home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume27 / transfig-2.1.8 / part02 (.txt) < prev    next >
LaTeX Document  |  1993-10-05  |  76KB  |  2,017 lines

  1. Newsgroups: comp.sources.unix
  2. From: envbvs@epb12.lbl.gov (Brian V. Smith)
  3. Subject: v27i056: transfig-2.1.8 - a set of tools for creating TeX documents with graphics, Part02/07
  4. References: <1.749903574.10622@gw.home.vix.com>
  5. Sender: unix-sources-moderator@gw.home.vix.com
  6. Approved: vixie@gw.home.vix.com
  7. Submitted-By: envbvs@epb12.lbl.gov (Brian V. Smith)
  8. Posting-Number: Volume 27, Issue 56
  9. Archive-Name: transfig-2.1.8/part02
  10. #! /bin/sh
  11. # This is a shell archive.  Remove anything before this line, then unpack
  12. # it by saving it into a file and typing "sh file".  To overwrite existing
  13. # files, type "sh file -c".  You can also feed this as standard input via
  14. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  15. # will see the following message at the end:
  16. #        "End of archive 2 (of 7)."
  17. # Contents:  doc/tpic.spec fig2dev/dev/Makefile fig2dev/dev/genpstex.c
  18. #   fig2dev/dev/tpicfonts.h fig2dev/fig2dev.c fig2dev/getopt.c
  19. #   fig2dev/latex_line.c fig2dev/object.h fig2dev/psfonts.c
  20. #   transfig/mkfile.c transfig/transfig.c
  21. # Wrapped by envbvs@epb12.lbl.gov.lbl.gov on Fri Oct  1 14:55:45 1993
  22. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  23. if test -f 'doc/tpic.spec' -a "${1}" != "-c" ; then 
  24.   echo shar: Will not clobber existing file \"'doc/tpic.spec'\"
  25. echo shar: Extracting \"'doc/tpic.spec'\" \(8799 characters\)
  26. sed "s/^X//" >'doc/tpic.spec' <<'END_OF_FILE'
  27. X\section{Output Specification}
  28. XThis section defines the output language which is generated by
  29. X\tpic/.  It is intended only for use by writers of
  30. X{\sc dvi} device drivers.  The first lines of output will
  31. Xexecute a \tcom{newbox} command to define \tcom{graph} if it
  32. Xhas not already been defined.  Each picture is enclosed in a \tcom{vtop}
  33. Xwhich is assigned to \tcom{graph}.  The width and height of this box are
  34. Xthe size of the picture as known to \tpic/ (text doesn't count because
  35. X\tpic/ can't know how wide it may be).  Inside this box are a
  36. Xsequence of \tcom{special} commands which define all the graphics,
  37. Xalong with \tcom{hbox} commands setting the text left, right, or center
  38. Xof a given point.
  39. XEach graphical element is placed relative to \TeX's idea of the location
  40. Xof this \tcom{special} on the page.  Each \tcom{special} is set at the
  41. Xtop left corner of the \tcom{graph} box.  This point is considered the
  42. Xorigin of the graph.  The $x$ axis is positive to the right, and the $y$
  43. Xaxis is positive moving down the page.  Thus the coordinates in the
  44. Xgraphics commands are in terms of a virtual page with axes oriented the
  45. Xsame as on many printers and workstation screens, like this:
  46. X"0,0" at (0,0) above
  47. Xarrow from (0,0) to (0.5,0)
  48. X"\ $+x$" at (0.5,0) ljust
  49. Xarrow from (0,0) to (0,-0.5)
  50. X"$+y$" at end of last arrow below
  51. X\centerline{\box\graph}
  52. XAngles are measured in the conventional way, from $+x$ towards $+y$.
  53. XUnfortunately, that reverses the meaning of "counterclockwise" from
  54. Xwhat you see in the output.  Angle measurements are in radians, from
  55. X0 to $2\pi$.  A complete circle or ellipse will have
  56. X$\hbox{\it start angle}=0$ and $\hbox{\it end angle} \ge 2\pi$.
  57. XThus, each distance (expressed in milli-inches) will be a positive number,
  58. Xsince the box encloses all of the graphical elements.
  59. XThe possible \tcom{special} commands which must be implemented are
  60. Xas follows.  All numbers which represent distances
  61. Xare integers except where noted.  Angles are always measured in radians,
  62. Xand they are measured in the conventional way from $+x$ towards $+y$.
  63. XNormally, this would be ``counterclockwise''.
  64. XUnfortunately, since the $y$ axis points down
  65. Xinstead of up, this turns out to be backwards.
  66. XThis is especially confusing because in the input language, $+y$
  67. Xpoint upwards.  Device driver writers should beware of this point.
  68. XIt is best to do all arithmetic in the coordinates of \tpic/'s output,
  69. Xthen convert the resulting endpoints to the device's coordinates
  70. Xfor printing; this should produce correct results in all cases.
  71. X\begin{description}
  72. X\item[pn $s$]           Sets the pen size to $s$ milli-inches.
  73. X\item[pa $x$ $y$]       Add point $(x,y)$ to a ``path'' which is
  74. X                        being stored in the {\sc dvi} interpreter.
  75. X                        The values of $x$ and $y$ are in milli-inches.
  76. X\item[fp]               Flush (i.e., print using the current pen size)
  77. X                        a previously defined path.  The number of path
  78. X                        elements is reset to zero.  If shading has been
  79. X                        specified, and if the path is closed, then the
  80. X                        enclosed area should be shaded.  Currently,
  81. X                        \tpic/ can only specify closed regions which are
  82. X                        rectangles using the {\tt pa} command, and
  83. X                        circles/ellipses are specified with the {\tt ar}
  84. X                        command; however, device driver writers should
  85. X                        not rely on this restriction.  Someday, \tpic/
  86. X                        may be able to specify arbitrary closed areas
  87. X                        using {\tt pa} commands.  Currently, the only
  88. X                        example of this is the shading of arrowheads,
  89. X                        which are triangular.
  90. X\item[ip]               This is the same as {\tt fp} except that the
  91. X                        path is not actually drawn.  Shading of the defined
  92. X                        region is performed if it has been specified.
  93. X\item[da $f$]           This is the same as {\tt fp} except that the line
  94. X                        is drawn as a dashed line with $f$ inches per dash
  95. X                        ($f$ is a real number).
  96. X\item[dt $f$]           This is the same as {\tt da} except that a dotted
  97. X                        line is drawn, with $f$ inches between each
  98. X                        dot ($f$ is a real number).
  99. X\item[sp $d$]           This is the same as {\tt fp} except that a spline
  100. X                        is drawn through the points.  The spline is guaranteed
  101. X                        to go through only the first and last points,
  102. X                        depending on the relative positions of any
  103. X                        intermediate points.  The argument $d$ is an
  104. X                        optional real value.  If $d=0$ or the argument
  105. X                        is omitted,
  106. X                        the spline is drawn normally, as a solid line.
  107. X                        If $d>0$, it is dashed with $d$ as the dashwid, else
  108. X                        if $d<0$, the spline is dotted with $-d$ as the dotwid.
  109. X\item[ar $x$ $y$ $r_x$ $r_y$ $s$ $e$]
  110. X                        Draw an arc with center at $(x,y)$, from
  111. X                        starting angle $s$ to ending angle $e$.
  112. X                        If it's a complete circle or ellipse, then
  113. X                        $r_x$ and $r_y$ determine the $x$ and $y$ radii,
  114. X                        respectively.  Otherwise, $r_x=r_y$ will hold,
  115. X                        and an arc from $s$ to $e$ should be drawn.
  116. X\item[ia $x$ $y$ $r_x$ $r_y$ $s$ $e$] The {\tt ia} command is to {\tt ar} what
  117. X                        {\tt ip} is to {\tt fp}.
  118. X\end{description}
  119. XThe following command is optional in {\sc dvi} driver implementations
  120. Xof \tpic/.  Drivers which do not implement it should silently ignore it.
  121. X\begin{description}
  122. X\item[sh $s$]           Shade the interior of the next closed figure defined
  123. X                        with three or more {\tt pa} commands followed
  124. X                        by a {\tt fp} or {\tt ip} command, or by an
  125. X                        {\tt ar} or {\tt ia} command.  The value $s$ is
  126. X                        a floating point number from 0 to 1.  Zero implies
  127. X                        a completely white interior (including erasing
  128. X                        anything underneath), while 1 implies completely
  129. X                        black.  A value of 0.5 is a default
  130. X                        ``normal'' gray shading.  If $s$ is not specified,
  131. X                        a value of 0.5 should be used.  NB: Shading applies
  132. X                        to the interior of the object only; the borders of
  133. X                        the object are still drawn using the current pen,
  134. X                        which is particularly important for dvi drivers
  135. X                        which do not support the {\tt sh} command.  The
  136. X                        pixels generated by the shading value should be
  137. X                        ``ANDed'' with the pixels already in the area.
  138. X                        Subsequent text pixels should be ``ORed''.  Thus,
  139. X                        text {\it followed\/} by a ``{\tt sh 0}'' command
  140. X                        covering the same area will disappear.  Any shading
  141. X                        value greater than zero should add the shading
  142. X                        to the existing text, with the text remaining
  143. X                        visible.  Of course, a shading value of one will
  144. X                        be completely black, so any text that is there
  145. X                        won't be distinguishable.
  146. X\end{description}
  147. XThe following two opcodes are considered obsolete, but they probably should be
  148. Ximplemented for backwards compatibility:
  149. X\begin{description}
  150. X\item[wh]               This is the same as ``{\tt sh 0}''.
  151. X\item[bk]               This is the same as ``{\tt sh 1}''.
  152. X\item[tx]               This command was used to specify a texture
  153. X                        to be used in shading instead of the default
  154. X                        one.  Its use was limited to
  155. X                        only one particular Imagen device driver,
  156. X                        and it was very device-specific.  Its
  157. X                        implementation is discouraged in favor of
  158. X                        support for the argument to the {\tt sh} command.
  159. X\end{description}
  160. X-----------------,------------------------------,------------------------------
  161. XMichael N. Lipp  !  Institut fuer Datentechnik  !  Phone: 49-6151-163776
  162. X                 !  Merckstr. 25     ,----------'  Fax:   49-6151-164976
  163. X                 !  D-6100 Darmstadt ! E-Mail:        xdatmnlx@ddathd21.bitnet
  164. X                 !  (Germany)        !    mnl@idtsun.e-technik.th-darmstadt.de
  165. X-----------------'-------------------'-----------------------------------------
  166. END_OF_FILE
  167. if test 8799 -ne `wc -c <'doc/tpic.spec'`; then
  168.     echo shar: \"'doc/tpic.spec'\" unpacked with wrong size!
  169. # end of 'doc/tpic.spec'
  170. if test -f 'fig2dev/dev/Makefile' -a "${1}" != "-c" ; then 
  171.   echo shar: Will not clobber existing file \"'fig2dev/dev/Makefile'\"
  172. echo shar: Extracting \"'fig2dev/dev/Makefile'\" \(9932 characters\)
  173. sed "s/^X//" >'fig2dev/dev/Makefile' <<'END_OF_FILE'
  174. X# Makefile generated by imake - do not edit!
  175. X# $XConsortium: imake.c,v 1.65 91/07/25 17:50:17 rws Exp $
  176. X# The cpp used on this machine replaces all newlines and multiple tabs and
  177. X# spaces in a macro expansion with a single space.  Imake tries to compensate
  178. X# for this, but is not always successful.
  179. X# -------------------------------------------------------------------------
  180. X# Makefile generated from "Imake.tmpl" and </tmp/IIf.a21026>
  181. X# $XConsortium: Imake.tmpl,v 1.139 91/09/16 08:52:48 rws Exp $
  182. X# Platform-specific parameters may be set in the appropriate <vendor>.cf
  183. X# configuration files.  Site-specific parameters should be set in the file
  184. X# site.def.  Full rebuilds are recommended if any parameters are changed.
  185. X# If your C preprocessor does not define any unique symbols, you will need
  186. X# to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing
  187. X# "make World" the first time).
  188. X# -------------------------------------------------------------------------
  189. X# site-specific configuration parameters that need to come before
  190. X# the platform-specific parameters - edit site.def to change
  191. X# site:  $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $
  192. X# -------------------------------------------------------------------------
  193. X# platform-specific configuration parameters - edit sun.cf to change
  194. X# platform:  $XConsortium: sun.cf,v 1.72.1.1 92/03/18 13:13:37 rws Exp $
  195. X# operating system:  SunOS 4.1.2
  196. X# $XConsortium: sunLib.rules,v 1.7 91/12/20 11:19:47 rws Exp $
  197. X# -------------------------------------------------------------------------
  198. X# site-specific configuration parameters that go after
  199. X# the platform-specific parameters - edit site.def to change
  200. X# site:  $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $
  201. X            SHELL = /bin/sh
  202. X              TOP = ../../.
  203. X      CURRENT_DIR = ./fig2dev/dev
  204. X               AR = ar clq
  205. X  BOOTSTRAPCFLAGS =
  206. X               CC = cc
  207. X               AS = as
  208. X         COMPRESS = compress
  209. X              CPP = /lib/cpp $(STD_CPP_DEFINES)
  210. X    PREPROCESSCMD = cc -E $(STD_CPP_DEFINES)
  211. X          INSTALL = install
  212. X               LD = ld
  213. X             LINT = lint
  214. X      LINTLIBFLAG = -C
  215. X         LINTOPTS = -axz
  216. X               LN = ln -s
  217. X             MAKE = make
  218. X               MV = mv
  219. X               CP = cp
  220. X           RANLIB = ranlib
  221. X  RANLIBINSTFLAGS =
  222. X               RM = rm -f
  223. X            TROFF = psroff
  224. X         MSMACROS = -ms
  225. X              TBL = tbl
  226. X              EQN = eqn
  227. X     STD_INCLUDES =
  228. X  STD_CPP_DEFINES =
  229. X      STD_DEFINES =
  230. X EXTRA_LOAD_FLAGS =
  231. X  EXTRA_LIBRARIES =
  232. X             TAGS = ctags
  233. X    SHAREDCODEDEF = -DSHAREDCODE
  234. X         SHLIBDEF = -DSUNSHLIB
  235. X    PROTO_DEFINES =
  236. X     INSTPGMFLAGS =
  237. X     INSTBINFLAGS = -m 0755
  238. X     INSTUIDFLAGS = -m 4755
  239. X     INSTLIBFLAGS = -m 0644
  240. X     INSTINCFLAGS = -m 0444
  241. X     INSTMANFLAGS = -m 0444
  242. X     INSTDATFLAGS = -m 0444
  243. X    INSTKMEMFLAGS = -g kmem -m 2755
  244. X      CDEBUGFLAGS = -O
  245. X        CCOPTIONS =
  246. X      ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(STD_INCLUDES)
  247. X       ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(DEFINES)
  248. X           CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES)
  249. X        LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES)
  250. X           LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
  251. X        LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) $(LOCAL_LDFLAGS)
  252. X   LDCOMBINEFLAGS = -X -r
  253. X      DEPENDFLAGS =
  254. X        MACROFILE = sun.cf
  255. X           RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut
  256. X    IMAKE_DEFINES =
  257. X         IRULESRC = $(CONFIGDIR)
  258. X        IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES)
  259. X     ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \
  260. X            $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \
  261. X            $(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES)
  262. X# -------------------------------------------------------------------------
  263. X# X Window System Build Parameters
  264. X# $XConsortium: Project.tmpl,v 1.138 91/09/10 09:02:12 rws Exp $
  265. X# -------------------------------------------------------------------------
  266. X# X Window System make variables; this need to be coordinated with rules
  267. X          PATHSEP = /
  268. X        USRLIBDIR = /usr/lib
  269. X           BINDIR = /usr/bin/X11
  270. X          INCROOT = /usr/include
  271. X     BUILDINCROOT = $(TOP)
  272. X      BUILDINCDIR = $(BUILDINCROOT)/X11
  273. X      BUILDINCTOP = ..
  274. X           INCDIR = $(INCROOT)/X11
  275. X           ADMDIR = /usr/adm
  276. X           LIBDIR = $(USRLIBDIR)/X11
  277. X        CONFIGDIR = $(LIBDIR)/config
  278. X       LINTLIBDIR = $(USRLIBDIR)/lint
  279. X          FONTDIR = $(LIBDIR)/fonts
  280. X         XINITDIR = $(LIBDIR)/xinit
  281. X           XDMDIR = $(LIBDIR)/xdm
  282. X           TWMDIR = $(LIBDIR)/twm
  283. X          MANPATH = /usr/man
  284. X    MANSOURCEPATH = $(MANPATH)/man
  285. X        MANSUFFIX = l
  286. X     LIBMANSUFFIX = 3
  287. X           MANDIR = $(MANSOURCEPATH)$(MANSUFFIX)
  288. X        LIBMANDIR = $(MANSOURCEPATH)$(LIBMANSUFFIX)
  289. X           NLSDIR = $(LIBDIR)/nls
  290. X        PEXAPIDIR = $(LIBDIR)/PEX
  291. X      XAPPLOADDIR = $(LIBDIR)/app-defaults
  292. X       FONTCFLAGS = -t
  293. X     INSTAPPFLAGS = $(INSTDATFLAGS)
  294. X            IMAKE = imake
  295. X           DEPEND = makedepend
  296. X              RGB = rgb
  297. X            FONTC = bdftopcf
  298. X        MKFONTDIR = mkfontdir
  299. X        MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier
  300. X        CONFIGSRC = $(TOP)/config
  301. X       DOCUTILSRC = $(TOP)/doc/util
  302. X        CLIENTSRC = $(TOP)/clients
  303. X          DEMOSRC = $(TOP)/demos
  304. X           LIBSRC = $(TOP)/lib
  305. X          FONTSRC = $(TOP)/fonts
  306. X       INCLUDESRC = $(TOP)/X11
  307. X        SERVERSRC = $(TOP)/server
  308. X          UTILSRC = $(TOP)/util
  309. X        SCRIPTSRC = $(UTILSRC)/scripts
  310. X       EXAMPLESRC = $(TOP)/examples
  311. X       CONTRIBSRC = $(TOP)/../contrib
  312. X           DOCSRC = $(TOP)/doc
  313. X           RGBSRC = $(TOP)/rgb
  314. X        DEPENDSRC = $(UTILSRC)/makedepend
  315. X         IMAKESRC = $(CONFIGSRC)
  316. X         XAUTHSRC = $(LIBSRC)/Xau
  317. X          XLIBSRC = $(LIBSRC)/X
  318. X           XMUSRC = $(LIBSRC)/Xmu
  319. X       TOOLKITSRC = $(LIBSRC)/Xt
  320. X       AWIDGETSRC = $(LIBSRC)/Xaw
  321. X       OLDXLIBSRC = $(LIBSRC)/oldX
  322. X      XDMCPLIBSRC = $(LIBSRC)/Xdmcp
  323. X      BDFTOSNFSRC = $(FONTSRC)/bdftosnf
  324. X      BDFTOSNFSRC = $(FONTSRC)/clients/bdftosnf
  325. X      BDFTOPCFSRC = $(FONTSRC)/clients/bdftopcf
  326. X     MKFONTDIRSRC = $(FONTSRC)/clients/mkfontdir
  327. X         FSLIBSRC = $(FONTSRC)/lib/fs
  328. X    FONTSERVERSRC = $(FONTSRC)/server
  329. X     EXTENSIONSRC = $(TOP)/extensions
  330. X         XILIBSRC = $(EXTENSIONSRC)/lib/xinput
  331. X      PHIGSLIBSRC = $(EXTENSIONSRC)/lib/PEX
  332. X# $XConsortium: sunLib.tmpl,v 1.14.1.1 92/03/17 14:58:46 rws Exp $
  333. XSHLIBLDFLAGS = -assert pure-text
  334. XPICFLAGS = -pic
  335. X  DEPEXTENSIONLIB =
  336. X     EXTENSIONLIB = -lXext
  337. X          DEPXLIB = $(DEPEXTENSIONLIB)
  338. X             XLIB = $(EXTENSIONLIB) -lX11
  339. X        DEPXMULIB = $(USRLIBDIR)/libXmu.sa.$(SOXMUREV)
  340. X       XMULIBONLY = -lXmu
  341. X           XMULIB = -lXmu
  342. X       DEPOLDXLIB =
  343. X          OLDXLIB = -loldX
  344. X      DEPXTOOLLIB = $(USRLIBDIR)/libXt.sa.$(SOXTREV)
  345. X         XTOOLLIB = -lXt
  346. X        DEPXAWLIB = $(USRLIBDIR)/libXaw.sa.$(SOXAWREV)
  347. X           XAWLIB = -lXaw
  348. X        DEPXILIB =
  349. X           XILIB = -lXi
  350. X        SOXLIBREV = 4.10
  351. X          SOXTREV = 4.10
  352. X         SOXAWREV = 5.0
  353. X        SOOLDXREV = 4.10
  354. X         SOXMUREV = 4.10
  355. X        SOXEXTREV = 4.10
  356. X      SOXINPUTREV = 4.10
  357. X      DEPXAUTHLIB = $(USRLIBDIR)/libXau.a
  358. X         XAUTHLIB =  -lXau
  359. X      DEPXDMCPLIB = $(USRLIBDIR)/libXdmcp.a
  360. X         XDMCPLIB =  -lXdmcp
  361. X        DEPPHIGSLIB = $(USRLIBDIR)/libphigs.a
  362. X           PHIGSLIB =  -lphigs
  363. X       DEPXBSDLIB = $(USRLIBDIR)/libXbsd.a
  364. X          XBSDLIB =  -lXbsd
  365. X LINTEXTENSIONLIB = $(LINTLIBDIR)/llib-lXext.ln
  366. X         LINTXLIB = $(LINTLIBDIR)/llib-lX11.ln
  367. X          LINTXMU = $(LINTLIBDIR)/llib-lXmu.ln
  368. X        LINTXTOOL = $(LINTLIBDIR)/llib-lXt.ln
  369. X          LINTXAW = $(LINTLIBDIR)/llib-lXaw.ln
  370. X           LINTXI = $(LINTLIBDIR)/llib-lXi.ln
  371. X        LINTPHIGS = $(LINTLIBDIR)/llib-lphigs.ln
  372. X          DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
  373. X         DEPLIBS1 = $(DEPLIBS)
  374. X         DEPLIBS2 = $(DEPLIBS)
  375. X         DEPLIBS3 = $(DEPLIBS)
  376. X# -------------------------------------------------------------------------
  377. X# Imake rules for building libraries, programs, scripts, and data files
  378. X# rules:  $XConsortium: Imake.rules,v 1.123 91/09/16 20:12:16 rws Exp $
  379. X# -------------------------------------------------------------------------
  380. X# start of Imakefile
  381. X#    Fig2dev Driver Library Makefile
  382. X# to set paper size to A4             add -DA4d    to DEFINES list
  383. X# to set IBM Graphics Enhancement Cartridge    add -DIBMGEC    to DEFINES list
  384. X# to set DVI-to-PostScript driver to dvips    add -DDVIPS    to DEFINES list
  385. XDEFINES = -DDVIPS
  386. XDEPLIBS =
  387. XINCLUDES = -I..
  388. XSRCS =  genbox.c genepic.c genibmgl.c genlatex.c genpic.c genpictex.c \
  389. X    genps.c genpstex.c gentextyl.c gentpic.c setfigfont.c
  390. XLIBOBJS = genbox.o genepic.o genibmgl.o genlatex.o genpic.o genpictex.o \
  391. X    genps.o genpstex.o gentextyl.o gentpic.o setfigfont.o
  392. XLIB = transfig
  393. Xall:: lib$(LIB).a
  394. Xlib$(LIB).a: $(LIBOBJS)
  395. X    $(RM) $@
  396. X    $(AR) $@ $(LIBOBJS)
  397. X    $(RANLIB) $@
  398. Xdepend::
  399. X    $(DEPEND) $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
  400. X# -------------------------------------------------------------------------
  401. X# common rules for all Makefiles - do not edit
  402. Xemptyrule::
  403. Xclean::
  404. X    $(RM_CMD) "#"*
  405. XMakefile::
  406. X    -@if [ -f Makefile ]; then set -x; \
  407. X    $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
  408. X    else exit 0; fi
  409. X    $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)
  410. Xtags::
  411. X    $(TAGS) -w *.[ch]
  412. X    $(TAGS) -xw *.[ch] > TAGS
  413. Xsaber:
  414. X    # load $(ALLDEFINES) $(SRCS)
  415. Xosaber:
  416. X    # load $(ALLDEFINES) $(OBJS)
  417. X# -------------------------------------------------------------------------
  418. X# empty rules for directories that do not have SUBDIRS - do not edit
  419. Xinstall::
  420. X    @echo "install in $(CURRENT_DIR) done"
  421. Xinstall.man::
  422. X    @echo "install.man in $(CURRENT_DIR) done"
  423. XMakefiles::
  424. Xincludes::
  425. X# -------------------------------------------------------------------------
  426. X# dependencies generated by makedepend
  427. END_OF_FILE
  428. if test 9932 -ne `wc -c <'fig2dev/dev/Makefile'`; then
  429.     echo shar: \"'fig2dev/dev/Makefile'\" unpacked with wrong size!
  430. # end of 'fig2dev/dev/Makefile'
  431. if test -f 'fig2dev/dev/genpstex.c' -a "${1}" != "-c" ; then 
  432.   echo shar: Will not clobber existing file \"'fig2dev/dev/genpstex.c'\"
  433. echo shar: Extracting \"'fig2dev/dev/genpstex.c'\" \(3764 characters\)
  434. sed "s/^X//" >'fig2dev/dev/genpstex.c' <<'END_OF_FILE'
  435. X * TransFig: Facility for Translating Fig code
  436. X * Copyright (c) 1985 Supoj Sutantavibul
  437. X * Copyright (c) 1991 Micah Beck
  438. X * Permission to use, copy, modify, distribute, and sell this software and its
  439. X * documentation for any purpose is hereby granted without fee, provided that
  440. X * the above copyright notice appear in all copies and that both that
  441. X * copyright notice and this permission notice appear in supporting
  442. X * documentation. The authors make no representations about the suitability 
  443. X * of this software for any purpose.  It is provided "as is" without express 
  444. X * or implied warranty.
  445. X * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  446. X * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  447. X * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  448. X * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  449. X * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  450. X * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  451. X * PERFORMANCE OF THIS SOFTWARE.
  452. X *    genpstex.c : psTeX and psTeX_t drivers for fig2dev
  453. X *    Author: Jose Alberto Fernandez R /Maryland CP 9/90
  454. X *     It uses the LaTeX and PostScript drivers to generate 
  455. X *      LaTeX processed text for a Postscript figure.
  456. X * The pstex_t driver is like a latex driver that only translates 
  457. X * text defined in the defaul font.
  458. X * The pstex driver is like a PostScript driver that translates 
  459. X * everything except for text in the default font.
  460. X * The option '-p file' added to the pstex_t translator specifies
  461. X * the name of the PostScript file to be called in the psfig macro.
  462. X * If not set or its value is null then no PS file will be inserted.
  463. X * Jose Alberto.
  464. X#if defined(hpux) || defined(SYSV)
  465. X#include <sys/types.h>
  466. X#endif
  467. X#include <sys/file.h>
  468. X#include <stdio.h>
  469. X#include <math.h>
  470. X#include "object.h"
  471. X#include "fig2dev.h"
  472. X#include "texfonts.h"
  473. X#ifndef fabs
  474. Xextern double fabs();
  475. X#endif
  476. X#ifndef sin
  477. Xextern double sin();
  478. X#endif
  479. X#ifndef cos
  480. Xextern double cos();
  481. X#endif
  482. X#ifndef acos
  483. Xextern double acos();
  484. X#endif
  485. X#ifndef atan
  486. Xextern double atan();
  487. X#endif
  488. Xextern double rad2deg;
  489. X#ifdef hpux
  490. X#define rint(a) floor((a)+0.5)     /* close enough? */
  491. X#endif
  492. X#ifdef gould
  493. X#define rint(a) floor((a)+0.5)     /* close enough? */
  494. X#endif
  495. Xextern void genlatex_start (),
  496. X    gendev_null (),
  497. X    genlatex_end (),
  498. X         genps_option (),
  499. X    genps_start (),
  500. X    genps_arc (),
  501. X    genps_ellipse (),
  502. X    genps_line (),
  503. X    genps_spline (),
  504. X    genps_end (),
  505. X        genlatex_option (),
  506. X        genlatex_text (),
  507. X        genps_text ();
  508. Xstatic char pstex_file[1000] = "";
  509. Xvoid genpstex_t_option(opt, optarg)
  510. Xchar opt, *optarg;
  511. X       if (opt == 'p') strcpy(pstex_file, optarg);
  512. X       else genlatex_option(opt, optarg);
  513. Xvoid genpstex_t_start(objects)
  514. XF_compound    *objects;
  515. X    /* Put PostScript Image if any*/
  516. X        if (pstex_file[0] != '\0')
  517. X        {
  518. X        fprintf(tfp, "\\begin{picture}(0,0)%%\n");
  519. X        fprintf(tfp, "\\special{psfile=%s}%%\n",pstex_file);
  520. X        fprintf(tfp, "\\end{picture}%%\n");
  521. X        genlatex_start(objects);
  522. Xvoid genpstex_t_text(t)
  523. XF_text    *t;
  524. X    if (!special_text(t))
  525. X      gendev_null(t);
  526. X    else genlatex_text(t);
  527. Xvoid genpstex_text(t)
  528. XF_text    *t;
  529. X    if (!special_text(t))
  530. X      genps_text(t);
  531. X    else gendev_null(t);
  532. Xvoid genpstex_option(opt, optarg)
  533. Xchar opt, *optarg;
  534. X       if (opt != 'p') genlatex_option(opt, optarg);
  535. Xstruct driver dev_pstex_t = {
  536. X         genpstex_t_option,
  537. X    genpstex_t_start,
  538. X    gendev_null,
  539. X    gendev_null,
  540. X    gendev_null,
  541. X    gendev_null,
  542. X    genpstex_t_text,
  543. X    genlatex_end,
  544. X    EXCLUDE_TEXT
  545. Xstruct driver dev_pstex = {
  546. X         genpstex_option,
  547. X    genps_start,
  548. X    genps_arc,
  549. X    genps_ellipse,
  550. X    genps_line,
  551. X    genps_spline,
  552. X    genpstex_text,
  553. X    genps_end,
  554. X    INCLUDE_TEXT
  555. END_OF_FILE
  556. if test 3764 -ne `wc -c <'fig2dev/dev/genpstex.c'`; then
  557.     echo shar: \"'fig2dev/dev/genpstex.c'\" unpacked with wrong size!
  558. # end of 'fig2dev/dev/genpstex.c'
  559. if test -f 'fig2dev/dev/tpicfonts.h' -a "${1}" != "-c" ; then 
  560.   echo shar: Will not clobber existing file \"'fig2dev/dev/tpicfonts.h'\"
  561. echo shar: Extracting \"'fig2dev/dev/tpicfonts.h'\" \(4655 characters\)
  562. sed "s/^X//" >'fig2dev/dev/tpicfonts.h' <<'END_OF_FILE'
  563. X * TransFig: Facility for Translating Fig code
  564. X * Copyright (c) 1985 Supoj Sutantavibul
  565. X * Copyright (c) 1991 Micah Beck
  566. X * Permission to use, copy, modify, distribute, and sell this software and its
  567. X * documentation for any purpose is hereby granted without fee, provided that
  568. X * the above copyright notice appear in all copies and that both that
  569. X * copyright notice and this permission notice appear in supporting
  570. X * documentation. The authors make no representations about the suitability 
  571. X * of this software for any purpose.  It is provided "as is" without express 
  572. X * or implied warranty.
  573. X * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  574. X * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  575. X * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  576. X * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  577. X * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  578. X * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  579. X * PERFORMANCE OF THIS SOFTWARE.
  580. Xstatic char        *texfontnames[] = {
  581. X            "rm",            /* default */
  582. X            "rm",            /* roman */
  583. X            "bf",            /* bold */
  584. X            "it",            /* italic */
  585. X            "sf",             /* sans serif */
  586. X            "sl",            /* slanted */
  587. X            "tt",            /* typewriter */
  588. X            /* Virtual fonts from here on */
  589. X            "avant",
  590. X            "avantcsc",
  591. X            "avantd",
  592. X            "avantdi",
  593. X            "avanti",
  594. X            "bookd",
  595. X            "bookdi",
  596. X            "bookl",
  597. X            "booklcsc",
  598. X            "bookli",
  599. X            "chanc",
  600. X            "cour",
  601. X            "courb",
  602. X            "courbi",
  603. X            "couri",
  604. X            "helv",
  605. X            "helvb",
  606. X            "helvbi",
  607. X            "helvc",
  608. X            "helvcb",
  609. X            "helvcbi",
  610. X            "helvci",
  611. X            "helvcsc",
  612. X            "helvi",
  613. X            "pal",
  614. X            "palb",
  615. X            "palbi",
  616. X            "palbu",
  617. X            "palc",
  618. X            "palcsc",
  619. X            "pali",
  620. X            "palsl",
  621. X            "palu",
  622. X            "palx",
  623. X            "times",
  624. X            "timesb",
  625. X            "timesbi",
  626. X            "timesc",
  627. X            "timescsc",
  628. X            "timesi",
  629. X            "timessl",
  630. X            "timesx"
  631. X        };
  632. X#define    MAX_TPICFONT    48
  633. X/* The selection of font names may be site dependent.
  634. X * Not all fonts are preloaded at all sizes.
  635. Xstatic char        *texfontsizes[] = {
  636. X            "ten",            /* default */
  637. X            "fiv", "fiv", "fiv", "fiv",     /* small fonts */
  638. X            "fiv",            /* five point font */
  639. X            "six", "sev", "egt",    /* etc */
  640. X            "nin", "ten", "elv",
  641. X            "twl", "twl", "frtn",    
  642. X            "frtn", "frtn", "svtn",
  643. X            "svtn", "svtn", "twty",
  644. X            "twty", "twty", "twty", "twty", "twfv"
  645. X            };
  646. Xstatic int        TeXfontsizes[] = {
  647. X            10,        /* default */
  648. X            5, 5, 5, 5,     /* small fonts */
  649. X            5,            /* five point font */
  650. X            6, 7, 8,    /* etc */
  651. X            9, 10, 11,
  652. X            12, 12, 14,    
  653. X            14, 14, 17,
  654. X            17, 17, 20,
  655. X            20, 20, 20, 20, 25
  656. X            };
  657. X#define MAXFONTSIZE 25
  658. X#define TEXFONT(F)    (texfontnames[((F) <= MAX_TPICFONT) ? (F) : MAX_TPICFONT])
  659. X#define TEXFONTSIZE(S)    (texfontsizes[((S) <= MAXFONTSIZE) ? (S) : MAXFONTSIZE])
  660. X#define TEXFONTMAG(T)    TEXFONTSIZE((int)(T->size*(rigid_text(T) ? 1.0 : mag)))
  661. X#define TEXFONTSIZEINT(S)    (TeXfontsizes[((S) <= MAXFONTSIZE) ? (S) : MAXFONTSIZE])
  662. X#define TEXFONTMAGINT(T)    TEXFONTSIZEINT((int)(T->size*(rigid_text(T) ? 1.0 : mag)))
  663. Xstatic char    *texture_patterns[] = {
  664. X    "8 0 8 0 4 1 3 e 0 8 0 8 1 4 e 3",    /* scales */
  665. X    "f f 8 0 8 0 8 0 f f 0 8 0 8 0 8",    /* bricks */
  666. X    "8 1 4 2 2 4 1 8 8 1 4 2 2 4 1 8",    /* waves */
  667. X    "8 0 4 0 2 0 1 0 0 8 0 4 0 2 0 1",    /* light backslash alternating */
  668. X    "e 0 7 0 3 8 1 c 0 e 0 7 8 3 c 1",    /* heavy backslash alternating */
  669. X    "7 7 b b d d e e 7 7 b b d d e e",    /* heavy backslash */
  670. X    "8 8 4 4 2 2 1 1 8 8 4 4 2 2 1 1",    /* light backslash */
  671. X    "9 9 c c 6 6 3 3 9 9 c c 6 6 3 3",    /* medium backslash */
  672. X    "2 0 4 0 8 0 0 0 0 8 0 4 0 2 0 0",    /* light hash */
  673. X    "f f 0 0 f f 0 0 f f 0 0 f f 0 0",    /* horizontal lines */
  674. X    "f f 0 0 0 0 0 0 f f 0 0 0 0 0 0",    /* spaced horizontal lines */
  675. X    "c c 0 0 0 0 0 0 3 3 0 0 0 0 0 0",    /* spaced horizontal dashed lines */
  676. X    "f 0 f 0 f 0 f 0 0 f 0 f 0 f 0 f",    /* chessboard */
  677. X    "f f 8 8 8 8 8 8 f f 8 8 8 8 8 8",    /* light meshed lines */
  678. X    "a a 4 4 a a 1 1 a a 4 4 a a 1 1",    /* hashed dotted lines */
  679. X    "0 1 0 2 0 4 0 8 1 0 2 0 4 0 8 0",    /* spaced light frontslash */
  680. X    "8 3 0 7 0 e 1 c 3 8 7 0 e 0 c 1",    /* spaced heavy frontslash */
  681. X    "e e d d b b 7 7 e e d d b b 7 7",    /* heavy frontslash */
  682. X    "1 1 2 2 4 4 8 8 1 1 2 2 4 4 8 8",    /* light frontslash */
  683. X    "3 3 6 6 c c 9 9 3 3 6 6 c c 9 9",    /* medium frontslash */
  684. X    "4 0 a 0 0 0 0 0 0 4 0 a 0 0 0 0",    /* wallpaper - birds */
  685. X    "a a a a a a a a a a a a a a a a",    /* vertical lines */
  686. X    "8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8",    /* spaced vertical lines */
  687. X    "0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 0",    /* vertical dashed lines */
  688. X    "0 0 0 8 1 4 2 a 5 5 2 a 1 4 0 8",    /* hashed diamonds */
  689. X    "f f 8 0 8 0 8 0 8 0 8 0 8 0 8 0",    /* spaced meshed lines */
  690. X    "8 2 4 4 2 8 1 0 2 8 4 4 8 2 0 1"    /* hashed dotted lines */
  691. X#define    MAXPATTERNS    27
  692. END_OF_FILE
  693. if test 4655 -ne `wc -c <'fig2dev/dev/tpicfonts.h'`; then
  694.     echo shar: \"'fig2dev/dev/tpicfonts.h'\" unpacked with wrong size!
  695. # end of 'fig2dev/dev/tpicfonts.h'
  696. if test -f 'fig2dev/fig2dev.c' -a "${1}" != "-c" ; then 
  697.   echo shar: Will not clobber existing file \"'fig2dev/fig2dev.c'\"
  698. echo shar: Extracting \"'fig2dev/fig2dev.c'\" \(7009 characters\)
  699. sed "s/^X//" >'fig2dev/fig2dev.c' <<'END_OF_FILE'
  700. X * TransFig: Facility for Translating Fig code
  701. X * Copyright (c) 1985 Supoj Sutantavibul
  702. X * Copyright (c) 1991 Micah Beck
  703. X * Permission to use, copy, modify, distribute, and sell this software and its
  704. X * documentation for any purpose is hereby granted without fee, provided that
  705. X * the above copyright notice appear in all copies and that both that
  706. X * copyright notice and this permission notice appear in supporting
  707. X * documentation. The authors make no representations about the suitability 
  708. X * of this software for any purpose.  It is provided "as is" without express 
  709. X * or implied warranty.
  710. X * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  711. X * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  712. X * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  713. X * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  714. X * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  715. X * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  716. X * PERFORMANCE OF THIS SOFTWARE.
  717. X *    Fig2dev : General Fig code translation program
  718. X#if defined(hpux) || defined(SYSV)
  719. X#include <sys/types.h>
  720. X#endif
  721. X#include <sys/file.h>
  722. X#include <stdio.h>
  723. X#include <ctype.h>
  724. X#include "patchlevel.h"
  725. X#include "object.h"
  726. X#include "fig2dev.h"
  727. X#include "drivers.h"
  728. Xextern int getopt();
  729. Xextern char *optarg;
  730. Xextern int optind;
  731. X#define DEFAULT_FONT_SIZE 11
  732. Xstruct driver *dev = NULL;
  733. Xchar        Usage[] = "Usage: %s [-L language] [-f font] [-s size] [-m scale] [input [output]]\n";
  734. Xchar        Err_badarg[] = "Argument -%c unkown to %s driver.";
  735. Xchar        Err_incomp[] = "Incomplete %s object at line %d.";
  736. Xchar        Err_mem[] = "Running out of memory.";
  737. Xchar        *prog;
  738. Xchar        *from = NULL, *to = NULL;
  739. Xint        font_size = 0;
  740. Xdouble        mag = 1.0;
  741. XFILE        *tfp = NULL;
  742. Xint        llx = 0, lly = 0, urx = 0, ury = 0;
  743. Xstruct obj_rec {
  744. X    void (*gendev)();
  745. X    char *obj;
  746. X    int depth;
  747. Xput_msg(format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
  748. Xchar   *format, *arg1, *arg2, *arg3, *arg4, *arg5, *arg6, *arg7, *arg8;
  749. X    fprintf(stderr, format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
  750. X    fprintf(stderr, "\n");
  751. Xget_args(argc, argv)
  752. Xint     argc;
  753. Xchar    *argv[];
  754. X      int    c, i;
  755. X    double    atof();
  756. X    prog = *argv;
  757. X/* add :? */
  758. X    while ((c = getopt(argc, argv, "acd:f:l:L:m:Pp:s:S:vVwW?")) != EOF) {
  759. X      /* generic option handling */
  760. X      switch (c) {
  761. X        case 'V': 
  762. X            fprintf(stderr, "TransFig Version %s Patchlevel %s\n",
  763. X                            VERSION, PATCHLEVEL);
  764. X            exit(0);
  765. X            break;
  766. X        case 'L':            /* set output language */
  767. X            for (i=0; *drivers[i].name; i++) 
  768. X            if (!strcmp(optarg, drivers[i].name))
  769. X                dev = drivers[i].dev;
  770. X            if (!dev) {
  771. X            fprintf(stderr,
  772. X                "Unknown graphics language %s\n", optarg);
  773. X            fprintf(stderr,"Known languages are:\n");
  774. X            /* display available languages - 23/01/90 */
  775. X            for (i=0; *drivers[i].name; i++)
  776. X                fprintf(stderr,"%s ",drivers[i].name);
  777. X            fprintf(stderr,"\n");
  778. X            exit(1);
  779. X            }
  780. X            break;
  781. X        case 's':            /* set default font size */
  782. X            font_size = atoi(optarg);
  783. X            break;
  784. X        case 'm':            /* set magnification */
  785. X            mag = atof(optarg);
  786. X            break;
  787. X        case '?':            /* usage         */
  788. X            fprintf(stderr,Usage,prog);
  789. X            exit(1);
  790. X        }
  791. X        /* pass options through to driver */
  792. X        if (!dev) {
  793. X        fprintf(stderr, "No graphics language specified.\n");
  794. X        exit(1);
  795. X        }
  796. X        dev->option(c, optarg);
  797. X          }
  798. X          if (!dev) {
  799. X        fprintf(stderr, "No graphics language specified.\n");
  800. X        exit(1);
  801. X          }
  802. X    /* default font size is scaled if not specified */
  803. X    if (!font_size) font_size = DEFAULT_FONT_SIZE*mag + 0.5;
  804. X    if (optind < argc) from = argv[optind++];  /*  from file  */
  805. X    if (optind < argc) to   = argv[optind];  /*  to file    */
  806. Xmain(argc, argv)
  807. Xint     argc;
  808. Xchar    *argv[];
  809. X    F_compound    objects;
  810. X    int        status;
  811. X    get_args(argc, argv);
  812. X    if (from)
  813. X        status = read_fig(from, &objects);
  814. X    else    /* read from stdin */
  815. X        status = readfp_fig(stdin, &objects);
  816. X    if (status != 0) {
  817. X        if (from) read_fail_message(from, status);
  818. X        exit(1);
  819. X        }
  820. X    if (to == NULL)
  821. X        tfp = stdout;
  822. X    else if ((tfp = fopen(to, "w")) == NULL) {
  823. X        fprintf(stderr, "Couldn't open %s", to);
  824. X        fprintf(stderr, Usage, prog);
  825. X        exit(1);
  826. X        }
  827. X    gendev_objects(&objects, dev);
  828. X    if (tfp != stdout) (void)fclose(tfp);
  829. X    exit(0);
  830. X/* count primitive objects & create pointer array */
  831. Xstatic int compound_dump(com, array, count, dev)
  832. XF_compound *com;
  833. Xstruct obj_rec *array;
  834. Xint count;
  835. Xstruct driver *dev;
  836. X      F_arc        *a;
  837. X    F_compound    *c;
  838. X    F_ellipse    *e;
  839. X    F_line        *l;
  840. X    F_spline    *s;
  841. X    F_text        *t;
  842. X    for (c = com->compounds; c != NULL; c = c->next)
  843. X      count = compound_dump(c, array, count, dev);
  844. X    for (a = com->arcs; a != NULL; a = a->next) {
  845. X      if (array) {
  846. X        array[count].gendev = dev->arc;
  847. X        array[count].obj = (char *)a;
  848. X        array[count].depth = a->depth;
  849. X      }
  850. X      count += 1;
  851. X    for (e = com->ellipses; e != NULL; e = e->next) {
  852. X      if (array) {
  853. X        array[count].gendev = dev->ellipse;
  854. X        array[count].obj = (char *)e;
  855. X        array[count].depth = e->depth;
  856. X      }
  857. X      count += 1;
  858. X    for (l = com->lines; l != NULL; l = l->next) {
  859. X      if (array) {
  860. X        array[count].gendev = dev->line;
  861. X        array[count].obj = (char *)l;
  862. X        array[count].depth = l->depth;
  863. X      }
  864. X      count += 1;
  865. X    for (s = com->splines; s != NULL; s = s->next) {
  866. X      if (array) {
  867. X        array[count].gendev = dev->spline;
  868. X        array[count].obj = (char *)s;
  869. X        array[count].depth = s->depth;
  870. X      }
  871. X      count += 1;
  872. X    for (t = com->texts; t != NULL; t = t->next) {
  873. X      if (array) {
  874. X        array[count].gendev = dev->text;
  875. X        array[count].obj = (char *)t;
  876. X        array[count].depth = t->depth;
  877. X      }
  878. X      count += 1;
  879. X    return count;
  880. Xgendev_objects(objects, dev)
  881. XF_compound    *objects;
  882. Xstruct driver *dev;
  883. X    F_arc        *a;
  884. X    F_compound    *c;
  885. X    F_ellipse    *e;
  886. X    F_line        *l;
  887. X    F_spline    *s;
  888. X    F_text        *t;
  889. X    int obj_count, rec_comp();
  890. X    struct obj_rec *rec_array, *r; 
  891. X    if (0 == (double)objects->nwcorner.x) {
  892. X        fprintf(stderr, "Resolution is zero!! default to 80 ppi\n");
  893. X        objects->nwcorner.x = 80;
  894. X        }
  895. X    if (objects->nwcorner.y != 1 && objects->nwcorner.y != 2) {
  896. X        fprintf(stderr, "Wrong coordinate system; cannot continue\n");
  897. X        return;
  898. X        }
  899. X    /* Compute bounding box of objects, supressing texts if indicated */
  900. X    compound_bound(objects, &llx, &lly, &urx, &ury, dev->text_include);
  901. X    /* dump object pointers to an array */
  902. X    obj_count = compound_dump(objects, 0, 0, dev);
  903. X    if (!obj_count) {
  904. X        fprintf(stderr, "No object");
  905. X        return;
  906. X        }
  907. X    rec_array = (struct obj_rec *)malloc(obj_count*sizeof(struct obj_rec));
  908. X    (void)compound_dump(objects, rec_array, 0, dev);
  909. X    /* sort object array by depth */
  910. X    qsort(rec_array, obj_count, sizeof(struct obj_rec), rec_comp);
  911. X    /* generate header */
  912. X    (*dev->start)(objects);
  913. X    /* generate objects in sorted order */
  914. X    for (r = rec_array; r<rec_array+obj_count; r++)
  915. X        (*(r->gendev))(r->obj);
  916. X    /* generate trailer */
  917. X    (*dev->end)();
  918. Xint rec_comp(r1, r2)
  919. Xstruct obj_rec *r1, *r2;
  920. X    return (r2->depth - r1->depth);
  921. X/* null operation */
  922. Xvoid gendev_null() {};
  923. END_OF_FILE
  924. if test 7009 -ne `wc -c <'fig2dev/fig2dev.c'`; then
  925.     echo shar: \"'fig2dev/fig2dev.c'\" unpacked with wrong size!
  926. # end of 'fig2dev/fig2dev.c'
  927. if test -f 'fig2dev/getopt.c' -a "${1}" != "-c" ; then 
  928.   echo shar: Will not clobber existing file \"'fig2dev/getopt.c'\"
  929. echo shar: Extracting \"'fig2dev/getopt.c'\" \(4071 characters\)
  930. sed "s/^X//" >'fig2dev/getopt.c' <<'END_OF_FILE'
  931. X * TransFig: Facility for Translating Fig code
  932. X * Copyright (c) 1985 Supoj Sutantavibul
  933. X * Copyright (c) 1991 Micah Beck
  934. X * Permission to use, copy, modify, distribute, and sell this software and its
  935. X * documentation for any purpose is hereby granted without fee, provided that
  936. X * the above copyright notice appear in all copies and that both that
  937. X * copyright notice and this permission notice appear in supporting
  938. X * documentation. The authors make no representations about the suitability 
  939. X * of this software for any purpose.  It is provided "as is" without express 
  940. X * or implied warranty.
  941. X * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  942. X * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  943. X * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  944. X * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  945. X * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  946. X * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  947. X * PERFORMANCE OF THIS SOFTWARE.
  948. X    I got this off net.sources from Henry Spencer.
  949. X    It is a public domain getopt(3) like in System V.
  950. X    I have made the following modifications:
  951. X    index(s,c) was added because too many people could
  952. X    not compile getopt without it.
  953. X    A test main program was added, ifdeffed by GETOPT.
  954. X    This main program is a public domain implementation
  955. X    of the getopt(1) program like in System V.  The getopt
  956. X    program can be used to standardize shell option handling.
  957. X        e.g.  cc -DGETOPT getopt.c -o getopt
  958. X#include <stdio.h>
  959. X#ifndef lint
  960. Xstatic    char    sccsfid[] = "@(#) getopt.c 5.0 (UTZoo) 1985";
  961. X#endif
  962. X#define    ARGCH    (int)':'
  963. X#define BADCH     (int)'?'
  964. X#define EMSG     ""
  965. X#define    ENDARGS  "--"
  966. X/* this is included because index is not on some UNIX systems */
  967. Xstatic
  968. Xchar *
  969. Xindex (s, c)
  970. Xregister    char    *s;
  971. Xregister    int     c;
  972. X    while (*s)
  973. X        if (c == *s) return (s);
  974. X        else s++;
  975. X    return (NULL);
  976. X * get option letter from argument vector
  977. Xint    opterr = 1,        /* useless, never set or used */
  978. X    optind = 1,        /* index into parent argv vector */
  979. X    optopt;            /* character checked for validity */
  980. Xchar    *optarg;        /* argument associated with option */
  981. X#define tell(s)    fputs(*nargv,stderr);fputs(s,stderr); \
  982. X        fputc(optopt,stderr);fputc('\n',stderr);return(BADCH);
  983. Xgetopt(nargc,nargv,ostr)
  984. Xint    nargc;
  985. Xchar    **nargv,
  986. X    *ostr;
  987. X    static char    *place = EMSG;    /* option letter processing */
  988. X    register char    *oli;        /* option letter list index */
  989. X    char    *index();
  990. X    if(!*place) {            /* update scanning pointer */
  991. X        if(optind >= nargc || *(place = nargv[optind]) != '-' || !*++place) return(EOF);
  992. X        if (*place == '-') {    /* found "--" */
  993. X            ++optind;
  994. X            return(EOF);
  995. X    }                /* option letter okay? */
  996. X    if ((optopt = (int)*place++) == ARGCH || !(oli = index(ostr,optopt))) {
  997. X        if(!*place) ++optind;
  998. X        tell(": illegal option -- ");
  999. X    if (*++oli != ARGCH) {        /* don't need argument */
  1000. X        optarg = NULL;
  1001. X        if (!*place) ++optind;
  1002. X    else {                /* need an argument */
  1003. X        if (*place) optarg = place;    /* no white space */
  1004. X        else if (nargc <= ++optind) {    /* no arg */
  1005. X            place = EMSG;
  1006. X            tell(": option requires an argument -- ");
  1007. X         else optarg = nargv[optind];    /* white space */
  1008. X        place = EMSG;
  1009. X        ++optind;
  1010. X    return(optopt);            /* dump back option letter */
  1011. X#ifdef GETOPT
  1012. X#ifndef lint
  1013. Xstatic    char    sccspid[] = "@(#) getopt.c 5.1 (WangInst) 6/15/85";
  1014. X#endif
  1015. Xmain (argc, argv) char **argv;
  1016. X    char    *optstring = argv[1];
  1017. X    char    *argv0 = argv[0];
  1018. X    extern    int     optind;
  1019. X    extern    char    *optarg;
  1020. X    int     opterr = 0;
  1021. X    int     C;
  1022. X    char    *opi;
  1023. X    if (argc == 1)
  1024. X        fprintf (stderr, "Usage: %s optstring args\n", argv0);
  1025. X        exit (1);
  1026. X    argv++;
  1027. X    argc--;
  1028. X    argv[0] = argv0;
  1029. X    while ((C = getopt (argc, argv, optstring)) != EOF)
  1030. X        if (C == BADCH) opterr++;
  1031. X        printf ("-%c ", C);
  1032. X        opi = index (optstring, C);
  1033. X        if (opi && opi[1] == ARGCH)
  1034. X            if (optarg)
  1035. X                printf ("\"%s\" ", optarg);
  1036. X            else opterr++;
  1037. X    printf ("%s", ENDARGS);
  1038. X    while (optind < argc)
  1039. X        printf (" \"%s\"", argv[optind++]);
  1040. X    putchar ('\n');
  1041. X    exit (opterr);
  1042. X#endif
  1043. END_OF_FILE
  1044. if test 4071 -ne `wc -c <'fig2dev/getopt.c'`; then
  1045.     echo shar: \"'fig2dev/getopt.c'\" unpacked with wrong size!
  1046. # end of 'fig2dev/getopt.c'
  1047. if test -f 'fig2dev/latex_line.c' -a "${1}" != "-c" ; then 
  1048.   echo shar: Will not clobber existing file \"'fig2dev/latex_line.c'\"
  1049. echo shar: Extracting \"'fig2dev/latex_line.c'\" \(5574 characters\)
  1050. sed "s/^X//" >'fig2dev/latex_line.c' <<'END_OF_FILE'
  1051. X * TransFig: Facility for Translating Fig code
  1052. X * Copyright (c) 1985 Supoj Sutantavibul
  1053. X * Copyright (c) 1991 Micah Beck
  1054. X * Permission to use, copy, modify, distribute, and sell this software and its
  1055. X * documentation for any purpose is hereby granted without fee, provided that
  1056. X * the above copyright notice appear in all copies and that both that
  1057. X * copyright notice and this permission notice appear in supporting
  1058. X * documentation. The authors make no representations about the suitability 
  1059. X * of this software for any purpose.  It is provided "as is" without express 
  1060. X * or implied warranty.
  1061. X * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  1062. X * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  1063. X * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  1064. X * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  1065. X * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  1066. X * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  1067. X * PERFORMANCE OF THIS SOFTWARE.
  1068. X#include <stdio.h>
  1069. X#include <math.h>
  1070. X *    latex_line.c: 
  1071. X *        Subroutines for drawing and translating lines for the LaTeX
  1072. X *        picture environment.
  1073. X *    Written by Frank Schmuck (schmuck@svax.cs.cornell.edu)
  1074. X *    June 1988
  1075. X *    The LaTeX picture environment allows generating pictures in standard
  1076. X *    LaTeX.  However, some restrictions apply:  lines and vectors (a vector
  1077. X *    is a line with an arrow at the end) can only be drawn with a finite
  1078. X *    number of slopes.  The available slopes are given by dy/dx where
  1079. X *    dx and dy must be integers <= 6 for lines and <= 4 for vectors.
  1080. X *    The subroutines in this file are used in fig2latex to approximate
  1081. X *    an arbitrary line or vector by a LaTeX line/vector, and in fig to 
  1082. X *    restrict line drawing to slopes supported by LaTeX.
  1083. X * Constant for converting from radian to degrees
  1084. Xdouble rad2deg = 57.295779513082320877;
  1085. Xint  pgcd(a,b)
  1086. X    int a, b;
  1087. X *  compute greatest common divisor, assuming 0 < a <= b
  1088. X    b = b % a;
  1089. X    return (b)? gcd(b, a): a;
  1090. Xint  gcd(a, b)
  1091. X    int a, b;
  1092. X *  compute greatest common divisor
  1093. X    if (a < 0) a = -a;
  1094. X    if (b < 0) b = -b;
  1095. X    return (a <= b)? pgcd(a, b): pgcd(b, a);
  1096. Xint  lcm(a, b)
  1097. X    int a, b;
  1098. X *  Compute least common multiple
  1099. X    return abs(a*b)/gcd(a,b);
  1100. X *  Tables of line and vector slopes supported by LaTeX
  1101. Xstruct angle_table {
  1102. X    int    x, y;
  1103. X    double angle;
  1104. X#define N_LINE 25
  1105. Xstruct angle_table line_angles[N_LINE] =
  1106. X  { {0, 1, 90.0}, 
  1107. X    {1, 0,  0.0},
  1108. X    {1, 1, 45.0}, 
  1109. X    {1, 2, 63.434948822922010648},
  1110. X    {1, 3, 71.565051177077989351},
  1111. X    {1, 4, 75.963756532073521417},
  1112. X    {1, 5, 78.690067525979786913},
  1113. X    {1, 6, 80.537677791974382609},
  1114. X    {2, 1, 26.565051177077989351},
  1115. X    {2, 3, 56.309932474020213086},
  1116. X    {2, 5, 68.198590513648188229}, 
  1117. X    {3, 1, 18.434948822922010648},
  1118. X    {3, 2, 33.690067525979786913},
  1119. X    {3, 4, 53.130102354155978703},
  1120. X    {3, 5, 59.036243467926478582},
  1121. X    {4, 1, 14.036243467926478588},
  1122. X    {4, 3, 36.869897645844021297},
  1123. X    {4, 5, 51.340191745909909396},
  1124. X    {5, 1, 11.309932474020213086},
  1125. X    {5, 2, 21.801409486351811770},
  1126. X    {5, 3, 30.963756532073521417},
  1127. X    {5, 4, 38.659808254090090604},
  1128. X    {5, 6, 50.194428907734805993},
  1129. X    {6, 1, 9.4623222080256173906},
  1130. X    {6, 5, 39.805571092265194006}
  1131. X  };
  1132. X#define N_ARROW 13
  1133. Xstruct angle_table arrow_angles[N_ARROW] =
  1134. X  { {0, 1, 90.0}, 
  1135. X    {1, 0,  0.0},
  1136. X    {1, 1, 45.0}, 
  1137. X    {1, 2, 63.434948822922010648},
  1138. X    {1, 3, 71.565051177077989351},
  1139. X    {1, 4, 75.963756532073521417},
  1140. X    {2, 1, 26.565051177077989351},
  1141. X    {2, 3, 56.309932474020213086},
  1142. X    {3, 1, 18.434948822922010648},
  1143. X    {3, 2, 33.690067525979786913},
  1144. X    {3, 4, 53.130102354155978703},
  1145. X    {4, 1, 14.036243467926478588},
  1146. X    {4, 3, 36.869897645844021297},
  1147. X  };
  1148. Xget_slope(dx, dy, sxp, syp, arrow)
  1149. X    int  dx, dy, *sxp, *syp, arrow;
  1150. X *  Find the LaTeX line slope that is closest to the one given by dx, dy.
  1151. X *  Result is returned in *sxp, *syp.  If (arrow != 0) the closest LaTeX
  1152. X *  vector slope is selected.
  1153. X    double angle;
  1154. X    int    i, s, max;
  1155. X    double d, d1;
  1156. X    struct angle_table *st;
  1157. X    if (dx == 0) {
  1158. X    *sxp = 0;
  1159. X    *syp = (dy < 0)? -1: 1;
  1160. X    return;
  1161. X    }
  1162. X    angle = atan((double)abs(dy) / (double)abs(dx)) * rad2deg;
  1163. X    if (arrow) {
  1164. X    st = arrow_angles;
  1165. X    max = N_ARROW;
  1166. X    } else {
  1167. X    st = line_angles;
  1168. X    max = N_LINE;
  1169. X    }
  1170. X    s = 0;
  1171. X    d = 9.9e9;
  1172. X    for (i = 0; i < max; i++) {
  1173. X    d1 = fabs(angle - st[i].angle);
  1174. X    if (d1 < d) {
  1175. X        s = i;
  1176. X        d = d1;
  1177. X    }
  1178. X    *sxp = st[s].x;
  1179. X    if (dx < 0) *sxp = -*sxp;
  1180. X    *syp = st[s].y;
  1181. X    if (dy < 0) *syp = -*syp;
  1182. Xlatex_endpoint(x1, y1, x2, y2, xout, yout, arrow, magnet)
  1183. X    int  x1, y1, x2, y2;
  1184. X    int  *xout, *yout;
  1185. X    int  arrow, magnet;
  1186. X *  Computes a point "close" to (x2,y2) that is reachable from (x1,y1)
  1187. X *  by a LaTeX line (LaTeX vector if arrow != 0).  The result is returned
  1188. X *  in *xout, *yout.  If (magnet > 1) the point returned is selected such that
  1189. X *  (*xout - x1) and (*yout - y1) are both multiples of magnet.
  1190. X    int    dx, dy, sx, sy, ds, dsx, dsy;
  1191. X    dx = x2-x1;
  1192. X    dy = y2-y1;
  1193. X    get_slope(dx, dy, &sx, &sy, arrow);
  1194. X    if (abs(sx) >= abs(sy)) {
  1195. X    ds = lcm(sx, magnet*gcd(sx,magnet));
  1196. X    dsx = (2*abs(dx)/ds + 1)/2;
  1197. X    dsx = (dx >= 0)? dsx*ds: -dsx*ds;
  1198. X    *xout = x1 + dsx;
  1199. X    *yout = y1 + dsx*sy/sx;
  1200. X    } else {
  1201. X    ds = lcm(sy, magnet*gcd(sy,magnet));
  1202. X    dsy = (2*abs(dy)/ds + 1)/2;
  1203. X    dsy = (dy >= 0)? dsy*ds: -dsy*ds;
  1204. X    *yout = y1 + dsy;
  1205. X    *xout = x1 + dsy*sx/sy;
  1206. X    }
  1207. END_OF_FILE
  1208. if test 5574 -ne `wc -c <'fig2dev/latex_line.c'`; then
  1209.     echo shar: \"'fig2dev/latex_line.c'\" unpacked with wrong size!
  1210. # end of 'fig2dev/latex_line.c'
  1211. if test -f 'fig2dev/object.h' -a "${1}" != "-c" ; then 
  1212.   echo shar: Will not clobber existing file \"'fig2dev/object.h'\"
  1213. echo shar: Extracting \"'fig2dev/object.h'\" \(6541 characters\)
  1214. sed "s/^X//" >'fig2dev/object.h' <<'END_OF_FILE'
  1215. X * TransFig: Facility for Translating Fig code
  1216. X * Copyright (c) 1985 Supoj Sutantavibul
  1217. X * Copyright (c) 1991 Micah Beck
  1218. X * Permission to use, copy, modify, distribute, and sell this software and its
  1219. X * documentation for any purpose is hereby granted without fee, provided that
  1220. X * the above copyright notice appear in all copies and that both that
  1221. X * copyright notice and this permission notice appear in supporting
  1222. X * documentation. The authors make no representations about the suitability 
  1223. X * of this software for any purpose.  It is provided "as is" without express 
  1224. X * or implied warranty.
  1225. X * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  1226. X * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  1227. X * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  1228. X * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  1229. X * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  1230. X * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  1231. X * PERFORMANCE OF THIS SOFTWARE.
  1232. X#define        DEFAULT                (-1)
  1233. Xtypedef        struct f_point {
  1234. X            int            x, y;
  1235. X            struct f_point        *next;
  1236. X            }
  1237. X        F_point;
  1238. Xtypedef        struct f_pos {
  1239. X            int            x, y;
  1240. X            }
  1241. X        F_pos;
  1242. Xtypedef        struct f_arrow {
  1243. X            int            type;
  1244. X            int            style;
  1245. X            double            thickness;
  1246. X            double            wid;
  1247. X            double            ht;
  1248. X            }
  1249. X        F_arrow;
  1250. Xtypedef        struct f_ellipse {
  1251. X            int            type;
  1252. X#define                    T_ELLIPSE_BY_RAD    1
  1253. X#define                    T_ELLIPSE_BY_DIA    2
  1254. X#define                    T_CIRCLE_BY_RAD        3
  1255. X#define                    T_CIRCLE_BY_DIA        4
  1256. X            int            style;
  1257. X            int            thickness;
  1258. X            int            color;
  1259. X#define                  BLACK_COLOR        0
  1260. X#define                    BLUE_COLOR        1
  1261. X#define                    GREEN_COLOR        2
  1262. X#define                    CYAN_COLOR        3
  1263. X#define                    RED_COLOR        4
  1264. X#define                    MAGENTA_COLOR        5
  1265. X#define                    YELLOW_COLOR        6
  1266. X#define                    WHITE_COLOR        7
  1267. X            int            depth;
  1268. X            int            direction;
  1269. X            double            style_val;
  1270. X            double            angle;
  1271. X            int            pen;
  1272. X            int            area_fill;
  1273. X#define                           UNFILLED    0
  1274. X#define                           WHITE_FILL    1
  1275. X#define                           BLACK_FILL    21
  1276. X            struct f_pos        center;
  1277. X            struct f_pos        radiuses;
  1278. X            struct f_pos        start;
  1279. X            struct f_pos        end;
  1280. X            struct f_ellipse    *next;
  1281. X            }
  1282. X        F_ellipse;
  1283. Xtypedef        struct f_arc {
  1284. X            int            type;
  1285. X#define                    T_3_POINTS_ARC        1
  1286. X            int            style;
  1287. X            int            thickness;
  1288. X            int            color;
  1289. X            int            depth;
  1290. X            int            pen;
  1291. X            int            area_fill;
  1292. X            double            style_val;
  1293. X            int            direction;
  1294. X            struct f_arrow        *for_arrow;
  1295. X            struct f_arrow        *back_arrow;
  1296. X            struct {double x, y;}    center;
  1297. X            struct f_pos        point[3];
  1298. X            struct f_arc        *next;
  1299. X            }
  1300. X        F_arc;
  1301. Xtypedef        struct f_line {
  1302. X            int            type;
  1303. X#define                    T_POLYLINE    1
  1304. X#define                    T_BOX        2
  1305. X#define                    T_POLYGON    3
  1306. X#define                                    T_ARC_BOX       4
  1307. X#define                                    T_EPS_BOX       5 
  1308. X            int            style;
  1309. X            int            thickness;
  1310. X            int            color;
  1311. X            int            depth;
  1312. X            double            style_val;
  1313. X            int            pen;
  1314. X             int            area_fill;
  1315. X            int            radius;    /* for T_ARC_BOX */
  1316. X            struct f_arrow        *for_arrow;
  1317. X            struct f_arrow        *back_arrow;
  1318. X            struct f_point        *points;
  1319. X                struct f_eps           *eps;
  1320. X            struct f_line        *next;
  1321. X            }
  1322. X        F_line;
  1323. Xtypedef struct f_eps {
  1324. X    char            file[256];
  1325. X    int             flipped;
  1326. X    unsigned char  *bitmap;
  1327. X    float        hw_ratio;
  1328. X    struct f_pos    bit_size;
  1329. X    int             pix_rotation, pix_width, pix_height, pix_flipped;
  1330. X        F_eps;
  1331. Xextern char EMPTY_EPS[];
  1332. Xtypedef        struct f_text {
  1333. X            int            type;
  1334. X#define                    T_LEFT_JUSTIFIED    0
  1335. X#define                    T_CENTER_JUSTIFIED    1
  1336. X#define                    T_RIGHT_JUSTIFIED    2
  1337. X            int            font;
  1338. X#define                    DEFAULT_FONT        0
  1339. X#define                    ROMAN_FONT        1
  1340. X#define                    BOLD_FONT        2
  1341. X#define                    ITALIC_FONT        3
  1342. X#define                    MODERN_FONT        4
  1343. X#define                    TYPEWRITER_FONT        5
  1344. X#define                    MAX_FONT        5
  1345. X            double            size;    /* point size */
  1346. X            int            color;
  1347. X            int            depth;
  1348. X            double            angle;    /* in radian */
  1349. X            int            flags;
  1350. X#define                    RIGID_TEXT    1    
  1351. X#define                    SPECIAL_TEXT    2
  1352. X#define                    PSFONT_TEXT    4
  1353. X            double            height;    /* pixels */
  1354. X            double            length;    /* pixels */
  1355. X            int            base_x;
  1356. X            int            base_y;
  1357. X            int            pen;
  1358. X            char            *cstring;
  1359. X            struct f_text        *next;
  1360. X            }
  1361. X        F_text;
  1362. X#define MAX_PSFONT    35
  1363. X#define MAXFONT(T) (psfont_text(T) ? MAX_PSFONT : MAX_FONT)
  1364. X#define        rigid_text(t) \
  1365. X            (t->flags == DEFAULT \
  1366. X                || (t->flags & RIGID_TEXT))
  1367. X#define        special_text(t) \
  1368. X            ((t->flags != DEFAULT \
  1369. X                && (t->flags & SPECIAL_TEXT)))
  1370. X#define        psfont_text(t) \
  1371. X            (t->flags != DEFAULT \
  1372. X                && (t->flags & PSFONT_TEXT))
  1373. Xtypedef        struct f_control {
  1374. X            double            lx, ly, rx, ry;
  1375. X            struct f_control    *next;
  1376. X            }
  1377. X        F_control;
  1378. X#define        int_spline(s)        (s->type & 0x2)
  1379. X#define        normal_spline(s)    (!(s->type & 0x2))
  1380. X#define        closed_spline(s)    (s->type & 0x1)
  1381. X#define        open_spline(s)        (!(s->type & 0x1))
  1382. Xtypedef        struct f_spline {
  1383. X            int            type;
  1384. X#define                    T_OPEN_NORMAL        0
  1385. X#define                    T_CLOSED_NORMAL        1
  1386. X#define                    T_OPEN_INTERPOLATED    2
  1387. X#define                    T_CLOSED_INTERPOLATED    3
  1388. X            int            style;
  1389. X            int            thickness;
  1390. X            int            color;
  1391. X            int            depth;
  1392. X            double            style_val;
  1393. X            int            pen;
  1394. X            int            area_fill;
  1395. X            struct f_arrow        *for_arrow;
  1396. X            struct f_arrow        *back_arrow;
  1397. X            /*
  1398. X            For T_OPEN_NORMAL and T_CLOSED_NORMAL points
  1399. X            are control points while they are knots for
  1400. X            T_OPEN_INTERPOLATED and T_CLOSED_INTERPOLTED
  1401. X            whose control points are stored in controls.
  1402. X            */
  1403. X            struct f_point        *points;
  1404. X            struct f_control    *controls;
  1405. X            struct f_spline        *next;
  1406. X            }
  1407. X        F_spline;
  1408. Xtypedef        struct f_compound {
  1409. X            struct f_pos        nwcorner;
  1410. X            struct f_pos        secorner;
  1411. X            struct f_line        *lines;
  1412. X            struct f_ellipse    *ellipses;
  1413. X            struct f_spline        *splines;
  1414. X            struct f_text        *texts;
  1415. X            struct f_arc        *arcs;
  1416. X            struct f_compound    *compounds;
  1417. X            struct f_compound    *next;
  1418. X            }
  1419. X        F_compound;
  1420. X#define        ARROW_SIZE        sizeof(struct f_arrow)
  1421. X#define        POINT_SIZE        sizeof(struct f_point)
  1422. X#define        CONTROL_SIZE        sizeof(struct f_control)
  1423. X#define        ELLOBJ_SIZE        sizeof(struct f_ellipse)
  1424. X#define        ARCOBJ_SIZE        sizeof(struct f_arc)
  1425. X#define        LINOBJ_SIZE        sizeof(struct f_line)
  1426. X#define        EPS_SIZE        sizeof(struct f_eps)
  1427. X#define        TEXOBJ_SIZE        sizeof(struct f_text)
  1428. X#define        SPLOBJ_SIZE        sizeof(struct f_spline)
  1429. X#define        COMOBJ_SIZE        sizeof(struct f_compound)
  1430. X/**********************  object codes  **********************/
  1431. X#define        O_ELLIPSE        1
  1432. X#define        O_POLYLINE        2
  1433. X#define        O_SPLINE        3
  1434. X#define        O_TEXT            4
  1435. X#define        O_ARC            5
  1436. X#define        O_COMPOUND        6
  1437. X#define        O_END_COMPOUND        (-O_COMPOUND)
  1438. X#define        O_ALL_OBJECT        99
  1439. X/************  object styles (except for f_text)  ************/
  1440. X#define        SOLID_LINE        0
  1441. X#define        DASH_LINE        1
  1442. X#define        DOTTED_LINE        2
  1443. X#define        CLOSED_PATH        0
  1444. X#define        OPEN_PATH        1
  1445. END_OF_FILE
  1446. if test 6541 -ne `wc -c <'fig2dev/object.h'`; then
  1447.     echo shar: \"'fig2dev/object.h'\" unpacked with wrong size!
  1448. # end of 'fig2dev/object.h'
  1449. if test -f 'fig2dev/psfonts.c' -a "${1}" != "-c" ; then 
  1450.   echo shar: Will not clobber existing file \"'fig2dev/psfonts.c'\"
  1451. echo shar: Extracting \"'fig2dev/psfonts.c'\" \(6461 characters\)
  1452. sed "s/^X//" >'fig2dev/psfonts.c' <<'END_OF_FILE'
  1453. X * TransFig: Facility for Translating Fig code
  1454. X * Copyright (c) 1985 Supoj Sutantavibul
  1455. X * Copyright (c) 1991 Micah Beck
  1456. X * Permission to use, copy, modify, distribute, and sell this software and its
  1457. X * documentation for any purpose is hereby granted without fee, provided that
  1458. X * the above copyright notice appear in all copies and that both that
  1459. X * copyright notice and this permission notice appear in supporting
  1460. X * documentation. The authors make no representations about the suitability 
  1461. X * of this software for any purpose.  It is provided "as is" without express 
  1462. X * or implied warranty.
  1463. X * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  1464. X * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  1465. X * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  1466. X * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  1467. X * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  1468. X * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  1469. X * PERFORMANCE OF THIS SOFTWARE.
  1470. X *    psfont.c : PostScript font mappings
  1471. X#include <stdio.h>
  1472. X#include "object.h"
  1473. Xchar            *PSfontnames[] = {
  1474. X            "Times-Roman", "Times-Roman",    /* default */
  1475. X            "Times-Italic",            /* italic */
  1476. X            "Times-Bold",            /* bold */
  1477. X            "Times-BoldItalic",
  1478. X            "AvantGarde-Book",
  1479. X            "AvantGarde-BookOblique",
  1480. X            "AvantGarde-Demi",
  1481. X            "AvantGarde-DemiOblique",
  1482. X            "Bookman-Light",
  1483. X            "Bookman-LightItalic",
  1484. X            "Bookman-Demi",
  1485. X            "Bookman-DemiItalic",
  1486. X            "Courier",    
  1487. X            "Courier-Oblique",
  1488. X            "Courier-Bold",
  1489. X            "Courier-BoldOblique",
  1490. X            "Helvetica",
  1491. X            "Helvetica-Oblique",
  1492. X            "Helvetica-Bold",
  1493. X            "Helvetica-BoldOblique",
  1494. X            "Helvetica-Narrow",
  1495. X            "Helvetica-Narrow-Oblique",
  1496. X            "Helvetica-Narrow-Bold",
  1497. X            "Helvetica-Narrow-BoldOblique",
  1498. X            "NewCenturySchlbk-Roman",
  1499. X            "NewCenturySchlbk-Italic",
  1500. X            "NewCenturySchlbk-Bold",
  1501. X            "NewCenturySchlbk-BoldItalic",
  1502. X            "Palatino-Roman",
  1503. X            "Palatino-Italic",
  1504. X            "Palatino-Bold",
  1505. X            "Palatino-BoldItalic",
  1506. X            "Symbol",
  1507. X            "ZapfChancery-MediumItalic",
  1508. X            "ZapfDingbats"
  1509. X        };
  1510. Xstatic int    PSfontmap[] = {
  1511. X        ROMAN_FONT, ROMAN_FONT,        /* Times-Roman */
  1512. X        ITALIC_FONT,            /* Times-Italic */
  1513. X        BOLD_FONT,            /* Times-Bold */
  1514. X        BOLD_FONT,            /* Times-BoldItalic */
  1515. X        ROMAN_FONT,            /* AvantGarde */
  1516. X        ROMAN_FONT,            /* AvantGarde-BookOblique */
  1517. X        ROMAN_FONT,            /* AvantGarde-Demi */
  1518. X        ROMAN_FONT,            /* AvantGarde-DemiOblique */
  1519. X        ROMAN_FONT,            /* Bookman-Light */
  1520. X        ITALIC_FONT,            /* Bookman-LightItalic */
  1521. X        ROMAN_FONT,            /* Bookman-Demi */
  1522. X        ITALIC_FONT,            /* Bookman-DemiItalic */
  1523. X        TYPEWRITER_FONT,        /* Courier */
  1524. X        TYPEWRITER_FONT,        /* Courier-Oblique */
  1525. X        BOLD_FONT,            /* Courier-Bold */
  1526. X        BOLD_FONT,            /* Courier-BoldItalic */
  1527. X        MODERN_FONT,            /* Helvetica */
  1528. X        MODERN_FONT,            /* Helvetica-Oblique */
  1529. X        BOLD_FONT,            /* Helvetica-Bold */
  1530. X        BOLD_FONT,            /* Helvetica-BoldOblique */
  1531. X        MODERN_FONT,            /* Helvetica-Narrow */
  1532. X        MODERN_FONT,            /* Helvetica-Narrow-Oblique */
  1533. X        BOLD_FONT,            /* Helvetica-Narrow-Bold */
  1534. X        BOLD_FONT,        /* Helvetica-Narrow-BoldOblique */
  1535. X        ROMAN_FONT,            /* NewCenturySchlbk-Roman */
  1536. X        ITALIC_FONT,            /* NewCenturySchlbk-Italic */
  1537. X        BOLD_FONT,            /* NewCenturySchlbk-Bold */
  1538. X        BOLD_FONT,        /* NewCenturySchlbk-BoldItalic */
  1539. X        ROMAN_FONT,            /* Palatino-Roman */
  1540. X        ITALIC_FONT,            /* Palatino-Italic */
  1541. X        BOLD_FONT,            /* Palatino-Bold */
  1542. X        BOLD_FONT,            /* Palatino-BoldItalic */
  1543. X        ROMAN_FONT,            /* Symbol */
  1544. X        ROMAN_FONT,            /* ZapfChancery-MediumItalic */
  1545. X        ROMAN_FONT            /* ZapfDingbats */
  1546. X        };
  1547. X#define    NO    2
  1548. X#define    FALSE    0
  1549. X#define    TRUE    1
  1550. Xstatic int    PSmapwarn[] = {
  1551. X        FALSE, FALSE,            /* Times-Roman */
  1552. X        FALSE,                /* Times-Italic */
  1553. X        FALSE,                /* Times-Bold */
  1554. X        FALSE,                /* Times-BoldItalic */
  1555. X        TRUE,                /* AvantGarde */
  1556. X        TRUE,                /* AvantGarde-BookOblique */
  1557. X        TRUE,                /* AvantGarde-Demi */
  1558. X        TRUE,                /* AvantGarde-DemiOblique */
  1559. X        TRUE,                /* Bookman-Light */
  1560. X        TRUE,                /* Bookman-LightItalic */
  1561. X        TRUE,                /* Bookman-Demi */
  1562. X        TRUE,                /* Bookman-DemiItalic */
  1563. X        FALSE,                /* Courier */
  1564. X        TRUE,                /* Courier-Oblique */
  1565. X        TRUE,                /* Courier-Bold */
  1566. X        TRUE,                /* Courier-BoldItalic */
  1567. X        FALSE,                /* Helvetica */
  1568. X        TRUE,                /* Helvetica-Oblique */
  1569. X        TRUE,                /* Helvetica-Bold */
  1570. X        TRUE,                /* Helvetica-BoldOblique */
  1571. X        TRUE,                /* Helvetica-Narrow */
  1572. X        TRUE,                /* Helvetica-Narrow-Oblique */
  1573. X        TRUE,                /* Helvetica-Narrow-Bold */
  1574. X        TRUE,            /* Helvetica-Narrow-BoldOblique */
  1575. X        TRUE,                /* NewCenturySchlbk-Roman */
  1576. X        TRUE,                /* NewCenturySchlbk-Italic */
  1577. X        TRUE,                /* NewCenturySchlbk-Bold */
  1578. X        TRUE,            /* NewCenturySchlbk-BoldItalic */
  1579. X        TRUE,                /* Palatino-Roman */
  1580. X        TRUE,                /* Palatino-Italic */
  1581. X        TRUE,                /* Palatino-Bold */
  1582. X        TRUE,                /* Palatino-BoldItalic */
  1583. X        TRUE,                /* Symbol */
  1584. X        TRUE,                /* ZapfChancery-MediumItalic */
  1585. X        TRUE                /* ZapfDingbats */
  1586. X        };
  1587. Xint            PSisomap[] = {
  1588. X        FALSE, FALSE,            /* Times-Roman */
  1589. X        FALSE,                /* Times-Italic */
  1590. X        FALSE,                /* Times-Bold */
  1591. X        FALSE,                /* Times-BoldItalic */
  1592. X        FALSE,                /* AvantGarde */
  1593. X        FALSE,                /* AvantGarde-BookOblique */
  1594. X        FALSE,                /* AvantGarde-Demi */
  1595. X        FALSE,                /* AvantGarde-DemiOblique */
  1596. X        FALSE,                /* Bookman-Light */
  1597. X        FALSE,                /* Bookman-LightItalic */
  1598. X        FALSE,                /* Bookman-Demi */
  1599. X        FALSE,                /* Bookman-DemiItalic */
  1600. X        FALSE,                /* Courier */
  1601. X        FALSE,                /* Courier-Oblique */
  1602. X        FALSE,                /* Courier-Bold */
  1603. X        FALSE,                /* Courier-BoldItalic */
  1604. X        FALSE,                /* Helvetica */
  1605. X        FALSE,                /* Helvetica-Oblique */
  1606. X        FALSE,                /* Helvetica-Bold */
  1607. X        FALSE,                /* Helvetica-BoldOblique */
  1608. X        FALSE,                /* Helvetica-Narrow */
  1609. X        FALSE,                /* Helvetica-Narrow-Oblique */
  1610. X        FALSE,                /* Helvetica-Narrow-Bold */
  1611. X        FALSE,            /* Helvetica-Narrow-BoldOblique */
  1612. X        FALSE,                /* NewCenturySchlbk-Roman */
  1613. X        FALSE,                /* NewCenturySchlbk-Italic */
  1614. X        FALSE,                /* NewCenturySchlbk-Bold */
  1615. X        FALSE,            /* NewCenturySchlbk-BoldItalic */
  1616. X        FALSE,                /* Palatino-Roman */
  1617. X        FALSE,                /* Palatino-Italic */
  1618. X        FALSE,                /* Palatino-Bold */
  1619. X        FALSE,                /* Palatino-BoldItalic */
  1620. X        NO,                /* Symbol */
  1621. X        FALSE,                /* ZapfChancery-MediumItalic */
  1622. X        NO                /* ZapfDingbats */
  1623. X        };
  1624. Xstatic char *figfontnames[] = {
  1625. X        "Roman", "Roman",
  1626. X        "Roman", 
  1627. X        "Bold",
  1628. X        "Italic",
  1629. X        "Modern",
  1630. X        "Typewriter"
  1631. X        };
  1632. Xvoid unpsfont(t)
  1633. XF_text    *t;
  1634. X    if (!psfont_text(t)) return;
  1635. X    if (PSmapwarn[t->font+1])
  1636. X      fprintf(stderr, "PS fonts not supported; substituting %s for %s\n",
  1637. X        figfontnames[PSfontmap[t->font+1]+1], PSfontnames[t->font+1]);
  1638. X    t->font = PSfontmap[t->font+1];
  1639. END_OF_FILE
  1640. if test 6461 -ne `wc -c <'fig2dev/psfonts.c'`; then
  1641.     echo shar: \"'fig2dev/psfonts.c'\" unpacked with wrong size!
  1642. # end of 'fig2dev/psfonts.c'
  1643. if test -f 'transfig/mkfile.c' -a "${1}" != "-c" ; then 
  1644.   echo shar: Will not clobber existing file \"'transfig/mkfile.c'\"
  1645. echo shar: Extracting \"'transfig/mkfile.c'\" \(5471 characters\)
  1646. sed "s/^X//" >'transfig/mkfile.c' <<'END_OF_FILE'
  1647. X * TransFig: Facility for Translating Fig code
  1648. X * Copyright (c) 1985 Supoj Sutantavibul
  1649. X * Copyright (c) 1991 Micah Beck
  1650. X * Permission to use, copy, modify, distribute, and sell this software and its
  1651. X * documentation for any purpose is hereby granted without fee, provided that
  1652. X * the above copyright notice appear in all copies and that both that
  1653. X * copyright notice and this permission notice appear in supporting
  1654. X * documentation. The authors make no representations about the suitability 
  1655. X * of this software for any purpose.  It is provided "as is" without express 
  1656. X * or implied warranty.
  1657. X * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  1658. X * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  1659. X * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  1660. X * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  1661. X * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  1662. X * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  1663. X * PERFORMANCE OF THIS SOFTWARE.
  1664. X#include <stdio.h>
  1665. X#include "transfig.h"
  1666. X * create an appropriate makefile
  1667. Xmakefile(mk, altfonts, arg_list)
  1668. XFILE *mk;
  1669. Xint  altfonts;
  1670. Xargument *arg_list;
  1671. X  argument *a;
  1672. X  char *i;
  1673. X  enum language to;
  1674. X  int needps, needpic, needfig;
  1675. X  fprintf(mk, "#\n# TransFig makefile\n#\n");
  1676. X  fprintf(mk, "\nall: ");
  1677. X  for (a = arglist; a; a = a->next)
  1678. X        fprintf(mk, "%s.tex ", a->name);
  1679. X  fprintf(mk, "\n");
  1680. X  for (a = arglist; a; a = a->next)
  1681. X    i = a->name;
  1682. X    to = a->tolang;
  1683. X    needps = needpic = needfig = 0;
  1684. X    fprintf(mk, "\n# translation into %s\n\n", lname[(int)to]);
  1685. X    switch (to)
  1686. X    case box:
  1687. X        putfig(mk, box, altfonts, NULL, NULL, a->m, NULL, i, "tex");
  1688. X        needfig = 1;
  1689. X        break;
  1690. X    case eepicemu:
  1691. X    case epic:
  1692. X    case eepic:
  1693. X        putfig(mk, to, altfonts, a->f, a->s, a->m, a->o, i, "tex");
  1694. X        needfig = 1;
  1695. X        break;
  1696. X    case latex:
  1697. X        putfig(mk, latex, altfonts, a->f, a->s, a->m, a->o, i, "tex");
  1698. X        needfig = 1;
  1699. X        break;
  1700. X    case pictex:
  1701. X        putfig(mk, pictex, altfonts, a->f, a->s, a->m, a->o, i, "tex");
  1702. X        needfig = 1;
  1703. X        break;
  1704. X    case postscript:
  1705. X                puttarget(mk, i, "tex", "ps");
  1706. X                fprintf(mk, "\tfig2ps2tex %s.ps >%s.tex\n", i, i);
  1707. X        needps = 1;
  1708. X                break;
  1709. X        case psfig:
  1710. X                puttarget(mk, i, "tex", "ps");
  1711. X        fprintf(mk,"\techo '\\strut\\psfig{figure=%s.ps}' >%s.tex\n",
  1712. X                          i, i);
  1713. X        needps = 1;
  1714. X                break;
  1715. X    case pstex:
  1716. X        /*
  1717. X         * The makefile for the pstex need to update two files.
  1718. X         * file.ps with is created using fig2dev -L texps file.fig
  1719. X         * and
  1720. X         * file.tex with fig2dev -L pstex -p file.ps file.fig
  1721. X         * 
  1722. X         */
  1723. X        puttarget(mk, i, "tex", "ps");
  1724. X        fprintf(mk, "\tfig2dev -L pstex_t -p %s.ps ", i);
  1725. X        putoptions(mk, altfonts, a->f, a->s, a->m, a->o, i, "tex");
  1726. X        needps = 1;
  1727. X        break;
  1728. X    case textyl:
  1729. X        putfig(mk, textyl, altfonts, a->f, a->s, a->m, a->o, i, "tex");
  1730. X        needfig = 1;
  1731. X        break;
  1732. X    case tpic:
  1733. X        puttarget(mk, i, "tex", "pic");
  1734. X        /* fprintf(mk, "\ttpic %s.pic\n", i); */
  1735. X        fprintf(mk, "\tpic2tpic %s.pic | tpic > %s.tex\n", i, i);
  1736. X        fprintf(mk, "\techo \'\\strut\\box\\graph\' >>%s.tex\n", i);
  1737. X        needpic = 1;
  1738. X        break;
  1739. X    putclean(mk, i, "tex" );
  1740. X    /* conversion to postscript */
  1741. X    if (needps && a->type != ps) {
  1742. X        if ( a->tops ) {
  1743. X            puttarget(mk, i, "ps", iname[(int)a->type]);
  1744. X            fprintf(mk, "\t%s %s.%s > %s.ps\n", a->tops, i, iname[(int)a->type], i);
  1745. X        else {
  1746. X                    putfig(mk, (to == pstex ? pstex : postscript), 
  1747. X               altfonts, a->f, a->s, a->m, a->o, i, "ps");
  1748. X                    a->interm = mksuff(i, ".ps");
  1749. X            needfig = 1;
  1750. X        putclean(mk, i, "ps" );
  1751. X    /* conversion to pic */
  1752. X    if (needpic && a->type != pic) {
  1753. X        if ( a->topic ) {
  1754. X            puttarget(mk, i, "pic", iname[(int)a->type]);
  1755. X            fprintf(mk, "\t%s %s.%s > %s.pic\n", a->topic, i, iname[(int)a->type],i);
  1756. X        else {
  1757. X            putfig(mk, tpic, altfonts, a->f, a->s, a->m, a->o, i, "pic");
  1758. X            needfig = 1;
  1759. X        putclean(mk, i, "pic" );
  1760. X    /* conversion to fig */
  1761. X    if (needfig && a->type != fig) {
  1762. X        if ( a->tofig ) {
  1763. X            puttarget(mk, i, "fig", iname[(int)a->type]);
  1764. X            fprintf(mk, "\t%s %s.%s > %s.fig\n", a->tofig, i, iname[(int)a->type],i);
  1765. X            a->interm = mksuff(i, ".fig");
  1766. X        else {
  1767. X            fprintf(stderr, "transfig: warning: don't now how to make %s\n", mksuff(i, ".fig") );
  1768. X        putclean(mk, i, "fig" );
  1769. Xputtarget(mk, i, suf1, suf2)
  1770. XFILE *mk;
  1771. Xchar *i, *suf1, *suf2;
  1772. X    fprintf(mk, "%s.%s: %s.%s %s\n", i, suf1, i, suf2, mkfile);
  1773. Xputfig(mk, to, altfonts, f, s, m, o, i, suf)
  1774. XFILE *mk;
  1775. Xenum language to;
  1776. Xint altfonts;
  1777. Xchar *f, *s, *m, *o, *i, *suf;
  1778. X  fprintf(mk, "%s%s%s: %s.fig %s\n",
  1779. X           i, (suf ? "." : ""), (suf ? suf : ""), i, mkfile);
  1780. X  if ( to == tpic )
  1781. X      fprintf(mk, "\tfig2dev -L pic ");
  1782. X  else
  1783. X      fprintf(mk, "\tfig2dev -L %s ", lname[(int)to]);
  1784. X  putoptions(mk, altfonts, f, s, m, o, i, suf);
  1785. Xputoptions(mk, altfonts, f, s, m, o, i, suf)
  1786. XFILE *mk;
  1787. Xint altfonts;
  1788. Xchar *f, *s, *m, *o, *i, *suf;
  1789. X  if (altfonts==1) fprintf(mk, "-a ");
  1790. X  if (f && *f) fprintf(mk, "-f %s ", f);
  1791. X  if (s && *s) fprintf(mk, "-s %s ", s);
  1792. X  if (m && *m) fprintf(mk, "-m %s ", m);
  1793. X  if (o && *o) fprintf(mk, "%s ", o);
  1794. X  fprintf(mk, "%s.fig > %s%s%s\n", i, i, (suf ? "." : ""), (suf ? suf : ""));
  1795. Xputclean(mk, i, suf)
  1796. XFILE *mk;
  1797. Xchar *i, *suf;
  1798. X   fprintf(mk, "clean::\n");
  1799. X   fprintf(mk, "\trm -f %s.%s\n", i, suf);
  1800. X   fprintf(mk, "\n");
  1801. END_OF_FILE
  1802. if test 5471 -ne `wc -c <'transfig/mkfile.c'`; then
  1803.     echo shar: \"'transfig/mkfile.c'\" unpacked with wrong size!
  1804. # end of 'transfig/mkfile.c'
  1805. if test -f 'transfig/transfig.c' -a "${1}" != "-c" ; then 
  1806.   echo shar: Will not clobber existing file \"'transfig/transfig.c'\"
  1807. echo shar: Extracting \"'transfig/transfig.c'\" \(4940 characters\)
  1808. sed "s/^X//" >'transfig/transfig.c' <<'END_OF_FILE'
  1809. X * TransFig: Facility for Translating Fig code
  1810. X * Copyright (c) 1985 Supoj Sutantavibul
  1811. X * Copyright (c) 1991 Micah Beck
  1812. X * Permission to use, copy, modify, distribute, and sell this software and its
  1813. X * documentation for any purpose is hereby granted without fee, provided that
  1814. X * the above copyright notice appear in all copies and that both that
  1815. X * copyright notice and this permission notice appear in supporting
  1816. X * documentation. The authors make no representations about the suitability 
  1817. X * of this software for any purpose.  It is provided "as is" without express 
  1818. X * or implied warranty.
  1819. X * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  1820. X * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  1821. X * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  1822. X * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  1823. X * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  1824. X * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  1825. X * PERFORMANCE OF THIS SOFTWARE.
  1826. X * transfig:     figure translation setup program
  1827. X *        creates TeX macro file and makefile
  1828. X * usage: transfig <option> ... [[<flag> ... ] [<figure>] ... ] ...
  1829. X * where:    <option> = -L <language> | -M <makefile> | -T <texfile>
  1830. X *        <flag>     = -f <font> | -s <size> | -m <scale>
  1831. X#include <stdio.h>
  1832. X#include "patchlevel.h"
  1833. X#include "transfig.h"
  1834. Xargument *parse_arg(), *arglist = NULL, *lastarg = NULL;
  1835. Xchar *strip();
  1836. Xchar *mkfile = "Makefile";
  1837. Xchar *txfile = "transfig.tex";
  1838. Xchar *input = "";
  1839. Xint  altfonts = 0;
  1840. Xchar *lname[] = {
  1841. X    "box",
  1842. X    "epic",
  1843. X    "eepic",
  1844. X    "eepicemu",
  1845. X    "latex",
  1846. X    "pictex",
  1847. X    "ps",
  1848. X    "psfig",
  1849. X    "pstex",
  1850. X    "textyl",
  1851. X    "tpic"};
  1852. X/* enum input {apg, fig, pic, ps}; */
  1853. Xchar *iname[] = {
  1854. X    "apg",
  1855. X    "fig",
  1856. X      "pic",
  1857. X    "ps"};
  1858. Xmain(argc, argv)
  1859. Xint argc;
  1860. Xchar *argv[];
  1861. X  FILE *mk, *tx;
  1862. X  enum language tolang = epic;
  1863. X  argument *a;
  1864. X  char c, *cp; 
  1865. X  char *arg_f = NULL, *arg_s = NULL, *arg_m = NULL, *arg_o = NULL, *argbuf;
  1866. X  for ( optind = 1; optind < argc; optind++ ) {
  1867. X    cp = argv[optind];
  1868. X    if (*cp == '-')
  1869. X    {
  1870. X      if (!cp[1])
  1871. X        fprintf(stderr, "transfig: bad option format '-'\n");
  1872. X        exit(1);
  1873. X    if (cp[1] == 'V') 
  1874. X        fprintf(stderr, "TransFig Version %s Patchlevel %s\n",
  1875. X                            VERSION, PATCHLEVEL);
  1876. X        exit(0);
  1877. X    if (cp[2])
  1878. X        optarg = &cp[2];
  1879. X    } else
  1880. X        if (cp[1] != 'a') {
  1881. X            optind += 1;
  1882. X            if (optind == argc)
  1883. X            {
  1884. X                fprintf(stderr,
  1885. X                    "transfig: no value for '%c' arg\n", cp[1]);
  1886. X                exit(1);
  1887. X            }
  1888. X            optarg = argv[optind];
  1889. X     switch (cp[1]) {
  1890. X    case 'I':
  1891. X        input = optarg;
  1892. X        break;
  1893. X      case 'L':
  1894. X        tolang = str2lang(optarg);
  1895. X        break;
  1896. X      case 'M':
  1897. X        mkfile = optarg;
  1898. X        break;
  1899. X      case 'T':
  1900. X        txfile = optarg;
  1901. X        break;
  1902. X    case 'a':
  1903. X        altfonts = 1;
  1904. X        break;
  1905. X    case 'f':
  1906. X        arg_f = optarg;
  1907. X        break;
  1908. X    case 's':
  1909. X        arg_s = optarg;    
  1910. X        break;
  1911. X    case 'm':
  1912. X        arg_m = optarg;    
  1913. X        break;
  1914. X    case 'o':
  1915. X        arg_o = optarg;
  1916. X        break;
  1917. X      default:
  1918. X        fprintf(stderr, "transfig: illegal option -- '%c'\n", cp[1]);
  1919. X        exit(1);
  1920. X      }
  1921. X    } else
  1922. X    {
  1923. X    a = parse_arg(tolang, arg_f, arg_s, arg_m, arg_o, argv[optind]);
  1924. X    if ( !lastarg )
  1925. X        arglist = a;
  1926. X    else
  1927. X        lastarg->next = a; 
  1928. X    lastarg = a;
  1929. X    }
  1930. X  /* no files specified -> all files */
  1931. X  if (!arglist)
  1932. X    argbuf = sysls();
  1933. X    while (cp = strchr(argbuf, '\n'))
  1934. X        *cp = '\0';
  1935. X        a = parse_arg(tolang, arg_f, arg_s, arg_m, arg_o, argbuf);
  1936. X        if ( !lastarg )
  1937. X            arglist = a;
  1938. X        else
  1939. X            lastarg->next = a; 
  1940. X        lastarg = a;
  1941. X        argbuf = cp+1;
  1942. X  sysmv(txfile);
  1943. X  tx = fopen(txfile, "w");
  1944. X  texfile(tx, input, altfonts, arglist);
  1945. X  sysmv(mkfile);
  1946. X  mk = fopen(mkfile, "w");
  1947. X  makefile(mk, altfonts, arglist);
  1948. X  exit(0);
  1949. Xenum language str2lang(s)
  1950. Xchar *s;
  1951. X  int i;
  1952. X  /* aliases */
  1953. X  if (!strcmp(s, "pic")) return tpic;
  1954. X  if (!strcmp(s, "postscript")) return postscript;
  1955. X  if (!strcmp(s, "latexps")) return pstex;
  1956. X  if (!strcmp(s, "null")) return box;
  1957. X  /* real names*/
  1958. X  for (i = 0; i <= (int)MAXLANG; i++)
  1959. X    if (!strcmp(lname[i], s)) return (enum language)i;
  1960. X  /* other strings */
  1961. X  fprintf(stderr, "Unknown output language \"%s\"\n", s);
  1962. X  exit(1);
  1963. Xargument *parse_arg(tolang, arg_f, arg_s, arg_m, arg_o, arg)
  1964. Xenum language tolang;
  1965. Xchar *arg_f, *arg_s, *arg_m, *arg_o, *arg;
  1966. X  argument *a;
  1967. X  a = (argument *)malloc(sizeof(argument));
  1968. X  a->f = arg_f;
  1969. X  a->s = arg_s;
  1970. X  a->m = arg_m;
  1971. X  a->o = arg_o;
  1972. X  a->next = NULL;
  1973. X  a->tofig = NULL;
  1974. X  a->topic = NULL;
  1975. X  a->tops = NULL;
  1976. X  a->tolang = tolang;
  1977. X  /* PIC */
  1978. X  if (strip(arg, ".pic"))
  1979. X      a->name = mksuff(arg, "");
  1980. X      a->type = pic;
  1981. X    a->tofig = PIC2FIG;
  1982. X    return a;
  1983. X  /* PS format */
  1984. X  if (strip(arg, ".ps"))
  1985. X      a->name = mksuff(arg, "");
  1986. X      a->type = ps;
  1987. X     return a;
  1988. X  /* ApGraph format */
  1989. X  if (strip(arg, ".apg"))
  1990. X      a->name = mksuff(arg, "");
  1991. X      a->type = apg;
  1992. X    a->tofig = APG2FIG;
  1993. X     return a;
  1994. X  /* Fig format */
  1995. X  strip(arg, ".fig");
  1996. X  a->name = mksuff(arg, "");
  1997. X  a->type = fig;
  1998. X  return a;
  1999. END_OF_FILE
  2000. if test 4940 -ne `wc -c <'transfig/transfig.c'`; then
  2001.     echo shar: \"'transfig/transfig.c'\" unpacked with wrong size!
  2002. # end of 'transfig/transfig.c'
  2003. echo shar: End of archive 2 \(of 7\).
  2004. cp /dev/null ark2isdone
  2005. MISSING=""
  2006. for I in 1 2 3 4 5 6 7 ; do
  2007.     if test ! -f ark${I}isdone ; then
  2008.     MISSING="${MISSING} ${I}"
  2009.     fi
  2010. if test "${MISSING}" = "" ; then
  2011.     echo You have unpacked all 7 archives.
  2012.     rm -f ark[1-9]isdone
  2013.     echo You still need to unpack the following archives:
  2014.     echo "        " ${MISSING}
  2015. ##  End of shell archive.
  2016. exit 0
  2017.