aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2018-01-19 06:10:41 +0100
committerTristan Gingold <tgingold@free.fr>2018-01-20 07:40:53 +0100
commitc763877e06400de084ccaffae61ccc98e451c474 (patch)
tree65e20a39f4ff68808662f6d800602c4793600245
parentc46dc8215f1d873c0f149cf06875284d9ccbd1a1 (diff)
downloadghdl-c763877e06400de084ccaffae61ccc98e451c474.tar.gz
ghdl-c763877e06400de084ccaffae61ccc98e451c474.tar.bz2
ghdl-c763877e06400de084ccaffae61ccc98e451c474.zip
name_table: get rid of Nam_Buffer/Nam_Length.
-rw-r--r--src/name_table.adb21
-rw-r--r--src/name_table.ads18
-rw-r--r--src/vhdl/scanner.adb6
-rw-r--r--src/vhdl/scanner.ads3
4 files changed, 6 insertions, 42 deletions
diff --git a/src/name_table.adb b/src/name_table.adb
index 707d05b82..cb3ddf5b4 100644
--- a/src/name_table.adb
+++ b/src/name_table.adb
@@ -179,21 +179,6 @@ package body Name_Table is
end if;
end Image;
- procedure Image (Id : Name_Id)
- is
- Name_Entry : Identifier renames Names_Table.Table (Id);
- begin
- if Is_Character (Id) then
- Nam_Buffer (1) := Get_Character (Id);
- Nam_Length := 1;
- else
- Nam_Length := Get_Name_Length (Id);
- Nam_Buffer (1 .. Nam_Length) := String
- (Strings_Table.Table
- (Name_Entry.Name .. Name_Entry.Name + Str_Idx (Nam_Length) - 1));
- end if;
- end Image;
-
-- Get the address of the first character of ID.
-- The string is NUL-terminated (this is done by get_identifier).
function Get_Address (Id : Name_Id) return System.Address
@@ -332,12 +317,6 @@ package body Name_Table is
return Res;
end Get_Identifier_With_Len;
- function Get_Identifier return Name_Id is
- begin
- return Get_Identifier_With_Len
- (To_Thin_String_Ptr (Nam_Buffer'Address), Nam_Length);
- end Get_Identifier;
-
function Get_Identifier_No_Create_With_Len
(Str : Thin_String_Ptr; Len : Natural) return Name_Id
is
diff --git a/src/name_table.ads b/src/name_table.ads
index eb604c8f1..2dc6137c6 100644
--- a/src/name_table.ads
+++ b/src/name_table.ads
@@ -47,10 +47,6 @@ package Name_Table is
-- If the name is a character, then single quote are added.
function Image (Id: Name_Id) return String;
- -- Set NAME_BUFFER/NAME_LENGTH with the image of ID. Characters aren't
- -- quoted.
- procedure Image (Id : Name_Id);
-
-- Get the address of the first character of ID. The address is valid
-- until the next call to Get_Identifier (which may reallocate the string
-- table).
@@ -71,9 +67,6 @@ package Name_Table is
function Is_Character (Id: Name_Id) return Boolean;
pragma Inline (Is_Character);
- -- Get or create an entry in the name table, use NAME_BUFFER/NAME_LENGTH.
- function Get_Identifier return Name_Id;
-
-- Like GET_IDENTIFIER, but return NULL_IDENTIFIER if the identifier
-- is not found (and do not create an entry for it).
function Get_Identifier_No_Create (Str : String) return Name_Id;
@@ -93,17 +86,6 @@ package Name_Table is
-- Be sure all info fields have their default value.
procedure Assert_No_Infos;
- -- This buffer is used by get_token to set the name.
- -- This can be seen as a copy buffer but this is necessary because names
- -- case is 'normalized' as VHDL is case insensitive.
- -- To avoid name clash with std_names, Nam_Buffer and Nam_Length are used
- -- instead of Name_Buffer and Name_Length.
- Max_Nam_Length : constant Natural := 1024;
- Nam_Buffer : String (1 .. Max_Nam_Length);
-
- -- The length of the name string.
- Nam_Length: Natural range 0 .. Max_Nam_Length;
-
-- Free all resources. The package cannot be used anymore after calling
-- this procedure.
procedure Finalize;
diff --git a/src/vhdl/scanner.adb b/src/vhdl/scanner.adb
index c5003666f..3ca706a50 100644
--- a/src/vhdl/scanner.adb
+++ b/src/vhdl/scanner.adb
@@ -933,7 +933,7 @@ package body Scanner is
procedure Scan_Identifier (Allow_PSL : Boolean)
is
use Name_Table;
- Buffer : String (1 .. Max_Nam_Length);
+ Buffer : String (1 .. Max_Name_Length);
C : Character;
Len : Natural;
begin
@@ -1250,7 +1250,7 @@ package body Scanner is
procedure Scan_Extended_Identifier
is
use Name_Table;
- Buffer : String (1 .. Max_Nam_Length);
+ Buffer : String (1 .. Max_Name_Length);
Len : Natural;
begin
-- LRM93 13.3.2
@@ -1455,7 +1455,7 @@ package body Scanner is
procedure Scan_Comment_Identifier (Id : out Name_Id)
is
use Name_Table;
- Buffer : String (1 .. Max_Nam_Length);
+ Buffer : String (1 .. Max_Name_Length);
Len : Natural;
C : Character;
begin
diff --git a/src/vhdl/scanner.ads b/src/vhdl/scanner.ads
index 8907975f4..5ed6f04db 100644
--- a/src/vhdl/scanner.ads
+++ b/src/vhdl/scanner.ads
@@ -27,6 +27,9 @@ package Scanner is
-- It can be replaced by a function call.
Current_Token: Token_Type := Tok_Invalid;
+ -- Maximal length for identifiers.
+ Max_Name_Length : constant Natural := 1024;
+
-- Simply set current_token to tok_invalid.
procedure Invalidate_Current_Token;
pragma Inline (Invalidate_Current_Token);