What's
New in version 2.96?
See Also: Upgrading Issues, uCalc
Language Builder
New or enhanced in version 2.96
- Better
documentation. The help file includes
examples for the various supported compilers, and more comprehensive
explanations. The source code in
the demo is interspersed with comments.
The Spreadsheet and Equation Solver examples are included in the
main zip file, instead of as separate downloads.
- Much
simpler method for native callbacks.
- Local variable construct (this is used in the
Equation Solver, and Summation examples).
- End-users
can also use ucDefine.
- Speed. Version 2.96 is faster than any
previous version. In some cases
the difference is dramatic.
- The
^ operator, and the Log and Sqr functions are faster.
- ucParam, ucParamStr, ucParamCount, ucReturn
and ucReturnStr were optimized for use with
native callbacks. Pointers are no
longer necessary for achieving a faster speed than non-native callbacks.
- Operations
involving an automatic conversion between Long and Double are much
faster.
- PowerBASIC
users in particular will notice that ucEvaluate() runs faster for them.
- ^,
Log, and Sqr were improved. If the
left operand of ^ is a negative number, and the right operand is a non-integer,
or the argument of Log or Sqr is negative, then it raises an exception (or
returns NaN), instead of returning an incorrect value. Also, an infix operator, such as ^, no
longer causes a problem if followed by a unary operator (for instance 3 ^
- 2).
- The
last argument of IIF is optional.
- Version
2.96 is better at catching errors and exceptions overall.
- ucTrigMode, which was present in 2.0 was
restored. It allows you to choose
between radian, grad, or degree mode for trigonometric routines.
- ucExprThread is a new function that lets your
callback know what thread the current callback is being called from.
- ucRaiseError lets your callback raise an error
(based on the given error number constant).
- ucRaiseErrorMessage
allows your callback to raise an error with a customized error message.
- ucReRaise lets your error handler
re-raise an exception, allowing your host program to catch it with try
/ except (or the equivalent error handler for your compiler).
- ucErrLocation returns the
location of an error in an expression.
- ucErrSymbol (formerly
ucGetSymbol) returns the name of the offending symbol when an error occurs
during parsing.
- The Error function lets you raise an
error from within your expression.
- SetVar, which was already in the DLL, is now
declared in the header / include file, and explained in the help
file. It lets your expression set
the value of a variable.
- ucSetVariableValue sets the value of a
variable using the variable's handle.
This is a replacement for the ucSetValueDbl routine that was
available for some compilers.
- Arrays are supported.
- Both DLLs
now contain version information (before, only the main DLL did).
- Unicode for VC++.
- Miscellaneous
features beyond the scope of this help file (and which are subject to
change):
- ~Eval
(which evaluates a sub-expression in place during pre-parsing) now has
sister routines ~Eval_1, which substitutes the result of the evaluation,
and moves on without passing over it a second time, and ~Eval_P, which
evaluates during the parsing stage.
Likewise ~Expand has a ~Expand_1 counterpart.
- Batch
evaluation (for faster speed).
- ucGetCodeBlock.
- End-user
routines: ucHandle(), ucRename()
- Partial
list of bug fixes:
- The
numeric pattern in the header / include file was fixed so that variable
names that start with an "e" and a number, such as
e123_somename, no longer cause a problem.
- The
leading 0 in a fractional number between 0 and 1 is optional again, as it
was in 2.0. For instance .5 is
accepted (as the equivalent of 0.5).
- Syntax
errors in ucDefine (and related routines, such as ucDefineVariable, ucDefineFunction,
etc.) will no longer cause a crash.
- ByExpr
no longer has to be the last argument when present in a function
definition.
- ByExpr
now works with operators definitions as well.
- Defining
a something such as "f(x=-1) = ..." didn't work if there was no
space between the = sign and -. Fixed.
- FPU
exceptions are handled more consistently.
- AndAlso,
and OrElse were fixed.
New or enhanced in version 2.95
- Speed. Versions 2.9 and 2.91 were slower than
2.0 in some ways, so the product was temporarily renamed uCalc Free Math
Parser and then uCalc FMP. Version
2.95 is now faster than ever, so the original uCalc Fast Math Parser
product name was reclaimed.
Optimizations were implemented for user-defined functions (and
operators), and for compilers that support Double precision so that
extraneous conversions to Extended precision are no longer performed. The speed bump in updating variable
values under VB.NET was also diminished.
- More
direct .NET support. A special
.NET DLL is included, which should work with any .NET compiler, and not
just VB.NET.
- Better
error handling; particularly for errors that occur elsewhere other than
the default thread, as well as when defining an item.
- Memory
leak for ucStrReturn, which affected some compilers, is fixed.
New or enhanced in version 2.91: (minor upgrade)
- Documentation
was revised, licensing options were made less confusing, and include files
were cleaned up.
New or enhanced in version 2.9:
The improvements mentioned below are relevant mainly in the context
of moving from uCalc Fast Math Parser 2.0 to version 2.9. More advanced features that are also new can
be found in the uCalc Language Builder, which
is a superset of uCalc FMP, and available separately.
- The
IIF() function evaluates either the True argument or the False argument,
depending on the value of the Condition argument, but not both, unlike
version 2.0 which always evaluated both.
- You
can define callback functions similar to IIF() such that arguments passed
ByExpr (as opposed to ByRef or ByVal) are not evaluated ahead of
time. This was not possible in
version 2.0.
- It is
no longer necessary to set up definition space boundaries ahead of
time. Memory is gradually
allocated as needed. You won't
need ucReset (though you can release an entire thread using
ucReleaseItem), and you won't have to worry about running out of
definition space (assuming you don't intentionally, or inadvertently
devise a way to consume all your gigs of memory). And there is no maximum number of
arguments per function.
- FMP
2.0 only allowed you to define infix (binary) operators. Now you can also define prefix
and postfix operators as well.
See DemoDefs.Txt for examples.
- FMP
2.0 operator definitions didn't allow you to set individual precedence
levels for each operator, as you can do now. See DemoDefs.Txt for examples.
- Case
sensitivity can be turned on or off.
(It's off by default).
- User-friendly
form-based demos for PowerBASIC, Borland C++ Builder, VC++, and VB.NET are
now included. (VB classic, and
Delphi already had form-based demos).
- Support
for VB.NET was added.
- Speed.
The new uCalc should be much faster, both in terms of parsing speed, and
in evaluation speed. The
difference in speed may range from barely noticeable to very dramatic,
depending on what you are doing, how you choose to implement things, and
in some cases which compiler you are using. By default, compilers that have native support for 80-bit
precision can benefit the most in numeric calculations. Compilers that support pointers can
create callbacks that use uCalc's NativeCall (an advanced Language Builder feature) for more
efficiency.
- You
can attach a uCalc variable to the address of a variable defined in your
source code. See the source code
for the Plotting and Sum examples in the demo files (excluding VB.NET).
- Specific
data types (Single, Double, Long, String, WideString, LPCSTR, etc.) are
supported, replacing generic numeric and string types.
- There
is no longer a problem with using ucEval or ucEvalStr in your callbacks.
- Function
overloading is supported.
- Function
bootstrapping is supported.
- Function
recursion is supported.
- More
function definition flexibility is supported.
- Multi-threading
is supported.
- Multi-statement
expressions are supported.
- Overall
syntax was simplified.
- The
FPU word of the host program and uCalc's FPU word are insulated from each
other.
- FPU
errors such as Overflow, Underflow, Division-by-0, etc., can be caught, or
masked.
- uCalc()
is a function that encapsulates all of uCalc's functionality. This function can be made available
even to the end-user.