"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "global.c" between
bas-2.5.tar.gz and bas-2.6.tar.gz

About: bas is an interpreter for the programming language BASIC.

global.c  (bas-2.5):global.c  (bas-2.6)
skipping to change at line 409 skipping to change at line 409
if (overflow || a<0) return Value_new_ERROR(v,OUTOFRANGE,_("argument number")) ; if (overflow || a<0) return Value_new_ERROR(v,OUTOFRANGE,_("argument number")) ;
Value_new_STRING(v); Value_new_STRING(v);
if (a==0) if (a==0)
{ {
if (bas_argv0!=(char*)0) String_appendChars(&v->u.string,bas_argv0); if (bas_argv0!=(char*)0) String_appendChars(&v->u.string,bas_argv0);
} }
else if (a<=bas_argc) String_appendChars(&v->u.string,bas_argv[a-1]); else if (a<=bas_argc) String_appendChars(&v->u.string,bas_argv[a-1]);
return v; return v;
} }
/*}}}*/ /*}}}*/
static struct Value *fn_cvd(struct Value *v, struct Auto *stack) /*{{{*/
{
struct String *s=stringValue(stack,0);
double n;
if (s->length!=sizeof(double)) return Value_new_ERROR(v,BADCONVERSION,_("numbe
r"));
memcpy(&n,s->character,sizeof(double));
return Value_new_REAL(v,n);
}
/*}}}*/
static struct Value *fn_cvi(struct Value *v, struct Auto *stack) /*{{{*/ static struct Value *fn_cvi(struct Value *v, struct Auto *stack) /*{{{*/
{ {
struct String *s=stringValue(stack,0); struct String *s=stringValue(stack,0);
long int n=(s->length && s->character[s->length-1]<0) ? -1 : 0; long int n=(s->length && s->character[s->length-1]<0) ? -1 : 0;
int i; int i;
for (i=s->length-1; i>=0; --i) n=(n<<8)|(s->character[i]&0xff); for (i=s->length-1; i>=0; --i) n=(n<<8)|(s->character[i]&0xff);
return Value_new_INTEGER(v,n); return Value_new_INTEGER(v,n);
} }
/*}}}*/ /*}}}*/
static struct Value *fn_cvs(struct Value *v, struct Auto *stack) /*{{{*/ static struct Value *fn_cvs(struct Value *v, struct Auto *stack) /*{{{*/
{ {
struct String *s=stringValue(stack,0); struct String *s=stringValue(stack,0);
float n; float n;
if (s->length!=sizeof(float)) return Value_new_ERROR(v,BADCONVERSION,_("number ")); if (s->length!=sizeof(float)) return Value_new_ERROR(v,BADCONVERSION,_("number "));
memcpy(&n,s->character,sizeof(float)); memcpy(&n,s->character,sizeof(float));
return Value_new_REAL(v,(double)n); return Value_new_REAL(v,(double)n);
} }
/*}}}*/ /*}}}*/
static struct Value *fn_cvd(struct Value *v, struct Auto *stack) /*{{{*/
{
struct String *s=stringValue(stack,0);
double n;
if (s->length!=sizeof(double)) return Value_new_ERROR(v,BADCONVERSION,_("numbe
r"));
memcpy(&n,s->character,sizeof(double));
return Value_new_REAL(v,n);
}
/*}}}*/
static struct Value *fn_date(struct Value *v, struct Auto *stack) /*{{{*/ static struct Value *fn_date(struct Value *v, struct Auto *stack) /*{{{*/
{ {
time_t t; time_t t;
struct tm *now; struct tm *now;
Value_new_STRING(v); Value_new_STRING(v);
String_size(&v->u.string,10); String_size(&v->u.string,10);
time(&t); time(&t);
now=localtime(&t); now=localtime(&t);
sprintf(v->u.string.character,"%02d-%02d-%04d",now->tm_mon+1,now->tm_mday,now- >tm_year+1900); sprintf(v->u.string.character,"%02d-%02d-%04d",now->tm_mon+1,now->tm_mday,now- >tm_year+1900);
skipping to change at line 1478 skipping to change at line 1478
builtin(this,"bin$", V_STRING, fn_bindi, 2,V_REAL,V_INTEGER); builtin(this,"bin$", V_STRING, fn_bindi, 2,V_REAL,V_INTEGER);
builtin(this,"bin$", V_STRING, fn_binid, 2,V_INTEGER,V_REAL); builtin(this,"bin$", V_STRING, fn_binid, 2,V_INTEGER,V_REAL);
builtin(this,"bin$", V_STRING, fn_bindd, 2,V_REAL,V_REAL); builtin(this,"bin$", V_STRING, fn_bindd, 2,V_REAL,V_REAL);
builtin(this,"chr$", V_STRING, fn_chr, 1,V_INTEGER); builtin(this,"chr$", V_STRING, fn_chr, 1,V_INTEGER);
builtin(this,"cint", V_REAL, fn_cint, 1,V_REAL); builtin(this,"cint", V_REAL, fn_cint, 1,V_REAL);
builtin(this,"code", V_INTEGER,fn_asc, 1,V_STRING); builtin(this,"code", V_INTEGER,fn_asc, 1,V_STRING);
builtin(this,"command$",V_STRING, fn_command, 0); builtin(this,"command$",V_STRING, fn_command, 0);
builtin(this,"command$",V_STRING, fn_commandi, 1,V_INTEGER); builtin(this,"command$",V_STRING, fn_commandi, 1,V_INTEGER);
builtin(this,"command$",V_STRING, fn_commandd, 1,V_REAL); builtin(this,"command$",V_STRING, fn_commandd, 1,V_REAL);
builtin(this,"cos", V_REAL, fn_cos, 1,V_REAL); builtin(this,"cos", V_REAL, fn_cos, 1,V_REAL);
builtin(this,"cvd", V_REAL, fn_cvd, 1,V_STRING);
builtin(this,"cvi", V_INTEGER,fn_cvi, 1,V_STRING); builtin(this,"cvi", V_INTEGER,fn_cvi, 1,V_STRING);
builtin(this,"cvs", V_REAL, fn_cvs, 1,V_STRING); builtin(this,"cvs", V_REAL, fn_cvs, 1,V_STRING);
builtin(this,"cvd", V_REAL, fn_cvd, 1,V_STRING);
builtin(this,"date$", V_STRING, fn_date, 0); builtin(this,"date$", V_STRING, fn_date, 0);
builtin(this,"dec$", V_STRING, fn_dec, 2,V_REAL,V_STRING); builtin(this,"dec$", V_STRING, fn_dec, 2,V_REAL,V_STRING);
builtin(this,"dec$", V_STRING, fn_dec, 2,V_INTEGER,V_STRING); builtin(this,"dec$", V_STRING, fn_dec, 2,V_INTEGER,V_STRING);
builtin(this,"dec$", V_STRING, fn_dec, 2,V_STRING,V_STRING); builtin(this,"dec$", V_STRING, fn_dec, 2,V_STRING,V_STRING);
builtin(this,"deg", V_REAL, fn_deg, 1,V_REAL); builtin(this,"deg", V_REAL, fn_deg, 1,V_REAL);
builtin(this,"det", V_REAL, fn_det, 0); builtin(this,"det", V_REAL, fn_det, 0);
builtin(this,"edit$", V_STRING, fn_edit, 2,V_STRING,V_INTEGER); builtin(this,"edit$", V_STRING, fn_edit, 2,V_STRING,V_INTEGER);
builtin(this,"environ$",V_STRING, fn_environi, 1,V_INTEGER); builtin(this,"environ$",V_STRING, fn_environi, 1,V_INTEGER);
builtin(this,"environ$",V_STRING, fn_environd, 1,V_REAL); builtin(this,"environ$",V_STRING, fn_environd, 1,V_REAL);
builtin(this,"environ$",V_STRING, fn_environs, 1,V_STRING); builtin(this,"environ$",V_STRING, fn_environs, 1,V_STRING);
 End of changes. 4 change blocks. 
12 lines changed or deleted 12 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)