27 #include "pips_config.h"
46 #ifdef CPROTO_IS_PROTOTYPING
50 typedef enum {
false,
true }
bool;
52 #define list_undefined 0
53 #define DEFINE_LOCAL_STACK(a, b)
67 #include "resources.h"
93 va_copy (args_copy, *args);
102 va_copy (args_copy, *args);
112 const char * calling_function_name,
113 const char * a_message_format,
121 va_copy(acpy, *args);
183 freopen(
"/dev/null",
"w",stderr);
188 freopen(
buf,
"w",stderr);
196 freopen(
buf,
"w",stderr);
211 property p = properties_pop();
233 make_properties_stack();
239 void create(
char* workspace_name,
char ** filenames)
246 "creating another one!\n",
284 if (sinfo) sinfo =
strdup(sinfo);
289 if(sinfo) sinfo=
strdup(sinfo);
300 sinfo_size+=strlen(m)+1;
304 fprintf(stderr,
"not enough memory to hold all module names\n");
314 fprintf(stderr,
"failer to retreive current working directory\n");
324 void apply(
char * phasename,
char * target)
336 void capply(
char * phasename,
char ** targets)
350 "capply phase %s failed without setting error message",
361 if(old_current_module_name) {
362 old_current_module_name =
strdup(old_current_module_name);
369 if(old_current_module_name) {
371 free(old_current_module_name);
388 char*
show(
char * rname,
char *mname)
414 return callers_string;
429 return callees_string;
447 setenv(name,
value, 1);
495 default:
return "unknown";
516 string result = NULL;
522 PyObject *pyStubFile =
523 PyEval_CallMethod(
stub_broker,
"stub_file_for_module",
"(s)", str);
528 #if PY_MAJOR_VERSION >= 3
529 result =
strdup(PyUnicode_AsUTF8(pyStubFile));
531 result =
strdup(PyString_AsString(pyStubFile));
533 Py_XDECREF(pyStubFile);
536 fprintf(stderr,
"Callback failed !\n");
576 bool is_exec_parallel_p =
582 return is_exec_parallel_p;
589 bool exec_parallel_p)
void(* pips_log_handler)(const char *fmt, va_list *args)
USER_LOG is a function that should be called to log the current PIPS request, as soon as it is releva...
void(* pips_error_handler)(const char *, const char *, va_list *)
PROMPT_USER schould be implemented.
void set_pips_meta_informations(const char *revs, const char *date, const char *comp)
property copy_property(property p)
PROPERTY.
void free_language(language p)
void db_reset_current_module_name(void)
bool db_resource_p(const char *rname, const char *oname)
true if exists and in loaded or stored state.
string db_get_current_module_name(void)
Also used to check whether set...
bool db_set_current_module_name(const char *name)
void activate_language(language l)
Choose the right combination of activate and setproperty for a given language.
void set_exception_callbacks(exception_callback_t, exception_callback_t)
size_t gen_array_nitems(const gen_array_t a)
void gen_array_full_free(gen_array_t a)
gen_array_t gen_array_make(size_t size)
declarations...
string string_array_join(gen_array_t array, string separator)
Join a string array with a string separator.
void * gen_array_item(const gen_array_t a, size_t i)
void gen_array_append(gen_array_t a, void *what)
void gen_array_free(gen_array_t a)
bool create_workspace(gen_array_t files)
FI: should be called "initialize_workspace()"; a previous call to db_create_workspace() is useful to ...
gen_array_t get_stubs()
Get all stubs.
#define ret(why, what)
true if not a remapping for old.
const char * module_name(const char *s)
Return the module part of an entity name.
void push_pips_context(char const *file, char const *function, int line)
exception.c
void pop_pips_context(char const *file, char const *function, int line)
int safe_display(char *fname)
Display a file through $PIPS_MORE (or $PAGER) if stdout is a TTY, on stdout otherwise.
void reset_current_module_entity(void)
Reset the current module entity.
void reset_current_module_statement(void)
Reset the current module statement.
statement set_current_module_statement(statement)
Set the current module statement.
statement get_current_module_statement(void)
Get the current module statement.
entity set_current_module_entity(entity)
static.c
#define list_undefined_p(c)
Return if a list is undefined.
list gen_nreverse(list cp)
reverse a list in place
#define NIL
The empty list (nil in Lisp)
list gen_copy_seq(list l)
Copy a list structure.
void gen_free_string_list(list ls)
#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 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.
gen_array_t db_get_module_list(void)
Get an array of all the modules (functions, procedures and compilation units) of a workspace.
#define DB_PUT_MEMORY_RESOURCE(res_name, own_name, res_val)
conform to old interface.
loop statement_loop(statement)
Get the loop of a statement.
void set_internal_missing_module_resolver_handler(string(*_internal_resolver)(const char *))
bool displayable_file_p(const char *name)
rather approximated.
#define pips_user_warning
#define MAXPATHLEN
MAXPATHLEN is defined in <sys/param.h> for SunOS...
void initialize_newgen()
cproto-generated files
#define same_string_p(s1, s2)
int bool
we cannot use an enum or stdbool because we need to be compatible with newgen, thus boolean need to h...
bool workspace_exists_p(const char *)
bool db_close_workspace(bool)
bool db_create_workspace(const char *)
string db_get_current_workspace_name(void)
the function is used to check that there is some current workspace...
gen_array_t get_callers(string module)
Get all the callers of the specified module.
gen_array_t get_callees(string module)
Get all the callers of the specified module.
bool safe_make(const char *res_n, const char *module_n)
bool safe_concurrent_apply(const char *phase_n, gen_array_t modules)
bool safe_set_property(const char *propname, const char *value)
bool safe_apply(const char *phase_n, const char *module_n)
string build_view_file(const char *)
view.c
bool process_user_file(string)
language workspace_language(gen_array_t)
Choose a language if all filenames in "files" have the same C or Fortran extensions.
void set_bool_property(const char *, bool)
property get_property(const char *, bool)
void set_int_property(const char *, int)
void set_string_property(const char *, const char *)
#define property_string(x)
#define property_string_p(x)
#define property_bool_p(x)
void close_log_buffer(void)
void create(char *workspace_name, char **filenames)
create a new workspace...
char * pyps_get_stubs(void)
Returns the list of the modules called by that specific module, separated by ' '.
void push_property(const char *name, const char *value)
void display(char *rname, char *mname)
display resource rname about module mname
void capply(char *phasename, char **targets)
apply a transformation on a set of modules, concurrently
char * getenviron(char *name)
get environment variable
void set_property(const char *propname, const char *value)
DEFINE_LOCAL_STACK(properties, property)
stack of properties, so that the previous value can be reinstated when going out of a phase.
char * get_log_buffer(void)
statement find_loop_from_label(statement, entity)
hmmm...
void setenviron(char *name, char *value)
add an environment variable of a given value
void set_python_missing_module_resolver_handler(PyObject *PyObj)
static string get_stub_from_broker(string str)
void pop_property(const char *name)
char * get_module_language(string mod_name)
char * get_callees_of(char *module_name)
Returns the list of the modules called by that specific module, separated by ' '.
bool add_a_file(string file)
Add a source file to the workspace We wrap process_user_file() here with a hack to define the workspa...
static PyObject * stub_broker
void open_log_buffer(void)
bool get_loop_execution_parallel(const char *module_name, const char *loop_label)
Read execution mode for a loop.
char * get_callers_of(char *module_name)
Returns the list of the modules that call that specific module, separated by ' '.
void apply(char *phasename, char *target)
apply a transformation on a module
void set_loop_execution_parallel(const char *module_name, const char *loop_label, bool exec_parallel_p)
Change execution mode for a loop.
static void pyps_log_handler(const char *fmt, va_list *args)
char * show(char *rname, char *mname)
return the rname[mname] resource, which must be a string containing a file name
static void pyps_error_handler(const char *calling_function_name, const char *a_message_format, va_list *args)
#define module_language(e)
implemented as a macro to allow lhs
const char * entity_local_name(entity e)
entity_local_name modified so that it does not core when used in vect_fprint, since someone thought t...
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
entity find_label_entity(const char *, const char *)
util.c
#define loop_execution(x)
#define entity_undefined_p(x)
@ is_execution_sequential
#define statement_undefined_p(x)
#define execution_parallel_p(x)
void initialize_sc(char *(*var_to_string)(Variable))
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
The structure used to build lists in NewGen.
string words_to_string(cons *lw)
int vasprintf(char **resultp, const char *format, va_list args)
Formatted output to strings.
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....