forked from enlightenment/efl
parent
b8d6ef0f60
commit
8b6e8a16c9
|
@ -427,9 +427,6 @@ typedef struct __s_stringpair
|
||||||
/* by default, functions and variables used in throughout the compiler
|
/* by default, functions and variables used in throughout the compiler
|
||||||
* files are "external"
|
* files are "external"
|
||||||
*/
|
*/
|
||||||
#if !defined SC_FUNC
|
|
||||||
#define SC_FUNC
|
|
||||||
#endif
|
|
||||||
#if !defined SC_VDECL
|
#if !defined SC_VDECL
|
||||||
#define SC_VDECL extern
|
#define SC_VDECL extern
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1671,7 +1671,7 @@ decl_enum(int vclass)
|
||||||
* Finds a function in the global symbol table or creates a new entry.
|
* Finds a function in the global symbol table or creates a new entry.
|
||||||
* It does some basic processing and error checking.
|
* It does some basic processing and error checking.
|
||||||
*/
|
*/
|
||||||
SC_FUNC symbol *
|
symbol *
|
||||||
fetchfunc(char *name, int tag)
|
fetchfunc(char *name, int tag)
|
||||||
{
|
{
|
||||||
symbol *sym;
|
symbol *sym;
|
||||||
|
@ -1952,7 +1952,7 @@ tag2str(char *dest, int tag)
|
||||||
return isdigit(dest[1]) ? &dest[1] : dest;
|
return isdigit(dest[1]) ? &dest[1] : dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC char *
|
char *
|
||||||
operator_symname(char *symname, char *opername, int tag1, int tag2,
|
operator_symname(char *symname, char *opername, int tag1, int tag2,
|
||||||
int numtags, int resulttag)
|
int numtags, int resulttag)
|
||||||
{
|
{
|
||||||
|
@ -2002,7 +2002,7 @@ parse_funcname(char *fname, int *tag1, int *tag2, char *opname)
|
||||||
return unary;
|
return unary;
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC char *
|
char *
|
||||||
funcdisplayname(char *dest, char *funcname)
|
funcdisplayname(char *dest, char *funcname)
|
||||||
{
|
{
|
||||||
int tags[2];
|
int tags[2];
|
||||||
|
@ -3028,7 +3028,7 @@ insert_constval(constvalue * prev, constvalue * next, char *name,
|
||||||
return cur;
|
return cur;
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC constvalue *
|
constvalue *
|
||||||
append_constval(constvalue * table, char *name, cell val, short index)
|
append_constval(constvalue * table, char *name, cell val, short index)
|
||||||
{
|
{
|
||||||
constvalue *cur, *prev;
|
constvalue *cur, *prev;
|
||||||
|
@ -3040,7 +3040,7 @@ append_constval(constvalue * table, char *name, cell val, short index)
|
||||||
return insert_constval(prev, NULL, name, val, index);
|
return insert_constval(prev, NULL, name, val, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC constvalue *
|
constvalue *
|
||||||
find_constval(constvalue * table, char *name, short index)
|
find_constval(constvalue * table, char *name, short index)
|
||||||
{
|
{
|
||||||
constvalue *ptr = table->next;
|
constvalue *ptr = table->next;
|
||||||
|
@ -3090,7 +3090,7 @@ delete_constval(constvalue * table, char *name)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SC_FUNC void
|
void
|
||||||
delete_consttable(constvalue * table)
|
delete_consttable(constvalue * table)
|
||||||
{
|
{
|
||||||
constvalue *cur = table->next, *next;
|
constvalue *cur = table->next, *next;
|
||||||
|
@ -3108,7 +3108,7 @@ delete_consttable(constvalue * table)
|
||||||
*
|
*
|
||||||
* Adds a symbol to the #define symbol table.
|
* Adds a symbol to the #define symbol table.
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
add_constant(char *name, cell val, int vclass, int tag)
|
add_constant(char *name, cell val, int vclass, int tag)
|
||||||
{
|
{
|
||||||
symbol *sym;
|
symbol *sym;
|
||||||
|
@ -3366,7 +3366,7 @@ doexpr(int comma, int chkeffect, int allowarray, int mark_endexpr,
|
||||||
|
|
||||||
/* constexpr
|
/* constexpr
|
||||||
*/
|
*/
|
||||||
SC_FUNC int
|
int
|
||||||
constexpr(cell * val, int *tag)
|
constexpr(cell * val, int *tag)
|
||||||
{
|
{
|
||||||
int constant, index;
|
int constant, index;
|
||||||
|
@ -3982,7 +3982,7 @@ docont(void)
|
||||||
jumplabel(ptr[wqLOOP]);
|
jumplabel(ptr[wqLOOP]);
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC void
|
void
|
||||||
exporttag(int tag)
|
exporttag(int tag)
|
||||||
{
|
{
|
||||||
/* find the tag by value in the table, then set the top bit to mark it
|
/* find the tag by value in the table, then set the top bit to mark it
|
||||||
|
|
|
@ -58,7 +58,7 @@ static int listline = -1; /* "current line" for the list file */
|
||||||
*/
|
*/
|
||||||
static stkitem stack[sSTKMAX];
|
static stkitem stack[sSTKMAX];
|
||||||
static int stkidx;
|
static int stkidx;
|
||||||
SC_FUNC void
|
void
|
||||||
pushstk(stkitem val)
|
pushstk(stkitem val)
|
||||||
{
|
{
|
||||||
if (stkidx >= sSTKMAX)
|
if (stkidx >= sSTKMAX)
|
||||||
|
@ -67,7 +67,7 @@ pushstk(stkitem val)
|
||||||
stkidx += 1;
|
stkidx += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC stkitem
|
stkitem
|
||||||
popstk(void)
|
popstk(void)
|
||||||
{
|
{
|
||||||
if (stkidx == 0)
|
if (stkidx == 0)
|
||||||
|
@ -76,7 +76,7 @@ popstk(void)
|
||||||
return stack[stkidx];
|
return stack[stkidx];
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC int
|
int
|
||||||
plungequalifiedfile(char *name)
|
plungequalifiedfile(char *name)
|
||||||
{
|
{
|
||||||
static char *extensions[] = { ".inc", ".sma", ".small" };
|
static char *extensions[] = { ".inc", ".sma", ".small" };
|
||||||
|
@ -131,7 +131,7 @@ plungequalifiedfile(char *name)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC int
|
int
|
||||||
plungefile(char *name, int try_currentpath, int try_includepaths)
|
plungefile(char *name, int try_currentpath, int try_includepaths)
|
||||||
{
|
{
|
||||||
int result = FALSE;
|
int result = FALSE;
|
||||||
|
@ -1692,7 +1692,7 @@ substallpatterns(char *line, int buffersize)
|
||||||
* pline (altered)
|
* pline (altered)
|
||||||
* freading (referred to only)
|
* freading (referred to only)
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
preprocess(void)
|
preprocess(void)
|
||||||
{
|
{
|
||||||
int iscommand;
|
int iscommand;
|
||||||
|
@ -1836,7 +1836,7 @@ static cell _lexval;
|
||||||
static char _lexstr[sLINEMAX + 1];
|
static char _lexstr[sLINEMAX + 1];
|
||||||
static int _lexnewline;
|
static int _lexnewline;
|
||||||
|
|
||||||
SC_FUNC void
|
void
|
||||||
lexinit(void)
|
lexinit(void)
|
||||||
{
|
{
|
||||||
stkidx = 0; /* index for pushstk() and popstk() */
|
stkidx = 0; /* index for pushstk() and popstk() */
|
||||||
|
@ -1861,7 +1861,7 @@ char *sc_tokens[] = {
|
||||||
"-label-", "-string-"
|
"-label-", "-string-"
|
||||||
};
|
};
|
||||||
|
|
||||||
SC_FUNC int
|
int
|
||||||
lex(cell * lexvalue, char **lexsym)
|
lex(cell * lexvalue, char **lexsym)
|
||||||
{
|
{
|
||||||
int i, toolong, newline, rawstring;
|
int i, toolong, newline, rawstring;
|
||||||
|
@ -2055,7 +2055,7 @@ lex(cell * lexvalue, char **lexsym)
|
||||||
* to read and return the information from these variables, rather than
|
* to read and return the information from these variables, rather than
|
||||||
* to read in a new token from the input file.
|
* to read in a new token from the input file.
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
lexpush(void)
|
lexpush(void)
|
||||||
{
|
{
|
||||||
assert(_pushed == FALSE);
|
assert(_pushed == FALSE);
|
||||||
|
@ -2068,7 +2068,7 @@ lexpush(void)
|
||||||
* symbol (a not continue with some old one). This is required upon return
|
* symbol (a not continue with some old one). This is required upon return
|
||||||
* from Assembler mode.
|
* from Assembler mode.
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
lexclr(int clreol)
|
lexclr(int clreol)
|
||||||
{
|
{
|
||||||
_pushed = FALSE;
|
_pushed = FALSE;
|
||||||
|
@ -2084,7 +2084,7 @@ lexclr(int clreol)
|
||||||
* This routine is useful if only a simple check is needed. If the token
|
* This routine is useful if only a simple check is needed. If the token
|
||||||
* differs from the one expected, it is pushed back.
|
* differs from the one expected, it is pushed back.
|
||||||
*/
|
*/
|
||||||
SC_FUNC int
|
int
|
||||||
matchtoken(int token)
|
matchtoken(int token)
|
||||||
{
|
{
|
||||||
cell val;
|
cell val;
|
||||||
|
@ -2116,7 +2116,7 @@ matchtoken(int token)
|
||||||
*
|
*
|
||||||
* The token itself is the return value. Normally, this one is already known.
|
* The token itself is the return value. Normally, this one is already known.
|
||||||
*/
|
*/
|
||||||
SC_FUNC int
|
int
|
||||||
tokeninfo(cell * val, char **str)
|
tokeninfo(cell * val, char **str)
|
||||||
{
|
{
|
||||||
/* if the token was pushed back, tokeninfo() returns the token and
|
/* if the token was pushed back, tokeninfo() returns the token and
|
||||||
|
@ -2135,7 +2135,7 @@ tokeninfo(cell * val, char **str)
|
||||||
*
|
*
|
||||||
* Global references: _lextok;
|
* Global references: _lextok;
|
||||||
*/
|
*/
|
||||||
SC_FUNC int
|
int
|
||||||
needtoken(int token)
|
needtoken(int token)
|
||||||
{
|
{
|
||||||
char s1[20], s2[20];
|
char s1[20], s2[20];
|
||||||
|
@ -2207,7 +2207,7 @@ match(char *st, int end)
|
||||||
* Global references: litidx (altered)
|
* Global references: litidx (altered)
|
||||||
* litq (altered)
|
* litq (altered)
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
stowlit(cell value)
|
stowlit(cell value)
|
||||||
{
|
{
|
||||||
if (litidx >= litmax)
|
if (litidx >= litmax)
|
||||||
|
@ -2331,7 +2331,7 @@ alpha(char c)
|
||||||
*
|
*
|
||||||
* Test if character "c" is alphanumeric ("a".."z", "0".."9", "_" or "@")
|
* Test if character "c" is alphanumeric ("a".."z", "0".."9", "_" or "@")
|
||||||
*/
|
*/
|
||||||
SC_FUNC int
|
int
|
||||||
alphanum(char c)
|
alphanum(char c)
|
||||||
{
|
{
|
||||||
return (alpha(c) || isdigit(c));
|
return (alpha(c) || isdigit(c));
|
||||||
|
@ -2395,7 +2395,7 @@ free_symbol(symbol * sym)
|
||||||
free(sym);
|
free(sym);
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC void
|
void
|
||||||
delete_symbol(symbol * root, symbol * sym)
|
delete_symbol(symbol * root, symbol * sym)
|
||||||
{
|
{
|
||||||
/* find the symbol and its predecessor
|
/* find the symbol and its predecessor
|
||||||
|
@ -2414,7 +2414,7 @@ delete_symbol(symbol * root, symbol * sym)
|
||||||
free_symbol(sym);
|
free_symbol(sym);
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC void
|
void
|
||||||
delete_symbols(symbol * root, int level, int delete_labels,
|
delete_symbols(symbol * root, int level, int delete_labels,
|
||||||
int delete_functions)
|
int delete_functions)
|
||||||
{
|
{
|
||||||
|
@ -2466,7 +2466,7 @@ delete_symbols(symbol * root, int level, int delete_labels,
|
||||||
* comparison (which is costly). There is little interest in avoiding
|
* comparison (which is costly). There is little interest in avoiding
|
||||||
* clusters in similar names, which is why this function is plain simple.
|
* clusters in similar names, which is why this function is plain simple.
|
||||||
*/
|
*/
|
||||||
SC_FUNC unsigned int
|
unsigned int
|
||||||
namehash(char *name)
|
namehash(char *name)
|
||||||
{
|
{
|
||||||
unsigned char *ptr = (unsigned char *)name;
|
unsigned char *ptr = (unsigned char *)name;
|
||||||
|
@ -2514,7 +2514,7 @@ find_symbol_child(symbol * root, symbol * sym)
|
||||||
* bywhom will be the function that uses a variable or that calls
|
* bywhom will be the function that uses a variable or that calls
|
||||||
* the function.
|
* the function.
|
||||||
*/
|
*/
|
||||||
SC_FUNC int
|
int
|
||||||
refer_symbol(symbol * entry, symbol * bywhom)
|
refer_symbol(symbol * entry, symbol * bywhom)
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
|
@ -2562,7 +2562,7 @@ refer_symbol(symbol * entry, symbol * bywhom)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC void
|
void
|
||||||
markusage(symbol * sym, int usage)
|
markusage(symbol * sym, int usage)
|
||||||
{
|
{
|
||||||
sym->usage |= (char)usage;
|
sym->usage |= (char)usage;
|
||||||
|
@ -2586,7 +2586,7 @@ markusage(symbol * sym, int usage)
|
||||||
*
|
*
|
||||||
* Returns a pointer to the global symbol (if found) or NULL (if not found)
|
* Returns a pointer to the global symbol (if found) or NULL (if not found)
|
||||||
*/
|
*/
|
||||||
SC_FUNC symbol *
|
symbol *
|
||||||
findglb(char *name)
|
findglb(char *name)
|
||||||
{
|
{
|
||||||
return find_symbol(&glbtab, name, fcurrent);
|
return find_symbol(&glbtab, name, fcurrent);
|
||||||
|
@ -2597,13 +2597,13 @@ findglb(char *name)
|
||||||
* Returns a pointer to the local symbol (if found) or NULL (if not found).
|
* Returns a pointer to the local symbol (if found) or NULL (if not found).
|
||||||
* See add_symbol() how the deepest nesting level is searched first.
|
* See add_symbol() how the deepest nesting level is searched first.
|
||||||
*/
|
*/
|
||||||
SC_FUNC symbol *
|
symbol *
|
||||||
findloc(char *name)
|
findloc(char *name)
|
||||||
{
|
{
|
||||||
return find_symbol(&loctab, name, -1);
|
return find_symbol(&loctab, name, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC symbol *
|
symbol *
|
||||||
findconst(char *name)
|
findconst(char *name)
|
||||||
{
|
{
|
||||||
symbol *sym;
|
symbol *sym;
|
||||||
|
@ -2617,7 +2617,7 @@ findconst(char *name)
|
||||||
return sym;
|
return sym;
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC symbol *
|
symbol *
|
||||||
finddepend(symbol * parent)
|
finddepend(symbol * parent)
|
||||||
{
|
{
|
||||||
symbol *sym;
|
symbol *sym;
|
||||||
|
@ -2633,7 +2633,7 @@ finddepend(symbol * parent)
|
||||||
* Adds a symbol to the symbol table (either global or local variables,
|
* Adds a symbol to the symbol table (either global or local variables,
|
||||||
* or global and local constants).
|
* or global and local constants).
|
||||||
*/
|
*/
|
||||||
SC_FUNC symbol *
|
symbol *
|
||||||
addsym(char *name, cell addr, int ident, int vclass, int tag, int usage)
|
addsym(char *name, cell addr, int ident, int vclass, int tag, int usage)
|
||||||
{
|
{
|
||||||
symbol entry, **refer;
|
symbol entry, **refer;
|
||||||
|
@ -2673,7 +2673,7 @@ addsym(char *name, cell addr, int ident, int vclass, int tag, int usage)
|
||||||
return add_symbol(&loctab, &entry, FALSE);
|
return add_symbol(&loctab, &entry, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC symbol *
|
symbol *
|
||||||
addvariable(char *name, cell addr, int ident, int vclass, int tag,
|
addvariable(char *name, cell addr, int ident, int vclass, int tag,
|
||||||
int dim[], int numdim, int idxtag[])
|
int dim[], int numdim, int idxtag[])
|
||||||
{
|
{
|
||||||
|
@ -2711,7 +2711,7 @@ addvariable(char *name, cell addr, int ident, int vclass, int tag,
|
||||||
*
|
*
|
||||||
* Return next available internal label number.
|
* Return next available internal label number.
|
||||||
*/
|
*/
|
||||||
SC_FUNC int
|
int
|
||||||
getlabel(void)
|
getlabel(void)
|
||||||
{
|
{
|
||||||
return labnum++;
|
return labnum++;
|
||||||
|
@ -2722,7 +2722,7 @@ getlabel(void)
|
||||||
* Converts a number to a hexadecimal string and returns a pointer to that
|
* Converts a number to a hexadecimal string and returns a pointer to that
|
||||||
* string.
|
* string.
|
||||||
*/
|
*/
|
||||||
SC_FUNC char *
|
char *
|
||||||
itoh(ucell val)
|
itoh(ucell val)
|
||||||
{
|
{
|
||||||
static char itohstr[15]; /* hex number is 10 characters long at most */
|
static char itohstr[15]; /* hex number is 10 characters long at most */
|
||||||
|
|
|
@ -116,7 +116,7 @@ nextop(int *opidx, int *list)
|
||||||
return FALSE; /* entire list scanned, nothing found */
|
return FALSE; /* entire list scanned, nothing found */
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC int
|
int
|
||||||
check_userop(void (*oper) (void), int tag1, int tag2, int numparam,
|
check_userop(void (*oper) (void), int tag1, int tag2, int numparam,
|
||||||
value * lval, int *resulttag)
|
value * lval, int *resulttag)
|
||||||
{
|
{
|
||||||
|
@ -318,7 +318,7 @@ check_userop(void (*oper) (void), int tag1, int tag2, int numparam,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC int
|
int
|
||||||
matchtag(int formaltag, int actualtag, int allowcoerce)
|
matchtag(int formaltag, int actualtag, int allowcoerce)
|
||||||
{
|
{
|
||||||
if (formaltag != actualtag)
|
if (formaltag != actualtag)
|
||||||
|
@ -752,7 +752,7 @@ calc(cell left, void (*oper) (), cell right, char *boolresult)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC int
|
int
|
||||||
expression(int *constant, cell * val, int *tag, int chkfuncresult)
|
expression(int *constant, cell * val, int *tag, int chkfuncresult)
|
||||||
{
|
{
|
||||||
value lval = { 0 };
|
value lval = { 0 };
|
||||||
|
@ -815,7 +815,7 @@ array_levelsize(symbol * sym, int level)
|
||||||
*
|
*
|
||||||
* Global references: intest (reffered to only)
|
* Global references: intest (reffered to only)
|
||||||
*/
|
*/
|
||||||
SC_FUNC int
|
int
|
||||||
hier14(value * lval1)
|
hier14(value * lval1)
|
||||||
{
|
{
|
||||||
int lvalue;
|
int lvalue;
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
* Today, the compiler simply generates a HALT instruction at address 0. So
|
* Today, the compiler simply generates a HALT instruction at address 0. So
|
||||||
* a subroutine can savely return to 0, and then encounter a HALT.
|
* a subroutine can savely return to 0, and then encounter a HALT.
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
writeleader(void)
|
writeleader(void)
|
||||||
{
|
{
|
||||||
assert(code_idx == 0);
|
assert(code_idx == 0);
|
||||||
|
@ -51,7 +51,7 @@ writeleader(void)
|
||||||
* code_idx (altered)
|
* code_idx (altered)
|
||||||
* glb_declared (altered)
|
* glb_declared (altered)
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
writetrailer(void)
|
writetrailer(void)
|
||||||
{
|
{
|
||||||
assert(sc_dataalign % opcodes(1) == 0); /* alignment must be a multiple of
|
assert(sc_dataalign % opcodes(1) == 0); /* alignment must be a multiple of
|
||||||
|
@ -94,7 +94,7 @@ writetrailer(void)
|
||||||
*
|
*
|
||||||
* Global references: curseg
|
* Global references: curseg
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
begcseg(void)
|
begcseg(void)
|
||||||
{
|
{
|
||||||
if (curseg != sIN_CSEG)
|
if (curseg != sIN_CSEG)
|
||||||
|
@ -111,7 +111,7 @@ begcseg(void)
|
||||||
*
|
*
|
||||||
* Global references: curseg
|
* Global references: curseg
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
begdseg(void)
|
begdseg(void)
|
||||||
{
|
{
|
||||||
if (curseg != sIN_DSEG)
|
if (curseg != sIN_DSEG)
|
||||||
|
@ -123,14 +123,14 @@ begdseg(void)
|
||||||
} /* if */
|
} /* if */
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC void
|
void
|
||||||
setactivefile(int fnumber)
|
setactivefile(int fnumber)
|
||||||
{
|
{
|
||||||
stgwrite("curfile ");
|
stgwrite("curfile ");
|
||||||
outval(fnumber, TRUE);
|
outval(fnumber, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC cell
|
cell
|
||||||
nameincells(char *name)
|
nameincells(char *name)
|
||||||
{
|
{
|
||||||
cell clen =
|
cell clen =
|
||||||
|
@ -138,7 +138,7 @@ nameincells(char *name)
|
||||||
return clen;
|
return clen;
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC void
|
void
|
||||||
setfile(char *name, int fileno)
|
setfile(char *name, int fileno)
|
||||||
{
|
{
|
||||||
if ((sc_debug & sSYMBOLIC) != 0)
|
if ((sc_debug & sSYMBOLIC) != 0)
|
||||||
|
@ -154,7 +154,7 @@ setfile(char *name, int fileno)
|
||||||
} /* if */
|
} /* if */
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC void
|
void
|
||||||
setline(int line, int fileno)
|
setline(int line, int fileno)
|
||||||
{
|
{
|
||||||
if ((sc_debug & (sSYMBOLIC | sCHKBOUNDS)) != 0)
|
if ((sc_debug & (sSYMBOLIC | sCHKBOUNDS)) != 0)
|
||||||
|
@ -173,7 +173,7 @@ setline(int line, int fileno)
|
||||||
*
|
*
|
||||||
* Post a code label (specified as a number), on a new line.
|
* Post a code label (specified as a number), on a new line.
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
setlabel(int number)
|
setlabel(int number)
|
||||||
{
|
{
|
||||||
assert(number >= 0);
|
assert(number >= 0);
|
||||||
|
@ -196,7 +196,7 @@ setlabel(int number)
|
||||||
* function parameter. This allows several simple optimizations by the peephole
|
* function parameter. This allows several simple optimizations by the peephole
|
||||||
* optimizer.
|
* optimizer.
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
endexpr(int fullexpr)
|
endexpr(int fullexpr)
|
||||||
{
|
{
|
||||||
if (fullexpr)
|
if (fullexpr)
|
||||||
|
@ -209,7 +209,7 @@ endexpr(int fullexpr)
|
||||||
*
|
*
|
||||||
* Global references: funcstatus (referred to only)
|
* Global references: funcstatus (referred to only)
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
startfunc(char *fname)
|
startfunc(char *fname)
|
||||||
{
|
{
|
||||||
stgwrite("\tproc");
|
stgwrite("\tproc");
|
||||||
|
@ -221,7 +221,7 @@ startfunc(char *fname)
|
||||||
*
|
*
|
||||||
* Declare a CODE ending point (function end)
|
* Declare a CODE ending point (function end)
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
endfunc(void)
|
endfunc(void)
|
||||||
{
|
{
|
||||||
stgwrite("\n"); /* skip a line */
|
stgwrite("\n"); /* skip a line */
|
||||||
|
@ -234,7 +234,7 @@ endfunc(void)
|
||||||
* be a power of 2, and this alignment must be done right after the frame
|
* be a power of 2, and this alignment must be done right after the frame
|
||||||
* is set up (before the first variable is declared)
|
* is set up (before the first variable is declared)
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
alignframe(int numbytes)
|
alignframe(int numbytes)
|
||||||
{
|
{
|
||||||
#if !defined NDEBUG
|
#if !defined NDEBUG
|
||||||
|
@ -258,7 +258,7 @@ alignframe(int numbytes)
|
||||||
|
|
||||||
/* Define a variable or function
|
/* Define a variable or function
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
defsymbol(char *name, int ident, int vclass, cell offset, int tag)
|
defsymbol(char *name, int ident, int vclass, cell offset, int tag)
|
||||||
{
|
{
|
||||||
if ((sc_debug & sSYMBOLIC) != 0)
|
if ((sc_debug & sSYMBOLIC) != 0)
|
||||||
|
@ -290,7 +290,7 @@ defsymbol(char *name, int ident, int vclass, cell offset, int tag)
|
||||||
} /* if */
|
} /* if */
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC void
|
void
|
||||||
symbolrange(int level, cell size)
|
symbolrange(int level, cell size)
|
||||||
{
|
{
|
||||||
if ((sc_debug & sSYMBOLIC) != 0)
|
if ((sc_debug & sSYMBOLIC) != 0)
|
||||||
|
@ -308,7 +308,7 @@ symbolrange(int level, cell size)
|
||||||
*
|
*
|
||||||
* Generate code to get the value of a symbol into "primary".
|
* Generate code to get the value of a symbol into "primary".
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
rvalue(value * lval)
|
rvalue(value * lval)
|
||||||
{
|
{
|
||||||
symbol *sym;
|
symbol *sym;
|
||||||
|
@ -358,7 +358,7 @@ rvalue(value * lval)
|
||||||
* Get the address of a symbol into the primary register (used for arrays,
|
* Get the address of a symbol into the primary register (used for arrays,
|
||||||
* and for passing arguments by reference).
|
* and for passing arguments by reference).
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
address(symbol * sym)
|
address(symbol * sym)
|
||||||
{
|
{
|
||||||
assert(sym != NULL);
|
assert(sym != NULL);
|
||||||
|
@ -389,7 +389,7 @@ address(symbol * sym)
|
||||||
* Saves the contents of "primary" into a memory cell, either directly
|
* Saves the contents of "primary" into a memory cell, either directly
|
||||||
* or indirectly (at the address given in the alternate register).
|
* or indirectly (at the address given in the alternate register).
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
store(value * lval)
|
store(value * lval)
|
||||||
{
|
{
|
||||||
symbol *sym;
|
symbol *sym;
|
||||||
|
@ -434,7 +434,7 @@ store(value * lval)
|
||||||
/* source must in PRI, destination address in ALT. The "size"
|
/* source must in PRI, destination address in ALT. The "size"
|
||||||
* parameter is in bytes, not cells.
|
* parameter is in bytes, not cells.
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
memcopy(cell size)
|
memcopy(cell size)
|
||||||
{
|
{
|
||||||
stgwrite("\tmovs ");
|
stgwrite("\tmovs ");
|
||||||
|
@ -446,7 +446,7 @@ memcopy(cell size)
|
||||||
/* Address of the source must already have been loaded in PRI
|
/* Address of the source must already have been loaded in PRI
|
||||||
* "size" is the size in bytes (not cells).
|
* "size" is the size in bytes (not cells).
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
copyarray(symbol * sym, cell size)
|
copyarray(symbol * sym, cell size)
|
||||||
{
|
{
|
||||||
assert(sym != NULL);
|
assert(sym != NULL);
|
||||||
|
@ -474,7 +474,7 @@ copyarray(symbol * sym, cell size)
|
||||||
memcopy(size);
|
memcopy(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC void
|
void
|
||||||
fillarray(symbol * sym, cell size, cell value)
|
fillarray(symbol * sym, cell size, cell value)
|
||||||
{
|
{
|
||||||
const1(value); /* load value in PRI */
|
const1(value); /* load value in PRI */
|
||||||
|
@ -509,7 +509,7 @@ fillarray(symbol * sym, cell size, cell value)
|
||||||
/*
|
/*
|
||||||
* Instruction to get an immediate value into the primary register
|
* Instruction to get an immediate value into the primary register
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
const1(cell val)
|
const1(cell val)
|
||||||
{
|
{
|
||||||
if (val == 0)
|
if (val == 0)
|
||||||
|
@ -528,7 +528,7 @@ const1(cell val)
|
||||||
/*
|
/*
|
||||||
* Instruction to get an immediate value into the secondary register
|
* Instruction to get an immediate value into the secondary register
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
const2(cell val)
|
const2(cell val)
|
||||||
{
|
{
|
||||||
if (val == 0)
|
if (val == 0)
|
||||||
|
@ -545,7 +545,7 @@ const2(cell val)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy value in secondary register to the primary register */
|
/* Copy value in secondary register to the primary register */
|
||||||
SC_FUNC void
|
void
|
||||||
moveto1(void)
|
moveto1(void)
|
||||||
{
|
{
|
||||||
stgwrite("\tmove.pri\n");
|
stgwrite("\tmove.pri\n");
|
||||||
|
@ -555,7 +555,7 @@ moveto1(void)
|
||||||
/*
|
/*
|
||||||
* Push primary register onto the stack
|
* Push primary register onto the stack
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
push1(void)
|
push1(void)
|
||||||
{
|
{
|
||||||
stgwrite("\tpush.pri\n");
|
stgwrite("\tpush.pri\n");
|
||||||
|
@ -565,7 +565,7 @@ push1(void)
|
||||||
/*
|
/*
|
||||||
* Push alternate register onto the stack
|
* Push alternate register onto the stack
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
push2(void)
|
push2(void)
|
||||||
{
|
{
|
||||||
stgwrite("\tpush.alt\n");
|
stgwrite("\tpush.alt\n");
|
||||||
|
@ -575,7 +575,7 @@ push2(void)
|
||||||
/*
|
/*
|
||||||
* Push a constant value onto the stack
|
* Push a constant value onto the stack
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
pushval(cell val)
|
pushval(cell val)
|
||||||
{
|
{
|
||||||
stgwrite("\tpush.c ");
|
stgwrite("\tpush.c ");
|
||||||
|
@ -586,7 +586,7 @@ pushval(cell val)
|
||||||
/*
|
/*
|
||||||
* pop stack to the primary register
|
* pop stack to the primary register
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
pop1(void)
|
pop1(void)
|
||||||
{
|
{
|
||||||
stgwrite("\tpop.pri\n");
|
stgwrite("\tpop.pri\n");
|
||||||
|
@ -596,7 +596,7 @@ pop1(void)
|
||||||
/*
|
/*
|
||||||
* pop stack to the secondary register
|
* pop stack to the secondary register
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
pop2(void)
|
pop2(void)
|
||||||
{
|
{
|
||||||
stgwrite("\tpop.alt\n");
|
stgwrite("\tpop.alt\n");
|
||||||
|
@ -606,7 +606,7 @@ pop2(void)
|
||||||
/*
|
/*
|
||||||
* swap the top-of-stack with the value in primary register
|
* swap the top-of-stack with the value in primary register
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
swap1(void)
|
swap1(void)
|
||||||
{
|
{
|
||||||
stgwrite("\tswap.pri\n");
|
stgwrite("\tswap.pri\n");
|
||||||
|
@ -622,7 +622,7 @@ swap1(void)
|
||||||
* The case table is sorted on the comparison value. This allows more advanced
|
* The case table is sorted on the comparison value. This allows more advanced
|
||||||
* abstract machines to sift the case table with a binary search.
|
* abstract machines to sift the case table with a binary search.
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
ffswitch(int label)
|
ffswitch(int label)
|
||||||
{
|
{
|
||||||
stgwrite("\tswitch ");
|
stgwrite("\tswitch ");
|
||||||
|
@ -630,7 +630,7 @@ ffswitch(int label)
|
||||||
code_idx += opcodes(1) + opargs(1);
|
code_idx += opcodes(1) + opargs(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC void
|
void
|
||||||
ffcase(cell value, char *labelname, int newtable)
|
ffcase(cell value, char *labelname, int newtable)
|
||||||
{
|
{
|
||||||
if (newtable)
|
if (newtable)
|
||||||
|
@ -649,7 +649,7 @@ ffcase(cell value, char *labelname, int newtable)
|
||||||
/*
|
/*
|
||||||
* Call specified function
|
* Call specified function
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
ffcall(symbol * sym, int numargs)
|
ffcall(symbol * sym, int numargs)
|
||||||
{
|
{
|
||||||
assert(sym != NULL);
|
assert(sym != NULL);
|
||||||
|
@ -680,14 +680,14 @@ ffcall(symbol * sym, int numargs)
|
||||||
*
|
*
|
||||||
* Global references: funcstatus (referred to only)
|
* Global references: funcstatus (referred to only)
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
ffret(void)
|
ffret(void)
|
||||||
{
|
{
|
||||||
stgwrite("\tretn\n");
|
stgwrite("\tretn\n");
|
||||||
code_idx += opcodes(1);
|
code_idx += opcodes(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC void
|
void
|
||||||
ffabort(int reason)
|
ffabort(int reason)
|
||||||
{
|
{
|
||||||
stgwrite("\thalt ");
|
stgwrite("\thalt ");
|
||||||
|
@ -695,7 +695,7 @@ ffabort(int reason)
|
||||||
code_idx += opcodes(1) + opargs(1);
|
code_idx += opcodes(1) + opargs(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC void
|
void
|
||||||
ffbounds(cell size)
|
ffbounds(cell size)
|
||||||
{
|
{
|
||||||
if ((sc_debug & sCHKBOUNDS) != 0)
|
if ((sc_debug & sCHKBOUNDS) != 0)
|
||||||
|
@ -709,7 +709,7 @@ ffbounds(cell size)
|
||||||
/*
|
/*
|
||||||
* Jump to local label number (the number is converted to a name)
|
* Jump to local label number (the number is converted to a name)
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
jumplabel(int number)
|
jumplabel(int number)
|
||||||
{
|
{
|
||||||
stgwrite("\tjump ");
|
stgwrite("\tjump ");
|
||||||
|
@ -720,7 +720,7 @@ jumplabel(int number)
|
||||||
/*
|
/*
|
||||||
* Define storage (global and static variables)
|
* Define storage (global and static variables)
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
defstorage(void)
|
defstorage(void)
|
||||||
{
|
{
|
||||||
stgwrite("dump ");
|
stgwrite("dump ");
|
||||||
|
@ -730,7 +730,7 @@ defstorage(void)
|
||||||
* Inclrement/decrement stack pointer. Note that this routine does
|
* Inclrement/decrement stack pointer. Note that this routine does
|
||||||
* nothing if the delta is zero.
|
* nothing if the delta is zero.
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
modstk(int delta)
|
modstk(int delta)
|
||||||
{
|
{
|
||||||
if (delta)
|
if (delta)
|
||||||
|
@ -742,7 +742,7 @@ modstk(int delta)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set the stack to a hard offset from the frame */
|
/* set the stack to a hard offset from the frame */
|
||||||
SC_FUNC void
|
void
|
||||||
setstk(cell value)
|
setstk(cell value)
|
||||||
{
|
{
|
||||||
stgwrite("\tlctrl 5\n"); /* get FRM */
|
stgwrite("\tlctrl 5\n"); /* get FRM */
|
||||||
|
@ -761,7 +761,7 @@ setstk(cell value)
|
||||||
code_idx += opcodes(2) + opargs(2);
|
code_idx += opcodes(2) + opargs(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC void
|
void
|
||||||
modheap(int delta)
|
modheap(int delta)
|
||||||
{
|
{
|
||||||
if (delta)
|
if (delta)
|
||||||
|
@ -772,7 +772,7 @@ modheap(int delta)
|
||||||
} /* if */
|
} /* if */
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC void
|
void
|
||||||
setheap_pri(void)
|
setheap_pri(void)
|
||||||
{
|
{
|
||||||
stgwrite("\theap "); /* ALT = HEA++ */
|
stgwrite("\theap "); /* ALT = HEA++ */
|
||||||
|
@ -782,7 +782,7 @@ setheap_pri(void)
|
||||||
code_idx += opcodes(3) + opargs(1);
|
code_idx += opcodes(3) + opargs(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC void
|
void
|
||||||
setheap(cell value)
|
setheap(cell value)
|
||||||
{
|
{
|
||||||
stgwrite("\tconst.pri "); /* load default value in PRI */
|
stgwrite("\tconst.pri "); /* load default value in PRI */
|
||||||
|
@ -795,7 +795,7 @@ setheap(cell value)
|
||||||
* Convert a cell number to a "byte" address; i.e. double or quadruple
|
* Convert a cell number to a "byte" address; i.e. double or quadruple
|
||||||
* the primary register.
|
* the primary register.
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
cell2addr(void)
|
cell2addr(void)
|
||||||
{
|
{
|
||||||
#if defined(BIT16)
|
#if defined(BIT16)
|
||||||
|
@ -809,7 +809,7 @@ cell2addr(void)
|
||||||
/*
|
/*
|
||||||
* Double or quadruple the alternate register.
|
* Double or quadruple the alternate register.
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
cell2addr_alt(void)
|
cell2addr_alt(void)
|
||||||
{
|
{
|
||||||
#if defined(BIT16)
|
#if defined(BIT16)
|
||||||
|
@ -825,7 +825,7 @@ cell2addr_alt(void)
|
||||||
* Or convert a number of packed characters to the number of cells (with
|
* Or convert a number of packed characters to the number of cells (with
|
||||||
* truncation).
|
* truncation).
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
addr2cell(void)
|
addr2cell(void)
|
||||||
{
|
{
|
||||||
#if defined(BIT16)
|
#if defined(BIT16)
|
||||||
|
@ -839,7 +839,7 @@ addr2cell(void)
|
||||||
/* Convert from character index to byte address. This routine does
|
/* Convert from character index to byte address. This routine does
|
||||||
* nothing if a character has the size of a byte.
|
* nothing if a character has the size of a byte.
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
char2addr(void)
|
char2addr(void)
|
||||||
{
|
{
|
||||||
if (charbits == 16)
|
if (charbits == 16)
|
||||||
|
@ -857,7 +857,7 @@ char2addr(void)
|
||||||
* that is, on Big Endian computers, ALIGN.pri/alt shuold do nothing
|
* that is, on Big Endian computers, ALIGN.pri/alt shuold do nothing
|
||||||
* and on Little Endian computers they should toggle the address.
|
* and on Little Endian computers they should toggle the address.
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
charalign(void)
|
charalign(void)
|
||||||
{
|
{
|
||||||
stgwrite("\talign.pri ");
|
stgwrite("\talign.pri ");
|
||||||
|
@ -868,7 +868,7 @@ charalign(void)
|
||||||
/*
|
/*
|
||||||
* Add a constant to the primary register.
|
* Add a constant to the primary register.
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
addconst(cell value)
|
addconst(cell value)
|
||||||
{
|
{
|
||||||
if (value != 0)
|
if (value != 0)
|
||||||
|
@ -882,7 +882,7 @@ addconst(cell value)
|
||||||
/*
|
/*
|
||||||
* signed multiply of primary and secundairy registers (result in primary)
|
* signed multiply of primary and secundairy registers (result in primary)
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
os_mult(void)
|
os_mult(void)
|
||||||
{
|
{
|
||||||
stgwrite("\tsmul\n");
|
stgwrite("\tsmul\n");
|
||||||
|
@ -893,7 +893,7 @@ os_mult(void)
|
||||||
* signed divide of alternate register by primary register (quotient in
|
* signed divide of alternate register by primary register (quotient in
|
||||||
* primary; remainder in alternate)
|
* primary; remainder in alternate)
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
os_div(void)
|
os_div(void)
|
||||||
{
|
{
|
||||||
stgwrite("\tsdiv.alt\n");
|
stgwrite("\tsdiv.alt\n");
|
||||||
|
@ -903,7 +903,7 @@ os_div(void)
|
||||||
/*
|
/*
|
||||||
* modulus of (alternate % primary), result in primary (signed)
|
* modulus of (alternate % primary), result in primary (signed)
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
os_mod(void)
|
os_mod(void)
|
||||||
{
|
{
|
||||||
stgwrite("\tsdiv.alt\n");
|
stgwrite("\tsdiv.alt\n");
|
||||||
|
@ -914,7 +914,7 @@ os_mod(void)
|
||||||
/*
|
/*
|
||||||
* Add primary and alternate registers (result in primary).
|
* Add primary and alternate registers (result in primary).
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
ob_add(void)
|
ob_add(void)
|
||||||
{
|
{
|
||||||
stgwrite("\tadd\n");
|
stgwrite("\tadd\n");
|
||||||
|
@ -924,7 +924,7 @@ ob_add(void)
|
||||||
/*
|
/*
|
||||||
* subtract primary register from alternate register (result in primary)
|
* subtract primary register from alternate register (result in primary)
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
ob_sub(void)
|
ob_sub(void)
|
||||||
{
|
{
|
||||||
stgwrite("\tsub.alt\n");
|
stgwrite("\tsub.alt\n");
|
||||||
|
@ -937,7 +937,7 @@ ob_sub(void)
|
||||||
* There is no need for a "logical shift left" routine, since
|
* There is no need for a "logical shift left" routine, since
|
||||||
* logical shift left is identical to arithmic shift left.
|
* logical shift left is identical to arithmic shift left.
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
ob_sal(void)
|
ob_sal(void)
|
||||||
{
|
{
|
||||||
stgwrite("\txchg\n");
|
stgwrite("\txchg\n");
|
||||||
|
@ -949,7 +949,7 @@ ob_sal(void)
|
||||||
* arithmic shift right alternate register the number of bits
|
* arithmic shift right alternate register the number of bits
|
||||||
* given in the primary register (result in primary).
|
* given in the primary register (result in primary).
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
os_sar(void)
|
os_sar(void)
|
||||||
{
|
{
|
||||||
stgwrite("\txchg\n");
|
stgwrite("\txchg\n");
|
||||||
|
@ -961,7 +961,7 @@ os_sar(void)
|
||||||
* logical (unsigned) shift right of the alternate register by the
|
* logical (unsigned) shift right of the alternate register by the
|
||||||
* number of bits given in the primary register (result in primary).
|
* number of bits given in the primary register (result in primary).
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
ou_sar(void)
|
ou_sar(void)
|
||||||
{
|
{
|
||||||
stgwrite("\txchg\n");
|
stgwrite("\txchg\n");
|
||||||
|
@ -972,7 +972,7 @@ ou_sar(void)
|
||||||
/*
|
/*
|
||||||
* inclusive "or" of primary and secondary registers (result in primary)
|
* inclusive "or" of primary and secondary registers (result in primary)
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
ob_or(void)
|
ob_or(void)
|
||||||
{
|
{
|
||||||
stgwrite("\tor\n");
|
stgwrite("\tor\n");
|
||||||
|
@ -982,7 +982,7 @@ ob_or(void)
|
||||||
/*
|
/*
|
||||||
* "exclusive or" of primary and alternate registers (result in primary)
|
* "exclusive or" of primary and alternate registers (result in primary)
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
ob_xor(void)
|
ob_xor(void)
|
||||||
{
|
{
|
||||||
stgwrite("\txor\n");
|
stgwrite("\txor\n");
|
||||||
|
@ -992,7 +992,7 @@ ob_xor(void)
|
||||||
/*
|
/*
|
||||||
* "and" of primary and secundairy registers (result in primary)
|
* "and" of primary and secundairy registers (result in primary)
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
ob_and(void)
|
ob_and(void)
|
||||||
{
|
{
|
||||||
stgwrite("\tand\n");
|
stgwrite("\tand\n");
|
||||||
|
@ -1002,7 +1002,7 @@ ob_and(void)
|
||||||
/*
|
/*
|
||||||
* test ALT==PRI; result in primary register (1 or 0).
|
* test ALT==PRI; result in primary register (1 or 0).
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
ob_eq(void)
|
ob_eq(void)
|
||||||
{
|
{
|
||||||
stgwrite("\teq\n");
|
stgwrite("\teq\n");
|
||||||
|
@ -1012,7 +1012,7 @@ ob_eq(void)
|
||||||
/*
|
/*
|
||||||
* test ALT!=PRI
|
* test ALT!=PRI
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
ob_ne(void)
|
ob_ne(void)
|
||||||
{
|
{
|
||||||
stgwrite("\tneq\n");
|
stgwrite("\tneq\n");
|
||||||
|
@ -1039,7 +1039,7 @@ ob_ne(void)
|
||||||
* stack and moves the value of ALT into PRI. If there is a next comparison,
|
* stack and moves the value of ALT into PRI. If there is a next comparison,
|
||||||
* PRI can now serve as the "left" operand of the relational operator.
|
* PRI can now serve as the "left" operand of the relational operator.
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
relop_prefix(void)
|
relop_prefix(void)
|
||||||
{
|
{
|
||||||
stgwrite("\tpush.pri\n");
|
stgwrite("\tpush.pri\n");
|
||||||
|
@ -1047,7 +1047,7 @@ relop_prefix(void)
|
||||||
code_idx += opcodes(2);
|
code_idx += opcodes(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC void
|
void
|
||||||
relop_suffix(void)
|
relop_suffix(void)
|
||||||
{
|
{
|
||||||
stgwrite("\tswap.alt\n");
|
stgwrite("\tswap.alt\n");
|
||||||
|
@ -1059,7 +1059,7 @@ relop_suffix(void)
|
||||||
/*
|
/*
|
||||||
* test ALT<PRI (signed)
|
* test ALT<PRI (signed)
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
os_lt(void)
|
os_lt(void)
|
||||||
{
|
{
|
||||||
stgwrite("\txchg\n");
|
stgwrite("\txchg\n");
|
||||||
|
@ -1070,7 +1070,7 @@ os_lt(void)
|
||||||
/*
|
/*
|
||||||
* test ALT<=PRI (signed)
|
* test ALT<=PRI (signed)
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
os_le(void)
|
os_le(void)
|
||||||
{
|
{
|
||||||
stgwrite("\txchg\n");
|
stgwrite("\txchg\n");
|
||||||
|
@ -1081,7 +1081,7 @@ os_le(void)
|
||||||
/*
|
/*
|
||||||
* test ALT>PRI (signed)
|
* test ALT>PRI (signed)
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
os_gt(void)
|
os_gt(void)
|
||||||
{
|
{
|
||||||
stgwrite("\txchg\n");
|
stgwrite("\txchg\n");
|
||||||
|
@ -1092,7 +1092,7 @@ os_gt(void)
|
||||||
/*
|
/*
|
||||||
* test ALT>=PRI (signed)
|
* test ALT>=PRI (signed)
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
os_ge(void)
|
os_ge(void)
|
||||||
{
|
{
|
||||||
stgwrite("\txchg\n");
|
stgwrite("\txchg\n");
|
||||||
|
@ -1103,7 +1103,7 @@ os_ge(void)
|
||||||
/*
|
/*
|
||||||
* logical negation of primary register
|
* logical negation of primary register
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
lneg(void)
|
lneg(void)
|
||||||
{
|
{
|
||||||
stgwrite("\tnot\n");
|
stgwrite("\tnot\n");
|
||||||
|
@ -1113,7 +1113,7 @@ lneg(void)
|
||||||
/*
|
/*
|
||||||
* two's complement primary register
|
* two's complement primary register
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
neg(void)
|
neg(void)
|
||||||
{
|
{
|
||||||
stgwrite("\tneg\n");
|
stgwrite("\tneg\n");
|
||||||
|
@ -1123,7 +1123,7 @@ neg(void)
|
||||||
/*
|
/*
|
||||||
* one's complement of primary register
|
* one's complement of primary register
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
invert(void)
|
invert(void)
|
||||||
{
|
{
|
||||||
stgwrite("\tinvert\n");
|
stgwrite("\tinvert\n");
|
||||||
|
@ -1133,7 +1133,7 @@ invert(void)
|
||||||
/*
|
/*
|
||||||
* nop
|
* nop
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
nooperation(void)
|
nooperation(void)
|
||||||
{
|
{
|
||||||
stgwrite("\tnop\n");
|
stgwrite("\tnop\n");
|
||||||
|
@ -1142,7 +1142,7 @@ nooperation(void)
|
||||||
|
|
||||||
/* increment symbol
|
/* increment symbol
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
inc(value * lval)
|
inc(value * lval)
|
||||||
{
|
{
|
||||||
symbol *sym;
|
symbol *sym;
|
||||||
|
@ -1208,7 +1208,7 @@ inc(value * lval)
|
||||||
*
|
*
|
||||||
* in case of an integer pointer, the symbol must be incremented by 2.
|
* in case of an integer pointer, the symbol must be incremented by 2.
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
dec(value * lval)
|
dec(value * lval)
|
||||||
{
|
{
|
||||||
symbol *sym;
|
symbol *sym;
|
||||||
|
@ -1273,7 +1273,7 @@ dec(value * lval)
|
||||||
/*
|
/*
|
||||||
* Jumps to "label" if PRI != 0
|
* Jumps to "label" if PRI != 0
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
jmp_ne0(int number)
|
jmp_ne0(int number)
|
||||||
{
|
{
|
||||||
stgwrite("\tjnz ");
|
stgwrite("\tjnz ");
|
||||||
|
@ -1284,7 +1284,7 @@ jmp_ne0(int number)
|
||||||
/*
|
/*
|
||||||
* Jumps to "label" if PRI == 0
|
* Jumps to "label" if PRI == 0
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
jmp_eq0(int number)
|
jmp_eq0(int number)
|
||||||
{
|
{
|
||||||
stgwrite("\tjzer ");
|
stgwrite("\tjzer ");
|
||||||
|
@ -1293,7 +1293,7 @@ jmp_eq0(int number)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* write a value in hexadecimal; optionally adds a newline */
|
/* write a value in hexadecimal; optionally adds a newline */
|
||||||
SC_FUNC void
|
void
|
||||||
outval(cell val, int newline)
|
outval(cell val, int newline)
|
||||||
{
|
{
|
||||||
stgwrite(itoh(val));
|
stgwrite(itoh(val));
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
* Version: $Id$
|
* Version: $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SC_FUNC int strexpand(char *dest, unsigned char *source, int maxlen,
|
int strexpand(char *dest, unsigned char *source, int maxlen,
|
||||||
unsigned char pairtable[128][2]);
|
unsigned char pairtable[128][2]);
|
||||||
|
|
||||||
#define SCPACK_TABLE errstr_table
|
#define SCPACK_TABLE errstr_table
|
||||||
|
|
|
@ -629,7 +629,7 @@ findopcode(char *instr, int maxlen)
|
||||||
return 0; /* not found, return special index */
|
return 0; /* not found, return special index */
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC void
|
void
|
||||||
assemble(FILE * fout, FILE * fin)
|
assemble(FILE * fout, FILE * fin)
|
||||||
{
|
{
|
||||||
typedef struct tagFUNCSTUB
|
typedef struct tagFUNCSTUB
|
||||||
|
|
|
@ -91,7 +91,7 @@ grow_stgbuffer(int requiredsize)
|
||||||
*stgbuf = '\0';
|
*stgbuf = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC void
|
void
|
||||||
stgbuffer_cleanup(void)
|
stgbuffer_cleanup(void)
|
||||||
{
|
{
|
||||||
if (stgbuf != NULL)
|
if (stgbuf != NULL)
|
||||||
|
@ -120,7 +120,7 @@ stgbuffer_cleanup(void)
|
||||||
* stgbuf (altered)
|
* stgbuf (altered)
|
||||||
* staging (referred to only)
|
* staging (referred to only)
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
stgmark(char mark)
|
stgmark(char mark)
|
||||||
{
|
{
|
||||||
if (staging)
|
if (staging)
|
||||||
|
@ -155,7 +155,7 @@ filewrite(char *str)
|
||||||
* stgbuf (altered)
|
* stgbuf (altered)
|
||||||
* staging (referred to only)
|
* staging (referred to only)
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
stgwrite(char *st)
|
stgwrite(char *st)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
|
@ -197,7 +197,7 @@ stgwrite(char *st)
|
||||||
* stgbuf (referred to only)
|
* stgbuf (referred to only)
|
||||||
* staging (referred to only)
|
* staging (referred to only)
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
stgout(int index)
|
stgout(int index)
|
||||||
{
|
{
|
||||||
if (!staging)
|
if (!staging)
|
||||||
|
@ -312,7 +312,7 @@ stgstring(char *start, char *end)
|
||||||
* Global references: stgidx (altered)
|
* Global references: stgidx (altered)
|
||||||
* staging (reffered to only)
|
* staging (reffered to only)
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
stgdel(int index, cell code_index)
|
stgdel(int index, cell code_index)
|
||||||
{
|
{
|
||||||
if (staging)
|
if (staging)
|
||||||
|
@ -322,7 +322,7 @@ stgdel(int index, cell code_index)
|
||||||
} /* if */
|
} /* if */
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC int
|
int
|
||||||
stgget(int *index, cell * code_index)
|
stgget(int *index, cell * code_index)
|
||||||
{
|
{
|
||||||
if (staging)
|
if (staging)
|
||||||
|
@ -343,7 +343,7 @@ stgget(int *index, cell * code_index)
|
||||||
* stgidx (altered)
|
* stgidx (altered)
|
||||||
* stgbuf (contents altered)
|
* stgbuf (contents altered)
|
||||||
*/
|
*/
|
||||||
SC_FUNC void
|
void
|
||||||
stgset(int onoff)
|
stgset(int onoff)
|
||||||
{
|
{
|
||||||
staging = onoff;
|
staging = onoff;
|
||||||
|
@ -368,7 +368,7 @@ stgset(int onoff)
|
||||||
*/
|
*/
|
||||||
static SEQUENCE *sequences;
|
static SEQUENCE *sequences;
|
||||||
|
|
||||||
SC_FUNC int
|
int
|
||||||
phopt_init(void)
|
phopt_init(void)
|
||||||
{
|
{
|
||||||
int number, i, len;
|
int number, i, len;
|
||||||
|
@ -417,7 +417,7 @@ phopt_init(void)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_FUNC int
|
int
|
||||||
phopt_cleanup(void)
|
phopt_cleanup(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
* Version: $Id$
|
* Version: $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SC_FUNC int strexpand(char *dest, unsigned char *source, int maxlen,
|
int strexpand(char *dest, unsigned char *source, int maxlen,
|
||||||
unsigned char pairtable[128][2]);
|
unsigned char pairtable[128][2]);
|
||||||
|
|
||||||
#define SCPACK_TERMINATOR , /* end each section with a comma */
|
#define SCPACK_TERMINATOR , /* end each section with a comma */
|
||||||
|
|
Loading…
Reference in New Issue