home *** CD-ROM | disk | FTP | other *** search
- From mipos3!intelca!oliveb!ames!necntc!ncoast!allbery Tue Sep 20 18:26:25 PDT 1988
- Article 537 of comp.sources.misc:
- Path: td2cad!mipos3!intelca!oliveb!ames!necntc!ncoast!allbery
- From: system@noao.UUCP (Marc Lesure)
- Newsgroups: comp.sources.misc
- Subject: v04i081: cif2ps - CIF to Postscript
- Keywords: CIF postscript
- Message-ID: <353@asuvax.UUCP>
- Date: 20 Sep 88 01:08:52 GMT
- Sender: allbery@ncoast.UUCP
- Reply-To: system@noao.UUCP (Marc Lesure)
- Organization: Arizona State Univ, Tempe
- Lines: 2638
- Approved: allbery@ncoast.UUCP
-
- Posting-number: Volume 4, Issue 81
- Submitted-by: "Marc Lesure" <system@noao.UUCP>
- Archive-name: cif2ps
-
- Here is `cif2ps`, the CIF to Postscript program. We use this program in
- place of `cifplot`.
-
- -----------------------------------------------------------------------
- Marc Lesure / Arizona State University / Tempe, AZ
- "Between the world of men and make-believe, I can be found..."
- "False faces and meaningless chases, I travel alone..."
- "And where do you go when you come to the end of your dream?"
-
- UUCP: ...!ncar!noao!asuvax!lesure
- Internet/CSNET/ARPA: lesure@asuvax.asu.edu
-
- #--------CUT---------CUT---------CUT---------CUT--------#
- #########################################################
- # #
- # This is a shell archive file. To extract files: #
- # #
- # 1) Make a directory for the files. #
- # 2) Write a file, such as "file.shar", containing #
- # this archive file into the directory. #
- # 3) Type "sh file.shar". Do not use csh. #
- # #
- #########################################################
- #
- #
- echo Extracting README:
- sed 's/^Z//' >README <<\STUNKYFLUFF
- ZThis code was orginally written by Arthur Simoneau, The Aerospace Corporation,
- ZEl Segundo, Calif. and was called 'cifp'. 'cifp' would only take MAGIC
- ZSCMOS cif input and generate postscript for a single page of output.
- Z
- ZI've since taken it and modified it to accept cmos-pw technology for our
- Zlocal needs at Arizona State University. The biggest improvement I made
- Zwas to get multiple page output. Each page is numbered with (x,y) coordinates
- Zso you know its proper sequence. Also each page overlaps with its neighbor,
- Zso you can cut and paste if you want. The program will rescale the
- Zuser-specific scale to avoid producing blank pages. A scaling limit of 5
- Zby 5 has been put in the program to eliminate massive outputs. Cif2ps can
- Zgenerate a postscript file in the multi-megabyte range very easily.
- ZI renamed the program to 'cif2ps' to be more descriptive of its function.
- Z
- ZTwo test files have been included, cmos-pw.test.cif and scmos.test.cif.
- ZThe file cmos-pw.test.cif was generated using the IGS2CIF program version
- Z2a.04 on a HP EGS Graphics system. The file scmos.test.cif is from the
- Zoriginal 'cifp' distribution. To plot this file you must use the '-T'
- Zoption on 'cif2ps'.
- Z
- ZCif2ps is now used here in place of cifplot from the Berkeley VSLI
- Zdistribution.
- Z
- ZSTANDARD DISCLAMER:
- Z-------------------
- ZThe authors and their organizations assume no responsibility for the use
- Zby the recipient of this program.
- Z
- ZMarc Lesure
- ZEngineering Computer Services
- ZArizona State Univerity
- Z
- STUNKYFLUFF
- set `sum README`
- if test 47634 != $1
- then
- echo README: Checksum error. Is: $1, should be: 47634.
- fi
- #
- #
- echo Extracting Readme.cifp:
- sed 's/^Z//' >Readme.cifp <<\STUNKYFLUFF
- ZThis is the original READ.ME file from the 'cifp' distribution. I've
- Zincluded it for completeness. (ml)
- Z-------------------------------------------------------------------------------
- Z
- ZIf somebody wants to midify this code you should be aware that the
- Zorder of the "filled boxes" are important. The last filled box wins all of
- Zthe pixels and so improper order can cause the p-well to obliterate all of
- Zthe CIF geometries.
- Z
- ZI will be maintaining this code and adding missing features as they become
- Zdesirable, so instead of re-inventing the wheel you should contact me before
- Zmakeing any changes to see if I have already done them. Also, I would like to
- Zmaintain knowledge of where this code is so I would appreciate any new sites
- Zrequest the code from me rather than siphoning it from another site.
- Z
- ZI will gladly respond to any bug reports if a suitable example displaying the
- Zbug is sent to me.
- Z
- ZCheers,
- ZArthur Simoneau
- ZThe Aerospace Corporation
- ZEl Segundo, Calif
- Z
- Zart@aerospace
- STUNKYFLUFF
- set `sum Readme.cifp`
- if test 05164 != $1
- then
- echo Readme.cifp: Checksum error. Is: $1, should be: 05164.
- fi
- #
- #
- echo Extracting cif2ps.c:
- sed 's/^Z//' >cif2ps.c <<\STUNKYFLUFF
- Z/*
- Z cif2ps is based on the program 'cifp' originally written by
- Z Arthur Simoneau, The Aerospace Corporation, El Segundo, Calif
- Z
- Z Changes to 'cifp' include support of cmos-pw layers, scaling
- Z factors to spread output over several pages of 8.5 x 11 paper,
- Z printing multiple layers.
- Z
- Z Modified by Marc Lesure, Arizona State University, Tempe, AZ
- Z
- Z Please honor the authors by not removing names from the source codes.
- Z*/
- Z#include <ctype.h>
- Z#include "define.h"
- Z
- Zint maxwidth = 5;
- Zint maxlength = 5;
- Z
- Zmain(argc, argv)
- Zint argc;
- Zchar *argv[];
- Z
- Z{
- Z char *s,*cifname,*plotname;
- Z
- Z length = width = 1;
- Z totpages = 0;
- Z size_font = false;
- Z cmos_pw = 1;
- Z while (argc-- > 1 && (*++argv)[0] == '-') {
- Z s = argv[0] + 1;
- Z switch (*s) {
- Z
- Z case 'w':
- Z width = atoi(*++argv);
- Z argc--;
- Z break;
- Z
- Z case 'h':
- Z length = atoi(*++argv);
- Z argc--;
- Z break;
- Z
- Z case 's':
- Z size_font = true;
- Z break;
- Z
- Z case 'T':
- Z cmos_pw++;
- Z break;
- Z
- Z default:
- Z printf("cif2ps: unknown flag - %s\n",*s);
- Z exit(0);
- Z }
- Z }
- Z if (argc != 2) {
- Z printf("Usage: cif2ps [-w width] [-h height] input output\n");
- Z exit(0);
- Z }
- Z cifname = *argv++;
- Z if ((ciffile = fopen(cifname, "r")) == NULL)
- Z {
- Z fprintf(stderr, "can't open %s\n", cifname);
- Z exit(1);
- Z }
- Z plotname = *argv;
- Z if ((plotfile = fopen(plotname, "w")) == NULL)
- Z {
- Z fprintf(stderr, "can't open %s\n", plotname);
- Z exit(1);
- Z }
- Z if (width <= 0) {
- Z printf("-w exceeds lower limit - setting to 1\n");
- Z width = 1;
- Z }
- Z if (length <= 0) {
- Z printf("-l exceeds lower limit - setting to 1\n");
- Z length = 1;
- Z }
- Z if (width > maxwidth) {
- Z printf("-w exceeds upper limit - setting to %d\n",maxwidth);
- Z width = maxwidth;
- Z }
- Z if (length > maxlength) {
- Z printf("-l exceeds upper limit - setting to %d\n",maxlength);
- Z length = maxlength;
- Z }
- Z init();
- Z do_cif();
- Z plotcif();
- Z printf("Complete plot contains %d pages\n",totpages);
- Z#ifdef DEBUG
- Zoutput_all_symbols(stderr);
- Z#endif
- Z} /*main*/
- Z
- Z
- Z
- Z#ifdef DEBUG
- Zoutput_all_symbols(filer)
- ZFILE *filer;
- Z
- Z{
- Zint i;
- Z
- Z for (i = 0; i <= last_symbol; i++)
- Z output_symboldef(filer, i);
- Z} /*output_all_symbols*/
- Z#endif
- Z
- Z
- Zplotcif()
- Z{
- Zint symbol_num, i, plotted_one;
- Zchar namein[MAXNAME];
- Zpointpairtype ll, ur;
- Z
- Z plotted_one = 0;
- Z FOREVER
- Z {
- Z if (ciffile == stdin)
- Z symbol_num = 0; /*top_level*/
- Z else
- Z {
- Z FOREVER
- Z {
- Z fprintf(stderr, "What symbol do you want to plot?\n");
- Z i = 0;
- Z while ((namein[i] = getchar()) != '\n')
- Z {
- Z if (namein[i] == EOF)
- Z {
- Z if (( !plotted_one) &&
- Z (plotfile == stdout))
- Z {
- Z namein[0] = '0';
- Z i = 1;
- Z break;
- Z }
- Z else
- Z return;
- Z }
- Z i++;
- Z }
- Z namein[i] = '\0';
- Z if (i == 0) /*terminate run*/
- Z return;
- Z
- Z symbol_num = get_index_char(namein);
- Z if (symbol_num != -1)
- Z break;
- Z
- Z fprintf(stderr, "couldn't find that symbol\n");
- Z output_all_symbolnums(stderr);
- Z } /*FOREVER*/
- Z }
- Z
- Z plotted_one++;
- Z ll.x = BIGINT;
- Z ur.x = -BIGINT;
- Z ll.y = BIGINT;
- Z ur.y = -BIGINT;
- Z get_bounds(symbol_num, &ll, &ur);
- Z if ((ll.x == BIGINT) || (ll.y == BIGINT))
- Z {
- Z fprintf(stderr, "Error in bounds %d %d and %d %d\n",
- Z ll.x, ll.y, ur.x, ur.y);
- Z return;
- Z }
- Z
- Z if (plotted_one == 1) {
- Z get_window(&ll, &ur);
- Z init_cif();
- Z }
- Z prolog();
- Z for(pagey=0; pagey < length; pagey++)
- Z for(pagex=0; pagex < width; pagex++) {
- Z prelog();
- Z plot_boxes(symbol_table[symbol_num].pointer);
- Z plot_textes(symbol_table[symbol_num].pointer);
- Z epilog();
- Z }
- Z if (ciffile == stdin)
- Z return;
- Z } /*FOREVER*/
- Z} /*plotcif*/
- Z
- Z
- Z int
- Zget_index_char(foobar)
- Zchar *foobar;
- Z
- Z{
- Zint i, bar;
- Z
- Z for(i = 0; i <= last_symbol; i++)
- Z {
- Z if (equal_strings(symbol_table[i].name, foobar))
- Z return(i);
- Z }
- Z
- Z for(i = 0; i < MAXNAME; i++)
- Z {
- Z if (foobar[i] == '\0')
- Z {
- Z (void) sscanf(foobar, "%d", &bar);
- Z return(get_index(bar));
- Z }
- Z else if ( !isdigit(foobar[i]))
- Z return(-1);
- Z }
- Z
- Z return(-1);
- Z} /*get_index_char*/
- Z
- Z
- Z
- Zget_window(ll, ur)
- Zpointpairtype *ll, *ur;
- Z
- Z{
- Zfloat scalex, scaley;
- Zfloat deltax, deltay;
- Zint newlength, newwidth;
- Z
- Z trans_x = - ll->x;
- Z trans_y = - ll->y;
- Z
- Z scalex = (width * PAGEWIDTH) / (deltax = (ur->x - ll->x));
- Z scaley = (length * PAGELENGTH) / (deltay = (ur->y - ll->y));
- Z if (scalex < scaley)
- Z {
- Z scale = scalex;
- Z scale2 = 1.0/deltax;
- Z scale2y = deltay/deltax;
- Z scale2x = 1.0;
- Z newlength = ((deltay * scale) / PAGELENGTH) + 1;
- Z if (newlength != length) {
- Z printf("output size changed to %d by %d\n",
- Z width,newlength);
- Z length = newlength;
- Z }
- Z }
- Z else
- Z {
- Z scale = scaley;
- Z scale2 = 1.0/deltay;
- Z scale2y = 1.0;
- Z scale2x = deltax/deltay;
- Z newwidth = ((deltax * scale) / PAGEWIDTH) + 1;
- Z if (newwidth != width) {
- Z printf("output size changed to %d by %d\n",
- Z newwidth,length);
- Z width = newwidth;
- Z }
- Z }
- Z#ifdef DEBUG
- Zfprintf(stderr, "scale %f, scalex %f, scaley %f, deltax %f, deltay %f\n",
- Z scale, scalex, scaley, deltax, deltay);
- Z#endif
- Z} /*get_window*/
- Z
- Z
- Z
- Zplot_boxes(symbol)
- Zsymboltype *symbol;
- Z
- Z{
- Zint i, num_clip, plot_boxes_sub();
- Z
- Z num_clip = 0;
- Z for (i = 1; i < numlayers; i++)
- Z {
- Z plot_change_layer(i);
- Z num_clip = 0;
- Z num_clip = plot_boxes_sub(symbol, num_clip);
- Z } /*for loop*/
- Z plot_change_layer(0);
- Z} /*plot_boxes*/
- Z
- Z
- Z
- Z
- Z int
- Zplot_boxes_sub(symbol, num_clip)
- Zsymboltype *symbol;
- Zint num_clip;
- Z
- Z{
- Zboxtype *box;
- Zfloat temp_matrix[3][3];
- Z
- Z while(symbol != NULL)
- Z {
- Z switch(symbol->typer)
- Z {
- Z case BOXTYPE:
- Z box = symbol->primitive.box;
- Z if (box->layer == layer)
- Z {
- Z plot_box(box);
- Z if (clip[layer] && (++num_clip > 50))
- Z {
- Z num_clip = 0;
- Z start_clipping();
- Z }
- Z }
- Z break;
- Z case CALLTYPE:
- Z copy_matrix(matrix, temp_matrix);
- Z hit_matrix(matrix,
- Z symbol->primitive.call->matrix, matrix);
- Z num_clip = plot_boxes_sub(
- Z symbol_table[symbol->primitive.call->symbol].pointer, num_clip);
- Z
- Z copy_matrix(temp_matrix, matrix);
- Z break;
- Z case DSTYPE:
- Z case NINETY_FOURTYPE:
- Z break;
- Z default:
- Z fprintf(stderr, "ERROR Not known %d in plot boxes\n",
- Z symbol->typer);
- Z break;
- Z }
- Z
- Z symbol = symbol->next;
- Z }
- Z
- Z return(num_clip);
- Z} /*plot_boxes_sub*/
- Z
- Z
- Z
- Zplot_textes(symbol)
- Zsymboltype *symbol;
- Z
- Z{
- Zninety_fourtype *ninety_four;
- Z
- Z start_text();
- Z while(symbol != NULL)
- Z {
- Z switch(symbol->typer)
- Z {
- Z case CALLTYPE:
- Z case DSTYPE:
- Z case BOXTYPE:
- Z break;
- Z case NINETY_FOURTYPE:
- Z ninety_four = symbol->primitive.ninety_four;
- Z plot_text(ninety_four);
- Z break;
- Z default:
- Z fprintf(stderr, "ERROR Not known %d in plot text\n",
- Z symbol->typer);
- Z break;
- Z }
- Z
- Z symbol = symbol->next;
- Z }
- Z} /*plot_textes*/
- Z
- Z
- Z
- Zget_bounds(sym, ll, ur)
- Zint sym;
- Zpointpairtype *ll, *ur;
- Z
- Z{
- Zint local_sym;
- Zsymboltype *symbol;
- Zboxtype *box;
- Zpointpairtype local_ll, local_ur;
- Z
- Z symbol = symbol_table[sym].pointer;
- Z while(symbol != NULL)
- Z {
- Z switch(symbol->typer)
- Z {
- Z case DSTYPE:
- Z case NINETY_FOURTYPE:
- Z break;
- Z case BOXTYPE:
- Z box = symbol->primitive.box;
- Z if (box->loc[0] < ll->x)
- Z ll->x = box->loc[0];
- Z if (box->loc[2] > ur->x)
- Z ur->x = box->loc[2];
- Z if (box->loc[1] < ll->y)
- Z ll->y = box->loc[1];
- Z if (box->loc[3] > ur->y)
- Z ur->y = box->loc[3];
- Z break;
- Z case CALLTYPE:
- Z local_sym = symbol->primitive.call->symbol;
- Z if (symbol_table[local_sym].ll.x == BIGINT)
- Z {
- Z get_bounds(local_sym,
- Z &(symbol_table[local_sym].ll),
- Z &(symbol_table[local_sym].ur));
- Z }
- Z copy_matrix(symbol->primitive.call->matrix, matrix);
- Z get_pair(symbol_table[local_sym].ll.x,
- Z symbol_table[local_sym].ll.y, &local_ll);
- Z get_pair(symbol_table[local_sym].ur.x,
- Z symbol_table[local_sym].ur.y, &local_ur);
- Z
- Z identity_matrix(matrix);
- Z if (local_ll.x < ll->x)
- Z ll->x = local_ll.x;
- Z if (local_ur.x < ll->x)
- Z ll->x = local_ur.x;
- Z if (local_ll.x > ur->x)
- Z ur->x = local_ll.x;
- Z if (local_ur.x > ur->x)
- Z ur->x = local_ur.x;
- Z if (local_ll.y < ll->y)
- Z ll->y = local_ll.y;
- Z if (local_ur.y < ll->y)
- Z ll->y = local_ur.y;
- Z if (local_ll.y > ur->y)
- Z ur->y = local_ll.y;
- Z if (local_ur.y > ur->y)
- Z ur->y = local_ur.y;
- Z break;
- Z default:
- Z fprintf(stderr, "ERROR Not known %d in get_bounds\n",
- Z symbol->typer);
- Z break;
- Z }
- Z
- Z symbol = symbol->next;
- Z }
- Z} /*get_bounds*/
- Z
- Z
- Zget_pair(x, y, pair)
- Zint x, y;
- Zpointpairtype *pair;
- Z
- Z{
- Z pair->x = (x * matrix[0][0]) + (y * matrix[0][1]) + matrix[0][2];
- Z pair->y = (x * matrix[1][0]) + (y * matrix[1][1]) + matrix[1][2];
- Z} /*get_pair*/
- Z
- Z
- Z
- Zcall_symbol(cif)
- Zchar *cif;
- Z
- Z{
- Zint last_read, callnum;
- Zchar token[MAXNAME];
- Zchar ciftemp[MAXLINE];
- Zint rotate_x, rotate_y;
- Zfloat multi_matrix[3][3];
- Zfloat temp_a_over_b, translate_x, translate_y;
- Zcalltype *call, *alloccall();
- Z
- Z bang_symbol();
- Z present_symbol->typer = CALLTYPE;
- Z call = alloccall();
- Z present_symbol->primitive.call = call;
- Z
- Z last_read = get_token(cif, 2, token);
- Z if (last_read == -1)
- Z {
- Z fprintf(stderr, "no symbol in CALL\n");
- Z output_cif(stderr, cif);
- Z return;
- Z }
- Z (void) sscanf(token, "%d", &callnum);
- Z call->symbol = get_index(callnum);
- Z if (call->symbol == -1)
- Z {
- Z sprintf(ciftemp, "DS %d", callnum);
- Z temp_a_over_b = a_over_b;
- Z ds(ciftemp, CALLTYPE);
- Z a_over_b = temp_a_over_b;
- Z
- Z call->symbol = get_index(callnum);
- Z if (call->symbol == -1)
- Z {
- Z fprintf(stderr, "Error in call cif\n");
- Z output_cif(stderr, cif);
- Z }
- Z }
- Z
- Z identity_matrix(multi_matrix);
- Z FOREVER
- Z {
- Z last_read = get_token(cif, last_read, token);
- Z if (last_read == -1) break;
- Z
- Z if (token[0] == 'M')
- Z {
- Z switch(token[1])
- Z {
- Z case 'X':
- Z multi_matrix[0][0] = -1;
- Z hit_matrix(multi_matrix, call->matrix,
- Z call->matrix);
- Z multi_matrix[0][0] = 1;
- Z break;
- Z case 'Y':
- Z multi_matrix[1][1] = -1;
- Z hit_matrix(multi_matrix, call->matrix,
- Z call->matrix);
- Z multi_matrix[1][1] = 1;
- Z break;
- Z default:
- Z fprintf(stderr, "Error in mirror %c\n", token[1]);
- Z output_cif(stderr, cif);
- Z break;
- Z } /*switch mirror*/
- Z } /*if mirror*/
- Z else if (token[0] == 'R')
- Z {
- Z last_read = get_token(cif, last_read, token);
- Z if (last_read == -1)
- Z {
- Z fprintf(stderr, "error in rotate\n");
- Z output_cif(stderr, cif);
- Z break;
- Z }
- Z (void) sscanf(token, "%d", &rotate_x);
- Z rotate_x = sign(rotate_x);
- Z last_read = get_token(cif, last_read, token);
- Z if (last_read == -1)
- Z {
- Z fprintf(stderr, "error2 in rotate\n");
- Z output_cif(stderr, cif);
- Z break;
- Z }
- Z (void) sscanf(token, "%d", &rotate_y);
- Z rotate_y = sign(rotate_y);
- Z switch(rotate_x)
- Z {
- Z case 1:
- Z if (rotate_y != 0)
- Z fprintf(stderr, "Bad rotation x %d y %d\n",
- Z rotate_x, rotate_y);
- Z break;
- Z case -1:
- Z if (rotate_y != 0)
- Z {
- Z fprintf(stderr, "Bad rotation x %d y %d\n",
- Z rotate_x, rotate_y);
- Z break;
- Z }
- Z multi_matrix[0][0] = -1;
- Z multi_matrix[1][1] = -1;
- Z hit_matrix(multi_matrix, call->matrix, call->matrix);
- Z identity_matrix(multi_matrix);
- Z break;
- Z case 0:
- Z switch(rotate_y)
- Z {
- Z case 1:
- Z multi_matrix[0][0] = 0;
- Z multi_matrix[1][1] = 0;
- Z multi_matrix[0][1] = -1;
- Z multi_matrix[1][0] = 1;
- Z hit_matrix(multi_matrix, call->matrix,
- Z call->matrix);
- Z identity_matrix(multi_matrix);
- Z break;
- Z case -1:
- Z multi_matrix[0][0] = 0;
- Z multi_matrix[1][1] = 0;
- Z multi_matrix[0][1] = 1;
- Z multi_matrix[1][0] = -1;
- Z hit_matrix(multi_matrix, call->matrix,
- Z call->matrix);
- Z identity_matrix(multi_matrix);
- Z break;
- Z default:
- Z fprintf(stderr, "Bad rotation x %d y %d\n",
- Z rotate_x, rotate_y);
- Z break;
- Z } /*switch y*/
- Z break;
- Z default:
- Z fprintf(stderr, "Bad rotation x %d y %d\n",
- Z rotate_x, rotate_y);
- Z break;
- Z } /*switch rotation*/
- Z } /*if rotate*/
- Z else if (token[0] == 'T')
- Z {
- Z last_read = get_token(cif, last_read, token);
- Z if (last_read == -1)
- Z {
- Z fprintf(stderr, "error in translate\n");
- Z output_cif(stderr, cif);
- Z break;
- Z }
- Z (void) sscanf(token, "%f", &translate_x);
- Z translate_x *= a_over_b;
- Z
- Z last_read = get_token(cif, last_read, token);
- Z if (last_read == -1)
- Z {
- Z fprintf(stderr, "error2 in translate\n");
- Z output_cif(stderr, cif);
- Z break;
- Z }
- Z (void) sscanf(token, "%f", &translate_y);
- Z translate_y *= a_over_b;
- Z
- Z if ((translate_x != 0) || (translate_y != 0))
- Z {
- Z multi_matrix[0][2] = translate_x;
- Z multi_matrix[1][2] = translate_y;
- Z hit_matrix(multi_matrix, call->matrix, call->matrix);
- Z identity_matrix(multi_matrix);
- Z }
- Z } /*if translate*/
- Z else
- Z {
- Z fprintf(stderr, "error---out of calls\n");
- Z output_cif(stderr, cif);
- Z fprintf(stderr, "\ttoken %s\n", token);
- Z break;
- Z }
- Z } /*FOREVER*/
- Z
- Z} /*call_symbol*/
- Z
- Zsign(x)
- Zint x;
- Z{
- Z int z;
- Z
- Z z = 0;
- Z if (x > 0) z = 1;
- Z if (x < 0) z = -1;
- Z return(z);
- Z}
- Z
- Z
- Z#ifdef DEBUG
- Zoutput_matrix(filer, matrix)
- ZFILE *filer;
- Zfloat matrix[3][3];
- Z
- Z{
- Zint i, j;
- Z
- Z for(i = 0; i < 3; i++)
- Z {
- Z fprintf(filer, "[");
- Z for(j = 0; j < 3; j++)
- Z fprintf(filer, "\t%f", matrix[i][j]);
- Z fprintf(filer, "]\n");
- Z }
- Z} /*output_matrix*/
- Z#endif
- Z
- Z
- Zidentity_matrix(matrix)
- Zfloat matrix[3][3];
- Z
- Z{
- Z matrix[0][0] = 1;
- Z matrix[0][1] = 0;
- Z matrix[0][2] = 0;
- Z matrix[1][0] = 0;
- Z matrix[1][1] = 1;
- Z matrix[1][2] = 0;
- Z matrix[2][0] = 0;
- Z matrix[2][1] = 0;
- Z matrix[2][2] = 1;
- Z} /*identity_matrix*/
- Z
- Z
- Z
- Zhit_matrix(left_matrix, right_matrix, to_matrix)
- Zfloat left_matrix[3][3], right_matrix[3][3], to_matrix[3][3];
- Z
- Z{
- Zint i, j;
- Zfloat temp[3][3];
- Z
- Z for(i = 0; i < 3; i++)
- Z {
- Z for(j = 0; j < 3; j++)
- Z temp[i][j] = (left_matrix[i][0] * right_matrix[0][j]) +
- Z (left_matrix[i][1] * right_matrix[1][j]) +
- Z (left_matrix[i][2] * right_matrix[2][j]);
- Z }
- Z
- Z copy_matrix(temp, to_matrix);
- Z} /*hit_matrix*/
- Z
- Z
- Z
- Zcopy_matrix(from_matrix, to_matrix)
- Zfloat from_matrix[3][3], to_matrix[3][3];
- Z
- Z{
- Zint i, j;
- Z
- Z for(i = 0; i < 3; i++)
- Z {
- Z for(j = 0; j < 3; j++)
- Z to_matrix[i][j] = from_matrix[i][j];
- Z }
- Z} /*copy_matrix*/
- STUNKYFLUFF
- set `sum cif2ps.c`
- if test 16103 != $1
- then
- echo cif2ps.c: Checksum error. Is: $1, should be: 16103.
- fi
- #
- #
- echo Extracting cif2ps.man:
- sed 's/^Z//' >cif2ps.man <<\STUNKYFLUFF
- Z.TH CIF2PS LOCAL "15 May 1988"
- Z.UC 4
- Z.SH NAME
- ZCif2ps \- CIF to postscript output
- Z.SH SYNOPSIS
- Z.B cif2ps
- Z[-w width] [-h height] [-T] input.cif output.ps
- Z.br
- Z.SH DESCRIPTION
- Z.I Cif2ps
- Ztakes a CIF file that has been produced by Magic or EGS graphics editor
- Zand creates a file that can
- Zbe sent to the plotter of choice. The code was written with the CIF layer
- Znames hard coded in. This means that this code will only work with cmos-pw
- Zor MOSIS's SCMOS designs.
- Z.PP
- Z.I Cif2ps
- Zoptions are :
- Z.TP
- Z.B \-w
- Zspecify width of plot (in pages, default is 1)
- Z.TP
- Z.B \-h
- Zspecify height of plot (in pages, default is 1)
- Z.PP
- Z.I Cif2ps
- Zwill rescale a user-specific dimension if neccesary to avoid
- Zproducing blank pages. The largest dimesion allowed is 5 pages by 5 pages
- Z(25 pages of output).
- Z.TP
- Z.B \-T
- Zuse SCMOS design rules (default is cmos-pw)
- Z.SH "SEE ALSO"
- Zmagic
- Z.SH AUTHOR
- ZArthur Simoneau wrote the version 'cifp'.
- ZMarc Lesure modified 'cifp' to produce 'cif2ps'.
- Z.SH FILES
- Zinput.cif and output.ps
- Z.SH BUGS
- Z.I Cif2ps
- Zshould be technology independent, but at least all of the technology
- Zdependence is in one file.
- STUNKYFLUFF
- set `sum cif2ps.man`
- if test 17538 != $1
- then
- echo cif2ps.man: Checksum error. Is: $1, should be: 17538.
- fi
- #
- #
- echo Extracting cifgood.c:
- sed 's/^Z//' >cifgood.c <<\STUNKYFLUFF
- Z/*
- Z cif2ps is based on the program 'cifp' originally written by
- Z Arthur Simoneau, The Aerospace Corporation, El Segundo, Calif
- Z
- Z Changes to 'cifp' include support of cmos-pw layers, scaling
- Z factors to spread output over several pages of 8.5 x 11 paper,
- Z printing multiple layers.
- Z
- Z Modified by Marc Lesure, Arizona State University, Tempe, AZ
- Z
- Z Please honor the authors by not removing names from the source codes.
- Z*/
- Z#include "define.h"
- Z
- Z#define DELTA_A 'a' - 'A'
- Z
- Zchar *malloc();
- Z
- Zinit_cif()
- Z{
- Z layer = 0;
- Z} /*init_cif*/
- Z
- Z
- Zget_next_cifline(stringer)
- Zchar *stringer;
- Z
- Z{
- Zint i;
- Zchar c;
- Z
- Z for(i = 0; i < MAXLINE; i++)
- Z {
- Z c = fgetc(ciffile);
- Z if (c == ';')
- Z {
- Z stringer[i] = '\0';
- Z return(i);
- Z }
- Z else if (c == '\n')
- Z {
- Z stringer[i] = ' ';
- Z no_lines++;
- Z }
- Z else if (c == EOF)
- Z {
- Z stringer[i] = '\0';
- Z return(EOF);
- Z }
- Z else if (c == '(')
- Z {
- Z while (fgetc(ciffile) != ')') ;
- Z }
- Z else
- Z stringer[i] = c;
- Z }
- Z
- Z fprintf(stderr, "Cifline exceeded bounds\n");
- Z stringer[i] = '\0';
- Z output_cif(stderr, stringer);
- Z exit(1);
- Z} /*get_next_cifline*/
- Z
- Z
- Z
- Zoutput_cif(filer, cif)
- ZFILE *filer;
- Zchar *cif;
- Z
- Z{
- Z fprintf(filer, "%s\t\t(*near line %d*)\n", cif, no_lines);
- Z} /*output_cif*/
- Z
- Z
- Ztrim_cif(cif)
- Zchar *cif;
- Z
- Z{
- Zint i, j, toggle_white;
- Z
- Z i = 0;
- Z j = 0;
- Z toggle_white = 1; /*so no white at beginning*/
- Z for (i = 0; i < MAXLINE; i++)
- Z {
- Z if (cif[i] == COMMA)
- Z {
- Z cif[i] = WHITE;
- Z }
- Z if (cif[i] == '\0')
- Z {
- Z cif[j] = '\0';
- Z return;
- Z }
- Z else if (white(cif[i]))
- Z {
- Z if ( !toggle_white) /*makes one white space*/
- Z {
- Z cif[j++] = ' ';
- Z toggle_white = 1;
- Z }
- Z }
- Z else
- Z {
- Z cif[j++] = cif[i];
- Z if (toggle_white) toggle_white = 0;
- Z }
- Z } /*for*/
- Z} /*trim_cif*/
- Z
- Z
- Zwhite(chr)
- Zchar chr;
- Z
- Z{
- Z switch(chr)
- Z {
- Z case ' ':
- Z case '\t':
- Z return(1);
- Z default:
- Z return(0);
- Z }
- Z} /*white*/
- Z
- Z
- Z#ifdef DEBUG
- Zoutput_symbol(filer, sym)
- ZFILE *filer;
- Zint sym;
- Z
- Z{
- Z fprintf(filer, "For symbol index %d\n", sym);
- Z fprintf(filer, "\tsymbol %d", symbol_table[sym].symbol);
- Z fprintf(filer, "\t(%s)", symbol_table[sym].name);
- Z fprintf(filer, "\ta %d\tb %d\n", symbol_table[sym].a, symbol_table[sym].b);
- Z fprintf(filer, "\tll %d, %d ur %d, %d\n",
- Z symbol_table[sym].ll.x, symbol_table[sym].ll.y,
- Z symbol_table[sym].ur.x,symbol_table[sym].ur.y);
- Z} /*output_symbol*/
- Z#endif
- Z
- Z
- Zequal_strings(s1, s2)
- Zchar *s1, *s2;
- Z
- Z{
- Zint temp;
- Z
- Z while( (((temp = (*s1 - *s2)) == 0) || (abs(temp) == DELTA_A))
- Z && (*s1 != '\0') && (*s2 != '\0'))
- Z {
- Z *s1++; *s2++;
- Z }
- Z
- Z if (*s1 == *s2) /*and therefore = '\0'*/
- Z return(1);
- Z else
- Z return(0);
- Z} /*equal_strings*/
- Z
- Z
- Z
- Z
- Z symboltype
- Z*allocsymbol()
- Z{
- Zunsigned size = sizeof(symboltype);
- Zsymboltype *symbol;
- Z
- Z symbol =(symboltype *) malloc(size);
- Z symbol->typer = 0;
- Z symbol->primitive.box = NULL;
- Z symbol->next = NULL;
- Z
- Z return(symbol);
- Z} /*allocsymbol*/
- Z
- Z
- Z boxtype
- Z*allocbox()
- Z{
- Zunsigned size = sizeof(boxtype);
- Zboxtype *box;
- Zint i;
- Z
- Z box =(boxtype *) malloc(size);
- Z box->layer = 0;
- Z for(i = 0; i < 4; i++)
- Z box->loc[i] = 0;
- Z
- Z return(box);
- Z} /*allocbox*/
- Z
- Z
- Z
- Z int
- Zget_index(num)
- Zint num;
- Z
- Z{
- Zint i;
- Z
- Z for(i = 0; i <= last_symbol; i++)
- Z {
- Z if (symbol_table[i].symbol == num) return(i);
- Z }
- Z
- Z return(-1);
- Z} /*get_index*/
- Z
- Z
- Z
- Zoutput_all_symbolnums(filer)
- ZFILE *filer;
- Z
- Z{
- Zint i;
- Z
- Z fprintf(filer, "Symbols are:\n");
- Z for(i = 0; i <= last_symbol; i++)
- Z fprintf(filer, "%d\t%s\n", symbol_table[i].symbol,
- Z symbol_table[i].name);
- Z} /*output_all_symbolnums*/
- Z
- Z
- Z
- Zdo_cif()
- Z{
- Zchar cif[MAXLINE];
- Z
- Z while(get_next_cifline(cif) != EOF)
- Z {
- Z#ifdef DEBUG
- Z fprintf(stderr,"trim before %d\n",cif[0]);
- Z#endif
- Z trim_cif(cif);
- Z#ifdef DEBUG
- Z fprintf(stderr,"trim after %d\n",cif[0]);
- Z#endif
- Z
- Z switch(cif[0])
- Z {
- Z case 'D':
- Z switch(cif[1])
- Z {
- Z case 'S':
- Z ds(cif, DSTYPE);
- Z break;
- Z case 'F':
- Z df();
- Z break;
- Z default:
- Z fprintf(stderr, "Unknown command in CIF\n");
- Z output_cif(stderr, cif);
- Z break;
- Z } /*switch(cif[1]*/
- Z break;
- Z case '9':
- Z switch(cif[1])
- Z {
- Z case WHITE:
- Z nine(cif);
- Z break;
- Z case '4':
- Z ninety_four(cif);
- Z break;
- Z default:
- Z fprintf(stderr, "Unknown command in CIF\n");
- Z output_cif(stderr, cif);
- Z break;
- Z } /*switchcif[1]*/
- Z break;
- Z case 'B':
- Z box_cif(cif);
- Z break;
- Z case 'L':
- Z cif_change_layer(cif);
- Z break;
- Z case 'C':
- Z call_symbol(cif);
- Z break;
- Z case 0:
- Z break;
- Z default:
- Z fprintf(stderr, "Warning the following wasn't understood...ignoring\n");
- Z output_cif(stderr, cif);
- Z break;
- Z } /*switch*/
- Z }
- Z} /*do_cif*/
- Z
- Z
- Zds(cif, typer)
- Zchar *cif;
- Zint typer;
- Z
- Z{
- Zint last_read, symnum, temp_index;
- Zchar token[MAXNAME];
- Zsymboltype *symbol;
- Z
- Z last_read = get_token(cif, 3, token);
- Z if (last_read == -1)
- Z {
- Z fprintf(stderr, "no symbol in DS\n");
- Z output_cif(stderr, cif);
- Z return;
- Z }
- Z (void) sscanf(token, "%d", &symnum);
- Z
- Z temp_index = get_index(symnum);
- Z if (temp_index == -1)
- Z {
- Z if (++last_symbol == MAXSYMBOLS)
- Z {
- Z fprintf(stderr, "Exceeded the number of allowed symbols\n");
- Z exit(1);
- Z }
- Z temp_index = last_symbol;
- Z }
- Z
- Z symbol_table[temp_index].symbol = symnum;
- Z symbol_table[temp_index].ll.x = BIGINT;
- Z symbol_table[temp_index].ll.y = BIGINT;
- Z symbol_table[temp_index].ur.x = -BIGINT;
- Z symbol_table[temp_index].ur.y = -BIGINT;
- Z symbol_table[temp_index].name[0] = '\0';
- Z symbol_table[temp_index].a = 1;
- Z symbol_table[temp_index].b = 1;
- Z a_over_b = 1;
- Z
- Z symbol = allocsymbol();
- Z if (typer == DSTYPE)
- Z {
- Z current_symbol_index = temp_index;
- Z present_symbol = symbol;
- Z }
- Z symbol->typer = DSTYPE;
- Z
- Z symbol_table[temp_index].pointer = symbol;
- Z *symbol_table[temp_index].name = '\0';
- Z
- Z last_read = get_token(cif, last_read, token);
- Z if (last_read == -1) return;
- Z (void) sscanf(token, "%d", &(symbol_table[temp_index].a));
- Z
- Z if (symbol_table[temp_index].a == 0)
- Z {
- Z fprintf(stderr, "read a 0 for A in DS\n");
- Z output_cif(stderr, cif);
- Z symbol_table[temp_index].a = 1;
- Z }
- Z
- Z last_read = get_token(cif, last_read, token);
- Z if (last_read == -1)
- Z {
- Z fprintf(stderr, "A but no B in DS\n");
- Z output_cif(stderr, cif);
- Z a_over_b = ((float) symbol_table[temp_index].a) /
- Z ((float) symbol_table[temp_index].b);
- Z return;
- Z }
- Z (void) sscanf(token, "%d", &(symbol_table[temp_index].b));
- Z
- Z if (symbol_table[temp_index].b == 0)
- Z {
- Z fprintf(stderr, "read a 0 for B in DS\n");
- Z output_cif(stderr, cif);
- Z symbol_table[temp_index].b = 1;
- Z }
- Z a_over_b = ((float) symbol_table[temp_index].a) /
- Z ((float) symbol_table[temp_index].b);
- Z} /*ds*/
- Z
- Z
- Z int
- Zget_token(cif, from, token)
- Zchar *cif;
- Zint from;
- Zchar *token;
- Z
- Z{
- Zint i;
- Z
- Z if ((from > 0) && (cif[from - 1] == '\0'))
- Z return(-1);
- Z
- Z for (i = 0; ((cif[i+from] != WHITE) && (cif[i+from] != COMMA));i++)
- Z {
- Z if (cif[i + from] == '\0')
- Z break;
- Z token[i] = cif[i + from];
- Z }
- Z
- Z token[i] = '\0';
- Z if (i == 0)
- Z return(-1);
- Z else
- Z return(i + from + 1);
- Z} /*get_token*/
- Z
- Z
- Zdf()
- Z{
- Z current_symbol_index = 0;
- Z present_symbol = symbol_table[current_symbol_index].pointer;
- Z} /*df*/
- Z
- Z
- Zbox_cif(cif)
- Zchar *cif;
- Z
- Z{
- Zint next_one, i;
- Zint temp[4];
- Zchar token[MAXNAME];
- Zboxtype *box, *allocbox();
- Z
- Z bang_symbol();
- Z present_symbol->typer = BOXTYPE;
- Z box = allocbox();
- Z present_symbol->primitive.box = box;
- Z
- Z box->layer = layer;
- Z
- Z next_one = 2;
- Z for(i = 0; i < 4; i++)
- Z {
- Z next_one = get_token(cif, next_one, token);
- Z if (next_one == -1)
- Z {
- Z fprintf(stderr, "incomplete box\n");
- Z output_cif(stderr, cif);
- Z return;
- Z }
- Z (void) sscanf(token, "%d", &(temp[i]));
- Z }
- Z
- Z box->loc[0] = a_over_b * (temp[2] - (temp[0]/2));
- Z box->loc[2] = a_over_b * (temp[2] + (temp[0]/2));
- Z box->loc[1] = a_over_b * (temp[3] - (temp[1]/2));
- Z box->loc[3] = a_over_b * (temp[3] + (temp[1]/2));
- Z} /*box_cif*/
- Z
- Z
- Z
- Zcif_change_layer(cif)
- Zchar *cif;
- Z
- Z{
- Zint foobar, i;
- Zchar token[MAXNAME];
- Z
- Z foobar = get_token(cif, 2, token);
- Z if (foobar == -1)
- Z {
- Z fprintf(stderr, "Error in layer command\n");
- Z output_cif(stderr, cif);
- Z return;
- Z }
- Z
- Z for(i = 0; i < numlayers; i++)
- Z {
- Z if (equal_strings(token, layers[i].name))
- Z {
- Z layer = i;
- Z return;
- Z }
- Z }
- Z
- Z fprintf(stderr, "layer not found\n");
- Z output_cif(stderr, cif);
- Z fprintf(stderr, "\nLayers are:\n");
- Z for(i = 0; i < numlayers; i++)
- Z fprintf(stderr, "\t%s\n", layers[i].name);
- Z} /*cif_change_layers*/
- Z
- Z
- Znine(cif)
- Zchar *cif;
- Z
- Z{
- Zint foobar;
- Zchar token[MAXNAME];
- Z
- Z foobar = get_token(cif, 2, token);
- Z if (foobar == -1)
- Z {
- Z fprintf(stderr, "Error in 9 command\n");
- Z output_cif(stderr, cif);
- Z return;
- Z }
- Z
- Z (void) sscanf(token, "%s", symbol_table[current_symbol_index].name);
- Z} /*nine*/
- Z
- Z
- Z
- Z
- Z#ifdef DEBUG
- Zoutput_symboldef(filer, sym)
- ZFILE *filer;
- Zint sym;
- Z
- Z{
- Zsymboltype *symbol;
- Z
- Z output_symbol(stdout, sym);
- Z symbol = symbol_table[sym].pointer;
- Z while(symbol != NULL)
- Z {
- Z output_symbolsub(filer, symbol);
- Z symbol = symbol->next;
- Z }
- Z} /*output_symboldef*/
- Z
- Z
- Zoutput_symbolsub(filer, symbol)
- ZFILE *filer;
- Zsymboltype *symbol;
- Z
- Z{
- Z fprintf(filer, "\ttype ");
- Z switch(symbol->typer)
- Z {
- Z case DSTYPE:
- Z fprintf(filer, "symbol\n");
- Z break;
- Z case BOXTYPE:
- Z output_box(filer, symbol->primitive.box);
- Z break;
- Z case CALLTYPE:
- Z output_call(filer, symbol->primitive.call);
- Z break;
- Z case NINETY_FOURTYPE:
- Z output_ninety_four(filer, symbol->primitive.ninety_four);
- Z break;
- Z default:
- Z fprintf(filer, "ERROR Not known %d\n", symbol->typer);
- Z return;
- Z }
- Z} /*output_symbolsub*/
- Z#endif
- Z
- Z
- Z
- Zbang_symbol()
- Z{
- Z present_symbol->next = allocsymbol();
- Z present_symbol = present_symbol->next;
- Z} /*bang_symbol*/
- Z
- Z
- Z
- Z#ifdef DEBUG
- Zoutput_box(filer, box)
- ZFILE *filer;
- Zboxtype *box;
- Z
- Z{
- Zint i;
- Z
- Z fprintf(filer, "\tBox ");
- Z for(i = 0; i < 4; i++)
- Z fprintf(filer, "%d ", box->loc[i]);
- Z
- Z fprintf(filer, "\t layer %s\n", layers[box->layer].name);
- Z} /*output_box*/
- Z#endif
- Z
- Z
- Z
- Zninety_four(cif)
- Zchar *cif;
- Z
- Z{
- Zint last_read;
- Zchar token[MAXNAME];
- Zninety_fourtype *ninety_four, *allocninety_four();
- Z
- Z bang_symbol();
- Z present_symbol->typer = NINETY_FOURTYPE;
- Z ninety_four = allocninety_four();
- Z present_symbol->primitive.ninety_four = ninety_four;
- Z
- Z last_read = get_token(cif, 3, token);
- Z if (last_read == -1)
- Z {
- Z fprintf(stderr, "no text in ninety_four\n");
- Z output_cif(stderr, cif);
- Z return;
- Z }
- Z (void) sscanf(token, "%s", ninety_four->name);
- Z
- Z last_read = get_token(cif, last_read, token);
- Z if (last_read == -1)
- Z {
- Z fprintf(stderr, "no x in ninety_four\n");
- Z output_cif(stderr, cif);
- Z return;
- Z }
- Z (void) sscanf(token, "%d", &(ninety_four->x));
- Z ninety_four->x *= a_over_b;
- Z
- Z last_read = get_token(cif, last_read, token);
- Z if (last_read == -1)
- Z {
- Z fprintf(stderr, "no y in ninety_four\n");
- Z output_cif(stderr, cif);
- Z return;
- Z }
- Z (void) sscanf(token, "%d", &(ninety_four->y));
- Z ninety_four->y *= a_over_b;
- Z
- Z last_read = get_token(cif, last_read, token);
- Z if (last_read != -1) /*don't need layer on 94*/
- Z ninety_four->layer = get_layer_num(token);
- Z} /*ninety_four*/
- Z
- Z
- Z#ifdef DEBUG
- Zoutput_ninety_four(filer, ninety_four)
- ZFILE *filer;
- Zninety_fourtype *ninety_four;
- Z
- Z{
- Z fprintf(filer, "\t94 %s, x %d y %d ", ninety_four->name,
- Z ninety_four->x, ninety_four->y);
- Z if ((ninety_four->layer < 0) || (ninety_four->layer >= numlayers))
- Z fprintf(stderr, "error in layer in 94 %d\n", ninety_four->layer);
- Z else
- Z fprintf(filer, "layer %s\n", layers[ninety_four->layer].name);
- Z} /*output_ninety_four*/
- Z#endif
- Z
- Z
- Z int
- Zget_layer_num(lay)
- Zchar *lay;
- Z
- Z{
- Zint i;
- Z
- Z for(i = 1; i < numlayers; i++)
- Z {
- Z if (equal_strings(lay, layers[i].name)) return(i);
- Z }
- Z
- Z fprintf(stderr, "layer **%s** not found in get layer\n", lay);
- Z return(0);
- Z} /*get_layer_num*/
- Z
- Z
- Z calltype
- Z*alloccall()
- Z{
- Zunsigned size = sizeof(calltype);
- Zcalltype *call;
- Z
- Z call =(calltype *) malloc(size);
- Z call->symbol = -999;
- Z identity_matrix(call->matrix);
- Z
- Z return(call);
- Z} /*alloccall*/
- Z
- Z
- Z
- Z ninety_fourtype
- Z*allocninety_four()
- Z{
- Zunsigned size = sizeof(ninety_fourtype);
- Zninety_fourtype *ninety_four;
- Z
- Z ninety_four =(ninety_fourtype *) malloc(size);
- Z ninety_four->layer = 0;
- Z ninety_four->x = 0;
- Z ninety_four->y = 0;
- Z ninety_four->name[0] = '\0';
- Z
- Z return(ninety_four);
- Z} /*allocninety_four*/
- Z
- Z
- Z#ifdef DEBUG
- Zoutput_call(filer, call)
- ZFILE *filer;
- Zcalltype *call;
- Z
- Z{
- Z fprintf(filer, "\tCall ");
- Z fprintf(filer, " %d (%s)\n", symbol_table[call->symbol].symbol,
- Z symbol_table[call->symbol].name);
- Z output_matrix(filer, call->matrix);
- Z} /*output_call*/
- Z#endif
- STUNKYFLUFF
- set `sum cifgood.c`
- if test 34229 != $1
- then
- echo cifgood.c: Checksum error. Is: $1, should be: 34229.
- fi
- #
- #
- echo Extracting cifplot.c:
- sed 's/^Z//' >cifplot.c <<\STUNKYFLUFF
- Z/*
- Z cif2ps is based on the program 'cifp' originally written by
- Z Arthur Simoneau, The Aerospace Corporation, El Segundo, Calif
- Z
- Z Changes to 'cifp' include support of cmos-pw layers, scaling
- Z factors to spread output over several pages of 8.5 x 11 paper,
- Z printing multiple layers.
- Z
- Z Modified by Marc Lesure, Arizona State University, Tempe, AZ
- Z
- Z Please honor the authors by not removing names from the source codes.
- Z*/
- Z#include "define.h"
- Z
- Zplot_box(box)
- Zboxtype *box;
- Z{
- Z float llx, urx, lly, ury, deltax, deltay;
- Z pointpairtype pair;
- Z
- Z get_pair(box->loc[0], box->loc[1], &pair);
- Z llx = (pair.x + trans_x) * scale;
- Z lly = (pair.y + trans_y) * scale;
- Z get_pair(box->loc[2], box->loc[3], &pair);
- Z urx = (pair.x + trans_x) * scale;
- Z ury = (pair.y + trans_y) * scale;
- Z
- Z deltax = urx - llx;
- Z if (deltax < 0)
- Z {
- Z llx = llx + deltax;
- Z deltax = - deltax;
- Z }
- Z deltay = ury - lly;
- Z if (deltay < 0)
- Z {
- Z lly = lly + deltay;
- Z deltay = - deltay;
- Z }
- Z
- Z if (clip[layer])
- Z {
- Z if (inarea(llx, lly, deltax, deltay)) {
- Z clipper(llx, lly, deltax, deltay);
- Z fill_box(llx, lly, deltax, deltay);
- Z }
- Z }
- Z else
- Z {
- Z if (inarea(llx, lly, deltax, deltay))
- Z box_plotter(llx, lly, deltax, deltay);
- Z }
- Z} /*plot_box*/
- Z
- Z
- Zinarea(llx, lly, deltax, deltay)
- Zfloat llx, lly, deltax, deltay;
- Z{
- Z float left, bottom, top, right;
- Z float maxx, maxy, minx, miny;
- Z
- Z minx = pagex * PAGEWIDTH;
- Z maxx = (pagex + 1) * PAGEWIDTH;
- Z miny = pagey * PAGELENGTH;
- Z maxy = (pagey + 1) * PAGELENGTH;
- Z left = llx;
- Z bottom = lly;
- Z right = llx + deltax;
- Z top = lly + deltay;
- Z if (left > maxx)
- Z return(0);
- Z if (top < miny)
- Z return(0);
- Z if (right < minx)
- Z return(0);
- Z if (bottom > maxy)
- Z return(0);
- Z return(1);
- Z}
- Z
- Z
- Z
- Zfill_box(llx, lly, deltax, deltay)
- Zfloat llx, lly, deltax, deltay;
- Z{
- Z float left, bottom, top, right;
- Z float x, y, xx, yy;
- Z float b, b_start;
- Z float slope_x, inv_slope_y, slope_xx, inv_slope_yy, b_div_slope;
- Z float minx,maxx,miny,maxy;
- Z float trunc();
- Z int toggle_top = 1, toggle_left = 1;
- Z
- Z minx = pagex * PAGEWIDTH;
- Z maxx = (pagex + 1) * PAGEWIDTH;
- Z miny = pagey * PAGELENGTH;
- Z maxy = (pagey + 1) * PAGELENGTH;
- Z left = llx;
- Z bottom = lly;
- Z right = llx + deltax;
- Z top = lly + deltay;
- Z
- Z if (slope <= 0)
- Z {
- Z b = top - (slope * right);
- Z x = right;
- Z }
- Z else
- Z {
- Z b = top - (slope * left);
- Z x = left;
- Z }
- Z
- Z b_start = trunc(b);
- Z while (b_start <= b)
- Z b_start += step;
- Z b_start -= step; /*went one too far*/
- Z
- Z b_div_slope = b_start / slope;
- Z slope_x = slope * x;
- Z y = slope_x + b_start;
- Z inv_slope_y = y / slope;
- Z
- Z yy = top;
- Z inv_slope_yy = yy / slope;
- Z xx = inv_slope_yy - b_div_slope;
- Z slope_xx = slope * xx;
- Z
- Z b = b_start;
- Z FOREVER
- Z {
- Z b_div_slope = b / slope;
- Z if (toggle_left)
- Z {
- Z y = slope_x + b;
- Z if (y < bottom)
- Z {
- Z toggle_left = 0;
- Z y = bottom;
- Z inv_slope_y = y / slope;
- Z }
- Z }
- Z if ( !toggle_left)
- Z {
- Z x = inv_slope_y - b_div_slope;
- Z
- Z if (slope <= 0)
- Z {
- Z if (x <= left)
- Z return;
- Z }
- Z else
- Z {
- Z if (x >= right)
- Z return;
- Z }
- Z }
- Z
- Z if (toggle_top)
- Z {
- Z xx = inv_slope_yy - b_div_slope;
- Z if (slope <= 0)
- Z {
- Z if (xx < left)
- Z {
- Z toggle_top = 0;
- Z xx = left;
- Z slope_xx = slope * xx;
- Z }
- Z }
- Z else
- Z {
- Z if (xx > right)
- Z {
- Z toggle_top = 0;
- Z xx = right;
- Z slope_xx = slope * xx;
- Z }
- Z }
- Z }
- Z if ( !toggle_top)
- Z yy = slope_xx + b;
- Z
- Z if ((x < left) || (x > right) || (xx < left) || (xx > right))
- Z {
- Z#ifdef DEBUG
- Z start_text();
- Z plot_string(x, y, "start error");
- Z plot_string(xx, yy, "end error");
- Z fprintf(stderr, "\nError....in x\n");
- Z fprintf(stderr, "x\t%f y\t%f xx\t%f yy\t%f\n",
- Z (float) x, (float) y, (float) xx, (float) yy);
- Z fprintf(stderr, "left\t%f bot\t%f right\t%f top \t%f\n",
- Z (float) left, (float) bottom,
- Z (float) right, (float) top);
- Z fprintf(stderr, "step %f ", (float) step);
- Z fprintf(stderr, "b %f, b start %f\n", b, b_start);
- Z return;
- Z#endif
- Z }
- Z else if ((y < bottom) || (y > top) || (yy < bottom) || (yy > top))
- Z {
- Z#ifdef DEBUG
- Z start_text();
- Z plot_string(x, y, "start error");
- Z plot_string(xx, yy, "end error");
- Z fprintf(stderr, "\nError....in y\n");
- Z fprintf(stderr, "x\t%f y\t%f xx\t%f yy\t%f\n",
- Z (float) x, (float) y, (float) xx, (float) yy);
- Z fprintf(stderr, "left\t%f bot\t%f right\t%f top \t%f\n",
- Z (float) left, (float) bottom,
- Z (float) right, (float) top);
- Z fprintf(stderr, "step %f ", (float) step);
- Z fprintf(stderr, "b %d, b start %d\n", b, b_start);
- Z return;
- Z#endif /*debug*/
- Z }
- Z else
- Z if ((inrange(minx,maxx,x) && inrange(miny,maxy,y)) ||
- Z (inrange(minx,maxx,xx) && inrange(miny,maxy,yy)))
- Z {
- Z drawline(x, y, xx, yy);
- Z }
- Z
- Z b -= step;
- Z } /*FOREVER*/
- Z} /*fill_box*/
- Z
- Z
- Zinrange(min,max,value)
- Zfloat min,max,value;
- Z{
- Z return(min <= value && value <= max);
- Z}
- Z
- Z
- Zfloat
- Ztrunc(in)
- Zfloat in;
- Z{
- Z long temp;
- Z float bar;
- Z
- Z temp = in;
- Z bar = temp;
- Z if (bar > 0)
- Z return(bar);
- Z else
- Z return(bar - 1);
- Z} /*trunc*/
- Z
- Z
- Zplot_text(ninety_four)
- Zninety_fourtype *ninety_four;
- Z{
- Z float x, y;
- Z pointpairtype pair;
- Z
- Z get_pair(ninety_four->x, ninety_four->y, &pair);
- Z x = (pair.x + trans_x) * scale;
- Z y = (pair.y + trans_y) * scale;
- Z
- Z plot_string(x, y, ninety_four->name);
- Z} /*plot_text*/
- Z
- Z
- Zplot_change_layer(layer_in)
- Zint layer_in;
- Z{
- Z
- Z if ((layer_in >= 0) && (layer_in < numlayers))
- Z {
- Z if (!clip[layer])
- Z end_box();
- Z }
- Z if (cmos_pw == 1) {
- Z switch(layer_in)
- Z {
- Z case 0:
- Z break;
- Z case CW:
- Z fprintf(plotfile, "0.9 setgray\n");
- Z break;
- Z case CM2:
- Z fprintf(plotfile, "0.2 setgray\n");
- Z break;
- Z case CM:
- Z fprintf(plotfile, "0.3 setgray\n");
- Z break;
- Z case CP:
- Z fprintf(plotfile, "0.4 setgray\n");
- Z break;
- Z case CD:
- Z fprintf(plotfile, "0.5 setgray\n");
- Z break;
- Z case CZ:
- Z case CC:
- Z case CC2:
- Z fprintf(plotfile, "0 setgray\n");
- Z break;
- Z case CS:
- Z fprintf(plotfile, "0.8 setgray\n");
- Z break;
- Z case CG:
- Z fprintf(plotfile, "0.7 setgray\n");
- Z break;
- Z default:
- Z fprintf(stderr, "Error in plot_change_layer %d\n", layer_in);
- Z return;
- Z }
- Z }
- Z else {
- Z switch(layer_in)
- Z {
- Z case 0:
- Z break;
- Z case CWP:
- Z fprintf(plotfile, "0.9 setgray\n");
- Z break;
- Z case CMS:
- Z fprintf(plotfile, "0.2 setgray\n");
- Z break;
- Z case CMF:
- Z fprintf(plotfile, "0.3 setgray\n");
- Z break;
- Z case CPG:
- Z fprintf(plotfile, "0.4 setgray\n");
- Z break;
- Z case CAA:
- Z fprintf(plotfile, "0.5 setgray\n");
- Z break;
- Z case CCA:
- Z case CCP:
- Z case CVA:
- Z fprintf(plotfile, "0 setgray\n");
- Z break;
- Z case CSP:
- Z fprintf(plotfile, "0.8 setgray\n");
- Z break;
- Z default:
- Z fprintf(stderr, "Error in plot_change_layer %d\n", layer_in);
- Z return;
- Z }
- Z }
- Z if (layer_in != 0)
- Z fprintf(plotfile, "%% %s\n", layers[layer_in].name);
- Z
- Z layer = layer_in;
- Z if (clip[layer])
- Z start_clipping();
- Z else
- Z start_box();
- Z} /*plot_change_layer*/
- Z
- Z
- Zstart_box()
- Z{
- Z fprintf(plotfile, "newpath\n");
- Z} /*start_box*/
- Z
- Zend_box()
- Z{
- Z fprintf(plotfile, "closepath\n");
- Z} /*end_box*/
- Z
- Z
- Zstart_clipping()
- Z{
- Z fprintf(plotfile, "0 setgray newpath\n");
- Z
- Z if (cmos_pw == 1) {
- Z switch(layer)
- Z {
- Z case CP:
- Z step = .5;
- Z slope = 5.0;
- Z break;
- Z case CM:
- Z step = .2;
- Z slope = 1.0;
- Z break;
- Z case CM2:
- Z step = .2;
- Z slope = -1.0;
- Z break;
- Z default:
- Z fprintf(stderr, "Hit default in start clipping %d\n", layer);
- Z break;
- Z } /*switch*/
- Z }
- Z else {
- Z switch(layer)
- Z {
- Z case CPG:
- Z step = .5;
- Z slope = 5.0;
- Z break;
- Z case CMF:
- Z step = .2;
- Z slope = 1.0;
- Z break;
- Z case CMS:
- Z step = .2;
- Z slope = -1.0;
- Z break;
- Z default:
- Z fprintf(stderr, "Hit default in start clipping %d\n", layer);
- Z break;
- Z } /*switch*/
- Z }
- Z} /*start_clipping*/
- Z
- Z
- Z
- Z
- Z
- Zstart_text()
- Z{
- Z float scalefont;
- Z
- Z fprintf(plotfile, "closepath\n");
- Z scalefont = scale * width * PAGEWIDTH * 20;
- Z fprintf(plotfile, "0 setgray\n");
- Z fprintf(plotfile, "/Helvetica findfont %f scalefont setfont\n",
- Z scalefont);
- Z} /*start_text*/
- Z
- Z
- Zdrawline(x, y, xx, yy)
- Zfloat x, y, xx, yy;
- Z{
- Z fprintf(plotfile, "%f %f moveto %f %f lineto stroke\n", x, y, xx, yy);
- Z} /*drawline*/
- Z
- Z
- Z
- Zbox_plotter(llx, lly, deltax, deltay)
- Zfloat llx, lly, deltax, deltay;
- Z{
- Z fprintf(plotfile, "%f %f %f %f box\n", llx, lly, deltax, deltay);
- Z} /*box_plotter*/
- Z
- Z
- Zclipper(llx, lly, deltax, deltay)
- Zfloat llx, lly, deltax, deltay;
- Z{
- Z fprintf(plotfile, "%f %f %f %f clipper\n", llx, lly, deltax, deltay);
- Z} /*clipper*/
- Z
- Z
- Z
- Zplot_string(x, y, stringer)
- Zfloat x, y;
- Zchar *stringer;
- Z{
- Z fprintf(plotfile, "%f %f moveto (%s) show\n", x, y, stringer);
- Z} /*plot_string*/
- Z
- Z
- Zprolog()
- Z{
- Z fprintf(plotfile, "%%!\n");
- Z fprintf(plotfile, "/area {/dely exch def /delx exch def moveto\n");
- Z fprintf(plotfile, "\tdelx 0 rlineto 0 dely rlineto delx neg 0 rlineto 0 dely neg rlineto} def\n");
- Z fprintf(plotfile, "/box {area fill} def\n");
- Z fprintf(plotfile, "/clipper {area stroke} def\n");
- Z} /*prolog*/
- Z
- Z#ifdef DEBUG
- Zfoobar(ll, ur)
- Zpointpairtype *ll, *ur;
- Z
- Z{
- Z float deltax, deltay;
- Z
- Z if (cmos_pw == 1)
- Z plot_change_layer(CM);
- Z else
- Z plot_change_layer(CMS);
- Z deltax = ur->x - ll->x;
- Z deltay = ur->y - ll->y;
- Z fprintf(stderr, "ll %f %f \tdelta %f %f\n",
- Z (float) ll->x, (float) ll->y, deltax, deltay);
- Z box_plotter((float) ll->x, (float) ll->y, deltax, deltay);
- Z}
- Z#endif
- Z
- Zprelog()
- Z{
- Z fprintf(plotfile, "gsave\n");
- Z fprintf(plotfile, "/inch {72 mul} def\n");
- Z fprintf(plotfile, "%% small correction for full page printing\n");
- Z fprintf(plotfile, "20 20 translate\n");
- Z fprintf(plotfile, "%% undo unit scaling when printing full page\n");
- Z fprintf(plotfile, "/unitscale { 1 inch %f mul dup scale } def\n",
- Z scale/scale2);
- Z fprintf(plotfile, "0.001 setlinewidth\n");
- Z fprintf(plotfile, "%f dup scale\n", scale2/scale);
- Z fprintf(plotfile, "%3.3f 0.0 %3.3f %3.3f unitscale\n",
- Z .5*scale2x, scale2x, scale2y);
- Z fprintf(plotfile,"%f %f translate\n",
- Z -pagex*PAGEWIDTH, -pagey*PAGELENGTH);
- Z}
- Z
- Z
- Zepilog()
- Z{
- Z fprintf(plotfile, "0 setgray\n");
- Z fprintf(plotfile, "gsave\n");
- Z fprintf(plotfile, "0 setgray\n");
- Z fprintf(plotfile, "/Helvetica findfont 0.075 scalefont setfont\n");
- Z /* fprintf(plotfile, "%f %f moveto (%d,%d) show\n",
- Z pagex * PAGEWIDTH, pagey * PAGELENGTH, pagex, pagey); */
- Z fprintf(plotfile, "grestore\n");
- Z fprintf(plotfile, "grestore\n");
- Z fprintf(plotfile, "showpage\n");
- Z totpages++;
- Z fflush(plotfile);
- Z} /*epilog*/
- Z
- Z
- Z
- Zinit()
- Z{
- Z int i;
- Z
- Z no_lines = 0;
- Z layer = 0;
- Z last_symbol = -1;
- Z ds("DS 0", DSTYPE);
- Z nine("9 top_level");
- Z identity_matrix(matrix);
- Z
- Z (void) strcpy(layers[0].name, "FOOBAR");
- Z if (cmos_pw == 1) {
- Z (void) strcpy(layers[CW].name, "CW");
- Z (void) strcpy(layers[CM2].name, "CM2");
- Z (void) strcpy(layers[CM].name, "CM");
- Z (void) strcpy(layers[CP].name, "CP");
- Z (void) strcpy(layers[CD].name, "CD");
- Z (void) strcpy(layers[CC].name, "CC");
- Z (void) strcpy(layers[CS].name, "CS");
- Z (void) strcpy(layers[CC2].name, "CC2");
- Z (void) strcpy(layers[CZ].name, "CZ");
- Z (void) strcpy(layers[CG].name, "CG");
- Z numlayers = 11;
- Z }
- Z else {
- Z (void) strcpy(layers[CWP].name, "CWP");
- Z (void) strcpy(layers[CMS].name, "CMS");
- Z (void) strcpy(layers[CMF].name, "CMF");
- Z (void) strcpy(layers[CPG].name, "CPG");
- Z (void) strcpy(layers[CAA].name, "CAA");
- Z (void) strcpy(layers[CCA].name, "CCA");
- Z (void) strcpy(layers[CCP].name, "CCP");
- Z (void) strcpy(layers[CSP].name, "CSP");
- Z (void) strcpy(layers[CVA].name, "CVA");
- Z numlayers = 10;
- Z }
- Z
- Z for (i = 1; i < numlayers; i++)
- Z clip[i] = 0;
- Z
- Z if (cmos_pw == 1) {
- Z clip[CP] = 1;
- Z clip[CM] = 1;
- Z clip[CM2] = 1;
- Z }
- Z else {
- Z clip[CPG] = 1;
- Z clip[CMF] = 1;
- Z clip[CMS] = 1;
- Z }
- Z
- Z} /*init*/
- STUNKYFLUFF
- set `sum cifplot.c`
- if test 32084 != $1
- then
- echo cifplot.c: Checksum error. Is: $1, should be: 32084.
- fi
- #
- #
- echo Extracting cmos-pw.test.cif:
- sed 's/^Z//' >cmos-pw.test.cif <<\STUNKYFLUFF
- Z ($$ HP EGS Graphics Editor);
- Z ($$ Revision : 2.1);
- Z ($$ Archival Date : 5/8/83);
- Z ($$ Archival Time : 9:55 AM);
- Z ($FILES inv $; );
- Z ( DA222 -- IGS2CIF program version 2a.04 cmp-15may87 );
- Z DS 1 ;
- Z 9 inv;
- Z L CS ;
- Z B 1300 800 3950,-300 ;
- Z L CC ;
- Z B 300 800 3950,100 ;
- Z L CD ;
- Z B 900 1200 3950,100 ;
- Z L CC2 ;
- Z B 300 300 3950,-1350 ;
- Z L CP ;
- Z B 4600 300 600,-750 ;
- Z B 300 1800 -1550,300 ;
- Z B 300 2800 -1550,3000 ;
- Z L CD ;
- Z B 2200 1600 -1700,3300 ;
- Z L CC ;
- Z B 300 300 -2350,2850 ;
- Z L CC2 ;
- Z B 300 300 -2350,-1450 ;
- Z L CD ;
- Z B 900 1800 -2350,-100 ;
- Z L CC ;
- Z B 300 800 -2350,-400 ;
- Z L CD ;
- Z B 2200 800 -1700,400 ;
- Z L CC ;
- Z B 300 300 -950,350 ;
- Z L CM ;
- Z B 900 2700 -2350,-550 ;
- Z B 700 800 -950,400 ;
- Z B 300 400 50,600 ;
- Z B 700 800 150,1200 ;
- Z L CP ;
- Z B 700 800 150,1200 ;
- Z L CC ;
- Z B 300 300 150,1250 ;
- Z L CP ;
- Z B 1900 300 -450,1750 ;
- Z L CM ;
- Z B 800 800 2500,-1900 ;
- Z L CP ;
- Z B 800 800 2500,-1900 ;
- Z B 300 600 2750,-1200 ;
- Z L CC ;
- Z B 300 300 2550,-1850 ;
- Z B 300 300 2050,350 ;
- Z L CD ;
- Z B 700 700 2050,350 ;
- Z L CM ;
- Z B 700 700 2050,350 ;
- Z B 2300 400 550,200 ;
- Z L CD ;
- Z B 2700 400 3050,500 ;
- Z L CM ;
- Z B 900 700 -2350,2850 ;
- Z L CD ;
- Z B 2700 800 3050,2900 ;
- Z L CP ;
- Z B 300 4200 2750,1500 ;
- Z L CC ;
- Z B 300 300 3350,2850 ;
- Z L CM ;
- Z B 1400 700 3700,2850 ;
- Z L CC ;
- Z B 300 300 4050,2850 ;
- Z B 300 300 2050,3250 ;
- Z L CW ;
- Z B 3800 5600 2900,1900 ;
- Z L CS ;
- Z B 2600 4900 -1700,2050 ;
- Z L CM ;
- Z B 900 2500 3950,-550 ;
- Z B 6300 300 -250,-2450 ;
- Z B 8600 300 900,2350 ;
- Z L CM2 ;
- Z B 900 9800 3950,1600 ;
- Z B 900 9800 1150,1600 ;
- Z B 900 9800 -2350,1600 ;
- Z L CM ;
- Z B 3000 900 200,3350 ;
- Z L CC2 ;
- Z B 300 300 1150,3350 ;
- Z L CC ;
- Z B 300 300 -950,3350 ;
- Z L CD ;
- Z B 700 1300 2050,3150 ;
- Z L CM ;
- Z B 700 900 2050,3350 ;
- Z DF;
- Z
- Z
- Z C 1 T 0, 0;
- Z( DEFINED SYMBOLS:
- Z CIF# IGS-NAME CALLED BY CELLS
- Z 1 : inv
- Z
- Z
- Z LAYER ASSIGNMENTS:
- Z IGS LAYER CIF LAYER
- Z 1 CW
- Z 3 CD
- Z 4 CP
- Z 5 CS
- Z 7 CC
- Z 8 CM
- Z 9 CG
- Z 13 CC2
- Z 14 CM2
- Z 15 CE
- Z
- Z
- Z SIZE[IGS] *1.00000E+002 ==> SIZE[CIF]
- Z
- Z
- Z TERMINATE NORMALLY);
- Z E
- STUNKYFLUFF
- set `sum cmos-pw.test.cif`
- if test 47135 != $1
- then
- echo cmos-pw.test.cif: Checksum error. Is: $1, should be: 47135.
- fi
- #
- #
- echo Extracting define.h:
- sed 's/^Z//' >define.h <<\STUNKYFLUFF
- Z#include <stdio.h>
- Z
- Z#define BIGINT 1000000
- Z#define FOREVER while(1)
- Z#define false 0
- Z#define true 1
- Z
- Z#define PAGEWIDTH 7.9
- Z#define PAGELENGTH 10.5
- Z
- Z/* defines for cmos-pw technology */
- Z#define CW 1
- Z#define CS 2
- Z#define CD 3
- Z#define CP 4
- Z#define CM 5
- Z#define CC 6
- Z#define CM2 7
- Z#define CC2 8
- Z#define CZ 9
- Z#define CG 10
- Z
- Z/* defines for SCMOS technology */
- Z#define CWP 1
- Z#define CSP 2
- Z#define CAA 3
- Z#define CPG 4
- Z#define CMF 5
- Z#define CCP 6
- Z#define CCA 7
- Z#define CMS 8
- Z#define CVA 9
- Z
- Z#define MAXNAME 50
- Z#define MAXSYMBOLS 200
- Z#define MAXLINE 200
- Z#define LAYERNAME 10
- Z#define MAXLAYERS 11
- Z#define MAXNINETY_FOUR 80
- Z
- Z#define DSTYPE 1
- Z#define BOXTYPE 2
- Z#define CALLTYPE 3
- Z#define NINETY_FOURTYPE 4
- Z#define WHITE ' '
- Z#define COMMA ','
- Z
- Ztypedef struct {
- Z int x, y;
- Z } pointpairtype;
- Z
- Ztypedef struct {
- Z int layer;
- Z int loc[4];
- Z } boxtype;
- Z
- Ztypedef struct {
- Z int name, a, b;
- Z } dstype;
- Z
- Ztypedef struct {
- Z char name[MAXNINETY_FOUR];
- Z int x, y, layer;
- Z } ninety_fourtype;
- Z
- Ztypedef struct {
- Z int symbol;
- Z float matrix[3][3];
- Z } calltype;
- Z
- Ztypedef struct symboldumb {
- Z struct symboldumb *next;
- Z int typer;
- Z union {
- Z boxtype *box;
- Z dstype *ds;
- Z calltype *call;
- Z ninety_fourtype *ninety_four;
- Z } primitive;
- Z } symboltype;
- Z
- Ztypedef struct {
- Z int symbol, a, b;
- Z char name[MAXNAME];
- Z symboltype *pointer;
- Z pointpairtype ll, ur;
- Z } tabletype;
- Z
- Ztypedef struct {
- Z char name[LAYERNAME];
- Z } layertype;
- Z
- Z
- Zsymboltype *allocsymbol();
- Z
- Ztabletype symbol_table[MAXSYMBOLS];
- ZFILE *ciffile, *plotfile;
- Zint no_lines;
- Zlayertype layers[MAXLAYERS];
- Zint clip[MAXLAYERS];
- Zint layer, numlayers;
- Zint last_symbol, current_symbol_index;
- Zsymboltype *present_symbol;
- Zfloat scale, trans_x, trans_y, a_over_b;
- Zfloat scale2, scale2x, scale2y;
- Zfloat matrix[3][3];
- Zfloat slope;
- Zfloat step;
- Zint pagex,pagey;
- Zint length,width;
- Zint totpages;
- Zint size_font;
- Zint cmos_pw;
- STUNKYFLUFF
- set `sum define.h`
- if test 38391 != $1
- then
- echo define.h: Checksum error. Is: $1, should be: 38391.
- fi
- #
- #
- echo Extracting makefile:
- sed 's/^Z//' >makefile <<\STUNKYFLUFF
- ZDEST = /usr/cad/bin
- ZLINKER = cc
- ZOBJS = cifgood.o \
- Z cif2ps.o \
- Z cifplot.o
- Z
- ZPROGRAM = cif2ps
- Z
- ZSRCS = cifgood.c \
- Z cif2ps.c \
- Z cifplot.c
- Z
- Zall: $(PROGRAM)
- Z
- Z$(PROGRAM): $(OBJS) $(LIBS)
- Z @echo -n "Loading $(PROGRAM) ... "
- Z @$(LINKER) $(OBJS) -o $(PROGRAM)
- Z @echo "done"
- Z
- Zclean:; @rm -f $(OBJS)
- Z
- Zinstall: $(PROGRAM)
- Z @echo Installing $(PROGRAM) in $(DEST)
- Z @install -s $(PROGRAM) $(DEST)
- Z
- Z###
- Zcifgood.o: define.h /usr/include/stdio.h
- Zcif2ps.o: /usr/include/ctype.h define.h /usr/include/stdio.h
- Zcifplot.o: define.h /usr/include/stdio.h
- STUNKYFLUFF
- set `sum makefile`
- if test 64413 != $1
- then
- echo makefile: Checksum error. Is: $1, should be: 64413.
- fi
- #
- #
- echo Extracting scmos.test.cif:
- sed 's/^Z//' >scmos.test.cif <<\STUNKYFLUFF
- ZDS 1 25 2;
- Z9 loadadd11;
- ZL CMF;
- Z B 48 12 216 3210;
- Z B 120 36 180 3186;
- Z B 36 12 138 3162;
- ZC 2 MX R 0 -1 T 12 3348;
- ZC 3 R 0 -1 T 276 3996;
- ZC 3 R 0 -1 T 876 3996;
- ZC 3 R 0 -1 T 1476 3996;
- ZC 3 R 0 -1 T 2076 3996;
- ZC 3 R 0 -1 T 2676 3996;
- ZDF;
- ZDS 3 25 2;
- Z9 latch_left_pair;
- ZL CMF;
- Z B 48 48 804 540;
- Z B 36 36 810 498;
- Z B 48 36 816 462;
- Z B 48 36 816 162;
- Z B 36 84 810 102;
- Z B 48 48 804 36;
- ZC 2 MX R 1 0 T 648 336;
- ZC 2 R -1 0 T 648 240;
- ZDF;
- ZDS 2 25 2;
- Z9 latch;
- ZL CWP;
- Z B 888 168 252 0;
- Z B 120 24 204 -96;
- ZL CMS;
- Z B 96 300 -228 126;
- Z B 420 48 450 252;
- Z B 240 48 -12 204;
- Z B 48 60 84 150;
- Z B 48 48 480 144;
- Z B 48 36 -12 90;
- Z B 36 48 474 96;
- Z B 528 48 228 48;
- Z B 564 48 6 -48;
- Z B 96 300 612 78;
- ZL CMF;
- Z B 108 48 234 252;
- Z B 48 48 -108 204;
- Z B 48 84 -12 186;
- Z B 120 36 -48 126;
- Z B 48 108 84 174;
- Z B 60 48 198 204;
- Z B 48 12 372 222;
- Z B 72 36 360 198;
- Z B 48 48 468 204;
- Z B 48 12 576 222;
- Z B 72 36 588 198;
- Z B 36 84 -90 66;
- Z B 48 48 -12 84;
- Z B 36 96 90 72;
- Z B 36 72 342 144;
- Z B 36 12 474 174;
- Z B 48 24 480 156;
- Z B 216 36 252 90;
- Z B 108 24 450 132;
- Z B 96 24 444 108;
- Z B 48 12 168 66;
- Z B 36 24 342 60;
- Z B 36 36 474 78;
- Z B 60 48 -102 0;
- Z B 144 36 36 6;
- Z B 48 12 -12 -18;
- Z B 48 12 84 -18;
- Z B 48 48 204 0;
- Z B 72 36 360 30;
- Z B 60 36 486 42;
- Z B 36 156 606 102;
- Z B 48 36 372 -6;
- Z B 48 48 504 0;
- Z B 48 48 612 0;
- Z B 108 48 234 -48;
- ZL CPG;
- Z B 24 300 -60 102;
- Z B 24 300 36 102;
- Z B 24 120 132 168;
- Z B 24 96 324 180;
- Z B 48 12 420 138;
- Z B 132 24 378 120;
- Z B 24 144 528 180;
- Z B 72 48 156 84;
- Z B 24 84 132 18;
- Z B 24 132 324 42;
- Z B 48 12 420 102;
- Z B 36 24 522 96;
- Z B 24 24 516 72;
- Z B 24 192 624 156;
- Z B 84 24 486 48;
- Z B 84 24 594 48;
- Z B 24 84 456 -6;
- Z B 24 84 564 -6;
- ZL CAA;
- Z B 48 48 204 252;
- Z B 48 24 -12 216;
- Z B 48 24 84 216;
- Z B 60 24 198 216;
- Z B 48 24 372 216;
- Z B 432 24 180 192;
- Z B 48 24 468 216;
- Z B 48 24 576 216;
- Z B 156 24 522 192;
- Z B 144 24 -60 12;
- Z B 48 24 -108 -12;
- Z B 48 24 -12 -12;
- Z B 336 24 228 12;
- Z B 48 24 84 -12;
- Z B 48 72 204 -36;
- Z B 48 24 372 -12;
- Z B 156 24 558 12;
- Z B 48 24 504 -12;
- Z B 48 24 612 -12;
- ZL CVA;
- Z B 24 24 264 252;
- Z B 24 24 -108 204;
- Z B 24 24 84 144;
- Z B 24 24 480 144;
- Z B 24 24 -12 84;
- Z B 24 24 264 -48;
- ZL CCA;
- Z B 24 24 -12 204;
- Z B 24 24 84 204;
- Z B 24 24 198 204;
- Z B 24 24 372 204;
- Z B 24 24 468 204;
- Z B 24 24 576 204;
- Z B 24 24 -108 0;
- Z B 24 24 -12 0;
- Z B 24 24 84 0;
- Z B 24 24 204 0;
- Z B 24 24 372 0;
- Z B 24 24 504 0;
- Z B 24 24 612 0;
- ZL CCA;
- Z B 24 24 204 252;
- Z B 24 24 204 -48;
- ZL CCP;
- Z B 24 24 420 120;
- Z B 24 24 168 84;
- ZL CSP;
- Z B 240 24 60 240;
- Z B 300 24 474 240;
- Z B 684 72 282 192;
- Z B 96 72 204 -60;
- Z94 GND -120 -48 CMS;
- Z94 phi1_bar 456 -48 CPG;
- Z94 Vdd 468 276 CMS;
- Z94 phi1 564 -48 CPG;
- Z94 in 636 0;
- Z94 Vdd 612 -72 CMS;
- Z94 out -108 204 CMF;
- Z94 i1 504 0;
- Z94 i2 168 84;
- Z94 phi2 -60 252 CPG;
- Z94 phi2_bar 36 252 CPG;
- ZDF;
- ZC 1;
- ZEnd
- STUNKYFLUFF
- set `sum scmos.test.cif`
- if test 53930 != $1
- then
- echo scmos.test.cif: Checksum error. Is: $1, should be: 53930.
- fi
- echo ALL DONE!
- exit 0
-
-
-