home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume4 / cif2ps < prev    next >
Text File  |  1989-02-03  |  55KB  |  2,652 lines

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