X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FLibraries%2Flibspiderscript.so_src%2Fbytecode.h;h=bc3c91cdbad3a3bdbd7a48b87a5c6d9f03bf2d3b;hb=c43c05ef3234d6118ce601d299df60383d54ac7b;hp=bff4caec1348c3a39f5c2358deaa19455a795481;hpb=efa38e0d56b1b620b6f4e5c4f91abc483a3065e2;p=tpg%2Facess2.git diff --git a/Usermode/Libraries/libspiderscript.so_src/bytecode.h b/Usermode/Libraries/libspiderscript.so_src/bytecode.h index bff4caec..bc3c91cd 100644 --- a/Usermode/Libraries/libspiderscript.so_src/bytecode.h +++ b/Usermode/Libraries/libspiderscript.so_src/bytecode.h @@ -5,25 +5,46 @@ #ifndef _BYTECODE_H_ #define _BYTECODE_H_ -struct sBytecodeHeader +#include "bytecode_ops.h" + +#define BC_NS_SEPARATOR '@' + +typedef struct sBC_Op tBC_Op; +typedef struct sBC_Function tBC_Function; + +struct sBC_Op { - uint32_t Magic; //!< Magic Value (identifier) "\x8FSS\r" - uint32_t NFunctions; //!< Number of functions - struct { - uint32_t NameOffset; //!< Offset to the name - uint32_t CodeOffset; //!< Offset to the code - } Functions[]; + tBC_Op *Next; + int Operation; + char bUseInteger; // Used for serialisation + char bUseString; // Used for serialisation + union { + struct { + int Integer; + char String[]; + } StringInt; + + uint64_t Integer; + double Real; + } Content; }; -enum eBytecodeOperations +struct sBC_Function { - BCOP_UNDEF, - BCOP_NOP, + int LabelCount; + int LabelSpace; + tBC_Op **Labels; - BCOP_DEFVAR, - BCOP_RETURN, - - NUM_BCOP -} + int MaxVariableCount; + // NOTE: These fields are invalid after compilation + int VariableCount; + int VariableSpace; + const char **VariableNames; + int CurContextDepth; // Used to get the real var count + + int OperationCount; + tBC_Op *Operations; + tBC_Op *OperationsEnd; +}; #endif