PIPS
database.c
Go to the documentation of this file.
1 /*
2 
3  $Id: database.c 23412 2017-08-09 15:07:09Z irigoin $
4 
5  Copyright 1989-2016 MINES ParisTech
6 
7  This file is part of PIPS.
8 
9  PIPS is free software: you can redistribute it and/or modify it
10  under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  any later version.
13 
14  PIPS is distributed in the hope that it will be useful, but WITHOUT ANY
15  WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  FITNESS FOR A PARTICULAR PURPOSE.
17 
18  See the GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with PIPS. If not, see <http://www.gnu.org/licenses/>.
22 
23 */
24 #ifdef HAVE_CONFIG_H
25  #include "pips_config.h"
26 #endif
27 
28 #include "genC.h"
29 
30 // this should not be here!
31 // #include "ri-util.h" // compilation_unit_p, a string function, really
32 #include "naming.h"
33 
34 /*
35  * Here is the database!
36  *
37  * Here are just the internals.
38  * They rely on pipsdbm private data structures, which are not exported!
39  * all exported functions should check that DB_OK.
40  */
41 
42 #include "private.h"
43 #include "pipsdbm_private.h"
44 
45 #include <regex.h>
46 #define IGNORE_RX "PIPS_IGNORE_FUNCTION_RX"
47 
48 /******************************************************************** UTILS */
49 
50 /* shorthands
51  */
52 #define db_resource_stored_p(r) db_status_stored_p(db_resource_db_status(r))
53 #define db_resource_loaded_p(r) db_status_loaded_p(db_resource_db_status(r))
54 #define db_resource_required_p(r) \
55  db_status_required_p(db_resource_db_status(r))
56 #define db_resource_loaded_and_stored_p(r) \
57  db_status_loaded_and_stored_p(db_resource_db_status(r))
58 
59 /* Module names must use some characters.
60  * Upper case letters and underscore for Fortran,
61  * but also lower case letters and the FILE_SEP_STRING
62  * "#" added for C compilation unit FC 12/08/2003
63  *
64  * FILE_SEP_STRING added for compilation units (FI)
65  * MODULE_SEP_STRING added for static C functions (FI)
66  */
67 /* #ifndef FILE_SEP_STRING /\* in ri-util *\/ */
68 /* #define FILE_SEP_STRING "!" */
69 /* #endif /\* FILE_SEP_STRING *\/ */
70 /* #ifndef MODULE_SEP_STRING /\* in ri-util *\/ */
71 /* #define MODULE_SEP_STRING ":" */
72 /* #endif /\* MODULE_SEP_STRING *\/ */
73 
74 /* #define MODULE_NAME_CHARS \ */
75 /* ( "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \ */
76 /* "0123456789" \ */
77 /* "abcdefghijklmnopqrstuvwxyz" \ */
78 /* FILE_SEP_STRING MODULE_SEP_STRING "|_#-." ) */
79 
80 static bool simple_name_p(const char* name)
81 {
82  return strlen(name)==strspn(name, MODULE_NAME_CHARS);
83 }
84 
85 static db_symbol find_or_create_db_symbol(const char* name)
86 {
88  if (!simple_name_p(name))
89  pips_user_warning("strange name \"%s\"\n", name);
90  return db_symbol_undefined_p(s)? make_db_symbol(strdup(name)): s;
91 }
92 
93 
94 /************************************************************** THE DATABASE */
95 
96 /* the pips_database stores pips resources.
97  *
98  * {init,close,set_reset,get}_pips_database()
99  * {store,load,delete,update,store_or_update}_pips_database()
100  * bound_pips_database_p()
101  */
102 GENERIC_LOCAL_FUNCTION(pips_database, db_resources)
103 
104 #define DB_OK pips_assert("defined database", !pips_database_undefined_p())
105 #define DB_UNDEF pips_assert("undefined database", pips_database_undefined_p())
106 
107 /* exported interface is minimal.
108  */
110 {
111  DB_UNDEF; init_pips_database(); DB_OK;
112 }
113 
114 /* latter */
115 static void db_clean_db_resources();
116 
117 /* @return whether okay.
118  */
119 bool db_open_pips_database(FILE * fd)
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)
131  dump_all_db_resource_status(stderr, "db_open_pips_database");
132 
133  DB_OK;
134  return true;
135 }
136 
137 void db_save_pips_database(FILE * fd)
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 }
149 
151 {
152  DB_OK; close_pips_database(); DB_UNDEF;
153 }
154 
156 {
157  // rough! memory leak...
158  if (!pips_database_undefined_p()) reset_pips_database();
159 }
160 
161 /******************************************************** LOAD/SAVE RESOURCE */
162 
163 static string db_status_string(db_status s)
164 {
165  if (db_status_undefined_p(s))
166  return "undefined";
167  switch (db_status_tag(s))
168  {
169  case is_db_status_stored:
170  return "stored";
171  case is_db_status_loaded:
172  return "loaded";
174  return "required";
176  return "loaded&stored";
177  default:
178  pips_internal_error("unexpected db_status tag %d\n", db_status_tag(s));
179  return NULL;
180  }
181 }
182 
183 static void dump_db_resource(
184  const char* rname, const char* oname, db_resource r)
185 {
186  ifdebug(1)
187  {
188  pips_debug(1, "rname=%s, oname=%s, r=%p\n", rname, oname, r);
189  if (!db_resource_undefined_p(r)) {
191  pips_debug(1, "pointer=%p, status=%s, time=%td, file_time=%td\n",
194  }
195  }
196 }
197 
198 void dump_all_db_resource_status(FILE * file, string where)
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 }
220 
221 #define debug_db_resource(l, r, o, p) ifdebug(l) { dump_db_resource(r, o, p);}
222 
223 static void init_owned_resources_if_necessary(const char* name)
224 {
226  /* set the owner_resources in the pips_database. */
227  if (!bound_pips_database_p(s))
228  store_pips_database(s, make_db_owned_resources());;
229 }
230 
231 static db_owned_resources get_db_owned_resources(const char * oname)
232 {
234  return bound_pips_database_p(o)?
235  load_pips_database(o): db_owned_resources_undefined;
236 }
237 
238 static db_resource get_resource(const char * rname, db_owned_resources or)
239 {
243  debug_db_resource(9, rname, "?", r);
244  return r;
245 }
246 
247 static db_resource get_db_resource(const char * rname, const char * oname)
248 {
250  or = get_db_owned_resources(oname);
251  if (db_owned_resources_undefined_p(or)) { /* lazy... */
252  pips_debug(1, "creating or for %s...\n", oname);
254  or = get_db_owned_resources(oname);
255  } /* pips_internal_error("no owned resources for %s", oname, rname);*/
256  return get_resource(rname, or);
257 }
258 
259 static db_resource get_real_db_resource(const char* rname, const char* oname)
260 {
261  db_resource r = get_db_resource(rname, oname);
263  pips_internal_error("no resource %s of %s\n", rname, oname);
264  return r;
265 }
266 
267 static db_resource find_or_create_db_resource(const char* rname, const char* oname)
268 {
269  db_resource r;
271  or = get_db_owned_resources(oname);
273  { /* still lazy... */
274  pips_debug(1, "module %s should have been registered\n", oname);
276  or = get_db_owned_resources(oname);
277  }
278  r = get_resource(rname, or);
280  { /* create it */
282  r = make_db_resource(NULL, db_status_undefined, 0, 0);
283  extend_db_owned_resources(or, rs, r);
284  }
285  return r;
286 }
287 
288 /* on checkpoints... there are some incoherencies!
289  * - status may be 'loaded', but it is not true!
290  * - status may be 'required', but it is not true either.
291  * - also, as obsolete resources are not cleaned...
292  *
293  * maybe the required stuff should be handled by pipsmake on its own?
294  */
296 {
297  list lr = NIL, lo = NIL, lo_init = NIL, lr_init = NIL;
298 
299  /* scan */
300  DB_RESOURCES_MAP(os, or,
301  {
303  {
304  string rn = db_symbol_name(rs);
305  string on = db_symbol_name(os);
306  pips_debug(8, "considering %s[%s] (0x%p)\n", rn, on, (void*) r);
307 
308  if (db_resource_required_p(r))
309  {
310  pips_debug(1, "resource %s[%s] in state required...\n", rn, on);
311  /* to be deleted later on */
312  lr = CONS(STRING, rn, lr);
313  lo = CONS(STRING, on, lo);
314  }
315  /* also if the file vanished...
316  * maybe on checkpoints where obsolete resources are not removed...
317  */
318  else if (dbll_stat_resource_file(rn, on, true)==0)
319  {
320  pips_debug(1, "resource %s[%s] file vanished...\n", rn, on);
321  lr = CONS(STRING, rn, lr);
322  lo = CONS(STRING, on, lo);
323  }
325  {
326  pips_debug(1, "resource %s[%s] set as stored\n", rn, on);
328  db_resource_pointer(r) = NULL;
329  }
330  },
331  or)
332  },
333  get_pips_database());
334 
335  /* delete */
336  for (; lr && lo; lr = CDR(lr), lo = CDR(lo))
337  {
338  string rn = STRING(CAR(lr)), on = STRING(CAR(lo));
339  db_resource r = get_db_resource(rn, on);
340  pips_debug(1, "deleting required %s[%s]\n", rn, on);
341  dump_db_resource(rn, on, r);
342  db_delete_resource(rn, on);
343  }
344 
345  gen_free_list(lr_init);
346  gen_free_list(lo_init);
347 
348  ifdebug(9) dump_all_db_resource_status(stderr, "db_clean_db_resources");
349 }
350 
351 /** Delete a resource
352  */
353 void db_delete_resource(const char* rname, const char* oname)
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 }
377 
378 /* this should really be a put. Just there for upward compatibility.
379  */
380 bool db_update_time(const char* rname, const char* oname)
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 }
392 
393 /* FI wants a sort... so here it is, FC. */
394 typedef struct
395 {
396  int time;
397  const char* owner_name;
398  const char* res_name;
400 
401 #define gen_DB_VOID_cons(i,l) gen_cons(i,l)
402 
403 static p_tmp_result make_tmp_result(int t, const char* on, const char* rn)
404 {
405  p_tmp_result res = (p_tmp_result) malloc(sizeof(t_tmp_result));
406  res->time = t;
407  res->owner_name = on;
408  res->res_name = rn;
409  return res;
410 }
411 
412 static int tmp_result_cmp(const p_tmp_result * p1, const p_tmp_result * p2)
413 {
414  if ((*p1)->time != (*p2)->time)
415  return (*p1)->time - (*p2)->time;
416  if ((*p1)->owner_name != (*p2)->owner_name)
417  return strcmp((*p1)->owner_name, (*p2)->owner_name);
418  return strcmp((*p1)->res_name, (*p2)->res_name);
419 }
420 
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 }
459 
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 }
499 
500 /******************************************************* RESOURCE MANAGEMENT */
501 
502 /* from now on we must not know about the database internals? */
503 
504 /* true if exists and in *ANY* state. */
505 bool db_resource_required_or_available_p(const char* rname, const char* oname)
506 {
507  DB_OK;
508  return !db_resource_undefined_p(get_db_resource(rname, oname));
509 }
510 
511 /* true if exists and in required state. */
512 bool db_resource_is_required_p(const char* rname, const char* oname)
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 }
522 
523 /* true if exists and in loaded or stored state. */
524 bool db_resource_p(const char* rname, const char* oname)
525 {
526  db_resource r;
527  DB_OK;
528  r = get_db_resource(rname, oname);
530  return false;
531  else
532  return db_resource_loaded_p(r) || db_resource_stored_p(r) ||
534 }
535 
536 /* touch logical time for resource[owner], possibly behind the back of pipsdbm.
537  */
538 bool db_touch_resource(const char* rname, const char* oname)
539 {
540  db_resource r;
541  DB_OK;
542  r = get_real_db_resource(rname, oname);
544  return true;
545 }
546 
547 static void db_check_time(const char* rname, const char* oname, db_resource r)
548 {
549  pips_assert("resource is loaded",
551 
552  /* just check for updates */
553  if (displayable_file_p(rname))
554  {
555  int its_time = dbll_stat_local_file(db_resource_pointer(r), false);
556  if (its_time > db_resource_file_time(r))
557  {
558  pips_user_warning("file resource %s[%s] updated!\n", rname, oname);
559 
560  /* update time of actual resource if appropriate
561  */
564  {
565  pips_user_warning("file '%s' for %s[%s] edited (%d -> %d)\n",
566  db_resource_pointer(r), rname, oname,
567  db_resource_file_time(r), its_time);
568  db_resource_file_time(r) = its_time;
569 
573  }
574  }
575  }
576  else
577  {
578  int its_time = dbll_stat_resource_file(rname, oname, true);
579  if (its_time > db_resource_file_time(r))
580  {
581  /* ??? just warn... may be a user error? */
582  pips_user_warning("internal resource %s[%s] updated!\n", rname, oname);
583  }
584  }
585 }
586 
587 static void db_load_resource(const char* rname, const char* oname, db_resource r)
588 {
589  pips_debug(7, "loading %s[%s]\n", rname, oname);
590  pips_assert("resource is stored", db_resource_stored_p(r));
591 
592  db_resource_pointer(r) = dbll_load_resource(rname, oname);
593 
594  if (dbll_very_special_resource_p(rname, oname))
596  else
598 
599  /* should it be checked elsewhere? */
600  db_check_time(rname, oname, r);
601 }
602 
603 int db_time_of_resource(const char* rname, const char* oname)
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 }
626 
627 static void db_save_resource(const char* rname, const char* oname, db_resource r)
628 {
629  pips_debug(7, "saving %s[%s]\n", rname, oname);
630  pips_assert("resource loaded",
632 
633  if (!dbll_storable_p(rname))
634  pips_internal_error("cannot store %s\n",rname);
635 
636  /* already saved */
638  return;
639 
640  dbll_save_resource(rname, oname, db_resource_pointer(r));
642 
643  /* let us set the file time if appropriate... */
644  if (!displayable_file_p(rname))
645  db_resource_file_time(r) = dbll_stat_resource_file(rname, oname, true);
646 }
647 
649  const char* rname, const char* oname, db_resource r, bool do_free)
650 {
651  pips_debug(7, "saving%s... %s[%s]\n",
652  do_free? " and freeing": "", rname, oname);
653 
654  pips_assert("resource is loaded",
656 
658  {
659  if (do_free) {
660  dbll_free_resource(rname, oname, db_resource_pointer(r));
662  db_resource_pointer(r) = NULL;
663  }
664  return;
665  }
666  else if (dbll_storable_p(rname))
667  {
668  dbll_save_and_free_resource(rname, oname,
669  db_resource_pointer(r), do_free);
670  if (do_free)
671  {
672  db_resource_pointer(r) = NULL;
674  }
675  else
676  {
677  /* ??? manual fix for entities... which are not well integrated. */
678  if (!dbll_very_special_resource_p(rname, oname))
679  {
682  }
683  else /* is loaded */
684  {
686  }
687  }
688 
689  db_resource_file_time(r) = dbll_stat_resource_file(rname, oname, true);
690  }
691  else
692  { /* lost.. just delete the resource. */
693  if (do_free)
694  {
695  dbll_free_resource(rname, oname, db_resource_pointer(r));
696  db_resource_pointer(r) = NULL;
697  db_delete_resource(rname, oname);
698  }
699  }
700 }
701 
702 /* some way to identify a resource... could be an id...
703  */
704 string db_get_resource_id(const char* rname, const char* oname)
705 {
706  return (char*) get_real_db_resource(rname, oname);
707 }
708 
709 
710 /** Return the pointer to the resource, whatever it is.
711 
712  @ingroup pipsdbm
713 
714  Assume that the resource is available.
715 
716  @param rname is a resource name, such as DBR_CODE for the code of a
717  module. The construction of these aliases are DBB_ + the uppercased
718  name of a resource defined in pipsmake-rc.tex. They are defined
719  automatically in include/resources.h
720 
721  @param oname is the resource owner name, typically a module name.
722 
723  @param pure is used to declare the programmer intentions about the
724  future of the resource.
725 
726  - If pure is true, the real resource is given as usual. If the
727  programmer use it in a read-only way, this is fine and the good way
728  to go. If it is modified by the programmer in a phase, all
729  subsequent phases that use this resource will access a modified
730  resource in an unnoticed way and use other resources that will be
731  out-of-sync because unnoticed by pipsmake. So in this case, the
732  programmer is assumed to put back the modified in the database later
733  to notify pipsmake.
734 
735  - If pure is false, then the resource is saved on disk and/or marked
736  as outdated before being returned. The idea is that we can modify
737  and use this resource as we want in a phase, it is a throwable
738  resource. Next time someone will want to use this resource, it will
739  be read back from disk or recomputed and nobody will seen it has
740  been changed by the first phase. The idea here is to behave as if
741  db_get_memory_resource() return a copy, so you are responsible of
742  its future (garbage collecting for example if you do not want it any
743  longer).
744 
745  This feature has been introduced in a time when gen_copy() did not
746  exist to duplicate resources and using persistence as a way to get a
747  copy was a sensible trick. But now we have gen_copy(), it is far
748  more efficient to use it instead of writing it to disk and parsing
749  it again or recomputing it. So in all new phases developed in PIPS,
750  pure should be always true and gen_copy() should be used when
751  necessary.
752 
753  @return an opaque pointer to the resource in memory.
754  */
755 string db_get_memory_resource(const char* rname, const char* oname, bool pure)
756 {
757  db_resource r;
758  void * result;
759  DB_OK;
760 
761  debug_on("PIPSDBM_DEBUG_LEVEL");
762  pips_debug(2, "get %s[%s] (%s)\n", rname, oname, pure? "pure": "not pure");
763 
764  r = get_db_resource(rname, oname);
765  debug_db_resource(9, rname, oname, r);
767  pips_internal_error("requested resource \"%s\" for module \"%s\" not available\n",
768  rname, oname);
769  /* else we have something. */
770 
771  if (db_resource_stored_p(r))
772  db_load_resource(rname, oname, r); /* does it unlink the file? */
773 
774  result = db_resource_pointer(r);
775 
776  if (!pure)
777  {
778  /* Save if possible to hide side effects. */
779  if (dbll_storable_p(rname)) {
780  db_save_resource(rname, oname, r); /* the pointer is there... */
781  /* make as stored now... */
782  db_resource_pointer(r) = NULL;
784  } else
785  /* Mark the resource as lost so next time it will be required,
786  pipsmake will recompute it for example: */
787  db_delete_resource(rname, oname);
788  }
789 
790  ifdebug(7)
791  pips_assert("resource is consistent",
792  dbll_check_resource(rname, oname, result));
793  debug_off();
794  return result;
795 }
796 
797 void db_set_resource_as_required(const char* rname, const char* oname)
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 }
830 
831 
832 /** Put a resource into the current workspace database
833 
834  @ingroup pipsdbm
835 
836  @param rname is a resource name, such as DBR_CODE for the code of a
837  module. The construction of these aliases are DBB_ + the uppercased
838  name of a resource defined in pipsmake-rc.tex. They are defined
839  automatically in include/resources.h
840 
841  @param oname is the resource owner name, typically a module name.
842 
843  @param p is an opaque pointer to the resource to be stored. Methods
844  defined in methods.h will know how to deal with.
845 
846  @param update_is_ok is a parameter to allow updating a resource.
847 
848  - If false and a resource is valid and not marked as required, this
849  function will fail
850 
851  - If true, even if a resource is valid and not marked as required,
852  this function will succeed to update it.
853 */
854 void db_put_or_update_memory_resource(const char* rname, const char* oname,
855  void * p, bool update_is_ok) {
856  db_resource r;
857  /* Check the database coherency: */
858  DB_OK;
859 
860  debug_on("PIPSDBM_DEBUG_LEVEL");
861  pips_debug(2, "putting or updating %s[%s]\n", rname, oname);
862  ifdebug(7) pips_assert("resource is consistent",
863  dbll_check_resource(rname, oname, p));
864 
865  /* Get the database resource associated to the given resource: */
866  r = find_or_create_db_resource(rname, oname);
868  /* The resource does not exist: it was just created, so mark it as
869  loaded into memory: */
871  else
872  /* The resource already exists... */
873  if (!update_is_ok && !db_resource_required_p(r))
874  /* If the resource is not required and we do not want to update it: */
875  pips_internal_error("resource %s[%s] already there\n",
876  rname, oname);
877 
878  /* Store data */
879  db_resource_pointer(r) = p; /**< ??? memory leak? depends? */
880  /* Mark the resource as loaded into memory: */
882  /* Timestamp the resource with the current logical time: */
884 
885  if (displayable_file_p(rname))
886  /* If there is a text file associated to the resource, get its
887  modification time: */
890  else
891  db_resource_file_time(r) = 0; /**< Or what else? */
892 
893  debug_db_resource(9, rname, oname, r);
894  debug_off();
895 }
896 
897 void db_invalidate_memory_resource(const char * rname, const char *oname)
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 }
908 ␌
909 /** Delete all the resources of a given type "rname"
910  *
911  * Return the number of deleted resources
912  *
913  * Each owner map has to be checked because of two-level mapping used.
914  */
915 int db_unput_resources(const char* rname)
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 }
933 
934 /* Retrieve all the db resources of a given resource type, "rname".
935  *
936  * Scan all module hash tables to find all resources of kind "rname",
937  * no matter what the owner is.
938  *
939  * Used only to clean up the make cache in pipsmake.c.
940  *
941  * Derived from db_unput_resources()
942  */
943 list db_retrieve_resources(const char* rname)
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 }
964 
965 /* Retrieve the resource name, a.k.a. kind or nature, or the resource
966  * owner name of db_resource "dbr" according to "owner_p".
967  *
968  * The two-level mapping must be inverted.
969  *
970  * string_undefined is returned if "dbr" is not found in the current
971  * resource database.
972  *
973  * This is used for interactive debugging and for debug messages.
974  */
975 static string db_resource_name_or_owner_name(db_resource dbr, bool owner_p)
976 {
977  string name = string_undefined;
978  DB_OK;
979  DB_RESOURCES_MAP(s1, or,
980  {
981  pips_debug(9, "Resources for module \"%s\":\n", db_symbol_name(s1));
982  DB_OWNED_RESOURCES_MAP(s2, dbr21,
983  {
984  pips_debug(9, "\t\"%s\":\n", db_symbol_name(s2));
985  if(dbr==dbr21) {
986  if(owner_p)
987  name = db_symbol_name(s1);
988  else
989  name = db_symbol_name(s2);
990  break;
991  }
992  },
993  or);
994  },
995  get_pips_database());
996  return name;
997 }
998 
999 /* To be used for debugging */
1000 string db_resource_name(void * dbr)
1001 {
1002  return db_resource_name_or_owner_name((db_resource) dbr, false);
1003 }
1004 
1005 /* To be used for debugging */
1006 string db_resource_owner_name(void * dbr)
1007 {
1008  return db_resource_name_or_owner_name((db_resource) dbr, true);
1009 }
1010 
1011 ␌
1013  (const char* rname, const char* oname, bool do_free)
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 }
1026 
1027 /* FC: I added this function to clean all resources, hence avoiding
1028  * to save them. This speed up hpfc at low cost;-).
1029  */
1031 {
1032  int nr = dbll_number_of_resources(), i;
1033  DB_OK;
1034  for (i=0; i<nr; i++)
1036 }
1037 
1038 /******************************************************************* MODULES */
1039 
1040 /* when telling the database about a module name, the module is
1041  * registered as a db_symbol, and it is added to the database.
1042  */
1043 static char* current_module_name = NULL;
1044 
1045 bool db_set_current_module_name(const char* name)
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 }
1057 
1058 /* Also used to check whether set... so no asserts, even DB_OK. */
1060 {
1061  return current_module_name;
1062 }
1063 
1065 {
1066  DB_OK; pips_assert("some current module name", current_module_name);
1068 }
1069 
1070 /***************************************************************** CLEANING */
1071 
1072 
1073 /* delete all obsolete resources before a close.
1074  * return the number of resources destroyed.
1075  */
1076 int db_delete_obsolete_resources(bool (*keep_p)(const char*, const char*))
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 }
1115 
1116 
1117 
1118 /** Return whether name is a "valid" module.
1119  *
1120  * @ingroup pipsdbm
1121  *
1122  * As FI points out to me (FC), it just means that the
1123  * name has been used by some-one, some-where, some-time...
1124  *
1125  * It just checks that an non empty resource table is associated to
1126  * this name. The table may be created when resources are marked as
1127  * required by pipsmake, and is never destroyed?
1128  */
1129 bool db_module_exists_p(const char* name)
1130 {
1131  bool ok = false;
1132 
1133  if (!pips_database_undefined_p()) // some database?
1134  {
1136  if (!db_symbol_undefined_p(s)) // some symbol?
1137  {
1138  db_resources dbr = get_pips_database();
1139  if (bound_db_resources_p(dbr, s)) // some resource table?
1140  {
1142  // some actual resource?
1144  }
1145  }
1146  }
1147 
1148  return ok;
1149 }
1150 
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 }
1200 
1201 
1202 /** @addtogroup pipsdbm */
1203 
1204 /** @{ */
1205 
1206 
1207 /* Returns an allocated array a with the sorted list of modules.
1208  *
1209  * strings are duplicated.
1210  *
1211  * Compilation units were not added because Fabien Coelho wanted to
1212  * avoid them in validation files: they do depend on include files
1213  * varying from machine to machine. Another reason to avoid them could
1214  * be that they are not real module with a signature and
1215  * code. However, the semantics of tpips %ALL does include them. It's
1216  * up to the validation designer to avoid including varying stuff in
1217  * test files. Another possibility would be to regenerate include
1218  * statements...
1219  *
1220  * @param module_p is used to select all modules, functions and
1221  * compilation units too. If true, compilation units are included as
1222  * well as functions.
1223  *
1224  * @param func_p is used to obtain either functions or compilation
1225  * units. It is only active if module_p is set to false.
1226  *
1227  * the environment variable PIPS_IGNORE_FUNCTION_RX helps
1228  * filtering out functions, typically static inlined functions
1229  * added by some "standard" header files.
1230  */
1231 static gen_array_t db_get_module_or_function_list(bool module_p, bool func_p)
1232 {
1233  gen_array_t a = gen_array_make(0);
1234  string ignore_rx = getenv(IGNORE_RX);
1235  regex_t ignore;
1236 
1237  DB_OK;
1238 
1239  if (ignore_rx && regcomp(&ignore, ignore_rx, 0))
1240  pips_user_error("recomp failed for \"%s\"", ignore_rx);
1241 
1242  DB_RESOURCES_FOREACH(os, or, get_pips_database())
1243  {
1244  string on = db_symbol_name(os);
1245  pips_assert("some symbol name", on);
1246  pips_debug(9, "considering %s -> %p\n", on, or);
1247  bool cu_p = compilation_unit_p(on);
1248  if (!same_string_p(on, "")
1249  && (module_p || (func_p && !cu_p) || (!func_p && cu_p))
1250  && (!ignore_rx || regexec(&ignore, on, 0, NULL, 0)))
1251  gen_array_dupappend(a, on);
1252  }
1253 
1254  gen_array_sort(a);
1255  if (ignore_rx)
1256  regfree(&ignore);
1257  return a;
1258 }
1259 
1260 
1261 /** Get an array of all the modules (functions, procedures and compilation
1262  units) of a workspace.
1263 
1264  @return an array of sorted strdup()ed strings.
1265  */
1267 {
1268  return db_get_module_or_function_list(true, true);
1269 }
1270 
1271 
1272 /** Get an array of all the functions and procedures (not compilation
1273  units) of a workspace.
1274 
1275  @return an array of sorted strdup()ed strings.
1276  */
1278 {
1279  return db_get_module_or_function_list(false, true);
1280 }
1281 
1282 
1283 /** Get an array of all the compilation units of a workspace.
1284 
1285  @return an array of sorted strdup()ed strings.
1286  */
1288 {
1289  return db_get_module_or_function_list(false, false);
1290 }
1291 
1292 /** @} */
db_status make_db_status(enum db_status_utype tag, void *val)
db_resource apply_db_owned_resources(db_owned_resources f, db_symbol k)
db_owned_resources apply_db_resources(db_resources f, db_symbol k)
bool bound_db_owned_resources_p(db_owned_resources f, db_symbol k)
void free_db_resource(db_resource p)
db_resource delete_db_owned_resources(db_owned_resources f, db_symbol k)
db_owned_resources make_db_owned_resources(void)
db_status make_db_status_loaded(void)
db_resources read_db_resources(FILE *f)
db_symbol make_db_symbol(string a1)
bool bound_db_resources_p(db_resources f, db_symbol k)
void write_db_resources(FILE *f, db_resources p)
db_owned_resources delete_db_resources(db_resources f, db_symbol k)
db_resource make_db_resource(db_void a1, db_status a2, intptr_t a3, intptr_t a4)
void extend_db_owned_resources(db_owned_resources f, db_symbol k, db_resource v)
#define db_resource_loaded_and_stored_p(r)
Definition: database.c:56
static void db_check_time(const char *rname, const char *oname, db_resource r)
Definition: database.c:547
static p_tmp_result make_tmp_result(int t, const char *on, const char *rn)
Definition: database.c:403
static db_resource get_db_resource(const char *rname, const char *oname)
Definition: database.c:247
static db_resource get_real_db_resource(const char *rname, const char *oname)
Definition: database.c:259
static db_resource get_resource(const char *rname, db_owned_resources or)
Definition: database.c:238
string db_resource_name(void *dbr)
To be used for debugging.
Definition: database.c:1000
bool db_resource_is_required_p(const char *rname, const char *oname)
true if exists and in required state.
Definition: database.c:512
void db_print_all_required_resources(FILE *file)
Definition: database.c:421
void db_clean_all_required_resources(void)
Definition: database.c:460
#define db_resource_required_p(r)
Definition: database.c:54
list db_retrieve_resources(const char *rname)
Retrieve all the db resources of a given resource type, "rname".
Definition: database.c:943
void dump_all_db_resource_status(FILE *file, string where)
Definition: database.c:198
void db_reset_current_module_name(void)
Definition: database.c:1064
static char * current_module_name
when telling the database about a module name, the module is registered as a db_symbol,...
Definition: database.c:1043
gen_array_t db_get_module_list_initial_order(void)
Definition: database.c:1151
static int tmp_result_cmp(const p_tmp_result *p1, const p_tmp_result *p2)
Definition: database.c:412
int db_time_of_resource(const char *rname, const char *oname)
Definition: database.c:603
static void db_save_and_free_resource(const char *rname, const char *oname, db_resource r, bool do_free)
Definition: database.c:648
static bool simple_name_p(const char *name)
Module names must use some characters.
Definition: database.c:80
static db_symbol find_or_create_db_symbol(const char *name)
Definition: database.c:85
#define db_resource_stored_p(r)
shorthands
Definition: database.c:52
static void db_load_resource(const char *rname, const char *oname, db_resource r)
Definition: database.c:587
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_current_module_name(void)
Also used to check whether set...
Definition: database.c:1059
#define DB_UNDEF
Definition: database.c:105
void db_save_pips_database(FILE *fd)
Definition: database.c:137
bool db_open_pips_database(FILE *fd)
Definition: database.c:119
struct t_tmp_result * p_tmp_result
static string db_status_string(db_status s)
Definition: database.c:163
bool db_resource_required_or_available_p(const char *rname, const char *oname)
from now on we must not know about the database internals?
Definition: database.c:505
void db_create_pips_database(void)
exported interface is minimal.
Definition: database.c:109
void db_set_resource_as_required(const char *rname, const char *oname)
Definition: database.c:797
void db_reset_pips_database_if_necessary(void)
Definition: database.c:155
bool db_touch_resource(const char *rname, const char *oname)
touch logical time for resource[owner], possibly behind the back of pipsdbm.
Definition: database.c:538
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
static void db_save_resource(const char *rname, const char *oname, db_resource r)
Definition: database.c:627
#define DB_OK
the pips_database stores pips resources.
Definition: database.c:104
static db_resource find_or_create_db_resource(const char *rname, const char *oname)
Definition: database.c:267
int db_delete_obsolete_resources(bool(*keep_p)(const char *, const char *))
delete all obsolete resources before a close.
Definition: database.c:1076
void db_save_and_free_memory_resource_if_any(const char *rname, const char *oname, bool do_free)
Definition: database.c:1013
void db_delete_all_resources(void)
FC: I added this function to clean all resources, hence avoiding to save them.
Definition: database.c:1030
int db_unput_resources(const char *rname)
Delete all the resources of a given type "rname".
Definition: database.c:915
static void init_owned_resources_if_necessary(const char *name)
Definition: database.c:223
static db_owned_resources get_db_owned_resources(const char *oname)
Definition: database.c:231
void db_invalidate_memory_resource(const char *rname, const char *oname)
Definition: database.c:897
#define db_resource_loaded_p(r)
Definition: database.c:53
string db_get_resource_id(const char *rname, const char *oname)
some way to identify a resource...
Definition: database.c:704
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
void db_close_pips_database(void)
Definition: database.c:150
static void db_clean_db_resources()
latter
Definition: database.c:295
#define debug_db_resource(l, r, o, p)
Definition: database.c:221
string db_resource_owner_name(void *dbr)
To be used for debugging.
Definition: database.c:1006
bool db_update_time(const char *rname, const char *oname)
this should really be a put.
Definition: database.c:380
#define IGNORE_RX
Definition: database.c:46
bool db_set_current_module_name(const char *name)
Definition: database.c:1045
static int count
Definition: SDG.c:519
gen_array_t gen_array_make(size_t size)
declarations...
Definition: array.c:40
void gen_array_sort(gen_array_t a)
Definition: array.c:164
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
#define STRING(x)
Definition: genC.h:87
if(!(yy_init))
Definition: genread_lex.c:1029
void * malloc(YYSIZE_T)
void free(void *)
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
Definition: genClib.c:2780
#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 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 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
#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
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
#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
#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
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
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
gen_array_t db_get_compilation_unit_list(void)
Get an array of all the compilation units of a workspace.
Definition: database.c:1287
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
bool db_module_exists_p(const char *name)
Return whether name is a "valid" module.
Definition: database.c:1129
static gen_array_t db_get_module_or_function_list(bool module_p, bool func_p)
Returns an allocated array a with the sorted list of modules.
Definition: database.c:1231
gen_array_t db_get_function_list(void)
Get an array of all the functions and procedures (not compilation units) of a workspace.
Definition: database.c:1277
void db_put_or_update_memory_resource(const char *rname, const char *oname, void *p, bool update_is_ok)
Put a resource into the current workspace database.
Definition: database.c:854
int hash_table_entry_count(hash_table htp)
now we define observers in order to hide the hash_table type...
Definition: hash.c:818
static void symbol(Pproblem XX, int v)
N note: if use janus.c then not static DN.
Definition: isolve.c:113
bool dbll_database_managed_file_p(const char *name)
returns whether the file is managed within the database.
Definition: lowlevel.c:376
bool dbll_very_special_resource_p(const char *rname, const char *oname)
Definition: lowlevel.c:119
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
bool displayable_file_p(const char *name)
rather approximated.
Definition: lowlevel.c:361
void dbll_free_resource(const char *rname, const char *oname, void *p)
Definition: lowlevel.c:313
int dbll_number_of_resources(void)
Definition: lowlevel.c:108
int dbll_stat_resource_file(const char *rname, const char *oname, bool okifnotthere)
Definition: lowlevel.c:265
void dbll_save_resource(const char *rname, const char *oname, void *p)
save rname of oname p.
Definition: lowlevel.c:275
void dbll_unlink_resource_file(const char *rname, const char *oname, bool erroriffailed)
Definition: lowlevel.c:219
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 rul...
Definition: lowlevel.c:324
bool dbll_storable_p(const char *rname)
Definition: lowlevel.c:341
string dbll_get_ith_resource_name(int i)
Definition: lowlevel.c:113
void * dbll_load_resource(const char *rname, const char *oname)
Definition: lowlevel.c:294
void dbll_save_and_free_resource(const char *rname, const char *oname, void *p, bool do_free)
Definition: lowlevel.c:350
#define debug_on(env)
Definition: misc-local.h:157
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
#define pips_user_warning
Definition: misc-local.h:146
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
#define pips_internal_error
Definition: misc-local.h:149
#define debug_off()
Definition: misc-local.h:160
#define pips_user_error
Definition: misc-local.h:147
#define MODULE_NAME_CHARS
Definition: naming-local.h:43
#define same_string_p(s1, s2)
void * gen_find_tabulated(const char *, int)
Definition: tabulated.c:218
list gen_filter_tabulated(bool(*)(gen_chunk *), int)
returns the list of entities with this caracteristics.
Definition: tabulated.c:144
#define string_undefined
Definition: newgen_types.h:40
#define string_undefined_p(s)
Definition: newgen_types.h:41
#define UU
Definition: newgen_types.h:98
int(* gen_cmp_func_t)(const void *, const void *)
Definition: newgen_types.h:114
int db_inc_logical_time(void)
0 means not set...
Definition: workspace.c:107
int db_get_logical_time(void)
Definition: workspace.c:112
#define DB_RESOURCE(x)
DB_RESOURCE.
#define DB_SYMBOL(x)
DB_SYMBOL.
#define db_resource_db_status(x)
#define db_owned_resources_undefined_p(x)
#define db_resource_pointer(x)
#define db_status_undefined
#define db_owned_resources_undefined
#define db_status_tag(x)
#define db_status_loaded_and_stored_p(x)
#define db_status_undefined_p(x)
#define db_resource_undefined
#define db_resources_undefined_p(x)
@ is_db_status_loaded_and_stored
@ is_db_status_loaded
@ is_db_status_stored
@ is_db_status_required
#define DB_RESOURCES_MAP(k, v, c, f)
#define db_symbol_name(x)
#define DB_RESOURCES_FOREACH(k, v, f)
#define DB_OWNED_RESOURCES_FOREACH(k, v, f)
#define db_resource_undefined_p(x)
#define db_resource_time(x)
#define DB_OWNED_RESOURCES_MAP(k, v, c, f)
#define db_symbol_undefined_p(x)
#define db_status_loaded_p(x)
#define db_symbol_domain
newgen_db_status_domain_defined
#define db_resource_file_time(x)
#define db_owned_resources_hash_table(x)
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
char * strdup()
s1
Definition: set.c:247
#define ifdebug(n)
Definition: sg.c:47
static bool ok
GENERIC_LOCAL_FUNCTION(directives, step_directives)
Copyright 2007, 2008, 2009 Alain Muller, Frederique Silber-Chaussumier.
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
FI wants a sort...
Definition: database.c:395
const char * res_name
Definition: database.c:398
const char * owner_name
Definition: database.c:397