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
,
169 ATTR_STRICTCONTEXTHANDLE
,
177 ATTR_USESGETLASTERROR
,
230 TKIND_PRIMITIVE
= -1,
252 TYPE_QUALIFIER_CONST
= 1,
255 enum function_specifier
257 FUNCTION_SPECIFIER_INLINE
= 1,
276 THREADING_APARTMENT
= 1,
285 MARSHALING_INVALID
= 0,
306 TYPE_BASIC_ERROR_STATUS_T
,
310 #define TYPE_BASIC_MAX TYPE_BASIC_HANDLE
311 #define TYPE_BASIC_INT_MIN TYPE_BASIC_INT8
312 #define TYPE_BASIC_INT_MAX TYPE_BASIC_HYPER
316 const char *input_name
;
318 const char *near_text
;
321 struct str_list_entry_t
330 enum storage_class stgclass
;
331 enum type_qualifier qualifier
;
332 enum function_specifier func_specifier
;
341 /* parser-internal */
358 /* parser-internal */
362 struct _attr_custdata_t
{
367 struct struct_details
372 struct enumeration_details
380 struct _var_t
*retval
;
385 statement_list_t
*stmts
;
386 var_list_t
*disp_methods
;
387 var_list_t
*disp_props
;
388 struct _type_t
*inherit
;
389 struct _type_t
*disp_inherit
;
390 struct _type_t
*async_iface
;
391 typeref_list_t
*requires
;
394 struct module_details
396 statement_list_t
*stmts
;
403 struct _decl_spec_t elem
;
405 unsigned char declptr
; /* if declared as a pointer */
406 unsigned short ptr_tfsoff
; /* offset of pointer definition for declptr */
409 struct coclass_details
411 typeref_list_t
*ifaces
;
416 enum type_basic_type type
;
420 struct pointer_details
422 struct _decl_spec_t ref
;
425 struct bitfield_details
427 struct _type_t
*field
;
433 struct _decl_spec_t aliasee
;
436 struct runtimeclass_details
438 typeref_list_t
*ifaces
;
441 struct parameterized_details
444 typeref_list_t
*params
;
447 struct delegate_details
456 struct namespace *parent
;
458 struct list children
;
459 struct rtype
*type_hash
[HASHMAX
];
465 TYPE_BASIC
, /* ints, floats and handles */
468 TYPE_ENCAPSULATED_UNION
,
480 TYPE_PARAMETERIZED_TYPE
,
486 const char *name
; /* C++ name with parameters in brackets */
487 struct namespace *namespace;
488 enum type_type type_type
;
492 struct struct_details
*structure
;
493 struct enumeration_details
*enumeration
;
494 struct func_details
*function
;
495 struct iface_details
*iface
;
496 struct module_details
*module
;
497 struct array_details array
;
498 struct coclass_details coclass
;
499 struct basic_details basic
;
500 struct pointer_details pointer
;
501 struct bitfield_details bitfield
;
502 struct alias_details alias
;
503 struct runtimeclass_details runtimeclass
;
504 struct parameterized_details parameterized
;
505 struct delegate_details delegate
;
507 const char *c_name
; /* mangled C name, with namespaces and parameters */
508 const char *signature
;
509 const char *qualified_name
; /* C++ fully qualified name */
510 const char *impl_name
; /* C++ parameterized types impl base class name */
511 const char *param_name
; /* used to build c_name of a parameterized type, when used as a parameter */
512 const char *short_name
; /* widl specific short name */
513 unsigned int typestring_offset
;
514 unsigned int ptrdesc
; /* used for complex structs */
517 unsigned int ignore
: 1;
518 unsigned int defined
: 1;
519 unsigned int written
: 1;
520 unsigned int user_types_registered
: 1;
521 unsigned int tfswrite
: 1; /* if the type needs to be written to the TFS */
522 unsigned int checked
: 1;
527 decl_spec_t declspec
;
531 unsigned int typestring_offset
;
533 /* fields specific to functions */
534 unsigned int procstring_offset
, func_idx
;
536 struct _loc_info_t loc_info
;
538 unsigned int declonly
: 1;
540 /* parser-internal */
544 struct _declarator_t
{
547 enum type_qualifier qualifier
;
550 /* parser-internal */
558 /* parser-internal */
562 struct _typelib_entry_t
{
567 struct _importinfo_t
{
575 importlib_t
*importlib
;
578 struct _importlib_t
{
585 importinfo_t
*importinfos
;
595 const attr_list_t
*attrs
;
596 struct list importlibs
;
597 statement_list_t
*stmts
;
600 unsigned int reg_iface_count
;
603 struct _user_type_t
{
608 struct _statement_t
{
610 enum statement_type type
;
617 typeref_list_t
*type_list
;
619 unsigned int declonly
: 1; /* for STMT_TYPE and STMT_TYPEDEF */
634 extern user_type_list_t user_type_list
;
635 extern context_handle_list_t context_handle_list
;
636 extern generic_handle_list_t generic_handle_list
;
637 void check_for_additional_prototype_types(type_t
*type
);
639 void init_types(void);
640 type_t
*alloc_type(void);
641 void set_all_tfswrite(int val
);
642 void clear_all_offsets(void);
648 var_t
*find_const(const char *name
, int f
);
649 type_t
*find_type(const char *name
, struct namespace *namespace, int t
);
650 type_t
*make_type(enum type_type type
);
651 type_t
*get_type(enum type_type type
, char *name
, struct namespace *namespace, int t
);
652 type_t
*reg_type(type_t
*type
, const char *name
, struct namespace *namespace, int t
);
654 var_t
*make_var(char *name
);
655 var_list_t
*append_var(var_list_t
*list
, var_t
*var
);
657 void init_loc_info(loc_info_t
*);
659 char *format_namespace(struct namespace *namespace, const char *prefix
, const char *separator
, const char *suffix
,
660 const char *abi_prefix
);
661 char *format_parameterized_type_name(type_t
*type
, typeref_list_t
*params
);
663 static inline enum type_type
type_get_type_detect_alias(const type_t
*type
)
665 return type
->type_type
;
668 #define STATEMENTS_FOR_EACH_FUNC(stmt, stmts) \
669 if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, statement_t, entry ) \
670 if (stmt->type == STMT_DECLARATION && stmt->u.var->declspec.stgclass == STG_NONE && \
671 type_get_type_detect_alias(stmt->u.var->declspec.type) == TYPE_FUNCTION)
673 static inline int statements_has_func(const statement_list_t
*stmts
)
675 const statement_t
*stmt
;
677 STATEMENTS_FOR_EACH_FUNC(stmt
, stmts
)
685 static inline int is_global_namespace(const struct namespace *namespace)
687 return !namespace->name
;
690 static inline decl_spec_t
*init_declspec(decl_spec_t
*declspec
, type_t
*type
)
692 declspec
->type
= type
;
693 declspec
->stgclass
= STG_NONE
;
694 declspec
->qualifier
= 0;
695 declspec
->func_specifier
= 0;