1: #include <stdio.h>
   2: #
   3: #include "def.h"
   4: int errflag;
   5: FILE *infd;
   6: 
   7: 
   8: int intcase=1, arbcase=0;
   9: int exitsize=0;         /* max number of nodes to be left in loop without iterating */
  10: int maxnode=400;    /* max number of nodes */
  11: int maxhash=347;    /* prime number = size of hash table */
  12: int progress=0;     /* if not 0, print line number every n lines, n = progress */
  13: int labinit=10;         /* labels generated starting with labinit */
  14: int labinc=10;          /* labels increase by labinc */
  15: int inputform=0;        /* = 0 if freeform input, 1 if standard form input */
  16: int debug=0;
  17: int levbrk=1;   /* true implies multilevel breaks; false implies single-level breaks only */
  18: int levnxt=1;   /* true implies multilevel nexts; false implies single-level nexts only */
  19: 
  20: 
  21: int maxprogsw=12;       /* number of program switches which can be set */
  22: char *progsw[]      = {"i", "a",
  23:             "e", "m",
  24:             "h", "p",
  25:             "t", "c",
  26:             "s", "d",
  27:             "b", "n"
  28:             };
  29: 
  30: 
  31: int *swval[]        = {&intcase, &arbcase,
  32:             &exitsize, &maxnode,
  33:             &maxhash, &progress,
  34:             &labinit, &labinc,
  35:             &inputform, &debug,
  36:             &levbrk, &levnxt
  37:             };
  38: 
  39: 
  40: char *getargs(argc, argv)
  41: int argc; char *argv[];
  42:     {
  43:     int n, infile;
  44:     infile = 0;
  45: 
  46:     for (n = 1; n < argc; ++n)
  47:         {
  48:         if (argv[n][0] == '-')
  49:             setsw(&argv[n][1]);
  50:         else
  51:             {
  52:             if (infile != 0)
  53:                 error("multiple input files - using first one: ", argv[infile],"");
  54:             else
  55:                 infile = n;
  56:             }
  57:         }
  58:     if (errflag)
  59:         exit(1);
  60:     if (!infile) faterr("no input file","","");
  61:     infd = fopen(argv[infile],"r");
  62:     if (infd == NULL)
  63:         faterr("can't open input file:",argv[infile],"");
  64:     return;
  65:     }
  66: 
  67: setsw(str)
  68: char *str;
  69:     {
  70:     int i, val, swnum;
  71: #define maxtemp 15
  72:     char temp[maxtemp];
  73:     for (i = 0; 'a' <= str[i] && str[i] <= 'z'; ++i)
  74:         {
  75:         if (i >= maxtemp)
  76:             {
  77:             error("invalid switch:",str,"");
  78:             errflag = 1;
  79:             }
  80:         temp[i] = str[i];
  81:         }
  82:     temp[i] = '\0';
  83: 
  84:     swnum = find(temp,progsw,maxprogsw);
  85:     if (swnum == -1)
  86:         {
  87:         error("invalid switch:", str,"");
  88:         errflag = 1;
  89:         return;
  90:         }
  91:     if (str[i] == '\0')
  92:         *(swval[swnum]) = !*(swval[swnum]);
  93:     else
  94:         {
  95:         sscanf(&str[i],"%d",&val);
  96:         *(swval[swnum]) = val;
  97:         }
  98:     }

Defined functions

getargs defined in line 40; used 2 times
setsw defined in line 67; used 1 times
  • in line 49

Defined variables

debug defined in line 16; used 6 times
errflag defined in line 4; used 4 times
exitsize defined in line 9; used 1 times
  • in line 32
inputform defined in line 15; used 1 times
  • in line 35
intcase defined in line 8; used 1 times
  • in line 31
labinc defined in line 14; used 1 times
  • in line 34
labinit defined in line 13; used 1 times
  • in line 34
levbrk defined in line 17; used 1 times
  • in line 36
levnxt defined in line 18; used 1 times
  • in line 36
maxhash defined in line 11; used 1 times
  • in line 33
maxnode defined in line 10; used 1 times
  • in line 32
maxprogsw defined in line 21; used 1 times
  • in line 84
progress defined in line 12; used 4 times
progsw defined in line 22; used 1 times
  • in line 84
swval defined in line 31; used 3 times

Defined macros

maxtemp defined in line 71; used 2 times
Last modified: 1981-07-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 827
Valid CSS Valid XHTML 1.0 Strict