Annotation of researchv9/jtools/src/cip/dump.c, revision 1.1.1.1

1.1       root        1: /*
                      2:        %Z%  %M%  version %I% %Q%of %H% %T%
                      3:        Last Delta:  %G% %U% to %P%
                      4: */
                      5: 
                      6: #ifdef DUMP
                      7: #include "cip.h"
                      8: 
                      9: extern struct macro *macroList;
                     10: 
                     11: char *types [] = {
                     12:   "CIRCLE", "BOX", "ELLIPSE", "LINE", "ARC", "SPLINE", "TEXT", "MACRO"
                     13: };
                     14: char *linetypes [] = {
                     15:   "SOLID", "DASHED", "DOTTED"
                     16: };
                     17: char fn[] = "dumpfile";
                     18: FILE *fp;
                     19: 
                     20: dump (h)
                     21: struct thing *h;
                     22: {
                     23:   struct macro *ml;
                     24:   fontBlk *f;
                     25: 
                     26:   if ((fp = fopen (fn, "w")) != (FILE *) NULL) {
                     27:     fprintf (fp, "\n*******        THING   LIST        *******\n");
                     28:     sleep (60);
                     29:     printThing (0, h);
                     30:     fprintf (fp, "\n*******        MACRO   LIST        *******\n\n");
                     31:     sleep (60);
                     32:     for (ml = macroList; ml != (struct macro *) NULL; ml=ml->next) {
                     33:       printMacro (0, ml);
                     34:       fprintf (fp, "\n");
                     35:       sleep (60);
                     36:     }
                     37:     fprintf (fp, "\n*******        FONT    LIST        *******\n\n");
                     38:     sleep (60);
                     39:     if ((f = fonts) != (fontBlk *)NULL) {
                     40:       do {
                     41:        printFont (0, f);
                     42:        fprintf (fp, "\n");
                     43:        sleep (60);
                     44:       } while ((f=f->next) != fonts);
                     45:     }
                     46:     fclose (fp);
                     47:   }
                     48: }
                     49: 
                     50: char *_doprnt ();
                     51: 
                     52: printit (ind, fmt, x1)
                     53: int ind;
                     54: char *fmt;
                     55: unsigned x1;
                     56: {
                     57:   int i;
                     58: 
                     59:   for (i=0; i<ind; i++) {
                     60:     fprintf (fp, "   ");
                     61:   }
                     62:   _doprnt (fp, fmt, &x1);
                     63: }
                     64: printThing (ind, h)
                     65: int ind;
                     66: struct thing *h;
                     67: {
                     68:   int i;
                     69:   Point *p;
                     70:   struct thing *t;
                     71: 
                     72:   if ((t = h) != TNULL) {
                     73:     do {
                     74:       fprintf (fp,  "\n");
                     75:       sleep (60);
                     76:       printit (ind, "%s @ %d\n", types[t->type], t);
                     77:       printit (ind, "   origin              = {%d,%d}\n", 
                     78:                             t->origin.x, t->origin.y);
                     79:       printit (ind, "   bb                  = {%d,%d,%d,%d}\n", 
                     80:                             t->bb.origin.x, t->bb.origin.y,
                     81:                             t->bb.corner.x, t->bb.corner.y);
                     82:       switch (t->type) {
                     83:        case CIRCLE: {
                     84:          printit (ind, "   radius              = %d\n", 
                     85:                             t->otherValues.radius);
                     86:          break;
                     87:        }
                     88:        case BOX: {
                     89:          printit (ind, "   corner              = {%d,%d}\n",
                     90:                             t->otherValues.corner.x,
                     91:                             t->otherValues.corner.y);
                     92:          printit (ind, "   %s\n", linetypes[t->boorder]);
                     93:          break;
                     94:        }
                     95:        case ELLIPSE: {
                     96:          printit (ind, "   height      = %d\n",
                     97:                             t->otherValues.ellipse.ht);
                     98:          printit (ind, "   width       = %d\n",
                     99:                             t->otherValues.ellipse.wid);
                    100:          break;
                    101:        }
                    102:        case LINE: {
                    103:          printit (ind, "   end         = {%d,%d}\n",
                    104:                             t->otherValues.end);
                    105:          printit (ind, "   %s\n", linetypes[t->boorder]);
                    106:          break;
                    107:        }
                    108:        case ARC: {
                    109:          printit (ind, "   start       = {%d,%d}\n",
                    110:                             t->otherValues.arc.start);
                    111:          printit (ind, "   end = {%d,%d}\n",
                    112:                             t->otherValues.arc.end);
                    113:          break;
                    114:        }
                    115:        case SPLINE: {
                    116:          printit (ind, "   used        = %d\n",
                    117:                             t->otherValues.spline.used);
                    118:          printit (ind, "   size        = %d\n",
                    119:                             t->otherValues.spline.size);
                    120:          p = t->otherValues.spline.plist;
                    121:          printit (ind, "   PLIST @ %d\n", p);
                    122:          for (i=0; i<t->otherValues.spline.used+3; i++) {
                    123:            printit (ind, "      {%d,%d}\n", p->x, p->y);
                    124:            p++;
                    125:          }
                    126:          break;
                    127:        }
                    128:        case TEXT: {
                    129:          printit (ind, "   text                = %s\n",
                    130:                             t->otherValues.text.s);
                    131:          printFont (ind, t->otherValues.text.f);
                    132:          break;
                    133:        }
                    134:        case MACRO: {
                    135:          printit (ind, "   list               = %d\n",
                    136:                             t->otherValues.list);
                    137:          break;
                    138:        }
                    139:       }
                    140:       printit (ind, "   next            = %d\n", t->next);
                    141:       printit (ind, "   last            = %d\n", t->last);
                    142:       t = t->next;
                    143:     } while (t != h);
                    144:   }
                    145: }
                    146: 
                    147: printMacro (ind, ml)
                    148: int ind;
                    149: struct macro *ml;
                    150: {
                    151:   printit (ind, "   macro @ %d\n", ml);
                    152:   printit (ind, "   list->name          = %s\n", ml->name);
                    153:   printit (ind, "   list->outName       = %s\n", ml->outName);
                    154:   printit (ind, "   list->useCount      = %d\n", ml->useCount);
                    155:   printit (ind, "   list->bb            = {%d,%d,%d,%d}\n",
                    156:                     ml->bb.origin.x,
                    157:                     ml->bb.origin.y,
                    158:                     ml->bb.corner.x,
                    159:                     ml->bb.corner.y);
                    160:   printit (ind, "   list->next          = %d\n", ml->next);
                    161:   printit (ind, "   list->xReflect      = %d\n", ml->xReflect);
                    162:   printit (ind, "   list->yReflect      = %d\n", ml->yReflect);
                    163:   printit (ind, "   list->parts         = %d\n", ml->parts);
                    164:   printThing (ind+1, ml->parts);
                    165: }
                    166: 
                    167: printFont (ind, f)
                    168: int ind;
                    169: fontBlk *f;
                    170: {
                    171:   printit (ind, "   text @              = %d\n", f);
                    172:   printit (ind, "   text.f->ps          = %d\n", f->ps);
                    173:   printit (ind, "   text.f->num         = %d\n", f->num);
                    174:   printit (ind, "   text.f->useCount    = %d\n", f->useCount);
                    175:   printit (ind, "   text.f->next        = %d\n", f->next);
                    176:   printit (ind, "   text.f->last        = %d\n", f->last);
                    177: }
                    178: #endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.