home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / fchek284.zip / ftnchek.h.orig < prev    next >
Text File  |  1995-05-31  |  22KB  |  636 lines

  1. /* ftnchek.h:
  2.  
  3.     Common definitions for Fortran Program Checker
  4.  
  5.     Copyright (C) 1994 by Robert K. Moniot.
  6.     This program is free software.  Permission is granted to
  7.     modify it and/or redistribute it, retaining this notice.
  8.     No guarantees accompany this software.
  9.  
  10. */
  11.  
  12. #define COPYRIGHT_DATE \
  13. "Copyright (C) 1994, 1995 by Robert K. Moniot"
  14. #define COPYRIGHT_NOTICE \
  15. "This program is free software.  Permission is granted to\n\
  16. modify it and/or redistribute it, retaining this notice.\n\
  17. No guarantees accompany this software."
  18. #define VERSION_NUMBER        "FTNCHEK Version 2.8 May 1995"
  19. #define PATCHLEVEL        "Patch Level 3"
  20. #define PROJECT_VERSION        "P2" /* Project file format version number */
  21.     /* The following system defines should be defined with the -D
  22.        (for UNIX) or /DEFINE (for VMS) compiler options in the makefile,
  23.        not here.  They are shown here so you know what to define.
  24.     */
  25.  
  26. /*#define VMS*/        /* Set flag for VAX/VMS   system-dependent defns. */
  27. /*#define UNIX*/    /* Set flag for UNIX (ATT or BSD) defns. */
  28. #ifdef __TURBOC__
  29. #define MSDOS        /* Set flag for MSDOS (IBM PC) */
  30. #define T_ALLOC        /* Specify workaround for malloc limits */
  31. #endif
  32.  
  33. #ifdef MSDOS
  34. #define NO_FLOATING_POINT    /* No need for floating point coprocessor */
  35. #endif
  36.             /* For portability, declare standard routines here. */
  37. #if defined(__STDC__) || defined(__osf__)
  38. #include <stdlib.h>
  39. #else
  40. char *getenv();
  41. char *malloc(), *calloc();
  42. void exit();
  43. #endif
  44.  
  45.  
  46. #ifdef VMS
  47.     /* If VMS system, define flag for extra VMS-isms in
  48.        iokeywds.h table unless NO_VMS_IO is defined. These
  49.        can be independently enabled by defining VMS_IO. */
  50. #ifndef NO_VMS_IO
  51. #define VMS_IO
  52. #endif /*NO_VMS_IO*/
  53.     /* Likewise define flag for VMS behavior in INCLUDE stmt
  54.        (defaulting extension, /NOLIST feature) unless
  55.        NO_VMS_INCLUDE is defined.  */
  56. #ifndef NO_VMS_INCLUDE
  57. #define VMS_INCLUDE
  58. #endif /*NO_VMS_INCLUDE*/
  59.  
  60. #endif /*VMS*/
  61.  
  62.     /* set flag to allow options to start with '/' */
  63. #ifndef OPTION_PREFIX_SLASH
  64. #ifdef VMS
  65. #define OPTION_PREFIX_SLASH
  66. #endif
  67. #ifdef MSDOS
  68. #define OPTION_PREFIX_SLASH
  69. #endif
  70. #endif
  71.  
  72.     /* The following defines control warnings about nonstandard
  73.        extensions.  If ALLOW_foo is 1, warning will be given about
  74.        foo only if -f77 flag is set.  If ALLOW_foo is 0, warning
  75.        will be given regardless of -f77 flag.  In either case, the
  76.        extension will be correctly parsed and interpreted.  The
  77.        code handling these extensions is often set off by ifdef's
  78.        but by now it is assumed that they will always be defined
  79.        (0 or 1).  All these default to 0 if STRICT_SYNTAX is
  80.        defined, 1 otherwise.  The default can be overridden by
  81.        defining each option explicitly.
  82.  
  83.        At present, there is no way to control these options at run
  84.        time.
  85.  
  86.        DEC_TABS sets the default value of -tab option.
  87.        If INLINE_COMMENT_CHAR is not defined, ! comments will cause
  88.        ftnchek to choke.
  89.      */
  90.  
  91. #ifdef STRICT_SYNTAX
  92. #define ALLOW_ALL 0
  93. #else
  94. #define ALLOW_ALL 1
  95. #define INLINE_COMMENT_CHAR '!' /* Inline comments starting with '!' */
  96. #endif
  97.  
  98. #ifndef DEC_TABS    /* DEC-style ugly tabbed source is off by default */
  99. #define DEC_TABS 0
  100. #endif
  101.  
  102. #ifndef ALLOW_DO_ENDO    /* The various DO loop extensions (including WHILE) */
  103. #define ALLOW_DO_ENDO ALLOW_ALL
  104. #endif
  105. #ifndef ALLOW_DOLLARSIGNS    /* Some systems allow $ in identifiers too */
  106. #define ALLOW_DOLLARSIGNS ALLOW_ALL
  107. #endif
  108. #ifndef ALLOW_FORMAT_DOLLARSIGNS /*  Allow $ control code in FORMAT */
  109. #define ALLOW_FORMAT_DOLLARSIGNS ALLOW_ALL
  110. #endif
  111. #ifndef ALLOW_INCLUDE        /* The INCLUDE statement */
  112. #define ALLOW_INCLUDE ALLOW_ALL
  113. #endif
  114. #ifndef ALLOW_QUOTEMARKS    /* Strings delimited by "quote marks" */
  115. #define ALLOW_QUOTEMARKS ALLOW_ALL
  116. #endif
  117. #ifndef ALLOW_TYPELESS_CONSTANTS    /* Like Z'19AF' */
  118. #define ALLOW_TYPELESS_CONSTANTS ALLOW_ALL
  119. #endif
  120. #ifndef ALLOW_UNDERSCORES    /* Underscores in variable names */
  121. #define ALLOW_UNDERSCORES ALLOW_ALL
  122. #endif
  123. #ifndef ALLOW_UNIX_BACKSLASH    /* backslash escape in strings */
  124. #define ALLOW_UNIX_BACKSLASH ALLOW_ALL
  125. #endif
  126. #ifndef ALLOW_UNIX_CPP /*  Support for Unix C preprocessor directives. */
  127. #define ALLOW_UNIX_CPP ALLOW_ALL
  128. #endif
  129. #ifndef ALLOW_VARIABLE_FORMAT        /* VMS style <integer_expr> for     */
  130. #define ALLOW_VARIABLE_FORMAT ALLOW_ALL    /* format repeat spec or field size */
  131. #endif
  132.  
  133.  
  134.         /* If STANDARD_INTRINSICS is defined, only F77 standard
  135.            intrinsic functions will be known to ftnchek.  Otherwise
  136.            there are three classes of nonstandard intrinsics:
  137.            common, Unix flavor, and VMS flavor.  The
  138.            Unix or VMS flavor will be selected if UNIX or
  139.            VMS rsptly is defined, unless suppressed with
  140.            NO_UNIX_INTRINSICS or NO_VMS_INTRINSICS.
  141.          */
  142. #ifndef STANDARD_INTRINSICS
  143.  
  144. #define NONSTD_INTRINSICS    /* Common nonstandard intrinsic functions */
  145.  
  146. #ifdef UNIX
  147. #ifndef NO_UNIX_INTRINSICS
  148. #define UNIX_INTRINSICS        /* UNIX intrinsic functions */
  149. #endif
  150.     /* Note: RAND syntax varies.  Define RAND_NO_ARG to make ftnchek
  151.        expect X=RAND(). By default ftnchek expects X=RAND(ISEED).
  152.      */
  153. #endif
  154.  
  155. #ifdef VMS
  156. #ifndef NO_VMS_INTRINSICS
  157. #define VMS_INTRINSICS        /* VMS intrinsic functions */
  158. #endif
  159. #endif
  160.  
  161. #endif
  162.  
  163.         /* Define to tolerate embedded blanks in numeric consts unless
  164.            feature turned off by defining NO_BLANKS_IN_NUMBERS. */
  165. #ifndef NO_BLANKS_IN_NUMBERS
  166. #define BLANKS_IN_NUMBERS
  167. #endif
  168.  
  169.         /* Define default source and output file extensions.  These
  170.          * can be overridden by defines on compiler commandline.
  171.          */
  172. #ifndef DEF_SRC_EXTENSION
  173. #ifdef VMS
  174. #define DEF_SRC_EXTENSION ".for"        /* VMS default extension */
  175. #endif
  176. #ifdef MSDOS
  177. #define DEF_SRC_EXTENSION ".for"        /* IBM PC default extension */
  178. #endif
  179. #endif /* DEF_SRC_EXTENSION */
  180.  
  181. #ifndef DEF_SRC_EXTENSION
  182. #define DEF_SRC_EXTENSION ".f"        /* Unix and all others */
  183. #endif
  184.         /* define default list-file extension */
  185. #ifndef DEF_LIST_EXTENSION
  186. #define DEF_LIST_EXTENSION ".lis"
  187. #endif
  188.         /* define default project-file extension */
  189. #ifndef DEF_PROJ_EXTENSION
  190. #define DEF_PROJ_EXTENSION ".prj"
  191. #endif
  192.         /* define default declaration-file extension */
  193. #ifndef DEF_DCL_EXTENSION
  194. #define DEF_DCL_EXTENSION ".dcl"
  195. #endif
  196.         /* define project-file name for case of input from stdin */
  197. #ifndef STDIN_PROJ_FILENAME
  198. #define STDIN_PROJ_FILENAME "ftnchek.prj"
  199. #endif
  200.  
  201. #ifndef ENV_PREFIX        /* prefix for option environment variables */
  202. #define ENV_PREFIX "FTNCHEK_"
  203. #endif
  204.  
  205. #ifndef MAXLINE
  206. #define MAXLINE 132    /* Maximum input line length.  Ignores past this. */
  207. #endif
  208. #ifndef MAXIDSIZE
  209. #define MAXIDSIZE 31    /* Longest identifier allowed */
  210. #endif
  211. #ifndef MAX_SRC_TEXT
  212. #define MAX_SRC_TEXT (20*66) /* Longest text string of a token */
  213. #endif
  214. #ifndef MAX_CHAR_CODE
  215. #define MAX_CHAR_CODE 255 /* Largest possible value of a char (8 bits here) */
  216. #endif
  217. #ifndef MAX_INCLUDE_DEPTH
  218. #define MAX_INCLUDE_DEPTH 16    /* Max nesting depth of include files */
  219. #endif
  220. #ifndef MAXEXPRTEXT
  221. #define MAXEXPRTEXT 15        /* length of expr text saved in arg lists */
  222. #endif
  223. #ifndef ENV_INCLUDE_VAR
  224. #define ENV_INCLUDE_VAR "INCLUDE" /* name of env variable for include dir */
  225. #endif
  226.  
  227. #ifndef DEFAULT_INCLUDE_DIR
  228. #ifdef UNIX
  229. #define DEFAULT_INCLUDE_DIR "/usr/include"
  230. #endif
  231. #ifdef VMS
  232. #define DEFAULT_INCLUDE_DIR "SYS$LIBRARY:"
  233. #endif
  234. #ifdef MSDOS
  235. #define DEFAULT_INCLUDE_DIR "\\include"
  236. #endif
  237. #endif
  238.  
  239. #define KEEP_ARG_NAMES 1    /* option was formerly experimental */
  240.  
  241.         /* Definitions of table sizes
  242.              Constraints:
  243.             STRSPACESZ > 20*72 so max f77 statement will fit
  244.             LOCSYMTABSZ+GLOBSYMTABSZ < HASHSZ so hashtab never full
  245.          */
  246.  
  247. #define KEYHASHSZ 195    /* Size of keyword hashtable -- do not change */
  248. #define INTRINS_HASHSZ 326 /* Chosen to give few clashes -- change with care */
  249.  
  250. #ifdef SMALL_MACHINE        /* Use these for e.g. IBM PC */
  251. #ifndef HASHSZ            /* Hint: pick one with no square factors */
  252. #define HASHSZ 798     /* SMALL_MACHINE Size of symbol hashtable */
  253. #endif
  254. #ifndef STRSPACESZ
  255. #define STRSPACESZ 4000 /* SMALL_MACHINE chunk size of string space */
  256. #endif
  257. #ifndef LOCSYMTABSZ
  258. #define LOCSYMTABSZ 300 /* SMALL_MACHINE Size of local symbol table */
  259. #endif
  260. #ifndef GLOBSYMTABSZ
  261. #define GLOBSYMTABSZ 400 /* SMALL_MACHINE Size of global symbol table */
  262. #endif
  263. #ifndef PARAMINFOSPACESZ
  264. #define PARAMINFOSPACESZ 20 /* SMALL_MACHINE ParamInfo structs per chunk */
  265. #endif
  266. #ifndef TOKHEADSPACESZ
  267. #define TOKHEADSPACESZ 50 /* SMALL_MACHINE TokenListHeaders per chunk */
  268. #endif
  269. #ifndef TOKENSPACESZ
  270. #define TOKENSPACESZ 200 /* SMALL_MACHINE tokens per token space chunk */
  271. #endif
  272. #ifndef ARGLISTHEADSZ
  273. #define ARGLISTHEADSZ    300 /* SMALL_MACHINE argument headers per chunk */
  274. #endif
  275. #ifndef ARGLISTELTSZ
  276. #define ARGLISTELTSZ    1000 /* SMALL_MACHINE argument list elts per chunk */
  277. #endif
  278. #ifndef COMLISTHEADSZ
  279. #define COMLISTHEADSZ    200 /* SMALL_MACHINE common list headers per chunk */
  280. #endif
  281. #ifndef COMLISTELTSZ
  282. #define COMLISTELTSZ    1000 /* SMALL_MACHINE common elts per chunk */
  283. #endif
  284. #ifndef PTRSPACESZ
  285. #define PTRSPACESZ    200  /* SMALL_MACHINE ptrs-to-arraydim per chunk */
  286. #endif
  287.  
  288. #else  /* end if SMALL_MACHINE */
  289.  
  290. #ifdef LARGE_MACHINE        /* use these if space is no problem */
  291. #ifndef HASHSZ        /* must be <= max int  */
  292. #define HASHSZ 20930     /* LARGE_MACHINE Size of symbol hashtable */
  293. #endif
  294. #ifndef STRSPACESZ
  295. #define STRSPACESZ 10000 /* LARGE_MACHINE chunk size of string space */
  296. #endif
  297. #ifndef LOCSYMTABSZ
  298. #define LOCSYMTABSZ 8000 /* LARGE_MACHINE Size of local symbol table */
  299. #endif
  300. #ifndef GLOBSYMTABSZ
  301. #define GLOBSYMTABSZ 12000 /* LARGE_MACHINE Size of global symbol table */
  302. #endif
  303. #ifndef PARAMINFOSPACESZ
  304. #define PARAMINFOSPACESZ 200 /* LARGE_MACHINE ParamInfo structs per chunk */
  305. #endif
  306. #ifndef TOKHEADSPACESZ
  307. #define TOKHEADSPACESZ 500 /* LARGE_MACHINE TokenListHeaders per chunk */
  308. #endif
  309. #ifndef TOKENSPACESZ
  310. #define TOKENSPACESZ 10000 /* LARGE_MACHINE tokens per token space chunk */
  311. #endif
  312. #ifndef ARGLISTHEADSZ
  313. #define ARGLISTHEADSZ    15000 /* LARGE_MACHINE argument headers per chunk */
  314. #endif
  315. #ifndef ARGLISTELTSZ
  316. #define ARGLISTELTSZ    50000    /* LARGE_MACHINE argument list elts per chunk */
  317. #endif
  318. #ifndef COMLISTHEADSZ
  319. #define COMLISTHEADSZ    10000 /* LARGE_MACHINE common list headers per chunk */
  320. #endif
  321. #ifndef COMLISTELTSZ
  322. #define COMLISTELTSZ    50000 /* LARGE_MACHINE common elts per chunk */
  323. #endif
  324. #ifndef PTRSPACESZ
  325. #define PTRSPACESZ    2000 /* LARGE_MACHINE Max number of ptrs to arraydim */
  326. #endif
  327.  
  328. #else        /* Defaults: Use these for average-size applications */
  329.  
  330. #ifndef HASHSZ
  331. #define HASHSZ 2002    /* Default Size of symbol hashtable */
  332. #endif
  333. #ifndef STRSPACESZ
  334. #define STRSPACESZ 10000 /* Default chunk size of string space */
  335. #endif
  336. #ifndef LOCSYMTABSZ
  337. #define LOCSYMTABSZ 800 /* Default Size of local symbol table */
  338. #endif
  339. #ifndef GLOBSYMTABSZ
  340. #define GLOBSYMTABSZ 1200 /* Default Size of global symbol table */
  341. #endif
  342. #ifndef PARAMINFOSPACESZ
  343. #define PARAMINFOSPACESZ 50 /* Default ParamInfo structs per chunk */
  344. #endif
  345. #ifndef TOKHEADSPACESZ
  346. #define TOKHEADSPACESZ 200 /* Default TokenListHeaders per chunk */
  347. #endif
  348. #ifndef TOKENSPACESZ
  349. #define TOKENSPACESZ 1000 /* Default tokens per token space chunk */
  350. #endif
  351. #ifndef ARGLISTHEADSZ
  352. #define ARGLISTHEADSZ    1500 /* Default argument headers per chunk */
  353. #endif
  354. #ifndef ARGLISTELTSZ
  355. #define ARGLISTELTSZ    5000    /* Default argument list elts per chunk */
  356. #endif
  357. #ifndef COMLISTHEADSZ
  358. #define COMLISTHEADSZ    1000 /* Default common list headers per chunk */
  359. #endif
  360. #ifndef COMLISTELTSZ
  361. #define COMLISTELTSZ    4000 /* Default common elts per chunk */
  362. #endif
  363. #ifndef PTRSPACESZ
  364. #define PTRSPACESZ    400 /* Default Max number of ptrs to arraydim */
  365. #endif
  366.  
  367. #endif /* end if LARGE_MACHINE else */
  368.  
  369. #endif/*end if SMALL_MACHINE else*/
  370.  
  371. /*  Default BpW = 4 bytes per word, which matches many machines.
  372.     If the Fortran code does not declare explicit sizes of
  373.     numeric variables (e.g. REAL*8), then the value of BpW will
  374.     not matter, since the table conforms to the standard in that
  375.     sizeof(INTEGER)=sizeof(REAL), and sizeof(DOUBLE)=sizeof(COMPLEX)
  376.     =2*sizeof(REAL).  If the code does declare explicit sizes of
  377.     numeric types, then the value of BpW will matter if explicit
  378.     and default sizes are expected to match.  If you want to
  379.     suppress warnings of this kind, you may change BpW to match
  380.     your hardware.  Under the -portability option, explicit and
  381.     default sizes never match: e.g. passing REAL*8 where DOUBLE
  382.     PRECISION expected.  None of this applies to CHARACTER data:
  383.     the default size (1) is well-defined, and the standard does
  384.     not specify the ratio of sizeof(CHARACTER) to sizeof(REAL). */
  385.  
  386. #ifndef BpW
  387. #define BpW 4    /* Bytes per Word: might want to use sizeof(float) instead */
  388. #endif
  389.  
  390.  
  391. #define FALSE 0
  392. #define TRUE 1
  393.  
  394. #define NO_COL_NUM ((unsigned)999)/* Impossible column number to suppress
  395.                  * printing in error messages
  396.                  */
  397. #define NO_LINE_NUM ((unsigned)0)/* Ditto for line number to suppress flushing
  398.                  * of line if error not in local context
  399.                  */
  400. #ifndef WRAP_COLUMN
  401. #define WRAP_COLUMN 79        /* When to wrap error messages to next line */
  402. #endif
  403.  
  404. #define OOPS_NONFATAL 0        /* Severity of "oops" messages */
  405. #define OOPS_FATAL 1
  406.  
  407. /* Shared variable and function defns start here */
  408.  
  409. #ifdef MAIN
  410. #define SHARED        /* (nothing) */
  411. #else
  412. #define SHARED extern    /* Non-main routines declare shared vars extern */
  413. #endif
  414.  
  415. #define PRIVATE static    /* For non-shared functions */
  416.  
  417.         /* Ftnchek has no need of floating-point calculations,
  418.            so to allow it to run on machines without coprocessor,
  419.            we neutralize the few floating-point operations.
  420.         */
  421. #ifdef NO_FLOATING_POINT
  422. typedef long DBLVAL;
  423. #else
  424. typedef double DBLVAL;
  425. #endif
  426.  
  427. SHARED FILE
  428.             *input_fd,  /* Input file */
  429.             *list_fd,    /* Output file for listing */
  430.         *dcl_fd,    /* Output type declaration file */
  431.         *project_fd;/* Project file for symtab info summary */
  432. SHARED char *current_filename,    /* name of current input file */
  433.         *top_filename;    /* name of toplevel parent input file */
  434. SHARED int incdepth;
  435.  
  436.  
  437.         /* Declare variables for command line options */
  438. #ifdef MAIN
  439. #define OPT(Type,Name,Value) Type Name=Value
  440. #else
  441. #define OPT(Type,Name,Value) extern Type Name
  442. #endif
  443.  
  444.         /* These ones are not yet options, but are variables
  445.            so that they can become options some day. */
  446.  
  447. OPT(int,allow_do_endo,ALLOW_DO_ENDO);
  448. OPT(int,allow_dollarsigns,ALLOW_DOLLARSIGNS);
  449. OPT(int,allow_format_dollarsigns,ALLOW_FORMAT_DOLLARSIGNS);
  450. OPT(int,allow_include,ALLOW_INCLUDE);
  451. OPT(int,allow_quotemarks,ALLOW_QUOTEMARKS);
  452. OPT(int,allow_typeless_constants,ALLOW_TYPELESS_CONSTANTS);
  453. OPT(int,allow_variable_format,ALLOW_VARIABLE_FORMAT);
  454. OPT(int,allow_underscores,ALLOW_UNDERSCORES);
  455. OPT(int,allow_unix_backslash,ALLOW_UNIX_BACKSLASH);
  456. OPT(int,allow_unix_cpp,ALLOW_UNIX_CPP);
  457.  
  458.         /* End of options that are not yet command-line options */
  459.  
  460.  
  461. OPT(int,unix_backslash,FALSE);    /* Treat backslash as escape */
  462. OPT(int,print_call_tree,FALSE);    /* Print the call tree */
  463. OPT(int,print_xref_list,FALSE);    /* Print subprogram cross-references */
  464. OPT(int,decls_required,FALSE);    /* List all undeclared identifiers */
  465. OPT(int,div_check,FALSE);    /* Check for possible division by zero */
  466. OPT(int,ext_def_check,TRUE);    /* Check defined status of externals*/
  467. OPT(int,f77_standard,FALSE);    /* Warn of non-f77 constructs */
  468. OPT(int,help_screen,FALSE);    /* Print out help screen */
  469. OPT(int,hollerith_check,TRUE);    /* Warn about holleriths under -port */
  470. OPT(int,library_mode,FALSE);    /* Set used-flag for all modules in file */
  471.  
  472. #ifdef EOLSKIP
  473. OPT(int,eol_is_space,TRUE);    /* Treat contd stmt linebreaks as space */
  474. #endif
  475.  
  476. OPT(int,do_list,FALSE);        /* Listing flag */
  477. OPT(int,novice_help,TRUE);    /* Extra help for novices */
  478. OPT(int,port_check,FALSE);    /* Portability warnings */
  479. OPT(int,pretty_flag,TRUE);    /* Warnings on deceiving appearances */
  480. OPT(int,make_project_file,FALSE);/* Save symtab defns in .prj file */
  481. OPT(int,pure_functions,TRUE);    /* Assume functions are pure */
  482. OPT(int,print_ref_list,FALSE);    /* Print reference (who-calls-who) list */
  483. OPT(int,sixclash,FALSE);    /* To check if names unique in 1st 6 chars */
  484. OPT(int,dec_tabs,DEC_TABS);    /* DEC-style tabbed source */
  485. OPT(int,print_topo_sort,FALSE);    /* Topological sort of modules */
  486. OPT(int,do_symtab,FALSE);    /* For symbol table printout */
  487. OPT(int,trunc_check,TRUE);    /* Check for truncation pitfalls */
  488. #ifdef VCG_SUPPORT
  489. OPT(int,print_vcg_list,FALSE);    /* Print call graph in vcg format */
  490. #endif
  491. OPT(int,verbose,TRUE);        /* Verbose output format */
  492. OPT(int,volatile_flag,FALSE);    /* Assume volatile vars and comblocks */
  493.         /* Debugging flags */
  494. OPT(int,debug_latest,FALSE);    /* debug the latest addition */
  495. OPT(int,debug_glob_symtab,FALSE);/* global symtab contents */
  496. OPT(int,debug_parser,FALSE);    /* grammar debug via DBG statements */
  497. OPT(int,debug_hashtab,FALSE);    /* hash table contents */
  498. OPT(int,debug_loc_symtab,FALSE); /* local symtab contents */
  499. OPT(int,show_resources,FALSE);    /* space avail and used */
  500. OPT(int,debug_lexer,FALSE);    /* list of tokens as scanned */
  501. #ifdef MAIN
  502. extern int yydebug;        /* grammar debug via yydebug */
  503. #endif
  504.         /* Declare variables for commandline settings */
  505. OPT(int,argcheck_strictness,3);    /* Strictness for checking args */
  506. OPT(int,array_arg_check,3);/* Check array argument dims & size  */
  507. OPT(int,max_stmt_col,72);    /* End of statement field ( <= MAXLINE )*/
  508. OPT(int,comcheck_strictness,3);    /* 0 (no check) to 3 (exact type & size) */
  509. OPT(int,make_dcls,0);        /* sum of: 0 (none), 1 (all), */
  510.                 /* 2 (undeclared), 4 (compact), 8 (keywords */
  511.                 /* lowercase), 16 (variables and constants */
  512.                 /* lowercase), 32 (exclude sf3 internal */
  513.                 /* variables), 64 (use * comment starter), */
  514.                 /* 128 (use 'c' comment starter). */
  515. OPT(int,usage_check,3);        /* Print set/used/ubs checks on variables */
  516. OPT(int,local_wordsize,BpW);    /* Bytes per word to use for default sizes */
  517. OPT(int,given_wordsize,BpW);    /* User's request as per -wordsize=n  */
  518. OPT(int,wrap_column,WRAP_COLUMN);/* For wrapping error messages */
  519.  
  520.             /* Shorthands for checking control settings */
  521. #define check_args_off    (argcheck_strictness == 0)
  522. #define check_args_number (argcheck_strictness&01)
  523. #define check_args_type    (argcheck_strictness&02)
  524. #define check_args_all    (argcheck_strictness == 3)
  525. #define check_array_dims (array_arg_check&01) /* levels 1 and 3 */
  526. #define check_array_size (array_arg_check&02) /* levels 2 and 3 */
  527. #define check_set_used    (usage_check&01) /* levels 1 and 3 */
  528. #define check_unused    (usage_check&02) /* levels 2 and 3 */
  529. #define check_com_off    (comcheck_strictness == 0) /* no checking common */
  530. #define check_com_lengths (comcheck_strictness >= 2) /* match lengths */
  531. #define check_com_byname (comcheck_strictness == 3) /* match var by var */
  532. #define check_com_tree (volatile_flag&&check_set_used) /* Check undef errors */
  533. #define check_volatile_com (volatile_flag)/* Check not saved */
  534.  
  535.         /* Declare variables for commandline StrSettings */
  536. OPT(char,*out_fname,(char *)NULL);    /* Output filename */
  537. #ifdef ALLOW_INCLUDE
  538. OPT(char,*include_path,(char *)NULL);    /* An include-file directory */
  539. #endif
  540.  
  541. SHARED unsigned
  542.     line_num,        /* line num of current char */
  543.     col_num,        /* column num of current char */
  544.     next_line_num,    /* line num of lookahead char */
  545.     next_col_num;    /* column num of lookahead char */
  546.  
  547. SHARED unsigned
  548.     tab_count,        /* Count of tabs in noncomment lines exc in strings */
  549.     error_count,    /* Count of syntax error messages per file */
  550.     warning_count;    /* Count of warning messages per file */
  551.  
  552.         /* Resource usage information: */
  553. SHARED unsigned long
  554.     tot_line_count,    /* total source lines (stmts + comments) */
  555.     tot_stmt_line_count,/* total source stmt lines  */
  556.     tot_exec_stmt_count,/* count of executable stmts in program */
  557.     tot_module_count,    /* count of modules in program */
  558.     exec_stmt_count,    /* count of executable stmts in module */
  559.     max_exec_stmt_count,/* max number of executable stmts in any module */
  560.     max_loc_symtab,    /* number of local symtab entries used */
  561.     max_glob_symtab,    /* number of global symtab entries used */
  562.     max_loc_strings,    /* chars of local stringspace used */
  563.     max_srctextspace,    /* chars of source text space used */
  564.     max_paraminfo,    /* number of param info structs used */
  565.     max_tokenlists,    /* number of tokenlists constructed */
  566.     max_token_space,    /* number of tokens used */
  567.     max_ptrspace,    /* number of pointers used */
  568.  
  569.     glob_strings_used,        /* chars of global stringspace used */
  570.     arglist_element_used,    /* arg array elements used */
  571.     arglist_head_used,        /* arg heads used (1 per call) */
  572.     comlist_element_used,    /* com array elements used */
  573.     comlist_head_used;        /* com heads used (1 per defn) */
  574.  
  575. SHARED int
  576.     equivalence_flag,   /* true while parsing EQUIVALENCE statement */
  577.     initial_flag,    /* true while only label or initial keywords read */
  578.     implicit_flag,    /* true while parsing IMPLICIT statement */
  579.     implicit_letter_flag, /* true while getting letters in IMPLICIT list */
  580.     implicit_type_given,/* true if IMPLICIT type statement found */
  581.     implicit_none,    /* true if IMPLICIT NONE statement found */
  582.     prev_token_class,    /* token class of last-returned token */
  583.     curr_stmt_class;    /* Token class of current stmt's leading token */
  584.  
  585.         /* Define linked-list structure for include-path list */
  586. #ifdef ALLOW_INCLUDE
  587. typedef struct IPNode {
  588.   struct IPNode *link;        /* next path on the list */
  589.   char *include_path;        /* one path (full directory name) */
  590. } IncludePathNode;
  591.  
  592. SHARED IncludePathNode *include_path_list; /* header to the list */
  593. #endif
  594.  
  595.         /* Declare shared routines */
  596.     /* in advance.c */
  597. void init_scan(),finish_scan(),open_include_file();
  598. int flush_line_out();
  599.  
  600.  
  601.     /* in ftnchek.c */
  602. void print_a_line(), yyerror(), syntax_error(), msg_tail(),
  603.      warning(), ugly_code(), nonstandard(), nonportable(),
  604.   oops_message(),oops_tail();
  605.  
  606.     /* in forlex.c */
  607. int yylex();
  608. void implied_id_token();
  609.  
  610.     /* in fortran.y/fortran.c */
  611. int yyparse();
  612. void init_parser();
  613.  
  614.     /* in intrinsics.c */
  615. unsigned long init_intrins_hashtab();
  616.  
  617.     /* in keywords.c */
  618. void init_keyhashtab();
  619.  
  620.     /* in pgsymtab.c */
  621.  
  622. void check_arglists(),check_comlists(),check_com_usage(),visit_children();
  623.  
  624.     /* in symtab.c */
  625.  
  626. void init_tables(), init_globals(), init_symtab(), note_filename();
  627.  
  628. char * token_name();
  629.  
  630.     /* in exprtype.c */
  631. void init_typesizes();
  632.  
  633.     /* in project.c */
  634. void                /* project file routines */
  635.  proj_file_out(),proj_file_in();
  636.