push_offset_array Function (ROM Call 0x3C4)

AMS 1.01 or higher estack.h

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.


Uses: check_estack_size, next_expression_index, top_estack, estack_max_index
Used by: map_tail, map_tail_Int, did_push_anti_deriv, did_push_series, push_1st_derivative, push_comdenom, push_csolve, push_czeros, push_def_int, push_denominator, push_desolve, push_dotproduct, push_expand, push_extended_prod, push_factor, push_floor, push_im, push_lim, push_max, push_min, push_nint, push_nsolve, push_numerator, push_phase, push_re, push_round, push_sin2, push_solve, push_summation, push_zeros, did_push_to_polar, push_and, push_equals, push_exponentiate, push_greater_than, push_greater_than_or_equals, push_less_than, push_less_than_or_equals, push_list_plus, push_list_times, push_negate, push_not_equals, push_or, push_product, push_substitute_no_simplify, push_sum, push_to_cylin, push_to_sphere, add_to_top, are_units_consistent, did_map_aggregate_arg, get_ub, index_if_pushed_qquad_info, push_auto_units_conversion, push_but_factor, push_but_term, push_constant_factors, push_constant_terms, push_dependent_factors, push_dependent_terms, push_gcd_then_cofactors, push_independent_factors, push_independent_terms, push_make_proper, push_mrow_aux, push_nonconstant_factors, push_nonconstant_terms, push_nonnumeric_factors, push_poly_qr, push_reciprocal, push_standardize, push_zero_partial_column, raise_to_top, replace_top_with_post_simplified, replace_top2_with_pow, replace_top2_with_sum, ROM Call 0x484