Commit e0b0793e authored by yoogx's avatar yoogx

* (Add_ULL_To_Name_Buffer): new function to print an unsigned

          long long in any base.
parent 9a82469c
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2015 ESA & ISAE. --
-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2016 ESA & ISAE. --
-- --
-- Ocarina is free software; you can redistribute it and/or modify under --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -97,6 +97,21 @@ package body Ocarina.Namet is
Add_Char_To_Name_Buffer (Character'Val (Character'Pos ('0') + V rem 10));
end Add_Nat_To_Name_Buffer;
----------------------------
-- Add_ULL_To_Name_Buffer --
----------------------------
procedure Add_ULL_To_Name_Buffer (U : ULL; B : ULL; S : Integer := 1) is
Hex : constant String := "0123456789ABCDEF";
Q : constant ULL := U / B;
R : constant ULL := U mod B;
begin
if Q /= 0 or else S > 1 then
Add_ULL_To_Name_Buffer (Q, B, S - 1);
end if;
Add_Char_To_Name_Buffer (Hex (Hex'First + Natural (R)));
end Add_ULL_To_Name_Buffer;
----------------------------
-- Add_Str_To_Name_Buffer --
----------------------------
......
......@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2015 ESA & ISAE. --
-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2016 ESA & ISAE. --
-- --
-- Ocarina is free software; you can redistribute it and/or modify under --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -144,6 +144,13 @@ package Ocarina.Namet is
pragma Inline (Set_Dnat_To_Name_Buffer);
-- Equivalent to Name_Len := 0; followed by Add_Nat_To_Name_Buffer (V);
subtype ULL is Unsigned_Long_Long;
procedure Add_ULL_To_Name_Buffer (U : ULL; B : ULL; S : Integer := 1);
-- Add base B representation of U to the end of the string
-- currently stored in Name_Buffer, incrementing Name_Len as
-- required.
procedure Add_Str_To_Name_Buffer (S : String);
-- Add characters of string S to the end of the string currently stored
-- in the Name_Buffer, incrementing Name_Len by the length of the string.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment