RefTextExtras.mesa
Copyright © 1992 by Xerox Corporation. All rights reserved.
Bier, December 4, 1992 1:24 pm PST
Contents: More routines on the REF TEXT data type.
RefTextExtras:
CEDAR
DEFINITIONS =
BEGIN
ObtainScratch16:
PROC []
RETURNS [
REF
TEXT] =
INLINE {
RETURN ObtainInternal[pool16]};
Obtains a REF TEXT of length 16 characters from a pool. Remember to return this storage using ReleaseScratch16 below.
ObtainScratch100:
PROC []
RETURNS [
REF
TEXT] =
INLINE {
RETURN ObtainInternal[pool100]};
Obtains a REF TEXT of length 100 characters from a pool. Remember to return this storage using ReleaseScratch100 below.
ObtainScratch512:
PROC []
RETURNS [
REF
TEXT] =
INLINE {
RETURN ObtainInternal[pool512]};
Obtains a REF TEXT of length 512 characters from a pool. Remember to return this storage using ReleaseScratch512 below.
ObtainScratch8192:
PROC []
RETURNS [
REF
TEXT] =
INLINE {
RETURN ObtainInternal[pool8192]};
Obtains a REF TEXT of length 8192 characters from a pool. Remember to return this storage using ReleaseScratch8192 below.
ReleaseScratch16:
PROC [t:
REF
TEXT] =
INLINE {ReleaseInternal[pool16, t]};
Frees a REF TEXT that was allocated using ObtainScratch16 to be reused.
ReleaseScratch100:
PROC [t:
REF
TEXT] =
INLINE {ReleaseInternal[pool100, t]};
Frees a REF TEXT that was allocated using ObtainScratch100 to be reused.
ReleaseScratch512:
PROC [t:
REF
TEXT] =
INLINE {ReleaseInternal[pool512, t]};
Frees a REF TEXT that was allocated using ObtainScratch512 to be reused.
ReleaseScratch8192:
PROC [t:
REF
TEXT] =
INLINE {ReleaseInternal[pool8192, t]};
Frees a REF TEXT that was allocated using ObtainScratch8192 to be reused.
CreatePool:
PROC [charsPerText:
CARD, textsInPool:
CARD]
RETURNS [pool: Pool];
For clients who need texts of a custom size or larger than 8192 characters.
For INLINEs Only
These types and routines help implement the above INLINE routines. They should probably not be used directly.
Pool: TYPE = REF PoolObj;
PoolObj: TYPE;
pool16, pool100, pool512, pool8192: Pool; -- global variables representing the storage pools
ObtainInternal: PROC [pool: Pool] RETURNS [REF TEXT];
ReleaseInternal: PROC [pool: Pool, t: REF TEXT];
END.