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
28 #include "wine/list.h"
38 typedef struct _loc_info_t loc_info_t
;
39 typedef struct _attr_t attr_t
;
40 typedef struct _expr_t expr_t
;
41 typedef struct _type_t type_t
;
42 typedef struct _var_t var_t
;
43 typedef struct _decl_spec_t decl_spec_t
;
44 typedef struct _declarator_t declarator_t
;
45 typedef struct _ifref_t ifref_t
;
46 typedef struct _typelib_entry_t typelib_entry_t
;
47 typedef struct _importlib_t importlib_t
;
48 typedef struct _importinfo_t importinfo_t
;
49 typedef struct _typelib_t typelib_t
;
50 typedef struct _user_type_t user_type_t
;
51 typedef struct _user_type_t context_handle_t
;
52 typedef struct _user_type_t generic_handle_t
;
53 typedef struct _type_list_t type_list_t
;
54 typedef struct _statement_t statement_t
;
55 typedef struct _warning_t warning_t
;
57 typedef struct list attr_list_t
;
58 typedef struct list str_list_t
;
59 typedef struct list expr_list_t
;
60 typedef struct list var_list_t
;
61 typedef struct list declarator_list_t
;
62 typedef struct list ifref_list_t
;
63 typedef struct list user_type_list_t
;
64 typedef struct list context_handle_list_t
;
65 typedef struct list generic_handle_list_t
;
66 typedef struct list statement_list_t
;
67 typedef struct list warning_list_t
;
80 ATTR_CALLCONV
, /* calling convention pseudo-attribute */
92 ATTR_DISABLECONSISTENCYCHECK
,
101 ATTR_EXPLICIT_HANDLE
,
108 ATTR_HELPSTRINGCONTEXT
,
116 ATTR_IMPLICIT_HANDLE
,
155 ATTR_STRICTCONTEXTHANDLE
,
163 ATTR_USESGETLASTERROR
,
216 TKIND_PRIMITIVE
= -1,
238 TYPE_QUALIFIER_CONST
= 1,
241 enum function_specifier
243 FUNCTION_SPECIFIER_INLINE
= 1,
262 THREADING_APARTMENT
= 1,
284 TYPE_BASIC_ERROR_STATUS_T
,
288 #define TYPE_BASIC_MAX TYPE_BASIC_HANDLE
289 #define TYPE_BASIC_INT_MIN TYPE_BASIC_INT8
290 #define TYPE_BASIC_INT_MAX TYPE_BASIC_HYPER
294 const char *input_name
;
296 const char *near_text
;
299 struct str_list_entry_t
308 enum storage_class stgclass
;
309 enum type_qualifier qualifier
;
310 enum function_specifier func_specifier
;
319 /* parser-internal */
336 /* parser-internal */
340 struct struct_details
345 struct enumeration_details
353 struct _var_t
*retval
;
358 statement_list_t
*stmts
;
359 var_list_t
*disp_methods
;
360 var_list_t
*disp_props
;
361 struct _type_t
*inherit
;
362 struct _type_t
*disp_inherit
;
363 struct _type_t
*async_iface
;
366 struct module_details
368 statement_list_t
*stmts
;
375 struct _decl_spec_t elem
;
377 unsigned char declptr
; /* if declared as a pointer */
378 unsigned short ptr_tfsoff
; /* offset of pointer definition for declptr */
381 struct coclass_details
383 ifref_list_t
*ifaces
;
388 enum type_basic_type type
;
392 struct pointer_details
394 struct _decl_spec_t ref
;
397 struct bitfield_details
399 struct _type_t
*field
;
405 struct _decl_spec_t aliasee
;
412 struct namespace *parent
;
414 struct list children
;
415 struct rtype
*type_hash
[HASHMAX
];
421 TYPE_BASIC
, /* ints, floats and handles */
424 TYPE_ENCAPSULATED_UNION
,
438 struct namespace *namespace;
439 enum type_type type_type
;
443 struct struct_details
*structure
;
444 struct enumeration_details
*enumeration
;
445 struct func_details
*function
;
446 struct iface_details
*iface
;
447 struct module_details
*module
;
448 struct array_details array
;
449 struct coclass_details coclass
;
450 struct basic_details basic
;
451 struct pointer_details pointer
;
452 struct bitfield_details bitfield
;
453 struct alias_details alias
;
456 unsigned int typestring_offset
;
457 unsigned int ptrdesc
; /* used for complex structs */
460 unsigned int ignore
: 1;
461 unsigned int defined
: 1;
462 unsigned int written
: 1;
463 unsigned int user_types_registered
: 1;
464 unsigned int tfswrite
: 1; /* if the type needs to be written to the TFS */
465 unsigned int checked
: 1;
470 decl_spec_t declspec
;
474 unsigned int typestring_offset
;
476 /* fields specific to functions */
477 unsigned int procstring_offset
, func_idx
;
479 struct _loc_info_t loc_info
;
481 unsigned int declonly
: 1;
483 /* parser-internal */
487 struct _declarator_t
{
490 enum type_qualifier qualifier
;
493 /* parser-internal */
501 /* parser-internal */
505 struct _typelib_entry_t
{
510 struct _importinfo_t
{
518 importlib_t
*importlib
;
521 struct _importlib_t
{
528 importinfo_t
*importinfos
;
538 const attr_list_t
*attrs
;
539 struct list importlibs
;
540 statement_list_t
*stmts
;
543 unsigned int reg_iface_count
;
546 struct _user_type_t
{
551 struct _type_list_t
{
553 struct _type_list_t
*next
;
556 struct _statement_t
{
558 enum statement_type type
;
566 type_list_t
*type_list
;
568 unsigned int declonly
: 1; /* for STMT_TYPE and STMT_TYPEDEF */
583 extern user_type_list_t user_type_list
;
584 extern context_handle_list_t context_handle_list
;
585 extern generic_handle_list_t generic_handle_list
;
586 void check_for_additional_prototype_types(type_t
*type
);
588 void init_types(void);
589 type_t
*alloc_type(void);
590 void set_all_tfswrite(int val
);
591 void clear_all_offsets(void);
597 var_t
*find_const(const char *name
, int f
);
598 type_t
*find_type(const char *name
, struct namespace *namespace, int t
);
599 type_t
*make_type(enum type_type type
);
600 type_t
*get_type(enum type_type type
, char *name
, struct namespace *namespace, int t
);
601 type_t
*reg_type(type_t
*type
, const char *name
, struct namespace *namespace, int t
);
603 var_t
*make_var(char *name
);
604 var_list_t
*append_var(var_list_t
*list
, var_t
*var
);
606 void init_loc_info(loc_info_t
*);
608 char *format_namespace(struct namespace *namespace, const char *prefix
, const char *separator
, const char *suffix
);
610 static inline enum type_type
type_get_type_detect_alias(const type_t
*type
)
612 return type
->type_type
;
615 #define STATEMENTS_FOR_EACH_FUNC(stmt, stmts) \
616 if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, statement_t, entry ) \
617 if (stmt->type == STMT_DECLARATION && stmt->u.var->declspec.stgclass == STG_NONE && \
618 type_get_type_detect_alias(stmt->u.var->declspec.type) == TYPE_FUNCTION)
620 static inline int statements_has_func(const statement_list_t
*stmts
)
622 const statement_t
*stmt
;
624 STATEMENTS_FOR_EACH_FUNC(stmt
, stmts
)
632 static inline int is_global_namespace(const struct namespace *namespace)
634 return !namespace->name
;
637 static inline decl_spec_t
*init_declspec(decl_spec_t
*declspec
, type_t
*type
)
639 declspec
->type
= type
;
640 declspec
->stgclass
= STG_NONE
;
641 declspec
->qualifier
= 0;
642 declspec
->func_specifier
= 0;