14
14
15
15
Function: symbol_tablet::add
16
16
17
- Inputs:
17
+ Inputs:
18
+ symbol - The symbol to be added to the symbol table
18
19
19
- Outputs:
20
+ Outputs: Returns a boolean indicating whether the process failed,
21
+ which should only happen if there is a symbol with the same
22
+ name already in the symbol table
20
23
21
- Purpose:
24
+ Purpose: Add a new symbol to the symbol table
22
25
23
26
\*******************************************************************/
24
27
@@ -39,11 +42,28 @@ bool symbol_tablet::add(const symbolt &symbol)
39
42
40
43
Function: symbol_tablet::move
41
44
42
- Inputs:
43
-
44
- Outputs:
45
-
46
- Purpose:
45
+ Inputs:
46
+ symbol - The symbol to be added to the symbol table
47
+ new_symbol - Pointer which the function will set to either point
48
+ to the symbol in the symbol table with the same name
49
+ or to the symbol that has been successfully moved
50
+ into the symbol table
51
+
52
+ Outputs: Returns a boolean indicating whether the process failed,
53
+ which should only happen if there is a symbol with the
54
+ same name already in the symbol table. If the process
55
+ failed then symbol is unchanged and new_symbol points to
56
+ the symbol with the same name. If the process succeeded
57
+ symbol is set to be empty and new_symbol points to its new
58
+ location in the symbol table
59
+
60
+ Purpose: Move a symbol into the symbol table. If there is already
61
+ a symbol with the same name then symbol is unchanged,
62
+ new_symbol points to the symbol with the same name and
63
+ true is returned. Otherwise, the symbol is moved into the
64
+ symbol table, symbol is set to be empty, new_symbol points
65
+ to its new location in the symbol table and false is
66
+ returned
47
67
48
68
\*******************************************************************/
49
69
@@ -75,11 +95,12 @@ bool symbol_tablet::move(symbolt &symbol, symbolt *&new_symbol)
75
95
76
96
Function: symbol_tablet::remove
77
97
78
- Inputs:
98
+ Inputs:
99
+ name - The name of the symbol to remove
79
100
80
- Outputs:
101
+ Outputs: Returns a boolean indicating whether the process failed
81
102
82
- Purpose:
103
+ Purpose: Remove a symbol from the symbol table
83
104
84
105
\*******************************************************************/
85
106
@@ -121,11 +142,12 @@ bool symbol_tablet::remove(const irep_idt &name)
121
142
122
143
Function: symbol_tablet::show
123
144
124
- Inputs:
145
+ Inputs:
146
+ out - The ostream to direct output to
125
147
126
148
Outputs:
127
149
128
- Purpose:
150
+ Purpose: Print the contents of the symbol table
129
151
130
152
\*******************************************************************/
131
153
@@ -141,11 +163,13 @@ void symbol_tablet::show(std::ostream &out) const
141
163
142
164
Function: symbol_tablet::lookup
143
165
144
- Inputs:
166
+ Inputs:
167
+ identifier - The name of the symbol to look for
145
168
146
- Outputs:
169
+ Outputs: The symbol in the symbol table with the correct name
147
170
148
- Purpose:
171
+ Purpose: Find a symbol in the symbol table. Throws a string if no
172
+ such symbol is found.
149
173
150
174
\*******************************************************************/
151
175
@@ -163,11 +187,13 @@ const symbolt &symbol_tablet::lookup(const irep_idt &identifier) const
163
187
164
188
Function: symbol_tablet::lookup
165
189
166
- Inputs:
190
+ Inputs:
191
+ identifier - The name of the symbol to look for
167
192
168
- Outputs:
193
+ Outputs: The symbol in the symbol table with the correct name
169
194
170
- Purpose:
195
+ Purpose: Find a symbol in the symbol table. Throws a string if no
196
+ such symbol is found.
171
197
172
198
\*******************************************************************/
173
199
@@ -185,11 +211,13 @@ symbolt &symbol_tablet::lookup(const irep_idt &identifier)
185
211
186
212
Function: operator <<
187
213
188
- Inputs:
214
+ Inputs:
215
+ out - The ostream to direct output to
216
+ symbol_table - The symbol table to print out
189
217
190
218
Outputs:
191
219
192
- Purpose:
220
+ Purpose: Print the contents of the symbol table
193
221
194
222
\*******************************************************************/
195
223
0 commit comments