working up mlp system
[IRC.git] / Robust / src / Runtime / mlp_runtime.h
1 #ifndef __MLP_RUNTIME__
2 #define __MLP_RUNTIME__
3
4
5 #include <pthread.h>
6 #include "Queue.h"
7 #include "psemaphore.h"
8
9
10 // forward delcarations
11 struct SESErecord_t;
12
13
14
15 /*
16 typedef struct SESEvar_t {
17   // the value when it is known will be placed
18   // in this location, which can be accessed
19   // as a variety of types
20   union {
21     char      sesetype_byte;
22     int       sesetype_boolean;
23     short     sesetype_short;
24     int       sesetype_int;
25     long long sesetype_long;
26     short     sesetype_char;
27     float     sesetype_float;
28     double    sesetype_double;
29     void*     sesetype_object;
30   };  
31 } SESEvar;
32 */
33
34 typedef struct SESErecord_t {  
35   // the identifier for the class of sese's that
36   // are instances of one particular static code block
37   int classID;
38
39   // The following fields have this structure:
40   // [INTPTR numPtrs][void* next][ptr0][ptr1]...
41   void* inSetObjs;
42   void* outSetObjsNotInInSet;
43
44   // The following fields point to compile-time
45   // generated structures that have named 
46   // primitive fields
47   void* inSetPrims;
48   void* outSetPrimsNotInInSet;
49
50   // the lock guards the following data SESE's
51   // use to coordinate with one another
52   pthread_mutex_t lock;
53   struct Queue*   forwardList;
54   int             doneExecuting;
55
56 } SESErecord;
57
58
59 // simple mechanical allocation and deallocation
60 // of SESE records
61 SESErecord* mlpCreateSESErecord( int   classID,
62                                  void* inSetObjs,
63                                  void* outSetObjsNotInInSet,
64                                  void* inSetPrims,
65                                  void* outSetPrimsNotInInSet
66                                );
67
68 void mlpDestroySESErecord( SESErecord* sese );
69
70
71 // main library functions
72 void mlpInit();
73 void mlpIssue( SESErecord* sese );
74 void mlpStall( SESErecord* sese );
75
76
77 #endif /* __MLP_RUNTIME__ */