Replace muparser with tinyexpr

This commit is contained in:
Fabian Homborg 2018-02-10 19:46:34 +01:00
parent 6f1ae79a13
commit b75c3b968c
59 changed files with 764 additions and 23488 deletions

View file

@ -7,7 +7,7 @@ IF(POLICY CMP0067)
CMAKE_POLICY(SET CMP0067 OLD)
ENDIF()
PROJECT(fish CXX)
PROJECT(fish)
# We are C++11.
SET(CMAKE_CXX_STANDARD 11)
@ -93,23 +93,22 @@ SET_SOURCE_FILES_PROPERTIES(src/fish_version.cpp
# Set up PCRE2
INCLUDE(cmake/PCRE2.cmake)
# Set up muparser.
INCLUDE(muparser-2.2.5/CMakeLists.txt)
# Set up the docs.
INCLUDE(cmake/Docs.cmake)
# Define a function to link dependencies.
FUNCTION(FISH_LINK_DEPS target)
TARGET_LINK_LIBRARIES(${target} fishlib)
TARGET_LINK_LIBRARIES(${target} fishlib tinyexpr)
ENDFUNCTION(FISH_LINK_DEPS)
ADD_LIBRARY(tinyexpr STATIC src/tinyexpr.c src/tinyexpr.h)
# Define libfish.a.
ADD_LIBRARY(fishlib STATIC ${FISH_SRCS})
TARGET_SOURCES(fishlib PRIVATE ${FISH_HEADERS})
TARGET_LINK_LIBRARIES(fishlib
${CURSES_LIBRARY} ${CURSES_EXTRA_LIBRARY} Threads::Threads ${CMAKE_DL_LIBS}
${PCRE2_LIB} muparser ${Intl_LIBRARIES})
${PCRE2_LIB} ${Intl_LIBRARIES})
# Define fish.
ADD_EXECUTABLE(fish src/fish.cpp)

View file

@ -66,15 +66,6 @@ extra_completionsdir = @extra_completionsdir@
extra_functionsdir = @extra_functionsdir@
extra_confdir = @extra_confdir@
#
# muparser
#
MUPARSER_DIR = muparser-2.2.5
MUPARSER_LIBDIR = $(MUPARSER_DIR)/lib
MUPARSER_LIB = $(MUPARSER_LIBDIR)/libmuparser.a
MUPARSER_H = $(MUPARSER_DIR)/include/muParser.h
EXTRA_MUPARSER = @EXTRA_MUPARSER@
#
# pcre2
#
@ -503,10 +494,6 @@ ifdef EXTRA_PCRE2
src/builtin_string.cpp: $(PCRE2_H)
endif
#ifdef EXTRA_MUPARSER
#src/env.cpp: $(MUPARSER_H)
#endif
#
# Generate the internal help functions by making doxygen create
# man-pages. The convertion path looks like this:
@ -762,7 +749,7 @@ obj: | show-MKDIR_P
#
# Build the fish program.
#
fish: obj/fish.o $(FISH_OBJS) $(EXTRA_PCRE2) ${EXTRA_MUPARSER}
fish: obj/fish.o $(FISH_OBJS) $(EXTRA_PCRE2)
@echo " CXX LD $(em)$@$(sgr0)"
$v $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS_FISH) $(FISH_OBJS) obj/fish.o $(LIBS) -o $@
@ -774,32 +761,24 @@ $(PCRE2_H):
@echo " autoconf $(em)$@$(sgr0)"
$v (cd $(PCRE2_DIR) && ./config.status)
$(MUPARSER_LIB): $(MUPARSER_H)
@echo " MAKE $(em)$@$(sgr0)"
$v $(MAKE) V=$(V) -C $(MUPARSER_DIR) CPPFLAGS=-D_UNICODE=1 lib/libmuparser.a
$(MUPARSER_H):
@echo " autoconf $(em)$@$(sgr0)"
$v (cd $(MUPARSER_DIR) && ./config.status)
#
# Build the fish_tests program.
#
fish_tests: $(FISH_TESTS_OBJS) $(EXTRA_PCRE2) ${EXTRA_MUPARSER}
fish_tests: $(FISH_TESTS_OBJS) $(EXTRA_PCRE2)
@echo " CXX LD $(em)$@$(sgr0)"
$v $(CXX) $(CXXFLAGS) $(LDFLAGS_FISH) $(FISH_TESTS_OBJS) $(LIBS) -o $@
#
# Build the fish_indent program.
#
fish_indent: $(FISH_INDENT_OBJS) $(EXTRA_PCRE2) ${EXTRA_MUPARSER}
fish_indent: $(FISH_INDENT_OBJS) $(EXTRA_PCRE2)
@echo " CXX LD $(em)$@$(sgr0)"
$v $(CXX) $(CXXFLAGS) $(LDFLAGS) $(FISH_INDENT_OBJS) $(LIBS) -o $@
#
# Build the fish_key_reader program to show input from the terminal.
#
fish_key_reader: $(FISH_KEYREAD_OBJS) $(EXTRA_PCRE2) ${EXTRA_MUPARSER}
fish_key_reader: $(FISH_KEYREAD_OBJS) $(EXTRA_PCRE2)
@echo " CXX LD $(em)$@$(sgr0)"
$v $(CXX) $(CXXFLAGS) $(LDFLAGS_FISH) $^ $(LIBS) -o $@
@ -852,8 +831,6 @@ style-all:
distclean: clean
-$v test ! -f $(PCRE2_DIR)/Makefile || \
$(MAKE) V=$(V) -C $(PCRE2_DIR) distclean
-$v test ! -f $(MUPARSER_DIR)/Makefile || \
$(MAKE) V=$(V) -C $(MUPARSER_DIR) distclean
$v rm -rf config.status config.log config.h Makefile autom4te.cache aclocal.m4
.PHONY: distclean
@ -872,15 +849,10 @@ clean:
ifeq ($(V), 0 )
-@test ! -f $(PCRE2_DIR)/Makefile || \
$(MAKE) -C $(PCRE2_DIR) clean
-@test ! -f $(MUPARSER_DIR)/Makefile || \
$(MAKE) -C $(MUPARSER_DIR) clean
else
-@test ! -f $(PCRE2_DIR)/Makefile || \
$(MAKE) -s -C $(PCRE2_DIR) clean > /dev/null || \
$(MAKE) -s -C $(PCRE2_DIR) clean
-@test ! -f $(MUPARSER_DIR)/Makefile || \
$(MAKE) -s -C $(MUPARSER_DIR) clean > /dev/null || \
$(MAKE) -s -C $(MUPARSER_DIR) clean
endif
$v rm -f obj/*.o *.o doc.h doc.tmp
$v rm -f doc_src/*.doxygen doc_src/*.cpp doc_src/*.o doc_src/commands.hdr

View file

@ -134,14 +134,14 @@ if set -q c_files[1]
oclint-xcodebuild xcodebuild.log >/dev/null
end
if test $all = yes
oclint-json-compilation-database -e '/pcre2-10.22/' -e '/muparser-2.2.5/' -- -enable-global-analysis 2>&1
oclint-json-compilation-database -e '/pcre2-10.22/' -- -enable-global-analysis 2>&1
else
set i_files
for f in $c_files
set i_files $i_files -i $f
end
echo oclint-json-compilation-database -e '/pcre2-10.22/' -e '/muparser-2.2.5/' $i_files
oclint-json-compilation-database -e '/pcre2-10.22/' -e '/muparser-2.2.5/' $i_files 2>&1
echo oclint-json-compilation-database -e '/pcre2-10.22/' $i_files
oclint-json-compilation-database -e '/pcre2-10.22/' $i_files 2>&1
end
else
# Presumably we're on Linux or other platform not requiring special

View file

@ -29,7 +29,7 @@ if test $all = yes
echo
exit 1
end
set c_files src/*.h src/*.cpp muparser-2.2.5/src/*.cpp muparser-2.2.5/include/*.h
set c_files src/*.h src/*.cpp src/*.c
# For now we don't restyle all fish scripts other than completion scripts. That's because people
# really like to vertically align the elements of the `complete` command and fish_indent
# currently does not honor that whitespace.

View file

@ -25,7 +25,6 @@ AC_SUBST(HAVE_DOXYGEN)
AC_SUBST(LDFLAGS_FISH)
AC_SUBST(WCHAR_T_BITS)
AC_SUBST(EXTRA_PCRE2)
AC_SUBST(EXTRA_MUPARSER)
#
# If needed, run autoconf to regenerate the configure file
@ -682,26 +681,6 @@ if test "x$included_pcre2" = "xyes"; then
LIBS="$LIBS $PCRE2_LIBS"
fi
# ========
# MuParser math expression library configuration.
EXTRA_MUPARSER=
# Build configure/Makefile for muparser
AC_MSG_NOTICE([using included MuParser library])
# unfortunately these get added to the global configuration
ac_configure_args="$ac_configure_args --enable-shared=no --enable-samples=no --enable-debug=no"
AC_CONFIG_SUBDIRS([muparser-2.2.5])
MUPARSER_CXXFLAGS='-I$(MUPARSER_DIR)/include'
MUPARSER_LIBS='-L$(MUPARSER_LIBDIR) -lmuparser'
# Make the binary depend on the MuParser libraries so they get built
EXTRA_MUPARSER='$(MUPARSER_LIB)'
CXXFLAGS="$CXXFLAGS $MUPARSER_CXXFLAGS"
LIBS="$LIBS $MUPARSER_LIBS"
# Allow configurable extra directories.
AC_SUBST(extra_completionsdir)
AC_ARG_WITH([extra-completionsdir],

View file

@ -1,14 +0,0 @@
SET(MUPARSER_SRCS
${CMAKE_CURRENT_LIST_DIR}/src/muParser.cpp
${CMAKE_CURRENT_LIST_DIR}/src/muParserBase.cpp
${CMAKE_CURRENT_LIST_DIR}/src/muParserBytecode.cpp
${CMAKE_CURRENT_LIST_DIR}/src/muParserCallback.cpp
${CMAKE_CURRENT_LIST_DIR}/src/muParserError.cpp
${CMAKE_CURRENT_LIST_DIR}/src/muParserInt.cpp
${CMAKE_CURRENT_LIST_DIR}/src/muParserTokenReader.cpp)
ADD_LIBRARY(muparser STATIC ${MUPARSER_SRCS})
TARGET_INCLUDE_DIRECTORIES(muparser PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)
FILE(GLOB MUPARSER_HEADERS ${CMAKE_CURRENT_LIST_DIR}/include/*.h)
TARGET_SOURCES(muparser PRIVATE ${MUPARSER_HEADERS})

View file

@ -1,557 +0,0 @@
#######################################################################
# #
# #
# __________ #
# _____ __ __\______ \_____ _______ ______ ____ _______ #
# / \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \ #
# | Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/ #
# |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| #
# \/ \/ \/ \/ #
# Fast math parser Library #
# #
# Copyright (C) 2015 Ingo Berg #
# #
# Web: muparser.beltoforion.de #
# e-mail: muparser@beltoforion.de #
# #
# #
#######################################################################
History:
--------
Rev 2.2.5: 27.04.2015
---------------------
Changes:
* example2 extended to work with UNICODE character set
* Applied patch from Issue 9
Bugfixes:
* muChar_t in muParserDLL.h was not set properly when UNICODE was used
* muparser.dll did not build on UNICODE systems
Rev 2.2.4: 02.10.2014
---------------------
Changes:
* explicit positive sign allowed
Bugfixes:
* Fix for Issue 6 (https://code.google.com/p/muparser/issues/detail?id=6)
* String constants did not work properly. Using more than a single one
was impossible.
* Project Files for VS2008 and VS2010 removed from the repository
* Fix for Issue 4 (https://code.google.com/p/muparser/issues/detail?id=4)
* Fix for VS2013 64 bit build option
* return type of ParserError::GetPos changed to int
* OpenMP support enabled in the VS2013 project files and precompiled windows DLL's
* Bulkmode did not evaluate properly if "=" and "," operator was used in the expression
Rev 2.2.3: 22.12.2012
---------------------
Removed features:
* build files for msvc2005, borland and watcom compiler were removed
Bugfixes:
* Bugfix for Intel Compilers added: The power operator did not work properly
with Intel C++ composer XE 2011.
(see https://sourceforge.net/projects/muparser/forums/forum/462843/topic/5117983/index/page/1)
* Issue 3509860: Callbacks of functions with string parameters called twice
(see http://sourceforge.net/tracker/?func=detail&aid=3509860&group_id=137191&atid=737979)
* Issue 3570423: example1 shows slot number in hexadecimal
(see https://sourceforge.net/tracker/?func=detail&aid=3570423&group_id=137191&atid=737979)
* Fixes for compiling with the "MUP_MATH_EXCEPTIONS" macro definition:
- division by zero in constant expressions was reported with the code "ec_GENERIC"
instead of "ecDIV_BY_ZERO"
- added throwing of "ecDOMAIN_ERROR" to sqrt and log functions
Rev 2.2.2: 18.02.2012
---------------------
Bugfixes:
* Optimizer did'nt work properly for division:
(see https://sourceforge.net/projects/muparser/forums/forum/462843/topic/5037825)
Rev 2.2.1: 22.01.2012
---------------------
Bugfixes:
* Optimizer bug in 64 bit systems fixed
(see https://sourceforge.net/projects/muparser/forums/forum/462843/topic/4977977/index/page/1)
Rev 2.2.0: 22.01.2012
---------------------
Improvements:
* Optimizer rewritten and improved. In general: more optimizations are
now applied to the bytecode. The downside is that callback Functions
can no longer be flagged as non-optimizable. (The flag is still present
but ignored) This is necessary since the optimizer had to call the
functions in order to precalculate the result (see Bugfixes). These calls
posed a problems for callback functions with side effects and if-then-else
clauses in general since they undermined the shortcut evaluation prinziple.
Bugfixes:
* Infix operators where not properly detected in the presence of a constant
name starting with an underscore which is a valid character for infix
operators too (i.e. "-_pi").
* Issue 3463353: Callback functions are called twice during the first call to eval.
* Issue 3447007: GetUsedVar unnecessaryly executes callback functions.
Rev 2.1.0: 19.11.2011
---------------------
New feature:
* Function atan2 added
Bugfixes:
* Issue 3438380: Changed behaviour of tellg with GCC >4.6 led to failures
in value detection callbacks.
* Issue 3438715: only "double" is a valid MUP_BASETYPE
MUP_BASETYPE can now be any of:
float,
double,
long double,
short,
unsigned short,
unsigned int,
long,
unsigned long.
Previousely only floating point types were allowed.
Using "int" is still not allowed!
* Compiler issues with GCC 4.6 fixed
* Custom value recognition callbacks added with AddValIdent had lower
priority than built in functions. This was causing problems with
hex value recognition since detection of non hex values had priority
over the detection of hex values. The "0" in the hex prefix "0x" would
be read as a separate non-hex number leaving the rest of the expression
unparseable.
Rev 2.0.0: 04.09.2011
---------------------
This release introduces a new version numbering scheme in order to make
future changes in the ABI apparent to users of the library. The number is
now based on the SONAME property as used by GNU/Linux.
Changes:
* Beginning with this version all version numbers will be SONAME compliant
* Project files for MSVC2010 added
* Project files for MSVC2003 removed
* Bytecode parsing engine cleaned up and rewritten
* Retrieving all results of expressions made up of comma separate
subexpressions is now possible with a new Eval overload.
* Callback functions with fixed number of arguments can now have up to 10
Parameters (previous limit was 5)
New features:
* ternary if-then-else operator added (C++ like; "(...) ? ... : ..." )
* new intrinsic binary operators: "&&", "||" (logical and, or)
* A new bulkmode allows submitting large arrays as variables to compute large
numbers of expressions with a single call. This can drastically improve
parsing performance when interfacing the library from managed languages like
C#. (It doesn't bring any performance benefit for C++ users though...)
Removed features:
* intrinsic "and", "or" and "xor" operators have been removed. I'd like to let
users the freedom of defining them on their own versions (either as logical or bitwise
operators).
* Implementation for complex numbers removed. This was merely a hack. If you
need complex numbers try muParserX which provides native support for them.
(see: http://beltoforion.de/muparserx/math_expression_parser_en.html)
Bugfixes:
* User defined operators could collide with built in operators that entirely
contained their identifier. i.e. user defined "&" would not work with the built
in "&&" operator since the user defined operator was detected with a higher
priority resulting in a syntax error.
* Detection of unknown variables did not work properly in case a postfix operator
was defined which was part of the undefined variable.
i.e. If a postfix operator "m" was defined expressions like "multi*1.0" did
not detect "multi" as an undefined variable.
(Reference: http://sourceforge.net/tracker/index.php?func=detail&aid=3343891&group_id=137191&atid=737979)
* Postfix operators sharing the first few characters were causing bogus parsing exception.
(Reference: https://sourceforge.net/tracker/?func=detail&aid=3358571&group_id=137191&atid=737979)
Rev 1.34: 04.09.2010
--------------------
Changes:
* The prefix needed for parsing hex values is now "0x" and no longer "$".
* AddValIdent reintroduced into the DLL interface
New features:
* The associativity of binary operators can now be changed. The pow operator
is now right associative. (This is what Mathematica is using)
* Seperator can now be used outside of functions. This allows compound
expressions like:
"a=10,b=20,c=a*b" The last "argument" will be taken as the return value
Bugfixes:
* The copy constructor did not copy binary operator definitions. Those were lost
in the copied parser instance.
* Mixing special characters and alphabetic characters in binary operator names
led to inconsistent parsing behaviour when parsing expressions like "a ++ b"
and "a++b" when "++" is defined as a binary operator. Binary operators must
now consist entirely of special characters or of alphabetic ones.
(original bug report: https://sourceforge.net/projects/muparser/forums/forum/462843/topic/3696881/index/page/1)
* User defined operators were not exactly handled like built in operators. This
led to inconsistencies in expression evaluation when using them. The results
differed due to slightly different precedence rules.
* Using empty string arguments ("") would cause a crash of muParser
Rev 1.32: 29.01.2010
--------------------
Changes:
* "example3" renamed to "example2"
* Project/Makefiles files are now provided for:
- msvc2003
- msvc2005
- msvc2008
- watcom (makefile)
- mingw (makefile)
- bcc (makefile)
* Project files for borland cpp builder were removed
New features:
* Added function returning muparsers version number
* Added function for resetting the locale
Bugfixes:
* Changes example1 in order to fix issues with irritating memory leak reports.
Added conditional code for memory leak detection with MSVC in example1.
(see: http://www.codeproject.com/KB/recipes/FastMathParser.aspx?msg=3286367#xx3286367xx)
* Fixed some warnings for gcc
Rev 1.31cp: 15.01.2010 (Maintainance release for CodeProject)
----------------------
Changes:
* Archive structure changed
* C# wrapper added
* Fixed issued that prevented compiling with VS2010 Beta2
Rev 1.30: 09.06.2008
--------------------
Changes:
* Epsilon of the numerical differentiation algorithm changed to allow greater accuracy.
New features:
* Setting thousands separator and decimal separator is now possible
Bugfixes:
* The dll interface did not provide a callback for functions without any arguments.
Rev 1.29: Januar 2008
---------------------
Unrelease Version available only via SVN.
Rev 1.28: 02. July, 2007
---------------------------
Library changes:
* Interface for the dynamic library changed and extended to create an interface
using pure C functions only.
* mupInit() removed
Build system:
* MSVC7 Project files removed in favor of MSVC8
Bugfixes:
* The dynamic library did not build on other systems than linux due to a misplaced
preprocessor definition. This is fixed now.
Rev 1.27:
---------------------------
Build system:
* Modified build\ directory layout introducing some subfolders
for the various IDE supported
* Project files for BCB and MSVC7 added
* Switched to use bakefile 0.2.1 which now correctly creates the
"make uninstall" target for autoconf's Makefile.in
* Now the library debug builds are named "muparserd" instead of "muparser"
to allow multiple mixed release/debug builds to coexist; so e.g. on Windows
when building with DEBUG=1, you'll get "muparserd.lib" instead of "muparser.lib"
New Features:
* Factory functions can now take a user defined pointer
* String functions can now be used with up to two additional
double parameters
* Support for UNICODE character types added
* Infix operator priority can now be changed by the user
Bugfixes:
* An internal error was raised when evaluating an empty
expressions
* The error message raised in case of name collisions between
implicitely defined variables and postfix operators did contain
misleading data.
Rev 1.26: (unofficial release)
------------------------------
New Features:
* Unary operator precedence can now be changed by the user.
Rev 1.25: 5. February, 2006
---------------------------
Build system: (special thanks to Francesco Montorsi for implementing it!)
* created a bakefile-based build system which adds support for the following win32 compilers:
-> MS visual C++ (6 and .NET)
-> BorlandC++ (5 or greater)
-> Mingw32 (tested with gcc 3.2)
-> Watcom (not tested)
and for GCC on Unix (using a standard autoconf's configure script).
Compatibility improvements:
* fixed some small warnings when using -Wall with GCC on Unix
* added inclusion guards for win32-specific portions of code
* added fixes that remove compiler warnings on Intel C++ and the Solaris C++ compiler.
Rev 1.24: 29. October, 2005
---------------------------
Changes:
Compatibility improvements:
* parser now works on 64 bit compilers
* (bytecode base datatype can now be changed freely)
Rev 1.23: 19. October, 2005
---------------------------
Changes:
Bugfixes:
* Variable factory examples in Example1.cpp and Example3.cpp contained a subtle bug.
New features:
* Added a MSVC6 project file and introduced muParserFixes.h in order to make it compile with MSVC6
Rev 1.22: October, 2005
-----------------------
Release notes:
All features of Version 1.22 are similar to Version 1.21. Version 1.22 fixes a compilation issue with
gcc 4.0. In order to fix this issue I rewrote part of the library to remove some unnecessary templates.
This should make the code cleaner. The Borland Project files were removed. If you want to use it
with Borland either use the dll version or create your own project files. I can't support it since I don't
have this compiler at hand.
Changes:
Project Changes:
* Borland project files removed
(The code should still compile with BCB but I cant provide you with project files)
Internal Changes:
* unnecessary template files have been removed:
- new files: muParserError.cpp, muParserTokenReader.cpp, muParserCallback.cpp
- removed Files: muIParserTypes.h
Rev 1.2 / 1.21: April, 2005
---------------------------
Release Notes:
First of all the interface has changed so this version is not backwards compatible.
After receiving a couple of questions about it, this version features support for
user defined binary operators. Consequently the built in operators can now be
turned off, thus you can deactivate them and write complete customized parser
subclasses that only contain the functionality you want. Another new feature is
the introduction of callback functions taking string arguments, implicit
generation of variables and the Assignement operator.
Functionality
* New built in operator: xor; Logical xor.
* New built in operator: Assignement operator; Defining variables in terms of
other variables/constants
* New feature: Strings as arguments for callback functions
* New feature: User defined binary operators
* New feature: ParserInt a class with a sample implementation for
integer numbers.
* New feature: Callbacks to value regognition functions.
* Removed: all predefined postfix operators have been removed.
* New project file: Now comes with a ready to use windows DLL.
* New project file: Makefile for cygwin now included.
* New example: Example3 shows usage of the DLL.
Interface changes
* New member function: DefineOprt For adding user defined binary operators.
* New member function: EnableBuiltInOprt(bool) Enables/Disables built in
binary operators.
* New member function: AddValIdent(...) to add callbacks for custom value
recognition functions.
* Removed: SetVar(), SetConst().
* Renamed: Most interface functions have been renamed
* Changed: The type for multiargument callbacks multfun_type has changed.
It no longer takes a std::vector as input.
Internal changes
* new class muParserTokenReader.h encapsulates the token identification
and token assignement.
* Internal handling of function callbacks unified as a result the performance
of the bytecode evaluation increased.
Rev 1.10 : December 30, 2004
----------------------------
Release Notes:
This version does not contain major new feature compared to V1.07 but its internal structure has
changed significantly. The String parsing routine is slower than the one of V1.07 but bytecode
parsing is equally fast. On the other hand the error messages of V1.09 are more flexible and you
can change its value datatype. It should work on 64-bit systems. For this reason I supply both
versions for download. If you use V1.07 and are happy with it there is no need for updating
your version.
* New example program: Archive now contains two demo programs: One for standard C++ and one for
managed C++.
* New member function: RemoveVar(...) can be used for removing a single variable from the internal
storage.
* New member function: GetVar() can be used for querying the variable names and pointers of all
variables defined in the parser.
* New member function: GetConst() can be used for querying all defined constants and their values.
* New member function: GetFunDef() can be used for querying all defined functions and the number of
arguments they expect.
* Internal structure changed; hanging base datatype at compile time is now possible.
* Bugfix: Postfix operator parsing could fail in certain cases; This has been fixed now.
* Bugfix: Variable names must will now be tested if they conflict with constant or function names.
* Internal change: Removed most dependencies from the C-string libraries.
* Internal change: Bytecode is now stored in a separate class: ParserByteCode.h
* Internal change: GetUsedVar() does no longer require that variables are defined at time of call.
* Internal change: Error treatment changed. ParserException is no longer derived from
std::runtime_error; Internal treatment of Error messages changed.
* New functions in Parser interface: ValidNameChars(), ValidOprtChars() and ValidPrefixOprtChars()
they are used for defining the charset allowed for variable-, operator- and
function names.
Rev 1.09 : November 20, 2004
----------------------------
* New member function: RemoveVar(...) can be used for removing a single variable from the internal
storage.
* Internal structure changed; changing base datatype at compile time is now possible.
* Bug fix: Postfix operator parsing could fail in certain cases; This has been fixed now.
* Internal change: Removed most dependencies from the C-string libraries.
* Internal change: Bytecode is now stored in a seperate class: ParserByteCode.h.
* Internal change: GetUsedVar() does no longer require that variables are defined at time of call.
* Internal change: Error treatment changed. ParserException is no longer derived from
std::runtime_error; Internal treatment of Error messages changed.
* New functions in Parser interface; ValidNameChars(), ValidOprtChars() and ValidPrefixOprtChars()
they are used for defining the charset allowed for variable-, operator- and function names.
Rev 1.08 : November, 2004
-------------------------
* unpublished; experimental template version with respect to data type and underlying string
type (string <-> widestring). The idea was dropped...
Rev 1.07 : September 4 2004
---------------------------
* Improved portability; Changes to make life for MSVC 6 user easier, there are probably still some
issues left.
* Improved portability; Changes in order to allow compiling on BCB.
* New function; value_type Diff(value_type *a_Var, value_type a_fPos) 4th order Differentiation with
respect to a certain variable; added in muParser.h.
Rev 1.06 : August 20 2004
-------------------------
* Volatile functions added; All overloaded AddFun(...) functions can now take a third parameter
indicating that the function can not be optimized.
* Internal changes: muParserStack.h simplified; refactorings
* Parser is now distributed under the MIT License; all comments changed accordingly.
Rev 1.05 : August 20 2004
-------------------------
* Variable/constant names will now be checked for invalid characters.
* Querying the names of all variables used in an expression is now possible; new function: GetUsedVar().
* Disabling bytecode parsing is now possible; new function: EnableByteCode(bool bStat).
* Predefined functions with variable number of arguments added: sum, avg, min, max.
* Unary prefix operators added; new functions: AddPrefixOp(...), ClearPrefixOp().
* Postfix operator interface names changed; new function names: AddPostfixOp(...), ClearPostfixOp().
* Hardcoded sign operators removed in favor of prefix operators; bytecode format changed accordingly.
* Internal changes: static array removed in Command code calculation routine; misc. changes.
Rev 1.04 : August 16 2004
-------------------------
* Support for functions with variable number of arguments added.
* Internal structure changed; new: ParserBase.h, ParserBase.cpp; removed: ParserException.h;
changed: Parser.h, Parser.cpp.
* Bug in the bytecode calculation function fixed (affected the unary minus operator).
* Optimizer can be deactivated; new function: EnableOptimizer(bool bStat).
Rev 1.03 : August 10 2004
-------------------------
* Support for user-defined unary postfix operators added; new functions: AddPostOp(), InitPostOp(),
ClearPostOp().
* Minor changes to the bytecode parsing routine.
* User defined functions can now have up to four parameters.
* Performance optimized: simple formula optimization added; (precalculation of constant parts of the
expression).
* Bug fixes: Multi-arg function parameters, constant name lookup and unary minus did not work properly.
Rev 1.02 : July 30 2004
-----------------------
* Support for user defined constants added; new functions: InitConst(), AddConst(), SetConst(),
ClearConst().
* Single variables can now be added using AddVar(); you have now the choice of adding them either
one by one or all at the same time using SetVar(const varmap_type &a_vVar).
* Internal handling of variables changed, is now similar to function handling.
* Virtual destructor added; InitFun(), InitConst() are now virtual too thus making it possible to
derive new parsers with a modified set of default functions and constants.
* Support for user defined functions with 2 or 3 parameters added; bytecode format changed to hold
function parameter count.
Rev 1.01 : July 23 2004
-----------------------
* Support for user defined functions has been added; new functions: AddFun(), ClearFun(),
InitFunctions().
* Built in constants have been removed; the parser contained undocumented built in
constants pi, e.
There was the possibility of name conflicts with user defined variables.
* Setting multiple variables with SetVar can now be done with a map of names and pointers as the only
argument. For this reason, a new type Parser::varmap_type was added. The old version that took 3
arguments (array of names, array of pointers, and array length) is now marked as deprecated.
* The names of logarithm functions have changed. The new names are: log2 for base 2, log10 or log for
base 10, and ln for base e.
Rev 1.00 : July 21 2004
-----------------------
* Initial release

View file

@ -1,133 +0,0 @@
#######################################################################
# #
# #
# __________ #
# _____ __ __\______ \_____ _______ ______ ____ _______ #
# / \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \ #
# | Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/ #
# |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| #
# \/ \/ \/ \/ #
# Fast math parser Library #
# #
# Copyright (C) 2012 Ingo Berg #
# #
# Web: muparser.beltoforion.de #
# e-mail: muparser@beltoforion.de #
# #
# #
#######################################################################
Contents
========
1. Installation on win32
2. Installation on unix
2.1 Other miscellaneous info Unix-specific
3. Where to ask for help
1. Installation on win32
========================
muParser supports various win32 command-line compilers:
-> mingw
-> watcom
-> microsoft CL
and provides also the project files for MSVC6 IDE.
In order to compile muParser from makefiles, open an MSDOS
prompt and then move to the muParser/build directory and
type:
mingw32-make -fmakefile.mingw for mingw
nmake -fmakefile.vc for msvc
make -fmakefile.bcc for borland
wmake -fmakefile.wat for watcom
All makefiles supports the following options:
# Set to 1 to build debug version [0,1]
# 0 - Release
# 1 - Debug
DEBUG = 0
# Set to 1 to build shared (DLL) version [0,1]
# 0 - Static
# 1 - DLL
SHARED = 0
# Set to 1 to compile samples [0,1]
SAMPLES = 1
The muParser library is created in the 'lib' folder and the sample
binaries are created in samples\example1 or samples\example2.
NOTE: samples\example1 can be compiled *only* when building
muParser as a STATIC library (SHARED=0).
samples\example2 can be compiled *only* when building
muParser as a SHARED library (SHARED=1).
2. Installation on Unix/Linux
=============================
muParser can be installed just extracting the sources somewhere
and then, from a terminal, typing:
cd [path to muParser]
./configure [--enable-shared=yes/no] [--enable-samples=yes/no]
[--enable-debug=yes/no]
make
[sudo*] make install
[sudo*] ldconfig
cd samples/example1
./example1
* = this command must be executed with root permissions and thus
you have to use 'sudo' or just 'su' to gain root access.
Note that installation and ldconfig are not strictly required unless
you built in shared mode.
The "make" step will create the muParser library in 'lib' and the
sample binary in samples/example1.
The samples/example2 is win32-specific and thus won't be built.
2.1 Other miscellaneous info Unix-specific
==========================================
If you don't like to have your muParser folder filled by temporary
files created by GCC, then you can do the following:
mkdir mybuild && cd mybuild && ../configure && make
to put all object files in the "mybuild" directory.
If you want to use muParser library in your programs, you can use
the pkg-config program (this works only if muParser was installed
with 'make install' !). The commands:
pkg-config muparser --cflags
pkg-config muparser --libs
will return all useful info you need to build your programs against
muParser !
3. Where to ask for help
========================
If you find problems with either compilation, installation or usage
of muParser, then you can ask in the muParser forum at:
https://sourceforge.net/forum/forum.php?forum_id=462843
For more info about muParser, visit:
http://sourceforge.net/projects/muparser/
http://muparser.sourceforge.net

View file

@ -1,35 +0,0 @@
#######################################################################
# #
# #
# __________ #
# _____ __ __\______ \_____ _______ ______ ____ _______ #
# / \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \ #
# | Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/ #
# |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| #
# \/ \/ \/ \/ #
# Fast math parser Library #
# #
# Copyright (C) 2011 Ingo Berg #
# #
# Web: muparser.beltoforion.de #
# e-mail: muparser@beltoforion.de #
# #
# #
#######################################################################
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -1,286 +0,0 @@
# =========================================================================
# This makefile was generated by
# Bakefile 0.2.9 (http://www.bakefile.org)
# Do not modify, all changes will be overwritten!
# =========================================================================
@MAKE_SET@
prefix = @prefix@
exec_prefix = @exec_prefix@
datarootdir = @datarootdir@
INSTALL = @INSTALL@
SHARED_LD_CXX = @SHARED_LD_CXX@
LIBEXT = @LIBEXT@
LIBPREFIX = @LIBPREFIX@
SO_SUFFIX = @SO_SUFFIX@
DLLIMP_SUFFIX = @DLLIMP_SUFFIX@
EXEEXT = @EXEEXT@
LN_S = @LN_S@
SETFILE = @SETFILE@
PIC_FLAG = @PIC_FLAG@
SONAME_FLAG = @SONAME_FLAG@
STRIP = @STRIP@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_DIR = @INSTALL_DIR@
BK_DEPS = @BK_DEPS@
srcdir = @srcdir@
top_builddir = @top_builddir@
libdir = @libdir@
DLLPREFIX = @DLLPREFIX@
LIBS = @LIBS@
AR = @AR@
AROPTIONS = @AROPTIONS@
RANLIB = @RANLIB@
CXX = @CXX@
CXXFLAGS = @CXXFLAGS@
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
### Variables: ###
DESTDIR =
MUPARSER_LIB_CXXFLAGS = $(____DEBUG) $(____SHARED) $(____SHARED_0) \
-I$(srcdir)/include $(CPPFLAGS) $(CXXFLAGS) -std=c++11
MUPARSER_LIB_OBJECTS = \
muParser_lib_muParser.o \
muParser_lib_muParserBase.o \
muParser_lib_muParserBytecode.o \
muParser_lib_muParserCallback.o \
muParser_lib_muParserError.o \
muParser_lib_muParserInt.o \
muParser_lib_muParserTest.o \
muParser_lib_muParserTokenReader.o
MUPARSER_LIB_HEADERS = \
include/muParser.h \
include/muParserBase.h \
include/muParserBytecode.h \
include/muParserCallback.h \
include/muParserDef.h \
include/muParserInt.h \
include/muParserTest.h \
include/muParserToken.h \
include/muParserTokenReader.h
EXAMPLE1_CXXFLAGS = $(____DEBUG) -I$(srcdir)/include $(CPPFLAGS) $(CXXFLAGS) -std=c++11
EXAMPLE1_OBJECTS = \
example1_example1.o
### Conditionally set variables: ###
@COND_DEPS_TRACKING_0@CXXC = $(CXX)
@COND_DEPS_TRACKING_1@CXXC = $(BK_DEPS) $(CXX)
@COND_DEBUG_0@DEBUG_BUILD_POSTFIX =
@COND_DEBUG_1@DEBUG_BUILD_POSTFIX = d
__muParser_lib___depname = $(top_builddir)/lib/$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(LIBEXT)
@COND_SHARED_0@__install_muParser_lib___depname = install_muParser_lib
@COND_SHARED_0@__uninstall_muParser_lib___depname = uninstall_muParser_lib
@COND_SHARED_0@__install_muParser_lib_headers___depname = \
@COND_SHARED_0@ install_muParser_lib_headers
@COND_SHARED_0@__uninstall_muParser_lib_headers___depname = \
@COND_SHARED_0@ uninstall_muParser_lib_headers
@COND_SHARED_1@__install_muParser_dll___depname = install_muParser_dll
@COND_SHARED_1@__uninstall_muParser_dll___depname = uninstall_muParser_dll
COND_PLATFORM_MACOSX_1___muParser_dll___macinstnamecmd = -install_name \
$(libdir)/$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf2)
@COND_PLATFORM_MACOSX_1@__muParser_dll___macinstnamecmd = $(COND_PLATFORM_MACOSX_1___muParser_dll___macinstnamecmd)
@COND_SHARED_1@__install_muParser_dll_headers___depname = \
@COND_SHARED_1@ install_muParser_dll_headers
@COND_SHARED_1@__uninstall_muParser_dll_headers___depname = \
@COND_SHARED_1@ uninstall_muParser_dll_headers
COND_PLATFORM_OS2_1___muParser_dll___importlib = -import \
$(top_builddir)/lib/$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX).$(DLLIMP_SUFFIX)
@COND_PLATFORM_OS2_1@__muParser_dll___importlib = $(COND_PLATFORM_OS2_1___muParser_dll___importlib)
COND_WINDOWS_IMPLIB_1___muParser_dll___importlib = \
-Wl,--out-implib=$(top_builddir)/lib/$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX).$(DLLIMP_SUFFIX)
@COND_WINDOWS_IMPLIB_1@__muParser_dll___importlib = $(COND_WINDOWS_IMPLIB_1___muParser_dll___importlib)
@COND_PLATFORM_MACOSX_0_USE_SOVERSION_1@__muParser_dll___targetsuf2 \
@COND_PLATFORM_MACOSX_0_USE_SOVERSION_1@ = .$(SO_SUFFIX).2
@COND_PLATFORM_MACOSX_1_USE_SOVERSION_1@__muParser_dll___targetsuf2 \
@COND_PLATFORM_MACOSX_1_USE_SOVERSION_1@ = .2.$(SO_SUFFIX)
@COND_USE_SOVERSION_0@__muParser_dll___targetsuf2 = .$(SO_SUFFIX)
@COND_PLATFORM_MACOSX_0_USE_SOVERCYGWIN_0_USE_SOVERSION_1@__muParser_dll___targetsuf3 \
@COND_PLATFORM_MACOSX_0_USE_SOVERCYGWIN_0_USE_SOVERSION_1@ = \
@COND_PLATFORM_MACOSX_0_USE_SOVERCYGWIN_0_USE_SOVERSION_1@ .$(SO_SUFFIX).2.2.4
@COND_PLATFORM_MACOSX_1_USE_SOVERSION_1@__muParser_dll___targetsuf3 \
@COND_PLATFORM_MACOSX_1_USE_SOVERSION_1@ = .2.2.4.$(SO_SUFFIX)
@COND_USE_SOVERSION_1_USE_SOVERSOLARIS_1@__muParser_dll___targetsuf3 \
@COND_USE_SOVERSION_1_USE_SOVERSOLARIS_1@ = .$(SO_SUFFIX).2
@COND_USE_SOVERCYGWIN_1_USE_SOVERSION_1@__muParser_dll___targetsuf3 \
@COND_USE_SOVERCYGWIN_1_USE_SOVERSION_1@ = -2.$(SO_SUFFIX)
@COND_USE_SOVERSION_0@__muParser_dll___targetsuf3 = .$(SO_SUFFIX)
COND_USE_SOVERLINUX_1___muParser_dll___soname_flags = \
$(SONAME_FLAG)$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf2)
@COND_USE_SOVERLINUX_1@__muParser_dll___soname_flags = $(COND_USE_SOVERLINUX_1___muParser_dll___soname_flags)
COND_USE_SOVERSOLARIS_1___muParser_dll___soname_flags = \
$(SONAME_FLAG)$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf3)
@COND_USE_SOVERSOLARIS_1@__muParser_dll___soname_flags = $(COND_USE_SOVERSOLARIS_1___muParser_dll___soname_flags)
COND_USE_SOTWOSYMLINKS_1___muParser_dll___so_symlinks_cmd = (cd \
$(top_builddir)/lib/; rm -f \
$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX).$(DLLIMP_SUFFIX) \
$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf2); \
$(LN_S) \
$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf3) \
$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf2); \
$(LN_S) \
$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf2) \
$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX).$(DLLIMP_SUFFIX))
@COND_USE_SOTWOSYMLINKS_1@__muParser_dll___so_symlinks_cmd = $(COND_USE_SOTWOSYMLINKS_1___muParser_dll___so_symlinks_cmd)
COND_USE_SOVERSOLARIS_1___muParser_dll___so_symlinks_cmd = (cd \
$(top_builddir)/lib/; rm -f \
$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX).$(DLLIMP_SUFFIX); $(LN_S) \
$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf3) \
$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX).$(DLLIMP_SUFFIX))
@COND_USE_SOVERSOLARIS_1@__muParser_dll___so_symlinks_cmd = $(COND_USE_SOVERSOLARIS_1___muParser_dll___so_symlinks_cmd)
COND_USE_SOTWOSYMLINKS_1___muParser_dll___so_symlinks_inst_cmd = rm -f \
$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX).$(DLLIMP_SUFFIX) \
$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf2); \
$(LN_S) \
$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf3) \
$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf2); \
$(LN_S) \
$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf2) \
$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX).$(DLLIMP_SUFFIX)
@COND_USE_SOTWOSYMLINKS_1@__muParser_dll___so_symlinks_inst_cmd = $(COND_USE_SOTWOSYMLINKS_1___muParser_dll___so_symlinks_inst_cmd)
COND_USE_SOVERSOLARIS_1___muParser_dll___so_symlinks_inst_cmd = rm -f \
$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX).$(DLLIMP_SUFFIX); $(LN_S) \
$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf3) \
$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX).$(DLLIMP_SUFFIX);
@COND_USE_SOVERSOLARIS_1@__muParser_dll___so_symlinks_inst_cmd = $(COND_USE_SOVERSOLARIS_1___muParser_dll___so_symlinks_inst_cmd)
COND_USE_SOTWOSYMLINKS_1___muParser_dll___so_symlinks_uninst_cmd = rm -f \
$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf2) \
$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX).$(DLLIMP_SUFFIX)
@COND_USE_SOTWOSYMLINKS_1@__muParser_dll___so_symlinks_uninst_cmd = $(COND_USE_SOTWOSYMLINKS_1___muParser_dll___so_symlinks_uninst_cmd)
@COND_USE_SOVERSOLARIS_1@__muParser_dll___so_symlinks_uninst_cmd \
@COND_USE_SOVERSOLARIS_1@ = rm -f \
@COND_USE_SOVERSOLARIS_1@ $(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX).$(DLLIMP_SUFFIX)
@COND_PLATFORM_MACOSX_1@__muParser_dll___macver = \
@COND_PLATFORM_MACOSX_1@ -compatibility_version 1 -current_version 1
__example1___depname = $(top_builddir)/samples/example1/example1$(EXEEXT)
@COND_PLATFORM_MAC_0@__example1___mac_setfilecmd = @true
@COND_PLATFORM_MAC_1@__example1___mac_setfilecmd = \
@COND_PLATFORM_MAC_1@ $(SETFILE) -t APPL \
@COND_PLATFORM_MAC_1@ $(top_builddir)/samples/example1/example1$(EXEEXT)
@COND_SHARED_0@____SHARED =
@COND_SHARED_1@____SHARED = -DMUPARSER_DLL
@COND_SHARED_0@____SHARED_0 =
@COND_SHARED_1@____SHARED_0 = -DMUPARSERLIB_EXPORTS
@COND_DEBUG_0@____DEBUG =
@COND_DEBUG_1@____DEBUG =
### Targets: ###
all: $(__muParser_lib___depname) $(__example1___depname)
install: $(__install_muParser_lib___depname) $(__install_muParser_lib_headers___depname) $(__install_muParser_dll___depname) $(__install_muParser_dll_headers___depname)
$(INSTALL_DIR) $(DESTDIR)$(libdir)/pkgconfig
$(INSTALL_DATA) build/autoconf/muparser.pc $(DESTDIR)$(libdir)/pkgconfig
uninstall: $(__uninstall_muParser_lib___depname) $(__uninstall_muParser_lib_headers___depname) $(__uninstall_muParser_dll___depname) $(__uninstall_muParser_dll_headers___depname)
install-strip: install
$(STRIP) $(DESTDIR)$(libdir)/$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf3)
clean:
rm -rf ./.deps ./.pch
rm -f ./*.o
rm -f $(top_builddir)/lib/$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(LIBEXT)
rm -f $(top_builddir)/lib/$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf3)
rm -f $(top_builddir)/lib/$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX).$(DLLIMP_SUFFIX)
rm -f $(top_builddir)/lib/$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX).$(DLLIMP_SUFFIX) $(top_builddir)/lib/$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf2)
rm -f $(top_builddir)/samples/example1/example1$(EXEEXT)
distclean: clean
rm -f config.cache config.log config.status bk-deps bk-make-pch shared-ld-sh Makefile
rm -f build/autoconf/muparser.pc
@COND_SHARED_0@$(top_builddir)/lib/$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(LIBEXT): $(MUPARSER_LIB_OBJECTS)
@COND_SHARED_0@ rm -f $@
@COND_SHARED_0@ $(AR) $(AROPTIONS) $@ $(MUPARSER_LIB_OBJECTS)
@COND_SHARED_0@ $(RANLIB) $@
@COND_SHARED_0@install_muParser_lib: $(__muParser_lib___depname)
@COND_SHARED_0@ $(INSTALL_DIR) $(DESTDIR)$(libdir)
@COND_SHARED_0@ $(INSTALL_DATA) $(top_builddir)/lib/$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(LIBEXT) $(DESTDIR)$(libdir)
@COND_SHARED_0@uninstall_muParser_lib:
@COND_SHARED_0@ rm -f $(DESTDIR)$(libdir)/$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(LIBEXT)
@COND_SHARED_0@install_muParser_lib_headers:
@COND_SHARED_0@ $(INSTALL_DIR) $(DESTDIR)$(prefix)
@COND_SHARED_0@ for f in $(MUPARSER_LIB_HEADERS); do \
@COND_SHARED_0@ if test ! -d $(DESTDIR)$(prefix)/`dirname $$f` ; then \
@COND_SHARED_0@ $(INSTALL_DIR) $(DESTDIR)$(prefix)/`dirname $$f`; \
@COND_SHARED_0@ fi; \
@COND_SHARED_0@ $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(prefix)/$$f; \
@COND_SHARED_0@ done
@COND_SHARED_0@uninstall_muParser_lib_headers:
@COND_SHARED_0@ for f in $(MUPARSER_LIB_HEADERS); do \
@COND_SHARED_0@ rm -f $(DESTDIR)$(prefix)/$$f; \
@COND_SHARED_0@ done
@COND_SHARED_1@
@COND_SHARED_1@ $(__muParser_dll___so_symlinks_cmd)
@COND_SHARED_1@ $(INSTALL_DIR) $(DESTDIR)$(libdir)
@COND_SHARED_1@ $(INSTALL_DATA) $(top_builddir)/lib/$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX).$(DLLIMP_SUFFIX) $(DESTDIR)$(libdir)
@COND_SHARED_1@ $(INSTALL_PROGRAM) $(top_builddir)/lib/$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf3) $(DESTDIR)$(libdir)
@COND_SHARED_1@ (cd $(DESTDIR)$(libdir) ; $(__muParser_dll___so_symlinks_inst_cmd))
@COND_SHARED_1@uninstall_muParser_dll:
@COND_SHARED_1@ rm -f $(DESTDIR)$(libdir)/$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX).$(DLLIMP_SUFFIX)
@COND_SHARED_1@ rm -f $(DESTDIR)$(libdir)/$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf3)
@COND_SHARED_1@ (cd $(DESTDIR)$(libdir) ; $(__muParser_dll___so_symlinks_uninst_cmd))
@COND_SAMPLES_1@$(top_builddir)/samples/example1/example1$(EXEEXT): $(EXAMPLE1_OBJECTS) $(__muParser_lib___depname)
@COND_SAMPLES_1@ $(CXX) -o $@ $(EXAMPLE1_OBJECTS) -L$(top_builddir)/lib -L$(srcdir)/lib $(LDFLAGS) -lmuparser$(DEBUG_BUILD_POSTFIX) $(LIBS)
@COND_SAMPLES_1@
@COND_SAMPLES_1@ $(__example1___mac_setfilecmd)
lib: $(__muParser_lib___depname)
samples: $(__example1___depname)
documentation:
( cd $(srcdir)/docs && doxygen )
muParser_lib_muParser.o: $(srcdir)/src/muParser.cpp
$(CXXC) -c -o $@ $(MUPARSER_LIB_CXXFLAGS) $(srcdir)/src/muParser.cpp
muParser_lib_muParserBase.o: $(srcdir)/src/muParserBase.cpp
$(CXXC) -c -o $@ $(MUPARSER_LIB_CXXFLAGS) $(srcdir)/src/muParserBase.cpp
muParser_lib_muParserBytecode.o: $(srcdir)/src/muParserBytecode.cpp
$(CXXC) -c -o $@ $(MUPARSER_LIB_CXXFLAGS) $(srcdir)/src/muParserBytecode.cpp
muParser_lib_muParserCallback.o: $(srcdir)/src/muParserCallback.cpp
$(CXXC) -c -o $@ $(MUPARSER_LIB_CXXFLAGS) $(srcdir)/src/muParserCallback.cpp
muParser_lib_muParserDLL.o: $(srcdir)/src/muParserDLL.cpp
$(CXXC) -c -o $@ $(MUPARSER_LIB_CXXFLAGS) $(srcdir)/src/muParserDLL.cpp
muParser_lib_muParserError.o: $(srcdir)/src/muParserError.cpp
$(CXXC) -c -o $@ $(MUPARSER_LIB_CXXFLAGS) $(srcdir)/src/muParserError.cpp
muParser_lib_muParserInt.o: $(srcdir)/src/muParserInt.cpp
$(CXXC) -c -o $@ $(MUPARSER_LIB_CXXFLAGS) $(srcdir)/src/muParserInt.cpp
muParser_lib_muParserTest.o: $(srcdir)/src/muParserTest.cpp
$(CXXC) -c -o $@ $(MUPARSER_LIB_CXXFLAGS) $(srcdir)/src/muParserTest.cpp
muParser_lib_muParserTokenReader.o: $(srcdir)/src/muParserTokenReader.cpp
$(CXXC) -c -o $@ $(MUPARSER_LIB_CXXFLAGS) $(srcdir)/src/muParserTokenReader.cpp
example1_example1.o: $(srcdir)/samples/example1/example1.cpp
$(CXXC) -c -o $@ $(EXAMPLE1_CXXFLAGS) $(srcdir)/samples/example1/example1.cpp
# Include dependency info, if present:
@IF_GNU_MAKE@-include ./.deps/*.d
.PHONY: all install uninstall clean distclean install_muParser_lib \
uninstall_muParser_lib install_muParser_lib_headers \
uninstall_muParser_lib_headers install_muParser_dll uninstall_muParser_dll \
install_muParser_dll_headers uninstall_muParser_dll_headers lib samples

View file

@ -1,50 +0,0 @@
#!/bin/bash
#
# Author: Francesco Montorsi
# RCS-ID: $Id: acregen.sh 236 2009-11-24 23:12:00Z frm $
# Creation date: 14/9/2005
#
# A simple script to generate the configure script
# Some features of this version:
# - automatic test for aclocal version
# - able to be called from any folder
# (i.e. you can call it typing 'build/autoconf/acregen.sh', not only './acregen.sh')
# called when an old version of aclocal is found
function aclocalold()
{
echo "Your aclocal version is $aclocal_maj.$aclocal_min.$aclocal_rel"
echo "Your automake installation is too old; please install automake >= $aclocal_minimal_maj.$aclocal_minimal_min.$aclocal_minimal_rel"
echo "You can download automake from ftp://sources.redhat.com/pub/automake/"
exit 1
}
# first check if we have an ACLOCAL version recent enough
aclocal_verfull=$(aclocal --version)
aclocal_maj=`echo $aclocal_verfull | sed 's/aclocal (GNU automake) \([0-9]*\).\([0-9]*\).\([0-9]*\).*/\1/'`
aclocal_min=`echo $aclocal_verfull | sed 's/aclocal (GNU automake) \([0-9]*\).\([0-9]*\).\([0-9]*\).*/\2/'`
aclocal_rel=`echo $aclocal_verfull | sed 's/aclocal (GNU automake) \([0-9]*\).\([0-9]*\).\([0-9]*\).*/\3/'`
if [[ "$aclocal_rel" = "" ]]; then aclocal_rel="0"; fi
#echo "Your aclocal version is $aclocal_maj.$aclocal_min.$aclocal_rel" # for debugging
aclocal_minimal_maj=1
aclocal_minimal_min=9
aclocal_minimal_rel=6
majok=$(($aclocal_maj > $aclocal_minimal_maj))
minok=$(($aclocal_maj == $aclocal_minimal_maj && $aclocal_min > $aclocal_minimal_min))
relok=$(($aclocal_maj == $aclocal_minimal_maj && $aclocal_min == $aclocal_minimal_min && \
$aclocal_rel >= $aclocal_minimal_rel))
versionok=$(($majok == 1 || $minok == 1 || $relok == 1))
if [[ "$versionok" = "0" ]]; then aclocalold; fi
# we can safely proceed
me=$(basename $0)
path=${0%%/$me} # path from which the script has been launched
current=$(pwd)
cd $path
aclocal && autoconf && mv configure ../..
cd $current

View file

@ -1,134 +0,0 @@
dnl ### begin block 00_header[muparser.bkl] ###
dnl
dnl This macro was generated by
dnl Bakefile 0.2.9 (http://www.bakefile.org)
dnl Do not modify, all changes will be overwritten!
BAKEFILE_AUTOCONF_INC_M4_VERSION="0.2.9"
dnl ### begin block 20_COND_DEBUG_0[muparser.bkl] ###
COND_DEBUG_0="#"
if test "x$DEBUG" = "x0" ; then
COND_DEBUG_0=""
fi
AC_SUBST(COND_DEBUG_0)
dnl ### begin block 20_COND_DEBUG_1[muparser.bkl] ###
COND_DEBUG_1="#"
if test "x$DEBUG" = "x1" ; then
COND_DEBUG_1=""
fi
AC_SUBST(COND_DEBUG_1)
dnl ### begin block 20_COND_DEPS_TRACKING_0[muparser.bkl] ###
COND_DEPS_TRACKING_0="#"
if test "x$DEPS_TRACKING" = "x0" ; then
COND_DEPS_TRACKING_0=""
fi
AC_SUBST(COND_DEPS_TRACKING_0)
dnl ### begin block 20_COND_DEPS_TRACKING_1[muparser.bkl] ###
COND_DEPS_TRACKING_1="#"
if test "x$DEPS_TRACKING" = "x1" ; then
COND_DEPS_TRACKING_1=""
fi
AC_SUBST(COND_DEPS_TRACKING_1)
dnl ### begin block 20_COND_PLATFORM_MACOSX_0_USE_SOVERCYGWIN_0_USE_SOVERSION_1[muparser.bkl] ###
COND_PLATFORM_MACOSX_0_USE_SOVERCYGWIN_0_USE_SOVERSION_1="#"
if test "x$PLATFORM_MACOSX" = "x0" -a "x$USE_SOVERCYGWIN" = "x0" -a "x$USE_SOVERSION" = "x1" ; then
COND_PLATFORM_MACOSX_0_USE_SOVERCYGWIN_0_USE_SOVERSION_1=""
fi
AC_SUBST(COND_PLATFORM_MACOSX_0_USE_SOVERCYGWIN_0_USE_SOVERSION_1)
dnl ### begin block 20_COND_PLATFORM_MACOSX_0_USE_SOVERSION_1[muparser.bkl] ###
COND_PLATFORM_MACOSX_0_USE_SOVERSION_1="#"
if test "x$PLATFORM_MACOSX" = "x0" -a "x$USE_SOVERSION" = "x1" ; then
COND_PLATFORM_MACOSX_0_USE_SOVERSION_1=""
fi
AC_SUBST(COND_PLATFORM_MACOSX_0_USE_SOVERSION_1)
dnl ### begin block 20_COND_PLATFORM_MACOSX_1[muparser.bkl] ###
COND_PLATFORM_MACOSX_1="#"
if test "x$PLATFORM_MACOSX" = "x1" ; then
COND_PLATFORM_MACOSX_1=""
fi
AC_SUBST(COND_PLATFORM_MACOSX_1)
dnl ### begin block 20_COND_PLATFORM_MACOSX_1_USE_SOVERSION_1[muparser.bkl] ###
COND_PLATFORM_MACOSX_1_USE_SOVERSION_1="#"
if test "x$PLATFORM_MACOSX" = "x1" -a "x$USE_SOVERSION" = "x1" ; then
COND_PLATFORM_MACOSX_1_USE_SOVERSION_1=""
fi
AC_SUBST(COND_PLATFORM_MACOSX_1_USE_SOVERSION_1)
dnl ### begin block 20_COND_PLATFORM_MAC_0[muparser.bkl] ###
COND_PLATFORM_MAC_0="#"
if test "x$PLATFORM_MAC" = "x0" ; then
COND_PLATFORM_MAC_0=""
fi
AC_SUBST(COND_PLATFORM_MAC_0)
dnl ### begin block 20_COND_PLATFORM_MAC_1[muparser.bkl] ###
COND_PLATFORM_MAC_1="#"
if test "x$PLATFORM_MAC" = "x1" ; then
COND_PLATFORM_MAC_1=""
fi
AC_SUBST(COND_PLATFORM_MAC_1)
dnl ### begin block 20_COND_PLATFORM_OS2_1[muparser.bkl] ###
COND_PLATFORM_OS2_1="#"
if test "x$PLATFORM_OS2" = "x1" ; then
COND_PLATFORM_OS2_1=""
fi
AC_SUBST(COND_PLATFORM_OS2_1)
dnl ### begin block 20_COND_SAMPLES_1[muparser.bkl] ###
COND_SAMPLES_1="#"
if test "x$SAMPLES" = "x1" ; then
COND_SAMPLES_1=""
fi
AC_SUBST(COND_SAMPLES_1)
dnl ### begin block 20_COND_SHARED_0[muparser.bkl] ###
COND_SHARED_0="#"
if test "x$SHARED" = "x0" ; then
COND_SHARED_0=""
fi
AC_SUBST(COND_SHARED_0)
dnl ### begin block 20_COND_SHARED_1[muparser.bkl] ###
COND_SHARED_1="#"
if test "x$SHARED" = "x1" ; then
COND_SHARED_1=""
fi
AC_SUBST(COND_SHARED_1)
dnl ### begin block 20_COND_USE_SOTWOSYMLINKS_1[muparser.bkl] ###
COND_USE_SOTWOSYMLINKS_1="#"
if test "x$USE_SOTWOSYMLINKS" = "x1" ; then
COND_USE_SOTWOSYMLINKS_1=""
fi
AC_SUBST(COND_USE_SOTWOSYMLINKS_1)
dnl ### begin block 20_COND_USE_SOVERCYGWIN_1_USE_SOVERSION_1[muparser.bkl] ###
COND_USE_SOVERCYGWIN_1_USE_SOVERSION_1="#"
if test "x$USE_SOVERCYGWIN" = "x1" -a "x$USE_SOVERSION" = "x1" ; then
COND_USE_SOVERCYGWIN_1_USE_SOVERSION_1=""
fi
AC_SUBST(COND_USE_SOVERCYGWIN_1_USE_SOVERSION_1)
dnl ### begin block 20_COND_USE_SOVERLINUX_1[muparser.bkl] ###
COND_USE_SOVERLINUX_1="#"
if test "x$USE_SOVERLINUX" = "x1" ; then
COND_USE_SOVERLINUX_1=""
fi
AC_SUBST(COND_USE_SOVERLINUX_1)
dnl ### begin block 20_COND_USE_SOVERSION_0[muparser.bkl] ###
COND_USE_SOVERSION_0="#"
if test "x$USE_SOVERSION" = "x0" ; then
COND_USE_SOVERSION_0=""
fi
AC_SUBST(COND_USE_SOVERSION_0)
dnl ### begin block 20_COND_USE_SOVERSION_1_USE_SOVERSOLARIS_1[muparser.bkl] ###
COND_USE_SOVERSION_1_USE_SOVERSOLARIS_1="#"
if test "x$USE_SOVERSION" = "x1" -a "x$USE_SOVERSOLARIS" = "x1" ; then
COND_USE_SOVERSION_1_USE_SOVERSOLARIS_1=""
fi
AC_SUBST(COND_USE_SOVERSION_1_USE_SOVERSOLARIS_1)
dnl ### begin block 20_COND_USE_SOVERSOLARIS_1[muparser.bkl] ###
COND_USE_SOVERSOLARIS_1="#"
if test "x$USE_SOVERSOLARIS" = "x1" ; then
COND_USE_SOVERSOLARIS_1=""
fi
AC_SUBST(COND_USE_SOVERSOLARIS_1)
dnl ### begin block 20_COND_WINDOWS_IMPLIB_1[muparser.bkl] ###
COND_WINDOWS_IMPLIB_1="#"
if test "x$WINDOWS_IMPLIB" = "x1" ; then
COND_WINDOWS_IMPLIB_1=""
fi
AC_SUBST(COND_WINDOWS_IMPLIB_1)

View file

@ -1,156 +0,0 @@
dnl ---------------------------------------------------------------------------
dnl Support macros for makefiles generated with Bakefile presets
dnl ---------------------------------------------------------------------------
dnl ---------------------------------------------------------------------------
dnl AM_YESNO_OPTCHECK([name of the boolean variable to set],
dnl [name of the variable with yes/no values],
dnl [name of the --enable/--with option])
dnl
dnl Converts the $3 variable, supposed to contain a yes/no value to a 1/0
dnl boolean variable and saves the result into $1.
dnl Outputs also the standard checking-option message.
dnl Used by the m4 macros of the presets.
dnl ---------------------------------------------------------------------------
AC_DEFUN([AC_BAKEFILE_YESNO_OPTCHECK],
[
AC_MSG_CHECKING([for the $3 option])
if [[ "x$$2" = "xyes" ]]; then
AC_MSG_RESULT([yes])
$1=1
else
AC_MSG_RESULT([no])
$1=0
fi
])
dnl ---------------------------------------------------------------------------
dnl AC_BAKEFILE_UNICODEOPT([default value for the --enable-unicode option])
dnl
dnl Adds the --enable-unicode option to the configure script and sets the
dnl UNICODE=0/1 variable accordingly to the value of the option.
dnl To be used with unicodeopt.bkl preset.
dnl ---------------------------------------------------------------------------
AC_DEFUN([AC_BAKEFILE_UNICODEOPT],
[
default="$1"
if [[ -z "$default" ]]; then
default="no"
fi
AC_ARG_ENABLE([unicode],
AC_HELP_STRING([--enable-unicode], [Builds in Unicode mode]),
[], [enableval="$default"])
AC_BAKEFILE_YESNO_OPTCHECK([UNICODE], [enableval], [--enable-unicode])
])
dnl ---------------------------------------------------------------------------
dnl AC_BAKEFILE_DEBUGOPT([default value for the --enable-debug option])
dnl
dnl Adds the --enable-debug option to the configure script and sets the
dnl DEBUG=0/1 variable accordingly to the value of the option.
dnl To be used with debugopt.bkl preset.
dnl ---------------------------------------------------------------------------
AC_DEFUN([AC_BAKEFILE_DEBUGOPT],
[
default="$1"
if [[ -z "$default" ]]; then
default="no"
fi
AC_ARG_ENABLE([debug],
AC_HELP_STRING([--enable-debug], [Builds in debug mode]),
[], [enableval="$default"])
AC_BAKEFILE_YESNO_OPTCHECK([DEBUG], [enableval], [--enable-debug])
dnl add the optimize/debug flags
if [[ "x$DEBUG" = "x1" ]]; then
dnl NOTE: the -Wundef and -Wno-ctor-dtor-privacy are not enabled automatically by -Wall
dnl NOTE2: the '-Wno-ctor-dtor-privacy' has sense only when compiling C++ source files
dnl and thus we must be careful to add it only to CXXFLAGS and not to CFLAGS
dnl (remember that CPPFLAGS is reserved for both C and C++ compilers while
dnl CFLAGS is intended as flags for C compiler only and CXXFLAGS for C++ only)
my_CXXFLAGS="$my_CXXFLAGS -g -O0 -Wall -Wundef -Wno-ctor-dtor-privacy"
my_CFLAGS="$my_CFLAGS -g -O0 -Wall -Wundef"
else
my_CXXFLAGS="$my_CXXFLAGS -O2"
my_CFLAGS="$my_CFLAGS -O2"
fi
# User-supplied CXXFLAGS must always take precedence.
# This still sucks because using `make CFLAGS=-foobar` kills
# the project-supplied flags again.
CXXFLAGS="$my_CXXFLAGS $CXXFLAGS"
CFLAGS="$my_CFLAGS $CFLAGS"
])
dnl ---------------------------------------------------------------------------
dnl AC_BAKEFILE_SHAREDOPT([default value for the --enable-shared option])
dnl
dnl Adds the --enable-shared option to the configure script and sets the
dnl SHARED=0/1 variable accordingly to the value of the option.
dnl To be used with sharedopt.bkl preset.
dnl ---------------------------------------------------------------------------
AC_DEFUN([AC_BAKEFILE_SHAREDOPT],
[
default="$1"
if [[ -z "$default" ]]; then
default="no"
fi
AC_ARG_ENABLE([shared],
AC_HELP_STRING([--enable-shared], [Builds in shared mode]),
[], [enableval="$default"])
AC_BAKEFILE_YESNO_OPTCHECK([SHARED], [enableval], [--enable-shared])
])
dnl ---------------------------------------------------------------------------
dnl AC_BAKEFILE_SHOW_DEBUGOPT
dnl
dnl Prints a message on stdout about the value of the DEBUG variable.
dnl This macro is useful to show summary messages at the end of the configure scripts.
dnl ---------------------------------------------------------------------------
AC_DEFUN([AC_BAKEFILE_SHOW_DEBUGOPT],
[
if [[ "$DEBUG" = "1" ]]; then
echo " - DEBUG build"
else
echo " - RELEASE build"
fi
])
dnl ---------------------------------------------------------------------------
dnl AC_BAKEFILE_SHOW_SHAREDOPT
dnl
dnl Prints a message on stdout about the value of the SHARED variable.
dnl This macro is useful to show summary messages at the end of the configure scripts.
dnl ---------------------------------------------------------------------------
AC_DEFUN([AC_BAKEFILE_SHOW_SHAREDOPT],
[
if [[ "$SHARED" = "1" ]]; then
echo " - SHARED mode"
else
echo " - STATIC mode"
fi
])
dnl ---------------------------------------------------------------------------
dnl AC_BAKEFILE_SHOW_UNICODEOPT
dnl
dnl Prints a message on stdout about the value of the UNICODE variable.
dnl This macro is useful to show summary messages at the end of the configure scripts.
dnl ---------------------------------------------------------------------------
AC_DEFUN([AC_BAKEFILE_SHOW_UNICODEOPT],
[
if [[ "$UNICODE" = "1" ]]; then
echo " - UNICODE mode"
else
echo " - ANSI mode"
fi
])

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,82 +0,0 @@
# ======================================================================================
# Author: Francesco Montorsi
# RCS-ID: $Id: configure.ac 634 2012-12-22 10:34:32Z ibg $
# ======================================================================================
# NOTE:
# the version of the project must be updated also in docs/Doxyfile !
AC_INIT([muparser], [2.2.4], [muparser@beltoforion.de])
AC_PREREQ([2.57])
AC_CONFIG_AUX_DIR([build/autoconf])
AC_LANG(C++)
# some helpers
m4_include(bakefile-presets.m4)
## CONFIGURE CHECKS
#####################################################################
dnl This allows us to use Bakefile, recognizing the system type
dnl (and sets the AC_CANONICAL_BUILD, AC_CANONICAL_HOST and
dnl AC_CANONICAL_TARGET variables)
AC_CANONICAL_SYSTEM
# We want to inhibit AC_PROG_C* macros adding the default "-g -O2" flags.
# To do so, make sure that the variables are not unset - it is ok if they are
# empty. However, their value MUST be retained, since one may have
# called ./configure CFLAGS=-foobar.
CFLAGS="$CFLAGS"
CPPFLAGS="$CPPFLAGS"
CXXFLAGS="$CXXFLAGS"
dnl Checks for basic programs used to compile/install.
AC_PROG_AWK
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_RANLIB
AC_PROG_CC
AC_PROG_CXX
AC_PROG_CXXCPP
AC_BAKEFILE_DEBUGOPT([no])
AC_BAKEFILE_SHAREDOPT([yes])
AC_ARG_ENABLE([samples],
AC_HELP_STRING([--enable-samples], [Builds the library samples, too]),
[], [enableval="yes"])
AC_BAKEFILE_YESNO_OPTCHECK([SAMPLES], [enableval], [--enable-samples])
dnl Create the output folders in the current build directory
dnl (this handles cases like:
dnl mkdir mybuild && cd mybuild && ../configure && make )
AS_MKDIR_P(lib)
AS_MKDIR_P(samples/example1)
AC_BAKEFILE([m4_include(autoconf_inc.m4)])
AC_CONFIG_FILES([Makefile build/autoconf/muparser.pc])
AC_OUTPUT
## CONFIGURE END MESSAGE
#####################################################################
echo
echo " ----------------------------------------------------------------"
echo " Configuration for $PACKAGE_NAME $PACKAGE_VERSION successfully completed."
echo " Summary of main configuration settings for $PACKAGE_NAME:"
AC_BAKEFILE_SHOW_SHAREDOPT
AC_BAKEFILE_SHOW_DEBUGOPT
if [[ "$SAMPLES" = "1" ]]; then
echo " - SAMPLES enabled"
else
echo " - SAMPLES disabled"
fi
echo " Now, just run make."
echo " ----------------------------------------------------------------"
echo

View file

@ -1,2 +0,0 @@
#!/bin/sh

View file

@ -1,11 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: @PACKAGE_NAME@
Description: Mathematical expressions parser library
Version: @PACKAGE_VERSION@
Requires:
Libs: -L${libdir} -lmuparser
Cflags: -I${includedir}

View file

@ -1,39 +0,0 @@
<?xml version="1.0" ?>
<!-- RCS-ID: $Id: Bakefiles.bkgen 635 2012-12-22 10:58:11Z ibg $ -->
<bakefile-gen xmlns="http://www.bakefile.org/schema/bakefile-gen">
<!-- you probably need to edit only this tag -->
<input>muparser.bkl</input>
<disable-formats>dmars,dmars_smake,cbx_unix,cbuilderx,msevc4prj</disable-formats>
<!-- <add-formats>autoconf,borland,mingw,msvc,watcom,msvs2003prj,msvs2005prj,msvs2008prj</add-formats> -->
<add-formats>autoconf,mingw,msvc</add-formats>
<add-flags formats="mingw">-o ../makefile.mingw</add-flags>
<add-flags formats="msvc">-o ../makefile.vc</add-flags>
<!-- change 20121221: Project files for msvc 2008 and 2010 are managed manually.
msvc 2005, borland and watcom are no longer supported.
<add-flags formats="borland">-o ../makefile.bcc</add-flags>
<add-flags formats="watcom">-o ../makefile.wat</add-flags>
<add-flags formats="msvs2005prj">-o ../msvc2005/muparser.sln</add-flags>
<add-flags formats="msvs2008prj">-o ../msvc2008/muparser.sln</add-flags>
-->
<!-- since it's standard on Unix to have Makefile.in and the configure script in
the root folder of the component to build, we put Makefile.in one directory up... -->
<add-flags formats="autoconf">
-o../../Makefile.in
</add-flags>
<!-- ...anyway, we don't want to fill the component's root with files which are
useless for the user and just make the component looks "messy"; thus all
autoconf files are still kept in build\; only "configure" and "Makefile.in"
will go in the component's root -->
<add-flags formats="autoconf">
-DAUTOCONF_MACROS_FILE=../autoconf/autoconf_inc.m4
</add-flags>
</bakefile-gen>

View file

@ -1,28 +0,0 @@
These are basic instructions for recreating the project files:
Changing the version number:
----------------------------
build/autoconf/configure.ac
Line 9:
AC_INIT ....
Change SO version
-----------------
muparser.bkl / tag <so_version>
Updating the make- and projectfiles:
------------------------------------
Clearing old project and makefiles:
bakefile_gen -c
Remaking Projects and Makefiles:
bakefile_gen
In addition to that automake must be started to create the new configure script:
rm -rf autoconf/autom4te.cache autoconf/aclocal.m4
../autoconf/acregen.sh
!!! IMPORTANT !!!
When building bakefile from the tar.gz archive make sure to
use the option --prefix=/usr wit the config file since its
path will default to /usr/local. This would cause strange errors!

View file

@ -1,160 +0,0 @@
<?xml version="1.0" ?>
<!-- RCS-ID: $Id: muparser.bkl 635 2012-12-22 10:58:11Z ibg $ -->
<makefile>
<requires version="0.2.5"/>
<using module="pkgconfig"/>
<include file="presets/debugopt.bkl"/>
<include file="presets/sharedopt.bkl"/>
<include file="presets/setbuilddir.bkl"/>
<!-- put all object files under the OBJ folder -->
<if cond="FORMAT!='autoconf'">
<set var="BUILDDIR">obj$(DIRSEP)$(BUILDDIR)</set>
</if>
<set var="DEBUG_BUILD_POSTFIX">
<if cond="DEBUG=='0'"></if>
<if cond="DEBUG=='1'">d</if>
</set>
<!-- Sources for this library -->
<!-- ======================== -->
<if cond="FORMAT=='autoconf'">
<!-- Note that since autoconf 2.60 the top_builddir variable does
not ends with '/' anymore... -->
<set var="LIBOUTPATH">$(top_builddir)/lib</set>
<set var="SAMPLEOUTPATH">$(top_builddir)/samples</set>
</if>
<if cond="'msv' in FORMAT">
<!-- match all MSVC visual studio formats -->
<set-srcdir>../..</set-srcdir>
</if>
<if cond="FORMAT in [ 'borland', 'mingw', 'watcom', 'msvc' ]">
<set-srcdir>..</set-srcdir>
</if>
<if cond="FORMAT!='autoconf'">
<set var="LIBOUTPATH">$(SRCDIR)/lib</set>
<set var="SAMPLEOUTPATH">$(SRCDIR)/samples</set>
</if>
<!-- Settings for this library -->
<!-- ========================= -->
<template id="muparser_base" template="debugopt">
<!-- tell Bakefile to define the MUPARSER_DLL symbol when building in shared mode -->
<define>$(substituteFromDict(SHARED, {'1':'MUPARSER_DLL', '0':''}))</define>
<define>$(substituteFromDict(SHARED, {'1':'MUPARSERLIB_EXPORTS', '0':''}))</define>
<if cond="FORMAT!='autoconf'">
<define>_WIN32</define>
</if>
<sources>$(fileList('src/*.cpp'))</sources>
<headers>$(fileList('include/*.h'))</headers>
<dirname>$(LIBOUTPATH)</dirname>
<include>$(SRCDIR)/include</include>
<install-to>$(LIBDIR)</install-to>
<install-headers-to>$(PREFIX)</install-headers-to>
</template>
<lib id="muParser_lib" template="muparser_base" cond="SHARED=='0'">
<libname>muparser$(DEBUG_BUILD_POSTFIX)</libname>
</lib>
<dll id="muParser_dll" template="muparser_base" cond="SHARED=='1'">
<dllname>muparser$(DEBUG_BUILD_POSTFIX)</dllname>
<libname>muparser$(DEBUG_BUILD_POSTFIX)</libname>
<version>2.2</version>
<so_version>2.2.4</so_version>
<mac_version>1</mac_version> <!-- must be > 0 -->
</dll>
<!-- this makes the MSVC6 project files much nicer... -->
<set var="MSVC6PRJ_MERGED_TARGETS">muParser=muParser_lib+muParser_dll</set>
<!-- Installs the PKG-CONFIG file -->
<pkgconfig id="pkgconfig" cond="FORMAT=='autoconf'">
<src>build/autoconf/muparser.pc</src>
</pkgconfig>
<!-- Samples for the library -->
<!-- ======================= -->
<if cond="FORMAT_SUPPORTS_CONDITIONS=='1'">
<option name="SAMPLES">
<values>0,1</values>
<default-value>1</default-value>
<description>Set to 1 to compile samples</description>
</option>
</if>
<if cond="FORMAT_SUPPORTS_CONDITIONS=='0'">
<!-- Avoid to create IDE project files with multiple configurations
which differ only for the SAMPLES=0/1 option! -->
<set var="SAMPLES">1</set>
</if>
<template id="muparser_sample" template="debugopt">
<library>muParser_lib</library>
<include>$(SRCDIR)/include</include>
<lib-path>$(SRCDIR)/lib</lib-path>
</template>
<if cond="FORMAT!='autoconf'">
<exe id="example1" template="muparser_sample" cond="SAMPLES=='1' and SHARED=='0'">
<sources>$(fileList('samples/example1/*.cpp'))</sources>
<dirname>$(SAMPLEOUTPATH)/example1</dirname>
<define>$(substituteFromDict(SHARED, {'1':'USINGDLL', '0':''}))</define>
</exe>
</if>
<if cond="FORMAT=='autoconf'">
<!-- On Unix this sample is always available -->
<exe id="example1" template="muparser_sample" cond="SAMPLES=='1'">
<sources>$(fileList('samples/example1/*.cpp'))</sources>
<dirname>$(SAMPLEOUTPATH)/example1</dirname>
</exe>
</if>
<if cond="FORMAT!='autoconf'">
<!-- This samples is win32-specific (it uses the DLL interface) -->
<exe id="example2" template="muparser_sample" cond="SAMPLES=='1' and SHARED=='1'">
<sources>$(fileList('samples/example2/*.c'))</sources>
<dirname>$(SAMPLEOUTPATH)/example2</dirname>
<define>$(substituteFromDict(SHARED, {'1':'USINGDLL', '0':''}))</define>
</exe>
</if>
<!-- Some helpers for command-line makefiles -->
<!-- ======================================= -->
<phony id="lib">
<depends>muParser_lib</depends>
<depends>muParser_dll</depends>
</phony>
<phony id="samples">
<depends>example1</depends>
<!-- <depends cond="FORMAT in [ 'msvc', 'msvc6prj' ]">example2</depends> -->
<depends cond="FORMAT!='autoconf'">example2</depends>
</phony>
<if cond="FORMAT_SUPPORTS_ACTIONS=='1'">
<action id="documentation">
<command>( cd $(SRCDIR)$(DIRSEP)docs &amp;&amp; doxygen )</command>
</action>
</if>
</makefile>

View file

@ -1,55 +0,0 @@
<?xml version="1.0" ?>
<!-- $Id: debugopt.bkl 40 2006-12-02 15:22:02Z frm $ -->
<!--
Adds the logic for handling a DEBUG=0/1 option, which switches between debug and
release builds.
Usage: use template "debugopt" for your targets:
<include file="presets/debugopt.bkl"/>
<exe id="myapp" template="debugopt">
<sources>myapp.cpp</sources>
</exe>
-->
<makefile>
<set var="DEBUG_DEFAULT" overwrite="0">0</set>
<option name="DEBUG">
<values>0,1</values>
<default-value>$(DEBUG_DEFAULT)</default-value>
<values-description>Release,Debug</values-description>
<description>Set to 1 to build debug version</description>
</option>
<template id="debugopt">
<define>
$(substituteFromDict(DEBUG,{'1':'','0':'NDEBUG'}))
</define>
<optimize>
$(substituteFromDict(DEBUG,{'1':'off','0':'speed'}))
</optimize>
<debug-info>
$(substituteFromDict(DEBUG,{'1':'on','0':'off'}))
</debug-info>
<warnings>
$(substituteFromDict(DEBUG,{'1':'max','0':'no'}))
</warnings>
<debug-runtime-libs>
$(substituteFromDict(DEBUG,{'1':'on','0':'off'}))
</debug-runtime-libs>
</template>
<!-- The DEBUGBUILDPOSTFIX variable is useful to set the BUILDDIR variable
as done in presets/setbuilddir.bkl -->
<set var="DEBUGBUILDPOSTFIX">
<if cond="DEBUG=='0'">rel</if>
<if cond="DEBUG=='1'">dbg</if>
</set>
</makefile>

View file

@ -1,63 +0,0 @@
<?xml version="1.0" ?>
<!-- $Id: setbuilddir.bkl 40 2006-12-02 15:22:02Z frm $ -->
<!--
Adds the logic for setting BUILDDIR in a smart way, checking which other presets have been
included. Include this preset after including all other presets.
Usage:
<include file="presets/sharedopt.bkl"/>
<include file="presets/unicodeopt.bkl"/>
<include file="presets/debugopt.bkl"/>
<include file="presets/setbuilddir.bkl"/>
<lib id="mylib_static" template="debugopt,unicodeopt" cond="SHARED=='0'">
<sources>mylib.cpp</sources>
</lib>
<dll id="mylib_shared" template="debugopt,unicodeopt" cond="SHARED=='1'">
<sources>mylib.cpp</sources>
</dll>
<set var="MSVC6PRJ_MERGED_TARGETS">mylib=mylib_static+mylib_shared</set>
-->
<makefile>
<!--
Setting the BUILDDIR variable using the
SHAREDBUILDPOSTFIX/DEBUGBUILDPOSTFIX/UNICODEBUILDPOSTFIX
variables we will keep separed the intermediate files (objects, compiled resources, exes, libs)
generated using SHARED/DEBUG/UNICODE=0 from those generated using SHARED/DEBUG/UNICODE=1.
Using the same BUILDDIR for these different configurations would force the
user to call a "make clean" (or equivalent) before rebuilding since it's not wise
mixing a shared build with a static one or a debug build with a release one
or a unicode build with an ansi one.
Last, using the COMPILER when setting BUILDDIR keeps separed the object files generated using
different compilers (in case makefiles for different compilers are generated in the same directory).
NOTE: the autoconf format requires BUILDDIR='.' since using different build directories
is already handled by the configure script.
E.g.
for debug builds: mkdir dbg && cd dbg && ../configure - -enable-debug
for release builds: mkdir rel && cd rel && ../configure - -disable-debug
...
See autoconf documentation for more info.
-->
<!-- some helpers -->
<set var="SHRDSTR"><if cond="isdefined('SHAREDBUILDPOSTFIX')">_$(SHAREDBUILDPOSTFIX)</if></set>
<set var="DBGSTR"><if cond="isdefined('DEBUGBUILDPOSTFIX')">_$(DEBUGBUILDPOSTFIX)</if></set>
<set var="UNICSTR"><if cond="isdefined('UNICODEBUILDPOSTFIX')">_$(UNICODEBUILDPOSTFIX)</if></set>
<if cond="FORMAT!='autoconf'">
<set var="BUILDDIR">
$(COMPILER)$(SHRDSTR)$(DBGSTR)$(UNICSTR)
</set>
</if>
</makefile>

View file

@ -1,42 +0,0 @@
<?xml version="1.0" ?>
<!-- $Id: sharedopt.bkl 40 2006-12-02 15:22:02Z frm $ -->
<!--
Adds the logic for handling a SHARED=0/1 option, which switches between static and
shared (DLL) builds.
Usage: use template "sharedopt" for your targets:
<include file="presets/sharedopt.bkl"/>
<lib id="mylib_static" cond="SHARED=='0'">
<sources>mylib.cpp</sources>
</lib>
<dll id="mylib_shared" cond="SHARED=='1'">
<sources>mylib.cpp</sources>
</dll>
<set var="MSVC6PRJ_MERGED_TARGETS">mylib=mylib_static+mylib_shared</set>
-->
<makefile>
<set var="SHARED_DEFAULT" overwrite="0">0</set>
<option name="SHARED">
<values>0,1</values>
<default-value>$(SHARED_DEFAULT)</default-value>
<values-description>Static,DLL</values-description>
<description>Set to 1 to build shared (DLL) version</description>
</option>
<!-- The SHAREDBUILDPOSTFIX variable is useful to set the BUILDDIR variable
as done in presets/setbuilddir.bkl -->
<set var="SHAREDBUILDPOSTFIX">
<if cond="SHARED=='0'">static</if>
<if cond="SHARED=='1'">shared</if>
</set>
</makefile>

View file

@ -1,43 +0,0 @@
<?xml version="1.0" ?>
<!-- $Id: unicodeopt.bkl 40 2006-12-02 15:22:02Z frm $ -->
<!--
Adds the logic for handling a UNICODE=0/1 option, which switches between unicode and
ansi builds.
Usage: use template "unicodeopt" for your targets:
<include file="presets/unicodeopt.bkl"/>
<exe id="myapp" template="unicodeopt">
<sources>myapp.cpp</sources>
</exe>
-->
<makefile>
<set var="UNICODE_DEFAULT" overwrite="0">0</set>
<option name="UNICODE">
<values>0,1</values>
<default-value>$(UNICODE_DEFAULT)</default-value>
<values-description>ANSI,Unicode</values-description>
<description>Set to 1 to build Unicode version</description>
</option>
<template id="unicodeopt">
<define>
$(substituteFromDict(UNICODE,{'1':'_UNICODE','0':''}))
</define>
</template>
<!-- The UNICODEBUILDPOSTFIX variable is useful to set the BUILDDIR variable
as done in presets/setbuilddir.bkl -->
<set var="UNICODEBUILDPOSTFIX">
<if cond="UNICODE=='0'">a</if>
<if cond="UNICODE=='1'">u</if>
</set>
</makefile>

View file

@ -1,283 +0,0 @@
# =========================================================================
# This makefile was generated by
# Bakefile 0.2.9 (http://www.bakefile.org)
# Do not modify, all changes will be overwritten!
# =========================================================================
# -------------------------------------------------------------------------
# These are configurable options:
# -------------------------------------------------------------------------
# Compiler flags to link shared library
LINK_DLL_FLAGS ?= -shared
# C compiler
CC = gcc
# C++ compiler
CXX = g++
# Standard flags for CC
CFLAGS ?=
# Standard flags for C++
CXXFLAGS ?=
# Standard preprocessor flags (common for CC and CXX)
CPPFLAGS ?=
# Standard linker flags
LDFLAGS ?=
# Set to 1 to build debug version [0,1]
DEBUG ?= 0
# Set to 1 to build shared (DLL) version [0,1]
SHARED ?= 0
# Set to 1 to compile samples [0,1]
SAMPLES ?= 1
# -------------------------------------------------------------------------
# Do not modify the rest of this file!
# -------------------------------------------------------------------------
### Variables: ###
CPPDEPS = -MT$@ -MF$@.d -MD -MP
MUPARSER_LIB_CXXFLAGS = $(____DEBUG) $(____DEBUG_3) $(____DEBUG_9) \
$(____DEBUG_8) $(____SHARED) $(____SHARED_0) -D_WIN32 -I..\include \
$(CPPFLAGS) $(CXXFLAGS)
MUPARSER_LIB_OBJECTS = \
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParser.o \
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParserBase.o \
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParserBytecode.o \
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParserCallback.o \
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParserDLL.o \
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParserError.o \
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParserInt.o \
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParserTest.o \
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParserTokenReader.o
MUPARSER_DLL_CXXFLAGS = $(____DEBUG) $(____DEBUG_3) $(____DEBUG_9) \
$(____DEBUG_8) $(____SHARED) $(____SHARED_0) -D_WIN32 -I..\include \
$(CPPFLAGS) $(CXXFLAGS)
MUPARSER_DLL_OBJECTS = \
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParser.o \
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParserBase.o \
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParserBytecode.o \
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParserCallback.o \
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParserDLL.o \
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParserError.o \
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParserInt.o \
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParserTest.o \
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParserTokenReader.o
EXAMPLE1_CXXFLAGS = $(____DEBUG) $(____DEBUG_3) $(____DEBUG_9) $(____DEBUG_8) \
-I..\include $(____SHARED_1) $(CPPFLAGS) $(CXXFLAGS)
EXAMPLE1_OBJECTS = \
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\example1_example1.o
EXAMPLE2_CFLAGS = $(____DEBUG) $(____DEBUG_3) $(____DEBUG_9) $(____DEBUG_8) \
-I..\include $(____SHARED_1) $(CPPFLAGS) $(CFLAGS)
EXAMPLE2_OBJECTS = \
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\example2_example2.o
### Conditionally set variables: ###
ifeq ($(DEBUG),0)
DEBUGBUILDPOSTFIX = rel
endif
ifeq ($(DEBUG),1)
DEBUGBUILDPOSTFIX = dbg
endif
ifeq ($(SHARED),0)
SHAREDBUILDPOSTFIX = static
endif
ifeq ($(SHARED),1)
SHAREDBUILDPOSTFIX = shared
endif
ifeq ($(DEBUG),0)
DEBUG_BUILD_POSTFIX =
endif
ifeq ($(DEBUG),1)
DEBUG_BUILD_POSTFIX = d
endif
ifeq ($(SHARED),0)
__muParser_lib___depname = ..\lib\libmuparser$(DEBUG_BUILD_POSTFIX).a
endif
ifeq ($(SHARED),1)
__muParser_dll___depname = ..\lib\muparser$(DEBUG_BUILD_POSTFIX).dll
endif
ifeq ($(SAMPLES),1)
ifeq ($(SHARED),0)
__example1___depname = ..\samples\example1\example1.exe
endif
endif
ifeq ($(SAMPLES),1)
ifeq ($(SHARED),1)
__example2___depname = ..\samples\example2\example2.exe
endif
endif
ifeq ($(SHARED),0)
____SHARED =
endif
ifeq ($(SHARED),1)
____SHARED = -DMUPARSER_DLL
endif
ifeq ($(SHARED),0)
____SHARED_0 =
endif
ifeq ($(SHARED),1)
____SHARED_0 = -DMUPARSERLIB_EXPORTS
endif
ifeq ($(DEBUG),0)
____DEBUG = -DNDEBUG
endif
ifeq ($(DEBUG),1)
____DEBUG =
endif
ifeq ($(DEBUG),0)
____DEBUG_3 = -O2
endif
ifeq ($(DEBUG),1)
____DEBUG_3 = -O0
endif
ifeq ($(DEBUG),0)
____DEBUG_8 =
endif
ifeq ($(DEBUG),1)
____DEBUG_8 = -W -Wall
endif
ifeq ($(SHARED),0)
____SHARED_1 =
endif
ifeq ($(SHARED),1)
____SHARED_1 = -DUSINGDLL
endif
ifeq ($(DEBUG),0)
____DEBUG_9 =
endif
ifeq ($(DEBUG),1)
____DEBUG_9 = -g
endif
all: obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX):
-if not exist obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX) mkdir obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)
### Targets: ###
all: $(__muParser_lib___depname) $(__muParser_dll___depname) $(__example1___depname) $(__example2___depname)
clean:
-if exist obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\*.o del obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\*.o
-if exist obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\*.d del obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\*.d
-if exist ..\lib\libmuparser$(DEBUG_BUILD_POSTFIX).a del ..\lib\libmuparser$(DEBUG_BUILD_POSTFIX).a
-if exist ..\lib\muparser$(DEBUG_BUILD_POSTFIX).dll del ..\lib\muparser$(DEBUG_BUILD_POSTFIX).dll
-if exist ..\lib\libmuparser$(DEBUG_BUILD_POSTFIX).a del ..\lib\libmuparser$(DEBUG_BUILD_POSTFIX).a
-if exist ..\samples\example1\example1.exe del ..\samples\example1\example1.exe
-if exist ..\samples\example2\example2.exe del ..\samples\example2\example2.exe
ifeq ($(SHARED),0)
..\lib\libmuparser$(DEBUG_BUILD_POSTFIX).a: $(MUPARSER_LIB_OBJECTS)
if exist $@ del $@
ar rcu $@ $(MUPARSER_LIB_OBJECTS)
ranlib $@
endif
ifeq ($(SHARED),1)
..\lib\muparser$(DEBUG_BUILD_POSTFIX).dll: $(MUPARSER_DLL_OBJECTS)
$(CXX) $(LINK_DLL_FLAGS) -fPIC -o $@ $(MUPARSER_DLL_OBJECTS) $(____DEBUG_9) -Wl,--out-implib=..\lib\libmuparser$(DEBUG_BUILD_POSTFIX).a $(LDFLAGS)
endif
ifeq ($(SAMPLES),1)
ifeq ($(SHARED),0)
..\samples\example1\example1.exe: $(EXAMPLE1_OBJECTS) $(__muParser_lib___depname)
$(CXX) -o $@ $(EXAMPLE1_OBJECTS) $(____DEBUG_9) -L..\lib $(LDFLAGS) ..\lib\libmuparser$(DEBUG_BUILD_POSTFIX).a
endif
endif
ifeq ($(SAMPLES),1)
ifeq ($(SHARED),1)
..\samples\example2\example2.exe: $(EXAMPLE2_OBJECTS) $(__muParser_lib___depname)
$(CC) -o $@ $(EXAMPLE2_OBJECTS) $(____DEBUG_9) -L..\lib $(LDFLAGS) ..\lib\libmuparser$(DEBUG_BUILD_POSTFIX).a
endif
endif
lib: $(__muParser_lib___depname) $(__muParser_dll___depname)
samples: $(__example1___depname) $(__example2___depname)
documentation:
( cd ..\docs && doxygen )
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParser.o: ../src/muParser.cpp
$(CXX) -c -o $@ $(MUPARSER_LIB_CXXFLAGS) $(CPPDEPS) $<
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParserBase.o: ../src/muParserBase.cpp
$(CXX) -c -o $@ $(MUPARSER_LIB_CXXFLAGS) $(CPPDEPS) $<
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParserBytecode.o: ../src/muParserBytecode.cpp
$(CXX) -c -o $@ $(MUPARSER_LIB_CXXFLAGS) $(CPPDEPS) $<
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParserCallback.o: ../src/muParserCallback.cpp
$(CXX) -c -o $@ $(MUPARSER_LIB_CXXFLAGS) $(CPPDEPS) $<
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParserDLL.o: ../src/muParserDLL.cpp
$(CXX) -c -o $@ $(MUPARSER_LIB_CXXFLAGS) $(CPPDEPS) $<
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParserError.o: ../src/muParserError.cpp
$(CXX) -c -o $@ $(MUPARSER_LIB_CXXFLAGS) $(CPPDEPS) $<
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParserInt.o: ../src/muParserInt.cpp
$(CXX) -c -o $@ $(MUPARSER_LIB_CXXFLAGS) $(CPPDEPS) $<
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParserTest.o: ../src/muParserTest.cpp
$(CXX) -c -o $@ $(MUPARSER_LIB_CXXFLAGS) $(CPPDEPS) $<
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParserTokenReader.o: ../src/muParserTokenReader.cpp
$(CXX) -c -o $@ $(MUPARSER_LIB_CXXFLAGS) $(CPPDEPS) $<
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParser.o: ../src/muParser.cpp
$(CXX) -c -o $@ $(MUPARSER_DLL_CXXFLAGS) $(CPPDEPS) $<
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParserBase.o: ../src/muParserBase.cpp
$(CXX) -c -o $@ $(MUPARSER_DLL_CXXFLAGS) $(CPPDEPS) $<
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParserBytecode.o: ../src/muParserBytecode.cpp
$(CXX) -c -o $@ $(MUPARSER_DLL_CXXFLAGS) $(CPPDEPS) $<
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParserCallback.o: ../src/muParserCallback.cpp
$(CXX) -c -o $@ $(MUPARSER_DLL_CXXFLAGS) $(CPPDEPS) $<
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParserDLL.o: ../src/muParserDLL.cpp
$(CXX) -c -o $@ $(MUPARSER_DLL_CXXFLAGS) $(CPPDEPS) $<
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParserError.o: ../src/muParserError.cpp
$(CXX) -c -o $@ $(MUPARSER_DLL_CXXFLAGS) $(CPPDEPS) $<
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParserInt.o: ../src/muParserInt.cpp
$(CXX) -c -o $@ $(MUPARSER_DLL_CXXFLAGS) $(CPPDEPS) $<
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParserTest.o: ../src/muParserTest.cpp
$(CXX) -c -o $@ $(MUPARSER_DLL_CXXFLAGS) $(CPPDEPS) $<
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParserTokenReader.o: ../src/muParserTokenReader.cpp
$(CXX) -c -o $@ $(MUPARSER_DLL_CXXFLAGS) $(CPPDEPS) $<
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\example1_example1.o: ../samples/example1/example1.cpp
$(CXX) -c -o $@ $(EXAMPLE1_CXXFLAGS) $(CPPDEPS) $<
obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\example2_example2.o: ../samples/example2/example2.c
$(CC) -c -o $@ $(EXAMPLE2_CFLAGS) $(CPPDEPS) $<
.PHONY: all clean lib samples
SHELL := $(COMSPEC)
# Dependencies tracking:
-include obj\gcc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)/*.d

View file

@ -1,322 +0,0 @@
# =========================================================================
# This makefile was generated by
# Bakefile 0.2.9 (http://www.bakefile.org)
# Do not modify, all changes will be overwritten!
# =========================================================================
# -------------------------------------------------------------------------
# These are configurable options:
# -------------------------------------------------------------------------
# C compiler
CC = cl
# C++ compiler
CXX = cl
# Standard flags for CC
CFLAGS =
# Standard flags for C++
CXXFLAGS =
# Standard preprocessor flags (common for CC and CXX)
CPPFLAGS =
# Standard linker flags
LDFLAGS =
# Set to 1 to build debug version [0,1]
# 0 - Release
# 1 - Debug
DEBUG = 0
# Set to 1 to build shared (DLL) version [0,1]
# 0 - Static
# 1 - DLL
SHARED = 0
# Set to 1 to compile samples [0,1]
SAMPLES = 1
# -------------------------------------------------------------------------
# Do not modify the rest of this file!
# -------------------------------------------------------------------------
### Variables: ###
MUPARSER_LIB_CXXFLAGS = /MD$(DEBUG_3) /DWIN32 $(____DEBUG_8) $(____DEBUG) \
$(____DEBUG_9) /Fd..\lib\muparser$(DEBUG_3).pdb $(____DEBUG_6) \
$(______DEBUG) $(____SHARED) $(____SHARED_0) /D_WIN32 /I..\include /GR /EHsc \
$(CPPFLAGS) $(CXXFLAGS)
MUPARSER_LIB_OBJECTS = \
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParser.obj \
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParserBase.obj \
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParserBytecode.obj \
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParserCallback.obj \
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParserDLL.obj \
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParserError.obj \
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParserInt.obj \
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParserTest.obj \
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParserTokenReader.obj
MUPARSER_DLL_CXXFLAGS = /MD$(DEBUG_3) /DWIN32 $(____DEBUG_8) $(____DEBUG) \
$(____DEBUG_9) /Fd..\lib\muparser$(DEBUG_3).pdb $(____DEBUG_6) \
$(______DEBUG) $(____SHARED) $(____SHARED_0) /D_WIN32 /I..\include /GR /EHsc \
$(CPPFLAGS) $(CXXFLAGS)
MUPARSER_DLL_OBJECTS = \
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParser.obj \
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParserBase.obj \
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParserBytecode.obj \
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParserCallback.obj \
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParserDLL.obj \
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParserError.obj \
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParserInt.obj \
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParserTest.obj \
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParserTokenReader.obj
EXAMPLE1_CXXFLAGS = /MD$(DEBUG_3) /DWIN32 $(____DEBUG_8) $(____DEBUG) \
$(____DEBUG_9) /Fd..\samples\example1\example1.pdb $(____DEBUG_6) \
$(______DEBUG) /I..\include $(____SHARED_1) /GR /EHsc $(CPPFLAGS) $(CXXFLAGS)
EXAMPLE1_OBJECTS = \
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\example1_example1.obj
EXAMPLE2_CFLAGS = /MD$(DEBUG_3) /DWIN32 $(____DEBUG_8) $(____DEBUG) \
$(____DEBUG_9) /Fd..\samples\example2\example2.pdb $(____DEBUG_6) \
$(______DEBUG) /I..\include $(____SHARED_1) $(CPPFLAGS) $(CFLAGS)
EXAMPLE2_OBJECTS = \
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\example2_example2.obj
### Conditionally set variables: ###
!if "$(DEBUG)" == "0"
DEBUGBUILDPOSTFIX = rel
!endif
!if "$(DEBUG)" == "1"
DEBUGBUILDPOSTFIX = dbg
!endif
!if "$(SHARED)" == "0"
SHAREDBUILDPOSTFIX = static
!endif
!if "$(SHARED)" == "1"
SHAREDBUILDPOSTFIX = shared
!endif
!if "$(SHARED)" == "0"
__muParser_lib___depname = ..\lib\muparser$(DEBUG_3).lib
!endif
!if "$(SHARED)" == "1"
__muParser_dll___depname = ..\lib\muparser$(DEBUG_3).dll
!endif
!if "$(DEBUG)" == "0"
____DEBUG_23_26 =
!endif
!if "$(DEBUG)" == "1"
____DEBUG_23_26 = $(____DEBUG_10)
!endif
!if "$(SAMPLES)" == "1" && "$(SHARED)" == "0"
__example1___depname = ..\samples\example1\example1.exe
!endif
!if "$(DEBUG)" == "0"
____DEBUG_40_43 =
!endif
!if "$(DEBUG)" == "1"
____DEBUG_40_43 = $(____DEBUG_10)
!endif
!if "$(SAMPLES)" == "1" && "$(SHARED)" == "1"
__example2___depname = ..\samples\example2\example2.exe
!endif
!if "$(DEBUG)" == "0"
____DEBUG_56_59 =
!endif
!if "$(DEBUG)" == "1"
____DEBUG_56_59 = $(____DEBUG_10)
!endif
!if "$(SHARED)" == "0"
____SHARED =
!endif
!if "$(SHARED)" == "1"
____SHARED = /DMUPARSER_DLL
!endif
!if "$(SHARED)" == "0"
____SHARED_0 =
!endif
!if "$(SHARED)" == "1"
____SHARED_0 = /DMUPARSERLIB_EXPORTS
!endif
!if "$(DEBUG)" == "0"
____DEBUG_8 = /DNDEBUG
!endif
!if "$(DEBUG)" == "1"
____DEBUG_8 =
!endif
!if "$(DEBUG)" == "0"
____DEBUG = /O2
!endif
!if "$(DEBUG)" == "1"
____DEBUG = /Od
!endif
!if "$(DEBUG)" == "0"
____DEBUG_9 =
!endif
!if "$(DEBUG)" == "1"
____DEBUG_9 = /Zi
!endif
!if "$(DEBUG)" == "0"
____DEBUG_5 =
!endif
!if "$(DEBUG)" == "1"
____DEBUG_5 = /DEBUG
!endif
!if "$(DEBUG)" == "0"
____DEBUG_6 = /w
!endif
!if "$(DEBUG)" == "1"
____DEBUG_6 = /W4
!endif
!if "$(DEBUG)" == "0"
______DEBUG =
!endif
!if "$(DEBUG)" == "1"
______DEBUG = /D_DEBUG
!endif
!if "$(DEBUG)" == "0"
DEBUG_3 =
!endif
!if "$(DEBUG)" == "1"
DEBUG_3 = d
!endif
!if "$(DEBUG)" == "0"
____DEBUG_10 = /opt:ref /opt:icf
!endif
!if "$(DEBUG)" == "1"
____DEBUG_10 =
!endif
!if "$(SHARED)" == "0"
____SHARED_1 =
!endif
!if "$(SHARED)" == "1"
____SHARED_1 = /DUSINGDLL
!endif
all: obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX):
-if not exist obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX) mkdir obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)
### Targets: ###
all: $(__muParser_lib___depname) $(__muParser_dll___depname) $(__example1___depname) $(__example2___depname)
clean:
-if exist obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\*.obj del obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\*.obj
-if exist obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\*.res del obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\*.res
-if exist obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\*.pch del obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\*.pch
-if exist ..\lib\muparser$(DEBUG_3).lib del ..\lib\muparser$(DEBUG_3).lib
-if exist ..\lib\muparser$(DEBUG_3).dll del ..\lib\muparser$(DEBUG_3).dll
-if exist ..\lib\muparser$(DEBUG_3).ilk del ..\lib\muparser$(DEBUG_3).ilk
-if exist ..\lib\muparser$(DEBUG_3).pdb del ..\lib\muparser$(DEBUG_3).pdb
-if exist ..\lib\muparser$(DEBUG_3).lib del ..\lib\muparser$(DEBUG_3).lib
-if exist ..\samples\example1\example1.exe del ..\samples\example1\example1.exe
-if exist ..\samples\example1\example1.ilk del ..\samples\example1\example1.ilk
-if exist ..\samples\example1\example1.pdb del ..\samples\example1\example1.pdb
-if exist ..\samples\example2\example2.exe del ..\samples\example2\example2.exe
-if exist ..\samples\example2\example2.ilk del ..\samples\example2\example2.ilk
-if exist ..\samples\example2\example2.pdb del ..\samples\example2\example2.pdb
!if "$(SHARED)" == "0"
..\lib\muparser$(DEBUG_3).lib: $(MUPARSER_LIB_OBJECTS)
if exist $@ del $@
link /LIB /NOLOGO /OUT:$@ @<<
$(MUPARSER_LIB_OBJECTS)
<<
!endif
!if "$(SHARED)" == "1"
..\lib\muparser$(DEBUG_3).dll: $(MUPARSER_DLL_OBJECTS)
link /DLL /NOLOGO /OUT:$@ $(____DEBUG_5) /pdb:"..\lib\muparser$(DEBUG_3).pdb" $(____DEBUG_23_26) $(LDFLAGS) @<<
$(MUPARSER_DLL_OBJECTS) /IMPLIB:..\lib\muparser$(DEBUG_3).lib
<<
!endif
!if "$(SAMPLES)" == "1" && "$(SHARED)" == "0"
..\samples\example1\example1.exe: $(EXAMPLE1_OBJECTS) $(__muParser_lib___depname)
link /NOLOGO /OUT:$@ $(____DEBUG_5) /pdb:"..\samples\example1\example1.pdb" $(____DEBUG_40_43) /LIBPATH:..\lib $(LDFLAGS) @<<
$(EXAMPLE1_OBJECTS) ..\lib\muparser$(DEBUG_3).lib
<<
!endif
!if "$(SAMPLES)" == "1" && "$(SHARED)" == "1"
..\samples\example2\example2.exe: $(EXAMPLE2_OBJECTS) $(__muParser_lib___depname)
link /NOLOGO /OUT:$@ $(____DEBUG_5) /pdb:"..\samples\example2\example2.pdb" $(____DEBUG_56_59) /LIBPATH:..\lib $(LDFLAGS) @<<
$(EXAMPLE2_OBJECTS) ..\lib\muparser$(DEBUG_3).lib
<<
!endif
lib: $(__muParser_lib___depname) $(__muParser_dll___depname)
samples: $(__example1___depname) $(__example2___depname)
documentation:
( cd ..\docs && doxygen )
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParser.obj: ..\src\muParser.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MUPARSER_LIB_CXXFLAGS) ..\src\muParser.cpp
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParserBase.obj: ..\src\muParserBase.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MUPARSER_LIB_CXXFLAGS) ..\src\muParserBase.cpp
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParserBytecode.obj: ..\src\muParserBytecode.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MUPARSER_LIB_CXXFLAGS) ..\src\muParserBytecode.cpp
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParserCallback.obj: ..\src\muParserCallback.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MUPARSER_LIB_CXXFLAGS) ..\src\muParserCallback.cpp
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParserDLL.obj: ..\src\muParserDLL.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MUPARSER_LIB_CXXFLAGS) ..\src\muParserDLL.cpp
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParserError.obj: ..\src\muParserError.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MUPARSER_LIB_CXXFLAGS) ..\src\muParserError.cpp
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParserInt.obj: ..\src\muParserInt.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MUPARSER_LIB_CXXFLAGS) ..\src\muParserInt.cpp
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParserTest.obj: ..\src\muParserTest.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MUPARSER_LIB_CXXFLAGS) ..\src\muParserTest.cpp
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_lib_muParserTokenReader.obj: ..\src\muParserTokenReader.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MUPARSER_LIB_CXXFLAGS) ..\src\muParserTokenReader.cpp
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParser.obj: ..\src\muParser.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MUPARSER_DLL_CXXFLAGS) ..\src\muParser.cpp
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParserBase.obj: ..\src\muParserBase.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MUPARSER_DLL_CXXFLAGS) ..\src\muParserBase.cpp
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParserBytecode.obj: ..\src\muParserBytecode.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MUPARSER_DLL_CXXFLAGS) ..\src\muParserBytecode.cpp
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParserCallback.obj: ..\src\muParserCallback.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MUPARSER_DLL_CXXFLAGS) ..\src\muParserCallback.cpp
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParserDLL.obj: ..\src\muParserDLL.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MUPARSER_DLL_CXXFLAGS) ..\src\muParserDLL.cpp
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParserError.obj: ..\src\muParserError.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MUPARSER_DLL_CXXFLAGS) ..\src\muParserError.cpp
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParserInt.obj: ..\src\muParserInt.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MUPARSER_DLL_CXXFLAGS) ..\src\muParserInt.cpp
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParserTest.obj: ..\src\muParserTest.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MUPARSER_DLL_CXXFLAGS) ..\src\muParserTest.cpp
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\muParser_dll_muParserTokenReader.obj: ..\src\muParserTokenReader.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MUPARSER_DLL_CXXFLAGS) ..\src\muParserTokenReader.cpp
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\example1_example1.obj: ..\samples\example1\example1.cpp
$(CXX) /c /nologo /TP /Fo$@ $(EXAMPLE1_CXXFLAGS) ..\samples\example1\example1.cpp
obj\vc_$(SHAREDBUILDPOSTFIX)_$(DEBUGBUILDPOSTFIX)\example2_example2.obj: ..\samples\example2\example2.c
$(CC) /c /nologo /TC /Fo$@ $(EXAMPLE2_CFLAGS) ..\samples\example2\example2.c

View file

@ -1,119 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "muparser", "muparser_muParser.vcxproj", "{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example1", "muparser_example1.vcxproj", "{A1DCD664-8803-54E2-B35F-84D96B9CA6DF}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example2", "muparser_example2.vcxproj", "{B405983E-B929-5BCF-8CC8-03CF34796A23}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug DLL|Any CPU = Debug DLL|Any CPU
Debug DLL|Mixed Platforms = Debug DLL|Mixed Platforms
Debug DLL|Win32 = Debug DLL|Win32
Debug DLL|x64 = Debug DLL|x64
Debug Static|Any CPU = Debug Static|Any CPU
Debug Static|Mixed Platforms = Debug Static|Mixed Platforms
Debug Static|Win32 = Debug Static|Win32
Debug Static|x64 = Debug Static|x64
Release DLL|Any CPU = Release DLL|Any CPU
Release DLL|Mixed Platforms = Release DLL|Mixed Platforms
Release DLL|Win32 = Release DLL|Win32
Release DLL|x64 = Release DLL|x64
Release Static|Any CPU = Release Static|Any CPU
Release Static|Mixed Platforms = Release Static|Mixed Platforms
Release Static|Win32 = Release Static|Win32
Release Static|x64 = Release Static|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}.Debug DLL|Any CPU.ActiveCfg = Debug DLL|Win32
{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}.Debug DLL|Any CPU.Build.0 = Debug DLL|Win32
{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}.Debug DLL|Mixed Platforms.ActiveCfg = Debug DLL|Win32
{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}.Debug DLL|Mixed Platforms.Build.0 = Debug DLL|Win32
{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32
{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}.Debug DLL|Win32.Build.0 = Debug DLL|Win32
{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}.Debug DLL|x64.ActiveCfg = Debug DLL|x64
{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}.Debug DLL|x64.Build.0 = Debug DLL|x64
{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}.Debug Static|Any CPU.ActiveCfg = Debug Static|Win32
{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}.Debug Static|Any CPU.Build.0 = Debug Static|Win32
{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}.Debug Static|Mixed Platforms.ActiveCfg = Debug Static|Win32
{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}.Debug Static|Mixed Platforms.Build.0 = Debug Static|Win32
{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}.Debug Static|Win32.ActiveCfg = Debug Static|Win32
{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}.Debug Static|Win32.Build.0 = Debug Static|Win32
{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}.Debug Static|x64.ActiveCfg = Debug Static|x64
{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}.Debug Static|x64.Build.0 = Debug Static|x64
{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}.Release DLL|Any CPU.ActiveCfg = Release DLL|Win32
{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}.Release DLL|Any CPU.Build.0 = Release DLL|Win32
{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}.Release DLL|Mixed Platforms.ActiveCfg = Release DLL|Win32
{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}.Release DLL|Mixed Platforms.Build.0 = Release DLL|Win32
{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}.Release DLL|Win32.ActiveCfg = Release DLL|Win32
{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}.Release DLL|Win32.Build.0 = Release DLL|Win32
{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}.Release DLL|x64.ActiveCfg = Release DLL|x64
{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}.Release DLL|x64.Build.0 = Release DLL|x64
{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}.Release Static|Any CPU.ActiveCfg = Release Static|Win32
{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}.Release Static|Any CPU.Build.0 = Release Static|Win32
{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}.Release Static|Mixed Platforms.ActiveCfg = Release Static|Win32
{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}.Release Static|Mixed Platforms.Build.0 = Release Static|Win32
{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}.Release Static|Win32.ActiveCfg = Release Static|Win32
{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}.Release Static|Win32.Build.0 = Release Static|Win32
{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}.Release Static|x64.ActiveCfg = Release Static|x64
{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}.Release Static|x64.Build.0 = Release Static|x64
{A1DCD664-8803-54E2-B35F-84D96B9CA6DF}.Debug DLL|Any CPU.ActiveCfg = Debug Static|Win32
{A1DCD664-8803-54E2-B35F-84D96B9CA6DF}.Debug DLL|Mixed Platforms.ActiveCfg = Debug Static|Win32
{A1DCD664-8803-54E2-B35F-84D96B9CA6DF}.Debug DLL|Mixed Platforms.Build.0 = Debug Static|Win32
{A1DCD664-8803-54E2-B35F-84D96B9CA6DF}.Debug DLL|Win32.ActiveCfg = Debug Static|Win32
{A1DCD664-8803-54E2-B35F-84D96B9CA6DF}.Debug DLL|x64.ActiveCfg = Debug Static|x64
{A1DCD664-8803-54E2-B35F-84D96B9CA6DF}.Debug Static|Any CPU.ActiveCfg = Debug Static|Win32
{A1DCD664-8803-54E2-B35F-84D96B9CA6DF}.Debug Static|Any CPU.Build.0 = Debug Static|Win32
{A1DCD664-8803-54E2-B35F-84D96B9CA6DF}.Debug Static|Mixed Platforms.ActiveCfg = Debug Static|Win32
{A1DCD664-8803-54E2-B35F-84D96B9CA6DF}.Debug Static|Mixed Platforms.Build.0 = Debug Static|Win32
{A1DCD664-8803-54E2-B35F-84D96B9CA6DF}.Debug Static|Win32.ActiveCfg = Debug Static|Win32
{A1DCD664-8803-54E2-B35F-84D96B9CA6DF}.Debug Static|Win32.Build.0 = Debug Static|Win32
{A1DCD664-8803-54E2-B35F-84D96B9CA6DF}.Debug Static|x64.ActiveCfg = Debug Static|x64
{A1DCD664-8803-54E2-B35F-84D96B9CA6DF}.Debug Static|x64.Build.0 = Debug Static|x64
{A1DCD664-8803-54E2-B35F-84D96B9CA6DF}.Release DLL|Any CPU.ActiveCfg = Release Static|Win32
{A1DCD664-8803-54E2-B35F-84D96B9CA6DF}.Release DLL|Mixed Platforms.ActiveCfg = Release Static|Win32
{A1DCD664-8803-54E2-B35F-84D96B9CA6DF}.Release DLL|Mixed Platforms.Build.0 = Release Static|Win32
{A1DCD664-8803-54E2-B35F-84D96B9CA6DF}.Release DLL|Win32.ActiveCfg = Release Static|Win32
{A1DCD664-8803-54E2-B35F-84D96B9CA6DF}.Release DLL|x64.ActiveCfg = Release Static|x64
{A1DCD664-8803-54E2-B35F-84D96B9CA6DF}.Release Static|Any CPU.ActiveCfg = Release Static|Win32
{A1DCD664-8803-54E2-B35F-84D96B9CA6DF}.Release Static|Any CPU.Build.0 = Release Static|Win32
{A1DCD664-8803-54E2-B35F-84D96B9CA6DF}.Release Static|Mixed Platforms.ActiveCfg = Release Static|Win32
{A1DCD664-8803-54E2-B35F-84D96B9CA6DF}.Release Static|Mixed Platforms.Build.0 = Release Static|Win32
{A1DCD664-8803-54E2-B35F-84D96B9CA6DF}.Release Static|Win32.ActiveCfg = Release Static|Win32
{A1DCD664-8803-54E2-B35F-84D96B9CA6DF}.Release Static|Win32.Build.0 = Release Static|Win32
{A1DCD664-8803-54E2-B35F-84D96B9CA6DF}.Release Static|x64.ActiveCfg = Release Static|x64
{A1DCD664-8803-54E2-B35F-84D96B9CA6DF}.Release Static|x64.Build.0 = Release Static|x64
{B405983E-B929-5BCF-8CC8-03CF34796A23}.Debug DLL|Any CPU.ActiveCfg = Debug DLL|Win32
{B405983E-B929-5BCF-8CC8-03CF34796A23}.Debug DLL|Any CPU.Build.0 = Debug DLL|Win32
{B405983E-B929-5BCF-8CC8-03CF34796A23}.Debug DLL|Mixed Platforms.ActiveCfg = Debug DLL|Win32
{B405983E-B929-5BCF-8CC8-03CF34796A23}.Debug DLL|Mixed Platforms.Build.0 = Debug DLL|Win32
{B405983E-B929-5BCF-8CC8-03CF34796A23}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32
{B405983E-B929-5BCF-8CC8-03CF34796A23}.Debug DLL|Win32.Build.0 = Debug DLL|Win32
{B405983E-B929-5BCF-8CC8-03CF34796A23}.Debug DLL|x64.ActiveCfg = Debug DLL|x64
{B405983E-B929-5BCF-8CC8-03CF34796A23}.Debug DLL|x64.Build.0 = Debug DLL|x64
{B405983E-B929-5BCF-8CC8-03CF34796A23}.Debug Static|Any CPU.ActiveCfg = Debug DLL|Win32
{B405983E-B929-5BCF-8CC8-03CF34796A23}.Debug Static|Mixed Platforms.ActiveCfg = Debug DLL|Win32
{B405983E-B929-5BCF-8CC8-03CF34796A23}.Debug Static|Mixed Platforms.Build.0 = Debug DLL|Win32
{B405983E-B929-5BCF-8CC8-03CF34796A23}.Debug Static|Win32.ActiveCfg = Debug DLL|Win32
{B405983E-B929-5BCF-8CC8-03CF34796A23}.Debug Static|x64.ActiveCfg = Debug DLL|x64
{B405983E-B929-5BCF-8CC8-03CF34796A23}.Release DLL|Any CPU.ActiveCfg = Release DLL|Win32
{B405983E-B929-5BCF-8CC8-03CF34796A23}.Release DLL|Any CPU.Build.0 = Release DLL|Win32
{B405983E-B929-5BCF-8CC8-03CF34796A23}.Release DLL|Mixed Platforms.ActiveCfg = Release DLL|Win32
{B405983E-B929-5BCF-8CC8-03CF34796A23}.Release DLL|Mixed Platforms.Build.0 = Release DLL|Win32
{B405983E-B929-5BCF-8CC8-03CF34796A23}.Release DLL|Win32.ActiveCfg = Release DLL|Win32
{B405983E-B929-5BCF-8CC8-03CF34796A23}.Release DLL|Win32.Build.0 = Release DLL|Win32
{B405983E-B929-5BCF-8CC8-03CF34796A23}.Release DLL|x64.ActiveCfg = Release DLL|x64
{B405983E-B929-5BCF-8CC8-03CF34796A23}.Release DLL|x64.Build.0 = Release DLL|x64
{B405983E-B929-5BCF-8CC8-03CF34796A23}.Release Static|Any CPU.ActiveCfg = Release DLL|Win32
{B405983E-B929-5BCF-8CC8-03CF34796A23}.Release Static|Mixed Platforms.ActiveCfg = Release DLL|Win32
{B405983E-B929-5BCF-8CC8-03CF34796A23}.Release Static|Mixed Platforms.Build.0 = Release DLL|Win32
{B405983E-B929-5BCF-8CC8-03CF34796A23}.Release Static|Win32.ActiveCfg = Release DLL|Win32
{B405983E-B929-5BCF-8CC8-03CF34796A23}.Release Static|x64.ActiveCfg = Release DLL|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View file

@ -1,238 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug Static|Win32">
<Configuration>Debug Static</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug Static|x64">
<Configuration>Debug Static</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release Static|Win32">
<Configuration>Release Static</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release Static|x64">
<Configuration>Release Static</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>example1</ProjectName>
<ProjectGuid>{A1DCD664-8803-54E2-B35F-84D96B9CA6DF}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Static|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Static|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Static|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Static|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release Static|Win32'">..\..\samples\example1\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release Static|Win32'">obj\vc_static_rel\example1\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release Static|Win32'">false</LinkIncremental>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release Static|Win32'">true</GenerateManifest>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug Static|Win32'">..\..\samples\example1\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug Static|Win32'">obj\vc_static_dbg\example1\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug Static|Win32'">true</LinkIncremental>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug Static|Win32'">true</GenerateManifest>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release Static|x64'">..\..\samples\example1\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release Static|x64'">obj\vc_static_rel\example1\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release Static|x64'">false</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug Static|x64'">..\..\samples\example1\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug Static|x64'">obj\vc_static_dbg\example1\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug Static|x64'">true</LinkIncremental>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug Static|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug Static|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug Static|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug Static|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug Static|x64'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug Static|x64'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release Static|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release Static|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release Static|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release Static|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release Static|x64'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release Static|x64'" />
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|Win32'">
<Midl>
<PreprocessorDefinitions>WIN32;_CONSOLE;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</Midl>
<ClCompile>
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_CONSOLE;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<ObjectFileName>obj\vc_static_rel\example1\</ObjectFileName>
<ProgramDataBaseFileName>..\..\samples\example1\example1.pdb</ProgramDataBaseFileName>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>
</DebugInformationFormat>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_CONSOLE;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<AdditionalOptions>%(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>..\..\lib\muparser32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>..\..\samples\example1\example1.exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<ProgramDatabaseFile>..\..\samples\example1\example1.pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>..\..\samples\example1\muparser_example1.bsc</OutputFile>
</Bscmake>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Static|Win32'">
<Midl>
<PreprocessorDefinitions>WIN32;_CONSOLE;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</Midl>
<ClCompile>
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_CONSOLE;_DEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Sync</ExceptionHandling>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<BufferSecurityCheck>true</BufferSecurityCheck>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<ObjectFileName>obj\vc_static_dbg\example1\</ObjectFileName>
<ProgramDataBaseFileName>..\..\samples\example1\example1.pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_CONSOLE;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<AdditionalOptions>%(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>..\..\lib\muparserd32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>..\..\samples\example1\example1.exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>..\..\samples\example1\example1.pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>..\..\samples\example1\muparser_example1.bsc</OutputFile>
</Bscmake>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|x64'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CONSOLE;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<ObjectFileName>obj\vc_static_rel\example1\</ObjectFileName>
<ProgramDataBaseFileName>..\..\samples\example1\example1.pdb</ProgramDataBaseFileName>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
</ClCompile>
<Link>
<AdditionalDependencies>..\..\lib\muparser64.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>..\..\samples\example1\example1.exe</OutputFile>
<AdditionalLibraryDirectories>..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Static|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CONSOLE;_DEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
<ObjectFileName>obj\vc_static_dbg\example1\</ObjectFileName>
<ProgramDataBaseFileName>..\..\samples\example1\example1.pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>..\..\lib\muparserd64.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>..\..\samples\example1\example1.exe</OutputFile>
<AdditionalLibraryDirectories>..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>..\..\samples\example1\example1.pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<TargetMachine>NotSet</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\samples\example1\example1.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="muparser_muParser.vcxproj">
<Project>{2a1f639a-7642-57cc-bf97-3ec5b5c89d91}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\samples\example1\example1.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View file

@ -1,208 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug DLL|Win32">
<Configuration>Debug DLL</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug DLL|x64">
<Configuration>Debug DLL</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release DLL|Win32">
<Configuration>Release DLL</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release DLL|x64">
<Configuration>Release DLL</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>example2</ProjectName>
<ProjectGuid>{B405983E-B929-5BCF-8CC8-03CF34796A23}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'">..\..\samples\example2\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'">obj\vc_shared_rel\example2\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'">false</LinkIncremental>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'">true</GenerateManifest>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'">..\..\samples\example2\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'">obj\vc_shared_rel\example2\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'">..\..\samples\example2\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'">obj\vc_shared_dbg\example2\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'">true</LinkIncremental>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'">true</GenerateManifest>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'">..\..\samples\example2\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'">obj\vc_shared_dbg\example2\</IntDir>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'" />
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'">
<Midl>
<PreprocessorDefinitions>WIN32;_CONSOLE;NDEBUG;USINGDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</Midl>
<ClCompile>
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_CONSOLE;NDEBUG;USINGDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<ObjectFileName>obj\vc_shared_rel\example2\</ObjectFileName>
<ProgramDataBaseFileName>..\..\samples\example2\example2.pdb</ProgramDataBaseFileName>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>
</DebugInformationFormat>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_CONSOLE;NDEBUG;USINGDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<AdditionalOptions>%(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>..\..\lib\muparser32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>..\..\samples\example2\example2.exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<ProgramDatabaseFile>..\..\samples\example2\example2.pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>..\..\samples\example2\muparser_example2.bsc</OutputFile>
</Bscmake>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalDependencies>..\..\lib\muparser64.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>..\..\samples\example2\example2.exe</OutputFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'">
<Midl>
<PreprocessorDefinitions>WIN32;_CONSOLE;_DEBUG;USINGDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</Midl>
<ClCompile>
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_CONSOLE;_DEBUG;USINGDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Sync</ExceptionHandling>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<BufferSecurityCheck>true</BufferSecurityCheck>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<ObjectFileName>obj\vc_shared_dbg\example2\</ObjectFileName>
<ProgramDataBaseFileName>..\..\samples\example2\example2.pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_CONSOLE;_DEBUG;USINGDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<AdditionalOptions>%(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>..\..\lib\muparserd32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>..\..\samples\example2\example2.exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>..\..\samples\example2\example2.pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>..\..\samples\example2\muparser_example2.bsc</OutputFile>
</Bscmake>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'">
<ClCompile>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalDependencies>..\..\lib\muparserd64.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>..\..\samples\example2\example2.exe</OutputFile>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\samples\example2\example2.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="muparser_muParser.vcxproj">
<Project>{2a1f639a-7642-57cc-bf97-3ec5b5c89d91}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\samples\example2\example2.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View file

@ -1,411 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug DLL|Win32">
<Configuration>Debug DLL</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug DLL|x64">
<Configuration>Debug DLL</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug Static|Win32">
<Configuration>Debug Static</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug Static|x64">
<Configuration>Debug Static</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release DLL|Win32">
<Configuration>Release DLL</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release DLL|x64">
<Configuration>Release DLL</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release Static|Win32">
<Configuration>Release Static</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release Static|x64">
<Configuration>Release Static</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>muparser</ProjectName>
<ProjectGuid>{2A1F639A-7642-57CC-BF97-3EC5B5C89D91}</ProjectGuid>
<RootNamespace>muParser</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Static|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Static|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Static|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Static|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release Static|Win32'">..\..\lib\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release Static|Win32'">obj\vc_static_rel\muParser\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'">..\..\lib\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'">obj\vc_shared_rel\muParser\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'">false</LinkIncremental>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'">true</GenerateManifest>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug Static|Win32'">..\..\lib\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug Static|Win32'">obj\vc_static_dbg\muParser\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'">..\..\lib\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'">obj\vc_shared_dbg\muParser\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'">true</LinkIncremental>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'">true</GenerateManifest>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release Static|x64'">..\..\lib\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release Static|x64'">obj\vc_static_rel\muParser\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'">..\..\lib\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'">obj\vc_shared_rel\muParser\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug Static|x64'">..\..\lib\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug Static|x64'">obj\vc_static_dbg\muParser\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'">..\..\lib\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'">obj\vc_shared_dbg\muParser\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'">true</LinkIncremental>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'">true</GenerateManifest>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug Static|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug Static|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug Static|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug Static|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug Static|x64'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug Static|x64'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release Static|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release Static|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release Static|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release Static|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release Static|x64'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release Static|x64'" />
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|Win32'">
<Midl>
<PreprocessorDefinitions>WIN32;_LIB;NDEBUG;_WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</Midl>
<ClCompile>
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_LIB;NDEBUG;_WIN32;MUP_USE_OPENMP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<ObjectFileName>obj\vc_static_rel\muParser\</ObjectFileName>
<ProgramDataBaseFileName>..\..\lib\muparser.pdb</ProgramDataBaseFileName>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>
</DebugInformationFormat>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;_WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Lib>
<OutputFile>..\..\lib\muparser32.lib</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Lib>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>..\..\lib\muparser_muParser.bsc</OutputFile>
</Bscmake>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'">
<Midl>
<PreprocessorDefinitions>WIN32;_USRDLL;DLL_EXPORTS;NDEBUG;MUPARSER_DLL;MUPARSERLIB_EXPORTS;_WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</Midl>
<ClCompile>
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_USRDLL;DLL_EXPORTS;NDEBUG;MUPARSER_DLL;MUPARSERLIB_EXPORTS;_WIN32;MUP_USE_OPENMP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<OpenMPSupport>true</OpenMPSupport>
<ObjectFileName>obj\vc_shared_rel\muParser\</ObjectFileName>
<ProgramDataBaseFileName>..\..\lib\muparser32.pdb</ProgramDataBaseFileName>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>
</DebugInformationFormat>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;MUPARSER_DLL;MUPARSERLIB_EXPORTS;_WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<AdditionalOptions>%(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>..\..\lib\muparser32.dll</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<ProgramDatabaseFile>..\..\lib\muparser.pdb</ProgramDatabaseFile>
<ImportLibrary>..\..\lib\muparser32.lib</ImportLibrary>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>..\..\lib\muparser_muParser.bsc</OutputFile>
</Bscmake>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Static|Win32'">
<Midl>
<PreprocessorDefinitions>WIN32;_LIB;_DEBUG;_WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</Midl>
<ClCompile>
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_LIB;_DEBUG;_WIN32;MUP_USE_OPENMP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Sync</ExceptionHandling>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<SmallerTypeCheck>true</SmallerTypeCheck>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<BufferSecurityCheck>true</BufferSecurityCheck>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<ObjectFileName>obj\vc_static_dbg\muParser\</ObjectFileName>
<ProgramDataBaseFileName>..\..\lib\muparserd.pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;_WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Lib>
<OutputFile>..\..\lib\muparserd32.lib</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Lib>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>..\..\lib\muparser_muParser.bsc</OutputFile>
</Bscmake>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'">
<Midl>
<PreprocessorDefinitions>WIN32;_USRDLL;DLL_EXPORTS;_DEBUG;MUPARSER_DLL;MUPARSERLIB_EXPORTS;_WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</Midl>
<ClCompile>
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_USRDLL;DLL_EXPORTS;_DEBUG;MUPARSER_DLL;MUPARSERLIB_EXPORTS;_WIN32;_CRT_SECURE_NO_WARNINGS;MUP_USE_OPENMP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Sync</ExceptionHandling>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<BufferSecurityCheck>true</BufferSecurityCheck>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<OpenMPSupport>true</OpenMPSupport>
<ObjectFileName>obj\vc_shared_dbg\muParser\</ObjectFileName>
<ProgramDataBaseFileName>..\..\lib\muparserd32.pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;MUPARSER_DLL;MUPARSERLIB_EXPORTS;_WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<AdditionalOptions>%(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>..\..\lib\muparserd32.dll</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>..\..\lib\muparserd32.pdb</ProgramDatabaseFile>
<ImportLibrary>..\..\lib\muparserd32.lib</ImportLibrary>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>..\..\lib\muparser_muParser.bsc</OutputFile>
</Bscmake>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|x64'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_LIB;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Lib>
<OutputFile>..\..\lib\muparser64.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'">
<ClCompile>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_USRDLL;DLL_EXPORTS;NDEBUG;MUPARSER_DLL;MUPARSERLIB_EXPORTS;MUP_USE_OPENMP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<ObjectFileName>obj\vc_shared_rel\muParser\</ObjectFileName>
<ProgramDataBaseFileName>..\..\lib\muparser64.pdb</ProgramDataBaseFileName>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
</ClCompile>
<Link>
<OutputFile>..\..\lib\muparser64.dll</OutputFile>
<ImportLibrary>..\..\lib\muparser64.lib</ImportLibrary>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Static|x64'">
<ClCompile>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_LIB;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SmallerTypeCheck>true</SmallerTypeCheck>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Disabled</Optimization>
</ClCompile>
<Lib>
<OutputFile>..\..\lib\muparserd64.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'">
<ClCompile>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_USRDLL;DLL_EXPORTS;_DEBUG;MUPARSER_DLL;MUPARSERLIB_EXPORTS;_CRT_SECURE_NO_WARNINGS;MUP_USE_OPENMP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<ObjectFileName>obj\vc_shared_dbg\muParser\</ObjectFileName>
<ProgramDataBaseFileName>..\..\lib\muparserd64.pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<OutputFile>..\..\lib\muparserd64.dll</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>..\..\lib\muparserd64.pdb</ProgramDatabaseFile>
<ImportLibrary>..\..\lib\muparserd64.lib</ImportLibrary>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\src\muParser.cpp" />
<ClCompile Include="..\..\src\muParserBase.cpp" />
<ClCompile Include="..\..\src\muParserBytecode.cpp" />
<ClCompile Include="..\..\src\muParserCallback.cpp" />
<ClCompile Include="..\..\src\muParserDLL.cpp" />
<ClCompile Include="..\..\src\muParserError.cpp" />
<ClCompile Include="..\..\src\muParserInt.cpp" />
<ClCompile Include="..\..\src\muParserTest.cpp" />
<ClCompile Include="..\..\src\muParserTokenReader.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\include\muParser.h" />
<ClInclude Include="..\..\include\muParserBase.h" />
<ClInclude Include="..\..\include\muParserBytecode.h" />
<ClInclude Include="..\..\include\muParserCallback.h" />
<ClInclude Include="..\..\include\muParserDef.h" />
<ClInclude Include="..\..\include\muParserDLL.h" />
<ClInclude Include="..\..\include\muParserError.h" />
<ClInclude Include="..\..\include\muParserFixes.h" />
<ClInclude Include="..\..\include\muParserInt.h" />
<ClInclude Include="..\..\include\muParserStack.h" />
<ClInclude Include="..\..\include\muParserTemplateMagic.h" />
<ClInclude Include="..\..\include\muParserTest.h" />
<ClInclude Include="..\..\include\muParserToken.h" />
<ClInclude Include="..\..\include\muParserTokenReader.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -1,86 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\muParser.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\muParserBase.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\muParserBytecode.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\muParserCallback.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\muParserDLL.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\muParserError.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\muParserInt.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\muParserTest.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\muParserTokenReader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\include\muParser.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\muParserBase.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\muParserBytecode.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\muParserCallback.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\muParserDef.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\muParserDLL.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\muParserError.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\muParserFixes.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\muParserInt.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\muParserStack.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\muParserTest.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\muParserToken.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\muParserTokenReader.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\muParserTemplateMagic.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

8355
muparser-2.2.5/configure vendored

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,15 +0,0 @@
<!DOCTYPE html>
<html style="height:100%;">
<head>
</head>
<body style="height:100%; overflow:hidden;">
<div style="border: 0px; position:absolute; top:0px; left:0px; width:100%; bottom:0px; padding:0px; margin:0px;">
<iframe src="http://muparser.beltoforion.de" style="border: 0px; width:100%; height:100%;">
Sorry, your browser doesn't support IFrames. Click <a href="http://muparser.beltoforion.de">here</a> to load the muparser documentation directly.
</iframe>
</div>
</body>
</html>

View file

@ -1,104 +0,0 @@
/*
__________
_____ __ __\______ \_____ _______ ______ ____ _______
/ \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \
| Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/
|__|_| /|____/ |____| (____ /|__| /____ > \___ >|__|
\/ \/ \/ \/
Copyright (C) 2013 Ingo Berg
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef MU_PARSER_H
#define MU_PARSER_H
//--- Standard includes ------------------------------------------------------------------------
#include <vector>
//--- Parser includes --------------------------------------------------------------------------
#include "muParserBase.h"
/** \file
\brief Definition of the standard floating point parser.
*/
namespace mu {
/** \brief Mathematical expressions parser.
Standard implementation of the mathematical expressions parser.
Can be used as a reference implementation for subclassing the parser.
<small>
(C) 2011 Ingo Berg<br>
muparser(at)beltoforion.de
</small>
*/
/* final */ class Parser : public ParserBase {
public:
Parser();
void InitCharSets() override;
void InitFun() override;
void InitConst() override;
void InitOprt() override;
protected:
// Trigonometric functions
static ValueOrError Sin(value_type);
static ValueOrError Cos(value_type);
static ValueOrError Tan(value_type);
static ValueOrError Tan2(value_type, value_type);
// arcus functions
static ValueOrError ASin(value_type);
static ValueOrError ACos(value_type);
static ValueOrError ATan(value_type);
static ValueOrError ATan2(value_type, value_type);
// hyperbolic functions
static ValueOrError Sinh(value_type);
static ValueOrError Cosh(value_type);
static ValueOrError Tanh(value_type);
// arcus hyperbolic functions
static ValueOrError ASinh(value_type);
static ValueOrError ACosh(value_type);
static ValueOrError ATanh(value_type);
// Logarithm functions
static ValueOrError Log2(value_type); // Logarithm Base 2
static ValueOrError Log10(value_type); // Logarithm Base 10
static ValueOrError Ln(value_type); // Logarithm Base e (natural logarithm)
// misc
static ValueOrError Exp(value_type);
static ValueOrError Abs(value_type);
static ValueOrError Sqrt(value_type);
static ValueOrError Rint(value_type);
static ValueOrError Sign(value_type);
// Prefix operators
// !!! Unary Minus is a MUST if you want to use negative signs !!!
static ValueOrError UnaryMinus(value_type);
static ValueOrError UnaryPlus(value_type);
// Functions with variable number of arguments
static ValueOrError Sum(const value_type *, int); // sum
static ValueOrError Avg(const value_type *, int); // mean value
static ValueOrError Min(const value_type *, int); // minimum
static ValueOrError Max(const value_type *, int); // maximum
static int IsVal(const char_type *a_szExpr, int *a_iPos, value_type *a_fVal);
};
} // namespace mu
#endif

View file

@ -1,265 +0,0 @@
/*
__________
_____ __ __\______ \_____ _______ ______ ____ _______
/ \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \
| Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/
|__|_| /|____/ |____| (____ /|__| /____ > \___ >|__|
\/ \/ \/ \/
Copyright (C) 2013 Ingo Berg
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef MU_PARSER_BASE_H
#define MU_PARSER_BASE_H
//--- Standard includes ------------------------------------------------------------------------
#include <limits.h>
#include <cmath>
#include <iostream>
#include <locale>
#include <map>
#include <memory>
#include <string>
//--- Parser includes --------------------------------------------------------------------------
#include "muParserBytecode.h"
#include "muParserDef.h"
#include "muParserTokenReader.h"
namespace mu {
/** \file
\brief This file contains the class definition of the muparser engine.
*/
//--------------------------------------------------------------------------------------------------
/** \brief Mathematical expressions parser (base parser engine).
\author (C) 2013 Ingo Berg
This is the implementation of a bytecode based mathematical expressions parser.
The formula will be parsed from string and converted into a bytecode.
Future calculations will be done with the bytecode instead the formula string
resulting in a significant performance increase.
Complementary to a set of internally implemented functions the parser is able to handle
user defined functions and variables.
*/
class ParserBase {
friend class ParserTokenReader;
private:
/** \brief Typedef for the parse functions.
The parse function do the actual work. The parser exchanges
the function pointer to the parser function depending on
which state it is in. (i.e. bytecode parser vs. string parser)
*/
typedef ValueOrError (ParserBase::*ParseFunction)() const;
/** \brief Type for a vector of strings. */
typedef std::vector<string_type> stringbuf_type;
/** \brief Type used for parser tokens. */
typedef ParserToken<value_type, string_type> token_type;
public:
/** \brief Type of the error class.
Included for backwards compatibility.
*/
typedef ParserError exception_type;
static void EnableDebugDump(bool bDumpCmd, bool bDumpStack);
ParserBase();
ParserBase(const ParserBase &a_Parser) = delete;
ParserBase &operator=(const ParserBase &a_Parser) = delete;
virtual ~ParserBase();
ValueOrError Eval() const;
void Eval(std::vector<ValueOrError> *results) const;
int GetNumResults() const;
OptionalError SetExpr(const string_type &a_sExpr);
void SetVarFactory(facfun_type a_pFactory, void *pUserData = NULL);
void SetDecSep(char_type cDecSep);
void SetThousandsSep(char_type cThousandsSep = 0);
void ResetLocale();
void EnableBuiltInOprt(bool a_bIsOn = true);
bool HasBuiltInOprt() const;
void AddValIdent(identfun_type a_pCallback);
/** \fn void mu::ParserBase::DefineFun(const string_type &a_strName, fun_type0 a_pFun)
\brief Define a parser function without arguments.
\param a_strName Name of the function
\param a_pFun Pointer to the callback function
*/
template <typename T>
OptionalError DefineFun(const string_type &a_strName, T a_pFun) {
return AddCallback(a_strName, ParserCallback(a_pFun), m_FunDef, ValidNameChars());
}
OptionalError DefineOprt(const string_type &a_strName, fun_type2 a_pFun, unsigned a_iPri = 0,
EOprtAssociativity a_eAssociativity = oaLEFT);
OptionalError DefineConst(const string_type &a_sName, value_type a_fVal);
OptionalError DefineStrConst(const string_type &a_sName, const string_type &a_strVal);
OptionalError DefineVar(const string_type &a_sName, value_type *a_fVar);
OptionalError DefinePostfixOprt(const string_type &a_strFun, fun_type1 a_pOprt);
OptionalError DefineInfixOprt(const string_type &a_strName, fun_type1 a_pOprt,
int a_iPrec = prINFIX);
// Clear user defined constants or operators.
void ClearConst();
void ClearPostfixOprt();
void RemoveVar(const string_type &a_strVarName);
const varmap_type &GetVar() const;
const string_type &GetExpr() const;
const char_type **GetOprtDef() const;
void DefineNameChars(const char_type *a_szCharset);
void DefineOprtChars(const char_type *a_szCharset);
void DefineInfixOprtChars(const char_type *a_szCharset);
const char_type *ValidNameChars() const;
const char_type *ValidOprtChars() const;
const char_type *ValidInfixOprtChars() const;
void SetArgSep(char_type cArgSep);
char_type GetArgSep() const;
ParserError Error(EErrorCodes a_iErrc, int a_iPos = (int)mu::string_type::npos,
const string_type &a_strTok = string_type()) const;
protected:
void Init();
virtual void InitCharSets() = 0;
virtual void InitFun() = 0;
virtual void InitConst() = 0;
virtual void InitOprt() = 0;
static const char_type *c_DefaultOprt[];
static std::locale s_locale; ///< The locale used by the parser
static bool g_DbgDumpCmdCode;
static bool g_DbgDumpStack;
/** \brief A facet class used to change decimal and thousands separator. */
template <class TChar>
class change_dec_sep : public std::numpunct<TChar> {
public:
explicit change_dec_sep(char_type cDecSep, char_type cThousandsSep = 0, int nGroup = 3)
: std::numpunct<TChar>(),
m_nGroup(nGroup),
m_cDecPoint(cDecSep),
m_cThousandsSep(cThousandsSep) {}
protected:
char_type do_decimal_point() const override { return m_cDecPoint; }
char_type do_thousands_sep() const override { return m_cThousandsSep; }
std::string do_grouping() const override {
// fix for issue 4: https://code.google.com/p/muparser/issues/detail?id=4
// courtesy of Jens Bartsch
// original code:
// return std::string(1, (char)m_nGroup);
// new code:
return std::string(1, (char)(m_cThousandsSep > 0 ? m_nGroup : CHAR_MAX));
}
private:
int m_nGroup;
char_type m_cDecPoint;
char_type m_cThousandsSep;
};
private:
void ReInit() const;
OptionalError AddCallback(const string_type &a_strName, const ParserCallback &a_Callback,
funmap_type &a_Storage, const char_type *a_szCharSet);
OptionalError ApplyRemainingOprt(ParserStack<token_type> &a_stOpt,
ParserStack<token_type> &a_stVal) const;
OptionalError ApplyBinOprt(ParserStack<token_type> &a_stOpt,
ParserStack<token_type> &a_stVal) const;
OptionalError ApplyIfElse(ParserStack<token_type> &a_stOpt,
ParserStack<token_type> &a_stVal) const;
OptionalError ApplyFunc(ParserStack<token_type> &a_stOpt, ParserStack<token_type> &a_stVal,
int iArgCount) const;
OptionalError ApplyStrFunc(const token_type &a_FunTok,
const std::vector<token_type> &a_vArg) const;
int GetOprtPrecedence(const token_type &a_Tok) const;
EOprtAssociativity GetOprtAssociativity(const token_type &a_Tok) const;
OptionalError CreateRPN() const;
ValueOrError ExecuteRPN() const;
ValueOrError InvokeFunction(generic_fun_type func, const value_type *args, int argCount) const;
/// Build the RPN if necessary, and then execute it.
/// \return the result, or an error.
ValueOrError BuildAndExecuteRPN() const;
OptionalError CheckName(const string_type &a_strName, const string_type &a_CharSet) const;
OptionalError CheckOprt(const string_type &a_sName, const ParserCallback &a_Callback,
const string_type &a_szCharSet) const;
void StackDump(const ParserStack<token_type> &a_stVal,
const ParserStack<token_type> &a_stOprt) const;
/** \brief Pointer to the parser function.
Eval() calls the function whose address is stored there.
*/
mutable ParserByteCode m_vRPN; ///< The Bytecode class.
mutable stringbuf_type
m_vStringBuf; ///< String buffer, used for storing string function arguments
stringbuf_type m_vStringVarBuf;
std::unique_ptr<ParserTokenReader> m_pTokenReader;
funmap_type m_FunDef; ///< Map of function names and pointers.
funmap_type m_PostOprtDef; ///< Postfix operator callbacks
funmap_type m_InfixOprtDef; ///< unary infix operator.
funmap_type m_OprtDef; ///< Binary operator callbacks
valmap_type m_ConstDef; ///< user constants.
strmap_type m_StrVarDef; ///< user defined string constants
varmap_type m_VarDef; ///< user defind variables.
bool m_bBuiltInOp =
true; ///< Flag that can be used for switching built in operators on and off
string_type m_sNameChars; ///< Charset for names
string_type m_sOprtChars; ///< Charset for postfix/ binary operator tokens
string_type m_sInfixOprtChars; ///< Charset for infix operator tokens
// items merely used for caching state information
/// This is merely a buffer used for the stack in the cmd parsing routine
mutable std::vector<value_type> m_vStackBuffer;
mutable int m_nFinalResultIdx = 0;
};
} // namespace mu
#endif

View file

@ -1,118 +0,0 @@
/*
__________
_____ __ __\______ \_____ _______ ______ ____ _______
/ \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \
| Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/
|__|_| /|____/ |____| (____ /|__| /____ > \___ >|__|
\/ \/ \/ \/
Copyright (C) 2004-2013 Ingo Berg
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef MU_PARSER_BYTECODE_H
#define MU_PARSER_BYTECODE_H
#include <cassert>
#include <stack>
#include <string>
#include <vector>
#include "muParserDef.h"
#include "muParserToken.h"
/** \file
\brief Definition of the parser bytecode class.
*/
namespace mu {
struct SToken {
ECmdCode Cmd;
union {
struct // SValData
{
value_type *ptr;
value_type data;
} Val;
struct // SFunData
{
// Note: generic_fun_type is merely a placeholder. The real type could be
// anything between gun_type1 and fun_type9. I can't use a void
// pointer due to constraints in the ANSI standard which allows
// data pointers and function pointers to differ in size.
generic_fun_type ptr;
int argc;
int idx;
} Fun;
struct // SOprtData
{
value_type *ptr;
int offset;
} Oprt;
};
};
/** \brief Bytecode implementation of the Math Parser.
The bytecode contains the formula converted to revers polish notation stored in a continious
memory area. Associated with this data are operator codes, variable pointers, constant
values and function pointers. Those are necessary in order to calculate the result.
All those data items will be casted to the underlying datatype of the bytecode.
\author (C) 2004-2013 Ingo Berg
*/
class ParserByteCode {
private:
/** \brief Token type for internal use only. */
typedef ParserToken<value_type, string_type> token_type;
/** \brief Position in the Calculation array. */
unsigned m_iStackPos;
/** \brief Maximum size needed for the stack. */
std::size_t m_iMaxStackSize;
/** \brief The actual rpn storage. */
std::vector<SToken> m_vRPN;
public:
ParserByteCode();
ParserByteCode(const ParserByteCode &a_ByteCode) = delete;
ParserByteCode &operator=(const ParserByteCode &a_ByteCode) = delete;
void AddVar(value_type *a_pVar);
void AddVal(value_type a_fVal);
void AddOp(ECmdCode a_Oprt);
void AddIfElse(ECmdCode a_Oprt);
void AddAssignOp(value_type *a_pVar);
void AddFun(generic_fun_type a_pFun, int a_iArgc);
void AddStrFun(generic_fun_type a_pFun, int a_iArgc, int a_iIdx);
void Finalize();
void clear();
std::size_t GetMaxStackSize() const;
std::size_t GetSize() const;
bool empty() const { return GetSize() == 0; }
const SToken *GetBase() const;
void AsciiDump();
};
} // namespace mu
#endif

View file

@ -1,92 +0,0 @@
/*
__________
_____ __ __\______ \_____ _______ ______ ____ _______
/ \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \
| Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/
|__|_| /|____/ |____| (____ /|__| /____ > \___ >|__|
\/ \/ \/ \/
Copyright (C) 2004-2011 Ingo Berg
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef MU_PARSER_CALLBACK_H
#define MU_PARSER_CALLBACK_H
#include "muParserDef.h"
/** \file
\brief Definition of the parser callback class.
*/
namespace mu {
/** \brief Encapsulation of prototypes for a numerical parser function.
Encapsulates the prototyp for numerical parser functions. The class
stores the number of arguments for parser functions as well
as additional flags indication the function is non optimizeable.
The pointer to the callback function pointer is stored as void*
and needs to be casted according to the argument count.
Negative argument counts indicate a parser function with a variable number
of arguments.
\author (C) 2004-2011 Ingo Berg
*/
class ParserCallback final {
public:
explicit ParserCallback(fun_type0 a_pFun);
ParserCallback(fun_type1 a_pFun, int a_iPrec = -1, ECmdCode a_iCode = cmFUNC);
ParserCallback(fun_type2 a_pFun, int a_iPrec, EOprtAssociativity a_eAssociativity);
explicit ParserCallback(fun_type2 a_pFun);
explicit ParserCallback(fun_type3 a_pFun);
explicit ParserCallback(multfun_type a_pFun);
explicit ParserCallback(strfun_type1 a_pFun);
explicit ParserCallback(strfun_type2 a_pFun);
explicit ParserCallback(strfun_type3 a_pFun);
ParserCallback();
ParserCallback(const ParserCallback& a_Fun);
void* GetAddr() const;
ECmdCode GetCode() const;
ETypeCode GetType() const;
int GetPri() const;
EOprtAssociativity GetAssociativity() const;
int GetArgc() const;
private:
void* m_pFun; ///< Pointer to the callback function, casted to void
/** \brief Number of numeric function arguments
This number is negative for functions with variable number of arguments. in this cases
they represent the actual number of arguments found.
*/
int m_iArgc;
int m_iPri; ///< Valid only for binary and infix operators; Operator precedence.
EOprtAssociativity m_eOprtAsct; ///< Operator associativity; Valid only for binary operators
ECmdCode m_iCode;
ETypeCode m_iType;
};
//------------------------------------------------------------------------------
/** \brief Container for Callback objects. */
typedef std::map<string_type, ParserCallback> funmap_type;
} // namespace mu
#endif

View file

@ -1,426 +0,0 @@
/*
__________
_____ __ __\______ \_____ _______ ______ ____ _______
/ \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \
| Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/
|__|_| /|____/ |____| (____ /|__| /____ > \___ >|__|
\/ \/ \/ \/
Copyright (C) 2014 Ingo Berg
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef MUP_DEF_H
#define MUP_DEF_H
#include <cassert>
#include <iostream>
#include <map>
#include <memory>
#include <sstream>
#include <string>
#include <vector>
/** \file
\brief This file contains standard definitions used by the parser.
*/
#define MUP_VERSION _T("2.2.5")
#define MUP_VERSION_DATE _T("20150427; GC")
#define MUP_CHARS _T("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
/** \brief If this macro is defined mathematical exceptions (div by zero) will be thrown as
* exceptions. */
//#define MUP_MATH_EXCEPTIONS
/** \brief Define the base datatype for values.
This datatype must be a built in value type. You can not use custom classes.
It should be working with all types except "int"!
*/
#define MUP_BASETYPE double
#if defined(_UNICODE)
/** \brief Definition of the basic parser string type. */
#define MUP_STRING_TYPE std::wstring
#if !defined(_T)
#define _T(x) L##x
#endif // not defined _T
#else
#ifndef _T
#define _T(x) x
#endif
/** \brief Definition of the basic parser string type. */
#define MUP_STRING_TYPE std::string
#endif
namespace mu {
#if defined(_UNICODE)
//------------------------------------------------------------------------------
/** \brief Encapsulate wcout. */
inline std::wostream &console() { return std::wcout; }
/** \brief Encapsulate cin. */
inline std::wistream &console_in() { return std::wcin; }
#else
/** \brief Encapsulate cout.
Used for supporting UNICODE more easily.
*/
inline std::ostream &console() { return std::cout; }
/** \brief Encapsulate cin.
Used for supporting UNICODE more easily.
*/
inline std::istream &console_in() { return std::cin; }
#endif
/// Our stack type.
template <typename T>
class ParserStack : public std::vector<T> {
public:
// Convenience to get the top value and pop it.
T pop() {
T val = std::move(this->back());
this->pop_back();
return val;
}
T &top() { return this->back(); }
void push(T val) { this->push_back(std::move(val)); }
};
//------------------------------------------------------------------------------
/** \brief Bytecode values.
\attention The order of the operator entries must match the order in ParserBase::c_DefaultOprt!
*/
enum ECmdCode {
// The following are codes for built in binary operators
// apart from built in operators the user has the opportunity to
// add user defined operators.
cmLE = 0, ///< Operator item: less or equal
cmGE = 1, ///< Operator item: greater or equal
cmNEQ = 2, ///< Operator item: not equal
cmEQ = 3, ///< Operator item: equals
cmLT = 4, ///< Operator item: less than
cmGT = 5, ///< Operator item: greater than
cmADD = 6, ///< Operator item: add
cmSUB = 7, ///< Operator item: subtract
cmMUL = 8, ///< Operator item: multiply
cmDIV = 9, ///< Operator item: division
cmPOW = 10, ///< Operator item: y to the power of ...
cmLAND = 11,
cmLOR = 12,
cmASSIGN = 13, ///< Operator item: Assignment operator
cmBO = 14, ///< Operator item: opening bracket
cmBC = 15, ///< Operator item: closing bracket
cmIF = 16, ///< For use in the ternary if-then-else operator
cmELSE = 17, ///< For use in the ternary if-then-else operator
cmENDIF = 18, ///< For use in the ternary if-then-else operator
cmARG_SEP = 19, ///< function argument separator
cmVAR = 20, ///< variable item
cmVAL = 21, ///< value item
// operators and functions
cmFUNC, ///< Code for a generic function item
cmFUNC_STR, ///< Code for a function with a string parameter
cmSTRING, ///< Code for a string token
cmOPRT_BIN, ///< user defined binary operator
cmOPRT_POSTFIX, ///< code for postfix operators
cmOPRT_INFIX, ///< code for infix operators
cmEND, ///< end of formula
cmUNKNOWN ///< uninitialized item
};
//------------------------------------------------------------------------------
/** \brief Types internally used by the parser.
*/
enum ETypeCode {
tpSTR = 0, ///< String type (Function arguments and constants only, no string variables)
tpDBL = 1, ///< Floating point variables
tpVOID = 2 ///< Undefined type.
};
//------------------------------------------------------------------------------
/** \brief Parser operator precedence values. */
enum EOprtAssociativity { oaLEFT = 0, oaRIGHT = 1, oaNONE = 2 };
//------------------------------------------------------------------------------
/** \brief Parser operator precedence values. */
enum EOprtPrecedence {
// binary operators
prLOR = 1,
prLAND = 2,
prLOGIC = 3, ///< logic operators
prCMP = 4, ///< comparsion operators
prADD_SUB = 5, ///< addition
prMUL_DIV = 6, ///< multiplication/division
prPOW = 7, ///< power operator priority (highest)
// infix operators
prINFIX = 6, ///< Signs have a higher priority than ADD_SUB, but lower than power operator
prPOSTFIX = 6 ///< Postfix operator priority (currently unused)
};
//------------------------------------------------------------------------------
// basic types
/** \brief The numeric datatype used by the parser.
Normally this is a floating point type either single or double precision.
*/
typedef MUP_BASETYPE value_type;
/** \brief The stringtype used by the parser.
Depends on wether UNICODE is used or not.
*/
typedef MUP_STRING_TYPE string_type;
/** \brief The character type used by the parser.
Depends on wether UNICODE is used or not.
*/
typedef string_type::value_type char_type;
/** \brief Typedef for easily using stringstream that respect the parser stringtype. */
typedef std::basic_stringstream<char_type, std::char_traits<char_type>, std::allocator<char_type> >
stringstream_type;
// Data container types
/** \brief Type used for storing variables. */
typedef std::map<string_type, value_type *> varmap_type;
/** \brief Type used for storing constants. */
typedef std::map<string_type, value_type> valmap_type;
/** \brief Type for assigning a string name to an index in the internal string table. */
typedef std::map<string_type, std::size_t> strmap_type;
/** \brief Error codes. */
enum EErrorCodes {
// Formula syntax errors
ecUNEXPECTED_OPERATOR = 0, ///< Unexpected binary operator found
ecUNASSIGNABLE_TOKEN = 1, ///< Token cant be identified.
ecUNEXPECTED_EOF = 2, ///< Unexpected end of formula. (Example: "2+sin(")
ecUNEXPECTED_ARG_SEP = 3, ///< An unexpected comma has been found. (Example: "1,23")
ecUNEXPECTED_ARG = 4, ///< An unexpected argument has been found
ecUNEXPECTED_VAL = 5, ///< An unexpected value token has been found
ecUNEXPECTED_VAR = 6, ///< An unexpected variable token has been found
ecUNEXPECTED_PARENS = 7, ///< Unexpected Parenthesis, opening or closing
ecUNEXPECTED_STR = 8, ///< A string has been found at an inapropriate position
ecSTRING_EXPECTED = 9, ///< A string function has been called with a different type of argument
ecVAL_EXPECTED =
10, ///< A numerical function has been called with a non value type of argument
ecMISSING_PARENS = 11, ///< Missing parens. (Example: "3*sin(3")
ecUNEXPECTED_FUN = 12, ///< Unexpected function found. (Example: "sin(8)cos(9)")
ecUNTERMINATED_STRING = 13, ///< unterminated string constant. (Example: "3*valueof("hello)")
ecTOO_MANY_PARAMS = 14, ///< Too many function parameters
ecTOO_FEW_PARAMS = 15, ///< Too few function parameters. (Example: "ite(1<2,2)")
ecOPRT_TYPE_CONFLICT =
16, ///< binary operators may only be applied to value items of the same type
ecSTR_RESULT = 17, ///< result is a string
// Invalid Parser input Parameters
ecINVALID_NAME = 18, ///< Invalid function, variable or constant name.
ecINVALID_BINOP_IDENT = 19, ///< Invalid binary operator identifier
ecINVALID_INFIX_IDENT = 20, ///< Invalid function, variable or constant name.
ecINVALID_POSTFIX_IDENT = 21, ///< Invalid function, variable or constant name.
ecBUILTIN_OVERLOAD = 22, ///< Trying to overload builtin operator
ecINVALID_FUN_PTR = 23, ///< Invalid callback function pointer
ecINVALID_VAR_PTR = 24, ///< Invalid variable pointer
ecEMPTY_EXPRESSION = 25, ///< The Expression is empty
ecNAME_CONFLICT = 26, ///< Name conflict
ecOPT_PRI = 27, ///< Invalid operator priority
//
ecDOMAIN_ERROR = 28, ///< catch division by zero, sqrt(-1), log(0) (currently unused)
ecDIV_BY_ZERO = 29, ///< Division by zero (currently unused)
ecGENERIC = 30, ///< Generic error
ecLOCALE = 31, ///< Conflict with current locale
ecUNEXPECTED_CONDITIONAL = 32,
ecMISSING_ELSE_CLAUSE = 33,
ecMISPLACED_COLON = 34,
ecUNREASONABLE_NUMBER_OF_COMPUTATIONS = 35,
// The last two are special entries
ecCOUNT, ///< This is no error code, It just stores just the total number of error codes
ecUNDEFINED = -1 ///< Undefined message, placeholder to detect unassigned error messages
};
/// \return an error message for the given code.
string_type parser_error_for_code(EErrorCodes code);
// Compatibility with non-clang compilers.
#ifndef __has_attribute
#define __has_attribute(x) 0
#endif
// Define a type-level attribute declaring that this type, when used as the return value
// of a function, should produce warnings. Only clang supports this on types.
#if __clang__ && __has_attribute(warn_unused_result)
#define MUPARSER_ATTR_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
#else
#define MUPARSER_ATTR_WARN_UNUSED_RESULT
#endif
//---------------------------------------------------------------------------
/** \brief Error class of the parser.
\author Ingo Berg
Part of the math parser package.
*/
class ParserError {
private:
/** \brief Replace all ocuurences of a substring with another string. */
void ReplaceSubString(string_type &strSource, const string_type &strFind,
const string_type &strReplaceWith);
void Reset();
public:
ParserError();
explicit ParserError(EErrorCodes a_iErrc);
explicit ParserError(const string_type &sMsg);
ParserError(EErrorCodes a_iErrc, string_type sTok, int a_iPos = -1);
ParserError(EErrorCodes a_iErrc, int a_iPos, string_type sTok);
ParserError(const char_type *a_szMsg, int a_iPos = -1, string_type sTok = string_type());
ParserError(ParserError &&) = default;
ParserError &operator=(ParserError &&) = default;
ParserError(const ParserError &a_Obj) = default;
ParserError &operator=(const ParserError &a_Obj) = default;
~ParserError();
void SetFormula(const string_type &a_strFormula);
const string_type &GetExpr() const;
const string_type &GetMsg() const;
int GetPos() const;
const string_type &GetToken() const;
EErrorCodes GetCode() const;
private:
string_type m_strMsg; ///< The message string
string_type m_strTok; ///< Token related with the error
int m_iPos = -1; ///< Formula position related to the error
EErrorCodes m_iErrc = ecUNDEFINED; ///< Error code
} MUPARSER_ATTR_WARN_UNUSED_RESULT;
// OptionalError is used to optionally encapsulate an error.
class OptionalError {
std::unique_ptr<ParserError> error_{};
public:
/// Create an OptionalError that represents no error.
OptionalError() {}
/// Create an OptionalError for the given error.
/* implicit */ OptionalError(ParserError err) : error_(new ParserError(std::move(err))) {}
/// \return whether an error is present.
bool has_error() const { return bool(error_); }
/// \return the error. asserts if this is not an error.
const ParserError &error() const {
assert(error_ && "Value did not error");
return *error_;
}
} MUPARSER_ATTR_WARN_UNUSED_RESULT;
// ValueOrError is used to propagate failures to callers.
class ValueOrError {
value_type value_{0};
OptionalError error_{};
public:
/// \return true if this has a value, false if it is an error.
bool has_value() const { return !error_.has_error(); }
/// \return false if this has a value,true if it is an error.
bool has_error() const { return error_.has_error(); }
/// Construct from a value.
/* implicit */ ValueOrError(value_type value) : value_(value) {}
/// Construct from an error.
/* implicit */ ValueOrError(ParserError err) : error_(std::move(err)) {}
/// \return the error. asserts if this is not an error.
const ParserError &error() const { return error_.error(); }
/// \return the value. asserts if this is an error.
value_type value() const {
assert(has_value() && "Value is an error");
return value_;
}
/// \return whether this has a value.
explicit operator bool() const { return has_value(); }
value_type operator*() const {
assert(has_value() && "Cannot access value with error");
return value_;
}
} MUPARSER_ATTR_WARN_UNUSED_RESULT;
// Parser callbacks
/** \brief Callback type used for functions without arguments. */
typedef ValueOrError (*generic_fun_type)();
/** \brief Callback type used for functions without arguments. */
typedef ValueOrError (*fun_type0)();
/** \brief Callback type used for functions with a single arguments. */
typedef ValueOrError (*fun_type1)(value_type);
/** \brief Callback type used for functions with two arguments. */
typedef ValueOrError (*fun_type2)(value_type, value_type);
/** \brief Callback type used for functions with three arguments. */
typedef ValueOrError (*fun_type3)(value_type, value_type, value_type);
/** \brief Callback type used for functions with a variable argument list. */
typedef ValueOrError (*multfun_type)(const value_type *, int);
/** \brief Callback type used for functions taking a string as an argument. */
typedef ValueOrError (*strfun_type1)(const char_type *);
/** \brief Callback type used for functions taking a string and a value as arguments. */
typedef ValueOrError (*strfun_type2)(const char_type *, value_type);
/** \brief Callback type used for functions taking a string and two values as arguments. */
typedef ValueOrError (*strfun_type3)(const char_type *, value_type, value_type);
/** \brief Callback used for functions that identify values in a string. */
typedef int (*identfun_type)(const char_type *sExpr, int *nPos, value_type *fVal);
/** \brief Callback used for variable creation factory functions. */
typedef value_type *(*facfun_type)(const char_type *, void *);
} // end of namespace
#endif

View file

@ -1,124 +0,0 @@
/*
__________
_____ __ __\______ \_____ _______ ______ ____ _______
/ \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \
| Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/
|__|_| /|____/ |____| (____ /|__| /____ > \___ >|__|
\/ \/ \/ \/
Copyright (C) 2004-2013 Ingo Berg
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef MU_PARSER_INT_H
#define MU_PARSER_INT_H
#include <vector>
#include "muParserBase.h"
/** \file
\brief Definition of a parser using integer value.
*/
namespace mu {
/** \brief Mathematical expressions parser.
This version of the parser handles only integer numbers. It disables the built in operators thus
it is
slower than muParser. Integer values are stored in the double value_type and converted if needed.
*/
class ParserInt : public ParserBase {
private:
static int Round(value_type v) { return (int)(v + ((v >= 0) ? 0.5 : -0.5)); };
static ValueOrError Abs(value_type);
static ValueOrError Sign(value_type);
static ValueOrError Ite(value_type, value_type, value_type);
// !! The unary Minus is a MUST, otherwise you cant use negative signs !!
static ValueOrError UnaryMinus(value_type);
// Functions with variable number of arguments
static ValueOrError Sum(const value_type* a_afArg, int a_iArgc); // sum
static ValueOrError Min(const value_type* a_afArg, int a_iArgc); // minimum
static ValueOrError Max(const value_type* a_afArg, int a_iArgc); // maximum
// binary operator callbacks
static ValueOrError Add(value_type v1, value_type v2);
static ValueOrError Sub(value_type v1, value_type v2);
static ValueOrError Mul(value_type v1, value_type v2);
static ValueOrError Div(value_type v1, value_type v2);
static ValueOrError Mod(value_type v1, value_type v2);
static ValueOrError Pow(value_type v1, value_type v2);
static ValueOrError Shr(value_type v1, value_type v2);
static ValueOrError Shl(value_type v1, value_type v2);
static ValueOrError LogAnd(value_type v1, value_type v2);
static ValueOrError LogOr(value_type v1, value_type v2);
static ValueOrError And(value_type v1, value_type v2);
static ValueOrError Or(value_type v1, value_type v2);
static ValueOrError Xor(value_type v1, value_type v2);
static ValueOrError Less(value_type v1, value_type v2);
static ValueOrError Greater(value_type v1, value_type v2);
static ValueOrError LessEq(value_type v1, value_type v2);
static ValueOrError GreaterEq(value_type v1, value_type v2);
static ValueOrError Equal(value_type v1, value_type v2);
static ValueOrError NotEqual(value_type v1, value_type v2);
static ValueOrError Not(value_type v1);
static int IsHexVal(const char_type* a_szExpr, int* a_iPos, value_type* a_iVal);
static int IsBinVal(const char_type* a_szExpr, int* a_iPos, value_type* a_iVal);
static int IsVal(const char_type* a_szExpr, int* a_iPos, value_type* a_iVal);
/** \brief A facet class used to change decimal and thousands separator. */
template <class TChar>
class change_dec_sep : public std::numpunct<TChar> {
public:
explicit change_dec_sep(char_type cDecSep, char_type cThousandsSep = 0, int nGroup = 3)
: std::numpunct<TChar>(),
m_cDecPoint(cDecSep),
m_cThousandsSep(cThousandsSep),
m_nGroup(nGroup) {}
protected:
virtual char_type do_decimal_point() const { return m_cDecPoint; }
virtual char_type do_thousands_sep() const { return m_cThousandsSep; }
virtual std::string do_grouping() const {
// fix for issue 4: https://code.google.com/p/muparser/issues/detail?id=4
// courtesy of Jens Bartsch
// original code:
// return std::string(1, (char)m_nGroup);
// new code:
return std::string(1, (char)(m_cThousandsSep > 0 ? m_nGroup : CHAR_MAX));
}
private:
int m_nGroup;
char_type m_cDecPoint;
char_type m_cThousandsSep;
};
public:
ParserInt();
void InitFun() override;
void InitOprt() override;
void InitConst() override;
void InitCharSets() override;
};
} // namespace mu
#endif

View file

@ -1,175 +0,0 @@
/*
__________
_____ __ __\______ \_____ _______ ______ ____ _______
/ \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \
| Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/
|__|_| /|____/ |____| (____ /|__| /____ > \___ >|__|
\/ \/ \/ \/
Copyright (C) 2013 Ingo Berg
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef MU_PARSER_TEST_H
#define MU_PARSER_TEST_H
#include <cstdlib>
#include <numeric> // for accumulate
#include <string>
#include "muParser.h"
#include "muParserInt.h"
/** \file
\brief This file contains the parser test class.
*/
namespace mu {
/** \brief Namespace for test cases. */
namespace Test {
//------------------------------------------------------------------------------
/** \brief Test cases for unit testing.
(C) 2004-2011 Ingo Berg
*/
class ParserTester // final
{
private:
static int c_iCount;
// Multiarg callbacks
static ValueOrError f1of1(value_type v) { return v; };
static ValueOrError f1of2(value_type v, value_type) { return v; };
static ValueOrError f2of2(value_type, value_type v) { return v; };
static ValueOrError f1of3(value_type v, value_type, value_type) { return v; };
static ValueOrError f2of3(value_type, value_type v, value_type) { return v; };
static ValueOrError f3of3(value_type, value_type, value_type v) { return v; };
static ValueOrError Min(value_type a_fVal1, value_type a_fVal2) {
return (a_fVal1 < a_fVal2) ? a_fVal1 : a_fVal2;
}
static ValueOrError Max(value_type a_fVal1, value_type a_fVal2) {
return (a_fVal1 > a_fVal2) ? a_fVal1 : a_fVal2;
}
static ValueOrError plus2(value_type v1) { return v1 + 2; }
static ValueOrError times3(value_type v1) { return v1 * 3; }
static ValueOrError sqr(value_type v1) { return v1 * v1; }
static ValueOrError sign(value_type v) { return -v; }
static ValueOrError add(value_type v1, value_type v2) { return v1 + v2; }
static ValueOrError land(value_type v1, value_type v2) { return (int)v1 & (int)v2; }
static ValueOrError FirstArg(const value_type* a_afArg, int a_iArgc) {
if (!a_iArgc) return ParserError(_T("too few arguments for function FirstArg."));
return a_afArg[0];
}
static ValueOrError LastArg(const value_type* a_afArg, int a_iArgc) {
if (!a_iArgc) return ParserError(_T("too few arguments for function LastArg."));
return a_afArg[a_iArgc - 1];
}
static ValueOrError Sum(const value_type* a_afArg, int a_iArgc) {
if (!a_iArgc) return ParserError(_T("too few arguments for function sum."));
value_type fRes = 0;
for (int i = 0; i < a_iArgc; ++i) fRes += a_afArg[i];
return fRes;
}
static ValueOrError Rnd(value_type v) {
return (value_type)(1 + (v * std::rand() / (RAND_MAX + 1.0)));
}
static ValueOrError RndWithString(const char_type*) {
return (value_type)(1 + (1000.0f * std::rand() / (RAND_MAX + 1.0)));
}
static ValueOrError Ping() { return 10; }
static ValueOrError ValueOf(const char_type*) { return 123; }
static ValueOrError StrFun1(const char_type* v1) {
int val(0);
stringstream_type(v1) >> val;
return (value_type)val;
}
static ValueOrError StrFun2(const char_type* v1, value_type v2) {
int val(0);
stringstream_type(v1) >> val;
return (value_type)(val + v2);
}
static ValueOrError StrFun3(const char_type* v1, value_type v2, value_type v3) {
int val(0);
stringstream_type(v1) >> val;
return val + v2 + v3;
}
static ValueOrError StrToFloat(const char_type* a_szMsg) {
value_type val(0);
stringstream_type(a_szMsg) >> val;
return val;
}
// postfix operator callback
static ValueOrError Mega(value_type a_fVal) { return a_fVal * (value_type)1e6; }
static ValueOrError Micro(value_type a_fVal) { return a_fVal * (value_type)1e-6; }
static ValueOrError Milli(value_type a_fVal) { return a_fVal / (value_type)1e3; }
// Custom value recognition
static int IsHexVal(const char_type* a_szExpr, int* a_iPos, value_type* a_fVal);
int TestNames();
int TestSyntax();
int TestMultiArg();
int TestPostFix();
int TestExpression();
int TestInfixOprt();
int TestBinOprt();
int TestInterface();
int TestException();
int TestStrArg();
int TestIfThenElse();
void Abort() const;
public:
typedef int (ParserTester::*testfun_type)();
ParserTester();
void Run();
private:
std::vector<testfun_type> m_vTestFun;
void AddTest(testfun_type a_pFun);
// Test Double Parser
int EqnTest(const string_type& a_str, double a_fRes, bool a_fPass);
int EqnTestWithVarChange(const string_type& a_str, double a_fRes1, double a_fVar1,
double a_fRes2, double a_fVar2);
int ThrowTest(const string_type& a_str, int a_iErrc, bool a_bFail = true);
// Test Int Parser
int EqnTestInt(const string_type& a_str, double a_fRes, bool a_fPass);
};
} // namespace Test
} // namespace mu
#endif

View file

@ -1,343 +0,0 @@
/*
__________
_____ __ __\______ \_____ _______ ______ ____ _______
/ \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \
| Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/
|__|_| /|____/ |____| (____ /|__| /____ > \___ >|__|
\/ \/ \/ \/
Copyright (C) 2004-2013 Ingo Berg
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef MU_PARSER_TOKEN_H
#define MU_PARSER_TOKEN_H
#include <cassert>
#include <memory>
#include <stack>
#include <string>
#include <vector>
#include "muParserCallback.h"
/** \file
\brief This file contains the parser token definition.
*/
namespace mu {
/** \brief Encapsulation of the data for a single formula token.
Formula token implementation. Part of the Math Parser Package.
Formula tokens can be either one of the following:
<ul>
<li>value</li>
<li>variable</li>
<li>function with numerical arguments</li>
<li>functions with a string as argument</li>
<li>prefix operators</li>
<li>infix operators</li>
<li>binary operator</li>
</ul>
\author (C) 2004-2013 Ingo Berg
*/
template <typename TBase, typename TString>
class ParserToken {
private:
ECmdCode m_iCode; ///< Type of the token; The token type is a constant of type #ECmdCode.
ETypeCode m_iType;
void *m_pTok; ///< Stores Token pointer; not applicable for all tokens
int m_iIdx; ///< An otional index to an external buffer storing the token data
TString m_strTok; ///< Token string
TString m_strVal; ///< Value for string variables
value_type m_fVal; ///< the value
std::unique_ptr<ParserCallback> m_pCallback;
public:
//---------------------------------------------------------------------------
/** \brief Constructor (default).
Sets token to an neutral state of type cmUNKNOWN.
\sa ECmdCode
*/
ParserToken()
: m_iCode(cmUNKNOWN),
m_iType(tpVOID),
m_pTok(0),
m_iIdx(-1),
m_strTok(),
m_strVal(),
m_fVal(0),
m_pCallback() {}
//------------------------------------------------------------------------------
/** \brief Create token from another one.
Implemented by calling Assign(...)
\post m_iType==cmUNKNOWN
\sa #Assign
*/
ParserToken(const ParserToken &a_Tok) { Assign(a_Tok); }
//------------------------------------------------------------------------------
/** \brief Assignement operator.
Copy token state from another token and return this.
Implemented by calling Assign(...).
*/
ParserToken &operator=(const ParserToken &a_Tok) {
Assign(a_Tok);
return *this;
}
//------------------------------------------------------------------------------
/** \brief Copy token information from argument.
*/
void Assign(const ParserToken &a_Tok) {
m_iCode = a_Tok.m_iCode;
m_pTok = a_Tok.m_pTok;
m_strTok = a_Tok.m_strTok;
m_iIdx = a_Tok.m_iIdx;
m_strVal = a_Tok.m_strVal;
m_iType = a_Tok.m_iType;
m_fVal = a_Tok.m_fVal;
// create new callback object if a_Tok has one
m_pCallback.reset(a_Tok.m_pCallback ? new ParserCallback(*a_Tok.m_pCallback) : nullptr);
}
//------------------------------------------------------------------------------
/** \brief Assign a token type.
Token may not be of type value, variable or function. Those have seperate set functions.
\pre [assert] a_iType!=cmVAR
\pre [assert] a_iType!=cmVAL
\pre [assert] a_iType!=cmFUNC
\post m_fVal = 0
\post m_pTok = 0
*/
ParserToken &Set(ECmdCode a_iType, const TString &a_strTok = TString()) {
// The following types cant be set this way, they have special Set functions
assert(a_iType != cmVAR);
assert(a_iType != cmVAL);
assert(a_iType != cmFUNC);
m_iCode = a_iType;
m_iType = tpVOID;
m_pTok = 0;
m_strTok = a_strTok;
m_iIdx = -1;
return *this;
}
//------------------------------------------------------------------------------
/** \brief Set Callback type. */
ParserToken &Set(const ParserCallback &a_pCallback, const TString &a_sTok) {
assert(a_pCallback.GetAddr());
m_iCode = a_pCallback.GetCode();
m_iType = tpVOID;
m_strTok = a_sTok;
m_pCallback.reset(new ParserCallback(a_pCallback));
m_pTok = 0;
m_iIdx = -1;
return *this;
}
//------------------------------------------------------------------------------
/** \brief Make this token a value token.
Member variables not necessary for value tokens will be invalidated.
*/
ParserToken &SetVal(TBase a_fVal, const TString &a_strTok = TString()) {
m_iCode = cmVAL;
m_iType = tpDBL;
m_fVal = a_fVal;
m_strTok = a_strTok;
m_iIdx = -1;
m_pTok = 0;
m_pCallback.reset(0);
return *this;
}
//------------------------------------------------------------------------------
/** \brief make this token a variable token.
Member variables not necessary for variable tokens will be invalidated.
*/
ParserToken &SetVar(TBase *a_pVar, const TString &a_strTok) {
m_iCode = cmVAR;
m_iType = tpDBL;
m_strTok = a_strTok;
m_iIdx = -1;
m_pTok = (void *)a_pVar;
m_pCallback.reset(0);
return *this;
}
//------------------------------------------------------------------------------
/** \brief Make this token a variable token.
Member variables not necessary for variable tokens will be invalidated.
*/
ParserToken &SetString(const TString &a_strTok, std::size_t a_iSize) {
m_iCode = cmSTRING;
m_iType = tpSTR;
m_strTok = a_strTok;
m_iIdx = static_cast<int>(a_iSize);
m_pTok = 0;
m_pCallback.reset(0);
return *this;
}
//------------------------------------------------------------------------------
/** \brief Set an index associated with the token related data.
In cmSTRFUNC - This is the index to a string table in the main parser.
\param a_iIdx The index the string function result will take in the bytecode parser.
\throw exception_type if #a_iIdx<0 or #m_iType!=cmSTRING
*/
void SetIdx(int a_iIdx) {
if (m_iCode != cmSTRING || a_iIdx < 0) assert(0 && "muParser internal error");
m_iIdx = a_iIdx;
}
//------------------------------------------------------------------------------
/** \brief Return Index associated with the token related data.
In cmSTRFUNC - This is the index to a string table in the main parser.
\throw exception_type if #m_iIdx<0 or #m_iType!=cmSTRING
\return The index the result will take in the Bytecode calculatin array (#m_iIdx).
*/
int GetIdx() const {
if (m_iIdx < 0 || m_iCode != cmSTRING) assert(0 && "muParser internal error");
return m_iIdx;
}
//------------------------------------------------------------------------------
/** \brief Return the token type.
\return #m_iType
*/
ECmdCode GetCode() const {
if (m_pCallback.get()) {
return m_pCallback->GetCode();
} else {
return m_iCode;
}
}
//------------------------------------------------------------------------------
ETypeCode GetType() const {
if (m_pCallback.get()) {
return m_pCallback->GetType();
} else {
return m_iType;
}
}
//------------------------------------------------------------------------------
int GetPri() const {
if (!m_pCallback.get()) assert(0 && "muParser internal error");
if (m_pCallback->GetCode() != cmOPRT_BIN && m_pCallback->GetCode() != cmOPRT_INFIX)
assert(0 && "muParser internal error");
return m_pCallback->GetPri();
}
//------------------------------------------------------------------------------
EOprtAssociativity GetAssociativity() const {
if (m_pCallback.get() == NULL || m_pCallback->GetCode() != cmOPRT_BIN)
assert(0 && "muParser internal error");
return m_pCallback->GetAssociativity();
}
//------------------------------------------------------------------------------
/** \brief Return the address of the callback function assoziated with
function and operator tokens.
\return The pointer stored in #m_pTok.
*/
generic_fun_type GetFuncAddr() const {
return m_pCallback ? (generic_fun_type)m_pCallback->GetAddr() : nullptr;
}
//------------------------------------------------------------------------------
/** \brifef Get value of the token.
Only applicable to variable and value tokens.
*/
ValueOrError GetVal() const {
switch (m_iCode) {
case cmVAL:
return m_fVal;
case cmVAR:
return *((TBase *)m_pTok);
default:
return ParserError(ecVAL_EXPECTED);
}
}
//------------------------------------------------------------------------------
/** \brief Get address of a variable token.
Valid only if m_iType==CmdVar.
\throw exception_type if token is no variable token.
*/
TBase *GetVar() const {
if (m_iCode != cmVAR) assert(0 && "muParser internal error");
return (TBase *)m_pTok;
}
//------------------------------------------------------------------------------
/** \brief Return the number of function arguments.
Valid only if m_iType==CmdFUNC.
*/
int GetArgCount() const {
assert(m_pCallback.get());
if (!m_pCallback->GetAddr()) assert(0 && "muParser internal error");
return m_pCallback->GetArgc();
}
//------------------------------------------------------------------------------
/** \brief Return the token identifier.
If #m_iType is cmSTRING the token identifier is the value of the string argument
for a string function.
\return #m_strTok
\sa m_strTok
*/
const TString &GetAsString() const { return m_strTok; }
};
} // namespace mu
#endif

View file

@ -1,152 +0,0 @@
/*
__________
_____ __ __\______ \_____ _______ ______ ____ _______
/ \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \
| Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/
|__|_| /|____/ |____| (____ /|__| /____ > \___ >|__|
\/ \/ \/ \/
Copyright (C) 2004-2013 Ingo Berg
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef MU_PARSER_TOKEN_READER_H
#define MU_PARSER_TOKEN_READER_H
#include <cassert>
#include <cstdio>
#include <cstring>
#include <list>
#include <map>
#include <memory>
#include <stack>
#include <string>
#include "muParserDef.h"
#include "muParserToken.h"
/** \file
\brief This file contains the parser token reader definition.
*/
namespace mu {
// Forward declaration
class ParserBase;
/** \brief Token reader for the ParserBase class.
*/
class ParserTokenReader final {
private:
typedef ParserToken<value_type, string_type> token_type;
public:
ParserTokenReader(ParserBase *a_pParent);
void AddValIdent(identfun_type a_pCallback);
void SetVarCreator(facfun_type a_pFactory, void *pUserData);
void SetFormula(const string_type &a_strFormula);
void SetArgSep(char_type cArgSep);
int GetPos() const;
const string_type &GetExpr() const;
char_type GetArgSep() const;
void IgnoreUndefVar(bool bIgnore);
void ReInit();
token_type ReadNextToken();
/// \return the first error (if any), clearing it.
OptionalError acquireFirstError() {
OptionalError ret = std::move(firstError_);
firstError_ = OptionalError{};
return ret;
}
private:
/** \brief Syntax codes.
The syntax codes control the syntax check done during the first time parsing of
the expression string. They are flags that indicate which tokens are allowed next
if certain tokens are identified.
*/
enum ESynCodes {
noBO = 1 << 0, ///< to avoid i.e. "cos(7)("
noBC = 1 << 1, ///< to avoid i.e. "sin)" or "()"
noVAL = 1 << 2, ///< to avoid i.e. "tan 2" or "sin(8)3.14"
noVAR = 1 << 3, ///< to avoid i.e. "sin a" or "sin(8)a"
noARG_SEP = 1 << 4, ///< to avoid i.e. ",," or "+," ...
noFUN = 1 << 5, ///< to avoid i.e. "sqrt cos" or "(1)sin"
noOPT = 1 << 6, ///< to avoid i.e. "(+)"
noPOSTOP = 1 << 7, ///< to avoid i.e. "(5!!)" "sin!"
noINFIXOP = 1 << 8, ///< to avoid i.e. "++4" "!!4"
noEND = 1 << 9, ///< to avoid unexpected end of formula
noSTR = 1 << 10, ///< to block numeric arguments on string functions
noASSIGN = 1 << 11, ///< to block assignement to constant i.e. "4=7"
noIF = 1 << 12,
noELSE = 1 << 13,
sfSTART_OF_LINE = noOPT | noBC | noPOSTOP | noASSIGN | noIF | noELSE | noARG_SEP,
noANY = ~0 ///< All of he above flags set
};
ParserTokenReader(const ParserTokenReader &a_Reader) = delete;
ParserTokenReader &operator=(const ParserTokenReader &a_Reader) = delete;
void SetParent(ParserBase *a_pParent);
int ExtractToken(const char_type *a_szCharSet, string_type &a_strTok, int a_iPos) const;
int ExtractOperatorToken(string_type &a_sTok, int a_iPos) const;
bool IsBuiltIn(token_type &a_Tok);
bool IsArgSep(token_type &a_Tok);
bool IsEOF(token_type &a_Tok);
bool IsInfixOpTok(token_type &a_Tok);
bool IsFunTok(token_type &a_Tok);
bool IsPostOpTok(token_type &a_Tok);
bool IsOprt(token_type &a_Tok);
bool IsValTok(token_type &a_Tok);
bool IsVarTok(token_type &a_Tok);
bool IsStrVarTok(token_type &a_Tok);
bool IsUndefVarTok(token_type &a_Tok);
bool IsString(token_type &a_Tok);
bool Error(EErrorCodes a_iErrc, int a_iPos = -1, const string_type &a_sTok = string_type());
token_type &SaveBeforeReturn(const token_type &tok);
ParserBase *m_pParser;
string_type m_strFormula;
int m_iPos = 0;
int m_iSynFlags = 0;
bool m_bIgnoreUndefVar = false;
OptionalError firstError_; /// The first error reported during parsing.
const funmap_type *m_pFunDef = nullptr;
const funmap_type *m_pPostOprtDef = nullptr;
const funmap_type *m_pInfixOprtDef = nullptr;
const funmap_type *m_pOprtDef = nullptr;
const valmap_type *m_pConstDef = nullptr;
const strmap_type *m_pStrVarDef = nullptr;
varmap_type *m_pVarDef = nullptr; ///< The only non const pointer to parser internals
facfun_type m_pFactory = nullptr;
void *m_pFactoryData = nullptr;
std::list<identfun_type> m_vIdentFun; ///< Value token identification function
varmap_type m_UsedVar;
value_type m_fZero = 0; ///< Dummy value of zero, referenced by undefined variables
int m_iBrackets = 0;
token_type m_lastTok;
char_type m_cArgSep = ','; ///< The character used for separating function arguments
};
} // namespace mu
#endif

View file

@ -1 +0,0 @@
Here goes the libraries (both static and shared) for this component.

View file

@ -1,353 +0,0 @@
//---------------------------------------------------------------------------
//
// __________
// _____ __ __\______ \_____ _______ ______ ____ _______
// / \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ |
// | Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/
// |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__|
// \/ \/ \/ \/
// (C) 2015 Ingo Berg
//
// example1.cpp - using the parser as a static library
//
//---------------------------------------------------------------------------
#include "muParserTest.h"
#if defined(_WIN32) && defined(_DEBUG)
#define _CRTDBG_MAP_ALLOC
#include <crtdbg.h>
#include <stdlib.h>
#define CREATE_LEAKAGE_REPORT
#endif
#if defined(USINGDLL) && defined(_WIN32)
#error This sample can be used only with STATIC builds of muParser (on win32)
#endif
/** \brief This macro will enable mathematical constants like M_PI. */
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <ios>
#include <iostream>
#include <limits>
#include <locale>
#include <numeric>
#include <string>
#include "muParser.h"
using namespace std;
using namespace mu;
#if defined(CREATE_LEAKAGE_REPORT)
// Dumping memory leaks in the destructor of the static guard
// guarantees i won't get false positives from the ParserErrorMsg
// class wich is a singleton with a static instance.
struct DumpLeaks {
~DumpLeaks() { _CrtDumpMemoryLeaks(); }
} static LeakDumper;
#endif
// Operator callback functions
ValueOrError Mega(value_type a_fVal) { return a_fVal * 1e6; }
ValueOrError Milli(value_type a_fVal) { return a_fVal / (value_type)1e3; }
ValueOrError Rnd(value_type v) { return v * std::rand() / (value_type)(RAND_MAX + 1.0); }
ValueOrError Not(value_type v) { return v == 0; }
ValueOrError Add(value_type v1, value_type v2) { return v1 + v2; }
ValueOrError Mul(value_type v1, value_type v2) { return v1 * v2; }
//---------------------------------------------------------------------------
ValueOrError ThrowAnException(value_type) {
throw std::runtime_error("This function does throw an exception.");
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
ValueOrError Ping() {
mu::console() << "ping\n";
return 0;
}
//---------------------------------------------------------------------------
ValueOrError StrFun0(const char_type *szMsg) {
if (szMsg) mu::console() << szMsg << std::endl;
return 999;
}
//---------------------------------------------------------------------------
ValueOrError StrFun2(const char_type *v1, value_type v2, value_type v3) {
mu::console() << v1 << std::endl;
return v2 + v3;
}
//---------------------------------------------------------------------------
ValueOrError Debug(mu::value_type v1, mu::value_type v2) {
ParserBase::EnableDebugDump(v1 != 0, v2 != 0);
mu::console() << _T("Bytecode dumping ") << ((v1 != 0) ? _T("active") : _T("inactive"))
<< _T("\n");
return 1;
}
//---------------------------------------------------------------------------
// Factory function for creating new parser variables
// This could as well be a function performing database queries.
value_type *AddVariable(const char_type *a_szName, void *a_pUserData) {
// I don't want dynamic allocation here, so i used this static buffer
// If you want dynamic allocation you must allocate all variables dynamically
// in order to delete them later on. Or you find other ways to keep track of
// variables that have been created implicitely.
static value_type afValBuf[100];
static int iVal = -1;
++iVal;
mu::console() << _T("Generating new variable \"") << a_szName << std::dec
<< _T("\" (slots left: ") << 99 - iVal << _T(")")
<< _T(" User data pointer is:") << std::hex << a_pUserData << endl;
afValBuf[iVal] = 0;
if (iVal >= 99)
throw mu::ParserError(_T("Variable buffer overflow."));
else
return &afValBuf[iVal];
}
int IsHexValue(const char_type *a_szExpr, int *a_iPos, value_type *a_fVal) {
if (a_szExpr[1] == 0 || (a_szExpr[0] != '0' || a_szExpr[1] != 'x')) return 0;
unsigned iVal(0);
// New code based on streams for UNICODE compliance:
stringstream_type::pos_type nPos(0);
stringstream_type ss(a_szExpr + 2);
ss >> std::hex >> iVal;
nPos = ss.tellg();
if (nPos == (stringstream_type::pos_type)0) return 1;
*a_iPos += (int)(2 + nPos);
*a_fVal = (value_type)iVal;
return 1;
}
//---------------------------------------------------------------------------
void Splash() {
mu::console() << _T(" __________ \n");
mu::console() << _T(" _____ __ __\\______ \\_____ _______ ______ ____ _______\n");
mu::console()
<< _T(" / \\ | | \\| ___/\\__ \\ \\_ __ \\/ ___/_/ __ \\\\_ __ \\ \n");
mu::console()
<< _T(" | Y Y \\| | /| | / __ \\_| | \\/\\___ \\ \\ ___/ | | \\/ \n");
mu::console() << _T(" |__|_| /|____/ |____| (____ /|__| /____ > \\___ >|__| \n");
mu::console() << _T(" \\/ \\/ \\/ \\/ \n");
mu::console() << _T(" (C) 2015 Ingo Berg\n");
}
//---------------------------------------------------------------------------
ValueOrError SelfTest() {
mu::console() << _T( "-----------------------------------------------------------\n");
mu::console() << _T( "Running test suite:\n\n");
// Skip the self test if the value type is set to an integer type.
if (std::numeric_limits<mu::value_type>::is_integer) {
mu::console()
<< _T( " Test skipped: integer data type are not compatible with the unit test!\n\n");
} else {
mu::Test::ParserTester pt;
pt.Run();
}
return 0;
}
//---------------------------------------------------------------------------
ValueOrError Help() {
mu::console() << _T( "-----------------------------------------------------------\n");
mu::console() << _T( "Commands:\n\n");
mu::console() << _T( " list var - list parser variables\n");
mu::console() << _T( " list exprvar - list expression variables\n");
mu::console() << _T( " list const - list all numeric parser constants\n");
mu::console() << _T( " locale de - switch to german locale\n");
mu::console() << _T( " locale en - switch to english locale\n");
mu::console() << _T( " locale reset - reset locale\n");
mu::console() << _T( " quit - exits the parser\n");
mu::console() << _T( "\nConstants:\n\n");
mu::console() << _T( " \"_e\" 2.718281828459045235360287\n");
mu::console() << _T( " \"_pi\" 3.141592653589793238462643\n");
mu::console() << _T( "-----------------------------------------------------------\n");
return 0;
}
//---------------------------------------------------------------------------
/** \brief Check for external keywords.
*/
int CheckKeywords(const mu::char_type *a_szLine, mu::Parser &a_Parser) {
string_type sLine(a_szLine);
if (sLine == _T("quit")) {
return -1;
} else if (sLine == _T("locale de")) {
mu::console() << _T("Setting german locale: ArgSep=';' DecSep=',' ThousandsSep='.'\n");
a_Parser.SetArgSep(';');
a_Parser.SetDecSep(',');
a_Parser.SetThousandsSep('.');
return 1;
} else if (sLine == _T("locale en")) {
mu::console() << _T("Setting english locale: ArgSep=',' DecSep='.' ThousandsSep=''\n");
a_Parser.SetArgSep(',');
a_Parser.SetDecSep('.');
a_Parser.SetThousandsSep();
return 1;
} else if (sLine == _T("locale reset")) {
mu::console() << _T("Resetting locale\n");
a_Parser.ResetLocale();
return 1;
}
return 0;
}
//---------------------------------------------------------------------------
void Calc() {
mu::Parser parser;
// Change locale settings if necessary
// function argument separator: sum(2;3;4) vs. sum(2,3,4)
// decimal separator: 3,14 vs. 3.14
// thousands separator: 1000000 vs 1.000.000
//#define USE_GERMAN_LOCALE
#ifdef USE_GERMAN_LOCALE
parser.SetArgSep(';');
parser.SetDecSep(',');
parser.SetThousandsSep('.');
#else
// this is the default, so i it's commented:
// parser.SetArgSep(',');
// parser.SetDecSep('.');
// parser.SetThousandsSep('');
#endif
// Add some variables
value_type vVarVal[] = {1, 2}; // Values of the parser variables
parser.DefineVar(_T("a"),
&vVarVal[0]); // Assign Variable names and bind them to the C++ variables
parser.DefineVar(_T("b"), &vVarVal[1]);
parser.DefineVar(_T("ft"), &vVarVal[1]);
parser.DefineStrConst(_T("sVar1"), _T("Sample string 1"));
parser.DefineStrConst(_T("sVar2"), _T("Sample string 2"));
parser.AddValIdent(IsHexValue);
// Add user defined unary operators
parser.DefinePostfixOprt(_T("M"), Mega);
parser.DefinePostfixOprt(_T("m"), Milli);
parser.DefineInfixOprt(_T("!"), Not);
parser.DefineFun(_T("strfun0"), StrFun0);
parser.DefineFun(_T("strfun2"), StrFun2);
parser.DefineFun(_T("ping"), Ping);
parser.DefineFun(_T("rnd"), Rnd);
parser.DefineFun(_T("throw"), ThrowAnException);
parser.DefineOprt(_T("add"), Add, 0);
parser.DefineOprt(_T("mul"), Mul, 1);
// These are service and debug functions
parser.DefineFun(_T("debug"), Debug);
parser.DefineFun(_T("selftest"), SelfTest);
parser.DefineFun(_T("help"), Help);
parser.DefinePostfixOprt(_T("{ft}"), Milli);
parser.DefinePostfixOprt(_T("ft"), Milli);
#ifdef _DEBUG
// parser.EnableDebugDump(1, 0);
#endif
// Define the variable factory
parser.SetVarFactory(AddVariable, &parser);
for (;;) {
try {
string_type sLine;
std::getline(mu::console_in(), sLine);
switch (CheckKeywords(sLine.c_str(), parser)) {
case 0:
break;
case 1:
continue;
case -1:
return;
}
if (!sLine.length()) continue;
parser.SetExpr(sLine);
mu::console() << std::setprecision(12);
// There are multiple ways to retrieve the result...
// 1.) If you know there is only a single return value or in case you only need the last
// result of an expression consisting of comma separated subexpressions you can
// simply use:
mu::console() << _T("ans=") << *parser.Eval() << _T("\n");
// 2.) As an alternative you can also retrieve multiple return values using this API:
int nNum = parser.GetNumResults();
if (nNum > 1) {
mu::console() << _T("Multiple return values detected! Complete list:\n");
// this is the hard way if you need to retrieve multiple subexpression
// results
std::vector<ValueOrError> vs;
parser.Eval(&vs);
mu::console() << std::setprecision(12);
for (const ValueOrError &v : vs) {
mu::console() << *v << _T("\n");
}
}
} catch (mu::Parser::exception_type &e) {
mu::console() << _T("\nError:\n");
mu::console() << _T("------\n");
mu::console() << _T("Message: ") << e.GetMsg() << _T("\n");
mu::console() << _T("Token: \"") << e.GetToken() << _T("\"\n");
mu::console() << _T("Position: ") << (int)e.GetPos() << _T("\n");
mu::console() << _T("Errc: ") << std::dec << e.GetCode() << _T("\n");
}
} // while running
}
//---------------------------------------------------------------------------
int main(int, char **) {
Splash();
(void)SelfTest();
(void)Help();
// CheckLocale();
// CheckDiff();
mu::console() << _T("Enter an expression or a command:\n");
try {
Calc();
} catch (Parser::exception_type &e) {
// Only erros raised during the initialization will end up here
// formula related errors are treated in Calc()
console() << _T("Initialization error: ") << e.GetMsg() << endl;
console() << _T("aborting...") << endl;
string_type sBuf;
console_in() >> sBuf;
} catch (std::exception & /*exc*/) {
// there is no unicode compliant way to query exc.what()
// so i'll leave it for this example.
console() << _T("aborting...\n");
}
return 0;
}

View file

@ -1,305 +0,0 @@
/*
__________
_____ __ __\______ \_____ _______ ______ ____ _______
/ \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \
| Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/
|__|_| /|____/ |____| (____ /|__| /____ > \___ >|__|
\/ \/ \/ \/
Copyright (C) 2013 Ingo Berg
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "muParser.h"
//--- Standard includes ------------------------------------------------------------------------
#include <algorithm>
#include <cmath>
#include <limits>
#include <numeric>
/** \brief Pi (what else?). */
#define PARSER_CONST_PI 3.141592653589793238462643
/** \brief The Eulerian number. */
#define PARSER_CONST_E 2.718281828459045235360287
using namespace std;
/** \file
\brief Implementation of the standard floating point parser.
*/
/** \brief Namespace for mathematical applications. */
namespace mu {
//---------------------------------------------------------------------------
// Trigonometric function
ValueOrError Parser::Sin(value_type v) { return std::sin(v); }
ValueOrError Parser::Cos(value_type v) { return std::cos(v); }
ValueOrError Parser::Tan(value_type v) { return std::tan(v); }
ValueOrError Parser::ASin(value_type v) { return std::asin(v); }
ValueOrError Parser::ACos(value_type v) { return std::acos(v); }
ValueOrError Parser::ATan(value_type v) { return std::atan(v); }
ValueOrError Parser::ATan2(value_type v1, value_type v2) { return std::atan2(v1, v2); }
ValueOrError Parser::Sinh(value_type v) { return std::sinh(v); }
ValueOrError Parser::Cosh(value_type v) { return std::cosh(v); }
ValueOrError Parser::Tanh(value_type v) { return std::tanh(v); }
ValueOrError Parser::ASinh(value_type v) { return std::asinh(v); }
ValueOrError Parser::ACosh(value_type v) { return std::acosh(v); }
ValueOrError Parser::ATanh(value_type v) { return std::atanh(v); }
//---------------------------------------------------------------------------
// Logarithm functions
// Logarithm base 2
ValueOrError Parser::Log2(value_type v) {
#ifdef MUP_MATH_EXCEPTIONS
if (v <= 0) return ParserError(ecDOMAIN_ERROR, _T("Log2"));
#endif
return std::log2(v);
}
// Logarithm base 10
ValueOrError Parser::Log10(value_type v) {
#ifdef MUP_MATH_EXCEPTIONS
if (v <= 0) return ParserError(ecDOMAIN_ERROR, _T("Log10"));
#endif
return std::log10(v);
}
// Logarithm base e (natural logarithm)
ValueOrError Parser::Ln(value_type v) {
#ifdef MUP_MATH_EXCEPTIONS
if (v <= 0) return ParserError(ecDOMAIN_ERROR, _T("Ln"));
#endif
return std::log(v);
}
//---------------------------------------------------------------------------
// misc
ValueOrError Parser::Exp(value_type v) { return std::exp(v); }
ValueOrError Parser::Abs(value_type v) { return std::abs(v); }
ValueOrError Parser::Sqrt(value_type v) {
#ifdef MUP_MATH_EXCEPTIONS
if (v < 0) return ParserError(ecDOMAIN_ERROR, _T("sqrt"));
#endif
return std::sqrt(v);
}
ValueOrError Parser::Rint(value_type v) { return std::floor(v + 0.5); }
ValueOrError Parser::Sign(value_type v) {
// return 1, 0, -1 according to whether v is positive, zero, negative.
return (v > 0) - (v < 0);
}
//---------------------------------------------------------------------------
/** \brief Callback for the unary minus operator.
\param v The value to negate
\return -v
*/
ValueOrError Parser::UnaryMinus(value_type v) { return -v; }
//---------------------------------------------------------------------------
/** \brief Callback for the unary minus operator.
\param v The value to negate
\return -v
*/
ValueOrError Parser::UnaryPlus(value_type v) { return v; }
//---------------------------------------------------------------------------
/** \brief Callback for adding multiple values.
\param [in] a_afArg Vector with the function arguments
\param [in] a_iArgc The size of a_afArg
*/
ValueOrError Parser::Sum(const value_type *a_afArg, int a_iArgc) {
if (!a_iArgc) return ParserError(_T("too few arguments for function sum."));
value_type fRes = 0;
for (int i = 0; i < a_iArgc; ++i) fRes += a_afArg[i];
return fRes;
}
//---------------------------------------------------------------------------
/** \brief Callback for averaging multiple values.
\param [in] a_afArg Vector with the function arguments
\param [in] a_iArgc The size of a_afArg
*/
ValueOrError Parser::Avg(const value_type *a_afArg, int a_iArgc) {
if (!a_iArgc) return ParserError(_T("too few arguments for function sum."));
value_type fRes = 0;
for (int i = 0; i < a_iArgc; ++i) fRes += a_afArg[i];
return fRes / (value_type)a_iArgc;
}
//---------------------------------------------------------------------------
/** \brief Callback for determining the minimum value out of a vector.
\param [in] a_afArg Vector with the function arguments
\param [in] a_iArgc The size of a_afArg
*/
ValueOrError Parser::Min(const value_type *a_afArg, int a_iArgc) {
if (!a_iArgc) return ParserError(_T("too few arguments for function min."));
value_type fRes = a_afArg[0];
for (int i = 0; i < a_iArgc; ++i) fRes = std::min(fRes, a_afArg[i]);
return fRes;
}
//---------------------------------------------------------------------------
/** \brief Callback for determining the maximum value out of a vector.
\param [in] a_afArg Vector with the function arguments
\param [in] a_iArgc The size of a_afArg
*/
ValueOrError Parser::Max(const value_type *a_afArg, int a_iArgc) {
if (!a_iArgc) return ParserError(_T("too few arguments for function max."));
value_type fRes = a_afArg[0];
for (int i = 0; i < a_iArgc; ++i) fRes = std::max(fRes, a_afArg[i]);
return fRes;
}
//---------------------------------------------------------------------------
/** \brief Default value recognition callback.
\param [in] a_szExpr Pointer to the expression
\param [in, out] a_iPos Pointer to an index storing the current position within the expression
\param [out] a_fVal Pointer where the value should be stored in case one is found.
\return 1 if a value was found 0 otherwise.
*/
int Parser::IsVal(const char_type *a_szExpr, int *a_iPos, value_type *a_fVal) {
value_type fVal(0);
stringstream_type stream(a_szExpr);
stream.seekg(0); // todo: check if this really is necessary
stream.imbue(Parser::s_locale);
stream >> fVal;
stringstream_type::pos_type iEnd = stream.tellg(); // Position after reading
if (iEnd == (stringstream_type::pos_type)-1) return 0;
*a_iPos += (int)iEnd;
*a_fVal = fVal;
return 1;
}
//---------------------------------------------------------------------------
/** \brief Constructor.
Call ParserBase class constructor and trigger Function, Operator and Constant initialization.
*/
Parser::Parser() : ParserBase() {
AddValIdent(IsVal);
InitCharSets();
InitFun();
InitConst();
InitOprt();
}
//---------------------------------------------------------------------------
/** \brief Define the character sets.
\sa DefineNameChars, DefineOprtChars, DefineInfixOprtChars
This function is used for initializing the default character sets that define
the characters to be useable in function and variable names and operators.
*/
void Parser::InitCharSets() {
DefineNameChars(_T("0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"));
DefineOprtChars(_T("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+-*^/?<>=#!$%&|~'_{}"));
DefineInfixOprtChars(_T("/+-*^?<>=#!$%&|~'_"));
}
/// assert that the given optional error \p oerr is not an error.
/// This is used only during initialization, when it ought to be impossible
/// to generate an error.
static void assertNoError(OptionalError oerr) {
assert(!oerr.has_error() && "Unexpected error during initialization");
(void)oerr;
}
//---------------------------------------------------------------------------
/** \brief Initialize the default functions. */
void Parser::InitFun() {
if (std::numeric_limits<mu::value_type>::is_integer) {
// When setting MUP_BASETYPE to an integer type
// Place functions for dealing with integer values here
// ...
// ...
// ...
} else {
// trigonometric functions
assertNoError(DefineFun(_T("sin"), Sin));
assertNoError(DefineFun(_T("cos"), Cos));
assertNoError(DefineFun(_T("tan"), Tan));
// arcus functions
assertNoError(DefineFun(_T("asin"), ASin));
assertNoError(DefineFun(_T("acos"), ACos));
assertNoError(DefineFun(_T("atan"), ATan));
assertNoError(DefineFun(_T("atan2"), ATan2));
// hyperbolic functions
assertNoError(DefineFun(_T("sinh"), Sinh));
assertNoError(DefineFun(_T("cosh"), Cosh));
assertNoError(DefineFun(_T("tanh"), Tanh));
// arcus hyperbolic functions
assertNoError(DefineFun(_T("asinh"), ASinh));
assertNoError(DefineFun(_T("acosh"), ACosh));
assertNoError(DefineFun(_T("atanh"), ATanh));
// Logarithm functions
assertNoError(DefineFun(_T("log2"), Log2));
assertNoError(DefineFun(_T("log10"), Log10));
assertNoError(DefineFun(_T("log"), Ln));
assertNoError(DefineFun(_T("ln"), Ln));
// misc
assertNoError(DefineFun(_T("exp"), Exp));
assertNoError(DefineFun(_T("sqrt"), Sqrt));
assertNoError(DefineFun(_T("sign"), Sign));
assertNoError(DefineFun(_T("rint"), Rint));
assertNoError(DefineFun(_T("abs"), Abs));
// Functions with variable number of arguments
assertNoError(DefineFun(_T("sum"), Sum));
assertNoError(DefineFun(_T("avg"), Avg));
assertNoError(DefineFun(_T("min"), Min));
assertNoError(DefineFun(_T("max"), Max));
}
}
//---------------------------------------------------------------------------
/** \brief Initialize constants.
By default the parser recognizes two constants. Pi ("pi") and the Eulerian
number ("_e").
*/
void Parser::InitConst() {
assertNoError(DefineConst(_T("_pi"), (value_type)PARSER_CONST_PI));
assertNoError(DefineConst(_T("_e"), (value_type)PARSER_CONST_E));
}
//---------------------------------------------------------------------------
/** \brief Initialize operators.
By default only the unary minus operator is added.
*/
void Parser::InitOprt() {
assertNoError(DefineInfixOprt(_T("-"), UnaryMinus));
assertNoError(DefineInfixOprt(_T("+"), UnaryPlus));
}
} // namespace mu

File diff suppressed because it is too large Load diff

View file

@ -1,338 +0,0 @@
/*
__________
_____ __ __\______ \_____ _______ ______ ____ _______
/ \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \
| Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/
|__|_| /|____/ |____| (____ /|__| /____ > \___ >|__|
\/ \/ \/ \/
Copyright (C) 2011 Ingo Berg
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "muParserBytecode.h"
#include <algorithm>
#include <cassert>
#include <iostream>
#include <stack>
#include <string>
#include <vector>
#include "muParserDef.h"
#include "muParserToken.h"
namespace mu {
//---------------------------------------------------------------------------
/** \brief Bytecode default constructor. */
ParserByteCode::ParserByteCode() : m_iStackPos(0), m_iMaxStackSize(0), m_vRPN() {
m_vRPN.reserve(50);
}
//---------------------------------------------------------------------------
/** \brief Add a Variable pointer to bytecode.
\param a_pVar Pointer to be added.
*/
void ParserByteCode::AddVar(value_type *a_pVar) {
++m_iStackPos;
m_iMaxStackSize = std::max(m_iMaxStackSize, (size_t)m_iStackPos);
SToken tok;
tok.Cmd = cmVAR;
tok.Val.ptr = a_pVar;
tok.Val.data = 0;
m_vRPN.push_back(tok);
}
//---------------------------------------------------------------------------
/** \brief Add a Variable pointer to bytecode.
Value entries in byte code consist of:
<ul>
<li>value array position of the value</li>
<li>the operator code according to ParserToken::cmVAL</li>
<li>the value stored in #mc_iSizeVal number of bytecode entries.</li>
</ul>
\param a_pVal Value to be added.
*/
void ParserByteCode::AddVal(value_type a_fVal) {
++m_iStackPos;
m_iMaxStackSize = std::max(m_iMaxStackSize, (size_t)m_iStackPos);
// If optimization does not apply
SToken tok;
tok.Cmd = cmVAL;
tok.Val.ptr = NULL;
tok.Val.data = a_fVal;
m_vRPN.push_back(tok);
}
//---------------------------------------------------------------------------
/** \brief Add an operator identifier to bytecode.
Operator entries in byte code consist of:
<ul>
<li>value array position of the result</li>
<li>the operator code according to ParserToken::ECmdCode</li>
</ul>
\sa ParserToken::ECmdCode
*/
void ParserByteCode::AddOp(ECmdCode a_Oprt) {
--m_iStackPos;
SToken tok;
tok.Cmd = a_Oprt;
m_vRPN.push_back(tok);
}
//---------------------------------------------------------------------------
void ParserByteCode::AddIfElse(ECmdCode a_Oprt) {
SToken tok;
tok.Cmd = a_Oprt;
m_vRPN.push_back(tok);
}
//---------------------------------------------------------------------------
/** \brief Add an assignment operator
Operator entries in byte code consist of:
<ul>
<li>cmASSIGN code</li>
<li>the pointer of the destination variable</li>
</ul>
\sa ParserToken::ECmdCode
*/
void ParserByteCode::AddAssignOp(value_type *a_pVar) {
--m_iStackPos;
SToken tok;
tok.Cmd = cmASSIGN;
tok.Oprt.ptr = a_pVar;
m_vRPN.push_back(tok);
}
//---------------------------------------------------------------------------
/** \brief Add function to bytecode.
\param a_iArgc Number of arguments, negative numbers indicate multiarg functions.
\param a_pFun Pointer to function callback.
*/
void ParserByteCode::AddFun(generic_fun_type a_pFun, int a_iArgc) {
if (a_iArgc >= 0) {
m_iStackPos = m_iStackPos - a_iArgc + 1;
} else {
// function with unlimited number of arguments
m_iStackPos = m_iStackPos + a_iArgc + 1;
}
m_iMaxStackSize = std::max(m_iMaxStackSize, (size_t)m_iStackPos);
SToken tok;
tok.Cmd = cmFUNC;
tok.Fun.argc = a_iArgc;
tok.Fun.ptr = a_pFun;
m_vRPN.push_back(tok);
}
//---------------------------------------------------------------------------
/** \brief Add String function entry to the parser bytecode.
A string function entry consists of the stack position of the return value,
followed by a cmSTRFUNC code, the function pointer and an index into the
string buffer maintained by the parser.
*/
void ParserByteCode::AddStrFun(generic_fun_type a_pFun, int a_iArgc, int a_iIdx) {
m_iStackPos = m_iStackPos - a_iArgc + 1;
SToken tok;
tok.Cmd = cmFUNC_STR;
tok.Fun.argc = a_iArgc;
tok.Fun.idx = a_iIdx;
tok.Fun.ptr = a_pFun;
m_vRPN.push_back(tok);
m_iMaxStackSize = std::max(m_iMaxStackSize, (size_t)m_iStackPos);
}
//---------------------------------------------------------------------------
/** \brief Add end marker to bytecode.
*/
void ParserByteCode::Finalize() {
SToken tok;
tok.Cmd = cmEND;
m_vRPN.push_back(tok);
m_vRPN.shrink_to_fit();
// Determine the if-then-else jump offsets
ParserStack<int> stIf, stElse;
for (int i = 0; i < (int)m_vRPN.size(); ++i) {
switch (m_vRPN[i].Cmd) {
case cmIF:
stIf.push_back(i);
break;
case cmELSE: {
int idx = stIf.back();
stIf.pop_back();
m_vRPN[idx].Oprt.offset = i - idx;
stElse.push_back(i);
break;
}
case cmENDIF: {
int idx = stElse.back();
stElse.pop_back();
m_vRPN[idx].Oprt.offset = i - idx;
break;
}
default:
break;
}
}
}
//---------------------------------------------------------------------------
const SToken *ParserByteCode::GetBase() const {
if (m_vRPN.size() == 0) assert(0 && "muParser internal error");
return &m_vRPN[0];
}
//---------------------------------------------------------------------------
std::size_t ParserByteCode::GetMaxStackSize() const { return m_iMaxStackSize + 1; }
//---------------------------------------------------------------------------
/** \brief Returns the number of entries in the bytecode. */
std::size_t ParserByteCode::GetSize() const { return m_vRPN.size(); }
//---------------------------------------------------------------------------
/** \brief Delete the bytecode.
The name of this function is a violation of my own coding guidelines
but this way it's more in line with the STL functions thus more
intuitive.
*/
void ParserByteCode::clear() {
m_vRPN.clear();
m_iStackPos = 0;
m_iMaxStackSize = 0;
}
//---------------------------------------------------------------------------
/** \brief Dump bytecode (for debugging only!). */
void ParserByteCode::AsciiDump() {
if (!m_vRPN.size()) {
mu::console() << _T("No bytecode available\n");
return;
}
mu::console() << _T("Number of RPN tokens:") << (int)m_vRPN.size() << _T("\n");
for (std::size_t i = 0; i < m_vRPN.size() && m_vRPN[i].Cmd != cmEND; ++i) {
mu::console() << std::dec << i << _T(" : \t");
switch (m_vRPN[i].Cmd) {
case cmVAL:
mu::console() << _T("VAL \t");
mu::console() << _T("[") << m_vRPN[i].Val.data << _T("]\n");
break;
case cmVAR:
mu::console() << _T("VAR \t");
mu::console() << _T("[ADDR: 0x") << std::hex << m_vRPN[i].Val.ptr << _T("]\n");
break;
case cmFUNC:
mu::console() << _T("CALL\t");
mu::console() << _T("[ARG:") << std::dec << m_vRPN[i].Fun.argc << _T("]");
mu::console() << _T("[ADDR: 0x") << std::hex << m_vRPN[i].Fun.ptr << _T("]");
mu::console() << _T("\n");
break;
case cmFUNC_STR:
mu::console() << _T("CALL STRFUNC\t");
mu::console() << _T("[ARG:") << std::dec << m_vRPN[i].Fun.argc << _T("]");
mu::console() << _T("[IDX:") << std::dec << m_vRPN[i].Fun.idx << _T("]");
mu::console() << _T("[ADDR: 0x") << m_vRPN[i].Fun.ptr << _T("]\n");
break;
case cmLT:
mu::console() << _T("LT\n");
break;
case cmGT:
mu::console() << _T("GT\n");
break;
case cmLE:
mu::console() << _T("LE\n");
break;
case cmGE:
mu::console() << _T("GE\n");
break;
case cmEQ:
mu::console() << _T("EQ\n");
break;
case cmNEQ:
mu::console() << _T("NEQ\n");
break;
case cmADD:
mu::console() << _T("ADD\n");
break;
case cmLAND:
mu::console() << _T("&&\n");
break;
case cmLOR:
mu::console() << _T("||\n");
break;
case cmSUB:
mu::console() << _T("SUB\n");
break;
case cmMUL:
mu::console() << _T("MUL\n");
break;
case cmDIV:
mu::console() << _T("DIV\n");
break;
case cmPOW:
mu::console() << _T("POW\n");
break;
case cmIF:
mu::console() << _T("IF\t");
mu::console() << _T("[OFFSET:") << std::dec << m_vRPN[i].Oprt.offset << _T("]\n");
break;
case cmELSE:
mu::console() << _T("ELSE\t");
mu::console() << _T("[OFFSET:") << std::dec << m_vRPN[i].Oprt.offset << _T("]\n");
break;
case cmENDIF:
mu::console() << _T("ENDIF\n");
break;
case cmASSIGN:
mu::console() << _T("ASSIGN\t");
mu::console() << _T("[ADDR: 0x") << m_vRPN[i].Oprt.ptr << _T("]\n");
break;
default:
mu::console() << _T("(unknown code: ") << m_vRPN[i].Cmd << _T(")\n");
break;
} // switch cmdCode
} // while bytecode
mu::console() << _T("END") << std::endl;
}
} // namespace mu

View file

@ -1,171 +0,0 @@
/*
__________
_____ __ __\______ \_____ _______ ______ ____ _______
/ \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \
| Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/
|__|_| /|____/ |____| (____ /|__| /____ > \___ >|__|
\/ \/ \/ \/
Copyright (C) 2004-2011 Ingo Berg
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "muParserCallback.h"
/** \file
\brief Implementation of the parser callback class.
*/
namespace mu {
//---------------------------------------------------------------------------
ParserCallback::ParserCallback(fun_type0 a_pFun)
: m_pFun((void*)a_pFun),
m_iArgc(0),
m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC),
m_iType(tpDBL) {}
//---------------------------------------------------------------------------
ParserCallback::ParserCallback(fun_type1 a_pFun, int a_iPrec, ECmdCode a_iCode)
: m_pFun((void*)a_pFun),
m_iArgc(1),
m_iPri(a_iPrec),
m_eOprtAsct(oaNONE),
m_iCode(a_iCode),
m_iType(tpDBL) {}
//---------------------------------------------------------------------------
/** \brief Constructor for constructing function callbacks taking two arguments.
*/
ParserCallback::ParserCallback(fun_type2 a_pFun)
: m_pFun((void*)a_pFun),
m_iArgc(2),
m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC),
m_iType(tpDBL) {}
//---------------------------------------------------------------------------
/** \brief Constructor for constructing binary operator callbacks.
\param a_pFun Pointer to a static function taking two arguments
\param a_bAllowOpti A flag indicating this function can be optimized
\param a_iPrec The operator precedence
\param a_eOprtAsct The operators associativity
*/
ParserCallback::ParserCallback(fun_type2 a_pFun, int a_iPrec, EOprtAssociativity a_eOprtAsct)
: m_pFun((void*)a_pFun),
m_iArgc(2),
m_iPri(a_iPrec),
m_eOprtAsct(a_eOprtAsct),
m_iCode(cmOPRT_BIN),
m_iType(tpDBL) {}
//---------------------------------------------------------------------------
ParserCallback::ParserCallback(fun_type3 a_pFun)
: m_pFun((void*)a_pFun),
m_iArgc(3),
m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC),
m_iType(tpDBL) {}
//---------------------------------------------------------------------------
ParserCallback::ParserCallback(multfun_type a_pFun)
: m_pFun((void*)a_pFun),
m_iArgc(-1),
m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC),
m_iType(tpDBL) {}
//---------------------------------------------------------------------------
ParserCallback::ParserCallback(strfun_type1 a_pFun)
: m_pFun((void*)a_pFun),
m_iArgc(0),
m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC_STR),
m_iType(tpSTR) {}
//---------------------------------------------------------------------------
ParserCallback::ParserCallback(strfun_type2 a_pFun)
: m_pFun((void*)a_pFun),
m_iArgc(1),
m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC_STR),
m_iType(tpSTR) {}
//---------------------------------------------------------------------------
ParserCallback::ParserCallback(strfun_type3 a_pFun)
: m_pFun((void*)a_pFun),
m_iArgc(2),
m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC_STR),
m_iType(tpSTR) {}
//---------------------------------------------------------------------------
/** \brief Default constructor.
*/
ParserCallback::ParserCallback()
: m_pFun(0),
m_iArgc(0),
m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmUNKNOWN),
m_iType(tpVOID) {}
//---------------------------------------------------------------------------
/** \brief Copy constructor.
*/
ParserCallback::ParserCallback(const ParserCallback& ref) = default;
//---------------------------------------------------------------------------
/** \brief Get the callback address for the parser function.
The type of the address is void. It needs to be recasted according to the
argument number to the right type.
\return #pFun
*/
void* ParserCallback::GetAddr() const { return m_pFun; }
//---------------------------------------------------------------------------
/** \brief Return the callback code. */
ECmdCode ParserCallback::GetCode() const { return m_iCode; }
//---------------------------------------------------------------------------
ETypeCode ParserCallback::GetType() const { return m_iType; }
//---------------------------------------------------------------------------
/** \brief Return the operator precedence.n
Only valid if the callback token is an operator token (binary or infix).
*/
int ParserCallback::GetPri() const { return m_iPri; }
//---------------------------------------------------------------------------
/** \brief Return the operators associativity.n
Only valid if the callback token is a binary operator token.
*/
EOprtAssociativity ParserCallback::GetAssociativity() const { return m_eOprtAsct; }
//---------------------------------------------------------------------------
/** \brief Returns the number of function Arguments. */
int ParserCallback::GetArgc() const { return m_iArgc; }
} // namespace mu

View file

@ -1,240 +0,0 @@
/*
__________
_____ __ __\______ \_____ _______ ______ ____ _______
/ \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \
| Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/
|__|_| /|____/ |____| (____ /|__| /____ > \___ >|__|
\/ \/ \/ \/
Copyright (C) 2011 Ingo Berg
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "muParserDef.h"
#include <assert.h>
#include <utility>
namespace mu {
//---------------------------------------------------------------------------
string_type parser_error_for_code(EErrorCodes code) {
switch (code) {
case ecUNASSIGNABLE_TOKEN:
return _T("Unexpected token \"$TOK$\" found at position $POS$.");
case ecINVALID_NAME:
return _T("Invalid function-, variable- or constant name: \"$TOK$\".");
case ecINVALID_BINOP_IDENT:
return _T("Invalid binary operator identifier: \"$TOK$\".");
case ecINVALID_INFIX_IDENT:
return _T("Invalid infix operator identifier: \"$TOK$\".");
case ecINVALID_POSTFIX_IDENT:
return _T("Invalid postfix operator identifier: \"$TOK$\".");
case ecINVALID_FUN_PTR:
return _T("Invalid pointer to callback function.");
case ecEMPTY_EXPRESSION:
return _T("Expression is empty.");
case ecINVALID_VAR_PTR:
return _T("Invalid pointer to variable.");
case ecUNEXPECTED_OPERATOR:
return _T("Unexpected operator \"$TOK$\" found at position $POS$");
case ecUNEXPECTED_EOF:
return _T("Unexpected end of expression at position $POS$");
case ecUNEXPECTED_ARG_SEP:
return _T("Unexpected argument separator at position $POS$");
case ecUNEXPECTED_PARENS:
return _T("Unexpected parenthesis \"$TOK$\" at position $POS$");
case ecUNEXPECTED_FUN:
return _T("Unexpected function \"$TOK$\" at position $POS$");
case ecUNEXPECTED_VAL:
return _T("Unexpected value \"$TOK$\" found at position $POS$");
case ecUNEXPECTED_VAR:
return _T("Unexpected variable \"$TOK$\" found at position $POS$");
case ecUNEXPECTED_ARG:
return _T("Function arguments used without a function (position: $POS$)");
case ecMISSING_PARENS:
return _T("Missing parenthesis");
case ecTOO_MANY_PARAMS:
return _T("Too many parameters for function \"$TOK$\" at expression position $POS$");
case ecTOO_FEW_PARAMS:
return _T("Too few parameters for function \"$TOK$\" at expression position $POS$");
case ecDIV_BY_ZERO:
return _T("Divide by zero");
case ecDOMAIN_ERROR:
return _T("Domain error");
case ecNAME_CONFLICT:
return _T("Name conflict");
case ecOPT_PRI:
return _T("Invalid value for operator priority (must be greater or equal to zero).");
case ecBUILTIN_OVERLOAD:
return _T("user defined binary operator \"$TOK$\" conflicts with a built in operator.");
case ecUNEXPECTED_STR:
return _T("Unexpected string token found at position $POS$.");
case ecUNTERMINATED_STRING:
return _T("Unterminated string starting at position $POS$.");
case ecSTRING_EXPECTED:
return _T("String function called with a non string type of argument.");
case ecVAL_EXPECTED:
return _T("String value used where a numerical argument is expected.");
case ecOPRT_TYPE_CONFLICT:
return _T("No suitable overload for operator \"$TOK$\" at position $POS$.");
case ecSTR_RESULT:
return _T("Function result is a string.");
case ecGENERIC:
return _T("Parser error.");
case ecLOCALE:
return _T("Decimal separator is identic to function argument separator.");
case ecUNEXPECTED_CONDITIONAL:
return _T("The \"$TOK$\" operator must be preceeded by a closing bracket.");
case ecMISSING_ELSE_CLAUSE:
return _T("If-then-else operator is missing an else clause");
case ecMISPLACED_COLON:
return _T("Misplaced colon at position $POS$");
case ecUNREASONABLE_NUMBER_OF_COMPUTATIONS:
return _T("Number of computations to small for bulk mode. (Vectorisation overhead too ")
_T("costly)");
default:
assert(0 && "Invalid error code");
return string_type();
}
}
//---------------------------------------------------------------------------
//
// ParserError class
//
//---------------------------------------------------------------------------
/** \brief Default constructor. */
ParserError::ParserError() {}
//------------------------------------------------------------------------------
/** \brief This Constructor is used for internal exceptions only.
It does not contain any information but the error code.
*/
ParserError::ParserError(EErrorCodes a_iErrc) : m_iErrc(a_iErrc) {
m_strMsg = parser_error_for_code(m_iErrc);
stringstream_type stream;
stream << (int)m_iPos;
ReplaceSubString(m_strMsg, _T("$POS$"), stream.str());
ReplaceSubString(m_strMsg, _T("$TOK$"), m_strTok);
}
//------------------------------------------------------------------------------
/** \brief Construct an error from a message text. */
ParserError::ParserError(const string_type &sMsg) {
Reset();
m_strMsg = sMsg;
}
//------------------------------------------------------------------------------
/** \brief Construct an error object.
\param [in] a_iErrc the error code.
\param [in] sTok The token string related to this error.
\param [in] a_iPos the position in the expression where the error occurred.
*/
ParserError::ParserError(EErrorCodes iErrc, string_type sTok, int iPos)
: m_strTok(std::move(sTok)), m_iPos(iPos), m_iErrc(iErrc) {
m_strMsg = parser_error_for_code(m_iErrc);
stringstream_type stream;
stream << (int)m_iPos;
ReplaceSubString(m_strMsg, _T("$POS$"), stream.str());
ReplaceSubString(m_strMsg, _T("$TOK$"), m_strTok);
}
//------------------------------------------------------------------------------
/** \brief Construct an error object.
\param [in] iErrc the error code.
\param [in] iPos the position in the expression where the error occurred.
\param [in] sTok The token string related to this error.
*/
ParserError::ParserError(EErrorCodes iErrc, int iPos, string_type sTok)
: m_strMsg(), m_strTok(std::move(sTok)), m_iPos(iPos), m_iErrc(iErrc) {
m_strMsg = parser_error_for_code(m_iErrc);
stringstream_type stream;
stream << (int)m_iPos;
ReplaceSubString(m_strMsg, _T("$POS$"), stream.str());
ReplaceSubString(m_strMsg, _T("$TOK$"), m_strTok);
}
//------------------------------------------------------------------------------
/** \brief Construct an error object.
\param [in] szMsg The error message text.
\param [in] iPos the position related to the error.
\param [in] sTok The token string related to this error.
*/
ParserError::ParserError(const char_type *szMsg, int iPos, string_type sTok)
: m_strMsg(szMsg), m_strTok(std::move(sTok)), m_iPos(iPos), m_iErrc(ecGENERIC) {
stringstream_type stream;
stream << (int)m_iPos;
ReplaceSubString(m_strMsg, _T("$POS$"), stream.str());
ReplaceSubString(m_strMsg, _T("$TOK$"), m_strTok);
}
//------------------------------------------------------------------------------
ParserError::~ParserError() = default;
//------------------------------------------------------------------------------
/** \brief Replace all occurrences of a substring with another string.
\param strFind The string that shall be replaced.
\param strReplaceWith The string that should be inserted instead of strFind
*/
void ParserError::ReplaceSubString(string_type &strSource, const string_type &strFind,
const string_type &strReplaceWith) {
string_type strResult;
string_type::size_type iPos(0), iNext(0);
for (;;) {
iNext = strSource.find(strFind, iPos);
strResult.append(strSource, iPos, iNext - iPos);
if (iNext == string_type::npos) break;
strResult.append(strReplaceWith);
iPos = iNext + strFind.length();
}
strSource.swap(strResult);
}
//------------------------------------------------------------------------------
/** \brief Reset the erro object. */
void ParserError::Reset() {
m_strMsg = _T("");
m_strTok = _T("");
m_iPos = -1;
m_iErrc = ecUNDEFINED;
}
//------------------------------------------------------------------------------
/** \brief Returns the message string for this error. */
const string_type &ParserError::GetMsg() const { return m_strMsg; }
//------------------------------------------------------------------------------
/** \brief Return the formula position related to the error.
If the error is not related to a distinct position this will return -1
*/
int ParserError::GetPos() const { return m_iPos; }
//------------------------------------------------------------------------------
/** \brief Return string related with this token (if available). */
const string_type &ParserError::GetToken() const { return m_strTok; }
//------------------------------------------------------------------------------
/** \brief Return the error code. */
EErrorCodes ParserError::GetCode() const { return m_iErrc; }
} // namespace mu

View file

@ -1,254 +0,0 @@
/*
__________
_____ __ __\______ \_____ _______ ______ ____ _______
/ \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \
| Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/
|__|_| /|____/ |____| (____ /|__| /____ > \___ >|__|
\/ \/ \/ \/
Copyright (C) 2011 Ingo Berg
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "muParserInt.h"
#include <algorithm>
#include <cmath>
#include <numeric>
using namespace std;
/** \file
\brief Implementation of a parser using integer value.
*/
/** \brief Namespace for mathematical applications. */
namespace mu {
ValueOrError ParserInt::Abs(value_type v) { return (value_type)Round(fabs((double)v)); }
ValueOrError ParserInt::Sign(value_type v) { return (Round(v) < 0) ? -1 : (Round(v) > 0) ? 1 : 0; }
ValueOrError ParserInt::Ite(value_type v1, value_type v2, value_type v3) {
return (Round(v1) == 1) ? Round(v2) : Round(v3);
}
ValueOrError ParserInt::Add(value_type v1, value_type v2) { return Round(v1) + Round(v2); }
ValueOrError ParserInt::Sub(value_type v1, value_type v2) { return Round(v1) - Round(v2); }
ValueOrError ParserInt::Mul(value_type v1, value_type v2) { return Round(v1) * Round(v2); }
ValueOrError ParserInt::Div(value_type v1, value_type v2) { return Round(v1) / Round(v2); }
ValueOrError ParserInt::Mod(value_type v1, value_type v2) { return Round(v1) % Round(v2); }
ValueOrError ParserInt::Shr(value_type v1, value_type v2) { return Round(v1) >> Round(v2); }
ValueOrError ParserInt::Shl(value_type v1, value_type v2) { return Round(v1) << Round(v2); }
ValueOrError ParserInt::LogAnd(value_type v1, value_type v2) { return Round(v1) & Round(v2); }
ValueOrError ParserInt::LogOr(value_type v1, value_type v2) { return Round(v1) | Round(v2); }
ValueOrError ParserInt::And(value_type v1, value_type v2) { return Round(v1) && Round(v2); }
ValueOrError ParserInt::Or(value_type v1, value_type v2) { return Round(v1) || Round(v2); }
ValueOrError ParserInt::Less(value_type v1, value_type v2) { return Round(v1) < Round(v2); }
ValueOrError ParserInt::Greater(value_type v1, value_type v2) { return Round(v1) > Round(v2); }
ValueOrError ParserInt::LessEq(value_type v1, value_type v2) { return Round(v1) <= Round(v2); }
ValueOrError ParserInt::GreaterEq(value_type v1, value_type v2) { return Round(v1) >= Round(v2); }
ValueOrError ParserInt::Equal(value_type v1, value_type v2) { return Round(v1) == Round(v2); }
ValueOrError ParserInt::NotEqual(value_type v1, value_type v2) { return Round(v1) != Round(v2); }
ValueOrError ParserInt::Not(value_type v) { return !Round(v); }
ValueOrError ParserInt::Pow(value_type v1, value_type v2) {
return std::pow((double)Round(v1), (double)Round(v2));
}
//---------------------------------------------------------------------------
// Unary operator Callbacks: Infix operators
ValueOrError ParserInt::UnaryMinus(value_type v) { return -Round(v); }
//---------------------------------------------------------------------------
ValueOrError ParserInt::Sum(const value_type *a_afArg, int a_iArgc) {
if (!a_iArgc) return ParserError(_T("too few arguments for function sum."));
value_type fRes = 0;
for (int i = 0; i < a_iArgc; ++i) fRes += a_afArg[i];
return fRes;
}
//---------------------------------------------------------------------------
ValueOrError ParserInt::Min(const value_type *a_afArg, int a_iArgc) {
if (!a_iArgc) return ParserError(_T("too few arguments for function min."));
value_type fRes = a_afArg[0];
for (int i = 0; i < a_iArgc; ++i) fRes = std::min(fRes, a_afArg[i]);
return fRes;
}
//---------------------------------------------------------------------------
ValueOrError ParserInt::Max(const value_type *a_afArg, int a_iArgc) {
if (!a_iArgc) return ParserError(_T("too few arguments for function min."));
value_type fRes = a_afArg[0];
for (int i = 0; i < a_iArgc; ++i) fRes = std::max(fRes, a_afArg[i]);
return fRes;
}
//---------------------------------------------------------------------------
// Default value recognition callback
int ParserInt::IsVal(const char_type *a_szExpr, int *a_iPos, value_type *a_fVal) {
string_type buf(a_szExpr);
std::size_t pos = buf.find_first_not_of(_T("0123456789"));
if (pos == std::string::npos) return 0;
stringstream_type stream(buf.substr(0, pos));
int iVal(0);
stream >> iVal;
if (stream.fail()) return 0;
stringstream_type::pos_type iEnd = stream.tellg(); // Position after reading
if (stream.fail()) iEnd = stream.str().length();
if (iEnd == (stringstream_type::pos_type)-1) return 0;
*a_iPos += (int)iEnd;
*a_fVal = (value_type)iVal;
return 1;
}
//---------------------------------------------------------------------------
/** \brief Check a given position in the expression for the presence of
a hex value.
\param a_szExpr Pointer to the expression string
\param [in/out] a_iPos Pointer to an integer value holding the current parsing
position in the expression.
\param [out] a_fVal Pointer to the position where the detected value shall be stored.
Hey values must be prefixed with "0x" in order to be detected properly.
*/
int ParserInt::IsHexVal(const char_type *a_szExpr, int *a_iPos, value_type *a_fVal) {
if (a_szExpr[1] == 0 || (a_szExpr[0] != '0' || a_szExpr[1] != 'x')) return 0;
unsigned iVal(0);
// New code based on streams for UNICODE compliance:
stringstream_type::pos_type nPos(0);
stringstream_type ss(a_szExpr + 2);
ss >> std::hex >> iVal;
nPos = ss.tellg();
if (nPos == (stringstream_type::pos_type)0) return 1;
*a_iPos += (int)(2 + nPos);
*a_fVal = (value_type)iVal;
return 1;
}
//---------------------------------------------------------------------------
int ParserInt::IsBinVal(const char_type *a_szExpr, int *a_iPos, value_type *a_fVal) {
if (a_szExpr[0] != '#') return 0;
unsigned iVal(0), iBits(sizeof(iVal) * 8), i(0);
for (i = 0; (a_szExpr[i + 1] == '0' || a_szExpr[i + 1] == '1') && i < iBits; ++i)
iVal |= (int)(a_szExpr[i + 1] == '1') << ((iBits - 1) - i);
if (i == 0) return 0;
// return false on overflow
if (i == iBits) return 0;
*a_fVal = (unsigned)(iVal >> (iBits - i));
*a_iPos += i + 1;
return 1;
}
//---------------------------------------------------------------------------
/** \brief Constructor.
Call ParserBase class constructor and trigger Function, Operator and Constant initialization.
*/
ParserInt::ParserInt() : ParserBase() {
AddValIdent(IsVal); // lowest priority
AddValIdent(IsBinVal);
AddValIdent(IsHexVal); // highest priority
InitCharSets();
InitFun();
InitOprt();
}
//---------------------------------------------------------------------------
void ParserInt::InitConst() {}
//---------------------------------------------------------------------------
void ParserInt::InitCharSets() {
DefineNameChars(_T("0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"));
DefineOprtChars(_T("+-*^/?<>=!%&|~'_"));
DefineInfixOprtChars(_T("/+-*^?<>=!%&|~'_"));
}
/// assert that the given optional error \p oerr is not an error.
/// This is used only during initialization, when it ought to be impossible
/// to generate an error.
static void assertNoError(OptionalError oerr) {
assert(!oerr.has_error() && "Unexpected error during initialization");
(void)oerr;
}
//---------------------------------------------------------------------------
/** \brief Initialize the default functions. */
void ParserInt::InitFun() {
assertNoError(DefineFun(_T("sign"), Sign));
assertNoError(DefineFun(_T("abs"), Abs));
assertNoError(DefineFun(_T("if"), Ite));
assertNoError(DefineFun(_T("sum"), Sum));
assertNoError(DefineFun(_T("min"), Min));
assertNoError(DefineFun(_T("max"), Max));
}
//---------------------------------------------------------------------------
/** \brief Initialize operators. */
void ParserInt::InitOprt() {
// disable all built in operators, not all of them useful for integer numbers
// (they don't do rounding of values)
EnableBuiltInOprt(false);
// Disable all built in operators, they wont work with integer numbers
// since they are designed for floating point numbers
assertNoError(DefineInfixOprt(_T("-"), UnaryMinus));
assertNoError(DefineInfixOprt(_T("!"), Not));
assertNoError(DefineOprt(_T("&"), LogAnd, prLOGIC));
assertNoError(DefineOprt(_T("|"), LogOr, prLOGIC));
assertNoError(DefineOprt(_T("&&"), And, prLOGIC));
assertNoError(DefineOprt(_T("||"), Or, prLOGIC));
assertNoError(DefineOprt(_T("<"), Less, prCMP));
assertNoError(DefineOprt(_T(">"), Greater, prCMP));
assertNoError(DefineOprt(_T("<="), LessEq, prCMP));
assertNoError(DefineOprt(_T(">="), GreaterEq, prCMP));
assertNoError(DefineOprt(_T("=="), Equal, prCMP));
assertNoError(DefineOprt(_T("!="), NotEqual, prCMP));
assertNoError(DefineOprt(_T("+"), Add, prADD_SUB));
assertNoError(DefineOprt(_T("-"), Sub, prADD_SUB));
assertNoError(DefineOprt(_T("*"), Mul, prMUL_DIV));
assertNoError(DefineOprt(_T("/"), Div, prMUL_DIV));
assertNoError(DefineOprt(_T("%"), Mod, prMUL_DIV));
assertNoError(DefineOprt(_T("^"), Pow, prPOW, oaRIGHT));
assertNoError(DefineOprt(_T(">>"), Shr, prMUL_DIV + 1));
assertNoError(DefineOprt(_T("<<"), Shl, prMUL_DIV + 1));
}
} // namespace mu

File diff suppressed because it is too large Load diff

View file

@ -1,752 +0,0 @@
/*
__________
_____ __ __\______ \_____ _______ ______ ____ _______
/ \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \
| Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/
|__|_| /|____/ |____| (____ /|__| /____ > \___ >|__|
\/ \/ \/ \/
Copyright (C) 2013 Ingo Berg
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <cassert>
#include <cstdio>
#include <cstring>
#include <map>
#include <stack>
#include <string>
#include "muParserBase.h"
#include "muParserTokenReader.h"
/** \file
\brief This file contains the parser token reader implementation.
*/
namespace mu {
//---------------------------------------------------------------------------
/** \brief Constructor.
Create a Token reader and bind it to a parser object.
\pre [assert] a_pParser may not be NULL
\post #m_pParser==a_pParser
\param a_pParent Parent parser object of the token reader.
*/
ParserTokenReader::ParserTokenReader(ParserBase *a_pParent) {
assert(a_pParent && "Missing parent");
SetParent(a_pParent);
}
//---------------------------------------------------------------------------
ParserTokenReader::token_type &ParserTokenReader::SaveBeforeReturn(const token_type &tok) {
m_lastTok = tok;
return m_lastTok;
}
//---------------------------------------------------------------------------
void ParserTokenReader::AddValIdent(identfun_type a_pCallback) {
// Use push_front is used to give user defined callbacks a higher priority than
// the built in ones. Otherwise reading hex numbers would not work
// since the "0" in "0xff" would always be read first making parsing of
// the rest impossible.
// reference:
// http://sourceforge.net/projects/muparser/forums/forum/462843/topic/4824956
m_vIdentFun.push_front(a_pCallback);
}
//---------------------------------------------------------------------------
void ParserTokenReader::SetVarCreator(facfun_type a_pFactory, void *pUserData) {
m_pFactory = a_pFactory;
m_pFactoryData = pUserData;
}
//---------------------------------------------------------------------------
/** \brief Return the current position of the token reader in the formula string.
\return #m_iPos
*/
int ParserTokenReader::GetPos() const { return m_iPos; }
//---------------------------------------------------------------------------
/** \brief Return a reference to the formula.
\return #m_strFormula
*/
const string_type &ParserTokenReader::GetExpr() const { return m_strFormula; }
//---------------------------------------------------------------------------
/** \brief Initialize the token Reader.
Sets the formula position index to zero and set Syntax flags to default for initial formula
parsing.
\pre [assert] triggered if a_szFormula==0
*/
void ParserTokenReader::SetFormula(const string_type &a_strFormula) {
m_strFormula = a_strFormula;
ReInit();
}
//---------------------------------------------------------------------------
/** \brief Set Flag that controls behaviour in case of undefined variables being found.
If true, the parser does not throw an exception if an undefined variable is found.
otherwise it does. This variable is used internally only!
It suppresses a "undefined variable" exception in GetUsedVar().
Those function should return a complete list of variables including
those the are not defined by the time of it's call.
*/
void ParserTokenReader::IgnoreUndefVar(bool bIgnore) { m_bIgnoreUndefVar = bIgnore; }
//---------------------------------------------------------------------------
/** \brief Reset the token reader to the start of the formula.
The syntax flags will be reset to a value appropriate for the
start of a formula.
\post #m_iPos==0, #m_iSynFlags = noOPT | noBC | noPOSTOP | noSTR
\sa ESynCodes
*/
void ParserTokenReader::ReInit() {
m_iPos = 0;
m_iSynFlags = sfSTART_OF_LINE;
m_iBrackets = 0;
m_UsedVar.clear();
m_lastTok = token_type();
}
//---------------------------------------------------------------------------
/** \brief Read the next token from the string. */
ParserTokenReader::token_type ParserTokenReader::ReadNextToken() {
assert(m_pParser);
const char_type *szFormula = m_strFormula.c_str();
token_type tok;
// Ignore all non printable characters when reading the expression
while (szFormula[m_iPos] > 0 && szFormula[m_iPos] <= 0x20) ++m_iPos;
if (IsEOF(tok)) return SaveBeforeReturn(tok); // Check for end of formula
if (IsOprt(tok)) return SaveBeforeReturn(tok); // Check for user defined binary operator
if (IsFunTok(tok)) return SaveBeforeReturn(tok); // Check for function token
if (IsBuiltIn(tok)) return SaveBeforeReturn(tok); // Check built in operators / tokens
if (IsArgSep(tok)) return SaveBeforeReturn(tok); // Check for function argument separators
if (IsValTok(tok)) return SaveBeforeReturn(tok); // Check for values / constant tokens
if (IsVarTok(tok)) return SaveBeforeReturn(tok); // Check for variable tokens
if (IsStrVarTok(tok)) return SaveBeforeReturn(tok); // Check for string variables
if (IsString(tok)) return SaveBeforeReturn(tok); // Check for String tokens
if (IsInfixOpTok(tok)) return SaveBeforeReturn(tok); // Check for unary operators
if (IsPostOpTok(tok)) return SaveBeforeReturn(tok); // Check for unary operators
// Check String for undefined variable token. Done only if a
// flag is set indicating to ignore undefined variables.
// This is a way to conditionally avoid an error if
// undefined variables occur.
// (The GetUsedVar function must suppress the error for
// undefined variables in order to collect all variable
// names including the undefined ones.)
if ((m_bIgnoreUndefVar || m_pFactory) && IsUndefVarTok(tok)) return SaveBeforeReturn(tok);
// Check for unknown token
//
// !!! From this point on there is no exit without an error possible...
//
string_type strTok;
int iEnd = ExtractToken(m_pParser->ValidNameChars(), strTok, m_iPos);
if (iEnd != m_iPos) {
Error(ecUNASSIGNABLE_TOKEN, m_iPos, strTok);
return {};
}
Error(ecUNASSIGNABLE_TOKEN, m_iPos, m_strFormula.substr(m_iPos));
return {};
}
//---------------------------------------------------------------------------
void ParserTokenReader::SetParent(ParserBase *a_pParent) {
m_pParser = a_pParent;
m_pFunDef = &a_pParent->m_FunDef;
m_pOprtDef = &a_pParent->m_OprtDef;
m_pInfixOprtDef = &a_pParent->m_InfixOprtDef;
m_pPostOprtDef = &a_pParent->m_PostOprtDef;
m_pVarDef = &a_pParent->m_VarDef;
m_pStrVarDef = &a_pParent->m_StrVarDef;
m_pConstDef = &a_pParent->m_ConstDef;
}
//---------------------------------------------------------------------------
/** \brief Extract all characters that belong to a certain charset.
\param a_szCharSet [in] Const char array of the characters allowed in the token.
\param a_strTok [out] The string that consists entirely of characters listed in a_szCharSet.
\param a_iPos [in] Position in the string from where to start reading.
\return The Position of the first character not listed in a_szCharSet.
*/
int ParserTokenReader::ExtractToken(const char_type *a_szCharSet, string_type &a_sTok,
int a_iPos) const {
int iEnd = (int)m_strFormula.find_first_not_of(a_szCharSet, a_iPos);
if (iEnd == (int)string_type::npos) iEnd = (int)m_strFormula.length();
// Assign token string if there was something found
if (a_iPos != iEnd)
a_sTok = string_type(m_strFormula.begin() + a_iPos, m_strFormula.begin() + iEnd);
return iEnd;
}
//---------------------------------------------------------------------------
/** \brief Check Expression for the presence of a binary operator token.
Userdefined binary operator "++" gives inconsistent parsing result for
the equations "a++b" and "a ++ b" if alphabetic characters are allowed
in operator tokens. To avoid this this function checks specifically
for operator tokens.
*/
int ParserTokenReader::ExtractOperatorToken(string_type &a_sTok, int a_iPos) const {
// Changed as per Issue 6: https://code.google.com/p/muparser/issues/detail?id=6
int iEnd = (int)m_strFormula.find_first_not_of(m_pParser->ValidOprtChars(), a_iPos);
if (iEnd == (int)string_type::npos) iEnd = (int)m_strFormula.length();
// Assign token string if there was something found
if (a_iPos != iEnd) {
a_sTok = string_type(m_strFormula.begin() + a_iPos, m_strFormula.begin() + iEnd);
return iEnd;
} else {
// There is still the chance of having to deal with an operator consisting exclusively
// of alphabetic characters.
return ExtractToken(MUP_CHARS, a_sTok, a_iPos);
}
}
//---------------------------------------------------------------------------
/** \brief Check if a built in operator or other token can be found
\param a_Tok [out] Operator token if one is found. This can either be a binary operator or an
infix operator token.
\return true if an operator token has been found.
*/
bool ParserTokenReader::IsBuiltIn(token_type &a_Tok) {
const char_type **const pOprtDef = m_pParser->GetOprtDef(),
*const szFormula = m_strFormula.c_str();
// Compare token with function and operator strings
// check string for operator/function
for (int i = 0; pOprtDef[i]; i++) {
std::size_t len(std::char_traits<char_type>::length(pOprtDef[i]));
if (string_type(pOprtDef[i]) == string_type(szFormula + m_iPos, szFormula + m_iPos + len)) {
switch (i) {
// case cmAND:
// case cmOR:
// case cmXOR:
case cmLAND:
case cmLOR:
case cmLT:
case cmGT:
case cmLE:
case cmGE:
case cmNEQ:
case cmEQ:
case cmADD:
case cmSUB:
case cmMUL:
case cmDIV:
case cmPOW:
case cmASSIGN:
// if (len!=sTok.length())
// continue;
// The assignment operator need special treatment
if (i == cmASSIGN && m_iSynFlags & noASSIGN)
return Error(ecUNEXPECTED_OPERATOR, m_iPos, pOprtDef[i]);
if (!m_pParser->HasBuiltInOprt()) continue;
if (m_iSynFlags & noOPT) {
// Maybe its an infix operator not an operator
// Both operator types can share characters in
// their identifiers
if (IsInfixOpTok(a_Tok)) return true;
return Error(ecUNEXPECTED_OPERATOR, m_iPos, pOprtDef[i]);
}
m_iSynFlags =
noBC | noOPT | noARG_SEP | noPOSTOP | noASSIGN | noIF | noELSE | noEND;
break;
case cmBO:
if (m_iSynFlags & noBO) return Error(ecUNEXPECTED_PARENS, m_iPos, pOprtDef[i]);
if (m_lastTok.GetCode() == cmFUNC)
m_iSynFlags =
noOPT | noEND | noARG_SEP | noPOSTOP | noASSIGN | noIF | noELSE;
else
m_iSynFlags =
noBC | noOPT | noEND | noARG_SEP | noPOSTOP | noASSIGN | noIF | noELSE;
++m_iBrackets;
break;
case cmBC:
if (m_iSynFlags & noBC) return Error(ecUNEXPECTED_PARENS, m_iPos, pOprtDef[i]);
m_iSynFlags = noBO | noVAR | noVAL | noFUN | noINFIXOP | noSTR | noASSIGN;
if (--m_iBrackets < 0) return Error(ecUNEXPECTED_PARENS, m_iPos, pOprtDef[i]);
break;
case cmELSE:
if (m_iSynFlags & noELSE)
return Error(ecUNEXPECTED_CONDITIONAL, m_iPos, pOprtDef[i]);
m_iSynFlags = noBC | noPOSTOP | noEND | noOPT | noIF | noELSE;
break;
case cmIF:
if (m_iSynFlags & noIF)
return Error(ecUNEXPECTED_CONDITIONAL, m_iPos, pOprtDef[i]);
m_iSynFlags = noBC | noPOSTOP | noEND | noOPT | noIF | noELSE;
break;
default: // The operator is listed in c_DefaultOprt, but not here. This is a bad
// thing...
assert(0 && "missing operator in muParser");
} // switch operator id
m_iPos += (int)len;
a_Tok.Set((ECmdCode)i, pOprtDef[i]);
return true;
} // if operator string found
} // end of for all operator strings
return false;
}
//---------------------------------------------------------------------------
bool ParserTokenReader::IsArgSep(token_type &a_Tok) {
const char_type *szFormula = m_strFormula.c_str();
if (szFormula[m_iPos] == m_cArgSep) {
// copy the separator into null terminated string
char_type szSep[2];
szSep[0] = m_cArgSep;
szSep[1] = 0;
if (m_iSynFlags & noARG_SEP) return Error(ecUNEXPECTED_ARG_SEP, m_iPos, szSep);
m_iSynFlags = noBC | noOPT | noEND | noARG_SEP | noPOSTOP | noASSIGN;
m_iPos++;
a_Tok.Set(cmARG_SEP, szSep);
return true;
}
return false;
}
//---------------------------------------------------------------------------
/** \brief Check for End of Formula.
\return true if an end of formula is found false otherwise.
\param a_Tok [out] If an eof is found the corresponding token will be stored there.
\sa IsOprt, IsFunTok, IsStrFunTok, IsValTok, IsVarTok, IsString, IsInfixOpTok, IsPostOpTok
*/
bool ParserTokenReader::IsEOF(token_type &a_Tok) {
const char_type *szFormula = m_strFormula.c_str();
// check for EOF
if (!szFormula[m_iPos] /*|| szFormula[m_iPos] == '\n'*/) {
if (m_iSynFlags & noEND) return Error(ecUNEXPECTED_EOF, m_iPos);
if (m_iBrackets > 0) return Error(ecMISSING_PARENS, m_iPos, _T(")"));
m_iSynFlags = 0;
a_Tok.Set(cmEND);
return true;
}
return false;
}
//---------------------------------------------------------------------------
/** \brief Check if a string position contains a unary infix operator.
\return true if a function token has been found false otherwise.
*/
bool ParserTokenReader::IsInfixOpTok(token_type &a_Tok) {
string_type sTok;
int iEnd = ExtractToken(m_pParser->ValidInfixOprtChars(), sTok, m_iPos);
if (iEnd == m_iPos) return false;
// iterate over all postfix operator strings
funmap_type::const_reverse_iterator it = m_pInfixOprtDef->rbegin();
for (; it != m_pInfixOprtDef->rend(); ++it) {
if (sTok.find(it->first) != 0) continue;
a_Tok.Set(it->second, it->first);
m_iPos += (int)it->first.length();
if (m_iSynFlags & noINFIXOP)
return Error(ecUNEXPECTED_OPERATOR, m_iPos, a_Tok.GetAsString());
m_iSynFlags = noPOSTOP | noINFIXOP | noOPT | noBC | noSTR | noASSIGN;
return true;
}
return false;
/*
a_Tok.Set(item->second, sTok);
m_iPos = (int)iEnd;
if (m_iSynFlags & noINFIXOP)
return Error(ecUNEXPECTED_OPERATOR, m_iPos, a_Tok.GetAsString());
m_iSynFlags = noPOSTOP | noINFIXOP | noOPT | noBC | noSTR | noASSIGN;
return true;
*/
}
//---------------------------------------------------------------------------
/** \brief Check whether the token at a given position is a function token.
\param a_Tok [out] If a value token is found it will be placed here.
\throw ParserException if Syntaxflags do not allow a function at a_iPos
\return true if a function token has been found false otherwise.
\pre [assert] m_pParser!=0
*/
bool ParserTokenReader::IsFunTok(token_type &a_Tok) {
string_type strTok;
int iEnd = ExtractToken(m_pParser->ValidNameChars(), strTok, m_iPos);
if (iEnd == m_iPos) return false;
funmap_type::const_iterator item = m_pFunDef->find(strTok);
if (item == m_pFunDef->end()) return false;
// Check if the next sign is an opening bracket
const char_type *szFormula = m_strFormula.c_str();
if (szFormula[iEnd] != '(') return false;
a_Tok.Set(item->second, strTok);
m_iPos = (int)iEnd;
if (m_iSynFlags & noFUN)
return Error(ecUNEXPECTED_FUN, m_iPos - (int)a_Tok.GetAsString().length(),
a_Tok.GetAsString());
m_iSynFlags = noANY ^ noBO;
return true;
}
//---------------------------------------------------------------------------
/** \brief Check if a string position contains a binary operator.
\param a_Tok [out] Operator token if one is found. This can either be a binary operator or an
infix operator token.
\return true if an operator token has been found.
*/
bool ParserTokenReader::IsOprt(token_type &a_Tok) {
const char_type *const szExpr = m_strFormula.c_str();
string_type strTok;
int iEnd = ExtractOperatorToken(strTok, m_iPos);
if (iEnd == m_iPos) return false;
// Check if the operator is a built in operator, if so ignore it here
const char_type **const pOprtDef = m_pParser->GetOprtDef();
for (int i = 0; m_pParser->HasBuiltInOprt() && pOprtDef[i]; ++i) {
if (string_type(pOprtDef[i]) == strTok) return false;
}
// Note:
// All tokens in oprt_bin_maptype are have been sorted by their length
// Long operators must come first! Otherwise short names (like: "add") that
// are part of long token names (like: "add123") will be found instead
// of the long ones.
// Length sorting is done with ascending length so we use a reverse iterator here.
funmap_type::const_reverse_iterator it = m_pOprtDef->rbegin();
for (; it != m_pOprtDef->rend(); ++it) {
const string_type &sID = it->first;
if (sID == string_type(szExpr + m_iPos, szExpr + m_iPos + sID.length())) {
a_Tok.Set(it->second, strTok);
// operator was found
if (m_iSynFlags & noOPT) {
// An operator was found but is not expected to occur at
// this position of the formula, maybe it is an infix
// operator, not a binary operator. Both operator types
// can share characters in their identifiers.
if (IsInfixOpTok(a_Tok))
return true;
else {
// nope, no infix operator
return false;
// return Error(ecUNEXPECTED_OPERATOR, m_iPos, a_Tok.GetAsString());
}
}
m_iPos += (int)sID.length();
m_iSynFlags = noBC | noOPT | noARG_SEP | noPOSTOP | noEND | noASSIGN;
return true;
}
}
return false;
}
//---------------------------------------------------------------------------
/** \brief Check if a string position contains a unary post value operator. */
bool ParserTokenReader::IsPostOpTok(token_type &a_Tok) {
// <ibg 20110629> Do not check for postfix operators if they are not allowed at
// the current expression index.
//
// This will fix the bug reported here:
//
// http://sourceforge.net/tracker/index.php?func=detail&aid=3343891&group_id=137191&atid=737979
//
if (m_iSynFlags & noPOSTOP) return false;
// </ibg>
// Tricky problem with equations like "3m+5":
// m is a postfix operator, + is a valid sign for postfix operators and
// for binary operators parser detects "m+" as operator string and
// finds no matching postfix operator.
//
// This is a special case so this routine slightly differs from the other
// token readers.
// Test if there could be a postfix operator
string_type sTok;
int iEnd = ExtractToken(m_pParser->ValidOprtChars(), sTok, m_iPos);
if (iEnd == m_iPos) return false;
// iterate over all postfix operator strings
funmap_type::const_reverse_iterator it = m_pPostOprtDef->rbegin();
for (; it != m_pPostOprtDef->rend(); ++it) {
if (sTok.find(it->first) != 0) continue;
a_Tok.Set(it->second, sTok);
m_iPos += (int)it->first.length();
m_iSynFlags = noVAL | noVAR | noFUN | noBO | noPOSTOP | noSTR | noASSIGN;
return true;
}
return false;
}
//---------------------------------------------------------------------------
/** \brief Check whether the token at a given position is a value token.
Value tokens are either values or constants.
\param a_Tok [out] If a value token is found it will be placed here.
\return true if a value token has been found.
*/
bool ParserTokenReader::IsValTok(token_type &a_Tok) {
assert(m_pConstDef);
assert(m_pParser);
string_type strTok;
value_type fVal(0);
int iEnd(0);
// 2.) Check for user defined constant
// Read everything that could be a constant name
iEnd = ExtractToken(m_pParser->ValidNameChars(), strTok, m_iPos);
if (iEnd != m_iPos) {
valmap_type::const_iterator item = m_pConstDef->find(strTok);
if (item != m_pConstDef->end()) {
m_iPos = iEnd;
a_Tok.SetVal(item->second, strTok);
if (m_iSynFlags & noVAL)
return Error(ecUNEXPECTED_VAL, m_iPos - (int)strTok.length(), strTok);
m_iSynFlags = noVAL | noVAR | noFUN | noBO | noINFIXOP | noSTR | noASSIGN;
return true;
}
}
// 3.call the value recognition functions provided by the user
// Call user defined value recognition functions
std::list<identfun_type>::const_iterator item = m_vIdentFun.begin();
for (item = m_vIdentFun.begin(); item != m_vIdentFun.end(); ++item) {
int iStart = m_iPos;
if ((*item)(m_strFormula.c_str() + m_iPos, &m_iPos, &fVal) == 1) {
// 2013-11-27 Issue 2: https://code.google.com/p/muparser/issues/detail?id=2
strTok.assign(m_strFormula.c_str(), iStart, m_iPos - iStart);
if (m_iSynFlags & noVAL)
return Error(ecUNEXPECTED_VAL, m_iPos - (int)strTok.length(), strTok);
a_Tok.SetVal(fVal, strTok);
m_iSynFlags = noVAL | noVAR | noFUN | noBO | noINFIXOP | noSTR | noASSIGN;
return true;
}
}
return false;
}
//---------------------------------------------------------------------------
/** \brief Check wheter a token at a given position is a variable token.
\param a_Tok [out] If a variable token has been found it will be placed here.
\return true if a variable token has been found.
*/
bool ParserTokenReader::IsVarTok(token_type &a_Tok) {
if (m_pVarDef->empty()) return false;
string_type strTok;
int iEnd = ExtractToken(m_pParser->ValidNameChars(), strTok, m_iPos);
if (iEnd == m_iPos) return false;
varmap_type::const_iterator item = m_pVarDef->find(strTok);
if (item == m_pVarDef->end()) return false;
if (m_iSynFlags & noVAR) return Error(ecUNEXPECTED_VAR, m_iPos, strTok);
m_iPos = iEnd;
a_Tok.SetVar(item->second, strTok);
m_UsedVar[item->first] = item->second; // Add variable to used-var-list
m_iSynFlags = noVAL | noVAR | noFUN | noBO | noINFIXOP | noSTR;
// Zur Info hier die SynFlags von IsVal():
// m_iSynFlags = noVAL | noVAR | noFUN | noBO | noINFIXOP | noSTR | noASSIGN;
return true;
}
//---------------------------------------------------------------------------
bool ParserTokenReader::IsStrVarTok(token_type &a_Tok) {
if (!m_pStrVarDef || m_pStrVarDef->empty()) return false;
string_type strTok;
int iEnd = ExtractToken(m_pParser->ValidNameChars(), strTok, m_iPos);
if (iEnd == m_iPos) return false;
strmap_type::const_iterator item = m_pStrVarDef->find(strTok);
if (item == m_pStrVarDef->end()) return false;
if (m_iSynFlags & noSTR) return Error(ecUNEXPECTED_VAR, m_iPos, strTok);
m_iPos = iEnd;
if (!m_pParser->m_vStringVarBuf.size()) assert(0 && "muParser internal error");
a_Tok.SetString(m_pParser->m_vStringVarBuf[item->second], m_pParser->m_vStringVarBuf.size());
m_iSynFlags = noANY ^ (noBC | noOPT | noEND | noARG_SEP);
return true;
}
//---------------------------------------------------------------------------
/** \brief Check wheter a token at a given position is an undefined variable.
\param a_Tok [out] If a variable tom_pParser->m_vStringBufken has been found it will be placed
here.
\return true if a variable token has been found.
*/
bool ParserTokenReader::IsUndefVarTok(token_type &a_Tok) {
string_type strTok;
int iEnd(ExtractToken(m_pParser->ValidNameChars(), strTok, m_iPos));
if (iEnd == m_iPos) return false;
if (m_iSynFlags & noVAR) {
// <ibg/> 20061021 added token string strTok instead of a_Tok.GetAsString() as the
// token identifier.
// related bug report:
// http://sourceforge.net/tracker/index.php?func=detail&aid=1578779&group_id=137191&atid=737979
return Error(ecUNEXPECTED_VAR, m_iPos - (int)a_Tok.GetAsString().length(), strTok);
}
// If a factory is available implicitely create new variables
if (m_pFactory) {
value_type *fVar = m_pFactory(strTok.c_str(), m_pFactoryData);
a_Tok.SetVar(fVar, strTok);
// Do not use m_pParser->DefineVar( strTok, fVar );
// in order to define the new variable, it will clear the
// m_UsedVar array which will kill previously defined variables
// from the list
// This is safe because the new variable can never override an existing one
// because they are checked first!
(*m_pVarDef)[strTok] = fVar;
m_UsedVar[strTok] = fVar; // Add variable to used-var-list
} else {
a_Tok.SetVar((value_type *)&m_fZero, strTok);
m_UsedVar[strTok] = 0; // Add variable to used-var-list
}
m_iPos = iEnd;
// Call the variable factory in order to let it define a new parser variable
m_iSynFlags = noVAL | noVAR | noFUN | noBO | noPOSTOP | noINFIXOP | noSTR;
return true;
}
//---------------------------------------------------------------------------
/** \brief Check wheter a token at a given position is a string.
\param a_Tok [out] If a variable token has been found it will be placed here.
\return true if a string token has been found.
\sa IsOprt, IsFunTok, IsStrFunTok, IsValTok, IsVarTok, IsEOF, IsInfixOpTok, IsPostOpTok
*/
bool ParserTokenReader::IsString(token_type &a_Tok) {
if (m_strFormula[m_iPos] != '"') return false;
string_type strBuf(&m_strFormula[m_iPos + 1]);
std::size_t iEnd(0), iSkip(0);
// parser over escaped '\"' end replace them with '"'
for (iEnd = (int)strBuf.find(_T("\"")); iEnd != 0 && iEnd != string_type::npos;
iEnd = (int)strBuf.find(_T("\""), iEnd)) {
if (strBuf[iEnd - 1] != '\\') break;
strBuf.replace(iEnd - 1, 2, _T("\""));
iSkip++;
}
if (iEnd == string_type::npos) return Error(ecUNTERMINATED_STRING, m_iPos, _T("\""));
string_type strTok(strBuf.begin(), strBuf.begin() + iEnd);
if (m_iSynFlags & noSTR) return Error(ecUNEXPECTED_STR, m_iPos, strTok);
m_pParser->m_vStringBuf.push_back(strTok); // Store string in internal buffer
a_Tok.SetString(strTok, m_pParser->m_vStringBuf.size());
m_iPos += (int)strTok.length() + 2 +
(int)iSkip; // +2 wg Anführungszeichen; +iSkip für entfernte escape zeichen
m_iSynFlags = noANY ^ (noARG_SEP | noBC | noOPT | noEND);
return true;
}
//---------------------------------------------------------------------------
/** \brief Create an error containing the parse error position. Store it in parseError_, if not
already set.
\param a_iErrc [in] The error code of type #EErrorCodes.
\param a_iPos [in] The position where the error was detected.
\param a_strTok [in] The token string representation associated with the error.
*/
bool ParserTokenReader::Error(EErrorCodes a_iErrc, int a_iPos, const string_type &a_sTok) {
if (!firstError_.has_error()) {
firstError_ = m_pParser->Error(a_iErrc, a_iPos, a_sTok);
}
return false;
}
//---------------------------------------------------------------------------
void ParserTokenReader::SetArgSep(char_type cArgSep) { m_cArgSep = cArgSep; }
//---------------------------------------------------------------------------
char_type ParserTokenReader::GetArgSep() const { return m_cArgSep; }
} // namespace mu

View file

@ -7,6 +7,8 @@
#include <algorithm>
#include <string>
#include "tinyexpr.h"
#include "builtin.h"
#include "builtin_math.h"
#include "common.h"
@ -15,10 +17,6 @@
#include "wgetopt.h"
#include "wutil.h" // IWYU pragma: keep
#include "muParser.h"
#include "muParserBase.h"
#include "muParserDef.h"
struct math_cmd_opts_t {
bool print_help = false;
int scale = 0;
@ -115,43 +113,25 @@ static const wchar_t *math_get_arg(int *argidx, wchar_t **argv, wcstring *storag
return math_get_arg_argv(argidx, argv);
}
/// Implement integer modulo math operator.
static mu::ValueOrError moduloOperator(double v, double w) { return (int)v % std::max(1, (int)w); };
/// Evaluate math expressions.
static int evaluate_expression(const wchar_t *cmd, parser_t &parser, io_streams_t &streams,
math_cmd_opts_t &opts, wcstring &expression) {
UNUSED(parser);
// Helper to print an error and return an error code.
auto printError = [&streams, cmd](const mu::ParserError &err) {
streams.err.append_format(_(L"%ls: Invalid expression: %ls\n"), cmd, err.GetMsg().c_str());
return STATUS_CMD_ERROR;
};
mu::Parser p;
// MuParser doesn't implement the modulo operator so we add it ourselves since there are
// likely users of our old math wrapper around bc that expect it to be available.
p.DefineOprtChars(L"%");
mu::OptionalError oerr = p.DefineOprt(L"%", moduloOperator, mu::prINFIX);
assert(!oerr.has_error() && "Unexpected error defining modulo operator");
(void)oerr;
oerr = p.SetExpr(expression);
if (oerr.has_error()) return printError(oerr.error());
std::vector<mu::ValueOrError> vs;
p.Eval(&vs);
for (const mu::ValueOrError &v : vs) {
if (v.has_error()) return printError(v.error());
}
for (const mu::ValueOrError &v : vs) {
int error;
char *narrow_str = wcs2str(expression);
double v = te_interp(narrow_str, &error);
if (error == 0) {
if (opts.scale == 0) {
streams.out.append_format(L"%ld\n", static_cast<long>(*v));
streams.out.append_format(L"%ld\n", static_cast<long>(v));
} else {
streams.out.append_format(L"%.*lf\n", opts.scale, *v);
streams.out.append_format(L"%.*lf\n", opts.scale, v);
}
} else {
// TODO: Better error reporting!
streams.err.append_format(L"'%ls': Error at token %d\n", expression.c_str(), error - 1);
}
free(narrow_str);
return STATUS_CMD_OK;
}

653
src/tinyexpr.c Executable file
View file

@ -0,0 +1,653 @@
/*
* TINYEXPR - Tiny recursive descent parser and evaluation engine in C
*
* Copyright (c) 2015, 2016 Lewis Van Winkle
*
* http://CodePlea.com
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgement in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
/* COMPILE TIME OPTIONS */
/* Exponentiation associativity:
For a^b^c = (a^b)^c and -a^b = (-a)^b do nothing.
For a^b^c = a^(b^c) and -a^b = -(a^b) uncomment the next line.*/
/* #define TE_POW_FROM_RIGHT */
/* Logarithms
For log = base 10 log do nothing
For log = natural log uncomment the next line. */
/* #define TE_NAT_LOG */
#include "tinyexpr.h"
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <stdio.h>
#include <limits.h>
#ifndef NAN
#define NAN (0.0/0.0)
#endif
#ifndef INFINITY
#define INFINITY (1.0/0.0)
#endif
typedef double (*te_fun2)(double, double);
enum {
TOK_NULL = TE_CLOSURE7+1, TOK_ERROR, TOK_END, TOK_SEP,
TOK_OPEN, TOK_CLOSE, TOK_NUMBER, TOK_VARIABLE, TOK_INFIX
};
enum {TE_CONSTANT = 1};
typedef struct state {
const char *start;
const char *next;
int type;
union {double value; const double *bound; const void *function;};
void *context;
const te_variable *lookup;
int lookup_len;
} state;
#define TYPE_MASK(TYPE) ((TYPE)&0x0000001F)
#define IS_PURE(TYPE) (((TYPE) & TE_FLAG_PURE) != 0)
#define IS_FUNCTION(TYPE) (((TYPE) & TE_FUNCTION0) != 0)
#define IS_CLOSURE(TYPE) (((TYPE) & TE_CLOSURE0) != 0)
#define ARITY(TYPE) ( ((TYPE) & (TE_FUNCTION0 | TE_CLOSURE0)) ? ((TYPE) & 0x00000007) : 0 )
#define NEW_EXPR(type, ...) new_expr((type), (const te_expr*[]){__VA_ARGS__})
static te_expr *new_expr(const int type, const te_expr *parameters[]) {
const int arity = ARITY(type);
const int psize = sizeof(void*) * arity;
const int size = (sizeof(te_expr) - sizeof(void*)) + psize + (IS_CLOSURE(type) ? sizeof(void*) : 0);
te_expr *ret = malloc(size);
memset(ret, 0, size);
if (arity && parameters) {
memcpy(ret->parameters, parameters, psize);
}
ret->type = type;
ret->bound = 0;
return ret;
}
void te_free_parameters(te_expr *n) {
if (!n) return;
switch (TYPE_MASK(n->type)) {
case TE_FUNCTION7: case TE_CLOSURE7: te_free(n->parameters[6]);
case TE_FUNCTION6: case TE_CLOSURE6: te_free(n->parameters[5]);
case TE_FUNCTION5: case TE_CLOSURE5: te_free(n->parameters[4]);
case TE_FUNCTION4: case TE_CLOSURE4: te_free(n->parameters[3]);
case TE_FUNCTION3: case TE_CLOSURE3: te_free(n->parameters[2]);
case TE_FUNCTION2: case TE_CLOSURE2: te_free(n->parameters[1]);
case TE_FUNCTION1: case TE_CLOSURE1: te_free(n->parameters[0]);
}
}
void te_free(te_expr *n) {
if (!n) return;
te_free_parameters(n);
free(n);
}
static double pi() {return 3.14159265358979323846;}
static double e() {return 2.71828182845904523536;}
static double fac(double a) {/* simplest version of fac */
if (a < 0.0)
return NAN;
if (a > UINT_MAX)
return INFINITY;
unsigned int ua = (unsigned int)(a);
unsigned long int result = 1, i;
for (i = 1; i <= ua; i++) {
if (i > ULONG_MAX / result)
return INFINITY;
result *= i;
}
return (double)result;
}
static double ncr(double n, double r) {
if (n < 0.0 || r < 0.0 || n < r) return NAN;
if (n > UINT_MAX || r > UINT_MAX) return INFINITY;
unsigned long int un = (unsigned int)(n), ur = (unsigned int)(r), i;
unsigned long int result = 1;
if (ur > un / 2) ur = un - ur;
for (i = 1; i <= ur; i++) {
if (result > ULONG_MAX / (un - ur + i))
return INFINITY;
result *= un - ur + i;
result /= i;
}
return result;
}
static double npr(double n, double r) {return ncr(n, r) * fac(r);}
static const te_variable functions[] = {
/* must be in alphabetical order */
{"abs", fabs, TE_FUNCTION1 | TE_FLAG_PURE, 0},
{"acos", acos, TE_FUNCTION1 | TE_FLAG_PURE, 0},
{"asin", asin, TE_FUNCTION1 | TE_FLAG_PURE, 0},
{"atan", atan, TE_FUNCTION1 | TE_FLAG_PURE, 0},
{"atan2", atan2, TE_FUNCTION2 | TE_FLAG_PURE, 0},
{"ceil", ceil, TE_FUNCTION1 | TE_FLAG_PURE, 0},
{"cos", cos, TE_FUNCTION1 | TE_FLAG_PURE, 0},
{"cosh", cosh, TE_FUNCTION1 | TE_FLAG_PURE, 0},
{"e", e, TE_FUNCTION0 | TE_FLAG_PURE, 0},
{"exp", exp, TE_FUNCTION1 | TE_FLAG_PURE, 0},
{"fac", fac, TE_FUNCTION1 | TE_FLAG_PURE, 0},
{"floor", floor, TE_FUNCTION1 | TE_FLAG_PURE, 0},
{"ln", log, TE_FUNCTION1 | TE_FLAG_PURE, 0},
#ifdef TE_NAT_LOG
{"log", log, TE_FUNCTION1 | TE_FLAG_PURE, 0},
#else
{"log", log10, TE_FUNCTION1 | TE_FLAG_PURE, 0},
#endif
{"log10", log10, TE_FUNCTION1 | TE_FLAG_PURE, 0},
{"ncr", ncr, TE_FUNCTION2 | TE_FLAG_PURE, 0},
{"npr", npr, TE_FUNCTION2 | TE_FLAG_PURE, 0},
{"pi", pi, TE_FUNCTION0 | TE_FLAG_PURE, 0},
{"pow", pow, TE_FUNCTION2 | TE_FLAG_PURE, 0},
{"sin", sin, TE_FUNCTION1 | TE_FLAG_PURE, 0},
{"sinh", sinh, TE_FUNCTION1 | TE_FLAG_PURE, 0},
{"sqrt", sqrt, TE_FUNCTION1 | TE_FLAG_PURE, 0},
{"tan", tan, TE_FUNCTION1 | TE_FLAG_PURE, 0},
{"tanh", tanh, TE_FUNCTION1 | TE_FLAG_PURE, 0},
{0, 0, 0, 0}
};
static const te_variable *find_builtin(const char *name, int len) {
int imin = 0;
int imax = sizeof(functions) / sizeof(te_variable) - 2;
/*Binary search.*/
while (imax >= imin) {
const int i = (imin + ((imax-imin)/2));
int c = strncmp(name, functions[i].name, len);
if (!c) c = '\0' - functions[i].name[len];
if (c == 0) {
return functions + i;
} else if (c > 0) {
imin = i + 1;
} else {
imax = i - 1;
}
}
return 0;
}
static const te_variable *find_lookup(const state *s, const char *name, int len) {
int iters;
const te_variable *var;
if (!s->lookup) return 0;
for (var = s->lookup, iters = s->lookup_len; iters; ++var, --iters) {
if (strncmp(name, var->name, len) == 0 && var->name[len] == '\0') {
return var;
}
}
return 0;
}
static double add(double a, double b) {return a + b;}
static double sub(double a, double b) {return a - b;}
static double mul(double a, double b) {return a * b;}
static double divide(double a, double b) {return a / b;}
static double negate(double a) {return -a;}
static double comma(double a, double b) {(void)a; return b;}
void next_token(state *s) {
s->type = TOK_NULL;
do {
if (!*s->next){
s->type = TOK_END;
return;
}
/* Try reading a number. */
if ((s->next[0] >= '0' && s->next[0] <= '9') || s->next[0] == '.') {
s->value = strtod(s->next, (char**)&s->next);
s->type = TOK_NUMBER;
} else {
/* Look for a variable or builtin function call. */
if (s->next[0] >= 'a' && s->next[0] <= 'z') {
const char *start;
start = s->next;
while ((s->next[0] >= 'a' && s->next[0] <= 'z') || (s->next[0] >= '0' && s->next[0] <= '9') || (s->next[0] == '_')) s->next++;
const te_variable *var = find_lookup(s, start, s->next - start);
if (!var) var = find_builtin(start, s->next - start);
if (!var) {
s->type = TOK_ERROR;
} else {
switch(TYPE_MASK(var->type))
{
case TE_VARIABLE:
s->type = TOK_VARIABLE;
s->bound = var->address;
break;
case TE_CLOSURE0: case TE_CLOSURE1: case TE_CLOSURE2: case TE_CLOSURE3:
case TE_CLOSURE4: case TE_CLOSURE5: case TE_CLOSURE6: case TE_CLOSURE7:
s->context = var->context;
case TE_FUNCTION0: case TE_FUNCTION1: case TE_FUNCTION2: case TE_FUNCTION3:
case TE_FUNCTION4: case TE_FUNCTION5: case TE_FUNCTION6: case TE_FUNCTION7:
s->type = var->type;
s->function = var->address;
break;
}
}
} else {
/* Look for an operator or special character. */
switch (s->next++[0]) {
case '+': s->type = TOK_INFIX; s->function = add; break;
case '-': s->type = TOK_INFIX; s->function = sub; break;
case '*': s->type = TOK_INFIX; s->function = mul; break;
case '/': s->type = TOK_INFIX; s->function = divide; break;
case '^': s->type = TOK_INFIX; s->function = pow; break;
case '%': s->type = TOK_INFIX; s->function = fmod; break;
case '(': s->type = TOK_OPEN; break;
case ')': s->type = TOK_CLOSE; break;
case ',': s->type = TOK_SEP; break;
case ' ': case '\t': case '\n': case '\r': break;
default: s->type = TOK_ERROR; break;
}
}
}
} while (s->type == TOK_NULL);
}
static te_expr *list(state *s);
static te_expr *expr(state *s);
static te_expr *power(state *s);
static te_expr *base(state *s) {
/* <base> = <constant> | <variable> | <function-0> {"(" ")"} | <function-1> <power> | <function-X> "(" <expr> {"," <expr>} ")" | "(" <list> ")" */
te_expr *ret;
int arity;
switch (TYPE_MASK(s->type)) {
case TOK_NUMBER:
ret = new_expr(TE_CONSTANT, 0);
ret->value = s->value;
next_token(s);
break;
case TOK_VARIABLE:
ret = new_expr(TE_VARIABLE, 0);
ret->bound = s->bound;
next_token(s);
break;
case TE_FUNCTION0:
case TE_CLOSURE0:
ret = new_expr(s->type, 0);
ret->function = s->function;
if (IS_CLOSURE(s->type)) ret->parameters[0] = s->context;
next_token(s);
if (s->type == TOK_OPEN) {
next_token(s);
if (s->type != TOK_CLOSE) {
s->type = TOK_ERROR;
} else {
next_token(s);
}
}
break;
case TE_FUNCTION1:
case TE_CLOSURE1:
ret = new_expr(s->type, 0);
ret->function = s->function;
if (IS_CLOSURE(s->type)) ret->parameters[1] = s->context;
next_token(s);
ret->parameters[0] = power(s);
break;
case TE_FUNCTION2: case TE_FUNCTION3: case TE_FUNCTION4:
case TE_FUNCTION5: case TE_FUNCTION6: case TE_FUNCTION7:
case TE_CLOSURE2: case TE_CLOSURE3: case TE_CLOSURE4:
case TE_CLOSURE5: case TE_CLOSURE6: case TE_CLOSURE7:
arity = ARITY(s->type);
ret = new_expr(s->type, 0);
ret->function = s->function;
if (IS_CLOSURE(s->type)) ret->parameters[arity] = s->context;
next_token(s);
if (s->type != TOK_OPEN) {
s->type = TOK_ERROR;
} else {
int i;
for(i = 0; i < arity; i++) {
next_token(s);
ret->parameters[i] = expr(s);
if(s->type != TOK_SEP) {
break;
}
}
if(s->type != TOK_CLOSE || i != arity - 1) {
s->type = TOK_ERROR;
} else {
next_token(s);
}
}
break;
case TOK_OPEN:
next_token(s);
ret = list(s);
if (s->type != TOK_CLOSE) {
s->type = TOK_ERROR;
} else {
next_token(s);
}
break;
default:
ret = new_expr(0, 0);
s->type = TOK_ERROR;
ret->value = NAN;
break;
}
return ret;
}
static te_expr *power(state *s) {
/* <power> = {("-" | "+")} <base> */
int sign = 1;
while (s->type == TOK_INFIX && (s->function == add || s->function == sub)) {
if (s->function == sub) sign = -sign;
next_token(s);
}
te_expr *ret;
if (sign == 1) {
ret = base(s);
} else {
ret = NEW_EXPR(TE_FUNCTION1 | TE_FLAG_PURE, base(s));
ret->function = negate;
}
return ret;
}
#ifdef TE_POW_FROM_RIGHT
static te_expr *factor(state *s) {
/* <factor> = <power> {"^" <power>} */
te_expr *ret = power(s);
int neg = 0;
te_expr *insertion = 0;
if (ret->type == (TE_FUNCTION1 | TE_FLAG_PURE) && ret->function == negate) {
te_expr *se = ret->parameters[0];
free(ret);
ret = se;
neg = 1;
}
while (s->type == TOK_INFIX && (s->function == pow)) {
te_fun2 t = s->function;
next_token(s);
if (insertion) {
/* Make exponentiation go right-to-left. */
te_expr *insert = NEW_EXPR(TE_FUNCTION2 | TE_FLAG_PURE, insertion->parameters[1], power(s));
insert->function = t;
insertion->parameters[1] = insert;
insertion = insert;
} else {
ret = NEW_EXPR(TE_FUNCTION2 | TE_FLAG_PURE, ret, power(s));
ret->function = t;
insertion = ret;
}
}
if (neg) {
ret = NEW_EXPR(TE_FUNCTION1 | TE_FLAG_PURE, ret);
ret->function = negate;
}
return ret;
}
#else
static te_expr *factor(state *s) {
/* <factor> = <power> {"^" <power>} */
te_expr *ret = power(s);
while (s->type == TOK_INFIX && (s->function == pow)) {
te_fun2 t = s->function;
next_token(s);
ret = NEW_EXPR(TE_FUNCTION2 | TE_FLAG_PURE, ret, power(s));
ret->function = t;
}
return ret;
}
#endif
static te_expr *term(state *s) {
/* <term> = <factor> {("*" | "/" | "%") <factor>} */
te_expr *ret = factor(s);
while (s->type == TOK_INFIX && (s->function == mul || s->function == divide || s->function == fmod)) {
te_fun2 t = s->function;
next_token(s);
ret = NEW_EXPR(TE_FUNCTION2 | TE_FLAG_PURE, ret, factor(s));
ret->function = t;
}
return ret;
}
static te_expr *expr(state *s) {
/* <expr> = <term> {("+" | "-") <term>} */
te_expr *ret = term(s);
while (s->type == TOK_INFIX && (s->function == add || s->function == sub)) {
te_fun2 t = s->function;
next_token(s);
ret = NEW_EXPR(TE_FUNCTION2 | TE_FLAG_PURE, ret, term(s));
ret->function = t;
}
return ret;
}
static te_expr *list(state *s) {
/* <list> = <expr> {"," <expr>} */
te_expr *ret = expr(s);
while (s->type == TOK_SEP) {
next_token(s);
ret = NEW_EXPR(TE_FUNCTION2 | TE_FLAG_PURE, ret, expr(s));
ret->function = comma;
}
return ret;
}
#define TE_FUN(...) ((double(*)(__VA_ARGS__))n->function)
#define M(e) te_eval(n->parameters[e])
double te_eval(const te_expr *n) {
if (!n) return NAN;
switch(TYPE_MASK(n->type)) {
case TE_CONSTANT: return n->value;
case TE_VARIABLE: return *n->bound;
case TE_FUNCTION0: case TE_FUNCTION1: case TE_FUNCTION2: case TE_FUNCTION3:
case TE_FUNCTION4: case TE_FUNCTION5: case TE_FUNCTION6: case TE_FUNCTION7:
switch(ARITY(n->type)) {
case 0: return TE_FUN(void)();
case 1: return TE_FUN(double)(M(0));
case 2: return TE_FUN(double, double)(M(0), M(1));
case 3: return TE_FUN(double, double, double)(M(0), M(1), M(2));
case 4: return TE_FUN(double, double, double, double)(M(0), M(1), M(2), M(3));
case 5: return TE_FUN(double, double, double, double, double)(M(0), M(1), M(2), M(3), M(4));
case 6: return TE_FUN(double, double, double, double, double, double)(M(0), M(1), M(2), M(3), M(4), M(5));
case 7: return TE_FUN(double, double, double, double, double, double, double)(M(0), M(1), M(2), M(3), M(4), M(5), M(6));
default: return NAN;
}
case TE_CLOSURE0: case TE_CLOSURE1: case TE_CLOSURE2: case TE_CLOSURE3:
case TE_CLOSURE4: case TE_CLOSURE5: case TE_CLOSURE6: case TE_CLOSURE7:
switch(ARITY(n->type)) {
case 0: return TE_FUN(void*)(n->parameters[0]);
case 1: return TE_FUN(void*, double)(n->parameters[1], M(0));
case 2: return TE_FUN(void*, double, double)(n->parameters[2], M(0), M(1));
case 3: return TE_FUN(void*, double, double, double)(n->parameters[3], M(0), M(1), M(2));
case 4: return TE_FUN(void*, double, double, double, double)(n->parameters[4], M(0), M(1), M(2), M(3));
case 5: return TE_FUN(void*, double, double, double, double, double)(n->parameters[5], M(0), M(1), M(2), M(3), M(4));
case 6: return TE_FUN(void*, double, double, double, double, double, double)(n->parameters[6], M(0), M(1), M(2), M(3), M(4), M(5));
case 7: return TE_FUN(void*, double, double, double, double, double, double, double)(n->parameters[7], M(0), M(1), M(2), M(3), M(4), M(5), M(6));
default: return NAN;
}
default: return NAN;
}
}
#undef TE_FUN
#undef M
static void optimize(te_expr *n) {
/* Evaluates as much as possible. */
if (n->type == TE_CONSTANT) return;
if (n->type == TE_VARIABLE) return;
/* Only optimize out functions flagged as pure. */
if (IS_PURE(n->type)) {
const int arity = ARITY(n->type);
int known = 1;
int i;
for (i = 0; i < arity; ++i) {
optimize(n->parameters[i]);
if (((te_expr*)(n->parameters[i]))->type != TE_CONSTANT) {
known = 0;
}
}
if (known) {
const double value = te_eval(n);
te_free_parameters(n);
n->type = TE_CONSTANT;
n->value = value;
}
}
}
te_expr *te_compile(const char *expression, const te_variable *variables, int var_count, int *error) {
state s;
s.start = s.next = expression;
s.lookup = variables;
s.lookup_len = var_count;
next_token(&s);
te_expr *root = list(&s);
if (s.type != TOK_END) {
te_free(root);
if (error) {
*error = (s.next - s.start);
if (*error == 0) *error = 1;
}
return 0;
} else {
optimize(root);
if (error) *error = 0;
return root;
}
}
double te_interp(const char *expression, int *error) {
te_expr *n = te_compile(expression, 0, 0, error);
double ret;
if (n) {
ret = te_eval(n);
te_free(n);
} else {
ret = NAN;
}
return ret;
}
static void pn (const te_expr *n, int depth) {
int i, arity;
printf("%*s", depth, "");
switch(TYPE_MASK(n->type)) {
case TE_CONSTANT: printf("%f\n", n->value); break;
case TE_VARIABLE: printf("bound %p\n", n->bound); break;
case TE_FUNCTION0: case TE_FUNCTION1: case TE_FUNCTION2: case TE_FUNCTION3:
case TE_FUNCTION4: case TE_FUNCTION5: case TE_FUNCTION6: case TE_FUNCTION7:
case TE_CLOSURE0: case TE_CLOSURE1: case TE_CLOSURE2: case TE_CLOSURE3:
case TE_CLOSURE4: case TE_CLOSURE5: case TE_CLOSURE6: case TE_CLOSURE7:
arity = ARITY(n->type);
printf("f%d", arity);
for(i = 0; i < arity; i++) {
printf(" %p", n->parameters[i]);
}
printf("\n");
for(i = 0; i < arity; i++) {
pn(n->parameters[i], depth + 1);
}
break;
}
}
void te_print(const te_expr *n) {
pn(n, 0);
}

86
src/tinyexpr.h Normal file
View file

@ -0,0 +1,86 @@
/*
* TINYEXPR - Tiny recursive descent parser and evaluation engine in C
*
* Copyright (c) 2015, 2016 Lewis Van Winkle
*
* http://CodePlea.com
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgement in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
#ifndef __TINYEXPR_H__
#define __TINYEXPR_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef struct te_expr {
int type;
union {double value; const double *bound; const void *function;};
void *parameters[1];
} te_expr;
enum {
TE_VARIABLE = 0,
TE_FUNCTION0 = 8, TE_FUNCTION1, TE_FUNCTION2, TE_FUNCTION3,
TE_FUNCTION4, TE_FUNCTION5, TE_FUNCTION6, TE_FUNCTION7,
TE_CLOSURE0 = 16, TE_CLOSURE1, TE_CLOSURE2, TE_CLOSURE3,
TE_CLOSURE4, TE_CLOSURE5, TE_CLOSURE6, TE_CLOSURE7,
TE_FLAG_PURE = 32
};
typedef struct te_variable {
const char *name;
const void *address;
int type;
void *context;
} te_variable;
/* Parses the input expression, evaluates it, and frees it. */
/* Returns NaN on error. */
double te_interp(const char *expression, int *error);
/* Parses the input expression and binds variables. */
/* Returns NULL on error. */
te_expr *te_compile(const char *expression, const te_variable *variables, int var_count, int *error);
/* Evaluates the expression. */
double te_eval(const te_expr *n);
/* Prints debugging information on the syntax tree. */
void te_print(const te_expr *n);
/* Frees the expression. */
/* This is safe to call on NULL pointers. */
void te_free(te_expr *n);
#ifdef __cplusplus
}
#endif
#endif /*__TINYEXPR_H__*/