parsepar.c 1.8 KB

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