SpiderScript - More changes, cleaning up
[tpg/acess2.git] / Usermode / Libraries / libspiderscript.so_src / bytecode.h
1 /*
2  * SpiderScript
3  * - Bytecode definitions
4  */
5 #ifndef _BYTECODE_H_
6 #define _BYTECODE_H_
7
8 #include "bytecode_ops.h"
9
10 typedef struct sBC_Op   tBC_Op;
11 typedef struct sBC_Function     tBC_Function;
12
13 struct sBC_Op
14 {
15         tBC_Op  *Next;
16          int    Operation;
17          int    bUseInteger;    // Used for serialisation
18         union {
19                 struct {
20                         const char *String;
21                          int    Integer;
22                 } StringInt;
23                 
24                 uint64_t        Integer;
25                 double  Real;
26         } Content;
27 };
28
29 struct sBC_Function
30 {
31         const char      *Name;
32         
33          int    LabelCount;
34          int    LabelSpace;
35         tBC_Op  **Labels;
36         
37          int    MaxVariableCount;
38         // NOTE: These fields are invalid after compilation
39          int    VariableCount;
40          int    VariableSpace;
41         const char      **VariableNames;        // Only type needs to be stored
42          int    CurContextDepth;        // Used to get the real var count
43
44          int    OperationCount;
45         tBC_Op  *Operations;
46         tBC_Op  *OperationsEnd;
47
48          int    ArgumentCount;
49         struct {
50                 char    *Name;
51                  int    Type;
52         }       Arguments[];
53 };
54
55 #endif

UCC git Repository :: git.ucc.asn.au