%{ CODE HEADER
/*
 * The Termprocessor Kimwitu
 *
 * Copyright (c) 1991 University of Twente, Dept TIOS.
 * All rights reserved.
 *
 */
%}
/*
 * extocc.k
 */
%{
#if ! (defined(lint) || defined(SABER) || defined(CODECENTER))
  static char extocc_kAccesSid[] = "@(#)$Id: extocc.k,v 1.13 1997/03/05 15:36:49 belinfan Rel $";
#endif
%}
/***************************************************************************/

void v_extendoccur( id, it) ID id; IDtype it;
{
    do_v_extendoccur( id, it, True);
}
void v_extendoccur_nowarning( id, it) ID id; IDtype it;
{
    do_v_extendoccur( id, it, False);
}
static void do_v_extendoccur( id, it, warn) ID id; IDtype it; boolean warn;
{
    id->type = it;
    with( it ) {
	ITUnknown(): {
	     with( id ) {
		Id( * ): {/*EMPTY*/}
	}   }
	ITPredefinedBigatomPhylum( * ),
	ITPredefinedPhylum( * ): {
	     with( id ) {
		Id( uid ): {
		    with( uid->type ) {
			ITUnknown(): { uid->type = it; uid->line = id->line; uid->file = id->file; }
			ITPredefinedBigatomPhylum( * ),
			ITPredefinedPhylum( * ): {/*EMPTY*/}
			ITUserPhylum( * ): { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "illegal extension of phylum:", id ))); }
			default: { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1t1S1ID( "illegal extension of", uid->type, "as phylum:", id ))); }
	}   }   }   }
	ITUserPhylum( * ): {
	     with( id ) {
		Id( uid ): {
		    with( uid->type ) {
			ITUnknown(): { uid->type = it; uid->line = id->line; uid->file = id->file; }
			ITUserPhylum( * ): {/*EMPTY*/}
			ITPredefinedBigatomPhylum( * ),
			ITPredefinedPhylum( * ): { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "illegal extension of predefined phylum:", id ))); }
			default: { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1t1S1ID( "illegal extension of", uid->type, "as phylum:", id ))); }
	}   }   }   }
	ITPredefinedOperator( *, * ): {
	     with( id ) {
		Id( uid ): {
		    with( uid->type ) {
			ITUnknown(): { uid->type = it; uid->line = id->line; uid->file = id->file; }
			ITPredefinedOperator( *, * ): { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "illegal extension of predefined operator:", id ))); }
			ITUserOperator( *, * ): { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "illegal extension of operator:", id ))); }
			default: { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1t1S1ID( "illegal extension of", uid->type, "as operator:", id ))); }
	}   }   }   }
	ITUserOperator( *, * ): {
	     with( id ) {
		Id( uid ): {
		    with( uid->type ) {
			ITUnknown(): { uid->type = it; uid->line = id->line; uid->file = id->file; }
			ITPredefinedOperator( *, * ): { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "illegal extension of predefined operator:", id ))); }
			ITUserOperator( *, * ): { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "illegal redefinition of operator:", id ))); }
			default: { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1t1S1ID( "illegal extension of", uid->type, "as operator:", id ))); }
	}   }   }   }
	ITPredefinedStorageClass(): {
	     with( id ) {
		Id( uid ): {
		    with( uid->type ) {
			ITUnknown(): { uid->type = it; uid->line = id->line; uid->file = id->file; }
			ITPredefinedStorageClass(): { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "illegal extension of predefined storage class:", id ))); }
			ITStorageClass(): { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "illegal extension of storage class:", id ))); }
			default: { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1t1S1ID( "illegal extension of", uid->type, "as storage class:", id ))); }
	}   }   }   }
	ITStorageClass(): {
	     with( id ) {
		Id( uid ): {
		    with( uid->type ) {
			ITUnknown(): { uid->type = it; uid->line = id->line; uid->file = id->file; }
			ITPredefinedStorageClass(): {
			  /*EMPTY*/
			  /**********
			   v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "illegal extension of predefined storage class:", id )));
			   **********/
			}
			ITStorageClass(): {/*EMPTY*/}
			  /**********
			default: { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1t1S1ID( "illegal extension of", uid->type, "as storage class:", id ))); }
			   **********/
	}   }   }   }
	ITUserFunction( * ): {
	     with( id ) {
		Id( uid ): {
		    with( uid->type ) {
			ITUnknown(): { uid->type = it; uid->line = id->line; uid->file = id->file; }
			ITUserFunction( * ): { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "illegal extension of function:", id ))); }
			default: { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1t1S1ID( "illegal extension of", uid->type, "as function:", id ))); }
	}   }   }   }
	ITPredefinedUView(): {
	     with( id ) {
		Id( uid ): {
		    with( uid->type ) {
			ITUnknown(): { uid->type = it; uid->line = id->line; uid->file = id->file; }
			ITPredefinedUView(): { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "illegal extension of predefined unparse view:", id ))); }
			ITUserUView(): { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "illegal extension of unparse view:", id ))); }
			default: { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1t1S1ID( "illegal extension of", uid->type, "as view:", id ))); }
	}   }   }   }
	ITUserUView(): {
	     with( id ) {
		Id( uid ): {
		    with( uid->type ) {
			ITUnknown(): { uid->type = it; uid->line = id->line; uid->file = id->file; }
			ITPredefinedUView(): {
			    if (warn) v_report(Warning( FileLine( id->file, id->line ), Problem1S1ID( "superflous redeclaration of predefined unparse view:", id )));
			}
			ITUserUView(): {
			    if (warn) v_report(Warning( FileLine( id->file, id->line ), Problem1S1ID( "superflous redeclaration of unparse view:", id )));
			}
			default: { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1t1S1ID( "illegal extension of", uid->type, "as unparse view:", id ))); }
	}   }   }   }
	ITPredefinedRView(): {
	     with( id ) {
		Id( uid ): {
		    with( uid->type ) {
			ITUnknown(): { uid->type = it; uid->line = id->line; uid->file = id->file; }
			ITPredefinedRView(): { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "illegal extension of predefined rewrite view:", id ))); }
			ITUserRView(): { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "illegal extension of rewrite view:", id ))); }
			default: { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1t1S1ID( "illegal extension of", uid->type, "as view:", id ))); }
	}   }   }   }
	ITUserRView(): {
	     with( id ) {
		Id( uid ): {
		    with( uid->type ) {
			ITUnknown(): { uid->type = it; uid->line = id->line; uid->file = id->file; }
			ITPredefinedRView(): {
			    if (warn) v_report(Warning( FileLine( id->file, id->line ), Problem1S1ID( "superflous redeclaration of predefined rewrite view:", id )));
			}
			ITUserRView(): {
			    if (warn) v_report(Warning( FileLine( id->file, id->line ), Problem1S1ID( "superflous redeclaration of rewrite view:", id )));
			}
			default: { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1t1S1ID( "illegal extension of", uid->type, "as rewrite view:", id ))); }
	}   }   }   }
	ITPatternVariable( t_id, t_scope ): {
	     with( id ) {
		Id( uid ): {
		    with( uid->type ) {
			ITUnknown(): { uid->type = it; uid->line = id->line; uid->file = id->file; }
			ITPatternVariable( id_id, id_scope ): {
			    if (t_scope == id_scope) {
				if (! eq_ID( t_id, id_id )) {
				    v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID1S1ID1S1ID( "type mismatch in redefinition of pattern variable:", id, "old type", id_id, "new type", t_id )));
				}
			    } else {
				uid->scopeinfo = Consscopetypefilelinestack( ScopeTypeFileLine(t_scope, uid->type, uid->file, uid->line), uid->scopeinfo );
				uid->type = it;
				uid->line = id->line;
				uid->file = id->file;
			}   }
			default: { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1t1S1ID( "illegal extension of", uid->type, "as pattern variable:", id ))); }
	}   }   }   }
}   }

