BOOTSTRAP (kexpr) library


LIBRARY NAME

kexpr - (no short description specified)

DESCRIPTION

The kexpr library (libkexpr.a) provides the routines that make up Expression services. It provides a symbolic mathematical expression parser implemented using Lex and YACC. It contains routines to set variables, to parse mathematical expressions utilizing variables that have been previously set, and to evaluate these expressions. The expression parser supports a full variety of data types, including byte, unsigned byte, short, unsigned short, integer, unsigned integer, long, unsigned long, float, double, complex, double complex, and string.

The expression parser is used by cantata visual language to handle the functions used with control loops, and by the xprism plotting package to evaluate user-defined functions. It is also by the image object to allow the user to display functions of map columns as red, green, and blue.

Any application that implements interactive mathematical computation would find the functions provided by math services invaluable. In such an application, the user might want to define a variable i with some integer value, a variable j with another integer value, and then ask for the value of i*2+j. Math services is designed specifically to solve equations like this. Variables may be defined, set, and reset; expressions using those variables may be evaluated; a list of the current variables and their values may be obtained.

The expression parser can evaluate a variety of the mathematical functions provided by math services; thus, mathematical functions such as cos, sin, and tan can all be evaluated by the expression parser. Note that the expression parser is only capable of supporting those functions available in math services that (1) take double precision arguments, and (2) return a double precision result.

The expression parser defines the scope of variables with an identification number, or id. This id is of type long, and must be passed to all expression services routines. It can defined by the calling routine to be any number that is deemed suitable. The value of the id itself is not important; the key issue is that it be used consistently. The id number, when used properly by the calling routine, defines the domain of variables set and used. For instance, if all variables set by the user are to be considered global, the application program would use the same id for all calls to expression services. However, if a set of variable definitions and expression evaluations were to be local to a particular module, a different id must be used for calls to the exprssion parser in that module. For instance, the same variables with different values might be employed by the user in three different areas of an application, provided that the application used a different identification number in each of the three areas.

LIST OF LIBRARY FUNCTIONS

kexpr_substitute_exprs
*
kexpr_eval
evaluate an expression
kexpr_evaluate_generic
evaluate an expression and return result using the desired data type
kexpr_free_function
frees up a previous compiled function
kexpr_parent_set
set the parent variable list associated with an id
kexpr_parent_unset
unset the parent variable list associated with an id
kexpr_variables_list
list variables associated with an id
kexpr_variables_def
list variable definitions associated with an id
kexpr_variables_reset
reset variable values to original definitions
kexpr_variables_print
prints variables associated with an id
kexpr_variables_copy
copies variables from one id to another
kexpr_variables_clear
deletes variables associated with an id
kexpr_variable_delete
delete a variable associated with an id
kexpr_variable_add
add a variable associated with an id
kexpr_delete_result
delete a KexprResult struct
kexpr_set_define_mode
turn define mode on or off.
kexpr_evaluate_byte
evaluate char/byte expression
kexpr_evaluate_ubyte
evaluate unsigned byte/char expression
kexpr_evaluate_short
evaluate short expression
kexpr_evaluate_ushort
evaluate unsigned short expression
kexpr_evaluate_int
evaluate integer expression
kexpr_evaluate_uint
evaluate unsigned integer expression
kexpr_evaluate_long
evaluate long expression
kexpr_evaluate_ulong
evaluate unsigned long expression
kexpr_evaluate_float
evaluate float expression
kexpr_evaluate_complex
evaluate complex expression
kexpr_evaluate_double
evaluate double expression
kexpr_evaluate_dcomplex
evaluate double complex expression
kexpr_evaluate_string
evaluate string expression

ADDITIONAL INFORMATION

LOCATION OF SOURCE FILES

$BOOTSTRAP/objects/library/kexpr/src

LOCATION OF PUBLIC INCLUDE FILE

$BOOTSTRAP/include/kexpr/kexpr.h

YOU MUST INCLUDE

#include <bootstrap.h>

SEE ALSO

SEE MANUAL

The kexpr library is documented in Chapter 4, "Expression Services" in the Programming Services Manual, Volume I.

COPYRIGHT

Copyright (C) 1993 - 1997, Khoral Research, Inc. ("KRI") All rights reserved.