home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / compsrcs / misc / volume04 / cif2ps < prev    next >
Encoding:
Internet Message Format  |  1991-08-27  |  53.5 KB

  1. From mipos3!intelca!oliveb!ames!necntc!ncoast!allbery Tue Sep 20 18:26:25 PDT 1988
  2. Article 537 of comp.sources.misc:
  3. Path: td2cad!mipos3!intelca!oliveb!ames!necntc!ncoast!allbery
  4. From: system@noao.UUCP (Marc Lesure)
  5. Newsgroups: comp.sources.misc
  6. Subject: v04i081: cif2ps - CIF to Postscript
  7. Keywords: CIF postscript
  8. Message-ID: <353@asuvax.UUCP>
  9. Date: 20 Sep 88 01:08:52 GMT
  10. Sender: allbery@ncoast.UUCP
  11. Reply-To: system@noao.UUCP (Marc Lesure)
  12. Organization: Arizona State Univ, Tempe
  13. Lines: 2638
  14. Approved: allbery@ncoast.UUCP
  15.  
  16. Posting-number: Volume 4, Issue 81
  17. Submitted-by: "Marc Lesure" <system@noao.UUCP>
  18. Archive-name: cif2ps
  19.  
  20. Here is `cif2ps`, the CIF to Postscript program.  We use this program in
  21. place of `cifplot`.
  22.  
  23. -----------------------------------------------------------------------
  24. Marc Lesure / Arizona State University / Tempe, AZ
  25. "Between the world of men and make-believe, I can be found..."
  26. "False faces and meaningless chases, I travel alone..."
  27. "And where do you go when you come to the end of your dream?"
  28.  
  29. UUCP:                ...!ncar!noao!asuvax!lesure  
  30. Internet/CSNET/ARPA: lesure@asuvax.asu.edu
  31.  
  32. #--------CUT---------CUT---------CUT---------CUT--------#
  33. #########################################################
  34. #                                                       #
  35. # This is a shell archive file.  To extract files:      #
  36. #                                                       #
  37. #    1)    Make a directory for the files.                 #
  38. #    2) Write a file, such as "file.shar", containing   #
  39. #       this archive file into the directory.           #
  40. #    3) Type "sh file.shar".  Do not use csh.           #
  41. #                                                       #
  42. #########################################################
  43. #
  44. #
  45. echo Extracting README:
  46. sed 's/^Z//' >README <<\STUNKYFLUFF
  47. ZThis code was orginally written by Arthur Simoneau, The Aerospace Corporation,
  48. ZEl Segundo, Calif. and was called 'cifp'.  'cifp' would only take MAGIC
  49. ZSCMOS cif input and generate postscript for a single page of output.
  50. Z
  51. ZI've since taken it and modified it to accept cmos-pw technology for our
  52. Zlocal needs at Arizona State University.  The biggest improvement I made
  53. Zwas to get multiple page output.  Each page is numbered with (x,y) coordinates
  54. Zso you know its proper sequence.  Also each page overlaps with its neighbor,
  55. Zso you can cut and paste if you want.  The program will rescale the
  56. Zuser-specific scale to avoid producing blank pages.  A scaling limit of 5
  57. Zby 5 has been put in the program to eliminate massive outputs.  Cif2ps can
  58. Zgenerate a postscript file in the multi-megabyte range very easily.
  59. ZI renamed the program to 'cif2ps' to be more descriptive of its function.
  60. Z
  61. ZTwo test files have been included, cmos-pw.test.cif and scmos.test.cif.
  62. ZThe file cmos-pw.test.cif was generated using the IGS2CIF program version
  63. Z2a.04 on a HP EGS Graphics system.  The file scmos.test.cif is from the
  64. Zoriginal 'cifp' distribution.  To plot this file you must use the '-T'
  65. Zoption on 'cif2ps'.
  66. Z
  67. ZCif2ps is now used here in place of cifplot from the Berkeley VSLI
  68. Zdistribution.
  69. Z
  70. ZSTANDARD DISCLAMER:
  71. Z-------------------
  72. ZThe authors and their organizations assume no responsibility for the use
  73. Zby the recipient of this program.
  74. Z
  75. ZMarc Lesure
  76. ZEngineering Computer Services
  77. ZArizona State Univerity
  78. Z
  79. STUNKYFLUFF
  80. set `sum README`
  81. if test 47634 != $1
  82. then
  83. echo README: Checksum error. Is: $1, should be: 47634.
  84. fi
  85. #
  86. #
  87. echo Extracting Readme.cifp:
  88. sed 's/^Z//' >Readme.cifp <<\STUNKYFLUFF
  89. ZThis is the original READ.ME file from the 'cifp' distribution.  I've 
  90. Zincluded it for completeness.  (ml)
  91. Z-------------------------------------------------------------------------------
  92. Z
  93. ZIf somebody wants to midify this code you should be aware that the
  94. Zorder of the "filled boxes" are important.  The last filled box wins all of
  95. Zthe pixels and so improper order can cause the p-well to obliterate all of
  96. Zthe CIF geometries.
  97. Z
  98. ZI will be maintaining this code and adding missing features as they become
  99. Zdesirable, so instead of re-inventing the wheel you should contact me before
  100. Zmakeing any changes to see if I have already done them.  Also, I would like to
  101. Zmaintain knowledge of where this code is so I would appreciate any new sites
  102. Zrequest the code from me rather than siphoning it from another site.
  103. Z
  104. ZI will gladly respond to any bug reports if a suitable example displaying the
  105. Zbug is sent to me.
  106. Z
  107. ZCheers,
  108. ZArthur Simoneau
  109. ZThe Aerospace Corporation
  110. ZEl Segundo, Calif
  111. Z
  112. Zart@aerospace
  113. STUNKYFLUFF
  114. set `sum Readme.cifp`
  115. if test 05164 != $1
  116. then
  117. echo Readme.cifp: Checksum error. Is: $1, should be: 05164.
  118. fi
  119. #
  120. #
  121. echo Extracting cif2ps.c:
  122. sed 's/^Z//' >cif2ps.c <<\STUNKYFLUFF
  123. Z/*
  124. Z    cif2ps is based on the program 'cifp' originally written by
  125. Z    Arthur Simoneau, The Aerospace Corporation, El Segundo, Calif
  126. Z
  127. Z    Changes to 'cifp' include support of cmos-pw layers, scaling
  128. Z    factors to spread output over several pages of 8.5 x 11 paper,
  129. Z    printing multiple layers.
  130. Z
  131. Z    Modified by Marc Lesure, Arizona State University, Tempe, AZ
  132. Z
  133. Z    Please honor the authors by not removing names from the source codes.
  134. Z*/
  135. Z#include <ctype.h>
  136. Z#include "define.h"
  137. Z
  138. Zint    maxwidth = 5;
  139. Zint    maxlength = 5;
  140. Z
  141. Zmain(argc, argv)
  142. Zint    argc;
  143. Zchar    *argv[];
  144. Z
  145. Z{
  146. Z    char *s,*cifname,*plotname;
  147. Z
  148. Z    length = width = 1;
  149. Z    totpages = 0;
  150. Z    size_font = false;
  151. Z    cmos_pw = 1;
  152. Z    while (argc-- > 1 && (*++argv)[0] == '-') {
  153. Z        s = argv[0] + 1;
  154. Z        switch (*s) {
  155. Z
  156. Z            case 'w':
  157. Z                width = atoi(*++argv);
  158. Z                argc--;
  159. Z                break;
  160. Z
  161. Z            case 'h':
  162. Z                length = atoi(*++argv);
  163. Z                argc--;
  164. Z                break;
  165. Z
  166. Z            case 's':
  167. Z                size_font = true;
  168. Z                break;
  169. Z
  170. Z            case 'T':
  171. Z                cmos_pw++;
  172. Z                break;
  173. Z
  174. Z            default:
  175. Z                printf("cif2ps: unknown flag - %s\n",*s);
  176. Z                exit(0);
  177. Z        }
  178. Z    }
  179. Z    if (argc != 2) {
  180. Z        printf("Usage: cif2ps [-w width] [-h height] input output\n");
  181. Z        exit(0);
  182. Z    }
  183. Z    cifname = *argv++;
  184. Z    if ((ciffile = fopen(cifname, "r")) == NULL)
  185. Z    {
  186. Z        fprintf(stderr, "can't open %s\n", cifname);
  187. Z        exit(1);
  188. Z    }
  189. Z    plotname = *argv;
  190. Z    if ((plotfile = fopen(plotname, "w")) == NULL)
  191. Z    {
  192. Z        fprintf(stderr, "can't open %s\n", plotname);
  193. Z        exit(1);
  194. Z    }
  195. Z    if (width <= 0) {
  196. Z        printf("-w exceeds lower limit - setting to 1\n");
  197. Z        width = 1;
  198. Z    }
  199. Z    if (length <= 0) {
  200. Z        printf("-l exceeds lower limit - setting to 1\n");
  201. Z        length = 1;
  202. Z    }
  203. Z    if (width > maxwidth) {
  204. Z        printf("-w exceeds upper limit - setting to %d\n",maxwidth);
  205. Z        width = maxwidth;
  206. Z    }
  207. Z    if (length > maxlength) {
  208. Z        printf("-l exceeds upper limit - setting to %d\n",maxlength);
  209. Z        length = maxlength;
  210. Z    }
  211. Z    init();
  212. Z    do_cif();
  213. Z    plotcif();
  214. Z    printf("Complete plot contains %d pages\n",totpages);
  215. Z#ifdef DEBUG
  216. Zoutput_all_symbols(stderr);
  217. Z#endif
  218. Z}    /*main*/
  219. Z
  220. Z
  221. Z
  222. Z#ifdef DEBUG
  223. Zoutput_all_symbols(filer)
  224. ZFILE    *filer;
  225. Z
  226. Z{
  227. Zint    i;
  228. Z
  229. Z    for (i = 0; i <= last_symbol; i++)
  230. Z        output_symboldef(filer, i);
  231. Z}    /*output_all_symbols*/
  232. Z#endif
  233. Z
  234. Z
  235. Zplotcif()
  236. Z{
  237. Zint    symbol_num, i, plotted_one;
  238. Zchar    namein[MAXNAME];
  239. Zpointpairtype    ll, ur;
  240. Z
  241. Z    plotted_one = 0;
  242. Z    FOREVER
  243. Z        {
  244. Z        if (ciffile == stdin)
  245. Z            symbol_num = 0;    /*top_level*/
  246. Z        else
  247. Z            {
  248. Z            FOREVER
  249. Z                {
  250. Z                fprintf(stderr, "What symbol do you want to plot?\n");
  251. Z                i = 0;
  252. Z                while ((namein[i] = getchar()) != '\n')
  253. Z                    {
  254. Z                    if (namein[i] == EOF)
  255. Z                        {
  256. Z                        if (( !plotted_one) &&
  257. Z                            (plotfile == stdout))
  258. Z                            {
  259. Z                            namein[0] = '0';
  260. Z                            i = 1;
  261. Z                            break;
  262. Z                            }
  263. Z                        else
  264. Z                            return;
  265. Z                        }
  266. Z                    i++;
  267. Z                    }
  268. Z                namein[i] = '\0';
  269. Z                if (i == 0)    /*terminate run*/
  270. Z                    return;
  271. Z
  272. Z                symbol_num = get_index_char(namein);
  273. Z                if (symbol_num != -1)
  274. Z                    break;
  275. Z
  276. Z                fprintf(stderr, "couldn't find that symbol\n");
  277. Z                output_all_symbolnums(stderr);
  278. Z                }    /*FOREVER*/
  279. Z            }
  280. Z
  281. Z        plotted_one++;
  282. Z        ll.x = BIGINT;
  283. Z        ur.x = -BIGINT;
  284. Z        ll.y = BIGINT;
  285. Z        ur.y = -BIGINT;
  286. Z        get_bounds(symbol_num, &ll, &ur);
  287. Z        if ((ll.x == BIGINT) || (ll.y == BIGINT))
  288. Z            {
  289. Z            fprintf(stderr, "Error in bounds %d %d and %d %d\n",
  290. Z                        ll.x, ll.y, ur.x, ur.y);
  291. Z            return;
  292. Z            }
  293. Z
  294. Z        if (plotted_one == 1) {
  295. Z            get_window(&ll, &ur);
  296. Z            init_cif();
  297. Z        }
  298. Z        prolog();
  299. Z        for(pagey=0; pagey < length; pagey++)
  300. Z            for(pagex=0; pagex < width; pagex++) {
  301. Z                prelog();
  302. Z                plot_boxes(symbol_table[symbol_num].pointer);
  303. Z                plot_textes(symbol_table[symbol_num].pointer);
  304. Z                epilog();
  305. Z            }
  306. Z        if (ciffile == stdin)
  307. Z            return;
  308. Z        }    /*FOREVER*/
  309. Z}    /*plotcif*/
  310. Z
  311. Z
  312. Z    int
  313. Zget_index_char(foobar)
  314. Zchar    *foobar;
  315. Z
  316. Z{
  317. Zint    i, bar;
  318. Z
  319. Z    for(i = 0; i <= last_symbol; i++)
  320. Z        {
  321. Z        if (equal_strings(symbol_table[i].name, foobar))
  322. Z            return(i);
  323. Z        }
  324. Z
  325. Z    for(i = 0; i < MAXNAME; i++)
  326. Z        {
  327. Z        if (foobar[i] == '\0')
  328. Z            {
  329. Z            (void) sscanf(foobar, "%d", &bar);
  330. Z            return(get_index(bar));
  331. Z            }
  332. Z        else if ( !isdigit(foobar[i]))
  333. Z            return(-1);
  334. Z        }
  335. Z
  336. Z    return(-1);
  337. Z}    /*get_index_char*/
  338. Z
  339. Z
  340. Z
  341. Zget_window(ll, ur)
  342. Zpointpairtype    *ll, *ur;
  343. Z
  344. Z{
  345. Zfloat    scalex, scaley;
  346. Zfloat   deltax, deltay;
  347. Zint    newlength, newwidth;
  348. Z
  349. Z    trans_x = - ll->x;
  350. Z    trans_y = - ll->y;
  351. Z
  352. Z    scalex = (width * PAGEWIDTH) /  (deltax = (ur->x - ll->x));
  353. Z    scaley = (length * PAGELENGTH) / (deltay = (ur->y - ll->y));
  354. Z    if (scalex < scaley)
  355. Z        {
  356. Z        scale = scalex;
  357. Z        scale2 = 1.0/deltax;
  358. Z        scale2y = deltay/deltax;
  359. Z        scale2x = 1.0;
  360. Z        newlength = ((deltay * scale) / PAGELENGTH) + 1;
  361. Z        if (newlength != length) {
  362. Z            printf("output size changed to %d by %d\n",
  363. Z                width,newlength);
  364. Z            length = newlength;
  365. Z        }
  366. Z        }
  367. Z    else
  368. Z        {
  369. Z        scale = scaley; 
  370. Z        scale2 = 1.0/deltay;
  371. Z        scale2y = 1.0;
  372. Z        scale2x = deltax/deltay;
  373. Z        newwidth = ((deltax * scale) / PAGEWIDTH) + 1;
  374. Z        if (newwidth != width) {
  375. Z            printf("output size changed to %d by %d\n",
  376. Z                newwidth,length);
  377. Z            width = newwidth;
  378. Z        }
  379. Z        }
  380. Z#ifdef DEBUG
  381. Zfprintf(stderr, "scale %f, scalex %f, scaley %f, deltax %f, deltay %f\n",
  382. Z    scale, scalex, scaley, deltax, deltay);
  383. Z#endif
  384. Z}    /*get_window*/
  385. Z
  386. Z
  387. Z
  388. Zplot_boxes(symbol)
  389. Zsymboltype    *symbol;
  390. Z
  391. Z{
  392. Zint    i, num_clip, plot_boxes_sub();
  393. Z
  394. Z    num_clip = 0;
  395. Z    for (i = 1; i < numlayers; i++)
  396. Z        {
  397. Z        plot_change_layer(i);
  398. Z        num_clip = 0;
  399. Z        num_clip = plot_boxes_sub(symbol, num_clip);
  400. Z        }    /*for loop*/
  401. Z    plot_change_layer(0);
  402. Z}    /*plot_boxes*/
  403. Z
  404. Z
  405. Z
  406. Z
  407. Z    int
  408. Zplot_boxes_sub(symbol, num_clip)
  409. Zsymboltype    *symbol;
  410. Zint    num_clip;
  411. Z
  412. Z{
  413. Zboxtype        *box;
  414. Zfloat    temp_matrix[3][3];
  415. Z
  416. Z    while(symbol != NULL)
  417. Z        {
  418. Z        switch(symbol->typer)
  419. Z            {
  420. Z        case BOXTYPE:
  421. Z            box = symbol->primitive.box;
  422. Z            if (box->layer == layer)
  423. Z                {
  424. Z                plot_box(box);
  425. Z                if (clip[layer] && (++num_clip > 50))
  426. Z                    {
  427. Z                    num_clip = 0;
  428. Z                    start_clipping();
  429. Z                    }
  430. Z                }
  431. Z            break;
  432. Z        case CALLTYPE:
  433. Z            copy_matrix(matrix, temp_matrix);
  434. Z            hit_matrix(matrix,
  435. Z                symbol->primitive.call->matrix, matrix);
  436. Z            num_clip = plot_boxes_sub(
  437. Z                symbol_table[symbol->primitive.call->symbol].pointer, num_clip);
  438. Z
  439. Z            copy_matrix(temp_matrix, matrix);
  440. Z            break;
  441. Z        case DSTYPE:
  442. Z        case NINETY_FOURTYPE:
  443. Z            break;
  444. Z        default:
  445. Z            fprintf(stderr, "ERROR Not known %d in plot boxes\n",
  446. Z                            symbol->typer);
  447. Z            break;
  448. Z            }
  449. Z
  450. Z        symbol = symbol->next;
  451. Z        }
  452. Z
  453. Z    return(num_clip);
  454. Z}    /*plot_boxes_sub*/
  455. Z
  456. Z
  457. Z
  458. Zplot_textes(symbol)
  459. Zsymboltype    *symbol;
  460. Z
  461. Z{
  462. Zninety_fourtype        *ninety_four;
  463. Z
  464. Z    start_text();
  465. Z    while(symbol != NULL)
  466. Z        {
  467. Z        switch(symbol->typer)
  468. Z            {
  469. Z        case CALLTYPE:
  470. Z        case DSTYPE:
  471. Z        case BOXTYPE:
  472. Z            break;
  473. Z        case NINETY_FOURTYPE:
  474. Z            ninety_four = symbol->primitive.ninety_four;
  475. Z            plot_text(ninety_four);
  476. Z            break;
  477. Z        default:
  478. Z            fprintf(stderr, "ERROR Not known %d in plot text\n",
  479. Z                            symbol->typer);
  480. Z            break;
  481. Z            }
  482. Z
  483. Z        symbol = symbol->next;
  484. Z        }
  485. Z}    /*plot_textes*/
  486. Z
  487. Z
  488. Z
  489. Zget_bounds(sym, ll, ur)
  490. Zint    sym;
  491. Zpointpairtype    *ll, *ur;
  492. Z
  493. Z{
  494. Zint        local_sym;
  495. Zsymboltype    *symbol;
  496. Zboxtype        *box;
  497. Zpointpairtype    local_ll, local_ur;
  498. Z
  499. Z    symbol = symbol_table[sym].pointer;
  500. Z    while(symbol != NULL)
  501. Z        {
  502. Z        switch(symbol->typer)
  503. Z            {
  504. Z        case DSTYPE:
  505. Z        case NINETY_FOURTYPE:
  506. Z            break;
  507. Z        case BOXTYPE:
  508. Z            box = symbol->primitive.box;
  509. Z            if (box->loc[0] < ll->x)
  510. Z                ll->x = box->loc[0];
  511. Z            if (box->loc[2] > ur->x)
  512. Z                ur->x = box->loc[2];
  513. Z            if (box->loc[1] < ll->y)
  514. Z                ll->y = box->loc[1];
  515. Z            if (box->loc[3] > ur->y)
  516. Z                ur->y = box->loc[3];
  517. Z            break;
  518. Z        case CALLTYPE:
  519. Z            local_sym = symbol->primitive.call->symbol;
  520. Z            if (symbol_table[local_sym].ll.x == BIGINT)
  521. Z                {
  522. Z                get_bounds(local_sym,
  523. Z                    &(symbol_table[local_sym].ll),
  524. Z                    &(symbol_table[local_sym].ur));
  525. Z                }
  526. Z            copy_matrix(symbol->primitive.call->matrix, matrix);
  527. Z            get_pair(symbol_table[local_sym].ll.x,
  528. Z                symbol_table[local_sym].ll.y, &local_ll);
  529. Z            get_pair(symbol_table[local_sym].ur.x,
  530. Z                symbol_table[local_sym].ur.y, &local_ur);
  531. Z
  532. Z            identity_matrix(matrix);
  533. Z            if (local_ll.x < ll->x)
  534. Z                ll->x = local_ll.x;
  535. Z            if (local_ur.x < ll->x)
  536. Z                ll->x = local_ur.x;
  537. Z            if (local_ll.x > ur->x)
  538. Z                ur->x = local_ll.x;
  539. Z            if (local_ur.x > ur->x)
  540. Z                ur->x = local_ur.x;
  541. Z            if (local_ll.y < ll->y)
  542. Z                ll->y = local_ll.y;
  543. Z            if (local_ur.y < ll->y)
  544. Z                ll->y = local_ur.y;
  545. Z            if (local_ll.y > ur->y)
  546. Z                ur->y = local_ll.y;
  547. Z            if (local_ur.y > ur->y)
  548. Z                ur->y = local_ur.y;
  549. Z            break;
  550. Z        default:
  551. Z            fprintf(stderr, "ERROR Not known %d in get_bounds\n",
  552. Z                            symbol->typer);
  553. Z            break;
  554. Z            }
  555. Z
  556. Z        symbol = symbol->next;
  557. Z        }
  558. Z}    /*get_bounds*/
  559. Z
  560. Z
  561. Zget_pair(x, y, pair)
  562. Zint    x, y;
  563. Zpointpairtype    *pair;
  564. Z
  565. Z{
  566. Z    pair->x = (x * matrix[0][0]) + (y * matrix[0][1]) + matrix[0][2];
  567. Z    pair->y = (x * matrix[1][0]) + (y * matrix[1][1]) + matrix[1][2];
  568. Z}    /*get_pair*/
  569. Z
  570. Z
  571. Z
  572. Zcall_symbol(cif)
  573. Zchar    *cif;
  574. Z
  575. Z{
  576. Zint    last_read, callnum;
  577. Zchar    token[MAXNAME];
  578. Zchar    ciftemp[MAXLINE];
  579. Zint    rotate_x, rotate_y;
  580. Zfloat    multi_matrix[3][3];
  581. Zfloat    temp_a_over_b, translate_x, translate_y;
  582. Zcalltype    *call, *alloccall();
  583. Z
  584. Z    bang_symbol();
  585. Z    present_symbol->typer = CALLTYPE;
  586. Z    call = alloccall();
  587. Z    present_symbol->primitive.call = call;
  588. Z
  589. Z    last_read = get_token(cif, 2, token);
  590. Z    if (last_read == -1)
  591. Z        {
  592. Z        fprintf(stderr, "no symbol in CALL\n");
  593. Z        output_cif(stderr, cif);
  594. Z        return;
  595. Z        }
  596. Z    (void) sscanf(token, "%d", &callnum);
  597. Z    call->symbol = get_index(callnum);
  598. Z    if (call->symbol == -1)
  599. Z        {
  600. Z        sprintf(ciftemp, "DS %d", callnum);
  601. Z        temp_a_over_b = a_over_b;
  602. Z        ds(ciftemp, CALLTYPE);
  603. Z        a_over_b = temp_a_over_b;
  604. Z
  605. Z        call->symbol = get_index(callnum);
  606. Z        if (call->symbol == -1)
  607. Z            {
  608. Z            fprintf(stderr, "Error in call cif\n");
  609. Z            output_cif(stderr, cif);
  610. Z            }
  611. Z        }
  612. Z
  613. Z    identity_matrix(multi_matrix);
  614. Z    FOREVER
  615. Z        {
  616. Z        last_read = get_token(cif, last_read, token);
  617. Z        if (last_read == -1) break;
  618. Z
  619. Z        if (token[0] == 'M')
  620. Z            {
  621. Z            switch(token[1])
  622. Z                {
  623. Z            case 'X':
  624. Z                multi_matrix[0][0] = -1;
  625. Z                hit_matrix(multi_matrix, call->matrix,
  626. Z                                call->matrix);
  627. Z                multi_matrix[0][0] = 1;
  628. Z                break;
  629. Z            case 'Y':
  630. Z                multi_matrix[1][1] = -1;
  631. Z                hit_matrix(multi_matrix, call->matrix,
  632. Z                                call->matrix);
  633. Z                multi_matrix[1][1] = 1;
  634. Z                break;
  635. Z            default:
  636. Z                fprintf(stderr, "Error in mirror %c\n", token[1]);
  637. Z                output_cif(stderr, cif);
  638. Z                break;
  639. Z                }    /*switch mirror*/
  640. Z            }    /*if mirror*/
  641. Z        else if (token[0] == 'R')
  642. Z            {
  643. Z            last_read = get_token(cif, last_read, token);
  644. Z            if (last_read == -1)
  645. Z                {
  646. Z                fprintf(stderr, "error in rotate\n");
  647. Z                output_cif(stderr, cif);
  648. Z                break;
  649. Z                }
  650. Z            (void) sscanf(token, "%d", &rotate_x);
  651. Z            rotate_x = sign(rotate_x);
  652. Z            last_read = get_token(cif, last_read, token);
  653. Z            if (last_read == -1)
  654. Z                {
  655. Z                fprintf(stderr, "error2 in rotate\n");
  656. Z                output_cif(stderr, cif);
  657. Z                break;
  658. Z                }
  659. Z            (void) sscanf(token, "%d", &rotate_y);
  660. Z            rotate_y = sign(rotate_y);
  661. Z            switch(rotate_x)
  662. Z                {
  663. Z            case 1:
  664. Z                if (rotate_y != 0)
  665. Z                    fprintf(stderr, "Bad rotation x %d y %d\n",
  666. Z                            rotate_x, rotate_y);
  667. Z                break;
  668. Z            case -1:
  669. Z                if (rotate_y != 0)
  670. Z                    {
  671. Z                    fprintf(stderr, "Bad rotation x %d y %d\n",
  672. Z                            rotate_x, rotate_y);
  673. Z                    break;
  674. Z                    }
  675. Z                multi_matrix[0][0] = -1;
  676. Z                multi_matrix[1][1] = -1;
  677. Z                hit_matrix(multi_matrix, call->matrix, call->matrix);
  678. Z                identity_matrix(multi_matrix);
  679. Z                break;
  680. Z            case 0:
  681. Z                switch(rotate_y)
  682. Z                    {
  683. Z                case 1:
  684. Z                    multi_matrix[0][0] = 0;
  685. Z                    multi_matrix[1][1] = 0;
  686. Z                    multi_matrix[0][1] = -1;
  687. Z                    multi_matrix[1][0] = 1;
  688. Z                    hit_matrix(multi_matrix, call->matrix,
  689. Z                                call->matrix);
  690. Z                    identity_matrix(multi_matrix);
  691. Z                    break;
  692. Z                case -1:
  693. Z                    multi_matrix[0][0] = 0;
  694. Z                    multi_matrix[1][1] = 0;
  695. Z                    multi_matrix[0][1] = 1;
  696. Z                    multi_matrix[1][0] = -1;
  697. Z                    hit_matrix(multi_matrix, call->matrix,
  698. Z                                call->matrix);
  699. Z                    identity_matrix(multi_matrix);
  700. Z                    break;
  701. Z                default:
  702. Z                    fprintf(stderr, "Bad rotation x %d y %d\n",
  703. Z                            rotate_x, rotate_y);
  704. Z                    break;
  705. Z                    }    /*switch y*/
  706. Z                break;
  707. Z            default:
  708. Z                fprintf(stderr, "Bad rotation x %d y %d\n",
  709. Z                            rotate_x, rotate_y);
  710. Z                break;
  711. Z                }    /*switch rotation*/
  712. Z            }    /*if rotate*/
  713. Z        else if (token[0] == 'T')
  714. Z            {
  715. Z            last_read = get_token(cif, last_read, token);
  716. Z            if (last_read == -1)
  717. Z                {
  718. Z                fprintf(stderr, "error in translate\n");
  719. Z                output_cif(stderr, cif);
  720. Z                break;
  721. Z                }
  722. Z            (void) sscanf(token, "%f", &translate_x);
  723. Z            translate_x *= a_over_b;
  724. Z
  725. Z            last_read = get_token(cif, last_read, token);
  726. Z            if (last_read == -1)
  727. Z                {
  728. Z                fprintf(stderr, "error2 in translate\n");
  729. Z                output_cif(stderr, cif);
  730. Z                break;
  731. Z                }
  732. Z            (void) sscanf(token, "%f", &translate_y);
  733. Z            translate_y *= a_over_b;
  734. Z
  735. Z            if ((translate_x != 0) || (translate_y != 0))
  736. Z                {
  737. Z                multi_matrix[0][2] = translate_x;
  738. Z                multi_matrix[1][2] = translate_y;
  739. Z                hit_matrix(multi_matrix, call->matrix, call->matrix);
  740. Z                identity_matrix(multi_matrix);
  741. Z                }
  742. Z            }    /*if translate*/
  743. Z        else
  744. Z            {
  745. Z            fprintf(stderr, "error---out of calls\n");
  746. Z            output_cif(stderr, cif);
  747. Z            fprintf(stderr, "\ttoken %s\n", token);
  748. Z            break;
  749. Z            }
  750. Z        }    /*FOREVER*/
  751. Z
  752. Z}    /*call_symbol*/
  753. Z
  754. Zsign(x)
  755. Zint x;
  756. Z{
  757. Z    int z;
  758. Z
  759. Z    z = 0;
  760. Z    if (x > 0) z = 1;
  761. Z    if (x < 0) z = -1;
  762. Z    return(z);
  763. Z}
  764. Z
  765. Z
  766. Z#ifdef DEBUG
  767. Zoutput_matrix(filer, matrix)
  768. ZFILE    *filer;
  769. Zfloat    matrix[3][3];
  770. Z
  771. Z{
  772. Zint    i, j;
  773. Z
  774. Z    for(i = 0; i < 3; i++)
  775. Z        {
  776. Z        fprintf(filer, "[");
  777. Z        for(j = 0; j < 3; j++)
  778. Z            fprintf(filer, "\t%f", matrix[i][j]);
  779. Z        fprintf(filer, "]\n");
  780. Z        }
  781. Z}    /*output_matrix*/
  782. Z#endif
  783. Z
  784. Z
  785. Zidentity_matrix(matrix)
  786. Zfloat    matrix[3][3];
  787. Z
  788. Z{
  789. Z    matrix[0][0] = 1;
  790. Z    matrix[0][1] = 0;
  791. Z    matrix[0][2] = 0;
  792. Z    matrix[1][0] = 0;
  793. Z    matrix[1][1] = 1;
  794. Z    matrix[1][2] = 0;
  795. Z    matrix[2][0] = 0;
  796. Z    matrix[2][1] = 0;
  797. Z    matrix[2][2] = 1;
  798. Z}    /*identity_matrix*/
  799. Z
  800. Z
  801. Z
  802. Zhit_matrix(left_matrix, right_matrix, to_matrix)
  803. Zfloat    left_matrix[3][3], right_matrix[3][3], to_matrix[3][3];
  804. Z
  805. Z{
  806. Zint    i, j;
  807. Zfloat    temp[3][3];
  808. Z
  809. Z    for(i = 0; i < 3; i++)
  810. Z        {
  811. Z        for(j = 0; j < 3; j++)
  812. Z            temp[i][j] = (left_matrix[i][0] * right_matrix[0][j]) +
  813. Z                    (left_matrix[i][1] * right_matrix[1][j]) +
  814. Z                    (left_matrix[i][2] * right_matrix[2][j]);
  815. Z        }
  816. Z
  817. Z    copy_matrix(temp, to_matrix);
  818. Z}    /*hit_matrix*/
  819. Z
  820. Z
  821. Z
  822. Zcopy_matrix(from_matrix, to_matrix)
  823. Zfloat    from_matrix[3][3], to_matrix[3][3];
  824. Z
  825. Z{
  826. Zint    i, j;
  827. Z
  828. Z    for(i = 0; i < 3; i++)
  829. Z        {
  830. Z        for(j = 0; j < 3; j++)
  831. Z            to_matrix[i][j] = from_matrix[i][j];
  832. Z        }
  833. Z}    /*copy_matrix*/
  834. STUNKYFLUFF
  835. set `sum cif2ps.c`
  836. if test 16103 != $1
  837. then
  838. echo cif2ps.c: Checksum error. Is: $1, should be: 16103.
  839. fi
  840. #
  841. #
  842. echo Extracting cif2ps.man:
  843. sed 's/^Z//' >cif2ps.man <<\STUNKYFLUFF
  844. Z.TH CIF2PS LOCAL "15 May 1988"
  845. Z.UC 4
  846. Z.SH NAME
  847. ZCif2ps \- CIF to postscript output
  848. Z.SH SYNOPSIS
  849. Z.B cif2ps
  850. Z[-w width] [-h height] [-T] input.cif output.ps
  851. Z.br
  852. Z.SH DESCRIPTION
  853. Z.I Cif2ps
  854. Ztakes a CIF file that has been produced by Magic or EGS graphics editor
  855. Zand creates a file that can
  856. Zbe sent to the plotter of choice. The code was written with the CIF layer 
  857. Znames hard coded in. This means that this code will only work with cmos-pw
  858. Zor MOSIS's SCMOS designs.
  859. Z.PP
  860. Z.I Cif2ps
  861. Zoptions are :
  862. Z.TP
  863. Z.B \-w
  864. Zspecify width of plot (in pages, default is 1)
  865. Z.TP
  866. Z.B \-h
  867. Zspecify height of plot (in pages, default is 1)
  868. Z.PP
  869. Z.I Cif2ps
  870. Zwill rescale a user-specific dimension if neccesary to avoid
  871. Zproducing blank pages.  The largest dimesion allowed is 5 pages by 5 pages
  872. Z(25 pages of output).
  873. Z.TP
  874. Z.B \-T
  875. Zuse SCMOS design rules (default is cmos-pw)
  876. Z.SH "SEE ALSO"
  877. Zmagic
  878. Z.SH AUTHOR
  879. ZArthur Simoneau wrote the version 'cifp'.
  880. ZMarc Lesure modified 'cifp' to produce 'cif2ps'.
  881. Z.SH FILES
  882. Zinput.cif and output.ps
  883. Z.SH BUGS
  884. Z.I Cif2ps
  885. Zshould be technology independent, but at least all of the technology
  886. Zdependence is in one file.
  887. STUNKYFLUFF
  888. set `sum cif2ps.man`
  889. if test 17538 != $1
  890. then
  891. echo cif2ps.man: Checksum error. Is: $1, should be: 17538.
  892. fi
  893. #
  894. #
  895. echo Extracting cifgood.c:
  896. sed 's/^Z//' >cifgood.c <<\STUNKYFLUFF
  897. Z/*
  898. Z    cif2ps is based on the program 'cifp' originally written by
  899. Z    Arthur Simoneau, The Aerospace Corporation, El Segundo, Calif
  900. Z
  901. Z    Changes to 'cifp' include support of cmos-pw layers, scaling
  902. Z    factors to spread output over several pages of 8.5 x 11 paper,
  903. Z    printing multiple layers.
  904. Z
  905. Z    Modified by Marc Lesure, Arizona State University, Tempe, AZ
  906. Z
  907. Z    Please honor the authors by not removing names from the source codes.
  908. Z*/
  909. Z#include "define.h"
  910. Z
  911. Z#define DELTA_A    'a' - 'A'
  912. Z
  913. Zchar    *malloc();
  914. Z
  915. Zinit_cif()
  916. Z{
  917. Z    layer = 0;
  918. Z}    /*init_cif*/
  919. Z
  920. Z
  921. Zget_next_cifline(stringer)
  922. Zchar    *stringer;
  923. Z
  924. Z{
  925. Zint    i;
  926. Zchar    c;
  927. Z
  928. Z    for(i = 0; i < MAXLINE; i++)
  929. Z        {
  930. Z        c = fgetc(ciffile);
  931. Z        if (c == ';')
  932. Z            {
  933. Z            stringer[i] = '\0';
  934. Z            return(i);
  935. Z            }
  936. Z        else if (c == '\n')
  937. Z            {
  938. Z            stringer[i] = ' ';
  939. Z            no_lines++;
  940. Z            }
  941. Z        else if (c == EOF)
  942. Z            {
  943. Z            stringer[i] = '\0';
  944. Z            return(EOF);
  945. Z            }
  946. Z        else if (c == '(')
  947. Z            {
  948. Z            while (fgetc(ciffile) != ')') ;
  949. Z            }
  950. Z        else
  951. Z            stringer[i] = c;
  952. Z        }
  953. Z
  954. Z    fprintf(stderr, "Cifline exceeded bounds\n");
  955. Z    stringer[i] = '\0';
  956. Z    output_cif(stderr, stringer);
  957. Z    exit(1);
  958. Z}    /*get_next_cifline*/
  959. Z
  960. Z
  961. Z
  962. Zoutput_cif(filer, cif)
  963. ZFILE    *filer;
  964. Zchar    *cif;
  965. Z
  966. Z{
  967. Z    fprintf(filer, "%s\t\t(*near line %d*)\n", cif, no_lines);
  968. Z}    /*output_cif*/
  969. Z
  970. Z
  971. Ztrim_cif(cif)
  972. Zchar    *cif;
  973. Z
  974. Z{
  975. Zint    i, j, toggle_white;
  976. Z
  977. Z    i = 0;
  978. Z    j = 0;
  979. Z    toggle_white = 1;        /*so no white at beginning*/
  980. Z    for (i = 0; i < MAXLINE; i++)
  981. Z        {
  982. Z        if (cif[i] == COMMA)
  983. Z            {
  984. Z                cif[i] = WHITE;
  985. Z            }
  986. Z        if (cif[i] == '\0')
  987. Z            {
  988. Z            cif[j] = '\0';
  989. Z            return;
  990. Z            }
  991. Z        else if (white(cif[i]))
  992. Z            {
  993. Z            if ( !toggle_white)    /*makes one white space*/
  994. Z                {
  995. Z                cif[j++] = ' ';
  996. Z                toggle_white = 1;
  997. Z                }
  998. Z            }
  999. Z        else
  1000. Z            {
  1001. Z            cif[j++] = cif[i];
  1002. Z            if (toggle_white) toggle_white = 0;
  1003. Z            }
  1004. Z        }    /*for*/
  1005. Z}    /*trim_cif*/
  1006. Z
  1007. Z
  1008. Zwhite(chr)
  1009. Zchar    chr;
  1010. Z
  1011. Z{
  1012. Z    switch(chr)
  1013. Z        {
  1014. Z    case ' ':
  1015. Z    case '\t':
  1016. Z        return(1);
  1017. Z    default:
  1018. Z        return(0);
  1019. Z        }
  1020. Z}    /*white*/
  1021. Z
  1022. Z
  1023. Z#ifdef DEBUG
  1024. Zoutput_symbol(filer, sym)
  1025. ZFILE    *filer;
  1026. Zint    sym;
  1027. Z
  1028. Z{
  1029. Z    fprintf(filer, "For symbol index %d\n", sym);
  1030. Z    fprintf(filer, "\tsymbol %d", symbol_table[sym].symbol);
  1031. Z    fprintf(filer, "\t(%s)", symbol_table[sym].name);
  1032. Z    fprintf(filer, "\ta %d\tb %d\n", symbol_table[sym].a, symbol_table[sym].b);
  1033. Z    fprintf(filer, "\tll %d, %d ur %d, %d\n",
  1034. Z            symbol_table[sym].ll.x, symbol_table[sym].ll.y,
  1035. Z            symbol_table[sym].ur.x,symbol_table[sym].ur.y);
  1036. Z}    /*output_symbol*/
  1037. Z#endif
  1038. Z
  1039. Z
  1040. Zequal_strings(s1, s2)
  1041. Zchar    *s1, *s2;
  1042. Z
  1043. Z{
  1044. Zint    temp;
  1045. Z
  1046. Z    while( (((temp = (*s1 - *s2)) == 0) || (abs(temp) == DELTA_A))
  1047. Z       && (*s1 != '\0') && (*s2 != '\0'))
  1048. Z        {
  1049. Z        *s1++;    *s2++;
  1050. Z        }
  1051. Z
  1052. Z    if (*s1 == *s2)            /*and therefore = '\0'*/
  1053. Z        return(1);
  1054. Z    else
  1055. Z        return(0);
  1056. Z}    /*equal_strings*/
  1057. Z
  1058. Z
  1059. Z
  1060. Z
  1061. Z    symboltype
  1062. Z*allocsymbol()
  1063. Z{
  1064. Zunsigned    size = sizeof(symboltype);
  1065. Zsymboltype    *symbol;
  1066. Z
  1067. Z    symbol =(symboltype *) malloc(size);
  1068. Z    symbol->typer = 0;
  1069. Z    symbol->primitive.box = NULL;
  1070. Z    symbol->next = NULL;
  1071. Z
  1072. Z    return(symbol);
  1073. Z}    /*allocsymbol*/
  1074. Z
  1075. Z
  1076. Z    boxtype
  1077. Z*allocbox()
  1078. Z{
  1079. Zunsigned    size = sizeof(boxtype);
  1080. Zboxtype    *box;
  1081. Zint    i;
  1082. Z
  1083. Z    box =(boxtype *) malloc(size);
  1084. Z    box->layer = 0;
  1085. Z    for(i = 0; i < 4; i++)
  1086. Z        box->loc[i] = 0;
  1087. Z
  1088. Z    return(box);
  1089. Z}    /*allocbox*/
  1090. Z
  1091. Z
  1092. Z
  1093. Z    int
  1094. Zget_index(num)
  1095. Zint    num;
  1096. Z
  1097. Z{
  1098. Zint    i;
  1099. Z
  1100. Z    for(i = 0; i <= last_symbol; i++)
  1101. Z        {
  1102. Z        if (symbol_table[i].symbol == num) return(i);
  1103. Z        }
  1104. Z
  1105. Z    return(-1);
  1106. Z}    /*get_index*/
  1107. Z
  1108. Z
  1109. Z
  1110. Zoutput_all_symbolnums(filer)
  1111. ZFILE    *filer;
  1112. Z
  1113. Z{
  1114. Zint    i;
  1115. Z
  1116. Z    fprintf(filer, "Symbols are:\n");
  1117. Z    for(i = 0; i <= last_symbol; i++)
  1118. Z        fprintf(filer, "%d\t%s\n", symbol_table[i].symbol,
  1119. Z                            symbol_table[i].name);
  1120. Z}    /*output_all_symbolnums*/
  1121. Z
  1122. Z
  1123. Z
  1124. Zdo_cif()
  1125. Z{
  1126. Zchar    cif[MAXLINE];
  1127. Z
  1128. Z    while(get_next_cifline(cif) != EOF)
  1129. Z        {
  1130. Z#ifdef DEBUG
  1131. Z    fprintf(stderr,"trim before %d\n",cif[0]);
  1132. Z#endif
  1133. Z        trim_cif(cif);
  1134. Z#ifdef DEBUG
  1135. Z    fprintf(stderr,"trim after %d\n",cif[0]);
  1136. Z#endif
  1137. Z
  1138. Z        switch(cif[0])
  1139. Z            {
  1140. Z        case 'D':
  1141. Z            switch(cif[1])
  1142. Z                {
  1143. Z               case 'S':
  1144. Z                ds(cif, DSTYPE);
  1145. Z                break;
  1146. Z               case 'F':
  1147. Z                df();
  1148. Z                break;
  1149. Z               default:
  1150. Z                fprintf(stderr, "Unknown command in CIF\n");
  1151. Z                output_cif(stderr, cif);
  1152. Z                break;
  1153. Z                }    /*switch(cif[1]*/
  1154. Z            break;
  1155. Z        case '9':
  1156. Z            switch(cif[1])
  1157. Z                {
  1158. Z               case WHITE:
  1159. Z                nine(cif);
  1160. Z                break;
  1161. Z               case '4':
  1162. Z                ninety_four(cif);
  1163. Z                break;
  1164. Z               default:
  1165. Z                fprintf(stderr, "Unknown command in CIF\n");
  1166. Z                output_cif(stderr, cif);
  1167. Z                break;
  1168. Z                }    /*switchcif[1]*/
  1169. Z            break;
  1170. Z        case 'B':
  1171. Z            box_cif(cif);
  1172. Z            break;
  1173. Z        case 'L':
  1174. Z            cif_change_layer(cif);
  1175. Z            break;
  1176. Z        case 'C':
  1177. Z            call_symbol(cif);
  1178. Z            break;
  1179. Z        case 0:
  1180. Z            break;
  1181. Z        default:
  1182. Z            fprintf(stderr, "Warning the following wasn't understood...ignoring\n");
  1183. Z            output_cif(stderr, cif);
  1184. Z            break;
  1185. Z            }    /*switch*/
  1186. Z        }
  1187. Z}    /*do_cif*/
  1188. Z
  1189. Z
  1190. Zds(cif, typer)
  1191. Zchar    *cif;
  1192. Zint    typer;
  1193. Z
  1194. Z{
  1195. Zint    last_read, symnum, temp_index;
  1196. Zchar    token[MAXNAME];
  1197. Zsymboltype    *symbol;
  1198. Z
  1199. Z    last_read = get_token(cif, 3, token);
  1200. Z    if (last_read == -1)
  1201. Z        {
  1202. Z        fprintf(stderr, "no symbol in DS\n");
  1203. Z        output_cif(stderr, cif);
  1204. Z        return;
  1205. Z        }
  1206. Z    (void) sscanf(token, "%d", &symnum);
  1207. Z
  1208. Z    temp_index = get_index(symnum);
  1209. Z    if (temp_index == -1)
  1210. Z        {
  1211. Z        if (++last_symbol == MAXSYMBOLS)
  1212. Z            {
  1213. Z            fprintf(stderr, "Exceeded the number of allowed symbols\n");
  1214. Z            exit(1);
  1215. Z            }
  1216. Z        temp_index = last_symbol;
  1217. Z        }
  1218. Z
  1219. Z    symbol_table[temp_index].symbol = symnum;
  1220. Z    symbol_table[temp_index].ll.x = BIGINT;
  1221. Z    symbol_table[temp_index].ll.y = BIGINT;
  1222. Z    symbol_table[temp_index].ur.x = -BIGINT;
  1223. Z    symbol_table[temp_index].ur.y = -BIGINT;
  1224. Z    symbol_table[temp_index].name[0] = '\0';
  1225. Z    symbol_table[temp_index].a = 1;
  1226. Z    symbol_table[temp_index].b = 1;
  1227. Z    a_over_b = 1;
  1228. Z
  1229. Z    symbol = allocsymbol();
  1230. Z    if (typer == DSTYPE)
  1231. Z        {
  1232. Z        current_symbol_index = temp_index;
  1233. Z        present_symbol = symbol;
  1234. Z        }
  1235. Z    symbol->typer = DSTYPE;
  1236. Z
  1237. Z    symbol_table[temp_index].pointer = symbol;
  1238. Z    *symbol_table[temp_index].name = '\0';
  1239. Z
  1240. Z    last_read = get_token(cif, last_read, token);
  1241. Z    if (last_read == -1) return;
  1242. Z    (void) sscanf(token, "%d", &(symbol_table[temp_index].a));
  1243. Z
  1244. Z    if (symbol_table[temp_index].a == 0)
  1245. Z        {
  1246. Z        fprintf(stderr, "read a 0 for A in DS\n");
  1247. Z        output_cif(stderr, cif);
  1248. Z        symbol_table[temp_index].a = 1;
  1249. Z        }
  1250. Z
  1251. Z    last_read = get_token(cif, last_read, token);
  1252. Z    if (last_read == -1)
  1253. Z        {
  1254. Z        fprintf(stderr, "A but no B in DS\n");
  1255. Z        output_cif(stderr, cif);
  1256. Z        a_over_b = ((float) symbol_table[temp_index].a) /
  1257. Z                    ((float) symbol_table[temp_index].b);
  1258. Z        return;
  1259. Z        }
  1260. Z    (void) sscanf(token, "%d", &(symbol_table[temp_index].b));
  1261. Z
  1262. Z    if (symbol_table[temp_index].b == 0)
  1263. Z        {
  1264. Z        fprintf(stderr, "read a 0 for B in DS\n");
  1265. Z        output_cif(stderr, cif);
  1266. Z        symbol_table[temp_index].b = 1;
  1267. Z        }
  1268. Z    a_over_b = ((float) symbol_table[temp_index].a) /
  1269. Z                    ((float) symbol_table[temp_index].b);
  1270. Z}    /*ds*/
  1271. Z
  1272. Z
  1273. Z    int
  1274. Zget_token(cif, from, token)
  1275. Zchar    *cif;
  1276. Zint    from;
  1277. Zchar    *token;
  1278. Z
  1279. Z{
  1280. Zint    i;
  1281. Z
  1282. Z    if ((from > 0) && (cif[from - 1] == '\0'))
  1283. Z        return(-1);
  1284. Z
  1285. Z    for (i = 0; ((cif[i+from] != WHITE) && (cif[i+from] != COMMA));i++)
  1286. Z        {
  1287. Z        if (cif[i + from] == '\0')
  1288. Z            break;
  1289. Z        token[i] = cif[i + from];
  1290. Z        }
  1291. Z
  1292. Z    token[i] = '\0';
  1293. Z    if (i == 0)
  1294. Z        return(-1);
  1295. Z    else
  1296. Z        return(i + from + 1);
  1297. Z}    /*get_token*/
  1298. Z
  1299. Z
  1300. Zdf()
  1301. Z{
  1302. Z    current_symbol_index = 0;
  1303. Z    present_symbol = symbol_table[current_symbol_index].pointer;
  1304. Z}    /*df*/
  1305. Z
  1306. Z
  1307. Zbox_cif(cif)
  1308. Zchar    *cif;
  1309. Z
  1310. Z{
  1311. Zint    next_one, i;
  1312. Zint    temp[4];
  1313. Zchar    token[MAXNAME];
  1314. Zboxtype    *box, *allocbox();
  1315. Z
  1316. Z    bang_symbol();
  1317. Z    present_symbol->typer = BOXTYPE;
  1318. Z    box = allocbox();
  1319. Z    present_symbol->primitive.box = box;
  1320. Z
  1321. Z    box->layer = layer;
  1322. Z
  1323. Z    next_one = 2;
  1324. Z    for(i = 0; i < 4; i++)
  1325. Z        {
  1326. Z        next_one = get_token(cif, next_one, token);
  1327. Z        if (next_one == -1)
  1328. Z            {
  1329. Z            fprintf(stderr, "incomplete box\n");
  1330. Z            output_cif(stderr, cif);
  1331. Z            return;
  1332. Z            }
  1333. Z        (void) sscanf(token, "%d", &(temp[i]));
  1334. Z        }
  1335. Z
  1336. Z    box->loc[0] = a_over_b * (temp[2] - (temp[0]/2));
  1337. Z    box->loc[2] = a_over_b * (temp[2] + (temp[0]/2));
  1338. Z    box->loc[1] = a_over_b * (temp[3] - (temp[1]/2));
  1339. Z    box->loc[3] = a_over_b * (temp[3] + (temp[1]/2));
  1340. Z}    /*box_cif*/
  1341. Z
  1342. Z
  1343. Z
  1344. Zcif_change_layer(cif)
  1345. Zchar    *cif;
  1346. Z
  1347. Z{
  1348. Zint    foobar, i;
  1349. Zchar    token[MAXNAME];
  1350. Z
  1351. Z    foobar = get_token(cif, 2, token);
  1352. Z    if (foobar == -1)
  1353. Z        {
  1354. Z        fprintf(stderr, "Error in layer command\n");
  1355. Z        output_cif(stderr, cif);
  1356. Z        return;
  1357. Z        }
  1358. Z
  1359. Z    for(i = 0; i < numlayers; i++)
  1360. Z        {
  1361. Z        if (equal_strings(token, layers[i].name))
  1362. Z            {
  1363. Z            layer = i;
  1364. Z            return;
  1365. Z            }
  1366. Z        }
  1367. Z
  1368. Z    fprintf(stderr, "layer not found\n");
  1369. Z    output_cif(stderr, cif);
  1370. Z    fprintf(stderr, "\nLayers are:\n");
  1371. Z    for(i = 0; i < numlayers; i++)
  1372. Z        fprintf(stderr, "\t%s\n", layers[i].name);
  1373. Z}    /*cif_change_layers*/
  1374. Z
  1375. Z
  1376. Znine(cif)
  1377. Zchar    *cif;
  1378. Z
  1379. Z{
  1380. Zint    foobar;
  1381. Zchar    token[MAXNAME];
  1382. Z
  1383. Z    foobar = get_token(cif, 2, token);
  1384. Z    if (foobar == -1)
  1385. Z        {
  1386. Z        fprintf(stderr, "Error in 9 command\n");
  1387. Z        output_cif(stderr, cif);
  1388. Z        return;
  1389. Z        }
  1390. Z
  1391. Z    (void) sscanf(token, "%s", symbol_table[current_symbol_index].name);
  1392. Z}    /*nine*/
  1393. Z
  1394. Z
  1395. Z
  1396. Z
  1397. Z#ifdef DEBUG
  1398. Zoutput_symboldef(filer, sym)
  1399. ZFILE    *filer;
  1400. Zint    sym;
  1401. Z
  1402. Z{
  1403. Zsymboltype    *symbol;
  1404. Z
  1405. Z    output_symbol(stdout, sym);
  1406. Z    symbol = symbol_table[sym].pointer;
  1407. Z    while(symbol != NULL)
  1408. Z        {
  1409. Z        output_symbolsub(filer, symbol);
  1410. Z        symbol = symbol->next;
  1411. Z        }
  1412. Z}    /*output_symboldef*/
  1413. Z
  1414. Z
  1415. Zoutput_symbolsub(filer, symbol)
  1416. ZFILE    *filer;
  1417. Zsymboltype    *symbol;
  1418. Z
  1419. Z{
  1420. Z    fprintf(filer, "\ttype ");
  1421. Z    switch(symbol->typer)
  1422. Z        {
  1423. Z    case DSTYPE:
  1424. Z        fprintf(filer, "symbol\n");
  1425. Z        break;
  1426. Z    case BOXTYPE:
  1427. Z        output_box(filer, symbol->primitive.box);
  1428. Z        break;
  1429. Z    case CALLTYPE:
  1430. Z        output_call(filer, symbol->primitive.call);
  1431. Z        break;
  1432. Z    case NINETY_FOURTYPE:
  1433. Z        output_ninety_four(filer, symbol->primitive.ninety_four);
  1434. Z        break;
  1435. Z    default:
  1436. Z        fprintf(filer, "ERROR Not known %d\n", symbol->typer);
  1437. Z        return;
  1438. Z        }
  1439. Z}    /*output_symbolsub*/
  1440. Z#endif
  1441. Z
  1442. Z
  1443. Z
  1444. Zbang_symbol()
  1445. Z{
  1446. Z    present_symbol->next = allocsymbol();
  1447. Z    present_symbol = present_symbol->next;
  1448. Z}    /*bang_symbol*/
  1449. Z
  1450. Z
  1451. Z
  1452. Z#ifdef DEBUG
  1453. Zoutput_box(filer, box)
  1454. ZFILE    *filer;
  1455. Zboxtype    *box;
  1456. Z
  1457. Z{
  1458. Zint    i;
  1459. Z
  1460. Z    fprintf(filer, "\tBox ");
  1461. Z    for(i = 0; i < 4; i++)
  1462. Z        fprintf(filer, "%d ", box->loc[i]);
  1463. Z
  1464. Z    fprintf(filer, "\t layer %s\n", layers[box->layer].name);
  1465. Z}    /*output_box*/
  1466. Z#endif
  1467. Z
  1468. Z
  1469. Z
  1470. Zninety_four(cif)
  1471. Zchar    *cif;
  1472. Z
  1473. Z{
  1474. Zint    last_read;
  1475. Zchar    token[MAXNAME];
  1476. Zninety_fourtype    *ninety_four, *allocninety_four();
  1477. Z
  1478. Z    bang_symbol();
  1479. Z    present_symbol->typer = NINETY_FOURTYPE;
  1480. Z    ninety_four = allocninety_four();
  1481. Z    present_symbol->primitive.ninety_four = ninety_four;
  1482. Z
  1483. Z    last_read = get_token(cif, 3, token);
  1484. Z    if (last_read == -1)
  1485. Z        {
  1486. Z        fprintf(stderr, "no text in ninety_four\n");
  1487. Z        output_cif(stderr, cif);
  1488. Z        return;
  1489. Z        }
  1490. Z    (void) sscanf(token, "%s", ninety_four->name);
  1491. Z
  1492. Z    last_read = get_token(cif, last_read, token);
  1493. Z    if (last_read == -1)
  1494. Z        {
  1495. Z        fprintf(stderr, "no x in ninety_four\n");
  1496. Z        output_cif(stderr, cif);
  1497. Z        return;
  1498. Z        }
  1499. Z    (void) sscanf(token, "%d", &(ninety_four->x));
  1500. Z    ninety_four->x *= a_over_b;
  1501. Z
  1502. Z    last_read = get_token(cif, last_read, token);
  1503. Z    if (last_read == -1)
  1504. Z        {
  1505. Z        fprintf(stderr, "no y in ninety_four\n");
  1506. Z        output_cif(stderr, cif);
  1507. Z        return;
  1508. Z        }
  1509. Z    (void) sscanf(token, "%d", &(ninety_four->y));
  1510. Z    ninety_four->y *= a_over_b;
  1511. Z
  1512. Z    last_read = get_token(cif, last_read, token);
  1513. Z    if (last_read != -1)    /*don't need layer on 94*/
  1514. Z        ninety_four->layer = get_layer_num(token);
  1515. Z}    /*ninety_four*/
  1516. Z
  1517. Z
  1518. Z#ifdef DEBUG
  1519. Zoutput_ninety_four(filer, ninety_four)
  1520. ZFILE    *filer;
  1521. Zninety_fourtype    *ninety_four;
  1522. Z
  1523. Z{
  1524. Z    fprintf(filer, "\t94 %s, x %d y %d ", ninety_four->name,
  1525. Z                    ninety_four->x, ninety_four->y);
  1526. Z    if ((ninety_four->layer < 0) || (ninety_four->layer >= numlayers))
  1527. Z        fprintf(stderr, "error in layer in 94 %d\n", ninety_four->layer);
  1528. Z    else
  1529. Z        fprintf(filer, "layer %s\n", layers[ninety_four->layer].name);
  1530. Z}    /*output_ninety_four*/
  1531. Z#endif
  1532. Z
  1533. Z
  1534. Z    int
  1535. Zget_layer_num(lay)
  1536. Zchar    *lay;
  1537. Z
  1538. Z{
  1539. Zint    i;
  1540. Z
  1541. Z    for(i = 1; i < numlayers; i++)
  1542. Z        {
  1543. Z        if (equal_strings(lay, layers[i].name)) return(i);
  1544. Z        }
  1545. Z
  1546. Z    fprintf(stderr, "layer **%s** not found in get layer\n", lay);
  1547. Z    return(0);
  1548. Z}    /*get_layer_num*/
  1549. Z
  1550. Z
  1551. Z    calltype
  1552. Z*alloccall()
  1553. Z{
  1554. Zunsigned    size = sizeof(calltype);
  1555. Zcalltype    *call;
  1556. Z
  1557. Z    call =(calltype *) malloc(size);
  1558. Z    call->symbol = -999;
  1559. Z    identity_matrix(call->matrix);
  1560. Z
  1561. Z    return(call);
  1562. Z}    /*alloccall*/
  1563. Z
  1564. Z
  1565. Z
  1566. Z    ninety_fourtype
  1567. Z*allocninety_four()
  1568. Z{
  1569. Zunsigned    size = sizeof(ninety_fourtype);
  1570. Zninety_fourtype    *ninety_four;
  1571. Z
  1572. Z    ninety_four =(ninety_fourtype *) malloc(size);
  1573. Z    ninety_four->layer = 0;
  1574. Z    ninety_four->x = 0;
  1575. Z    ninety_four->y = 0;
  1576. Z    ninety_four->name[0] = '\0';
  1577. Z
  1578. Z    return(ninety_four);
  1579. Z}    /*allocninety_four*/
  1580. Z
  1581. Z
  1582. Z#ifdef DEBUG
  1583. Zoutput_call(filer, call)
  1584. ZFILE    *filer;
  1585. Zcalltype    *call;
  1586. Z
  1587. Z{
  1588. Z    fprintf(filer, "\tCall ");
  1589. Z    fprintf(filer, " %d (%s)\n", symbol_table[call->symbol].symbol,
  1590. Z                    symbol_table[call->symbol].name);
  1591. Z    output_matrix(filer, call->matrix);
  1592. Z}    /*output_call*/
  1593. Z#endif
  1594. STUNKYFLUFF
  1595. set `sum cifgood.c`
  1596. if test 34229 != $1
  1597. then
  1598. echo cifgood.c: Checksum error. Is: $1, should be: 34229.
  1599. fi
  1600. #
  1601. #
  1602. echo Extracting cifplot.c:
  1603. sed 's/^Z//' >cifplot.c <<\STUNKYFLUFF
  1604. Z/*
  1605. Z    cif2ps is based on the program 'cifp' originally written by
  1606. Z    Arthur Simoneau, The Aerospace Corporation, El Segundo, Calif
  1607. Z
  1608. Z    Changes to 'cifp' include support of cmos-pw layers, scaling
  1609. Z    factors to spread output over several pages of 8.5 x 11 paper,
  1610. Z    printing multiple layers.
  1611. Z
  1612. Z    Modified by Marc Lesure, Arizona State University, Tempe, AZ
  1613. Z
  1614. Z    Please honor the authors by not removing names from the source codes.
  1615. Z*/
  1616. Z#include "define.h"
  1617. Z
  1618. Zplot_box(box)
  1619. Zboxtype    *box;
  1620. Z{
  1621. Z    float        llx, urx, lly, ury, deltax, deltay;
  1622. Z    pointpairtype    pair;
  1623. Z
  1624. Z    get_pair(box->loc[0], box->loc[1], &pair);
  1625. Z    llx = (pair.x + trans_x) * scale;
  1626. Z    lly = (pair.y + trans_y) * scale;
  1627. Z    get_pair(box->loc[2], box->loc[3], &pair);
  1628. Z    urx = (pair.x + trans_x) * scale;
  1629. Z    ury = (pair.y + trans_y) * scale;
  1630. Z
  1631. Z    deltax = urx - llx;
  1632. Z    if (deltax < 0)
  1633. Z        {
  1634. Z        llx = llx + deltax;
  1635. Z        deltax = - deltax;
  1636. Z        }
  1637. Z    deltay = ury - lly;
  1638. Z    if (deltay < 0)
  1639. Z        {
  1640. Z        lly = lly + deltay;
  1641. Z        deltay = - deltay;
  1642. Z        }
  1643. Z
  1644. Z    if (clip[layer])
  1645. Z        {
  1646. Z        if (inarea(llx, lly, deltax, deltay)) {
  1647. Z            clipper(llx, lly, deltax, deltay);
  1648. Z            fill_box(llx, lly, deltax, deltay);
  1649. Z        }
  1650. Z        }
  1651. Z    else
  1652. Z        {
  1653. Z        if (inarea(llx, lly, deltax, deltay)) 
  1654. Z            box_plotter(llx, lly, deltax, deltay);
  1655. Z           }
  1656. Z}    /*plot_box*/
  1657. Z
  1658. Z
  1659. Zinarea(llx, lly, deltax, deltay)
  1660. Zfloat    llx, lly, deltax, deltay;
  1661. Z{
  1662. Z    float    left, bottom, top, right;
  1663. Z    float    maxx, maxy, minx, miny;
  1664. Z
  1665. Z    minx = pagex * PAGEWIDTH;
  1666. Z    maxx = (pagex + 1) * PAGEWIDTH;
  1667. Z    miny = pagey * PAGELENGTH;
  1668. Z    maxy = (pagey + 1) * PAGELENGTH;
  1669. Z    left = llx;
  1670. Z    bottom = lly;
  1671. Z    right = llx + deltax;
  1672. Z    top = lly + deltay;
  1673. Z    if (left > maxx)
  1674. Z        return(0);
  1675. Z    if (top < miny)
  1676. Z        return(0);
  1677. Z    if (right < minx)
  1678. Z        return(0);
  1679. Z    if (bottom > maxy)
  1680. Z        return(0);
  1681. Z    return(1);
  1682. Z}
  1683. Z
  1684. Z
  1685. Z
  1686. Zfill_box(llx, lly, deltax, deltay)
  1687. Zfloat    llx, lly, deltax, deltay;
  1688. Z{
  1689. Z    float    left, bottom, top, right;
  1690. Z    float    x, y, xx, yy;
  1691. Z    float    b, b_start;
  1692. Z    float    slope_x, inv_slope_y, slope_xx, inv_slope_yy, b_div_slope;
  1693. Z    float    minx,maxx,miny,maxy;
  1694. Z    float    trunc();
  1695. Z    int    toggle_top = 1, toggle_left = 1;
  1696. Z
  1697. Z    minx = pagex * PAGEWIDTH;
  1698. Z    maxx = (pagex + 1) * PAGEWIDTH;
  1699. Z    miny = pagey * PAGELENGTH;
  1700. Z    maxy = (pagey + 1) * PAGELENGTH;
  1701. Z    left = llx;
  1702. Z    bottom = lly;
  1703. Z    right = llx + deltax;
  1704. Z    top = lly + deltay;
  1705. Z
  1706. Z    if (slope <= 0)
  1707. Z        {
  1708. Z        b = top - (slope * right);
  1709. Z        x = right;
  1710. Z        }
  1711. Z    else
  1712. Z        {
  1713. Z        b = top - (slope * left);
  1714. Z        x = left;
  1715. Z        }
  1716. Z
  1717. Z    b_start = trunc(b);
  1718. Z    while (b_start <= b)
  1719. Z        b_start += step;
  1720. Z    b_start -= step;    /*went one too far*/
  1721. Z
  1722. Z    b_div_slope = b_start / slope;
  1723. Z    slope_x = slope * x;
  1724. Z    y = slope_x + b_start;
  1725. Z    inv_slope_y = y / slope;
  1726. Z
  1727. Z    yy = top;
  1728. Z    inv_slope_yy = yy / slope;
  1729. Z    xx = inv_slope_yy - b_div_slope;
  1730. Z    slope_xx = slope * xx;
  1731. Z
  1732. Z    b = b_start;
  1733. Z    FOREVER
  1734. Z        {
  1735. Z        b_div_slope = b / slope;
  1736. Z        if (toggle_left)
  1737. Z            {
  1738. Z            y = slope_x + b;
  1739. Z            if (y < bottom)
  1740. Z                {
  1741. Z                toggle_left = 0;
  1742. Z                y = bottom;
  1743. Z                inv_slope_y = y / slope;
  1744. Z                }
  1745. Z            }
  1746. Z        if ( !toggle_left)
  1747. Z            {
  1748. Z            x = inv_slope_y - b_div_slope;
  1749. Z
  1750. Z            if (slope <= 0)
  1751. Z                {
  1752. Z                if (x <= left)
  1753. Z                    return;
  1754. Z                }
  1755. Z            else
  1756. Z                {
  1757. Z                if (x >= right)
  1758. Z                    return;
  1759. Z                }
  1760. Z            }
  1761. Z
  1762. Z        if (toggle_top)
  1763. Z            {
  1764. Z            xx = inv_slope_yy - b_div_slope;
  1765. Z            if (slope <= 0)
  1766. Z                 {
  1767. Z                if (xx < left)
  1768. Z                    {
  1769. Z                    toggle_top = 0;
  1770. Z                    xx = left;
  1771. Z                    slope_xx = slope * xx;
  1772. Z                    }
  1773. Z                }
  1774. Z            else
  1775. Z                 {
  1776. Z                if (xx > right)
  1777. Z                    {
  1778. Z                    toggle_top = 0;
  1779. Z                    xx = right;
  1780. Z                    slope_xx = slope * xx;
  1781. Z                    }
  1782. Z                }
  1783. Z            }
  1784. Z        if ( !toggle_top)
  1785. Z            yy = slope_xx + b;
  1786. Z
  1787. Z        if ((x < left) || (x > right) || (xx < left) || (xx > right))
  1788. Z            {
  1789. Z#ifdef DEBUG
  1790. Z            start_text();
  1791. Z            plot_string(x, y, "start error");
  1792. Z            plot_string(xx, yy, "end error");
  1793. Z            fprintf(stderr, "\nError....in x\n");
  1794. Z            fprintf(stderr, "x\t%f y\t%f xx\t%f yy\t%f\n",
  1795. Z                (float) x, (float) y, (float) xx, (float) yy);
  1796. Z            fprintf(stderr, "left\t%f bot\t%f right\t%f top \t%f\n",
  1797. Z                        (float) left, (float) bottom,
  1798. Z                        (float) right, (float) top);
  1799. Z            fprintf(stderr, "step %f ", (float) step);
  1800. Z            fprintf(stderr, "b %f, b start %f\n", b, b_start);
  1801. Z            return;
  1802. Z#endif
  1803. Z            }
  1804. Z        else if ((y < bottom) || (y > top) || (yy < bottom) || (yy > top))
  1805. Z            {
  1806. Z#ifdef DEBUG
  1807. Z            start_text();
  1808. Z            plot_string(x, y, "start error");
  1809. Z            plot_string(xx, yy, "end error");
  1810. Z            fprintf(stderr, "\nError....in y\n");
  1811. Z            fprintf(stderr, "x\t%f y\t%f xx\t%f yy\t%f\n",
  1812. Z                (float) x, (float) y, (float) xx, (float) yy);
  1813. Z            fprintf(stderr, "left\t%f bot\t%f right\t%f top \t%f\n",
  1814. Z                        (float) left, (float) bottom,
  1815. Z                        (float) right, (float) top);
  1816. Z            fprintf(stderr, "step %f ", (float) step);
  1817. Z            fprintf(stderr, "b %d, b start %d\n", b, b_start);
  1818. Z            return;
  1819. Z#endif    /*debug*/
  1820. Z            }
  1821. Z        else
  1822. Z            if ((inrange(minx,maxx,x) && inrange(miny,maxy,y)) ||
  1823. Z                (inrange(minx,maxx,xx) && inrange(miny,maxy,yy)))
  1824. Z            {
  1825. Z                drawline(x, y, xx, yy);
  1826. Z            }
  1827. Z
  1828. Z        b -= step;
  1829. Z        }    /*FOREVER*/
  1830. Z}    /*fill_box*/
  1831. Z
  1832. Z
  1833. Zinrange(min,max,value)
  1834. Zfloat min,max,value;
  1835. Z{
  1836. Z    return(min <= value && value <= max);
  1837. Z}
  1838. Z
  1839. Z
  1840. Zfloat
  1841. Ztrunc(in)
  1842. Zfloat    in;
  1843. Z{
  1844. Z    long    temp;
  1845. Z    float    bar;
  1846. Z
  1847. Z    temp = in;
  1848. Z    bar = temp;
  1849. Z    if (bar > 0)
  1850. Z        return(bar);
  1851. Z    else
  1852. Z        return(bar - 1);
  1853. Z}    /*trunc*/
  1854. Z
  1855. Z
  1856. Zplot_text(ninety_four)
  1857. Zninety_fourtype    *ninety_four;
  1858. Z{
  1859. Z    float        x, y;
  1860. Z    pointpairtype    pair;
  1861. Z
  1862. Z    get_pair(ninety_four->x, ninety_four->y, &pair);
  1863. Z    x = (pair.x + trans_x) * scale;
  1864. Z    y = (pair.y + trans_y) * scale;
  1865. Z
  1866. Z    plot_string(x, y, ninety_four->name);
  1867. Z}    /*plot_text*/
  1868. Z
  1869. Z
  1870. Zplot_change_layer(layer_in)
  1871. Zint    layer_in;
  1872. Z{
  1873. Z
  1874. Z    if ((layer_in >= 0) && (layer_in < numlayers))
  1875. Z        {
  1876. Z        if (!clip[layer])
  1877. Z            end_box();
  1878. Z        }
  1879. Z    if (cmos_pw == 1) {
  1880. Z        switch(layer_in)
  1881. Z            {
  1882. Z        case 0:
  1883. Z            break;
  1884. Z        case CW:
  1885. Z            fprintf(plotfile, "0.9 setgray\n");
  1886. Z            break;
  1887. Z        case CM2:
  1888. Z            fprintf(plotfile, "0.2 setgray\n");
  1889. Z            break;
  1890. Z        case CM:
  1891. Z            fprintf(plotfile, "0.3 setgray\n");
  1892. Z            break;
  1893. Z        case CP:
  1894. Z            fprintf(plotfile, "0.4 setgray\n");
  1895. Z            break;
  1896. Z        case CD:
  1897. Z            fprintf(plotfile, "0.5 setgray\n");
  1898. Z            break;
  1899. Z        case CZ:
  1900. Z        case CC:
  1901. Z        case CC2:
  1902. Z            fprintf(plotfile, "0 setgray\n");
  1903. Z            break;
  1904. Z        case CS:
  1905. Z            fprintf(plotfile, "0.8 setgray\n");
  1906. Z            break;
  1907. Z        case CG:
  1908. Z            fprintf(plotfile, "0.7 setgray\n");
  1909. Z            break;
  1910. Z        default:
  1911. Z            fprintf(stderr, "Error in plot_change_layer %d\n", layer_in);
  1912. Z            return;
  1913. Z            }
  1914. Z    }
  1915. Z    else {
  1916. Z        switch(layer_in)
  1917. Z            {
  1918. Z        case 0:
  1919. Z            break;
  1920. Z        case CWP:
  1921. Z            fprintf(plotfile, "0.9 setgray\n");
  1922. Z            break;
  1923. Z        case CMS:
  1924. Z            fprintf(plotfile, "0.2 setgray\n");
  1925. Z            break;
  1926. Z        case CMF:
  1927. Z            fprintf(plotfile, "0.3 setgray\n");
  1928. Z            break;
  1929. Z        case CPG:
  1930. Z            fprintf(plotfile, "0.4 setgray\n");
  1931. Z            break;
  1932. Z        case CAA:
  1933. Z            fprintf(plotfile, "0.5 setgray\n");
  1934. Z            break;
  1935. Z        case CCA:
  1936. Z        case CCP:
  1937. Z        case CVA:
  1938. Z            fprintf(plotfile, "0 setgray\n");
  1939. Z            break;
  1940. Z        case CSP:
  1941. Z            fprintf(plotfile, "0.8 setgray\n");
  1942. Z            break;
  1943. Z        default:
  1944. Z            fprintf(stderr, "Error in plot_change_layer %d\n", layer_in);
  1945. Z            return;
  1946. Z            }
  1947. Z    }
  1948. Z    if (layer_in != 0)
  1949. Z        fprintf(plotfile, "%% %s\n", layers[layer_in].name);
  1950. Z
  1951. Z    layer = layer_in;
  1952. Z    if (clip[layer])
  1953. Z        start_clipping();
  1954. Z    else
  1955. Z        start_box();
  1956. Z}    /*plot_change_layer*/
  1957. Z
  1958. Z
  1959. Zstart_box()
  1960. Z{
  1961. Z    fprintf(plotfile, "newpath\n");
  1962. Z}    /*start_box*/
  1963. Z
  1964. Zend_box()
  1965. Z{
  1966. Z    fprintf(plotfile, "closepath\n");
  1967. Z}    /*end_box*/
  1968. Z
  1969. Z
  1970. Zstart_clipping()
  1971. Z{
  1972. Z    fprintf(plotfile, "0 setgray  newpath\n");
  1973. Z
  1974. Z    if (cmos_pw == 1) {
  1975. Z        switch(layer)
  1976. Z            {
  1977. Z        case CP:
  1978. Z            step = .5;
  1979. Z            slope = 5.0;
  1980. Z            break;
  1981. Z        case CM:
  1982. Z            step = .2;
  1983. Z            slope = 1.0;
  1984. Z            break;
  1985. Z        case CM2:
  1986. Z            step = .2;
  1987. Z            slope = -1.0;
  1988. Z            break;
  1989. Z        default:
  1990. Z            fprintf(stderr, "Hit default in start clipping %d\n", layer);
  1991. Z            break;
  1992. Z            }    /*switch*/
  1993. Z    }
  1994. Z    else {
  1995. Z        switch(layer)
  1996. Z            {
  1997. Z        case CPG:
  1998. Z            step = .5;
  1999. Z            slope = 5.0;
  2000. Z            break;
  2001. Z        case CMF:
  2002. Z            step = .2;
  2003. Z            slope = 1.0;
  2004. Z            break;
  2005. Z        case CMS:
  2006. Z            step = .2;
  2007. Z            slope = -1.0;
  2008. Z            break;
  2009. Z        default:
  2010. Z            fprintf(stderr, "Hit default in start clipping %d\n", layer);
  2011. Z            break;
  2012. Z            }    /*switch*/
  2013. Z    }
  2014. Z}    /*start_clipping*/
  2015. Z
  2016. Z
  2017. Z
  2018. Z
  2019. Z
  2020. Zstart_text()
  2021. Z{
  2022. Z    float    scalefont;
  2023. Z
  2024. Z    fprintf(plotfile, "closepath\n");
  2025. Z    scalefont = scale * width * PAGEWIDTH * 20;
  2026. Z    fprintf(plotfile, "0 setgray\n");
  2027. Z    fprintf(plotfile, "/Helvetica findfont %f scalefont setfont\n",
  2028. Z                                scalefont);
  2029. Z}    /*start_text*/
  2030. Z
  2031. Z
  2032. Zdrawline(x, y, xx, yy)
  2033. Zfloat    x, y, xx, yy;
  2034. Z{
  2035. Z    fprintf(plotfile, "%f %f moveto %f %f lineto stroke\n", x, y, xx, yy);
  2036. Z}    /*drawline*/
  2037. Z
  2038. Z
  2039. Z
  2040. Zbox_plotter(llx, lly, deltax, deltay)
  2041. Zfloat    llx, lly, deltax, deltay;
  2042. Z{
  2043. Z    fprintf(plotfile, "%f %f %f %f box\n", llx, lly, deltax, deltay);
  2044. Z}    /*box_plotter*/
  2045. Z
  2046. Z
  2047. Zclipper(llx, lly, deltax, deltay)
  2048. Zfloat    llx, lly, deltax, deltay;
  2049. Z{
  2050. Z    fprintf(plotfile, "%f %f %f %f clipper\n", llx, lly, deltax, deltay);
  2051. Z}    /*clipper*/
  2052. Z
  2053. Z
  2054. Z
  2055. Zplot_string(x, y, stringer)
  2056. Zfloat x, y;
  2057. Zchar    *stringer;
  2058. Z{
  2059. Z    fprintf(plotfile, "%f %f moveto (%s) show\n", x, y, stringer);
  2060. Z}    /*plot_string*/
  2061. Z
  2062. Z
  2063. Zprolog()
  2064. Z{
  2065. Z    fprintf(plotfile, "%%!\n");
  2066. Z    fprintf(plotfile, "/area {/dely exch def /delx exch def moveto\n");
  2067. Z    fprintf(plotfile, "\tdelx 0 rlineto 0 dely rlineto delx neg 0 rlineto 0 dely neg rlineto} def\n");
  2068. Z    fprintf(plotfile, "/box {area fill} def\n");
  2069. Z    fprintf(plotfile, "/clipper {area stroke} def\n");
  2070. Z}    /*prolog*/
  2071. Z
  2072. Z#ifdef DEBUG
  2073. Zfoobar(ll, ur)
  2074. Zpointpairtype    *ll, *ur;
  2075. Z
  2076. Z{
  2077. Z    float    deltax, deltay;
  2078. Z
  2079. Z    if (cmos_pw == 1)
  2080. Z        plot_change_layer(CM);
  2081. Z    else
  2082. Z        plot_change_layer(CMS);
  2083. Z    deltax = ur->x - ll->x;
  2084. Z    deltay = ur->y - ll->y;
  2085. Z    fprintf(stderr, "ll %f %f \tdelta %f %f\n",
  2086. Z            (float) ll->x, (float) ll->y, deltax, deltay);
  2087. Z    box_plotter((float) ll->x, (float) ll->y, deltax, deltay);
  2088. Z}
  2089. Z#endif
  2090. Z
  2091. Zprelog()
  2092. Z{
  2093. Z    fprintf(plotfile, "gsave\n");
  2094. Z    fprintf(plotfile, "/inch {72 mul} def\n");
  2095. Z    fprintf(plotfile, "%% small correction for full page printing\n");
  2096. Z    fprintf(plotfile, "20 20 translate\n");
  2097. Z    fprintf(plotfile, "%% undo unit scaling when printing full page\n");
  2098. Z    fprintf(plotfile, "/unitscale { 1 inch %f mul dup scale } def\n",
  2099. Z                                scale/scale2);
  2100. Z    fprintf(plotfile, "0.001 setlinewidth\n");
  2101. Z    fprintf(plotfile, "%f dup scale\n", scale2/scale);
  2102. Z        fprintf(plotfile, "%3.3f 0.0 %3.3f %3.3f unitscale\n", 
  2103. Z                        .5*scale2x, scale2x, scale2y);
  2104. Z    fprintf(plotfile,"%f %f translate\n",
  2105. Z        -pagex*PAGEWIDTH, -pagey*PAGELENGTH);
  2106. Z}
  2107. Z
  2108. Z
  2109. Zepilog()
  2110. Z{
  2111. Z    fprintf(plotfile, "0 setgray\n");
  2112. Z    fprintf(plotfile, "gsave\n");
  2113. Z    fprintf(plotfile, "0 setgray\n");
  2114. Z    fprintf(plotfile, "/Helvetica findfont 0.075 scalefont setfont\n");
  2115. Z    /* fprintf(plotfile, "%f %f moveto (%d,%d) show\n",
  2116. Z        pagex * PAGEWIDTH, pagey * PAGELENGTH, pagex, pagey); */
  2117. Z    fprintf(plotfile, "grestore\n");
  2118. Z    fprintf(plotfile, "grestore\n");
  2119. Z    fprintf(plotfile, "showpage\n");
  2120. Z    totpages++;
  2121. Z    fflush(plotfile);
  2122. Z}    /*epilog*/
  2123. Z
  2124. Z
  2125. Z
  2126. Zinit()
  2127. Z{
  2128. Z    int    i;
  2129. Z
  2130. Z    no_lines = 0;
  2131. Z    layer = 0;
  2132. Z    last_symbol = -1;
  2133. Z    ds("DS 0", DSTYPE);
  2134. Z    nine("9 top_level");
  2135. Z    identity_matrix(matrix);
  2136. Z
  2137. Z    (void) strcpy(layers[0].name, "FOOBAR");
  2138. Z    if (cmos_pw == 1) {
  2139. Z        (void) strcpy(layers[CW].name, "CW");
  2140. Z        (void) strcpy(layers[CM2].name, "CM2");
  2141. Z        (void) strcpy(layers[CM].name, "CM");
  2142. Z        (void) strcpy(layers[CP].name, "CP");
  2143. Z        (void) strcpy(layers[CD].name, "CD");
  2144. Z        (void) strcpy(layers[CC].name, "CC");
  2145. Z        (void) strcpy(layers[CS].name, "CS");
  2146. Z        (void) strcpy(layers[CC2].name, "CC2");
  2147. Z        (void) strcpy(layers[CZ].name, "CZ");
  2148. Z        (void) strcpy(layers[CG].name, "CG");
  2149. Z        numlayers = 11;
  2150. Z    }
  2151. Z    else {
  2152. Z         (void) strcpy(layers[CWP].name, "CWP");
  2153. Z         (void) strcpy(layers[CMS].name, "CMS");
  2154. Z         (void) strcpy(layers[CMF].name, "CMF");
  2155. Z         (void) strcpy(layers[CPG].name, "CPG");
  2156. Z         (void) strcpy(layers[CAA].name, "CAA");
  2157. Z         (void) strcpy(layers[CCA].name, "CCA");
  2158. Z         (void) strcpy(layers[CCP].name, "CCP");
  2159. Z         (void) strcpy(layers[CSP].name, "CSP");
  2160. Z         (void) strcpy(layers[CVA].name, "CVA");
  2161. Z         numlayers = 10;
  2162. Z    }
  2163. Z
  2164. Z    for (i = 1; i < numlayers; i++)
  2165. Z        clip[i] = 0;
  2166. Z
  2167. Z    if (cmos_pw == 1) {
  2168. Z        clip[CP] = 1;
  2169. Z        clip[CM] = 1;
  2170. Z        clip[CM2] = 1;
  2171. Z    }
  2172. Z    else {
  2173. Z         clip[CPG] = 1;
  2174. Z         clip[CMF] = 1;
  2175. Z         clip[CMS] = 1;
  2176. Z    }
  2177. Z
  2178. Z}    /*init*/
  2179. STUNKYFLUFF
  2180. set `sum cifplot.c`
  2181. if test 32084 != $1
  2182. then
  2183. echo cifplot.c: Checksum error. Is: $1, should be: 32084.
  2184. fi
  2185. #
  2186. #
  2187. echo Extracting cmos-pw.test.cif:
  2188. sed 's/^Z//' >cmos-pw.test.cif <<\STUNKYFLUFF
  2189. Z ($$ HP EGS Graphics Editor);
  2190. Z ($$ Revision      : 2.1);
  2191. Z ($$ Archival Date : 5/8/83);
  2192. Z ($$ Archival Time : 9:55 AM);
  2193. Z ($FILES inv $; );
  2194. Z ( DA222 -- IGS2CIF program  version 2a.04 cmp-15may87 );
  2195. Z DS 1 ;
  2196. Z 9 inv;
  2197. Z L CS  ;
  2198. Z B 1300 800 3950,-300 ;
  2199. Z L CC  ;
  2200. Z B 300 800 3950,100 ;
  2201. Z L CD  ;
  2202. Z B 900 1200 3950,100 ;
  2203. Z L CC2 ;
  2204. Z B 300 300 3950,-1350 ;
  2205. Z L CP  ;
  2206. Z B 4600 300 600,-750 ;
  2207. Z B 300 1800 -1550,300 ;
  2208. Z B 300 2800 -1550,3000 ;
  2209. Z L CD  ;
  2210. Z B 2200 1600 -1700,3300 ;
  2211. Z L CC  ;
  2212. Z B 300 300 -2350,2850 ;
  2213. Z L CC2 ;
  2214. Z B 300 300 -2350,-1450 ;
  2215. Z L CD  ;
  2216. Z B 900 1800 -2350,-100 ;
  2217. Z L CC  ;
  2218. Z B 300 800 -2350,-400 ;
  2219. Z L CD  ;
  2220. Z B 2200 800 -1700,400 ;
  2221. Z L CC  ;
  2222. Z B 300 300 -950,350 ;
  2223. Z L CM  ;
  2224. Z B 900 2700 -2350,-550 ;
  2225. Z B 700 800 -950,400 ;
  2226. Z B 300 400 50,600 ;
  2227. Z B 700 800 150,1200 ;
  2228. Z L CP  ;
  2229. Z B 700 800 150,1200 ;
  2230. Z L CC  ;
  2231. Z B 300 300 150,1250 ;
  2232. Z L CP  ;
  2233. Z B 1900 300 -450,1750 ;
  2234. Z L CM  ;
  2235. Z B 800 800 2500,-1900 ;
  2236. Z L CP  ;
  2237. Z B 800 800 2500,-1900 ;
  2238. Z B 300 600 2750,-1200 ;
  2239. Z L CC  ;
  2240. Z B 300 300 2550,-1850 ;
  2241. Z B 300 300 2050,350 ;
  2242. Z L CD  ;
  2243. Z B 700 700 2050,350 ;
  2244. Z L CM  ;
  2245. Z B 700 700 2050,350 ;
  2246. Z B 2300 400 550,200 ;
  2247. Z L CD  ;
  2248. Z B 2700 400 3050,500 ;
  2249. Z L CM  ;
  2250. Z B 900 700 -2350,2850 ;
  2251. Z L CD  ;
  2252. Z B 2700 800 3050,2900 ;
  2253. Z L CP  ;
  2254. Z B 300 4200 2750,1500 ;
  2255. Z L CC  ;
  2256. Z B 300 300 3350,2850 ;
  2257. Z L CM  ;
  2258. Z B 1400 700 3700,2850 ;
  2259. Z L CC  ;
  2260. Z B 300 300 4050,2850 ;
  2261. Z B 300 300 2050,3250 ;
  2262. Z L CW  ;
  2263. Z B 3800 5600 2900,1900 ;
  2264. Z L CS  ;
  2265. Z B 2600 4900 -1700,2050 ;
  2266. Z L CM  ;
  2267. Z B 900 2500 3950,-550 ;
  2268. Z B 6300 300 -250,-2450 ;
  2269. Z B 8600 300 900,2350 ;
  2270. Z L CM2 ;
  2271. Z B 900 9800 3950,1600 ;
  2272. Z B 900 9800 1150,1600 ;
  2273. Z B 900 9800 -2350,1600 ;
  2274. Z L CM  ;
  2275. Z B 3000 900 200,3350 ;
  2276. Z L CC2 ;
  2277. Z B 300 300 1150,3350 ;
  2278. Z L CC  ;
  2279. Z B 300 300 -950,3350 ;
  2280. Z L CD  ;
  2281. Z B 700 1300 2050,3150 ;
  2282. Z L CM  ;
  2283. Z B 700 900 2050,3350 ;
  2284. Z DF;
  2285. Z
  2286. Z
  2287. Z C 1 T 0, 0;
  2288. Z( DEFINED SYMBOLS:
  2289. Z  CIF#   IGS-NAME    CALLED BY CELLS
  2290. Z    1 : inv   
  2291. Z
  2292. Z
  2293. Z LAYER ASSIGNMENTS:
  2294. Z IGS LAYER    CIF LAYER
  2295. Z           1    CW  
  2296. Z           3    CD  
  2297. Z           4    CP  
  2298. Z           5    CS  
  2299. Z           7    CC  
  2300. Z           8    CM  
  2301. Z           9    CG  
  2302. Z          13    CC2 
  2303. Z          14    CM2 
  2304. Z          15    CE  
  2305. Z
  2306. Z
  2307. Z SIZE[IGS] *1.00000E+002 ==> SIZE[CIF]
  2308. Z
  2309. Z
  2310. Z TERMINATE NORMALLY);
  2311. Z E
  2312. STUNKYFLUFF
  2313. set `sum cmos-pw.test.cif`
  2314. if test 47135 != $1
  2315. then
  2316. echo cmos-pw.test.cif: Checksum error. Is: $1, should be: 47135.
  2317. fi
  2318. #
  2319. #
  2320. echo Extracting define.h:
  2321. sed 's/^Z//' >define.h <<\STUNKYFLUFF
  2322. Z#include <stdio.h>
  2323. Z
  2324. Z#define BIGINT    1000000
  2325. Z#define FOREVER while(1)
  2326. Z#define false 0
  2327. Z#define true 1
  2328. Z
  2329. Z#define PAGEWIDTH 7.9
  2330. Z#define PAGELENGTH 10.5
  2331. Z
  2332. Z/* defines for cmos-pw technology */
  2333. Z#define CW   1
  2334. Z#define CS   2
  2335. Z#define CD   3
  2336. Z#define CP   4
  2337. Z#define CM   5
  2338. Z#define CC   6
  2339. Z#define CM2  7
  2340. Z#define CC2  8
  2341. Z#define CZ   9
  2342. Z#define CG  10
  2343. Z
  2344. Z/* defines for SCMOS technology */
  2345. Z#define CWP  1
  2346. Z#define CSP  2
  2347. Z#define CAA  3
  2348. Z#define CPG  4
  2349. Z#define CMF  5
  2350. Z#define CCP  6
  2351. Z#define CCA  7
  2352. Z#define CMS  8
  2353. Z#define CVA  9
  2354. Z
  2355. Z#define MAXNAME        50
  2356. Z#define MAXSYMBOLS    200
  2357. Z#define MAXLINE        200
  2358. Z#define LAYERNAME    10
  2359. Z#define MAXLAYERS    11
  2360. Z#define MAXNINETY_FOUR    80
  2361. Z
  2362. Z#define DSTYPE        1
  2363. Z#define BOXTYPE        2
  2364. Z#define CALLTYPE    3
  2365. Z#define NINETY_FOURTYPE    4
  2366. Z#define WHITE    ' '
  2367. Z#define COMMA    ','
  2368. Z
  2369. Ztypedef    struct    {
  2370. Z    int    x, y;
  2371. Z    }    pointpairtype;
  2372. Z
  2373. Ztypedef struct    {
  2374. Z    int    layer;
  2375. Z    int    loc[4];
  2376. Z    }    boxtype;
  2377. Z
  2378. Ztypedef struct    {
  2379. Z    int    name, a, b;
  2380. Z    }    dstype;
  2381. Z
  2382. Ztypedef struct    {
  2383. Z    char    name[MAXNINETY_FOUR];
  2384. Z    int    x, y, layer;
  2385. Z    }    ninety_fourtype;
  2386. Z
  2387. Ztypedef struct    {
  2388. Z    int    symbol;
  2389. Z    float    matrix[3][3];
  2390. Z    }    calltype;
  2391. Z
  2392. Ztypedef    struct    symboldumb    {
  2393. Z    struct    symboldumb    *next;
  2394. Z    int    typer;
  2395. Z    union    {
  2396. Z        boxtype    *box;
  2397. Z        dstype    *ds;
  2398. Z        calltype    *call;
  2399. Z        ninety_fourtype    *ninety_four;
  2400. Z        }    primitive;
  2401. Z    }    symboltype;
  2402. Z
  2403. Ztypedef    struct    {
  2404. Z    int    symbol, a, b;
  2405. Z    char    name[MAXNAME];
  2406. Z    symboltype    *pointer;
  2407. Z    pointpairtype    ll, ur;
  2408. Z    }    tabletype;
  2409. Z
  2410. Ztypedef    struct    {
  2411. Z        char    name[LAYERNAME];
  2412. Z    }    layertype;
  2413. Z
  2414. Z
  2415. Zsymboltype    *allocsymbol();
  2416. Z
  2417. Ztabletype    symbol_table[MAXSYMBOLS];
  2418. ZFILE    *ciffile, *plotfile;
  2419. Zint    no_lines;
  2420. Zlayertype    layers[MAXLAYERS];
  2421. Zint    clip[MAXLAYERS];
  2422. Zint    layer, numlayers;
  2423. Zint    last_symbol, current_symbol_index;
  2424. Zsymboltype    *present_symbol;
  2425. Zfloat    scale, trans_x, trans_y, a_over_b;
  2426. Zfloat   scale2, scale2x, scale2y;
  2427. Zfloat    matrix[3][3];
  2428. Zfloat    slope;
  2429. Zfloat    step;
  2430. Zint    pagex,pagey;
  2431. Zint    length,width;
  2432. Zint    totpages;
  2433. Zint    size_font;
  2434. Zint    cmos_pw;
  2435. STUNKYFLUFF
  2436. set `sum define.h`
  2437. if test 38391 != $1
  2438. then
  2439. echo define.h: Checksum error. Is: $1, should be: 38391.
  2440. fi
  2441. #
  2442. #
  2443. echo Extracting makefile:
  2444. sed 's/^Z//' >makefile <<\STUNKYFLUFF
  2445. ZDEST          = /usr/cad/bin
  2446. ZLINKER          = cc 
  2447. ZOBJS          = cifgood.o \
  2448. Z        cif2ps.o \
  2449. Z        cifplot.o
  2450. Z
  2451. ZPROGRAM          = cif2ps
  2452. Z
  2453. ZSRCS          = cifgood.c \
  2454. Z        cif2ps.c \
  2455. Z        cifplot.c
  2456. Z
  2457. Zall:        $(PROGRAM)
  2458. Z
  2459. Z$(PROGRAM):     $(OBJS) $(LIBS)
  2460. Z        @echo -n "Loading $(PROGRAM) ... "
  2461. Z        @$(LINKER) $(OBJS) -o $(PROGRAM)
  2462. Z        @echo "done"
  2463. Z
  2464. Zclean:;        @rm -f $(OBJS)
  2465. Z
  2466. Zinstall:    $(PROGRAM)
  2467. Z        @echo Installing $(PROGRAM) in $(DEST)
  2468. Z        @install -s $(PROGRAM) $(DEST)
  2469. Z
  2470. Z###
  2471. Zcifgood.o: define.h /usr/include/stdio.h
  2472. Zcif2ps.o: /usr/include/ctype.h define.h /usr/include/stdio.h
  2473. Zcifplot.o: define.h /usr/include/stdio.h
  2474. STUNKYFLUFF
  2475. set `sum makefile`
  2476. if test 64413 != $1
  2477. then
  2478. echo makefile: Checksum error. Is: $1, should be: 64413.
  2479. fi
  2480. #
  2481. #
  2482. echo Extracting scmos.test.cif:
  2483. sed 's/^Z//' >scmos.test.cif <<\STUNKYFLUFF
  2484. ZDS 1 25 2;
  2485. Z9 loadadd11;
  2486. ZL CMF;
  2487. Z    B 48 12 216 3210;
  2488. Z    B 120 36 180 3186;
  2489. Z    B 36 12 138 3162;
  2490. ZC 2 MX R 0 -1 T 12 3348;
  2491. ZC 3 R 0 -1 T 276 3996;
  2492. ZC 3 R 0 -1 T 876 3996;
  2493. ZC 3 R 0 -1 T 1476 3996;
  2494. ZC 3 R 0 -1 T 2076 3996;
  2495. ZC 3 R 0 -1 T 2676 3996;
  2496. ZDF;
  2497. ZDS 3 25 2;
  2498. Z9 latch_left_pair;
  2499. ZL CMF;
  2500. Z    B 48 48 804 540;
  2501. Z    B 36 36 810 498;
  2502. Z    B 48 36 816 462;
  2503. Z    B 48 36 816 162;
  2504. Z    B 36 84 810 102;
  2505. Z    B 48 48 804 36;
  2506. ZC 2 MX R 1 0 T 648 336;
  2507. ZC 2 R -1 0 T 648 240;
  2508. ZDF;
  2509. ZDS 2 25 2;
  2510. Z9 latch;
  2511. ZL CWP;
  2512. Z    B 888 168 252 0;
  2513. Z    B 120 24 204 -96;
  2514. ZL CMS;
  2515. Z    B 96 300 -228 126;
  2516. Z    B 420 48 450 252;
  2517. Z    B 240 48 -12 204;
  2518. Z    B 48 60 84 150;
  2519. Z    B 48 48 480 144;
  2520. Z    B 48 36 -12 90;
  2521. Z    B 36 48 474 96;
  2522. Z    B 528 48 228 48;
  2523. Z    B 564 48 6 -48;
  2524. Z    B 96 300 612 78;
  2525. ZL CMF;
  2526. Z    B 108 48 234 252;
  2527. Z    B 48 48 -108 204;
  2528. Z    B 48 84 -12 186;
  2529. Z    B 120 36 -48 126;
  2530. Z    B 48 108 84 174;
  2531. Z    B 60 48 198 204;
  2532. Z    B 48 12 372 222;
  2533. Z    B 72 36 360 198;
  2534. Z    B 48 48 468 204;
  2535. Z    B 48 12 576 222;
  2536. Z    B 72 36 588 198;
  2537. Z    B 36 84 -90 66;
  2538. Z    B 48 48 -12 84;
  2539. Z    B 36 96 90 72;
  2540. Z    B 36 72 342 144;
  2541. Z    B 36 12 474 174;
  2542. Z    B 48 24 480 156;
  2543. Z    B 216 36 252 90;
  2544. Z    B 108 24 450 132;
  2545. Z    B 96 24 444 108;
  2546. Z    B 48 12 168 66;
  2547. Z    B 36 24 342 60;
  2548. Z    B 36 36 474 78;
  2549. Z    B 60 48 -102 0;
  2550. Z    B 144 36 36 6;
  2551. Z    B 48 12 -12 -18;
  2552. Z    B 48 12 84 -18;
  2553. Z    B 48 48 204 0;
  2554. Z    B 72 36 360 30;
  2555. Z    B 60 36 486 42;
  2556. Z    B 36 156 606 102;
  2557. Z    B 48 36 372 -6;
  2558. Z    B 48 48 504 0;
  2559. Z    B 48 48 612 0;
  2560. Z    B 108 48 234 -48;
  2561. ZL CPG;
  2562. Z    B 24 300 -60 102;
  2563. Z    B 24 300 36 102;
  2564. Z    B 24 120 132 168;
  2565. Z    B 24 96 324 180;
  2566. Z    B 48 12 420 138;
  2567. Z    B 132 24 378 120;
  2568. Z    B 24 144 528 180;
  2569. Z    B 72 48 156 84;
  2570. Z    B 24 84 132 18;
  2571. Z    B 24 132 324 42;
  2572. Z    B 48 12 420 102;
  2573. Z    B 36 24 522 96;
  2574. Z    B 24 24 516 72;
  2575. Z    B 24 192 624 156;
  2576. Z    B 84 24 486 48;
  2577. Z    B 84 24 594 48;
  2578. Z    B 24 84 456 -6;
  2579. Z    B 24 84 564 -6;
  2580. ZL CAA;
  2581. Z    B 48 48 204 252;
  2582. Z    B 48 24 -12 216;
  2583. Z    B 48 24 84 216;
  2584. Z    B 60 24 198 216;
  2585. Z    B 48 24 372 216;
  2586. Z    B 432 24 180 192;
  2587. Z    B 48 24 468 216;
  2588. Z    B 48 24 576 216;
  2589. Z    B 156 24 522 192;
  2590. Z    B 144 24 -60 12;
  2591. Z    B 48 24 -108 -12;
  2592. Z    B 48 24 -12 -12;
  2593. Z    B 336 24 228 12;
  2594. Z    B 48 24 84 -12;
  2595. Z    B 48 72 204 -36;
  2596. Z    B 48 24 372 -12;
  2597. Z    B 156 24 558 12;
  2598. Z    B 48 24 504 -12;
  2599. Z    B 48 24 612 -12;
  2600. ZL CVA;
  2601. Z    B 24 24 264 252;
  2602. Z    B 24 24 -108 204;
  2603. Z    B 24 24 84 144;
  2604. Z    B 24 24 480 144;
  2605. Z    B 24 24 -12 84;
  2606. Z    B 24 24 264 -48;
  2607. ZL CCA;
  2608. Z    B 24 24 -12 204;
  2609. Z    B 24 24 84 204;
  2610. Z    B 24 24 198 204;
  2611. Z    B 24 24 372 204;
  2612. Z    B 24 24 468 204;
  2613. Z    B 24 24 576 204;
  2614. Z    B 24 24 -108 0;
  2615. Z    B 24 24 -12 0;
  2616. Z    B 24 24 84 0;
  2617. Z    B 24 24 204 0;
  2618. Z    B 24 24 372 0;
  2619. Z    B 24 24 504 0;
  2620. Z    B 24 24 612 0;
  2621. ZL CCA;
  2622. Z    B 24 24 204 252;
  2623. Z    B 24 24 204 -48;
  2624. ZL CCP;
  2625. Z    B 24 24 420 120;
  2626. Z    B 24 24 168 84;
  2627. ZL CSP;
  2628. Z    B 240 24 60 240;
  2629. Z    B 300 24 474 240;
  2630. Z    B 684 72 282 192;
  2631. Z    B 96 72 204 -60;
  2632. Z94 GND -120 -48 CMS;
  2633. Z94 phi1_bar 456 -48 CPG;
  2634. Z94 Vdd 468 276 CMS;
  2635. Z94 phi1 564 -48 CPG;
  2636. Z94 in 636 0;
  2637. Z94 Vdd 612 -72 CMS;
  2638. Z94 out -108 204 CMF;
  2639. Z94 i1 504 0;
  2640. Z94 i2 168 84;
  2641. Z94 phi2 -60 252 CPG;
  2642. Z94 phi2_bar 36 252 CPG;
  2643. ZDF;
  2644. ZC 1;
  2645. ZEnd
  2646. STUNKYFLUFF
  2647. set `sum scmos.test.cif`
  2648. if test 53930 != $1
  2649. then
  2650. echo scmos.test.cif: Checksum error. Is: $1, should be: 53930.
  2651. fi
  2652. echo ALL DONE!
  2653. exit 0
  2654.  
  2655.  
  2656.