Return a variable type.
29{
30 enum
31 {
32 ENUM_VOID = 1 << 0,
33 ENUM_BOOL = 1 << 2,
34 ENUM_CHAR = 1 << 4,
35 ENUM_SHORT = 1 << 6,
36 ENUM_INT = 1 << 8,
37 ENUM_LONG = 1 << 10,
38 ENUM_FLOAT = 1 << 12,
39 ENUM_DOUBLE = 1 << 14,
40 ENUM_OTHER = 1 << 16,
41 ENUM_SIGNED = 1 << 17,
42 ENUM_UNSIGNED = 1 << 18,
43 };
44
46 int Counter = 0;
48
49 while (PtokenStack->
Pointer > 0)
50 {
51 TopToken =
Pop(PtokenStack);
53 {
54 Push(PtokenStack, TopToken);
55 break;
56 }
57 if (!strcmp(TopToken->
Value,
"@VOID"))
58 {
59 Counter += ENUM_VOID;
60 }
61 else if (!strcmp(TopToken->
Value,
"@BOOL"))
62 {
63 Counter += ENUM_BOOL;
64 }
65 else if (!strcmp(TopToken->
Value,
"@CHAR"))
66 {
67 Counter += ENUM_CHAR;
68 }
69 else if (!strcmp(TopToken->
Value,
"@SHORT"))
70 {
71 Counter += ENUM_SHORT;
72 }
73 else if (!strcmp(TopToken->
Value,
"@INT"))
74 {
75 Counter += ENUM_INT;
76 }
77 else if (!strcmp(TopToken->
Value,
"@LONG"))
78 {
79 Counter += ENUM_LONG;
80 }
81 else if (!strcmp(TopToken->
Value,
"@FLOAT"))
82 {
83 Counter += ENUM_FLOAT;
84 }
85 else if (!strcmp(TopToken->
Value,
"@DOUBLE"))
86 {
87 Counter += ENUM_DOUBLE;
88 }
89 else if (!strcmp(TopToken->
Value,
"@SIGNED"))
90 {
91 Counter |= ENUM_SIGNED;
92 }
93 else if (!strcmp(TopToken->
Value,
"@UNSIGNED"))
94 {
95 Counter |= ENUM_UNSIGNED;
96 }
97 else
98 {
100 }
102
103 switch (Counter)
104 {
105 case ENUM_VOID:
107 break;
108 case ENUM_BOOL:
110 break;
111 case ENUM_CHAR:
112 case ENUM_SIGNED + ENUM_CHAR:
114 break;
115 case ENUM_UNSIGNED + ENUM_CHAR:
117 break;
118 case ENUM_SHORT:
119 case ENUM_SHORT + ENUM_INT:
120 case ENUM_SIGNED + ENUM_SHORT:
121 case ENUM_SIGNED + ENUM_SHORT + ENUM_INT:
123 break;
124 case ENUM_UNSIGNED + ENUM_SHORT:
125 case ENUM_UNSIGNED + ENUM_SHORT + ENUM_INT:
127 break;
128 case ENUM_INT:
129 case ENUM_SIGNED:
130 case ENUM_SIGNED + ENUM_INT:
132 break;
133 case ENUM_UNSIGNED:
134 case ENUM_UNSIGNED + ENUM_INT:
136 break;
137 case ENUM_LONG:
138 case ENUM_LONG + ENUM_INT:
139 case ENUM_LONG + ENUM_LONG:
140 case ENUM_LONG + ENUM_LONG + ENUM_INT:
141 case ENUM_SIGNED + ENUM_LONG:
142 case ENUM_SIGNED + ENUM_LONG + ENUM_INT:
143 case ENUM_SIGNED + ENUM_LONG + ENUM_LONG:
144 case ENUM_SIGNED + ENUM_LONG + ENUM_LONG + ENUM_INT:
146 break;
147 case ENUM_UNSIGNED + ENUM_LONG:
148 case ENUM_UNSIGNED + ENUM_LONG + ENUM_INT:
149 case ENUM_UNSIGNED + ENUM_LONG + ENUM_LONG:
150 case ENUM_UNSIGNED + ENUM_LONG + ENUM_LONG + ENUM_INT:
152 break;
153 case ENUM_FLOAT:
155 break;
156 case ENUM_DOUBLE:
158 break;
159 case ENUM_LONG + ENUM_DOUBLE:
161 break;
162 }
163 }
164 return Result;
165}
NULL()
Definition test-case-generator.py:530
PTOKEN Pop(PTOKEN_LIST TokenList)
Removes last Token of a TokenList and returns it.
Definition common.c:485
void RemoveToken(PTOKEN *Token)
Removes allocated memory of a token.
Definition common.c:104
PTOKEN_LIST Push(PTOKEN_LIST TokenList, PTOKEN Token)
Adds Token to the last empty position of TokenList.
Definition common.c:424
unsigned int Pointer
Definition common.h:85
read tokens from input stored in this structure
Definition common.h:72
char * Value
Definition common.h:74
TOKEN_TYPE Type
Definition common.h:73
VARIABLE_TYPE * VARIABLE_TYPE_FLOAT
Definition type.c:18
VARIABLE_TYPE * VARIABLE_TYPE_UCHAR
Definition type.c:13
VARIABLE_TYPE * VARIABLE_TYPE_UNKNOWN
Definition type.c:3
VARIABLE_TYPE * VARIABLE_TYPE_DOUBLE
Definition type.c:19
VARIABLE_TYPE * VARIABLE_TYPE_ULONG
Definition type.c:16
VARIABLE_TYPE * VARIABLE_TYPE_VOID
Definition type.c:5
VARIABLE_TYPE * VARIABLE_TYPE_LONG
Definition type.c:11
VARIABLE_TYPE * VARIABLE_TYPE_BOOL
Definition type.c:6
VARIABLE_TYPE * VARIABLE_TYPE_INT
Definition type.c:10
VARIABLE_TYPE * VARIABLE_TYPE_CHAR
Definition type.c:8
VARIABLE_TYPE * VARIABLE_TYPE_UINT
Definition type.c:15
VARIABLE_TYPE * VARIABLE_TYPE_USHORT
Definition type.c:14
VARIABLE_TYPE * VARIABLE_TYPE_LDOUBLE
Definition type.c:20