PIPS
stub.c File Reference
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "effects.h"
#include "ri-util.h"
#include "effects-util.h"
#include "misc.h"
#include "database.h"
#include "resources.h"
#include "pipsdbm.h"
#include "control.h"
+ Include dependency graph for stub.c:

Go to the source code of this file.

Macros

#define LISP   (getenv("LISP"))
 
#define REDUCTIONS_SOURCE_DIRECTORY    (strdup(concatenate(getenv("DEVEDIR"), "/Lib/reductions", NULL)))
 

Functions

bool old_reductions (string mod_name)
 stub.c More...
 

Macro Definition Documentation

◆ LISP

#define LISP   (getenv("LISP"))

Definition at line 58 of file stub.c.

◆ REDUCTIONS_SOURCE_DIRECTORY

#define REDUCTIONS_SOURCE_DIRECTORY    (strdup(concatenate(getenv("DEVEDIR"), "/Lib/reductions", NULL)))

Definition at line 60 of file stub.c.

Function Documentation

◆ old_reductions()

bool old_reductions ( string  mod_name)

stub.c

true or FALSE? After all, it's just a user warning, not an error

Parameters
mod_nameod_name

Definition at line 63 of file stub.c.

64 {
65  string program_name = db_get_current_workspace_name() ;
66  char *command ;
67  struct stat buf ;
68  char *options ;
70 
71  if( stat( LISP, &buf ) != 0 ) {
72  user_warning("reductions",
73  "No lisp! Skipping reduction detection\n") ;
74  /* true or FALSE? After all, it's just a user warning, not an error */
75  return false;
76  }
77  debug_on("REDUCTIONS_DEBUG_LEVEL");
78  db_close_workspace(false) ;
79  options = (get_debug_level() <= 5) ? " -batch" : "" ;
80  asprintf(&command,
81  "(echo \"(defparameter files-directory \\\"%s\\\")\
82  (load (concatenate %s files-directory \\\"/init\\\"))\
83  (load (concatenate %s files-directory \\\"/top\\\"))\
84  (reductions t \\\"%s\\\" \\\"%s\\\")\") | %s%s",
86  "'string",
87  "'string",
88  program_name,
89  mod_name,
90  LISP,
91  options ) ;
92  debug( 5, "reductions", "\ncommand = %s\n", command ) ;
93 
94  if( (system( command ) >> 8) != 0 ) {
95  pips_internal_error("Lisp process died unexpectedly" ) ;
96  }
97  free(command);
98  debug_off();
99  db_open_workspace( program_name ) ;
100  mod_stat = (statement)
101  db_get_memory_resource(DBR_CODE, mod_name, true);
103  DB_PUT_MEMORY_RESOURCE(DBR_CODE, strdup(mod_name), mod_stat);
104 
105  return true;
106 }
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
void free(void *)
string db_get_memory_resource(const char *rname, const char *oname, bool pure)
Return the pointer to the resource, whatever it is.
Definition: database.c:755
#define DB_PUT_MEMORY_RESOURCE(res_name, own_name, res_val)
conform to old interface.
Definition: pipsdbm-local.h:66
static statement mod_stat
We want to keep track of the current statement inside the recurse.
Definition: impact_check.c:41
#define debug_on(env)
Definition: misc-local.h:157
#define asprintf
Definition: misc-local.h:225
#define pips_internal_error
Definition: misc-local.h:149
#define debug_off()
Definition: misc-local.h:160
#define user_warning(fn,...)
Definition: misc-local.h:262
int get_debug_level(void)
GET_DEBUG_LEVEL returns the current debugging level.
Definition: debug.c:67
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
Definition: debug.c:189
bool db_close_workspace(bool)
Definition: workspace.c:367
bool db_open_workspace(const char *)
Definition: workspace.c:380
string db_get_current_workspace_name(void)
the function is used to check that there is some current workspace...
Definition: workspace.c:82
bool module_reorder(statement body)
Reorder a module and recompute order to statement if any.
Definition: reorder.c:244
char * strdup()
static char buf[BSZ]
Definition: split_file.c:157
#define LISP
Definition: stub.c:58
#define REDUCTIONS_SOURCE_DIRECTORY
Definition: stub.c:60

References asprintf, buf, db_close_workspace(), db_get_current_workspace_name(), db_get_memory_resource(), db_open_workspace(), DB_PUT_MEMORY_RESOURCE, debug(), debug_off, debug_on, free(), get_debug_level(), LISP, mod_stat, module_reorder(), pips_internal_error, REDUCTIONS_SOURCE_DIRECTORY, strdup(), and user_warning.

+ Here is the call graph for this function: