From: Alex Smith Date: Sat, 5 Jul 2008 18:17:54 +0000 (-0400) Subject: Send +printflow output to stderr not stdout X-Git-Tag: 0.29~210 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=b759e3d94899807ebad6e03555a9b260f1617b91;p=intercal.git Send +printflow output to stderr not stdout --- diff --git a/src/abcess.h b/src/abcess.h index 65677ca..8d803a5 100644 --- a/src/abcess.h +++ b/src/abcess.h @@ -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); diff --git a/src/feh2.c b/src/feh2.c index f4a3070..eea8788 100644 --- a/src/feh2.c +++ b/src/feh2.c @@ -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 */ diff --git a/src/ick_ec.c b/src/ick_ec.c index 1478354..0530df6 100644 --- a/src/ick_ec.c +++ b/src/ick_ec.c @@ -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 */ } diff --git a/src/unravel.c b/src/unravel.c index 589c828..4a41f3f 100644 --- a/src/unravel.c +++ b/src/unravel.c @@ -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); } /**********************************************************************