xine-lib: xine-lib-1.2.12/src/post/goom/goomsl_private.h Source File

xine-lib 1.2.12

goomsl_private.h
Go to the documentation of this file.
1#ifndef _GSL_PRIVATE_H
2#define _GSL_PRIVATE_H
3
4/* -- internal use -- */
5
6#include "goomsl.h"
7
8#ifdef USE_JITC_X86
9#include "jitc_x86.h"
10#endif
11
12#include "goomsl_heap.h"
13
14/* {{{ type of nodes */
15#define EMPTY_NODE 0
16#define CONST_INT_NODE 1
17#define CONST_FLOAT_NODE 2
18#define CONST_PTR_NODE 3
19#define VAR_NODE 4
20#define PARAM_NODE 5
21#define READ_PARAM_NODE 6
22#define OPR_NODE 7
23/* }}} */
24/* {{{ type of operations */
25#define OPR_SET 1
26#define OPR_IF 2
27#define OPR_WHILE 3
28#define OPR_BLOCK 4
29#define OPR_ADD 5
30#define OPR_MUL 6
31#define OPR_EQU 7
32#define OPR_NOT 8
33#define OPR_LOW 9
34#define OPR_DIV 10
35#define OPR_SUB 11
36#define OPR_FUNC_INTRO 12
37#define OPR_FUNC_OUTRO 13
38#define OPR_CALL 14
39#define OPR_EXT_CALL 15
40#define OPR_PLUS_EQ 16
41#define OPR_SUB_EQ 17
42#define OPR_MUL_EQ 18
43#define OPR_DIV_EQ 19
44#define OPR_CALL_EXPR 20
45#define OPR_AFFECT_LIST 21
46#define OPR_FOREACH 22
47#define OPR_VAR_LIST 23
48
49/* }}} */
50
51 typedef struct _ConstIntNodeType { /* {{{ */
52 int val;
53} ConstIntNodeType; /* }}} */
54 typedef struct _ConstFloatNodeType { /* {{{ */
55 float val;
56} ConstFloatNodeType; /* }}} */
57 typedef struct _ConstPtrNodeType { /* {{{ */
58 int id;
59} ConstPtrNodeType; /* }}} */
60 typedef struct _OprNodeType { /* {{{ */
61 int type;
62 int nbOp;
63 struct _NODE_TYPE *op[3]; /* maximal number of operand needed */
64 struct _NODE_TYPE *next;
65} OprNodeType; /* }}} */
66 typedef struct _NODE_TYPE { /* {{{ */
67 int type;
68 char *str;
69 GoomHash *vnamespace;
70 int line_number;
71 union {
72 ConstIntNodeType constInt;
73 ConstFloatNodeType constFloat;
74 ConstPtrNodeType constPtr;
75 OprNodeType opr;
76 } unode;
77} NodeType; /* }}} */
78 typedef struct _INSTRUCTION_DATA { /* {{{ */
79
80 union {
81 void *var;
82 int *var_int;
83 int *var_ptr;
84 float *var_float;
85 int jump_offset;
86 struct _ExternalFunctionStruct *external_function;
87 } udest;
88
89 union {
90 void *var;
91 int *var_int;
92 int *var_ptr;
93 float *var_float;
94 int value_int;
95 int value_ptr;
96 float value_float;
97 } usrc;
98} InstructionData;
99/* }}} */
100 typedef struct _INSTRUCTION { /* {{{ */
101
102 int id;
103 InstructionData data;
104 GoomSL *parent;
105 const char *name; /* name of the instruction */
106
107 char **params; /* parametres de l'instruction */
108 GoomHash **vnamespace;
109 int *types; /* type des parametres de l'instruction */
110 int cur_param;
111 int nb_param;
112
113 int address;
114 char *jump_label;
115 char *nop_label;
116
117 int line_number;
118
119} Instruction;
120/* }}} */
121 typedef struct _INSTRUCTION_FLOW { /* {{{ */
122
123 Instruction **instr;
124 int number;
125 int tabsize;
126 GoomHash *labels;
127} InstructionFlow;
128/* }}} */
129 typedef struct _FAST_INSTRUCTION { /* {{{ */
130 int id;
131 InstructionData data;
132 Instruction *proto;
133} FastInstruction;
134/* }}} */
135 typedef struct _FastInstructionFlow { /* {{{ */
136 int number;
137 FastInstruction *instr;
138 void *mallocedInstr;
139} FastInstructionFlow;
140/* }}} */
141 typedef struct _ExternalFunctionStruct { /* {{{ */
142 GoomSL_ExternalFunction function;
143 GoomHash *vars;
144 int is_extern;
145} ExternalFunctionStruct;
146/* }}} */
147 typedef struct _Block {
148 int data;
149 int size;
150} Block;
151 typedef struct _GSL_StructField { /* {{{ */
152 int type;
153 char name[256];
154 int offsetInStruct; /* Where this field is stored... */
155} GSL_StructField;
156 /* }}} */
157 typedef struct _GSL_Struct { /* {{{ */
158 int nbFields;
159 GSL_StructField *fields[64];
160 int size;
161 Block iBlock[64];
162 Block fBlock[64];
163} GSL_Struct;
164 /* }}} */
165 struct _GoomSL { /* {{{ */
166 int num_lines;
167 Instruction *instr; /* instruction en cours de construction */
168
169 InstructionFlow *iflow; /* flow d'instruction 'normal' */
170 FastInstructionFlow *fastiflow; /* flow d'instruction optimise */
171
172 GoomHash *vars; /* table de variables */
173 int currentNS;
174 GoomHash *namespaces[16];
175
176 GoomHash *functions; /* table des fonctions externes */
177
178 GoomHeap *data_heap; /* GSL Heap-like memory space */
179
180 int nbStructID;
181 GoomHash *structIDS;
182 GSL_Struct **gsl_struct;
183 int gsl_struct_size;
184
185 int nbPtr;
186 int ptrArraySize;
187 void **ptrArray;
188
189 int compilationOK;
190#ifdef USE_JITC_X86
191 JitcX86Env *jitc;
192 JitcFunc jitc_func;
193#endif
194}; /* }}} */
195
196extern GoomSL *currentGoomSL;
197
198 Instruction *gsl_instr_init(GoomSL *parent, const char *name, int id, int nb_param, int line_number);
199void gsl_instr_add_param(Instruction *_this, const char *param, int type);
200void gsl_instr_set_namespace(Instruction *_this, GoomHash *ns);
201
202void gsl_declare_task(const char *name);
203void gsl_declare_external_task(const char *name);
204
205int gsl_type_of_var(GoomHash *namespace, const char *name);
206
207void gsl_enternamespace(const char *name);
208void gsl_reenternamespace(GoomHash *ns);
209 GoomHash *gsl_leavenamespace(void);
210 GoomHash *gsl_find_namespace(const char *name);
211
212void gsl_commit_compilation(void);
213
214/* #define TYPE_PARAM 1 */
215
216#define FIRST_RESERVED 0x80000
217
218#define TYPE_INTEGER 0x90001
219#define TYPE_FLOAT 0x90002
220#define TYPE_VAR 0x90003
221#define TYPE_PTR 0x90004
222#define TYPE_LABEL 0x90005
223
224#define TYPE_OP_EQUAL 6
225#define TYPE_IVAR 0xa0001
226#define TYPE_FVAR 0xa0002
227#define TYPE_PVAR 0xa0003
228#define TYPE_SVAR 0xa0004
229
230#define INSTR_JUMP 6
231#define INSTR_JZERO 29
232#define INSTR_CALL 36
233#define INSTR_RET 37
234#define INSTR_EXT_CALL 38
235#define INSTR_JNZERO 40
236
237#define INSTR_SET 0x80001
238#define INSTR_INT 0x80002
239#define INSTR_FLOAT 0x80003
240#define INSTR_PTR 0x80004
241#define INSTR_LABEL 0x80005
242#define INSTR_ISLOWER 0x80006
243#define INSTR_ADD 0x80007
244#define INSTR_MUL 0x80008
245#define INSTR_DIV 0x80009
246#define INSTR_SUB 0x80010
247#define INSTR_ISEQUAL 0x80011
248#define INSTR_NOT 0x80012
249
250
251#endif
goomsl.h
GoomSL_ExternalFunction
void(* GoomSL_ExternalFunction)(GoomSL *gsl, GoomHash *global_vars, GoomHash *local_vars)
Definition: goomsl.h:7
goomsl_heap.h
gsl_declare_external_task
void gsl_declare_external_task(const char *name)
Definition: goomsl.c:858
Instruction
struct _INSTRUCTION Instruction
gsl_instr_init
Instruction * gsl_instr_init(GoomSL *parent, const char *name, int id, int nb_param, int line_number)
Definition: goomsl.c:175
gsl_declare_task
void gsl_declare_task(const char *name)
Definition: goomsl.c:844
InstructionFlow
struct _INSTRUCTION_FLOW InstructionFlow
gsl_instr_add_param
void gsl_instr_add_param(Instruction *_this, const char *param, int type)
Definition: goomsl.c:141
NodeType
struct _NODE_TYPE NodeType
gsl_type_of_var
int gsl_type_of_var(GoomHash *namespace, const char *name)
Definition: goomsl_yacc.c:358
ExternalFunctionStruct
struct _ExternalFunctionStruct ExternalFunctionStruct
FastInstructionFlow
struct _FastInstructionFlow FastInstructionFlow
gsl_leavenamespace
GoomHash * gsl_leavenamespace(void)
Definition: goomsl.c:828
gsl_instr_set_namespace
void gsl_instr_set_namespace(Instruction *_this, GoomHash *ns)
Definition: goomsl.c:132
gsl_commit_compilation
void gsl_commit_compilation(void)
Definition: goomsl_yacc.c:1150
InstructionData
struct _INSTRUCTION_DATA InstructionData
ConstFloatNodeType
struct _ConstFloatNodeType ConstFloatNodeType
GSL_Struct
struct _GSL_Struct GSL_Struct
GSL_StructField
struct _GSL_StructField GSL_StructField
gsl_reenternamespace
void gsl_reenternamespace(GoomHash *ns)
Definition: goomsl.c:823
ConstIntNodeType
struct _ConstIntNodeType ConstIntNodeType
currentGoomSL
GoomSL * currentGoomSL
Definition: goomsl_lex.c:635
gsl_find_namespace
GoomHash * gsl_find_namespace(const char *name)
Definition: goomsl.c:834
Block
struct _Block Block
gsl_enternamespace
void gsl_enternamespace(const char *name)
Definition: goomsl.c:809
FastInstruction
struct _FAST_INSTRUCTION FastInstruction
ConstPtrNodeType
struct _ConstPtrNodeType ConstPtrNodeType
OprNodeType
struct _OprNodeType OprNodeType
GOOM_HASH
Definition: goomsl_hash.h:20
_Block
Definition: goomsl_private.h:147
_Block::data
int data
Definition: goomsl_private.h:148
_Block::size
int size
Definition: goomsl_private.h:149
_ConstFloatNodeType
Definition: goomsl_private.h:54
_ConstFloatNodeType::val
float val
Definition: goomsl_private.h:55
_ConstIntNodeType
Definition: goomsl_private.h:51
_ConstIntNodeType::val
int val
Definition: goomsl_private.h:52
_ConstPtrNodeType
Definition: goomsl_private.h:57
_ConstPtrNodeType::id
int id
Definition: goomsl_private.h:58
_ExternalFunctionStruct
Definition: goomsl_private.h:141
_ExternalFunctionStruct::is_extern
int is_extern
Definition: goomsl_private.h:144
_ExternalFunctionStruct::function
GoomSL_ExternalFunction function
Definition: goomsl_private.h:142
_ExternalFunctionStruct::vars
GoomHash * vars
Definition: goomsl_private.h:143
_FAST_INSTRUCTION
Definition: goomsl_private.h:129
_FAST_INSTRUCTION::proto
Instruction * proto
Definition: goomsl_private.h:132
_FAST_INSTRUCTION::data
InstructionData data
Definition: goomsl_private.h:131
_FAST_INSTRUCTION::id
int id
Definition: goomsl_private.h:130
_FastInstructionFlow
Definition: goomsl_private.h:135
_FastInstructionFlow::mallocedInstr
void * mallocedInstr
Definition: goomsl_private.h:138
_FastInstructionFlow::instr
FastInstruction * instr
Definition: goomsl_private.h:137
_FastInstructionFlow::number
int number
Definition: goomsl_private.h:136
_GOOM_HEAP
Definition: goomsl_heap.c:10
_GSL_StructField
Definition: goomsl_private.h:151
_GSL_StructField::offsetInStruct
int offsetInStruct
Definition: goomsl_private.h:154
_GSL_StructField::type
int type
Definition: goomsl_private.h:152
_GSL_StructField::name
char name[256]
Definition: goomsl_private.h:153
_GSL_Struct
Definition: goomsl_private.h:157
_GSL_Struct::fields
GSL_StructField * fields[64]
Definition: goomsl_private.h:159
_GSL_Struct::iBlock
Block iBlock[64]
Definition: goomsl_private.h:161
_GSL_Struct::nbFields
int nbFields
Definition: goomsl_private.h:158
_GSL_Struct::fBlock
Block fBlock[64]
Definition: goomsl_private.h:162
_GSL_Struct::size
int size
Definition: goomsl_private.h:160
_GoomSL
Definition: goomsl_private.h:165
_GoomSL::nbPtr
int nbPtr
Definition: goomsl_private.h:185
_GoomSL::iflow
InstructionFlow * iflow
Definition: goomsl_private.h:169
_GoomSL::ptrArraySize
int ptrArraySize
Definition: goomsl_private.h:186
_GoomSL::namespaces
GoomHash * namespaces[16]
Definition: goomsl_private.h:174
_GoomSL::gsl_struct
GSL_Struct ** gsl_struct
Definition: goomsl_private.h:182
_GoomSL::num_lines
int num_lines
Definition: goomsl_private.h:166
_GoomSL::functions
GoomHash * functions
Definition: goomsl_private.h:176
_GoomSL::data_heap
GoomHeap * data_heap
Definition: goomsl_private.h:178
_GoomSL::fastiflow
FastInstructionFlow * fastiflow
Definition: goomsl_private.h:170
_GoomSL::nbStructID
int nbStructID
Definition: goomsl_private.h:180
_GoomSL::vars
GoomHash * vars
Definition: goomsl_private.h:172
_GoomSL::currentNS
int currentNS
Definition: goomsl_private.h:173
_GoomSL::structIDS
GoomHash * structIDS
Definition: goomsl_private.h:181
_GoomSL::instr
Instruction * instr
Definition: goomsl_private.h:167
_GoomSL::gsl_struct_size
int gsl_struct_size
Definition: goomsl_private.h:183
_GoomSL::compilationOK
int compilationOK
Definition: goomsl_private.h:189
_GoomSL::ptrArray
void ** ptrArray
Definition: goomsl_private.h:187
_INSTRUCTION_DATA
Definition: goomsl_private.h:78
_INSTRUCTION_DATA::value_int
int value_int
Definition: goomsl_private.h:94
_INSTRUCTION_DATA::var
void * var
Definition: goomsl_private.h:81
_INSTRUCTION_DATA::value_float
float value_float
Definition: goomsl_private.h:96
_INSTRUCTION_DATA::var_float
float * var_float
Definition: goomsl_private.h:84
_INSTRUCTION_DATA::value_ptr
int value_ptr
Definition: goomsl_private.h:95
_INSTRUCTION_DATA::external_function
struct _ExternalFunctionStruct * external_function
Definition: goomsl_private.h:86
_INSTRUCTION_DATA::udest
union _INSTRUCTION_DATA::@46 udest
_INSTRUCTION_DATA::jump_offset
int jump_offset
Definition: goomsl_private.h:85
_INSTRUCTION_DATA::var_ptr
int * var_ptr
Definition: goomsl_private.h:83
_INSTRUCTION_DATA::var_int
int * var_int
Definition: goomsl_private.h:82
_INSTRUCTION_DATA::usrc
union _INSTRUCTION_DATA::@47 usrc
_INSTRUCTION_FLOW
Definition: goomsl_private.h:121
_INSTRUCTION_FLOW::instr
Instruction ** instr
Definition: goomsl_private.h:123
_INSTRUCTION_FLOW::labels
GoomHash * labels
Definition: goomsl_private.h:126
_INSTRUCTION_FLOW::number
int number
Definition: goomsl_private.h:124
_INSTRUCTION_FLOW::tabsize
int tabsize
Definition: goomsl_private.h:125
_INSTRUCTION
Definition: goomsl_private.h:100
_INSTRUCTION::nop_label
char * nop_label
Definition: goomsl_private.h:115
_INSTRUCTION::parent
GoomSL * parent
Definition: goomsl_private.h:104
_INSTRUCTION::name
const char * name
Definition: goomsl_private.h:105
_INSTRUCTION::vnamespace
GoomHash ** vnamespace
Definition: goomsl_private.h:108
_INSTRUCTION::line_number
int line_number
Definition: goomsl_private.h:117
_INSTRUCTION::nb_param
int nb_param
Definition: goomsl_private.h:111
_INSTRUCTION::id
int id
Definition: goomsl_private.h:102
_INSTRUCTION::params
char ** params
Definition: goomsl_private.h:107
_INSTRUCTION::data
InstructionData data
Definition: goomsl_private.h:103
_INSTRUCTION::jump_label
char * jump_label
Definition: goomsl_private.h:114
_INSTRUCTION::types
int * types
Definition: goomsl_private.h:109
_INSTRUCTION::address
int address
Definition: goomsl_private.h:113
_INSTRUCTION::cur_param
int cur_param
Definition: goomsl_private.h:110
_NODE_TYPE
Definition: goomsl_private.h:66
_NODE_TYPE::opr
OprNodeType opr
Definition: goomsl_private.h:75
_NODE_TYPE::vnamespace
GoomHash * vnamespace
Definition: goomsl_private.h:69
_NODE_TYPE::type
int type
Definition: goomsl_private.h:67
_NODE_TYPE::constInt
ConstIntNodeType constInt
Definition: goomsl_private.h:72
_NODE_TYPE::unode
union _NODE_TYPE::@45 unode
_NODE_TYPE::line_number
int line_number
Definition: goomsl_private.h:70
_NODE_TYPE::str
char * str
Definition: goomsl_private.h:68
_NODE_TYPE::constFloat
ConstFloatNodeType constFloat
Definition: goomsl_private.h:73
_NODE_TYPE::constPtr
ConstPtrNodeType constPtr
Definition: goomsl_private.h:74
_OprNodeType
Definition: goomsl_private.h:60
_OprNodeType::next
struct _NODE_TYPE * next
Definition: goomsl_private.h:64
_OprNodeType::op
struct _NODE_TYPE * op[3]
Definition: goomsl_private.h:63
_OprNodeType::type
int type
Definition: goomsl_private.h:61
_OprNodeType::nbOp
int nbOp
Definition: goomsl_private.h:62
name
const char * name
Definition: xine.c:1569
type
_xine_arg_type_t type
Definition: xine.c:1568