Routines for symbolic manipulation and expression handling
ESQ
num.FALSE_TAG
(0x2B) stored in the Flash.TRUE_TAG
(0x2C) stored in the Flash.See also: args.h
void add_to_top (CESI ptr); |
Adds a value to the expression on the top of the EStack.
add_to_top adds the expression pointed to by ptr to the expression currently at the top of the EStack and stores the result to the top of the EStack, in place of the expression that was added to.
See also: subtract_from_top, negate_top, add1_to_top, subtract1_from_top
void add1_to_top (void); |
Adds 1 to the top of the EStack.
add1_to_top adds 1 (or 1.0) to the value on the top of the EStack. This routine basically calls add_to_top with "1" as the pointed-to value.
See also: add_to_top, subtract1_from_top
short all_tail (CESI_Callback_t f, ESI start_ptr); |
Checks whether all elements in the list have some property.
all_tail is similar to map_tail, but callback function f is
not void. It needs to return a Boolean value (TRUE or FALSE).
If f returns FALSE, any further processing of the list tail will
be stopped, even if END_TAG is not reached yet. The result of all_tail is
the last value returned from f. In other words, it returns TRUE if
and only if the callback function f returns TRUE for each expression
in the tail of expressions indexed by element_ptr.
all_tail is very useful to check whether all elements of a list possess some property. Suppose
that you defined the following function which checks whether an entry on the expression stack is a positive
integer:
short is_positive_integer (ESI ptr) { return (*ptr == POSINT_TAG); }
and suppose that start_ptr points to the first element of the list (one byte below LIST_TAG). Then, you can use the following call to check whether all elements of the lists are positive integers:
are_all_positive_integers = all_tail (is_positive_integer, start_ptr);
void and_onto_top (CESI ptr); |
Logical ANDs an expression onto the EStack.
and_onto_top replaces the top expression on the EStack with the logical AND of itself and the expression pointed to by ptr.
See also: or_onto_top
short any_tail (CESI_Callback_t f, ESI start_ptr); |
Checks whether any element in the list has some property.
any_tail is similar like all_tail, except further processing of the list will be stopped if f returns TRUE instead of FALSE. In other words, it returns TRUE if and only if the callback function f returns TRUE for at least one expression in the tail of expressions indexed by element_ptr. any_tail is very useful to check whether any element of a list possesses some property. Assuming the same assumptions as in the example given with all_tail, the following call will check whether any element of the list is a positive integer:
is_any_positive_integer = any_tail (is_positive_integer, start_ptr);
short are_expressions_identical (CESI ptr1, CESI ptr2); |
Checks whether two expressions are identical.
are_expressions_identical returns TRUE if expressions pointed to by ptr1 and ptr2 are syntactically identical, else returns FALSE. At the moment, I am not exactly sure what is the criteria for equivalence. I only know that a+b and b+a are not identical for example. And, floats are never identical to rational numbers. So far, I only know that this function surely returns TRUE when two expressions are absolutely identical. But, if this is the only case of equivalence, this routine should be very simple. But it is not. It is very complicated and recursive, so I am really not sure which pairs of expressions may be treated as "identical". Any additional info is welcomed.
short can_be_approxed (CESI ptr, short Complex); |
Checks whether an expression can be approximated to a number.
can_be_approxed returns TRUE if the expression pointed to by
ptr can be approximated to a number (including transfinite ones) or a list of
numbers (such expression are for example
'ln(2+sin(1))/5'
, '1/0'
or
'x^2+1-x*x'
), else returns FALSE.
Complex is a Boolean parameter:
if it is TRUE, complex results will be allowed, but if it
is FALSE, complex results will be treated as "cannot be approxed".
Note: can_be_approxed performs much detailed investigation than functions
likely_approx_to_number and
likely_approx_to_complex_number.
void check_estack_size (unsigned short Size); |
Checks if there is enough room on the expression stack.
check_estack_size checks if there is enough room to push Size bytes to the expression stack. If there is not enough space, it tries to enlarge the stack (using HeapRealloc) to make additional space. It throws an error if the requirement cannot be satisfied. Note that all "push_..." functions call this routine, so all of them may throw an error if there is not enough memory.
short compare_complex_magnitudes (CESI ptr1, CESI ptr2); |
Compares magnitudes of two complex number entries on the expression stack.
compare_complex_magnitudes compares two complex number entries (which may be real also) on the expression stack pointed to by ptr1 and ptr2, and returns a value which is
< 0 if the magnitude of the number pointed to by ptr1 is less than the magnitude of the number pointed to by ptr2
== 0 if the magnitude of the number pointed to by ptr1 is the same as the magnitude of the number pointed to by ptr2
> 0 if the magnitude of the number pointed to by ptr1 is greater than the magnitude of the number pointed to by ptr2
short compare_expressions (CESI ptr1, CESI ptr2); |
Compares two expressions.
compare_expressions returns 0 if two expressions pointed to by ptr1 and ptr2
are equal in the sense that they have the same structure, variables, function names, and
numbers that compare equal. A float and a rational number compare equal
if converting the rational number to a float produces an identical number.
If the expressions are not, it returns a non-zero value which may be positive or negative
(more precise, 1 or -1). Positive result means that the
expression pointed to by ptr1 is "more main" that the expression pointed to by ptr2,
and negative result means "less main". Principally, variables are more main than symbolic constants
such as pi, which are more main than numbers. In expressions such
as 'expand(...,var)'
or 'Integral(...,var)'
, a variable var
is "most main". Otherwise, the 26 Roman one-letter variables order
r>>s>>...>>z>>a>>b>>...>>q ('>>' means "more main"),
which order more main than all other variables, which order alphabetically. Functions and operators
are typically ordered by recursively comparing their first arguments, with ties broken by
comparing their second arguments, etc. then finally comparing the operators or functions, if
necessary. For example:
-2.0 and -2 are equal;
-2.0 is less main than -1;
pi is more main than 4;
x
is more main than 4;
x
is less main than r
;
x
is more main than ln(y)
;
x
is less main than ln(x)
.
Note: Both expressions should be in internal canonic form (see push_internal_simplify), else this function may not work as expected.
long compare_Floats (CESI ptr1, CESI ptr2); |
Compares two floating point entries on the expression stack.
compare_Floats compares two floating point entries on the expression stack pointed to by ptr1 and ptr2, and returns a value which is
< 0 if the number pointed to by ptr1 is less than the number pointed to by ptr2
== 0 if the number pointed to by ptr1 is the same as the number pointed to by ptr2
> 0 if the number pointed to by ptr1 is greater than the number pointed to by ptr2
So, this function is similar like fcmp, except the arguments are different (fcmp uses floating point arguments, and compare_Floats uses pointers to floating point entries on the expression stack).
HANDLE CreateEmptyList (void); |
Creates a MULTI_EXPR containing an empty list and returns its handle.
This function throws an error if there is not enough memory to allocate the handle.
void delete_between (ESI ptr1, ESI ptr2); |
Deletes a sequence of bytes from the expression stack.
delete_between deletes a sequence of bytes between ptr1 and ptr2 (more precise, starting at ptr1+1 and ending at ptr2) from the expression stack. It does this by moving the memory from ptr2+1 to top_estack downwards (using memmove) and adjusting top_estack. This routine assumes that ptr1 and ptr2 really point to parts of the expression stack and that ptr2 is above ptr1, otherwise the result is unpredictable.
void delete_expression (ESI ptr); |
Deletes an expression from the expression stack.
delete_expression deletes an entry on the expression stack pointed to by ptr (it needs to point to the entry tag) from the stack. The entry need not be a simple entity; it may be a complex symbolic expression too. This is achieved by calling next_expression_index and delete_between.
unsigned short deleted_between (ESI ptr1, ESI ptr2); |
Deletes a sequence of bytes from the expression stack.
deleted_between acts like delete_between, but it also returns a number of deleted bytes. Note that delete_between calls memmove for moving memory after ptr2, but deleted_between uses an embedded loop sequence for the same task. I don't know why these two routines use different methods: as I can see, the final effect is the same. Maybe I am wrong?
unsigned short deleted_expression (ESI ptr); |
Deletes an expression from the expression stack.
deleted_expression acts like delete_expression, but it also returns a number of deleted bytes. It calls deleted_between instead of delete_between.
short did_push_cnvrt_Float_to_integer (CESI ptr); |
Pushes a floating point entry converted to an integer, but only if it is an exact whole number.
did_push_cnvrt_Float_to_integer is a subroutine used in push_cnvrt_integer_if_whole_nmb. It assumes that ptr points to a floating point entry. If it is a whole number (including big numbers too), did_push_cnvrt_Float_to_integer pushes the number converted to a tagged integer to the expression stack, and returns TRUE, otherwise it does nothing and returns FALSE.
HANDLE display_statements (CESI ptr, unsigned short Newlines, unsigned short FullPrec); |
Converts tokenized expressions or TI-Basic statements to the printable form.
display_statements converts the expression (or a group of tokenized TI-Basic statements) pointed to by ptr from RPN form to the standard printable ("algebraic") form, and returns a handle to the memory block where the converted string is stored (you don't need to allocate anything by yourself, this function will do it instead; note that this routine may cause heap compression). It will return H_NULL if memory is full. Newline is a Boolean flag: when it is nonzero, all newline characters will be replaced with ':', otherwise they will remain intact. FullPrec is also a Boolean flag: when it is non-zero, all floating point values will be converted using the maximal precision (14 digits), else current precision settings (from TI-Basic MODE dialog) will be used. Here is an illustrative example for usage of this command (take a look at the "Integrate" example as well):
push_parse_text ("expand((x+1)(x+2)(x+3))"); NG_rationalESI (top_estack); handle = display_statements (top_estack, 1, 1); printf_xy (0, 40, "%s", HeapDeref (handle)); HeapFree (handle);
See push_parse_text, NG_rationalESI,
HeapDeref and HeapFree
to understand how this example works.
Note: Handles returned by display_statements aren't locked so any heap
compression will move the block associated with the handle. Therefore it is safer
to lock them using HLock and
HeapUnlock than to just dereference them
using HeapDeref.
display_statements will always convert expressions into the "canonic printing (external) form".
For example, both x*3 and 3*x will be displayed as 3*x, x*y^(-1) will be displayed as x/y etc.
Note: Although display_statements is very similar to Parse1DExpr
and both of them may usually be used for the same purposes, display_statements is used in TIOS for
printing TI-Basic statements (from programs) and for the detokenization (in NG_RPNToText),
and Parse1DExpr is used for printing expressions.
void divide_top (CESI ptr); |
Divides the expression onto the EStack.
divide_top divides the expression currently at the top of the EStack by the expression pointed to by ptr, and stores the result to the top of the EStack, in place of the expression that was divided by.
See also: times_top
float estack_number_to_Float (CESI ptr); |
Converts entry on the expression stack to floating point number.
estack_number_to_Float converts an entry on the expression stack pointed to by
ptr (it needs to point to the entry tag) to a floating point value
and returns the result. Note that the entry need not be represented by
FLOAT_TAG: it also may be represented by an integer, or
by a fraction. This function does not remove the entry from the stack.
Note: estack_number_to_Float will throw an error if the entry on the stack is not
a floating point number, a fraction or an integer, so you will need to use
ER_catch to catch eventual errors.
short estack_to_short (CESI ptr, short *value_ptr); |
Converts entry on the expression stack to signed short integer.
estack_to_short converts an entry on the expression stack pointed to by
ptr (it needs to point to the entry tag) to a signed short integer
and stores the result in the location pointed to by value_ptr.
Note that the entry need not be represented by POSINT_TAG
or NEGINT_TAG: it also may be represented by
FLOAT_TAG for example, but the value itself needs to be a whole
number. This function does not remove the entry from the stack.
estack_to_short returns 1 if the conversion was successful, 0 in the case of overflow
(in this case the stored result will be -32768 or 32767 depending of the direction
of the overflow), and -1 if the entry cannot be represented as a whole number (in
this case the result is undefined).
short estack_to_ushort (CESI ptr, unsigned short *value_ptr); |
Converts entry on the expression stack to unsigned short integer.
estack_to_ushort converts an entry on the expression stack pointed to by
ptr (it needs to point to the entry tag) to a unsigned short integer
and stores the result in the location pointed to by value_ptr.
Note that the entry need not be represented by POSINT_TAG
or NEGINT_TAG: it also may be represented by
FLOAT_TAG for example, but the value itself needs to be a whole
number. This function does not remove the entry from the stack.
estack_to_short returns 1 if the conversion was successful, 0 in the case of overflow
(in this case the stored result will be 0 or 65535 depending of the direction of the
overflow), and -1 if the entry cannot be represented as a whole number (in this case
the result is undefined).
#define ESTACK(idx) (*(idx)) |
Reads the expression stack at a specific index.
The ESTACK macro can be used to read the expression stack at the index idx. It simply dereferences idx, since the ESI and CESI types are in fact pointers to quantums of type ESQ.
ESI factor_base_index (CESI ptr); |
Gets the index of the base of an expression.
If ptr points to the POW_TAG, which is a case when it points to an expression of form base ^ exponent factor_base_index returns the pointer to base. If ptr does not point to the POW_TAG, factor_base_index returns ptr (i.e. the pointer to the expression itself).
ESI factor_exponent_index (CESI ptr); |
Gets the index of the exponent of an expression.
If ptr points to the POW_TAG, which is a case when it points to an expression of form base ^ exponent factor_exponent_index returns the pointer to exponent. If ptr does not point to the POW_TAG, factor_exponent_index returns a pointer to a simple expression which consists only of the number 1 (floating point or integer, depending on whether the approximation mode is active or not).
float gcd_exact_whole_Floats (CESI ptr1, CESI ptr2); |
Finds the greatest common divisor of two floating point entries.
gcd_exact_whole_Floats finds the greatest common divisor of two floating point entries
pointed to by ptr1 and ptr2 and returns the result (the result is a garbage
if ptr1 or ptr2 doesn't point to floating point entries).
Note: Although the name of the function suggests that both entries need to be whole
numbers, this is not true. This function, in fact, returns "generalized" GCD of two
numbers x and y which is defined as the greatest number z
which has a property that both x/z and
y/z are whole numbers.
char *get_key_ptr (ESQ Tag1, ESQ Tag2); |
Converts a tag code to a tag name.
get_key_ptr returns a static pointer to the string which represents the name of the
tag Tag1. Tag2 is used only if Tag1 is an extended tag
(i.e. EXT_TAG, EXT_INSTR_TAG or EXT_SYSTEM_TAG)
which can't be fully represented using only one byte.
If the tag corresponds to a function, AMS 1.xx does not append
'(' at the end of the string, but AMS 2.xx does. Thus, anyone who
intends to use this function for function tokens should use extra
code to handle both cases.
long GetValue (CESI ptr, long low, long high); |
Converts entry on the expression stack to short integer and checks whether it is in a given range.
GetValue converts an entry on the expression stack pointed to by ptr (it needs to point on the entry tag) to a short integer value using estack_to_short or estack_to_ushort, depending on the sign of low. Then, a "Domain Error" is thrown if the value is smaller than low or greater than high, otherwise the value will be returned as the result of the function. It will also throw a "Data type" error if the entry cannot be represented as an integer.
ESI HToESI (HANDLE Handle); |
Converts a handle to an expression stack index.
HToESI is a simple but very useful routine. It returns a pointer to the last
byte of the MULTI_EXPR structure referenced
by Handle. Therefore it allows for the use of TIOS variables as input
data in expression stack routines. Assuming that Handle
is a handle of a TIOS variable which contains an expression, HToESI will return a pointer
to the tag of the expression contained in the variable. Such a pointer may be used in
any routine which needs an argument of type CESI, like
NG_approxESI, etc. (except in functions which manipulate
the actual memory space on the expression stack, like
delete_between).
In fact, HToESI simply dereferences Handle and adds the size plus 1 to the address.
It also may be used to determine the type of a TIOS variable, because after execution the
result points to the data type tag of the variable data.
Note: If the handle is not locked, HToESI must be called again after a heap compression
since the block of memory associated with the handle may have moved.
ESI im_index (CESI ptr); |
Gets the index of the imaginary part of an expression.
If ptr points to the COMPLEX_TAG
(i.e. if the expression is complex), im_index returns the pointer
to the imaginary part of the expression. If ptr does not point to the
COMPLEX_TAG (i.e. if the expression is real),
im_index returns a pointer to a simple zero expression, i.e. expression which
consists only of the number 0 (floating point or integer,
depending on whether the approximation mode is active or not).
Note: The expression should be in internal canonic form
(see push_internal_simplify), else this function
is not reliable.
ESI index_below_display_expression_aux (CESI ptr); |
Main routine for detokenizing.
index_below_display_expression_aux is main (recursive) routine for detokenizing. As it is just an auxiliary routine used in display_statements and Parse1DExpr, it shouldn't need to be used directly.
ESI index_main_var (CESI ptr); |
Searches an expression for a first encountered variable.
index_main_var returns the index of the first encountered variable in the expression pointed to by ptr. More precise, it repeatedly decreases value of ptr by one until the tag of a variable, a number or a symbolic constant (like pi) is reached. As expressions are usually organized in "internal canonic" form (see notes given with description of numeric_factor_index) in which all constants are always "below" variables on the stack, a variable will always be reached before any constant, except if there are not any variables in the expression (in this case, a pointer to a constant is returned). Obviously, this function is not reliable if the expression is not in the internal canonic form (see push_internal_simplify).
ESI index_numeric_term (CESI ptr); |
Searches terms in the expression for a numeric term.
If ptr points to the ADD_TAG, which is a case when it
points to an expression of form term1 + term2 + ...
(i.e. if the expression is a sum of simpler terms), index_numeric_term returns the pointer
to the eventual numeric term in the expression. If the expression is a number, index_numeric_term
returns ptr (i.e. the pointer to the expression itself). If ptr does not point to
the ADD_TAG (i.e. if the expression is not a sum of simpler terms),
or if there are not any numeric terms in the expression, index_numeric_factor returns
a pointer to a simple expression which consists only of the number 0 (floating point or integer,
depending on whether the approximation mode is active or not).
Note: This function is not implemented to be very universal. TIOS always "reorganizes" expressions
on such way that numeric terms are at the beginning of the expression (for example, x+3 will be reorganized
into 3+x, although it will be displayed just reversed, i.e. as x+3), and this function assumes that the
expression is organized on such way. In other words, it must be in internal canonic form (such
expressions always have at most one term with a numeric tag, in which case it is the deepest
term). Fortunately,
all expressions in argument are always in internal canonic form. However, this is not true after
push_parse_text function, nor after an evaluation using
NG_rationalESI or NG_approxESI. In
other words, results of these commands are not always "correctly" organized. To force converting
an expression to the internal canonic form, always call
push_internal_simplify after usage of any of the functions
mentioned above.
ESI index_of_lead_base_of_lead_term (CESI ptr); |
Gets the index of the base of the lead term of an expression.
index_of_lead_base_of_lead_term first calls lead_term_index, then apply lead_base_index on the result. So, it returns the pointer to the base of the lead factor of the first term of the expression pointed to by ptr.
ESI *init_list_indices (ESI *indices, CESI expr); |
Computes and stores the indices of the elements of a list.
init_list_indices stores the index of the first element to indices, then it
repeatedly calls next_expression_index and
stores the result to indices until END_TAG is reached.
expr is assumed to point to a LIST_TAG.
init_list_indices returns indices.
Here is an example (called "List elements") which displays the list elements as returned by
init_list_indices:
// Shows how the init_list_indices function works. #define USE_TI89 // Compile for TI-89 #define USE_TI92PLUS // Compile for TI-92 Plus #define USE_V200 // Compile for V200 #define MIN_AMS 101 // Compile for AMS 1.01 or higher #define SAVE_SCREEN // Save/Restore LCD Contents #include <tigcclib.h> // Include All Header Files // The {1, 0, -1} list. static const ESQ list_1_0_minus1[10] = {END_TAG, 0x01, 0x01, NEGINT_TAG, 0x00, POSINT_TAG, 0x01, 0x01, POSINT_TAG, LIST_TAG}; // Main Function void _main(void) { ESI elements[3]; HANDLE h; TRY ClrScr(); DrawStr (0, 0, "The elements of list", A_NORMAL); DrawStr (0, 20, "are", A_NORMAL); // Print whole expression. h = Parse1DExpr (list_1_0_minus1 + 9, FALSE, 0); DrawStr(0, 10, HeapDeref(h), A_NORMAL); HeapFree(h); // Get the individual constituents of the expression and print them. init_list_indices(elements, list_1_0_minus1 + 9); h = Parse1DExpr (elements[0], FALSE, 0); DrawStr(0, 30, HeapDeref(h), A_NORMAL); HeapFree(h); h = Parse1DExpr (elements[1], FALSE, 0); DrawStr(0, 40, HeapDeref(h), A_NORMAL); HeapFree(h); h = Parse1DExpr (elements[2], FALSE, 0); DrawStr(0, 50, HeapDeref(h), A_NORMAL); HeapFree(h); ONERR DrawStr (0, 70, "Error!", A_NORMAL); ENDTRY GKeyIn (NULL, 0); }
ESI *init_matrix_indices (ESI *indices, CESI expr); |
Computes and stores the indices of the elements of a matrix.
init_matrix_indices stores the index of the first element of the first row to indices, then
it repeatedly calls next_expression_index and
stores the result to indices until the END_TAG
for the whole matrix is reached.
expr is assumed to point to a double LIST_TAG.
init_matrix_indices returns indices.
Here is an example (called "Matrix elements") which displays the matrix elements as returned by
init_matrix_indices:
// Shows how the init_matrix_indices function works. #define USE_TI89 // Compile for TI-89 #define USE_TI92PLUS // Compile for TI-92 Plus #define USE_V200 // Compile for V200 #define MIN_AMS 101 // Compile for AMS 1.01 or higher #define SAVE_SCREEN // Save/Restore LCD Contents #include <tigcclib.h> // Include All Header Files // The [1, 0; 0, 1] matrix. static const ESQ matrix_identity_2[16] = {END_TAG, END_TAG, 0x01, 0x01, POSINT_TAG, 0x00, POSINT_TAG, LIST_TAG, END_TAG, 0x00, POSINT_TAG, 0x01, 0x01, POSINT_TAG, LIST_TAG, LIST_TAG}; // Main Function void _main(void) { ESI elements[4]; HANDLE h; TRY ClrScr(); DrawStr (0, 0, "The elements of matrix", A_NORMAL); DrawStr (0, 20, "are", A_NORMAL); // Print whole expression. h = Parse1DExpr (matrix_identity_2 + 15, FALSE, 0); DrawStr(0, 10, HeapDeref(h), A_NORMAL); HeapFree(h); // Get the individual constituents of the expression and print them. init_matrix_indices(elements, matrix_identity_2 + 15); h = Parse1DExpr (elements[0], FALSE, 0); DrawStr(0, 30, HeapDeref(h), A_NORMAL); HeapFree(h); h = Parse1DExpr (elements[1], FALSE, 0); DrawStr(0, 40, HeapDeref(h), A_NORMAL); HeapFree(h); h = Parse1DExpr (elements[2], FALSE, 0); DrawStr(0, 50, HeapDeref(h), A_NORMAL); HeapFree(h); h = Parse1DExpr (elements[3], FALSE, 0); DrawStr(0, 60, HeapDeref(h), A_NORMAL); HeapFree(h); ONERR DrawStr (0, 70, "Error!", A_NORMAL); ENDTRY GKeyIn (NULL, 0); }
short integer_non_unknown (CESI ptr); |
Tests if an expression is an integer.
Returns 1 if the expression pointed to by ptr is an integer
or floating-point value; returns -1 for constants like p or e.
Returns 0 for everything else - this includes expressions like ln(2)
,
2p
, or Ö(2)
.
short is0 (CESI ptr); |
Tests if an expression is equal to 0.
Returns TRUE if the expression pointed to by ptr is equal to zero (integer or floating point).
See also: is1, is_minus1, is_never0
short is1 (CESI ptr); |
Tests if an expression is equal to 1.
Returns TRUE if the expression pointed to by ptr is equal to one (integer or floating point).
short is_advanced_tag (ESQ Tag); |
Checks whether a tag is an advanced tag.
is_advanced_tag returns TRUE if a byte Tag is an advanced tag, otherwise it returns FALSE. Advanced tags are all tags which do not represent a variable, a number (integer, fraction or float) or an expression which consists only of simple operations "+", "-", "*", "/" and "^" (including element-by-element versions "+.", "-.", "*.", "/." and "^.").
short is_antisymmetric (CESI expr_ptr, CESI var_ptr); |
Checks for a antisymmetry.
is_antisymmetric returns TRUE if the expression pointed to by expr_ptr is such that it changes the sign but keeps the same magnitude when the variable pointed to by var_ptr changes it sign, otherwise it returns FALSE.
short is_complex0 (CESI ptr); |
Checks whether an expression is reducible to zero.
is_complex0 returns TRUE if the expression pointed to by
ptr is a zero (signed, unsigned, or even complex), otherwise it returns FALSE.
Note: The information about this routine in releases of TIGCCLIB before 2.3 was wrong.
short is_complex_number (CESI ptr); |
Checks whether an expression is a number.
is_complex_number returns TRUE if the expression (in RPN form,
of course) pointed to by ptr is a "number" (integer, rational, floating point, or
complex, but not irrational), otherwise it returns FALSE.
Note that 'sqrt(2)'
is not a "number" in this convention.
A complex number is a "number" if both real and imaginary parts are "numbers" in a sense
of the convention given above.
Note: The information about this routine in releases of TIGCCLIB before 2.3 was wrong.
See also: likely_approx_to_number
short is_constant (CESI ptr); |
Checks whether an expression is constant.
is_constant returns TRUE if the expression pointed to by ptr does not rely on any variables (initialized, built-in, but not constants like p), otherwise it returns FALSE.
short is_Float_exact_whole_number (CESI ptr); |
Checks whether a floating point entry is an exact whole number.
is_Float_exact_whole_number returns TRUE if the floating point entry pointed to by ptr is an exact whole number whose magnitude is less than the smallest whole number that is not represented exactly (1e15), otherwise it returns FALSE.
short is_free_of_tag (CESI ptr, ESQ Tag); |
Checks whether an expression is free of a particular tag.
is_free_of_tag is a recursive function which returns TRUE if the expression structure pointed to by ptr is free of tag Tag, otherwise it returns FALSE.
short is_independent_of_de_seq_vars (CESI ptr); |
Checks whether an expression is independent of differential equation and sequence variables.
is_independent_of_de_seq_vars returns TRUE if the expression pointed to by expr_ptr is independent of system variables which are used for differential equation and sequence graphing (i.e. variables u1-u99 and y1'-y99'), otherwise it returns FALSE.
short is_independent_of_elements (CESI expr_ptr, CESI varlist_ptr); |
Checks whether an expression is independent of the elements of a list.
is_independent_of_elements is very similar to is_independent_of_tail. Assuming that varlist_ptr points to the list of variables or expressions (more precise, to the LIST_TAG of such list), is_independent_of_elements returns TRUE if the expression pointed to by expr_ptr is independent of all variables from the list pointed to by varlist_ptr, otherwise it returns FALSE. More precisely,
is_independent_of_elements (expr_ptr, varlist_ptr)
is the same as
is_independent_of_tail (expr_ptr, varlist_ptr - 1)
short is_independent_of_tail (CESI expr_ptr, CESI start_ptr); |
Checks whether an expression is independent of a sequence of variables (or expressions).
is_independent_of_tail returns TRUE if the expression pointed to by expr_ptr is independent of all entries on the expression stack stored below start_ptr up to END_TAG tag, otherwise it returns FALSE.
See also: is_independent_of, is_independent_of_elements, map_tail, all_tail
short is_independent_of (CESI expr_ptr, CESI var_ptr); |
Checks whether an expression is independent of a variable (or expression).
is_independent_of returns TRUE if the expression pointed to by
expr_ptr is independent of the variable pointed to by
var_ptr, else returns FALSE. Although var_ptr
may point to something which is not a variable, the independence of the "expression"
is not well defined, so avoid such situations until more information about what
such "independence" means (TI says that this means "syntactical independence", but
this is not well defined either).
Note: This routine (and all other "independence" routines also)
is not reliable if expressions are not in internal canonic form
(see push_internal_simplify).
short is_matrix (CESI ptr); |
Checks whether an expression is a matrix.
is_matrix returns TRUE if the expression pointed to by ptr is a matrix (i.e. a list which consists of equally sized lists), otherwise it returns FALSE.
short is_minus1 (CESI ptr); |
Tests if an expression is equal to -1.
Returns TRUE if the expression pointed to by ptr is equal to negative one (integer or floating point).
short is_monomial_in_kernel (CESI ptr); |
Checks whether an expression is a monomial in kernel.
is_monomial_in_kernel returns TRUE if the expression pointed to by
ptr is a monomial in kernel, i.e. if it is a monomial function of kernels,
where "kernel" means any irrational subexpression, else returns FALSE.
For example, 'sin(x)*ln(y)'
is not monomial (in respect to 'x'
and 'y'
), but it is monomial in kernel (in respect to 'sin(x)'
and 'ln(y)'
).
short is_monomial (CESI ptr); |
Checks whether an expression is a monomial.
is_monomial returns TRUE if the expression pointed to by
ptr is a monomial expression, otherwise it returns FALSE.
For example, the expression 'x*y^3'
is a monomial, and
x+y*z'
or 'ln(x)'
are not.
short is_narrowly_independent_of (CESI expr_ptr, CESI var_ptr); |
Checks whether an expression is narrowly independent of a variable (???).
is_narrowly_independent_of returns TRUE if the expression pointed to by expr_ptr is narrowly independent of the variable pointed to by var_ptr, otherwise it returns FALSE. I am not sure what "narrowly independent" really means, and what the difference between this function and is_independent_of is.
short is_negative (CESI ptr); |
Tests if an expression is less than 0.
Returns TRUE if the expression pointed to by ptr is known to be negative, FALSE otherwise.
See also: is_nonnegative, is_positive, is_nonpositive
short is_never0 (CESI ptr); |
Tests if an expression is never 0.
Returns TRUE if the expression pointed to by ptr cannot be equal to zero.
See also: is0
short is_nonnegative (CESI ptr); |
Tests if an expression is >= 0.
Returns TRUE if the expression pointed to by ptr is known to be positive or zero, FALSE otherwise.
See also: is_negative, is_positive, is_nonpositive
short is_nonpositive (CESI ptr); |
Tests if an expression is <= 0.
Returns TRUE if the expression pointed to by ptr is known to be negative or zero, FALSE otherwise.
See also: is_positive, is_negative, is_nonnegative
short is_polynomial_in_var_or_kern (CESI test, CESI var_or_kern); |
Checks if an expression is a polynomial with respect to another expression.
is_polynomial_in_var_or_kern returns TRUE if the expression pointed to by test is a polynomial with respect to the expression var_or_kern, otherwise it returns FALSE. The definition of "polynomial with respect to" is more complicated when dealing with expressions in var_or_kern. For example, "x+sin(x)" is polynomial with respect to "sin(x)" but not to "x". Interestingly, when testing with respect to "sin(x)", "x" seems to be treated like a constant.
short is_pos_int_and_eq_quantum (CESI expr, ESQ num); |
Determines whether expr points to the tag of a positive integer equal to num.
Returns TRUE if expr points to the tag of a positive integer equal to num, FALSE otherwise.
This function assumes that num is nonzero.
short is_positive (CESI ptr); |
Tests if an expression is greater than 0.
Returns TRUE if the expression pointed to by ptr is known to be positive (not zero), FALSE otherwise.
See also: is_nonpositive, is_negative, is_nonnegative
short is_reciprocal_of_quantum (CESI, ESQ); |
Determines whether expr points to the tag of the reciprocal of ESQ
num.
Returns TRUE if expr points to the tag of the fraction that is the reciprocal of
ESQ
num, FALSE otherwise.
This function assumes that num is nonzero.
short is_square_matrix (CESI ptr); |
Checks whether an expression is a square matrix.
is_square_matrix returns TRUE if the expression pointed to by ptr is a square matrix, otherwise it returns FALSE.
short is_symmetric (CESI expr_ptr, CESI var_ptr); |
Checks for symmetry.
is_symmetric returns TRUE if the expression pointed to by expr_ptr is such that it remains the same when the variable pointed to by var_ptr changes its sign, otherwise it returns FALSE.
short is_tail_independent_of (CESI start_ptr, CESI var_ptr); |
Checks whether a sequence of expressions is independent of a variable (or expression).
is_tail_independent_of returns TRUE if all expressions on the expression stack which are stored below start_ptr up to END_TAG are independent of the variable pointed to by var_ptr, otherwise it returns FALSE.
See also: is_independent_of, map_tail, all_tail
short is_temperature_unit(CESI ptr); |
Checks for strings of temperature units.
Checks if ptr points to the end of AMS strings (zero-padded at both sides) SYMSTR("_°C"), SYMSTR("_°K"), SYMSTR("_°F") and SYMSTR("_°R"), i.e. strings of temperature units.
short is_totally_polynomial (CESI ptr); |
Checks if an expression is polynomial in all variables.
is_totally_polynomial returns TRUE if the expression pointed to by ptr is polynomial with respect to all variables - that is, consists only of variables raised to positive constant powers (with coefficients) and multiplied or added together. Otherwise it returns FALSE.
short is_valid_smap_aggregate (CESI ptr); |
Checks whether an expression is a valid aggregate type.
is_valid_smap_aggregate returns TRUE if the expression pointed to by ptr is a valid aggregate type (i.e. list or valid matrix), otherwise it returns FALSE. This is not a simple check whether a tag pointed to by ptr is LIST_TAG. For example, list which consists of lists which are not equally sized (like {{1,2,3},{4,5}}) are not valid. Also, matrices whose elements are list or matrices are also not valid aggregate types.
short is_variable (CESI ptr); |
Checks if the expression is a variable.
is_variable returns TRUE if the expression is a variable and FALSE if it is not.
short is_whole_number (CESI ptr); |
Tests if an expression is a whole number.
Returns TRUE if the expression pointed to by ptr is a whole number (it can be a floating-point value).
ESI last_element_index (CESI ptr); |
Searches for the last expression in the list.
last_element_index calls next_expression_index in a loop starting from ptr until END_TAG is reached, then returns the pointer to the last encountered expression before END_TAG. So, assuming that ptr points to a member of the list (including argument lists too), last_element_index will return the pointer to the last element of the list.
ESI lead_base_index (CESI ptr); |
Gets the index of the base of the lead factor of an expression.
lead_base_index first calls lead_factor_index, then applies factor_base_index to the result. So, it returns the pointer to the base of the lead factor (i.e. the lead base) of the expression pointed to by ptr.
ESI lead_exponent_index (CESI ptr); |
Gets the index of the exponent of the lead factor of an expression.
lead_exponent_index first calls lead_factor_index, then applies factor_exponent_index to the result. So, it returns the pointer to the exponent of the lead factor (i.e. the lead exponent) of the expression pointed to by ptr.
ESI lead_factor_index (CESI ptr); |
Gets the index of the lead factor of an expression.
If ptr points to the MUL_TAG, which is the case when it
points to an expression of form factor1 * factor2 * ...
(i.e. if the expression is a product of simpler factors), lead_factor_index returns the pointer
to factor1 (i.e. to the lead factor). If ptr does not point to the
MUL_TAG (i.e. if the expression is not a product of simpler factors),
lead_factor_index returns ptr (i.e. the pointer to the expression itself).
Note: Expressions in internal canonic form have the most main factor shallowest, with less main factors deeper
(see compare_expressions for more info about "main"
ordering). Also, the lead factor of an internally-simplified product is never a product.
For example, lead factor of '(3*x^2)*y'
converted into canonic form is
'x^2'
. Internally-simplified numeric denominator factors are combined with
numeric numerator factors into a fractional numeric factor. Non-numeric denominator
factors are internally simplified to be merged with numerator factors as negative powers.
For example, the lead factor of '2/x'
converted into canonic form is
'x^-1'
. A factor having a sum as its base orders shallower than a factor
having the sum’s main variable as its base. For example, the lead factor
of '(x+1)^-2*x^3'
converted into canonic form is '(x+1)^-2'
.
See push_internal_simplify
for more info about how to convert an expression into the internal canonic form.
ESI lead_term_index (CESI ptr); |
Gets the index of the lead term of an expression.
If ptr points to the ADD_TAG, which is a case when it
points to an expression of form term1 + term2 + ...
(i.e. if the expression is a sum of simpler terms), lead_term_index returns the pointer
to term1 (i.e. to the lead term). If ptr does not point to the
ADD_TAG (i.e. if the expression is not a sum of simpler terms),
lead_term_index returns ptr (i.e. the pointer to the expression itself).
Note: Expressions in internal canonic form have the most main term shallowest, with less main
terms deeper (see compare_expressions about more info about
"main" ordering). Also, the lead term of an internally-simplified sum is never a sum.
For example, the lead term of '(2+x)+y'
converted to canonic form is 'x'
.
By default, similar powers of the main variable are collected in internal canonic forms.
For example, the lead term of 'x^2*y+x^2+5'
converted to canonic form is
'x^2*(y+1)'
. See push_internal_simplify
for more info about how to convert an expression into the internal canonic form.
short likely_approx_to_complex_number (CESI ptr); |
Checks if it is likely that an expression can be approxed to a complex number.
likely_approx_to_complex_number is very similar to likely_approx_to_number, except that it checks for the possibility of approximation to numbers which need not be real numbers.
short likely_approx_to_number (CESI ptr); |
Checks is it likely that an expression can be approxed to a real number.
If likely_approx_to_number returned TRUE, it is sure that the expression pointed to by
ptr can be approxed to a real number, but returning FALSE
does not mean that the approximation is not possible: it only means that the approximation
to a number is not obvious. For example, it is obvious that expression
'ln(2+sin(1))/5'
can be approxed to a number, but this is not so obvious for
expression 'x^2+1-x*x'
, because it
contains a symbolic variable name. See can_be_approxed for a more
detailed investigation of possibility of approximation.
ESI main_gen_var_index (CESI ptr); |
Searches an expression for a generalized variable.
main_gen_var_index is a variant of index_main_var, but it
searches for a "generalized variable", which may also be a subexpression. For example,
if the expression is 'sin(x)+y'
, index_main_var
will return a pointer to 'x'
, but main_gen_var_index will return a pointer to
'sin(x)'
. Generalized variable can be an ordinary variable, the base of a
noninteger power, or a kernel (like 'sin(x)'
), meaning any other irrational
subexpression.
More precise, main_gen_var_index skips all ADD_TAG,
MUL_TAG and POW_TAG tags, then stops at the
first tag which is not equal to some of them. In addition to this, if the tag is
POW_TAG, function next_expression_index
will be called, to get access to the base of the power (note that "powers" cannot be
"reorganized" on such way that constants are always in front of variables, because '2^x'
and 'x^2'
are not the same expression). This implies that "main generalized variable"
of a sum, a product or an integer power is equal to the main generalized variable of a lead term,
a lead factor or a base respectively. Otherwise, main generalized variable is the expression
itself. For example, main "generalized variables" of expressions 'sin(x)^2*y+ln(z)'
,
'3^(1/5)+2'
and '(x+y)^(1/2)+x'
are 'sin(x)'
,
'3'
and 'x+y'
respectively.
short map_tail_Int (ESI_Callback_Int_t f, ESI start_ptr, short n); |
Applies an extended function to all elements in the list.
map_tail_Int is very similar to map_tail, except callback function f has one additional parameter n. Each time f is called, the parameter n passed to map_tail_Int is passed to f. Also, the callback function is not void but returns a Boolean value (TRUE or FALSE). The result of map_tail_Int is the logical OR of all the values returned by f.
void map_tail (ESI_Callback_t f, ESI start_ptr); |
Applies a function to all elements in the list.
map_tail first pushes END_TAG on the expression stack, then
calls callback function f for every expression on the expression stack
(in reversed order), starting from the expression pointed to by start_ptr until
END_TAG is reached. Each time f is called, a pointer to the
actual expression is passed to it. This function is very useful if you want to apply some
operation on all elements of the list (then start_ptr need to point to the first
element of the list). If the callback function does not push anything on the stack, the
END_TAG pushed by map_tail should probably be deleted.
Note: map_tail calls next_expression_index
to step from one expression to another.
void map_unary_over_comparison (ESI_Callback_t f, ESI cmptag_ptr); |
Calls callback function for both comparison terms and pushes the comparison tag.
map_unary_over_comparison assumes that cmptag_ptr
points to a comparison tag. It calls the callback function f twice, passing to it pointers
to both comparison terms, i.e. the two expressions below the comparison tag (the callback function
should push something to the expression stack). The callback function is applied first to the
deeper argument on the stack, then to the shallower argument. Finally, map_unary_over_comparison
will push the tag pointed to by cmptag_ptr (one byte) to the expression stack.
This function is useful to perform some transformations on both sides of a comparison
(e.g. to transform 'n<5'
into 'n!<120'
). Beware that squaring of
both sides of an inequality can cause loss of solutions, and squaring both sides of an
equation may introduce spurious solutions!
ESQ min_quantum (ESQ Tag1, ESQ Tag2); |
Finds smaller of two tags.
min_quantum returns Tag1 if it is smaller than Tag2, else returns Tag2.
void move_between_to_top (ESI ptr1, ESI ptr2); |
Moves a sequence of bytes to the top of the expression stack.
move_between_to_top moves a sequence of bytes between ptr1 and ptr2 (more precise, starting at ptr1+1 and ending at ptr2) to the top of the expression stack. It acts like a combination of push_between and delete_between (in fact, it is). This routine assumes that ptr1 and ptr2 really point to parts of the expression stack and that ptr2 is above ptr1, otherwise the result is unpredictable.
unsigned short moved_between_to_top (ESI ptr1, ESI ptr2); |
Moves a sequence of bytes to the top of the expression stack.
moved_between_to_top acts like move_between_to_top, but it also returns a number of moved bytes. It calls deleted_between instead of delete_between.
void negate_top (void); |
Negates the top of the EStack.
negate_top changes the sign of the expression on the top of the EStack.
See also: add_to_top, subtract_from_top, and_onto_top
ESI next_expression_index (CESI ptr); |
Finds the next entry on the expression stack.
Assuming that ptr points to an expression entry on the expression stack,
next_expression_index returns the pointer which points to an expression which is
located just below the expression pointed to by ptr. So, by successive calls
to next_expression_index starting from top_estack, you
can locate all expressions on the stack. This command will throw an error if
ptr points to the END_TAG, so be careful.
Note: next_expression_index calls index_after_match_endtag
for TI-Basic functions and program tags, so that inline functions are counted as entire
expressions rather than of their components.
void NG_approxESI (CESI ptr); |
Evaluates an expression in "APPROX" mode.
NG_approxESI executes the entry on the expression stack pointed to by ptr (it needs to point to the entry tag) in "APPROX" mode, then pushes the result (i.e. a new expression) on the top of the expression stack. The pushed result is NOT in internal canonic form (if necessary, do push_internal_simplify to force conversion to the internal canonic form). The following example illustrates this very powerful command:
push_parse_text ("sin(1.3)+log(2)/7"); NG_approxESI (top_estack); printf_xy (0, 50, "%f", estack_number_to_Float (top_estack));
See push_parse_text and estack_number_to_Float
to understand how this example works.
Note: The expression must not contain TI-Basic statements.
For executing TI-Basic statements, use NG_execute. Also, this
command may cause expansion of the expression stack or heap compression, and may throw
various errors is something is wrong.
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.
void NG_graphESI (CESI ptr, HANDLE Handle); |
Evaluates an expressions for graphing purposes.
NG_graphESI is the function used in TIOS during drawing function graphs. It evaluates the entry on the expression stack pointed to by ptr in "APPROX" mode then pushes the result on the top of the expression stack, similar to what NG_approxESI does, but NG_graphESI requires that all variables in the expression must be defined, i.e. the expression must evaluate to a number (else "Undefined variable" error will be thrown). Handle is the handle of the function in which the expression is defined. I don't know exactly when and why this function needs this handle (probably to check which variables are parameters of the function, which variables are local etc.). When I tried to pass H_NULL to this function, nothing bad happened. However, in the absence of more info, avoid this function.
void NG_rationalESI (CESI ptr); |
Evaluates an expression in "EXACT" mode.
NG_rationalESI executes the entry on the expression stack pointed to by ptr
(it needs to point to the entry tag) in "EXACT" mode, then pushes the result (i.e. a new
expression) on the top of the expression stack. See the example of usage given with
display_statements. The same notes given with
NG_approxESI are true with this command too.
Note: The expression must not contain TI-Basic statements.
For executing TI-Basic statements, use NG_execute. Also, this
command may cause expansion of the expression stack or heap compression, and may throw
various errors is something is wrong.
HANDLE NG_RPNToText (HANDLE hRPN, unsigned short NewLines, unsigned short FullPrec); |
Detokenizes a tokenized structure associated with a handle.
NG_RPNToText detokenizes a tokenized structure (an expression, TI-Basic statement or a group of statements) associated with handle hRPN and returns a handle to the memory block where detokenized string is stored (you don't need to allocate anything by yourself, this function will do it instead). The first word of the data associated with hRPN should be the length of the data which is used to find the first tag of the tokenized data. It throws an error if the detokenization fails. This function is mainly identical to display_statements except NG_RPNToText requires a handle instead of the pointer to the structure which needs to be detokenized. See display_statements for more info.
short NG_tokenize (HANDLE hTEXT, unsigned short *ErrCode, unsigned short *ErrOffset); |
Tokenizes text associated with a handle and pushes them to the expression stack.
NG_tokenize is more powerful variant of push_parse_text. It tokenizes the text associated with the handle hTEXT, and pushes the converted text to the expression stack. Returns TRUE if the operation was successful, otherwise it returns FALSE. If there was an error, then the variable pointed to by ErrCode contains the error code, and the variable pointed to by ErrOffset contains the offset in the text where the error occurred. If there were not any errors, then the variable pointed to by ErrCode contains multi state (this is the result returned from push_parse_text) and ErrOffset is undefined. This routine may expand the expression stack, may cause the heap compression, or even may throw an error if something goes really wrong (not enough memory, for example).
float norm1_complex_Float (CESI ptr); |
Finds the 1-norm of a complex number entry.
norm1_complex_Float finds the 1-norm (i.e. the sum of absolute values of real and imaginary part) of the complex number entry pointed to by ptr and returns the result. If the entry is not a complex or real floating point number, the result is garbage (in the case of a real number, norm1_complex_Float reduces to a simple absolute value).
ESI numeric_factor_index (CESI ptr); |
Searches factors in the expression for a numeric factor.
If ptr points to the MUL_TAG, which is a case when it
points to an expression of form factor1 * factor2 * ...
(i.e. if the expression is a product of simpler factors), numeric_factor_index returns the pointer
to the eventual numeric factor in the expression. If the expression is a number, numeric_factor_index
returns ptr (i.e. the pointer to the expression itself). If ptr does not point to
the MUL_TAG (i.e. if the expression is not a product of simpler factors),
or if there is not any numeric factors in the expression, lead_factor_index returns
a pointer to a simple expression which consists only of the number 1 (floating point or integer,
depending of whether the approximation mode is active or not).
Note: This function is not implemented to be very universal. TIOS always "reorganizes" expressions
on such way that numeric factors are at the beginning of the expression (i.e. x*3 will be reorganized
into 3*x), and this function assumes that the expression is organized on such way. This is the so-called
"internal canonic" form, and such expressions always have at most one factor with a numeric tag, in
which case it is the deepest factor. So, '3*x^2*y'
contains a numeric factor (3),
but '2*x+3'
does not. Also, numeric factors in numerators and denominators are
always simplified into a single numeric factor in internal canonic forms (so, the numeric
factor of '6*x/(4*y)'
after conversion to canonic form is 3/2. Fortunately,
all expressions in arguments are always in internal canonic form. However, this is not true after
push_parse_text function, nor after an evaluation using
NG_rationalESI or NG_approxESI. In
other words, results of these commands are not always "correctly" organized. To force converting
an expression to the internal canonic form, always call
push_internal_simplify after usage any of functions
mentioned above.
void or_onto_top (CESI ptr); |
Logical ORs an expression onto the estack.
or_onto_top replaces the top expression on the estack with the logical OR of itself and the expression pointed to by ptr.
See also: and_onto_top
void Parms2D (CESI ptr, short *Width, short *Bottom, short *Top); |
Gets information about dimensions of block which will be "pretty printed".
Parms2D gets information about the screen space which will be occupied by displayed expression. It should be called after calling Parse2DExpr (or Parse2DMultiExpr), and ptr should be a result returned from it. Params2D stores the information in three variables pointed to by Width, Bottom and Top. Width is the width of the displayed block, and Top and Bottom are distances of top and bottom edge of the block measured from the wanted y position. More precise, if the expression is printed at (x, y) using Print2DExpr, the left corner of the occupied space will be at (x, y-*Top), and the right corner of the occupied space will be at (x+*Width, y+*Bottom). So, the 2D expression has an imaginary center line above which is the "Top", and below (counting this line too) is the "Bottom".
HANDLE Parse1DExpr (CESI ptr, unsigned short FullPrec, unsigned short width); |
Parses a tokenized expression to be printed.
Parse1DExpr does a similar job as display_statements (i.e. converts a RPN expression to the TEXT and returns the handle to the text), but the parameters are somewhat different. Here, width is the maximum width of text result (0 indicates no width restriction). So, when necessary, symbolic expressions are truncated to width-1 characters and terminated with an ellipsis character ('...'). When ptr points to a tagged floating point number, the number is rounded to fit in width characters. When the number cannot be rounded to fit in width characters, an ellipsis character ('...') is returned. See display_statements for more info.
ESI Parse2DExpr (CESI ptr, unsigned short FullPrec); |
Parses a tokenized expression to be pretty printed using Print2DExpr.
Parse2DExpr parses the expression pointed to by ptr, so it can be displayed with
Print2DExpr. This function splits up expression into blocks with
information about their relative position and size. This splitting is performed for
efficiency reasons, so the expression may be displayed again without having to calculate
the positions again. Parse2DExpr returns the pointer to a created structure (it needs to be
passed to Print2DExpr). This pointer is in fact the new
value of top_estack, because the created structure (known as "boxed RPN")
is also pushed on the expression stack. FullPrec is a Boolean flag:
when it is non-zero, all floating point values will be converted using the maximal precision
(14 digits), else current precision settings (from TI-Basic MODE dialog) will be used.
If there is not enough memory, a special symbol is pushed onto the expression stack to signify
this. This routine may cause heap compression.
See Print2DExpr for an example of usage.
Parse2DExpr will always convert expressions into the "canonic printing (external) form".
For example, both x*3 and 3*x will be displayed as 3*x, x*y^(-1) will be displayed as x/y etc.
Note: Break key (ON) is checked during execution of this function, and pressing it will throw
an error!
ESI Parse2DMultiExpr (HANDLE Handle, unsigned short FullPrec); |
Parses a multi-statement expression associated with a handle to be pretty printed using Print2DExpr.
Parse2DMultiExpr parses a multi-expression (see MULTI_EXPR) associated with Handle so that it can be displayed with Print2DExpr. Parameter FullPrec has the same meaning as in Parse2DExpr. The expression associated with Handle may contain multiple expressions separated with NEXTEXPR_TAG (in opposite to Parse2DExpr). I must admit that I don't understand this function very well, so avoid it except if you know about it more than I know...
void Print2DExpr (CESI ptr, WINDOW *w, short x, short y); |
Performs "pretty printing" (or "2D printing") of an expression.
Print2DExpr prints the expression in "pretty" or "2D" style. Before printing, the expression
needs first to be "parsed" using Parse2DExpr, and argument ptr
should be a result returned from Parse2DExpr
(an error may be thrown if ptr points to something else). w is a pointer
to the WINDOW structure which describes the window in which
the expression will be displayed (see wingraph.h header file for
more info about windows). If you didn't create your own windows in the program, you can pass
DeskTop as the parameter (as in the example given below).
x and y are coordinates (window-relative) where the expression will be printed.
x determines the left edge of the expression, and the expression goes (in y direction)
both above and below the value of y. See Parms2D for exact
information about dimensions of displayed expression. If the displayed expression cannot fit
into the given window, it will be simply clipped at edges of the window.
Here is an example (called "Pretty Print") which first calculates the integral of 1/((x-3)(x^2+4)), then "pretty prints"
the result on the screen:
// Calculate an integral and pretty print it #define USE_TI89 // Compile for TI-89 #define USE_TI92PLUS // Compile for TI-92 Plus #define USE_V200 // Compile for V200 #define MIN_AMS 101 // Compile for AMS 1.01 or higher #define SAVE_SCREEN // Save/Restore LCD Contents #include <tigcclib.h> // Include All Header Files // Main Function void _main(void) { TRY push_END_TAG (); push_quantum (VAR_X_TAG); push_parse_text ("1/((x-3)(x^2+4))"); push_quantum (INTEGRATE_TAG); NG_rationalESI (top_estack); WinClr (DeskTop); Print2DExpr (Parse2DExpr (top_estack, FALSE), DeskTop, 0, 50); ONERR DrawStr (20, 20, "Error!", A_NORMAL); ENDTRY ngetchx (); }
It is also possible to use
Parse2DExpr (top_estack, FALSE); Print2DExpr (top_estack, DeskTop, 0, 50);
instead of
Print2DExpr (Parse2DExpr (top_estack, FALSE), DeskTop, 0, 50);
You can use Parms2D to get information about the height and the width of the printed expression without displaying it on the screen. This may be used to determine coordinates where the expression needs to be displayed.
void push0 (void); |
Pushes a tagged integer or a tagged float 0, depending on the mode setting.
If the mode setting is APPROX, the tagged float 0.0 is pushed onto the EStack. Else, the tagged integer 0 is pushed by push_exact0.
See also: push1, push_minus1, push_exact0, push_exact1, push_exact_minus1
void push1 (void); |
Pushes a tagged integer or a tagged float 1, depending on the mode setting.
If the mode setting is APPROX, the tagged float 1.0 is pushed onto the EStack. Else, the tagged integer 1 is pushed by push_exact1.
See also: push0, push_minus1, push_exact0, push_exact1, push_exact_minus1
void push_ANSI_string (const char *str); |
Pushes a standard C string to the expression stack.
push_ANSI_string is an alias (known from early versions of TIGCCLIB) for the TIOS function push_zstr.
void push_between (void *ptr1, void *ptr2); |
Pushes a sequence of bytes to the expression stack.
push_between pushes a sequence of bytes starting at ptr1+1 and ending at ptr2
to the expression stack.
Note: The break key (ON) is checked during execution of this routine, and an error is thrown if
it is pressed!
void push_cnvrt_integer_if_whole_nmb (CESI ptr); |
Pushes a floating point entry eventually converted to an integer.
push_cnvrt_integer_if_whole_nmb checks the entry on the expression stack pointed to by ptr. If it is not a floating point value (represented by FLOAT_TAG), or if it is a floating point value which is not a whole number, yet another copy of the entry is pushed on the expression stack. If the entry is a floating point value which is a whole number, this number is pushed on the expression stack, but this time as an integer (i.e. with POSINT_TAG or NEGINT_TAG).
void push_e (void); |
Pushes e.
If the mode setting is APPROX, the tagged float e is pushed onto the EStack. Otherwise, e^1 is pushed.
void push_END_TAG (void); |
Pushes end-of-list marker to the expression stack.
push_END_TAG pushes END_TAG to the expression stack. This
is the same as push_quantum (END_TAG).
push_END_TAG may be useful when you want to push a list on the expressions
stack: first push END_TAG, then all elements of the list in reverse order, and finally
push LIST_TAG (using push_LIST_TAG).
See also: push_quantum
void push_exact0 (void); |
Pushes a tagged integer 0.
This routine is called by push0 if the mode setting is not APPROX.
See also: push0, push1, push_minus1, push_exact1, push_exact_minus1
void push_exact1 (void); |
Pushes a tagged integer 1.
This routine is called by push1 if the mode setting is not APPROX.
See also: push0, push1, push_minus1, push_exact0, push_exact_minus1
void push_exact_minus1 (void); |
Pushes a tagged integer -1.
This routine is called by push_minus1 if the mode setting is not APPROX.
See also: push0, push1, push_minus1, push_exact0, push_exact1
void push_expr_quantum (CESI ptr, ESQ Tag); |
Pushes an expression followed by a tag to the expression stack.
push_expr_quantum pushes an entry (expression) pointed to by ptr (it needs to point to the entry tag) to the top of the expression stack, then pushes a byte Tag. The entry does not need to be a simple entity; it may be a complex symbolic expression, too. This is achieved by calling next_expression_index and push_between. This function is useful when you need to perform a unary operation on the expression.
See also: push_expression, push_expr2_quantum
void push_expr2_quantum (CESI ptr1, CESI ptr2, ESQ Tag); |
Pushes two expressions followed by a tag to the expression stack.
push_expr2_quantum pushes two entries (expressions) on the expression stack pointed to by ptr1 and ptr2 to the top of the stack, then pushes a byte Tag. This function is useful when you need to perform a binary operation on two expressions.
See also: push_expression, push_expr_quantum
void push_expression (CESI ptr); |
Pushes an expression to the expression stack.
push_expression pushes an entry (expression) pointed to by ptr (it needs to point to the entry tag) to the top of the expression stack. The entry does not need to be a simple entity; it may be a complex symbolic expression, too. This is achieved by calling next_expression_index and push_between.
See also: push_quantum, push_expr_quantum, push_expr2_quantum
void push_Float_to_nonneg_int (float value); |
Rounds a floating point value to an integer, then pushes it to the expression stack.
push_Float_to_nonneg_int rounds value to the nearest integer, then pushes it to the expression stack, as a tagged integer value. The sign of value is ignored. This routine may throw an error if the truncated integer part of value is not representable as a big integer.
void push_Float_to_rat (CESI ptr); |
Pushes a rational approximation of a floating point entry.
push_Float_to_rat finds a rational approximation of the floating point entry pointed to by ptr (of course, ptr points to the tag), and pushes it on the top of the expression stack. The relative error can be specified using the AMS global variable RAtionalize_tol. This routine works well even with transfinite floats (e.g. POSITIVE_INF will be pushed as INFINITY_TAG).
void push_Float (float value); |
Pushes a floating point value to the expression stack.
push_Float rounds value to the 14 significant digits (using round14), then pushes it to the expression stack. If value is not representable as a finite float, the most appropriate transfinite tag is pushed.
void push_half (void); |
Pushes a tagged fraction +1/2 or a tagged float 0.5, depending on the mode setting.
If the mode setting is APPROX, the tagged float 0.5 is pushed onto the EStack.
Else, the tagged fraction +1/2 is pushed by calling push_reciprocal_of_quantum(2);
See also: push0, push1, push_minus1, push_minus_half, push_reciprocal_of_quantum
void push_i (void); |
Pushes i.
The complex i is pushed onto the EStack, in float or integer form, depending on the APPROX mode setting.
void push_internal_simplify (CESI ptr); |
Converts an expression into internal canonic form and pushes the result to the expression stack.
This extremely important low-level subroutine converts an expression pointed to by ptr to the internal canonic form (see top_estack for more info about the internal canonic form), and pushes the converted expression at the top of the expression stack. This routine accepts all valid (algebraic, calculus, relational, logical or Boolean) tokenized expressions. During the conversion, various simplifications may be performed as well. This routine may cause heap compression, stack expansion, and may throw an error if something goes wrong.
void push_LIST_TAG (void); |
Pushes list tag to the expression stack.
push_LIST_TAG pushes LIST_TAG to the expression stack. This
is the same as push_quantum (LIST_TAG).
push_LIST_TAG may be useful when you want to push a list on the expressions
stack: first push END_TAG (using push_END_TAG),
then all elements of the list in reverse order, and finally push LIST_TAG.
See also: push_quantum
void push_long_to_integer (long value); |
Pushes a signed long integer to the expression stack.
push_long_to_integer pushes the long integer value value to the expression stack. It is the same as push_longint, except that it is implemented in the operating system instead of by GCC4TI.
See also: push_ulong_to_integer, push_ushort_to_integer, push_longint
void push_longint (long value); |
Pushes a long integer to the expression stack.
push_longint pushes the long integer value value to the expression stack.
Note: push_longint is not a TIOS entry; it is implemented "by hand" using
push_quantum. This means that either
push_shortint or push_longint should be used in a
program, but using both is usually not desirable.
See also: push_shortint, push_longlongint
void push_longlongint (long long value); |
Pushes a double-long integer to the expression stack.
push_longlongint pushes the double-long integer value value to the expression stack.
Note: push_longlongint is not a TIOS entry; it is implemented "by hand" using
push_quantum.
See also: push_shortint, push_longint
void push_minus1 (void); |
Pushes a tagged integer or a tagged float -1, depending on the mode setting.
If the mode setting is APPROX, the tagged float -1.0 is pushed onto the EStack. Else, the tagged integer -1 is pushed by push_exact_minus1.
See also: push0, push1, push_exact0, push_exact1, push_exact_minus1
void push_minus_half (void); |
Pushes a tagged fraction -1/2 or a tagged float -0.5, depending on the mode setting.
If the mode setting is APPROX, the tagged float -0.5 is pushed onto the EStack.
Else, the tagged fraction -1/2 is pushed by calling push_minus_recip_of_quantum(2);
See also: push0, push1, push_minus1, push_half, push_minus_recip_of_quantum
void push_minus_recip_of_quantum (ESQ q); |
Pushes on the EStack minus the reciprocal of the argument as a tagged negative fraction.
This function assumes that its argument is strictly superior to 1.
See also: push_reciprocal_of_quantum, push_quantum_as_nonnegative_int, push_negate_quantum_as_negint, push_quantum_pair_as_pos_frac
void push_negate_quantum_as_negint (ESQ); |
Pushes on the EStack the argument as a tagged negative integer.
This function assumes that its argument is strictly superior to 0.
See also: push_quantum_as_nonnegative_int, push_reciprocal_of_quantum, push_minus_recip_of_quantum, push_quantum_pair_as_pos_frac
void push_next_arb_int (void); |
Pushes a next "arbitrary integer" symbol to the expression stack.
push_next_arb_int pushes a next "arbitrary integer" symbol (i.e. symbol @nxxx) to the top of the expression stack. More precise, it increments an internal counter for arbitrary integers, pushes the counter on the stack, then pushes ARB_INT_TAG. The counter wraps to zero after 255 is reached.
void push_next_arb_real (void); |
Pushes a next "arbitrary real" symbol to the expression stack.
push_next_arb_int pushes a next "arbitrary real" symbol (i.e. symbol @xxx) to the top of the expression stack. More precise, it increments an internal counter for arbitrary reals, pushes the counter on the stack, then pushes ARB_REAL_TAG. The counter wraps to zero after 255 is reached.
void push_next_internal_var (ESQ Tag); |
Pushes an internal variable to the expression stack.
push_next_internal_var is an auxiliary function used in calculus operations. It pushes the sequence 0, Tag+1, count, 0 to the expression stack, where count is the internal counter of internal variables. Then, the counter is increased by one. TIOS usually passes 0 or 1 for Tag, so it manages a two independent sets of internal variables. You can see that internal variable names consist of two bytes (see VAR_NAME_TAG): one byte is "set number", and another byte is "number of a variable in the set".
void push_no_solution_found_string (void); |
Pushes "No solution found", or its localized version if a language localization is active (on AMS 2.xx), on the EStack.
The string is pushed as an AMS string using push_zstr.
unsigned short push_offset_array (CESI elements_ptr, unsigned short **dest); |
Pushes an array of offsets to the list items.
This function is not complicated, but it is a bit hard to explain.
It first increments the pointer to the top of the expression stack to the
nearest even address, then pushes a word array which contains the offsets to all entries
on the expression stack below elements_ptr until END_TAG is
reached. The offset is expressed relative to the elements_ptr.
push_offset_array returns the size of pushed array in words (i.e. the number of elements),
and stores in the pointer variable pointed to by dest the top address of pushed
array. For example, if you execute the following sequence
unsigned int *offsets;
ESI esi;
unsigned int count;
...
esi=top_estack;
count=push_offset_array (esi, &offsets);
then
esi-offsets[0],
esi-offsets[-1],
esi-offsets[-2],
..., esi-offsets[1-count]
will point to entries on the expression stack.
esi-offsets[0] will point to the further entry from the
top of the expression stack,
esi-offsets[-1] will point
to the next one, and finally,
esi-offsets[1-count] will
point to the entry on the top of the expression stack (more precise,
offsets[1-count] is always zero). This function is useful
when you need a fast way to access to all entries on the expression stack many times.
void push_overflow_to_infinity (ESQ inf_tag); |
Displays a warning, and pushes a tag to the expression stack.
push_overflow_to_infinity displays the warning message "Warning: Overflow replaced by INF or -INF", then pushes byte inf_tag to the expression stack (it is usually INFINITY_TAG or NEGINFINITY_TAG).
short push_parse_text (const char *str); |
Parses an expression given in a string and pushes tokenized expression to the expression stack.
push_parse_text is an extremely powerful function: it parses the expression given in the
string str, and pushes the expressions (in RPN form) to the expression stack.
This function also can parse TI-Basic statements (after parsing, the tokenized form of these
statements is pushed on the expression stack too). push_parse_text returns FALSE
if the expression is a multi expression (i.e. if it contains ":" [separator], "->" [store] or
TI-Basic statements), otherwise it returns TRUE. This routine may cause expansion
of the expression stack or heap compression.
GCC4TILIB internally uses this function (together with estack_number_to_Float)
in the implementation of atof function.
For more examples of usage of this function, see NG_approxESI,
NG_rationalESI, NG_execute etc.
The "inverse" function of push_parse_text is display_statements.
If you want to perform highly advanced symbolic operations with expressions, you should know that expressions
created by push_parse_text are not always organized on a way which allows the most efficient symbolic
processing (so-called internal canonic form). For example, TIOS always converts 'x*3'
into '3*x'
and converts
'x-y'
into 'x+y*(-1)'
, although it will be printed as
'x-y'
. However, expressions
created by push_parse_text are always as-is, i.e.
'3*x'
will be just '3*x'
, not 'x*3'
. Some routines
(like numeric_factor_index for example) may be fooled if
the expression is not "sorted" correctly. Also, some routines
(like lead_term_index, lead_factor_index
etc.) may also be fooled with expressions like 'x-y'
and
'x/y'
, because operators '-'
and '/'
are usually never seen in
expressions during symbolic processing (the processing is more unique if addition and
subtraction are treated as the same operation; the same is true for '*'
and
'/'
). So, if you
planed to perform some advanced symbolic processing which is based on accessing various
part of the expression, always call push_internal_simplify
after calling push_parse_text. This function pushes on the expression stack the same expression
but converted in internal canonic form.
Note: push_parse_text will throw an error if the string contains expression with wrong
syntax, so you need to use TRY etc. to catch
eventual errors. And, the string must be built using TI-Basic conventions (for
example, you must use 0xAD ("small" minus) instead of '-'
for
unary minus, etc. See NG_tokenize for a more powerful function which
doesn't throw any errors, and which can determine the exact location and type of the error.
void push_pi_on_quantum (ESQ); |
Pushes on the EStack the quotient of PI (numerator) and of the argument (denominator), in a way depending on the mode setting.
If the mode setting is APPROX, then a tagged float is pushed on the EStack.
The sequence of bytes [reciprocal of argument] PI_TAG MUL_TAG is pushed otherwise.
This function assumes that its argument is strictly superior to 1.
See also: push_pi
void push_pi (void); |
Pushes on the EStack a tagged float PI if the mode setting is APPROX, otherwise pushes a PI_TAG.
This function assumes nothing.
See also: push_pi_on_quantum
void push_quantum_as_nonnegative_int (ESQ); |
Pushes on the EStack the argument as a tagged positive integer.
This function assumes that its argument is strictly superior to 0.
See also: push_negate_quantum_as_negint, push_reciprocal_of_quantum, push_minus_recip_of_quantum, push_quantum_pair_as_pos_frac
void push_quantum_pair_as_pos_frac (ESQ, ESQ); |
Pushes on the EStack the quotient of the first argument (numerator) and the second argument (denominator).
This function assumes:
that the numerator and the denominator are relatively prime;
that the numerator is strictly superior to 0;
that the denominator is strictly superior to 1.
See also: push_quantum_as_nonnegative_int, push_negate_quantum_as_negint, push_reciprocal_of_quantum, push_minus_recip_of_quantum
void push_quantum_pair (ESQ Tag1, ESQ Tag2); |
Pushes two bytes (tags) to the expression stack.
push_quantum_pair pushes the bytes Tag1 and Tag2 to the expression stack. Basically, it acts like:
push_quantum (Tag1); push_quantum (Tag2);
but it is a little more optimized.
See also: push_quantum
void push_quantum (ESQ Tag); |
Pushes a byte (tag) to the expression stack.
push_quantum is the basic function for manipulating the expression stack, and many other functions are based on it. It pushes a byte Tag to the expression stack. For example, you can push a complex value to the expression stack using the following construction:
push_Float (real_part); push_Float (imaginary_part); push_quantum (COMPLEX_TAG);
See push_Float, and info about top_estack
and Tags for more info about this example.
Note: This routine (as well as all other "push_..." routines) may cause heap compression, and
may throw an error if there is not enough space on the expression stack.
See also: push_quantum_pair, push_expression, push_expr_quantum
void push_reciprocal_of_quantum (ESQ q); |
Pushes on the EStack the reciprocal of the argument as a tagged positive fraction.
This function assumes that its argument is strictly superior to 1.
See also: push_minus_recip_of_quantum, push_quantum_as_nonnegative_int, push_negate_quantum_as_negint, push_quantum_pair_as_pos_frac
void push_reversed_tail (CESI ptr); |
Pushes elements of the list up to tail onto the stack in reversed order.
push_reversed_tail first pushes END_TAG to the expression stack, then pushes all expressions starting from the expression pointed to by ptr one by one (by calling next_expression_index) until END_TAG is reached. So after calling this function, the expressions up to tail will be pushed onto the stack in reversed order. See other "tail" operations like map_tail.
void push_round_Float (CESI ptr); |
Pushes an approximation of a floating point entry.
push_round_Float first finds a rational approximation of the floating point entry pointed to by ptr using push_Float_to_rat, then converts this fraction back to the floating point number and pushes it on the top of the expressions stack. The summary effect is rounding float to the precision of about 1e-5.
void push_shortint (short value); |
Pushes a short integer to the expression stack.
push_shortint pushes the short integer value value to the expression stack.
Note: push_shortint is not a TIOS entry; it is implemented "by hand" using
push_quantum. This means that either
push_shortint or push_longint should be used in a
program, but using both is usually not desirable.
See also: push_longint, push_longlongint
void push_simplify (CESI ptr); |
Simplifies the argument and pushes onto the estack.
push_simplify is like push_internal_simplify, but does not convert into internal canonic form.
void push_transpose_aux (CESI ptr, short ConjFlag); |
Pushes transposed matrix to the expression stack.
Assuming that ptr points to the tag of a matrix (which is, in fact, a list of equally sized lists), push_transpose_aux pushes the transpose of the matrix to the expression stack. If ConjFlag is TRUE, a complex conjugate transpose will be produced, and if ConjFlag is FALSE, an ordinary transpose will be produced. For complex conjugate transposition, the matrix should be in canonic internal form (see push_internal_simplify). If ptr doesn't point to a matrix, the behavior is unpredictable.
void push_ulong_to_integer (unsigned long value); |
Pushes an unsigned long integer to the expression stack.
push_ulong_to_integer pushes the long integer value value to the expression stack. It is the same as push_long_to_integer, except that the value is interpreted as an unsigned value.
See also: push_long_to_integer, push_ushort_to_integer, push_longint
void push_ushort_to_integer (unsigned short value); |
Pushes an unsigned short integer to the expression stack.
push_ushort_to_integer pushes the short integer value value to the expression stack. It is the same as push_shortint, except that the value is interpreted as an unsigned value, and that it is implemented in the operating system instead of by GCC4TI.
See also: push_long_to_integer, push_ulong_to_integer, push_shortint
void push_zstr (const char *str); |
Pushes a standard C string to the expression stack.
push_zstr pushes the string str to the expression stack. str is a standard ANSI (zero-terminated) string.
void raise_to_top (CESI ptr); |
Raises a value to the power given by the expression on the top of the EStack.
raise_to_top raises the expression pointed to by ptr to the power indicated by the expression currently at the top of the EStack, and stores the result to the top of the EStack, in place of the expression that was used as power.
ESI re_index (CESI ptr); |
Gets the index of the real part of an expression.
If ptr points to the COMPLEX_TAG
(i.e. if the expression is complex), re_index returns the pointer
to the real part of the expression. If ptr does not point to the
COMPLEX_TAG (i.e. if the expression is real),
re_index returns ptr (i.e. the pointer to the expression itself).
Note: The expression should be in internal canonic form
(see push_internal_simplify), else this function
is not reliable.
ESI reductum_index (CESI ptr); |
Gets the index of remaining terms of an expression.
If ptr points to the ADD_TAG, which is a case when it
points to an expression of form term1 + term2 + ...
(i.e. if the expression is a sum of simpler terms), reductum_index returns the pointer
to the subexpression term2 + ... (which is a reductum
subexpression of the given expression). If ptr does not point to the
ADD_TAG (i.e. if the expression is not a sum of simpler terms),
reductum_index returns a pointer to a simple zero expression, i.e. expression which
consists only of number 0 (floating point or integer,
depending of whether the approximation mode is active or not).
Note: Expressions in internal canonic form have the most main term
shallowest (see lead_term_index. So, the reductum of
'2+x+y'
converted to canonic form is 'y+2'
.
By default, similar powers of the main variable are collected in internal canonic forms.
For example, the reductum of 'x^2*y+x^2+5'
converted to canonic form is
'5'
. See push_internal_simplify
for more info about how to convert an expression into the internal canonic form.
unsigned short remaining_element_count (CESI start_ptr); |
Returns number of elements remaining.
remaining_element_count counts how many expressions are stored on the expressions
stack below the expression pointed to by ptr (including this one).
END_TAG is treated as the terminator, so eventual expressions
below END_TAG are not counted. So, if ptr points to
an element of the list, remaining_element_count returns the number of elements
in the list starting from this element up to the end of the list.
remaining_element_count works using repeated calling next_expression_index
and increasing a counter until END_TAG is reached.
ESI remaining_factors_index (CESI ptr); |
Gets the index of remaining factors of an expression.
If ptr points to the MUL_TAG, which is a case when it
points to an expression of form factor1 * factor2 * ...
(i.e. if the expression is a sum of simpler terms), remaining_factors_index returns the pointer
to the subexpression term2 * ... (i.e. to the remaining
factors of the expression). If ptr does not point to the
MUL_TAG (i.e. if the expression is not a product of simpler factors),
remaining_factors_index returns a pointer to a simple expression which
consists only of number 1.
Note: Expressions in internal canonic form have the most main factor shallowest, with less main factors
below that (see compare_expressions for more info about "main"
ordering). Also, the lead factor of an internally-simplified product is never a product.
For example, remaining factors of '(3*x^2)*y'
converted into canonic form
are '3*y'
. By default, similar powers of the main variable are collected, so
remaining factor of 'x^2*y+x^2'
after conversion into canonic form is
'y+1'
. Internally-simplified numeric denominator factors are combined with
numeric numerator factors into a fractional numeric factor. Non-numeric denominator
factors are internally simplified to be merged with numerator factors as negative powers.
See push_internal_simplify
for more info about how to convert an expression into the internal canonic form.
void replace_top_with_post_simplified (ESI prev_top); |
Replaces the expression on top of the EStack, in internal form, with the external (printing) form.
See display_statements and
top_estack for more information about the external form.
prev_top should usually be next_expression_index(top_estack)
.
See also: display_statements, top_estack, push_simplify, push_internal_simplify
void replace_top_with_reciprocal (void); |
Replaces the expression on top of the EStack by its reciprocal.
replace_top_with_reciprocal computes the reciprocal of the expression currently at the top of the EStack, and stores the result in place of the expression.
void replace_top2_with_and (ESI expr); |
Replace the two top-most expressions on the EStack by their logical AND.
The following code:
push_quantum(TRUE_TAG); ptr = top_estack; push_quantum(FALSE_TAG); replace_top2_with_and(ptr);
will leave the false expression on the EStack.
expr should usually be next_expression_index(top_estack)
.
See also: replace_top2_with_or
void replace_top2_with_difference (ESI expr); |
Replace the two top-most expressions on the EStack by their difference.
The following code:
push_quantum(VAR_A_TAG); ptr = top_estack; push_quantum(VAR_B_TAG); replace_top2_with_difference(ptr);
will leave the a - b expression on the EStack.
expr should usually be next_expression_index(top_estack)
.
See also: replace_top2_with_sum
void replace_top2_with_imre (ESI expr); |
Replace the two top-most expressions on the EStack by a complex number.
The following code:
push_quantum(VAR_A_TAG); ptr = top_estack; push_quantum(VAR_B_TAG); replace_top2_with_imre(ptr);
will leave the a + b * i expression on the EStack.
expr should usually be next_expression_index(top_estack)
.
void replace_top2_with_or (ESI expr); |
Replace the two top-most expressions on the EStack by their logical OR.
The following code:
push_quantum(TRUE_TAG); ptr = top_estack; push_quantum(FALSE_TAG); replace_top2_with_or(ptr);
will leave the true expression on the EStack.
expr should usually be next_expression_index(top_estack)
.
See also: replace_top2_with_and
void replace_top2_with_pow (ESI expr); |
Replace the two top-most expressions on the EStack by a power.
The following code:
push_quantum(VAR_A_TAG); ptr = top_estack; push_quantum(VAR_B_TAG); replace_top2_with_pow(ptr);
will leave the b ^ a expression on the EStack.
expr should usually be next_expression_index(top_estack)
.
void replace_top2_with_prod (ESI expr); |
Replace the two top-most expressions on the EStack by their product.
The following code:
push_quantum(VAR_A_TAG); ptr = top_estack; push_quantum(VAR_B_TAG); replace_top2_with_prod(ptr);
will leave the a * b expression on the EStack.
expr should usually be next_expression_index(top_estack)
.
See also: replace_top2_with_ratio
void replace_top2_with_ratio (ESI expr); |
Replace the two top-most expressions on the EStack by their ratio.
push_quantum(VAR_A_TAG); ptr = top_estack; push_quantum(VAR_B_TAG); replace_top2_with_ratio(ptr);
will leave the a / b expression on the EStack.
expr should usually be next_expression_index(top_estack)
.
See also: replace_top2_with_prod
void replace_top2_with_sum (ESI expr); |
Replace the two top-most expressions on the EStack by their sum.
The following code:
push_quantum(VAR_A_TAG); ptr = top_estack; push_quantum(VAR_B_TAG); replace_top2_with_sum(ptr);
will leave the a + b expression on the EStack.
expr should usually be next_expression_index(top_estack)
.
See also: replace_top2_with_difference
void reset_control_flags (void); |
Resets the control flags for operations with the expression stack.
reset_control_flags resets various control flags which control operations which use the expression stack. It is good idea to call this function before starting any calculation using the expression stack.
void reset_estack_size (unsigned short NewSize); |
Reallocates the expression stack.
reset_estack_size changes the size of the expression stack to NewSize. It throws an error if the requirement cannot be satisfied. If NewSize is smaller than the current amount of used space, then the expression stack is set to the current amount of used space instead of NewSize. Default size of the expression stack is 16384 bytes.
short should_and_did_push_approx_arg2 (CESI arg1_ptr, CESI arg2_ptr); |
Pushes a second floating point argument, if possible.
This function is combination of "push" and "check" operations. If the entry on the expressions stack pointed to by arg1_ptr is not a floating point number (i.e. if arg1_ptr does not point to FLOAT_TAG), this function does nothing and returns FALSE. Otherwise, it checks if it is likely that the entry on the expression stack pointed to by arg2_ptr can be approxed to a real number (using likely_approx_to_number). If it is, should_and_did_push_approx_arg2 pushes the approximated value to the expression stack and returns TRUE, otherwise it does nothing more and returns FALSE.
long signum_Float (CESI ptr); |
Finds the signum of a floating point entry.
signum_Float finds the signum of the floating point entry pointed to by ptr (i.e. returns 1 if the entry is positive, -1 if it is negative, 0 if it is zero). If the entry is not a floating point number, the result is garbage.
void subtract_from_top (CESI ptr); |
Subtracts a value from the top of the EStack.
subtract_from_top subtracts the expression pointed to by ptr from the expression currently at the top of the EStack and stores the result to the top of the EStack, in place of the expression that was substracted from.
See also: add_to_top, negate_top, subtract1_from_top
void subtract1_from_top (void); |
Subtracts 1 from the top of the EStack.
subtract1_from_top subtracts 1 (or 1.0) from the value on the top of the EStack. This routine basically calls add_to_top with "-1" as the pointed-to value.
See also: subtract_from_top, add1_to_top
void times_top (CESI ptr); |
Multiplies the expression onto the EStack.
times_top multiplies the expression currently at the top of the EStack by the expression pointed to by ptr, and stores the result to the top of the estack, in place of the expression that was multiplied.
ESI TokenizeSymName (const char *src, unsigned short Flags); |
Tokenizes a C string into a symbol name.
TokenizeSymName converts a symbol name pointed to by src,
which is an ordinary ANSI C string, into a tokenized form, and pushes the
tokenized form on the expression stack.
After pushing, the new value of top_estack
points to the variable tag on the expression stack. TokenizeSymName returns
the old value of top_estack (which you
can use to restore top_estack), or
NULL_INDEX if the symbol name was invalid.
The parameter Flags is a set of binary flags from
TokenizeSymNameFlags with the
following meaning:
TSF_FULLY_QUALIFIED | Add current default folder to the name if no folder specified in the name (do not use if tokenizing standalone folder names). |
TSF_ALLOW_RESERVED | Allow reserved names to be tokenized (otherwise they cause throwing an error). |
TSF_PASS_ERRORS | Throw errors instead of returning NULL_INDEX. |
See also: StrToTokN
ESQ ARb_int_count; |
Represents the number of times arbitrary-integer variables were already used by some calculus.
Arbitrary-integer variables (of the form "@nx") are generated by TI-Basic function calls such as solve(sin(x)=0,x)
.
This variable is set to 0 every time the calculator is reset, or if
cmd_clrhome is called.
ARb_int_count wraps back to 0 after 255.
See also: ARb_real_count, cmd_clrhome, cmd_newprob
ESQ ARb_real_count; |
Represents the number of times arbitrary variables were already used by some calculus.
Arbitrary variables (of the form "@x") are generated by TI-Basic function calls such as zeros(0,x)
.
This variable is set to 0 every time the calculator is reset, or if
cmd_clrhome is called.
ARb_real_count wraps back to 0 after 255.
See also: ARb_int_count, cmd_clrhome, cmd_newprob
CESI bottom_estack; |
Points to the bottom of the expression stack.
bottom_estack is a global variable which points to the bottom of the
expression stack, i.e. the first byte used. The quantum at bottom_estack
is always ENDSTACK_TAG. Usually, you should not
change this pointer, although it seems that it is possible to change it
temporarily. If you do this, however, you need to make sure that it is
changed back in any case, even if an error occurs.
This variable can be used together with
top_estack to determine the amount of memory
on the expression stack which is currently used.
The following example (called "Print EStack") prints the values of
bottom_estack and top_estack:
// Print bottom_estack and top_estack #define USE_TI89 // Compile for TI-89 #define USE_TI92PLUS // Compile for TI-92 Plus #define USE_V200 // Compile for V200 #define MIN_AMS 100 // Compile for AMS 1.00 or higher #define SAVE_SCREEN // Save/Restore LCD Contents #include <tigcclib.h> // Include All Header Files // Main Function void _main(void) { ClrScr (); printf_xy (0, 40, "Bottom = 0x%lp", bottom_estack); printf_xy (0, 50, "Top = 0x%lp", top_estack); ngetchx (); }
See also: top_estack, estack_max_index
const cmd_info *const command_tag_list; |
Array of structures containing information on InstructionTags.
CESI estack_max_index; |
Points to the end of the expression stack.
This is the address of the highest usable byte of the expression stack.
See also: top_estack, bottom_estack
ESI Float0Index; |
Pointer to the end tag (FLOAT_TAG) of a 14-digit tagged floating-point value 0.0.
This variable is meant to be used with functions dealing with the EStack, rather than with timath.h functions.
ESI Float1Index; |
Pointer to the end tag (FLOAT_TAG) of a 14-digit tagged floating-point value 1.0.
This variable is meant to be used with functions dealing with the EStack, rather than with timath.h functions.
ESI FloatExp1Index; |
Pointer to the end tag (FLOAT_TAG) of a 14-digit tagged floating-point value e.
This variable is meant to be used with functions dealing with the EStack, rather than with timath.h functions.
ESI FloatHalfIndex; |
Pointer to the end tag (FLOAT_TAG) of a 14-digit tagged floating-point value 0.5.
This variable is meant to be used with functions dealing with the EStack, rather than with timath.h functions.
ESI FloatMinus1Index; |
Pointer to the end tag (FLOAT_TAG) of a 14-digit tagged floating-point value -1.0.
This variable is meant to be used with functions dealing with the EStack, rather than with timath.h functions.
ESI FloatPiIndex; |
Pointer to the end tag (FLOAT_TAG) of a 14-digit tagged floating-point value pi.
This variable is meant to be used with functions dealing with the EStack, rather than with timath.h functions.
const float * const FLOATTAB; |
A pointer to an array of more or less commonly used untagged floats.
Elements of this array are:
FPI_TWOPI | 2*pi |
FPI_ONEPI | pi |
FPI_PIDIV2 | pi/2 |
FPI_PIDIV4 | pi/4 |
FPI_360 | 360.0 |
FPI_180 | 180.0 |
FPI_90 | 90.0 |
FPI_45 | 45.0 |
FPI_180DIVPI | 180/pi |
FPI_PIDIV180 | pi/180 |
FPI_0 | 0.0 |
FPI_PT001 | 0.001 |
FPI_PT1 | 0.1 |
FPI_PIDIV24 | pi/24 |
FPI_PT5 | 0.5 |
FPI_PT9 | 0.9 |
FPI_1 | 1.0 |
FPI_MINUS1 | -1.0 |
FPI_SQRT2 | sqrt(2) |
FPI_2 | 2.0 |
FPI_3 | 3.0 |
FPI_2PI12 | 2*pi (12 digits precision) |
FPI_10 | 10.0 |
FPI_MINUS10 | -10.0 |
FPI_12 | 12.0 |
FPI_14 | 14.0 |
FPI_20 | 20.0 |
FPI_70 | 70.0 |
FPI_BIGGEST | 10^1000 |
FPI_NEGBIGGEST | -10^1000 |
FPI_16000 | 16000.0 |
FPI_MINUS16000 | -16000.0 |
FPI_32767 | 32767.0 |
FPI_MINUS32768 | -32768.0 |
FPI_65535 | 65535.0 |
FPI_1E14 | 1.0e14 |
FPI_INVALID | NAN |
FPI_LOGE | log(e) |
FPI_POS0 | positive zero |
FPI_NEG0 | negative zero |
FPI_POSINF | +infinity |
FPI_NEGINF | -infinity |
FPI_UNSINF | infinity |
See also: FLOATTABIndexes
ESI index_false; |
Pointer on a FALSE_TAG
(0x2B) stored in the Flash.
This variable is meant to be used with functions dealing with the EStack.
ESI index_true; |
Pointer on a TRUE_TAG
(0x2C) stored in the Flash.
This variable is meant to be used with functions dealing with the EStack.
ESI Integer0Index; |
Pointer to the end tag (POSINT_TAG) of an integer value 0.
This variable is meant to be used with functions dealing with the EStack.
ESI Integer1Index; |
Pointer to the end tag (POSINT_TAG) of an integer value 1.
This variable is meant to be used with functions dealing with the EStack.
ESI Integer2Index; |
Pointer to the end tag (POSINT_TAG) of an integer value 2.
This variable is meant to be used with functions dealing with the EStack.
ESI IntegerMinus1Index; |
Pointer to the end tag (NEGINT_TAG) of an integer value -1.
This variable is meant to be used with functions dealing with the EStack.
const tag_info *const primary_tag_list; |
Array of structures containing information on Tags.
const tag_info *const secondary_tag_list; |
Array of structures containing information on ExtTags.
const sysvar_info *const sysvar_tag_list; |
Array of structures containing information on SysvarTags.
ESI top_estack; |
Points to the top of the expression stack.
The global variable top_estack points to the top (i.e. the last byte) of the expression stack.
Strictly speaking, in "nostub" mode it is not a real variable but smart macro, although it
works like it is a variable. The expression stack is the place in the memory where TI keeps
expressions during evaluation. All statements are tokenized before being executed
(interpreted). Instructions are reduced to (byte sized) quanta and parsed into Reverse
Polish Notation (RPN). This is a common technique in interpreted languages. Expressions,
functions, etc. are all stored in RPN form, to allow for efficient operation of the expressions
stack. See below for more details about organization of the expression stack.
The actual processing of all expressions is done via the expression stack. The position in the
stack is given by top_estack. Pushing a value appends it to the expression stack and increments
top_estack. When a expression is interpreted, expressions are reduced, and executed as far as
possible. Whatever remains on the stack is the result, this may then be stored or processed
later.
When a file is interpreted the end of the variable is found and it is processed as a separate
expression stack. It is then processed recursively, producing a simplified version on the real
expression stack. Expressions are therefore interpreted from the top (high memory) recursively.
As an artefact of expressions processing mechanism, the arguments of the called program are
kept also on the expression stack. It grows upwards, and the last argument is stored first.
After the assembly program is called, the image of the expression stack is as follows:
The first byte (i.e. the byte with the lowest address) on the stack is END_TAG (0xE5).
Then, a argument list follows, starting from the last argument up to the first argument. So, top_estack points to the last byte of the first argument.
Each string entry on the expression stack is stored as follows (from lower to higher addresses):
One zero byte (starting tag);
Content of the string;
Terminating zero byte;
Byte STR_TAG (0x2D).
Each integer entry is stored as follows:
Bytes of the number in little endian format (i.e. the lowest byte is stored first); the number of bytes varies depending of the size of the number;
A byte which represents the number of the bytes which made the number (note that zero has zero-byte length);
Byte POSINT_TAG (0x1F) or NEGINT_TAG (0x20), depending whether the number is positive or negative (for negative numbers, previous bytes contain the absolute value).
Each fraction entry is stored as follows:
Bytes of the denominator in little endian format (i.e. the lowest byte is stored first); the number of bytes varies depending of the size of the number;
A byte which represents the number of the bytes which made the denominator;
Bytes of the numerator in little endian format;
A byte which represents the number of the bytes which made the numerator;
Byte POSFRAC_TAG (0x21) or NEGFRAC_TAG (0x22), depending whether the fraction is positive or negative (for negative fractions, previous bytes contain absolute values).
Each floating point entry is stored as follows:
Only first 9 bytes of the content of the floating point value are stored (instead of 10), because TIOS always rounds floating point values up to 14 significant digits before pushing them on expression stack (see bcd structure for more information about the internal organization of floating point values);
The last byte is FLOAT_TAG (0x23).
If the entry is complex number, real part is stored first (which can be integer, float,
fraction, etc.), then imaginary part. COMPLEX_TAG (0x9D) is stored after them, so if the
current argument type is complex, decrease the argument pointer by one, then first read
imaginary part, then real part separately.
If the entry is composite (i.e. if it is a list or a matrix), the first byte is end_of_list marker
(byte END_TAG or 0xE5), then follow each element of the list in reverse order (starting
from the last element), and the last byte is LIST_TAG (0xD9).
Now, you surely have an idea how you can pick up elements from the list. Note that a matrix is
a "list of lists".
Signed zeros (POSITIVE_ZERO and
NEGATIVE_ZERO) are represented as
fractions +0/1 and -0/1.
Variable names are stored exactly like strings without terminating STR_TAG (i.e. it is a
sequence of letters bounded with two zero bytes), so "variable" tag is just a zero byte.
There is an exception: one-letter variables have unique one-byte tags (see
Tags for more info. Also, note that variable names are always
stored with lowercase letters. Variables whose names ends with an underscore are assumed
to be complex, and variables whose names starts with an underscore are assumed to
represent physical units.
Expressions are stored in RPN (Reverse Polish Notation) form (also known as postfix form).
So, function calls like func(arg1,arg2,...argn) are stored as sequence
argn ... arg2 arg1 func_tag
and terms like arg1 operator arg2 are stored as
arg1 arg2 operator_tag or
arg2 arg1 operator_tag, depending on the concrete operator.
The situation is analogous for unary operators.
Note that a "pointer to an expression" is a pointer to the last byte of the expression!
When a function (or operator) has variable number of arguments, END_TAG is used to indicate "no more arguments".
See Tags for complete list of various tags. This will be illustrated with
some examples:
Algebraic form: | integrate (e^(x^2), x, 1, 2) |
RPN form: | 2 1 x 2 x ^ e ^ integrate |
Sequence of bytes: | [02 01 1F] [01 01 1F] [08] [02 01 1F] [08] [93] [25] [93] [C4] |
Algebraic form: | sum (sqrt (1 + x), x, 0, a) (where sum is actually the capital sigma) |
RPN form: | a 0 x x 1 + sqrt sum |
Sequence of bytes: | [0B] [00 1F] [08] [08] [01 01 1F] [8B] [51] [BA] |
Algebraic form: | a + b + a - b + (a + b) * (a - b) -> a |
RPN form: | a b + a + b - a b + a b - * + a -> |
Sequence of bytes: | [0B] [0C] [8B] [0B] [8B] [0C] [8D] [0B] [0C] [8B] [0B] [0C] [8D] [8F] [8B] [0B] [80] |
Algebraic form: | {{1, 2}, {3, 4}} |
RPN form: | END_TAG END_TAG 4 3 LIST_TAG END_TAG 2 1 LIST_TAG LIST_TAG |
Sequence of bytes: | [E5] [E5] [04 01 1F] [03 01 1F] [D9] [E5] [02 01 1F] [01 01 1F] [D9] [D9] |
Algebraic form: | my_func (a, b, c) |
RPN form: | END_TAG c b a my_func USERFUNC_TAG |
Sequence of bytes: | [E5] [0D] [0C] [0B] [00 6D 79 5F 66 75 6E 63 00] [DA] |
'x*3'
and
'x+3'
becomes '3*x'
and '3+x'
(although
the second example will be printed as 'x+3'
). Also, expressions like 'x/y'
or
'x-y'
in internal canonic form do not contain subtractions and divisions.
As the parameter list (when the program is called from TI-Basic) is always in internal
canonic form, such expressions will never be observed as-is in parameter lists
etc. because they will be converted before passing them to the program. A lot of functions
for algebraic manipulations automatically convert the expression in the internal canonic form,
but when this is not true, you can always force the conversion using explicit call to
push_internal_simplify function. Note that the reverse conversion
(i.e. back from the canonic form into a regular form) is performed anytime when you try to
print out the expression. Here is the list of the most common transformations which appears
during the transformation into the internal canonic form:
Expression | Standard canonic form |
-x | (-1)*x |
x-y | x+y*(-1) |
x/y | x*y^(-1) |
e^x | exp(x) |
x^y | exp(ln(x)*y) [ except when "y" is an integer or a fraction ] |
e | exp(1) |
sqrt(x) | x^(1/2) |
log(x) | ln(x)*(ln(10)^(-1)) |
sin(x) | trig(x,0) [ assuming "radian" mode; for "trig" function, see SINCOS_TAG ] |
cos(x) | trig(x,1) |
tan(x) | trig(x,0)*trig(x,1)^(-1) |
sinh(x) | exp(x)*(1/2)+exp(x)^(-1)*(-1/2) |
cosh(x) | exp(x)*(1/2)+exp(x)^(-1)*(1/2) |
tanh(x) | (exp(x)^2+1)^(-1)*(exp(x)^2+(-1)) |
x xor y | (not x and y) or (x and not y) |
// Print bottom_estack and top_estack #define USE_TI89 // Compile for TI-89 #define USE_TI92PLUS // Compile for TI-92 Plus #define USE_V200 // Compile for V200 #define MIN_AMS 100 // Compile for AMS 1.00 or higher #define SAVE_SCREEN // Save/Restore LCD Contents #include <tigcclib.h> // Include All Header Files // Main Function void _main(void) { ClrScr (); printf_xy (0, 40, "Bottom = 0x%lp", bottom_estack); printf_xy (0, 50, "Top = 0x%lp", top_estack); ngetchx (); }
Run this program in VTI and pass to it parameters as you want. top_estack will be shown on the screen. During waiting for a keypress, enter the debugger and look at the addresses shown, to see how parameters are stored.
See also: bottom_estack, estack_max_index
#define NULL_INDEX ((CESI) 0) |
Describes an empty expression stack index.
NULL_INDEX is an expression stack index (ESI) equivalent to NULL. It can be used as a function argument in cases where the argument is optional.
typedef CALLBACK unsigned short (*CESI_Callback_t) (CESI); |
Represents a pointer to a CESI callback function.
CESI_Callback_t is a pointer to a function taking a CESI (expression stack index with constant data) as a parameter and returning an integer. It is used in all_tail and any_tail.
typedef const ESQ *CESI; |
Represents a pointer to a constant expression.
The type CESI acts like ESI, but the value pointed to by it may have to be constant. For example, it may be a SYM_STR whose contents are stored at a fixed place in the program.
typedef struct {
|
Structure containing information about AMS EStack command tags (InstructionTags).
typedef CALLBACK unsigned short (*ESI_Callback_Int_t) (ESI, unsigned short); |
Represents a pointer to an ESI callback function with integer extensions.
ESI_Callback_Int_t is a pointer to a function taking an ESI (expression stack index) and an integer as a parameter and returning an integer. It is used in map_tail_Int.
typedef CALLBACK void (*ESI_Callback_t) (ESI); |
Represents a pointer to an ESI callback function.
ESI_Callback_t is a pointer to a function taking an ESI (expression stack index) as a parameter and returning nothing. It is used in map_tail and map_unary_over_comparison.
typedef ESQ *ESI; |
Represents an index of a value on the TIOS expression stack.
The type ESI is an "expression stack index", which is, in fact,
a pointer to a tag byte on the TIOS expression stack.
See top_estack and Tags
for more info about the expression stack.
typedef unsigned char ESQ; |
Represents a quantum within an expression.
ESQ represents a quantum (the smallest meaningful unit) of an expression. It can be a tag from the Tags enum, or any other byte value.
typedef unsigned short EStackDisplacement; |
Type used for representing difference of two ESI pointers.
#define EStackIndex ESI |
Represents an index of a value on the TIOS expression stack.
EStackIndex is a synonym for ESI.
enum ExtTags {...}; |
An enumeration to describe extra types of entries on the expression stack.
If the tag of an entry on the expression stack is EXT_TAG (0xE3), then the
byte below it is the extra TI-Basic function tag. ExtTags is enumerated type for describing
such extended entries (see top_estack for more info about how entries
on the expression stack are organized). This enum is quite big, and here is a complete list of
extended function tags defined in it (all values are in hex), with their meaning (used notation
is RPN):
01 | INDIR_TAG | string_expr # (indirection) |
02 | GETKEY_TAG | [] getKey |
03 | GETFOLD_TAG | [] getFold |
04 | SWITCH_TAG | [int] switch |
05 | UNITCONV_TAG | unit1 unit2 > (unit conversion, unit1 |> unit2) |
06 | ORD_TAG | string ord |
07 | EXPR_TAG | string expr |
08 | CHAR_TAG | int char |
09 | STRING_TAG | expr string |
0A | GETTYPE_TAG | var getType |
0B | GETMODE_TAG | string getMode |
0C | SETFOLD_TAG | var setFold |
0D | PTTEST_TAG | y x ptTest |
0E | PXLTEST_TAG | column row pxlTest |
0F | SETGRAPH_TAG | string string setGraph |
10 | SETTABLE_TAG | string string setTable |
11 | SETMODE_TAG | string string setMode / list setMode |
12 | FORMAT_TAG | [string] expr format |
13 | INSTRING_TAG | [start] substring search-string inString |
14 | APPEND_TAG | string1 string2 & (append) |
15 | DD_TAG | dmsnumber >DD |
16 | EXPR2DMS_TAG | expr >DMS |
17 | VEC2RECT_TAG | vec >Rect |
18 | VEC2POLAR_TAG | vec >Polar |
19 | VEC2CYLIND_TAG | vec >Cylind |
1A | VEC2SPHERE_TAG | vec >Sphere |
1B | PARENTH_START_TAG | ( (used only internally for the parser, not in expressions) |
1C | PARENTH_END_TAG | ) (used only internally for the parser, not in expressions) |
1D | MAT_START_TAG | [ (used only internally for the parser, not in expressions) |
1E | MAT_END_TAG | ] (used only internally for the parser, not in expressions) |
1F | LIST_START_TAG | { (used only internally for the parser, not in expressions) |
20 | LIST_END_TAG | } (used only internally for the parser, not in expressions) |
21 | COMMA_TAG | , (used only internally for the parser, not in expressions) |
22 | SEMICOLON_TAG | ; (used only internally for the parser, not in expressions) |
23 | COMPLEX_ANGLE_TAG | /_ (used only internally for the parser, not in expressions) |
24 | SINGLE_QUOTE_TAG | ' (used only internally for the parser, not in expressions) |
25 | QUOTE_TAG | " (used only internally for the parser, not in expressions) |
26 | POLCPLX_TAG | magnitude angle /_ (polar complex number) |
27 | TMPCNV_TAG | expr2 expr1 tmpCnv |
28 | DELTA_TMPCNV_TAG | expr2 expr1 DtmpCnv |
29 | GETUNITS_TAG | [] getUnits |
2A | SETUNITS_TAG | list setUnits |
2B | BIN_TAG | int 0b (i.e. 0bint) |
2C | HEX_TAG | expr 0h (i.e. 0hexpr) |
2D | INT2BIN_TAG | int >Bin |
2E | INT2DEC_TAG | int >Dec |
2F | INT2HEX_TAG | int >Hex |
30 | DET_TOL_TAG | tol mat det |
31 | REF_TOL_TAG | tol mat ref |
32 | RREF_TOL_TAG | tol mat rref |
33 | SIMULT_TOL_TAG | tol vec mat simult |
34 | GETCONFG_TAG | [] getConfg |
35 | V_AUGMENT_TAG | mat2 ; mat1 augment |
36 | MEAN_TWOARG_TAG | list list mean (AMS 2.00 or higher) |
37 | PRODUCT_TWOARG_TAG | [end] start list product (AMS 2.00 or higher) |
38 | STDDEV_TWOARG_TAG | list list stdDev (AMS 2.00 or higher) |
39 | SUM_TWOARG_TAG | [end] start list sum (AMS 2.00 or higher) |
3A | VARIANCE_TWOARG_TAG | list list variance (AMS 2.00 or higher) |
3B | DELTA_LIST_TAG | list Dlist (AMS 2.00 or higher) |
46 | ISCLKON_TAG | [] isClkOn (AMS 2.07 or higher) |
47 | GETDATE_TAG | [] getDate (AMS 2.07 or higher) |
48 | GETTIME_TAG | [] getTime (AMS 2.07 or higher) |
49 | GETTMZN_TAG | [] getTmZn (AMS 2.07 or higher) |
4A | SETDATE_TAG | [] d mo y setDate (AMS 2.07 or higher) |
4B | SETTIME_TAG | [] s min h setTime (AMS 2.07 or higher) |
4C | SETTMZN_TAG | int setTmZn (AMS 2.07 or higher) |
4D | DAYOFWK_TAG | [] d mo y dayOfWk (AMS 2.07 or higher) |
4E | STARTTMR_TAG | [] startTmr (AMS 2.07 or higher) |
4F | CHECKTMR_TAG | seconds checkTmr (AMS 2.07 or higher) |
50 | TIMECNV_TAG | seconds timeCnv (AMS 2.07 or higher) |
51 | GETDTFMT_TAG | [] getDtFmt (AMS 2.07 or higher) |
52 | GETTMFMT_TAG | [] getTmFmt (AMS 2.07 or higher) |
53 | GETDTSTR_TAG | [int] getDtStr (AMS 2.07 or higher) |
54 | GETTMSTR_TAG | [int] getTmStr (AMS 2.07 or higher) |
55 | SETDTFMT_TAG | [int] setDtFmt (AMS 2.07 or higher) |
56 | SETTMFMT_TAG | [int] setTmFmt (AMS 2.07 or higher) |
57 | ROOT_TAG | nthOrder expr root (AMS 3.10 or higher) |
58 | EXPRIO_TAG | string exprIO (AMS 3.10 or higher) |
59 | IMPDIF_TAG | [order] dependentVar independentVar equation impDif (AMS 3.10 or higher) |
5A | STDEVPOP_TAG | [arg2] arg1 stDevPop (AMS 3.10 or higher) |
5B | ISVAR_TAG | var isVar (AMS 3.10 or higher) |
5C | ISLOCKED_TAG | var isLocked (AMS 3.10 or higher) |
5D | ISARCHIV_TAG | var isArchiv (AMS 3.10 or higher) |
5E | GRAD_TAG | expr G (AMS 3.10 or higher) |
5F | TO_GRAD_TAG | expr >Grad (AMS 3.10 or higher) |
60 | TO_RAD_TAG | expr >Rad (AMS 3.10 or higher) |
61 | TO_LN_TAG | expr >ln (AMS 3.10 or higher) |
62 | TO_LOGBASE_TAG | expr expr >logbase (AMS 3.10 or higher) |
enum FLOATTABIndexes {
|
An enumeration for describing the valid indexes for FLOATTAB.
See also: FLOATTAB
enum InstructionTags {...}; |
An enumeration to describe types of instructions on the expression stack.
If the tag of an entry on the expression stack is EXT_INSTR_TAG (0xE4), then the
byte below it is the tag of a TI-Basic command token. Although TI-Basic tokens are not interesting
for programming, they are defined in enumerated type InstructionTags, due to completeness. This
enum is quite big, and here is a complete list of TI-Basic instruction token tags defined in it
(all values are in hex), with their meaning (used notation is RPN):
01 | CLRDRAW_ITAG | ClrDraw |
02 | CLRGRAPH_ITAG | ClrGraph |
03 | CLRHOME_ITAG | ClrHome |
04 | CLRIO_ITAG | ClrIO |
05 | CLRTABLE_ITAG | ClrTable |
06 | CUSTOM_ITAG | Custom |
07 | CYCLE_ITAG | displacement Cycle (displacement towards the instruction ending the loop) |
08 | DIALOG_ITAG | Dialog |
09 | DISPG_ITAG | DispG |
0A | DISPTBL_ITAG | DispTbl |
0B | ELSE_ITAG | Else (in If...EndIf statement) |
0C | ENDCUSTM_ITAG | EndCustm |
0D | ENDDLOG_ITAG | EndDlog |
0E | ENDFOR_ITAG | displacement EndFor |
0F | ENDFUNC_ITAG | EndFunc |
10 | ENDIF_ITAG | EndIf |
11 | ENDLOOP_ITAG | displacement EndLoop |
12 | ENDPRGM_ITAG | EndPrgm |
13 | ENDTBAR_ITAG | EndTBar |
14 | ENDTRY_ITAG | EndTry |
15 | ENDWHILE_ITAG | displacement EndWhile |
16 | EXIT_ITAG | displacement Exit (displacement towards the end of the loop, i.e. the instruction following the loop ending instruction) |
17 | FUNC_ITAG | Func |
18 | LOOP_ITAG | Loop |
19 | PRGM_ITAG | Prgm |
1A | SHOWSTAT_ITAG | ShowStat |
1B | STOP_ITAG | Stop |
1C | THEN_ITAG | Then |
1D | TOOLBAR_ITAG | Toolbar |
1E | TRACE_ITAG | Trace |
1F | TRY_ITAG | Try |
20 | ZOOMBOX_ITAG | ZoomBox |
21 | ZOOMDATA_ITAG | ZoomData |
22 | ZOOMDEC_ITAG | ZoomDec |
23 | ZOOMFIT_ITAG | ZoomFit |
24 | ZOOMIN_ITAG | ZoomIn |
25 | ZOOMINT_ITAG | ZoomInt |
26 | ZOOMOUT_ITAG | ZoomOut |
27 | ZOOMPREV_ITAG | ZoomPrev |
28 | ZOOMRCL_ITAG | ZoomRcl |
29 | ZOOMSQR_ITAG | ZoomSqr |
2A | ZOOMSTD_ITAG | ZoomStd |
2B | ZOOMSTO_ITAG | ZoomSto |
2C | ZOOMTRIG_ITAG | ZoomTrig |
2D | DRAWFUNC_ITAG | expr DrawFunc |
2E | DRAWINV_ITAG | expr DrawInv |
2F | GOTO_ITAG | expr Goto (Expr = LABEL) |
30 | LBL_ITAG | expr Lbl (Expr = LABEL) |
31 | GET_ITAG | var Get |
32 | SEND_ITAG | list Send |
33 | GETCALC_ITAG | var GetCalc |
34 | SENDCALC_ITAG | var SendCalc |
35 | NEWFOLD_ITAG | foldername NewFold |
36 | PRINTOBJ_ITAG | var PrintObj |
37 | RCLGDB_ITAG | var RclGDB |
38 | STOGDB_ITAG | var StoGDB |
39 | ELSEIF_ITAG | condition ElseIf |
3A | IF_ITAG | condition If (simple variant) |
3B | IFTHEN_ITAG | condition If...Then (If condition Then) |
3C | RANDSEED_ITAG | expr RandSeed |
3D | WHILE_ITAG | condition While |
3E | LINETAN_ITAG | point expr LineTan |
3F | COPYVAR_ITAG | var2 var1 CopyVar |
40 | RENAME_ITAG | newname oldname Rename |
41 | STYLE_ITAG | string expr Style |
42 | FILL_ITAG | var expr Fill |
43 | REQUEST_ITAG | var string Request |
44 | POPUP_ITAG | var itemlist PopUp |
45 | PTCHG_ITAG | y x PtChg |
46 | PTOFF_ITAG | y x PtOff |
47 | PTON_ITAG | y x PtOn |
48 | PXLCHG_ITAG | column row PxlChg |
49 | PXLOFF_ITAG | column row PxlOff |
4A | PXLON_ITAG | column row PxlOn |
4B | MOVEVAR_ITAG | newfolder oldfolder var MoveVar |
4C | DROPDOWN_ITAG | var list title_string DropDown |
4D | OUTPUT_ITAG | expr column row Output |
4E | PTTEXT_ITAG | y x string PtText |
4F | PXLTEXT_ITAG | column row string PxlText |
50 | DRAWSLP_ITAG | slope y x DrawSlp |
51 | PAUSE_ITAG | [expr] Pause |
52 | RETURN_ITAG | [expr] Return |
53 | INPUT_ITAG | [var [string]] Input |
54 | PLOTSOFF_ITAG | [9] ... [2] [1] PlotsOff |
55 | PLOTSON_ITAG | [9] ... [2] [1] PlotsOn |
56 | TITLE_ITAG | [label] string Title |
57 | ITEM_ITAG | [label] string Item |
58 | INPUTSTR_ITAG | var [string] InputStr |
59 | LINEHORZ_ITAG | [drawmode] y LineHorz |
5A | LINEVERT_ITAG | [drawmode] x LineVert |
5B | PXLHORZ_ITAG | [drawmode] row PxlHorz |
5C | PXLVERT_ITAG | [drawmode] column PxlVert |
5D | ANDPIC_ITAG | [pxlcol pxlrow] picvar AndPic |
5E | RCLPIC_ITAG | [pxlcol pxlrow] picvar RclPic |
5F | RPLCPIC_ITAG | [pxlcol pxlrow] picvar RplcPic |
60 | XORPIC_ITAG | [pxlcol pxlrow] picvar XorPic |
61 | DRAWPOL_ITAG | [qstep] [qmax] [qmin] DrawPol |
62 | TEXT_ITAG | [] string Text |
63 | ONEVAR_ITAG | [L4] [L3] [L2] [L1] OneVar |
64 | STOPIC_ITAG | [height width] [pxlcol pxlrow] var StoPic |
65 | GRAPH_ITAG | [var2] [var1] [expr2] expr1 Graph |
66 | TABLE_ITAG | [var] [expr2] expr1 Table |
67 | NEWPIC_ITAG | [maxcol] [maxrow] picvar mat NewPic |
68 | DRAWPARM_ITAG | [tstep] [tmax] [tmin] expr2 expr1 DrawParm |
69 | CYCLEPIC_ITAG | [direction] [cycle] [wait] N picname_string CyclePic |
6A | CUBICREG_ITAG | [[L5 L4] [L3]] L2 L1 CubicReg |
6B | EXPREG_ITAG | [[L5 L4] [L3]] L2 L1 ExpReg |
6C | LINREG_ITAG | [[L5 L4] [L3]] L2 L1 LinReg |
6D | LNREG_ITAG | [[L5 L4] [L3]] L2 L1 LnReg |
6E | MEDMED_ITAG | [[L5 L4] [L3]] L2 L1 MedMed |
6F | POWERREG_ITAG | [[L5 L4] [L3]] L2 L1 PowerReg |
70 | QUADREG_ITAG | [[L5 L4] [L3]] L2 L1 QuadReg |
71 | QUARTREG_ITAG | [[L5 L4] [L3]] L2 L1 QuartReg |
72 | TWOVAR_ITAG | [[L5 L4] [L3]] L2 L1 TwoVar |
73 | SHADE_ITAG | [patres] [pat] [xhigh] [xlow] expr2 expr1 Shade |
74 | FOR_ITAG | [step] high low var For |
75 | CIRCLE_ITAG | [drawmode] r y x Circle |
76 | PXLCRCL_ITAG | [drawmode] r col row PxlCrcl |
77 | NEWPLOT_ITAG | [bucket] [mark] [inc] [cat] [frq] [ylist] xlist type N NewPlot |
78 | LINE_ITAG | [drawmode] yend xend ystart xstart Line |
79 | PXLLINE_ITAG | [drawmode] colend rowend colstart rowstart PxlLine |
7A | DISP_ITAG | [[...] expr1] Disp |
7B | FNOFF_ITAG | [99] ... [2] [1] FnOff |
7C | FNON_ITAG | [99] ... [2] [1] FnOn |
7D | LOCAL_ITAG | [...] var1 Local |
7E | DELFOLD_ITAG | [...] var1 DelFold |
7F | DELVAR_ITAG | [...] var1 DelVar |
80 | LOCK_ITAG | [...] var1 Lock |
81 | PROMPT_ITAG | [...] var1 Prompt |
82 | SORTA_ITAG | [...] list1 SortA |
83 | SORTD_ITAG | [...] list1 SortD |
84 | UNLOCK_ITAG | [...] var1 UnLock |
85 | NEWDATA_ITAG | [...] list1 datavar NewData |
86 | DEFINE_ITAG | expr var|userfunc Define |
87 | ELSE_TRY_ITAG | Else (in Try...EndTry statement) |
88 | CLRERR_ITAG | ClrErr |
89 | PASSERR_ITAG | PassErr |
8A | DISPHOME_ITAG | DispHome |
8B | EXEC_ITAG | [[...] expr] string Exec |
8C | ARCHIVE_ITAG | [...] var1 Archive |
8D | UNARCHIV_ITAG | [...] var1 Unarchiv |
8E | LU_ITAG | [tol] pvar uvar lvar mat LU |
8F | QR_ITAG | [tol] rvar qvar mat QR |
90 | BLDDATA_ITAG | var|sysdata BldData |
91 | DRWCTOUR_ITAG | expr DrwCtour |
92 | NEWPROB_ITAG | NewProb |
93 | SINREG_ITAG | [[L4 L3] [period] [iter]] L2 L1 SinReg |
94 | LOGISTIC_ITAG | [[L4 L3] [period] [iter]] L2 L1 Logistic |
95 | CUSTMON_ITAG | CustmOn |
96 | CUSTMOFF_ITAG | CustmOff |
97 | SENDCHAT_ITAG | var SendChat |
99 | REQUEST_THREEARG_ITAG | [] alphalock var string Request (AMS 2.07 or higher) |
9A | CLOCKON_ITAG | ClockOn (AMS 2.07 or higher) |
9B | CLOCKOFF_ITAG | ClockOff (AMS 2.07 or higher) |
9C | SENDCALC_TWOARG_ITAG | port var SendCalc (AMS 3.00 or higher) |
9D | GETCALC_TWOARG_ITAG | port var GetCalc (AMS 3.00 or higher) |
9E | DELTYPE_ITAG | varTypeStr DelType (AMS 3.10 or higher) |
9F | DATA2MAT_ITAG | [col2] [row2] [col1] [row1] matVar dataVar Data>Mat (AMS 3.10 or higher) |
A0 | MAT2DATA_ITAG | [col2] [row2] [col1] [row1] dataVar matVar Mat>Data (AMS 3.10 or higher) |
typedef struct {
|
Describes a multi-expression, which is processed as a separate expression stack.
MULTI_EXPR is a structure describing a multi-expression. It can be applied to the
contents of every VAT symbol, because all symbols contain size bytes at the
beginning. It can also be used to describe a multi-expression passed to
Parse2DMultiExpr, or used by the FIFO
elements in homescr.h.
The Size field contains the size of the data in Expr, in bytes
(but note that ESQ is one byte large). For real
multi-expressions, Expr should start with
ENDSTACK_TAG, followed by the actual expressions.
These expressions are processed from the end to the beginning, as usual
(using the Size field to find the end). So the last quantum needs to
be a tag from the Tags enum.
Multiple expressions are separated with
NEXTEXPR_TAG, or with
NEWLINE_TAG (only in TI-Basic programs and
functions).
If you have a handle to a MULTI_EXPR structure, you can use the
HToESI function to get a pointer to the last
quantum (i.e. the tag).
See also: top_estack, HToESI, Parse2DMultiExpr, homescr.h
#define Quantum ESQ |
Represents a quantum within an expression.
Quantum is a synonym for ESQ.
typedef CESI SYM_STR; |
Represents a pointer to the terminating zero byte of a string.
The type SYM_STR is in fact the same as CESI. It represents a string created with the SYMSTR macro. This type of string is usually used in expressions on the expression stack, or in functions from vat.h or bascmd.h.
typedef struct {
|
Structure containing information about AMS EStack tags (SysvarTags).
enum SysvarTags {...}; |
An enumeration to describe types of system variable entries on the expression stack.
If the tag of an entry on the expression stack is EXT_SYSTEM_TAG (0x1C), then the
byte below it is the tag of a TI-Basic system variable. SysvarTags is enumerated type for describing
such extended entries (see top_estack for more info about how entries
on the expression stack are organized). This enum is quite big, and here is a complete list of
system variables tags defined in it (all values are in hex), with their meaning:
typedef struct {
|
Structure containing information about AMS EStack tags (Tags, ExtTags).
enum Tags {...}; |
An enumeration to describe types of entries on the expression stack.
This enum is very large, as there are a lot of various entries.
See top_estack for more info about how entries on the
expression stack are organized.
Here is a complete list of tags with their values in hexadecimal notation, along with their meaning written in RPN:
00 | VAR_NAME_TAG | variable name (with more than one letter): '\0' var_name '\0' |
01 | _VAR_Q_TAG | variable q (but not used - 1B is used normally) |
02 | VAR_R_TAG | variable r |
03 | VAR_S_TAG | variable s |
04 | VAR_T_TAG | variable t |
05 | VAR_U_TAG | variable u |
06 | VAR_V_TAG | variable v |
07 | VAR_W_TAG | variable w |
08 | VAR_X_TAG | variable x |
09 | VAR_Y_TAG | variable y |
0A | VAR_Z_TAG | variable z |
0B | VAR_A_TAG | variable a |
0C | VAR_B_TAG | variable b |
0D | VAR_C_TAG | variable c |
0E | VAR_D_TAG | variable d |
0F | VAR_E_TAG | variable e |
10 | VAR_F_TAG | variable f |
11 | VAR_G_TAG | variable g |
12 | VAR_H_TAG | variable h |
13 | VAR_I_TAG | variable i |
14 | VAR_J_TAG | variable j |
15 | VAR_K_TAG | variable k |
16 | VAR_L_TAG | variable l |
17 | VAR_M_TAG | variable m |
18 | VAR_N_TAG | variable n |
19 | VAR_O_TAG | variable o |
1A | VAR_P_TAG | variable p |
1B | VAR_Q_TAG | variable q |
1C | EXT_SYSTEM_TAG | system token (a byte before the tag identifies a system variable, see SysvarTags) |
1D | ARB_REAL_TAG | arbitrary real number @xxx (byte before the tag determines xxx) |
1E | ARB_INT_TAG | arbitrary integer number @nxxx (byte before the tag determines xxx) |
1F | POSINT_TAG | positive integer tag |
20 | NEGINT_TAG | negative integer tag |
21 | POSFRAC_TAG | positive fraction tag |
22 | NEGFRAC_TAG | negative fraction tag |
23 | FLOAT_TAG | floating point tag |
23 | BCD_TAG | floating point tag (alias tag name) |
24 | PI_TAG | constant p |
25 | EXP_TAG | constant e |
26 | IM_TAG | constant i |
27 | NEGINFINITY_TAG | -¥ |
28 | INFINITY_TAG | ¥ |
29 | PN_INFINITY_TAG | +/- ¥ |
2A | UNDEF_TAG | undef |
2B | FALSE_TAG | false |
2C | TRUE_TAG | true |
2D | STR_TAG | string tag: '\0' string '\0' STR_TAG |
2E | NOTHING_TAG | allows missing terms in expressions |
2F | ACOSH_TAG | expr acosh |
30 | ASINH_TAG | expr asinh |
31 | ATANH_TAG | expr atanh |
32 | ASECH_TAG | expr asech (AMS 2.08 or higher) |
33 | ACSCH_TAG | expr acsch (AMS 2.08 or higher) |
34 | ACOTH_TAG | expr acoth (AMS 2.08 or higher) |
35 | COSH_TAG | expr cosh |
36 | SINH_TAG | expr sinh |
37 | TANH_TAG | expr tanh |
38 | SECH_TAG | expr sech (AMS 2.08 or higher) |
39 | CSCH_TAG | expr csch (AMS 2.08 or higher) |
3A | COTH_TAG | expr coth (AMS 2.08 or higher) |
3B | ACOS_TAG | expr acos |
3C | ASIN_TAG | expr asin |
3D | ATAN_TAG | expr atan |
3E | ASEC_TAG | expr asec (AMS 2.08 or higher) |
3F | ACSC_TAG | expr acsc (AMS 2.08 or higher) |
40 | ACOT_TAG | expr acot (AMS 2.08 or higher) |
41 | RACOS_TAG | expr arcos (used only internally) |
42 | RASIN_TAG | expr arsin (used only internally) |
43 | RATAN_TAG | expr artan (used only internally) |
44 | COS_TAG | expr cos |
45 | SIN_TAG | expr sin |
46 | TAN_TAG | expr tan |
47 | SEC_TAG | expr sec (AMS 2.08 or higher) |
48 | CSC_TAG | expr csc (AMS 2.08 or higher) |
49 | COT_TAG | expr cot (AMS 2.08 or higher) |
4A | ITAN_TAG | expr tan (used only internally) |
4B | ABS_TAG | expr abs |
4C | ANGLE_TAG | expr angle |
4D | CEILING_TAG | expr ceiling |
4E | FLOOR_TAG | expr floor |
4F | INT_TAG | expr int |
50 | SIGN_TAG | expr sign |
51 | SQRT_TAG | expr Ö |
52 | EXPF_TAG | expr e^ |
53 | LN_TAG | expr ln |
54 | LOG_TAG | expr log |
55 | FPART_TAG | expr fPart |
56 | IPART_TAG | expr iPart |
57 | CONJ_TAG | expr conj |
58 | IMAG_TAG | expr imag |
59 | REAL_TAG | expr real |
5A | APPROX_TAG | expr approx |
5B | TEXPAND_TAG | expr tExpand |
5C | TCOLLECT_TAG | expr tCollect |
5D | GETDENOM_TAG | expr getDenom |
5E | GETNUM_TAG | expr getNum |
5F | ERROR_TAG | expr _ERROR_ (used only internally) |
60 | CUMSUM_TAG | list cumSum |
61 | DET_TAG | mat det |
62 | COLNORM_TAG | mat colNorm |
63 | ROWNORM_TAG | mat rowNorm |
64 | NORM_TAG | mat norm |
65 | MEAN_TAG | list mean |
66 | MEDIAN_TAG | list median |
67 | PRODUCT_TAG | list product |
68 | STDDEV_TAG | list stdDev |
69 | SUM_TAG | list sum |
6A | VARIANCE_TAG | list variance |
6B | UNITV_TAG | vec unitV |
6C | DIM_TAG | mat dim |
6D | MAT2LIST_TAG | mat mat>list |
6E | NEWLIST_TAG | no_of_elements newList |
6F | RREF_TAG | mat rref |
70 | REF_TAG | mat ref |
71 | IDENTITY_TAG | integer identity |
72 | DIAG_TAG | mat diag |
73 | COLDIM_TAG | mat colDim |
74 | ROWDIM_TAG | mat rowDim |
75 | TRANSPOSE_TAG | mat T |
76 | FACTORIAL_TAG | expr ! |
77 | PERCENT_TAG | expr % |
78 | RADIANS_TAG | expr r |
79 | NOT_TAG | expr not |
7A | MINUS_TAG | expr _negative_ |
7B | VEC_POLAR_TAG | mat _polar_vector_ (mat is assumed to be [[r,q]]) |
7C | VEC_CYLIND_TAG | mat _cylind_vector_ (mat is assumed to be [[r,q,z]]) |
7D | VEC_SPHERE_TAG | mat _sphere_vector_ (mat is assumed to be [[r,q,F]]) |
7E | START_TAG | ( (used only internally, don't use it) |
7F | ISTORE_TAG | expr var -> (internal version: don't use) |
80 | STORE_TAG | expr var -> |
81 | WITH_TAG | condition expr | |
82 | XOR_TAG | expr2 expr1 xor |
83 | OR_TAG | expr2 expr1 or |
84 | AND_TAG | expr2 expr1 and |
85 | LT_TAG | expr2 expr1 < |
86 | LE_TAG | expr2 expr1 <= |
87 | EQ_TAG | expr2 expr1 = |
88 | GE_TAG | expr2 expr1 >= |
89 | GT_TAG | expr2 expr1 > |
8A | NE_TAG | expr2 expr1 /= |
8B | ADD_TAG | expr1 expr2 + |
8C | ADDELT_TAG | expr1 expr2 .+ |
8D | SUB_TAG | expr1 expr2 - |
8E | SUBELT_TAG | expr1 expr2 .- |
8F | MUL_TAG | expr1 expr2 * |
90 | MULELT_TAG | expr1 expr2 .* |
91 | DIV_TAG | expr1 expr2 / |
92 | DIVELT_TAG | expr1 expr2 ./ |
93 | POW_TAG | expr2 expr1 ^ |
94 | POWELT_TAG | expr2 expr1 .^ |
95 | SINCOS_TAG | int expr trig (where trig(expr,int)=cos(expr+(int-1)*pi/2)) |
96 | SOLVE_TAG | var equation solve |
97 | CSOLVE_TAG | var equation cSolve |
98 | NSOLVE_TAG | var equation nSolve |
99 | ZEROS_TAG | var expr_in_var zeros |
9A | CZEROS_TAG | var expr_in_var cZeros |
9B | FMIN_TAG | var expr_in_var fMin |
9C | FMAX_TAG | var expr_in_var fMax |
9D | COMPLEX_TAG | complex number |
9E | POLYEVAL_TAG | expr list polyEval |
9F | RANDPOLY_TAG | order var randPoly |
A0 | CROSSP_TAG | vec2 vec1 crossP |
A1 | DOTP_TAG | vec2 vec1 dotP |
A2 | GCD_TAG | expr2 expr1 gcd |
A3 | LCM_TAG | expr2 expr1 lcm |
A4 | MOD_TAG | expr2 expr1 mod |
A5 | INTDIV_TAG | expr2 expr1 intDiv |
A6 | REMAIN_TAG | expr2 expr1 remain |
A7 | NCR_TAG | expr2 expr1 nCr |
A8 | NPR_TAG | expr2 expr1 nPr |
A9 | P2RX_TAG | q_expr r_expr P>Rx |
AA | P2RY_TAG | q_expr r_expr P>Ry |
AB | P2PTHETA_TAG | y_expr x_expr R>Pq |
AC | P2PR_TAG | y_expr x_expr R>Pr |
AD | AUGMENT_TAG | mat2 mat1 augment |
AE | NEWMAT_TAG | num_columns num_rows newMat |
AF | RANDMAT_TAG | num_columns num_rows randMat |
B0 | SIMULT_TAG | vec mat simult |
B1 | PART_TAG | [#] expr part |
B2 | EXP2LIST_TAG | var list exp>list |
B3 | RANDNORM_TAG | sd mean randNorm |
B4 | MROW_TAG | [] index mat expr mRow |
B5 | ROWADD_TAG | [] index2 index1 mat rowAdd |
B6 | ROWSWAP_TAG | [] index2 index1 mat rowSwap |
B7 | ARCLEN_TAG | [] end start var expr arcLen |
B8 | NINT_TAG | [] up low var expr nInt |
B9 | PI_PRODUCT_TAG | [] high low var expr Õ |
BA | SIGMA_SUM_TAG | [] high low var expr å |
BB | MROWADD_TAG | [] index2 index1 mat expr mRowAdd |
BC | ANS_TAG | [int] ans |
BD | ENTRY_TAG | [int] entry |
BE | EXACT_TAG | [tol] expr exact |
BF | LOGB_TAG | expr2 expr1 logb (where logb(expr1,expr2)=ln(expr1)/ln(expr2)) |
C0 | COMDENOM_TAG | [var] expr comDenom |
C1 | EXPAND_TAG | [var] expr expand |
C2 | FACTOR_TAG | [var] expr factor |
C3 | CFACTOR_TAG | [var] expr cFactor |
C4 | INTEGRATE_TAG | [up low] var expr ò |
C5 | DIFFERENTIATE_TAG | [order] var expr ¶ |
C6 | AVGRC_TAG | [h] var expr avgRC |
C7 | NDERIV_TAG | [h] var expr nDeriv |
C8 | TAYLOR_TAG | [point] order var expr taylor |
C9 | LIMIT_TAG | [direction] point var expr limit |
CA | PROPFRAC_TAG | [var] expr propFrac |
CB | WHEN_TAG | [[undef_val] false_val] true_val condition when |
CC | ROUND_TAG | [digits] expr round |
CD | DMS_TAG | [[ss] mm] dd _DMSNUMBER_ |
CE | LEFT_TAG | [num] string left |
CF | RIGHT_TAG | [num] string right |
D0 | MID_TAG | [count] start string mid |
D1 | SHIFT_TAG | [int] list shift |
D2 | SEQ_TAG | [step] high low var expr seq |
D3 | LIST2MAT_TAG | [elements_per_row] list list->mat |
D4 | SUBMAT_TAG | [[[[col2] row2] col1] row1] mat subMat |
D5 | SUBSCRIPT_TAG | [col] row var _subscript_ (i.e. var[row] or var[row,col]) |
D6 | RAND_TAG | [int] rand |
D7 | MIN_TAG | [expr2] list|expr1 min |
D8 | MAX_TAG | [expr2] list|expr1 max |
D9 | LIST_TAG | list tag, or matrix represented as "list of list" |
DA | USERFUNC_TAG | user defined function/program call: [[...] arg1] '\0' fnc_name '\0' USERFUNC_TAG |
DB | MATRIX_TAG | matrix tag (only in data editor) |
DC | FUNC_TAG | program/function tag (not used in expressions) |
DD | DATA_TAG | data tag (not used in expressions) |
DE | GDB_TAG | GDB tag (not used in expressions) |
DF | PIC_TAG | picture tag (not used in expressions) |
E0 | TEXT_TAG | text tag (not used in expressions) |
E1 | FIG_TAG | figure tag (not used in expressions) |
E2 | MAC_TAG | macro tag (not used in expressions) |
E3 | EXT_TAG | extra TI-Basic function token (see ExtTags) |
E4 | EXT_INSTR_TAG | TI-Basic command token (not used in expressions, see InstructionTags) |
E5 | END_TAG | end of the expression or the list |
E6 | COMMENT_TAG | comment (not used in expressions): '\0' string '\0' indentation COMMENT_TAG, where indentation is a single byte indicating the number of spaces between © and the first comment character |
E7 | NEXTEXPR_TAG | ":" between tokens on same line in the program (not used in expressions): indentation NEXTEXPR_TAG, where indentation is a single byte indicating the number of spaces between : and the first character of the next logical line |
E8 | NEWLINE_TAG | marks end of line in TI-Basic (not used in expressions): indentation NEWLINE_TAG, where indentation is a single byte indicating the number of spaces in front of the first character of the next line |
E9 | ENDSTACK_TAG | end of TI-Basic program (not used in expressions), or end of the expression stack |
EA | PN1_TAG | expr +/- |
EB | PN2_TAG | expr1 expr2 +/- |
EC | ERROR_MSG_TAG | name error_message |
ED | EIGVC_TAG | mat eigVc |
EE | EIGVL_TAG | mat eigVl |
EF | DASH_TAG | expr ' (prime, i.e. expr') |
F0 | LOCALVAR_TAG | var _local_ (parameter/local variable reference) |
F1 | DESOLVE_TAG | [] depend_var indep_var equation deSolve |
F2 | FDASH_TAG | func_params func_name ' (prime, i.e. func_name'(func_params) |
F3 | ASM_TAG | ASM program tag (not used in expressions) |
F4 | ISPRIME_TAG | int isPrime |
F8 | OTH_TAG | Other file tag, for custom file types (not used in expressions) |
F9 | ROTATE_TAG | [count] list|int|string rotate |
enum TokenizeSymNameFlags {TSF_FULLY_QUALIFIED = 0x01, TSF_ALLOW_RESERVED = 0x02, TSF_PASS_ERRORS = 0x04}; |
Contains flags specifying how a symbol name is tokenized.
TokenizeSymNameFlags is an enumeration containing flags used by TokenizeSymName.