OpenCores
URL https://opencores.org/ocsvn/c16/c16/trunk

Subversion Repositories c16

[/] [c16/] [trunk/] [compiler/] [Name.hh] - Blame information for rev 31

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 jsauermann
// Name.hh
2
 
3
#include "List.hh"
4
class TypeName;
5 7 jsauermann
class Name;
6 2 jsauermann
 
7
//-----------------------------------------------------------------------------
8
class Name
9
{
10
public:
11
   Name(const char * n, Name * t, TypeName * d, int spos)
12
   : name(n),
13
     tail(t),
14
     decl(d),
15
     stack_position(spos)
16
     {}
17
 
18
   static TypeName  * FindType(const char * na);
19
   static int         FindPos(const char * na);
20
   static bool        FindEnum(const char * na, int & value);
21
   static void        AddExtern(const char * na, TypeName * decl);
22
   static void        AddStatic(const char * na, TypeName * decl);
23
   static void        AddEnum(const char * na, int value);
24
   static void        AddLocal(const char * na, TypeName * decl);
25
   static void        AddAuto(const char * na, TypeName * decl, int spos = 0);
26
   static void        SetAutoPos(const char * na, int spos);
27
   static void        AutoToLocal();
28
   static void        PrintAll(FILE * out);
29
 
30 7 jsauermann
   static void        RemoveAuto();
31
   static bool        ContextIsEmpty()   { return (autos == 0); };
32
   static void        PushContext();
33
   static void        PopContext();
34
 
35 2 jsauermann
   void               Print(FILE * out);
36
 
37
private:
38
   const char * name;
39
   Name       * tail;
40
   TypeName   * decl;
41
   int          stack_position;
42
 
43
   static Name * FindDeclared(const char * na);
44
 
45
   static Name * externs;
46
   static Name * statics;
47
   static Name * locals;
48
   static Name * enums;
49
   static Name * autos;
50
};
51
//-----------------------------------------------------------------------------
52
class TypedefName
53
{
54
public:
55
   TypedefName(const char * n, TypedefName * t, TypeName * d)
56
   : name(n),
57
     tail(t),
58
     decl(d)
59
     {}
60
 
61
   static bool       IsDefined(const char * na);
62
   static TypeName * Find(const char * na);
63
   static void       Add(const char * na, TypeName * decl);
64
 
65
private:
66
   const char  * name;
67
   TypedefName * tail;
68
   TypeName    * decl;
69
 
70
   static TypedefName * typedefs;
71
};
72
//-----------------------------------------------------------------------------
73
class StructName
74
{
75
public:
76
   StructName(const char * n, StructName * t, StructDeclarationList * sdl)
77
   : name(n),
78
     tail(t),
79
     sdlist(sdl)
80
     {}
81
 
82
   static bool IsDefined(const char * na);
83
   static StructDeclarationList * Find(const char * na);
84
   static void Add(const char * na, StructDeclarationList * sdl);
85
 
86
private:
87
   const char            * name;
88
   StructName            * tail;
89
   StructDeclarationList * sdlist;
90
 
91
   static StructName * structs;
92
};
93
//-----------------------------------------------------------------------------

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.