This file is indexed.

/usr/share/doc/libmuparser-doc/html/mup_interface.html is in libmuparser-doc 2.2.3-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <link rel="stylesheet" type="text/css" href="style/formate.css"/>
  <meta name="author" content="Ingo Berg"/>

  <!-- $META -->
  <meta name="keywords" content="muparser, api, interface, dll, C++"/>
  <meta name="description" content="muparser programming interface"/>
  <title>muParser programming interface</title>

  <script src="script/functions.js" language="javascript" type="text/javascript"></script>
  <script type="text/javascript">
  imgHome=new Image();
  imgHome.src="images/home.png";
  imgHomeDark=new Image();
  imgHomeDark.src="images/home_dark.png";

  imgApi=new Image();
  imgApi.src="images/api.png"; 
  imgApiDark=new Image();
  imgApiDark.src="images/api_dark.png";

  function ChangeButtonImage(num,obj)
  {
    window.document.images[num].src=obj.src;
  }
  </script>
</head>

<body>
    <div class="gradient" id="top">
      <div class="header">
        muParser - a fast math parser library
        <br/>
        <div style="font-size:10pt;">Version 2.1.0</div>
      </div>

      <div style="position:absolute; width:250px; height:100px; top:20px; text-align:center">
        <a href="http://sourceforge.net/projects/muparser">
          <img src="http://sflogo.sourceforge.net/sflogo.php?group_id=137191&amp;type=15" 
               width="150" 
               height="40" 
               border="0"
               alt="Get muParser - A fast math parser library at SourceForge.net. Fast, secure and Free Open Source software downloads" />
        </a>
      </div>	

      <div style="position:absolute; width:100px; right:110px; text-align:center; line-height: 1em;">
        <a class="white" 
           href="http://beltoforion.de"  
           onmouseover="ChangeButtonImage(1,imgHome)" 
           onmouseout="ChangeButtonImage(1,imgHomeDark)">
          <img src="images/home_dark.png" border="0" height="40" alt="My home page"/>
          <br/>
          <span class="tiny_text dark_text">My home<br/>page</span>
        </a>
     </div>

     <div  style="position:absolute; width:100px; right:10px; text-align:center; line-height: 1em;">
       <a class="white" 
          href="http://muparser.sourceforge.net/classdocu/index.html"
          onmouseover="ChangeButtonImage(2,imgApi)" 
          onmouseout="ChangeButtonImage(2,imgApiDark)">
         <img src="images/api_dark.png" border="0" alt="class documentation" height="40"/>
         <br/>
         <span class="tiny_text dark_text">muParser<br/>API-doc</span>
       </a>
    </div>
  </div> <!-- class="gradient" -->

    <!-- Tabelle mit Hauptinhalt der Seite -->
    <table id="MainTable" border="0" cellpadding="5" cellspacing="0" style="width:100%; height:100%;">
      <tbody>
        <tr>
          <td style="vertical-align: top; text-align: center" width="230">
            <h3 class="navi_heading navi_info">Introduction</h3>
            <div class="sidebarlink">
                <a href="index.html">About the parser</a><br/>
                <a href="mup_intro.html#idRelNote">Release notes</a><br/>
                <a href="http://sourceforge.net/news/?group_id=137191">News</a><br/>
                <a href="mup_links.html">Software using muParser</a><br/>
                <a href="mup_licence.html">Licence</a><br/>
            </div>

            <h3 class="navi_heading navi_blocks">Features</h3>
            <div class="sidebarlink">
              <a href="mup_features.html">Features</a><br/>
              <a href="mup_features.html#idFeatureOverview">Overview</a><br/>
              <a href="mup_features.html#idDef2">Built in functions</a><br/>
              <a href="mup_features.html#idDef3">Built in binary operators</a><br/>
              <a href="mup_features.html#idDef4">Other operators</a><br/>
            </div>

            <h3 class="navi_heading navi_build">Build instructions</h3>
            <div class="sidebarlink">
              <a href="mup_usage.html#idInstWin">Building on Win32</a><br/>
              <a href="mup_usage.html#idInstLinux">Building on BSD/Linux</a><br/>
              <a href="mup_usage.html#idInstMisc">Misc build instructions</a><br/>
              <a href="mup_usage.html#idInstInc">Including the files</a><br/>
              <a href="mup_usage.html#idCompilerSwitches">Compiler switches</a><br/>
              <a href="mup_usage.html#idHelp">Where to ask for help</a><br/>
            </div>

            <h3 class="navi_heading navi_list">Math parser interface</h3>
            <div class="sidebarlink">
              <a href="mup_interface.html#idInit">Parser (de)initialization</a><br/>
              <a href="mup_interface.html#idEval">Evaluating an expression</a><br/>
              &nbsp;&nbsp;&nbsp;<a href="mup_interface.html#idEvalSimple">Single return value</a><br/>
              &nbsp;&nbsp;&nbsp;<a href="mup_interface.html#idEvalMulti">Multiple return values</a><br/>
              &nbsp;&nbsp;&nbsp;<a href="mup_interface.html#idEvalBulk">Bulk mode</a><br/>

              <a href="mup_interface.html#idSetExpr">Setting the expression</a><br/>
              <a href="mup_interface.html#idDefCharset">Defining identifier charsets</a><br/>
              <a href="mup_interface.html#idDefVar">Defining parser variables</a><br/>
              <a href="mup_interface.html#idDefVarEx">Explicit variable definition</a><br/>
              <a href="mup_interface.html#idDefVarIm">Implicit variable definition</a><br/>
              <a href="mup_interface.html#idDefConst">Defining constants</a><br/>

              <a href="mup_interface_oprt.html#idAddFunOp">Adding functionand operators</a><br/>
              &nbsp;&nbsp;&nbsp;<a href="mup_interface_oprt.html#idDefFun">Defining functions</a><br/>
              &nbsp;&nbsp;&nbsp;<a href="mup_interface_oprt.html#idDefOprt">Defining operators</a><br/>
              &nbsp;&nbsp;&nbsp;<a href="mup_interface_oprt.html#idUnOp">Unary operators</a><br/>
              &nbsp;&nbsp;&nbsp;<a href="mup_interface_oprt.html#idBinOp">Binary operators</a><br/>

              <a href="mup_interface.html#idQueryVar">Querying variables</a><br/>
              <a href="mup_interface.html#idQueryConst">Querying constants</a><br/>
              <a href="mup_interface.html#idDefConst2">Value recognition callbacks</a><br/>
              <a href="mup_interface.html#idDefConst2">Removing variables/constants</a><br/>
              <a href="mup_locale.html#idLoc">Localization</a><br/>
              <a href="mup_interface.html#idErrors">Error handling</a><br/>
              <a href="mup_version.html#idExample">Example code</a><br/>
            </div>

            <h3 class="navi_heading navi_question">Current version</h3>
            <div class="sidebarlink">
              <a href="mup_version.html#idBench">Benchmarks</a><br/>
            </div>

            <br/>
            <div align="center">
              <a href="http://www.opensource.org/"><img style="border:0;" src="images/osi.jpg" alt="Open source initiative logo"/></a>
              <br/>
              <br/>
              <a href="http://validator.w3.org/check?uri=referer">
                <img src="http://www.w3.org/Icons/valid-xhtml10-blue" alt="Valid XHTML 1.0 Transitional" style="border:0;width:88px;height:31px"/>
              </a>
              <br/>
              <br/>
	      <a href="http://jigsaw.w3.org/css-validator/check/referer">
                <img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="CSS ist valide!" />
	      </a>

            </div>
          </td>

          <td style="height: 100%; padding: 1em; vertical-align: top;">
            <!-- 
              This section contains the real page content. 
              pages are created automatically by using the script "build_page.sh"
              which combines section templated with the navigation bar.

	      This creates webpages that do not rely on php3 or Javascript for 
              serverside or client side html inclusion.
            //-->
            <!-- $PLACEHOLDER -->

<!-- 
//
//
//  
//   The parser interface
//
//
//
-->

<br/>
<h1><a id="idInterface"></a>The parser interface</h1>
The following section gives an overview of the public parser member functions as well as of the functions 
exported by the DLL version of the parser.


<h2><a id="idInit"></a>Parser initialization / deinitialization</h2>
<h4>[DLL interface]</h4>
Create a new instance handle. You can create as many different instance handles as you like. Each will 
internally reference a different parser object. When using the DLL it is necessary to manually release 
any parser handle created by <code>mupInit()</code> by calling <code>mupRelease(hParser)</code>.

<pre>
<span class="code_kw_lib">muParserHandle_t</span> hParser;
hParser = <span class="code_kw_lib">mupInit</span>(); <span class="code_cmt">// Create a new handle</span>

<span class="code_cmt">// use the parser...</span>

<span class="code_kw_lib">mupRelease</span>(hParser); <span class="code_cmt">// Release an existing parser handle</span>
</pre>

Internally a handle is nothing more than a pointer to a parser object casted to a void pointer.


<h4>[Parser class interface]</h4>
Code for creating a new parser object. (In case of dynamic allocation use <code>new</code> and <code>delete</code> 
for initialization and deinitialization.) 

<pre>
<span class="code_kw_lib">mu::Parser</span> parser;
</pre>

<!-- 
//
//   The parser interface / Setting the expression
//
-->

<h2><a id="idSetExpr"></a>Setting the expression</h2>
<h4>[DLL interface]</h4>
Setting the expression when using the DLL requires a valid parser handle and a pointer to 
<code>const char</code> pointing to the expression.

<pre>
<span class="code_kw_lib">mupSetExpr</span>(hParser, szLine);
</pre>
<small>See also: <i>example2/example2.c</i>.</small>

<h4>[Parser class interface]</h4>
Setting the expression using the parser class requires a <code>std::string</code> containing the expression as the
only parameter.
<pre>
<span class="code_kw_lib">parser.SetExpr</span>(line);
</pre>
<small>See also: <i>example1/example1.cpp; src/muParserTest.cpp</i>.</small>

<!-- 
//
//   The parser interface / Evaluating the expression
//
-->

<h2><a id="idEval"></a>Evaluating an expression</h2>
<h3><a id="idEvalSimple"></a>Single return value</h3>
<p>
Expression evaluation is done by calling the <code>mupEval()</code> function in the DLL version or the 
<code>Eval()</code> member function of a parser object. When evaluating an expression for the first time
the parser evaluates the expression string directly and creates a bytecode during this first time evaluation. 
Every sucessive call to <code>Eval()</code> will evaluate the bytecode directly unless you call a function 
that will silently reset the parser to string parse mode. Some functions invalidate the bytecode due to 
possible changes in callback function pointers or variable addresses. By doing so they effectively cause a 
recreation of the bytecode during the next call to <code>Eval()</code>. 
</p>

<p>
Internally there are different evaluation functions. One for parsing from a string, the other for
parsing from bytecode (and a third one used only if the expression can be simplified to a constant). 
Initially, <code>Eval()</code> will call the string parsing function which is slow due to all the 
necessary syntax checking, variable lookup, and bytecode creation. Once this
function succeeds, <code>Eval()</code> will change its internal parse function pointer to either
the bytecode parsing function or the const result function which are significantly (approx. 1000 times) 
faster. You don't have to worry about this, it's done automatically, just keep in mind that the 
first time evaluation of an expression is significantly slower than any successive call to 
<code>Eval()</code>.
</p>

<h4>[DLL interface]</h4>
<pre>
<span class="code_kw">double</span> fVal;
fVal = <span class="code_kw_lib">mupEval</span>(hParser);
</pre>
<small>See also: <i>example2/example2.c</i>.</small>

<h4>[Parser class interface]</h4>
<pre>
<span class="code_kw">double</span> fVal;
<span class="code_kw">try</span>
{
  fVal = <span class="code_kw_lib">parser.Eval()</span>;
}
<span class="code_kw">catch</span> (<span class="code_kw_lib">Parser::exception_type</span> &amp;e)
{
  std::cout &lt;&lt; e.GetMsg() &lt;&lt; endl;
}
</pre>
<small>See also: <i>example1/example1.cpp</i>.</small>

<p>
If the expression contains multiple separated subexpressions the return value of <code>Eval()</code>/
<code>mupEval()</code> is the result of the last subexpression. If you need all of the results 
use the Eval overload described in the next section.
</p>

<h3><a id="idEvalMulti"></a>Multiple return values</h3>
<p>
muParser accepts expressions that are made up of several subexpressions <a href="mup_locale.html#idLoc">delimited by the function 
argument separator</a>. For instance take a look at the following expression:
</p>

<pre>
sin(x),y+x,x*x
</pre>

<p>
It is made up of three expression separated by commas hence it will create three return values. 
(Assuming the comma is defined as the argument separator). The number of return values as well
as their value can be queried with an overload of the <code>Eval</code> function. This overload
takes a reference to an integer value for storing the total number of return values and returns
a pointer to an array of <code>value_type</code> holding the actual values with the first value 
at the botton of the array and the last at the top.
</p>
<h4>[DLL interface]</h4>
<pre>
  <span class="code_kw">int</span> nNum, i;
  <span class="code_kw_lib">muFloat_t</span> *v = mupEvalMulti(hParser, &nNum);
  <span class="code_kw">for</span> (i=<span class="code_digit">0</span>; i&lt;nNum; ++i)
  {
    <span class="code_kw">printf</span>(<span class="code_str">"v[i]=%2.2f\n"</span>, v[i]);
  }
</pre>

<h4>[Parser class interface]</h4>
<pre>
  <span class="code_kw">int nNum</span>;
  <span class="code_kw_lib">value_type</span> *v = <span class="code_kw_lib">parser.Eval</span>(nNum);
  <span class="code_kw">for</span> (<span class="code_kw">int</span> i=<span class="code_digit">0</span>; i&lt;nNum; ++i)
  {
    std::cout &lt;&lt; v[i] &lt;&lt; <span class="code_str">"\n"</span>;
  }
</pre>
<small>See also: <i>example1/example1.cpp</i>.</small>

<p>
The function <code>GetNumResults()</code> can be used in order to finf out whether a given expression has produced
multiple return values.
</p>

<h3><a id="idEvalBulk"></a>Bulk mode evaluations</h3>
<p>
The basic idea behind the bulkmode is to minimize the overhead of function calls and loops when using 
muParser inside of large loops. Each loop turn requires a distinct set of variables and setting these 
variables followed by calling the evaluation function can by slow if the loop is implemented in a managed
language. This overhead can be minimized by precalculating the variable values and calling just a single 
evaluation function. In reality the bulkmode doesn't make much of a difference when used in C++ but it 
brings a significant increase in performance when used in .NET applications. If muParser 
<a href="mup_usage.html#idCompilerSwitches_openMP">was compiled with OpenMP support</a> the 
calculation load will be spread among all available CPU cores. When using the bulk mode variable 
pointers submitted to the DefineVar function must be arrays instead of single variables. All
variable arrays must have the same size and each array index represents a distinct set of variables
to be used in the expression. 
</p>
<p>
Although the bulk mode does work with standard callback functions it may sometimes be necessary to have
additional informations inside a callback function. Especially Informations like the index of the current 
variable set and the index of the thread performing the calculation may be crucial to the
evaluation process. To facilitate this need a special set of callback functions was added.
</p>

<h4>[DLL interface]</h4>
<pre>
<span class="code_kw">void</span> CalcBulk()
{
  <span class="code_kw">int</span> nBulkSize = <span class="code_digit">200</span>, i;

  <span class="code_cmt">// allocate the arrays for variables and return values</span>
  <span class="code_kw_lib">muFloat_t</span> *x = (<span class="code_kw_lib">muFloat_t</span>*)malloc(nBulkSize * <span class="code_kw">sizeof</span>(<span class="code_kw_lib">muFloat_t</span>));
  <span class="code_kw_lib">muFloat_t</span> *y = (<span class="code_kw_lib">muFloat_t</span>*)malloc(nBulkSize * <span class="code_kw">sizeof</span>(<span class="code_kw_lib">muFloat_t</span>));
  <span class="code_kw_lib">muFloat_t</span> *r = (<span class="code_kw_lib">muFloat_t</span>*)malloc(nBulkSize * <span class="code_kw">sizeof</span>(<span class="code_kw_lib">muFloat_t</span>));

  <span class="code_cmt">// initialize the parser and variables</span>
  <span class="code_kw_lib">muParserHandle_t</span> hParser = <span class="code_kw_lib">mupCreate</span>(<span class="code_kw_lib">muBASETYPE_FLOAT</span>);  
  <span class="code_kw">for</span> (i=<span class="code_digit">0</span>; i&lt;nBulkSize; ++i)
  {
    x[i] = i;
    y[i] = i;
    r[i] = <span class="code_digit">0</span>;
  }

  <span class="code_cmt">// Set up variables and functions and evaluate the expression</span>
  <span class="code_kw_lib">mupDefineVar</span>(hParser, <span class="code_str">"x"</span>, x);  
  <span class="code_kw_lib">mupDefineVar</span>(hParser, <span class="code_str">"y"</span>, y);
  <span class="code_kw_lib">mupDefineBulkFun1</span>(hParser, <span class="code_str">"bulktest"</span>, BulkTest);
  <span class="code_kw_lib">mupSetExpr</span>(hParser, <span class="code_str">"bulktest(x+y)"</span>);
  <span class="code_kw_lib">mupEvalBulk</span>(hParser, r, nBulkSize);
  <span class="code_kw">if</span> (<span class="code_kw_lib">mupError</span>(hParser))
  {
    printf(<span class="code_str">"\nError:\n"</span>);
    printf(<span class="code_str">"------\n"</span>);
    printf(<span class="code_str">"Message:  %s\n"</span>, <span class="code_kw_lib">mupGetErrorMsg</span>(hParser) );
    printf(<span class="code_str">"Token:    %s\n"</span>, <span class="code_kw_lib">mupGetErrorToken</span>(hParser) );
    printf(<span class="code_str">"Position: %d\n"</span>, <span class="code_kw_lib">mupGetErrorPos</span>(hParser) );
    printf(<span class="code_str">"Errc:     %d\n"</span>, <span class="code_kw_lib">mupGetErrorCode</span>(hParser) );
    <span class="code_kw">return</span>;
  }

  <span class="code_cmt">// Output the result</span>
  <span class="code_kw">for</span> (i=0; i&lt;nBulkSize; ++i)
  {
    printf(<span class="code_str">"%d: bulkfun(%2.2f + %2.2f) = %2.2f\n"</span>, i, x[i], y[i], r[i]);
  }

  free(x);
  free(y);
  free(r);
}
</pre>

<!-- 
//
//   The parser interface / Defining identifier character sets
//
-->

<h2><a id="idDefCharset"></a>Defining identifier character sets</h2>
Sometimes it is necessary to change the character sets that are used for token identifiers in 
order to avoid conflicts. The parser uses three different character sets.
<ul>
  <li>The name character set, is used for:
  <ul>
    <li>function identifiers</li>
    <li>variable identifiers</li>
    <li>constant identifiers</li>
  </ul>
  </li>
  <li>The operator character set is used for:
  <ul>
    <li>binary operator identifiers</li>
    <li>postfix operator identifiers</li>
  </ul></li>

  <li>The Infix operator charset is used for infix operator identifiers only</li>
</ul>

When using the default implementation <code>mu::muParser</code> directly you can skip this
section. (The DLL version uses the default implementation internally.)

<h4>[DLL interface]</h4>
<pre>
<span class="code_kw_lib">mupDefineNameChars</span>(hParser, <span class="code_str">"0123456789_"
                            "abcdefghijklmnopqrstuvwxyz"
                            "ABCDEFGHIJKLMNOPQRSTUVWXYZ"</span>);
<span class="code_kw_lib">mupDefineOprtChars</span>(hParser, <span class="code_str">"abcdefghijklmnopqrstuvwxyz"
                            "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
                            "+-*^/?&lt;&gt;=#!$%&amp;|~'_"</span>);
<span class="code_kw_lib">mupDefineInfixOprtChars</span>(hParser, <span class="code_str">"/+-*^?&lt;&gt;=#!$%&amp;|~'_"</span>);
</pre>

<h4>[Parser class interface]</h4>
<pre>
<span class="code_kw_lib">parser.DefineNameChars</span>(<span class="code_str">"0123456789_"
                       "abcdefghijklmnopqrstuvwxyz"
                       "ABCDEFGHIJKLMNOPQRSTUVWXYZ"</span>);
<span class="code_kw_lib">parser.DefineOprtChars</span>(<span class="code_str">"abcdefghijklmnopqrstuvwxyz"
                       "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
                       "+-*^/?&lt;&gt;=#!$%&amp;|~'_"</span>);
<span class="code_kw_lib">parser.DefineInfixOprtChars</span>(<span class="code_str">"/+-*^?&lt;&gt;=#!$%&amp;|~'_"</span>);
</pre>
<small>See also: <i>ParserLib/muParser.cpp; ParserLib/muParserInt.cpp</i>.</small>

<!-- 
//
//   The parser interface / Defining parser variables
//
-->

<h2><a id="idDefVar"></a>Defining parser variables</h2>
Custom variables can be defined either explicit in the code by using the <code>DefineVar</code> function or implicit by the parser. Implicit declaration will call a variable factory function provided by the user. The parser is never the owner of its variables. So you must take care of their destruction in case of dynamic allocation. The general idea is to bind every parser variable to a C++ variable. For this reason, you have to make sure the C++ variable stays valid as long as you process a formula that needs it. Only variables of type <code>double</code> are supported.


<h2><a id="idDefVarEx"></a>Explicitely defining variables</h2>
Explicitely in this context means you have to do add the variables manually it in your application code. So you must know in advance which variables you intend to use. If this is not the case have a look at
the section on <a href="#idDefVarIm">Implicit creation of new variables</a>.

<table>
  <tr>
    <td><img src="images/warning.gif" alt="warning"/></td>  
    <td>Defining new Variables will reset the parser bytecode. Do not use this function just for changing the values of variables! It would dramatically reduce the parser performance! Once the parser knows the address of the variable there is no need to explicitely call a function for changing the value. Since the parser knows the address it knows the value too so simply change the C++ variable in your code directly!</td>
  </tr>
</table>

<h4>[DLL interface]</h4>
The first parameter is a valid parser handle, the second the variable name and the third a pointer to 
the associated C++ variable.

<pre>
<span class="code_kw">double</span> fVal=<span class="code_digit">0</span>;
<span class="code_kw_lib">mupDefineVar</span>(hParser, <span class="code_str">"a"</span>, &amp;fVal);  
</pre>
<small>See also: <i>example2/example2.c</i>.</small>

<h4>[Parser class interface]</h4>

The first parameter is the variable name and the second a pointer to the associated C++ variable.

<pre>
<span class="code_kw">double</span> fVal=0;
<span class="code_kw_lib">parser.DefineVar</span>(<span class="code_str">"a"</span>, &amp;fVal);
</pre>
<small>See also: <i>example1/example1.cpp; src/muParserTest.cpp</i>.</small>


<h2><a id="idDefVarIm"></a>Implicit creation of new variables</h2>
Implicit declaration of new variables is only possible by setting a factory function. Implicit creation 
means that everytime the parser finds an unknown token at a position where a variable could be located it 
creates a new variable with that name automatically. The necessary factory function must be of type:

<pre>
<span class="code_kw">double</span>* (*<span class="code_kw_lib">facfun_type</span>)(<span class="code_kw">const char</span>*, <span class="code_kw">void</span>*)
</pre> 

The first argument to a factory function is the name of the variable found by the parser. The second is a pointer
to user defined data. This pointer can be used to provide a pointer to a class that implements the actual factory. 
By doing this it is possible to use custom factory classes depending on the variable name.

<table>
<tr><td><img src="images/warning.gif" alt="warning"/></td> <td>Be aware of name conflicts! Please notice that recognizing the name of an undefined variable is the last step during parser token detection. If the potential variable name starts with identifiers that could be interpreted as a function or operator it will be detected as such most likely resulting in an syntax error.</td>
</tr>
</table>

The following code is an example of a factory function. The example does not use dynamic allocation for 
the new variables although this would be possible too. But when using dynamic allocation you must keep
track of the variables allocated implicitely in order to free them later on. 

<pre>
<span class="code_kw">double</span>* AddVariable(<span class="code_kw">const char</span> *a_szName, <span class="code_kw">void</span> *pUserData)
{
  <span class="code_kw">static double</span> afValBuf[<span class="code_digit">100</span>];  
  <span class="code_kw">static int</span> iVal = <span class="code_digit">0</span>;          

  std::cout &lt;&lt; <span class="code_str">"Generating new variable \""</span> 
            &lt;&lt; a_szName &lt;&lt; <span class="code_str">"\" (slots left: " </span>
            &lt;&lt; <span class="code_digit">99</span>-iVal &lt;&lt; <span class="code_str">")"</span> &lt;&lt; endl;
	
  <span class="code_cmt">// you could also do:</span>
  <span class="code_cmt">// MyFactory *pFactory = (MyFactory*)pUserData;</span>
  <span class="code_cmt">// pFactory->CreateNewVariable(a_szName);</span>
  
  afValBuf[iVal++] = <span class="code_digit">0</span>;
  <span class="code_kw">if</span> (iVal>=<span class="code_digit">99</span>)
    <span class="code_kw">throw</span> <span class="code_kw_lib">mu::Parser::exception_type</span>(<span class="code_str">"Variable buffer overflow."</span>);

  <span class="code_kw">return</span> &amp;afValBuf[iVal];
}
</pre>
<small>See also: <i>example1/example1.cpp</i>.</small>

In order to add a variable factory use the <code>SetVarFactory</code> functions. The first parameter 
is a pointer to the static factory function, the second parameter is optional and represents a pointer 
to user defined data. Without a variable factory each undefined variable will cause an undefined token error. Factory 
functions can be used to query the values of newly created variables directly from a
database. If you emit errors from a factory function be sure to throw an exception of
type <code>ParserBase::exception_type</code> all other exceptions will be caught internally
and result in an internal error.

<h4>[DLL interface]</h4>
<pre>
<span class="code_kw_lib">mupSetVarFactory</span>(hParser, AddVariable, pUserData);
</pre>
<small>See also: <i>example2/example2.c</i>.</small>

<h4>[Parser class interface]</h4>
<pre>
<span class="code_kw_lib">parser.SetVarFactory</span>(AddVariable, pUserData);
</pre>
<small>See also: <i>example1/example1.cpp</i>.</small>


<!-- 
//
//   The parser interface / Defining parser constants
//
-->


<h2><a id="idDefConst"></a>Defining parser constants</h2>
Parser constants can either be values of type <code>double</code> or <code>string</code>. Constness 
refers to the bytecode. Constants will be stored by their value in the bytecode, not by a reference to
their address. Thus accessing them is faster. They may be optimized away if this is possible. 
Defining new constants or changing old ones will reset the parser to string parsing mode thus resetting
the bytecode.
<br/>
The Names of user defined constants may contain only the following characters: <code>0-9, a-z, A-Z, _</code>, and they may not start with a number. Violating this rule will raise a parser error.

<h4>[DLL interface]</h4>
<pre>
<span class="code_cmt">// Define value constants _pi</span>
<span class="code_kw_lib">mupDefineConst</span>(hParser, <span class="code_str">"_pi"</span>, (<span class="code_kw">double</span>)PARSER_CONST_PI);  

<span class="code_cmt">// Define a string constant named strBuf</span>
<span class="code_kw_lib">mupDefineStrConst</span>(<span class="code_str">"strBuf"</span>, <span class="code_str">"hello world"</span>);
</pre>
<small>See also: <i>example2/example2.c</i>.</small>


<h4>[Parser class interface]</h4>
<pre>
<span class="code_cmt">// Define value constant _pi</span>
<span class="code_kw_lib">parser.DefineConst</span>(<span class="code_str">"_pi"</span>, (<span class="code_kw">double</span>)PARSER_CONST_PI);

<span class="code_cmt">// Define a string constant named strBuf</span>
<span class="code_kw_lib">parser.DefineStrConst</span>(<span class="code_str">"strBuf"</span>, <span class="code_str">"hello world"</span>);
</pre>
<small>See also: <i>example1/example1.cpp; src/muParserTest.cpp</i>.</small>

<!-- 
//
//   The parser interface / Querying parser variables
//
-->

<h2><a id="idQueryVar"></a>Querying parser variables</h2>
Keeping track of all variables can be a difficult task. For simplification the parser allows the user
to query the variables defined in the parser. There are two different sets of variables that can 
be accessed:

<ul>
  <li>Varaiables defined in the parser</li>
  <li>Variables used in the current expression</li>
</ul>

Since the usage of the necessary commands is similar the following example shows 
querying the parser variables only.


<h4>[DLL interface]</h4>
For querying the variables used in the expression exchange <code>mupGetVarNum(...)</code> with 
<code>mupGetExprVarNum(...)</code> and <code>mupGetVar(...)</code> with <code>mupGetExprVar(...)</code> 
in the following example. Due to the use of an temporary internal static buffer for storing the variable
name in the DLL version this DLL-function is not thread safe.

<pre>
<span class="code_cmt">// Get the number of variables</span>
<span class="code_kw">int</span> iNumVar = <span class="code_kw_lib">mupGetVarNum</span>(a_hParser);

<span class="code_cmt">// Query the variables</span>  
<span class="code_kw">for</span> (<span class="code_kw">int</span> i=<span class="code_digit">0</span>; i &lt; iNumVar; ++i)
{
  <span class="code_kw">const</span> <span class="code_kw_lib">char_type</span> *szName = <span class="code_digit">0</span>;
  <span class="code_kw">double</span> *pVar = <span class="code_digit">0</span>;
  <span class="code_kw_lib">mupGetVar</span>(a_hParser, i, &amp;szName, &amp;pVar);
  std::cout &lt;&lt; <span class="code_str">"Name: "</span> &lt;&lt; szName &lt;&lt; <span class="code_str">"   Address: [0x"</span> &lt;&lt; pVar &lt;&lt; <span class="code_str">"]\n"</span>;
}
</pre>
<small>See also: <i>example2/example2.c</i>.</small>

<h4>[Parser class interface]</h4>
For querying the expression variables exchange <code>parser.GetVar()</code> with
<code>parser.GetUsedVar()</code> in the following example.

<pre>
<span class="code_cmt">// Get the map with the variables</span>
<span class="code_kw_lib">mu::Parser::varmap_type</span> variables = <span class="code_kw_lib">parser.GetVar()</span>;
cout &lt;&lt; <span class="code_str">"Number: "</span> &lt;&lt; (<span class="code_kw">int</span>)variables.size() &lt;&lt; <span class="code_str">"\n"</span>;

<span class="code_cmt">// Get the number of variables</span> 
<span class="code_kw_lib">mu::Parser::varmap_type::</span>const_iterator item = variables.begin();

<span class="code_cmt">// Query the variables</span>
<span class="code_kw">for</span> (; item!=variables.end(); ++item)
{
  cout &lt;&lt; <span class="code_str">"Name: "</span> &lt;&lt; item->first &lt;&lt; <span class="code_str">" Address: [0x"</span> &lt;&lt; item->second &lt;&lt; <span class="code_str">"]\n"</span>;
}
</pre>

<small>
  See also: <i>example1/example1.cpp</i>.
</small>

<!-- 
//
//   The parser interface / Querying parser constants
//
-->


<h2><a id="idQueryConst"></a>Querying parser constants</h2>
Querying parser constants is similar to querying variables and expression variables. 

<h4>[DLL interface]</h4>
Due to the use of an temporary internal static buffer for storing the variable
name in the DLL version this DLL-function is not thread safe.

<pre>
<span class="code_kw">int</span> iNumVar = <span class="code_kw_lib">mupGetConstNum</span>(a_hParser);

<span class="code_kw">for</span> (<span class="code_kw">int</span> i=<span class="code_digit">0</span>; i &lt; iNumVar; ++i)
{
  <span class="code_kw">const</span> <span class="code_kw_lib">char_type</span> *szName = <span class="code_digit">0</span>;
  <span class="code_kw">double</span> fVal = <span class="code_digit">0</span>;
  <span class="code_kw_lib">mupGetConst</span>(a_hParser, i, &amp;szName, fVal);
  std::cout &lt;&lt; <span class="code_str">"  "</span> &lt;&lt; szName &lt;&lt; <span class="code_str">" = "</span> &lt;&lt; fVal &lt;&lt; <span class="code_str">"\n"</span>;
}
</pre>

<small>
  See also: <i>example2/example2.c</i>.
</small>


<h4>[Parser class interface]</h4>
The parser class provides you with the <code>GetConst()</code> member function that returns a map structure
with all defined constants. The following code snippet shows how to use it:
<pre>
<span class="code_kw_lib">mu::Parser::valmap_type</span> cmap = <span class="code_kw_lib">parser.GetConst</span>();
<span class="code_kw">if</span> (cmap.size())
{
  <span class="code_kw_lib">mu::Parser::valmap_type</span>::const_iterator item = cmap.begin();
  <span class="code_kw">for</span> (; item!=cmap.end(); ++item)
    cout &lt;&lt; <span class="code_str">"  "</span> &lt;&lt; item->first &lt;&lt; <span class="code_str">" =  "</span> &lt;&lt; item->second &lt;&lt; <span class="code_str">"\n"</span>;
}
</pre>
<small>See also: <i>example1/example1.cpp</i>.</small>

<!-- 
//
//   The parser interface / Setting custom value recognition callbacks
//
-->


<h2><a id="idDefConst2"></a>Setting custom value recognition callbacks</h2>
The parser default implementation <i>(muParser.cpp)</i> scans expressions 
only for floating point values. Custom value recognition callbacks can be used in order to 
implement support for binary, hexadecimal or octal numbers. These functions are called 
during the string parsing and allow the user to scan portions of the original expressions
for values. Their callback functions must be of the following type:

<pre>
<span class="code_kw">bool</span> (*<span class="code_kw_lib">identfun_type</span>)(<span class="code_kw">const</span> <span class="code_kw_lib">char_type</span>*, <span class="code_kw">int</span>&amp;, <span class="code_kw_lib">value_type</span>&amp;);
</pre>

<p>
If the parser reaches an a position during string parsing that could host a value token it 
tries to interpret it as such. If that fails the parser sucessively calls all 
internal value recognition callbacks in order to give them a chance to make 
sense out of what has been found. If all of them fail the parser continues to
check if it is a Variable or another kind of token. 
</p>

<p>
In order to perform the task of value recognition these functions take a <code>const char</code>
pointer, a reference to <code>int</code> and a reference 
to <code>double</code> as their arguments. 
The <code>const char</code> pointer points to the current formula position. The second
argument is the index of that position. This value must be increased by the length of the 
value entry if one has been found. In that case the value must be written to the third 
argument which is of type <code>double</code>.
</p>

<p>
The next code snippet shows a sample implementation of a function that reads and
interprets binary values from the expression string. The code is taken from 
<i>muParserInt.cpp</i> the implementation of a parser for integer numbers. Binary 
numbers must be preceded with a <code>#</code> (i.e. <code>#1000101</code>).
</p>

<pre>
<span class="code_kw">bool</span> ParserInt::IsBinVal(<span class="code_kw">const</span> <span class="code_kw_lib">char_type</span> *a_szExpr, 
                         <span class="code_kw">int</span> &amp;a_iPos, <span class="code_kw_lib">value_type</span> &amp;a_fVal)
{
  <span class="code_kw">if</span> (a_szExpr[<span class="code_digit">0</span>]!='#') 
    <span class="code_kw">return false</span>;

  <span class="code_kw">unsigned</span> iVal = <span class="code_digit">0</span>, iBits = <span class="code_kw">sizeof</span>(iVal)*<span class="code_digit">8</span>;
  <span class="code_kw">for</span> (<span class="code_kw">unsigned</span> i=<span class="code_digit">0</span>; 
       (a_szExpr[i+<span class="code_digit">1</span>]=='0'||a_szExpr[i+<span class="code_digit">1</span>]=='1')&amp;&amp; i&lt;iBits; 
       ++i)
  {
    iVal |= (<span class="code_kw">int</span>)(a_szExpr[i+<span class="code_digit">1</span>]=='1') &lt;&lt; ((iBits-<span class="code_digit">1</span>)-i);
  }

  <span class="code_kw">if</span> (i==<span class="code_digit">0</span>) 
    <span class="code_kw">return false</span>;

  <span class="code_kw">if</span> (i==iBits)
    <span class="code_kw">throw</span> <span class="code_kw_lib">exception_type</span>(<span class="code_str">"Binary to integer conversion error (overflow)."</span>);

  a_fVal = (<span class="code_kw">unsigned</span>)(iVal &gt;&gt; (iBits-i) );
  a_iPos += i+<span class="code_digit">1</span>;

  <span class="code_kw">return true</span>;
}
</pre>

Once you have the callback you must add it to the parser. This can be done with:

<h4>[DLL interface]</h4>
<pre>
<span class="code_kw_lib">mupAddValIdent</span>(hParser, IsBinVal);
</pre>

<small>
See also: <i>example2/example2.c</i>.
</small>


<h4>[Parser class interface]</h4>
<pre>
<span class="code_kw_lib">parser.AddValIdent</span>(IsBinVal);
</pre>
<small>
See also: <i>ParserLib/muParserInt.cpp</i>.
</small>

<!-- 
//
//   The parser interface / Removing variables or constants
//
-->

<h2><a id="idRemoveVar"></a>Removing variables or constants</h2>
Removing variables and constants can be done all at once using <code>ClearVar</code> and 
<code>ClearConst</code>. Additionally variables can be removed by name using 
<code>RemoveVar</code>. Since the parser never owns the variables you must take care of
their release yourself <small>(if they were dynamically allocated)</small>. If you need to browse all 
the variables have a look at the chapter explaining how to 
<a href="#idQueryVar">query parser variables</a>.


<h4>[DLL interface]</h4>
<pre>
<span class="code_cmt">// Remove all constants</span>
<span class="code_kw_lib">mupClearConst</span>(hParser);

<span class="code_cmt">// remove all variables</span>
<span class="code_kw_lib">mupClearVar</span>(hParser);

<span class="code_cmt">// remove a single variable by name</span>
<span class="code_kw_lib">mupRemoveVar</span>(hParser, <span class="code_str">"a"</span>); 
</pre>
<small>See also: example2/example2.c</small>

<h4>[Parser class interface]</h4>
<pre>
<span class="code_cmt">// Remove all constants</span>
<span class="code_kw_lib">parser.ClearConst()</span>;

<span class="code_cmt">// remove all variables</span>
<span class="code_kw_lib">parser.ClearVar()</span>;

<span class="code_cmt">// remove a single variable by name</span>
<span class="code_kw_lib">parser.RemoveVar</span>(<span class="code_str">"a"</span>);
</pre>
<small>See also: example1/example1.cpp</small>
<!-- 
//
//   The parser interface / Error handling
//
-->


<h2><a id="idErrors"></a>Error handling</h2>
In case of an error both parser class and the parser DLL provide 
similar methods for querying the information associated with the 
error. In the parser class they are member functions of the associated 
exception class <code>mu::Parser::exception_type</code> and in the DLL 
version they are normal functions.

<p>
These functions are:
</p>

<ul>
  <li><code>exception.GetMsg() / mupGetErrorMsg()</code> - returns the error message.</li>
  <li><code>exception.GetExpr() / mupGetExpr()</code> - returns the current formula (if a formula is set)</li>
  <li><code>exception.GetToken() / mupGetErrorToken()</code> - returns the token associated with the error (if applicable)</li>
  <li><code>exception.GetPos() / mupGetErrorPos()</code> - returns the current formula position (if applicable)</li>
  <li><code>exception.GetCode() / mupGetErrorCode()</code> - returns the error code.</li>
</ul>

<p>
The following table lists the parser error codes. 
The first column contains the enumeration values as defined in the enumeration <code>mu::EErrorCodes</code> 
located in the file <i>muParserError.h</i>. Since they are only accessible from C++ the second column lists 
their numeric code and the third column contains the error description.
</p>

<table border="0">
<thead>
  <tr>
    <td>             <small><b>Enumeration name</b></small></td>
    <td align="center"><small><b>Value</b></small></td>
    <td>             <small><b>Description</b></small></td>
  </tr>
</thead>

<tbody>
  <tr>
      <td><small><code>ecUNEXPECTED_OPERATOR</code></small></td>  
      <td align="center"><small>0</small></td>
      <td><small>Unexpected binary operator found</small></td>
  </tr>
  <tr>
      <td><small><code>ecUNASSIGNABLE_TOKEN</code></small></td>
      <td align="center"><small>1</small></td>
      <td><small>Token cant be identified</small></td>
  </tr>
  <tr>
      <td><small><code>ecUNEXPECTED_EOF</code></small></td> 
      <td align="center"><small>2</small></td> 
      <td><small>Unexpected end of formula. (Example: "2+sin(")</small></td>
  </tr>

  <tr>
      <td><small><code>ecUNEXPECTED_ARG_SEP</code></small></td> 
      <td align="center"><small>3</small></td>  
      <td><small>An unexpected <a href="mup_locale.html#idLoc">argument separator</a> has been found. (Example: "1,23")</small></td>
  </tr>
  <tr>
      <td><small><code>ecUNEXPECTED_ARG</code></small></td>
      <td align="center"><small>4</small></td> 
      <td><small>An unexpected argument has been found</small></td>
  </tr>
  <tr>
      <td><small><code>ecUNEXPECTED_VAL</code></small></td>
      <td align="center"><small>5</small></td> 
      <td><small>An unexpected value token has been found</small></td>
  </tr>
  <tr>
      <td><small><code>ecUNEXPECTED_VAR</code></small></td>
      <td align="center"><small>6</small></td>  
      <td><small>An unexpected variable token has been found</small></td>
  </tr>

  <tr>
      <td><small><code>ecUNEXPECTED_PARENS</code></small></td> 
      <td align="center"><small>7</small></td>
      <td><small>Unexpected parenthesis, opening or closing</small></td>
  </tr>
  <tr>
      <td><small><code>ecUNEXPECTED_STR</code></small></td>
      <td align="center"><small>8</small></td> 
      <td><small>A string has been found at an inapropriate position</small></td>
  </tr>
  <tr>
      <td><small><code>ecSTRING_EXPECTED</code></small></td>
      <td align="center"><small>9</small></td>  
      <td><small>A string function has been called with a different type of argument</small></td>
  </tr>

  <tr>
      <td><small><code>ecVAL_EXPECTED</code></small></td>
      <td align="center"><small>10</small></td> 
      <td><small>A numerical function has been called with a non value type of argument</small></td>
  </tr>
  <tr>
      <td><small><code>ecMISSING_PARENS</code></small></td>
      <td align="center"><small>11</small></td> <td><small>Missing parens. (Example: "3*sin(3")</small></td>
  </tr>
  <tr>
      <td><small><code>ecUNEXPECTED_FUN</code></small></td>
      <td align="center"><small>12</small></td> 
      <td><small>Unexpected function found. (Example: "sin(8)cos(9)")</small></td>
  </tr>
  <tr>
      <td><small><code>ecUNTERMINATED_STRING</code></small></td>
      <td align="center"><small>13</small></td>
      <td><small>unterminated string constant. (Example: "3*valueof("hello)")</small></td>
  </tr>
  <tr>
      <td><small><code>ecTOO_MANY_PARAMS</code></small></td>
      <td align="center"><small>14</small></td> 
      <td><small>Too many function parameters</small></td>
  </tr>
  <tr>
      <td><small><code>ecTOO_FEW_PARAMS</code></small></td> 
      <td align="center"><small>15</small></td>
      <td><small>Too few function parameters. (Example: "ite(1&lt;2,2)")</small></td>
  </tr>
  <tr>
      <td><small><code>ecOPRT_TYPE_CONFLICT</code></small></td> 
      <td align="center"><small>16</small></td> 
      <td><small>binary operators may only be applied to value items of the same type</small></td>
  </tr>
  <tr>
      <td><small><code>ecSTR_RESULT</code></small></td>  
      <td align="center"><small>17</small></td> 
      <td><small>result is a string</small></td>
  </tr>
  <tr>
      <td><small><code>ecINVALID_NAME</code></small></td>
      <td align="center"><small>18</small></td> 
      <td><small>Invalid function, variable or constant name.</small></td>
  </tr>
  <tr>
      <td><small><code>ecINVALID_BINOP_IDENT</code></small></td>
      <td align="center"><small>19</small></td> 
      <td><small>Invalid binary operator identifier.</small></td>
  </tr>
  <tr>
      <td><small><code>ecINVALID_INFIX_IDENT</code></small></td>
      <td align="center"><small>20</small></td> 
      <td><small>Invalid infix operator identifier.</small></td>
  </tr>
  <tr>
      <td><small><code>ecINVALID_POSTFIX_IDENT</code></small></td>
      <td align="center"><small>21</small></td> 
      <td><small>Invalid postfix operator identifier.</small></td>
  </tr>
  <tr>
      <td><small><code>ecBUILTIN_OVERLOAD</code></small></td>
      <td align="center"><small>22</small></td> 
      <td><small>Trying to overload builtin operator</small></td>
  </tr>
  <tr>
      <td><small><code>ecINVALID_FUN_PTR</code></small></td>  
      <td align="center"><small>23</small></td> 
      <td><small>Invalid callback function pointer</small></td>
  </tr>
  <tr>
      <td><small><code>ecINVALID_VAR_PTR</code></small></td>
      <td align="center"><small>24</small></td> 
      <td><small>Invalid variable pointer</small></td>
  </tr>
  <tr>
      <td><small><code>ecEMPTY_EXPRESSION </code></small></td>
      <td align="center"><small>25</small></td> 
      <td><small>The expression string is empty</small></td>
  </tr>
  <tr>
      <td><small><code>ecNAME_CONFLICT</code></small></td>  
      <td align="center"><small>26</small></td> 
      <td><small>Name conflict</small></td>
  </tr>
  <tr>
      <td><small><code>ecOPT_PRI</code></small></td>  
      <td align="center"><small>27</small></td>
      <td><small>Invalid operator priority</small></td>
  </tr>
  <tr>
      <td><small><code>ecDOMAIN_ERROR</code></small></td>
      <td align="center"><small>28</small></td>
      <td><small>catch division by zero, sqrt(-1), log(0) (currently unused)</small></td>
  </tr>
  <tr>
      <td><small><code>ecDIV_BY_ZERO</code></small></td>
      <td align="center"><small>29</small></td> 
      <td><small>Division by zero (currently unused)</small></td>
  </tr>
  <tr>
      <td><small><code>ecGENERIC</code></small></td> 
      <td align="center"><small>30</small></td> 
      <td><small>Error that does not fit any other code but is not an internal error</small></td>
  </tr>
  <tr>
      <td><small><code>ecLOCALE</code></small></td> 
      <td align="center"><small>31</small></td> 
      <td><small>Conflict with current locale</small></td>
  </tr>
  <tr>
      <td><small><code>ecUNEXPECTED_CONDITIONAL</code></small></td> 
      <td align="center"><small>32</small></td> 
      <td><small>Unexpected if then else operator</small></td>
  </tr>
  <tr>
      <td><small><code>ecMISSING_ELSE_CLAUSE</code></small></td> 
      <td align="center"><small>33</small></td> 
      <td><small>Missing else clause</small></td>
  </tr>
  <tr>
      <td><small><code>ecMISPLACED_COLON</code></small></td> 
      <td align="center"><small>34</small></td> 
      <td><small>Misplaced colon</small></td>
  </tr>
  <tr>
      <td><small><code>ecINTERNAL_ERROR</code></small></td>   
      <td align="center"><small>35</small></td> 
      <td><small>Internal error of any kind.</small></td>
  </tr>
  </tbody>
</table>

<h4>[DLL interface]</h4>
Since dynamic libraries with functions exported in C-style can't throw exceptions the DLL version
provides the user with a callback mechanism to raise errors. Simply add a callback function
that does the handling of errors. Additionally you can query the error flag with 
<code>mupError()</code>. Please note that by calling this function you will automatically reset the error flag!
<pre>
<span class="code_cmt">// Callback function for errors</span>
<span class="code_kw">void</span> OnError()
{
  cout &lt;&lt; <span class="code_str">"Message:  "</span> &lt;&lt; <span class="code_kw_lib">mupGetErrorMsg</span>() &lt;&lt; <span class="code_str">"\n"</span>;
  cout &lt;&lt; <span class="code_str">"Token:    "</span> &lt;&lt; <span class="code_kw_lib">mupGetErrorToken</span>() &lt;&lt; <span class="code_str">"\n"</span>;
  cout &lt;&lt; <span class="code_str">"Position: "</span> &lt;&lt; <span class="code_kw_lib">mupGetErrorPos</span>() &lt;&lt; <span class="code_str">"\n"</span>;
  cout &lt;&lt; <span class="code_str">"Errc:     "</span> &lt;&lt; <span class="code_kw_lib">mupGetErrorCode</span>() &lt;&lt; <span class="code_str">"\n"</span>;
}

...

<span class="code_cmt">// Set a callback for error handling</span>
<span class="code_kw_lib">mupSetErrorHandler</span>(OnError);

<span class="code_cmt">// The next function could raise an error</span>
fVal = <span class="code_kw_lib">mupEval</span>(hParser);

<span class="code_cmt">// Test for the error flag</span>
<span class="code_kw">if</span> (!<span class="code_kw_lib">mupError</span>()) cout &lt;&lt; fVal &lt;&lt; <span class="code_str">"\n"</span>;
</pre>
<small>See also: example2/example2.c</small>

<h4>[Parser class interface]</h4>
In case of an error the parser class raises an exception of type <code>Parser::exception_type</code>. This 
class provides you with several member functions that allow querying the exact cause as well as 
additional information for the error.
<pre>
<span class="code_kw">try</span>
{
  ...
  <span class="code_kw_lib">parser.Eval</span>();
  ...
}
<span class="code_kw">catch</span>(<span class="code_kw_lib">mu::Parser::exception_type</span> &amp;e)
{
  cout &lt;&lt; <span class="code_str">"Message:  "</span> &lt;&lt; <span class="code_kw_lib">e.GetMsg()</span> &lt;&lt; <span class="code_str">"\n"</span>;
  cout &lt;&lt; <span class="code_str">"Formula:  "</span> &lt;&lt; <span class="code_kw_lib">e.GetExpr()</span> &lt;&lt; <span class="code_str">"\n"</span>;
  cout &lt;&lt; <span class="code_str">"Token:    "</span> &lt;&lt; <span class="code_kw_lib">e.GetToken()</span> &lt;&lt; <span class="code_str">"\n"</span>;
  cout &lt;&lt; <span class="code_str">"Position: "</span> &lt;&lt; <span class="code_kw_lib">e.GetPos()</span> &lt;&lt; <span class="code_str">"\n"</span>;
  cout &lt;&lt; <span class="code_str">"Errc:     "</span> &lt;&lt; <span class="code_kw_lib">e.GetCode()</span> &lt;&lt; <span class="code_str">"\n"</span>;
}
</pre>
<small>See also: example1/example1.cpp</small>



            <hr/>
            <table border="0" style="width:100%">
            <tr>
              <td>&copy; 2005-2011 Ingo Berg</td>
              <td style="text-align:right; padding-right: 3em;">
                <a href="#top">^ TOP</a>
              </td>
            </tr>
          </table>
          <br/>
          <br/>

          </td>
        </tr>
      </tbody>
    </table>


    <script type="text/javascript">
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    </script>
    <script type="text/javascript">
    try 
    {
    } 
    catch(err) {}
    </script>

</body>
</html>