PIPS
main_pips.c File Reference

Go to the source code of this file.

Functions

char * pips_thanks (char *, char *)
 This file contains the main for pips. More...
 
int pips_main (int, char **)
 
int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 35 of file main_pips.c.

36 {
37  pips_thanks("pips", argv[0]);
38  return pips_main(argc, argv);
39 }
int pips_main(int, char **)
Definition: pips.c:160
char * pips_thanks(char *, char *)
This file contains the main for pips.
Definition: message.c:265

References pips_main(), and pips_thanks().

+ Here is the call graph for this function:

◆ pips_main()

int pips_main ( int  argc,
char **  argv 
)

Definition at line 160 of file pips.c.

161 {
162  volatile bool success = true;
163  pips_checks();
165 
169 
170  pips_parse_arguments(argc, argv);
171 
172  debug_on("PIPS_DEBUG_LEVEL");
174 
176  {
177  // no need to pop_pips_context() at top-level
178  // FI: are you sure make_close_program() cannot call user_error() ?
179  close_workspace(true);
180  success = false;
181  }
182  TRY
183  {
184  // Initialize workspace
188  }
189  else {
190  user_log("Cannot create workspace %s!\n", wspace);
191  exit(1);
192  }
193  } else {
194  // Workspace must be opened
195  if (!open_workspace(wspace)) {
196  user_log("Cannot open workspace %s!\n", wspace);
197  exit(1);
198  }
199  }
200 
201  // Open module
202  if (module != NULL)
204  else
206 
207  // Activate rules
208  if (success && selected_rules)
209  {
211  }
212 
213  // Perform applies
214  if (success && performed_rule && module)
215  {
217  if (success) {
218  user_log("%s performed for %s.\n", performed_rule, module);
219  }
220  else {
221  user_log("Cannot perform %s for %s.\n", performed_rule, module);
222  }
223  }
224 
225  // Build resources
227  {
228  FOREACH(STRING, build_resource_name, build_resource_names)
229  {
230  success = safe_make(build_resource_name, module);
231  if (!success)
232  {
233  user_log("Cannot build %s for %s.\n", build_resource_name, module);
234  break;
235  }
236  }
237  }
238  // whether success or not...
239  close_workspace(true);
240 
242  }
243 
244  debug_off();
245 
246  return !success;
247 }
void user_log(const char *format,...)
Definition: message.c:234
void set_pips_meta_informations(const char *revs, const char *date, const char *comp)
Definition: message.c:102
#define CATCH(what)
@ any_exception_error
catch all
#define UNCATCH(what)
#define TRY
void set_exception_callbacks(exception_callback_t, exception_callback_t)
size_t gen_array_nitems(const gen_array_t a)
Definition: array.c:131
bool open_module(const char *name)
tpips used to convert lower cases into upper cases for all module names, but this is no longer possib...
Definition: dbm.c:95
bool open_module_if_unique(void)
Open the module of a workspace if there is only one.
Definition: dbm.c:144
bool create_workspace(gen_array_t files)
FI: should be called "initialize_workspace()"; a previous call to db_create_workspace() is useful to ...
Definition: dbm.c:180
bool close_workspace(bool is_quit)
Definition: dbm.c:346
bool open_workspace(const char *name)
should be: success (cf wpips.h)
Definition: dbm.c:309
void push_pips_context(char const *file, char const *function, int line)
exception.c
Definition: exception.c:43
void pop_pips_context(char const *file, char const *function, int line)
Definition: exception.c:50
#define STRING(x)
Definition: genC.h:87
bool success
Definition: gpips-local.h:59
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
Definition: newgen_list.h:179
void pips_checks(void)
add checkings here (FI: why in help.c?) SG : PIPS_ROOT should not be required :)
Definition: help.c:100
#define debug_on(env)
Definition: misc-local.h:157
#define debug_off()
Definition: misc-local.h:160
#define exit(code)
Definition: misc-local.h:54
void initialize_newgen()
cproto-generated files
Definition: newgen.c:48
static list selected_rules
Definition: pips.c:78
char * soft_revisions
could be shared somewhere?
Definition: revisions.c:33
static list build_resource_names
Definition: pips.c:76
char * cc_version
Definition: revisions.c:41
static void select_rule(char *rule_name)
Definition: pips.c:149
char * soft_date
Definition: revisions.c:39
static char * performed_rule
Definition: pips.c:75
static char * wspace
Definition: pips.c:73
static void pips_parse_arguments(int argc, char *argv[])
Definition: pips.c:80
static char * module
Definition: pips.c:74
static gen_array_t source_files
Definition: pips.c:77
bool db_create_workspace(const char *)
Definition: workspace.c:282
bool safe_make(const char *res_n, const char *module_n)
Definition: pipsmake.c:1717
bool safe_apply(const char *phase_n, const char *module_n)
Definition: pipsmake.c:1723
void initialize_signal_catcher(void)
Definition: signal.c:126
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...
Definition: entity.c:453
void initialize_sc(char *(*var_to_string)(Variable))
Definition: sc_debug.c:253
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
Definition: vecteur-local.h:60

Referenced by main().

+ Here is the caller graph for this function:

◆ pips_thanks()

char* pips_thanks ( string  name,
string  path 
)

This file contains the main for pips.

Please, do not change anything! do any change to pips_main().

This file contains the main for pips.

This file contains the main for fpips.

Parameters
nameame
pathath

Definition at line 265 of file message.c.

266 {
267  if (isatty(fileno(stdout)))
268  {
269  fprintf(stdout, PIPS_THANKS_STRING(STRINGIFY(SOFT_ARCH)), name, path);
270  fflush(stdout);
271  }
272 }
#define PIPS_THANKS_STRING(arch)
The # "stringificator" only works in a macro expansion...
Definition: message.c:247
#define STRINGIFY(symbol)
If not using this 2-stage macro evaluation, the generated string is not the value of the macro but th...
Definition: misc-local.h:50
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...

Referenced by main().

+ Here is the caller graph for this function: