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
26 #define E_OUTOFMEMORY ((HRESULT)0x8007000EL)
27 #define TYPE_E_IOERROR ((HRESULT)0x80028CA2L)
29 #define max(a, b) ((a) > (b) ? a : b)
34 #include "wine/rpcfc.h"
35 #include "wine/list.h"
45 typedef struct _loc_info_t loc_info_t
;
46 typedef struct _attr_t attr_t
;
47 typedef struct _expr_t expr_t
;
48 typedef struct _type_t type_t
;
49 typedef struct _var_t var_t
;
50 typedef struct _declarator_t declarator_t
;
51 typedef struct _ifref_t ifref_t
;
52 typedef struct _typelib_entry_t typelib_entry_t
;
53 typedef struct _importlib_t importlib_t
;
54 typedef struct _importinfo_t importinfo_t
;
55 typedef struct _typelib_t typelib_t
;
56 typedef struct _user_type_t user_type_t
;
57 typedef struct _user_type_t context_handle_t
;
58 typedef struct _type_list_t type_list_t
;
59 typedef struct _statement_t statement_t
;
61 typedef struct list attr_list_t
;
62 typedef struct list str_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
;
82 ATTR_CALLCONV
, /* calling convention pseudo-attribute */
84 ATTR_CONST
, /* const pseudo-attribute */
102 ATTR_HELPSTRINGCONTEXT
,
109 ATTR_IMPLICIT_HANDLE
,
138 ATTR_STRICTCONTEXTHANDLE
,
194 TKIND_PRIMITIVE
= -1,
241 TYPE_BASIC_ERROR_STATUS_T
,
245 #define TYPE_BASIC_MAX TYPE_BASIC_HANDLE
246 #define TYPE_BASIC_INT_MIN TYPE_BASIC_INT8
247 #define TYPE_BASIC_INT_MAX TYPE_BASIC_HYPER
251 const char *input_name
;
253 const char *near_text
;
256 struct str_list_entry_t
268 /* parser-internal */
285 /* parser-internal */
289 struct struct_details
294 struct enumeration_details
302 struct _type_t
*rettype
;
308 statement_list_t
*stmts
;
309 var_list_t
*disp_methods
;
310 var_list_t
*disp_props
;
311 struct _type_t
*inherit
;
314 struct module_details
316 statement_list_t
*stmts
;
323 struct _type_t
*elem
;
325 unsigned char ptr_def_fc
;
326 unsigned char declptr
; /* if declared as a pointer */
329 struct coclass_details
331 ifref_list_t
*ifaces
;
336 enum type_basic_type type
;
340 struct pointer_details
343 unsigned char def_fc
;
346 struct bitfield_details
348 struct _type_t
*field
;
355 TYPE_BASIC
, /* ints, floats and handles */
358 TYPE_ENCAPSULATED_UNION
,
372 enum type_type type_type
;
376 struct struct_details
*structure
;
377 struct enumeration_details
*enumeration
;
378 struct func_details
*function
;
379 struct iface_details
*iface
;
380 struct module_details
*module
;
381 struct array_details array
;
382 struct coclass_details coclass
;
383 struct basic_details basic
;
384 struct pointer_details pointer
;
385 struct bitfield_details bitfield
;
387 type_t
*orig
; /* dup'd types */
388 unsigned int typestring_offset
;
389 unsigned int ptrdesc
; /* used for complex structs */
392 unsigned int ignore
: 1;
393 unsigned int defined
: 1;
394 unsigned int written
: 1;
395 unsigned int user_types_registered
: 1;
396 unsigned int tfswrite
: 1; /* if the type needs to be written to the TFS */
397 unsigned int checked
: 1;
398 unsigned int is_alias
: 1; /* is the type an alias? */
406 enum storage_class stgclass
;
408 struct _loc_info_t loc_info
;
410 /* parser-internal */
414 struct _declarator_t
{
421 /* parser-internal */
429 /* parser-internal */
433 struct _typelib_entry_t
{
438 struct _importinfo_t
{
446 importlib_t
*importlib
;
449 struct _importlib_t
{
455 importinfo_t
*importinfos
;
466 const attr_list_t
*attrs
;
467 struct list importlibs
;
468 statement_list_t
*stmts
;
471 struct _user_type_t
{
476 struct _type_list_t
{
478 struct _type_list_t
*next
;
481 struct _statement_t
{
483 enum statement_type type
;
491 type_list_t
*type_list
;
502 extern syskind_t typelib_kind
;
503 extern user_type_list_t user_type_list
;
504 void check_for_additional_prototype_types(const var_list_t
*list
);
506 void init_types(void);
507 type_t
*alloc_type(void);
508 void set_all_tfswrite(int val
);
509 void clear_all_offsets(void);
511 int is_ptr(const type_t
*t
);
512 int is_array(const type_t
*t
);
513 int is_var_ptr(const var_t
*v
);
514 int cant_be_null(const var_t
*v
);
520 var_t
*find_const(const char *name
, int f
);
521 type_t
*find_type(const char *name
, int t
);
522 type_t
*make_type(enum type_type type
);
523 type_t
*get_type(enum type_type type
, char *name
, int t
);
524 type_t
*reg_type(type_t
*type
, const char *name
, int t
);
525 void add_incomplete(type_t
*t
);
527 var_t
*make_var(char *name
);
528 var_list_t
*append_var(var_list_t
*list
, var_t
*var
);
530 void init_loc_info(loc_info_t
*);
532 static inline var_list_t
*type_get_function_args(const type_t
*func_type
)
534 return func_type
->details
.function
->args
;
537 static inline enum type_type
type_get_type_detect_alias(const type_t
*type
)
541 return type
->type_type
;
544 #define STATEMENTS_FOR_EACH_FUNC(stmt, stmts) \
545 if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, statement_t, entry ) \
546 if (stmt->type == STMT_DECLARATION && stmt->u.var->stgclass == STG_NONE && \
547 type_get_type_detect_alias(stmt->u.var->type) == TYPE_FUNCTION)
549 static inline int statements_has_func(const statement_list_t
*stmts
)
551 const statement_t
*stmt
;
553 STATEMENTS_FOR_EACH_FUNC(stmt
, stmts
)