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

  1. #ifndef VARIABLE_H
  2. #define VARIABLE_H
  3.  
  4. /* $Id: variable.h,v 1.8 1994/05/11 19:51:05 libes Exp $ */
  5.  
  6. /************************************************************************
  7. ** Module:    Variable
  8. ** Description:    This module implements the Variable abstraction.  A
  9. **    Variable consists of a name, a type, a reference class, and
  10. **    some flags, e.g. 'optional', 'variable'.  It is used to represent
  11. **    entity attributes, variables, and formal parameters.
  12. ** Constants:
  13. **    VARIABLE_NULL    - the null variable
  14. **
  15. ************************************************************************/
  16.  
  17. /*
  18.  * This code was developed with the support of the United States Government,
  19.  * and is not subject to copyright.
  20.  *
  21.  * $Log: variable.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/03/19  20:42:36  libes
  29.  * fixed get_inverse macro
  30.  *
  31.  * Revision 1.5  1993/02/16  03:27:55  libes
  32.  * added flag for simplifying detection of parameters from other vars
  33.  *
  34.  * Revision 1.4  1993/01/19  22:15:13  libes
  35.  * *** empty log message ***
  36.  *
  37.  * Revision 1.3  1992/08/18  17:12:41  libes
  38.  * rm'd extraneous error messages
  39.  *
  40.  * Revision 1.2  1992/06/08  18:06:24  libes
  41.  * prettied up interface to print_objects_when_running
  42.  */
  43.  
  44. /*************/
  45. /* constants */
  46. /*************/
  47.  
  48. #define VARIABLE_NULL        (Variable)0
  49.  
  50. /*****************/
  51. /* packages used */
  52. /*****************/
  53.  
  54. #include "expbasic.h"    /* get basic definitions */
  55. #include "symbol.h"       
  56.  
  57. /************/
  58. /* typedefs */
  59. /************/
  60.  
  61. typedef struct Variable    *Variable;
  62.  
  63. /****************/
  64. /* modules used */
  65. /****************/
  66.        
  67. #include "type.h"
  68. #include "expr.h"
  69.  
  70. /***************************/
  71. /* hidden type definitions */
  72. /***************************/
  73.  
  74. struct Variable {
  75.     /* Symbol is inside of 'name' below */
  76.     Expression name;
  77.     Type type;
  78.     Expression initializer;    /* or 'derived' */
  79.     int        offset;
  80.  
  81.     struct {
  82.         int optional    :1;    /* OPTIONAL keyword */
  83.         int var        :1;    /* VAR keyword */
  84.         int constant    :1;    /* from CONSTANT...END_CONSTANT */
  85.         int unique    :1;    /* appears in UNIQUE list */
  86.         int parameter    :1;    /* is a formal parameter */
  87.     } flags;
  88.  
  89. #define query_symbol inverse_symbol
  90.     Symbol *    inverse_symbol;    /* entity symbol */
  91.     Variable     inverse_attribute;    /* attribute related by */
  92.                 /* inverse relationship */
  93. };
  94.  
  95. /********************/
  96. /* global variables */
  97. /********************/
  98.  
  99. #ifdef VARIABLE_C
  100. #include "defstart.h"
  101. #else
  102. #include "decstart.h"
  103. #endif    /*  VARIABLE_C  */
  104.  
  105. GLOBAL struct freelist_head VAR_fl;
  106.  
  107. #include "de_end.h"
  108.  
  109. /******************************/
  110. /* macro function definitions */
  111. /******************************/
  112.  
  113. #define VAR_new()    (struct Variable *)MEM_new(&VAR_fl)
  114. #define VAR_destroy(x)    MEM_destroy(&VAR_fl,(Freelist *)(Generic)x)
  115.  
  116. #define VARget_name(v)            ((v)->name)
  117. #define VARput_name(v,n)        ((v)->name = (n))
  118. #define VARput_offset(v,off)        ((v)->offset = (off))
  119. #define VARget_offset(v)        ((v)->offset)
  120.  
  121. #define VARget_initializer(v)        ((v)->initializer)
  122. #define VARget_type(v)            ((v)->type)
  123. #define VARget_optional(v)        ((v)->flags.optional)
  124. #define VARget_unique(v)        ((v)->flags.unique)
  125.  
  126. #define VARis_derived(v)        ((v)->initializer != 0)
  127. #define VARget_inverse(v)        ((v)->inverse_attribute)
  128. /* for backwards compatibility */
  129. #define VARget_derived        VARis_derived
  130.  
  131. /***********************/
  132. /* function prototypes */
  133. /***********************/
  134.  
  135. extern Variable VARcreate PROTO((Expression, Type));
  136. extern void VARinitialize PROTO((void));
  137. extern char *VARget_simple_name PROTO((Variable));
  138.  
  139. #if 0
  140. extern void        VARput_type PROTO((Variable *, Type));
  141. extern void        VARput_initializer PROTO((Variable *, Expression));
  142. extern void        VARput_derived PROTO((Variable *, Boolean));
  143. extern void        VARput_optional PROTO((Variable *, Boolean));
  144. extern void        VARput_variable PROTO((Variable *, Boolean));
  145. extern void        VARput_reference PROTO((Variable *,Expression));
  146. /*Mextern void        VARput_offset PROTO((Variable *, int));*/
  147. extern void        VARput_inverse PROTO((Variable *,Symbol *));
  148. /*M extern Type        VARget_type PROTO((Variable *));*/
  149. /*Mextern Boolean        VARget_derived PROTO((Variable *));*/
  150. extern Boolean        VARget_optional PROTO((Variable *));
  151. extern Boolean        VARget_variable PROTO((Variable *));
  152. extern Expression    VARget_reference PROTO((Variable *));
  153. /*Mextern int        VARget_offset PROTO((Variable *));*/
  154. #endif /*0*/
  155.  
  156. /********************/
  157. /* inline functions */
  158. /********************/
  159.  
  160. #if supports_inline_functions || defined(VARIABLE_C)
  161.  
  162. #endif /* supports_inline_functions || defined(VARIABLE_C) */
  163.  
  164. #endif    /*  VARIABLE_H  */
  165.