home *** CD-ROM | disk | FTP | other *** search
- unit FrenchVb; { Listing 5-6 }
-
- interface
-
- type
-
- Person = ( fps, sps, tps, fpp, spp, tpp );
- Ending = array[fps..tpp] of string;
-
- const
- ER_Nominative : Ending
- = ( 'e', 'es', 'e', 'ons', 'ez', 'ent' );
- IR_Nominative : Ending
- = ( 'is', 'is', 'it', 'issons', 'issez', 'issent');
- RE_Nominative : Ending
- = ( 's', 's', '', 'ons', 'ez', 'ent');
-
- type
- Verb = object
- Infinitive : string;
- Root : string;
- constructor Init( TheVerb : string );
- function VerbForm( E : Person ) : string; virtual;
- procedure ConjugateVerb;
- end;
-
- RE_Verb = object( Verb )
- function VerbForm( E : Person ) : string; virtual;
- end;
-
-
- IR_Verb = object( Verb )
- function VerbForm( E : Person ) : string; virtual;
- end;
-
- ER_Verb = object( Verb )
- function VerbForm( E : Person ) : string; virtual;
- end;
-
- implementation
-
- constructor Verb.Init( TheVerb : string );
- begin
- Infinitive := TheVerb;
- Root := Copy( TheVerb, 1, (Length(TheVerb) - 2) );
- end;
-
- { This function is needed to be able to compile the
- .ConjugateVerb method }
- function Verb.VerbForm( E: Person ) : string;
- begin
- VerbForm := '';
- end;
-
- function ER_Verb.VerbForm( E : Person ) : string;
- begin
- VerbForm := Concat( Root, ER_Nominative[E] )
- end;
-
- function IR_Verb.VerbForm( E : Person ) : string;
- begin
- VerbForm := Concat( Root, IR_Nominative[E] )
- end;
-
- function RE_Verb.VerbForm( E : Person ) : string;
- begin
- VerbForm := Concat( Root, RE_Nominative[E] )
- end;
-
- procedure Verb.ConjugateVerb;
- begin
- writeln( 'Conjugation of the verb ', Infinitive, ':' );
- writeln( 'je ', VerbForm( fps ) );
- writeln( 'tu ', VerbForm( sps ) );
- writeln( 'il ', VerbForm( tps ) );
- writeln( 'nous ', VerbForm( fpp ) );
- writeln( 'vous ', VerbForm( spp ) );
- writeln( 'ils ', VerbForm( tpp ) );
- end;
-
-
- end.
-
- { end of Listing 5-6 }