]> git.sur5r.net Git - cc65/blob - src/cc65/declare.h
57bf41516501a923ca5d3d9be6cb9988d0ef6887
[cc65] / src / cc65 / declare.h
1 /*
2  * declare.h
3  *
4  * Ullrich von Bassewitz, 20.06.1998
5  */
6
7
8
9 #ifndef DECLARE_H
10 #define DECLARE_H
11
12
13
14 #include "scanner.h"
15 #include "symtab.h"
16
17
18
19 /*****************************************************************************/
20 /*                                   Data                                    */
21 /*****************************************************************************/
22
23
24
25 /* Masks for the Flags field in DeclSpec */
26 #define DS_DEF_STORAGE          0x0001U /* Default storage class used */
27 #define DS_DEF_TYPE             0x0002U /* Default type used */
28
29 /* Result of ParseDeclSpec */
30 typedef struct DeclSpec DeclSpec;
31 struct DeclSpec {
32     unsigned    StorageClass;           /* One of the SC_xxx flags */
33     type        Type [MAXTYPELEN];      /* Type of the declaration spec */
34     unsigned    Flags;                  /* Bitmapped flags */
35 };
36
37 /* Result of ParseDecl */
38 typedef struct Declaration Declaration;
39 struct Declaration {
40     ident       Ident;                  /* The identifier if any, else empty */
41     type        Type [MAXTYPELEN];      /* The type */
42
43     /* Working variables */
44     type*       T;                      /* Used to build Type */
45 };
46
47 /* Modes for ParseDecl */
48 #define DM_NEED_IDENT   0U              /* We must have an identifier */
49 #define DM_NO_IDENT     1U              /* We won't read an identifier */
50 #define DM_ACCEPT_IDENT 2U              /* We will accept an id if there is one */
51
52
53
54 /*****************************************************************************/
55 /*                                   Code                                    */
56 /*****************************************************************************/
57
58
59
60 type* ParseType (type* Type);
61 /* Parse a complete type specification */
62
63 void ParseDecl (const DeclSpec* Spec, Declaration* D, unsigned Mode);
64 /* Parse a variable, type or function declaration */
65
66 void ParseDeclSpec (DeclSpec* D, unsigned DefStorage, int DefType);
67 /* Parse a declaration specification */
68
69 void ParseInit (type* tptr);
70 /* Parse initialization of variables */
71
72
73
74 /* End of declare.h */
75
76 #endif
77
78
79