|
|
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 - metrics - download
Length: 10240 (0x2800)
Types: Ada Source
Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Itf01, seg_0468c8
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦5a81ac88f⟧ »Space Info Vol 1«
└─⟦this⟧
with Text_Io, String_Utilities, Unbounded_String;
package body Itf01 is
package Infinite_String is new Unbounded_String (50);
type States is (State_Start, State_Good_Id, State_Bad_Id, State_Found);
Maxtaille : constant Positive := 100;
Maxword : constant Positive := 3;
Tab_Value : array (1 .. Maxword) of Infinite_String.Variable_String;
Tab_Status : array (1 .. Maxword) of Status;
Word_Number : Natural := 0;
Current_Status : Status;
Current_Value : Infinite_String.Variable_String;
function Get_Value (I : in Positive) return String is
begin
return Infinite_String.Image (Tab_Value (I));
end Get_Value;
function Get_Status (I : in Positive) return Status is
begin
return Tab_Status (I);
end Get_Status;
procedure Initialize is
begin
for I in 1 .. Maxword loop
Infinite_String.Free (Tab_Value (I));
end loop;
end Initialize;
function Isalpha (C : in Character) return Boolean is
begin
return ((C in 'a' .. 'z') or (C in 'A' .. 'Z') or (C = '_'));
end Isalpha;
function Isdigit (C : in Character) return Boolean is
begin
return (C in '0' .. '9');
end Isdigit;
function Isseparator (C : in Character) return Boolean is
begin
return (C = ' ');
end Isseparator;
function Get_Command return Infinite_String.Variable_String is
Source : String (1 .. Maxtaille);
Source1 : Infinite_String.Variable_String;
Prompt_Character : constant Character := '>';
Long : Positive;
begin
Infinite_String.Free (Source1);
Text_Io.Put_Line ("enter votre action :");
Text_Io.Put (Prompt_Character);
Text_Io.Put (Prompt_Character);
Text_Io.Get_Line (Source, Long);
Source1 := Infinite_String.Value (Source);
-- Source1 := Infinite_String.Value
-- (String_Utilities.Strip_Trailing (Source);
Text_Io.Put (Infinite_String.Image (Source1));
-- source1 n'a ainsi plus de blanc a la fin
return Source1;
end Get_Command;
procedure Get_Identifier (Source : in Infinite_String.Variable_String;
Index : in out Natural) is
Current_State : States;
Readed_Character : Character;
begin
Infinite_String.Free (Current_Value);
Current_State := State_Start;
Current_Status := Invalid;
while ((Current_State /= State_Found) and then
(Index <= Infinite_String.Length (Source))) loop
Readed_Character := Infinite_String.Char_At (Source, Index);
Index := Index + 1;
case Current_State is
when State_Start =>
if (Isseparator (Readed_Character)) then
Current_State := State_Start;
Text_Io.Put_Line (" " & Positive'Image (Index) & " " &
States'Image (Current_State));
-- Index := Index + 1;
else
if (not Isalpha (Readed_Character)) then
Current_State := State_Bad_Id;
Infinite_String.Append
(Current_Value, Readed_Character);
Text_Io.Put_Line
(" " & Positive'Image (Index) & " " &
States'Image (Current_State));
-- Index := Index + 1;
else
Current_State := State_Good_Id;
Text_Io.Put_Line
(" " & Positive'Image (Index) & " " &
States'Image (Current_State));
-- Index := Index + 1;
end if;
end if;
when State_Bad_Id =>
if (not Isseparator (Readed_Character)) then
Current_State := State_Bad_Id;
Infinite_String.Append
(Current_Value, Readed_Character);
Text_Io.Put_Line (" " & Positive'Image (Index) & " " &
States'Image (Current_State));
-- Index := Index + 1;
else
Current_State := State_Found;
Current_Status := Invalid;
Word_Number := Word_Number + 1;
end if;
when State_Good_Id =>
if ((Isdigit (Readed_Character)) or
(Isalpha (Readed_Character))) then
Current_Status := Valid;
Current_State := State_Good_Id;
Infinite_String.Append
(Current_Value, Readed_Character);
Text_Io.Put_Line (" " & Positive'Image (Index) & " " &
States'Image (Current_State));
-- Index := Index + 1;
else
Current_State := State_Found;
Current_Status := Valid;
Word_Number := Word_Number + 1;
end if;
when others =>
null;
end case;
end loop;
if Index > Infinite_String.Length (Source) then
case Current_State is
when State_Good_Id =>
Current_State := State_Found;
Current_Status := Valid;
when State_Bad_Id =>
Current_State := State_Found;
Current_Status := Invalid;
when others =>
null;
end case;
end if;
end Get_Identifier;
procedure Next_Command is
Index : Natural := 1;
Source : Infinite_String.Variable_String;
begin
Initialize;
Source := Get_Command;
while (Index <= Infinite_String.Length (Source)) loop
Get_Identifier (Source, Index);
Text_Io.Put (" " & Infinite_String.Image (Current_Value));
if (Word_Number > Maxword) then
raise Word_Overflow;
end if;
Text_Io.Put (" " & Natural'Image (Word_Number));
Tab_Value (Word_Number) := Current_Value;
Text_Io.Put (" " & Infinite_String.Image (Tab_Value (Word_Number)));
Tab_Status (Word_Number) := Current_Status;
end loop;
end Next_Command;
end Itf01;
nblk1=9
nid=8
hdr6=10
[0x00] rec0=21 rec1=00 rec2=01 rec3=020
[0x01] rec0=21 rec1=00 rec2=05 rec3=040
[0x02] rec0=1a rec1=00 rec2=04 rec3=052
[0x03] rec0=12 rec1=00 rec2=02 rec3=00a
[0x04] rec0=13 rec1=00 rec2=06 rec3=050
[0x05] rec0=16 rec1=00 rec2=09 rec3=036
[0x06] rec0=21 rec1=00 rec2=07 rec3=014
[0x07] rec0=02 rec1=00 rec2=03 rec3=000
[0x08] rec0=02 rec1=00 rec2=03 rec3=000
tail 0x215433d0e86515cc27fb5 0x42a00088462060003
Free Block Chain:
0x8: 0000 00 00 00 04 80 01 20 01 69 6e 67 2e 56 61 6c 75 ┆ ing.Valu┆