~ubuntu-branches/ubuntu/maverick/aspectc++/maverick

« back to all changes in this revision

Viewing changes to Puma/src/parser/cparser/CTree.cc

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2008-04-10 17:40:52 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20080410174052-xdnsm7oi8hauyyf1
Tags: 1.0pre4~svn.20080409+dfsg-3
Fix another missing include, this time in Ag++/StdSystem.cc

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
  return cnt;
57
57
}
58
58
 
59
 
void CTree::ReplaceSon (CTree * const *sons, int max, CTree *old_son, CTree *new_son) const {
60
 
  for (int i = 0; i < max; i++)
61
 
    if (sons[i] == old_son)
62
 
      ((CTree**)sons)[i] = new_son;
 
59
void CTree::ReplaceSon (CTree **sons, int max, CTree *old_son, CTree *new_son) {
 
60
  for (int i = 0; i < max; i++) {
 
61
    if (sons[i] == old_son) {
 
62
      sons[i] = new_son;
 
63
      if (new_son) SetParent (new_son, this);
 
64
    }
 
65
  }
 
66
}
 
67
 
 
68
void CTree::ReplaceSon (CTree *&son, CTree *old_son, CTree *new_son) {
 
69
  if (old_son == son) {
 
70
    son = new_son;
 
71
    if (new_son) SetParent (new_son, this);
 
72
  }
 
73
}
 
74
 
 
75
void CTree::AddSon (CTree *&son, CTree *new_son) {
 
76
  son = new_son;
 
77
  if (new_son) SetParent (new_son, this);
63
78
}
64
79
 
65
80
// find the start token
149
164
 
150
165
void CT_List::InsertSon (CTree *before_son, CTree *new_son) {
151
166
  int sons = Sons ();
152
 
  for (int i = 0; i < sons; i++)
 
167
  for (int i = 0; i < sons; i++) {
153
168
    if (Son (i) == before_son) {
154
169
      _sons.insert (i, new_son);
 
170
      if (new_son) SetParent (new_son, this);
155
171
      break;
156
172
    }
 
173
  }
157
174
}
158
175
 
159
176
void CT_List::ReplaceSon (CTree *old_son, CTree *new_son) {
160
177
  int sons = Sons ();
161
 
  for (int i = 0; i < sons; i++)
 
178
  for (int i = 0; i < sons; i++) {
162
179
    if (Son (i) == old_son) {
163
180
      _sons[i] = new_son;
 
181
      if (new_son) SetParent (new_son, this);
164
182
      break;
165
183
    }
 
184
  }
166
185
}
167
186
 
168
187
void CT_List::RemoveSon (CTree *son) {
169
188
  int sons = Sons ();
170
 
  for (int i = 0; i < sons; i++)
 
189
  for (int i = 0; i < sons; i++) {
171
190
    if (Son (i) == son) {
172
191
      _sons.remove (i);
173
192
      break;
174
193
    }
 
194
  }
175
195
}
176
196
 
177
197
void CT_DeclList::Linkage (CT_LinkageSpec *l) {
236
256
  AddSon (n); 
237
257
 
238
258
  std::ostringstream name;
239
 
  name << "~" << n->token ()->text () << std::ends;
 
259
  name << "~" << n->token ()->text ();
240
260
  Name (name.str ().c_str ());
241
261
}
242
262
 
289
309
      name << op->token ()->text ();
290
310
      break;
291
311
  }
292
 
  name << std::ends;
293
312
  Name (name.str ().c_str ());
294
313
}
295
314
 
301
320
  std::ostringstream name;
302
321
  name << "operator ";
303
322
  TypeName ()->Object ()->TypeInfo ()->TypeText (name);
304
 
  name << std::ends;
305
323
  Name (name.str ().c_str ());
306
324
}
307
325
 
316
334
 
317
335
// static syntax tree node ids
318
336
 
 
337
// TODO: these extension node types shouldn't be defined here!
319
338
const char *CT_AsmBlock::NodeId () { return "AsmBlock"; }
320
339
 
 
340
const char *CT_GnuAsmSpec::NodeId () { return "GnuAsmSpec"; }
321
341
const char *CT_GnuAsmDef::NodeId () { return "GnuAsmDef"; }
322
342
const char *CT_GnuAsmOperand::NodeId () { return "GnuAsmOperand"; }
323
343
const char *CT_GnuAsmOperands::NodeId () { return "GnuAsmOperands"; }
337
357
const char *CT_TemplateParamList::NodeId () { return "TemplateParamList"; }
338
358
const char *CT_TemplateArgList::NodeId () { return "TemplateArgList"; }
339
359
const char *CT_Expression::NodeId() { return "Expression"; }
 
360
const char *CT_Call::NodeId() { return "Call"; }
 
361
const char *CT_ImplicitCall::NodeId() { return "ImplicitCall"; }
340
362
const char *CT_String::NodeId () { return "String"; }
341
363
const char *CT_WideString::NodeId () { return "WideString"; }
342
364
const char *CT_Integer::NodeId () { return "Integer"; }