Chapter 13: Memory Management
141
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
If a variable’s in-use flag (SF_INUSE) is set, the variable is being used by an
application. Depending on the application, the handle to the data may be null or
the data may not be in a useable form. It is up to the caller to test the SF_INUSE
flag and take appropriate action.
13.3.2.5. HSYM VarStore (BYTE *
DestVar
, WORD
Flags
,
WORD
SourceSize
[,
parm1
] [,
parm2
] [,
parm3
] . . . )
VarStore
stores values, prepares a variable to be stored to, or stores individual
values to elements of a list or matrix. The data type and domain of system
variables are verified to be correct. System variables not in the symbol table will
return H_NULL. Variables in the symbol table will return their HSYM handle. The
Flags
parameter determines the meaning of the remaining parameters.
Flags
STOF_ESI —
parm1
is an EStackIndex pointing to a locked block of memory,
most likely the estack.
STOF_HESI —
parm1
is a handle to a block of memory containing the data to
store (will be locked initially).
STOF_ELEMENT —
parm1
is an EStackIndex pointing to the element to store. For a
list,
parm2
is a WORD indexing the element to store to and
parm3
(also a WORD) must be zero.
For a matrix,
parm2
indexes the column of the matrix to store
to and
parm3
indexes the row. The indexes for both lists and
matrices start at one.
STOF_NONE — Nothing is assumed about the source, no copy is done (left to
caller). It creates the symbol table entry, verifies the name and
flags, and other conditions.
USER_FUN_TAG —
parm1
points to the USER_FUN_TAG of the function to store.
Otherwise
Flags
must equal TEXT_VAR_TAG, GDB_VAR_TAG,
PIC_VAR_TAG, DATA_VAR_TAG, or GEN_DATA_TAG. The destination is
verified to have the same type as the source. The copy operation is not done.
SourceSize
is the size of the source data including the tag but not the size word
stored in the heap. If it is zero then the size of the estack expression pointed to
by
parm1
will be used for STOF_ESI, STOF_HESI, and STOF_ELEMENT.
Otherwise, the new value is not allocated (return value->hSym may still not be
H_NULL if previous data existed in that variable). For STOF_ESI, STOF_HESI,
and STOF_ELEMENT the source is copied to the new destination.