Skip to content
This repository was archived by the owner on Sep 26, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/sc.h
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ SC_FUNC void set_extension(char *filename,const char *extension,int force);
SC_FUNC symbol *fetchfunc(const char *name,int tag);
SC_FUNC char *operator_symname(char *symname,char *opername,int tag1,int tag2,int numtags,int resulttag);
SC_FUNC char *funcdisplayname(char *dest,const char *funcname);
SC_FUNC int constexpr(cell *val,int *tag,symbol **symptr);
SC_FUNC int const_expr(cell *val,int *tag,symbol **symptr);
SC_FUNC constvalue *append_constval(constvalue *table,const char *name,cell val,int index);
SC_FUNC constvalue *find_constval(constvalue *table,const char *name,int index);
SC_FUNC void delete_consttable(constvalue *table);
Expand Down
20 changes: 10 additions & 10 deletions compiler/sc1.c
Original file line number Diff line number Diff line change
Expand Up @@ -3120,7 +3120,7 @@ static cell init(int ident,int usage,int *tag,int *errorfound,int *packcount,cel
if (tok==tSTRING && (usage & uPACKED)!=0 || tok==tPACKSTRING && (usage & uPACKED)==0)
error(229);
*tag=0;
} else if (constexpr(&i,tag,NULL)) {
} else if (const_expr(&i,tag,NULL)) {
if (packcount!=NULL && *packcount>=0) {
assert(packitem!=NULL);
assert(*packcount<pc_cellsize);
Expand Down Expand Up @@ -3215,7 +3215,7 @@ static cell needsub(char match,constvalue **namelist)
} else {
symbol *sym;
int exprtag;
constexpr(&val,&exprtag,&sym);/* get value (must be constant expression) */
const_expr(&val,&exprtag,&sym);/* get value (must be constant expression) */
if (tag==0)
tag=exprtag; /* copy expression tag */
if (val<0 || sc_rationaltag!=0 && tag==sc_rationaltag) {
Expand Down Expand Up @@ -3286,12 +3286,12 @@ static void decl_const(int scope)
assert(enumerate!=0 || first); /* when not enumerating, each constant is the "first" of the list */
if (enumerate) {
if (matchtoken('='))
constexpr(&val,&exprtag,NULL);/* get value (optional, except for the first) */
const_expr(&val,&exprtag,NULL);/* get value (optional, except for the first) */
else if (first)
error(91,constname); /* first constant in a list must be initialized */
} else {
needtoken('=');
constexpr(&val,&exprtag,NULL); /* get value */
const_expr(&val,&exprtag,NULL); /* get value */
}
first=0;
defaultval=val;
Expand Down Expand Up @@ -3885,7 +3885,7 @@ static void funcstub(int fnative)
sym->index=(int)ntvidx->value;
} /* if */
} else {
constexpr(&val,NULL,NULL);
const_expr(&val,NULL,NULL);
sym->index=(int)val;
/* At the moment, I have assumed that this syntax is only valid if
* val < 0. To properly mix "normal" native functions and indexed
Expand Down Expand Up @@ -4587,7 +4587,7 @@ static void doarg(char *name,int ident,int offset,const int tags[],int numtags,
while (paranthese--)
needtoken(')');
} else {
constexpr(&arg->defvalue.val,&arg->defvalue_tag,NULL);
const_expr(&arg->defvalue.val,&arg->defvalue_tag,NULL);
assert(numtags>0);
if (!matchtag(tags[0],arg->defvalue_tag,TRUE))
error(213); /* tagname mismatch */
Expand Down Expand Up @@ -5990,9 +5990,9 @@ static int doexpr(int comma,int chkeffect,int allowarray,int mark_endexpr,
return ident;
}

/* constexpr
/* const_expr
*/
SC_FUNC int constexpr(cell *val,int *tag,symbol **symptr)
SC_FUNC int const_expr(cell *val,int *tag,symbol **symptr)
{
int ident,index;
cell cidx;
Expand Down Expand Up @@ -6337,7 +6337,7 @@ static void doswitch(void)
* parse all expressions until that special token.
*/

constexpr(&val,NULL,NULL);
const_expr(&val,NULL,NULL);
/* Search the insertion point (the table is kept in sorted order, so
* that advanced abstract machines can sift the case table with a
* binary search). Check for duplicate case values at the same time.
Expand All @@ -6360,7 +6360,7 @@ static void doswitch(void)
insert_constval(csp,cse,itoh(lbl_case),val,0);
if (matchtoken(tDBLDOT)) {
cell end;
constexpr(&end,NULL,NULL);
const_expr(&end,NULL,NULL);
if (end<=val)
error(50); /* invalid range */
while (++val<=end) {
Expand Down
2 changes: 1 addition & 1 deletion compiler/sc2.c
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@ static int preproc_expr(cell *val,int *tag)
term=strchr((char*)srcline,'\0');
assert(term!=NULL);
chrcat((char*)srcline,PREPROC_TERM); /* the "DEL" code (see SC.H) */
result=constexpr(val,tag,NULL); /* get value (or 0 on error) */
result=const_expr(val,tag,NULL); /* get value (or 0 on error) */
*term='\0'; /* erase the token (if still present) */
lexclr(FALSE); /* clear any "pushed" tokens */
litidx=cur_lit; /* reset literal pool */
Expand Down
2 changes: 1 addition & 1 deletion compiler/sc3.c
Original file line number Diff line number Diff line change
Expand Up @@ -2842,7 +2842,7 @@ static int constant(value *lval)
packitem=0;
packcount=0;
do {
/* cannot call constexpr() here, because "staging" is already turned
/* cannot call const_expr() here, because "staging" is already turned
* on at this point */
assert(staging);
stgget(&index,&cidx); /* mark position in code generator */
Expand Down