/* com.h -- Public #include File (module.h template V1.0)
- Copyright (C) 1995-1997 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 2000, 2003, 2004
+ Free Software Foundation, Inc.
Contributed by James Craig Burley.
This file is part of GNU Fortran.
/* Allow multiple inclusion to work. */
-#ifndef _H_f_com
-#define _H_f_com
+#ifndef GCC_F_COM_H
+#define GCC_F_COM_H
/* Simple definitions and enumerations. */
#define FFECOM_dimensionsMAX 7 /* Max # dimensions (quick hack). */
-#define FFECOM_targetFFE 1
-#define FFECOM_targetGCC 2
-
-#ifndef FFE_STANDALONE
-#define FFECOM_targetCURRENT FFECOM_targetGCC /* Backend! */
-#define FFECOM_ONEPASS 0
-#else
-#define FFECOM_targetCURRENT FFECOM_targetFFE
-#define FFECOM_ONEPASS 0
-#endif
-
-#if FFECOM_ONEPASS
-#define FFECOM_TWOPASS 0
-#else
-#define FFECOM_TWOPASS 1
-#endif
-
#define FFECOM_SIZE_UNIT "byte" /* Singular form. */
#define FFECOM_SIZE_UNITS "bytes" /* Plural form. */
-#if FFECOM_targetCURRENT == FFECOM_targetGCC
#define FFECOM_constantNULL NULL_TREE
#define FFECOM_nonterNULL NULL_TREE
#define FFECOM_globalNULL NULL_TREE
to build the libf2c with which g77-generated code is linked, or there
will probably be bugs, some of them difficult to detect or even trigger. */
-/* Do we need int (for 32-bit or 64-bit systems) or long (16-bit or
- normally 32-bit) for f2c-type integers? */
-
-#ifndef BITS_PER_WORD
-#define BITS_PER_WORD 32
-#endif
-
-#ifndef CHAR_TYPE_SIZE
-#define CHAR_TYPE_SIZE BITS_PER_UNIT
-#endif
-
-#ifndef SHORT_TYPE_SIZE
-#define SHORT_TYPE_SIZE (BITS_PER_UNIT * MIN ((UNITS_PER_WORD + 1) / 2, 2))
-#endif
-
-#ifndef INT_TYPE_SIZE
-#define INT_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef LONG_TYPE_SIZE
-#define LONG_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef LONG_LONG_TYPE_SIZE
-#define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
-
-#ifndef WCHAR_UNSIGNED
-#define WCHAR_UNSIGNED 0
-#endif
-
-#ifndef FLOAT_TYPE_SIZE
-#define FLOAT_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef DOUBLE_TYPE_SIZE
-#define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
-
-#ifndef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
-
-#if LONG_TYPE_SIZE == FLOAT_TYPE_SIZE
-# define FFECOM_f2cINTEGER FFECOM_f2ccodeLONG
-# define FFECOM_f2cLOGICAL FFECOM_f2ccodeLONG
-#elif INT_TYPE_SIZE == FLOAT_TYPE_SIZE
-# define FFECOM_f2cINTEGER FFECOM_f2ccodeINT
-# define FFECOM_f2cLOGICAL FFECOM_f2ccodeINT
-#else
-# error Cannot find a suitable type for FFECOM_f2cINTEGER
-#endif
-
-#if LONG_TYPE_SIZE == (FLOAT_TYPE_SIZE * 2)
-# define FFECOM_f2cLONGINT FFECOM_f2ccodeLONG
-#elif LONG_LONG_TYPE_SIZE == (FLOAT_TYPE_SIZE * 2)
-# define FFECOM_f2cLONGINT FFECOM_f2ccodeLONGLONG
-#else
-# error Cannot find a suitable type for FFECOM_f2cLONGINT
-#endif
+/* The C front-end provides __g77_integer and __g77_uinteger types so that
+ the appropriately-sized signed and unsigned integer types are available
+ for libf2c. If you change this, also the definitions of those types
+ in ../c-decl.c. */
+#define FFECOM_f2cINTEGER \
+ (LONG_TYPE_SIZE == FLOAT_TYPE_SIZE \
+ ? FFECOM_f2ccodeLONG \
+ : (INT_TYPE_SIZE == FLOAT_TYPE_SIZE \
+ ? FFECOM_f2ccodeINT \
+ : (abort (), -1)))
+
+#define FFECOM_f2cLOGICAL FFECOM_f2cINTEGER
+
+/* The C front-end provides __g77_longint and __g77_ulongint types so that
+ the appropriately-sized signed and unsigned integer types are available
+ for libf2c. If you change this, also the definitions of those types
+ in ../c-decl.c. */
+#define FFECOM_f2cLONGINT \
+ (LONG_TYPE_SIZE == (FLOAT_TYPE_SIZE * 2) \
+ ? FFECOM_f2ccodeLONG \
+ : (LONG_LONG_TYPE_SIZE == (FLOAT_TYPE_SIZE * 2) \
+ ? FFECOM_f2ccodeLONGLONG \
+ : (abort (), -1)))
#define FFECOM_f2cADDRESS FFECOM_f2ccodeCHARPTR
#define FFECOM_f2cSHORTINT FFECOM_f2ccodeSHORT
typedef enum
{
-#define DEFGFRT(CODE,NAME,TYPE,ARGS,VOLATILE,COMPLEX) CODE,
+#define DEFGFRT(CODE,NAME,TYPE,ARGS,VOLATILE,COMPLEX,CONST) CODE,
#include "com-rt.def"
#undef DEFGFRT
FFECOM_gfrt
} ffecomGfrt;
-#endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */
-
/* Typedefs. */
-#if FFECOM_targetCURRENT == FFECOM_targetGCC
#ifndef TREE_CODE
-#include "tree.j"
-#endif
-
-#ifndef BUILT_FOR_270
-#ifdef DECL_STATIC_CONSTRUCTOR /* In gcc/tree.h. */
-#define BUILT_FOR_270 1
-#else
-#define BUILT_FOR_270 0
-#endif
-#endif /* !defined (BUILT_FOR_270) */
-
-#ifndef BUILT_FOR_280
-#ifdef DECL_ONE_ONLY /* In gcc/tree.h. */
-#define BUILT_FOR_280 1
-#else
-#define BUILT_FOR_280 0
+#include "tree.h"
#endif
-#endif /* !defined (BUILT_FOR_280) */
typedef tree ffecomConstant;
-#define FFECOM_constantHOOK
typedef tree ffecomNonter;
-#define FFECOM_nonterHOOK
typedef tree ffecomLabel;
-#define FFECOM_globalHOOK
typedef tree ffecomGlobal;
-#define FFECOM_labelHOOK
typedef tree ffecomStorage;
-#define FFECOM_storageHOOK
typedef struct _ffecom_symbol_ ffecomSymbol;
-#define FFECOM_symbolHOOK
struct _ffecom_symbol_
{
tree assign_tree; /* For ASSIGN'ed vars. */
bool addr; /* Is address of item instead of item. */
};
-#endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */
/* Include files needed by this one. */
#include "storag.h"
#include "symbol.h"
-/* Structure definitions. */
-
+extern int global_bindings_p (void);
+extern tree getdecls (void);
+extern void pushlevel (int);
+extern tree poplevel (int,int, int);
+extern void insert_block (tree);
+extern void set_block (tree);
+extern tree pushdecl (tree);
/* Global objects accessed by users of this module. */
-#if FFECOM_targetCURRENT == FFECOM_targetGCC
-extern tree string_type_node;
-extern tree ffecom_integer_type_node;
-extern tree ffecom_integer_zero_node;
-extern tree ffecom_integer_one_node;
-extern tree ffecom_tree_type[FFEINFO_basictype][FFEINFO_kindtype];
+extern GTY(()) tree string_type_node;
+extern GTY(()) tree ffecom_integer_type_node;
+extern GTY(()) tree ffecom_integer_zero_node;
+extern GTY(()) tree ffecom_integer_one_node;
+extern GTY(()) tree ffecom_tree_type[FFEINFO_basictype][FFEINFO_kindtype];
extern ffecomSymbol ffecom_symbol_null_;
extern ffeinfoKindtype ffecom_pointer_kind_;
extern ffeinfoKindtype ffecom_label_kind_;
extern int ffecom_f2c_typecode_[FFEINFO_basictype][FFEINFO_kindtype];
-extern tree ffecom_f2c_integer_type_node;
-extern tree ffecom_f2c_address_type_node;
-extern tree ffecom_f2c_real_type_node;
-extern tree ffecom_f2c_doublereal_type_node;
-extern tree ffecom_f2c_complex_type_node;
-extern tree ffecom_f2c_doublecomplex_type_node;
-extern tree ffecom_f2c_longint_type_node;
-extern tree ffecom_f2c_logical_type_node;
-extern tree ffecom_f2c_flag_type_node;
-extern tree ffecom_f2c_ftnlen_type_node;
-extern tree ffecom_f2c_ftnlen_zero_node;
-extern tree ffecom_f2c_ftnlen_one_node;
-extern tree ffecom_f2c_ftnlen_two_node;
-extern tree ffecom_f2c_ptr_to_ftnlen_type_node;
-extern tree ffecom_f2c_ftnint_type_node;
-extern tree ffecom_f2c_ptr_to_ftnint_type_node;
-#endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */
+extern GTY(()) tree ffecom_f2c_integer_type_node;
+extern GTY(()) tree ffecom_f2c_address_type_node;
+extern GTY(()) tree ffecom_f2c_real_type_node;
+extern GTY(()) tree ffecom_f2c_doublereal_type_node;
+extern GTY(()) tree ffecom_f2c_complex_type_node;
+extern GTY(()) tree ffecom_f2c_doublecomplex_type_node;
+extern GTY(()) tree ffecom_f2c_longint_type_node;
+extern GTY(()) tree ffecom_f2c_logical_type_node;
+extern GTY(()) tree ffecom_f2c_flag_type_node;
+extern GTY(()) tree ffecom_f2c_ftnlen_type_node;
+extern GTY(()) tree ffecom_f2c_ftnlen_zero_node;
+extern GTY(()) tree ffecom_f2c_ftnlen_one_node;
+extern GTY(()) tree ffecom_f2c_ftnlen_two_node;
+extern GTY(()) tree ffecom_f2c_ptr_to_ftnlen_type_node;
+extern GTY(()) tree ffecom_f2c_ftnint_type_node;
+extern GTY(()) tree ffecom_f2c_ptr_to_ftnint_type_node;
/* Declare functions with prototypes. */
-#if FFECOM_targetCURRENT == FFECOM_targetGCC
tree ffecom_1 (enum tree_code code, tree type, tree node);
tree ffecom_1_fn (tree node);
tree ffecom_2 (enum tree_code code, tree type, tree node1, tree node2);
tree ffecom_arg_ptr_to_const_expr (ffebld expr, tree *length);
tree ffecom_arg_ptr_to_expr (ffebld expr, tree *length);
tree ffecom_call_gfrt (ffecomGfrt ix, tree args, tree hook);
+tree ffecom_constantunion_with_type (ffebldConstantUnion *cu,
+ tree tree_type,ffebldConst ct);
tree ffecom_constantunion (ffebldConstantUnion *cu, ffeinfoBasictype bt,
ffeinfoKindtype kt, tree tree_type);
tree ffecom_const_expr (ffebld expr);
tree ffecom_decl_field (tree context, tree prevfield, const char *name,
tree type);
-#endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */
void ffecom_close_include (FILE *f);
-int ffecom_decode_include_option (char *spec);
-#if FFECOM_targetCURRENT == FFECOM_targetGCC
+void ffecom_decode_include_option (const char *dir);
tree ffecom_end_compstmt (void);
-#endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */
void ffecom_end_transition (void);
void ffecom_exec_transition (void);
void ffecom_expand_let_stmt (ffebld dest, ffebld source);
-#if FFECOM_targetCURRENT == FFECOM_targetGCC
tree ffecom_expr (ffebld expr);
tree ffecom_expr_assign (ffebld expr);
tree ffecom_expr_assign_w (ffebld expr);
void ffecom_finish_progunit (void);
tree ffecom_get_invented_identifier (const char *pattern, ...)
ATTRIBUTE_PRINTF_1;
-ffeinfoKindtype ffecom_gfrt_basictype (ffecomGfrt ix);
+ffeinfoBasictype ffecom_gfrt_basictype (ffecomGfrt ix);
ffeinfoKindtype ffecom_gfrt_kindtype (ffecomGfrt ix);
void ffecom_init_0 (void);
void ffecom_init_2 (void);
ffetargetCharacterSize size, int elements);
tree ffecom_modify (tree newtype, tree lhs, tree rhs);
void ffecom_save_tree_forever (tree t);
-#endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */
void ffecom_file (const char *name);
void ffecom_notify_init_storage (ffestorag st);
void ffecom_notify_init_symbol (ffesymbol s);
void ffecom_notify_primary_entry (ffesymbol fn);
FILE *ffecom_open_include (char *name, ffewhereLine l, ffewhereColumn c);
-#if FFECOM_targetCURRENT == FFECOM_targetGCC
void ffecom_prepare_arg_ptr_to_expr (ffebld expr);
bool ffecom_prepare_end (void);
void ffecom_prepare_expr_ (ffebld expr, ffebld dest);
void ffecom_start_compstmt (void);
tree ffecom_start_decl (tree decl, bool is_init);
void ffecom_sym_commit (ffesymbol s);
-#endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */
ffesymbol ffecom_sym_end_transition (ffesymbol s);
ffesymbol ffecom_sym_exec_transition (ffesymbol s);
ffesymbol ffecom_sym_learned (ffesymbol s);
-#if FFECOM_targetCURRENT == FFECOM_targetGCC
void ffecom_sym_retract (ffesymbol s);
tree ffecom_temp_label (void);
tree ffecom_truth_value (tree expr);
tree ffecom_truth_value_invert (tree expr);
tree ffecom_type_expr (ffebld expr);
tree ffecom_which_entrypoint_decl (void);
-
-/* These need to be in the front end with exactly these interfaces,
- as they're called by the back end. */
-
-int mark_addressable (tree expr);
-#endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */
+void ffe_parse_file (int);
/* Define macros. */
-#if FFECOM_targetCURRENT == FFECOM_targetFFE
-#define ffecom_expr(e) (e)
-#define ffecom_init_0()
-#define ffecom_init_2()
-#define ffecom_label_kind() FFEINFO_kindtypeINTEGERDEFAULT
-#define ffecom_pointer_kind() FFEINFO_kindtypeINTEGERDEFAULT
-#define ffecom_ptr_to_expr(e) (e)
-#define ffecom_sym_commit(s)
-#define ffecom_sym_retract(s)
-#endif /* FFECOM_targetCURRENT == FFECOM_targetFFE */
-
-#if FFECOM_targetCURRENT == FFECOM_targetGCC
#define ffecom_f2c_typecode(bt,kt) ffecom_f2c_typecode_[(bt)][(kt)]
#define ffecom_label_kind() ffecom_label_kind_
#define ffecom_pointer_kind() ffecom_pointer_kind_
#define ffecom_prepare_expr(e) ffecom_prepare_expr_ ((e), NULL)
-#endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */
#define ffecom_init_1()
#define ffecom_init_3()
/* End of #include file. */
-#endif
+#endif /* ! GCC_F_COM_H */