11.07.2015 Views

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

$ZFZero-Terminated and Counted Unicode StringsThe $ZF function supports argument types for zero-terminated Unicode strings and countedUnicode strings. These are supported even in versions of <strong>Caché</strong> that do not use Unicodecharacters internally.The argument types for zero-terminated Unicode strings and counted Unicode strings havethe following codes:ArgumentwsPurposePointer to a zero-terminated Unicode character string.Pointer to a counted Unicode character string.For both argument types, the C data type of the Unicode character is an unsigned short. Apointer to a zero-terminated Unicode string is declared as follows:unsigned short *p;A pointer to a counted Unicode string is declared as a pointer to the following C structure:typedef struct zwarray {unsigned short len;unsigned short data[1]; /* 1 is a dummy value */} *ZWARRAYP;For example:ZWARRAYP *p;The len field contains the length of the Unicode character array.The data field contains the characters in the counted Unicode string. The maximum size ofa Unicode string is the maximum $ZF string size, which is an updateable configurationparameter that defaults to 32767.Each Unicode character is two bytes long. This is important to consider when declaringUnicode strings as output arguments, because <strong>Caché</strong> reserves space for the longest string thatmay be passed back. When using the default string size, the total memory consumption fora single Unicode string argument is calculated as follows:32767 maximum characters * 2 bytes per character = 65534 total bytes.This is close to the default maximum memory area allocated for all $ZF arguments, whichis 67584. This maximum $ZF heap area is also an updateable configuration parameter.<strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong> 533

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!