Stable, not functional. Builds a switch case for unique SESE class invocation, inclu...
[IRC.git] / Robust / src / Runtime / mlp_runtime.h
1 #ifndef __MLP_RUNTIME__
2 #define __MLP_RUNTIME__
3
4
5 // value mode means the variable's value
6 // is present in the SESEvar struct
7 #define SESEvar_MODE_VALUE   3001
8
9 // static move means the variable's value
10 // will come from a statically known SESE
11 #define SESEvar_MODE_STATIC  3002
12
13 // dynamic mode means the variable's value
14 // will come from an SESE, and the exact
15 // SESE will be determined at runtime
16 #define SESEvar_MODE_DYNAMIC 3003
17
18
19 // a forward delcaration for SESEvar
20 struct SESErecord;
21
22
23 struct SESEvar {
24   unsigned char mode;
25
26   // the value when it is known will be placed
27   // in this location, which can be accessed
28   // as a variety of types
29   union {
30     char   sesetype_byte;
31     char   sesetype_boolean;
32     short  sesetype_short;
33     int    sesetype_int;
34     long   sesetype_long;
35     char   sesetype_char;
36     float  sesetype_float;
37     double sesetype_double;
38   };
39   
40   // a statically or dynamically known SESE
41   // to gather the variable's value from
42   // if source==NULL it indicates the root
43   // SESE, which has no record, just normal
44   // temp names
45   struct SESErecord* source;
46   unsigned int index;
47 };
48
49
50 struct SESErecord {  
51   // the identifier for the class of sese's that
52   // are instances of one particular static code block
53   int classID;
54
55   // not globally unqiue, but each parent ensures that
56   // its children have unique identifiers, including to
57   // the parent itself
58   int instanceID;
59
60   // for state of vars after issue
61   struct SESEvar* vars;
62   
63   // when this sese is ready to be invoked,
64   // allocate and fill in this structure, and
65   // the primitives will be passed out of the
66   // above var array at the call site
67   void* paramStruct;
68 };
69
70
71 void mlpInit();
72
73 struct SESErecord* mlpGetCurrent();
74
75 void mlpIssue     ( struct SESErecord* sese );
76 void mlpStall     ( struct SESErecord* sese );
77 void mlpNotifyExit( struct SESErecord* sese );
78
79
80 #endif /* __MLP_RUNTIME__ */