]> thyrsus.com Git - intercal.git/commitdiff
First const patch.
authorArvid Norlander <anmaster@tele2.se>
Tue, 18 Nov 2008 17:25:17 +0000 (12:25 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 26 Aug 2010 00:35:18 +0000 (20:35 -0400)
src/ick_ec.h
src/ick_lose.c
src/ick_lose.h
src/perpet.c
src/uncommon.c
src/uncommon.h
src/unravel.c
src/yuk.c

index 0aaccf23659ca84409cc7971dab35db318bec3e4..35dfd6801e74dd49eabcc03794c081adf93dca2a 100644 (file)
@@ -293,7 +293,7 @@ void ick_c_i_setvalue(int, uint32_t);
 #define ICK_IE778 "778 UNEXPLAINED COMPILER BUG\n\
        ON THE WAY TO %d\n"
 
-extern void /*@noreturn@*/ ick_lose(char *m, int n, /*@null@*/ char *s)
+extern void /*@noreturn@*/ ick_lose(const char *m, int n, /*@null@*/ const char *s)
 #ifdef __GNUC__
   __attribute__ ((noreturn))
 #endif
index d33b6a37c1be9a704482b798b25e18524a27ffd6..b38158c57f15be8a7680b7b41d5afb6dfb652245 100644 (file)
@@ -32,7 +32,7 @@ int ick_coreonerr = 0; /* AIS */
 int ick_checkforbugs; /* AIS */
 
 /*@-formatconst@*/
-void ick_lose(char *m, int n, char *s)
+void ick_lose(const char *m, int n, const char *s)
 {
     (void) fflush(stdout); /* AIS: To stop stdout getting muddled with stderr*/
     (void) fprintf(stderr,
@@ -52,7 +52,7 @@ void ick_lose(char *m, int n, char *s)
 }
 
 /* AIS: This function reports potential bugs. It's paraphrased from ick_lose. */
-void ick_lwarn(char *m, int n, char *s)
+void ick_lwarn(const char *m, int n, const char *s)
 {
   if(!ick_checkforbugs) return; /* Don't report a potential bug without -l */
   (void) fflush(stdout);
index 1684b18e5e4ca58643120d477cc92f45e392c94e..fb36e51135c8367a865ef3f15c0e53ef747ecc64 100644 (file)
 
 extern int ick_lineno;
 
-extern void /*@noreturn@*/ ick_lose(char *m, int n, /*@null@*/ char *s)
+extern void /*@noreturn@*/ ick_lose(const char *m, int n, /*@null@*/ const char *s)
 #ifdef __GNUC__
   __attribute__ ((noreturn))
 #endif
 ;
 
-extern void ick_lwarn(char *m, int n, /*@null@*/ char *s);
+extern void ick_lwarn(const char *m, int n, /*@null@*/ const char *s);
 
 /* ick_lose.h ends here */
index d68d4752ee1f10a3e977ad1031c7a069de25640a..7f2b2c87d04d124c94b6e8c14a2297b19a6eff52 100644 (file)
@@ -143,7 +143,7 @@ static int smallsizes[8] = {0, 0, 16, 10, 8, 6, 6, 5};
 static unsigned int maxsmalls[8] =
 {0, 0, 65535, 59048, 65535, 15624, 46655, 16806};
 
-/*@observer@*/ static char *compiler;
+/*@observer@*/ static const char *compiler;
 
 atom *oblist = NULL, *obdex;
 int obcount = 0;
@@ -193,7 +193,7 @@ static RETSIGTYPE abend(int signim)
   /*@-noeffect@*/ (void) signim; /*@=noeffect@*/
   ick_lose(IE778, iyylineno, (char *)NULL);
 }
-static void print_usage(char *prog, char *options)
+static void print_usage(const char *prog, const char *options)
 {
   fprintf(stderr,"Usage: %s [-%s] <file> [<file> ...]\n",prog,options);
   fprintf(stderr,"\t-b\t:reduce the probability of E774 to zero\n");
@@ -263,13 +263,15 @@ static void print_usage(char *prog, char *options)
   fprintf(stderr,"\t\tfor base 2 or .3i, etc., for base 3, etc.).\n");
 }
 
+#if __DJGPP__
 /* AIS: Determine whether an environment variable exists (this is used to
    find a temp directory) */
-int isenv(char* e)
+static int isenv(char* e)
 {
   char* x=getenv(e);
   return x != NULL && *x != '\0';
 }
+#endif
 
 /*@-redef@*/
 int main(int argc, char *argv[])
@@ -284,10 +286,10 @@ int main(int argc, char *argv[])
   atom *op;
   int          c, i;
   /*@-shadow@*/ /* no it doesn't, cesspool isn't linked to perpet */
-  char *includedir, *libdir, *ick_datadir;
+  const char   *includedir, *libdir, *ick_datadir;
   /*@=shadow@*/
   /* AIS: removed getenv(), added ick_datadir */
-  char        *cooptsh; /* AIS */
+  const char        *cooptsh; /* AIS */
   FILE *ifp, *ofp;
   int          maxabstain, /* nextcount, AIS */ bugline;
   ick_bool        needsyslib, firstfile;
@@ -528,7 +530,7 @@ int main(int argc, char *argv[])
             along the same lines as CLC-INTERCAL's preloads. Search for
             it in the usual places, then make a copy in a temp directory
             and substitute that on the command line. */
-         char* tempfn;
+         const char* tempfn;
          FILE* fromcopy;
          FILE* tocopy;
          int c2;
@@ -1656,7 +1658,7 @@ int main(int argc, char *argv[])
     FILE* cioallec;
     char* buf2ptr;
     long remspace;
-    char* tempfn="ickectmp.c";
+    const char* tempfn="ickectmp.c";
     int needc99=0;
 #if __DJGPP__
     /* Look for a temp directory, as above. */
index abc98bec48980a23b54325dbd03dd9f2f083198c..2ef57c224d62a471f548a0762d5e864377081f43 100644 (file)
@@ -26,8 +26,8 @@ LICENSE TERMS
 /* Options that might affect this */
 int ick_printfopens=0;
 
-/*@dependent@*/ /*@null@*/ FILE* ick_debfopen(/*@observer@*/ char* fname,
-                                             /*@observer@*/ char* mode)
+/*@dependent@*/ /*@null@*/ FILE* ick_debfopen(/*@observer@*/ const char* fname,
+                                             /*@observer@*/ const char* mode)
 {
   FILE* t;
   if(ick_printfopens) fprintf(stderr,"Trying to open '%s'...\n",fname);
@@ -43,13 +43,13 @@ int ick_printfopens=0;
    overflows, instead truncating filenames (and if that manages to find them,
    I'll be incredibly surprised). It also tries argv[0]/../lib and
    argv[0]/../include (where they are when running without installing). */
-/*@dependent@*/ /*@null@*/ FILE* ick_findandfopen(/*@observer@*/ char* file,
-                                                 /*@observer@*/ char* guessdir,
-                                                 /*@observer@*/ char* mode,
-                                                 /*@observer@*/ char* argv0)
+/*@dependent@*/ /*@null@*/ FILE* ick_findandfopen(/*@observer@*/ const char* file,
+                                                 /*@observer@*/ const char* guessdir,
+                                                 /*@observer@*/ const char* mode,
+                                                 /*@observer@*/ const char* argv0)
 {
   static char buf2[BUFSIZ];
-  /*@observer@*/ static char *fileiter;
+  /*@observer@*/ static const char *fileiter;
   size_t i = 0, j;
   FILE* ret;
   while(*guessdir != '\0' && i<BUFSIZ-2) buf2[i++] = *guessdir++;
@@ -96,13 +96,13 @@ int ick_printfopens=0;
 }
 
 /* AIS: The same, looking for an executable */
-/*@observer@*/ /*@null@*/ char* ick_findandtestopen(/*@observer@*/ char* file,
-                                                   /*@observer@*/ char* guessdir,
-                                                   /*@observer@*/ char* mode,
-                                                   /*@observer@*/ char* argv0)
+/*@observer@*/ /*@null@*/ const char* ick_findandtestopen(/*@observer@*/ const char* file,
+                                                         /*@observer@*/ const char* guessdir,
+                                                         /*@observer@*/ const char* mode,
+                                                         /*@observer@*/ const char* argv0)
 {
   static char buf2[BUFSIZ];
-  /*@observer@*/ static char *fileiter;
+  /*@observer@*/ static const char *fileiter;
   size_t i = 0, j;
   FILE* ret;
   while(*guessdir != '\0' && i<BUFSIZ-2) buf2[i++] = *guessdir++;
@@ -149,13 +149,13 @@ int ick_printfopens=0;
 }
 
 /* AIS: The same thing, but with freopen */
-/*@dependent@*/ /*@null@*/ FILE* ick_findandfreopen(/*@observer@*/ char* file,
-                                                   /*@observer@*/ char* guessdir,
-                                                   /*@observer@*/ char* mode,
-                                                   /*@observer@*/ char* argv0,
+/*@dependent@*/ /*@null@*/ FILE* ick_findandfreopen(/*@observer@*/ const char* file,
+                                                   /*@observer@*/ const char* guessdir,
+                                                   /*@observer@*/ const char* mode,
+                                                   /*@observer@*/ const char* argv0,
                                                    FILE* over)
 {
-  char* s=ick_findandtestopen(file,guessdir,mode,argv0);
+  const char* s=ick_findandtestopen(file,guessdir,mode,argv0);
   if(s != NULL)
     return freopen(s,mode,over);
   else
index 85708ce4f2b0ed20e379ed300995b596f6291367..2d879cdebc029ccf68c24d972575c8ce8d8dd5a9 100644 (file)
@@ -2,7 +2,7 @@
 
 #include "config.h"
 
-/*@null@*/ /*@dependent@*/ extern FILE* ick_debfopen(/*@observer@*/ char*, /*@observer@*/ char*);
-/*@null@*/ /*@dependent@*/ extern FILE* ick_findandfopen(/*@observer@*/ char*, /*@observer@*/ char*, /*@observer@*/ char*, /*@observer@*/ char*);
-/*@observer@*/ /*@null@*/ extern char* ick_findandtestopen(/*@observer@*/ char*, /*@observer@*/ char*, /*@observer@*/ char*, /*@observer@*/ char*);
-/*@null@*/ /*@dependent@*/ extern FILE* ick_findandfreopen(/*@observer@*/ char*, /*@observer@*/ char*, /*@observer@*/ char*, /*@observer@*/ char*, FILE*);
+/*@null@*/ /*@dependent@*/ extern FILE* ick_debfopen(/*@observer@*/ const char*, /*@observer@*/ const char*);
+/*@null@*/ /*@dependent@*/ extern FILE* ick_findandfopen(/*@observer@*/ const char*, /*@observer@*/ const char*, /*@observer@*/ const char*, /*@observer@*/ const char*);
+/*@observer@*/ /*@null@*/ extern const char* ick_findandtestopen(/*@observer@*/ const char*, /*@observer@*/ const char*, /*@observer@*/ const char*, /*@observer@*/ const char*);
+/*@null@*/ /*@dependent@*/ extern FILE* ick_findandfreopen(/*@observer@*/ const char*, /*@observer@*/ const char*, /*@observer@*/ const char*, /*@observer@*/ const char*, FILE*);
index 4a41f3fd4d52e6e028045d5285a0adbc5437c611..c5804ecf16fbfb76028f68a2b1ad3b7cac1734da 100644 (file)
@@ -112,7 +112,7 @@ extern int ick_printflow; /* from arrgghh.c; a debug option */
 int weaving=0; /* Weave newly created threads? */
 
 /* Printflow debugging output */
-static void fluputs(char* s)
+static void fluputs(const char* s)
 {
   fprintf(stderr,"%s",s);
   (void) fflush(stderr);
index 6548fa54c730cfd9be0494dd94753821967c06dd..b4d32774349e49b20bdecaed855a3f74f1ba798c 100644 (file)
--- a/src/yuk.c
+++ b/src/yuk.c
@@ -198,7 +198,7 @@ void yukline(int aboff,int emitlineno)
   yptimer temptick;
   char* text=textlines[lineofaboff[aboff]];
   char copyloc[BUFSIZ+9];
-  char* tempcharp;
+  const char* tempcharp;
   if(!yukopts) return;
   if(globalargc!=3)
     ick_lose(IE778,emitlineno,(char*)NULL);