|
|
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: 14336 (0x3800)
Types: Ada Source
Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Trame_Serie, seg_05191a
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦cfc2e13cd⟧ »Space Info Vol 2«
└─⟦this⟧
with File_Attente;
with Simple_Io;
package body Trame_Serie is
type Etat_Reception is (Etat_Attente, Etat_Traitement_Debut,
Etat_Traitement_Taille, Etat_Recoit,
Etat_Traitement_Fin, Etat_Trame_Dispo);
Occurence_Debut : Integer range 1 .. G_Defs.Debut_Trame'Length := 1;
Occurence_Fin : Integer range 1 .. G_Defs.Fin_Trame'Length := 1;
Occurence_Taille : Integer range 1 .. 2 := 1;
Octet_Poids_Fort, Octet_Poids_Faible : G_Defs.Byte;
Taille_A_Recevoir : Integer := 0;
Trame_Reception : Trame_Serie.Objet;
Etat_Recep : Etat_Reception := Etat_Attente;
procedure Raz (Trame : in out Objet) is
begin
Trame.Nbre_Elements := 0;
File.Raz (Trame.Contenu_Trame);
end Raz;
procedure Init is
begin
Etat_Recep := Etat_Attente;
Occurence_Debut := 1;
Occurence_Fin := 1;
Occurence_Taille := 1;
Taille_A_Recevoir := 0;
Raz (Trame => Trame_Reception);
end Init;
function Calcul_Longueur_Trame
(Octet_Poids_Fort : G_Defs.Byte;
Octet_Poids_Faible : G_Defs.Byte) return Integer is
Poids_Fort, Poids_Faible : Integer;
begin
Poids_Fort := G_Defs.Byte'Pos (Octet_Poids_Fort) * 256;
Poids_Faible := G_Defs.Byte'Pos (Octet_Poids_Faible);
return Poids_Fort + Poids_Faible;
end Calcul_Longueur_Trame;
procedure Deposer (Trame : in out Objet; Octet : G_Defs.Byte) is
begin
File.Enfiler (File_Attente => Trame.Contenu_Trame, Elem => Octet);
Trame.Nbre_Elements := Trame.Nbre_Elements + 1;
end Deposer;
function Taille (Trame : Objet) return Integer is
begin
return Trame.Nbre_Elements;
end Taille;
procedure Extraire_Trame_Reception (Trame_A_Lire : out G_Defs.Byte_String;
Taille : out Integer) is
I : Integer := 0;
begin
while File.Est_Vide (File_Attente => Trame_Reception.Contenu_Trame) =
False loop
I := I + 1;
Trame_A_Lire (I) :=
File.Element_Tete (File_Attente =>
Trame_Reception.Contenu_Trame);
File.Defiler (File_Attente => Trame_Reception.Contenu_Trame);
end loop;
Taille := I;
--
-- Apres extraction l'automate est de nouveau en Attente
Init;
end Extraire_Trame_Reception;
function Construire_Trame_Reception
(Octet : G_Defs.Byte) return Etat_Trame is
begin
case Etat_Recep is
--**********************
-- Etat Attente
--**********************
when Etat_Attente =>
if G_Defs.Egaux (Octet, G_Defs.Debut_Trame
(G_Defs.Debut_Trame'First)) then
Etat_Recep := Etat_Traitement_Debut;
Occurence_Debut := Occurence_Debut + 1;
end if;
--**************************
-- Etat Traitement_Debut
--**************************
when Etat_Traitement_Debut =>
if G_Defs.Egaux
(G_Defs.Debut_Trame (Occurence_Debut), Octet) then
if Occurence_Debut = G_Defs.Debut_Trame'Length then
Etat_Recep := Etat_Traitement_Taille;
return Debut;
else
Occurence_Debut := Occurence_Debut + 1;
end if;
else
Init;
end if;
--***************************
-- Etat traitement taille
--***************************
when Etat_Traitement_Taille =>
if Occurence_Taille = 1 then
Octet_Poids_Fort := Octet;
Occurence_Taille := Occurence_Taille + 1;
else
Taille_A_Recevoir := Calcul_Longueur_Trame
(Octet_Poids_Fort, Octet);
if (Taille_A_Recevoir > Taille_Trame) then
raise Taille_Trame_Trop_Grande;
else
Etat_Recep := Etat_Recoit;
end if;
end if;
--**********************
-- Etat recoit
--**********************
when Etat_Recoit =>
Deposer (Trame => Trame_Reception, Octet => Octet);
if Taille (Trame => Trame_Reception) = Taille_A_Recevoir then
Etat_Recep := Etat_Traitement_Fin;
-- IMPLEMENTER PARCE QUE PAS DE DELAI VALIDE
-- A SUPPRIMER AVEC TIMEOUT IMPLEMENTER
elsif G_Defs.Egaux (G_Defs.Fin_Trame (1), Octet) then
raise Erreur_Sur_Trame;
end if;
--*************************
-- Etat traitement_fin
--*************************
when Etat_Traitement_Fin =>
if G_Defs.Egaux (G_Defs.Fin_Trame (Occurence_Fin), Octet) =
True then
if Occurence_Fin = G_Defs.Fin_Trame'Length then
Etat_Recep := Etat_Trame_Dispo;
return Fin;
else
Occurence_Fin := Occurence_Fin + 1;
end if;
else
raise Erreur_Sur_Trame;
end if;
when Etat_Trame_Dispo =>
return Fin;
end case;
return Autre;
exception
when Erreur_Sur_Trame =>
Etat_Recep := Etat_Trame_Dispo;
Raz (Trame => Trame_Reception);
return Fin;
when Taille_Trame_Trop_Grande =>
Etat_Recep := Etat_Trame_Dispo;
Raz (Trame => Trame_Reception);
return Fin;
when others =>
Etat_Recep := Etat_Trame_Dispo;
Raz (Trame => Trame_Reception);
return Fin;
end Construire_Trame_Reception;
function Calcul_Taille_Chaine_Emission
(Taille : Integer) return Code_Taille_Trame is
Code_Retour : Code_Taille_Trame;
begin
Code_Retour (Code_Retour'First) := G_Defs.Byte (Taille / 256);
Code_Retour (Code_Retour'First + 1) := G_Defs.Byte (Taille mod 256);
return Code_Retour;
end Calcul_Taille_Chaine_Emission;
procedure Construire_Trame_Emission (Trame_Entree : in G_Defs.Byte_String;
Trame_Formattee : out Chaine_Trame;
Taille : out Integer) is
Code_Taille : Code_Taille_Trame;
begin
Taille := Trame_Entree'Length + G_Defs.Debut_Trame'Length +
G_Defs.Fin_Trame'Length + Code_Taille'Length;
Code_Taille := Calcul_Taille_Chaine_Emission
(Taille => Trame_Entree'Length);
for I in G_Defs.Debut_Trame'Range loop
Trame_Formattee (I) := G_Defs.Debut_Trame (I);
end loop;
for I in Code_Taille'Range loop
Trame_Formattee (I + G_Defs.Debut_Trame'Length) := Code_Taille (I);
end loop;
for I in Trame_Entree'Range loop
Trame_Formattee (G_Defs.Debut_Trame'Length +
I + Code_Taille'Length) := Trame_Entree (I);
end loop;
for I in G_Defs.Fin_Trame'Range loop
Trame_Formattee (G_Defs.Debut_Trame'Length +
Trame_Entree'Length + I + Code_Taille'Length) :=
G_Defs.Fin_Trame (I);
end loop;
end Construire_Trame_Emission;
begin
Init;
end Trame_Serie;
nblk1=d
nid=6
hdr6=12
[0x00] rec0=1f rec1=00 rec2=01 rec3=018
[0x01] rec0=1a rec1=00 rec2=0b rec3=06e
[0x02] rec0=1a rec1=00 rec2=02 rec3=07a
[0x03] rec0=17 rec1=00 rec2=03 rec3=048
[0x04] rec0=16 rec1=00 rec2=07 rec3=06a
[0x05] rec0=1c rec1=00 rec2=04 rec3=024
[0x06] rec0=1c rec1=00 rec2=0d rec3=000
[0x07] rec0=17 rec1=00 rec2=08 rec3=01e
[0x08] rec0=0e rec1=00 rec2=05 rec3=000
[0x09] rec0=0e rec1=00 rec2=05 rec3=000
[0x0a] rec0=0e rec1=00 rec2=05 rec3=000
[0x0b] rec0=e3 rec1=80 rec2=00 rec3=000
[0x0c] rec0=24 rec1=00 rec2=15 rec3=7cc
tail 0x21758fa34879a8bb2f8bf 0x42a00088462060003
Free Block Chain:
0x6: 0000 00 09 03 29 80 19 72 61 6d 65 20 3d 3e 20 54 72 ┆ ) rame => Tr┆
0x9: 0000 00 0a 03 fc 80 19 20 20 20 20 20 20 20 20 2d 2d ┆ --┆
0xa: 0000 00 0c 00 19 00 00 00 00 10 65 6e 64 20 54 72 61 ┆ end Tra┆
0xc: 0000 00 00 00 0d 80 0a 70 65 20 53 6f 72 74 69 65 5f ┆ pe Sortie_┆