diff options
author | Tristan Gingold <tgingold@free.fr> | 2014-05-07 05:23:35 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2014-05-07 05:23:35 +0200 |
commit | 77d6e8dba756da993707baa2deac4b235bb78992 (patch) | |
tree | 64a1f36a12c9a796437f139cea3a0be3673c8288 /files_map.adb | |
parent | ebfb88265397a6443dea3e2a6386ca1bc4608e43 (diff) | |
download | ghdl-77d6e8dba756da993707baa2deac4b235bb78992.tar.gz ghdl-77d6e8dba756da993707baa2deac4b235bb78992.tar.bz2 ghdl-77d6e8dba756da993707baa2deac4b235bb78992.zip |
Files_Map: add Create_Source_File_From_String
Std_Names: Add new predefined names.
Diffstat (limited to 'files_map.adb')
-rw-r--r-- | files_map.adb | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/files_map.adb b/files_map.adb index bc0f4c8ea..f4927e8db 100644 --- a/files_map.adb +++ b/files_map.adb @@ -610,24 +610,37 @@ package body Files_Map is return Res; end Create_Source_File_Entry; - function Create_Virtual_Source_File (Name: Name_Id) - return Source_File_Entry + function Create_Source_File_From_String (Name: Name_Id; Content : String) + return Source_File_Entry is Res : Source_File_Entry; Buffer: File_Buffer_Acc; + Len : constant Source_Ptr := Source_Ptr (Content'Length); begin Res := Create_Source_File_Entry (Null_Identifier, Name); - Buffer := new File_Buffer (Source_Ptr_Org .. Source_Ptr_Org + 1); + Buffer := new File_Buffer + (Source_Ptr_Org .. Source_Ptr_Org + Len + 1); - Buffer (Source_Ptr_Org) := EOT; - Buffer (Source_Ptr_Org + 1) := EOT; + Buffer (Source_Ptr_Org .. Source_Ptr_Org + Len - 1) := + File_Buffer (Content); + Buffer (Source_Ptr_Org + Len) := EOT; + Buffer (Source_Ptr_Org + Len + 1) := EOT; - Source_Files.Table (Res).Last_Location := Next_Location + 1; - Next_Location := Next_Location + 2; + Source_Files.Table (Res).Last_Location := + Next_Location + Location_Type (Len) + 1; + Next_Location := Source_Files.Table (Res).Last_Location + 1; Source_Files.Table (Res).Source := Buffer; - Source_Files.Table (Res).File_Length := 0; + Source_Files.Table (Res).File_Length := Natural (Len); + return Res; + end Create_Source_File_From_String; + + function Create_Virtual_Source_File (Name: Name_Id) + return Source_File_Entry + is + begin + return Create_Source_File_From_String (Name, ""); end Create_Virtual_Source_File; -- Return an entry for a filename. |