home *** CD-ROM | disk | FTP | other *** search
/ ftptest.leeds.ac.uk / 2015.02.ftptest.leeds.ac.uk.tar / ftptest.leeds.ac.uk / bionet / CAE-GROUP / SCL-WIN3x / FED_PLUS.EXE / SCHEMA.H < prev    next >
Text File  |  1994-07-25  |  5KB  |  167 lines

  1. #ifndef SCHEMA_H
  2. #define SCHEMA_H
  3.  
  4. /* $Id: schema.h,v 1.7 1994/05/11 19:51:05 libes Exp $ */
  5.  
  6. /************************************************************************
  7. ** Module:    Schema
  8. ** Description:    This module implements the Schema abstraction, which
  9. **    basically amounts to a named symbol table.
  10. ** Constants:
  11. **    SCHEMA_NULL    - the null schema
  12. **
  13. ************************************************************************/
  14.  
  15. /*
  16.  * This software was developed by U.S. Government employees as part of
  17.  * their official duties and is not subject to copyright.
  18.  *
  19.  * $Log: schema.h,v $
  20.  * Revision 1.7  1994/05/11  19:51:05  libes
  21.  * numerous fixes
  22.  *
  23.  * Revision 1.6  1993/10/15  18:48:24  libes
  24.  * CADDETC certified
  25.  *
  26.  * Revision 1.5  1993/01/19  22:16:43  libes
  27.  * *** empty log message ***
  28.  *
  29.  * Revision 1.4  1992/08/27  23:42:33  libes
  30.  * *** empty log message ***
  31.  *
  32.  * Revision 1.3  1992/08/18  17:12:41  libes
  33.  * rm'd extraneous error messages
  34.  *
  35.  * Revision 1.2  1992/06/08  18:06:24  libes
  36.  * prettied up interface to print_objects_when_running
  37.  */
  38.  
  39. /*************/
  40. /* constants */
  41. /*************/
  42.  
  43. /*****************/
  44. /* packages used */
  45. /*****************/
  46.  
  47. #include "expbasic.h"    /* get basic definitions */
  48. #include "symbol.h"
  49. #include "scope.h"
  50.  
  51. /************/
  52. /* typedefs */
  53. /************/
  54.  
  55. /*typedef struct Scope *Schema;*/
  56.  
  57. /****************/
  58. /* modules used */
  59. /****************/
  60.  
  61. #include "alg.h"
  62. #include "dict.h"
  63. #include "entity.h"
  64. #include "scope.h"
  65. #include "linklist.h"
  66.  
  67. /***************************/
  68. /* hidden type definitions */
  69. /***************************/
  70.  
  71. enum rename_type { use, ref };
  72.  
  73. typedef struct Rename {
  74.     struct Symbol *schema_sym;
  75.     Schema schema;
  76.     struct Symbol *old;
  77.     struct Symbol *new;
  78.     Generic object;        /* once object has been looked up */
  79.     char type;        /* drat, need to remember this */
  80.             /* once renames have been resolved to avoid */
  81.             /* looking them up in the dictionary again */
  82.     enum rename_type rename_type;
  83. } Rename;
  84.  
  85. struct Schema {
  86.     Linked_List rules;
  87. #if 0
  88.     struct Express    *express;
  89. #endif
  90.     /* dictionarys into which are entered renames for each specific */
  91.     /* object specified in a rename clause (even if it uses the same */
  92.     /* name */
  93.     Dictionary refdict;
  94.     Dictionary usedict;
  95.     /* lists of schemas that are fully ref/use'd */
  96.     /* entries can be 0 if schemas weren't found during RENAMEresolve */
  97.     Linked_List uselist;
  98.     Linked_List reflist;
  99. };
  100.  
  101. /********************/
  102. /* global variables */
  103. /********************/
  104.  
  105. #ifdef SCHEMA_C
  106. # define GLOBAL
  107. # define INITIALLY(value) = value
  108. #else
  109. # define GLOBAL extern
  110. # define INITIALLY(value)
  111. #endif /* SCHEMA_C */
  112.  
  113. GLOBAL struct freelist_head REN_fl;
  114. GLOBAL struct freelist_head SCOPE_fl;
  115. GLOBAL struct freelist_head SCHEMA_fl;
  116.  
  117. GLOBAL int    __SCOPE_search_id        INITIALLY(0);
  118.  
  119. #undef GLOBAL
  120. #undef INITIALLY
  121.  
  122. /******************************/
  123. /* macro function definitions */
  124. /******************************/
  125.  
  126. #define SCHEMAget_name(schema)        SCOPEget_name(schema)
  127. #define SCHEMAget_symbol(schema)    SCOPEget_symbol(schema)
  128.  
  129. #define REN_new()    (struct Rename *)MEM_new(&REN_fl)
  130. #define REN_destroy(x)    MEM_destroy(&REN_fl,(Freelist *)(Generic)x)
  131. #define SCOPE_new()    (struct Scope *)MEM_new(&SCOPE_fl)
  132. #define SCOPE_destroy(x)    MEM_destroy(&SCOPE_fl,(Freelist *)(Generic)x)
  133. #define SCHEMA_new()    (struct Schema *)MEM_new(&SCHEMA_fl)
  134. #define SCHEMA_destroy(x)    MEM_destroy(&SCHEMA_fl,(Freelist *)(Generic)x)
  135.  
  136. /* the following is simply to make the resulting code easier to read */
  137. /* otherwise, you'd see "entity->superscope" even when you KNOW */
  138. /* it is a schema */
  139. #define ENTITYget_schema(e)        (e)->superscope
  140.  
  141. /***********************/
  142. /* function prototypes */
  143. /***********************/
  144.  
  145. extern Variable VARfind PROTO((Scope,char *,int));
  146. extern Schema     SCHEMAcreate PROTO((void));
  147. extern void    SCHEMAinitialize PROTO((void));
  148. extern void    SCHEMAadd_use PROTO((Schema,Symbol *, Symbol *, Symbol *));
  149. extern void    SCHEMAadd_reference PROTO((Scope/*really, a schema*/,Symbol *, Symbol *, Symbol *));
  150. extern Generic    SCHEMAfind PROTO((Scope/*really, a schema */,char *name,int search_refs));
  151. extern Scope SCOPEcreate PROTO((char));
  152. extern Scope SCOPEcreate_tiny PROTO((char));
  153. extern Scope SCOPEcreate_nostab PROTO((char));
  154. extern Linked_List SCHEMAget_entities_use PROTO((Scope));
  155. extern Linked_List SCHEMAget_entities_ref PROTO((Scope));
  156.  
  157. /********************/
  158. /* inline functions */
  159. /********************/
  160.  
  161. #if supports_inline_functions || defined(SCHEMA_C)
  162. #endif /* supports_inline_functions || defined(SCHEMA_C) */
  163.  
  164. #endif /*  SCHEMA_H */
  165.  
  166.  
  167.