| NG_execute | Function (ROM Call 0x25D)

estack.h

void NG_execute (HANDLE Handle, short approx_flag);

Executes TI-Basic statements.

NG_execute executes a sequence of TI-Basic statements in tokenized form, which are located in a memory block pointed to by handle Handle. It is a handle to a MULTI_EXPR structure. To create such a block, the functions push_parse_text and HS_popEStack may be very useful, like in the following example:

    push_parse_text ("ClrGraph:Graph sin(x)");
    handle = HS_popEStack ();
    NG_execute (handle, FALSE);
    HeapFree (handle);

If approx_flag is non-zero, the sequence will be executed in "approx" mode (like running with [DIAMOND]+[ENTER]). Otherwise, the current mode settings will be used. This routine is called after NG_RPNToText from the home screen.
NG_execute can also evaluate expressions. In this case, the result of the evaluation is pushed on the top of the expression stack.
Note: This routine always clears the error context, resets control flags, may cause estack expansion or heap compression. It may throw various errors if something is wrong.

Uses: HToESI, reset_control_flags, HeapLock, HeapMoveHigh, HeapUnlock, ER_catch, ER_success, ER_throwVar, clear_error_context, NG_control, push_simplify_statements, ROM Call 0x5C5, ROM Call 0x5C6, ROM Call 0x5C7, ROM Call 0x5C8, ROM Call 0x5CB, ROM Call 0x5CC
Used by: HomeExecute