Appendix A: System Routines — Variables
1135
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
cmd_movevar
Declaration:
void
cmd_movevar
(EStackIndex
varName
,
EStackIndex
oldFolder
, EStackIndex
newFolder
)
Category(ies):
Variables
Description:
Move a variable from one folder to another. This is the TI
-
BASIC command
MoveVar. If the destination folder (
newFolder
) does not exist it will be
created.
Inputs:
varName
— ESTACK index of variable to move.
oldFolder
— Original folder.
newFolder
— New folder.
Outputs:
May throw these errors:
ER_FOLDER — Destination folder name is invalid.
ER_LOCKED — Destination variable is locked or in-use.
ER_RESERVED — Cannot move reserved names.
ER_MEMORY — Not enough memory to do the move.
ER_UNDEFINED_VAR — Source variable not found.
Assumptions:
None
Side Effects:
May cause heap compression.
Availability:
On AMS 1.05 and higher.
TI
-
89 / TI
-
92 Plus
Differences:
None
See Also: TokenizeSymName, TokenizeName, cmd_newfold
Example:
This example passes direct pointers to ‘tokenized’ names instead of using
TokenizeSymName
. Compare this to the
cmd_delvar
example which
uses
TokenizeSymName
or the
VarRecall
example which uses
TokenizeName
.
const BYTE MainFolderName[6] = {0, 'm','a','i','n', 0};
const BYTE NewFolderName[10] = {0,'z','f','o','l','d','e','r','1',0};
const BYTE fName[4] = {0,'f','1',0};
if (FS_OK != FCreate("main\\f1", "DAT"))
return;
/* "main" is always reserved but since this code by-passes TokenizeSymName we must
make sure our name "zfolder1" is not reserved. Adding a digit to the end will
insure it does not conflict with any new reserved names added by a localizer. Since
a tokenized name consists of a zero byte followed by the name followed by a zero
byte, we can just pass a pointer to the second zero byte as the tokenized name. */
cmd_movevar( (BYTE *)fName+3, (BYTE *)MainFolderName+5, (BYTE *)NewFolderName+9 );