~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/jscript/engine.h

Version: ~ [ wine-1.1.33 ] ~ [ wine-1.1.32 ] ~ [ wine-1.1.31 ] ~ [ wine-1.1.30 ] ~ [ wine-1.1.29 ] ~ [ wine-1.1.28 ] ~ [ wine-1.1.27 ] ~ [ wine-1.1.26 ] ~ [ wine-1.1.25 ] ~ [ wine-1.1.24 ] ~ [ wine-1.1.23 ] ~ [ wine-1.1.22 ] ~ [ wine-1.1.21 ] ~ [ wine-1.1.20 ] ~ [ wine-1.1.19 ] ~ [ wine-1.1.18 ] ~ [ wine-1.1.17 ] ~ [ wine-1.1.16 ] ~ [ wine-1.1.15 ] ~ [ wine-1.1.14 ] ~ [ wine-1.1.13 ] ~ [ wine-1.1.12 ] ~ [ wine-1.1.11 ] ~ [ wine-1.1.10 ] ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~

  1 /*
  2  * Copyright 2008 Jacek Caban for CodeWeavers
  3  *
  4  * This library is free software; you can redistribute it and/or
  5  * modify it under the terms of the GNU Lesser General Public
  6  * License as published by the Free Software Foundation; either
  7  * version 2.1 of the License, or (at your option) any later version.
  8  *
  9  * This library is distributed in the hope that it will be useful,
 10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 12  * Lesser General Public License for more details.
 13  *
 14  * You should have received a copy of the GNU Lesser General Public
 15  * License along with this library; if not, write to the Free Software
 16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 17  */
 18 
 19 typedef struct _source_elements_t source_elements_t;
 20 typedef struct _function_expression_t function_expression_t;
 21 
 22 typedef struct _obj_literal_t {
 23     DispatchEx *obj;
 24     struct _obj_literal_t *next;
 25 } obj_literal_t;
 26 
 27 typedef struct _function_declaration_t {
 28     function_expression_t *expr;
 29 
 30     struct _function_declaration_t *next;
 31 } function_declaration_t;
 32 
 33 typedef struct _var_list_t {
 34     const WCHAR *identifier;
 35 
 36     struct _var_list_t *next;
 37 } var_list_t;
 38 
 39 typedef struct _func_stack {
 40     function_declaration_t *func_head;
 41     function_declaration_t *func_tail;
 42     var_list_t *var_head;
 43     var_list_t *var_tail;
 44 
 45     struct _func_stack *next;
 46 } func_stack_t;
 47 
 48 typedef struct _parser_ctx_t {
 49     LONG ref;
 50 
 51     const WCHAR *ptr;
 52     const WCHAR *begin;
 53     const WCHAR *end;
 54 
 55     script_ctx_t *script;
 56     source_elements_t *source;
 57     BOOL nl;
 58     BOOL is_html;
 59     HRESULT hres;
 60 
 61     jsheap_t heap;
 62 
 63     obj_literal_t *obj_literals;
 64     func_stack_t *func_stack;
 65 
 66     struct _parser_ctx_t *next;
 67 } parser_ctx_t;
 68 
 69 HRESULT script_parse(script_ctx_t*,const WCHAR*,const WCHAR*,parser_ctx_t**);
 70 void parser_release(parser_ctx_t*);
 71 
 72 int parser_lex(void*,parser_ctx_t*);
 73 
 74 static inline void parser_addref(parser_ctx_t *ctx)
 75 {
 76     ctx->ref++;
 77 }
 78 
 79 static inline void *parser_alloc(parser_ctx_t *ctx, DWORD size)
 80 {
 81     return jsheap_alloc(&ctx->heap, size);
 82 }
 83 
 84 static inline void *parser_alloc_tmp(parser_ctx_t *ctx, DWORD size)
 85 {
 86     return jsheap_alloc(&ctx->script->tmp_heap, size);
 87 }
 88 
 89 typedef struct _scope_chain_t {
 90     LONG ref;
 91     DispatchEx *obj;
 92     struct _scope_chain_t *next;
 93 } scope_chain_t;
 94 
 95 HRESULT scope_push(scope_chain_t*,DispatchEx*,scope_chain_t**);
 96 void scope_release(scope_chain_t*);
 97 
 98 static inline void scope_addref(scope_chain_t *scope)
 99 {
100     scope->ref++;
101 }
102 
103 struct _exec_ctx_t {
104     LONG ref;
105 
106     parser_ctx_t *parser;
107     scope_chain_t *scope_chain;
108     DispatchEx *var_disp;
109     IDispatch *this_obj;
110 };
111 
112 static inline void exec_addref(exec_ctx_t *ctx)
113 {
114     ctx->ref++;
115 }
116 
117 void exec_release(exec_ctx_t*);
118 HRESULT create_exec_ctx(IDispatch*,DispatchEx*,scope_chain_t*,exec_ctx_t**);
119 HRESULT exec_source(exec_ctx_t*,parser_ctx_t*,source_elements_t*,jsexcept_t*,VARIANT*);
120 
121 typedef struct _statement_t statement_t;
122 typedef struct _expression_t expression_t;
123 typedef struct _parameter_t parameter_t;
124 
125 HRESULT create_source_function(parser_ctx_t*,parameter_t*,source_elements_t*,scope_chain_t*,
126         const WCHAR*,DWORD,DispatchEx**);
127 
128 typedef struct {
129     VARTYPE vt;
130     union {
131         LONG lval;
132         double dval;
133         const WCHAR *wstr;
134         VARIANT_BOOL bval;
135         IDispatch *disp;
136     } u;
137 } literal_t;
138 
139 literal_t *parse_regexp(parser_ctx_t*);
140 
141 typedef struct _variable_declaration_t {
142     const WCHAR *identifier;
143     expression_t *expr;
144 
145     struct _variable_declaration_t *next;
146 } variable_declaration_t;
147 
148 typedef struct {
149     enum{
150         RT_NORMAL,
151         RT_RETURN,
152         RT_BREAK,
153         RT_CONTINUE
154     } type;
155     jsexcept_t ei;
156 } return_type_t;
157 
158 typedef HRESULT (*statement_eval_t)(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
159 
160 struct _statement_t {
161     statement_eval_t eval;
162     statement_t *next;
163 };
164 
165 typedef struct {
166     statement_t stat;
167     statement_t *stat_list;
168 } block_statement_t;
169 
170 typedef struct {
171     statement_t stat;
172     variable_declaration_t *variable_list;
173 } var_statement_t;
174 
175 typedef struct {
176     statement_t stat;
177     expression_t *expr;
178 } expression_statement_t;
179 
180 typedef struct {
181     statement_t stat;
182     expression_t *expr;
183     statement_t *if_stat;
184     statement_t *else_stat;
185 } if_statement_t;
186 
187 typedef struct {
188     statement_t stat;
189     BOOL do_while;
190     expression_t *expr;
191     statement_t *statement;
192 } while_statement_t;
193 
194 typedef struct {
195     statement_t stat;
196     variable_declaration_t *variable_list;
197     expression_t *begin_expr;
198     expression_t *expr;
199     expression_t *end_expr;
200     statement_t *statement;
201 } for_statement_t;
202 
203 typedef struct {
204     statement_t stat;
205     variable_declaration_t *variable;
206     expression_t *expr;
207     expression_t *in_expr;
208     statement_t *statement;
209 } forin_statement_t;
210 
211 typedef struct {
212     statement_t stat;
213     const WCHAR *identifier;
214 } branch_statement_t;
215 
216 typedef struct {
217     statement_t stat;
218     expression_t *expr;
219     statement_t *statement;
220 } with_statement_t;
221 
222 typedef struct {
223     statement_t stat;
224     const WCHAR *identifier;
225     statement_t *statement;
226 } labelled_statement_t;
227 
228 typedef struct _case_clausule_t {
229     expression_t *expr;
230     statement_t *stat;
231 
232     struct _case_clausule_t *next;
233 } case_clausule_t;
234 
235 typedef struct {
236     statement_t stat;
237     expression_t *expr;
238     case_clausule_t *case_list;
239 } switch_statement_t;
240 
241 typedef struct {
242     const WCHAR *identifier;
243     statement_t *statement;
244 } catch_block_t;
245 
246 typedef struct {
247     statement_t stat;
248     statement_t *try_statement;
249     catch_block_t *catch_block;
250     statement_t *finally_statement;
251 } try_statement_t;
252 
253 HRESULT block_statement_eval(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
254 HRESULT var_statement_eval(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
255 HRESULT empty_statement_eval(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
256 HRESULT expression_statement_eval(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
257 HRESULT if_statement_eval(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
258 HRESULT while_statement_eval(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
259 HRESULT for_statement_eval(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
260 HRESULT forin_statement_eval(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
261 HRESULT continue_statement_eval(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
262 HRESULT break_statement_eval(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
263 HRESULT return_statement_eval(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
264 HRESULT with_statement_eval(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
265 HRESULT labelled_statement_eval(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
266 HRESULT switch_statement_eval(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
267 HRESULT throw_statement_eval(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
268 HRESULT try_statement_eval(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
269 
270 typedef struct {
271     enum {
272         EXPRVAL_VARIANT,
273         EXPRVAL_IDREF,
274         EXPRVAL_NAMEREF
275     } type;
276     union {
277         VARIANT var;
278         struct {
279             IDispatch *disp;
280             DISPID id;
281         } idref;
282         struct {
283             IDispatch *disp;
284             BSTR name;
285         } nameref;
286     } u;
287 } exprval_t;
288 
289 typedef HRESULT (*expression_eval_t)(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
290 
291 struct _expression_t {
292     expression_eval_t eval;
293 };
294 
295 struct _parameter_t {
296     const WCHAR *identifier;
297 
298     struct _parameter_t *next;
299 };
300 
301 struct _source_elements_t {
302     statement_t *statement;
303     statement_t *statement_tail;
304     function_declaration_t *functions;
305     var_list_t *variables;
306 };
307 
308 struct _function_expression_t {
309     expression_t expr;
310     const WCHAR *identifier;
311     parameter_t *parameter_list;
312     source_elements_t *source_elements;
313     const WCHAR *src_str;
314     DWORD src_len;
315 };
316 
317 typedef struct {
318     expression_t expr;
319     expression_t *expression1;
320     expression_t *expression2;
321 } binary_expression_t;
322 
323 typedef struct {
324     expression_t expr;
325     expression_t *expression;
326 } unary_expression_t;
327 
328 typedef struct {
329     expression_t expr;
330     expression_t *expression;
331     expression_t *true_expression;
332     expression_t *false_expression;
333 } conditional_expression_t;
334 
335 typedef struct {
336     expression_t expr;
337     expression_t *member_expr;
338     expression_t *expression;
339 } array_expression_t;
340 
341 typedef struct {
342     expression_t expr;
343     expression_t *expression;
344     const WCHAR *identifier;
345 } member_expression_t;
346 
347 typedef struct _argument_t {
348     expression_t *expr;
349 
350     struct _argument_t *next;
351 } argument_t;
352 
353 typedef struct {
354     expression_t expr;
355     expression_t *expression;
356     argument_t *argument_list;
357 } call_expression_t;
358 
359 typedef struct {
360     expression_t expr;
361     const WCHAR *identifier;
362 } identifier_expression_t;
363 
364 typedef struct {
365     expression_t expr;
366     literal_t *literal;
367 } literal_expression_t;
368 
369 typedef struct _array_element_t {
370     int elision;
371     expression_t *expr;
372 
373     struct _array_element_t *next;
374 } array_element_t;
375 
376 typedef struct {
377     expression_t expr;
378     array_element_t *element_list;
379     int length;
380 } array_literal_expression_t;
381 
382 typedef struct _prop_val_t {
383     literal_t *name;
384     expression_t *value;
385 
386     struct _prop_val_t *next;
387 } prop_val_t;
388 
389 typedef struct {
390     expression_t expr;
391     prop_val_t *property_list;
392 } property_value_expression_t;
393 
394 typedef enum {
395      EXPR_COMMA,
396      EXPR_OR,
397      EXPR_AND,
398      EXPR_BOR,
399      EXPR_BXOR,
400      EXPR_BAND,
401      EXPR_INSTANCEOF,
402      EXPR_IN,
403      EXPR_ADD,
404      EXPR_SUB,
405      EXPR_MUL,
406      EXPR_DIV,
407      EXPR_MOD,
408      EXPR_DELETE,
409      EXPR_VOID,
410      EXPR_TYPEOF,
411      EXPR_MINUS,
412      EXPR_PLUS,
413      EXPR_POSTINC,
414      EXPR_POSTDEC,
415      EXPR_PREINC,
416      EXPR_PREDEC,
417      EXPR_EQ,
418      EXPR_EQEQ,
419      EXPR_NOTEQ,
420      EXPR_NOTEQEQ,
421      EXPR_LESS,
422      EXPR_LESSEQ,
423      EXPR_GREATER,
424      EXPR_GREATEREQ,
425      EXPR_BITNEG,
426      EXPR_LOGNEG,
427      EXPR_LSHIFT,
428      EXPR_RSHIFT,
429      EXPR_RRSHIFT,
430      EXPR_ASSIGN,
431      EXPR_ASSIGNLSHIFT,
432      EXPR_ASSIGNRSHIFT,
433      EXPR_ASSIGNRRSHIFT,
434      EXPR_ASSIGNADD,
435      EXPR_ASSIGNSUB,
436      EXPR_ASSIGNMUL,
437      EXPR_ASSIGNDIV,
438      EXPR_ASSIGNMOD,
439      EXPR_ASSIGNAND,
440      EXPR_ASSIGNOR,
441      EXPR_ASSIGNXOR
442 } expression_type_t;
443 
444 HRESULT function_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
445 HRESULT conditional_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
446 HRESULT array_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
447 HRESULT member_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
448 HRESULT new_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
449 HRESULT call_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
450 HRESULT this_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
451 HRESULT identifier_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
452 HRESULT literal_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
453 HRESULT array_literal_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
454 HRESULT property_value_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
455 
456 HRESULT comma_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
457 HRESULT logical_or_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
458 HRESULT logical_and_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
459 HRESULT binary_or_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
460 HRESULT binary_xor_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
461 HRESULT binary_and_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
462 HRESULT instanceof_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
463 HRESULT in_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
464 HRESULT add_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
465 HRESULT sub_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
466 HRESULT mul_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
467 HRESULT div_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
468 HRESULT mod_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
469 HRESULT delete_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
470 HRESULT void_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
471 HRESULT typeof_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
472 HRESULT minus_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
473 HRESULT plus_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
474 HRESULT post_increment_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
475 HRESULT post_decrement_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
476 HRESULT pre_increment_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
477 HRESULT pre_decrement_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
478 HRESULT equal_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
479 HRESULT equal2_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
480 HRESULT not_equal_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
481 HRESULT not_equal2_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
482 HRESULT less_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
483 HRESULT lesseq_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
484 HRESULT greater_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
485 HRESULT greatereq_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
486 HRESULT binary_negation_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
487 HRESULT logical_negation_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
488 HRESULT left_shift_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
489 HRESULT right_shift_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
490 HRESULT right2_shift_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
491 HRESULT assign_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
492 HRESULT assign_lshift_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
493 HRESULT assign_rshift_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
494 HRESULT assign_rrshift_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
495 HRESULT assign_add_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
496 HRESULT assign_sub_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
497 HRESULT assign_mul_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
498 HRESULT assign_div_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
499 HRESULT assign_mod_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
500 HRESULT assign_and_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
501 HRESULT assign_or_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
502 HRESULT assign_xor_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
503 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.