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

Defined functions

fplt defined in line 37; used 2 times
gets defined in line 122; used 2 times
getsi defined in line 113; used 28 times
main defined in line 6; never used

Defined variables

deltx defined in line 3; used 1 times
  • in line 14
delty defined in line 4; used 1 times
  • in line 17
Last modified: 1981-07-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 742
Valid CSS Valid XHTML 1.0 Strict