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 #define RPC_FC_MODULE 0xfc
39 #define RPC_FC_COCLASS 0xfd
40 #define RPC_FC_FUNCTION 0xfe
42 typedef struct _loc_info_t loc_info_t;
43 typedef struct _attr_t attr_t;
44 typedef struct _expr_t expr_t;
45 typedef struct _type_t type_t;
46 typedef struct _typeref_t typeref_t;
47 typedef struct _var_t var_t;
48 typedef struct _declarator_t declarator_t;
49 typedef struct _func_t func_t;
50 typedef struct _ifref_t ifref_t;
51 typedef struct _typelib_entry_t typelib_entry_t;
52 typedef struct _importlib_t importlib_t;
53 typedef struct _importinfo_t importinfo_t;
54 typedef struct _typelib_t typelib_t;
55 typedef struct _user_type_t user_type_t;
56 typedef struct _user_type_t context_handle_t;
57 typedef struct _type_list_t type_list_t;
58 typedef struct _statement_t statement_t;
60 typedef struct list attr_list_t;
61 typedef struct list str_list_t;
62 typedef struct list func_list_t;
63 typedef struct list expr_list_t;
64 typedef struct list var_list_t;
65 typedef struct list declarator_list_t;
66 typedef struct list ifref_list_t;
67 typedef struct list array_dims_t;
68 typedef struct list user_type_list_t;
69 typedef struct list context_handle_list_t;
70 typedef struct list statement_list_t;
81 ATTR_CALLCONV, /* calling convention pseudo-attribute */
83 ATTR_CONST, /* const pseudo-attribute */
101 ATTR_HELPSTRINGCONTEXT,
108 ATTR_IMPLICIT_HANDLE,
136 ATTR_STRICTCONTEXTHANDLE,
191 TKIND_PRIMITIVE = -1,
226 const char *input_name;
228 const char *near_text;
231 struct str_list_entry_t
243 /* parser-internal */
260 /* parser-internal */
264 struct struct_details
269 struct enumeration_details
282 statement_list_t *stmts;
283 func_list_t *disp_methods;
284 var_list_t *disp_props;
287 struct module_details
289 statement_list_t *stmts;
296 expr_t *size_is, *length_is;
299 struct coclass_details
301 ifref_list_t *ifaces;
307 TYPE_BASIC, /* ints, floats and handles */
310 TYPE_ENCAPSULATED_UNION,
328 struct struct_details *structure;
329 struct enumeration_details *enumeration;
330 struct func_details *function;
331 struct iface_details *iface;
332 struct module_details *module;
333 struct array_details array;
334 struct coclass_details coclass;
336 type_t *orig; /* dup'd types */
337 unsigned int typestring_offset;
338 unsigned int ptrdesc; /* used for complex structs */
341 unsigned int declarray : 1; /* if declared as an array */
342 unsigned int ignore : 1;
343 unsigned int defined : 1;
344 unsigned int written : 1;
345 unsigned int user_types_registered : 1;
346 unsigned int tfswrite : 1; /* if the type needs to be written to the TFS */
347 unsigned int checked : 1;
348 unsigned int is_alias : 1; /* is the type an alias? */
357 enum storage_class stgclass;
359 struct _loc_info_t loc_info;
361 /* parser-internal */
365 struct _declarator_t {
371 /* parser-internal */
378 /* parser-internal */
386 /* parser-internal */
390 struct _typelib_entry_t {
395 struct _importinfo_t {
403 importlib_t *importlib;
406 struct _importlib_t {
412 importinfo_t *importinfos;
423 const attr_list_t *attrs;
424 struct list importlibs;
425 statement_list_t *stmts;
428 struct _user_type_t {
433 struct _type_list_t {
435 struct _type_list_t *next;
438 struct _statement_t {
440 enum statement_type type;
448 type_list_t *type_list;
452 extern unsigned char pointer_default;
454 extern user_type_list_t user_type_list;
455 void check_for_additional_prototype_types(const var_list_t *list);
457 void init_types(void);
458 type_t *alloc_type(void);
459 void set_all_tfswrite(int val);
460 void clear_all_offsets(void);
462 int is_ptr(const type_t *t);
463 int is_array(const type_t *t);
464 int is_var_ptr(const var_t *v);
465 int cant_be_null(const var_t *v);
466 int is_struct(unsigned char tc);
467 int is_union(unsigned char tc);
469 var_t *find_const(const char *name, int f);
470 type_t *find_type(const char *name, int t);
471 type_t *make_type(unsigned char type, type_t *ref);
473 void init_loc_info(loc_info_t *);
475 static inline var_list_t *type_get_function_args(const type_t *func_type)
477 return func_type->details.function->args;
480 static inline enum type_type type_get_type_detect_alias(const type_t *type)
501 case RPC_FC_ERROR_STATUS_T:
502 case RPC_FC_BIND_PRIMITIVE:
515 case RPC_FC_CPSTRUCT:
516 case RPC_FC_CVSTRUCT:
517 case RPC_FC_BOGUS_STRUCT:
519 case RPC_FC_ENCAPSULATED_UNION:
520 return TYPE_ENCAPSULATED_UNION;
521 case RPC_FC_NON_ENCAPSULATED_UNION:
523 case RPC_FC_SMFARRAY:
524 case RPC_FC_LGFARRAY:
525 case RPC_FC_SMVARRAY:
526 case RPC_FC_LGVARRAY:
529 case RPC_FC_BOGUS_ARRAY:
531 case RPC_FC_FUNCTION:
532 return TYPE_FUNCTION;
536 return TYPE_INTERFACE;
545 #define STATEMENTS_FOR_EACH_FUNC(stmt, stmts) \
546 if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, statement_t, entry ) \
547 if (stmt->type == STMT_DECLARATION && stmt->u.var->stgclass == STG_NONE && \
548 type_get_type_detect_alias(stmt->u.var->type) == TYPE_FUNCTION)
550 static inline int statements_has_func(const statement_list_t *stmts)
552 const statement_t *stmt;
554 STATEMENTS_FOR_EACH_FUNC(stmt, stmts)