ReactOS  0.4.15-dev-3163-gf17c2c0
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 {
80  ATTR_CALLCONV, /* calling convention pseudo-attribute */
84  ATTR_CONST, /* const pseudo-attribute */
172 };
173 
175 {
214 };
215 
217 {
228 };
229 
231 {
236 };
237 
239 {
250 };
251 
253 {
259 };
260 
262 {
278 };
279 
280 #define TYPE_BASIC_MAX TYPE_BASIC_HANDLE
281 #define TYPE_BASIC_INT_MIN TYPE_BASIC_INT8
282 #define TYPE_BASIC_INT_MAX TYPE_BASIC_HYPER
283 
285 {
286  const char *input_name;
288  const char *near_text;
289 };
290 
292 {
293  char *str;
294  struct list entry;
295 };
296 
297 struct _attr_t {
299  union {
300  unsigned int ival;
301  void *pval;
302  } u;
303  /* parser-internal */
304  struct list entry;
305 };
306 
307 struct _expr_t {
309  const expr_t *ref;
310  union {
311  int lval;
312  double dval;
313  const char *sval;
314  const expr_t *ext;
316  } u;
317  const expr_t *ext2;
318  int is_const;
319  int cval;
320  /* parser-internal */
321  struct list entry;
322 };
323 
325 {
327 };
328 
330 {
332 };
333 
335 {
337  struct _var_t *retval;
338  int idx;
339 };
340 
342 {
346  struct _type_t *inherit;
349 };
350 
352 {
354 };
355 
357 {
360  struct _type_t *elem;
361  unsigned int dim;
362  unsigned char ptr_def_fc;
363  unsigned char declptr; /* if declared as a pointer */
364  unsigned short ptr_tfsoff; /* offset of pointer definition for declptr */
365 };
366 
368 {
370 };
371 
373 {
375  int sign;
376 };
377 
379 {
380  struct _type_t *ref;
381  unsigned char def_fc;
382 };
383 
385 {
386  struct _type_t *field;
387  const expr_t *bits;
388 };
389 
390 #define HASHMAX 64
391 
392 struct namespace {
393  const char *name;
394  struct namespace *parent;
395  struct list entry;
396  struct list children;
397  struct rtype *type_hash[HASHMAX];
398 };
399 
401 {
403  TYPE_BASIC, /* ints, floats and handles */
416 };
417 
418 struct _type_t {
419  const char *name;
420  struct namespace *namespace;
423  union
424  {
427  struct func_details *function;
435  } details;
436  const char *c_name;
437  type_t *orig; /* dup'd types */
438  unsigned int typestring_offset;
439  unsigned int ptrdesc; /* used for complex structs */
442  unsigned int ignore : 1;
443  unsigned int defined : 1;
444  unsigned int written : 1;
445  unsigned int user_types_registered : 1;
446  unsigned int tfswrite : 1; /* if the type needs to be written to the TFS */
447  unsigned int checked : 1;
448  unsigned int is_alias : 1; /* is the type an alias? */
449 };
450 
451 struct _var_t {
452  char *name;
457  unsigned int procstring_offset;
458  unsigned int typestring_offset;
459 
461 
462  /* parser-internal */
463  struct list entry;
464 };
465 
471 
472  /* parser-internal */
473  struct list entry;
474 };
475 
476 struct _ifref_t {
479 
480  /* parser-internal */
481  struct list entry;
482 };
483 
486  struct list entry;
487 };
488 
490  int offset;
492  int flags;
493  int id;
494 
495  char *name;
496 
498 };
499 
500 struct _importlib_t {
501  char *name;
502 
503  int version;
505 
508 
510 
511  struct list entry;
512 };
513 
514 struct _typelib_t {
515  char *name;
517  struct list importlibs;
519 };
520 
521 struct _user_type_t {
522  struct list entry;
523  const char *name;
524 };
525 
526 struct _type_list_t {
529 };
530 
531 struct _statement_t {
532  struct list entry;
534  union
535  {
538  const char *str;
542  } u;
543 };
544 
545 struct _warning_t {
546  int num;
547  struct list entry;
548 };
549 
550 typedef enum {
555 } syskind_t;
556 
561 
562 void init_types(void);
563 type_t *alloc_type(void);
564 void set_all_tfswrite(int val);
565 void clear_all_offsets(void);
566 
567 #define tsENUM 1
568 #define tsSTRUCT 2
569 #define tsUNION 3
570 
571 var_t *find_const(const char *name, int f);
572 type_t *find_type(const char *name, struct namespace *namespace, int t);
574 type_t *get_type(enum type_type type, char *name, struct namespace *namespace, int t);
575 type_t *reg_type(type_t *type, const char *name, struct namespace *namespace, int t);
576 void add_incomplete(type_t *t);
577 
578 var_t *make_var(char *name);
580 
581 void init_loc_info(loc_info_t *);
582 
583 char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix);
584 
585 static inline var_list_t *type_get_function_args(const type_t *func_type)
586 {
587  return func_type->details.function->args;
588 }
589 
591 {
592  if (type->is_alias)
593  return TYPE_ALIAS;
594  return type->type_type;
595 }
596 
597 #define STATEMENTS_FOR_EACH_FUNC(stmt, stmts) \
598  if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, statement_t, entry ) \
599  if (stmt->type == STMT_DECLARATION && stmt->u.var->stgclass == STG_NONE && \
600  type_get_type_detect_alias(stmt->u.var->type) == TYPE_FUNCTION)
601 
602 static inline int statements_has_func(const statement_list_t *stmts)
603 {
604  const statement_t *stmt;
605  int has_func = 0;
606  STATEMENTS_FOR_EACH_FUNC(stmt, stmts)
607  {
608  has_func = 1;
609  break;
610  }
611  return has_func;
612 }
613 
614 static inline int is_global_namespace(const struct namespace *namespace)
615 {
616  return !namespace->name;
617 }
618 
619 #endif
statement_list_t * stmts
Definition: widltypes.h:353
type_t * func_type
Definition: widltypes.h:469
const char * var
Definition: shader.c:5666
unsigned short ptr_tfsoff
Definition: widltypes.h:364
#define STATEMENTS_FOR_EACH_FUNC(stmt, stmts)
Definition: widltypes.h:597
struct func_details * function
Definition: widltypes.h:427
static int is_global_namespace(const struct namespace *namespace)
Definition: widltypes.h:614
var_list_t * fields
Definition: widltypes.h:326
static var_list_t * type_get_function_args(const type_t *func_type)
Definition: widltypes.h:585
struct struct_details * structure
Definition: widltypes.h:425
struct list entry
Definition: widltypes.h:473
unsigned int tfswrite
Definition: widltypes.h:446
typelib_t * lib
Definition: widltypes.h:540
importlib_t * importlib
Definition: widltypes.h:497
static const WCHAR separator[]
Definition: asmname.c:65
unsigned int dim
Definition: widltypes.h:361
struct module_details * module
Definition: widltypes.h:429
unsigned int is_alias
Definition: widltypes.h:448
struct list entry
Definition: widltypes.h:511
void add_incomplete(type_t *t)
var_list_t * args
Definition: widltypes.h:336
enum attr_type type
Definition: widltypes.h:298
enum expr_type type
Definition: widltypes.h:308
var_t * var
Definition: widltypes.h:539
expr_t * bits
Definition: widltypes.h:470
int ntypeinfos
Definition: widltypes.h:507
GLsizei const GLvoid * pointer
Definition: glext.h:5848
var_t * make_var(char *name)
const char * near_text
Definition: widltypes.h:288
struct coclass_details coclass
Definition: widltypes.h:431
struct list entry
Definition: widltypes.h:321
var_list_t * disp_methods
Definition: widltypes.h:344
unsigned char ptr_def_fc
Definition: widltypes.h:362
enum type_type type_type
Definition: widltypes.h:421
struct _loc_info_t loc_info
Definition: widltypes.h:460
GLdouble GLdouble t
Definition: gl.h:2047
struct _type_t * async_iface
Definition: widltypes.h:348
struct list entry
Definition: widltypes.h:294
const char * sval
Definition: widltypes.h:313
type_kind
Definition: widltypes.h:216
expr_type
char * name
Definition: widltypes.h:515
unsigned int typestring_offset
Definition: widltypes.h:458
struct _type_t * ref
Definition: widltypes.h:380
enum storage_class stgclass
Definition: widltypes.h:456
var_t * find_const(const char *name, int f)
struct list entry
Definition: widltypes.h:486
Definition: widltypes.h:484
unsigned char declptr
Definition: widltypes.h:363
int is_const
Definition: widltypes.h:318
type_type
Definition: widltypes.h:400
unsigned int typestring_offset
Definition: widltypes.h:438
type_t * alloc_type(void)
static int statements_has_func(const statement_list_t *stmts)
Definition: widltypes.h:602
type_basic_type
Definition: widltypes.h:261
const expr_t * ref
Definition: widltypes.h:309
threading_type
Definition: widltypes.h:252
struct enumeration_details * enumeration
Definition: widltypes.h:426
union _statement_t::@4786 u
expr_t * eval
Definition: widltypes.h:455
void * pval
Definition: widltypes.h:301
int cval
Definition: widltypes.h:319
struct _type_t * field
Definition: widltypes.h:386
type_t * tref
Definition: widltypes.h:315
struct _var_t * retval
Definition: widltypes.h:337
struct list entry
Definition: widltypes.h:395
type_t * type
Definition: widltypes.h:527
unsigned int ptrdesc
Definition: widltypes.h:439
type_t * type
Definition: widltypes.h:468
struct rtype * type_hash[HASHMAX]
Definition: widltypes.h:397
struct bitfield_details bitfield
Definition: widltypes.h:434
statement_type_t type
Definition: parser.h:124
statement_type
Definition: widltypes.h:238
expr_t * size_is
Definition: widltypes.h:358
type_t * reg_type(type_t *type, const char *name, struct namespace *namespace, int t)
attr_type
Definition: widltypes.h:68
unsigned int written
Definition: widltypes.h:444
GLuint GLfloat * val
Definition: glext.h:7180
struct _type_t * elem
Definition: widltypes.h:360
char * name
Definition: widltypes.h:495
struct list entry
Definition: widltypes.h:481
expr_t * length_is
Definition: widltypes.h:359
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:381
union _type_t::@4785 details
storage_class
Definition: widltypes.h:230
double dval
Definition: widltypes.h:312
unsigned int procstring_offset
Definition: widltypes.h:457
type_t * type
Definition: widltypes.h:453
attr_list_t * attrs
Definition: widltypes.h:422
#define HASHMAX
Definition: widltypes.h:390
const char * c_name
Definition: widltypes.h:436
struct list children
Definition: widltypes.h:396
unsigned int defined
Definition: widltypes.h:443
attr_list_t * attrs
Definition: widltypes.h:454
type_t * type
Definition: widltypes.h:537
int typelib_idx
Definition: widltypes.h:440
struct _type_t * disp_inherit
Definition: widltypes.h:347
union _expr_t::@4784 u
var_t * var
Definition: widltypes.h:467
static enum type_type type_get_type_detect_alias(const type_t *type)
Definition: widltypes.h:590
struct iface_details * iface
Definition: widltypes.h:428
struct list entry
Definition: widltypes.h:532
Definition: widltypes.h:291
const expr_t * bits
Definition: widltypes.h:387
void check_for_additional_prototype_types(const var_list_t *list)
Definition: header.c:640
const char * name
Definition: widltypes.h:419
int lval
Definition: widltypes.h:311
union _attr_t::@4783 u
statement_list_t * stmts
Definition: widltypes.h:343
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:374
Definition: _list.h:228
const expr_t * ext
Definition: widltypes.h:314
struct list entry
Definition: widltypes.h:547
var_list_t * append_var(var_list_t *list, var_t *var)
const char * input_name
Definition: widltypes.h:286
char * name
Definition: widltypes.h:452
unsigned int checked
Definition: widltypes.h:447
const attr_list_t * attrs
Definition: widltypes.h:516
void init_loc_info(loc_info_t *)
struct list entry
Definition: widltypes.h:304
statement_list_t * stmts
Definition: widltypes.h:518
var_list_t * disp_props
Definition: widltypes.h:345
int line_number
Definition: widltypes.h:287
const char * str
Definition: widltypes.h:538
GUID UUID
Definition: widltypes.h:32
type_list_t * type_list
Definition: widltypes.h:541
unsigned int user_types_registered
Definition: widltypes.h:445
ifref_t iface
Definition: widltypes.h:536
const char * name
Definition: widltypes.h:523
unsigned int ival
Definition: widltypes.h:300
type_t * iface
Definition: widltypes.h:477
unsigned int ignore
Definition: widltypes.h:442
attr_list_t * attrs
Definition: widltypes.h:478
struct list entry
Definition: widltypes.h:522
struct list entry
Definition: widltypes.h:463
type_t * get_type(enum type_type type, char *name, struct namespace *namespace, int t)
const char * name
Definition: widltypes.h:393
struct _type_t * inherit
Definition: widltypes.h:346
generic_handle_list_t generic_handle_list
Definition: header.c:44
struct basic_details basic
Definition: widltypes.h:432
Definition: name.c:38
ifref_list_t * ifaces
Definition: widltypes.h:369
type_t * find_type(const char *name, struct namespace *namespace, int t)
struct list importlibs
Definition: widltypes.h:517
type_t * orig
Definition: widltypes.h:437
const expr_t * ext2
Definition: widltypes.h:317
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
type_t * type
Definition: widltypes.h:485
type_t * make_type(enum type_type type)
Definition: typetree.c:44
struct namespace * parent
Definition: widltypes.h:394
struct _type_list_t * next
Definition: widltypes.h:528
void init_types(void)
void set_all_tfswrite(int val)
loc_info_t loc_info
Definition: widltypes.h:441
void clear_all_offsets(void)
char * str
Definition: widltypes.h:293
importinfo_t * importinfos
Definition: widltypes.h:506
var_list_t * enums
Definition: widltypes.h:331
char * name
Definition: widltypes.h:501
syskind_t
Definition: widltypes.h:550