444
Appendix A: System Routines — Display
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
Print2DExpr
Declaration:
void
Print2DExpr
(EStackIndex
i
, WINDOW *
Win
, SWORD
xOffset
,
SWORD
yOffset
)
Category(ies):
Display
Description:
Print the 2D output from
Parse2DExpr
or
Parse2DMultiExpr
to a window
(with defined offsets).
Inputs:
i
— EStackIndex of 2D expression (output of
Parse2DExpr
or
Parse2DMultiExpr
).
Win
— WINDOW structure to write to.
xOffset
,
yOffset
— x and y offsets of where to start drawing in the window.
Outputs:
Draws to
Win.
Assumptions:
Assumes the input came from
Parse2DExpr
or
Parse2DMultiExpr
.
Side Effects:
Throws an ILLEGAL_TAG_ERROR if any invalid tags in the input.
Availability:
All versions of the TI
-
89 / TI
-
92 Plus.
TI
-
89 / TI
-
92 Plus
Differences:
None
See Also: Parse2DMultiExpr, Parse2DExpr
Example:
See
WinScrollH
for an example of a scrollable 2D viewer.
WORD Width, Depth, Height, Key;
short y;
EStackIndex origEStack, i2D;
BYTE Buf[128];
WinClr( &appW );
y = 0; /* appW setup when app started */
strcpy( (char *) Buf, "((1-X)^2/(1+X))" ); /* Buf could be input by user */
origEStack = top_estack; /* save top of estack */
TRY
push_quantum( END_OF_SEGMENT_TAG ); /* mark end of expression */
push_parse_text( Buf ); /* tokenized text */
i2D = Parse2DExpr( top_estack, 1 ); /* convert to display rpn */
Parms2D( i2D, &Width, &Depth, &Height ); /* get parameters of display rpn */
y += Height + 2; /* update y cursor by height of expression */
Print2DExpr( i2D, &appW, 0, y ); /* print to our window */
GKeyIn( NULL, 0 ); /* wait */
y += Depth; /* update y cursor by depth */
ONERR
top_estack = origEStack; /* restore estack if error */
PASS; /* and pass error on up the chain */
ENDTRY
top_estack = origEStack; /* restore estack */