dpic_2014.01.01+dfsg1/000755 001750 001750 00000000000 12276425175 015620 5ustar00scarlettscarlett000000 000000 dpic_2014.01.01+dfsg1/examples/000755 001750 001750 00000000000 11517605766 017441 5ustar00scarlettscarlett000000 000000 dpic_2014.01.01+dfsg1/examples/README000644 001750 001750 00000000643 11335032323 020301 0ustar00scarlettscarlett000000 000000 The file Examples.txt contains a minimal example of each of the different output modes of dpic. In each case, the input file, LaTeX file, and processing commands are given. In a Unix-like environment, the modes can be tested by typing one of make make epic make pstricks make pgf make pdf make mfpic make psfrag make postscript make overlay make metapost make xfig make svg Typing make clean deletes unneeded files. dpic_2014.01.01+dfsg1/examples/sources/000755 001750 001750 00000000000 10415071202 021076 5ustar00scarlettscarlett000000 000000 dpic_2014.01.01+dfsg1/examples/sources/diag8.pic000644 001750 001750 00000000506 10262527230 022577 0ustar00scarlettscarlett000000 000000 verbatimtex \documentclass[11pt]{article} \usepackage{times} \begin{document} etex .PS arrow "$u$" above S: circle rad 10/72.27 # 10 pt line right 0.35 G: box "$G(s)$" arrow "$y$" above line down G.ht from last arrow then left last arrow.c.x-S.x then to S.s "$-\;$" below rjust arrow <- down 0.1 from S.s .PE end dpic_2014.01.01+dfsg1/examples/sources/test8.tex000644 001750 001750 00000000147 10262514136 022701 0ustar00scarlettscarlett000000 000000 \documentclass{article} \usepackage{graphicx} \begin{document} \includegraphics{diag.1} \end{document} dpic_2014.01.01+dfsg1/examples/sources/diagB.pic000644 001750 001750 00000000267 10262512242 022612 0ustar00scarlettscarlett000000 000000 .PS B: "\includegraphics{diag.eps}" wid 172/72 ht 54/72 "$u$" at B.sw + (0.25,0.6) "$G(s)$" at B.sw + (1.5,0.5) "$y$" at B.sw + (2.13,0.6) "$-$" at B.sw + (0.55,0.6-0.30) .PE dpic_2014.01.01+dfsg1/examples/sources/diag6.pic000644 001750 001750 00000000502 10262506642 022575 0ustar00scarlettscarlett000000 000000 .PS command "/Times-Italic findfont 11 scalefont setfont" arrow "u" above S: circle rad 10/72.27 # 10 pt line right 0.35 G: box "G(s)" arrow "y" above line down G.ht from last arrow then left last arrow.c.x-S.x then to S.s move down 0.05 left 0.15; "" command "(\261) show" arrow <- down 0.1 from S.s .PE dpic_2014.01.01+dfsg1/examples/sources/diag2.pic000644 001750 001750 00000000366 10262320652 022574 0ustar00scarlettscarlett000000 000000 .PS arrow "$u$" above S: circle rad 10/72.27 # 10 pt line right 0.35 G: box "$G(s)$" arrow "$y$" above line dotted down G.ht from last arrow then left last arrow.c.x-S.x then to S.s "$-\;$" below rjust arrow <- down 0.1 from S.s .PE dpic_2014.01.01+dfsg1/examples/sources/test4.tex000644 001750 001750 00000000203 10262321501 022656 0ustar00scarlettscarlett000000 000000 \documentclass{article} \usepackage{mfpic} \begin{document} \opengraphsfile{tst-mfpic} \input diag \closegraphsfile \end{document} dpic_2014.01.01+dfsg1/examples/sources/diag1.pic000644 001750 001750 00000000325 10262530244 022566 0ustar00scarlettscarlett000000 000000 .PS arrow "$u$" above S: circle rad 10/72.27 # 10 pt line right 0.35 G: box "$G(s)$" arrow "$y$" above line -> down G.ht from last arrow then left last arrow.c.x-S.x then to S.s "$-\;$" below rjust .PE dpic_2014.01.01+dfsg1/examples/sources/diag5.pic000644 001750 001750 00000000357 10262322063 022575 0ustar00scarlettscarlett000000 000000 .PS arrow "$u$" above S: circle rad 10/72.27 # 10 pt line right 0.35 G: box "$G(s)$" arrow "$y$" above line down G.ht from last arrow then left last arrow.c.x-S.x then to S.s "$-\;$" below rjust arrow <- down 0.1 from S.s .PE dpic_2014.01.01+dfsg1/examples/sources/diag9.pic000644 001750 001750 00000000313 10262545517 022604 0ustar00scarlettscarlett000000 000000 .PS arrow "u" above S: circle rad 10/72.27 # 10 pt line right 0.35 G: box "G(s)" arrow "y" above line -> down G.ht from last arrow then left last arrow.c.x-S.x then to S.s "-" below rjust .PE dpic_2014.01.01+dfsg1/examples/sources/test6.tex000644 001750 001750 00000000145 10262322340 022667 0ustar00scarlettscarlett000000 000000 \documentclass{article} \usepackage{graphicx} \begin{document} \includegraphics{diag} \end{document} dpic_2014.01.01+dfsg1/examples/sources/test9.tex000644 001750 001750 00000000126 10415071200 022665 0ustar00scarlettscarlett000000 000000 \documentclass{article} \usepackage{tikz} \begin{document} \input diag \end{document} dpic_2014.01.01+dfsg1/examples/sources/diagA.pic000644 001750 001750 00000000257 10262515340 022612 0ustar00scarlettscarlett000000 000000 .PS arrow S: circle rad 10/72.27 line right 0.35 G: box arrow line down G.ht from last arrow then left last arrow.c.x-S.x then to S.s arrow <- down 0.1 from S.s .PE dpic_2014.01.01+dfsg1/examples/sources/test1.tex000644 001750 001750 00000000120 10262320254 022655 0ustar00scarlettscarlett000000 000000 \documentclass{article} \begin{document} \input diag \end{document} dpic_2014.01.01+dfsg1/examples/sources/test2.tex000644 001750 001750 00000000137 10262320703 022665 0ustar00scarlettscarlett000000 000000 \documentclass{article} \usepackage{epic,eepicemu} \begin{document} \input diag \end{document} dpic_2014.01.01+dfsg1/examples/sources/test7.tex000644 001750 001750 00000000143 10262510334 022670 0ustar00scarlettscarlett000000 000000 \documentclass{article} \usepackage{pstricks,graphicx} \begin{document} \input diag \end{document} dpic_2014.01.01+dfsg1/examples/sources/test3.tex000644 001750 001750 00000000132 10262321255 022664 0ustar00scarlettscarlett000000 000000 \documentclass{article} \usepackage{pstricks} \begin{document} \input diag \end{document} dpic_2014.01.01+dfsg1/examples/sources/test5.tex000644 001750 001750 00000000202 10262322301 022655 0ustar00scarlettscarlett000000 000000 \documentclass{article} \usepackage{graphicx} \usepackage[scanall]{psfrag} \begin{document} \includegraphics{diag} \end{document} dpic_2014.01.01+dfsg1/examples/sources/diag3.pic000644 001750 001750 00000000357 10262321206 022571 0ustar00scarlettscarlett000000 000000 .PS arrow "$u$" above S: circle rad 10/72.27 # 10 pt line right 0.35 G: box "$G(s)$" arrow "$y$" above line down G.ht from last arrow then left last arrow.c.x-S.x then to S.s "$-\;$" below rjust arrow <- down 0.1 from S.s .PE dpic_2014.01.01+dfsg1/examples/Makefile000644 001750 001750 00000003452 11517602734 021075 0ustar00scarlettscarlett000000 000000 DPIC = dpic # DPIC = $$HOME/dpic/test/dpic nooption: cp sources/diag1.pic diag.pic cp sources/test1.tex tst.tex $(DPIC) diag.pic > diag.tex # latex tst # dvips -Ppdf tst.dvi all: nooption epic pstricks pgf pdf mfpic psfrag postscript overlay metapost \ xfig svg epic: cp sources/diag2.pic diag.pic cp sources/test2.tex tst.tex $(DPIC) -t diag.pic > diag.tex latex tst dvips -Ppdf tst.dvi pstricks: cp sources/diag1.pic diag.pic cp sources/test3.tex tst.tex $(DPIC) -p diag.pic > diag.tex latex tst dvips -Ppdf tst.dvi pgf: cp sources/diag1.pic diag.pic cp sources/test9.tex tst.tex $(DPIC) -g diag.pic > diag.tex latex tst dvips -Ppdf tst.dvi pdf: cp sources/diag1.pic diag.pic cp sources/test9.tex tst.tex $(DPIC) -g diag.pic > diag.tex pdflatex tst mfpic: cp sources/diag1.pic diag.pic cp sources/test4.tex tst.tex $(DPIC) -m diag.pic > diag.tex latex tst mf tst-mfpic latex tst dvips tst.dvi psfrag: cp sources/diag1.pic diag.pic cp sources/test5.tex tst.tex $(DPIC) -f diag.pic > diag.eps latex tst dvips -Ppdf tst postscript: cp sources/diag6.pic diag.pic cp sources/test6.tex tst.tex $(DPIC) -r diag.pic > diag.eps latex tst dvips -Ppdf tst svg: cp sources/diag6.pic diag.pic cp sources/test6.tex tst.tex $(DPIC) -v diag.pic > tst.svg overlay: $(DPIC) -r sources/diagA.pic > diag.eps $(DPIC) -p sources/diagB.pic > diag.tex cp sources/test7.tex tst.tex latex tst dvips -Ppdf tst.dvi metapost: cp sources/diag8.pic diag.pic cp sources/test8.tex tst.tex $(DPIC) -s diag.pic > diag.mp mpost --tex=latex diag.mp latex tst dvips -Ppdf tst xfig: cp sources/diag9.pic diag.pic $(DPIC) -x diag.pic > diag.fig clean: rm -f *.ps *.eps *.dvi *.log *.mp *.1 mpxerr* *pk *gf *.mpx *.dim *.mf rm -f *.tfm *.aux *.pfg tst.tex diag.pic diag.tex *.trace *.fig *.pdf *.svg dpic_2014.01.01+dfsg1/examples/Examples.txt000644 001750 001750 00000017440 11335021647 021752 0ustar00scarlettscarlett000000 000000 This file contains minimal examples of simple diagrams generated by each of the output options of dpic. In each case except the last two a postscript file is produced that can be viewed using gsview. Example 11 produces an svg file that can be viewed by most browsers, but Internet Explorer requires an svg viewer plug-in such as the Adobe svg viewer. Consult the appropriate manual for processing mfpic, PStricks, MetaPost, TikZ-PGP, or psfrag output. ======================================================================== EXAMPLE 1: LaTeX Picture Commands: LaTeX provides a primitive drawing capability by placing characters from special fonts. Dpic automates the tedious coordinate calculations, but drawings are still limited to the boxes, ovals, and lines of restricted slope provided by the fonts. Diagram source file diag.pic: .PS arrow "$u$" above S: circle rad 10/72.27 # 10 pt line right 0.35 G: box "$G(s)$" arrow "$y$" above line down G.ht from last arrow then left last arrow.c.x-S.x arrow to S.s "$-\;$" below rjust .PE LaTeX file tst.tex: \documentclass{article} \begin{document} \input diag \end{document} Commands: dpic diag.pic > diag.tex latex tst dvips -Ppdf tst.dvi Result: tst.ps ======================================================================== EXAMPLE 2: LaTeX Picture Commands with epic and eepicemu: Diagram source file diag.pic: .PS arrow "$u$" above S: circle rad 10/72.27 # 10 pt line right 0.35 G: box "$G(s)$" arrow "$y$" above line dotted down G.ht from last arrow then left last arrow.c.x-S.x then to S.s "$-\;$" below rjust arrow <- down 0.1 from S.s .PE LaTeX file tst.tex: \documentclass{article} \usepackage{epic,eepicemu} \begin{document} \input diag \end{document} Commands: dpic -t diag.pic > diag.tex latex tst dvips -Ppdf tst.dvi Result: tst.ps The feedback path has been dotted in this example, requiring the explicit arrowhead below the circle. ======================================================================== EXAMPLE 3: PSTricks output. Diagram source file diag.pic: .PS arrow "$u$" above S: circle rad 10/72.27 # 10 pt line right 0.35 G: box "$G(s)$" arrow "$y$" above line down G.ht from last arrow then left last arrow.c.x-S.x then to S.s "$-\;$" below rjust arrow <- down 0.1 from S.s .PE LaTeX file tst.tex: \documentclass{article} \usepackage{pstricks} \begin{document} \input diag \end{document} Commands: dpic -p diag.pic > diag.tex latex tst dvips -Ppdf tst.dvi ======================================================================== EXAMPLE 4: TikZ-PGF output to produce either postscript or pdf. Diagram source file diag.pic: .PS arrow "$u$" above S: circle rad 10/72.27 # 10 pt line right 0.35 G: box "$G(s)$" arrow "$y$" above line down G.ht from last arrow then left last arrow.c.x-S.x then to S.s "$-\;$" below rjust arrow <- down 0.1 from S.s .PE LaTeX file tst.tex: \documentclass{article} \usepackage{tikz} \begin{document} \input diag \end{document} Commands to produce tst.ps: dpic -g diag.pic > diag.tex latex tst dvips -Ppdf tst.dvi Commands to produce tst.pdf: dpic -g diag.pic > diag.tex pdflatex tst ======================================================================== EXAMPLE 5: Mfpic output. Diagram source file as above. LaTeX file tst.tex: \documentclass{article} \usepackage{mfpic} \begin{document} \opengraphsfile{tst-mfpic} \input diag \closegraphsfile \end{document} Commands: dpic -m diag.pic > diag.tex latex tst mf tst-mfpic latex tst dvips tst.dvi The mf command creates a new font tst-mfpic, containing one character in this example. To see the font characters, type "tex testfont" and at the prompts, type "tst-mfpic", "\table", and "\end". Then "dvips testfont" creates testfont.ps. Notice that the font character contains the lines of the diagram but not the labels. ======================================================================== EXAMPLE 6: Postscript output with psfrag strings. Diagram source file as above. LaTeX file tst.tex: \documentclass{article} \usepackage{graphicx} \usepackage[scanall]{psfrag} \begin{document} \includegraphics{diag} \end{document} Commands: dpic -f diag.pic > diag.eps latex tst dvips -Ppdf tst ======================================================================== EXAMPLE 7: Raw postscript output Diagram source file diag.pic: .PS command "/Times-Italic findfont 11 scalefont setfont" arrow "u" above S: circle rad 10/72.27 # 10 pt line right 0.35 G: box "G(s)" arrow "y" above line down G.ht from last arrow then left last arrow.c.x-S.x then to S.s move down 0.05 left 0.15; "" command "(\261) show" arrow <- down 0.1 from S.s .PE LaTeX file tst.tex: \documentclass{article} \usepackage{graphicx} \begin{document} \includegraphics{diag} \end{document} Commands: dpic -r diag.pic > diag.eps latex tst dvips -Ppdf tst Postscript code to select the font and to position and print the minus sign have been manually inserted using "command", since diag.eps is produced without any automatic text formatting. This is not practical for complicated labels. ======================================================================== EXAMPLE 8: Raw postscript output with overlaid labels Diagram source file diagA.pic containing no labels: .PS arrow S: circle rad 10/72.27 line right 0.35 G: box arrow line down G.ht from last arrow then left last arrow.c.x-S.x then to S.s arrow <- down 0.1 from S.s .PE Diagram source file diagB.pic containing only labels: .PS B: "\includegraphics{diag.eps}" wid 172/72 ht 54/72 "$u$" at B.sw + (0.25,0.6) "$G(s)$" at B.sw + (1.5,0.5) "$y$" at B.sw + (2.13,0.6) "$-$" at B.sw + (0.55,0.6-0.30) .PE LaTeX file tst.tex: \documentclass{article} \usepackage{pstricks,graphicx} \begin{document} \input diag \end{document} Commands: dpic -r diagA.pic > diag.eps dpic -p diagB.pic > diag.tex latex tst dvips -Ppdf tst.dvi The .eps file contains no text strings but contains the line %%BoundingBox: 0 -36 172 18 from which its width is 172-0 pt and its height is 18-(-36)=54 pt. The locations of the labels have to be known in diagB.pic but they can be calculated automatically as well as manually in this simple example. ======================================================================== EXAMPLE 9: MetaPost output: Diagram source file diag.pic: verbatimtex \documentclass[11pt]{article} \usepackage{times} \begin{document} etex .PS arrow "$u$" above S: circle rad 10/72.27 # 10 pt line right 0.35 G: box "$G(s)$" arrow "$y$" above line down G.ht from last arrow then left last arrow.c.x-S.x then to S.s "$-\;$" below rjust arrow <- down 0.1 from S.s .PE end LaTeX file tst.tex: \documentclass{article} \usepackage{graphicx} \begin{document} \includegraphics{diag.1} \end{document} Commands: dpic -s diag.pic > diag.mp mpost --tex=latex diag.mp latex tst dvips -Ppdf tst ======================================================================== EXAMPLE 10: Xfig output: Diagram source file diag.pic: .PS arrow "u" above S: circle rad 10/72.27 # 10 pt line right 0.35 G: box "G(s)" arrow "y" above line -> down G.ht from last arrow then left last arrow.c.x-S.x then to S.s "-" below rjust .PE Commands: dpic -x diag.pic > diag.fig The file diag.fig can then be read by xfig version 3.2 or later. ======================================================================== EXAMPLE 11: SVG output: Diagram source file diag.pic: .PS arrow "u" above S: circle rad 10/72.27 # 10 pt line right 0.35 G: box "G(s)" arrow "y" above line -> down G.ht from last arrow then left last arrow.c.x-S.x then to S.s "-" below rjust .PE Commands: dpic -v diag.pic > diag.svg The file diag.svg can then be read by a browser or svg viewer plugin. dpic_2014.01.01+dfsg1/dpic.c000644 001750 001750 00001523736 12261053740 016711 0ustar00scarlettscarlett000000 000000 /* Output from p2c, the Pascal-to-C translator */ /* From input file "" */ /* dpic translator program. The p2c-dependent, debugging-dependent, and machine-dependent comment symbols are stripped out by the makefile or by p2c */ /* BSD Licence: Copyright (c) 2014, J. D. Aplevich All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "p2c.h" #include /*D,log D*/ /*X program dpic(input,output); X*/ /* exit label for parser errors */ /* include dp0.h */ /* dp0.x */ /* Global definitions */ /* Some PC versions of p2c crash on Pascal const declarations at low levels. All consts should be in dp0.x */ #define Version "dpic version 2014.Jan.01" /* UMBX distmax = 1E25; XBMU */ #define distmax 3.40282347e+38 /* assumes at least IEEE single */ /*DM MaxReal = distmax; MD*/ /*GH distmax = MaxReal; HG*/ #define mdistmax (-distmax) #define pi 3.1415926535897931 #define ln10 2.3025850929940459 #define SVGPX 90 /* SVG pixels per inch */ /*UGH maxint = 2147483647; HGU*/ #define randmax SHORT_MAX #if defined RAND_MAX #undef randmax #define randmax RAND_MAX #endif #define HASHLIM 7 /* Hash array len for variable names */ /* Parser constants */ #define next 1 #define kind 2 #define symb 3 #define err 4 #define rs 3 #define prod 4 #define lb 3 /* include parscst.i */ #define symbmax 242 #define prodmax 180 #define lrmax 4760 #define lxmax 459 /*B%include parscstB*/ /* include parscdc.i */ #define METAGOAL1 0 #define input1 1 #define input2 2 #define picture1 3 #define picture2 4 #define NL1 5 #define NL2 6 #define start1 7 #define start2 8 #define start3 9 #define elementlist1 10 #define elementlist2 11 #define elementlist3 12 #define term1 13 #define term2 14 #define term3 15 #define term4 16 #define element1 17 #define element2 18 #define element3 19 #define element4 20 #define element5 21 #define element6 22 #define element7 23 #define element8 24 #define element9 25 #define element10 26 #define element11 27 #define element12 28 #define lbrace1 29 #define namedobj1 30 #define namedobj2 31 #define suffix1 32 #define suffix2 33 #define position1 34 #define position2 35 #define position3 36 #define position4 37 #define assignlist1 38 #define assignlist2 39 #define command1 40 #define command2 41 #define command3 42 #define command4 43 #define command5 44 #define command6 45 #define command7 46 #define command8 47 #define command9 48 #define command10 49 #define optnl1 50 #define optnl2 51 #define ifpart1 52 #define elsehead1 53 #define for1 54 #define for2 55 #define stringexpr1 56 #define stringexpr2 57 #define string1 58 #define string2 59 #define assignment1 60 #define assignment2 61 #define assignment3 62 #define assignment4 63 #define expression1 64 #define expression2 65 #define expression3 66 #define expression4 67 #define expression5 68 #define ifhead1 69 #define setlogic1 70 #define logexpr1 71 #define logexpr2 72 #define forhead1 73 #define forincr1 74 #define do1 75 #define do2 76 #define by1 77 #define by2 78 #define redirect1 79 #define redirect2 80 #define redirect3 81 #define resetlist1 82 #define resetlist2 83 #define defhead1 84 #define defhead2 85 #define sprintf1 86 #define sprintf2 87 #define exprlist1 88 #define exprlist2 89 #define object1 90 #define object2 91 #define object3 92 #define object4 93 #define object5 94 #define object6 95 #define object7 96 #define object8 97 #define object9 98 #define object10 99 #define object11 100 #define object12 101 #define object13 102 #define object14 103 #define object15 104 #define object16 105 #define object17 106 #define object18 107 #define object19 108 #define object20 109 #define object21 110 #define object22 111 #define object23 112 #define object24 113 #define object25 114 #define object26 115 #define object27 116 #define openblock1 117 #define block1 118 #define block2 119 #define block3 120 #define block4 121 #define optexp1 122 #define optexp2 123 #define closeblock1 124 #define objectwith1 125 #define objectwith2 126 #define objectwith3 127 #define pair1 128 #define pair2 129 #define nth1 130 #define nth2 131 #define nth3 132 #define primobj1 133 #define primobj2 134 #define primobj3 135 #define primobj4 136 #define shift1 137 #define shift2 138 #define shift3 139 #define location1 140 #define location2 141 #define location3 142 #define location4 143 #define location5 144 #define place1 145 #define place2 146 #define place3 147 #define place4 148 #define place5 149 #define factor1 150 #define factor2 151 #define factor3 152 #define placename1 153 #define placename2 154 #define placename3 155 #define placename4 156 #define ncount1 157 #define ncount2 158 #define ncount3 159 #define logprod1 160 #define logprod2 161 #define logval1 162 #define logval2 163 #define logval3 164 #define lcompare1 165 #define lcompare2 166 #define lcompare3 167 #define lcompare4 168 #define primary1 169 #define primary2 170 #define primary3 171 #define primary4 172 #define primary5 173 #define primary6 174 #define primary7 175 #define primary8 176 #define primary9 177 #define primary10 178 #define primary11 179 #define primary12 180 /* include lxcst.h */ /*D XAND = 36; D*/ #define XBLOCK 26 #define XLBRACKET 21 #define XRBRACKET 22 #define XCOMMENT 42 #define XLcolrspec 138 #define XLcolour 139 #define XCOLON 20 #define XD 25 #define XDOUBLEHEAD 151 #define XDc 98 #define XDe 94 #define XDend 97 #define XDn 92 #define XDne 88 #define XDnw 90 #define XDs 93 #define XDse 89 #define XDstart 96 #define XDsw 91 #define XDw 95 #define XEMPTY 2 #define XEND 45 #define XEQEQ 100 #define XEQ 29 #define XGE 102 #define XLE 103 #define XERROR 3 #define XFOR 83 #define XGT 104 #define XLBRACE 23 #define XLEFTHEAD 149 #define XLT 4 #define XLabel 39 #define XLabove 146 #define XLabs 113 #define XLacos 114 #define XLarc 161 #define XLarcrad 167 #define XLarg 43 #define XLarrow 163 #define XLarrowhd 148 #define XLarrowhead 184 #define XLarrowht 168 #define XLarrowwid 169 #define XLasin 115 #define XLat 54 #define XLatan2 128 #define XLbelow 147 #define XLbox 158 #define XLboxht 170 #define XLboxrad 171 #define XLboxwid 172 #define XLccw 6 #define XLcenter 143 #define XLchop 59 #define XLcircle 159 #define XLcirclerad 173 #define XLcoloneq 30 #define XLcontinue 58 #define XLcorner 87 #define XLcos 116 #define XLcw 5 #define XLdashed 135 #define XLdashwid 174 #define XLdefine 78 #define XLdiameter 109 #define XLdirecton 152 #define XLdiveq 34 #define XLdo 84 #define XLdotted 134 #define XLdown 154 #define XLellipse 160 #define XLellipseht 175 #define XLellipsewid 176 #define XLelse 82 #define XLendfor 85 #define XLenvvar 166 #define XLexp 117 #define XLexpe 118 #define XLfillval 185 #define XLfloat 37 #define XLfloor 126 #define XLfrom 52 #define XLfunc1 112 #define XLfunc2 127 #define XLheight 106 #define XLint 119 #define XLinvis 136 #define XLlastenv 189 #define XLlastsc 183 #define XLleft 156 #define XLlength 111 #define XLline 162 #define XLlineht 177 #define XLlinethick 186 #define XLlinetype 132 #define XLlinewid 178 #define XLljust 144 #define XLlog 120 #define XLloge 121 #define XLcompare 99 #define XLmax 129 #define XLmaxpsht 187 #define XLmaxpswid 188 #define XLmin 130 #define XLminuseq 32 #define XLmove 164 #define XLmoveht 179 #define XLmovewid 180 #define XLmulteq 33 #define XLname 38 #define XLoutlined 140 #define XLparam 105 #define XLpath 137 #define XLpluseq 31 #define XLpmod 131 #define XLprimitiv 157 #define XLradius 108 #define XLremeq 35 #define XLright 155 #define XLrjust 145 #define XLscale 189 #define XLshaded 141 #define XLsign 122 #define XLsin 123 #define XLsolid 133 #define XLspline 165 #define XLsqrt 124 #define XLstring 41 #define XLtan 125 #define XLtextht 181 #define XLtextoffset 182 #define XLtextpos 142 #define XLtextwid 183 #define XLthen 57 #define XLthickness 110 #define XLto 53 #define XLaTeX 40 #define XLundefine 79 #define XLup 153 #define XLwidth 107 #define XNEQ 101 #define XNOT 16 #define XNL 14 #define XRBRACE 24 #define XRIGHTHEAD 150 #define XSEMICOLON 14 #define XSTAR 9 #define XSTART 44 #define XANDAND 17 #define XOROR 18 #define Xlparen 7 #define Xrparen 8 #define Xplus 10 #define Xcomma 19 #define Xminus 11 #define XSLASH 12 /* Machine constants */ #define ordMINCH 0 /* first element of type character */ /* last element of type character, newline, tab, CR, ETX */ #define ordMAXCH 255 #define ordNL 10 #define ordTAB 9 #define ordCR 13 #define ordETX 3 /*B ordMAXCH = 255; ordNL = 37; ordTAB = 5; ordCR = 13; ordETX = 3 B*/ #define maxbval 16383 /* must be > CHBUFSIZ-2 */ /* Lexical parameters */ #define CHBUFSIZ 4095 /* size of chbuf arrays, input record */ #define FILENAMELEN 1024 /* max length of file names */ #define DFONT 11 /* default svg textht, pt; should be adj*/ #define TEXTRATIO 1.6 /* baseline to text height ratio */ /* Lalr machine parameters */ #define STACKMAX 255 /* size of attstack and parsestack */ #define REDUMAX 128 /* size of reduction buffer */ #define ERRMAX 3 /* max no of error messages per line */ #define MAXERRCOUNT 3 /* max no of errors before giving up */ /* Lexical types */ typedef short chbufinx; typedef uchar symbol; typedef short lxinx; typedef uchar production; typedef Char chbufarray[CHBUFSIZ + 1]; typedef Char mstring[FILENAMELEN]; /* Environment variable index */ /*GH1HG*/ typedef uchar environx; /* Lalr machine types */ typedef uchar stackinx; typedef short redubufrange; typedef struct reduelem { /* packed */ /*D oldtop, D*/ stackinx newtop; production prod_; } reduelem; /* Message types */ typedef char errmsginx; #define TeX 0 #define tTeX 1 #define PSTricks 2 #define MFpic 3 #define MPost 4 #define PGF 5 #define PS 6 #define PSfrag 7 #define pict2e 8 #define xfig 9 #define SVG 10 /* Production types */ /*,PSmps*/ /* For storing names */ typedef struct nametype { Char *segmnt; chbufinx seginx, len; double val; struct nametype *next_; } nametype; /* Lexical input for loops and macros */ typedef struct fbuffer { Char *carray; int savedlen, readx, attrib; struct fbuffer *higherb, *prevb, *nextb; } fbuffer; /* Macro argument list pointer */ typedef struct arg { fbuffer *argbody; struct arg *higherb, *nextb; } arg; /* Pic position */ typedef struct postype { /* packed */ double xpos, ypos; } postype; typedef double envarray[XLlastenv - XLenvvar]; /* maybe textp should be a primitivep to allow text to have the full properties of boxes */ /* To save some space: shadedp: box, circle, ellipse outlinep: box, circle, ellipse, line, arc, spline textp: not for block */ typedef struct primitive { nametype *name, *textp, *outlinep, *shadedp; struct primitive *parent, *son, *next_; postype aat; double lparam, lthick; int direction, spec, ptype; union { struct { double boxheight, boxwidth, boxfill, boxradius; } Ubox; struct { double blockheight, blockwidth; postype here; nametype *vars[HASHLIM + 1]; int nvars[HASHLIM + 1]; double *env; } Ublock; struct { double cfill, radius; } Ucircle; struct { double elheight, elwidth, efill; } Uellipse; struct { /* XLarc:( endpos.xpos,endpos.ypos: real ); endpos.xpos, endpos.ypos */ postype endpos; double height, width, lfill, aradius; int atype; } Uline; } UU; } primitive; /* To force optimum dynamic storage of primitives: */ typedef struct XLboxprimitive { nametype *name, *textp, *outlinep, *shadedp; primitive *parent, *son, *next_; postype aat; double lparam, lthick; int direction, spec, ptype; union { struct { double boxheight, boxwidth, boxfill, boxradius; } Ubox; } UU; } XLboxprimitive; typedef struct XLcircleprimitive { nametype *name, *textp, *outlinep, *shadedp; primitive *parent, *son, *next_; postype aat; double lparam, lthick; int direction, spec, ptype; union { struct { double cfill, radius; } Ucircle; } UU; } XLcircleprimitive; typedef struct XLellipseprimitive { nametype *name, *textp, *outlinep, *shadedp; primitive *parent, *son, *next_; postype aat; double lparam, lthick; int direction, spec, ptype; union { struct { double elheight, elwidth, efill; } Uellipse; } UU; } XLellipseprimitive; typedef struct XLlineprimitive { nametype *name, *textp, *outlinep, *shadedp; primitive *parent, *son, *next_; postype aat; double lparam, lthick; int direction, spec, ptype; union { struct { postype endpos; double height, width, lfill, aradius; int atype; } Uline; } UU; } XLlineprimitive; typedef struct XLabelprimitive { nametype *name, *textp, *outlinep, *shadedp; primitive *parent, *son, *next_; postype aat; double lparam, lthick; int direction, spec, ptype; } XLabelprimitive; /* Attribute stack types */ typedef struct attribute { chbufinx chbufx; int length; primitive *prim, *root; nametype *varname; double xval, yval, startchop, endchop; int lexval, state; } attribute; typedef attribute attstacktype[STACKMAX + 1]; /* Parser types */ typedef struct stackelm { stackinx link; int table; } stackelm; typedef stackelm tparsestack[STACKMAX + 1]; typedef struct _REC_errmsg { int no, col, symb_; } _REC_errmsg; /*BX def XB*/ /* Machine-dependent characters */ Char tabch, nlch, crch, etxch; /* File names */ FILE *input, *output, *errout; /*G asmname 'std_err'; G*/ FILE *copyin; /*G asmname 'copy_in'; G*/ FILE *redirect; /*G asmname 'redi_rect'; G*/ /*D log: text; D*/ /*DG asmname 'log_file'; GD*/ mstring infname; /* name of current input file */ mstring outfnam; /* name of current output file */ /*X infname: string; X*/ boolean inputeof; /* end of input flag */ boolean forbufend; /* end of for buffer */ int argct; /* argument counter for options */ char drawmode; /* output conversion */ boolean safemode; /* disable sh and copy */ /*D oflag: integer; D*/ /* Lexical analyzer character buffer */ /* chbuf: strptr; */ Char *chbuf; chbufinx chbufi, oldbufi; /* character buffer index */ /* Lexical variables */ Char ch; /* current character */ short newsymb; /* current lexical symbol */ int lexstate, lexsymb; _REC_errmsg errmsg[ERRMAX + 1]; boolean inlogic; /* set < to in context */ boolean instr; /* set while reading a string */ fbuffer *inbuf, *savebuf, *freeinbuf; /* Error handling */ int errcount; /* becomes nonzero when errors found */ errmsginx errmp; /* index of error messages in errmsg */ int lineno; /* current input line number */ /* Production variables */ attribute *attstack; /*D stackhigh: integer;D*/ redubufrange reduinx, redutop; reduelem redubuf[REDUMAX + REDUMAX + 1]; /* reduction buffer */ double floatvalue; /* numerical value of floats read */ primitive *envblock; double north, south, east, west; /* compass corners of a primitive */ double xfheight; /* for calculating xfig coordinates */ Char *freeseg; /* segment open to store strings */ short freex; /* next free location */ Char *tmpbuf; /* buffer for snprintf or sprintf */ double scale, fsc; /* scale factor and final scale factor*/ int splcount, spltot; /* spline depth counter */ primitive *snode; /* temporary node storage */ boolean sfill; /* fill flag for linear objects */ double vfill; /* fill value */ nametype *sshade, *soutline; /* temp values for linear objects */ double lastfillval; /* last-used fill density */ double lastthick; /* last-used line thickness */ int printstate; /* for passing output state info */ postype splineend; /* tmp storage for svg spline */ /* Global tables for easy C conversion. Alternative: use run-time space */ short lr[lrmax + 1]={ 0, 5,1, 0, 0, 0, 10,6, 0, -1, 15,3745,1, 1, 1, 0, 20,1, 44, 7, 25, 580,2, 16,151, 30, 575,2, 166,169, 35, 565,2, 38,170, 40, 555,2, 37,171, 45, 415,2, 7,172, 50, 325,2, 80,176, 55, 315,2, 112,178, 60, 305,2, 127,179, 65, 285,2, 39,153, 70, 210,2, 87,147, 75, 205,2, 66,149, 80, 180,2, 68,132, 85, 175,2, 27,158, 90, 95,2, 23,159, 0,4486,4, 0, 7, 100, 670,1, 10, 2, 105, 615,1, 11, 66, 110, 580,1, 16,151, 115, 575,1, 166,169, 120, 565,1, 38,170, 125, 555,1, 37,171, 130, 415,1, 7,172, 135, 325,1, 80,176, 140, 315,1, 112,178, 145, 305,1, 127,179, 150, 285,1, 39,153, 155, 210,1, 87,147, 160, 205,1, 66,149, 165, 180,1, 68,132, 170, 175,1, 27,158, 0, 95,1, 23,159, 100, 670,1, 10, 2, 0,4286,3, 0,132, 0, 190,1, 67, 3, 195, 200,2, 68,131, 0,4491,4, 0,130, 0,4286,3, 2,131, 0, 300,3, 0,149, 215,1690,1, 61, 4, 220, 285,1, 39,153, 225, 180,1, 68,132, 165, 230,1, 37,157, 0, 185,3, 0,-157, 240, 275,1, 157, 5, 245, 270,1, 26,134, 250, 265,1, 41,135, 0, 255,1, 21,136, 0, 260,1, 22, 6, 0,4298,3, 1,136, 0,4298,3, 0,-135, 0,4298,3, 0,-134, 0,4298,3, 0,-133, 0,4438,3, 1,154, 290, 295,2, 21, 33, 0,3838,6, 0, 32, 100, 670,1, 10, 2, 0,4318,3, 0,-142, 0, 310,1, 7, 7, 100, 670,1, 10, 2, 0, 320,1, 7, 7, 100, 670,1, 10, 2, 0, 330,1, 7, 7, 95,1640,1, 8, 8, 340, 385,2, 105,175, 345, 360,2, 25,155, 350, 355,2, 87,146, 0,4496,4, 0,145, 0, 300,3, 1,146, 220, 375,1, 39, 9, 240, 275,1, 157, 5, 0,4438,3, 3,156, 290, 295,2, 21, 33, 0,4438,3, 3,155, 0,4478,3, 1,175, 395, 920,1, 70, 10, 400, 915,1, 71,174, 405, 925,1, 9,143, 0, 410,1, 12,144, 110, 580,1, 16, 11, 420,1290,1, 38, 12, 425,1255,1, 166, 62, 430, 670,1, 10, 65, 435, 615,1, 11, 66, 440, 415,1, 7,140, 445, 210,1, 87,147, 450, 205,1, 66,149, 455, 580,1, 16,151, 460, 515,1, 41, 58, 465, 285,1, 39,153, 470, 555,1, 37,171, 475, 325,1, 80,176, 480, 315,1, 112,178, 485, 305,1, 127,179, 160, 490,1, 86, 86, 0, 495,1, 7, 7, 500, 515,1, 41, 13, 0, 490,1, 86, 86, 0, 510,1, 8, 14, 0,4050,3, 1,-59, 0,4050,3, 0, 58, 0,3978,3, 0,-56, 530, 550,2, 19, 87, 535, 540,2, 10, 57, 0,4501,4, 0, 86, 500, 515,1, 41, 13, 0,3978,3, 2, 57, 100, 670,1, 10, 2, 560, 230,4, 67,157, 0,4506,4, 0,171, 290, 295,2, 21, 33, 0,4478,3, 1,170, 0,4478,3, 0,169, 115, 575,1, 166, 15, 0,4410,3, 1,151, 595, 600,2, 15,152, 0,4511,4, 0,150, 110, 580,1, 16, 11, 0,4410,3, 2,152, 0,3798,3, 0,-13, 110, 580,1, 16, 11, 625, 660,2, 9, 14, 630, 650,2, 12, 15, 635, 640,2, 13, 16, 0,4516,4, 0, 66, 110, 580,1, 16, 11, 0,3798,3, 2, 16, 110, 580,1, 16, 11, 0,3798,3, 2, 15, 110, 580,1, 16, 11, 0,3798,3, 2, 14, 110, 580,1, 16, 11, 680, 660,2, 9, 14, 685, 650,2, 12, 15, 690, 640,2, 13, 16, 0,4521,4, 0, 65, 700, 660,2, 9, 14, 705, 650,2, 12, 15, 710, 640,2, 13, 16, 0,4526,4, 0, 64, 720, 785,2, 19, 89, 725, 760,2, 10, 67, 730, 735,2, 11, 68, 0,4531,4, 0, 88, 110, 580,1, 16, 11, 745, 660,2, 9, 14, 750, 650,2, 12, 15, 755, 640,2, 13, 16, 0,4536,4, 0, 68, 110, 580,1, 16, 11, 770, 660,2, 9, 14, 775, 650,2, 12, 15, 780, 640,2, 13, 16, 0,4541,4, 0, 67, 100, 670,1, 10, 2, 0,4238,3, 2, 89, 0, 505,3, 4, 87, 805, 815,2, 4,163, 810, 540,2, 10, 57, 0,4546,4, 0,166, 500, 515,1, 41, 13, 825, 540,2, 10, 57, 0,4551,4, 0,163, 835, 840,2, 99,167, 0,4556,4, 0,162, 845, 670,1, 10, 12, 850, 615,1, 11, 66, 855, 515,1, 41, 58, 860, 580,1, 16,151, 110, 490,1, 86, 86, 870, 540,2, 10, 57, 0,4561,4, 0,168, 880, 760,2, 10, 67, 885, 735,2, 11, 68, 0,4566,4, 0,167, 895, 925,2, 9,143, 900, 410,2, 12,144, 905, 920,2, 70,173, 910, 915,2, 71,174, 0,4310,6, 0,137, 0,4478,3, 1,174, 0,4478,3, 1,-173, 110, 580,1, 16, 11, 0,4318,3, 2,143, 940,1135,2, 10,138, 945, 950,2, 11,139, 0,4571,4, 0,129, 955, 975,1, 7, 16, 960, 210,1, 87,147, 215, 205,1, 66,149, 970, 355,2, 87,146, 350, 360,2, 25,155, 980, 670,1, 10, 2, 985, 615,1, 11, 66, 990, 415,1, 7,140, 995, 210,1, 87,147,1000, 205,1, 66,149,1005, 580,1, 16,151, 1010, 285,1, 39,153,1015, 575,1, 166,169,1020, 565,1, 38,170, 1025, 555,1, 37,171,1030, 325,1, 80,176,1035, 315,1, 112,178, 160, 305,1, 127,179,1045,1190,1, 64, 17,1050,1155,1, 61, 36, 1055,1090,1, 4, 37,1060,1070,1, 19,128,1065, 760,1, 10, 67, 0, 735,1, 11, 68, 100, 670,1, 10, 2,1080, 760,2, 10, 67, 1085, 735,2, 11, 68, 0,4576,4, 0,128, 980, 670,1, 10, 2, 0,3866,3, 0,-34, 0,1105,1, 19, 18, 980, 670,1, 10, 2, 0,1115,1, 99, 19, 0,4310,6, 0,137,1125,1135,2, 10,138, 1130, 950,2, 11,139, 0,4581,4, 0, 37, 955, 975,1, 7, 16, 1145, 925,2, 9,143,1150, 410,2, 12,144, 0,4586,4, 0,138, 0,1160,1, 62, 20, 0,1165,1, 63, 21, 0,1170,1, 64, 22, 980, 670,1, 10, 2, 0,1180,1, 65, 23, 980, 670,1, 10, 2, 0,3866,3, 7, 36, 980, 670,1, 10, 2, 0,1200,1, 65, 23, 980, 670,1, 10, 2, 0,3866,3, 4, 35,1215,1235,1, 8, 24, 0,1220,1, 19,141, 980, 670,1, 10, 2, 0,1230,1, 8, 14, 0,4318,3, 4,141, 0,4318,3, 2,140,1245, 925,2, 9,143, 1250, 410,2, 12,144, 0,4591,4, 0,139,1260,1265,2, 29, 62, 0, 575,4, 0,169,1270, 670,1, 10, 2,1275, 615,1, 11, 66, 1280,1290,1, 38, 60,1285,1255,1, 166, 62, 120, 580,1, 16,151, 290, 295,2, 21, 33,1300,1305,2, 29, 60, 0, 570,4, 0,170, 1270, 670,1, 10, 2, 0,4058,3, 3, 61,1320, 760,2, 10, 67, 1325, 735,2, 11, 68, 0,4596,4, 0, 60, 0,4058,3, 2, 63, 1340, 760,2, 10, 67,1345, 735,2, 11, 68, 0,4601,4, 0, 62, 0,4462,3, 0,-160,1360,1190,2, 64, 35,1365,1155,2, 61, 36, 1370,1390,2, 4, 37,1375,1070,2, 19,128,1380, 760,2, 10, 67, 1385, 735,2, 11, 68, 0,4606,4, 0,165,1395, 670,1, 10, 2, 1400, 615,1, 11, 66,1405, 415,1, 7,140,1410, 580,1, 16,151, 1415, 210,1, 87,147,1420, 205,1, 66,149,1425, 575,1, 166,169, 1430, 565,1, 38,170,1435, 555,1, 37,171,1440, 325,1, 80,176, 1445, 315,1, 112,178,1450, 305,1, 127,179, 160, 285,1, 39,153, 1460,1190,2, 64, 35,1465,1155,2, 61, 36,1470,1090,2, 4, 37, 1475, 760,2, 10, 67,1480, 735,2, 11, 68,1485,1070,2, 19,128, 0,4611,4, 0,164, 0,3938,3, 0,-38,1500,1505,2, 17,161, 0,4616,4, 0, 71,1510, 670,1, 10, 12,1515, 615,1, 11, 66, 1520, 515,1, 41, 58, 105, 490,1, 86, 86,1375,1530,2, 4,164, 100, 670,1, 10, 2,1540, 760,2, 10, 67,1485, 735,2, 11, 68, 0,4462,3, 2,161,1555,1590,1, 8, 24, 0,1560,1, 19, 39, 1565,1575,1, 38, 25, 0,1570,1, 166, 62, 0,1265,1, 29, 26, 290, 295,2, 21, 33, 0,1305,1, 29, 26, 0,3938,3, 2, 39, 0,4478,3, 2,180,1600,1620,1, 8, 27, 0,1605,1, 18, 72, 1510, 670,1, 10, 12,1615,1505,2, 17,161, 0,4621,4, 0, 72, 0,4478,3, 2,172, 0,4318,3, 2,144,1060,1635,1, 8, 28, 0,4478,3, 3,177, 0,4478,3, 2,176,1060,1650,1, 8, 28, 0,4478,3, 3,178,1060,1660,1, 19, 29, 100, 670,1, 10, 2, 1060,1670,1, 8, 28, 0,4478,3, 5,179,1060,1680,1, 22, 30, 0,3838,3, 2, 33, 0,4438,3, 1,153, 220, 285,1, 39, 9, 1700, 360,2, 25,155, 0,4626,4, 0,148,1710, 360,2, 25,155, 0,4631,4, 0,147,1060,1720,1, 28, 31, 0, 185,3, 2,158, 1060,1730,1, 24, 32, 0, 185,3, 2,159,1740, 660,2, 9, 14, 1745, 650,2, 12, 15,1750, 640,2, 13, 16,1755, 580,2, 16,151, 1760, 575,2, 166,169,1765, 565,2, 38,170,1770, 555,2, 37,171, 1775, 415,2, 7,172,1780, 325,2, 80,176,1785, 315,2, 112,178, 1790, 305,2, 127,179,1795, 285,2, 39,153,1800, 210,2, 87,147, 1805, 205,2, 66,149,1810, 180,2, 68,132,1815, 175,2, 27,158, 1820, 95,2, 23,159, 0,4636,4, 0, 8,1830, 660,2, 9, 14, 1835, 650,2, 12, 15,1840, 640,2, 13, 16, 0,4641,4, 0, 9, 1850,1860,1, 14, 33, 0,1855,1, 3, 6, 0,3750,3, 0, -6, 0,3750,3, 0, -5,1870,3150,2, 39, 18,1875,3135,2, 152, 20, 1880,3130,2, 40, 21,1885,3055,2, 77, 27,1890,3040,2, 75, 28, 1895,2480,2, 72, 40,1900,2445,2, 74, 43,1905,2430,2, 76, 45, 1910,2415,2, 73, 46,1915,2360,2, 79, 48,1920,3115,6, 23, 29, 1925,2230,2, 58,116,1930,1575,2, 38, 60,1935,1570,2, 166, 62, 1940,2210,2, 78, 84,1945,2115,2, 83, 73,1950,2010,2, 157,118, 1955,2190,6, 81, 70,1960,1980,6, 21,117,1965,1980,6, 26,117, 1970, 515,2, 41, 58,1975, 490,2, 86, 86, 0,3770,6, 0, 10, 1985,1995,1, 21, 34, 0,1990,1, 26,121, 0,2335,3, 1,121, 1870,3150,2, 39, 18,2005, 540,2, 10, 57, 0,4646,4, 0,119, 2015, 670,2, 10, 65,2020, 615,2, 11, 66,2025, 580,2, 16,151, 2030, 575,2, 166,169,2035, 565,2, 38,170,2040, 555,2, 37,171, 2045, 415,2, 7,172,2050, 325,2, 80,176,2055, 315,2, 112,178, 2060, 305,2, 127,179,2065, 285,2, 39,153,2070, 210,2, 87,147, 2075, 205,2, 66,149,2080, 180,2, 68,132,2085, 175,2, 27,158, 2090, 95,2, 23,159, 0,4254,6, 0,122,2100, 760,2, 10, 67, 2105, 735,2, 11, 68, 0,4651,4, 0,123, 0,2335,3, 1,118, 1565,1575,1, 38, 25,1555,2125,1, 53, 35, 100, 670,1, 10, 2, 2135, 760,1, 10, 36,2140, 735,1, 11, 68,2145,2180,1, 84, 75, 0,2150,1, 56, 77,2155,2160,2, 9, 78, 0,4656,4, 0, 77, 0,2165,3, 1, 78, 100, 670,1, 10, 2,1060,2175,1, 84, 37, 0,2185,3, 2, 76, 0,2185,3, 0, 75, 0,2340,3, 4, 73, 0,2195,1, 81, 38,1510, 670,1, 10, 12,1600,2205,1, 57, 39, 0,2350,3, 3, 69,2215,2225,1, 38, 40, 0,2220,1, 39, 85, 0,2380,3, 1, 85, 0,2380,3, 1, 84, 0,4246,3, 0,116, 2240,2325,1, 54, 41,2245,2310,1, 87,114,2250,2270,1, 25,126, 2255, 670,1, 10, 65,2260, 615,1, 11, 66, 995, 415,1, 7,140, 1060,1070,1, 19, 29, 220,2285,1, 39, 9, 240, 275,1, 157, 5, 0,2235,3, 3,127, 290, 295,2, 21, 33, 0,2235,3, 3,126, 0,2300,1, 54, 42, 980, 670,1, 10, 2, 0,4246,3, 3,115, 210,2315,1, 54, 43, 980, 670,1, 10, 2, 0,4246,3, 3,114, 980, 670,1, 10, 2, 0,4246,3, 2,113, 0,4246,3, 0,-90, 0,2345,1, 23, 44,1870,3150,2, 39, 18, 0,2355,1, 23, 44, 1870,3150,2, 39, 18,2365,2375,1, 38, 40, 0,2370,1, 39, 49, 0,3125,3, 1, 49, 0,3125,3, 1, 48,2385,1860,2, 14, 5, 2390,1855,2, 3, 6, 0,3950,6, 0,-50, 0,3950,3, 0,-51, 0,2405,1, 23, 44, 0,2410,1, 24, 45, 0,3125,3, 3,-47, 500, 515,1, 41, 13,2425, 540,2, 10, 57, 0,4661,4, 0, 46, 500, 515,1, 41, 13,2440, 540,2, 10, 57, 0,4666,4, 0, 45, 2450,2455,2, 166, 82, 0,4671,4, 0, 43, 0,2460,3, 0, 82, 2465,2470,2, 19, 83, 0,4676,4, 0, 44, 0,2475,1, 166, 46, 0,2460,3, 2, 83,2485, 670,1, 10, 12,2490, 615,1, 11, 66, 2495, 515,1, 41, 58,2500, 580,1, 16,151,2505, 415,1, 7,140, 2510, 490,1, 86, 86,2515, 575,1, 166,169,2520, 565,1, 38,170, 2525, 555,1, 37,171,2530, 325,1, 80,176,2535, 315,1, 112,178, 2540, 305,1, 127,179,2545, 210,1, 87,147,2550, 205,1, 66,149, 160, 285,1, 39,153,2560, 540,2, 10, 57,2565,2570,2, 99, 80, 0,4226,6, 0, 79, 495,2575,1, 99, 47, 500, 515,1, 41, 13, 2585, 540,2, 10, 57, 0,4681,4, 0, 81,2595, 540,2, 10, 57, 0,4686,4, 0, 80, 0,3125,3, 2, 42,2565,2570,2, 99, 80, 0,3125,3, 2, 41,2620, 760,2, 10, 67,2625, 735,2, 11, 68, 2630,1190,2, 64, 35,2635,1155,2, 61, 36,2640,1090,2, 4, 37, 2560,1070,2, 19,128, 0,3125,3, 2, 40,2655,3020,2, 46, 91, 2660,3000,2, 47, 92,2665,2980,2, 48, 93,2670,2960,2, 49, 94, 2675,2940,2, 50, 95,2680,2920,2, 51, 96,2685,2910,2, 152, 97, 2690,2900,2, 132, 98,2695,2890,2, 59, 99,2700,2880,2, 69,100, 2705,2870,2, 148,101,2710,2865,2, 57,102,2715,2860,2, 5,103, 2720,2855,2, 6,104,2725,2850,2, 60,105,2730,2830,2, 56,107, 2735,2820,2, 52,108,2740,2810,2, 53,109,2745,2800,2, 54,110, 2750,2795,2, 142,111,2755,2780,2, 138,112,2760,2775,2, 55,125, 2765, 515,2, 41, 58,2770, 490,2, 86, 86, 0,4691,4, 0, 30, 0,2235,3, 1,-125, 500, 515,1, 41, 13,2790, 540,2, 10, 57, 0,4696,4, 0,112, 0,4246,3, 1,111, 980, 670,1, 10, 2, 0,4246,3, 2,110, 980, 670,1, 10, 2, 0,4246,3, 2,109, 980, 670,1, 10, 2, 0,4246,3, 2,108, 980, 670,1, 10, 2, 0,4246,3, 2,107,2845, 540,2, 10, 57, 0,4701,4, 0,106, 0,4246,3, 1,105, 0,4246,3, 1,104, 0,4246,3, 1,103, 0,4246,3, 1,102,2015, 670,2, 10, 65, 0,4246,3, 2,101, 2015, 670,2, 10, 65, 0,4246,3, 2,100,2015, 670,2, 10, 65, 0,4246,3, 2, 99,2015, 670,2, 10, 65, 0,4246,3, 2, 98, 2015, 670,2, 10, 65, 0,4246,3, 2, 97, 100, 670,1, 10, 2, 2930, 760,2, 10, 67,2935, 735,2, 11, 68, 0,4706,4, 0, 96, 100, 670,1, 10, 2,2950, 760,2, 10, 67,2955, 735,2, 11, 68, 0,4711,4, 0, 95, 100, 670,1, 10, 2,2970, 760,2, 10, 67, 2975, 735,2, 11, 68, 0,4716,4, 0, 94, 100, 670,1, 10, 2, 2990, 760,2, 10, 67,2995, 735,2, 11, 68, 0,4721,4, 0, 93, 100, 670,1, 10, 2,3010, 760,2, 10, 67,3015, 735,2, 11, 68, 0,4726,4, 0, 92, 100, 670,1, 10, 2,3030, 760,2, 10, 67, 3035, 735,2, 11, 68, 0,4731,4, 0, 91, 500, 515,1, 41, 13, 3050, 540,2, 10, 57, 0,4736,4, 0, 28, 500, 515,1, 41, 13, 3065, 540,2, 10, 57, 0,4741,4, 0, 27,3075,3565,2, 24, 26, 0,3080,6, 0, 74, 0,3085,1, 85, 48,1870,3150,2, 39, 18, 0,3095,1, 23, 44,1870,3150,2, 39, 18,3105,3110,2, 82, 53, 0,4746,4, 0, 24, 0,3090,3, 1, 53, 0,3120,1, 23, 44, 1870,3150,2, 39, 18, 0,3826,3, 0, 22, 0,3826,3, 0, 21, 0,3826,3, 0, 20,3145,1560,2, 19, 39, 0,4751,4, 0, 19, 290, 295,2, 21, 33, 0,3160,1, 20, 49,3165,2230,2, 58,116, 3170, 670,2, 10, 65,3175, 615,2, 11, 66,3180,2010,2, 157,118, 3185, 415,2, 7,140,3190, 210,2, 87,147,3195, 205,2, 66,149, 3200, 580,2, 16,151,3205, 515,2, 41, 58,3210, 285,2, 39,153, 3215, 575,2, 166,169,3220, 565,2, 38,170,3225, 555,2, 37,171, 3230, 325,2, 80,176,3235, 315,2, 112,178,3240, 305,2, 127,179, 3245, 490,2, 86, 86,3250, 180,2, 68,132,3255, 175,2, 27,158, 3260, 95,2, 23,159, 0,1980,6, 0,117,3270,3020,2, 46, 91, 3275,3000,2, 47, 92,3280,2980,2, 48, 93,3285,2960,2, 49, 94, 3290,2940,2, 50, 95,3295,2920,2, 51, 96,3300,2910,2, 152, 97, 3305,2900,2, 132, 98,3310,2890,2, 59, 99,3315,2880,2, 69,100, 3320,2870,2, 148,101,3325,2865,2, 57,102,3330,2860,2, 5,103, 3335,2855,2, 6,104,3340,2850,2, 60,105,3345,2830,2, 56,107, 3350,2820,2, 52,108,3355,2810,2, 53,109,3360,2800,2, 54,110, 3365,2795,2, 142,111,3370,2780,2, 138,112,3375,2775,2, 55,125, 3380, 515,2, 41, 58,3385, 490,2, 86, 86, 0,4756,4, 0, 31, 0,3826,3, 3, 18, 0,3826,3, 0, 17, 0,3770,3, 0, 11, 2385,1860,2, 14, 5,3415,3150,2, 39, 18,3420,3135,2, 152, 20, 3425,3130,2, 40, 21,3430,3055,2, 77, 27,3435,3040,2, 75, 28, 3440,2480,2, 72, 40,3445,2445,2, 74, 43,3450,2430,2, 76, 45, 3455,2415,2, 73, 46,3460,2360,2, 79, 48,3465,3115,6, 23, 29, 3470,2230,2, 58,116,3475,1575,2, 38, 60,3480,1570,2, 166, 62, 3485,2210,2, 78, 84,3490,2115,2, 83, 73,3495,2010,2, 157,118, 3500,2190,6, 81, 70,3505,1980,6, 21,117,3510,1980,6, 26,117, 3515, 515,2, 41, 58,3520, 490,2, 86, 86, 0,2395,4, 0, 51, 0,3770,3, 2, 12, 0,3535,1, 24, 45, 0,3826,3, 4, 23, 2385,1860,2, 14, 5, 0,3550,1, 24, 45, 0,3826,3, 4,-25, 2385,1860,2, 14, 5, 0,3070,3, 4, 55, 0,3826,3, 1,-26, 2385,1860,2, 14, 5, 0,3580,1, 24, 45, 0,3100,3, 4,-52, 2385,1860,2, 14, 5, 0,3070,3, 3,-54,2385,1860,2, 14, 5, 0,3605,3, 1,124, 0,3610,1, 22, 6, 0,2335,3, 3,120, 1845,3730,1, 45, 50,3625,3725,2, 45, 4,3630,3150,2, 39, 18, 3635,3135,2, 152, 20,3640,3130,2, 40, 21,3645,3055,2, 77, 27, 3650,3040,2, 75, 28,3655,2480,2, 72, 40,3660,2445,2, 74, 43, 3665,2430,2, 76, 45,3670,2415,2, 73, 46,3675,2360,2, 79, 48, 3680,3115,6, 23, 29,3685,2230,2, 58,116,3690,1575,2, 38, 60, 3695,1570,2, 166, 62,3700,2210,2, 78, 84,3705,2115,2, 83, 73, 3710,2010,2, 157,118,3715,2190,6, 81, 70,3720, 515,2, 41, 58, 3260, 490,2, 86, 86, 0,3735,3, 4, 4, 0,3735,3, 3, 3, 1850,1860,1, 14, 33, 0, 10,3, 2, 2, 0, 0,0, 2, 0, 3754,1865,5,1845 ,3758,2395,5,2380 ,3762,3620,5,3615 , 3766,3740,5,3735 , 0,3410,5, 0 ,3774,3595,5,1995 , 3778,3585,5,2345 ,3782,3570,5,2355 ,3786,3555,5,3085 , 3790,3540,5,3095 ,3794,3405,5,3120 , 0,3615,5, 0 , 3802,1735,5, 20 ,3806, 620,5, 615 ,3810, 675,5, 670 , 3814, 740,5, 735 ,3818, 765,5, 760 ,3822,1825,5,1735 , 0, 695,5, 0 ,3830,3525,5,3410 ,3834,3525,5,3620 , 0,3400,5, 0 ,3842, 380,5, 375 ,3846, 570,5, 565 , 3850,1295,5,1290 ,3854,1580,5,1575 ,3858,2290,5,2285 , 3862,3155,5,3150 , 0,1685,5, 0 ,3870,1100,5,1090 , 3874,1110,5,1105 ,3878,1175,5,1170 ,3882,1185,5,1180 , 3886,1195,5,1190 ,3890,1205,5,1200 ,3894,1225,5,1220 , 3898,1100,5,1390 ,3902,2305,5,2300 ,3906,2320,5,2315 , 3910,2330,5,2325 ,3914,2605,5,2480 ,3918,2805,5,2800 , 3922,2815,5,2810 ,3926,2825,5,2820 ,3930,2835,5,2830 , 3934,3390,5,3160 , 0,1210,5, 0 ,3942,1550,5, 415 , 3946,2120,5,2115 , 0,3140,5, 0 ,3954,3530,5,3405 , 3958,3545,5,3540 ,3962,3560,5,3555 ,3966,3575,5,3570 , 3970,3590,5,3585 ,3974,3600,5,3595 , 0,2400,5, 0 , 3982, 800,5, 415 ,3986, 525,5, 495 ,3990, 820,5, 815 , 3994, 865,5, 840 ,3998, 800,5,1505 ,4002, 800,5,1605 , 4006, 800,5,2195 ,4010,2420,5,2415 ,4014,2435,5,2430 , 4018,2555,5,2480 ,4022,2590,5,2570 ,4026,2580,5,2575 , 4030,2840,5,2650 ,4034,2785,5,2780 ,4038,3045,5,3040 , 4042,3060,5,3055 ,4046,2840,5,3265 , 0,2000,5, 0 , 4054, 545,5, 540 , 0, 520,5, 0 ,4062,1330,5,1265 , 4066,1310,5,1305 ,4070,1585,5,1560 , 0,1490,5, 0 , 4078,1725,5, 95 ,4082,1715,5, 175 ,4086,1675,5, 295 , 4090,1655,5, 310 ,4094,1645,5, 320 ,4098,1630,5, 330 , 4102,1355,5, 415 ,4106, 715,5, 550 ,4110, 715,5, 785 , 4114, 875,5, 840 ,4118,1075,5,1070 ,4122,1335,5,1265 , 4126,1315,5,1305 ,4130,1455,5,1390 ,4134,1525,5,1505 , 4138,1535,5,1530 ,4142,1525,5,1605 ,4146,1665,5,1660 , 4150,2095,5,2010 ,4154,2130,5,2125 ,4158,2170,5,2165 , 4162,1525,5,2195 ,4166,2265,5,2235 ,4170,2615,5,2480 , 4174,2095,5,2870 ,4178,2095,5,2880 ,4182,2095,5,2890 , 4186,2095,5,2900 ,4190,2095,5,2910 ,4194,2925,5,2920 , 4198,2945,5,2940 ,4202,2965,5,2960 ,4206,2985,5,2980 , 4210,3005,5,3000 ,4214,3025,5,3020 , 0,1040,5, 0 , 4222,2200,5,2195 , 0,1595,5, 0 ,4230,2610,5,2605 , 4234,2645,5,2615 , 0,2600,5, 0 ,4242, 790,5, 785 , 0, 795,5, 0 ,4250,3265,5,3160 , 0,2650,5, 0 , 4258,2875,5,2870 ,4262,2885,5,2880 ,4266,2895,5,2890 , 4270,2905,5,2900 ,4274,2915,5,2910 , 0,2110,5, 0 , 4282,2295,5,2235 , 0,1095,5, 0 ,4290, 365,5, 360 , 4294,2275,5,2270 , 0, 235,5, 0 ,4302, 370,5, 365 , 4306,2280,5,2275 , 0, 280,5, 0 ,4314,1120,5,1115 , 0, 935,5, 0 ,4322, 890,5, 415 ,4326,1240,5, 950 , 4330, 890,5, 975 ,4334, 890,5,1090 ,4338, 890,5,1105 , 4342,1140,5,1135 ,4346, 890,5,1170 ,4350, 890,5,1180 , 4354, 890,5,1190 ,4358, 890,5,1200 ,4362, 890,5,1220 , 4366, 890,5,1390 ,4370, 890,5,2235 ,4374, 890,5,2300 , 4378, 890,5,2315 ,4382, 890,5,2325 ,4386, 890,5,2480 , 4390, 890,5,2800 ,4394, 890,5,2810 ,4398, 890,5,2820 , 4402, 890,5,2830 ,4406, 890,5,3160 , 0, 390,5, 0 , 4414,1625,5, 410 ,4418, 605,5, 600 ,4422, 645,5, 640 , 4426, 655,5, 650 ,4430, 665,5, 660 ,4434, 930,5, 925 , 0, 610,5, 0 ,4442,1705,5, 210 ,4446, 965,5, 950 , 4450, 965,5,1135 ,4454,1695,5,1690 ,4458,1705,5,2310 , 0, 335,5, 0 ,4466,1610,5,1605 , 0,1495,5, 0 , 4474,1545,5,1505 , 0,1350,5, 0 ,4482, 585,5, 580 , 0, 590,5, 0 , 0,1845,3, 0, 7, 0,4286,3, 1,130, 0, 300,3, 0,145, 0, 505,3, 2, 86, 0,4478,3, 0,-171, 0,4410,3, 0,-150, 0,4074,3, 1, 66, 0,4074,3, 1, 65, 0,4074,3, 0,-64, 0,4238,3, 0, 88, 0,4074,3, 2, 68, 0,4074,3, 2, 67, 0, 830,3, 0,-166, 0,4470,3, 2,163, 0,4470,3, 0,162, 0, 830,3, 2,168, 0, 830,3, 2,167, 0,4278,3, 1,129, 0,4278,3, 2,128, 0,3866,3, 6, 37, 0,4310,3, 2,138, 0,4310,3, 2,139, 0,4058,3, 3, 60, 0,4058,3, 2, 62, 0, 830,3, 0,-165, 0,4470,3, 2,164, 0,4218,3, 0,-71, 0,4218,3, 2, 72, 0, 300,3, 2,148, 0, 300,3, 1,147, 0,1845,3, 1, 8, 0,1845,3, 2, 9, 0,2335,3, 0,119, 0,4254,3, 0,-123, 0,2165,3, 0,-77, 0,3125,3, 1, 46, 0,3125,3, 1, 45, 0,3125,3, 0, 43, 0,3125,3, 1,-44, 0,4226,3, 2, 81, 0,4226,3, 1, 80, 0,3395,3, 0, 30, 0,4246,3, 2,112, 0,4246,3, 1,106, 0,4246,3, 2, 96, 0,4246,3, 2, 95, 0,4246,3, 2, 94, 0,4246,3, 2, 93, 0,4246,3, 2, 92, 0,4246,3, 2, 91, 0,3826,3, 1, 28, 0,3826,3, 1, 27, 0,3826,3, 0,-24, 0,3826,3, 0, 19, 0,3395,3, 3, 31 }; lxinx entryhp[ordMAXCH + 1]={ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,2, 3,0,0,0,4,5,0,6,8,100,0,0,0,0,0,0,0,0,0,0,101,0,102,105,106,0,0,0,0,0,0,0,0, 0,107,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,110,0,0,0,0,0,111,144,168,213,240, 260,0,277,283,0,0,293,319,338,339,347,0,357,377,415,443,0,451,0,0,0,0,459,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; lxinx lxhp[lxmax + 1]={ 0,0,0,0,0,0,0,0,95,88,81,76,70,63,57,48,38,28,21,0,0,26,23,24,25,0,27,0,31,30, 0,32,33,34,35,36,37,0,0,45,42,0,43,44,0,46,47,0,53,50,51,52,0,54,55,56,0,0,60, 0,61,62,0,64,69,66,67,68,0,0,72,0,73,74,75,0,79,78,0,80,0,82,83,84,85,86,87, 0,89,90,91,94,93,0,0,96,97,98,99,0,0,0,104,0,0,0,0,108,109,0,0,140,138,137,122, 120,117,118,119,0,121,0,134,124,125,126,130,128,129,0,132,0,133,0,135,136,0, 0,139,0,142,0,143,0,160,147,0,157,149,156,154,152,153,0,155,0,0,158,159,0,166, 162,163,164,165,0,167,0,212,206,204,197,174,0,189,185,180,179,0,0,181,182,183, 184,0,186,187,188,0,190,195,192,193,194,0,196,0,198,199,200,201,202,203,0,205, 0,207,208,211,210,0,0,0,233,229,223,217,220,219,0,221,222,0,224,225,226,227, 228,0,230,231,232,0,234,235,239,237,238,0,0,248,247,243,246,245,0,0,0,251,250, 0,252,253,254,255,259,257,258,0,0,270,267,266,264,265,0,0,268,269,0,271,272, 276,274,275,0,0,279,0,280,281,282,0,0,285,0,287,288,289,290,291,292,0,317,315, 303,300,298,299,0,301,302,0,304,305,314,310,308,309,0,311,312,313,0,0,316,0, 318,0,330,329,322,323,324,328,326,327,0,0,0,331,332,333,337,335,336,0,0,0,0, 341,342,343,344,345,346,0,355,353,350,351,352,0,354,0,356,0,371,0,368,365,362, 363,364,0,366,367,0,369,370,0,374,373,0,375,376,0,413,409,405,402,399,390,388, 385,386,387,0,389,0,396,392,393,394,395,0,397,398,0,400,401,0,404,0,0,406,407, 408,0,410,411,412,0,414,0,442,429,420,419,0,428,422,423,424,425,426,427,0,0, 430,431,441,436,434,435,0,437,438,439,440,0,0,0,445,0,446,447,448,449,450,0, 458,453,456,455,0,457,0,0,0}; lxinx lxnp[lxmax + 1]={ 0,0,0,0,0,0,7,0,9,10,11,12,13,14,15,16,17,18,19,20,0,22,0,0,0,0,0,0,29,0,0,0, 0,0,0,0,0,0,39,40,41,0,0,0,0,0,0,0,49,0,0,0,0,0,0,0,0,58,59,0,0,0,0,0,65,0,0, 0,0,0,71,0,0,0,0,0,77,0,0,0,0,0,0,0,0,0,0,0,0,0,0,92,0,0,0,0,0,0,0,0,0,0,103, 0,0,0,0,0,0,0,0,112,113,114,115,116,0,0,0,0,0,0,123,0,0,0,127,0,0,0,131,0,0, 0,0,0,0,0,0,0,141,0,0,0,145,146,0,148,0,150,151,0,0,0,0,0,0,0,0,0,161,0,0,0, 0,0,0,0,169,170,171,172,173,0,175,176,177,178,0,0,0,0,0,0,0,0,0,0,0,0,191,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,209,0,0,0,0,214,215,216,0,218,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,236,0,0,0,0,241,242,0,244,0,0,0,0,249,0,0,0,0,0,0,256,0, 0,0,0,261,262,263,0,0,0,0,0,0,0,0,0,273,0,0,0,0,278,0,0,0,0,0,284,0,286,0,0, 0,0,0,0,0,294,295,296,297,0,0,0,0,0,0,0,0,306,307,0,0,0,0,0,0,0,0,0,0,0,0,320, 321,0,0,0,325,0,0,0,0,0,0,0,0,334,0,0,0,0,0,340,0,0,0,0,0,0,0,348,349,0,0,0, 0,0,0,0,0,358,359,360,361,0,0,0,0,0,0,0,0,0,0,372,0,0,0,0,0,378,379,380,381, 382,383,384,0,0,0,0,0,0,391,0,0,0,0,0,0,0,0,0,0,0,403,0,0,0,0,0,0,0,0,0,0,0, 0,416,417,418,0,0,421,0,0,0,0,0,0,0,0,0,0,432,433,0,0,0,0,0,0,0,0,0,0,444,0, 0,0,0,0,0,0,452,0,454,0,0,0,0,0,0}; symbol lxtv[lxmax + 1]={ 0,101,35,17,33,31,32,150,93,98,0,94,0,95,92,94,93,92,95,70,71,0,0,107,0,107, 0,95,0,0,92,0,0,110,0,0,0,110,89,0,0,91,0,0,96,0,0,93,0,0,0,0,94,108,0,0,108, 88,0,90,0,0,92,0,0,111,0,0,111,95,0,106,0,0,0,106,0,0,97,0,94,0,0,109,0,0,0, 109,0,0,0,0,0,98,98,0,93,0,0,93,34,30,149,103,151,100,102,0,0,66,26,0,0,0,0, 0,54,0,0,128,0,115,161,0,0,163,0,0,0,169,0,168,0,184,0,0,167,65,0,114,0,113, 0,146,0,0,56,0,158,0,0,0,0,172,0,171,170,0,0,93,0,0,0,0,0,64,0,147,0,0,0,0,0, 5,0,0,0,0,116,73,0,0,0,0,58,0,0,0,77,0,139,0,139,0,139,0,139,0,0,0,159,0,0,173, 0,59,0,0,0,0,143,143,6,0,0,0,84,0,0,154,0,0,134,0,49,0,0,0,49,0,0,0,78,0,0,0, 0,0,174,135,0,0,0,0,117,118,75,97,0,0,82,0,0,0,160,0,0,0,176,175,0,0,0,0,0,52, 83,0,0,126,0,69,0,0,0,185,69,0,46,0,0,0,46,81,0,119,0,0,136,0,0,0,136,0,0,0, 0,0,120,121,0,0,144,0,162,0,0,0,0,178,0,0,0,186,177,0,156,0,68,0,0,0,0,164,0, 0,0,180,179,130,129,0,0,0,0,0,188,187,67,61,0,0,0,0,0,140,140,0,0,0,0,0,72,0, 131,0,137,0,67,0,0,0,0,0,145,0,0,155,0,0,74,48,0,80,0,0,48,0,0,76,0,0,0,0,67, 0,0,96,0,124,0,0,0,0,0,86,0,0,165,0,0,133,0,123,122,0,0,141,141,0,0,189,51,0, 60,0,0,67,53,92,62,0,0,50,0,0,0,50,57,0,0,0,0,0,0,183,0,0,0,0,182,181,125,0, 153,0,0,79,0,0,79,0,0,47,0,55,0,47,63,18}; symbol entrytv[ordMAXCH + 1]={ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,41,42,43, 13,36,28,7,8,9,10,19,11,25,12,0,0,0,0,0,0,0,0,0,0,20,14,4,29,104,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,0,22,15,0,27,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,23,0,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; Char lxch[lxmax + 1]={ '0','=','=','&','=','=','=','>','b','c','d','e','h','l','n','r','s','t','w', 'x','y','e','i','d','t','h','s','t','h','o','p','i','c','k','n','e','s','s', 'e','o','t','w','a','r','t','u','t','h','a','i','g','h','t','d','i','u','s', 'e','o','w','r','t','h','e','f','n','g','t','h','t','e','t','i','g','h','t', 'a','n','d','s','t','i','a','m','e','t','e','r','e','n','t','e','r','e','r', 'o','t','t','o','m','=','=','-','=','>','=','=','e','r','e',']','b','c','n', 'r','s','t','a','n','2','i','n','c','r','o','w','h','w','i','d','e','t','a', 'd','r','a','d','d','o','s','o','s','v','e','e','o','y','t','x','h','r','w', 'i','d','a','d','t','t','o','m','l','t','w','e','e','n','o','w','c','e','h', 'i','o','w','l','m','n','p','s','y','t','i','n','u','e','m','a','n','d','o', 'r','u','r','e','d','e','d','r','c','l','e','r','a','d','o','p','n','t','e', 'r','e','r','w','a','e','i','o','t','w','n','t','e','d','a','m','e','t','e', 'r','f','i','n','e','s','h','e','w','i','d','d','l','n','x','e','p','e','c', 'd','l','s','e','i','p','s','e','h','w','i','d','t','i','l','o','r','o','m', 'r','o','o','r','l','l','e','v','a','l','d','e','t','i','g','h','t','f','n', 't','v','i','s','i','b','l','e','a','e','i','j','o','g','e','u','s','t','n', 'e','h','t','w','i','d','h','i','c','k','t','f','t','s','t','a','i','o','v', 'e','h','w','i','d','t','n','x','p','s','h','w','i','d','t','d','f','u','t', 'l','i','n','e','d','a','m','r','i','n','t','o','d','t','h','a','d','e','i', 'j','u','s','t','g','h','t','s','e','t','d','n','d','i','u','s','a','c','h', 'i','o','p','q','t','a','r','t','r','t','l','r','i','n','t','f','i','n','e', 'l','i','d','g','n','n','a','d','e','d','a','l','e','d','m','e','a','e','h', 'o','p','e','i','c','k','n','e','s','s','n','x','t','h','o','w','i','d','f', 'f','s','e','t','t','n','n','p','d','e','f','i','n','e','a','i','d','t','h', 't','h','y','|'}; /* integer debugging constants */ /*D debuglevel, linesignal: integer; D*/ /*D trace: boolean; D*/ /* used for debugging the parser */ /* Parser variables */ int oldsymb; /* last lexical symbol */ arg *macros, *args; /* macro and macro argument list */ stackinx stacktop, pseudotop, validtop, top; stackelm *parsestack; /* parse stack */ boolean parsestop; /* parser flags */ int startinx, lri, start; /*--------------------------------------------------------------------*/ /* include dp1.z */ /*dp1.x---------------------------------------------------------------*/ int Ceil(double x); int Floor(double x); double Max(double x, double y); double Min(double x, double y); double datan(double y, double x); primitive *findenv(primitive *p); arg *findmacro(arg *p, Char *chb, chbufinx inx, chbufinx length, arg **last); boolean isthen(primitive *pr); double linlen(double x, double y); int lspec(int n); /*DGHM function ordp(p:pointer): integer; forward; MHGD*/ double principal(double x, double r); void checkjust(nametype *tp, boolean *A, boolean *B, boolean *L, boolean *R); void getlinespec(primitive *nd, int *lsp, primitive **lastnd); void consoleflush(void); void copyleft(fbuffer *mac, fbuffer **buf); void deletetree(primitive **p); /*D; loc: integer D*/ void disposebufs(fbuffer **buf); void drawtree(double n, double s, double e, double w, primitive *eb); void fatal(int t); void initnesw(void); void doprod(int prno); void markerror(int n); void nesw(primitive *ptmp); void newarg(arg **arg_); void newbuf(fbuffer **buf); #ifndef SAFE_MODE void pointinput(nametype *txt); void pointoutput(boolean nw, nametype *txt, int *ier); #endif void produce(stackinx newp, int p); void readfor(fbuffer *p0, int attx, fbuffer **p2); void skiptobrace(void); /*D procedure snaptype(var iou: text; p: integer); forward; D*/ void wcoord(FILE **iou, double x, double y); void wfloat(FILE **iou, double y); void wpair(FILE **iou, double x, double y); void wpos(postype pos); /*D procedure wrbuf(p: fbufferp; job,r: integer); forward; D*/ /*D procedure wlogfl( nm: string; v: real; cr: integer); forward; D*/ void wstring(FILE **iou, nametype *p); int ahlex(int atyp); int ahnum(int atyp); int pahlex(int atyp, int alex); int pahnum(int atyp, int anum); postype arcstart(primitive *n); postype arcend(primitive *n); fbuffer *newinbuf(fbuffer *p); /*--------------------------------------------------------------------*/ /* include sysdep.h */ /*GH#include 'sysdep.h'HG*/ double principal(double x, double r) { /* x,r: real): real */ while (x > r) x -= 2 * r; while (x < -r) x += 2 * r; return x; } double Max(double x, double y) { /* x,y: real): real */ if (y > x) return y; else return x; } double Min(double x, double y) { /* x,y: real): real */ if (y < x) return y; else return x; } int Floor(double x) { /* x: real): integer */ if (x >= 0 || (long)x == x) return ((long)x); else return ((long)x - 1); } int Ceil(double x) { /* x: real): integer */ if (x < 0 || (long)x == x) return ((long)x); else return ((long)x + 1); } double datan(double y, double x) { /* y,x: real ): real */ double r; /*D if debuglevel=2 then write(log,'datan(',y:8:4,',',x:8:4,')='); D*/ if (x > 0.0) { r = atan(y / x); return r; } if (x < 0.0) { if (y >= 0.0) r = pi - atan(-(y / x)); else r = atan(y / x) - pi; return r; } if (y > 0.0) { r = pi / 2; return r; } if (y < 0.0) r = pi / -2; else /* markerror(907); */ r = 0.0; /*D if debuglevel=2 then writeln(log,r:8:4); D*/ return r; } void consoleflush(void) { /* causes immediate physical write to console, not needed for most systems. */ /*DUGHM; if debuglevel > 0 then flush(log) MHGUD*/ fflush(errout); P_ioresult = 0; } void epilog(void) { /* produce(0, 0); */ /*D if debuglevel > 0 then begin writeln(log,'stackhigh=',stackhigh:1); writeln(log,'Dpic log ends'); writeln(log) end; D*/ /* Seems needed for some Cygwin machines: */ /* GH flush(errout); flush(stdout) HG */ } void currentline(int *startlin) { /* Print out the current input line */ int inx, j, lastinx; fbuffer *bf, *ba, *WITH; putc('\n', errout); consoleflush(); bf = inbuf; ba = NULL; /*D if debuglevel > 0 then begin write(log,'currentline:'); wrbuf(bf,3,0) end; D*/ while (bf != NULL) { WITH = bf; ba = bf; j = 0; if (bf->readx - 1 < bf->savedlen) inx = bf->readx - 1; else inx = bf->savedlen; while (inx > j) { if (WITH->carray[inx] == etxch || WITH->carray[inx] == tabch || WITH->carray[inx] == ' ' || WITH->carray[inx] == crch || WITH->carray[inx] == nlch) inx--; else j = inx; } /*D if debuglevel > 0 then write(log,'skipwhite inx=',inx:1); D*/ if (bf == inbuf) lastinx = inx; j = 0; while (inx > j) { if (WITH->carray[inx] != nlch) inx--; else j = inx; } /*D if debuglevel > 0 then begin write(log,' skipnonwhite inx=',inx:1); if bf<>inbuf then wrbuf(bf,3,-inx) else writeln(log) end; D*/ if (inx == 0) bf = WITH->prevb; else bf = NULL; } *startlin = inx; while (ba != NULL) { WITH = ba; if (ba == inbuf) j = lastinx; else j = WITH->savedlen; while (inx < j) { inx++; if (WITH->carray[inx] == nlch) putc('\n', errout); else if (WITH->carray[inx] != etxch) putc(WITH->carray[inx], errout); } if (ba == inbuf) ba = NULL; else ba = ba->nextb; inx = 0; } putc('\n', errout); consoleflush(); } void fatal(int t) { /* t: integer */ int i; if (t != 0) { fprintf(errout, " *** dpic: "); currentline(&i); } switch (t) { case 0: /* blank case */ break; case 1: fprintf(errout, "Input file not readable\n"); break; case 3: fprintf(errout, "Maximum error count exceeded\n"); break; case 4: fprintf(errout, "Character buffer overflow: \"CHBUFSIZ\" exceeded\n"); break; case 5: fprintf(errout, "End of file encountered on input\n"); break; case 6: fprintf(errout, "Too many pending actions, const \"STACKMAX\" exceeded,\n"); fprintf(errout, " possibly caused by infinite recursion.\n"); break; case 7: fprintf(errout, "Input too complex, const \"REDUMAX\" exceeded\n"); break; case 8: fprintf(errout, "Error recovery abandoned\n"); /*D; 9: writeln(errout,'Debug special exit') D*/ break; } epilog(); if (input != NULL) fclose(input); if (output != NULL) fclose(output); if (errout != NULL) fclose(errout); /*DP2CC if (log_ != NULL) fclose(log_); */ exit(EXIT_FAILURE); } /*--------------------------------------------------------------------*/ /* include sysdep.h */ /* sysdep.x Required UNIX functions */ /*H name 'access' H*/ /*G; asmname '_p_Access' G*/ extern int access(Char *f, int n); /*H name H*/ /*G; asmname G*/ /*GH 'isatty' HG*/ /*H name H*/ /*G; asmname G*/ /*GH 'time' HG*/ /*BXUGH real HGUXB*/ /*H name H*/ /*G; asmname G*/ /*GH 'sprintf' HG*/ /*BXUGH real HGUXB*/ /*H name H*/ /*G; asmname G*/ /*GH 'snprintf' HG*/ /* function system( var s: char ): integer; */ /*H name H*/ /*G; asmname G*/ /*GH 'system' HG*/ /* These need tweaking for different operating systems: */ /*H name H*/ /*G; asmname G*/ /*GH 'random' HG*/ #if defined __MSDOS__ || defined __CYGWIN__ || defined RAND #undef random #define random() rand() #else extern long random(void); #if !defined RAND_MAX #undef randmax #define randmax LONG_MAX #endif #endif /*H name H*/ /*G; asmname G*/ /*GH 'srandom' HG*/ #if defined _POSIX_SOURCE || defined sun extern void srandom(unsigned s); #elif defined __MSDOS__ || defined __CYGWIN32__ || defined RAND extern void srand(unsigned s); #define srandom(x) srand((unsigned)(x)) #elif defined mips #elif defined __APPLE__ #elif defined __OpenBSD__ extern void srand(unsigned int s); #else extern void srandom(int s); #endif /*DUBX function ordp(var p:primitivep ): integer; external; XBUD*/ /*-----------------------------------------------------------------*/ /* include dpic1.p */ /*BX segment dpic1; XB*/ /* onefile */ /* G module dpic1; G */ /* include dp0.h */ /*BXU#include 'dp0.h'UXB*/ /* onefile */ /* G#include 'dp0.h'G */ /* include dp1.h */ /*BXU#include 'dp1.h'UXB*/ /* onefile */ /* G#include 'dp1.h'G */ /* include sysdep.h */ /*BXU#include 'sysdep.h'UXB*/ /* onefile */ /* G#include 'sysdep.h'G */ /* Recursive routines: snaptree pexit neswrec shift treedraw scaleobj */ int bval(Char *buf) { return (((int) buf[0]) << 7) + (int) buf[1] ; } void putbval(Char *buf, int n) { /* D if debuglevel > 0 then writeln(log,'putbval[',ordp(buf):1,'](',n:1,')'); D */ buf[0] = (Char)(n>>7); buf[1] = (Char)(n % 128); } void deletename(nametype **head) { nametype *pn, *r; int j, FORLIM; while (*head != NULL) { pn = *head; r = pn; while (pn->next_ != NULL) { r = pn; pn = pn->next_; } r->next_ = NULL; if (pn == *head) *head = NULL; if (pn->segmnt != NULL) { if (bval(pn->segmnt) > 1) { j = bval(pn->segmnt); putbval(pn->segmnt, j - 1); if (pn->segmnt == freeseg && pn->seginx + pn->len == freex) { freex = pn->seginx; j = 3; while (freex > j) { if (pn->segmnt[freex - 1] == nlch) freex--; else j = freex; } } else { FORLIM = pn->seginx + pn->len; for (j = pn->seginx; j < FORLIM; j++) pn->segmnt[j] = nlch; } } else if (pn->segmnt == freeseg) { Free(freeseg); freeseg = NULL; } else Free(pn->segmnt); } Free(pn); } } /* procedure setvis(var specv: integer; nonz: integer); begin specv := (specv div 32)*32 + nonz*16 + (specv mod 16) end; */ void setspec(int *specv, int svalue) { *specv = ((*specv) >> 3) * 8 + svalue - XLlinetype; /* if svalue = XLsolid then specv := (specv div 32)*32 + 16 + (specv mod 16) */ } void resetspec(int *specv, int svalue) { *specv = 0; setspec(specv, svalue); } void setthen(int *specv) { *specv = ((*specv) >> 4) * 16 + ((*specv) & 7) + 8; } /*D procedure prtstval(st: integer); begin write(log,'state=',st:1); if (st mod 4)<>0 then case (st mod 4) of 1: write(log,',XL','to'); 2: write(log,',XL','from'); 3: write(log,',XL','at'); otherwise end; if odd(st div 4) then write(log,',XL','chop'); if odd(st div 8) then write(log,',XL','directon') end; procedure snapname( chbu:chbufp; inx,ll:chbufinx); var j: integer; begin write(log,' (',ordp(chbu):1,' inx=',inx:1,' len=',ll:1,')|'); if chbu = nil then write(log,'**nil string pointer**') else for j := inx to inx+ll-1 do write(log,chbu^[j]); write(log,'|'); flush(log) end; procedure snaptype D*/ /* var iou: text; p: integer */ /*D; begin case p of XLbox: write(iou,''); XBLOCK: write(iou,'<[]>'); XLellipse: write(iou,''); XLcircle: write(iou,''); XLline: write(iou,''); XLarrow: write(iou,''); XLmove: write(iou,''); XLspline: write(iou,''); XLarc: write(iou,''); XLstring: write(iou,'<>'); XLaTeX: write(iou,'<>'); XLabel: write(iou,'<