From a09735a4c7a1f035615d2b5c0f75dbb976b43ce7 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 22 Aug 2014 00:53:47 -0700 Subject: [PATCH] Remove SC_FUNC and SC_VDEFINE. --- sourcepawn/compiler/pawncc.cpp | 9 +- sourcepawn/compiler/sc.h | 601 ++++++++++++++--------------- sourcepawn/compiler/sc1.cpp | 29 +- sourcepawn/compiler/sc2.cpp | 80 ++-- sourcepawn/compiler/sc3.cpp | 20 +- sourcepawn/compiler/sc4.cpp | 172 ++++----- sourcepawn/compiler/sc5-in.scp | 2 +- sourcepawn/compiler/sc5.cpp | 4 +- sourcepawn/compiler/sc6.cpp | 2 +- sourcepawn/compiler/sc7-in.scp | 2 +- sourcepawn/compiler/sc7.cpp | 18 +- sourcepawn/compiler/scexpand.cpp | 2 +- sourcepawn/compiler/sci18n.cpp | 10 +- sourcepawn/compiler/sclist.cpp | 56 +-- sourcepawn/compiler/scstate.cpp | 30 +- sourcepawn/compiler/scvars.cpp | 140 +++---- sourcepawn/compiler/sp_symhash.cpp | 14 +- sourcepawn/compiler/sp_symhash.h | 14 +- 18 files changed, 584 insertions(+), 621 deletions(-) diff --git a/sourcepawn/compiler/pawncc.cpp b/sourcepawn/compiler/pawncc.cpp index b7332c07..10ceaa96 100644 --- a/sourcepawn/compiler/pawncc.cpp +++ b/sourcepawn/compiler/pawncc.cpp @@ -36,8 +36,8 @@ enum FileSections FS_Number, }; -extern "C" int pc_printf(const char *message,...); -extern "C" int pc_compile(int argc, char **argv); +int pc_printf(const char *message,...); +int pc_compile(int argc, char **argv); void sfwrite(const void *buf, size_t size, size_t count, sp_file_t *spf); memfile_t *bin_file = NULL; @@ -518,7 +518,7 @@ void sfwrite(const void *buf, size_t size, size_t count, sp_file_t *spf) longjmp(brkout, 1); } -extern "C" void sp_fdbg_ntv_start(int num_natives) +void sp_fdbg_ntv_start(int num_natives) { if (num_natives == 0) return; @@ -528,8 +528,7 @@ extern "C" void sp_fdbg_ntv_start(int num_natives) } #include "sc.h" - -extern "C" void sp_fdbg_ntv_hook(int index, symbol *sym) +void sp_fdbg_ntv_hook(int index, symbol *sym) { int i, j; t_native *native; diff --git a/sourcepawn/compiler/sc.h b/sourcepawn/compiler/sc.h index 1f1505a0..aaab83c3 100644 --- a/sourcepawn/compiler/sc.h +++ b/sourcepawn/compiler/sc.h @@ -537,11 +537,6 @@ typedef enum s_optmark { #define CELL_MAX (((ucell)1 << (sizeof(cell)*8-1)) - 1) -/* interface functions */ -#if defined __cplusplus - extern "C" { -#endif - /* * Functions you call from the "driver" program */ @@ -590,166 +585,144 @@ void pc_resetbin(void *handle,long offset); int pc_writebin(void *handle,void *buffer,int size); long pc_lengthbin(void *handle); /* return the length of the file */ -#if defined __cplusplus - } -#endif - - -/* by default, functions and variables used in throughout the compiler - * files are "external" - */ -#if !defined SC_FUNC -# if defined(__cplusplus) -# define SC_FUNC extern "C" -# else -# define SC_FUNC -# endif -#endif -#if !defined SC_VDECL - #define SC_VDECL extern -#endif -#if !defined SC_VDEFINE - #define SC_VDEFINE -#endif - -SC_FUNC void sp_fdbg_ntv_start(int num_natives); -SC_FUNC void sp_fdbg_ntv_hook(int index, symbol *sym); +void sp_fdbg_ntv_start(int num_natives); +void sp_fdbg_ntv_hook(int index, symbol *sym); /* function prototypes in SC1.C */ -SC_FUNC void set_extension(char *filename,const char *extension,int force); -SC_FUNC symbol *fetchfunc(char *name); -SC_FUNC char *operator_symname(char *symname,const char *opername,int tag1,int tag2,int numtags,int resulttag); -SC_FUNC char *funcdisplayname(char *dest,char *funcname); -SC_FUNC int exprconst(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,char *name,int index); -SC_FUNC void delete_consttable(constvalue *table); -SC_FUNC symbol *add_constant(const char *name,cell val,int vclass,int tag); -SC_FUNC void exporttag(int tag); -SC_FUNC void sc_attachdocumentation(symbol *sym); -SC_FUNC constvalue *find_tag_byval(int tag); -SC_FUNC int get_actual_compound(symbol *sym); +void set_extension(char *filename,const char *extension,int force); +symbol *fetchfunc(char *name); +char *operator_symname(char *symname,const char *opername,int tag1,int tag2,int numtags,int resulttag); +char *funcdisplayname(char *dest,char *funcname); +int exprconst(cell *val,int *tag,symbol **symptr); +constvalue *append_constval(constvalue *table,const char *name,cell val,int index); +constvalue *find_constval(constvalue *table,char *name,int index); +void delete_consttable(constvalue *table); +symbol *add_constant(const char *name,cell val,int vclass,int tag); +void exporttag(int tag); +void sc_attachdocumentation(symbol *sym); +constvalue *find_tag_byval(int tag); +int get_actual_compound(symbol *sym); /* function prototypes in SC2.C */ #define PUSHSTK_P(v) { stkitem s_; s_.pv=(v); pushstk(s_); } #define PUSHSTK_I(v) { stkitem s_; s_.i=(v); pushstk(s_); } #define POPSTK_P() (popstk().pv) #define POPSTK_I() (popstk().i) -SC_FUNC void pushstk(stkitem val); -SC_FUNC stkitem popstk(void); -SC_FUNC void clearstk(void); -SC_FUNC int plungequalifiedfile(char *name); /* explicit path included */ -SC_FUNC int plungefile(char *name,int try_currentpath,int try_includepaths); /* search through "include" paths */ -SC_FUNC void preprocess(void); -SC_FUNC void lexinit(void); -SC_FUNC int lex(cell *lexvalue,char **lexsym); -SC_FUNC int lextok(token_t *tok); -SC_FUNC int lexpeek(int id); -SC_FUNC void lexpush(void); -SC_FUNC void lexclr(int clreol); -SC_FUNC int matchtoken(int token); -SC_FUNC int tokeninfo(cell *val,char **str); -SC_FUNC int needtoken(int token); -SC_FUNC int matchtoken2(int id, token_t *tok); -SC_FUNC int expecttoken(int id, token_t *tok); -SC_FUNC int matchsymbol(token_ident_t *ident); -SC_FUNC int needsymbol(token_ident_t *ident); -SC_FUNC int peek_same_line(); -SC_FUNC int require_newline(int allow_semi); -SC_FUNC void litadd(cell value); -SC_FUNC void litinsert(cell value,int pos); -SC_FUNC int alphanum(char c); -SC_FUNC int ishex(char c); -SC_FUNC void delete_symbol(symbol *root,symbol *sym); -SC_FUNC void delete_symbols(symbol *root,int level,int del_labels,int delete_functions); -SC_FUNC int refer_symbol(symbol *entry,symbol *bywhom); -SC_FUNC void markusage(symbol *sym,int usage); -SC_FUNC symbol *findglb(const char *name,int filter); -SC_FUNC symbol *findloc(const char *name); -SC_FUNC symbol *findconst(const char *name,int *matchtag); -SC_FUNC symbol *finddepend(const symbol *parent); -SC_FUNC symbol *addsym(const char *name,cell addr,int ident,int vclass,int tag, int usage); -SC_FUNC symbol *addvariable(const char *name,cell addr,int ident,int vclass,int tag, +void pushstk(stkitem val); +stkitem popstk(void); +void clearstk(void); +int plungequalifiedfile(char *name); /* explicit path included */ +int plungefile(char *name,int try_currentpath,int try_includepaths); /* search through "include" paths */ +void preprocess(void); +void lexinit(void); +int lex(cell *lexvalue,char **lexsym); +int lextok(token_t *tok); +int lexpeek(int id); +void lexpush(void); +void lexclr(int clreol); +int matchtoken(int token); +int tokeninfo(cell *val,char **str); +int needtoken(int token); +int matchtoken2(int id, token_t *tok); +int expecttoken(int id, token_t *tok); +int matchsymbol(token_ident_t *ident); +int needsymbol(token_ident_t *ident); +int peek_same_line(); +int require_newline(int allow_semi); +void litadd(cell value); +void litinsert(cell value,int pos); +int alphanum(char c); +int ishex(char c); +void delete_symbol(symbol *root,symbol *sym); +void delete_symbols(symbol *root,int level,int del_labels,int delete_functions); +int refer_symbol(symbol *entry,symbol *bywhom); +void markusage(symbol *sym,int usage); +symbol *findglb(const char *name,int filter); +symbol *findloc(const char *name); +symbol *findconst(const char *name,int *matchtag); +symbol *finddepend(const symbol *parent); +symbol *addsym(const char *name,cell addr,int ident,int vclass,int tag, int usage); +symbol *addvariable(const char *name,cell addr,int ident,int vclass,int tag, int dim[],int numdim,int idxtag[]); -SC_FUNC symbol *addvariable2(const char *name,cell addr,int ident,int vclass,int tag, +symbol *addvariable2(const char *name,cell addr,int ident,int vclass,int tag, int dim[],int numdim,int idxtag[],int slength); -SC_FUNC symbol *addvariable3(declinfo_t *decl,cell addr,int vclass,int slength); -SC_FUNC int getlabel(void); -SC_FUNC char *itoh(ucell val); +symbol *addvariable3(declinfo_t *decl,cell addr,int vclass,int slength); +int getlabel(void); +char *itoh(ucell val); #define MATCHTAG_COERCE 0x1 // allow coercion #define MATCHTAG_SILENT 0x2 // silence the error(213) warning #define MATCHTAG_COMMUTATIVE 0x4 // order does not matter /* function prototypes in SC3.C */ -SC_FUNC int check_userop(void (*oper)(void),int tag1,int tag2,int numparam, +int check_userop(void (*oper)(void),int tag1,int tag2,int numparam, value *lval,int *resulttag); -SC_FUNC int matchtag(int formaltag,int actualtag,int allowcoerce); -SC_FUNC int checktag(int tags[],int numtags,int exprtag); -SC_FUNC int expression(cell *val,int *tag,symbol **symptr,int chkfuncresult,value *_lval); -SC_FUNC int sc_getstateid(constvalue **automaton,constvalue **state); -SC_FUNC cell array_totalsize(symbol *sym); -SC_FUNC int matchtag_string(int ident, int tag); -SC_FUNC int checktag_string(value *sym1, value *sym2); -SC_FUNC int checktags_string(int tags[], int numtags, value *sym1); -SC_FUNC int lvalexpr(svalue *sval); +int matchtag(int formaltag,int actualtag,int allowcoerce); +int checktag(int tags[],int numtags,int exprtag); +int expression(cell *val,int *tag,symbol **symptr,int chkfuncresult,value *_lval); +int sc_getstateid(constvalue **automaton,constvalue **state); +cell array_totalsize(symbol *sym); +int matchtag_string(int ident, int tag); +int checktag_string(value *sym1, value *sym2); +int checktags_string(int tags[], int numtags, value *sym1); +int lvalexpr(svalue *sval); /* function prototypes in SC4.C */ -SC_FUNC void writeleader(symbol *root); -SC_FUNC void writetrailer(void); -SC_FUNC void begcseg(void); -SC_FUNC void begdseg(void); -SC_FUNC void setline(int chkbounds); -SC_FUNC void setfiledirect(char *name); -SC_FUNC void setlinedirect(int line); -SC_FUNC void setlabel(int index); -SC_FUNC void markexpr(optmark type,const char *name,cell offset); -SC_FUNC void startfunc(char *fname); -SC_FUNC void endfunc(void); -SC_FUNC void alignframe(int numbytes); -SC_FUNC void rvalue(value *lval); -SC_FUNC void address(symbol *ptr,regid reg); -SC_FUNC void store(value *lval); -SC_FUNC void loadreg(cell address,regid reg); -SC_FUNC void storereg(cell address,regid reg); -SC_FUNC void memcopy(cell size); -SC_FUNC void copyarray(symbol *sym,cell size); -SC_FUNC void fillarray(symbol *sym,cell size,cell value); -SC_FUNC void ldconst(cell val,regid reg); -SC_FUNC void moveto1(void); -SC_FUNC void move_alt(void); -SC_FUNC void pushreg(regid reg); -SC_FUNC void pushval(cell val); -SC_FUNC void popreg(regid reg); -SC_FUNC void genarray(int dims, int _autozero); -SC_FUNC void swap1(void); -SC_FUNC void ffswitch(int label); -SC_FUNC void ffcase(cell value,char *labelname,int newtable); -SC_FUNC void ffcall(symbol *sym,const char *label,int numargs); -SC_FUNC void ffret(int remparams); -SC_FUNC void ffabort(int reason); -SC_FUNC void ffbounds(cell size); -SC_FUNC void jumplabel(int number); -SC_FUNC void defstorage(void); -SC_FUNC void modstk(int delta); -SC_FUNC void setstk(cell value); -SC_FUNC void modheap(int delta); -SC_FUNC void modheap_i(); -SC_FUNC void setheap_pri(void); -SC_FUNC void setheap(cell value); -SC_FUNC void cell2addr(void); -SC_FUNC void cell2addr_alt(void); -SC_FUNC void addr2cell(void); -SC_FUNC void char2addr(void); -SC_FUNC void charalign(void); -SC_FUNC void addconst(cell value); -SC_FUNC void setheap_save(cell value); -SC_FUNC void stradjust(regid reg); -SC_FUNC void invoke_getter(struct methodmap_method_s *method); -SC_FUNC void invoke_setter(struct methodmap_method_s *method, int save); -SC_FUNC void inc_pri(); -SC_FUNC void dec_pri(); -SC_FUNC void load_hidden_arg(); +void writeleader(symbol *root); +void writetrailer(void); +void begcseg(void); +void begdseg(void); +void setline(int chkbounds); +void setfiledirect(char *name); +void setlinedirect(int line); +void setlabel(int index); +void markexpr(optmark type,const char *name,cell offset); +void startfunc(char *fname); +void endfunc(void); +void alignframe(int numbytes); +void rvalue(value *lval); +void address(symbol *ptr,regid reg); +void store(value *lval); +void loadreg(cell address,regid reg); +void storereg(cell address,regid reg); +void memcopy(cell size); +void copyarray(symbol *sym,cell size); +void fillarray(symbol *sym,cell size,cell value); +void ldconst(cell val,regid reg); +void moveto1(void); +void move_alt(void); +void pushreg(regid reg); +void pushval(cell val); +void popreg(regid reg); +void genarray(int dims, int _autozero); +void swap1(void); +void ffswitch(int label); +void ffcase(cell value,char *labelname,int newtable); +void ffcall(symbol *sym,const char *label,int numargs); +void ffret(int remparams); +void ffabort(int reason); +void ffbounds(cell size); +void jumplabel(int number); +void defstorage(void); +void modstk(int delta); +void setstk(cell value); +void modheap(int delta); +void modheap_i(); +void setheap_pri(void); +void setheap(cell value); +void cell2addr(void); +void cell2addr_alt(void); +void addr2cell(void); +void char2addr(void); +void charalign(void); +void addconst(cell value); +void setheap_save(cell value); +void stradjust(regid reg); +void invoke_getter(struct methodmap_method_s *method); +void invoke_setter(struct methodmap_method_s *method, int save); +void inc_pri(); +void dec_pri(); +void load_hidden_arg(); /* Code generation functions for arithmetic operators. * @@ -759,197 +732,197 @@ SC_FUNC void load_hidden_arg(); * | +--------- "u"nsigned operator, "s"igned operator or "b"oth * +------------- "o"perator */ -SC_FUNC void os_mult(void); /* multiplication (signed) */ -SC_FUNC void os_div(void); /* division (signed) */ -SC_FUNC void os_mod(void); /* modulus (signed) */ -SC_FUNC void ob_add(void); /* addition */ -SC_FUNC void ob_sub(void); /* subtraction */ -SC_FUNC void ob_sal(void); /* shift left (arithmetic) */ -SC_FUNC void os_sar(void); /* shift right (arithmetic, signed) */ -SC_FUNC void ou_sar(void); /* shift right (logical, unsigned) */ -SC_FUNC void ob_or(void); /* bitwise or */ -SC_FUNC void ob_xor(void); /* bitwise xor */ -SC_FUNC void ob_and(void); /* bitwise and */ -SC_FUNC void ob_eq(void); /* equality */ -SC_FUNC void ob_ne(void); /* inequality */ -SC_FUNC void relop_prefix(void); -SC_FUNC void relop_suffix(void); -SC_FUNC void os_le(void); /* less or equal (signed) */ -SC_FUNC void os_ge(void); /* greater or equal (signed) */ -SC_FUNC void os_lt(void); /* less (signed) */ -SC_FUNC void os_gt(void); /* greater (signed) */ +void os_mult(void); /* multiplication (signed) */ +void os_div(void); /* division (signed) */ +void os_mod(void); /* modulus (signed) */ +void ob_add(void); /* addition */ +void ob_sub(void); /* subtraction */ +void ob_sal(void); /* shift left (arithmetic) */ +void os_sar(void); /* shift right (arithmetic, signed) */ +void ou_sar(void); /* shift right (logical, unsigned) */ +void ob_or(void); /* bitwise or */ +void ob_xor(void); /* bitwise xor */ +void ob_and(void); /* bitwise and */ +void ob_eq(void); /* equality */ +void ob_ne(void); /* inequality */ +void relop_prefix(void); +void relop_suffix(void); +void os_le(void); /* less or equal (signed) */ +void os_ge(void); /* greater or equal (signed) */ +void os_lt(void); /* less (signed) */ +void os_gt(void); /* greater (signed) */ -SC_FUNC void lneg(void); -SC_FUNC void neg(void); -SC_FUNC void invert(void); -SC_FUNC void nooperation(void); -SC_FUNC void inc(value *lval); -SC_FUNC void dec(value *lval); -SC_FUNC void jmp_ne0(int number); -SC_FUNC void jmp_eq0(int number); -SC_FUNC void outval(cell val,int newline); +void lneg(void); +void neg(void); +void invert(void); +void nooperation(void); +void inc(value *lval); +void dec(value *lval); +void jmp_ne0(int number); +void jmp_eq0(int number); +void outval(cell val,int newline); /* function prototypes in SC5.C */ -SC_FUNC int error(int number,...); -SC_FUNC void errorset(int code,int line); +int error(int number,...); +void errorset(int code,int line); /* function prototypes in SC6.C */ -SC_FUNC int assemble(void *fout,void *fin); +int assemble(void *fout,void *fin); /* function prototypes in SC7.C */ -SC_FUNC void stgbuffer_cleanup(void); -SC_FUNC void stgmark(char mark); -SC_FUNC void stgwrite(const char *st); -SC_FUNC void stgout(int index); -SC_FUNC void stgdel(int index,cell code_index); -SC_FUNC int stgget(int *index,cell *code_index); -SC_FUNC void stgset(int onoff); -SC_FUNC int phopt_init(void); -SC_FUNC int phopt_cleanup(void); +void stgbuffer_cleanup(void); +void stgmark(char mark); +void stgwrite(const char *st); +void stgout(int index); +void stgdel(int index,cell code_index); +int stgget(int *index,cell *code_index); +void stgset(int onoff); +int phopt_init(void); +int phopt_cleanup(void); /* function prototypes in SCLIST.C */ -SC_FUNC char* duplicatestring(const char* sourcestring); -SC_FUNC stringpair *insert_alias(char *name,char *alias); -SC_FUNC stringpair *find_alias(char *name); -SC_FUNC int lookup_alias(char *target,char *name); -SC_FUNC void delete_aliastable(void); -SC_FUNC stringlist *insert_path(char *path); -SC_FUNC char *get_path(int index); -SC_FUNC void delete_pathtable(void); -SC_FUNC stringpair *insert_subst(const char *pattern,const char *substitution,int prefixlen); -SC_FUNC int get_subst(int index,char **pattern,char **substitution); -SC_FUNC stringpair *find_subst(char *name,int length); -SC_FUNC int delete_subst(char *name,int length); -SC_FUNC void delete_substtable(void); -SC_FUNC stringlist *insert_sourcefile(char *string); -SC_FUNC char *get_sourcefile(int index); -SC_FUNC void delete_sourcefiletable(void); -SC_FUNC stringlist *insert_docstring(char *string); -SC_FUNC char *get_docstring(int index); -SC_FUNC void delete_docstring(int index); -SC_FUNC void delete_docstringtable(void); -SC_FUNC stringlist *insert_autolist(const char *string); -SC_FUNC char *get_autolist(int index); -SC_FUNC void delete_autolisttable(void); -SC_FUNC stringlist *insert_dbgfile(const char *filename); -SC_FUNC stringlist *insert_dbgline(int linenr); -SC_FUNC stringlist *insert_dbgsymbol(symbol *sym); -SC_FUNC char *get_dbgstring(int index); -SC_FUNC void delete_dbgstringtable(void); -SC_FUNC stringlist *get_dbgstrings(); +char* duplicatestring(const char* sourcestring); +stringpair *insert_alias(char *name,char *alias); +stringpair *find_alias(char *name); +int lookup_alias(char *target,char *name); +void delete_aliastable(void); +stringlist *insert_path(char *path); +char *get_path(int index); +void delete_pathtable(void); +stringpair *insert_subst(const char *pattern,const char *substitution,int prefixlen); +int get_subst(int index,char **pattern,char **substitution); +stringpair *find_subst(char *name,int length); +int delete_subst(char *name,int length); +void delete_substtable(void); +stringlist *insert_sourcefile(char *string); +char *get_sourcefile(int index); +void delete_sourcefiletable(void); +stringlist *insert_docstring(char *string); +char *get_docstring(int index); +void delete_docstring(int index); +void delete_docstringtable(void); +stringlist *insert_autolist(const char *string); +char *get_autolist(int index); +void delete_autolisttable(void); +stringlist *insert_dbgfile(const char *filename); +stringlist *insert_dbgline(int linenr); +stringlist *insert_dbgsymbol(symbol *sym); +char *get_dbgstring(int index); +void delete_dbgstringtable(void); +stringlist *get_dbgstrings(); /* function prototypes in SCI18N.C */ #define MAXCODEPAGE 12 -SC_FUNC int cp_path(const char *root,const char *directory); -SC_FUNC int cp_set(const char *name); -SC_FUNC cell cp_translate(const unsigned char *string,const unsigned char **endptr); -SC_FUNC cell get_utf8_char(const unsigned char *string,const unsigned char **endptr); -SC_FUNC int scan_utf8(void *fp,const char *filename); +int cp_path(const char *root,const char *directory); +int cp_set(const char *name); +cell cp_translate(const unsigned char *string,const unsigned char **endptr); +cell get_utf8_char(const unsigned char *string,const unsigned char **endptr); +int scan_utf8(void *fp,const char *filename); /* function prototypes in SCSTATE.C */ -SC_FUNC constvalue *automaton_add(const char *name); -SC_FUNC constvalue *automaton_find(const char *name); -SC_FUNC constvalue *automaton_findid(int id); -SC_FUNC constvalue *state_add(const char *name,int fsa_id); -SC_FUNC constvalue *state_find(const char *name,int fsa_id); -SC_FUNC constvalue *state_findid(int id); -SC_FUNC void state_buildlist(int **list,int *listsize,int *count,int stateid); -SC_FUNC int state_addlist(int *list,int count,int fsa_id); -SC_FUNC void state_deletetable(void); -SC_FUNC int state_getfsa(int listid); -SC_FUNC int state_count(int listid); -SC_FUNC int state_inlist(int listid,int state); -SC_FUNC int state_listitem(int listid,int index); -SC_FUNC void state_conflict(symbol *root); -SC_FUNC int state_conflict_id(int listid1,int listid2); +constvalue *automaton_add(const char *name); +constvalue *automaton_find(const char *name); +constvalue *automaton_findid(int id); +constvalue *state_add(const char *name,int fsa_id); +constvalue *state_find(const char *name,int fsa_id); +constvalue *state_findid(int id); +void state_buildlist(int **list,int *listsize,int *count,int stateid); +int state_addlist(int *list,int count,int fsa_id); +void state_deletetable(void); +int state_getfsa(int listid); +int state_count(int listid); +int state_inlist(int listid,int state); +int state_listitem(int listid,int index); +void state_conflict(symbol *root); +int state_conflict_id(int listid1,int listid2); /* external variables (defined in scvars.c) */ #if !defined SC_SKIP_VDECL typedef struct HashTable HashTable; -SC_VDECL struct HashTable *sp_Globals; -SC_VDECL symbol loctab; /* local symbol table */ -SC_VDECL symbol glbtab; /* global symbol table */ -SC_VDECL cell *litq; /* the literal queue */ -SC_VDECL unsigned char pline[]; /* the line read from the input file */ -SC_VDECL const unsigned char *lptr;/* points to the current position in "pline" */ -SC_VDECL constvalue tagname_tab;/* tagname table */ -SC_VDECL constvalue libname_tab;/* library table (#pragma library "..." syntax) */ -SC_VDECL constvalue *curlibrary;/* current library */ -SC_VDECL int pc_addlibtable; /* is the library table added to the AMX file? */ -SC_VDECL symbol *curfunc; /* pointer to current function */ -SC_VDECL char *inpfname; /* name of the file currently read from */ -SC_VDECL char outfname[]; /* intermediate (assembler) file name */ -SC_VDECL char binfname[]; /* binary file name */ -SC_VDECL char errfname[]; /* error file name */ -SC_VDECL char sc_ctrlchar; /* the control character (or escape character) */ -SC_VDECL char sc_ctrlchar_org;/* the default control character */ -SC_VDECL int litidx; /* index to literal table */ -SC_VDECL int litmax; /* current size of the literal table */ -SC_VDECL int stgidx; /* index to the staging buffer */ -SC_VDECL int sc_labnum; /* number of (internal) labels */ -SC_VDECL int staging; /* true if staging output */ -SC_VDECL cell declared; /* number of local cells declared */ -SC_VDECL cell glb_declared; /* number of global cells declared */ -SC_VDECL cell code_idx; /* number of bytes with generated code */ -SC_VDECL int ntv_funcid; /* incremental number of native function */ -SC_VDECL int errnum; /* number of errors */ -SC_VDECL int warnnum; /* number of warnings */ -SC_VDECL int sc_debug; /* debug/optimization options (bit field) */ -SC_VDECL int sc_packstr; /* strings are packed by default? */ -SC_VDECL int sc_asmfile; /* create .ASM file? */ -SC_VDECL int sc_listing; /* create .LST file? */ -SC_VDECL int sc_compress; /* compress bytecode? */ -SC_VDECL int sc_needsemicolon;/* semicolon required to terminate expressions? */ -SC_VDECL int sc_dataalign; /* data alignment value */ -SC_VDECL int sc_alignnext; /* must frame of the next function be aligned? */ -SC_VDECL int pc_docexpr; /* must expression be attached to documentation comment? */ -SC_VDECL int sc_showincludes; /* show include files? */ -SC_VDECL int curseg; /* 1 if currently parsing CODE, 2 if parsing DATA */ -SC_VDECL cell pc_stksize; /* stack size */ -SC_VDECL cell pc_amxlimit; /* abstract machine size limit (code + data, or only code) */ -SC_VDECL cell pc_amxram; /* abstract machine data size limit */ -SC_VDECL int freading; /* is there an input file ready for reading? */ -SC_VDECL int fline; /* the line number in the current file */ -SC_VDECL short fnumber; /* number of files in the file table (debugging) */ -SC_VDECL short fcurrent; /* current file being processed (debugging) */ -SC_VDECL short sc_intest; /* true if inside a test */ -SC_VDECL int sideeffect; /* true if an expression causes a side-effect */ -SC_VDECL int stmtindent; /* current indent of the statement */ -SC_VDECL int indent_nowarn; /* skip warning "217 loose indentation" */ -SC_VDECL int sc_tabsize; /* number of spaces that a TAB represents */ -SC_VDECL short sc_allowtags; /* allow/detect tagnames in lex() */ -SC_VDECL int sc_status; /* read/write status */ -SC_VDECL int sc_err_status; /* TRUE if errors should be generated even if sc_status = SKIP */ -SC_VDECL int sc_rationaltag; /* tag for rational numbers */ -SC_VDECL int rational_digits; /* number of fractional digits */ -SC_VDECL int sc_allowproccall;/* allow/detect tagnames in lex() */ -SC_VDECL short sc_is_utf8; /* is this source file in UTF-8 encoding */ -SC_VDECL char *pc_deprecate; /* if non-NULL, mark next declaration as deprecated */ -SC_VDECL int sc_curstates; /* ID of the current state list */ -SC_VDECL int pc_optimize; /* (peephole) optimization level */ -SC_VDECL int pc_memflags; /* special flags for the stack/heap usage */ -SC_VDECL int pc_functag; /* global function tag */ -SC_VDECL int pc_tag_string; /* global String tag */ -SC_VDECL int pc_tag_void; /* global void tag */ -SC_VDECL int pc_tag_object; /* root object tag */ -SC_VDECL int pc_tag_bool; /* global bool tag */ -SC_VDECL int pc_tag_null_t; /* the null type */ -SC_VDECL int pc_tag_nullfunc_t; /* the null function type */ -SC_VDECL int pc_anytag; /* global any tag */ -SC_VDECL int glbstringread; /* last global string read */ -SC_VDECL int sc_require_newdecls; /* only newdecls are allowed */ +extern struct HashTable *sp_Globals; +extern symbol loctab; /* local symbol table */ +extern symbol glbtab; /* global symbol table */ +extern cell *litq; /* the literal queue */ +extern unsigned char pline[]; /* the line read from the input file */ +extern const unsigned char *lptr;/* points to the current position in "pline" */ +extern constvalue tagname_tab;/* tagname table */ +extern constvalue libname_tab;/* library table (#pragma library "..." syntax) */ +extern constvalue *curlibrary;/* current library */ +extern int pc_addlibtable; /* is the library table added to the AMX file? */ +extern symbol *curfunc; /* pointer to current function */ +extern char *inpfname; /* name of the file currently read from */ +extern char outfname[]; /* intermediate (assembler) file name */ +extern char binfname[]; /* binary file name */ +extern char errfname[]; /* error file name */ +extern char sc_ctrlchar; /* the control character (or escape character) */ +extern char sc_ctrlchar_org;/* the default control character */ +extern int litidx; /* index to literal table */ +extern int litmax; /* current size of the literal table */ +extern int stgidx; /* index to the staging buffer */ +extern int sc_labnum; /* number of (internal) labels */ +extern int staging; /* true if staging output */ +extern cell declared; /* number of local cells declared */ +extern cell glb_declared; /* number of global cells declared */ +extern cell code_idx; /* number of bytes with generated code */ +extern int ntv_funcid; /* incremental number of native function */ +extern int errnum; /* number of errors */ +extern int warnnum; /* number of warnings */ +extern int sc_debug; /* debug/optimization options (bit field) */ +extern int sc_packstr; /* strings are packed by default? */ +extern int sc_asmfile; /* create .ASM file? */ +extern int sc_listing; /* create .LST file? */ +extern int sc_compress; /* compress bytecode? */ +extern int sc_needsemicolon;/* semicolon required to terminate expressions? */ +extern int sc_dataalign; /* data alignment value */ +extern int sc_alignnext; /* must frame of the next function be aligned? */ +extern int pc_docexpr; /* must expression be attached to documentation comment? */ +extern int sc_showincludes; /* show include files? */ +extern int curseg; /* 1 if currently parsing CODE, 2 if parsing DATA */ +extern cell pc_stksize; /* stack size */ +extern cell pc_amxlimit; /* abstract machine size limit (code + data, or only code) */ +extern cell pc_amxram; /* abstract machine data size limit */ +extern int freading; /* is there an input file ready for reading? */ +extern int fline; /* the line number in the current file */ +extern short fnumber; /* number of files in the file table (debugging) */ +extern short fcurrent; /* current file being processed (debugging) */ +extern short sc_intest; /* true if inside a test */ +extern int sideeffect; /* true if an expression causes a side-effect */ +extern int stmtindent; /* current indent of the statement */ +extern int indent_nowarn; /* skip warning "217 loose indentation" */ +extern int sc_tabsize; /* number of spaces that a TAB represents */ +extern short sc_allowtags; /* allow/detect tagnames in lex() */ +extern int sc_status; /* read/write status */ +extern int sc_err_status; /* TRUE if errors should be generated even if sc_status = SKIP */ +extern int sc_rationaltag; /* tag for rational numbers */ +extern int rational_digits; /* number of fractional digits */ +extern int sc_allowproccall;/* allow/detect tagnames in lex() */ +extern short sc_is_utf8; /* is this source file in UTF-8 encoding */ +extern char *pc_deprecate; /* if non-NULL, mark next declaration as deprecated */ +extern int sc_curstates; /* ID of the current state list */ +extern int pc_optimize; /* (peephole) optimization level */ +extern int pc_memflags; /* special flags for the stack/heap usage */ +extern int pc_functag; /* global function tag */ +extern int pc_tag_string; /* global String tag */ +extern int pc_tag_void; /* global void tag */ +extern int pc_tag_object; /* root object tag */ +extern int pc_tag_bool; /* global bool tag */ +extern int pc_tag_null_t; /* the null type */ +extern int pc_tag_nullfunc_t; /* the null function type */ +extern int pc_anytag; /* global any tag */ +extern int glbstringread; /* last global string read */ +extern int sc_require_newdecls; /* only newdecls are allowed */ -SC_VDECL constvalue sc_automaton_tab; /* automaton table */ -SC_VDECL constvalue sc_state_tab; /* state table */ +extern constvalue sc_automaton_tab; /* automaton table */ +extern constvalue sc_state_tab; /* state table */ -SC_VDECL void *inpf; /* file read from (source or include) */ -SC_VDECL void *inpf_org; /* main source file */ -SC_VDECL void *outf; /* file written to */ +extern void *inpf; /* file read from (source or include) */ +extern void *inpf_org; /* main source file */ +extern void *outf; /* file written to */ -SC_VDECL jmp_buf errbuf; /* target of longjmp() on a fatal error */ +extern jmp_buf errbuf; /* target of longjmp() on a fatal error */ #if !defined SC_LIGHT - SC_VDECL int sc_makereport; /* generate a cross-reference report */ + extern int sc_makereport; /* generate a cross-reference report */ #endif #if defined WIN32 diff --git a/sourcepawn/compiler/sc1.cpp b/sourcepawn/compiler/sc1.cpp index 5fb12501..a615d420 100644 --- a/sourcepawn/compiler/sc1.cpp +++ b/sourcepawn/compiler/sc1.cpp @@ -193,9 +193,6 @@ char g_tmpfile[_MAX_PATH] = {0}; /* "main" of the compiler */ -#if defined __cplusplus - extern "C" -#endif int pc_compile(int argc, char *argv[]) { int entry,i,jmpcode; @@ -582,9 +579,6 @@ cleanup: return retcode; } -#if defined __cplusplus - extern "C" -#endif int pc_addconstant(const char *name,cell value,int tag) { errorset(sFORCESET,0); /* make sure error engine is silenced */ @@ -678,9 +672,6 @@ int pc_findtag(const char *name) return -1; } -#if defined __cplusplus - extern "C" -#endif int pc_addtag(const char *name) { int val; @@ -833,7 +824,7 @@ static char *get_extension(char *filename) * Set the default extension, or force an extension. To erase the * extension of a filename, set "extension" to an empty string. */ -SC_FUNC void set_extension(char *filename,const char *extension,int force) +void set_extension(char *filename,const char *extension,int force) { char *ptr; @@ -4726,7 +4717,7 @@ static int compare_tag(int tag1, int tag2) * Finds a function in the global symbol table or creates a new entry. * It does some basic processing and error checking. */ -SC_FUNC symbol *fetchfunc(char *name) +symbol *fetchfunc(char *name) { symbol *sym; @@ -4955,7 +4946,7 @@ static char *tag2str(char *dest,int tag) return isdigit(dest[1]) ? &dest[1] : dest; } -SC_FUNC char *operator_symname(char *symname,const char *opername,int tag1,int tag2,int numtags,int resulttag) +char *operator_symname(char *symname,const char *opername,int tag1,int tag2,int numtags,int resulttag) { char tagstr1[10], tagstr2[10]; int opertok; @@ -5005,7 +4996,7 @@ constvalue *find_tag_byval(int tag) return tagsym; } -SC_FUNC char *funcdisplayname(char *dest,char *funcname) +char *funcdisplayname(char *dest,char *funcname) { int tags[2]; char opname[10]; @@ -6493,7 +6484,7 @@ static constvalue *insert_constval(constvalue *prev,constvalue *next,const char return cur; } -SC_FUNC constvalue *append_constval(constvalue *table,const char *name,cell val,int index) +constvalue *append_constval(constvalue *table,const char *name,cell val,int index) { constvalue *cur,*prev; @@ -6503,7 +6494,7 @@ SC_FUNC constvalue *append_constval(constvalue *table,const char *name,cell val, return insert_constval(prev,NULL,name,val,index); } -SC_FUNC constvalue *find_constval(constvalue *table,char *name,int index) +constvalue *find_constval(constvalue *table,char *name,int index) { constvalue *ptr = table->next; @@ -6546,7 +6537,7 @@ static int delete_constval(constvalue *table,char *name) } #endif -SC_FUNC void delete_consttable(constvalue *table) +void delete_consttable(constvalue *table) { constvalue *cur=table->next, *next; @@ -6562,7 +6553,7 @@ SC_FUNC void delete_consttable(constvalue *table) * * Adds a symbol to the symbol table. Returns NULL on failure. */ -SC_FUNC symbol *add_constant(const char *name,cell val,int vclass,int tag) +symbol *add_constant(const char *name,cell val,int vclass,int tag) { symbol *sym; @@ -6896,7 +6887,7 @@ static int doexpr2(int comma,int chkeffect,int allowarray,int mark_endexpr, /* exprconst */ -SC_FUNC int exprconst(cell *val,int *tag,symbol **symptr) +int exprconst(cell *val,int *tag,symbol **symptr) { int ident,index; cell cidx; @@ -7633,7 +7624,7 @@ static void docont(void) jumplabel(ptr[wqLOOP]); } -SC_FUNC void exporttag(int tag) +void exporttag(int tag) { /* find the tag by value in the table, then set the top bit to mark it * "public" diff --git a/sourcepawn/compiler/sc2.cpp b/sourcepawn/compiler/sc2.cpp index 04b87d34..76be50e3 100644 --- a/sourcepawn/compiler/sc2.cpp +++ b/sourcepawn/compiler/sc2.cpp @@ -86,7 +86,7 @@ static double pow10(double d) static stkitem *stack=NULL; static int stkidx=0,stktop=0; -SC_FUNC void pushstk(stkitem val) +void pushstk(stkitem val) { assert(stkidx<=stktop); if (stkidx==stktop) { @@ -109,7 +109,7 @@ SC_FUNC void pushstk(stkitem val) stkidx+=1; } -SC_FUNC stkitem popstk(void) +stkitem popstk(void) { if (stkidx==0) { stkitem s; @@ -121,7 +121,7 @@ SC_FUNC stkitem popstk(void) return stack[stkidx]; } -SC_FUNC void clearstk(void) +void clearstk(void) { assert(stack!=NULL || stktop==0); if (stack!=NULL) { @@ -132,7 +132,7 @@ SC_FUNC void clearstk(void) assert(stktop==0); } -SC_FUNC int plungequalifiedfile(char *name) +int plungequalifiedfile(char *name) { static const char *extensions[] = { ".inc", ".p", ".pawn" }; @@ -185,7 +185,7 @@ SC_FUNC int plungequalifiedfile(char *name) return TRUE; } -SC_FUNC int plungefile(char *name,int try_currentpath,int try_includepaths) +int plungefile(char *name,int try_currentpath,int try_includepaths) { int result=FALSE; @@ -1793,7 +1793,7 @@ static int scanellipsis(const unsigned char *lptr) * pline (altered) * freading (referred to only) */ -SC_FUNC void preprocess(void) +void preprocess(void) { int iscommand; @@ -1932,7 +1932,7 @@ static full_token_t *next_token() return &sTokenBuffer->tokens[cursor]; } -SC_FUNC void lexinit(void) +void lexinit(void) { stkidx=0; /* index for pushstk() and popstk() */ iflevel=0; /* preprocessor: nesting of "#if" is currently 0 */ @@ -2001,7 +2001,7 @@ static void lexpop() sTokenBuffer->cursor = 0; } -SC_FUNC int lex(cell *lexvalue,char **lexsym) +int lex(cell *lexvalue,char **lexsym) { int i,toolong,newline; const unsigned char *starttoken; @@ -2259,7 +2259,7 @@ SC_FUNC int lex(cell *lexvalue,char **lexsym) * to read and return the information from these variables, rather than * to read in a new token from the input file. */ -SC_FUNC void lexpush(void) +void lexpush(void) { assert(sTokenBuffer->depth < MAX_TOKEN_DEPTH); sTokenBuffer->depth++; @@ -2276,7 +2276,7 @@ SC_FUNC void lexpush(void) * symbol (a not continue with some old one). This is required upon return * from Assembler mode, and in a few cases after detecting an syntax error. */ -SC_FUNC void lexclr(int clreol) +void lexclr(int clreol) { sTokenBuffer->depth = 0; if (clreol) { @@ -2286,7 +2286,7 @@ SC_FUNC void lexclr(int clreol) } // Return true if the symbol is ahead, false otherwise. -SC_FUNC int lexpeek(int id) +int lexpeek(int id) { if (matchtoken(id)) { lexpush(); @@ -2305,7 +2305,7 @@ SC_FUNC int lexpeek(int id) * (i.e. not present in the source code) should not be pushed back, which is * why it is sometimes important to distinguish the two. */ -SC_FUNC int matchtoken(int token) +int matchtoken(int token) { cell val; char *str; @@ -2338,7 +2338,7 @@ SC_FUNC int matchtoken(int token) * * The token itself is the return value. Normally, this one is already known. */ -SC_FUNC int tokeninfo(cell *val,char **str) +int tokeninfo(cell *val,char **str) { *val = current_token()->value; *str = current_token()->str; @@ -2352,7 +2352,7 @@ SC_FUNC int tokeninfo(cell *val,char **str) * this function returns 1 for "token found" and 2 for "statement termination * token" found; see function matchtoken() for details. */ -SC_FUNC int needtoken(int token) +int needtoken(int token) { char s1[20],s2[20]; int t; @@ -2379,7 +2379,7 @@ SC_FUNC int needtoken(int token) // If the next token is on the current line, return that token. Otherwise, // return tNEWLINE. -SC_FUNC int peek_same_line() +int peek_same_line() { // We should not call this without having parsed at least one token. assert(sTokenBuffer->num_tokens > 0); @@ -2407,7 +2407,7 @@ SC_FUNC int peek_same_line() return tEOL; } -SC_FUNC int require_newline(int allow_semi) +int require_newline(int allow_semi) { if (allow_semi) { // Semicolon must be on the same line. @@ -2482,7 +2482,7 @@ static void chk_grow_litq(void) * Global references: litidx (altered) * litq (altered) */ -SC_FUNC void litadd(cell value) +void litadd(cell value) { chk_grow_litq(); assert(litidx='0' && c<='9') || (c>='a' && c<='f') || (c>='A' && c<='F'); } @@ -2717,7 +2717,7 @@ static void free_symbol(symbol *sym) free(sym); } -SC_FUNC void delete_symbol(symbol *root,symbol *sym) +void delete_symbol(symbol *root,symbol *sym) { symbol *origRoot=root; /* find the symbol and its predecessor @@ -2738,7 +2738,7 @@ SC_FUNC void delete_symbol(symbol *root,symbol *sym) free_symbol(sym); } -SC_FUNC int get_actual_compound(symbol *sym) +int get_actual_compound(symbol *sym) { if (sym->ident == iARRAY || sym->ident == iREFARRAY) { while (sym->parent) @@ -2748,7 +2748,7 @@ SC_FUNC int get_actual_compound(symbol *sym) return sym->compound; } -SC_FUNC void delete_symbols(symbol *root,int level,int delete_labels,int delete_functions) +void delete_symbols(symbol *root,int level,int delete_labels,int delete_functions) { symbol *origRoot=root; symbol *sym,*parent_sym; @@ -2908,7 +2908,7 @@ static symbol *find_symbol_child(const symbol *root,const symbol *sym) * bywhom will be the function that uses a variable or that calls * the function. */ -SC_FUNC int refer_symbol(symbol *entry,symbol *bywhom) +int refer_symbol(symbol *entry,symbol *bywhom) { int count; @@ -2950,7 +2950,7 @@ SC_FUNC int refer_symbol(symbol *entry,symbol *bywhom) return TRUE; } -SC_FUNC void markusage(symbol *sym,int usage) +void markusage(symbol *sym,int usage) { assert(sym!=NULL); sym->usage |= (char)usage; @@ -2974,7 +2974,7 @@ SC_FUNC void markusage(symbol *sym,int usage) * * Returns a pointer to the global symbol (if found) or NULL (if not found) */ -SC_FUNC symbol *findglb(const char *name,int filter) +symbol *findglb(const char *name,int filter) { /* find a symbol with a matching automaton first */ symbol *sym=NULL; @@ -3010,12 +3010,12 @@ SC_FUNC symbol *findglb(const char *name,int filter) * 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. */ -SC_FUNC symbol *findloc(const char *name) +symbol *findloc(const char *name) { return find_symbol(&loctab,name,-1,-1,NULL); } -SC_FUNC symbol *findconst(const char *name,int *cmptag) +symbol *findconst(const char *name,int *cmptag) { symbol *sym; @@ -3033,7 +3033,7 @@ SC_FUNC symbol *findconst(const char *name,int *cmptag) return sym; } -SC_FUNC symbol *finddepend(const symbol *parent) +symbol *finddepend(const symbol *parent) { symbol *sym; @@ -3048,7 +3048,7 @@ SC_FUNC symbol *finddepend(const symbol *parent) * Adds a symbol to the symbol table (either global or local variables, * or global and local constants). */ -SC_FUNC symbol *addsym(const char *name,cell addr,int ident,int vclass,int tag,int usage) +symbol *addsym(const char *name,cell addr,int ident,int vclass,int tag,int usage) { symbol entry, **refer; @@ -3083,13 +3083,13 @@ SC_FUNC symbol *addsym(const char *name,cell addr,int ident,int vclass,int tag,i return add_symbol(&loctab,&entry,FALSE); } -SC_FUNC symbol *addvariable(const char *name,cell addr,int ident,int vclass,int tag, +symbol *addvariable(const char *name,cell addr,int ident,int vclass,int tag, int dim[],int numdim,int idxtag[]) { return addvariable2(name,addr,ident,vclass,tag,dim,numdim,idxtag,0); } -SC_FUNC symbol *addvariable3(declinfo_t *decl,cell addr,int vclass,int slength) +symbol *addvariable3(declinfo_t *decl,cell addr,int vclass,int slength) { typeinfo_t *type = &decl->type; return addvariable2( @@ -3105,7 +3105,7 @@ SC_FUNC symbol *addvariable3(declinfo_t *decl,cell addr,int vclass,int slength) ); } -SC_FUNC symbol *addvariable2(const char *name,cell addr,int ident,int vclass,int tag, +symbol *addvariable2(const char *name,cell addr,int ident,int vclass,int tag, int dim[],int numdim,int idxtag[],int slength) { symbol *sym; @@ -3154,7 +3154,7 @@ SC_FUNC symbol *addvariable2(const char *name,cell addr,int ident,int vclass,int * Returns te next internal label number. The global variable sc_labnum is * initialized to zero. */ -SC_FUNC int getlabel(void) +int getlabel(void) { return sc_labnum++; } @@ -3164,7 +3164,7 @@ SC_FUNC int getlabel(void) * Converts a number to a hexadecimal string and returns a pointer to that * string. This function is NOT re-entrant. */ -SC_FUNC char *itoh(ucell val) +char *itoh(ucell val) { static char itohstr[30]; char *ptr; @@ -3199,13 +3199,13 @@ static char itohstr[30]; return itohstr; } -SC_FUNC int lextok(token_t *tok) +int lextok(token_t *tok) { tok->id = lex(&tok->val, &tok->str); return tok->id; } -SC_FUNC int expecttoken(int id, token_t *tok) +int expecttoken(int id, token_t *tok) { int rval = needtoken(id); if (rval) { @@ -3217,7 +3217,7 @@ SC_FUNC int expecttoken(int id, token_t *tok) return FALSE; } -SC_FUNC int matchtoken2(int id, token_t *tok) +int matchtoken2(int id, token_t *tok) { if (matchtoken(id)) { tok->id = tokeninfo(&tok->val, &tok->str); @@ -3226,7 +3226,7 @@ SC_FUNC int matchtoken2(int id, token_t *tok) return FALSE; } -SC_FUNC int matchsymbol(token_ident_t *ident) +int matchsymbol(token_ident_t *ident) { if (lextok(&ident->tok) != tSYMBOL) { lexpush(); @@ -3237,7 +3237,7 @@ SC_FUNC int matchsymbol(token_ident_t *ident) return TRUE; } -SC_FUNC int needsymbol(token_ident_t *ident) +int needsymbol(token_ident_t *ident) { if (!expecttoken(tSYMBOL, &ident->tok)) return FALSE; diff --git a/sourcepawn/compiler/sc3.cpp b/sourcepawn/compiler/sc3.cpp index 075a1d7a..42c49636 100644 --- a/sourcepawn/compiler/sc3.cpp +++ b/sourcepawn/compiler/sc3.cpp @@ -113,7 +113,7 @@ static int nextop(int *opidx,int *list) return FALSE; /* entire list scanned, nothing found */ } -SC_FUNC int check_userop(void (*oper)(void),int tag1,int tag2,int numparam, +int check_userop(void (*oper)(void),int tag1,int tag2,int numparam, value *lval,int *resulttag) { static const char *binoperstr[] = { @@ -290,7 +290,7 @@ SC_FUNC int check_userop(void (*oper)(void),int tag1,int tag2,int numparam, return TRUE; } -SC_FUNC int checktags_string(int tags[], int numtags, value *sym1) +int checktags_string(int tags[], int numtags, value *sym1) { int i; if (sym1->ident == iARRAY || sym1->ident == iREFARRAY) @@ -305,7 +305,7 @@ SC_FUNC int checktags_string(int tags[], int numtags, value *sym1) return FALSE; } -SC_FUNC int checktag_string(value *sym1, value *sym2) +int checktag_string(value *sym1, value *sym2) { if (sym1->ident == iARRAY || sym2->ident == iARRAY || sym1->ident == iREFARRAY || sym2->ident == iREFARRAY) @@ -321,7 +321,7 @@ SC_FUNC int checktag_string(value *sym1, value *sym2) return FALSE; } -SC_FUNC const char *type_to_name(int tag) +const char *type_to_name(int tag) { if (tag == 0) return "int"; @@ -339,7 +339,7 @@ SC_FUNC const char *type_to_name(int tag) return "unknown"; } -SC_FUNC int matchtag_string(int ident, int tag) +int matchtag_string(int ident, int tag) { if (ident == iARRAY || ident == iREFARRAY) return FALSE; @@ -519,7 +519,7 @@ static int matchfunctags(int formaltag, int actualtag) return FALSE; } -SC_FUNC int matchtag(int formaltag, int actualtag, int flags) +int matchtag(int formaltag, int actualtag, int flags) { if (formaltag == actualtag) return TRUE; @@ -958,7 +958,7 @@ static cell calc(cell left,void (*oper)(),cell right,char *boolresult) return 0; } -SC_FUNC int lvalexpr(svalue *sval) +int lvalexpr(svalue *sval) { memset(sval, 0, sizeof(*sval)); @@ -971,7 +971,7 @@ SC_FUNC int lvalexpr(svalue *sval) return sval->val.ident; } -SC_FUNC int expression(cell *val,int *tag,symbol **symptr,int chkfuncresult,value *_lval) +int expression(cell *val,int *tag,symbol **symptr,int chkfuncresult,value *_lval) { value lval={0}; pushheaplist(); @@ -994,7 +994,7 @@ SC_FUNC int expression(cell *val,int *tag,symbol **symptr,int chkfuncresult,valu return lval.ident; } -SC_FUNC int sc_getstateid(constvalue **automaton,constvalue **state) +int sc_getstateid(constvalue **automaton,constvalue **state) { char name[sNAMEMAX+1]; cell val; @@ -1047,7 +1047,7 @@ SC_FUNC int sc_getstateid(constvalue **automaton,constvalue **state) return 1; } -SC_FUNC cell array_totalsize(symbol *sym) +cell array_totalsize(symbol *sym) { cell length; diff --git a/sourcepawn/compiler/sc4.cpp b/sourcepawn/compiler/sc4.cpp index 214d4e50..b9c9fb5c 100644 --- a/sourcepawn/compiler/sc4.cpp +++ b/sourcepawn/compiler/sc4.cpp @@ -34,14 +34,14 @@ static int fcurseg; /* the file number (fcurrent) for the active segment */ -SC_FUNC void load_i(); +void load_i(); /* When a subroutine returns to address 0, the AMX must halt. In earlier * releases, the RET and RETN opcodes checked for the special case 0 address. * Today, the compiler simply generates a HALT instruction at address 0. So * a subroutine can savely return to 0, and then encounter a HALT. */ -SC_FUNC void writeleader(symbol *root) +void writeleader(symbol *root) { int lbl_nostate,lbl_table; int statecount; @@ -175,7 +175,7 @@ SC_FUNC void writeleader(symbol *root) * code_idx (altered) * glb_declared (altered) */ -SC_FUNC void writetrailer(void) +void writetrailer(void) { assert(sc_dataalign % opcodes(1) == 0); /* alignment must be a multiple of * the opcode size */ @@ -215,7 +215,7 @@ SC_FUNC void writetrailer(void) * Global references: curseg * fcurrent */ -SC_FUNC void begcseg(void) +void begcseg(void) { if (sc_status!=statSKIP && (curseg!=sIN_CSEG || fcurrent!=fcurseg)) { stgwrite("\n"); @@ -233,7 +233,7 @@ SC_FUNC void begcseg(void) * * Global references: curseg */ -SC_FUNC void begdseg(void) +void begdseg(void) { if (sc_status!=statSKIP && (curseg!=sIN_DSEG || fcurrent!=fcurseg)) { stgwrite("\n"); @@ -246,7 +246,7 @@ SC_FUNC void begdseg(void) } /* if */ } -SC_FUNC void setline(int chkbounds) +void setline(int chkbounds) { if (sc_asmfile) { stgwrite("\t; line "); @@ -263,7 +263,7 @@ SC_FUNC void setline(int chkbounds) } /* if */ } -SC_FUNC void setfiledirect(char *name) +void setfiledirect(char *name) { if (sc_status==statFIRST && sc_listing) { assert(name!=NULL); @@ -273,7 +273,7 @@ SC_FUNC void setfiledirect(char *name) } /* if */ } -SC_FUNC void setlinedirect(int line) +void setlinedirect(int line) { if (sc_status==statFIRST && sc_listing) { char string[40]; @@ -286,7 +286,7 @@ SC_FUNC void setlinedirect(int line) * * Post a code label (specified as a number), on a new line. */ -SC_FUNC void setlabel(int number) +void setlabel(int number) { assert(number>=0); stgwrite("l."); @@ -307,7 +307,7 @@ SC_FUNC void setlabel(int number) * statement. This allows several simple optimizations by the peephole * optimizer. */ -SC_FUNC void markexpr(optmark type,const char *name,cell offset) +void markexpr(optmark type,const char *name,cell offset) { switch (type) { case sEXPR: @@ -332,7 +332,7 @@ SC_FUNC void markexpr(optmark type,const char *name,cell offset) * * Global references: funcstatus (referred to only) */ -SC_FUNC void startfunc(char *fname) +void startfunc(char *fname) { stgwrite("\tproc"); if (sc_asmfile) { @@ -349,7 +349,7 @@ SC_FUNC void startfunc(char *fname) * * Declare a CODE ending point (function end) */ -SC_FUNC void endfunc(void) +void endfunc(void) { stgwrite("\n"); /* skip a line */ } @@ -361,7 +361,7 @@ SC_FUNC void endfunc(void) * be a power of 2, and this alignment must be done right after the frame * is set up (before the first variable is declared) */ -SC_FUNC void alignframe(int numbytes) +void alignframe(int numbytes) { #if !defined NDEBUG /* "numbytes" should be a power of 2 for this code to work */ @@ -385,7 +385,7 @@ SC_FUNC void alignframe(int numbytes) * * Generate code to get the value of a symbol into "primary". */ -SC_FUNC void rvalue(value *lval) +void rvalue(value *lval) { symbol *sym; @@ -429,7 +429,7 @@ SC_FUNC void rvalue(value *lval) /* Get the address of a symbol into the primary or alternate register (used * for arrays, and for passing arguments by reference). */ -SC_FUNC void address(symbol *sym,regid reg) +void address(symbol *sym,regid reg) { assert(sym!=NULL); assert(reg==sPRI || reg==sALT); @@ -495,20 +495,20 @@ static void load_argcount(regid reg) } // PRI = ALT + (PRI * cellsize) -SC_FUNC void idxaddr() +void idxaddr() { stgwrite("\tidxaddr\n"); code_idx += opcodes(1); } -SC_FUNC void load_i() +void load_i() { stgwrite("\tload.i\n"); code_idx+=opcodes(1); } // Load the hidden array argument into ALT. -SC_FUNC void load_hidden_arg() +void load_hidden_arg() { pushreg(sPRI); @@ -533,7 +533,7 @@ SC_FUNC void load_hidden_arg() * Saves the contents of "primary" into a memory cell, either directly * or indirectly (at the address given in the alternate register). */ -SC_FUNC void store(value *lval) +void store(value *lval) { symbol *sym; @@ -570,7 +570,7 @@ SC_FUNC void store(value *lval) } /* Get a cell from a fixed address in memory */ -SC_FUNC void loadreg(cell address,regid reg) +void loadreg(cell address,regid reg) { assert(reg==sPRI || reg==sALT); if (reg==sPRI) @@ -582,7 +582,7 @@ SC_FUNC void loadreg(cell address,regid reg) } /* Store a cell into a fixed address in memory */ -SC_FUNC void storereg(cell address,regid reg) +void storereg(cell address,regid reg) { assert(reg==sPRI || reg==sALT); if (reg==sPRI) @@ -596,7 +596,7 @@ SC_FUNC void storereg(cell address,regid reg) /* source must in PRI, destination address in ALT. The "size" * parameter is in bytes, not cells. */ -SC_FUNC void memcopy(cell size) +void memcopy(cell size) { stgwrite("\tmovs "); outval(size,TRUE); @@ -607,7 +607,7 @@ SC_FUNC void memcopy(cell size) /* Address of the source must already have been loaded in PRI * "size" is the size in bytes (not cells). */ -SC_FUNC void copyarray(symbol *sym,cell size) +void copyarray(symbol *sym,cell size) { assert(sym!=NULL); /* the symbol can be a local array, a global array, or an array @@ -631,7 +631,7 @@ SC_FUNC void copyarray(symbol *sym,cell size) memcopy(size); } -SC_FUNC void fillarray(symbol *sym,cell size,cell value) +void fillarray(symbol *sym,cell size,cell value) { ldconst(value,sPRI); /* load value in PRI */ @@ -660,7 +660,7 @@ SC_FUNC void fillarray(symbol *sym,cell size,cell value) code_idx+=opcodes(2)+opargs(2); } -SC_FUNC void stradjust(regid reg) +void stradjust(regid reg) { assert(reg==sPRI); stgwrite("\tstradjust.pri\n"); @@ -670,7 +670,7 @@ SC_FUNC void stradjust(regid reg) /* Instruction to get an immediate value into the primary or the alternate * register */ -SC_FUNC void ldconst(cell val,regid reg) +void ldconst(cell val,regid reg) { assert(reg==sPRI || reg==sALT); switch (reg) { @@ -698,13 +698,13 @@ SC_FUNC void ldconst(cell val,regid reg) } /* Copy value in alternate register to the primary register */ -SC_FUNC void moveto1(void) +void moveto1(void) { stgwrite("\tmove.pri\n"); code_idx+=opcodes(1)+opargs(0); } -SC_FUNC void move_alt(void) +void move_alt(void) { stgwrite("\tmove.alt\n"); code_idx+=opcodes(1)+opargs(0); @@ -712,7 +712,7 @@ SC_FUNC void move_alt(void) /* Push primary or the alternate register onto the stack */ -SC_FUNC void pushreg(regid reg) +void pushreg(regid reg) { assert(reg==sPRI || reg==sALT); switch (reg) { @@ -729,7 +729,7 @@ SC_FUNC void pushreg(regid reg) /* * Push a constant value onto the stack */ -SC_FUNC void pushval(cell val) +void pushval(cell val) { stgwrite("\tpush.c "); outval(val, TRUE); @@ -738,7 +738,7 @@ SC_FUNC void pushval(cell val) /* Pop stack into the primary or the alternate register */ -SC_FUNC void popreg(regid reg) +void popreg(regid reg) { assert(reg==sPRI || reg==sALT); switch (reg) { @@ -755,7 +755,7 @@ SC_FUNC void popreg(regid reg) /* * Generate an array */ -SC_FUNC void genarray(int dims, int _autozero) +void genarray(int dims, int _autozero) { if (_autozero) { stgwrite("\tgenarray.z "); @@ -769,7 +769,7 @@ SC_FUNC void genarray(int dims, int _autozero) /* * swap the top-of-stack with the value in primary register */ -SC_FUNC void swap1(void) +void swap1(void) { stgwrite("\tswap.pri\n"); code_idx+=opcodes(1); @@ -784,14 +784,14 @@ SC_FUNC void swap1(void) * The case table is sorted on the comparison value. This allows more advanced * abstract machines to sift the case table with a binary search. */ -SC_FUNC void ffswitch(int label) +void ffswitch(int label) { stgwrite("\tswitch "); outval(label,TRUE); /* the label is the address of the case table */ code_idx+=opcodes(1)+opargs(1); } -SC_FUNC void ffcase(cell value,char *labelname,int newtable) +void ffcase(cell value,char *labelname,int newtable) { if (newtable) { stgwrite("\tcasetbl\n"); @@ -808,7 +808,7 @@ SC_FUNC void ffcase(cell value,char *labelname,int newtable) /* * Call specified function */ -SC_FUNC void ffcall(symbol *sym,const char *label,int numargs) +void ffcall(symbol *sym,const char *label,int numargs) { char symname[2*sNAMEMAX+16]; char aliasname[sNAMEMAX+1]; @@ -868,7 +868,7 @@ SC_FUNC void ffcall(symbol *sym,const char *label,int numargs) * * Global references: funcstatus (referred to only) */ -SC_FUNC void ffret(int remparams) +void ffret(int remparams) { if (remparams) stgwrite("\tretn\n"); @@ -877,14 +877,14 @@ SC_FUNC void ffret(int remparams) code_idx+=opcodes(1); } -SC_FUNC void ffabort(int reason) +void ffabort(int reason) { stgwrite("\thalt "); outval(reason,TRUE); code_idx+=opcodes(1)+opargs(1); } -SC_FUNC void ffbounds(cell size) +void ffbounds(cell size) { if ((sc_debug & sCHKBOUNDS)!=0) { stgwrite("\tbounds "); @@ -896,7 +896,7 @@ SC_FUNC void ffbounds(cell size) /* * Jump to local label number (the number is converted to a name) */ -SC_FUNC void jumplabel(int number) +void jumplabel(int number) { stgwrite("\tjump "); outval(number,TRUE); @@ -906,7 +906,7 @@ SC_FUNC void jumplabel(int number) /* * Define storage (global and static variables) */ -SC_FUNC void defstorage(void) +void defstorage(void) { stgwrite("dump "); } @@ -915,7 +915,7 @@ SC_FUNC void defstorage(void) * Inclrement/decrement stack pointer. Note that this routine does * nothing if the delta is zero. */ -SC_FUNC void modstk(int delta) +void modstk(int delta) { if (delta) { stgwrite("\tstack "); @@ -925,7 +925,7 @@ SC_FUNC void modstk(int delta) } /* set the stack to a hard offset from the frame */ -SC_FUNC void setstk(cell value) +void setstk(cell value) { stgwrite("\tstackadjust "); assert(value<=0); /* STK should always become <= FRM */ @@ -933,7 +933,7 @@ SC_FUNC void setstk(cell value) code_idx+=opcodes(1)+opargs(1); } -SC_FUNC void modheap(int delta) +void modheap(int delta) { if (delta) { stgwrite("\theap "); @@ -942,13 +942,13 @@ SC_FUNC void modheap(int delta) } /* if */ } -SC_FUNC void modheap_i() +void modheap_i() { stgwrite("\ttracker.pop.setheap\n"); code_idx+=opcodes(1); } -SC_FUNC void setheap_save(cell value) +void setheap_save(cell value) { assert(value); stgwrite("\ttracker.push.c "); @@ -956,7 +956,7 @@ SC_FUNC void setheap_save(cell value) code_idx+=opcodes(1)+opargs(1); } -SC_FUNC void setheap_pri(void) +void setheap_pri(void) { stgwrite("\theap "); /* ALT = HEA++ */ outval(sizeof(cell), TRUE); @@ -965,7 +965,7 @@ SC_FUNC void setheap_pri(void) code_idx+=opcodes(3)+opargs(1); } -SC_FUNC void setheap(cell value) +void setheap(cell value) { stgwrite("\tconst.pri "); /* load default value in PRI */ outval(value, TRUE); @@ -977,7 +977,7 @@ SC_FUNC void setheap(cell value) * Convert a cell number to a "byte" address; i.e. double or quadruple * the primary register. */ -SC_FUNC void cell2addr(void) +void cell2addr(void) { #if PAWN_CELL_SIZE==16 stgwrite("\tshl.c.pri 1\n"); @@ -994,7 +994,7 @@ SC_FUNC void cell2addr(void) /* * Double or quadruple the alternate register. */ -SC_FUNC void cell2addr_alt(void) +void cell2addr_alt(void) { #if PAWN_CELL_SIZE==16 stgwrite("\tshl.c.alt 1\n"); @@ -1013,7 +1013,7 @@ SC_FUNC void cell2addr_alt(void) * Or convert a number of packed characters to the number of cells (with * truncation). */ -SC_FUNC void addr2cell(void) +void addr2cell(void) { #if PAWN_CELL_SIZE==16 stgwrite("\tshr.c.pri 1\n"); @@ -1030,7 +1030,7 @@ SC_FUNC void addr2cell(void) /* Convert from character index to byte address. This routine does * nothing if a character has the size of a byte. */ -SC_FUNC void char2addr(void) +void char2addr(void) { #if sCHARBITS==16 stgwrite("\tshl.c.pri 1\n"); @@ -1048,7 +1048,7 @@ SC_FUNC void char2addr(void) * * NOTE: For Source Pawn, this is fliped. It will do nothing on Little-Endian. */ -SC_FUNC void charalign(void) +void charalign(void) { #if 0 /* TEMPORARILY DISABLED BECAUSE WE DON'T USE BIG ENDIAN */ stgwrite("\talign.pri "); @@ -1060,7 +1060,7 @@ SC_FUNC void charalign(void) /* * Add a constant to the primary register. */ -SC_FUNC void addconst(cell value) +void addconst(cell value) { if (value!=0) { stgwrite("\tadd.c "); @@ -1072,7 +1072,7 @@ SC_FUNC void addconst(cell value) /* * signed multiply of primary and secundairy registers (result in primary) */ -SC_FUNC void os_mult(void) +void os_mult(void) { stgwrite("\tsmul\n"); code_idx+=opcodes(1); @@ -1082,7 +1082,7 @@ SC_FUNC void os_mult(void) * signed divide of alternate register by primary register (quotient in * primary; remainder in alternate) */ -SC_FUNC void os_div(void) +void os_div(void) { stgwrite("\tsdiv.alt\n"); code_idx+=opcodes(1); @@ -1091,7 +1091,7 @@ SC_FUNC void os_div(void) /* * modulus of (alternate % primary), result in primary (signed) */ -SC_FUNC void os_mod(void) +void os_mod(void) { stgwrite("\tsdiv.alt\n"); stgwrite("\tmove.pri\n"); /* move ALT to PRI */ @@ -1101,7 +1101,7 @@ SC_FUNC void os_mod(void) /* * Add primary and alternate registers (result in primary). */ -SC_FUNC void ob_add(void) +void ob_add(void) { stgwrite("\tadd\n"); code_idx+=opcodes(1); @@ -1110,7 +1110,7 @@ SC_FUNC void ob_add(void) /* * subtract primary register from alternate register (result in primary) */ -SC_FUNC void ob_sub(void) +void ob_sub(void) { stgwrite("\tsub.alt\n"); code_idx+=opcodes(1); @@ -1122,7 +1122,7 @@ SC_FUNC void ob_sub(void) * There is no need for a "logical shift left" routine, since * logical shift left is identical to arithmic shift left. */ -SC_FUNC void ob_sal(void) +void ob_sal(void) { stgwrite("\txchg\n"); stgwrite("\tshl\n"); @@ -1133,7 +1133,7 @@ SC_FUNC void ob_sal(void) * arithmic shift right alternate register the number of bits * given in the primary register (result in primary). */ -SC_FUNC void os_sar(void) +void os_sar(void) { stgwrite("\txchg\n"); stgwrite("\tsshr\n"); @@ -1144,7 +1144,7 @@ SC_FUNC void os_sar(void) * logical (unsigned) shift right of the alternate register by the * number of bits given in the primary register (result in primary). */ -SC_FUNC void ou_sar(void) +void ou_sar(void) { stgwrite("\txchg\n"); stgwrite("\tshr\n"); @@ -1154,7 +1154,7 @@ SC_FUNC void ou_sar(void) /* * inclusive "or" of primary and alternate registers (result in primary) */ -SC_FUNC void ob_or(void) +void ob_or(void) { stgwrite("\tor\n"); code_idx+=opcodes(1); @@ -1163,7 +1163,7 @@ SC_FUNC void ob_or(void) /* * "exclusive or" of primary and alternate registers (result in primary) */ -SC_FUNC void ob_xor(void) +void ob_xor(void) { stgwrite("\txor\n"); code_idx+=opcodes(1); @@ -1172,7 +1172,7 @@ SC_FUNC void ob_xor(void) /* * "and" of primary and secundairy registers (result in primary) */ -SC_FUNC void ob_and(void) +void ob_and(void) { stgwrite("\tand\n"); code_idx+=opcodes(1); @@ -1181,7 +1181,7 @@ SC_FUNC void ob_and(void) /* * test ALT==PRI; result in primary register (1 or 0). */ -SC_FUNC void ob_eq(void) +void ob_eq(void) { stgwrite("\teq\n"); code_idx+=opcodes(1); @@ -1190,7 +1190,7 @@ SC_FUNC void ob_eq(void) /* * test ALT!=PRI */ -SC_FUNC void ob_ne(void) +void ob_ne(void) { stgwrite("\tneq\n"); code_idx+=opcodes(1); @@ -1216,14 +1216,14 @@ SC_FUNC void ob_ne(void) * 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. */ -SC_FUNC void relop_prefix(void) +void relop_prefix(void) { stgwrite("\tpush.pri\n"); stgwrite("\tmove.pri\n"); code_idx+=opcodes(2); } -SC_FUNC void relop_suffix(void) +void relop_suffix(void) { stgwrite("\tswap.alt\n"); stgwrite("\tand\n"); @@ -1234,7 +1234,7 @@ SC_FUNC void relop_suffix(void) /* * test ALTPRI (signed) */ -SC_FUNC void os_gt(void) +void os_gt(void) { stgwrite("\txchg\n"); stgwrite("\tsgrtr\n"); @@ -1264,7 +1264,7 @@ SC_FUNC void os_gt(void) /* * test ALT>=PRI (signed) */ -SC_FUNC void os_ge(void) +void os_ge(void) { stgwrite("\txchg\n"); stgwrite("\tsgeq\n"); @@ -1274,7 +1274,7 @@ SC_FUNC void os_ge(void) /* * logical negation of primary register */ -SC_FUNC void lneg(void) +void lneg(void) { stgwrite("\tnot\n"); code_idx+=opcodes(1); @@ -1283,7 +1283,7 @@ SC_FUNC void lneg(void) /* * two's complement primary register */ -SC_FUNC void neg(void) +void neg(void) { stgwrite("\tneg\n"); code_idx+=opcodes(1); @@ -1292,7 +1292,7 @@ SC_FUNC void neg(void) /* * one's complement of primary register */ -SC_FUNC void invert(void) +void invert(void) { stgwrite("\tinvert\n"); code_idx+=opcodes(1); @@ -1301,19 +1301,19 @@ SC_FUNC void invert(void) /* * nop */ -SC_FUNC void nooperation(void) +void nooperation(void) { stgwrite("\tnop\n"); code_idx+=opcodes(1); } -SC_FUNC void inc_pri() +void inc_pri() { stgwrite("\tinc.pri\n"); code_idx+=opcodes(1); } -SC_FUNC void dec_pri() +void dec_pri() { stgwrite("\tdec.pri\n"); code_idx+=opcodes(1); @@ -1321,7 +1321,7 @@ SC_FUNC void dec_pri() /* increment symbol */ -SC_FUNC void inc(value *lval) +void inc(value *lval) { symbol *sym; @@ -1379,7 +1379,7 @@ SC_FUNC void inc(value *lval) * * in case of an integer pointer, the symbol must be incremented by 2. */ -SC_FUNC void dec(value *lval) +void dec(value *lval) { symbol *sym; @@ -1436,7 +1436,7 @@ SC_FUNC void dec(value *lval) /* * Jumps to "label" if PRI != 0 */ -SC_FUNC void jmp_ne0(int number) +void jmp_ne0(int number) { stgwrite("\tjnz "); outval(number,TRUE); @@ -1446,7 +1446,7 @@ SC_FUNC void jmp_ne0(int number) /* * Jumps to "label" if PRI == 0 */ -SC_FUNC void jmp_eq0(int number) +void jmp_eq0(int number) { stgwrite("\tjzer "); outval(number,TRUE); @@ -1454,14 +1454,14 @@ SC_FUNC void jmp_eq0(int number) } /* write a value in hexadecimal; optionally adds a newline */ -SC_FUNC void outval(cell val,int newline) +void outval(cell val,int newline) { stgwrite(itoh(val)); if (newline) stgwrite("\n"); } -SC_FUNC void invoke_getter(methodmap_method_t *method) +void invoke_getter(methodmap_method_t *method) { if (!method->getter) { error(149, method->name); @@ -1479,7 +1479,7 @@ SC_FUNC void invoke_getter(methodmap_method_t *method) markusage(method->getter, uREAD); } -SC_FUNC void invoke_setter(methodmap_method_t *method, int save) +void invoke_setter(methodmap_method_t *method, int save) { if (!method->setter) { error(152, method->name); diff --git a/sourcepawn/compiler/sc5-in.scp b/sourcepawn/compiler/sc5-in.scp index 653eb02d..0478abb2 100644 --- a/sourcepawn/compiler/sc5-in.scp +++ b/sourcepawn/compiler/sc5-in.scp @@ -21,7 +21,7 @@ * Version: $Id$ */ -SC_FUNC int strexpand(char *dest, unsigned char *source, int maxlen, unsigned char pairtable[128][2]); +int strexpand(char *dest, unsigned char *source, int maxlen, unsigned char pairtable[128][2]); #ifndef SCPACK # define SCPACK diff --git a/sourcepawn/compiler/sc5.cpp b/sourcepawn/compiler/sc5.cpp index f2444947..64d2a649 100644 --- a/sourcepawn/compiler/sc5.cpp +++ b/sourcepawn/compiler/sc5.cpp @@ -67,7 +67,7 @@ static int sErrLine; /* forced line number for the error message */ * fcurrent (reffered to only) * errflag (altered) */ -SC_FUNC int error(int number,...) +int error(int number,...) { static const char *prefix[3]={ "error", "fatal error", "warning" }; static int lastline,errorcount; @@ -172,7 +172,7 @@ static short lastfile; return 0; } -SC_FUNC void errorset(int code,int line) +void errorset(int code,int line) { switch (code) { case sRESET: diff --git a/sourcepawn/compiler/sc6.cpp b/sourcepawn/compiler/sc6.cpp index b78ebd2c..8e677f0e 100644 --- a/sourcepawn/compiler/sc6.cpp +++ b/sourcepawn/compiler/sc6.cpp @@ -659,7 +659,7 @@ static int findopcode(char *instr,int maxlen) return 0; /* not found, return special index */ } -SC_FUNC int assemble(void *fout, void *fin) +int assemble(void *fout, void *fin) { AMX_HEADER hdr; AMX_FUNCSTUBNT func; diff --git a/sourcepawn/compiler/sc7-in.scp b/sourcepawn/compiler/sc7-in.scp index 39aac3bc..ddbfb9b8 100644 --- a/sourcepawn/compiler/sc7-in.scp +++ b/sourcepawn/compiler/sc7-in.scp @@ -22,7 +22,7 @@ * Version: $Id$ */ -SC_FUNC int strexpand(char *dest, unsigned char *source, int maxlen, unsigned char pairtable[128][2]); +int strexpand(char *dest, unsigned char *source, int maxlen, unsigned char pairtable[128][2]); #define SCPACK_TERMINATOR , /* end each section with a comma */ diff --git a/sourcepawn/compiler/sc7.cpp b/sourcepawn/compiler/sc7.cpp index 61f095d8..754a0ed1 100644 --- a/sourcepawn/compiler/sc7.cpp +++ b/sourcepawn/compiler/sc7.cpp @@ -108,7 +108,7 @@ static void grow_stgbuffer(char **buffer, int *curmax, int requiredsize) **buffer='\0'; } -SC_FUNC void stgbuffer_cleanup(void) +void stgbuffer_cleanup(void) { if (stgbuf!=NULL) { free(stgbuf); @@ -141,7 +141,7 @@ SC_FUNC void stgbuffer_cleanup(void) * stgbuf (altered) * staging (referred to only) */ -SC_FUNC void stgmark(char mark) +void stgmark(char mark) { if (staging) { CHECK_STGBUFFER(stgidx); @@ -188,7 +188,7 @@ static int filewrite(char *str) * stgbuf (altered) * staging (referred to only) */ -SC_FUNC void stgwrite(const char *st) +void stgwrite(const char *st) { int len; @@ -224,7 +224,7 @@ SC_FUNC void stgwrite(const char *st) * stgbuf (referred to only) * staging (referred to only) */ -SC_FUNC void stgout(int index) +void stgout(int index) { int reordered=0; int idx; @@ -348,7 +348,7 @@ static int stgstring(char *start,char *end) * Global references: stgidx (altered) * staging (reffered to only) */ -SC_FUNC void stgdel(int index,cell code_index) +void stgdel(int index,cell code_index) { if (staging) { stgidx=index; @@ -356,7 +356,7 @@ SC_FUNC void stgdel(int index,cell code_index) } /* if */ } -SC_FUNC int stgget(int *index,cell *code_index) +int stgget(int *index,cell *code_index) { if (staging) { *index=stgidx; @@ -375,7 +375,7 @@ SC_FUNC int stgget(int *index,cell *code_index) * stgidx (altered) * stgbuf (contents altered) */ -SC_FUNC void stgset(int onoff) +void stgset(int onoff) { staging=onoff; if (staging){ @@ -398,7 +398,7 @@ SC_FUNC void stgset(int onoff) */ static SEQUENCE *sequences; -SC_FUNC int phopt_init(void) +int phopt_init(void) { int number, i, len; char str[160]; @@ -440,7 +440,7 @@ SC_FUNC int phopt_init(void) return TRUE; } -SC_FUNC int phopt_cleanup(void) +int phopt_cleanup(void) { int i; if (sequences!=NULL) { diff --git a/sourcepawn/compiler/scexpand.cpp b/sourcepawn/compiler/scexpand.cpp index 977c0121..09182ad6 100644 --- a/sourcepawn/compiler/scexpand.cpp +++ b/sourcepawn/compiler/scexpand.cpp @@ -16,7 +16,7 @@ #define STACKSIZE 16 -SC_FUNC int strexpand(char *dest, unsigned char *source, int maxlen, unsigned char pairtable[128][2]) +int strexpand(char *dest, unsigned char *source, int maxlen, unsigned char pairtable[128][2]) { unsigned char stack[STACKSIZE]; short c, top = 0; diff --git a/sourcepawn/compiler/sci18n.cpp b/sourcepawn/compiler/sci18n.cpp index f016e7f8..980dcbdc 100644 --- a/sourcepawn/compiler/sci18n.cpp +++ b/sourcepawn/compiler/sci18n.cpp @@ -113,7 +113,7 @@ static int cp_readline(FILE *fp,char *string,size_t size) * codepages are most conveniently stored in a subdirectory of this home * directory. */ -SC_FUNC int cp_path(const char *root, const char *directory) +int cp_path(const char *root, const char *directory) { size_t len1,len2; int add_slash1,add_slash2; @@ -154,7 +154,7 @@ SC_FUNC int cp_path(const char *root, const char *directory) * /cp * /cp.txt */ -SC_FUNC int cp_set(const char *name) +int cp_set(const char *name) { char filename[_MAX_PATH]; FILE *fp=NULL; @@ -277,7 +277,7 @@ SC_FUNC int cp_set(const char *name) return TRUE; } -SC_FUNC cell cp_translate(const unsigned char *string,const unsigned char **endptr) +cell cp_translate(const unsigned char *string,const unsigned char **endptr) { wchar_t result; @@ -312,7 +312,7 @@ SC_FUNC cell cp_translate(const unsigned char *string,const unsigned char **endp #endif /* NO_CODEPAGE */ #if !defined NO_UTF8 -SC_FUNC cell get_utf8_char(const unsigned char *string,const unsigned char **endptr) +cell get_utf8_char(const unsigned char *string,const unsigned char **endptr) { int follow=0; long lowmark=0; @@ -391,7 +391,7 @@ SC_FUNC cell get_utf8_char(const unsigned char *string,const unsigned char **end } #endif -SC_FUNC int scan_utf8(void *fp,const char *filename) +int scan_utf8(void *fp,const char *filename) { #if defined NO_UTF8 return 0; diff --git a/sourcepawn/compiler/sclist.cpp b/sourcepawn/compiler/sclist.cpp index 1a830044..bcf7192b 100644 --- a/sourcepawn/compiler/sclist.cpp +++ b/sourcepawn/compiler/sclist.cpp @@ -41,7 +41,7 @@ * to other memory allocators becomes easier. * By Søren Hannibal. */ -SC_FUNC char* duplicatestring(const char* sourcestring) +char* duplicatestring(const char* sourcestring) { char* result=(char*)malloc(strlen(sourcestring)+1); strcpy(result,sourcestring); @@ -190,7 +190,7 @@ static int delete_string(stringlist *root,int index) return FALSE; } -SC_FUNC void delete_stringtable(stringlist *root) +void delete_stringtable(stringlist *root) { stringlist *cur,*next; @@ -210,7 +210,7 @@ SC_FUNC void delete_stringtable(stringlist *root) /* ----- alias table --------------------------------------------- */ static stringpair alias_tab = {NULL, NULL, NULL}; /* alias table */ -SC_FUNC stringpair *insert_alias(char *name,char *alias) +stringpair *insert_alias(char *name,char *alias) { stringpair *cur; @@ -223,7 +223,7 @@ SC_FUNC stringpair *insert_alias(char *name,char *alias) return cur; } -SC_FUNC int lookup_alias(char *target,char *name) +int lookup_alias(char *target,char *name) { stringpair *cur=find_stringpair(alias_tab.next,name,strlen(name)); if (cur!=NULL) { @@ -233,7 +233,7 @@ SC_FUNC int lookup_alias(char *target,char *name) return cur!=NULL; } -SC_FUNC void delete_aliastable(void) +void delete_aliastable(void) { delete_stringpairtable(&alias_tab); } @@ -241,17 +241,17 @@ SC_FUNC void delete_aliastable(void) /* ----- include paths list -------------------------------------- */ static stringlist includepaths; /* directory list for include files */ -SC_FUNC stringlist *insert_path(char *path) +stringlist *insert_path(char *path) { return insert_string(&includepaths,path); } -SC_FUNC char *get_path(int index) +char *get_path(int index) { return get_string(&includepaths,index); } -SC_FUNC void delete_pathtable(void) +void delete_pathtable(void) { delete_stringtable(&includepaths); assert(includepaths.next==NULL); @@ -275,7 +275,7 @@ static void adjustindex(char c) substindex[(int)c-PUBLIC_CHAR]=cur; } -SC_FUNC stringpair *insert_subst(const char *pattern,const char *substitution,int prefixlen) +stringpair *insert_subst(const char *pattern,const char *substitution,int prefixlen) { stringpair *cur; @@ -306,7 +306,7 @@ SC_FUNC stringpair *insert_subst(const char *pattern,const char *substitution,in return cur; } -SC_FUNC stringpair *find_subst(char *name,int length) +stringpair *find_subst(char *name,int length) { stringpair *item; assert(name!=NULL); @@ -336,7 +336,7 @@ SC_FUNC stringpair *find_subst(char *name,int length) return item; } -SC_FUNC int delete_subst(char *name,int length) +int delete_subst(char *name,int length) { stringpair *item; assert(name!=NULL); @@ -357,7 +357,7 @@ SC_FUNC int delete_subst(char *name,int length) return TRUE; } -SC_FUNC void delete_substtable(void) +void delete_substtable(void) { int i; delete_stringpairtable(&substpair); @@ -371,17 +371,17 @@ SC_FUNC void delete_substtable(void) /* ----- input file list ----------------------------------------- */ static stringlist sourcefiles; -SC_FUNC stringlist *insert_sourcefile(char *string) +stringlist *insert_sourcefile(char *string) { return insert_string(&sourcefiles,string); } -SC_FUNC char *get_sourcefile(int index) +char *get_sourcefile(int index) { return get_string(&sourcefiles,index); } -SC_FUNC void delete_sourcefiletable(void) +void delete_sourcefiletable(void) { delete_stringtable(&sourcefiles); assert(sourcefiles.next==NULL); @@ -392,22 +392,22 @@ SC_FUNC void delete_sourcefiletable(void) #if !defined SC_LIGHT static stringlist docstrings; -SC_FUNC stringlist *insert_docstring(char *string) +stringlist *insert_docstring(char *string) { return insert_string(&docstrings,string); } -SC_FUNC char *get_docstring(int index) +char *get_docstring(int index) { return get_string(&docstrings,index); } -SC_FUNC void delete_docstring(int index) +void delete_docstring(int index) { delete_string(&docstrings,index); } -SC_FUNC void delete_docstringtable(void) +void delete_docstringtable(void) { delete_stringtable(&docstrings); assert(docstrings.next==NULL); @@ -418,17 +418,17 @@ SC_FUNC void delete_docstringtable(void) /* ----- autolisting --------------------------------------------- */ static stringlist autolist; -SC_FUNC stringlist *insert_autolist(const char *string) +stringlist *insert_autolist(const char *string) { return insert_string(&autolist,string); } -SC_FUNC char *get_autolist(int index) +char *get_autolist(int index) { return get_string(&autolist,index); } -SC_FUNC void delete_autolisttable(void) +void delete_autolisttable(void) { delete_stringtable(&autolist); assert(autolist.next==NULL); @@ -464,7 +464,7 @@ SC_FUNC void delete_autolisttable(void) static stringlist dbgstrings; -SC_FUNC stringlist *insert_dbgfile(const char *filename) +stringlist *insert_dbgfile(const char *filename) { if (sc_status==statWRITE && (sc_debug & sSYMBOLIC)!=0) { @@ -477,7 +477,7 @@ SC_FUNC stringlist *insert_dbgfile(const char *filename) return NULL; } -SC_FUNC stringlist *insert_dbgline(int linenr) +stringlist *insert_dbgline(int linenr) { if (sc_status==statWRITE && (sc_debug & sSYMBOLIC)!=0) { char string[40]; @@ -489,7 +489,7 @@ SC_FUNC stringlist *insert_dbgline(int linenr) return NULL; } -SC_FUNC stringlist *insert_dbgsymbol(symbol *sym) +stringlist *insert_dbgsymbol(symbol *sym) { if (sc_status==statWRITE && (sc_debug & sSYMBOLIC)!=0) { char string[2*sNAMEMAX+128]; @@ -522,17 +522,17 @@ SC_FUNC stringlist *insert_dbgsymbol(symbol *sym) return NULL; } -SC_FUNC stringlist *get_dbgstrings() +stringlist *get_dbgstrings() { return &dbgstrings; } -SC_FUNC char *get_dbgstring(int index) +char *get_dbgstring(int index) { return get_string(&dbgstrings,index); } -SC_FUNC void delete_dbgstringtable(void) +void delete_dbgstringtable(void) { delete_stringtable(&dbgstrings); assert(dbgstrings.next==NULL); diff --git a/sourcepawn/compiler/scstate.cpp b/sourcepawn/compiler/scstate.cpp index 1d383e2b..8c772804 100644 --- a/sourcepawn/compiler/scstate.cpp +++ b/sourcepawn/compiler/scstate.cpp @@ -87,7 +87,7 @@ static constvalue *find_automaton(const char *name,int *last) return NULL; } -SC_FUNC constvalue *automaton_add(const char *name) +constvalue *automaton_add(const char *name) { constvalue *ptr; int last; @@ -101,13 +101,13 @@ SC_FUNC constvalue *automaton_add(const char *name) return ptr; } -SC_FUNC constvalue *automaton_find(const char *name) +constvalue *automaton_find(const char *name) { int last; return find_automaton(name,&last); } -SC_FUNC constvalue *automaton_findid(int id) +constvalue *automaton_findid(int id) { constvalue *ptr; for (ptr=sc_automaton_tab.next; ptr!=NULL && ptr->index!=id; ptr=ptr->next) @@ -135,7 +135,7 @@ static constvalue *find_state(const char *name,int fsa,int *last) return NULL; } -SC_FUNC constvalue *state_add(const char *name,int fsa) +constvalue *state_add(const char *name,int fsa) { constvalue *ptr; int last; @@ -149,13 +149,13 @@ SC_FUNC constvalue *state_add(const char *name,int fsa) return ptr; } -SC_FUNC constvalue *state_find(const char *name,int fsa_id) +constvalue *state_find(const char *name,int fsa_id) { int last; /* dummy */ return find_state(name,fsa_id,&last); } -SC_FUNC constvalue *state_findid(int id) +constvalue *state_findid(int id) { constvalue *ptr; for (ptr=sc_state_tab.next; ptr!=NULL && ptr->value!=id; ptr=ptr->next) @@ -163,7 +163,7 @@ SC_FUNC constvalue *state_findid(int id) return ptr; } -SC_FUNC void state_buildlist(int **list,int *listsize,int *count,int stateid) +void state_buildlist(int **list,int *listsize,int *count,int stateid) { int idx; @@ -227,7 +227,7 @@ static statelist *state_getlist_ptr(int listid) return ptr; } -SC_FUNC int state_addlist(int *list,int count,int fsa) +int state_addlist(int *list,int count,int fsa) { statelist *ptr; int last; @@ -253,7 +253,7 @@ SC_FUNC int state_addlist(int *list,int count,int fsa) return ptr->listid; } -SC_FUNC void state_deletetable(void) +void state_deletetable(void) { statelist *ptr; @@ -268,7 +268,7 @@ SC_FUNC void state_deletetable(void) } /* while */ } -SC_FUNC int state_getfsa(int listid) +int state_getfsa(int listid) { statelist *ptr; @@ -280,7 +280,7 @@ SC_FUNC int state_getfsa(int listid) return (ptr!=NULL) ? ptr->fsa : -1; /* fsa 0 exists */ } -SC_FUNC int state_count(int listid) +int state_count(int listid) { statelist *ptr=state_getlist_ptr(listid); if (ptr==NULL) @@ -288,7 +288,7 @@ SC_FUNC int state_count(int listid) return ptr->numstates; } -SC_FUNC int state_inlist(int listid,int state) +int state_inlist(int listid,int state) { statelist *ptr; int i; @@ -302,7 +302,7 @@ SC_FUNC int state_inlist(int listid,int state) return FALSE; } -SC_FUNC int state_listitem(int listid,int index) +int state_listitem(int listid,int index) { statelist *ptr; @@ -329,7 +329,7 @@ static int checkconflict(statelist *psrc,statelist *ptgt) * of a symbol exists in any other statelist id's of the same function; it also * verifies that all definitions of the symbol are in the same automaton. */ -SC_FUNC void state_conflict(symbol *root) +void state_conflict(symbol *root) { statelist *psrc,*ptgt; constvalue *srcptr,*tgtptr; @@ -363,7 +363,7 @@ SC_FUNC void state_conflict(symbol *root) /* check whether the two state lists (whose ids are passed in) share any * states */ -SC_FUNC int state_conflict_id(int listid1,int listid2) +int state_conflict_id(int listid1,int listid2) { statelist *psrc,*ptgt; diff --git a/sourcepawn/compiler/scvars.cpp b/sourcepawn/compiler/scvars.cpp index 96d36095..0f030923 100644 --- a/sourcepawn/compiler/scvars.cpp +++ b/sourcepawn/compiler/scvars.cpp @@ -32,82 +32,82 @@ * All global variables that are shared amongst the compiler files are * declared here. */ -SC_VDEFINE symbol loctab; /* local symbol table */ -SC_VDEFINE symbol glbtab; /* global symbol table */ -SC_VDEFINE cell *litq; /* the literal queue */ -SC_VDEFINE unsigned char pline[sLINEMAX+1]; /* the line read from the input file */ -SC_VDEFINE const unsigned char *lptr; /* points to the current position in "pline" */ -SC_VDEFINE constvalue tagname_tab = { NULL, "", 0, 0}; /* tagname table */ -SC_VDEFINE constvalue libname_tab = { NULL, "", 0, 0}; /* library table (#pragma library "..." syntax) */ -SC_VDEFINE constvalue *curlibrary = NULL; /* current library */ -SC_VDEFINE int pc_addlibtable = TRUE; /* is the library table added to the AMX file? */ -SC_VDEFINE symbol *curfunc; /* pointer to current function */ -SC_VDEFINE char *inpfname; /* pointer to name of the file currently read from */ -SC_VDEFINE char outfname[_MAX_PATH]; /* intermediate (assembler) file name */ -SC_VDEFINE char binfname[_MAX_PATH]; /* binary file name */ -SC_VDEFINE char errfname[_MAX_PATH]; /* error file name */ -SC_VDEFINE char sc_ctrlchar = CTRL_CHAR; /* the control character (or escape character)*/ -SC_VDEFINE char sc_ctrlchar_org = CTRL_CHAR;/* the default control character */ -SC_VDEFINE int litidx = 0; /* index to literal table */ -SC_VDEFINE int litmax = sDEF_LITMAX; /* current size of the literal table */ -SC_VDEFINE int stgidx = 0; /* index to the staging buffer */ -SC_VDEFINE int sc_labnum = 0; /* number of (internal) labels */ -SC_VDEFINE int staging = 0; /* true if staging output */ -SC_VDEFINE cell declared = 0; /* number of local cells declared */ -SC_VDEFINE cell glb_declared=0; /* number of global cells declared */ -SC_VDEFINE cell code_idx = 0; /* number of bytes with generated code */ -SC_VDEFINE int ntv_funcid= 0; /* incremental number of native function */ -SC_VDEFINE int errnum = 0; /* number of errors */ -SC_VDEFINE int warnnum = 0; /* number of warnings */ -SC_VDEFINE int sc_debug = sCHKBOUNDS; /* by default: bounds checking+assertions */ -SC_VDEFINE int sc_packstr= FALSE; /* strings are packed by default? */ -SC_VDEFINE int sc_asmfile= FALSE; /* create .ASM file? */ -SC_VDEFINE int sc_listing= FALSE; /* create .LST file? */ -SC_VDEFINE int sc_compress=TRUE; /* compress bytecode? */ -SC_VDEFINE int sc_needsemicolon=TRUE;/* semicolon required to terminate expressions? */ -SC_VDEFINE int sc_dataalign=sizeof(cell);/* data alignment value */ -SC_VDEFINE int sc_alignnext=FALSE; /* must frame of the next function be aligned? */ -SC_VDEFINE int pc_docexpr=FALSE; /* must expression be attached to documentation comment? */ -SC_VDEFINE int curseg = 0; /* 1 if currently parsing CODE, 2 if parsing DATA */ -SC_VDEFINE cell pc_stksize=sDEF_AMXSTACK;/* default stack size */ -SC_VDEFINE cell pc_amxlimit=0; /* default abstract machine size limit = none */ -SC_VDEFINE cell pc_amxram=0; /* default abstract machine data size limit = none */ -SC_VDEFINE int freading = FALSE; /* Is there an input file ready for reading? */ -SC_VDEFINE int fline = 0; /* the line number in the current file */ -SC_VDEFINE short fnumber = 0; /* the file number in the file table (debugging) */ -SC_VDEFINE short fcurrent= 0; /* current file being processed (debugging) */ -SC_VDEFINE short sc_intest=FALSE; /* true if inside a test */ -SC_VDEFINE int sideeffect= 0; /* true if an expression causes a side-effect */ -SC_VDEFINE int stmtindent= 0; /* current indent of the statement */ -SC_VDEFINE int indent_nowarn=FALSE;/* skip warning "217 loose indentation" */ -SC_VDEFINE int sc_tabsize=8; /* number of spaces that a TAB represents */ -SC_VDEFINE short sc_allowtags=TRUE; /* allow/detect tagnames in lex() */ -SC_VDEFINE int sc_status; /* read/write status */ -SC_VDEFINE int sc_err_status; -SC_VDEFINE int sc_rationaltag=0; /* tag for rational numbers */ -SC_VDEFINE int rational_digits=0; /* number of fractional digits */ -SC_VDEFINE int sc_allowproccall=0; /* allow/detect tagnames in lex() */ -SC_VDEFINE short sc_is_utf8=FALSE; /* is this source file in UTF-8 encoding */ -SC_VDEFINE char *pc_deprecate=NULL;/* if non-null, mark next declaration as deprecated */ -SC_VDEFINE int sc_curstates=0; /* ID of the current state list */ -SC_VDEFINE int pc_optimize=sOPTIMIZE_NOMACRO; /* (peephole) optimization level */ -SC_VDEFINE int pc_memflags=0; /* special flags for the stack/heap usage */ -SC_VDEFINE int sc_showincludes=0; /* show include files */ -SC_VDEFINE int sc_require_newdecls=0; /* Require new-style declarations */ +symbol loctab; /* local symbol table */ +symbol glbtab; /* global symbol table */ +cell *litq; /* the literal queue */ +unsigned char pline[sLINEMAX+1]; /* the line read from the input file */ +const unsigned char *lptr; /* points to the current position in "pline" */ +constvalue tagname_tab = { NULL, "", 0, 0}; /* tagname table */ +constvalue libname_tab = { NULL, "", 0, 0}; /* library table (#pragma library "..." syntax) */ +constvalue *curlibrary = NULL; /* current library */ +int pc_addlibtable = TRUE; /* is the library table added to the AMX file? */ +symbol *curfunc; /* pointer to current function */ +char *inpfname; /* pointer to name of the file currently read from */ +char outfname[_MAX_PATH]; /* intermediate (assembler) file name */ +char binfname[_MAX_PATH]; /* binary file name */ +char errfname[_MAX_PATH]; /* error file name */ +char sc_ctrlchar = CTRL_CHAR; /* the control character (or escape character)*/ +char sc_ctrlchar_org = CTRL_CHAR;/* the default control character */ +int litidx = 0; /* index to literal table */ +int litmax = sDEF_LITMAX; /* current size of the literal table */ +int stgidx = 0; /* index to the staging buffer */ +int sc_labnum = 0; /* number of (internal) labels */ +int staging = 0; /* true if staging output */ +cell declared = 0; /* number of local cells declared */ +cell glb_declared=0; /* number of global cells declared */ +cell code_idx = 0; /* number of bytes with generated code */ +int ntv_funcid= 0; /* incremental number of native function */ +int errnum = 0; /* number of errors */ +int warnnum = 0; /* number of warnings */ +int sc_debug = sCHKBOUNDS; /* by default: bounds checking+assertions */ +int sc_packstr= FALSE; /* strings are packed by default? */ +int sc_asmfile= FALSE; /* create .ASM file? */ +int sc_listing= FALSE; /* create .LST file? */ +int sc_compress=TRUE; /* compress bytecode? */ +int sc_needsemicolon=TRUE;/* semicolon required to terminate expressions? */ +int sc_dataalign=sizeof(cell);/* data alignment value */ +int sc_alignnext=FALSE; /* must frame of the next function be aligned? */ +int pc_docexpr=FALSE; /* must expression be attached to documentation comment? */ +int curseg = 0; /* 1 if currently parsing CODE, 2 if parsing DATA */ +cell pc_stksize=sDEF_AMXSTACK;/* default stack size */ +cell pc_amxlimit=0; /* default abstract machine size limit = none */ +cell pc_amxram=0; /* default abstract machine data size limit = none */ +int freading = FALSE; /* Is there an input file ready for reading? */ +int fline = 0; /* the line number in the current file */ +short fnumber = 0; /* the file number in the file table (debugging) */ +short fcurrent= 0; /* current file being processed (debugging) */ +short sc_intest=FALSE; /* true if inside a test */ +int sideeffect= 0; /* true if an expression causes a side-effect */ +int stmtindent= 0; /* current indent of the statement */ +int indent_nowarn=FALSE;/* skip warning "217 loose indentation" */ +int sc_tabsize=8; /* number of spaces that a TAB represents */ +short sc_allowtags=TRUE; /* allow/detect tagnames in lex() */ +int sc_status; /* read/write status */ +int sc_err_status; +int sc_rationaltag=0; /* tag for rational numbers */ +int rational_digits=0; /* number of fractional digits */ +int sc_allowproccall=0; /* allow/detect tagnames in lex() */ +short sc_is_utf8=FALSE; /* is this source file in UTF-8 encoding */ +char *pc_deprecate=NULL;/* if non-null, mark next declaration as deprecated */ +int sc_curstates=0; /* ID of the current state list */ +int pc_optimize=sOPTIMIZE_NOMACRO; /* (peephole) optimization level */ +int pc_memflags=0; /* special flags for the stack/heap usage */ +int sc_showincludes=0; /* show include files */ +int sc_require_newdecls=0; /* Require new-style declarations */ -SC_VDEFINE constvalue sc_automaton_tab = { NULL, "", 0, 0}; /* automaton table */ -SC_VDEFINE constvalue sc_state_tab = { NULL, "", 0, 0}; /* state table */ +constvalue sc_automaton_tab = { NULL, "", 0, 0}; /* automaton table */ +constvalue sc_state_tab = { NULL, "", 0, 0}; /* state table */ -SC_VDEFINE void *inpf = NULL; /* file read from (source or include) */ -SC_VDEFINE void *inpf_org= NULL; /* main source file */ -SC_VDEFINE void *outf = NULL; /* (intermediate) text file written to */ +void *inpf = NULL; /* file read from (source or include) */ +void *inpf_org= NULL; /* main source file */ +void *outf = NULL; /* (intermediate) text file written to */ -SC_VDEFINE jmp_buf errbuf; +jmp_buf errbuf; -SC_VDEFINE HashTable *sp_Globals = NULL; +HashTable *sp_Globals = NULL; #if !defined SC_LIGHT - SC_VDEFINE int sc_makereport=FALSE; /* generate a cross-reference report */ + int sc_makereport=FALSE; /* generate a cross-reference report */ #endif #if defined __WATCOMC__ && !defined NDEBUG diff --git a/sourcepawn/compiler/sp_symhash.cpp b/sourcepawn/compiler/sp_symhash.cpp index fd27c452..b843698c 100644 --- a/sourcepawn/compiler/sp_symhash.cpp +++ b/sourcepawn/compiler/sp_symhash.cpp @@ -64,13 +64,13 @@ struct HashTable : public ke::HashTable { }; -SC_FUNC uint32_t +uint32_t NameHash(const char *str) { return ke::HashCharSequence(str, strlen(str)); } -SC_FUNC HashTable *NewHashTable() +HashTable *NewHashTable() { HashTable *ht = new HashTable(); if (!ht->init()) { @@ -80,13 +80,13 @@ SC_FUNC HashTable *NewHashTable() return ht; } -SC_FUNC void +void DestroyHashTable(HashTable *ht) { delete ht; } -SC_FUNC symbol * +symbol * FindTaggedInHashTable(HashTable *ht, const char *name, int fnumber, int *cmptag) { NameAndScope nas(name, fnumber, cmptag); @@ -103,7 +103,7 @@ FindTaggedInHashTable(HashTable *ht, const char *name, int fnumber, int *cmptag) return *r; } -SC_FUNC symbol * +symbol * FindInHashTable(HashTable *ht, const char *name, int fnumber) { NameAndScope nas(name, fnumber, nullptr); @@ -113,7 +113,7 @@ FindInHashTable(HashTable *ht, const char *name, int fnumber) return *r; } -SC_FUNC void +void AddToHashTable(HashTable *ht, symbol *sym) { HashTable::Insert i = ht->findForAdd(sym); @@ -121,7 +121,7 @@ AddToHashTable(HashTable *ht, symbol *sym) ht->add(i, sym); } -SC_FUNC void +void RemoveFromHashTable(HashTable *ht, symbol *sym) { HashTable::Result r = ht->find(sym); diff --git a/sourcepawn/compiler/sp_symhash.h b/sourcepawn/compiler/sp_symhash.h index 688c69d2..3617368f 100644 --- a/sourcepawn/compiler/sp_symhash.h +++ b/sourcepawn/compiler/sp_symhash.h @@ -2,16 +2,16 @@ #ifndef _INCLUDE_SPCOMP_SYMHASH_H_ #define _INCLUDE_SPCOMP_SYMHASH_H_ -SC_FUNC uint32_t NameHash(const char *str); +uint32_t NameHash(const char *str); struct HashTable; -SC_FUNC HashTable *NewHashTable(); -SC_FUNC void DestroyHashTable(HashTable *ht); -SC_FUNC void AddToHashTable(HashTable *ht, symbol *sym); -SC_FUNC void RemoveFromHashTable(HashTable *ht, symbol *sym); -SC_FUNC symbol *FindInHashTable(HashTable *ht, const char *name, int fnumber); -SC_FUNC symbol *FindTaggedInHashTable(HashTable *ht, const char *name, int fnumber, +HashTable *NewHashTable(); +void DestroyHashTable(HashTable *ht); +void AddToHashTable(HashTable *ht, symbol *sym); +void RemoveFromHashTable(HashTable *ht, symbol *sym); +symbol *FindInHashTable(HashTable *ht, const char *name, int fnumber); +symbol *FindTaggedInHashTable(HashTable *ht, const char *name, int fnumber, int *cmptag); #endif /* _INCLUDE_SPCOMP_SYMHASH_H_ */