BOOTSTRAP (kexpr) functions
LIBRARY ROUTINE
kexpr_evaluate_complex - evaluate complex expression
LIBRARY CALL
int kexpr_evaluate_complex(
long id,
char *string,
kcomplex *value,
char *error)
INPUT
- id - the variable identifier.
- string - the string to be evaluated.
OUTPUT
- value - if no error occurred then the complex
value of the expression is stored and
TRUE returned.
- error - if an error occurred the error message is stored in
the error string array and False returned. The
error string array must be at least a 1024 string
array that is allocated by the calling routine. If
the error string array has not been allocated by the
calling routine (error is passed in as NULL) then the
error message is output with the kerror facility.
RETURN VALUE
TRUE (1) on success, FALSE (0) otherwise
DESCRIPTION
This routine performs two functions: it sets complex
variables and evaluates complex expressions.
It will return TRUE (1) on success, FALSE (0) on failure.
If the routine fails for some reason, an error message will
be passed back in the error string. If the error string
is NULL then the error is output using the kerror facility.
The string passed in will indicate which function
(variable or expression)
kexpr_evaluate_complex() is to perform, and the complex value
returned will reflect this. Let us illustrate with
an example. Suppose a string of "x = (0,1)" is passed
to kexpr_evaluate_complex(). This indicates that the variable
x is to be defined and assigned the complex value of (0i,1j)
the value returned will be in kcomplex structure as floating
point pairs of real = 0.0, and imaginary = 1.0. Then,
kexpr_evaluate_complex() is called again with a string of
"y = (0,9)"; now the value returned is (0i,9j). Finally,
suppose kexpr_evaluate_complex() is with the with a string of
"(x+y)/2". Now, kexpr_evaluate_complex() will evaluate the
expression, using the values of x and y defined by the
previous call: [(0.1 + 0.9) / 2]. The value returned in
this case would be (0.5i,0.0j).
ADDITIONAL INFORMATION
none
EXAMPLES
none
SIDE EFFECTS
none
RESTRICTIONS
none
MODIFICATION
none
FILES
$BOOTSTRAP/include/kexpr/kevaluate.h
SEE ALSO
kexpr(3)
COPYRIGHT
Copyright (C) 1993 - 1997, Khoral Research, Inc. ("KRI") All rights reserved.