diff options
author | Stefan Eßer <se@FreeBSD.org> | 2020-09-30 18:15:38 +0000 |
---|---|---|
committer | Stefan Eßer <se@FreeBSD.org> | 2020-09-30 18:15:38 +0000 |
commit | a37422b35c1181b991f6f154170035383bec3391 (patch) | |
tree | a2540ec928034c67c68bec2721b73de6b762cf30 | |
parent | multimedia/libva-intel-media-driver: update to 20.3.0 (diff) |
Fix build by casting from pointer to integer through size_t
Notes
Notes:
svn path=/head/; revision=550728
-rw-r--r-- | devel/frink/Makefile | 5 | ||||
-rw-r--r-- | devel/frink/files/patch-README | 20 | ||||
-rw-r--r-- | devel/frink/files/patch-blocks.c | 10 | ||||
-rw-r--r-- | devel/frink/files/patch-blocks.h | 11 | ||||
-rw-r--r-- | devel/frink/files/patch-config.c | 126 | ||||
-rw-r--r-- | devel/frink/files/patch-flagvars.h | 27 | ||||
-rw-r--r-- | devel/frink/files/patch-frink.c | 148 | ||||
-rw-r--r-- | devel/frink/files/patch-frink.h | 20 | ||||
-rw-r--r-- | devel/frink/files/patch-indent | 23 | ||||
-rw-r--r-- | devel/frink/files/patch-output.c | 65 | ||||
-rw-r--r-- | devel/frink/files/patch-strdup | 22 | ||||
-rw-r--r-- | devel/frink/files/patch-tcl.c | 680 | ||||
-rw-r--r-- | devel/frink/files/patch-token.c | 337 | ||||
-rw-r--r-- | devel/frink/files/patch-token.h | 59 | ||||
-rw-r--r-- | devel/frink/files/patch-util.c | 15 | ||||
-rw-r--r-- | devel/frink/files/patch-util.h | 11 | ||||
-rw-r--r-- | devel/frink/files/patch-vars.c | 79 | ||||
-rw-r--r-- | devel/frink/files/patch-vars.h | 25 | ||||
-rw-r--r-- | devel/frink/files/patch-warnings | 1308 |
19 files changed, 1636 insertions, 1355 deletions
diff --git a/devel/frink/Makefile b/devel/frink/Makefile index 3e5b1599f802..696e00b5d2ca 100644 --- a/devel/frink/Makefile +++ b/devel/frink/Makefile @@ -3,7 +3,7 @@ PORTNAME= frink PORTVERSION= 2.2.2p4 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= devel MASTER_SITES= https://BSDforge.COM/projects/source/devel/frink/ @@ -15,10 +15,11 @@ LICENSE_NAME= The University of Newcastle upon Tyne LICENSE_FILE= ${WRKSRC}/COPYRIGHT LICENSE_PERMS= auto-accept -WRKSRC= ${WRKDIR}/${PORTNAME}-2.2.2 USES= uidfix MAKEFILE= ${FILESDIR}/Makefile.bsd +WRKSRC= ${WRKDIR}/${PORTNAME}-2.2.2 + OPTIONS_DEFINE= DOCS post-install: diff --git a/devel/frink/files/patch-README b/devel/frink/files/patch-README new file mode 100644 index 000000000000..3188639f727f --- /dev/null +++ b/devel/frink/files/patch-README @@ -0,0 +1,20 @@ +--- README.orig 2002-09-11 08:46:00 UTC ++++ README +@@ -32,7 +32,7 @@ + turn OFF processing code passed to the bind command. + + -c <n> +- set further indent for continuations to n. default = 2 ++ set further indent for continuations to n. default = 4 + + -d + remove braces in certain (safe) circumstances (default = OFF) +@@ -79,7 +79,7 @@ + turn on heuristic tests and warnings. (default = OFF) + + -i <n> +- set indent for each level to n. default = 4 ++ set indent for each level to n. default = 8 + + -I + Treat elseif and else the same way. (default = OFF) diff --git a/devel/frink/files/patch-blocks.c b/devel/frink/files/patch-blocks.c new file mode 100644 index 000000000000..2ee230d9461d --- /dev/null +++ b/devel/frink/files/patch-blocks.c @@ -0,0 +1,10 @@ +--- blocks.c.orig 2004-01-22 13:58:26 UTC ++++ blocks.c +@@ -32,7 +32,6 @@ + #endif + + extern List *blocks; +-extern void warnFor(Token*, char*, char*); + + Blox *pushBlock(Token *cmd, int infl, int lvl, int cond) + { diff --git a/devel/frink/files/patch-blocks.h b/devel/frink/files/patch-blocks.h new file mode 100644 index 000000000000..9dc40ab170d6 --- /dev/null +++ b/devel/frink/files/patch-blocks.h @@ -0,0 +1,11 @@ +--- blocks.h.orig 2002-12-11 22:22:09 UTC ++++ blocks.h +@@ -33,7 +33,7 @@ typedef struct block_s + extern Blox *pushBlock(Token *, int, int, int); + extern void delBlock(Blox *); + extern void popBlock(int); +-extern int isUnreachable(); ++extern int isUnreachable(void); + extern void setUnreachable(int); + + #endif diff --git a/devel/frink/files/patch-config.c b/devel/frink/files/patch-config.c new file mode 100644 index 000000000000..981f126316de --- /dev/null +++ b/devel/frink/files/patch-config.c @@ -0,0 +1,126 @@ +--- config.c.orig 2002-12-13 09:56:37 UTC ++++ config.c +@@ -29,14 +29,10 @@ + #include <malloc.h> + #endif + +-extern Token *tokenPop(Token **); +-extern void freeToken(Token *); +-extern void streamMore(Input *); +- + List *config = noList; + + static struct { +- char *name; ++ const char *name; + ParamType code; + } pvals[] ={ + {"var", PVAR}, +@@ -71,10 +67,10 @@ static struct { + {(char *) 0, 0} + }; + +-void dumpPdata(ParamData *pt, FILE *op) ++static void dumpPdata(ParamData *pt, FILE *op) + { + int i; +- char *pad; ++ const char *pad; + List *lp; + + for (i=0; pvals[i].name != (char *) 0; i += 1) +@@ -91,7 +87,7 @@ void dumpPdata(ParamData *pt, FILE *op) + { + while (lp != noList) + { +- fprintf(op, "%x ", (int) lp->item); ++ fprintf(op, "%x ", (int)(size_t) lp->item); + lp = lp->next; + } + fprintf(op, "}"); +@@ -104,7 +100,7 @@ void dumpPdata(ParamData *pt, FILE *op) + + } + +-void dumpConf(ConfigData *cp, FILE *op) ++void dumpConf(const ConfigData *cp, FILE *op) + { + List *plp; + +@@ -118,7 +114,7 @@ void dumpConf(ConfigData *cp, FILE *op) + fprintf(op, "}\n"); + } + +-static void pcode(ParamData *ppt, char *str) ++static void pcode(ParamData *ppt, const char *str) + { + int i; + +@@ -171,8 +167,7 @@ static void param(Token *tp, List **plist) + ParamData *ppt; + SeqnData *sd; + void *dp; +- extern void dumpToken(Token *, FILE *); +- ++ + ppt = newpdata(); + switch (tp->type) + { +@@ -252,7 +247,7 @@ static void parlist(Token *tp, List **plist) + freeToken(lp2); + } + +-static int handle(Token *line) ++static int confighandle(Token *line) + { + ConfigData *cpt; + Token *hd, *tp; +@@ -306,11 +301,11 @@ static int handle(Token *line) + return 1; + } + +-void readconfig(char *str) ++void readconfig(const char *str) + { + FILE *fd; + Input file; +- ++ + if ((fd = fopen(str, "r")) == NULL) + { + fprintf(stderr, "Warning: cannot open config file\n"); +@@ -319,21 +314,21 @@ void readconfig(char *str) + /* + * use the tokenising mechanism we already have to parse the config file + */ +- file.text = (char *) malloc(64*1024); ++ file.atext = malloc(64*1024); + file.stream = fd; + file.tcall = file.texpr = 0; + file.lineNumber = 1; + file.lineStart = 1; + streamMore(&file); +- while(handle(collect(&file))) ++ while(confighandle(collect(&file))) + { + /* skip */ + } +- free(file.text); ++ free(file.atext); + fclose(fd); + } + +-void stringconfig(char *str) ++void stringconfig(const char *str) + { + Input file; + /* +@@ -346,7 +341,7 @@ void stringconfig(char *str) + file.tcall = file.texpr = 0; + file.lineNumber = 1; + file.lineStart = 1; +- while(handle(collect(&file))) ++ while(confighandle(collect(&file))) + { + /* skip */ + } diff --git a/devel/frink/files/patch-flagvars.h b/devel/frink/files/patch-flagvars.h new file mode 100644 index 000000000000..9d7ae81cb4a1 --- /dev/null +++ b/devel/frink/files/patch-flagvars.h @@ -0,0 +1,27 @@ +--- flagvars.h.orig 2002-12-11 22:22:22 UTC ++++ flagvars.h +@@ -14,7 +14,7 @@ + extern int failed; + + extern int lineNumber; +-extern char *currentfile; ++extern const char *currentfile; + + extern int compout; + extern int noquotes; +@@ -63,11 +63,11 @@ extern int noheuristics; + extern int nocommand; + extern int trystrings; + +-extern char *style; +-extern char *pstyle; +-extern char *contString; ++extern const char *style; ++extern const char *pstyle; ++extern const char *contString; + +-extern char *locale; ++extern const char *locale; + extern FILE *msgfile; + extern FILE *specfile; + diff --git a/devel/frink/files/patch-frink.c b/devel/frink/files/patch-frink.c new file mode 100644 index 000000000000..c3f59b51bc28 --- /dev/null +++ b/devel/frink/files/patch-frink.c @@ -0,0 +1,148 @@ +--- frink.c.orig 2003-10-02 20:18:05 UTC ++++ frink.c +@@ -28,6 +28,7 @@ + #ifdef HAVE_STDLIB_H + #include <stdlib.h> + #endif ++#include <unistd.h> + + int failed = 0; + int lineNumber = 0; +@@ -39,7 +40,7 @@ int warndyn = 0; + int fascist = 0; + + int compout = 0; +-int resvsplit = 0; ++static int resvsplit = 0; + int noquotes = 0; + int spaceout = 0; + int trystrings = 0; +@@ -80,30 +81,21 @@ int nonlelsif = 0; + int extract = 0; + int internat = 0; + +-char *style = (char *) 0; +-char *pstyle = (char *) 0; +-char *contString = ""; ++const char *style = NULL; ++const char *pstyle = NULL; ++const char *contString = ""; + +-char *locale = (char *) 0; ++const char *locale = NULL; + FILE *msgfile = NULL; + FILE *specfile = NULL; + + int pragma = 0; + int praghold = 0; + +-char *currentfile = (char *) 0; ++const char *currentfile = NULL; + +-List *skiplist = (List *) 0; ++List *skiplist = NULL; + +-#ifndef __FreeBSD__ +-extern int getopt(int, char*const*, const char*); +-#endif +- +-extern int optind; +-extern char *optarg; +-extern int fclose(FILE*); +-extern void readconfig(char *); +-extern void stringconfig(char *); + extern void clearState(void); + + static void doVersion(void) +@@ -112,7 +104,7 @@ static void doVersion(void) + exit(0); + } + +-static char *languages[] = ++static const char *languages[] = + { + "aa", /* Afar */ + "ab", /* Abkhazian */ +@@ -256,7 +248,7 @@ static char *languages[] = + (char *) 0 + }; + +-static char *countries[] = ++static const char *countries[] = + { + "AF", /* AFGHANISTAN */ + "AL", /* ALBANIA */ +@@ -500,11 +492,11 @@ static char *countries[] = + (char *) 0 + }; + +-static void checkLocale(char *v) ++static void checkLocale(const char *v) + { + int l, i, fnd = 0;; + +- for (i = 0; languages[i] != (char *) 0; i += 1) ++ for (i = 0; languages[i] != NULL; i += 1) + { + if (strncmp(v, languages[i], 2) == 0) + { +@@ -624,7 +616,7 @@ static void usage(void) + "\n"); + } + +-void setOption(int flag, char *value) ++static void setOption(int flag, const char *value) + { + int not; + switch (flag) +@@ -749,9 +741,10 @@ static void setStyle(void) + } + } + +-static void readrc(char *file) ++static void readrc(const char *file) + { +- char *opts[50], buff[128], *cp; ++ const char *opts[50]; ++ char buff[128], *cp; + FILE *desc; + int leng, i; + +@@ -793,13 +786,9 @@ static void findrc(void) + + static void process(FILE *desc) + { +- extern void flushOutput(void); +- extern int handle(Token *line); +- extern void streamMore(Input *); +- + Input file; + +- file.text = (char *) malloc(64*1024); ++ file.atext = malloc(64*1024); + file.stream = desc; + file.tcall = file.texpr = 0; + file.lineNumber = 1; +@@ -809,12 +798,12 @@ static void process(FILE *desc) + { + } + flushOutput(); +- free(file.text); ++ free(file.atext); + } + + static void initCmds(void) + { +- static char *cmdspec = ++ static const char *cmdspec = + "set {{var 0x0017} {ctype? 0x0001}}\n" + "global {{varlist 0x0150}}\n" + "append {{var 0x0017} any args}\n" +@@ -969,7 +958,6 @@ static void initCmds(void) + int main(int argc, char **argv) + { + FILE *desc; +- extern void initOutput(void); + + initCmds(); + findrc(); diff --git a/devel/frink/files/patch-frink.h b/devel/frink/files/patch-frink.h new file mode 100644 index 000000000000..68f1bc76a5b8 --- /dev/null +++ b/devel/frink/files/patch-frink.h @@ -0,0 +1,20 @@ +--- frink.h.orig 2004-01-22 14:01:52 UTC ++++ frink.h +@@ -99,3 +99,17 @@ extern List *config; + + extern List *skiplist; + extern List *blocks; ++ ++void dumpConf(const ConfigData *, FILE*); ++void readconfig(const char *fileName); ++void stringconfig(const char *line); ++void initOutput(void); ++void setIndent(void); ++void outdent(void); ++int isVarToken(const Token *); ++int isSwitch(const Token *); ++int isSingleCall(const Token *, const char *); ++int tokEqual(const Token *, const char *); ++void flushOutput(void); ++void clearState(void); ++void warnFor(const Token *token, const char *cmd, const char *txt); diff --git a/devel/frink/files/patch-indent b/devel/frink/files/patch-indent deleted file mode 100644 index cd800c6206e1..000000000000 --- a/devel/frink/files/patch-indent +++ /dev/null @@ -1,23 +0,0 @@ -This patch sets frink's indentation defaults closer to the FreeBSD's -style(9) guidelines. ---- README Thu Jun 21 10:49:12 2001 -+++ README Fri May 31 15:04:26 2002 -@@ -33,3 +33,3 @@ - -c <n> -- set further indent for continuations to n. default = 2 -+ set further indent for continuations to n. default = 4 - -@@ -77,3 +77,3 @@ - -i <n> -- set indent for each level to n. default = 4 -+ set indent for each level to n. default = 8 - ---- frink.c Thu Jun 21 10:49:12 2001 -+++ frink.c Fri May 31 15:05:31 2002 -@@ -37,4 +37,4 @@ - int width = 80; --int indent = 4; --int contdent = 2; -+int indent = 8; -+int contdent = 4; - int nocomments = 0; diff --git a/devel/frink/files/patch-output.c b/devel/frink/files/patch-output.c new file mode 100644 index 000000000000..81f4efd84a0c --- /dev/null +++ b/devel/frink/files/patch-output.c @@ -0,0 +1,65 @@ +--- output.c.orig 2002-12-11 23:05:16 UTC ++++ output.c +@@ -43,10 +43,10 @@ static int olead = 0; /* number of spaces wanted at s + + static TokenType olast = HEAD; + +-static Token nlToken = {BLANK, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; +-static Token startToken = {START, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; +-static Token contToken = {CONT, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; +-static Token spToken = {SP, CNSTWORD, 0, " ", 1, (Token *) 0, (Token *) 0}; ++static Token nlToken = {.type = BLANK, .ckind = CNSTWORD}; ++static Token startToken = {.type = START, .ckind = CNSTWORD}; ++static Token contToken = {.type = CONT, .ckind = CNSTWORD}; ++static Token spToken = {.type = SP, .ckind = CNSTWORD, .text = " ", .length = 1}; + + void initOutput(void) + { +@@ -226,7 +226,7 @@ static void termline(void) + } + } + +-static void printkn(char *txt, int length, int keepnl) ++static void printkn(const char *txt, int length, int keepnl) + { + char *cp; + int l; +@@ -251,7 +251,7 @@ static void printkn(char *txt, int length, int keepnl) + } + } + +-static void printn(char *txt, int len) ++static void printn(const char *txt, int len) + { + if (!testonly) + { +@@ -259,12 +259,12 @@ static void printn(char *txt, int len) + } + } + +-static void print(char *txt) ++static void print(const char *txt) + { + printn(txt, strlen(txt)); + } + +-static void brace(char *t) ++static void brace(const char *t) + { + char *cp, *bp; + while ((cp = strpbrk(t, "{}")) != (char *) 0) +@@ -377,10 +377,10 @@ static void putString(Token *seq) + if (qts) { printn("\"", 1); } + } + +-static Token dollarToken = {DOLLAR, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; +-static Token endlineToken = {ENDLINE, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; +-static Token lbrackToken = {LBRACK, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; +-static Token rbrackToken = {RBRACK, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; ++static Token dollarToken = {.type = DOLLAR, .ckind = CNSTWORD}; ++static Token endlineToken = {.type = ENDLINE, .ckind = CNSTWORD}; ++static Token lbrackToken = {.type = LBRACK, .ckind = CNSTWORD}; ++static Token rbrackToken = {.type = RBRACK, .ckind = CNSTWORD}; + + void output(Token *token, int compress) + { diff --git a/devel/frink/files/patch-strdup b/devel/frink/files/patch-strdup deleted file mode 100644 index 6f806066e99e..000000000000 --- a/devel/frink/files/patch-strdup +++ /dev/null @@ -1,22 +0,0 @@ ---- util.h Wed Dec 11 17:21:48 2002 -+++ util.h Mon Feb 14 11:47:14 2005 -@@ -58,5 +58,5 @@ - extern void lapply(List *, void(*)(void *)); - --extern char *newString(char *); -+#define newString(t) strdup(t) - extern int doTest(enum Heuristics); - ---- util.c Wed Dec 11 18:07:50 2002 -+++ util.c Mon Feb 14 11:49:40 2005 -@@ -105,10 +105,4 @@ - } - --char * newString(char *t) --{ -- return strcpy(malloc(strlen(t)+1), t); --} -- -- - int doTest(enum Heuristics x) - { diff --git a/devel/frink/files/patch-tcl.c b/devel/frink/files/patch-tcl.c new file mode 100644 index 000000000000..669c4fcbb2c2 --- /dev/null +++ b/devel/frink/files/patch-tcl.c @@ -0,0 +1,680 @@ +--- tcl.c.orig 2004-01-22 13:25:48 UTC ++++ tcl.c +@@ -26,50 +26,42 @@ + static int nest[32]; /* = = class, 1 = namespace */ + static int inproc = 0; + +-static Token lbraceToken = {LBRACE, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; +-static Token rbraceToken = {RBRACE, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; +-static Token xcontToken = {XCONT, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; +-static Token ostartToken = {OSTART, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; +-static Token startToken = {START, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; +-static Token contToken = {CONT, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; +-static Token econtToken = {ECONT, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; +-static Token emToken = {EM, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; +-static Token nospToken = {NOSP, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; ++static Token lbraceToken = {.type = LBRACE, .ckind = CNSTWORD}; ++static Token rbraceToken = {.type = RBRACE, .ckind = CNSTWORD}; ++static Token xcontToken = {.type = XCONT, .ckind = CNSTWORD}; ++static Token ostartToken = {.type = OSTART, .ckind = CNSTWORD}; ++static Token startToken = {.type = START, .ckind = CNSTWORD}; ++static Token contToken = {.type = CONT, .ckind = CNSTWORD}; ++static Token econtToken = {.type = ECONT, .ckind = CNSTWORD}; ++static Token emToken = {.type = EM, .ckind = CNSTWORD}; ++static Token nospToken = {.type = NOSP, .ckind = CNSTWORD}; + static Token *olsToken = &emToken; +-static Token spToken = {SP, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; +-static Token lbrackToken = {LBRACK, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; +-static Token rbrackToken = {RBRACK, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; +-static Token msgcatToken = {CONST, CNSTWORD, 0, "::msgcat::mc", 12, (Token *) 0, (Token *) 0}; ++static Token spToken = {.type = SP, .ckind = CNSTWORD}; ++static Token lbrackToken = {.type = LBRACK, .ckind = CNSTWORD}; ++static Token rbrackToken = {.type = RBRACK, .ckind = CNSTWORD}; ++static Token msgcatToken = {.type = CONST, .ckind = CNSTWORD, .text = "::msgcat::mc", .length = 12}; + +-static Token dqStart = {DQSTART, CNSTWORD, 0, (char *) 0, 0, noToken, noToken}; +-static Token dqEnd = {DQEND, CNSTWORD, 0, (char *) 0, 0, noToken, noToken}; +-static Token thenToken = {CONST, CNSTWORD, 0, "then", 4, noToken, noToken}; +-static Token procToken = {CONST, CNSTWORD, 0, "proc", 4, noToken, noToken}; +-static Token elseToken = {CONST, CNSTWORD, 0, "else", 4, noToken, noToken}; +-static Token elseifToken = {CONST, CNSTWORD, 0, "elseif", 6, noToken, noToken}; +-static Token methodToken = {CONST, CNSTWORD, 0, "method", 6, noToken, noToken}; +-static Token semiToken = {SEMI, CNSTWORD, 0, ";", 1, noToken, noToken}; +-static Token argsToken = {SEMI, CNSTWORD, 0, "args", 4, noToken, noToken}; +-static Token argvToken = {SEMI, CNSTWORD, 0, "argv", 4, noToken, noToken}; +-static Token argv0Token = {SEMI, CNSTWORD, 0, "argv0", 5, noToken, noToken}; +-static Token platfToken = {SEMI, CNSTWORD, 0, "tcl_platform", 12, noToken, noToken}; ++static Token dqStart = {.type = DQSTART, .ckind = CNSTWORD}; ++static Token dqEnd = {.type = DQEND, .ckind = CNSTWORD}; ++static Token thenToken = {.type = CONST, .ckind = CNSTWORD, .text = "then", .length = 4}; ++static Token procToken = {.type = CONST, .ckind = CNSTWORD, .text = "proc", .length = 4}; ++static Token elseToken = {.type = CONST, .ckind = CNSTWORD, .text = "else", .length = 4}; ++static Token elseifToken = {.type = CONST, .ckind = CNSTWORD, .text = "elseif", .length = 6}; ++static Token methodToken = {.type = CONST, .ckind = CNSTWORD, .text = "method", .length = 6}; ++static Token semiToken = {.type = SEMI, .ckind = CNSTWORD, .text = ";", .length = 1}; ++static Token argsToken = {.type = SEMI, .ckind = CNSTWORD, .text = "args", .length = 4}; ++static Token argvToken = {.type = SEMI, .ckind = CNSTWORD, .text = "argv", .length = 4}; ++static Token argv0Token = {.type = SEMI, .ckind = CNSTWORD, .text = "argv0", .length = 5}; ++static Token platfToken = {.type = SEMI, .ckind = CNSTWORD, .text = "tcl_platform", .length = 12}; + + List *blocks = noList; + +-static CheckIt **noChecks = (CheckIt **) 0; +- +-extern void setIndent(void); +-extern void outdent(void); +-extern int isVarToken(Token *); +-extern int isSwitch(Token *); +-extern int isSingleCall(Token *, char *); +-extern int tokEqual(Token *, char *); +- + /* + * If there are no more tokens, print a useful message to the user and + * exit. + */ +-void failIfNullToken(Token *token, char *part, char *command, int ln) ++static void failIfNullToken(const Token *token, const char *part, ++ const char *command, int ln) + { + char msg[1024]; + +@@ -77,11 +69,11 @@ void failIfNullToken(Token *token, char *part, char *c + { + if (ln == 0) + { +- sprintf(msg, "Missing \"%s\" part in call of %s", part, command); ++ snprintf(msg, sizeof msg, "Missing \"%s\" part in call of %s", part, command); + } + else + { +- sprintf(msg, "Missing \"%s\" part in call of %s, starting line %d", ++ snprintf(msg, sizeof msg, "Missing \"%s\" part in call of %s, starting line %d", + part, command, ln); + } + fail(token, msg); +@@ -92,7 +84,8 @@ void failIfNullToken(Token *token, char *part, char *c + * If there are more tokens after this one, print a useful warning to + * the user. + */ +-void warnIfArgsAfter(Token *token, char *part, char *command) ++static void warnIfArgsAfter(const Token *token, const char *part, ++ const char *command) + { + char msg[1024]; + +@@ -106,25 +99,25 @@ void warnIfArgsAfter(Token *token, char *part, char *c + { + if (*part != '\0') + { +- sprintf(msg, "Extra arguments after \"%s\" part in call of %s", ++ snprintf(msg, sizeof msg, "Extra arguments after \"%s\" part in call of %s", + part, command); + } + else + { +- sprintf(msg, "Extra arguments in call of `%s'", command); ++ snprintf(msg, sizeof msg, "Extra arguments in call of `%s'", command); + } + warn(token, msg); + if (token->next != noToken && token->next->text != (char *) 0 && + token->next->text[0] != '\0') + { +- sprintf(msg, "Extra token is `%s'", token->next->text); ++ snprintf(msg, sizeof msg, "Extra token is `%s'", token->next->text); + warn(token->next, msg); + } + } + } + } + +-void warnExpr(Token *cmd, char *txt) ++static void warnExpr(const Token *cmd, const char *txt) + { + if (doTest(HEXPR) && cmd != noToken && cmd->type != LIST) + { +@@ -132,21 +125,14 @@ void warnExpr(Token *cmd, char *txt) + } + } + +-void warnFor(Token *token, char *cmd, char *txt) ++void warnFor(const Token *token, const char *cmd, const char *txt) + { + char msg[1024]; + +- sprintf(msg, txt, cmd); ++ snprintf(msg, sizeof msg, txt, cmd); + warn(token, msg); + } + +-static void warnIFor(Token *token, int val, char *txt) +-{ +- char msg[1024]; +- +- sprintf(msg, txt, val); +- warn(token, msg); +-} + /* + * reset various variables so that multiple file processing doesn't get + * screwed up +@@ -170,7 +156,7 @@ void clearState(void) + setVar(&platfToken, VGLOBAL, 1); + } + +-static int isNumber(char *cp) ++static int isNumber(const char *cp) + { + if (*cp == '-' || *cp == '+') + { +@@ -187,9 +173,9 @@ static int isNumber(char *cp) + return 1; + } + +-static int tokIsLevel(Token *tp) ++static int tokIsLevel(const Token *tp) + { +- char *cp; ++ const char *cp; + if (tp == noToken || !(tp->type == CONST || tp->type == LIST) || tp->text == (char *) 0) + { + return 0; +@@ -207,7 +193,7 @@ static int tokIsLevel(Token *tp) + return isNumber(cp); + } + +-static int oneLine(Token *seq, int semis) ++static int oneLine(const Token *seq, int semis) + { + while (seq != noToken) + { +@@ -221,7 +207,7 @@ static int oneLine(Token *seq, int semis) + return 1; + } + +-static int checkSpecial(char *val) ++static int checkSpecial(const char *val) + { + char ch; + +@@ -238,17 +224,17 @@ static int checkSpecial(char *val) + return 1; + } + +-static void checkUnquoted(Token *str) ++static void checkUnquoted(const Token *str) + { + char msg[128]; + if (noquotes && str->type == CONST && str->ckind == CNSTWORD && !isNumber(str->text)) + { +- sprintf(msg, "Unquoted constant - \"%s\"", str->text); ++ snprintf(msg, sizeof msg, "Unquoted constant - \"%s\"", str->text); + warn(str, msg); + } + } + +-static void checkType(Token *cmd, int flags) ++static void checkType(const Token *cmd, int flags) + { + if (cmd->type == CONST) + { +@@ -266,7 +252,7 @@ static void checkType(Token *cmd, int flags) + } + } + +-static int single(Token * tp) ++static int single(const Token * tp) + { + if (tp != noToken && tp->next == noToken) + { +@@ -285,13 +271,13 @@ static int single(Token * tp) + return 0; + } + +-static int sconstant(Token *tp) ++static int sconstant(const Token *tp) + { + return (tp != noToken && tp->next == noToken + && (tp->type == CONST || tp->type == LIST) && !checkSpecial(tp->text)); + } + +-static int constantString(Token * tp, int any) ++static int constantString(const Token * tp, int any) + { + Token *sq; + if (tp == noToken) return 0; +@@ -312,12 +298,12 @@ static int constantString(Token * tp, int any) + } + } + +-void loopstart(int inf, int cond) ++static void loopstart(int inf, int cond) + { + pushBlock(noToken, inf, -1, cond); + } + +-void loopend(void) ++static void loopend(void) + { + Blox *bp = lpeek(blocks); + int il = bp->infloop, su = (bp->breaks == 0); +@@ -329,7 +315,7 @@ void loopend(void) + } + } + +-static void msgsave(Token *tp, int any) ++static void msgsave(const Token *tp, int any) + { + char filename[128]; + +@@ -362,10 +348,11 @@ static void msgsave(Token *tp, int any) + } + } + +-void sptclop(Token *hd) ++static void doUser(Token *hd, Token *cmd, const ConfigData *cpt, int nostart); ++ ++static void sptclop(Token *hd) + { + List *cpt = config; +- extern void doUser(Token *hd, Token *cmd, ConfigData *cpt, int nostart); + ConfigData *cdp; + + while (cpt != noList) +@@ -528,7 +515,7 @@ typedef enum flags_e { + SPACEOUT = 020 + } PressFlags; + +-static void press(Token *v , PressFlags flags, CheckIt **checkp) ++static void press(Token *v , PressFlags flags) + { + Input *idx; + Token *token = noToken, *lst = noToken; +@@ -601,7 +588,7 @@ done : + switch (token->type) + { + case SEMI : +- if (flags && SEMIS) ++ if (flags & SEMIS) + { + output(&semiToken, 1); + } +@@ -640,7 +627,7 @@ done : + } + } + +-void etcetera(Token *cmd, int v) ++static void etcetera(Token *cmd, int v) + { + while (cmd != noToken) + { +@@ -649,7 +636,7 @@ void etcetera(Token *cmd, int v) + } + } + +-void catbin(Token *tp) ++static void catbin(Token *tp) + { + int sem, oln; + Token *sols; +@@ -692,7 +679,8 @@ static void handleVar(Token *hd, Token *cmd, int flags + enum VarType vt; + VarData *vp = (VarData *) 0; + char msg[1024]; +- Token *ap = noToken, *ac; ++ Token *ap = noToken; ++ const Token *ac; + int array = 0; + + if (isVarToken(cmd)) +@@ -828,7 +816,7 @@ void makeCall (Token *prc, Token *arg) + } + } + +-Token *doswitch(Token *cmd, Token *leadin) ++static Token *doswitch(Token *cmd, Token *leadin) + { + Token *tp, *bod; + int ln = leadin->lineNo, eopt = 0, dflt = 0, srtp = 1; +@@ -951,7 +939,7 @@ Token *doswitch(Token *cmd, Token *leadin) + return noToken; + } + +-Token *doif(Token *cmd, Token *leadin) ++static Token *doif(Token *cmd, Token *leadin) + { + Token *tp, *then; + int efl = ADDBRACES, ln = leadin->lineNo, cfl = ADDBRACES | PAREN; +@@ -963,7 +951,7 @@ Token *doif(Token *cmd, Token *leadin) + { + cfl |= SPACEOUT; + } +- press(cmd, cfl, noChecks); ++ press(cmd, cfl); + if (putThen) { output(&thenToken, 0); } + then = cmd->next; + if (tokEqual(then, "then")) { then = then->next; } +@@ -979,7 +967,7 @@ Token *doif(Token *cmd, Token *leadin) + tp = tp->next; + failIfNullToken(tp, "condition", "elseif", ln); + warnExpr(tp, "elseif condition not braced."); +- press(tp, efl | PAREN, noChecks); ++ press(tp, efl | PAREN); + tp = tp->next; + failIfNullToken(tp, "body", "elseif", ln); + body(tp, 0, 0); +@@ -1019,9 +1007,9 @@ Token *doif(Token *cmd, Token *leadin) + } + + +-int isNSName(Token *cmd) ++static int isNSName(const Token *cmd) + { +- char *cp; ++ const char *cp; + int cols = 0; + + if (!constant(cmd) || cmd->text == (char *) 0) { return 0; } +@@ -1053,7 +1041,7 @@ int isNSName(Token *cmd) + return 0; + } + +-static Token *doProc(Token *tag, Token *cmd, Token *leadin, int checkNS) ++static Token *doProc(Token *tag, Token *cmd, Token *leadin) + { + int ln = leadin->lineNo, inns; + Token *token, *tok2, *tok3; +@@ -1176,15 +1164,15 @@ static Token *doProc(Token *tag, Token *cmd, Token *le + + static Token *doproc(Token *cmd, Token *leadin) + { +- return doProc(&procToken, cmd, leadin, 1); ++ return doProc(&procToken, cmd, leadin); + } + + static Token *domethod(Token *cmd, Token *leadin) + { +- return doProc(&methodToken, cmd, leadin, 0); ++ return doProc(&methodToken, cmd, leadin); + } + +-static Token *dodestructor(Token *cmd, Token *leadin) ++static Token *dodestructor(Token *cmd, Token *leadin __attribute__((__unused__))) + { + if (!nest[0]) + { +@@ -1199,7 +1187,7 @@ static Token *dodestructor(Token *cmd, Token *leadin) + return noToken; + } + +-Token *doconstructor(Token *cmd, Token *leadin) ++static Token *doconstructor(Token *cmd, Token *leadin __attribute__((__unused__))) + { + if (!nest[0]) + { +@@ -1208,7 +1196,7 @@ Token *doconstructor(Token *cmd, Token *leadin) + else + { + failIfNullToken(cmd, "args", "constructor", 0); +- press(cmd, NOBRACE | ADDBRACES, noChecks); ++ press(cmd, NOBRACE | ADDBRACES); + cmd = cmd->next; + failIfNullToken(cmd, "body", "constructor", 0); + body(cmd, 0, 0); +@@ -1217,7 +1205,7 @@ Token *doconstructor(Token *cmd, Token *leadin) + return noToken; + } + +-Token *doreturn(Token *cmd, Token *leadin) ++static Token *doreturn(Token *cmd, Token *leadin) + { + Blox *pr = (Blox *) lpeek(blocks); + +@@ -1266,7 +1254,7 @@ Token *doreturn(Token *cmd, Token *leadin) + return noToken; + } + +-Token *doregexp(Token *cmd, Token *leadin) ++static Token *doregexp(Token *cmd, Token *leadin) + { + int eopt = 0; + int ln = cmd->lineNo, paramCount = 0; +@@ -1311,7 +1299,7 @@ Token *doregexp(Token *cmd, Token *leadin) + return noToken; + } + +-Token *doregsub(Token *cmd, Token *leadin) ++static Token *doregsub(Token *cmd, Token *leadin) + { + int eopt = 0; + int ln = cmd->lineNo, paramCount = 0; +@@ -1360,7 +1348,7 @@ Token *doregsub(Token *cmd, Token *leadin) + return cmd->next; + } + +-Token *dobind(Token *cmd, Token *leadin) ++static Token *dobind(Token *cmd, Token *leadin __attribute__((__unused__))) + { + Token *np; + if (!doBind || pragma & NOFORMAT) +@@ -1386,7 +1374,7 @@ Token *dobind(Token *cmd, Token *leadin) + return noToken; + } + +-Token *doitcl_class(Token *cmd, Token *leadin) ++static Token *doitcl_class(Token *cmd, Token *leadin __attribute__((__unused__))) + { + failIfNullToken(cmd, "className", "itcl_class", 0); + output(cmd, 1); +@@ -1399,7 +1387,7 @@ Token *doitcl_class(Token *cmd, Token *leadin) + return noToken; + } + +-Token *docvar(Token *cmd, Token *prt) ++static Token *docvar(Token *cmd, Token *prt) + { + if (!nest[0]) + { +@@ -1411,14 +1399,14 @@ Token *docvar(Token *cmd, Token *prt) + output(cmd, 1); + if ((cmd = cmd->next) != noToken) + { +- press(cmd, NOBRACE | ADDBRACES, noChecks); ++ press(cmd, NOBRACE | ADDBRACES); + warnIfArgsAfter(cmd, "init", prt->text); + } + } + return noToken; + } + +-Token *dopublic(Token *cmd, Token *leadin) ++static Token *dopublic(Token *cmd, Token *leadin __attribute__((__unused__))) + { + if (!nest[0]) + { +@@ -1430,7 +1418,7 @@ Token *dopublic(Token *cmd, Token *leadin) + output(cmd, 1); + if ((cmd = cmd->next) != noToken) + { +- press(cmd, NOBRACE | ADDBRACES, noChecks); ++ press(cmd, NOBRACE | ADDBRACES); + if ((cmd = cmd->next) != noToken) + { + body(cmd, 0, 0); +@@ -1441,11 +1429,11 @@ Token *dopublic(Token *cmd, Token *leadin) + return noToken; + } + +-Token *doprotected(Token *cmd, Token *leadin) { return docvar(cmd, leadin); } ++static Token *doprotected(Token *cmd, Token *leadin) { return docvar(cmd, leadin); } + +-Token *docommon(Token *cmd, Token *leadin) { return docvar(cmd, leadin); } ++static Token *docommon(Token *cmd, Token *leadin) { return docvar(cmd, leadin); } + +-static void checkVar(Token *cmd, char *nm) ++static void checkVar(Token *cmd, const char *nm) + { + List *bp = blocks; + Blox *xp; +@@ -1524,7 +1512,7 @@ static void addForVars(Token *cmd) + } + } + +-Token *doforeach(Token *cmd, Token *leadin) ++static Token *doforeach(Token *cmd, Token *leadin __attribute__((__unused__))) + { + failIfNullToken(cmd, "varName", "foreach", 0); + loopstart(0, 0); +@@ -1534,7 +1522,7 @@ Token *doforeach(Token *cmd, Token *leadin) + addForVars(cmd); + cmd = cmd->next; + failIfNullToken(cmd, "list", "foreach", 0); +- press(cmd, NOBRACE, noChecks); ++ press(cmd, NOBRACE); + cmd = cmd->next; + } + while (cmd != noToken && cmd->next != noToken && cmd->next->type != SCOMMENT); +@@ -1546,7 +1534,7 @@ Token *doforeach(Token *cmd, Token *leadin) + return noToken; + } + +-Token *doloop(Token *cmd, Token *leadin) ++static Token *doloop(Token *cmd, Token *leadin __attribute__((__unused__))) + { + Token *tp; + if (!tclX) +@@ -1556,15 +1544,15 @@ Token *doloop(Token *cmd, Token *leadin) + else + { + failIfNullToken(cmd, "var", "loop", 0); +- press(cmd, NOBRACE | ADDBRACES, noChecks); /* var */ ++ press(cmd, NOBRACE | ADDBRACES); /* var */ + tp = cmd->next; + failIfNullToken(tp, "first", "loop", 0); + warnExpr(cmd, "Unbracketed loop \"first\""); +- press(tp, ADDBRACES, noChecks); /* first */ ++ press(tp, ADDBRACES); /* first */ + tp = tp->next; + failIfNullToken(tp, "limit", "loop", 0); + warnExpr(cmd, "Unbracketed loop \"limit\""); +- press(tp, ADDBRACES, noChecks); /* limit */ ++ press(tp, ADDBRACES); /* limit */ + + tp = tp->next; + failIfNullToken(tp, "body", "loop", 0); +@@ -1572,7 +1560,7 @@ Token *doloop(Token *cmd, Token *leadin) + if (tp->next != noToken) + { + warnExpr(cmd, "Unbracketed loop \"incr\""); +- press(tp, NOBRACE | ADDBRACES, noChecks); /* incr */ ++ press(tp, NOBRACE | ADDBRACES); /* incr */ + tp = tp->next; + } + loopstart(0, 0); +@@ -1584,7 +1572,7 @@ Token *doloop(Token *cmd, Token *leadin) + return noToken; + } + +-Token *doexpr(Token *cmd, Token *leadin) ++static Token *doexpr(Token *cmd, Token *leadin __attribute__((__unused__))) + { + if (!doExpr) + { +@@ -1599,7 +1587,7 @@ Token *doexpr(Token *cmd, Token *leadin) + else if (cmd->next == noToken) + { + warnExpr(cmd, "expr body not braced."); +- press(cmd, ADDBRACES | PAREN, noChecks); /* */ ++ press(cmd, ADDBRACES | PAREN); /* */ + } + else + { +@@ -1610,7 +1598,7 @@ Token *doexpr(Token *cmd, Token *leadin) + return noToken; + } + +-Token *dounset(Token *cmd, Token *leadin) ++static Token *dounset(Token *cmd, Token *leadin) + { + int pCount = 1; + +@@ -1641,7 +1629,7 @@ Token *dounset(Token *cmd, Token *leadin) + return noToken; + } + +-Token *doupvar(Token *cmd, Token *leadin) ++static Token *doupvar(Token *cmd, Token *leadin) + { + int paramCount = 0; + int ln = leadin->lineNo; +@@ -1672,7 +1660,7 @@ Token *doupvar(Token *cmd, Token *leadin) + return noToken; + } + +-Token *dovariable(Token *cmd, Token *leadin) ++static Token *dovariable(Token *cmd, Token *leadin) + { + int paramCount = 1; + +@@ -1776,7 +1764,7 @@ static int valuecheck(ParamData *pdp, Token *cmd) + return 0; + } + +-void doBasic(ConfigData *cpt, Token *hd, Token *cmd) ++static void doBasic(const ConfigData *cpt, Token *hd, Token *cmd) + { + List *sp, *llp, *lp; + ParamData *pt, *pdp; +@@ -1793,7 +1781,7 @@ void doBasic(ConfigData *cpt, Token *hd, Token *cmd) + pt = (ParamData *) lpeek(lp); + if (pt != (ParamData *) 0 && pt->values != noList) + { +- ptpar = (int) lpeek(pt->values); ++ ptpar = (int)(size_t) lpeek(pt->values); + } + else + { +@@ -1850,7 +1838,7 @@ void doBasic(ConfigData *cpt, Token *hd, Token *cmd) + } + else + { +- press(cmd, NOBRACE | ADDBRACES | SEMIS, noChecks); /* */ ++ press(cmd, NOBRACE | ADDBRACES | SEMIS); /* */ + } + break; + +@@ -1862,7 +1850,7 @@ void doBasic(ConfigData *cpt, Token *hd, Token *cmd) + else + { + warnExpr(cmd, "Unbracketed expression"); +- press(cmd, ptpar, noChecks); /* */ ++ press(cmd, ptpar); /* */ + } + break; + +@@ -1883,7 +1871,7 @@ void doBasic(ConfigData *cpt, Token *hd, Token *cmd) + { + ptpar |= SPACEOUT; + } +- press(cmd, ptpar, noChecks); ++ press(cmd, ptpar); + loopstart(infloop, 1); + } + break; +@@ -2085,7 +2073,7 @@ void doBasic(ConfigData *cpt, Token *hd, Token *cmd) + pt = (ParamData *) lpeek(lp); + if ((sp = pt->values) != noList) + { +- ptpar = (int) lpeek(sp); ++ ptpar = (int)(size_t) lpeek(sp); + } + else + { +@@ -2140,7 +2128,8 @@ void doBasic(ConfigData *cpt, Token *hd, Token *cmd) + } + } + +-void doUser(Token *hd, Token *cmd, ConfigData *cpt, int nostart) ++static void doUser(Token *hd, Token *cmd, ++ const ConfigData *cpt, int nostart) + { + if (isUnreachable()) + { diff --git a/devel/frink/files/patch-token.c b/devel/frink/files/patch-token.c new file mode 100644 index 000000000000..e62544dc6b49 --- /dev/null +++ b/devel/frink/files/patch-token.c @@ -0,0 +1,337 @@ +--- token.c.orig 2004-01-22 13:58:48 UTC ++++ token.c +@@ -31,8 +31,6 @@ + #include <malloc.h> + #endif + +-extern char *currentfile; +- + typedef struct tbuff_s + { + char *buff; +@@ -77,7 +75,7 @@ static void capTB(TBuff *tp) + tp->buff[tp->length] ='\0'; + } + +-static void catTB(TBuff *tp, char *str) ++static void catTB(TBuff *tp, const char *str) + { + while (*str) + { +@@ -86,7 +84,7 @@ static void catTB(TBuff *tp, char *str) + capTB(tp); + } + +-static char *tokenName[] = ++static const char *tokenName[] = + { + "ENDF", + "ENDLINE", +@@ -136,7 +134,7 @@ static Token *concToken(char, char, Input *); + static Token *callToken(Input *); + static Token *varToken(Input *); + +-Token *newToken(TokenType t) ++static Token *newToken(TokenType t) + { + Token *tp = malloc(sizeof(Token)); + tp->type = t; +@@ -149,9 +147,9 @@ Token *newToken(TokenType t) + return tp; + } + +-void dumpToken(Token *tk, FILE *ops) ++void dumpToken(const Token *tk, FILE *ops) + { +- static char *cval [] = ++ static const char *cval [] = + { + "word", "string", "list" + }; +@@ -194,7 +192,7 @@ void dumpToken(Token *tk, FILE *ops) + } + } + +-void fail(Token *tp, char *msg) ++void fail(const Token *tp, const char *msg) + { + if (!compout) + { +@@ -324,7 +322,7 @@ void makeTB(Token *hd, TBuff *tb) + if (hd != noToken) { makeTB(hd->next, tb); } + } + +-void warn(Token *tp, char *msg) ++void warn(const Token *tp, const char *msg) + { + Blox *blp = (Blox *) lpeek(blocks); + TBuff *tbp = newTB(32); +@@ -333,7 +331,7 @@ void warn(Token *tp, char *msg) + { + fprintf(stderr, "***"); + } +- if (currentfile != (char *) 0) ++ if (currentfile != NULL) + { + fprintf(stderr, " %s", currentfile); + } +@@ -376,7 +374,7 @@ void warn(Token *tp, char *msg) + failed = 1; + } + +-static void bwarn(int ln, char *msg) ++static void bwarn(int ln, const char *msg) + { + Token *tp = newToken(SP); + tp->lineNo = ln; +@@ -390,7 +388,7 @@ void streamMore(Input *file) + file->position = file->text; + if (file->stream != NULL) + { +- file->remaining = fread(file->text, 1, 64*1024, file->stream); ++ file->remaining = fread(file->atext, 1, 64*1024, file->stream); + } + } + +@@ -399,7 +397,7 @@ static int isBlank(char ch) + return ch == ' ' || ch == '\t'; + } + +-static char *skipblank(char *cp) ++static const char *skipblank(const char *cp) + { + while (isBlank(*cp)) + { +@@ -496,9 +494,9 @@ void freeToken(Token *tp) + { + if (tp != noToken) + { +- if (tp->text != (char *) 0 && tp->text != tp->little) ++ if (tp->atext != tp->little) + { +- free(tp->text); ++ free(tp->atext); + } + if (tp->sequence) freeToken(tp->sequence); + if (tp->next) freeToken(tp->next); +@@ -506,7 +504,7 @@ void freeToken(Token *tp) + } + } + +-static char *filterString(Token *tp, char *txt) ++static char *filterString(Token *tp, const char *txt) + { + char *cp = malloc(strlen(txt) + 1), *pt; + +@@ -555,25 +553,9 @@ Input *tokenise(Token *tp, int expr) + return file; + } + +-Input *ftokenise(char *txt, int length, int lineNo, int expr) +-{ +- Token *tmp = newToken(CONST); /* gash token for filterstring */ +- Input *file = (Input *) malloc(sizeof(Input)); +- file->remaining = length; +- file->pushed = 0; +- file->stream = NULL; +- file->position = file->text = filterString(tmp, txt); +- file->tcall = 0; +- file->texpr = expr; +- file->lineNumber = lineNo; +- file->lineStart = 1; +- freeToken(tmp); +- return file; +-} +- + void untokenise(Input *file) + { +- free(file->text); ++ free(file->atext); + free(file); + } + +@@ -606,17 +588,17 @@ void tokenPush(Token **tp, Token *v) + } + } + +-static Token *createToken(TokenType t, char *text, Token *nxt) ++static Token *createToken(TokenType t, const char *text, size_t len, Token *nxt) + { + Token *tp = newToken(t); + +- if ((tp->length = strlen(text)) < (sizeof(tp->little) - 1)) ++ if ((tp->length = len) < (sizeof(tp->little) - 1)) + { + tp->text = strcpy(tp->little, text); + } + else + { +- tp->text = newString(text); ++ tp->text = strndup(text, len); + } + tp->next = nxt; + return tp; +@@ -719,7 +701,7 @@ done: + + static Token *handleSemi(Input*, char); + +-Token *stringToken(Input *file, char lst, TokenType res, int term) ++static Token *stringToken(Input *file, char lst, TokenType res, int term) + { + int bufSize = 16*1024; + Token *tp = newToken(res), *nt; +@@ -836,7 +818,7 @@ done: + } + + +-int tokEqual(Token *tp, char *val) ++int tokEqual(const Token *tp, const char *val) + { + if (tp != noToken) + { +@@ -844,7 +826,7 @@ int tokEqual(Token *tp, char *val) + { + case CONST: + case LIST : +- return (tp->text != (char *) 0 && strcmp(tp->text, val) == 0); ++ return (tp->text != NULL && strcmp(tp->text, val) == 0); + default: + break; + } +@@ -852,7 +834,7 @@ int tokEqual(Token *tp, char *val) + return 0; + } + +-int tokNEqual(Token *tp, char *val, int n) ++static int tokNEqual(const Token *tp, const char *val, int n) + { + if (tp != noToken) + { +@@ -870,7 +852,7 @@ int tokNEqual(Token *tp, char *val, int n) + + static int isPragma(TBuff *tp) + { +- char *cp; ++ const char *cp; + + cp = skipblank(tp->buff + 1); /* start after # character */ + return (strncmp(cp, "PRAGMA", 6) == 0 || strncmp(cp, "FRINK", 5) == 0); +@@ -1251,7 +1233,7 @@ static void handlePragma(Token *tp) + { + static struct pragma_s + { +- char *text; ++ const char *text; + enum Pragmas value; + int nextmode; + } pragmas[] = +@@ -1263,11 +1245,11 @@ static void handlePragma(Token *tp) + { "set", 0, 2}, + { "unused", 0, 3}, + { "array", 0, 4}, +- { (char *) 0, 0, 1}, ++ { NULL, 0, 1}, + }; + struct pragma_s *prp; + int label, mode = 1; +- char *cp; ++ const char *cp; + Token *token, *chars = newToken(CONST); + Input *pfile; + +@@ -1347,9 +1329,6 @@ int handle(Token *line) + { + Token *hd; + +- extern int tclop(Token*, Token*); +- extern void comment(Token *); +- + if (line == noToken) + { + if (!minimise) +@@ -1575,7 +1554,7 @@ void lprocess(Token *lst, int nls) + if (line != noToken) { handle(line); } + } + +-Token *accumulate(Input *file, int nl) ++static Token *accumulate(Input *file, int nl) + { + Token *line = noToken, *hd = noToken; + TokenType last = NL; +@@ -1652,16 +1631,16 @@ Token *tokacc(Token *tp, int flag, int nl) + return lp; + } + +-static int chkVarToken(Token *token) ++static int chkVarToken(const Token *token) + { + return (token != noToken && + (token->type == VAR || token->type == CALL || token->type == CONC + || token->type == STRING)); + } + +-int isVarToken(Token *token) ++int isVarToken(const Token *token) + { +- char *cp; ++ const char *cp; + TBuff *tb; + + if (token != noToken && token->type == CONC) +@@ -1694,7 +1673,7 @@ int isVarToken(Token *token) + return chkVarToken(token); + } + +-int isSingleCall(Token *token, char *proc) ++int isSingleCall(const Token *token, const char *proc) + { + if (token != noToken) + { +@@ -1715,7 +1694,7 @@ int isSingleCall(Token *token, char *proc) + return 0; + } + +-int isSwitch(Token *token) ++int isSwitch(const Token *token) + { + if (token != noToken) + { +@@ -1739,14 +1718,15 @@ int isSwitch(Token *token) + return 0; + } + +-Token *isArray(Token *tp) ++Token *isArray(const Token *tp) + { + Token *res = noToken; + TBuff *tbp = (TBuff *) 0; +- char *txt, *cp, ch; ++ const char *txt, *cp; ++ char ch; + int len; + +- if (tp != noToken && (tp->text != (char *) 0 || tp->type == CONC)) ++ if (tp != noToken && (tp->text != NULL || tp->type == CONC)) + { + switch (tp->type) + { +@@ -1776,9 +1756,7 @@ Token *isArray(Token *tp) + ch = *cp; + if (ch == '(') + { +- *cp = '\0'; +- res = createToken(CONST, txt, noToken); +- *cp = '('; ++ res = createToken(CONST, txt, cp - txt, noToken); + break; + } + if (ch == '\0') { break; } +@@ -1790,7 +1768,7 @@ Token *isArray(Token *tp) + return res; + } + +-int constant(Token *tp) ++int constant(const Token *tp) + { + return (tp != noToken && (tp->type == CONST || tp->type == LIST)); + } diff --git a/devel/frink/files/patch-token.h b/devel/frink/files/patch-token.h new file mode 100644 index 000000000000..f5d6591c49ab --- /dev/null +++ b/devel/frink/files/patch-token.h @@ -0,0 +1,59 @@ +--- token.h.orig 2002-12-11 22:20:34 UTC ++++ token.h +@@ -18,11 +18,14 @@ + + typedef struct input_s + { +- char *position; ++ const char *position; + int remaining; + int pushed; + char back[16]; +- char *text; ++ union { ++ const char *text; /* Use const in most cases */ ++ char *atext; ++ }; + FILE *stream; + int tcall; + int texpr; +@@ -48,8 +51,11 @@ typedef struct token_s + TokenType type; + ConstType ckind; + int isconc; +- char *text; +- int length; ++ union { ++ const char *text; ++ char *atext; ++ }; ++ size_t length; + struct token_s *sequence; + struct token_s *next; + char little[32]; +@@ -69,12 +75,21 @@ extern void freeToken(Token *); + extern void lprocess(Token*, int); + extern void makeCall(Token*, Token*); + extern void body(Token *, int, int); ++extern void comment(Token *); + + extern void output(Token *, int); + extern void blank(void); +-extern void warn(Token *, char *); +-extern void fail(Token *, char *); ++extern void warn(const Token *, const char *); ++extern void fail(const Token *, const char *); + +-extern Token *isArray(Token *); +-extern int constant(Token *tp); ++extern Token *isArray(const Token *); ++extern int constant(const Token *tp); ++extern int tclop(Token *hd, Token *line); ++extern void streamMore(Input *file); ++extern int handle(Token *line); ++extern void sprocess(Token *lst, int nls); ++extern void dumpToken(const Token *tk, FILE *ops); ++extern Token *tokenPop(Token **); ++extern void freeToken(Token *); ++ + #endif diff --git a/devel/frink/files/patch-util.c b/devel/frink/files/patch-util.c new file mode 100644 index 000000000000..c253e4bb8d14 --- /dev/null +++ b/devel/frink/files/patch-util.c @@ -0,0 +1,15 @@ +--- util.c.orig 2002-12-11 23:07:50 UTC ++++ util.c +@@ -104,12 +104,6 @@ void lapply(List * l, void (*fn)(void *)) + } + } + +-char * newString(char *t) +-{ +- return strcpy(malloc(strlen(t)+1), t); +-} +- +- + int doTest(enum Heuristics x) + { + extern int pragma; diff --git a/devel/frink/files/patch-util.h b/devel/frink/files/patch-util.h new file mode 100644 index 000000000000..46e3ee9992b0 --- /dev/null +++ b/devel/frink/files/patch-util.h @@ -0,0 +1,11 @@ +--- util.h.orig 2002-12-11 22:21:48 UTC ++++ util.h +@@ -57,7 +57,7 @@ extern void lappend(List **, void*); + extern void ldel(List **, int); + extern void lapply(List *, void(*)(void *)); + +-extern char *newString(char *); ++#define newString(t) strdup(t) + extern int doTest(enum Heuristics); + + #endif diff --git a/devel/frink/files/patch-vars.c b/devel/frink/files/patch-vars.c new file mode 100644 index 000000000000..17f3698a4577 --- /dev/null +++ b/devel/frink/files/patch-vars.c @@ -0,0 +1,79 @@ +--- vars.c.orig 2004-01-22 13:31:04 UTC ++++ vars.c +@@ -32,11 +32,9 @@ + #include <malloc.h> + #endif + +-extern void warnFor(Token*, char*, char*); +- + void checkName(Token *cmd, int dynm) + { +- static char *badNames[] = ++ static const char *badNames[] = + { + ".", + "after", +@@ -158,7 +156,8 @@ void checkName(Token *cmd, int dynm) + "wm", + (char *) 0 + }; +- char **bnp = badNames, msgb[256]; ++ const char **bnp = badNames; ++ char msgb[256]; + + if (cmd != noToken) + { +@@ -198,7 +197,7 @@ void checkName(Token *cmd, int dynm) + } + } + +-static VarData *newVar(char *name, enum VarType type) ++static VarData *newVar(const char *name, enum VarType type) + { + VarData *blp = (VarData *) malloc(sizeof(VarData)); + +@@ -211,7 +210,7 @@ static VarData *newVar(char *name, enum VarType type) + return blp; + } + +-static VarData *addVar(char *name, enum VarType type, int array) ++static VarData *addVar(const char *name, enum VarType type, int array) + { + VarData *vp = newVar(name, type); + +@@ -220,7 +219,7 @@ static VarData *addVar(char *name, enum VarType type, + return vp; + } + +-VarData *varKnown(char *name) ++VarData *varKnown(const char *name) + { + List *blp = blocks; + List *lp; +@@ -245,7 +244,7 @@ VarData *varKnown(char *name) + return (VarData *) 0; + } + +-VarData *declareVar(Token *nm, enum VarType type, int array) ++VarData *declareVar(const Token *nm, enum VarType type, int array) + { + VarData *vp = varKnown(nm->text); + +@@ -268,7 +267,7 @@ VarData *declareVar(Token *nm, enum VarType type, int + return addVar(nm->text, type, array); + } + +-VarData *useVar(Token *nm, enum VarType type, int array) ++VarData *useVar(const Token *nm, enum VarType type, int array) + { + VarData *vp; + +@@ -298,7 +297,7 @@ VarData *useVar(Token *nm, enum VarType type, int arra + return vp; + } + +-VarData *setVar(Token *nm, enum VarType type, int array) ++VarData *setVar(const Token *nm, enum VarType type, int array) + { + VarData *vp; + diff --git a/devel/frink/files/patch-vars.h b/devel/frink/files/patch-vars.h new file mode 100644 index 000000000000..0ecea68d2186 --- /dev/null +++ b/devel/frink/files/patch-vars.h @@ -0,0 +1,25 @@ +--- vars.h.orig 2003-02-27 10:33:04 UTC ++++ vars.h +@@ -11,7 +11,7 @@ + * + */ + +-#ifndef FRINK_VARS_h ++#ifndef FRINK_VARS_H + #define FRINK_VARS_H + + enum VarType +@@ -46,9 +46,9 @@ enum varCheck + + + extern void checkName(Token *, int); +-extern VarData *varKnown(char *); +-extern VarData *declareVar(Token *, enum VarType, int); +-extern VarData *useVar(Token *, enum VarType, int); +-extern VarData *setVar(Token *, enum VarType, int); ++extern VarData *varKnown(const char *); ++extern VarData *declareVar(const Token *, enum VarType, int); ++extern VarData *useVar(const Token *, enum VarType, int); ++extern VarData *setVar(const Token *, enum VarType, int); + + #endif diff --git a/devel/frink/files/patch-warnings b/devel/frink/files/patch-warnings deleted file mode 100644 index 131cb5719288..000000000000 --- a/devel/frink/files/patch-warnings +++ /dev/null @@ -1,1308 +0,0 @@ ---- blocks.c 2004-01-22 08:58:26.000000000 -0500 -+++ blocks.c 2020-05-26 00:46:17.567171000 -0400 -@@ -33,5 +33,4 @@ - - extern List *blocks; --extern void warnFor(Token*, char*, char*); - - Blox *pushBlock(Token *cmd, int infl, int lvl, int cond) ---- blocks.h 2002-12-11 17:22:09.000000000 -0500 -+++ blocks.h 2020-05-25 21:44:35.228984000 -0400 -@@ -34,5 +34,5 @@ - extern void delBlock(Blox *); - extern void popBlock(int); --extern int isUnreachable(); -+extern int isUnreachable(void); - extern void setUnreachable(int); - ---- config.c 2002-12-13 04:56:37.000000000 -0500 -+++ config.c 2020-05-26 00:53:58.729888000 -0400 -@@ -30,12 +30,8 @@ - #endif - --extern Token *tokenPop(Token **); --extern void freeToken(Token *); --extern void streamMore(Input *); -- - List *config = noList; - - static struct { -- char *name; -+ const char *name; - ParamType code; - } pvals[] ={ -@@ -72,8 +68,8 @@ - }; - --void dumpPdata(ParamData *pt, FILE *op) -+static void dumpPdata(ParamData *pt, FILE *op) - { - int i; -- char *pad; -+ const char *pad; - List *lp; - -@@ -105,5 +101,5 @@ - } - --void dumpConf(ConfigData *cp, FILE *op) -+void dumpConf(const ConfigData *cp, FILE *op) - { - List *plp; -@@ -119,5 +115,5 @@ - } - --static void pcode(ParamData *ppt, char *str) -+static void pcode(ParamData *ppt, const char *str) - { - int i; -@@ -172,6 +168,5 @@ - SeqnData *sd; - void *dp; -- extern void dumpToken(Token *, FILE *); -- -+ - ppt = newpdata(); - switch (tp->type) -@@ -253,5 +248,5 @@ - } - --static int handle(Token *line) -+static int confighandle(Token *line) - { - ConfigData *cpt; -@@ -307,9 +302,9 @@ - } - --void readconfig(char *str) -+void readconfig(const char *str) - { - FILE *fd; - Input file; -- -+ - if ((fd = fopen(str, "r")) == NULL) - { -@@ -320,5 +315,5 @@ - * use the tokenising mechanism we already have to parse the config file - */ -- file.text = (char *) malloc(64*1024); -+ file.atext = malloc(64*1024); - file.stream = fd; - file.tcall = file.texpr = 0; -@@ -326,13 +321,13 @@ - file.lineStart = 1; - streamMore(&file); -- while(handle(collect(&file))) -+ while(confighandle(collect(&file))) - { - /* skip */ - } -- free(file.text); -+ free(file.atext); - fclose(fd); - } - --void stringconfig(char *str) -+void stringconfig(const char *str) - { - Input file; -@@ -347,5 +342,5 @@ - file.lineNumber = 1; - file.lineStart = 1; -- while(handle(collect(&file))) -+ while(confighandle(collect(&file))) - { - /* skip */ ---- flagvars.h 2002-12-11 17:22:22.000000000 -0500 -+++ flagvars.h 2020-05-25 22:01:07.242413000 -0400 -@@ -15,5 +15,5 @@ - - extern int lineNumber; --extern char *currentfile; -+extern const char *currentfile; - - extern int compout; -@@ -64,9 +64,9 @@ - extern int trystrings; - --extern char *style; --extern char *pstyle; --extern char *contString; -+extern const char *style; -+extern const char *pstyle; -+extern const char *contString; - --extern char *locale; -+extern const char *locale; - extern FILE *msgfile; - extern FILE *specfile; ---- frink.c 2020-05-16 20:19:34.593158000 -0400 -+++ frink.c 2020-05-26 00:20:15.522562000 -0400 -@@ -29,4 +29,5 @@ - #include <stdlib.h> - #endif -+#include <unistd.h> - - int failed = 0; -@@ -40,5 +41,5 @@ - - int compout = 0; --int resvsplit = 0; -+static int resvsplit = 0; - int noquotes = 0; - int spaceout = 0; -@@ -81,9 +82,9 @@ - int internat = 0; - --char *style = (char *) 0; --char *pstyle = (char *) 0; --char *contString = ""; -+const char *style = NULL; -+const char *pstyle = NULL; -+const char *contString = ""; - --char *locale = (char *) 0; -+const char *locale = NULL; - FILE *msgfile = NULL; - FILE *specfile = NULL; -@@ -92,17 +93,8 @@ - int praghold = 0; - --char *currentfile = (char *) 0; -+const char *currentfile = NULL; - --List *skiplist = (List *) 0; -+List *skiplist = NULL; - --#ifndef __FreeBSD__ --extern int getopt(int, char*const*, const char*); --#endif -- --extern int optind; --extern char *optarg; --extern int fclose(FILE*); --extern void readconfig(char *); --extern void stringconfig(char *); - extern void clearState(void); - -@@ -113,5 +105,5 @@ - } - --static char *languages[] = -+static const char *languages[] = - { - "aa", /* Afar */ -@@ -257,5 +249,5 @@ - }; - --static char *countries[] = -+static const char *countries[] = - { - "AF", /* AFGHANISTAN */ -@@ -501,9 +493,9 @@ - }; - --static void checkLocale(char *v) -+static void checkLocale(const char *v) - { - int l, i, fnd = 0;; - -- for (i = 0; languages[i] != (char *) 0; i += 1) -+ for (i = 0; languages[i] != NULL; i += 1) - { - if (strncmp(v, languages[i], 2) == 0) -@@ -625,5 +617,5 @@ - } - --void setOption(int flag, char *value) -+static void setOption(int flag, const char *value) - { - int not; -@@ -750,7 +742,8 @@ - } - --static void readrc(char *file) -+static void readrc(const char *file) - { -- char *opts[50], buff[128], *cp; -+ const char *opts[50]; -+ char buff[128], *cp; - FILE *desc; - int leng, i; -@@ -794,11 +787,7 @@ - static void process(FILE *desc) - { -- extern void flushOutput(void); -- extern int handle(Token *line); -- extern void streamMore(Input *); -- - Input file; - -- file.text = (char *) malloc(64*1024); -+ file.atext = malloc(64*1024); - file.stream = desc; - file.tcall = file.texpr = 0; -@@ -810,10 +799,10 @@ - } - flushOutput(); -- free(file.text); -+ free(file.atext); - } - - static void initCmds(void) - { -- static char *cmdspec = -+ static const char *cmdspec = - "set {{var 0x0017} {ctype? 0x0001}}\n" - "global {{varlist 0x0150}}\n" -@@ -970,5 +959,4 @@ - { - FILE *desc; -- extern void initOutput(void); - - initCmds(); ---- frink.h 2004-01-22 09:01:52.000000000 -0500 -+++ frink.h 2020-05-26 00:46:50.409373000 -0400 -@@ -100,2 +100,16 @@ - extern List *skiplist; - extern List *blocks; -+ -+void dumpConf(const ConfigData *, FILE*); -+void readconfig(const char *fileName); -+void stringconfig(const char *line); -+void initOutput(void); -+void setIndent(void); -+void outdent(void); -+int isVarToken(const Token *); -+int isSwitch(const Token *); -+int isSingleCall(const Token *, const char *); -+int tokEqual(const Token *, const char *); -+void flushOutput(void); -+void clearState(void); -+void warnFor(const Token *token, const char *cmd, const char *txt); ---- output.c 2002-12-11 18:05:16.000000000 -0500 -+++ output.c 2020-05-25 22:27:07.601022000 -0400 -@@ -44,8 +44,8 @@ - static TokenType olast = HEAD; - --static Token nlToken = {BLANK, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; --static Token startToken = {START, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; --static Token contToken = {CONT, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; --static Token spToken = {SP, CNSTWORD, 0, " ", 1, (Token *) 0, (Token *) 0}; -+static Token nlToken = {.type = BLANK, .ckind = CNSTWORD}; -+static Token startToken = {.type = START, .ckind = CNSTWORD}; -+static Token contToken = {.type = CONT, .ckind = CNSTWORD}; -+static Token spToken = {.type = SP, .ckind = CNSTWORD, .text = " ", .length = 1}; - - void initOutput(void) -@@ -227,5 +227,5 @@ - } - --static void printkn(char *txt, int length, int keepnl) -+static void printkn(const char *txt, int length, int keepnl) - { - char *cp; -@@ -252,5 +252,5 @@ - } - --static void printn(char *txt, int len) -+static void printn(const char *txt, int len) - { - if (!testonly) -@@ -260,10 +260,10 @@ - } - --static void print(char *txt) -+static void print(const char *txt) - { - printn(txt, strlen(txt)); - } - --static void brace(char *t) -+static void brace(const char *t) - { - char *cp, *bp; -@@ -378,8 +378,8 @@ - } - --static Token dollarToken = {DOLLAR, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; --static Token endlineToken = {ENDLINE, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; --static Token lbrackToken = {LBRACK, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; --static Token rbrackToken = {RBRACK, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; -+static Token dollarToken = {.type = DOLLAR, .ckind = CNSTWORD}; -+static Token endlineToken = {.type = ENDLINE, .ckind = CNSTWORD}; -+static Token lbrackToken = {.type = LBRACK, .ckind = CNSTWORD}; -+static Token rbrackToken = {.type = RBRACK, .ckind = CNSTWORD}; - - void output(Token *token, int compress) ---- tcl.c 2004-01-22 08:25:48.000000000 -0500 -+++ tcl.c 2020-05-26 00:46:39.040977000 -0400 -@@ -27,48 +27,40 @@ - static int inproc = 0; - --static Token lbraceToken = {LBRACE, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; --static Token rbraceToken = {RBRACE, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; --static Token xcontToken = {XCONT, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; --static Token ostartToken = {OSTART, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; --static Token startToken = {START, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; --static Token contToken = {CONT, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; --static Token econtToken = {ECONT, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; --static Token emToken = {EM, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; --static Token nospToken = {NOSP, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; -+static Token lbraceToken = {.type = LBRACE, .ckind = CNSTWORD}; -+static Token rbraceToken = {.type = RBRACE, .ckind = CNSTWORD}; -+static Token xcontToken = {.type = XCONT, .ckind = CNSTWORD}; -+static Token ostartToken = {.type = OSTART, .ckind = CNSTWORD}; -+static Token startToken = {.type = START, .ckind = CNSTWORD}; -+static Token contToken = {.type = CONT, .ckind = CNSTWORD}; -+static Token econtToken = {.type = ECONT, .ckind = CNSTWORD}; -+static Token emToken = {.type = EM, .ckind = CNSTWORD}; -+static Token nospToken = {.type = NOSP, .ckind = CNSTWORD}; - static Token *olsToken = &emToken; --static Token spToken = {SP, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; --static Token lbrackToken = {LBRACK, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; --static Token rbrackToken = {RBRACK, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; --static Token msgcatToken = {CONST, CNSTWORD, 0, "::msgcat::mc", 12, (Token *) 0, (Token *) 0}; -- --static Token dqStart = {DQSTART, CNSTWORD, 0, (char *) 0, 0, noToken, noToken}; --static Token dqEnd = {DQEND, CNSTWORD, 0, (char *) 0, 0, noToken, noToken}; --static Token thenToken = {CONST, CNSTWORD, 0, "then", 4, noToken, noToken}; --static Token procToken = {CONST, CNSTWORD, 0, "proc", 4, noToken, noToken}; --static Token elseToken = {CONST, CNSTWORD, 0, "else", 4, noToken, noToken}; --static Token elseifToken = {CONST, CNSTWORD, 0, "elseif", 6, noToken, noToken}; --static Token methodToken = {CONST, CNSTWORD, 0, "method", 6, noToken, noToken}; --static Token semiToken = {SEMI, CNSTWORD, 0, ";", 1, noToken, noToken}; --static Token argsToken = {SEMI, CNSTWORD, 0, "args", 4, noToken, noToken}; --static Token argvToken = {SEMI, CNSTWORD, 0, "argv", 4, noToken, noToken}; --static Token argv0Token = {SEMI, CNSTWORD, 0, "argv0", 5, noToken, noToken}; --static Token platfToken = {SEMI, CNSTWORD, 0, "tcl_platform", 12, noToken, noToken}; -+static Token spToken = {.type = SP, .ckind = CNSTWORD}; -+static Token lbrackToken = {.type = LBRACK, .ckind = CNSTWORD}; -+static Token rbrackToken = {.type = RBRACK, .ckind = CNSTWORD}; -+static Token msgcatToken = {.type = CONST, .ckind = CNSTWORD, .text = "::msgcat::mc", .length = 12}; -+ -+static Token dqStart = {.type = DQSTART, .ckind = CNSTWORD}; -+static Token dqEnd = {.type = DQEND, .ckind = CNSTWORD}; -+static Token thenToken = {.type = CONST, .ckind = CNSTWORD, .text = "then", .length = 4}; -+static Token procToken = {.type = CONST, .ckind = CNSTWORD, .text = "proc", .length = 4}; -+static Token elseToken = {.type = CONST, .ckind = CNSTWORD, .text = "else", .length = 4}; -+static Token elseifToken = {.type = CONST, .ckind = CNSTWORD, .text = "elseif", .length = 6}; -+static Token methodToken = {.type = CONST, .ckind = CNSTWORD, .text = "method", .length = 6}; -+static Token semiToken = {.type = SEMI, .ckind = CNSTWORD, .text = ";", .length = 1}; -+static Token argsToken = {.type = SEMI, .ckind = CNSTWORD, .text = "args", .length = 4}; -+static Token argvToken = {.type = SEMI, .ckind = CNSTWORD, .text = "argv", .length = 4}; -+static Token argv0Token = {.type = SEMI, .ckind = CNSTWORD, .text = "argv0", .length = 5}; -+static Token platfToken = {.type = SEMI, .ckind = CNSTWORD, .text = "tcl_platform", .length = 12}; - - List *blocks = noList; - --static CheckIt **noChecks = (CheckIt **) 0; -- --extern void setIndent(void); --extern void outdent(void); --extern int isVarToken(Token *); --extern int isSwitch(Token *); --extern int isSingleCall(Token *, char *); --extern int tokEqual(Token *, char *); -- - /* - * If there are no more tokens, print a useful message to the user and - * exit. - */ --void failIfNullToken(Token *token, char *part, char *command, int ln) -+static void failIfNullToken(const Token *token, const char *part, -+ const char *command, int ln) - { - char msg[1024]; -@@ -78,9 +70,9 @@ - if (ln == 0) - { -- sprintf(msg, "Missing \"%s\" part in call of %s", part, command); -+ snprintf(msg, sizeof msg, "Missing \"%s\" part in call of %s", part, command); - } - else - { -- sprintf(msg, "Missing \"%s\" part in call of %s, starting line %d", -+ snprintf(msg, sizeof msg, "Missing \"%s\" part in call of %s, starting line %d", - part, command, ln); - } -@@ -93,5 +85,6 @@ - * the user. - */ --void warnIfArgsAfter(Token *token, char *part, char *command) -+static void warnIfArgsAfter(const Token *token, const char *part, -+ const char *command) - { - char msg[1024]; -@@ -107,10 +100,10 @@ - if (*part != '\0') - { -- sprintf(msg, "Extra arguments after \"%s\" part in call of %s", -+ snprintf(msg, sizeof msg, "Extra arguments after \"%s\" part in call of %s", - part, command); - } - else - { -- sprintf(msg, "Extra arguments in call of `%s'", command); -+ snprintf(msg, sizeof msg, "Extra arguments in call of `%s'", command); - } - warn(token, msg); -@@ -118,5 +111,5 @@ - token->next->text[0] != '\0') - { -- sprintf(msg, "Extra token is `%s'", token->next->text); -+ snprintf(msg, sizeof msg, "Extra token is `%s'", token->next->text); - warn(token->next, msg); - } -@@ -125,5 +118,5 @@ - } - --void warnExpr(Token *cmd, char *txt) -+static void warnExpr(const Token *cmd, const char *txt) - { - if (doTest(HEXPR) && cmd != noToken && cmd->type != LIST) -@@ -133,19 +126,12 @@ - } - --void warnFor(Token *token, char *cmd, char *txt) -+void warnFor(const Token *token, const char *cmd, const char *txt) - { - char msg[1024]; - -- sprintf(msg, txt, cmd); -+ snprintf(msg, sizeof msg, txt, cmd); - warn(token, msg); - } - --static void warnIFor(Token *token, int val, char *txt) --{ -- char msg[1024]; -- -- sprintf(msg, txt, val); -- warn(token, msg); --} - /* - * reset various variables so that multiple file processing doesn't get -@@ -171,5 +157,5 @@ - } - --static int isNumber(char *cp) -+static int isNumber(const char *cp) - { - if (*cp == '-' || *cp == '+') -@@ -188,7 +174,7 @@ - } - --static int tokIsLevel(Token *tp) -+static int tokIsLevel(const Token *tp) - { -- char *cp; -+ const char *cp; - if (tp == noToken || !(tp->type == CONST || tp->type == LIST) || tp->text == (char *) 0) - { -@@ -208,5 +194,5 @@ - } - --static int oneLine(Token *seq, int semis) -+static int oneLine(const Token *seq, int semis) - { - while (seq != noToken) -@@ -222,5 +208,5 @@ - } - --static int checkSpecial(char *val) -+static int checkSpecial(const char *val) - { - char ch; -@@ -239,15 +225,15 @@ - } - --static void checkUnquoted(Token *str) -+static void checkUnquoted(const Token *str) - { - char msg[128]; - if (noquotes && str->type == CONST && str->ckind == CNSTWORD && !isNumber(str->text)) - { -- sprintf(msg, "Unquoted constant - \"%s\"", str->text); -+ snprintf(msg, sizeof msg, "Unquoted constant - \"%s\"", str->text); - warn(str, msg); - } - } - --static void checkType(Token *cmd, int flags) -+static void checkType(const Token *cmd, int flags) - { - if (cmd->type == CONST) -@@ -267,5 +253,5 @@ - } - --static int single(Token * tp) -+static int single(const Token * tp) - { - if (tp != noToken && tp->next == noToken) -@@ -286,5 +272,5 @@ - } - --static int sconstant(Token *tp) -+static int sconstant(const Token *tp) - { - return (tp != noToken && tp->next == noToken -@@ -292,5 +278,5 @@ - } - --static int constantString(Token * tp, int any) -+static int constantString(const Token * tp, int any) - { - Token *sq; -@@ -313,10 +299,10 @@ - } - --void loopstart(int inf, int cond) -+static void loopstart(int inf, int cond) - { - pushBlock(noToken, inf, -1, cond); - } - --void loopend(void) -+static void loopend(void) - { - Blox *bp = lpeek(blocks); -@@ -330,5 +316,5 @@ - } - --static void msgsave(Token *tp, int any) -+static void msgsave(const Token *tp, int any) - { - char filename[128]; -@@ -363,8 +349,9 @@ - } - --void sptclop(Token *hd) -+static void doUser(Token *hd, Token *cmd, const ConfigData *cpt, int nostart); -+ -+static void sptclop(Token *hd) - { - List *cpt = config; -- extern void doUser(Token *hd, Token *cmd, ConfigData *cpt, int nostart); - ConfigData *cdp; - -@@ -529,5 +516,5 @@ - } PressFlags; - --static void press(Token *v , PressFlags flags, CheckIt **checkp) -+static void press(Token *v , PressFlags flags) - { - Input *idx; -@@ -602,5 +589,5 @@ - { - case SEMI : -- if (flags && SEMIS) -+ if (flags & SEMIS) - { - output(&semiToken, 1); -@@ -641,5 +628,5 @@ - } - --void etcetera(Token *cmd, int v) -+static void etcetera(Token *cmd, int v) - { - while (cmd != noToken) -@@ -650,5 +637,5 @@ - } - --void catbin(Token *tp) -+static void catbin(Token *tp) - { - int sem, oln; -@@ -693,5 +680,6 @@ - VarData *vp = (VarData *) 0; - char msg[1024]; -- Token *ap = noToken, *ac; -+ Token *ap = noToken; -+ const Token *ac; - int array = 0; - -@@ -829,5 +817,5 @@ - } - --Token *doswitch(Token *cmd, Token *leadin) -+static Token *doswitch(Token *cmd, Token *leadin) - { - Token *tp, *bod; -@@ -952,5 +940,5 @@ - } - --Token *doif(Token *cmd, Token *leadin) -+static Token *doif(Token *cmd, Token *leadin) - { - Token *tp, *then; -@@ -964,5 +952,5 @@ - cfl |= SPACEOUT; - } -- press(cmd, cfl, noChecks); -+ press(cmd, cfl); - if (putThen) { output(&thenToken, 0); } - then = cmd->next; -@@ -980,5 +968,5 @@ - failIfNullToken(tp, "condition", "elseif", ln); - warnExpr(tp, "elseif condition not braced."); -- press(tp, efl | PAREN, noChecks); -+ press(tp, efl | PAREN); - tp = tp->next; - failIfNullToken(tp, "body", "elseif", ln); -@@ -1020,7 +1008,7 @@ - - --int isNSName(Token *cmd) -+static int isNSName(const Token *cmd) - { -- char *cp; -+ const char *cp; - int cols = 0; - -@@ -1054,5 +1042,5 @@ - } - --static Token *doProc(Token *tag, Token *cmd, Token *leadin, int checkNS) -+static Token *doProc(Token *tag, Token *cmd, Token *leadin) - { - int ln = leadin->lineNo, inns; -@@ -1177,13 +1165,13 @@ - static Token *doproc(Token *cmd, Token *leadin) - { -- return doProc(&procToken, cmd, leadin, 1); -+ return doProc(&procToken, cmd, leadin); - } - - static Token *domethod(Token *cmd, Token *leadin) - { -- return doProc(&methodToken, cmd, leadin, 0); -+ return doProc(&methodToken, cmd, leadin); - } - --static Token *dodestructor(Token *cmd, Token *leadin) -+static Token *dodestructor(Token *cmd, Token *leadin __attribute__((__unused__))) - { - if (!nest[0]) -@@ -1200,5 +1188,5 @@ - } - --Token *doconstructor(Token *cmd, Token *leadin) -+static Token *doconstructor(Token *cmd, Token *leadin __attribute__((__unused__))) - { - if (!nest[0]) -@@ -1209,5 +1197,5 @@ - { - failIfNullToken(cmd, "args", "constructor", 0); -- press(cmd, NOBRACE | ADDBRACES, noChecks); -+ press(cmd, NOBRACE | ADDBRACES); - cmd = cmd->next; - failIfNullToken(cmd, "body", "constructor", 0); -@@ -1218,5 +1206,5 @@ - } - --Token *doreturn(Token *cmd, Token *leadin) -+static Token *doreturn(Token *cmd, Token *leadin) - { - Blox *pr = (Blox *) lpeek(blocks); -@@ -1267,5 +1255,5 @@ - } - --Token *doregexp(Token *cmd, Token *leadin) -+static Token *doregexp(Token *cmd, Token *leadin) - { - int eopt = 0; -@@ -1312,5 +1300,5 @@ - } - --Token *doregsub(Token *cmd, Token *leadin) -+static Token *doregsub(Token *cmd, Token *leadin) - { - int eopt = 0; -@@ -1361,5 +1349,5 @@ - } - --Token *dobind(Token *cmd, Token *leadin) -+static Token *dobind(Token *cmd, Token *leadin __attribute__((__unused__))) - { - Token *np; -@@ -1387,5 +1375,5 @@ - } - --Token *doitcl_class(Token *cmd, Token *leadin) -+static Token *doitcl_class(Token *cmd, Token *leadin __attribute__((__unused__))) - { - failIfNullToken(cmd, "className", "itcl_class", 0); -@@ -1400,5 +1388,5 @@ - } - --Token *docvar(Token *cmd, Token *prt) -+static Token *docvar(Token *cmd, Token *prt) - { - if (!nest[0]) -@@ -1412,5 +1400,5 @@ - if ((cmd = cmd->next) != noToken) - { -- press(cmd, NOBRACE | ADDBRACES, noChecks); -+ press(cmd, NOBRACE | ADDBRACES); - warnIfArgsAfter(cmd, "init", prt->text); - } -@@ -1419,5 +1407,5 @@ - } - --Token *dopublic(Token *cmd, Token *leadin) -+static Token *dopublic(Token *cmd, Token *leadin __attribute__((__unused__))) - { - if (!nest[0]) -@@ -1431,5 +1419,5 @@ - if ((cmd = cmd->next) != noToken) - { -- press(cmd, NOBRACE | ADDBRACES, noChecks); -+ press(cmd, NOBRACE | ADDBRACES); - if ((cmd = cmd->next) != noToken) - { -@@ -1442,9 +1430,9 @@ - } - --Token *doprotected(Token *cmd, Token *leadin) { return docvar(cmd, leadin); } -+static Token *doprotected(Token *cmd, Token *leadin) { return docvar(cmd, leadin); } - --Token *docommon(Token *cmd, Token *leadin) { return docvar(cmd, leadin); } -+static Token *docommon(Token *cmd, Token *leadin) { return docvar(cmd, leadin); } - --static void checkVar(Token *cmd, char *nm) -+static void checkVar(Token *cmd, const char *nm) - { - List *bp = blocks; -@@ -1525,5 +1513,5 @@ - } - --Token *doforeach(Token *cmd, Token *leadin) -+static Token *doforeach(Token *cmd, Token *leadin __attribute__((__unused__))) - { - failIfNullToken(cmd, "varName", "foreach", 0); -@@ -1535,5 +1523,5 @@ - cmd = cmd->next; - failIfNullToken(cmd, "list", "foreach", 0); -- press(cmd, NOBRACE, noChecks); -+ press(cmd, NOBRACE); - cmd = cmd->next; - } -@@ -1547,5 +1535,5 @@ - } - --Token *doloop(Token *cmd, Token *leadin) -+static Token *doloop(Token *cmd, Token *leadin __attribute__((__unused__))) - { - Token *tp; -@@ -1557,13 +1545,13 @@ - { - failIfNullToken(cmd, "var", "loop", 0); -- press(cmd, NOBRACE | ADDBRACES, noChecks); /* var */ -+ press(cmd, NOBRACE | ADDBRACES); /* var */ - tp = cmd->next; - failIfNullToken(tp, "first", "loop", 0); - warnExpr(cmd, "Unbracketed loop \"first\""); -- press(tp, ADDBRACES, noChecks); /* first */ -+ press(tp, ADDBRACES); /* first */ - tp = tp->next; - failIfNullToken(tp, "limit", "loop", 0); - warnExpr(cmd, "Unbracketed loop \"limit\""); -- press(tp, ADDBRACES, noChecks); /* limit */ -+ press(tp, ADDBRACES); /* limit */ - - tp = tp->next; -@@ -1573,5 +1561,5 @@ - { - warnExpr(cmd, "Unbracketed loop \"incr\""); -- press(tp, NOBRACE | ADDBRACES, noChecks); /* incr */ -+ press(tp, NOBRACE | ADDBRACES); /* incr */ - tp = tp->next; - } -@@ -1585,5 +1573,5 @@ - } - --Token *doexpr(Token *cmd, Token *leadin) -+static Token *doexpr(Token *cmd, Token *leadin __attribute__((__unused__))) - { - if (!doExpr) -@@ -1600,5 +1588,5 @@ - { - warnExpr(cmd, "expr body not braced."); -- press(cmd, ADDBRACES | PAREN, noChecks); /* */ -+ press(cmd, ADDBRACES | PAREN); /* */ - } - else -@@ -1611,5 +1599,5 @@ - } - --Token *dounset(Token *cmd, Token *leadin) -+static Token *dounset(Token *cmd, Token *leadin) - { - int pCount = 1; -@@ -1642,5 +1630,5 @@ - } - --Token *doupvar(Token *cmd, Token *leadin) -+static Token *doupvar(Token *cmd, Token *leadin) - { - int paramCount = 0; -@@ -1673,5 +1661,5 @@ - } - --Token *dovariable(Token *cmd, Token *leadin) -+static Token *dovariable(Token *cmd, Token *leadin) - { - int paramCount = 1; -@@ -1777,5 +1765,5 @@ - } - --void doBasic(ConfigData *cpt, Token *hd, Token *cmd) -+static void doBasic(const ConfigData *cpt, Token *hd, Token *cmd) - { - List *sp, *llp, *lp; -@@ -1851,5 +1839,5 @@ - else - { -- press(cmd, NOBRACE | ADDBRACES | SEMIS, noChecks); /* */ -+ press(cmd, NOBRACE | ADDBRACES | SEMIS); /* */ - } - break; -@@ -1863,5 +1851,5 @@ - { - warnExpr(cmd, "Unbracketed expression"); -- press(cmd, ptpar, noChecks); /* */ -+ press(cmd, ptpar); /* */ - } - break; -@@ -1884,5 +1872,5 @@ - ptpar |= SPACEOUT; - } -- press(cmd, ptpar, noChecks); -+ press(cmd, ptpar); - loopstart(infloop, 1); - } -@@ -2141,5 +2129,6 @@ - } - --void doUser(Token *hd, Token *cmd, ConfigData *cpt, int nostart) -+static void doUser(Token *hd, Token *cmd, -+ const ConfigData *cpt, int nostart) - { - if (isUnreachable()) ---- token.c 2004-01-22 08:58:48.000000000 -0500 -+++ token.c 2020-05-26 00:51:36.179835000 -0400 -@@ -32,6 +32,4 @@ - #endif - --extern char *currentfile; -- - typedef struct tbuff_s - { -@@ -78,5 +76,5 @@ - } - --static void catTB(TBuff *tp, char *str) -+static void catTB(TBuff *tp, const char *str) - { - while (*str) -@@ -87,5 +85,5 @@ - } - --static char *tokenName[] = -+static const char *tokenName[] = - { - "ENDF", -@@ -137,5 +135,5 @@ - static Token *varToken(Input *); - --Token *newToken(TokenType t) -+static Token *newToken(TokenType t) - { - Token *tp = malloc(sizeof(Token)); -@@ -150,7 +148,7 @@ - } - --void dumpToken(Token *tk, FILE *ops) -+void dumpToken(const Token *tk, FILE *ops) - { -- static char *cval [] = -+ static const char *cval [] = - { - "word", "string", "list" -@@ -195,5 +193,5 @@ - } - --void fail(Token *tp, char *msg) -+void fail(const Token *tp, const char *msg) - { - if (!compout) -@@ -325,5 +323,5 @@ - } - --void warn(Token *tp, char *msg) -+void warn(const Token *tp, const char *msg) - { - Blox *blp = (Blox *) lpeek(blocks); -@@ -334,5 +332,5 @@ - fprintf(stderr, "***"); - } -- if (currentfile != (char *) 0) -+ if (currentfile != NULL) - { - fprintf(stderr, " %s", currentfile); -@@ -377,5 +375,5 @@ - } - --static void bwarn(int ln, char *msg) -+static void bwarn(int ln, const char *msg) - { - Token *tp = newToken(SP); -@@ -391,5 +389,5 @@ - if (file->stream != NULL) - { -- file->remaining = fread(file->text, 1, 64*1024, file->stream); -+ file->remaining = fread(file->atext, 1, 64*1024, file->stream); - } - } -@@ -400,5 +398,5 @@ - } - --static char *skipblank(char *cp) -+static const char *skipblank(const char *cp) - { - while (isBlank(*cp)) -@@ -497,7 +495,7 @@ - if (tp != noToken) - { -- if (tp->text != (char *) 0 && tp->text != tp->little) -+ if (tp->atext != tp->little) - { -- free(tp->text); -+ free(tp->atext); - } - if (tp->sequence) freeToken(tp->sequence); -@@ -507,5 +505,5 @@ - } - --static char *filterString(Token *tp, char *txt) -+static char *filterString(Token *tp, const char *txt) - { - char *cp = malloc(strlen(txt) + 1), *pt; -@@ -556,23 +554,7 @@ - } - --Input *ftokenise(char *txt, int length, int lineNo, int expr) --{ -- Token *tmp = newToken(CONST); /* gash token for filterstring */ -- Input *file = (Input *) malloc(sizeof(Input)); -- file->remaining = length; -- file->pushed = 0; -- file->stream = NULL; -- file->position = file->text = filterString(tmp, txt); -- file->tcall = 0; -- file->texpr = expr; -- file->lineNumber = lineNo; -- file->lineStart = 1; -- freeToken(tmp); -- return file; --} -- - void untokenise(Input *file) - { -- free(file->text); -+ free(file->atext); - free(file); - } -@@ -607,9 +589,9 @@ - } - --static Token *createToken(TokenType t, char *text, Token *nxt) -+static Token *createToken(TokenType t, const char *text, size_t len, Token *nxt) - { - Token *tp = newToken(t); - -- if ((tp->length = strlen(text)) < (sizeof(tp->little) - 1)) -+ if ((tp->length = len) < (sizeof(tp->little) - 1)) - { - tp->text = strcpy(tp->little, text); -@@ -617,5 +599,5 @@ - else - { -- tp->text = newString(text); -+ tp->text = strndup(text, len); - } - tp->next = nxt; -@@ -720,5 +702,5 @@ - static Token *handleSemi(Input*, char); - --Token *stringToken(Input *file, char lst, TokenType res, int term) -+static Token *stringToken(Input *file, char lst, TokenType res, int term) - { - int bufSize = 16*1024; -@@ -837,5 +819,5 @@ - - --int tokEqual(Token *tp, char *val) -+int tokEqual(const Token *tp, const char *val) - { - if (tp != noToken) -@@ -845,5 +827,5 @@ - case CONST: - case LIST : -- return (tp->text != (char *) 0 && strcmp(tp->text, val) == 0); -+ return (tp->text != NULL && strcmp(tp->text, val) == 0); - default: - break; -@@ -853,5 +835,5 @@ - } - --int tokNEqual(Token *tp, char *val, int n) -+static int tokNEqual(const Token *tp, const char *val, int n) - { - if (tp != noToken) -@@ -871,5 +853,5 @@ - static int isPragma(TBuff *tp) - { -- char *cp; -+ const char *cp; - - cp = skipblank(tp->buff + 1); /* start after # character */ -@@ -1252,5 +1234,5 @@ - static struct pragma_s - { -- char *text; -+ const char *text; - enum Pragmas value; - int nextmode; -@@ -1264,9 +1246,9 @@ - { "unused", 0, 3}, - { "array", 0, 4}, -- { (char *) 0, 0, 1}, -+ { NULL, 0, 1}, - }; - struct pragma_s *prp; - int label, mode = 1; -- char *cp; -+ const char *cp; - Token *token, *chars = newToken(CONST); - Input *pfile; -@@ -1348,7 +1330,4 @@ - Token *hd; - -- extern int tclop(Token*, Token*); -- extern void comment(Token *); -- - if (line == noToken) - { -@@ -1576,5 +1555,5 @@ - } - --Token *accumulate(Input *file, int nl) -+static Token *accumulate(Input *file, int nl) - { - Token *line = noToken, *hd = noToken; -@@ -1653,5 +1632,5 @@ - } - --static int chkVarToken(Token *token) -+static int chkVarToken(const Token *token) - { - return (token != noToken && -@@ -1660,7 +1639,7 @@ - } - --int isVarToken(Token *token) -+int isVarToken(const Token *token) - { -- char *cp; -+ const char *cp; - TBuff *tb; - -@@ -1695,5 +1674,5 @@ - } - --int isSingleCall(Token *token, char *proc) -+int isSingleCall(const Token *token, const char *proc) - { - if (token != noToken) -@@ -1716,5 +1695,5 @@ - } - --int isSwitch(Token *token) -+int isSwitch(const Token *token) - { - if (token != noToken) -@@ -1740,12 +1719,13 @@ - } - --Token *isArray(Token *tp) -+Token *isArray(const Token *tp) - { - Token *res = noToken; - TBuff *tbp = (TBuff *) 0; -- char *txt, *cp, ch; -+ const char *txt, *cp; -+ char ch; - int len; - -- if (tp != noToken && (tp->text != (char *) 0 || tp->type == CONC)) -+ if (tp != noToken && (tp->text != NULL || tp->type == CONC)) - { - switch (tp->type) -@@ -1777,7 +1757,5 @@ - if (ch == '(') - { -- *cp = '\0'; -- res = createToken(CONST, txt, noToken); -- *cp = '('; -+ res = createToken(CONST, txt, cp - txt, noToken); - break; - } -@@ -1791,5 +1769,5 @@ - } - --int constant(Token *tp) -+int constant(const Token *tp) - { - return (tp != noToken && (tp->type == CONST || tp->type == LIST)); ---- token.h 2002-12-11 17:20:34.000000000 -0500 -+++ token.h 2020-05-26 00:51:20.737970000 -0400 -@@ -19,9 +19,12 @@ - typedef struct input_s - { -- char *position; -+ const char *position; - int remaining; - int pushed; - char back[16]; -- char *text; -+ union { -+ const char *text; /* Use const in most cases */ -+ char *atext; -+ }; - FILE *stream; - int tcall; -@@ -49,6 +52,9 @@ - ConstType ckind; - int isconc; -- char *text; -- int length; -+ union { -+ const char *text; -+ char *atext; -+ }; -+ size_t length; - struct token_s *sequence; - struct token_s *next; -@@ -70,11 +76,20 @@ - extern void makeCall(Token*, Token*); - extern void body(Token *, int, int); -+extern void comment(Token *); - - extern void output(Token *, int); - extern void blank(void); --extern void warn(Token *, char *); --extern void fail(Token *, char *); -+extern void warn(const Token *, const char *); -+extern void fail(const Token *, const char *); -+ -+extern Token *isArray(const Token *); -+extern int constant(const Token *tp); -+extern int tclop(Token *hd, Token *line); -+extern void streamMore(Input *file); -+extern int handle(Token *line); -+extern void sprocess(Token *lst, int nls); -+extern void dumpToken(const Token *tk, FILE *ops); -+extern Token *tokenPop(Token **); -+extern void freeToken(Token *); - --extern Token *isArray(Token *); --extern int constant(Token *tp); - #endif ---- vars.c 2004-01-22 08:31:04.000000000 -0500 -+++ vars.c 2020-05-26 00:47:20.615067000 -0400 -@@ -33,9 +33,7 @@ - #endif - --extern void warnFor(Token*, char*, char*); -- - void checkName(Token *cmd, int dynm) - { -- static char *badNames[] = -+ static const char *badNames[] = - { - ".", -@@ -159,5 +157,6 @@ - (char *) 0 - }; -- char **bnp = badNames, msgb[256]; -+ const char **bnp = badNames; -+ char msgb[256]; - - if (cmd != noToken) -@@ -199,5 +198,5 @@ - } - --static VarData *newVar(char *name, enum VarType type) -+static VarData *newVar(const char *name, enum VarType type) - { - VarData *blp = (VarData *) malloc(sizeof(VarData)); -@@ -212,5 +211,5 @@ - } - --static VarData *addVar(char *name, enum VarType type, int array) -+static VarData *addVar(const char *name, enum VarType type, int array) - { - VarData *vp = newVar(name, type); -@@ -221,5 +220,5 @@ - } - --VarData *varKnown(char *name) -+VarData *varKnown(const char *name) - { - List *blp = blocks; -@@ -246,5 +245,5 @@ - } - --VarData *declareVar(Token *nm, enum VarType type, int array) -+VarData *declareVar(const Token *nm, enum VarType type, int array) - { - VarData *vp = varKnown(nm->text); -@@ -269,5 +268,5 @@ - } - --VarData *useVar(Token *nm, enum VarType type, int array) -+VarData *useVar(const Token *nm, enum VarType type, int array) - { - VarData *vp; -@@ -299,5 +298,5 @@ - } - --VarData *setVar(Token *nm, enum VarType type, int array) -+VarData *setVar(const Token *nm, enum VarType type, int array) - { - VarData *vp; ---- vars.h 2020-05-16 20:19:34.598633000 -0400 -+++ vars.h 2020-05-25 23:56:08.143689000 -0400 -@@ -12,5 +12,5 @@ - */ - --#ifndef FRINK_VARS_h -+#ifndef FRINK_VARS_H - #define FRINK_VARS_H - -@@ -47,8 +47,8 @@ - - extern void checkName(Token *, int); --extern VarData *varKnown(char *); --extern VarData *declareVar(Token *, enum VarType, int); --extern VarData *useVar(Token *, enum VarType, int); --extern VarData *setVar(Token *, enum VarType, int); -+extern VarData *varKnown(const char *); -+extern VarData *declareVar(const Token *, enum VarType, int); -+extern VarData *useVar(const Token *, enum VarType, int); -+extern VarData *setVar(const Token *, enum VarType, int); - - #endif |