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

  1. From decwrl!wuarchive!cs.utexas.edu!uunet!allbery Tue Nov  7 12:46:16 PST 1989
  2. Article 1167 of comp.sources.misc:
  3. Path: decwrl!wuarchive!cs.utexas.edu!uunet!allbery
  4. From: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5. Newsgroups: comp.sources.misc
  6. Subject: v09i001: Patch 1 for cif2ps (a CIF to PostScript translator)
  7. Message-ID: <71547@uunet.UU.NET>
  8. Date: 7 Nov 89 00:29:33 GMT
  9. Sender: allbery@uunet.UU.NET
  10. Reply-To: gwr@gomez.mitre.org (Gordon W. Ross)
  11. Lines: 178
  12. Approved: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  13.  
  14. Posting-number: Volume 9, Issue 1
  15. Submitted-by: gwr@gomez.mitre.org (Gordon W. Ross)
  16. Archive-name: cif2ps.p1
  17.  
  18. This is patch number 1 for cif2ps (as modified by Gordon W. Ross).
  19. The initial version of cif2ps ignored the (optional) "box-direction"
  20. part of cif box commands, causing incorrect plots for cif files using
  21. boxes with a "direction" specifier.  The code added here only handles
  22. box directions which are a multiple of 90 degrees (most are).
  23. Handling arbitrary box directions would require major changes...
  24. and the parser is a mess... 
  25. Anyone volunteers to replace the parser with the Oct or UW cif parser?
  26.  
  27. Other changes in this patch include:
  28.     improvements to error messages
  29.     the default plot-cell is now the top level (cell zero).
  30.  
  31. The changes are attached (you can use patch to apply them).
  32.  
  33. Gordon W. Ross    gwr@gomez.mitre.org    (617) 271-3205 (daytime)
  34. The MITRE Corp. (M/S E025)  Burlington Road, Bedford, MA 01730
  35.  
  36. ------------------------ patch 1 for cif2ps ---------------------
  37. *** cifgood.old    Tue Oct 24 18:16:17 1989
  38. --- cifgood.c    Mon Nov  6 17:02:32 1989
  39. ***************
  40. *** 270,276 ****
  41.           {
  42.           if (++last_symbol == MAXSYMBOLS)
  43.               {
  44. !             fprintf(stderr, "Exceeded the number of allowed symbols\n");
  45.               exit(1);
  46.               }
  47.           temp_index = last_symbol;
  48. --- 270,276 ----
  49.           {
  50.           if (++last_symbol == MAXSYMBOLS)
  51.               {
  52. !             fprintf(stderr, "Too many cell definitions\n");
  53.               exit(1);
  54.               }
  55.           temp_index = last_symbol;
  56. ***************
  57. *** 375,382 ****
  58.   cif_box(cif)
  59.   char    *cif;
  60.   {
  61.   int    next_one, i;
  62. ! int    temp[4];
  63.   char    token[MAXTOKEN];
  64.   boxtype    *box, *allocbox();
  65.   
  66. --- 375,383 ----
  67.   cif_box(cif)
  68.   char    *cif;
  69.   {
  70. + static char *error = "incorrect box\n";
  71.   int    next_one, i;
  72. ! int    temp[4],dirX,dirY;
  73.   char    token[MAXTOKEN];
  74.   boxtype    *box, *allocbox();
  75.   
  76. ***************
  77. *** 392,398 ****
  78.           next_one = get_token(cif, next_one, token);
  79.           if (next_one == -1)
  80.               {
  81. !             fprintf(stderr, "incomplete box\n");
  82.               cif_output(stderr, cif);
  83.               return;
  84.               }
  85. --- 393,399 ----
  86.           next_one = get_token(cif, next_one, token);
  87.           if (next_one == -1)
  88.               {
  89. !             fprintf(stderr, error);
  90.               cif_output(stderr, cif);
  91.               return;
  92.               }
  93. ***************
  94. *** 399,404 ****
  95. --- 400,432 ----
  96.           (void) sscanf(token, "%d", &(temp[i]));
  97.       }
  98.   
  99. +     /* Check for box direction */
  100. +     next_one = get_token(cif, next_one, token);
  101. +     if (0 < next_one) { /* box rotated */
  102. +       (void) sscanf(token, "%d", &dirX);
  103. +       next_one = get_token(cif, next_one, token);
  104. +       if (next_one == -1) {
  105. +         fprintf(stderr, error);
  106. +         cif_output(stderr, cif);
  107. +         return;
  108. +       }
  109. +       (void) sscanf(token, "%d", &dirY);
  110. +       /* fix-up box dimensions */
  111. +       if (dirX==0) {
  112. +         /* rotate this box by 90 degrees */
  113. +         dirX=temp[0];
  114. +         temp[0]=temp[1];
  115. +         temp[1]=dirX;
  116. +       } else { /* dirX != 0 */
  117. +         /* just assert manhattan direction */
  118. +         if (dirY != 0) {
  119. +           fprintf(stderr, "box is non-manhattan\n");
  120. +           cif_output(stderr, cif);
  121. +           return;
  122. +         }
  123. +       }
  124. +     } /* if (0 < next_one)... box rotated */
  125.       /* *temp = width, height, center-x, center-y */
  126.       box->llx = a_over_b * (temp[2] - temp[0]/2);
  127.       box->urx = a_over_b * (temp[2] + temp[0]/2);
  128. ***************
  129. *** 481,487 ****
  130.   cif_polygon(cif)
  131.   char    *cif;
  132.   {
  133. -     static char *error = "can't read polygon";
  134.       ngontype *ngon;
  135.       int points=0;
  136.       int *pointsArray;
  137. --- 509,514 ----
  138. ***************
  139. *** 555,561 ****
  140.   cif_wire(cif)
  141.   char    *cif;
  142.   {
  143. !     static char *error = "can't read wire";
  144.       static char token[MAXTOKEN];
  145.       static int width;
  146.       int column=1;    /* current column in cif line */
  147. --- 582,588 ----
  148.   cif_wire(cif)
  149.   char    *cif;
  150.   {
  151. !     static char *error = "incorrect wire\n";
  152.       static char token[MAXTOKEN];
  153.       static int width;
  154.       int column=1;    /* current column in cif line */
  155. ***************
  156. *** 566,572 ****
  157.       /* read the wire width */
  158.       column = get_token(cif, column, token);
  159.       if((column == -1) || (1 != sscanf(token, "%d", &width))) {
  160. !       fprintf(stderr,error,"width");
  161.         cif_output(stderr,cif);
  162.         return;
  163.       }
  164. --- 593,599 ----
  165.       /* read the wire width */
  166.       column = get_token(cif, column, token);
  167.       if((column == -1) || (1 != sscanf(token, "%d", &width))) {
  168. !       fprintf(stderr,error);
  169.         cif_output(stderr,cif);
  170.         return;
  171.       }
  172.  
  173. *** cif2ps.old    Tue Oct 24 18:05:03 1989
  174. --- cif2ps.c    Mon Nov  6 09:40:27 1989
  175. ***************
  176. *** 169,174 ****
  177.       } else {
  178.           /* use default choice of symbol */
  179. !         /* usually want "1" if it exists, else "0" */
  180. !         sym_index = get_index(1);
  181.           if (sym_index < 0) sym_index = 0;
  182.       }
  183. --- 169,174 ----
  184.       } else {
  185.           /* use default choice of symbol */
  186. !         /* cell zero is the top level */
  187. !         sym_index = get_index(0);
  188.           if (sym_index < 0) sym_index = 0;
  189.       }
  190. ----------------------------- end of patch 1 --------------------------
  191.  
  192.  
  193.