%{ CODE HEADER /* * The Termprocessor Kimwitu * * Copyright (c) 1991 University of Twente, Dept TIOS. * All rights reserved. * */ %} /* * defocc.k */ %{ #if ! (defined(lint) || defined(SABER) || defined(CODECENTER)) static char defocc_kAccesSid[] = "@(#)$Id: defocc.k,v 1.9 1996/10/14 11:12:31 belinfan Rel $"; #endif %} /***************************************************************************/ %{ KC_TYPES_HEADER #include "defocc.h" %} /***************************************************************************/ /* * This can maybe done easier using an addional (only for pattern-matching) phylum * twoIDtype: TwoIDtype( IDtype IDtype ); * then we can match the combinations of both subterms in one pattern, * allowing more wildcarding and use of several patterns for the same action * (in the new release) * such a trick (using two in patterns) might be more generally useful * when we want to compare two things of the same type! */ void v_defoccur( id, it) ID id; IDtype it; { id->type = it; with( it ) { ITUnknown(): {/*EMPTY*/} ITPredefinedBigatomPhylum( * ), ITPredefinedPhylum( * ): { with( id ) { Id( uid ): { with( uid->type ) { ITUnknown(): { uid->type = it; uid->line = id->line; uid->file = id->file; } ITPredefinedBigatomPhylum( * ), ITPredefinedPhylum( * ): { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "illegal predefinition of predefined phylum:", id ))); } ITUserPhylum( * ): { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "illegal predefinition of phylum:", id ))); } default: { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1t1S1ID( "illegal predefinition 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; } ITPredefinedBigatomPhylum( * ), ITPredefinedPhylum( * ): { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "illegal redefinition of predefined phylum:", id ))); } ITUserPhylum( * ): { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "illegal redefinition of phylum:", id ))); } default: { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1t1S1ID( "illegal redefinition 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 predefinition of predefined operator:", id ))); } ITUserOperator( *, * ): { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "illegal predefinition of operator:", id ))); } default: { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1t1S1ID( "illegal predefinition 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 redefinition 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 redefinition 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 predefinition of predefined storage class:", id ))); } ITStorageClass(): { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "illegal predefinition of storage class:", id ))); } default: { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1t1S1ID( "illegal predefinition 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(): { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "illegal redefinition of predefined storage class:", id ))); } ITStorageClass(): { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "illegal redefinition of storage class:", id ))); } default: { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1t1S1ID( "illegal redefinition of ", uid->type, "as storage class", id ))); } } } } } ITUserFunction( it_fnc ): { with( id ) { Id( uid ): { with( uid->type ) { ITUnknown(): { uid->type = it; uid->line = id->line; uid->file = id->file; } ITUserFunction( GlobalFn() ): { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "illegal redefinition of global function:", id ))); } ITUserFunction(LocalFn( * ) ): { with( it_fnc ) { GlobalFn(): { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "illegal redefinition of local function:", id ))); } LocalFn( * ): { if (eq_casestring( uid->file, id->file )) { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "illegal redefinition of local function:", id ))); } } } } default: { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1t1S1ID( "illegal redefinition 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 predefinition of predefined unparse view:", id ))); } ITUserUView(): { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "illegal predefinition of unparse view:", id ))); } default: { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1t1S1ID( "illegal predefinition of ", uid->type, "as unparse view", id ))); } } } } } ITUserUView(): { 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 redefinition of predefined unparse view:", id ))); } ITUserUView(): { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "illegal redefinition of unparse view:", id ))); } default: { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1t1S1ID( "illegal redefinition 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 predefinition of predefined rewrite view:", id ))); } ITUserRView(): { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "illegal predefinition of rewrite view:", id ))); } default: { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1t1S1ID( "illegal predefinition of ", uid->type, "as rewrite view", id ))); } } } } } ITUserRView(): { 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 redefinition of predefined rewrite view:", id ))); } ITUserRView(): { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "illegal redefinition of rewrite view:", id ))); } default: { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1t1S1ID( "illegal redefinition of ", uid->type, "as rewrite view", id ))); } } } } } ITPatternVariable( *, i_s ): { with( id ) { Id( uid ): { with( uid->type ) { ITUnknown(): { uid->type = it; uid->line = id->line; uid->file = id->file; } ITPatternVariable( *, id_s ): { if (i_s == id_s) v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1ID( "illegal redefinition of pattern variable:", id ))); } default: { v_report(NonFatal( FileLine( id->file, id->line ), Problem1S1t1S1ID( "illegal redefinition of ", uid->type, "as pattern variable", id ))); } } } } } } }