DUP.ST - duplicate a string.

Usage:

B:
   ptr = dup.st(string [, extra]);
C:
   #equate dup_st dup.st
   void *dup_st(const char *string [, int extra] );

Where:

string
is a pointer to the string to be duplicated.
extra
is the number of extra words to be allocated in addition to the space required to hold the copy of the string. The default is zero.
ptr
points to the allocated space. The duplicated string will be at "ptr+extra". If "extra" is non-zero, the number of words of space allocated is stored in "ptr[0]".

Description:

DUP.ST is used to allocate a new copy of a string, or of a structure with a fixed header followed by a string. DUP.ST allocates "extra" words plus sufficient space to hold a copy of "string". It then copies the string into the allocated space, skipping over the first "extra" words. For example, suppose you want to create a linked list of strings. Each item in the list consists of a string preceded by a machine word that contains a pointer to the next entry in the list.

ptr = dup.st(string,1)

would allocate the space needed for a list entry, leave the first word of the entry open (so the pointer could be filled in later), and copy "string" into the rest of the entry.

See Also:

expl b lib fre.st

Copyright © 1996, Thinkage Ltd.