BAS: More name compatibility changes
This commit is contained in:
parent
6e013e76fc
commit
799de0c6b5
@ -140,7 +140,7 @@ static enum
|
|||||||
} g_pass;
|
} g_pass;
|
||||||
|
|
||||||
static int g_stopped;
|
static int g_stopped;
|
||||||
static int optionbase;
|
static int g_optionbase;
|
||||||
static struct Pc g_pc;
|
static struct Pc g_pc;
|
||||||
static struct Auto g_stack;
|
static struct Auto g_stack;
|
||||||
static struct Program g_program;
|
static struct Program g_program;
|
||||||
@ -1539,7 +1539,7 @@ static void new(void)
|
|||||||
Program_destroy(&g_program);
|
Program_destroy(&g_program);
|
||||||
Program_new(&g_program);
|
Program_new(&g_program);
|
||||||
FS_closefiles();
|
FS_closefiles();
|
||||||
optionbase = 0;
|
g_optionbase = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pushLabel(enum labeltype_e type, struct Pc *patch)
|
static void pushLabel(enum labeltype_e type, struct Pc *patch)
|
||||||
@ -1917,7 +1917,7 @@ static struct Value *compileProgram(struct Value *v, int clearGlobals)
|
|||||||
g_lastdata = &g_stack.begindata;
|
g_lastdata = &g_stack.begindata;
|
||||||
}
|
}
|
||||||
|
|
||||||
optionbase = 0;
|
g_optionbase = 0;
|
||||||
g_stopped = 0;
|
g_stopped = 0;
|
||||||
g_program.runnable = 1;
|
g_program.runnable = 1;
|
||||||
g_pc = begin;
|
g_pc = begin;
|
||||||
@ -1989,7 +1989,7 @@ static void runline(struct Token *line)
|
|||||||
g_curdata.line = -1;
|
g_curdata.line = -1;
|
||||||
g_pc.line = -1;
|
g_pc.line = -1;
|
||||||
g_pc.token = line;
|
g_pc.token = line;
|
||||||
optionbase = 0;
|
g_optionbase = 0;
|
||||||
g_stopped = 0;
|
g_stopped = 0;
|
||||||
statements(&value);
|
statements(&value);
|
||||||
if (value.type != V_ERROR && g_pc.token->type != T_EOL)
|
if (value.type != V_ERROR && g_pc.token->type != T_EOL)
|
||||||
@ -2029,7 +2029,7 @@ static void runline(struct Token *line)
|
|||||||
|
|
||||||
g_pc.line = -1;
|
g_pc.line = -1;
|
||||||
g_pc.token = line;
|
g_pc.token = line;
|
||||||
optionbase = 0;
|
g_optionbase = 0;
|
||||||
g_curdata = g_stack.begindata;
|
g_curdata = g_stack.begindata;
|
||||||
g_nextdata.line = -1;
|
g_nextdata.line = -1;
|
||||||
Value_destroy(&value);
|
Value_destroy(&value);
|
||||||
@ -2092,14 +2092,14 @@ static struct Value *evalGeometry(struct Value *value, unsigned int *dim,
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_pass == INTERPRET && value->u.integer < optionbase)
|
if (g_pass == INTERPRET && value->u.integer < g_optionbase)
|
||||||
{
|
{
|
||||||
Value_destroy(value);
|
Value_destroy(value);
|
||||||
g_pc = exprpc;
|
g_pc = exprpc;
|
||||||
return Value_new_ERROR(value, OUTOFRANGE, _("dimension"));
|
return Value_new_ERROR(value, OUTOFRANGE, _("dimension"));
|
||||||
}
|
}
|
||||||
|
|
||||||
geometry[0] = value->u.integer - optionbase + 1;
|
geometry[0] = value->u.integer - g_optionbase + 1;
|
||||||
Value_destroy(value);
|
Value_destroy(value);
|
||||||
if (g_pc.token->type == T_COMMA)
|
if (g_pc.token->type == T_COMMA)
|
||||||
{
|
{
|
||||||
@ -2111,14 +2111,14 @@ static struct Value *evalGeometry(struct Value *value, unsigned int *dim,
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_pass == INTERPRET && value->u.integer < optionbase)
|
if (g_pass == INTERPRET && value->u.integer < g_optionbase)
|
||||||
{
|
{
|
||||||
Value_destroy(value);
|
Value_destroy(value);
|
||||||
g_pc = exprpc;
|
g_pc = exprpc;
|
||||||
return Value_new_ERROR(value, OUTOFRANGE, _("dimension"));
|
return Value_new_ERROR(value, OUTOFRANGE, _("dimension"));
|
||||||
}
|
}
|
||||||
|
|
||||||
geometry[1] = value->u.integer - optionbase + 1;
|
geometry[1] = value->u.integer - g_optionbase + 1;
|
||||||
Value_destroy(value);
|
Value_destroy(value);
|
||||||
*dim = 2;
|
*dim = 2;
|
||||||
}
|
}
|
||||||
|
@ -907,7 +907,7 @@ struct Value *stmt_DIM(struct Value *value)
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_pass == INTERPRET && value->u.integer < optionbase) /* error */
|
if (g_pass == INTERPRET && value->u.integer < g_optionbase) /* error */
|
||||||
{
|
{
|
||||||
Value_destroy(value);
|
Value_destroy(value);
|
||||||
Value_new_ERROR(value, OUTOFRANGE, _("dimension"));
|
Value_new_ERROR(value, OUTOFRANGE, _("dimension"));
|
||||||
@ -937,7 +937,7 @@ struct Value *stmt_DIM(struct Value *value)
|
|||||||
geometry = more;
|
geometry = more;
|
||||||
}
|
}
|
||||||
|
|
||||||
geometry[dim] = value->u.integer - optionbase + 1;
|
geometry[dim] = value->u.integer - g_optionbase + 1;
|
||||||
++dim;
|
++dim;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -968,7 +968,7 @@ struct Value *stmt_DIM(struct Value *value)
|
|||||||
struct Var newarray;
|
struct Var newarray;
|
||||||
|
|
||||||
assert(capacity);
|
assert(capacity);
|
||||||
if (Var_new(&newarray, vartype, dim, geometry, optionbase) ==
|
if (Var_new(&newarray, vartype, dim, geometry, g_optionbase) ==
|
||||||
(struct Var *)0)
|
(struct Var *)0)
|
||||||
{
|
{
|
||||||
free(geometry);
|
free(geometry);
|
||||||
@ -3296,7 +3296,7 @@ struct Value *stmt_MAT(struct Value *value)
|
|||||||
if (g_pass == INTERPRET)
|
if (g_pass == INTERPRET)
|
||||||
{
|
{
|
||||||
Var_destroy(var1);
|
Var_destroy(var1);
|
||||||
Var_new(var1, vartype, dim, geometry, optionbase);
|
Var_new(var1, vartype, dim, geometry, g_optionbase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3529,7 +3529,7 @@ struct Value *stmt_MATINPUT(struct Value *value)
|
|||||||
if (g_pass == INTERPRET)
|
if (g_pass == INTERPRET)
|
||||||
{
|
{
|
||||||
Var_destroy(var);
|
Var_destroy(var);
|
||||||
Var_new(var, vartype, dim, geometry, optionbase);
|
Var_new(var, vartype, dim, geometry, g_optionbase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3859,7 +3859,7 @@ struct Value *stmt_MATREAD(struct Value *value)
|
|||||||
if (g_pass == INTERPRET)
|
if (g_pass == INTERPRET)
|
||||||
{
|
{
|
||||||
Var_destroy(var);
|
Var_destroy(var);
|
||||||
Var_new(var, vartype, dim, geometry, optionbase);
|
Var_new(var, vartype, dim, geometry, g_optionbase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4796,7 +4796,7 @@ struct Value *stmt_OPTIONBASE(struct Value *value)
|
|||||||
|
|
||||||
if (g_pass == INTERPRET)
|
if (g_pass == INTERPRET)
|
||||||
{
|
{
|
||||||
optionbase = value->u.integer;
|
g_optionbase = value->u.integer;
|
||||||
}
|
}
|
||||||
|
|
||||||
Value_destroy(value);
|
Value_destroy(value);
|
||||||
|
@ -1403,11 +1403,11 @@ char *yytext;
|
|||||||
#include "token.h"
|
#include "token.h"
|
||||||
#include "statement.h"
|
#include "statement.h"
|
||||||
|
|
||||||
static int matchdata;
|
static int g_matchdata;
|
||||||
static int backslash_colon;
|
static int g_backslash_colon;
|
||||||
static int uppercase;
|
static int g_uppercase;
|
||||||
int yylex(void);
|
|
||||||
static struct Token *cur;
|
static struct Token *cur;
|
||||||
|
int yylex(void);
|
||||||
|
|
||||||
static void string(const char *text) /*{{{*/
|
static void string(const char *text) /*{{{*/
|
||||||
{
|
{
|
||||||
@ -1673,7 +1673,7 @@ YY_DECL
|
|||||||
#line 102 "token.l"
|
#line 102 "token.l"
|
||||||
|
|
||||||
/* flex rules */ /*{{{*/
|
/* flex rules */ /*{{{*/
|
||||||
if (matchdata) BEGIN(DATAINPUT);
|
if (g_matchdata) BEGIN(DATAINPUT);
|
||||||
|
|
||||||
#line 1683 "<stdout>"
|
#line 1683 "<stdout>"
|
||||||
|
|
||||||
@ -1872,7 +1872,7 @@ case 15:
|
|||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 180 "token.l"
|
#line 180 "token.l"
|
||||||
{
|
{
|
||||||
if (backslash_colon)
|
if (g_backslash_colon)
|
||||||
{
|
{
|
||||||
if (cur) cur->statement=stmt_COLON_EOL;
|
if (cur) cur->statement=stmt_COLON_EOL;
|
||||||
return T_COLON;
|
return T_COLON;
|
||||||
@ -4674,7 +4674,7 @@ void yyfree (void * ptr )
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int Token_property[T_LASTTOKEN];
|
int g_token_property[T_LASTTOKEN];
|
||||||
|
|
||||||
struct Token *Token_newCode(const char *ln) /*{{{*/
|
struct Token *Token_newCode(const char *ln) /*{{{*/
|
||||||
{
|
{
|
||||||
@ -4685,7 +4685,7 @@ struct Token *Token_newCode(const char *ln) /*{{{*/
|
|||||||
cur=(struct Token*)0;
|
cur=(struct Token*)0;
|
||||||
buf=yy_scan_string(ln);
|
buf=yy_scan_string(ln);
|
||||||
/* determine number of tokens */ /*{{{*/
|
/* determine number of tokens */ /*{{{*/
|
||||||
matchdata=sawif=0;
|
g_matchdata=sawif=0;
|
||||||
for (lasttok=T_EOL,l=1; (thistok=yylex()); ++l)
|
for (lasttok=T_EOL,l=1; (thistok=yylex()); ++l)
|
||||||
{
|
{
|
||||||
if (l==1 && thistok!=T_INTEGER) { addNumber=1; ++l; }
|
if (l==1 && thistok!=T_INTEGER) { addNumber=1; ++l; }
|
||||||
@ -4706,7 +4706,7 @@ struct Token *Token_newCode(const char *ln) /*{{{*/
|
|||||||
}
|
}
|
||||||
buf=yy_scan_string(ln);
|
buf=yy_scan_string(ln);
|
||||||
lasttok=T_EOL;
|
lasttok=T_EOL;
|
||||||
matchdata=sawif=0;
|
g_matchdata=sawif=0;
|
||||||
while (cur->statement=NULL,(cur->type=yylex()))
|
while (cur->statement=NULL,(cur->type=yylex()))
|
||||||
{
|
{
|
||||||
if (cur->type==T_IF) sawif=1;
|
if (cur->type==T_IF) sawif=1;
|
||||||
@ -4747,12 +4747,12 @@ struct Token *Token_newData(const char *ln) /*{{{*/
|
|||||||
|
|
||||||
cur=(struct Token*)0;
|
cur=(struct Token*)0;
|
||||||
buf=yy_scan_string(ln);
|
buf=yy_scan_string(ln);
|
||||||
matchdata=1;
|
g_matchdata=1;
|
||||||
for (l=1; yylex(); ++l);
|
for (l=1; yylex(); ++l);
|
||||||
yy_delete_buffer(buf);
|
yy_delete_buffer(buf);
|
||||||
cur=result=malloc(sizeof(struct Token)*l);
|
cur=result=malloc(sizeof(struct Token)*l);
|
||||||
buf=yy_scan_string(ln);
|
buf=yy_scan_string(ln);
|
||||||
matchdata=1;
|
g_matchdata=1;
|
||||||
while (cur->statement=NULL,(cur->type=yylex())) ++cur;
|
while (cur->statement=NULL,(cur->type=yylex())) ++cur;
|
||||||
cur->type=T_EOL;
|
cur->type=T_EOL;
|
||||||
cur->statement=stmt_COLON_EOL;
|
cur->statement=stmt_COLON_EOL;
|
||||||
@ -5317,7 +5317,7 @@ struct String *Token_toString(struct Token *token, struct Token *spaceto, struct
|
|||||||
if ((token->u.real<((double)LONG_MIN)) || (token->u.real>((double)LONG_MAX))) String_appendChar(s,'!');
|
if ((token->u.real<((double)LONG_MIN)) || (token->u.real>((double)LONG_MAX))) String_appendChar(s,'!');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case T_REM: String_appendPrintf(s,"%s%s",uppercase?"REM":"rem",token->u.rem); break;
|
case T_REM: String_appendPrintf(s,"%s%s",g_uppercase?"REM":"rem",token->u.rem); break;
|
||||||
case T_QUOTE: String_appendPrintf(s,"'%s",token->u.rem); break;
|
case T_QUOTE: String_appendPrintf(s,"'%s",token->u.rem); break;
|
||||||
case T_STRING: /*{{{*/
|
case T_STRING: /*{{{*/
|
||||||
{
|
{
|
||||||
@ -5337,7 +5337,7 @@ struct String *Token_toString(struct Token *token, struct Token *spaceto, struct
|
|||||||
/*}}}*/
|
/*}}}*/
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
if (uppercase)
|
if (g_uppercase)
|
||||||
{
|
{
|
||||||
struct String u;
|
struct String u;
|
||||||
|
|
||||||
@ -5360,10 +5360,10 @@ struct String *Token_toString(struct Token *token, struct Token *spaceto, struct
|
|||||||
void Token_init(int b_c, int uc) /*{{{*/
|
void Token_init(int b_c, int uc) /*{{{*/
|
||||||
{
|
{
|
||||||
#define PROPERTY(t,assoc,unary_priority,binary_priority,is_unary,is_binary) \
|
#define PROPERTY(t,assoc,unary_priority,binary_priority,is_unary,is_binary) \
|
||||||
Token_property[t]=(assoc<<8)|(unary_priority<<5)|(binary_priority<<2)|(is_unary<<1)|is_binary
|
g_token_property[t]=(assoc<<8)|(unary_priority<<5)|(binary_priority<<2)|(is_unary<<1)|is_binary
|
||||||
|
|
||||||
backslash_colon=b_c;
|
g_backslash_colon=b_c;
|
||||||
uppercase=uc;
|
g_uppercase=uc;
|
||||||
PROPERTY(T_POW, 1,0,7,0,1);
|
PROPERTY(T_POW, 1,0,7,0,1);
|
||||||
PROPERTY(T_MULT, 0,0,5,0,1);
|
PROPERTY(T_MULT, 0,0,5,0,1);
|
||||||
PROPERTY(T_DIV, 0,0,5,0,1);
|
PROPERTY(T_DIV, 0,0,5,0,1);
|
||||||
|
@ -71,11 +71,11 @@
|
|||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#define TOKEN_ISBINARYOPERATOR(t) (Token_property[t]&1)
|
#define TOKEN_ISBINARYOPERATOR(t) (g_token_property[t]&1)
|
||||||
#define TOKEN_ISUNARYOPERATOR(t) (Token_property[t]&(1<<1))
|
#define TOKEN_ISUNARYOPERATOR(t) (g_token_property[t]&(1<<1))
|
||||||
#define TOKEN_BINARYPRIORITY(t) ((Token_property[t]>>2)&7)
|
#define TOKEN_BINARYPRIORITY(t) ((g_token_property[t]>>2)&7)
|
||||||
#define TOKEN_UNARYPRIORITY(t) ((Token_property[t]>>5)&7)
|
#define TOKEN_UNARYPRIORITY(t) ((g_token_property[t]>>5)&7)
|
||||||
#define TOKEN_ISRIGHTASSOCIATIVE(t) (Token_property[t]&(1<<8))
|
#define TOKEN_ISRIGHTASSOCIATIVE(t) (g_token_property[t]&(1<<8))
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Types
|
* Public Types
|
||||||
@ -530,7 +530,7 @@ struct Token
|
|||||||
* Public Data
|
* Public Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
extern int Token_property[];
|
extern int g_token_property[];
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Function Prototypes
|
* Public Function Prototypes
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user