| 1 | /* |
| 2 | __________ |
| 3 | _____ __ __\______ \_____ _______ ______ ____ _______ |
| 4 | / \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \ |
| 5 | | Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/ |
| 6 | |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| |
| 7 | \/ \/ \/ \/ |
| 8 | Copyright (C) 2004-2011 Ingo Berg |
| 9 | |
| 10 | Permission is hereby granted, free of charge, to any person obtaining a copy of this |
| 11 | software and associated documentation files (the "Software"), to deal in the Software |
| 12 | without restriction, including without limitation the rights to use, copy, modify, |
| 13 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to |
| 14 | permit persons to whom the Software is furnished to do so, subject to the following conditions: |
| 15 | |
| 16 | The above copyright notice and this permission notice shall be included in all copies or |
| 17 | substantial portions of the Software. |
| 18 | |
| 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT |
| 20 | NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 21 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
| 22 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 24 | */ |
| 25 | #if defined(MUPARSER_DLL) |
| 26 | |
| 27 | #if defined(_WIN32) |
| 28 | #define WIN32_LEAN_AND_MEAN |
| 29 | #include <windows.h> |
| 30 | #endif |
| 31 | |
| 32 | #include "muParserDLL.h" |
| 33 | #include "muParser.h" |
| 34 | #include "muParserInt.h" |
| 35 | #include "muParserError.h" |
| 36 | |
| 37 | |
| 38 | #define MU_TRY \ |
| 39 | try \ |
| 40 | { |
| 41 | |
| 42 | #define MU_CATCH \ |
| 43 | } \ |
| 44 | catch (muError_t &e) \ |
| 45 | { \ |
| 46 | ParserTag *pTag = static_cast<ParserTag*>(a_hParser); \ |
| 47 | pTag->exc = e; \ |
| 48 | pTag->bError = true; \ |
| 49 | if (pTag->errHandler) \ |
| 50 | (pTag->errHandler)(a_hParser); \ |
| 51 | } \ |
| 52 | catch (...) \ |
| 53 | { \ |
| 54 | ParserTag *pTag = static_cast<ParserTag*>(a_hParser); \ |
| 55 | pTag->exc = muError_t(mu::ecINTERNAL_ERROR); \ |
| 56 | pTag->bError = true; \ |
| 57 | if (pTag->errHandler) \ |
| 58 | (pTag->errHandler)(a_hParser); \ |
| 59 | } |
| 60 | |
| 61 | /** \file |
| 62 | \brief This file contains the implementation of the DLL interface of muparser. |
| 63 | */ |
| 64 | |
| 65 | //--------------------------------------------------------------------------- |
| 66 | // private types |
| 67 | typedef mu::ParserBase::exception_type muError_t; |
| 68 | typedef mu::ParserBase muParser_t; |
| 69 | |
| 70 | int g_nBulkSize; |
| 71 | |
| 72 | //--------------------------------------------------------------------------- |
| 73 | class ParserTag |
| 74 | { |
| 75 | public: |
| 76 | ParserTag(int nType) |
| 77 | :pParser((nType == muBASETYPE_FLOAT) ? (mu::ParserBase*)new mu::Parser() : |
| 78 | (nType == muBASETYPE_INT) ? (mu::ParserBase*)new mu::ParserInt() : NULL) |
| 79 | , exc() |
| 80 | , errHandler(NULL) |
| 81 | , bError(false) |
| 82 | , m_nParserType(nType) |
| 83 | {} |
| 84 | |
| 85 | ~ParserTag() |
| 86 | { |
| 87 | delete pParser; |
| 88 | } |
| 89 | |
| 90 | mu::ParserBase *pParser; |
| 91 | mu::ParserBase::exception_type exc; |
| 92 | muErrorHandler_t errHandler; |
| 93 | bool bError; |
| 94 | |
| 95 | private: |
| 96 | ParserTag(const ParserTag &ref); |
| 97 | ParserTag& operator=(const ParserTag &ref); |
| 98 | |
| 99 | int m_nParserType; |
| 100 | }; |
| 101 | |
| 102 | static muChar_t s_tmpOutBuf[2048]; |
| 103 | |
| 104 | //--------------------------------------------------------------------------- |
| 105 | // |
| 106 | // |
| 107 | // unexported functions |
| 108 | // |
| 109 | // |
| 110 | //--------------------------------------------------------------------------- |
| 111 | |
| 112 | //--------------------------------------------------------------------------- |
| 113 | muParser_t* AsParser(muParserHandle_t a_hParser) |
| 114 | { |
| 115 | return static_cast<ParserTag*>(a_hParser)->pParser; |
| 116 | } |
| 117 | |
| 118 | //--------------------------------------------------------------------------- |
| 119 | ParserTag* AsParserTag(muParserHandle_t a_hParser) |
| 120 | { |
| 121 | return static_cast<ParserTag*>(a_hParser); |
| 122 | } |
| 123 | |
| 124 | //--------------------------------------------------------------------------- |
| 125 | #if defined(_WIN32) |
| 126 | #define _CRT_SECURE_NO_DEPRECATE |
| 127 | |
| 128 | BOOL APIENTRY DllMain(HANDLE /*hModule*/, |
| 129 | DWORD ul_reason_for_call, |
| 130 | LPVOID /*lpReserved*/) |
| 131 | { |
| 132 | switch (ul_reason_for_call) |
| 133 | { |
| 134 | case DLL_PROCESS_ATTACH: |
| 135 | break; |
| 136 | |
| 137 | case DLL_THREAD_ATTACH: |
| 138 | case DLL_THREAD_DETACH: |
| 139 | case DLL_PROCESS_DETACH: |
| 140 | break; |
| 141 | } |
| 142 | |
| 143 | return TRUE; |
| 144 | } |
| 145 | |
| 146 | #endif |
| 147 | |
| 148 | //--------------------------------------------------------------------------- |
| 149 | // |
| 150 | // |
| 151 | // exported functions |
| 152 | // |
| 153 | // |
| 154 | //--------------------------------------------------------------------------- |
| 155 | |
| 156 | API_EXPORT(void) mupSetVarFactory(muParserHandle_t a_hParser, muFacFun_t a_pFactory, void *pUserData) |
| 157 | { |
| 158 | MU_TRY |
| 159 | muParser_t* p(AsParser(a_hParser)); |
| 160 | p->SetVarFactory(a_pFactory, pUserData); |
| 161 | MU_CATCH |
| 162 | } |
| 163 | |
| 164 | //--------------------------------------------------------------------------- |
| 165 | /** \brief Create a new Parser instance and return its handle. |
| 166 | */ |
| 167 | API_EXPORT(muParserHandle_t) mupCreate(int nBaseType) |
| 168 | { |
| 169 | switch (nBaseType) |
| 170 | { |
| 171 | case muBASETYPE_FLOAT: return (void*)(new ParserTag(muBASETYPE_FLOAT)); |
| 172 | case muBASETYPE_INT: return (void*)(new ParserTag(muBASETYPE_INT)); |
| 173 | default: return NULL; |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | //--------------------------------------------------------------------------- |
| 178 | /** \brief Release the parser instance related with a parser handle. |
| 179 | */ |
| 180 | API_EXPORT(void) mupRelease(muParserHandle_t a_hParser) |
| 181 | { |
| 182 | MU_TRY |
| 183 | ParserTag* p = static_cast<ParserTag*>(a_hParser); |
| 184 | delete p; |
| 185 | MU_CATCH |
| 186 | } |
| 187 | |
| 188 | //--------------------------------------------------------------------------- |
| 189 | API_EXPORT(const muChar_t*) mupGetVersion(muParserHandle_t a_hParser) |
| 190 | { |
| 191 | MU_TRY |
| 192 | muParser_t* const p(AsParser(a_hParser)); |
| 193 | |
| 194 | #ifndef _UNICODE |
| 195 | sprintf(s_tmpOutBuf, "%s", p->GetVersion().c_str()); |
| 196 | #else |
| 197 | wsprintf(s_tmpOutBuf, _T("%s"), p->GetVersion().c_str()); |
| 198 | #endif |
| 199 | |
| 200 | return s_tmpOutBuf; |
| 201 | MU_CATCH |
| 202 | |
| 203 | return _T(""); |
| 204 | } |
| 205 | |
| 206 | //--------------------------------------------------------------------------- |
| 207 | /** \brief Evaluate the expression. |
| 208 | */ |
| 209 | API_EXPORT(muFloat_t) mupEval(muParserHandle_t a_hParser) |
| 210 | { |
| 211 | MU_TRY |
| 212 | muParser_t* const p(AsParser(a_hParser)); |
| 213 | return p->Eval(); |
| 214 | MU_CATCH |
| 215 | |
| 216 | return 0; |
| 217 | } |
| 218 | |
| 219 | //--------------------------------------------------------------------------- |
| 220 | API_EXPORT(muFloat_t*) mupEvalMulti(muParserHandle_t a_hParser, int *nNum) |
| 221 | { |
| 222 | MU_TRY |
| 223 | assert(nNum != NULL); |
| 224 | |
| 225 | muParser_t* const p(AsParser(a_hParser)); |
| 226 | return p->Eval(*nNum); |
| 227 | MU_CATCH |
| 228 | |
| 229 | return 0; |
| 230 | } |
| 231 | |
| 232 | //--------------------------------------------------------------------------- |
| 233 | API_EXPORT(void) mupEvalBulk(muParserHandle_t a_hParser, muFloat_t *a_res, int nSize) |
| 234 | { |
| 235 | MU_TRY |
| 236 | muParser_t* p(AsParser(a_hParser)); |
| 237 | p->Eval(a_res, nSize); |
| 238 | MU_CATCH |
| 239 | } |
| 240 | |
| 241 | //--------------------------------------------------------------------------- |
| 242 | API_EXPORT(void) mupSetExpr(muParserHandle_t a_hParser, const muChar_t* a_szExpr) |
| 243 | { |
| 244 | MU_TRY |
| 245 | muParser_t* const p(AsParser(a_hParser)); |
| 246 | p->SetExpr(a_szExpr); |
| 247 | MU_CATCH |
| 248 | } |
| 249 | |
| 250 | //--------------------------------------------------------------------------- |
| 251 | API_EXPORT(void) mupRemoveVar(muParserHandle_t a_hParser, const muChar_t* a_szName) |
| 252 | { |
| 253 | MU_TRY |
| 254 | muParser_t* const p(AsParser(a_hParser)); |
| 255 | p->RemoveVar(a_szName); |
| 256 | MU_CATCH |
| 257 | } |
| 258 | |
| 259 | //--------------------------------------------------------------------------- |
| 260 | /** \brief Release all parser variables. |
| 261 | \param a_hParser Handle to the parser instance. |
| 262 | */ |
| 263 | API_EXPORT(void) mupClearVar(muParserHandle_t a_hParser) |
| 264 | { |
| 265 | MU_TRY |
| 266 | muParser_t* const p(AsParser(a_hParser)); |
| 267 | p->ClearVar(); |
| 268 | MU_CATCH |
| 269 | } |
| 270 | |
| 271 | //--------------------------------------------------------------------------- |
| 272 | /** \brief Release all parser variables. |
| 273 | \param a_hParser Handle to the parser instance. |
| 274 | */ |
| 275 | API_EXPORT(void) mupClearConst(muParserHandle_t a_hParser) |
| 276 | { |
| 277 | MU_TRY |
| 278 | muParser_t* const p(AsParser(a_hParser)); |
| 279 | p->ClearConst(); |
| 280 | MU_CATCH |
| 281 | } |
| 282 | |
| 283 | //--------------------------------------------------------------------------- |
| 284 | /** \brief Clear all user defined operators. |
| 285 | \param a_hParser Handle to the parser instance. |
| 286 | */ |
| 287 | API_EXPORT(void) mupClearOprt(muParserHandle_t a_hParser) |
| 288 | { |
| 289 | MU_TRY |
| 290 | muParser_t* const p(AsParser(a_hParser)); |
| 291 | p->ClearOprt(); |
| 292 | MU_CATCH |
| 293 | } |
| 294 | |
| 295 | //--------------------------------------------------------------------------- |
| 296 | API_EXPORT(void) mupClearFun(muParserHandle_t a_hParser) |
| 297 | { |
| 298 | MU_TRY |
| 299 | muParser_t* const p(AsParser(a_hParser)); |
| 300 | p->ClearFun(); |
| 301 | MU_CATCH |
| 302 | } |
| 303 | |
| 304 | //--------------------------------------------------------------------------- |
| 305 | API_EXPORT(void) mupDefineFun0(muParserHandle_t a_hParser, |
| 306 | const muChar_t* a_szName, |
| 307 | muFun0_t a_pFun, |
| 308 | muBool_t a_bAllowOpt) |
| 309 | { |
| 310 | MU_TRY |
| 311 | muParser_t* const p(AsParser(a_hParser)); |
| 312 | p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0); |
| 313 | MU_CATCH |
| 314 | } |
| 315 | |
| 316 | //--------------------------------------------------------------------------- |
| 317 | API_EXPORT(void) mupDefineFun1(muParserHandle_t a_hParser, |
| 318 | const muChar_t* a_szName, |
| 319 | muFun1_t a_pFun, |
| 320 | muBool_t a_bAllowOpt) |
| 321 | { |
| 322 | MU_TRY |
| 323 | muParser_t* const p(AsParser(a_hParser)); |
| 324 | p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0); |
| 325 | MU_CATCH |
| 326 | } |
| 327 | |
| 328 | //--------------------------------------------------------------------------- |
| 329 | API_EXPORT(void) mupDefineFun2(muParserHandle_t a_hParser, |
| 330 | const muChar_t* a_szName, |
| 331 | muFun2_t a_pFun, |
| 332 | muBool_t a_bAllowOpt) |
| 333 | { |
| 334 | MU_TRY |
| 335 | muParser_t* const p(AsParser(a_hParser)); |
| 336 | p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0); |
| 337 | MU_CATCH |
| 338 | } |
| 339 | |
| 340 | //--------------------------------------------------------------------------- |
| 341 | API_EXPORT(void) mupDefineFun3(muParserHandle_t a_hParser, |
| 342 | const muChar_t *a_szName, |
| 343 | muFun3_t a_pFun, |
| 344 | muBool_t a_bAllowOpt) |
| 345 | { |
| 346 | MU_TRY |
| 347 | muParser_t* const p(AsParser(a_hParser)); |
| 348 | p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0); |
| 349 | MU_CATCH |
| 350 | } |
| 351 | |
| 352 | //--------------------------------------------------------------------------- |
| 353 | API_EXPORT(void) mupDefineFun4(muParserHandle_t a_hParser, |
| 354 | const muChar_t *a_szName, |
| 355 | muFun4_t a_pFun, |
| 356 | muBool_t a_bAllowOpt) |
| 357 | { |
| 358 | MU_TRY |
| 359 | muParser_t* const p(AsParser(a_hParser)); |
| 360 | p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0); |
| 361 | MU_CATCH |
| 362 | } |
| 363 | |
| 364 | //--------------------------------------------------------------------------- |
| 365 | API_EXPORT(void) mupDefineFun5(muParserHandle_t a_hParser, |
| 366 | const muChar_t *a_szName, |
| 367 | muFun5_t a_pFun, |
| 368 | muBool_t a_bAllowOpt) |
| 369 | { |
| 370 | MU_TRY |
| 371 | muParser_t* const p(AsParser(a_hParser)); |
| 372 | p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0); |
| 373 | MU_CATCH |
| 374 | } |
| 375 | |
| 376 | //--------------------------------------------------------------------------- |
| 377 | API_EXPORT(void) mupDefineFun6(muParserHandle_t a_hParser, |
| 378 | const muChar_t *a_szName, |
| 379 | muFun6_t a_pFun, |
| 380 | muBool_t a_bAllowOpt) |
| 381 | { |
| 382 | MU_TRY |
| 383 | muParser_t* const p(AsParser(a_hParser)); |
| 384 | p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0); |
| 385 | MU_CATCH |
| 386 | } |
| 387 | |
| 388 | //--------------------------------------------------------------------------- |
| 389 | API_EXPORT(void) mupDefineFun7(muParserHandle_t a_hParser, |
| 390 | const muChar_t *a_szName, |
| 391 | muFun7_t a_pFun, |
| 392 | muBool_t a_bAllowOpt) |
| 393 | { |
| 394 | MU_TRY |
| 395 | muParser_t* const p(AsParser(a_hParser)); |
| 396 | p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0); |
| 397 | MU_CATCH |
| 398 | } |
| 399 | |
| 400 | //--------------------------------------------------------------------------- |
| 401 | API_EXPORT(void) mupDefineFun8(muParserHandle_t a_hParser, |
| 402 | const muChar_t *a_szName, |
| 403 | muFun8_t a_pFun, |
| 404 | muBool_t a_bAllowOpt) |
| 405 | { |
| 406 | MU_TRY |
| 407 | muParser_t* const p(AsParser(a_hParser)); |
| 408 | p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0); |
| 409 | MU_CATCH |
| 410 | } |
| 411 | |
| 412 | //--------------------------------------------------------------------------- |
| 413 | API_EXPORT(void) mupDefineFun9(muParserHandle_t a_hParser, |
| 414 | const muChar_t *a_szName, |
| 415 | muFun9_t a_pFun, |
| 416 | muBool_t a_bAllowOpt) |
| 417 | { |
| 418 | MU_TRY |
| 419 | muParser_t* const p(AsParser(a_hParser)); |
| 420 | p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0); |
| 421 | MU_CATCH |
| 422 | } |
| 423 | |
| 424 | //--------------------------------------------------------------------------- |
| 425 | API_EXPORT(void) mupDefineFun10(muParserHandle_t a_hParser, |
| 426 | const muChar_t *a_szName, |
| 427 | muFun10_t a_pFun, |
| 428 | muBool_t a_bAllowOpt) |
| 429 | { |
| 430 | MU_TRY |
| 431 | muParser_t* const p(AsParser(a_hParser)); |
| 432 | p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0); |
| 433 | MU_CATCH |
| 434 | } |
| 435 | |
| 436 | //--------------------------------------------------------------------------- |
| 437 | API_EXPORT(void) mupDefineBulkFun0(muParserHandle_t a_hParser, |
| 438 | const muChar_t* a_szName, |
| 439 | muBulkFun0_t a_pFun) |
| 440 | { |
| 441 | MU_TRY |
| 442 | muParser_t* const p(AsParser(a_hParser)); |
| 443 | p->DefineFun(a_szName, a_pFun, false); |
| 444 | MU_CATCH |
| 445 | } |
| 446 | |
| 447 | //--------------------------------------------------------------------------- |
| 448 | API_EXPORT(void) mupDefineBulkFun1(muParserHandle_t a_hParser, |
| 449 | const muChar_t* a_szName, |
| 450 | muBulkFun1_t a_pFun) |
| 451 | { |
| 452 | MU_TRY |
| 453 | muParser_t* const p(AsParser(a_hParser)); |
| 454 | p->DefineFun(a_szName, a_pFun, false); |
| 455 | MU_CATCH |
| 456 | } |
| 457 | |
| 458 | //--------------------------------------------------------------------------- |
| 459 | API_EXPORT(void) mupDefineBulkFun2(muParserHandle_t a_hParser, |
| 460 | const muChar_t* a_szName, |
| 461 | muBulkFun2_t a_pFun) |
| 462 | { |
| 463 | MU_TRY |
| 464 | muParser_t* const p(AsParser(a_hParser)); |
| 465 | p->DefineFun(a_szName, a_pFun, false); |
| 466 | MU_CATCH |
| 467 | } |
| 468 | |
| 469 | //--------------------------------------------------------------------------- |
| 470 | API_EXPORT(void) mupDefineBulkFun3(muParserHandle_t a_hParser, |
| 471 | const muChar_t *a_szName, |
| 472 | muBulkFun3_t a_pFun) |
| 473 | { |
| 474 | MU_TRY |
| 475 | muParser_t* const p(AsParser(a_hParser)); |
| 476 | p->DefineFun(a_szName, a_pFun, false); |
| 477 | MU_CATCH |
| 478 | } |
| 479 | |
| 480 | //--------------------------------------------------------------------------- |
| 481 | API_EXPORT(void) mupDefineBulkFun4(muParserHandle_t a_hParser, |
| 482 | const muChar_t *a_szName, |
| 483 | muBulkFun4_t a_pFun) |
| 484 | { |
| 485 | MU_TRY |
| 486 | muParser_t* const p(AsParser(a_hParser)); |
| 487 | p->DefineFun(a_szName, a_pFun, false); |
| 488 | MU_CATCH |
| 489 | } |
| 490 | |
| 491 | //--------------------------------------------------------------------------- |
| 492 | API_EXPORT(void) mupDefineBulkFun5(muParserHandle_t a_hParser, |
| 493 | const muChar_t *a_szName, |
| 494 | muBulkFun5_t a_pFun) |
| 495 | { |
| 496 | MU_TRY |
| 497 | muParser_t* const p(AsParser(a_hParser)); |
| 498 | p->DefineFun(a_szName, a_pFun, false); |
| 499 | MU_CATCH |
| 500 | } |
| 501 | |
| 502 | //--------------------------------------------------------------------------- |
| 503 | API_EXPORT(void) mupDefineBulkFun6(muParserHandle_t a_hParser, |
| 504 | const muChar_t *a_szName, |
| 505 | muBulkFun6_t a_pFun) |
| 506 | { |
| 507 | MU_TRY |
| 508 | muParser_t* const p(AsParser(a_hParser)); |
| 509 | p->DefineFun(a_szName, a_pFun, false); |
| 510 | MU_CATCH |
| 511 | } |
| 512 | |
| 513 | //--------------------------------------------------------------------------- |
| 514 | API_EXPORT(void) mupDefineBulkFun7(muParserHandle_t a_hParser, |
| 515 | const muChar_t *a_szName, |
| 516 | muBulkFun7_t a_pFun) |
| 517 | { |
| 518 | MU_TRY |
| 519 | muParser_t* const p(AsParser(a_hParser)); |
| 520 | p->DefineFun(a_szName, a_pFun, false); |
| 521 | MU_CATCH |
| 522 | } |
| 523 | |
| 524 | //--------------------------------------------------------------------------- |
| 525 | API_EXPORT(void) mupDefineBulkFun8(muParserHandle_t a_hParser, |
| 526 | const muChar_t *a_szName, |
| 527 | muBulkFun8_t a_pFun) |
| 528 | { |
| 529 | MU_TRY |
| 530 | muParser_t* const p(AsParser(a_hParser)); |
| 531 | p->DefineFun(a_szName, a_pFun, false); |
| 532 | MU_CATCH |
| 533 | } |
| 534 | |
| 535 | //--------------------------------------------------------------------------- |
| 536 | API_EXPORT(void) mupDefineBulkFun9(muParserHandle_t a_hParser, |
| 537 | const muChar_t *a_szName, |
| 538 | muBulkFun9_t a_pFun) |
| 539 | { |
| 540 | MU_TRY |
| 541 | muParser_t* const p(AsParser(a_hParser)); |
| 542 | p->DefineFun(a_szName, a_pFun, false); |
| 543 | MU_CATCH |
| 544 | } |
| 545 | |
| 546 | //--------------------------------------------------------------------------- |
| 547 | API_EXPORT(void) mupDefineBulkFun10(muParserHandle_t a_hParser, |
| 548 | const muChar_t *a_szName, |
| 549 | muBulkFun10_t a_pFun) |
| 550 | { |
| 551 | MU_TRY |
| 552 | muParser_t* const p(AsParser(a_hParser)); |
| 553 | p->DefineFun(a_szName, a_pFun, false); |
| 554 | MU_CATCH |
| 555 | } |
| 556 | |
| 557 | //--------------------------------------------------------------------------- |
| 558 | API_EXPORT(void) mupDefineStrFun1(muParserHandle_t a_hParser, |
| 559 | const muChar_t *a_szName, |
| 560 | muStrFun1_t a_pFun) |
| 561 | { |
| 562 | MU_TRY |
| 563 | muParser_t* const p(AsParser(a_hParser)); |
| 564 | p->DefineFun(a_szName, a_pFun, false); |
| 565 | MU_CATCH |
| 566 | } |
| 567 | |
| 568 | //--------------------------------------------------------------------------- |
| 569 | API_EXPORT(void) mupDefineStrFun2(muParserHandle_t a_hParser, |
| 570 | const muChar_t* a_szName, |
| 571 | muStrFun2_t a_pFun) |
| 572 | { |
| 573 | MU_TRY |
| 574 | muParser_t* const p(AsParser(a_hParser)); |
| 575 | p->DefineFun(a_szName, a_pFun, false); |
| 576 | MU_CATCH |
| 577 | } |
| 578 | |
| 579 | //--------------------------------------------------------------------------- |
| 580 | API_EXPORT(void) mupDefineStrFun3(muParserHandle_t a_hParser, |
| 581 | const muChar_t* a_szName, |
| 582 | muStrFun3_t a_pFun) |
| 583 | { |
| 584 | MU_TRY |
| 585 | muParser_t* const p(AsParser(a_hParser)); |
| 586 | p->DefineFun(a_szName, a_pFun, false); |
| 587 | MU_CATCH |
| 588 | } |
| 589 | |
| 590 | //--------------------------------------------------------------------------- |
| 591 | API_EXPORT(void) mupDefineMultFun(muParserHandle_t a_hParser, |
| 592 | const muChar_t *a_szName, |
| 593 | muMultFun_t a_pFun, |
| 594 | muBool_t a_bAllowOpt) |
| 595 | { |
| 596 | MU_TRY |
| 597 | muParser_t* const p(AsParser(a_hParser)); |
| 598 | p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0); |
| 599 | MU_CATCH |
| 600 | } |
| 601 | |
| 602 | //--------------------------------------------------------------------------- |
| 603 | API_EXPORT(void) mupDefineOprt(muParserHandle_t a_hParser, |
| 604 | const muChar_t* a_szName, |
| 605 | muFun2_t a_pFun, |
| 606 | muInt_t a_nPrec, |
| 607 | muInt_t a_nOprtAsct, |
| 608 | muBool_t a_bAllowOpt) |
| 609 | { |
| 610 | MU_TRY |
| 611 | muParser_t* const p(AsParser(a_hParser)); |
| 612 | p->DefineOprt(a_szName, |
| 613 | a_pFun, |
| 614 | a_nPrec, |
| 615 | (mu::EOprtAssociativity)a_nOprtAsct, |
| 616 | a_bAllowOpt != 0); |
| 617 | MU_CATCH |
| 618 | } |
| 619 | |
| 620 | //--------------------------------------------------------------------------- |
| 621 | API_EXPORT(void) mupDefineVar(muParserHandle_t a_hParser, |
| 622 | const muChar_t *a_szName, |
| 623 | muFloat_t *a_pVar) |
| 624 | { |
| 625 | MU_TRY |
| 626 | muParser_t* const p(AsParser(a_hParser)); |
| 627 | p->DefineVar(a_szName, a_pVar); |
| 628 | MU_CATCH |
| 629 | } |
| 630 | |
| 631 | //--------------------------------------------------------------------------- |
| 632 | API_EXPORT(void) mupDefineBulkVar(muParserHandle_t a_hParser, |
| 633 | const muChar_t *a_szName, |
| 634 | muFloat_t *a_pVar) |
| 635 | { |
| 636 | MU_TRY |
| 637 | muParser_t* const p(AsParser(a_hParser)); |
| 638 | p->DefineVar(a_szName, a_pVar); |
| 639 | MU_CATCH |
| 640 | } |
| 641 | |
| 642 | //--------------------------------------------------------------------------- |
| 643 | API_EXPORT(void) mupDefineConst(muParserHandle_t a_hParser, |
| 644 | const muChar_t *a_szName, |
| 645 | muFloat_t a_fVal) |
| 646 | { |
| 647 | MU_TRY |
| 648 | muParser_t* const p(AsParser(a_hParser)); |
| 649 | p->DefineConst(a_szName, a_fVal); |
| 650 | MU_CATCH |
| 651 | } |
| 652 | |
| 653 | //--------------------------------------------------------------------------- |
| 654 | API_EXPORT(void) mupDefineStrConst(muParserHandle_t a_hParser, |
| 655 | const muChar_t *a_szName, |
| 656 | const muChar_t *a_szVal) |
| 657 | { |
| 658 | MU_TRY |
| 659 | muParser_t* const p(AsParser(a_hParser)); |
| 660 | p->DefineStrConst(a_szName, a_szVal); |
| 661 | MU_CATCH |
| 662 | } |
| 663 | |
| 664 | //--------------------------------------------------------------------------- |
| 665 | API_EXPORT(const muChar_t*) mupGetExpr(muParserHandle_t a_hParser) |
| 666 | { |
| 667 | MU_TRY |
| 668 | muParser_t* const p(AsParser(a_hParser)); |
| 669 | |
| 670 | // C# explodes when pMsg is returned directly. For some reason it can't access |
| 671 | // the memory where the message lies directly. |
| 672 | #ifndef _UNICODE |
| 673 | sprintf(s_tmpOutBuf, "%s", p->GetExpr().c_str()); |
| 674 | #else |
| 675 | wsprintf(s_tmpOutBuf, _T("%s"), p->GetExpr().c_str()); |
| 676 | #endif |
| 677 | |
| 678 | return s_tmpOutBuf; |
| 679 | |
| 680 | MU_CATCH |
| 681 | |
| 682 | return _T(""); |
| 683 | } |
| 684 | |
| 685 | //--------------------------------------------------------------------------- |
| 686 | API_EXPORT(void) mupDefinePostfixOprt(muParserHandle_t a_hParser, |
| 687 | const muChar_t* a_szName, |
| 688 | muFun1_t a_pOprt, |
| 689 | muBool_t a_bAllowOpt) |
| 690 | { |
| 691 | MU_TRY |
| 692 | muParser_t* const p(AsParser(a_hParser)); |
| 693 | p->DefinePostfixOprt(a_szName, a_pOprt, a_bAllowOpt != 0); |
| 694 | MU_CATCH |
| 695 | } |
| 696 | |
| 697 | //--------------------------------------------------------------------------- |
| 698 | API_EXPORT(void) mupDefineInfixOprt(muParserHandle_t a_hParser, |
| 699 | const muChar_t* a_szName, |
| 700 | muFun1_t a_pOprt, |
| 701 | muBool_t a_bAllowOpt) |
| 702 | { |
| 703 | MU_TRY |
| 704 | muParser_t* const p(AsParser(a_hParser)); |
| 705 | p->DefineInfixOprt(a_szName, a_pOprt, a_bAllowOpt != 0); |
| 706 | MU_CATCH |
| 707 | } |
| 708 | |
| 709 | // Define character sets for identifiers |
| 710 | //--------------------------------------------------------------------------- |
| 711 | API_EXPORT(void) mupDefineNameChars(muParserHandle_t a_hParser, |
| 712 | const muChar_t* a_szCharset) |
| 713 | { |
| 714 | muParser_t* const p(AsParser(a_hParser)); |
| 715 | p->DefineNameChars(a_szCharset); |
| 716 | } |
| 717 | |
| 718 | //--------------------------------------------------------------------------- |
| 719 | API_EXPORT(void) mupDefineOprtChars(muParserHandle_t a_hParser, |
| 720 | const muChar_t* a_szCharset) |
| 721 | { |
| 722 | muParser_t* const p(AsParser(a_hParser)); |
| 723 | p->DefineOprtChars(a_szCharset); |
| 724 | } |
| 725 | |
| 726 | //--------------------------------------------------------------------------- |
| 727 | API_EXPORT(void) mupDefineInfixOprtChars(muParserHandle_t a_hParser, |
| 728 | const muChar_t *a_szCharset) |
| 729 | { |
| 730 | muParser_t* const p(AsParser(a_hParser)); |
| 731 | p->DefineInfixOprtChars(a_szCharset); |
| 732 | } |
| 733 | |
| 734 | //--------------------------------------------------------------------------- |
| 735 | /** \brief Get the number of variables defined in the parser. |
| 736 | \param a_hParser [in] Must be a valid parser handle. |
| 737 | \return The number of used variables. |
| 738 | \sa mupGetExprVar |
| 739 | */ |
| 740 | API_EXPORT(int) mupGetVarNum(muParserHandle_t a_hParser) |
| 741 | { |
| 742 | MU_TRY |
| 743 | muParser_t* const p(AsParser(a_hParser)); |
| 744 | const mu::varmap_type VarMap = p->GetVar(); |
| 745 | return (int)VarMap.size(); |
| 746 | MU_CATCH |
| 747 | |
| 748 | return 0; // never reached |
| 749 | } |
| 750 | |
| 751 | //--------------------------------------------------------------------------- |
| 752 | /** \brief Return a variable that is used in an expression. |
| 753 | \param a_hParser [in] A valid parser handle. |
| 754 | \param a_iVar [in] The index of the variable to return. |
| 755 | \param a_szName [out] Pointer to the variable name. |
| 756 | \param a_pVar [out] Pointer to the variable. |
| 757 | \throw nothrow |
| 758 | |
| 759 | Prior to calling this function call mupGetExprVarNum in order to get the |
| 760 | number of variables in the expression. If the parameter a_iVar is greater |
| 761 | than the number of variables both a_szName and a_pVar will be set to zero. |
| 762 | As a side effect this function will trigger an internal calculation of the |
| 763 | expression undefined variables will be set to zero during this calculation. |
| 764 | During the calculation user defined callback functions present in the expression |
| 765 | will be called, this is unavoidable. |
| 766 | */ |
| 767 | API_EXPORT(void) mupGetVar(muParserHandle_t a_hParser, |
| 768 | unsigned a_iVar, |
| 769 | const muChar_t **a_szName, |
| 770 | muFloat_t **a_pVar) |
| 771 | { |
| 772 | // A static buffer is needed for the name since i cant return the |
| 773 | // pointer from the map. |
| 774 | static muChar_t szName[1024]; |
| 775 | |
| 776 | MU_TRY |
| 777 | muParser_t* const p(AsParser(a_hParser)); |
| 778 | const mu::varmap_type VarMap = p->GetVar(); |
| 779 | |
| 780 | if (a_iVar >= VarMap.size()) |
| 781 | { |
| 782 | *a_szName = 0; |
| 783 | *a_pVar = 0; |
| 784 | return; |
| 785 | } |
| 786 | mu::varmap_type::const_iterator item; |
| 787 | |
| 788 | item = VarMap.begin(); |
| 789 | for (unsigned i = 0; i < a_iVar; ++i) |
| 790 | ++item; |
| 791 | |
| 792 | #ifndef _UNICODE |
| 793 | strncpy(szName, item->first.c_str(), sizeof(szName)); |
| 794 | #else |
| 795 | wcsncpy(szName, item->first.c_str(), sizeof(szName)); |
| 796 | #endif |
| 797 | |
| 798 | szName[sizeof(szName)-1] = 0; |
| 799 | |
| 800 | *a_szName = &szName[0]; |
| 801 | *a_pVar = item->second; |
| 802 | return; |
| 803 | |
| 804 | MU_CATCH |
| 805 | |
| 806 | *a_szName = 0; |
| 807 | *a_pVar = 0; |
| 808 | } |
| 809 | |
| 810 | //--------------------------------------------------------------------------- |
| 811 | /** \brief Get the number of variables used in the expression currently set in the parser. |
| 812 | \param a_hParser [in] Must be a valid parser handle. |
| 813 | \return The number of used variables. |
| 814 | \sa mupGetExprVar |
| 815 | */ |
| 816 | API_EXPORT(int) mupGetExprVarNum(muParserHandle_t a_hParser) |
| 817 | { |
| 818 | MU_TRY |
| 819 | muParser_t* const p(AsParser(a_hParser)); |
| 820 | const mu::varmap_type VarMap = p->GetUsedVar(); |
| 821 | return (int)VarMap.size(); |
| 822 | MU_CATCH |
| 823 | |
| 824 | return 0; // never reached |
| 825 | } |
| 826 | |
| 827 | //--------------------------------------------------------------------------- |
| 828 | /** \brief Return a variable that is used in an expression. |
| 829 | |
| 830 | Prior to calling this function call mupGetExprVarNum in order to get the |
| 831 | number of variables in the expression. If the parameter a_iVar is greater |
| 832 | than the number of variables both a_szName and a_pVar will be set to zero. |
| 833 | As a side effect this function will trigger an internal calculation of the |
| 834 | expression undefined variables will be set to zero during this calculation. |
| 835 | During the calculation user defined callback functions present in the expression |
| 836 | will be called, this is unavoidable. |
| 837 | |
| 838 | \param a_hParser [in] A valid parser handle. |
| 839 | \param a_iVar [in] The index of the variable to return. |
| 840 | \param a_szName [out] Pointer to the variable name. |
| 841 | \param a_pVar [out] Pointer to the variable. |
| 842 | \throw nothrow |
| 843 | */ |
| 844 | API_EXPORT(void) mupGetExprVar(muParserHandle_t a_hParser, |
| 845 | unsigned a_iVar, |
| 846 | const muChar_t **a_szName, |
| 847 | muFloat_t **a_pVar) |
| 848 | { |
| 849 | // A static buffer is needed for the name since i cant return the |
| 850 | // pointer from the map. |
| 851 | static muChar_t szName[1024]; |
| 852 | |
| 853 | MU_TRY |
| 854 | muParser_t* const p(AsParser(a_hParser)); |
| 855 | const mu::varmap_type VarMap = p->GetUsedVar(); |
| 856 | |
| 857 | if (a_iVar >= VarMap.size()) |
| 858 | { |
| 859 | *a_szName = 0; |
| 860 | *a_pVar = 0; |
| 861 | return; |
| 862 | } |
| 863 | mu::varmap_type::const_iterator item; |
| 864 | |
| 865 | item = VarMap.begin(); |
| 866 | for (unsigned i = 0; i < a_iVar; ++i) |
| 867 | ++item; |
| 868 | |
| 869 | #ifndef _UNICODE |
| 870 | strncpy(szName, item->first.c_str(), sizeof(szName)); |
| 871 | #else |
| 872 | wcsncpy(szName, item->first.c_str(), sizeof(szName)); |
| 873 | #endif |
| 874 | |
| 875 | szName[sizeof(szName)-1] = 0; |
| 876 | |
| 877 | *a_szName = &szName[0]; |
| 878 | *a_pVar = item->second; |
| 879 | return; |
| 880 | |
| 881 | MU_CATCH |
| 882 | |
| 883 | *a_szName = 0; |
| 884 | *a_pVar = 0; |
| 885 | } |
| 886 | |
| 887 | //--------------------------------------------------------------------------- |
| 888 | /** \brief Return the number of constants defined in a parser. */ |
| 889 | API_EXPORT(int) mupGetConstNum(muParserHandle_t a_hParser) |
| 890 | { |
| 891 | MU_TRY |
| 892 | muParser_t* const p(AsParser(a_hParser)); |
| 893 | const mu::valmap_type ValMap = p->GetConst(); |
| 894 | return (int)ValMap.size(); |
| 895 | MU_CATCH |
| 896 | |
| 897 | return 0; // never reached |
| 898 | } |
| 899 | |
| 900 | //----------------------------------------------------------------------------------------------------- |
| 901 | API_EXPORT(void) mupSetArgSep(muParserHandle_t a_hParser, const muChar_t cArgSep) |
| 902 | { |
| 903 | MU_TRY |
| 904 | muParser_t* const p(AsParser(a_hParser)); |
| 905 | p->SetArgSep(cArgSep); |
| 906 | MU_CATCH |
| 907 | } |
| 908 | |
| 909 | //----------------------------------------------------------------------------------------------------- |
| 910 | API_EXPORT(void) mupResetLocale(muParserHandle_t a_hParser) |
| 911 | { |
| 912 | MU_TRY |
| 913 | muParser_t* const p(AsParser(a_hParser)); |
| 914 | p->ResetLocale(); |
| 915 | MU_CATCH |
| 916 | } |
| 917 | |
| 918 | //----------------------------------------------------------------------------------------------------- |
| 919 | API_EXPORT(void) mupSetDecSep(muParserHandle_t a_hParser, const muChar_t cDecSep) |
| 920 | { |
| 921 | MU_TRY |
| 922 | muParser_t* const p(AsParser(a_hParser)); |
| 923 | p->SetDecSep(cDecSep); |
| 924 | MU_CATCH |
| 925 | } |
| 926 | |
| 927 | //----------------------------------------------------------------------------------------------------- |
| 928 | API_EXPORT(void) mupSetThousandsSep(muParserHandle_t a_hParser, const muChar_t cThousandsSep) |
| 929 | { |
| 930 | MU_TRY |
| 931 | muParser_t* const p(AsParser(a_hParser)); |
| 932 | p->SetThousandsSep(cThousandsSep); |
| 933 | MU_CATCH |
| 934 | } |
| 935 | |
| 936 | //--------------------------------------------------------------------------- |
| 937 | /** \brief Retrieve name and value of a single parser constant. |
| 938 | \param a_hParser [in] a valid parser handle |
| 939 | \param a_iVar [in] Index of the constant to query |
| 940 | \param a_pszName [out] pointer to a null terminated string with the constant name |
| 941 | \param [out] The constant value |
| 942 | */ |
| 943 | API_EXPORT(void) mupGetConst(muParserHandle_t a_hParser, |
| 944 | unsigned a_iVar, |
| 945 | const muChar_t **a_pszName, |
| 946 | muFloat_t *a_fVal) |
| 947 | { |
| 948 | // A static buffer is needed for the name since i cant return the |
| 949 | // pointer from the map. |
| 950 | static muChar_t szName[1024]; |
| 951 | |
| 952 | MU_TRY |
| 953 | muParser_t* const p(AsParser(a_hParser)); |
| 954 | const mu::valmap_type ValMap = p->GetConst(); |
| 955 | |
| 956 | if (a_iVar >= ValMap.size()) |
| 957 | { |
| 958 | *a_pszName = 0; |
| 959 | *a_fVal = 0; |
| 960 | return; |
| 961 | } |
| 962 | |
| 963 | mu::valmap_type::const_iterator item; |
| 964 | item = ValMap.begin(); |
| 965 | for (unsigned i = 0; i < a_iVar; ++i) |
| 966 | ++item; |
| 967 | |
| 968 | #ifndef _UNICODE |
| 969 | strncpy(szName, item->first.c_str(), sizeof(szName)); |
| 970 | #else |
| 971 | wcsncpy(szName, item->first.c_str(), sizeof(szName)); |
| 972 | #endif |
| 973 | |
| 974 | szName[sizeof(szName)-1] = 0; |
| 975 | |
| 976 | *a_pszName = &szName[0]; |
| 977 | *a_fVal = item->second; |
| 978 | return; |
| 979 | |
| 980 | MU_CATCH |
| 981 | |
| 982 | *a_pszName = 0; |
| 983 | *a_fVal = 0; |
| 984 | } |
| 985 | |
| 986 | //--------------------------------------------------------------------------- |
| 987 | /** \brief Add a custom value recognition function. |
| 988 | */ |
| 989 | API_EXPORT(void) mupAddValIdent(muParserHandle_t a_hParser, |
| 990 | muIdentFun_t a_pFun) |
| 991 | { |
| 992 | MU_TRY |
| 993 | muParser_t* p(AsParser(a_hParser)); |
| 994 | p->AddValIdent(a_pFun); |
| 995 | MU_CATCH |
| 996 | } |
| 997 | |
| 998 | //--------------------------------------------------------------------------- |
| 999 | /** \brief Query if an error occurred. |
| 1000 | |
| 1001 | After querying the internal error bit will be reset. So a consecutive call |
| 1002 | will return false. |
| 1003 | */ |
| 1004 | API_EXPORT(muBool_t) mupError(muParserHandle_t a_hParser) |
| 1005 | { |
| 1006 | bool bError(AsParserTag(a_hParser)->bError); |
| 1007 | AsParserTag(a_hParser)->bError = false; |
| 1008 | return bError; |
| 1009 | } |
| 1010 | |
| 1011 | //--------------------------------------------------------------------------- |
| 1012 | /** \brief Reset the internal error flag. |
| 1013 | */ |
| 1014 | API_EXPORT(void) mupErrorReset(muParserHandle_t a_hParser) |
| 1015 | { |
| 1016 | AsParserTag(a_hParser)->bError = false; |
| 1017 | } |
| 1018 | |
| 1019 | //--------------------------------------------------------------------------- |
| 1020 | API_EXPORT(void) mupSetErrorHandler(muParserHandle_t a_hParser, muErrorHandler_t a_pHandler) |
| 1021 | { |
| 1022 | AsParserTag(a_hParser)->errHandler = a_pHandler; |
| 1023 | } |
| 1024 | |
| 1025 | //--------------------------------------------------------------------------- |
| 1026 | /** \brief Return the message associated with the last error. |
| 1027 | */ |
| 1028 | API_EXPORT(const muChar_t*) mupGetErrorMsg(muParserHandle_t a_hParser) |
| 1029 | { |
| 1030 | ParserTag* const p(AsParserTag(a_hParser)); |
| 1031 | const muChar_t *pMsg = p->exc.GetMsg().c_str(); |
| 1032 | |
| 1033 | // C# explodes when pMsg is returned directly. For some reason it can't access |
| 1034 | // the memory where the message lies directly. |
| 1035 | #ifndef _UNICODE |
| 1036 | sprintf(s_tmpOutBuf, "%s", pMsg); |
| 1037 | #else |
| 1038 | wsprintf(s_tmpOutBuf, _T("%s"), pMsg); |
| 1039 | #endif |
| 1040 | |
| 1041 | return s_tmpOutBuf; |
| 1042 | } |
| 1043 | |
| 1044 | //--------------------------------------------------------------------------- |
| 1045 | /** \brief Return the message associated with the last error. |
| 1046 | */ |
| 1047 | API_EXPORT(const muChar_t*) mupGetErrorToken(muParserHandle_t a_hParser) |
| 1048 | { |
| 1049 | ParserTag* const p(AsParserTag(a_hParser)); |
| 1050 | const muChar_t *pToken = p->exc.GetToken().c_str(); |
| 1051 | |
| 1052 | // C# explodes when pMsg is returned directly. For some reason it can't access |
| 1053 | // the memory where the message lies directly. |
| 1054 | #ifndef _UNICODE |
| 1055 | sprintf(s_tmpOutBuf, "%s", pToken); |
| 1056 | #else |
| 1057 | wsprintf(s_tmpOutBuf, _T("%s"), pToken); |
| 1058 | #endif |
| 1059 | |
| 1060 | return s_tmpOutBuf; |
| 1061 | } |
| 1062 | |
| 1063 | //--------------------------------------------------------------------------- |
| 1064 | /** \brief Return the code associated with the last error. |
| 1065 | */ |
| 1066 | API_EXPORT(int) mupGetErrorCode(muParserHandle_t a_hParser) |
| 1067 | { |
| 1068 | return AsParserTag(a_hParser)->exc.GetCode(); |
| 1069 | } |
| 1070 | |
| 1071 | //--------------------------------------------------------------------------- |
| 1072 | /** \brief Return the position associated with the last error. */ |
| 1073 | API_EXPORT(int) mupGetErrorPos(muParserHandle_t a_hParser) |
| 1074 | { |
| 1075 | return (int)AsParserTag(a_hParser)->exc.GetPos(); |
| 1076 | } |
| 1077 | |
| 1078 | ////----------------------------------------------------------------------------------------------------- |
| 1079 | //API_EXPORT(const muChar_t*) mupGetErrorExpr(muParserHandle_t a_hParser) |
| 1080 | //{ |
| 1081 | // return AsParserTag(a_hParser)->exc.GetExpr().c_str(); |
| 1082 | //} |
| 1083 | |
| 1084 | //----------------------------------------------------------------------------------------------------- |
| 1085 | API_EXPORT(muFloat_t*) mupCreateVar() |
| 1086 | { |
| 1087 | return new muFloat_t(0); |
| 1088 | } |
| 1089 | |
| 1090 | //----------------------------------------------------------------------------------------------------- |
| 1091 | API_EXPORT(void) mupReleaseVar(muFloat_t *ptr) |
| 1092 | { |
| 1093 | delete ptr; |
| 1094 | } |
| 1095 | |
| 1096 | #endif // MUPARSER_DLL |