-typedef struct _jdep {
-#ifdef ONLY_INT_FIELDS
- int kind : 8; /* Type of patch */
-#else
- enum jdep_code kind : 8;
-#endif
-
- int flag0 : 1; /* Some flags */
- tree decl; /* Tied decl/or WFL */
- tree solv; /* What to solve */
- tree wfl; /* Where thing to resolve where found */
- tree misc; /* Miscellaneous info (optional). */
- tree *patch; /* Address of a location to patch */
- struct _jdep *next; /* Linked list */
-} jdep;
-
-
-#define JDEP_DECL(J) ((J)->decl)
-#define JDEP_DECL_WFL(J) ((J)->decl)
-#define JDEP_KIND(J) ((J)->kind)
-#define JDEP_SOLV(J) ((J)->solv)
-#define JDEP_WFL(J) ((J)->wfl)
-#define JDEP_MISC(J) ((J)->misc)
-#define JDEP_CLASS(J) ((J)->class)
-#define JDEP_APPLY_PATCH(J,P) (*(J)->patch = (P))
-#define JDEP_GET_PATCH(J) ((J)->patch)
-#define JDEP_CHAIN(J) ((J)->next)
-#define JDEP_TO_RESOLVE(J) ((J)->solv)
-#define JDEP_RESOLVED_DECL(J) ((J)->solv)
-#define JDEP_RESOLVED(J, D) ((J)->solv = D)
-#define JDEP_RESOLVED_P(J) \
- (!(J)->solv || TREE_CODE ((J)->solv) != POINTER_TYPE)
-
-typedef struct _jdeplist {
- jdep *first;
- jdep *last;
- struct _jdeplist *next;
-} jdeplist;
-
-#endif /* JC1_LITE */
-
-#define CLASSD_FIRST(CD) ((CD)->first)
-#define CLASSD_LAST(CD) ((CD)->last)
-#define CLASSD_CHAIN(CD) ((CD)->next)
-
-#define JDEP_INSERT(L,J) \
- { \
- if (!(L)->first) \
- (L)->last = (L)->first = (J); \
- else \
- { \
- JDEP_CHAIN ((L)->last) = (J); \
- (L)->last = (J); \
- } \
- }
-
-/* if TYPE can't be resolved, obtain something suitable for its
- resolution (TYPE is saved in SAVE before being changed). and set
- CHAIN to 1. Otherwise, type is set to something usable. CHAIN is
- usually used to determine that a new DEP must be installed on TYPE.
- Note that when compiling java.lang.Object, references to Object are
- java.lang.Object. */
-#define SET_TYPE_FOR_RESOLUTION(TYPE, SAVE, CHAIN) \
- { \
- tree returned_type; \
- (CHAIN) = 0; \
- if (TREE_TYPE (ctxp->current_parsed_class) == object_type_node \
- && TREE_CODE (TYPE) == EXPR_WITH_FILE_LOCATION \
- && EXPR_WFL_NODE (TYPE) == unqualified_object_id_node) \
- (TYPE) = object_type_node; \
- else \
- { \
- if (unresolved_type_p (type, &returned_type)) \
- { \
- if (returned_type) \
- (TYPE) = returned_type; \
- else \
- { \
- (SAVE) = (TYPE); \
- (TYPE) = obtain_incomplete_type (TYPE); \
- CHAIN = 1; \
- } \
- } \
- } \
- }
-/* Promote a type if it won't be registered as a patch */
-#define PROMOTE_RECORD_IF_COMPLETE(TYPE, IS_INCOMPLETE) \
- { \
- if (!(IS_INCOMPLETE) && TREE_CODE (TYPE) == RECORD_TYPE) \
- (TYPE) = promote_type (TYPE); \
- }
-
-/* Insert a DECL in the current block */
-#define BLOCK_CHAIN_DECL(NODE) \
- { \
- TREE_CHAIN ((NODE)) = \
- BLOCK_EXPR_DECLS (GET_CURRENT_BLOCK (current_function_decl)); \
- BLOCK_EXPR_DECLS (GET_CURRENT_BLOCK (current_function_decl)) = (NODE); \
- }
-
-/* Return the current block, either found in the body of the currently
- declared function or in the current static block being defined. */
-#define GET_CURRENT_BLOCK(F) ((F) ? DECL_FUNCTION_BODY ((F)) : \
- current_static_block)
-
-/* For an artificial BLOCK (created to house a local variable declaration not
- at the start of an existing block), the parent block; otherwise NULL. */
-#define BLOCK_EXPR_ORIGIN(NODE) BLOCK_ABSTRACT_ORIGIN(NODE)
-
-/* Merge an other line to the source line number of a decl. Used to
- remember function's end. */
-#define DECL_SOURCE_LINE_MERGE(DECL,NO) DECL_SOURCE_LINE(DECL) |= (NO << 16)
-
-/* Retrieve those two info separately. */
-#define DECL_SOURCE_LINE_FIRST(DECL) (DECL_SOURCE_LINE(DECL) & 0x0000ffff)
-#define DECL_SOURCE_LINE_LAST(DECL) (DECL_SOURCE_LINE(DECL) >> 16)
-
-/* Retrieve line/column from a WFL. */
-#define EXPR_WFL_GET_LINECOL(V,LINE,COL) \
- { \
- (LINE) = (V) >> 12; \
- (COL) = (V) & 0xfff; \
- }
-/* Add X to the column number information */
-#define EXPR_WFL_ADD_COL(V, X) \
- (V) = (((V) & 0xfffff000) | ((((V) & 0xfff) + (X)) & 0xfff))
-
-/* Build a WFL for expression nodes */
-#define BUILD_EXPR_WFL(NODE, WFL) \
- build_expr_wfl ((NODE), input_filename, EXPR_WFL_LINENO ((WFL)), \
- EXPR_WFL_COLNO ((WFL)))
-
-#define EXPR_WFL_QUALIFICATION(WFL) TREE_OPERAND ((WFL), 2)
-#define QUAL_WFL(NODE) TREE_PURPOSE (NODE)
-#define QUAL_RESOLUTION(NODE) TREE_VALUE (NODE)
-#define QUAL_DECL_TYPE(NODE) GET_SKIP_TYPE (NODE)
-
-#define GET_SKIP_TYPE(NODE) \
- (TREE_CODE (TREE_TYPE (NODE)) == POINTER_TYPE ? \
- TREE_TYPE (TREE_TYPE (NODE)): TREE_TYPE (NODE))
-
-/* Handy macros for the walk operation */
-#define COMPLETE_CHECK_OP(NODE, N) \
-{ \
- TREE_OPERAND ((NODE), (N)) = \
- java_complete_tree (TREE_OPERAND ((NODE), (N))); \
- if (TREE_OPERAND ((NODE), (N)) == error_mark_node) \
- return error_mark_node; \
-}
-#define COMPLETE_CHECK_OP_0(NODE) COMPLETE_CHECK_OP(NODE, 0)
-#define COMPLETE_CHECK_OP_1(NODE) COMPLETE_CHECK_OP(NODE, 1)
-#define COMPLETE_CHECK_OP_2(NODE) COMPLETE_CHECK_OP(NODE, 2)
-
-/* Building invocations: append(ARG) and StringBuffer(ARG) */
-#define BUILD_APPEND(ARG) \
- ((JSTRING_TYPE_P (TREE_TYPE (ARG)) || JPRIMITIVE_TYPE_P (TREE_TYPE (ARG))) \
- ? build_method_invocation (wfl_append, \
- ARG ? build_tree_list (NULL, (ARG)) : NULL_TREE)\
- : build_method_invocation (wfl_append, \
- ARG ? build_tree_list (NULL, \
- build1 (CONVERT_EXPR, \
- object_type_node,\
- (ARG))) \
- : NULL_TREE))
-#define BUILD_STRING_BUFFER(ARG) \
- build_new_invocation (wfl_string_buffer, \
- (ARG ? build_tree_list (NULL, (ARG)) : NULL_TREE))
-
-/* For exception handling, build diverse function calls */
-#define BUILD_ASSIGN_EXCEPTION_INFO(WHERE, TO) \
- { \
- (WHERE) = build (MODIFY_EXPR, void_type_node, (TO), \
- soft_exceptioninfo_call_node); \
- TREE_SIDE_EFFECTS (WHERE) = 1; \
- }
-
-#define BUILD_THROW(WHERE, WHAT) \
- { \
- (WHERE) = build (CALL_EXPR, void_type_node, \
- build_address_of (throw_node[exceptions_via_longjmp ? 1 : 0]), \
- build_tree_list (NULL_TREE, (WHAT)), NULL_TREE); \
- TREE_SIDE_EFFECTS ((WHERE)) = 1; \
- }
-
-/* Set wfl_operator for the most accurate error location */
-#define SET_WFL_OPERATOR(WHICH, NODE, WFL) \
- EXPR_WFL_LINECOL (WHICH) = \
- (TREE_CODE (WFL) == EXPR_WITH_FILE_LOCATION ? \
- EXPR_WFL_LINECOL (WFL) : EXPR_WFL_LINECOL (NODE))
-
-#define PATCH_METHOD_RETURN_ERROR() \
- { \
- if (ret_decl) \
- *ret_decl = NULL_TREE; \
- return error_mark_node; \
- }
-
-/* Convenient macro to check. Assumes that CLASS is a CLASS_DECL. */
-#define CHECK_METHODS(CLASS) \
- { \
- if (CLASS_INTERFACE ((CLASS))) \
- java_check_abstract_methods ((CLASS)); \
- else \
- java_check_regular_methods ((CLASS)); \
- }
-
-/* Using and reseting the @deprecated tag flag */
-#define CHECK_DEPRECATED(DECL) \
- { \
- if (ctxp->deprecated) \
- DECL_DEPRECATED (DECL) = 1; \
- ctxp->deprecated = 0; \
- }
-
-/* Register an import */
-#define REGISTER_IMPORT(WHOLE, NAME) \
-{ \
- IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P ((NAME)) = 1; \
- node = build_tree_list ((WHOLE), (NAME)); \
- TREE_CHAIN (node) = ctxp->import_list; \
- ctxp->import_list = node; \
-}
-
-/* Safe check that DECL is <clinit> */
-#define IS_CLINIT(DECL) \
- (DECL != NULL_TREE && DECL_NAME (DECL) == clinit_identifier_node)
-
-/* Macro to access the osb (opening square bracket) count */
-#define CURRENT_OSB(C) (C)->osb_number [(C)->osb_depth]
-
-/* Macro for the xreferencer */
-#define DECL_END_SOURCE_LINE(DECL) DECL_FRAME_SIZE (DECL)
-#define DECL_INHERITED_SOURCE_LINE(DECL) DECL_FIELD_SIZE (DECL)
-
-/* Parser context data structure. */
-struct parser_ctxt {
-
- char *filename; /* Current filename */
- FILE *finput; /* Current file input stream */
- struct parser_ctxt *next;
-
- struct java_line *p_line, *c_line; /* Previous and current line */
- java_lc elc; /* Error's line column info */
- unicode_t unget_utf8_value; /* An unget utf8 value */
- int ccb_indent; /* Keep track of {} indent, lexer */
- int first_ccb_indent1; /* First { at ident level 1 */
- int last_ccb_indent1; /* Last } at ident level 1 */
- int parser_ccb_indent; /* Keep track of {} indent, parser */
- int osb_depth; /* Current depth of [ in an expression */
- int osb_limit; /* Limit of this depth */
- int *osb_number; /* Keep track of ['s */
- int minus_seen; /* Integral literal overflow */
- int lineno; /* Current lineno */
- int java_error_flag; /* Report error when true */
- int deprecated; /* @deprecated tag seen */
-
- /* This section is defined only if we compile jc1 */
-#ifndef JC1_LITE
- tree modifier_ctx [11]; /* WFL of modifiers */
- tree current_class; /* Current class */
- tree current_function_decl; /* Current function decl, save/restore */
-
- struct JCF *current_jcf; /* CU jcf */
-
- int prevent_ese; /* Prevent expression statement error */
- int class_err; /* Flag to report certain errors */
-
- int formal_parameter_number; /* Number of parameters found */
- int interface_number; /* # itfs declared to extend an itf def */
-
- tree package; /* Defined package ID */
-
- /* Those tow list are saved accross file traversal */
- tree incomplete_class; /* List of non-complete classes */
- tree gclass_list; /* All classes seen from source code */
-
- /* These two lists won't survive file traversal */
- tree class_list; /* List of classes in a CU */
- jdeplist *classd_list; /* Classe dependencies in a CU */
-
- tree current_parsed_class; /* Class currently parsed */
- tree current_parsed_class_un; /* Curr. parsed class unqualified name */
-
- tree non_static_initialized; /* List of non static initialized fields */
- tree static_initialized; /* List of static non final initialized */
-
- tree import_list; /* List of import */
- tree import_demand_list; /* List of import on demand */
-
- tree current_loop; /* List of the currently nested
- loops/switches */
- tree current_labeled_block; /* List of currently nested
- labeled blocks. */
-
- int pending_block; /* Pending block to close */
-
- int explicit_constructor_p; /* True when processing an explicit
- constructor. This flag is used to trap
- illegal argument usage during an
- explicit constructor invocation. */
-#endif /* JC1_LITE */
-};
-
-#ifndef JC1_LITE
-void safe_layout_class PROTO ((tree));
-void java_complete_class PROTO ((void));
-void java_check_circular_reference PROTO ((void));
-void java_fix_constructors PROTO ((void));
-void java_check_final PROTO ((void));
-void java_layout_classes PROTO ((void));
-tree java_method_add_stmt PROTO ((tree, tree));
-void java_expand_switch PROTO ((tree));
-int java_report_errors PROTO ((void));
-extern tree do_resolve_class PROTO ((tree, tree, tree));
-#endif
-char *java_get_line_col PROTO ((char *, int, int));
-extern void reset_report PROTO ((void));