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 */
98 ATTR_DISABLECONSISTENCYCHECK
,
110 ATTR_EXPLICIT_HANDLE
,
118 ATTR_HELPSTRINGCONTEXT
,
126 ATTR_IMPLICIT_HANDLE
,
133 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
;
322 struct str_list_entry_t
331 enum storage_class stgclass
;
332 enum type_qualifier qualifier
;
333 enum function_specifier func_specifier
;
342 /* parser-internal */
359 /* parser-internal */
363 struct _attr_custdata_t
{
368 struct struct_details
373 struct enumeration_details
381 struct _var_t
*retval
;
386 statement_list_t
*stmts
;
387 var_list_t
*disp_methods
;
388 var_list_t
*disp_props
;
389 struct _type_t
*inherit
;
390 struct _type_t
*disp_inherit
;
391 struct _type_t
*async_iface
;
392 typeref_list_t
*requires
;
395 struct module_details
397 statement_list_t
*stmts
;
404 struct _decl_spec_t elem
;
406 unsigned char declptr
; /* if declared as a pointer */
407 unsigned short ptr_tfsoff
; /* offset of pointer definition for declptr */
410 struct coclass_details
412 typeref_list_t
*ifaces
;
417 enum type_basic_type type
;
421 struct pointer_details
423 struct _decl_spec_t ref
;
426 struct bitfield_details
428 struct _type_t
*field
;
434 struct _decl_spec_t aliasee
;
437 struct runtimeclass_details
439 typeref_list_t
*ifaces
;
442 struct parameterized_details
445 typeref_list_t
*params
;
448 struct delegate_details
457 struct namespace *parent
;
459 struct list children
;
460 struct rtype
*type_hash
[HASHMAX
];
466 TYPE_BASIC
, /* ints, floats and handles */
469 TYPE_ENCAPSULATED_UNION
,
481 TYPE_PARAMETERIZED_TYPE
,
487 const char *name
; /* C++ name with parameters in brackets */
488 struct namespace *namespace;
489 enum type_type type_type
;
493 struct struct_details
*structure
;
494 struct enumeration_details
*enumeration
;
495 struct func_details
*function
;
496 struct iface_details
*iface
;
497 struct module_details
*module
;
498 struct array_details array
;
499 struct coclass_details coclass
;
500 struct basic_details basic
;
501 struct pointer_details pointer
;
502 struct bitfield_details bitfield
;
503 struct alias_details alias
;
504 struct runtimeclass_details runtimeclass
;
505 struct parameterized_details parameterized
;
506 struct delegate_details delegate
;
508 const char *c_name
; /* mangled C name, with namespaces and parameters */
509 const char *signature
;
510 const char *qualified_name
; /* C++ fully qualified name */
511 const char *impl_name
; /* C++ parameterized types impl base class name */
512 const char *param_name
; /* used to build c_name of a parameterized type, when used as a parameter */
513 const char *short_name
; /* widl specific short name */
514 unsigned int typestring_offset
;
515 unsigned int ptrdesc
; /* used for complex structs */
517 struct location where
;
518 unsigned int ignore
: 1;
519 unsigned int defined
: 1;
520 unsigned int written
: 1;
521 unsigned int user_types_registered
: 1;
522 unsigned int tfswrite
: 1; /* if the type needs to be written to the TFS */
523 unsigned int checked
: 1;
528 decl_spec_t declspec
;
532 unsigned int typestring_offset
;
534 /* fields specific to functions */
535 unsigned int procstring_offset
, func_idx
;
537 struct location where
;
539 unsigned int declonly
: 1;
541 /* parser-internal */
545 struct _declarator_t
{
548 enum type_qualifier qualifier
;
551 /* parser-internal */
559 /* parser-internal */
563 struct _typelib_entry_t
{
568 struct _importinfo_t
{
576 importlib_t
*importlib
;
579 struct _importlib_t
{
586 importinfo_t
*importinfos
;
596 const attr_list_t
*attrs
;
597 struct list importlibs
;
598 statement_list_t
*stmts
;
601 unsigned int reg_iface_count
;
604 struct _user_type_t
{
609 struct _statement_t
{
611 enum statement_type type
;
618 typeref_list_t
*type_list
;
620 unsigned int declonly
: 1; /* for STMT_TYPE and STMT_TYPEDEF */
635 extern user_type_list_t user_type_list
;
636 extern context_handle_list_t context_handle_list
;
637 extern generic_handle_list_t generic_handle_list
;
638 void check_for_additional_prototype_types(type_t
*type
);
640 void init_types(void);
641 type_t
*alloc_type(void);
642 void set_all_tfswrite(int val
);
643 void clear_all_offsets(void);
649 var_t
*find_const(const char *name
, int f
);
650 type_t
*find_type(const char *name
, struct namespace *namespace, int t
);
651 type_t
*make_type(enum type_type type
);
652 type_t
*get_type(enum type_type type
, char *name
, struct namespace *namespace, int t
);
653 type_t
*reg_type(type_t
*type
, const char *name
, struct namespace *namespace, int t
);
655 var_t
*make_var(char *name
);
656 var_list_t
*append_var(var_list_t
*list
, var_t
*var
);
658 char *format_namespace(struct namespace *namespace, const char *prefix
, const char *separator
, const char *suffix
,
659 const char *abi_prefix
);
660 char *format_parameterized_type_name(type_t
*type
, typeref_list_t
*params
);
662 static inline enum type_type
type_get_type_detect_alias(const type_t
*type
)
664 return type
->type_type
;
667 #define STATEMENTS_FOR_EACH_FUNC(stmt, stmts) \
668 if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, statement_t, entry ) \
669 if (stmt->type == STMT_DECLARATION && stmt->u.var->declspec.stgclass == STG_NONE && \
670 type_get_type_detect_alias(stmt->u.var->declspec.type) == TYPE_FUNCTION)
672 static inline int statements_has_func(const statement_list_t
*stmts
)
674 const statement_t
*stmt
;
676 STATEMENTS_FOR_EACH_FUNC(stmt
, stmts
)
684 static inline int is_global_namespace(const struct namespace *namespace)
686 return !namespace->name
;
689 static inline decl_spec_t
*init_declspec(decl_spec_t
*declspec
, type_t
*type
)
691 declspec
->type
= type
;
692 declspec
->stgclass
= STG_NONE
;
693 declspec
->qualifier
= 0;
694 declspec
->func_specifier
= 0;