EasyManuals Logo

Texas Instruments TI-89 Developer's Guide

Texas Instruments TI-89
1398 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #350 background imageLoading...
Page #350 background image
308
Appendix A: System Routines — Apps
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
OO_appSetPublicStorage
(continued)
typedef struct
{
USHORT flags;
char name[40];
BCD16 result;
} GLOBALS;
n
GLOBALS g;
o
.
.
.
void main(pFrame self, Event *e)
{
HANDLE h;
switch (e->command)
{
.
.
.
case CM_PACK:
/* Getting ready to garbage collect -- save global variables */
h = HeapAlloc(sizeof(GLOBALS));
p
if (h != H_NULL)
{
GLOBALS *pg = HeapDeref(h);
*pg = g;
q
OO_appSetPublicStorage(h);
r
}
else
OO_appSetPublicStorage(H_NULL);
break;
case CM_UNPACK:
/* Garbage collect is finished -- restore global variables */
h = OO_appGetPublicStorage();
s
if (h != H_NULL)
{
GLOBALS *pg = HeapDeref(h);
g = *pg;
t
HeapFree(h);
u
}
break;
n
Declare all the global variables that need to be saved in a single structure.
o
Define a struct variable to hold the global variables.
p
Allocate memory from the heap to hold the global variables.
q
Copy the global variables to the heap.
r
Save handle to global variables in public storage.
s
Recover handle to global variables from public storage.
t
Copy global variables from heap to data segment.
u
Do not forget to release heap memory.

Table of Contents

Other manuals for Texas Instruments TI-89

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments TI-89 and is the answer not in the manual?

Texas Instruments TI-89 Specifications

General IconGeneral
Display size (HxV)100 x 160 mm
Memory type639K FLASH ROM, 188K bytes RAM
Compatible operating systemsOperating System 2.09
Battery typeAAA

Related product manuals