packing Strings()?

Frank Heckenbach ih8mj at fjf.gnu.de
Thu Jul 7 10:23:42 CEST 2005


Contestcen at aol.com wrote (bogus quoting fixed):

> > I often need to store a lot of strings, and don't want to waste the
> > space allocated to a String(255) for each one.  With "short" strings,
> > I just allocate memory (with the Mac system NewPtr routine, not with
> > the Pascal New routine) for Length(s)+1 bytes, and then BlockMove the
> > string in.  This has the advantage that the string can be references
> > as just Str255Ptr(s)^ (sometimes the size needs to be aligned to 2 or
> > 4 bytes, depending on the platform).
> 
> The Pascal Macro Compiler has a set of macros that will pack character 
> strings without any wasted space between them  The macros can be downloaded directly 
> from the webpage http://www.contestcen.com/paskey.htm which has both the 
> source code and a detailed description.

How can a preprocessor (macro compiler) help here, when it runs at
compile time, while time question was clearly about runtime storing
of strings (mentioning New and block moves etc.)?

Frank

-- 
THANK YOU, EUROPEAN PARLIAMENT, for rejecting one of the most
dangerous stupidities: http://swpat.ffii.org/log/05/ep0706/

Frank Heckenbach, frank at g-n-u.de, http://fjf.gnu.de/, 7977168E




More information about the Gpc mailing list