summaryrefslogtreecommitdiff
path: root/support/ltx2x/l2xiexec.h
blob: 81cb53f32da4ae75446dba7d7ab9644bad6595ee (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
/* l2xiexec.h  for LTX2X interpreter  */

#ifndef exec_h
#define exec_h

#include "l2xicmon.h"
#include "listsetc.h"

/*  following markers are now at the end of the TOKEN_CODE enumeration */
/*
* #define STATEMENT_MARKER 0x70
* #define ADDRESS_MARKER 0x71
*/

/* runtime stack */


   /* stack value types */
typedef enum { 
#define sotc(a, b, c, d) a,
#define sftc(a, b, c, d) a,
#define fotc(a, b, c, d)
#include "l2xisftc.h"
#undef sotc
#undef sftc
#undef fotc
} STACK_TYPE;


typedef struct {
  STACK_TYPE type;
  union {
    XPRSAINT integer;      /* STKINT, STKLOG, STKUDF */
    XPRSAREAL real;        /* STKREA */
    STRING string;         /* STKSTR */
    ADDRESS address;       /* all others */
    LBS_PTR head;          /* STKBAG, STKLST, STKSET */
  } value;
} STACK_ITEM, *STACK_ITEM_PTR;

typedef struct {
  STACK_ITEM function_value;
  STACK_ITEM static_link;
  STACK_ITEM dynamic_link;
  STACK_ITEM return_address;
} *STACK_FRAME_HEADER_PTR;

/* functions */

SYMTAB_NODE_PTR get_symtab_cptr();
int get_statement_cmarker();
TYPE_STRUCT_PTR exec_routine_call();
TYPE_STRUCT_PTR exec_expression();
TYPE_STRUCT_PTR exec_variable();


ICT *crunch_address_marker();
ADDRESS fixup_address_marker();
ADDRESS get_address_cmarker();
XPRSAINT get_cinteger();
ADDRESS get_caddress();
ADDRESS get_address();
XPRSAREAL get_real();
ADDRESS get_static_link();
ADDRESS get_dynamic_link();
ADDRESS get_return_address();

/* macros */

/* get_ctoken  -- extract next token code from the current code segment */
/* #define get_ctoken()      entry_debug("getting_ctoken (l2xiexec.h)");   \
                          code_segment_entry_debug(code_segmentp);      \
                          ctoken = *code_segmentp++;                    \
                          exit_debug("got_ctoken")

#define get_ctoken()      code_segment_entry_debug(code_segmentp);      \
                          ctoken = *code_segmentp++
*/

/* pop  -- pop the runtime stack */
#define pop() stack_access_debug("Popped", tos); \
              --tos

/* Tracing routine calls. To compile, #define trace beforehand */
#ifndef trace
#define trace_routine_entry(idp)
#define trace_routine_exit(idp)
#define trace_statement_execution()
#define trace_data_store(idp, idp_tp, targetp, target_tp)
#define trace_data_fetch(idp, tp, datap)
#endif

#endif