1: #ifndef lint
   2: static char sccsid[] = "@(#)debug.c	4.2 (Berkeley) 1/9/85";
   3: #endif
   4: 
   5: #include <stdio.h>
   6: 
   7: float deltx;
   8: float delty;
   9: 
  10: main(argc,argv)  char **argv; {
  11:     int std=1;
  12:     FILE *fin;
  13: 
  14:     while(argc-- > 1) {
  15:         if(*argv[1] == '-')
  16:             switch(argv[1][1]) {
  17:                 case 'l':
  18:                     deltx = atoi(&argv[1][2]) - 1;
  19:                     break;
  20:                 case 'w':
  21:                     delty = atoi(&argv[1][2]) - 1;
  22:                     break;
  23:                 }
  24: 
  25:         else {
  26:             std = 0;
  27:             if ((fin = fopen(argv[1], "r")) == NULL) {
  28:                 fprintf(stderr, "can't open %s\n", argv[1]);
  29:                 exit(1);
  30:                 }
  31:             fplt(fin);
  32:             }
  33:         argv++;
  34:         }
  35:     if (std)
  36:         fplt( stdin );
  37:     exit(0);
  38:     }
  39: 
  40: 
  41: fplt(fin)  FILE *fin; {
  42:     int c;
  43:     char s[256];
  44:     int xi,yi,x0,y0,x1,y1,r/*,dx,n,i*/;
  45: 
  46:     printf("openpl\n");
  47:     while((c=getc(fin)) != EOF){
  48:         switch(c){
  49:         case 'm':
  50:             xi = getsi(fin);
  51:             yi = getsi(fin);
  52:             printf("move %d %d\n", xi, yi);
  53:             break;
  54:         case 'l':
  55:             x0 = getsi(fin);
  56:             y0 = getsi(fin);
  57:             x1 = getsi(fin);
  58:             y1 = getsi(fin);
  59:             printf("line %d %d   %d %d\n", x0, y0, x1, y1);
  60:             break;
  61:         case 't':
  62:             getstr(s,fin);
  63:             printf("label %s\n", s);
  64:             break;
  65:         case 'e':
  66:             printf("erase\n");
  67:             break;
  68:         case 'p':
  69:             xi = getsi(fin);
  70:             yi = getsi(fin);
  71:             printf("point %d %d\n", xi, yi);
  72:             break;
  73:         case 'n':
  74:             xi = getsi(fin);
  75:             yi = getsi(fin);
  76:             printf("continue %d %d\n", xi, yi);
  77:             break;
  78:         case 's':
  79:             x0 = getsi(fin);
  80:             y0 = getsi(fin);
  81:             x1 = getsi(fin);
  82:             y1 = getsi(fin);
  83:             printf("space %d %d   %d %d\n", x0, y0, x1, y1);
  84:             break;
  85:         case 'a':
  86:             xi = getsi(fin);
  87:             yi = getsi(fin);
  88:             x0 = getsi(fin);
  89:             y0 = getsi(fin);
  90:             x1 = getsi(fin);
  91:             y1 = getsi(fin);
  92:             printf("arc\n");
  93:             break;
  94:         case 'c':
  95:             xi = getsi(fin);
  96:             yi = getsi(fin);
  97:             r = getsi(fin);
  98:             printf("circle\n");
  99:             break;
 100:         case 'f':
 101:             getstr(s,fin);
 102:             printf("linemod %s\n", s);
 103:             break;
 104:         default:
 105:             fprintf(stderr, "Unknown command %c (%o)\n", c, c);
 106:             break;
 107:             }
 108:         }
 109:     printf("closepl\n");
 110:     }
 111: getsi(fin)  FILE *fin; {    /* get an integer stored in 2 ascii bytes. */
 112:     short a, b;
 113:     if((b = getc(fin)) == EOF)
 114:         return(EOF);
 115:     if((a = getc(fin)) == EOF)
 116:         return(EOF);
 117:     a = a<<8;
 118:     return(a|b);
 119: }
 120: getstr(s,fin)  char *s;  FILE *fin; {
 121:     for( ; *s = getc(fin); s++)
 122:         if(*s == '\n')
 123:             break;
 124:     *s = '\0';
 125: }

Defined functions

fplt defined in line 41; used 2 times
getsi defined in line 111; used 23 times
getstr defined in line 120; used 2 times
main defined in line 10; never used

Defined variables

deltx defined in line 7; used 1 times
  • in line 18
delty defined in line 8; used 1 times
  • in line 21
sccsid defined in line 2; never used
Last modified: 1987-02-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1875
Valid CSS Valid XHTML 1.0 Strict