home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume8 / cif2ps < prev    next >
Encoding:
Text File  |  1989-11-02  |  66.4 KB  |  2,794 lines

  1. Newsgroups: comp.sources.misc
  2. subject: v08i100: cif2ps: a CIF to PostScript translator
  3. from: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  4. Reply-To: gwr@gomez.mitre.org (Gordon W. Ross)
  5.  
  6. Posting-number: Volume 8, Issue 100
  7. Submitted-by: gwr@gomez.mitre.org (Gordon W. Ross)
  8. Archive-name: cif2ps
  9.  
  10. I've posted my version of "cif2ps" to comp.sources.misc this evening.
  11. Your site should be receiving it soon.  Please accept my apology for
  12. not posting it sooner.  I have been busy, and cif2ps is not a high
  13. priority.  On the brighter side though, I've added support for CIF
  14. objects other than boxes, as well as a limited plot depth option.
  15.  
  16. Here is the header from the posting to comp.sources.misc:
  17.  
  18. This package includes the source for "cif2ps," a program to create a
  19. PostScript representation of an integrated circuit from a layout
  20. stored in Caltech Intermediate Form (CIF).  A README, Makefile, and
  21. manual page are included as well as some sample CIF files.
  22.  
  23. This version was derived from a version distributed by Marc Lesure
  24. of Engineering Computer Services, Arizona State University.
  25. The original version (called "cifp") was written by Arthur Simoneau,
  26. of The Aerospace Corporation, El Segundo, California.
  27.  
  28. My additions to this program include:
  29. run time customization of plot styles for all CIF layers, limited
  30. plot depth option, technology-independent handling of CIF layers,
  31. PostScript functions for filling an object using a clipping path,
  32. automatic ordering of drawing operations for minimal obliteration,
  33. reduced output size, and support for CIF objects other than boxes.
  34.  
  35. A few test files are included.  Running "make test" will generate a
  36. layer-key for Scalable CMOS (SCMOS).  The file "everything.cif" has
  37. one object of each CIF type: a box, roundflash, polygon, and wire.
  38. The file "scmos-test.cif" is a sample layout from the old "cifp."
  39.  
  40. This version of "cif2ps" is distributed without any promise of
  41. support, though I would appreciate bug reports and changes.
  42.  
  43. Gordon W. Ross    gwr@gomez.mitre.org    (617) 271-3205 (daytime)
  44. The MITRE Corp. (M/S E025)  Burlington Road, Bedford, MA 01730
  45.  
  46. #! /bin/sh
  47. # This is a shell archive, meaning:
  48. # 1. Remove everything above the #! /bin/sh line.
  49. # 2. Save the resulting text in a file.
  50. # 3. Execute the file with /bin/sh (not csh) to create the files:
  51. #    README
  52. #    cif2ps.1
  53. #    Makefile
  54. #    psheader.ps
  55. #    define.h
  56. #    cif2ps.c
  57. #    cifgood.c
  58. #    cifplot.c
  59. #    layers.c
  60. #    styles.c
  61. #    layerkey.csh
  62. #    everything.cif
  63. #    scmos-test.cif
  64. # This archive created: Tue Oct 31 17:33:48 1989
  65. # By:    Gordon W. Ross (The MITRE Corporation, Bedford, MA.)
  66. export PATH; PATH=/bin:$PATH
  67. echo shar: extracting "'README'" '(4221 characters)'
  68. if test -f 'README'
  69. then
  70.     echo shar: will not over-write existing file "'README'"
  71. else
  72. sed 's/^X //' << \SHAR_EOF > 'README'
  73. X This package includes the source for "cif2ps," a program to create a
  74. X PostScript representation of an integrated circuit from a layout
  75. X stored in Caltech Intermediate Form (CIF).  A README, Makefile, and
  76. X manual page are included as well as some sample CIF files.
  77. X This version was derived from a version distributed by Marc Lesure
  78. X of Engineering Computer Services, Arizona State University.
  79. X The original version (called "cifp") was written by Arthur Simoneau,
  80. X of The Aerospace Corporation, El Segundo, California.
  81. X My additions to this program include:
  82. X run time customization of plot styles for all CIF layers, limited
  83. X plot depth option, technology-independent handling of CIF layers,
  84. X PostScript functions for filling an object using a clipping path,
  85. X automatic ordering of drawing operations for minimal obliteration,
  86. X reduced output size, and support for CIF objects other than boxes.
  87. X A few test files are included.  Running "make test" will generate a
  88. X layer-key for Scalable CMOS (SCMOS).  The file "everything.cif" has
  89. X one object of each CIF type: a box, roundflash, polygon, and wire.
  90. X The file "scmos-test.cif" is a sample layout from the old "cifp."
  91. X This version of "cif2ps" is distributed without any promise of
  92. X support, though I would appreciate bug reports and changes.
  93. X Gordon W. Ross    gwr@gomez.mitre.org    (617) 271-3205 (daytime)
  94. X The MITRE Corp. (M/S E025)  Burlington Road, Bedford, MA 01730
  95. X Included below are the contents of README files from older versions.
  96. X ------------------------------------------------------------------
  97. X [ README file from Marc Lesure's version of "cif2ps":  -GWR ]
  98. X This code was originally written by Arthur Simoneau, The Aerospace
  99. X Corporation, El Segundo, California. and was called 'cifp'.  'cifp' would
  100. X only take MAGIC SCMOS cif input and generate postscript for a single
  101. X page of output.
  102. X I've since taken it and modified it to accept cmos-pw technology for
  103. X our local needs at Arizona State University.  The biggest improvement
  104. X I made was to get multiple page output.  Each page is numbered with
  105. X (x,y) coordinates so you know its proper sequence.  Also each page
  106. X overlaps with its neighbor, so you can cut and paste if you want.
  107. X The program will rescale the user-specific scale to avoid producing
  108. X blank pages.  A scaling limit of 5 by 5 has been put in the program to
  109. X eliminate massive outputs.  Cif2ps can generate a postscript file in
  110. X the multi-megabyte range very easily.  I renamed the program to
  111. X 'cif2ps' to be more descriptive of its function.
  112. X Two test files have been included, cmos-pw.test.cif and scmos.test.cif.
  113. X The file cmos-pw.test.cif was generated using the IGS2CIF program
  114. X version 2a.04 on a HP EGS Graphics system.  The file scmos.test.cif is
  115. X from the original 'cifp' distribution.  To plot this file you must use
  116. X the '-T' option on 'cif2ps'.
  117. X [ The "-T" option is no longer needed or available.  -GWR ]
  118. X Cif2ps is now used here in place of cifplot from the Berkeley VSLI
  119. X distribution.
  120. X STANDARD DISCLAIMER:
  121. X -------------------
  122. X The authors and their organizations assume no responsibility for the
  123. X use by the recipient of this program.
  124. X Marc Lesure
  125. X Engineering Computer Services
  126. X Arizona State University
  127. X ---------------------------------------------------------------
  128. X [ README file from Arthur Simoneau's original "cifp":  -GWR ]
  129. X If somebody wants to modify this code you should be aware that the
  130. X order of the "filled boxes" are important.  The last filled box wins
  131. X all of the pixels and so improper order can cause the p-well to
  132. X obliterate all of the CIF geometries.
  133. X [ Filled objects are now handled in a more sophisticated manner. -GWR ]
  134. X I will be maintaining this code and adding missing features as they
  135. X become desirable, so instead of re-inventing the wheel you should
  136. X contact me before making any changes to see if I have already done
  137. X them.  Also, I would like to maintain knowledge of where this code is
  138. X so I would appreciate any new sites request the code from me rather
  139. X than siphoning it from another site.
  140. X I will gladly respond to any bug reports if a suitable example
  141. X displaying the bug is sent to me.
  142. X Cheers,
  143. X Arthur Simoneau
  144. X The Aerospace Corporation
  145. X El Segundo, California
  146. X art@aerospace
  147. X [ I was not able to reach art@aerospace  -GWR ]
  148. SHAR_EOF
  149. if test 4221 -ne "`wc -c < 'README'`"
  150. then
  151.     echo shar: error transmitting "'README'" '(should have been 4221 characters)'
  152. fi
  153. fi # end of overwriting check
  154. echo shar: extracting "'cif2ps.1'" '(5278 characters)'
  155. if test -f 'cif2ps.1'
  156. then
  157.     echo shar: will not over-write existing file "'cif2ps.1'"
  158. else
  159. sed 's/^X //' << \SHAR_EOF > 'cif2ps.1'
  160. X .TH CIF2PS LOCAL "23 June 1989"
  161. X .UC 4
  162. X .SH NAME
  163. X Cif2ps \- CIF to postscript translator
  164. X .SH SYNOPSIS
  165. X .na
  166. X .B cif2ps
  167. X .RB [ \-r ]
  168. X .RB [ \-c
  169. X .IR cell ]
  170. X .RB [ \-d
  171. X .IR depth ]
  172. X .RB [ \-f
  173. X .IR font-size ]
  174. X .RB [ \-w
  175. X .IR width ]
  176. X .RB [ \-h
  177. X .IR height ]
  178. X .RB [ \-s
  179. X .IR LAYER=style-string ]
  180. X .RI [ in-file.cif \ [ out-file.ps ]]
  181. X .ad
  182. X .br
  183. X .SH DESCRIPTION
  184. X .I Cif2ps
  185. X converts a CIF file produced by Magic or another VLSI layout editor
  186. X into PostScript.  The output file produced is complete and suitable
  187. X for printing on a letter-size PostScript printer.
  188. X The first file name (i.e.
  189. X .IR in-file.cif )
  190. X is the input file
  191. X The second file name (i.e.
  192. X .IR out-file.ps )
  193. X is the output file.
  194. X If no file names are given the program reads from standard input
  195. X and writes to standard output.
  196. X If just one file name is specified, it is used as input.
  197. X .PP
  198. X .I Cif2ps
  199. X options are :
  200. X .TP
  201. X .B \-r
  202. X rotate the plot by 90 degrees (cumulative if repeated).
  203. X .TP
  204. X .BI \-c \ cell
  205. X .I cell
  206. X (name or CIF number) should be plotted.
  207. X By default the top-level cell (number zero) is plotted.
  208. X CIF files generated by Magic have a "dummy" top-level cell
  209. X used only for specifying scale factors and the "real" top-level
  210. X cell (as seen in Magic) is number one.
  211. X .TP
  212. X .BI \-d \ depth
  213. X Cells instantiated
  214. X .I depth
  215. X levels or more below the top level should not be plotted.
  216. X The default is zero, meaning plot at all depths.
  217. X A depth of one restricts plotting to the top level.
  218. X .TP
  219. X .BI \-f \ font-size
  220. X Use a font (Helvetica) scaled to a height of
  221. X .I font-size
  222. X points.  The default is 6 points.
  223. X .TP
  224. X .BI \-w \ width
  225. X the plot should be made
  226. X .I width
  227. X pages wide.  By default the width is one page.
  228. X .TP
  229. X .BI \-h \ height
  230. X the plot should be made
  231. X .I height
  232. X pages wide.  By default the height is one page.
  233. X .PP
  234. X .I Cif2ps
  235. X will rescale a user-specific dimension if neccesary to avoid
  236. X producing blank pages.  The largest dimesion allowed is 5 pages by 5 pages
  237. X (25 pages of output).
  238. X .TP
  239. X .BI \-s \ LAYER=style-string
  240. X set the drawing style for the layer named
  241. X .I LAYER
  242. X to the string
  243. X .I style-string.
  244. X Any number of
  245. X .BI \-s \ LAYER=style-string
  246. X pairs of arguments may be given, each defining one CIF layer.
  247. X If
  248. X .I style-string
  249. X is omitted then
  250. X .I LAYER
  251. X is not plotted.
  252. X Built-in default styles are provided for some technologies
  253. X (MOSIS SCMOS and Bulk CMOS, Oct symbolic).
  254. X See
  255. X .B Style Customiztion
  256. X below for information on style strings.
  257. X .SH "Style Customization"
  258. X .PP
  259. X Style strings (used with the
  260. X .B \-s
  261. X option) are simply strings of PostScript commands (with one exception).
  262. X The commands are used to fill each figure generated by
  263. X .I cif2ps.
  264. X The exception is that styles using the printer's built-in
  265. X gray fill function need special handling because this
  266. X fill function uses an opaque fill method (obliterating any
  267. X drawings previously inside the filled area).
  268. X Style strings which use the printer's built-in gray fill do so
  269. X by prepending a special code "G" and a number to the otherwise
  270. X ordinary PostScript string.  The number following the "G"
  271. X is the gray-level to be used, with zero (0) being black and one
  272. X (1.0) being white.  Note that for this special code to be recognized
  273. X the "G" must be the first letter in the style string.
  274. X .PP
  275. X .I Cif2ps
  276. X will write all gray fill boxes in order of decreasing gray-level
  277. X before writing any of the regular PostScript fill styles.
  278. X This produces a plot with most layers being rendered
  279. X with transparent overlap regions.
  280. X .PP
  281. X The PostScript functions provided in addition to gray fill are:
  282. X .TP
  283. X "\fIs a\fR L"
  284. X Fill the region with lines spaced by \fIs\fR pixcels and rotated
  285. X (counter-clockwise) by angle \fIa\fR degrees from horizontal.
  286. X .TP
  287. X "X"
  288. X Draw an "X" across the figure.
  289. X .TP
  290. X "stroke"
  291. X A PostScript primitive which draws a line along the current path
  292. X and then clears the path.  Since the current path is cleared
  293. X by "stroke" it must be used \fIafter\fR any of the above commands.
  294. X .PP
  295. X Some examples:
  296. X .TP
  297. X ""
  298. X (null string) Don't draw anyting for this layer.
  299. X .TP
  300. X "G0"
  301. X Fill with black.
  302. X .TP
  303. X "G.5"
  304. X Fill with 50% gray.
  305. X .TP
  306. X "8 45 L"
  307. X Fill with lines spaced by 8 pixcels and rotated 45 degrees.
  308. X (The lines will have a slope of one.)
  309. X .TP
  310. X "G.75 32 135 L"
  311. X Fill with light gray (75%) and then fill with lines
  312. X spaced by 32 pixcels and rotated by 135 degrees (slope = -1).
  313. X .TP
  314. X "G.5 X stroke"
  315. X Fill with dark gray (50%), draw an "X" from the corners,
  316. X and draw an outline of the figure.
  317. X This produces a box with an diagonals similar to contacts in Magic.
  318. X .SH "SEE ALSO"
  319. X Magic
  320. X .SH AUTHORS
  321. X Arthur Simoneau (of The Aerospace Corporation, El Segundo, Calif)
  322. X wrote the original version, "cifp."
  323. X .br
  324. X Marc Lesure (of Arizona State University, Tempe, AZ)
  325. X modified 'cifp' to produce 'cif2ps',
  326. X adding scale factors and multi-page output.
  327. X .br
  328. X Gordon Ross (of The MITRE Corporation, Bedford, MA)
  329. X added: run-time style customization options,
  330. X transluscent fill operators using PostScript,
  331. X support for CIF polygons, circles, and wires,
  332. X and reduced output file size.
  333. X .SH BUGS
  334. X .PP
  335. X Text is plotted only in the top-most cell chosen for plotting.
  336. X .PP
  337. X The output can (still) become very large.
  338. X Full depth plotting can easily produce output ten times the size of
  339. X the CIF file.  A work-around is to limit the plot depth with the
  340. X .BI \-d \ depth
  341. X option.
  342. X .PP
  343. X Multi-page plots cause repetition of the entire PostScript output for
  344. X each page.  This could be reduced if cif2ps did some clipping.
  345. SHAR_EOF
  346. if test 5278 -ne "`wc -c < 'cif2ps.1'`"
  347. then
  348.     echo shar: error transmitting "'cif2ps.1'" '(should have been 5278 characters)'
  349. fi
  350. fi # end of overwriting check
  351. echo shar: extracting "'Makefile'" '(1045 characters)'
  352. if test -f 'Makefile'
  353. then
  354.     echo shar: will not over-write existing file "'Makefile'"
  355. else
  356. sed 's/^X //' << \SHAR_EOF > 'Makefile'
  357. X DEST    = /vlsi/mitre
  358. X CC    = cc -f68881
  359. X CFLAGS    = -O
  360. X LDFLAGS =
  361. X PROGRAM    = cif2ps
  362. X SRCS    = cif2ps.c cifgood.c cifplot.c layers.c styles.c
  363. X OBJS    = cif2ps.o cifgood.o cifplot.o layers.o styles.o psheader.o
  364. X FILES    = README cif2ps.1 Makefile psheader.ps define.h $(SRCS) \
  365. X     layerkey.csh everything.cif scmos-test.cif
  366. X all:        $(PROGRAM)
  367. X $(PROGRAM): $(OBJS)
  368. X     $(CC) $(LDFLAGS) -o $@ $(OBJS)
  369. X lint:    $(SRCS)
  370. X     lint $(SRCS)
  371. X test:    scmos-key.cif
  372. X     cif2ps scmos-key.cif
  373. X scmos-key.cif:
  374. X     layerkey.csh CPG CAA CMF CMS \
  375. X     CWG CWP CWN CSG CSP CSN CCP CCA CVA COG >$@
  376. X dist:    
  377. X     shar -v -c -b -p "X " $(FILES) >Dist.sha
  378. X .SUFFIXES: .ps
  379. X .ps.c:
  380. X     ( echo "/* This file was generated from $? */" ;\
  381. X       echo "char *$*[] = {" ;\
  382. X       sed 's/.*/"&",/' <$? ;\
  383. X       echo "0 }; /* end of $* */" ) >$@
  384. X .ps.o:
  385. X     $(MAKE) $(MFLAGS) $*.c
  386. X     $(CC) $(CFLAGS) -c $*.c
  387. X     rm -f $*.c
  388. X clean:
  389. X     rm -f $(OBJS) psheader.c
  390. X install:    $(PROGRAM)
  391. X     cp -p $(PROGRAM) $(DEST)/bin
  392. X     cp -p cif2ps.1 $(DEST)/man/man1
  393. X ###
  394. X cif2ps.o:    define.h
  395. X cifgood.o:    define.h
  396. X cifplot.o:    define.h
  397. X layers.o:    define.h
  398. X styles.o:    define.h
  399. SHAR_EOF
  400. if test 1045 -ne "`wc -c < 'Makefile'`"
  401. then
  402.     echo shar: error transmitting "'Makefile'" '(should have been 1045 characters)'
  403. fi
  404. fi # end of overwriting check
  405. echo shar: extracting "'psheader.ps'" '(1843 characters)'
  406. if test -f 'psheader.ps'
  407. then
  408.     echo shar: will not over-write existing file "'psheader.ps'"
  409. else
  410. sed 's/^X //' << \SHAR_EOF > 'psheader.ps'
  411. X % PostScript from \"cif2ps,\" a CIF to PostScript translator by:
  412. X %    Arthur Simoneau, The Aerospace Corporation, El Segundo, Calif
  413. X % with additions by:
  414. X %    Marc Lesure, Arizona State University, Tempe, AZ (May 1988)
  415. X % as well as:
  416. X %    Gordon W. Ross, The MITRE Corporation, Bedford, MA (June 1989)
  417. X %        (proud author of this header code :-)
  418. X % Header code follows:
  419. X /B {    % dx dy x1 y1 ==> ---
  420. X     % Build a box: size=(dx,dy); lower_left=(x1,y1)
  421. X     newpath moveto dup 0 exch    % dx dy 0 dy
  422. X     rlineto exch 0            % dy dx 0
  423. X     rlineto 0 exch neg        % 0 -dy
  424. X     rlineto closepath
  425. X } bind def % B
  426. X /L {    % step angle ==> ---
  427. X     % Fill the current path with lines spaced by STEP and
  428. X     % rotated from the X-axis by ANGLE degrees ccw.
  429. X     gsave clip 0 setgray 0 setlinewidth
  430. X     matrix setmatrix
  431. X     rotate dup scale        %
  432. X     pathbbox newpath        % x1 y1 x2 y2
  433. X     1 add cvi 4 1 roll        % y2' x1 y1 x2
  434. X     1 add cvi 4 1 roll        % x2' y2' x1 y1
  435. X     1 sub cvi exch 1 sub cvi    % x2' y2' y1' x1'
  436. X     2 copy exch translate
  437. X     3 1 roll sub            % x2' x1' dy
  438. X     3 1 roll sub exch        % dx dy
  439. X     { % repeat (dy) times        % dx
  440. X         0 0 moveto dup 0    % dx dx 0
  441. X         rlineto stroke        % dx
  442. X         0 1 translate        % dx
  443. X     } repeat pop
  444. X     grestore
  445. X } bind def % L
  446. X /WW 1 def    % default Wire Width (space from line)
  447. X /Wto {        % x1 y1 x2 y2 ==> x2 y2
  448. X %    Draws a path spaced WW from the line (x1,y1)-(x2,y2)
  449. X newpath
  450. X %    wire angle a=atan(dy/dx)
  451. X 4 2 roll 4 copy    exch        % x2 y2 x1 y1 x2 y2 y1 x1
  452. X 3 1 roll sub 3 1 roll sub    % x2 y2 x1 y1 dy dx
  453. X atan dup 4 1 roll        % x2 y2 a x1 y1 a
  454. X WW exch 90 add dup 180 add arc    % x2 y2 a
  455. X 3 copy pop 3 2 roll        % x2 y2 x2 y2 a
  456. X WW exch 90 sub dup 180 add arc    % x2 y2
  457. X closepath            % x2 y2  (leave for next Wto)
  458. X } bind def % Wto
  459. X /X {    % Draw an X on the current figure
  460. X     gsave clip
  461. X     pathbbox newpath    % x1 y1 x2 y2
  462. X     4 copy moveto lineto    % x1 y1 x2 y2
  463. X     3 1 roll exch        % x1 y2 x2 y1
  464. X     moveto lineto stroke    %
  465. X     grestore
  466. X } bind def % X
  467. X % End of header code
  468. SHAR_EOF
  469. if test 1843 -ne "`wc -c < 'psheader.ps'`"
  470. then
  471.     echo shar: error transmitting "'psheader.ps'" '(should have been 1843 characters)'
  472. fi
  473. fi # end of overwriting check
  474. echo shar: extracting "'define.h'" '(2178 characters)'
  475. if test -f 'define.h'
  476. then
  477.     echo shar: will not over-write existing file "'define.h'"
  478. else
  479. sed 's/^X //' << \SHAR_EOF > 'define.h'
  480. X /*
  481. X  *    Global defines.
  482. X  *    See "cif2ps.c" for authors' names and addresses.
  483. X  *    Please honor the authors by not removing their attributions.
  484. X  */
  485. X #include <stdio.h>
  486. X /* The following dimensions are all in points (1/72 in.) */
  487. X #define PAGEMARGIN    36
  488. X #define PAGEWIDTH    ( 8.5 * 72 - 2 * PAGEMARGIN)
  489. X #define PAGELENGTH    (11.0 * 72 - 2 * PAGEMARGIN)
  490. X #define DEFPOINTS    6    /* default points size of text */
  491. X #define BIGINT    0x7FFFFF
  492. X #define false 0
  493. X #define true 1
  494. X #define MAXTOKEN        64
  495. X #define MAXSYMBOLS    256
  496. X #define MAXLINE        1024
  497. X #define LNAMELEN    7
  498. X #define MAXLAYERS    32
  499. X #define MAXNINETY_FOUR    64
  500. X #define DSTYPE        1
  501. X #define BOXTYPE        2
  502. X #define CALLTYPE    3
  503. X #define NINETY_FOURTYPE    4
  504. X #define NGONTYPE    5
  505. X #define ROUNDTYPE    6
  506. X #define WIRETYPE    7
  507. X #define WHITE    ' '
  508. X #define COMMA    ','
  509. X typedef    struct    {
  510. X     int    x, y;
  511. X     }    pointpairtype;
  512. X typedef struct    {
  513. X     int    layer;
  514. X     int    llx,lly,urx,ury;
  515. X     }    boxtype;
  516. X typedef struct    {
  517. X     int    layer;
  518. X     int    numPoints;
  519. X     int    *ptrPoints;
  520. X     }    ngontype;
  521. X typedef struct    {
  522. X     int    layer;
  523. X     int    x,y,r;
  524. X     }    roundtype;
  525. X typedef struct    {
  526. X     int    layer;
  527. X     int    numPoints;
  528. X     int    *ptrPoints;
  529. X     int    width;
  530. X     }    wiretype;
  531. X typedef struct    {
  532. X     int    name, a, b;
  533. X     }    dstype;
  534. X typedef struct    {
  535. X     char    name[MAXNINETY_FOUR];
  536. X     int    x, y, layer;
  537. X     }    ninety_fourtype;
  538. X typedef struct    {
  539. X     int    symbol;
  540. X     float    matrix[3][3];
  541. X     }    calltype;
  542. X typedef    struct    symboldumb    {
  543. X     struct    symboldumb    *next;
  544. X     int    typer;
  545. X     union    {
  546. X         boxtype    *box;
  547. X         dstype    *ds;
  548. X         calltype    *call;
  549. X         ninety_fourtype    *ninety_four;
  550. X         ngontype    *ngon;
  551. X         roundtype    *round;
  552. X         wiretype    *wire;
  553. X         }    primitive;
  554. X     }    symboltype;
  555. X typedef    struct    {
  556. X     int    symbol, a, b;
  557. X     char    name[MAXTOKEN];
  558. X     symboltype    *pointer;
  559. X     pointpairtype    ll, ur;
  560. X     }    tabletype;
  561. X typedef    struct    {
  562. X         char    *name;
  563. X     char    *style;
  564. X     }    layertype;
  565. X symboltype    *allocsymbol();
  566. X tabletype    symbol_table[MAXSYMBOLS];
  567. X FILE    *ciffile;
  568. X int    no_lines;
  569. X layertype    layers[MAXLAYERS];
  570. X int    order[MAXLAYERS];
  571. X int    layer, numlayers;
  572. X int    last_symbol, current_symbol_index;
  573. X symboltype    *present_symbol;
  574. X char *cur_style;
  575. X float    scale, trans_x, trans_y, a_over_b;
  576. X float    matrix[3][3], top_matrix[3][3];
  577. X int    pagex,pagey;
  578. X int    length,width;
  579. X int    totpages;
  580. X int    font_points;    /* point-size of label font */
  581. X char *psheader[];
  582. X char *style_lookup();
  583. SHAR_EOF
  584. if test 2178 -ne "`wc -c < 'define.h'`"
  585. then
  586.     echo shar: error transmitting "'define.h'" '(should have been 2178 characters)'
  587. fi
  588. fi # end of overwriting check
  589. echo shar: extracting "'cif2ps.c'" '(15796 characters)'
  590. if test -f 'cif2ps.c'
  591. then
  592.     echo shar: will not over-write existing file "'cif2ps.c'"
  593. else
  594. sed 's/^X //' << \SHAR_EOF > 'cif2ps.c'
  595. X /*
  596. X     cif2ps is based on the program 'cifp' originally written by
  597. X     Arthur Simoneau, The Aerospace Corporation, El Segundo, Calif
  598. X     Modified by Marc Lesure, Arizona State University, Tempe, AZ
  599. X     Changes to 'cifp' include support of cmos-pw layers, scaling
  600. X     factors to spread output over several pages of 8.5 x 11 paper,
  601. X     printing multiple layers.
  602. X     Modified by Gordon W Ross, The MITRE Corporation, Bedford, MA
  603. X     Designed new PostScript routines to reduce output file size.
  604. X     Added automatic style selection and run-time customization.
  605. X     Added rotation option.  (June 1989)
  606. X     Please honor the authors by not removing their attributions.
  607. X */
  608. X #include <stdio.h>
  609. X extern char *sprintf(); /* missing from stdio.h on Sun! */
  610. X #include <ctype.h>
  611. X #include "define.h"
  612. X int    maxwidth = 5;
  613. X int    maxlength = 5;
  614. X int    depth_lim, depth_now;
  615. X main(argc, argv)
  616. X int    argc;
  617. X char    *argv[];
  618. X {
  619. X     char *s,*cifname,*plotname,*sym_name;
  620. X     /* Initialize */
  621. X     ciffile=stdin;
  622. X     cifname="(stdin)";
  623. X     sym_name=0;    /* default (see below) */
  624. X     depth_lim=0;
  625. X     length = width = 1;
  626. X     totpages = 0;
  627. X     font_points = DEFPOINTS;
  628. X     no_lines = 0;
  629. X     layer = 0;
  630. X     last_symbol = -1;
  631. X     identity_matrix(top_matrix); /* need for "-r" option */
  632. X     while (--argc && ++argv && **argv == '-') {
  633. X         s = argv[0] + 1;
  634. X         switch (*s) {
  635. X         case 'c':
  636. X             sym_name = *++argv;
  637. X             argc--;
  638. X             break;
  639. X         case 'd':
  640. X             depth_lim = atoi(*++argv);
  641. X             argc--;
  642. X             break;
  643. X         case 'f':
  644. X             font_points = atoi(*++argv);
  645. X             argc--;
  646. X             break;
  647. X         case 'h':
  648. X             length = atoi(*++argv);
  649. X             argc--;
  650. X             break;
  651. X         case 'w':
  652. X             width = atoi(*++argv);
  653. X             argc--;
  654. X             break;
  655. X         case 'r':    /* rotate by 90 degrees */
  656. X             {
  657. X                 float rotate[3][3];
  658. X                 identity_matrix(rotate);
  659. X                 rotate[0][0] = 0;
  660. X                 rotate[0][1] = -1;
  661. X                 rotate[1][0] = 1;
  662. X                 rotate[1][1] = 0;
  663. X                 hit_matrix(rotate,
  664. X                        top_matrix,
  665. X                        top_matrix);
  666. X             }
  667. X             break;
  668. X         case 's':
  669. X             set_style(*++argv);
  670. X             argc--;
  671. X             break;
  672. X         default:
  673. X             printf("cif2ps: unknown flag - %s\n",*s);
  674. X             exit(0);
  675. X         }
  676. X     }
  677. X     if (argc) {    /* input file name supplied? */
  678. X         cifname = *argv++; argc--;
  679. X         if (!freopen(cifname, "r", stdin)) {
  680. X         fprintf(stderr, "%s: can't read\n", cifname);
  681. X         exit(1);
  682. X         }
  683. X     }
  684. X     if (argc) {    /* output file name supplied? */
  685. X         plotname = *argv++; argc--;
  686. X         if (!freopen(plotname, "w", stdout)) {
  687. X         fprintf(stderr, "%s: can't write\n", plotname);
  688. X         exit(1);
  689. X         }
  690. X     }
  691. X     if (argc) {    /* extra args must be errors */
  692. X         fprintf(stderr,
  693. X     "Usage: cif2ps [-w width] [-h height] [input [output]]\n");
  694. X         exit(0);
  695. X     }
  696. X     if (width <= 0) {
  697. X         printf("-w exceeds lower limit - setting to 1\n");
  698. X         width = 1;
  699. X     }
  700. X     if (length <= 0) {
  701. X         printf("-l exceeds lower limit - setting to 1\n");
  702. X         length = 1;
  703. X     }
  704. X     if (width > maxwidth) {
  705. X         printf("-w exceeds upper limit - setting to %d\n",maxwidth);
  706. X         width = maxwidth;
  707. X     }
  708. X     if (length > maxlength) {
  709. X         printf("-l exceeds upper limit - setting to %d\n",maxlength);
  710. X         length = maxlength;
  711. X     }
  712. X     copy_matrix(top_matrix, matrix);
  713. X     ds("DS 0", DSTYPE); /* cell 0 is predefined. Yech! -GWR */
  714. X     nine("9 top_level");
  715. X     do_cif();    /* parse input */
  716. X     style_sort();    /* determine plot order for layers */
  717. X     plot_symbol(sym_name);
  718. X }    /*main*/
  719. X plot_symbol(sym_name)
  720. X char    *sym_name;
  721. X {
  722. X     pointpairtype    ll, ur;
  723. X     int    sym_index = 0;
  724. X     /* get the symbol number */
  725. X     if (sym_name) {
  726. X         if (isdigit(*sym_name)) {
  727. X             sym_index = get_index(atoi(sym_name));
  728. X         } else {
  729. X             sym_index = sym_lookup(sym_name);
  730. X         }
  731. X         if (sym_index < 0) {
  732. X             fprintf(stderr,
  733. X                 "%s: symbol not found\n",
  734. X                 sym_name);
  735. X             output_all_symbolnums(stderr);
  736. X             exit(1);
  737. X         }
  738. X     } else {
  739. X         /* use default choice of symbol */
  740. X         /* usually want "1" if it exists, else "0" */
  741. X         sym_index = get_index(1);
  742. X         if (sym_index < 0) sym_index = 0;
  743. X     }
  744. X     ll.x = BIGINT;
  745. X     ur.x = -BIGINT;
  746. X     ll.y = BIGINT;
  747. X     ur.y = -BIGINT;
  748. X     
  749. X     get_bounds(sym_index, &ll, &ur);
  750. X     if ((ll.x == BIGINT) || (ll.y == BIGINT)) {
  751. X         fprintf(stderr, "cell number %s is empty\n",
  752. X             sym_name);
  753. X         exit(1);
  754. X     }
  755. X     get_pair(ll.x, ll.y, &ll);
  756. X     get_pair(ur.x, ur.y, &ur);
  757. X     fix_bbox(&ll, &ur); /* transformed? */
  758. X     
  759. X     get_window(&ll, &ur);
  760. X     init_cif();
  761. X     putHeader();
  762. X     
  763. X     for(pagey=0; pagey < length; pagey++) {
  764. X         for(pagex=0; pagex < width; pagex++) {
  765. X             startPage();
  766. X             plot_boxes(symbol_table[sym_index].pointer);
  767. X             plot_textes(symbol_table[sym_index].pointer);
  768. X             finishPage();
  769. X         }
  770. X     }
  771. X     putTrailer();
  772. X }    /*plotcif*/
  773. X int
  774. X sym_lookup(sym_name)    /* return symbol table index */
  775. X char    *sym_name;
  776. X {
  777. X     int    i;
  778. X     for(i = 0; i <= last_symbol; i++) {
  779. X         if (symbol_table[i].name &&
  780. X             !strcmp(symbol_table[i].name, sym_name))
  781. X             return(i);
  782. X     }
  783. X     return(-1);
  784. X }
  785. X get_window(ll, ur)
  786. X pointpairtype    *ll, *ur;
  787. X {
  788. X     /* assigns global variables: scale, trans_x, trans_y */
  789. X     /* Note: scale maps from CIF coordinates to 72'nds of inches */
  790. X     float    scalex, scaley;
  791. X     float   deltax, deltay;
  792. X     int    newsize;
  793. X     trans_x = - ll->x;
  794. X     trans_y = - ll->y;
  795. X     deltax = ur->x - ll->x;
  796. X     scalex = width * PAGEWIDTH / deltax;
  797. X     deltay = ur->y - ll->y;
  798. X     scaley = length * PAGELENGTH / deltay;
  799. X     if (scalex < scaley) {
  800. X         scale = scalex;
  801. X         newsize = ((deltay * scale) / PAGELENGTH) + 1;
  802. X         if (newsize != length) {
  803. X             printf("output length changed from %d to %d\n",
  804. X                 length, newsize);
  805. X             length = newsize;
  806. X         }
  807. X     } else {
  808. X         scale = scaley; 
  809. X         newsize = ((deltax * scale) / PAGEWIDTH) + 1;
  810. X         if (newsize != width) {
  811. X             printf("output width changed from %d to %d\n",
  812. X                 newsize,length);
  813. X             width = newsize;
  814. X         }
  815. X     }
  816. X }    /*get_window*/
  817. X plot_boxes(symbol)
  818. X symboltype    *symbol;
  819. X {
  820. X     int i;
  821. X     /* first we plot all the opaque (gray fill) styles */
  822. X     for (i=0; i<numlayers; i++) {
  823. X         layer = order[i];
  824. X         if (style_gray(layers[layer].style)) {
  825. X             printf("%% %s\n", layers[layer].name);
  826. X             depth_now = 0;
  827. X             plot_boxes_sub(symbol);
  828. X         }
  829. X     }
  830. X     puts("0 setgray");
  831. X     /* plot the remaining styles (any order is fine) */
  832. X     for (i = 0; i < numlayers; i++) {
  833. X         layer = i;
  834. X         if (style_rest(layers[layer].style)) {
  835. X             printf("%% %s\n", layers[layer].name);
  836. X             depth_now = 0;
  837. X             plot_boxes_sub(symbol);
  838. X         }
  839. X     }
  840. X }    /*plot_boxes*/
  841. X plot_boxes_sub(symbol)
  842. X symboltype    *symbol;
  843. X {
  844. X float    temp_matrix[3][3];
  845. X     while(symbol != NULL)
  846. X         {
  847. X         switch(symbol->typer)
  848. X             {
  849. X         case BOXTYPE:
  850. X             plot_box(symbol->primitive.box);
  851. X             break;
  852. X         case NGONTYPE:
  853. X             plot_ngon(symbol->primitive.ngon);
  854. X             break;
  855. X         case ROUNDTYPE:
  856. X             plot_round(symbol->primitive.round);
  857. X             break;
  858. X         case WIRETYPE:
  859. X             plot_wire(symbol->primitive.wire);
  860. X             break;
  861. X         case CALLTYPE:
  862. X             /* if at depth_lim, skip calls */
  863. X             if (depth_lim &&
  864. X                 (depth_lim <= (depth_now + 1)))
  865. X                 break;
  866. X             depth_now++;
  867. X             copy_matrix(matrix, temp_matrix);
  868. X             hit_matrix(matrix,
  869. X                 symbol->primitive.call->matrix,
  870. X                 matrix);
  871. X             plot_boxes_sub(
  872. X         symbol_table[symbol->primitive.call->symbol].pointer);
  873. X             copy_matrix(temp_matrix, matrix);
  874. X             depth_now--;
  875. X             break;
  876. X         case DSTYPE:
  877. X         case NINETY_FOURTYPE:
  878. X             break;
  879. X         default:
  880. X             fprintf(stderr, "ERROR Not known %d in plot boxes\n",
  881. X                             symbol->typer);
  882. X             break;
  883. X             }
  884. X         symbol = symbol->next;
  885. X         }
  886. X     return;
  887. X }    /*plot_boxes_sub*/
  888. X plot_textes(symbol)
  889. X symboltype    *symbol;
  890. X {
  891. X ninety_fourtype        *ninety_four;
  892. X     puts("0 setgray");
  893. X     while(symbol != NULL)
  894. X         {
  895. X         switch(symbol->typer)
  896. X             {
  897. X         case CALLTYPE:    /* only plots text in top level */
  898. X         case DSTYPE:
  899. X         case BOXTYPE:
  900. X         case NGONTYPE:
  901. X         case ROUNDTYPE:
  902. X         case WIRETYPE:
  903. X             break;
  904. X         case NINETY_FOURTYPE:
  905. X             ninety_four = symbol->primitive.ninety_four;
  906. X             plot_text(ninety_four);
  907. X             break;
  908. X         default:
  909. X             fprintf(stderr, "ERROR unknown %d in plot_textes\n",
  910. X                             symbol->typer);
  911. X             break;
  912. X             }
  913. X         symbol = symbol->next;
  914. X         }
  915. X }    /*plot_textes*/
  916. X bound_point(ll,ur,x,y)
  917. X pointpairtype    *ll, *ur;
  918. X int x,y;
  919. X {
  920. X     if (ll->x > x) ll->x = x;
  921. X     if (ll->y > y) ll->y = y;
  922. X     if (ur->x < x) ur->x = x;
  923. X     if (ur->y < y) ur->y = y;
  924. X }
  925. X bound_box(ll,ur,box)
  926. X pointpairtype    *ll, *ur;
  927. X boxtype *box;
  928. X {
  929. X     bound_point(ll,ur,box->llx,box->lly);
  930. X     bound_point(ll,ur,box->urx,box->ury);
  931. X }
  932. X bound_ngon(ll,ur,ngon)
  933. X pointpairtype    *ll, *ur;
  934. X ngontype *ngon;
  935. X {
  936. X     int n = ngon->numPoints;
  937. X     int *a = ngon->ptrPoints;
  938. X     do {
  939. X         bound_point(ll,ur,a[0],a[1]);
  940. X         n--; a += 2;
  941. X     } while (n);
  942. X }
  943. X bound_round(ll,ur,round)
  944. X pointpairtype    *ll, *ur;
  945. X roundtype *round;
  946. X {
  947. X     bound_point(ll,ur,
  948. X             round->x - round->r,
  949. X             round->y - round->r);
  950. X     bound_point(ll,ur,
  951. X             round->x + round->r,
  952. X             round->y + round->r);
  953. X }
  954. X bound_wire(ll,ur,wire)
  955. X pointpairtype    *ll, *ur;
  956. X wiretype *wire;
  957. X {
  958. X     int n = wire->numPoints;
  959. X     int *a = wire->ptrPoints;
  960. X     do {
  961. X         bound_point(ll,ur,a[0],a[1]);
  962. X         n--; a += 2;
  963. X     } while (n);
  964. X     ll->x -= wire->width;
  965. X     ll->y -= wire->width;
  966. X     ur->x += wire->width;
  967. X     ur->y += wire->width;
  968. X }
  969. X get_bounds(sym, ll, ur)
  970. X int    sym;
  971. X pointpairtype    *ll, *ur;
  972. X {
  973. X int        local_sym;
  974. X symboltype    *symbol;
  975. X pointpairtype    local_ll, local_ur;
  976. X float    temp_matrix[3][3];
  977. X     symbol = symbol_table[sym].pointer;
  978. X     while(symbol != NULL)
  979. X         {
  980. X         switch(symbol->typer)
  981. X             {
  982. X         case DSTYPE:
  983. X         case NINETY_FOURTYPE:
  984. X             break;
  985. X         case BOXTYPE:
  986. X             bound_box(ll,ur,symbol->primitive.box);
  987. X             break;
  988. X         case NGONTYPE:
  989. X             bound_ngon(ll,ur,symbol->primitive.ngon);
  990. X             break;
  991. X         case ROUNDTYPE:
  992. X             bound_round(ll,ur,symbol->primitive.round);
  993. X             break;
  994. X         case WIRETYPE:
  995. X             bound_wire(ll,ur,symbol->primitive.wire);
  996. X             break;
  997. X         case CALLTYPE:
  998. X             local_sym = symbol->primitive.call->symbol;
  999. X             if (symbol_table[local_sym].ll.x == BIGINT)
  1000. X                 {
  1001. X                 get_bounds(local_sym,
  1002. X                     &(symbol_table[local_sym].ll),
  1003. X                     &(symbol_table[local_sym].ur));
  1004. X                 }
  1005. X             copy_matrix(matrix, temp_matrix);
  1006. X             copy_matrix(symbol->primitive.call->matrix, matrix);
  1007. X             get_pair(symbol_table[local_sym].ll.x,
  1008. X                 symbol_table[local_sym].ll.y, &local_ll);
  1009. X             get_pair(symbol_table[local_sym].ur.x,
  1010. X                 symbol_table[local_sym].ur.y, &local_ur);
  1011. X             copy_matrix(temp_matrix, matrix);
  1012. X             /* local_ll and local_ur may be transformed
  1013. X              * such that left>right or lower>upper ...
  1014. X              */
  1015. X             fix_bbox(&local_ll, &local_ur);
  1016. X             if (ll->x > local_ll.x)
  1017. X                 ll->x = local_ll.x;
  1018. X             if (ll->y > local_ll.y)
  1019. X                 ll->y = local_ll.y;
  1020. X             if (ur->x < local_ur.x)
  1021. X                 ur->x = local_ur.x;
  1022. X             if (ur->y < local_ur.y)
  1023. X                 ur->y = local_ur.y;
  1024. X             break;
  1025. X         default:
  1026. X             fprintf(stderr, "ERROR Not known %d in get_bounds\n",
  1027. X                             symbol->typer);
  1028. X             break;
  1029. X             }
  1030. X         symbol = symbol->next;
  1031. X         }
  1032. X }    /*get_bounds*/
  1033. X get_pair(x, y, pair)
  1034. X int    x, y;
  1035. X pointpairtype    *pair;
  1036. X {
  1037. X     pair->x = (x * matrix[0][0]) + (y * matrix[0][1]) + matrix[0][2];
  1038. X     pair->y = (x * matrix[1][0]) + (y * matrix[1][1]) + matrix[1][2];
  1039. X }    /*get_pair*/
  1040. X call_symbol(cif)
  1041. X char    *cif;
  1042. X {
  1043. X int    last_read, callnum;
  1044. X char    token[MAXTOKEN];
  1045. X char    ciftemp[MAXLINE];
  1046. X int    rotate_x, rotate_y;
  1047. X float    multi_matrix[3][3];
  1048. X float    temp_a_over_b, translate_x, translate_y;
  1049. X calltype    *call, *alloccall();
  1050. X     bang_symbol();
  1051. X     present_symbol->typer = CALLTYPE;
  1052. X     call = alloccall();
  1053. X     present_symbol->primitive.call = call;
  1054. X     last_read = get_token(cif, 2, token);
  1055. X     if (last_read == -1)
  1056. X         {
  1057. X         fprintf(stderr, "no symbol in CALL\n");
  1058. X         cif_output(stderr, cif);
  1059. X         return;
  1060. X         }
  1061. X     (void) sscanf(token, "%d", &callnum);
  1062. X     call->symbol = get_index(callnum);
  1063. X     if (call->symbol == -1)
  1064. X         {
  1065. X         sprintf(ciftemp, "DS %d", callnum);
  1066. X         temp_a_over_b = a_over_b;
  1067. X         ds(ciftemp, CALLTYPE);
  1068. X         a_over_b = temp_a_over_b;
  1069. X         call->symbol = get_index(callnum);
  1070. X         if (call->symbol == -1)
  1071. X             {
  1072. X             fprintf(stderr, "Error in call cif\n");
  1073. X             cif_output(stderr, cif);
  1074. X             }
  1075. X         }
  1076. X     identity_matrix(multi_matrix);
  1077. X     while(1) {
  1078. X         last_read = get_token(cif, last_read, token);
  1079. X         if (last_read == -1) break;
  1080. X         if (token[0] == 'M')
  1081. X             {
  1082. X             switch(token[1])
  1083. X                 {
  1084. X             case 'X':
  1085. X                 multi_matrix[0][0] = -1;
  1086. X                 hit_matrix(multi_matrix,
  1087. X                        call->matrix,
  1088. X                        call->matrix);
  1089. X                 multi_matrix[0][0] = 1;
  1090. X                 break;
  1091. X             case 'Y':
  1092. X                 multi_matrix[1][1] = -1;
  1093. X                 hit_matrix(multi_matrix,
  1094. X                        call->matrix,
  1095. X                        call->matrix);
  1096. X                 multi_matrix[1][1] = 1;
  1097. X                 break;
  1098. X             default:
  1099. X                 fprintf(stderr,
  1100. X                     "Error in mirror %c\n",
  1101. X                     token[1]);
  1102. X                 cif_output(stderr, cif);
  1103. X                 break;
  1104. X                 }    /*switch mirror*/
  1105. X             }    /*if mirror*/
  1106. X         else if (token[0] == 'R')
  1107. X             {
  1108. X             last_read = get_token(cif, last_read, token);
  1109. X             if (last_read == -1)
  1110. X                 {
  1111. X                 fprintf(stderr, "error in rotate\n");
  1112. X                 cif_output(stderr, cif);
  1113. X                 break;
  1114. X                 }
  1115. X             (void) sscanf(token, "%d", &rotate_x);
  1116. X             rotate_x = sign(rotate_x);
  1117. X             last_read = get_token(cif, last_read, token);
  1118. X             if (last_read == -1)
  1119. X                 {
  1120. X                 fprintf(stderr, "error2 in rotate\n");
  1121. X                 cif_output(stderr, cif);
  1122. X                 break;
  1123. X                 }
  1124. X             (void) sscanf(token, "%d", &rotate_y);
  1125. X             rotate_y = sign(rotate_y);
  1126. X             switch(rotate_x)
  1127. X                 {
  1128. X             case 1:
  1129. X                 if (rotate_y != 0)
  1130. X                     fprintf(stderr,
  1131. X                         "Bad rotation x %d y %d\n",
  1132. X                         rotate_x, rotate_y);
  1133. X                 break;
  1134. X             case -1:
  1135. X                 if (rotate_y != 0)
  1136. X                     {
  1137. X                     fprintf(stderr,
  1138. X                         "Bad rotation x %d y %d\n",
  1139. X                         rotate_x, rotate_y);
  1140. X                     break;
  1141. X                     }
  1142. X                 multi_matrix[0][0] = -1;
  1143. X                 multi_matrix[1][1] = -1;
  1144. X                 hit_matrix(multi_matrix,
  1145. X                        call->matrix,
  1146. X                        call->matrix);
  1147. X                 identity_matrix(multi_matrix);
  1148. X                 break;
  1149. X             case 0:
  1150. X                 switch(rotate_y)
  1151. X                     {
  1152. X                 case 1:
  1153. X                     multi_matrix[0][0] = 0;
  1154. X                     multi_matrix[1][1] = 0;
  1155. X                     multi_matrix[0][1] = -1;
  1156. X                     multi_matrix[1][0] = 1;
  1157. X                     hit_matrix(multi_matrix,
  1158. X                            call->matrix,
  1159. X                            call->matrix);
  1160. X                     identity_matrix(multi_matrix);
  1161. X                     break;
  1162. X                 case -1:
  1163. X                     multi_matrix[0][0] = 0;
  1164. X                     multi_matrix[1][1] = 0;
  1165. X                     multi_matrix[0][1] = 1;
  1166. X                     multi_matrix[1][0] = -1;
  1167. X                     hit_matrix(multi_matrix,
  1168. X                            call->matrix,
  1169. X                            call->matrix);
  1170. X                     identity_matrix(multi_matrix);
  1171. X                     break;
  1172. X                 default:
  1173. X                     fprintf(stderr,
  1174. X                         "Bad rotation x %d y %d\n",
  1175. X                         rotate_x, rotate_y);
  1176. X                     break;
  1177. X                     }    /*switch y*/
  1178. X                 break;
  1179. X             default:
  1180. X                 fprintf(stderr, "Bad rotation x %d y %d\n",
  1181. X                     rotate_x, rotate_y);
  1182. X                 break;
  1183. X                 }    /*switch rotation*/
  1184. X             }    /*if rotate*/
  1185. X         else if (token[0] == 'T')
  1186. X             {
  1187. X             last_read = get_token(cif, last_read, token);
  1188. X             if (last_read == -1)
  1189. X                 {
  1190. X                 fprintf(stderr, "error in translate\n");
  1191. X                 cif_output(stderr, cif);
  1192. X                 break;
  1193. X                 }
  1194. X             (void) sscanf(token, "%f", &translate_x);
  1195. X             translate_x *= a_over_b;
  1196. X             last_read = get_token(cif, last_read, token);
  1197. X             if (last_read == -1)
  1198. X                 {
  1199. X                 fprintf(stderr, "error2 in translate\n");
  1200. X                 cif_output(stderr, cif);
  1201. X                 break;
  1202. X                 }
  1203. X             (void) sscanf(token, "%f", &translate_y);
  1204. X             translate_y *= a_over_b;
  1205. X             if ((translate_x != 0) || (translate_y != 0))
  1206. X                 {
  1207. X                 multi_matrix[0][2] = translate_x;
  1208. X                 multi_matrix[1][2] = translate_y;
  1209. X                 hit_matrix(multi_matrix,
  1210. X                        call->matrix,
  1211. X                        call->matrix);
  1212. X                 identity_matrix(multi_matrix);
  1213. X                 }
  1214. X             }    /*if translate*/
  1215. X         else
  1216. X             {
  1217. X             fprintf(stderr, "error---out of calls\n");
  1218. X             cif_output(stderr, cif);
  1219. X             fprintf(stderr, "\ttoken %s\n", token);
  1220. X             break;
  1221. X             }
  1222. X         }    /* while(1) */
  1223. X }    /*call_symbol*/
  1224. X sign(x)
  1225. X int x;
  1226. X {
  1227. X     int z;
  1228. X     z = 0;
  1229. X     if (x > 0) z = 1;
  1230. X     if (x < 0) z = -1;
  1231. X     return(z);
  1232. X }
  1233. X identity_matrix(matrix)
  1234. X float    matrix[3][3];
  1235. X {
  1236. X     matrix[0][0] = 1;
  1237. X     matrix[0][1] = 0;
  1238. X     matrix[0][2] = 0;
  1239. X     matrix[1][0] = 0;
  1240. X     matrix[1][1] = 1;
  1241. X     matrix[1][2] = 0;
  1242. X     matrix[2][0] = 0;
  1243. X     matrix[2][1] = 0;
  1244. X     matrix[2][2] = 1;
  1245. X }    /*identity_matrix*/
  1246. X hit_matrix(left_matrix, right_matrix, to_matrix)
  1247. X float    left_matrix[3][3], right_matrix[3][3], to_matrix[3][3];
  1248. X {
  1249. X int    i, j;
  1250. X float    temp[3][3];
  1251. X     for(i = 0; i < 3; i++)
  1252. X         for(j = 0; j < 3; j++)
  1253. X             temp[i][j] = left_matrix[i][0] * right_matrix[0][j]
  1254. X                        + left_matrix[i][1] * right_matrix[1][j]
  1255. X                    + left_matrix[i][2] * right_matrix[2][j];
  1256. X     copy_matrix(temp, to_matrix);
  1257. X }    /*hit_matrix*/
  1258. X copy_matrix(from_matrix, to_matrix)
  1259. X float    from_matrix[3][3], to_matrix[3][3];
  1260. X {
  1261. X int    i, j;
  1262. X     for(i = 0; i < 3; i++)
  1263. X         {
  1264. X         for(j = 0; j < 3; j++)
  1265. X             to_matrix[i][j] = from_matrix[i][j];
  1266. X         }
  1267. X }    /*copy_matrix*/
  1268. X fix_bbox(ll, ur)
  1269. X pointpairtype *ll, *ur;
  1270. X {
  1271. X     float temp;
  1272. X     if (ll->x > ur->x) {    /* swap */
  1273. X         temp = ll->x;
  1274. X         ll->x = ur->x;
  1275. X         ur->x = temp;
  1276. X     }
  1277. X     if (ll->y > ur->y) {    /* swap */
  1278. X         temp = ll->y;
  1279. X         ll->y = ur->y;
  1280. X         ur->y = temp;
  1281. X     }
  1282. X }
  1283. SHAR_EOF
  1284. if test 15796 -ne "`wc -c < 'cif2ps.c'`"
  1285. then
  1286.     echo shar: error transmitting "'cif2ps.c'" '(should have been 15796 characters)'
  1287. fi
  1288. fi # end of overwriting check
  1289. echo shar: extracting "'cifgood.c'" '(13422 characters)'
  1290. if test -f 'cifgood.c'
  1291. then
  1292.     echo shar: will not over-write existing file "'cifgood.c'"
  1293. else
  1294. sed 's/^X //' << \SHAR_EOF > 'cifgood.c'
  1295. X /*
  1296. X  *    CIF parser code.
  1297. X  *    See "cif2ps.c" for authors' names and addresses.
  1298. X  *    Please honor the authors by not removing their attributions.
  1299. X  */
  1300. X #include "define.h"
  1301. X #include <malloc.h>
  1302. X #define DELTA_A    'a' - 'A'
  1303. X init_cif()
  1304. X {
  1305. X     layer = 0;
  1306. X }    /*init_cif*/
  1307. X get_next_cifline(stringer)
  1308. X char    *stringer;
  1309. X {
  1310. X     int    i;
  1311. X     int    c;
  1312. X     for(i = 0; i < MAXLINE; i++) {
  1313. X         c = getchar();
  1314. X         if (c == ';') {
  1315. X             stringer[i] = '\0';
  1316. X             return(i);
  1317. X             }
  1318. X         else if (c == '\n')
  1319. X             {
  1320. X             stringer[i] = ' ';
  1321. X             no_lines++;
  1322. X             }
  1323. X         else if (c == EOF)
  1324. X             {
  1325. X             stringer[i] = '\0';
  1326. X             if (i) return(i);
  1327. X             return(EOF);
  1328. X             }
  1329. X         else if (c == '(')
  1330. X             {
  1331. X             while (getchar() != ')') ;
  1332. X             }
  1333. X         else
  1334. X             stringer[i] = c;
  1335. X     } /* for (i ...) */
  1336. X     fprintf(stderr, "Cifline exceeded bounds\n");
  1337. X     stringer[i] = '\0';
  1338. X     cif_output(stderr, stringer);
  1339. X     exit(1);
  1340. X     /*NOTREACHED*/
  1341. X }    /*get_next_cifline*/
  1342. X cif_output(filer, cif)
  1343. X FILE    *filer;
  1344. X char    *cif;
  1345. X {
  1346. X     fprintf(filer, "%s\t\t(*near line %d*)\n", cif, no_lines);
  1347. X }    /*cif_output*/
  1348. X trim_cif(cif)
  1349. X char    *cif;
  1350. X {
  1351. X int    i, j, toggle_white;
  1352. X     i = 0;
  1353. X     j = 0;
  1354. X     toggle_white = 1;        /*so no white at beginning*/
  1355. X     for (i = 0; i < MAXLINE; i++)
  1356. X         {
  1357. X         if (cif[i] == COMMA)
  1358. X             {
  1359. X                 cif[i] = WHITE;
  1360. X             }
  1361. X         if (cif[i] == '\0')
  1362. X             {
  1363. X             cif[j] = '\0';
  1364. X             return;
  1365. X             }
  1366. X         else if (white(cif[i]))
  1367. X             {
  1368. X             if ( !toggle_white)    /*makes one white space*/
  1369. X                 {
  1370. X                 cif[j++] = ' ';
  1371. X                 toggle_white = 1;
  1372. X                 }
  1373. X             }
  1374. X         else
  1375. X             {
  1376. X             cif[j++] = cif[i];
  1377. X             if (toggle_white) toggle_white = 0;
  1378. X             }
  1379. X         }    /*for*/
  1380. X }    /*trim_cif*/
  1381. X white(chr)
  1382. X char    chr;
  1383. X {
  1384. X     switch(chr)
  1385. X         {
  1386. X     case ' ':
  1387. X     case '\t':
  1388. X         return(1);
  1389. X     default:
  1390. X         return(0);
  1391. X         }
  1392. X }    /*white*/
  1393. X symboltype
  1394. X *allocsymbol()
  1395. X {
  1396. X unsigned    size = sizeof(symboltype);
  1397. X symboltype    *symbol;
  1398. X     symbol =(symboltype *) malloc(size);
  1399. X     symbol->typer = 0;
  1400. X     symbol->primitive.box = NULL;
  1401. X     symbol->next = NULL;
  1402. X     return(symbol);
  1403. X }    /*allocsymbol*/
  1404. X     boxtype
  1405. X *allocbox()
  1406. X {
  1407. X     unsigned    size = sizeof(boxtype);
  1408. X     boxtype    *box;
  1409. X     box = (boxtype *) malloc(size);
  1410. X     return(box);
  1411. X }    /*allocbox*/
  1412. X int
  1413. X get_index(num)
  1414. X int    num;
  1415. X {
  1416. X     int    i;
  1417. X     for(i = 0; i <= last_symbol; i++)
  1418. X         {
  1419. X         if (symbol_table[i].symbol == num) return(i);
  1420. X         }
  1421. X     return(-1);
  1422. X }    /*get_index*/
  1423. X output_all_symbolnums(filer)
  1424. X FILE    *filer;
  1425. X {
  1426. X int    i;
  1427. X     fprintf(filer, "Symbols are:\n");
  1428. X     for(i = 0; i <= last_symbol; i++)
  1429. X         fprintf(filer, "%d\t%s\n", symbol_table[i].symbol,
  1430. X                             symbol_table[i].name);
  1431. X }    /*output_all_symbolnums*/
  1432. X do_cif()
  1433. X {
  1434. X char    cif[MAXLINE];
  1435. X     while (get_next_cifline(cif) != EOF) {
  1436. X         trim_cif(cif);
  1437. X         switch(cif[0]) {
  1438. X         case 'D':
  1439. X             switch(cif[1])
  1440. X                 {
  1441. X                case 'S':
  1442. X                 ds(cif, DSTYPE);
  1443. X                 break;
  1444. X                case 'F':
  1445. X                 df();
  1446. X                 break;
  1447. X                default:
  1448. X                 fprintf(stderr, "Unknown command in CIF\n");
  1449. X                 cif_output(stderr, cif);
  1450. X                 break;
  1451. X                 }    /*switch(cif[1]*/
  1452. X             break;
  1453. X         case '9':
  1454. X             switch(cif[1])
  1455. X                 {
  1456. X                case WHITE:
  1457. X                 nine(cif);
  1458. X                 break;
  1459. X                case '4':
  1460. X                 ninety_four(cif);
  1461. X                 break;
  1462. X                default:
  1463. X                 fprintf(stderr, "Unknown command in CIF\n");
  1464. X                 cif_output(stderr, cif);
  1465. X                 break;
  1466. X                 }    /*switchcif[1]*/
  1467. X             break;
  1468. X         case 'B':
  1469. X             cif_box(cif);
  1470. X             break;
  1471. X         case 'C':
  1472. X             call_symbol(cif);
  1473. X             break;
  1474. X         case 'L':
  1475. X             cif_change_layer(cif);
  1476. X             break;
  1477. X         case 'P':
  1478. X             cif_polygon(cif);
  1479. X             break;
  1480. X         case 'R':
  1481. X             cif_round(cif);
  1482. X             break;
  1483. X         case 'W':
  1484. X             cif_wire(cif);
  1485. X             break;
  1486. X         case 0:
  1487. X             break;
  1488. X         case 'E':
  1489. X             return;
  1490. X         default:
  1491. X             fprintf(stderr, "Syntax error:\n");
  1492. X             cif_output(stderr, cif);
  1493. X             break;
  1494. X         }    /*switch*/
  1495. X     } /* while (get_next_cifline(cif)...) */
  1496. X     fprintf(stderr, "Premature end of file\n");
  1497. X }    /*do_cif*/
  1498. X ds(cif, typer)
  1499. X char    *cif;
  1500. X int    typer;
  1501. X {
  1502. X int    last_read, symnum, temp_index;
  1503. X char    token[MAXTOKEN];
  1504. X symboltype    *symbol;
  1505. X     last_read = get_token(cif, 2, token); /* space optional */
  1506. X     if (last_read == -1)
  1507. X         {
  1508. X         fprintf(stderr, "no symbol in DS\n");
  1509. X         cif_output(stderr, cif);
  1510. X         return;
  1511. X         }
  1512. X     (void) sscanf(token, "%d", &symnum);
  1513. X     temp_index = get_index(symnum);
  1514. X     if (temp_index == -1)
  1515. X         {
  1516. X         if (++last_symbol == MAXSYMBOLS)
  1517. X             {
  1518. X             fprintf(stderr, "Exceeded the number of allowed symbols\n");
  1519. X             exit(1);
  1520. X             }
  1521. X         temp_index = last_symbol;
  1522. X         }
  1523. X     symbol_table[temp_index].symbol = symnum;
  1524. X     symbol_table[temp_index].ll.x = BIGINT;
  1525. X     symbol_table[temp_index].ll.y = BIGINT;
  1526. X     symbol_table[temp_index].ur.x = -BIGINT;
  1527. X     symbol_table[temp_index].ur.y = -BIGINT;
  1528. X     symbol_table[temp_index].name[0] = '\0';
  1529. X     symbol_table[temp_index].a = 1;
  1530. X     symbol_table[temp_index].b = 1;
  1531. X     a_over_b = 1;
  1532. X     symbol = allocsymbol();
  1533. X     if (typer == DSTYPE)
  1534. X         {
  1535. X         current_symbol_index = temp_index;
  1536. X         present_symbol = symbol;
  1537. X         }
  1538. X     symbol->typer = DSTYPE;
  1539. X     symbol_table[temp_index].pointer = symbol;
  1540. X     *symbol_table[temp_index].name = '\0';
  1541. X     last_read = get_token(cif, last_read, token);
  1542. X     if (last_read == -1) return;
  1543. X     (void) sscanf(token, "%d", &(symbol_table[temp_index].a));
  1544. X     if (symbol_table[temp_index].a == 0)
  1545. X         {
  1546. X         fprintf(stderr, "read a 0 for A in DS\n");
  1547. X         cif_output(stderr, cif);
  1548. X         symbol_table[temp_index].a = 1;
  1549. X         }
  1550. X     last_read = get_token(cif, last_read, token);
  1551. X     if (last_read == -1)
  1552. X         {
  1553. X         fprintf(stderr, "A but no B in DS\n");
  1554. X         cif_output(stderr, cif);
  1555. X         a_over_b = ((float) symbol_table[temp_index].a) /
  1556. X                     ((float) symbol_table[temp_index].b);
  1557. X         return;
  1558. X         }
  1559. X     (void) sscanf(token, "%d", &(symbol_table[temp_index].b));
  1560. X     if (symbol_table[temp_index].b == 0)
  1561. X         {
  1562. X         fprintf(stderr, "read a 0 for B in DS\n");
  1563. X         cif_output(stderr, cif);
  1564. X         symbol_table[temp_index].b = 1;
  1565. X         }
  1566. X     a_over_b = ((float) symbol_table[temp_index].a) /
  1567. X                     ((float) symbol_table[temp_index].b);
  1568. X }    /*ds*/
  1569. X     int
  1570. X get_token(cif, from, token)    /* copies token into *token */
  1571. X char    *cif;
  1572. X int    from;
  1573. X char    *token;
  1574. X {
  1575. X     int    i;
  1576. X     /* passed end of cif statement yet? */
  1577. X     if ((from > 0) && (cif[from - 1] == '\0'))
  1578. X         return(-1);
  1579. X     /* skip leading white space */
  1580. X     while (cif[from] == WHITE) from++;
  1581. X     for (i = 0; ((cif[i+from] != WHITE) && (cif[i+from] != COMMA));i++)
  1582. X         {
  1583. X         if (i >= MAXTOKEN-1) {
  1584. X           fprintf(stderr,"token overflow!\n");
  1585. X           cif_output(stderr,cif);
  1586. X           exit(1);
  1587. X         }
  1588. X         if (cif[i + from] == '\0')
  1589. X             break;
  1590. X         token[i] = cif[i + from];
  1591. X         }
  1592. X     token[i] = '\0';
  1593. X     if (i == 0)
  1594. X         return(-1);
  1595. X     else
  1596. X         return(i + from + 1);
  1597. X }    /*get_token*/
  1598. X df()
  1599. X {
  1600. X     current_symbol_index = 0;
  1601. X     present_symbol = symbol_table[current_symbol_index].pointer;
  1602. X }    /*df*/
  1603. X cif_box(cif)
  1604. X char    *cif;
  1605. X {
  1606. X int    next_one, i;
  1607. X int    temp[4];
  1608. X char    token[MAXTOKEN];
  1609. X boxtype    *box, *allocbox();
  1610. X     bang_symbol();
  1611. X     present_symbol->typer = BOXTYPE;
  1612. X     box = allocbox();
  1613. X     present_symbol->primitive.box = box;
  1614. X     box->layer = layer;
  1615. X     next_one = 1; /* space optional */
  1616. X     for(i = 0; i < 4; i++) {
  1617. X         next_one = get_token(cif, next_one, token);
  1618. X         if (next_one == -1)
  1619. X             {
  1620. X             fprintf(stderr, "incomplete box\n");
  1621. X             cif_output(stderr, cif);
  1622. X             return;
  1623. X             }
  1624. X         (void) sscanf(token, "%d", &(temp[i]));
  1625. X     }
  1626. X     /* *temp = width, height, center-x, center-y */
  1627. X     box->llx = a_over_b * (temp[2] - temp[0]/2);
  1628. X     box->urx = a_over_b * (temp[2] + temp[0]/2);
  1629. X     box->lly = a_over_b * (temp[3] - temp[1]/2);
  1630. X     box->ury = a_over_b * (temp[3] + temp[1]/2);
  1631. X }    /*cif_box*/
  1632. X cif_change_layer(cif)
  1633. X char    *cif;
  1634. X {
  1635. X     char    token[MAXTOKEN];
  1636. X     if (-1 == get_token(cif, 1, token)) { /* space optional */
  1637. X         fprintf(stderr, "Error in layer command\n");
  1638. X         cif_output(stderr, cif);
  1639. X         exit(1);
  1640. X     }
  1641. X     layer = layer_lookup(token);
  1642. X }    /*cif_change_layers*/
  1643. X #define PATHMALLOC 4    /* number of points per malloc */
  1644. X cif_path(cif,ptpoints,ptarray)
  1645. X char *cif;    /* the input statement */
  1646. X int *ptpoints;    /* place to return number of points */
  1647. X int **ptarray;    /* place to return address of array */
  1648. X {
  1649. X     static char *error = "can't read path";
  1650. X     static char token[MAXTOKEN];
  1651. X     static int x,y;
  1652. X     int points=0;
  1653. X     int column=0;    /* current column in cif line */
  1654. X     int pointsMax = PATHMALLOC; /* initial size of array */
  1655. X     int *pointsArray = (int *) malloc(
  1656. X             (unsigned) (PATHMALLOC*2*sizeof(int)));
  1657. X     /* read all the points into the array */
  1658. X     while(-1 != (column = get_token(cif, column, token))) {
  1659. X       if(1 != sscanf(token, "%d", &x)) {
  1660. X         fprintf(stderr,"%s point %d X\n", error, points);
  1661. X         cif_output(stderr,cif);
  1662. X         points=0;
  1663. X         break;
  1664. X       }
  1665. X       column = get_token(cif, column, token);
  1666. X       if((column == -1) || (1 != sscanf(token, "%d", &y))) {
  1667. X         fprintf(stderr,"%s point %d Y\n", error, points);
  1668. X         cif_output(stderr,cif);
  1669. X         points=0;
  1670. X         break;
  1671. X       }
  1672. X       /* make sure there's room for the new X,Y */
  1673. X       if (points >= pointsMax) {
  1674. X         pointsMax += PATHMALLOC;
  1675. X         pointsArray = (int *) realloc((char *) pointsArray,
  1676. X             (unsigned) (pointsMax * 2 * sizeof(int)));
  1677. X       }
  1678. X       if (!pointsArray) {
  1679. X         fprintf(stderr,"out of memory\n");
  1680. X         exit(1);
  1681. X       }
  1682. X       /* store the X,Y pair in the array */
  1683. X       pointsArray[2*points] = x * a_over_b;
  1684. X       pointsArray[2*points+1] = y * a_over_b;
  1685. X       points++;
  1686. X     } /* while (-1 != (column = get_token(...))) */
  1687. X     *ptpoints = points;
  1688. X     *ptarray = pointsArray;
  1689. X } /* cif_path() */
  1690. X cif_polygon(cif)
  1691. X char    *cif;
  1692. X {
  1693. X     static char *error = "can't read polygon";
  1694. X     ngontype *ngon;
  1695. X     int points=0;
  1696. X     int *pointsArray;
  1697. X     /* read in the path (list of points) */
  1698. X     cif_path(&(cif[1]), &points, &pointsArray);
  1699. X     /* make sure polygon has enough points */
  1700. X     if (points < 3) {
  1701. X       fprintf(stderr,"degenerate polygon\n");
  1702. X       cif_output(stderr,cif);
  1703. X       free((char *) pointsArray);
  1704. X       return;
  1705. X     }
  1706. X     /* Finish up... */
  1707. X     bang_symbol();
  1708. X     present_symbol->typer = NGONTYPE;
  1709. X     ngon = (ngontype *) malloc(sizeof(ngontype));
  1710. X     present_symbol->primitive.ngon = ngon;
  1711. X     ngon->layer = layer;
  1712. X     ngon->numPoints = points;
  1713. X     ngon->ptrPoints = pointsArray;
  1714. X } /* cif_polygon() */
  1715. X cif_round(cif)
  1716. X char    *cif;
  1717. X {
  1718. X     static char *error = "can't read roundflash %s\n";
  1719. X     static char token[MAXTOKEN];
  1720. X     static int x,y,r;
  1721. X     int    column=1; /* space optional */
  1722. X     roundtype *round;
  1723. X     column = get_token(cif, column, token);
  1724. X     if((column == -1) || (1 != sscanf(token, "%d", &x))) {
  1725. X       fprintf(stderr,error,"X");
  1726. X       cif_output(stderr,cif);
  1727. X       return;
  1728. X     }
  1729. X     column = get_token(cif, column, token);
  1730. X     if((column == -1) || (1 != sscanf(token, "%d", &y))) {
  1731. X       fprintf(stderr,error,"Y");
  1732. X       cif_output(stderr,cif);
  1733. X       return;
  1734. X     }
  1735. X     column = get_token(cif, column, token);
  1736. X     if((column == -1) || (1 != sscanf(token, "%d", &r))) {
  1737. X       fprintf(stderr,error,"radius");
  1738. X       cif_output(stderr,cif);
  1739. X       return;
  1740. X     }
  1741. X     /* Finish up... */
  1742. X     bang_symbol();
  1743. X     present_symbol->typer = ROUNDTYPE;
  1744. X     round = (roundtype *) malloc(sizeof(roundtype));
  1745. X     present_symbol->primitive.round = round;
  1746. X     round->layer = layer;
  1747. X     round->x = x * a_over_b;
  1748. X     round->y = y * a_over_b;
  1749. X     round->r = r * a_over_b;
  1750. X } /* cif_round() */
  1751. X cif_wire(cif)
  1752. X char    *cif;
  1753. X {
  1754. X     static char *error = "can't read wire";
  1755. X     static char token[MAXTOKEN];
  1756. X     static int width;
  1757. X     int column=1;    /* current column in cif line */
  1758. X     wiretype *wire;
  1759. X     int points=0;
  1760. X     int *pointsArray;
  1761. X     /* read the wire width */
  1762. X     column = get_token(cif, column, token);
  1763. X     if((column == -1) || (1 != sscanf(token, "%d", &width))) {
  1764. X       fprintf(stderr,error,"width");
  1765. X       cif_output(stderr,cif);
  1766. X       return;
  1767. X     }
  1768. X     /* read in the path (list of points) */
  1769. X     cif_path(&(cif[column]), &points, &pointsArray);
  1770. X     /* make sure wire has enough points */
  1771. X     if (points < 2) {
  1772. X       fprintf(stderr,"degenerate wire\n");
  1773. X       cif_output(stderr,cif);
  1774. X       free((char *) pointsArray);
  1775. X       return;
  1776. X     }
  1777. X     /* Finish up... */
  1778. X     bang_symbol();
  1779. X     present_symbol->typer = WIRETYPE;
  1780. X     wire = (wiretype *) malloc(sizeof(wiretype));
  1781. X     present_symbol->primitive.wire = wire;
  1782. X     wire->layer = layer;
  1783. X     wire->width = width * a_over_b;
  1784. X     wire->numPoints = points;
  1785. X     wire->ptrPoints = pointsArray;
  1786. X } /* cif_wire() */
  1787. X nine(cif)
  1788. X char    *cif;
  1789. X {
  1790. X int    foobar;
  1791. X char    token[MAXTOKEN];
  1792. X     foobar = get_token(cif, 1, token); /* space optional */
  1793. X     if (foobar == -1)
  1794. X         {
  1795. X         fprintf(stderr, "Error in 9 command\n");
  1796. X         cif_output(stderr, cif);
  1797. X         return;
  1798. X         }
  1799. X     (void) sscanf(token, "%s", symbol_table[current_symbol_index].name);
  1800. X }    /*nine*/
  1801. X bang_symbol()
  1802. X {
  1803. X     present_symbol->next = allocsymbol();
  1804. X     present_symbol = present_symbol->next;
  1805. X }    /*bang_symbol*/
  1806. X ninety_four(cif)
  1807. X char    *cif;
  1808. X {
  1809. X int    last_read;
  1810. X char    token[MAXTOKEN];
  1811. X ninety_fourtype    *ninety_four, *allocninety_four();
  1812. X     bang_symbol();
  1813. X     present_symbol->typer = NINETY_FOURTYPE;
  1814. X     ninety_four = allocninety_four();
  1815. X     present_symbol->primitive.ninety_four = ninety_four;
  1816. X     last_read = get_token(cif, 2, token); /* space optional */
  1817. X     if (last_read == -1)
  1818. X         {
  1819. X         fprintf(stderr, "no text in ninety_four\n");
  1820. X         cif_output(stderr, cif);
  1821. X         return;
  1822. X         }
  1823. X     (void) sscanf(token, "%s", ninety_four->name);
  1824. X     last_read = get_token(cif, last_read, token);
  1825. X     if (last_read == -1)
  1826. X         {
  1827. X         fprintf(stderr, "no x in ninety_four\n");
  1828. X         cif_output(stderr, cif);
  1829. X         return;
  1830. X         }
  1831. X     (void) sscanf(token, "%d", &(ninety_four->x));
  1832. X     ninety_four->x *= a_over_b;
  1833. X     last_read = get_token(cif, last_read, token);
  1834. X     if (last_read == -1)
  1835. X         {
  1836. X         fprintf(stderr, "no y in ninety_four\n");
  1837. X         cif_output(stderr, cif);
  1838. X         return;
  1839. X         }
  1840. X     (void) sscanf(token, "%d", &(ninety_four->y));
  1841. X     ninety_four->y *= a_over_b;
  1842. X     last_read = get_token(cif, last_read, token);
  1843. X     if (last_read != -1)    /*don't need layer on 94*/
  1844. X         ninety_four->layer = -1;
  1845. X }    /*ninety_four*/
  1846. X calltype
  1847. X *alloccall()
  1848. X {
  1849. X unsigned    size = sizeof(calltype);
  1850. X calltype    *call;
  1851. X     call =(calltype *) malloc(size);
  1852. X     call->symbol = -999;
  1853. X     identity_matrix(call->matrix);
  1854. X     return(call);
  1855. X }    /*alloccall*/
  1856. X     ninety_fourtype
  1857. X *allocninety_four()
  1858. X {
  1859. X unsigned    size = sizeof(ninety_fourtype);
  1860. X ninety_fourtype    *ninety_four;
  1861. X     ninety_four =(ninety_fourtype *) malloc(size);
  1862. X     ninety_four->layer = 0;
  1863. X     ninety_four->x = 0;
  1864. X     ninety_four->y = 0;
  1865. X     ninety_four->name[0] = '\0';
  1866. X     return(ninety_four);
  1867. X }    /*allocninety_four*/
  1868. SHAR_EOF
  1869. if test 13422 -ne "`wc -c < 'cifgood.c'`"
  1870. then
  1871.     echo shar: error transmitting "'cifgood.c'" '(should have been 13422 characters)'
  1872. fi
  1873. fi # end of overwriting check
  1874. echo shar: extracting "'cifplot.c'" '(3227 characters)'
  1875. if test -f 'cifplot.c'
  1876. then
  1877.     echo shar: will not over-write existing file "'cifplot.c'"
  1878. else
  1879. sed 's/^X //' << \SHAR_EOF > 'cifplot.c'
  1880. X /*
  1881. X  *    Output generation code.
  1882. X  *    See "cif2ps.c" for authors' names and addresses.
  1883. X  *    Please honor the authors by not removing their attributions.
  1884. X  */
  1885. X #include "define.h"
  1886. X plot_box(box)
  1887. X boxtype    *box;
  1888. X {
  1889. X     pointpairtype ll, ur;
  1890. X     int dx, dy;
  1891. X     if (box->layer != layer) return;
  1892. X     get_pair(box->llx, box->lly, &ll);
  1893. X     get_pair(box->urx, box->ury, &ur);
  1894. X     dx = ur.x - ll.x;
  1895. X     dy = ur.y - ll.y;
  1896. X     printf("%d %d %d %d B %s\n",
  1897. X            dx, dy, ll.x, ll.y, cur_style);
  1898. X }    /*plot_box*/
  1899. X plot_ngon(ngon)
  1900. X ngontype    *ngon;
  1901. X {
  1902. X     pointpairtype point;
  1903. X     int n = ngon->numPoints;
  1904. X     int *a = ngon->ptrPoints;
  1905. X     if (ngon->layer != layer) return;
  1906. X     get_pair(a[0], a[1], &point);
  1907. X     printf("%d %d moveto %% P %d\n", point.x, point.y, n);
  1908. X     n--; a += 2;
  1909. X     do {
  1910. X         get_pair(a[0], a[1], &point);
  1911. X         printf("%d %d lineto\n", point.x, point.y);
  1912. X         n--; a += 2;
  1913. X     } while (n);
  1914. X     printf("closepath %s\n", cur_style);
  1915. X }    /* plot_ngon */
  1916. X plot_round(round)
  1917. X roundtype    *round;
  1918. X {
  1919. X     pointpairtype center;
  1920. X     if (round->layer != layer) return;
  1921. X     get_pair(round->x, round->y, ¢er);
  1922. X     printf("newpath %d %d %d 0 360 arc closepath %s\n",
  1923. X            (int) center.x, (int) center.y,
  1924. X            (int) round->r, cur_style);
  1925. X }    /* plot_round */
  1926. X plot_wire(wire)
  1927. X wiretype    *wire;
  1928. X {
  1929. X     pointpairtype point;
  1930. X     int n = wire->numPoints;
  1931. X     int *a = wire->ptrPoints;
  1932. X     if (wire->layer != layer) return;
  1933. X     printf("/WW %d 2 div def ",wire->width);
  1934. X     get_pair(a[0], a[1], &point);
  1935. X     printf("%d %d %% W %d\n", point.x, point.y, n);
  1936. X     n--; a += 2;
  1937. X     do {
  1938. X         get_pair(a[0], a[1], &point);
  1939. X         printf("%d %d Wto %s\n",
  1940. X                point.x, point.y, cur_style);
  1941. X         n--; a += 2;
  1942. X     } while (n);
  1943. X     printf("pop pop\n");
  1944. X }    /* plot_wire */
  1945. X plot_text(ninety_four)
  1946. X ninety_fourtype    *ninety_four;
  1947. X {
  1948. X     pointpairtype    pair;
  1949. X     get_pair(ninety_four->x, ninety_four->y, &pair);
  1950. X     plot_string(pair.x, pair.y, ninety_four->name);
  1951. X }    /*plot_text*/
  1952. X plot_string(x, y, stringer)
  1953. X int x, y;
  1954. X char    *stringer;
  1955. X {
  1956. X     printf("%d %d moveto (%s) show\n", x, y, stringer);
  1957. X }    /*plot_string*/
  1958. X void printStrings(p)
  1959. X char **p;
  1960. X {
  1961. X     while(*p) puts(*p++);
  1962. X }
  1963. X putHeader()    /* goes before first page */
  1964. X {
  1965. X     /* Uses globals: psheader */
  1966. X     puts("%!PS-Adobe-1.0");
  1967. X     puts("%%Creator: cif2ps");
  1968. X     puts("%%DocumentFonts: Helvetica");
  1969. X     puts("%%Pages: (atend)");
  1970. X     puts("%%EndComments");
  1971. X     printStrings(psheader);
  1972. X     puts("%%EndProlog\n");
  1973. X }
  1974. X putTrailer()        /* goes after last page */
  1975. X {
  1976. X     /* Uses global: totpages */
  1977. X     puts("%%Trailer");
  1978. X     printf("%%%%Pages: %d\n", totpages);
  1979. X }
  1980. X startPage()
  1981. X {
  1982. X     printf("%%%%Page: %d:%d\n", pagex, pagey);
  1983. X     printf("%d dup translate %% margins\n", (int) PAGEMARGIN);
  1984. X     if ( (width > 1) || (length > 1)) {
  1985. X         /* multi-page plot: print the page number */
  1986. X         printf("/Helvetica findfont ");
  1987. X         printf("%d scalefont setfont\n", (int)DEFPOINTS);
  1988. X         printf("0 %d moveto (Page %d,%d) show\n",
  1989. X                (int)(-DEFPOINTS), pagex, pagey);
  1990. X     }
  1991. X     printf("/Helvetica findfont %d ", font_points);
  1992. X     printf("%g div scalefont setfont\n", scale);
  1993. X     printf("%g dup scale %% points/centi-micron\n", scale);
  1994. X     printf("%g %g translate %% cell_origin\n", trans_x, trans_y);
  1995. X     if (pagex || pagey) {
  1996. X         printf("%g %g translate %% page_origin\n",
  1997. X             (float)(-pagex * PAGEWIDTH / scale),
  1998. X             (float)(-pagey * PAGELENGTH / scale));
  1999. X     }
  2000. X }
  2001. X finishPage()
  2002. X {
  2003. X     printf("showpage\n");
  2004. X     totpages++;
  2005. X }    /*epilog*/
  2006. SHAR_EOF
  2007. if test 3227 -ne "`wc -c < 'cifplot.c'`"
  2008. then
  2009.     echo shar: error transmitting "'cifplot.c'" '(should have been 3227 characters)'
  2010. fi
  2011. fi # end of overwriting check
  2012. echo shar: extracting "'layers.c'" '(798 characters)'
  2013. if test -f 'layers.c'
  2014. then
  2015.     echo shar: will not over-write existing file "'layers.c'"
  2016. else
  2017. sed 's/^X //' << \SHAR_EOF > 'layers.c'
  2018. X /*
  2019. X  *    CIF Layer name storage and lookup functions.
  2020. X  *    See "cif2ps.c" for authors' names and addresses.
  2021. X  *    Please honor the authors by not removing their attributions.
  2022. X  */
  2023. X #include "define.h"
  2024. X #include <string.h>
  2025. X #include <malloc.h>
  2026. X int
  2027. X layer_lookup(name)    /* assigns a unique number to each CIF layer */
  2028. X char *name;
  2029. X {
  2030. X     int i;
  2031. X     char *new;
  2032. X     for (i=0; i<numlayers; i++) {
  2033. X         if (!strcmp(name,layers[i].name)) return(i);
  2034. X     }
  2035. X     /* layer was not found so define it */
  2036. X     if (numlayers>=MAXLAYERS) {
  2037. X         fprintf(stderr,"Too many layers\n");
  2038. X         exit(1);
  2039. X     }
  2040. X     new = malloc(LNAMELEN+1);
  2041. X     if (!new) {
  2042. X         fprintf(stderr,"layer_lookup: Out of memory\n");
  2043. X         exit(1);
  2044. X     }
  2045. X     layers[numlayers].name = strncpy(new,name,LNAMELEN);
  2046. X     layers[numlayers].name[LNAMELEN] = '\0';
  2047. X     layers[numlayers].style = 0;
  2048. X     return(numlayers++);
  2049. X }
  2050. SHAR_EOF
  2051. if test 798 -ne "`wc -c < 'layers.c'`"
  2052. then
  2053.     echo shar: error transmitting "'layers.c'" '(should have been 798 characters)'
  2054. fi
  2055. fi # end of overwriting check
  2056. echo shar: extracting "'styles.c'" '(3885 characters)'
  2057. if test -f 'styles.c'
  2058. then
  2059.     echo shar: will not over-write existing file "'styles.c'"
  2060. else
  2061. sed 's/^X //' << \SHAR_EOF > 'styles.c'
  2062. X /*
  2063. X  *    Style selection default table and related functions.
  2064. X  *    See "cif2ps.c" for authors' names and addresses.
  2065. X  *    Please honor the authors by not removing their attributions.
  2066. X  */
  2067. X #include "define.h"
  2068. X #include <string.h>
  2069. X #include <ctype.h>
  2070. X /*
  2071. X  *    Style table encoding:
  2072. X  *    The strings are pairs: LAYER, STYLE and
  2073. X  *    STYLE strings are merely PostScript except for the "G.n"
  2074. X  *    code which is special (and must be first in the string).
  2075. X  *    A spaces is required between components.
  2076. X  *
  2077. X  *    Drawing styles implemented:
  2078. X  *
  2079. X  *    "Gn"    fill with opaque gray stipple with level n where
  2080. X  *        n is a real number immediately after the 'G'.
  2081. X  *        The G must be the beginning of the string!
  2082. X  *
  2083. X  *    "n a L"    fill with lines spaced by n and rotated by a (degrees).
  2084. X  *
  2085. X  *    "X"    Put an X across the figure.
  2086. X  *
  2087. X  *    "stroke" Draw a box around the figure.
  2088. X  *            (this must be last if used).
  2089. X  */
  2090. X char *default_styles[] = {    /* pairs of strings */
  2091. X     /* MOSIS SCMOS layers */
  2092. X     "CPG", "G.3",
  2093. X     "CCP", "G0",
  2094. X     "CAA", "G.5",
  2095. X     "CCA", "G0",
  2096. X     "CMF", "8 45 L",
  2097. X     "CMS", "8 135 L",
  2098. X     "CVA", "G.2",
  2099. X     "CSP", "16 45 L",
  2100. X     "CSN", "16 135 L",
  2101. X     "CWP", "32 45 L",
  2102. X     "CWN", "32 135 L",
  2103. X     "COG", "G.7",
  2104. X     /* Oct Symbolic layers */
  2105. X     "POLY", "G.3",
  2106. X     "COPO", "G.3 X stroke",        /* poly contact */
  2107. X     "PDIF", "G.7 24 45 L",
  2108. X     "COPD", "G.7 X stroke",        /* pdiff contact */
  2109. X     "NDIF", "G.7 24 135 L",
  2110. X     "COND", "G.7 X stroke",        /* ndiff contact */
  2111. X     "MET1", "8 45 L",
  2112. X     "COM2", "8 45 L 8 135 L stroke",
  2113. X     "MET2", "8 135 L",
  2114. X     "PWEL", "32 45 L",
  2115. X     "COPS", "G.9 32 45 L X stroke",        /* psubs contact */
  2116. X     "NWEL", "32 135 L",
  2117. X     "CONS", "G.9 32 135 L X stroke",    /* nsubs contact */
  2118. X     "GLAS", "G.7 X stroke",
  2119. X     /* MOSIS Bulk CMOS layers */
  2120. X     "CP", "G.3",
  2121. X     "CD", "G.5",
  2122. X     "CM", "8 45 L",
  2123. X     "CQ", "8 135 L",    /* metal 2 */
  2124. X     "CM2","8 135 L",    /* metal 2, alternate name */
  2125. X     "CC", "G0",
  2126. X     "CV", "G.2 stroke",    /* via */
  2127. X     "CC2","G.2 stroke",    /* via, alternate name */
  2128. X     "CW", "23 45 L",
  2129. X     "CS", "16 45 L",
  2130. X     "CG", "G.7",
  2131. X     /* end of table marker -- MAKE SURE THIS STAYS! */
  2132. X     0, 0
  2133. X };
  2134. X char *style_lookup(name)    /* returns style string for layer */
  2135. X char *name;
  2136. X {
  2137. X     char **p;
  2138. X     for (p = default_styles; *p; p++) {
  2139. X         if (!strcmp(*(p++),name)) return(*p);
  2140. X     }
  2141. X     fprintf(stderr,"%s: layer style not found (ignoring)\n", name);
  2142. X     return("");
  2143. X }
  2144. X style_sort()    /* determines drawing order for layers */
  2145. X {
  2146. X     int i,j,tmp;
  2147. X     float grays[MAXLAYERS];
  2148. X     /* the lighter (higher value) gray levels are drawn first,
  2149. X      * so sort into decreasing order.
  2150. X      */
  2151. X     /* Read the gray levels and initialize order[] */
  2152. X     /* Also, make the ones starting with "G" come first */
  2153. X     i = 0; j = numlayers;
  2154. X     while (--j >= 0) {
  2155. X         if (!layers[j].style)
  2156. X             layers[j].style = style_lookup(layers[j].name);
  2157. X         if (1 == sscanf(layers[j].style,
  2158. X                 "G%f",&(grays[j]))) {
  2159. X             order[i++] = j;
  2160. X         } else {
  2161. X             order[j+i] = j;
  2162. X         }
  2163. X     }
  2164. X     /* Now only the first (i) elements need sorting */
  2165. X     /* Sort the array into decreasing gray levels.
  2166. X      * An exchange sort is used on indexes in order[].
  2167. X      * (The number of elements is always small.)
  2168. X      */
  2169. X     while (--i >= 0) {
  2170. X         for (j=0; j<i; j++) {
  2171. X             if (grays[order[j]] >= grays[order[i]])
  2172. X                 continue;
  2173. X             /* swap (put in decreasing order) */
  2174. X             tmp = order[i];
  2175. X             order[i] = order[j];
  2176. X             order[j] = tmp;
  2177. X         }
  2178. X     }
  2179. X }
  2180. X int style_gray(s)    /* returns true if style uses gray fill */
  2181. X     char *s;
  2182. X {
  2183. X     if (*s != 'G') return(0);
  2184. X     ++s;
  2185. X     while ( isdigit(*s) || (*s=='.') ) putchar(*s++);
  2186. X     puts(" setgray");
  2187. X     cur_style = "fill";
  2188. X     return(1);
  2189. X }
  2190. X int style_rest(s)    /* the rest can be done in any order */
  2191. X     char *s;
  2192. X {
  2193. X     if (*s == 'G') {    /* skip a gray fill code (already done)  */
  2194. X         ++s;
  2195. X         while ( isdigit(*s) || *s=='.' ) s++;
  2196. X         while ( isspace(*s) ) s++;
  2197. X     }
  2198. X     if (*s == '\0') return(0);
  2199. X     cur_style = s;
  2200. X     return(1);
  2201. X }
  2202. X set_style(s)        /* set style, i.e. "CSP=stroke" */
  2203. X char *s;
  2204. X {
  2205. X     int i;
  2206. X     char *p;
  2207. X     p = s;
  2208. X     while (isalnum(*p)) p++;    /* find non-alnum */
  2209. X     if (*p) *(p++) = '\0';            /* zap it */
  2210. X     i = layer_lookup(s);
  2211. X     layers[i].style = p;
  2212. X }
  2213. SHAR_EOF
  2214. if test 3885 -ne "`wc -c < 'styles.c'`"
  2215. then
  2216.     echo shar: error transmitting "'styles.c'" '(should have been 3885 characters)'
  2217. fi
  2218. fi # end of overwriting check
  2219. echo shar: extracting "'layerkey.csh'" '(501 characters)'
  2220. if test -f 'layerkey.csh'
  2221. then
  2222.     echo shar: will not over-write existing file "'layerkey.csh'"
  2223. else
  2224. sed 's/^X //' << \SHAR_EOF > 'layerkey.csh'
  2225. X #!/bin/csh -f
  2226. X # shell script to make a color/pattern key for cifplot.
  2227. X # Run this with an arg list of layer names to produce
  2228. X # CIF with a box showing each layer (on standard output).
  2229. X if "$1" == "" then
  2230. X     sh -c "echo $0\: expecting layer list as arguments. >&2"
  2231. X     exit(1)
  2232. X endif
  2233. X echo "( CIF layer key generated by $0 );"
  2234. X echo "DS 1 200 1;"
  2235. X # Write cell definitions, one cell for each layer
  2236. X set Y=1
  2237. X foreach L ($argv[1-])
  2238. X     echo "L $L; B 2 2 1 $Y; 94 $L 1 $Y;"
  2239. X     @ Y += 2
  2240. X end
  2241. X echo "DF;"
  2242. X echo "C 1;"
  2243. X echo End
  2244. SHAR_EOF
  2245. if test 501 -ne "`wc -c < 'layerkey.csh'`"
  2246. then
  2247.     echo shar: error transmitting "'layerkey.csh'" '(should have been 501 characters)'
  2248. fi
  2249. chmod +x 'layerkey.csh'
  2250. fi # end of overwriting check
  2251. echo shar: extracting "'everything.cif'" '(111 characters)'
  2252. if test -f 'everything.cif'
  2253. then
  2254.     echo shar: will not over-write existing file "'everything.cif'"
  2255. else
  2256. sed 's/^X //' << \SHAR_EOF > 'everything.cif'
  2257. X DS 1 100 1;
  2258. X L CMF;
  2259. X B 20 20 10 10;
  2260. X R 10 30 10;
  2261. X P 0 40
  2262. X  10 50
  2263. X  20 40;
  2264. X W 2
  2265. X   0 60
  2266. X  10 60
  2267. X  30 40
  2268. X  30 0;
  2269. X DF;
  2270. X C 1;
  2271. X E
  2272. SHAR_EOF
  2273. if test 111 -ne "`wc -c < 'everything.cif'`"
  2274. then
  2275.     echo shar: error transmitting "'everything.cif'" '(should have been 111 characters)'
  2276. fi
  2277. fi # end of overwriting check
  2278. echo shar: extracting "'scmos-test.cif'" '(3074 characters)'
  2279. if test -f 'scmos-test.cif'
  2280. then
  2281.     echo shar: will not over-write existing file "'scmos-test.cif'"
  2282. else
  2283. sed 's/^X //' << \SHAR_EOF > 'scmos-test.cif'
  2284. X DS 1 25 2;
  2285. X 9 loadadd11;
  2286. X L CMF;
  2287. X     B 48 12 216 3210;
  2288. X     B 120 36 180 3186;
  2289. X     B 36 12 138 3162;
  2290. X C 2 MX R 0 -1 T 12 3348;
  2291. X C 3 R 0 -1 T 276 3996;
  2292. X C 3 R 0 -1 T 876 3996;
  2293. X C 3 R 0 -1 T 1476 3996;
  2294. X C 3 R 0 -1 T 2076 3996;
  2295. X C 3 R 0 -1 T 2676 3996;
  2296. X DF;
  2297. X DS 3 25 2;
  2298. X 9 latch_left_pair;
  2299. X L CMF;
  2300. X     B 48 48 804 540;
  2301. X     B 36 36 810 498;
  2302. X     B 48 36 816 462;
  2303. X     B 48 36 816 162;
  2304. X     B 36 84 810 102;
  2305. X     B 48 48 804 36;
  2306. X C 2 MX R 1 0 T 648 336;
  2307. X C 2 R -1 0 T 648 240;
  2308. X DF;
  2309. X DS 2 25 2;
  2310. X 9 latch;
  2311. X L CWP;
  2312. X     B 888 168 252 0;
  2313. X     B 120 24 204 -96;
  2314. X L CMS;
  2315. X     B 96 300 -228 126;
  2316. X     B 420 48 450 252;
  2317. X     B 240 48 -12 204;
  2318. X     B 48 60 84 150;
  2319. X     B 48 48 480 144;
  2320. X     B 48 36 -12 90;
  2321. X     B 36 48 474 96;
  2322. X     B 528 48 228 48;
  2323. X     B 564 48 6 -48;
  2324. X     B 96 300 612 78;
  2325. X L CMF;
  2326. X     B 108 48 234 252;
  2327. X     B 48 48 -108 204;
  2328. X     B 48 84 -12 186;
  2329. X     B 120 36 -48 126;
  2330. X     B 48 108 84 174;
  2331. X     B 60 48 198 204;
  2332. X     B 48 12 372 222;
  2333. X     B 72 36 360 198;
  2334. X     B 48 48 468 204;
  2335. X     B 48 12 576 222;
  2336. X     B 72 36 588 198;
  2337. X     B 36 84 -90 66;
  2338. X     B 48 48 -12 84;
  2339. X     B 36 96 90 72;
  2340. X     B 36 72 342 144;
  2341. X     B 36 12 474 174;
  2342. X     B 48 24 480 156;
  2343. X     B 216 36 252 90;
  2344. X     B 108 24 450 132;
  2345. X     B 96 24 444 108;
  2346. X     B 48 12 168 66;
  2347. X     B 36 24 342 60;
  2348. X     B 36 36 474 78;
  2349. X     B 60 48 -102 0;
  2350. X     B 144 36 36 6;
  2351. X     B 48 12 -12 -18;
  2352. X     B 48 12 84 -18;
  2353. X     B 48 48 204 0;
  2354. X     B 72 36 360 30;
  2355. X     B 60 36 486 42;
  2356. X     B 36 156 606 102;
  2357. X     B 48 36 372 -6;
  2358. X     B 48 48 504 0;
  2359. X     B 48 48 612 0;
  2360. X     B 108 48 234 -48;
  2361. X L CPG;
  2362. X     B 24 300 -60 102;
  2363. X     B 24 300 36 102;
  2364. X     B 24 120 132 168;
  2365. X     B 24 96 324 180;
  2366. X     B 48 12 420 138;
  2367. X     B 132 24 378 120;
  2368. X     B 24 144 528 180;
  2369. X     B 72 48 156 84;
  2370. X     B 24 84 132 18;
  2371. X     B 24 132 324 42;
  2372. X     B 48 12 420 102;
  2373. X     B 36 24 522 96;
  2374. X     B 24 24 516 72;
  2375. X     B 24 192 624 156;
  2376. X     B 84 24 486 48;
  2377. X     B 84 24 594 48;
  2378. X     B 24 84 456 -6;
  2379. X     B 24 84 564 -6;
  2380. X L CAA;
  2381. X     B 48 48 204 252;
  2382. X     B 48 24 -12 216;
  2383. X     B 48 24 84 216;
  2384. X     B 60 24 198 216;
  2385. X     B 48 24 372 216;
  2386. X     B 432 24 180 192;
  2387. X     B 48 24 468 216;
  2388. X     B 48 24 576 216;
  2389. X     B 156 24 522 192;
  2390. X     B 144 24 -60 12;
  2391. X     B 48 24 -108 -12;
  2392. X     B 48 24 -12 -12;
  2393. X     B 336 24 228 12;
  2394. X     B 48 24 84 -12;
  2395. X     B 48 72 204 -36;
  2396. X     B 48 24 372 -12;
  2397. X     B 156 24 558 12;
  2398. X     B 48 24 504 -12;
  2399. X     B 48 24 612 -12;
  2400. X L CVA;
  2401. X     B 24 24 264 252;
  2402. X     B 24 24 -108 204;
  2403. X     B 24 24 84 144;
  2404. X     B 24 24 480 144;
  2405. X     B 24 24 -12 84;
  2406. X     B 24 24 264 -48;
  2407. X L CCA;
  2408. X     B 24 24 -12 204;
  2409. X     B 24 24 84 204;
  2410. X     B 24 24 198 204;
  2411. X     B 24 24 372 204;
  2412. X     B 24 24 468 204;
  2413. X     B 24 24 576 204;
  2414. X     B 24 24 -108 0;
  2415. X     B 24 24 -12 0;
  2416. X     B 24 24 84 0;
  2417. X     B 24 24 204 0;
  2418. X     B 24 24 372 0;
  2419. X     B 24 24 504 0;
  2420. X     B 24 24 612 0;
  2421. X L CCA;
  2422. X     B 24 24 204 252;
  2423. X     B 24 24 204 -48;
  2424. X L CCP;
  2425. X     B 24 24 420 120;
  2426. X     B 24 24 168 84;
  2427. X L CSP;
  2428. X     B 240 24 60 240;
  2429. X     B 300 24 474 240;
  2430. X     B 684 72 282 192;
  2431. X     B 96 72 204 -60;
  2432. X 94 GND -120 -48 CMS;
  2433. X 94 phi1_bar 456 -48 CPG;
  2434. X 94 Vdd 468 276 CMS;
  2435. X 94 phi1 564 -48 CPG;
  2436. X 94 in 636 0;
  2437. X 94 Vdd 612 -72 CMS;
  2438. X 94 out -108 204 CMF;
  2439. X 94 i1 504 0;
  2440. X 94 i2 168 84;
  2441. X 94 phi2 -60 252 CPG;
  2442. X 94 phi2_bar 36 252 CPG;
  2443. X DF;
  2444. X C 1;
  2445. X End
  2446. SHAR_EOF
  2447. if test 3074 -ne "`wc -c < 'scmos-test.cif'`"
  2448. then
  2449.     echo shar: error transmitting "'scmos-test.cif'" '(should have been 3074 characters)'
  2450. fi
  2451. fi # end of overwriting check
  2452. #    End of shell archive
  2453. exit 0
  2454.  
  2455. Gordon W. Ross    gwr@gomez.mitre.org    (617) 271-3205 (daytime)
  2456. The MITRE Corp. (M/S E025)  Burlington Road, Bedford, MA 01730
  2457.  
  2458.