Fix file mode.
[llvm-testsuite.git] / MultiSource / Applications / kimwitu++ / parse.cc
blobffd4acb582c8dbab42176e0433057d63eaf15315
1 /* translation of file "parse.k" */
2 /* generated by:
3 * @(#)$Author$
4 */
5 #define KC_FUNCTIONS_parse_
7 #include <stdlib.h>
8 #include "k.h"
9 #include "parse.h"
10 namespace kc { }
11 using namespace kc;
12 /* included stuff */
14 // The Termprocessor Kimwitu++
16 // Copyright (C) 1991 University of Twente, Dept TIOS.
17 // Copyright (C) 1998-2003 Humboldt-University of Berlin, Institute of Informatics
18 // All rights reserved.
20 // Kimwitu++ is free software; you can redistribute it and/or modify
21 // it under the terms of the GNU General Public License as published by
22 // the Free Software Foundation; either version 2 of the License, or
23 // (at your option) any later version.
25 // Kimwitu++ is distributed in the hope that it will be useful,
26 // but WITHOUT ANY WARRANTY; without even the implied warranty of
27 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 // GNU General Public License for more details.
30 // You should have received a copy of the GNU General Public License
31 // along with Kimwitu++; if not, write to the Free Software
32 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
35 static char parse_kAccesSid[] = "@(#)$Id$";
37 int pg_lineno = 1; /* global line # */
38 int pg_column = 0; /* global column # */
39 int pg_charpos = 0; /* global charpos # */
40 casestring pg_filename; /* global file name */
41 int pg_no_of_arguments; /* no_of_arguments */
42 phylumdeclarations Thephylumdeclarations; /* global phylumdecls */
43 rwdeclarations Therwdeclarations; /* global rw-decls */
44 fndeclarations Thefndeclarations; /* fn-decls for the file being parsed */
45 fnfiles Thefnfiles; /* global fn-decls */
46 includefiles Theincludefiles; /* global incl-decls */
47 unparsedeclarations Theunparsedeclarations; /* global unp-decls */
48 argsnumbers Theargsnumbers; /* global list of argsnumbers */
49 viewnames Theuviewnames; /* global list of u-viewnames */
50 viewnames Therviewnames; /* global list of r-viewnames */
51 storageclasses Thestorageclasses; /* global list of storageclasses */
52 languagenames Thelanguages; /* global list of used languages */
53 baseclass_declarations Thebaseclasses; /* global list of defined baseclasses */
54 bool pg_uviewshavebeendefined; /* global indication */
55 bool pg_rviewshavebeendefined; /* global indication */
56 bool pg_storageclasseshavebeendefined; /* global indication */
57 bool pg_languageshavebeendefined; /* global indication */
59 static long language_text_nr=0;
60 static bool language_text_nr_used=false;
62 #include "util.h"
64 /* end included stuff */
67 namespace kc {
69 #ifndef KC_TRACE_PROVIDED
70 #define KC_TRACE_PROVIDED(COND,FILE,LINE,NODE) COND
71 #endif
73 static ID f_ID_of_direct_decl (ac_direct_declarator d);
74 static int f_stars_of_ac_pointer_option (ac_pointer_option d);
75 static int f_stars_of_ac_pointer (ac_pointer d);
76 static bool f_is_member_fn (ac_declarator dec);
77 static bool f_static_in_ac_decl_spec (ac_declaration_specifier ds);
78 static bool f_static_in_ac_stor_class (ac_storage_class_specifier sc);
79 static ID f_ID_of_ac_declaration_specifier (ac_declaration_specifier d);
80 static ID f_ID_of_ac_type_specifier (ac_type_specifier d);
81 phylumdeclarations mergephylumdeclarations(phylumdeclaration pd, phylumdeclarations pds)
83 phylumdeclaration kc_selvar_0_1 = phylum_cast<phylumdeclaration>(pd);
84 if ((kc_selvar_0_1->prod_sel() == sel_PhylumDeclaration)) {
85 const ID pd_id = phylum_cast<const impl_phylumdeclaration_PhylumDeclaration*>(kc_selvar_0_1)->ID_1;
86 const storageoption pd_stopt = phylum_cast<const impl_phylumdeclaration_PhylumDeclaration*>(kc_selvar_0_1)->storageoption_1;
87 const productionblock pd_pb = phylum_cast<const impl_phylumdeclaration_PhylumDeclaration*>(kc_selvar_0_1)->productionblock_1;
88 const Ccode_option pd_ccopt = phylum_cast<const impl_phylumdeclaration_PhylumDeclaration*>(kc_selvar_0_1)->Ccode_option_1;
90 phylumdeclaration fpd = f_lookupuserdecl( pd_id );
91 if (!fpd) {
92 v_add( pd_id );
93 return Consphylumdeclarations( pd, pds );
94 } else if ( pd == fpd ) {
95 if ( f_added( pd_id ) ) {
96 return pds;
97 } else {
98 v_add( pd_id );
99 return Consphylumdeclarations( pd, pds );
104 phylumdeclaration kc_selvar_1_1 = phylum_cast<phylumdeclaration>( fpd );
105 if ((kc_selvar_1_1->prod_sel() == sel_PhylumDeclaration)) {
106 const ID fpd_id = phylum_cast<const impl_phylumdeclaration_PhylumDeclaration*>(kc_selvar_1_1)->ID_1;
107 const storageoption fpd_stopt = phylum_cast<const impl_phylumdeclaration_PhylumDeclaration*>(kc_selvar_1_1)->storageoption_1;
108 const productionblock fpd_pb = phylum_cast<const impl_phylumdeclaration_PhylumDeclaration*>(kc_selvar_1_1)->productionblock_1;
109 const Ccode_option fpd_ccopt = phylum_cast<const impl_phylumdeclaration_PhylumDeclaration*>(kc_selvar_1_1)->Ccode_option_1;
112 storageoption kc_selvar_2_1 = phylum_cast<storageoption>( pd_stopt);
113 storageoption kc_selvar_2_2 = phylum_cast<storageoption>( fpd_stopt );
114 if ((kc_selvar_2_1->prod_sel() == sel_PositiveStorageOption) && (kc_selvar_2_2->prod_sel() == sel_NegativeStorageOption) && (phylum_cast<const impl_storageoption_NegativeStorageOption*>(kc_selvar_2_2)->ID_1->eq(phylum_cast<const impl_storageoption_PositiveStorageOption*>(kc_selvar_2_1)->ID_1))) {
115 const ID id = phylum_cast<const impl_storageoption_PositiveStorageOption*>(kc_selvar_2_1)->ID_1;
117 v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1storageoption1S1ID( "storage option mismatch ( declared as ", fpd_stopt, ") for phylum", fpd_id )));
119 } else
120 if ((kc_selvar_2_1->prod_sel() == sel_NegativeStorageOption) && (kc_selvar_2_2->prod_sel() == sel_PositiveStorageOption) && (phylum_cast<const impl_storageoption_PositiveStorageOption*>(kc_selvar_2_2)->ID_1->eq(phylum_cast<const impl_storageoption_NegativeStorageOption*>(kc_selvar_2_1)->ID_1))) {
121 const ID id = phylum_cast<const impl_storageoption_NegativeStorageOption*>(kc_selvar_2_1)->ID_1;
123 v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1storageoption1S1ID( "storage option mismatch ( declared as ", fpd_stopt, ") for phylum", fpd_id )));
125 } else
126 if ((kc_selvar_2_1->prod_sel() == sel_PositiveStorageOption) && (kc_selvar_2_2->prod_sel() == sel_PositiveStorageOption) && (phylum_cast<const impl_storageoption_PositiveStorageOption*>(kc_selvar_2_2)->ID_1->eq(phylum_cast<const impl_storageoption_PositiveStorageOption*>(kc_selvar_2_1)->ID_1))) {
127 const ID id = phylum_cast<const impl_storageoption_PositiveStorageOption*>(kc_selvar_2_1)->ID_1;
129 } else
130 if ((kc_selvar_2_1->prod_sel() == sel_NegativeStorageOption) && (kc_selvar_2_2->prod_sel() == sel_NegativeStorageOption) && (phylum_cast<const impl_storageoption_NegativeStorageOption*>(kc_selvar_2_2)->ID_1->eq(phylum_cast<const impl_storageoption_NegativeStorageOption*>(kc_selvar_2_1)->ID_1))) {
131 const ID id = phylum_cast<const impl_storageoption_NegativeStorageOption*>(kc_selvar_2_1)->ID_1;
133 } else
134 if ((kc_selvar_2_1->prod_sel() == sel_NoStorageOption)) {
135 /*EMPTY*/
136 } else
137 if ((kc_selvar_2_2->prod_sel() == sel_NoStorageOption)) {
138 static_cast<impl_phylumdeclaration_PhylumDeclaration*>(fpd)->storageoption_1 = pd_stopt;
139 } else
145 v_report(NonFatal( FileLine( pd_id->file, pd_id->line ), Problem1S1storageoption1S1ID( "storage option mismatch ( declared as ", fpd_stopt, ") for phylum", fpd_id )));
150 productionblock kc_selvar_2_1 = phylum_cast<productionblock>( pd_pb);
151 productionblock kc_selvar_2_2 = phylum_cast<productionblock>( fpd_pb );
152 if ((kc_selvar_2_1->prod_sel() == sel_NonlistAlternatives) && (kc_selvar_2_2->prod_sel() == sel_NonlistAlternatives)) {
153 const alternatives pd_pb_a = phylum_cast<const impl_productionblock_NonlistAlternatives*>(kc_selvar_2_1)->alternatives_1;
154 const alternatives fpd_pb_a = phylum_cast<const impl_productionblock_NonlistAlternatives*>(kc_selvar_2_2)->alternatives_1;
156 static_cast<impl_productionblock_NonlistAlternatives*>(fpd_pb)->alternatives_1 = concat(pd_pb_a, fpd_pb_a );
158 } else
159 if ((kc_selvar_2_1->prod_sel() == sel_NonlistAlternatives) && (kc_selvar_2_2->prod_sel() == sel_Emptyproductionblock)) {
160 static_cast<impl_phylumdeclaration_PhylumDeclaration*>(fpd)->productionblock_1 = pd_pb;
161 } else
162 if ((kc_selvar_2_1->prod_sel() == sel_PredefinedAlternatives) && (kc_selvar_2_2->prod_sel() == sel_Emptyproductionblock)) {
163 static_cast<impl_phylumdeclaration_PhylumDeclaration*>(fpd)->productionblock_1 = pd_pb;
164 } else
165 if ((kc_selvar_2_1->prod_sel() == sel_ListAlternatives) && (kc_selvar_2_2->prod_sel() == sel_Emptyproductionblock)) {
166 static_cast<impl_phylumdeclaration_PhylumDeclaration*>(fpd)->productionblock_1 = pd_pb;
167 } else
168 if ((kc_selvar_2_1->prod_sel() == sel_Emptyproductionblock) && (kc_selvar_2_2->prod_sel() == sel_Emptyproductionblock)) {
169 /*EMPTY*/
170 } else
171 if ((kc_selvar_2_1->prod_sel() == sel_NonlistAlternatives)) {
173 v_report(NonFatal( FileLine( pd_id->file, pd_id->line ), Problem1S1ID( "production block mismatch: trying to extend phylum", pd_id )));
175 } else
176 if ((kc_selvar_2_1->prod_sel() == sel_PredefinedAlternatives)) {
178 v_report(NonFatal( FileLine( pd_id->file, pd_id->line ), Problem1S1ID( "production block mismatch: trying to predefine phylum", pd_id )));
180 } else
181 if ((kc_selvar_2_1->prod_sel() == sel_ListAlternatives)) {
183 v_report(NonFatal( FileLine( pd_id->file, pd_id->line ), Problem1S1ID( "production block mismatch: trying to redefine list phylum", pd_id )));
185 } else
186 if ((kc_selvar_2_1->prod_sel() == sel_Emptyproductionblock)) {
187 /*EMPTY*/
188 } else
189 { kc_no_default_in_with( "mergephylumdeclarations", __LINE__, __FILE__ );
190 return static_cast<phylumdeclarations>(0); }
193 Ccode_option kc_selvar_2_1 = phylum_cast<Ccode_option>( pd_ccopt);
194 Ccode_option kc_selvar_2_2 = phylum_cast<Ccode_option>( fpd_ccopt );
195 if ((kc_selvar_2_1->prod_sel() == sel_CcodeOption) && (kc_selvar_2_2->prod_sel() == sel_CcodeOption)) {
196 const attributes pd_ccopt_attr = phylum_cast<const impl_Ccode_option_CcodeOption*>(kc_selvar_2_1)->attributes_1;
197 const Ctexts pd_ccopt_ct = phylum_cast<const impl_Ccode_option_CcodeOption*>(kc_selvar_2_1)->Ctexts_1;
198 const attributes fpd_ccopt_attr = phylum_cast<const impl_Ccode_option_CcodeOption*>(kc_selvar_2_2)->attributes_1;
199 const Ctexts fpd_ccopt_ct = phylum_cast<const impl_Ccode_option_CcodeOption*>(kc_selvar_2_2)->Ctexts_1;
201 static_cast<impl_phylumdeclaration_PhylumDeclaration*>(fpd)->Ccode_option_1 = CcodeOption( concat(pd_ccopt_attr, fpd_ccopt_attr), concat(pd_ccopt_ct, fpd_ccopt_ct ));
203 } else
204 { kc_no_default_in_with( "mergephylumdeclarations", __LINE__, __FILE__ );
205 return static_cast<phylumdeclarations>(0); }
208 } else
209 { kc_no_default_in_with( "mergephylumdeclarations", __LINE__, __FILE__ );
210 return static_cast<phylumdeclarations>(0); }
212 return pds;
214 } else
215 { kc_no_default_in_with( "mergephylumdeclarations", __LINE__, __FILE__ );
216 return static_cast<phylumdeclarations>(0); }
221 alternatives makeListAlternatives(ID listphylum, ID elementphylum)
223 ID Nil_id, Cons_id;
224 alternative Nil_alternative, Cons_alternative;
225 Nil_id = Id( Str( mkcasestring((string("Nil")+f_strofID(listphylum)).c_str())));
226 Cons_id = Id( Str( mkcasestring((string("Cons")+f_strofID(listphylum)).c_str())));
227 Nil_id->line = elementphylum->line;
228 Nil_id->file = elementphylum->file;
229 Cons_id->line = elementphylum->line;
230 Cons_id->file = elementphylum->file;
231 Nil_alternative = Alternative( Nil_id, Nilarguments() );
232 Cons_alternative = Alternative( Cons_id, Consarguments( listphylum, Consarguments( elementphylum, Nilarguments() ) ) );
233 v_extendoccur( Nil_id, ITUserOperator( Nil_alternative, listphylum ) );
234 v_extendoccur( Cons_id, ITUserOperator( Cons_alternative, listphylum ) );
235 return Consalternatives( Cons_alternative, Consalternatives( Nil_alternative, Nilalternatives() ) );
239 const char *f_strofID(ID id)
241 ID kc_selvar_0_1 = phylum_cast<ID>(id);
242 if ((kc_selvar_0_1->prod_sel() == sel_Id) && (phylum_cast<const impl_ID_Id*>(kc_selvar_0_1)->uniqID_1->prod_sel() == sel_Str)) {
243 const casestring cs = phylum_cast<const impl_uniqID_Str*>(phylum_cast<const impl_ID_Id*>(kc_selvar_0_1)->uniqID_1)->casestring_1;
244 return cs->name;
245 } else
246 { kc_no_default_in_with( "f_strofID", __LINE__, __FILE__ );
247 return static_cast<char*>(0); }
252 phylumdeclaration f_lookupuserdecl(ID id)
254 ID kc_selvar_0_1 = phylum_cast<ID>(id);
255 if ((kc_selvar_0_1->prod_sel() == sel_Id)) {
256 const uniqID uid = phylum_cast<const impl_ID_Id*>(kc_selvar_0_1)->uniqID_1;
259 IDtype kc_selvar_1_1 = phylum_cast<IDtype>( uid->type );
260 if ((kc_selvar_1_1->prod_sel() == sel_ITUserFunction)) {
262 v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "expected user-defined phylum instead of user-defined function:", id )));
263 return 0;
265 } else
266 if ((kc_selvar_1_1->prod_sel() == sel_ITUserRView)) {
268 v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "expected user-defined phylum instead of user-defined rewrite view:", id )));
269 return 0;
271 } else
272 if ((kc_selvar_1_1->prod_sel() == sel_ITPredefinedRView)) {
274 v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "expected user-defined phylum instead of predefined rewrite view:", id )));
275 return 0;
277 } else
278 if ((kc_selvar_1_1->prod_sel() == sel_ITUserUView)) {
280 v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "expected user-defined phylum instead of user-defined unparse view:", id )));
281 return 0;
283 } else
284 if ((kc_selvar_1_1->prod_sel() == sel_ITPredefinedUView)) {
286 v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "expected user-defined phylum instead of predefined unparse view:", id )));
287 return 0;
289 } else
290 if ((kc_selvar_1_1->prod_sel() == sel_ITStorageClass)) {
292 v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "expected user-defined phylum instead of user-defined storage class:", id )));
293 return 0;
295 } else
296 if ((kc_selvar_1_1->prod_sel() == sel_ITPredefinedStorageClass)) {
298 v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "expected user-defined phylum instead of predefined storage class:", id )));
299 return 0;
301 } else
302 if ((kc_selvar_1_1->prod_sel() == sel_ITUserOperator)) {
304 v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "expected user-defined phylum instead of user-defined operator:", id )));
305 return 0;
307 } else
308 if ((kc_selvar_1_1->prod_sel() == sel_ITPredefinedOperator)) {
310 v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "expected user-defined phylum instead of predefined operator:", id )));
311 return 0;
313 } else
314 if ((kc_selvar_1_1->prod_sel() == sel_ITUserPhylum)) {
315 const phylumdeclaration pd = phylum_cast<const impl_IDtype_ITUserPhylum*>(kc_selvar_1_1)->phylumdeclaration_1;
316 return pd;
317 } else
318 if ((kc_selvar_1_1->prod_sel() == sel_ITPredefinedPhylum)) {
320 v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "expected user-defined phylum instead of predefined phylum:", id )));
321 return 0;
323 } else
324 if ((kc_selvar_1_1->prod_sel() == sel_ITUnknown)) {
326 v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "undefined phylum:", id )));
327 return 0;
329 } else
330 { kc_no_default_in_with( "f_lookupuserdecl", __LINE__, __FILE__ );
331 return static_cast<phylumdeclaration>(0); }
334 } else
335 { kc_no_default_in_with( "f_lookupuserdecl", __LINE__, __FILE__ );
336 return static_cast<phylumdeclaration>(0); }
341 phylumdeclaration f_lookupdecl(ID id)
343 ID kc_selvar_0_1 = phylum_cast<ID>(id);
344 if ((kc_selvar_0_1->prod_sel() == sel_Id)) {
345 const uniqID uid = phylum_cast<const impl_ID_Id*>(kc_selvar_0_1)->uniqID_1;
348 IDtype kc_selvar_1_1 = phylum_cast<IDtype>( uid->type );
349 if ((kc_selvar_1_1->prod_sel() == sel_ITUserFunction)) {
351 v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "expected user-defined phylum instead of user-defined function:", id )));
352 return 0;
354 } else
355 if ((kc_selvar_1_1->prod_sel() == sel_ITUserRView)) {
357 v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "expected user-defined phylum instead of user-defined rewrite view:", id )));
358 return 0;
360 } else
361 if ((kc_selvar_1_1->prod_sel() == sel_ITPredefinedRView)) {
363 v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "expected user-defined phylum instead of predefined rewrite view:", id )));
364 return 0;
366 } else
367 if ((kc_selvar_1_1->prod_sel() == sel_ITUserUView)) {
369 v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "expected user-defined phylum instead of user-defined unparse view:", id )));
370 return 0;
372 } else
373 if ((kc_selvar_1_1->prod_sel() == sel_ITPredefinedUView)) {
375 v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "expected user-defined phylum instead of predefined unparse view:", id )));
376 return 0;
378 } else
379 if ((kc_selvar_1_1->prod_sel() == sel_ITStorageClass)) {
381 v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "expected user-defined phylum instead of user-defined storage class:", id )));
382 return 0;
384 } else
385 if ((kc_selvar_1_1->prod_sel() == sel_ITPredefinedStorageClass)) {
387 v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "expected user-defined phylum instead of predefined storage class:", id )));
388 return 0;
390 } else
391 if ((kc_selvar_1_1->prod_sel() == sel_ITUserOperator)) {
393 v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "expected user-defined phylum instead of user-defined operator:", id )));
394 return 0;
396 } else
397 if ((kc_selvar_1_1->prod_sel() == sel_ITPredefinedOperator)) {
399 v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "expected user-defined phylum instead of predefined operator:", id )));
400 return 0;
402 } else
403 if ((kc_selvar_1_1->prod_sel() == sel_ITUserPhylum)) {
404 const phylumdeclaration pd = phylum_cast<const impl_IDtype_ITUserPhylum*>(kc_selvar_1_1)->phylumdeclaration_1;
405 return pd;
406 } else
407 if ((kc_selvar_1_1->prod_sel() == sel_ITPredefinedPhylum)) {
408 const phylumdeclaration pd = phylum_cast<const impl_IDtype_ITPredefinedPhylum*>(kc_selvar_1_1)->phylumdeclaration_1;
409 return pd;
410 } else
411 if ((kc_selvar_1_1->prod_sel() == sel_ITUnknown)) {
413 v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "undefined phylum:", id )));
414 return 0;
416 } else
417 { kc_no_default_in_with( "f_lookupdecl", __LINE__, __FILE__ );
418 return static_cast<phylumdeclaration>(0); }
421 } else
422 { kc_no_default_in_with( "f_lookupdecl", __LINE__, __FILE__ );
423 return static_cast<phylumdeclaration>(0); }
428 argsnumbers insert_in_argsnumbers(int i, argsnumbers a)
430 argsnumbers kc_selvar_0_1 = phylum_cast<argsnumbers>(a);
431 if ((kc_selvar_0_1->prod_sel() == sel_Consargsnumbers)) {
432 const integer j = (kc_selvar_0_1)->integer_1;
433 const argsnumbers ra = (kc_selvar_0_1)->argsnumbers_1;
435 if ( i < j->value )
436 return Consargsnumbers( mkinteger(i), a );
437 else if ( i == j->value )
438 return a;
439 else
440 return Consargsnumbers( j, insert_in_argsnumbers( i, ra ));
442 } else
443 if ((kc_selvar_0_1->prod_sel() == sel_Nilargsnumbers)) {
444 return Consargsnumbers( mkinteger(i), a );
445 } else
446 { kc_no_default_in_with( "insert_in_argsnumbers", __LINE__, __FILE__ );
447 return static_cast<argsnumbers>(0); }
452 void set_includefiles(includefiles ifs, includedeclaration i)
455 includefiles kc_fe_selvar_1 = ifs ;
457 while(
458 kc_fe_selvar_1->prod_sel() == sel_Consincludefiles
460 includefile kc_selvar_0_1 = kc_fe_selvar_1->includefile_1;
464 const includefile pl_includefile = kc_selvar_0_1;
466 assertCond((pl_includefile->inc_type == include_file) || (pl_includefile->inc_type == include_header));
467 pl_includefile->inc[pl_includefile->inc_type] =
468 Consincludedeclarations( i, pl_includefile->inc[pl_includefile->inc_type] );
474 kc_fe_selvar_1 = kc_fe_selvar_1->includefiles_1;
481 languagenames merge_languagenames(languagenames names, languagenames name_list)
483 languagenames res=name_list;
485 languagenames kc_fe_selvar_1 = names ;
487 while(
488 kc_fe_selvar_1->prod_sel() == sel_Conslanguagenames
490 ID kc_selvar_0_1 = kc_fe_selvar_1->ID_1;
493 if ((kc_selvar_0_1->prod_sel() == sel_Id)) {
494 const ID id = kc_selvar_0_1;
495 const uniqID u_id = phylum_cast<const impl_ID_Id*>(kc_selvar_0_1)->uniqID_1;
497 if(u_id->type->eq(ITUnknown())) {
498 res=Conslanguagenames(id,res);
499 u_id->type=ITLanguageName(
500 mkinteger(res->length()-1));
503 } else
504 {/* EMPTY */ /*skip: no matching pattern in foreach patterns*/}
508 kc_fe_selvar_1 = kc_fe_selvar_1->languagenames_1;
512 return res;
516 long get_text_nr()
518 language_text_nr_used=true;
519 return language_text_nr;
523 void inc_text_nr()
525 if(language_text_nr_used) {
526 language_text_nr++;
527 language_text_nr_used=false;
532 long last_text_nr()
534 if(language_text_nr_used)
535 return language_text_nr;
536 else
537 return language_text_nr-1;
541 ID f_ID_of_declarator(ac_declarator d)
543 ac_declarator kc_selvar_0_1 = phylum_cast<ac_declarator>(d);
544 if ((kc_selvar_0_1->prod_sel() == sel_AcDeclarator)) {
545 const ac_direct_declarator dd = phylum_cast<const impl_ac_declarator_AcDeclarator*>(kc_selvar_0_1)->ac_direct_declarator_1;
547 return f_ID_of_direct_decl( dd );
549 } else
550 { kc_no_default_in_with( "f_ID_of_declarator", __LINE__, __FILE__ );
551 return static_cast<ID>(0); }
556 ID f_ID_of_fn_declarator(ac_declarator d, fnclass fnc)
558 ac_declarator kc_selvar_0_1 = phylum_cast<ac_declarator>(d);
559 if ((kc_selvar_0_1->prod_sel() == sel_AcDeclarator)) {
560 const ac_direct_declarator dd = phylum_cast<const impl_ac_declarator_AcDeclarator*>(kc_selvar_0_1)->ac_direct_declarator_1;
562 ID id=f_ID_of_direct_decl( dd );
564 fnclass kc_selvar_1_1 = phylum_cast<fnclass>(fnc);
565 if ((kc_selvar_1_1->prod_sel() == sel_DestructorFn)) {
567 static int dtor_nr=0;
568 char buf[30];
569 sprintf(buf,"destructor_%d",++dtor_nr);
570 ID new_id=Id(Str(mkcasestring(buf)));
571 new_id->file=id->file;
572 new_id->line=id->line;
573 return new_id;
575 } else
576 if ((kc_selvar_1_1->prod_sel() == sel_ConstructorFn)) {
578 static int ctor_nr=0;
579 char buf[30];
580 sprintf(buf,"constructor_%d",++ctor_nr);
581 ID new_id=Id(Str(mkcasestring(buf)));
582 new_id->file=id->file;
583 new_id->line=id->line;
584 return new_id;
586 } else
588 return id;
592 } else
593 { kc_no_default_in_with( "f_ID_of_fn_declarator", __LINE__, __FILE__ );
594 return static_cast<ID>(0); }
599 static ID f_ID_of_direct_decl(ac_direct_declarator d)
601 ac_direct_declarator kc_selvar_0_1 = phylum_cast<ac_direct_declarator>(d);
602 if ((kc_selvar_0_1->prod_sel() == sel_AcQualifiedDeclProto)) {
603 const ac_direct_declarator a_d = phylum_cast<const impl_ac_direct_declarator_AcQualifiedDeclProto*>(kc_selvar_0_1)->ac_direct_declarator_1;
604 return f_ID_of_direct_decl( a_d );
605 } else
606 if ((kc_selvar_0_1->prod_sel() == sel_AcDirectDeclProto)) {
607 const ac_direct_declarator a_d = phylum_cast<const impl_ac_direct_declarator_AcDirectDeclProto*>(kc_selvar_0_1)->ac_direct_declarator_1;
608 return f_ID_of_direct_decl( a_d );
609 } else
610 if ((kc_selvar_0_1->prod_sel() == sel_AcDirectDeclArray)) {
611 const ac_direct_declarator a_d = phylum_cast<const impl_ac_direct_declarator_AcDirectDeclArray*>(kc_selvar_0_1)->ac_direct_declarator_1;
612 return f_ID_of_direct_decl( a_d );
613 } else
614 if ((kc_selvar_0_1->prod_sel() == sel_AcDirectDeclPack)) {
615 const ac_declarator a_d = phylum_cast<const impl_ac_direct_declarator_AcDirectDeclPack*>(kc_selvar_0_1)->ac_declarator_1;
616 return f_ID_of_declarator( a_d );
617 } else
618 if ((kc_selvar_0_1->prod_sel() == sel_AcDirectDeclId)) {
619 const ID i = phylum_cast<const impl_ac_direct_declarator_AcDirectDeclId*>(kc_selvar_0_1)->ID_1;
620 return i;
621 } else
623 return f_emptyId();
629 int f_stars_of_declarator(ac_declarator d)
631 ac_declarator kc_selvar_0_1 = phylum_cast<ac_declarator>(d);
632 if ((kc_selvar_0_1->prod_sel() == sel_AcDeclarator)) {
633 const ac_pointer_option po = phylum_cast<const impl_ac_declarator_AcDeclarator*>(kc_selvar_0_1)->ac_pointer_option_1;
634 return f_stars_of_ac_pointer_option( po );
635 } else
637 return 0;
643 static int f_stars_of_ac_pointer_option(ac_pointer_option d)
645 ac_pointer_option kc_selvar_0_1 = phylum_cast<ac_pointer_option>(d);
646 if ((kc_selvar_0_1->prod_sel() == sel_Yespointer)) {
647 const ac_pointer p = phylum_cast<const impl_ac_pointer_option_Yespointer*>(kc_selvar_0_1)->ac_pointer_1;
648 return f_stars_of_ac_pointer( p );
649 } else
651 return 0;
657 static int f_stars_of_ac_pointer(ac_pointer d)
659 ac_pointer kc_selvar_0_1 = phylum_cast<ac_pointer>(d);
660 if ((kc_selvar_0_1->prod_sel() == sel_AcPointerCons)) {
661 const ac_pointer p = phylum_cast<const impl_ac_pointer_AcPointerCons*>(kc_selvar_0_1)->ac_pointer_1;
662 return 1 + f_stars_of_ac_pointer( p );
663 } else
665 return 1;
671 static bool f_is_member_fn(ac_declarator dec)
673 ac_declarator kc_selvar_0_1 = phylum_cast<ac_declarator>(dec);
674 if ((kc_selvar_0_1->prod_sel() == sel_AcDeclarator) && (phylum_cast<const impl_ac_declarator_AcDeclarator*>(kc_selvar_0_1)->ac_direct_declarator_1->prod_sel() == sel_AcQualifiedDeclProto) && (phylum_cast<const impl_ac_direct_declarator_AcQualifiedDeclProto*>(phylum_cast<const impl_ac_declarator_AcDeclarator*>(kc_selvar_0_1)->ac_direct_declarator_1)->ac_class_qualifier_list_1->prod_sel() == sel_Consac_class_qualifier_list)) {
675 return true;
676 } else
678 return false;
684 fnclass f_fnclass_info(ac_declaration_specifiers ds, casestring fn, ac_declarator dec)
686 ac_declaration_specifiers kc_selvar_0_1 = phylum_cast<ac_declaration_specifiers>(ds);
687 if ((kc_selvar_0_1->prod_sel() == sel_Consac_declaration_specifiers)) {
688 const ac_declaration_specifier h = (kc_selvar_0_1)->ac_declaration_specifier_1;
689 const ac_declaration_specifiers t = (kc_selvar_0_1)->ac_declaration_specifiers_1;
691 if (f_static_in_ac_decl_spec( h )) {
692 return StaticFn( fn );
693 } else {
694 return f_is_member_fn(dec)?MemberFn():f_fnclass_info( t, fn , dec);
697 } else
698 if ((kc_selvar_0_1->prod_sel() == sel_Nilac_declaration_specifiers)) {
700 assertCond(!f_is_member_fn(dec));
701 return
703 GlobalFn();
704 } else
705 { kc_no_default_in_with( "f_fnclass_info", __LINE__, __FILE__ );
706 return static_cast<fnclass>(0); }
711 fnclass f_member_class_info(ac_declaration_specifiers ds, casestring fn)
713 ac_declaration_specifiers kc_selvar_0_1 = phylum_cast<ac_declaration_specifiers>(ds);
714 if ((kc_selvar_0_1->prod_sel() == sel_Consac_declaration_specifiers)) {
715 const ac_declaration_specifier h = (kc_selvar_0_1)->ac_declaration_specifier_1;
716 const ac_declaration_specifiers t = (kc_selvar_0_1)->ac_declaration_specifiers_1;
718 if (f_static_in_ac_decl_spec( h )) {
719 return StaticFn( fn );
720 } else {
721 return f_member_class_info( t, fn);
724 } else
725 if ((kc_selvar_0_1->prod_sel() == sel_Nilac_declaration_specifiers)) {
726 return MemberFn();
727 } else
728 { kc_no_default_in_with( "f_member_class_info", __LINE__, __FILE__ );
729 return static_cast<fnclass>(0); }
734 bool f_static_in_ac_decl_specs(ac_declaration_specifiers ds)
736 ac_declaration_specifiers kc_selvar_0_1 = phylum_cast<ac_declaration_specifiers>(ds);
737 if ((kc_selvar_0_1->prod_sel() == sel_Nilac_declaration_specifiers)) {
738 return false;
739 } else
740 if ((kc_selvar_0_1->prod_sel() == sel_Consac_declaration_specifiers)) {
741 const ac_declaration_specifier head = (kc_selvar_0_1)->ac_declaration_specifier_1;
742 const ac_declaration_specifiers tail = (kc_selvar_0_1)->ac_declaration_specifiers_1;
744 return f_static_in_ac_decl_spec(head) || f_static_in_ac_decl_specs(tail);
746 } else
747 { kc_no_default_in_with( "f_static_in_ac_decl_specs", __LINE__, __FILE__ );
748 return static_cast<bool>(0); }
753 static bool f_static_in_ac_decl_spec(ac_declaration_specifier ds)
755 ac_declaration_specifier kc_selvar_0_1 = phylum_cast<ac_declaration_specifier>(ds);
756 if ((kc_selvar_0_1->prod_sel() == sel_AcDeclSpecTypeQual)) {
757 return false;
758 } else
759 if ((kc_selvar_0_1->prod_sel() == sel_AcDeclSpecTypeSpec)) {
760 return false;
761 } else
762 if ((kc_selvar_0_1->prod_sel() == sel_AcDeclSpecStorageSpec)) {
763 const ac_storage_class_specifier a_sc = phylum_cast<const impl_ac_declaration_specifier_AcDeclSpecStorageSpec*>(kc_selvar_0_1)->ac_storage_class_specifier_1;
764 return f_static_in_ac_stor_class( a_sc );
765 } else
766 { kc_no_default_in_with( "f_static_in_ac_decl_spec", __LINE__, __FILE__ );
767 return static_cast<bool>(0); }
772 static bool f_static_in_ac_stor_class(ac_storage_class_specifier sc)
774 ac_storage_class_specifier kc_selvar_0_1 = phylum_cast<ac_storage_class_specifier>(sc);
775 if ((kc_selvar_0_1->prod_sel() == sel_AcTypedef)) {
776 return false;
777 } else
778 if ((kc_selvar_0_1->prod_sel() == sel_AcExtern)) {
779 return false;
780 } else
781 if ((kc_selvar_0_1->prod_sel() == sel_AcStatic)) {
782 return true;
783 } else
784 if ((kc_selvar_0_1->prod_sel() == sel_AcRegister)) {
785 return false;
786 } else
787 if ((kc_selvar_0_1->prod_sel() == sel_AcAuto)) {
788 return false;
789 } else
790 { kc_no_default_in_with( "f_static_in_ac_stor_class", __LINE__, __FILE__ );
791 return static_cast<bool>(0); }
796 ID f_ID_of_ac_declaration_specifiers(ac_declaration_specifiers d)
798 ac_declaration_specifiers kc_selvar_0_1 = phylum_cast<ac_declaration_specifiers>(d);
799 if ((kc_selvar_0_1->prod_sel() == sel_Consac_declaration_specifiers)) {
800 const ac_declaration_specifier h = (kc_selvar_0_1)->ac_declaration_specifier_1;
801 const ac_declaration_specifiers t = (kc_selvar_0_1)->ac_declaration_specifiers_1;
803 ID tmp = f_ID_of_ac_declaration_specifier( h );
804 if (tmp)
805 return tmp;
806 else
807 return f_ID_of_ac_declaration_specifiers( t );
809 } else
810 if ((kc_selvar_0_1->prod_sel() == sel_Nilac_declaration_specifiers)) {
811 return 0;
812 } else
813 { kc_no_default_in_with( "f_ID_of_ac_declaration_specifiers", __LINE__, __FILE__ );
814 return static_cast<ID>(0); }
819 static ID f_ID_of_ac_declaration_specifier(ac_declaration_specifier d)
821 ac_declaration_specifier kc_selvar_0_1 = phylum_cast<ac_declaration_specifier>(d);
822 if ((kc_selvar_0_1->prod_sel() == sel_AcDeclSpecTypeSpec)) {
823 const ac_type_specifier t = phylum_cast<const impl_ac_declaration_specifier_AcDeclSpecTypeSpec*>(kc_selvar_0_1)->ac_type_specifier_1;
825 return f_ID_of_ac_type_specifier( t );
827 } else
828 if ((kc_selvar_0_1->prod_sel() == sel_AcDeclSpecTypeQual)) {
829 return 0;
830 } else
831 if ((kc_selvar_0_1->prod_sel() == sel_AcDeclSpecStorageSpec)) {
832 return 0;
833 } else
834 { kc_no_default_in_with( "f_ID_of_ac_declaration_specifier", __LINE__, __FILE__ );
835 return static_cast<ID>(0); }
840 static ID f_ID_of_ac_type_specifier(ac_type_specifier d)
842 ac_type_specifier kc_selvar_0_1 = phylum_cast<ac_type_specifier>(d);
843 if ((kc_selvar_0_1->prod_sel() == sel_AcTypeSpec)) {
844 const ID i = phylum_cast<const impl_ac_type_specifier_AcTypeSpec*>(kc_selvar_0_1)->ID_1;
845 return i;
846 } else
847 { kc_no_default_in_with( "f_ID_of_ac_type_specifier", __LINE__, __FILE__ );
848 return static_cast<ID>(0); }
853 void check_no_patternchaingroup_in_patternchain(casestring f, int l, patternchain a_patternchain, const char *ctxt)
855 patternchain kc_selvar_0_1 = phylum_cast<patternchain>(a_patternchain);
856 if ((kc_selvar_0_1->prod_sel() == sel_Nilpatternchain)) {
857 /*EMPTY*/
858 } else
859 if ((kc_selvar_0_1->prod_sel() == sel_Conspatternchain)) {
860 const patternchainitem h = (kc_selvar_0_1)->patternchainitem_1;
861 const patternchain t = (kc_selvar_0_1)->patternchain_1;
863 check_no_patternchaingroup_in_patternchain( f, l, t, ctxt );
865 patternchainitem kc_selvar_1_1 = phylum_cast<patternchainitem>( h );
866 if ((kc_selvar_1_1->prod_sel() == sel_PatternchainitemGroup)) {
868 v_report(NonFatal( FileLine( f, l ), Problem3S( "no pattern grouping () allowed in", ctxt, "context." )));
870 } else
871 if ((kc_selvar_1_1->prod_sel() == sel_PatternchainitemDollarid)) {
872 /*EMPTY*/
873 } else
874 if ((kc_selvar_1_1->prod_sel() == sel_PatternchainitemOutmost)) {
875 /*EMPTY*/
876 } else
877 kc_no_default_in_with( "check_no_patternchaingroup_in_patternchain", __LINE__, __FILE__ );
880 } else
881 kc_no_default_in_with( "check_no_patternchaingroup_in_patternchain", __LINE__, __FILE__ );
886 void check_no_patternchaingroup_in_patternchains(casestring f, int l, patternchains a_patternchains, const char *ctxt)
888 patternchains kc_selvar_0_1 = phylum_cast<patternchains>(a_patternchains);
889 if ((kc_selvar_0_1->prod_sel() == sel_Nilpatternchains)) {
890 /*EMPTY*/
891 } else
892 if ((kc_selvar_0_1->prod_sel() == sel_Conspatternchains)) {
893 const patternchain h = (kc_selvar_0_1)->patternchain_1;
894 const patternchains t = (kc_selvar_0_1)->patternchains_1;
896 check_no_patternchaingroup_in_patternchains( f, l, t, ctxt );
897 check_no_patternchaingroup_in_patternchain( f, l, h, ctxt );
899 } else
900 kc_no_default_in_with( "check_no_patternchaingroup_in_patternchains", __LINE__, __FILE__ );
905 void check_no_patternchaingroup_or_pattern_in_patternchain(casestring f, int l, patternchain a_patternchain, const char *ctxt)
907 patternchain kc_selvar_0_1 = phylum_cast<patternchain>(a_patternchain);
908 if ((kc_selvar_0_1->prod_sel() == sel_Nilpatternchain)) {
909 /*EMPTY*/
910 } else
911 if ((kc_selvar_0_1->prod_sel() == sel_Conspatternchain)) {
912 const patternchainitem h = (kc_selvar_0_1)->patternchainitem_1;
913 const patternchain t = (kc_selvar_0_1)->patternchain_1;
915 check_no_patternchaingroup_or_pattern_in_patternchain( f, l, t, ctxt );
917 patternchainitem kc_selvar_1_1 = phylum_cast<patternchainitem>( h );
918 if ((kc_selvar_1_1->prod_sel() == sel_PatternchainitemGroup)) {
920 v_report(NonFatal( FileLine( f, l ), Problem3S( "no pattern grouping () allowed in", ctxt, "context." )));
922 } else
923 if ((kc_selvar_1_1->prod_sel() == sel_PatternchainitemDollarid)) {
924 /*EMPTY*/
925 } else
926 if ((kc_selvar_1_1->prod_sel() == sel_PatternchainitemOutmost)) {
927 const outmostpattern op = phylum_cast<const impl_patternchainitem_PatternchainitemOutmost*>(kc_selvar_1_1)->outmostpattern_1;
931 } else
932 kc_no_default_in_with( "check_no_patternchaingroup_or_pattern_in_patternchain", __LINE__, __FILE__ );
935 } else
936 kc_no_default_in_with( "check_no_patternchaingroup_or_pattern_in_patternchain", __LINE__, __FILE__ );
941 void check_no_patternchaingroup_or_pattern_in_patternchains(casestring f, int l, patternchains a_patternchains, const char *ctxt)
943 patternchains kc_selvar_0_1 = phylum_cast<patternchains>(a_patternchains);
944 if ((kc_selvar_0_1->prod_sel() == sel_Nilpatternchains)) {
945 /*EMPTY*/
946 } else
947 if ((kc_selvar_0_1->prod_sel() == sel_Conspatternchains)) {
948 const patternchain h = (kc_selvar_0_1)->patternchain_1;
949 const patternchains t = (kc_selvar_0_1)->patternchains_1;
951 check_no_patternchaingroup_or_pattern_in_patternchains( f, l, t, ctxt );
952 check_no_patternchaingroup_or_pattern_in_patternchain( f, l, h, ctxt );
954 } else
955 kc_no_default_in_with( "check_no_patternchaingroup_or_pattern_in_patternchains", __LINE__, __FILE__ );
960 patternchains syn_patternchains_fileline(patternchains a_patternchains, casestring a_file, int a_line)
962 patternchains kc_selvar_0_1 = phylum_cast<patternchains>(a_patternchains);
963 if ((kc_selvar_0_1->prod_sel() == sel_Nilpatternchains)) {
965 kc_selvar_0_1->file = a_file;
966 kc_selvar_0_1->line = a_line;
967 return a_patternchains;
969 } else
970 if ((kc_selvar_0_1->prod_sel() == sel_Conspatternchains)) {
971 const patternchain h = (kc_selvar_0_1)->patternchain_1;
972 const patternchains t = (kc_selvar_0_1)->patternchains_1;
974 syn_patternchains_fileline( t, a_file, a_line );
975 syn_patternchain_fileline( h, t->file, t->line );
976 kc_selvar_0_1->file = h->file;
977 kc_selvar_0_1->line = h->line;
978 return a_patternchains;
980 } else
981 { kc_no_default_in_with( "syn_patternchains_fileline", __LINE__, __FILE__ );
982 return static_cast<patternchains>(0); }
987 patternchain syn_patternchain_fileline(patternchain a_patternchain, casestring a_file, int a_line)
989 patternchain kc_selvar_0_1 = phylum_cast<patternchain>(a_patternchain);
990 if ((kc_selvar_0_1->prod_sel() == sel_Nilpatternchain)) {
992 kc_selvar_0_1->file = a_file;
993 kc_selvar_0_1->line = a_line;
994 return a_patternchain;
996 } else
997 if ((kc_selvar_0_1->prod_sel() == sel_Conspatternchain)) {
998 const patternchainitem h = (kc_selvar_0_1)->patternchainitem_1;
999 const patternchain t = (kc_selvar_0_1)->patternchain_1;
1001 syn_patternchain_fileline( t, a_file, a_line );
1002 kc_selvar_0_1->file = h->file;
1003 kc_selvar_0_1->line = h->line;
1004 return a_patternchain;
1006 } else
1007 { kc_no_default_in_with( "syn_patternchain_fileline", __LINE__, __FILE__ );
1008 return static_cast<patternchain>(0); }
1013 withexpressions pf_gen_foreachwith_vars(idCexpressions a_idCexpressions)
1015 static int nrof_foreach_occ = 0;
1016 nrof_foreach_occ++;
1017 return t_pf_gen_foreachwith_vars(a_idCexpressions, nrof_foreach_occ, a_idCexpressions->length(), false);
1021 withexpressions pf_gen_foreachwith_listvars(idCexpressions a_idCexpressions)
1023 static int nrof_foreach_occ = 0;
1024 nrof_foreach_occ++;
1025 return t_pf_gen_foreachwith_vars(a_idCexpressions, nrof_foreach_occ, a_idCexpressions->length(), true);
1029 withexpressions t_pf_gen_foreachwith_vars(idCexpressions a_idCexpressions, int occ, int nr, bool listvars)
1031 idCexpressions kc_selvar_0_1 = phylum_cast<idCexpressions>(a_idCexpressions);
1032 if ((kc_selvar_0_1->prod_sel() == sel_ConsidCexpressions) && ((kc_selvar_0_1)->idCexpression_1->prod_sel() == sel_IdCexpression)) {
1033 const idCexpression ice = (kc_selvar_0_1)->idCexpression_1;
1034 const ID id = phylum_cast<const impl_idCexpression_IdCexpression*>((kc_selvar_0_1)->idCexpression_1)->ID_1;
1035 const Cexpression ce = phylum_cast<const impl_idCexpression_IdCexpression*>((kc_selvar_0_1)->idCexpression_1)->Cexpression_1;
1036 const idCexpressions t = (kc_selvar_0_1)->idCexpressions_1;
1038 char tmp[BUFSIZ];
1039 withexpression w;
1040 withexpressions ws;
1041 ID w_id;
1042 if (listvars)
1043 sprintf(tmp, "kc_fe_withlistvar_%d_%d", occ, nr);
1044 else
1045 sprintf(tmp, "kc_fe_withvar_%d_%d", occ, nr);
1046 w_id = Id(Str(mkcasestring(tmp)));
1047 w = WEVariable(w_id);
1048 w->type = (listvars ? id : f_listelementphylum(id));
1049 w->file = ce->file;
1050 w->line = ce->line;
1051 ice->id = w_id;
1052 ws = Conswithexpressions(
1054 t_pf_gen_foreachwith_vars( t, occ, nr-1, listvars));
1055 ws->file = w->file;
1056 ws->line = w->line;
1057 return ws;
1059 } else
1060 if ((kc_selvar_0_1->prod_sel() == sel_NilidCexpressions)) {
1061 return Nilwithexpressions();
1062 } else
1063 { kc_no_default_in_with( "t_pf_gen_foreachwith_vars", __LINE__, __FILE__ );
1064 return static_cast<withexpressions>(0); }
1069 ac_class_qualifier_list f_check_build_qualifier_tail(ac_class_qualifier_help_list qh_list)
1071 ac_class_qualifier_help_list kc_selvar_0_1 = phylum_cast<ac_class_qualifier_help_list>(qh_list);
1072 if ((kc_selvar_0_1->prod_sel() == sel_Consac_class_qualifier_help_list) && ((kc_selvar_0_1)->ac_direct_declarator_1->prod_sel() == sel_AcOperatorDeclId) && (phylum_cast<const impl_ac_direct_declarator_AcOperatorDeclId*>((kc_selvar_0_1)->ac_direct_declarator_1)->ac_operator_name_1->prod_sel() == sel_AcOperatorName)) {
1073 const ac_operator_name op = phylum_cast<const impl_ac_direct_declarator_AcOperatorDeclId*>((kc_selvar_0_1)->ac_direct_declarator_1)->ac_operator_name_1;
1074 const casestring str = phylum_cast<const impl_ac_operator_name_AcOperatorName*>(phylum_cast<const impl_ac_direct_declarator_AcOperatorDeclId*>((kc_selvar_0_1)->ac_direct_declarator_1)->ac_operator_name_1)->casestring_1;
1076 v_report(NonFatal( FileLine( op->file, op->line ), Problem3S( "operator ",str->name, "is not a type name" )));
1077 return Nilac_class_qualifier_list();
1079 } else
1080 if ((kc_selvar_0_1->prod_sel() == sel_Consac_class_qualifier_help_list) && ((kc_selvar_0_1)->ac_direct_declarator_1->prod_sel() == sel_AcDirectDeclId)) {
1081 const ID id = phylum_cast<const impl_ac_direct_declarator_AcDirectDeclId*>((kc_selvar_0_1)->ac_direct_declarator_1)->ID_1;
1082 const ac_class_qualifier_help_list tail = (kc_selvar_0_1)->ac_class_qualifier_help_list_1;
1084 return Consac_class_qualifier_list(id,f_check_build_qualifier_tail(tail));
1086 } else
1087 if ((kc_selvar_0_1->prod_sel() == sel_Nilac_class_qualifier_help_list)) {
1088 return Nilac_class_qualifier_list();
1089 } else
1090 { kc_no_default_in_with( "f_check_build_qualifier_tail", __LINE__, __FILE__ );
1091 return static_cast<ac_class_qualifier_list>(0); }
1096 ac_class_qualifier_list f_check_build_qualifier(ac_class_qualifier_help_list qh_list, ac_direct_declarator &decl)
1098 ac_class_qualifier_help_list kc_selvar_0_1 = phylum_cast<ac_class_qualifier_help_list>(qh_list);
1099 if ((kc_selvar_0_1->prod_sel() == sel_Consac_class_qualifier_help_list)) {
1100 const ac_direct_declarator dd = (kc_selvar_0_1)->ac_direct_declarator_1;
1101 const ac_class_qualifier_help_list tail = (kc_selvar_0_1)->ac_class_qualifier_help_list_1;
1103 decl=dd;
1104 return f_check_build_qualifier_tail(tail);
1106 } else
1108 assertCond(false); return NULL;
1114 ID subst_name(ID n, casestring oldname, casestring newname)
1116 ID kc_selvar_0_1 = phylum_cast<ID>(n);
1117 if ((kc_selvar_0_1->prod_sel() == sel_Id) && (phylum_cast<const impl_ID_Id*>(kc_selvar_0_1)->uniqID_1->prod_sel() == sel_Str)) {
1118 const casestring s = phylum_cast<const impl_uniqID_Str*>(phylum_cast<const impl_ID_Id*>(kc_selvar_0_1)->uniqID_1)->casestring_1;
1120 if (s->eq(oldname)) {
1121 ID tmp = Id(Str(newname));
1122 tmp->file = n->file;
1123 tmp->line = n->line;
1124 return tmp;
1125 } else
1126 return n;
1128 } else
1129 { kc_no_default_in_with( "subst_name", __LINE__, __FILE__ );
1130 return static_cast<ID>(0); }
1136 } // namespace kc