ReactOS  0.4.14-dev-57-g333b8f1
widltypes.h
Go to the documentation of this file.
1 /*
2  * IDL Compiler
3  *
4  * Copyright 2002 Ove Kaaven
5  *
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.
10  *
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.
15  *
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
19  */
20 
21 #ifndef __WIDL_WIDLTYPES_H
22 #define __WIDL_WIDLTYPES_H
23 
24 #include <stdarg.h>
25 #include <assert.h>
26 #include "guiddef.h"
27 #include "ndrtypes.h"
28 #include "wine/list.h"
29 
30 #ifndef UUID_DEFINED
31 #define UUID_DEFINED
32 typedef GUID UUID;
33 #endif
34 
35 #define TRUE 1
36 #define FALSE 0
37 
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 _declarator_t declarator_t;
44 typedef struct _ifref_t ifref_t;
46 typedef struct _importlib_t importlib_t;
47 typedef struct _importinfo_t importinfo_t;
48 typedef struct _typelib_t typelib_t;
49 typedef struct _user_type_t user_type_t;
52 typedef struct _type_list_t type_list_t;
53 typedef struct _statement_t statement_t;
54 typedef struct _warning_t warning_t;
55 
56 typedef struct list attr_list_t;
57 typedef struct list str_list_t;
58 typedef struct list expr_list_t;
59 typedef struct list var_list_t;
60 typedef struct list declarator_list_t;
61 typedef struct list ifref_list_t;
62 typedef struct list user_type_list_t;
63 typedef struct list context_handle_list_t;
64 typedef struct list generic_handle_list_t;
65 typedef struct list statement_list_t;
66 typedef struct list warning_list_t;
67 
69 {
79  ATTR_CALLCONV, /* calling convention pseudo-attribute */
83  ATTR_CONST, /* const pseudo-attribute */
171 };
172 
174 {
213 };
214 
216 {
227 };
228 
230 {
235 };
236 
238 {
249 };
250 
252 {
258 };
259 
261 {
277 };
278 
279 #define TYPE_BASIC_MAX TYPE_BASIC_HANDLE
280 #define TYPE_BASIC_INT_MIN TYPE_BASIC_INT8
281 #define TYPE_BASIC_INT_MAX TYPE_BASIC_HYPER
282 
284 {
285  const char *input_name;
287  const char *near_text;
288 };
289 
291 {
292  char *str;
293  struct list entry;
294 };
295 
296 struct _attr_t {
298  union {
299  unsigned int ival;
300  void *pval;
301  } u;
302  /* parser-internal */
303  struct list entry;
304 };
305 
306 struct _expr_t {
308  const expr_t *ref;
309  union {
310  int lval;
311  double dval;
312  const char *sval;
313  const expr_t *ext;
315  } u;
316  const expr_t *ext2;
317  int is_const;
318  int cval;
319  /* parser-internal */
320  struct list entry;
321 };
322 
324 {
326 };
327 
329 {
331 };
332 
334 {
336  struct _var_t *retval;
337  int idx;
338 };
339 
341 {
345  struct _type_t *inherit;
348 };
349 
351 {
353 };
354 
356 {
359  struct _type_t *elem;
360  unsigned int dim;
361  unsigned char ptr_def_fc;
362  unsigned char declptr; /* if declared as a pointer */
363  unsigned short ptr_tfsoff; /* offset of pointer definition for declptr */
364 };
365 
367 {
369 };
370 
372 {
374  int sign;
375 };
376 
378 {
379  struct _type_t *ref;
380  unsigned char def_fc;
381 };
382 
384 {
385  struct _type_t *field;
386  const expr_t *bits;
387 };
388 
389 #define HASHMAX 64
390 
391 struct namespace {
392  const char *name;
393  struct namespace *parent;
394  struct list entry;
395  struct list children;
397 };
398 
400 {
402  TYPE_BASIC, /* ints, floats and handles */
415 };
416 
417 struct _type_t {
418  const char *name;
419  struct namespace *namespace;
422  union
423  {
426  struct func_details *function;
434  } details;
435  const char *c_name;
436  type_t *orig; /* dup'd types */
437  unsigned int typestring_offset;
438  unsigned int ptrdesc; /* used for complex structs */
441  unsigned int ignore : 1;
442  unsigned int defined : 1;
443  unsigned int written : 1;
444  unsigned int user_types_registered : 1;
445  unsigned int tfswrite : 1; /* if the type needs to be written to the TFS */
446  unsigned int checked : 1;
447  unsigned int is_alias : 1; /* is the type an alias? */
448 };
449 
450 struct _var_t {
451  char *name;
456  unsigned int procstring_offset;
457  unsigned int typestring_offset;
458 
460 
461  /* parser-internal */
462  struct list entry;
463 };
464 
470 
471  /* parser-internal */
472  struct list entry;
473 };
474 
475 struct _ifref_t {
478 
479  /* parser-internal */
480  struct list entry;
481 };
482 
485  struct list entry;
486 };
487 
489  int offset;
491  int flags;
492  int id;
493 
494  char *name;
495 
497 };
498 
499 struct _importlib_t {
500  char *name;
501 
502  int version;
504 
507 
509 
510  struct list entry;
511 };
512 
513 struct _typelib_t {
514  char *name;
516  struct list importlibs;
518 };
519 
520 struct _user_type_t {
521  struct list entry;
522  const char *name;
523 };
524 
525 struct _type_list_t {
528 };
529 
530 struct _statement_t {
531  struct list entry;
533  union
534  {
537  const char *str;
541  } u;
542 };
543 
544 struct _warning_t {
545  int num;
546  struct list entry;
547 };
548 
549 typedef enum {
554 } syskind_t;
555 
560 
561 void init_types(void);
562 type_t *alloc_type(void);
563 void set_all_tfswrite(int val);
564 void clear_all_offsets(void);
565 
566 #define tsENUM 1
567 #define tsSTRUCT 2
568 #define tsUNION 3
569 
570 var_t *find_const(const char *name, int f);
571 type_t *find_type(const char *name, struct namespace *namespace, int t);
573 type_t *get_type(enum type_type type, char *name, struct namespace *namespace, int t);
574 type_t *reg_type(type_t *type, const char *name, struct namespace *namespace, int t);
575 void add_incomplete(type_t *t);
576 
577 var_t *make_var(char *name);
579 
580 void init_loc_info(loc_info_t *);
581 
582 char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix);
583 
584 static inline var_list_t *type_get_function_args(const type_t *func_type)
585 {
586  return func_type->details.function->args;
587 }
588 
590 {
591  if (type->is_alias)
592  return TYPE_ALIAS;
593  return type->type_type;
594 }
595 
596 #define STATEMENTS_FOR_EACH_FUNC(stmt, stmts) \
597  if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, statement_t, entry ) \
598  if (stmt->type == STMT_DECLARATION && stmt->u.var->stgclass == STG_NONE && \
599  type_get_type_detect_alias(stmt->u.var->type) == TYPE_FUNCTION)
600 
601 static inline int statements_has_func(const statement_list_t *stmts)
602 {
603  const statement_t *stmt;
604  int has_func = 0;
605  STATEMENTS_FOR_EACH_FUNC(stmt, stmts)
606  {
607  has_func = 1;
608  break;
609  }
610  return has_func;
611 }
612 
613 static inline int is_global_namespace(const struct namespace *namespace)
614 {
615  return !namespace->name;
616 }
617 
618 #endif
statement_list_t * stmts
Definition: widltypes.h:352
type_t * func_type
Definition: widltypes.h:468
unsigned short ptr_tfsoff
Definition: widltypes.h:363
#define STATEMENTS_FOR_EACH_FUNC(stmt, stmts)
Definition: widltypes.h:596
struct func_details * function
Definition: widltypes.h:426
static int is_global_namespace(const struct namespace *namespace)
Definition: widltypes.h:613
var_list_t * fields
Definition: widltypes.h:325
static var_list_t * type_get_function_args(const type_t *func_type)
Definition: widltypes.h:584
struct struct_details * structure
Definition: widltypes.h:424
struct list entry
Definition: widltypes.h:472
unsigned int tfswrite
Definition: widltypes.h:445
typelib_t * lib
Definition: widltypes.h:539
importlib_t * importlib
Definition: widltypes.h:496
static const WCHAR separator[]
Definition: asmname.c:63
unsigned int dim
Definition: widltypes.h:360
struct module_details * module
Definition: widltypes.h:428
unsigned int is_alias
Definition: widltypes.h:447
struct list entry
Definition: widltypes.h:510
void add_incomplete(type_t *t)
Definition: parser.tab.c:6026
var_list_t * args
Definition: widltypes.h:335
enum attr_type type
Definition: widltypes.h:297
enum expr_type type
Definition: widltypes.h:307
var_t * var
Definition: widltypes.h:538
expr_t * bits
Definition: widltypes.h:469
int ntypeinfos
Definition: widltypes.h:506
GLsizei const GLvoid * pointer
Definition: glext.h:5848
var_t * make_var(char *name)
Definition: parser.tab.c:5876
const char * near_text
Definition: widltypes.h:287
struct coclass_details coclass
Definition: widltypes.h:430
struct list entry
Definition: widltypes.h:320
var_list_t * disp_methods
Definition: widltypes.h:343
unsigned char ptr_def_fc
Definition: widltypes.h:361
union _expr_t::@4029 u
enum type_type type_type
Definition: widltypes.h:420
struct _loc_info_t loc_info
Definition: widltypes.h:459
GLdouble GLdouble t
Definition: gl.h:2047
struct _type_t * async_iface
Definition: widltypes.h:347
struct list entry
Definition: widltypes.h:293
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
const char * sval
Definition: widltypes.h:312
type_kind
Definition: widltypes.h:215
expr_type
char * name
Definition: widltypes.h:514
unsigned int typestring_offset
Definition: widltypes.h:457
struct _type_t * ref
Definition: widltypes.h:379
enum storage_class stgclass
Definition: widltypes.h:455
var_t * find_const(const char *name, int f)
Definition: parser.tab.c:6224
struct list entry
Definition: widltypes.h:485
Definition: widltypes.h:483
unsigned char declptr
Definition: widltypes.h:362
int is_const
Definition: widltypes.h:317
type_type
Definition: widltypes.h:399
unsigned int typestring_offset
Definition: widltypes.h:437
type_t * alloc_type(void)
Definition: parser.tab.c:5517
static int statements_has_func(const statement_list_t *stmts)
Definition: widltypes.h:601
type_basic_type
Definition: widltypes.h:260
const expr_t * ref
Definition: widltypes.h:308
threading_type
Definition: widltypes.h:251
struct enumeration_details * enumeration
Definition: widltypes.h:425
union _statement_t::@4031 u
expr_t * eval
Definition: widltypes.h:454
void * pval
Definition: widltypes.h:300
int cval
Definition: widltypes.h:318
struct _type_t * field
Definition: widltypes.h:385
type_t * tref
Definition: widltypes.h:314
struct _var_t * retval
Definition: widltypes.h:336
struct list entry
Definition: widltypes.h:394
type_t * type
Definition: widltypes.h:526
unsigned int ptrdesc
Definition: widltypes.h:438
type_t * type
Definition: widltypes.h:467
struct rtype * type_hash[HASHMAX]
Definition: widltypes.h:396
struct bitfield_details bitfield
Definition: widltypes.h:433
statement_type_t type
Definition: parser.h:124
statement_type
Definition: widltypes.h:237
expr_t * size_is
Definition: widltypes.h:357
type_t * reg_type(type_t *type, const char *name, struct namespace *namespace, int t)
Definition: parser.tab.c:5992
attr_type
Definition: widltypes.h:68
unsigned int written
Definition: widltypes.h:443
GLuint GLfloat * val
Definition: glext.h:7180
struct _type_t * elem
Definition: widltypes.h:359
char * name
Definition: widltypes.h:494
struct list entry
Definition: widltypes.h:480
expr_t * length_is
Definition: widltypes.h:358
user_type_list_t user_type_list
Definition: header.c:42
GLfloat f
Definition: glext.h:7540
context_handle_list_t context_handle_list
Definition: header.c:43
unsigned char def_fc
Definition: widltypes.h:380
storage_class
Definition: widltypes.h:229
double dval
Definition: widltypes.h:311
unsigned int procstring_offset
Definition: widltypes.h:456
type_t * type
Definition: widltypes.h:452
union _type_t::@4030 details
attr_list_t * attrs
Definition: widltypes.h:421
#define HASHMAX
Definition: widltypes.h:389
const char * c_name
Definition: widltypes.h:435
struct list children
Definition: widltypes.h:395
unsigned int defined
Definition: widltypes.h:442
attr_list_t * attrs
Definition: widltypes.h:453
type_t * type
Definition: widltypes.h:536
int typelib_idx
Definition: widltypes.h:439
struct _type_t * disp_inherit
Definition: widltypes.h:346
var_t * var
Definition: widltypes.h:466
static enum type_type type_get_type_detect_alias(const type_t *type)
Definition: widltypes.h:589
struct iface_details * iface
Definition: widltypes.h:427
struct list entry
Definition: widltypes.h:531
Definition: widltypes.h:290
const expr_t * bits
Definition: widltypes.h:386
void check_for_additional_prototype_types(const var_list_t *list)
Definition: header.c:640
const char * name
Definition: widltypes.h:418
int lval
Definition: widltypes.h:310
statement_list_t * stmts
Definition: widltypes.h:342
char * format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix)
Definition: typetree.c:110
enum type_basic_type type
Definition: widltypes.h:373
Definition: _list.h:228
const expr_t * ext
Definition: widltypes.h:313
struct list entry
Definition: widltypes.h:546
var_list_t * append_var(var_list_t *list, var_t *var)
Definition: parser.tab.c:5852
const char * input_name
Definition: widltypes.h:285
char * name
Definition: widltypes.h:451
unsigned int checked
Definition: widltypes.h:446
const attr_list_t * attrs
Definition: widltypes.h:515
void init_loc_info(loc_info_t *)
Definition: parser.tab.c:7200
struct list entry
Definition: widltypes.h:303
statement_list_t * stmts
Definition: widltypes.h:517
var_list_t * disp_props
Definition: widltypes.h:344
int line_number
Definition: widltypes.h:286
const char * str
Definition: widltypes.h:537
GUID UUID
Definition: widltypes.h:32
type_list_t * type_list
Definition: widltypes.h:540
unsigned int user_types_registered
Definition: widltypes.h:444
ifref_t iface
Definition: widltypes.h:535
const char * name
Definition: widltypes.h:522
unsigned int ival
Definition: widltypes.h:299
type_t * iface
Definition: widltypes.h:476
unsigned int ignore
Definition: widltypes.h:441
attr_list_t * attrs
Definition: widltypes.h:477
struct list entry
Definition: widltypes.h:521
struct list entry
Definition: widltypes.h:462
type_t * get_type(enum type_type type, char *name, struct namespace *namespace, int t)
Definition: parser.tab.c:6178
const char * name
Definition: widltypes.h:392
struct _type_t * inherit
Definition: widltypes.h:345
generic_handle_list_t generic_handle_list
Definition: header.c:44
struct basic_details basic
Definition: widltypes.h:431
Definition: name.c:36
ifref_list_t * ifaces
Definition: widltypes.h:368
type_t * find_type(const char *name, struct namespace *namespace, int t)
Definition: parser.tab.c:6139
struct list importlibs
Definition: widltypes.h:516
type_t * orig
Definition: widltypes.h:436
const expr_t * ext2
Definition: widltypes.h:316
type_t * type
Definition: widltypes.h:484
type_t * make_type(enum type_type type)
Definition: typetree.c:44
struct namespace * parent
Definition: widltypes.h:393
struct _type_list_t * next
Definition: widltypes.h:527
void init_types(void)
Definition: parser.tab.c:5310
void set_all_tfswrite(int val)
Definition: parser.tab.c:5524
loc_info_t loc_info
Definition: widltypes.h:440
void clear_all_offsets(void)
Definition: parser.tab.c:5531
char * str
Definition: widltypes.h:292
importinfo_t * importinfos
Definition: widltypes.h:505
union _attr_t::@4028 u
var_list_t * enums
Definition: widltypes.h:330
char * name
Definition: widltypes.h:500
syskind_t
Definition: widltypes.h:549