AVR-Ada Wiki
Ada cross compiler and libraries for AVR µCs
Status: Beta
Brought to you by:
rolf_ebert
package AVR.Strings.PString is
pragma Pure;
generic
Max : Pos8;
-- Maximum length of a PString. This implementation in the AVR
-- hierarchy is limited to an absolute maximum of 255
-- characters.
package Generic_PString is
-- pragma Preelaborate (Generic_Pstring);
-- GNAT: "incorrect placement of pragma PREELABORATE"
Max_Length : constant Pos8 := Max;
subtype Length_Range is Unsigned_8 range 0 .. Max_Length;
type PString is record
Current_Length : Length_Range;
Data : AVR_String (1 .. Max_Length);
end record;
-- type PString is private;
function Length (Source : in PString) return Length_Range;
--------------------------------------------------------
-- Conversion, Concatenation, and Selection Functions --
--------------------------------------------------------
function To_PString(Source : in AVR_String) return PString;
function "+"(Source : in AVR_String) return PString
renames To_PString;
pragma Pure_Function (To_PString);
function Element
(Source : in PString;
Index : in Pos8)
return Character;
end AVR.Strings.PString;