|
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: 18432 (0x4800) Types: Ada Source Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Package_Database, seg_026ced
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000 └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« └─⟦this⟧
------------------------------------------------------------------------------- with Umps_Defs; with Text_Io; with Wild_String; with Database; with Slot; with Set; with Request; package body Package_Database is --------------------------------------------------------------------------- function Create (Sender : Umps_Defs.Behavior_Number; Handler : Umps_Defs.Behavior_Number; Method : String) return Request.Element is Rq : Request.Element; begin Request.Add_Sender (Sender, Rq); Request.Add_Handler (Handler, Rq); Request.Add_Method (Method, Rq); return Rq; end Create; --------------------------------------------------------------------------- procedure Test_Remplissage is Rq : Request.Element; Rq2 : Request.Element; Param : Set.Object; use Text_Io; begin Put_Line ("-- Destruction Database"); Database.Destroy; Put_Line ("-- Ouverture Database"); Database.Open; Put_Line ("-- Database Vide"); Database.Display; New_Line; Put_Line ("-- Ajout de : Open(File : in string := ""toto.c"";"); Put_Line (" Rights : in string := ""rw"";"); Put_Line (" Is_Open : out integer);"); Rq := Create (1, Umps_Defs.Any_Behaviors, "Open"); Request.Add_Param (Slot.Make ("File", "toto.c"), Rq); Request.Add_Param (Slot.Make ("Rights", "rw"), Rq); Request.Add_Param (Slot.Make ("Is_Open", Slot.Boolean), Rq); Database.Put (Rq); Database.Display; New_Line; Put_Line ("-- Ajout de : Close(File : string;"); Put_Line (" Is_Open : integer);"); Rq := Create (2, Umps_Defs.Any_Behaviors, "Close"); Request.Add_Param (Slot.Make ("File", Slot.String), Rq); Request.Add_Param (Slot.Make ("Is_ok", Slot.Integer), Rq); Database.Put (Rq); Database.Display; New_Line; Put_Line ("-- Ajout de : Put(The_Car : character := 'a';"); Put_Line (" File : string := ""toto.c"");"); Rq := Create (2, Umps_Defs.Any_Behaviors, "Put"); Request.Add_Param (Slot.Make ("The_Car", 'a'), Rq); Request.Add_Param (Slot.Make ("File", "toto.c"), Rq); Database.Put (Rq); Database.Display; New_Line; Put_Line ("-- Ajout de : Date(Day : integer;"); Put_Line (" Month : integer;"); Put_Line (" Year : integer );"); Rq := Create (4, Umps_Defs.Any_Behaviors, "Date"); Request.Add_Param (Slot.Make ("Day", Slot.Integer), Rq); Request.Add_Param (Slot.Make ("Month", Slot.Integer), Rq); Request.Add_Param (Slot.Make ("Year", Slot.Integer), Rq); Database.Put (Rq); Database.Display; New_Line; Put_Line ("-- Ajout de : Date(Time : string);"); Rq := Create (5, Umps_Defs.Any_Behaviors, "Date"); Request.Add_Param (Slot.Make ("Time", Slot.String), Rq); Database.Put (Rq); Database.Display; New_Line; end Test_Remplissage; --------------------------------------------------------------------------- procedure Test_Interrogation is Iter : Database.Iter_Request; Rq : Request.Element; Action : Database.Actions; State : Database.States; Param : Set.Object; use Text_Io; begin Put_Line ("-- Recherche d'une requete faisant date"); Rq := Create (Umps_Defs.Any_Behaviors, Umps_Defs.Any_Behaviors, "Date"); Database.Init (Iter, Rq, Slot.On_None, Database.Performed, Database.Unlock); Research_Each_Element: while (not Database.Done (Iter)) loop Database.Value (Iter, Rq, Action, State); Request.Display (Rq); Put_Line ("-- Action : " & Database.Actions'Image (Action)); Put_Line ("-- State : " & Database.States'Image (State)); Database.Next (Iter); end loop Research_Each_Element; New_Line; Put_Line ("-- Recherche d'une requete faisant Date(Day, Month, Year)"); Rq := Create (Umps_Defs.Any_Behaviors, Umps_Defs.Any_Behaviors, "Date"); Request.Add_Param (Slot.Make ("Day", Slot.Void), Rq); Request.Add_Param (Slot.Make ("Month", Slot.Void), Rq); Request.Add_Param (Slot.Make ("Year", Slot.Void), Rq); Database.Init (Iter, Rq, Slot.On_Name, Database.Performed, Database.Unlock); Research_Element: while (not Database.Done (Iter)) loop Database.Value (Iter, Rq, Action, State); Request.Display (Rq); Put_Line ("-- Action : " & Database.Actions'Image (Action)); Put_Line ("-- State : " & Database.States'Image (State)); Database.Next (Iter); end loop Research_Element; New_Line; Put_Line ("-- Recherche d'une requete faisant Date(Day : integer, Month : string, Year: integer)"); Rq := Create (Umps_Defs.Any_Behaviors, Umps_Defs.Any_Behaviors, "Date"); Request.Add_Param (Slot.Make ("Day", Slot.Integer), Rq); Request.Add_Param (Slot.Make ("Month", Slot.String), Rq); Request.Add_Param (Slot.Make ("Year", Slot.Integer), Rq); Database.Init (Iter, Rq, Slot.On_Kind, Database.Performed, Database.Unlock); while (not Database.Done (Iter)) loop Database.Value (Iter, Rq, Action, State); Request.Display (Rq); Put_Line ("-- Action : " & Database.Actions'Image (Action)); Put_Line ("-- State : " & Database.States'Image (State)); Database.Next (Iter); end loop; New_Line; Put_Line ("-- Recherche d'une requete faisant Date(Day : integer, Month : integer, Year: integer)"); Rq := Create (Umps_Defs.Any_Behaviors, Umps_Defs.Any_Behaviors, "Date"); Request.Add_Param (Slot.Make ("Day", Slot.Integer), Rq); Request.Add_Param (Slot.Make ("Month", Slot.Integer), Rq); Request.Add_Param (Slot.Make ("Year", Slot.Integer), Rq); Database.Init (Iter, Rq, Slot.On_Kind, Database.Performed, Database.Unlock); while (not Database.Done (Iter)) loop Database.Value (Iter, Rq, Action, State); Request.Display (Rq); Put_Line ("-- Action : " & Database.Actions'Image (Action)); Put_Line ("-- State : " & Database.States'Image (State)); Database.Next (Iter); end loop; New_Line; Put_Line ("-- Recherche d'une requete faisant Open(""toto.c"", ""rw"", Result : boolean)"); Rq := Create (Umps_Defs.Any_Behaviors, Umps_Defs.Any_Behaviors, "Open"); Request.Add_Param (Slot.Make ("File", "toto.c"), Rq); Request.Add_Param (Slot.Make ("Rights", "rw"), Rq); Request.Add_Param (Slot.Make ("Is_Open", Slot.Boolean), Rq); Database.Init (Iter, Rq, Slot.On_Value, Database.Performed, Database.Unlock); while (not Database.Done (Iter)) loop Database.Value (Iter, Rq, Action, State); Request.Display (Rq); Put_Line ("-- Action : " & Database.Actions'Image (Action)); Put_Line ("-- State : " & Database.States'Image (State)); Database.Next (Iter); end loop; New_Line; Put_Line ("-- Recherche de toutes les requetes"); Rq := Create (Umps_Defs.Any_Behaviors, Umps_Defs.Any_Behaviors, "" & Wild_String.Wildcard.Question_Mark); Database.Init (Iter, Rq, Slot.On_None, Database.Performed, Database.Unlock); while (not Database.Done (Iter)) loop Database.Value (Iter, Rq, Action, State); Request.Display (Rq); Put_Line ("-- Action : " & Database.Actions'Image (Action)); Put_Line ("-- State : " & Database.States'Image (State)); Database.Next (Iter); end loop; end Test_Interrogation; --------------------------------------------------------------------------- procedure Test is use Text_Io; begin Put_Line ("---> Test Package Database"); New_Line; Put_Line ("-- Remplissage de la database"); Test_Remplissage; New_Line; Put_Line ("-- Test interrogation"); Test_Interrogation; New_Line; end Test; end Package_Database; -------------------------------------------------------------------------------
nblk1=11 nid=d hdr6=14 [0x00] rec0=23 rec1=00 rec2=01 rec3=03e [0x01] rec0=18 rec1=00 rec2=04 rec3=05a [0x02] rec0=17 rec1=00 rec2=0c rec3=05a [0x03] rec0=1d rec1=00 rec2=06 rec3=01a [0x04] rec0=14 rec1=00 rec2=0a rec3=032 [0x05] rec0=15 rec1=00 rec2=0f rec3=01e [0x06] rec0=14 rec1=00 rec2=11 rec3=07a [0x07] rec0=18 rec1=00 rec2=0b rec3=05a [0x08] rec0=1c rec1=00 rec2=10 rec3=002 [0x09] rec0=08 rec1=00 rec2=0e rec3=000 [0x0a] rec0=16 rec1=00 rec2=0e rec3=052 [0x0b] rec0=19 rec1=00 rec2=10 rec3=010 [0x0c] rec0=1b rec1=00 rec2=08 rec3=000 [0x0d] rec0=18 rec1=00 rec2=10 rec3=01e [0x0e] rec0=0e rec1=00 rec2=08 rec3=000 [0x0f] rec0=1b rec1=00 rec2=0f rec3=012 [0x10] rec0=0e rec1=00 rec2=10 rec3=000 tail 0x21520432a83aa676c27d8 0x42a00088462063c03 Free Block Chain: 0xd: 0000 00 08 00 04 80 01 20 01 02 03 04 05 06 07 08 74 ┆ t┆ 0x8: 0000 00 05 00 04 80 01 20 01 02 20 52 65 71 75 65 73 ┆ Reques┆ 0x5: 0000 00 09 00 09 80 06 43 6c 6f 73 65 22 06 32 20 20 ┆ Close" 2 ┆ 0x9: 0000 00 07 03 fc 80 0c 28 50 61 72 61 6d 2c 20 52 71 ┆ (Param, Rq┆ 0x7: 0000 00 03 00 09 80 06 50 61 72 61 6d 20 06 07 08 09 ┆ Param ┆ 0x3: 0000 00 02 03 fc 80 07 28 4c 69 73 74 29 3b 07 00 32 ┆ (List); 2┆ 0x2: 0000 00 00 03 fc 00 26 20 20 20 20 2d 2d 20 20 20 20 ┆ & -- ┆