/* translation of file "../gutil.k" */
/* generated by:
 *	@(#)$Author: Kimwitu version: V4_6 (c) 1990-1996 University of Twente $
 */
#define KC_FUNCTIONS_gutil
#define KIMW_FUNCTIONS_gutil /* for backwards compatibility */
/* define our own macro if we have a 'standard' (ansi) C(++) compiler */
#ifndef KC_NO_STDC
# if defined(__STDC__) || defined(__cplusplus) || defined(_WIN32)
#  define KC_STDC
# endif
#endif
#include <stdio.h>
#ifdef KC_STDC
# include <stdlib.h>
#endif
#include "k.h"
/* included stuff */
#line 2 "../gutil.k"
/*
 * The Termprocessor Kimwitu
 *
 * Copyright (c) 1991 University of Twente, Dept TIOS.
 * All rights reserved.
 *
 */

#line 29 "gutil.c"
#line 14 "../gutil.k"
#if ! (defined(lint) || defined(SABER) || defined(CODECENTER))
  static char gutil_kAccesSid[] = "@(#)$Id: gutil.k,v 1.29 1998/01/29 10:57:34 belinfan Rel $";
#endif

#line 35 "gutil.c"
#line 90 "../gutil.k"
/* string(s) stuff */
#include <string.h>
#if (! defined(KC_STDC) ) && defined(sun)
   extern char *sprintf();
#endif

#line 43 "gutil.c"
#line 157 "../gutil.k"
#include "util.h"

#line 47 "gutil.c"
#line 277 "../gutil.k"
#include "parse.h"

#line 51 "gutil.c"
#line 365 "../gutil.k"
#include "unpk.h"
#ifndef MALLOC
#  define MALLOC emalloc
#endif
#ifndef REALLOC
/*
 * # ifdef lint
 * #  define REALLOC(kc_p,kc_s) (kc_p,kc_s,0)
 * # else
 */
#  define REALLOC erealloc
/*
 * # endif
 */
#endif
#ifndef FREE
#  define FREE efree
#endif
#ifndef efree
/*
 * # ifdef lint
 * #  define efree(kc_p) 
 * # else
 */
#  define efree(kc_p) free((kc_malloc_t)(kc_p))
/*
 * # endif
 */
#endif

#line 83 "gutil.c"
#line 464 "../gutil.k"
#define QUOTEDBACKSLASH '\\'

#line 87 "gutil.c"
#line 502 "../gutil.k"
#define MKSELVARMAXINTREPR 30

#line 91 "gutil.c"
#line 602 "../gutil.k"
#include <ctype.h>

#line 95 "gutil.c"
#line 634 "../gutil.k"
static ID global_filterview; /* to be used by filteronview */

#line 99 "gutil.c"
#line 908 "../gutil.k"
#include "rk.h"		/* for the rewrite_withcasesinfo call below */

#line 103 "gutil.c"
/* end included stuff */

#include "gutil.h"
static boolean f_attributes_to_initialize KC__P((attributes attr)); 
static Cvariabledeclaration lookup_and_createCvariabledeclaration KC__P((ID a_fnarg, Cvariabledeclarations C_vardecls)); 
static ac_parameter_declaration lookup_and_create_ac_parameter_declaration KC__P((ID a_fnarg, ac_declaration_list C_vardecls)); 
static void check_ac_parameter_declaration KC__P((ac_declaration_list C_vardecls, ac_identifier_list fn_args)); 
static boolean filterrewriteruleinfoonview KC__P((rewriteruleinfo a_rewriteruleinfo)); 
static boolean filterunparsedeclinfoonview KC__P((unparsedeclinfo a_unparsedeclinfo)); 
static boolean is_viewname_in_rewriteruleinfo KC__P((ID a_view, rewriteruleinfo a_rewriteruleinfo)); 
static boolean is_viewname_in_unparsedeclinfo KC__P((ID a_view, unparsedeclinfo a_unparsedeclinfo)); 
static boolean is_viewname_in_viewnames KC__P((ID a_view, viewnames a_viewnames)); 
static rewriterulesinfo f_rewriterulesinfoofalternatives KC__P((alternatives a_alternatives)); 
static unparsedeclsinfo f_unparsedeclsinfoofalternatives KC__P((alternatives a_alternatives)); 
static ID f_operatorofelem_patternrepresentation KC__P((elem_patternrepresentation a_elem_patternrepresentation)); 
static ID f_operatorofpaths KC__P((paths a_paths)); 
static ID f_operatorofpath KC__P((path a_path)); 
static boolean f_outmost_nl_preds_in_patternrepresentation KC__P((patternrepresentation p)); 
static boolean f_outmost_nl_preds_in_elem_patternrepresentation KC__P((elem_patternrepresentation e_p)); 
static boolean f_outmost_nl_preds_in_paths KC__P((paths p)); 
boolean f_something_to_initialize
#ifdef KC_USE_PROTOTYPES
(Ccode_option cco)
#else
(cco) Ccode_option cco;
#endif
#line 100 "../gutil.k"
{
    {
#line 101 "../gutil.k"
Ccode_option kc_selvar_0_1 = 
 cco 
;
#line 101 "../gutil.k"
/*SUPPRESS 622*/
assert_Ccode_option(kc_selvar_0_1, "with_expression (1)");

#line 141 "gutil.c"
		if (( kc_selvar_0_1->prod_sel == sel_CcodeOption)) {
#line 102 "../gutil.k"
		attributes attr =  kc_selvar_0_1->u.CcodeOption.attributes_1;
#line 102 "../gutil.k"
		Ctexts ct =  kc_selvar_0_1->u.CcodeOption.Ctexts_1;
#line 102 "../gutil.k"

	    return (boolean)(f_attributes_to_initialize( attr ) || (! f_NilCtexts( ct )));

#line 151 "gutil.c"
		} else
{ kc_no_default_in_with( "f_something_to_initialize", __LINE__, __FILE__ );
   return (boolean)0; }
}
#line 104 "../gutil.k"
   
#line 104 "../gutil.k"
}
#line 160 "gutil.c"

boolean f_NilCtexts
#ifdef KC_USE_PROTOTYPES
(Ctexts c)
#else
(c) Ctexts c;
#endif
#line 107 "../gutil.k"
{
    {
#line 108 "../gutil.k"
Ctexts kc_selvar_0_1 = 
 c 
;
#line 108 "../gutil.k"
/*SUPPRESS 622*/
assert_Ctexts(kc_selvar_0_1, "with_expression (1)");

#line 179 "gutil.c"
		if (( kc_selvar_0_1->prod_sel == sel_ConsCtexts)) {
#line 110 "../gutil.k"
 return False; 
#line 183 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_NilCtexts)) {
#line 109 "../gutil.k"
 return True; 
#line 188 "gutil.c"
		} else
{ kc_no_default_in_with( "f_NilCtexts", __LINE__, __FILE__ );
   return (boolean)0; }
}
#line 111 "../gutil.k"
   
#line 111 "../gutil.k"
}
#line 197 "gutil.c"

static boolean f_attributes_to_initialize
#ifdef KC_USE_PROTOTYPES
(attributes attr)
#else
(attr) attributes attr;
#endif
#line 116 "../gutil.k"
{
    {
#line 117 "../gutil.k"
attributes kc_fe_selvar_1 =  attr ;
#line 117 "../gutil.k"
/*SUPPRESS 622*/
assert_attributes(kc_fe_selvar_1, "foreach_list_expression");

#line 214 "gutil.c"
while(
	kc_fe_selvar_1->prod_sel == sel_Consattributes
	) {
attribute kc_selvar_0_1 = kc_fe_selvar_1->u.Consattributes.attribute_1;
{
#line 117 "../gutil.k"
{
#line 117 "../gutil.k"
/*SUPPRESS 622*/
assert_attribute(kc_selvar_0_1, "with_expression (1)");

#line 226 "gutil.c"
{
#line 117 "../gutil.k"
		attribute a =  kc_selvar_0_1;
#line 117 "../gutil.k"

	{
#line 118 "../gutil.k"
attribute kc_selvar_1_1 = 
 a 
;
#line 118 "../gutil.k"
/*SUPPRESS 622*/
assert_attribute(kc_selvar_1_1, "with_expression (1)");

#line 241 "gutil.c"
		if (( kc_selvar_1_1->prod_sel == sel_Attribute) && ( kc_selvar_1_1->u.Attribute.attribute_initialisation_option_1->prod_sel == sel_Yesattribute_initialisation)) {
#line 120 "../gutil.k"

		return True;
	    
#line 247 "gutil.c"
		} else
		if (( kc_selvar_1_1->prod_sel == sel_Attribute) && ( kc_selvar_1_1->u.Attribute.attribute_initialisation_option_1->prod_sel == sel_Noattribute_initialisation)) {
#line 119 "../gutil.k"
/*EMPTY*/
#line 252 "gutil.c"
		} else
{ kc_no_default_in_with( "f_attributes_to_initialize", __LINE__, __FILE__ );
   return (boolean)0; }
}
#line 124 "../gutil.k"
    
#line 259 "gutil.c"
}
}

#line 263 "gutil.c"
}
kc_fe_selvar_1 = kc_fe_selvar_1->u.Consattributes.attributes_1;
#line 117 "../gutil.k"
/*SUPPRESS 622*/
assert_attributes(kc_fe_selvar_1, "sublist_of_foreach_list_expression");

#line 270 "gutil.c"
}
}
#line 125 "../gutil.k"
    return False;

#line 126 "../gutil.k"
}
#line 278 "gutil.c"

boolean f_no_attrs_in_Ccode_option
#ifdef KC_USE_PROTOTYPES
(Ccode_option cco)
#else
(cco) Ccode_option cco;
#endif
#line 129 "../gutil.k"
{
    {
#line 130 "../gutil.k"
Ccode_option kc_selvar_0_1 = 
 cco 
;
#line 130 "../gutil.k"
/*SUPPRESS 622*/
assert_Ccode_option(kc_selvar_0_1, "with_expression (1)");

#line 297 "gutil.c"
		if (( kc_selvar_0_1->prod_sel == sel_CcodeOption) && ( kc_selvar_0_1->u.CcodeOption.attributes_1->prod_sel == sel_Consattributes)) {
#line 132 "../gutil.k"
 return False; 
#line 301 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_CcodeOption) && ( kc_selvar_0_1->u.CcodeOption.attributes_1->prod_sel == sel_Nilattributes)) {
#line 131 "../gutil.k"
 return True; 
#line 306 "gutil.c"
		} else
{ kc_no_default_in_with( "f_no_attrs_in_Ccode_option", __LINE__, __FILE__ );
   return (boolean)0; }
}
#line 133 "../gutil.k"
   
#line 133 "../gutil.k"
}
#line 315 "gutil.c"

boolean f_all_alternatives_nullary
#ifdef KC_USE_PROTOTYPES
(alternatives a)
#else
(a) alternatives a;
#endif
#line 144 "../gutil.k"
{
    {
#line 145 "../gutil.k"
alternatives kc_fe_selvar_1 =  a ;
#line 145 "../gutil.k"
/*SUPPRESS 622*/
assert_alternatives(kc_fe_selvar_1, "foreach_list_expression");

#line 332 "gutil.c"
while(
	kc_fe_selvar_1->prod_sel == sel_Consalternatives
	) {
alternative kc_selvar_0_1 = kc_fe_selvar_1->u.Consalternatives.alternative_1;
{
#line 145 "../gutil.k"
{
#line 145 "../gutil.k"
/*SUPPRESS 622*/
assert_alternative(kc_selvar_0_1, "with_expression (1)");

#line 344 "gutil.c"
{
#line 145 "../gutil.k"
		alternative alt =  kc_selvar_0_1;
#line 145 "../gutil.k"

	{
#line 146 "../gutil.k"
alternative kc_selvar_1_1 = 
 alt 
;
#line 146 "../gutil.k"
/*SUPPRESS 622*/
assert_alternative(kc_selvar_1_1, "with_expression (1)");

#line 359 "gutil.c"
		if (( kc_selvar_1_1->prod_sel == sel_Alternative) && ( kc_selvar_1_1->u.Alternative.arguments_1->prod_sel == sel_Nilarguments)) {
#line 148 "../gutil.k"
/*EMPTY*/
#line 363 "gutil.c"
		} else
		if (( kc_selvar_1_1->prod_sel == sel_Alternative) && ( kc_selvar_1_1->u.Alternative.arguments_1->prod_sel == sel_Consarguments)) {
#line 147 "../gutil.k"
 return False; 
#line 368 "gutil.c"
		} else
{ kc_no_default_in_with( "f_all_alternatives_nullary", __LINE__, __FILE__ );
   return (boolean)0; }
}
#line 150 "../gutil.k"
    
#line 375 "gutil.c"
}
}

#line 379 "gutil.c"
}
kc_fe_selvar_1 = kc_fe_selvar_1->u.Consalternatives.alternatives_1;
#line 145 "../gutil.k"
/*SUPPRESS 622*/
assert_alternatives(kc_fe_selvar_1, "sublist_of_foreach_list_expression");

#line 386 "gutil.c"
}
}
#line 151 "../gutil.k"
    return True;

#line 152 "../gutil.k"
}
#line 394 "gutil.c"

ID f_phylumofwithcasesinfo
#ifdef KC_USE_PROTOTYPES
(withcasesinfo wcso)
#else
(wcso) withcasesinfo wcso;
#endif
#line 161 "../gutil.k"
{
    ID id;
    {
#line 163 "../gutil.k"
withcasesinfo kc_selvar_0_1 = 
 wcso 
;
#line 163 "../gutil.k"
/*SUPPRESS 622*/
assert_withcasesinfo(kc_selvar_0_1, "with_expression (1)");

#line 414 "gutil.c"
		if (( kc_selvar_0_1->prod_sel == sel_Conswithcasesinfo)) {
#line 168 "../gutil.k"
		withcaseinfo wco =  kc_selvar_0_1->u.Conswithcasesinfo.withcaseinfo_1;
#line 168 "../gutil.k"
		withcasesinfo r_wcso =  kc_selvar_0_1->u.Conswithcasesinfo.withcasesinfo_1;
#line 168 "../gutil.k"

	    {
#line 169 "../gutil.k"
withcaseinfo kc_selvar_1_1 = 
 wco 
;
#line 169 "../gutil.k"
/*SUPPRESS 622*/
assert_withcaseinfo(kc_selvar_1_1, "with_expression (1)");

#line 431 "gutil.c"
		if (( kc_selvar_1_1->prod_sel == sel_Withcaseinfo)) {
#line 170 "../gutil.k"
		patternrepresentation patrep =  kc_selvar_1_1->u.Withcaseinfo.patternrepresentation_1;
#line 170 "../gutil.k"

		    if ( eq_ID(id = f_phylumofpatternrepresentation( patrep ), f_emptyId() )) {
			return f_phylumofwithcasesinfo( r_wcso );
		    } else {
			return id;
}   
#line 442 "gutil.c"
		} else
{ kc_no_default_in_with( "f_phylumofwithcasesinfo", __LINE__, __FILE__ );
   return (ID)0; }
}
#line 175 "../gutil.k"
   
#line 449 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_Nilwithcasesinfo)) {
#line 164 "../gutil.k"

	    v_report(NonFatal( NoFileLine(), Problem1S( "Error: can not find type of with expression" )));
	    return Id( Str( mkcasestring( "KC_ERRORunknownTYPE" )));
 	
#line 457 "gutil.c"
		} else
{ kc_no_default_in_with( "f_phylumofwithcasesinfo", __LINE__, __FILE__ );
   return (ID)0; }
}
#line 175 "../gutil.k"
   
#line 175 "../gutil.k"
}
#line 466 "gutil.c"

ID f_phylumofpatternrepresentation
#ifdef KC_USE_PROTOTYPES
(patternrepresentation a_patrep)
#else
(a_patrep) patternrepresentation a_patrep;
#endif
#line 178 "../gutil.k"
{
    {
#line 179 "../gutil.k"
patternrepresentation kc_selvar_0_1 = 
 a_patrep 
;
#line 179 "../gutil.k"
/*SUPPRESS 622*/
assert_patternrepresentation(kc_selvar_0_1, "with_expression (1)");

#line 485 "gutil.c"
		if (( kc_selvar_0_1->prod_sel == sel_Conspatternrepresentation)) {
#line 183 "../gutil.k"
		elem_patternrepresentation a_patrep_elem =  kc_selvar_0_1->u.Conspatternrepresentation.elem_patternrepresentation_1;
#line 183 "../gutil.k"
		patternrepresentation r_patrep =  kc_selvar_0_1->u.Conspatternrepresentation.patternrepresentation_1;
#line 183 "../gutil.k"

	    {
#line 184 "../gutil.k"
elem_patternrepresentation kc_selvar_1_1 = 
 a_patrep_elem 
;
#line 184 "../gutil.k"
/*SUPPRESS 622*/
assert_elem_patternrepresentation(kc_selvar_1_1, "with_expression (1)");

#line 502 "gutil.c"
		if (( kc_selvar_1_1->prod_sel == sel_PRIntLiteral)) {
#line 206 "../gutil.k"

		    return f_phylumofpatternrepresentation( r_patrep );

#line 508 "gutil.c"
		} else
		if (( kc_selvar_1_1->prod_sel == sel_PRStringLiteral)) {
#line 203 "../gutil.k"

		    return f_phylumofpatternrepresentation( r_patrep );
		
#line 515 "gutil.c"
		} else
		if (( kc_selvar_1_1->prod_sel == sel_PRWildcard)) {
#line 200 "../gutil.k"

		    return f_phylumofpatternrepresentation( r_patrep );
		
#line 522 "gutil.c"
		} else
		if (( kc_selvar_1_1->prod_sel == sel_PRDefault)) {
#line 197 "../gutil.k"

		    return f_phylumofpatternrepresentation( r_patrep );
		
#line 529 "gutil.c"
		} else
		if (( kc_selvar_1_1->prod_sel == sel_PROperPredicate)) {
#line 194 "../gutil.k"
		ID id =  kc_selvar_1_1->u.PROperPredicate.ID_1;
#line 194 "../gutil.k"

		    return f_phylumofoperator( id );
		
#line 538 "gutil.c"
		} else
		if (( kc_selvar_1_1->prod_sel == sel_PRVarPredicate)) {
#line 191 "../gutil.k"

		    return f_phylumofpatternrepresentation( r_patrep );
		
#line 545 "gutil.c"
		} else
		if (( kc_selvar_1_1->prod_sel == sel_PRNonLeafBinding)) {
#line 188 "../gutil.k"

		    return f_phylumofpatternrepresentation( r_patrep );
		
#line 552 "gutil.c"
		} else
		if (( kc_selvar_1_1->prod_sel == sel_PRBinding)) {
#line 185 "../gutil.k"

		    return f_phylumofpatternrepresentation( r_patrep );
		
#line 559 "gutil.c"
		} else
{ kc_no_default_in_with( "f_phylumofpatternrepresentation", __LINE__, __FILE__ );
   return (ID)0; }
}
#line 208 "../gutil.k"
   
#line 566 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_Nilpatternrepresentation)) {
#line 180 "../gutil.k"

	    return f_emptyId();
	
#line 573 "gutil.c"
		} else
{ kc_no_default_in_with( "f_phylumofpatternrepresentation", __LINE__, __FILE__ );
   return (ID)0; }
}
#line 208 "../gutil.k"
   
#line 208 "../gutil.k"
}
#line 582 "gutil.c"

Cvariabledeclarations sort_extend_Cvariabledeclarations
#ifdef KC_USE_PROTOTYPES
(Cvariabledeclarations C_vardecls, fnarguments fn_args)
#else
(C_vardecls, fn_args) Cvariabledeclarations C_vardecls;
fnarguments fn_args;
#endif
#line 213 "../gutil.k"
{
    return t_sort_extend_Cvariabledeclarations( C_vardecls, fn_args, NilCvariabledeclarations() );

#line 215 "../gutil.k"
}
#line 597 "gutil.c"

Cvariabledeclarations t_sort_extend_Cvariabledeclarations
#ifdef KC_USE_PROTOTYPES
(Cvariabledeclarations C_vardecls, fnarguments fn_args, Cvariabledeclarations temp)
#else
(C_vardecls, fn_args, temp) Cvariabledeclarations C_vardecls;
fnarguments fn_args;
Cvariabledeclarations temp;
#endif
#line 217 "../gutil.k"
{
    {
#line 218 "../gutil.k"
fnarguments kc_selvar_0_1 = 
 fn_args 
;
#line 218 "../gutil.k"
/*SUPPRESS 622*/
assert_fnarguments(kc_selvar_0_1, "with_expression (1)");

#line 618 "gutil.c"
		if (( kc_selvar_0_1->prod_sel == sel_Consfnarguments)) {
#line 220 "../gutil.k"
		ID a_fnarg =  kc_selvar_0_1->u.Consfnarguments.ID_1;
#line 220 "../gutil.k"
		fnarguments r_fnargs =  kc_selvar_0_1->u.Consfnarguments.fnarguments_1;
#line 220 "../gutil.k"

	    temp =  t_sort_extend_Cvariabledeclarations( C_vardecls, r_fnargs, temp );
	    return ConsCvariabledeclarations( lookup_and_createCvariabledeclaration( a_fnarg, C_vardecls ), temp );

#line 629 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_Nilfnarguments)) {
#line 219 "../gutil.k"
 return temp; 
#line 634 "gutil.c"
		} else
{ kc_no_default_in_with( "t_sort_extend_Cvariabledeclarations", __LINE__, __FILE__ );
   return (Cvariabledeclarations)0; }
}
#line 223 "../gutil.k"
   
#line 223 "../gutil.k"
}
#line 643 "gutil.c"

static Cvariabledeclaration lookup_and_createCvariabledeclaration
#ifdef KC_USE_PROTOTYPES
(ID a_fnarg, Cvariabledeclarations C_vardecls)
#else
(a_fnarg, C_vardecls) ID a_fnarg;
Cvariabledeclarations C_vardecls;
#endif
#line 226 "../gutil.k"
{
    Cvariabledeclaration result = 0;
    int number_of_results = 0;
    {
#line 229 "../gutil.k"
Cvariabledeclarations kc_fe_selvar_1 =  C_vardecls ;
#line 229 "../gutil.k"
/*SUPPRESS 622*/
assert_Cvariabledeclarations(kc_fe_selvar_1, "foreach_list_expression");

#line 663 "gutil.c"
while(
	kc_fe_selvar_1->prod_sel == sel_ConsCvariabledeclarations
	) {
Cvariabledeclaration kc_selvar_0_1 = kc_fe_selvar_1->u.ConsCvariabledeclarations.Cvariabledeclaration_1;
{
#line 229 "../gutil.k"
{
#line 229 "../gutil.k"
/*SUPPRESS 622*/
assert_Cvariabledeclaration(kc_selvar_0_1, "with_expression (1)");

#line 675 "gutil.c"
{
#line 229 "../gutil.k"
		Cvariabledeclaration vard =  kc_selvar_0_1;
#line 229 "../gutil.k"

	{
#line 230 "../gutil.k"
Cvariabledeclaration kc_selvar_1_1 = 
 vard 
;
#line 230 "../gutil.k"
/*SUPPRESS 622*/
assert_Cvariabledeclaration(kc_selvar_1_1, "with_expression (1)");

#line 690 "gutil.c"
		if (( kc_selvar_1_1->prod_sel == sel_Fnargfpdecl)) {
#line 245 "../gutil.k"
		ID type =  kc_selvar_1_1->u.Fnargfpdecl.ID_1;
#line 245 "../gutil.k"
		Cvariables cvars =  kc_selvar_1_1->u.Fnargfpdecl.Cvariables_1;
#line 245 "../gutil.k"

		{
#line 246 "../gutil.k"
Cvariables kc_fe_selvar_1 =  cvars ;
#line 246 "../gutil.k"
/*SUPPRESS 622*/
assert_Cvariables(kc_fe_selvar_1, "foreach_list_expression");

#line 705 "gutil.c"
while(
	kc_fe_selvar_1->prod_sel == sel_ConsCvariables
	) {
Cvariable kc_selvar_2_1 = kc_fe_selvar_1->u.ConsCvariables.Cvariable_1;
{
#line 246 "../gutil.k"
{
#line 246 "../gutil.k"
/*SUPPRESS 622*/
assert_Cvariable(kc_selvar_2_1, "with_expression (1)");

#line 717 "gutil.c"
{
#line 246 "../gutil.k"
		Cvariable cvar =  kc_selvar_2_1;
#line 246 "../gutil.k"

		    {
#line 247 "../gutil.k"
Cvariable kc_selvar_3_1 = 
 cvar 
;
#line 247 "../gutil.k"
/*SUPPRESS 622*/
assert_Cvariable(kc_selvar_3_1, "with_expression (1)");

#line 732 "gutil.c"
		if (( kc_selvar_3_1->prod_sel == sel_CVFunction)) {
#line 253 "../gutil.k"
		ID name =  kc_selvar_3_1->u.CVFunction.ID_1;
#line 253 "../gutil.k"

			    if (eq_ID( name, a_fnarg ) ) {
				result = CVariabledeclaration( type, ConsCvariables( cvar , NilCvariables() ));
				number_of_results++;
			}   
#line 742 "gutil.c"
		} else
		if (( kc_selvar_3_1->prod_sel == sel_CVPointer)) {
#line 248 "../gutil.k"
		ID name =  kc_selvar_3_1->u.CVPointer.ID_1;
#line 248 "../gutil.k"

			    if (eq_ID( name, a_fnarg ) ) {
				result = CVariabledeclaration( type, ConsCvariables( cvar , NilCvariables() ));
				number_of_results++;
			}   
#line 753 "gutil.c"
		} else
{ kc_no_default_in_with( "lookup_and_createCvariabledeclaration", __LINE__, __FILE__ );
   return (Cvariabledeclaration)0; }
}
#line 258 "../gutil.k"
   
#line 760 "gutil.c"
}
}

#line 764 "gutil.c"
}
kc_fe_selvar_1 = kc_fe_selvar_1->u.ConsCvariables.Cvariables_1;
#line 246 "../gutil.k"
/*SUPPRESS 622*/
assert_Cvariables(kc_fe_selvar_1, "sublist_of_foreach_list_expression");

#line 771 "gutil.c"
}
}
#line 258 "../gutil.k"
   
#line 776 "gutil.c"
		} else
		if (( kc_selvar_1_1->prod_sel == sel_CVariabledeclaration)) {
#line 231 "../gutil.k"
		ID type =  kc_selvar_1_1->u.CVariabledeclaration.ID_1;
#line 231 "../gutil.k"
		Cvariables cvars =  kc_selvar_1_1->u.CVariabledeclaration.Cvariables_1;
#line 231 "../gutil.k"

		{
#line 232 "../gutil.k"
Cvariables kc_fe_selvar_1 =  cvars ;
#line 232 "../gutil.k"
/*SUPPRESS 622*/
assert_Cvariables(kc_fe_selvar_1, "foreach_list_expression");

#line 792 "gutil.c"
while(
	kc_fe_selvar_1->prod_sel == sel_ConsCvariables
	) {
Cvariable kc_selvar_2_1 = kc_fe_selvar_1->u.ConsCvariables.Cvariable_1;
{
#line 232 "../gutil.k"
{
#line 232 "../gutil.k"
/*SUPPRESS 622*/
assert_Cvariable(kc_selvar_2_1, "with_expression (1)");

#line 804 "gutil.c"
{
#line 232 "../gutil.k"
		Cvariable cvar =  kc_selvar_2_1;
#line 232 "../gutil.k"

		    {
#line 233 "../gutil.k"
Cvariable kc_selvar_3_1 = 
 cvar 
;
#line 233 "../gutil.k"
/*SUPPRESS 622*/
assert_Cvariable(kc_selvar_3_1, "with_expression (1)");

#line 819 "gutil.c"
		if (( kc_selvar_3_1->prod_sel == sel_CVFunction)) {
#line 239 "../gutil.k"
		ID name =  kc_selvar_3_1->u.CVFunction.ID_1;
#line 239 "../gutil.k"

			    if (eq_ID( name, a_fnarg ) ) {
				result = CVariabledeclaration( type, ConsCvariables( cvar , NilCvariables() ));
				number_of_results++;
			}   
#line 829 "gutil.c"
		} else
		if (( kc_selvar_3_1->prod_sel == sel_CVPointer)) {
#line 234 "../gutil.k"
		ID name =  kc_selvar_3_1->u.CVPointer.ID_1;
#line 234 "../gutil.k"

			    if (eq_ID( name, a_fnarg ) ) {
				result = CVariabledeclaration( type, ConsCvariables( cvar , NilCvariables() ));
				number_of_results++;
			}   
#line 840 "gutil.c"
		} else
{ kc_no_default_in_with( "lookup_and_createCvariabledeclaration", __LINE__, __FILE__ );
   return (Cvariabledeclaration)0; }
}
#line 244 "../gutil.k"
   
#line 847 "gutil.c"
}
}

#line 851 "gutil.c"
}
kc_fe_selvar_1 = kc_fe_selvar_1->u.ConsCvariables.Cvariables_1;
#line 232 "../gutil.k"
/*SUPPRESS 622*/
assert_Cvariables(kc_fe_selvar_1, "sublist_of_foreach_list_expression");

#line 858 "gutil.c"
}
}
#line 244 "../gutil.k"
   
#line 863 "gutil.c"
		} else
{ kc_no_default_in_with( "lookup_and_createCvariabledeclaration", __LINE__, __FILE__ );
   return (Cvariabledeclaration)0; }
}
#line 259 "../gutil.k"
   
#line 870 "gutil.c"
}
}

#line 874 "gutil.c"
}
kc_fe_selvar_1 = kc_fe_selvar_1->u.ConsCvariabledeclarations.Cvariabledeclarations_1;
#line 229 "../gutil.k"
/*SUPPRESS 622*/
assert_Cvariabledeclarations(kc_fe_selvar_1, "sublist_of_foreach_list_expression");

#line 881 "gutil.c"
}
}
#line 260 "../gutil.k"
    if (number_of_results == 1) {
	return result;
    } else {
	
	if (number_of_results > 1) {
	    v_report(Warning( FileLine( a_fnarg->file, a_fnarg->line ), Problem1S1ID( "more than one type defined for function argument:", a_fnarg )));
    } else { 
	    v_report(Warning( FileLine( a_fnarg->file, a_fnarg->line ), Problem1S1ID( "can not find type of function argument:", a_fnarg )));
	}
    
	return CVariabledeclaration( Id( Str( mkcasestring( "KC_ERRORunknownTYPE" ))), ConsCvariables( CVPointer( 0, a_fnarg ), NilCvariables() ));
    }

#line 272 "../gutil.k"
}
#line 900 "gutil.c"

ac_parameter_type_list sort_extend_parameter_type_list
#ifdef KC_USE_PROTOTYPES
(ac_declaration_list C_vardecls, ac_declarator decl)
#else
(C_vardecls, decl) ac_declaration_list C_vardecls;
ac_declarator decl;
#endif
#line 280 "../gutil.k"
{{
#line 279 "../gutil.k"
ac_declarator kc_selvar_0_1 = decl;
#line 279 "../gutil.k"
/*SUPPRESS 622*/
assert_ac_declarator(kc_selvar_0_1, "with_expression (1)");

#line 917 "gutil.c"
		if (( kc_selvar_0_1->prod_sel == sel_AcDeclarator)) {
#line 281 "../gutil.k"
		ac_direct_declarator add =  kc_selvar_0_1->u.AcDeclarator.ac_direct_declarator_1;
#line 281 "../gutil.k"

		{
#line 282 "../gutil.k"
ac_direct_declarator kc_selvar_1_1 = 
 add 
;
#line 282 "../gutil.k"
/*SUPPRESS 622*/
assert_ac_direct_declarator(kc_selvar_1_1, "with_expression (1)");

#line 932 "gutil.c"
		if (( kc_selvar_1_1->prod_sel == sel_AcDirectDeclKandR) && ( kc_selvar_1_1->u.AcDirectDeclKandR.ac_identifier_list_1->prod_sel == sel_Consac_identifier_list) && ( kc_selvar_1_1->u.AcDirectDeclKandR.ac_identifier_list_1->u.Consac_identifier_list.ID_1->prod_sel == sel_Id) && ( kc_selvar_1_1->u.AcDirectDeclKandR.ac_identifier_list_1->u.Consac_identifier_list.ID_1->u.Id.uniqID_1->prod_sel == sel_Str) && (strcmp( kc_selvar_1_1->u.AcDirectDeclKandR.ac_identifier_list_1->u.Consac_identifier_list.ID_1->u.Id.uniqID_1->u.Str.casestring_1->name, "void")==0) && ( kc_selvar_1_1->u.AcDirectDeclKandR.ac_identifier_list_1->u.Consac_identifier_list.ac_identifier_list_1->prod_sel == sel_Nilac_identifier_list)) {
#line 287 "../gutil.k"
 
				check_ac_parameter_declaration( C_vardecls, Nilac_identifier_list() );
				return AcParList( t_sort_extend_parameter_list( C_vardecls, Nilac_identifier_list(), Nilac_parameter_list() ) );
			
#line 939 "gutil.c"
		} else
		if (( kc_selvar_1_1->prod_sel == sel_AcDirectDeclKandR)) {
#line 291 "../gutil.k"
		ac_identifier_list fn_args =  kc_selvar_1_1->u.AcDirectDeclKandR.ac_identifier_list_1;
#line 291 "../gutil.k"

				check_ac_parameter_declaration( C_vardecls, fn_args );
				return AcParList( t_sort_extend_parameter_list( C_vardecls, fn_args, Nilac_parameter_list() ) );
			
#line 949 "gutil.c"
		} else
		if (( kc_selvar_1_1->prod_sel == sel_AcDirectDeclProto)) {
#line 286 "../gutil.k"
		ac_parameter_type_list fn_proto =  kc_selvar_1_1->u.AcDirectDeclProto.ac_parameter_type_list_1;
#line 286 "../gutil.k"
 return fn_proto; 
#line 956 "gutil.c"
		} else
		if (( kc_selvar_1_1->prod_sel == sel_AcDirectDeclArray)) {
#line 285 "../gutil.k"
 return AcParList( Nilac_parameter_list() ); 
#line 961 "gutil.c"
		} else
		if (( kc_selvar_1_1->prod_sel == sel_AcDirectDeclPack)) {
#line 285 "../gutil.k"
 return AcParList( Nilac_parameter_list() ); 
#line 966 "gutil.c"
		} else
		if (( kc_selvar_1_1->prod_sel == sel_AcDirectDeclId)) {
#line 285 "../gutil.k"
 return AcParList( Nilac_parameter_list() ); 
#line 971 "gutil.c"
		} else
{ kc_no_default_in_with( "sort_extend_parameter_type_list", __LINE__, __FILE__ );
   return (ac_parameter_type_list)0; }
}
#line 296 "../gutil.k"
	
#line 978 "gutil.c"
		} else
{ kc_no_default_in_with( "sort_extend_parameter_type_list", __LINE__, __FILE__ );
   return (ac_parameter_type_list)0; }
}

#line 297 "../gutil.k"
}
#line 986 "gutil.c"

ac_parameter_list t_sort_extend_parameter_list
#ifdef KC_USE_PROTOTYPES
(ac_declaration_list C_vardecls, ac_identifier_list fn_args, ac_parameter_list temp)
#else
(C_vardecls, fn_args, temp) ac_declaration_list C_vardecls;
ac_identifier_list fn_args;
ac_parameter_list temp;
#endif
#line 299 "../gutil.k"
{
    {
#line 300 "../gutil.k"
ac_identifier_list kc_selvar_0_1 = 
 fn_args 
;
#line 300 "../gutil.k"
/*SUPPRESS 622*/
assert_ac_identifier_list(kc_selvar_0_1, "with_expression (1)");

#line 1007 "gutil.c"
		if (( kc_selvar_0_1->prod_sel == sel_Consac_identifier_list)) {
#line 302 "../gutil.k"
		ID a_fnarg =  kc_selvar_0_1->u.Consac_identifier_list.ID_1;
#line 302 "../gutil.k"
		ac_identifier_list r_fnargs =  kc_selvar_0_1->u.Consac_identifier_list.ac_identifier_list_1;
#line 302 "../gutil.k"

	    temp =  t_sort_extend_parameter_list( C_vardecls, r_fnargs, temp );
	    return Consac_parameter_list( lookup_and_create_ac_parameter_declaration( a_fnarg, C_vardecls ), temp );

#line 1018 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_Nilac_identifier_list)) {
#line 301 "../gutil.k"
 return temp; 
#line 1023 "gutil.c"
		} else
{ kc_no_default_in_with( "t_sort_extend_parameter_list", __LINE__, __FILE__ );
   return (ac_parameter_list)0; }
}
#line 305 "../gutil.k"
   
#line 305 "../gutil.k"
}
#line 1032 "gutil.c"

static ac_parameter_declaration lookup_and_create_ac_parameter_declaration
#ifdef KC_USE_PROTOTYPES
(ID a_fnarg, ac_declaration_list C_vardecls)
#else
(a_fnarg, C_vardecls) ID a_fnarg;
ac_declaration_list C_vardecls;
#endif
#line 308 "../gutil.k"
{
    ac_parameter_declaration result = 0;
    int number_of_results = 0;
    {
#line 311 "../gutil.k"
ac_declaration_list kc_fe_selvar_1 =  C_vardecls ;
#line 311 "../gutil.k"
/*SUPPRESS 622*/
assert_ac_declaration_list(kc_fe_selvar_1, "foreach_list_expression");

#line 1052 "gutil.c"
while(
	kc_fe_selvar_1->prod_sel == sel_Consac_declaration_list
	) {
ac_declaration kc_selvar_0_1 = kc_fe_selvar_1->u.Consac_declaration_list.ac_declaration_1;
{
#line 311 "../gutil.k"
{
#line 311 "../gutil.k"
/*SUPPRESS 622*/
assert_ac_declaration(kc_selvar_0_1, "with_expression (1)");

#line 1064 "gutil.c"
{
#line 311 "../gutil.k"
		ac_declaration vard =  kc_selvar_0_1;
#line 311 "../gutil.k"
{
#line 311 "../gutil.k"
ac_declaration kc_selvar_1_1 = vard;
#line 311 "../gutil.k"
/*SUPPRESS 622*/
assert_ac_declaration(kc_selvar_1_1, "with_expression (1)");

#line 1076 "gutil.c"
		if (( kc_selvar_1_1->prod_sel == sel_AcDeclaration)) {
#line 312 "../gutil.k"
		ac_declaration_specifiers type =  kc_selvar_1_1->u.AcDeclaration.ac_declaration_specifiers_1;
#line 312 "../gutil.k"
		ac_init_declarator_list cvars =  kc_selvar_1_1->u.AcDeclaration.ac_init_declarator_list_1;
#line 312 "../gutil.k"

			{
#line 313 "../gutil.k"
ac_init_declarator_list kc_fe_selvar_1 =  cvars ;
#line 313 "../gutil.k"
/*SUPPRESS 622*/
assert_ac_init_declarator_list(kc_fe_selvar_1, "foreach_list_expression");

#line 1091 "gutil.c"
while(
	kc_fe_selvar_1->prod_sel == sel_Consac_init_declarator_list
	) {
ac_init_declarator kc_selvar_2_1 = kc_fe_selvar_1->u.Consac_init_declarator_list.ac_init_declarator_1;
{
#line 313 "../gutil.k"
{
#line 313 "../gutil.k"
/*SUPPRESS 622*/
assert_ac_init_declarator(kc_selvar_2_1, "with_expression (1)");

#line 1103 "gutil.c"
{
#line 313 "../gutil.k"
		ac_init_declarator cvar =  kc_selvar_2_1;
#line 313 "../gutil.k"
{
#line 313 "../gutil.k"
ac_init_declarator kc_selvar_3_1 = cvar;
#line 313 "../gutil.k"
/*SUPPRESS 622*/
assert_ac_init_declarator(kc_selvar_3_1, "with_expression (1)");

#line 1115 "gutil.c"
		if (( kc_selvar_3_1->prod_sel == sel_AcInitDecl)) {
#line 314 "../gutil.k"
		ac_declarator decl =  kc_selvar_3_1->u.AcInitDecl.ac_declarator_1;
#line 314 "../gutil.k"

					ID name = f_ID_of_declarator( decl );
					if (eq_ID( name, a_fnarg ) ) {
						result = AcParDeclDecl( type, decl );
						number_of_results++;
	}	
#line 1126 "gutil.c"
		} else
{ kc_no_default_in_with( "lookup_and_create_ac_parameter_declaration", __LINE__, __FILE__ );
   return (ac_parameter_declaration)0; }
}

#line 1132 "gutil.c"
}
}

#line 1136 "gutil.c"
}
kc_fe_selvar_1 = kc_fe_selvar_1->u.Consac_init_declarator_list.ac_init_declarator_list_1;
#line 313 "../gutil.k"
/*SUPPRESS 622*/
assert_ac_init_declarator_list(kc_fe_selvar_1, "sublist_of_foreach_list_expression");

#line 1143 "gutil.c"
}
}
#line 319 "../gutil.k"
	
#line 1148 "gutil.c"
		} else
{ kc_no_default_in_with( "lookup_and_create_ac_parameter_declaration", __LINE__, __FILE__ );
   return (ac_parameter_declaration)0; }
}

#line 1154 "gutil.c"
}
}

#line 1158 "gutil.c"
}
kc_fe_selvar_1 = kc_fe_selvar_1->u.Consac_declaration_list.ac_declaration_list_1;
#line 311 "../gutil.k"
/*SUPPRESS 622*/
assert_ac_declaration_list(kc_fe_selvar_1, "sublist_of_foreach_list_expression");

#line 1165 "gutil.c"
}
}
#line 320 "../gutil.k"
	if (number_of_results == 1) {
		return result;
	} else {
		
		if (number_of_results > 1) {
			v_report(Warning( FileLine( a_fnarg->file, a_fnarg->line ), Problem1S1ID( "more than one type defined for function argument:", a_fnarg )));
		} else { 
			v_report(Warning( FileLine( a_fnarg->file, a_fnarg->line ), Problem1S1ID( "can not find type of function argument:", a_fnarg )));
		}
		
		return AcParDeclDecl(
			 Consac_declaration_specifiers(
				AcDeclSpecTypeSpec(
					AcTypeSpec( Id( Str( mkcasestring( "KC_ERRORunknownTYPE" ))))),
				Nilac_declaration_specifiers()),
			 AcDeclarator(
				Nopointer(),
				AcDirectDeclId( a_fnarg )));
    }

#line 339 "../gutil.k"
}
#line 1191 "gutil.c"

static void check_ac_parameter_declaration
#ifdef KC_USE_PROTOTYPES
(ac_declaration_list C_vardecls, ac_identifier_list fn_args)
#else
(C_vardecls, fn_args) ac_declaration_list C_vardecls;
ac_identifier_list fn_args;
#endif
#line 342 "../gutil.k"
{
    {
#line 343 "../gutil.k"
ac_declaration_list kc_fe_selvar_1 =  C_vardecls ;
#line 343 "../gutil.k"
/*SUPPRESS 622*/
assert_ac_declaration_list(kc_fe_selvar_1, "foreach_list_expression");

#line 1209 "gutil.c"
while(
	kc_fe_selvar_1->prod_sel == sel_Consac_declaration_list
	) {
ac_declaration kc_selvar_0_1 = kc_fe_selvar_1->u.Consac_declaration_list.ac_declaration_1;
{
#line 343 "../gutil.k"
{
#line 343 "../gutil.k"
/*SUPPRESS 622*/
assert_ac_declaration(kc_selvar_0_1, "with_expression (1)");

#line 1221 "gutil.c"
{
#line 343 "../gutil.k"
		ac_declaration vard =  kc_selvar_0_1;
#line 343 "../gutil.k"
{
#line 343 "../gutil.k"
ac_declaration kc_selvar_1_1 = vard;
#line 343 "../gutil.k"
/*SUPPRESS 622*/
assert_ac_declaration(kc_selvar_1_1, "with_expression (1)");

#line 1233 "gutil.c"
		if (( kc_selvar_1_1->prod_sel == sel_AcDeclaration)) {
#line 344 "../gutil.k"
		ac_init_declarator_list cvars =  kc_selvar_1_1->u.AcDeclaration.ac_init_declarator_list_1;
#line 344 "../gutil.k"

			{
#line 345 "../gutil.k"
ac_init_declarator_list kc_fe_selvar_1 =  cvars ;
#line 345 "../gutil.k"
/*SUPPRESS 622*/
assert_ac_init_declarator_list(kc_fe_selvar_1, "foreach_list_expression");

#line 1246 "gutil.c"
while(
	kc_fe_selvar_1->prod_sel == sel_Consac_init_declarator_list
	) {
ac_init_declarator kc_selvar_2_1 = kc_fe_selvar_1->u.Consac_init_declarator_list.ac_init_declarator_1;
{
#line 345 "../gutil.k"
{
#line 345 "../gutil.k"
/*SUPPRESS 622*/
assert_ac_init_declarator(kc_selvar_2_1, "with_expression (1)");

#line 1258 "gutil.c"
{
#line 345 "../gutil.k"
		ac_init_declarator cvar =  kc_selvar_2_1;
#line 345 "../gutil.k"
{
#line 345 "../gutil.k"
ac_init_declarator kc_selvar_3_1 = cvar;
#line 345 "../gutil.k"
/*SUPPRESS 622*/
assert_ac_init_declarator(kc_selvar_3_1, "with_expression (1)");

#line 1270 "gutil.c"
		if (( kc_selvar_3_1->prod_sel == sel_AcInitDecl)) {
#line 346 "../gutil.k"
		ac_declarator decl =  kc_selvar_3_1->u.AcInitDecl.ac_declarator_1;
#line 346 "../gutil.k"

					ID name = f_ID_of_declarator( decl );
					int number_of_results = 0;
					{
#line 349 "../gutil.k"
ac_identifier_list kc_fe_selvar_1 =  fn_args;
#line 349 "../gutil.k"
/*SUPPRESS 622*/
assert_ac_identifier_list(kc_fe_selvar_1, "foreach_list_expression");

#line 1285 "gutil.c"
while(
	kc_fe_selvar_1->prod_sel == sel_Consac_identifier_list
	) {
ID kc_selvar_4_1 = kc_fe_selvar_1->u.Consac_identifier_list.ID_1;
{
#line 349 "../gutil.k"
{
#line 349 "../gutil.k"
/*SUPPRESS 622*/
assert_ID(kc_selvar_4_1, "with_expression (1)");

#line 1297 "gutil.c"
{
#line 349 "../gutil.k"
		ID a_fnarg =  kc_selvar_4_1;
#line 349 "../gutil.k"

						if (eq_ID( name, a_fnarg ) ) {
							number_of_results++;
						}
					
#line 1307 "gutil.c"
}
}

#line 1311 "gutil.c"
}
kc_fe_selvar_1 = kc_fe_selvar_1->u.Consac_identifier_list.ac_identifier_list_1;
#line 349 "../gutil.k"
/*SUPPRESS 622*/
assert_ac_identifier_list(kc_fe_selvar_1, "sublist_of_foreach_list_expression");

#line 1318 "gutil.c"
}
}
#line 354 "../gutil.k"
					if (number_of_results > 1) {
						v_report(Warning( FileLine( name->file, name->line ), Problem1S1ID( "more than one function argument for type definition:", name )));
					} else if (number_of_results < 1) {
						v_report(Warning( FileLine( name->file, name->line ), Problem1S1ID( "can not find declared function argument:", name )));
					}
	
#line 1328 "gutil.c"
		} else
kc_no_default_in_with( "check_ac_parameter_declaration", __LINE__, __FILE__ );
}

#line 1333 "gutil.c"
}
}

#line 1337 "gutil.c"
}
kc_fe_selvar_1 = kc_fe_selvar_1->u.Consac_init_declarator_list.ac_init_declarator_list_1;
#line 345 "../gutil.k"
/*SUPPRESS 622*/
assert_ac_init_declarator_list(kc_fe_selvar_1, "sublist_of_foreach_list_expression");

#line 1344 "gutil.c"
}
}
#line 359 "../gutil.k"
	
#line 1349 "gutil.c"
		} else
kc_no_default_in_with( "check_ac_parameter_declaration", __LINE__, __FILE__ );
}

#line 1354 "gutil.c"
}
}

#line 1358 "gutil.c"
}
kc_fe_selvar_1 = kc_fe_selvar_1->u.Consac_declaration_list.ac_declaration_list_1;
#line 343 "../gutil.k"
/*SUPPRESS 622*/
assert_ac_declaration_list(kc_fe_selvar_1, "sublist_of_foreach_list_expression");

#line 1365 "gutil.c"
}
}
#line 360 "../gutil.k"

#line 360 "../gutil.k"
}
#line 1372 "gutil.c"

void unparse_charptr
#ifdef KC_USE_PROTOTYPES
(char *s, void (*printer_fn)(char *dummy1, uview dummy2), view v)
#else
(s, printer_fn, v) char *s;
void (*printer_fn)();
view v;
#endif
#line 396 "../gutil.k"
{
    printer_fn( s, v );

#line 398 "../gutil.k"
}
#line 1388 "gutil.c"

char *f_mkstars
#ifdef KC_USE_PROTOTYPES
(int i)
#else
(i) int i;
#endif
#line 401 "../gutil.k"
{
    static char star_string[] = "**************";
    static char *malloced_star_string = 0;
    static char empty_string[] = "";

    if (i <= 0 ) {
	return empty_string;
    } else if (i <= (int)strlen(star_string)) {
	return &(star_string[strlen(star_string)-i]);
    } else {
	char *ptr = 0;
	int j;
	if (malloced_star_string == 0) {
	    malloced_star_string = (char *)MALLOC((kc_size_t) i+1 );
	    ptr = malloced_star_string;
	} else if ( i > (int)strlen(malloced_star_string) ) {
	    malloced_star_string = (char *)REALLOC((kc_voidptr_t)malloced_star_string, (kc_size_t)i+1 );
	    ptr = malloced_star_string;
	}
	if (ptr != 0) {
            for (j = 0; j< i; j++) {
		*ptr++ = '*';
	    }
	    *ptr = '\0';
	}
	return &(malloced_star_string[strlen(malloced_star_string)-i]);
    }	

#line 428 "../gutil.k"
}
#line 1427 "gutil.c"

char *f_mknls
#ifdef KC_USE_PROTOTYPES
(int i)
#else
(i) int i;
#endif
#line 431 "../gutil.k"
{
    static char empty_string[] = "";
    static char nl_string[] = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
    static char *malloced_nl_string = 0;

    if (i <= 0 ) {
	return empty_string;
    } else if (i <= (int)strlen(nl_string)) {
	return &(nl_string[strlen(nl_string)-i]);
    } else {
	char *ptr = 0;
	int j;
	if (malloced_nl_string == 0) {
	    malloced_nl_string = (char *)MALLOC( (kc_size_t)i+1 );
	    ptr = malloced_nl_string;
	} else if ( i > (int)strlen(malloced_nl_string) ) {
	    malloced_nl_string = (char *)REALLOC( (kc_voidptr_t)malloced_nl_string, (kc_size_t)i+1 );
	    ptr = malloced_nl_string;
	}
	if (ptr != 0) {
            for (j = 0; j< i; j++) {
		*ptr++ = '\n';
	    }
	    *ptr = '\0';
	}
	return &(malloced_nl_string[strlen(malloced_nl_string)-i]);
    }	

#line 458 "../gutil.k"
}
#line 1466 "gutil.c"

char *f_mkquotednls
#ifdef KC_USE_PROTOTYPES
(int ii)
#else
(ii) int ii;
#endif
#line 468 "../gutil.k"
{
    static char empty_string[] = "";
    static char nl_string[] = "\\\n\\n\\\n\\n\\\n\\n\\\n\\n\\\n\\n\\\n\\n\\\n\\n\\\n\\n\\\n\\n\\\n\\n\\\n\\n\\\n\\n\\\n\\n\\\n\\n\\\n\\n\\\n\\n\\\n\\n\\\n\\n\\\n\\n\\\n\\n";
    static char *malloced_nl_string = 0;
    int i = 4*ii;

    if (i <= 0 ) {
	return empty_string;
    } else if (i <= (int)strlen(nl_string)) {
	return &(nl_string[strlen(nl_string)-i]);
    } else {
	char *ptr = 0;
	int j;
	if (malloced_nl_string == 0) {
	    malloced_nl_string = (char *)MALLOC( (kc_size_t)i+1 );
	    ptr = malloced_nl_string;
	} else if ( i > (int)strlen(malloced_nl_string) ) {
	    malloced_nl_string = (char *)REALLOC( (kc_voidptr_t)malloced_nl_string, (kc_size_t)i+1 );
	    ptr = malloced_nl_string;
	}
	if (ptr != 0) {
            for (j = 0; j< i; j+=4) {
		*ptr++ = QUOTEDBACKSLASH;
		*ptr++ = '\n';
		*ptr++ = QUOTEDBACKSLASH;
		*ptr++ = 'n';
	    }
	    *ptr = '\0';
	}
	return &(malloced_nl_string[strlen(malloced_nl_string)-i]);
    }	

#line 499 "../gutil.k"
}
#line 1509 "gutil.c"

ID f_mkselvar
#ifdef KC_USE_PROTOTYPES
(char *prefix, int level)
#else
(prefix, level) char *prefix;
int level;
#endif
#line 506 "../gutil.k"
{
    


    char fixbuf[BUFSIZ];
    char *dynbuf = 0;
    char *buf = 0;
    ID id;
    if (strlen(prefix) + MKSELVARMAXINTREPR + 1 > BUFSIZ) {
	dynbuf = (char*)MALLOC((kc_size_t) strlen(prefix) + MKSELVARMAXINTREPR + 1);
        buf = dynbuf;
    } else {
	buf = fixbuf;
    }
    (void)strcpy( buf, prefix );
    (void)sprintf( &buf[strlen(prefix)], "%d", level );
    id = Id( Str( mkcasestring( buf )));
    if (dynbuf != 0) {
	FREE((kc_voidptr_t) dynbuf );
    }
    return id;

#line 527 "../gutil.k"
}
#line 1543 "gutil.c"

ID f_mkselvar2
#ifdef KC_USE_PROTOTYPES
(char *prefix, int level, int branch)
#else
(prefix, level, branch) char *prefix;
int level;
int branch;
#endif
#line 530 "../gutil.k"
{
    



    char fixbuf[BUFSIZ];
    char *dynbuf = 0;
    char *buf = 0;
    ID id;
    int constant_factor = MKSELVARMAXINTREPR + 1 + MKSELVARMAXINTREPR + 1;
    if (strlen(prefix) + constant_factor > BUFSIZ) {
	dynbuf = (char*)MALLOC((kc_size_t) strlen(prefix) + constant_factor);
        buf = dynbuf;
    } else {
	buf = fixbuf;
    }
    (void)strcpy( buf, prefix );
    (void)sprintf( &buf[strlen(prefix)], "%d_%d", level, branch );
    id = Id( Str( mkcasestring( buf )));
    if (dynbuf != 0) {
	FREE((kc_voidptr_t) dynbuf );
    }
    return id;

#line 553 "../gutil.k"
}
#line 1580 "gutil.c"

char *f_mk_filename
#ifdef KC_USE_PROTOTYPES
(casestring a_casestring, char suffix)
#else
(a_casestring, suffix) casestring a_casestring;
char suffix;
#endif
#line 566 "../gutil.k"
{
    char *filename, *basename;
    int baselen;

    if ((basename = strrchr( a_casestring->name, '/' )) == 0) {
	basename = a_casestring->name;
    }
    if (*basename == '/') {
	basename++;
    } else if (*basename == '"') {
	basename++;
    }
    baselen = strlen(basename);
    filename = (char*)MALLOC((kc_size_t)baselen+3); 
    (void)strcpy( filename, basename );
    if (baselen > 0 && filename[baselen-1] == '"' ) {
	filename[baselen-1] = '\0';
	baselen--;
    }
    if ( baselen > 1 && (filename[baselen-1] == 'k' && filename[baselen-2] == '.' )) {
	filename[baselen-1] = suffix;
    } else {
	filename[baselen] = '.';
	filename[baselen+1] = suffix;
	filename[baselen+2] = '\0';
    }
    return filename;

#line 593 "../gutil.k"
}
#line 1620 "gutil.c"

char *f_make_identifier_basename
#ifdef KC_USE_PROTOTYPES
(char *fn)
#else
(fn) char *fn;
#endif
#line 605 "../gutil.k"
{
    int len, i;
    char *nn;

    len = strlen(fn);
    /*SUPPRESS 622*/
    assert(len >2);
    nn = (char*)MALLOC((kc_size_t)(len-2+1)); 
    (void)strncpy(nn, fn, len-2);
    nn[len-2] = '\0';
    for (i=0; i< len-2; i++) {
	if (! isalnum(nn[i])) {
	    nn[i] = '_';
    }   }
    return nn;

#line 620 "../gutil.k"
}
#line 1647 "gutil.c"

rewriterulesinfo f_rewriterulesinfoofalternativeinview
#ifdef KC_USE_PROTOTYPES
(alternative a_alternative, ID a_view)
#else
(a_alternative, a_view) alternative a_alternative;
ID a_view;
#endif
#line 638 "../gutil.k"
{
	global_filterview = a_view;
    return filter_rewriterulesinfo( a_alternative->rewriteinfo, filterrewriteruleinfoonview );

#line 641 "../gutil.k"
}
#line 1663 "gutil.c"

rewriteviewsinfo f_rewriteviewsinfoofalternatives
#ifdef KC_USE_PROTOTYPES
(alternatives a_alternatives, viewnames a_views)
#else
(a_alternatives, a_views) alternatives a_alternatives;
viewnames a_views;
#endif
#line 644 "../gutil.k"
{
    rewriterulesinfo tmp_rewriterulesinfo = f_rewriterulesinfoofalternatives( a_alternatives );
    rewriteviewsinfo tmp_rewriteviewsinfo = Nilrewriteviewsinfo();
    {
#line 647 "../gutil.k"
viewnames kc_fe_selvar_1 =  a_views ;
#line 647 "../gutil.k"
/*SUPPRESS 622*/
assert_viewnames(kc_fe_selvar_1, "foreach_list_expression");

#line 1683 "gutil.c"
while(
	kc_fe_selvar_1->prod_sel == sel_Consviewnames
	) {
ID kc_selvar_0_1 = kc_fe_selvar_1->u.Consviewnames.ID_1;
{
#line 647 "../gutil.k"
{
#line 647 "../gutil.k"
/*SUPPRESS 622*/
assert_ID(kc_selvar_0_1, "with_expression (1)");

#line 1695 "gutil.c"
{
#line 647 "../gutil.k"
		ID a_view =  kc_selvar_0_1;
#line 647 "../gutil.k"

	global_filterview = a_view;
	tmp_rewriteviewsinfo = Consrewriteviewsinfo( Rewriteviewinfo( a_view, filter_rewriterulesinfo( tmp_rewriterulesinfo, filterrewriteruleinfoonview )), tmp_rewriteviewsinfo );
    
#line 1704 "gutil.c"
}
}

#line 1708 "gutil.c"
}
kc_fe_selvar_1 = kc_fe_selvar_1->u.Consviewnames.viewnames_1;
#line 647 "../gutil.k"
/*SUPPRESS 622*/
assert_viewnames(kc_fe_selvar_1, "sublist_of_foreach_list_expression");

#line 1715 "gutil.c"
}
}
#line 651 "../gutil.k"
    return tmp_rewriteviewsinfo;

#line 652 "../gutil.k"
}
#line 1723 "gutil.c"

unparseviewsinfo f_unparseviewsinfoofalternatives
#ifdef KC_USE_PROTOTYPES
(alternatives a_alternatives, viewnames a_views)
#else
(a_alternatives, a_views) alternatives a_alternatives;
viewnames a_views;
#endif
#line 655 "../gutil.k"
{
    unparsedeclsinfo tmp_unparsedeclsinfo = f_unparsedeclsinfoofalternatives( a_alternatives );
    unparseviewsinfo tmp_unparseviewsinfo = Nilunparseviewsinfo();
    {
#line 658 "../gutil.k"
viewnames kc_fe_selvar_1 =  a_views ;
#line 658 "../gutil.k"
/*SUPPRESS 622*/
assert_viewnames(kc_fe_selvar_1, "foreach_list_expression");

#line 1743 "gutil.c"
while(
	kc_fe_selvar_1->prod_sel == sel_Consviewnames
	) {
ID kc_selvar_0_1 = kc_fe_selvar_1->u.Consviewnames.ID_1;
{
#line 658 "../gutil.k"
{
#line 658 "../gutil.k"
/*SUPPRESS 622*/
assert_ID(kc_selvar_0_1, "with_expression (1)");

#line 1755 "gutil.c"
{
#line 658 "../gutil.k"
		ID a_view =  kc_selvar_0_1;
#line 658 "../gutil.k"

	global_filterview = a_view;
	tmp_unparseviewsinfo = Consunparseviewsinfo( Unparseviewinfo( a_view, filter_unparsedeclsinfo( tmp_unparsedeclsinfo, filterunparsedeclinfoonview )), tmp_unparseviewsinfo );
    
#line 1764 "gutil.c"
}
}

#line 1768 "gutil.c"
}
kc_fe_selvar_1 = kc_fe_selvar_1->u.Consviewnames.viewnames_1;
#line 658 "../gutil.k"
/*SUPPRESS 622*/
assert_viewnames(kc_fe_selvar_1, "sublist_of_foreach_list_expression");

#line 1775 "gutil.c"
}
}
#line 662 "../gutil.k"
    return tmp_unparseviewsinfo;

#line 663 "../gutil.k"
}
#line 1783 "gutil.c"

static boolean filterrewriteruleinfoonview
#ifdef KC_USE_PROTOTYPES
(rewriteruleinfo a_rewriteruleinfo)
#else
(a_rewriteruleinfo) rewriteruleinfo a_rewriteruleinfo;
#endif
#line 666 "../gutil.k"
{
    return is_viewname_in_rewriteruleinfo( global_filterview, a_rewriteruleinfo );

#line 668 "../gutil.k"
}
#line 1797 "gutil.c"

static boolean filterunparsedeclinfoonview
#ifdef KC_USE_PROTOTYPES
(unparsedeclinfo a_unparsedeclinfo)
#else
(a_unparsedeclinfo) unparsedeclinfo a_unparsedeclinfo;
#endif
#line 671 "../gutil.k"
{
    return is_viewname_in_unparsedeclinfo( global_filterview, a_unparsedeclinfo );

#line 673 "../gutil.k"
}
#line 1811 "gutil.c"

static boolean is_viewname_in_rewriteruleinfo
#ifdef KC_USE_PROTOTYPES
(ID a_view, rewriteruleinfo a_rewriteruleinfo)
#else
(a_view, a_rewriteruleinfo) ID a_view;
rewriteruleinfo a_rewriteruleinfo;
#endif
#line 676 "../gutil.k"
{
    {
#line 677 "../gutil.k"
rewriteruleinfo kc_selvar_0_1 = 
 a_rewriteruleinfo 
;
#line 677 "../gutil.k"
/*SUPPRESS 622*/
assert_rewriteruleinfo(kc_selvar_0_1, "with_expression (1)");

#line 1831 "gutil.c"
		if (( kc_selvar_0_1->prod_sel == sel_Rewriteruleinfo) && ( kc_selvar_0_1->u.Rewriteruleinfo.rewriteclause_1->prod_sel == sel_RewriteClause)) {
#line 678 "../gutil.k"
		viewnames a_viewnames =  kc_selvar_0_1->u.Rewriteruleinfo.rewriteclause_1->u.RewriteClause.viewnames_1;
#line 678 "../gutil.k"

	    return is_viewname_in_viewnames( a_view, a_viewnames );

#line 1839 "gutil.c"
		} else
{ kc_no_default_in_with( "is_viewname_in_rewriteruleinfo", __LINE__, __FILE__ );
   return (boolean)0; }
}
#line 680 "../gutil.k"
   
#line 680 "../gutil.k"
}
#line 1848 "gutil.c"

static boolean is_viewname_in_unparsedeclinfo
#ifdef KC_USE_PROTOTYPES
(ID a_view, unparsedeclinfo a_unparsedeclinfo)
#else
(a_view, a_unparsedeclinfo) ID a_view;
unparsedeclinfo a_unparsedeclinfo;
#endif
#line 683 "../gutil.k"
{
    {
#line 684 "../gutil.k"
unparsedeclinfo kc_selvar_0_1 = 
 a_unparsedeclinfo 
;
#line 684 "../gutil.k"
/*SUPPRESS 622*/
assert_unparsedeclinfo(kc_selvar_0_1, "with_expression (1)");

#line 1868 "gutil.c"
		if (( kc_selvar_0_1->prod_sel == sel_Unparsedeclinfo) && ( kc_selvar_0_1->u.Unparsedeclinfo.unparseclause_1->prod_sel == sel_UnparseClause)) {
#line 685 "../gutil.k"
		viewnames a_viewnames =  kc_selvar_0_1->u.Unparsedeclinfo.unparseclause_1->u.UnparseClause.viewnames_1;
#line 685 "../gutil.k"

	    return is_viewname_in_viewnames( a_view, a_viewnames );

#line 1876 "gutil.c"
		} else
{ kc_no_default_in_with( "is_viewname_in_unparsedeclinfo", __LINE__, __FILE__ );
   return (boolean)0; }
}
#line 687 "../gutil.k"
   
#line 687 "../gutil.k"
}
#line 1885 "gutil.c"

static boolean is_viewname_in_viewnames
#ifdef KC_USE_PROTOTYPES
(ID a_view, viewnames a_viewnames)
#else
(a_view, a_viewnames) ID a_view;
viewnames a_viewnames;
#endif
#line 690 "../gutil.k"
{
    {
#line 691 "../gutil.k"
viewnames kc_fe_selvar_1 =  a_viewnames ;
#line 691 "../gutil.k"
/*SUPPRESS 622*/
assert_viewnames(kc_fe_selvar_1, "foreach_list_expression");

#line 1903 "gutil.c"
while(
	kc_fe_selvar_1->prod_sel == sel_Consviewnames
	) {
ID kc_selvar_0_1 = kc_fe_selvar_1->u.Consviewnames.ID_1;
{
#line 691 "../gutil.k"
{
#line 691 "../gutil.k"
/*SUPPRESS 622*/
assert_ID(kc_selvar_0_1, "with_expression (1)");

#line 1915 "gutil.c"
{
#line 691 "../gutil.k"
		ID a_viewname =  kc_selvar_0_1;
#line 691 "../gutil.k"

	if ( eq_ID( a_view, a_viewname ) ) {
	    return True;
    }   
#line 1924 "gutil.c"
}
}

#line 1928 "gutil.c"
}
kc_fe_selvar_1 = kc_fe_selvar_1->u.Consviewnames.viewnames_1;
#line 691 "../gutil.k"
/*SUPPRESS 622*/
assert_viewnames(kc_fe_selvar_1, "sublist_of_foreach_list_expression");

#line 1935 "gutil.c"
}
}
#line 695 "../gutil.k"
    return False;

#line 696 "../gutil.k"
}
#line 1943 "gutil.c"

static rewriterulesinfo f_rewriterulesinfoofalternatives
#ifdef KC_USE_PROTOTYPES
(alternatives a_alternatives)
#else
(a_alternatives) alternatives a_alternatives;
#endif
#line 705 "../gutil.k"
{
    rewriterulesinfo tmp = Nilrewriterulesinfo();
    {
#line 707 "../gutil.k"
alternatives kc_fe_selvar_1 =  a_alternatives ;
#line 707 "../gutil.k"
/*SUPPRESS 622*/
assert_alternatives(kc_fe_selvar_1, "foreach_list_expression");

#line 1961 "gutil.c"
while(
	kc_fe_selvar_1->prod_sel == sel_Consalternatives
	) {
alternative kc_selvar_0_1 = kc_fe_selvar_1->u.Consalternatives.alternative_1;
{
#line 707 "../gutil.k"
{
#line 707 "../gutil.k"
/*SUPPRESS 622*/
assert_alternative(kc_selvar_0_1, "with_expression (1)");

#line 1973 "gutil.c"
{
#line 707 "../gutil.k"
		alternative a_alternative =  kc_selvar_0_1;
#line 707 "../gutil.k"

	tmp = concat_rewriterulesinfo( a_alternative->rewriteinfo, tmp );
    
#line 1981 "gutil.c"
}
}

#line 1985 "gutil.c"
}
kc_fe_selvar_1 = kc_fe_selvar_1->u.Consalternatives.alternatives_1;
#line 707 "../gutil.k"
/*SUPPRESS 622*/
assert_alternatives(kc_fe_selvar_1, "sublist_of_foreach_list_expression");

#line 1992 "gutil.c"
}
}
#line 710 "../gutil.k"
    return tmp;

#line 711 "../gutil.k"
}
#line 2000 "gutil.c"

static unparsedeclsinfo f_unparsedeclsinfoofalternatives
#ifdef KC_USE_PROTOTYPES
(alternatives a_alternatives)
#else
(a_alternatives) alternatives a_alternatives;
#endif
#line 713 "../gutil.k"
{
    unparsedeclsinfo tmp = Nilunparsedeclsinfo();
    {
#line 715 "../gutil.k"
alternatives kc_fe_selvar_1 =  a_alternatives ;
#line 715 "../gutil.k"
/*SUPPRESS 622*/
assert_alternatives(kc_fe_selvar_1, "foreach_list_expression");

#line 2018 "gutil.c"
while(
	kc_fe_selvar_1->prod_sel == sel_Consalternatives
	) {
alternative kc_selvar_0_1 = kc_fe_selvar_1->u.Consalternatives.alternative_1;
{
#line 715 "../gutil.k"
{
#line 715 "../gutil.k"
/*SUPPRESS 622*/
assert_alternative(kc_selvar_0_1, "with_expression (1)");

#line 2030 "gutil.c"
{
#line 715 "../gutil.k"
		alternative a_alternative =  kc_selvar_0_1;
#line 715 "../gutil.k"

	tmp = concat_unparsedeclsinfo( a_alternative->unparseinfo, tmp );
    
#line 2038 "gutil.c"
}
}

#line 2042 "gutil.c"
}
kc_fe_selvar_1 = kc_fe_selvar_1->u.Consalternatives.alternatives_1;
#line 715 "../gutil.k"
/*SUPPRESS 622*/
assert_alternatives(kc_fe_selvar_1, "sublist_of_foreach_list_expression");

#line 2049 "gutil.c"
}
}
#line 718 "../gutil.k"
    return tmp;

#line 719 "../gutil.k"
}
#line 2057 "gutil.c"

ID f_typeof
#ifdef KC_USE_PROTOTYPES
(path a_path)
#else
(a_path) path a_path;
#endif
#line 722 "../gutil.k"
{
	if (eq_ID(a_path->id, f_emptyId())) {
    	{
#line 724 "../gutil.k"
path kc_selvar_0_1 = 
 a_path 
;
#line 724 "../gutil.k"
/*SUPPRESS 622*/
assert_path(kc_selvar_0_1, "with_expression (1)");

#line 2077 "gutil.c"
		if (( kc_selvar_0_1->prod_sel == sel_Conspath)) {
#line 728 "../gutil.k"
		int i =  kc_selvar_0_1->u.Conspath.int_1;
#line 728 "../gutil.k"
		path r_path =  kc_selvar_0_1->u.Conspath.path_1;
#line 728 "../gutil.k"

			    return f_subphylumofoperator( r_path->op, Int( i ) );
		   
#line 2087 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_Nilpath)) {
#line 725 "../gutil.k"

	    		return f_phylumofoperator( a_path->op );
			
#line 2094 "gutil.c"
		} else
{ kc_no_default_in_with( "f_typeof", __LINE__, __FILE__ );
   return (ID)0; }
}
#line 731 "../gutil.k"
	} else {
		return a_path->id;
	}

#line 734 "../gutil.k"
}
#line 2106 "gutil.c"

ID f_operatorofpatternrepresentation
#ifdef KC_USE_PROTOTYPES
(patternrepresentation a_patternrepresentation)
#else
(a_patternrepresentation) patternrepresentation a_patternrepresentation;
#endif
#line 737 "../gutil.k"
{
    {
#line 738 "../gutil.k"
patternrepresentation kc_selvar_0_1 = 
 a_patternrepresentation 
;
#line 738 "../gutil.k"
/*SUPPRESS 622*/
assert_patternrepresentation(kc_selvar_0_1, "with_expression (1)");

#line 2125 "gutil.c"
		if (( kc_selvar_0_1->prod_sel == sel_Conspatternrepresentation)) {
#line 742 "../gutil.k"
		elem_patternrepresentation e =  kc_selvar_0_1->u.Conspatternrepresentation.elem_patternrepresentation_1;
#line 742 "../gutil.k"

	    return f_operatorofelem_patternrepresentation( e );

#line 2133 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_Nilpatternrepresentation)) {
#line 739 "../gutil.k"

	    return f_emptyId();
	
#line 2140 "gutil.c"
		} else
{ kc_no_default_in_with( "f_operatorofpatternrepresentation", __LINE__, __FILE__ );
   return (ID)0; }
}
#line 744 "../gutil.k"
   
#line 744 "../gutil.k"
}
#line 2149 "gutil.c"

static ID f_operatorofelem_patternrepresentation
#ifdef KC_USE_PROTOTYPES
(elem_patternrepresentation a_elem_patternrepresentation)
#else
(a_elem_patternrepresentation) elem_patternrepresentation a_elem_patternrepresentation;
#endif
#line 747 "../gutil.k"
{
    {
#line 748 "../gutil.k"
elem_patternrepresentation kc_selvar_0_1 = 
 a_elem_patternrepresentation 
;
#line 748 "../gutil.k"
/*SUPPRESS 622*/
assert_elem_patternrepresentation(kc_selvar_0_1, "with_expression (1)");

#line 2168 "gutil.c"
		if (( kc_selvar_0_1->prod_sel == sel_PRIntLiteral)) {
#line 756 "../gutil.k"
		path p =  kc_selvar_0_1->u.PRIntLiteral.path_1;
#line 756 "../gutil.k"
 return f_operatorofpath( p ); 
#line 2174 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_PRStringLiteral)) {
#line 755 "../gutil.k"
		path p =  kc_selvar_0_1->u.PRStringLiteral.path_1;
#line 755 "../gutil.k"
 return f_operatorofpath( p ); 
#line 2181 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_PRWildcard)) {
#line 754 "../gutil.k"
		path p =  kc_selvar_0_1->u.PRWildcard.path_1;
#line 754 "../gutil.k"
 return f_operatorofpath( p ); 
#line 2188 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_PRDefault)) {
#line 753 "../gutil.k"
 return f_emptyId(); 
#line 2193 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_PRNonLeafBinding)) {
#line 752 "../gutil.k"
		path p =  kc_selvar_0_1->u.PRNonLeafBinding.path_1;
#line 752 "../gutil.k"
 return f_operatorofpath( p ); 
#line 2200 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_PROperPredicate)) {
#line 751 "../gutil.k"
		path p =  kc_selvar_0_1->u.PROperPredicate.path_1;
#line 751 "../gutil.k"
 return f_operatorofpath( p ); 
#line 2207 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_PRVarPredicate)) {
#line 750 "../gutil.k"
		paths ps =  kc_selvar_0_1->u.PRVarPredicate.paths_1;
#line 750 "../gutil.k"
 return f_operatorofpaths( ps ); 
#line 2214 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_PRBinding)) {
#line 749 "../gutil.k"
		path p =  kc_selvar_0_1->u.PRBinding.path_1;
#line 749 "../gutil.k"
 return f_operatorofpath( p ); 
#line 2221 "gutil.c"
		} else
{ kc_no_default_in_with( "f_operatorofelem_patternrepresentation", __LINE__, __FILE__ );
   return (ID)0; }
}
#line 757 "../gutil.k"
   
#line 757 "../gutil.k"
}
#line 2230 "gutil.c"

static ID f_operatorofpaths
#ifdef KC_USE_PROTOTYPES
(paths a_paths)
#else
(a_paths) paths a_paths;
#endif
#line 760 "../gutil.k"
{
    {
#line 761 "../gutil.k"
paths kc_selvar_0_1 = 
 a_paths 
;
#line 761 "../gutil.k"
/*SUPPRESS 622*/
assert_paths(kc_selvar_0_1, "with_expression (1)");

#line 2249 "gutil.c"
		if (( kc_selvar_0_1->prod_sel == sel_Conspaths)) {
#line 765 "../gutil.k"
		path p =  kc_selvar_0_1->u.Conspaths.path_1;
#line 765 "../gutil.k"

	    return f_operatorofpath( p );

#line 2257 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_Nilpaths)) {
#line 762 "../gutil.k"

	    return f_emptyId();
	
#line 2264 "gutil.c"
		} else
{ kc_no_default_in_with( "f_operatorofpaths", __LINE__, __FILE__ );
   return (ID)0; }
}
#line 767 "../gutil.k"
   
#line 767 "../gutil.k"
}
#line 2273 "gutil.c"

static ID f_operatorofpath
#ifdef KC_USE_PROTOTYPES
(path a_path)
#else
(a_path) path a_path;
#endif
#line 770 "../gutil.k"
{
    {
#line 771 "../gutil.k"
path kc_selvar_0_1 = 
 a_path 
;
#line 771 "../gutil.k"
/*SUPPRESS 622*/
assert_path(kc_selvar_0_1, "with_expression (1)");

#line 2292 "gutil.c"
		if (( kc_selvar_0_1->prod_sel == sel_Conspath)) {
#line 775 "../gutil.k"
		path r_path =  kc_selvar_0_1->u.Conspath.path_1;
#line 775 "../gutil.k"

	    return r_path->op;

#line 2300 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_Nilpath)) {
#line 772 "../gutil.k"

	    return a_path->op;
	
#line 2307 "gutil.c"
		} else
{ kc_no_default_in_with( "f_operatorofpath", __LINE__, __FILE__ );
   return (ID)0; }
}
#line 777 "../gutil.k"
   
#line 777 "../gutil.k"
}
#line 2316 "gutil.c"

ID f_typeofunpsubterm
#ifdef KC_USE_PROTOTYPES
(unpsubterm a_unpsubterm, ID a_operator)
#else
(a_unpsubterm, a_operator) unpsubterm a_unpsubterm;
ID a_operator;
#endif
#line 780 "../gutil.k"
{
    {
#line 781 "../gutil.k"
unpsubterm kc_selvar_0_1 = 
 a_unpsubterm 
;
#line 781 "../gutil.k"
/*SUPPRESS 622*/
assert_unpsubterm(kc_selvar_0_1, "with_expression (1)");

#line 2336 "gutil.c"
		if (( kc_selvar_0_1->prod_sel == sel_UnpCastedVariable)) {
#line 786 "../gutil.k"
		ID a_cast =  kc_selvar_0_1->u.UnpCastedVariable.ID_1;
#line 786 "../gutil.k"
 return a_cast; 
#line 2342 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_UnpDollarvarAttr)) {
#line 785 "../gutil.k"
		INT i =  kc_selvar_0_1->u.UnpDollarvarAttr.INT_1;
#line 785 "../gutil.k"
		unpattributes a_unpattributes =  kc_selvar_0_1->u.UnpDollarvarAttr.unpattributes_1;
#line 785 "../gutil.k"
 return f_check_unpattributes_in_phylum( a_unpattributes, f_subphylumofoperator( a_operator, i ) ); 
#line 2351 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_UnpSubAttr)) {
#line 784 "../gutil.k"
		ID an_id =  kc_selvar_0_1->u.UnpSubAttr.ID_1;
#line 784 "../gutil.k"
		unpattributes an_unpattributes =  kc_selvar_0_1->u.UnpSubAttr.unpattributes_1;
#line 784 "../gutil.k"
 return f_check_unpattributes_in_phylum( an_unpattributes, f_phylumofpatternID( an_id ) ); 
#line 2360 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_UnpDollarvarTerm)) {
#line 783 "../gutil.k"
		INT i =  kc_selvar_0_1->u.UnpDollarvarTerm.INT_1;
#line 783 "../gutil.k"
 return f_subphylumofoperator( a_operator, i ); 
#line 2367 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_UnpSubTerm)) {
#line 782 "../gutil.k"
		ID a_id =  kc_selvar_0_1->u.UnpSubTerm.ID_1;
#line 782 "../gutil.k"
 return f_phylumofpatternID( a_id ); 
#line 2374 "gutil.c"
		} else
{ kc_no_default_in_with( "f_typeofunpsubterm", __LINE__, __FILE__ );
   return (ID)0; }
}
#line 787 "../gutil.k"
   
#line 787 "../gutil.k"
}
#line 2383 "gutil.c"

boolean f_outmost_nl_preds_in_rewriterulesinfo
#ifdef KC_USE_PROTOTYPES
(rewriterulesinfo ri)
#else
(ri) rewriterulesinfo ri;
#endif
#line 793 "../gutil.k"
{
    {
#line 794 "../gutil.k"
rewriterulesinfo kc_selvar_0_1 = 
 ri 
;
#line 794 "../gutil.k"
/*SUPPRESS 622*/
assert_rewriterulesinfo(kc_selvar_0_1, "with_expression (1)");

#line 2402 "gutil.c"
		if (( kc_selvar_0_1->prod_sel == sel_Consrewriterulesinfo) && ( kc_selvar_0_1->u.Consrewriterulesinfo.rewriteruleinfo_1->prod_sel == sel_Rewriteruleinfo)) {
#line 796 "../gutil.k"
		patternrepresentation preds =  kc_selvar_0_1->u.Consrewriterulesinfo.rewriteruleinfo_1->u.Rewriteruleinfo.patternrepresentation_1;
#line 796 "../gutil.k"
		rewriterulesinfo r_ri =  kc_selvar_0_1->u.Consrewriterulesinfo.rewriterulesinfo_1;
#line 796 "../gutil.k"

	    return (boolean) (f_outmost_nl_preds_in_patternrepresentation( preds )
		    	     || f_outmost_nl_preds_in_rewriterulesinfo( r_ri ));

#line 2413 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_Nilrewriterulesinfo)) {
#line 795 "../gutil.k"
 return False; 
#line 2418 "gutil.c"
		} else
{ kc_no_default_in_with( "f_outmost_nl_preds_in_rewriterulesinfo", __LINE__, __FILE__ );
   return (boolean)0; }
}
#line 799 "../gutil.k"
   
#line 799 "../gutil.k"
}
#line 2427 "gutil.c"

static boolean f_outmost_nl_preds_in_patternrepresentation
#ifdef KC_USE_PROTOTYPES
(patternrepresentation p)
#else
(p) patternrepresentation p;
#endif
#line 802 "../gutil.k"
{
    {
#line 803 "../gutil.k"
patternrepresentation kc_selvar_0_1 = 
 p 
;
#line 803 "../gutil.k"
/*SUPPRESS 622*/
assert_patternrepresentation(kc_selvar_0_1, "with_expression (1)");

#line 2446 "gutil.c"
		if (( kc_selvar_0_1->prod_sel == sel_Conspatternrepresentation)) {
#line 805 "../gutil.k"
		elem_patternrepresentation a_p =  kc_selvar_0_1->u.Conspatternrepresentation.elem_patternrepresentation_1;
#line 805 "../gutil.k"
		patternrepresentation r_p =  kc_selvar_0_1->u.Conspatternrepresentation.patternrepresentation_1;
#line 805 "../gutil.k"

	    return (boolean) (f_outmost_nl_preds_in_elem_patternrepresentation( a_p )
		    	    || f_outmost_nl_preds_in_patternrepresentation( r_p ));

#line 2457 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_Nilpatternrepresentation)) {
#line 804 "../gutil.k"
 return False; 
#line 2462 "gutil.c"
		} else
{ kc_no_default_in_with( "f_outmost_nl_preds_in_patternrepresentation", __LINE__, __FILE__ );
   return (boolean)0; }
}
#line 808 "../gutil.k"
   
#line 808 "../gutil.k"
}
#line 2471 "gutil.c"

static boolean f_outmost_nl_preds_in_elem_patternrepresentation
#ifdef KC_USE_PROTOTYPES
(elem_patternrepresentation e_p)
#else
(e_p) elem_patternrepresentation e_p;
#endif
#line 811 "../gutil.k"
{
    {
#line 812 "../gutil.k"
elem_patternrepresentation kc_selvar_0_1 = 
 e_p 
;
#line 812 "../gutil.k"
/*SUPPRESS 622*/
assert_elem_patternrepresentation(kc_selvar_0_1, "with_expression (1)");

#line 2490 "gutil.c"
		if (( kc_selvar_0_1->prod_sel == sel_PRIntLiteral)) {
#line 822 "../gutil.k"
 return False; 
#line 2494 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_PRStringLiteral)) {
#line 821 "../gutil.k"
 return False; 
#line 2499 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_PRWildcard)) {
#line 820 "../gutil.k"
 return False; 
#line 2504 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_PRDefault)) {
#line 819 "../gutil.k"
 return False; 
#line 2509 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_PRNonLeafBinding)) {
#line 818 "../gutil.k"
 return False; 
#line 2514 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_PROperPredicate)) {
#line 817 "../gutil.k"
 return False; 
#line 2519 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_PRVarPredicate)) {
#line 814 "../gutil.k"
		paths a_p =  kc_selvar_0_1->u.PRVarPredicate.paths_1;
#line 814 "../gutil.k"

	    return f_outmost_nl_preds_in_paths( a_p );
	
#line 2528 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_PRBinding)) {
#line 813 "../gutil.k"
 return False; 
#line 2533 "gutil.c"
		} else
{ kc_no_default_in_with( "f_outmost_nl_preds_in_elem_patternrepresentation", __LINE__, __FILE__ );
   return (boolean)0; }
}
#line 823 "../gutil.k"
   
#line 823 "../gutil.k"
}
#line 2542 "gutil.c"

static boolean f_outmost_nl_preds_in_paths
#ifdef KC_USE_PROTOTYPES
(paths p)
#else
(p) paths p;
#endif
#line 826 "../gutil.k"
{
    {
#line 827 "../gutil.k"
paths kc_selvar_0_1 = 
 p 
;
#line 827 "../gutil.k"
/*SUPPRESS 622*/
assert_paths(kc_selvar_0_1, "with_expression (1)");

#line 2561 "gutil.c"
		if (( kc_selvar_0_1->prod_sel == sel_Conspaths) && ( kc_selvar_0_1->u.Conspaths.path_1->prod_sel == sel_Conspath)) {
#line 830 "../gutil.k"
		paths r_p =  kc_selvar_0_1->u.Conspaths.paths_1;
#line 830 "../gutil.k"

	    return f_outmost_nl_preds_in_paths( r_p );

#line 2569 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_Conspaths) && ( kc_selvar_0_1->u.Conspaths.path_1->prod_sel == sel_Nilpath)) {
#line 829 "../gutil.k"
 return True; 
#line 2574 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_Nilpaths)) {
#line 828 "../gutil.k"
 return False; 
#line 2579 "gutil.c"
		} else
{ kc_no_default_in_with( "f_outmost_nl_preds_in_paths", __LINE__, __FILE__ );
   return (boolean)0; }
}
#line 832 "../gutil.k"
   
#line 832 "../gutil.k"
}
#line 2588 "gutil.c"

boolean f_is_known_ptr_type
#ifdef KC_USE_PROTOTYPES
(ID id)
#else
(id) ID id;
#endif
#line 851 "../gutil.k"
{
	static phylumnames known = 0;

	if (! known ) {		
		known = Nilphylumnames();
		known = Consphylumnames( Id( Str( mkcasestring( "kc_voidptr_t" ))), known );
		known = Consphylumnames( Id( Str( mkcasestring( "kc_malloc_t" ))), known );
		known = Consphylumnames( Id( Str( mkcasestring( "kc_voidfnptr_t" ))), known );
		known = Consphylumnames( Id( Str( mkcasestring( "kc_realloc_arg_t" ))), known );
		known = Consphylumnames( Id( Str( mkcasestring( "kc_size_t" ))), known );
		known = Consphylumnames( Id( Str( mkcasestring( "size_t" ))), known );
		known = Consphylumnames( Id( Str( mkcasestring( "unsigned" ))), known );
		known = Consphylumnames( Id( Str( mkcasestring( "kc_memset_size_t" ))), known );
		known = Consphylumnames( Id( Str( mkcasestring( "kc_memory_blocksinfo_t" ))), known );
		known = Consphylumnames( Id( Str( mkcasestring( "kc_enum_phyla" ))), known );
		known = Consphylumnames( Id( Str( mkcasestring( "kc_enum_operators" ))), known );
		known = Consphylumnames( Id( Str( mkcasestring( "kc_enum_phyla_list" ))), known );
		known = Consphylumnames( Id( Str( mkcasestring( "kc_size_t_list" ))), known );
		known = Consphylumnames( Id( Str( mkcasestring( "KC_UNIQ_INFO" ))), known );
		known = Consphylumnames( Id( Str( mkcasestring( "kc_hashnode_t" ))), known );
		known = Consphylumnames( Id( Str( mkcasestring( "kc_tp_boolean" ))), known );
		known = Consphylumnames( Id( Str( mkcasestring( "boolean" ))), known );
		known = Consphylumnames( Id( Str( mkcasestring( "kc_hastable_storage_mode_t" ))), known );
		known = Consphylumnames( Id( Str( mkcasestring( "kc_hashtable_t" ))), known );
		known = Consphylumnames( Id( Str( mkcasestring( "kc_private_malloc_t" ))), known );
		known = Consphylumnames( Id( Str( mkcasestring( "kc_Align" ))), known );
		known = Consphylumnames( Id( Str( mkcasestring( "kc_qsort_firstarg_t" ))), known );
		known = Consphylumnames( Id( Str( mkcasestring( "KC_IO_STATUS" ))), known );
		known = Consphylumnames( Id( Str( mkcasestring( "view" ))), known );
		known = Consphylumnames( Id( Str( mkcasestring( "uview" ))), known );
		known = Consphylumnames( Id( Str( mkcasestring( "rview" ))), known );
	}
	{
#line 883 "../gutil.k"
phylumnames kc_fe_selvar_1 =  known ;
#line 883 "../gutil.k"
/*SUPPRESS 622*/
assert_phylumnames(kc_fe_selvar_1, "foreach_list_expression");

#line 2636 "gutil.c"
while(
	kc_fe_selvar_1->prod_sel == sel_Consphylumnames
	) {
ID kc_selvar_0_1 = kc_fe_selvar_1->u.Consphylumnames.ID_1;
{
#line 883 "../gutil.k"
{
#line 883 "../gutil.k"
/*SUPPRESS 622*/
assert_ID(kc_selvar_0_1, "with_expression (1)");

#line 2648 "gutil.c"
{
#line 883 "../gutil.k"
		ID pn =  kc_selvar_0_1;
#line 883 "../gutil.k"

		if ( eq_ID( pn, id )) {
			return True;
	}	
#line 2657 "gutil.c"
}
}

#line 2661 "gutil.c"
}
kc_fe_selvar_1 = kc_fe_selvar_1->u.Consphylumnames.phylumnames_1;
#line 883 "../gutil.k"
/*SUPPRESS 622*/
assert_phylumnames(kc_fe_selvar_1, "sublist_of_foreach_list_expression");

#line 2668 "gutil.c"
}
}
#line 887 "../gutil.k"
	return False;

#line 888 "../gutil.k"
}
#line 2676 "gutil.c"

withcasesinfo my_rewrite_withcasesinfo
#ifdef KC_USE_PROTOTYPES
(withcasesinfo a_withcasesinfo)
#else
(a_withcasesinfo) withcasesinfo a_withcasesinfo;
#endif
#line 912 "../gutil.k"
{{
#line 911 "../gutil.k"
withcasesinfo kc_selvar_0_1 = a_withcasesinfo;
#line 911 "../gutil.k"
/*SUPPRESS 622*/
assert_withcasesinfo(kc_selvar_0_1, "with_expression (1)");

#line 2692 "gutil.c"
		if (( kc_selvar_0_1->prod_sel == sel_Conswithcasesinfo) && ( kc_selvar_0_1->u.Conswithcasesinfo.withcaseinfo_1->prod_sel == sel_Withcaseinfo)) {
#line 914 "../gutil.k"
		patternrepresentation p =  kc_selvar_0_1->u.Conswithcasesinfo.withcaseinfo_1->u.Withcaseinfo.patternrepresentation_1;
#line 914 "../gutil.k"
		patternrepresentation b =  kc_selvar_0_1->u.Conswithcasesinfo.withcaseinfo_1->u.Withcaseinfo.patternrepresentation_2;
#line 914 "../gutil.k"
		Ctext ct =  kc_selvar_0_1->u.Conswithcasesinfo.withcaseinfo_1->u.Withcaseinfo.Ctext_1;
#line 914 "../gutil.k"
		withcasesinfo r =  kc_selvar_0_1->u.Conswithcasesinfo.withcasesinfo_1;
#line 914 "../gutil.k"

		return Conswithcasesinfo(
				Withcaseinfo(
				  rewrite_patternrepresentation(p, base_rview), b, ct ),
				my_rewrite_withcasesinfo( r ) );
	
#line 2709 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_Nilwithcasesinfo)) {
#line 913 "../gutil.k"
 return kc_selvar_0_1; 
#line 2714 "gutil.c"
		} else
{ kc_no_default_in_with( "my_rewrite_withcasesinfo", __LINE__, __FILE__ );
   return (withcasesinfo)0; }
}

#line 920 "../gutil.k"
}
#line 2722 "gutil.c"

int pos_of_sole_dollar_or_pattern_in_patternchain
#ifdef KC_USE_PROTOTYPES
(patternchain a_patternchain)
#else
(a_patternchain) patternchain a_patternchain;
#endif
#line 938 "../gutil.k"
{
	return t_pos_of_sole_dollar_or_pattern_in_patternchain(a_patternchain, -2, 1);


#line 941 "../gutil.k"
}
#line 2737 "gutil.c"

int t_pos_of_sole_dollar_or_pattern_in_patternchain
#ifdef KC_USE_PROTOTYPES
(patternchain a_patternchain, int tmp_result, int pos)
#else
(a_patternchain, tmp_result, pos) patternchain a_patternchain;
int tmp_result;
int pos;
#endif
#line 944 "../gutil.k"
{
	if (tmp_result == -1) { 
		return tmp_result;
	}
	{
#line 948 "../gutil.k"
patternchain kc_selvar_0_1 = 
 a_patternchain 
;
#line 948 "../gutil.k"
/*SUPPRESS 622*/
assert_patternchain(kc_selvar_0_1, "with_expression (1)");

#line 2761 "gutil.c"
		if (( kc_selvar_0_1->prod_sel == sel_Nilpatternchain)) {
#line 986 "../gutil.k"

			return tmp_result;
		
#line 2767 "gutil.c"
		} else
		if (( kc_selvar_0_1->prod_sel == sel_Conspatternchain)) {
#line 949 "../gutil.k"
		patternchainitem h =  kc_selvar_0_1->u.Conspatternchain.patternchainitem_1;
#line 949 "../gutil.k"
		patternchain t =  kc_selvar_0_1->u.Conspatternchain.patternchain_1;
#line 949 "../gutil.k"

			tmp_result = t_pos_of_sole_dollar_or_pattern_in_patternchain( t, tmp_result, pos+1 );
			if (tmp_result == -1) { 
				return tmp_result;
			}
			{
#line 954 "../gutil.k"
patternchainitem kc_selvar_1_1 = 
 h 
;
#line 954 "../gutil.k"
/*SUPPRESS 622*/
assert_patternchainitem(kc_selvar_1_1, "with_expression (1)");

#line 2789 "gutil.c"
		if (( kc_selvar_1_1->prod_sel == sel_PatternchainitemDollarid)) {
#line 980 "../gutil.k"

					if (tmp_result >= 0) {
						return -1; 
					} else {
						return pos;
		}	
#line 2798 "gutil.c"
		} else
		if (( kc_selvar_1_1->prod_sel == sel_PatternchainitemGroup)) {
#line 977 "../gutil.k"

					return -1; 
				
#line 2805 "gutil.c"
		} else
		if (( kc_selvar_1_1->prod_sel == sel_PatternchainitemOutmost)) {
#line 955 "../gutil.k"
		outmostpattern p =  kc_selvar_1_1->u.PatternchainitemOutmost.outmostpattern_1;
#line 955 "../gutil.k"

					{
#line 956 "../gutil.k"
outmostpattern kc_selvar_2_1 = 
 p 
;
#line 956 "../gutil.k"
/*SUPPRESS 622*/
assert_outmostpattern(kc_selvar_2_1, "with_expression (1)");

#line 2821 "gutil.c"
		if (( kc_selvar_2_1->prod_sel == sel_OPOperatorWildcard)) {
#line 957 "../gutil.k"
		ID id =  kc_selvar_2_1->u.OPOperatorWildcard.ID_1;
#line 957 "../gutil.k"

							{
#line 958 "../gutil.k"
ID kc_selvar_3_1 = 
 id 
;
#line 958 "../gutil.k"
/*SUPPRESS 622*/
assert_ID(kc_selvar_3_1, "with_expression (1)");

#line 2836 "gutil.c"
		if (( kc_selvar_3_1->prod_sel == sel_Id)) {
#line 959 "../gutil.k"
		uniqID uid =  kc_selvar_3_1->u.Id.uniqID_1;
#line 959 "../gutil.k"

								    {
#line 960 "../gutil.k"
IDtype kc_selvar_4_1 = 
 uid->type 
;
#line 960 "../gutil.k"
/*SUPPRESS 622*/
assert_IDtype(kc_selvar_4_1, "with_expression (1)");

#line 2851 "gutil.c"
		if (( kc_selvar_4_1->prod_sel == sel_ITUnknown)) {
#line 962 "../gutil.k"
 
											return tmp_result;
										
#line 2857 "gutil.c"
		} else
		if (( kc_selvar_4_1->prod_sel == sel_ITPatternVariable)) {
#line 962 "../gutil.k"
 
											return tmp_result;
										
#line 2864 "gutil.c"
		} else
{
#line 965 "../gutil.k"

											if (tmp_result >= 0) {
												return -1; 
											} else {
												return pos;
						}	
#line 2874 "gutil.c"
}
}
#line 970 "../gutil.k"
	
#line 2879 "gutil.c"
		} else
{ kc_no_default_in_with( "t_pos_of_sole_dollar_or_pattern_in_patternchain", __LINE__, __FILE__ );
   return (int)0; }
}
#line 970 "../gutil.k"
	
#line 2886 "gutil.c"
		} else
{
#line 971 "../gutil.k"

							if (tmp_result >= 0) {
								return -1; 
							} else {
								return pos;
				}	
#line 2896 "gutil.c"
}
}
#line 976 "../gutil.k"
	
#line 2901 "gutil.c"
		} else
{ kc_no_default_in_with( "t_pos_of_sole_dollar_or_pattern_in_patternchain", __LINE__, __FILE__ );
   return (int)0; }
}
#line 985 "../gutil.k"
	
#line 2908 "gutil.c"
		} else
{ kc_no_default_in_with( "t_pos_of_sole_dollar_or_pattern_in_patternchain", __LINE__, __FILE__ );
   return (int)0; }
}
#line 990 "../gutil.k"

#line 990 "../gutil.k"
}
#line 2917 "gutil.c"

