Texas Instruments TI89 Developer Guide - Page 233
Graphing, contains pointers to the current Window variables, which are kept in system
UPC - 033317198566
View all Texas Instruments TI89 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 233 highlights
Chapter 17: Graphing 191 There is always an active graph, even when the Graph application is not displayed. This allows access to the graph system variables and settings from the Home screen or any other application. The graph system functions are stored in the symbol table and appear on the VAR-LINK screen in the MAIN folder. All other data needed by the active Graph application is stored in a GR_WIN_VARS structure that is pointed to by the global variable gr_active. This struct also contains pointers to the current Window variables, which are kept in system memory, not part of the symbol table. The system routine VarStore must be used to store to the graph system variables. This insures that the values are valid and all necessary system flags will be set when appropriate. The following code sample demonstrates how to define a graph function from an app or ASM and shows an example of storing to the Window variables: EStackIndex volatile old_top = top_estack; EStackIndex name; UCHAR buf[25]; TRY /* buf = "Define y1(x)=x" */ memset(buf, 0, 25); strcat((char *) buf, (const char *) XR_stringPtr(XR_DefineB)); strcat((char *) buf, (const char *) "y1(x)=x" ); /* Execute buf to define graph function y1(x) */ push_quantum( END_OF_SEGMENT_TAG ); push_parse_text( buf ); push_simplify_statements( top_estack ); /* store -10 to xmin */ push_parse_text( (UCHAR *) XR_stringPtr(XR_XMIN_STR)); name = top_estack; push_Float( -10.0 ); VarStore( (BYTE *)name, STOF_ESI, 0, top_estack ); /* OK to access system variables directly, but not store. */ if((gr_active->rngp)[GR_XMAX] < 0.0 ) { /* if xmax is negative, make it 10.0 instead */ push_parse_text( (UCHAR *) XR_stringPtr(XR_XMAX_STR)); name = top_estack; push_Float( 10.0 ); VarStore( (BYTE *)name, STOF_ESI, 0, top_estack ); /* xmax=10 */ } top_estack = old_top; /* restore top_estack */ ONERR top_estack = old_top; /* restore top_estack */ PASS; ENDTRY TI-89 / TI-92 Plus Developer Guide Not for Distribution Beta Version January 26, 2001