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 _attr_t attr_t
;
41 typedef struct _attr_custdata_t attr_custdata_t
;
42 typedef struct _expr_t expr_t
;
43 typedef struct _type_t type_t
;
44 typedef struct _var_t var_t
;
45 typedef struct _decl_spec_t decl_spec_t
;
46 typedef struct _declarator_t declarator_t
;
47 typedef struct _typeref_t typeref_t
;
48 typedef struct _typelib_entry_t typelib_entry_t
;
49 typedef struct _importlib_t importlib_t
;
50 typedef struct _importinfo_t importinfo_t
;
51 typedef struct _typelib_t typelib_t
;
52 typedef struct _user_type_t user_type_t
;
53 typedef struct _user_type_t context_handle_t
;
54 typedef struct _user_type_t generic_handle_t
;
55 typedef struct _statement_t statement_t
;
56 typedef struct _warning_t warning_t
;
58 typedef struct list attr_list_t
;
59 typedef struct list str_list_t
;
60 typedef struct list expr_list_t
;
61 typedef struct list var_list_t
;
62 typedef struct list declarator_list_t
;
63 typedef struct list typeref_list_t
;
64 typedef struct list user_type_list_t
;
65 typedef struct list context_handle_list_t
;
66 typedef struct list generic_handle_list_t
;
67 typedef struct list statement_list_t
;
68 typedef struct list warning_list_t
;
83 ATTR_CALLCONV
, /* calling convention pseudo-attribute */
99 ATTR_DISABLECONSISTENCYCHECK
,
111 ATTR_EXPLICIT_HANDLE
,
119 ATTR_HELPSTRINGCONTEXT
,
127 ATTR_IMPLICIT_HANDLE
,
134 ATTR_MARSHALING_BEHAVIOR
,
170 ATTR_STRICTCONTEXTHANDLE
,
178 ATTR_USESGETLASTERROR
,
231 TKIND_PRIMITIVE
= -1,
253 TYPE_QUALIFIER_CONST
= 1,
256 enum function_specifier
258 FUNCTION_SPECIFIER_INLINE
= 1,
277 THREADING_APARTMENT
= 1,
286 MARSHALING_INVALID
= 0,
307 TYPE_BASIC_ERROR_STATUS_T
,
311 #define TYPE_BASIC_MAX TYPE_BASIC_HANDLE
312 #define TYPE_BASIC_INT_MIN TYPE_BASIC_INT8
313 #define TYPE_BASIC_INT_MAX TYPE_BASIC_HYPER
317 const char *input_name
;
324 struct str_list_entry_t
333 enum storage_class stgclass
;
334 enum type_qualifier qualifier
;
335 enum function_specifier func_specifier
;
344 /* parser-internal */
346 struct location where
;
362 /* parser-internal */
366 struct _attr_custdata_t
{
371 struct struct_details
376 struct enumeration_details
384 struct _var_t
*retval
;
389 statement_list_t
*stmts
;
390 var_list_t
*disp_methods
;
391 var_list_t
*disp_props
;
392 struct _type_t
*inherit
;
393 struct _type_t
*disp_inherit
;
394 struct _type_t
*async_iface
;
395 typeref_list_t
*requires
;
398 struct module_details
400 statement_list_t
*stmts
;
407 struct _decl_spec_t elem
;
409 unsigned char declptr
; /* if declared as a pointer */
410 unsigned short ptr_tfsoff
; /* offset of pointer definition for declptr */
413 struct coclass_details
415 typeref_list_t
*ifaces
;
420 enum type_basic_type type
;
424 struct pointer_details
426 struct _decl_spec_t ref
;
429 struct bitfield_details
431 struct _type_t
*field
;
437 struct _decl_spec_t aliasee
;
440 struct runtimeclass_details
442 typeref_list_t
*ifaces
;
445 struct parameterized_details
448 typeref_list_t
*params
;
451 struct delegate_details
460 struct namespace *parent
;
462 struct list children
;
463 struct rtype
*type_hash
[HASHMAX
];
469 TYPE_BASIC
, /* ints, floats and handles */
472 TYPE_ENCAPSULATED_UNION
,
484 TYPE_PARAMETERIZED_TYPE
,
490 const char *name
; /* C++ name with parameters in brackets */
491 struct namespace *namespace;
492 enum type_type type_type
;
496 struct struct_details
*structure
;
497 struct enumeration_details
*enumeration
;
498 struct func_details
*function
;
499 struct iface_details
*iface
;
500 struct module_details
*module
;
501 struct array_details array
;
502 struct coclass_details coclass
;
503 struct basic_details basic
;
504 struct pointer_details pointer
;
505 struct bitfield_details bitfield
;
506 struct alias_details alias
;
507 struct runtimeclass_details runtimeclass
;
508 struct parameterized_details parameterized
;
509 struct delegate_details delegate
;
511 const char *c_name
; /* mangled C name, with namespaces and parameters */
512 const char *signature
;
513 const char *qualified_name
; /* C++ fully qualified name */
514 const char *impl_name
; /* C++ parameterized types impl base class name */
515 const char *param_name
; /* used to build c_name of a parameterized type, when used as a parameter */
516 const char *short_name
; /* widl specific short name */
517 unsigned int typestring_offset
;
518 unsigned int ptrdesc
; /* used for complex structs */
520 struct location where
;
521 unsigned int ignore
: 1;
522 unsigned int defined
: 1;
523 unsigned int written
: 1;
524 unsigned int user_types_registered
: 1;
525 unsigned int tfswrite
: 1; /* if the type needs to be written to the TFS */
526 unsigned int checked
: 1;
531 decl_spec_t declspec
;
535 unsigned int typestring_offset
;
537 /* fields specific to functions */
538 unsigned int procstring_offset
, func_idx
;
540 struct location where
;
542 unsigned int declonly
: 1;
544 /* parser-internal */
548 struct _declarator_t
{
551 enum type_qualifier qualifier
;
554 /* parser-internal */
562 /* parser-internal */
566 struct _typelib_entry_t
{
571 struct _importinfo_t
{
579 importlib_t
*importlib
;
582 struct _importlib_t
{
589 importinfo_t
*importinfos
;
599 const attr_list_t
*attrs
;
600 struct list importlibs
;
601 statement_list_t
*stmts
;
604 unsigned int reg_iface_count
;
607 struct _user_type_t
{
612 struct _statement_t
{
614 enum statement_type type
;
621 typeref_list_t
*type_list
;
623 unsigned int declonly
: 1; /* for STMT_TYPE and STMT_TYPEDEF */
638 extern user_type_list_t user_type_list
;
639 extern context_handle_list_t context_handle_list
;
640 extern generic_handle_list_t generic_handle_list
;
641 void check_for_additional_prototype_types(type_t
*type
);
643 void init_types(void);
644 type_t
*alloc_type(void);
645 void set_all_tfswrite(int val
);
646 void clear_all_offsets(void);
652 var_t
*find_const(const char *name
, int f
);
653 type_t
*find_type(const char *name
, struct namespace *namespace, int t
);
654 type_t
*make_type(enum type_type type
);
655 type_t
*get_type(enum type_type type
, char *name
, struct namespace *namespace, int t
);
656 type_t
*reg_type(type_t
*type
, const char *name
, struct namespace *namespace, int t
);
658 var_t
*make_var(char *name
);
659 var_list_t
*append_var(var_list_t
*list
, var_t
*var
);
661 char *format_namespace(struct namespace *namespace, const char *prefix
, const char *separator
, const char *suffix
,
662 const char *abi_prefix
);
663 char *format_parameterized_type_name(type_t
*type
, typeref_list_t
*params
);
665 static inline enum type_type
type_get_type_detect_alias(const type_t
*type
)
667 return type
->type_type
;
670 #define STATEMENTS_FOR_EACH_FUNC(stmt, stmts) \
671 if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, statement_t, entry ) \
672 if (stmt->type == STMT_DECLARATION && stmt->u.var->declspec.stgclass == STG_NONE && \
673 type_get_type_detect_alias(stmt->u.var->declspec.type) == TYPE_FUNCTION)
675 static inline int statements_has_func(const statement_list_t
*stmts
)
677 const statement_t
*stmt
;
679 STATEMENTS_FOR_EACH_FUNC(stmt
, stmts
)
687 static inline int is_global_namespace(const struct namespace *namespace)
689 return !namespace->name
;
692 static inline decl_spec_t
*init_declspec(decl_spec_t
*declspec
, type_t
*type
)
694 declspec
->type
= type
;
695 declspec
->stgclass
= STG_NONE
;
696 declspec
->qualifier
= 0;
697 declspec
->func_specifier
= 0;