]> git.sur5r.net Git - cc65/blob - src/cc65/declare.h
Some changes in the way, types and type strings are handled.
[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 #define DS_EXTRA_TYPE           0x0004U /* Extra type declared          */
29
30 /* Result of ParseDeclSpec */
31 typedef struct DeclSpec DeclSpec;
32 struct DeclSpec {
33     unsigned    StorageClass;           /* One of the SC_xxx flags      */
34     type        Type [MAXTYPELEN];      /* Type of the declaration spec */
35     unsigned    Flags;                  /* Bitmapped flags              */
36 };
37
38 /* Result of ParseDecl */
39 typedef struct Declaration Declaration;
40 struct Declaration {
41     ident       Ident;                  /* The identifier if any, else empty */
42     type        Type [MAXTYPELEN];      /* The type */
43
44     /* Working variables */
45     type*       T;                      /* Used to build Type */
46 };
47
48 /* Modes for ParseDecl */
49 #define DM_NEED_IDENT   0U              /* We must have an identifier */
50 #define DM_NO_IDENT     1U              /* We won't read an identifier */
51 #define DM_ACCEPT_IDENT 2U              /* We will accept an id if there is one */
52
53
54
55 /*****************************************************************************/
56 /*                                   Code                                    */
57 /*****************************************************************************/
58
59
60
61 type* ParseType (type* Type);
62 /* Parse a complete type specification */
63
64 void ParseDecl (const DeclSpec* Spec, Declaration* D, unsigned Mode);
65 /* Parse a variable, type or function declaration */
66
67 void ParseDeclSpec (DeclSpec* D, unsigned DefStorage, int DefType);
68 /* Parse a declaration specification */
69
70 void CheckEmptyDecl (const DeclSpec* D);
71 /* Called after an empty type declaration (that is, a type declaration without
72  * a variable). Checks if the declaration does really make sense and issues a
73  * warning if not.
74  */
75
76 void ParseInit (type* tptr);
77 /* Parse initialization of variables. */
78
79
80
81 /* End of declare.h */
82
83 #endif
84
85
86