use char, not signed char 30/head
authorMichael Jarvis <michael@jarvis.com>
Thu, 1 Jun 2017 22:45:29 +0000 (17:45 -0500)
committerMichael Jarvis <michael@jarvis.com>
Thu, 1 Jun 2017 22:45:29 +0000 (17:45 -0500)
compile.c
main.c
main.h

index 9906f08329d1df8923f8b57dc14a88e312a0ffd4..a6b441131b769dfc82ea1f33e9aecf604176289c 100644 (file)
--- a/compile.c
+++ b/compile.c
@@ -21,7 +21,7 @@ const char ascii_to_advent[] = {0, 74, 75, 76, 77, 78, 79, 80, 81, 82, 0, 0, 85,
 // Global variables for use in functions below that can gradually disappear as code is cleaned up
 long LNLENG;
 long LNPOSN;
 // Global variables for use in functions below that can gradually disappear as code is cleaned up
 long LNLENG;
 long LNPOSN;
-signed char INLINE[LINESIZE+1];
+char INLINE[LINESIZE+1];
 long I;
 long K;
 long KK;
 long I;
 long K;
 long KK;
@@ -195,12 +195,12 @@ void MAPLIN(FILE *OPENED) {
     fgets(INLINE + 1, sizeof(INLINE) - 1, OPENED);
   }
   while (!feof(OPENED) && INLINE[1] == '#');
     fgets(INLINE + 1, sizeof(INLINE) - 1, OPENED);
   }
   while (!feof(OPENED) && INLINE[1] == '#');
-  
+
   LNLENG = 0;
   LNLENG = 0;
-  for (int i = 1; i <= sizeof(INLINE) && INLINE[i] != 0; ++i)
+  for (size_t i = 1; i <= sizeof(INLINE) && INLINE[i] != 0; ++i)
     {
       char val = INLINE[i] + 1;
     {
       char val = INLINE[i] + 1;
-      INLINE[i] = ascii_to_advent[val];
+      INLINE[i] = ascii_to_advent[(unsigned)val];
       if (INLINE[i] != 0)
        LNLENG = i;
     }
       if (INLINE[i] != 0)
        LNLENG = i;
     }
@@ -213,7 +213,7 @@ long GETNUM(FILE *source) {
  *  if K=0 we use a line that has already been read (and perhaps partially
  *  scanned).  If we're at the end of the line or encounter an illegal
  *  character (not a digit, hyphen, or blank), we return 0. */
  *  if K=0 we use a line that has already been read (and perhaps partially
  *  scanned).  If we're at the end of the line or encounter an illegal
  *  character (not a digit, hyphen, or blank), we return 0. */
-  
+
   long DIGIT, GETNUM, SIGN;
 
   if(source != NULL) MAPLIN(source);
   long DIGIT, GETNUM, SIGN;
 
   if(source != NULL) MAPLIN(source);
@@ -242,7 +242,7 @@ L42:        GETNUM=GETNUM*SIGN;
 }
 
 int read_database(FILE* database) {
 }
 
 int read_database(FILE* database) {
-       
+
 /*  Clear out the various text-pointer arrays.  All text is stored in array
  *  lines; each line is preceded by a word pointing to the next pointer (i.e.
  *  the word following the end of the line).  The pointer is negative if this is
 /*  Clear out the various text-pointer arrays.  All text is stored in array
  *  lines; each line is preceded by a word pointing to the next pointer (i.e.
  *  the word following the end of the line).  The pointer is negative if this is
@@ -497,7 +497,7 @@ void write_files(FILE* c_file, FILE* header_file)
   // include the header in the C file
   fprintf(c_file, "#include \"database.h\"\n");
   fprintf(c_file, "\n");
   // include the header in the C file
   fprintf(c_file, "#include \"database.h\"\n");
   fprintf(c_file, "\n");
-  
+
   // content variables
   write_0d(c_file, header_file, LINUSE, "LINUSE");
   write_0d(c_file, header_file, TRVS, "TRVS");
   // content variables
   write_0d(c_file, header_file, LINUSE, "LINUSE");
   write_0d(c_file, header_file, TRVS, "TRVS");
@@ -528,11 +528,8 @@ void write_files(FILE* c_file, FILE* header_file)
   write_hints(c_file, header_file, HINTS, HNTSIZ + 1, 5, "HINTS");
 }
 
   write_hints(c_file, header_file, HINTS, HNTSIZ + 1, 5, "HINTS");
 }
 
-int main(int argc, char** argv)
+int main()
 {
 {
-  argc = argc;
-  argv = argv;
-
   FILE* database = fopen("adventure.text", "r");
   read_database(database);
   fclose(database);
   FILE* database = fopen("adventure.text", "r");
   read_database(database);
   fclose(database);
@@ -542,6 +539,6 @@ int main(int argc, char** argv)
   write_files(c_file, header_file);
   fclose(c_file);
   fclose(header_file);
   write_files(c_file, header_file);
   fclose(c_file);
   fclose(header_file);
-  
+
   return(EXIT_SUCCESS);
 }
   return(EXIT_SUCCESS);
 }
diff --git a/main.c b/main.c
index 57197e9c45c7f4ccb92b60b09f5c1a2e060f9916..400abd8b3fd8c5f20fec394b716aebf42cac7296 100644 (file)
--- a/main.c
+++ b/main.c
@@ -18,7 +18,7 @@ long ABB[186], ATLOC[186], BLKLIN = true, DFLAG,
                LINK[201], LNLENG, LNPOSN,
                PARMS[26], PLACE[101],
                SETUP = 0;
                LINK[201], LNLENG, LNPOSN,
                PARMS[26], PLACE[101],
                SETUP = 0;
-signed char rawbuf[LINESIZE], INLINE[LINESIZE+1], MAP1[129], MAP2[129];
+char rawbuf[LINESIZE], INLINE[LINESIZE+1], MAP1[129], MAP2[129];
 
 long ABBNUM, AMBER, ATTACK, AXE, BACK, BATTER, BEAR, BIRD, BLOOD, BONUS,
                 BOTTLE, CAGE, CAVE, CAVITY, CHAIN, CHASM, CHEST, CHLOC, CHLOC2,
 
 long ABBNUM, AMBER, ATTACK, AXE, BACK, BATTER, BEAR, BIRD, BLOOD, BONUS,
                 BOTTLE, CAGE, CAVE, CAVITY, CHAIN, CHASM, CHEST, CHLOC, CHLOC2,
@@ -141,7 +141,7 @@ L1: SETUP= -1;
 
        if (logfp)
            fprintf(logfp, "seed %ld\n", seedval);
 
        if (logfp)
            fprintf(logfp, "seed %ld\n", seedval);
-       
+
        for (;;) {
            if (!do_command(stdin))
                break;
        for (;;) {
            if (!do_command(stdin))
                break;
@@ -149,7 +149,7 @@ L1: SETUP= -1;
        score(1);
 }
 
        score(1);
 }
 
-static bool fallback_handler(signed char *buf)
+static bool fallback_handler(char *buf)
 /* fallback handler for commands not handled by FORTRANish parser */
 {
     long sv;
 /* fallback handler for commands not handled by FORTRANish parser */
 {
     long sv;
diff --git a/main.h b/main.h
index 2b3373539d0dfbb22f05d259ff6275a71f33e979..259170a54ba5a327bdd929e10396ce2159784f3b 100644 (file)
--- a/main.h
+++ b/main.h
@@ -10,7 +10,7 @@ typedef struct lcg_state
 extern long ABB[], ATLOC[], BLKLIN, DFLAG, DLOC[], FIXED[], HOLDNG,
                LINK[], LNLENG, LNPOSN,
                PARMS[], PLACE[];
 extern long ABB[], ATLOC[], BLKLIN, DFLAG, DLOC[], FIXED[], HOLDNG,
                LINK[], LNLENG, LNPOSN,
                PARMS[], PLACE[];
-extern signed char rawbuf[LINESIZE], INLINE[LINESIZE+1], MAP1[], MAP2[];
+extern char rawbuf[LINESIZE], INLINE[LINESIZE+1], MAP1[], MAP2[];
 extern FILE *logfp;
 extern bool oldstyle;
 extern lcg_state lcgstate;
 extern FILE *logfp;
 extern bool oldstyle;
 extern lcg_state lcgstate;