v04i074: xpic -- pic previewer for X11, Part09/15
Dan Heller
argv at island.uu.net
Sat Jul 22 17:41:02 AEST 1989
Submitted-by: Mark Moraes <moraes at ai.toronto.edu>
Posting-number: Volume 4, Issue 74
Archive-name: xpic/part09
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of archive 9 (of 15)."
# Contents: xpic/Makefile xpic/doc/marcel.x xpic/main.c xpic/x2tpic.c
# Wrapped by moraes at neat.ai on Thu Jul 13 22:36:09 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'xpic/Makefile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'xpic/Makefile'\"
else
echo shar: Extracting \"'xpic/Makefile'\" \(13314 characters\)
sed "s/^X//" >'xpic/Makefile' <<'END_OF_FILE'
X# Makefile generated by imake - do not edit!
X# $XConsortium: imake.c,v 1.37 88/10/08 20:08:30 jim Exp $
X#
X# The cpp used on this machine replaces all newlines and multiple tabs and
X# spaces in a macro expansion with a single space. Imake tries to compensate
X# for this, but is not always successful.
X#
X
X###########################################################################
X# X Window System Makefile generated from template file Imake.tmpl
X# $XConsortium: Imake.tmpl,v 1.91 88/10/23 22:37:10 jim Exp $
X#
X# Do not change the body of the imake template file. Server-specific
X# parameters may be set in the appropriate .macros file; site-specific
X# parameters (but shared by all servers) may be set in site.def. If you
X# make any changes, you'll need to rebuild the makefiles using
X# "make World" (at best) or "make Makefile; make Makefiles" (at least) in
X# the top level directory.
X#
X# If your C preprocessor doesn't define any unique symbols, you'll need
X# to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing
X# "make Makefile", "make Makefiles", or "make World").
X#
X# If you absolutely can't get imake to work, you'll need to set the
X# variables at the top of each Makefile as well as the dependencies at the
X# bottom (makedepend will do this automatically).
X#
X
X###########################################################################
X# platform-specific configuration parameters - edit Sun.macros to change
X
X# platform: $XConsortium: Sun.macros,v 1.52 88/10/23 11:00:55 jim Exp $
X# operating system: SunOS 3.5
X
XBOOTSTRAPCFLAGS =
X AS = as
X CC = cc
X CPP = /lib/cpp
X LD = ld
X LINT = lint
X INSTALL = install
X TAGS = ctags
X RM = rm -f
X MV = mv
X LN = ln -s
X RANLIB = ranlib
XRANLIBINSTFLAGS = -t
X AR = ar clq
X LS = ls
X LINTOPTS = -axz
X LINTLIBFLAG = -C
X MAKE = make
XSTD_CPP_DEFINES =
X STD_DEFINES =
X
X###########################################################################
X# site-specific configuration parameters - edit site.def to change
X
X# site: $XConsortium: site.def,v 1.16 88/10/12 10:30:24 jim Exp $
X
X GCC = gcc -traditional
X CC = $(GCC)
X
XCC = gcc -traditional
X
X XWSRC = $(CONTRIBSRC)/widgets/Xhp/Xw
X
X XWLIB = $(USRLIBDIR)/libXw.a
X
X###########################################################################
X# definitions common to all Makefiles - do not edit
X
X SHELL = /bin/sh
X
X DESTDIR =
X USRLIBDIR = /local/lib/X11
X BINDIR = /local/bin/X11
X INCDIR = $(LIBDIR)/include
X INCROOT = $(DESTDIR)/usr/include
X ADMDIR = /scr/Xerrors
X LIBDIR = /local/share/X11
X LINTLIBDIR = $(LIBDIR)/lint
X FONTDIR = $(LIBDIR)/fonts
X XINITDIR = $(LIBDIR)/xinit
X XDMDIR = $(LIBDIR)/xdm
X UWMDIR = $(LIBDIR)/uwm
X AWMDIR = $(LIBDIR)/awm
X TWMDIR = $(LIBDIR)/twm
X MANPATH = /local/man
X MANSOURCEPATH = $(MANPATH)/man
X MANDIR = $(MANSOURCEPATH)x
X LIBMANDIR = $(MANSOURCEPATH)3
X XAPPLOADDIR = $(LIBDIR)/app-defaults
X
X INSTBINFLAGS = -m 0755
X INSTUIDFLAGS = -m 4755
X INSTLIBFLAGS = -m 0664
X INSTINCFLAGS = -m 0444
X INSTMANFLAGS = -m 0444
X INSTAPPFLAGS = -m 0444
X INSTKMEMFLAGS = -g kmem -m 2755
X FCFLAGS = -t
X CDEBUGFLAGS = -O
X
X PATHSEP = /
X DEPEND = $(DEPENDSRC)/makedepend
X IMAKE = $(IMAKESRC)/imake
X RGB = $(RGBSRC)/rgb
X FC = $(BDFTOSNFSRC)/bdftosnf
X MKFONTDIR = $(MKFONTDIRSRC)/mkfontdir
X MKDIRHIER = $(SCRIPTSSRC)/mkdirhier.sh
X
X CFLAGS = $(CDEBUGFLAGS) $(INCLUDES) $(STD_DEFINES) $(DEFINES)
X LINTFLAGS = $(LINTOPTS) $(INCLUDES) $(STD_DEFINES) $(DEFINES) -DLINT
X LDFLAGS = $(CDEBUGFLAGS) $(SYS_LIBRARIES) $(SYSAUX_LIBRARIES)
X TOP = /csri3/X.V11R3
X CLIENTSRC = $(TOP)/clients
X DEMOSRC = $(TOP)/demos
X LIBSRC = $(TOP)/lib
X FONTSRC = $(TOP)/fonts
X INCLUDESRC = $(TOP)/X11
X SERVERSRC = $(TOP)/server
X UTILSRC = $(TOP)/util
X SCRIPTSSRC = $(UTILSRC)/scripts
X EXAMPLESRC = $(TOP)/examples
X CONTRIBSRC = $(TOP)/contrib
X DOCSRC = $(TOP)/doc
X RGBSRC = $(TOP)/rgb
X DEPENDSRC = $(UTILSRC)/makedepend
X IMAKESRC = $(UTILSRC)/imake
X IRULESRC = $(UTILSRC)/imake.includes
X XLIBSRC = $(LIBSRC)/X
X XMUSRC = $(LIBSRC)/Xmu
X TOOLKITSRC = $(LIBSRC)/Xt
X AWIDGETSRC = $(LIBSRC)/Xaw
X OLDXLIBSRC = $(LIBSRC)/oldX
X BDFTOSNFSRC = $(FONTSRC)/bdftosnf
X MKFONTDIRSRC = $(FONTSRC)/mkfontdir
X EXTENSIONSRC = $(TOP)/extensions
X
X EXTENSIONLIB = $(USRLIBDIR)/lib/libXext.a
X XLIB = $(USRLIBDIR)/libX11.a
X XMULIB = $(USRLIBDIR)/libXmu.a
X OLDXLIB = $(USRLIBDIR)/liboldX.a
X XTOOLLIB = $(USRLIBDIR)/libXt.a
X XAWLIB = $(USRLIBDIR)/libXaw.a
X INCLUDES = -I$(INCDIR) -I$(INCROOT)
X
X LINTXLIB = $(XLIBSRC)/llib-lX11.ln
X LINTXMU = $(XMUSRC)/llib-lXmu.ln
X LINTXTOOL = $(TOOLKITSRC)/llib-lXt.ln
X LINTXAW = $(AWIDGETSRC)/llib-lXaw.ln
X MACROFILE = Sun.macros
X ICONFIGFILES = $(IRULESRC)/Imake.tmpl \
X $(IRULESRC)/$(MACROFILE) $(IRULESRC)/site.def
X IMAKE_DEFINES =
X IMAKE_CMD = $(NEWTOP)$(IMAKE) -TImake.tmpl -I$(NEWTOP)$(IRULESRC) \
X -s Makefile $(IMAKE_DEFINES)
X RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a \
X .emacs_* tags TAGS make.log MakeOut
X
X###########################################################################
X# rules: $XConsortium: Imake.rules,v 1.71 88/10/23 22:46:34 jim Exp $
X
X###########################################################################
X# start of Imakefile
X
XCC=gcc
X
X# For SunOS3.5, Sun3 with f68881 installed
X#INLINELIBM=/usr/lib/f68881.il
X
X# For SunOS4.0, Sun3 with f68881 installed
X#INLINELIBM=/usr/lib/f68881/libm.il
X
X# For a machine with a 68881 using gcc - ../fastmath is where we keep
X# our inline math library for gcc. Collect that by anonymous ftp from
X# ai.toronto.edu:pub/moraes/fastmath.tar.Z
XINLINELIBM=-I../fastmath
X
X# Where are the HP widgets - this is used with a -I option. If you have them
X# installed.
XXWSRC=$(CONTRIBSRC)/widgets/Xhp
XXWINC=-I$(XWSRC)
X
X# Note - You need the HP widgets (Xw) for the X11 Toolkit
X# These should be defined in an Imake.tmpl - except that the
X# normal Imake.tmpl insists on these being compiled in the
X# X directory tree.
X#XWLIB=$(XWSRC)/Xw/libXw.a
XXWLIB=$(USRLIBDIR)/libXw.a
X
X# The documents go in $(DOCDIR)/xpic - see the install target.
X# At CSRI, we use a logical link to the source, so we don't
X# install this. You must still keep this accurate, because
X# it's put into the man page. Change the install target appropriately.
XDOCDIR=/local/doc/X11
X# the directory in which xpic saves the current buffer
X# in case it dies on a signal
XDUMPDIR=/tmp
X
X# -DXPIC is used by the filename completion code.
X# -DMAGIC will include code that puts a '#! $(BINDIR)/xpic'
X# header on the saved xpic files, and make them executable, so
X# you can just execute the saved xpic file and it starts up
X# xpic.
X# -DFASTARCS means your X server can draw arcs fast. This is not
X# for the MIT R3 sample server running on anything less than a
X# MIPS-based workstation.
X# -DDEBUG turns on debugging output - do you really want that?!
X# -DDRAWBBOX is also for debugging - it draws the bounding box
X# of all gels.
X# -DGRAB should be defined if XtAddGrab and XtRemoveGrab can be
X# made to work in Minibuf.c and input.c - I can't seem to get them
X# to work.
X# -DTYPEOUT includes the typeout code - this is still not used by
X# xpic - not much point defining it.
XDEFINES = -DXPIC -DMAGIC -DTYPEOUT # -DDEBUG
X
X# Define USLEEP if your system lacks a usleep (eg) Ultrix.
XUSLEEP=usleep.o
X
X########################################################################
X# You should not have to modify the rest of this file
X
XCDEBUGFLAGS = -O
XINCLUDES = $(XWINC) -I$(TOP) -Ibitmaps $(INLINELIBM)
XXPICLIBDIR=$(LIBDIR)/xpic
X
X# Sigh - we use sin(), cos(), atan2() for arrow, and for ellipses
X# If inlining is chosen (see INLINELIBM), then the mathlib on won't be
X# used, saving a whopping 55K on Suns.
XMATHLIB=-lm
X
X# /usr/lib/debug/malloc.o is Sun's debugging malloc() - it
X# provides the malloc_debug() and malloc_verify() calls.
X# malloc.o is a first-fit malloc with debugging ASSERTs. Finds
X# heap corruption fast. Not defining this will use libc.
X#MALLOC = /usr/lib/debug/malloc.o
X#MALLOC = malloc.o
XMALLOC =
X
XOBJS1 = main.o windows.o xpic.o handlers.o input.o \
X event.o grid.o error.o spline.o arrow.o newfonts.o \
X util.o gels.o null.o obj_line.o obj_spline.o obj_text.o \
X obj_box.o obj_circ.o obj_ell.o obj_block.o obj_elem.o \
X updown.o text.o isqrt.o ask.o xtypeout.o Minibuf.o Window.o \
X arc.o box.o focus.o line.o $(USLEEP)
X
XSRCS1 = main.c windows.c xpic.c handlers.c input.c \
X event.c grid.c error.c spline.c arrow.c newfonts.c \
X util.c gels.c null.c obj_line.c obj_spline.c obj_text.c \
X obj_box.c obj_circ.c obj_ell.c obj_block.c obj_elem.c \
X updown.c text.c isqrt.c ask.c xtypeout.c Minibuf.c Window.c \
X arc.c box.c focus.c line.c
X
XOBJS2 = x2pic.o hash.o
XSRCS2 = x2pic.c hash.c
X
XOBJS3 = x2ps.o hash.o
XSRCS3 = x2ps.c hash.c
X
XOBJS4 = x2tpic.o xtp.o hash.o
XSRCS4 = x2tpic.c xtp.c hash.c
X
XPROGRAMS = xpic x2ps x2pic x2tpic
X
X.SUFFIXES: .manX .man
X
X.manX.man:
X sed -e 's?DOCDIR?$(DOCDIR)/xpic?g'\
X -e 's?XPICLIBDIR?$(XPICLIBDIR)?g' $*.manX > $*.man
X
X OBJS = $(OBJS1) $(OBJS2) $(OBJS3)
X SRCS = $(SRCS1) $(SRCS2) $(SRCS3)
X
Xall:: $(PROGRAMS)
X
Xxpic: $(OBJS1) $(MYXTSTUFF) $(MALLOC) $(XWLIB) $(XTOOLLIB) $(XLIB)
X $(RM) $@
X $(CC) -o $@ $(OBJS1) $(MYXTSTUFF) $(MALLOC) $(XWLIB) $(XTOOLLIB) $(XLIB) $(LDFLAGS) $(MATHLIB) $(SYSLAST_LIBRARIES)
X
Xinstall:: xpic
X $(INSTALL) -c $(INSTALLFLAGS) xpic $(BINDIR)
X
Xinstall.man:: xpic.man
X $(INSTALL) -c $(INSTMANFLAGS) xpic.man $(MANDIR)/xpic.x
X
Xrelink::
X $(RM) $(PROGRAMS)
X $(MAKE) $(MFLAGS) $(PROGRAMS)
X
Xdepend:: $(DEPEND)
X
Xdepend::
X $(DEPEND) -s "# DO NOT DELETE" -- $(CFLAGS) -- $(SRCS)
X
X$(DEPEND):
X @echo "making $@"; \
X cd $(DEPENDSRC); $(MAKE)
X
Xclean::
X $(RM) $(PROGRAMS)
X
XSRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4)
X
Xx2pic: $(OBJS2)
X $(RM) $@
X $(CC) -o $@ $(OBJS2) $(LDFLAGS) $(SYSLAST_LIBRARIES)
X
Xrelink::
X $(RM) x2pic
X $(MAKE) $(MFLAGS) x2pic
X
Xclean::
X $(RM) x2pic
X
Xinstall:: x2pic
X $(INSTALL) -c $(INSTALLFLAGS) x2pic $(BINDIR)
X
Xinstall.man:: x2pic.man
X $(INSTALL) -c $(INSTMANFLAGS) x2pic.man $(MANDIR)/x2pic.x
X
Xx2ps: $(OBJS3)
X $(RM) $@
X $(CC) -o $@ $(OBJS3) $(LDFLAGS) $(MATHLIB) $(SYSLAST_LIBRARIES)
X
Xrelink::
X $(RM) x2ps
X $(MAKE) $(MFLAGS) x2ps
X
Xclean::
X $(RM) x2ps
X
Xinstall:: x2ps
X $(INSTALL) -c $(INSTALLFLAGS) x2ps $(BINDIR)
X
Xinstall.man:: x2ps.man
X $(INSTALL) -c $(INSTMANFLAGS) x2ps.man $(MANDIR)/x2ps.x
X
Xx2tpic: $(OBJS4)
X $(RM) $@
X $(CC) -o $@ $(OBJS4) $(LDFLAGS) $(SYSLAST_LIBRARIES)
X
Xrelink::
X $(RM) x2tpic
X $(MAKE) $(MFLAGS) x2tpic
X
Xclean::
X $(RM) x2tpic
X
Xinstall:: x2tpic
X $(INSTALL) -c $(INSTALLFLAGS) x2tpic $(BINDIR)
X
Xinstall.man:: x2tpic.man
X $(INSTALL) -c $(INSTMANFLAGS) x2tpic.man $(MANDIR)/x2tpic.x
X
Xinstall:: x2tex.script
X $(INSTALL) -c $(INSTALLFLAGS) x2tex.script $(BINDIR)/x2tex
X
Xinstall.man:: x2tex.man
X $(INSTALL) -c $(INSTMANFLAGS) x2tex.man $(MANDIR)/x2tex.x
X
Xlint:
X (lint -abz $(SRCS1) -lXw -lXt -lX11 -lm $(LINTFLAGS); \
X lint -abz $(SRCS2) $(LINTFLAGS); \
X lint -abz $(SRCS3) -lm $(LINTFLAGS); \
X lint -abz $(SRCS4) $(LINTFLAGS)) | \
X ./xlint
X
Xclean::
X $(RM) tune.h.new xpic.man x2ps.man x2pic.man x2tpic.man x2tex.man
X
Xid: tags
X mkid *.[ch]
X
Xinstall::
X -mkdir $(XPICLIBDIR)
X $(INSTALL) -c $(INSTAPPFLAGS) x2ps.pro $(XPICLIBDIR)
X $(INSTALL) -c $(INSTAPPFLAGS) x2ps.tra $(XPICLIBDIR)
X -mkdir $(XPICLIBDIR)/fontdesc
X $(INSTALL) -c $(INSTAPPFLAGS) fontdesc/xpic $(XPICLIBDIR)/fontdesc
X $(INSTALL) -c $(INSTAPPFLAGS) fontdesc/x2pic $(XPICLIBDIR)/fontdesc
X $(INSTALL) -c $(INSTAPPFLAGS) fontdesc/x2tpic $(XPICLIBDIR)/fontdesc
X $(INSTALL) -c $(INSTAPPFLAGS) fontdesc/x2ps $(XPICLIBDIR)/fontdesc
X
Xinstall::
X -rm -r $(DOCDIR)/xpic
X -cp -r doc $(DOCDIR)/xpic
X
Xtar:
X cd ..; tar cvfX - xpic/ExcludeFiles xpic | compress > xpic.tar.Z
X
Xtune.h: Makefile
X echo \#define LIBDIR \"$(XPICLIBDIR)\" > tune.h.new
X echo \#define PROGRAMNAME \"$(BINDIR)/xpic\" >> tune.h.new
X echo \#define DUMPDIR \"$(DUMPDIR)\" >> tune.h.new
X -cmp -s tune.h.new tune.h || cp tune.h.new tune.h
X
X###########################################################################
X# Imake.tmpl common rules for all Makefiles - do not edit
X
Xemptyrule::
X
Xclean::
X $(RM_CMD) \#*
X
XMakefile:: $(IMAKE)
X
XMakefile:: Imakefile \
X $(IRULESRC)/Imake.tmpl \
X $(IRULESRC)/Imake.rules \
X $(IRULESRC)/site.def \
X $(IRULESRC)/$(MACROFILE)
X - at if [ -f Makefile ]; then \
X echo "$(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \
X $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
X else exit 0; fi
X $(IMAKE_CMD) -DTOPDIR=$(TOP)
X
X$(IMAKE):
X @echo "making $@"; \
X cd $(IMAKESRC); $(MAKE) BOOTSTRAPCFLAGS=$(BOOTSTRAPCFLAGS)
X
Xtags::
X $(TAGS) -w *.[ch]
X $(TAGS) -xw *.[ch] > TAGS
X
X###########################################################################
X# empty rules for directories that do not have SUBDIRS - do not edit
X
Xinstall::
X @echo "install done"
X
Xinstall.man::
X @echo "install.man done"
X
XMakefiles::
X
X###########################################################################
X# dependencies generated by makedepend
X
END_OF_FILE
if test 13314 -ne `wc -c <'xpic/Makefile'`; then
echo shar: \"'xpic/Makefile'\" unpacked with wrong size!
fi
# end of 'xpic/Makefile'
fi
if test -f 'xpic/doc/marcel.x' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'xpic/doc/marcel.x'\"
else
echo shar: Extracting \"'xpic/doc/marcel.x'\" \(13421 characters\)
sed "s/^X//" >'xpic/doc/marcel.x' <<'END_OF_FILE'
X56 67 1176 776 8
X1 438 496 672 544 672 20 1
X2
X 544 672 496 672
X1 439 496 472 512 648 20 1
X3
X 512 472 512 648 496 648
X1 440 372 392 372 408 20 1
X2
X 372 408 372 392
X6 441 447 434 481 447 0 0
X464 440 7 0 2
XdPC (h)
X1 442 528 320 544 320 20 1
X2
X 544 320 528 320
X6 443 435 379 452 390 2000 0
X452 384 4 0 1
XDrtx
X6 444 489 315 520 326 2000 0
X520 320 7 0 1
XPC(h)in
X6 445 487 379 520 390 2000 0
X520 384 6 0 1
XHW_gen
X6 446 353 411 392 422 0 0
X372 416 9 0 1
X(from EU)
X6 447 360 379 386 390 1000 0
X360 384 5 0 1
XIBASE
X6 448 696 167 720 178 1000 0
X696 172 6 0 1
XPC_sel
X6 449 594 191 664 202 2000 0
X664 196 17 0 1
X(from EU) PC(h)in
X6 450 595 175 660 186 2000 0
X660 180 16 0 1
X(from IFU) PCout
X6 451 867 298 877 311 0 0
X872 304 1 0 2
X+
X1 452 528 248 560 248 20 1
X2
X 528 248 560 248
X3 453 864 288 880 320 0 1
X1 454 688 200 840 232 20 1
X3
X 688 200 840 200 840 232
X1 455 408 144 1152 272 20 1
X3
X 408 272 408 144 1152 144
X6 456 465 242 519 255 0 0
X492 248 12 0 2
XPC Stack ptr
X6 457 830 258 858 271 0 0
X844 264 6 0 2
XPC (h)
X6 458 950 306 987 319 0 0
X968 312 7 0 2
XControl
X6 459 941 290 995 303 0 0
X968 296 11 0 2
XQueue Shift
X6 460 1044 354 1060 367 0 0
X1052 360 2 0 2
XQL
X6 461 1043 338 1061 351 0 0
X1052 344 2 0 2
XQH
X1 462 1040 352 1064 352 0 1
X2
X 1040 352 1064 352
X1 463 1104 352 1104 776 20 1
X2
X 1104 776 1104 352
X1 464 1064 352 1104 352 20 1
X2
X 1104 352 1064 352
X1 465 1016 376 1136 376 20 1
X2
X 1136 376 1016 376
X1 466 1120 280 1120 776 20 1
X2
X 1120 280 1120 776
X1 467 848 280 1120 280 20 1
X2
X 848 280 1120 280
X1 468 1016 352 1040 352 20 1
X2
X 1040 352 1016 352
X1 469 1016 344 1040 344 20 1
X2
X 1040 344 1016 344
X3 470 1040 336 1064 368 0 1
X6 471 378 358 454 378 0 0
X416 368 10 0 5
XController
X6 472 401 334 431 354 0 0
X416 344 3 0 5
XIFU
X6 473 103 297 128 311 2000 0
X128 304 3 0 3
XIRQ
X6 474 71 321 128 335 2000 0
X128 328 8 0 3
XIRQ_addr
X6 475 177 346 248 359 2000 0
X248 352 12 0 2
XTAG Mismatch
X6 476 176 362 248 375 2000 0
X248 368 14 0 2
XRead Exception
X6 477 173 378 248 391 2000 0
X248 384 15 0 2
XWrite Exception
X1 478 136 304 312 304 10 1
X2
X 312 304 136 304
X1 479 136 328 312 328 10 1
X2
X 312 328 136 328
X1 480 256 384 312 384 10 1
X2
X 312 384 256 384
X1 481 256 368 312 368 10 1
X2
X 312 368 256 368
X1 482 256 352 312 352 10 1
X2
X 312 352 256 352
X6 483 851 231 856 242 2000 0
X856 236 1 0 1
XF
X6 484 838 231 844 242 2000 0
X844 236 1 0 1
XT
X6 485 582 407 588 418 2000 0
X588 412 1 0 1
XT
X6 486 595 407 600 418 2000 0
X600 412 1 0 1
XF
X6 487 608 387 616 398 1000 0
X608 392 2 0 1
X18
X1 488 596 388 604 396 0 1
X2
X 596 396 604 388
X1 489 600 384 600 408 20 1
X2
X 600 384 600 408
X1 490 592 416 592 432 20 1
X2
X 592 416 592 432
X1 491 576 408 608 416 0 1
X5
X 584 416 600 416 608 408 576 408
X 584 416
X1 492 552 376 560 376 20 1
X2
X 560 376 552 376
X6 493 573 434 611 447 0 0
X592 440 7 0 2
XQA data
X1 494 544 200 680 440 20 1
X3
X 544 440 544 200 680 200
X6 495 497 331 520 342 2000 0
X520 336 6 0 1
Xlength
X1 496 368 296 376 320 0 1
X5
X 376 304 376 312 368 320 368 296
X 376 304
X1 497 356 312 368 312 20 1
X2
X 356 312 368 312
X1 498 356 304 368 304 20 1
X2
X 356 304 368 304
X1 499 440 308 456 308 20 1
X2
X 440 308 456 308
X1 500 376 308 392 308 20 1
X2
X 376 308 392 308
X1 501 352 168 684 272 20 1
X4
X 352 272 352 168 684 168 684 180
X1 502 384 184 680 272 20 1
X3
X 384 272 384 184 680 184
X1 503 424 232 836 272 20 1
X5
X 424 272 424 232 808 232 812 236
X 836 236
X6 504 320 347 340 358 1000 0
X320 352 3 0 1
XTAG
X6 505 320 363 340 374 1000 0
X320 368 5 0 1
Xreade
X6 506 320 379 342 390 1000 0
X320 384 6 0 1
Xwritee
X6 507 340 275 364 286 0 0
X352 280 6 0 1
XPC_sel
X6 508 372 275 396 286 0 0
X384 280 5 0 1
XPCout
X6 509 401 275 415 286 0 0
X408 280 2 0 1
XRD
X6 510 418 275 430 286 0 0
X424 280 3 0 1
Xabs
X6 511 395 307 437 318 0 0
X416 312 10 0 1
Xpre-decode
X6 512 405 299 428 310 0 0
X416 304 4 0 1
XuPLA
X6 513 439 275 458 286 0 0
X448 280 5 0 1
Xfetch
X6 514 475 275 486 286 0 0
X480 280 3 0 1
Xinc
X6 515 506 275 519 286 0 0
X512 280 3 0 1
Xdec
X6 516 495 291 520 302 2000 0
X520 296 6 0 1
Xh0_ovr
X6 517 499 299 520 310 2000 0
X520 304 6 0 1
Xoffset
X1 518 528 312 920 336 20 1
X4
X 528 336 904 336 904 312 920 312
X1 519 448 160 1136 272 20 1
X3
X 448 272 448 160 1136 160
X1 520 512 256 512 272 20 1
X2
X 512 272 512 256
X1 521 480 256 480 272 20 1
X2
X 480 272 480 256
X1 522 528 304 832 304 20 1
X2
X 528 304 832 304
X1 523 528 248 876 296 20 1
X5
X 528 296 792 296 792 248 876 248
X 876 256
X3 524 464 240 528 256 0 1
X3 525 312 272 528 392 0 1
X3 526 392 296 440 320 0 1
X1 527 560 348 1016 348 0 1
X2
X 1016 348 560 348
X1 528 944 352 944 384 0 1
X2
X 944 352 944 384
X1 529 560 352 1016 352 0 1
X2
X 560 352 1016 352
X3 530 560 344 1016 384 0 1
X1 531 560 368 1016 368 1 1
X2
X 560 368 1016 368
X1 532 1000 352 1000 384 0 1
X2
X 1000 352 1000 384
X1 533 680 176 688 224 0 1
X5
X 680 224 688 216 688 184 680 176
X 680 224
X1 534 688 352 688 384 0 1
X2
X 688 352 688 384
X3 535 560 240 736 280 0 1
X1 536 872 256 872 272 0 1
X2
X 872 256 872 272
X1 537 856 200 888 304 20 1
X5
X 880 304 888 304 888 200 856 200
X 856 232
X3 538 816 256 880 272 0 1
X1 539 848 272 864 296 20 1
X3
X 848 272 848 296 864 296
X1 540 848 240 848 256 20 1
X2
X 848 240 848 256
X1 541 832 232 864 240 0 1
X5
X 840 240 856 240 864 232 832 232
X 840 240
X1 542 840 312 864 312 20 1
X2
X 840 312 864 312
X1 543 832 296 840 328 0 1
X5
X 832 328 840 320 840 304 832 296
X 832 328
X1 544 824 320 832 320 20 1
X2
X 824 320 832 320
X6 545 805 313 820 327 2000 0
X820 320 3 0 3
X'1'
X3 546 920 288 1016 320 0 1
X1 547 880 352 880 384 0 1
X2
X 880 352 880 384
X1 548 816 352 816 384 0 1
X2
X 816 352 816 384
X1 549 752 352 752 384 0 1
X2
X 752 352 752 384
X6 550 874 259 879 270 0 0
X876 264 1 0 1
Xh
X1 551 648 216 680 240 20 1
X3
X 648 240 648 216 680 216
X1 552 1136 160 1136 776 20 1
X2
X 1136 160 1136 776
X1 553 1152 144 1152 776 20 1
X2
X 1152 144 1152 776
X1 554 728 196 736 204 0 1
X2
X 728 204 736 196
X1 555 652 400 660 408 0 1
X2
X 652 408 660 400
X6 556 664 399 672 410 1000 0
X664 404 2 0 1
X18
X6 557 728 183 736 194 1000 0
X728 188 2 0 1
X31
X6 558 796 219 808 230 2000 0
X808 224 3 0 1
Xabs
X6 559 604 249 692 263 0 0
X648 256 16 0 3
XPC pseudo-stack
X6 560 605 265 691 279 0 0
X648 272 17 0 3
X(circular buffer)
X6 561 961 353 984 367 0 0
X972 360 4 0 3
Xdata
X6 562 951 369 993 383 0 0
X972 376 8 0 3
Xaddr (h)
X6 563 647 353 666 367 0 0
X656 360 2 0 3
XQB
X6 564 711 353 730 367 0 0
X720 360 2 0 3
XQC
X6 565 774 353 794 367 0 0
X784 360 2 0 3
XQD
X6 566 839 353 858 367 0 0
X848 360 2 0 3
XQE
X6 567 903 353 921 367 0 0
X912 360 2 0 3
XQF
X6 568 638 434 674 447 0 0
X656 440 7 0 2
XQB data
X1 569 624 432 624 448 0 1
X2
X 624 432 624 448
X3 570 560 432 688 448 0 1
X1 571 624 352 624 384 0 1
X2
X 624 352 624 384
X1 572 656 384 656 432 20 1
X2
X 656 384 656 432
X6 573 582 353 603 367 0 0
X592 360 2 0 3
XQA
X1 574 552 376 552 416 20 1
X2
X 552 376 552 416
X6 575 490 355 520 366 2000 0
X520 360 5 0 1
XHW_op
X1 576 528 360 584 408 20 1
X5
X 528 360 536 360 536 392 584 392
X 584 408
X1 577 464 416 552 432 20 1
X3
X 552 416 464 416 464 432
X3 578 432 432 496 448 0 1
X1 579 464 448 512 472 20 1
X4
X 464 448 464 456 512 456 512 472
X3 580 472 496 480 536 0 1
X2 581 448 504 472 528 0 1
X5
X 472 504 456 504 448 516 456 528
X 472 528
X1 582 440 552 448 584 0 1
X5
X 448 552 440 560 440 576 448 584
X 448 552
X1 583 472 528 480 528 0 1
X2
X 472 528 480 528
X1 584 472 520 480 520 0 1
X2
X 472 520 480 520
X1 585 472 512 480 512 0 1
X2
X 472 512 480 512
X1 586 472 504 480 504 0 1
X2
X 472 504 480 504
X1 587 480 536 480 560 0 1
X2
X 480 536 480 560
X1 588 444 516 448 556 20 1
X3
X 448 516 444 516 444 556
X1 589 448 560 560 560 20 1
X2
X 560 560 448 560
X1 590 448 576 560 576 20 1
X2
X 560 576 448 576
X1 591 264 656 296 664 0 1
X5
X 264 656 296 656 288 664 272 664
X 264 656
X1 592 288 616 288 656 20 1
X2
X 288 616 288 656
X1 593 216 640 272 656 20 1
X4
X 216 640 216 648 272 648 272 656
X1 594 336 496 336 616 2 1
X2
X 336 616 336 496
X3 595 168 632 256 640 0 1
X3 596 200 496 384 616 0 1
X1 597 292 660 480 660 20 1
X2
X 480 660 292 660
X1 598 400 560 408 592 0 1
X5
X 408 560 408 592 400 584 400 568
X 408 560
X1 599 408 568 440 568 20 1
X2
X 440 568 408 568
X1 600 384 576 400 576 20 1
X2
X 400 576 384 576
X2 601 428 516 444 568 0 1
X4
X 444 516 436 516 436 568 428 568
X2 602 280 664 280 672 20 1
X2
X 280 664 280 672
X3 603 320 680 384 696 0 1
X3 604 120 688 296 720 0 1
X1 605 376 680 376 696 0 1
X2
X 376 680 376 696
X1 606 120 704 296 704 0 1
X2
X 120 704 296 704
X1 607 216 704 216 720 0 1
X2
X 216 704 216 720
X1 608 168 704 168 720 0 1
X2
X 168 704 168 720
X1 609 208 672 280 688 20 1
X3
X 280 672 208 672 208 688
X1 610 280 672 352 680 20 1
X3
X 280 672 352 672 352 680
X1 611 380 588 404 704 20 1
X4
X 380 696 380 704 404 704 404 588
X1 612 352 584 416 712 20 1
X5
X 352 696 352 712 416 712 416 584
X 408 584
X1 613 1032 664 1032 704 20 1
X2
X 1032 664 1032 704
X1 614 976 664 976 704 20 1
X2
X 976 664 976 704
X1 615 404 680 488 704 20 1
X3
X 404 704 488 704 488 680
X1 616 972 680 980 688 0 1
X2
X 972 688 980 680
X1 617 892 680 900 688 0 1
X2
X 892 688 900 680
X1 618 828 680 836 688 0 1
X2
X 828 688 836 680
X1 619 748 680 756 688 0 1
X2
X 748 688 756 680
X1 620 668 680 676 688 0 1
X2
X 668 688 676 680
X1 621 628 680 636 688 0 1
X2
X 628 688 636 680
X1 622 588 680 596 688 0 1
X2
X 588 688 596 680
X1 623 776 704 776 720 0 1
X2
X 776 704 776 720
X1 624 880 704 880 720 0 1
X2
X 880 704 880 720
X1 625 656 704 656 720 0 1
X2
X 656 704 656 720
X1 626 616 704 616 720 0 1
X2
X 616 704 616 720
X3 627 1016 704 1048 720 0 1
X3 628 960 704 992 720 0 1
X3 629 736 704 920 720 0 1
X3 630 576 704 696 720 0 1
X1 631 592 664 592 704 20 1
X2
X 592 664 592 704
X1 632 632 664 632 704 20 1
X2
X 632 664 632 704
X1 633 672 664 672 704 20 1
X2
X 672 664 672 704
X1 634 752 664 752 704 20 1
X2
X 752 664 752 704
X1 635 832 664 832 704 20 1
X2
X 832 664 832 704
X1 636 896 664 896 704 20 1
X2
X 896 664 896 704
X1 637 1028 680 1036 688 0 1
X2
X 1028 688 1036 680
X3 638 560 496 1056 664 0 1
X1 639 544 440 544 736 20 1
X2
X 544 736 544 440
X6 640 192 631 241 642 0 0
X216 636 13 0 1
XNOP, length 0
X6 641 312 651 329 662 1000 0
X312 656 6 0 1
Xstall!
X6 642 330 682 366 695 0 0
X348 688 8 0 2
Xnxt addr
X6 643 160 690 257 703 0 0
X208 696 20 0 2
XuWord Control Fields
X6 644 178 706 207 719 0 0
X192 712 7 0 2
Xstage 2
X6 645 130 706 159 719 0 0
X144 712 7 0 2
Xstage 3
X6 646 242 706 271 719 0 0
X256 712 7 0 2
Xstage 1
X6 647 583 706 610 719 0 0
X596 712 5 0 2
XBreg1
X6 648 620 706 653 719 0 0
X636 712 7 0 2
Xoffset1
X6 649 665 706 687 719 0 0
X676 712 5 0 2
Xctrl1
X6 650 743 706 770 719 0 0
X756 712 5 0 2
XBreg2
X6 651 816 706 849 719 0 0
X832 712 7 0 2
Xoffset2
X6 652 889 706 911 719 0 0
X900 712 5 0 2
Xctrl2
X6 653 968 706 984 719 0 0
X976 712 3 0 2
Xsop
X3 654 480 640 496 680 0 1
X6 655 1020 707 1045 718 0 0
X1032 712 7 0 1
Xcar/cdr
X6 656 483 654 493 667 0 0
X488 660 1 0 2
X=
X6 657 568 569 615 583 1000 0
X568 576 7 0 3
XExtraOp
X6 658 569 553 615 567 0 0
X592 560 6 0 3
XOpCode
X6 659 713 576 919 601 0 0
X816 588 20 0 7
XOperand Decode Logic
X6 660 790 535 843 562 0 0
X816 548 3 0 8
XODL
X6 661 600 678 606 691 1000 0
X600 684 1 0 2
X5
X6 662 640 678 646 691 1000 0
X640 684 1 0 2
X5
X6 663 760 678 766 691 1000 0
X760 684 1 0 2
X5
X6 664 840 678 852 691 1000 0
X840 684 2 0 2
X30
X6 665 984 678 990 691 1000 0
X984 684 1 0 2
X2
X6 666 1040 678 1046 691 1000 0
X1040 684 1 0 2
X1
X6 667 265 516 311 533 0 0
X288 524 4 0 4
XuROM
X6 668 242 553 303 567 0 0
X272 560 11 0 3
XInstruction
X6 669 235 577 309 591 0 0
X272 584 10 0 3
XDecode ROM
X6 670 346 553 375 567 0 0
X360 560 3 0 3
XODL
X6 671 342 577 378 591 0 0
X360 584 5 0 3
XuCode
X6 672 278 606 298 619 0 0
X288 612 4 0 2
Xdata
X6 673 524 742 564 755 0 0
X544 748 7 0 2
Xnext_PC
X6 674 354 602 367 615 0 0
X360 608 3 0 2
Xrtx
X6 675 463 379 480 390 2000 0
X480 384 6 0 1
Xstall!
X1 676 360 472 520 624 20 1
X4
X 360 616 360 624 520 624 520 472
X1 677 440 392 520 472 20 1
X4
X 520 472 520 400 440 400 440 392
X1 678 504 392 536 440 20 1
X4
X 504 392 504 408 536 408 536 440
X1 679 472 392 528 440 10 1
X4
X 472 392 472 424 528 424 528 440
X1 680 464 440 528 660 20 1
X4
X 464 660 464 632 528 632 528 440
X1 681 480 440 536 736 20 1
X4
X 536 440 536 728 480 728 480 736
X6 682 463 742 498 755 0 0
X480 748 7 0 2
Xlength0
X1 683 1032 720 1032 736 20 1
X2
X 1032 720 1032 736
X1 684 976 720 976 736 20 1
X2
X 976 720 976 736
X1 685 896 720 896 736 20 1
X2
X 896 720 896 736
X1 686 832 720 832 736 20 1
X2
X 832 720 832 736
X1 687 752 720 752 736 20 1
X2
X 752 720 752 736
X1 688 672 720 672 736 20 1
X2
X 672 720 672 736
X1 689 632 720 632 736 20 1
X2
X 632 720 632 736
X1 690 592 720 592 736 20 1
X2
X 592 720 592 736
X1 691 192 720 192 736 20 1
X2
X 192 720 192 736
X1 692 144 720 144 736 20 1
X2
X 144 720 144 736
X6 693 233 738 280 751 0 0
X256 744 9 0 2
X(decoded)
X1 694 256 720 256 736 20 1
X2
X 256 720 256 736
X1 695 592 448 592 496 20 1
X2
X 592 448 592 496
X1 696 656 448 656 496 20 1
X2
X 656 448 656 496
X1 697 56 440 424 440 2 1
X2
X 56 440 424 440
X1 698 696 440 1176 440 2 1
X2
X 696 440 1176 440
X1 699 304 712 344 712 2 1
X2
X 304 712 344 712
X1 700 424 712 528 712 2 1
X2
X 424 712 528 712
X1 701 552 712 568 712 2 1
X2
X 552 712 568 712
X1 702 704 712 728 712 2 1
X2
X 704 712 728 712
X1 703 928 712 952 712 2 1
X2
X 928 712 952 712
X1 704 1000 712 1008 712 2 1
X2
X 1000 712 1008 712
X1 705 1056 712 1176 712 2 1
X2
X 1056 712 1176 712
X1 706 832 400 864 400 20 1
X2
X 864 400 832 400
X1 707 832 416 864 416 20 1
X2
X 832 416 864 416
X6 708 872 394 893 407 1000 0
X872 400 5 0 2
Xshift
X6 709 811 410 824 423 2000 0
X824 416 4 0 2
Xfill
X6 710 96 67 319 94 1000 0
X96 80 15 0 8
XSLIME PROCESSOR
X1 711 96 96 320 96 0 1
X2
X 96 96 320 96
X6 712 77 180 116 205 0 0
X96 192 3 0 7
XIFU
X6 713 67 220 125 245 0 0
X96 232 7 0 7
X1 stage
X6 714 75 500 118 525 0 0
X96 512 3 0 7
XIDU
X6 715 67 540 125 565 0 0
X96 552 7 0 7
X1 stage
X3 716 64 176 128 208 0 1
X6 717 497 68 815 93 0 0
X656 80 35 0 7
XStage Interconnect Diagram (Part 1)
X1 718 56 712 112 712 2 1
X2
X 56 712 112 712
X3 719 64 496 128 528 0 1
END_OF_FILE
if test 13421 -ne `wc -c <'xpic/doc/marcel.x'`; then
echo shar: \"'xpic/doc/marcel.x'\" unpacked with wrong size!
fi
# end of 'xpic/doc/marcel.x'
fi
if test -f 'xpic/main.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'xpic/main.c'\"
else
echo shar: Extracting \"'xpic/main.c'\" \(12870 characters\)
sed "s/^X//" >'xpic/main.c' <<'END_OF_FILE'
X/* $Header: main.c,v 1.5 89/04/21 03:30:54 xwindows Exp $ */
X#include <signal.h>
X
X#include "xpic.h"
X#include "windows.h"
X#include "spline.h"
X#include "gels.h"
X#include "tune.h"
X#include "newfonts.h"
X#include "assert.h"
X
X#include <X11/Shell.h>
X#include <X11/Xutil.h>
X
X
X#include "xpic.icon"
X
X#ifndef lint
Xstatic char rcsid[] = "$Header: main.c,v 1.5 89/04/21 03:30:54 xwindows Exp $";
X#endif
X
X#define DUMPTEMPLATE "%s/xpic%d"
Xstatic char dumpfile[sizeof(DUMPDIR) + sizeof(DUMPTEMPLATE) + 17];
X
Xint screenResolution;
Xchar *lprinter;
Xchar *lprcommand;
X
Xmain(argc, argv)
Xint argc;
Xchar **argv;
X{
X extern char *getmyhomedir();
X int Dying(), X_Error(), X_IOError();
X Widget X_start();
X Widget toplevel;
X
X nullfile = "No file";
X argfile = NULL;
X inputWidget = 0;
X GelCounter = 0;
X homeDir = getmyhomedir();
X if ((flatVerts = InitSpline(&flatSize)) == NULL)
X error("Not enough memory for the rubber-band spline buffer");
X
X if ((flatVerts2 = InitSpline(&flatSize2)) == NULL)
X error("Not enough memory for the redraw spline buffer");
X
X toplevel = X_start(argc, argv);
X picDpy = XtDisplay(toplevel);
X
X XSetErrorHandler(X_Error);
X XSetIOErrorHandler(X_IOError);
X
X CreateWindows(toplevel);
X
X if (argfile == NULL) {
X if ((MainCell = NewCell("Main", nullfile)) == NULL) {
X error("Main: Can't create Main cell");
X /*NOTREACHED*/
X }
X } else {
X if ((MainCell = ReadCell(nullfile, argfile)) == NULL) {
X free(argfile);
X if ((MainCell = NewCell("Main", nullfile)) == NULL) {
X error("Main: Can't create Main cell");
X /*NOTREACHED*/
X }
X }
X }
X
X LastCell = CurrentCell = MainCell;
X
X (void) sprintf(dumpfile, DUMPTEMPLATE, DUMPDIR, getpid());
X /* We try to save the current cell in a temp. file before dying */
X if (signal(SIGHUP, SIG_IGN)==SIG_DFL)
X (void) signal(SIGHUP, Dying);
X if (signal(SIGINT, SIG_IGN)==SIG_DFL)
X (void) signal(SIGINT, Dying);
X if (signal(SIGQUIT, SIG_IGN)==SIG_DFL)
X (void) signal(SIGQUIT, Dying);
X /* If abort generates this signal instead of IOT, remove this handler */
X if (signal(SIGEMT, SIG_IGN)==SIG_DFL)
X (void) signal(SIGEMT, Dying);
X if (signal(SIGBUS, SIG_IGN)==SIG_DFL)
X (void) signal(SIGBUS, Dying);
X if (signal(SIGSEGV, SIG_IGN)==SIG_DFL)
X (void) signal(SIGSEGV, Dying);
X if (signal(SIGTERM, SIG_IGN)==SIG_DFL)
X (void) signal(SIGTERM, Dying);
X
X XtMainLoop();
X /*NOTREACHED*/
X}
X
X
X/* x MUST be a constant string */
X#define whine(x) (void) write(2, x, sizeof(x))
X
Xstatic int swansong = 0;
X
X/* We try to save the current cell in a temp. file before dying */
XDying(sig, code, scp)
Xint sig, code;
Xstruct sigcontext *scp;
X{
X char buf[BUFSIZ];
X
X if (swansong) /* we're here again. better quit fast */
X _exit(-1);
X swansong++;
X (void) sprintf(buf, "xpic received signal %d, code %d\n", sig, code);
X (void) write(2, buf, strlen(buf));
X if ((outFile = fopen(dumpfile, "w")) == NULL) {
X (void) sprintf(buf, "Can't open %s for dump\nDying.\n", dumpfile);
X } else {
X /*
X * Don't want it to try malloc! In a bad memory corruption error, (of
X * which I hope there aren't any!), the WriteGel can go into
X * never-never land, if the pointers in the gelList are corrupted.
X * Worth a try though...
X */
X setbuf(outFile, buf);
X WriteGel(CurrentCell->gelList);
X (void) fclose(outFile);
X (void) sprintf(buf, "Dumped the current cell to %s\nNow dying.\n",
X dumpfile);
X }
X (void) write(2, buf, strlen(buf));
X if (scp == NULL || sig == SIGSEGV || sig == SIGBUS || sig == SIGEMT
X || sig == SIGILL)
X abort();
X else
X exit(-1);
X /* NOTREACHED */
X}
X
X/* Hell just froze over. */
X/*ARGSUSED*/
XX_IOError (dpy)
XDisplay *dpy;
X{
X perror("X Windows IO Error");
X Dying(0, 0, (struct sigcontext *) NULL);
X /*NOTREACHED*/
X}
X
X
X/*
X * They say this isn't fatal - but if it happens, it's a serious
X * problem, so we die.
X */
Xint X_Error(dpy, event)
XDisplay *dpy;
XXErrorEvent *event;
X{
X char buffer[BUFSIZ];
X char mesg[BUFSIZ];
X char number[32];
X char *mtype = "XlibMessage";
X
X whine("Unthinkable - an xpic bug - Please note down the\n");
X whine("following message and tell the person responsible\n");
X whine("for xpic here\n");
X
X XGetErrorText(dpy, (int) event->error_code, buffer, BUFSIZ);
X XGetErrorDatabaseText(dpy, mtype, "XError", "X Error", mesg, BUFSIZ);
X (void) fprintf(stderr, "%s: %s\n ", mesg, buffer);
X XGetErrorDatabaseText(dpy, mtype, "MajorCode", "Request Major code %d",
X mesg, BUFSIZ);
X (void) fprintf(stderr, mesg, event->request_code);
X (void) sprintf(number, "%d", event->request_code);
X XGetErrorDatabaseText(dpy, "XRequest", number, "", buffer, BUFSIZ);
X (void) fprintf(stderr, " %s", buffer);
X fputs("\n ", stderr);
X XGetErrorDatabaseText(dpy, mtype, "MinorCode", "Request Minor code",
X mesg, BUFSIZ);
X (void) fprintf(stderr, mesg, event->minor_code);
X fputs("\n ", stderr);
X XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x",
X mesg, BUFSIZ);
X (void) fprintf(stderr, mesg, event->resourceid);
X fputs("\n ", stderr);
X XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d",
X mesg, BUFSIZ);
X (void) fprintf(stderr, mesg, event->serial);
X fputs("\n ", stderr);
X XGetErrorDatabaseText(dpy, mtype, "CurrentSerial", "Current Serial #%d",
X mesg, BUFSIZ);
X (void) fprintf(stderr, mesg, dpy->request);
X fputs("\n ", stderr);
X if (event->error_code == BadImplementation) return 0;
X exit(1);
X Dying(0, 0, (struct sigcontext *) NULL);
X /*NOTREACHED*/
X}
X
X
X/* Defaults */
Xstatic Boolean defaultFALSE = FALSE;
Xstatic Boolean defaultTRUE = TRUE;
Xstatic int defaultWidth = DEFAULTPAGEWIDTH;
Xstatic int defaultHeight = DEFAULTPAGEHEIGHT;
Xstatic int defaultSpacing = DEFAULTSPACING;
Xstatic char *iconGeometry;
Xstatic char *iconPixmap;
Xstatic int rotate;
X
X/* Application Resources - no particular widget */
Xstatic XtResource application_resources[] = {
X {"name", "Name", XtRString, sizeof(char *),
X (Cardinal)&progname, XtRString, "xpic"},
X#ifndef FIXED_TOOLKIT
X {"iconGeometry", "IconGeometry", XtRString, sizeof(char *),
X (Cardinal)&iconGeometry, XtRString, (caddr_t) NULL},
X {"iconPixmap", "IconPixmap", XtRString, sizeof(char *),
X (Cardinal)&iconPixmap, XtRString, (caddr_t) NULL},
X#endif
X {"pageWidth", "PageWidth", XtRInt, sizeof(int),
X (Cardinal)&pageWidth, XtRInt, (caddr_t) &defaultWidth},
X {"pageHeight", "PageHeight", XtRInt, sizeof(int),
X (Cardinal)&pageHeight, XtRInt, (caddr_t) &defaultHeight},
X {"gridSpacing", "GridSpacing", XtRInt, sizeof(int),
X (Cardinal)&gridSpacing, XtRInt, (caddr_t) &defaultSpacing},
X {"gridOn", "GridOn", XtRBoolean, sizeof(Boolean),
X (Cardinal)&gridOn, XtRBoolean, (caddr_t) &defaultTRUE},
X {"gridColor", "GridColor", XtRPixel, sizeof(Pixel),
X (Cardinal)&gridColor, XtRString, (caddr_t) "Black"},
X {"cursorColor", "CursorColor", XtRPixel, sizeof(Pixel),
X (Cardinal)&cursorColor, XtRString, (caddr_t) "Black"},
X {"highlight", "Highlight", XtRPixel, sizeof(Pixel),
X (Cardinal)&highlight, XtRString, (caddr_t) "Black"},
X {"rotate", "Rotate", XtRBoolean, sizeof(Boolean),
X (Cardinal)&rotate, XtRBoolean, (caddr_t) &defaultFALSE},
X {"backup", "Backup", XtRBoolean, sizeof(Boolean),
X (Cardinal)&backupOnWrite, XtRBoolean, (caddr_t) &defaultTRUE},
X {"printer", "Printer", XtRString, sizeof(char *),
X (Cardinal)&lprinter, XtRString, (caddr_t) "PostScript"},
X {"lprcommand", "LprCommand", XtRString, sizeof(char *),
X (Cardinal)&lprcommand, XtRString, "x2ps -w | lpr -P%s"},
X {"font", "Font", XtRFontStruct, sizeof(char *),
X (Cardinal)&defaultFont, XtRString, DEFAULT_FONT},
X};
X
X/*
X * Command line options table. The command line is parsed for these,
X * and it sets/overrides the appropriate values in the resource
X * database
X */
Xstatic XrmOptionDescRec optionDescList[] = {
X#ifndef FIXED_TOOLKIT
X{"-igeometry", "*iconGeometry", XrmoptionSepArg, (caddr_t) NULL},
X{"-ipixmap", "*iconPixmap", XrmoptionSepArg, (caddr_t) NULL},
X#endif
X{"-pw", "*pageWidth", XrmoptionSepArg, (caddr_t) NULL},
X{"-ph", "*pageHeight", XrmoptionSepArg, (caddr_t) NULL},
X{"-gs", "*gridSpacing", XrmoptionSepArg, (caddr_t) NULL},
X{"-gc", "*gridColor", XrmoptionSepArg, (caddr_t) NULL},
X{"-cr", "*cursorColor", XrmoptionSepArg, (caddr_t) NULL},
X{"-ms", "*cursorColor", XrmoptionSepArg, (caddr_t) NULL},
X{"-hl", "*highlight", XrmoptionSepArg, (caddr_t) NULL},
X{"-grid", "*gridOn", XrmoptionNoArg, (caddr_t) "off"},
X{"+grid", "*gridOn", XrmoptionNoArg, (caddr_t) "on"},
X{"-rotate", "*rotate", XrmoptionNoArg, (caddr_t) "on"},
X{"+rotate", "*rotate", XrmoptionNoArg, (caddr_t) "off"},
X{"-backup", "*backup", XrmoptionNoArg, (caddr_t) "off"},
X{"+backup", "*backup", XrmoptionNoArg, (caddr_t) "on"},
X{"-P", "*printer", XrmoptionStickyArg, (caddr_t) NULL},
X{"-font", ".font", XrmoptionSepArg, (caddr_t) NULL},
X{"-fn", ".font", XrmoptionSepArg, (caddr_t) NULL},
X};
X
X
XWidget X_start(argc, argv)
Xint argc;
Xchar **argv;
X{
X int i;
X Widget toplevel;
X char *lp;
X extern char *getenv();
X
X /*
X * We do some silly stuff to ensure the -P option overrides the
X * environment variable PRINTER which overrides the application resource
X * [pP]rinter which overrides the default "PostScript"
X */
X lp = getenv("PRINTER");
X
X toplevel = XtInitialize("xpic", "XPic",
X optionDescList, XtNumber(optionDescList), (Cardinal *) &argc, argv);
X
X if (lprinter != NULL)
X lp = lprinter;
X
X XtGetApplicationResources(toplevel, (caddr_t) 0, application_resources,
X XtNumber(application_resources), (ArgList) NULL, (Cardinal) 0 );
X
X if (lp != NULL)
X lprinter = lp;
X
X for (i = 1; i < argc; i++) {
X if (argv[i][0] != '-') {
X /* !! Yechh! We don't do multiple files yet - one day... */
X argfile = XtMalloc((unsigned) (strlen(argv[i]) + 1));
X (void) strcpy(argfile, argv[i]);
X }
X else
X usage(progname, argv[i]);
X }
X if (rotate) {
X int temp = pageHeight;
X pageHeight = pageWidth;
X pageWidth = temp;
X }
X
X screenResolution = 254 *
X HeightOfScreen(XtScreen(toplevel)) / HeightMMOfScreen(XtScreen(toplevel));
X screenResolution /= 10;
X#ifdef DEBUG
X printf("screen resolution = %d\n", screenResolution);
X#endif
X /*
X * !! Something for reverse video since the toolkit doesn't
X * seem to do much. Also check that the colors (foreground,
X * background, highlight, cursorColor, gridColor are correct
X */
X
X /* Something with icon geometry */
X if (iconGeometry != NULL) {
X int scr, junk1, junk2, bitmask;
X Arg args[2];
X
X for(scr = 0; /* yyuucchh */
X XtScreen(toplevel) != ScreenOfDisplay(XtDisplay(toplevel),scr);
X scr++);
X
X args[0].name = XtNiconX;
X args[1].name = XtNiconY;
X bitmask = XGeometry(XtDisplay(toplevel), scr, iconGeometry, "",
X 0, 0, 0, 0, 0, (int *) &args[0].value, (int *) &args[1].value,
X &junk1, &junk2);
X if (bitmask & (XValue | YValue)) /* No way to communicate Negative */
X XtSetValues( toplevel, args, 2);
X }
X
X if (iconPixmap != NULL) {
X int icon_width, icon_height, xhot, yhot;
X Pixmap icon_pixmap;
X Arg args[1];
X
X if (XReadBitmapFile(XtDisplay(toplevel),
X RootWindowOfScreen(XtScreen(toplevel)), iconPixmap,
X (unsigned *) &icon_width, (unsigned *) &icon_height,
X &icon_pixmap, &xhot, &yhot)
X == BitmapSuccess) {
X args[0].name = XtNiconPixmap;
X args[0].value = (XtArgVal) icon_pixmap;
X XtSetValues(toplevel, args, 1);
X } else
X (void) fprintf(stderr, "xpic: can't find pixmap %s\n", iconPixmap);
X } else {
X Arg args[1];
X Pixmap icon_pixmap = XCreateBitmapFromData(XtDisplay(toplevel),
X RootWindowOfScreen(XtScreen(toplevel)), xpic_bits,
X xpic_width, xpic_height);
X
X args[0].name = XtNiconPixmap;
X args[0].value = (XtArgVal) icon_pixmap;
X XtSetValues(toplevel, args, 1);
X }
X
X return(toplevel);
X}
X
X
Xusage(prog, err)
Xchar *prog;
Xchar *err;
X{
X if (err)
X (void) fprintf(stderr, "%s: Bad option: \"%s\"\n", prog, err);
X (void) fprintf(stderr, "\
XUsage:\n\
X%s [standard Toolkit options] [xpic options] ..... file ... \n\
X\n\
XThe list of xpic options is shown below - together with the corresponding\n\
Xresource name. The option overrides the resource if both are specified\n\
XThe defaults are also shown.\n\
X\n\
X-grid, gridOn \"off\" Turns grid off (On)\n\
X+grid, gridOn \"on\" Turns grid on (On)\n\
X-gs, gridSpacing Grid spacing in pixels (8)\n\
X-gc, gridColor Grid color (Black)\n\
X-ph, pageHeight PageHeight in 10*in. (110)\n\
X-pw, pageWidth PageWidth in 10*in. (85)\n\
X-rotate, rotate \"on\" swap page height and width\n\
X+rotate, rotate \"off\" normal page height and width\n\
X-backup, backup \"off\" No backup file on write(On)\n\
X+backup, backup \"on\" Make backup file on write(On)\n\
X-cr, cursorColor Sets cursor color (Black)\n\
X-ms, cursorColor Sets cursor color (Black)\n\
X-hl, highlight Sets highlight color (Black)\n\
X-fn, font default font (%s)\n\
X-font, font default font (%s)\n\
X-P name printer Sets printer name (PostScript)\n",
X prog, DEFAULT_FONT, DEFAULT_FONT);
X exit(1);
X}
END_OF_FILE
if test 12870 -ne `wc -c <'xpic/main.c'`; then
echo shar: \"'xpic/main.c'\" unpacked with wrong size!
fi
# end of 'xpic/main.c'
fi
if test -f 'xpic/x2tpic.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'xpic/x2tpic.c'\"
else
echo shar: Extracting \"'xpic/x2tpic.c'\" \(13300 characters\)
sed "s/^X//" >'xpic/x2tpic.c' <<'END_OF_FILE'
X/* $Header: x2tpic.c,v 1.2 89/04/21 03:32:15 xwindows Exp $ */
X#include <X11/Xos.h>
X#include <stdio.h>
X#include <ctype.h>
X#include "defs.h"
X#include "tune.h"
X#include "xtp.h"
X
X/*
X * This program reads in a file in xpic formats and outputs a file which, when
X * given as input to tpic, will produce a TeX format file with the xpic
X * picture. The difference from x2pic is that strings are written in the form
X * "{\twelverm datastring}" instead of "\fR\s12datastring\fP". Furthermore,
X * when a font is encountered, a string of the form "\font\eighteenrm cmr10
X * scaled1800" is written after the ".PE"; this will pass through tpic and
X * initialize the font when it gets to TeX.
X */
X
X/*
X * Define this is your pic does not reset the scale between consecutive
X * pictures, resulting in successive xpic pictures in a document
X * shrinking more and more - or apply pic.fix to your pic source, if
X * you have it - or complain to your pic vendor.
X */
X/* define BROKENPIC */
X
X/* To do:
X 2. Allow some sort of scaling and positioning arguments.
X */
X
X
X#define MAXFONTS 512
X#define FONTDESCFILE "x2tpic"
X
X#define STRNEQ(s1, s2, n) ((*s1)==(*s2) && strncmp(s1, s2, n) == 0)
X
Xextern char *malloc();
Xextern char *calloc();
X
X#define xtransform(x) ((double) ((x) - orgX))
X#define ytransform(y) ((double) (picHeight - (y)))
X
Xstatic int orgX, orgY, picWidth, picHeight, delX, delY;
X
Xstatic double width, height;
Xstatic double x, y;
Xstatic char *style_words[NSTYLES] = {
X "", "dotted", "dashed", "dashed 0.1 * scale", "dashed 0.15 * scale"
X};
Xstatic int style;
Xstatic int linewidth = 0;
X
Xstatic char *progname;
Xstatic char *halign_words[] = {
X "", "ljust", "rjust"
X};
Xstatic int halign;
Xstatic int valign;
X
Xstatic char *arrows[] = {
X "", "<-", "->", "<->"
X};
Xstatic int arrow_type;
Xstatic char *name;
Xstatic double picScale = 1.0;
X
Xstatic int nfonts = MAXFONTS;
Xstruct fontinfo *availfonts;
Xint navailfonts;
X
XFILE *outFile;
XFILE *inFile;
X
Xextern int optind;
Xextern char *optarg;
X
X
Xstatic void ChangeThickness(t)
X{
X if (linewidth != t) {
X linewidth = t;
X if (linewidth == 0)
X (void) fprintf(outFile, ".ps 10\n");
X else
X (void) fprintf(outFile, ".ps %d\n", linewidth * 20);
X }
X}
X
Xstatic void MakeBox(x1, y1, x2, y2, attr)
X{
X style = getlinestyle(attr);
X if ((style < 0) || (style >= NSTYLES)) {
X (void) fprintf(stderr, "Unknown style - %d\n", style);
X style = 0;
X }
X width = x2 - x1;
X height = y2 - y1;
X x = xtransform(((double) (x1 + x2)) / 2.0);
X y = ytransform(((double) (y1 + y2)) / 2.0);
X (void) fprintf(outFile, "box %s wid %g ht %g at %g, %g\n",
X style_words[style], width, height, x, y);
X}
X
X
X/* Ellipses and circles have no attributes in pic - not yet, anyway. */
X/*ARGSUSED*/
Xstatic void MakeEllipse(xc, yc, xr, yr, attr, x1, y1, x2, y2)
X{
X if (attr != 0) {
X (void) fputs("warning: ellipses have no attributes in pic\n", stderr);
X }
X width = 2.0 * xr;
X height = 2.0 * yr;
X x = xtransform((double) xc);
X y = ytransform((double) yc);
X (void) fprintf(outFile, "ellipse wid %g ht %g at %g, %g\n",
X width, height, x, y);
X}
X
X/*ARGSUSED*/
Xstatic void MakeCircle(xc, yc, r, attr, x1, y1, x2, y2)
X{
X if (attr != 0) {
X (void) fprintf(stderr, "warning: circles have no attributes in pic\n");
X }
X x = xtransform((double) xc);
X y = ytransform((double) yc);
X (void) fprintf(outFile, "circle radius %d at %g, %g\n",
X r, x, y);
X}
X
X
X/*
X * print out a string. For TeX, we don't escape anything.
X */
Xstatic void PrintText(s)
Xchar *s;
X{
X register char *cp = s;
X
X for(; *cp != 0; cp++) {
X if (isascii(*cp) && isprint(*cp)) {
X (void) fputc(*cp, outFile);
X } else {
X /* We don't want to print these! */
X (void) fprintf(stderr, "Ignoring weird character \\%o in \"%s\"",
X *cp & 0xff, s);
X }
X }
X}
X
X
X/*ARGSUSED*/
Xstatic void MakeText(s, len, font, size, attr, xc, yc, x1, y1, x2, y2)
Xchar *s;
Xchar *font;
X{
X if (size < 0) {
X (void) fprintf(stderr, "Incorrect font size %d\n", size);
X size = 10;
X }
X valign = gettext_valign(attr);
X if ((valign < 0) || (valign >= 3)) {
X (void) fprintf(stderr, "Incorrect vert alignment %d\n", valign);
X valign = 0;
X }
X halign = gettext_halign(attr);
X if ((halign < 0) || (halign >= 3)) {
X (void) fprintf(stderr, "Incorrect horiz. alignment %d\n", halign);
X halign = 0;
X }
X size = (int) (picScale * size);
X x = xtransform(xc);
X switch (valign) {
X case 0: /* MIDLINE */
X y = ytransform( yc );
X break;
X case 1: /* TOPLINE */
X y = ytransform( yc + ((double) (y2 - y1)) / 2.0 );
X break;
X case 2: /* BOTLINE */
X y = ytransform( yc - ((double) (y2 - y1)) / 2.0 );
X break;
X }
X /* FIX FOR TeX */
X (void) fprintf(outFile, "\"{%s ", ChangeFont( font, size) );
X PrintText(s);
X (void) fprintf(outFile, " }\" %s at %g, %g\n", halign_words[halign], x, y);
X}
X
X
X/*ARGSUSED*/
Xstatic void StartLine(xc, yc, n, attr, type)
X{
X arrow_type = getlinearrow(attr);
X if ((arrow_type < 0) || (arrow_type >= 4)) {
X (void) fprintf(stderr, "Unknown arrow type %d\n", arrow_type);
X arrow_type = 0;
X }
X style = getlinestyle(attr);
X if ((style < 0) || (style >= NSTYLES)) {
X (void) fprintf(stderr, "Unknown style - %d\n", style);
X style = 0;
X }
X x = xtransform(xc);
X y = ytransform(yc);
X name = "line";
X if (type != LINE) {
X name = "spline";
X if (style != 0) {
X (void) fprintf(stderr,
X "warning: splines have no attributes in pic\n");
X style = 0;
X }
X }
X (void) fprintf(outFile, "%s %s %s from %g, %g ",
X name, arrows[arrow_type], style_words[style], x, y);
X}
X
X
Xstatic void NextAt(xc, yc)
X{
X x = xtransform(xc);
X y = ytransform(yc);
X (void) fprintf(outFile, "\\\n\tto %g, %g ", x, y);
X}
X
X
Xstatic void EndLine()
X{
X (void) fprintf(outFile, "\n");
X}
X
X/*
X * Read in a file output by xpic, and emit the appropriate pic text
X */
Xstatic void convert()
X{
X int type;
X int xc, yc, xr, yr, len, attr;
X int size;
X int x1, y1, x2, y2;
X char *s;
X int c, i, n;
X int err, nf, gs;
X int num, thickness;
X char font[MAXSTR];
X
X
X#define INPERR 2
X#define INPEOF 3
X
X err = 0;
X#ifdef MAGIC
X /* Check for the magic header that the new xpic puts out */
X if ((c = fgetc(inFile)) == EOF) {
X (void) fprintf(stderr, "Incorrect input format");
X return;
X }
X (void) ungetc(c, inFile);
X if (c == '#') {
X /* Magic header - ignore */
X (void) fscanf(inFile, "%*[^\n]");
X }
X#endif MAGIC
X /* Read in (and ignore) the gel bounding box */
X (void) fscanf(inFile, " %d %d %d %d %d", &x1, &y1, &x2, &y2, &gs);
X /* Set up constants for scaling, translation etc. */
X orgX = x1;
X orgY = y1;
X delX = x2 - x1;
X delY = y2 - y1;
X picWidth = x2;
X picHeight = y2;
X (void) fprintf(outFile, ".PS\nscale = %lg\n",
X (double) (gs * 10 / picScale));
X /* Read in the actual picture */
X do {
X if ((nf = fscanf(inFile, " %d", &type)) != 1) {
X err = INPEOF;
X break;
X }
X nf = fscanf(inFile, " %d %d %d %d %d %x %d", &num, &x1, &y1,
X &x2, &y2, &attr, &thickness);
X if (nf != 7) {
X err = INPERR;
X break;
X }
X ChangeThickness(thickness);
X switch (type) {
X case BOX:
X MakeBox(x1, y1,x2, y2, attr);
X break;
X case ELLIPSE:
X nf = fscanf(inFile, " %d %d %d %d", &xc, &yc, &xr, &yr) ;
X if (nf != 4) {
X err = INPERR;
X break;
X }
X MakeEllipse(xc, yc, xr, yr, attr, x1, y1, x2, y2);
X break;
X case CIRCLE:
X nf = fscanf(inFile, " %d %d %d", &xc, &yc, &xr);
X if (nf != 3) {
X err = INPERR;
X break;
X }
X MakeCircle(xc, yc, xr, attr, x1, y1, x2, y2);
X break;
X case TEXT:
X nf = fscanf(inFile, " %d %d %d %s %d", &xc, &yc, &len, font,
X &size);
X if (nf != 5) {
X err = INPERR;
X break;
X }
X /*
X * For backward compatibility with the bad old days. The
X * old convention of storing font information was really
X * ugly - a font number from 0-3, (corresponding to Roman,
X * Bolld, Italic, Special) and a size from 0-9
X * (corresponding to point sizes 6 - 24)
X */
X if (font[1] == '\0') {
X int oldfontconvention = TRUE;
X
X switch (font[0]) {
X case '0':
X (void) strcpy(font, "Roman");
X break;
X case '1':
X (void) strcpy(font, "Bold");
X break;
X case '2':
X (void) strcpy(font, "Italic");
X break;
X case '3':
X (void) strcpy(font, "Special");
X break;
X default:
X /* Must a new font with a one letter name. Eeep! */
X oldfontconvention = FALSE;
X }
X if (oldfontconvention)
X /* Convert to pointsize */
X size = size * 2 + 6;
X }
X /* Go to the next line */
X while ((c = fgetc(inFile)) != '\n' && c != EOF)
X ;
X if (c == EOF) {
X err = INPERR;
X break;
X }
X if (( s = malloc((unsigned) (len + 2))) == NULL) {
X (void) fprintf(stderr, "No more memory for text string");
X break;
X }
X if (fgets(s, len + 1, inFile) == NULL) {
X free(s);
X err = INPERR;
X break;
X }
X s[len] = '\0';
X MakeText(s, len, font, size, attr, xc, yc, x1, y1, x2, y2);
X free(s);
X break;
X case LINE:
X case SPLINE:
X if (fscanf(inFile, " %d %d %d", &n, &xc, &yc) != 3) {
X err = INPERR;
X break;
X }
X StartLine(xc, yc, n, attr, type);
X for (i = 1; i < n; i++) {
X if (fscanf(inFile, " %d %d", &xc, &yc) != 2) {
X err = INPERR;
X break;
X }
X NextAt(xc, yc);
X }
X if (err != INPERR)
X EndLine();
X break;
X }
X } while (err == 0);
X (void) fprintf(outFile, ".PE\n");
X#ifdef BROKENPIC
X (void) fprintf(outFile, ".PS\nscale = 0\n.PE\n");
X#endif
X if (err == INPERR)
X (void) fprintf(stderr, "Incorrect input format");
X
X /* FIX FOR TeX */
X (void) fflush(outFile);
X rewind(outFile);
X PutTexFontPostScript(stdout);
X copystuff(outFile, stdout);
X rewind(outFile);
X
X return;
X
X#undef INPEOF
X#undef INPERR
X}
X
Xcopystuff(from, to)
XFILE *from;
XFILE *to;
X{
X char s[BUFSIZ];
X
X while(fgets(s, sizeof(s), from) != NULL)
X fputs(s, to);
X
X}
X
Xusage(s)
Xchar *s;
X{
X (void) fprintf(stderr, "Usage: %s [-s scale] [-f maxfonts] [filename]\n",
X s);
X exit(-1);
X}
X
Xchar *
Xgetword(cpp)
Xchar **cpp;
X{
X register char *cp = *cpp;
X char *s;
X
X while(*cp != '\0' && (*cp == ' ' || *cp == '\t' || *cp == '\n'))
X cp++;
X if (*cp == '\0')
X return(NULL);
X s = cp;
X while(*cp != '\0' && *cp != ' ' && *cp != '\t' && *cp != '\n')
X cp++;
X *cp++ = '\0';
X *cpp = cp;
X return(s);
X}
X
X
X/* Font tables are of the form
X xpic-font-name point-size tex-font-string real-tex-font how-to-scale
X (eg)
X Roman 12 twelverm cmr10 magstep1
X Helvetica 24 twfourhelv PS-Helvetica pointsize24
X */
X
Xstatic char *pointsize = "pointsize";
Xstatic char *curparse;
X
Xreadfonttable(file)
Xchar *file;
X{
X FILE *fp;
X int size, texsize;
X char *s1, *s2, *s3, *s4, *s5, *s;
X extern char *strsave();
X char buf[MAXSTR*4];
X char fbuf[MAXSTR];
X int nlines = 0;
X struct fontinfo *font = &availfonts[navailfonts];
X
X if ((fp = fopen(file, "r")) == NULL)
X return;
X while(fgets(buf, sizeof(buf), fp) != NULL) {
X nlines++;
X if ((curparse = index(buf, '#')) != NULL)
X *curparse = '\0';
X curparse = buf;
X if ((s1 = getword(&curparse)) == NULL)
X continue;
X if ((s2 = getword(&curparse)) == NULL || (size = atoi(s2)) <= 0)
X goto complain;
X if ((s3 = getword(&curparse)) == NULL || *s3 != '\\')
X goto complain;
X if ((s4 = getword(&curparse)) == NULL)
X goto complain;
X s5 = getword(&curparse);
X if (navailfonts == nfonts) {
X (void) fprintf(stderr, "Too many fonts - max %d. Use -f to raise it\n",
X nfonts);
X exit(-1);
X }
X if (s5 == NULL) {
X s = strsave(s4);
X } else if (STRNEQ(s5, pointsize, 9)) {
X s5 += 9;
X if ((texsize = atoi(s5)) == 0)
X goto complain;
X (void) sprintf(fbuf, "%s at %dpt", s4, texsize);
X s = strsave(fbuf);
X } else {
X (void) sprintf(fbuf, "%s scaled %s", s4, s5);
X s = strsave(fbuf);
X }
X#ifdef DEBUG
X (void) fprintf(stderr, "Adding mapping %s, %d, %s, %s\n", s1, size,
X s3, s);
X#endif
X font->style = strsave(s1);
X font->size = size;
X font->texname = strsave(s3);
X font->texfontinit = s;
X font->refcnt = 0;
X font++;
X navailfonts++;
X continue;
Xcomplain:
X (void) fprintf(stderr,
X "Bad syntax on line %d, file %s somewhere at \"%s\"\n",
X nlines, file, curparse);
X }
X (void) fclose(fp);
X}
X
X
Xmain(argc, argv)
Xint argc;
Xchar **argv;
X{
X double atof();
X int c;
X char fontfile[MAXSTR];
X char *hdir;
X char *getenv();
X char tempfilename[MAXSTR];
X
X progname = argv[0];
X inFile = stdin;
X (void) sprintf(tempfilename, "%s/x2tpic%d", DUMPDIR, getpid());
X if ((outFile = fopen(tempfilename, "w+")) == NULL) {
X (void) fprintf(stderr, "Can't open %s for update\n", tempfilename);
X exit(-1);
X }
X#ifndef DEBUG
X (void) unlink(tempfilename); /* So file goes away when the program dies */
X#endif
X while((c = getopt(argc, argv, "s:f:")) != EOF) {
X switch (c) {
X case 's':
X picScale = atof(optarg);
X break;
X case 'f':
X nfonts = atoi(optarg);
X break;
X case '?':
X usage(progname);
X break;
X }
X }
X
X HashInit(nfonts);
X availfonts = (struct fontinfo *) calloc((unsigned) nfonts,
X sizeof(struct fontinfo));
X if (availfonts == NULL) {
X (void) fprintf(stderr, "Can't allocate font table of %d elements.\n",
X nfonts);
X exit(-1);
X }
X navailfonts = 0;
X (void) sprintf(fontfile, "%s/fontdesc/%s", LIBDIR, FONTDESCFILE);
X readfonttable(fontfile);
X if (hdir = getenv("HOME")) {
X (void) sprintf(fontfile, "%s/.%s", hdir, FONTDESCFILE);
X readfonttable(fontfile);
X }
X /* Must have some files */
X if (optind >= argc) {
X convert();
X } else {
X while (optind < argc) {
X if ((inFile = fopen(argv[optind], "r")) == NULL) {
X (void) fprintf(stderr, "Can't open %s for reading\n",
X argv[optind]);
X break;
X }
X convert();
X optind++;
X }
X }
X exit(0);
X}
END_OF_FILE
if test 13300 -ne `wc -c <'xpic/x2tpic.c'`; then
echo shar: \"'xpic/x2tpic.c'\" unpacked with wrong size!
fi
# end of 'xpic/x2tpic.c'
fi
echo shar: End of archive 9 \(of 15\).
cp /dev/null ark9isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 15 archives.
rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0
More information about the Comp.sources.x
mailing list