1 /* $Id: ftnchek.h,v 1.94 2005/02/06 21:36:37 moniot Exp $ 2 3 Common definitions for Fortran Program Checker 4 */ 5 6 /* 7 8 9 Copyright (c) 2001 by Robert K. Moniot. 10 11 Permission is hereby granted, free of charge, to any person 12 obtaining a copy of this software and associated documentation 13 files (the "Software"), to deal in the Software without 14 restriction, including without limitation the rights to use, 15 copy, modify, merge, publish, distribute, sublicense, and/or 16 sell copies of the Software, and to permit persons to whom the 17 Software is furnished to do so, subject to the following 18 conditions: 19 20 The above copyright notice and this permission notice shall be 21 included in all copies or substantial portions of the 22 Software. 23 24 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 25 KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 26 WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 27 PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 28 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 30 OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 31 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 32 33 Acknowledgement: the above permission notice is what is known 34 as the "MIT License." 35 Acknowledgement: the above permission notice was copied, with minor 36 changes, from the XFree86 Project. 37 38 */ 39 40 #define COPYRIGHT_DATE \ 41 "Copyright (C) 1994, 1997, 2000, 2004 by Robert K. Moniot" 42 #define COPYRIGHT_NOTICE \ 43 "This program is free software. Permission is granted to\n\ 44 modify it and/or redistribute it, retaining this notice.\n\ 45 No guarantees accompany this software." 46 #define VERSION_NUMBER "FTNCHEK Version 3.3 November 2004" 47 #define PATCHLEVEL "Patch Level 1" 48 #define PROJECT_VERSION "P3" /* Project file format version number */ 49 50 #include "config.h" /* Get system-specific information */ 51 52 /* Define macro PROTO for declaring function prototypes. If 53 compiler doesn't accept prototypes, use -DNO_PROTOTYPES. 54 The args in macro must be enclosed in parentheses. 55 Define macro VOID for declaring functions without 56 args. Also define HAVE_STDC for declaring functions 57 in ANSI form or Kernighan-Ritchie form. Each function 58 defn is in both forms, with #ifdef HAVE_STDC to select 59 between them. 60 */ 61 62 #ifdef NO_PROTOTYPES 63 #define PROTO(TYPE_AND_NAME,ARGS) TYPE_AND_NAME() 64 #define VOID 65 #define HAVE_STDC 0 66 #else 67 #define PROTO(TYPE_AND_NAME,ARGS) TYPE_AND_NAME ARGS 68 #define VOID void 69 #define HAVE_STDC 1 70 #endif 71 72 /* The following system defines should be defined with the -D 73 (for UNIX) or /DEFINE (for VMS) compiler options in the makefile, 74 not here. They are shown here so you know what to define. 75 MSDOS should be defined for IBM PC version. We set it here 76 automatically if a DOS/Win compiler is detected, otherwise when 77 compiling you should define it on compiler command line. 78 Only one of MSDOS, VMS, or UNIX should be defined. They control 79 details of behavior such as filename extensions and use of slash 80 as an option prefix. 81 */ 82 83 /*#define VMS*/ /* Set flag for VMS system-dependent defns. */ 84 /*#define UNIX*/ /* Set flag for UNIX (any flavor) defns. */ 85 /* Many (all?) Windows compilers autodefine _WIN32. I am guessing 86 about _MSDOS. TurboC (DOS and Win versions) sets __TURBOC__ */ 87 #if defined(_WIN32) || defined(_MSDOS) || defined(__TURBOC__) 88 #define MSDOS /* Set flag for MSDOS (including Windows) */ 89 #endif 90 91 /* For portability, declare standard routines here. */ 92 #if HAVE_STDLIB_H 93 #include <stdlib.h> 94 #else 95 PROTO(char *getenv,(char *)); 96 PROTO(char *malloc,(unsigned)); 97 PROTO(char *calloc,(unsigned,unsigned)); 98 PROTO(VOID free,(void *)); 99 PROTO(VOID exit,(int)); 100 #endif 101 102 103 /************************************************************************* 104 Begin section of defines for system-dependent configuration. 105 **************************************************************************/ 106 107 108 /* set flag to allow options to start with '/' */ 109 #ifndef OPTION_PREFIX_SLASH 110 #ifndef NO_OPTION_PREFIX_SLASH 111 #ifdef VMS 112 #define OPTION_PREFIX_SLASH 113 #endif 114 #ifdef MSDOS 115 #define OPTION_PREFIX_SLASH 116 #endif 117 #endif 118 #endif 119 120 /* Define standard home directory for VMS and MSDOS. 121 This directory is one place ftnchek looks for the 122 rc or ini file. */ 123 #ifdef VMS 124 #ifndef SPECIAL_HOMEDIR 125 #define SPECIAL_HOMEDIR "SYS$DISK:[]" 126 #endif 127 #endif 128 129 #ifdef MSDOS 130 #ifndef SPECIAL_HOMEDIR 131 #define SPECIAL_HOMEDIR "c:\\lib" 132 #endif 133 #endif 134 135 /* Define the Unix-style startup file name and a non-Unix-style 136 alternate. Both are looked for on all systems. */ 137 138 #ifndef UNIX_RC_FILE 139 #define UNIX_RC_FILE ".ftnchekrc" 140 #endif 141 #ifndef NONUNIX_RC_FILE 142 #define NONUNIX_RC_FILE "ftnchek.ini" 143 #endif 144 145 /* Define default source and output file extensions. These 146 * can be overridden by defines on compiler commandline. 147 */ 148 #ifndef DEF_SRC_EXTENSION 149 #ifdef VMS 150 #define DEF_SRC_EXTENSION ".for" /* VMS default extension */ 151 #endif 152 #ifdef MSDOS 153 #define DEF_SRC_EXTENSION ".for" /* IBM PC default extension */ 154 #endif 155 #endif /* DEF_SRC_EXTENSION */ 156 157 #ifndef DEF_SRC_EXTENSION 158 #define DEF_SRC_EXTENSION ".f" /* Unix and all others */ 159 #endif 160 /* define default list-file extension */ 161 #ifndef DEF_LIST_EXTENSION 162 #define DEF_LIST_EXTENSION ".lis" 163 #endif 164 /* define default project-file extension */ 165 #ifndef DEF_PROJ_EXTENSION 166 #define DEF_PROJ_EXTENSION ".prj" 167 #endif 168 /* define default declaration-file extension */ 169 #ifndef DEF_DCL_EXTENSION 170 #define DEF_DCL_EXTENSION ".dcl" 171 #endif 172 /* define default html documentation-file extension */ 173 #ifndef DEF_HTML_EXTENSION 174 #define DEF_HTML_EXTENSION ".html" 175 #endif 176 /* define default include-file extension */ 177 #ifndef DEF_INC_EXTENSION 178 #define DEF_INC_EXTENSION DEF_SRC_EXTENSION 179 #endif 180 /* define default declaration-file extension */ 181 #ifndef DEF_VCG_EXTENSION 182 #define DEF_VCG_EXTENSION ".vcg" 183 #endif 184 /* define project-file name for case of input from stdin */ 185 #ifndef STDIN_PROJ_FILENAME 186 #define STDIN_PROJ_FILENAME "ftnchek.prj" 187 #endif 188 189 #ifndef ENV_PREFIX /* prefix for option environment variables */ 190 #define ENV_PREFIX "FTNCHEK_" 191 #endif 192 193 #ifndef ENV_INCLUDE_VAR 194 #define ENV_INCLUDE_VAR "INCLUDE" /* name of env variable for include dir */ 195 #endif 196 197 #ifndef DEFAULT_INCLUDE_DIR 198 #ifdef UNIX 199 #define DEFAULT_INCLUDE_DIR "/usr/include" 200 #endif 201 #ifdef VMS 202 #define DEFAULT_INCLUDE_DIR "SYS$LIBRARY:" 203 #endif 204 #ifdef MSDOS 205 #define DEFAULT_INCLUDE_DIR "\\include" 206 #endif 207 #endif 208 209 /************************************************************************* 210 End of section of defines for system-dependent configuration. 211 212 Begin section of defines to control ftnchek's behavior 213 (syntax accepted, options supported, etc.) 214 **************************************************************************/ 215 216 /* The following macro turns on useful extra information saying 217 "expecting whatever" in "parse error" messages from GNU 218 bison-generated parser. This macro may not do anything if 219 parser is generated by another version of bison or yacc. 220 */ 221 #ifndef NO_YYERROR_VERBOSE 222 #define YYERROR_VERBOSE 223 #endif 224 225 226 /* This is the default limit on "cascades" of error 227 messages where the trailer "etc..." is given 228 instead of printing them all. The limit can be 229 changed at run time by -error=num. 230 */ 231 #ifndef DEF_ERROR_CASCADE_LIMIT 232 #define DEF_ERROR_CASCADE_LIMIT 3 233 #endif 234 235 /* VCG support is now standard. If you don't want it, you can 236 eliminate it by defining NO_VCG_SUPPORT. You can customize 237 the graph options by changing the macro VCG_GRAPH_OPTIONS. 238 Include \n between options and after the last option. 239 (These options affect the graph as a whole.) */ 240 241 #ifndef NO_VCG_SUPPORT 242 #define VCG_SUPPORT 243 #ifndef VCG_GRAPH_OPTIONS 244 #define VCG_GRAPH_OPTIONS "color: lightgray\n" 245 #endif 246 #endif 247 248 /* Define the amount of indentation of declarations produced 249 under -makedcls in free-form mode. Must be >= 0. 250 */ 251 #ifndef DCL_FREEFORM_INDENT 252 #define DCL_FREEFORM_INDENT 2 253 #endif 254 255 /* The following defines control the default status of 256 warnings controlled by -arg, -f77/90/95, -port, -pretty, and -trunc. 257 */ 258 259 260 /* -arguments options default to ARGCHECK_ALL. Define 261 LAX_ARGCHECK to make -arguments=none the default. 262 Otherwise -arguments=all is default. 263 */ 264 #ifdef LAX_ARGCHECK 265 #define ARGCHECK_ALL FALSE 266 #else 267 #define ARGCHECK_ALL TRUE 268 #endif 269 270 271 /* -array options default to ARRAYCHECK_ALL. Define 272 LAX_ARRAYCHECK to make -array=none the default. 273 Otherwise -array=all is default. 274 */ 275 #ifdef LAX_ARRAYCHECK 276 #define ARRAYCHECK_ALL FALSE 277 #else 278 #define ARRAYCHECK_ALL TRUE 279 #endif 280 281 /* -common options default to COMCHECK_ALL, except for 282 volatile, which defaults to FALSE. Define 283 LAX_COMCHECK to make -common=none the default. 284 Otherwise -common=type,length,exact is default. 285 */ 286 #ifdef LAX_COMCHECK 287 #define COMCHECK_ALL FALSE 288 #else 289 #define COMCHECK_ALL TRUE 290 #endif 291 292 293 /* -f77 options default to F77_ALL. Define 294 STRICT_SYNTAX to make -f77=all the default. 295 Otherwise -f77=none is default. 296 */ 297 #ifdef STRICT_SYNTAX 298 #define F77_ALL 1 299 #else 300 #define F77_ALL 0 301 #endif 302 303 /* -f90 options default to none unless 304 F90_SYNTAX is defined. 305 */ 306 #ifdef F90_SYNTAX 307 #define F90_ALL 1 308 #else 309 #define F90_ALL 0 310 #endif 311 312 /* -f95 options default to none unless 313 F95_SYNTAX is defined. 314 */ 315 #ifdef F95_SYNTAX 316 #define F95_ALL 1 317 #else 318 #define F95_ALL 0 319 #endif 320 321 322 /* -portability options default to PORT_ALL. Define 323 STRICT_PORTABILITY to make -port=all the default. 324 Otherwise -port=none is default. 325 */ 326 #ifdef STRICT_PORTABILITY 327 #define PORT_ALL TRUE 328 #else 329 #define PORT_ALL FALSE 330 #endif 331 332 /* -pretty options default to PRETTY_ALL. Define 333 UGLY_IS_OK to make -pretty=none the default. 334 Otherwise -pretty=all is default. 335 */ 336 #ifdef UGLY_IS_OK 337 #define PRETTY_ALL FALSE 338 #else 339 #define PRETTY_ALL TRUE 340 #endif 341 342 /* -source options are defined here. Since 343 -source=all is unlikely to be desired, each 344 option has its own macro for default value */ 345 346 #ifndef DEC_TABS /* DEC-style ugly tabbed source is off by default */ 347 #define DEC_TABS FALSE 348 #endif 349 /* VMS-style INCLUDE supports defaulting 350 extension, /NOLIST feature. It is default 351 for VMS, not for other systems. */ 352 #ifndef VMS_INCLUDE 353 #ifdef VMS 354 #define VMS_INCLUDE TRUE 355 #else 356 #define VMS_INCLUDE FALSE 357 #endif 358 #endif 359 360 #ifndef UNIX_BACKSLASH /* UNIX backslash escape sequences in strings */ 361 #define UNIX_BACKSLASH FALSE 362 #endif 363 364 /* standard parameters take data type from value */ 365 #ifndef PARAMETER_IMPLICIT_TYPE 366 #define PARAMETER_IMPLICIT_TYPE FALSE 367 #endif 368 369 /* DEC-style parameters get data type in standard way */ 370 #ifndef DEC_PARAMETER_STANDARD_TYPE 371 #define DEC_PARAMETER_STANDARD_TYPE FALSE 372 #endif 373 374 375 /* -style options default to STYLECHECK_ALL, which 376 should be FALSE to prevent ftnchek from spewing 377 warnings about perfectly normal code. 378 */ 379 #ifndef STYLECHECK_ALL 380 #define STYLECHECK_ALL FALSE 381 #endif 382 383 384 /* -truncation options default to TRUNC_ALL. Define 385 LAX_TRUNCATION to make -trunc=none the default. 386 Otherwise -trunc=all is default. 387 */ 388 #ifdef LAX_TRUNCATION 389 #define TRUNC_ALL FALSE 390 #else 391 #define TRUNC_ALL TRUE 392 #endif 393 394 /* -usage options default to USAGE_ALL. Define 395 LAX_USAGE to make -usage=none the default. 396 Otherwise -usage=all is default. 397 */ 398 #ifdef LAX_USAGE 399 #define USAGE_ALL FALSE 400 #else 401 #define USAGE_ALL TRUE 402 #endif 403 404 /* The macros in the following section control whether 405 certain groups of nonstandard intrinsics are compiled 406 into ftnchek. By turning off all these macros using the 407 STANDARD_INTRINSICS define or selectively by using the 408 NO_ prefix, some efficiency is gained but these intrinsics 409 will then never be recognized by ftnchek, regardless of 410 the -intrinsic setting. Turn these off only if you are 411 a purist who will never use non-F77 intrinsics. 412 */ 413 414 #ifndef STANDARD_INTRINSICS 415 416 #ifndef NO_EXTRA_INTRINSICS 417 #define EXTRA_INTRINSICS /* Common nonstandard intrinsic functions */ 418 #endif 419 420 #ifndef NO_UNIX_INTRINSICS 421 #define UNIX_INTRINSICS /* UNIX intrinsic functions */ 422 #endif 423 424 #ifndef NO_VMS_INTRINSICS 425 #define VMS_INTRINSICS /* VMS intrinsic functions */ 426 #endif 427 428 429 430 431 /* The macros in the next section define the default 432 value of the -intrinsic settings governing which 433 intrinsic groups to recognize and how to treat RAND 434 and IARGC, which may take no argument or one dummy 435 argument on different platforms. 436 */ 437 438 /* Define which sets to recognize by default: 439 bit 0 = commonly available nonstandard intrinsics 440 bit 1 = some Unix intrinsics 441 bit 2 = some VMS intrinsics 442 */ 443 444 #ifdef UNIX /* Unix default: accept Common & Unix intrinsics */ 445 #define DEF_INTRINSIC_SET 3 446 #endif 447 448 #ifdef VMS /* VMS default: accept Common & VMS intrinsics */ 449 #define DEF_INTRINSIC_SET 5 450 #endif 451 452 #ifndef DEF_INTRINSIC_SET /* Otherwise default = only common set */ 453 #define DEF_INTRINSIC_SET 1 454 #endif 455 456 /* Define which RAND form to use. 457 bit 0 = allow no-arg form 458 bit 1 = allow one-arg form 459 */ 460 461 #ifdef RAND_NO_ARG /*RAND() form*/ 462 #define DEF_INTRINSIC_RAND 1 463 #else 464 #ifdef RAND_ONE_ARG /*RAND(ISEED) form*/ 465 #define DEF_INTRINSIC_RAND 2 466 #else /* Default: allow either form */ 467 #define DEF_INTRINSIC_RAND 3 468 #endif 469 #endif 470 471 /* Define which IARGC form to use */ 472 #ifdef IARGC_NO_ARG 473 #define DEF_INTRINSIC_IARGC 1 474 #else 475 #ifdef IARGC_ONE_ARG 476 #define DEF_INTRINSIC_IARGC 2 477 #else /* Default: allow either form */ 478 #define DEF_INTRINSIC_IARGC 3 479 #endif 480 #endif 481 482 #endif /* not STANDARD_INTRINSICS */ 483 484 /* Default BpW = 4 bytes per word, which matches many machines. 485 This macro serves as the default value for -wordsize. 486 If the Fortran code does not declare explicit sizes of 487 numeric variables (e.g. REAL*8), then the value of -wordsize will 488 not matter, since the table conforms to the standard in that 489 sizeof(INTEGER)=sizeof(REAL), and sizeof(DOUBLE)=sizeof(COMPLEX) 490 =2*sizeof(REAL). If the code does declare explicit sizes of 491 numeric types, then the value of -wordsize will matter if explicit 492 and default sizes are expected to match. If you want to 493 suppress warnings of this kind, you may use the -wordsize setting 494 or, to make it the default, change BpW to match 495 your hardware. Under the -portability option, explicit and 496 default sizes never match: e.g. passing REAL*8 where DOUBLE 497 PRECISION expected. None of this applies to CHARACTER data: 498 the default size (1) is well-defined, and the standard does 499 not specify the ratio of sizeof(CHARACTER) to sizeof(REAL). 500 501 For the Cray pointer extension, we also define PTRSIZE as the size of 502 a pointer. The default is the same as the wordsize. This can be 503 changed at run time by -pointersize=nnn. 504 */ 505 506 #ifndef BpW 507 #define BpW 4 /* Bytes per Word: might want to use sizeof(float) instead */ 508 #endif 509 #ifndef PTRSIZE 510 #define PTRSIZE BpW 511 #endif 512 513 /* Define to tolerate embedded blanks in numeric consts unless 514 feature turned off by defining NO_BLANKS_IN_NUMBERS. */ 515 #ifndef NO_BLANKS_IN_NUMBERS 516 #define BLANKS_IN_NUMBERS 517 #endif 518 519 /* Default value of -wrap option */ 520 #ifndef WRAP_COLUMN 521 #define WRAP_COLUMN 79 /* When to wrap error messages to next line */ 522 #endif 523 524 #ifndef DEF_IDLETTER_LIST /* default nonalnums allowed in identifiers */ 525 #define DEF_IDLETTER_LIST "$_" 526 #endif 527 528 /* The following defines used to be optional, now they 529 are standard. If these defines are removed or 530 undef'd, the corresponding syntax will not be 531 recognized (resulting in parse errors). I don't 532 recommend undefining them. They are all warned about 533 by -f77 */ 534 535 #define ALLOW_CRAY_POINTERS 1 536 #define ALLOW_DO_ENDDO 1 537 #define ALLOW_INCLUDE 1 538 #define ALLOW_QUOTEMARKS 1 539 #define ALLOW_TYPELESS_CONSTANTS 1 540 #define ALLOW_UNIX_BACKSLASH 1 541 #define ALLOW_UNIX_CPP 1 542 #define ALLOW_VMS_IO 1 543 #define ALLOW_IBM_IO 1 544 545 #define INLINE_COMMENT_CHAR '!' /* Inline comments start with '!' */ 546 547 548 #define KEEP_ARG_NAMES 1 /* option was formerly experimental */ 549 550 551 /* SMALL_INT_VALUE is an integer that is small enough that 552 we don't need to worry if it is assigned to a small-size 553 int, for purposes of catching truncation errors. We 554 conservatively use maximum signed 8-bit byte value. 555 */ 556 #ifndef SMALL_INT_VALUE 557 #define SMALL_INT_VALUE 127 558 #endif 559 560 #ifdef DEVELOPMENT /* For maintaining the program */ 561 #define DEBUG_FORLEX 562 #endif 563 564 /************************************************************************* 565 End section of defines to control ftnchek's behavior 566 567 Begin section to define limits, table sizes, etc. 568 **************************************************************************/ 569 570 571 572 573 #ifndef MAXLINE 574 #define MAXLINE 132 /* Maximum input line length. Ignores past this. */ 575 #endif 576 #ifndef MAXIDSIZE 577 #define MAXIDSIZE 31 /* Longest identifier allowed */ 578 #endif 579 #ifndef MAX_SRC_TEXT 580 #define MAX_SRC_TEXT (20*66) /* Longest text string of a token */ 581 #endif 582 #ifndef MAX_CHAR_CODE 583 #define MAX_CHAR_CODE 255 /* Largest possible value of a char (8 bits here) */ 584 #endif 585 #ifndef MAX_INCLUDE_DEPTH 586 #define MAX_INCLUDE_DEPTH 16 /* Max nesting depth of include files */ 587 #endif 588 #ifndef MAXEXPRTEXT 589 #define MAXEXPRTEXT 15 /* length of expr text saved in arg lists */ 590 #endif 591 #ifndef MAX_RC_LINE 592 #define MAX_RC_LINE 500 /* Max length of line in rc file */ 593 #endif 594 #ifndef RC_COMMENT_CHAR 595 #define RC_COMMENT_CHAR '#' /* Comments start with this or space */ 596 #endif 597 /* Definitions of table sizes 598 Constraints: 599 STRSPACESZ > 20*72 so max f77 statement will fit 600 LOCSYMTABSZ+GLOBSYMTABSZ < HASHSZ so hashtab never full 601 */ 602 603 #define KEYHASHSZ 195 /* Size of keyword hashtable -- do not change */ 604 #define INTRINS_HASHSZ 433 /* Chosen to give few clashes -- change with care */ 605 606 #ifdef SMALL_MACHINE /* Use these for e.g. IBM PC */ 607 #ifndef HASHSZ /* Hint: pick one with no square factors */ 608 #define HASHSZ 798 /* SMALL_MACHINE Size of symbol hashtable */ 609 #endif 610 #ifndef STRSPACESZ 611 #define STRSPACESZ 4000 /* SMALL_MACHINE chunk size of string space */ 612 #endif 613 #ifndef LOCSYMTABSZ 614 #define LOCSYMTABSZ 300 /* SMALL_MACHINE Size of local symbol table */ 615 #endif 616 #ifndef GLOBSYMTABSZ 617 #define GLOBSYMTABSZ 400 /* SMALL_MACHINE Size of global symbol table */ 618 #endif 619 #ifndef PARAMINFOSPACESZ 620 #define PARAMINFOSPACESZ 20 /* SMALL_MACHINE ParamInfo structs per chunk */ 621 #endif 622 #ifndef TOKHEADSPACESZ 623 #define TOKHEADSPACESZ 50 /* SMALL_MACHINE TokenListHeaders per chunk */ 624 #endif 625 #ifndef TOKENSPACESZ 626 #define TOKENSPACESZ 200 /* SMALL_MACHINE tokens per token space chunk */ 627 #endif 628 #ifndef ARGLISTHEADSZ 629 #define ARGLISTHEADSZ 300 /* SMALL_MACHINE argument headers per chunk */ 630 #endif 631 #ifndef ARGLISTELTSZ 632 #define ARGLISTELTSZ 1000 /* SMALL_MACHINE argument list elts per chunk */ 633 #endif 634 #ifndef COMLISTHEADSZ 635 #define COMLISTHEADSZ 200 /* SMALL_MACHINE common list headers per chunk */ 636 #endif 637 #ifndef COMLISTELTSZ 638 #define COMLISTELTSZ 1000 /* SMALL_MACHINE common elts per chunk */ 639 #endif 640 #ifndef PTRSPACESZ 641 #define PTRSPACESZ 200 /* SMALL_MACHINE ptrs-to-arraydim per chunk */ 642 #endif 643 #ifndef LABTABLE_SIZE 644 #define LABTABLE_SIZE 109 /* SMALL_MACHINE initial size of label table */ 645 #endif 646 #ifndef REF_LISTS_SIZE 647 #define REF_LISTS_SIZE 200 /* SMALL_MACHINE Lab_ref_lists per chunk*/ 648 #endif 649 #ifndef IO_UNIT_INFO_SIZE 650 #define IO_UNIT_INFO_SIZE 50 /* SMALL_MACHINE initial size of I/O unit info table */ 651 #endif 652 653 #else /* end if SMALL_MACHINE */ 654 655 #ifdef MEDIUM_MACHINE /* use these if default is too big */ 656 657 #ifndef HASHSZ 658 #define HASHSZ 2002 /* MEDIUM_MACHINE Size of symbol hashtable */ 659 #endif 660 #ifndef STRSPACESZ 661 #define STRSPACESZ 10000 /* MEDIUM_MACHINE chunk size of string space */ 662 #endif 663 #ifndef LOCSYMTABSZ 664 #define LOCSYMTABSZ 800 /* MEDIUM_MACHINE Size of local symbol table */ 665 #endif 666 #ifndef GLOBSYMTABSZ 667 #define GLOBSYMTABSZ 1200 /* MEDIUM_MACHINE Size of global symbol table */ 668 #endif 669 #ifndef PARAMINFOSPACESZ 670 #define PARAMINFOSPACESZ 50 /* MEDIUM_MACHINE ParamInfo structs per chunk */ 671 #endif 672 #ifndef TOKHEADSPACESZ 673 #define TOKHEADSPACESZ 200 /* MEDIUM_MACHINE TokenListHeaders per chunk */ 674 #endif 675 #ifndef TOKENSPACESZ 676 #define TOKENSPACESZ 1000 /* MEDIUM_MACHINE tokens per token space chunk */ 677 #endif 678 #ifndef ARGLISTHEADSZ 679 #define ARGLISTHEADSZ 1500 /* MEDIUM_MACHINE argument headers per chunk */ 680 #endif 681 #ifndef ARGLISTELTSZ 682 #define ARGLISTELTSZ 5000 /* MEDIUM_MACHINE argument list elts per chunk */ 683 #endif 684 #ifndef COMLISTHEADSZ 685 #define COMLISTHEADSZ 1000 /* MEDIUM_MACHINE common list headers per chunk */ 686 #endif 687 #ifndef COMLISTELTSZ 688 #define COMLISTELTSZ 4000 /* MEDIUM_MACHINE common elts per chunk */ 689 #endif 690 #ifndef PTRSPACESZ 691 #define PTRSPACESZ 400 /* MEDIUM_MACHINE Max number of ptrs to arraydim */ 692 #endif 693 #ifndef LABTABLE_SIZE 694 #define LABTABLE_SIZE 209 /* MEDIUM_MACHINE initial size of labtable */ 695 #endif 696 #ifndef REF_LISTS_SIZE 697 #define REF_LISTS_SIZE 400 /* MEDIUM_MACHINE Lab_ref_lists per chunk*/ 698 #endif 699 #ifndef IO_UNIT_INFO_SIZE 700 #define IO_UNIT_INFO_SIZE 200 /* MEDIUM_MACHINE initial size of I/O unit info table */ 701 #endif 702 #else /* Default is now LARGE_MACHINE, OK for most modern machines */ 703 704 #ifndef HASHSZ /* must be <= max int */ 705 #define HASHSZ 20930 /* LARGE_MACHINE Size of symbol hashtable */ 706 #endif 707 #ifndef STRSPACESZ 708 #define STRSPACESZ 10000 /* LARGE_MACHINE chunk size of string space */ 709 #endif 710 #ifndef LOCSYMTABSZ 711 #define LOCSYMTABSZ 8000 /* LARGE_MACHINE Size of local symbol table */ 712 #endif 713 #ifndef GLOBSYMTABSZ 714 #define GLOBSYMTABSZ 12000 /* LARGE_MACHINE Size of global symbol table */ 715 #endif 716 #ifndef PARAMINFOSPACESZ 717 #define PARAMINFOSPACESZ 200 /* LARGE_MACHINE ParamInfo structs per chunk */ 718 #endif 719 #ifndef TOKHEADSPACESZ 720 #define TOKHEADSPACESZ 500 /* LARGE_MACHINE TokenListHeaders per chunk */ 721 #endif 722 #ifndef TOKENSPACESZ 723 #define TOKENSPACESZ 10000 /* LARGE_MACHINE tokens per token space chunk */ 724 #endif 725 #ifndef ARGLISTHEADSZ 726 #define ARGLISTHEADSZ 15000 /* LARGE_MACHINE argument headers per chunk */ 727 #endif 728 #ifndef ARGLISTELTSZ 729 #define ARGLISTELTSZ 50000 /* LARGE_MACHINE argument list elts per chunk */ 730 #endif 731 #ifndef COMLISTHEADSZ 732 #define COMLISTHEADSZ 10000 /* LARGE_MACHINE common list headers per chunk */ 733 #endif 734 #ifndef COMLISTELTSZ 735 #define COMLISTELTSZ 50000 /* LARGE_MACHINE common elts per chunk */ 736 #endif 737 #ifndef PTRSPACESZ 738 #define PTRSPACESZ 2000 /* LARGE_MACHINE Max number of ptrs to arraydim */ 739 #endif 740 #ifndef LABTABLE_SIZE 741 #define LABTABLE_SIZE 299 /* LARGE_MACHINE initial size of labtable */ 742 #endif 743 #ifndef REF_LISTS_SIZE 744 #define REF_LISTS_SIZE 2000 /* LARGE_MACHINE Lab_ref_lists per chunk*/ 745 #endif 746 #ifndef IO_UNIT_INFO_SIZE 747 #define IO_UNIT_INFO_SIZE 500 /* LARGE_MACHINE initial size of I/O unit info table */ 748 #endif 749 #endif /* end if LARGE_MACHINE else */ 750 751 #endif/*end if SMALL_MACHINE else*/ 752 753 /************************************************************************* 754 End of section to define limits, table sizes, etc. 755 756 From here down should not be altered. 757 **************************************************************************/ 758 759 760 761 #define FALSE 0 762 #define TRUE 1 763 764 /* Make sure line numbers use 32 bits */ 765 #if SIZEOF_INT >= 4 766 typedef unsigned LINENO_t; 767 #else 768 typedef unsigned long LINENO_t; 769 #endif 770 typedef unsigned COLNO_t; 771 772 773 #define NO_COL_NUM ((COLNO_t)999)/* Impossible column number to suppress 774 * printing in error messages 775 */ 776 #define GLOBAL_NO_COL_NUM ((LINENO_t)998)/* Ditto for global-level warnings */ 777 778 #define NO_LINE_NUM ((LINENO_t)0)/* Ditto for line number to suppress flushing 779 * of line if error not in local context 780 */ 781 782 #define OOPS_NONFATAL 0 /* Severity of "oops" messages */ 783 #define OOPS_FATAL 1 784 785 /************************************************************************* 786 Shared variable and function defns start here 787 **************************************************************************/ 788 789 #ifdef MAIN 790 #define SHARED /* (nothing) */ 791 #else 792 #define SHARED extern /* Non-main routines declare shared vars extern */ 793 #endif 794 795 #define PRIVATE static /* For non-shared functions */ 796 797 /* Except when DEBUG_FORLEX is turned on, ftnchek has no need 798 of floating-point calculations, so to allow it to run on 799 machines without coprocessor, we neutralize the few 800 floating-point operations that there are. */ 801 802 #ifndef DEBUG_FORLEX 803 #ifndef NO_FLOATING_POINT 804 #define NO_FLOATING_POINT 805 #endif 806 #endif 807 808 #ifdef NO_FLOATING_POINT 809 typedef long DBLVAL; 810 #else 811 typedef double DBLVAL; 812 #endif 813 814 SHARED FILE 815 *input_fd, /* Input file */ 816 *list_fd, /* Output file for listing */ 817 *dcl_fd, /* Output type declaration file */ 818 *html_fd, /* Output file for HTML documentation */ 819 *htmlcalltree_fd, /* Output file for html call tree documentation */ 820 #ifdef VCG_SUPPORT 821 *vcg_fd, /* Output VCG graph description file */ 822 #endif 823 *project_fd;/* Project file for symtab info summary */ 824 825 SHARED char *html_filename; /* name of the html documentation file */ 826 SHARED char *htmlcalltree_filename; /* name of the html call tree doc file */ 827 SHARED char *current_filename, /* name of current input file */ 828 *top_filename; /* name of toplevel parent input file */ 829 SHARED int incdepth; 830 831 #ifdef VCG_SUPPORT 832 SHARED char *main_filename; /* name of file containing main program */ 833 #endif 834 835 836 837 /*****************************************************************/ 838 /* Declare variables for command line options */ 839 /*****************************************************************/ 840 841 842 843 #ifdef MAIN 844 #define OPT(Type,Name,Value) Type Name=Value 845 #else 846 #define OPT(Type,Name,Value) extern Type Name 847 #endif 848 849 /* These options are controlled by -arguments */ 850 OPT(int,argcheck_argnumber,ARGCHECK_ALL);/* Check for wrong no. of args */ 851 OPT(int,argcheck_arrayness,ARGCHECK_ALL);/* Check arg arrayness mismatches */ 852 OPT(int,argcheck_argtype,ARGCHECK_ALL); /* Check for arg type mismatches */ 853 OPT(int,argcheck_functype,ARGCHECK_ALL); /* Check for func type mismatches */ 854 /* End of -arguments options */ 855 856 /* These options are controlled by -array */ 857 OPT(int,arraycheck_dims,ARRAYCHECK_ALL);/* Check for mismatch no.of dims */ 858 OPT(int,arraycheck_size,ARRAYCHECK_ALL);/* Check for mismatch no.of elements */ 859 /* End of -array options */ 860 861 /* These options are controlled by -calltree */ 862 OPT(int,print_call_tree,FALSE); /* Print the call tree */ 863 OPT(int,print_ref_list,FALSE); /* Print reference (who-calls-who) list */ 864 #ifdef VCG_SUPPORT 865 OPT(int,print_vcg_list,FALSE); /* Print call graph in vcg format */ 866 #endif 867 OPT(int,call_tree_prune,TRUE); /* do not repeat duplicates, use "see above" */ 868 OPT(int,call_tree_sort,TRUE); /* alphabetized, not program order */ 869 /* End of -calltree options */ 870 871 /* These options are controlled by -crossref */ 872 OPT(int,print_xref_list,FALSE); /* print subprogram cross-references */ 873 OPT(int,print_com_xrefs,FALSE); /* print common block cross-refs */ 874 OPT(int,print_lab_refs,FALSE); /* print label cross-references */ 875 /* End of -crossref options */ 876 877 /* These options are controlled by -common */ 878 OPT(int,comcheck_type,COMCHECK_ALL);/* Check for type mismatch */ 879 OPT(int,comcheck_length,COMCHECK_ALL);/* Check for length mismatch */ 880 OPT(int,comcheck_dims,COMCHECK_ALL);/* Check for array dim mismatch */ 881 OPT(int,comcheck_by_name,COMCHECK_ALL);/* Check name-by-name */ 882 OPT(int,comcheck_volatile,FALSE); /* Assume blocks are "volatile" */ 883 /* End of -common options */ 884 885 /* These options are controlled by -f77 */ 886 OPT(int,f77_20_continue,F77_ALL); 887 OPT(int,f77_accept_type,F77_ALL); 888 OPT(int,f77_assignment,F77_ALL); 889 OPT(int,f77_array_bounds,F77_ALL); 890 OPT(int,f77_attrbased_typedecl,F77_ALL); 891 OPT(int,f77_automatic_array,F77_ALL); 892 OPT(int,f77_byte,F77_ALL); 893 OPT(int,f77_case_construct,F77_ALL); 894 OPT(int,f77_char_extension,F77_ALL); 895 OPT(int,f77_cray_pointers,F77_ALL); 896 OPT(int,f77_common_subprog_name,F77_ALL); 897 OPT(int,f77_construct_name,F77_ALL); 898 OPT(int,f77_cycle_exit,F77_ALL); 899 OPT(int,f77_d_comment,F77_ALL); 900 OPT(int,f77_dec_tabs,F77_ALL); 901 OPT(int,f77_do_enddo,F77_ALL); 902 OPT(int,f77_dollarsigns,F77_ALL); 903 OPT(int,f77_double_complex,F77_ALL); 904 OPT(int,f77_format_dollarsigns,F77_ALL); 905 OPT(int,f77_format_extensions,F77_ALL); 906 OPT(int,f77_function_noparen,F77_ALL); 907 OPT(int,f77_implicit_none,F77_ALL); 908 OPT(int,f77_include,F77_ALL); 909 OPT(int,f77_initializers,F77_ALL); 910 OPT(int,f77_inline_comment,F77_ALL); 911 OPT(int,f77_internal_list_io,F77_ALL); 912 OPT(int,f77_intrinsics,F77_ALL); 913 OPT(int,f77_io_keywords,F77_ALL); 914 OPT(int,f77_long_names,F77_ALL); 915 OPT(int,f77_mixed_common,F77_ALL); 916 OPT(int,f77_mixed_expr,F77_ALL); 917 OPT(int,f77_namelist,F77_ALL); 918 OPT(int,f77_overlength,F77_ALL); 919 OPT(int,f77_param_implicit_type,F77_ALL); 920 OPT(int,f77_param_intrinsic,F77_ALL); 921 OPT(int,f77_param_noparen,F77_ALL); 922 OPT(int,f77_pointers,F77_ALL); 923 OPT(int,f77_quad_constants,F77_ALL); 924 OPT(int,f77_quotemarks,F77_ALL); 925 OPT(int,f77_relops,F77_ALL); 926 OPT(int,f77_semicolon,F77_ALL); 927 OPT(int,f77_stmt_order,F77_ALL); 928 OPT(int,f77_typeless_constants,F77_ALL); 929 OPT(int,f77_typesize,F77_ALL); 930 OPT(int,f77_underscores,F77_ALL); 931 OPT(int,f77_unix_backslash,F77_ALL); 932 OPT(int,f77_unix_cpp,F77_ALL); 933 OPT(int,f77_variable_format,F77_ALL); 934 /* End of -f77 options */ 935 936 /* These options are controlled by -f90 */ 937 OPT(int,f90_accept_type,F90_ALL); 938 OPT(int,f90_byte,F90_ALL); 939 OPT(int,f90_continue,F90_ALL); 940 OPT(int,f90_cray_pointers,F90_ALL); 941 OPT(int,f90_d_comment,F90_ALL); 942 OPT(int,f90_dec_tabs,F90_ALL); 943 OPT(int,f90_dollarsigns,F90_ALL); 944 OPT(int,f90_double_complex,F90_ALL); 945 OPT(int,f90_format_dollarsigns,F90_ALL); 946 OPT(int,f90_format_extensions,F90_ALL); 947 OPT(int,f90_function_noparen,F90_ALL); 948 OPT(int,f90_initializers,F90_ALL); 949 OPT(int,f90_intrinsics,F90_ALL); 950 OPT(int,f90_io_keywords,F90_ALL); 951 OPT(int,f90_mixed_expr,F90_ALL); 952 OPT(int,f90_overlength,F90_ALL); 953 OPT(int,f90_param_implicit_type,F90_ALL); 954 OPT(int,f90_param_noparen,F90_ALL); 955 OPT(int,f90_quad_constants,F90_ALL); 956 OPT(int,f90_stmt_order,F90_ALL); 957 OPT(int,f90_typeless_constants,F90_ALL); 958 OPT(int,f90_typesize,F90_ALL); 959 OPT(int,f90_unix_backslash,F90_ALL); 960 OPT(int,f90_unix_cpp,F90_ALL); 961 OPT(int,f90_variable_format,F90_ALL); 962 /* Abuse of blank space in free format is not treated as a supported 963 extension to F90 but as a syntax error. Thus it is on by default. */ 964 #define f90_freeform_space misc_warn 965 /* End of -f90 options */ 966 967 /* These options are controlled by -f95 */ 968 OPT(int,f95_real_do,F95_ALL); /* real or d.p. DO variable */ 969 OPT(int,f95_pause,F95_ALL); /* PAUSE stmt */ 970 OPT(int,f95_assign,F95_ALL); /* ASSIGN stmt & kin */ 971 OPT(int,f95_Hedit,F95_ALL); /* H edit descriptor */ 972 /* End of -f95 options */ 973 974 /* These options are controlled by -makedcls */ 975 OPT(int,dcl_declarations,FALSE); 976 OPT(int,dcl_only_undeclared,FALSE); 977 OPT(int,dcl_compact,FALSE); 978 OPT(int,dcl_use_continuations,FALSE); 979 OPT(int,dcl_keywords_lowercase,FALSE); 980 OPT(int,dcl_vars_and_consts_lowercase,FALSE); 981 OPT(int,dcl_excl_sftran3_internal_vars,FALSE); 982 OPT(int,dcl_asterisk_comment_character,FALSE); 983 OPT(int,dcl_lowercase_comment_character,FALSE); 984 OPT(int,dcl_no_array_dimensions,FALSE); 985 OPT(int,dcl_free_form,FALSE); 986 /* End of -makedcls options */ 987 988 /* These options are controlled by -mkhtml */ 989 OPT(int,html_documents,FALSE); 990 OPT(int,html_only_undeclared,FALSE); 991 OPT(int,html_compact,FALSE); 992 OPT(int,html_use_continuations,FALSE); 993 OPT(int,html_keywords_lowercase,FALSE); 994 OPT(int,html_vars_and_consts_lowercase,FALSE); 995 OPT(int,html_excl_sftran3_internal_vars,FALSE); 996 OPT(int,html_no_array_dimensions,FALSE); 997 OPT(int,html_free_form,FALSE); 998 /* End of -makedcls options */ 999 1000 /* These options are controlled by -portability */ 1001 OPT(int,port_common_alignment,PORT_ALL);/* Common not in desc size order */ 1002 OPT(int,port_backslash,PORT_ALL); /* Backslash used in standard way */ 1003 OPT(int,port_real_do,PORT_ALL); /* Non-integer DO loop bounds */ 1004 OPT(int,port_long_string,PORT_ALL); /* Char string > 255 in length */ 1005 OPT(int,port_hollerith,PORT_ALL); /* Hollerith (except in FORMAT) */ 1006 OPT(int,port_mixed_equiv,PORT_ALL); /* Different types equivalenced */ 1007 OPT(int,port_mixed_size,PORT_ALL); /* sized, nonsized types mixed */ 1008 OPT(int,port_param_implicit_type,PORT_ALL);/* Implicit param type != default */ 1009 OPT(int,port_tabs,PORT_ALL); /* Tabs in source */ 1010 /* End of -portability options */ 1011 1012 1013 /* These options are controlled by -pretty */ 1014 OPT(int,pretty_alt_return,PRETTY_ALL);/* alternate return out of range */ 1015 OPT(int,pretty_multiple_common,PRETTY_ALL);/* COMMON decl in multiple stmts */ 1016 OPT(int,pretty_multiple_namelist,PRETTY_ALL);/* NAMELIST decl in multiple stmts */ 1017 OPT(int,pretty_parens,PRETTY_ALL); /* Parentheses around a variable */ 1018 OPT(int,pretty_overlength,PRETTY_ALL); /* Lines over 72 columns */ 1019 OPT(int,pretty_extra_space,PRETTY_ALL); /* Spaces in identifiers */ 1020 OPT(int,pretty_no_space,PRETTY_ALL); /* Space missing btw id and keyword */ 1021 OPT(int,pretty_contin,PRETTY_ALL); /* Continuation mark after comment */ 1022 /* End of -pretty options */ 1023 1024 /* These options are controlled by -project */ 1025 OPT(int,make_project_file,FALSE);/* Save symtab defns in .prj file */ 1026 OPT(int,proj_trim_calls,TRUE); /* Keep min no of calls in project file */ 1027 OPT(int,proj_trim_common,TRUE); /* Keep min no of block decls in proj file */ 1028 /* End of -project options */ 1029 1030 1031 /* These options are controlled by -source */ 1032 OPT(int,source_dec_tab,DEC_TABS); /*DEC Fortran tab-format*/ 1033 OPT(int,source_vms_include,VMS_INCLUDE); /*VMS INCLUDE statement*/ 1034 OPT(int,source_unix_backslash,UNIX_BACKSLASH); /*UNIX backslash escape*/ 1035 OPT(int,source_dec_param_std_type,DEC_PARAMETER_STANDARD_TYPE); 1036 OPT(int,source_param_implicit,PARAMETER_IMPLICIT_TYPE);/* std params */ 1037 OPT(int,source_fixed_form,FALSE); /* force fixed format (see Note) */ 1038 OPT(int,source_free_form,FALSE); /* force free format (see Note) */ 1039 /* Note: actual flag variable used to specify source form is 1040 free_form in forlex.h. It is set by init_scan based on 1041 filename extension (.f or .f90), overridden by 1042 source_fixed_format or source_free_format if set.*/ 1043 1044 /* end of -source options */ 1045 1046 /* These options are controlled by -style */ 1047 /* require subprog END stmts to specify subprog class */ 1048 OPT(int,style_req_structured_end,STYLECHECK_ALL); 1049 /* require names on structured END stmts */ 1050 OPT(int,style_req_end_name,STYLECHECK_ALL); 1051 /* require names on IF, DO, and SELECT CASE constructs */ 1052 OPT(int,style_req_construct_name,STYLECHECK_ALL); 1053 /* require main prog to start with PROGRAM stmt */ 1054 OPT(int,style_req_prog_stmt,STYLECHECK_ALL); 1055 /* require use of block IF or logical IF */ 1056 OPT(int,style_req_block_if,STYLECHECK_ALL); 1057 /* require use of ENDDO with DO */ 1058 OPT(int,style_req_enddo,STYLECHECK_ALL); 1059 /* require use of ENDDO or CONTINUE with DO */ 1060 OPT(int,style_req_do_construct,STYLECHECK_ALL); 1061 /* no shared DO loop terminators */ 1062 OPT(int,style_shared_do_terminator,STYLECHECK_ALL); 1063 /* GOTO in all its forms */ 1064 OPT(int,style_goto,STYLECHECK_ALL); 1065 /* Labeled stmt other than FORMAT */ 1066 OPT(int,style_labeled_exec,STYLECHECK_ALL); 1067 /* Labeled FORMAT stmt */ 1068 OPT(int,style_labeled_format,STYLECHECK_ALL); 1069 1070 /* End of -style options */ 1071 1072 /* These options are controlled by -truncation */ 1073 OPT(int,trunc_int_div_real,TRUNC_ALL); /* Int/int --> real */ 1074 OPT(int,trunc_int_div_exponent,TRUNC_ALL);/* Int/int as exponentl */ 1075 OPT(int,trunc_int_div_zero,TRUNC_ALL); /* Int/int const = 0 */ 1076 OPT(int,trunc_int_neg_power,TRUNC_ALL); /* Int**(-int) */ 1077 OPT(int,trunc_real_subscript,TRUNC_ALL);/* Real array subscript */ 1078 OPT(int,trunc_real_do_index,TRUNC_ALL); /* Real DO index with int bounds */ 1079 OPT(int,trunc_type_demotion,TRUNC_ALL); /* High --> low precision */ 1080 OPT(int,trunc_size_demotion,TRUNC_ALL); /* High --> low precision */ 1081 OPT(int,trunc_promotion,TRUNC_ALL); /* Low --> high precision */ 1082 OPT(int,trunc_sigfigs,TRUNC_ALL); /* Sngl const overspecified */ 1083 /* truncation warnings related to precision */ 1084 #define trunc_precision (trunc_promotion||trunc_type_demotion||trunc_size_demotion) 1085 /* End of -truncation options */ 1086 1087 /* These options are controlled by -usage */ 1088 OPT(int,usage_arg_modified,USAGE_ALL); /* const or expr arg modified */ 1089 OPT(int,usage_arg_alias_modified,USAGE_ALL); /* arg same-as other modified */ 1090 OPT(int,usage_array_alias_modified,USAGE_ALL);/* arg in same array as other modified */ 1091 OPT(int,usage_arg_common_modified,USAGE_ALL); /* arg in common modified */ 1092 OPT(int,usage_array_common_modified,USAGE_ALL); /* array arg in common modified */ 1093 OPT(int,usage_arg_unused,USAGE_ALL); /* arg declared but not used */ 1094 OPT(int,usage_com_block_unused,USAGE_ALL); /* whole block declared but not used */ 1095 OPT(int,usage_com_block_volatile,USAGE_ALL); /* block may lose defn */ 1096 OPT(int,usage_com_var_set_unused,USAGE_ALL); /* set but not used */ 1097 OPT(int,usage_com_var_uninitialized,USAGE_ALL);/* used but not set */ 1098 OPT(int,usage_com_var_unused,USAGE_ALL); /* declared but not used */ 1099 OPT(int,usage_do_var_modified,USAGE_ALL); /* DO index var modified */ 1100 OPT(int,usage_ext_declared_only,USAGE_ALL); /* declared EXTERNAL but not defined or used */ 1101 OPT(int,usage_ext_multiply_defined,USAGE_ALL);/* multiple definitions */ 1102 OPT(int,usage_ext_undefined,USAGE_ALL); /* used but not defined (= -external flag) */ 1103 OPT(int,usage_ext_unused,USAGE_ALL); /* defined but not used (like -library flag) */ 1104 OPT(int,usage_label_undefined,USAGE_ALL); /* label used but undefined */ 1105 OPT(int,usage_label_unused,USAGE_ALL); /* label defined but unused */ 1106 OPT(int,usage_var_set_unused,USAGE_ALL); /* set but not used */ 1107 OPT(int,usage_var_uninitialized,USAGE_ALL); /* used before set */ 1108 OPT(int,usage_var_unused,USAGE_ALL); /* declared but not used */ 1109 /* End of -usage options */ 1110 1111 1112 /* The following flag is for warnings not covered by other flags, 1113 so that all warnings can be turned off by -nocheck. */ 1114 OPT(int,misc_warn,TRUE); 1115 1116 /* The following variables are controlled by command line options */ 1117 1118 OPT(int,do_check,TRUE); /* For -nocheck option */ 1119 OPT(int,decls_required,FALSE); /* List all undeclared identifiers */ 1120 OPT(int,div_check,FALSE); /* Check for possible division by zero */ 1121 OPT(int,ext_def_check,TRUE); /* Check defined status of externals*/ 1122 OPT(int,help_screen,FALSE); /* Print out help screen */ 1123 OPT(int,library_mode,FALSE); /* Set used-flag for all modules in file */ 1124 OPT(int,brief,FALSE); /* Briefer form of local error messages */ 1125 OPT(int,do_list,FALSE); /* Listing flag */ 1126 OPT(int,novice_help,TRUE); /* Extra help for novices */ 1127 OPT(int,pure_functions,TRUE); /* Assume functions are pure */ 1128 OPT(int,quiet,FALSE); /* Less verbose output format */ 1129 OPT(int,sixclash,FALSE); /* To check if names unique in 1st 6 chars */ 1130 OPT(int,print_topo_sort,FALSE); /* Topological sort of modules */ 1131 OPT(int,do_symtab,FALSE); /* For symbol table printout */ 1132 OPT(int,print_version,FALSE); /* Print version number and quit */ 1133 /* Debugging flags */ 1134 OPT(int,debug_latest,FALSE); /* debug the latest addition */ 1135 OPT(int,debug_glob_symtab,FALSE);/* global symtab contents */ 1136 OPT(int,debug_parser,FALSE); /* grammar debug via DBG statements */ 1137 OPT(int,debug_hashtab,FALSE); /* hash table contents */ 1138 OPT(int,debug_loc_symtab,FALSE); /* local symtab contents */ 1139 OPT(int,show_resources,FALSE); /* space avail and used */ 1140 #if defined(DEBUG_FORLEX) || defined(DEBUG_IS_KEYWORD) 1141 OPT(int,debug_lexer,FALSE); /* list of tokens as scanned */ 1142 #endif 1143 1144 /* Declare variables for commandline settings */ 1145 OPT(int,call_tree_options,0); /* Sum of: 1 (print it), */ 1146 /* 2 (who-calls-who form), 4 (don't prune) */ 1147 /* 8 (program order), 16 (VCG format) */ 1148 1149 1150 #ifndef STANDARD_INTRINSICS 1151 /* -intrinsic setting defaults */ 1152 OPT(int,intrinsic_rand_no_argument,(DEF_INTRINSIC_RAND & 1)==1); /* rand form */ 1153 OPT(int,intrinsic_rand_one_argument,(DEF_INTRINSIC_RAND & 2)==2); 1154 OPT(int,intrinsic_iargc_no_argument,(DEF_INTRINSIC_IARGC & 1)==1);/* iargc form */ 1155 OPT(int,intrinsic_iargc_one_argument,(DEF_INTRINSIC_IARGC & 2)==2); 1156 OPT(int,intrinsic_set_extra,(DEF_INTRINSIC_SET & 1)==1);/* common intrinsics */ 1157 OPT(int,intrinsic_set_unix,(DEF_INTRINSIC_SET & 2)==2);/* some unix intrinsics */ 1158 OPT(int,intrinsic_set_vms,(DEF_INTRINSIC_SET & 4)==4);/* some vms intrinsics */ 1159 #endif /* not STANDARD_INTRINSICS */ 1160 1161 OPT(int,fixed_max_stmt_col,72); /* End of fixed-form statement field ( <= MAXLINE )*/ 1162 OPT(int,error_cascade_limit,DEF_ERROR_CASCADE_LIMIT);/* max errors in cascade */ 1163 OPT(int,local_ptrsize,PTRSIZE); /* Size of Cray pointer variables */ 1164 OPT(int,given_ptrsize,PTRSIZE); /* Size requested for Cray pointer variables */ 1165 1166 OPT(int,local_wordsize,BpW); /* Bytes per word to use for default sizes */ 1167 OPT(int,given_wordsize,BpW); /* User's request as per -wordsize=n */ 1168 OPT(int,wrap_column,WRAP_COLUMN);/* For wrapping error messages */ 1169 1170 1171 /* Shorthands for checking control settings */ 1172 1173 #define usage_com_any (usage_com_block_unused || usage_com_var_set_unused \ 1174 || usage_com_var_uninitialized || usage_com_var_unused) 1175 1176 #define COMCHECK_OFF (!(comcheck_by_name||comcheck_type||comcheck_length)) 1177 1178 #define check_com_tree (comcheck_volatile&&usage_com_block_volatile) /* Check undef errors */ 1179 1180 #define full_output (do_list || do_symtab) 1181 1182 #define ANY_DCL_DECLARATIONS() (dcl_declarations\ 1183 ||dcl_only_undeclared\ 1184 ||dcl_compact||dcl_use_continuations\ 1185 ||dcl_keywords_lowercase\ 1186 ||dcl_vars_and_consts_lowercase\ 1187 ||dcl_excl_sftran3_internal_vars\ 1188 ||dcl_asterisk_comment_character\ 1189 ||dcl_lowercase_comment_character\ 1190 ||dcl_no_array_dimensions\ 1191 ||dcl_free_form\ 1192 ) 1193 #define ANY_HTML_DECLARATIONS() (html_documents\ 1194 ||html_only_undeclared\ 1195 ||html_compact||html_use_continuations\ 1196 ||html_keywords_lowercase\ 1197 ||html_vars_and_consts_lowercase\ 1198 ||html_excl_sftran3_internal_vars\ 1199 ||html_no_array_dimensions\ 1200 ||html_free_form\ 1201 ) 1202 1203 /* Declare variables for commandline StrSettings */ 1204 OPT(char*,out_fname,(char *)NULL); /* Output filename */ 1205 #ifdef ALLOW_INCLUDE 1206 OPT(char*,include_path,(char *)NULL); /* An include-file directory */ 1207 #endif 1208 OPT(char*,idletter_list,DEF_IDLETTER_LIST);/* non-alpha chars allowed in identifiers */ 1209 1210 SHARED LINENO_t 1211 line_num, /* line num of current char */ 1212 next_line_num; /* line num of lookahead char */ 1213 SHARED COLNO_t 1214 col_num, /* column num of current char */ 1215 next_col_num; /* column num of lookahead char */ 1216 1217 SHARED unsigned 1218 error_count, /* Count of syntax error messages per file */ 1219 warning_count; /* Count of warning messages per file */ 1220 1221 SHARED char * 1222 tab_filename; /* Filename where there are tabs for -port */ 1223 1224 /* Resource usage information: */ 1225 SHARED unsigned long 1226 tot_line_count, /* total source lines (stmts + comments) */ 1227 tot_stmt_line_count,/* total source stmt lines */ 1228 tot_exec_stmt_count,/* count of executable stmts in program */ 1229 tot_module_count, /* count of subprograms in program */ 1230 tot_label_count, /* total number of statement labels defined */ 1231 exec_stmt_count, /* count of executable stmts in module */ 1232 max_exec_stmt_count,/* max number of executable stmts in any module */ 1233 max_loc_strings, /* chars of local stringspace used */ 1234 max_srctextspace, /* chars of source text space used */ 1235 max_paraminfo, /* number of param info structs used */ 1236 max_tokenlists, /* number of tokenlists constructed */ 1237 max_token_space, /* number of tokens used */ 1238 max_ptrspace, /* number of pointers used */ 1239 max_labels, /* maximum no. of labels in any subprog */ 1240 1241 glob_strings_used, /* chars of global stringspace used */ 1242 arglist_element_used, /* arg array elements used */ 1243 arglist_head_used, /* arg heads used (1 per call) */ 1244 comlist_element_used, /* com array elements used */ 1245 comlist_head_used; /* com heads used (1 per defn) */ 1246 SHARED long 1247 max_loc_symtab, /* number of local symtab entries used */ 1248 max_glob_symtab; /* number of global symtab entries used */ 1249 1250 SHARED int 1251 equivalence_flag, /* true while parsing EQUIVALENCE statement */ 1252 initial_flag, /* true while only label or initial keywords read */ 1253 implicit_flag, /* true while parsing IMPLICIT statement */ 1254 implicit_letter_flag, /* true while getting letters in IMPLICIT list */ 1255 implicit_type_given,/* true if IMPLICIT type statement found */ 1256 implicit_none, /* true if IMPLICIT NONE statement found */ 1257 prev_token_class, /* token class of last-returned token */ 1258 curr_stmt_class; /* Token class of current stmt's leading token */ 1259 1260 /* flag for error messages to behave differently in global cases */ 1261 SHARED int doing_wrapup; 1262 /* ditto for local cases */ 1263 SHARED int doing_end_proc; 1264 1265 /* Define linked-list structure for include-path list */ 1266 #ifdef ALLOW_INCLUDE 1267 typedef struct IPNode { 1268 struct IPNode *link; /* next path on the list */ 1269 char *include_path; /* one path (full directory name) */ 1270 } IncludePathNode; 1271 1272 SHARED IncludePathNode *include_path_list; /* header to the list */ 1273 #endif 1274 1275 /* Declare routines shared with main module ftnchek.c */ 1276 1277 1278 /* in exprtype.c */ 1279 PROTO(void init_typesizes, ( void )); 1280 1281 /* in ftnchek.c */ 1282 PROTO( char * add_ext,( char *s, const char *ext )); 1283 PROTO( int has_extension,( const char *name, const char *ext )); 1284 1285 /* in forlex.c and advance.c */ 1286 PROTO(void make_legal_char_list, ( void )); 1287 PROTO(void finish_scan, ( void )); 1288 PROTO(int flush_line_out, ( LINENO_t n )); 1289 PROTO(int flush_end_stmt, ( LINENO_t n )); 1290 PROTO(void init_keyhashtab, ( void )); 1291 PROTO(void init_scan, ( void )); 1292 PROTO(void init_stream,( void )); 1293 1294 1295 /* in include.c */ 1296 PROTO(void open_include_file, ( char *fname, LINENO_t include_line_num )); 1297 PROTO(int pop_include_file,( void )); 1298 1299 /* in fortran.y/fortran.c */ 1300 PROTO(void init_parser, ( void )); 1301 PROTO(int yyparse, ( void )); 1302 1303 /* in message.c */ 1304 PROTO(void msg_tail, ( const char *s )); 1305 PROTO(void nonportable, ( LINENO_t lineno, COLNO_t colno, const char *s )); 1306 PROTO(void nonstandard, ( LINENO_t lineno, COLNO_t colno, int f90, int f95 )); 1307 PROTO(void oops_message, ( int severity, LINENO_t lineno, COLNO_t colno, const char *s )); 1308 PROTO(void oops_tail, ( const char *s )); 1309 PROTO(void print_a_line, ( FILE *fd, const char *line, LINENO_t num )); 1310 PROTO(void syntax_error, ( LINENO_t lineno, COLNO_t colno, const char *s )); 1311 PROTO(void ugly_code, ( LINENO_t lineno, COLNO_t colno, const char *s )); 1312 PROTO(void warning, ( LINENO_t lineno, COLNO_t colno, const char *s )); 1313 PROTO(void local_message, ( const char *filename, LINENO_t lineno, const char *s, const char *tag )); 1314 PROTO(void global_warning, ( const char *filename, LINENO_t lineno, const char *s )); 1315 PROTO(void global_message, ( const char *filename, LINENO_t lineno, const char *s )); 1316 PROTO(void lex_error, (const char *s )); 1317 PROTO(void yyerror, ( const char *s )); 1318 PROTO(char* ulongtostr, (unsigned long num)); 1319 /* Maximum length of a longtostr() result */ 1320 #define MAX_ULONGTOSTR (3*sizeof(unsigned long)) 1321 1322 1323 /* in pgsymtab.c */ 1324 PROTO(void check_arglists, ( void )); 1325 PROTO(void check_comlists, ( void )); 1326 PROTO(void check_com_usage, ( void )); 1327 PROTO(void visit_children, ( void )); 1328 1329 /* in plsymtab.c */ 1330 PROTO(void debug_symtabs, ( void )); 1331 1332 /* in project.c */ 1333 PROTO(void proj_file_out, ( FILE *fd )); 1334 PROTO(void proj_file_in, ( FILE *fd )); 1335 1336 /* in symtab.c */ 1337 PROTO(void init_tables, ( void )); 1338 PROTO(void init_globals, ( void )); 1339 PROTO(void init_symtab, ( void )); 1340 PROTO(void note_filename, ( char *s )); 1341 #ifdef DEBUG_SIZES 1342 PROTO(void print_sizeofs, ( void )); 1343 #endif 1344 1345 /* Misc. useful defines */ 1346 #undef MAX 1347 #define MAX(X,Y) ((X)>(Y)?(X):(Y)) 1348