25 #include "pips_config.h"
42 #include "resources.h"
275 pips_debug(1,
"Parser error detected in function \"%s\".\n", func);
281 pips_debug(4,
"Reset current module entity %s\n", mod_name);
342 pips_user_warning(
"\nRecovery from C parser failure not (fully) implemented yet.\n"
343 "C parser is likely to fail later if re-used.\n");
389 for(
char * c = nln; *c !=
'\0'; c++)
404 hash_put(label_to_new_label, (
char *) l, (
char *) nl);
546 bool is_compilation_unit_parser)
555 string input_file_name =
561 if (is_compilation_unit_parser) {
668 printf(
"\nList of callees:\n");
688 if (is_compilation_unit_parser)
functional make_functional(list a1, type a2)
parameter copy_parameter(parameter p)
PARAMETER.
basic make_basic_complex(intptr_t _field_)
value make_value_unknown(void)
parameter make_parameter(type a1, mode a2, dummy a3)
mode make_mode(enum mode_utype tag, void *val)
basic make_basic(enum basic_utype tag, void *val)
storage make_storage_rom(void)
basic make_basic_int(intptr_t _field_)
type make_type_void(list _field_)
bool statement_consistent_p(statement p)
variable make_variable(basic a1, list a2, list a3)
basic make_basic_logical(intptr_t _field_)
value make_value_intrinsic(void)
dummy make_dummy_unknown(void)
mode make_mode_value(void)
type make_type(enum type_utype tag, void *val)
callees make_callees(list a)
struct _newgen_struct_entity_ * entity
void error_reset_c_parser_current_user_input_file_name(void)
void set_c_parser_current_user_input_file_name(string file_name)
bool c_parser(const char *module_name)
static bool actual_c_parser(const char *module_name, string dbr_file, bool is_compilation_unit_parser)
void reset_entity_type_stack_table()
void reset_c_parser_current_input_file_name(void)
static hash_table entity_to_type_stack_table
static string c_parser_current_file_name
void set_c_parser_current_input_file_name(string file_name)
bool c_parser_error(const char *func, const char *msg)
Output a parser message error.
void parser_init_keyword_typedef_table()
string compilation_unit_name
cproto-generated files
void reset_c_parser_current_user_input_file_name(void)
stack get_from_entity_type_stack_table(entity key)
void error_reset_c_parser_current_input_file_name(void)
static string c_parser_current_user_input_file_name
static bool substitute_statement_label(statement s, hash_table l_to_nl)
bool compilation_unit_parser_is_running_p
To pass down the information to functions used by the syntactical analyzer.
void init_entity_type_storage_table()
void make_predefined_C_entities(string compilation_unit_name)
void remove_entity_type_stack(entity e)
void put_to_entity_type_stack_table(entity key, stack value)
list removable_extern_entities
int loop_counter
Global counter.
string get_c_parser_current_user_input_file_name()
void remove_entity_type_stacks(list el)
bool compilation_unit_parser(const char *module_name)
string get_c_parser_current_input_file_name()
statement ModuleStatement
static void FixCInternalLabels(statement s)
To avoid label name conflicts, the parser uses a special character that cannot appear in a C label.
#define c_parser_context_domain
newgen_qualifier_domain_defined
void reset_expression_comment(void)
we don't want an expression comment with new lines, it is disgracefull
void init_c_parser_scope_stack(void)
#define get_label_prefix()
The labels in C have function scope...
void set_current_C_line_number(void)
void reset_c_parser_scope_stack(void)
void reset_declaration_counter(void)
int get_current_C_line_number(void)
void init_C_comment(void)
void reset_current_C_line_number(void)
void reset_C_comment(bool)
reset and reset_error should be handled differently
void error_reset_current_C_line_number(void)
void force_reset_c_parser_scope_stack(void)
To be used by an error handler.
void MakeTopLevelEntity(void)
void FixCReturnStatements(statement)
When return statements have been encountered, each of them has been replaced by a goto to a unique re...
stack SwitchControllerStack
bool check_declaration_uniqueness_p(statement)
This is designed for standard C functions, not for compilation units.
void reset_preprocessor_line_analysis(void)
void ResetCurrentCompilationUnitEntity(bool)
void RemoveFromExterns(entity)
void Reset_C_ReturnStatement(void)
The return statement must be reset when it is used by the parser to add the return statement to the f...
stack SwitchGotoStack
list of labeled statements of the current module
stack BlockStack
statement.c
void reset_current_dummy_parameter_number(void)
void MakeCurrentCompilationUnitEntity(const char *)
A compilation unit is also considered as a module.
void CleanLocalEntities(entity function)
Fortran version.
string compilation_unit_of_module(const char *)
The output is undefined if the module is referenced but not defined in the workspace,...
bool compilation_unit_p(const char *module_name)
The names of PIPS entities carry information about their nature.
const char * module_name(const char *s)
Return the module part of an entity name.
FILE * safe_fopen(const char *filename, const char *what)
int safe_fclose(FILE *stream, const char *filename)
#define gen_context_recurse(start, ctxt, domain_number, flt, rwt)
entity get_current_module_entity(void)
Get the entity of the current module.
void gen_null2(__attribute__((unused)) void *u1, __attribute__((unused)) void *u2)
idem with 2 args, to please overpeaky compiler checks
#define ENDP(l)
Test if a list is empty.
#define list_undefined_p(c)
Return if a list is undefined.
#define NIL
The empty list (nil in Lisp)
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
void gen_free_list(list l)
free the spine of the list
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
#define list_undefined
Undefined list definition :-)
string db_get_memory_resource(const char *rname, const char *oname, bool pure)
Return the pointer to the resource, whatever it is.
#define DB_PUT_MEMORY_RESOURCE(res_name, own_name, res_val)
conform to old interface.
list statement_to_labels(statement)
Look for non-empty labels appearing directly or indirectly and allocate a label list.
hash_table hash_table_make(hash_key_type key_type, size_t size)
void * hash_get(const hash_table htp, const void *key)
this function retrieves in the hash table pointed to by htp the couple whose key is equal to key.
void hash_put(hash_table htp, const void *key, const void *val)
This functions stores a couple (key,val) in the hash table pointed to by htp.
void hash_table_free(hash_table htp)
this function deletes a hash table that is no longer useful.
void * hash_del(hash_table htp, const void *key)
this function removes from the hash table pointed to by htp the couple whose key is equal to key.
void set_prettyprint_language_tag(enum language_utype lang)
set the prettyprint language from a language_utype argument
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
#define pips_user_warning
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
#define pips_internal_error
string concatenate(const char *,...)
Return the concatenation of the given strings.
#define HASH_MAP(k, v, code, ht)
#define HASH_UNDEFINED_VALUE
value returned by hash_get() when the key is not found; could also be called HASH_KEY_NOT_FOUND,...
#define hash_table_undefined_p(h)
#define hash_table_undefined
Value of an undefined hash_table.
struct __hash_table * hash_table
Define hash_table structure which is hidden.
bool stack_empty_p(const stack)
void stack_free(stack *)
type, bucket_size, policy
stack stack_make(int, int, int)
allocation
struct __stack_head * stack
STACK MANAGEMENT – headers.
#define stack_undefined_p(s)
#define string_undefined_p(s)
#define db_get_file_resource
string db_get_current_workspace_directory(void)
int user_line_number
To be exported to the parser for error messages related to the user file.
#define BUILTIN_VA_END
vararg stuff.
#define DEFAULT_LOGICAL_TYPE_SIZE
#define DEFAULT_INTEGER_TYPE_SIZE
#define DEFAULT_COMPLEX_TYPE_SIZE
const char * entity_user_name(entity e)
Since entity_local_name may contain PIPS special characters such as prefixes (label,...
entity FindOrCreateEntity(const char *package, const char *local_name)
Problem: A functional global entity may be referenced without parenthesis or CALL keyword in a functi...
void print_entities(list l)
bool label_name_conflict_with_labels(const char *n, list ll)
bool entity_empty_label_p(entity e)
const char * entity_module_name(entity e)
See comments about module_name().
const char * label_local_name(entity e)
END_EOLE.
void statement_normalize_subscripts(statement s)
To be used for module statements.
hash_table make_keyword_typedef_table(int)
hash_table keyword_typedef_table
Because of typedefs, the C lexers need help to decide if a character string such as toto is a type na...
void error_reset_current_module_entity(void)
To be called by an error management routine only.
#define value_undefined_p(x)
#define entity_storage(x)
#define statement_domain
newgen_sizeofexpression_domain_defined
#define code_declarations(x)
#define statement_label(x)
#define type_undefined_p(x)
#define entity_undefined_p(x)
#define basic_domain
newgen_area_domain_defined
#define PARAMETER(x)
PARAMETER.
#define code_decls_text(x)
#define statement_declarations(x)
#define type_variable_p(x)
#define code_domain
newgen_cast_domain_defined
#define storage_undefined_p(x)
#define entity_domain
newgen_syntax_domain_defined
#define statement_undefined
#define entity_initial(x)
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
#define TK_BUILTIN_VA_ARG
The structure used to build lists in NewGen.