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/list.h"
34 unsigned char Data4
[8];
40 typedef struct _loc_info_t loc_info_t
;
41 typedef struct _attr_t attr_t
;
42 typedef struct _attr_custdata_t attr_custdata_t
;
43 typedef struct _expr_t expr_t
;
44 typedef struct _type_t type_t
;
45 typedef struct _var_t var_t
;
46 typedef struct _decl_spec_t decl_spec_t
;
47 typedef struct _declarator_t declarator_t
;
48 typedef struct _typeref_t typeref_t
;
49 typedef struct _typelib_entry_t typelib_entry_t
;
50 typedef struct _importlib_t importlib_t
;
51 typedef struct _importinfo_t importinfo_t
;
52 typedef struct _typelib_t typelib_t
;
53 typedef struct _user_type_t user_type_t
;
54 typedef struct _user_type_t context_handle_t
;
55 typedef struct _user_type_t generic_handle_t
;
56 typedef struct _statement_t statement_t
;
57 typedef struct _warning_t warning_t
;
59 typedef struct list attr_list_t
;
60 typedef struct list str_list_t
;
61 typedef struct list expr_list_t
;
62 typedef struct list var_list_t
;
63 typedef struct list declarator_list_t
;
64 typedef struct list typeref_list_t
;
65 typedef struct list user_type_list_t
;
66 typedef struct list context_handle_list_t
;
67 typedef struct list generic_handle_list_t
;
68 typedef struct list statement_list_t
;
69 typedef struct list warning_list_t
;
84 ATTR_CALLCONV
, /* calling convention pseudo-attribute */
99 ATTR_DISABLECONSISTENCYCHECK
,
111 ATTR_EXPLICIT_HANDLE
,
119 ATTR_HELPSTRINGCONTEXT
,
127 ATTR_IMPLICIT_HANDLE
,
134 ATTR_MARSHALING_BEHAVIOR
,
168 ATTR_STRICTCONTEXTHANDLE
,
176 ATTR_USESGETLASTERROR
,
229 TKIND_PRIMITIVE
= -1,
251 TYPE_QUALIFIER_CONST
= 1,
254 enum function_specifier
256 FUNCTION_SPECIFIER_INLINE
= 1,
275 THREADING_APARTMENT
= 1,
284 MARSHALING_INVALID
= 0,
305 TYPE_BASIC_ERROR_STATUS_T
,
309 #define TYPE_BASIC_MAX TYPE_BASIC_HANDLE
310 #define TYPE_BASIC_INT_MIN TYPE_BASIC_INT8
311 #define TYPE_BASIC_INT_MAX TYPE_BASIC_HYPER
315 const char *input_name
;
317 const char *near_text
;
320 struct str_list_entry_t
329 enum storage_class stgclass
;
330 enum type_qualifier qualifier
;
331 enum function_specifier func_specifier
;
340 /* parser-internal */
357 /* parser-internal */
361 struct _attr_custdata_t
{
366 struct struct_details
371 struct enumeration_details
379 struct _var_t
*retval
;
384 statement_list_t
*stmts
;
385 var_list_t
*disp_methods
;
386 var_list_t
*disp_props
;
387 struct _type_t
*inherit
;
388 struct _type_t
*disp_inherit
;
389 struct _type_t
*async_iface
;
390 typeref_list_t
*requires
;
393 struct module_details
395 statement_list_t
*stmts
;
402 struct _decl_spec_t elem
;
404 unsigned char declptr
; /* if declared as a pointer */
405 unsigned short ptr_tfsoff
; /* offset of pointer definition for declptr */
408 struct coclass_details
410 typeref_list_t
*ifaces
;
415 enum type_basic_type type
;
419 struct pointer_details
421 struct _decl_spec_t ref
;
424 struct bitfield_details
426 struct _type_t
*field
;
432 struct _decl_spec_t aliasee
;
435 struct runtimeclass_details
437 typeref_list_t
*ifaces
;
440 struct parameterized_details
443 typeref_list_t
*params
;
446 struct delegate_details
455 struct namespace *parent
;
457 struct list children
;
458 struct rtype
*type_hash
[HASHMAX
];
464 TYPE_BASIC
, /* ints, floats and handles */
467 TYPE_ENCAPSULATED_UNION
,
479 TYPE_PARAMETERIZED_TYPE
,
486 struct namespace *namespace;
487 enum type_type type_type
;
491 struct struct_details
*structure
;
492 struct enumeration_details
*enumeration
;
493 struct func_details
*function
;
494 struct iface_details
*iface
;
495 struct module_details
*module
;
496 struct array_details array
;
497 struct coclass_details coclass
;
498 struct basic_details basic
;
499 struct pointer_details pointer
;
500 struct bitfield_details bitfield
;
501 struct alias_details alias
;
502 struct runtimeclass_details runtimeclass
;
503 struct parameterized_details parameterized
;
504 struct delegate_details delegate
;
507 const char *signature
;
508 const char *qualified_name
;
509 const char *impl_name
;
510 const char *short_name
;
511 unsigned int typestring_offset
;
512 unsigned int ptrdesc
; /* used for complex structs */
515 unsigned int ignore
: 1;
516 unsigned int defined
: 1;
517 unsigned int written
: 1;
518 unsigned int user_types_registered
: 1;
519 unsigned int tfswrite
: 1; /* if the type needs to be written to the TFS */
520 unsigned int checked
: 1;
525 decl_spec_t declspec
;
529 unsigned int typestring_offset
;
531 /* fields specific to functions */
532 unsigned int procstring_offset
, func_idx
;
534 struct _loc_info_t loc_info
;
536 unsigned int declonly
: 1;
538 /* parser-internal */
542 struct _declarator_t
{
545 enum type_qualifier qualifier
;
548 /* parser-internal */
556 /* parser-internal */
560 struct _typelib_entry_t
{
565 struct _importinfo_t
{
573 importlib_t
*importlib
;
576 struct _importlib_t
{
583 importinfo_t
*importinfos
;
593 const attr_list_t
*attrs
;
594 struct list importlibs
;
595 statement_list_t
*stmts
;
598 unsigned int reg_iface_count
;
601 struct _user_type_t
{
606 struct _statement_t
{
608 enum statement_type type
;
615 typeref_list_t
*type_list
;
617 unsigned int declonly
: 1; /* for STMT_TYPE and STMT_TYPEDEF */
632 extern user_type_list_t user_type_list
;
633 extern context_handle_list_t context_handle_list
;
634 extern generic_handle_list_t generic_handle_list
;
635 void check_for_additional_prototype_types(type_t
*type
);
637 void init_types(void);
638 type_t
*alloc_type(void);
639 void set_all_tfswrite(int val
);
640 void clear_all_offsets(void);
646 var_t
*find_const(const char *name
, int f
);
647 type_t
*find_type(const char *name
, struct namespace *namespace, int t
);
648 type_t
*make_type(enum type_type type
);
649 type_t
*get_type(enum type_type type
, char *name
, struct namespace *namespace, int t
);
650 type_t
*reg_type(type_t
*type
, const char *name
, struct namespace *namespace, int t
);
652 var_t
*make_var(char *name
);
653 var_list_t
*append_var(var_list_t
*list
, var_t
*var
);
655 void init_loc_info(loc_info_t
*);
657 char *format_namespace(struct namespace *namespace, const char *prefix
, const char *separator
, const char *suffix
,
658 const char *abi_prefix
);
659 char *format_parameterized_type_name(type_t
*type
, typeref_list_t
*params
);
661 static inline enum type_type
type_get_type_detect_alias(const type_t
*type
)
663 return type
->type_type
;
666 #define STATEMENTS_FOR_EACH_FUNC(stmt, stmts) \
667 if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, statement_t, entry ) \
668 if (stmt->type == STMT_DECLARATION && stmt->u.var->declspec.stgclass == STG_NONE && \
669 type_get_type_detect_alias(stmt->u.var->declspec.type) == TYPE_FUNCTION)
671 static inline int statements_has_func(const statement_list_t
*stmts
)
673 const statement_t
*stmt
;
675 STATEMENTS_FOR_EACH_FUNC(stmt
, stmts
)
683 static inline int is_global_namespace(const struct namespace *namespace)
685 return !namespace->name
;
688 static inline decl_spec_t
*init_declspec(decl_spec_t
*declspec
, type_t
*type
)
690 declspec
->type
= type
;
691 declspec
->stgclass
= STG_NONE
;
692 declspec
->qualifier
= 0;
693 declspec
->func_specifier
= 0;