7b4bb371da6813455b4b5a53906d5cd59457240b tdreszer Fri Aug 3 16:40:44 2012 -0700 By redefining printf, puts and putc in the header file and including that header in select c files, hgTrackUi can decide to add a box around the cfg dialog after it is written. This is useful since it is not clear whether a cfg will be written until it is tried. Openning the box beforehand can leave an empty box. This minor check-in does not include changes to any cgis, only the ability to do so. diff --git src/lib/dsPrint.c src/lib/dsPrint.c index 05d51fe..33ebcc6 100644 --- src/lib/dsPrint.c +++ src/lib/dsPrint.c @@ -286,40 +286,40 @@ dsPrintStackDepth(),dsPrintSize(token1),dsPrintSize(token2),dsPrintSizeAll()); dsPrintFlushAndClose(token2); dsPrintf("6 1:%d After flushAndClose:2 len1:%d\n",dsPrintStackDepth(),dsPrintSize(token1)); token2 = dsPrintOpen(256); dsPrintf("7 dsOpen:2 reopen:2 WILL ABANDON CONTENT\n"); char *content = cloneString(dsPrintContent(token2)); dsPrintAbandonContent(token2); dsPrintf("8x7 2:%d len1:%d len2:%d lenAll:%d isEmpty2:%s\n", dsPrintStackDepth(),dsPrintSize(token1),dsPrintSize(token2),dsPrintSizeAll(), (dsPrintIsEmpty(token2) ? "EMPTY":"NOT_EMPTY")); strSwapChar(content,'\n','~'); // Replace newline before printing. dsPrintf("9 2:%d No flush yet len1:%d len2:%d lenAll:%d prev7:[%s]\n", dsPrintStackDepth(),dsPrintSize(token1),dsPrintSize(token2),dsPrintSizeAll(),content); freez(&content); int token3 = dsPrintOpen(256); -dsPrintPuts("10 Open:3 Line doubled and out of turn due to dsPrintDirectly()"); +dsPuts("10 Open:3 Line doubled and out of turn due to dsPrintDirectly()"); dsPrintDirectly(token3,stdout); dsPrintf("11 3:%d Just prior to closing all. len1:%d len2:%d len3:%d lenAll:%d", dsPrintStackDepth(), dsPrintSize(token1),dsPrintSize(token2),dsPrintSize(token3),dsPrintSizeAll()); int token4 = dsPrintOpen(256); dsPrintf("12 Open:4 Opened stack:%d WILL ABANDON\n",dsPrintStackDepth()); dsPrintAbandon(token4); -dsPrintPutc('\n'); -dsPrintPuts("13 Puts: Added last '\\n' with dsPrintPutc(), this with dsPrintPuts()."); +dsPutc('\n'); +dsPuts("13 Puts: Added last '\\n' with dsPutc(), this with dsPuts()."); dsPrintf("14 3:%d Last line! Expect 7 & 12 missing, 10 dupped. lenAll:%d Bye.\n", dsPrintStackDepth(),dsPrintSizeAll()); dsPrintFlushAndCloseAll(); assert(dsStack == NULL); int ix = 0; for (;ix<20;ix++) // tested to 1000 { dsPrintOpen(32); // Don't even care about tokens! if (ix == 0) dsPrintf("CannibalizeAndCloseAll():"); dsPrintf(" %d",dsPrintStackDepth()); } content = dsPrintCannibalizeAndCloseAll(); printf("\n[%s]\n",content); freez(&content);