From: marc_nauwelaerts@skynet.be
Date: 08/13/03
Message-Id: <200308131454.h7DEsUsR003367@nebula.skynet.be> From: marc_nauwelaerts@skynet.be Subject: tcptrace-bugs xplot patch to allow compile under GCC 3.3 Date: Wed, 13 Aug 2003 16:54:29 +0200
Hi,
xplot use multiline strings and this is disallowed by GCC 3.3
As I needed this progrma for tcptrace output, I modified xplot.c by backslashifying (?) the multiline strings.
I also changed all #include of <malloc.h> by <stdlib.h> as suggested by the compiler
Commented one extra bit after a #define, was obvious mistake
I have sent the patch to xplot.org, but I think that you may be the actual current maintainers.
Feel free to make all the comments you want.
I include the patch.
Best regards,
Marc Nauwelaerts.
Index: dtime.c
===================================================================
--- dtime.c (revision 1)
+++ dtime.c (revision 3)
@@ -31,7 +31,7 @@
to preserve same.
*/
#include <math.h>
-#include <malloc.h>
+#include <stdlib.h>
#include <stdio.h>
#include \"xplot.h\"
Index: timeval.c
===================================================================
--- timeval.c (revision 1)
+++ timeval.c (revision 3)
@@ -31,7 +31,7 @@
to preserve same.
*/
#include <math.h>
-#include <malloc.h>
+#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include \"xplot.h\"
Index: xplot.c
===================================================================
--- xplot.c (revision 1)
+++ xplot.c (revision 3)
@@ -1434,7 +1434,7 @@
printf(\"Based on Tim Shepard's version 0.90.7 xplot\\n\");
printf(\"Tcptrace-hosted version: %s\\n\", version_string);
}
-#endif TCPTRACE
+#endif /* TCPTRACE */
/* Look for -v or -version argument */
for (i = 1; i < argc && *argv[i] == '-'; i++) {
@@ -3528,18 +3528,18 @@
fputs(\"gsave\\n\", fp);
/* Set up scale */
- fputs(\"
-%/sign { dup 0 gt { pop 1 } { 0 lt { -1 } { 0 } ifelse } ifelse } def
-
-%matrix currentmatrix
-%aload pop
-%6 2 roll sign
-%6 1 roll sign
-%6 1 roll sign
-%6 1 roll sign
-%6 1 roll
-%matrix astore setmatrix
-
+ fputs(\" \\
+%/sign { dup 0 gt { pop 1 } { 0 lt { -1 } { 0 } ifelse } ifelse } def \\
+ \\
+%matrix currentmatrix \\
+%aload pop \\
+%6 2 roll sign \\
+%6 1 roll sign \\
+%6 1 roll sign \\
+%6 1 roll sign \\
+%6 1 roll \\
+%matrix astore setmatrix \\
+ \\
\", fp);
fprintf(fp, \"72 %d div dup scale\\n\", PER_INCH);
@@ -3548,132 +3548,133 @@
/* Set up units of measurement. */
fprintf(fp, \"/inch {%d mul} def\\n\", PER_INCH);
- fputs(\"/pt {inch 72 div} def
-%
-%
-/tfont /Times-Bold findfont 12 pt scalefont def
-%
-/lfont /Times-Roman findfont 10 pt scalefont def
-%
-%tfont /FontBBox get
-% aload pop
-% tfont /FontMatrix get dtransform pop /tascent exch def
-% tfont /FontMatrix get dtransform pop neg /tdescent exch def
-lfont /FontBBox get
- aload pop
- lfont /FontMatrix get dtransform pop 0.65 mul /lascent exch def
- lfont /FontMatrix get dtransform pop neg /ldescent exch def
-% begin gdt mod
-% define font for xplot characters
-/BuildCharDict 10 dict def
-/Xplotfontdict 7 dict def
-Xplotfontdict begin
- /FontType 3 def
- /FontMatrix [1 0 0 1 0 0] def
- /FontBBox [-1 -1 1 1]def
- /Encoding 256 array def
- 0 1 255 {Encoding exch /.notdef put} for
- Encoding (.) 0 get /xplotfontdot put
- /CharacterDefs 3 dict def
- CharacterDefs /.notdef {} put
- CharacterDefs /xplotfontdot
- { newpath
- 0 0 1 0 360 arc fill
- } put
- /BuildChar
- { BuildCharDict begin
- /char exch def
- /fontdict exch def
- /charname fontdict /Encoding get
- char get def
- /charproc fontdict /CharacterDefs
- get charname get def
- 1 0 -1 -1 1 1 setcachedevice
- gsave charproc grestore
- end
- } def
-end
-/XplotFont Xplotfontdict definefont pop
-% scale font according to theta
-/dotsetup { /dotfont /XplotFont findfont 4 theta scalefont def } def
-% DONE gdt mod
-%define procedures for each xplot primitive.
-% x y x --
-/x {moveto 8 8 rlineto -16 -16 rlineto
- 8 8 rmoveto
- -8 8 rlineto 16 -16 rlineto} def
-% x y ?arrow --
-/darrow {moveto 8 theta 8 theta rmoveto -8 theta -8 theta rlineto
- -8 theta 8 theta rlineto } def
-/uarrow {moveto -8 theta -8 theta rmoveto 8 theta 8 theta rlineto
- 8 theta -8 theta rlineto } def
-/rarrow {moveto -8 theta 8 theta rmoveto 8 theta -8 theta rlineto
- -8 theta -8 theta rlineto } def
-/larrow {moveto 8 theta 8 theta rmoveto -8 theta -8 theta rlineto
- 8 theta -8 theta rlineto } def
-%x y x y line --
-/line {moveto lineto} def
-%x y dot --
-% begin gdt mod
-/dot { moveto dotfont setfont (.) show } def
-%/dot {stroke 8 theta 0 360 arc fill} def
-% end gdt mod
-%x y . --
-% begin gdt mod
-/. { moveto dotfont setfont (.) show } def
-%/. {stroke 8 theta 0 360 arc fill} def
-% end gdt mod
-%x y plus --
-/plus {moveto -8 theta 0 rmoveto 16 theta 0 rlineto
- -8 theta -8 theta rmoveto 0 16 theta rlineto} def
-%x y + --
-/+ {moveto -8 theta 0 rmoveto 16 theta 0 rlineto
- -8 theta -8 theta rmoveto 0 16 theta rlineto} def
-%x y box --
-/box {moveto -8 theta -8 theta rmoveto
- 16 theta 0 rlineto
- 0 16 theta rlineto
- -16 theta 0 rlineto
- 0 -16 theta rlineto} def
-%x y diamond --
-/diamond { moveto 0 theta 24 theta rmoveto
- -24 theta -24 theta rlineto
- 24 theta -24 theta rlineto
- 24 theta 24 theta rlineto
- -24 theta 24 theta rlineto} def
-%x y ?tick --
-/utick {moveto 0 6 theta rlineto} def
-/dtick {moveto 0 -6 theta rlineto} def
-/ltick {moveto -6 theta 0 rlineto} def
-/rtick {moveto 6 theta 0 rlineto} def
-/htick {moveto -6 theta 0 rmoveto 12 theta 0 rlineto} def
-/vtick {moveto 0 -6 theta rmoveto 0 12 theta rlineto} def
-%Separate functions for each text position.
-%x y string ?text --
-/space 6 pt def
-% Set the font, figure out the width.
-% x y string tsetup string x width y
-/tsetup {lfont setfont dup stringwidth pop exch
- 4 1 roll exch} def
-%CENTER
-/ctext {tsetup lascent 2 div sub
- 3 1 roll 2 div sub exch
-% stack should now be string x y
- moveto show} def
-%ABOVE
-/atext {tsetup space ldescent add add
- 3 1 roll 2 div sub exch moveto show} def
-%BELOW
-/btext {tsetup space lascent add sub
- 3 1 roll 2 div sub exch moveto show} def
-%TO_THE_LEFT
-/ltext {tsetup lascent 2 div sub
- 3 1 roll space add sub exch moveto show} def
-%TO_THE_RIGHT
-/rtext {tsetup lascent 2 div sub
- 3 1 roll pop space add exch moveto show} def
+ fputs(\"/pt {inch 72 div} def \\
+% \\
+% \\
+/tfont /Times-Bold findfont 12 pt scalefont def \\
+% \\
+/lfont /Times-Roman findfont 10 pt scalefont def \\
+% \\
+%tfont /FontBBox get \\
+% aload pop \\
+% tfont /FontMatrix get dtransform pop /tascent exch def \\
+% tfont /FontMatrix get dtransform pop neg /tdescent exch def \\
+lfont /FontBBox get \\
+ aload pop \\
+ lfont /FontMatrix get dtransform pop 0.65 mul /lascent exch def \\
+ lfont /FontMatrix get dtransform pop neg /ldescent exch def \\
+% begin gdt mod \\
+% define font for xplot characters \\
+/BuildCharDict 10 dict def \\
+/Xplotfontdict 7 dict def \\
+Xplotfontdict begin \\
+ /FontType 3 def \\
+ /FontMatrix [1 0 0 1 0 0] def \\
+ /FontBBox [-1 -1 1 1]def \\
+ /Encoding 256 array def \\
+ 0 1 255 {Encoding exch /.notdef put} for \\
+ Encoding (.) 0 get /xplotfontdot put \\
+ /CharacterDefs 3 dict def \\
+ CharacterDefs /.notdef {} put \\
+ CharacterDefs /xplotfontdot \\
+ { newpath \\
+ 0 0 1 0 360 arc fill \\
+ } put \\
+ /BuildChar \\
+ { BuildCharDict begin \\
+ /char exch def \\
+ /fontdict exch def \\
+ /charname fontdict /Encoding get \\
+ char get def \\
+ /charproc fontdict /CharacterDefs \\
+ get charname get def \\
+ 1 0 -1 -1 1 1 setcachedevice \\
+ gsave charproc grestore \\
+ end \\
+ } def \\
+end \\
+/XplotFont Xplotfontdict definefont pop \\
+% scale font according to theta \\
+/dotsetup { /dotfont /XplotFont findfont 4 theta scalefont def } def \\
+% DONE gdt mod \\
+%define procedures for each xplot primitive. \\
+% x y x -- \\
+/x {moveto 8 8 rlineto -16 -16 rlineto \\
+ 8 8 rmoveto \\
+ -8 8 rlineto 16 -16 rlineto} def \\
+% x y ?arrow -- \\
+/darrow {moveto 8 theta 8 theta rmoveto -8 theta -8 theta rlineto \\
+ -8 theta 8 theta rlineto } def \\
+/uarrow {moveto -8 theta -8 theta rmoveto 8 theta 8 theta rlineto \\
+ 8 theta -8 theta rlineto } def \\
+/rarrow {moveto -8 theta 8 theta rmoveto 8 theta -8 theta rlineto \\
+ -8 theta -8 theta rlineto } def \\
+/larrow {moveto 8 theta 8 theta rmoveto -8 theta -8 theta rlineto \\
+ 8 theta -8 theta rlineto } def \\
+%x y x y line -- \\
+/line {moveto lineto} def \\
+%x y dot -- \\
+% begin gdt mod \\
+/dot { moveto dotfont setfont (.) show } def \\
+%/dot {stroke 8 theta 0 360 arc fill} def \\
+% end gdt mod \\
+%x y . -- \\
+% begin gdt mod \\
+/. { moveto dotfont setfont (.) show } def \\
+%/. {stroke 8 theta 0 360 arc fill} def \\
+% end gdt mod \\
+%x y plus -- \\
+/plus {moveto -8 theta 0 rmoveto 16 theta 0 rlineto \\
+ -8 theta -8 theta rmoveto 0 16 theta rlineto} def \\
+%x y + -- \\
+/+ {moveto -8 theta 0 rmoveto 16 theta 0 rlineto \\
+ -8 theta -8 theta rmoveto 0 16 theta rlineto} def \\
+%x y box -- \\
+/box {moveto -8 theta -8 theta rmoveto \\
+ 16 theta 0 rlineto \\
+ 0 16 theta rlineto \\
+ -16 theta 0 rlineto \\
+ 0 -16 theta rlineto} def \\
+%x y diamond -- \\
+/diamond { moveto 0 theta 24 theta rmoveto \\
+ -24 theta -24 theta rlineto \\
+ 24 theta -24 theta rlineto \\
+ 24 theta 24 theta rlineto \\
+ -24 theta 24 theta rlineto} def \\
+%x y ?tick -- \\
+/utick {moveto 0 6 theta rlineto} def \\
+/dtick {moveto 0 -6 theta rlineto} def \\
+/ltick {moveto -6 theta 0 rlineto} def \\
+/rtick {moveto 6 theta 0 rlineto} def \\
+/htick {moveto -6 theta 0 rmoveto 12 theta 0 rlineto} def \\
+/vtick {moveto 0 -6 theta rmoveto 0 12 theta rlineto} def \\
+%Separate functions for each text position. \\
+%x y string ?text -- \\
+/space 6 pt def \\
+% Set the font, figure out the width. \\
+% x y string tsetup string x width y \\
+/tsetup {lfont setfont dup stringwidth pop exch \\
+ 4 1 roll exch} def \\
+%CENTER \\
+/ctext {tsetup lascent 2 div sub \\
+ 3 1 roll 2 div sub exch \\
+% stack should now be string x y \\
+ moveto show} def \\
+%ABOVE \\
+/atext {tsetup space ldescent add add \\
+ 3 1 roll 2 div sub exch moveto show} def \\
+%BELOW \\
+/btext {tsetup space lascent add sub \\
+ 3 1 roll 2 div sub exch moveto show} def \\
+%TO_THE_LEFT \\
+/ltext {tsetup lascent 2 div sub \\
+ 3 1 roll space add sub exch moveto show} def \\
+%TO_THE_RIGHT \\
+/rtext {tsetup lascent 2 div sub \\
+ 3 1 roll pop space add exch moveto show} def \\
\", fp);
+
{
int i;
@@ -3718,9 +3719,9 @@
if (state == PRINTING) {
fputs(\"-90 rotate -11 inch 0 inch translate\\n\", fp);
} else {
- fputs(\"
-/notintex { currentdict userdict eq } def
-notintex { 1.5 inch 5.0 inch translate } if
+ fputs(\" \\
+/notintex { currentdict userdict eq } def \\
+notintex { 1.5 inch 5.0 inch translate } if \\
\", fp);
}
/* Move origin to create left & bottom margins. */
Index: signed.c
===================================================================
--- signed.c (revision 1)
+++ signed.c (revision 3)
@@ -31,7 +31,7 @@
to preserve same.
*/
#include <math.h>
-#include <malloc.h>
+#include <stdlib.h>
#include <stdio.h>
#include \"xplot.h\"
Index: double.c
===================================================================
--- double.c (revision 1)
+++ double.c (revision 3)
@@ -31,7 +31,7 @@
to preserve same.
*/
#include <math.h>
-#include <malloc.h>
+#include <stdlib.h>
#include <stdio.h>
#include \"xplot.h\"
Index: unsigned.c
===================================================================
--- unsigned.c (revision 1)
+++ unsigned.c (revision 3)
@@ -31,7 +31,7 @@
to preserve same.
*/
#include <math.h>
-#include <malloc.h>
+#include <stdlib.h>
#include \"xplot.h\"
#include <stdio.h>
This archive was generated by hypermail 2.1.7 : 08/13/03 EDT