From ef962f6008f25ab7cbd4ca21bcc72b97a1e2d76f Mon Sep 17 00:00:00 2001 From: Ruben Undheim Date: Tue, 5 Jul 2016 18:02:38 +0200 Subject: Imported Upstream version 0.0.34 --- fparser/docs/fparser.html | 1863 +++++++++++++++++++++++++++++++++++++++++++++ fparser/docs/gpl.txt | 674 ++++++++++++++++ fparser/docs/lgpl.txt | 165 ++++ fparser/docs/style.css | 80 ++ 4 files changed, 2782 insertions(+) create mode 100644 fparser/docs/fparser.html create mode 100644 fparser/docs/gpl.txt create mode 100644 fparser/docs/lgpl.txt create mode 100644 fparser/docs/style.css (limited to 'fparser/docs') diff --git a/fparser/docs/fparser.html b/fparser/docs/fparser.html new file mode 100644 index 0000000..ffc73f4 --- /dev/null +++ b/fparser/docs/fparser.html @@ -0,0 +1,1863 @@ + + + + + + Function Parser for C++ v4.5.1 : Documentation + + + +

Function Parser for C++ v4.5.1

+ +

Authors: Juha Nieminen +(http://iki.fi/warp/), +Joel Yliluoma +(http://iki.fi/bisqwit/). + +

The usage license of this library is located at the end of this file. + +

Table of contents:

+ + + + +

What's new

+ +

What's new in v4.5.1 +

+ +

What's new in v4.5 +

+ + + + + +

Preface

+ +

This C++ library offers a class which can be used to parse and evaluate a +mathematical function from a string (which might be eg. requested from the +user). The syntax of the function string is similar to mathematical expressions +written in C/C++ (the exact syntax is specified later in this document). +The function can then be evaluated with different values of variables. + +

For example, a function like "sin(sqrt(x*x+y*y))" can be +parsed from a string (either std::string or a C-style string) +and then evaluated with different values of x and y. +This library can be useful for evaluating user-inputted functions, or in +some cases interpreting mathematical expressions in a scripting language. + +

This library aims for maximum speed in both parsing and evaluation, while +keeping maximum portability. The library should compile and work with any +standard-conforming C++ compiler. + +

Different numerical types are supported: double, + float, long double, long int, + std::complex (of types double, + float and long double), + multiple-precision floating point numbers using the MPFR library, and + arbitrary precision integers using the GMP library. (Note that it's + not necessary for these two libraries to exist in the system in order + to use the Function Parser library with the other numerical types. Support + for these libraries is optionally compiled in using preprocessor settings.) + + + + +

Usage

+ +

To use the FunctionParser class, you have to include +"fparser.hh" in your source code files which use the +FunctionParser class. + +

If you are going to use the MPFR version of the library, you need to +include "fparser_mpfr.hh". If you are going to use the GMP +version of the library, you need to include "fparser_gmpint.hh". +(Note that support for these special parser versions needs to be specified +with preprocessor macros. See the documentation +below for details.) + +

When compiling, you have to compile fparser.cc and +fpoptimizer.cc and link them to the main program. In many +developement environments it's enough to add those two files to your +current project (usually header files don't have to be added to the +project for the compilation to work). + +

If you are going to use the MPFR or the GMP versions of the library, +you also need to add mpfr/MpfrFloat.cc or +mpfr/GmpInt.cc files to your project, respectively. Otherwise +they should not be added to the project. + +

Note that part of the library source code is inside several +.inc files inside the extrasrc subdirectory +(these files contain auto-generated C++ code), provided in the library +package. These files are used by fparser.cc and don't need +to be added explicitly to the project in most IDEs (such as Visual Studio). +Basically, you don't need to do anything with these files, other than keep +them in the extrasrc subdirectory. + +

Simple usage example of the library: + +

+    FunctionParser fp;
+    fp.Parse("sqrt(x*x + y*y)", "x,y");
+    double variables[2] = { 1.5, 2.9 };
+    double result = fp.Eval(variables);
+
+ + + +

Parser types

+ +

Different versions of the function parser class are supported, using + different floating point or integral types for function evaluation. + +

All the classes other than the default one, FunctionParser, + need to be enabled at compile time by defining a preprocessor macro + (specified below) either in the fpconfig.hh file or your + compiler settings. (The reason for this is that every parser that is + included in the compilation process will make the compilation slower + and increase the size of the executable, so they are compiled only on + demand. Also, the GMP and MPFR versions of the parser require for those + libraries to be available, which is often not the case.) + +

Note that if you try to use the other class types without enabling them + with the correspondent preprocessor macro, you will get a linker error + (rather than a compiler error) because those classes will not have been + instantiated when the library was compiled. + +

Currently the Optimize() method works only for the + FunctionParser, FunctionParser_f and + FunctionParser_ld classes. For the other types it can be + called but it does nothing. + +

+

+

FunctionParser

+
+

This is the default class, which uses double as its + numerical type. This is the only class enabled by default. +

If you use some other type than this one, and you don't want this + version of the class compiled into the library, you can define the + preprocessor macro FP_DISABLE_DOUBLE_TYPE. +

+ +

FunctionParser_f

+
+

This parser uses float as its numerical type. +

The FP_SUPPORT_FLOAT_TYPE preprocessor macro needs to be + defined for this class to be enabled. +

+ +

FunctionParser_ld

+
+

This parser uses long double as its numerical type. +

The FP_SUPPORT_LONG_DOUBLE_TYPE preprocessor macro needs + to be defined for this class to be enabled. +

Note that the FP_USE_STRTOLD preprocessor macro should + also be defined when using this version of the parser if the compiler + supports the (C99) function strtold(). (See + documentation below.) +

+ +

FunctionParser_li

+
+

This parser uses long int as its numerical type. +

The FP_SUPPORT_LONG_INT_TYPE preprocessor macro needs + to be defined for this class to be enabled. +

Note that this version of the class uses a reduced function syntax + with support only for functions which are feasible to be used with + integral types (namely abs(), eval(), + if(), min() and max(), besides + basic arithmetic operators, except for the power operator). +

+ +

FunctionParser_cd, FunctionParser_cf, + FunctionParser_cld

+
+

These parsers use std::complex<double>, + std::complex<float> and + std::complex<long double> as their numerical type, + respectively. +

The preprocessor macros to enable them are + FP_SUPPORT_COMPLEX_DOUBLE_TYPE, + FP_SUPPORT_COMPLEX_FLOAT_TYPE and + FP_SUPPORT_COMPLEX_LONG_DOUBLE_TYPE. +

If FunctionParser_cld is used, the + FP_USE_STRTOLD macro should also be defined if the compiler + supports the strtold() function. +

+ +

FunctionParser_mpfr

+
+

This parser uses MpfrFloat as its numerical type. +

The FP_SUPPORT_MPFR_FLOAT_TYPE preprocessor macro needs + to be defined for this class to be enabled. +

Note that to use this version of the parser, + "fparser_mpfr.hh" needs to be included. +

MpfrFloat is an auxiliary class which uses the MPFR + library for multiple-precision floating point numbers. The class + behaves largely like a floating point type, and is declared in the + mpfr/MpfrFloat.hh file (see that file for info about + the public interface of the class). +

If this class is enabled, mpfr/MpfrFloat.cc + needs to be compiled into the project, as well as the GMP and MPFR + libraries. (With the gcc compiler this means using the linker options + "-lgmp -lmpfr".) +

+ +

FunctionParser_gmpint

+
+

This parser uses GmpInt as its numerical type. +

The FP_SUPPORT_GMP_INT_TYPE preprocessor macro needs + to be defined for this class to be enabled. +

Note that to use this version of the parser, + "fparser_gmpint.hh" needs to be included. +

GmpInt is an auxiliary class which uses the GMP + library for arbitrary-precision integer numbers. The class + behaves largely like an integer type, and is declared in the + mpfr/GmpInt.hh file (see that file for info about + the public interface of the class). +

If this class is enabled, mpfr/GmpInt.cc + needs to be compiled into the project, as well as the GMP library. +

This version of the class also uses a reduced version of the syntax, + like the long int version. +

Note: Since there's no upper limit to the size of GMP + integers, this version of the class should be used with care in + situations where malicious users might be able to exploit it to + make the program run out of memory. An example of this would be + a server-side application usable through the WWW. +

+
+ +

Note that these different classes are completely independent and + instances of different classes cannot be given to each other using the + AddFunction() method. Only objects of the same type can + be given to that method. + +

The rest of the documentation assumes that FunctionParser + (which uses the double type) is used. The usage of the other + classes is identical except that double is replaced with the + correspondent type used by that class. (In other words, whenever the + rest of this documentation uses the type keyword 'double', + the correspondent type should be used instead, when using another version + of the class.) + + + +

Configuring the compilation

+ +

There is a set of precompiler options in the fpconfig.hh file +which can be used for setting certain features on or off. All of these options +can also be specified from the outside, using precompiler settings (eg. the +-D option in gcc), and thus it's not necessary to modify this +file. + +

+

FP_USE_STRTOLD : (Default off)

+

If FunctionParser_ld or FunctionParser_cld + are used, this preprocessor macro should be defined if the compiler + supports the (C99) function strtold(). If not, then numeric + literals will be parsed with double precision only, which in most + systems is less accurate than long double precision, which will cause + small rounding errors. (This setting has no effect on the other parser + types.) Note that strtold() will also be automatically used + if __cplusplus indicates that C++11 is in use. +

+ +

FP_SUPPORT_CPLUSPLUS11_MATH_FUNCS : (Default off)

+

Use C++11 math functions where applicable. (These are ostensibly + faster than the equivalent formulas using C++98 math functions.) Note + that not all compilers support these functions (even if they otherwise + support C++11.) + +

FP_SUPPORT_OPTIMIZER : (Default on)

+

If you are not going to use the Optimize() method, you + can comment this line out to speed-up the compilation a bit, as + well as making the binary a bit smaller. (Optimize() can + still be called, but it will not do anything.) + +

You can also disable the optimizer by specifying the + FP_NO_SUPPORT_OPTIMIZER precompiler constant in your + compiler settings. +

+ +

FP_USE_THREAD_SAFE_EVAL : (Default off)

+

Define this precompiler constant to make Eval() + thread-safe. Refer to the thread safety + section later in this document for more information. + Note that defining this may make Eval() slightly slower. +

Also note that the MPFR and GMP versions of the library cannot be + made thread-safe, and thus this setting has no effect on them. +

+ +

FP_USE_THREAD_SAFE_EVAL_WITH_ALLOCA : (Default off)

+

This is like the previous, but makes Eval() use the + alloca() function (instead of std::vector). + This will make it faster, but the alloca() + function is not standard and thus not supported by all compilers. +

+
+ + + + +

Copying and assignment

+ +

The class implements a safe copy constructor and assignment operator. + +

It uses the copy-on-write technique for efficiency. This means that + when copying or assigning a FunctionParser instance, the internal data + (which in some cases can be quite lengthy) is not immediately copied + but only when the contents of the copy (or the original) are changed. + +

This means that copying/assigning is a very fast operation, and if + the copies are never modified then actual data copying never happens + either. + +

The Eval() and EvalError() methods of the +copy can be called without the internal data being copied. + +

Calling Parse(), Optimize() or the user-defined +constant/function adding methods will cause a deep-copy. + + + + +

Short descriptions of FunctionParser methods

+ +
+int Parse(const std::string& Function, const std::string& Vars,
+          bool useDegrees = false);
+
+int Parse(const char* Function, const std::string& Vars,
+          bool useDegrees = false);
+
+ +

Parses the given function and compiles it to internal format. + Return value is -1 if successful, else the index value to the location + of the error. + +


+
+void setDelimiterChar(char);
+
+ +

Sets an ending delimiter character for the function string. (See the + long description for more details.) + +


+
+static double epsilon();
+static void setEpsilon(double);
+
+ +

Setter and getter for the epsilon value used with comparison operators. + +


+
+const char* ErrorMsg(void) const;
+
+ +

Returns an error message corresponding to the error in +Parse(), or an empty string if no such error occurred. + +


+
+ParseErrorType GetParseErrorType() const;
+
+ +

Returns the type of parsing error which occurred. Possible return types + are described in the long description. + +


+
+double Eval(const double* Vars);
+
+ +

Evaluates the function given to Parse(). + +


+
+int EvalError(void) const;
+
+ +

Returns 0 if no error happened in the previous call to +Eval(), else an error code >0. + +


+
+void Optimize();
+
+ +

Tries to optimize the bytecode for faster evaluation. + +


+
+bool AddConstant(const std::string& name, double value);
+
+ +

Add a constant to the parser. Returns false if the name of +the constant is invalid, else true. + +


+
+bool AddUnit(const std::string& name, double value);
+
+ +

Add a new unit to the parser. Returns false if the name of +the unit is invalid, else true. + +


+
+bool AddFunction(const std::string& name,
+                 double (*functionPtr)(const double*),
+                 unsigned paramsAmount);
+
+ +

Add a user-defined function to the parser (as a function pointer). +Returns false if the name of the function is invalid, else +true. + +


+
+bool AddFunction(const std::string& name, FunctionParser&);
+
+ +

Add a user-defined function to the parser (as a FunctionParser +instance). Returns false if the name of the function is invalid, +else true. + +


+
+bool RemoveIdentifier(const std::string& name);
+
+ +

Removes the constant, unit or user-defined function with the specified +name from the parser. + +


+
+int ParseAndDeduceVariables(const std::string& function,
+                            int* amountOfVariablesFound = 0,
+                            bool useDegrees = false);
+int ParseAndDeduceVariables(const std::string& function,
+                            std::string& resultVarString,
+                            int* amountOfVariablesFound = 0,
+                            bool useDegrees = false);
+int ParseAndDeduceVariables(const std::string& function,
+                            std::vector<std::string>& resultVars,
+                            bool useDegrees = false);
+
+ +

Like Parse(), but the variables in the function are deduced +automatically. The amount of found variables and the variable names themselves +are returned by the different versions of the function. + + + +

Long descriptions of FunctionParser methods

+ +
+ +
+int Parse(const std::string& Function, const std::string& Vars,
+          bool useDegrees = false);
+
+int Parse(const char* Function, const std::string& Vars,
+          bool useDegrees = false);
+
+ +

Parses the given function (and compiles it to internal format). +Destroys previous function. Following calls to Eval() will evaluate +the given function. + +

The strings given as parameters are not needed anymore after parsing. + +

Parameters: + + + + + + + + + + + +
FunctionString containing the function to parse.
VarsString containing the variable names, separated by commas.
+ Eg. "x,y", "VarX,VarY,VarZ,n" or + "x1,x2,x3,x4,__VAR__". +
useDegrees(Optional.) Whether to use degrees or radians in + trigonometric functions. (Default: radians)
+ +

If a char* is given as the Function parameter, +it must be a null-terminated string. + +

Variables can have any size and they are case sensitive (ie. +"var", "VAR" and "Var" are +different variable names). Letters, digits, underscores and +UTF8-encoded characters can be used in variable names, but the name of +a variable can't begin with a digit. Each variable name can appear only +once in the 'Vars' string. Function names are not legal +variable names. + +

Using longer variable names causes no overhead whatsoever to the +Eval() method, so it's completely safe to use variable names +of any size. + +

The third, optional parameter specifies whether angles should be + interpreted as radians or degrees in trigonometrical functions. + If not specified, the default value is radians. + +

Return values: + +

+ +

Example: parser.Parse("3*x+y", "x,y"); + + +


+ +
+void setDelimiterChar(char);
+
+ +

By default the parser expects the entire function string to be valid +(ie. the entire contents of the given std::string, or a C string +ending in the null character '\0'). + +

If a delimiter character is specified with this function, then if it's +encountered at the outermost parsing level by the Parse() +function, and the input function has been valid so far, Parse() +will return an index to this character inside the input string, but rather +than set an error code, FP_NO_ERROR will be set. + +

The idea is that this can be used to more easily parse functions which +are embedded inside larger strings, containing surrounding data, without +having to explicitly extract the function to a separate string. + +

For example, suppose you are writing an interpreter for a scripting + language, which can have commands like this: + +

let MyFunction(x,y) = { sin(x*x+y*y) } // A 2-dimensional function + +

Normally when parsing such a line you would have to extract the part +inside the curly brackets into a separate string and parse it that way. +With this feature what you can do instead is to set '}' as +the delimiter character and then simply give a pointer to the character +which comes after the '{'. If all goes well, the +Parse() function will return an index to the '}' +character (from the given starting point) and GetParseErrorType() +will return FP_NO_ERROR. You can use the return +value (if it's not -1) to jump forward in the string to the +delimiter character. + +

Note that a null character ('\0') or the end of the +std::string (if one was given) will still be a valid end of +the function string even if a delimiter character was specified. (In this +case Parse() will return -1 if there was no error, +as usual.) + +

Also note that the delimiter character cannot be any valid operator +or alphanumeric (including the underscore) character, nor the other +characters defined in the function syntax. It must be a character not +supported by the function parser (such as '}', +'"', ']', etc). + + +


+ +
+static double epsilon();
+static void setEpsilon(double);
+
+ +

Comparison operators (for the non-integral versions of the parser) use an +epsilon value to account for floating point calculation rounding errors. +This epsilon value can be set and read with these functions. (Note that the +specified value will be used by all instances of FunctionParser.) If not +specified, the default values are: + +

+ + +
+ +
+const char* ErrorMsg(void) const;
+
+ +

Returns a pointer to an error message string corresponding to the error +caused by Parse() (you can use this to print the proper error +message to the user). If no such error has occurred, returns an empty string. + + +


+ +
+ParseErrorType GetParseErrorType() const;
+
+ +

Returns the type of parse error which occurred. + +

This method can be used to get the error type if ErrorMsg() +is not enough for printing the error message. In other words, this can be +used for printing customized error messages (eg. in another language). +If the default error messages suffice, then this method doesn't need +to be called. + +FunctionParser::ParseErrorType is an enumerated type inside +the class (ie. its values are accessed like +"FunctionParser::SYNTAX_ERROR"). + +

The possible values for FunctionParser::ParseErrorType are listed below, +along with their equivalent error message returned by the +ErrorMsg() method: + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FP_NO_ERRORIf no error occurred in the previous call to Parse().
SYNTAX_ERROR"Syntax error"
MISM_PARENTH"Mismatched parenthesis"
MISSING_PARENTH"Missing ')'"
EMPTY_PARENTH"Empty parentheses"
EXPECT_OPERATOR"Syntax error: Operator expected"
OUT_OF_MEMORY"Not enough memory"
UNEXPECTED_ERROR"An unexpected error occurred. Please make a full bug report to the + author"
INVALID_VARS"Syntax error in parameter 'Vars' given to FunctionParser::Parse()"
ILL_PARAMS_AMOUNT"Illegal number of parameters to function"
PREMATURE_EOS"Syntax error: Premature end of string"
EXPECT_PARENTH_FUNC"Syntax error: Expecting ( after function"
UNKNOWN_IDENTIFIER"Syntax error: Unknown identifier"
NO_FUNCTION_PARSED_YET"(No function has been parsed yet)"
+ + +


+ +
+double Eval(const double* Vars);
+
+ +

Evaluates the function given to Parse(). +The array given as parameter must contain the same amount of values as +the amount of variables given to Parse(). Each value corresponds +to each variable, in the same order. + +

Return values: +

+ +

Example: + +

double Vars[] = {1, -2.5};
+double result = parser.Eval(Vars); + + +


+ +
+int EvalError(void) const;
+
+ +

Used to test if the call to Eval() succeeded. + +

Return values: + +

If there was no error in the previous call to Eval(), +returns 0, else returns a positive value as follows: +

+ + +
+ +
+void Optimize();
+
+ +

This method can be called after calling the Parse() method. +It will try to simplify the internal bytecode so that it will evaluate faster +(it tries to reduce the amount of opcodes in the bytecode). + +

For example, the bytecode for the function "5+x*y-25*4/8" will +be reduced to a bytecode equivalent to the function "x*y-7.5" (the +original 11 opcodes will be reduced to 5). Besides calculating constant +expressions (like in the example), it also performs other types of +simplifications with variable and function expressions. + +

This method is quite slow and the decision of whether to use it or +not should depend on the type of application. If a function is parsed +once and evaluated millions of times, then calling Optimize() +may speed-up noticeably. However, if there are tons of functions to parse +and each one is evaluated once or just a few times, then calling +Optimize() will only slow down the program. + +

Also, if the original function is expected to be optimal, then calling +Optimize() would be useless. + +

Note: Currently this method does not make any checks (like +Eval() does) and thus things like "1/0" will cause +undefined behaviour. (On the other hand, if such expression is given to the +parser, Eval() will always give an error code, no matter what +the parameters.) If caching this type of errors is important, a work-around +is to call Eval() once before calling Optimize() +and checking EvalError(). + +

If the destination application is not going to use this method, +the compiler constant FP_SUPPORT_OPTIMIZER can be undefined in +fpconfig.hh to make the library smaller (Optimize() +can still be called, but it will not do anything). + +

(If you are interested in seeing how this method optimizes the opcode, +you can call the PrintByteCode() method before and after the +call to Optimize() to see the difference.) + + +


+ +
+bool AddConstant(const std::string& name, double value);
+
+ +

This method can be used to add constants to the parser. Syntactically + constants are identical to variables (ie. they follow the same naming + rules and they can be used in the function string in the same way as + variables), but internally constants are directly replaced with their + value at parse time. + +

Constants used by a function must be added before calling +Parse() for that function. Constants are preserved between +Parse() calls in the current FunctionParser instance, so +they don't need to be added but once. (If you use the same constant in +several instances of FunctionParser, you will need to add it to all the +instances separately.) + +

Constants can be added at any time and the value of old constants can +be changed, but new additions and changes will only have effect the next +time Parse() is called. (That is, changing the value of a constant +after calling Parse() and before calling Eval() +will have no effect.) + +

The return value will be false if the 'name' of +the constant was illegal, else true. If the name was illegal, +the method does nothing. + +

Example: parser.AddConstant("pi", 3.1415926535897932); + +

Now for example parser.Parse("x*pi", "x"); will be identical +to the call parser.Parse("x*3.1415926535897932", "x"); + + +


+ +
+bool AddUnit(const std::string& name, double value);
+
+ +

In some applications it is desirable to have units of measurement. +A typical example is an application which creates a page layout to be +printed. When printing, distances are usually measured in points +(defined by the resolution of the printer). However, it is often more +useful for the user to be able to specify measurements in other units +such as centimeters or inches. + +

A unit is simply a value by which the preceding element is multiplied. +For example, if the printing has been set up to 300 DPI, one inch is +then 300 points (dots). Thus saying eg. "5in" is the same as saying +"5*300" or "1500" (assuming "in" has +been added as a unit with the value 300). + +

Note that units are slightly different from a multiplication in +that they have a higher precedence than any other operator (except +parentheses). Thus for example "5/2in" is parsed as +"5/(2*300)". +(If 5/2 inches is what one wants, it has to be written "(5/2)in".) + +

You can use the AddUnit() method to add a new unit. The +unit can then be used after any element in the function (and will work as +a multiplier for that element). An element is a float literal, a constant, +a variable, a function or any expression in parentheses. When the element +is not a float literal nor an expression in parentheses, there has to naturally +be at least one whitespace between the element and the unit (eg. +"x in"). To change the value of a unit, call +AddUnit() again with the same unit name and the new value. + +

Unit names share the same namespace as constants, functions and + variables, and thus should be distinct from those. + +

Example: parser.AddUnit("in", 300); + +

Now for example the function "5in" will be identical to +"(5*300)". Other usage examples include "x in", +"3in+2", "pow(x,2)in", "(x+2)in". + + +


+ +
+bool AddFunction(const std::string& name,
+                 double (*functionPtr)(const double*),
+                 unsigned paramsAmount);
+
+ +This method can be used to add new functions to the parser. For example, +if you would like to add a function "sqr(A)" which squares the +value of A, you can do it with this method (so that you don't +need to touch the source code of the parser). + +

The method takes three parameters: + +

+ +

The return value will be false if the given name was invalid +(either it did not follow the variable naming conventions, or the name was +already reserved), else true. If the return value is +false, nothing is added. + +

Example: Suppose we have a C++ function like this: + +

double Square(const double* p)
+{
+    return p[0]*p[0];
+} + +

Now we can add this function to the parser like this: + +

parser.AddFunction("sqr", Square, 1);
+parser.Parse("2*sqr(x)", "x"); + +

An example of a useful function taking no parameters is a function + returning a random value. For example: + +

double Rand(const double*)
+{
+    return drand48();
} + +

parser.AddFunction("rand", Rand, 0); + +

Important note: If you use the Optimize() method, +it will assume that the user-given function has no side-effects, that is, +it always returns the same value for the same parameters. The optimizer will +optimize the function call away in some cases, making this assumption. +(The Rand() function given as example above is one such +problematic case.) + + +


+ +
+bool AddFunction(const std::string& name, FunctionParser&);
+
+ +

This method is almost identical to the previous AddFunction(), +but instead of taking a C++ function, it takes another FunctionParser +instance. + +

There are some important restrictions on making a FunctionParser instance + call another: + +

+ +

Example: + +

FunctionParser f1, f2;
+

f1.Parse("x*x", "x");
+

f2.AddFunction("sqr", f1); + +

This version of the AddFunction() method can be useful to +eg. chain user-given functions. For example, ask the user for a function F1, + and then ask the user another function F2, but now the user can + call F1 in this second function if he wants (and so on with a third + function F3, where he can call F1 and F2, etc). + +


+ +
+template<typename DerivedWrapper>
+bool AddFunctionWrapper(const std::string& name, const DerivedWrapper&,
+                        unsigned paramsAmount);
+
+ +

See section on specialized function objects. + +


+ +
+bool RemoveIdentifier(const std::string& name);
+
+ +

If a constant, unit or user-defined function with the specified name +exists in the parser, it will be removed and the return value will be +true, else nothing will be done and the return value will be +false. + +

(Note: If you want to remove everything from an existing +FunctionParser instance, simply assign a fresh instance to it, ie. like +"parser = FunctionParser();") + +


+ +
+int ParseAndDeduceVariables(const std::string& function,
+                            int* amountOfVariablesFound = 0,
+                            bool useDegrees = false);
+int ParseAndDeduceVariables(const std::string& function,
+                            std::string& resultVarString,
+                            int* amountOfVariablesFound = 0,
+                            bool useDegrees = false);
+int ParseAndDeduceVariables(const std::string& function,
+                            std::vector<std::string>& resultVars,
+                            bool useDegrees = false);
+
+ +

These functions work in the same way as the Parse() function, +but the variables in the input function string are deduced automatically. The +parameters are: + +

+ +

As with Parse(), the return value will be -1 if +the parsing succeeded, else an index to the location of the error. None of +the specified return values will be modified in case of error. + + + +

Specialized function objects

+ +

The AddFunction() method can be used to add a new user-defined +function to the parser, its implementation being called through a C++ function +pointer. Sometimes this might not be enough, though. For example, one might +want to use boost::function or other similar specialized stateful +function objects instead of raw function pointers. This library provides a +mechanism to achieve this. + +

Creating and adding a specialized function object

+ +

In order to create a specialized function object, create a class derived +from the FunctionParser::FunctionWrapper class. This class +declares a virtual function named callFunction that the derived +class must implement. For example: + +

+class MyFunctionWrapper:
+    public FunctionParser::FunctionWrapper
+{
+ public:
+    virtual double callFunction(const double* values)
+    {
+        // Perform the actual function call here, like:
+        return someFunctionSomewhere(values);
+
+        // In principle the result could also be
+        // calculated here, like for example:
+        return values[0] * values[0];
+    }
+};
+
+ +

You can then add an instance of this class to FunctionParser +using the AddFunctionWrapper() method, which works like +AddFunction(), but takes a wrapper object instead of a function +pointer as parameter. For example: + +

+MyFunctionWrapper wrapper;
+parser.AddFunctionWrapper("funcName", wrapper, 1);
+
+ +

Note that FunctionParser will internally create a copy of +the wrapper object, managing the lifetime of this copy, and thus the object +given as parameter does not need to exist for as long as the +FunctionParser instance. Hence the above could also be written as: + +

+parser.AddFunctionWrapper("funcName", MyFunctionWrapper(), 1);
+
+ +

Note that this also means that the wrapper class must have a working +copy constructor. + +

Also note that if the FunctionParser instance is copied, all +the copies will share the same function wrapper objects given to the original. + +

Retrieving specialized function objects

+ +

As noted, the library will internally make a copy of the wrapper object, +and thus it will be separate from the one which was given as parameter to +AddFunctionWrapper(). In some cases it may be necessary to +retrieve this wrapper object (for example to read or change its state). +This can be done with the GetFunctionWrapper() method, which +takes the name of the function and returns a pointer to the wrapper object, +or null if no such object exists with that name. + +

Note that the returned pointer will be of type +FunctionParser::FunctionWrapper. In order to get a pointer to +the actual derived type, the calling code should perform a +dynamic_cast, for example like this: + +

+MyFunctionWrapper* wrapper =
+    dynamic_cast<MyFunctionWrapper*>
+    (parser.GetFunctionWrapper("funcName"));
+
+if(!wrapper) { /* oops, the retrieval failed */ }
+else ...
+
+ +

(Using dynamic cast rather than a static cast adds safety because if you +accidentally try to downcast to the wrong type, the pointer will become null.) + +

The calling code is free to modify the object in any way it wants, but it +must not delete it (because FunctionParser itself handles this). + + + + +

FunctionParserBase

+ +

All the different parser types are derived from a templated base class +named FunctionParserBase. In normal use it's not necessary to +directly refer to this base class in the calling code. However, if the calling +code also needs to be templated (with respect to the numerical type), then +using FunctionParserBase directly is the easiest way to achieve +this. + +

For example, if you want to make a function that handles more than one +type of parser, it can be done like this: + +

+template<typename Value_t>
+void someFunction(FunctionParserBase<Value_t>& parser)
+{
+    // do something with 'parser' here
+}
+
+ +

Now it's convenient to call that function with more than one type of +parser, for example: + +

+FunctionParser realParser;
+FunctionParser_cd complexParser;
+
+someFunction(realParser);
+someFunction(complexParser);
+
+ +

Another example is a class that inherits from FunctionParser +which also wants to support different numerical types. Such class can be +declared as: + +

+template<typename Value_t>
+class SpecializedParser: public FunctionParserBase<Value_t>
+{
+    ...
+};
+
+ + + +

Syntax

+ + +

Numeric literals

+ +

A numeric literal is a fixed numerical value in the input function string + (either a floating point value or an integer value, depending on the parser + type). + +

An integer literal can consist solely of numerical digits (possibly with + a preceding unary minus). For example, "12345". + +

If the literal is preceded by the characters "0x", it + will be interpreted as a hexadecimal literal, where digits can also include + the letters from 'A' to 'F' (in either uppercase + or lowercase). For example, "0x89ABC" (which corresponds to the + value 563900). + +

A floating point literal (only supported by the floating point type parsers) + may additionally include a decimal point followed by the decimal part of the + value, such as for example "12.34", optionally followed by a + decimal exponent. + +

A decimal exponent consists of an 'E' or 'e', + followed by an optional plus or minus sign, followed by decimal digits, and + indicates multiplication by a power of 10. For example, "1.2e5" + (which is equivalent to the value 120000). + +

If a floating point literal is preceded by the characters "0x" + it will be interpreted in hexadecimal. A hexadecimal floating point + literal consists of a hexadecimal value, with an optional decimal point, + followed optionally by a binary exponent in base 10 (in other words, the + exponent is not in hexadecimal). + +

A binary exponent has the same format as a decimal exponent, except that + 'P' or 'p' is used. A binary exponent indicates + multiplication by a power of 2. For example, "0xA.Bp10" + (which is equivalent to the value 10944). + +

With the complex versions of the library, the imaginary part of a numeric + literal is written as a regular numeric literal with an 'i' + appended, for example "5i". Note that when also specifying + the real part of a complex literal, parentheses should be used to avoid + precedence problems. (For example, "(2+5i) * x" + is not the same thing as "2+5i * x". The latter + would be equivalent to "2 + (5i * x)".) + + +

Identifier names

+ +

An identifier is the name of a function (internal or user-defined), + variable, constant or unit. New identifiers can be specified with the + functions described in the earlier subsections in this document. + +

The name of an identifier can use any alphanumeric characters, the + underscore character and any UTF8-encoded unicode character, excluding + those denoting whitespace. + The first character of the name cannot be a numeric digit, though. + +

All functions, variables, constants and units must use unique names. + It's not possible to add two different identifiers with the same name. + + + + +

The function string syntax

+ +

The function string understood by the class is very similar (but not +completely identical in all aspects) to mathematical expressions in the +C/C++ languages. +Arithmetic float expressions can be created from float literals, variables +or functions using the following operators in this order of precedence: + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
()expressions in parentheses first
A unita unit multiplier (if one has been added)
A^Bexponentiation (A raised to the power B)
-Aunary minus
!Aunary logical not (result is 1 if int(A) is 0, else 0)
A*B A/B A%Bmultiplication, division and modulo
A+B A-Baddition and subtraction
A=B A<B A<=B
A!=B A>B A>=B
comparison between A and B (result is either 0 or 1)
A&Bresult is 1 if int(A) and int(B) differ from + 0, else 0.
+ Note: Regardless of the values, both operands are always + evaluated. However, if the expression is optimized, it may + be changed such that only one of the operands is evaluated, + according to standard shortcut logical operation semantics.
A|Bresult is 1 if int(A) or int(B) differ from 0, + else 0.
+ Note: Regardless of the values, both operands are always + evaluated. However, if the expression is optimized, it may + be changed such that only one of the operands is evaluated, + according to standard shortcut logical operation semantics.
+ +

(Note that currently the exponentiation operator is not supported for + FunctionParser_li nor FunctionParser_gmpint. + With the former the result would very easily overflow, making its + usefulness questionable. With the latter it could be easily abused to + make the program run out of memory; think of a function like + "10^10^10^100000".) + +

Since the unary minus has higher precedence than any other operator, for + example the following expression is valid: x*-y + +

The comparison operators use an epsilon value, so expressions which may +differ in very least-significant digits should work correctly. For example, +"0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1 = 1" should always +return 1, and the same comparison done with ">" or +"<" should always return 0. (The epsilon value can be +configured in the fpconfig.hh file.) +Without epsilon this comparison probably returns the wrong value. + +

The class supports these functions: + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
abs(A)Absolute value (magnitude) of A. + With real numbers, if A is negative, returns -A otherwise returns A. + With complex numbers, equivalent to hypot(real(x),imag(x)).
acos(A)Arc-cosine of A. Returns the angle, measured in radians, whose cosine is A.
acosh(A)Same as acos() but for hyperbolic cosine.
arg(A)Phase angle of complex number A. Equivalent to atan2(imag(x),real(x)).
asin(A)Arc-sine of A. Returns the angle, measured in radians, whose sine is A.
asinh(A)Same as asin() but for hyperbolic sine.
atan(A)Arc-tangent of (A). Returns the angle, measured in radians, + whose tangent is A.
atan2(A,B)Principal arc-tangent of A/B, using the signs of the + two arguments to determine the quadrant of the result. + Returns the solution to the two expressions + hypot(A,B)*sin(x)=A, hypot(A,B)*cos(x)=B. + The return value is in range -pi to pi, inclusive.
atanh(A)Same as atan() but for hyperbolic tangent.
cbrt(A)Cube root of A. Returns a solution to expression pow(x,3)=A.
conj(A)Complex conjugate of A. Equivalent to real(x) - 1i*imag(x) or polar(abs(x),-arg(x)).
ceil(A)Ceiling of A. Returns the smallest integer not smaller than A. + Rounds up to the next higher integer. E.g. -2.9, -2.5 and -2.1 are + rounded to -2.0, and 2.9, 2.5 and 2.1 are rounded to 3.0.
cos(A)Cosine of A. Returns the cosine of the angle A, where A is + measured in radians.
cosh(A)Same as cos() but for hyperbolic cosine.
cot(A)Cotangent of A. Equivalent to 1/tan(A).
csc(A)Cosecant of A. Equivalent to 1/sin(A).
eval(...)This a recursive call to the function to be evaluated. The + number of parameters must be the same as the number of parameters + taken by the function. Must be called inside if() to avoid + infinite recursion.
exp(A)Exponential of A. Returns the value of e raised to the power + A where e is the base of the natural logarithm, i.e. the + non-repeating value approximately equal to 2.71828182846.
exp2(A)Base 2 exponential of A. Equivalent to pow(2,A).
floor(A)Floor of A. Returns the largest integer not greater than A. Rounds + down to the next lower integer. + E.g. -2.9, -2.5 and -2.1 are rounded to -3.0, + and 2.9, 2.5 and 2.1 are rounded to 2.0.
hypot(A,B)Euclidean distance function. Equivalent to sqrt(A^2+B^2).
if(A,B,C)If int(A) differs from 0, the return value of this function is B, + else C. Only the parameter which needs to be evaluated is + evaluated, the other parameter is skipped; this makes it safe to + use eval() in them.
imag(A)Return the imaginary part of complex number A. Equivalent to abs(A)*sin(arg(A)).
int(A)Rounds A to the closest integer. Equidistant values are rounded away from + zero. E.g. -2.9 and -2.5 are rounded to -3.0; -2.1 is rounded to -2.0, + and 2.9 and 2.5 are rounded to 3.0; 2.1 is rounded to 2.0.
log(A)Natural (base e) logarithm of A. Returns the solution to expression exp(x)=A.
log2(A)Base 2 logarithm of A. Equivalent to log(A)/log(2).
log10(A)Base 10 logarithm of A.
max(A,B)If A>B, the result is A, else B.
min(A,B)If A<B, the result is A, else B.
polar(A,B)Returns a complex number from magnitude A, phase angle B (in radians). + Equivalent to real(A)*(cos(real(B))+1i*sin(real(B))).
pow(A,B)Exponentiation (A raised to the power B).
real(A)Return the real part of complex number A. Equivalent to abs(A)*cos(arg(A)).
sec(A)Secant of A. Equivalent to 1/cos(A).
sin(A)Sine of A. Returns the sine of the angle A, where A is + measured in radians.
sinh(A)Same as sin() but for hyperbolic sine.
sqrt(A)Square root of A. Returns a solution to expression pow(x,2)=A.
tan(A)Tangent of A. Returns the tangent of the angle A, where A + is measured in radians.
tanh(A)Same as tan() but for hyperbolic tangent.
trunc(A)Truncated value of A. Returns an integer corresponding to the value + of A without its fractional part. + E.g. -2.9, -2.5 and -2.1 are rounded to -2.0, + and 2.9, 2.5 and 2.1 are rounded to 2.0.
+ +

(Note that for FunctionParser_li and + FunctionParser_gmpint only the functions + abs(), eval(), if(), + min() and max() are supported.) + +

Examples of function string understood by the class: + +

"1+2"
+"x-1"
+"-sin(sqrt(x^2+y^2))"
+"sqrt(XCoord*XCoord + YCoord*YCoord)"
+ +

An example of a recursive function is the factorial function: + +"if(n>1, n*eval(n-1), 1)" + +

Note that a recursive call has some overhead, which makes it a bit slower + than any other operation. It may be a good idea to avoid recursive functions + in very time-critical applications. Recursion also takes some memory, so + extremely deep recursions should be avoided (eg. millions of nested recursive + calls). + +

Also note that even though the maximum recursion level of +eval() is limited, it is possible to write functions which +never reach that level but still take enormous amounts of time to evaluate. +This can sometimes be undesirable because it is prone to exploitation, +which is why eval() is disabled by default. It can be enabled +in the fpconfig.hh file. + + + + +

Inline variables

+ +

The function syntax supports defining new variables inside the function +string itself. This can be done with the following syntax: + +

"<variable name> := <expression>; <function>" + +

For example: + +

"length := sqrt(x*x+y*y); 2*length*sin(length)" + +

(Spaces around the ':=' operator are optional.) + +

The obvious benefit of this is that if a long expression needs to be +used in the function several times, this allows writing it only once and +using a named variable from that point forward. + +

The variable name must be an unused identifier (in other words, not an +existing function, variable or unit name). + +

The <function> part can have further inline variable +definitions, and thus it's possible to have any amount of them, for example: + +

"A := x^2; B := y^2; C := z^2; sqrt(A+B+C)" + +

The expressions in subsequent inline variable definitions can use any +of the previous inline variables. It is also possible to redefine an inline +variable. For example: + +

"A := x^2; A := 2*A; sqrt(A)" + + + + +

Whitespace

+ +

Arbitrary amounts of whitespace can optionally be included between + elements in the function string. + The following unicode characters are interpreted as whitespace: + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Character numberCharacter nameUTF-8 byte sequence
U+0009HORIZONTAL TABULATION 09
U+000ALINE FEED 0A
U+000BVERTICAL TABULATION 0B
U+000DCARRIAGE RETURN 0D
U+0020SPACE 20
U+00A0NO-BREAK SPACE C2 A0
U+2000EN QUAD E2 80 80
U+2001EM QUAD E2 80 81
U+2002EN SPACE E2 80 82
U+2003EM SPACE E2 80 83
U+2004THREE-PER-EM SPACE E2 80 84
U+2005FOUR-PER-EM SPACE E2 80 85
U+2006SIX-PER-EM SPACE E2 80 86
U+2007FIGURE SPACE E2 80 87
U+2008PUNCTUATION SPACE E2 80 88
U+2009THIN SPACE E2 80 89
U+200AHAIR SPACE E2 80 8A
U+200BZERO WIDTH SPACE E2 80 8B
U+202FNARROW NO-BREAK SPACE E2 80 AF
U+205FMEDIUM MATHEMATICAL SPACEE2 81 9F
U+3000IDEOGRAPHIC SPACE E3 80 80
+ + +

Miscellaneous

+ + +

About floating point accuracy

+ +

Note that if you are using FunctionParser_ld or +FunctionParser_cld and you want calculations to be as accurate +as the long double type allows, you should pay special attention +to floating point literals in your own code. For example, this is a very +typical mistake: + +

FunctionParser_ld parser;
+parser.AddConstant("pi", 3.14159265358979323846);
+ +

The mistake might not be immediately apparent. The mistake is that a +literal of type double is passed to the AddConstant() +function even though it expects a value of type long double. +In most systems the latter has more bits of precision than the former, which +means that the value will have its least-significant bits clipped, +introducing a rounding error. The proper way of making the above calls is: + +

FunctionParser_ld parser;
+parser.AddConstant("pi", 3.14159265358979323846L);
+ +

The same principle should be used everywhere in your own code, if you are +using the long double type. + +

This is especially important if you are using the MpfrFloat +type (in which case its string-parsing constructor or its +ParseValue() or parseString() member functions +should be used instead of using numerical literals). + + +

About evaluation-time checks

+ +

FunctionParser::Eval() will perform certain sanity +checks before performing certain operations. For example, before calling the +sqrt function, it will check if the parameter is negative, and +if so, it will set the proper error code instead of calling the function. +These checks include: + +

+ +

However, the library can not guarantee that it will catch all +possible floating point errors before performing them, because this is +impossible to do with standard C++. For example, dividing a very large +value by a value which is very close to zero, or calculating the logarithm +of a very small value may overflow the result, as well as multiplying two +very large values. Raising a negative number to a non-integral power may +cause a NaN result, etc. + +

As a rule of thumb, the library will (by default) detect invalid operations +if they are invalid for a range of values. For example, square root is undefined +for all negative values, and arc sine is undefined only values outside the range +[-1, 1]. In general, operations which are invalid for only one single value +(rather than a contiguous range of values) will not be detected (division by +the exact value of zero is an exception to this rule) nor will +overflow/underflow situations. + +

The library cannot guarantee that floating point +errors will never happen during evaluation. This can make the library to +return the floating point values inf and NaN. Moreover, +if floating point errors cause an interrupt in the target computer +architecture and/or when using certain compiler settings, this library +cannot guarantee that it will never happen. + +

Note that the optimizer never performs any sanity checks. + + + + +

About thread safety

+ +

None of the member functions of the FunctionParser class are thread-safe. +Most prominently, the Eval() function is not thread-safe. +(In other words, the Eval() function of a single FunctionParser +instance cannot be safely called simultaneously by two threads.) + +

There are ways to use this library in a thread-safe way, though. If each +thread uses its own FunctionParser instance, no problems will obviously +happen. Note, however, that if these instances need to be a copy of a given +FunctionParser instance (eg. one where the user has entered a function), +a deep copy of this instance has to be performed for each thread. By +default FunctionParser uses shallow-copying (copy-on-write), which means +that a simple assignment of copy construction will not copy the data itself. +To force a deep copy you can all the ForceDeepCopy() function on +each of the instances of each thread after the assignment or copying has been +done. + +

Another possibility is to compile the FunctionParser library so that +its Eval() function will be thread-safe. (This can be done by +defining the FP_USE_THREAD_SAFE_EVAL or the +FP_USE_THREAD_SAFE_EVAL_WITH_ALLOCA +precompiler constant.) As long as only one thread calls the other functions +of FunctionParser, the other threads can safely call the Eval() +of this one instance. + +

Note, however, that compiling the library like this can make +Eval() slightly slower. (The alloca version, if +supported by the compiler, will not be as slow.) + +

Also note that the MPFR and GMP versions of the library cannot be + made thread-safe, and thus this setting has no effect on them. + + + + +

Tips and tricks

+ +

Add constants automatically to all parser objects

+ +

Often the same constants (such as pi and e) and other +user-defined identifiers (such as units) are always used in all the +FunctionParser objects throughout the program. It would be +troublesome to always have to manually add these constants every time a +new parser object is created. + +

There is, however, a simple way to always add these user-defined identifiers +to all instances. Write a class like this: + +

+    class ParserWithConsts: public FunctionParser
+    {
+     public:
+        ParserWithConsts()
+        {
+            AddConstant("pi", 3.14159265358979323846);
+            AddConstant("e", 2.71828182845904523536);
+        }
+    };
+
+ +

Now instead of using FunctionParser, always use +ParserWithConsts. It will behave identically except that the +constants (and possibly other user-defined identifiers) will always be +automatically defined. (Objects of this type even survive +slicing, so +they are completely safe to use anywhere.) + + + + +

Contacting the author

+ +

Any comments, bug reports, etc. should be sent to warp@iki.fi + + + + + + + + +

Usage license

+ +

Copyright © 2003-2011 Juha Nieminen, Joel Yliluoma + +

This Library is distributed under the + Lesser General Public + License (LGPL) version 3. + + + diff --git a/fparser/docs/gpl.txt b/fparser/docs/gpl.txt new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/fparser/docs/gpl.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/fparser/docs/lgpl.txt b/fparser/docs/lgpl.txt new file mode 100644 index 0000000..cca7fc2 --- /dev/null +++ b/fparser/docs/lgpl.txt @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/fparser/docs/style.css b/fparser/docs/style.css new file mode 100644 index 0000000..d5141d3 --- /dev/null +++ b/fparser/docs/style.css @@ -0,0 +1,80 @@ +html +{ + background-color: #E0E0E0; +} + +body +{ + background-color: white; + margin-left: 7%; + margin-top: 16px; + margin-right: 7%; + padding-top: 2em; + padding-left: 7%; + padding-right: 7%; + padding-bottom: 2%; + border-color: black; + border: solid; + border-width: 1px; +} + +h1 +{ + text-align: center; + background-color: #FFEEBB; + padding-bottom: 0.2em; + padding-top: 0.1em; +} + +h2 +{ + background-color: #FFFFCC; + padding-left: 0.5em; +} + +h3 +{ + background-color: #FFFFEE; +} + +blockquote +{ + padding-left: 2em; + padding-right: 2em; + font-style: italic; + background-color: #FFFAF0; +} + +li +{ + padding-top: 0.3em; +} + +pre +{ + background-color: #E8E8E8; + padding-left: 1em; + padding-top: 0.5em; + padding-bottom: 0.5em; +} + +code +{ + font-family: monospace; + color: #900040; +} + +.small +{ + font-size: 80%; +} + +.codecomment +{ + color: green; +} + +.highlight +{ + background: #C0D0FF; +} -- cgit v1.2.3