diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-07-19 06:12:09 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-07-19 06:13:11 +0200 |
commit | 94912cf6e8862c9f5fe88f1e5314d4699f8e5659 (patch) | |
tree | b92c9549d54b7489bec8ac49dd486b06d5da79eb /src | |
parent | fd91ad38193d468040fdd52d078c85a4c4201348 (diff) | |
download | ghdl-94912cf6e8862c9f5fe88f1e5314d4699f8e5659.tar.gz ghdl-94912cf6e8862c9f5fe88f1e5314d4699f8e5659.tar.bz2 ghdl-94912cf6e8862c9f5fe88f1e5314d4699f8e5659.zip |
errorout: handle %v for values.
Diffstat (limited to 'src')
-rw-r--r-- | src/errorout.adb | 27 | ||||
-rw-r--r-- | src/errorout.ads | 10 |
2 files changed, 36 insertions, 1 deletions
diff --git a/src/errorout.adb b/src/errorout.adb index 485f5fef3..79ed35dbf 100644 --- a/src/errorout.adb +++ b/src/errorout.adb @@ -134,6 +134,16 @@ package body Errorout is return (Kind => Earg_Char, Val_Char => V); end "+"; + function "+" (V : Uns32) return Earg_Type is + begin + return (Kind => Earg_Uns32, Val_Uns32 => V); + end "+"; + + function "+" (V : Int32) return Earg_Type is + begin + return (Kind => Earg_Int32, Val_Int32 => V); + end "+"; + function "+" (V : String8_Len_Type) return Earg_Type is begin return (Kind => Earg_String8, Val_Str8 => V); @@ -357,6 +367,23 @@ package body Errorout is end case; Report_Handler.Message (""""); end; + when 'v' => + -- Numerical values + declare + Arg : Earg_Type renames Args (Argn); + begin + case Arg.Kind is + when Earg_Uns32 => + declare + S : constant String := + Uns32'Image (Arg.Val_Uns32); + begin + Report_Handler.Message (S (2 .. S'Last)); + end; + when others => + raise Internal_Error; + end case; + end; when others => -- Unknown format. raise Internal_Error; diff --git a/src/errorout.ads b/src/errorout.ads index 580d09e44..39e170d6d 100644 --- a/src/errorout.ads +++ b/src/errorout.ads @@ -161,11 +161,14 @@ package Errorout is -- %l: location -- %n: node name -- %s: a string + -- %v: value -- TODO: %m: mode, %y: type of function "+" (V : Location_Type) return Earg_Type; function "+" (V : Name_Id) return Earg_Type; function "+" (V : Character) return Earg_Type; function "+" (V : String8_Len_Type) return Earg_Type; + function "+" (V : Uns32) return Earg_Type; + function "+" (V : Int32) return Earg_Type; -- Convert location. function "+" (L : Location_Type) return Source_Coord_Type; @@ -235,7 +238,8 @@ package Errorout is private type Earg_Kind is (Earg_None, - Earg_Location, Earg_Id, Earg_Char, Earg_String8, + Earg_Location, Earg_Id, + Earg_Char, Earg_String8, Earg_Uns32, Earg_Int32, Earg_Vhdl_Node, Earg_Vhdl_Token); type Earg_Type (Kind : Earg_Kind := Earg_None) is record @@ -250,6 +254,10 @@ private Val_Char : Character; when Earg_String8 => Val_Str8 : String8_Len_Type; + when Earg_Uns32 => + Val_Uns32 : Uns32; + when Earg_Int32 => + Val_Int32 : Int32; when Earg_Vhdl_Node => Val_Vhdl_Node : Vhdl.Nodes.Iir; when Earg_Vhdl_Token => |