]> thyrsus.com Git - intercal.git/commitdiff
Update IFFI to support cfunge r633.
authorArvid Norlander <anmaster@tele2.se>
Sat, 28 Mar 2009 21:56:12 +0000 (17:56 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 26 Aug 2010 00:35:33 +0000 (20:35 -0400)
etc/IFFI.spec
etc/IFFI/IFFI.c
etc/IFFI/IFFI.h
etc/cftoec.sh
src/cesspool.c
src/dekludge.c
src/feh.h
src/feh2.c
src/ick.h
src/numerals.c
src/perpet.c

index 48f24c2021c86e0376b141341891f5a7a7b2fd9a..3288a32c8aae83604bb15c1974a11c9c3c7e04f9 100644 (file)
@@ -1,4 +1,4 @@
-%fingerprint-spec 1.2
+%fingerprint-spec 1.4
 %fprint:IFFI
 %url:http://example.com
 %desc:INTERCAL-like Foreign Function Interface
index 221fd17739c21641252c44c118aa62e88b891e4c..ecaadc333a1ea9cb543f78a489905079e67d2967 100644 (file)
@@ -93,7 +93,7 @@ void ick_interpreter_run(void)
 
 void ick_iffi_interpreter_one_iteration(void)
 {
-       fungeCell opcode;
+       funge_cell opcode;
        opcode = fungespace_get(&iffiIP->position);
 
        if (setting_trace_level > 8) {
@@ -110,7 +110,7 @@ void ick_iffi_interpreter_one_iteration(void)
 
        execute_instruction(opcode, iffiIP);
        if (iffiIP->needMove)
-               ip_forward(iffiIP, 1);
+               ip_forward(iffiIP);
        else
                iffiIP->needMove = true;
 }
@@ -119,15 +119,15 @@ void ick_iffi_interpreter_one_iteration(void)
 static void finger_IFFI_create(instructionPointer * ip)
 {
     // arguments: line number on TOS, signature as 0gnirts beneath it
-       fungeCell l = stack_pop(ip->stack);
-       unsigned char * restrict str = stack_pop_string(ip->stack);
+       funge_cell l = stack_pop(ip->stack);
+       unsigned char * restrict str = stack_pop_string(ip->stack, NULL);
        ick_create((const char*)str, l);
 }
 
 // C - In markmode COME FROM the top of stack
 static void finger_IFFI_come_from(instructionPointer * ip)
 {
-       fungeCell l;
+       funge_cell l;
 
        l = stack_pop(ip->stack);
 
@@ -148,7 +148,7 @@ static void finger_IFFI_create_data(instructionPointer * ip)
        // 0 if the argument is not a variable, or its number if it is
        // The argument's value at the time the CREATED instruction was called
        // The argument's value now (same as previous if -a was not used)
-       fungeCell i;
+       funge_cell i;
 
        if (firstload) {
                ip_reverse(ip);
@@ -167,7 +167,7 @@ static void finger_IFFI_create_data(instructionPointer * ip)
 // F - FORGET NEXT stack entries equal to top of stack
 static void finger_IFFI_forget(instructionPointer * ip)
 {
-       fungeCell f;
+       funge_cell f;
 
        if (firstload) {
                ip_reverse(ip);
@@ -193,7 +193,7 @@ static void finger_IFFI_var_get(instructionPointer * ip)
        // var numbers are positive for onespot, negative for twospot
        // return: the value of the variable
 
-       fungeCell v;
+       funge_cell v;
 
        if (firstload) {
                ip_reverse(ip);
@@ -214,7 +214,7 @@ static void finger_IFFI_var_get(instructionPointer * ip)
 // L - Use top of stack as a line label for this point
 static void finger_IFFI_label(instructionPointer * ip)
 {
-       fungeCell l;
+       funge_cell l;
 
        if (firstload) {
                ip_reverse(ip);
@@ -238,7 +238,7 @@ static void finger_IFFI_marker(instructionPointer * ip)
 // N - Try to NEXT to the line labelled with the top of stack
 static void finger_IFFI_next(instructionPointer * ip)
 {
-       fungeCell l;
+       funge_cell l;
 
        if (firstload) {
                ip_reverse(ip);
@@ -260,7 +260,7 @@ static void finger_IFFI_next(instructionPointer * ip)
 // R - RESUME to the top-of-stackth NEXT stack entry
 static void finger_IFFI_resume(instructionPointer * ip)
 {
-       fungeCell f;
+       funge_cell f;
 
        if (firstload) {
                ip_reverse(ip);
@@ -290,7 +290,7 @@ static void finger_IFFI_var_set(instructionPointer * ip)
        // var numbers are positive for onespot, negative for twospot
        // return: the value of the variable
 
-       fungeCell v, d;
+       funge_cell v, d;
 
        if (firstload) {
                ip_reverse(ip);
@@ -314,7 +314,7 @@ static void finger_IFFI_arg_set(instructionPointer * ip)
 {
        // arguments: 0-based argument index on TOS, new value beneath it
        // note that this is a NOP unless -a was used when compiling
-       fungeCell i, d;
+       funge_cell i, d;
 
        if (firstload) {
                ip_reverse(ip);
@@ -330,7 +330,7 @@ static void finger_IFFI_arg_set(instructionPointer * ip)
 // X - In markmode NEXT FROM the top of stack
 static void finger_IFFI_next_from(instructionPointer * ip)
 {
-       fungeCell l;
+       funge_cell l;
 
        l = stack_pop(ip->stack);
 
index 1c70e232640b4c3469505bbbe7f7391bcc5e660a..88d82db63f563329f7ce9284009c9b0878193aab 100644 (file)
 #include "../../global.h"
 #include "../manager.h"
 
+#if !defined(CFUNGE_API_VERSION) || (CFUNGE_API_VERSION != 1)
+#  error "This version of IFFI isn't compatible with this cfunge version."
+#endif
+
 #ifdef CONCURRENT_FUNGE
-#error The C-INTERCAL/cfunge external calls interface cannot be used concurrently
+#  error "The C-INTERCAL/cfunge external calls interface cannot be used concurrently."
 #endif
 
 // We need at least GCC 4.1 for this trick.
index 0965eab4ff91edc528a44392af678a2cb78f717b..b9fccf3258bfe3b27a500215f8a878caa26b1d05 100644 (file)
@@ -102,7 +102,7 @@ echo "   " Adding the IFFI fingerprint...
 cp -r "$ICKSRC_PATH/etc/IFFI" "$ICKSRC_PATH/etc/IFFI.spec" src/fingerprints
 
 echo "   " Regenerating fingerprint lists...
-$CFUNGE_PATH/tools/gen_fprint_list.sh > /dev/null || die "Failed to regen list."
+tools/gen_fprint_list.sh > /dev/null || die "Failed to regen list."
 
 # Trust the filenames that are in the cfunge directory tree; if the user's
 # trying to trick themselves into running this on something that looks like
index 05b3be6fe3fd2be412e5907727cae2b2e6a1a08b..0ea2a291eaa1881fd262dbc8abd831d59724c5e7 100644 (file)
@@ -460,7 +460,7 @@ static void clcbinout(unsigned int type, const ick_array* a)
   while(i--) if(tempcp[i] == '\0') tempcp[i]='\x1a';
   if(!ick_cesspoolout) ick_cesspoolout=stdout;
   fprintf(ick_cesspoolout,"%s\n",tempcp);
-  fflush(ick_cesspoolout);
+  (void) fflush(ick_cesspoolout);
   free(tempcp);
   free(buf);
 }
index 59823fa63ce98e335204e86676e2a51136c84238..73f26a00180b9c757d3c5f6a0e4dbeeb5fa1209e 100644 (file)
@@ -58,7 +58,7 @@ extern void prexpr(node *np, FILE* fp, int freenode); /* AIS */
    just with extra arrows in. The annotations here show that nulls are allowed
    when called recursively, but not otherwise. */
 /*@-incondefs@*/
-/*@null@*/ node *nodecopy(/*@null@*/ node* n)
+/*@null@*/ node *nodecopy(/*@null@*/ const node* n)
 /*@=incondefs@*/
 {
   node* np;
@@ -72,7 +72,7 @@ extern void prexpr(node *np, FILE* fp, int freenode); /* AIS */
 
 /* This function by AIS. Compares expressions. In C++, I'd call this
    node::operator== . */
-ick_bool nodessame(const node* n1, const node* n2)
+ick_bool nodessame(/*@observer@*/ const node* n1, /*@observer@*/ const node* n2)
 {
   if(!n1) return !n2;
   if(!n2) return 0;
index 63be73232f25484d59fc53a90abbe1950028349a..1876fb00c9e963172c32e9e21d47972f623521fe 100644 (file)
--- a/src/feh.h
+++ b/src/feh.h
@@ -23,8 +23,8 @@ extern void checknodeactbits(node *np); /* 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(const node*, const node*); /* AIS */
+extern node *nodecopy(const node*); /* AIS */
+extern ick_bool nodessame(/*@observer@*/ const node*, /*@observer@*/ const node*); /* AIS */
 
 extern node *optdebugnode; /* AIS */
 extern const char **enablers; /* AIS: so that there can be an element before the
index 2790d3bc046d44a0ebf5a1b62285cd28c5808e0d..827a6396139f8b22118d41737e4e9dd3d76f007f 100644 (file)
@@ -459,7 +459,7 @@ void prexpr(node *np, FILE *fp, int freenode);
  * If the order of statement-token defines in parser.y ever changes,
  * this will need to be reordered.
  */
-const char *enablersm1[MAXTYPES+1] =
+/*@observer@*/ const char *enablersm1[MAXTYPES+1] =
 {
     "UNKNOWN", /* AIS: so comments can be ABSTAINED/REINSTATED */
     "GETS",
@@ -1594,10 +1594,10 @@ static int prunknownstr(node *np, FILE* fp)
   case BADCHAR:
     if (np->constant > 256)
       (void) fprintf(fp, "o%xx%x",
-                    (int)(np->constant / 256),
-                    (int)(np->constant % 256));
+                    (unsigned int)(np->constant / 256),
+                    (unsigned int)(np->constant % 256));
     else
-      (void) fprintf(fp, "u%x", (int)np->constant);
+      (void) fprintf(fp, "u%x", (unsigned int)np->constant);
     return 2;
   case US_ID: (void) fputc((char)np->constant, fp); return 0;
   case US_ELEM: (void) fputc(';', fp); return 1;
index 60fefe3d818603adf71de5bd37d4c26c8c69bee7..e45231df8db2ddc10a69a77a95674d170a2aa74b 100644 (file)
--- a/src/ick.h
+++ b/src/ick.h
@@ -129,7 +129,7 @@ extern int tuplecount;
 /*@dependent@*/ extern tuple *optuple; /* AIS: The tuple currently being optimized */
 
 extern const char **enablers;
-extern const char *enablersm1[MAXTYPES+1];
+/*@observer@*/ extern const char *enablersm1[MAXTYPES+1];
 extern const assoc vartypes[];
 
 /* the lexical analyzer keeps copies of the source logical lines */
index 024228edf8c653ff953175b26df7dc21e31f4be0..ecdee2bbb3433ba69001d7ff170424d5d2fa9272 100644 (file)
@@ -38,8 +38,8 @@ LICENSE TERMS
 
 typedef struct
 {
-    const char *name;
-    int        value;
+    /*@observer@*/ const char *name;
+    const int  value;
 }
 numeral;
 
index 468c95fbd4bfa75e5a8ea04416bde2fb707f8c20..02607d6e4198e7d6bb19173fbfb32941d2721e10 100644 (file)
@@ -544,7 +544,7 @@ static void handle_befunge98(char *libbuf, size_t libbuf_size,
     else if(c=='\n' && jlb) {jlb = 0; continue;}
     else if(c=='\n') {x=0; y++; jlb = 0;}
     else x++;
-    fprintf(of,"\\x%x",c);
+    fprintf(of,"\\x%x",(unsigned int)c);
     if(!x) fprintf(of,"\"\n\"");
   }
   fprintf(of,"\";\n\nint ick_iffi_markercount=%d;\n"
@@ -555,7 +555,7 @@ static void handle_befunge98(char *libbuf, size_t libbuf_size,
                               markerposns[markercount][1]);
   fprintf(of,"};\n");
 
-  fclose(of);
+  (void) fclose(of);
 
   /* Put the libraries and .cio file in the command line. */
   ick_snprintf_or_die(libbuf+strlen(libbuf),libbuf_size - strlen(libbuf),
@@ -1516,10 +1516,10 @@ static void run_cc_and_maybe_debugger(/*@observer@*/ const char *cc_command,
  * @param cooptsh Path to coopt.sh
  * @param binaryname The output binary filename.
  */
-static void run_coopt(/*@observer@*/ /*@null@*/ const char* cooptsh,
-                      /*@observer@*/ const char* binaryname)
+static void run_coopt(/*@observer@*/ /*@null@*/ /*@unused@*/ const char* cooptsh,
+                      /*@observer@*/ /*@unused@*/ const char* binaryname)
 {
-  char commandlinebuf[BUFSIZ];
+  /* Note: Params are marked unused because they may not be used if sh isn't supported. */
 #ifdef HAVE_PROG_SH
 # ifdef HAVE_SYS_INTERPRETER
   if(coopt) /* AIS */
@@ -1532,6 +1532,7 @@ static void run_coopt(/*@observer@*/ /*@null@*/ const char* cooptsh,
        WRITE IN. Double-oh-sevens screw this up, too. */
     if(cooptsh)
     {
+      char commandlinebuf[BUFSIZ];
       (void) ick_snprintf_or_die(commandlinebuf, sizeof commandlinebuf,
                                 "sh %s %s", cooptsh, binaryname);
       ICK_SYSTEM(commandlinebuf); /* replaces the output executable if
@@ -1799,7 +1800,7 @@ int main(int argc, char *argv[])
 #endif
 
   oldoptind=optind; /* AIS */
-  *libbuf = 0; /* AIS */
+  *libbuf = '\0'; /* AIS */
   /* Begin file loop */
   for (firstfile = ick_TRUE; optind < argc; optind++, firstfile = ick_FALSE)
   {
@@ -1885,7 +1886,7 @@ int main(int argc, char *argv[])
           it instead adds a space and the filename to libbuf. */
        handle_archive(libbuf, sizeof libbuf,
                       argv[optind] /* Archive name without extension. */);
-       *argv[optind]=0;
+       *argv[optind]='\0';
        continue;
       }