PIPS
pipsdbm.h File Reference
#include "linear.h"
#include "resources.h"
#include "newgen.h"
+ Include dependency graph for pipsdbm.h:

Go to the source code of this file.

Macros

#define PIPSDBM_DEBUG_LEVEL   "PIPSDBM_DEBUG_LEVEL"
 Warning! Do not modify this file that is automatically generated! More...
 
#define PROGRAM_RESOURCE_OWNER   ""
 
#define WORKSPACE_TMP_SPACE   "Tmp"
 
#define WORKSPACE_SRC_SPACE   "Src"
 
#define WORKSPACE_PROGRAM_SPACE   "Program"
 
#define WORKSPACE_METADATA_SPACE   "Metadata"
 
#define MAIN_FILE_NAMES   "PROGRAM.main"
 Name of the file containing the names of the main procedures. More...
 
#define DB_PUT_MEMORY_RESOURCE(res_name, own_name, res_val)    db_put_or_update_memory_resource(res_name, own_name, (void*) res_val, true)
 conform to old interface. More...
 
#define DB_PUT_FILE_RESOURCE   DB_PUT_MEMORY_RESOURCE
 Put a file resource into the current workspace database. More...
 
#define DB_PUT_NEW_FILE_RESOURCE(res_name, own_name, res_val)    db_put_or_update_memory_resource(res_name, own_name, (void*) res_val, false)
 Put a new file resource into the current workspace database. More...
 
#define db_get_file_resource   db_get_memory_resource
 
#define db_unput_a_resource(r, o)   db_delete_resource(r,o)
 
#define build_pgmwd   db_get_workspace_directory_name
 
#define db_make_subdirectory(n)   free(db_get_directory_name_for_module(n))
 

Functions

int genread_input (void)
 
void db_create_pips_database (void)
 ??? statement_mapping More...
 
bool db_open_pips_database (FILE *)
 
void db_save_pips_database (FILE *)
 
void db_close_pips_database (void)
 
void db_reset_pips_database_if_necessary (void)
 
void dump_all_db_resource_status (FILE *, string)
 
void db_delete_resource (const char *, const char *)
 Delete a resource. More...
 
bool db_update_time (const char *, const char *)
 this should really be a put. More...
 
void db_print_all_required_resources (FILE *)
 
void db_clean_all_required_resources (void)
 
bool db_resource_required_or_available_p (const char *, const char *)
 from now on we must not know about the database internals? More...
 
bool db_resource_is_required_p (const char *, const char *)
 true if exists and in required state. More...
 
bool db_resource_p (const char *, const char *)
 true if exists and in loaded or stored state. More...
 
bool db_touch_resource (const char *, const char *)
 touch logical time for resource[owner], possibly behind the back of pipsdbm. More...
 
int db_time_of_resource (const char *, const char *)
 
string db_get_resource_id (const char *, const char *)
 some way to identify a resource... More...
 
string db_get_memory_resource (const char *, const char *, bool)
 Return the pointer to the resource, whatever it is. More...
 
void db_set_resource_as_required (const char *, const char *)
 
void db_put_or_update_memory_resource (const char *, const char *, void *, bool)
 Put a resource into the current workspace database. More...
 
void db_invalidate_memory_resource (const char *, const char *)
 
int db_unput_resources (const char *)
 Delete all the resources of a given type "rname". More...
 
list db_retrieve_resources (const char *)
 Retrieve all the db resources of a given resource type, "rname". More...
 
string db_resource_name (void *)
 To be used for debugging. More...
 
string db_resource_owner_name (void *)
 To be used for debugging. More...
 
void db_save_and_free_memory_resource_if_any (const char *, const char *, bool)
 
void db_delete_all_resources (void)
 FC: I added this function to clean all resources, hence avoiding to save them. More...
 
bool db_set_current_module_name (const char *)
 
string db_get_current_module_name (void)
 Also used to check whether set... More...
 
void db_reset_current_module_name (void)
 
int db_delete_obsolete_resources (bool(*)(const char *, const char *))
 delete all obsolete resources before a close. More...
 
bool db_module_exists_p (const char *)
 Return whether name is a "valid" module. More...
 
gen_array_t db_get_module_list_initial_order (void)
 
gen_array_t db_get_module_list (void)
 Get an array of all the modules (functions, procedures and compilation units) of a workspace. More...
 
gen_array_t db_get_function_list (void)
 Get an array of all the functions and procedures (not compilation units) of a workspace. More...
 
gen_array_t db_get_compilation_unit_list (void)
 Get an array of all the compilation units of a workspace. More...
 
int dbll_number_of_resources (void)
 
string dbll_get_ith_resource_name (int)
 
bool dbll_very_special_resource_p (const char *, const char *)
 
void db_set_current_builder_name (const char *)
 
void db_reset_current_builder_name (void)
 
string db_get_current_builder_name (void)
 
string db_get_directory_name_for_module (const char *)
 returns the allocated and mkdir'ed directory for module name More...
 
string db_build_file_resource_name (const char *, const char *, const char *)
 returns an allocated file name for a file resource. More...
 
string get_resource_file_name (const char *, const char *)
 allocate a full file name for the given resource. More...
 
void dbll_unlink_resource_file (const char *, const char *, bool)
 
int dbll_stat_local_file (const char *, bool)
 It is impportant that the workspace directory does not appear in the file name so as to allow workspaces to be moveable. More...
 
int dbll_stat_resource_file (const char *, const char *, bool)
 
void dbll_save_resource (const char *, const char *, void *)
 save rname of oname p. More...
 
void * dbll_load_resource (const char *, const char *)
 
void dbll_free_resource (const char *, const char *, void *)
 
bool dbll_check_resource (const char *, const char *, void *)
 Internal consistency of the resource, not the global consistency wrt other resources and pipsmake rules which is managed by the pipsmake library at a higher level. More...
 
bool dbll_storable_p (const char *)
 
void dbll_save_and_free_resource (const char *, const char *, void *, bool)
 
bool displayable_file_p (const char *)
 rather approximated. More...
 
bool dbll_database_managed_file_p (const char *)
 returns whether the file is managed within the database. More...
 
bool workspace_name_p (const char *)
 workspace.c More...
 
string db_get_current_workspace_name (void)
 the function is used to check that there is some current workspace... More...
 
string db_get_workspace_directory_name (const char *)
 returns an allocated string. More...
 
string db_get_current_workspace_directory (void)
 
int db_inc_logical_time (void)
 0 means not set... More...
 
int db_get_logical_time (void)
 
string db_get_meta_data_directory (void)
 
bool workspace_exists_p (const char *)
 
bool workspace_ok_p (const char *)
 
bool db_create_workspace (const char *)
 
void db_checkpoint_workspace (void)
 
bool db_close_workspace (bool)
 
bool db_open_workspace (const char *)
 
char * pipsdbm_read_entities (FILE *)
 externals.c More...
 
void pipsdbm_free_entities (char *)
 
void pipsdbm_write_statement_mapping (FILE *, statement_mapping)
 Write a statement mapping. More...
 
hash_table pipsdbm_read_statement_mapping (FILE *)
 Read a statement mapping. More...
 
bool pipsdbm_check_statement_mapping (statement_mapping)
 a little bit partial, because domain are not checked. More...
 
void pipsdbm_free_statement_mapping (statement_mapping)
 
bool pipsdbm_consistent_statement_function (gen_chunkp)
 
void pipsdbm_write_statement_function (FILE *, gen_chunkp)
 the stored stuff need be based on the ordering... More...
 
gen_chunkp pipsdbm_read_statement_function (FILE *)
 Should use a higher level pipsdbm_read_statement_mapping() to survive to XML. More...
 
void free_static_control_mapping (statement_mapping)
 Modification Dec 11 1995: ne pas utiliser free_static_control car il libere des champs qui appartiennent a d'autres structures que celles controlees par static_controlize...(champs d'origine) Les liberation de ces champs par un autre transformer (use_def_elim) entrainait alors un core dump au niveau de cette procedure. More...
 
void declarations_write (FILE *, hash_table)
 Functions to read and write declarations resource, which is a hash table whose key and value are string (keyword/typedef and TK_keyword/TK_typedef) More...
 
hash_table declarations_read (FILE *)
 
bool some_main_entity_p (void)
 util.c More...
 
string get_main_entity_name (void)
 Return the local name of the main module if it is available, or the local name of any module by default. More...
 
void interrupt_pipsmake_asap (void)
 misc.c More...
 
void dont_interrupt_pipsmake_asap (void)
 
bool interrupt_pipsmake_asap_p (void)
 
void init_request_timers (void)
 Functions for timing one request. More...
 
void init_log_timers (void)
 Functions for timing one phase. More...
 
void dbm_start_timer (void)
 
void dbm_stop_timer (void)
 accumulate dbm related times for one phase More...
 
void get_string_timers (string *, string *)
 compute times elapsed since init_log_timers(), i.e. More...
 
void get_request_string_timers (string *, string *, string *)
 compute times elapsed since init_request_log_timers(), i.e. More...
 
void init_resource_usage_check (void)
 init variables More...
 
void add_read_resource (string, string)
 add an element to the read set More...
 
void add_write_resource (string, string)
 add an element to the write set More...
 
void get_logged_resources (set *, set *)
 Get the made sets. More...
 

Variables

FILE * genread_in
 symbols exported by parser / lexer More...
 
const char * dbll_current_module
 lowlevel.c More...
 

Macro Definition Documentation

◆ build_pgmwd

#define build_pgmwd   db_get_workspace_directory_name

Definition at line 116 of file pipsdbm.h.

◆ db_get_file_resource

#define db_get_file_resource   db_get_memory_resource

Definition at line 114 of file pipsdbm.h.

◆ db_make_subdirectory

#define db_make_subdirectory (   n)    free(db_get_directory_name_for_module(n))

Definition at line 118 of file pipsdbm.h.

◆ db_unput_a_resource

#define db_unput_a_resource (   r,
 
)    db_delete_resource(r,o)

Definition at line 115 of file pipsdbm.h.

◆ MAIN_FILE_NAMES

#define MAIN_FILE_NAMES   "PROGRAM.main"

Name of the file containing the names of the main procedures.

There may be more than one in Fortran. It is simpler in C, because the main procedure is always called "main" and we cannot have more than one without a name conflict.

Definition at line 49 of file pipsdbm.h.

◆ PIPSDBM_DEBUG_LEVEL

#define PIPSDBM_DEBUG_LEVEL   "PIPSDBM_DEBUG_LEVEL"

Warning! Do not modify this file that is automatically generated!

Modify src/Libs/pipsdbm/pipsdbm-local.h instead, to add your own modifications. header file built by cproto pipsdbm-local.h

Definition at line 35 of file pipsdbm.h.

◆ PROGRAM_RESOURCE_OWNER

#define PROGRAM_RESOURCE_OWNER   ""

Definition at line 37 of file pipsdbm.h.

◆ WORKSPACE_METADATA_SPACE

#define WORKSPACE_METADATA_SPACE   "Metadata"

Definition at line 42 of file pipsdbm.h.

◆ WORKSPACE_PROGRAM_SPACE

#define WORKSPACE_PROGRAM_SPACE   "Program"

Definition at line 41 of file pipsdbm.h.

◆ WORKSPACE_SRC_SPACE

#define WORKSPACE_SRC_SPACE   "Src"

Definition at line 40 of file pipsdbm.h.

◆ WORKSPACE_TMP_SPACE

#define WORKSPACE_TMP_SPACE   "Tmp"

Definition at line 39 of file pipsdbm.h.

Function Documentation

◆ add_read_resource()

void add_read_resource ( string  rname,
string  oname 
)

add an element to the read set

Parameters
rnamename
onamename

Definition at line 251 of file misc.c.

252 {
255  res_read,
256  strdup(concatenate(oname, ".", rname, NULL)));
257 }
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
#define set_undefined_p(s)
Definition: newgen_set.h:49
set set_add_element(set, const set, const void *)
Definition: set.c:152
static set res_read
Sets of the readwrite resources by pipsdbm.
Definition: misc.c:236
char * strdup()

References concatenate(), res_read, set_add_element(), set_undefined_p, and strdup().

+ Here is the call graph for this function:

◆ add_write_resource()

void add_write_resource ( string  rname,
string  oname 
)

add an element to the write set

Parameters
rnamename
onamename

Definition at line 260 of file misc.c.

261 {
264  strdup(concatenate(oname, ".", rname, NULL)));
265 }
static set res_write
Definition: misc.c:237

References concatenate(), res_write, set_add_element(), set_undefined_p, and strdup().

+ Here is the call graph for this function:

◆ db_build_file_resource_name()

string db_build_file_resource_name ( const char *  rname,
const char *  oname,
const char *  suffix 
)

returns an allocated file name for a file resource.

may depend on the current builder, someday. this function is to be used by all phases that generate files. it does not include the directory for movability

mkdir as a side effect.

the next name must be compatible with the Display script... it may depend on the builder function maybe (if pipsmake tells) may include the resource name? as lower letters?

Parameters
rnamename
onamename
suffixuffix

Definition at line 169 of file lowlevel.c.

170 {
171  string result;
172  if (same_string_p(oname, "")) oname = DEFAULT_OWNER_NAME;
173  free(db_get_directory_name_for_module(oname));/* mkdir as a side effect. */
174  /* the next name must be compatible with the Display script...
175  * it may depend on the builder function maybe (if pipsmake tells)
176  * may include the resource name? as lower letters?
177  */
178  result = strdup(concatenate(oname, "/", oname, suffix, NULL));
179 
180  pips_debug(8, "file name for %s[%s] with suffix '%s' is '%s'\n",
181  rname, oname, suffix, result);
182  return result;
183 }
void free(void *)
#define DEFAULT_OWNER_NAME
Definition: lowlevel.c:146
string db_get_directory_name_for_module(const char *name)
returns the allocated and mkdir'ed directory for module name
Definition: lowlevel.c:150
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
#define same_string_p(s1, s2)

References concatenate(), db_get_directory_name_for_module(), DEFAULT_OWNER_NAME, free(), pips_debug, same_string_p, strdup(), and STUB_ERROR.

Referenced by actual_symbol_table_dump(), add_new_compilation_unit(), add_new_module_from_text(), filter_file(), flinter(), full_graph_of_calls(), generic_print_xml_application(), gpu_xml_dump(), graph_of_calls(), html_prettyprint(), html_prettyprint_symbol_table(), loop_statistics(), make_resource_from_starting_node(), make_text_resource(), module_to_callgraph(), print_c_code(), print_code_smalltalk(), print_crough(), print_dependence_or_chains_graph(), print_dot_dependence_or_chains_graph(), print_filtered_dg_or_dvdg(), print_interface(), print_loopnest_dependence_cone(), print_loops(), print_sesam_tasks_buffers_header(), print_xml_code(), print_xml_code_with_explicit_motif(), process_user_file(), step_compile(), store_new_module(), and unsplit_internal().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ db_checkpoint_workspace()

void db_checkpoint_workspace ( void  )

load ENTITIES (since no one ask for them as they should...)

Definition at line 350 of file workspace.c.

351 {
353  pips_debug(1, "Checkpointing workspace %s\n",
355 
356  db_save_workspace("Saving", false);
357 
358  /* load ENTITIES (since no one ask for them as they should...)
359  */
360  if (db_resource_p(DBR_ENTITIES, ""))
361  (void) db_get_memory_resource(DBR_ENTITIES, "", true);
362 
364  debug_off();
365 }
void dump_all_db_resource_status(FILE *file, string where)
Definition: database.c:198
bool db_resource_p(const char *rname, const char *oname)
true if exists and in loaded or stored state.
Definition: database.c:524
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 debug_on(env)
Definition: misc-local.h:157
#define debug_off()
Definition: misc-local.h:160
#define PIPSDBM_DEBUG_LEVEL
Definition: pipsdbm-local.h:27
#define ifdebug(n)
Definition: sg.c:47
static void db_save_workspace(string what, bool do_free)
Definition: workspace.c:333
void db_checkpoint_workspace(void)
Definition: workspace.c:350
string db_get_current_workspace_name(void)
the function is used to check that there is some current workspace...
Definition: workspace.c:82

References db_get_current_workspace_name(), db_get_memory_resource(), db_resource_p(), db_save_workspace(), debug_off, debug_on, dump_all_db_resource_status(), ifdebug, pips_debug, and PIPSDBM_DEBUG_LEVEL.

Referenced by checkpoint_workspace().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ db_clean_all_required_resources()

void db_clean_all_required_resources ( void  )

of db_symbols

Owner Symbol, Owned Resources

Resource Symbol, DB Resource

DEBUG?

Mark owner symbol os as to be deleted if set of owned resouces is empty.

maybe temporarily required by pipsmake but some error occured

Definition at line 460 of file database.c.

461 {
462  list /* of db_symbols */ owners_to_delete = NIL;
463  db_resources db = get_pips_database();
464 
465  /* Owner Symbol, Owned Resources */
466  DB_RESOURCES_MAP(os, or,
467  {
468  /* Resource Symbol, DB Resource */
470  {
471  string rn = db_symbol_name(rs);
472  string on = db_symbol_name(os);
473  pips_debug(8, "considering %s[%s] (%p)\n", rn, on, (void*) r);
474 
475  if (db_resource_required_p(r))
476  {
477  pips_debug(1, "deleting %s[%s]\n", rn, on);
478  dump_db_resource(rn, on, r); /* DEBUG? */
479  db_delete_resource(rn, on);
480  }
481  },
482  or);
483 
484  /* Mark owner symbol os as to be deleted if set of owned resouces is
485  empty. */
487  {
488  pips_user_warning("module '%s' to be deleted, no more resources owned.\n",
489  /* maybe temporarily required by pipsmake but some error occured */
490  db_symbol_name(os));
491 
492  owners_to_delete = CONS(DB_SYMBOL, os, owners_to_delete);
493  }
494  },
495  db);
496 
497  MAP(DB_SYMBOL, os, delete_db_resources(db, os), owners_to_delete);
498 }
db_owned_resources delete_db_resources(db_resources f, db_symbol k)
#define db_resource_required_p(r)
Definition: database.c:54
static void dump_db_resource(const char *rname, const char *oname, db_resource r)
Definition: database.c:183
void db_delete_resource(const char *rname, const char *oname)
Delete a resource.
Definition: database.c:353
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
#define MAP(_map_CASTER, _map_item, _map_code, _map_list)
Apply/map an instruction block on all the elements of a list (old fashioned)
Definition: newgen_list.h:226
int hash_table_entry_count(hash_table htp)
now we define observers in order to hide the hash_table type...
Definition: hash.c:818
#define pips_user_warning
Definition: misc-local.h:146
#define DB_SYMBOL(x)
DB_SYMBOL.
#define DB_RESOURCES_MAP(k, v, c, f)
#define db_symbol_name(x)
#define DB_OWNED_RESOURCES_MAP(k, v, c, f)
#define db_owned_resources_hash_table(x)
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

References CONS, db_delete_resource(), db_owned_resources_hash_table, DB_OWNED_RESOURCES_MAP, db_resource_required_p, DB_RESOURCES_MAP, DB_SYMBOL, db_symbol_name, delete_db_resources(), dump_db_resource(), hash_table_entry_count(), MAP, NIL, pips_debug, and pips_user_warning.

Referenced by make(), and safe_do_something().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ db_close_pips_database()

void db_close_pips_database ( void  )

Definition at line 150 of file database.c.

151 {
152  DB_OK; close_pips_database(); DB_UNDEF;
153 }
#define DB_UNDEF
Definition: database.c:105
#define DB_OK
the pips_database stores pips resources.
Definition: database.c:104

References DB_OK, and DB_UNDEF.

Referenced by save_meta_data().

+ Here is the caller graph for this function:

◆ db_close_workspace()

bool db_close_workspace ( bool  is_quit)

free?

Parameters
is_quits_quit

Definition at line 367 of file workspace.c.

368 {
370  pips_debug(1, "Closing workspace %s\n", db_get_current_workspace_name());
371 
372  db_save_workspace("Closing", /* free? */ !is_quit);
374 
375  pips_debug(1, "done\n");
376  debug_off();
377  return true;
378 }
static void db_reset_current_workspace_name(void)
Definition: workspace.c:69

References db_get_current_workspace_name(), db_reset_current_workspace_name(), db_save_workspace(), debug_off, debug_on, pips_debug, and PIPSDBM_DEBUG_LEVEL.

Referenced by create(), main(), make_close_workspace(), make_open_workspace(), old_reductions(), tpips_internal_error(), and tpips_user_error().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ db_create_pips_database()

void db_create_pips_database ( void  )

??? statement_mapping

cproto-generated files database.c

??? statement_mapping

Definition at line 109 of file database.c.

110 {
111  DB_UNDEF; init_pips_database(); DB_OK;
112 }

References DB_OK, and DB_UNDEF.

Referenced by db_create_workspace().

+ Here is the caller graph for this function:

◆ db_create_workspace()

bool db_create_workspace ( const char *  name)
Parameters
nameame

Definition at line 282 of file workspace.c.

283 {
284  bool ok;
285  string dir_name;
287 
288  dir_name = db_get_workspace_directory_name(name);
289 
290  pips_debug(1, "workspace %s in directory %s\n", name, dir_name);
291 
292  if ((ok = purge_directory(dir_name)))
293  {
294  if ((ok = create_directory(dir_name)))
295  {
298  }
299  else
300  {
301  pips_user_warning("could not create directory %s\n", dir_name);
302  }
303  }
304  else
305  {
306  pips_user_warning("could not remove old directory %s\n", dir_name);
307  }
308 
309  free(dir_name);
310  pips_debug(1, "done\n");
311 
312  debug_off();
313  return ok;
314 }
void db_create_pips_database(void)
exported interface is minimal.
Definition: database.c:109
bool create_directory(char *name)
Definition: file.c:435
bool purge_directory(char *name)
Definition: file.c:453
static bool ok
static void db_set_current_workspace_name(const char *name)
Definition: workspace.c:60
string db_get_workspace_directory_name(const char *name)
returns an allocated string.
Definition: workspace.c:91

References create_directory(), db_create_pips_database(), db_get_workspace_directory_name(), db_set_current_workspace_name(), debug_off, debug_on, free(), ok, pips_debug, pips_user_warning, PIPSDBM_DEBUG_LEVEL, and purge_directory().

Referenced by create(), end_create_workspace_notify(), execute_workspace_creation_and_so_on_given_with_options(), and pips_main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ db_delete_all_resources()

void db_delete_all_resources ( void  )

FC: I added this function to clean all resources, hence avoiding to save them.

This speed up hpfc at low cost;-).

Definition at line 1030 of file database.c.

1031 {
1032  int nr = dbll_number_of_resources(), i;
1033  DB_OK;
1034  for (i=0; i<nr; i++)
1036 }
int db_unput_resources(const char *rname)
Delete all the resources of a given type "rname".
Definition: database.c:915
int dbll_number_of_resources(void)
Definition: lowlevel.c:108
string dbll_get_ith_resource_name(int i)
Definition: lowlevel.c:113

References DB_OK, db_unput_resources(), dbll_get_ith_resource_name(), and dbll_number_of_resources().

Referenced by delete_all_resources(), and delete_some_resources().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ db_delete_obsolete_resources()

int db_delete_obsolete_resources ( bool(*)(const char *, const char *)  keep_p)

delete all obsolete resources before a close.

return the number of resources destroyed.

of string

Definition at line 1076 of file database.c.

1077 {
1078  int ndeleted = 0;
1079  list /* of string */ lr = NIL, lo = NIL, lrp, lop;
1080  DB_OK;
1081  debug_on("PIPSDBM_DEBUG_LEVEL");
1082 
1083  // builds the lists to delete.
1084  pips_debug(4, "building list of resources to delete... (keep=%p)\n", keep_p);
1085  DB_RESOURCES_FOREACH(os, or, get_pips_database())
1086  {
1087  DB_OWNED_RESOURCES_FOREACH(rs, r, or)
1088  {
1089  string rn = db_symbol_name(rs), on = db_symbol_name(os);
1090  pips_debug(8, "considering %s of %s (%p)\n", rn, on, (void *) r);
1091  if (!db_resource_required_p(r) && !keep_p(rn, on)) {
1092  pips_debug(8, "to be destroyed: %s of %s\n", rn, on);
1093  ndeleted++;
1094  lr = CONS(STRING, rn, lr);
1095  lo = CONS(STRING, on, lo);
1096  }
1097  }
1098  }
1099 
1100  // delete the resources.
1101  pips_debug(4, "deleting obsolete resources...\n");
1102  for(lrp=lr, lop=lo; !ENDP(lrp); POP(lrp), POP(lop))
1103  {
1104  string rname = STRING(CAR(lrp)), oname = STRING(CAR(lop));
1105  db_delete_resource(rname, oname);
1106  dbll_unlink_resource_file(rname, oname, false);
1107  }
1108 
1109  gen_free_list(lr);
1110  gen_free_list(lo);
1111  pips_debug(4, "deleting obsolete resources done.\n");
1112  debug_off();
1113  return ndeleted;
1114 }
#define STRING(x)
Definition: genC.h:87
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
#define POP(l)
Modify a list pointer to point on the next element of the list.
Definition: newgen_list.h:59
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
void gen_free_list(list l)
free the spine of the list
Definition: list.c:327
void dbll_unlink_resource_file(const char *rname, const char *oname, bool erroriffailed)
Definition: lowlevel.c:219
#define DB_RESOURCES_FOREACH(k, v, f)
#define DB_OWNED_RESOURCES_FOREACH(k, v, f)

References CAR, CONS, db_delete_resource(), DB_OK, DB_OWNED_RESOURCES_FOREACH, db_resource_required_p, DB_RESOURCES_FOREACH, db_symbol_name, dbll_unlink_resource_file(), debug_off, debug_on, ENDP, gen_free_list(), NIL, pips_debug, POP, and STRING.

Referenced by delete_obsolete_resources().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ db_delete_resource()

void db_delete_resource ( const char *  rname,
const char *  oname 
)

Delete a resource.

let us do it!

??? I should unlink the file

Parameters
rnamename
onamename

Definition at line 353 of file database.c.

354 {
355  db_resource r;
357  DB_OK;
358 
359  or = get_db_owned_resources(oname);
360  pips_assert("valid owned resources", !db_owned_resources_undefined_p(or));
361  r = get_resource(rname, or);
362  if (!db_resource_undefined_p(r))
363  {
364  /* let us do it! */
368  {
369  dbll_free_resource(rname, oname, db_resource_pointer(r));
370  /* ??? I should unlink the file */
371  }
372  db_resource_pointer(r) = NULL;
373  free_db_resource(r);
375  }
376 }
void free_db_resource(db_resource p)
db_resource delete_db_owned_resources(db_owned_resources f, db_symbol k)
#define db_resource_loaded_and_stored_p(r)
Definition: database.c:56
static db_resource get_resource(const char *rname, db_owned_resources or)
Definition: database.c:238
static db_symbol find_or_create_db_symbol(const char *name)
Definition: database.c:85
static db_owned_resources get_db_owned_resources(const char *oname)
Definition: database.c:231
#define db_resource_loaded_p(r)
Definition: database.c:53
void dbll_free_resource(const char *rname, const char *oname, void *p)
Definition: lowlevel.c:313
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
#define db_owned_resources_undefined_p(x)
#define db_resource_pointer(x)
#define db_resource_undefined_p(x)

References DB_OK, db_owned_resources_undefined_p, db_resource_loaded_and_stored_p, db_resource_loaded_p, db_resource_pointer, db_resource_undefined_p, dbll_free_resource(), delete_db_owned_resources(), find_or_create_db_symbol(), free_db_resource(), get_db_owned_resources(), get_resource(), and pips_assert.

Referenced by db_clean_all_required_resources(), db_clean_db_resources(), db_delete_obsolete_resources(), db_get_memory_resource(), db_save_and_free_resource(), db_unput_resources(), outliner_independent(), and remove_a_resource().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ db_get_current_builder_name()

string db_get_current_builder_name ( void  )

Definition at line 140 of file lowlevel.c.

141 {
142  pips_assert("some current builder", current_builder);
143  return current_builder;
144 }
static char * current_builder
Definition: lowlevel.c:126

References current_builder, and pips_assert.

◆ db_get_current_module_name()

◆ db_get_current_workspace_directory()

string db_get_current_workspace_directory ( void  )

Definition at line 96 of file workspace.c.

97 {
98  string ws_name = db_get_current_workspace_name();
99  pips_assert("some current workspace", ws_name);
100  return db_get_workspace_directory_name(ws_name);
101 }

References db_get_current_workspace_name(), db_get_workspace_directory_name(), pips_assert, string_undefined, and STUB_WARNING.

Referenced by actual_c_parser(), actual_symbol_table_dump(), add_new_compilation_unit(), add_new_module_from_text(), alias_check(), callgraph_module_name(), compile_a_pure_function(), compile_a_special_io_function(), compile_f90_module(), create_workspace(), davinci_dump_expressions(), davinci_print_control_nodes(), davinci_print_non_deterministic_unstructured(), db_get_directory_name_for_module(), dbll_stat_local_file(), do_recompile_module(), filter_file(), flinter(), full_graph_of_calls(), generic_print_xml_application(), get_first_main_module(), get_main_entity_name(), gpu_xml_dump(), graph_of_calls(), hbdsc_parallelization(), hpfc_filter(), hpfc_generate_path_name_of_file_name(), hpfc_install(), hpfc_make(), hpfc_print_file(), hpfc_run(), html_prettyprint(), html_prettyprint_symbol_table(), insert_something_in_the_wpips_log_window(), loop_statistics(), make_resource_from_starting_node(), make_text_resource(), module_name_to_input_file_name(), module_to_callgraph(), open_workspace(), outliner_independent(), pips_split_file(), print_array_dfg(), print_bdt(), print_c_code(), print_code_smalltalk(), print_crough(), print_dependence_or_chains_graph(), print_dinf_statistics(), print_dot_dependence_or_chains_graph(), print_dsup_statistics(), print_filtered_dg_or_dvdg(), print_interface(), print_loopnest_dependence_cone(), print_loops(), print_module_name_to_toposorts(), print_plc(), print_proj_op_statistics(), print_sesam_tasks_buffers_header(), print_umay_statistics(), print_umust_statistics(), print_xml_code(), print_xml_code_with_explicit_motif(), process_user_file(), put_generated_resources_for_common(), put_generated_resources_for_module(), put_generated_resources_for_program(), region_translation_statistics_close(), rice_dependence_graph(), sequence_dependence_graph(), some_main_entity_p(), step_compile(), step_compile_generated_module(), the_actual_parser(), unsplit_internal(), used_before_set(), and writeresult().

+ Here is the call graph for this function:

◆ db_get_current_workspace_name()

◆ db_get_directory_name_for_module()

string db_get_directory_name_for_module ( const char *  name)

returns the allocated and mkdir'ed directory for module name

MKDIR

Parameters
nameame

Definition at line 150 of file lowlevel.c.

151 {
152  string dir_name, ws_dir_name;
153  pips_assert("some valid name", name && !same_string_p(name, ""));
154  ws_dir_name = db_get_current_workspace_directory();
155  dir_name = strdup(concatenate(ws_dir_name, "/", name, NULL));
156  free(ws_dir_name);
157  if (!directory_exists_p(dir_name))
158  if (!create_directory(dir_name)) /* MKDIR */
160  ("cannot create directory %s\n", dir_name);
161  return dir_name;
162 }
bool directory_exists_p(const char *name)
Definition: file.c:314
#define pips_user_irrecoverable_error
Definition: misc-local.h:148
string db_get_current_workspace_directory(void)
Definition: workspace.c:96

References concatenate(), create_directory(), db_get_current_workspace_directory(), directory_exists_p(), free(), pips_assert, pips_user_irrecoverable_error, same_string_p, and strdup().

Referenced by dag_dot_dump(), db_build_file_resource_name(), db_get_meta_data_directory(), generate_hpf_remapping_file(), get_new_tmp_file_name(), get_opencl_file_name(), get_resource_file_name(), helper_file_name(), hpfc_init(), insert_check_alias_before_statement(), insert_flag_before_call_site(), insert_test_before_caller(), insert_test_before_statement(), process_thru_C_pp(), process_thru_fortran_pp(), push_path(), step_install(), text_area_included(), unsplit_internal(), and used_before_set().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ db_get_logical_time()

int db_get_logical_time ( void  )

Definition at line 112 of file workspace.c.

113 {
114  return logical_time;
115 }
static int logical_time
Definition: workspace.c:105

References logical_time.

Referenced by db_check_time(), db_put_or_update_memory_resource(), db_set_resource_as_required(), db_touch_resource(), db_update_time(), and save_meta_data().

+ Here is the caller graph for this function:

◆ db_get_meta_data_directory()

string db_get_meta_data_directory ( void  )

Definition at line 139 of file workspace.c.

140 {
142 }
#define METADATA
Definition: workspace.c:132

References db_get_directory_name_for_module(), and METADATA.

Referenced by build_pgm_makefile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ db_get_module_list_initial_order()

gen_array_t db_get_module_list_initial_order ( void  )

of db_symbol

Definition at line 1151 of file database.c.

1152 {
1153  list /* of db_symbol */ ls;
1154  db_resources dbr;
1155  gen_array_t a;
1156  // should this filtering out performed here? needed for UNSPLIT
1157  string ignore_rx = getenv(IGNORE_RX);
1158  regex_t ignore;
1159 
1160  DB_OK;
1161 
1162  if (ignore_rx && regcomp(&ignore, ignore_rx, 0))
1163  pips_user_error("recomp failed for \"%s\"", ignore_rx);
1164 
1165  // the list returned is reversed...
1167  a = gen_array_make(0);
1168  dbr = get_pips_database();
1169 
1170  // first extract compilation units
1171  FOREACH(DB_SYMBOL, symbol, ls)
1172  {
1173  string name = db_symbol_name(symbol);
1174  // if it is a module, append...
1175  if (!string_undefined_p(name) &&
1176  !same_string_p(name, "") &&
1177  // I should check that some actual resources is stored?
1178  bound_db_resources_p(dbr, symbol) &&
1179  compilation_unit_p(name))
1180  gen_array_dupappend(a, name);
1181  }
1182 
1183  // then extract functions
1184  FOREACH(DB_SYMBOL, symbol, ls)
1185  {
1186  string name = db_symbol_name(symbol);
1187  // if it is a module, append...
1188  if (!string_undefined_p(name) &&
1189  !same_string_p(name, "") &&
1190  // I should check that some actual resources is stored?
1191  bound_db_resources_p(dbr, symbol) &&
1192  !compilation_unit_p(name) &&
1193  (!ignore_rx || regexec(&ignore, name, 0, NULL, 0)))
1194  gen_array_dupappend(a, name);
1195  }
1196 
1197  gen_free_list(ls);
1198  return a;
1199 }
bool bound_db_resources_p(db_resources f, db_symbol k)
#define IGNORE_RX
Definition: database.c:46
gen_array_t gen_array_make(size_t size)
declarations...
Definition: array.c:40
void gen_array_dupappend(gen_array_t a, void *what)
Definition: array.c:117
bool compilation_unit_p(const char *module_name)
The names of PIPS entities carry information about their nature.
Definition: entity_names.c:56
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
Definition: genClib.c:2780
#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
static void symbol(Pproblem XX, int v)
N note: if use janus.c then not static DN.
Definition: isolve.c:113
#define pips_user_error
Definition: misc-local.h:147
list gen_filter_tabulated(bool(*)(gen_chunk *), int)
returns the list of entities with this caracteristics.
Definition: tabulated.c:144
#define string_undefined_p(s)
Definition: newgen_types.h:41
#define db_symbol_domain
newgen_db_status_domain_defined

References bound_db_resources_p(), compilation_unit_p(), DB_OK, DB_SYMBOL, db_symbol_domain, db_symbol_name, FOREACH, gen_array_dupappend(), gen_array_make(), gen_filter_tabulated(), gen_free_list(), gen_true(), IGNORE_RX, pips_user_error, same_string_p, string_undefined_p, and symbol().

Referenced by step_compile_generated_module(), step_install(), and unsplit_internal().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ db_get_resource_id()

string db_get_resource_id ( const char *  rname,
const char *  oname 
)

some way to identify a resource...

could be an id...

Parameters
rnamename
onamename

Definition at line 704 of file database.c.

705 {
706  return (char*) get_real_db_resource(rname, oname);
707 }
static db_resource get_real_db_resource(const char *rname, const char *oname)
Definition: database.c:259

References get_real_db_resource().

Referenced by check_physical_resource_up_to_date(), make_required(), rmake(), and update_preserved_resources().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ db_get_workspace_directory_name()

string db_get_workspace_directory_name ( const char *  name)

returns an allocated string.

Parameters
nameame

Definition at line 91 of file workspace.c.

92 {
93  return strdup(concatenate("./", name, "." MD_DATABASE, NULL));
94 }
#define MD_DATABASE
Definition: workspace.c:88

References concatenate(), MD_DATABASE, and strdup().

Referenced by db_create_workspace(), db_get_current_workspace_directory(), db_open_workspace(), workspace_exists_p(), and workspace_ok_p().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ db_inc_logical_time()

int db_inc_logical_time ( void  )

0 means not set...

Definition at line 107 of file workspace.c.

108 {
109  return logical_time++;
110 }

References logical_time.

Referenced by db_check_time(), and update_preserved_resources().

+ Here is the caller graph for this function:

◆ db_invalidate_memory_resource()

void db_invalidate_memory_resource ( const char *  rname,
const char *  oname 
)

Check the database coherency:

Get the database resource associated to the given resource:

Parameters
rnamename
onamename

Definition at line 897 of file database.c.

898 {
899  db_resource r;
900  /* Check the database coherency: */
901  DB_OK;
902 
903  /* Get the database resource associated to the given resource: */
904  r = find_or_create_db_resource(rname, oname);
907 }
static db_resource find_or_create_db_resource(const char *rname, const char *oname)
Definition: database.c:267
#define db_resource_db_status(x)
#define db_status_undefined_p(x)
#define db_resource_file_time(x)

References DB_OK, db_resource_db_status, db_resource_file_time, db_status_undefined_p, and find_or_create_db_resource().

+ Here is the call graph for this function:

◆ db_open_pips_database()

bool db_open_pips_database ( FILE *  fd)
Returns
whether okay.
Parameters
fdd

Definition at line 119 of file database.c.

120 {
121  db_resources rs;
122  DB_UNDEF;
123  rs = read_db_resources(fd);
124  if (db_resources_undefined_p(rs)) return false;
125  set_pips_database(rs);
126 
127  // coredump in copy if done on save in next function ???.
129 
130  ifdebug(1)
132 
133  DB_OK;
134  return true;
135 }
db_resources read_db_resources(FILE *f)
bool db_open_pips_database(FILE *fd)
Definition: database.c:119
static void db_clean_db_resources()
latter
Definition: database.c:295
#define true
Definition: newgen_types.h:81
#define db_resources_undefined_p(x)
return(s1)

References db_clean_db_resources(), DB_OK, db_resources_undefined_p, DB_UNDEF, dump_all_db_resource_status(), ifdebug, and read_db_resources().

Referenced by load_meta_data().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ db_open_workspace()

bool db_open_workspace ( const char *  name)

failure!

load ENTITIES (since no one ask for them as they should;-)

should touch them somehow to force latter saving?

Parameters
nameame

Definition at line 380 of file workspace.c.

381 {
382  bool ok = true;
383  string dir_name;
385  pips_debug(1, "Opening workspace %s\n", name);
386 
387  dir_name = db_get_workspace_directory_name(name);
388  if (directory_exists_p(dir_name))
389  {
391  ok = load_meta_data();
392 
393  if (!ok) /* failure! */
394  {
395  reset_meta_data();
396  pips_user_warning("Cannot load workspace metadata for %s.\n",
397  name);
398  }
399 
400  /* load ENTITIES (since no one ask for them as they should;-) */
401  if (ok && db_resource_p(DBR_ENTITIES, "")) {
402  (void) db_get_memory_resource(DBR_ENTITIES, "", true);
403  /* should touch them somehow to force latter saving? */
404  }
405  }
406  else ok = false;
407 
408  pips_debug(1, "done (%d)\n", ok);
409  debug_off();
410  free(dir_name);
411  return ok;
412 }
static bool load_meta_data(void)
load metadata from workspace.
Definition: workspace.c:211
static void reset_meta_data(void)
reset all meta data on failures.
Definition: workspace.c:153

References db_get_memory_resource(), db_get_workspace_directory_name(), db_resource_p(), db_set_current_workspace_name(), debug_off, debug_on, directory_exists_p(), free(), load_meta_data(), ok, pips_debug, pips_user_warning, PIPSDBM_DEBUG_LEVEL, and reset_meta_data().

Referenced by main(), make_open_workspace(), and old_reductions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ db_print_all_required_resources()

void db_print_all_required_resources ( FILE *  file)

first collect result

then sort, dump and free

Parameters
fileile

Definition at line 421 of file database.c.

422 {
423  list lres = NIL;
424 
425  /* first collect result */
426  DB_RESOURCES_MAP(os, or,
427  {
429  {
430  string rn = db_symbol_name(rs);
431  string on = db_symbol_name(os);
432  pips_debug(8, "resource %s[%s] is %s\n",
434 
435  if (db_resource_required_p(r)) {
436  lres = CONS(DB_VOID,
437  make_tmp_result(db_resource_time(r), on, rn),
438  lres);
439  }
440  },
441  or);
442  },
443  get_pips_database());
444 
445  /* then sort, dump and free */
447 
448  MAPL(l,
449  {
450  p_tmp_result p = (p_tmp_result) CAR(l).e;
451  fprintf(file,
452  "resource %s[%s] is in 'required' status since %d\n",
453  p->res_name, p->owner_name, p->time);
454  free(p);
455  },
456  lres);
457  gen_free_list(lres);
458 }
static p_tmp_result make_tmp_result(int t, const char *on, const char *rn)
Definition: database.c:403
static int tmp_result_cmp(const p_tmp_result *p1, const p_tmp_result *p2)
Definition: database.c:412
struct t_tmp_result * p_tmp_result
static string db_status_string(db_status s)
Definition: database.c:163
#define MAPL(_map_list_cp, _code, _l)
Apply some code on the addresses of all the elements of a list.
Definition: newgen_list.h:203
void gen_sort_list(list l, gen_cmp_func_t compare)
Sorts a list of gen_chunks in place, to avoid allocations...
Definition: list.c:796
int(* gen_cmp_func_t)(const void *, const void *)
Definition: newgen_types.h:114
#define db_resource_time(x)
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
FI wants a sort...
Definition: database.c:395
const char * res_name
Definition: database.c:398
const char * owner_name
Definition: database.c:397

References CAR, CONS, DB_OWNED_RESOURCES_MAP, db_resource_db_status, db_resource_required_p, db_resource_time, DB_RESOURCES_MAP, db_status_string(), db_symbol_name, fprintf(), free(), gen_free_list(), gen_sort_list(), make_tmp_result(), MAPL, NIL, t_tmp_result::owner_name, pips_debug, t_tmp_result::res_name, t_tmp_result::time, and tmp_result_cmp().

Referenced by make(), and rmake().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ db_reset_current_builder_name()

void db_reset_current_builder_name ( void  )

Definition at line 134 of file lowlevel.c.

135 {
136  pips_assert("some current builder", current_builder);
138 }

References current_builder, free(), and pips_assert.

+ Here is the call graph for this function:

◆ db_reset_current_module_name()

void db_reset_current_module_name ( void  )

Definition at line 1064 of file database.c.

1065 {
1066  DB_OK; pips_assert("some current module name", current_module_name);
1068 }

References current_module_name, DB_OK, free(), and pips_assert.

Referenced by display(), make_close_workspace(), open_module(), and perform().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ db_reset_pips_database_if_necessary()

void db_reset_pips_database_if_necessary ( void  )

Definition at line 155 of file database.c.

156 {
157  // rough! memory leak...
158  if (!pips_database_undefined_p()) reset_pips_database();
159 }

Referenced by reset_meta_data().

+ Here is the caller graph for this function:

◆ db_resource_is_required_p()

bool db_resource_is_required_p ( const char *  rname,
const char *  oname 
)

true if exists and in required state.

Parameters
rnamename
onamename

Definition at line 512 of file database.c.

513 {
514  db_resource r;
515  DB_OK;
516  r = get_db_resource(rname, oname);
518  return false;
519  else
520  return db_resource_required_p(r);
521 }
static db_resource get_db_resource(const char *rname, const char *oname)
Definition: database.c:247

References DB_OK, db_resource_required_p, db_resource_undefined_p, and get_db_resource().

Referenced by rmake().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ db_resource_name()

string db_resource_name ( void *  dbr)

To be used for debugging.

Parameters
dbrbr

Definition at line 1000 of file database.c.

1001 {
1002  return db_resource_name_or_owner_name((db_resource) dbr, false);
1003 }
static string db_resource_name_or_owner_name(db_resource dbr, bool owner_p)
Retrieve the resource name, a.k.a.
Definition: database.c:975

References db_resource_name_or_owner_name().

Referenced by make_cache_consistent_p(), print_make_cache(), and remove_resource_from_make_cache().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ db_resource_owner_name()

string db_resource_owner_name ( void *  dbr)

To be used for debugging.

Parameters
dbrbr

Definition at line 1006 of file database.c.

1007 {
1008  return db_resource_name_or_owner_name((db_resource) dbr, true);
1009 }

References db_resource_name_or_owner_name().

Referenced by make_cache_consistent_p(), print_make_cache(), and remove_resource_from_make_cache().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ db_resource_p()

◆ db_resource_required_or_available_p()

bool db_resource_required_or_available_p ( const char *  rname,
const char *  oname 
)

from now on we must not know about the database internals?

true if exists and in ANY state.

Parameters
rnamename
onamename

Definition at line 505 of file database.c.

506 {
507  DB_OK;
508  return !db_resource_undefined_p(get_db_resource(rname, oname));
509 }

References DB_OK, db_resource_undefined_p, get_db_resource(), and STUB_ERROR.

Referenced by AddEntityToCompilationUnit(), outliner_independent(), RemoveEntityFromCompilationUnit(), and step_analysed_module_p().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ db_retrieve_resources()

list db_retrieve_resources ( const char *  rname)

Retrieve all the db resources of a given resource type, "rname".

Scan all module hash tables to find all resources of kind "rname", no matter what the owner is.

Used only to clean up the make cache in pipsmake.c.

Derived from db_unput_resources()

Scan all resource maps or of owners

See if it contains a resource of kind rname, normalized to r

Parameters
rnamename

Definition at line 943 of file database.c.

944 {
945  list rl = NIL;
946  db_symbol r;
947  DB_OK;
948  r = find_or_create_db_symbol(rname);
949  /* Scan all resource maps or of owners */
950  DB_RESOURCES_MAP(s, or,
951  {
952  pips_debug(9, "Resources for owner \"%s\"\n", (string) s);
953  /* See if it contains a resource of kind rname,
954  normalized to r */
955  if (bound_db_owned_resources_p(or, r)) {
956  /* */
957  db_resource dbr = get_resource(rname, or);
958  rl = CONS(DB_RESOURCE, dbr, rl);
959  }
960  },
961  get_pips_database());
962  return rl;
963 }
bool bound_db_owned_resources_p(db_owned_resources f, db_symbol k)
#define DB_RESOURCE(x)
DB_RESOURCE.

References bound_db_owned_resources_p(), CONS, DB_OK, DB_RESOURCE, DB_RESOURCES_MAP, find_or_create_db_symbol(), get_resource(), NIL, and pips_debug.

Referenced by delete_named_resources().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ db_save_and_free_memory_resource_if_any()

void db_save_and_free_memory_resource_if_any ( const char *  rname,
const char *  oname,
bool  do_free 
)
Parameters
rnamename
onamename
do_freeo_free

Definition at line 1012 of file database.c.

1014 {
1015  db_resource r;
1016  DB_OK;
1017 
1018  pips_debug(8, "maybe saving%s... %s[%s]\n",
1019  do_free? " and freeing":"", rname, oname);
1020 
1021  r = get_db_resource(rname, oname);
1022  if (!db_resource_undefined_p(r) &&
1024  db_save_and_free_resource(rname, oname, r, do_free);
1025 }
static void db_save_and_free_resource(const char *rname, const char *oname, db_resource r, bool do_free)
Definition: database.c:648

References DB_OK, db_resource_loaded_and_stored_p, db_resource_loaded_p, db_resource_undefined_p, db_save_and_free_resource(), get_db_resource(), and pips_debug.

Referenced by db_close_module().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ db_save_pips_database()

void db_save_pips_database ( FILE *  fd)

db_resources dbres;

??? check for required resources left over?

save a cleaned COPY with status artificially set as STORED...

dbres = copy_db_resources(get_pips_database()); db_clean_db_resources(dbres);

free_db_resources(dbres);

Parameters
fdd

Definition at line 137 of file database.c.

138 {
139  /* db_resources dbres; */
140  DB_OK;
141  /* ??? check for required resources left over? */
142 
143  /* save a cleaned COPY with status artificially set as STORED... */
144  /* dbres = copy_db_resources(get_pips_database());
145  db_clean_db_resources(dbres);*/
146  write_db_resources(fd, get_pips_database());
147  /* free_db_resources(dbres); */
148 }
void write_db_resources(FILE *f, db_resources p)

References DB_OK, and write_db_resources().

Referenced by save_meta_data().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ db_set_current_builder_name()

void db_set_current_builder_name ( const char *  name)
Parameters
nameame

Definition at line 128 of file lowlevel.c.

129 {
130  pips_assert("no current builder", !current_builder);
131  current_builder = strdup(name);
132 }

References current_builder, pips_assert, and strdup().

+ Here is the call graph for this function:

◆ db_set_current_module_name()

bool db_set_current_module_name ( const char *  name)

can be rejected softly

Parameters
nameame

Definition at line 1045 of file database.c.

1046 {
1047  bool ok = false;
1048  DB_OK; pips_assert("no current module", !current_module_name);
1049  if (simple_name_p(name)) {
1050  current_module_name = strdup(name);
1052  ok = true;
1053  } else /* can be rejected softly */
1054  pips_user_warning("invalid module name \"%s\"\n", name);
1055  return ok;
1056 }
static bool simple_name_p(const char *name)
Module names must use some characters.
Definition: database.c:80
static void init_owned_resources_if_necessary(const char *name)
Definition: database.c:223

References current_module_name, DB_OK, init_owned_resources_if_necessary(), ok, pips_assert, pips_user_warning, simple_name_p(), and strdup().

Referenced by display(), open_module(), and perform().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ db_set_resource_as_required()

void db_set_resource_as_required ( const char *  rname,
const char *  oname 
)

newly created db_resource...

Parameters
rnamename
onamename

Definition at line 797 of file database.c.

798 {
799  db_resource r;
800  db_status s;
801  DB_OK;
802 
803  pips_debug(5, "set %s[%s] as required at %d\n", rname, oname,
805 
806  r = find_or_create_db_resource(rname, oname);
807  s = db_resource_db_status(r);
808  if (db_status_undefined_p(s)) {
809  /* newly created db_resource... */
811  }
812  else
813  {
814  pips_debug(1, "set %s[%s] as 'required' from '%s' at %d\n",
815  rname, oname,
818 
821  {
822  dbll_free_resource(rname, oname, db_resource_pointer(r));
823  db_resource_pointer(r) = NULL;
824  }
825  }
826 
829 }
db_status make_db_status(enum db_status_utype tag, void *val)
#define UU
Definition: newgen_types.h:98
int db_get_logical_time(void)
Definition: workspace.c:112
#define db_status_tag(x)
#define db_status_loaded_and_stored_p(x)
@ is_db_status_required
#define db_status_loaded_p(x)

References db_get_logical_time(), DB_OK, db_resource_db_status, db_resource_pointer, db_resource_time, db_status_loaded_and_stored_p, db_status_loaded_p, db_status_string(), db_status_tag, db_status_undefined_p, dbll_free_resource(), find_or_create_db_resource(), is_db_status_required, make_db_status(), pips_debug, and UU.

Referenced by rmake().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ db_time_of_resource()

int db_time_of_resource ( const char *  rname,
const char *  oname 
)

we load the resource if it is a simple file name... the file time stamps are checked here anyway.

will update time if needed.

may update time...

Parameters
rnamename
onamename

Definition at line 603 of file database.c.

604 {
605  db_resource r;
606  DB_OK;
607 
608  r = get_db_resource(rname, oname);
609 
611  return -1;
612 
613  /* we load the resource if it is a simple file name...
614  * the file time stamps are checked here anyway.
615  */
616  if (displayable_file_p(rname))
617  {
618  if (db_resource_stored_p(r))
619  db_load_resource(rname, oname, r); /* will update time if needed. */
620  else
621  db_check_time(rname, oname, r); /* may update time... */
622  }
623 
624  return db_resource_time(r);
625 }
static void db_check_time(const char *rname, const char *oname, db_resource r)
Definition: database.c:547
static void db_load_resource(const char *rname, const char *oname, db_resource r)
Definition: database.c:587
bool displayable_file_p(const char *name)
rather approximated.
Definition: lowlevel.c:361

References db_check_time(), db_load_resource(), DB_OK, db_resource_required_p, db_resource_stored_p, db_resource_time, db_resource_undefined_p, displayable_file_p(), and get_db_resource().

Referenced by check_physical_resource_up_to_date(), and rmake().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ db_touch_resource()

bool db_touch_resource ( const char *  rname,
const char *  oname 
)

touch logical time for resource[owner], possibly behind the back of pipsdbm.

Parameters
rnamename
onamename

Definition at line 538 of file database.c.

539 {
540  db_resource r;
541  DB_OK;
542  r = get_real_db_resource(rname, oname);
544  return true;
545 }

References db_get_logical_time(), DB_OK, db_resource_time, get_real_db_resource(), and STUB_ERROR.

Referenced by AddEntityToCompilationUnit(), linearize_array_generic(), normalize_microcode(), outliner_independent(), preserve_virtual_resource(), RemoveEntityFromCompilationUnit(), sort_parameters(), and touch_a_resource().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ db_unput_resources()

int db_unput_resources ( const char *  rname)

Delete all the resources of a given type "rname".

Return the number of deleted resources

Each owner map has to be checked because of two-level mapping used.

Parameters
rnamename

Definition at line 915 of file database.c.

916 {
917  db_symbol r;
918  int count = 0;
919  DB_OK;
920  r = find_or_create_db_symbol(rname);
921  DB_RESOURCES_MAP(s, or,
922  {
923  pips_debug(7, "deleting %s[%s] if any\n", rname, db_symbol_name(s));
924  if (bound_db_owned_resources_p(or, r)) {
926  dbll_unlink_resource_file(rname, db_symbol_name(s), false);
927  count ++;
928  }
929  },
930  get_pips_database());
931  return count;
932 }
static int count
Definition: SDG.c:519

References bound_db_owned_resources_p(), count, db_delete_resource(), DB_OK, DB_RESOURCES_MAP, db_symbol_name, dbll_unlink_resource_file(), find_or_create_db_symbol(), and pips_debug.

Referenced by activate_phase(), db_delete_all_resources(), and delete_named_resources().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ db_update_time()

bool db_update_time ( const char *  rname,
const char *  oname 
)

this should really be a put.

Just there for upward compatibility.

bll_stat_resource_file(rname, oname, true);

Parameters
rnamename
onamename

Definition at line 380 of file database.c.

381 {
382  db_resource r;
383  DB_OK;
384  pips_assert("displayable resource", displayable_file_p(rname));
385  r = get_real_db_resource(rname, oname);
388  dbll_stat_local_file((char*) db_resource_pointer(r), false);
389  /*dbll_stat_resource_file(rname, oname, true); */
390  return true;
391 }
int dbll_stat_local_file(const char *file_name, bool okifnotthere)
It is impportant that the workspace directory does not appear in the file name so as to allow workspa...
Definition: lowlevel.c:251

References db_get_logical_time(), DB_OK, db_resource_file_time, db_resource_pointer, db_resource_time, dbll_stat_local_file(), displayable_file_p(), get_real_db_resource(), and pips_assert.

+ Here is the call graph for this function:

◆ dbll_check_resource()

bool dbll_check_resource ( const char *  rname,
const char *  oname,
void *  p 
)

Internal consistency of the resource, not the global consistency wrt other resources and pipsmake rules which is managed by the pipsmake library at a higher level.

Know right away which resource is Newgen inconsistent

FI: I find this message I have added myself pretty useless in general as a core dump occurs in case some inconsistency is found.

Parameters
rnamename
onamename

Definition at line 324 of file lowlevel.c.

325 {
326  methods * m;
327  /* Know right away which resource is Newgen inconsistent */
328  pips_debug(9, "checking Newgen resource consistency %s[%s] (0x%p)\n",
329  rname, oname, p);
330  m = get_methods(rname);
331  bool b = m->check_function(p);
332  /* FI: I find this message I have added myself pretty useless in
333  general as a core dump occurs in case some inconsistency is
334  found. */
335  pips_debug(9, "checking Newgen resource consistency %s[%s] (0x%p): %s\n",
336  rname, oname, p,
337  bool_to_string(b));
338  return b;
339 }
static methods * get_methods(const char *name)
gcc version
Definition: lowlevel.c:88
string bool_to_string(bool)
Definition: string.c:243
CHECKER check_function
Definition: lowlevel.c:53

References bool_to_string(), methods::check_function, get_methods(), and pips_debug.

Referenced by db_get_memory_resource(), and db_put_or_update_memory_resource().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dbll_database_managed_file_p()

bool dbll_database_managed_file_p ( const char *  name)

returns whether the file is managed within the database.

that is it is not a SOURCE_FILE. basically SOURCE_FILEs are given relative names with leading . or /, while within the database a leading "*.database/" is always appended.

Parameters
nameame

Definition at line 376 of file lowlevel.c.

377 {
378  return name[0]!='.' && name[0]!='/';
379 }

Referenced by db_check_time().

+ Here is the caller graph for this function:

◆ dbll_free_resource()

void dbll_free_resource ( const char *  rname,
const char *  oname,
void *  p 
)
Parameters
rnamename
onamename

Definition at line 313 of file lowlevel.c.

314 {
315  methods * m;
316  pips_debug(7, "freeing resource %s[%s] (%p)\n", rname, oname, p);
317  m = get_methods(rname);
318  m->free_function(p);
319 }
FREER free_function
Definition: lowlevel.c:52

References methods::free_function, get_methods(), and pips_debug.

Referenced by db_delete_resource(), db_save_and_free_resource(), db_set_resource_as_required(), and dbll_save_and_free_resource().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dbll_get_ith_resource_name()

string dbll_get_ith_resource_name ( int  i)

Definition at line 113 of file lowlevel.c.

114 {
115  pips_assert("valid resource number", i>=0 && i<dbll_number_of_resources());
116  return all_methods[i].name;
117 }
static methods all_methods[]
sigh...
Definition: lowlevel.c:78
string name
Definition: lowlevel.c:49

References all_methods, dbll_number_of_resources(), methods::name, and pips_assert.

Referenced by db_close_module(), and db_delete_all_resources().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dbll_load_resource()

void* dbll_load_resource ( const char *  rname,
const char *  oname 
)
Parameters
rnamename
onamename

Definition at line 294 of file lowlevel.c.

295 {
296  methods * m;
297  FILE * f;
298  void * p = NULL;
299  pips_debug(7, "loading resource %s[%s]\n", rname, oname);
300 
301  dbll_current_module = oname;
302  m = get_methods(rname);
303  if (m->read_function==no_read)
304  pips_internal_error("cannot load %s of %s, no load function",
305  rname, oname);
306  f = open_resource_file(rname, oname, "r");
307  p = m->read_function(f);
308  close_resource_file(f, rname, oname);
309  dbll_current_module = (string) NULL;
310  return p;
311 }
static void close_resource_file(FILE *file, const char *rname, const char *oname)
Definition: lowlevel.c:206
static FILE * open_resource_file(const char *rname, const char *oname, const char *what)
Definition: lowlevel.c:197
#define no_read
Definition: lowlevel.c:57
const char * dbll_current_module
the current module is expected by some load/save functions...
Definition: lowlevel.c:41
#define pips_internal_error
Definition: misc-local.h:149
char * string
STRING.
Definition: newgen_types.h:39
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15
READER read_function
Definition: lowlevel.c:50

References close_resource_file(), dbll_current_module, f(), get_methods(), no_read, open_resource_file(), pips_debug, pips_internal_error, and methods::read_function.

Referenced by db_load_resource().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dbll_number_of_resources()

int dbll_number_of_resources ( void  )

I'm not sure sizeof(all_methods) is ANSI C. FC

Definition at line 108 of file lowlevel.c.

109 { /* I'm not sure sizeof(all_methods) is ANSI C. FC */
110  return sizeof(all_methods)/sizeof(methods) - 1;
111 }

References all_methods.

Referenced by db_close_module(), db_delete_all_resources(), dbll_get_ith_resource_name(), and get_methods().

+ Here is the caller graph for this function:

◆ dbll_save_and_free_resource()

void dbll_save_and_free_resource ( const char *  rname,
const char *  oname,
void *  p,
bool  do_free 
)
Parameters
rnamename
onamename
do_freeo_free

Definition at line 350 of file lowlevel.c.

352 {
353  dbll_save_resource(rname, oname, p);
354  if (do_free) dbll_free_resource(rname, oname, p);
355 }
void dbll_save_resource(const char *rname, const char *oname, void *p)
save rname of oname p.
Definition: lowlevel.c:275

References dbll_free_resource(), and dbll_save_resource().

Referenced by db_save_and_free_resource().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dbll_save_resource()

void dbll_save_resource ( const char *  rname,
const char *  oname,
void *  p 
)

save rname of oname p.

get the method, then apply it.

Parameters
rnamename
onamename

Definition at line 275 of file lowlevel.c.

276 {
277  methods * m;
278  FILE * f;
279  pips_debug(7, "saving resource %s[%s] (0x%p)\n", rname, oname, p);
280 
281  dbll_current_module = oname;
282  m = get_methods(rname);
283  if (m->write_function==no_write) {
284  pips_user_warning("resource %s of %s lost, no unload function\n",
285  rname, oname);
286  } else {
287  f = open_resource_file(rname, oname, "w");
288  m->write_function(f, p);
289  close_resource_file(f, rname, oname);
290  }
291  dbll_current_module = (string) NULL;
292 }
#define no_write
Definition: lowlevel.c:58
WRITER write_function
Definition: lowlevel.c:51

References close_resource_file(), dbll_current_module, f(), get_methods(), no_write, open_resource_file(), pips_debug, pips_user_warning, and methods::write_function.

Referenced by db_save_resource(), and dbll_save_and_free_resource().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dbll_stat_local_file()

int dbll_stat_local_file ( const char *  file_name,
bool  okifnotthere 
)

It is impportant that the workspace directory does not appear in the file name so as to allow workspaces to be moveable.

Parameters
file_nameile_name
okifnottherekifnotthere

Definition at line 251 of file lowlevel.c.

252 {
253  string full_name;
254  int time;
255  if (file_name[0]!='/' && file_name[0]!='.') {
256  string dir_name = db_get_current_workspace_directory();
257  full_name = strdup(concatenate(dir_name, "/", file_name, NULL));
258  free(dir_name);
259  } else full_name = strdup(file_name);
260  time = dbll_stat_file(full_name, okifnotthere);
261  free(full_name);
262  return time;
263 }
#define full_name(dir, name)
Definition: compile.c:414
static int dbll_stat_file(const char *file_name, bool okifnotthere)
returns 0 on errors (say no file).
Definition: lowlevel.c:232
static string file_name

References concatenate(), db_get_current_workspace_directory(), dbll_stat_file(), file_name, free(), full_name, and strdup().

Referenced by db_check_time(), db_put_or_update_memory_resource(), and db_update_time().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dbll_stat_resource_file()

int dbll_stat_resource_file ( const char *  rname,
const char *  oname,
bool  okifnotthere 
)
Parameters
rnamename
onamename
okifnottherekifnotthere

Definition at line 265 of file lowlevel.c.

266 {
267  string file_name = get_resource_file_name(rname, oname);
268  int time = dbll_stat_file(file_name, okifnotthere);
269  free(file_name);
270  return time;
271 }
string get_resource_file_name(const char *rname, const char *oname)
allocate a full file name for the given resource.
Definition: lowlevel.c:187

References dbll_stat_file(), file_name, free(), and get_resource_file_name().

Referenced by db_check_time(), db_clean_db_resources(), db_save_and_free_resource(), and db_save_resource().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dbll_storable_p()

bool dbll_storable_p ( const char *  rname)
Parameters
rnamename

Definition at line 341 of file lowlevel.c.

342 {
343  methods * m = get_methods(rname);
344  return m->write_function!=no_write;
345 }

References get_methods(), no_write, and methods::write_function.

Referenced by db_get_memory_resource(), db_save_and_free_resource(), and db_save_resource().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dbll_unlink_resource_file()

void dbll_unlink_resource_file ( const char *  rname,
const char *  oname,
bool  erroriffailed 
)
Parameters
rnamename
onamename
erroriffailedrroriffailed

Definition at line 219 of file lowlevel.c.

220 {
221  string full_name = get_resource_file_name(rname, oname);
222  if (unlink(full_name) && erroriffailed) {
223  perror(full_name);
224  pips_internal_error("cannot unlink resource %s of %s", rname, oname);
225  }
226  free(full_name);
227 }

References free(), full_name, get_resource_file_name(), and pips_internal_error.

Referenced by db_delete_obsolete_resources(), and db_unput_resources().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dbll_very_special_resource_p()

bool dbll_very_special_resource_p ( const char *  rname,
const char *  oname 
)
Parameters
rnamename
onamename

Definition at line 119 of file lowlevel.c.

120 {
121  return same_string_p(rname, DBR_ENTITIES) && same_string_p(oname, "");
122 }

References same_string_p.

Referenced by db_load_resource(), and db_save_and_free_resource().

+ Here is the caller graph for this function:

◆ dbm_start_timer()

void dbm_start_timer ( void  )

Definition at line 131 of file misc.c.

132 {
134 }
static struct tms dbm_time
Definition: misc.c:81
static void set_current_time(struct tms *now, double *rnow)
set current usage and time in two formats
Definition: misc.c:98
static double real_dbm_time
Definition: misc.c:82

References dbm_time, real_dbm_time, and set_current_time().

+ Here is the call graph for this function:

◆ dbm_stop_timer()

void dbm_stop_timer ( void  )

accumulate dbm related times for one phase

Definition at line 137 of file misc.c.

138 {
139  struct tms current;
140  double real_current;
141 
142  set_current_time(&current, &real_current);
143 
144  // ??? does not include sub process time!
145  total_dbm_time.tms_utime += current.tms_utime - dbm_time.tms_utime;
146  total_dbm_time.tms_stime += current.tms_stime - dbm_time.tms_stime;
147  real_total_dbm_time += real_current - real_dbm_time;
148 }
static struct tms total_dbm_time
Definition: misc.c:84
static double real_total_dbm_time
Definition: misc.c:85
static size_t current
Definition: string.c:115

References current, dbm_time, real_dbm_time, real_total_dbm_time, set_current_time(), and total_dbm_time.

+ Here is the call graph for this function:

◆ declarations_read()

hash_table declarations_read ( FILE *  f)

Definition at line 345 of file externals.c.

346 {
348  int c;
349  while ((c = getc(f)) && c != EOF)
350  {
351  ungetc(c,f);
352  char* key = safe_readline(f);
353  _int value = atoi(safe_readline(f));
354 
355  hash_put(result,key,(void*)value);
356  }
357  return result;
358 }
char * safe_readline(FILE *file)
returns the allocated line read, whatever its length.
Definition: file.c:497
hash_table hash_table_make(hash_key_type key_type, size_t size)
Definition: hash.c:294
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.
Definition: hash.c:364
@ hash_string
Definition: newgen_hash.h:32
intptr_t _int
_INT
Definition: newgen_types.h:53

References f(), hash_put(), hash_string, hash_table_make(), and safe_readline().

+ Here is the call graph for this function:

◆ declarations_write()

void declarations_write ( FILE *  f,
hash_table  h 
)

Functions to read and write declarations resource, which is a hash table whose key and value are string (keyword/typedef and TK_keyword/TK_typedef)

Definition at line 335 of file externals.c.

336 {
337  HASH_MAP(k,v,
338  {
339  fprintf(f, "%s\n", (char *) k);
340  fprintf(f, "%td\n", (_int) v);
341  },h);
342 }
#define HASH_MAP(k, v, code, ht)
Definition: newgen_hash.h:60

References f(), fprintf(), and HASH_MAP.

+ Here is the call graph for this function:

◆ displayable_file_p()

bool displayable_file_p ( const char *  name)

rather approximated.

beware that this function is used to check whether a resource is a file, and also to check its current time on pipsmake dependencies.

Parameters
nameame

Definition at line 361 of file lowlevel.c.

362 {
363  methods * m = get_methods(name);
364  return
365  // the resource itself is a string
367  // and the resource names ends with "_FILE"
368  find_suffix((string) name, "_FILE");
369 }
static void writeln_string(FILE *f, void *p)
Definition: lowlevel.c:60
string find_suffix(const string, const string)
Find if a string s end with a suffix.
Definition: string.c:273

References find_suffix(), get_methods(), methods::write_function, and writeln_string().

Referenced by db_check_time(), db_put_or_update_memory_resource(), db_save_resource(), db_time_of_resource(), db_update_time(), get_view_file(), just_show(), and show().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dont_interrupt_pipsmake_asap()

void dont_interrupt_pipsmake_asap ( void  )

Definition at line 53 of file misc.c.

54 {
56 }
static bool flag_interrupt_pipsmake_asap
Definition: misc.c:46

References flag_interrupt_pipsmake_asap.

Referenced by apply(), concurrent_apply(), delete_some_resources(), and make().

+ Here is the caller graph for this function:

◆ dump_all_db_resource_status()

void dump_all_db_resource_status ( FILE *  file,
string  where 
)
Parameters
fileile
wherehere

Definition at line 198 of file database.c.

199 {
200  pips_debug(1, "doing at '%s'\n", where);
201 
202  DB_RESOURCES_MAP(os, or,
203  {
205  {
206  string rn = db_symbol_name(rs);
207  string on = db_symbol_name(os);
208  fprintf(file, "resource %s[%s] status '%s' since %td (%td) 0x%p\n",
209  rn, on,
211  db_resource_time(r),
214  },
215  or);
216  },
217  get_pips_database());
218 
219 }

References DB_OWNED_RESOURCES_MAP, db_resource_db_status, db_resource_file_time, db_resource_pointer, db_resource_time, DB_RESOURCES_MAP, db_status_string(), db_symbol_name, fprintf(), and pips_debug.

Referenced by db_checkpoint_workspace(), db_clean_db_resources(), and db_open_pips_database().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ free_static_control_mapping()

void free_static_control_mapping ( statement_mapping  map)

Modification Dec 11 1995: ne pas utiliser free_static_control car il libere des champs qui appartiennent a d'autres structures que celles controlees par static_controlize...(champs d'origine) Les liberation de ces champs par un autre transformer (use_def_elim) entrainait alors un core dump au niveau de cette procedure.

On fait a la place des gen_free_list en detail –DB ]

Parameters
mapap

Definition at line 318 of file externals.c.

319 {
320  STATEMENT_MAPPING_MAP(s, val, {
326  gen_free( (void*) val );
327  }, map);
328 
330 }
void gen_free(gen_chunk *obj)
version without shared_pointers.
Definition: genClib.c:992
#define FREE_STATEMENT_MAPPING(map)
Definition: newgen-local.h:45
#define STATEMENT_MAPPING_MAP(s, v, code, h)
Definition: newgen-local.h:53
#define static_control_loops(x)
Definition: paf_ri.h:757
#define static_control_params(x)
Definition: paf_ri.h:755
#define static_control_tests(x)
Definition: paf_ri.h:759

References FREE_STATEMENT_MAPPING, gen_free(), gen_free_list(), STATEMENT_MAPPING_MAP, static_control_loops, static_control_params, and static_control_tests.

+ Here is the call graph for this function:

◆ genread_input()

int genread_input ( void  )

◆ get_logged_resources()

void get_logged_resources ( set sr,
set sw 
)

Get the made sets.

Parameters
srr
sww

Definition at line 268 of file misc.c.

269 {
270  *sr = res_read;
271  *sw = res_write;
272 }

References res_read, and res_write.

Referenced by do_resource_usage_check().

+ Here is the caller graph for this function:

◆ get_main_entity_name()

string get_main_entity_name ( void  )

Return the local name of the main module if it is available, or the local name of any module by default.

Hopefully, the module names are sorted and the same module of rank 0 is always returned.

A new string is allocated.

Up to a memory leak: entity get_main_entity(void) == module_name_to_entity(get_main_entity_name())

??? some default if there is no main...

This has an impact on interprocedural analysis and especially semantics and works well if only one function is analyzed.

Definition at line 63 of file util.c.

64 {
65  string mn = string_undefined;
66  char buffer[MAXIMAL_MODULE_NAME_SIZE]; // defined in naming.h
68  "/", MAIN_FILE_NAMES, NULL));
69  FILE * fm = fopen(main_list, "r");
70  buffer[0] = 0;
71  if (fm!=NULL) {
72  // FI: we assume here that we have only one main function
74  fclose(fm);
75  // Drop the final LF
76  mn = strndup(buffer, strlen(buffer)-1);
77  }
78  else {
79  // FI: a module list is an array ?
80  gen_array_t modules = db_get_module_list();
81  int nmodules = gen_array_nitems(modules);
82 
83  pips_assert("some modules in the program", nmodules>0);
84  /* ??? some default if there is no main...
85  *
86  * This has an impact on interprocedural analysis and especially
87  * semantics and works well if only one function is analyzed.
88  */
89  pips_user_warning("No main function found, use \"%s\" instead.\n",
90  gen_array_item(modules,0));
91  mn = strdup(gen_array_item(modules, 0));
92 
93  gen_array_full_free(modules);
94  }
95  return mn;
96 }
size_t gen_array_nitems(const gen_array_t a)
Definition: array.c:131
void gen_array_full_free(gen_array_t a)
Definition: array.c:77
void * gen_array_item(const gen_array_t a, size_t i)
Definition: array.c:143
char * safe_fgets(char *s, int n, FILE *stream, char *filename)
Definition: file.c:170
gen_array_t db_get_module_list(void)
Get an array of all the modules (functions, procedures and compilation units) of a workspace.
Definition: database.c:1266
#define MAXIMAL_MODULE_NAME_SIZE
In C, the module name may include file names, the compilation unit name and the user name of the func...
Definition: naming-local.h:112
#define string_undefined
Definition: newgen_types.h:40
#define MAIN_FILE_NAMES
Name of the file containing the names of the main procedures.
Definition: pipsdbm-local.h:41
static string buffer
Definition: string.c:113
char * strndup(char const *s, size_t n)
A replacement function, for systems that lack strndup.
Definition: strndup.c:26

References buffer, concatenate(), db_get_current_workspace_directory(), db_get_module_list(), gen_array_full_free(), gen_array_item(), gen_array_nitems(), MAIN_FILE_NAMES, MAXIMAL_MODULE_NAME_SIZE, pips_assert, pips_user_warning, safe_fgets(), strdup(), string_undefined, and strndup().

Referenced by generic_program_pointer_values(), print_program_precondition(), program_points_to(), program_postcondition(), and program_precondition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_request_string_timers()

void get_request_string_timers ( string global,
string phases,
string dbm 
)

compute times elapsed since init_request_log_timers(), i.e.

for one request to pipsmake (btw this code is misplaced...)

Parameters
globallobal
phaseshases
dbmbm

Definition at line 196 of file misc.c.

197 {
198  struct tms total_request_time;
199  double real_total_request_time;
200  static char s1[MAX_TIME_STRING_LENGTH];
201  static char s2[MAX_TIME_STRING_LENGTH];
202  static char s3[MAX_TIME_STRING_LENGTH];
203 
204  set_current_time(&total_request_time, &real_total_request_time);
205 
206  // switch to accumulator
207  total_request_time.tms_utime -= request_time.tms_utime;
208  total_request_time.tms_stime -= request_time.tms_stime;
209  real_total_request_time -= real_request_time;
210 
211  long HZ = sysconf(_SC_CLK_TCK);
212 
213  sprintf (s1, "(r%.3f u%.2f s%.2f)\n",
214  real_total_request_time,
215  (double) total_request_time.tms_utime / HZ,
216  (double) total_request_time.tms_stime / HZ);
217 
218  sprintf (s2, "(r%.3f u%.2f s%.2f)\n",
220  (double) request_phase_time.tms_utime / HZ,
221  (double) request_phase_time.tms_stime / HZ);
222 
223  sprintf (s3, "(r%.3f u%.2f s%.2f)\n",
225  (double) request_dbm_time.tms_utime / HZ,
226  (double) request_dbm_time.tms_stime / HZ);
227 
228  *global = s1;
229  *phases = s2;
230  *dbm = s3;
231 }
static struct tms request_phase_time
Definition: misc.c:71
static struct tms request_time
Timing of one request.
Definition: misc.c:68
#define MAX_TIME_STRING_LENGTH
Definition: misc.c:150
static double real_request_dbm_time
Definition: misc.c:75
static double real_request_phase_time
Definition: misc.c:72
static struct tms request_dbm_time
Definition: misc.c:74
static double real_request_time
Definition: misc.c:69
s1
Definition: set.c:247

References MAX_TIME_STRING_LENGTH, real_request_dbm_time, real_request_phase_time, real_request_time, request_dbm_time, request_phase_time, request_time, s1, and set_current_time().

Referenced by logs_off().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_resource_file_name()

string get_resource_file_name ( const char *  rname,
const char *  oname 
)

allocate a full file name for the given resource.

Parameters
rnamename
onamename

Definition at line 187 of file lowlevel.c.

188 {
189  string dir_name, file_name;
190  if (same_string_p(oname, "")) oname = DEFAULT_OWNER_NAME;
191  dir_name = db_get_directory_name_for_module(oname);
192  file_name = strdup(concatenate(dir_name, "/", rname, NULL));
193  free(dir_name);
194  return file_name;
195 }

References concatenate(), db_get_directory_name_for_module(), DEFAULT_OWNER_NAME, file_name, free(), same_string_p, and strdup().

Referenced by close_resource_file(), dbll_stat_resource_file(), dbll_unlink_resource_file(), f95split(), open_resource_file(), and process_user_file().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_string_timers()

void get_string_timers ( string with_io,
string io 
)

compute times elapsed since init_log_timers(), i.e.

for one phase

accumulate phase times in request times, ignoring sub-processes ???

Parameters
with_ioith_io
ioo

Definition at line 155 of file misc.c.

156 {
157  struct tms total_phase_time;
158  double real_total_phase_time;
159  static char s1[MAX_TIME_STRING_LENGTH];
160  static char s2[MAX_TIME_STRING_LENGTH];
161 
162  set_current_time(&total_phase_time, &real_total_phase_time);
163 
164  // switch stop start time to an accumulator
165  total_phase_time.tms_utime -= phase_time.tms_utime;
166  total_phase_time.tms_stime -= phase_time.tms_stime;
167  real_total_phase_time -= real_phase_time;
168 
169  long HZ = sysconf(_SC_CLK_TCK);
170 
171  sprintf (s1, "(r%.3f u%.2f s%.2f)\n",
172  real_total_phase_time,
173  (double) total_phase_time.tms_utime / HZ,
174  (double) total_phase_time.tms_stime / HZ);
175 
176  sprintf (s2,"(r%.3f u%.2f s%.2f)\n",
178  (double) total_dbm_time.tms_utime / HZ,
179  (double) total_dbm_time.tms_stime / HZ);
180 
181  *with_io = s1; *io = s2;
182 
183  /* accumulate phase times in request times, ignoring sub-processes ??? */
184  request_dbm_time.tms_utime += total_dbm_time.tms_utime;
185  request_dbm_time.tms_stime += total_dbm_time.tms_stime;
187 
188  request_phase_time.tms_utime += total_phase_time.tms_utime;
189  request_phase_time.tms_stime += total_phase_time.tms_stime;
190  real_request_phase_time += real_total_phase_time;
191 }
static double real_phase_time
Definition: misc.c:79
static struct tms phase_time
Timing of one phase.
Definition: misc.c:78

References MAX_TIME_STRING_LENGTH, phase_time, real_phase_time, real_request_dbm_time, real_request_phase_time, real_total_dbm_time, request_dbm_time, request_phase_time, s1, set_current_time(), and total_dbm_time.

Referenced by apply_a_rule().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_log_timers()

void init_log_timers ( void  )

Functions for timing one phase.

Definition at line 122 of file misc.c.

123 {
125 
126  total_dbm_time.tms_utime = 0;
127  total_dbm_time.tms_stime = 0;
128  real_total_dbm_time = 0.0;
129 }

References phase_time, real_phase_time, real_total_dbm_time, set_current_time(), and total_dbm_time.

Referenced by apply_a_rule().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_request_timers()

void init_request_timers ( void  )

Functions for timing one request.

initialize accumulators for dbm and phase times

Definition at line 106 of file misc.c.

107 {
109 
110  /* initialize accumulators for dbm and phase times */
111  request_dbm_time.tms_utime = 0;
112  request_dbm_time.tms_stime = 0;
113  real_request_dbm_time = 0.0;
114 
115  request_phase_time.tms_utime = 0;
116  request_phase_time.tms_stime = 0;
118 }

References real_request_dbm_time, real_request_phase_time, real_request_time, request_dbm_time, request_phase_time, request_time, and set_current_time().

Referenced by logs_on().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_resource_usage_check()

void init_resource_usage_check ( void  )

init variables

Definition at line 240 of file misc.c.

241 {
248 }
set set_clear(set)
Assign the empty set to s s := {}.
Definition: set.c:326
@ set_string
Definition: newgen_set.h:42
set set_make(set_type)
Create an empty set of any type but hash_private.
Definition: set.c:102

References res_read, res_write, set_clear(), set_make(), set_string, and set_undefined_p.

Referenced by apply_a_rule().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ interrupt_pipsmake_asap()

void interrupt_pipsmake_asap ( void  )

misc.c

Definition at line 48 of file misc.c.

49 {
51 }

References flag_interrupt_pipsmake_asap.

Referenced by pips_signal_handler(), and wpips_interrupt_pipsmake().

+ Here is the caller graph for this function:

◆ interrupt_pipsmake_asap_p()

bool interrupt_pipsmake_asap_p ( void  )

Definition at line 58 of file misc.c.

59 {
62  return res;
63 }

References flag_interrupt_pipsmake_asap.

Referenced by apply_a_rule().

+ Here is the caller graph for this function:

◆ pipsdbm_check_statement_mapping()

bool pipsdbm_check_statement_mapping ( statement_mapping  h)

a little bit partial, because domain are not checked.

Definition at line 178 of file externals.c.

179 {
180  STATEMENT_MAPPING_MAP(k, v, {
181  pips_assert("consistent statement",
183  pips_assert("consistent val", gen_consistent_p((void*) v));
184  },
185  h);
186  return true;
187 }
bool statement_consistent_p(statement p)
Definition: ri.c:2195
int gen_consistent_p(gen_chunk *obj)
GEN_CONSISTENT_P dynamically checks the type correctness of OBJ.
Definition: genClib.c:2398

References gen_consistent_p(), pips_assert, statement_consistent_p(), and STATEMENT_MAPPING_MAP.

+ Here is the call graph for this function:

◆ pipsdbm_consistent_statement_function()

bool pipsdbm_consistent_statement_function ( gen_chunkp  map)
Parameters
mapap

Definition at line 226 of file externals.c.

227 {
228  hash_table h = (map+1)->h;
230  {
231  if (gen_type((void*)s)!=statement_domain) return false;
232  if (!gen_consistent_p((void*)x)) return false;
233  },
234  h);
235  return true;
236 }
#define STATEMENT_FUNCTION_MAP(k, v, code, _map_hash_h)
this piece of code makes low level assumptions about newgen internals.
Definition: externals.c:202
int gen_type(gen_chunk *obj)
GEN_TYPE returns the domain number for the object in argument.
Definition: genClib.c:82
#define statement_domain
newgen_sizeofexpression_domain_defined
Definition: ri.h:362
static char * x
Definition: split_file.c:159

References gen_consistent_p(), gen_type(), statement_domain, STATEMENT_FUNCTION_MAP, and x.

+ Here is the call graph for this function:

◆ pipsdbm_free_entities()

void pipsdbm_free_entities ( char *  p)

Definition at line 72 of file externals.c.

73 {
74  pips_assert("argument not used", p==p);
76 }
int gen_free_tabulated(int domain)
free tabulated elements of this domain.
Definition: genClib.c:1461
#define entity_domain
newgen_syntax_domain_defined
Definition: ri.h:410

References entity_domain, gen_free_tabulated(), and pips_assert.

+ Here is the call graph for this function:

◆ pipsdbm_free_statement_mapping()

void pipsdbm_free_statement_mapping ( statement_mapping  h)

Definition at line 190 of file externals.c.

191 {
192  STATEMENT_MAPPING_MAP(k, v, gen_free((void*) v), h);
194 }

References FREE_STATEMENT_MAPPING, gen_free(), and STATEMENT_MAPPING_MAP.

+ Here is the call graph for this function:

◆ pipsdbm_read_entities()

char* pipsdbm_read_entities ( FILE *  fd)

externals.c

Parameters
fdd

Definition at line 64 of file externals.c.

65 {
66  int read = gen_read_tabulated(fd, false);
67  pips_assert("entities were read", read==entity_domain);
68  return (char *) entity_domain;
69 }
int gen_read_tabulated(FILE *file, int create_p)
GEN_READ_TABULATED reads FILE to update the Gen_tabulated_ table.
Definition: genClib.c:2334

References entity_domain, gen_read_tabulated(), and pips_assert.

+ Here is the call graph for this function:

◆ pipsdbm_read_statement_function()

gen_chunkp pipsdbm_read_statement_function ( FILE *  fd)

Should use a higher level pipsdbm_read_statement_mapping() to survive to XML.

get meta data.

allocate the statement function.

now reads each couple and rebuild the function.

Parameters
fdd

Definition at line 271 of file externals.c.

272 {
273  statement stat;
274  int domain, n;
275  gen_chunkp result;
276  hash_table h;
277 
278  pips_assert("some current module name", dbll_current_module);
279  pips_debug(3, "statement -> ??? for %s\n", dbll_current_module);
280  stat = (statement)
282 
284 
285  /* get meta data.
286  */
287  domain = lire_int(fd);
288  n = lire_int(fd);
289 
290  /* allocate the statement function.
291  */
292  result = gen_alloc(2*sizeof(gen_chunk), GEN_CHECK_ALLOC, domain);
293  h = (result+1)->h;
294 
295  /* now reads each couple and rebuild the function.
296  */
297  while(n-->0) {
298  int so = lire_int(fd);
299  pips_assert("valid ordering", so!=STATEMENT_ORDERING_UNDEFINED);
300  HASH_EXTEND(p, p, h, ordering_to_statement(so), gen_read(fd));
301  }
302 
304 
305  return result;
306 }
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
static int lire_int(FILE *fd)
reads an int while sharing file and buffers with newgen...
Definition: externals.c:40
#define GEN_CHECK_ALLOC
Definition: genC.h:307
gen_chunk * gen_alloc(int size, int gen_check_p, int dom,...)
allocates something in newgen.
Definition: genClib.c:298
gen_chunk * gen_read(FILE *file)
GEN_READ reads any object from the FILE stream.
Definition: genClib.c:2323
#define STATEMENT_ORDERING_UNDEFINED
mapping.h inclusion
Definition: newgen-local.h:35
#define HASH_EXTEND(start, image, h, k, v)
Definition: newgen_map.h:36
hash_table set_ordering_to_statement(statement s)
To be used instead of initialize_ordering_to_statement() to make sure that the hash table ots is in s...
Definition: ordering.c:172
statement ordering_to_statement(int o)
Get the statement associated to a given ordering.
Definition: ordering.c:111
void reset_ordering_to_statement(void)
Reset the mapping from ordering to statement.
Definition: ordering.c:185
A DOMAIN union describes the structure of a user type.
A gen_chunk is used to store every object.
Definition: genC.h:58

References db_get_memory_resource(), dbll_current_module, gen_alloc(), GEN_CHECK_ALLOC, gen_read(), HASH_EXTEND, lire_int(), ordering_to_statement(), pips_assert, pips_debug, reset_ordering_to_statement(), set_ordering_to_statement(), and STATEMENT_ORDERING_UNDEFINED.

+ Here is the call graph for this function:

◆ pipsdbm_read_statement_mapping()

hash_table pipsdbm_read_statement_mapping ( FILE *  fd)

Read a statement mapping.

This function is quite too low level... It mixes raw getc() from a FILE with gen_read. To survive other NewGen backend (XML), fprintf could be replaced with a gen_getc() that could peek in a CDATA for example in the case of XML.

But in this case it should be a call to something like so = gen_read_int(fd) instead to do even simpler and read an int value (in textual form or in <int>...</int> in the case of XML.

get meta data.

Parameters
fdd

Definition at line 147 of file externals.c.

148 {
149  statement stat;
151  int n;
152 
153  pips_assert("some current module name", dbll_current_module);
154  pips_debug(3, "statement -> ??? for %s\n", dbll_current_module);
155  stat = (statement)
157 
159 
160  /* get meta data.
161  */
162  n = lire_int(fd);
163 
164  while (n-->0) {
165  int so = lire_int(fd);
166  pips_assert("valid ordering", so!=STATEMENT_ORDERING_UNDEFINED);
167  hash_put(result,(void*)ordering_to_statement(so),(void*)gen_read(fd));
168  }
169 
171 
172  return result;
173 }
@ hash_pointer
Definition: newgen_hash.h:32

References db_get_memory_resource(), dbll_current_module, gen_read(), hash_pointer, hash_put(), hash_table_make(), lire_int(), ordering_to_statement(), pips_assert, pips_debug, reset_ordering_to_statement(), set_ordering_to_statement(), and STATEMENT_ORDERING_UNDEFINED.

+ Here is the call graph for this function:

◆ pipsdbm_write_statement_function()

void pipsdbm_write_statement_function ( FILE *  fd,
gen_chunkp  map 
)

the stored stuff need be based on the ordering...

because newgen won't regenerate pointers...

Should use a higher level pipsdbm_write_statement_mapping() to survive to XML

save it!

Parameters
fdfile to write to
mapstatement function

Definition at line 245 of file externals.c.

248 {
249  hash_table h = (map+1)->h;
250  fprintf(fd, "%td\n%d\n", map->i, number_of_ordered_statements(h));
252  {
253  int order = statement_ordering(s);
254  if (order!=STATEMENT_ORDERING_UNDEFINED) { /* save it! */
255  fprintf(fd, "%d\n", order);
256  gen_write(fd, x);
257  }
258  else {
259  pips_user_warning("Statement with illegal ordering, lost data: %s\n",
261  }
262  },
263  h);
264 }
static int number_of_ordered_statements(hash_table h)
count the number of statements with a valid ordering.
Definition: externals.c:213
void gen_write(FILE *fd, gen_chunk *obj)
GEN_WRITE writes the OBJect on the stream FD.
Definition: genClib.c:1745
string statement_identification(statement)
Like external_statement_identification(), but with internal information, the hexadecimal address of t...
Definition: statement.c:1700
#define statement_ordering(x)
Definition: ri.h:2454
_int i
Definition: genC.h:62

References fprintf(), gen_write(), gen_chunk::i, number_of_ordered_statements(), pips_user_warning, STATEMENT_FUNCTION_MAP, statement_identification(), statement_ordering, STATEMENT_ORDERING_UNDEFINED, and x.

+ Here is the call graph for this function:

◆ pipsdbm_write_statement_mapping()

void pipsdbm_write_statement_mapping ( FILE *  fd,
statement_mapping  h 
)

Write a statement mapping.

This function is quite too low level... It mixes raw printf in a FILE with gen_write. To survive other NewGen backend (XML), fprintf could be replaced with a gen_fprintf() that could encapsulate the output in a CDATA for example in the case of XML.

But in this case it should be a call to something like gen_write_int(fd, order) instead to do even simpler.

save it!

Parameters
fdfile to write to
hhash table to dump

Definition at line 115 of file externals.c.

118 {
119  fprintf(fd, "%d\n", statement_mapping_count(h));
121  {
122  statement key = (statement) s;
123  gen_chunkp val = (gen_chunkp) v;
124  int order = statement_ordering(key);
125  if (order!=STATEMENT_ORDERING_UNDEFINED) { /* save it! */
126  fprintf(fd, "%d\n", order);
127  gen_write(fd, (gen_chunkp) val);
128  }
129  else pips_user_warning("statement with illegal ordering\n");
130  },
131  h);
132 }
static int statement_mapping_count(statement_mapping h)
The old statement_mapping is an hash_table managed directly.
Definition: externals.c:94
union gen_chunk * gen_chunkp

References fprintf(), gen_write(), pips_user_warning, statement_mapping_count(), STATEMENT_MAPPING_MAP, statement_ordering, and STATEMENT_ORDERING_UNDEFINED.

+ Here is the call graph for this function:

◆ some_main_entity_p()

bool some_main_entity_p ( void  )

util.c

util.c

Definition at line 37 of file util.c.

38 {
39  bool some_main_p = false;
41  "/", MAIN_FILE_NAMES, NULL));
42  FILE * fm = fopen(main_list, "r");
43  if(fm!=NULL) {
44  some_main_p = true;
45  fclose(fm);
46  }
47  free(main_list);
48  return some_main_p;
49 }

References concatenate(), db_get_current_workspace_directory(), free(), MAIN_FILE_NAMES, and strdup().

Referenced by ordinary_summary_precondition(), and summary_total_postcondition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ workspace_exists_p()

bool workspace_exists_p ( const char *  name)
Parameters
nameame

Definition at line 266 of file workspace.c.

267 {
269  bool result = directory_exists_p(full_name);
270  free(full_name);
271  return result;
272 }

References db_get_workspace_directory_name(), directory_exists_p(), free(), and full_name.

Referenced by continue_create_workspace_notify(), create(), and open_workspace().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ workspace_name_p()

bool workspace_name_p ( const char *  name)

workspace.c

Parameters
nameame

Definition at line 46 of file workspace.c.

47 {
48  return strlen(name)==strspn(name, WORKSPACE_NAME_CHARS);
49 }
#define WORKSPACE_NAME_CHARS
the workspace name must be composed of the following characters.
Definition: workspace.c:43

References WORKSPACE_NAME_CHARS.

Referenced by continue_create_workspace_notify(), db_set_current_workspace_name(), end_create_workspace_notify(), and open_or_create_workspace().

+ Here is the caller graph for this function:

◆ workspace_ok_p()

bool workspace_ok_p ( const char *  name)
Parameters
nameame

Definition at line 274 of file workspace.c.

275 {
277  bool result = file_readable_p(full_name);
278  free(full_name);
279  return result;
280 }
bool file_readable_p(char *name)
Definition: file.c:428

References db_get_workspace_directory_name(), file_readable_p(), free(), and full_name.

Referenced by open_workspace().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ dbll_current_module

const char* dbll_current_module
extern

◆ genread_in

FILE* genread_in
extern

symbols exported by parser / lexer