4 * Copyright 2002 Ove Kaaven
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __WIDL_WIDLTYPES_H
22 #define __WIDL_WIDLTYPES_H
27 #include "wine/rpcfc.h"
28 #include "wine/list.h"
38 typedef struct _loc_info_t loc_info_t;
39 typedef struct _attr_t attr_t;
40 typedef struct _expr_t expr_t;
41 typedef struct _type_t type_t;
42 typedef struct _var_t var_t;
43 typedef struct _declarator_t declarator_t;
44 typedef struct _ifref_t ifref_t;
45 typedef struct _typelib_entry_t typelib_entry_t;
46 typedef struct _importlib_t importlib_t;
47 typedef struct _importinfo_t importinfo_t;
48 typedef struct _typelib_t typelib_t;
49 typedef struct _user_type_t user_type_t;
50 typedef struct _user_type_t context_handle_t;
51 typedef struct _user_type_t generic_handle_t;
52 typedef struct _type_list_t type_list_t;
53 typedef struct _statement_t statement_t;
55 typedef struct list attr_list_t;
56 typedef struct list str_list_t;
57 typedef struct list expr_list_t;
58 typedef struct list var_list_t;
59 typedef struct list declarator_list_t;
60 typedef struct list ifref_list_t;
61 typedef struct list array_dims_t;
62 typedef struct list user_type_list_t;
63 typedef struct list context_handle_list_t;
64 typedef struct list generic_handle_list_t;
65 typedef struct list statement_list_t;
77 ATTR_CALLCONV, /* calling convention pseudo-attribute */
81 ATTR_CONST, /* const pseudo-attribute */
90 ATTR_DISABLECONSISTENCYCHECK,
106 ATTR_HELPSTRINGCONTEXT,
114 ATTR_IMPLICIT_HANDLE,
154 ATTR_STRICTCONTEXTHANDLE,
162 ATTR_USESGETLASTERROR,
215 TKIND_PRIMITIVE = -1,
250 THREADING_APARTMENT = 1,
271 TYPE_BASIC_ERROR_STATUS_T,
275 #define TYPE_BASIC_MAX TYPE_BASIC_HANDLE
276 #define TYPE_BASIC_INT_MIN TYPE_BASIC_INT8
277 #define TYPE_BASIC_INT_MAX TYPE_BASIC_HYPER
281 const char *input_name;
283 const char *near_text;
286 struct str_list_entry_t
298 /* parser-internal */
315 /* parser-internal */
319 struct struct_details
324 struct enumeration_details
332 struct _var_t *retval;
338 statement_list_t *stmts;
339 var_list_t *disp_methods;
340 var_list_t *disp_props;
341 struct _type_t *inherit;
344 struct module_details
346 statement_list_t *stmts;
353 struct _type_t *elem;
355 unsigned char ptr_def_fc;
356 unsigned char declptr; /* if declared as a pointer */
357 unsigned short ptr_tfsoff; /* offset of pointer definition for declptr */
360 struct coclass_details
362 ifref_list_t *ifaces;
367 enum type_basic_type type;
371 struct pointer_details
374 unsigned char def_fc;
377 struct bitfield_details
379 struct _type_t *field;
386 TYPE_BASIC, /* ints, floats and handles */
389 TYPE_ENCAPSULATED_UNION,
403 enum type_type type_type;
407 struct struct_details *structure;
408 struct enumeration_details *enumeration;
409 struct func_details *function;
410 struct iface_details *iface;
411 struct module_details *module;
412 struct array_details array;
413 struct coclass_details coclass;
414 struct basic_details basic;
415 struct pointer_details pointer;
416 struct bitfield_details bitfield;
418 type_t *orig; /* dup'd types */
419 unsigned int typestring_offset;
420 unsigned int ptrdesc; /* used for complex structs */
423 unsigned int ignore : 1;
424 unsigned int defined : 1;
425 unsigned int written : 1;
426 unsigned int user_types_registered : 1;
427 unsigned int tfswrite : 1; /* if the type needs to be written to the TFS */
428 unsigned int checked : 1;
429 unsigned int is_alias : 1; /* is the type an alias? */
437 enum storage_class stgclass;
438 unsigned int procstring_offset;
439 unsigned int typestring_offset;
441 struct _loc_info_t loc_info;
443 /* parser-internal */
447 struct _declarator_t {
454 /* parser-internal */
462 /* parser-internal */
466 struct _typelib_entry_t {
471 struct _importinfo_t {
479 importlib_t *importlib;
482 struct _importlib_t {
488 importinfo_t *importinfos;
498 const attr_list_t *attrs;
499 struct list importlibs;
500 statement_list_t *stmts;
503 struct _user_type_t {
508 struct _type_list_t {
510 struct _type_list_t *next;
513 struct _statement_t {
515 enum statement_type type;
523 type_list_t *type_list;
534 extern syskind_t typelib_kind;
535 extern user_type_list_t user_type_list;
536 extern context_handle_list_t context_handle_list;
537 extern generic_handle_list_t generic_handle_list;
538 void check_for_additional_prototype_types(const var_list_t *list);
540 void init_types(void);
541 type_t *alloc_type(void);
542 void set_all_tfswrite(int val);
543 void clear_all_offsets(void);
545 int is_ptr(const type_t *t);
546 int is_array(const type_t *t);
552 var_t *find_const(const char *name, int f);
553 type_t *find_type(const char *name, int t);
554 type_t *make_type(enum type_type type);
555 type_t *get_type(enum type_type type, char *name, int t);
556 type_t *reg_type(type_t *type, const char *name, int t);
557 void add_incomplete(type_t *t);
559 var_t *make_var(char *name);
560 var_list_t *append_var(var_list_t *list, var_t *var);
562 void init_loc_info(loc_info_t *);
564 static inline var_list_t *type_get_function_args(const type_t *func_type)
566 return func_type->details.function->args;
569 static inline enum type_type type_get_type_detect_alias(const type_t *type)
573 return type->type_type;
576 #define STATEMENTS_FOR_EACH_FUNC(stmt, stmts) \
577 if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, statement_t, entry ) \
578 if (stmt->type == STMT_DECLARATION && stmt->u.var->stgclass == STG_NONE && \
579 type_get_type_detect_alias(stmt->u.var->type) == TYPE_FUNCTION)
581 static inline int statements_has_func(const statement_list_t *stmts)
583 const statement_t *stmt;
585 STATEMENTS_FOR_EACH_FUNC(stmt, stmts)