Adding uCalc to your PB application
In order to implement uCalc Fast Math Parser in PowerBASIC (PB/Win or PB/CC), follow these steps:
Now you're all set to go.
A user-friendly form-based demo is found in a file named DemoPB.Bas. The source code in that file demonstrates the essential features, especially as they relate to PowerBASIC. Because it is form-based, it will compile with PB/Win, and not PB/CC. However, uCalc FMP itself fully supports PB/CC.
The following examples are for key features that may have some peculiarities in PowerBASIC. The following examples compile with PB/Win. In order to run them in PB/CC, change statements such as MsgBox to Print, and InputBox to Line Input. There are many more examples in Visual Basic that are close enough to PB. Those are listed under More Examples.
Example 1: Simple evaluation with ucEvalStr
Example 2: Fast evaluation millions of times in a loop
Example 3: Defining a centralized error handler
Example 4: Raising an error with ucRaiseErrorMessage
Example 5: A native function callback with two numeric arguments
Example 6: A native function callback with any number of arguments
Example 7: A native string callback function
Example 8: A non-native function callback
Example 9: Strings in non-native functions
Example 10: Attached variables
See More Examples
What’s different in version 3
· Support for special uCalc enhancements unique to PB were removed so that uCalc could work roughly the same across compilers and be easier to maintain. Callbacks simply use a Dword for expression arguments, and macros were replaced with functions.
· See What's New in version 3.0.
New or enhanced in version 2.96
New or enhanced in version 2.9+