From 08d1784f953c6a7e65c587bab96f9b47e9c4d8c1 Mon Sep 17 00:00:00 2001 From: Manoel Trapier Date: Tue, 19 Mar 2013 13:26:07 +0100 Subject: [PATCH] Remove more warns on ncgg !! Maybe a bug found in ncgg cgg.y with n_coerc call atline 612 --- h/cgg_cg.h | 5 +++++ util/ncgg/cgg.y | 12 +++++----- util/ncgg/coerc.c | 9 +++++--- util/ncgg/coerc.h | 27 +++++++++++++++++++++++ util/ncgg/cvtkeywords | 2 +- util/ncgg/cvtkeywords.h | 10 +++++++++ util/ncgg/emlookup.c | 4 ---- util/ncgg/emlookup.h | 16 ++++++++++++++ util/ncgg/error.c | 10 ++++----- util/ncgg/error.h | 26 ++++++++++++++++++++++ util/ncgg/expr.c | 5 +---- util/ncgg/expr.h | 26 ++++++++++++++++++++++ util/ncgg/hall.c | 8 ++----- util/ncgg/hall.h | 18 +++++++++++++++ util/ncgg/instruct.c | 9 +++----- util/ncgg/instruct.h | 5 +++++ util/ncgg/iocc.c | 6 ++--- util/ncgg/iocc.h | 13 +++++++++++ util/ncgg/lookup.c | 8 ++----- util/ncgg/lookup.h | 9 +++++++- util/ncgg/main.c | 22 +++++++++++++----- util/ncgg/output.c | 23 +++++++++++++------ util/ncgg/output.h | 49 +++++++++++++++++++++++++++++++++++++++++ util/ncgg/scan.l | 13 +++++++---- util/ncgg/set.c | 7 ++---- util/ncgg/set.h | 14 ++++++++++++ util/ncgg/strlookup.c | 5 +---- util/ncgg/strlookup.h | 11 +++++++++ util/ncgg/subr.c | 10 ++++----- util/ncgg/subr.h | 31 ++++++++++++++++++++++++++ util/ncgg/var.c | 4 ---- util/ncgg/varinfo.h | 4 ++++ 32 files changed, 340 insertions(+), 81 deletions(-) create mode 100644 util/ncgg/coerc.h create mode 100644 util/ncgg/cvtkeywords.h create mode 100644 util/ncgg/emlookup.h create mode 100644 util/ncgg/error.h create mode 100644 util/ncgg/hall.h create mode 100644 util/ncgg/output.h create mode 100644 util/ncgg/strlookup.h create mode 100644 util/ncgg/subr.h diff --git a/h/cgg_cg.h b/h/cgg_cg.h index 6cc04b007..49f2c9eb2 100644 --- a/h/cgg_cg.h +++ b/h/cgg_cg.h @@ -4,6 +4,9 @@ */ /* $Id$ */ +#ifndef H_CGG_CG_H +#define H_CGG_CG_H + /* offsets of interesting fields in EM-pattern */ #define PO_HASH 0 @@ -165,3 +168,5 @@ typedef struct { /* one to one coercions */ if ((a=((*(b)++)&BMASK)) >= 128) {\ a = ((a-128)< #include "param.h" #include "varinfo.h" @@ -14,7 +12,9 @@ static char rcsid[]= "$Id$"; #include "iocc.h" #include "instruct.h" #include "expr.h" +#include "output.h" #include "extern.h" +#include "strlookup.h" #include #include @@ -610,9 +610,11 @@ coercdeflist_el inithall(); } optexpr allocates generates yields - { tokpatro[0] = 0; + { + iocc_t empty; /* WARNING */ + tokpatro[0] = 0; checkhall(); - n_coerc($3,$5,$6,$7,$8); + n_coerc($3,$5,$6,$7,$8, empty); freevi($6); freevi($7); cursetno = -1; diff --git a/util/ncgg/coerc.c b/util/ncgg/coerc.c index 971168cf3..d2734bbc1 100644 --- a/util/ncgg/coerc.c +++ b/util/ncgg/coerc.c @@ -2,9 +2,7 @@ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. * See the copyright notice in the ACK home directory, in the file "Copyright". */ -#ifndef NORCSID -static char rcsid[]= "$Id$"; -#endif +#include #include "assert.h" #include "param.h" @@ -13,7 +11,12 @@ static char rcsid[]= "$Id$"; #include "reg.h" #include "token.h" #include "varinfo.h" +#include "instruct.h" #include "iocc.h" +#include "error.h" +#include "output.h" +#include "subr.h" +#include "hall.h" #include #include "pseudo.h" #include "extern.h" diff --git a/util/ncgg/coerc.h b/util/ncgg/coerc.h new file mode 100644 index 000000000..bc6f53885 --- /dev/null +++ b/util/ncgg/coerc.h @@ -0,0 +1,27 @@ +/* + * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. + * See the copyright notice in the ACK home directory, in the file "Copyright". + */ +#ifndef LANG_NCGG_COERC_H +#define LANG_NCGG_COERC_H + +#include "iocc.h" +#include "varinfo.h" + +/* util/ncgg/coerc.c */ +void n_move(int s1, int e1, int s2, int e2, struct varinfo *vi); +int existmove(iocc_t from, short *sp); +int existalmove(iocc_t from, int prpno); +struct varinfo *gen_move(iocc_t from, iocc_t to); +void n_test(int s, int e, struct varinfo *vi); +struct varinfo *gen_test(iocc_t from); +struct varinfo *gen_label(int arg); +struct varinfo *gen_preturn(void); +struct varinfo *gen_tlab(int n); +void n_stack(int s, int e, int p, struct varinfo *vi); +void checkstacking(short *sp); +void n_coerc(int ti, int be, struct varinfo *al, struct varinfo *ge, struct varinfo *rp, iocc_t in); +void checkunstacking(int setno); +void n_split(int ti, int be, struct varinfo *al, struct varinfo *ge, struct varinfo *rp, int n); + +#endif /* LANG_NCGG_COERC_H */ \ No newline at end of file diff --git a/util/ncgg/cvtkeywords b/util/ncgg/cvtkeywords index c3a4f1e2b..cfab9558d 100755 --- a/util/ncgg/cvtkeywords +++ b/util/ncgg/cvtkeywords @@ -12,7 +12,7 @@ g/^#/d a void enterkeyw() { - register symbol *sy_p; + symbol *sy_p; . $a diff --git a/util/ncgg/cvtkeywords.h b/util/ncgg/cvtkeywords.h new file mode 100644 index 000000000..28126b428 --- /dev/null +++ b/util/ncgg/cvtkeywords.h @@ -0,0 +1,10 @@ +/* + * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. + * See the copyright notice in the ACK home directory, in the file "Copyright". + */ +#ifndef LANG_NCGG_CVTKEYWORDS_H +#define LANG_NCGG_CVTKEYWORDS_H + +void enterkeyw(); + +#endif /* LANG_NCGG_CVTKEYWORDS_H */ \ No newline at end of file diff --git a/util/ncgg/emlookup.c b/util/ncgg/emlookup.c index 7597d9f11..7ba133d41 100644 --- a/util/ncgg/emlookup.c +++ b/util/ncgg/emlookup.c @@ -2,10 +2,6 @@ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. * See the copyright notice in the ACK home directory, in the file "Copyright". */ -#ifndef NORCSID -static char rcsid[]= "$Id$"; -#endif - #include #include #include "param.h" diff --git a/util/ncgg/emlookup.h b/util/ncgg/emlookup.h new file mode 100644 index 000000000..00a051599 --- /dev/null +++ b/util/ncgg/emlookup.h @@ -0,0 +1,16 @@ +/* + * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. + * See the copyright notice in the ACK home directory, in the file "Copyright". + */ +#ifndef LANG_NCGG_EMLOOKUP_H +#define LANG_NCGG_EMLOOKUP_H + +/* util/ncgg/emlookup.c */ +void initemhash(void); +unsigned int emhash(char *name); +void enter(char *name, int value); +int mlookup(char *name); +int argtyp(int mn); + + +#endif /* LANG_NCGG_EMLOOKUP_H */ \ No newline at end of file diff --git a/util/ncgg/error.c b/util/ncgg/error.c index 5e33f093f..7c0c32305 100644 --- a/util/ncgg/error.c +++ b/util/ncgg/error.c @@ -2,10 +2,6 @@ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. * See the copyright notice in the ACK home directory, in the file "Copyright". */ -#ifndef NORCSID -static char rcsid[]= "$Id$"; -#endif - #if __STDC__ #include #endif @@ -13,6 +9,9 @@ static char rcsid[]= "$Id$"; #include #include +#include "varinfo.h" +#include "output.h" + #if __STDC__ void error(char *fmt, ...); #else @@ -98,7 +97,8 @@ void badassertion(char *string, char *file, int line) } #endif -void tabovf(char *string) +int tabovf(char *string) { fatal("%s overflow", string); + return 0; } diff --git a/util/ncgg/error.h b/util/ncgg/error.h new file mode 100644 index 000000000..b4ea95598 --- /dev/null +++ b/util/ncgg/error.h @@ -0,0 +1,26 @@ +/* + * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. + * See the copyright notice in the ACK home directory, in the file "Copyright". + */ +#ifndef LANG_NCGG_ERROR_H +#define LANG_NCGG_ERROR_H + +void yyerror(char *s); +void goodbye(); + +#if __STDC__ +void error(char *fmt, ...); +void fatal(char *fmt, ...); +#else /* __STDC__ */ +/*VARARGS1*/ +fatal(s,a,b,c,d); +error(s,a,b,c,d); +#endif + +#ifndef NDEBUG +void badassertion(char *string, char *file, int line); +#endif + +int tabovf(char *string); + +#endif /* LANG_NCGG_ERROR_H */ \ No newline at end of file diff --git a/util/ncgg/expr.c b/util/ncgg/expr.c index c58d9990c..7e03b191e 100644 --- a/util/ncgg/expr.c +++ b/util/ncgg/expr.c @@ -2,10 +2,6 @@ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. * See the copyright notice in the ACK home directory, in the file "Copyright". */ -#ifndef NORCSID -static char rcsid[]= "$Id$"; -#endif - #include #include #include @@ -18,6 +14,7 @@ static char rcsid[]= "$Id$"; #include "property.h" #include "expr.h" #include "regvar.h" +#include "error.h" #include #include "extern.h" diff --git a/util/ncgg/expr.h b/util/ncgg/expr.h index 177a71f7b..172784112 100644 --- a/util/ncgg/expr.h +++ b/util/ncgg/expr.h @@ -4,6 +4,9 @@ */ /* $Id$ */ +#ifndef UTIL_NCGG_EXPR_H +#define UTIL_NCGG_EXPR_H + typedef struct expr { int ex_typ; short ex_regset[SZOFSET(MAXREGS)]; @@ -18,3 +21,26 @@ typedef struct expr { /* When the type is register the regset contains the set of possible registers for checking purposes only. */ + +/* util/ncgg/expr.c */ +int i_expr(expr_t e); +int b_expr(expr_t e); +expr_t make_expr(int type, int operator, int op1, int op2); +expr_t regno_expr(int regno); +expr_t ident_expr(char *name); +expr_t subreg_expr(int tokarg, int subreg); +void subregset(short *sp, int subreg, short *regset); +int membset(int setno, char *name, short *regset, char *appearance, int restyp, int *typp); +expr_t memb_expr(int setno, char *name, char *appearance, int tokarg); +expr_t tokm_expr(int tokarg, char *name); +expr_t perc_ident_expr(char *name); +expr_t all_expr(int all_no, int subreg); +int eq2expr(expr_t e1, expr_t e2); +int ne2expr(expr_t e1, expr_t e2); +expr_t sum_expr(expr_t e1, expr_t e2); +expr_t iextoaddr(expr_t e); +expr_t regvar_expr(expr_t e, int regtyp); +void initnodes(void); +int ex_lookup(int operator, int lnode, int rnode); + +#endif /* UTIL_NCGG_EXPR_H */ \ No newline at end of file diff --git a/util/ncgg/hall.c b/util/ncgg/hall.c index 564268a6e..9a07884f7 100644 --- a/util/ncgg/hall.c +++ b/util/ncgg/hall.c @@ -2,17 +2,13 @@ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. * See the copyright notice in the ACK home directory, in the file "Copyright". */ -#ifndef NORCSID -static char rcsid[]= "$Id$"; -#endif - #include "assert.h" #include "param.h" #include "set.h" +#include "hall.h" +#include "error.h" #include -void unite(short *sp, short *into); - /* * This file implements the marriage thesis from Hall. * The thesis says that given a number, say N, of subsets from diff --git a/util/ncgg/hall.h b/util/ncgg/hall.h new file mode 100644 index 000000000..a21f492be --- /dev/null +++ b/util/ncgg/hall.h @@ -0,0 +1,18 @@ +/* + * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. + * See the copyright notice in the ACK home directory, in the file "Copyright". + */ +#ifndef LANG_NCGG_HALL_H +#define LANG_NCGG_HALL_H + +/* util/ncgg/hall.c */ +void hallverbose(void); +void inithall(void); +void nexthall(short *sp); +int card(short *sp); +void checkhall(void); +int hall(void); +int recurhall(int nhallsets, short hallsets[][(((40 +100)+15)/16)]); +void unite(short *sp, short *into); + +#endif /* LANG_NCGG_HALL_H */ \ No newline at end of file diff --git a/util/ncgg/instruct.c b/util/ncgg/instruct.c index f0b3fbd6a..213be56a8 100644 --- a/util/ncgg/instruct.c +++ b/util/ncgg/instruct.c @@ -2,10 +2,6 @@ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. * See the copyright notice in the ACK home directory, in the file "Copyright". */ -#ifndef NORCSID -static char rcsid[]= "$Id$"; -#endif - #include #include "param.h" @@ -15,6 +11,9 @@ static char rcsid[]= "$Id$"; #include "set.h" #include "expr.h" #include "iocc.h" +#include "set.h" +#include "subr.h" +#include "error.h" #include #include "extern.h" @@ -25,8 +24,6 @@ extern inproc; extern set_t l_sets[]; extern inst_t l_instances[]; -extern expr_t subreg_expr(),regno_expr(); - struct varinfo *setcoco(int n) { struct varinfo *vi; diff --git a/util/ncgg/instruct.h b/util/ncgg/instruct.h index 68828f99b..ef6c558b1 100644 --- a/util/ncgg/instruct.h +++ b/util/ncgg/instruct.h @@ -4,6 +4,9 @@ */ /* $Id$ */ +#ifndef LANG_NCGG_INSTRUCT_H +#define LANG_NCGG_INSTRUCT_H + #ifndef _COST_ #include "cost.h" #endif @@ -39,3 +42,5 @@ extern instr_t l_instr[]; * if it contains the same information and is allowed as an operand * in this place. Too difficult for now. */ + +#endif /* LANG_NCGG_INSTRUCT_H */ \ No newline at end of file diff --git a/util/ncgg/iocc.c b/util/ncgg/iocc.c index 9f2d37cc1..9e6240b14 100644 --- a/util/ncgg/iocc.c +++ b/util/ncgg/iocc.c @@ -2,10 +2,6 @@ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. * See the copyright notice in the ACK home directory, in the file "Copyright". */ -#ifndef NORCSID -static char rcsid[]= "$Id$"; -#endif - #include #include #include @@ -17,6 +13,8 @@ static char rcsid[]= "$Id$"; #include "token.h" #include "property.h" #include "iocc.h" +#include "error.h" +#include "subr.h" #include #include "regvar.h" #include "extern.h" diff --git a/util/ncgg/iocc.h b/util/ncgg/iocc.h index 197f53475..58b8f71b0 100644 --- a/util/ncgg/iocc.h +++ b/util/ncgg/iocc.h @@ -3,8 +3,21 @@ * See the copyright notice in the ACK home directory, in the file "Copyright". */ /* $Id$ */ +#ifndef LANG_NCGG_IOCC_H +#define LANG_NCGG_IOCC_H typedef struct iocc { short in_set[SETSIZE]; int in_index; } iocc_t,*iocc_p; + +/* util/ncgg/iocc.c */ +iocc_t subr_iocc(int tokarg, int subreg); +iocc_t tokm_iocc(int tokarg, char *ident); +iocc_t percident_iocc(char *ident); +iocc_t ident_iocc(char *ident); +iocc_t all_iocc(int all_no, int subreg); +iocc_t descr_iocc(char *ident); +int instalookup(inst_t insta, int filled); + +#endif /* LANG_NCGG_IOCC_H */ \ No newline at end of file diff --git a/util/ncgg/lookup.c b/util/ncgg/lookup.c index 32c60df75..037bb025b 100644 --- a/util/ncgg/lookup.c +++ b/util/ncgg/lookup.c @@ -2,18 +2,14 @@ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. * See the copyright notice in the ACK home directory, in the file "Copyright". */ -#ifndef NORCSID -static char rcsid[]= "$Id$"; -#endif - #include #include "assert.h" #include "param.h" #include "lookup.h" +#include "error.h" +#include "lookup.h" #include "extern.h" -unsigned int hashvalue(char *s); - symbol dumsym; /* dummy to return in case of error */ symbol *lookup(char *name, symtype type, lookupstyle style) diff --git a/util/ncgg/lookup.h b/util/ncgg/lookup.h index 8eec0e75d..378722846 100644 --- a/util/ncgg/lookup.h +++ b/util/ncgg/lookup.h @@ -3,6 +3,8 @@ * See the copyright notice in the ACK home directory, in the file "Copyright". */ /* $Id$ */ +#ifndef LANG_NCGG_LOOKUP_H +#define LANG_NCGG_LOOKUP_H typedef enum { justlooking,mustexist,newsymbol,makeexist @@ -30,4 +32,9 @@ typedef struct symbol { #define NSYMHASH 61 extern symbol *symhash[NSYMHASH]; /* chained hashtable */ -extern symbol *lookup(); + +/* util/ncgg/lookup.c */ +symbol *lookup(char *name, symtype type, lookupstyle style); +unsigned int hashvalue(char *s); + +#endif /* LANG_NCGG_LOOKUP_H */ \ No newline at end of file diff --git a/util/ncgg/main.c b/util/ncgg/main.c index 2c805e7a8..b397c5b2a 100644 --- a/util/ncgg/main.c +++ b/util/ncgg/main.c @@ -2,18 +2,28 @@ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. * See the copyright notice in the ACK home directory, in the file "Copyright". */ -#ifndef NORCSID -static char rcsid[]= "$Id$"; -#endif - #include #include +#include "param.h" +#include "varinfo.h" + +#include "error.h" +#include "emlookup.h" +#include "cvtkeywords.h" +#include "expr.h" +#include "output.h" +#include "hall.h" +#include + +/* From YACC lexer */ +void yyparse(void); + char *filename; char *beg_sbrk; -extern char *sbrk(); -main(argc,argv) char **argv; { +int main(int argc, char *argv[]) +{ extern int nerrors; extern int code_in_c; extern int tabledebug; diff --git a/util/ncgg/output.c b/util/ncgg/output.c index 42beb516a..25ef5b674 100644 --- a/util/ncgg/output.c +++ b/util/ncgg/output.c @@ -16,12 +16,13 @@ char *c_file= "tables.c"; char *h_file= "tables.H"; char *cd_file= "code"; -#ifndef NORCSID -static char rcsid[]= "$Id$"; -#endif - #include #include +#include +#include +#include +#include + #include "assert.h" #include "varinfo.h" #include "param.h" @@ -31,11 +32,17 @@ static char rcsid[]= "$Id$"; #include "set.h" #include "instruct.h" #include "lookup.h" +#include "error.h" +#include "strlookup.h" +#include "subr.h" #include #include "pseudo.h" #include "regvar.h" #include "extern.h" +/* Since isascii is not standard, as c89 or C99, privide another method */ +#define IsAscii(_c) (((_c) & ~0x7f) == 0) + #define BMASK 0xFF #define BSHIFT 8 @@ -387,7 +394,7 @@ void outfmt(char *p) register int c; fprintf(ctable,"\""); while ((c= (*p++&0377))!=0) { - if (! isascii(c) || iscntrl(c)) { + if (! IsAscii(c) || iscntrl(c)) { fprintf(ctable,"\\%c%c%c", ((c&~0300)>>6) + '0', ((c&070)>>3)+'0', (c&07)+'0'); @@ -433,8 +440,10 @@ void outenodes() void outstrings() { int i; +#if 0 char *p; int c; +#endif extern char * filename; if (tabledebug) @@ -445,7 +454,7 @@ void outstrings() outfmt(l_strings[i]); #if 0 while ((c= (*p++&0377))!=0) { - if (! isascii(c) || iscntrl(c)) { + if (! IsAscii(c) || iscntrl(c)) { fprintf(ctable,"\\%c%c%c", ((c&~0300)>>6) + '0', ((c&070)>>3)+'0', (c&07)+'0'); @@ -658,7 +667,7 @@ void outars() void finishio() { - int nregs; + int nregs = 0; finishcode(); hashpatterns(); diff --git a/util/ncgg/output.h b/util/ncgg/output.h new file mode 100644 index 000000000..c24deee6b --- /dev/null +++ b/util/ncgg/output.h @@ -0,0 +1,49 @@ +/* + * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. + * See the copyright notice in the ACK home directory, in the file "Copyright". + */ +#ifndef LANG_NCGG_OUTPUT_H +#define LANG_NCGG_OUTPUT_H + +/* util/ncgg/output.c */ +void opnfile(FILE **f, char *s); +void unlfile(FILE *f, char *s); +void initio(void); +void finishcode(void); +void errorexit(void); +void code8(int x); +void code53(int x, int y); +void codeint(int x); +void outpatterns(void); +void pat(int n); +void patshort(int n); +void patbyte(int n); +void hashpatterns(void); +void outincludes(void); +void outregs(void); +void outregvars(void); +int typeconv(int n); +void outfmt(char *p); +void outtokens(void); +void outenodes(void); +void outstrings(void); +void outsets(void); +void outinstances(void); +void outmoves(void); +void outtests(void); +void outstacks(void); +void outsplits(void); +void outcoercs(void); +void outproplists(void); +void outconsts(void); +void cdef(char *s, int n); +void passon(char *s); +void outdefs(void); +void outars(void); +void finishio(void); +void codecoco(int cocono); +void dopattern(int stackcoerc, varinfo *kills, varinfo *allocates, varinfo *generates, varinfo *yields, varinfo *leaving); +void used(char *resource, int use, int max); +void statistics(void); + +#endif /* LANG_NCGG_OUTPUT_H */ \ No newline at end of file diff --git a/util/ncgg/scan.l b/util/ncgg/scan.l index db00a941b..7e56c15e6 100644 --- a/util/ncgg/scan.l +++ b/util/ncgg/scan.l @@ -3,12 +3,17 @@ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. * See the copyright notice in the ACK home directory, in the file "Copyright". */ -#ifndef NORCSID -static char rcsid2[]= "$Id$"; -#endif - +#include "emlookup.h" +#include "subr.h" +#include "error.h" +#include "hall.h" +#include "coerc.h" #include "extern.h" + +/* fileno is not C89 and can be missing sometimes. */ +int fileno(FILE *stream); + int lineno=1; extern char *filename; #undef yywrap diff --git a/util/ncgg/set.c b/util/ncgg/set.c index 43caa690f..7ba6a0f9b 100644 --- a/util/ncgg/set.c +++ b/util/ncgg/set.c @@ -2,17 +2,14 @@ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. * See the copyright notice in the ACK home directory, in the file "Copyright". */ -#ifndef NORCSID -static char rcsid[]= "$Id$"; -#endif - #include "param.h" #include "property.h" #include "set.h" #include "token.h" #include "lookup.h" #include "reg.h" -#include +#include "error.h" +#include "subr.h" #include "extern.h" extern set_t l_sets[]; diff --git a/util/ncgg/set.h b/util/ncgg/set.h index 04010baf7..f0f08fe5d 100644 --- a/util/ncgg/set.h +++ b/util/ncgg/set.h @@ -3,7 +3,21 @@ * See the copyright notice in the ACK home directory, in the file "Copyright". */ /* $Id$ */ +#ifndef LANG_NCGG_SET_H +#define LANG_NCGG_SET_H + +#include #define BIS(sp,n) (sp)[(n)>>4] |= 1<<((n)&0xF) #define BIC(sp,n) (sp)[(n)>>4] &= ~(1<<((n)&0xF)) #define BIT(sp,n) (((sp)[(n)>>4]&(1<<((n)&0xF)))!=0) + +/* util/ncgg/set.c */ +int setlookup(set_t s); +void make_std_sets(void); +set_t ident_to_set(char *name); +set_t setproduct(set_t s1, set_t s2); +set_t setsum(set_t s1, set_t s2); +set_t setdiff(set_t s1, set_t s2); + +#endif /* LANG_NCGG_SET_H */ diff --git a/util/ncgg/strlookup.c b/util/ncgg/strlookup.c index 7aee93ae1..e58041384 100644 --- a/util/ncgg/strlookup.c +++ b/util/ncgg/strlookup.c @@ -2,12 +2,9 @@ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. * See the copyright notice in the ACK home directory, in the file "Copyright". */ -#ifndef NORCSID -static char rcsid[]= "$Id$"; -#endif - #include #include "param.h" +#include "error.h" #include "extern.h" int nstrings=0; diff --git a/util/ncgg/strlookup.h b/util/ncgg/strlookup.h new file mode 100644 index 000000000..8e1f58fd7 --- /dev/null +++ b/util/ncgg/strlookup.h @@ -0,0 +1,11 @@ +/* + * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. + * See the copyright notice in the ACK home directory, in the file "Copyright". + */ +#ifndef LANG_NCGG_STRLOOKUP_H +#define LANG_NCGG_STRLOOKUP_H + +/* util/ncgg/strlookup.c */ +int strlookup(char *str); + +#endif /* LANG_NCGG_STRLOOKUP_H */ \ No newline at end of file diff --git a/util/ncgg/subr.c b/util/ncgg/subr.c index 82b41b1cf..1e10ec03a 100644 --- a/util/ncgg/subr.c +++ b/util/ncgg/subr.c @@ -2,10 +2,6 @@ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. * See the copyright notice in the ACK home directory, in the file "Copyright". */ -#ifndef NORCSID -static char rcsid[]= "$Id$"; -#endif - #include #include #include "param.h" @@ -18,10 +14,12 @@ static char rcsid[]= "$Id$"; #include "instruct.h" #include "token.h" #include "regvar.h" +#include "error.h" +#include "subr.h" #include #include "extern.h" - -expr_t ident_expr(char *name); +#include "strlookup.h" +#include "hall.h" void n_proc(char *name) { diff --git a/util/ncgg/subr.h b/util/ncgg/subr.h new file mode 100644 index 000000000..d8a2b8328 --- /dev/null +++ b/util/ncgg/subr.h @@ -0,0 +1,31 @@ +#ifndef UTIL_NCGG_SUBR_H +#define UTIL_NCGG_SUBR_H + +#include "varinfo.h" +#include "instruct.h" + +/* util/ncgg/subr.c */ +void n_proc(char *name); +struct varinfo *make_erase(char *name); +void n_instr(char *name, char *asname, operand *oplist, struct varinfo *eraselist, struct varinfo *cost); +void n_set(char *name, int number); +void n_tok(char *name, struct varinfo *atts, int size, struct varinfo *cost, struct varinfo *format); +void checkprintformat(int n); +void n_prop(char *name, int size); +void prophall(int n); +int n_reg(char *name, char *printstring, int nmemb, int member1, int member2); +void make_const(void); +int cmustbeset(char *ident); +void n_const(char *ident, int val); +void n_sconst(char *ident, char *val); +void regline(varinfo *rl, varinfo *pl, int rv); +void setallreg(struct varinfo *vi); +void freevi(struct varinfo *vip); +int myatoi(char *s); +char *mystrcpy(char *s); +char *myalloc(int n); +int chkincl(int value, int lwb, int upb); +int subset(short *sp1, short *sp2, int setsize); +int vilength(struct varinfo *vip); + +#endif /* UTIL_NCGG_SUBR_H */ \ No newline at end of file diff --git a/util/ncgg/var.c b/util/ncgg/var.c index 792b78923..5aa5a1e46 100644 --- a/util/ncgg/var.c +++ b/util/ncgg/var.c @@ -2,10 +2,6 @@ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. * See the copyright notice in the ACK home directory, in the file "Copyright". */ -#ifndef NORCSID -static char rcsid[]= "$Id$"; -#endif - #include "param.h" #include "reg.h" #include "property.h" diff --git a/util/ncgg/varinfo.h b/util/ncgg/varinfo.h index 8e7f95b38..affcda2f3 100644 --- a/util/ncgg/varinfo.h +++ b/util/ncgg/varinfo.h @@ -3,6 +3,8 @@ * See the copyright notice in the ACK home directory, in the file "Copyright". */ /* $Id$ */ +#ifndef LANG_NCGG_VARINFO_H +#define LANG_NCGG_VARINFO_H #define VI_NSTR 1 #define VI_NINT 3 @@ -15,3 +17,5 @@ typedef struct varinfo { } varinfo; #define VI_NULL (struct varinfo *) 0 + +#endif /* LANG_NCGG_VARINFO_H */ \ No newline at end of file -- 2.34.1