|
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: 9216 (0x2400) Types: Ada Source Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Wild_String, seg_026570, seg_026d44
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000 └─ ⟦5a81ac88f⟧ »Space Info Vol 1« └─⟦this⟧ └─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000 └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« └─⟦this⟧
------------------------------------------------------------------------------- with String_Run; package body Wild_String is --------------------------------------------------------------------------- function Is_With_Wildcards (Word : String) return Boolean is begin for I in Word'Range loop case (Word (I)) is when Wildcard.Pound_Sign => return True; when Wildcard.At_Sign => return True; when Wildcard.Question_Mark => return True; when others => null; end case; end loop; return False; end Is_With_Wildcards; --------------------------------------------------------------------------- function At_Sign_At_End (Iter : String_Run.Iterator) return Boolean is begin if (String_Run.Value (Iter) = Wildcard.At_Sign) then return String_Run.Next_Done (Iter); else return False; end if; end At_Sign_At_End; --------------------------------------------------------------------------- function Is_Wild_Equal (Left, Right : String) return Boolean is Iter_Left : String_Run.Iterator; Iter_Right : String_Run.Iterator; Find : Boolean; begin String_Run.Init (Iter_Left, Left); String_Run.Init (Iter_Right, Right); loop if (String_Run.Done (Iter_Left) and String_Run.Done (Iter_Right)) then return True; end if; if (String_Run.Done (Iter_Left)) then return At_Sign_At_End (Iter_Right); end if; if (String_Run.Done (Iter_Right)) then return At_Sign_At_End (Iter_Left); end if; case (String_Run.Value (Iter_Left)) is when Wildcard.Pound_Sign => String_Run.Next (Iter_Left); String_Run.Next (Iter_Right); when Wildcard.At_Sign => if (String_Run.Next_Done (Iter_Left)) then return True; else Find := False; for I in String_Run.Current_Index (Iter_Right) .. Right'Length loop Find := True; exit when Is_Wild_Equal (String_Run.Rest (Iter_Left), String_Run.Cut (Iter_Right, I)); Find := False; end loop; return Find; end if; when Wildcard.Question_Mark => if (String_Run.Next_Done (Iter_Left)) then return (not String_Run.Done (Iter_Right)); else Find := False; for I in String_Run.Current_Index (Iter_Right) + 1 .. Right'Length loop Find := True; exit when Is_Wild_Equal (String_Run.Rest (Iter_Left), String_Run.Cut (Iter_Right, I)); Find := False; end loop; return Find; end if; when others => if (String_Run.Value (Iter_Left) /= String_Run.Value (Iter_Right)) then return False; end if; String_Run.Next (Iter_Left); String_Run.Next (Iter_Right); end case; end loop; end Is_Wild_Equal; --------------------------------------------------------------------------- function Is_Equal (Left, Right : String) return Boolean is Left_Wild : Boolean; Right_Wild : Boolean; begin Left_Wild := Is_With_Wildcards (Left); Right_Wild := Is_With_Wildcards (Right); if (Left_Wild and Right_Wild) then raise Invalid_Argument_Error; end if; if (Left_Wild) then return Is_Wild_Equal (Left, Right); end if; if (Right_Wild) then return Is_Wild_Equal (Right, Left); end if; return Left = Right; end Is_Equal; end Wild_String; -------------------------------------------------------------------------------
nblk1=8 nid=6 hdr6=c [0x00] rec0=1e rec1=00 rec2=01 rec3=076 [0x01] rec0=13 rec1=00 rec2=08 rec3=066 [0x02] rec0=19 rec1=00 rec2=05 rec3=058 [0x03] rec0=14 rec1=00 rec2=04 rec3=008 [0x04] rec0=20 rec1=00 rec2=03 rec3=016 [0x05] rec0=0a rec1=00 rec2=02 rec3=000 [0x06] rec0=0a rec1=00 rec2=02 rec3=000 [0x07] rec0=0a rec1=00 rec2=02 rec3=000 tail 0x21520439683aa67ab2365 0x42a00088462063c03 Free Block Chain: 0x6: 0000 00 07 03 fc 80 09 69 61 6c 5f 43 68 61 72 3b 09 ┆ ial_Char; ┆ 0x7: 0000 00 00 02 c8 80 03 67 69 6e 03 00 3c 20 20 20 20 ┆ gin < ┆