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 / SCOPE.H < prev    next >
C/C++ Source or Header  |  1994-07-23  |  5KB  |  167 lines

  1. #ifndef SCOPE_H
  2. #define SCOPE_H
  3.  
  4. /* $Id: scope.h,v 1.8 1994/05/11 19:51:05 libes Exp $ */
  5.  
  6. /************************************************************************
  7. ** Module:    Scope
  8. ** Description:    This module implements a hierarchical (i.e., scoped)
  9. **    symbol table.  The symbol table can store definitions of entities,
  10. **    types, algorithms, and variables, as well as containing a list
  11. **    of subscopes.
  12. ** Constants:
  13. **    SCOPE_NULL    - the null scope
  14. **
  15. ************************************************************************/
  16.  
  17. /*
  18.  * This software was developed by U.S. Government employees as part of
  19.  * their official duties and is not subject to copyright.
  20.  *
  21.  * $Log: scope.h,v $
  22.  * Revision 1.8  1994/05/11  19:51:05  libes
  23.  * numerous fixes
  24.  *
  25.  * Revision 1.7  1993/10/15  18:48:24  libes
  26.  * CADDETC certified
  27.  *
  28.  * Revision 1.6  1993/01/19  22:16:43  libes
  29.  * *** empty log message ***
  30.  *
  31.  * Revision 1.5  1992/08/18  17:12:41  libes
  32.  * rm'd extraneous error messages
  33.  *
  34.  * Revision 1.4  1992/06/08  18:06:24  libes
  35.  * prettied up interface to print_objects_when_running
  36.  */
  37.  
  38. /*************/
  39. /* constants */
  40. /*************/
  41.  
  42. #define SCOPE_NULL    (Scope)0
  43.  
  44. /************/
  45. /* typedefs */
  46. /************/
  47.  
  48. /*typedef struct Scope *Scope;*/
  49.  
  50. /****************/
  51. /* modules used */
  52. /****************/
  53.  
  54. #include "type.h"
  55. #include "variable.h"
  56. #include "entity.h"
  57. #include "express.h"
  58. #include "alg.h"
  59. #include "schema.h"
  60.  
  61. /*****************/
  62. /* packages used */
  63. /*****************/
  64.  
  65. #include "expbasic.h"    /* get basic definitions */
  66. #include "dict.h"
  67. #include "symbol.h"
  68.  
  69. /***************************/
  70. /* hidden type definitions */
  71. /***************************/
  72. void SCOPEinitialize(void);
  73. /* these allow one to give SCOPEfind hints to its search strategy */
  74. #define SCOPE_FIND_TYPE        OBJ_TYPE_BITS
  75. #define SCOPE_FIND_ENTITY    OBJ_ENTITY_BITS
  76. #define SCOPE_FIND_FUNCTION    OBJ_FUNCTION_BITS
  77. #define SCOPE_FIND_PROCEDURE    OBJ_PROCEDURE_BITS
  78. #define SCOPE_FIND_ANYTHING    OBJ_ANYTHING_BITS
  79.  
  80. struct Scope {
  81.     Symbol        symbol;
  82.     char        type;        /* see above */
  83.     ClientData    clientData;    /* user may use this for any purpose */
  84.     int        search_id;    /* key to avoid searching this scope twice */
  85.     Dictionary    symbol_table;
  86.     struct Scope    *superscope;
  87.     union {
  88. /*        struct Constant *constant;*/
  89.         struct Procedure *proc;
  90.         struct Function *func;
  91.         struct Rule *rule;
  92.         struct Entity *entity;
  93.         struct Schema *schema;
  94.         struct Express *express;
  95.         struct Increment *incr;
  96.         struct TypeHead *type;
  97. /* no, query owns a scope rather than scope owning a query */
  98. /*        struct Query *query;*/
  99.     } u;
  100.     Linked_List where;        /* optional where clause */
  101. };
  102.  
  103. /********************/
  104. /* global variables */
  105. /********************/
  106.  
  107. #ifdef SCOPE_C
  108. #include "defstart.h"
  109. #else
  110. #include "decstart.h"
  111. #endif /* SCOPE_C */
  112. #include "de_end.h"
  113.  
  114. /******************************/
  115. /* macro function definitions */
  116. /******************************/
  117.  
  118. #define SCOPEis(scope)            ((scope)->type)
  119. #define SCOPEis_schema(scope)        ((scope)->type == OBJ_SCHEMA)
  120.  
  121. #define SCOPEget_symbol(scope)        (&(scope)->symbol)
  122. #define SCOPEput_name(scope,name)    ((scope)->symbol.name = name)
  123. #define SCOPEget_name(scope)        ((scope)->symbol.name)
  124. /* get_superscope's' for backward compat */
  125. #define SCOPEget_superscope(scope)    ((scope)->superscope)
  126. #define SCOPEget_superscope(scope)    ((scope)->superscope)
  127. #define SCOPEget_resolved(scope)    ((scope)->symbol.resolved)
  128.  
  129. #define SCOPEget_clientData(s)        ((s)->clientData)
  130. #define SCOPEput_clientData(s,d)    ((s)->clientData = (d))
  131.  
  132.  
  133. #define SCOPEdo_types(s,t,de) DICTdo_type_init(s->symbol_table,&de,OBJ_TYPE);{\
  134.                 Type t; \
  135.                   while (0 != (t = (Type)DICTdo(&de))) {
  136. #define SCOPEdo_entities(s,t,de) DICTdo_type_init(s->symbol_table,&de,OBJ_ENTITY); { \
  137.                 Entity t; \
  138.                   while (0 != (t = (Entity)DICTdo(&de))) {
  139. #define SCOPEod            }}
  140.  
  141. /***********************/
  142. /* function prototypes */
  143. /***********************/
  144.  
  145. extern struct Symbol *    SCOPE_get_symbol PROTO((Generic));
  146. /*extern struct Scope *    SCOPEget_nearest_enclosing_entity PROTO((Scope));*/
  147. extern void        SCOPE_get_entities PROTO((Scope,Linked_List));
  148. extern Linked_List    SCOPEget_entities PROTO((Scope));
  149. extern Linked_List    SCOPEget_entities_superclass_order PROTO((Scope));
  150. extern Generic        SCOPEfind PROTO((Scope,char *,int));
  151.  
  152. #if 0
  153. extern Linked_List    SCOPEget_types PROTO((Scope));
  154. extern Linked_List    SCOPEget_variables PROTO((Scope));
  155. extern Linked_List    SCOPEget_algorithms PROTO((Scope));
  156. extern Linked_List    SCOPEget_constants PROTO((Scope));
  157. #endif
  158.  
  159. /********************/
  160. /* inline functions */
  161. /********************/
  162.  
  163. #if supports_inline_functions || defined(SCOPE_C)
  164.  
  165. #endif /* supports_inline_functions || defined(SCOPE_C) */
  166. #endif /* SCOPE_H */
  167.