%{ CODE HEADER
/*
 * The Termprocessor Kimwitu
 *
 * Copyright (c) 1991 University of Twente, Dept TIOS.
 * All rights reserved.
 *
 */
%}
/*
 * gen.k
 */
%{
#if ! (defined(lint) || defined(SABER) || defined(CODECENTER))
  static char gen_kAccesSid[] = "@(#)$Id: gen.k,v 1.94 1998/03/18 17:52:27 belinfan Rel $";
#endif
%}
/******
 TODO:
   Suppress the Saber RunTime under/overflow detection (if possible) in the hash code
 ******/

/***************************************************************************/

/* first of all: the declarations of the views that we use! */

%uview
	view_filename,
	view_error,
	view_error_tID,
	view_check,
	view_check_count,
	view_check_count1,
	view_check_outmostopers_in_phylum,
	view_set_type,
	view_check_is_var,
	view_gen_initializephyla_c,
	view_check_u,
	view_check_r,
	view_check_viewnames,
	view_init_stacks,
	view_check_uniq,
	view_check_uniq1,
	view_check_uniq2,
	view_make_patternreps,
	view_printer_outputfileline,
	view_printer_reset,
	view_no_of_printed_string_chars_reset,
	view_gen_k_h,
	view_gen_end_k_h,
	view_gen_k_c,
	view_gen_alloc_h,
	view_gen_alloc_c,
	view_gen_enumphyla_h,
	view_gen_enumoperators_h,
	view_gen_operatormap_type_h,
	view_gen_phylummap_c,
	view_gen_operatormap_c,
	view_count_args,
	view_gen_operatormap_operator_fn,
	view_gen_prodsel_fnarg_and_decls,
	view_gen_prodsel_fnargs,
	view_gen_prodsel_fnargdecls,
	view_gen_operatormap_subphyla,
	view_gen_operatormap_suboffsets,
	view_gen_uniqmap_c,
	view_gen_uniqmap_c_1,
	view_gen_uniqmap_c_2,
	view_gen_nodetypedefs_h,
	view_gen_nodetypes_h,
	view_gen_yaccstacktype_h,
	view_gen_noofoperators_h,
	view_gen_booleans_h,
	view_gen_initialization_h,
	view_gen_initialization_c,
	view_gen_assertmacros_h,
	view_gen_operatordecls_h,
	view_gen_operatordefs_c,
	view_gen_operatordefs_c_0,
	view_gen_operatordefs_c_1,
	view_gen_operatordefs_c_2,
	view_gen_operatordefs_c_2a,
	view_gen_operatordefs_c_3,
	view_gen_operatordefs_c_3a,
	view_gen_operatordefs_c_4,
	view_gen_operatordefs_c_4z,
	view_gen_operatordefs_c_4a,
	view_gen_initializephyla_assert_c,
	view_gen_initializephyla_whiletest_c,
	view_gen_initializephyla_init_el_c,
	view_gen_initializephyla_update_loop_c,
	view_gen_operatordefs_nonhash_c,
	view_gen_operatordefs_hash_c,
	view_gen_argseqnr,
	view_gen_fnargs,
	view_gen_fnargdecls,
	view_gen_fnarg_and_decls,
	view_gen_asserts,
	view_gen_assignments,
	view_gen_hash,
	view_gen_test,
	view_gen_error_decls_h,
	view_gen_error_defs_c,
	view_gen_freedecls_h,
	view_gen_freedefs_c,
	view_gen_eqdecls_h,
	view_gen_eqdefs_c,
	view_gen_eqdefs_bigatom_c,
	view_gen_eqdefs_bigatom_do_c,
	view_gen_printdecls_h,
	view_gen_printdefs_c,
	view_gen_printdefs_bigatom_c,
	view_gen_printdefs_bigatom_do_c,
	view_gen_printdotdecls_h,
	view_gen_printdotdefs_c,
	view_gen_printdotdecls_c,
	view_gen_printdotdefs_bigatom_c,
	view_gen_printdotdefs_bigatom_do_c,
	view_gen_printdotedges_c,
	view_gen_listdecls_h,
	view_gen_listdefs_c,
	view_gen_includes,
	view_do_gen_includes,
	view_gen_csgio_start_h,
	view_gen_csgio_end_h,
	view_gen_csgio_h,
	view_gen_csgio_start_c,
	view_gen_csgio_c,
	view_gen_csgio_c_read,
	view_gen_csgio_c_write,
	view_gen_csgio_bigatom_arguse_c,
	view_gen_csgio_bigatom_do_arguse_c,
	view_gen_csgio_scandef_c,
	view_gen_csgio_scandefs_c,
	view_gen_csgio_scandef_bigatom_c,
	view_gen_csgio_scandef_bigatom_do_c,
	view_gen_csgio_write2structuredefs_c,
	view_gen_csgio_write2structuredef_c,
	view_gen_csgio_write2structuredef_bigatom_c,
	view_gen_csgio_write2structuredef_bigatom_do_c,
	view_gen_csgio_writephylumdef_scan_c,
	view_gen_csgio_writephylumdef_write_c,
	view_gen_copy_attributes_c,
	view_gen_copy_attributes_c_doit,
	view_gen_copydecls_h,
	view_gen_copydefs_c,
	view_gen_copydefs_bigatom_argdefs_c,
	view_gen_copydefs_bigatom_argset_c,
	view_gen_copydefs_bigatom_arguse_c,
	view_gen_copydefs_bigatom_do_arguse_c,
	view_gen_rewritek_h,
	view_gen_end_rewritek_h,
	view_gen_rewritek_c,
	view_gen_rewritedecls_h,
	view_gen_rewritedefs_c,
	view_gen_rewritedefs_default_c,
	view_gen_rewritedefs_other_c,
	view_gen_rewritedefs_rewritearg_c,
	view_gen_rewritedefs_nl_arg_c,
	view_gen_rewritedefs_testarg_c,
	view_gen_rewritedefs_dotestarg_c,
	view_gen_rewritedefs_args_c,
	view_gen_withcases_and_default,
	view_rw_predicates,
	view_wc_predicates,
	view_unp_predicates,
	view_wc_bindings,
	view_unp_bindings,
	view_rw_bindings,
	view_gen_fnk_h,
	view_gen_fnkdecls_c,
	view_gen_fnk_c,
	view_gen_fnkarg_and_decls,
	view_gen_fn_pointer_name,
	view_gen_fnkargs,
	view_gen_fnkdecls,
	view_gen_fns_start_h,
	view_gen_fns_end_h,
	view_gen_fns_start_c,
	view_gen_fns_owninclude_c,
	view_gen_unpk_h,
	view_gen_unparsedecls_h,
	view_uview_def,
	view_gen_end_unpk_h,
	view_gen_unpk_c,
	view_gen_default_types_unpk_c,
	view_gen_unparsedefs_c,
	view_gen_unparsedefs_default_c,
	view_gen_unparsedefs_other_c,
	view_gen_unpstr_c
;

/***************************************************************************/

PhylumDeclarations( * )			-> [view_printer_outputfileline: {/*EMPTY*/} ];
PhylumDeclarations( * )			-> [view_printer_reset: {/*EMPTY*/} ];
PhylumDeclarations( * )			-> [view_no_of_printed_string_chars_reset: {/*EMPTY*/} ];
/***************************************************************************/
Nilfnfiles()				-> [: {/*EMPTY*/} ];
Consfnfiles( f, r_f )			-> [:
	r_f
"	\"" f "\"
"
					];

/***************************************************************************/

PhylumDeclarations( * )			-> [view_gen_k_h:
"/* translation of file(s)
"
(fnfiles)Thefnfiles
" */
/* generated by:
 *	" (charptr)kimwitu_copyright "
 */
#ifndef KC_TYPES_HEADER
#define KC_TYPES_HEADER
#define KIMW_TYPES_HEADER /* 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>	/* eg. for FILE* */
#include <sys/types.h>	/* eg. for size_t */
typedef void *kc_voidptr_t;
typedef void (*kc_voidfnptr_t)();
#ifdef KC_STDC
  typedef const void* kc_constvoidptr_t;
#else
  typedef kc_voidptr_t kc_constvoidptr_t;
#endif
#ifndef KC_MALLOC_T
# if defined(KC_STDC) && (!defined(sun) || defined(lint))
    typedef kc_voidptr_t kc_malloc_t;
# else
    typedef char *kc_malloc_t;
# endif
#else
 typedef KC_MALLOC_T kc_malloc_t;
#endif
#ifndef KC_REALLOC_ARG_T
# if defined(sun) && defined(KC_STDC)
   typedef kc_voidptr_t kc_realloc_arg_t;
# else
   typedef kc_malloc_t kc_realloc_arg_t;
# endif
#else
  typedef KC_REALLOC_ARG_T kc_realloc_arg_t;
#endif
#ifndef KC_SIZE_T
# ifdef KC_STDC
   typedef size_t kc_size_t;
# else
   typedef unsigned kc_size_t;
# endif
#else
  typedef KC_SIZE_T kc_size_t;
#endif
#ifndef KC__P
# ifdef KC_STDC
#  define KC__P(kc_p) kc_p
#  ifndef KC__C
#   define KC__C(kc_c) kc_c
#  endif
# else
#  define KC__P(kc_p) ()
# endif
#endif
#ifndef KC__C
# define KC__C(kc_c)
#endif
#ifdef KC_STDC
# ifndef KC_USE_PROTOTYPES
#  define KC_USE_PROTOTYPES
# endif
#else
# undef KC_USE_PROTOTYPES
# ifndef KC_KEEP_TYPE_QUALIFIERS
#  define const
#  define volatile
# endif
#endif
#ifndef KC_DOTDOTDOT
# ifdef KC_OLD_DOTDOTDOT
#  define KC_DOTDOTDOT ...
# else
#  define KC_DOTDOTDOT kc_enum_operators,...
# endif
#endif
#ifndef KC_PRINTDOT_LABELSIZE
# define KC_PRINTDOT_LABELSIZE 1023
#endif
"
					   ];
PhylumDeclarations( * )			-> [view_gen_end_k_h:
"
#endif /* KC_TYPES_HEADER */
"
					   ];

/***************************************************************************/

PhylumDeclarations( * )			-> [view_gen_k_c:
"/*LINTLIBRARY*/
/* translation of file(s)
"
(fnfiles)Thefnfiles
" */
/* generated by:
 *	" (charptr)kimwitu_copyright "
 */
#define KC_TYPES
#define KIMW_TYPES /* 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>
#include <ctype.h>
#include <string.h>
#if ((! defined(KC_STDC) ) && defined(sun))
   extern char *sprintf();
#endif
#include <sys/types.h>
#ifdef KC_STDC
# include <stdlib.h>
#else
#  include <memory.h> /*for memset*/
#endif
typedef size_t kc_memset_size_t; /* needed for sun */

#include \"k.h\"
#ifndef KC_STDC
  extern void exit KC__P((int));
#endif

#if ((! defined(KC_STDC) ) && defined(sun))
  /* kc_memset_firstarg_t should be void* kc_voidptr_t, but sun's include files are dumb */
# ifndef KC_MEMSET_FIRSTARG_T
  typedef char *kc_memset_firstarg_t;
# else
  typedef KC_MEMSET_FIRSTARG_T kc_memset_firstarg_t;
# endif
#else
  typedef kc_voidptr_t kc_memset_firstarg_t;
#endif

"
					   ];

/***************************************************************************/

PhylumDeclarations( * )			-> [view_gen_alloc_h:
"kc_voidfnptr_t kc_set_out_of_storage_handler KC__P(( kc_voidfnptr_t ));
kc_voidptr_t emalloc KC__P(( kc_size_t )), ecalloc KC__P(( kc_size_t, kc_size_t )), erealloc KC__P(( kc_voidptr_t, kc_size_t ));
kc_voidptr_t uniqmalloc KC__P(( kc_size_t, kc_voidptr_t ));
void uniqfreeelement KC__P(( kc_voidptr_t, kc_voidptr_t ));
void uniqfreeall KC__P(( kc_voidptr_t ));
void kc_print_memory_info_statistics KC__P(( FILE*, kc_voidptr_t ));
#ifndef KC_STDC
  kc_malloc_t malloc KC__P(( kc_size_t )), calloc KC__P(( kc_size_t, kc_size_t )), realloc KC__P(( kc_realloc_arg_t, kc_size_t ));
#endif
void kc_bzero KC__P(( char*, int ));

"
					   ];

/***************************************************************************/

PhylumDeclarations( * )			-> [view_gen_alloc_c:
"static kc_voidfnptr_t kc_out_of_storage_handler = 0;
kc_voidfnptr_t kc_set_out_of_storage_handler
#ifdef KC_USE_PROTOTYPES
( kc_voidfnptr_t kc_handler )
#else
(kc_handler) kc_voidfnptr_t kc_handler;
#endif
{	kc_voidfnptr_t kc_tmp_handler = kc_out_of_storage_handler;
	kc_out_of_storage_handler = kc_handler;
	return kc_tmp_handler;
}

kc_voidptr_t emalloc	/* check return from malloc */
#ifdef KC_USE_PROTOTYPES
(kc_size_t kc_n)
#else
(kc_n) kc_size_t kc_n;
#endif
{	kc_voidptr_t kc_p;
	while ((kc_p = (kc_voidptr_t)malloc((kc_size_t)kc_n)) == 0) {
		if (kc_out_of_storage_handler) {
			(*kc_out_of_storage_handler)();
		} else {
			(void)fflush(stdout);
			(void)fprintf(stderr,\"out of memory in emalloc\\n\");
			exit( 1 ); /*NOTREACHED*/
	}	}
	return kc_p;
}

kc_voidptr_t ecalloc	/* check return from calloc */
#ifdef KC_USE_PROTOTYPES
(kc_size_t kc_n, kc_size_t kc_s)
#else
(kc_n,kc_s) kc_size_t kc_n, kc_s;
#endif
{	kc_voidptr_t kc_p;
	while ((kc_p = (kc_voidptr_t)calloc((kc_size_t)kc_n,(kc_size_t)kc_s)) == 0) {
		if (kc_out_of_storage_handler) {
			(*kc_out_of_storage_handler)();
		} else {
			(void)fflush(stdout);
			(void)fprintf(stderr,\"out of memory in ecalloc\\n\");
			exit( 1 ); /*NOTREACHED*/
	}	}
	return kc_p;
}

kc_voidptr_t erealloc	/* check return from realloc */
#ifdef KC_USE_PROTOTYPES
(kc_voidptr_t kc_r, kc_size_t kc_s)
#else
(kc_r,kc_s) kc_voidptr_t kc_r; kc_size_t kc_s;
#endif
{	kc_voidptr_t kc_p;
	while ((kc_p = (kc_voidptr_t)realloc((kc_realloc_arg_t)kc_r,(kc_size_t)kc_s)) == 0) {
		if (kc_out_of_storage_handler) {
			(*kc_out_of_storage_handler)();
		} else {
			(void)fflush(stdout);
			(void)fprintf(stderr,\"out of memory in erealloc\\n\");
			exit( 1 ); /*NOTREACHED*/
	}	}
	return kc_p;
}

void kc_bzero
#ifdef KC_USE_PROTOTYPES
(register char *kc_p, register int kc_s)
#else
(kc_p,kc_s) register char *kc_p; register int kc_s;
#endif
{	while (kc_s--) {
		*kc_p++ = '\\0';
	}
}

"
				];

/***************************************************************************/

PhylumDeclarations( pds )		-> [view_gen_enumphyla_h:
{ g_no_of_phyla = PHYLUMNUMBEROFFSET; }
"typedef enum { kc_one_before_first_phylum = " (int)g_no_of_phyla " , 
"
{ g_no_of_phyla++; }
	pds
"	kc_last_phylum = " (int)g_no_of_phyla "
} kc_enum_phyla;

"
					];
Consphylumdeclarations( pd, rpds )	-> [view_gen_enumphyla_h: rpds pd ];
Nilphylumdeclarations()			-> [view_gen_enumphyla_h: {/*EMPTY*/} ];
PhylumDeclaration( id, *, *, * )	-> [view_gen_enumphyla_h:
"	kc_phylum_" id " = " (int)g_no_of_phyla ",
"
{ g_no_of_phyla++; }
					];

/***************************************************************************/

PhylumDeclarations( pds )		-> [view_gen_enumoperators_h:
{ g_no_of_operators = OPERATORNUMBEROFFSET; }
"typedef enum { kc_one_before_first_operator = " (int)g_no_of_operators " , 
"
{ g_no_of_operators++; }
	pds
"	kc_last_operator = " (int)g_no_of_operators "
} kc_enum_operators;

"
					];
Consphylumdeclarations( pd, rpds )	-> [view_gen_enumoperators_h: rpds pd ];
Nilphylumdeclarations()			-> [view_gen_enumoperators_h: {/*EMPTY*/} ];
PhylumDeclaration( *, *, Emptyproductionblock(), * )
					-> [view_gen_enumoperators_h: {/*EMPTY*/} ];
PhylumDeclaration( *, *, ListAlternatives( a, * ), * ),
PhylumDeclaration( *, *, NonlistAlternatives( a ), * ),
PhylumDeclaration( *, *, PredefinedAlternatives( a ), * )
					-> [view_gen_enumoperators_h:
	a
					];
Consalternatives( a, as )		-> [view_gen_enumoperators_h: as a ];
Consalternatives( a, Nilalternatives())	-> [view_gen_enumoperators_h: a ];
Alternative( id, * )			-> [view_gen_enumoperators_h:
"	sel_" id " = " (int)g_no_of_operators ",
"
{ g_no_of_operators++; }
					];

/***************************************************************************/

PhylumDeclarations( * )			-> [view_gen_operatormap_type_h:
"typedef kc_enum_phyla *kc_enum_phyla_list;
typedef kc_size_t *kc_size_t_list; /* size_t is defined in ANSI C <stddef.h> */

/*
 * make sure that the first `real' storage class _always_ gets a value > 0
 * and kc_not_uniq gets a value == 0
 * (because then we can use it as a C boolean)
 */
typedef enum { /*kc_not_uniq = 0, kc_uniq_nullary_operator,*/ " (storageclasses)Thestorageclasses ", kc_last_storageclass } kc_storageclass_t;



typedef struct {
	char *name;			/* name of the phylum */
	kc_size_t size;			/* size of the struct phylum record */
	kc_enum_operators first_operator;	/* index in kc_OperatorInfo[] */
	kc_enum_operators last_operator;	/* index in kc_OperatorInfo[] */
	kc_storageclass_t uniq_stored;	/* storage class */
	void (*copy_attributes) KC__P((kc_voidptr_t, kc_voidptr_t));	/* routine that copies attributes */
} KC_PHYLUM_INFO;

typedef struct {
	char *name;			/* name of the operator */
	int no_sons;			/* number of sons */
	int atomicity;			/* atomic type or not (used as a boolean) */
	kc_enum_phyla phylum;		/* index in kc_PhylumInfo[] */
	kc_enum_phyla_list subphylum;	/* indexes in kc_PhylumInfo[] */
	kc_size_t_list suboffset;	/* offsets of sub-phyla (pointers) in the phylum record */
	kc_storageclass_t uniq_stored;	/* storage class */
	kc_voidptr_t (*create_routine) KC__P((KC_DOTDOTDOT));	/* create routine */
} KC_OPERATOR_INFO;

typedef kc_enum_phyla_list KC_UNIQ_INFO;

extern KC_OPERATOR_INFO kc_OperatorInfo[];
extern KC_PHYLUM_INFO kc_PhylumInfo[];
extern KC_UNIQ_INFO kc_UniqInfo[];

#ifndef KC_SUBPHYLUM
# ifdef lint
#  define KC_SUBPHYLUM(kc_phylum, kc_offset) (kc_phylum,kc_offset,0)
# else
#  define KC_SUBPHYLUM(kc_phylum, kc_offset) (*((char**)(((char*)kc_phylum)+(kc_offset))))
# endif
#endif



"
					];
Nilstorageclasses()			-> [view_gen_operatormap_type_h: {/*EMPTY*/} ];
Consstorageclasses( sc, Nilstorageclasses())	-> [view_gen_operatormap_type_h: sc ];
Consstorageclasses( sc, r_sc)		-> [view_gen_operatormap_type_h:
	r_sc ", " sc
					];


/***************************************************************************/

PhylumDeclarations( d )			-> [view_gen_phylummap_c:
"KC_PHYLUM_INFO kc_PhylumInfo[] = {
"
${ { int i = PHYLUMNUMBEROFFSET; do } ${ { /*PHYLUMNUMBEROFFSET + 1 times*/ }
"	{ \"\", 0, kc_one_before_first_operator, kc_one_before_first_operator, (kc_storageclass_t)0, 0 }, /* dummy element */
"
{ i--; } $} { while (i >= 0); } $}
	d
"	{ \"\", 0, kc_one_before_first_operator, kc_one_before_first_operator, (kc_storageclass_t)0, 0 } /* last element */
};

"
					];
Consphylumdeclarations( pd, rpds )	-> [view_gen_phylummap_c: rpds pd ];
Nilphylumdeclarations()			-> [view_gen_phylummap_c: {/*EMPTY*/} ];
PhylumDeclaration( id, st_opt, pb, cco )
					-> [view_gen_phylummap_c:
{ gl_phylum = id; }
/* for int we need another sizof, below */
{ if  ((strcmp( f_strofID( id ), "int" ) == 0)
      || (strcmp( f_strofID( id ), "float" ) == 0)
      || (strcmp( f_strofID( id ), "voidptr" ) == 0)) } ${
"	{ \"" id "\", sizeof(" id "), " pb ", " st_opt ", " cco " },
"
$} { else } ${
"	{ \"" id "\", sizeof(struct kc_tag_" id "), " pb ", " st_opt ", " cco " },
"
$}
{ gl_phylum = 0; }
					];
NoStorageOption()			-> [view_gen_phylummap_c: "kc_not_uniq" ];
NegativeStorageOption( * )		-> [view_gen_phylummap_c: "kc_not_uniq" ];
PositiveStorageOption( sc )		-> [view_gen_phylummap_c: sc ];

Emptyproductionblock()			-> [view_gen_phylummap_c: {/*EMPTY*/} ];
ListAlternatives( Consalternatives( Alternative( oid, * ), Nilalternatives() ), * ),
NonlistAlternatives( Consalternatives( Alternative( oid, * ), Nilalternatives() ) ),
PredefinedAlternatives( Consalternatives( Alternative( oid, * ), Nilalternatives() ) )	/* HACK: should we do something special for predefined phyla? */
					-> [view_gen_phylummap_c:
"sel_" oid ", sel_" oid
					];

ListAlternatives( Consalternatives( Alternative( oid, * ), ra ), * ),
NonlistAlternatives( Consalternatives( Alternative( oid, * ), ra ) ),
PredefinedAlternatives( Consalternatives( Alternative( oid, * ), ra ) )
					-> [view_gen_phylummap_c:
"sel_" ra ", sel_" oid
					];
Nilalternatives()			-> [view_gen_phylummap_c: {/*EMPTY*/} ];
Consalternatives( Alternative( oid, * ), Nilalternatives() )
					-> [view_gen_phylummap_c:
	oid
					];
Consalternatives( *, ra )		-> [view_gen_phylummap_c:
	ra
					];
CcodeOption( a, * )			-> [view_gen_phylummap_c:
	a
					];
Nilattributes()				-> [view_gen_phylummap_c:
"0"
					];
Consattributes( *, * )			-> [view_gen_phylummap_c:
"KC__C((void(*)(kc_voidptr_t, kc_voidptr_t)))kc_copy_attributes_" (ID)gl_phylum
					];


/***************************************************************************/

PhylumDeclarations( d )			-> [view_gen_operatormap_c:
	d:view_gen_operatormap_operator_fn
"
"
	d:view_gen_operatormap_subphyla
"

#ifndef KC_OFFSETOF
#  define KC_OFFSETOF(kc_record, kc_operator, kc_subphylum) ((kc_size_t) \\
   ((char*)(&((kc_record *)0)->u.kc_operator.kc_subphylum) - (char*)((kc_record *)0)))
#endif
"
	d:view_gen_operatormap_suboffsets
"

KC_OPERATOR_INFO kc_OperatorInfo[] = {
"
${ { int i = OPERATORNUMBEROFFSET; do } ${ { /*OPERATORNUMBEROFFSET + 1 times*/ }
"	{ \"\", 0, 0, kc_one_before_first_phylum, (kc_enum_phyla_list)0, (kc_size_t_list)0, (kc_storageclass_t)0, 0 }, /* dummy element */
"
{  i--; } $} { while (i >= 0); } $}
	d
"	{ (char*)0, 0, 0, kc_one_before_first_phylum, (kc_enum_phyla_list)0, (kc_size_t_list)0, (kc_storageclass_t)0, 0 } /* last element */
};

"
					];
Consphylumdeclarations( pd, rpds )	-> [view_gen_operatormap_c: rpds pd ];
Nilphylumdeclarations()			-> [view_gen_operatormap_c: {/*EMPTY*/} ];
PhylumDeclaration( *, *, Emptyproductionblock(), * )
					-> [view_gen_operatormap_c: {/*EMPTY*/} ];
PhylumDeclaration( id, st_opt, ListAlternatives( a, * ), cco ),
PhylumDeclaration( id, st_opt, NonlistAlternatives( a ), cco )
					-> [view_gen_operatormap_c:
{ gl_phylum = id; gl_storageoption = st_opt; gl_atomicity = 0; gl_no_attributes = f_no_attrs_in_Ccode_option( cco ); }
	a
{ gl_phylum = 0; gl_storageoption = 0; gl_no_attributes = False; }
					];
PhylumDeclaration( id, st_opt, PredefinedAlternatives( a ), cco )
					-> [view_gen_operatormap_c:
{ gl_phylum = id; gl_storageoption = st_opt; gl_atomicity = 1; gl_no_attributes = f_no_attrs_in_Ccode_option( cco ); }
	a
{ gl_phylum = 0; gl_storageoption = 0; gl_no_attributes = False; }
					];
Nilalternatives()			-> [view_gen_operatormap_c: {/*EMPTY*/} ];
Consalternatives( Alternative( oid, args ), ra )
					-> [view_gen_operatormap_c:
	ra
	args:view_count_args
"	{ \"" oid "\", " (int)gl_no_of_args ", " (int)gl_atomicity ", kc_phylum_" (ID)gl_phylum ", "
{ if (gl_no_of_args) } ${
      "kc_subphyla_" oid ", kc_suboffsets_" oid ", "
      (storageoption)gl_storageoption:view_gen_phylummap_c
$} { else } ${
      "(kc_enum_phyla_list)0, (kc_size_t_list)0, "
{     if ((int) gl_no_attributes) } ${ "kc_uniq_nullary_operator" $} { else } ${ (storageoption)gl_storageoption $}
$}
", " 
{ if (gl_atomicity) } ${ "0" $} { else } ${ "(kc_voidptr_t(*) KC__P((KC_DOTDOTDOT)))kc_opfn_" oid $}
" },
"
					];
NoStorageOption()			-> [view_gen_operatormap_c: "kc_not_uniq" ];
NegativeStorageOption( * )		-> [view_gen_operatormap_c: "kc_not_uniq" ];
PositiveStorageOption( * )		-> [view_gen_operatormap_c: "kc_uniq_nullary_operator" ];

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */


Nilarguments()				-> [view_count_args:
{ gl_no_of_args = 0; }
					];
Consarguments( *, ra )			-> [view_count_args:
	ra
{ gl_no_of_args++; }
					];

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Consphylumdeclarations( pd, rpds )	-> [view_gen_operatormap_operator_fn: rpds pd ];
Nilphylumdeclarations()			-> [view_gen_operatormap_operator_fn: {/*EMPTY*/} ];
PhylumDeclaration( *, *, Emptyproductionblock(), * )
					-> [view_gen_operatormap_operator_fn: {/*EMPTY*/} ];
PhylumDeclaration( *, *, PredefinedAlternatives( * ), * )
					-> [view_gen_operatormap_operator_fn: {/*EMPTY*/} ];
PhylumDeclaration( id, *, ListAlternatives( a, * ), * ),
PhylumDeclaration( id, *, NonlistAlternatives( a ), * )
					-> [view_gen_operatormap_operator_fn:
{ gl_phylum = id; }
	a
{ gl_phylum = (ID) 0; }
					];
Nilalternatives()	-> [view_gen_operatormap_operator_fn: {/*EMPTY*/} ];
Consalternatives( Alternative( oid, args ), ra )
					-> [view_gen_operatormap_operator_fn:
	ra
"static " (ID)gl_phylum " kc_opfn_" oid "
#ifdef KC_USE_PROTOTYPES
(" args:view_gen_prodsel_fnarg_and_decls ")
#else
(" args:view_gen_prodsel_fnargs ")" args:view_gen_prodsel_fnargdecls "
#endif
{ return " oid "(" args:view_gen_fnargs "); }
"
					];
Nilarguments()		-> [view_gen_prodsel_fnarg_and_decls:
"kc_enum_operators kc_prod_sel"
					];
Consarguments( *, * )	-> [view_gen_prodsel_fnarg_and_decls:
"kc_enum_operators kc_prod_sel, "
	$0:view_gen_fnarg_and_decls
					];
Nilarguments()		-> [view_gen_prodsel_fnargs:
"kc_prod_sel"
					];
Consarguments( *, * )	-> [view_gen_prodsel_fnargs:
"kc_prod_sel, "
	$0:view_gen_fnargs
					];
Nilarguments()		-> [view_gen_prodsel_fnargdecls:
"kc_enum_operators kc_prod_sel;"
					];
Consarguments( *, * )	-> [view_gen_prodsel_fnargdecls:
"kc_enum_operators kc_prod_sel; "
	$0:view_gen_fnargdecls
					];

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Consphylumdeclarations( pd, rpds )	-> [view_gen_operatormap_subphyla: rpds pd ];
Nilphylumdeclarations()			-> [view_gen_operatormap_subphyla: {/*EMPTY*/} ];
PhylumDeclaration( *, *, Emptyproductionblock(), * )
					-> [view_gen_operatormap_subphyla: {/*EMPTY*/} ];
PhylumDeclaration( *, *, ListAlternatives( a, * ), * ),
PhylumDeclaration( *, *, NonlistAlternatives( a ), * ),
PhylumDeclaration( *, *, PredefinedAlternatives( a ), * )
					-> [view_gen_operatormap_subphyla: a ];
Nilalternatives()			-> [view_gen_operatormap_subphyla: {/*EMPTY*/} ];
Consalternatives( Alternative( oid, args ), ra )
					-> [view_gen_operatormap_subphyla:
	ra
	args:view_count_args
{ if (gl_no_of_args) } ${
"static kc_enum_phyla kc_subphyla_" oid "[] = { "
	args
" };
"
$}
					];
Nilarguments()				-> [view_gen_operatormap_subphyla: {/*EMPTY*/} ];
Consarguments( a, ra )			-> [view_gen_operatormap_subphyla:
	ra
", "
"kc_phylum_" a
					];
Consarguments( a, Nilarguments() )	-> [view_gen_operatormap_subphyla:
"kc_phylum_" a
					];

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Consphylumdeclarations( pd, rpds )	-> [view_gen_operatormap_suboffsets: rpds pd ];
Nilphylumdeclarations()			-> [view_gen_operatormap_suboffsets: {/*EMPTY*/} ];
PhylumDeclaration( *, *, Emptyproductionblock(), * )
					-> [view_gen_operatormap_suboffsets: {/*EMPTY*/} ];
PhylumDeclaration( id, *, ListAlternatives( a, * ), * ),
PhylumDeclaration( id, *, NonlistAlternatives( a ), * ),
PhylumDeclaration( id, *, PredefinedAlternatives( a ), * )
					-> [view_gen_operatormap_suboffsets:
{ gl_phylum = id; }
	a
{ gl_phylum = 0; }
 ];
Nilalternatives()			-> [view_gen_operatormap_suboffsets: {/*EMPTY*/} ];
Consalternatives( Alternative( oid, args ), ra )
					-> [view_gen_operatormap_suboffsets:
	ra
{ gl_operator = oid; }
	args:view_count_args
{ if (gl_no_of_args) } ${
"static kc_size_t kc_suboffsets_" oid "[] = { "
	args
" };
"
$}
{ gl_operator = 0; }
					];
Nilarguments()				-> [view_gen_operatormap_suboffsets: {/*EMPTY*/} ];
Consarguments( *, ra )			-> [view_gen_operatormap_suboffsets:
	ra
	", "
"KC_OFFSETOF( struct kc_tag_" (ID)gl_phylum ", " (ID)gl_operator ", " $0:view_gen_argseqnr " )"
					];
Consarguments( *, Nilarguments() )	-> [view_gen_operatormap_suboffsets:
"KC_OFFSETOF( struct kc_tag_" (ID)gl_phylum ", " (ID)gl_operator ", " $0:view_gen_argseqnr " )"
					];


/***************************************************************************/

Nilstorageclasses()			-> [view_gen_uniqmap_c: {/*EMPTY*/} ];
Consstorageclasses( *, * )		-> [view_gen_uniqmap_c:
	$0:view_gen_uniqmap_c_1
"
KC_UNIQ_INFO kc_UniqInfo[] = {
"
	$0:view_gen_uniqmap_c_2
"
};
"
					];

Nilstorageclasses()			-> [view_gen_uniqmap_c_1: {/*EMPTY*/} ];
Consstorageclasses( sc, r_sc )		-> [view_gen_uniqmap_c_1:
	r_sc
{ if (length_phylumnames($0->phyla) > 0) } ${
"static kc_enum_phyla kc_phylumstorageclass_" sc "[] = { kc_one_before_first_phylum, "
	$0->phyla
"kc_last_phylum };
"
$}
					];
Nilphylumnames()			-> [view_gen_uniqmap_c_1: {/*EMPTY*/} ];
Consphylumnames( pn, r_pn )		-> [view_gen_uniqmap_c_1: r_pn "kc_phylum_" pn ", " ];
Nilstorageclasses()			-> [view_gen_uniqmap_c_2: {/*EMPTY*/} ];
Consstorageclasses( sc, Nilstorageclasses() )	-> [view_gen_uniqmap_c_2:
{ if (length_phylumnames($0->phyla) > 0) } ${
"	kc_phylumstorageclass_" sc
$} { else } ${
"	(KC_UNIQ_INFO)0"
$}
					];
Consstorageclasses( sc, r_sc )		-> [view_gen_uniqmap_c_2:
	r_sc
{ if (length_phylumnames($0->phyla) > 0) } ${
",
	kc_phylumstorageclass_" sc
$} { else } ${
",
	(KC_UNIQ_INFO)0"
$}
					];

/***************************************************************************/

PhylumDeclarations( d )			-> [view_gen_nodetypedefs_h:
"typedef union  kc_tag_YYSTYPE YYSTYPE;
typedef struct kc_tag_kc_hashnode_t *kc_hashnode_t;
typedef struct kc_tag_kc_dotedgenode_t *kc_dotedgenode_t;

"
	d
"
"
					];
Consphylumdeclarations( pd, rpds )	-> [view_gen_nodetypedefs_h: rpds pd ];
Nilphylumdeclarations()			-> [view_gen_nodetypedefs_h: {/*EMPTY*/} ];
PhylumDeclaration( *, *, Emptyproductionblock(), * )
					-> [view_gen_nodetypedefs_h: {/*EMPTY*/} ];
PhylumDeclaration( id, *, ListAlternatives( *, * ), * ),
PhylumDeclaration( id, *, NonlistAlternatives( * ), * )
					-> [view_gen_nodetypedefs_h:
"typedef struct kc_tag_" id " *" id ";
"
					];
PhylumDeclaration( id, *, PredefinedAlternatives( * ), * )
					-> [view_gen_nodetypedefs_h:
{ if ((strcmp( f_strofID( id ), "int" ) == 0)
     || (strcmp( f_strofID( id ), "float" ) == 0)) } ${
{ /*EMPTY*/ }
$} { else if (strcmp( f_strofID( id ), "voidptr" ) == 0) } ${
"typedef kc_voidptr_t " id ";
"
$} { else /* [no]casestring*/ } ${
"typedef struct kc_tag_" id " *" id ";
"
$}
					];

/***************************************************************************/

PhylumDeclarations( d )			-> [view_gen_nodetypes_h:
"struct kc_tag_kc_hashnode_t {
	kc_enum_operators prod_sel;
	YYSTYPE ptr;
	int number;
	boolean created;
};

struct kc_tag_kc_dotedgenode_t {
	kc_enum_operators prod_sel;
	kc_enum_phyla phy_from;
	YYSTYPE ptr_from;
	kc_enum_phyla phy_to;
	YYSTYPE ptr_to;
	int son_nr;
	char *label;
	int lsize;
	kc_dotedgenode_t next;
};

"
	d
					];
Consphylumdeclarations( pd, rpds )	-> [view_gen_nodetypes_h: rpds pd ];
Nilphylumdeclarations()			-> [view_gen_nodetypes_h: {/*EMPTY*/} ];
PhylumDeclaration( *, *, Emptyproductionblock(), * )
					-> [view_gen_nodetypes_h: {/*EMPTY*/} ];
PhylumDeclaration( id, *, ListAlternatives( a, * ), cco ),
PhylumDeclaration( id, *, NonlistAlternatives( a ), cco )
					-> [view_gen_nodetypes_h:
"struct kc_tag_" id " {
	kc_enum_operators prod_sel;
"
{ if (! f_all_alternatives_nullary( a )) } ${
"	union {
"
	a
"	} u;
"
$}
	cco
"};

"
					];
PhylumDeclaration( id, *, PredefinedAlternatives( * ), * )
					-> [view_gen_nodetypes_h:
{ if ((strcmp( f_strofID( id ), "int" ) == 0)
     || (strcmp( f_strofID( id ), "float" ) == 0)
     || (strcmp( f_strofID( id ), "voidptr" ) == 0)) } ${
{ /*EMPTY*/ }
$} { else /* [no]casestring*/ } ${
"struct kc_tag_" id " {
	kc_enum_operators prod_sel;
	char *name;
};

"
$}
					];
Nilalternatives()			-> [view_gen_nodetypes_h: {/*EMPTY*/} ];
Consalternatives( Alternative( *, Nilarguments() ), ra )
					-> [view_gen_nodetypes_h:
	ra
					 ];
Consalternatives( Alternative( oid, args ), ra )
					-> [view_gen_nodetypes_h:
	ra
"		struct {
"
	args
"		} " oid ";
"
					];
Consarguments( a, rargs )		-> [view_gen_nodetypes_h:
	rargs
"			" a " " a "_" $0->seqnr ";
"
					];
CcodeOption( a, * )			-> [view_gen_nodetypes_h:
	a
					];
Nilattributes()				-> [view_gen_nodetypes_h: {/*EMPTY*/} ];
Consattributes( Attribute( t, id, * ), ra )
					-> [view_gen_nodetypes_h:
	ra
"	" t " " id ";
"
					];

/***************************************************************************/

PhylumDeclarations( d )			-> [view_gen_yaccstacktype_h:
"union kc_tag_YYSTYPE {
	kc_hashnode_t yt_kc_hashnode_t;
	kc_dotedgenode_t yt_kc_dotedgenode_t;
"
	d
"};
extern YYSTYPE yylval;

"
					];
Consphylumdeclarations( pd, rpds )	-> [view_gen_yaccstacktype_h: rpds pd ];
Nilphylumdeclarations()			-> [view_gen_yaccstacktype_h: {/*EMPTY*/} ];
PhylumDeclaration( id, *, *, * )	-> [view_gen_yaccstacktype_h:
"	" id "	yt_" id ";
"
					];

/***************************************************************************/

PhylumDeclarations( * )			-> [view_gen_noofoperators_h:
"#define KC_NO_OF_OPERATORS " (int) g_no_of_operators "

"
					];

/***************************************************************************/

PhylumDeclarations( * )			-> [view_gen_booleans_h:
"typedef enum { KC_False=0, KC_True=1 } kc_tp_boolean;
#if ! (defined(True) || defined(False))
# define True KC_True
# define False KC_False
# define boolean kc_tp_boolean
#else
# if ! defined(boolean)
#  define boolean int
# endif
#endif

"
					];

/***************************************************************************/

PhylumDeclarations( * )			-> [view_gen_initialization_h:
"#ifndef KC_NO_DEFAULT_IN_WITH
# define KC_NO_DEFAULT_IN_WITH \"Internal Error: no default action defined in function %s at %s:%d\\n\"
#endif
void kc_no_default_in_with KC__P((char*, int, char*));
void kc_returnless_function KC__P((char *, int, char*));

#ifndef KC_SEPARATE_HASH_LEVELS
#  define KC_IS_HT_STORE_STATIC =kc_ht_store_static
#else
#  define KC_IS_HT_STORE_STATIC
#endif

/*
 * small tricks to shut up lint
 */
#if (defined(lint) || defined(SABER) || defined(CODECENTER))
#  define KC_LINTUSE(x) if(x)x=x
#else
#  define KC_LINTUSE(x) 
#endif

/*
 * the following trick is because for Saber (CenterLine) we have
 * the possibillity to load a file either as .c or as .o,
 * so we can not have a maybe nonexisting variable as in the
 * lint variant.
 * we may want to SUPPRESS a Saber warning about unused variable.
 */
#if defined(lint)
   extern int kc_zero_constant;
#else
# if (defined(SABER) || defined(CODECENTER))
   static int kc_zero_constant = 0;
# else
#  define kc_zero_constant 0
# endif
#endif

#ifndef NDEBUG
# define assert(t) do {if (!(t)) kc_assertionFailed(__FILE__,__LINE__);}while(kc_zero_constant)
# define _assert(t) do {if (!(t)) kc_assertionFailed(__FILE__,__LINE__);}while(kc_zero_constant)
# define assertReason(t,s) do {if (!(t)) kc_assertionReasonFailed(__FILE__,__LINE__,s);}while(kc_zero_constant)
# define assertNonNull(ptr,str) do {if (ptr == NULL) kc_assertionNonNullFailed(str,__FILE__,__LINE__);}while(kc_zero_constant)
# define assertOperatorInPhylumFn(op,str1,str2,phy,fn) do {if ((op<(int)kc_PhylumInfo[(int)phy].first_operator)||(op>(int)kc_PhylumInfo[(int)phy].last_operator)) fn(op,str1,str2,(int)phy,__FILE__,__LINE__);}while(kc_zero_constant)
# define assertOperatorInPhylum(op,str1,str2,phy) assertOperatorInPhylumFn(op,str1,str2,phy,kc_assertionOperatorInPhylumFailed)
# define assertPhylum(ptr,ptrstr,phy) do{if((phy!=kc_phylum_int)&&(phy!=kc_phylum_float)&&(phy!=kc_phylum_voidptr)){assertNonNull(ptr,ptrstr);assertOperatorInPhylum((int)(ptr->prod_sel),ptrstr,\"->prod_sel\",phy);}}while(kc_zero_constant)
# define assertNonIntPhylum(ptr,ptrstr,phy) do{assertNonNull(ptr,ptrstr);assertOperatorInPhylum((int)(ptr->prod_sel),ptrstr,\"->prod_sel\",phy);}while(kc_zero_constant)
#else
# define assert(t)
# define _assert(t)
# define assertReason(t,s)
# define assertNonNull(ptr,str)
# define assertOperatorInPhylumFn(op,str1,str2,phy,fn)
# define assertOperatorInPhylum(op,str1,str2,phy)
# define assertPhylum(ptr,ptrstr,phy)
# define assertNonIntPhylum(ptr,ptrstr,phy)
#endif
void kc_assertionFailed KC__P((char*, int));
void kc_assertionReasonFailed KC__P((char*, int, char*));
void kc_assertionNonNullFailed KC__P((char*, char*, int));
void kc_assertionOperatorInPhylumFailed KC__P((int, char*, char*, int, char*, int));
/* void kc_invalid_operator KC__P((char*, kc_enum_phyla, int, char*, int)); */

"
					];

/***************************************************************************/

PhylumDeclarations( * )			-> [view_gen_initialization_c:
"#if defined(lint)
   int kc_zero_constant = 0;
#endif

void kc_no_default_in_with
#ifdef KC_USE_PROTOTYPES
( char *kc_func, int kc_line, char *kc_file )
#else
( kc_func, kc_line, kc_file ) char *kc_func; int kc_line; char *kc_file;
#endif
{	(void)fflush(stdout);
	(void)fprintf( stderr, KC_NO_DEFAULT_IN_WITH, kc_func, kc_file, kc_line );
#ifndef KC_NODEFAULT_NO_ABORT
	abort();
#else
	exit( 1 );
#endif
}

void kc_returnless_function
#ifdef KC_USE_PROTOTYPES
( char *kc_func, int kc_line, char *kc_file )
#else
( kc_func, kc_line, kc_file ) char *kc_func; int kc_line; char *kc_file;
#endif
{	(void)fflush(stdout);
	(void)fprintf( stderr, \"Internal Error: function %s does not return a value, at %s:%d\", kc_func, kc_file, kc_line );
#ifndef KC_NODEFAULT_NO_ABORT
	abort();
#else
	exit( 1 );
#endif
}

void kc_assertionFailed
#ifdef KC_USE_PROTOTYPES
(char *kc_fn, int kc_l)
#else
(kc_fn, kc_l) char *kc_fn; int kc_l;
#endif
{	(void)fflush(stdout);
	(void)fprintf( stderr, \"Internal Error: Assertion failed at %s:%d\\n\", kc_fn, kc_l );
#ifndef KC_ASSERT_NO_ABORT
	abort();
#else
	exit( 1 );
#endif
}

void kc_assertionReasonFailed
#ifdef KC_USE_PROTOTYPES
(char *kc_fn, int kc_l, char *kc_s)
#else
(kc_fn, kc_l, kc_s) char *kc_fn; int kc_l; char *kc_s;
#endif
{	(void)fflush(stdout);
	(void)fprintf( stderr, \"Internal Error: Assertion failed at file %s:%d: %s\\n\", kc_fn, kc_l, kc_s );
#ifndef KC_ASSERT_NO_ABORT
	abort();
#else
	exit( 1 );
#endif
}

void kc_assertionNonNullFailed
#ifdef KC_USE_PROTOTYPES
(char *kc_str, char *kc_fn, int kc_l)
#else
(kc_str, kc_fn, kc_l) char *kc_str; char *kc_fn; int kc_l;
#endif
{	(void)fflush(stdout);
	(void)fprintf( stderr, \"Internal Error: Assertion failed at %s:%d: pointer %s is NULL\\n\", kc_fn, kc_l, kc_str );
#ifndef KC_ASSERT_NO_ABORT
	abort();
#else
	exit( 1 );
#endif
}

void kc_assertionOperatorInPhylumFailed
#ifdef KC_USE_PROTOTYPES
(int kc_op, char *kc_str1, char *kc_str2, int kc_phy, char *kc_fn, int kc_l)
#else
(kc_op, kc_str1, kc_str2, kc_phy, kc_fn, kc_l) int kc_op; char *kc_str1; char *kc_str2; int kc_phy; char *kc_fn; int kc_l;
#endif
{	(void)fflush(stdout);
	if ((kc_op <= (int)kc_one_before_first_operator) || (kc_op >= (int)kc_last_operator)) {
		(void)fprintf( stderr, \"Internal Error: Assertion failed at %s:%d: illegal value for (%s) %s%s: %d not a valid operator\\n\", kc_fn, kc_l, kc_PhylumInfo[(int)kc_phy].name, kc_str1, kc_str2, kc_op );
	} else {
		(void)fprintf( stderr, \"Internal Error: Assertion failed at %s:%d: illegal value for (%s) %s%s: %s (%d) is a value of %s\\n\", kc_fn, kc_l, kc_PhylumInfo[(int)kc_phy].name, kc_str1, kc_str2, kc_OperatorInfo[kc_op].name, kc_op, kc_PhylumInfo[(int)kc_OperatorInfo[kc_op].phylum].name );
	}
#ifndef KC_ASSERT_NO_ABORT
	abort();
#else
	exit( 1 );
#endif
}

static void kc_invalid_operator
#ifdef KC_USE_PROTOTYPES
( char *kc_func_prefix, kc_enum_phyla kc_phy, int kc_line, char *kc_file, int kc_oper )
#else
( kc_func_prefix, kc_phy, kc_line, kc_file, kc_oper ) char *kc_func_prefix; kc_enum_phyla kc_phy; int kc_line; char *kc_file; int kc_oper;
#endif
{	(void)fflush(stdout);
	(void)fprintf( stderr, \"Internal Error: invalid operator code in %s%s at %s:%d: %s\\n\", kc_func_prefix, kc_phylumname_or_error( (int)kc_phy ), kc_file, kc_line, kc_operatorname_or_error( kc_oper ));
#ifndef KC_INVALID_OPERATOR_NO_ABORT
	abort();
#else
	exit( 1 );
#endif
}

"
					];

/***************************************************************************/

PhylumDeclarations( d )			-> [view_gen_assertmacros_h:
	d
					];
Consphylumdeclarations( pd, rpds )	-> [view_gen_assertmacros_h: rpds pd ];
Nilphylumdeclarations()			-> [view_gen_assertmacros_h: {/*EMPTY*/} ];
PhylumDeclaration( *, *, Emptyproductionblock(), * )
					-> [view_gen_assertmacros_h: {/*EMPTY*/} ];
PhylumDeclaration( id, *, ListAlternatives( *, * ), * ),
PhylumDeclaration( id, *, NonlistAlternatives( * ), * )
					-> [view_gen_assertmacros_h:
"#define assert_" id "(p,pstr) assertNonIntPhylum(p,pstr,(int)kc_phylum_" id ")
"
					];
PhylumDeclaration( id, *, PredefinedAlternatives( * ), * )
					-> [view_gen_assertmacros_h:
{ if ((strcmp( f_strofID( id ), "int" ) == 0)
     || (strcmp( f_strofID( id ), "float" ) == 0)
     || (strcmp( f_strofID( id ), "voidptr" ) == 0)) } ${
"#define assert_" id "(p,pstr)
"
$} { else } ${
"#define assert_" id "(c, cstr) assertNonIntPhylum(c,cstr,(int)kc_phylum_" id ")
"
$}
					];

/***************************************************************************/


PhylumDeclarations( d )			-> [view_gen_operatordecls_h:
"typedef struct {
	int create;
	int existing_not_found;
	int free_called[2];
	int freed[2];
} KC_OPERATOR_STATISTICS;

#ifdef KC_STATISTICS
# define kc_print_operator_statistics(kc_f) kc_do_print_operator_statistics(kc_f)
  void	kc_do_print_operator_statistics KC__P(( FILE* ));
#else /*KC_STATISTICS*/
# define kc_print_operator_statistics(kc_f) 
#endif /*KC_STATISTICS*/

typedef struct kc_tag_kc_hashtableentry_t {
	YYSTYPE *index; /* index[ibound] */
	int ibound; /* nr of slots; index of first nonexist */
	int nr; /* nr of occupied; index of first free */
} kc_hashtableentry_t;

typedef enum { kc_ht_store_static = 0, kc_ht_store_dynamic KC_IS_HT_STORE_STATIC, kc_last_storage_mode } kc_hastable_storage_mode_t;

typedef struct kc_tag_kc_hashtable_struct_t *kc_hashtable_t;
typedef struct kc_tag_kc_private_malloc_t {
	kc_voidptr_t malloc_private_data;
	struct kc_tag_kc_private_malloc_t *next;
	struct kc_tag_kc_private_malloc_t *prev;
} *kc_private_malloc_t;

typedef struct kc_tag_kc_hashtable_struct_t {
	/* general stuff */
	kc_hashtableentry_t (*hashtable)[kc_last_storage_mode]; /* hashtable[size][dynamic/static] */
	int size; /* nr of buckets in the hashtable; index of first nonexist */
	int kc_to_be_freed; /* should be True for dynamic, False for statically allocated structures */
	kc_hashtable_t next; /* to build a linked list of all hashtables created, ever */
	kc_hashtable_t prev; /* to build a linked list of all hashtables created, ever */
	/* node allocation */
	kc_voidptr_t (*malloc_initialise) KC__P(()); /* routine to initialise a new block(list/level), returns the malloc_private_data */
	kc_voidptr_t (*malloc) KC__P((kc_size_t, kc_voidptr_t)); /* routine to be used to create elements in the hashtable */
	void (*free_element) KC__P((kc_voidptr_t, kc_voidptr_t)); /* routine to be used to free one element allocated using malloc */
	void (*free_all_elements) KC__P((kc_voidptr_t)); /* routine to be used to free elements in a block(list/level) */
	boolean (*in_block) KC__P((kc_voidptr_t, kc_voidptr_t)); /* routine to test if an element is in a block */
	kc_voidptr_t malloc_private_data; /* private data for the malloc routine, for current block */
	kc_voidptr_t static_malloc_private_data; /* private data for the malloc routine */
	kc_private_malloc_t dynamic_malloc_private_data; /* private data for the malloc routine */
	kc_private_malloc_t dec_dynamic_malloc_private_data; /* dec-level-ed dynamic_malloc_private_data == dynamic_malloc_private_data->prev if defined */
	kc_hastable_storage_mode_t mode; /* either dynamic or static */
	void (*malloc_info) KC__P((FILE*, kc_voidptr_t)); /* routine to print info on malloc structure */
	/* bucket allocation */
	kc_voidptr_t (*bucket_alloc_initialise) KC__P(()); /* routine to initialise the bucket allocation stuff, returns the malloc_private_data */
	kc_voidptr_t (*bucket_calloc) KC__P((kc_size_t, kc_size_t, kc_voidptr_t)); /* routine to be used to create buckets in the hashtable */
	kc_voidptr_t (*bucket_realloc) KC__P((kc_voidptr_t, kc_size_t, kc_size_t, kc_voidptr_t)); /* routine to be used to realloc buckets in the hashtable */
	kc_voidptr_t bucket_alloc_private_data; /* private data for the bucket alloc routines */
	void (*free_bucket) KC__P((kc_voidptr_t, kc_size_t, kc_voidptr_t)); /* routine to be used to free one bucket */
	void (*free_buckets) KC__P((kc_voidptr_t)); /* routine to be used to free all buckets */
	int bucket_alloc_inc; /* size of increments in bucket alloced memory */ /* default: KC_BUCKET_INC */
	void (*bucket_alloc_info) KC__P((FILE*, kc_voidptr_t)); /* routine to print info on bucket alloc structure */
} kc_hashtable_struct_t;

void	kc_print_hash_statistics KC__P((FILE*));
void	kc_print_all_hashtable_statistics KC__P((FILE*));
void	kc_print_hashtable_statistics KC__P(( FILE*, kc_hashtable_t));
void	kc_ht_static KC__P((kc_storageclass_t));
void	kc_ht_dynamic KC__P((kc_storageclass_t));
void	kc_ht_inc_level KC__P((kc_storageclass_t));
void	kc_ht_dec_level KC__P((kc_storageclass_t));
void	kc_ht_free_level KC__P((kc_storageclass_t));
kc_hashtable_t	kc_ht_create_bucketmanagement KC__P((int,
 kc_voidptr_t (*)(),
 kc_voidptr_t (*)(kc_size_t, kc_voidptr_t),
 void (*)(kc_voidptr_t, kc_voidptr_t),
 void (*)(kc_voidptr_t),
 boolean (*)(kc_voidptr_t, kc_voidptr_t),
 void (*)(FILE*, kc_voidptr_t),
 kc_voidptr_t (*)(),
 kc_voidptr_t (*)(kc_size_t, kc_size_t, kc_voidptr_t),
 kc_voidptr_t (*)( kc_voidptr_t, kc_size_t, kc_size_t, kc_voidptr_t),
 void (*)(kc_voidptr_t, kc_size_t, kc_voidptr_t),
 void (*)(kc_voidptr_t),
 int,
 void (*)(FILE*, kc_voidptr_t)));
kc_hashtable_t	kc_ht_create KC__P((int, kc_voidptr_t(*)(), kc_voidptr_t(*)(kc_size_t, kc_voidptr_t), void (*)(kc_voidptr_t, kc_voidptr_t), void (*)(kc_voidptr_t), boolean (*)(kc_voidptr_t, kc_voidptr_t)));
kc_hashtable_t	kc_ht_create_simple KC__P((int));
kc_hashtable_t	kc_ht_assign KC__P((kc_hashtable_t, kc_storageclass_t));
kc_hashtable_t	kc_ht_assigned KC__P((kc_storageclass_t));
void	kc_ht_clear KC__P((kc_hashtable_t));
void	kc_ht_reuse KC__P((kc_hashtable_t));
void	kc_ht_delete KC__P((kc_hashtable_t));
int	kc_ci_strcmp KC__P(( char *, char * )); /* Maybe should be static? */
casestring	mkcasestring KC__P(( char * ));
nocasestring	mknocasestring KC__P(( char * ));
kc_hashnode_t	kc_mksharinghashnode KC__P(( YYSTYPE, kc_hashtable_t, kc_enum_phyla ));
kc_hashnode_t	kc_mknonsharinghashnode KC__P(( YYSTYPE, kc_hashtable_t, kc_enum_phyla ));
kc_dotedgenode_t	kc_mkdotedgenode KC__P(( kc_hashtable_t, YYSTYPE, kc_enum_phyla, YYSTYPE, kc_enum_phyla, int ));
kc_voidptr_t kc_do_copy_phylum KC__P(( kc_voidptr_t, boolean, kc_enum_phyla )); /* NOT static because we use it in csgiok.c */
"
	d
					];

Consphylumdeclarations( pd, rpds )	-> [view_gen_operatordecls_h: rpds pd ];
Nilphylumdeclarations()			-> [view_gen_operatordecls_h: {/*EMPTY*/} ];
PhylumDeclaration( *, *, Emptyproductionblock(), * )
					-> [view_gen_operatordecls_h: {/*EMPTY*/} ];
PhylumDeclaration( id, *, ListAlternatives( a, * ), * ),
PhylumDeclaration( id, *, NonlistAlternatives( a ), * )
					-> [view_gen_operatordecls_h:
	id "	" a ";
"
					];
PhylumDeclaration( *, *, PredefinedAlternatives( * ), * )
					-> [view_gen_operatordecls_h: {/*EMPTY*/} ];
Nilalternatives()			-> [view_gen_operatordecls_h: {/*EMPTY*/} ];
Consalternatives( Alternative( oid, args ), ra )
					-> [view_gen_operatordecls_h:
	ra ",
"	oid " KC__P((" args "))"
					];
Consalternatives( Alternative( oid, args ), Nilalternatives() )
					-> [view_gen_operatordecls_h:
	oid " KC__P((" args "))"
					];
Consarguments( a, Nilarguments() )	-> [view_gen_operatordecls_h:
	a
					];
Consarguments( a, rargs )		-> [view_gen_operatordecls_h:
	rargs ", " a
					];

/***************************************************************************/

%{ KC_UNPARSE
#define FMOP 38
#define FMSZ 3
#define FMNCR 8
#define FMNCRD 8
#define FMEXIST 8
#define FMFRNC 8
#define FMFRRC 8
#define FMFREED 8
#define FMREM 8
#define FMTOT 9
%}

PhylumDeclarations( d )			-> [view_gen_operatordefs_c:
"/* macro's that do the string concatenation */
#define KC_MIdStr(s) s
#ifdef KC_STDC
#  define KC_MStrConc(s1,s2) s1 ## s2
#else
#  define KC_MStrConc(s1,s2) KC_MIdStr(s1)s2
#endif

#ifndef KC_MEMORY_BLOCKSIZE
#  define KC_MEMORY_BLOCKSIZE 20000
#endif
#ifndef LARGEPRIME
#  define LARGEPRIME 80021
#endif
#if LARGEPRIME < 0
#  define LARGEPRIME 0
#endif
#ifndef KC_BUCKET_INC
#  define KC_BUCKET_INC 8
#endif
#ifndef HASH
#  define HASH(x) kc_hashval = ((kc_hashval<<3) + (((unsigned)x)>>2))
#endif
#ifndef INTHASH
#  define INTHASH(x) kc_hashval = ((kc_hashval<<10) + (unsigned)x)
#endif
#ifndef FLOATHASH
#  define FLOATHASH(x) kc_hashval = ((kc_hashval<<10) + (unsigned)x)
#endif
#ifndef VOIDPTRHASH
#  define VOIDPTRHASH(x) HASH(x)
#endif
#ifndef OPERATORHASH
#  define OPERATORHASH(x) kc_hashval = (kc_hashval + (unsigned)x * 73)
#endif
#ifndef CASESTRHASH
#  define CASESTRHASH(x) kc_hashval = ((kc_hashval<<3) + (unsigned)kc_casestrhash(x))
#endif
#ifndef NOCASESTRHASH
#  define NOCASESTRHASH(x) kc_hashval = ((kc_hashval<<3) + (unsigned)kc_nocasestrhash(x))
#endif
#ifndef MALLOC
#  define MALLOC emalloc
#endif
#ifndef CALLOC
#  define CALLOC ecalloc
#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
#ifndef KC_ALIGN
typedef union kc_Align_tag { long l; int i; } kc_Align;
#else
typedef KC_ALIGN kc_Align;
#endif
#ifndef UNIQMALLOCINIT
#  define UNIQMALLOCINIT uniqmallocinit
#  ifndef UNIQMALLOC2
#    define UNIQMALLOC2 uniqmalloc
#  endif
#  ifndef UNIQFREEELEMENT
#    define UNIQFREEELEMENT uniqfreeelement
#  endif
#  ifndef UNIQFREEALL
#    define UNIQFREEALL uniqfreeall
#  endif
#  ifndef INUNIQBLOCK
#    define INUNIQBLOCK isinuniqmalloccedblock
#  endif
#  ifndef UNIQMEMORYINFO
#    define UNIQMEMORYINFO kc_print_memory_info_statistics
#  endif
#else
#  ifndef UNIQFREEELEMENT
#    define UNIQFREEELEMENT 0
#  endif
#  ifndef UNIQFREEALL
#    define UNIQFREEALL 0
#  endif
#  ifndef INUNIQBLOCK
#    define INUNIQBLOCK 0
#  endif
#  ifndef UNIQMEMORYINFO
#    define UNIQMEMORYINFO 0
#  endif
#endif
#ifndef BUCKETALLOCINIT
#  define BUCKETALLOCINIT 0
#  ifndef BUCKETCALLOC
#    define BUCKETCALLOC kc_wrap_bucket_malloc
#  endif
#  ifndef BUCKETREALLOC
#    define BUCKETREALLOC kc_wrap_bucket_realloc
#  endif
#  ifndef BUCKETFREE
#    define BUCKETFREE kc_wrap_bucket_free
#  endif
#  ifndef BUCKETSFREE
#    define BUCKETSFREE 0
#  endif
#  ifndef BUCKETMEMORYINFO
#    define BUCKETMEMORYINFO 0
#  endif
#else
#  ifndef BUCKETFREE
#    define BUCKETFREE 0
#  endif
#  ifndef BUCKETSFREE
#    define BUCKETSFREE 0
#  endif
#  ifndef BUCKETMEMORYINFO
#    define BUCKETMEMORYINFO 0
#  endif
#endif
#ifndef BUCKETINC
#  define BUCKETINC KC_BUCKET_INC
#endif
#ifndef NONUNIQMALLOC
#  define NONUNIQMALLOC emalloc
#endif
#ifndef NONUNIQFREE
#  define NONUNIQFREE efree
#endif
#ifndef KC_BZERO
#  define KC_BZERO(kc_p, kc_s) (void)memset((kc_memset_firstarg_t)kc_p, 0, (kc_memset_size_t)kc_s)
#endif

typedef struct kc_tag_kc_memory_blockinfo_t *kc_memory_blocksinfo_t;
typedef struct kc_tag_kc_memory_blockinfo_t kc_memory_blockinfo_t;
typedef struct kc_tag_kc_memory_info_t kc_memory_info_t;

static kc_memory_blocksinfo_t kc_mainmemory_freelist = 0;

struct kc_tag_kc_memory_blockinfo_t {
	kc_voidptr_t block; /* pointer to the allocated structure */
	kc_size_t size; /* size of allocated structure */
	kc_memory_blocksinfo_t next; /* next block in list */
	kc_memory_blocksinfo_t prev; /* prev block in list */
};

struct kc_tag_kc_memory_info_t {
	kc_memory_blocksinfo_t kc_memory_blocklist; /* points to block currently in use */
	int kc_memory_left; /* remaining bytes in current block */
	kc_voidptr_t kc_memory_ptr; /* address of first free byte in current block */
	kc_memory_blocksinfo_t *kc_memory_freelist; /* pointer to variable that holds freelist */
	int kc_to_be_freed; /* should be 0 for statically created nodes, and 1 for dynamically created ones */
	kc_size_t kc_wanted_blocksize; /* prefered size of chunks */
};

static kc_memory_blocksinfo_t kc_memory_createblock
#ifdef KC_USE_PROTOTYPES
(kc_size_t kc_n, kc_memory_info_t *kc_malloc_private_info)
#else
(kc_n, kc_malloc_private_info) kc_size_t kc_n; kc_memory_info_t *kc_malloc_private_info;
#endif
{	kc_voidptr_t kc_p;
	kc_memory_blocksinfo_t kc_l;
	kc_size_t kc_size;

	/* we use plain malloc for adminstrative things, and test for the return status */
	kc_l = (kc_memory_blocksinfo_t)MALLOC((kc_size_t)sizeof(kc_memory_blockinfo_t));
	kc_size = (kc_malloc_private_info->kc_wanted_blocksize > kc_n) ?  kc_malloc_private_info->kc_wanted_blocksize : kc_n;
	kc_p = (kc_voidptr_t)MALLOC((kc_size_t)kc_size);
	kc_l->block = kc_p;
	kc_l->size = kc_size;
	return kc_l;
}

/*
 * we use first fit when reusing a block
 */
static kc_memory_blocksinfo_t kc_memory_reuseblock
#ifdef KC_USE_PROTOTYPES
(kc_size_t kc_n, kc_memory_info_t *kc_malloc_private_info)
#else
(kc_n, kc_malloc_private_info) kc_size_t kc_n; kc_memory_info_t *kc_malloc_private_info;
#endif
{	kc_memory_blocksinfo_t kc_l;
	if (*kc_malloc_private_info->kc_memory_freelist == 0) { /* no elements in freelist */
		return (kc_memory_blocksinfo_t)0;
	}
	kc_l = *kc_malloc_private_info->kc_memory_freelist;
	do { /* at least one time, because we have at least one element */
		if (kc_l->size >= kc_n) {
			if (kc_l->next != kc_l) { /* the list contains > 1 elements */
				kc_l->prev->next = kc_l->next;
				kc_l->next->prev = kc_l->prev;
				/* make sure that we don't loose the handle to the list */
				if (kc_l ==  *kc_malloc_private_info->kc_memory_freelist) {
					*kc_malloc_private_info->kc_memory_freelist = kc_l->next;
				}
			} else { /* we release the last free element */
				*kc_malloc_private_info->kc_memory_freelist = 0;
			}
			return kc_l;
		}
		kc_l = kc_l->next;
	} while(kc_l != *kc_malloc_private_info->kc_memory_freelist);
	return (kc_memory_blocksinfo_t)0;
}

static void kc_memory_newblock
#ifdef KC_USE_PROTOTYPES
(kc_size_t kc_n, kc_memory_info_t *kc_malloc_private_info)
#else
(kc_n, kc_malloc_private_info) kc_size_t kc_n; kc_memory_info_t *kc_malloc_private_info;
#endif
{	kc_memory_blocksinfo_t kc_l;
	if ((kc_l = kc_memory_reuseblock(kc_n, kc_malloc_private_info)) == 0) {
		kc_l = kc_memory_createblock(kc_n, kc_malloc_private_info);
	}
	if (kc_malloc_private_info->kc_memory_blocklist != 0) {
		kc_l->next = kc_malloc_private_info->kc_memory_blocklist;
		kc_malloc_private_info->kc_memory_blocklist->prev->next = kc_l;
		kc_l->prev = kc_malloc_private_info->kc_memory_blocklist->prev;
		kc_malloc_private_info->kc_memory_blocklist->prev = kc_l;
	} else {
		kc_l->next = kc_l;
		kc_l->prev = kc_l;
	}
	kc_malloc_private_info->kc_memory_blocklist = kc_l;
	kc_malloc_private_info->kc_memory_left = kc_l->size;
	kc_malloc_private_info->kc_memory_ptr = kc_l->block;
}

static void kc_print_memory_blocks_info_statistics
#ifdef KC_USE_PROTOTYPES
(FILE *kc_f, kc_memory_blocksinfo_t kc_a_memory_blocksinfo_t)
#else
(kc_f, kc_a_memory_blocksinfo_t) FILE *kc_f; kc_memory_blocksinfo_t kc_a_memory_blocksinfo_t;
#endif
{	kc_memory_blocksinfo_t kc_tmp = kc_a_memory_blocksinfo_t;
	if (kc_tmp) {
		/* at least one block? */
		do {
			fprintf(kc_f, \"		block-size (at %p): %d\\n\", kc_tmp->block, kc_tmp->size);
			kc_tmp = kc_tmp->next;
		} while(kc_tmp && (kc_tmp != kc_a_memory_blocksinfo_t));
	} else {
		fprintf(kc_f, \"		no blocks allocated\\n\");
	}
}

void kc_print_memory_info_statistics
#ifdef KC_USE_PROTOTYPES
(FILE *kc_f, kc_voidptr_t kc_malloc_private_info)
#else
(kc_f, kc_malloc_private_info) FILE *kc_f; kc_voidptr_t kc_malloc_private_info;
#endif
{
	kc_memory_info_t *kc_a_memory_info_t = (kc_memory_info_t *)kc_malloc_private_info;
	fprintf(kc_f, \"	to-be-freed: %s\\n\", (kc_a_memory_info_t->kc_to_be_freed ? \"yes\" : \"no\"));
	fprintf(kc_f, \"	wanted block-size: %d\\n\", kc_a_memory_info_t->kc_wanted_blocksize);
	fprintf(kc_f, \"	remaining in current block: %d\\n\", kc_a_memory_info_t->kc_memory_left);
	fprintf(kc_f, \"	blocks-info (at %p):\\n\", kc_a_memory_info_t->kc_memory_blocklist);
	kc_print_memory_blocks_info_statistics(kc_f, kc_a_memory_info_t->kc_memory_blocklist);
	fprintf(kc_f, \"	freelist-info (at %p):\\n\", *kc_a_memory_info_t->kc_memory_freelist);
	kc_print_memory_blocks_info_statistics(kc_f, *kc_a_memory_info_t->kc_memory_freelist);
}	

/*
 * the %p in the routine below is ANSI-C standard (but implementation dependent)
 * for void*; instead we could use %p
 */
void kc_print_hashtable_memory_statistics
#ifdef KC_USE_PROTOTYPES
(FILE *kc_f, kc_hashtable_t kc_a_hashtable_t)
#else
(kc_f, kc_a_hashtable_t) FILE *kc_f; kc_hashtable_t kc_a_hashtable_t;
#endif
{	kc_private_malloc_t kc_tmp;
	int kc_i;
	fprintf(kc_f, \"current allocation scheme: %s\\n\",
		((kc_a_hashtable_t->mode == kc_ht_store_static) ? \"static\" : \"dynamic\"));
	if (kc_a_hashtable_t->malloc_info) {
		fprintf(kc_f, \"static allocation info (info ptr: %p):\\n\", kc_a_hashtable_t->static_malloc_private_data);
		(*kc_a_hashtable_t->malloc_info)(kc_f, kc_a_hashtable_t->static_malloc_private_data);
		kc_tmp = kc_a_hashtable_t->dynamic_malloc_private_data;
		kc_i = 0;
		fprintf(kc_f, \"dynamic allocation info: counting from top (level 0) of level stack\\n\");
		while(kc_tmp) {
			fprintf(kc_f, \"dynamic allocation info for level %d,(info ptr: %p):\\n\", kc_i, kc_tmp->malloc_private_data);
			(*kc_a_hashtable_t->malloc_info)(kc_f, kc_tmp->malloc_private_data);
			kc_i++;
			kc_tmp = kc_tmp->next;
		}
		kc_tmp = kc_a_hashtable_t->dec_dynamic_malloc_private_data;
		kc_i = 0;
		fprintf(kc_f, \"dynamic allocation info: levels to be freed, counting from bottom\\n\");
		while(kc_tmp) {
			fprintf(kc_f, \"dynamic allocation info for level %d,(info ptr: %p):\\n\", kc_i, kc_tmp->malloc_private_data);
			(*kc_a_hashtable_t->malloc_info)(kc_f, kc_tmp->malloc_private_data);
			kc_i++;
			kc_tmp = kc_tmp->prev;
		}
	}
}


kc_voidptr_t uniqmalloc	/* check return from malloc */
#ifdef KC_USE_PROTOTYPES
(kc_size_t kc_n, kc_voidptr_t kc_malloc_private_info)
#else
(kc_n, kc_malloc_private_info) kc_size_t kc_n; kc_voidptr_t kc_malloc_private_info;
#endif
{	kc_voidptr_t kc_p;
	kc_memory_info_t *kc_a_memory_info_t = (kc_memory_info_t *)kc_malloc_private_info;	
	/* all blocks should be a multiple of the alignment requirement */
	kc_n += sizeof(kc_Align) - 1 - ((kc_n - 1) % sizeof(kc_Align));
	if ( kc_a_memory_info_t->kc_memory_left < (int)kc_n ) kc_memory_newblock(kc_n, kc_a_memory_info_t);
	kc_a_memory_info_t->kc_memory_left -= kc_n;
	kc_p = kc_a_memory_info_t->kc_memory_ptr;
	kc_a_memory_info_t->kc_memory_ptr = (kc_voidptr_t)((char*)(kc_a_memory_info_t->kc_memory_ptr) + kc_n);
	return kc_p;
}

kc_memory_info_t *uniqmallocinit
#ifdef KC_USE_PROTOTYPES
( /*kc_size_t kc_n*/ )
#else
( /*kc_n*/ ) /*kc_size_t kc_n;*/
#endif
{	kc_memory_info_t *kc_p;
	kc_p = (kc_memory_info_t*)MALLOC((kc_size_t)sizeof(kc_memory_info_t));
	kc_p->kc_memory_blocklist = 0;
	kc_p->kc_memory_left = 0;
	kc_p->kc_memory_ptr = 0;
	kc_p->kc_memory_freelist = &kc_mainmemory_freelist;
	kc_p->kc_to_be_freed = 1;
	kc_p->kc_wanted_blocksize = /*(kc_n <= 0) ?*/ KC_MEMORY_BLOCKSIZE /*: kc_n*/;
	return kc_p;
}

boolean isinuniqmalloccedblock
#ifdef KC_USE_PROTOTYPES
(kc_voidptr_t kc_p, kc_voidptr_t kc_malloc_private_info)
#else
(kc_p, kc_malloc_private_info) kc_voidptr_t kc_p; kc_voidptr_t kc_malloc_private_info;
#endif
{	kc_memory_blocksinfo_t kc_l;
	kc_memory_info_t *kc_a_memory_info_t = (kc_memory_info_t *)kc_malloc_private_info;
	if (kc_a_memory_info_t->kc_memory_blocklist == 0) {
		return False;
	}
	kc_l = kc_a_memory_info_t->kc_memory_blocklist;
	do {
		if (((char*)kc_p >= (char*)kc_l->block) && ((char*)kc_p < (char*)((char*)kc_l->block + kc_l->size))) {
			return True;
		}
		kc_l = kc_l->next;
	} while(kc_l != kc_a_memory_info_t->kc_memory_blocklist);
	return False;
}

/*ARGSUSED*/
void uniqfreeelement	/* free (prepare for reuse of) one element in private info */
#ifdef KC_USE_PROTOTYPES
(kc_voidptr_t kc_ptr, kc_voidptr_t kc_malloc_private_info)
#else
(kc_ptr, kc_malloc_private_info) kc_voidptr_t kc_ptr; kc_voidptr_t kc_malloc_private_info;
#endif
{
}

void uniqfreeall	/* free (prepare for reuse of) everything in private info */
#ifdef KC_USE_PROTOTYPES
(kc_voidptr_t kc_malloc_private_info)
#else
(kc_malloc_private_info) kc_voidptr_t kc_malloc_private_info;
#endif
{
	kc_memory_info_t *kc_a_memory_info_t = (kc_memory_info_t *)kc_malloc_private_info;
	if (kc_a_memory_info_t->kc_memory_blocklist != 0) {
		kc_memory_blocksinfo_t kc_a_memory_blocklist = kc_a_memory_info_t->kc_memory_blocklist;
		kc_memory_blocksinfo_t kc_blockptr = kc_a_memory_blocklist;
		do {
			KC_BZERO(kc_blockptr->block, kc_blockptr->size);
			kc_blockptr = kc_blockptr->next;
		} while (kc_blockptr != kc_a_memory_blocklist);
		if (*kc_a_memory_info_t->kc_memory_freelist == 0) {
			*kc_a_memory_info_t->kc_memory_freelist = kc_a_memory_info_t->kc_memory_blocklist;
		} else {
			kc_a_memory_info_t->kc_memory_blocklist->prev->next = (*kc_a_memory_info_t->kc_memory_freelist);
			(*kc_a_memory_info_t->kc_memory_freelist)->prev->next = kc_a_memory_info_t->kc_memory_blocklist;
			kc_blockptr = kc_a_memory_info_t->kc_memory_blocklist->prev;
			kc_a_memory_info_t->kc_memory_blocklist->prev = (*kc_a_memory_info_t->kc_memory_freelist)->prev;
			(*kc_a_memory_info_t->kc_memory_freelist)->prev = kc_blockptr;;
	}	}
	/* just to be sure, this is NECESSARY in case kc_a_memory_info_t->kc_to_be_freed holds */
	kc_a_memory_info_t->kc_memory_blocklist = 0;
	kc_a_memory_info_t->kc_memory_left = 0;
	kc_a_memory_info_t->kc_memory_ptr = 0;
	kc_a_memory_info_t->kc_memory_left = 0;
	if (kc_a_memory_info_t->kc_to_be_freed) { /* we must be sure that it wasn't dynamically allocated */
		KC_BZERO(kc_a_memory_info_t, sizeof(kc_memory_info_t));
		FREE((kc_voidptr_t)kc_a_memory_info_t);
}	}

/*ARGSUSED*/
kc_voidptr_t kc_wrap_bucket_malloc
#ifdef KC_USE_PROTOTYPES
(kc_size_t kc_a_size, kc_size_t kc_a_number, kc_voidptr_t kc_a_private_malloc_info)
#else
(kc_a_size, kc_a_number, kc_a_private_malloc_info)
kc_size_t kc_a_size; kc_size_t kc_a_number; kc_voidptr_t kc_a_private_malloc_info;
#endif
{	return MALLOC((kc_size_t)kc_a_size*kc_a_number);
}

/*ARGSUSED*/
kc_voidptr_t kc_wrap_bucket_realloc
#ifdef KC_USE_PROTOTYPES
(kc_voidptr_t kc_ptr, kc_size_t kc_a_oldsize, kc_size_t kc_a_newsize, kc_voidptr_t kc_a_private_malloc_info)
#else
(kc_ptr, kc_a_oldsize, kc_a_newsize, kc_a_private_malloc_info)
kc_voidptr_t kc_ptr; kc_size_t kc_a_oldsize; kc_size_t kc_a_newsize; kc_voidptr_t kc_a_private_malloc_info;
#endif
{	return REALLOC(kc_ptr, kc_a_newsize);
}

/*ARGSUSED*/
void kc_wrap_bucket_free
#ifdef KC_USE_PROTOTYPES
(kc_voidptr_t kc_ptr, kc_size_t kc_a_size, kc_voidptr_t kc_a_private_malloc_info)
#else
(kc_ptr, kc_a_size, kc_a_private_malloc_info)
kc_voidptr_t kc_ptr; kc_size_t kc_a_size; kc_voidptr_t kc_a_private_malloc_info;
#endif
{	(void)FREE(kc_ptr);
}

#ifdef KC_STATISTICS
   KC_OPERATOR_STATISTICS kc_OperatorStatistics[KC_NO_OF_OPERATORS];
#  define KC_COLLECT_STATS0(v) v
#else
#  define KC_COLLECT_STATS0(v) 
#endif

#ifndef KC_CREATE_STATS
#  define KC_CREATE_STATS(oper) kc_OperatorStatistics[(int)oper].create++;
#endif
#ifndef KC_EXISTINGNOTFOUND_STATS
#  define KC_EXISTINGNOTFOUND_STATS(oper) kc_OperatorStatistics[(int)oper].existing_not_found++;
#endif

#ifndef KC_FREE_CALLED_STATS
#  define KC_FREE_CALLED_STATS(oper,rec) kc_OperatorStatistics[(int)oper].free_called[(int)(rec?True:False)]++;
#endif

#ifndef KC_FREED_STATS
#  define KC_FREED_STATS(oper,rec) kc_OperatorStatistics[(int)oper].freed[(int)(rec?True:False)]++;
#endif


"
(storageclasses)Thestorageclasses:view_gen_operatordefs_c_0
"

static boolean kc_storageclass_still_uniq[] = {
"
(storageclasses)Thestorageclasses:view_gen_operatordefs_c_1
" };

"
(storageclasses)Thestorageclasses:view_gen_operatordefs_c_2
"

#if 0 /* ! (defined(lint) || defined(SABER) || defined(CODECENTER)) */ /* currently not used */
static kc_memory_info_t *kc_memory_info[] = { "
  (storageclasses)Thestorageclasses:view_gen_operatordefs_c_2a
" };
#endif

static kc_hashtable_struct_t kc_static_hashtables[] = {
"
  (storageclasses)Thestorageclasses:view_gen_operatordefs_c_4
"};

static kc_hashtable_t kc_hashtables[] = {
"
  (storageclasses)Thestorageclasses:view_gen_operatordefs_c_3
"};

static char* kc_storageclassnames[] = { "(storageclasses)Thestorageclasses " };

static kc_hashtable_t kc_all_hashtables = &kc_static_hashtables[0];

static int kc_primes[] = {
	1009,
	1091,
	1193,
	1297,
	1423,
	1543,
	1693,
	1847,
	2003,
	2203,
	2381,
	2609,
	2833,
	3089,
	3371,
	3673,
	4007,
	4373,
	4783,
	5209,
	5683,
	6197,
	6761,
	7369,
	8039,
	8761,
	9587,
	10427,
	11383,
	12409,
	13537,
	14767,
	16111,
	17569,
	19181,
	20921,
	22807,
	24889,
	27143,
	29611,
	32299,
	35251,
	38447,
	41941,
	45751,
	49919,
	54443,
	59387,
	64793,
	70687,
	77101,
	80021,
	84121,
	91753,
	100103,
	109199,
	119129,
	129953,
	141761,
	154643,
	168713,
	184039,
	200771,
	219017,
	238939,
	260647,
	284357,
	310223,
	338407,
	369169,
	402739,
	439339,
	479263,
	522829,
	570359,
	622241,
	678773,
	740477,
	807797,
	881233,
	961339,
	1048759,
	1144081,
	1248083,
	1361573,
	1485347,
	1620347,
	1767679,
	1928351,
	2103653,
	2294891,
	2503511,
	2731103,
	2979391,
	3250243,
	3545719,
	3868057,
	4219687,
	4603297,
	5021773,
	5478299,
	5976329,
	6519647,
	7112351,
	7758899,
	8464273,
	9233729,
	10073153,
	10988893,
	11987891,
	13077707,
	14266573,
	15563531,
	16978399,
	18521897,
	20205697,
	22042607,
	24046487,
	26232491,
	28617269,
	31218823,
	34056907,
	37152979,
	40530541,
	44215117,
	48234733,
	52619639,
	57403277,
	62621729,
	68314613,
	74525021,
	81300017,
	88690949,
	96753739,
	105549557,
	115144957,
	125612671,
	137032001,
	149489477,
	163079431,
	177904801,
	194077981,
	211721429,
	230968853,
	251966009,
	274871969,
	299860369,
	327120389,
	356858597,
	389300293,
	424691207,
	463299493,
	505417691,
	551364677,
	601488779,
	656169539,
	715821317,
	780896041,
	851886569,
	929330767,
	1013815373,
	1105980433,
	1206524183,
	1316208139,
	1435863449,
	1566396463,
	1708796171,
	1864141193,
	2033608601,
0, 0 /* last two elements should ALWAYS be 0 */ };

#ifdef KC_STATISTICS
static int kc_casestring_strlen =0;
static int kc_nocasestring_strlen =0;

void kc_do_print_operator_statistics
#ifdef KC_USE_PROTOTYPES
(FILE * kc_f)
#else
(kc_f) FILE *kc_f;
#endif
{	unsigned int kc_i;
	/*SUPPRESS 622*/
	assertNonNull( kc_f,\"kc_f\" );
	(void)fprintf(kc_f, \"%-*s| %-*s| %-*s| %-*s| %-*s| %-*s| %-*s| %-*s| %-*s| %-*s\\n\", "
(int)FMOP	" , \"Operator\", "
(int)FMSZ	", \"Sz\", "
(int)FMNCR	", \"#oper\", "
(int)FMNCRD	", \"#new\", "
(int)FMEXIST	", \"#exist\", "
(int)FMFRNC	", \"#frnrec\", "
(int)FMFRRC	", \"#frrec\", "
(int)FMFREED	", \"#freed\", "
(int)FMREM	", \"#rem\", "
(int)FMTOT	", \"total (bytes)\");
	(void)fprintf(kc_f, \"%-*s|%*s |%*d |%*d |%*d |%*d |%*d |%*d |%*d |%*d\\n\", "
(int)FMOP	", \"case sensitive strings\", "
(int)FMSZ	", \"-\", "
(int)FMNCR	", kc_OperatorStatistics[(int)sel__Str].create, "
(int)FMNCRD	", kc_OperatorStatistics[(int)sel__Str].existing_not_found, "
(int)FMEXIST	", kc_OperatorStatistics[(int)sel__Str].create-kc_OperatorStatistics[(int)sel__Str].existing_not_found, "
(int)FMFRNC	", 0, "
(int)FMFRRC	", 0, "
(int)FMFREED	", 0, "
(int)FMREM	", 0, "
(int)FMTOT	", kc_casestring_strlen);
	(void)fprintf(kc_f, \"%-*s|%*s |%*d |%*d |%*d |%*d |%*d |%*d |%*d |%*d\\n\", "
(int)FMOP	", \"case insensitive strings\", "
(int)FMSZ	", \"-\", "
(int)FMNCR	", kc_OperatorStatistics[(int)sel_NoCaseStr].create, "
(int)FMNCRD	", kc_OperatorStatistics[(int)sel_NoCaseStr].existing_not_found, "
(int)FMEXIST	", kc_OperatorStatistics[(int)sel_NoCaseStr].create-kc_OperatorStatistics[(int)sel_NoCaseStr].existing_not_found, "
(int)FMFRNC	", 0, "
(int)FMFRRC	", 0, "
(int)FMFREED	", 0, "
(int)FMREM	", 0, "
(int)FMTOT	", kc_nocasestring_strlen);
	for (kc_i = (int)kc_one_before_first_operator+1; kc_i < (int)kc_last_operator; kc_i++) {
		(void)fprintf(kc_f, \"%-*s|%*d |%*d |%*d |%*d |%*d |%*d |%*d |%*d |%*d\\n\", "
(int)FMOP	", kc_OperatorInfo[kc_i].name, "
(int)FMSZ	", kc_PhylumInfo[(int)kc_OperatorInfo[kc_i].phylum].size, "
(int)FMNCR	", kc_OperatorStatistics[kc_i].create, "
(int)FMNCRD	", kc_OperatorStatistics[kc_i].existing_not_found, "
(int)FMEXIST	", kc_OperatorStatistics[kc_i].create-kc_OperatorStatistics[kc_i].existing_not_found, "
(int)FMFRNC	", kc_OperatorStatistics[kc_i].free_called[(int)False], "
(int)FMFRRC	", kc_OperatorStatistics[kc_i].free_called[(int)True], "
(int)FMFREED	", kc_OperatorStatistics[kc_i].freed[(int)False]+kc_OperatorStatistics[kc_i].freed[(int)True], "
(int)FMREM	", kc_OperatorStatistics[kc_i].existing_not_found-(kc_OperatorStatistics[kc_i].freed[(int)False]+kc_OperatorStatistics[kc_i].freed[(int)True]), "
(int)FMTOT	", (kc_PhylumInfo[(int)kc_OperatorInfo[(int)kc_i].phylum].size)*(kc_OperatorStatistics[kc_i].existing_not_found-(kc_OperatorStatistics[kc_i].freed[(int)False]+kc_OperatorStatistics[kc_i].freed[(int)True])));
	}
}
#endif /* KC_STATISTICS */

void kc_print_hash_statistics
#ifdef KC_USE_PROTOTYPES
(FILE *kc_f)
#else
(kc_f) FILE *kc_f;
#endif
{	unsigned int kc_k;
	/*SUPPRESS 622*/
	/*assertNonNull(kc_f,\"kc_f\");*/ if (kc_f == NULL) kc_f = stdout;
	for (kc_k=0; kc_k < (int)kc_last_storageclass; kc_k++) {
		(void)fprintf(kc_f, \"Information for storage class %s: \\n\", kc_storageclassnames[kc_k]);
		kc_print_hashtable_statistics(kc_f, kc_hashtables[kc_k]);
}	}

void kc_print_all_hashtable_statistics
#ifdef KC_USE_PROTOTYPES
(FILE *kc_f)
#else
(kc_f) FILE *kc_f;
#endif
{	kc_hashtable_t kc_a_hashtable_t = kc_all_hashtables;
	unsigned int kc_k;
	boolean kc_st_found;
	/*SUPPRESS 622*/
	/*assertNonNull(kc_f,\"kc_f\");*/ if (kc_f == NULL) kc_f = stdout;
	do { /* at least one time, because we have at least one element */
		kc_st_found = False;
		for (kc_k=0; kc_k < (int)kc_last_storageclass; kc_k++) {
			if (kc_hashtables[kc_k] == kc_a_hashtable_t) {
				kc_st_found = True;
				(void)fprintf(kc_f, \"Information for storage class %s: \\n\", kc_storageclassnames[kc_k]);
		}	}
		if (! kc_st_found) {
			(void)fprintf(kc_f, \"Information for unknown storage class: \\n\");
		}
		kc_print_hashtable_statistics(kc_f, kc_a_hashtable_t);
		kc_print_hashtable_memory_statistics(kc_f, kc_a_hashtable_t);
		kc_a_hashtable_t = kc_a_hashtable_t->next;
	} while(kc_a_hashtable_t != kc_all_hashtables);
}

void kc_print_hashtable_statistics
#ifdef KC_USE_PROTOTYPES
(FILE *kc_f, kc_hashtable_t kc_a_hashtable_t)
#else
(kc_f, kc_a_hashtable_t) FILE *kc_f; kc_hashtable_t kc_a_hashtable_t;
#endif
{
	boolean kc_goon;
	int kc_entries[9];
	int kc_o_8 = 0;
	int kc_o_20 = 0;
	int kc_o_100 = 0;
	int kc_total = 0;
	int kc_i, kc_j;

	/*SUPPRESS 622*/
	/*(kc_f,\"kc_f\");*/ if (kc_f == NULL) kc_f = stdout;
	(void)fprintf(kc_f, \"\\tsize:\\t%d\\n\",kc_a_hashtable_t->size);
	for (kc_i=0; kc_i < 9; kc_i++) kc_entries[kc_i]=0;
	for (kc_i=0;kc_i<kc_a_hashtable_t->size;kc_i++) {
		int kc_m=0, kc_n;
		for (kc_n=0;kc_n<(int)kc_last_storage_mode;kc_n++) {
			kc_m += kc_a_hashtable_t->hashtable[kc_i][kc_n].nr;
		}
		kc_total += kc_m;
		if (kc_m >100) {kc_o_100 ++; (void)fprintf(kc_f, \">100: key %d (%d elts)\\n\",kc_i,kc_m); }
		else if (kc_m >20) {kc_o_20 ++; (void)fprintf(kc_f, \">20: key %d (%d elts)\\n\",kc_i,kc_m); }
		else if (kc_m > 8) kc_o_8 ++;
		else {
			kc_j =0; kc_goon = True;
			while ( kc_goon && (kc_j < 9)) {
				if (kc_m == kc_j) { kc_entries[kc_j]++; kc_goon = False; }
				else kc_j++;
	}	}	}
	(void)fprintf(kc_f, \"The spreading is: \\n\");
	for (kc_j=0; kc_j < 9; kc_j++) {
		(void)fprintf(kc_f, \"\\t%d elts:\\t%d\\n\",kc_j, kc_entries[kc_j]);
	}
	(void)fprintf(kc_f, \"\\tOver 8 elts:\\t%d\\n\",kc_o_8);
	(void)fprintf(kc_f, \"\\tOver 20 elts:\\t%d\\n\",kc_o_20);
	(void)fprintf(kc_f, \"\\tOver 100 elts:\\t%d\\n\",kc_o_100);
	(void)fprintf(kc_f, \" Total number of cells: %d\\n\",kc_total);
	(void)fprintf(kc_f, \" Number of buckets: %d\\n\",kc_a_hashtable_t->size);
}

static void kc_growindex
#ifdef KC_USE_PROTOTYPES
(kc_hashtableentry_t *kc_hte, kc_hashtable_t kc_a_ht)
#else
(kc_hte, kc_a_ht) kc_hashtableentry_t *kc_hte; kc_hashtable_t kc_a_ht;
#endif
{	int kc_newsize = kc_hte->ibound + kc_a_ht->bucket_alloc_inc;
	if (kc_newsize == kc_a_ht->bucket_alloc_inc)
		kc_hte->index = (YYSTYPE *) (*kc_a_ht->bucket_calloc)((kc_size_t)kc_newsize, (kc_size_t)sizeof(YYSTYPE), kc_a_ht->bucket_alloc_private_data);
	else
		kc_hte->index = (YYSTYPE *) (*kc_a_ht->bucket_realloc)((kc_voidptr_t)kc_hte->index, (kc_size_t)kc_hte->ibound * sizeof(YYSTYPE), (kc_size_t)kc_newsize * sizeof(YYSTYPE), kc_a_ht->bucket_alloc_private_data);
	kc_hte->ibound = kc_newsize;
}

void kc_ht_static
#ifdef KC_USE_PROTOTYPES
(kc_storageclass_t kc_a_storageclass_t)
#else
(kc_a_storageclass_t) kc_storageclass_t kc_a_storageclass_t;
#endif
{
	kc_hashtables[(int)kc_a_storageclass_t]->mode = kc_ht_store_static;
	kc_hashtables[(int)kc_a_storageclass_t]->malloc_private_data = kc_hashtables[(int)kc_a_storageclass_t]->static_malloc_private_data;
}

void kc_ht_dynamic
#ifdef KC_USE_PROTOTYPES
(kc_storageclass_t kc_a_storageclass_t)
#else
(kc_a_storageclass_t) kc_storageclass_t kc_a_storageclass_t;
#endif
{
	kc_hashtables[(int)kc_a_storageclass_t]->mode = kc_ht_store_dynamic;
	if (kc_hashtables[(int)kc_a_storageclass_t]->dynamic_malloc_private_data != 0) {
		kc_ht_inc_level(kc_a_storageclass_t);
	}
	kc_hashtables[(int)kc_a_storageclass_t]->malloc_private_data = kc_hashtables[(int)kc_a_storageclass_t]->dynamic_malloc_private_data->malloc_private_data;
}

void kc_ht_inc_level
#ifdef KC_USE_PROTOTYPES
(kc_storageclass_t kc_a_storageclass_t)
#else
(kc_a_storageclass_t) kc_storageclass_t kc_a_storageclass_t;
#endif
{
	kc_private_malloc_t kc_a_private_malloc_t = (kc_private_malloc_t)MALLOC(sizeof(struct kc_tag_kc_private_malloc_t));
	kc_a_private_malloc_t->next = kc_hashtables[(int)kc_a_storageclass_t]->dynamic_malloc_private_data;
	if (kc_hashtables[(int)kc_a_storageclass_t]->dynamic_malloc_private_data != 0 ) {
		kc_hashtables[(int)kc_a_storageclass_t]->dynamic_malloc_private_data->prev = kc_a_private_malloc_t;
	}
	kc_a_private_malloc_t->prev = kc_hashtables[(int)kc_a_storageclass_t]->dec_dynamic_malloc_private_data;
	kc_a_private_malloc_t->malloc_private_data = (*kc_hashtables[(int)kc_a_storageclass_t]->malloc_initialise)();
	kc_hashtables[(int)kc_a_storageclass_t]->dynamic_malloc_private_data = kc_a_private_malloc_t;
}

void kc_ht_dec_level
#ifdef KC_USE_PROTOTYPES
(kc_storageclass_t kc_a_storageclass_t)
#else
(kc_a_storageclass_t) kc_storageclass_t kc_a_storageclass_t;
#endif
{
	int kc_i, kc_j, kc_m;
	kc_hashtableentry_t* kc_hte;

	kc_hashtable_t kc_a_hashtable_t = kc_hashtables[(int)kc_a_storageclass_t];
	if (kc_a_hashtable_t->dynamic_malloc_private_data != 0) {
		kc_a_hashtable_t->dec_dynamic_malloc_private_data = kc_a_hashtable_t->dynamic_malloc_private_data;
		kc_a_hashtable_t->dynamic_malloc_private_data = kc_a_hashtable_t->dynamic_malloc_private_data->next;
		for (kc_i=0; kc_i < kc_a_hashtable_t->size; kc_i++) {
			kc_m = (int)kc_ht_store_dynamic;
			kc_hte = &kc_a_hashtable_t->hashtable[kc_i][kc_m];
			for (kc_j=kc_hte->nr -1; kc_j >= 0; kc_j--) {
				kc_private_malloc_t kc_a_private_malloc_t = kc_a_hashtable_t->dec_dynamic_malloc_private_data;
				boolean kc_is_in_block = (*kc_a_hashtable_t->in_block)((kc_voidptr_t)kc_hte->index[kc_j].yt_casestring, kc_a_private_malloc_t->malloc_private_data);
#if 0 /* not necessary, because every kc_ht_dec_level call takes care of its own level */
				while ((!kc_is_in_block) && kc_a_private_malloc_t->prev) {
					kc_a_private_malloc_t = kc_a_private_malloc_t->prev;
					kc_is_in_block = (*kc_a_hashtable_t->in_block)((kc_voidptr_t)kc_hte->index[kc_j].yt_casestring, kc_a_private_malloc_t->malloc_private_data);
				}
#endif
				if (kc_is_in_block) {
					kc_hte->nr--;
					kc_hte->index[kc_j] = kc_hte->index[kc_hte->nr];
					kc_hte->index[kc_hte->nr].yt_casestring = 0;
				}
#ifdef KC_SEPARATE_HASH_LEVELS
				  else {
					break;
				}
#endif
		}	}
	} else {
		/* should be a better error message */
		/*SUPPRESS 622*/
		assert(kc_zero_constant); 
}	}

/* free the previous level(s) in the level-list, ie
 * the sublist that is reachable via dec_dynamic_malloc_private_data,
 * and via the prev field of the current dynamic node, if defined
 * follow prev's to the left start, freeing the blocks while moving
 * and freeing the administration nodes themselves
 */
static void kc_ht_do_free_level
#ifdef KC_USE_PROTOTYPES
(kc_hashtable_t kc_a_hashtable_t)
#else
(kc_a_hashtable_t) kc_hashtable_t kc_a_hashtable_t;
#endif
{	kc_private_malloc_t kc_a_private_malloc_t, kc_b_private_malloc_t;
	if (kc_a_hashtable_t->dec_dynamic_malloc_private_data != 0) {
		kc_a_private_malloc_t = kc_a_hashtable_t->dec_dynamic_malloc_private_data;
		while (kc_a_private_malloc_t != 0) {
			if (kc_a_hashtable_t->free_all_elements != 0) {
				(*kc_a_hashtable_t->free_all_elements)(kc_a_private_malloc_t->malloc_private_data);
			}
			kc_b_private_malloc_t = kc_a_private_malloc_t;
			kc_a_private_malloc_t = kc_a_private_malloc_t->prev;
			KC_BZERO(kc_b_private_malloc_t, sizeof(struct kc_tag_kc_private_malloc_t));
			FREE((kc_voidptr_t)kc_b_private_malloc_t);
		}
		kc_a_hashtable_t->dec_dynamic_malloc_private_data = 0;
		if (kc_a_hashtable_t->dynamic_malloc_private_data != 0) {
			kc_a_hashtable_t->dynamic_malloc_private_data->prev = 0;
}	}	}

void kc_ht_free_level
#ifdef KC_USE_PROTOTYPES
(kc_storageclass_t kc_a_storageclass_t)
#else
(kc_a_storageclass_t) kc_storageclass_t kc_a_storageclass_t;
#endif
{
	kc_ht_do_free_level(kc_hashtables[(int)kc_a_storageclass_t]);
}

static int kc_choose_prime
#ifdef KC_USE_PROTOTYPES
(int kc_a_size)
#else
(kc_a_size) int kc_a_size;
#endif
{	int kc_i =0;
	while((kc_primes[kc_i] < kc_a_size) && (kc_primes[kc_i+1] > 0)) {
		kc_i++;
	}
	return kc_primes[kc_i];
}

kc_hashtable_t kc_ht_create_bucketmanagement
#ifdef KC_USE_PROTOTYPES
(int kc_a_size,
 kc_voidptr_t (*kc_a_malloc_initialise)(),
 kc_voidptr_t (*kc_a_malloc)(kc_size_t, kc_voidptr_t),
 void (*kc_a_free_element)(kc_voidptr_t, kc_voidptr_t),
 void (*kc_a_free_all_elements)(kc_voidptr_t),
 boolean (*kc_a_in_block)(kc_voidptr_t, kc_voidptr_t),
 void (*kc_a_malloc_info)(FILE*, kc_voidptr_t),
 kc_voidptr_t (*kc_a_bucket_alloc_initialise)(),
 kc_voidptr_t (*kc_a_bucket_calloc)(kc_size_t, kc_size_t, kc_voidptr_t),
 kc_voidptr_t (*kc_a_bucket_realloc)( kc_voidptr_t, kc_size_t, kc_size_t, kc_voidptr_t),
 void (*kc_a_free_bucket)(kc_voidptr_t, kc_size_t, kc_voidptr_t),
 void (*kc_a_free_buckets)(kc_voidptr_t),
 int kc_a_bucket_alloc_inc,
 void (*kc_a_bucket_alloc_info)(FILE*, kc_voidptr_t)
)
#else
(kc_a_size,
 kc_a_malloc_initialise,
 kc_a_malloc,
 kc_a_free_element,
 kc_a_free_all_elements,
 kc_a_in_block,
 kc_a_malloc_info,
 kc_a_bucket_alloc_initialise,
 kc_a_bucket_calloc,
 kc_a_bucket_realloc,
 kc_a_free_bucket,
 kc_a_free_buckets,
 kc_a_bucket_alloc_inc,
 kc_a_bucket_alloc_info
)
 int kc_a_size;
 kc_voidptr_t (*kc_a_malloc_initialise)KC__P(());
 kc_voidptr_t (*kc_a_malloc)KC__P((kc_size_t, kc_voidptr_t));
 void (*kc_a_free_element)KC__P((kc_voidptr_t, kc_voidptr_t));
 void (*kc_a_free_all_elements)KC__P((kc_voidptr_t));
 boolean (*kc_a_in_block)KC__P((kc_voidptr_t, kc_voidptr_t));
 void (*kc_a_malloc_info)KC__P((FILE*, kc_voidptr_t));
 kc_voidptr_t (*kc_a_bucket_alloc_initialise)KC__P(());
 kc_voidptr_t (*kc_a_bucket_calloc)KC__P((kc_size_t, size_t, kc_voidptr_t));
 kc_voidptr_t (*kc_a_bucket_realloc)KC__P(( kc_voidptr_t, kc_size_t, kc_size_t, kc_voidptr_t));
 void (*kc_a_free_bucket)KC__P((kc_voidptr_t, kc_size_t, kc_voidptr_t));
 void (*kc_a_free_buckets)KC__P((kc_voidptr_t));
 int kc_a_bucket_alloc_inc;
 void (*kc_a_bucket_alloc_info)KC__P((FILE*, kc_voidptr_t));
#endif
{	kc_hashtable_t kc_a_hashtable_t = (kc_hashtable_t)MALLOC(sizeof(kc_hashtable_struct_t));
	kc_a_hashtable_t->size = kc_choose_prime(kc_a_size);
	kc_a_hashtable_t->hashtable = (kc_hashtableentry_t(*)[(int)kc_last_storage_mode])CALLOC((kc_size_t)kc_a_hashtable_t->size*((int)kc_last_storage_mode), (kc_size_t)sizeof(kc_hashtableentry_t));

	kc_a_hashtable_t->malloc_initialise = kc_a_malloc_initialise;
	kc_a_hashtable_t->malloc = kc_a_malloc;
	kc_a_hashtable_t->free_element = kc_a_free_element;
	kc_a_hashtable_t->free_all_elements = kc_a_free_all_elements;
	kc_a_hashtable_t->in_block = kc_a_in_block;
	kc_a_hashtable_t->static_malloc_private_data = (kc_voidptr_t)(*kc_a_hashtable_t->malloc_initialise)();
	kc_a_hashtable_t->malloc_private_data = kc_a_hashtable_t->static_malloc_private_data;
	kc_a_hashtable_t->dynamic_malloc_private_data = 0;
	kc_a_hashtable_t->dec_dynamic_malloc_private_data = 0;
	kc_a_hashtable_t->mode = kc_ht_store_static;
	kc_a_hashtable_t->malloc_info = kc_a_malloc_info;

	kc_a_hashtable_t->bucket_alloc_initialise = kc_a_bucket_alloc_initialise;
	kc_a_hashtable_t->bucket_calloc = kc_a_bucket_calloc;
	kc_a_hashtable_t->bucket_realloc = kc_a_bucket_realloc;
	kc_a_hashtable_t->free_bucket = kc_a_free_bucket;
	kc_a_hashtable_t->free_buckets = kc_a_free_buckets;
	kc_a_hashtable_t->bucket_alloc_info = kc_a_bucket_alloc_info;
	kc_a_hashtable_t->bucket_alloc_inc = (kc_a_bucket_alloc_inc ? kc_a_bucket_alloc_inc : KC_BUCKET_INC);
	kc_a_hashtable_t->bucket_alloc_private_data = (kc_a_hashtable_t->bucket_alloc_initialise)
						      ? (kc_voidptr_t)(*kc_a_hashtable_t->bucket_alloc_initialise)()
						      : 0;

	kc_a_hashtable_t->kc_to_be_freed = 1;
	kc_a_hashtable_t->next = kc_all_hashtables;
	kc_a_hashtable_t->prev = kc_all_hashtables->prev;
	kc_all_hashtables->prev->next = kc_a_hashtable_t;
	kc_all_hashtables->prev = kc_a_hashtable_t;
	kc_all_hashtables = kc_a_hashtable_t;
	return kc_a_hashtable_t;
}

kc_hashtable_t kc_ht_create
#ifdef KC_USE_PROTOTYPES
(int kc_a_size, kc_voidptr_t (*kc_a_malloc_initialise)(), kc_voidptr_t (*kc_a_malloc)(kc_size_t, kc_voidptr_t),
 void (*kc_a_free_element)(kc_voidptr_t, kc_voidptr_t), void (*kc_a_free_all_elements)(kc_voidptr_t),
 boolean (*kc_a_in_block)(kc_voidptr_t, kc_voidptr_t))
#else
(kc_a_size, kc_a_malloc_initialise, kc_a_malloc, kc_a_free_element, kc_a_free_all_elements, kc_a_in_block)
 int kc_a_size; kc_voidptr_t (*kc_a_malloc_initialise)KC__P(()); kc_voidptr_t (*kc_a_malloc)KC__P((kc_size_t, kc_voidptr_t));
 void (*kc_a_free_element)KC__P((kc_voidptr_t, kc_voidptr_t)); void (*kc_a_free_all_elements)KC__P((kc_voidptr_t));
 boolean (*kc_a_in_block)KC__P((kc_voidptr_t, kc_voidptr_t));
#endif
{
	kc_voidptr_t (*kc_tmp_malloc_initialise)KC__P(()) = (kc_voidptr_t(*)())UNIQMALLOCINIT;
	void (*kc_tmp_malloc_info)KC__P((FILE*, kc_voidptr_t)) = (kc_tmp_malloc_initialise == kc_a_malloc_initialise)
								? (void(*)KC__P((FILE*, kc_voidptr_t)))UNIQMEMORYINFO
								: (void(*)KC__P((FILE*, kc_voidptr_t)))0
								;
	/* do something special (wrt mallocinfo?) if we know that our malloc is being used */
	return kc_ht_create_bucketmanagement(kc_a_size, kc_a_malloc_initialise, kc_a_malloc, kc_a_free_element, kc_a_free_all_elements, kc_a_in_block, kc_tmp_malloc_info,
					    (kc_voidptr_t(*)())BUCKETALLOCINIT, BUCKETCALLOC, BUCKETREALLOC, BUCKETFREE, (void(*)KC__P((kc_voidptr_t)))BUCKETSFREE,
					     BUCKETINC, (void(*)KC__P((FILE*, kc_voidptr_t)))BUCKETMEMORYINFO);
}

kc_hashtable_t kc_ht_create_simple
#ifdef KC_USE_PROTOTYPES
(int kc_a_size)
#else
(kc_a_size) int kc_a_size;
#endif
{
	return kc_ht_create_bucketmanagement(kc_a_size, (kc_voidptr_t(*)())UNIQMALLOCINIT, UNIQMALLOC2, (void (*)KC__P((kc_voidptr_t, kc_voidptr_t)))0/*UNIQFREEELEMENT*/, UNIQFREEALL, INUNIQBLOCK,
			    UNIQMEMORYINFO, (kc_voidptr_t(*)())BUCKETALLOCINIT, BUCKETCALLOC, BUCKETREALLOC, BUCKETFREE, (void(*)KC__P((kc_voidptr_t)))BUCKETSFREE, BUCKETINC, (void(*)KC__P((FILE*, kc_voidptr_t)))BUCKETMEMORYINFO);
}

kc_hashtable_t kc_ht_assign
#ifdef KC_USE_PROTOTYPES
(kc_hashtable_t kc_a_hashtable_t, kc_storageclass_t kc_a_storageclass_t)
#else
(kc_a_hashtable_t, kc_a_storageclass_t) kc_hashtable_t kc_a_hashtable_t; kc_storageclass_t kc_a_storageclass_t;
#endif
{	kc_hashtable_t kc_tmp = kc_hashtables[(int)kc_a_storageclass_t];
	kc_hashtables[(int)kc_a_storageclass_t] = kc_a_hashtable_t;
	kc_storageclass_still_uniq[(int)kc_a_storageclass_t] = False;
	return kc_tmp;
}

kc_hashtable_t kc_ht_assigned
#ifdef KC_USE_PROTOTYPES
(kc_storageclass_t kc_a_storageclass_t)
#else
(kc_a_storageclass_t) kc_storageclass_t kc_a_storageclass_t;
#endif
{	return kc_hashtables[(int)kc_a_storageclass_t];
}

static void kc_ht_free_single_elements
#ifdef KC_USE_PROTOTYPES
(kc_hashtable_t kc_a_hashtable_t, int kc_i, int kc_m)
#else
(kc_a_hashtable_t, kc_i, kc_m) kc_hashtable_t kc_a_hashtable_t; int kc_i; int kc_m;
#endif
{	int kc_j;
	if ((int)kc_m == (int)kc_ht_store_static) {
		for (kc_j=0; kc_j < kc_a_hashtable_t->hashtable[kc_i][kc_m].nr; kc_j++) {
			(*kc_a_hashtable_t->free_element)((kc_voidptr_t)kc_a_hashtable_t->hashtable[kc_i][kc_m].index[kc_j].yt_casestring, kc_a_hashtable_t->static_malloc_private_data);
		}
	} else {
		kc_voidptr_t kc_a_private_data = 0;
		if ((kc_a_hashtable_t->dynamic_malloc_private_data == 0) || (kc_a_hashtable_t->dynamic_malloc_private_data->malloc_private_data == 0)) {
			kc_a_private_data = 0;
		} else if (kc_a_hashtable_t->dynamic_malloc_private_data->next == 0) {
			kc_a_private_data = kc_a_hashtable_t->dynamic_malloc_private_data->malloc_private_data;
		}
		for (kc_j=0; kc_j < kc_a_hashtable_t->hashtable[kc_i][kc_m].nr; kc_j++) {
			(*kc_a_hashtable_t->free_element)((kc_voidptr_t)kc_a_hashtable_t->hashtable[kc_i][kc_m].index[kc_j].yt_casestring, kc_a_private_data);
		}
	}
}

static void kc_ht_do_clear_all_elements
#ifdef KC_USE_PROTOTYPES
(kc_hashtable_t kc_a_hashtable_t, boolean kc_reuse, boolean kc_reinit)
#else
(kc_a_hashtable_t, kc_reuse, kc_reinit) kc_hashtable_t kc_a_hashtable_t; boolean kc_reuse; boolean kc_reinit;
#endif
{	int kc_i, kc_m;
	kc_private_malloc_t kc_a_private_malloc_t;
/* free all static stuff */
	(*kc_a_hashtable_t->free_all_elements)(kc_a_hashtable_t->static_malloc_private_data);
/* free all dynamic stuff */
	/* walk to end of list of levels, kc_ht_do_free_level will free last and all
	 * previous levels in the list
	 */
	if (kc_a_hashtable_t->dynamic_malloc_private_data != 0) {
		kc_a_private_malloc_t = kc_a_hashtable_t->dynamic_malloc_private_data;
		while(kc_a_private_malloc_t->next != 0) {
			kc_a_private_malloc_t = kc_a_private_malloc_t->next;
		}
		kc_a_hashtable_t->dec_dynamic_malloc_private_data = kc_a_private_malloc_t;
		kc_a_hashtable_t->dynamic_malloc_private_data = 0;
		kc_ht_do_free_level(kc_a_hashtable_t);
	}
/* free/reuse the buckets, and re-initialize the hashtable-entries */
	if (kc_reuse) { /* zero the buckets; reset nr field */
		for (kc_i=0; kc_i < kc_a_hashtable_t->size; kc_i++) {
			for (kc_m=0; kc_m < (int)kc_last_storage_mode; kc_m++) {
				/* we only do something if nr !=0, else there is nothing to do
				 * because of our 'invariant'
				 */
				if (kc_a_hashtable_t->hashtable[kc_i][kc_m].nr) {
					KC_BZERO((kc_voidptr_t)kc_a_hashtable_t->hashtable[kc_i][kc_m].index,
					 	 (kc_size_t)kc_a_hashtable_t->hashtable[kc_i][kc_m].ibound * sizeof(YYSTYPE));
					kc_a_hashtable_t->hashtable[kc_i][kc_m].nr = 0;
		}	}	}
	} else if (kc_reinit) { /* zero & free the buckets; reset nr, index, ibound fields */
		if (kc_a_hashtable_t->free_buckets) {
			(*kc_a_hashtable_t->free_buckets)(kc_a_hashtable_t->bucket_alloc_private_data);
			KC_BZERO(kc_a_hashtable_t->hashtable, (kc_size_t)kc_a_hashtable_t->size*((int)kc_last_storage_mode)*sizeof(kc_hashtableentry_t));
#if 0
			for (kc_i=0; kc_i < kc_a_hashtable_t->size; kc_i++) {
				for (kc_m=0; kc_m < (int)kc_last_storage_mode; kc_m++) {
					/* we do something if ibound !=0, it is not suficient to
					 * look only at the nr field, because the nr field might be
					 * reset in a previous reuse operation.
					 * we could as well look for an non-null index field.
					 */
					if (kc_a_hashtable_t->hashtable[kc_i][kc_m].ibound) {
						kc_a_hashtable_t->hashtable[kc_i][kc_m].index = 0;
						kc_a_hashtable_t->hashtable[kc_i][kc_m].ibound = 0;
						kc_a_hashtable_t->hashtable[kc_i][kc_m].nr = 0;
			}	}	}
#endif
		} else if (kc_a_hashtable_t->free_bucket) {
			for (kc_i=0; kc_i < kc_a_hashtable_t->size; kc_i++) {
				for (kc_m=0; kc_m < (int)kc_last_storage_mode; kc_m++) {
					/* we do something if ibound !=0, it is not suficient to
					 * look only at the nr field, because the nr field might be
					 * reset in a previous reuse operation.
					 * we could as well look for an non-null index field.
					 */
					if (kc_a_hashtable_t->hashtable[kc_i][kc_m].ibound) {
						KC_BZERO((kc_voidptr_t)kc_a_hashtable_t->hashtable[kc_i][kc_m].index,
							  (kc_size_t)kc_a_hashtable_t->hashtable[kc_i][kc_m].ibound * sizeof(YYSTYPE));
						(*kc_a_hashtable_t->free_bucket)((kc_voidptr_t)kc_a_hashtable_t->hashtable[kc_i][kc_m].index,
										 (kc_size_t)kc_a_hashtable_t->hashtable[kc_i][kc_m].ibound * sizeof(YYSTYPE),
										 kc_a_hashtable_t->bucket_alloc_private_data);
						kc_a_hashtable_t->hashtable[kc_i][kc_m].index = 0;
						kc_a_hashtable_t->hashtable[kc_i][kc_m].ibound = 0;
						kc_a_hashtable_t->hashtable[kc_i][kc_m].nr = 0;
			}	}	}
		} else {
			/* should be a better error message */
			/*SUPPRESS 622*/
			assert(kc_zero_constant); 
		}
	} else { /* zero & free the buckets */
		if (kc_a_hashtable_t->free_buckets) {
			(*kc_a_hashtable_t->free_buckets)(kc_a_hashtable_t->bucket_alloc_private_data);
		} else if (kc_a_hashtable_t->free_bucket) {
			for (kc_i=0; kc_i < kc_a_hashtable_t->size; kc_i++) {
				for (kc_m=0; kc_m < (int)kc_last_storage_mode; kc_m++) {
					/* we do something if index !=0, it is not suficient to
					 * look only at the nr field, because the nr field might be
					 * reset in a previous reuse operation.
					 * we could as well look for an non-null ibound field.
					 */
					if (kc_a_hashtable_t->hashtable[kc_i][kc_m].index) {
						KC_BZERO((kc_voidptr_t)kc_a_hashtable_t->hashtable[kc_i][kc_m].index,
							  (kc_size_t)kc_a_hashtable_t->hashtable[kc_i][kc_m].ibound * sizeof(YYSTYPE));
						(*kc_a_hashtable_t->free_bucket)((kc_voidptr_t)kc_a_hashtable_t->hashtable[kc_i][kc_m].index,
										 (kc_size_t)kc_a_hashtable_t->hashtable[kc_i][kc_m].ibound * sizeof(YYSTYPE),
										 kc_a_hashtable_t->bucket_alloc_private_data);
			}	}	}
		} else {
			/* should be a better error message */
			/*SUPPRESS 622*/
			assert(kc_zero_constant); 
		}
	}
}

static void kc_ht_do_clear_no_all_elements
#ifdef KC_USE_PROTOTYPES
(kc_hashtable_t kc_a_hashtable_t, boolean kc_reuse, boolean kc_reinit)
#else
(kc_a_hashtable_t, kc_reuse, kc_reinit) kc_hashtable_t kc_a_hashtable_t; boolean kc_reuse; boolean kc_reinit;
#endif
{	int kc_i, kc_m;
/* free all static stuff */
	/* done on the fly, below */
/* free all dynamic stuff */
	/* done on the fly, below */
/* free/reuse the buckets, and re-initialize the hashtable-entries */
	if (kc_reuse) { /* zero the buckets; reset nr field */
		for (kc_i=0; kc_i < kc_a_hashtable_t->size; kc_i++) {
			for (kc_m=0; kc_m < (int)kc_last_storage_mode; kc_m++) {
				/* we only do something if nr !=0, else there is nothing to do
				 * because of our 'invariant'
				 */
				if (kc_a_hashtable_t->hashtable[kc_i][kc_m].nr) {
					kc_ht_free_single_elements(kc_a_hashtable_t, kc_i, kc_m);
					KC_BZERO((kc_voidptr_t)kc_a_hashtable_t->hashtable[kc_i][kc_m].index,
					 	 (kc_size_t)kc_a_hashtable_t->hashtable[kc_i][kc_m].ibound * sizeof(YYSTYPE));
					kc_a_hashtable_t->hashtable[kc_i][kc_m].nr = 0;
		}	}	}
	} else if (kc_reinit) { /* zero & free the buckets; reset nr, index, ibound fields */
		if (kc_a_hashtable_t->free_buckets) {
			(*kc_a_hashtable_t->free_buckets)(kc_a_hashtable_t->bucket_alloc_private_data);
			KC_BZERO(kc_a_hashtable_t->hashtable, (kc_size_t)kc_a_hashtable_t->size*((int)kc_last_storage_mode)*sizeof(kc_hashtableentry_t));
#if 0
			for (kc_i=0; kc_i < kc_a_hashtable_t->size; kc_i++) {
				for (kc_m=0; kc_m < (int)kc_last_storage_mode; kc_m++) {
					/* we do something if ibound !=0, it is not suficient to
					 * look only at the nr field, because the nr field might be
					 * reset in a previous reuse operation.
					 * we could as well look for an non-null index field.
					 */
					if (kc_a_hashtable_t->hashtable[kc_i][kc_m].ibound) {
						kc_ht_free_single_elements(kc_a_hashtable_t, kc_i, kc_m);
						kc_a_hashtable_t->hashtable[kc_i][kc_m].index = 0;
						kc_a_hashtable_t->hashtable[kc_i][kc_m].ibound = 0;
						kc_a_hashtable_t->hashtable[kc_i][kc_m].nr = 0;
			}	}	}
#endif
		} else if (kc_a_hashtable_t->free_bucket) {
			for (kc_i=0; kc_i < kc_a_hashtable_t->size; kc_i++) {
				for (kc_m=0; kc_m < (int)kc_last_storage_mode; kc_m++) {
					/* we do something if ibound !=0, it is not suficient to
					 * look only at the nr field, because the nr field might be
					 * reset in a previous reuse operation.
					 * we could as well look for an non-null index field.
					 */
					if (kc_a_hashtable_t->hashtable[kc_i][kc_m].ibound) {
						kc_ht_free_single_elements(kc_a_hashtable_t, kc_i, kc_m);
						KC_BZERO((kc_voidptr_t)kc_a_hashtable_t->hashtable[kc_i][kc_m].index,
							  (kc_size_t)kc_a_hashtable_t->hashtable[kc_i][kc_m].ibound * sizeof(YYSTYPE));
						(*kc_a_hashtable_t->free_bucket)((kc_voidptr_t)kc_a_hashtable_t->hashtable[kc_i][kc_m].index,
										 (kc_size_t)kc_a_hashtable_t->hashtable[kc_i][kc_m].ibound * sizeof(YYSTYPE),
										 kc_a_hashtable_t->bucket_alloc_private_data);
						kc_a_hashtable_t->hashtable[kc_i][kc_m].index = 0;
						kc_a_hashtable_t->hashtable[kc_i][kc_m].ibound = 0;
						kc_a_hashtable_t->hashtable[kc_i][kc_m].nr = 0;
			}	}	}
		} else {
			/* should be a better error message */
			/*SUPPRESS 622*/
			assert(kc_zero_constant); 
		}
	} else { /* zero & free the buckets */
		if (kc_a_hashtable_t->free_buckets) {
			(*kc_a_hashtable_t->free_buckets)(kc_a_hashtable_t->bucket_alloc_private_data);
		} else if (kc_a_hashtable_t->free_bucket) {
			for (kc_i=0; kc_i < kc_a_hashtable_t->size; kc_i++) {
				for (kc_m=0; kc_m < (int)kc_last_storage_mode; kc_m++) {
					/* we do something if index !=0, it is not suficient to
					 * look only at the nr field, because the nr field might be
					 * reset in a previous reuse operation.
					 * we could as well look for an non-null ibound field.
					 */
					if (kc_a_hashtable_t->hashtable[kc_i][kc_m].index) {
						kc_ht_free_single_elements(kc_a_hashtable_t, kc_i, kc_m);
						KC_BZERO((kc_voidptr_t)kc_a_hashtable_t->hashtable[kc_i][kc_m].index,
							  (kc_size_t)kc_a_hashtable_t->hashtable[kc_i][kc_m].ibound * sizeof(YYSTYPE));
						(*kc_a_hashtable_t->free_bucket)((kc_voidptr_t)kc_a_hashtable_t->hashtable[kc_i][kc_m].index,
										 (kc_size_t)kc_a_hashtable_t->hashtable[kc_i][kc_m].ibound * sizeof(YYSTYPE),
										 kc_a_hashtable_t->bucket_alloc_private_data);
			}	}	}
		} else {
			/* should be a better error message */
			/*SUPPRESS 622*/
			assert(kc_zero_constant); 
		}
	}
}

static void kc_ht_do_clear
#ifdef KC_USE_PROTOTYPES
(kc_hashtable_t kc_a_hashtable_t, boolean kc_reuse, boolean kc_reinit)
#else
(kc_a_hashtable_t, kc_reuse, kc_reinit) kc_hashtable_t kc_a_hashtable_t; boolean kc_reuse; boolean kc_reinit;
#endif
{
	if (kc_a_hashtable_t->free_all_elements) {
		kc_ht_do_clear_all_elements(kc_a_hashtable_t, kc_reuse, kc_reinit);
	} else {
		kc_ht_do_clear_no_all_elements(kc_a_hashtable_t, kc_reuse, kc_reinit);
	}
}

void kc_ht_clear
#ifdef KC_USE_PROTOTYPES
(kc_hashtable_t kc_a_hashtable_t)
#else
(kc_a_hashtable_t) kc_hashtable_t kc_a_hashtable_t;
#endif
{
	kc_ht_do_clear(kc_a_hashtable_t, False, True );
	if (kc_a_hashtable_t->kc_to_be_freed) {
		kc_a_hashtable_t->static_malloc_private_data = (kc_voidptr_t)(*kc_a_hashtable_t->malloc_initialise)();
	} /* else: it is a statically allocated hashtable with a statically allocated
	   * static_malloc_private_data that will not be freed either... we have to
	   * trust that our free_all_elements routine (called via kc_ht_do_clear)
	   * prepares the static_malloc_private_data for reuse
	   */
	kc_a_hashtable_t->malloc_private_data = kc_a_hashtable_t->static_malloc_private_data;
	kc_a_hashtable_t->dynamic_malloc_private_data = 0;
	kc_a_hashtable_t->dec_dynamic_malloc_private_data = 0;
	kc_a_hashtable_t->mode = kc_ht_store_static;
	kc_a_hashtable_t->bucket_alloc_private_data = (kc_a_hashtable_t->bucket_alloc_initialise)
						      ? (kc_voidptr_t)(*kc_a_hashtable_t->bucket_alloc_initialise)()
						      : 0;
}

void kc_ht_reuse
#ifdef KC_USE_PROTOTYPES
(kc_hashtable_t kc_a_hashtable_t)
#else
(kc_a_hashtable_t) kc_hashtable_t kc_a_hashtable_t;
#endif
{
	kc_ht_do_clear(kc_a_hashtable_t, True, True );
	if (kc_a_hashtable_t->kc_to_be_freed) {
		kc_a_hashtable_t->static_malloc_private_data = (kc_voidptr_t)(*kc_a_hashtable_t->malloc_initialise)();
	} /* else: it is a statically allocated hashtable with a statically allocated
	   * static_malloc_private_data that will not be freed either... we have to
	   * trust that our free_all_elements routine (called via kc_ht_do_clear)
	   * prepares the static_malloc_private_data for reuse
	   */
	kc_a_hashtable_t->malloc_private_data = kc_a_hashtable_t->static_malloc_private_data;
	kc_a_hashtable_t->dynamic_malloc_private_data = 0;
	kc_a_hashtable_t->dec_dynamic_malloc_private_data = 0;
	kc_a_hashtable_t->mode = kc_ht_store_static;
	kc_a_hashtable_t->bucket_alloc_private_data = (kc_a_hashtable_t->bucket_alloc_initialise)
						      ? (kc_voidptr_t)(*kc_a_hashtable_t->bucket_alloc_initialise)()
						      : 0;
}

void kc_ht_delete
#ifdef KC_USE_PROTOTYPES
(kc_hashtable_t kc_a_hashtable_t)
#else
(kc_a_hashtable_t) kc_hashtable_t kc_a_hashtable_t;
#endif
{
	kc_ht_do_clear(kc_a_hashtable_t, False, False);
	if (kc_a_hashtable_t->kc_to_be_freed) {
		kc_a_hashtable_t->next->prev = kc_a_hashtable_t->prev;
		kc_a_hashtable_t->prev->next = kc_a_hashtable_t->next;
		if (kc_all_hashtables == kc_a_hashtable_t) {
			kc_all_hashtables = kc_a_hashtable_t->next;
		}
		KC_BZERO((kc_voidptr_t)kc_a_hashtable_t->hashtable,
			 (kc_size_t)sizeof(struct kc_tag_kc_hashtableentry_t) * kc_a_hashtable_t->size);
		FREE((kc_voidptr_t)kc_a_hashtable_t->hashtable);
		KC_BZERO((kc_voidptr_t)kc_a_hashtable_t, sizeof(struct kc_tag_kc_hashtable_struct_t));
		FREE((kc_voidptr_t)kc_a_hashtable_t);
}	}


/* atoms creation */
#ifdef KC_STDC
#  define kc_mylower(c) (isupper(c) ? tolower(c) : c)
#else
#  define kc_mylower(c) ((isascii(c) && isupper(c)) ? tolower(c) : c)
#endif
/* should be static, maybe? */
int kc_ci_strcmp
#ifdef KC_USE_PROTOTYPES
(char *kc_s1, char *kc_s2)
#else
(kc_s1, kc_s2) char *kc_s1, *kc_s2;
#endif
{	int tmp;
	while ((*kc_s1 != '\\0') && (*kc_s2 != '\\0')) {
		if ( (tmp = kc_mylower(*kc_s1) - kc_mylower(*kc_s2)) != 0 ) return tmp;
		kc_s1++;
		kc_s2++;
	}
	return( (*kc_s1 != '\\0') - (*kc_s2 != '\\0') );
}

static unsigned kc_casestrhash
#ifdef KC_USE_PROTOTYPES
(char *kc_s)
#else
(kc_s) char *kc_s;
#endif
{	register unsigned kc_i = 0;
	register char *kc_sp;

	for (kc_sp = kc_s; *kc_sp != '\\0'; kc_sp++)
		kc_i = (unsigned)((kc_i * 75) + *kc_sp);
	return kc_i;
}

static unsigned kc_nocasestrhash
#ifdef KC_USE_PROTOTYPES
(char *kc_s)
#else
(kc_s) char *kc_s;
#endif
{	register unsigned kc_i = 0;
	register char *kc_sp;

	for (kc_sp = kc_s; *kc_sp != '\\0'; kc_sp++)
		kc_i = (unsigned)((kc_i * 75) + kc_mylower(*kc_sp));
	return kc_i;
}

#undef kc_mylower

"
	d:view_gen_initializephyla_c

"casestring mkcasestring
#ifdef KC_USE_PROTOTYPES
(char *kc_s)
#else
(kc_s) char *kc_s;
#endif
{	register casestring kc_x;
	int kc_i;
	register kc_hashtableentry_t* kc_hte;
	unsigned kc_hashval = (unsigned)0;
	YYSTYPE *kc_ptr, *kc_beyond;
	kc_hashtable_t kc_a_ht = kc_hashtables[(int)uniq];

	KC_COLLECT_STATS0(KC_CREATE_STATS(sel__Str));
	OPERATORHASH((unsigned) sel__Str);
	CASESTRHASH(kc_s);
	kc_hashval = kc_hashval%kc_a_ht->size;
	for (kc_i=0; kc_i < (int)kc_last_storage_mode; kc_i++) {
		kc_hte = &(kc_a_ht->hashtable[kc_hashval][kc_i]);
		if (kc_hte->nr != 0) {
			kc_beyond = &kc_hte->index[kc_hte->nr];
			for (kc_ptr = &kc_hte->index[0]; kc_ptr < kc_beyond; kc_ptr++){
				kc_x= kc_ptr->yt_casestring;
				if ((kc_x->prod_sel == sel__Str) && (strcmp(kc_x->name, kc_s) == 0))
					return(kc_x);
	}	}	}
	KC_COLLECT_STATS0(KC_EXISTINGNOTFOUND_STATS(sel__Str));
	kc_hte = &(kc_a_ht->hashtable[kc_hashval][(int)kc_a_ht->mode]);
	if (kc_hte->nr >= kc_hte->ibound) kc_growindex(kc_hte, kc_a_ht);
	kc_x = (casestring)(*kc_a_ht->malloc)((kc_size_t)sizeof(struct kc_tag_casestring), kc_a_ht->malloc_private_data);
	kc_x->name = (char*)(*kc_a_ht->malloc)((kc_size_t)(strlen(kc_s))+1, kc_a_ht->malloc_private_data);
	kc_x->prod_sel = sel__Str;
	(void)strcpy(kc_x->name, kc_s);
	kc_hte->index[kc_hte->nr++].yt_casestring = kc_x;
	KC_COLLECT_STATS0(kc_casestring_strlen += strlen(kc_s)+1;);
	return kc_x;
}

nocasestring mknocasestring
#ifdef KC_USE_PROTOTYPES
(char *kc_s)
#else
(kc_s) char *kc_s;
#endif
{	register nocasestring kc_x;
	int kc_i;
	register kc_hashtableentry_t* kc_hte;
	unsigned kc_hashval = (unsigned)0;
	YYSTYPE *kc_ptr, *kc_beyond;
	kc_hashtable_t kc_a_ht = kc_hashtables[(int)uniq];

	KC_COLLECT_STATS0(KC_CREATE_STATS(sel_NoCaseStr));
	OPERATORHASH((unsigned) sel_NoCaseStr);
	NOCASESTRHASH(kc_s);
	kc_hashval = kc_hashval%kc_a_ht->size;
	for (kc_i=0; kc_i < (int)kc_last_storage_mode; kc_i++) {
		kc_hte = &(kc_a_ht->hashtable[kc_hashval][kc_i]);
		if (kc_hte->nr != 0) {
			kc_beyond = &kc_hte->index[kc_hte->nr];
			for (kc_ptr = &kc_hte->index[0]; kc_ptr < kc_beyond; kc_ptr++){
				kc_x= kc_ptr->yt_nocasestring;
				if ((kc_x->prod_sel == sel_NoCaseStr) && (kc_ci_strcmp(kc_x->name, kc_s) == 0))
					return(kc_x);
	}	}	}
	KC_COLLECT_STATS0(KC_EXISTINGNOTFOUND_STATS(sel_NoCaseStr));
	kc_hte = &(kc_a_ht->hashtable[kc_hashval][(int)kc_a_ht->mode]);
	if (kc_hte->nr >= kc_hte->ibound) kc_growindex(kc_hte, kc_a_ht);
	kc_x = (nocasestring)(*kc_a_ht->malloc)((kc_size_t)sizeof(struct kc_tag_nocasestring), kc_a_ht->malloc_private_data);
	kc_x->name = (char*)(*kc_a_ht->malloc)((kc_size_t)(strlen(kc_s))+1, kc_a_ht->malloc_private_data);
	kc_x->prod_sel = sel_NoCaseStr;
	(void)strcpy(kc_x->name, kc_s);
	kc_hte->index[kc_hte->nr++].yt_nocasestring = kc_x;
	KC_COLLECT_STATS0(kc_nocasestring_strlen += strlen(kc_s)+1;);
	return kc_x;
}

kc_hashnode_t kc_mksharinghashnode
#ifdef KC_USE_PROTOTYPES
(YYSTYPE kc_s, kc_hashtable_t kc_a_ht, kc_enum_phyla kc_phylum)
#else
(kc_s, kc_a_ht, kc_phylum) YYSTYPE kc_s; kc_hashtable_t kc_a_ht; kc_enum_phyla kc_phylum;
#endif
{
	register kc_hashnode_t kc_x;
	int kc_i;
	register kc_hashtableentry_t* kc_hte;
	unsigned kc_hashval = (unsigned)0;
	YYSTYPE *kc_ptr, *kc_beyond;

	switch(kc_phylum) {
	case (int)kc_phylum_int: INTHASH(kc_s.yt_int); break;
	case (int)kc_phylum_float: FLOATHASH(kc_s.yt_float); break;
	default: HASH(kc_s.yt_voidptr); break;
	}
	kc_hashval = kc_hashval%kc_a_ht->size;
	for (kc_i=0; kc_i < (int)kc_last_storage_mode; kc_i++) {
		kc_hte = &(kc_a_ht->hashtable[kc_hashval][kc_i]);
		if (kc_hte->nr != 0) {
			kc_beyond = &kc_hte->index[kc_hte->nr];
			for (kc_ptr = &kc_hte->index[0]; kc_ptr < kc_beyond; kc_ptr++){
				kc_x= kc_ptr->yt_kc_hashnode_t;
				if ((kc_x->prod_sel == (kc_enum_operators)0) &&
				    (((kc_phylum == kc_phylum_int) &&
				      (kc_x->ptr.yt_int == kc_s.yt_int)) ||
				     ((kc_phylum == kc_phylum_float) &&
				      (kc_x->ptr.yt_float == kc_s.yt_float)) ||
				     (kc_x->ptr.yt_voidptr == kc_s.yt_voidptr)))
					return(kc_x);
	}	}	}
	kc_hte = &(kc_a_ht->hashtable[kc_hashval][(int)kc_a_ht->mode]);
	if (kc_hte->nr >= kc_hte->ibound) kc_growindex(kc_hte, kc_a_ht);
	kc_x = (kc_hashnode_t)(*kc_a_ht->malloc)((kc_size_t)sizeof(struct kc_tag_kc_hashnode_t), kc_a_ht->malloc_private_data);
	kc_x->ptr = kc_s;
	kc_x->number = -1; /* IMPORTANT: some code depends on this -1 */
	kc_x->created = False;
	kc_x->prod_sel = (kc_enum_operators)0;
	kc_hte->index[kc_hte->nr++].yt_kc_hashnode_t = kc_x;
	return kc_x;
}
/*ARGSUSED*/
kc_hashnode_t kc_mknonsharinghashnode
#ifdef KC_USE_PROTOTYPES
(YYSTYPE kc_s, kc_hashtable_t kc_a_ht, kc_enum_phyla kc_phylum)
#else
(kc_s, kc_a_ht, kc_phylum) YYSTYPE kc_s; kc_hashtable_t kc_a_ht; kc_enum_phyla kc_phylum;
#endif
{	static struct kc_tag_kc_hashnode_t kc_x_struct;
	kc_x_struct.number = -1; /* IMPORTANT: some code depends on this -1 */
	kc_x_struct.created = False;
	return &kc_x_struct;
}

kc_dotedgenode_t kc_mkdotedgenode
#ifdef KC_USE_PROTOTYPES
(kc_hashtable_t kc_a_ht, YYSTYPE kc_s_from, kc_enum_phyla kc_phy_from, YYSTYPE kc_s_to, kc_enum_phyla kc_phy_to, int kc_son_nr)
#else
(kc_a_ht, kc_s_from, kc_phy_from, kc_s_to, kc_phy_to, kc_son_nr) kc_hashtable_t kc_a_ht; YYSTYPE kc_s_from; kc_enum_phyla kc_phy_from; YYSTYPE kc_s_to; kc_enum_phyla kc_phy_to; int kc_son_nr;
#endif
{
	register kc_dotedgenode_t kc_x;
	int kc_i;
	register kc_hashtableentry_t* kc_hte;
	unsigned kc_hashval = (unsigned)0;
	YYSTYPE *kc_ptr, *kc_beyond;

	OPERATORHASH((unsigned) kc_phy_from);
	switch(kc_phy_from) {
	case (int)kc_phylum_int: INTHASH(kc_s_from.yt_int); break;
	case (int)kc_phylum_float: FLOATHASH(kc_s_from.yt_float); break;
	default: HASH(kc_s_from.yt_voidptr); break;
	}
	OPERATORHASH((unsigned) kc_phy_to);
	switch(kc_phy_to) {
	case (int)kc_phylum_int: INTHASH(kc_s_to.yt_int); break;
	case (int)kc_phylum_float: FLOATHASH(kc_s_to.yt_float); break;
	default: HASH(kc_s_to.yt_voidptr); break;
	}
	INTHASH(kc_son_nr);
	kc_hashval = kc_hashval%kc_a_ht->size;
	for (kc_i=0; kc_i < (int)kc_last_storage_mode; kc_i++) {
		kc_hte = &(kc_a_ht->hashtable[kc_hashval][kc_i]);
		if (kc_hte->nr != 0) {
			kc_beyond = &kc_hte->index[kc_hte->nr];
			for (kc_ptr = &kc_hte->index[0]; kc_ptr < kc_beyond; kc_ptr++){
				kc_x= kc_ptr->yt_kc_dotedgenode_t;
				if ((kc_x->prod_sel == (kc_enum_operators)0) &&
				    (kc_x->phy_from == kc_phy_from) &&
				    (kc_x->phy_to == kc_phy_to) &&
				    (kc_x->son_nr == kc_son_nr) &&
				    (((kc_phy_from == kc_phylum_int) &&
				      (kc_x->ptr_from.yt_int == kc_s_from.yt_int)) ||
				     ((kc_phy_from == kc_phylum_float) &&
				      (kc_x->ptr_from.yt_float == kc_s_from.yt_float)) ||
				     (kc_x->ptr_from.yt_voidptr == kc_s_from.yt_voidptr)) &&
				    (((kc_phy_to == kc_phylum_int) &&
				      (kc_x->ptr_to.yt_int == kc_s_to.yt_int)) ||
				     ((kc_phy_to == kc_phylum_float) &&
				      (kc_x->ptr_to.yt_float == kc_s_to.yt_float)) ||
				     (kc_x->ptr_to.yt_voidptr == kc_s_to.yt_voidptr)) )
					return(kc_x);
	}	}	}
	kc_hte = &(kc_a_ht->hashtable[kc_hashval][(int)kc_a_ht->mode]);
	if (kc_hte->nr >= kc_hte->ibound) kc_growindex(kc_hte, kc_a_ht);
	kc_x = (kc_dotedgenode_t)(*kc_a_ht->malloc)((kc_size_t)sizeof(struct kc_tag_kc_dotedgenode_t), kc_a_ht->malloc_private_data);
	kc_x->ptr_to = kc_s_to;
	kc_x->ptr_from = kc_s_from;
	kc_x->phy_from = kc_phy_from;
	kc_x->phy_to = kc_phy_to;
	kc_x->son_nr = kc_son_nr;
	kc_x->label = 0;
	kc_x->lsize = 0;
	kc_x->next = 0;
	kc_x->prod_sel = (kc_enum_operators)0;
	kc_hte->index[kc_hte->nr++].yt_kc_dotedgenode_t = kc_x;
	return kc_x;
}

"

	d
					];
Nilstorageclasses()			-> [view_gen_operatordefs_c: {/*EMPTY*/} ];
Consstorageclasses( sc, Nilstorageclasses())	-> [view_gen_operatordefs_c: "\"" sc "\"" ];
Consstorageclasses( sc, r_sc)		-> [view_gen_operatordefs_c:
	r_sc ", \"" sc "\""
					];
Nilstorageclasses()			-> [view_gen_operatordefs_c_0: {/*EMPTY*/} ];
Consstorageclasses( sc, r_sc)		-> [view_gen_operatordefs_c_0:
	r_sc
"static kc_hashtableentry_t kc_mainhasharray_" sc "[LARGEPRIME+1][(int)kc_last_storage_mode]; /* +1 because LARGEPRIME can be 0 */
"
					];
Consstorageclasses( sc = Id( Str( "kc_not_uniq")), r_sc),
Consstorageclasses( sc = Id( Str( "kc_uniq_nullary_operator")), r_sc)
					-> [view_gen_operatordefs_c_0:
	r_sc
"static kc_hashtableentry_t kc_mainhasharray_" sc "[1][(int)kc_last_storage_mode];
"
					];
Nilstorageclasses()			-> [view_gen_operatordefs_c_1: {/*EMPTY*/} ];
Consstorageclasses( *, Nilstorageclasses())	-> [view_gen_operatordefs_c_1:
	"True"
					];
Consstorageclasses( *, r_sc)		-> [view_gen_operatordefs_c_1:
	r_sc
	", True"
					];
Nilstorageclasses()			-> [view_gen_operatordefs_c_2: {/*EMPTY*/} ];
Consstorageclasses( sc, r_sc)		-> [view_gen_operatordefs_c_2:
	r_sc 
"static kc_memory_info_t kc_memory_info_" sc " = { 0, 0, 0, &kc_mainmemory_freelist, 0, KC_MEMORY_BLOCKSIZE };
"
					];
Nilstorageclasses()			-> [view_gen_operatordefs_c_2a: {/*EMPTY*/} ];
Consstorageclasses( sc, Nilstorageclasses())	-> [view_gen_operatordefs_c_2a:
	"&kc_memory_info_" sc
					];
Consstorageclasses( sc, r_sc)		-> [view_gen_operatordefs_c_2a:
	r_sc
	", &kc_memory_info_" sc
					];
Nilstorageclasses()			-> [view_gen_operatordefs_c_3: {/*EMPTY*/} ];
Consstorageclasses( *, Nilstorageclasses())	-> [view_gen_operatordefs_c_3:
	$0:view_gen_operatordefs_c_3a
					];
Consstorageclasses( *, r_sc)		-> [view_gen_operatordefs_c_3:
	r_sc ", "
	$0:view_gen_operatordefs_c_3a
					];
Consstorageclasses( sc, *)		-> [view_gen_operatordefs_c_3a:
"&kc_static_hashtables[(int)" sc "]"
					];
Nilstorageclasses()			-> [view_gen_operatordefs_c_4: {/*EMPTY*/} ];
Consstorageclasses( *, *)		-> [view_gen_operatordefs_c_4:
{ gl_nr_of_hashtables = length_storageclasses( Thestorageclasses );
  gl_hashtablenr_next = 1; gl_hashtablenr_prev = gl_nr_of_hashtables - 1; }
	$0:view_gen_operatordefs_c_4z
					];
Nilstorageclasses()			-> [view_gen_operatordefs_c_4z: {/*EMPTY*/} ];
Consstorageclasses( *, Nilstorageclasses())	-> [view_gen_operatordefs_c_4z:
	$0:view_gen_operatordefs_c_4a
					];
Consstorageclasses( *, r_sc)		-> [view_gen_operatordefs_c_4z:
	r_sc ",
"
	$0:view_gen_operatordefs_c_4a
					];
Consstorageclasses( sc = Id( Str( "kc_not_uniq")), *),
Consstorageclasses( sc = Id( Str( "kc_uniq_nullary_operator")), *)
					-> [view_gen_operatordefs_c_4a:
"{ kc_mainhasharray_" sc ",
 0 /*size*/,
 0 /*kc_to_be_freed*/,
 &kc_static_hashtables[" (int)gl_hashtablenr_next "],
 &kc_static_hashtables[" (int)gl_hashtablenr_prev "],
 /* node allocation*/
 (kc_voidptr_t(*)())UNIQMALLOCINIT,
 UNIQMALLOC2,
 0 /*UNIQFREEELEMENT*/,
 UNIQFREEALL,
 INUNIQBLOCK,
 (kc_voidptr_t)&kc_memory_info_" sc " /*malloc_private_data*/,
 (kc_voidptr_t)&kc_memory_info_" sc " /*static_malloc_private_data*/,
 0 /*dynamic_malloc_private_data*/,
 0 /*dec_dynamic_malloc_private_data*/,
 kc_ht_store_static,
 UNIQMEMORYINFO,
 /* bucket allocation */
 BUCKETALLOCINIT,
 BUCKETCALLOC,
 BUCKETREALLOC,
 0 /*bucket_alloc_private_data*/,
 BUCKETFREE,
 BUCKETSFREE,
 BUCKETINC,
 BUCKETMEMORYINFO
 }"
{ gl_hashtablenr_next = (gl_hashtablenr_next + 1) % gl_nr_of_hashtables;
  gl_hashtablenr_prev = (gl_hashtablenr_prev + 1) % gl_nr_of_hashtables; }
					];
Consstorageclasses( sc, *)		-> [view_gen_operatordefs_c_4a:
"{ kc_mainhasharray_" sc ",
 LARGEPRIME /*size*/,
 0 /*kc_to_be_freed*/,
 &kc_static_hashtables[" (int)gl_hashtablenr_next "],
 &kc_static_hashtables[" (int)gl_hashtablenr_prev "],
 /* node allocation*/
 (kc_voidptr_t(*)())UNIQMALLOCINIT,
 UNIQMALLOC2,
 0 /*UNIQFREEELEMENT*/,
 UNIQFREEALL,
 INUNIQBLOCK,
 (kc_voidptr_t)&kc_memory_info_" sc ",
 (kc_voidptr_t)&kc_memory_info_" sc ",
 0 /*dynamic_malloc_private_data*/,
 0 /*dec_dynamic_malloc_private_data*/,
 kc_ht_store_static,
 UNIQMEMORYINFO,
 /* bucket allocation */
 BUCKETALLOCINIT,
 BUCKETCALLOC,
 BUCKETREALLOC,
 0 /*bucket_alloc_private_data*/,
 BUCKETFREE,
 BUCKETSFREE,
 BUCKETINC,
 BUCKETMEMORYINFO
 }"
{ gl_hashtablenr_next = (gl_hashtablenr_next + 1) % gl_nr_of_hashtables;
  gl_hashtablenr_prev = (gl_hashtablenr_prev + 1) % gl_nr_of_hashtables; }
					];
Consphylumdeclarations( pd, rpds )	-> [view_gen_initializephyla_c: rpds pd ];
Nilphylumdeclarations()			-> [view_gen_initializephyla_c: {/*EMPTY*/} ];
PhylumDeclaration( *, *, Emptyproductionblock(), * )
					-> [view_gen_initializephyla_c: {/*EMPTY*/} ];
PhylumDeclaration( id, *, ListAlternatives( *, * ), cco ),
PhylumDeclaration( id, *, NonlistAlternatives( * ), cco )
					-> [view_gen_initializephyla_c:
{ if (f_something_to_initialize( cco )) } ${
"static " id " kc_initialize_" id "
#ifdef KC_USE_PROTOTYPES
(" id " kc_x)
#else
(kc_x) " id " kc_x;
#endif
{
"
	cco
(charptr)g_emptystring:view_printer_outputfileline
"	return kc_x;
}

"
$}
					];
PhylumDeclaration( *, *, PredefinedAlternatives( * ), * )
					-> [view_gen_initializephyla_c: {/*EMPTY*/} ];
CcodeOption( attr,  init )		-> [view_gen_initializephyla_c:
	attr
	init
					];
Consattributes( Attribute( *, aid, Yesattribute_initialisation( cexpr )), ra)
					-> [view_gen_initializephyla_c:
{     ID selvar; }
ra
{     selvar = Id(Str(mkcasestring("kc_x")));
      selvar->line = aid->line; /* give selvar the line/file info of attribute name */
      selvar->file = aid->file;
      /*cf_pushselvar( selvar );*/
      cf_pushdollarvar( selvar );
      cf_pushdollarvarext( f_emptyId() );
      cf_pushoperator( f_emptyId() );
}
"#line " aid->line " \"" aid->file:view_filename "\"
	kc_x->" aid " = " cexpr ";
"
{     /*cf_popselvar();*/
      cf_popdollarvar();
      cf_popdollarvarext();
      cf_popoperator();
}
					];
Consattributes( Attribute( *, *, Noattribute_initialisation()), ra )
					-> [view_gen_initializephyla_c: ra ];
Nilattributes()				-> [view_gen_initializephyla_c: {/*EMPTY*/} ];

ConsCtexts( ct, cts )			-> [view_gen_initializephyla_c:
{     ID selvar; }
	cts 
{     selvar = Id(Str(mkcasestring("kc_x")));
      selvar->line = ct->line; /* give selvar the line/file info of the ctext */
      selvar->file = ct->file;
      /*cf_pushselvar( selvar );*/
      cf_pushdollarvar( selvar );
      cf_pushdollarvarext( f_emptyId() );
      cf_pushoperator( f_emptyId() );
}
"#line " ct->line " \"" ct->file:view_filename "\"
"
	ct
(charptr)g_emptystring:view_printer_outputfileline
{     /*cf_popselvar();*/
      cf_popdollarvar();
      cf_popdollarvarext();
      cf_popoperator();
}
					];
ConsCexpression( ce, ces )		-> [view_gen_initializephyla_c: ces ce ];
NilCexpression()			-> [view_gen_initializephyla_c: {/*EMPTY*/} ];
CExpressionPart( cs )			-> [view_gen_initializephyla_c: cs ];
UnpDollarvarTerm( i ),
UnpDollarvarAttr( i, * ),
CTextDollarVar( i ),
CExpressionDollarvar( i )		-> [view_gen_initializephyla_c:
{   ID oid = f_emptyId(), dollarvar = cf_topdollarvar(), dollarvarext = cf_topdollarvarext();
    argument arg;
    boolean nulvar = True;
    with( i ) {
	Int( ii ): {
	    if (ii != 0) {
		nulvar = False;
		oid = cf_topoperator();
		arg = f_argumentofoperator( oid, i );
}   }   }   }
/* below we use the fact that the dollar var is only allowed if there is
 * only ONE dollar. And we know that in that case it will have number one...
 * so we DEPEND on that...
 */
{ if (nulvar) } ${
(ID)dollarvar (ID)dollarvarext
$} { else } ${
(ID)dollarvar (ID)dollarvarext "->u." (ID)oid "." (argument)arg
{         free_argument( arg, False/* TOBECHECKED*/ );  }
$}
					];
Argument( id, i )			-> [ /*allow all views here */:
	id "_" i
					];
CExpressionNl( i )			-> [view_gen_initializephyla_c:
{ char *nl_string = f_mknls( i ); }
	(charptr)nl_string
					 ];
CExpressionDQ( cedq )			-> [view_gen_initializephyla_c:
"\"" cedq "\""
					 ];
CExpressionSQ( cesq )			-> [view_gen_initializephyla_c:
"'" cesq "'"
					 ];
CExpressionPack( cexpr )		-> [view_gen_initializephyla_c:
"(" cexpr ")"
					 ];
CExpressionArray( cexpr )		-> [view_gen_initializephyla_c:
"[" cexpr "]"
					 ];

NilCtexts()				-> [view_gen_initializephyla_c: {/*EMPTY*/} ];
ConsCtext( cte, ct )			-> [view_gen_initializephyla_c:
{ gl_print_line_directive = False; }
	ct cte
					];
NilCtext()				-> [view_gen_initializephyla_c: {/*EMPTY*/} ];
CTextLine( cs )				-> [view_gen_initializephyla_c:
{ if (gl_print_line_directive) } ${
"#line " $0->line " \"" $0->file:view_filename "\"
"
  { gl_print_line_directive = False; }
$}
	cs
					];
CTextNl( i )				-> [view_gen_initializephyla_c:
{ char *nl_string; }
{ if (gl_print_line_directive) } ${
"#line " $0->line " \"" $0->file:view_filename "\"
"
  { gl_print_line_directive = False; }
  { nl_string = f_mknls( i - 1 ); }
$} { else } ${
  { nl_string = f_mknls( i ); }
$}
	(charptr)nl_string
					];
CTextCexpressionDQ( cedq )		-> [view_gen_initializephyla_c:
{ if (gl_print_line_directive) } ${
"#line " $0->line " \"" $0->file:view_filename "\"
"
  { gl_print_line_directive = False; }
$}
"\"" cedq "\""
					];
CTextCexpressionSQ( cesq )		-> [view_gen_initializephyla_c:
{ if (gl_print_line_directive) } ${
"#line " $0->line " \"" $0->file:view_filename "\"
"
  { gl_print_line_directive = False; }
$}
"'" cesq "'"
					];
CTextCbody( ct )			-> [view_gen_initializephyla_c:
{ if (gl_print_line_directive) } ${
"#line " $0->line " \"" $0->file:view_filename "\"
"
  { gl_print_line_directive = False; }
$}
"{"
	ct
"}"
{ if (gl_print_line_directive) } ${
"
"
$}
					];

CTextForeachexpression( *, idcexpr, *, ct, fa )
					-> [view_gen_initializephyla_c:
{
  ID selvar = f_mkselvar("kc_selvar_", g_ctext_level);
  selvar->line = $0->line; /* give selvar the line/file info of the ctext */
  selvar->file = $0->file;
  cf_pushselvar( selvar );
}
"{
"
idcexpr
idcexpr:view_gen_initializephyla_assert_c
(charptr)g_emptystring:view_printer_outputfileline
"while(
"
idcexpr:view_gen_initializephyla_whiletest_c
"	) {
"
idcexpr:view_gen_initializephyla_init_el_c
"{
#line " ct->line " \"" ct->file:view_filename "\"
"
ct
(charptr)g_emptystring:view_printer_outputfileline
"}
"
idcexpr:view_gen_initializephyla_update_loop_c
(charptr)g_emptystring:view_printer_outputfileline
"}
"
{ cf_popselvar();
  selvar = Id(Str(mkcasestring("kc_fe_selvar")));
  selvar->line = fa->line; /* give selvar the line/file info of the ctext */
  selvar->file = fa->file;
  cf_pushselvar( selvar );
}
fa
"}
"
{ cf_popselvar();
  gl_print_line_directive = True;
}
					];

NoForeachAfter()	-> [view_gen_initializephyla_c: {/*EMPTY*/} ];
ForeachAfter( *, *, *, ct )
					-> [view_gen_initializephyla_c:
"{
#line " ct->line " \"" ct->file:view_filename "\"
"
ct
(charptr)g_emptystring:view_printer_outputfileline
"}
"
					];


NilidCexpressions()	-> [view_gen_initializephyla_c
						view_gen_initializephyla_assert_c
						view_gen_initializephyla_whiletest_c
						view_gen_initializephyla_init_el_c
						view_gen_initializephyla_update_loop_c
						:
{	g_fe_selvar_nr = 0; }
					];
ConsidCexpressions( IdCexpression( tid, cexpr ), t )
					-> [view_gen_initializephyla_c:
	t
{	g_fe_selvar_nr++; }
{	if (cexpr->line) } ${
"#line " cexpr->line " \"" cexpr->file:view_filename "\"
"
	$}
	tid " kc_fe_selvar_" (int)g_fe_selvar_nr " = " cexpr ";
"
	
					];
ConsidCexpressions( IdCexpression( tid, cexpr ), t )
					-> [view_gen_initializephyla_assert_c:
	t
{	g_fe_selvar_nr++; }
{	if (cexpr->line) } ${
"#line " cexpr->line " \"" cexpr->file:view_filename "\"
"
	$}
"/*SUPPRESS 622*/
assert_" tid "(kc_fe_selvar_" (int)g_fe_selvar_nr ", \"foreach_list_expression\");
"
					];
ConsidCexpressions( IdCexpression( tid, cexpr ), t )
					-> [view_gen_initializephyla_whiletest_c:
	t
{	g_fe_selvar_nr++; }
"	&& kc_fe_selvar_" (int)g_fe_selvar_nr "->prod_sel == sel_Cons" tid "
"
	
					];
ConsidCexpressions( IdCexpression( tid, cexpr ), t = NilidCexpressions() )
					-> [view_gen_initializephyla_whiletest_c:
	t
{	g_fe_selvar_nr++; }
"	kc_fe_selvar_" (int)g_fe_selvar_nr "->prod_sel == sel_Cons" tid "
"
					];
ConsidCexpressions( ice = IdCexpression( tid, cexpr ), t )
					-> [view_gen_initializephyla_init_el_c:
{ ID element_type = f_listelementphylum( tid );
  ID selvar = cf_topselvar();
}
	t
{	g_fe_selvar_nr++; }
(ID)element_type " " (ID)selvar "_" (int)g_fe_selvar_nr " = kc_fe_selvar_" (int)g_fe_selvar_nr "->u.Cons" tid "." (ID)element_type "_1;
"
					];
ConsidCexpressions( IdCexpression( tid, cexpr ), t )
					-> [view_gen_initializephyla_update_loop_c:
	t
{	g_fe_selvar_nr++; }
"kc_fe_selvar_" (int)g_fe_selvar_nr " = kc_fe_selvar_" (int)g_fe_selvar_nr "->u.Cons" tid "." tid "_1;
#line " cexpr->line " \"" cexpr->file:view_filename "\"
/*SUPPRESS 622*/
assert_" tid "(kc_fe_selvar_" (int)g_fe_selvar_nr ", \"sublist_of_foreach_list_expression\");
"
					];

ctw = CTextWithexpression(                            wexpr,  wcs, in_foreach_context )
					-> [view_gen_initializephyla_c:
{ if (wcs->wcinfo) } ${
{ /* ID selvar_type = f_phylumofwithcasesinfo( wcs->wcinfo );*/
	ID selvar;
	int p;
	patternchain fe_pc = 0;
	withcasesinfo rewr_wcinfo = my_rewrite_withcasesinfo(wcs->wcinfo);
	with(in_foreach_context) {
		InForeachContext(mp): {
			selvar = cf_topselvar(); /* already pushed in Foreach context */
			cf_pushinforeachcontext(1);
			fe_pc = mp;
		}
		NotInForeachContext(): {
			selvar = f_mkselvar("kc_selvar_", g_ctext_level);
			selvar->line = ctw->line; /* give selvar the line/file info of the ctext */
			selvar->file = ctw->file;
			cf_pushselvar( selvar );
			cf_pushinforeachcontext(0);
		}
	}
}
"{
"
/***********
#line " $0->line " \"" $0->file:view_filename "\"
" (ID)selvar_type " " (ID)selvar " = " wexpr ";
************/
{	if (! cf_topinforeachcontext()) } ${
wexpr
	$}
wexpr:view_gen_initializephyla_assert_c
(charptr)g_emptystring:view_printer_outputfileline
{	if (! cf_topinforeachcontext()) {
			cf_pushdollarvar( selvar );
			cf_pushdollarvarext( Id(Str(mkcasestring("_1"))) );
	} else if ((p = pos_of_sole_dollar_or_pattern_in_patternchain(fe_pc)) >= 0) {
			cf_pushdollarvar( selvar );
			cf_pushdollarvarext( f_mkselvar("_", p) );
	}
}
(withcasesinfo)rewr_wcinfo:view_gen_withcases_and_default
{	if (! cf_topinforeachcontext()) {
			cf_popselvar();
			cf_popdollarvar();
			cf_popdollarvarext();
	} else if (p >= 0) {
			cf_popdollarvar();
			cf_popdollarvarext();
	}
  cf_popinforeachcontext();
}
"}
"
{ gl_print_line_directive = True; }
$} { else { v_report(NonFatal( FileLine( $0->file, $0->line ), Problem1S( "internal error: no info for withcases of CTextWithexpression" )));
 } }
					];
					
Nilwithexpressions()	-> [view_gen_initializephyla_c view_gen_initializephyla_assert_c:
{	g_withexpr_nr = 0; }
						];
Conswithexpressions( h, t )	-> [view_gen_initializephyla_c:
{	ID selvar = cf_topselvar(); }
	t
{	g_withexpr_nr++;
}
{	if (h->line) } ${
"#line " h->line " \"" h->file:view_filename "\"
"
	$}
{	assert( ! (eq_ID(h->type, f_emptyId())) ); }
	h->type " " (ID)selvar "_" (int)g_withexpr_nr " = " h ";
"
					];
Conswithexpressions( h, t )	-> [view_gen_initializephyla_assert_c:
{	ID selvar = cf_topselvar(); }
	t
{	g_withexpr_nr++;
}
{	if ($0->line) } ${
"#line " $0->line " \"" $0->file:view_filename "\"
"
	$}
{	assert( ! (eq_ID(h->type, f_emptyId())) ); }
"/*SUPPRESS 622*/
assert_" h->type "(" (ID)selvar "_" (int)g_withexpr_nr ", \"with_expression (" (int)g_withexpr_nr ")\");
"
					];
WEVariable( id )	-> [view_gen_initializephyla_c:	id ];
WECexpression( cexpr )	-> [view_gen_initializephyla_c:
"
" cexpr "
"
					];


ConsCexpressionDQ( cedqe, cedq )	-> [view_gen_initializephyla_c: cedq cedqe ];
NilCexpressionDQ()			-> [view_gen_initializephyla_c: {/*EMPTY*/} ];
CExpressionDQPart( cs )			-> [view_gen_initializephyla_c: cs ];
CExpressionDQNl( i )			-> [view_gen_initializephyla_c:
{ char *nl_string = f_mknls( i ); }
	(charptr)nl_string
					];
ConsCexpressionSQ( cesqe, cesq )	-> [view_gen_initializephyla_c: cesq cesqe ];
NilCexpressionSQ()			-> [view_gen_initializephyla_c: {/*EMPTY*/} ];
CExpressionSQPart( cs )			-> [view_gen_initializephyla_c: cs ];
CExpressionSQNl( i )			-> [view_gen_initializephyla_c:
{ char *nl_string = f_mknls( i ); }
	(charptr)nl_string
					];

Consphylumdeclarations( pd, rpds )	-> [view_gen_operatordefs_c: rpds pd ];
Nilphylumdeclarations()			-> [view_gen_operatordefs_c: {/*EMPTY*/} ];
PhylumDeclaration( *, *, Emptyproductionblock(), * )
					-> [view_gen_operatordefs_c: {/*EMPTY*/} ];
PhylumDeclaration( id, NoStorageOption(), ListAlternatives( alt, * ), cco ),
PhylumDeclaration( id, NegativeStorageOption( * ), ListAlternatives( alt, * ), cco ),
PhylumDeclaration( id, NoStorageOption(), NonlistAlternatives( alt ), cco ),
PhylumDeclaration( id, NegativeStorageOption( * ), NonlistAlternatives( alt ), cco )
					-> [view_gen_operatordefs_c:
{ gl_phylum = id; gl_cco = cco; }
	alt:view_gen_operatordefs_nonhash_c
{ gl_phylum = (ID) 0; gl_cco = (Ccode_option)0; }
					];
PhylumDeclaration( id, PositiveStorageOption( sto ), ListAlternatives( alt, * ), cco ),
PhylumDeclaration( id, PositiveStorageOption( sto ), NonlistAlternatives( alt ), cco )
					-> [view_gen_operatordefs_c:
{ gl_phylum = id; gl_cco = cco; gl_sto = sto; }
	alt:view_gen_operatordefs_hash_c
{ gl_phylum = (ID) 0; gl_cco = (Ccode_option)0; gl_sto = (ID)0; }
					];
PhylumDeclaration( *, *, PredefinedAlternatives( * ), * )
					-> [view_gen_operatordefs_c: {/*EMPTY*/} ];
Consalternatives( Alternative( oid, args ), ra )
					-> [view_gen_operatordefs_nonhash_c:
	ra
{ gl_operator = oid; }
(ID)gl_phylum " " oid "
#ifdef KC_USE_PROTOTYPES
(" args:view_gen_fnarg_and_decls ")
#else
(" args:view_gen_fnargs ")" args:view_gen_fnargdecls "
#endif
{"
{ if (f_Nilarguments( args ) && f_no_attrs_in_Ccode_option( gl_cco )) } ${
"	static " (ID)gl_phylum " kc_x = (" (ID)gl_phylum ")0;
	KC_COLLECT_STATS0(KC_CREATE_STATS(sel_" oid "));
	if (kc_x == (" (ID)gl_phylum ")0) {
		KC_COLLECT_STATS0(KC_EXISTINGNOTFOUND_STATS(sel_" oid " ));
		kc_x = (" (ID)gl_phylum ")(*kc_hashtables[(int)kc_uniq_nullary_operator]->malloc)((kc_size_t)sizeof(struct kc_tag_" (ID)gl_phylum "), kc_hashtables[(int)kc_uniq_nullary_operator]->malloc_private_data);
		kc_x->prod_sel = sel_" oid ";
	}
"
$} { else } ${
"	register " (ID)gl_phylum " kc_x = (" (ID)gl_phylum ") NONUNIQMALLOC((kc_size_t)sizeof(struct kc_tag_" (ID)gl_phylum "));
	KC_COLLECT_STATS0(KC_CREATE_STATS(sel_" oid "));
	KC_COLLECT_STATS0(KC_EXISTINGNOTFOUND_STATS(sel_"  oid "));
"
	args:view_gen_asserts
"	kc_x->prod_sel = sel_" oid ";
"
	args:view_gen_assignments
$}
{ if (f_something_to_initialize( gl_cco )) } ${
"	kc_x = kc_initialize_" (ID)gl_phylum "(kc_x);
"
$}
"	return kc_x;
"
"}

"
{ gl_operator = (ID)0; }
					];
Consalternatives( Alternative( oid, args ), ra )
					-> [view_gen_operatordefs_hash_c:
	ra
{ gl_operator = oid; }
{ if (f_Nilarguments( args )) } ${
(ID)gl_phylum " " oid "
#ifdef KC_USE_PROTOTYPES
(" args:view_gen_fnarg_and_decls ")
#else
(" args:view_gen_fnargs ")" args:view_gen_fnargdecls "
#endif
{"
"	static " (ID)gl_phylum " kc_x = (" (ID)gl_phylum ")0;
	KC_COLLECT_STATS0(KC_CREATE_STATS(sel_" oid "));
	if (kc_x == (" (ID)gl_phylum ")0) {
		KC_COLLECT_STATS0(KC_EXISTINGNOTFOUND_STATS(sel_" oid " ));
		kc_x = (" (ID)gl_phylum ")(*kc_hashtables[(int)kc_uniq_nullary_operator]->malloc)((kc_size_t)sizeof(struct kc_tag_" (ID)gl_phylum "), kc_hashtables[(int)kc_uniq_nullary_operator]->malloc_private_data);
		kc_x->prod_sel = sel_" oid ";
"
{     if (f_something_to_initialize( gl_cco )) } ${
"		kc_x = kc_initialize_" (ID)gl_phylum "(kc_x);
"
      $}

"	}
	return kc_x;
}

"
$} { else } ${
(ID)gl_phylum " " (ID)gl_operator "
#ifdef KC_USE_PROTOTYPES
(" args:view_gen_fnarg_and_decls ")
#else
(" args:view_gen_fnargs ")" args:view_gen_fnargdecls "
#endif
{	register " (ID)gl_phylum " kc_x;
	int kc_i;
	register kc_hashtableentry_t* kc_hte;
	unsigned kc_hashval = (unsigned)0;
	YYSTYPE *kc_ptr, *kc_beyond;
	kc_hashtable_t kc_a_ht = kc_hashtables[(int)" (ID)gl_sto "];

" 
	args:view_gen_asserts
"	KC_COLLECT_STATS0(KC_CREATE_STATS(sel_" (ID)gl_operator "));
	OPERATORHASH((unsigned) sel_" (ID)gl_operator ");
"
	args:view_gen_hash
"	kc_hashval = kc_hashval%kc_a_ht->size;
	for (kc_i=0; kc_i < (int)kc_last_storage_mode; kc_i++) {
		kc_hte = &(kc_a_ht->hashtable[kc_hashval][kc_i]);
		if (kc_hte->nr != 0) {
			kc_beyond = &kc_hte->index[kc_hte->nr];
			for (kc_ptr = &kc_hte->index[0]; kc_ptr < kc_beyond; kc_ptr++){
				kc_x= kc_ptr->yt_" (ID)gl_phylum ";
				if ((kc_x->prod_sel == sel_" (ID)gl_operator ") " args:view_gen_test " )
					return(kc_x);
	}	}	}
	KC_COLLECT_STATS0(KC_EXISTINGNOTFOUND_STATS(sel_" (ID)gl_operator "));
	kc_hte = &(kc_a_ht->hashtable[kc_hashval][(int)kc_a_ht->mode]);
	if (kc_hte->nr >= kc_hte->ibound) kc_growindex(kc_hte, kc_a_ht);
	kc_x = (" (ID)gl_phylum ")(*kc_a_ht->malloc)((kc_size_t)sizeof(struct kc_tag_" (ID)gl_phylum "), kc_a_ht->malloc_private_data);
	kc_x->prod_sel = sel_" (ID)gl_operator ";
"
	args:view_gen_assignments
"	kc_hte->index[kc_hte->nr++].yt_" (ID)gl_phylum " = kc_x;
"
{     if (f_something_to_initialize( gl_cco )) } ${
"	kc_x = kc_initialize_" (ID)gl_phylum "(kc_x);
"
      $}
"	return kc_x;
}

"
$}
{ gl_operator = (ID)0; }
					];
Consarguments( a, * )			-> [view_gen_argseqnr:
 a "_" $0->seqnr
					];

Nilarguments()				-> [view_gen_fnargs: {/*EMPTY*/} ];
Consarguments( *, Nilarguments() )	-> [view_gen_fnargs:
 $0:view_gen_argseqnr
					];
Consarguments( *, rargs )		-> [view_gen_fnargs:
	rargs ", " $0:view_gen_argseqnr
					];
Nilarguments()				-> [view_gen_fnargdecls: {/*EMPTY*/} ];
Consarguments( a, rargs )		-> [view_gen_fnargdecls:
	rargs " " a " " $0:view_gen_argseqnr "; "
					];
Nilarguments()				-> [view_gen_fnarg_and_decls: {/*EMPTY*/} ];
Consarguments( a, Nilarguments() )	-> [view_gen_fnarg_and_decls:
 a " " $0:view_gen_argseqnr
					];
Consarguments( a, rargs )		-> [view_gen_fnarg_and_decls:
	rargs ", " a " " $0:view_gen_argseqnr
					];

Nilarguments()				-> [view_gen_asserts: {/*EMPTY*/} ];
Consarguments( a, rargs )		-> [view_gen_asserts:
	rargs
"	/*SUPPRESS 622*/
	assert_" a "( " $0:view_gen_argseqnr ", \"" $0:view_gen_argseqnr  "\" );
"
					];
Nilarguments()				-> [view_gen_assignments: {/*EMPTY*/} ];
Consarguments( *, rargs )		-> [view_gen_assignments:
	rargs
"	kc_x->u." (ID)gl_operator "." $0:view_gen_argseqnr " = " $0:view_gen_argseqnr ";
"
					];
Nilarguments()				-> [view_gen_hash: {/*EMPTY*/} ];
Consarguments( a, rargs )		-> [view_gen_hash:
	rargs 
{ if (eq_ID( Id(Str(mkcasestring("int"))), a )) } ${
"	INTHASH(" $0:view_gen_argseqnr ");
"
$} { else if (eq_ID( Id(Str(mkcasestring("float"))), a )) } ${
"	FLOATHASH(" $0:view_gen_argseqnr ");
"
$} { else if (eq_ID( Id(Str(mkcasestring("voidptr"))), a )) } ${
"	VOIDPTRHASH(" $0:view_gen_argseqnr ");
"
$} { else } ${
"	HASH(" $0:view_gen_argseqnr ");
"
$}
					];
Nilarguments()				-> [view_gen_test: {/*EMPTY*/} ];
Consarguments( *, rargs )		-> [view_gen_test:
	rargs " && (kc_x->u." (ID)gl_operator "." $0:view_gen_argseqnr " == " $0:view_gen_argseqnr ")"
					];

/***************************************************************************/

PhylumDeclarations( * )			-> [view_gen_error_decls_h:
"char *kc_phylumname_or_error KC__P(( int ));
char *kc_operatorname_or_error KC__P(( int ));

"
					];
PhylumDeclarations( * )			-> [view_gen_error_defs_c:
{ char *strof_phylum_error="Internal Error: unknown phylum number: ";
  int strlen_strof_phylum_error = strlen(strof_phylum_error)+30;
  casestring cstrof_phylum_error = mkcasestring(strof_phylum_error);
  char *strof_operator_error="Internal Error: unknown operator number: ";
  int strlen_strof_operator_error = strlen(strof_operator_error)+30;
  casestring cstrof_operator_error = mkcasestring(strof_operator_error);
}
"char *kc_phylumname_or_error
#ifdef KC_USE_PROTOTYPES
(int kc_phylum)
#else
(kc_phylum) int kc_phylum;
#endif
{	if ((kc_phylum <= (int)kc_one_before_first_phylum) || (kc_phylum >= (int)kc_last_phylum)) {
		char *kc_strof_error;
		(void)sprintf((kc_strof_error=(char*)MALLOC(" (int)strlen_strof_phylum_error ")), \"" (casestring)cstrof_phylum_error "%d\", kc_phylum);
		return kc_strof_error;
	} else {
		return kc_PhylumInfo[kc_phylum].name;
}	}


char *kc_operatorname_or_error
#ifdef KC_USE_PROTOTYPES
(int kc_operator)
#else
(kc_operator) int kc_operator;
#endif
{	if ((kc_operator <= (int)kc_one_before_first_operator) || (kc_operator >= (int)kc_last_operator)) {
		char *kc_strof_error;
		(void)sprintf((kc_strof_error=(char*)MALLOC(" (int)strlen_strof_operator_error ")), \"" (casestring)cstrof_operator_error "%d\", kc_operator);
		return kc_strof_error;
	} else {
		return kc_OperatorInfo[kc_operator].name;
}	}

"
					];

/***************************************************************************/

PhylumDeclarations( pds )		-> [view_gen_freedecls_h:
	pds
					];
Consphylumdeclarations( pd, rpds )	-> [view_gen_freedecls_h: rpds pd ];
Nilphylumdeclarations()			-> [view_gen_freedecls_h: {/*EMPTY*/} ];
PhylumDeclaration( *, *, Emptyproductionblock(), * )
					-> [view_gen_freedecls_h: {/*EMPTY*/} ];
PhylumDeclaration( id, *, *, * )	-> [view_gen_freedecls_h:
"void free_" id " KC__P(( " id ", boolean ));
"
					];

/***************************************************************************/

PhylumDeclarations( pds )		-> [view_gen_freedefs_c:
"/*ARGSUSED*/ static void kc_do_free_phylum
#ifdef KC_USE_PROTOTYPES
(kc_voidptr_t kc_p, boolean kc_rec, kc_enum_phyla kc_phylum)
#else
(kc_p, kc_rec, kc_phylum) kc_voidptr_t kc_p; boolean kc_rec; kc_enum_phyla kc_phylum;
#endif
{	kc_enum_operators kc_prodsel;
	KC_OPERATOR_INFO *kc_op_info;
	/*SUPPRESS 622*/
	assertPhylum(((casestring)kc_p),\"kc_p\",kc_phylum);
	kc_prodsel = (kc_phylum == kc_phylum_int ? sel__Int :
                     (kc_phylum == kc_phylum_float ? sel__Real :
                     (kc_phylum == kc_phylum_voidptr ? sel__VoidPtr :
                     ((casestring)kc_p)->prod_sel)));
	kc_op_info = &kc_OperatorInfo[(int)kc_prodsel];
	KC_COLLECT_STATS0(KC_FREE_CALLED_STATS((int)kc_prodsel, kc_rec));
	if (! kc_op_info->uniq_stored) {
		if (kc_rec) {
			int kc_i;
			for (kc_i=0; kc_i < kc_op_info->no_sons; kc_i++) {
				kc_do_free_phylum( (kc_voidptr_t)KC_SUBPHYLUM(kc_p, kc_op_info->suboffset[kc_i]), kc_rec, kc_op_info->subphylum[kc_i] );
		}	}
		KC_COLLECT_STATS0(KC_FREED_STATS((int)kc_prodsel, kc_rec));
		KC_BZERO((kc_voidptr_t)kc_p, kc_PhylumInfo[(int)kc_phylum].size);
		NONUNIQFREE((kc_voidptr_t)kc_p);
}	}	
"
	pds
					];
Consphylumdeclarations( pd, rpds )	-> [view_gen_freedefs_c: 
	rpds
	pd
					   ];
Nilphylumdeclarations()			-> [view_gen_freedefs_c: {/*EMPTY*/} ];
PhylumDeclaration( *, *, Emptyproductionblock(), * )
					-> [view_gen_freedefs_c: {/*EMPTY*/} ];
PhylumDeclaration( id, *, PredefinedAlternatives(  Consalternatives( Alternative( oid, * ), Nilalternatives() )), * )
					-> [view_gen_freedefs_c:
"/*ARGSUSED*/ void free_" id "
#ifdef KC_USE_PROTOTYPES
(" id " kc_p, boolean kc_rec)
#else
(kc_p, kc_rec) " id " kc_p; boolean kc_rec;
#endif
{ KC_COLLECT_STATS0(KC_FREE_CALLED_STATS((int)sel_" oid ", kc_rec)); }
"
					];
PhylumDeclaration( id, *, ListAlternatives( *, * ), * ),
PhylumDeclaration( id, *, NonlistAlternatives( * ), * )
					-> [view_gen_freedefs_c:
"/*ARGSUSED*/ void free_" id "
#ifdef KC_USE_PROTOTYPES
(" id " kc_p, boolean kc_rec)
#else
(kc_p, kc_rec) " id " kc_p; boolean kc_rec;
#endif
{ kc_do_free_phylum( (kc_voidptr_t)kc_p, kc_rec, kc_phylum_" id ");  }
"
					];

/***************************************************************************/

PhylumDeclarations( pds )		-> [view_gen_eqdecls_h:
	pds
					];
Consphylumdeclarations( pd, rpds )	-> [view_gen_eqdecls_h: rpds pd ];
Nilphylumdeclarations()			-> [view_gen_eqdecls_h: {/*EMPTY*/} ];
PhylumDeclaration( *, *, Emptyproductionblock(), * )
					-> [view_gen_eqdecls_h: {/*EMPTY*/} ];
PhylumDeclaration( id, *, *, * )	-> [view_gen_eqdecls_h:
"boolean eq_" id " KC__P(( " id ", " id " ));
"
					];

/***************************************************************************/

PhylumDeclarations( pds )		-> [view_gen_eqdefs_c:
"/*ARGSUSED*/ static boolean kc_do_eq_phylum
#ifdef KC_USE_PROTOTYPES
(kc_voidptr_t kc_p1, kc_voidptr_t kc_p2, kc_enum_phyla kc_phylum)
#else
(kc_p1, kc_p2, kc_phylum) kc_voidptr_t kc_p1, kc_p2; kc_enum_phyla kc_phylum;
#endif
{	int kc_i;
	kc_enum_operators kc_prodsel;
	int kc_st;
	KC_OPERATOR_INFO *kc_op_info;
	kc_hashtable_t kc_a_ht;
"
(phyla)cg_bigatomphyla
"	if (kc_p1 == kc_p2) return True;
	if (kc_phylum == kc_phylum_voidptr) return False;
	/*SUPPRESS 622*/
	assertPhylum(((casestring)kc_p1),\"kc_p1\",kc_phylum);
	/*SUPPRESS 622*/
	assertPhylum(((casestring)kc_p2),\"kc_p2\",kc_phylum);
	if ((kc_prodsel = ((casestring)kc_p1)->prod_sel) != ((casestring)kc_p2)->prod_sel) return False;
	kc_op_info = &kc_OperatorInfo[(int)kc_prodsel];
	kc_st = (int)kc_op_info->uniq_stored;
	kc_a_ht = kc_hashtables[kc_st];
	if (kc_st
	   && (kc_storageclass_still_uniq[kc_st]
	       || ((kc_a_ht->in_block != 0)
		  && (*kc_a_ht->in_block)((kc_voidptr_t)kc_p1, kc_a_ht->malloc_private_data)
		  && (*kc_a_ht->in_block)((kc_voidptr_t)kc_p2, kc_a_ht->malloc_private_data)))) return False;
"
{ if (cg_bigatomoperators && length_operators(cg_bigatomoperators) > 0) } ${
"	switch(kc_prodsel) {
"
     (operators)cg_bigatomoperators
"	default:
"
  $}
"	for (kc_i=0; kc_i < kc_op_info->no_sons; kc_i++) {
		if (! kc_do_eq_phylum( (kc_voidptr_t)KC_SUBPHYLUM(kc_p1, kc_op_info->suboffset[kc_i]), (kc_voidptr_t)KC_SUBPHYLUM(kc_p2, kc_op_info->suboffset[kc_i]), kc_op_info->subphylum[kc_i] )) {
			return False;
	}	}
	return True;
"
{ if (cg_bigatomoperators && length_operators(cg_bigatomoperators) > 0) } ${
"	}
"
  $}
"}
"
	pds
					];
Consphylumdeclarations( pd, rpds )	-> [view_gen_eqdefs_c: 
	rpds
	pd
					   ];
Nilphylumdeclarations()			-> [view_gen_eqdefs_c: {/*EMPTY*/} ];
PhylumDeclaration( *, *, Emptyproductionblock(), * )
					-> [view_gen_eqdefs_c: {/*EMPTY*/} ];
PhylumDeclaration( id, *, PredefinedAlternatives( * ), * )
					-> [view_gen_eqdefs_c:
"/*ARGSUSED*/ boolean eq_" id "
#ifdef KC_USE_PROTOTYPES
(" id " kc_p1, " id " kc_p2)
#else
(kc_p1, kc_p2) " id " kc_p1, kc_p2;
#endif
{ return (boolean)(kc_p1 == kc_p2); }
"
					];
PhylumDeclaration( id, *, ListAlternatives( *, * ), * ),
PhylumDeclaration( id, *, NonlistAlternatives( * ), * )
					-> [view_gen_eqdefs_c:
"/*ARGSUSED*/ boolean eq_" id "
#ifdef KC_USE_PROTOTYPES
(" id " kc_p1, " id "  kc_p2)
#else
(kc_p1, kc_p2) " id " kc_p1, kc_p2;
#endif
{ return kc_do_eq_phylum( (kc_voidptr_t)kc_p1, (kc_voidptr_t)kc_p2, kc_phylum_" id ");  }
"
					];
Nilphyla()				-> [view_gen_eqdefs_c: {/*EMPTY*/} ];
Consphyla( a_phy, r_phy )		-> [view_gen_eqdefs_c:
 r_phy
"	/*SUPPRESS 622*/
	assertReason(kc_phylum != kc_phylum_" a_phy ", \"kc_do_eq_phylum called with kc_phylum_" a_phy " argument\");
"
					];
Niloperators()				-> [view_gen_eqdefs_c: {/*EMPTY*/} ];
Consoperators( a_op, r_op )		-> [view_gen_eqdefs_c:
{ arguments args; }
 r_op
{ args = f_argumentsofoperator( a_op );
  gl_operator = a_op;
  gl_phylum = f_phylumofoperator( a_op );
  if (length_arguments(args) > 0) } ${
"	case (int)sel_" (ID)a_op ":
		return (("
   (arguments)args:view_gen_eqdefs_bigatom_c
") ? True : False);
"
$}
{ gl_operator = 0;
  gl_phylum = 0;
}
					];
Nilarguments()				-> [view_gen_eqdefs_bigatom_c: {/*EMPTY*/} ];
Consarguments( *, r_args )		-> [view_gen_eqdefs_bigatom_c:
	r_args
	" &&
			"
	$0:view_gen_eqdefs_bigatom_do_c
					];
Consarguments( *, Nilarguments() )	-> [view_gen_eqdefs_bigatom_c:
	$0:view_gen_eqdefs_bigatom_do_c
					];
Consarguments( a_arg, * )	-> [view_gen_eqdefs_bigatom_do_c:
{ if (f_isbigatom( a_arg )) } ${
"eq_" a_arg "(((" (ID)gl_phylum ")kc_p1)->u." (ID)gl_operator "." a_arg "_" $0->seqnr ", ((" (ID)gl_phylum ")kc_p2)->u." (ID)gl_operator "." a_arg "_" $0->seqnr ")"
  $} { else } ${
"kc_do_eq_phylum((kc_voidptr_t)((" (ID)gl_phylum ")kc_p1)->u." (ID)gl_operator "." a_arg "_" $0->seqnr ", (kc_voidptr_t)((" (ID)gl_phylum ")kc_p2)->u." (ID)gl_operator "." a_arg "_" $0->seqnr ", kc_phylum_" a_arg ")"
  $}
					];

/***************************************************************************/

PhylumDeclarations( pds )		-> [view_gen_printdecls_h:
	pds
					];
Consphylumdeclarations( pd, rpds )	-> [view_gen_printdecls_h: rpds pd ];
Nilphylumdeclarations()			-> [view_gen_printdecls_h: {/*EMPTY*/} ];
PhylumDeclaration( *, *, Emptyproductionblock(), * )
					-> [view_gen_printdecls_h: {/*EMPTY*/} ];
PhylumDeclaration( id, *, *, * )	-> [view_gen_printdecls_h:
"void print_" id " KC__P(( " id " ));
void fprint_" id " KC__P(( FILE*, " id " ));
"
					];

/***************************************************************************/

PhylumDeclarations( pds )		-> [view_gen_printdefs_c:
"static int kc_indentation = 0;
static char *kc_printformat_not_nullair_open = \"%*s%s(\\n\";
static char *kc_printformat_not_nullair_close = \"%*s)\\n\";
static char *kc_printformat_nullair = \"%*s%s()\\n\";

static void kc_do_print_phylum
#ifdef KC_USE_PROTOTYPES
(FILE *kc_f, kc_voidptr_t kc_p, kc_enum_phyla kc_phylum)
#else
(kc_f, kc_p, kc_phylum) FILE *kc_f; kc_voidptr_t kc_p; kc_enum_phyla kc_phylum;
#endif
{	int kc_i;

"
(phyla)cg_bigatomphyla
"	/*SUPPRESS 622*/
	assertPhylum(((casestring)kc_p),\"kc_p\",kc_phylum);
	if (!kc_f) kc_f = stdout;
	if (kc_phylum == kc_phylum_voidptr) {
		(void)fprintf(kc_f, \"%*s%p\\n\", kc_indentation, \"\", kc_p);
	} else if ((kc_phylum == kc_phylum_casestring) || (kc_phylum == kc_phylum_nocasestring)) {
		(void)fprintf(kc_f, \"%*s%s\\n\", kc_indentation, \"\", ((casestring)kc_p)->name);
	} else {
		kc_enum_operators kc_prodsel = ((casestring)kc_p)->prod_sel;
		KC_OPERATOR_INFO *kc_op_info = &kc_OperatorInfo[(int)kc_prodsel];
		if (! kc_op_info->no_sons) {
			(void)fprintf(kc_f, kc_printformat_nullair, kc_indentation, \"\", kc_op_info->name);
		} else {
			(void)fprintf(kc_f, kc_printformat_not_nullair_open, kc_indentation, \"\", kc_op_info->name);
			kc_indentation++;
"
{ if (cg_bigatomoperators && length_operators(cg_bigatomoperators) > 0) } ${
"			switch(kc_prodsel) {
"
     (operators)cg_bigatomoperators
"			default:
"
  $}
"			for (kc_i=0; kc_i < kc_op_info->no_sons; kc_i++) {
				kc_do_print_phylum(kc_f, (kc_voidptr_t)KC_SUBPHYLUM(kc_p, kc_op_info->suboffset[kc_i]), kc_op_info->subphylum[kc_i] );
			}
"
{ if (cg_bigatomoperators && length_operators(cg_bigatomoperators) > 0) } ${
"			}
"
  $}
"			kc_indentation--;
			(void)fprintf(kc_f, kc_printformat_not_nullair_close, kc_indentation, \"\");
}	}	}	
"
	pds
					];
Consphylumdeclarations( pd, rpds )	-> [view_gen_printdefs_c: 
	rpds
	pd
					   ];
Nilphylumdeclarations()			-> [view_gen_printdefs_c: {/*EMPTY*/} ];
PhylumDeclaration( *, *, Emptyproductionblock(), * )
					-> [view_gen_printdefs_c: {/*EMPTY*/} ];
PhylumDeclaration( id, *, PredefinedAlternatives( * ), * )
					-> [view_gen_printdefs_c:
"void print_" id "
#ifdef KC_USE_PROTOTYPES
(" id " kc_p)
#else
(kc_p) " id " kc_p;
#endif
"
{ if (strcmp( f_strofID( id ), "float" ) == 0)} ${
"{ (void)fprintf(stdout, \"%*s%f\\n\", kc_indentation, \"\", kc_p);  }
"
  $} {else if (strcmp( f_strofID( id ), "int" ) == 0)} ${
"{ (void)fprintf(stdout, \"%*s%d\\n\", kc_indentation, \"\", kc_p);  }
"
  $} {else} ${
"{ kc_do_print_phylum(stdout, (kc_voidptr_t)kc_p, kc_phylum_" id ");  }
"
  $}
"void fprint_" id "
#ifdef KC_USE_PROTOTYPES
(FILE *kc_f, " id " kc_p)
#else
(kc_f, kc_p) FILE *kc_f; " id " kc_p;
#endif
"
{ if (strcmp( f_strofID( id ), "float" ) == 0)} ${
"{	if (!kc_f) kc_f = stdout;
	(void)fprintf(kc_f, \"%*s%f\\n\", kc_indentation, \"\", kc_p);
}
"
  $} {else if (strcmp( f_strofID( id ), "int" ) == 0)} ${
"{	if (!kc_f) kc_f = stdout;
	(void)fprintf(kc_f, \"%*s%d\\n\", kc_indentation, \"\", kc_p);
}
"
  $} {else} ${
"{ kc_do_print_phylum(kc_f, (kc_voidptr_t)kc_p, kc_phylum_" id ");  }
"
  $}
					];
PhylumDeclaration( id, *, ListAlternatives( *, * ), * ),
PhylumDeclaration( id, *, NonlistAlternatives( * ), * )
					-> [view_gen_printdefs_c:
"void print_" id "
#ifdef KC_USE_PROTOTYPES
(" id " kc_p)
#else
(kc_p) " id " kc_p;
#endif
{ kc_do_print_phylum(stdout, (kc_voidptr_t)kc_p, kc_phylum_" id ");  }
void fprint_" id "
#ifdef KC_USE_PROTOTYPES
(FILE *kc_f, " id " kc_p)
#else
(kc_f, kc_p) FILE *kc_f; " id " kc_p;
#endif
{ kc_do_print_phylum(kc_f, (kc_voidptr_t)kc_p, kc_phylum_" id ");  }
"
					];
Nilphyla()				-> [view_gen_printdefs_c: {/*EMPTY*/} ];
Consphyla( a_phy, r_phy )		-> [view_gen_printdefs_c:
 r_phy
"	/*SUPPRESS 622*/
	assertReason(kc_phylum != kc_phylum_" a_phy ", \"kc_do_print_phylum called with kc_phylum_" a_phy " argument\");
"
					];
Niloperators()				-> [view_gen_printdefs_c: {/*EMPTY*/} ];
Consoperators( a_op, r_op )		-> [view_gen_printdefs_c:
{ arguments args; }
 r_op
{ args = f_argumentsofoperator( a_op );
  gl_operator = a_op;
  gl_phylum = f_phylumofoperator( a_op );
  if (length_arguments(args) > 0) } ${
"			case (int)sel_" (ID)a_op ": {
"
   (arguments)args:view_gen_printdefs_bigatom_c
"			break; }
"
  $}
{ gl_operator = 0;
  gl_phylum = 0;
}
					];
Nilarguments()				-> [view_gen_printdefs_bigatom_c: {/*EMPTY*/} ];
Consarguments( *, r_args )		-> [view_gen_printdefs_bigatom_c:
	r_args
	$0:view_gen_printdefs_bigatom_do_c
					];
Consarguments( *, Nilarguments() )	-> [view_gen_printdefs_bigatom_c:
	$0:view_gen_printdefs_bigatom_do_c
					];
Consarguments( a_arg, * )	-> [view_gen_printdefs_bigatom_do_c:
{ if (f_isbigatom( a_arg )) } ${
"				fprint_" a_arg "(kc_f, ((" (ID)gl_phylum ")kc_p)->u." (ID)gl_operator "." a_arg "_" $0->seqnr ");
"
  $} { else } ${
"				kc_do_print_phylum(kc_f, (kc_voidptr_t)((" (ID)gl_phylum ")kc_p)->u." (ID)gl_operator "." a_arg "_" $0->seqnr ", kc_phylum_" a_arg " );
"
  $}
					];

/***************************************************************************/

PhylumDeclarations( pds )		-> [view_gen_printdotdecls_h:
"void fprintdotprologue KC__P(( FILE* ));
void fprintdotepilogue KC__P(( FILE* ));
int kc_set_fprintdot_hashtablesize KC__P(( int ));
"
	pds
					];
Consphylumdeclarations( pd, rpds )	-> [view_gen_printdotdecls_h: rpds pd ];
Nilphylumdeclarations()			-> [view_gen_printdotdecls_h: {/*EMPTY*/} ];
PhylumDeclaration( *, *, Emptyproductionblock(), * )
					-> [view_gen_printdotdecls_h: {/*EMPTY*/} ];
PhylumDeclaration( id, *, *, * )	-> [view_gen_printdotdecls_h:
"void fprintdot_" id " KC__P(( FILE*, " id ", char*, char*, char*, boolean, boolean, boolean ));
"
					];

/***************************************************************************/

PhylumDeclarations( pds )		-> [view_gen_printdotdefs_c:
	pds:view_gen_printdotdecls_c  /* declare static routines first */
	
"
static void kc_do_printdot_subgraph_prologue KC__P((FILE*, kc_voidptr_t, kc_enum_phyla, char*, char*, boolean, boolean));
static void kc_do_printdot_subgraph_epilogue KC__P((FILE*));
static void kc_do_printdot_genfields KC__P((FILE*, int, kc_enum_phyla, boolean));
static void kc_do_printdot_id_of_phylum KC__P((FILE*, kc_voidptr_t, kc_enum_phyla, boolean, kc_voidptr_t, int));
static void kc_do_printdot_do_add_edge KC__P((YYSTYPE, kc_enum_phyla, YYSTYPE, kc_enum_phyla, int, int*, kc_dotedgenode_t*, char*));
static void kc_do_printdot_add_edge KC__P((kc_voidptr_t, kc_enum_phyla, kc_voidptr_t, kc_enum_phyla, int, int*, kc_dotedgenode_t*, char*));
static void kc_do_printdot_edges KC__P((FILE*, kc_dotedgenode_t, char*, boolean));
static void kc_do_printdot_phylum KC__P((FILE*, kc_voidptr_t, kc_enum_phyla, boolean, int*, kc_dotedgenode_t*, char*, boolean, boolean, kc_voidptr_t, int));

static kc_hashtable_t kc_fprintdot_hashtable;
static int kc_fprintdot_hashtablesize = 5000;
int kc_set_fprintdot_hashtablesize
#ifdef KC_USE_PROTOTYPES
(int kc_i)
#else
(kc_i) int kc_i;
#endif
{	int kc_tmp = kc_fprintdot_hashtablesize;
	kc_fprintdot_hashtablesize =  kc_i;
	return kc_tmp;
}

static void kc_do_printdot_subgraph_prologue
#ifdef KC_USE_PROTOTYPES
(FILE *kc_f, kc_voidptr_t kc_p, kc_enum_phyla kc_phylum, char *kc_root, char *kc_edge_attributes, boolean kc_phy_labels, boolean kc_use_ctxt)
#else
(kc_f, kc_p, kc_phylum, kc_root, kc_edge_attributes, kc_phy_labels, kc_use_ctxt) FILE *kc_f; kc_voidptr_t kc_p; kc_enum_phyla kc_phylum; char *kc_root; char *kc_edge_attributes; boolean kc_phy_labels; boolean kc_use_ctxt;
#endif
{	if (!kc_f) kc_f = stdout;
	(void)fprintf(kc_f, \"/*subgraph*/ {\\n\");
	if (kc_root) {
		(void)fprintf(kc_f, \"\\\"%s\\\" [shape=ellipse\", kc_root);
		if (kc_edge_attributes && (strlen(kc_edge_attributes) > 0)) {
			(void)fprintf(kc_f, \", %s\", kc_edge_attributes);
		}
		if (kc_phy_labels) {
			(void)fprintf(kc_f, \", label=\\\"%s\\\\n%s\\\"\", kc_root, kc_PhylumInfo[kc_phylum].name);
		}
		(void)fprintf(kc_f, \"];\\n\");
		(void)fprintf(kc_f, \"\\\"%s\\\" ->\", kc_root);
		kc_do_printdot_id_of_phylum(kc_f, kc_p, kc_phylum, kc_use_ctxt, 0, 0);
		if (kc_edge_attributes && (strlen(kc_edge_attributes) > 0)) {
			(void)fprintf(kc_f, \"[%s]\", kc_edge_attributes);
		}
		(void)fprintf(kc_f, \";\\n\");
	}
}	

static void kc_do_printdot_subgraph_epilogue
#ifdef KC_USE_PROTOTYPES
(FILE *kc_f)
#else
(kc_f) FILE *kc_f;
#endif
{	if (!kc_f) kc_f = stdout;
	(void)fprintf(kc_f, \"}\\n\");
}
	
void fprintdotprologue
#ifdef KC_USE_PROTOTYPES
(FILE *kc_f)
#else
(kc_f) FILE *kc_f;
#endif
{	if (!kc_f) kc_f = stdout;
	(void)fprintf(kc_f, \"digraph kc_output{\\n\");
	(void)fprintf(kc_f, \"node [shape=record, height=.1, fontname=Helvetica];\\n\");
}	

void fprintdotepilogue
#ifdef KC_USE_PROTOTYPES
(FILE *kc_f)
#else
(kc_f) FILE *kc_f;
#endif
{	if (!kc_f) kc_f = stdout;
	(void)fprintf(kc_f, \"}\\n\");
}
	
static void kc_do_printdot_genfields
#ifdef KC_USE_PROTOTYPES
(FILE *kc_f, int kc_prodsel, kc_enum_phyla kc_phylum, boolean kc_phy_labels)
#else
(kc_f, kc_prodsel, kc_phylum, kc_phy_labels) FILE *kc_f; int kc_prodsel; kc_enum_phyla kc_phylum; boolean kc_phy_labels;
#endif
{	int kc_i = 1;
	KC_OPERATOR_INFO *kc_op_info = &kc_OperatorInfo[(int)kc_prodsel];
	if (kc_op_info->no_sons <= 0) return;
	if (!kc_f) kc_f = stdout;
	while(kc_i < kc_op_info->no_sons) {
		(void)fprintf(kc_f, \"<f%d>\", kc_i);
		if (kc_phy_labels) {
			(void)fprintf(kc_f, \"%s\", kc_PhylumInfo[(int)kc_op_info->subphylum[kc_i-1]].name);

		}
		(void)fprintf(kc_f, \"|\");
		kc_i++;
	}
	(void)fprintf(kc_f, \"<f%d>\", kc_i);
	if (kc_phy_labels) {
		(void)fprintf(kc_f, \"%s\", kc_PhylumInfo[(int)kc_op_info->subphylum[kc_i-1]].name);
	}
}	

static void kc_do_printdot_id_of_phylum
#ifdef KC_USE_PROTOTYPES
(FILE *kc_f, kc_voidptr_t kc_p, kc_enum_phyla kc_phylum, boolean kc_use_ctxt, kc_voidptr_t kc_ctxt, int kc_son_nr)
#else
(kc_f, kc_p, kc_phylum, kc_use_ctxt, kc_ctxt, kc_son_nr) FILE *kc_f; kc_voidptr_t kc_p; kc_enum_phyla kc_phylum; boolean kc_use_ctxt; kc_voidptr_t kc_ctxt; int kc_son_nr;
#endif
{
"
(phyla)cg_bigatomphyla
"	/*SUPPRESS 622*/
	assertPhylum(((casestring)kc_p),\"kc_p\",kc_phylum);
	if (!kc_f) kc_f = stdout;
	if (kc_phylum == kc_phylum_voidptr) {
		(void)fprintf(kc_f, \"kcidp%p\", kc_p);
		if (kc_use_ctxt) {
			(void)fprintf(kc_f, \"_%p_%d\", kc_ctxt, kc_son_nr);
		}
	} else if ((kc_phylum == kc_phylum_casestring) || (kc_phylum == kc_phylum_nocasestring)) {
		(void)fprintf(kc_f, \"kcids%p\", ((casestring)kc_p));
		if (kc_use_ctxt) {
			(void)fprintf(kc_f, \"_%p_%d\", kc_ctxt, kc_son_nr);
		}
	} else {
		(void)fprintf(kc_f, \"kcidx%p\", kc_p);
}	}	

static void kc_do_printdot_do_add_edge
#ifdef KC_USE_PROTOTYPES
(YYSTYPE kc_p, kc_enum_phyla kc_phylum, YYSTYPE kc_sub_p, kc_enum_phyla kc_sub_phylum, int kc_son_nr, int *kc_edge_nr, kc_dotedgenode_t *kc_edges, char *kc_edge_prefix)
#else
(kc_p, kc_phylum, kc_sub_p, kc_sub_phylum, kc_son_nr, kc_edge_nr, kc_edges, kc_edge_prefix) kc_voidptr_t kc_p; kc_enum_phyla kc_phylum; kc_voidptr_t kc_sub_p; kc_enum_phyla kc_sub_phylum; int kc_son_nr; int *kc_edge_nr; kc_dotedgenode_t *kc_edges; char *kc_edge_prefix;
#endif
{	kc_dotedgenode_t kc_hn;
	char kc_buf[30];
	kc_hn = kc_mkdotedgenode(kc_fprintdot_hashtable, kc_p, kc_phylum, kc_sub_p, kc_sub_phylum, kc_son_nr);
	if (! kc_hn->label) {
		kc_hn->label = (char*)(*kc_fprintdot_hashtable->malloc)((kc_size_t)(KC_PRINTDOT_LABELSIZE+1)*sizeof(char), kc_fprintdot_hashtable->malloc_private_data);
		kc_hn->lsize = KC_PRINTDOT_LABELSIZE;
		(void)strcpy(kc_hn->label, \"\");
		kc_hn->next = *kc_edges;
		*kc_edges = kc_hn;
	} else {
		char kc_buf2[30];
		(void)sprintf(kc_buf2, \", \");
		(void)strncat(kc_hn->label, kc_buf2, kc_hn->lsize - strlen(kc_hn->label));
	}
	if (kc_edge_prefix) {
		(void)strncat(kc_hn->label, kc_edge_prefix, kc_hn->lsize - strlen(kc_hn->label));
	}
	(void)sprintf(kc_buf, \"%d\", *kc_edge_nr);
	(void)strncat(kc_hn->label, kc_buf, kc_hn->lsize - strlen(kc_hn->label));
	(*kc_edge_nr)++;
}

static void kc_do_printdot_add_edge
#ifdef KC_USE_PROTOTYPES
(kc_voidptr_t kc_p, kc_enum_phyla kc_phylum, kc_voidptr_t kc_sub_p, kc_enum_phyla kc_sub_phylum, int kc_son_nr, int *kc_edge_nr, kc_dotedgenode_t *kc_edges, char *kc_edge_prefix)
#else
(kc_p, kc_phylum, kc_sub_p, kc_sub_phylum, kc_son_nr, kc_edge_nr, kc_edges, kc_edge_prefix) kc_voidptr_t kc_p; kc_enum_phyla kc_phylum; kc_voidptr_t kc_sub_p; kc_enum_phyla kc_sub_phylum; int kc_son_nr; int *kc_edge_nr; kc_dotedgenode_t *kc_edges; char *kc_edge_prefix;
#endif
{	YYSTYPE kc_n, kc_sub_n;
"
(phyla)cg_bigatomphyla
"	/*SUPPRESS 622*/
	assertPhylum(((casestring)kc_p),\"kc_p\",kc_phylum);
	kc_n.yt_voidptr = kc_p;
	kc_sub_n.yt_voidptr = kc_sub_p;
	kc_do_printdot_do_add_edge(kc_n, kc_phylum, kc_sub_n, kc_sub_phylum, kc_son_nr, kc_edge_nr, kc_edges, kc_edge_prefix);
}

static void kc_do_printdot_edges
#ifdef KC_USE_PROTOTYPES
(FILE *kc_f, kc_dotedgenode_t kc_edges, char *kc_edge_attributes, boolean kc_use_ctxt)
#else
(kc_f, kc_edges, kc_edge_attributes, kc_use_ctxt) FILE *kc_f; kc_dotedgenode_t kc_edges; char *kc_edge_attributes; boolean kc_use_ctxt;
#endif
{	kc_dotedgenode_t kc_p = kc_edges;
	if (!kc_f) kc_f = stdout;
	while(kc_p) {
		kc_do_printdot_id_of_phylum(kc_f, kc_p->ptr_from.yt_voidptr, kc_p->phy_from, kc_use_ctxt, 0, 0);
		(void)fprintf(kc_f, \":f%d -> \", kc_p->son_nr);
"
{ if (cg_bigatomoperators && length_operators(cg_bigatomoperators) > 0) } ${
"		switch(kc_p->phy_to) {
"
     (phyla)cg_bigatomphyla:view_gen_printdotedges_c
"		default:
"
  $}
"		kc_do_printdot_id_of_phylum(kc_f, kc_p->ptr_to.yt_voidptr, kc_p->phy_to, kc_use_ctxt, kc_p->ptr_from.yt_voidptr, kc_p->son_nr);
"
{ if (cg_bigatomoperators && length_operators(cg_bigatomoperators) > 0) } ${
"		}
"
  $}
"		(void)fprintf(kc_f, \" [label=\\\"%s\\\"\", kc_p->label);
		if (kc_edge_attributes && (strlen(kc_edge_attributes) > 0)) {
			(void)fprintf(kc_f, \", %s\", kc_edge_attributes);
		}
		(void)fprintf(kc_f, \"];\\n\");
		kc_p = kc_p->next;
}	}	

static void kc_do_printdot_phylum
#ifdef KC_USE_PROTOTYPES
(FILE *kc_f, kc_voidptr_t kc_p, kc_enum_phyla kc_phylum, boolean kc_outmost, int *kc_edge_nr, kc_dotedgenode_t *kc_edges, char *kc_edge_prefix, boolean kc_phy_labels, boolean kc_use_ctxt, kc_voidptr_t kc_ctxt, int kc_son_nr)
#else
(kc_f, kc_p, kc_phylum, kc_outmost, kc_edge_nr, kc_edges, kc_edge_prefix, kc_phy_labels, kc_use_ctxt, kc_ctxt, kc_son_nr) FILE *kc_f; kc_voidptr_t kc_p; kc_enum_phyla kc_phylum; boolean kc_outmost; int *kc_edge_nr; kc_dotedgenode_t *kc_edges; char *kc_edge_prefix; boolean kc_phy_labels; boolean kc_use_ctxt; kc_voidptr_t kc_ctxt; int kc_son_nr;
#endif
{	int kc_i;

"
(phyla)cg_bigatomphyla
"	/*SUPPRESS 622*/
	assertPhylum(((casestring)kc_p),\"kc_p\",kc_phylum);
	if (!kc_f) kc_f = stdout;
	if (kc_phylum == kc_phylum_voidptr) {
		kc_do_printdot_id_of_phylum(kc_f, kc_p, kc_phylum, kc_use_ctxt, kc_ctxt, kc_son_nr);
		(void)fprintf(kc_f, \" [label=\\\"%p\\\", shape=ellipse];\\n\", kc_p);
	} else if ((kc_phylum == kc_phylum_casestring) || (kc_phylum == kc_phylum_nocasestring)) {
		kc_do_printdot_id_of_phylum(kc_f, kc_p, kc_phylum, kc_use_ctxt, kc_ctxt, kc_son_nr);
		(void)fprintf(kc_f, \" [label=\\\"%s\\\", shape=ellipse];\\n\", ((casestring)kc_p)->name);
	} else {
		kc_enum_operators kc_prodsel = ((casestring)kc_p)->prod_sel;
		KC_OPERATOR_INFO *kc_op_info = &kc_OperatorInfo[(int)kc_prodsel];
		if (! kc_op_info->no_sons) {
			kc_do_printdot_id_of_phylum(kc_f, kc_p, kc_phylum, kc_use_ctxt, kc_ctxt, kc_son_nr);
			(void)fprintf(kc_f, \" [label=\\\"<f0>%s\\\"];\\n\", kc_op_info->name);
		} else {
			kc_do_printdot_id_of_phylum(kc_f, kc_p, kc_phylum, kc_use_ctxt, kc_ctxt, kc_son_nr);
			(void)fprintf(kc_f, \" [label=\\\"{<f0>%s|{\", kc_op_info->name);
			kc_do_printdot_genfields(kc_f, kc_prodsel, kc_phylum, kc_phy_labels);
			(void)fprintf(kc_f, \"}}\\\"];\\n\");
"
{ if (cg_bigatomoperators && length_operators(cg_bigatomoperators) > 0) } ${
"			switch(kc_prodsel) {
"
     (operators)cg_bigatomoperators
"			default:
"
  $}
"			for (kc_i=0; kc_i < kc_op_info->no_sons; kc_i++) {
				kc_do_printdot_add_edge( kc_p, kc_phylum, (kc_voidptr_t)KC_SUBPHYLUM(kc_p, kc_op_info->suboffset[kc_i]), kc_op_info->subphylum[kc_i], kc_i+1, kc_edge_nr, kc_edges, kc_edge_prefix );
				kc_do_printdot_phylum( kc_f, (kc_voidptr_t)KC_SUBPHYLUM(kc_p, kc_op_info->suboffset[kc_i]), kc_op_info->subphylum[kc_i], False, kc_edge_nr, kc_edges, kc_edge_prefix, kc_phy_labels, kc_use_ctxt, kc_p, kc_i+1 );
			}
"
{ if (cg_bigatomoperators && length_operators(cg_bigatomoperators) > 0) } ${
"			}
"
  $}
"	}	}	
}
"
	pds
					];
Consphylumdeclarations( pd, rpds )	-> [view_gen_printdotdefs_c view_gen_printdotdecls_c: 
	rpds
	pd
					   ];
Nilphylumdeclarations()			-> [view_gen_printdotdefs_c view_gen_printdotdecls_c: {/*EMPTY*/} ];

/* declare static routines first */
PhylumDeclaration( *, *, *, * )
					-> [view_gen_printdotdecls_c: {/*EMPTY*/} ];
PhylumDeclaration( id, *, PredefinedAlternatives( * ), * )
					-> [view_gen_printdotdecls_c:
"static void kc_do_printdot_subgraph_prologue__" id " KC__P((FILE*, " id ", char*, char*, boolean, boolean));
static void kc_do_printdot_id_of__" id " KC__P((FILE*, " id ", boolean, kc_voidptr_t, int));
static void kc_do_printdot__" id " KC__P((FILE*, " id ", boolean, int*, kc_dotedgenode_t*, char*, boolean, boolean, kc_voidptr_t, int));
/* TERRIBLE HACK: declare non-static, to shut up gcc -Wall ... */
/*static*/ void kc_do_printdot_add_edge_" id " KC__P((kc_voidptr_t, kc_enum_phyla, " id ", int, int*, kc_dotedgenode_t*, char*));
"
					];

PhylumDeclaration( *, *, Emptyproductionblock(), * )
					-> [view_gen_printdotdefs_c: {/*EMPTY*/} ];
PhylumDeclaration( id, *, PredefinedAlternatives( * ), * )
					-> [view_gen_printdotdefs_c:
"static void kc_do_printdot_subgraph_prologue__" id "
#ifdef KC_USE_PROTOTYPES
(FILE *kc_f, " id " kc_p, char *kc_root, char *kc_edge_attributes, boolean kc_phy_labels, boolean kc_use_ctxt)
#else
(kc_f, kc_p, kc_root, kc_edge_attributes, kc_phy_labels, kc_use_ctxt) FILE *kc_f; " id " kc_p; char *kc_root; char *kc_edge_attributes; boolean kc_phy_labels; boolean kc_use_ctxt;
#endif
{	if (!kc_f) kc_f = stdout;
	(void)fprintf(kc_f, \"/*subgraph*/ {\\n\");
	if (kc_root) {
		(void)fprintf(kc_f, \"\\\"%s\\\" [shape=ellipse\", kc_root);
		if (kc_edge_attributes && (strlen(kc_edge_attributes) > 0)) {
			(void)fprintf(kc_f, \", %s\", kc_edge_attributes);
		}
		if (kc_phy_labels) {
			(void)fprintf(kc_f, \", label=\\\"%s\\\\n%s\\\"\", kc_root, kc_PhylumInfo[kc_phylum_" id "].name);
		}
		(void)fprintf(kc_f, \"];\\n\");
		(void)fprintf(kc_f, \"\\\"%s\\\" ->\", kc_root);
		kc_do_printdot_id_of__" id "(kc_f, kc_p, kc_use_ctxt, 0, 0);
		if (kc_edge_attributes && (strlen(kc_edge_attributes) > 0)) {
			(void)fprintf(kc_f, \"[%s]\", kc_edge_attributes);
		}
		(void)fprintf(kc_f, \";\\n\");
	}
}
static void kc_do_printdot_id_of__" id "
#ifdef KC_USE_PROTOTYPES
(FILE *kc_f, " id " kc_p, boolean kc_use_ctxt, kc_voidptr_t kc_ctxt, int kc_son_nr)
#else
(kc_f, kc_p, kc_use_ctxt, kc_ctxt, kc_son_nr) FILE *kc_f; " id " kc_p; boolean kc_use_ctxt; kc_voidptr_t kc_ctxt; int kc_son_nr;
#endif
"
{ if (strcmp( f_strofID( id ), "float" ) == 0)} ${
"{	if (kc_use_ctxt) {
		(void)fprintf(kc_f, \"\\\"kcidf%f_%p_%d\\\"\", kc_p, kc_ctxt, kc_son_nr);
	} else {
		(void)fprintf(kc_f, \"\\\"kcidf%f\\\"\", kc_p);
}	}
"
  $} {else if (strcmp( f_strofID( id ), "int" ) == 0)} ${
"{	if (kc_use_ctxt) {
		(void)fprintf(kc_f, \"\\\"kcidi%d_%p_%d\\\"\", kc_p, kc_ctxt, kc_son_nr);
	} else {
		(void)fprintf(kc_f, \"\\\"kcidi%d\\\"\", kc_p);
}	}
"
  $} {else} ${
"{ kc_do_printdot_id_of_phylum(kc_f, (kc_voidptr_t)kc_p, kc_phylum_" id ", kc_use_ctxt, kc_ctxt, kc_son_nr);  }
"
  $}
"static void kc_do_printdot__" id "
#ifdef KC_USE_PROTOTYPES
(FILE *kc_f, " id " kc_p, boolean kc_outmost, int *kc_edge_nr, kc_dotedgenode_t *kc_edges, char *kc_edge_prefix, boolean kc_phy_labels, boolean kc_use_ctxt, kc_voidptr_t kc_ctxt, int kc_son_nr)
#else
(kc_f, kc_p, kc_outmost, kc_edge_nr, kc_edges, kc_edge_prefix, kc_phy_labels, kc_use_ctxt, kc_ctxt, kc_son_nr) FILE *kc_f; " id " kc_p; boolean kc_outmost; int *kc_edge_nr; kc_dotedgenode_t *kc_edges; char *kc_edge_prefix; boolean kc_phy_labels; boolean kc_use_ctxt; kc_voidptr_t kc_ctxt; int kc_son_nr;
#endif
"
{ if (strcmp( f_strofID( id ), "float" ) == 0)} ${
"{	if (!kc_f) kc_f = stdout;
	kc_do_printdot_id_of__" id "(kc_f, kc_p, kc_use_ctxt, kc_ctxt, kc_son_nr);
	(void)fprintf(kc_f, \" [label=\\\"%f\\\", shape=ellipse];\\n\", kc_p);
}
"
  $} {else if (strcmp( f_strofID( id ), "int" ) == 0)} ${
"{	if (!kc_f) kc_f = stdout;
	kc_do_printdot_id_of__" id "(kc_f, kc_p, kc_use_ctxt, kc_ctxt, kc_son_nr);
	(void)fprintf(kc_f, \" [label=\\\"%d\\\", shape=ellipse];\\n\", kc_p);
}
"
  $} {else} ${
"{ kc_do_printdot_phylum(kc_f, (kc_voidptr_t)kc_p, kc_phylum_" id ", kc_outmost, kc_edge_nr, kc_edges, kc_edge_prefix, kc_phy_labels, kc_use_ctxt, kc_ctxt, kc_son_nr); }
"
  $}
"/* TERRIBLE HACK: declare non-static, to shut up gcc -Wall ... */
/*static*/ void kc_do_printdot_add_edge_" id "
#ifdef KC_USE_PROTOTYPES
(kc_voidptr_t kc_p, kc_enum_phyla kc_phylum, " id " kc_sub_p, int kc_son_nr, int *kc_edge_nr, kc_dotedgenode_t *kc_edges, char *kc_edge_prefix)
#else
(kc_p, kc_phylum, kc_sub_p, kc_son_nr, kc_edge_nr, kc_edges, kc_edge_prefix) kc_voidptr_t kc_p; kc_enum_phyla kc_phylum; " id " kc_sub_p; int kc_son_nr; int *kc_edge_nr; kc_dotedgenode_t *kc_edges; char *kc_edge_prefix;
#endif
"
{ if (strcmp( f_strofID( id ), "float" ) == 0)} ${
"{	YYSTYPE kc_n, kc_sub_n;
	kc_n.yt_voidptr = kc_p;
	kc_sub_n.yt_" id " = kc_sub_p;
	kc_do_printdot_do_add_edge(kc_n, kc_phylum, kc_sub_n, kc_phylum_" id ", kc_son_nr, kc_edge_nr, kc_edges, kc_edge_prefix);
}
"
  $} {else if (strcmp( f_strofID( id ), "int" ) == 0)} ${
"{	YYSTYPE kc_n, kc_sub_n;
	kc_n.yt_voidptr = kc_p;
	kc_sub_n.yt_" id " = kc_sub_p;
	kc_do_printdot_do_add_edge(kc_n, kc_phylum, kc_sub_n, kc_phylum_" id ", kc_son_nr, kc_edge_nr, kc_edges, kc_edge_prefix);
}
"
  $} {else} ${
"{ kc_do_printdot_add_edge(kc_p, kc_phylum, kc_sub_p, kc_phylum_" id ", kc_son_nr, kc_edge_nr, kc_edges, kc_edge_prefix); }
"
  $}
"void fprintdot_" id "
#ifdef KC_USE_PROTOTYPES
(FILE *kc_f, " id " kc_p, char *kc_root, char *kc_edge_prefix, char *kc_edge_attributes, boolean kc_phy_labels, boolean kc_use_ctxt, boolean kc_prt_head_foot)
#else
(kc_f, kc_p, kc_root, kc_edge_prefix, kc_edge_attributes, kc_phy_labels, kc_use_ctxt, kc_prt_head_foot) FILE *kc_f; " id " kc_p; char *kc_root; char *kc_edge_prefix; char *kc_edge_attributes; boolean kc_phy_labels; boolean kc_use_ctxt; boolean kc_prt_head_foot;
#endif
{	int kc_edge_nr = 1;
	kc_dotedgenode_t kc_edges = 0;
	if (kc_prt_head_foot) fprintdotprologue(kc_f);
	/*if (kc_outmost)*/ kc_do_printdot_subgraph_prologue__" id "(kc_f, kc_p, kc_root, kc_edge_attributes, kc_phy_labels, kc_use_ctxt);
	kc_fprintdot_hashtable = kc_ht_create_simple(kc_fprintdot_hashtablesize);
	kc_do_printdot__" id "(kc_f, kc_p, True, &kc_edge_nr, &kc_edges, kc_edge_prefix, kc_phy_labels, kc_use_ctxt, 0, 0);
	kc_do_printdot_edges(kc_f, kc_edges, kc_edge_attributes, kc_use_ctxt);
	kc_ht_delete(kc_fprintdot_hashtable);
	/*if (kc_outmost)*/ kc_do_printdot_subgraph_epilogue(kc_f);
	if (kc_prt_head_foot) fprintdotepilogue(kc_f);
}
"
					];
PhylumDeclaration( id, *, ListAlternatives( *, * ), * ),
PhylumDeclaration( id, *, NonlistAlternatives( * ), * )
					-> [view_gen_printdotdefs_c:
"void fprintdot_" id "
#ifdef KC_USE_PROTOTYPES
(FILE *kc_f, " id " kc_p, char *kc_root, char *kc_edge_prefix, char *kc_edge_attributes, boolean kc_phy_labels, boolean kc_use_ctxt, boolean kc_prt_head_foot)
#else
(kc_f, kc_p, kc_root, kc_edge_prefix, kc_edge_attributes, kc_phy_labels, kc_use_ctxt, kc_prt_head_foot) FILE *kc_f; " id " kc_p; char *kc_root; char *kc_edge_prefix; char *kc_edge_attributes; boolean kc_phy_labels; boolean kc_use_ctxt;; boolean kc_prt_head_foot;
#endif
{	int kc_edge_nr = 1;
	kc_dotedgenode_t kc_edges = 0;
	if (kc_prt_head_foot) fprintdotprologue(kc_f);
	/*if (kc_outmost)*/ kc_do_printdot_subgraph_prologue(kc_f, kc_p, kc_phylum_" id ", kc_root, kc_edge_attributes, kc_phy_labels, kc_use_ctxt);
	kc_fprintdot_hashtable = kc_ht_create_simple(kc_fprintdot_hashtablesize);
	kc_do_printdot_phylum(kc_f, (kc_voidptr_t)kc_p, kc_phylum_" id ", True, &kc_edge_nr, &kc_edges, kc_edge_prefix, kc_phy_labels, kc_use_ctxt, 0, 0);
	kc_do_printdot_edges(kc_f, kc_edges, kc_edge_attributes, kc_use_ctxt);
	kc_ht_delete(kc_fprintdot_hashtable);
	/*if (kc_outmost)*/ kc_do_printdot_subgraph_epilogue(kc_f);
	if (kc_prt_head_foot) fprintdotepilogue(kc_f);
}
"
					];

/* * * * * * * * * * * */

Nilphyla()				-> [view_gen_printdotdefs_c: {/*EMPTY*/} ];
Consphyla( a_phy, r_phy )		-> [view_gen_printdotdefs_c:
 r_phy
"	/*SUPPRESS 622*/
	assertReason(kc_phylum != kc_phylum_" a_phy ", \"kc_do_printdot_phylum called with kc_phylum_" a_phy " argument\");
"
					];

/* * * * * * * * * * * */

Niloperators()				-> [view_gen_printdotdefs_c: {/*EMPTY*/} ];
Consoperators( a_op, r_op )		-> [view_gen_printdotdefs_c:
{ arguments args; }
 r_op
{ args = f_argumentsofoperator( a_op );
  gl_operator = a_op;
  gl_phylum = f_phylumofoperator( a_op );
  if (length_arguments(args) > 0) } ${
"			case (int)sel_" (ID)a_op ": {
				kc_i = 0;
"
   (arguments)args:view_gen_printdotdefs_bigatom_c
"			break; }
"
  $}
{ gl_operator = 0;
  gl_phylum = 0;
}
					];
Nilarguments()				-> [view_gen_printdotdefs_bigatom_c: {/*EMPTY*/} ];
Consarguments( *, r_args )		-> [view_gen_printdotdefs_bigatom_c:
	r_args
	$0:view_gen_printdotdefs_bigatom_do_c
					];
Consarguments( *, Nilarguments() )	-> [view_gen_printdotdefs_bigatom_c:
	$0:view_gen_printdotdefs_bigatom_do_c
					];
Consarguments( a_arg, * )	-> [view_gen_printdotdefs_bigatom_do_c:
{ if (f_isbigatom( a_arg )) } ${
"				kc_do_printdot_add_edge_" a_arg "(kc_p, kc_phylum, ((" (ID)gl_phylum ")kc_p)->u." (ID)gl_operator "." a_arg "_" $0->seqnr ",  kc_i+1, kc_edge_nr, kc_edges, kc_edge_prefix);
				kc_do_printdot__" a_arg "(kc_f, ((" (ID)gl_phylum ")kc_p)->u." (ID)gl_operator "." a_arg "_" $0->seqnr ", False, kc_edge_nr, kc_edges, kc_edge_prefix, kc_phy_labels, kc_use_ctxt, kc_p, kc_i+1);
"
  $} { else } ${
"				kc_do_printdot_add_edge(kc_f, kc_phylum, (kc_voidptr_t)((" (ID)gl_phylum ")kc_p)->u." (ID)gl_operator "." a_arg "_" $0->seqnr ", kc_phylum_" a_arg ", kc_i+1, kc_edge_nr, kc_edges, kc_edge_prefix);
				kc_do_printdot_phylum(kc_f, (kc_voidptr_t)((" (ID)gl_phylum ")kc_p)->u." (ID)gl_operator "." a_arg "_" $0->seqnr ", kc_phylum_" a_arg ", False, kc_edge_nr, kc_edges, kc_edge_prefix, kc_phy_labels, kc_use_ctxt, kc_p, kc_i+1);
"
  $}
"				kc_i++;
"

					];

/* * * * * * * * * * * */

Nilphyla()				-> [view_gen_printdotedges_c: {/*EMPTY*/} ];
Consphyla( a_phy, r_phy )		-> [view_gen_printdotedges_c:
 r_phy
"		case (int)kc_phylum_" a_phy ": {
			kc_do_printdot_id_of__" a_phy "(kc_f, kc_p->ptr_to.yt_" a_phy ", kc_use_ctxt, kc_p->ptr_from.yt_voidptr, kc_p->son_nr);
		break; }
"
					];

/***************************************************************************/

PhylumDeclarations( pds )		-> [view_gen_listdecls_h:
	pds
					];
Consphylumdeclarations( pd, rpds )	-> [view_gen_listdecls_h: rpds pd ];
Nilphylumdeclarations()			-> [view_gen_listdecls_h: {/*EMPTY*/} ];
PhylumDeclaration( *, *, *, * )	-> [view_gen_listdecls_h: {/*EMPTY*/} ];
PhylumDeclaration( id, *, ListAlternatives( *, el ), * )	-> [view_gen_listdecls_h:
id " concat_" id " KC__P(( " id ", " id " ));
" id " reverse_" id " KC__P(( " id " ));
int length_" id " KC__P(( " id " ));
" el " last_" id " KC__P(( " id " ));
" id " map_" id " KC__P(( " id ", " el " (*)(" el ")));
" id " filter_" id " KC__P(( " id ", boolean (*)(" el ")));
void freelist_" id " KC__P(( " id " ));
"
					];

/***************************************************************************/

PhylumDeclarations( pds )		-> [view_gen_listdefs_c:
"static char *kc_error_concat = \"concat_\";
static char *kc_error_reverse = \"reverse_\";
static char *kc_error_length = \"length_\";
static char *kc_error_last = \"last_\";
static char *kc_error_last_with_nil_argument = \"Internal Error: last_%s was called with argument Nil%s\\n\";
static char *kc_error_map = \"map_\";
static char *kc_error_filter = \"filter_\";
static char *kc_error_freelist = \"freelist_\";

static int kc_do_length_phylum
#ifdef KC_USE_PROTOTYPES
(kc_voidptr_t kc_p, kc_enum_phyla kc_phylum )
#else
(kc_p, kc_phylum) kc_voidptr_t kc_p; kc_enum_phyla kc_phylum;
#endif
{	boolean kc_not_ready = True;
	int kc_length = 0;
	kc_enum_operators kc_prodsel;
	while(kc_not_ready) {
		/*SUPPRESS 622*/
		assertPhylum(((casestring)kc_p),\"kc_p\",kc_phylum);
		kc_prodsel = ((casestring)kc_p)->prod_sel;
		if (kc_prodsel == kc_PhylumInfo[(int)kc_phylum].first_operator) {
			kc_not_ready=False;
		} else if (kc_prodsel == kc_PhylumInfo[(int)kc_phylum].last_operator) {
			kc_length++;
			kc_p = (kc_voidptr_t)KC_SUBPHYLUM(kc_p, kc_OperatorInfo[(int)kc_prodsel].suboffset[1]);
		} else {
			kc_invalid_operator(kc_error_length, kc_phylum, __LINE__, __FILE__, (int)kc_prodsel);/*NOTREACHED*/
	}	}
	return kc_length;
}

static void kc_do_freelist_phylum
#ifdef KC_USE_PROTOTYPES
(kc_voidptr_t kc_p, kc_enum_phyla kc_phylum )
#else
(kc_p, kc_phylum) kc_voidptr_t kc_p; kc_enum_phyla kc_phylum;
#endif
{	boolean kc_not_ready = True;
	kc_enum_operators kc_prodsel;
	kc_voidptr_t kc_tmp_p;
	while(kc_not_ready) {
		/*SUPPRESS 622*/
		assertPhylum(((casestring)kc_p),\"kc_p\",kc_phylum);
		kc_prodsel = ((casestring)kc_p)->prod_sel;
		if (kc_prodsel == kc_PhylumInfo[(int)kc_phylum].first_operator) {
			kc_do_free_phylum(kc_p, False, kc_phylum);
			kc_not_ready=False;
		} else if (kc_prodsel == kc_PhylumInfo[(int)kc_phylum].last_operator) {
			kc_tmp_p = kc_p;
			kc_p = (kc_voidptr_t)KC_SUBPHYLUM(kc_p, kc_OperatorInfo[(int)kc_prodsel].suboffset[1]);
			kc_do_free_phylum(kc_tmp_p, False, kc_phylum);
		} else {
			kc_invalid_operator(kc_error_freelist, kc_phylum, __LINE__, __FILE__, (int)kc_prodsel);/*NOTREACHED*/
}	}	}

static kc_voidptr_t kc_do_concat_phylum
#ifdef KC_USE_PROTOTYPES
(kc_voidptr_t kc_p1, kc_voidptr_t kc_p2, kc_enum_phyla kc_phylum)
#else
(kc_p1, kc_p2, kc_phylum) kc_voidptr_t kc_p1, kc_p2; kc_enum_phyla kc_phylum;
#endif
{	kc_enum_operators kc_prodsel;
	/*SUPPRESS 622*/
	assertPhylum(((casestring)kc_p1),\"kc_p1\",kc_phylum);
	kc_prodsel = ((casestring)kc_p1)->prod_sel;
	if (kc_prodsel == kc_PhylumInfo[(int)kc_phylum].first_operator) {
		return kc_p2;
	} else if (kc_prodsel == kc_PhylumInfo[(int)kc_phylum].last_operator) {
		return (kc_voidptr_t)(*kc_OperatorInfo[(int)kc_prodsel].create_routine)(
			kc_prodsel,
			(kc_voidptr_t)KC_SUBPHYLUM(kc_p1, kc_OperatorInfo[(int)kc_prodsel].suboffset[0]),
			 kc_do_concat_phylum( (kc_voidptr_t)KC_SUBPHYLUM(kc_p1, kc_OperatorInfo[(int)kc_prodsel].suboffset[1]), kc_p2, kc_phylum ) );
	} else {
		kc_invalid_operator(kc_error_concat, kc_phylum, __LINE__, __FILE__, (int)kc_prodsel);/*NOTREACHED*/return (kc_voidptr_t)0;
}	}

static kc_voidptr_t kc_do_reverse_phylum
#ifdef KC_USE_PROTOTYPES
(kc_voidptr_t kc_p, kc_enum_phyla kc_phylum)
#else
(kc_p, kc_phylum) kc_voidptr_t kc_p; kc_enum_phyla kc_phylum;
#endif
{	boolean kc_not_ready = True;
	kc_enum_operators kc_prodsel;
	KC_PHYLUM_INFO *kc_phy_info = &kc_PhylumInfo[(int)kc_phylum];
	KC_OPERATOR_INFO *kc_firstop_info = &kc_OperatorInfo[(int)kc_phy_info->first_operator];
	KC_OPERATOR_INFO *kc_lastop_info = &kc_OperatorInfo[(int)kc_phy_info->last_operator];
	kc_voidptr_t kc_tmp = (*kc_firstop_info->create_routine)(kc_phy_info->first_operator);
	while(kc_not_ready) {
		/*SUPPRESS 622*/
		assertPhylum(((casestring)kc_p),\"kc_p\",kc_phylum);
		kc_prodsel = ((casestring)kc_p)->prod_sel;
		if (kc_prodsel == kc_phy_info->first_operator) {
			kc_not_ready=False;
		} else if (kc_prodsel == kc_phy_info->last_operator) {
			kc_tmp = (kc_voidptr_t)(*kc_lastop_info->create_routine)(kc_prodsel, (kc_voidptr_t)KC_SUBPHYLUM(kc_p, kc_lastop_info->suboffset[0]), kc_tmp);
			kc_p = (kc_voidptr_t)KC_SUBPHYLUM(kc_p, kc_lastop_info->suboffset[1]);
		} else {
			kc_invalid_operator(kc_error_reverse, kc_phylum, __LINE__, __FILE__, (int)kc_prodsel);/*NOTREACHED*/
	}	}
	return kc_tmp;
}

static kc_voidptr_t kc_do_last_phylum
#ifdef KC_USE_PROTOTYPES
(kc_voidptr_t kc_p, kc_enum_phyla kc_phylum)
#else
(kc_p, kc_phylum) kc_voidptr_t kc_p; kc_enum_phyla kc_phylum;
#endif
{	boolean kc_not_ready = True;
	kc_voidptr_t kc_tmp = (kc_voidptr_t)0;
	kc_enum_operators kc_prodsel;
	KC_PHYLUM_INFO *kc_phy_info = &kc_PhylumInfo[(int)kc_phylum];
	KC_OPERATOR_INFO *kc_lastop_info = &kc_OperatorInfo[(int)kc_phy_info->last_operator];
	/*SUPPRESS 622*/
	assertPhylum(((casestring)kc_p),\"kc_p\",kc_phylum);
	if (((casestring)kc_p)->prod_sel == kc_phy_info->first_operator) {
		(void)fflush(stdout); (void)fprintf(stderr, kc_error_last_with_nil_argument, kc_phy_info->name,  kc_phy_info->name); exit( 1 ); /*NOTREACHED*/
	}
	while(kc_not_ready) {
		/*SUPPRESS 622*/
		assertPhylum(((casestring)kc_p),\"kc_p\",kc_phylum);
		kc_prodsel = ((casestring)kc_p)->prod_sel;
		if (kc_prodsel == kc_phy_info->first_operator) {
			kc_not_ready=False;
		} else if (kc_prodsel == kc_phy_info->last_operator) {
			kc_tmp = (kc_voidptr_t)KC_SUBPHYLUM(kc_p, kc_lastop_info->suboffset[0]);
			kc_p = (kc_voidptr_t)KC_SUBPHYLUM(kc_p, kc_lastop_info->suboffset[1]);
		} else {
			kc_invalid_operator(kc_error_last, kc_phylum, __LINE__, __FILE__, (int)kc_prodsel);/*NOTREACHED*/
	}	}
	return kc_tmp;
}

static kc_voidptr_t kc_do_map_phylum
#ifdef KC_USE_PROTOTYPES
(kc_voidptr_t kc_p, kc_voidptr_t (*kc_fp)(kc_voidptr_t), kc_enum_phyla kc_phylum)
#else
(kc_p, kc_fp, kc_phylum) kc_voidptr_t kc_p; kc_voidptr_t (*kc_fp)KC__P((kc_voidptr_t)); kc_enum_phyla kc_phylum;
#endif
{	kc_enum_operators kc_prodsel;
	/*SUPPRESS 622*/
	assertPhylum(((casestring)kc_p),\"kc_p\",kc_phylum);
	kc_prodsel = ((casestring)kc_p)->prod_sel;
	if (kc_prodsel == kc_PhylumInfo[(int)kc_phylum].first_operator) {
		return kc_p;
	} else if (kc_prodsel == kc_PhylumInfo[(int)kc_phylum].last_operator) {
		return (kc_voidptr_t)(*kc_OperatorInfo[(int)kc_prodsel].create_routine)(
			kc_prodsel,
			(*kc_fp)((kc_voidptr_t)KC_SUBPHYLUM(kc_p, kc_OperatorInfo[(int)kc_prodsel].suboffset[0])),
			kc_do_map_phylum((kc_voidptr_t)KC_SUBPHYLUM(kc_p, kc_OperatorInfo[(int)kc_prodsel].suboffset[1]), kc_fp, kc_phylum));
	} else {
		kc_invalid_operator(kc_error_map, kc_phylum, __LINE__, __FILE__, (int)kc_prodsel);/*NOTREACHED*/return (kc_voidptr_t)0;
}	}

static kc_voidptr_t kc_do_filter_phylum
#ifdef KC_USE_PROTOTYPES
(kc_voidptr_t kc_p,  boolean (*kc_fp)(kc_voidptr_t), kc_enum_phyla kc_phylum)
#else
(kc_p, kc_fp, kc_phylum) kc_voidptr_t kc_p; boolean (*kc_fp)KC__P((kc_voidptr_t)); kc_enum_phyla kc_phylum;
#endif
{	kc_enum_operators kc_prodsel;
	/*SUPPRESS 622*/
	assertPhylum(((casestring)kc_p),\"kc_p\",kc_phylum);
	kc_prodsel = ((casestring)kc_p)->prod_sel;
	if (kc_prodsel == kc_PhylumInfo[(int)kc_phylum].first_operator) {
		return kc_p;
	} else if (kc_prodsel == kc_PhylumInfo[(int)kc_phylum].last_operator) {
		if ((*kc_fp)((kc_voidptr_t)KC_SUBPHYLUM(kc_p, kc_OperatorInfo[(int)kc_prodsel].suboffset[0]))) {
			return (kc_voidptr_t)(*kc_OperatorInfo[(int)kc_prodsel].create_routine)(
				kc_prodsel,
				(kc_voidptr_t)KC_SUBPHYLUM(kc_p, kc_OperatorInfo[(int)kc_prodsel].suboffset[0]),
				kc_do_filter_phylum((kc_voidptr_t)KC_SUBPHYLUM(kc_p, kc_OperatorInfo[(int)kc_prodsel].suboffset[1]), kc_fp, kc_phylum));
		} else {
			return kc_do_filter_phylum((kc_voidptr_t)KC_SUBPHYLUM(kc_p, kc_OperatorInfo[(int)kc_prodsel].suboffset[1]), kc_fp, kc_phylum);
		}
	} else {
		kc_invalid_operator(kc_error_filter, kc_phylum, __LINE__, __FILE__, (int)kc_prodsel);/*NOTREACHED*/return (kc_voidptr_t)0;
}	}

"
	pds
					];
Consphylumdeclarations( pd, rpds )	-> [view_gen_listdefs_c: 
	rpds
	pd
					   ];
Nilphylumdeclarations()			-> [view_gen_listdefs_c: {/*EMPTY*/} ];
PhylumDeclaration( *, *, *, * )	-> [view_gen_listdefs_c: {/*EMPTY*/} ];
PhylumDeclaration( id, *, ListAlternatives( *, el ), * )
					-> [view_gen_listdefs_c:
id " concat_" id "
#ifdef KC_USE_PROTOTYPES
(" id " kc_p1, " id " kc_p2)
#else
(kc_p1, kc_p2) " id " kc_p1, kc_p2;
#endif
"
{ if (f_isbigatom(el)) } ${
"{	/*SUPPRESS 622*/
	assert_" id "(kc_p1,\"kc_p1\");
	if (kc_p1->prod_sel == sel_Nil" id ") {
		return kc_p2;
	} else if (kc_p1->prod_sel ==  sel_Cons" id ") {
		return Cons" id "(
			kc_p1->u.Cons" id "." el "_1,
			concat_" id "(kc_p1->u.Cons" id "." id "_1, kc_p2) );
	} else {
		kc_invalid_operator(kc_error_concat, kc_phylum_" id ", __LINE__, __FILE__, (int)kc_p1->prod_sel);/*NOTREACHED*/return (" id ")0;
}	}
"
  $} {else} ${
"{ return (" id ")kc_do_concat_phylum( (kc_voidptr_t)kc_p1, (kc_voidptr_t)kc_p2, kc_phylum_" id " ); }
"
 $}
id " reverse_" id "
#ifdef KC_USE_PROTOTYPES
(" id " kc_p)
#else
(kc_p) " id " kc_p;
#endif
"
{ if (f_isbigatom(el)) } ${
"{	boolean kc_not_ready = True;
	" id " kc_tmp = Nil" id "();
	while(kc_not_ready) {
		/*SUPPRESS 622*/
		assert_" id "(((casestring)kc_p),\"kc_p\");
		if (kc_p->prod_sel == sel_Nil" id ") {
			kc_not_ready=False;
		} else if (kc_p->prod_sel == sel_Cons" id ") {
			kc_tmp = Cons" id "(kc_p->u.Cons" id "." el "_1, kc_tmp);
			kc_p = kc_p->u.Cons" id "." id "_1;
		} else {
			kc_invalid_operator(kc_error_reverse, kc_phylum_" id ", __LINE__, __FILE__, (int)kc_p->prod_sel);/*NOTREACHED*/
	}	}
	return kc_tmp;
}
"
  $} {else} ${
"{ return (" id ")kc_do_reverse_phylum( (kc_voidptr_t)kc_p, kc_phylum_" id " ); }
"
 $}
"int length_" id "
#ifdef KC_USE_PROTOTYPES
(" id " kc_p)
#else
(kc_p) " id " kc_p;
#endif
{ return kc_do_length_phylum( (kc_voidptr_t)kc_p, kc_phylum_" id " ); }
" el " last_" id "
#ifdef KC_USE_PROTOTYPES
(" id " kc_p)
#else
(kc_p) " id " kc_p;
#endif
"
{ if (f_isbigatom(el)) } ${
"{	boolean kc_not_ready = True;
	" el " kc_tmp = (" el ")0;
	/*SUPPRESS 622*/
	assert_" id "(kc_p,\"kc_p\");
	if (kc_p->prod_sel == sel_Nil" id ") {
		(void)fflush(stdout); (void)fprintf(stderr, kc_error_last_with_nil_argument, \"" id "\",  \"" id "\"); exit( 1 ); /*NOTREACHED*/
	}
	while(kc_not_ready) {
		/*SUPPRESS 622*/
		assert_" id "(kc_p,\"kc_p\");
		if (kc_p->prod_sel == sel_Nil" id ") {
			kc_not_ready=False;
		} else if (kc_p->prod_sel == sel_Cons" id ") {
			kc_tmp = kc_p->u.Cons" id "." el "_1;
			kc_p = kc_p->u.Cons" id "." id "_1;
		} else {
			kc_invalid_operator(kc_error_last, kc_phylum_" id ", __LINE__, __FILE__, (int)kc_p->prod_sel);/*NOTREACHED*/
	}	}
	return kc_tmp;
}
"
  $} {else} ${
"{ return (" el ")kc_do_last_phylum( (kc_voidptr_t)kc_p, kc_phylum_" id " ); }
"
 $}
id " map_" id "
#ifdef KC_USE_PROTOTYPES
(" id " kc_p, " el " (*kc_fp)(" el "))
#else
(kc_p, kc_fp) " id " kc_p; " el " (*kc_fp)KC__P((" el "));
#endif
"
{ if (f_isbigatom(el)) } ${
"{	/*SUPPRESS 622*/
	assert_" id "(kc_p,\"kc_p\");
	if (kc_p->prod_sel == sel_Nil" id ") {
		return kc_p;
	} else if (kc_p->prod_sel == sel_Cons" id ") {
		return Cons" id "(
			(*kc_fp)(kc_p->u.Cons" id "." el "_1),
			map_" id "(kc_p->u.Cons" id "." id "_1, kc_fp));
	} else {
		kc_invalid_operator(kc_error_map, kc_phylum_" id ", __LINE__, __FILE__, (int)kc_p->prod_sel);/*NOTREACHED*/return (" id ")0;
}	}
"
  $} {else} ${
"{ return (" id ")kc_do_map_phylum( (kc_voidptr_t)kc_p, (kc_voidptr_t (*)KC__P((kc_voidptr_t)))kc_fp, kc_phylum_" id " ); }
"
 $}
id " filter_" id "
#ifdef KC_USE_PROTOTYPES
(" id " kc_p, boolean (*kc_fp)(" el "))
#else
(kc_p, kc_fp) " id " kc_p; boolean (*kc_fp)KC__P((" el "));
#endif
"
{ if (f_isbigatom(el)) } ${
"{	/*SUPPRESS 622*/
	assert_" id "(kc_p,\"kc_p\");
	if (kc_p->prod_sel == sel_Nil" id ") {
		return kc_p;
	} else if (kc_p->prod_sel == sel_Cons" id ") {
		if ((*kc_fp)(kc_p->u.Cons" id "." el "_1)) {
			return Cons" id "(
				kc_p->u.Cons" id "." el "_1,
				filter_" id "(kc_p->u.Cons" id "." id "_1, kc_fp));
		} else {
			return filter_" id "(kc_p->u.Cons" id "." id "_1, kc_fp);
		}
	} else {
		kc_invalid_operator(kc_error_filter, kc_phylum_" id ", __LINE__, __FILE__, (int)kc_p->prod_sel);/*NOTREACHED*/return (" id ")0;
}	}
"
  $} {else} ${
"{ return (" id ")kc_do_filter_phylum( (kc_voidptr_t)kc_p, (boolean (*)KC__P((kc_voidptr_t)))kc_fp, kc_phylum_" id " ); }
"
 $}
"void freelist_" id "
#ifdef KC_USE_PROTOTYPES
(" id " kc_p)
#else
(kc_p) " id " kc_p;
#endif
{ kc_do_freelist_phylum( (kc_voidptr_t)kc_p, kc_phylum_" id " ); }
"
					];

/***************************************************************************/
/*
 * Included code
 *
 */
Nilincludedeclarations()		-> [view_gen_includes: {/*EMPTY*/} ];
Consincludedeclarations( *, * )		-> [view_gen_includes:
"/* included stuff */
"
	$0:view_do_gen_includes
"/* end included stuff */

"
					];
Nilincludedeclarations()		-> [view_do_gen_includes: {/*EMPTY*/} ];
Consincludedeclarations( e ,l)		-> [view_do_gen_includes: l e ];
IncludeDeclaration( i )			-> [view_do_gen_includes: 
"#line " $0->line " \"" $0->file:view_filename "\"
"
	i
(charptr)g_emptystring:view_printer_outputfileline
					];
Nilincludes()				-> [view_do_gen_includes: {/*EMPTY*/} ];
Consincludes( e, l )			-> [view_do_gen_includes: l e ];
Include( c )				-> [view_do_gen_includes: c ];
IncludeNl( i )				-> [view_do_gen_includes: 
{ char *nl_string = f_mknls( i ); }
	(charptr)nl_string
					];

/***************************************************************************/
/*
 * CSGIO code
 */


PhylumDeclarations( * )			-> [view_gen_csgio_start_h:
"/* translation of file(s)
"
(fnfiles)Thefnfiles
" */
/* generated by:
 *	" (charptr)kimwitu_copyright "
 */
#ifndef KC_CSGIO_HEADER
#define KC_CSGIO_HEADER
#define KIMW_CSGIO_HEADER /* 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 \"k.h\"	/* in case a user forgets */

int kc_set_csgio_hashtablesize KC__P((int kc_i));

"
				];
PhylumDeclarations( * )			-> [view_gen_csgio_end_h:
"#endif /* ! KC_CSGIO_HEADER */

"
				];
PhylumDeclarations( pds )		-> [view_gen_csgio_h:
	pds
				];
Consphylumdeclarations( pd, rpds )	-> [view_gen_csgio_h: 
	rpds
	pd
					   ];
Nilphylumdeclarations()			-> [view_gen_csgio_h: {/*EMPTY*/} ];
PhylumDeclaration( *, *, Emptyproductionblock(), * )
					-> [view_gen_csgio_h: {/*EMPTY*/} ];
PhylumDeclaration( id, *, ListAlternatives( *, * ), * ),
PhylumDeclaration( id, *, PredefinedAlternatives( * ), * ),
PhylumDeclaration( id, *, NonlistAlternatives( * ), * )
					-> [view_gen_csgio_h:
"char *CSGIOread_" id " KC__P(( FILE *, " id "* ));
char *CSGIOwrite_" id " KC__P(( FILE *, " id " ));
"
					];

/***************************************************************************/

PhylumDeclarations( * )			-> [view_gen_csgio_start_c:
"/*LINTLIBRARY*/
/* translation of file(s)
"
(fnfiles)Thefnfiles
" */
/* generated by:
 *	" (charptr)kimwitu_copyright "
 */
#define KC_CSGIO
#define KIMW_CSGIO /* 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>
#include <setjmp.h>
#include <ctype.h>
#include <string.h>
#if ((! defined(KC_STDC) ) && defined(sun))
   extern char *sprintf();
#endif
#ifdef KC_STDC
# include <stdlib.h>
#else
  extern double atof (/* char* */);
#endif
#include \"k.h\"
#include \"csgiok.h\"
"
					];

PhylumDeclarations( pds )		-> [view_gen_csgio_c:
"/* macro's that do the string concatenation */
#define KC_MIdStr(s) s
#ifdef KC_STDC
# define KC_MStrConc(s1,s2) s1 ## s2
# define KC_MStrConc3(s1,s2,s3) s1 ## s2 ## s3
#else
# define KC_MStrConc(s1,s2) KC_MIdStr(s1)s2
# define KC_MStrConc3(s1,s2,s3) KC_MIdStr(KC_MIdStr(s1)s2)s3
#endif

#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 CALLOC
#  define CALLOC ecalloc
#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

/* kc_qsort_firstarg_t should be void* kc_voidptr_t, but sun's include files are dumb */
#ifndef KC_QSORT_FIRSTARG_T
typedef char *kc_qsort_firstarg_t;
#else
typedef KC_QSORT_FIRSTARG_T kc_qsort_firstarg_t;
#endif

/* macro that does the string concatenation */
#define kc_str_conc2(a,b) (char*)strcat(strcpy((char *) MALLOC((kc_size_t)(strlen(a) + strlen(b) +1)), a), b)

/* macro that does the field/son selection */
#ifndef KC_FIELD
#  define KC_FIELD(var,oper,subphy,subphynr,sonnr) (var->u.oper.KC_MStrConc3(subphy,_,subphynr))
#endif

/* macro that reads the integers */
#define kc_do_get_int(c,c_init,i,f)\\
  c = c_init;\\
  i = 0;\\
  while (isdigit(c)){\\
    i = (i*10) + (c-'0');\\
    c = getc(f);\\
  }

static char *kc_malloc_area = (char*)0;
static kc_size_t kc_sizeof_malloc_area = 0;
#define KC_GETMALLOCAREA(kc_s) (((kc_s) > kc_sizeof_malloc_area) ? kc_grow_malloc_area(kc_s) : kc_malloc_area)
static char *kc_grow_malloc_area
#ifdef KC_USE_PROTOTYPES
(kc_size_t kc_s)
#else
(kc_s) kc_size_t kc_s;
#endif
{
	if (kc_malloc_area != (char*)0) FREE((kc_voidptr_t)kc_malloc_area);
	kc_malloc_area = (char*)MALLOC(kc_s);
	kc_sizeof_malloc_area = kc_s;
	return kc_malloc_area;
}

typedef enum {
	KC_CSGIOSTATUS_NO_ERR = 0,
	KC_CSGIOSTATUS_SCAN_ERR_1, KC_CSGIOSTATUS_SCAN_ERR_2, KC_CSGIOSTATUS_SCAN_ERR_3, KC_CSGIOSTATUS_SCAN_ERR_4, KC_CSGIOSTATUS_SCAN_ERR_5,
	KC_CSGIOSTATUS_GRAM_INCONSISTENT, KC_CSGIOSTATUS_ROK, KC_CSGIOSTATUS_ILLEGAL_OPTION, KC_CSGIOSTATUS_TOO_MANY_OPERATORS,
	KC_CSGIOSTATUS_WOK, KC_CSGIOSTATUS_TXT_FILE_INPUT, KC_CSGIOSTATUS_SYNTAX_ERROR, KC_CSGIOSTATUS_ILLEGAL_CONTEXT, KC_CSGIOSTATUS_PREMATURE_EOF,
	KC_CSGIOSTATUS_UNEXP_FATHER_MARK
} KC_IO_STATUS;

typedef struct {
	KC_IO_STATUS io_status;
	char *err_reason;
	int line;
} KC_IO_RETURN;

/* global variables */
static jmp_buf kc_priv_env;
static char *kc_csgio_err_reason = \"\";
static int kc_no_external_ops;
#define KC_NOT_FOUND_OPERATOR -1
static int kc_file_offset_base;
static int kc_file_offset;

static boolean kc_CSGIOsharing =
#ifndef KC_CSGIO_NO_SHARING
	True
#else /* KC_CSGIO_NO_SHARING */
	False
#endif /* !KC_CSGIO_NO_SHARING */
	;
static kc_hashnode_t (*kc_mkhashnode)KC__P((YYSTYPE, kc_hashtable_t, kc_enum_phyla)) = 
#ifndef KC_CSGIO_NO_SHARING
	kc_mksharinghashnode
#else /* KC_CSGIO_NO_SHARING */
	kc_mknonsharinghashnode
#endif /* !KC_CSGIO_NO_SHARING */
	;
boolean kc_set_csgio_sharing
#ifdef KC_USE_PROTOTYPES
(boolean kc_i)
#else
(kc_i) boolean kc_i;
#endif
{	boolean kc_tmp = kc_CSGIOsharing;
	kc_CSGIOsharing =  kc_i;
	return kc_tmp;
}

/* Magic File descriptor(s) */
/* Magic descriptors of length up to KC_MAGIC_LENGTH-1 are supported. */
/* When changing KC_MAGIC_LENGTH. change constant in MAGIC_READ_FORMAT to be one less than KC_MAGIC_LENGTH. */
/* Every file is assumed to start with the magic file descriptor for asc_csg_v3 */

static char kc_ascii_prefix_magic_v3[] = \"A#S#C#S#S#L#V#3\";
#define KC_MAGIC_LENGTH 25
#define KC_MAGIC_READ_FORMAT \"%24s\\n\" 

/* Operators with names of length upto OP_LENGTH-1 are supported. */
/* When changing OP_LENGHTH, change constant in OP_READ_FOMAT to be one less */
#define KC_OP_LENGTH 256
#define KC_OP_READ_FORMAT \"%255s\\n\" 

/************************/
/* Error-string Routine */
/************************/

static char *kc_CSGIOerrorstring
#ifdef KC_USE_PROTOTYPES
(KC_IO_STATUS kc_io_status)
#else
(kc_io_status) KC_IO_STATUS kc_io_status;
#endif
{
	switch( (int)kc_io_status ) {
	case (int)KC_CSGIOSTATUS_NO_ERR: return( \"No errors\" );
	case (int)KC_CSGIOSTATUS_SCAN_ERR_1: return( \"Scan error(1)\" );
	case (int)KC_CSGIOSTATUS_SCAN_ERR_2: return( \"Scan error(2)\" );
	case (int)KC_CSGIOSTATUS_SCAN_ERR_3: return( \"Scan error(3)\" );
	case (int)KC_CSGIOSTATUS_SCAN_ERR_4: return( \"Scan error(4)\" );
	case (int)KC_CSGIOSTATUS_SCAN_ERR_5: return( \"Scan error(5)\" );
	case (int)KC_CSGIOSTATUS_GRAM_INCONSISTENT: return( \"Grammar is inconsistent\" );
	case (int)KC_CSGIOSTATUS_ROK: return( \"Read OK structure file\" );
	case (int)KC_CSGIOSTATUS_ILLEGAL_OPTION: return( \"Illegal option in write command\" );
	case (int)KC_CSGIOSTATUS_TOO_MANY_OPERATORS: return( \"Too many operators for binary format\" );
	case (int)KC_CSGIOSTATUS_WOK: return( \"Written OK\" );
	case (int)KC_CSGIOSTATUS_TXT_FILE_INPUT: return( \"Read OK Text-file\" );
	case (int)KC_CSGIOSTATUS_SYNTAX_ERROR: return( \"Syntax error\" );
	case (int)KC_CSGIOSTATUS_ILLEGAL_CONTEXT: return( \"Illegal context for operator\" );
	case (int)KC_CSGIOSTATUS_PREMATURE_EOF: return( \"Premature eof in file\" );
	case (int)KC_CSGIOSTATUS_UNEXP_FATHER_MARK: return( \"Unexpected FATHER MARKER\" );
	default: return( \"Unknown error code\" );
	}
}

static kc_hashtable_t kc_CSGIOhashtable;

/* Maps */
typedef struct {
	int left;
	int right;
} kc_OpToOpMap_tuple_t;

static kc_OpToOpMap_tuple_t kc_OpToOpMap[ KC_NO_OF_OPERATORS ];
#define KC_NOT_USED -1

static int kc_op_search
#ifdef KC_USE_PROTOTYPES
(char *kc_s)
#else
(kc_s) char *kc_s;
#endif
{
	int kc_i;
	for ( kc_i=0; kc_i < KC_NO_OF_OPERATORS; kc_i++ ) {
		if ( strcmp( kc_s, kc_OperatorInfo[kc_i].name ) == 0 ) return( kc_i );
	}
	return( KC_NOT_FOUND_OPERATOR );
}

static void kc_initializeOpToOpMap
#ifdef KC_USE_PROTOTYPES
(int kc_v)
#else
(kc_v) int kc_v;
#endif
{
	int kc_i;
	for ( kc_i=0; kc_i < KC_NO_OF_OPERATORS; kc_i++ ) {
		kc_OpToOpMap[kc_i].left = kc_i;
		kc_OpToOpMap[kc_i].right = kc_v;
}	}

static int kc_OpToOpMap_tuple_t_compare_right
#ifdef KC_USE_PROTOTYPES
(kc_constvoidptr_t kc_el1, kc_constvoidptr_t kc_el2)
#else
(kc_el1, kc_el2) kc_constvoidptr_t kc_el1, kc_el2;
#endif
{
	kc_OpToOpMap_tuple_t *kc_elt1 = (kc_OpToOpMap_tuple_t *)kc_el1;
	kc_OpToOpMap_tuple_t *kc_elt2 = (kc_OpToOpMap_tuple_t *)kc_el2;
	/* sort in DECREASING order */
	return (kc_elt2->right - kc_elt1->right);
}

static int kc_OpToOpMap_tuple_t_compare_left
#ifdef KC_USE_PROTOTYPES
(kc_constvoidptr_t kc_el1, kc_constvoidptr_t kc_el2)
#else
(kc_el1, kc_el2) kc_constvoidptr_t kc_el1, kc_el2;
#endif
{
	kc_OpToOpMap_tuple_t *kc_elt1 = (kc_OpToOpMap_tuple_t *)kc_el1;
	kc_OpToOpMap_tuple_t *kc_elt2 = (kc_OpToOpMap_tuple_t *)kc_el2;
	/* sort in INCREASING order */
	return (kc_elt1->left - kc_elt2->left);
}

static void kc_sort_rightOpToOpMap()
{
	qsort((kc_qsort_firstarg_t)kc_OpToOpMap, KC_NO_OF_OPERATORS, sizeof(kc_OpToOpMap_tuple_t), kc_OpToOpMap_tuple_t_compare_right);
}

static void kc_sort_leftOpToOpMap()
{
	qsort((kc_qsort_firstarg_t)kc_OpToOpMap, KC_NO_OF_OPERATORS, sizeof(kc_OpToOpMap_tuple_t), kc_OpToOpMap_tuple_t_compare_left);
}

static void kc_renumberOpToOpMap()
{
	int kc_i, kc_j = 0;
	for ( kc_i=0; kc_i < KC_NO_OF_OPERATORS; kc_i++ ) {
		if (kc_OpToOpMap[kc_i].right > 0) {
			kc_OpToOpMap[kc_i].right = kc_j++;
		} else {
			kc_OpToOpMap[kc_i].right = KC_NOT_USED;
}	}	}



#define KC_MAKE_NEW_MAPPING(ext_op,int_op) kc_OpToOpMap[ext_op].right = int_op;
#define KC_MAKE_NEW_SCAN_MAPPING(ext_op) kc_OpToOpMap[ext_op].right++;
#define KC_MAP(op) (kc_OpToOpMap[op].right)
#define KC_IS_MAPPED(op) (kc_OpToOpMap[op].right != KC_NOT_USED)
#define KC_OP_NAME(op) (kc_OperatorInfo[op].name)
#define KC_NO_SONS(prod) (kc_OperatorInfo[prod].no_sons)
#define KC_ATOMICITY(prod) (kc_OperatorInfo[prod].atomicity)

/*ARGSUSED*/
static void kc_error_operator_not_in_phylum
#ifdef KC_USE_PROTOTYPES
(int kc_op, char *kc_str1, char *kc_str2, int kc_phy, char *kc_fn, int kc_l)
#else
(kc_op, kc_str1, kc_str2, kc_phy, kc_fn, kc_l) int kc_op; char *kc_str1; char *kc_str2; int kc_phy; char *kc_fn; int kc_l;
#endif
{
	char *kc_error_message1 = \"operator not defined in phylum \";
	char *kc_error_message2 = \": \";
	if ((kc_op <= (int)kc_one_before_first_operator) || (kc_op >= (int)kc_last_operator)) {
		char kc_value[30];
		(void)sprintf(kc_value, \"%d\",kc_op);
		kc_csgio_err_reason = kc_str_conc2(\"unknown operator number: \",kc_value);
	} else {
		kc_csgio_err_reason = (char*)strcat(strcat(strcat(strcpy((char*)MALLOC((kc_size_t)(strlen(kc_error_message1)+strlen(kc_PhylumInfo[kc_phy].name)+strlen(kc_error_message2)+strlen(kc_OperatorInfo[kc_op].name)+1)), kc_error_message1), kc_PhylumInfo[kc_phy].name), kc_error_message2), kc_OperatorInfo[kc_op].name);
	}
	longjmp( kc_priv_env, (int)KC_CSGIOSTATUS_ILLEGAL_CONTEXT ); /*NOTREACHED*/
}

/* NEED to be extended */
static KC_IO_RETURN kc_io_return
#ifdef KC_USE_PROTOTYPES
(KC_IO_STATUS kc_status, char *kc_err_reason /*, int kc_line*/)
#else
(kc_status, kc_err_reason /*, kc_line*/ ) KC_IO_STATUS kc_status; char *kc_err_reason; /*int kc_line;*/
#endif
{
	KC_IO_RETURN kc_r;
	kc_r.io_status = kc_status;
	kc_r.err_reason = kc_err_reason;
	/*kc_r.line = kc_line;*/
	return(kc_r);
}

static char *kc_readKC_IO_RETURN2char
#ifdef KC_USE_PROTOTYPES
(KC_IO_RETURN kc_p)
#else
(kc_p) KC_IO_RETURN kc_p;
#endif
{
	char *kc_err_ret = (char *)0;
	char *kc_err_sep = \": \";
	if (kc_p.io_status != KC_CSGIOSTATUS_ROK) {
		char *kc_io_err = kc_CSGIOerrorstring(kc_p.io_status);
		kc_err_ret = (char *)MALLOC((kc_size_t)strlen(kc_io_err)+strlen(kc_err_sep)+strlen(kc_p.err_reason)+1);
		(void)strcpy(kc_err_ret, kc_io_err);
		(void)strcat(kc_err_ret, kc_err_sep);
		(void)strcat(kc_err_ret, kc_p.err_reason);
	}
	return kc_err_ret;
}

static char *kc_writeKC_IO_RETURN2char
#ifdef KC_USE_PROTOTYPES
(KC_IO_RETURN kc_p)
#else
(kc_p) KC_IO_RETURN kc_p;
#endif
{
	char *kc_err_ret = (char *)0;
	char *kc_err_sep = \": \";
	if (kc_p.io_status != KC_CSGIOSTATUS_WOK) {
		char *kc_io_err = kc_CSGIOerrorstring(kc_p.io_status);
		kc_err_ret = (char *)MALLOC((kc_size_t)strlen(kc_io_err)+strlen(kc_err_sep)+strlen(kc_p.err_reason)+1);
		(void)strcpy(kc_err_ret, kc_io_err);
		(void)strcat(kc_err_ret, kc_err_sep);
		(void)strcat(kc_err_ret, kc_p.err_reason);
	}
	return kc_err_ret;
}

/* Base 64 numbers are written with the digits:
   : ; < = > ? @ A-Z [ \\ ] ^ _ ` a-y
   Base 10 numbers are written with the ordinary digits 0-9.
   Other characters are used in special circumstances:
	! Indicates switch between reading attribute and unattributed nodes.
	# Indicates that the father is the next PROD_INSTANCE in the file.
	+ Indicates that the following bytes are not a base 64 number
	* Indicates a line containing a (decimal) count of attributes.
*/
#define KC_B64_ZERO_CHAR	':'
#define KC_IS_B64(c)	((unsigned)((c)-KC_B64_ZERO_CHAR)<64)
#define KC_ASCII_ZERO	'0'
#define KC_NON_B64_CHAR	'+'
#define KC_FATHER_MARKER	'#'
#define KC_SIX_BIT_MASK  0x3f

#ifndef KC_NO_CSGIO_READ

/* read and compute the base 64 integer in stream */
static unsigned get_rest_of_b64
#ifdef KC_USE_PROTOTYPES
(FILE *kc_stream, register int kc_read_char, char kc_trailing_char)
#else
(kc_stream, kc_read_char, kc_trailing_char) FILE *kc_stream; register int kc_read_char; char kc_trailing_char;
#endif
{
	unsigned kc_next_char;
	register int kc_offset;
	register int kc_i = 0;

	if (!KC_IS_B64(kc_read_char))
		longjmp(kc_priv_env, (int)KC_CSGIOSTATUS_SCAN_ERR_1);
	kc_offset = (int) kc_read_char - KC_B64_ZERO_CHAR;

	kc_next_char = (unsigned) getc(kc_stream);
	while(KC_IS_B64(kc_next_char)) {
		kc_offset += (int) ((kc_next_char - KC_B64_ZERO_CHAR) << (6 * (++kc_i)));
		kc_next_char = (unsigned) getc(kc_stream);
		}

	if (kc_next_char == '-') {
		kc_offset *= -1;
		kc_next_char = (unsigned) getc(kc_stream);
	}

	if (kc_next_char != (unsigned)kc_trailing_char)
		longjmp(kc_priv_env, (int)KC_CSGIOSTATUS_SCAN_ERR_1);
	return((unsigned) kc_offset);
}

/* read shared functions */
typedef enum { KC_NOT_READ_YET, KC_READ_EARLIER } KC_READ_STATUS;
/* variable used by the sharing routines during a read */
/* stores pointers to value_ptr fields */
static YYSTYPE *kc_offset_to_address_map;
static char* *kc_offset_to_address_map_base;

static void kc_init_read_sharing
#ifdef KC_USE_PROTOTYPES
(int kc_node_count, int kc_node_count_base)
#else
(kc_node_count, kc_node_count_base) int kc_node_count; int kc_node_count_base;
#endif
{
	kc_offset_to_address_map = (YYSTYPE *)CALLOC((kc_size_t)kc_node_count, (kc_size_t)sizeof(YYSTYPE));
	kc_file_offset = 0;
	kc_offset_to_address_map_base = (char* *)CALLOC((kc_size_t)kc_node_count_base, (kc_size_t)sizeof(char*));
	kc_file_offset_base = 0;
}

static KC_READ_STATUS kc_read_sharing_find
#ifdef KC_USE_PROTOTYPES
(FILE *kc_stream, YYSTYPE *kc_valptr)
#else
(kc_stream, kc_valptr) FILE *kc_stream; YYSTYPE *kc_valptr;
#endif
{	char kc_first_char;
	unsigned kc_offset;

	kc_first_char = getc(kc_stream);
	if (KC_IS_B64(kc_first_char)) {
		kc_offset = get_rest_of_b64(kc_stream, kc_first_char, '\\n');
		*kc_valptr = kc_offset_to_address_map[kc_file_offset - (int) kc_offset];
		return(KC_READ_EARLIER);
	} else {
		(void)ungetc(kc_first_char, kc_stream);
		return(KC_NOT_READ_YET);
}	}

static KC_READ_STATUS kc_read_sharing_find_base
#ifdef KC_USE_PROTOTYPES
(FILE *kc_stream, char **kc_valptr)
#else
(kc_stream, kc_valptr) FILE *kc_stream; char **kc_valptr;
#endif
{	char kc_first_char;
	unsigned kc_offset;

	kc_first_char = getc(kc_stream);
	if (KC_IS_B64(kc_first_char)) {
		kc_offset = get_rest_of_b64(kc_stream, kc_first_char, '\\n');
		*kc_valptr = kc_offset_to_address_map_base[kc_file_offset_base - (int) kc_offset];
		return(KC_READ_EARLIER);
	} else {
		return(KC_NOT_READ_YET);
}	}

#define kc_read_sharing_store(kc_ptr, kc_loc) \\
	kc_offset_to_address_map[kc_loc] = kc_ptr
#define kc_read_sharing_store_base(kc_ptr) \\
	kc_offset_to_address_map_base[kc_file_offset_base++] = kc_ptr


static void kc_end_read_sharing()
{
	FREE((kc_voidptr_t)kc_offset_to_address_map);
	FREE((kc_voidptr_t)kc_offset_to_address_map_base);
}

static void kc_CSGIOdo_read_atom_denotation
#ifdef KC_USE_PROTOTYPES
(FILE *kc_stream, char *kc_sbase, int kc_len)
#else
(kc_stream, kc_sbase, kc_len) FILE *kc_stream; char *kc_sbase; int kc_len;
#endif
{
	char * kc_sptr = kc_sbase;
	register int kc_ch, kc_ch1;
	register char kc_test;
	register int kc_i;

	for (kc_i=0; kc_i<kc_len; kc_i++, kc_sptr++) {
		kc_ch = getc(kc_stream);
		if (kc_ch == '\\n') {
			(void)ungetc(kc_ch, kc_stream);
			break;
		}
		*kc_sptr = (char) kc_ch;
		if ( kc_ch == '\\\\' ) {
			if ( ( kc_test = getc( kc_stream ) ) != '\\\\' ) { /* Must be escaped hex */
				if (isdigit(kc_test)) kc_ch1 = kc_test - '0'; else kc_ch1 =kc_test + 10 - 'a';
				kc_ch1 = 16 * kc_ch1;
				kc_test = getc(kc_stream);
				if (isdigit(kc_test)) kc_test= kc_test - '0'; else kc_test=kc_test + 10 - 'a';
				kc_ch1 = kc_ch1 + kc_test;
				*kc_sptr = (char)kc_ch1; /* cast is for explicit narrowing from int to char */
			}
		}
	}

	kc_ch = getc(kc_stream);
	if ( kc_ch == EOF ) longjmp( kc_priv_env, (int)KC_CSGIOSTATUS_PREMATURE_EOF );
	else if (kc_ch != '\\n') longjmp( kc_priv_env, (int)KC_CSGIOSTATUS_SCAN_ERR_1 );

	*kc_sptr = '\\000';
}

static float kc_ator
#ifdef KC_USE_PROTOTYPES
(char *kc_s)
#else
(kc_s) char *kc_s;
#endif
{
	/* HACK!! WARNING!!
	 * (as diagnosed by the visual c++ 5.0 compiler, when compiled as c++ code:
	 *  conversion from 'double ' to 'float ', possible loss of data
	 */
	return (float)atof( kc_s );
}

static YYSTYPE kc_CSGIOread2dft
#ifdef KC_USE_PROTOTYPES
(FILE *kc_stream, kc_enum_phyla kc_phylum)
#else
(kc_stream, kc_phylum) FILE *kc_stream; kc_enum_phyla kc_phylum;
#endif
{
	char *kc_sbase;
	int kc_len;
	int kc_delim;
	YYSTYPE kc_answer;
	int kc_location;
	boolean kc_not_read_yet = False;

/* get operator */
	int kc_op;
	int kc_ext_op;
	int kc_testing;
	int kc_version_no;

	/* scan for optional unparsing version number */
	if (kc_read_sharing_find( kc_stream, &kc_answer ) == KC_READ_EARLIER ) {
		switch((int)kc_phylum) {
		case (int)kc_phylum_int:
			kc_answer.yt_int = copy_int( kc_answer.yt_int, False );
			break;
		case (int)kc_phylum_float:
			kc_answer.yt_float = copy_float( kc_answer.yt_float, False );
			break;
		default:
			kc_answer.yt_voidptr = kc_do_copy_phylum( (kc_voidptr_t)kc_answer.yt_voidptr, False, kc_phylum );
		}
		return kc_answer;
	}
	kc_do_get_int(kc_testing,getc(kc_stream),kc_ext_op,kc_stream);
	if ( kc_testing == EOF )
		longjmp( kc_priv_env, (int)KC_CSGIOSTATUS_SCAN_ERR_1 );
	if ( kc_testing == '(' ) {
		char kc_testchar;
		if ( fscanf( kc_stream, \"%d)%c\", &kc_version_no, &kc_testchar ) != 2 )
			longjmp( kc_priv_env, (int)KC_CSGIOSTATUS_SCAN_ERR_1 );
		else kc_testing = kc_testchar; /* unnecessary? */
	}
	if ( kc_testing == KC_FATHER_MARKER )
		longjmp( kc_priv_env, (int)KC_CSGIOSTATUS_UNEXP_FATHER_MARK );
	if ( kc_testing != '\\n' )
		longjmp( kc_priv_env, (int)KC_CSGIOSTATUS_SCAN_ERR_1 );
	kc_op = KC_MAP( kc_ext_op );
/* end get operator */

	/*SUPPRESS 622*/
	assertOperatorInPhylumFn(kc_op, \"kc_op\", \"\", kc_phylum, kc_error_operator_not_in_phylum);
	kc_location = kc_file_offset++;
	switch( (int)kc_op ) {
	case (int)sel__VoidPtr:
		/* FATAL ERROR */
		kc_do_get_int(kc_delim,getc(kc_stream),kc_len,kc_stream);
		if ( kc_delim == EOF )
			longjmp(kc_priv_env, (int)KC_CSGIOSTATUS_SCAN_ERR_1);
		kc_sbase = (char *) KC_GETMALLOCAREA((kc_size_t)(kc_len + 1)); /* +1 for '\\0' */
		kc_CSGIOdo_read_atom_denotation(kc_stream, kc_sbase, kc_len);
		kc_answer.yt_voidptr = 0;
		break;
	case (int)sel__Int:
		kc_do_get_int(kc_delim,getc(kc_stream),kc_len,kc_stream);
		if ( kc_delim == EOF )
			longjmp(kc_priv_env, (int)KC_CSGIOSTATUS_SCAN_ERR_1);
		kc_sbase = (char *) KC_GETMALLOCAREA((kc_size_t)(kc_len + 1)); /* +1 for '\\0' */
		kc_CSGIOdo_read_atom_denotation(kc_stream, kc_sbase, kc_len);
		kc_answer.yt_int = atoi( kc_sbase );
		break;
	case (int)sel__Real:
		kc_do_get_int(kc_delim,getc(kc_stream),kc_len,kc_stream);
		if ( kc_delim == EOF )
			longjmp(kc_priv_env, (int)KC_CSGIOSTATUS_SCAN_ERR_1);
		kc_sbase = (char *) KC_GETMALLOCAREA((kc_size_t)(kc_len + 1)); /* +1 for '\\0' */
		kc_CSGIOdo_read_atom_denotation(kc_stream, kc_sbase, kc_len);
		kc_answer.yt_float = kc_ator( kc_sbase );
		break;
	case (int)sel__Str:
		if (kc_read_sharing_find_base( kc_stream, &kc_sbase ) == KC_NOT_READ_YET) {
			kc_not_read_yet = True;
			kc_do_get_int(kc_delim,getc(kc_stream),kc_len,kc_stream);
			if ( kc_delim == EOF )
				longjmp(kc_priv_env, (int)KC_CSGIOSTATUS_SCAN_ERR_1);
			kc_sbase = (char *) KC_GETMALLOCAREA((kc_size_t)(kc_len + 1)); /* +1 for '\\0' */
			kc_CSGIOdo_read_atom_denotation(kc_stream, kc_sbase, kc_len);
		}
		kc_answer.yt_casestring = mkcasestring( kc_sbase );
		if (kc_not_read_yet) {
			kc_read_sharing_store_base( kc_answer.yt_casestring->name );
		}
		break;
	case (int)sel_NoCaseStr:
		if (kc_read_sharing_find_base( kc_stream, &kc_sbase ) == KC_NOT_READ_YET) {
			kc_not_read_yet = True;
			kc_do_get_int(kc_delim,getc(kc_stream),kc_len,kc_stream);
			if ( kc_delim == EOF )
				longjmp(kc_priv_env, (int)KC_CSGIOSTATUS_SCAN_ERR_1);
			kc_sbase = (char *) KC_GETMALLOCAREA((kc_size_t)(kc_len + 1)); /* +1 for '\\0' */
			kc_CSGIOdo_read_atom_denotation(kc_stream, kc_sbase, kc_len);
		}
		kc_answer.yt_nocasestring = mknocasestring( kc_sbase );
		if (kc_not_read_yet) {
			kc_read_sharing_store_base( kc_answer.yt_nocasestring->name );
		}
		break;
	default: {
		YYSTYPE kc_subtmp["
	${ { int i = last_argsnumbers( Theargsnumbers ); if (i<=0) i = 1; } (int)i $}
"];
		int kc_i;
		for (kc_i = 0; kc_i < kc_OperatorInfo[kc_op].no_sons; kc_i++) {
			kc_subtmp[kc_i] = kc_CSGIOread2dft(kc_stream, kc_OperatorInfo[kc_op].subphylum[kc_i] );
		}
"
{ if (cg_bigatomoperators && length_operators(cg_bigatomoperators) > 0) } ${
"		switch(kc_op) {
"
     (operators)cg_bigatomoperators
"		default:
"
  $}
"		switch(kc_OperatorInfo[kc_op].no_sons) {
"
	(argsnumbers)Theargsnumbers
"		default:
			/*SUPPRESS 622*/
			assertReason(kc_zero_constant, \"unexpected number of sub-phyla\"); break;
		}
"
{ if (cg_bigatomoperators && length_operators(cg_bigatomoperators) > 0) } ${
"		break;
		}
"
  $}
"	}}
	kc_read_sharing_store( kc_answer, kc_location );
	return kc_answer;
}

static KC_IO_RETURN kc_CSGIOreadphylum
#ifdef KC_USE_PROTOTYPES
(FILE *kc_stream, YYSTYPE *kc_ptr, kc_enum_phyla kc_phylum)
#else
(kc_stream, kc_ptr, kc_phylum) FILE *kc_stream; YYSTYPE *kc_ptr; kc_enum_phyla kc_phylum;
#endif
{	KC_IO_STATUS kc_answer;
	int kc_scan_return_code;
	char kc_magic_no[KC_MAGIC_LENGTH];
	char kc_dollarcode[KC_OP_LENGTH];
	char kc_ext_name[KC_OP_LENGTH];
	int kc_operator, kc_node_count, kc_node_count_base;

	kc_csgio_err_reason = \"\";
	kc_scan_return_code = fscanf( kc_stream, KC_MAGIC_READ_FORMAT, kc_magic_no );
	if ( kc_scan_return_code != 1 )
		return( kc_io_return(KC_CSGIOSTATUS_GRAM_INCONSISTENT, \"magic string not scanned\") );
	if ( strcmp( kc_magic_no, kc_ascii_prefix_magic_v3 ) != 0 )
		return( kc_io_return(KC_CSGIOSTATUS_GRAM_INCONSISTENT,\"scanned magic string is not asc_ssl_v3 magic string\") );
	if ( fscanf( kc_stream, \"$%[^ ] \\n\", kc_dollarcode ) != 1 )
		return( kc_io_return(KC_CSGIOSTATUS_GRAM_INCONSISTENT,\"problems finding $ before operators\") );
	while ( strcmp( kc_dollarcode, \"operators\" ) != 0 ) {
		if ( fscanf( kc_stream, \"%*[^$]$%[^ ] \\n\", kc_dollarcode) != 1 )
			return( kc_io_return(KC_CSGIOSTATUS_GRAM_INCONSISTENT,\"problems finding operators keyword\") );
	}
	/* read all external operator definitions and initialize map */
	kc_no_external_ops = 0;
	kc_initializeOpToOpMap(KC_NOT_FOUND_OPERATOR);
	while ( ! kc_zero_constant ) {
		int kc_ext_arity, kc_ext_attr_arity, kc_ext_atomicity;

		if ( fscanf( kc_stream, \"%[^ ] \", kc_ext_name ) != 1 )
			return( kc_io_return(KC_CSGIOSTATUS_SCAN_ERR_3, \"no operator name at start of line\") );
		else if ( kc_ext_name[0] == '$' )
			break;
		else if ( fscanf( kc_stream, \"%d %d %d\\n\", &kc_ext_arity, &kc_ext_attr_arity, &kc_ext_atomicity ) != 3 )
			return( kc_io_return(KC_CSGIOSTATUS_SCAN_ERR_4, \"no arity, attr_arity or atomicity\") );
		else {
			kc_operator = kc_op_search( kc_ext_name );
			if ( ( kc_operator == KC_NOT_FOUND_OPERATOR ) ||
				 ( KC_NO_SONS( kc_operator ) != kc_ext_arity ) ||
				 ( KC_ATOMICITY( kc_operator) != kc_ext_atomicity )
			   )
				return( kc_io_return(KC_CSGIOSTATUS_GRAM_INCONSISTENT, kc_str_conc2(\"problems with operator: \",kc_ext_name)) );
			else {
				KC_MAKE_NEW_MAPPING( kc_no_external_ops, kc_operator );
				kc_no_external_ops++;
	}	}	}
	kc_answer = (KC_IO_STATUS) setjmp( kc_priv_env );
	if ( kc_answer != KC_CSGIOSTATUS_NO_ERR )
		/* longjmp was called if we get here */
		return( kc_io_return(kc_answer, kc_csgio_err_reason));
	else {
		/* ascertain that we are at the $object section, or get to that point */
		if ( strcmp( kc_ext_name, \"$object\" ) != 0 ) /* if not at $object */
			while ( strcmp( kc_ext_name, \"object\" ) != 0 ) {
				if ( fscanf( kc_stream, \"%*[^$]$%[^ ]\", kc_ext_name ) != 1 )
					return( kc_io_return(KC_CSGIOSTATUS_GRAM_INCONSISTENT, kc_str_conc2(\"problems finding start of object section\",\"\")) );
			}

		/* read node_count; set up address map */
		if (fscanf(kc_stream, \"%d %d\\n\", &kc_node_count, &kc_node_count_base) != 2)
			longjmp(kc_priv_env, (int)KC_CSGIOSTATUS_SCAN_ERR_1);
		kc_init_read_sharing(kc_node_count, kc_node_count_base); /* for shared values */

		/* read the tree (actually a graph) */
		*kc_ptr = kc_CSGIOread2dft( kc_stream, kc_phylum );
		kc_end_read_sharing(); /* for atomic values */

		kc_answer = KC_CSGIOSTATUS_ROK;
	}
	return( kc_io_return(kc_answer, \"\") );
}

"
	pds:view_gen_csgio_c_read
"#endif /* ! KC_NO_CSGIO_READ */

#ifndef KC_NO_CSGIO_WRITE
static int kc_node_count;
static int kc_node_count_base;

static void kc_print_to_file
#ifdef KC_USE_PROTOTYPES
(FILE *kc_f, char *kc_value)
#else
(kc_f, kc_value) FILE *kc_f; char *kc_value;
#endif
{	register unsigned char *kc_vptr = (unsigned char*)kc_value;
	register int kc_len = strlen(kc_value);
	register int kc_i;
	static char kc_hex_digit[] = \"0123456789abcdef\";

	(void)fprintf(kc_f, \"%d \", kc_len);
	for (kc_i=0; kc_i<kc_len; kc_i++, kc_vptr++) {
		if (*kc_vptr == '\\\\') {
			(void)fprintf(kc_f, \"\\\\\\\\\");
		} else if (isprint(*kc_vptr)) {
			(void)putc((char)*kc_vptr, kc_f);
		} else {
			(void)fprintf(kc_f, \"\\\\%c%c\", kc_hex_digit[*kc_vptr / 16], kc_hex_digit[*kc_vptr % 16]);
		}
	}
	(void)putc('\\n', kc_f);
/**** very dirty, i think *************
	(void)putc('\\0', kc_f);
	(kc_f->_ptr)--;
	kc_f->_cnt++;
 *****************************/
}

static void kc_print_b64_to_file
#ifdef KC_USE_PROTOTYPES
(FILE *kc_f, int kc_value)
#else
(kc_f, kc_value) FILE *kc_f; int kc_value;
#endif
{	unsigned int kc_pos_value;	

	if (kc_value == 0) {
		(void)putc(KC_B64_ZERO_CHAR, kc_f);
	} else {
		kc_pos_value = abs(kc_value);
        	while (kc_pos_value != 0) {
			(void)putc((int)((kc_pos_value & KC_SIX_BIT_MASK) + KC_B64_ZERO_CHAR), kc_f);
			kc_pos_value >>= 6;
		}
		if (kc_value < 0) {
			(void)putc('-', kc_f);
		}
	}
	(void)putc('\\n', kc_f);
}

"
(phyla)cg_bigatomphyla:view_gen_csgio_scandefs_c
"static void kc_CSGIOscan
#ifdef KC_USE_PROTOTYPES
(FILE *kc_stream, kc_voidptr_t kc_p, kc_enum_phyla kc_phylum)
#else
(kc_stream, kc_p, kc_phylum) FILE *kc_stream; kc_voidptr_t kc_p; kc_enum_phyla kc_phylum;
#endif
{	int kc_i;
	kc_enum_operators kc_prodsel;
	kc_hashnode_t kc_hn;
	YYSTYPE kc_yt;
"
(phyla)cg_bigatomphyla:view_gen_csgio_scandef_c
"	/*SUPPRESS 622*/
	assertPhylum(((casestring)kc_p),\"kc_p\",kc_phylum);
	kc_prodsel = (kc_phylum == kc_phylum_voidptr ? sel__VoidPtr :
                     ((casestring)kc_p)->prod_sel);
	kc_yt.yt_voidptr = kc_p;
	kc_hn = (*kc_mkhashnode)(kc_yt, kc_CSGIOhashtable, kc_phylum);
	if (kc_hn->number == -1) {
		kc_hn->number = kc_node_count++;
		KC_MAKE_NEW_SCAN_MAPPING( (int)kc_prodsel );
		switch((int)kc_prodsel) {
		case (int)sel__VoidPtr:
			break;
		case (int)sel__Str:
		case (int)sel_NoCaseStr:
			kc_yt.yt_voidptr = (kc_voidptr_t)((casestring)kc_p)->name;
			kc_hn = (*kc_mkhashnode)( kc_yt, kc_CSGIOhashtable, kc_phylum_voidptr);
			if (kc_hn->number == -1) {
				kc_hn->number = kc_node_count_base++;
			}
			break;
"
{ if (cg_bigatomoperators && length_operators(cg_bigatomoperators) > 0) } ${
     (operators)cg_bigatomoperators:view_gen_csgio_scandef_c
  $}
"		default:
			for (kc_i=0; kc_i < kc_OperatorInfo[(int)kc_prodsel].no_sons; kc_i++) {
				kc_CSGIOscan( kc_stream, (kc_voidptr_t)KC_SUBPHYLUM(kc_p, kc_OperatorInfo[(int)kc_prodsel].suboffset[kc_i]), kc_OperatorInfo[(int)kc_prodsel].subphylum[kc_i] );
}	}	}	}

"
(phyla)cg_bigatomphyla:view_gen_csgio_write2structuredefs_c
"static void kc_CSGIOwrite2structure
#ifdef KC_USE_PROTOTYPES
(FILE *kc_stream, kc_voidptr_t kc_p, kc_enum_phyla kc_phylum)
#else
(kc_stream, kc_p, kc_phylum) FILE *kc_stream; kc_voidptr_t kc_p; kc_enum_phyla kc_phylum;
#endif
{	int kc_i;
	kc_enum_operators kc_prodsel;
	kc_hashnode_t kc_hn;
	YYSTYPE kc_yt;
"
(phyla)cg_bigatomphyla:view_gen_csgio_write2structuredef_c
"	/*SUPPRESS 622*/
	assertPhylum(((casestring)kc_p),\"kc_p\",kc_phylum);
	kc_prodsel = (kc_phylum == kc_phylum_voidptr ? sel__VoidPtr :
                     ((casestring)kc_p)->prod_sel);
	kc_yt.yt_voidptr = kc_p;
	kc_hn = (*kc_mkhashnode)(kc_yt, kc_CSGIOhashtable, kc_phylum);
	if (kc_hn->created) {
		kc_print_b64_to_file( kc_stream, kc_file_offset - kc_hn->number );
	} else {
		kc_hn->created = True;
		(void)fprintf( kc_stream, \"%d\\n\", KC_MAP( (int)kc_prodsel ) );
		kc_file_offset++;
		switch((int)kc_prodsel) {
		case (int)sel__VoidPtr: {
			/* FATAL ERROR */
			char kc_value[30];
			(void)sprintf( kc_value, \"%p\", kc_p);
			kc_print_to_file( kc_stream, kc_value );
			break; }
		case (int)sel__Str:
		case (int)sel_NoCaseStr:
			kc_yt.yt_voidptr = (kc_voidptr_t) ((casestring)kc_p)->name;
			kc_hn = (*kc_mkhashnode)(kc_yt, kc_CSGIOhashtable, kc_phylum_voidptr);
			if (kc_hn->created) {
				kc_print_b64_to_file( kc_stream, kc_file_offset_base - kc_hn->number );
			} else {
				kc_hn->created = True;
				(void)fprintf( kc_stream, \"%c\", KC_NON_B64_CHAR );
				kc_print_to_file( kc_stream, ((casestring)kc_p)->name );
				kc_file_offset_base++;
			}
			break;
"
{ if (cg_bigatomoperators && length_operators(cg_bigatomoperators) > 0) } ${
     (operators)cg_bigatomoperators:view_gen_csgio_write2structuredef_c
  $}
"		default:
			for (kc_i=0; kc_i < kc_OperatorInfo[(int)kc_prodsel].no_sons; kc_i++) {
				kc_CSGIOwrite2structure( kc_stream, (kc_voidptr_t)KC_SUBPHYLUM(kc_p, kc_OperatorInfo[(int)kc_prodsel].suboffset[kc_i]), kc_OperatorInfo[(int)kc_prodsel].subphylum[kc_i] );
}	}	}	}

static int kc_CSGIO_hashtablesize = 5000;
int kc_set_csgio_hashtablesize
#ifdef KC_USE_PROTOTYPES
(int kc_i)
#else
(kc_i) int kc_i;
#endif
{	int kc_tmp = kc_CSGIO_hashtablesize;
	kc_CSGIO_hashtablesize =  kc_i;
	return kc_tmp;
}

static KC_IO_RETURN kc_CSGIOwritephylum
#ifdef KC_USE_PROTOTYPES
(FILE *kc_stream, YYSTYPE kc_p, kc_enum_phyla kc_phylum)
#else
(kc_stream, kc_p, kc_phylum) FILE *kc_stream; YYSTYPE kc_p; kc_enum_phyla kc_phylum;
#endif
{	int kc_i;
	kc_hashnode_t (*kc_old_mkhashnode)KC__P((YYSTYPE, kc_hashtable_t, kc_enum_phyla)) = kc_mkhashnode;

	kc_csgio_err_reason = \"\";

	if (kc_CSGIOsharing) {
		kc_CSGIOhashtable = kc_ht_create_simple(kc_CSGIO_hashtablesize);
		kc_mkhashnode = kc_mksharinghashnode;
	} else {
		kc_mkhashnode = kc_mknonsharinghashnode;
	}

	/* write out the magic string and $operators string */
	(void)fprintf( kc_stream, \"%s\\n$operators \\n\", kc_ascii_prefix_magic_v3 );

	/* Initialize map from internal operators to external operators, */
	/* initially empty */
	kc_no_external_ops = 0;
	kc_node_count = 0;
	kc_node_count_base = 0;
	kc_initializeOpToOpMap(0); /* initialize to 0, not an other value */

	/* write out grammar and compute OpToOpMap[] */
"
{ if (cg_bigatomphyla && length_phyla(cg_bigatomphyla) > 0) } ${
"	switch(kc_phylum) {
"
     (phyla)cg_bigatomphyla:view_gen_csgio_writephylumdef_scan_c
"	default:
"
  $}
"	kc_CSGIOscan( kc_stream, kc_p.yt_voidptr, kc_phylum );
"
{ if (cg_bigatomphyla && length_phyla(cg_bigatomphyla) > 0) } ${
"	}
"
  $}
"	/* sort the optoopmap on decreasing operator usage */
	kc_sort_rightOpToOpMap();
	kc_renumberOpToOpMap();
	
	/* write out the _sorted_ operator table */
	for(kc_i = 0; kc_i < KC_NO_OF_OPERATORS; kc_i++) {
		if (kc_OpToOpMap[kc_i].right != KC_NOT_USED) {
			(void)fprintf( kc_stream, \"%s %d %d %d\\n\", KC_OP_NAME( kc_OpToOpMap[kc_i].left), KC_NO_SONS( kc_OpToOpMap[kc_i].left ), 0, KC_ATOMICITY( kc_OpToOpMap[kc_i].left ) );
	}	}

	/* sort the optoopmap increasing on the operator number */
	kc_sort_leftOpToOpMap();

	/* write out the grammar terminator string and the number of nodes */
	(void)fprintf( kc_stream, \"$object \\n%d %d\\n\", kc_node_count, kc_node_count_base );

	/* write out the tree */
	kc_file_offset = 0;
	kc_file_offset_base = 0;
"
{ if (cg_bigatomphyla && length_phyla(cg_bigatomphyla) > 0) } ${
"	switch(kc_phylum) {
"
     (phyla)cg_bigatomphyla:view_gen_csgio_writephylumdef_write_c
"	default:
"
  $}
"	kc_CSGIOwrite2structure( kc_stream, kc_p.yt_voidptr, kc_phylum );
"
{ if (cg_bigatomphyla && length_phyla(cg_bigatomphyla) > 0) } ${
"	}
"
  $}
"
	if (kc_CSGIOsharing) {
		kc_ht_delete(kc_CSGIOhashtable);
	}
	kc_mkhashnode = kc_old_mkhashnode;

	return( kc_io_return(KC_CSGIOSTATUS_WOK, kc_csgio_err_reason) );
}

"
	pds:view_gen_csgio_c_write
"#endif /* ! KC_NO_CSGIO_WRITE */

"
				];
Consphylumdeclarations( pd, rpds )	-> [view_gen_csgio_c_read view_gen_csgio_c_write: 
	rpds
	pd
					   ];
Nilphylumdeclarations()			-> [view_gen_csgio_c_read view_gen_csgio_c_write: {/*EMPTY*/} ];
PhylumDeclaration( *, *, Emptyproductionblock(), * )
					-> [view_gen_csgio_c_read view_gen_csgio_c_write: {/*EMPTY*/} ];
PhylumDeclaration( id, *, PredefinedAlternatives( * ), * )
					-> [view_gen_csgio_c_read:
"char *CSGIOread_" id "
#ifdef KC_USE_PROTOTYPES
(FILE *kc_stream, " id " *kc_p )
#else
(kc_stream, kc_p) FILE *kc_stream; " id " *kc_p;
#endif
{	YYSTYPE kc_value;
	char *kc_answer = kc_readKC_IO_RETURN2char( kc_CSGIOreadphylum( kc_stream, &kc_value, kc_phylum_" id " ));
	*kc_p = kc_value.yt_" id ";
	return kc_answer;
}
"
					];
PhylumDeclaration( id, *, ListAlternatives( *, * ), * ),
PhylumDeclaration( id, *, NonlistAlternatives( * ), * )
					-> [view_gen_csgio_c_read:
"char *CSGIOread_" id "
#ifdef KC_USE_PROTOTYPES
(FILE *kc_stream, " id " *kc_p )
#else
(kc_stream, kc_p) FILE *kc_stream; " id " *kc_p;
#endif
{	YYSTYPE kc_value;
	char *kc_answer = kc_readKC_IO_RETURN2char( kc_CSGIOreadphylum( kc_stream, &kc_value, kc_phylum_" id " ));
	*kc_p = kc_value.yt_" id ";
	return kc_answer;
}
"
					];
PhylumDeclaration( id, *, ListAlternatives( *, * ), * ),
PhylumDeclaration( id, *, PredefinedAlternatives( * ), * ),
PhylumDeclaration( id, *, NonlistAlternatives( * ), * )
					-> [view_gen_csgio_c_write:
"char *CSGIOwrite_" id "
#ifdef KC_USE_PROTOTYPES
(FILE *kc_stream, " id " kc_p )
#else
(kc_stream, kc_p) FILE *kc_stream; " id " kc_p;
#endif
{ 	YYSTYPE kc_y; kc_y.yt_" id " = kc_p;
	return kc_writeKC_IO_RETURN2char( kc_CSGIOwritephylum( kc_stream, kc_y, kc_phylum_" id " ));
}
"
					];
Nilargsnumbers()			-> [view_gen_csgio_c: {/*EMPTY*/} ];
Consargsnumbers( i, r )			-> [view_gen_csgio_c:
"		case " i ": kc_answer.yt_voidptr = (kc_voidptr_t) (*kc_OperatorInfo[kc_op].create_routine)("
" (kc_enum_operators)kc_op"
    { if (i > 0) } ${
  ","
    $}
	${ { int j; for (j=0; j<i; j++ ) } ${
" kc_subtmp[" (int)j "].yt_voidptr"
	{		if ( j < i-1 ) }
","
	{		else }
" "
	$}                              $}
"); break;
"
	r
					];

Niloperators()				-> [view_gen_csgio_c: {/*EMPTY*/} ];
Consoperators( a_op, r_op )		-> [view_gen_csgio_c:
{ arguments args; ID phy; }
 r_op
{ args = f_argumentsofoperator( a_op );
  phy = f_phylumofoperator( a_op );
  if (length_arguments(args) > 0) ${
}
"		case (int)sel_" (ID)a_op ": {
			kc_answer.yt_" (ID)phy " = " (ID)a_op "("
   (arguments)args:view_gen_csgio_bigatom_arguse_c
");
		break; }
"
{  $} }
					];

Nilarguments()				-> [view_gen_csgio_bigatom_arguse_c: { gl_j = 0; } ];
Consarguments( *, r_args )		-> [view_gen_csgio_bigatom_arguse_c:
	r_args
	","
	$0:view_gen_csgio_bigatom_do_arguse_c
					];
Consarguments( *, Nilarguments() )	-> [view_gen_csgio_bigatom_arguse_c:
{ gl_j = 0; }
	$0:view_gen_csgio_bigatom_do_arguse_c
					];
Consarguments( a_arg, * )		-> [view_gen_csgio_bigatom_do_arguse_c:
" kc_subtmp[" (int)gl_j "].yt_" a_arg
{ gl_j++; }
					];

Nilphyla()				-> [view_gen_csgio_scandef_c: {/*EMPTY*/} ];
Consphyla( a_phy, r_phy )		-> [view_gen_csgio_scandef_c:
 r_phy
"	/*SUPPRESS 622*/
	assertReason(kc_phylum != kc_phylum_" a_phy ", \"kc_CSGIOscan called with kc_phylum_" a_phy " argument\");
"
					];
Nilphyla()				-> [view_gen_csgio_scandefs_c: {/*EMPTY*/} ];
Consphyla( a_phy, r_phy )		-> [view_gen_csgio_scandefs_c:
{ ID oper = f_operatorofphylum(a_phy, Int(1)); }
 r_phy
"/*ARGSUSED*/
static void kc_CSGIOscan_" a_phy "
#ifdef KC_USE_PROTOTYPES
(FILE *kc_stream, " a_phy " kc_p)
#else
(kc_stream, kc_p) FILE *kc_stream; " a_phy " kc_p;
#endif
{	kc_hashnode_t kc_hn;
	YYSTYPE kc_yt;
	/*SUPPRESS 622*/
	assert_" a_phy "(kc_p,\"kc_p\");
	kc_yt.yt_" a_phy " = kc_p;
	kc_hn = (*kc_mkhashnode)(kc_yt, kc_CSGIOhashtable, kc_phylum_" a_phy ");
	if (kc_hn->number == -1) {
		kc_hn->number = kc_node_count++;
		KC_MAKE_NEW_SCAN_MAPPING( (int)sel_" (ID)oper " );
}	}
"					];
Niloperators()				-> [view_gen_csgio_scandef_c: {/*EMPTY*/} ];
Consoperators( a_op, r_op )		-> [view_gen_csgio_scandef_c:
{ arguments args; }
 r_op
{ args = f_argumentsofoperator( a_op );
  gl_operator = a_op;
  gl_phylum = f_phylumofoperator( a_op );
  if (length_arguments(args) > 0) ${
}
"			case (int)sel_" (ID)a_op ": {
"
   (arguments)args:view_gen_csgio_scandef_bigatom_c
"			break; }
"
{  $}
  gl_operator = 0;
  gl_phylum = 0;
}
					];
Nilarguments()				-> [view_gen_csgio_scandef_bigatom_c: {/*EMPTY*/} ];
Consarguments( *, r_args )		-> [view_gen_csgio_scandef_bigatom_c:
	r_args
	$0:view_gen_csgio_scandef_bigatom_do_c
					];
Consarguments( *, Nilarguments() )	-> [view_gen_csgio_scandef_bigatom_c:
	$0:view_gen_csgio_scandef_bigatom_do_c
					];
Consarguments( a_arg, * )	-> [view_gen_csgio_scandef_bigatom_do_c:
{ if (f_isbigatom( a_arg )) } ${
"				kc_CSGIOscan_" a_arg "( kc_stream, ((" (ID)gl_phylum ")kc_p)->u." (ID)gl_operator "." a_arg "_" $0->seqnr ");
"
  $} { else } ${
"				kc_CSGIOscan(kc_stream, (kc_voidptr_t)((" (ID)gl_phylum ")kc_p)->u." (ID)gl_operator "." a_arg "_" $0->seqnr ", kc_phylum_" a_arg " );
"
  $}
					];
Nilphyla()				-> [view_gen_csgio_write2structuredefs_c: {/*EMPTY*/} ];
Consphyla( a_phy, r_phy )		-> [view_gen_csgio_write2structuredefs_c:
{ ID oper = f_operatorofphylum(a_phy, Int(1)); }
 r_phy
"static void kc_CSGIOwrite2structure_" a_phy "
#ifdef KC_USE_PROTOTYPES
(FILE *kc_stream, " a_phy " kc_p)
#else
(kc_stream, kc_p) FILE *kc_stream; " a_phy " kc_p;
#endif
{	kc_hashnode_t kc_hn;
	YYSTYPE kc_yt;
	/*SUPPRESS 622*/
	assert_" a_phy "(kc_p,\"kc_p\");
	kc_yt.yt_" a_phy " = kc_p;
	kc_hn = (*kc_mkhashnode)(kc_yt, kc_CSGIOhashtable, kc_phylum_" a_phy ");
	if (kc_hn->created) {
		kc_print_b64_to_file( kc_stream, kc_file_offset - kc_hn->number );
	} else {
		kc_hn->created = True;
		(void)fprintf( kc_stream, \"%d\\n\", KC_MAP( (int)sel_" (ID)oper " ) );
		kc_file_offset++;
"
{ if (strcmp(f_strofID( a_phy), "int")==0) } ${
"		{	char kc_value[30];
			(void)sprintf( kc_value, \"%d\", kc_p);
			kc_print_to_file( kc_stream, kc_value );
		}
"
 $} {else} ${
"		{	char kc_value[30];
			(void)sprintf( kc_value, \"%f\", kc_p);
			kc_print_to_file( kc_stream, kc_value );
		}
"
 $}
"}	}
"					];
Nilphyla()				-> [view_gen_csgio_write2structuredef_c: {/*EMPTY*/} ];
Consphyla( a_phy, r_phy )		-> [view_gen_csgio_write2structuredef_c:
 r_phy
"	/*SUPPRESS 622*/
	assertReason(kc_phylum != kc_phylum_" a_phy ", \"kc_CSGIOwrite2structure called with kc_phylum_" a_phy " argument\");
"
					];
Niloperators()				-> [view_gen_csgio_write2structuredef_c: {/*EMPTY*/} ];
Consoperators( a_op, r_op )		-> [view_gen_csgio_write2structuredef_c:
{ arguments args; }
 r_op
{ args = f_argumentsofoperator( a_op );
  gl_operator = a_op;
  gl_phylum = f_phylumofoperator( a_op );
  if (length_arguments(args) > 0) ${
}
"			case (int)sel_" (ID)a_op ": {
"
   (arguments)args:view_gen_csgio_write2structuredef_bigatom_c
"			break; }
"
{  $}
  gl_operator = 0;
  gl_phylum = 0;
}
					];
Nilarguments()				-> [view_gen_csgio_write2structuredef_bigatom_c: {/*EMPTY*/} ];
Consarguments( *, r_args )		-> [view_gen_csgio_write2structuredef_bigatom_c:
	r_args
	$0:view_gen_csgio_write2structuredef_bigatom_do_c
					];
Consarguments( *, Nilarguments() )	-> [view_gen_csgio_write2structuredef_bigatom_c:
	$0:view_gen_csgio_write2structuredef_bigatom_do_c
					];
Consarguments( a_arg, * )	-> [view_gen_csgio_write2structuredef_bigatom_do_c:
{ if (f_isbigatom( a_arg )) } ${
"				kc_CSGIOwrite2structure_" a_arg "( kc_stream, ((" (ID)gl_phylum ")kc_p)->u." (ID)gl_operator "." a_arg "_" $0->seqnr ");
"
  $} { else } ${
"				kc_CSGIOwrite2structure(kc_stream, (kc_voidptr_t)((" (ID)gl_phylum ")kc_p)->u." (ID)gl_operator "." a_arg "_" $0->seqnr ", kc_phylum_" a_arg " );
"
  $}
					];
Nilphyla()				-> [view_gen_csgio_writephylumdef_scan_c: {/*EMPTY*/} ];
Consphyla( a_phy, r_phy )		-> [view_gen_csgio_writephylumdef_scan_c:
 r_phy
"	case (int)kc_phylum_" a_phy ":
		kc_CSGIOscan_" a_phy "( kc_stream, kc_p.yt_" a_phy " );
		break;
"					];
Nilphyla()				-> [view_gen_csgio_writephylumdef_write_c: {/*EMPTY*/} ];
Consphyla( a_phy, r_phy )		-> [view_gen_csgio_writephylumdef_write_c:
 r_phy
"	case (int)kc_phylum_" a_phy ":
		kc_CSGIOwrite2structure_" a_phy "(kc_stream, kc_p.yt_" a_phy ");
		break;
"					];


/***************************************************************************/
/*
 * attribute copy fnsdefs
 *
 */

PhylumDeclarations( pds )		-> [view_gen_copy_attributes_c:
	pds
					];
Consphylumdeclarations( pd, rpds )	-> [view_gen_copy_attributes_c: rpds pd ];
Nilphylumdeclarations()			-> [view_gen_copy_attributes_c: {/*EMPTY*/} ];
PhylumDeclaration( *, *, Emptyproductionblock(), * )
					-> [view_gen_copy_attributes_c: {/*EMPTY*/} ];
PhylumDeclaration( id, *, *, CcodeOption( a, * ))
					-> [view_gen_copy_attributes_c:
{ gl_phylum = id; }
	a
{ gl_phylum = 0; }
					];
Nilattributes()				-> [view_gen_copy_attributes_c: {/*EMPTY*/} ];
Consattributes( *, * )			-> [view_gen_copy_attributes_c:
"static void kc_copy_attributes_" (ID)gl_phylum "
#ifdef KC_USE_PROTOTYPES
(" (ID)gl_phylum " kc_p1, " (ID)gl_phylum " kc_p2)
#else
(kc_p1, kc_p2) " (ID)gl_phylum " kc_p1, kc_p2;
#endif
{
"
	$0:view_gen_copy_attributes_c_doit
"}
"
					];
Nilattributes()				-> [view_gen_copy_attributes_c_doit: {/*EMPTY*/} ];
Consattributes( Attribute( *, id, * ), ra )
					-> [view_gen_copy_attributes_c_doit:
	ra
"	kc_p2->" id " = kc_p1->" id ";
"
					];

/***************************************************************************/
/*
 * copy fnsdelcs
 *
 */

PhylumDeclarations( pds )		-> [view_gen_copydecls_h:
	pds
					];
Consphylumdeclarations( pd, rpds )	-> [view_gen_copydecls_h: rpds pd ];
Nilphylumdeclarations()			-> [view_gen_copydecls_h: {/*EMPTY*/} ];
PhylumDeclaration( *, *, Emptyproductionblock(), * )
					-> [view_gen_copydecls_h: {/*EMPTY*/} ];
PhylumDeclaration( id, *, *, * )	-> [view_gen_copydecls_h:
id " copy_" id " KC__P(( " id ", boolean ));
"
					];

/***************************************************************************/
/*
 * copy fnsdefs
 *
 */


PhylumDeclarations( pds )		-> [view_gen_copydefs_c:
"/*ARGSUSED*/ kc_voidptr_t kc_do_copy_phylum
#ifdef KC_USE_PROTOTYPES
(kc_voidptr_t kc_p, boolean kc_copy_attributes, kc_enum_phyla kc_phylum)
#else
(kc_p, kc_copy_attributes, kc_phylum) kc_voidptr_t kc_p; boolean kc_copy_attributes; kc_enum_phyla kc_phylum;
#endif
{	kc_voidptr_t kc_subtmp["
 	${ { int i = last_argsnumbers( Theargsnumbers ); if (i<=0) i = 1; } (int)i $}
"];
	kc_voidptr_t kc_answer = 0;
	int kc_i;
	kc_enum_operators kc_prodsel;
	KC_OPERATOR_INFO *kc_op_info;
	int kc_st;
	kc_hashtable_t kc_a_ht;
	/* SHOULD be done using bigatoms? */
"
(phyla)cg_bigatomphyla
"	/*SUPPRESS 622*/
	assertPhylum(((casestring)kc_p),\"kc_p\",kc_phylum);
	if ((kc_phylum == kc_phylum_voidptr)) {
		return kc_p;
	}
	kc_prodsel = ((casestring)kc_p)->prod_sel;
	kc_op_info = &kc_OperatorInfo[(int)kc_prodsel];
	kc_st = (int)kc_op_info->uniq_stored;
	kc_a_ht = kc_hashtables[kc_st];
	if (kc_st
	   && (/* kc_storageclass_still_uniq[kc_st]
	       || */ ((kc_a_ht->in_block != 0)
		  && (*kc_a_ht->in_block)((kc_voidptr_t)kc_p, kc_a_ht->malloc_private_data)))) {
		return kc_p;
	} else if (kc_phylum == kc_phylum_casestring) {
		return (kc_voidptr_t)mkcasestring(((casestring)kc_p)->name);
	} else if (kc_phylum == kc_phylum_nocasestring) {
		return (kc_voidptr_t)mknocasestring(((nocasestring)kc_p)->name);
	}
"
{ if (cg_bigatomoperators && length_operators(cg_bigatomoperators) > 0) } ${
"	switch(kc_prodsel) {
"
     (operators)cg_bigatomoperators
"	default:
"
  $}
"	for (kc_i = 0; kc_i < kc_op_info->no_sons; kc_i++) {
		kc_subtmp[kc_i] = kc_do_copy_phylum((kc_voidptr_t)KC_SUBPHYLUM(kc_p, kc_op_info->suboffset[kc_i]), kc_copy_attributes, kc_op_info->subphylum[kc_i] );
	}
	switch(kc_op_info->no_sons) {
"
	(argsnumbers)Theargsnumbers
"	default:
		/*SUPPRESS 622*/
		assertReason(kc_zero_constant, \"unexpected number of sub-phyla\");/*NOTREACHED*/
	}
"
{ if (cg_bigatomoperators && length_operators(cg_bigatomoperators) > 0) } ${
"	break;
	}
"
  $}
"	if (kc_copy_attributes && (kc_PhylumInfo[(int)kc_phylum].copy_attributes != 0)) {
		(*kc_PhylumInfo[(int)kc_phylum].copy_attributes)(kc_p, kc_answer);
	}
	return kc_answer;
}

"
	pds
					];
Consphylumdeclarations( pd, rpds )	-> [view_gen_copydefs_c: rpds pd ];
Nilphylumdeclarations()			-> [view_gen_copydefs_c: {/*EMPTY*/} ];
PhylumDeclaration( *, *, Emptyproductionblock(), * )
					-> [view_gen_copydefs_c: {/*EMPTY*/} ];
PhylumDeclaration( id, *, PredefinedAlternatives( * ), * )
					-> [view_gen_copydefs_c:
"/*ARGSUSED*/
" id " copy_" id "
#ifdef KC_USE_PROTOTYPES
(" id " kc_p, boolean kc_copy_attributes)
#else
(kc_p, kc_copy_attributes) " id " kc_p; boolean kc_copy_attributes;
#endif
"
{ if ( (strcmp( f_strofID( id ), "int" ) == 0) ||
       (strcmp( f_strofID( id ), "float" ) == 0) ) } ${
"{	return kc_p; }
"
  $} {else} ${
"{	return (" id ")kc_do_copy_phylum( (kc_voidptr_t)kc_p, kc_copy_attributes, kc_phylum_" id "); }
"
  $}
					];
PhylumDeclaration( id, *, *, * )	-> [view_gen_copydefs_c:
id " copy_" id "
#ifdef KC_USE_PROTOTYPES
(" id " kc_p, boolean kc_copy_attributes)
#else
(kc_p, kc_copy_attributes) " id " kc_p; boolean kc_copy_attributes;
#endif
{	return (" id ")kc_do_copy_phylum( (kc_voidptr_t)kc_p, kc_copy_attributes, kc_phylum_" id "); }
"
					];


Nilphyla()				-> [view_gen_copydefs_c: {/*EMPTY*/} ];
Consphyla( a_phy, r_phy )		-> [view_gen_copydefs_c:
 r_phy
"	/*SUPPRESS 622*/
	assertReason(kc_phylum != kc_phylum_" a_phy ", \"kc_do_copy_phylum called with kc_phylum_" a_phy " argument\");
"
					];
Niloperators()				-> [view_gen_copydefs_c: {/*EMPTY*/} ];
Consoperators( a_op, r_op )		-> [view_gen_copydefs_c:
{ arguments args; }
 r_op
{ args = f_argumentsofoperator( a_op );
  gl_operator = a_op;
  gl_phylum = f_phylumofoperator( a_op );
  if (length_arguments(args) > 0) } ${
"	case (int)sel_" (ID)a_op ": {
"
   (arguments)args:view_gen_copydefs_bigatom_argdefs_c
   (arguments)args:view_gen_copydefs_bigatom_argset_c
"		kc_answer = (kc_voidptr_t) " (ID)a_op "("
   (arguments)args:view_gen_copydefs_bigatom_arguse_c
");
	break; }
"
  $}
{ gl_operator = 0;
  gl_phylum = 0;
}
					];


Nilarguments()				-> [view_gen_copydefs_bigatom_argdefs_c: {/*EMPTY*/} ];
Consarguments( a_arg, r_args )		-> [view_gen_copydefs_bigatom_argdefs_c:
	r_args
{ if (f_isbigatom( a_arg )) } ${
"		" a_arg " kc_sub_" a_arg "_" $0->seqnr ";
"
  $}
					];
Nilarguments()				-> [view_gen_copydefs_bigatom_argset_c: { gl_j = 0; } ];
Consarguments( a_arg, r_args )		-> [view_gen_copydefs_bigatom_argset_c:
	r_args
{ if (f_isbigatom( a_arg )) } ${
"		kc_sub_" a_arg "_" $0->seqnr " = copy_" a_arg "(((" (ID)gl_phylum ")kc_p)->u." (ID)gl_operator "." a_arg "_" $0->seqnr ", kc_copy_attributes);
"
  $} { else } ${
"		kc_subtmp[" (int)gl_j "] = kc_do_copy_phylum((kc_voidptr_t)((" (ID)gl_phylum ")kc_p)->u." (ID)gl_operator "." a_arg "_" $0->seqnr ", kc_copy_attributes, kc_phylum_" a_arg ");
"
  $}
{ gl_j++; }
					];
Nilarguments()				-> [view_gen_copydefs_bigatom_arguse_c: { gl_j = 0; } ];
Consarguments( *, r_args )		-> [view_gen_copydefs_bigatom_arguse_c:
	r_args
	","
	$0:view_gen_copydefs_bigatom_do_arguse_c
					];
Consarguments( *, Nilarguments() )	-> [view_gen_copydefs_bigatom_arguse_c:
{ gl_j = 0; }
	$0:view_gen_copydefs_bigatom_do_arguse_c
					];
Consarguments( a_arg, * )	-> [view_gen_copydefs_bigatom_do_arguse_c:
{ if (f_isbigatom( a_arg )) } ${
" kc_sub_" a_arg "_" $0->seqnr
  $} { else } ${
" (" a_arg ")kc_subtmp[" (int)gl_j "]"
  $}
{ gl_j++; }
					];


Nilargsnumbers()			-> [view_gen_copydefs_c: {/*EMPTY*/} ];
Consargsnumbers( i, r )			-> [view_gen_copydefs_c:
"	case " i ": kc_answer = (kc_voidptr_t) (*kc_op_info->create_routine)("
" kc_prodsel"
    { if (i > 0) } ${
  ","
    $}
	${ { int j; for (j=0; j<i; j++ ) } ${
" kc_subtmp[" (int)j "]"
	{		if ( j < i-1 ) }
","
	{		else }
" "
	$}                              $}
"); break;
"
	r
					];



/***************************************************************************/

PhylumDeclarations( * )			-> [view_gen_rewritek_h:
"/* translation of file(s)
"
(fnfiles)Thefnfiles
" */
/* generated by:
 *	" (charptr)kimwitu_copyright "
 */
#ifndef KC_REWRITE_HEADER
#define KC_REWRITE_HEADER
#define KIMW_REWRITE_HEADER /* 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 \"k.h\"	/* in case a user forgets */

typedef enum {
" (viewnames)Therviewnames "
} rview;

extern char *kc_rview_names[];

"
					   ];
PhylumDeclarations( * )			-> [view_gen_end_rewritek_h:
"
#endif /* KC_TYPES_HEADER */
"
					   ];

/***************************************************************************/

PhylumDeclarations( * )			-> [view_gen_rewritek_c:
"/*LINTLIBRARY*/
/* translation of file(s)
"
(fnfiles)Thefnfiles
" */
/* generated by:
 *	" (charptr)kimwitu_copyright "
 */
#define KC_REWRITE
#define KIMW_REWRITE /* 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>
#include <sys/types.h>
#ifdef KC_STDC
# include <stdlib.h>
#endif
#include \"k.h\"
#include \"rk.h\"

char *kc_rview_names[] = {
" (viewnames)Therviewnames "
};

"
					   ];

/***************************************************************************/

PhylumDeclarations( pds )		-> [view_gen_rewritedecls_h:
	pds
					];
Consphylumdeclarations( pd, rpds )	-> [view_gen_rewritedecls_h: rpds pd ];
Nilphylumdeclarations()			-> [view_gen_rewritedecls_h: {/*EMPTY*/} ];
PhylumDeclaration( *, *, Emptyproductionblock(), * )
					-> [view_gen_rewritedecls_h: {/*EMPTY*/} ];
PhylumDeclaration( id, *, *, * )	-> [view_gen_rewritedecls_h:
id " rewrite_" id " KC__P(( " id ", rview ));
"
					];

/***************************************************************************/

PhylumDeclarations( pds )		-> [view_gen_rewritedefs_c:
	pds
					];
Consphylumdeclarations( pd, rpds )	-> [view_gen_rewritedefs_c: 
	rpds
	pd
					   ];
Nilphylumdeclarations()			-> [view_gen_rewritedefs_c: {/*EMPTY*/} ];
PhylumDeclaration( *, *, Emptyproductionblock(), * )
					-> [view_gen_rewritedefs_c: {/*EMPTY*/} ];
PhylumDeclaration( id, *, PredefinedAlternatives( * ), * )	-> [view_gen_rewritedefs_c:
{ gl_phylum = id; }
"/*ARGSUSED*/
"id " rewrite_" id "
#ifdef KC_USE_PROTOTYPES
(" id " kc_p, rview kc_current_view)
#else
(kc_p, kc_current_view) " id " kc_p; rview kc_current_view;
#endif
{
	/*SUPPRESS 622*/
	assert_" id "( kc_p, \"kc_p\" );
	return kc_p;
}
"
{ gl_phylum = 0; }
					];
PhylumDeclaration( id, *, pb, * )	-> [view_gen_rewritedefs_c:
{ gl_phylum = id; }
{ gl_phydecl = f_lookupdecl( gl_phylum );
  if ( gl_phydecl == 0 ) {
	v_report(NonFatal( FileLine( gl_phylum->file, gl_phylum->line ), Problem1S1ID( "internal error: could not find declaration of phylum:", gl_phylum )));
  }
}
"/*ARGSUSED*/
"id " rewrite_" id "
#ifdef KC_USE_PROTOTYPES
(" id " kc_p, rview kc_current_view)
#else
(kc_p, kc_current_view) " id " kc_p; rview kc_current_view;
#endif
{
	/*SUPPRESS 622*/
	assert_" id "( kc_p, \"kc_p\" );
	switch((int)kc_current_view) {
"
	pb
"	}
}
"
{ gl_phylum = 0; gl_phydecl = 0; }
					];

ListAlternatives( a, * ),
NonlistAlternatives( a )		-> [view_gen_rewritedefs_c:
{ rewriteviewsinfo a_rewriteviewsinfo = f_rewriteviewsinfoofalternatives( a, Therviewnames ); }
{ gl_rewrite_goto_used = False; }
	(rewriteviewsinfo)a_rewriteviewsinfo
					];
Nilrewriteviewsinfo() 			-> [view_gen_rewritedefs_c: {/*EMPTY*/} ];
/*
 * IMPORTANT we unparse the viewsinfo in reverse order, to make sure that
 * the kc_unparsing_label is used before defined, ie.
 * the default view is the last in the switch
 * so that we can set a variable when we generate a goto,
 * so that we only generate the label if necessary
 */
Consrewriteviewsinfo( a_rvi, r_rvi ) 	-> [view_gen_rewritedefs_c:
	r_rvi
	a_rvi
					];
Rewriteviewinfo( v, rri )			-> [view_gen_rewritedefs_c:
{ gl_rewrite_rewriteinfo = rri; }
{ if (eq_ID( v, Id( Str( mkcasestring( "base_rview" ))))) } ${
	$0:view_gen_rewritedefs_default_c
$} { else } ${
	$0:view_gen_rewritedefs_other_c
$}
{ gl_rewrite_rewriteinfo = 0; }
					];
Rewriteviewinfo( v, * )		-> [view_gen_rewritedefs_default_c:
"	default:
"
{ if (gl_rewrite_goto_used) } ${
"	kc_rewrite_default:
"
$}
"	case (int)" v ": {
"
{ gl_view = v; }
	(phylumdeclaration)gl_phydecl
{ gl_view = 0; }
"	}
"
					];
Rewriteviewinfo( *, Nilrewriterulesinfo() )
					-> [view_gen_rewritedefs_other_c: {/*EMPTY*/} ];
Rewriteviewinfo( v, * )		-> [view_gen_rewritedefs_other_c:
"	case (int)" v ": {
"
{ gl_view = v; }
	(phylumdeclaration)gl_phydecl
{ gl_view = 0; }
"	}
"
{ gl_rewrite_goto_used = True; }
					];

PhylumDeclaration( *, *, PredefinedAlternatives( * ), * ),
PhylumDeclaration( *, *, Emptyproductionblock(), * )
					-> [view_gen_rewritedefs_default_c view_gen_rewritedefs_other_c: {/*EMPTY*/} ];
PhylumDeclaration( *, *, ListAlternatives( a, * ), * ),
PhylumDeclaration( *, *, NonlistAlternatives( a ), * )
					-> [view_gen_rewritedefs_default_c:
"		switch((int)kc_p->prod_sel) {
"
	a
"		default: return kc_p;}
"
					];
PhylumDeclaration( *, *, ListAlternatives( a, * ), * ),
PhylumDeclaration( *, *, NonlistAlternatives( a ), * )
					-> [view_gen_rewritedefs_other_c:
"		switch((int)kc_p->prod_sel) {
"
	a
"		default: goto kc_rewrite_default;}
"
{ gl_rewrite_goto_used = True; }
					];

/***** vanaf hier volg de oude code ******/

Nilalternatives()			-> [view_gen_rewritedefs_default_c view_gen_rewritedefs_other_c: {/*EMPTY*/} ];
Consalternatives( a, r_a )		-> [view_gen_rewritedefs_default_c view_gen_rewritedefs_other_c:
	r_a
	a
					];
Alternative( id, args )
					-> [view_gen_rewritedefs_default_c:
{ gl_operator = id; gl_args = args;
  gl_rewrite_rewriteinfo = f_rewriterulesinfoofalternativeinview($0, gl_view);
  gl_outmost_nonleaf_predicates = f_outmost_nl_preds_in_rewriterulesinfo(gl_rewrite_rewriteinfo); }
"		case (int)sel_" id ": {
"
	args:view_gen_rewritedefs_rewritearg_c
{ if (gl_outmost_nonleaf_predicates) } ${
	args:view_gen_rewritedefs_nl_arg_c
  $}
	(rewriterulesinfo)gl_rewrite_rewriteinfo
"		}
"
{ gl_operator = 0; gl_args = 0; gl_rewrite_rewriteinfo = 0; gl_outmost_nonleaf_predicates = False; }
					];
Alternative( id, args )
					-> [view_gen_rewritedefs_other_c:
{ gl_operator = id; gl_args = args;
  gl_rewrite_rewriteinfo = f_rewriterulesinfoofalternativeinview($0, gl_view);
  gl_outmost_nonleaf_predicates = f_outmost_nl_preds_in_rewriterulesinfo(gl_rewrite_rewriteinfo); }
{ if (! eq_rewriterulesinfo( gl_rewrite_rewriteinfo, Nilrewriterulesinfo())) } ${
"		case (int)sel_" id ": {
"
	args:view_gen_rewritedefs_rewritearg_c
{ if (gl_outmost_nonleaf_predicates) } ${
	args:view_gen_rewritedefs_nl_arg_c
  $}
	(rewriterulesinfo)gl_rewrite_rewriteinfo
"		}
"
 $}
{ gl_operator = 0; gl_args = 0; gl_rewrite_rewriteinfo = 0; gl_outmost_nonleaf_predicates = False; }
					];

Nilarguments()				-> [view_gen_rewritedefs_rewritearg_c: {/*EMPTY*/} ];
Consarguments( a_arg, r_args )		-> [view_gen_rewritedefs_rewritearg_c:
	r_args
"		" a_arg " " a_arg "_" $0->seqnr " = rewrite_" a_arg "(kc_p->u." (ID)gl_operator "." a_arg "_" $0->seqnr ", kc_current_view);
"
					];
Nilarguments()				-> [view_gen_rewritedefs_nl_arg_c:
"		" (ID)gl_phylum " kc_rp = kc_p;
"
					];
Consarguments( *, * )			-> [view_gen_rewritedefs_nl_arg_c:
"		" (ID)gl_phylum " kc_rp = ((" $0:view_gen_rewritedefs_dotestarg_c "))
			? kc_p
			: " (ID)gl_operator "(" $0:view_gen_rewritedefs_args_c ");
"
					];
Nilarguments()				-> [view_gen_rewritedefs_testarg_c:
"		return kc_p;
"
					];
Consarguments( *, * )			-> [view_gen_rewritedefs_testarg_c:
{ if (gl_outmost_nonleaf_predicates) } ${
"		return kc_rp;
"
  $} { else } ${
"		if ((" $0:view_gen_rewritedefs_dotestarg_c "))
			return kc_p;
		else
			return " (ID)gl_operator "(" $0:view_gen_rewritedefs_args_c ");
"
  $}
					];
Nilarguments()				-> [view_gen_rewritedefs_dotestarg_c: {/*EMPTY*/} ];
Consarguments( a_arg, Nilarguments() )	-> [view_gen_rewritedefs_dotestarg_c:
a_arg "_" $0->seqnr " == kc_p->u." (ID)gl_operator "." a_arg "_" $0->seqnr
					];
Consarguments( a_arg, r_args )		-> [view_gen_rewritedefs_dotestarg_c:
	r_args
") && (" a_arg "_" $0->seqnr " == kc_p->u." (ID)gl_operator "." a_arg "_" $0->seqnr
					];
Nilarguments()				-> [view_gen_rewritedefs_args_c: {/*EMPTY*/} ];
Consarguments( a_arg, Nilarguments() )	-> [view_gen_rewritedefs_args_c:
	a_arg "_" $0->seqnr
					];
Consarguments( a_arg, r_args )		-> [view_gen_rewritedefs_args_c:
	r_args
	", "
	a_arg "_" $0->seqnr
					];
Nilrewriterulesinfo()			-> [view_gen_rewritedefs_default_c:
	(arguments)gl_args:view_gen_rewritedefs_testarg_c
					];
Nilrewriterulesinfo()			-> [view_gen_rewritedefs_other_c:
"		goto kc_rewrite_default;
"
{ gl_rewrite_goto_used = True; }
					];
/* we skip the first predicate, it will be for the outermost operator that we handle in the switch */
Consrewriterulesinfo( Rewriteruleinfo( Nilpatternrepresentation(), bindings, RewriteClause( *, t) ), * ),
Consrewriterulesinfo( Rewriteruleinfo( Conspatternrepresentation( *, Nilpatternrepresentation() ), bindings, RewriteClause( *, t) ), * )
					-> [view_gen_rewritedefs_default_c view_gen_rewritedefs_other_c:
"		{
"
	bindings:view_rw_bindings
(charptr)g_emptystring:view_printer_outputfileline
"		" (ID)gl_phylum " kc_result = " t ";
		return (kc_result == kc_p) ? kc_p : rewrite_" (ID)gl_phylum "( kc_result, kc_current_view );
		}
"
					];
Consrewriterulesinfo( Rewriteruleinfo( Conspatternrepresentation( *, r_p ), bindings, RewriteClause( *, t) ), r_rri)
					-> [view_gen_rewritedefs_default_c view_gen_rewritedefs_other_c:
"		if ((" r_p:view_rw_predicates ")) {
"
	bindings:view_rw_bindings
(charptr)g_emptystring:view_printer_outputfileline
"		" (ID)gl_phylum " kc_result = " t ";
		return (kc_result == kc_p) ? kc_p : rewrite_" (ID)gl_phylum "( kc_result, kc_current_view );
		} else
"
	r_rri
					];

/* withcases stuff */
/* we do not skip the first predicate, because in first try we don't use a switch */
Nilwithcasesinfo()			-> [view_gen_withcases_and_default:
{ if (cf_topinforeachcontext()) } ${
"{/*EMPTY*/ /*skip: no matching pattern in foreach patterns*/}
"
$} { else if ( (strcmp( gl_return_type, "" ) == 0) ||
       ((strcmp( gl_star_string, "") == 0) && 
        (! f_isphylum( gl_return_ID )) &&
        (! f_is_known_ptr_type( gl_return_ID )) ) ) } ${
"kc_no_default_in_with( \"" (charptr)gl_function "\", __LINE__, __FILE__ );
"
$} { else } ${
"{ kc_no_default_in_with( \"" (charptr)gl_function "\", __LINE__, __FILE__ );
   return (" (charptr)gl_return_type (charptr)gl_star_string ")0; }
"
$}
					];
Conswithcasesinfo( Withcaseinfo( Nilpatternrepresentation(), bindings, ct ), * ),
/* special case for 'outermost wildcard' - shouldn't be triggered
 */
Conswithcasesinfo( Withcaseinfo( Conspatternrepresentation( PRDefault(), * ), bindings, ct ), * )
					-> [:
"{
"
	bindings:view_wc_bindings
"#line " ct->line " \"" ct->file:view_filename "\"
"
	ct:view_gen_initializephyla_c
(charptr)g_emptystring:view_printer_outputfileline
"}
"
					];
Conswithcasesinfo( Withcaseinfo( p , bindings, ct ), r_rri)
					-> [:
"		if ((" p:view_wc_predicates ")) {
"
	bindings:view_wc_bindings
"#line " ct->line " \"" ct->file:view_filename "\"
"
{ cf_pushoperator( f_operatorofpatternrepresentation( p ) ); }
	ct:view_gen_initializephyla_c
{ cf_popoperator(); }
(charptr)g_emptystring:view_printer_outputfileline
"		} else
"
	r_rri
					];

/* pattern stuff */
Nilpatternrepresentation()		-> [: {/*EMPTY*/} ];
Conspatternrepresentation( p, Nilpatternrepresentation() )
					-> [view_rw_predicates view_wc_predicates view_unp_predicates:
	p
					];
Conspatternrepresentation( p, r_p )	-> [view_rw_predicates view_wc_predicates view_unp_predicates:
	p
	") && ("
	r_p
					];
Conspatternrepresentation( p, r_p )	-> [:
	p
	r_p
					];
PRNonLeafBinding( p, id, * ),
PRBinding( p, id )			-> [:
${
{	ID gl_type;
	if (eq_ID($0->type, f_emptyId())) {
		gl_type = f_typeof( p );
	} else {
		gl_type = $0->type;
	}
}
"#line " id->line " \"" id->file:view_filename "\"
		" (ID)gl_type " " id " = " p ";
"
$}
					];
Nilpath()				-> [: {/*EMPTY*/} ];
/* special case for start of withcase pattern. because we do not skip the
 * first operator (no switch) we have to place the Nilpath in this place
 * QUESTION: is the pattern below actually used? Should we use selvarext?
 */
Nilpath()				-> [view_wc_bindings view_wc_predicates:
{ ID selvar = cf_topselvar(); }
	" " (ID)selvar
					];
/* special case for start of withcase pattern. because we do not skip the
 * first operator (no switch) we have to place the Nilpath in this place
 * Also, because the first Conspath contains the expression number,
 * we special-case this, such that we get 'selvar_exprnumber' as var name.
 */
Conspath( i, r_p = Nilpath() ) 		-> [view_wc_bindings view_wc_predicates:
	r_p "_" i
					];
Nilpath()				-> [view_unp_bindings view_unp_predicates:
	" kc_p"
					];
Conspath( i, r_p ) 			-> [:
	r_p
	"->u." r_p->op "."
	${ { argument gl_argument = f_argumentofoperator( r_p->op, Int( i )); }
	(argument)gl_argument
	$}
					];
/* special case for start of rewrite path. because we skip the first operator
 * that is in the switch we always have a Conspath in a rewrite pattern representation
 */
Nilpath() 				-> [view_rw_bindings view_rw_predicates:
{ if (gl_outmost_nonleaf_predicates) } ${
	" kc_rp"
  $} { else /* we have only an outermost nonleaf binding */ } ${
	" ((" (arguments)gl_args:view_gen_rewritedefs_dotestarg_c "))
			? kc_p
			: " (ID)gl_operator "(" (arguments)gl_args:view_gen_rewritedefs_args_c ")"
  $}
					];
Conspath( i, Nilpath() ) 		-> [view_rw_bindings view_rw_predicates:
	${ { argument gl_argument = f_argumentofoperator( $2->op, Int( i )); }
	(argument)gl_argument
	$}
					];
PRVarPredicate( ps, *, * )		-> [:
	ps
					];
Nilpaths()				-> [: {/*EMPTY*/} ];
Conspaths(*, Nilpaths())		-> [: {/*EMPTY*/} ];
Conspaths(p1, Conspaths(p2, Nilpaths()))
					-> [:
${ { ID gl_type = f_typeof( p1 ); }
	"eq_" (ID)gl_type "(" p1 ", " p2 ")"
$}
					];
Conspaths(p1, Conspaths(p2, *))		-> [:
${ { ID gl_type = f_typeof( p1 ); }
	"eq_" (ID)gl_type "(" p1 ", " p2 ")) && (" $2
$}
					];
/* strip leading/trailing 0 from the Oper path */
PROperPredicate( Conspath( *, p), id )	-> [:
	p "->prod_sel == sel_" id
					];
PROperPredicate( Nilpath(), * )		-> [: {/*EMPTY*/} ];
PRDefault(),
PRWildcard( * )				-> [:
	"1 /*default*/"
					];
PRStringLiteral( p, Cexprdq )		-> [:
	{ if (strcmp( f_strofID( f_typeof( p ) ), "casestring" ) == 0) } ${
	        "strcmp(" p "->name, \"" Cexprdq "\")==0"
	$} { else if (strcmp( f_strofID( f_typeof( p ) ), "nocasestring" ) == 0) } ${
	        "kc_ci_strcmp(" p "->name, \"" Cexprdq "\")==0"
	$} { else } ${
	{       /*SUPPRESS 622*/
		assert(kc_zero_constant); /* internal error */ }
	$}
					];
PRIntLiteral( p, i )			-> [:
	p " == " i
					];

TVariable( id )				-> [: id ];
TOperator( id, t )			-> [: id "(" t ")" ];
TStringLiteral( Cexpr )			-> [: Cexpr ];
TIntLiteral( i )			-> [: i ];
Nilterms()				-> [: {/*EMPTY*/} ];
Consterms( t, Nilterms() )		-> [: t ];
Consterms( t, r_t )			-> [: r_t ", " t ];

/***************************************************************************/

Nilfndeclarations()			-> [view_gen_fnk_h: {/*EMPTY*/} ];
Consfndeclarations( fnd, r_fnds ) 	-> [view_gen_fnk_h:
	r_fnds
	fnd
					];
FnDeclaration( fn_t, fn_p, fn_name, *, *, *, GlobalFn() )
					-> [view_gen_fnk_h:
{ char *star_string = f_mkstars( fn_p );
}
fn_t " " (charptr)star_string " " fn_name " KC__P((" $0->sorted ")); 
"
					];
FnDeclaration( *, *, *, *, *, *, LocalFn( * ) )
					-> [view_gen_fnk_h: {/*EMPTY*/} ];
NilCvariabledeclarations()		-> [view_gen_fnk_h: {/*EMPTY*/} ];
ConsCvariabledeclarations( Cvard, NilCvariabledeclarations() ) -> [view_gen_fnk_h:
	Cvard
					];

FnAcDeclaration( fn_ds, fn_d, *, *, *, GlobalFn() )
					-> [view_gen_fnk_h:
fn_ds " " fn_d:view_gen_fn_pointer_name " KC__P((" $0->newsorted ")); 
"
					];
FnAcDeclaration( *, *, *, *, *, LocalFn( * ) )
					-> [view_gen_fnk_h: {/*EMPTY*/} ];

NilCvariabledeclarations()		-> [view_gen_fnk_h: {/*EMPTY*/} ];
ConsCvariabledeclarations( Cvard, NilCvariabledeclarations() ) -> [view_gen_fnk_h:
	Cvard
					];
ConsCvariabledeclarations( Cvard, r_Cvards ) -> [view_gen_fnk_h:
	r_Cvards ", " Cvard
					];
CVariabledeclaration( type, a_Cvars )	-> [view_gen_fnk_h:
	type " " a_Cvars
					];
Fnargfpdecl( *, * )			-> [view_gen_fnk_h: {/*EMPTY*/} ];
NilCvariables()				-> [view_gen_fnk_h: {/*EMPTY*/} ];
ConsCvariables( a_Cvar, NilCvariables() )	-> [view_gen_fnk_h:
	a_Cvar
					];
ConsCvariables( a_Cvar, r_Cvars )	-> [view_gen_fnk_h:
	r_Cvars " " a_Cvar
					];
CVPointer( pointer, * )			-> [view_gen_fnk_h:
{  char *star_string = f_mkstars( pointer );
}
	(charptr)star_string
					];
CVFunction( pointer1, pointer2, * )	-> [view_gen_fnk_h:
{  char *star_string1 = f_mkstars( pointer1 );
   char *star_string2 = f_mkstars( pointer2 );
}
	(charptr)star_string1 "(" (charptr)star_string2 ")()"
					];

/***************************************************************************/

Nilfndeclarations()			-> [view_gen_fnkdecls_c: {/*EMPTY*/} ];
Consfndeclarations( fnd, r_fnds ) 	-> [view_gen_fnkdecls_c:
	r_fnds
	fnd
					];
FnDeclaration( *, *, *, *, *, *, GlobalFn() )
					-> [view_gen_fnkdecls_c: {/*EMPTY*/} ];
FnDeclaration( fn_t, fn_p, fn_name, *, *, *, LocalFn( * ) )
					-> [view_gen_fnkdecls_c:
{ char *star_string = f_mkstars( fn_p );
}
"static " fn_t " " (charptr)star_string " " fn_name " KC__P((" $0->sorted:view_gen_fnk_h ")); 
"
					];

FnAcDeclaration( *, *, *, *, *, GlobalFn() )
					-> [view_gen_fnkdecls_c: {/*EMPTY*/} ];
FnAcDeclaration( fn_ds, fn_d, *, *, *, LocalFn( * ) )
					-> [view_gen_fnkdecls_c:
fn_ds " " fn_d:view_gen_fn_pointer_name " KC__P((" $0->newsorted ")); 
"
					];

Nilfndeclarations()			-> [view_gen_fnk_c: {/*EMPTY*/} ];
Consfndeclarations( fnd, r_fnds ) 	-> [view_gen_fnk_c:
	r_fnds
	fnd
					];
FnDeclaration( fn_t, fn_p, fn_name, fn_args, *, ct, fn_c ) -> [view_gen_fnk_c:
{  char *star_string = f_mkstars( fn_p );
   gl_return_type = f_strofID( fn_t );
   gl_return_ID = fn_t;
   gl_star_string = star_string;
   gl_function = f_strofID( fn_name );
}
fn_c fn_t " " (charptr)star_string " " fn_name "
#ifdef KC_USE_PROTOTYPES
(" $0->sorted:view_gen_fnkarg_and_decls ")
#else
(" fn_args ") " $0->sorted "
#endif
#line " ct->line " \"" ct->file:view_filename "\"
{"
	ct:view_gen_initializephyla_c
"
#line " $0->last_line " \"" $0->file:view_filename "\"
}"
(charptr)g_emptystring:view_printer_outputfileline
"
"
{  gl_return_type = "";
   gl_return_ID = 0;
   gl_star_string = "";
   gl_function = "";
}
					];
GlobalFn()				-> [view_gen_fnk_c: {/*EMPTY*/} ];
LocalFn( * )				-> [view_gen_fnk_c:
	"static "
					];
Nilfnarguments()			-> [view_gen_fnk_c: {/*EMPTY*/} ];
Consfnarguments( a_fnarg, Nilfnarguments()) -> [view_gen_fnk_c:
	a_fnarg
					];
Consfnarguments( a_fnarg, r_fnargs )	-> [view_gen_fnk_c:
	r_fnargs ", " a_fnarg
					];

NilCvariabledeclarations()		-> [view_gen_fnk_c: {/*EMPTY*/} ];
ConsCvariabledeclarations( Cvard, NilCvariabledeclarations() ) -> [view_gen_fnk_c:
	Cvard
					];
ConsCvariabledeclarations( Cvard, r_Cvards ) -> [view_gen_fnk_c:
	r_Cvards "
" Cvard
					];
CVariabledeclaration( type, a_Cvars )	-> [view_gen_fnk_c:
	type " " a_Cvars ";"
					];
Fnargfpdecl( *, * )			-> [view_gen_fnk_c: {/*EMPTY*/} ];
NilCvariables()				-> [view_gen_fnk_c: {/*EMPTY*/} ];
ConsCvariables( a_Cvar, NilCvariables() )	-> [view_gen_fnk_c:
	a_Cvar
					];
ConsCvariables( a_Cvar, r_Cvars )	-> [view_gen_fnk_c:
	r_Cvars "," a_Cvar
					];
CVPointer( pointer, name )		-> [view_gen_fnk_c view_gen_fnkarg_and_decls:
{  char *star_string = f_mkstars( pointer );
}
	(charptr)star_string name
					];
CVFunction( pointer1, pointer2, name )	-> [view_gen_fnk_c view_gen_fnkarg_and_decls:
{  char *star_string1 = f_mkstars( pointer1 );
   char *star_string2 = f_mkstars( pointer2 );
}
	(charptr)star_string1 "(" (charptr)star_string2 name ")()"
					];

NilCvariabledeclarations()		-> [view_gen_fnkarg_and_decls: {/*EMPTY*/} ];
ConsCvariabledeclarations( Cvard, NilCvariabledeclarations() ) -> [view_gen_fnkarg_and_decls:
	Cvard
					];
ConsCvariabledeclarations( Cvard, r_Cvards ) -> [view_gen_fnkarg_and_decls:
	r_Cvards ", " Cvard
					];
CVariabledeclaration( type, a_Cvars )	-> [view_gen_fnkarg_and_decls:
{ gl_type = type; }
	a_Cvars
{ gl_type = 0; }
					];
Fnargfpdecl( *, * )			-> [view_gen_fnkarg_and_decls: {/*EMPTY*/} ];
NilCvariables()				-> [view_gen_fnkarg_and_decls: {/*EMPTY*/} ];
ConsCvariables( a_Cvar, NilCvariables() )	-> [view_gen_fnkarg_and_decls:
	(ID)gl_type " " a_Cvar
					];
ConsCvariables( a_Cvar, r_Cvars )	-> [view_gen_fnkarg_and_decls:
	r_Cvars ", " (ID)gl_type " " a_Cvar
					];

FnAcDeclaration( fn_ds, fn_d, *, ct, fn_name, * ) -> [view_gen_fnk_c:
{  char *star_string = f_mkstars( f_stars_of_declarator( fn_d ) );
   gl_return_ID = f_ID_of_ac_declaration_specifiers( fn_ds );
   gl_return_type = f_strofID( gl_return_ID );
   gl_star_string = star_string;
   gl_function = f_strofID( fn_name );
}
fn_ds " " fn_d:view_gen_fn_pointer_name "
#ifdef KC_USE_PROTOTYPES
(" $0->newsorted ")
#else
(" $0->newsorted:view_gen_fnkargs ") " $0->newsorted:view_gen_fnkdecls "
#endif
#line " ct->line " \"" ct->file:view_filename "\"
{"
	ct:view_gen_initializephyla_c
"
#line " $0->last_line " \"" $0->file:view_filename "\"
}"
(charptr)g_emptystring:view_printer_outputfileline
"
"
{  gl_return_type = "";
   gl_return_ID = 0;
   gl_star_string = "";
   gl_function = "";
}
					];

AcDeclaration( ds, idlo ) ->  [:
	ds " " idlo ";
"
	];

Consac_declaration_list( h, t ) -> [: t h ];

Consac_declaration_specifiers( h, Nilac_declaration_specifiers() ) -> [: h ];
Consac_declaration_specifiers( h, t ) -> [: t " " h ];
AcAuto()	-> [: "auto" ];
AcRegister()	-> [: "register" ];
AcStatic()	-> [: "static" ];
AcExtern()	-> [: "extern" ];
AcTypedef()	-> [: "typedef" ];

AcTypeSpec( i ) -> [: i ];

AcConst()	-> [: "const" ];
AcVolatile()	-> [: "volatile" ];

Consac_init_declarator_list( h , t ) -> [: t " " h ];
Consac_init_declarator_list( h, Nilac_init_declarator_list() ) -> [: h ];

AcInitDecl( d ) -> [: d ];

AcDeclarator( po, dd ) -> [: po dd ];

AcDirectDeclId( i ) -> [: i ];
AcDirectDeclPack( d ) -> [: "(" d ")" ];
AcDirectDeclArray( dd, ceo ) -> [: dd "[" ceo "]" ];
AcDirectDeclProto( dd, ptl ) -> [: dd "(" ptl ")" ];
AcDirectDeclKandR( dd, il ) -> [: dd "(" il ")" ];

Nopointer() -> [: {/*EMPTY*/} ];
Yespointer( p ) -> [: p ];

AcPointerNil( Nilac_type_qualifier_list() ) -> [: "*" ];
AcPointerNil( tql ) -> [: "* " tql " " ];
AcPointerCons( Nilac_type_qualifier_list(), p ) -> [: "*" p ];
AcPointerCons( tql, p ) -> [: "* " tql " " p ];

Consac_type_qualifier_list( h, Nilac_type_qualifier_list() ) -> [: h ];
Consac_type_qualifier_list( h, t ) -> [: t " " h ];

AcParList( pl ) -> [: pl ];
AcParList( Nilac_parameter_list() ) -> [: "void" ];
AcParList3Dot( pl ) -> [: pl ", ..." ];

Consac_parameter_list( h, Nilac_parameter_list() ) -> [: h ];
Consac_parameter_list( h, t ) -> [: t ", " h ];

AcParDeclDecl( ds, d ) -> [: ds " " d ];
AcParDeclAbsdecl( ds, ad ) -> [: ds " " ad ];

Consac_identifier_list( h, Nilac_identifier_list() ) -> [: h ];
Consac_identifier_list( h, t ) -> [: t ", " h ];

AcAbsdeclPointer( p ) -> [: p ];
AcAbsdeclDirdecl( po, dad ) -> [: po dad ];

Yesac_direct_abstract_declarator( dad ) -> [: dad ];

AcDirAbsdeclPack( ad ) -> [: "(" ad ")" ];
AcDirAbsdeclArray( dado, ceo ) -> [: dado "[" ceo "]" ];
AcDirAbsdeclFn( dado, ptl ) -> [: dado "(" ptl ")" ];

AcConstExpr( ce ) -> [:
	ce:view_gen_initializephyla_c
];

AcDeclarator( po, dd ) -> [view_gen_fn_pointer_name: po dd ];
AcDirectDeclProto( dd, * ) -> [view_gen_fn_pointer_name: dd ];
AcDirectDeclKandR( dd, * ) -> [view_gen_fn_pointer_name: dd ];

AcParList( Nilac_parameter_list() ) -> [view_gen_fnkargs:  ];
AcParList3Dot( pl ) -> [view_gen_fnkargs: pl ];
AcParDeclDecl( *, d ) -> [view_gen_fnkargs: d ];
AcParDeclAbsdecl( *, ad ) -> [view_gen_fnkargs: ad ];
AcDeclarator( *, dd ) -> [view_gen_fnkargs: dd ];
AcDirectDeclPack( d ) -> [view_gen_fnkargs: d ];
AcDirectDeclArray( dd, * ) -> [view_gen_fnkargs: dd ];
AcDirectDeclProto( dd, * ) -> [view_gen_fnkargs: dd ];
AcDirectDeclKandR( dd, * ) -> [view_gen_fnkargs: dd ];
AcAbsdeclPointer( * ) -> [view_gen_fnkargs: "kc_arg_missing" ];
AcAbsdeclDirdecl( *, dad ) -> [view_gen_fnkargs: dad ];
AcDirAbsdeclPack( ad ) -> [view_gen_fnkargs: ad ];
AcDirAbsdeclArray( dado, * ) -> [view_gen_fnkargs: dado ];
AcDirAbsdeclFn( dado, * ) -> [view_gen_fnkargs: dado ];

AcParList( Nilac_parameter_list() ) -> [view_gen_fnkdecls:  ];
AcParList3Dot( pl ) -> [view_gen_fnkdecls: pl ];
Consac_parameter_list( h, Nilac_parameter_list() ) -> [view_gen_fnkdecls: h ";" ];
Consac_parameter_list( h, t ) -> [view_gen_fnkdecls: t "\n" h ";" ];
AcParDeclDecl( ds, d ) -> [view_gen_fnkdecls: ds " " d ];
AcParDeclAbsdecl( ds, ad ) -> [view_gen_fnkdecls: ds " " ad ];
AcDeclarator( po, dd ) -> [view_gen_fnkdecls: po dd ];
AcDirectDeclId( i ) -> [view_gen_fnkdecls: i ];
AcDirectDeclPack( d ) -> [view_gen_fnkdecls: "(" d ")" ];
AcDirectDeclArray( dd, ceo ) -> [view_gen_fnkdecls: dd "[" ceo "]" ];
AcDirectDeclProto( dd, * ) -> [view_gen_fnkdecls: dd "()" ];
AcDirectDeclKandR( dd, * ) -> [view_gen_fnkdecls: dd "()" ];
AcAbsdeclPointer( p ) -> [view_gen_fnkargs: p " kc_arg_missing" ];
AcAbsdeclDirdecl( p, dad ) -> [view_gen_fnkargs: p dad ];

/***************************************************************************/
%{ KC_UNPARSE
#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
%}

PhylumDeclarations( * )		-> [view_gen_fns_start_h:
{ char *printablefilename = f_make_identifier_basename( g_hfilename ); }
"/* translation of file \"" (casestring)pg_filename "\" */
/* generated by:
 *	" (charptr)kimwitu_copyright "
 */
#ifndef KC_FUNCTIONS_" (charptr)printablefilename "_HEADER
#define KC_FUNCTIONS_" (charptr)printablefilename "_HEADER
#define KIMW_FUNCTIONS_" (charptr)printablefilename "_HEADER /* 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 \"k.h\"	/* in case a user forgets */

"
{ FREE((kc_voidptr_t) printablefilename ); }
				];
PhylumDeclarations( * )			-> [view_gen_fns_end_h:
{ char *printablefilename = f_make_identifier_basename( g_hfilename ); }
"#endif /* !  KC_FUNCTIONS_" (charptr)printablefilename "_HEADER */

"
{ FREE((kc_voidptr_t) printablefilename ); }
				];

/***************************************************************************/

PhylumDeclarations( * )			-> [view_gen_fns_start_c:
{ char *printablefilename = f_make_identifier_basename( g_cfilename ); }
"/* translation of file \"" (casestring)pg_filename "\" */
/* generated by:
 *	" (charptr)kimwitu_copyright "
 */
#define KC_FUNCTIONS_" (charptr)printablefilename "
#define KIMW_FUNCTIONS_" (charptr)printablefilename " /* 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\"
"
{ FREE((kc_voidptr_t) printablefilename ); }
					];
PhylumDeclarations( * )			-> [view_gen_fns_owninclude_c:
/* { char *printablefilename = f_make_identifier_basename( g_cfilename ); } */
"#include \"" (charptr)g_hfilename "\"
"
/* { FREE((kc_voidptr_t) printablefilename ); } */
					];

/***************************************************************************/

/***************************************************************************/

/***************************************************************************/

PhylumDeclarations( * )			-> [view_gen_unpk_h:
"/* translation of file(s)
"
(fnfiles)Thefnfiles
" */
/* generated by:
 *	" (charptr)kimwitu_copyright "
 */
#ifndef KC_UNPARSE_HEADER
#define KC_UNPARSE_HEADER
#define KIMW_UNPARSE_HEADER /* 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 \"k.h\"	/* in case a user forgets */
"
					   ];

PhylumDeclarations( pds )		-> [view_gen_unparsedecls_h:
"#ifndef KC_MAXINTSTRING
# define KC_MAXINTSTRING 30
#endif /* !KC_MAXINTSTRING */

typedef enum {
" (viewnames)Theuviewnames:view_uview_def "
} uview;
typedef uview view; /* for backwards compatibility */

extern char *kc_view_names[];

"
	pds
					];
Nilviewnames()				-> [view_gen_rewritek_h view_gen_unparsedecls_h view_uview_def: {/*EMPTY*/} ];
Consviewnames( vn, Nilviewnames())	-> [view_gen_rewritek_h view_gen_unparsedecls_h: "\t" vn ];
Consviewnames( vn, r_vn)		-> [view_gen_rewritek_h view_gen_unparsedecls_h:
	r_vn ",\n\t" vn
					];

Consviewnames( vn, Nilviewnames())	-> [view_uview_def:
 "\t" vn
{ if (eq_ID( vn, Id( Str( mkcasestring( "base_view" ))))) } ${
      " = base_uview"
  $}
					];
Consviewnames( vn, r_vn)		-> [view_uview_def:
	r_vn ",\n\t" vn
{ if (eq_ID( vn, Id( Str( mkcasestring( "base_view" ))))) } ${
      " = base_uview"
  $}
					];

Consphylumdeclarations( pd, rpds )	-> [view_gen_unparsedecls_h: rpds pd ];
Nilphylumdeclarations()			-> [view_gen_unparsedecls_h: {/*EMPTY*/} ];
PhylumDeclaration( *, *, Emptyproductionblock(), * )
					-> [view_gen_unparsedecls_h: {/*EMPTY*/} ];
PhylumDeclaration( id, *, *, * )	-> [view_gen_unparsedecls_h:
"void unparse_" id " KC__P(( " id ", void(*)(char*, uview), uview )); 
"
					];

PhylumDeclarations( * )			-> [view_gen_end_unpk_h:
"
#endif /* KC_UNPARSE_HEADER */
"
					   ];

/***************************************************************************/

PhylumDeclarations( * )			-> [view_gen_unpk_c:
"/*LINTLIBRARY*/
/* translation of file(s)
"
(fnfiles)Thefnfiles
" */
/* generated by:
 *	" (charptr)kimwitu_copyright "
 */
#define KC_UNPARSE
#define KIMW_UNPARSE /* 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>
#include <string.h>
#if ((! defined(KC_STDC) ) && defined(sun))
   extern char *sprintf();
#endif
#ifdef KC_STDC
# include <stdlib.h>
#endif
#include \"k.h\"
#include \"unpk.h\"

char *kc_view_names[] = {
" (viewnames)Theuviewnames ",
	\"base_view\"
};

"
					   ];
Nilviewnames()				-> [view_gen_rewritek_c view_gen_unpk_c: {/*EMPTY*/} ];
Consviewnames( vn, Nilviewnames())	-> [view_gen_rewritek_c view_gen_unpk_c: "\t\"" vn "\"" ];
Consviewnames( vn, r_vn)		-> [view_gen_rewritek_c view_gen_unpk_c:
	r_vn ",\n\t\"" vn "\""
					];

/***************************************************************************/

PhylumDeclarations( * )			-> [view_gen_default_types_unpk_c:
"void unparse_casestring
#ifdef KC_USE_PROTOTYPES
(casestring kc_p, void (*kc_printer)(char*, uview), uview kc_current_view)
#else
(kc_p, kc_printer, kc_current_view) casestring kc_p; void (*kc_printer)KC__P((char*, uview)); uview kc_current_view;
#endif
{
        /*SUPPRESS 622*/
	assert_casestring(kc_p, \"kc_p\");
        (*kc_printer)(kc_p->name, kc_current_view);
}

void unparse_nocasestring
#ifdef KC_USE_PROTOTYPES
(nocasestring kc_p, void (*kc_printer)(char*, uview), uview kc_current_view)
#else
(kc_p, kc_printer, kc_current_view) nocasestring kc_p; void (*kc_printer)KC__P((char*, uview)); uview kc_current_view;
#endif
{
	/*SUPPRESS 622*/
	assert_nocasestring(kc_p, \"kc_p\");
	(*kc_printer)(kc_p->name, kc_current_view);
}

void unparse_int
#ifdef KC_USE_PROTOTYPES
(int kc_p, void (*kc_printer)(char*, uview), uview kc_current_view)
#else
(kc_p, kc_printer, kc_current_view) int kc_p; void (*kc_printer)KC__P((char*, uview)); uview kc_current_view;
#endif
{
        char kc_string[KC_MAXINTSTRING];
	/* ADD: test if kc_p will fit in the allocated buffer */
        (void)sprintf(kc_string, \"%d\", kc_p);
        (*kc_printer)(kc_string, kc_current_view);
}

void unparse_float
#ifdef KC_USE_PROTOTYPES
(float kc_p, void (*kc_printer)(char*, uview), uview kc_current_view)
#else
(kc_p, kc_printer, kc_current_view) float kc_p; void (*kc_printer)KC__P((char*, uview)); uview kc_current_view;
#endif
{
        char kc_string[KC_MAXINTSTRING];
	/* ADD: test if kc_p will fit in the allocated buffer */
        (void)sprintf(kc_string, \"%f\", kc_p);
        (*kc_printer)(kc_string, kc_current_view);
}

void unparse_voidptr
#ifdef KC_USE_PROTOTYPES
(voidptr kc_p, void (*kc_printer)(char*, uview), uview kc_current_view)
#else
(kc_p, kc_printer, kc_current_view) voidptr kc_p; void (*kc_printer)KC__P((char*, uview)); uview kc_current_view;
#endif
{
        char kc_string[KC_MAXINTSTRING];
	/* ADD: test if kc_p will fit in the allocated buffer */
        (void)sprintf(kc_string, \"%p\", kc_p);
        (*kc_printer)(kc_string, kc_current_view);
}

"
						];

PhylumDeclarations( pds )		-> [view_gen_unparsedefs_c:
	pds
					];
Consphylumdeclarations( pd, rpds )	-> [view_gen_unparsedefs_c: 
	rpds
	pd
					   ];
Nilphylumdeclarations()			-> [view_gen_unparsedefs_c: {/*EMPTY*/} ];
PhylumDeclaration( *, *, PredefinedAlternatives( * ), * ),
PhylumDeclaration( *, *, Emptyproductionblock(), * )
					-> [view_gen_unparsedefs_c: {/*EMPTY*/} ];
PhylumDeclaration( id, *, pb, * )	-> [view_gen_unparsedefs_c:
{ ID selvar = Id(Str(mkcasestring("kc_p")));
  /*cf_pushselvar( selvar );*/
  cf_pushdollarvar( selvar );
  cf_pushdollarvarext( f_emptyId() );
  gl_phylum = id; }
"/*ARGSUSED*/
void unparse_" id "
#ifdef KC_USE_PROTOTYPES
(" id " kc_p, void (*kc_printer)(char*, uview), uview kc_current_view)
#else
(kc_p, kc_printer, kc_current_view) " id " kc_p; void (*kc_printer)KC__P((char*, uview)); uview kc_current_view;
#endif
{
	/*SUPPRESS 622*/
	assert_" id "(kc_p, \"kc_p\");
	switch((int)kc_current_view) {
"
	pb
"	}
}
"
{ gl_phylum = 0;
  /*cf_popselvar();*/
  cf_popdollarvar();
  cf_popdollarvarext();
}

					];

PredefinedAlternatives( * )		-> [view_gen_unparsedefs_c: {/*EMPTY*/} ];
ListAlternatives( a, * ),
NonlistAlternatives( a )		-> [view_gen_unparsedefs_c:
{ unparseviewsinfo a_unparseviewsinfo = f_unparseviewsinfoofalternatives( a, Theuviewnames ); }
{ gl_unparse_goto_used = False; }
	(unparseviewsinfo)a_unparseviewsinfo
					];
Nilunparseviewsinfo() 			-> [view_gen_unparsedefs_c: {/*EMPTY*/} ];
/*
 * IMPORTANT we unparse the viewsinfo in reverse order, to make sure that
 * the kc_unparsing_label is used before defined, ie.
 * the default view is the last in the switch
 * so that we can set a variable when we generate a goto,
 * so that we only generate the label if necessary
 */
Consunparseviewsinfo( a_uvi, r_uvi ) 	-> [view_gen_unparsedefs_c:
	r_uvi
	a_uvi
					];
Unparseviewinfo( v, * )			-> [view_gen_unparsedefs_c:
{ if (eq_ID( v, Id( Str( mkcasestring( "base_uview" ))))) } ${
	$0:view_gen_unparsedefs_default_c
$} { else if (! eq_ID( v, Id( Str( mkcasestring( "base_view" ))))) } ${
	$0:view_gen_unparsedefs_other_c
$}
					];
Unparseviewinfo( v, udi )		-> [view_gen_unparsedefs_default_c:
"	default:
"
{ if (gl_unparse_goto_used) } ${
"	kc_unparsing_default:
"
$}
"	case (int)" v ": {
"
	udi
"		break;
	}
"
					];
Unparseviewinfo( *, Nilunparsedeclsinfo() )
					-> [view_gen_unparsedefs_other_c: {/*EMPTY*/} ];
Unparseviewinfo( v, udi )		-> [view_gen_unparsedefs_other_c:
"	case (int)" v ": {
"
	udi
"		break;
	}
"
					];
Nilunparsedeclsinfo()			-> [view_gen_unparsedefs_other_c:
"		goto kc_unparsing_default;
"
{ gl_unparse_goto_used = True; }
					];
Nilunparsedeclsinfo()			-> [view_gen_unparsedefs_default_c:
{ phylumdeclaration phydecl = f_lookupdecl( gl_phylum );
  if ( phydecl == 0 ) } ${ {
	v_report(NonFatal( FileLine( gl_phylum->file, gl_phylum->line ), Problem1S1ID( "internal error: could not find declaration of phylum:", gl_phylum )));
  } $} { else } ${
	(phylumdeclaration)phydecl
  $}	
					];

PhylumDeclaration( *, *, PredefinedAlternatives( * ), * ),
PhylumDeclaration( *, *, Emptyproductionblock(), * )
					-> [view_gen_unparsedefs_default_c: {/*EMPTY*/} ];
PhylumDeclaration( *, *, ListAlternatives( a, * ), * ),
PhylumDeclaration( *, *, NonlistAlternatives( a ), * )
					-> [view_gen_unparsedefs_default_c:
/* if _all_ alternatives have _no_ arguments, then there is nothing to do
 * here, and can we skip (just as we skip for 'Alternative( *, Nilarguments() )'
 * in the rule for Consalternatives below).
 * However, as soon as there is at least one operator in the alternatives we
 * do have to generate code for it here.
 */
{ if (! f_all_alternatives_nullary( a )) } ${
"		switch((int)kc_p->prod_sel) {
"
	a
"		default:;}
"
  $}
					];
Nilalternatives()			-> [view_gen_unparsedefs_default_c: {/*EMPTY*/} ];
Consalternatives( Alternative( *, Nilarguments() ), ra )
					-> [view_gen_unparsedefs_default_c:
	ra
					 ];
Consalternatives( Alternative( oid, args ), ra )
					-> [view_gen_unparsedefs_default_c:
	ra
{ gl_operator = oid; }
"		case (int)sel_" oid ":
"
	args
"			break;
"
{ gl_operator = 0; }
					];
Consarguments( a, rargs )		-> [view_gen_unparsedefs_default_c:
	rargs
"			unparse_" a "( kc_p->u." (ID)gl_operator "." a "_" $0->seqnr ", kc_printer, kc_current_view );
"
					];
Consunparsedeclsinfo( Unparsedeclinfo( Nilpatternrepresentation(), bindings, uc ), * )
					-> [view_gen_unparsedefs_other_c view_gen_unparsedefs_default_c:
	bindings:view_unp_bindings
	uc
					];
Consunparsedeclsinfo( Unparsedeclinfo( p , bindings, uc ), r_rri)
					-> [view_gen_unparsedefs_other_c view_gen_unparsedefs_default_c:
"		if ((" p:view_unp_predicates ")) {
"
	bindings:view_unp_bindings
{ cf_pushoperator( f_operatorofpatternrepresentation( p ) ); }

	uc
{ cf_popoperator(); }
"		} else
"
	r_rri
					];
UnparseClause( *, ui )			-> [view_gen_unparsedefs_other_c view_gen_unparsedefs_default_c:
	ui
					];
Nilunparseitems()			-> [view_gen_unparsedefs_other_c view_gen_unparsedefs_default_c: {/*EMPTY*/} ];
Consunparseitems( a_ui, r_ui )		-> [view_gen_unparsedefs_other_c view_gen_unparsedefs_default_c:
	r_ui
	a_ui
					];
NoViewname()				-> [view_gen_unparsedefs_other_c view_gen_unparsedefs_default_c:
	"kc_current_view"
					];
YesViewname( v )			-> [view_gen_unparsedefs_other_c view_gen_unparsedefs_default_c:
	v
					];
UnpStr( a_CexpressionDQ, a_vnameopt )	-> [view_gen_unparsedefs_other_c view_gen_unparsedefs_default_c:
{ ug_viewnameopt = a_vnameopt; }
{ (*kc_printer)( "", view_no_of_printed_string_chars_reset ); }
"		{ (*kc_printer)(\"" a_CexpressionDQ:view_gen_unpstr_c "\", " a_vnameopt "); }
"
{ ug_viewnameopt = 0; }
					];
ConsCexpressionDQ( cedqe, cedq )	-> [view_gen_unpstr_c: cedq cedqe ];
NilCexpressionDQ()			-> [view_gen_unpstr_c: {/*EMPTY*/} ];
CExpressionDQPart( cs )			-> [view_gen_unpstr_c: cs ];
CExpressionDQNl( i )			-> [view_gen_unpstr_c:
{ char *nl_string = f_mkquotednls( i ); }
	(charptr)nl_string
					];

UnpSubexpr( sub, a_vnameopt )		-> [view_gen_unparsedefs_other_c view_gen_unparsedefs_default_c:
{ ID phy = f_typeofunpsubterm( sub, cf_topoperator() ); }
"		unparse_" (ID)phy "(" sub ", kc_printer, " a_vnameopt ");
"
					];
UnpSubTerm( st )			-> [view_gen_unparsedefs_other_c view_gen_unparsedefs_default_c:
	st
					];
UnpDollarvarTerm( * )			-> [view_gen_unparsedefs_other_c view_gen_unparsedefs_default_c:
	$0:view_gen_initializephyla_c
					];
UnpSubAttr( st, a_unpattributes )	-> [view_gen_unparsedefs_other_c view_gen_unparsedefs_default_c:
	st a_unpattributes
					];
UnpDollarvarAttr( *, a_unpattributes )	-> [view_gen_unparsedefs_other_c view_gen_unparsedefs_default_c:
	$0:view_gen_initializephyla_c a_unpattributes
					];
UnpCastedVariable( *, a_id )		-> [view_gen_unparsedefs_other_c view_gen_unparsedefs_default_c:
	a_id
					];
UnpCtext( ct )				-> [view_gen_unparsedefs_other_c view_gen_unparsedefs_default_c:
"#line " ct->line " \"" ct->file:view_filename "\"
"
ct:view_gen_initializephyla_c
(charptr)g_emptystring:view_printer_outputfileline
					];
UnpBody( a_unparseitems )		-> [view_gen_unparsedefs_other_c view_gen_unparsedefs_default_c:
	"{
"
	a_unparseitems
	" }
"
					];
Nilunpattributes()			-> [view_gen_unparsedefs_other_c view_gen_unparsedefs_default_c: {/*EMPTY*/} ];
Consunpattributes( a_attr, r_attr )	-> [view_gen_unparsedefs_other_c view_gen_unparsedefs_default_c:
	r_attr "->" a_attr
					];
