PIPS
|
Go to the source code of this file.
Macros | |
#define | SRCPATH "PIPS_SRCPATH" |
Warning! Do not modify this file that is automatically generated! More... | |
#define | CPP_PIPS_ENV "PIPS_CPP" |
pre-processor and added options from environment More... | |
#define | CPP_PIPS_OPTIONS_ENV "PIPS_CPP_FLAGS" |
#define | FPP_PIPS_ENV "PIPS_FPP" |
#define | FPP_PIPS_OPTIONS_ENV "PIPS_FPP_FLAGS" |
#define | CPP_CPP "cpp -C -std=c99" |
default preprocessor and basic options -C: do not discard comments... More... | |
#define | CPP_CPPFLAGS " -D__PIPS__ -D__HPFC__ -U__GNUC__ " |
#define CPP_CPPFLAGS " -P -D__PIPS__ -D__HPFC__ " More... | |
#define | FPP_CPP "gfortran -E" |
The preprocessor to use for Fortran files. More... | |
#define | FPP_CPPFLAGS " -P -D__PIPS__ -D__HPFC__ " |
The default preprocessor flags to use with Fortran files. More... | |
#define | DEFAULT_PIPS_FLINT "gfortran -Wall" |
#define | DEFAULT_PIPS_CC "gcc -std=c99 -D__PIPS__ -D__HPFC__ -U__GNUC__ " |
See necessary definitions in pipsmake-rc.tex. More... | |
#define | DEFAULT_PIPS_CC_FLAGS " -Wall " |
#define | csplit_parser_warning(...) |
Typedefs | |
typedef size_t | yy_size_t |
symbols exported by lex / yacc More... | |
Functions | |
void | MakeTypedefStack () |
Define some functions from the .l or .y since cproto cannot dig them out: More... | |
void | ResetTypedefStack () |
int | splitc_lex () |
int | splitc_lex_destroy () |
int | splitc_parse () |
void | splitc_error (const char *) |
void | pips_get_workspace_list (gen_array_t) |
cproto-generated files More... | |
void | pips_get_fortran_list (gen_array_t) |
Select the true file with names ending in ".[fF]" and return a sorted arg list: More... | |
string | hpfc_generate_path_name_of_file_name (const char *) |
Return the path of an HPFC file name relative to the current PIPS directory. More... | |
int | hpfc_get_file_list (gen_array_t, char **) |
string | pips_change_directory (const char *) |
Change to the given directory if it exists and return a canonical name. More... | |
void | pips_srcpath_set (string) |
Set the PIPS source path. More... | |
string | pips_srcpath_append (string) |
returns an allocated pointer to the old value More... | |
void | init_processed_include_cache (void) |
void | close_processed_include_cache (void) |
bool | filter_file (string) |
string | preprocessed_to_user_file (string) |
Allocate a new string containing the user file name, before preprocessing. More... | |
bool | dot_F_file_p (string) |
Test if a name ends with .F. More... | |
bool | dot_f_file_p (string) |
Test if a name ends with .f. More... | |
bool | dot_f90_file_p (string) |
Test if a name ends with .f90. More... | |
bool | dot_f95_file_p (string) |
Test if a name ends with .f95. More... | |
bool | dot_c_file_p (string) |
Test if a name ends with .c. More... | |
language | workspace_language (gen_array_t) |
Choose a language if all filenames in "files" have the same C or Fortran extensions. More... | |
int | find_eol_coding (string) |
Returns the newly allocated name if preprocessing succeeds. More... | |
bool | process_user_file (string) |
bool | flag_as_stub (const string) |
bool | bootstrap_stubs (const string) |
char * | fsplit (char *, char *, FILE *) |
char * | process_bang_comments_and_hollerith (FILE *, FILE *) |
processing extracted for includes... More... | |
void | init_module_name_list (void) |
void | reset_module_name_list (void) |
void | error_reset_module_name_list (void) |
No checking, to be called from a (future) error handling module. More... | |
string | get_splitc_input_file_name (void) |
void | reset_current_input_line (void) |
In file just above. More... | |
void | csplit_open_compilation_unit (string) |
Disambiguate the compilation unit base name (special character to avoid conflicts with function names and rank if same basename exists elsewhere in user files). More... | |
void | csplit_close_compilation_unit (void) |
void | copy_between_2_fd_up_to_offset (FILE *, FILE *, unsigned long long, bool) |
void | csplit_append_to_compilation_unit (int, unsigned long long) |
Copy the input file to the compilation unit between the function declarations up to the current function definition. More... | |
void | csplit_copy (const char *, string, int, int, size_t, size_t, int, bool) |
Create the module directory and file, copy the definition of the module and add the module name to the module name list. More... | |
void | keep_track_of_typedef (string) |
void | csplit_error_handler (void) |
Close open files and reset variables. More... | |
void | csplit_reset (void) |
void | csplit_close_files (string) |
void | preprocessor_init_keyword_typedef_table (void) |
string | csplit (char *, char *, FILE *) |
char * | f95split (char *, char *, FILE **) |
f95split_file.c More... | |
void | csplit_parser_warning_func (const char *, const char *, const int, const string,...) |
void | csplit_parser_error (const string) |
Redundant with splitc_error()? More... | |
void | ForceResetTypedefStack (void) |
void | init_preprocessor_scope_stack (void) |
void | reset_preprocessor_scope_stack (void) |
void | force_reset_preprocessor_scope_stack (void) |
To be used by an error handler. More... | |
void | push_new_preprocessor_scope (void) |
void | pop_preprocessor_scope (void) |
bool | preprocessor_scope_stack_empty_p (void) |
string | get_preprocessor_current_scope (void) |
string | get_preprocessor_nth_scope (int) |
int | preprocessor_scope_number (void) |
int | check_signature_balance (void) |
void | reset_csplit_line_number (void) |
Reinitialise global position numbers for a new file. More... | |
void | reset_csplit_current_beginning (void) |
This function is called at the end of any top-level C construct: More... | |
int | get_csplit_current_beginning (void) |
int | get_user_current_beginning (void) |
Get the current line number in the file to split from the user point of view (before preprocessor expansion): More... | |
size_t | get_csplit_file_offset_beginning (void) |
Get the file position in the file to split where the current function begins: More... | |
size_t | get_current_csplit_file_offset (void) |
Get the current file position in the file to split: More... | |
void | update_csplit_file_offset_information (void) |
Function called each time a token is read to trac file position information: More... | |
void | splitc_restart (FILE *) |
void | splitc_pop_buffer_state (void) |
int | splitc_get_lineno (void) |
FILE * | splitc_get_in (void) |
FILE * | splitc_get_out (void) |
int | splitc_get_leng (void) |
char * | splitc_get_text (void) |
void | splitc_set_lineno (int) |
void | splitc_set_in (FILE *) |
void | splitc_set_out (FILE *) |
int | splitc_get_debug (void) |
void | splitc_set_debug (int) |
void * | splitc_alloc (yy_size_t) |
void * | splitc_realloc (void *, yy_size_t) |
void | splitc_free (void *) |
int | splitc_wrap (void) |
Variables | |
char * | splitc_text |
FILE * | splitc_in |
string | preprocessor_current_split_file_name |
Split a C or Fortran file into as many files as modules. More... | |
string | preprocessor_current_initial_file_name |
The digestion of a user file by PIPS begins here. More... | |
char | fsplit_copyright [] |
split_file.c More... | |
char | fsplit_sccsid [] |
not lint More... | |
char * | current_include_file_path |
csplit_file.c More... | |
char * | current_file_path |
string | current_file_name |
Split a C file into one file per module (function or procedure) plus. More... | |
int | csplit_is_external |
splitc.c More... | |
int | csplit_is_function |
to know if the variable is declared inside or outside a function More... | |
string | csplit_current_function_name |
to know if this is the declaration of a function or not, to distinguish between a static variable and a static function More... | |
string | csplit_current_function_name2 |
string | csplit_definite_function_name |
string | csplit_definite_function_signature |
bool | csplit_is_static_p |
static int enum_counter = 0; More... | |
int | splitc_char |
int | splitc_nerrs |
int | splitc_leng |
lexer.c More... | |
FILE * | splitc_out |
int | splitc_lineno |
int | splitc__flex_debug |
int | csplit_line_number |
To be exported to the parser for splitting the preprocessed file. More... | |
int | user_line_number |
To be exported to the parser for error messages related to the user file. More... | |
size_t | current_csplit_file_offset |
size_t | csplit_file_offset_beginning |
enum gather_comment_state_t | gather_comment_state_machine |
Indeed it does not work since csplit_copy() is called from splitc.y when a function definition is found and thus we cannot gather the comment in it... More... | |
#define CPP_CPP "cpp -C -std=c99" |
default preprocessor and basic options -C: do not discard comments...
-P: inhibit linemakers (# 1 "file.c") -ffreestanding: ignore "stdc-predef.h"
Definition at line 52 of file preprocessor.h.
#define CPP_CPPFLAGS " -D__PIPS__ -D__HPFC__ -U__GNUC__ " |
#define CPP_CPPFLAGS " -P -D__PIPS__ -D__HPFC__ "
-U__GNUC__ seems to be still useful to avoid spoiling the libC files with too many GCC extensions:
Definition at line 57 of file preprocessor.h.
#define CPP_PIPS_ENV "PIPS_CPP" |
pre-processor and added options from environment
Definition at line 40 of file preprocessor.h.
#define CPP_PIPS_OPTIONS_ENV "PIPS_CPP_FLAGS" |
Definition at line 41 of file preprocessor.h.
#define csplit_parser_warning | ( | ... | ) |
Definition at line 81 of file preprocessor.h.
#define DEFAULT_PIPS_CC "gcc -std=c99 -D__PIPS__ -D__HPFC__ -U__GNUC__ " |
See necessary definitions in pipsmake-rc.tex.
Definition at line 74 of file preprocessor.h.
#define DEFAULT_PIPS_CC_FLAGS " -Wall " |
Definition at line 75 of file preprocessor.h.
#define DEFAULT_PIPS_FLINT "gfortran -Wall" |
Definition at line 70 of file preprocessor.h.
#define FPP_CPP "gfortran -E" |
The preprocessor to use for Fortran files.
Alternative values: "gcc -E -C" or "fpp". The issue with cpp or gcc -E is that they don't undestand Fortran and chokes on unbalanced strings in Fortran comments and so on.
Definition at line 65 of file preprocessor.h.
#define FPP_CPPFLAGS " -P -D__PIPS__ -D__HPFC__ " |
The default preprocessor flags to use with Fortran files.
Definition at line 68 of file preprocessor.h.
#define FPP_PIPS_ENV "PIPS_FPP" |
Definition at line 42 of file preprocessor.h.
#define FPP_PIPS_OPTIONS_ENV "PIPS_FPP_FLAGS" |
Definition at line 43 of file preprocessor.h.
#define SRCPATH "PIPS_SRCPATH" |
Warning! Do not modify this file that is automatically generated!
Modify src/Libs/preprocessor/preprocessor-local.h instead, to add your own modifications. header file built by cproto preprocessor-local.h Preprocessing and splitting of Fortran and C files the name of the environment variable where source files are searched for.
Definition at line 36 of file preprocessor.h.
symbols exported by lex / yacc
Definition at line 86 of file preprocessor.h.
bool bootstrap_stubs | ( | const | string | ) |
string | odule_name |
Definition at line 1344 of file source_file.c.
References DB_PUT_MEMORY_RESOURCE, db_resource_p(), make_callees(), module_name(), NIL, and pips_internal_error.
Referenced by generic_initializer().
int check_signature_balance | ( | void | ) |
pips_internal_error("More signatures freed than allocated: %d\n", imbalance);
Definition at line 524 of file splitc.c.
References number_of_signatures_built, number_of_signatures_freed, and pips_debug.
Referenced by reset_csplit_current_beginning().
void close_processed_include_cache | ( | void | ) |
pips may call this without a prior call to init_processed_include_cache under some error conditions, such as a file not found in the initializer, or a failed cpp.
Definition at line 283 of file source_file.c.
References free(), HASH_MAP, hash_table_free(), hash_table_undefined, hash_table_undefined_p, pips_assert, and processed_cache.
Referenced by check_delete_workspace(), and close_workspace().
void copy_between_2_fd_up_to_offset | ( | FILE * | , |
FILE * | , | ||
unsigned long long | , | ||
bool | |||
) |
string csplit | ( | char * | dir_name, |
char * | file_name, | ||
FILE * | out | ||
) |
In case a error occurs
The same file is opened twice for parsing, for copying the compilation unit and for copying the modules.
splitc_in_copy = safe_fopen(file_name, "r");
Do not forget to catch what could remain after the last function up to the end of file:
dir_name | ir_name |
file_name | ile_name |
out | ut |
Definition at line 641 of file csplit_file.c.
References any_exception_error, CATCH, csplit_append_to_compilation_unit(), csplit_close_files(), csplit_open_compilation_unit(), csplit_reset(), current_file_name, current_file_path, current_include_file_path, current_workspace_name, debug_off, debug_on, file_name, fprintf(), init_preprocessor_scope_stack(), MakeTypedefStack(), module_list_file, out, pips_debug, preprocessor_init_keyword_typedef_table(), safe_fopen(), splitc_in, splitc_in_append, splitc_input_file_name, splitc_parse(), string_undefined, TRY, and UNCATCH.
Referenced by pips_split_file().
void csplit_append_to_compilation_unit | ( | int | last_line, |
unsigned long long | last_offset | ||
) |
Copy the input file to the compilation unit between the function declarations up to the current function definition.
We are in the offset mode instead of line mode
Copy up to function begin
We are in the line-oreiented mode:
In some cases, e.g. two module definitions are contiguous, nothing has to be copied.
last_line | ast_line |
last_offset | ast_offset |
Definition at line 262 of file csplit_file.c.
References compilation_unit_file, copy_between_2_fd_up_to_offset(), current_input_line, ifdebug, pips_assert, pips_debug, and splitc_in_append.
Referenced by csplit(), and csplit_copy().
void csplit_close_compilation_unit | ( | void | ) |
Definition at line 183 of file csplit_file.c.
References compilation_unit_file, current_compilation_unit_file_name, current_compilation_unit_name, free(), reset_preprocessor_scope_stack(), safe_fclose(), and string_undefined.
Referenced by csplit_close_files().
void csplit_close_files | ( | string | file_name | ) |
No close, because this file descriptor is managed by the caller.
file_name | ile_name |
Definition at line 547 of file csplit_file.c.
References csplit_close_compilation_unit(), current_file_path, current_include_file_path, file_name, ForceResetTypedefStack(), free(), module_list_file, safe_fclose(), splitc_in, splitc_in_append, splitc_input_file_name, and string_undefined.
Referenced by csplit(), and csplit_parser_error().
void csplit_copy | ( | const char * | module_name, |
string | signature, | ||
int | first_line, | ||
int | last_line, | ||
size_t | first_offset, | ||
size_t | last_offset, | ||
int | user_first_line, | ||
bool | is_static_p | ||
) |
Create the module directory and file, copy the definition of the module and add the module name to the module name list.
The compilation unit name used for static functions is retrieved from a global variable set by csplit_open_compilation_unit(), current_compilation_unit_name.
If first_offset and last_offset are not both 0, the module is found in the source file between these file offset instead of between lines first_line and int last_line.
Unambiguous, unless the user has given the same name to two functions.
MODULE_SEP_STRING,
string unambiguous_module_name = module_name;
Keep track of the existence of a C main function in the workspace
pips_assert("First line is strictly positive and lesser than last_line", first_line>0 && first_line<last_line);
Step 1: Define an unambiguous name and open the file if possible
Concatenate the unambigous compilation unit name and the module name
Note: the same static function may be declared twice in the compilation unit because the user is mistaken.
pips_internal_error("Not implemented yet.");
FILE_SEP_STRING,
The name should be unique in the workspace, but the user may have provided several module with the same name
Open the module code file for writing as the mfd FILE descriptor:
Such a module already exists
Possible access right problem?
Step 2: Copy the file source from the end of the last function definition up to the begin of the current one into the compilation unit to get variable and type declarations, etc.
Only bother in line-oriented mode
Step 3: Copy the function declaration in its module file, starting with its line number in the original file.
skip is up to the C preprocessor choice for local files: foo.c or ./foo.c.
It does not really matter because the ambiguity is taken care of by the PIPS C parser.
Begin and end are specified as line numbers:
Begin and end are specified as file offsets. First seek at the begin of the function:
Copy up to the function end:
Do not include trailing spaces
Step 4: Copy the function definition
Fabien: you could add here anything you might want to unsplit the file later. SG: what about inline static ? why add an extern qualifier ?
check for the static qualifier
or the extern qualifier
default to extern qualifier? Not mandatory, but expected by the C parser
Step 5: Keep track of the new module
SG hook: do not keep track of module declared inside a header not very reliable in the presence of used inline function in user header, so left apart as of now
Do not free unambiguous_module_name since it is already done in reset_csplit_current_beginning()
module_name | odule_name |
signature | ignature |
first_line | irst_line |
last_line | ast_line |
first_offset | irst_offset |
last_offset | ast_offset |
user_first_line | ser_first_line |
is_static_p | s_static_p |
Definition at line 334 of file csplit_file.c.
References abort, compilation_unit_file, concatenate(), copy_between_2_fd_up_to_offset(), csplit_append_to_compilation_unit(), current_compilation_unit_name, current_include_file_path, current_input_line, current_workspace_name, fprintf(), free(), get_bool_property(), ifdebug, MAIN_FILE_NAMES, module_list_file, module_name(), path_header_p(), pips_assert, pips_debug, pips_user_error, preprocessor_current_initial_file_name, safe_fclose(), same_string_p, splitc_in_append, splitc_input_file_name, strdup(), and string_undefined_p.
void csplit_error_handler | ( | void | ) |
Close open files and reset variables.
Reset keyword table
Definition at line 531 of file csplit_file.c.
References free_keyword_typedef_table(), reset_csplit_line_number(), and reset_current_input_line().
Referenced by csplit_parser_error().
void csplit_open_compilation_unit | ( | string | input_file_name | ) |
Disambiguate the compilation unit base name (special character to avoid conflicts with function names and rank if same basename exists elsewhere in user files).
Do not create the corresponding directory and within it the compilation unit file.
Initialize compilation_unit_file by opening this last file.
Set the current_compilation_unit_file_name.
string compilation_unit_name = string_undefined;
string compilation_unit_file_name = string_undefined;
Step 1: Define the compilation unit name from the input file name.
Loop with a counter until the open is OK. Two or more files with the same local names may be imported from different directories.
This does not work because this file is later moved in the proper directory.
Loop over counter not implemented.
Does this current compilation unit already exist?
Keep track of the new compilation unit as a "module" stored in a file
input_file_name | nput_file_name |
Definition at line 116 of file csplit_file.c.
References compilation_unit_file, concatenate(), current_compilation_unit_file_name, current_compilation_unit_name, current_workspace_name, FILE_SEP_STRING, fprintf(), free(), module_list_file, pips_assert, pips_basename(), pips_debug, pips_user_error, safe_fopen(), strdup(), string_undefined, and string_undefined_p.
Referenced by csplit().
void csplit_parser_error | ( | const | string | ) |
Redundant with splitc_error()?
Should add the current line number of the lexer
csplit_parser_warning("Corrupted or non-supported C constructs.\n"
"Make sure your code is compiled by gcc -stc=c99 first, "
"and/or set proper PIPS option, "
"CHECK_FORTRAN_SYNTAX_BEFORE_RUNNING_PIPS or "
"CHECK_C_SYNTAX_BEFORE_RUNNING_PIPS.\n");
Reset all static variables
Close all open files: at least three...
string | sg |
Definition at line 188 of file splitc.c.
References csplit_close_files(), csplit_error_handler(), csplit_parser_warning, current_file_name, pips_user_error, and splitc_lex_destroy().
void csplit_parser_warning_func | ( | const char * | pips_func, |
const char * | pips_file, | ||
const int | pips_line, | ||
const | string, | ||
... | |||
) |
pips_func | ips_func |
pips_file | ips_file |
pips_line | ips_line |
string | ormat |
Definition at line 174 of file splitc.c.
References csplit_parser_warning_alist().
void csplit_reset | ( | void | ) |
Reset keyword table
Definition at line 539 of file csplit_file.c.
References free_keyword_typedef_table(), reset_csplit_line_number(), and reset_current_input_line().
Referenced by csplit().
Test if a name ends with .c.
name | ame |
Definition at line 661 of file source_file.c.
References find_suffix().
Referenced by get_new_user_file(), pips_split_file(), process_user_file(), and workspace_language().
Test if a name ends with .f90.
name | ame |
Definition at line 649 of file source_file.c.
References find_suffix().
Referenced by create_workspace(), get_new_user_file(), pips_split_file(), process_user_file(), and workspace_language().
Test if a name ends with .f95.
name | ame |
Definition at line 655 of file source_file.c.
References find_suffix().
Referenced by create_workspace(), get_new_user_file(), pips_split_file(), process_user_file(), and workspace_language().
Test if a name ends with .F.
name | ame |
Definition at line 637 of file source_file.c.
References find_suffix().
Referenced by pips_split_file(), process_thru_cpp(), process_user_file(), and workspace_language().
Test if a name ends with .f.
name | ame |
Definition at line 643 of file source_file.c.
References find_suffix().
Referenced by get_new_user_file(), pips_split_file(), process_user_file(), and workspace_language().
void error_reset_module_name_list | ( | void | ) |
No checking, to be called from a (future) error handling module.
Definition at line 74 of file csplit_file.c.
References list_undefined_p, module_name_list, and reset_module_name_list().
char* f95split | ( | char * | dir_name, |
char * | file_name, | ||
FILE ** | out | ||
) |
printf(stderr, "\n-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n" "+ Starting gfc parser in PIPS. -\n" "-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n" );
string source_filename = strdup( concatenate( dir, "/", db_get_file_resource( DBR_SOURCE_FILE, module, true ), NULL ) );
dump_parse_tree is the gfc pass that have been hacked to call the gfc2pips stuff
we may have non-standard file extensions (e.g. .f_initial) and gfortran will not be able to know what it is so we force the language input
I don't know what the following stuff is ...
-fcray-pointer",
This debug_off() occurs too late since pipsdbm has been called before. Initially, the parser was designed to parse more than one subroutine/function/program at a time.
dir_name | ir_name |
file_name | ile_name |
out | ut |
Definition at line 56 of file f95split_file.c.
References debug_off, debug_on, entity_domain, exit, EXIT_SUCCESS, file_name, fprintf(), free(), gen_read_tabulated(), gen_write_tabulated(), get_resource_file_name(), gfc2pips_args(), ifdebug, out, pips_debug, pips_user_error, safe_fclose(), and safe_fopen().
Referenced by pips_split_file().
directory is set for finding includes.
mod_name | od_name |
Definition at line 501 of file source_file.c.
References concatenate(), db_build_file_resource_name(), db_get_current_workspace_directory(), db_get_memory_resource(), DB_PUT_NEW_FILE_RESOURCE, free(), pips_dirname(), pips_process_file(), pips_user_warning, safe_unlink(), strdup(), and user_file_directory.
Returns the newly allocated name if preprocessing succeeds.
Returns NULL if preprocessing fails.
name | ame |
Definition at line 721 of file source_file.c.
References f(), safe_fclose(), and safe_fopen().
Referenced by process_thru_C_pp().
bool flag_as_stub | ( | const | string | ) |
string | odule_name |
Definition at line 1334 of file source_file.c.
References callees_callees, CONS, db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, db_resource_p(), module_name(), pips_internal_error, strdup(), and STRING.
Referenced by generic_initializer().
void force_reset_preprocessor_scope_stack | ( | void | ) |
To be used by an error handler.
Definition at line 297 of file splitc.c.
References c_preprocessor_scope_number, c_preprocessor_scope_stack, SCOPE_UNDEFINED, stack_free(), and stack_undefined.
void ForceResetTypedefStack | ( | void | ) |
Definition at line 259 of file splitc.c.
References stack_free(), stack_undefined, and TypedefStack.
Referenced by csplit_close_files().
char* fsplit | ( | char * | dir_name, |
char * | file_name, | ||
FILE * | out | ||
) |
output file
1 if got card in output file, 0 otherwise
1 if got name of subprog., 0 otherwise
??? 20 -> 80 because not checked... smaller than a line is ok ? FC
MALLOC STRINGS
look for a temp file that doesn't correspond to an existing file
FC
if no name yet, try and find one
FC: some hack to deal with entry...
FC again
now we gave it a name!
a new module name is appended to the current line...
look for an 'end' statement
while
no lines in file, forget the file
rename the file
out?
for(;;)
dir_name | ir_name |
file_name | ile_name |
out | ut |
Definition at line 474 of file split_file.c.
Referenced by pips_split_file().
int get_csplit_current_beginning | ( | void | ) |
size_t get_csplit_file_offset_beginning | ( | void | ) |
Get the file position in the file to split where the current function begins:
Definition at line 1205 of file lexer.c.
References csplit_file_offset_beginning.
size_t get_current_csplit_file_offset | ( | void | ) |
Get the current file position in the file to split:
Definition at line 1211 of file lexer.c.
References current_csplit_file_offset.
string get_preprocessor_current_scope | ( | void | ) |
Definition at line 327 of file splitc.c.
References c_preprocessor_scope_stack, preprocessor_scope_stack_empty_p(), stack_head(), and string_undefined.
Referenced by is_c_preprocessor_keyword_typedef(), and keep_track_of_typedef().
Definition at line 339 of file splitc.c.
References c_preprocessor_scope_stack, and stack_nth().
Referenced by is_c_preprocessor_keyword_typedef().
string get_splitc_input_file_name | ( | void | ) |
Definition at line 84 of file csplit_file.c.
References splitc_input_file_name.
int get_user_current_beginning | ( | void | ) |
Get the current line number in the file to split from the user point of view (before preprocessor expansion):
Definition at line 1198 of file lexer.c.
References user_current_beginning.
string hpfc_generate_path_name_of_file_name | ( | const char * | file_name | ) |
Return the path of an HPFC file name relative to the current PIPS directory.
Can be freed by the caller.
file_name | ile_name |
Definition at line 97 of file source_file.c.
References concatenate(), db_get_current_workspace_directory(), file_name, free(), and strdup().
Referenced by notify_hpfc_file_view().
int hpfc_get_file_list | ( | gen_array_t | file_names, |
char ** | hpfc_directory_name | ||
) |
Where is the output of HPFC:
generated files start with upercases
Plain files only:
file_names | ile_names |
hpfc_directory_name | pfc_directory_name |
Definition at line 106 of file source_file.c.
References build_pgmwd, db_get_current_workspace_name(), file_exists_p(), free(), malloc(), message_assert, and safe_list_files_in_directory().
Referenced by generate_a_menu_with_HPF_output_files().
void init_module_name_list | ( | void | ) |
Definition at line 58 of file csplit_file.c.
References list_undefined_p, module_name_list, NIL, and pips_assert.
void init_preprocessor_scope_stack | ( | void | ) |
Definition at line 274 of file splitc.c.
References c_preprocessor_scope_number, c_preprocessor_scope_stack, stack_make(), and string_domain.
Referenced by csplit().
void init_processed_include_cache | ( | void | ) |
Definition at line 272 of file source_file.c.
References hash_string, hash_table_make(), hash_table_undefined_p, pips_assert, and processed_cache.
Referenced by create_workspace(), and open_workspace().
void keep_track_of_typedef | ( | string | type_name | ) |
type_name | ype_name |
Definition at line 517 of file csplit_file.c.
References concatenate(), get_preprocessor_current_scope(), hash_put(), keyword_typedef_table, pips_debug, same_string_p, strdup(), and TK_NAMED_TYPE.
void MakeTypedefStack | ( | ) |
string pips_change_directory | ( | const char * | dir | ) |
Change to the given directory if it exists and return a canonical name.
Return NULL if it does not exist, or fails
dir | ir |
Definition at line 142 of file source_file.c.
References directory_exists_p(), and get_cwd().
Referenced by end_directory_notify().
void pips_get_fortran_list | ( | gen_array_t | array | ) |
Select the true file with names ending in ".[fF]" and return a sorted arg list:
array | rray |
Definition at line 89 of file source_file.c.
References array, file_exists_p(), and list_files_in_directory().
Referenced by continue_create_workspace_notify().
void pips_get_workspace_list | ( | gen_array_t | array | ) |
cproto-generated files
cproto-generated files
(For each name, there is a name.database directory in the current directory):
array | rray |
Definition at line 74 of file source_file.c.
References array, directory_exists_p(), gen_array_item(), gen_array_nitems(), and list_files_in_directory().
Referenced by generate_workspace_menu(), open_or_create_workspace(), open_workspace_notify(), and start_delete_workspace_notify().
returns an allocated pointer to the old value
Strdup the string since it is returned and use later in many other places
pathtoadd | athtoadd |
Definition at line 177 of file source_file.c.
References concatenate(), pips_srcpath_set(), SRCPATH, and strdup().
Referenced by parse_arguments(), and step_analyse_init().
void pips_srcpath_set | ( | string | path | ) |
Set the PIPS source path.
path | is used to set the search path or to unset if path is NULL |
Strangely this environment variable is set many times in PIPS to pass some information...
path | ath |
Definition at line 167 of file source_file.c.
References SRCPATH.
Referenced by parse_arguments(), pips_srcpath_append(), pop_path(), and safe_pop_path().
void pop_preprocessor_scope | ( | void | ) |
Definition at line 316 of file splitc.c.
References c_preprocessor_scope_stack, and stack_pop().
Allocate a new string containing the user file name, before preprocessing.
No preprocessing has occured
preprocessed_user_file | reprocessed_user_file |
Definition at line 617 of file source_file.c.
References find_suffix(), strdup(), string_undefined, and user_file.
Referenced by get_new_user_file().
void preprocessor_init_keyword_typedef_table | ( | void | ) |
FI: keyword_typedef_table is also a global variable. I am trying to move towards some kind of functional wrapping around the global variable, which I would like to declare static in ri-util/static.c.
GNU predefined type(s), expecting no conflict with user named type
AM: en attendant mieux...
typedef names are added later when encoutered.
Definition at line 567 of file csplit_file.c.
References hash_put(), keyword_typedef_table, make_keyword_typedef_table(), TK_ASM, TK_AUTO, TK_BREAK, TK_BUILTIN_VA_ARG, TK_CASE, TK_CHAR, TK_COMPLEX, TK_CONST, TK_CONTINUE, TK_DEFAULT, TK_DO, TK_DOUBLE, TK_ELSE, TK_ENUM, TK_EXTERN, TK_FLOAT, TK_FOR, TK_GOTO, TK_IF, TK_INLINE, TK_INT, TK_INT128, TK_LONG, TK_NAMED_TYPE, TK_REGISTER, TK_RESTRICT, TK_RETURN, TK_SHORT, TK_SIGNED, TK_SIZEOF, TK_STATIC, TK_STRUCT, TK_SWITCH, TK_THREAD, TK_TYPEDEF, TK_UINT128, TK_UNION, TK_UNSIGNED, TK_VOID, TK_VOLATILE, and TK_WHILE.
Referenced by csplit().
int preprocessor_scope_number | ( | void | ) |
Definition at line 345 of file splitc.c.
References c_preprocessor_scope_stack, and stack_size().
Referenced by is_c_preprocessor_keyword_typedef().
bool preprocessor_scope_stack_empty_p | ( | void | ) |
Definition at line 322 of file splitc.c.
References c_preprocessor_scope_stack, and stack_empty_p().
Referenced by get_preprocessor_current_scope().
char* process_bang_comments_and_hollerith | ( | FILE * | in, |
FILE * | out | ||
) |
processing extracted for includes...
in | n |
out | ut |
Definition at line 836 of file split_file.c.
References buf, current_line_number, error, GetLine(), hollerith_and_bangcomments(), ifp, and out.
Referenced by handle_include_file().
The file is looked for in the pips source path.
Do not check the syntax in the input file: quite dangerous in case it is wrong because PIPS is not designed to work on damaged source codes. But this may be useful is the input file is a validation file or if the input file has already been checked.
If two modules have the same name, the first splitted wins and the other one is hidden by the call since fsplit gives it a zzz00n.f name Let's hope no user module is called ###???.f
The newly created module files are registered in the database The file_list allows split to communicate with this function.
a_line: "MODULE1 ... MODULEn file_name"
The list modules comes from entries that might be included in the subroutine.
For each Fortran module in the line, put the initial_file and user_file resource. In C, line should have only one entry and a C source file and a user file resources are created.
hey, that's cleaning!
Seems to be recorded as a resource, causes problems later when closing the workspace...
unlink(nfile);
file | ile |
Definition at line 1090 of file source_file.c.
References check_c_file_syntax(), check_fortran_syntax_before_pips(), concatenate(), CONS, db_build_file_resource_name(), db_get_current_workspace_directory(), db_get_memory_resource(), DB_PUT_NEW_FILE_RESOURCE, dot_c_file_p(), dot_f90_file_p(), dot_f95_file_p(), dot_F_file_p(), dot_f_file_p(), extract_last_name(), file_name, find_file_in_directories(), FOREACH, free(), gen_free_list(), gen_read(), get_bool_property(), get_resource_file_name(), NIL, pips_check_c(), pips_check_fortran(), pips_debug, pips_internal_error, pips_split_file(), pips_user_error, pips_user_warning, preprocessor_current_initial_file_name, process_thru_cpp(), safe_fclose(), safe_fopen(), safe_readline(), SRCPATH, strdup(), STRING, string_undefined, and user_log().
Referenced by add_a_file(), ask_a_missing_file(), create_workspace(), retrieve_a_missing_file_using_external_resolver(), and retrieve_a_missing_file_using_internal_resolver().
void push_new_preprocessor_scope | ( | void | ) |
Definition at line 307 of file splitc.c.
References asprintf, c_preprocessor_scope_number, c_preprocessor_scope_stack, stack_push(), and string_undefined.
void reset_csplit_current_beginning | ( | void | ) |
This function is called at the end of any top-level C construct:
Snapshot the current file position as a potential function begin:
Aggregate following spaces and comments on the sameline to the previous top-level construct:
FI: I'm not ready to abort() here...
Definition at line 1152 of file lexer.c.
References check_signature_balance(), csplit_current_beginning, csplit_current_function_name, csplit_current_function_name2, csplit_definite_function_name, csplit_definite_function_signature, csplit_file_offset_beginning, csplit_is_static_p, current_csplit_file_offset, free(), GATHER_COMMENT, gather_comment_state_machine, pips_debug, string_undefined, string_undefined_p, and user_current_beginning.
void reset_csplit_line_number | ( | void | ) |
Reinitialise global position numbers for a new file.
Definition at line 1124 of file lexer.c.
References bracket_depth, csplit_file_offset_beginning, csplit_line_number, current_csplit_file_offset, gather_comment_state_machine, PUT_IN_NEXT_TOP_LEVEL_CONSTRUCT, and user_line_number.
Referenced by csplit_error_handler(), and csplit_reset().
void reset_current_input_line | ( | void | ) |
In file just above.
Definition at line 93 of file csplit_file.c.
References current_input_line.
Referenced by csplit_error_handler(), and csplit_reset().
void reset_module_name_list | ( | void | ) |
Definition at line 65 of file csplit_file.c.
References gen_free_list(), list_undefined, list_undefined_p, module_name_list, and pips_assert.
Referenced by error_reset_module_name_list().
void reset_preprocessor_scope_stack | ( | void | ) |
Definition at line 280 of file splitc.c.
References c_preprocessor_scope_number, c_preprocessor_scope_stack, pips_user_warning, SCOPE_UNDEFINED, stack_empty_p(), stack_free(), and stack_undefined.
Referenced by csplit_close_compilation_unit().
void* splitc_alloc | ( | yy_size_t | ) |
void splitc_error | ( | const char * | ) |
void splitc_free | ( | void * | ) |
int splitc_get_debug | ( | void | ) |
FILE* splitc_get_in | ( | void | ) |
int splitc_get_leng | ( | void | ) |
int splitc_get_lineno | ( | void | ) |
FILE* splitc_get_out | ( | void | ) |
char* splitc_get_text | ( | void | ) |
int splitc_lex | ( | ) |
int splitc_lex_destroy | ( | ) |
int splitc_parse | ( | ) |
void splitc_pop_buffer_state | ( | void | ) |
void* splitc_realloc | ( | void * | , |
yy_size_t | |||
) |
void splitc_restart | ( | FILE * | ) |
void splitc_set_debug | ( | int | ) |
void splitc_set_in | ( | FILE * | ) |
void splitc_set_lineno | ( | int | ) |
void splitc_set_out | ( | FILE * | ) |
int splitc_wrap | ( | void | ) |
void update_csplit_file_offset_information | ( | void | ) |
Function called each time a token is read to trac file position information:
Definition at line 1218 of file lexer.c.
References current_csplit_file_offset, and yyleng.
language workspace_language | ( | gen_array_t | files | ) |
Choose a language if all filenames in "files" have the same C or Fortran extensions.
files | iles |
Definition at line 667 of file source_file.c.
References dot_c_file_p(), dot_f90_file_p(), dot_f95_file_p(), dot_F_file_p(), dot_f_file_p(), gen_array_item(), gen_array_nitems(), language_undefined, make_language_c(), make_language_fortran(), make_language_fortran95(), and make_language_unknown().
Referenced by add_a_file(), and create_workspace().
|
extern |
to know if this is the declaration of a function or not, to distinguish between a static variable and a static function
Shared with the lexical analyzer
Definition at line 123 of file splitc.c.
Referenced by reset_csplit_current_beginning(), and reset_csplit_current_function_name().
|
extern |
Definition at line 124 of file splitc.c.
Referenced by reset_csplit_current_beginning(), and reset_csplit_current_function_name().
|
extern |
Definition at line 125 of file splitc.c.
Referenced by reset_csplit_current_beginning().
|
extern |
Definition at line 126 of file splitc.c.
Referenced by reset_csplit_current_beginning().
|
extern |
Definition at line 1093 of file lexer.c.
Referenced by get_csplit_file_offset_beginning(), reset_csplit_current_beginning(), and reset_csplit_line_number().
|
extern |
For the moment, block scope is not considered. CurrentScope can be File, Module, File'FILE_SEP_STRING'Module or TOP-LEVEL static string CurrentScope = NULL; static string CurrentDerivedName = NULL; to remember the name of a struct and add it to the member prefix name static int CurrentMode = 0; to know the mode of the formal parameter : by value or by reference
|
extern |
|
extern |
static int enum_counter = 0;
Shared with the lexical analyzer
Definition at line 143 of file splitc.c.
Referenced by reset_csplit_current_beginning().
|
extern |
To be exported to the parser for splitting the preprocessed file.
Definition at line 1085 of file lexer.c.
Referenced by csplit_parser_warning_alist(), reset_csplit_line_number(), and update_csplit_current_beginning().
|
extern |
Definition at line 1092 of file lexer.c.
Referenced by get_current_csplit_file_offset(), reset_csplit_current_beginning(), reset_csplit_line_number(), and update_csplit_file_offset_information().
|
extern |
Split a C file into one file per module (function or procedure) plus.
dir_name | the directory name where the input file is to pick |
file_name | the C input file name to split |
out | file opened to record module and compilation unit names |
Definition at line 640 of file csplit_file.c.
Referenced by csplit(), and csplit_parser_error().
|
extern |
Definition at line 52 of file csplit_file.c.
Referenced by csplit(), and csplit_close_files().
|
extern |
Definition at line 51 of file csplit_file.c.
Referenced by csplit(), csplit_close_files(), and csplit_copy().
|
extern |
Definition at line 114 of file split_file.c.
|
extern |
not lint
Definition at line 120 of file split_file.c.
|
extern |
Indeed it does not work since csplit_copy() is called from splitc.y when a function definition is found and thus we cannot gather the comment in it...
:-(
Definition at line 1096 of file lexer.c.
Referenced by reset_csplit_current_beginning(), reset_csplit_line_number(), and update_csplit_current_beginning().
|
extern |
The digestion of a user file by PIPS begins here.
The file is searched in the SRCPATH directories.
Definition at line 1088 of file source_file.c.
Referenced by csplit_copy(), csplit_parser_warning_alist(), and process_user_file().
|
extern |
Split a C or Fortran file into as many files as modules.
Definition at line 584 of file source_file.c.
Referenced by csplit_parser_warning_alist(), and pips_split_file().
|
extern |
|
extern |
|
extern |
Definition at line 174 of file preprocessor.h.
|
extern |
lexer.c
|
extern |
|
extern |
|
extern |
|
extern |
Definition at line 178 of file preprocessor.h.
|
extern |
To be exported to the parser for error messages related to the user file.
Definition at line 1087 of file lexer.c.
Referenced by c_parser_error(), reset_csplit_line_number(), and update_csplit_current_beginning().