|
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: 18432 (0x4800) Types: Ada Source Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Tab_Util, seg_05728b
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000 └─⟦cfc2e13cd⟧ »Space Info Vol 2« └─⟦this⟧
with Tab_Orb; with Trame; with Bounded_String; with Utils; package body Tab_Util is --************************************************************************** procedure Init (Tab : in out Tableau) is I : Integer; begin I := 1; -- Met le champ Etat du tableau en Traite = 1 et Libre = 1 <=> Etat = 11 while I <= Tab.Max loop Tab.Ma_Liste (I).Etat := 11; I := I + 1; end loop; end Init; --************************************************************************** procedure Ajoute (Tab : in out Tableau; Element : in Byte_Defs.Byte_String; Erreur : out Boolean) is I : Integer; begin I := 1; -- Trouve un emplacement libre ou ajouter la trame <=> Etat = 11 Boucle: while I <= Tab.Max loop if Tab.Ma_Liste (I).Etat /= 11 then I := I + 1; else exit Boucle; end if; end loop Boucle; -- Copie des infos de la trame if I <= Tab.Max then Tab.Ma_Liste (I).Type_Msg := Trame.Donne_Integer (Element, 1); Bounded_String.Copy (Tab.Ma_Liste (I).Host, Trame.Extrait (Element, 2)); Bounded_String.Copy (Tab.Ma_Liste (I).Socket, Trame.Extrait (Element, 3)); Tab.Ma_Liste (I).Requete := Trame.Donne_Integer (Element, 4); Bounded_String.Copy (Tab.Ma_Liste (I).Commande, Trame.Extrait (Element, 5)); Tab.Ma_Liste (I).Etat := 0; Erreur := False; else Erreur := True; end if; end Ajoute; --************************************************************************** procedure Efface (Tab : in out Tableau; Index : in Positive; Erreur : out Boolean) is begin -- Met le champ Etat du tableau en Libre = 11 -- Met des valeurs "Bidon" dans les autres champs if Index <= Tab.Max then Tab.Ma_Liste (Index).Type_Msg := 100; Bounded_String.Copy (Tab.Ma_Liste (Index).Host, " "); Bounded_String.Copy (Tab.Ma_Liste (Index).Socket, " "); Tab.Ma_Liste (Index).Requete := 2000; Bounded_String.Copy (Tab.Ma_Liste (Index).Commande, " "); Tab.Ma_Liste (Index).Etat := 11; Erreur := False; else Erreur := True; end if; end Efface; --************************************************************************** procedure Trouve (Tab : in Tableau; Index : out Positive; Element : in Byte_Defs.Byte_String; Numero : in Positive; Erreur : out Boolean) is I, J : Integer; Fini : Boolean := False; Trouve : Boolean := False; Element1 : Bounded_String.Variable_String (1024); Valeur : Positive; Symbole : Character; begin -- Met le champ Etat du tableau en Traite = 1 et Libre = 1 <=> Etat = 1--Fixe le symbole terminateur permetant de separer les elements dans un champ if Numero = 5 then Symbole := '('; Element1 := Trame.Extrait (Element, Numero); end if; if Numero = 4 then Valeur := Trame.Donne_Integer (Element, Numero); end if; Index := 1; I := 1; Erreur := True; -- Boucle de scrutation du tableau while I <= Tab.Max and not Fini loop J := 1; -- Boucle de test du nom du contrat -- Synchronisation sur le symbole if Tab.Ma_Liste (I).Etat /= 11 then begin if Numero = 5 then while Bounded_String.Char_At (Tab.Ma_Liste (I).Commande, J) = Bounded_String.Char_At (Element1, J) and Bounded_String.Char_At (Element1, J) /= Symbole loop J := J + 1; end loop; Trouve := True; end if; if Numero = 4 then if Tab.Ma_Liste (I).Requete = Valeur then Trouve := True; end if; end if; -- Teste si contrat valide if Trouve then if ((Numero = 5 and Bounded_String.Char_At (Element1, J) = Symbole) or Numero = 4) then Fini := True; Index := I; Erreur := False; end if; end if; end; end if; I := I + 1; end loop; end Trouve; --************************************************************************** procedure Trouve_Index (Tab : in Tableau; Requete : in Positive; Index : out Positive; Erreur : out Boolean) is Ligne : Positive; Trouve : Boolean := False; Error : Boolean := True; begin --Recherche la "ligne" contenant le numero de requete Ligne := 1; while Ligne <= Tab.Max and not Trouve loop --Il faut que la "Ligne" ne soit pas vide -- => Etat doit etre egal a 0. if (Tab.Ma_Liste (Ligne).Requete = Requete) and (Tab.Ma_Liste (Ligne).Etat = 0) then Trouve := True; Error := False; else Ligne := Ligne + 1; end if; end loop; Index := Ligne; Erreur := Error; end Trouve_Index; --************************************************************************** procedure Donne (Tab : in Tableau; Requete : in Positive; Numero : in Positive; Element : in out Bounded_String.Variable_String; Erreur : out Boolean) is --Renvoie le contenu du sous-champ No. Numero, a partir du numero de requete --...contenu dans le champ "Commande" Ligne : Positive; Commande : Bounded_String.Variable_String (1024); Debut : Positive := 1; Long : Positive; Compteur : Positive := 1; Error : Boolean; Trouve : Boolean := False; begin --Recherche la "ligne" contenant le numero de requete Trouve_Index (Tab, Requete, Ligne, Error); Erreur := Error; --Si le numero de requete est trouve, on lit le champ... if not Error then --Lecture du champ "commande" Bounded_String.Copy (Commande, Tab.Ma_Liste (Ligne).Commande); --Trouve la position du Numero'ieme "$" (debut) while Compteur /= Numero + 1 loop while Bounded_String.Char_At (Commande, Debut) /= '$' loop Debut := Debut + 1; end loop; Compteur := Compteur + 1; Debut := Debut + 1; end loop; --Efface le debut Bounded_String.Delete (Commande, 1, Debut - 1); Compteur := 1; Long := Bounded_String.Length (Commande); --Trouve la position du prochain "$" (fin) while Bounded_String.Char_At (Commande, Compteur) /= '$' loop Compteur := Compteur + 1; end loop; --Efface la fin, et retourne la portion demandee (No. Numero) Bounded_String.Delete (Commande, Compteur, Long - Compteur + 1); Bounded_String.Copy (Element, Commande); end if; end Donne; --************************************************************************** function Donne_String (Tab : Tableau; Index : Positive; Num_Champ : Positive) return Bounded_String.Variable_String is Contenu_Champ : Bounded_String.Variable_String (1024); begin if Num_Champ = 2 then Bounded_String.Copy (Contenu_Champ, Tab.Ma_Liste (Index).Host); end if; if Num_Champ = 3 then Bounded_String.Copy (Contenu_Champ, Tab.Ma_Liste (Index).Socket); end if; if Num_Champ = 6 then Bounded_String.Copy (Contenu_Champ, Tab.Ma_Liste (Index).Commande); end if; return Contenu_Champ; end Donne_String; --************************************************************************** function Donne_Integer (Tab : Tableau; Index : Positive; Num_Champ : Positive) return Integer is Contenu_Champ : Integer; begin if Num_Champ = 1 then Contenu_Champ := Tab.Ma_Liste (Index).Type_Msg; end if; if Num_Champ = 4 then Contenu_Champ := Tab.Ma_Liste (Index).Etat; end if; if Num_Champ = 5 then Contenu_Champ := Tab.Ma_Liste (Index).Requete; end if; return Contenu_Champ; end Donne_Integer; --************************************************************************** procedure Insere_String (Tab : in out Tableau; Index : in Positive; Num_Champ : in Positive; Donnees : in Bounded_String.Variable_String) is begin if Num_Champ = 2 then Bounded_String.Copy (Tab.Ma_Liste (Index).Host, Donnees); end if; if Num_Champ = 3 then Bounded_String.Copy (Tab.Ma_Liste (Index).Socket, Donnees); end if; if Num_Champ = 6 then Bounded_String.Copy (Tab.Ma_Liste (Index).Commande, Donnees); end if; end Insere_String; --************************************************************************** procedure Insere_Integer (Tab : in out Tableau; Index : in Positive; Num_Champ : in Positive; Donnees : in Integer) is begin if Num_Champ = 1 then Tab.Ma_Liste (Index).Type_Msg := Donnees; end if; if Num_Champ = 4 then Tab.Ma_Liste (Index).Etat := Donnees; end if; if Num_Champ = 5 then Tab.Ma_Liste (Index).Requete := Donnees; end if; end Insere_Integer; --************************************************************************** function Taille_Max (Tab : Tableau) return Positive is begin return Tab.Max; end Taille_Max; --************************************************************************** function Teste_Plein (Tab : Tableau) return Boolean is Ligne : Integer := 1; Plein : Boolean := True; begin --Teste si toutes les "lignes" sont occupees while (Plein and Ligne <= Tab.Max) loop if (Tab.Ma_Liste (Ligne).Etat /= 11) then Ligne := Ligne + 1; else Plein := False; end if; end loop; return Plein; end Teste_Plein; --************************************************************************** function Teste_Vide (Tab : Tableau) return Integer is Ligne : Integer := 1; Vide : Boolean := True; begin --Teste si toutes les "lignes" sont vides while (Vide and Ligne <= Tab.Max) loop if (Tab.Ma_Liste (Ligne).Etat /= 11) then Vide := False; else Ligne := Ligne + 1; end if; end loop; if Vide then Ligne := 0; else Ligne := 1; Vide := True; while (Vide and Ligne <= Tab.Max) loop if (Tab.Ma_Liste (Ligne).Etat /= 11) then Ligne := Ligne + 1; else Vide := False; end if; end loop; end if; return Ligne; end Teste_Vide; --************************************************************************** function Fait_Trame (Tab : Tableau; Index : Positive) return Byte_Defs.Byte_String is begin --Refabrique la trame a partir des donnees du tableau --Tab.Ma_Liste (Index).Etat := 10; return Trame.Fait_Trame (Tab.Ma_Liste (Index).Type_Msg, Tab.Ma_Liste (Index).Host, Tab.Ma_Liste (Index).Socket, Tab.Ma_Liste (Index).Requete, Tab.Ma_Liste (Index).Commande); end Fait_Trame; --************************************************************************** procedure Donne_Contrat (Tab : in Tableau; Index : in Positive; Contrat : in out Bounded_String.Variable_String) is Symbole : Character := '('; --Ceci est le symbole a rechercher Long : Positive; Debut : Positive; begin Contrat := Donne_String (Tab, Index, 6); --Extrait le champ "Commande" Long := Bounded_String.Length (Contrat); Debut := 1; while (Bounded_String.Char_At (Contrat, Debut) /= Symbole) and (Debut <= Long) loop Debut := Debut + 1; end loop; if Debut <= Long then --Efface ce qui suit le contrat: les (...) Bounded_String.Delete (Contrat, Debut, Long - Debut + 1); end if; --Retourne Contrat; --Si la "(" a ete trouvee, le contrat est retourne --Sinon c'est tout le champ "Commande" (cas Erreur) end Donne_Contrat; end Tab_Util;
nblk1=11 nid=0 hdr6=22 [0x00] rec0=21 rec1=00 rec2=01 rec3=036 [0x01] rec0=19 rec1=00 rec2=0a rec3=012 [0x02] rec0=18 rec1=00 rec2=11 rec3=01a [0x03] rec0=08 rec1=00 rec2=04 rec3=0a4 [0x04] rec0=18 rec1=00 rec2=0c rec3=03c [0x05] rec0=1b rec1=00 rec2=0d rec3=06e [0x06] rec0=1c rec1=00 rec2=09 rec3=078 [0x07] rec0=04 rec1=00 rec2=10 rec3=002 [0x08] rec0=17 rec1=00 rec2=02 rec3=036 [0x09] rec0=1b rec1=00 rec2=07 rec3=04a [0x0a] rec0=1a rec1=00 rec2=03 rec3=016 [0x0b] rec0=1c rec1=00 rec2=0e rec3=010 [0x0c] rec0=1b rec1=00 rec2=05 rec3=014 [0x0d] rec0=0a rec1=00 rec2=0b rec3=01a [0x0e] rec0=21 rec1=00 rec2=06 rec3=000 [0x0f] rec0=16 rec1=00 rec2=08 rec3=086 [0x10] rec0=18 rec1=00 rec2=0f rec3=000 tail 0x21763eff487c676e7044b 0x42a00088462060003