mirror of https://git.wownero.com/dsc/mxe.git
add package muparserx
This commit is contained in:
parent
3465e4db8a
commit
f939f4a9b7
|
@ -1920,7 +1920,11 @@ local-pkg-list: $(LOCAL_PKG_LIST)</pre>
|
|||
</tr>
|
||||
<tr>
|
||||
<td class="package">muparser</td>
|
||||
<td class="website"><a href="http://muparser.sourceforge.net/">muParser</a></td>
|
||||
<td class="website"><a href="http://muparser.beltoforion.de/">muParser</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="package">muparserx</td>
|
||||
<td class="website"><a href="http://muparserx.beltoforion.de/">muParserX</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="package">mxml</td>
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* This file is part of MXE.
|
||||
* See index.html for further information.
|
||||
*
|
||||
* based on:
|
||||
* http://articles.beltoforion.de/article.php?a=muparserx&hl=en&p=using&s=idInclude#idEval
|
||||
*/
|
||||
|
||||
#include "mpParser.h"
|
||||
|
||||
using namespace mup;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
// Create the parser instance
|
||||
ParserX p;
|
||||
|
||||
// Create an array of mixed type
|
||||
Value arr(3, 0);
|
||||
arr.At(0) = 2.0;
|
||||
arr.At(1) = "this is a string";
|
||||
|
||||
// Create some basic values
|
||||
Value cVal(cmplx_type(1, 1));
|
||||
Value sVal("Hello World");
|
||||
Value fVal(1.1);
|
||||
|
||||
// Now add the variable to muParser
|
||||
p.DefineVar("va", Variable(&arr));
|
||||
p.DefineVar("a", Variable(&cVal));
|
||||
p.DefineVar("b", Variable(&sVal));
|
||||
p.DefineVar("c", Variable(&fVal));
|
||||
|
||||
p.SetExpr("va[0]+a*strlen(b)-c");
|
||||
for (int i=0; i<<10; ++i)
|
||||
{
|
||||
// evaluate the expression and change the value of
|
||||
// the variable c in each turn
|
||||
cVal = 1.1 * i;
|
||||
Value result = p.Eval();
|
||||
|
||||
// print the result
|
||||
console() << result << "\n";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
# This file is part of MXE.
|
||||
# See index.html for further information.
|
||||
|
||||
PKG := muparserx
|
||||
$(PKG)_IGNORE :=
|
||||
$(PKG)_VERSION := 4.0.4
|
||||
$(PKG)_CHECKSUM := d7ebcab8cb1de88e6dcba21651db8f6055b3e904c45afc387b06b5f4218dda40
|
||||
$(PKG)_SUBDIR := $(PKG)-$($(PKG)_VERSION)
|
||||
$(PKG)_FILE := $($(PKG)_SUBDIR).tar.gz
|
||||
$(PKG)_URL := https://github.com/beltoforion/$(PKG)/archive/v$($(PKG)_VERSION).tar.gz
|
||||
$(PKG)_DEPS := gcc
|
||||
|
||||
define $(PKG)_UPDATE
|
||||
$(call MXE_GET_GITHUB_TAGS, beltoforion/muparserx, v)
|
||||
endef
|
||||
|
||||
define $(PKG)_BUILD
|
||||
cd '$(1)' && '$(TARGET)-cmake' \
|
||||
-DBUILD_EXAMPLES=OFF
|
||||
$(MAKE) -C '$(1)' -j '$(JOBS)' install
|
||||
|
||||
'$(TARGET)-g++' \
|
||||
-W -Wall -Werror -ansi -pedantic \
|
||||
'$(2).cpp' -o '$(PREFIX)/$(TARGET)/bin/test-$(PKG).exe' \
|
||||
`'$(TARGET)-pkg-config' $(PKG) --cflags --libs`
|
||||
endef
|
Loading…
Reference in New Issue