CTD TypeCommonDerivation( // GET COMMON TYPE DERIVATION FOR TWO TYPES TYPE type1, // - type [1] (left) TYPE type2 ) // - type [2] (right) { CTD retn; // - return: CTD_... SCOPE scope1; // - scope for type[1] SCOPE scope2; // - scope for type[2] retn = CTD_NO; scope1 = TypeScope( StructType( type1 ) ); if( NULL != scope1 ) { scope2 = TypeScope( StructType( type2 ) ); if( scope1 == scope2 ) { retn = CTD_LEFT; } else if( NULL != scope2 ) { switch( ScopeDerived( scope1, scope2 ) ) { case DERIVED_YES : retn = CTD_LEFT; break; case DERIVED_YES_BUT_VIRTUAL : retn = CTD_LEFT_VIRTUAL; break; case DERIVED_YES_BUT_AMBIGUOUS : retn = CTD_LEFT_AMBIGUOUS; break; case DERIVED_YES_BUT_PRIVATE : retn = CTD_LEFT_PRIVATE; break; case DERIVED_YES_BUT_PROTECTED : retn = CTD_LEFT_PROTECTED; break; case DERIVED_NO : switch( ScopeDerived( scope2, scope1 ) ) { case DERIVED_YES : retn = CTD_RIGHT; break; case DERIVED_YES_BUT_VIRTUAL : retn = CTD_RIGHT_VIRTUAL; break; case DERIVED_YES_BUT_AMBIGUOUS : retn = CTD_RIGHT_AMBIGUOUS; break; case DERIVED_YES_BUT_PRIVATE : retn = CTD_RIGHT_PRIVATE; break; case DERIVED_YES_BUT_PROTECTED : retn = CTD_RIGHT_PROTECTED; break; case DERIVED_NO : retn = CTD_NO; break; } } } } return( retn ); }
static bool validateBase( // VALIDATE BASE CLASS OK SCOPE base_scope, // - scope for base class THROW_CNV_CTL *ctl ) // - control area { bool retb; // - true ==> generate conversion SCOPE thr_scope; // - scope for throw retb = false; thr_scope = TypeScope( ctl->src_type ); switch( ScopeDerived( thr_scope, base_scope ) ) { DbgDefault( "validateBase -- impossible derived type" ); case DERIVED_YES : case DERIVED_YES_BUT_VIRTUAL : ctl->offset = ThrowBaseOffset( thr_scope, base_scope ); retb = true; break; case DERIVED_YES_BUT_AMBIGUOUS : case DERIVED_YES_BUT_PRIVATE : case DERIVED_YES_BUT_PROTECTED : break; } return( retb ); }