Xobas Software'> ]> ProLinga-Calc Project Release: &PRODUCT;-&version; - &release-date; Bas Driessen &xobas;
bas.driessen@xobas.com
Original author and current maintainer.
2002-©right-year; The ProLinga Team Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". This document describes the ProLinga-Calc Project, how to build the software components and documents the API reference of the prolinga-calc library.
ProLinga-Calc Project The ProLinga-Calc Project is a small project which focusses on the development of a library which, after implementing, enables any application to make C expression type calculations. Simple expressions as x=2+3 and more complicated ones like x=2*sin(y). Main purpose for the creation of this project, is to provide an easy way to perform calculations from the ProLinga 4GL programming language. Since the result library of this project is very open, simple and easy to implement, it can be used in other non-ProLinga related projects. Input for the ProLinga-Calc library are normal C expressions containing operators, float or integer constants, variables and references to previous results ($n). Precedence and semantic of operators is the same as in C language. There are two extra binary operators: >>> unsigned shift right and ** raising to power. ProLinga-Calc supports the standard set of functions from C mathematics library and also defines function prime(n), which returns smallest prime number >= n. Operators: > >>>]]> >=]]> >= >>>= &= |= ^= **=]]> Functions: abs acos asin atan atan2 cos cosh exp int float log log10 prime sin sinh sqrt tan tanh To test the library, a small binary called prolingacalc is built when compiling.
Screenshot prolingacalc binary Screenshot of the prolingacalc binary.
ProLinga-Calc has been built and tested on several popular GNU/Linux platforms as RedHat Fedora, Mandriva Linux, Debian, openSUSE Linux, Ubuntu and MS-Windows (Cygwin). Since all code is written in C++, it can be ported to all modern UNIX systems, Linux variants as well as Windows and Mac O/S platforms. Portions of code are lifted from the freeware application ccalc V1.01 programmed by Konstantin Knizhnik.
ProLinga-Calc Programming Notes A very basic example program using ProLinga-Calc looks like this: #include int main() { char *expression = "2+5"; char *result; PlCalc calc; printf("Expression is %s\n", expression); result = calc.getCalc(expression); printf("Result is %s\n", result); return 0; } ]]> This assigns 2 + 5 to expression, calls the function getCalc of class PlCalc for the calculation of 2 + 5 and assigns the outcome to result. To compile the program, use the following command: g++ calc_test.cpp -o calc_test `pkg-config --cflags --libs prolinga-calc` You may need to set the environment variable PKG_CONFIG_PATH to point to the directory where prolinga-calc.pc is located. By default this is directory /usr/local/lib/pkgconfig on Linux for example. You can also use a more traditional command as: g++ calc_test.cpp -o calc_test -I/usr/local/include/ -L/usr/local/lib -lprolingacalc Download ProLinga-Calc There are two types of product versions available for download: Production Version Development Version Production Version The production version is an official product release. This is a stable completed version which should be used in production environments. Please visit the download page for the latest details. Development Version The development version is a snapshot of the latest source files. Since it can contain bugs as part of "work in progress", this version should not be used in production environments. Only developers who want to help with further development of the ProLinga Projects should download this version. Please read the details at the Subversion of how to obtain the latest development version. Build ProLinga-Calc Prerequisites ProLinga-Calc &version; has been built and tested on Fedora, Mandriva Linux, Debian, openSUSE Linux Ubuntu and MS-Windows (Cygwin). The product should compile and run successfully on other Linux distributions as well as UNIX. GNU gcc/g++ >= 3.3 compilers/tools are required for a successful build. Required 3rd party package(s) for a successful build: Math library libm. Optional 3rd party package(s) for a successful build: Command line processor xsltproc. This package is only required to re-generate the HTML pages after making changes to the documentation. Build Instructions Extracting archive The product archive can be extracted to any desired directory using unzip (.zip file extension) or gunzip (.gz file extension) or bunzip2 (.bz2 file extension) and tar. After extracting, the following directories will be created: Directory Structure. Directory Description &PRODUCT;-&version; Product version root directory. &PRODUCT;-&version;/config Config build information. &PRODUCT;-&version;/doc Documentation. &PRODUCT;-&version;/src All source and internal header files. &PRODUCT;-&version;/tests Self tests. &PRODUCT;-&version;/prolinga External (API) header files.
Compiling and Linking To build the product go to the product root directory and run the configure script. For default installation in /usr/local type: ./configure To install into another directory type: ./configure --prefix=/any/dirname/ For all other configure options, type: ./configure --help After running the configure script, the product can be build with: make To run the optional self-test type: make check After compilation, the binaries, libraries and header files can be installed with: make install You may need root access for this last option. By default, HTML documentation pages are available in the doc/html directory. These pages are generated from DocBook XML file format files in /doc. To re-generate the HTML pages from these files type: make html The command line XSLT processor xsltproc must be available from $PATH to be able to generate the HTML documentation. Dependencies No dependencies on non-system libraries. Choosing the right type of build The default configuration options provide libraries which can be used both to develop/debug as to run the product. However better builds are possible for a dedicated development or production environment. In production environments, builds are needed which contain minimal (debug) overhead, so they are fast and small. To build such binaries/libraries, the --enable-final options can be used. Example: ./configure --enable-final The enable-final flag is configured to be used with GCC environments only. If access to more compilers become available over time, the enable-flag will be ported to those compilers as well. In development environments, builds are needed producing warnings, enabling maximum debugging info etc. Several options are available here. --enable-warnings : Set all compiler warning flags --enable-debug : Enable all debug messages --enable-gprof : Enables profiling with gprof (GCC only)
Further development of ProLinga-Calc All ProLinga Projects are under constant active development. This includes issues related to fixing bugs, increasing performance etc, as well as expanding the various projects with new features. This chapter provides information of all these types of tasks as well as details of how to join the development team. To-do List This section contains a list of work that needs to be done on the product. A more detailed and up to date list is available on the ProLinga Bugzilla Server. Self tests need to be further developed. Utilities. Code review and cleanup. Subversion A Subversion tree containing the latest project sources is available at http://svn.prolinga.org. For access please contact the ProLinga Team. Bugzilla Bugzilla software development and bug tracking system to manage the ProLinga projects is available at http://bugzilla.prolinga.org. For access please contact the ProLinga Team. Help to Develop Are you ready to join the ProLinga development team? There are several ways you can help: Use the product. Tell us what you think. Fixing bugs. Visit the development section on the ProLinga Web Site, choose a bug, fix it and send us the code changes. Enhancements. Have a look at the enhancement section of the to-do list and let us know which new feature you want to help to develop. Porting. To be successful it is essential that the ProLinga Projects are available on a wide range of platforms. We need help in porting and testing as well as providing binary releases for many different platforms. Let us know if and how you can help out. Real world examples. Are you using ProLinga products or do you know people who are happily using it. Please tell us the story and provide some screenshots. ProLinga-Calc C++ API This section contains the API reference for ProLinga-Calc. All the public interfaces are documented here. &prolinga-calc-API; ProLinga-Calc User Guide This section contains the user guide for the ProLinga-Calculator. &prolinga-calc-userguide; &fdl;