summaryrefslogtreecommitdiff
path: root/support/ltx2x/licomsym.h
blob: eb1b39adcf88ca78749542442350da3d6bae25f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
/* licomsym.h  Symbol table common for sharing between LTX2X & code interp */

#ifndef licomsym_h
#define licomsym_h

#include "l2xicmon.h"

/* value structure */
typedef union {
  XPRSAINT integer;
  XPRSAREAL real;
  char character;
  char *stringp;
} VALUE;

/* definition structure */

typedef enum {
#define dfntc(a, b) a,
#include "l2xidftc.h"
#undef dfntc
} DEFN_KEY;



typedef enum {
  DECLARED,
  FORWARD,
  READ,
  READLN,
  WRITE,
  WRITELN,
  ABS,
  COS,
  EOFF,
  EOLN,
  EXP,
  ODD,
  ROUND,
  SIN,
  SQRT,
  TRUNC,
  L2XPRINT, 
  L2XPRINTLN,
  L2XSYSTEM,
  L2XREXPR,
  XACOS,   
  XASIN,
  XATAN,
  XBLENGTH,
  XEXISTS,
  XFORMAT,
  XHIBOUND,
  XHIINDEX,
  XLENGTH,
  XLOBOUND,
  XLOG,
  XLOG2,
  XLOG10,
  XLOINDEX,
  XNVL,
  XROLESOF,
  XSIZEOF,
  XTAN,
  XTYPEOF,
  XUSEDIN,
  XVALUE,
  XVALUE_IN,
  XVALUE_UNIQUE,
  XINSERT,   
  XREMOVE,
} ROUTINE_KEY;

typedef struct {
  DEFN_KEY key;
  union {
    struct {
      VALUE value;
    } constant;

    struct {
      ROUTINE_KEY key;
      int parm_count;
      int total_parm_size;
      int total_local_size;
      struct symtab_node *parms;
      struct symtab_node *locals;
      struct symtab_node *local_symtab;
      ICT *code_segment;
    } routine;

    struct {
      int offset;
      struct symtab_node *entity_idp;
    } data;
  } info;
} DEFN_STRUCT;

/* type structure */

typedef enum {
#define fotc(a, b, c, d) c,
#define sotc(a, b, c, d)
#define sftc(a, b, c, d) c,
#include "l2xisftc.h"
#undef fotc
#undef sotc
#undef sftc
} TYPE_FORM;

typedef struct type_struct {
  TYPE_FORM form;
  int size;
  struct symtab_node *type_idp;
  union {
    struct {
      struct symtab_node *const_idp;
      int max;
    } enumeration;

    struct {
      struct type_struct *range_typep;
      int min;
      int max;
    } subrange;

    struct {
      struct type_struct *bound_typep;
      int min;
      int max;
    } bound;

    struct {
      struct type_struct *index_typep;
      struct type_struct *elmt_typep;
      int min_index;
      int max_index;
      int elmt_count;
    } array;
  
    struct {
      struct type_struct *index_typep;
      struct type_struct *elmt_typep;
      int min_index;
      int max_index;
      int elmt_count;
    } dynagg;
  
    struct {
      struct symtab_node *attribute_symtab;
    } entity;

    struct {
      int max_length;
      int length;
    } string;
  } info;
} TYPE_STRUCT, *TYPE_STRUCT_PTR;

/* symbol table node */
typedef struct symtab_node {
  struct symtab_node *left, *right;  /* ptrs to subtrees */
  struct symtab_node *next;          /* for chaining nodes */
  char *name;                        /* name string */
  char *info;                        /* ptr to generic info */
  DEFN_STRUCT defn;                  /* definition struct */
  TYPE_STRUCT_PTR typep;             /* ptr to type struct */
  int level;                         /* nesting level */
  int label_index;                   /* index for code label */
} SYMTAB_NODE, *SYMTAB_NODE_PTR;

typedef int LOGICAL_REP;

#endif