ick_overop accessors;/* how to get and set this lvalue, or {0,0} */
unsigned long value; /* current value of the var or expression */
};
-extern void ick_registercreation(char*,unsigned long);
-extern unsigned long ick_jicmatch(char*);
+extern void ick_registercreation(const char*,unsigned long);
+extern unsigned long ick_jicmatch(const char*);
/* AIS: Multithreading types and defines */
#if MULTITHREAD != 0
{
register int i, j;
static int helpflag = -1;
- static char *flags[] = {
+ static const char *flags[] = {
"help",
"wimpmode",
"traditional",
&ick_printflow, /* AIS */
&ick_mystery, /* AIS */
};
- static int nflags = (int)(sizeof(flags)/sizeof(flags[0]));
+ static const int nflags = (int)(sizeof(flags)/sizeof(flags[0]));
for(i = 1;i < argc;i++) {
if(argv[i][0] != '+' && argv[i][0] != '-') {
for(n=0,cp = strtok(buf, " ");cp;cp = strtok((char *)NULL, " "),n++)
{
int digit = -1;
- numeral *np;
+ const numeral *np;
for (np = ick_numerals; np < ick_numerals + sizeof(ick_numerals)/sizeof(numeral); np++)
if (strcmp(np->name, cp) == 0)
char res[MAXROMANS], ovb[MAXROMANS];
/* We need FOUR columns because of the odd way that M and I interact. */
- static char br_equiv[MAXDIGITS][4] =
+ static const char br_equiv[MAXDIGITS][4] =
{
{'I', 'I', 'V', 'X'}, {'X', 'X', 'L', 'C'},
{'C', 'C', 'D', 'M'}, {'M', 'I', 'V', 'X'},
{'c', 'c', 'd', 'm'}, {'m', 'i', 'v', 'x'},
};
- static char br_overbar[MAXDIGITS][4] =
+ static const char br_overbar[MAXDIGITS][4] =
{
{' ', ' ', ' ', ' '},
{' ', ' ', ' ', ' '},
struct ick_jictype
{
- /*@observer@*/ char* sig; /* a shallow copy of a constant string */
+ /*@observer@*/ const char* sig; /* a shallow copy of a constant string */
unsigned long target;
/*@null@*/ /*@only@*/ struct ick_jictype* next;
};
/* Return a jic entry that matches the requested signature exactly,
creating one if there isn't one yet. */
-static struct ick_jictype* jicextract(/*@observer@*/ char* sig)
+static struct ick_jictype* jicextract(/*@observer@*/ const char* sig)
{
struct ick_jictype* jicptr = jiclist;
while(jicptr)
return jicptr;
}
-void ick_registercreation(char* sig, unsigned long target)
+void ick_registercreation(const char* sig, unsigned long target)
{
jicextract(sig)->target=target;
}
-unsigned long ick_jicmatch(char* sig)
+unsigned long ick_jicmatch(const char* sig)
{
return jicextract(sig)->target;
}
/* This function by AIS. Compares expressions. In C++, I'd call this
node::operator== . */
-ick_bool nodessame(node* n1, node* n2)
+ick_bool nodessame(const node* n1, const node* n2)
{
if(!n1) return !n2;
if(!n2) return 0;
}
/* AIS: Checks if an abstention could affect a tuple. */
-int abstainmatch(int npconstant, int tptype)
+static int abstainmatch(int npconstant, int tptype)
{
if(npconstant == tptype) return 1;
if(npconstant == ABSTAIN)
**************************************************************************/
extern int optimize_pass1(node *np); /* Read from idiotism.c */
-static void checkforintercaloperators(node *np);
-static void checkW534(node *np);
+static void checkforintercaloperators(const node *np);
+static void checkW534(const node *np);
node* optdebugnode;
}
/* By AIS. This checks W534. */
-static void checkW534(node *np)
+static void checkW534(const node *np)
{
if(!np) return;
if(np->opcode == AND || np->opcode == OR || np->opcode == XOR)
}
/* By AIS. This checks W018. */
-static void checkforintercaloperators(node *np)
+static void checkforintercaloperators(const node *np)
{
if(!np) return;
switch(np->opcode)
extern void typecast(node *np);
extern void codecheck(void);
extern void optimize(node *np);
-/*@observer@*/ extern char *nameof(int value, assoc table[]);
+/*@observer@*/ extern const char *nameof(int value, const assoc table[]);
extern void emit(tuple *tn, FILE *fp);
extern void emittextlines(FILE *fp);
extern void emitslatproto(FILE *fp); /* AIS: emit prototypes for /-functions */
extern void explexpr(node* np, FILE* fp); /* AIS */
extern void prexpr(node *np, FILE* fp, int freenode); /* AIS: destaticed */
extern void checknodeactbits(node *np); /* AIS */
-extern void optimizef(); /* AIS */
+extern void optimizef(void); /* AIS */
extern void nodefree(/*@keep@*/ /*@null@*/ node* np); /* AIS */
extern unsigned long varextern(unsigned long intern, int vartype); /* AIS */
extern node *nodecopy(node*); /* AIS */
-extern ick_bool nodessame(node*, node*); /* AIS */
+extern ick_bool nodessame(const node*, const node*); /* AIS */
extern node *optdebugnode; /* AIS */
-extern char **enablers; /* AIS: so that there can be an element before the
- ick_first element of the ick_array (UNKNOWN is element
- -1, just to cause a bit more confusion) */
-extern assoc vartypes[];
+extern const char **enablers; /* AIS: so that there can be an element before the
+ ick_first element of the ick_array (UNKNOWN is element
+ -1, just to cause a bit more confusion) */
+extern const assoc vartypes[];
extern int useprintflow; /* AIS */
* If the order of statement-token defines in parser.y ever changes,
* this will need to be reordered.
*/
-char *enablersm1[MAXTYPES+1] =
+const char *enablersm1[MAXTYPES+1] =
{
"UNKNOWN", /* AIS: so comments can be ABSTAINED/REINSTATED */
"GETS",
"COMPUCREATE", /* AIS */
"FROM", /* AIS: ABSTAIN expr FROM LABEL */
};
-char** enablers = enablersm1+1;
+const char** enablers = enablersm1+1;
-assoc vartypes[] =
+const assoc vartypes[] =
{
{ ick_ONESPOT, "ick_ONESPOT" },
{ ick_TWOSPOT, "ick_TWOSPOT" },
{ ick_TAIL, "ick_TAIL" },
{ ick_HYBRID, "ick_HYBRID" },
- { 0, (char *)NULL }
+ { 0, (const char *)NULL }
};
-static assoc forgetbits[] =
+static const assoc forgetbits[] =
{
{ ick_ONESPOT, "ick_oneforget" },
{ ick_TWOSPOT, "ick_twoforget" },
{ ick_TAIL, "ick_tailforget" },
{ ick_HYBRID, "ick_hyforget" },
- { 0, (char *)NULL }
+ { 0, (const char *)NULL }
};
/* AIS: Destatic. This is now needed in perpet.c. */
-assoc varstores[] =
+const assoc varstores[] =
{
{ ick_ONESPOT, "ick_onespots" },
{ ick_TWOSPOT, "ick_twospots" },
{ ick_TAIL, "ick_tails" },
{ ick_HYBRID, "ick_hybrids" },
- { 0, (char *)NULL }
+ { 0, (const char *)NULL }
};
/* AIS: A demangled version */
-static assoc varstoresdem[] =
+static const assoc varstoresdem[] =
{
{ ick_ONESPOT, "onespots" },
{ ick_TWOSPOT, "twospots" },
{ ick_TAIL, "tails" },
{ ick_HYBRID, "hybrids" },
- { 0, (char *)NULL }
+ { 0, (const char *)NULL }
};
-static assoc typedefs[] =
+static const assoc typedefs[] =
{
{ ick_ONESPOT, "ick_type16" },
{ ick_TWOSPOT, "ick_type32" },
{ ick_TAIL, "ick_type16" },
{ ick_HYBRID, "ick_type32" },
- { 0, (char *)NULL }
+ { 0, (const char *)NULL }
};
-/*@observer@*/ char *nameof(int value, assoc table[])
+/*@observer@*/ const char *nameof(int value, const assoc table[])
/* return string corresponding to value in table */
{
- assoc *ap;
+ const assoc *ap;
for (ap = table; ap->name; ap++)
if (ap->value == value)
return(ap->name);
- return((char *)NULL);
+ return((const char *)NULL);
}
/* AIS: Code for printing explanations (mixed C/INTERCAL code that lets
void emitslatproto(FILE* fp)
{
node* np=firstslat;
- char* t="ick_type32";
+ const char* t="ick_type32";
while(np)
{
fprintf(fp,"%s ick_og%lx(%s);\nvoid ick_os%lx(%s, void(*)());\n",
{
node* np=firstslat;
node* temp, *temp2;
- char* t="ick_type32";
+ const char* t="ick_type32";
while(np)
{
fprintf(fp,
typedef struct
{
int value;
- char *name;
+ const char *name;
}
assoc;
/*@dependent@*/ extern tuple *optuple; /* AIS: The tuple currently being optimized */
-extern char **enablers;
-extern char *enablersm1[MAXTYPES+1];
-extern assoc vartypes[];
+extern const char **enablers;
+extern const char *enablersm1[MAXTYPES+1];
+extern const assoc vartypes[];
/* the lexical analyzer keeps copies of the source logical lines */
/*@only@*/ extern char **textlines;
/* Register a CREATE target. This is just a wrapper for
ick_registercreation that gets around scoping problems. */
-void ick_create(char* sig, unsigned long target)
+void ick_create(const char* sig, unsigned long target)
{
ick_registercreation(sig, target);
}
uint32_t ick_gettwospot(unsigned short);
void ick_settwospot(unsigned short, uint32_t);
-void ick_create(char*, unsigned long);
+void ick_create(const char*, unsigned long);
/* For accessing the arguments to an ick_created command */
int ick_c_i_width(int);
typedef struct
{
- char *name;
+ const char *name;
int value;
}
numeral;
-numeral ick_numerals[] =
+const numeral ick_numerals[] =
{
/* English */
{ "OH", 0 },
tuple *optuple = NULL; /* AIS: Tuple being optimized */
-extern assoc varstores[]; /* AIS: Need to know this for PIC compilation */
+extern const assoc varstores[]; /* AIS: Need to know this for PIC compilation */
#ifndef HAVE_UNISTD_H
/* AIS: We don't have unistd.h, so we can't use getopt. Write our own version