Index: sbParser-SDK 3.62 for Win32 Download current Trialversion sbParser-SDK 3.62 Addendum to C++ Installation Directory News Purchasing sbParser-SDK EXAMPLES in C++ 1.Example (simple calculation without variables) 2.Example (variables which only consist of one character) 3.Example (variables which consist of more than one character) Current Information-Online
This SDK gives you an easy way to
create an sbParser object. Since version 3 of the csbparse.DLL SoftBase offers the
creation and use of the sbParser by HANDLE. This is a simple (and
known) way to program your own C/C++ code. You only have to
include the header "astsbpar.h" in your C/C++
source and the "astsbpar.cpp" in your project.
Since version 3.5 we added an ActiveX-control sbParserX to the
sbParser-SDK. It can be used with any Win32-compiler e.g. Microsoft
Visual Basic, Microsoft Visual C++, Borland
C++, Borland Delphi or the Borland C++ Builder.
Some examples for the Microsoft
Visual C++, Borland C++, Borland C++ Builder
and Microsoft Visual Basic (ActiveX) compilers
are included in this SDK, too (Screenshots). They are built and can be started to examine the
power of the sbParser object. The Microsoft Visual Basic
example needs the msvbvm50.DLL
that gets installed by many programs (e.g. Microsoft Office 97)
so we did not add this file (1.3MB) to
the sbParser-SDK.You can get it with the whole
VB5run-installation from: http://www.mslm.com/free.htm.
The sbParser-object can solve mathematical functions of any length. But furthermore you can declare up to 24 variables (6 with the ActiveX-control sbParserX). These variables can be defined and redefined. This is very useful for fast calculations, e.g. for function plotters. The following example is very simple but it shows you the easy way of the programming.
If you want to plot a mathematical function like
i.e. f(x) = -sin(x*cos(x))^(1/x)
You only have to create once an sbParser object through
C++: HANDLE hParser = CreateNewParser("-sin(x*cos(x))^(1/x) ", 1, "x"); |
This will create the object that identifies the subfunctions and subcalculations in the function and return the HANDLE of the sbParser.This "precompile" of f(x) takes time (less than 0.001 seconds on a 200MHz Pentium). This may seem very fast but think of the time you will need to create an object for any of the x values you want to plot (maybe thousands). Therefore you can declare the variable x by calling CreateNewParser(...).
The variable x = 0.5 is set with
C++: long double xval = 0.5; long double result; result = GetResult(hParser, x_val); |
and the return value is the result of the calculation. The time that will be used through GetResult(...) is as little as the time the compiled source code would need. I.e. the time the compiled code
C++: long double x_val = 0.5; long double result = -1*powl(sinl(x_val*cosl(x_val)), 1/x_val); |
would need (less than 0.00001 seconds on a 200MHz Pentium).
And of course you can also solve simple functions like "5*7^2" without any variable.
The above C++ example is as easy with the ActiveX-control sbParserX. The sbParserX has got a property Function and a property VarDesc1 to set the function and the name of the variable. You can set both for an sbParserX-object "The_sbParser" with
ActiveX and Visual Basic: The_sbParser.Function = "-sin(x*cos(x))^(1/x)" The_sbParser.VarDesc1 = "x" (Of course you can set the properties with the Property-Inspector, too.) |
The variable x = 0.5 is set with the property VarValue1
ActiveX and Visual Basic: Dim theResult As Double The_sbParser.VarValue1 = 0.5 theResult = The_sbParser.Result |
and the property Result
is the result of the calcualation.
The correctness of the result is the correctness of the floating point unit. The internal calculation of the sbParser object does nothing less than pure calculation by C++ source code. In fact it gives you more: We have a built-in verification of the result. You can clearly see it if you turn a long double value into a char array. As a programmer you know the errors occuring by conversions to strings (e.g. 3.2 turns to "3.200000456"). If you use our ldtochar(...) function you can validate the result. I.e. this function finds out the best string that represents the long double value.
The ldtochar(...) and other useful functions are assembled in this SDK, too.
Last but not least you can change the number system to binary, hexadecimal and octal and the angular unit of the trigonometric subfunctions to degree, radian and centesimal degree.
E.g. it is possible to solve the binary function
ie. f(x)=((sin(x) + 0.1101^11) / sqrt(10.01)) *1011.101
with the variable
x = 10.11
with the angular unit degree and a hexadecimal output
4.875C488C2627A (see C++ Builder example with file "2to16.sbc").
You see: This SDK offers you a fast way to build applications with mathematical functions. As anything is built on char*, you can easily give the user the ability to declare and manipulate the functions and variables through edit fields. So your main advantage of this sbParser-SDK is the easy implementation of a mathematical tool in your program to calculate user defined functions which are typed in conveniently.
Your SoftBase-Team
Download current
Trialversion sbParser-SDK:
sbParser.exe
(660kB)
For questions, prices and further
information send an eMail to
SoftBase@T-Online.de
or write to
SoftBase
Neue Stege 1c
D-46485 Wesel
Germany
Look for updates and new versions
at
http://home.t-online.de/home/SoftBase/serv02_f.htm
Files you need in the building process and
the setup procedure
C++ Build Include the header "astsbpar.h" in your C/C++ source with #include <astsbpar.h> Include the file "astsbpar.cpp" in your C/C++ project Setup Ensure that your application is able to find the csbparse.DLL |
ActiveX Build: Include the ActiveX-control sbParseX and sbRegisterX in your project. (Please check the documentation of you compiler on how to do that.) Setup 1. You have to install the sbParserX.OCX, sbRegisterX.OCX and the csbparse.DLL in the Windows/System-directory. 2. You have to register the sbParserX.OCX and sbRegisterX.OCX via regsvr32.EXE (e.g. "regsvr32.exe c:\windows\system\sbParserX.ocx") to declare them as ActiveX-servers. |
The csbparse.DLL was built and tested on a Borland
C++ 5.02 compiler. At this time it was tested on the Borland
C++ Builder and the Microsoft Visual C++, too. Of
course you can use the library in source code of other Windows
C/C++ compilers e.g. Symantec or Watcom. Normally you have to get
the LIB and DEF file out of the
csbparse.DLL and insert them into your
project. We give you another way: In the sbParser-SDK directory
you find the directory ".\anyc". In this
directory is the Win32 console example "parsanyc.exe"
and the source file "parsanyc.cpp". It includes
the header "astsbpar.h" that will work with
almost any Win32 C++ compiler.
Especially for the Microsoft Visual C++ compiler we have built in some more functions. We have done this to prevent crashes when your Visual C++ program receives a result that over- or underruns the maximum or minimum double value. This may happen since Microsoft redefines long double (80bit) to double (64bit)1. Therefore any of our sbParser SDK function that returns a long double has an equal function that returns a double (e.g. GetResultxxx(...) » dGetResultxxx(...), ConvertBaseTold(...) » ConvertBaseTod(...) or chartold(...) » chartod(...)).
1 Excerpt from the MSDN: "Previous 16-bit versions of Microsoft C/C++ and Microsoft Visual C++ supported the long double, 80-bit precision data type. In Win32 programming, however, the long double data type maps to the double, 64-bit precision data type."
What have we done since last version 3.53...
To offer you the best (and fastest) way to receive your version of the sbParser-SDK you can order it directly per eMail. You just have to complete the order form below and send it to us. Then we will send you an eMail with the current sbParser-SDK and the account. You also get a permission-code, that works with any release of your licensed major version of the sbParser-SDK. I.e. if you have licensed the sbParser-SDK 3.1.2 and we have sent you a code like
ThisIsNotARealOne#123123123 |
you will be able to download any new version with the major version number 3 (e.g. 3.2.2 or 3.5.6) from our homepage and use it with your code, too.
Without this permission-code the sbParser-SDK remains a trialversion that expires at a predefined date (normally in January or July). Of course we will send you a description what you have to do to turn the trialversion into a full version: You just have to call a function of the sbParser-SDK from your C/C++ source with your personal permission-code as a parameter. Which function you have to call depends on your version.
As a licensed user you also achieve support for any release of your licensed major version of the sbParser-SDK. When you have a problem with our SDK (technical or conceptional) just send an eMail to SoftBase@cww.de.
The examples are always clipped with InitSTDsbParserDLL and DeinitSTDsbParserDLL Each of these functions must only be called once in the program.
1.Example
(simple calculation without variables)
//Link
necessary header #include <astsbpar.h> //Load and initialization of the csbparse.dll InitSTDsbParserDLL(); //Creating an sbParser object and receipt its HANDLE HANDLE hParser; hParser = CreateNewParser("5+3^2+round(12.76)"); //Compute the result long double Result; if (GetIsError(hParser)) { //an error occurred (However, it can not occur in the case of the above function.) Result = 0; } else { //Compute the result Result = GetResult(hParser); } //Conversion
of the number to a string, e.g. for output ldtochar(strResult,
Result, 10, true); //Delete
of the sbParser object //Unload
of the csbparse.dll |
2.Example
(variables which only consist of one character)
//Link
necessary header #include <astsbpar.h> //Load and initialization of the csbparse.dll InitSTDsbParserDLL(); //Creating an sbParser object and receipt its HANDLE HANDLE hParser; hParser = CreateNewParser("-sin(x*cos(u))^(1/w)", 3, "xuw"); //Declaring
the variable contents long double Result; Result = 0; } else { //Compute the result Result = GetResultExt(hParser,VarIn); } //Conversion
of the number to a string, e.g. for output ldtochar(strResult,
Result, 15, true); //Delete
of the sbParser object //Unload
of the csbparse.dll |
3.Example
(variables which consist of more than one character)
//Link
necessary header #include <astsbpar.h> //Load and initialization of the csbparse.dll InitSTDsbParserDLL(); //Creating an sbParser object and receipt its HANDLE HANDLE hParser; hParser = CreateNewParser("(Costs1994+Costs1995)-Costs1993*1.25", 3, "Costs1993 Costs1994 Costs1995"); //Declaring the
variable contents long double Result; Result = 0; } else { //Compute the result Result = GetResultExt(hParser,VarIn); } //Conversion
of the number to a string, e.g. for output ldtochar(strResult,
Result, 8, true); //Delete
of the sbParser object //Unload
of the csbparse.dll |