📄 gfortran.h
字号:
/* gfortran header file Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Contributed by Andy VaughtThis file is part of GCC.GCC is free software; you can redistribute it and/or modify it underthe terms of the GNU General Public License as published by the FreeSoftware Foundation; either version 2, or (at your option) any laterversion.GCC is distributed in the hope that it will be useful, but WITHOUT ANYWARRANTY; without even the implied warranty of MERCHANTABILITY orFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public Licensefor more details.You should have received a copy of the GNU General Public Licensealong with GCC; see the file COPYING. If not, write to the FreeSoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA02110-1301, USA. */#ifndef GCC_GFORTRAN_H#define GCC_GFORTRAN_H/* It's probably insane to have this large of a header file, but it seemed like everything had to be recompiled anyway when a change was made to a header file, and there were ordering issues with multiple header files. Besides, Microsoft's winnt.h was 250k last time I looked, so by comparison this is perfectly reasonable. */#include "system.h"#include "intl.h"#include "coretypes.h"#include "input.h"/* The following ifdefs are recommended by the autoconf documentation for any code using alloca. *//* AIX requires this to be the first thing in the file. */#ifdef __GNUC__#else /* not __GNUC__ */#ifdef HAVE_ALLOCA_H#include <alloca.h>#else /* do not HAVE_ALLOCA_H */#ifdef _AIX#pragma alloca#else#ifndef alloca /* predefined by HP cc +Olibcalls */char *alloca ();#endif /* not predefined */#endif /* not _AIX */#endif /* do not HAVE_ALLOCA_H */#endif /* not __GNUC__ *//* Major control parameters. */#define GFC_MAX_SYMBOL_LEN 63#define GFC_MAX_LINE 132 /* Characters beyond this are not seen. */#define GFC_MAX_DIMENSIONS 7 /* Maximum dimensions in an array. */#define GFC_LETTERS 26 /* Number of letters in the alphabet. */#define free(x) Use_gfc_free_instead_of_free()#define gfc_is_whitespace(c) ((c==' ') || (c=='\t'))#ifndef NULL#define NULL ((void *) 0)#endif/* Stringization. */#define stringize(x) expand_macro(x)#define expand_macro(x) # x/* For a the runtime library, a standard prefix is a requirement to avoid cluttering the namespace with things nobody asked for. It's ugly to look at and a pain to type when you add the prefix by hand, so we hide it behind a macro. */#define PREFIX(x) "_gfortran_" x#define PREFIX_LEN 10#define BLANK_COMMON_NAME "__BLNK__"/* Macro to initialize an mstring structure. */#define minit(s, t) { s, NULL, t }/* Structure for storing strings to be matched by gfc_match_string. */typedef struct{ const char *string; const char *mp; int tag;}mstring;/* Flags to specify which standard/extension contains a feature. */#define GFC_STD_LEGACY (1<<6) /* Backward compatibility. */#define GFC_STD_GNU (1<<5) /* GNU Fortran extension. */#define GFC_STD_F2003 (1<<4) /* New in F2003. *//* Note that no features were obsoleted nor deleted in F2003. */#define GFC_STD_F95 (1<<3) /* New in F95. */#define GFC_STD_F95_DEL (1<<2) /* Deleted in F95. */#define GFC_STD_F95_OBS (1<<1) /* Obsoleted in F95. */#define GFC_STD_F77 (1<<0) /* Up to and including F77. *//* Bitmasks for the various FPE that can be enabled. */#define GFC_FPE_INVALID (1<<0)#define GFC_FPE_DENORMAL (1<<1)#define GFC_FPE_ZERO (1<<2)#define GFC_FPE_OVERFLOW (1<<3)#define GFC_FPE_UNDERFLOW (1<<4)#define GFC_FPE_PRECISION (1<<5)/* Keep this in sync with libgfortran/io/io.h ! */typedef enum { CONVERT_NATIVE=0, CONVERT_SWAP, CONVERT_BIG, CONVERT_LITTLE }options_convert;/*************************** Enums *****************************//* The author remains confused to this day about the convention of returning '0' for 'SUCCESS'... or was it the other way around? The following enum makes things much more readable. We also start values off at one instead of zero. */typedef enum{ SUCCESS = 1, FAILURE }try;/* Matchers return one of these three values. The difference between MATCH_NO and MATCH_ERROR is that MATCH_ERROR means that a match was successful, but that something non-syntactic is wrong and an error has already been issued. */typedef enum{ MATCH_NO = 1, MATCH_YES, MATCH_ERROR }match;typedef enum{ FORM_FREE, FORM_FIXED, FORM_UNKNOWN }gfc_source_form;typedef enum{ BT_UNKNOWN = 1, BT_INTEGER, BT_REAL, BT_COMPLEX, BT_LOGICAL, BT_CHARACTER, BT_DERIVED, BT_PROCEDURE, BT_HOLLERITH}bt;/* Expression node types. */typedef enum{ EXPR_OP = 1, EXPR_FUNCTION, EXPR_CONSTANT, EXPR_VARIABLE, EXPR_SUBSTRING, EXPR_STRUCTURE, EXPR_ARRAY, EXPR_NULL}expr_t;/* Array types. */typedef enum{ AS_EXPLICIT = 1, AS_ASSUMED_SHAPE, AS_DEFERRED, AS_ASSUMED_SIZE, AS_UNKNOWN}array_type;typedef enum{ AR_FULL = 1, AR_ELEMENT, AR_SECTION, AR_UNKNOWN }ar_type;/* Statement label types. */typedef enum{ ST_LABEL_UNKNOWN = 1, ST_LABEL_TARGET, ST_LABEL_BAD_TARGET, ST_LABEL_FORMAT}gfc_sl_type;/* Intrinsic operators. */typedef enum{ GFC_INTRINSIC_BEGIN = 0, INTRINSIC_NONE = -1, INTRINSIC_UPLUS = GFC_INTRINSIC_BEGIN, INTRINSIC_UMINUS, INTRINSIC_PLUS, INTRINSIC_MINUS, INTRINSIC_TIMES, INTRINSIC_DIVIDE, INTRINSIC_POWER, INTRINSIC_CONCAT, INTRINSIC_AND, INTRINSIC_OR, INTRINSIC_EQV, INTRINSIC_NEQV, INTRINSIC_EQ, INTRINSIC_NE, INTRINSIC_GT, INTRINSIC_GE, INTRINSIC_LT, INTRINSIC_LE, INTRINSIC_NOT, INTRINSIC_USER, INTRINSIC_ASSIGN, INTRINSIC_PARENTHESES, GFC_INTRINSIC_END /* Sentinel */}gfc_intrinsic_op;/* Strings for all intrinsic operators. */extern mstring intrinsic_operators[];/* This macro is the number of intrinsic operators that exist. Assumptions are made about the numbering of the interface_op enums. */#define GFC_INTRINSIC_OPS GFC_INTRINSIC_END/* Arithmetic results. */typedef enum{ ARITH_OK = 1, ARITH_OVERFLOW, ARITH_UNDERFLOW, ARITH_NAN, ARITH_DIV0, ARITH_INCOMMENSURATE, ARITH_ASYMMETRIC}arith;/* Statements. */typedef enum{ ST_ARITHMETIC_IF, ST_ALLOCATE, ST_ATTR_DECL, ST_BACKSPACE, ST_BLOCK_DATA, ST_CALL, ST_CASE, ST_CLOSE, ST_COMMON, ST_CONTINUE, ST_CONTAINS, ST_CYCLE, ST_DATA, ST_DATA_DECL, ST_DEALLOCATE, ST_DO, ST_ELSE, ST_ELSEIF, ST_ELSEWHERE, ST_END_BLOCK_DATA, ST_ENDDO, ST_IMPLIED_ENDDO, ST_END_FILE, ST_FLUSH, ST_END_FORALL, ST_END_FUNCTION, ST_ENDIF, ST_END_INTERFACE, ST_END_MODULE, ST_END_PROGRAM, ST_END_SELECT, ST_END_SUBROUTINE, ST_END_WHERE, ST_END_TYPE, ST_ENTRY, ST_EQUIVALENCE, ST_EXIT, ST_FORALL, ST_FORALL_BLOCK, ST_FORMAT, ST_FUNCTION, ST_GOTO, ST_IF_BLOCK, ST_IMPLICIT, ST_IMPLICIT_NONE, ST_INQUIRE, ST_INTERFACE, ST_PARAMETER, ST_MODULE, ST_MODULE_PROC, ST_NAMELIST, ST_NULLIFY, ST_OPEN, ST_PAUSE, ST_PRIVATE, ST_PROGRAM, ST_PUBLIC, ST_READ, ST_RETURN, ST_REWIND, ST_STOP, ST_SUBROUTINE, ST_TYPE, ST_USE, ST_WHERE_BLOCK, ST_WHERE, ST_WRITE, ST_ASSIGNMENT, ST_POINTER_ASSIGNMENT, ST_SELECT_CASE, ST_SEQUENCE, ST_SIMPLE_IF, ST_STATEMENT_FUNCTION, ST_DERIVED_DECL, ST_LABEL_ASSIGNMENT, ST_ENUM, ST_ENUMERATOR, ST_END_ENUM, ST_NONE}gfc_statement;/* Types of interfaces that we can have. Assignment interfaces are considered to be intrinsic operators. */typedef enum{ INTERFACE_NAMELESS = 1, INTERFACE_GENERIC, INTERFACE_INTRINSIC_OP, INTERFACE_USER_OP}interface_type;/* Symbol flavors: these are all mutually exclusive. 10 elements = 4 bits. */typedef enum sym_flavor{ FL_UNKNOWN = 0, FL_PROGRAM, FL_BLOCK_DATA, FL_MODULE, FL_VARIABLE, FL_PARAMETER, FL_LABEL, FL_PROCEDURE, FL_DERIVED, FL_NAMELIST}sym_flavor;/* Procedure types. 7 elements = 3 bits. */typedef enum procedure_type{ PROC_UNKNOWN, PROC_MODULE, PROC_INTERNAL, PROC_DUMMY, PROC_INTRINSIC, PROC_ST_FUNCTION, PROC_EXTERNAL}procedure_type;/* Intent types. */typedef enum sym_intent{ INTENT_UNKNOWN = 0, INTENT_IN, INTENT_OUT, INTENT_INOUT}sym_intent;/* Access types. */typedef enum gfc_access{ ACCESS_UNKNOWN = 0, ACCESS_PUBLIC, ACCESS_PRIVATE}gfc_access;/* Flags to keep track of where an interface came from. 4 elements = 2 bits. */typedef enum ifsrc{ IFSRC_UNKNOWN = 0, IFSRC_DECL, IFSRC_IFBODY, IFSRC_USAGE}ifsrc;/* Strings for all symbol attributes. We use these for dumping the parse tree, in error messages, and also when reading and writing modules. In symbol.c. */extern const mstring flavors[];extern const mstring procedures[];extern const mstring intents[];extern const mstring access_types[];extern const mstring ifsrc_types[];/* Enumeration of all the generic intrinsic functions. Used by the backend for identification of a function. */enum gfc_generic_isym_id{ /* GFC_ISYM_NONE is used for intrinsics which will never be seen by the backend (eg. KIND). */ GFC_ISYM_NONE = 0, GFC_ISYM_ABS, GFC_ISYM_ACHAR, GFC_ISYM_ACOS, GFC_ISYM_ACOSH, GFC_ISYM_ADJUSTL, GFC_ISYM_ADJUSTR, GFC_ISYM_AIMAG, GFC_ISYM_AINT, GFC_ISYM_ALL, GFC_ISYM_ALLOCATED, GFC_ISYM_ANINT, GFC_ISYM_AND, GFC_ISYM_ANY, GFC_ISYM_ASIN, GFC_ISYM_ASINH, GFC_ISYM_ASSOCIATED, GFC_ISYM_ATAN, GFC_ISYM_ATANH, GFC_ISYM_ATAN2, GFC_ISYM_J0, GFC_ISYM_J1, GFC_ISYM_JN, GFC_ISYM_Y0, GFC_ISYM_Y1, GFC_ISYM_YN, GFC_ISYM_BTEST, GFC_ISYM_CEILING, GFC_ISYM_CHAR, GFC_ISYM_CHDIR, GFC_ISYM_CMPLX, GFC_ISYM_COMMAND_ARGUMENT_COUNT, GFC_ISYM_COMPLEX, GFC_ISYM_CONJG, GFC_ISYM_COS, GFC_ISYM_COSH, GFC_ISYM_COUNT, GFC_ISYM_CSHIFT, GFC_ISYM_CTIME, GFC_ISYM_DBLE, GFC_ISYM_DIM, GFC_ISYM_DOT_PRODUCT, GFC_ISYM_DPROD, GFC_ISYM_EOSHIFT, GFC_ISYM_ERF, GFC_ISYM_ERFC, GFC_ISYM_ETIME, GFC_ISYM_EXP, GFC_ISYM_EXPONENT, GFC_ISYM_FDATE, GFC_ISYM_FGET, GFC_ISYM_FGETC, GFC_ISYM_FLOOR, GFC_ISYM_FNUM, GFC_ISYM_FPUT, GFC_ISYM_FPUTC, GFC_ISYM_FRACTION, GFC_ISYM_FSTAT, GFC_ISYM_FTELL, GFC_ISYM_GETCWD, GFC_ISYM_GETGID, GFC_ISYM_GETPID, GFC_ISYM_GETUID, GFC_ISYM_HOSTNM, GFC_ISYM_IACHAR, GFC_ISYM_IAND, GFC_ISYM_IARGC, GFC_ISYM_IBCLR, GFC_ISYM_IBITS, GFC_ISYM_IBSET, GFC_ISYM_ICHAR, GFC_ISYM_IEOR, GFC_ISYM_IERRNO, GFC_ISYM_INDEX, GFC_ISYM_INT, GFC_ISYM_IOR, GFC_ISYM_IRAND, GFC_ISYM_ISATTY, GFC_ISYM_ISHFT, GFC_ISYM_ISHFTC, GFC_ISYM_KILL, GFC_ISYM_LBOUND, GFC_ISYM_LEN, GFC_ISYM_LEN_TRIM, GFC_ISYM_LINK, GFC_ISYM_LGE, GFC_ISYM_LGT, GFC_ISYM_LLE, GFC_ISYM_LLT, GFC_ISYM_LOG, GFC_ISYM_LOC, GFC_ISYM_LOG10, GFC_ISYM_LOGICAL, GFC_ISYM_MALLOC, GFC_ISYM_MATMUL, GFC_ISYM_MAX, GFC_ISYM_MAXLOC, GFC_ISYM_MAXVAL, GFC_ISYM_MERGE, GFC_ISYM_MIN, GFC_ISYM_MINLOC, GFC_ISYM_MINVAL, GFC_ISYM_MOD, GFC_ISYM_MODULO, GFC_ISYM_NEAREST, GFC_ISYM_NINT, GFC_ISYM_NOT, GFC_ISYM_OR, GFC_ISYM_PACK, GFC_ISYM_PRESENT, GFC_ISYM_PRODUCT, GFC_ISYM_RAND, GFC_ISYM_REAL, GFC_ISYM_RENAME, GFC_ISYM_REPEAT, GFC_ISYM_RESHAPE, GFC_ISYM_RRSPACING, GFC_ISYM_SCALE, GFC_ISYM_SCAN, GFC_ISYM_SECOND, GFC_ISYM_SECNDS, GFC_ISYM_SET_EXPONENT, GFC_ISYM_SHAPE, GFC_ISYM_SI_KIND, GFC_ISYM_SIGN, GFC_ISYM_SIGNAL, GFC_ISYM_SIN, GFC_ISYM_SINH, GFC_ISYM_SIZE, GFC_ISYM_SPACING, GFC_ISYM_SPREAD, GFC_ISYM_SQRT, GFC_ISYM_SR_KIND, GFC_ISYM_STAT, GFC_ISYM_SUM, GFC_ISYM_SYMLNK, GFC_ISYM_SYSTEM, GFC_ISYM_TAN, GFC_ISYM_TANH, GFC_ISYM_TIME, GFC_ISYM_TIME8, GFC_ISYM_TRANSFER, GFC_ISYM_TRANSPOSE, GFC_ISYM_TRIM, GFC_ISYM_TTYNAM, GFC_ISYM_UBOUND, GFC_ISYM_UMASK, GFC_ISYM_UNLINK, GFC_ISYM_UNPACK, GFC_ISYM_VERIFY, GFC_ISYM_XOR, GFC_ISYM_CONVERSION};typedef enum gfc_generic_isym_id gfc_generic_isym_id;/************************* Structures *****************************//* Symbol attribute structure. */typedef struct{ /* Variable attributes. */ unsigned allocatable:1, dimension:1, external:1, intrinsic:1, optional:1, pointer:1, save:1, target:1, dummy:1, result:1, assign:1; unsigned data:1, /* Symbol is named in a DATA statement. */ use_assoc:1; /* Symbol has been use-associated. */ unsigned in_namelist:1, in_common:1, in_equivalence:1; unsigned function:1, subroutine:1, generic:1; unsigned implicit_type:1; /* Type defined via implicit rules. */ unsigned untyped:1; /* No implicit type could be found. */ /* Function/subroutine attributes */ unsigned sequence:1, elemental:1, pure:1, recursive:1; unsigned unmaskable:1, masked:1, contained:1; /* This is set if the subroutine doesn't return. Currently, this is only possible for intrinsic subroutines. */ unsigned noreturn:1; /* Set if this procedure is an alternate entry point. These procedures don't have any code associated, and the backend will turn them into thunks to the master function. */ unsigned entry:1; /* Set if this is the master function for a procedure with multiple entry points. */ unsigned entry_master:1; /* Set if this is the master function for a function with multiple entry points where characteristics of the entry points differ. */ unsigned mixed_entry_master:1; /* Set if a function must always be referenced by an explicit interface. */ unsigned always_explicit:1; /* Set if the symbol has been referenced in an expression. No further modification of type or type parameters is permitted. */ unsigned referenced:1; /* Set if the is the symbol for the main program. This is the least cumbersome way to communicate this function property without strcmp'ing with __MAIN everywhere. */ unsigned is_main_program:1; /* Mutually exclusive multibit attributes. */ ENUM_BITFIELD (gfc_access) access:2;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -