Pristine Ack-5.5
[Ack-5.5.git] / lang / basic / src / parsepar.c
1 /*
2  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
3  * See the copyright notice in the ACK home directory, in the file "Copyright".
4  */
5
6 #include "bem.h"
7
8 #ifndef NORSCID
9 static char rcs_id[] = "$Id: parsepar.c,v 1.3 1994/06/24 11:30:59 ceriel Exp $" ;
10 #endif
11
12
13 int     listing;                /* -l listing required */
14 int     debug;                  /* -d compiler debugging */
15 int     wflag=0;                /* -w no warnings */
16 int     traceflag=0;            /* generate line tracing code */
17 int     nolins=0;               /* generate no LIN statements */
18
19
20
21 parseparams(argc,argv)
22 int argc;
23 char **argv;
24 {
25         int files=0 ;
26         int i;
27         register char *p;
28
29         if(argc< 4)
30         {
31                 fprint(STDERR,"usage %s <flags> <file> <file> <source>\n", 
32                         argv[0]);
33                 sys_stop(S_EXIT);
34         }
35
36         for(i=1;i<argc;i++)
37                 if( argv[i][0]=='-')
38                         switch(argv[i][1])
39                         {
40                                 case 'D': yydebug++;
41                                           break;        /* parser debugging */
42                                 case 't': traceflag++; 
43                                           break;        /* line tracing */
44                                 case 'h': /* split EM file */
45                                           fprint(STDERR,
46                                                  "h option not implemented\n");
47                                           break;
48                                 case 'd': debug++; 
49                                           break;
50                                 case 'L': nolins++; 
51                                           break; /* no EM lin statements */
52                                 case 'E': listing++; 
53                                           break; /* generate full listing */
54                                 case 'w': wflag++;
55                                           break; /* no warnings */
56                                 case 'V':
57                                           p = &argv[i][2];
58                                           while (*p) switch(*p++) {
59                                           case 'w':
60                                                 BEMINTSIZE = *p++ - '0';
61                                                 break;
62                                           case 'p':
63                                                 BEMPTRSIZE = *p++ - '0';
64                                                 break;
65                                           case 'f':
66                                                 BEMFLTSIZE = *p++ - '0';
67                                                 break;
68                                           default:
69                                                 p++;
70                                                 break;
71                                           }
72                         } else {
73                                 /* new input file */
74                                 switch ( files++ ) {
75                                         case 0: inpfile= argv[i]; break;
76                                         case 1: outfile= argv[i]; break;
77                                         case 2: /* should be the source file 
78                                                    name */
79                                                 program= argv[i]; 
80                                                 break;
81                                         default:fatal("Too many file arguments") ;
82                                 }
83                         }
84                 if (files < 3) fatal("Too few file arguments");
85 }