|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - download
Length: 10240 (0x2800) Types: Ada Source Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Interpreteur, seg_048a86
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000 └─ ⟦5a81ac88f⟧ »Space Info Vol 1« └─⟦this⟧
with Text_Io; with String_Utilities; with Quate; use Quate; with Actions, Message_D_Erreur; with Verbs, Complements; package body Interpreteur is Premier_Passage : Boolean := True; function Est_Predefini (Mot_Lu : String) return Boolean is Un_Mot : String (1 .. L_Mot) := (others => ' '); begin if L_Mot >= Mot_Lu'Last then Un_Mot (Mot_Lu'Range) := Mot_Lu; String_Utilities.Lower_Case (Un_Mot); for I in Verbes_Predefinis'Range loop if Un_Mot = Verbes_Predefinis (I) then return True; end if; end loop; end if; return False; end Est_Predefini; function Fin_De_Jeu (Mot_Lu : String) return Boolean is Lg_Fin : constant Integer := 4; Un_Mot : String (1 .. Lg_Fin) := (others => ' '); begin if Lg_Fin >= Mot_Lu'Last then Un_Mot (Mot_Lu'Range) := Mot_Lu; String_Utilities.Lower_Case (Un_Mot); if Un_Mot = "stop" then return True; else return False; end if; else return False; end if; end Fin_De_Jeu; function Saisie_Queac return String is Une_Queac : String (1 .. 255) := (others => ' '); Length : Natural := 0; begin Text_Io.Set_Input (Text_Io.Standard_Input); Text_Io.Put_Line (""); Text_Io.Put ("Queac > "); while Length = 0 loop Text_Io.Get_Line (Une_Queac, Length); end loop; return Une_Queac (1 .. Length); end Saisie_Queac; procedure Extraction_Mot (Une_Chaine : in out My_String.Variable_String; Un_Mot : in out My_String.Variable_String) is Decoupage : My_String.Variable_String; Length1 : Natural; begin My_String.Copy (Une_Chaine, String_Utilities.Strip_Leading (My_String.Image (Une_Chaine))); Length1 := String_Utilities.Locate (' ', My_String.Image (Une_Chaine)); if Length1 = 0 then Length1 := My_String.Length (Une_Chaine); end if; My_String.Copy (Decoupage, String_Utilities.Strip_Trailing (My_String.Image (Une_Chaine) (1 .. Length1))); My_String.Copy (Une_Chaine, String_Utilities.Strip_Trailing (My_String.Image (Une_Chaine) (Length1 + 1 .. My_String.Length (Une_Chaine)))); My_String.Free (Un_Mot); My_String.Append (Un_Mot, Decoupage); end Extraction_Mot; function Traite_Queac (La_Cde : String) return Type_De_Demande is Reponse, Copy_Cde : My_String.Variable_String; Reconnu : Boolean := False; Add_Ok : Boolean := True; Etat_Jeu : Type_De_Demande; begin My_String.Append (Copy_Cde, La_Cde); Etat_Jeu := Sans; Recherche: while (My_String.Length (Copy_Cde) /= 0) and (Add_Ok) loop Extraction_Mot (Copy_Cde, Reponse); Reconnu := False; case Etat_Jeu is when Sans => if Fin_De_Jeu (My_String.Image (Reponse)) then Etat_Jeu := Fin_De_Jeu; exit Recherche; else if Est_Predefini (My_String.Image (Reponse)) then Reconnu := True; Etat_Jeu := Predefinie; else if Verbs.Exists (My_String.Image (Reponse)) then Reconnu := True; Etat_Jeu := Action; else if Complements.Exists (My_String.Image (Reponse)) then Reconnu := True; if Complements."=" (Complements.Kind_Of (My_String.Image (Reponse)), Complements.Way) then Etat_Jeu := Predefinie; else Etat_Jeu := Action; end if; end if; end if; end if; end if; when Predefinie => if Est_Predefini (My_String.Image (Reponse)) then Reconnu := True; Etat_Jeu := Predefinie; else if Complements.Exists (My_String.Image (Reponse)) then Reconnu := True; Etat_Jeu := Predefinie; end if; end if; when Action => if Complements.Exists (My_String.Image (Reponse)) then Reconnu := True; Etat_Jeu := Action; end if; when Fin_De_Jeu => Etat_Jeu := Fin_De_Jeu; -- erreur ?... end case; if Reconnu then Add_Ok := Actions.Add (My_String.Image (Reponse)); else Message_D_Erreur (1); end if; end loop Recherche; return Etat_Jeu; end Traite_Queac; function Analyser return Type_De_Demande is begin Actions.Reset; return Traite_Queac (Saisie_Queac); end Analyser; end Interpreteur;
nblk1=9 nid=9 hdr6=10 [0x00] rec0=21 rec1=00 rec2=01 rec3=058 [0x01] rec0=1e rec1=00 rec2=07 rec3=050 [0x02] rec0=01 rec1=00 rec2=02 rec3=036 [0x03] rec0=18 rec1=00 rec2=04 rec3=010 [0x04] rec0=13 rec1=00 rec2=03 rec3=040 [0x05] rec0=12 rec1=00 rec2=08 rec3=048 [0x06] rec0=15 rec1=00 rec2=05 rec3=034 [0x07] rec0=0d rec1=00 rec2=06 rec3=000 [0x08] rec0=81 rec1=42 rec2=00 rec3=004 tail 0x21545fa02865a5d706a2b 0x42a00088462060003 Free Block Chain: 0x9: 0000 00 00 00 04 80 01 20 01 02 03 04 05 06 07 08 09 ┆ ┆