]> thyrsus.com Git - intercal.git/commitdiff
Send +printflow output to stderr not stdout
authorAlex Smith <ais523@bham.ac.uk>
Sat, 5 Jul 2008 18:17:54 +0000 (14:17 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 26 Aug 2010 00:35:06 +0000 (20:35 -0400)
src/abcess.h
src/feh2.c
src/ick_ec.c
src/unravel.c

index 65677cacbdbe7ac24f34f251d48d347763cadce3..8d803a55525bd25d8743ff1f072a1c4d1c2da76b 100644 (file)
@@ -174,10 +174,10 @@ typedef struct tag_ickthread ickthread;
                                                               thread switching O(1), not O(n), with
                                                               respect to the number of threads */
 extern int weaving; /* whether to weave newly created threads */
-#define NEXTTHREAD if(ick_printflow) printf("[%d:%lx]",ick_lineno,(unsigned long)\
-                                                          ickmt_cur); \
-                                 if(setjmp(ick_cjb) == 0) \
-                                   nextthread(ick_cjb, ick_lineno, 3);
+#define NEXTTHREAD if(ick_printflow) fprintf(stderr,"[%d:%lx]",ick_lineno, \
+                                            (unsigned long)ickmt_cur); \
+  if(setjmp(ick_cjb) == 0)                                             \
+    nextthread(ick_cjb, ick_lineno, 3);
 
 extern void nextthread(jmp_buf pc, int errlineno, int flags);
 extern void killthread(void);
index f4a3070c1c68f992e2e4653ef8685a16cf9f23b9..eea8788f1e307836ffd432a8c4e8ec9fbded9666 100644 (file)
@@ -2387,7 +2387,7 @@ void emit(tuple *tn, FILE *fp)
       }
       fprintf(fp,"\t""%s;} else goto CCF%d;\n",
              multithread?"NEXTTHREAD":useprintflow?
-             "if(ick_printflow) printf(\"[%d]\",ick_lineno)":"",
+             "if(ick_printflow) fprintf(stderr,\"[%d]\",ick_lineno)":"",
              compucomecount);
       break;
 
@@ -2611,7 +2611,8 @@ void emit(tuple *tn, FILE *fp)
        (void) fprintf(fp, "if(0) {C%ld: %s;%s}\n", (long)(tn-tuples+1),
                       tn->type==NEXTFROMLABEL ? "ick_pushnext(truelineno+1)":"",
                       multithread?" NEXTTHREAD;":!useprintflow?""
-                      :" if(ick_printflow) printf(\"[%d]\",ick_lineno);");
+                      :" if(ick_printflow) "
+                      "fprintf(stderr,\"[%d]\",ick_lineno);");
        /* AIS: Changed so all COME_FROMs have unique labels even if two
           of them aim at the same line, and added the NEXT FROM case (which
           involves hiding COME FROM labels in an unreachable if()). */
@@ -2762,7 +2763,8 @@ void emit(tuple *tn, FILE *fp)
        thread in a multithread program. */
     if(multithread) (void) fputs("    NEXTTHREAD;\n", fp);
     else if(useprintflow)
-      (void) fputs("    if(ick_printflow) printf(\"[%d]\",ick_lineno);\n",fp);
+      (void) fputs("    if(ick_printflow) fprintf(stderr,"
+                  "\"[%d]\",ick_lineno);\n",fp);
 }
 
 /* AIS: Generate prototypes for slat expressions, args to UNKNOWN */
index 147835439da173d6f6ca7da32ae6ba4c677aab51..0530df6639fc93da05517a759bbd81e837f6a514 100644 (file)
@@ -107,7 +107,7 @@ extern ick_overop* ick_oo_twospots;
      procedure is longjmped to. */
   auto volatile int nextlevel = ick_nextindex;
   if(ick_printflow&&linelabel<=65535&&isnext)
-    printf("[next:%lu]",linelabel);
+    fprintf(stderr,"[next:%lu]",linelabel);
   ick_global_checkmode = 2; /* look for linelabels */
   ick_global_linelabel = linelabel;
   /* If there was a FORGET earlier, implement it now, by removing the relevant
@@ -120,9 +120,9 @@ extern ick_overop* ick_oo_twospots;
   if(!isnext)
   {
     if(ick_printflow&&ick_forgetamount)
-      printf("[forget:%d]",ick_forgetamount);
+      fprintf(stderr,"[forget:%d]",ick_forgetamount);
     else if(ick_printflow&&linelabel<=65535)
-      printf("[goto:%lu]",linelabel);
+      fprintf(stderr,"[goto:%lu]",linelabel);
     nextlevel = ick_nextindex -= ick_forgetamount + 1;
     ick_forgetamount = 0;
     if(ick_nextindex < 0) ick_nextindex = 0;
@@ -161,7 +161,7 @@ void ick_scheduleforget(unsigned short amount)
 /* Resume to a previous NEXT stack entry. */
 /*@noreturn@*/ void ick_doresume(unsigned short amount, int emitlineno)
 {
-  if(ick_printflow) printf("[resume:%hu]",amount);
+  if(ick_printflow) fprintf(stderr,"[resume:%hu]",amount);
   if(ick_forgetamount) ick_lose(IE778, emitlineno, (char *)NULL);
   if(!amount) ick_lose(IE621, emitlineno, (char *)NULL);
   ick_nextindex -= amount;
@@ -195,12 +195,12 @@ void ick_runstartups(void)
   /* If this was a COME FROM, goto it. */
   if(ick_global_checkmode == 1)
   {
-    if(ick_printflow) printf("[comefrom:%lu]",ick_global_linelabel);
+    if(ick_printflow) fprintf(stderr,"[comefrom:%lu]",ick_global_linelabel);
     ick_dogoto(ick_global_goto,-1,0); /* GOTO */
   }
   else if(ick_global_checkmode == 3)
   {
-    if(ick_printflow) printf("[nextfrom:%lu]",ick_global_linelabel);
+    if(ick_printflow) fprintf(stderr,"[nextfrom:%lu]",ick_global_linelabel);
     ick_dogoto(ick_global_goto,-1,1); /* NEXT */
     return; /* we were RESUMEd to */
   }
index 589c8286aff53509393bac248c25e74d228ad99c..4a41f3fd4d52e6e028045d5285a0adbc5437c611 100644 (file)
@@ -114,8 +114,8 @@ int weaving=0; /* Weave newly created threads? */
 /* Printflow debugging output */
 static void fluputs(char* s)
 {
-  printf("%s",s);
-  (void) fflush(stdout);
+  fprintf(stderr,"%s",s);
+  (void) fflush(stderr);
 }
 
 /**********************************************************************