mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 04:43:10 +00:00
[muparser] Remove muParserDLL.h and muParserDLL.cpp
This is a C interface (?) which fish does not use and is not needed.
This commit is contained in:
parent
128aacaf87
commit
bb9e15675e
5 changed files with 3 additions and 941 deletions
|
@ -376,7 +376,6 @@
|
|||
D068222B1F5149B500040321 /* muParserBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D06822221F51498700040321 /* muParserBase.cpp */; };
|
||||
D068222C1F5149B500040321 /* muParserBytecode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D06822231F51498700040321 /* muParserBytecode.cpp */; };
|
||||
D068222D1F5149B500040321 /* muParserCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D06822241F51498700040321 /* muParserCallback.cpp */; };
|
||||
D068222E1F5149B500040321 /* muParserDLL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D06822251F51498700040321 /* muParserDLL.cpp */; };
|
||||
D068222F1F5149B500040321 /* muParserError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D06822261F51498700040321 /* muParserError.cpp */; };
|
||||
D06822301F5149B500040321 /* muParserInt.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D06822271F51498700040321 /* muParserInt.cpp */; };
|
||||
D06822321F5149B500040321 /* muParserTokenReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D06822291F51498700040321 /* muParserTokenReader.cpp */; };
|
||||
|
@ -818,7 +817,6 @@
|
|||
D06822221F51498700040321 /* muParserBase.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = muParserBase.cpp; sourceTree = "<group>"; };
|
||||
D06822231F51498700040321 /* muParserBytecode.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = muParserBytecode.cpp; sourceTree = "<group>"; };
|
||||
D06822241F51498700040321 /* muParserCallback.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = muParserCallback.cpp; sourceTree = "<group>"; };
|
||||
D06822251F51498700040321 /* muParserDLL.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = muParserDLL.cpp; sourceTree = "<group>"; };
|
||||
D06822261F51498700040321 /* muParserError.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = muParserError.cpp; sourceTree = "<group>"; };
|
||||
D06822271F51498700040321 /* muParserInt.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = muParserInt.cpp; sourceTree = "<group>"; };
|
||||
D06822291F51498700040321 /* muParserTokenReader.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = muParserTokenReader.cpp; sourceTree = "<group>"; };
|
||||
|
@ -1077,7 +1075,6 @@
|
|||
D06822221F51498700040321 /* muParserBase.cpp */,
|
||||
D06822231F51498700040321 /* muParserBytecode.cpp */,
|
||||
D06822241F51498700040321 /* muParserCallback.cpp */,
|
||||
D06822251F51498700040321 /* muParserDLL.cpp */,
|
||||
D06822261F51498700040321 /* muParserError.cpp */,
|
||||
D06822271F51498700040321 /* muParserInt.cpp */,
|
||||
D06822291F51498700040321 /* muParserTokenReader.cpp */,
|
||||
|
@ -1924,7 +1921,6 @@
|
|||
D068222B1F5149B500040321 /* muParserBase.cpp in Sources */,
|
||||
D068222C1F5149B500040321 /* muParserBytecode.cpp in Sources */,
|
||||
D068222D1F5149B500040321 /* muParserCallback.cpp in Sources */,
|
||||
D068222E1F5149B500040321 /* muParserDLL.cpp in Sources */,
|
||||
D068222F1F5149B500040321 /* muParserError.cpp in Sources */,
|
||||
D06822301F5149B500040321 /* muParserInt.cpp in Sources */,
|
||||
D06822321F5149B500040321 /* muParserTokenReader.cpp in Sources */,
|
||||
|
|
1
muparser-2.2.5/CMakeLists.txt
vendored
1
muparser-2.2.5/CMakeLists.txt
vendored
|
@ -3,7 +3,6 @@ SET(MUPARSER_SRCS
|
|||
${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/muParserDLL.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/muParserError.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/muParserInt.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/muParserTokenReader.cpp)
|
||||
|
|
81
muparser-2.2.5/Makefile.in
vendored
81
muparser-2.2.5/Makefile.in
vendored
|
@ -49,7 +49,6 @@ MUPARSER_LIB_OBJECTS = \
|
|||
muParser_lib_muParserBase.o \
|
||||
muParser_lib_muParserBytecode.o \
|
||||
muParser_lib_muParserCallback.o \
|
||||
muParser_lib_muParserDLL.o \
|
||||
muParser_lib_muParserError.o \
|
||||
muParser_lib_muParserInt.o \
|
||||
muParser_lib_muParserTest.o \
|
||||
|
@ -59,32 +58,6 @@ MUPARSER_LIB_HEADERS = \
|
|||
include/muParserBase.h \
|
||||
include/muParserBytecode.h \
|
||||
include/muParserCallback.h \
|
||||
include/muParserDLL.h \
|
||||
include/muParserDef.h \
|
||||
include/muParserFixes.h \
|
||||
include/muParserInt.h \
|
||||
include/muParserTemplateMagic.h \
|
||||
include/muParserTest.h \
|
||||
include/muParserToken.h \
|
||||
include/muParserTokenReader.h
|
||||
MUPARSER_DLL_CXXFLAGS = $(____DEBUG) $(____SHARED) $(____SHARED_0) \
|
||||
-I$(srcdir)/include $(PIC_FLAG) $(CPPFLAGS) $(CXXFLAGS) -std=c++11
|
||||
MUPARSER_DLL_OBJECTS = \
|
||||
muParser_dll_muParser.o \
|
||||
muParser_dll_muParserBase.o \
|
||||
muParser_dll_muParserBytecode.o \
|
||||
muParser_dll_muParserCallback.o \
|
||||
muParser_dll_muParserDLL.o \
|
||||
muParser_dll_muParserError.o \
|
||||
muParser_dll_muParserInt.o \
|
||||
muParser_dll_muParserTest.o \
|
||||
muParser_dll_muParserTokenReader.o
|
||||
MUPARSER_DLL_HEADERS = \
|
||||
include/muParser.h \
|
||||
include/muParserBase.h \
|
||||
include/muParserBytecode.h \
|
||||
include/muParserCallback.h \
|
||||
include/muParserDLL.h \
|
||||
include/muParserDef.h \
|
||||
include/muParserFixes.h \
|
||||
include/muParserInt.h \
|
||||
|
@ -102,17 +75,13 @@ EXAMPLE1_OBJECTS = \
|
|||
@COND_DEPS_TRACKING_1@CXXC = $(BK_DEPS) $(CXX)
|
||||
@COND_DEBUG_0@DEBUG_BUILD_POSTFIX =
|
||||
@COND_DEBUG_1@DEBUG_BUILD_POSTFIX = d
|
||||
@COND_SHARED_0@__muParser_lib___depname = \
|
||||
@COND_SHARED_0@ $(top_builddir)/lib/$(LIBPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(LIBEXT)
|
||||
__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___muParser_dll___depname = \
|
||||
$(top_builddir)/lib/$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf3)
|
||||
@COND_SHARED_1@__muParser_dll___depname = $(COND_SHARED_1___muParser_dll___depname)
|
||||
@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 \
|
||||
|
@ -204,7 +173,7 @@ __example1___depname = $(top_builddir)/samples/example1/example1$(EXEEXT)
|
|||
|
||||
### Targets: ###
|
||||
|
||||
all: $(__muParser_lib___depname) $(__muParser_dll___depname) $(__example1___depname)
|
||||
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
|
||||
|
@ -254,12 +223,9 @@ distclean: clean
|
|||
@COND_SHARED_0@ rm -f $(DESTDIR)$(prefix)/$$f; \
|
||||
@COND_SHARED_0@ done
|
||||
|
||||
@COND_SHARED_1@$(top_builddir)/lib/$(DLLPREFIX)muparser$(DEBUG_BUILD_POSTFIX)$(__muParser_dll___targetsuf3): $(MUPARSER_DLL_OBJECTS)
|
||||
@COND_SHARED_1@ $(SHARED_LD_CXX) $@ $(MUPARSER_DLL_OBJECTS) $(__muParser_dll___macinstnamecmd) $(__muParser_dll___importlib) $(__muParser_dll___soname_flags) $(__muParser_dll___macver) $(LDFLAGS) $(LIBS)
|
||||
@COND_SHARED_1@
|
||||
@COND_SHARED_1@ $(__muParser_dll___so_symlinks_cmd)
|
||||
|
||||
@COND_SHARED_1@install_muParser_dll: $(__muParser_dll___depname)
|
||||
@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)
|
||||
|
@ -270,26 +236,12 @@ distclean: clean
|
|||
@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_SHARED_1@install_muParser_dll_headers:
|
||||
@COND_SHARED_1@ $(INSTALL_DIR) $(DESTDIR)$(prefix)
|
||||
@COND_SHARED_1@ for f in $(MUPARSER_DLL_HEADERS); do \
|
||||
@COND_SHARED_1@ if test ! -d $(DESTDIR)$(prefix)/`dirname $$f` ; then \
|
||||
@COND_SHARED_1@ $(INSTALL_DIR) $(DESTDIR)$(prefix)/`dirname $$f`; \
|
||||
@COND_SHARED_1@ fi; \
|
||||
@COND_SHARED_1@ $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(prefix)/$$f; \
|
||||
@COND_SHARED_1@ done
|
||||
|
||||
@COND_SHARED_1@uninstall_muParser_dll_headers:
|
||||
@COND_SHARED_1@ for f in $(MUPARSER_DLL_HEADERS); do \
|
||||
@COND_SHARED_1@ rm -f $(DESTDIR)$(prefix)/$$f; \
|
||||
@COND_SHARED_1@ done
|
||||
|
||||
@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) $(__muParser_dll___depname)
|
||||
lib: $(__muParser_lib___depname)
|
||||
|
||||
samples: $(__example1___depname)
|
||||
|
||||
|
@ -323,33 +275,6 @@ muParser_lib_muParserTest.o: $(srcdir)/src/muParserTest.cpp
|
|||
muParser_lib_muParserTokenReader.o: $(srcdir)/src/muParserTokenReader.cpp
|
||||
$(CXXC) -c -o $@ $(MUPARSER_LIB_CXXFLAGS) $(srcdir)/src/muParserTokenReader.cpp
|
||||
|
||||
muParser_dll_muParser.o: $(srcdir)/src/muParser.cpp
|
||||
$(CXXC) -c -o $@ $(MUPARSER_DLL_CXXFLAGS) $(srcdir)/src/muParser.cpp
|
||||
|
||||
muParser_dll_muParserBase.o: $(srcdir)/src/muParserBase.cpp
|
||||
$(CXXC) -c -o $@ $(MUPARSER_DLL_CXXFLAGS) $(srcdir)/src/muParserBase.cpp
|
||||
|
||||
muParser_dll_muParserBytecode.o: $(srcdir)/src/muParserBytecode.cpp
|
||||
$(CXXC) -c -o $@ $(MUPARSER_DLL_CXXFLAGS) $(srcdir)/src/muParserBytecode.cpp
|
||||
|
||||
muParser_dll_muParserCallback.o: $(srcdir)/src/muParserCallback.cpp
|
||||
$(CXXC) -c -o $@ $(MUPARSER_DLL_CXXFLAGS) $(srcdir)/src/muParserCallback.cpp
|
||||
|
||||
muParser_dll_muParserDLL.o: $(srcdir)/src/muParserDLL.cpp
|
||||
$(CXXC) -c -o $@ $(MUPARSER_DLL_CXXFLAGS) $(srcdir)/src/muParserDLL.cpp
|
||||
|
||||
muParser_dll_muParserError.o: $(srcdir)/src/muParserError.cpp
|
||||
$(CXXC) -c -o $@ $(MUPARSER_DLL_CXXFLAGS) $(srcdir)/src/muParserError.cpp
|
||||
|
||||
muParser_dll_muParserInt.o: $(srcdir)/src/muParserInt.cpp
|
||||
$(CXXC) -c -o $@ $(MUPARSER_DLL_CXXFLAGS) $(srcdir)/src/muParserInt.cpp
|
||||
|
||||
muParser_dll_muParserTest.o: $(srcdir)/src/muParserTest.cpp
|
||||
$(CXXC) -c -o $@ $(MUPARSER_DLL_CXXFLAGS) $(srcdir)/src/muParserTest.cpp
|
||||
|
||||
muParser_dll_muParserTokenReader.o: $(srcdir)/src/muParserTokenReader.cpp
|
||||
$(CXXC) -c -o $@ $(MUPARSER_DLL_CXXFLAGS) $(srcdir)/src/muParserTokenReader.cpp
|
||||
|
||||
example1_example1.o: $(srcdir)/samples/example1/example1.cpp
|
||||
$(CXXC) -c -o $@ $(EXAMPLE1_CXXFLAGS) $(srcdir)/samples/example1/example1.cpp
|
||||
|
||||
|
|
|
@ -1,228 +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.
|
||||
*/
|
||||
#ifndef MU_PARSER_DLL_H
|
||||
#define MU_PARSER_DLL_H
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
#ifdef MUPARSERLIB_EXPORTS
|
||||
#define API_EXPORT(TYPE) __declspec(dllexport) TYPE __cdecl
|
||||
#else
|
||||
#define API_EXPORT(TYPE) __declspec(dllimport) TYPE __cdecl
|
||||
#endif
|
||||
#else
|
||||
#define API_EXPORT(TYPE) TYPE
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** \file
|
||||
\brief This file contains the DLL interface of muparser.
|
||||
*/
|
||||
|
||||
// Basic types
|
||||
typedef void *muParserHandle_t; // parser handle
|
||||
|
||||
#ifndef _UNICODE
|
||||
typedef char muChar_t; // character type
|
||||
#else
|
||||
typedef wchar_t muChar_t; // character type
|
||||
#endif
|
||||
|
||||
typedef int muBool_t; // boolean type
|
||||
typedef int muInt_t; // integer type
|
||||
typedef double muFloat_t; // floating point type
|
||||
using mu::ValueOrError;
|
||||
|
||||
// function types for calculation
|
||||
typedef ValueOrError (*muFun0_t)();
|
||||
typedef ValueOrError (*muFun1_t)(muFloat_t);
|
||||
typedef ValueOrError (*muFun2_t)(muFloat_t, muFloat_t);
|
||||
typedef ValueOrError (*muFun3_t)(muFloat_t, muFloat_t, muFloat_t);
|
||||
typedef ValueOrError (*muFun4_t)(muFloat_t, muFloat_t, muFloat_t, muFloat_t);
|
||||
typedef ValueOrError (*muFun5_t)(muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t);
|
||||
typedef ValueOrError (*muFun6_t)(muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t);
|
||||
typedef ValueOrError (*muFun7_t)(muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t,
|
||||
muFloat_t);
|
||||
typedef ValueOrError (*muFun8_t)(muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t,
|
||||
muFloat_t, muFloat_t);
|
||||
typedef ValueOrError (*muFun9_t)(muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t,
|
||||
muFloat_t, muFloat_t, muFloat_t);
|
||||
typedef ValueOrError (*muFun10_t)(muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t,
|
||||
muFloat_t, muFloat_t, muFloat_t, muFloat_t);
|
||||
|
||||
typedef ValueOrError (*muMultFun_t)(const muFloat_t *, muInt_t);
|
||||
typedef ValueOrError (*muStrFun1_t)(const muChar_t *);
|
||||
typedef ValueOrError (*muStrFun2_t)(const muChar_t *, muFloat_t);
|
||||
typedef ValueOrError (*muStrFun3_t)(const muChar_t *, muFloat_t, muFloat_t);
|
||||
|
||||
// Functions for parser management
|
||||
typedef void (*muErrorHandler_t)(
|
||||
muParserHandle_t a_hParser); // [optional] callback to an error handler
|
||||
typedef muFloat_t *(*muFacFun_t)(const muChar_t *,
|
||||
void *); // [optional] callback for creating new variables
|
||||
typedef muInt_t (*muIdentFun_t)(const muChar_t *, muInt_t *,
|
||||
muFloat_t *); // [optional] value identification callbacks
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
// Constants
|
||||
static const int muOPRT_ASCT_LEFT = 0;
|
||||
static const int muOPRT_ASCT_RIGHT = 1;
|
||||
|
||||
static const int muBASETYPE_FLOAT = 0;
|
||||
static const int muBASETYPE_INT = 1;
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
// muParser C compatible bindings
|
||||
//
|
||||
//
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
|
||||
// Basic operations / initialization
|
||||
API_EXPORT(muParserHandle_t) mupCreate(int nBaseType);
|
||||
API_EXPORT(void) mupRelease(muParserHandle_t a_hParser);
|
||||
API_EXPORT(const muChar_t *) mupGetExpr(muParserHandle_t a_hParser);
|
||||
API_EXPORT(void) mupSetExpr(muParserHandle_t a_hParser, const muChar_t *a_szExpr);
|
||||
API_EXPORT(void)
|
||||
mupSetVarFactory(muParserHandle_t a_hParser, muFacFun_t a_pFactory, void *pUserData);
|
||||
API_EXPORT(const muChar_t *) mupGetVersion(muParserHandle_t a_hParser);
|
||||
API_EXPORT(muFloat_t) mupEval(muParserHandle_t a_hParser);
|
||||
|
||||
// Defining callbacks / variables / constants
|
||||
API_EXPORT(void)
|
||||
mupDefineFun0(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun0_t a_pFun,
|
||||
muBool_t a_bOptimize);
|
||||
API_EXPORT(void)
|
||||
mupDefineFun1(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun1_t a_pFun,
|
||||
muBool_t a_bOptimize);
|
||||
API_EXPORT(void)
|
||||
mupDefineFun2(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun2_t a_pFun,
|
||||
muBool_t a_bOptimize);
|
||||
API_EXPORT(void)
|
||||
mupDefineFun3(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun3_t a_pFun,
|
||||
muBool_t a_bOptimize);
|
||||
API_EXPORT(void)
|
||||
mupDefineFun4(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun4_t a_pFun,
|
||||
muBool_t a_bOptimize);
|
||||
API_EXPORT(void)
|
||||
mupDefineFun5(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun5_t a_pFun,
|
||||
muBool_t a_bOptimize);
|
||||
API_EXPORT(void)
|
||||
mupDefineFun6(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun6_t a_pFun,
|
||||
muBool_t a_bOptimize);
|
||||
API_EXPORT(void)
|
||||
mupDefineFun7(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun7_t a_pFun,
|
||||
muBool_t a_bOptimize);
|
||||
API_EXPORT(void)
|
||||
mupDefineFun8(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun8_t a_pFun,
|
||||
muBool_t a_bOptimize);
|
||||
API_EXPORT(void)
|
||||
mupDefineFun9(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun9_t a_pFun,
|
||||
muBool_t a_bOptimize);
|
||||
API_EXPORT(void)
|
||||
mupDefineFun10(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun10_t a_pFun,
|
||||
muBool_t a_bOptimize);
|
||||
|
||||
// string functions
|
||||
API_EXPORT(void)
|
||||
mupDefineStrFun1(muParserHandle_t a_hParser, const muChar_t *a_szName, muStrFun1_t a_pFun);
|
||||
API_EXPORT(void)
|
||||
mupDefineStrFun2(muParserHandle_t a_hParser, const muChar_t *a_szName, muStrFun2_t a_pFun);
|
||||
API_EXPORT(void)
|
||||
mupDefineStrFun3(muParserHandle_t a_hParser, const muChar_t *a_szName, muStrFun3_t a_pFun);
|
||||
|
||||
API_EXPORT(void)
|
||||
mupDefineMultFun(muParserHandle_t a_hParser, const muChar_t *a_szName, muMultFun_t a_pFun,
|
||||
muBool_t a_bOptimize);
|
||||
|
||||
API_EXPORT(void)
|
||||
mupDefineOprt(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun2_t a_pFun,
|
||||
muInt_t a_nPrec, muInt_t a_nOprtAsct, muBool_t a_bOptimize);
|
||||
|
||||
API_EXPORT(void)
|
||||
mupDefineConst(muParserHandle_t a_hParser, const muChar_t *a_szName, muFloat_t a_fVal);
|
||||
|
||||
API_EXPORT(void)
|
||||
mupDefineStrConst(muParserHandle_t a_hParser, const muChar_t *a_szName, const muChar_t *a_sVal);
|
||||
|
||||
API_EXPORT(void)
|
||||
mupDefineVar(muParserHandle_t a_hParser, const muChar_t *a_szName, muFloat_t *a_fVar);
|
||||
|
||||
API_EXPORT(void)
|
||||
mupDefinePostfixOprt(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun1_t a_pOprt,
|
||||
muBool_t a_bOptimize);
|
||||
|
||||
API_EXPORT(void)
|
||||
mupDefineInfixOprt(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun1_t a_pOprt,
|
||||
muBool_t a_bOptimize);
|
||||
|
||||
// Define character sets for identifiers
|
||||
API_EXPORT(void) mupDefineNameChars(muParserHandle_t a_hParser, const muChar_t *a_szCharset);
|
||||
API_EXPORT(void) mupDefineOprtChars(muParserHandle_t a_hParser, const muChar_t *a_szCharset);
|
||||
API_EXPORT(void) mupDefineInfixOprtChars(muParserHandle_t a_hParser, const muChar_t *a_szCharset);
|
||||
|
||||
// Remove all / single variables
|
||||
API_EXPORT(void) mupRemoveVar(muParserHandle_t a_hParser, const muChar_t *a_szName);
|
||||
API_EXPORT(void) mupClearVar(muParserHandle_t a_hParser);
|
||||
API_EXPORT(void) mupClearConst(muParserHandle_t a_hParser);
|
||||
API_EXPORT(void) mupClearOprt(muParserHandle_t a_hParser);
|
||||
API_EXPORT(void) mupClearFun(muParserHandle_t a_hParser);
|
||||
|
||||
// Querying variables / expression variables / constants
|
||||
API_EXPORT(int) mupGetExprVarNum(muParserHandle_t a_hParser);
|
||||
API_EXPORT(void)
|
||||
mupGetExprVar(muParserHandle_t a_hParser, unsigned a_iVar, const muChar_t **a_pszName,
|
||||
muFloat_t **a_pVar);
|
||||
API_EXPORT(void) mupSetArgSep(muParserHandle_t a_hParser, const muChar_t cArgSep);
|
||||
API_EXPORT(void) mupSetDecSep(muParserHandle_t a_hParser, const muChar_t cArgSep);
|
||||
API_EXPORT(void) mupSetThousandsSep(muParserHandle_t a_hParser, const muChar_t cArgSep);
|
||||
API_EXPORT(void) mupResetLocale(muParserHandle_t a_hParser);
|
||||
|
||||
// Add value recognition callbacks
|
||||
API_EXPORT(void) mupAddValIdent(muParserHandle_t a_hParser, muIdentFun_t);
|
||||
|
||||
// Error handling
|
||||
API_EXPORT(muBool_t) mupError(muParserHandle_t a_hParser);
|
||||
API_EXPORT(void) mupErrorReset(muParserHandle_t a_hParser);
|
||||
API_EXPORT(void) mupSetErrorHandler(muParserHandle_t a_hParser, muErrorHandler_t a_pErrHandler);
|
||||
API_EXPORT(const muChar_t *) mupGetErrorMsg(muParserHandle_t a_hParser);
|
||||
API_EXPORT(muInt_t) mupGetErrorCode(muParserHandle_t a_hParser);
|
||||
API_EXPORT(muInt_t) mupGetErrorPos(muParserHandle_t a_hParser);
|
||||
API_EXPORT(const muChar_t *) mupGetErrorToken(muParserHandle_t a_hParser);
|
||||
// API_EXPORT(const muChar_t*) mupGetErrorExpr(muParserHandle_t a_hParser);
|
||||
|
||||
// This is used for .NET only. It creates a new variable allowing the dll to
|
||||
// manage the variable rather than the .NET garbage collector.
|
||||
API_EXPORT(muFloat_t *) mupCreateVar();
|
||||
API_EXPORT(void) mupReleaseVar(muFloat_t *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // include guard
|
|
@ -1,630 +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.
|
||||
*/
|
||||
#if defined(MUPARSER_DLL)
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "muParser.h"
|
||||
#include "muParserDLL.h"
|
||||
#include "muParserInt.h"
|
||||
|
||||
static void throwIfError(mu::OptionalError oerr) {
|
||||
if (oerr.has_error()) throw oerr.error();
|
||||
}
|
||||
|
||||
#define MU_TRY try {
|
||||
#define MU_CATCH \
|
||||
} \
|
||||
catch (muError_t & e) { \
|
||||
ParserTag* pTag = static_cast<ParserTag*>(a_hParser); \
|
||||
pTag->exc = e; \
|
||||
pTag->bError = true; \
|
||||
if (pTag->errHandler) (pTag->errHandler)(a_hParser); \
|
||||
} \
|
||||
catch (...) { \
|
||||
ParserTag* pTag = static_cast<ParserTag*>(a_hParser); \
|
||||
pTag->bError = true; \
|
||||
if (pTag->errHandler) (pTag->errHandler)(a_hParser); \
|
||||
}
|
||||
|
||||
/** \file
|
||||
\brief This file contains the implementation of the DLL interface of muparser.
|
||||
*/
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// private types
|
||||
typedef mu::ParserBase::exception_type muError_t;
|
||||
typedef mu::ParserBase muParser_t;
|
||||
|
||||
int g_nBulkSize;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
class ParserTag {
|
||||
public:
|
||||
ParserTag(int nType)
|
||||
: pParser((nType == muBASETYPE_FLOAT)
|
||||
? (mu::ParserBase*)new mu::Parser()
|
||||
: (nType == muBASETYPE_INT) ? (mu::ParserBase*)new mu::ParserInt() : NULL),
|
||||
exc(),
|
||||
errHandler(NULL),
|
||||
bError(false),
|
||||
m_nParserType(nType) {}
|
||||
|
||||
~ParserTag() { delete pParser; }
|
||||
|
||||
mu::ParserBase* pParser;
|
||||
mu::ParserBase::exception_type exc;
|
||||
muErrorHandler_t errHandler;
|
||||
bool bError;
|
||||
|
||||
private:
|
||||
ParserTag(const ParserTag& ref);
|
||||
ParserTag& operator=(const ParserTag& ref);
|
||||
|
||||
int m_nParserType;
|
||||
};
|
||||
|
||||
static muChar_t s_tmpOutBuf[2048];
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
// unexported functions
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
muParser_t* AsParser(muParserHandle_t a_hParser) {
|
||||
return static_cast<ParserTag*>(a_hParser)->pParser;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
ParserTag* AsParserTag(muParserHandle_t a_hParser) { return static_cast<ParserTag*>(a_hParser); }
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
#if defined(_WIN32)
|
||||
#define _CRT_SECURE_NO_DEPRECATE
|
||||
|
||||
BOOL APIENTRY DllMain(HANDLE /*hModule*/, DWORD ul_reason_for_call, LPVOID /*lpReserved*/) {
|
||||
switch (ul_reason_for_call) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
break;
|
||||
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
// exported functions
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
API_EXPORT(void)
|
||||
mupSetVarFactory(muParserHandle_t a_hParser, muFacFun_t a_pFactory, void* pUserData) {
|
||||
MU_TRY
|
||||
muParser_t* p(AsParser(a_hParser));
|
||||
p->SetVarFactory(a_pFactory, pUserData);
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
/** \brief Create a new Parser instance and return its handle.
|
||||
*/
|
||||
API_EXPORT(muParserHandle_t) mupCreate(int nBaseType) {
|
||||
switch (nBaseType) {
|
||||
case muBASETYPE_FLOAT:
|
||||
return (void*)(new ParserTag(muBASETYPE_FLOAT));
|
||||
case muBASETYPE_INT:
|
||||
return (void*)(new ParserTag(muBASETYPE_INT));
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
/** \brief Release the parser instance related with a parser handle.
|
||||
*/
|
||||
API_EXPORT(void) mupRelease(muParserHandle_t a_hParser) {
|
||||
MU_TRY
|
||||
ParserTag* p = static_cast<ParserTag*>(a_hParser);
|
||||
delete p;
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
API_EXPORT(const muChar_t*) mupGetVersion(muParserHandle_t a_hParser) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
|
||||
#ifndef _UNICODE
|
||||
sprintf(s_tmpOutBuf, "%s", p->GetVersion().c_str());
|
||||
#else
|
||||
wsprintf(s_tmpOutBuf, _T("%s"), p->GetVersion().c_str());
|
||||
#endif
|
||||
|
||||
return s_tmpOutBuf;
|
||||
MU_CATCH
|
||||
|
||||
return _T("");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
/** \brief Evaluate the expression.
|
||||
*/
|
||||
API_EXPORT(muFloat_t) mupEval(muParserHandle_t a_hParser) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
return *p->Eval();
|
||||
MU_CATCH
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
API_EXPORT(void) mupSetExpr(muParserHandle_t a_hParser, const muChar_t* a_szExpr) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
throwIfError(p->SetExpr(a_szExpr));
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
API_EXPORT(void) mupRemoveVar(muParserHandle_t a_hParser, const muChar_t* a_szName) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
p->RemoveVar(a_szName);
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
/** \brief Release all parser variables.
|
||||
\param a_hParser Handle to the parser instance.
|
||||
*/
|
||||
API_EXPORT(void) mupClearVar(muParserHandle_t a_hParser) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
p->ClearVar();
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
/** \brief Release all parser variables.
|
||||
\param a_hParser Handle to the parser instance.
|
||||
*/
|
||||
API_EXPORT(void) mupClearConst(muParserHandle_t a_hParser) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
p->ClearConst();
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
/** \brief Clear all user defined operators.
|
||||
\param a_hParser Handle to the parser instance.
|
||||
*/
|
||||
API_EXPORT(void) mupClearOprt(muParserHandle_t a_hParser) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
p->ClearOprt();
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
API_EXPORT(void) mupClearFun(muParserHandle_t a_hParser) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
p->ClearFun();
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
API_EXPORT(void)
|
||||
mupDefineFun0(muParserHandle_t a_hParser, const muChar_t* a_szName, muFun0_t a_pFun) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
p->DefineFun(a_szName, a_pFun);
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
API_EXPORT(void)
|
||||
mupDefineFun1(muParserHandle_t a_hParser, const muChar_t* a_szName, muFun1_t a_pFun) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
p->DefineFun(a_szName, a_pFun);
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
API_EXPORT(void)
|
||||
mupDefineFun2(muParserHandle_t a_hParser, const muChar_t* a_szName, muFun2_t a_pFun) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
p->DefineFun(a_szName, a_pFun);
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
API_EXPORT(void)
|
||||
mupDefineFun3(muParserHandle_t a_hParser, const muChar_t* a_szName, muFun3_t a_pFun) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
p->DefineFun(a_szName, a_pFun);
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
API_EXPORT(void)
|
||||
mupDefineFun4(muParserHandle_t a_hParser, const muChar_t* a_szName, muFun4_t a_pFun) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
p->DefineFun(a_szName, a_pFun);
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
API_EXPORT(void)
|
||||
mupDefineFun5(muParserHandle_t a_hParser, const muChar_t* a_szName, muFun5_t a_pFun) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
p->DefineFun(a_szName, a_pFun);
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
API_EXPORT(void)
|
||||
mupDefineFun6(muParserHandle_t a_hParser, const muChar_t* a_szName, muFun6_t a_pFun) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
p->DefineFun(a_szName, a_pFun);
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
API_EXPORT(void)
|
||||
mupDefineFun7(muParserHandle_t a_hParser, const muChar_t* a_szName, muFun7_t a_pFun) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
p->DefineFun(a_szName, a_pFun);
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
API_EXPORT(void)
|
||||
mupDefineFun8(muParserHandle_t a_hParser, const muChar_t* a_szName, muFun8_t a_pFun) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
p->DefineFun(a_szName, a_pFun);
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
API_EXPORT(void)
|
||||
mupDefineFun9(muParserHandle_t a_hParser, const muChar_t* a_szName, muFun9_t a_pFun) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
p->DefineFun(a_szName, a_pFun);
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
API_EXPORT(void)
|
||||
mupDefineFun10(muParserHandle_t a_hParser, const muChar_t* a_szName, muFun10_t a_pFun) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
p->DefineFun(a_szName, a_pFun);
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
API_EXPORT(void)
|
||||
mupDefineStrFun1(muParserHandle_t a_hParser, const muChar_t* a_szName, muStrFun1_t a_pFun) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
p->DefineFun(a_szName, a_pFun);
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
API_EXPORT(void)
|
||||
mupDefineStrFun2(muParserHandle_t a_hParser, const muChar_t* a_szName, muStrFun2_t a_pFun) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
p->DefineFun(a_szName, a_pFun);
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
API_EXPORT(void)
|
||||
mupDefineStrFun3(muParserHandle_t a_hParser, const muChar_t* a_szName, muStrFun3_t a_pFun) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
p->DefineFun(a_szName, a_pFun);
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
API_EXPORT(void)
|
||||
mupDefineMultFun(muParserHandle_t a_hParser, const muChar_t* a_szName, muMultFun_t a_pFun) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
p->DefineFun(a_szName, a_pFun);
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
API_EXPORT(void)
|
||||
mupDefineOprt(muParserHandle_t a_hParser, const muChar_t* a_szName, muFun2_t a_pFun,
|
||||
muInt_t a_nPrec, muInt_t a_nOprtAsct) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
throwIfError(p->DefineOprt(a_szName, a_pFun, a_nPrec, (mu::EOprtAssociativity)a_nOprtAsct));
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
API_EXPORT(void)
|
||||
mupDefineVar(muParserHandle_t a_hParser, const muChar_t* a_szName, muFloat_t* a_pVar) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
throwIfError(p->DefineVar(a_szName, a_pVar));
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
API_EXPORT(void)
|
||||
mupDefineBulkVar(muParserHandle_t a_hParser, const muChar_t* a_szName, muFloat_t* a_pVar) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
throwIfError(p->DefineVar(a_szName, a_pVar));
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
API_EXPORT(void)
|
||||
mupDefineConst(muParserHandle_t a_hParser, const muChar_t* a_szName, muFloat_t a_fVal) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
throwIfError(p->DefineConst(a_szName, a_fVal));
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
API_EXPORT(void)
|
||||
mupDefineStrConst(muParserHandle_t a_hParser, const muChar_t* a_szName, const muChar_t* a_szVal) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
throwIfError(p->DefineStrConst(a_szName, a_szVal));
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
API_EXPORT(const muChar_t*) mupGetExpr(muParserHandle_t a_hParser) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
|
||||
// C# explodes when pMsg is returned directly. For some reason it can't access
|
||||
// the memory where the message lies directly.
|
||||
#ifndef _UNICODE
|
||||
sprintf(s_tmpOutBuf, "%s", p->GetExpr().c_str());
|
||||
#else
|
||||
wsprintf(s_tmpOutBuf, _T("%s"), p->GetExpr().c_str());
|
||||
#endif
|
||||
|
||||
return s_tmpOutBuf;
|
||||
|
||||
MU_CATCH
|
||||
|
||||
return _T("");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
API_EXPORT(void)
|
||||
mupDefinePostfixOprt(muParserHandle_t a_hParser, const muChar_t* a_szName, muFun1_t a_pOprt) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
p->DefinePostfixOprt(a_szName, a_pOprt);
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
API_EXPORT(void)
|
||||
mupDefineInfixOprt(muParserHandle_t a_hParser, const muChar_t* a_szName, muFun1_t a_pOprt) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
p->DefineInfixOprt(a_szName, a_pOprt);
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
// Define character sets for identifiers
|
||||
//---------------------------------------------------------------------------
|
||||
API_EXPORT(void) mupDefineNameChars(muParserHandle_t a_hParser, const muChar_t* a_szCharset) {
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
p->DefineNameChars(a_szCharset);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
API_EXPORT(void) mupDefineOprtChars(muParserHandle_t a_hParser, const muChar_t* a_szCharset) {
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
p->DefineOprtChars(a_szCharset);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
API_EXPORT(void) mupDefineInfixOprtChars(muParserHandle_t a_hParser, const muChar_t* a_szCharset) {
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
p->DefineInfixOprtChars(a_szCharset);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
API_EXPORT(void) mupSetArgSep(muParserHandle_t a_hParser, const muChar_t cArgSep) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
p->SetArgSep(cArgSep);
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
API_EXPORT(void) mupResetLocale(muParserHandle_t a_hParser) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
p->ResetLocale();
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
API_EXPORT(void) mupSetDecSep(muParserHandle_t a_hParser, const muChar_t cDecSep) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
p->SetDecSep(cDecSep);
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
API_EXPORT(void) mupSetThousandsSep(muParserHandle_t a_hParser, const muChar_t cThousandsSep) {
|
||||
MU_TRY
|
||||
muParser_t* const p(AsParser(a_hParser));
|
||||
p->SetThousandsSep(cThousandsSep);
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
/** \brief Add a custom value recognition function.
|
||||
*/
|
||||
API_EXPORT(void) mupAddValIdent(muParserHandle_t a_hParser, muIdentFun_t a_pFun) {
|
||||
MU_TRY
|
||||
muParser_t* p(AsParser(a_hParser));
|
||||
p->AddValIdent(a_pFun);
|
||||
MU_CATCH
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
/** \brief Query if an error occurred.
|
||||
|
||||
After querying the internal error bit will be reset. So a consecutive call
|
||||
will return false.
|
||||
*/
|
||||
API_EXPORT(muBool_t) mupError(muParserHandle_t a_hParser) {
|
||||
bool bError(AsParserTag(a_hParser)->bError);
|
||||
AsParserTag(a_hParser)->bError = false;
|
||||
return bError;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
/** \brief Reset the internal error flag.
|
||||
*/
|
||||
API_EXPORT(void) mupErrorReset(muParserHandle_t a_hParser) {
|
||||
AsParserTag(a_hParser)->bError = false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
API_EXPORT(void) mupSetErrorHandler(muParserHandle_t a_hParser, muErrorHandler_t a_pHandler) {
|
||||
AsParserTag(a_hParser)->errHandler = a_pHandler;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
/** \brief Return the message associated with the last error.
|
||||
*/
|
||||
API_EXPORT(const muChar_t*) mupGetErrorMsg(muParserHandle_t a_hParser) {
|
||||
ParserTag* const p(AsParserTag(a_hParser));
|
||||
const muChar_t* pMsg = p->exc.GetMsg().c_str();
|
||||
|
||||
// C# explodes when pMsg is returned directly. For some reason it can't access
|
||||
// the memory where the message lies directly.
|
||||
#ifndef _UNICODE
|
||||
sprintf(s_tmpOutBuf, "%s", pMsg);
|
||||
#else
|
||||
wsprintf(s_tmpOutBuf, _T("%s"), pMsg);
|
||||
#endif
|
||||
|
||||
return s_tmpOutBuf;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
/** \brief Return the message associated with the last error.
|
||||
*/
|
||||
API_EXPORT(const muChar_t*) mupGetErrorToken(muParserHandle_t a_hParser) {
|
||||
ParserTag* const p(AsParserTag(a_hParser));
|
||||
const muChar_t* pToken = p->exc.GetToken().c_str();
|
||||
|
||||
// C# explodes when pMsg is returned directly. For some reason it can't access
|
||||
// the memory where the message lies directly.
|
||||
#ifndef _UNICODE
|
||||
sprintf(s_tmpOutBuf, "%s", pToken);
|
||||
#else
|
||||
wsprintf(s_tmpOutBuf, _T("%s"), pToken);
|
||||
#endif
|
||||
|
||||
return s_tmpOutBuf;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
/** \brief Return the code associated with the last error.
|
||||
*/
|
||||
API_EXPORT(int) mupGetErrorCode(muParserHandle_t a_hParser) {
|
||||
return AsParserTag(a_hParser)->exc.GetCode();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
/** \brief Return the position associated with the last error. */
|
||||
API_EXPORT(int) mupGetErrorPos(muParserHandle_t a_hParser) {
|
||||
return (int)AsParserTag(a_hParser)->exc.GetPos();
|
||||
}
|
||||
|
||||
////-----------------------------------------------------------------------------------------------------
|
||||
// API_EXPORT(const muChar_t*) mupGetErrorExpr(muParserHandle_t a_hParser)
|
||||
//{
|
||||
// return AsParserTag(a_hParser)->exc.GetExpr().c_str();
|
||||
//}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
API_EXPORT(muFloat_t*) mupCreateVar() { return new muFloat_t(0); }
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
API_EXPORT(void) mupReleaseVar(muFloat_t* ptr) { delete ptr; }
|
||||
|
||||
#endif // MUPARSER_DLL
|
Loading…
Reference in a new issue