Skip to content

Commit c3c74d5

Browse files
committed
Implement checking string prefix
1 parent bb7f3ad commit c3c74d5

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

gnat2goto/driver/goto_utils.adb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,18 @@ package body GOTO_Utils is
3030
return R;
3131
end Make_Address_Of;
3232

33+
function Is_Prefix (Prefix : String; Base_String : String) return Boolean
34+
is
35+
begin
36+
if Prefix'Length < Base_String'Length and then
37+
Prefix = Base_String (Base_String'First .. Prefix'Length)
38+
then
39+
return True;
40+
else
41+
return False;
42+
end if;
43+
end Is_Prefix;
44+
3345
-------------------
3446
-- Make_Int_Type --
3547
-------------------

gnat2goto/driver/goto_utils.ads

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ package GOTO_Utils is
2222

2323
type String_Access is access String;
2424

25+
function Is_Prefix (Prefix : String; Base_String : String) return Boolean;
26+
2527
package Addressed_Variables is new
2628
GNAT.Table (Table_Component_Type => String_Access,
2729
Table_Index_Type => Natural,

0 commit comments

Comments
 (0)