Package Name: pstrings

Return to: Package List


------------------------------------------------------------------------------
--                                                                          --
--                        MacOS COMPILER COMPONENTS                         --
--                                                                          --
--                             P S T R I N G S                              --
--                                                                          --
--                                S p e c                                   --
--                                                                          --
--                            $ Revision: 1.4 $                             --
--                                                                          --
------------------------------------------------------------------------------
with System; use System;

with Types; use Types;

package PStrings is
function To_Pascal  (Item : in String) return Str255;

-- convert an Ada String to a Pascal string
function To_Ada     (Item : in PString) return String;

-- convert a Pascal string to an Ada String
function To_StringPtr (Item : Address) return StringPtr;

-- return a pointer to a Pascal string
function New_String (Item : in String; Size : in Natural := 0) return StringPtr;
-- allocate a Pascal string of Size bytes or, by default, Item'Length + 1

-- returns null if allocation fails or Item longer than 255 characters
procedure Free      (Item : in out StringPtr);

-- deallocate a Pascal string created by New_String
function Value      (Item : in StringPtr) return String;

-- get the string pointed to by Item
function Length     (Item : in PString) return Natural;
function Length     (Item : in StringPtr) return Natural;

-- get the actual length of a Pascal string
procedure Update    (Item : access Str255; Str : in String);

-- update (in place) the contents of Item with the Ada string, Str
end PStrings;