[SCM] iannix/master: New upstream version 0.9.19~dfsg0

umlaeute at users.alioth.debian.org umlaeute at users.alioth.debian.org
Mon Oct 23 11:15:47 UTC 2017


The following commit has been merged in the master branch:
commit bc91fb4a5db076edd3114e940cbb6de9904ac6b6
Author: IOhannes m zmölnig (Debian/GNU) <umlaeute at debian.org>
Date:   Mon Oct 23 13:01:35 2017 +0200

    New upstream version 0.9.19~dfsg0

diff --git a/IanniX.pro b/IanniX.pro
index 6d707b3..15a6cd9 100644
--- a/IanniX.pro
+++ b/IanniX.pro
@@ -2,7 +2,7 @@
 #    Copyright (C) 2010-2015 — IanniX Association
 #
 #    Project Manager: Thierry Coduys (http://www.le-hub.org)
-#    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+#    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 #
 #    This file was written by Guillaume Jacquemin.
 #
diff --git a/Info.plist b/Info.plist
old mode 100755
new mode 100644
index 43fb210..33ec2b1
--- a/Info.plist
+++ b/Info.plist
@@ -7,9 +7,9 @@
 	<key>CFBundleExecutable</key>
 	<string>IanniX</string>
 	<key>CFBundleShortVersionString</key>
-	<string>0.9.17</string>
+        <string>0.9.18</string>
 	<key>CFBundleVersion</key>
-	<string>0.9.17</string>
+        <string>0.9.18</string>
 	<key>CFBundleIdentifier</key>
 	<string>org.iannix.desktop</string>
 	<key>NSHumanReadableCopyright</key>
diff --git a/Patches/Arduino/Arduino.ino b/Patches/Arduino/Arduino.ino
index 498af5b..7e60591 100644
--- a/Patches/Arduino/Arduino.ino
+++ b/Patches/Arduino/Arduino.ino
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/Patches/Arduino/Readme.txt b/Patches/Arduino/Readme.txt
index 6b7f883..a99721c 100644
--- a/Patches/Arduino/Readme.txt
+++ b/Patches/Arduino/Readme.txt
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     These files were written by Guillaume Jacquemin.
 
diff --git a/Patches/Arduino/iannix_lib.cpp b/Patches/Arduino/iannix_lib.cpp
index f459b6f..247964a 100644
--- a/Patches/Arduino/iannix_lib.cpp
+++ b/Patches/Arduino/iannix_lib.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/Patches/Arduino/iannix_lib.h b/Patches/Arduino/iannix_lib.h
index 66b0d3a..ed803ab 100644
--- a/Patches/Arduino/iannix_lib.h
+++ b/Patches/Arduino/iannix_lib.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/Patches/PureData/Iannix-puredata/example_gem/a-initcursor.pd b/Patches/PureData/Iannix-puredata/example_gem/a-initcursor.pd
index 7062a0c..b4e7370 100644
--- a/Patches/PureData/Iannix-puredata/example_gem/a-initcursor.pd
+++ b/Patches/PureData/Iannix-puredata/example_gem/a-initcursor.pd
@@ -1,25 +1,17 @@
-#N canvas 306 25 781 482 10;
-#X obj 39 271 repeat 1000;
-#X obj 105 130 bng 25 250 50 0 empty empty empty 17 7 0 10 -262144
+#N canvas 313 49 781 656 10;
+#X obj 115 130 bng 25 250 50 0 empty empty init.tab 0 -7 0 10 -262144
 -1 -1;
-#X obj 39 232 t b b;
-#X msg 85 249 0;
-#X obj 64 292 + 1;
-#X obj 40 348 tabwrite INDEXcursor;
-#X obj 64 312 t b f;
-#X msg 40 329 0;
-#X obj 140 266 s INITGEN;
-#X obj 39 292 f;
-#X text 102 114 init tab;
-#X obj -103 271 unpack f;
-#X obj -101 336 tabwrite INDEXcursor;
-#X obj -101 291 t b f;
-#X msg -101 314 1;
-#N canvas 323 88 450 300 subtab 0;
-#N canvas 0 22 450 300 (subpatch) 0;
+#X obj 169 202 t b b;
+#X msg 215 219 0;
+#X obj 215 246 s INITGEN;
+#X obj 27 441 unpack f;
+#X obj 29 506 tabwrite INDEXcursor;
+#X obj 29 461 t b f;
+#X msg 29 484 1;
+#N canvas 325 80 450 300 subtab 0;
+#N canvas 0 50 450 300 (subpatch) 0;
 #X array INDEXcursor 3000 float 3;
-#A 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
-1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+#A 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
@@ -47,143 +39,284 @@
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
-#A 1000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
-#A 2000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
+#A 1000 0 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.750312 0.750624 0.750937 0.751249 0.751562 0.751874 0.752187
+0.752499 0.752812 0.753124 0.753437 0.753749 0.754062 0.754374 0.754687
+0.754999 0.755312 0.755624 0.755937 0.756249 0.756562 0.756874 0.757187
+0.757499 0.757812 0.758124 0.758437 0.758749 0.759062 0.759374 0.759687
+0.759999 0.760312 0.760624 0.760937 0.761249 0.761562 0.761874 0.762187
+0.7625 0.762812 0.763125 0.763437 0.76375 0.764062 0.764375 0.764687
+0.765 0.765312 0.765625 0.765937 0.76625 0.766562 0.766875 0.767187
+0.7675 0.767812 0.768125 0.768437 0.76875 0.769062 0.769375 0.769687
+0.77 0.770312 0.770625 0.770937 0.77125 0.771562 0.771875 0.772187
+0.7725 0.772812 0.773125 0.773437 0.77375 0.774062 0.774375 0.774687
+0.775 0.775312 0.775625 0.775937 0.77625 0.776562 0.776875 0.777187
+0.7775 0.777812 0.778125 0.778437 0.77875 0.779062 0.779375 0.779687
+0.78 0.780312 0.780625 0.780937 0.78125 0.781562 0.781875 0.782187
+0.7825 0.782812 0.783125 0.783437 0.78375 0.784063 0.784375 0.784688
+0.785 0.785313 0.785625 0.785938 0.78625 0.786563 0.786875 0.787188
+0.7875 0.787813 0.788125 0.788438 0.78875 0.789063 0.789375 0.789688
+0.79 0.790313 0.790625 0.790938 0.79125 0.791563 0.791875 0.792188
+0.7925 0.792813 0.793125 0.793438 0.79375 0.794063 0.794375 0.794688
+0.795 0.795313 0.795625 0.795938 0.79625 0.796563 0.796875 0.797188
+0.7975 0.797813 0.798125 0.798438 0.79875 0.799063 0.799375 0.799688
+0.8 0.800313 0.800625 0.800938 0.80125 0.801563 0.801875 0.802188 0.8025
+0.802813 0.803125 0.803438 0.80375 0.804063 0.804375 0.804688 0.805
+0.805313 0.805625 0.805938 0.806251 0.806563 0.806876 0.807188 0.807501
+0.807813 0.808126 0.808438 0.808751 0.809063 0.809376 0.809688 0.810001
+0.810313 0.810626 0.810938 0.811251 0.811563 0.811876 0.812188 0.812501
+0.812813 0.813126 0.813438 0.813751 0.814063 0.814376 0.814688 0.815001
+0.815313 0.815626 0.815938 0.816251 0.816563 0.816876 0.817188 0.817501
+0.817813 0.818126 0.818438 0.818751 0.819063 0.819376 0.819688 0.820001
+0.820313 0.820626 0.820938 0.821251 0.821563 0.821876 0.822188 0.822501
+0.822813 0.823126 0.823438 0.823751 0.824063 0.824376 0.824688 0.825001
+0.263439 0.264376 0.265314 0.266251 0.267189 0.268126 0.269064 0.270001
+0.270939 0.271876 0.272814 0.273751 0.274689 0.275627 0.276564 0.277502
+0.278439 0.279377 0.280314 0.281252 0.282189 0.283127 0.284064 0.285002
+0.285939 0.286877 0.287814 0.288752 0.289689 0.290627 0.291564 0.292502
+0.293439 0.294377 0.295314 0.296252 0.29719 0.298127 0.299065 0.300002
+0.30094 0.301877 0.302815 0.303752 0.30469 0.305627 0.306565 0.307502
+0.30844 0.309377 0.310315 0.311252 0.31219 0.313127 0.314065 0.315002
+0.31594 0.316877 0.317815 0.318753 0.31969 0.320628 0.321565 0.322503
+0.32344 0.324378 0.325315 0.326253 0.32719 0.328128 0.329065 0.330003
+0.33094 0.331878 0.332815 0.333753 0.33469 0.335628 0.336565 0.337503
+0.33844 0.339378 0.340316 0.341253 0.342191 0.343128 0.344066 0.345003
+0.345941 0.346878 0.347816 0.348753 0.349691 0.350628 0.351566 0.352503
+0.353441 0.354378 0.355316 0.356253 0.357191 0.358128 0.359066 0.360003
+0.360941 0.361879 0.362816 0.363754 0.364691 0.365629 0.366566 0.367504
+0.368441 0.369379 0.370316 0.371254 0.372191 0.373129 0.374066 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004;
+#A 2000 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
 #X coords 0 1.5 3000 0 50 20 1;
 #X restore 244 113 graph;
-#X restore 337 74 pd subtab;
-#X obj -103 246 r RouteCursor;
-#X obj 222 222 repeat 1000;
-#X obj 222 267 tabread INDEXcursor;
-#X obj 247 242 + 1;
-#X obj 224 291 sel 1;
-#X obj 247 318 + 1;
-#X obj 161 130 bng 25 250 50 0 empty empty empty 17 7 0 10 -262144
--1 -1;
-#X obj 222 572 s pd-Rcursor;
-#X obj 222 242 f;
-#X obj 222 318 f;
-#X msg 278 199 0;
-#X text 158 113 create objet;
-#X obj 222 526 pack f f f;
-#X obj 222 392 mod 10;
-#X obj 265 428 sel 1;
-#X obj 222 344 t f f;
-#X obj 265 474 f;
-#X obj 293 474 + 50;
-#X obj 250 501 f;
-#X obj 222 411 t f f b;
-#X msg 222 547 obj \$1 \$2 abs-cursor \$3;
-#X obj 252 369 + 0;
-#X obj 222 453 * 125;
-#X obj 222 181 t b b b;
-#X msg 406 198 \; pd-Rcursor clear \;;
-#X connect 0 0 9 0;
-#X connect 1 0 2 0;
-#X connect 2 0 0 0;
-#X connect 2 1 3 0;
-#X connect 2 1 40 0;
-#X connect 3 0 8 0;
-#X connect 3 0 9 1;
+#X restore 467 74 pd subtab;
+#X obj 27 416 r RouteCursor;
+#X obj 352 297 tabread INDEXcursor;
+#X obj 384 257 + 1;
+#X obj 352 321 sel 1;
+#X obj 387 341 + 1;
+#X obj 171 130 bng 25 250 50 0 empty empty create.object 0 -7 0 10
+-262144 -1 -1;
+#X obj 352 257 f;
+#X obj 352 341 f;
+#X msg 408 199 0;
+#X obj 352 556 pack f f f;
+#X obj 352 422 mod 10;
+#X obj 395 463 sel 1;
+#X obj 352 381 t f f;
+#X obj 395 484 f;
+#X obj 423 484 + 50;
+#X obj 385 531 f;
+#X obj 352 441 t f f b;
+#X msg 352 577 obj \$1 \$2 abs-cursor \$3;
+#X obj 384 402 + 0;
+#X obj 352 483 * 125;
+#X msg 536 198 clear;
+#X obj 329 170 t b b b b;
+#X msg 329 192 loadbang;
+#X msg 352 215 1000;
+#X obj 352 237 until;
+#X obj 352 277 t f f;
+#X obj 352 361 t f f;
+#X obj 408 219 t f f f;
+#X obj 395 504 t f f;
+#X obj 352 602 s pd-\$1.Rcursor;
+#X msg 169 269 const 0;
+#X obj 169 291 s INDEXcursor;
+#X connect 0 0 1 0;
+#X connect 1 0 39 0;
+#X connect 1 1 2 0;
+#X connect 2 0 3 0;
 #X connect 4 0 6 0;
-#X connect 4 0 9 1;
 #X connect 6 0 7 0;
 #X connect 6 1 5 1;
 #X connect 7 0 5 0;
 #X connect 9 0 4 0;
-#X connect 11 0 13 0;
-#X connect 13 0 14 0;
-#X connect 13 1 12 1;
-#X connect 14 0 12 0;
-#X connect 16 0 11 0;
-#X connect 17 0 24 0;
-#X connect 18 0 20 0;
-#X connect 19 0 24 1;
-#X connect 20 0 25 0;
-#X connect 21 0 25 1;
-#X connect 22 0 39 0;
-#X connect 24 0 19 0;
-#X connect 24 0 18 0;
-#X connect 25 0 21 0;
-#X connect 25 0 31 0;
-#X connect 26 0 24 1;
-#X connect 26 0 25 1;
-#X connect 26 0 32 1;
-#X connect 28 0 36 0;
-#X connect 29 0 35 0;
-#X connect 30 0 32 0;
-#X connect 31 0 29 0;
-#X connect 31 1 37 0;
+#X connect 10 0 12 0;
+#X connect 11 0 15 1;
+#X connect 12 0 16 0;
+#X connect 13 0 16 1;
+#X connect 14 0 30 0;
+#X connect 15 0 34 0;
+#X connect 16 0 35 0;
+#X connect 17 0 36 0;
+#X connect 18 0 26 0;
+#X connect 19 0 25 0;
+#X connect 20 0 22 0;
+#X connect 21 0 19 0;
+#X connect 21 1 27 0;
+#X connect 22 0 37 0;
+#X connect 23 0 22 1;
+#X connect 24 0 18 1;
+#X connect 25 0 28 0;
+#X connect 25 1 20 0;
+#X connect 25 2 24 0;
+#X connect 26 0 38 0;
+#X connect 27 0 18 2;
+#X connect 28 0 18 0;
+#X connect 29 0 38 0;
+#X connect 30 0 31 0;
+#X connect 30 1 32 0;
+#X connect 30 2 17 0;
+#X connect 30 3 29 0;
+#X connect 31 0 38 0;
 #X connect 32 0 33 0;
-#X connect 32 0 34 1;
-#X connect 33 0 32 1;
-#X connect 34 0 28 1;
-#X connect 35 0 38 0;
-#X connect 35 1 30 0;
-#X connect 35 2 34 0;
-#X connect 36 0 23 0;
-#X connect 37 0 28 2;
-#X connect 38 0 28 0;
-#X connect 39 0 17 0;
-#X connect 39 1 26 0;
-#X connect 39 2 40 0;
+#X connect 33 0 15 0;
+#X connect 34 0 10 0;
+#X connect 34 1 11 0;
+#X connect 35 0 21 0;
+#X connect 35 1 13 0;
+#X connect 36 0 22 1;
+#X connect 36 1 16 1;
+#X connect 36 2 15 1;
+#X connect 37 0 24 1;
+#X connect 37 1 23 0;
+#X connect 39 0 40 0;
 #X coords 0 -1 1 1 160 60 1 100 100;
diff --git a/Patches/PureData/Iannix-puredata/example_gem/a-inittrig.pd b/Patches/PureData/Iannix-puredata/example_gem/a-inittrig.pd
index 6fddfbd..d1b267d 100644
--- a/Patches/PureData/Iannix-puredata/example_gem/a-inittrig.pd
+++ b/Patches/PureData/Iannix-puredata/example_gem/a-inittrig.pd
@@ -1,24 +1,17 @@
-#N canvas 223 99 659 675 10;
-#X obj -38 239 t b f;
-#X msg -39 264 1;
-#X obj -40 285 tabwrite INDEXtrigger;
-#X obj 105 131 bng 25 250 50 0 empty empty empty 17 7 0 10 -262144
+#N canvas 231 61 659 675 10;
+#X obj 181 459 t b f;
+#X msg 181 484 1;
+#X obj 181 505 tabwrite INDEXtrigger;
+#X obj 105 131 bng 25 250 50 0 empty empty init.tab 0 -7 0 10 -262144
 -1 -1;
-#X text 104 114 init tab;
-#X obj 105 196 t b b;
-#X msg 151 213 0;
-#X obj 130 256 + 1;
-#X obj 130 276 t b f;
-#X msg 106 293 0;
-#X obj 206 230 s INITGEN;
-#X obj 106 312 tabwrite INDEXtrigger;
-#X obj 105 235 repeat 3000;
-#X obj 105 256 f;
-#N canvas 358 502 450 300 sutab 0;
-#N canvas 0 22 450 300 (subpatch) 0;
+#X obj 105 166 t b b;
+#X msg 212 190 0;
+#X obj 212 210 s INITGEN;
+#N canvas 362 452 450 300 sutab 0;
+#N canvas 4 50 450 300 (subpatch) 0;
 #X array INDEXtrigger 3000 float 3;
-#A 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+#A 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
+1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
@@ -77,8 +70,8 @@
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
-#A 2000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
-1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+#A 2000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
@@ -109,79 +102,86 @@
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
 #X coords 0 1 3000 -1 50 20 1;
 #X restore 235 107 graph;
-#X restore 334 57 pd sutab;
-#X obj 335 257 + 1;
-#X obj 310 302 sel 1;
-#X obj 335 329 + 1;
-#X obj 164 131 bng 25 250 50 0 empty empty empty 17 7 0 10 -262144
--1 -1;
-#X obj 310 279 tabread INDEXtrigger;
-#X obj 310 237 repeat 3000;
-#X obj 309 578 s pd-Rtrigger;
-#X obj 341 377 + 2000;
-#X obj 310 257 f;
-#X obj 310 329 f;
-#X msg 380 206 0;
-#X text 161 113 create objet;
-#X obj 311 534 pack f f f;
-#X obj 311 400 mod 10;
-#X obj 354 436 sel 1;
-#X obj 311 352 t f f;
-#X obj 354 482 f;
-#X obj 382 482 + 50;
-#X obj 339 509 f;
-#X obj 311 419 t f f b;
-#X msg 310 558 obj \$1 \$2 abs-trigger \$3;
-#X obj 311 461 * 110;
-#X obj -38 216 r RouteTrigger;
-#X obj 310 189 t b b b;
-#X msg 416 208 \; pd-Rtrigger clear \;;
+#X restore 434 57 pd sutab;
+#X obj 442 237 + 1;
+#X obj 410 302 sel 1;
+#X obj 442 328 + 1;
+#X obj 164 131 bng 25 250 50 0 empty empty create.object 0 -7 0 10
+-262144 -1 -1;
+#X obj 410 279 tabread INDEXtrigger;
+#X obj 410 237 f;
+#X obj 410 329 f;
+#X msg 480 166 0;
+#X obj 410 587 pack f f f;
+#X obj 410 419 mod 10;
+#X obj 433 464 sel 1;
+#X obj 410 375 t f f;
+#X obj 453 505 f;
+#X obj 481 505 + 50;
+#X obj 438 562 f;
+#X obj 410 442 t f f b;
+#X msg 410 608 obj \$1 \$2 abs-trigger \$3;
+#X obj 410 484 * 110;
+#X obj 181 436 r RouteTrigger;
+#X msg 538 209 clear;
+#X obj 390 149 t b b b b;
+#X msg 390 171 loadbang;
+#X obj 105 210 s INDEXtrigger;
+#X msg 105 190 const 0;
+#X obj 410 193 i 3000;
+#X obj 410 214 until;
+#X obj 410 257 t f f;
+#X obj 410 351 t f f;
+#X obj 453 526 t f f;
+#X obj 470 186 t a a a;
+#X obj 390 628 s pd-\$1.Rtrigger;
+#X obj 442 395 + 0;
 #X connect 0 0 1 0;
 #X connect 0 1 2 1;
 #X connect 1 0 2 0;
-#X connect 3 0 5 0;
-#X connect 5 0 12 0;
-#X connect 5 1 6 0;
-#X connect 5 1 39 0;
-#X connect 6 0 10 0;
-#X connect 6 0 13 1;
-#X connect 7 0 8 0;
-#X connect 7 0 13 1;
-#X connect 8 0 9 0;
-#X connect 8 1 11 1;
-#X connect 9 0 11 0;
-#X connect 12 0 13 0;
-#X connect 13 0 7 0;
-#X connect 15 0 23 1;
+#X connect 3 0 4 0;
+#X connect 4 0 31 0;
+#X connect 4 1 5 0;
+#X connect 5 0 6 0;
+#X connect 8 0 13 1;
+#X connect 9 0 14 0;
+#X connect 10 0 14 1;
+#X connect 11 0 28 0;
+#X connect 12 0 9 0;
+#X connect 13 0 34 0;
+#X connect 14 0 35 0;
+#X connect 15 0 37 0;
 #X connect 16 0 24 0;
-#X connect 17 0 24 1;
-#X connect 18 0 38 0;
-#X connect 19 0 16 0;
-#X connect 20 0 23 0;
-#X connect 22 0 27 2;
-#X connect 23 0 15 0;
-#X connect 23 0 19 0;
-#X connect 24 0 17 0;
-#X connect 24 0 30 0;
-#X connect 25 0 23 1;
-#X connect 25 0 24 1;
-#X connect 25 0 31 1;
-#X connect 27 0 35 0;
-#X connect 28 0 34 0;
-#X connect 29 0 31 0;
-#X connect 30 0 28 0;
-#X connect 30 1 22 0;
-#X connect 31 0 32 0;
-#X connect 31 0 33 1;
-#X connect 32 0 31 1;
-#X connect 33 0 27 1;
-#X connect 34 0 36 0;
-#X connect 34 1 29 0;
-#X connect 34 2 33 0;
-#X connect 35 0 21 0;
-#X connect 36 0 27 0;
-#X connect 37 0 0 0;
-#X connect 38 0 20 0;
-#X connect 38 1 25 0;
-#X connect 38 2 39 0;
+#X connect 17 0 23 0;
+#X connect 18 0 20 0;
+#X connect 19 0 17 0;
+#X connect 19 1 39 0;
+#X connect 20 0 36 0;
+#X connect 21 0 20 1;
+#X connect 22 0 16 1;
+#X connect 23 0 25 0;
+#X connect 23 1 18 0;
+#X connect 23 2 22 0;
+#X connect 24 0 38 0;
+#X connect 25 0 16 0;
+#X connect 26 0 0 0;
+#X connect 27 0 38 0;
+#X connect 28 0 29 0;
+#X connect 28 1 32 0;
+#X connect 28 2 15 0;
+#X connect 28 3 27 0;
+#X connect 29 0 38 0;
+#X connect 31 0 30 0;
+#X connect 32 0 33 0;
+#X connect 33 0 13 0;
+#X connect 34 0 12 0;
+#X connect 34 1 8 0;
+#X connect 35 0 19 0;
+#X connect 35 1 10 0;
+#X connect 36 0 22 1;
+#X connect 36 1 21 0;
+#X connect 37 0 20 1;
+#X connect 37 1 14 1;
+#X connect 37 2 13 1;
+#X connect 39 0 16 2;
 #X coords 0 -1 1 1 160 60 1 100 100;
diff --git a/Patches/PureData/Iannix-puredata/example_gem/a-udp.pd b/Patches/PureData/Iannix-puredata/example_gem/a-udp.pd
index 2e81d84..930eeea 100644
--- a/Patches/PureData/Iannix-puredata/example_gem/a-udp.pd
+++ b/Patches/PureData/Iannix-puredata/example_gem/a-udp.pd
@@ -1,76 +1,90 @@
-#N canvas 240 58 960 669 10;
-#X declare -lib mrpeach;
-#X obj 121 -135 import mrpeach;
-#X obj 307 -67 inlet;
-#X obj 437 -67 inlet;
-#X msg 437 -18 /iannix/stop;
-#X obj 437 -43 route 0;
-#X msg 525 -18 /iannix/play \$1;
-#X obj 637 -67 inlet;
-#X obj 306 139 route /trigger /cursor /curve /transport;
-#X obj 307 15 packOSC;
-#X obj 321 -175 loadbang;
-#X obj 306 117 unpackOSC;
-#X obj 307 58 udpsend;
-#X obj 307 36 prepend send;
-#X obj 261 -129 pack s f;
-#X obj 321 -150 f \$2;
-#X obj 261 -150 symbol \$1;
-#X msg 261 -106 connect \$1 \$2;
-#X obj 306 272 outlet;
-#X obj 365 272 outlet;
-#X obj 424 272 outlet;
-#X obj 483 205 route play stop fastrewind;
-#X msg 483 225 1;
-#X msg 534 225 0;
-#X obj 585 250 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
+#N canvas 245 49 960 669 10;
+#X obj 317 83 inlet;
+#X obj 447 83 inlet;
+#X msg 447 132 /iannix/stop;
+#X obj 447 107 route 0;
+#X msg 535 132 /iannix/play \$1;
+#X obj 647 83 inlet;
+#X obj 211 75 loadbang;
+#X obj 141 121 pack s f;
+#X obj 211 100 f \$2;
+#X obj 141 100 symbol \$1;
+#X msg 141 144 connect \$1 \$2;
+#X obj 307 512 outlet;
+#X obj 366 512 outlet;
+#X obj 425 512 outlet;
+#X obj 484 445 route play stop fastrewind;
+#X msg 484 465 1;
+#X msg 535 465 0;
+#X obj 586 490 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
 -1 -1;
-#X obj 506 251 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
+#X obj 507 491 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
 1;
-#X obj 506 272 outlet;
-#X obj 585 272 outlet;
-#X obj 735 272 outlet;
-#X obj 777 272 outlet;
-#X obj 819 272 outlet;
-#X msg 637 -18 /iannix/fastrewind;
-#X msg 483 184 \$1;
-#X obj 635 272 outlet;
-#X obj 685 272 outlet;
-#X obj 483 163 unpack s f s f f f;
-#X obj 306 95 udpreceive \$3;
-#X connect 1 0 8 0;
-#X connect 2 0 4 0;
-#X connect 3 0 8 0;
-#X connect 4 0 3 0;
-#X connect 4 1 5 0;
-#X connect 5 0 8 0;
-#X connect 6 0 30 0;
-#X connect 7 0 17 0;
-#X connect 7 1 18 0;
-#X connect 7 2 19 0;
-#X connect 7 3 34 0;
-#X connect 8 0 12 0;
-#X connect 9 0 14 0;
-#X connect 9 0 15 0;
-#X connect 10 0 7 0;
-#X connect 12 0 11 0;
-#X connect 13 0 16 0;
-#X connect 14 0 13 1;
-#X connect 15 0 13 0;
-#X connect 16 0 11 0;
-#X connect 20 0 21 0;
-#X connect 20 1 22 0;
-#X connect 20 2 23 0;
-#X connect 21 0 24 0;
-#X connect 22 0 24 0;
-#X connect 23 0 26 0;
-#X connect 24 0 25 0;
-#X connect 30 0 8 0;
-#X connect 31 0 20 0;
-#X connect 34 0 31 0;
-#X connect 34 1 32 0;
-#X connect 34 2 33 0;
-#X connect 34 3 27 0;
-#X connect 34 4 28 0;
-#X connect 34 5 29 0;
-#X connect 35 0 10 0;
+#X obj 507 512 outlet;
+#X obj 586 512 outlet;
+#X obj 735 492 outlet;
+#X obj 777 492 outlet;
+#X obj 819 492 outlet;
+#X msg 647 132 /iannix/fastrewind;
+#X msg 484 424 \$1;
+#X obj 636 512 outlet;
+#X obj 685 492 outlet;
+#X obj 484 403 unpack s f s f f f;
+#X obj 488 298 netsend -u -b;
+#X obj 488 256 list prepend send;
+#X obj 488 277 list trim;
+#X obj 307 305 netreceive -u -b \$3;
+#X obj 307 327 oscparse;
+#X obj 307 379 route trigger cursor curve transport;
+#X obj 448 160 route send;
+#X obj 448 204 list split 1;
+#X obj 566 207 symbol;
+#X obj 488 229 oscformat;
+#X msg 566 229 set \$1;
+#X obj 448 182 t a a;
+#X obj 307 353 list trim;
+#X connect 0 0 35 0;
+#X connect 1 0 3 0;
+#X connect 2 0 35 0;
+#X connect 3 0 2 0;
+#X connect 3 1 4 0;
+#X connect 4 0 35 0;
+#X connect 5 0 24 0;
+#X connect 6 0 8 0;
+#X connect 6 0 9 0;
+#X connect 7 0 10 0;
+#X connect 8 0 7 1;
+#X connect 9 0 7 0;
+#X connect 10 0 29 0;
+#X connect 14 0 15 0;
+#X connect 14 1 16 0;
+#X connect 14 2 17 0;
+#X connect 15 0 18 0;
+#X connect 16 0 18 0;
+#X connect 17 0 20 0;
+#X connect 18 0 19 0;
+#X connect 24 0 35 0;
+#X connect 25 0 14 0;
+#X connect 28 0 25 0;
+#X connect 28 1 26 0;
+#X connect 28 2 27 0;
+#X connect 28 3 21 0;
+#X connect 28 4 22 0;
+#X connect 28 5 23 0;
+#X connect 30 0 31 0;
+#X connect 31 0 29 0;
+#X connect 32 0 33 0;
+#X connect 33 0 41 0;
+#X connect 34 0 11 0;
+#X connect 34 1 12 0;
+#X connect 34 2 13 0;
+#X connect 34 3 28 0;
+#X connect 35 0 40 0;
+#X connect 35 1 40 0;
+#X connect 36 1 38 0;
+#X connect 37 0 39 0;
+#X connect 38 0 30 0;
+#X connect 39 0 38 0;
+#X connect 40 0 36 0;
+#X connect 40 1 37 0;
+#X connect 41 0 34 0;
diff --git a/Patches/PureData/Iannix-puredata/example_gem/a_range.pd b/Patches/PureData/Iannix-puredata/example_gem/a_range.pd
index 0965e03..bd40826 100644
--- a/Patches/PureData/Iannix-puredata/example_gem/a_range.pd
+++ b/Patches/PureData/Iannix-puredata/example_gem/a_range.pd
@@ -1,26 +1,25 @@
-#N canvas 121 22 450 300 10;
-#X obj -135 -3 inlet;
-#X obj -135 236 outlet;
-#X obj -135 26 - \$1;
-#X obj -135 124 /;
-#X obj -59 57 \$2;
-#X obj -59 89 - \$1;
-#X obj -135 182 *;
-#X obj 27 89 \$4;
-#X obj 26 121 - \$3;
-#X obj -135 212 + \$3;
-#X obj 27 67 initbang;
-#X obj -59 34 loadbang;
+#N canvas 122 49 450 300 10;
+#X obj 125 27 inlet;
+#X obj 125 266 outlet;
+#X obj 125 56 - \$1;
+#X obj 125 154 /;
+#X obj 201 119 - \$1;
+#X obj 125 212 *;
+#X obj 287 151 - \$3;
+#X obj 125 242 + \$3;
+#X obj 201 40 loadbang;
+#X obj 201 67 t b b;
+#X obj 201 93 f \$2;
+#X obj 287 125 f \$4;
 #X connect 0 0 2 0;
 #X connect 2 0 3 0;
-#X connect 3 0 6 0;
-#X connect 4 0 5 0;
-#X connect 5 0 3 1;
-#X connect 6 0 9 0;
-#X connect 7 0 8 0;
-#X connect 8 0 6 1;
-#X connect 9 0 1 0;
-#X connect 10 0 7 0;
+#X connect 3 0 5 0;
+#X connect 4 0 3 1;
+#X connect 5 0 7 0;
+#X connect 6 0 5 1;
+#X connect 7 0 1 0;
+#X connect 8 0 9 0;
+#X connect 9 0 10 0;
+#X connect 9 1 11 0;
 #X connect 10 0 4 0;
-#X connect 11 0 4 0;
-#X connect 11 0 7 0;
+#X connect 11 0 6 0;
diff --git a/Patches/PureData/Iannix-puredata/example_gem/abs-cursor.pd b/Patches/PureData/Iannix-puredata/example_gem/abs-cursor.pd
index 529433a..4f8d782 100644
--- a/Patches/PureData/Iannix-puredata/example_gem/abs-cursor.pd
+++ b/Patches/PureData/Iannix-puredata/example_gem/abs-cursor.pd
@@ -1,7 +1,6 @@
-#N canvas 535 99 574 627 10;
+#N canvas 536 95 574 627 10;
 #X obj 20 142 outlet;
 #X obj 48 169 outlet;
-#X obj 269 310 initbang;
 #X obj 325 327 loadbang;
 #X obj 104 37 route \$1;
 #X obj 78 194 outlet;
@@ -13,7 +12,7 @@
 #X obj 131 275 translateXYZ;
 #X obj 131 369 cube 0.1;
 #X msg 279 352 draw line;
-#X obj 133 326 rotateXYZ;
+#X obj 131 326 rotateXYZ;
 #X obj 178 300 * 10;
 #X obj 201 300 * 10;
 #X obj 224 301 * 10;
@@ -22,31 +21,30 @@
 #X obj 153 147 a_range 0.01 1 -3 3;
 #X obj 176 170 a_range 0.01 1 -3 3;
 #X obj 200 190 a_range 0.01 1 -3 3;
-#X connect 2 0 13 0;
-#X connect 3 0 13 0;
-#X connect 4 0 6 0;
-#X connect 6 1 7 0;
-#X connect 6 2 8 0;
-#X connect 6 3 9 0;
-#X connect 7 0 0 0;
+#X connect 2 0 12 0;
+#X connect 3 0 5 0;
+#X connect 5 1 6 0;
+#X connect 5 2 7 0;
+#X connect 5 3 8 0;
+#X connect 6 0 0 0;
+#X connect 6 1 19 0;
+#X connect 7 0 1 0;
 #X connect 7 1 20 0;
-#X connect 8 0 1 0;
+#X connect 8 0 4 0;
 #X connect 8 1 21 0;
-#X connect 9 0 5 0;
-#X connect 9 1 22 0;
-#X connect 10 0 4 0;
-#X connect 11 0 14 0;
-#X connect 13 0 12 0;
-#X connect 14 0 12 0;
-#X connect 15 0 14 1;
-#X connect 16 0 14 2;
-#X connect 17 0 14 3;
-#X connect 18 0 11 0;
-#X connect 19 0 18 0;
-#X connect 20 0 11 1;
+#X connect 9 0 3 0;
+#X connect 10 0 13 0;
+#X connect 12 0 11 0;
+#X connect 13 0 11 0;
+#X connect 14 0 13 1;
+#X connect 15 0 13 2;
+#X connect 16 0 13 3;
+#X connect 17 0 10 0;
+#X connect 18 0 17 0;
+#X connect 19 0 10 1;
+#X connect 19 0 14 0;
+#X connect 20 0 10 2;
 #X connect 20 0 15 0;
-#X connect 21 0 11 2;
 #X connect 21 0 16 0;
-#X connect 22 0 17 0;
-#X connect 22 0 11 3;
+#X connect 21 0 10 3;
 #X coords 0 627 1 626 120 35 0;
diff --git a/Patches/PureData/Iannix-puredata/example_gem/main.pd b/Patches/PureData/Iannix-puredata/example_gem/main.pd
index 6c9285c..b033c30 100644
--- a/Patches/PureData/Iannix-puredata/example_gem/main.pd
+++ b/Patches/PureData/Iannix-puredata/example_gem/main.pd
@@ -1,160 +1,57 @@
-#N canvas 696 27 712 546 10;
-#X declare -lib mrpeach;
-#N canvas 53 38 1285 596 Rcursor 0;
-#X obj 0 0 abs-cursor 0;
-#X obj 125 0 abs-cursor 1;
-#X obj 250 0 abs-cursor 2;
-#X obj 375 0 abs-cursor 3;
-#X obj 500 0 abs-cursor 4;
-#X obj 625 0 abs-cursor 5;
-#X obj 750 0 abs-cursor 6;
-#X obj 875 0 abs-cursor 7;
-#X obj 1000 0 abs-cursor 8;
-#X obj 1125 0 abs-cursor 9;
-#X obj 0 0 abs-cursor 10;
-#X obj 125 0 abs-cursor 11;
-#X obj 250 50 abs-cursor 12;
-#X obj 375 50 abs-cursor 13;
-#X obj 500 50 abs-cursor 14;
-#X obj 625 50 abs-cursor 15;
-#X obj 750 50 abs-cursor 16;
-#X obj 875 50 abs-cursor 17;
-#X obj 1000 50 abs-cursor 18;
-#X obj 1125 50 abs-cursor 19;
-#X obj 0 50 abs-cursor 20;
-#X obj 125 50 abs-cursor 21;
-#X obj 250 100 abs-cursor 22;
-#X obj 375 100 abs-cursor 23;
-#X obj 500 100 abs-cursor 24;
-#X obj 625 100 abs-cursor 25;
-#X obj 750 100 abs-cursor 26;
-#X obj 875 100 abs-cursor 27;
-#X obj 1000 100 abs-cursor 28;
-#X obj 1125 100 abs-cursor 29;
-#X obj 0 100 abs-cursor 30;
-#X obj 125 100 abs-cursor 31;
-#X obj 250 150 abs-cursor 32;
-#X obj 375 150 abs-cursor 33;
-#X obj 500 150 abs-cursor 34;
-#X obj 625 150 abs-cursor 35;
-#X obj 750 150 abs-cursor 36;
-#X obj 875 150 abs-cursor 37;
-#X obj 1000 150 abs-cursor 38;
-#X obj 1125 150 abs-cursor 39;
-#X obj 0 150 abs-cursor 40;
-#X obj 125 150 abs-cursor 41;
-#X obj 250 200 abs-cursor 42;
-#X obj 375 200 abs-cursor 43;
-#X obj 500 200 abs-cursor 44;
-#X obj 625 200 abs-cursor 45;
-#X obj 750 200 abs-cursor 46;
-#X obj 875 200 abs-cursor 47;
-#X obj 1000 200 abs-cursor 48;
-#X obj 1125 200 abs-cursor 49;
-#X restore -92 25 pd Rcursor;
-#X text -58 -271 Set IanniX score speed;
-#X floatatom -94 -272 5 0 0 0 - - -;
-#X msg -94 -252 /iannix/speed \$1;
-#X obj -77 -116 s RouteCursor;
-#X obj -60 -136 s RouteCurve;
-#X obj -94 -96 s RouteTrigger;
-#X obj -18 -204 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1
-0 1;
-#X text -2 -205 Play / pause;
-#X obj 99 -240 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
+#N canvas 605 49 757 597 10;
+#X text 102 39 Set IanniX score speed;
+#X floatatom 66 38 5 0 0 0 - - -, f 5;
+#X msg 66 58 /iannix/speed \$1;
+#X obj 83 194 s RouteCursor;
+#X obj 100 174 s RouteCurve;
+#X obj 66 214 s RouteTrigger;
+#X obj 142 106 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
 1;
-#X text 114 -241 Score played / paused;
-#X msg -18 -225 set \$1;
-#X floatatom 59 -157 5 0 0 0 - - -;
-#X floatatom 42 -139 5 0 0 0 - - -;
-#X floatatom 25 -121 5 0 0 0 - - -;
-#X obj -96 -38 a-initcursor;
-#X obj -94 -177 a-udp 127.0.0.1 1234 57120;
-#X obj 69 -39 a-inittrig;
-#N canvas 0 22 1137 239 Rtrigger 0;
-#X obj 0 0 abs-trigger 2000;
-#X obj 110 0 abs-trigger 2001;
-#X obj 220 0 abs-trigger 2002;
-#X obj 330 0 abs-trigger 2003;
-#X obj 440 0 abs-trigger 2004;
-#X obj 550 0 abs-trigger 2005;
-#X obj 660 0 abs-trigger 2006;
-#X obj 770 0 abs-trigger 2007;
-#X obj 880 0 abs-trigger 2008;
-#X obj 990 0 abs-trigger 2009;
-#X obj 0 0 abs-trigger 2010;
-#X obj 110 0 abs-trigger 2011;
-#X obj 220 50 abs-trigger 2012;
-#X obj 330 50 abs-trigger 2013;
-#X obj 440 50 abs-trigger 2014;
-#X obj 550 50 abs-trigger 2015;
-#X obj 660 50 abs-trigger 2016;
-#X obj 770 50 abs-trigger 2017;
-#X obj 880 50 abs-trigger 2018;
-#X obj 990 50 abs-trigger 2019;
-#X obj 0 50 abs-trigger 2020;
-#X obj 110 50 abs-trigger 2021;
-#X obj 220 100 abs-trigger 2022;
-#X obj 330 100 abs-trigger 2023;
-#X obj 440 100 abs-trigger 2024;
-#X obj 550 100 abs-trigger 2025;
-#X obj 660 100 abs-trigger 2026;
-#X obj 770 100 abs-trigger 2027;
-#X obj 880 100 abs-trigger 2028;
-#X obj 990 100 abs-trigger 2029;
-#X obj 0 100 abs-trigger 2030;
-#X obj 110 100 abs-trigger 2031;
-#X obj 220 150 abs-trigger 2032;
-#X obj 330 150 abs-trigger 2033;
-#X obj 440 150 abs-trigger 2034;
-#X obj 550 150 abs-trigger 2035;
-#X obj 660 150 abs-trigger 2036;
-#X obj 770 150 abs-trigger 2037;
-#X obj 880 150 abs-trigger 2038;
-#X obj 990 150 abs-trigger 2039;
-#X obj 0 150 abs-trigger 2040;
-#X obj 110 150 abs-trigger 2041;
-#X obj 220 200 abs-trigger 2042;
-#X obj 330 200 abs-trigger 2043;
-#X obj 440 200 abs-trigger 2044;
-#X obj 550 200 abs-trigger 2045;
-#X obj 660 200 abs-trigger 2046;
-#X obj 770 200 abs-trigger 2047;
-#X obj 880 200 abs-trigger 2048;
-#X obj 990 200 abs-trigger 2049;
-#X obj 0 200 abs-trigger 2050;
-#X restore 69 23 pd Rtrigger;
-#X text -94 149 4/ open [pd Rcursor] or [Rtrigger] to see the abstractions
+#X text 158 105 Play / pause;
+#X obj 259 70 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
+1;
+#X text 274 69 Score played / paused;
+#X msg 142 85 set \$1;
+#X floatatom 219 153 5 0 0 0 - - -, f 5;
+#X floatatom 202 171 5 0 0 0 - - -, f 5;
+#X floatatom 185 189 5 0 0 0 - - -, f 5;
+#X obj 66 133 a-udp 127.0.0.1 1234 57120;
+#X text 66 459 4/ open [pd Rcursor] or [Rtrigger] to see the abstractions
 or to modify;
-#X text -95 107 2/ click init tab for cursor and trigger to dump number
+#X text 65 417 2/ click init tab for cursor and trigger to dump number
 of elements;
-#X text -93 134 3/ create object for cursor and trigger.;
-#X text -91 209 created by philippe boisnard;
-#X text -97 48 gem example;
-#X obj 289 -93 gemwin;
-#X msg 346 -110 destroy;
-#X obj 282 -34 gemhead;
-#X obj 282 -8 s GemHeadCircle;
-#X obj 381 -31 gemhead;
-#X obj 381 -8 s GemHeadCube;
-#X text -95 60 this example shows how you can generate in dynamic patching
+#X text 67 444 3/ create object for cursor and trigger.;
+#X text 69 519 created by philippe boisnard;
+#X text 63 358 gem example;
+#X obj 449 217 gemwin;
+#X msg 506 200 destroy;
+#X obj 442 276 gemhead;
+#X obj 442 302 s GemHeadCircle;
+#X obj 541 279 gemhead;
+#X obj 541 302 s GemHeadCube;
+#X text 65 370 this example shows how you can generate in dynamic patching
 an gem-video;
-#X msg 288 -132 FSAA 4 \, dimen 800 800 \, frame 30 \, create \, 1
-;
-#X text -95 92 1/ open a ianniX score and play it (Rosette \, Spin
+#X msg 448 178 FSAA 4 \, dimen 800 800 \, frame 30 \, create \, 1;
+#X text 65 402 1/ open a ianniX score and play it (Rosette \, Spin
 \, Torus).;
-#X connect 2 0 3 0;
-#X connect 3 0 16 0;
-#X connect 7 0 16 1;
-#X connect 9 0 11 0;
-#X connect 11 0 7 0;
-#X connect 16 0 6 0;
-#X connect 16 1 4 0;
-#X connect 16 2 5 0;
-#X connect 16 7 14 0;
-#X connect 16 8 13 0;
-#X connect 16 9 12 0;
-#X connect 25 0 24 0;
-#X connect 26 0 27 0;
-#X connect 28 0 29 0;
-#X connect 31 0 24 0;
+#N canvas 68 50 1285 596 \$0.Rcursor 0;
+#X restore 68 335 pd \$0.Rcursor;
+#N canvas 14 50 1137 239 \$0.Rtrigger 0;
+#X restore 229 333 pd \$0.Rtrigger;
+#X obj 64 272 a-initcursor \$0;
+#X obj 229 271 a-inittrig \$0;
+#X connect 1 0 2 0;
+#X connect 2 0 14 0;
+#X connect 6 0 14 1;
+#X connect 8 0 10 0;
+#X connect 10 0 6 0;
+#X connect 14 0 5 0;
+#X connect 14 1 3 0;
+#X connect 14 2 4 0;
+#X connect 14 7 13 0;
+#X connect 14 8 12 0;
+#X connect 14 9 11 0;
+#X connect 21 0 20 0;
+#X connect 22 0 23 0;
+#X connect 24 0 25 0;
+#X connect 27 0 20 0;
diff --git a/Patches/PureData/Iannix-puredata/example_sound/a-initcursor.pd b/Patches/PureData/Iannix-puredata/example_sound/a-initcursor.pd
index 0d01920..b4e7370 100644
--- a/Patches/PureData/Iannix-puredata/example_sound/a-initcursor.pd
+++ b/Patches/PureData/Iannix-puredata/example_sound/a-initcursor.pd
@@ -1,25 +1,17 @@
-#N canvas 306 25 781 482 10;
-#X obj 39 271 repeat 1000;
-#X obj 105 130 bng 25 250 50 0 empty empty empty 17 7 0 10 -262144
+#N canvas 313 49 781 656 10;
+#X obj 115 130 bng 25 250 50 0 empty empty init.tab 0 -7 0 10 -262144
 -1 -1;
-#X obj 39 232 t b b;
-#X msg 85 249 0;
-#X obj 64 292 + 1;
-#X obj 40 348 tabwrite INDEXcursor;
-#X obj 64 312 t b f;
-#X msg 40 329 0;
-#X obj 140 266 s INITGEN;
-#X obj 39 292 f;
-#X text 102 114 init tab;
-#X obj -103 271 unpack f;
-#X obj -101 336 tabwrite INDEXcursor;
-#X obj -101 291 t b f;
-#X msg -101 314 1;
-#N canvas 323 88 450 300 subtab 0;
-#N canvas 0 22 450 300 (subpatch) 0;
+#X obj 169 202 t b b;
+#X msg 215 219 0;
+#X obj 215 246 s INITGEN;
+#X obj 27 441 unpack f;
+#X obj 29 506 tabwrite INDEXcursor;
+#X obj 29 461 t b f;
+#X msg 29 484 1;
+#N canvas 325 80 450 300 subtab 0;
+#N canvas 0 50 450 300 (subpatch) 0;
 #X array INDEXcursor 3000 float 3;
-#A 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
-1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+#A 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
@@ -47,142 +39,284 @@
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
-#A 1000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
-#A 2000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
+#A 1000 0 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999 0.749999
+0.749999 0.750312 0.750624 0.750937 0.751249 0.751562 0.751874 0.752187
+0.752499 0.752812 0.753124 0.753437 0.753749 0.754062 0.754374 0.754687
+0.754999 0.755312 0.755624 0.755937 0.756249 0.756562 0.756874 0.757187
+0.757499 0.757812 0.758124 0.758437 0.758749 0.759062 0.759374 0.759687
+0.759999 0.760312 0.760624 0.760937 0.761249 0.761562 0.761874 0.762187
+0.7625 0.762812 0.763125 0.763437 0.76375 0.764062 0.764375 0.764687
+0.765 0.765312 0.765625 0.765937 0.76625 0.766562 0.766875 0.767187
+0.7675 0.767812 0.768125 0.768437 0.76875 0.769062 0.769375 0.769687
+0.77 0.770312 0.770625 0.770937 0.77125 0.771562 0.771875 0.772187
+0.7725 0.772812 0.773125 0.773437 0.77375 0.774062 0.774375 0.774687
+0.775 0.775312 0.775625 0.775937 0.77625 0.776562 0.776875 0.777187
+0.7775 0.777812 0.778125 0.778437 0.77875 0.779062 0.779375 0.779687
+0.78 0.780312 0.780625 0.780937 0.78125 0.781562 0.781875 0.782187
+0.7825 0.782812 0.783125 0.783437 0.78375 0.784063 0.784375 0.784688
+0.785 0.785313 0.785625 0.785938 0.78625 0.786563 0.786875 0.787188
+0.7875 0.787813 0.788125 0.788438 0.78875 0.789063 0.789375 0.789688
+0.79 0.790313 0.790625 0.790938 0.79125 0.791563 0.791875 0.792188
+0.7925 0.792813 0.793125 0.793438 0.79375 0.794063 0.794375 0.794688
+0.795 0.795313 0.795625 0.795938 0.79625 0.796563 0.796875 0.797188
+0.7975 0.797813 0.798125 0.798438 0.79875 0.799063 0.799375 0.799688
+0.8 0.800313 0.800625 0.800938 0.80125 0.801563 0.801875 0.802188 0.8025
+0.802813 0.803125 0.803438 0.80375 0.804063 0.804375 0.804688 0.805
+0.805313 0.805625 0.805938 0.806251 0.806563 0.806876 0.807188 0.807501
+0.807813 0.808126 0.808438 0.808751 0.809063 0.809376 0.809688 0.810001
+0.810313 0.810626 0.810938 0.811251 0.811563 0.811876 0.812188 0.812501
+0.812813 0.813126 0.813438 0.813751 0.814063 0.814376 0.814688 0.815001
+0.815313 0.815626 0.815938 0.816251 0.816563 0.816876 0.817188 0.817501
+0.817813 0.818126 0.818438 0.818751 0.819063 0.819376 0.819688 0.820001
+0.820313 0.820626 0.820938 0.821251 0.821563 0.821876 0.822188 0.822501
+0.822813 0.823126 0.823438 0.823751 0.824063 0.824376 0.824688 0.825001
+0.263439 0.264376 0.265314 0.266251 0.267189 0.268126 0.269064 0.270001
+0.270939 0.271876 0.272814 0.273751 0.274689 0.275627 0.276564 0.277502
+0.278439 0.279377 0.280314 0.281252 0.282189 0.283127 0.284064 0.285002
+0.285939 0.286877 0.287814 0.288752 0.289689 0.290627 0.291564 0.292502
+0.293439 0.294377 0.295314 0.296252 0.29719 0.298127 0.299065 0.300002
+0.30094 0.301877 0.302815 0.303752 0.30469 0.305627 0.306565 0.307502
+0.30844 0.309377 0.310315 0.311252 0.31219 0.313127 0.314065 0.315002
+0.31594 0.316877 0.317815 0.318753 0.31969 0.320628 0.321565 0.322503
+0.32344 0.324378 0.325315 0.326253 0.32719 0.328128 0.329065 0.330003
+0.33094 0.331878 0.332815 0.333753 0.33469 0.335628 0.336565 0.337503
+0.33844 0.339378 0.340316 0.341253 0.342191 0.343128 0.344066 0.345003
+0.345941 0.346878 0.347816 0.348753 0.349691 0.350628 0.351566 0.352503
+0.353441 0.354378 0.355316 0.356253 0.357191 0.358128 0.359066 0.360003
+0.360941 0.361879 0.362816 0.363754 0.364691 0.365629 0.366566 0.367504
+0.368441 0.369379 0.370316 0.371254 0.372191 0.373129 0.374066 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004;
+#A 2000 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004 0.375004
+0.375004 0.375004 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
 #X coords 0 1.5 3000 0 50 20 1;
 #X restore 244 113 graph;
-#X restore 337 74 pd subtab;
-#X obj -103 246 r RouteCursor;
-#X obj 222 222 repeat 1000;
-#X obj 222 267 tabread INDEXcursor;
-#X obj 247 242 + 1;
-#X obj 224 291 sel 1;
-#X obj 247 318 + 1;
-#X obj 161 130 bng 25 250 50 0 empty empty empty 17 7 0 10 -262144
--1 -1;
-#X obj 222 572 s pd-Rcursor;
-#X obj 222 242 f;
-#X obj 222 318 f;
-#X msg 278 199 0;
-#X text 158 113 create objet;
-#X obj 222 526 pack f f f;
-#X obj 222 392 mod 10;
-#X obj 265 428 sel 1;
-#X obj 222 344 t f f;
-#X obj 265 474 f;
-#X obj 293 474 + 50;
-#X obj 250 501 f;
-#X obj 222 411 t f f b;
-#X msg 222 547 obj \$1 \$2 abs-cursor \$3;
-#X obj 252 369 + 0;
-#X obj 222 453 * 125;
-#X obj 222 181 t b b b;
-#X msg 406 198 \; pd-Rcursor clear \;;
-#X connect 0 0 9 0;
-#X connect 1 0 2 0;
-#X connect 2 0 0 0;
-#X connect 2 1 3 0;
-#X connect 3 0 8 0;
-#X connect 3 0 9 1;
+#X restore 467 74 pd subtab;
+#X obj 27 416 r RouteCursor;
+#X obj 352 297 tabread INDEXcursor;
+#X obj 384 257 + 1;
+#X obj 352 321 sel 1;
+#X obj 387 341 + 1;
+#X obj 171 130 bng 25 250 50 0 empty empty create.object 0 -7 0 10
+-262144 -1 -1;
+#X obj 352 257 f;
+#X obj 352 341 f;
+#X msg 408 199 0;
+#X obj 352 556 pack f f f;
+#X obj 352 422 mod 10;
+#X obj 395 463 sel 1;
+#X obj 352 381 t f f;
+#X obj 395 484 f;
+#X obj 423 484 + 50;
+#X obj 385 531 f;
+#X obj 352 441 t f f b;
+#X msg 352 577 obj \$1 \$2 abs-cursor \$3;
+#X obj 384 402 + 0;
+#X obj 352 483 * 125;
+#X msg 536 198 clear;
+#X obj 329 170 t b b b b;
+#X msg 329 192 loadbang;
+#X msg 352 215 1000;
+#X obj 352 237 until;
+#X obj 352 277 t f f;
+#X obj 352 361 t f f;
+#X obj 408 219 t f f f;
+#X obj 395 504 t f f;
+#X obj 352 602 s pd-\$1.Rcursor;
+#X msg 169 269 const 0;
+#X obj 169 291 s INDEXcursor;
+#X connect 0 0 1 0;
+#X connect 1 0 39 0;
+#X connect 1 1 2 0;
+#X connect 2 0 3 0;
 #X connect 4 0 6 0;
-#X connect 4 0 9 1;
 #X connect 6 0 7 0;
 #X connect 6 1 5 1;
 #X connect 7 0 5 0;
 #X connect 9 0 4 0;
-#X connect 11 0 13 0;
-#X connect 13 0 14 0;
-#X connect 13 1 12 1;
-#X connect 14 0 12 0;
-#X connect 16 0 11 0;
-#X connect 17 0 24 0;
-#X connect 18 0 20 0;
-#X connect 19 0 24 1;
-#X connect 20 0 25 0;
-#X connect 21 0 25 1;
-#X connect 22 0 39 0;
-#X connect 24 0 19 0;
-#X connect 24 0 18 0;
-#X connect 25 0 21 0;
-#X connect 25 0 31 0;
-#X connect 26 0 24 1;
-#X connect 26 0 25 1;
-#X connect 26 0 32 1;
-#X connect 28 0 36 0;
-#X connect 29 0 35 0;
-#X connect 30 0 32 0;
-#X connect 31 0 29 0;
-#X connect 31 1 37 0;
+#X connect 10 0 12 0;
+#X connect 11 0 15 1;
+#X connect 12 0 16 0;
+#X connect 13 0 16 1;
+#X connect 14 0 30 0;
+#X connect 15 0 34 0;
+#X connect 16 0 35 0;
+#X connect 17 0 36 0;
+#X connect 18 0 26 0;
+#X connect 19 0 25 0;
+#X connect 20 0 22 0;
+#X connect 21 0 19 0;
+#X connect 21 1 27 0;
+#X connect 22 0 37 0;
+#X connect 23 0 22 1;
+#X connect 24 0 18 1;
+#X connect 25 0 28 0;
+#X connect 25 1 20 0;
+#X connect 25 2 24 0;
+#X connect 26 0 38 0;
+#X connect 27 0 18 2;
+#X connect 28 0 18 0;
+#X connect 29 0 38 0;
+#X connect 30 0 31 0;
+#X connect 30 1 32 0;
+#X connect 30 2 17 0;
+#X connect 30 3 29 0;
+#X connect 31 0 38 0;
 #X connect 32 0 33 0;
-#X connect 32 0 34 1;
-#X connect 33 0 32 1;
-#X connect 34 0 28 1;
-#X connect 35 0 38 0;
-#X connect 35 1 30 0;
-#X connect 35 2 34 0;
-#X connect 36 0 23 0;
-#X connect 37 0 28 2;
-#X connect 38 0 28 0;
-#X connect 39 0 17 0;
-#X connect 39 1 26 0;
-#X connect 39 2 40 0;
+#X connect 33 0 15 0;
+#X connect 34 0 10 0;
+#X connect 34 1 11 0;
+#X connect 35 0 21 0;
+#X connect 35 1 13 0;
+#X connect 36 0 22 1;
+#X connect 36 1 16 1;
+#X connect 36 2 15 1;
+#X connect 37 0 24 1;
+#X connect 37 1 23 0;
+#X connect 39 0 40 0;
 #X coords 0 -1 1 1 160 60 1 100 100;
diff --git a/Patches/PureData/Iannix-puredata/example_sound/a-inittrig.pd b/Patches/PureData/Iannix-puredata/example_sound/a-inittrig.pd
index 07067d2..d1b267d 100644
--- a/Patches/PureData/Iannix-puredata/example_sound/a-inittrig.pd
+++ b/Patches/PureData/Iannix-puredata/example_sound/a-inittrig.pd
@@ -1,24 +1,17 @@
-#N canvas 223 99 659 675 10;
-#X obj -38 239 t b f;
-#X msg -39 264 1;
-#X obj -40 285 tabwrite INDEXtrigger;
-#X obj 105 131 bng 25 250 50 0 empty empty empty 17 7 0 10 -262144
+#N canvas 231 61 659 675 10;
+#X obj 181 459 t b f;
+#X msg 181 484 1;
+#X obj 181 505 tabwrite INDEXtrigger;
+#X obj 105 131 bng 25 250 50 0 empty empty init.tab 0 -7 0 10 -262144
 -1 -1;
-#X text 104 114 init tab;
-#X obj 105 196 t b b;
-#X msg 151 213 0;
-#X obj 130 256 + 1;
-#X obj 130 276 t b f;
-#X msg 106 293 0;
-#X obj 206 230 s INITGEN;
-#X obj 106 312 tabwrite INDEXtrigger;
-#X obj 105 235 repeat 3000;
-#X obj 105 256 f;
-#N canvas 358 502 450 300 sutab 0;
-#N canvas 0 22 450 300 (subpatch) 0;
+#X obj 105 166 t b b;
+#X msg 212 190 0;
+#X obj 212 210 s INITGEN;
+#N canvas 362 452 450 300 sutab 0;
+#N canvas 4 50 450 300 (subpatch) 0;
 #X array INDEXtrigger 3000 float 3;
-#A 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+#A 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
+1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
@@ -77,8 +70,8 @@
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
-#A 2000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
-1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+#A 2000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
@@ -109,78 +102,86 @@
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
 #X coords 0 1 3000 -1 50 20 1;
 #X restore 235 107 graph;
-#X restore 334 57 pd sutab;
-#X obj 335 257 + 1;
-#X obj 310 302 sel 1;
-#X obj 335 329 + 1;
-#X obj 164 131 bng 25 250 50 0 empty empty empty 17 7 0 10 -262144
--1 -1;
-#X obj 310 279 tabread INDEXtrigger;
-#X obj 310 237 repeat 3000;
-#X obj 309 578 s pd-Rtrigger;
-#X obj 341 377 + 2000;
-#X obj 310 257 f;
-#X obj 310 329 f;
-#X msg 380 206 0;
-#X text 161 113 create objet;
-#X obj 311 534 pack f f f;
-#X obj 311 400 mod 10;
-#X obj 354 436 sel 1;
-#X obj 311 352 t f f;
-#X obj 354 482 f;
-#X obj 382 482 + 50;
-#X obj 339 509 f;
-#X obj 311 419 t f f b;
-#X msg 310 558 obj \$1 \$2 abs-trigger \$3;
-#X obj 311 461 * 110;
-#X obj -38 216 r RouteTrigger;
-#X obj 310 189 t b b b;
-#X msg 416 208 \; pd-Rtrigger clear \;;
+#X restore 434 57 pd sutab;
+#X obj 442 237 + 1;
+#X obj 410 302 sel 1;
+#X obj 442 328 + 1;
+#X obj 164 131 bng 25 250 50 0 empty empty create.object 0 -7 0 10
+-262144 -1 -1;
+#X obj 410 279 tabread INDEXtrigger;
+#X obj 410 237 f;
+#X obj 410 329 f;
+#X msg 480 166 0;
+#X obj 410 587 pack f f f;
+#X obj 410 419 mod 10;
+#X obj 433 464 sel 1;
+#X obj 410 375 t f f;
+#X obj 453 505 f;
+#X obj 481 505 + 50;
+#X obj 438 562 f;
+#X obj 410 442 t f f b;
+#X msg 410 608 obj \$1 \$2 abs-trigger \$3;
+#X obj 410 484 * 110;
+#X obj 181 436 r RouteTrigger;
+#X msg 538 209 clear;
+#X obj 390 149 t b b b b;
+#X msg 390 171 loadbang;
+#X obj 105 210 s INDEXtrigger;
+#X msg 105 190 const 0;
+#X obj 410 193 i 3000;
+#X obj 410 214 until;
+#X obj 410 257 t f f;
+#X obj 410 351 t f f;
+#X obj 453 526 t f f;
+#X obj 470 186 t a a a;
+#X obj 390 628 s pd-\$1.Rtrigger;
+#X obj 442 395 + 0;
 #X connect 0 0 1 0;
 #X connect 0 1 2 1;
 #X connect 1 0 2 0;
-#X connect 3 0 5 0;
-#X connect 5 0 12 0;
-#X connect 5 1 6 0;
-#X connect 6 0 10 0;
-#X connect 6 0 13 1;
-#X connect 7 0 8 0;
-#X connect 7 0 13 1;
-#X connect 8 0 9 0;
-#X connect 8 1 11 1;
-#X connect 9 0 11 0;
-#X connect 12 0 13 0;
-#X connect 13 0 7 0;
-#X connect 15 0 23 1;
+#X connect 3 0 4 0;
+#X connect 4 0 31 0;
+#X connect 4 1 5 0;
+#X connect 5 0 6 0;
+#X connect 8 0 13 1;
+#X connect 9 0 14 0;
+#X connect 10 0 14 1;
+#X connect 11 0 28 0;
+#X connect 12 0 9 0;
+#X connect 13 0 34 0;
+#X connect 14 0 35 0;
+#X connect 15 0 37 0;
 #X connect 16 0 24 0;
-#X connect 17 0 24 1;
-#X connect 18 0 38 0;
-#X connect 19 0 16 0;
-#X connect 20 0 23 0;
-#X connect 22 0 27 2;
-#X connect 23 0 15 0;
-#X connect 23 0 19 0;
-#X connect 24 0 17 0;
-#X connect 24 0 30 0;
-#X connect 25 0 23 1;
-#X connect 25 0 24 1;
-#X connect 25 0 31 1;
-#X connect 27 0 35 0;
-#X connect 28 0 34 0;
-#X connect 29 0 31 0;
-#X connect 30 0 28 0;
-#X connect 30 1 22 0;
-#X connect 31 0 32 0;
-#X connect 31 0 33 1;
-#X connect 32 0 31 1;
-#X connect 33 0 27 1;
-#X connect 34 0 36 0;
-#X connect 34 1 29 0;
-#X connect 34 2 33 0;
-#X connect 35 0 21 0;
-#X connect 36 0 27 0;
-#X connect 37 0 0 0;
-#X connect 38 0 20 0;
-#X connect 38 1 25 0;
-#X connect 38 2 39 0;
+#X connect 17 0 23 0;
+#X connect 18 0 20 0;
+#X connect 19 0 17 0;
+#X connect 19 1 39 0;
+#X connect 20 0 36 0;
+#X connect 21 0 20 1;
+#X connect 22 0 16 1;
+#X connect 23 0 25 0;
+#X connect 23 1 18 0;
+#X connect 23 2 22 0;
+#X connect 24 0 38 0;
+#X connect 25 0 16 0;
+#X connect 26 0 0 0;
+#X connect 27 0 38 0;
+#X connect 28 0 29 0;
+#X connect 28 1 32 0;
+#X connect 28 2 15 0;
+#X connect 28 3 27 0;
+#X connect 29 0 38 0;
+#X connect 31 0 30 0;
+#X connect 32 0 33 0;
+#X connect 33 0 13 0;
+#X connect 34 0 12 0;
+#X connect 34 1 8 0;
+#X connect 35 0 19 0;
+#X connect 35 1 10 0;
+#X connect 36 0 22 1;
+#X connect 36 1 21 0;
+#X connect 37 0 20 1;
+#X connect 37 1 14 1;
+#X connect 37 2 13 1;
+#X connect 39 0 16 2;
 #X coords 0 -1 1 1 160 60 1 100 100;
diff --git a/Patches/PureData/Iannix-puredata/example_sound/a-udp.pd b/Patches/PureData/Iannix-puredata/example_sound/a-udp.pd
index 2e81d84..930eeea 100644
--- a/Patches/PureData/Iannix-puredata/example_sound/a-udp.pd
+++ b/Patches/PureData/Iannix-puredata/example_sound/a-udp.pd
@@ -1,76 +1,90 @@
-#N canvas 240 58 960 669 10;
-#X declare -lib mrpeach;
-#X obj 121 -135 import mrpeach;
-#X obj 307 -67 inlet;
-#X obj 437 -67 inlet;
-#X msg 437 -18 /iannix/stop;
-#X obj 437 -43 route 0;
-#X msg 525 -18 /iannix/play \$1;
-#X obj 637 -67 inlet;
-#X obj 306 139 route /trigger /cursor /curve /transport;
-#X obj 307 15 packOSC;
-#X obj 321 -175 loadbang;
-#X obj 306 117 unpackOSC;
-#X obj 307 58 udpsend;
-#X obj 307 36 prepend send;
-#X obj 261 -129 pack s f;
-#X obj 321 -150 f \$2;
-#X obj 261 -150 symbol \$1;
-#X msg 261 -106 connect \$1 \$2;
-#X obj 306 272 outlet;
-#X obj 365 272 outlet;
-#X obj 424 272 outlet;
-#X obj 483 205 route play stop fastrewind;
-#X msg 483 225 1;
-#X msg 534 225 0;
-#X obj 585 250 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
+#N canvas 245 49 960 669 10;
+#X obj 317 83 inlet;
+#X obj 447 83 inlet;
+#X msg 447 132 /iannix/stop;
+#X obj 447 107 route 0;
+#X msg 535 132 /iannix/play \$1;
+#X obj 647 83 inlet;
+#X obj 211 75 loadbang;
+#X obj 141 121 pack s f;
+#X obj 211 100 f \$2;
+#X obj 141 100 symbol \$1;
+#X msg 141 144 connect \$1 \$2;
+#X obj 307 512 outlet;
+#X obj 366 512 outlet;
+#X obj 425 512 outlet;
+#X obj 484 445 route play stop fastrewind;
+#X msg 484 465 1;
+#X msg 535 465 0;
+#X obj 586 490 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
 -1 -1;
-#X obj 506 251 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
+#X obj 507 491 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
 1;
-#X obj 506 272 outlet;
-#X obj 585 272 outlet;
-#X obj 735 272 outlet;
-#X obj 777 272 outlet;
-#X obj 819 272 outlet;
-#X msg 637 -18 /iannix/fastrewind;
-#X msg 483 184 \$1;
-#X obj 635 272 outlet;
-#X obj 685 272 outlet;
-#X obj 483 163 unpack s f s f f f;
-#X obj 306 95 udpreceive \$3;
-#X connect 1 0 8 0;
-#X connect 2 0 4 0;
-#X connect 3 0 8 0;
-#X connect 4 0 3 0;
-#X connect 4 1 5 0;
-#X connect 5 0 8 0;
-#X connect 6 0 30 0;
-#X connect 7 0 17 0;
-#X connect 7 1 18 0;
-#X connect 7 2 19 0;
-#X connect 7 3 34 0;
-#X connect 8 0 12 0;
-#X connect 9 0 14 0;
-#X connect 9 0 15 0;
-#X connect 10 0 7 0;
-#X connect 12 0 11 0;
-#X connect 13 0 16 0;
-#X connect 14 0 13 1;
-#X connect 15 0 13 0;
-#X connect 16 0 11 0;
-#X connect 20 0 21 0;
-#X connect 20 1 22 0;
-#X connect 20 2 23 0;
-#X connect 21 0 24 0;
-#X connect 22 0 24 0;
-#X connect 23 0 26 0;
-#X connect 24 0 25 0;
-#X connect 30 0 8 0;
-#X connect 31 0 20 0;
-#X connect 34 0 31 0;
-#X connect 34 1 32 0;
-#X connect 34 2 33 0;
-#X connect 34 3 27 0;
-#X connect 34 4 28 0;
-#X connect 34 5 29 0;
-#X connect 35 0 10 0;
+#X obj 507 512 outlet;
+#X obj 586 512 outlet;
+#X obj 735 492 outlet;
+#X obj 777 492 outlet;
+#X obj 819 492 outlet;
+#X msg 647 132 /iannix/fastrewind;
+#X msg 484 424 \$1;
+#X obj 636 512 outlet;
+#X obj 685 492 outlet;
+#X obj 484 403 unpack s f s f f f;
+#X obj 488 298 netsend -u -b;
+#X obj 488 256 list prepend send;
+#X obj 488 277 list trim;
+#X obj 307 305 netreceive -u -b \$3;
+#X obj 307 327 oscparse;
+#X obj 307 379 route trigger cursor curve transport;
+#X obj 448 160 route send;
+#X obj 448 204 list split 1;
+#X obj 566 207 symbol;
+#X obj 488 229 oscformat;
+#X msg 566 229 set \$1;
+#X obj 448 182 t a a;
+#X obj 307 353 list trim;
+#X connect 0 0 35 0;
+#X connect 1 0 3 0;
+#X connect 2 0 35 0;
+#X connect 3 0 2 0;
+#X connect 3 1 4 0;
+#X connect 4 0 35 0;
+#X connect 5 0 24 0;
+#X connect 6 0 8 0;
+#X connect 6 0 9 0;
+#X connect 7 0 10 0;
+#X connect 8 0 7 1;
+#X connect 9 0 7 0;
+#X connect 10 0 29 0;
+#X connect 14 0 15 0;
+#X connect 14 1 16 0;
+#X connect 14 2 17 0;
+#X connect 15 0 18 0;
+#X connect 16 0 18 0;
+#X connect 17 0 20 0;
+#X connect 18 0 19 0;
+#X connect 24 0 35 0;
+#X connect 25 0 14 0;
+#X connect 28 0 25 0;
+#X connect 28 1 26 0;
+#X connect 28 2 27 0;
+#X connect 28 3 21 0;
+#X connect 28 4 22 0;
+#X connect 28 5 23 0;
+#X connect 30 0 31 0;
+#X connect 31 0 29 0;
+#X connect 32 0 33 0;
+#X connect 33 0 41 0;
+#X connect 34 0 11 0;
+#X connect 34 1 12 0;
+#X connect 34 2 13 0;
+#X connect 34 3 28 0;
+#X connect 35 0 40 0;
+#X connect 35 1 40 0;
+#X connect 36 1 38 0;
+#X connect 37 0 39 0;
+#X connect 38 0 30 0;
+#X connect 39 0 38 0;
+#X connect 40 0 36 0;
+#X connect 40 1 37 0;
+#X connect 41 0 34 0;
diff --git a/Patches/PureData/Iannix-puredata/example_sound/abs-cursor.pd b/Patches/PureData/Iannix-puredata/example_sound/abs-cursor.pd
index 66f9c27..5f9f020 100644
--- a/Patches/PureData/Iannix-puredata/example_sound/abs-cursor.pd
+++ b/Patches/PureData/Iannix-puredata/example_sound/abs-cursor.pd
@@ -1,8 +1,7 @@
-#N canvas 535 99 574 627 10;
+#N canvas 536 95 574 627 10;
 #X obj 20 142 outlet;
 #X obj 48 169 outlet;
-#X obj 263 5 initbang;
-#X obj 319 22 loadbang;
+#X obj 383 21 loadbang;
 #X obj 104 37 route \$1;
 #X obj 78 194 outlet;
 #X obj 217 433 *~ 2;
@@ -31,41 +30,41 @@
 #X obj 266 389 phasor~;
 #X obj 209 388 osc~;
 #X obj 256 331 * 2;
-#X connect 2 0 13 0;
-#X connect 2 0 15 0;
-#X connect 3 0 13 0;
-#X connect 3 0 15 0;
-#X connect 4 0 23 0;
-#X connect 6 0 7 0;
-#X connect 7 0 14 0;
-#X connect 8 0 18 0;
-#X connect 8 0 20 0;
-#X connect 9 0 8 1;
-#X connect 10 0 9 0;
-#X connect 12 0 30 0;
-#X connect 13 0 10 0;
-#X connect 14 0 8 0;
-#X connect 15 0 8 2;
-#X connect 16 0 17 0;
-#X connect 17 0 18 1;
-#X connect 18 0 11 0;
-#X connect 20 0 19 0;
-#X connect 21 0 28 0;
-#X connect 22 0 21 1;
-#X connect 23 1 24 0;
-#X connect 23 2 25 0;
-#X connect 23 3 26 0;
-#X connect 24 0 0 0;
-#X connect 24 1 12 0;
-#X connect 24 1 16 0;
-#X connect 24 1 20 1;
-#X connect 25 0 1 0;
-#X connect 25 1 21 0;
-#X connect 26 0 5 0;
-#X connect 26 1 31 0;
-#X connect 27 0 4 0;
-#X connect 28 0 14 1;
-#X connect 29 0 7 1;
-#X connect 30 0 6 0;
-#X connect 31 0 29 0;
+#X obj 373 41 t a a;
+#X connect 2 0 31 0;
+#X connect 3 0 22 0;
+#X connect 5 0 6 0;
+#X connect 6 0 13 0;
+#X connect 7 0 17 0;
+#X connect 7 0 19 0;
+#X connect 8 0 7 1;
+#X connect 9 0 8 0;
+#X connect 11 0 29 0;
+#X connect 12 0 9 0;
+#X connect 13 0 7 0;
+#X connect 14 0 7 2;
+#X connect 15 0 16 0;
+#X connect 16 0 17 1;
+#X connect 17 0 10 0;
+#X connect 19 0 18 0;
+#X connect 20 0 27 0;
+#X connect 21 0 20 1;
+#X connect 22 1 23 0;
+#X connect 22 2 24 0;
+#X connect 22 3 25 0;
+#X connect 23 0 0 0;
+#X connect 23 1 11 0;
+#X connect 23 1 15 0;
+#X connect 23 1 19 1;
+#X connect 24 0 1 0;
+#X connect 24 1 20 0;
+#X connect 25 0 4 0;
+#X connect 25 1 30 0;
+#X connect 26 0 3 0;
+#X connect 27 0 13 1;
+#X connect 28 0 6 1;
+#X connect 29 0 5 0;
+#X connect 30 0 28 0;
+#X connect 31 0 14 0;
+#X connect 31 1 12 0;
 #X coords 0 627 1 626 120 35 0;
diff --git a/Patches/PureData/Iannix-puredata/example_sound/abs-trigger.pd b/Patches/PureData/Iannix-puredata/example_sound/abs-trigger.pd
index 2d7399e..a8eb027 100644
--- a/Patches/PureData/Iannix-puredata/example_sound/abs-trigger.pd
+++ b/Patches/PureData/Iannix-puredata/example_sound/abs-trigger.pd
@@ -1,4 +1,4 @@
-#N canvas 598 181 574 627 10;
+#N canvas 599 137 574 627 10;
 #X obj 25 193 outlet;
 #X obj 73 205 outlet;
 #X obj 101 38 route \$1;
@@ -7,11 +7,10 @@
 #X obj 280 361 throw~ dac1;
 #X obj 366 363 throw~ dac2;
 #X obj 100 60 unpack s f f f f f f f;
-#X floatatom 228 119 3 0 0 0 - - -;
-#X floatatom 252 119 3 0 0 0 - - -;
-#X floatatom 278 119 3 0 0 0 - - -;
-#X floatatom 332 151 3 0 0 0 - - -;
-#X obj 358 197 ead~;
+#X floatatom 228 119 3 0 0 0 - - -, f 3;
+#X floatatom 252 119 3 0 0 0 - - -, f 3;
+#X floatatom 278 119 3 0 0 0 - - -, f 3;
+#X floatatom 332 151 3 0 0 0 - - -, f 3;
 #X obj 338 263 *~;
 #X obj 368 166 * 100;
 #X obj 409 164 * 100;
@@ -25,26 +24,31 @@
 #X text 117 157 Z;
 #X obj 331 128 t a b;
 #X text 265 153 nbr cursor;
+#X msg 369 213 0 \, \$1 \$2 \, 0 \$3 \$2;
+#X obj 369 235 vline~;
+#X obj 369 191 pack 1 0 0;
 #X connect 2 0 7 0;
 #X connect 4 0 2 0;
-#X connect 7 1 17 0;
-#X connect 7 2 19 0;
-#X connect 7 3 21 0;
+#X connect 7 1 16 0;
+#X connect 7 2 18 0;
+#X connect 7 3 20 0;
 #X connect 7 4 8 0;
 #X connect 7 5 9 0;
 #X connect 7 6 10 0;
-#X connect 7 7 24 0;
-#X connect 12 0 13 1;
-#X connect 13 0 6 0;
-#X connect 13 0 5 0;
-#X connect 14 0 12 1;
-#X connect 15 0 12 2;
-#X connect 16 0 13 0;
-#X connect 17 0 0 0;
-#X connect 17 1 14 0;
-#X connect 19 0 1 0;
-#X connect 19 1 15 0;
-#X connect 21 0 3 0;
-#X connect 24 0 11 0;
-#X connect 24 1 12 0;
+#X connect 7 7 23 0;
+#X connect 12 0 6 0;
+#X connect 12 0 5 0;
+#X connect 13 0 27 1;
+#X connect 14 0 27 2;
+#X connect 15 0 12 0;
+#X connect 16 0 0 0;
+#X connect 16 1 13 0;
+#X connect 18 0 1 0;
+#X connect 18 1 14 0;
+#X connect 20 0 3 0;
+#X connect 23 0 11 0;
+#X connect 23 1 27 0;
+#X connect 25 0 26 0;
+#X connect 26 0 12 1;
+#X connect 27 0 25 0;
 #X coords 0 0 1 1 110 35 0;
diff --git a/Patches/PureData/Iannix-puredata/example_sound/main.pd b/Patches/PureData/Iannix-puredata/example_sound/main.pd
index ec4d255..40de08c 100644
--- a/Patches/PureData/Iannix-puredata/example_sound/main.pd
+++ b/Patches/PureData/Iannix-puredata/example_sound/main.pd
@@ -1,122 +1,71 @@
-#N canvas 728 22 566 489 10;
-#X declare -lib mrpeach;
-#N canvas 53 38 1285 596 Rcursor 0;
-#X obj 0 50 abs-cursor 0;
-#X obj 125 50 abs-cursor 1;
-#X obj 250 0 abs-cursor 2;
-#X obj 375 0 abs-cursor 3;
-#X obj 500 0 abs-cursor 4;
-#X obj 625 0 abs-cursor 5;
-#X restore -92 25 pd Rcursor;
-#X obj 249 -21 dac~;
-#X obj 246 -139 catch~ dac1;
-#X obj 248 -50 vols~;
-#X floatatom 330 -65 5 0 0 0 - - -;
-#X obj 261 -113 catch~ dac2;
-#X obj 373 -59 s varPhas;
-#X floatatom 374 -83 5 0 0 0 - - -;
-#X text -95 60 this example shows how you can generate in dynamic patching
+#N canvas 732 49 625 541 10;
+#X obj 379 259 dac~;
+#X obj 377 141 catch~ dac1;
+#X obj 409 167 catch~ dac2;
+#X obj 503 171 s varPhas;
+#X floatatom 504 147 5 0 0 0 - - -, f 5;
+#X text 35 340 this example shows how you can generate in dynamic patching
 an additive synthese;
-#X text -58 -271 Set IanniX score speed;
-#X floatatom -94 -272 5 0 0 0 - - -;
-#X msg -94 -252 /iannix/speed \$1;
-#X obj -77 -116 s RouteCursor;
-#X obj -60 -136 s RouteCurve;
-#X obj -94 -96 s RouteTrigger;
-#X obj -18 -204 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1
-0 1;
-#X text -2 -205 Play / pause;
-#X obj 99 -240 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
+#X text 72 9 Set IanniX score speed;
+#X floatatom 36 8 5 0 0 0 - - -, f 5;
+#X msg 36 28 /iannix/speed \$1;
+#X obj 53 164 s RouteCursor;
+#X obj 70 144 s RouteCurve;
+#X obj 36 184 s RouteTrigger;
+#X obj 112 76 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
 1;
-#X text 114 -241 Score played / paused;
-#X msg -18 -225 set \$1;
-#X floatatom 59 -157 5 0 0 0 - - -;
-#X floatatom 42 -139 5 0 0 0 - - -;
-#X floatatom 25 -121 5 0 0 0 - - -;
-#X obj -96 -38 a-initcursor;
-#X obj -94 -177 a-udp 127.0.0.1 1234 57120;
-#X text -97 48 sound example;
-#X obj 69 -39 a-inittrig;
-#N canvas 0 22 1137 239 Rtrigger 0;
-#X obj 0 250 abs-trigger 2000;
-#X obj 110 250 abs-trigger 2001;
-#X obj 220 0 abs-trigger 2002;
-#X obj 330 0 abs-trigger 2003;
-#X obj 440 0 abs-trigger 2004;
-#X obj 550 0 abs-trigger 2005;
-#X obj 660 0 abs-trigger 2006;
-#X obj 770 0 abs-trigger 2007;
-#X obj 880 0 abs-trigger 2008;
-#X obj 990 0 abs-trigger 2009;
-#X obj 0 0 abs-trigger 2010;
-#X obj 110 0 abs-trigger 2011;
-#X obj 220 50 abs-trigger 2012;
-#X obj 330 50 abs-trigger 2013;
-#X obj 440 50 abs-trigger 2014;
-#X obj 550 50 abs-trigger 2015;
-#X obj 660 50 abs-trigger 2016;
-#X obj 770 50 abs-trigger 2017;
-#X obj 880 50 abs-trigger 2018;
-#X obj 990 50 abs-trigger 2019;
-#X obj 0 50 abs-trigger 2020;
-#X obj 110 50 abs-trigger 2021;
-#X obj 220 100 abs-trigger 2022;
-#X obj 330 100 abs-trigger 2023;
-#X obj 440 100 abs-trigger 2024;
-#X obj 550 100 abs-trigger 2025;
-#X obj 660 100 abs-trigger 2026;
-#X obj 770 100 abs-trigger 2027;
-#X obj 880 100 abs-trigger 2028;
-#X obj 990 100 abs-trigger 2029;
-#X obj 0 100 abs-trigger 2030;
-#X obj 110 100 abs-trigger 2031;
-#X obj 220 150 abs-trigger 2032;
-#X obj 330 150 abs-trigger 2033;
-#X obj 440 150 abs-trigger 2034;
-#X obj 550 150 abs-trigger 2035;
-#X obj 660 150 abs-trigger 2036;
-#X obj 770 150 abs-trigger 2037;
-#X obj 880 150 abs-trigger 2038;
-#X obj 990 150 abs-trigger 2039;
-#X obj 0 150 abs-trigger 2040;
-#X obj 110 150 abs-trigger 2041;
-#X obj 220 200 abs-trigger 2042;
-#X obj 330 200 abs-trigger 2043;
-#X obj 440 200 abs-trigger 2044;
-#X obj 550 200 abs-trigger 2045;
-#X obj 660 200 abs-trigger 2046;
-#X obj 770 200 abs-trigger 2047;
-#X obj 880 200 abs-trigger 2048;
-#X obj 990 200 abs-trigger 2049;
-#X obj 0 200 abs-trigger 2050;
-#X obj 110 200 abs-trigger 2051;
-#X obj 220 250 abs-trigger 2052;
-#X obj 330 250 abs-trigger 2053;
-#X obj 440 250 abs-trigger 2054;
-#X obj 550 250 abs-trigger 2055;
-#X obj 660 250 abs-trigger 2056;
-#X restore 69 23 pd Rtrigger;
-#X text -94 149 4/ open [pd Rcursor] or [Rtrigger] to see the abstractions
+#X text 128 75 Play / pause;
+#X obj 229 40 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
+1;
+#X text 244 39 Score played / paused;
+#X msg 112 55 set \$1;
+#X floatatom 189 123 5 0 0 0 - - -, f 5;
+#X floatatom 172 141 5 0 0 0 - - -, f 5;
+#X floatatom 155 159 5 0 0 0 - - -, f 5;
+#X obj 36 103 a-udp 127.0.0.1 1234 57120;
+#X text 33 328 sound example;
+#X text 36 429 4/ open [pd Rcursor] or [Rtrigger] to see the abstractions
 or to modify;
-#X text -95 92 1/ open a ianniX score and play it.;
-#X text -95 107 2/ click init tab for cursor and trigger to dump number
+#X text 35 372 1/ open a ianniX score and play it.;
+#X text 35 387 2/ click init tab for cursor and trigger to dump number
 of elements;
-#X text -93 134 3/ create object for cursor and trigger.;
-#X text -91 209 created by philippe boisnard;
-#X connect 2 0 3 0;
-#X connect 3 0 1 0;
-#X connect 3 1 1 1;
-#X connect 4 0 3 2;
-#X connect 5 0 3 1;
-#X connect 7 0 6 0;
-#X connect 10 0 11 0;
-#X connect 11 0 24 0;
-#X connect 15 0 24 1;
-#X connect 17 0 19 0;
-#X connect 19 0 15 0;
-#X connect 24 0 14 0;
-#X connect 24 1 12 0;
-#X connect 24 2 13 0;
-#X connect 24 7 22 0;
-#X connect 24 8 21 0;
-#X connect 24 9 20 0;
+#X text 37 414 3/ create object for cursor and trigger.;
+#X text 39 489 created by philippe boisnard;
+#X obj 470 204 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 -262144
+-1 -1 4400 1;
+#X obj 467 224 dbtorms;
+#X obj 467 246 pack 0 50;
+#X obj 467 268 line~;
+#X obj 378 230 *~;
+#X obj 408 230 *~;
+#X obj 240 83 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
+-1;
+#N canvas 68 49 1285 596 \$0.Rcursor 0;
+#X restore 38 305 pd \$0.Rcursor;
+#N canvas 14 49 1137 239 \$0.Rtrigger 0;
+#X restore 199 303 pd \$0.Rtrigger;
+#X obj 34 242 a-initcursor \$0;
+#X obj 199 241 a-inittrig \$0;
+#X connect 1 0 31 0;
+#X connect 2 0 32 0;
+#X connect 4 0 3 0;
+#X connect 7 0 8 0;
+#X connect 8 0 20 0;
+#X connect 12 0 20 1;
+#X connect 14 0 16 0;
+#X connect 16 0 12 0;
+#X connect 20 0 11 0;
+#X connect 20 1 9 0;
+#X connect 20 2 10 0;
+#X connect 20 3 14 0;
+#X connect 20 7 19 0;
+#X connect 20 8 18 0;
+#X connect 20 9 17 0;
+#X connect 27 0 28 0;
+#X connect 28 0 29 0;
+#X connect 29 0 30 0;
+#X connect 30 0 31 1;
+#X connect 30 0 32 1;
+#X connect 31 0 0 0;
+#X connect 32 0 0 1;
+#X connect 33 0 20 2;
diff --git a/Patches/PureData/PureData Example.pd b/Patches/PureData/PureData Example.pd
index 57ae9fe..3bdf5dc 100644
--- a/Patches/PureData/PureData Example.pd	
+++ b/Patches/PureData/PureData Example.pd	
@@ -1,12 +1,8 @@
-#N canvas 701 236 921 483 10;
-#X declare -lib OSC;
-#X declare -lib mrpeach;
-#X obj 273 34 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
-1;
-#X obj 353 33 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
--1;
-#X text 373 33 Fastrewind;
-#X text 192 34 Play / pause;
+#N canvas 267 222 1011 483 10;
+#X obj 287 34 tgl 15 0 empty empty play/pause 17 7 0 10 -262144 -1
+-1 0 1;
+#X obj 380 33 bng 15 250 50 0 empty empty fast.rewind 17 7 0 10 -262144
+-1 -1;
 #X obj 247 241 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
 1;
 #X obj 264 210 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
@@ -14,226 +10,123 @@
 #X text 283 209 Score rewinded;
 #X text 262 240 Score played / paused;
 #X msg 247 9 set \$1;
-#X floatatom 317 113 5 0 0 0 - - -;
-#X floatatom 335 113 5 0 0 0 - - -;
-#X floatatom 353 113 5 0 0 0 - - -;
-#X text 390 112 Number of triggers / cursors / curves;
-#X text 34 9 Set IanniX score speed;
-#X floatatom 37 27 5 0 0 0 - - -;
-#X text 509 314 - no argument : outputs all objects (no filtering)
-;
-#X text 509 327 - one argument : only outputs object with desired ID
-(use 0 to disable ID filtering);
-#X text 428 297 Inlet #2 : desired ID (see arguments);
-#X text 25 293 Triggers fired;
-#X text 131 293 Cursors coords;
-#X text 234 292 Curves intersections;
-#X text 428 357 Outlets : (1) unique ID \, (2) group ID \,;
-#X text 488 369 (3-4-5) mapped X coord \, Y coord \, Z coord \,;
-#X text 488 381 (6-7-8) absolute X coord \, Y coord \, Z coord \,;
-#X text 488 394 (9-10) (triggers only) curve Unique ID \, curve group
-ID \,;
-#X text 488 407 (11) packed data as a list;
-#X obj 118 338 send cursors;
-#X obj 229 335 send curves;
-#X obj 9 334 send triggers;
-#X floatatom 282 165 5 0 0 0 - - -;
+#X floatatom 338 103 3 0 0 0 - - -, f 3;
+#X floatatom 366 103 3 0 0 0 - - -, f 3;
+#X floatatom 394 103 3 0 0 0 - - -, f 3;
+#X text 421 102 Number of triggers / cursors / curves;
+#X floatatom 37 27 5 0 0 2 score.speed - -, f 5;
+#X text 6 325 Triggers fired;
+#X text 128 326 Cursors coords;
+#X text 244 319 Curves intersections;
+#X floatatom 297 165 5 0 0 0 - - -, f 5;
 #X text 279 182 Transport timecode;
-#X msg 321 141 set \$1;
-#X msg 321 165 00:00:00:462;
-#N canvas 164 158 696 372 subpatches 0;
-#X obj -159 -40 inlet;
-#X obj -159 -19 route 0 1 2 3 4 5 6 7 8 9;
-#X obj 1 -19 route 10 11 12 13 14 15 16 17 18 19;
-#X obj 221 -19 route 20 21 22 23 24 25 26 27 28 29;
-#X obj -150 162 route 30 31 32 33 34 35 36 37 38 39;
-#X obj 70 162 route 40 41 42 43 44 45 46 47 48 49;
-#X obj 290 162 route 50 51 52 53 54 55 56 57 58 59;
-#X obj -42 81 subpatch;
-#X obj -159 1 subpatch;
-#X obj 353 91 subpatch;
-#X obj 118 81 subpatch;
-#X obj -145 11 subpatch;
-#X obj -130 21 subpatch;
-#X obj -115 31 subpatch;
-#X obj -101 41 subpatch;
-#X obj -86 51 subpatch;
-#X obj -71 61 subpatch;
-#X obj -57 71 subpatch;
-#X obj -27 91 subpatch;
-#X obj 1 1 subpatch;
-#X obj 15 11 subpatch;
-#X obj 30 21 subpatch;
-#X obj 45 31 subpatch;
-#X obj 59 41 subpatch;
-#X obj 74 51 subpatch;
-#X obj 89 61 subpatch;
-#X obj 103 71 subpatch;
-#X obj 133 91 subpatch;
-#X obj 221 1 subpatch;
-#X obj 235 11 subpatch;
-#X obj 250 21 subpatch;
-#X obj 265 31 subpatch;
-#X obj 279 41 subpatch;
-#X obj 294 51 subpatch;
-#X obj 309 61 subpatch;
-#X obj 323 71 subpatch;
-#X obj 338 81 subpatch;
-#X obj -150 182 subpatch;
-#X obj -136 192 subpatch;
-#X obj -121 202 subpatch;
-#X obj -106 212 subpatch;
-#X obj -92 222 subpatch;
-#X obj -77 232 subpatch;
-#X obj -62 242 subpatch;
-#X obj -48 252 subpatch;
-#X obj -33 262 subpatch;
-#X obj -18 272 subpatch;
-#X obj 70 182 subpatch;
-#X obj 84 192 subpatch;
-#X obj 99 202 subpatch;
-#X obj 114 212 subpatch;
-#X obj 128 222 subpatch;
-#X obj 143 232 subpatch;
-#X obj 158 242 subpatch;
-#X obj 172 252 subpatch;
-#X obj 187 262 subpatch;
-#X obj 202 272 subpatch;
-#X obj 290 182 subpatch;
-#X obj 304 192 subpatch;
-#X obj 319 202 subpatch;
-#X obj 334 212 subpatch;
-#X obj 348 222 subpatch;
-#X obj 363 232 subpatch;
-#X obj 378 242 subpatch;
-#X obj 392 252 subpatch;
-#X obj 407 262 subpatch;
-#X obj 422 272 subpatch;
-#X connect 0 0 1 0;
-#X connect 1 0 8 0;
-#X connect 1 1 11 0;
-#X connect 1 2 12 0;
-#X connect 1 3 13 0;
-#X connect 1 4 14 0;
-#X connect 1 5 15 0;
-#X connect 1 6 16 0;
-#X connect 1 7 17 0;
-#X connect 1 8 7 0;
-#X connect 1 9 18 0;
-#X connect 1 10 2 0;
-#X connect 2 0 19 0;
-#X connect 2 1 20 0;
-#X connect 2 2 21 0;
-#X connect 2 3 22 0;
-#X connect 2 4 23 0;
-#X connect 2 5 24 0;
-#X connect 2 6 25 0;
-#X connect 2 7 26 0;
-#X connect 2 8 10 0;
-#X connect 2 9 27 0;
-#X connect 2 10 3 0;
-#X connect 3 0 28 0;
-#X connect 3 1 29 0;
-#X connect 3 2 30 0;
-#X connect 3 3 31 0;
-#X connect 3 4 32 0;
-#X connect 3 5 33 0;
-#X connect 3 6 34 0;
-#X connect 3 7 35 0;
-#X connect 3 8 36 0;
-#X connect 3 9 9 0;
-#X connect 3 10 4 0;
-#X connect 4 0 37 0;
-#X connect 4 1 38 0;
-#X connect 4 2 39 0;
-#X connect 4 3 40 0;
-#X connect 4 4 41 0;
-#X connect 4 5 42 0;
-#X connect 4 6 43 0;
-#X connect 4 7 44 0;
-#X connect 4 8 45 0;
-#X connect 4 9 46 0;
-#X connect 4 10 5 0;
-#X connect 5 0 47 0;
-#X connect 5 1 48 0;
-#X connect 5 2 49 0;
-#X connect 5 3 50 0;
-#X connect 5 4 51 0;
-#X connect 5 5 52 0;
-#X connect 5 6 53 0;
-#X connect 5 7 54 0;
-#X connect 5 8 55 0;
-#X connect 5 9 56 0;
-#X connect 5 10 6 0;
-#X connect 6 0 57 0;
-#X connect 6 1 58 0;
-#X connect 6 2 59 0;
-#X connect 6 3 60 0;
-#X connect 6 4 61 0;
-#X connect 6 5 62 0;
-#X connect 6 6 63 0;
-#X connect 6 7 64 0;
-#X connect 6 8 65 0;
-#X connect 6 9 66 0;
-#X restore 577 213 pd subpatches;
 #X obj 576 163 gemwin;
-#X msg 701 142 destroy \, reset;
+#X msg 721 142 destroy \, reset;
 #X msg 576 142 create \, 1 \, frame 25;
 #X obj 577 189 receive cursors;
-#X obj 84 387 spigot;
-#X obj 84 408 print triggers;
-#X floatatom 117 365 1 0 0 0 - - -;
-#X text 24 365 Print triggers;
-#X obj 193 388 spigot;
-#X floatatom 226 366 1 0 0 0 - - -;
-#X obj 193 409 print cursors;
-#X text 140 365 Print cursors;
-#X obj 304 388 spigot;
-#X floatatom 337 366 1 0 0 0 - - -;
-#X obj 304 409 print curves;
-#X text 251 365 Print curves;
+#X obj 249 404 spigot;
 #X text 519 143 GEM --->;
-#X obj 194 64 iannix 127.0.0.1 1234 57120;
 #X msg 37 47 send /iannix/speed \$1;
-#X obj 118 315 iannix_object;
-#X obj 574 26 declare -lib OSC;
-#X obj 574 5 declare -lib mrpeach;
-#X text 371 59 arguments : <IP where IanniX runs> <OSC port in of IanniX>
-<OSC port out of IanniX <- not working due to udpreceive changes >
-;
-#X obj 412 327 iannix_object;
-#X obj 9 313 iannix_object;
-#X obj 229 313 iannix_object;
-#X text 429 283 NO MORE WORKING / HAVE TO TEST WITH PD VANILLA;
-#X connect 0 0 51 1;
-#X connect 1 0 51 2;
-#X connect 4 0 8 0;
-#X connect 8 0 0 0;
-#X connect 14 0 52 0;
-#X connect 31 0 32 0;
-#X connect 35 0 34 0;
-#X connect 36 0 34 0;
-#X connect 37 0 33 0;
-#X connect 38 0 39 0;
-#X connect 40 0 38 1;
-#X connect 42 0 44 0;
-#X connect 43 0 42 1;
-#X connect 46 0 48 0;
-#X connect 47 0 46 1;
-#X connect 51 0 58 0;
-#X connect 51 1 53 0;
-#X connect 51 2 59 0;
-#X connect 51 3 4 0;
-#X connect 51 4 5 0;
-#X connect 51 5 29 0;
-#X connect 51 6 31 0;
-#X connect 51 7 9 0;
-#X connect 51 8 10 0;
-#X connect 51 9 11 0;
-#X connect 52 0 51 0;
-#X connect 53 10 26 0;
-#X connect 53 10 42 0;
-#X connect 58 10 28 0;
-#X connect 58 10 38 0;
-#X connect 59 10 27 0;
-#X connect 59 10 46 0;
+#X text 576 400 see also:;
+#X text 391 59 arguments : <IP where IanniX runs> <OSC port in of IanniX>
+<OSC port out of IanniX>, f 84;
+#X obj 194 64 iannix 127.0.0.1 1234 57120;
+#X obj 299 404 tgl 15 0 empty empty empty 17 7 0 10 -228856 -1 -1 0
+1;
+#X obj 249 361 t a a;
+#X obj 249 382 send curves;
+#X obj 249 424 print curves;
+#X obj 357 344 hradio 15 1 0 8 empty empty empty 0 -8 0 10 -262144
+-1 -1 0;
+#X msg 357 368 bang;
+#N canvas 6 50 645 333 triggers 0;
+#X obj 359 247 spigot;
+#X obj 239 173 iannix/filter;
+#X obj 190 100 tgl 15 0 \$0-triggers \$0-triggers empty 17 7 0 10 -228856
+-1 -1 0 1;
+#X obj 239 143 inlet;
+#X obj 327 199 t a a;
+#X floatatom 103 122 5 -1 60 1 filter - -, f 5;
+#X obj 305 112 select -1;
+#X obj 305 46 int;
+#X obj 305 68 t f f;
+#X msg 337 90 set \$1;
+#X obj 327 225 send triggers;
+#X obj 359 267 print triggers;
+#X obj 428 224 r \$0-triggers;
+#X connect 0 0 11 0;
+#X connect 1 10 4 0;
+#X connect 3 0 1 0;
+#X connect 4 0 10 0;
+#X connect 4 1 0 0;
+#X connect 5 0 7 0;
+#X connect 6 0 1 1;
+#X connect 6 1 1 1;
+#X connect 7 0 8 0;
+#X connect 8 0 6 0;
+#X connect 8 1 9 0;
+#X connect 9 0 5 0;
+#X connect 12 0 0 1;
+#X coords 0 -1 1 1 105 40 1 100 100;
+#X restore 5 343 pd triggers;
+#N canvas 5 50 645 333 cursors 0;
+#X obj 359 247 spigot;
+#X obj 190 100 tgl 15 0 \$0-cursors \$0-cursors empty 17 7 0 10 -228856
+-1 -1 0 1;
+#X obj 239 143 inlet;
+#X obj 327 199 t a a;
+#X floatatom 103 122 5 -1 60 1 filter - -, f 5;
+#X obj 305 112 select -1;
+#X obj 305 46 int;
+#X obj 305 68 t f f;
+#X msg 337 90 set \$1;
+#X obj 327 225 send cursors;
+#X obj 359 267 print cursors;
+#X obj 428 224 r \$0-cursors;
+#X obj 239 173 iannix/filter;
+#X connect 0 0 10 0;
+#X connect 2 0 12 0;
+#X connect 3 0 9 0;
+#X connect 3 1 0 0;
+#X connect 4 0 6 0;
+#X connect 5 0 12 1;
+#X connect 5 1 12 1;
+#X connect 6 0 7 0;
+#X connect 7 0 5 0;
+#X connect 7 1 8 0;
+#X connect 8 0 4 0;
+#X connect 11 0 0 1;
+#X connect 12 10 3 0;
+#X coords 0 -1 1 1 105 40 1 100 100;
+#X restore 129 343 pd cursors;
+#X obj 577 212 clone 99 subpatch;
+#X obj 647 400 iannix/filter;
+#X obj 249 341 iannix/filter;
+#X obj 648 428 iannix, f 13;
+#X symbolatom 318 151 12 0 0 0 - - -, f 12;
+#X connect 0 0 26 1;
+#X connect 1 0 26 2;
+#X connect 2 0 6 0;
+#X connect 6 0 0 0;
+#X connect 11 0 23 0;
+#X connect 18 0 17 0;
+#X connect 19 0 17 0;
+#X connect 20 0 35 0;
+#X connect 21 0 30 0;
+#X connect 23 0 26 0;
+#X connect 26 0 33 0;
+#X connect 26 1 34 0;
+#X connect 26 2 37 0;
+#X connect 26 3 2 0;
+#X connect 26 4 3 0;
+#X connect 26 5 15 0;
+#X connect 26 6 39 0;
+#X connect 26 7 7 0;
+#X connect 26 8 8 0;
+#X connect 26 9 9 0;
+#X connect 27 0 21 1;
+#X connect 28 0 29 0;
+#X connect 28 1 21 0;
+#X connect 31 0 37 1;
+#X connect 32 0 37 1;
+#X connect 37 10 28 0;
diff --git a/Patches/PureData/Readme.txt b/Patches/PureData/Readme.txt
old mode 100755
new mode 100644
index 4159731..3ce6100
--- a/Patches/PureData/Readme.txt
+++ b/Patches/PureData/Readme.txt
@@ -1,11 +1,13 @@
 /*
     All the files of this directory are part of IanniX, a graphical real-time open-source sequencer for digital art
     Copyright (C) 2010-2015 — IanniX Association
+    Copyright (C) 2017 — IOhannes m zmölnig
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
-    These files were written by Guillaume Jacquemin and Alexandros Drymonitis.
+    These files were written by Guillaume Jacquemin, Alexandros Drymonitis
+    and IOhannes m zmölnig.
 
     IanniX is a free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -24,4 +26,4 @@
 Pure Data
 ----------
 - Open any IanniX score
-- Play and have a look with GEM or print messages
\ No newline at end of file
+- Play and have a look with GEM or print messages
diff --git a/Patches/PureData/iannix.pd b/Patches/PureData/iannix.pd
deleted file mode 100644
index 017eeb3..0000000
--- a/Patches/PureData/iannix.pd
+++ /dev/null
@@ -1,72 +0,0 @@
-#N canvas 652 81 660 477 10;
-#X obj 65 44 inlet;
-#X obj 188 14 inlet;
-#X obj 188 38 route 0;
-#X obj 448 14 inlet;
-#X obj 64 200 route /trigger /cursor /curve /transport;
-#X obj 65 96 packOSC;
-#X obj 19 -64 loadbang;
-#X obj 64 178 unpackOSC;
-#X obj 65 119 udpsend;
-#X obj 19 -18 pack s f;
-#X obj 79 -39 f \$2;
-#X obj 19 -39 symbol \$1;
-#X msg 19 5 connect \$1 \$2;
-#X obj 64 333 outlet;
-#X obj 123 333 outlet;
-#X obj 182 333 outlet;
-#X obj 241 266 route play stop fastrewind;
-#X msg 241 286 1;
-#X msg 292 286 0;
-#X obj 343 311 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
--1 -1;
-#X obj 264 312 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
-1;
-#X obj 264 333 outlet;
-#X obj 343 333 outlet;
-#X obj 493 333 outlet;
-#X obj 535 333 outlet;
-#X obj 577 333 outlet;
-#X msg 241 245 \$1;
-#X obj 393 333 outlet;
-#X obj 443 333 outlet;
-#X obj 241 224 unpack s f s f f f;
-#X msg 188 63 send /iannix/stop;
-#X msg 316 63 send /iannix/play \$1;
-#X msg 448 63 send /iannix/fastrewind;
-#X obj 64 156 udpreceive 57120;
-#X connect 0 0 5 0;
-#X connect 1 0 2 0;
-#X connect 2 0 30 0;
-#X connect 2 1 31 0;
-#X connect 3 0 32 0;
-#X connect 4 0 13 0;
-#X connect 4 1 14 0;
-#X connect 4 2 15 0;
-#X connect 4 3 29 0;
-#X connect 5 0 8 0;
-#X connect 6 0 10 0;
-#X connect 6 0 11 0;
-#X connect 7 0 4 0;
-#X connect 9 0 12 0;
-#X connect 10 0 9 1;
-#X connect 11 0 9 0;
-#X connect 12 0 8 0;
-#X connect 16 0 17 0;
-#X connect 16 1 18 0;
-#X connect 16 2 19 0;
-#X connect 17 0 20 0;
-#X connect 18 0 20 0;
-#X connect 19 0 22 0;
-#X connect 20 0 21 0;
-#X connect 26 0 16 0;
-#X connect 29 0 26 0;
-#X connect 29 1 27 0;
-#X connect 29 2 28 0;
-#X connect 29 3 23 0;
-#X connect 29 4 24 0;
-#X connect 29 5 25 0;
-#X connect 30 0 5 0;
-#X connect 31 0 5 0;
-#X connect 32 0 5 0;
-#X connect 33 0 7 0;
diff --git a/Patches/PureData/iannix/filter-help.pd b/Patches/PureData/iannix/filter-help.pd
new file mode 100644
index 0000000..d71065a
--- /dev/null
+++ b/Patches/PureData/iannix/filter-help.pd
@@ -0,0 +1,17 @@
+#N canvas 5 49 724 363 10;
+#X declare -path ..;
+#X text 229 174 - no argument : outputs all objects (no filtering)
+;
+#X text 148 217 Inlet #2 : desired ID (see arguments);
+#X text 148 247 Outlets : (1) unique ID \, (2) group ID \,;
+#X text 218 259 (3-4-5) mapped X coord \, Y coord \, Z coord \,;
+#X text 218 271 (6-7-8) absolute X coord \, Y coord \, Z coord \,;
+#X text 218 284 (9-10) (triggers only) curve Unique ID \, curve group
+ID \,;
+#X text 218 297 (11) packed data as a list;
+#X obj 116 91 iannix/filter;
+#X text 228 188 - one argument : only outputs object with desired ID
+;
+#X text 99 4 [iannix/filter] filter data from IanniX;
+#X text 148 154 Arguments :;
+#X obj 495 24 declare -path ..;
diff --git a/Patches/PureData/iannix/filter.pd b/Patches/PureData/iannix/filter.pd
new file mode 100644
index 0000000..0fe6550
--- /dev/null
+++ b/Patches/PureData/iannix/filter.pd
@@ -0,0 +1,94 @@
+#N canvas 647 70 601 470 10;
+#X obj 56 105 inlet;
+#X obj 88 381 outlet;
+#X obj 105 401 outlet;
+#X obj 122 320 outlet;
+#X obj 139 340 outlet;
+#X obj 156 360 outlet;
+#X obj 173 320 outlet;
+#X obj 190 340 outlet;
+#X obj 207 360 outlet;
+#X obj 224 381 outlet;
+#X obj 241 401 outlet;
+#X obj 436 361 outlet;
+#X obj 56 224 t l l;
+#X obj 88 297 unpack f s f f f f f f f s;
+#X obj 56 178 route \$1;
+#X obj 56 200 list prepend \$1;
+#N canvas 5 50 450 300 have-arg 0;
+#X obj 55 40 inlet;
+#X obj 55 248 outlet;
+#X obj 55 135 symbol \$1-;
+#X obj 55 62 t b b;
+#X msg 110 35 bang;
+#X obj 55 157 select symbol;
+#X obj 143 136 makefilename $%d-;
+#X msg 143 115 1;
+#X msg 55 179 0;
+#X msg 143 180 1;
+#X obj 55 201 t f;
+#X connect 0 0 3 0;
+#X connect 2 0 5 0;
+#X connect 3 0 2 0;
+#X connect 3 1 7 0;
+#X connect 4 0 3 0;
+#X connect 5 0 8 0;
+#X connect 5 1 9 0;
+#X connect 6 0 5 1;
+#X connect 7 0 6 0;
+#X connect 8 0 10 0;
+#X connect 9 0 10 0;
+#X connect 10 0 1 0;
+#X restore 138 81 pd have-arg;
+#X obj 56 127 t a a;
+#X obj 56 149 spigot 0;
+#X obj 126 149 spigot 1;
+#X obj 138 103 t f f;
+#X obj 179 126 == 0;
+#X obj 138 58 loadbang;
+#X msg 208 60 bang;
+#X obj 404 64 inlet ID;
+#X msg 404 130 1;
+#X obj 404 152 t f;
+#X obj 358 108 t b;
+#X msg 358 130 0;
+#X text 44 11 [iannix/filter] filter IanniX data;
+#X obj 404 86 route bang;
+#X obj 404 108 t b a;
+#X obj 126 178 t a a;
+#X connect 0 0 17 0;
+#X connect 12 0 11 0;
+#X connect 12 1 13 0;
+#X connect 13 0 1 0;
+#X connect 13 1 2 0;
+#X connect 13 2 3 0;
+#X connect 13 3 4 0;
+#X connect 13 4 5 0;
+#X connect 13 5 6 0;
+#X connect 13 6 7 0;
+#X connect 13 7 8 0;
+#X connect 13 8 9 0;
+#X connect 13 9 10 0;
+#X connect 14 0 15 0;
+#X connect 15 0 12 0;
+#X connect 16 0 20 0;
+#X connect 17 0 18 0;
+#X connect 17 1 19 0;
+#X connect 18 0 14 0;
+#X connect 19 0 12 0;
+#X connect 20 0 18 1;
+#X connect 20 1 21 0;
+#X connect 21 0 19 1;
+#X connect 22 0 16 0;
+#X connect 23 0 16 0;
+#X connect 24 0 30 0;
+#X connect 25 0 26 0;
+#X connect 26 0 20 0;
+#X connect 27 0 28 0;
+#X connect 28 0 26 0;
+#X connect 30 0 27 0;
+#X connect 30 1 31 0;
+#X connect 31 0 25 0;
+#X connect 31 1 32 0;
+#X connect 32 0 14 1;
+#X connect 32 1 15 1;
diff --git a/Patches/PureData/iannix/iannix-help.pd b/Patches/PureData/iannix/iannix-help.pd
new file mode 100644
index 0000000..68fcab2
--- /dev/null
+++ b/Patches/PureData/iannix/iannix-help.pd
@@ -0,0 +1,36 @@
+#N canvas 159 140 901 429 10;
+#X declare -path ..;
+#X obj 287 134 tgl 15 0 empty empty play/pause -17 -7 0 10 -262144
+-1 -1 0 1;
+#X obj 380 133 bng 15 250 50 0 empty empty fastrewind -17 -7 0 10 -262144
+-1 -1;
+#X obj 256 341 tgl 15 0 empty empty score.playing/paused 17 7 0 10
+-262144 -1 -1 0 1;
+#X obj 276 310 bng 15 250 50 0 empty empty score.rewound 17 7 0 10
+-262144 -1 -1;
+#X floatatom 338 213 3 0 0 0 - - -, f 3;
+#X floatatom 361 213 3 0 0 0 - - -, f 3;
+#X floatatom 384 213 3 0 0 0 - - -, f 3;
+#X text 411 212 Number of triggers / cursors / curves;
+#X floatatom 37 117 5 0 0 2 score.speed - -, f 5;
+#X floatatom 297 286 5 0 0 1 transport.timecode - -, f 5;
+#X obj 194 164 iannix 127.0.0.1 1234 57120;
+#X msg 37 137 send /iannix/speed \$1;
+#X text 108 62 arguments : <IanniX.server.IP> <IanniX.server.OSCinPort>
+<IanniX.server.OSCoutPort>, f 84;
+#X text 167 39 [iannix] interfacing with IanniX via OSC;
+#X obj 670 18 declare -path ..;
+#X obj 211 385 iannix/filter;
+#X text 142 387 see also:;
+#X symbolatom 318 267 12 0 0 0 - - -, f 12;
+#X connect 0 0 10 1;
+#X connect 1 0 10 2;
+#X connect 8 0 11 0;
+#X connect 10 3 2 0;
+#X connect 10 4 3 0;
+#X connect 10 5 9 0;
+#X connect 10 6 17 0;
+#X connect 10 7 4 0;
+#X connect 10 8 5 0;
+#X connect 10 9 6 0;
+#X connect 11 0 10 0;
diff --git a/Patches/PureData/iannix/iannix.pd b/Patches/PureData/iannix/iannix.pd
new file mode 100644
index 0000000..a10fde6
--- /dev/null
+++ b/Patches/PureData/iannix/iannix.pd
@@ -0,0 +1,93 @@
+#N canvas 297 108 840 599 10;
+#X obj 95 14 inlet;
+#X obj 188 14 inlet;
+#X obj 188 38 route 0;
+#X obj 468 14 inlet;
+#X obj 19 6 loadbang;
+#X obj 19 82 pack s f;
+#X obj 89 61 f \$2;
+#X obj 19 61 symbol \$1;
+#X msg 19 105 connect \$1 \$2;
+#X obj 301 376 route play stop fastrewind;
+#X msg 301 396 1;
+#X msg 352 396 0;
+#X msg 301 355 \$1;
+#X obj 301 334 unpack s f s f f f;
+#X msg 188 63 send /iannix/stop;
+#X msg 316 63 send /iannix/play \$1;
+#X msg 468 63 send /iannix/fastrewind;
+#X obj 64 252 oscparse;
+#X obj 64 280 list trim;
+#X obj 301 420 t f;
+#X obj 330 489 t b;
+#X obj 19 33 t b b;
+#X obj 65 206 netsend -u -b;
+#X obj 65 168 list prepend send;
+#X obj 65 187 list trim;
+#X obj 316 118 t a;
+#X obj 316 140 route send;
+#X obj 316 162 t a a;
+#X obj 409 186 symbol;
+#X msg 409 208 set \$1;
+#X obj 316 227 oscformat;
+#X obj 316 184 list split 1;
+#X obj 316 206 t a;
+#X obj 64 233 netreceive -u -b \$3;
+#X obj 64 300 route trigger cursor curve transport;
+#X obj 64 453 outlet triggers;
+#X obj 126 433 outlet cursors;
+#X obj 188 413 outlet curves;
+#X obj 301 463 outlet play_state;
+#X obj 330 513 outlet score_rewound;
+#X obj 480 463 outlet score:timecode;
+#X obj 530 443 outlet num.triggers;
+#X obj 572 423 outlet num.cursors;
+#X obj 614 403 outlet num.curves;
+#X obj 450 483 outlet score.time;
+#X connect 0 0 25 0;
+#X connect 1 0 2 0;
+#X connect 2 0 14 0;
+#X connect 2 1 15 0;
+#X connect 3 0 16 0;
+#X connect 4 0 21 0;
+#X connect 5 0 8 0;
+#X connect 6 0 5 1;
+#X connect 7 0 5 0;
+#X connect 8 0 22 0;
+#X connect 9 0 10 0;
+#X connect 9 1 11 0;
+#X connect 9 2 20 0;
+#X connect 10 0 19 0;
+#X connect 11 0 19 0;
+#X connect 12 0 9 0;
+#X connect 13 0 12 0;
+#X connect 13 1 44 0;
+#X connect 13 2 40 0;
+#X connect 13 3 41 0;
+#X connect 13 4 42 0;
+#X connect 13 5 43 0;
+#X connect 14 0 25 0;
+#X connect 15 0 25 0;
+#X connect 16 0 25 0;
+#X connect 17 0 18 0;
+#X connect 18 0 34 0;
+#X connect 19 0 38 0;
+#X connect 20 0 39 0;
+#X connect 21 0 7 0;
+#X connect 21 1 6 0;
+#X connect 23 0 24 0;
+#X connect 24 0 22 0;
+#X connect 25 0 26 0;
+#X connect 26 0 27 0;
+#X connect 27 0 31 0;
+#X connect 27 1 28 0;
+#X connect 28 0 29 0;
+#X connect 29 0 32 0;
+#X connect 30 0 23 0;
+#X connect 31 1 32 0;
+#X connect 32 0 30 0;
+#X connect 33 0 17 0;
+#X connect 34 0 35 0;
+#X connect 34 1 36 0;
+#X connect 34 2 37 0;
+#X connect 34 3 13 0;
diff --git a/Patches/PureData/iannix_object.pd b/Patches/PureData/iannix_object.pd
deleted file mode 100644
index 27433f9..0000000
--- a/Patches/PureData/iannix_object.pd
+++ /dev/null
@@ -1,29 +0,0 @@
-#N canvas 817 92 539 470 10;
-#X obj 6 -35 inlet;
-#X obj 33 141 outlet;
-#X obj 50 161 outlet;
-#X obj 67 80 outlet;
-#X obj 84 100 outlet;
-#X obj 101 120 outlet;
-#X obj 118 80 outlet;
-#X obj 135 100 outlet;
-#X obj 152 120 outlet;
-#X obj 169 141 outlet;
-#X obj 186 161 outlet;
-#X obj 236 161 outlet;
-#X obj 6 24 t l l;
-#X obj 33 57 unpack f s f f f f f f f s;
-#X text 155 -33 TODO : filters;
-#X connect 0 0 12 0;
-#X connect 12 0 11 0;
-#X connect 12 1 13 0;
-#X connect 13 0 1 0;
-#X connect 13 1 2 0;
-#X connect 13 2 3 0;
-#X connect 13 3 4 0;
-#X connect 13 4 5 0;
-#X connect 13 5 6 0;
-#X connect 13 6 7 0;
-#X connect 13 7 8 0;
-#X connect 13 8 9 0;
-#X connect 13 9 10 0;
diff --git a/Patches/PureData/subpatch.pd b/Patches/PureData/subpatch.pd
index 559267f..bd67466 100644
--- a/Patches/PureData/subpatch.pd
+++ b/Patches/PureData/subpatch.pd
@@ -1,19 +1,19 @@
-#N canvas 913 22 316 244 10;
-#X obj 30 -6 inlet;
-#X obj 24 41 gemhead;
-#X obj 24 163 cube;
-#X msg 108 146 draw line;
-#X obj 108 106 loadbang;
-#X obj 108 127 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
+#N canvas 810 49 420 318 10;
+#X obj 30 54 inlet;
+#X obj 24 101 gemhead;
+#X obj 24 223 cube;
+#X msg 108 206 draw line;
+#X obj 108 166 loadbang;
+#X obj 108 187 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
 -1 -1;
-#X msg 178 146 0.03;
-#X obj 24 83 translateXYZ -0.5 -0.5 0;
-#X obj 24 63 scaleXYZ 6 6 6;
-#X obj 24 141 translateXYZ;
-#X obj 12 119 unpack f f;
-#X obj 168 106 r reset;
-#X msg 218 146 -5 -5;
-#X obj 30 17 unpack s f f f f f f f s;
+#X msg 178 206 0.03;
+#X obj 24 143 translateXYZ -0.5 -0.5 0;
+#X obj 24 123 scaleXYZ 6 6 6;
+#X obj 24 201 translateXYZ;
+#X obj 12 179 unpack f f;
+#X obj 168 166 r reset;
+#X msg 218 206 -5 -5;
+#X obj 30 77 unpack s f f f f f f f s;
 #X connect 0 0 13 0;
 #X connect 1 0 8 0;
 #X connect 3 0 2 0;
diff --git a/Readme.md b/Readme.md
index 8791c25..9259432 100644
--- a/Readme.md
+++ b/Readme.md
@@ -7,7 +7,7 @@ Build IanniX
 
 All platforms
 -------------
-- Download Qt 4.8 for your plateform (http://qt-project.org/downloads) (4.7 is also compatible)
+- Download Qt 5.x for your platform (http://qt-project.org/downloads) (4.8 and 4.7 are also compatible, especially for compilation on Mac 32 bits)
 - Download Qt Creator (http://qt-project.org/downloads)
 - Open IanniX.pro and build!
 
@@ -18,4 +18,8 @@ Mac OS X specific
 
 Linux
 -----
-- You'll need to build Qt before building IanniX
\ No newline at end of file
+- You'll need to build Qt before building IanniX
+  - If your distribution supports it, you can also install Qt via the package
+    manager, e.g.:
+
+        aptitude install libqt4-dev libqt4-opengl-dev
diff --git a/Tools/HTML Template.html b/Tools/HTML Template.html
index 4950d25..ac6c4d4 100644
--- a/Tools/HTML Template.html	
+++ b/Tools/HTML Template.html	
@@ -4,7 +4,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/Tools/JavaScript Library.js b/Tools/JavaScript Library.js
index 741469d..9cb1dba 100644
--- a/Tools/JavaScript Library.js	
+++ b/Tools/JavaScript Library.js	
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/Tools/Score template.iannix b/Tools/Score template.iannix
index 3d757bf..10981a6 100644
--- a/Tools/Score template.iannix	
+++ b/Tools/Score template.iannix	
@@ -119,7 +119,7 @@ function alterateWithScript() {
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/Tools/Translation_fr_FR.ts b/Tools/Translation_fr_FR.ts
index dd0e628..79c0538 100644
--- a/Tools/Translation_fr_FR.ts
+++ b/Tools/Translation_fr_FR.ts
@@ -440,7 +440,7 @@ Bougez un slider sur votre interface de contrôle ou appuyez sur une note MIDI</
         <location filename="../iannix.cpp" line="490"/>
         <location filename="../iannix.cpp" line="501"/>
         <location filename="../iannix.cpp" line="531"/>
-        <source>Coordinates systems are differents.
+        <source>Coordinates systems are different.
 Please enter a scale factor: </source>
         <translation>Les systèmes de coordonnées sont différents.
 Merci de saisir un facteur de taille :</translation>
diff --git a/abstractionsgl.cpp b/abstractionsgl.cpp
index 9e26e94..55733d8 100644
--- a/abstractionsgl.cpp
+++ b/abstractionsgl.cpp
@@ -503,8 +503,8 @@ void OpenGlDrawing::drawRect(OpenGlTexture *texture, qreal alpha, qreal selected
 }
 void OpenGlDrawing::drawRect(const QRectF &rect, const OpenGlColors &colors, OpenGlTexture *texture, qreal alpha, qreal selected, qreal croppingMode, bool ninePatch, QRectF partialTextureRect) {
     QRectF textureRect, targetRect = rect;
-    alpha    = qBound(0., alpha,    1.);
-    selected = qBound(0., selected, 1.);
+    alpha    = qBound(qreal(0.), alpha,    qreal(1.));
+    selected = qBound(qreal(0.), selected, qreal(1.));
 
     //Cropping
     if(!colors.isColorTransparent()) {
@@ -716,7 +716,7 @@ qreal OpenGlDrawing::drawText(QPainter *painter, const QColor &color, const Open
                 //painter->drawStaticText(QPointF(0, 0), staticText);
                 //qDebug("%s\tH:%f\tC:%f\tSH:%f\tPOS:%f", qPrintable(text), rect.height(), rect.center().y(), staticText.size().height(), rect.center().y() - staticText.size().height()/2);
                 if((font.alignementFlags() & Qt::AlignVCenter) == Qt::AlignVCenter)
-                    pos.setY(qMax(0., rect.center().y() - fontHeight/2));
+                    pos.setY(qMax(qreal(0.), rect.center().y() - fontHeight/2));
                 else if((font.alignementFlags() & Qt::AlignBottom) == Qt::AlignBottom)
                     pos.setY(rect.bottom() - fontHeight);
 
diff --git a/geometry/nxeasing.cpp b/geometry/nxeasing.cpp
index ac9ada8..0d104b8 100644
--- a/geometry/nxeasing.cpp
+++ b/geometry/nxeasing.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/geometry/nxeasing.h b/geometry/nxeasing.h
index 3971390..ca34b0d 100644
--- a/geometry/nxeasing.h
+++ b/geometry/nxeasing.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
@@ -38,7 +38,7 @@ public:
 public:
     inline void setType(quint16 type)           { easing.setType((QEasingCurve::Type)type); }
     inline quint16 getType() const              { return easing.type(); }
-    inline qreal getValue(qreal progress) const { return qBound(0., easing.valueForProgress(progress), 1.); }
+    inline qreal getValue(qreal progress) const { return qBound(qreal(0.), easing.valueForProgress(progress), qreal(1.)); }
 };
 
 #endif // NXEASING_H
diff --git a/geometry/nxline.cpp b/geometry/nxline.cpp
index c8cbc1a..bf1256e 100644
--- a/geometry/nxline.cpp
+++ b/geometry/nxline.cpp
@@ -1,60 +1,60 @@
-/*
-    This file is part of IanniX, a graphical real-time open-source sequencer for digital art
-    Copyright (C) 2010-2015 — IanniX Association
-
-    Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
-
-    This file was written by Guillaume Jacquemin.
-
-    IanniX is a free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "nxline.h"
-
-bool NxLine::isNull() const {
-    return (qFuzzyCompare(pt1.x(), pt2.x()) && qFuzzyCompare(pt1.y(), pt2.y())) ? true : false;
-}
-
-qreal NxLine::length() const {
-    qreal x = pt2.x() - pt1.x();
-    qreal y = pt2.y() - pt1.y();
-    qreal z = pt2.z() - pt1.z();
-    return qSqrt(x*x + y*y + z*z);
-}
-
-NxLine::IntersectType NxLine::intersect(const NxLine &l, NxPoint *intersectionPoint) const {
-    // ipmlementation is based on Graphics Gems III's "Faster Line Segment Intersection"
-    const NxPoint a = pt2 - pt1;
-    const NxPoint b = l.pt1 - l.pt2;
-    const NxPoint c = pt1 - l.pt1;
-
-    const qreal denominator = a.y() * b.x() - a.x() * b.y();
-    if (denominator == 0 || !qIsFinite(denominator))
-        return NoIntersection;
-
-    const qreal reciprocal = 1 / denominator;
-    const qreal na = (b.y() * c.x() - b.x() * c.y()) * reciprocal;
-    if (intersectionPoint)
-        *intersectionPoint = pt1 + a * na;
-
-    if (na < 0 || na > 1)
-        return UnboundedIntersection;
-
-    const qreal nb = (a.x() * c.y() - a.y() * c.x()) * reciprocal;
-    if (nb < 0 || nb > 1)
-        return UnboundedIntersection;
-
-    return BoundedIntersection;
-}
+/*
+    This file is part of IanniX, a graphical real-time open-source sequencer for digital art
+    Copyright (C) 2010-2015 — IanniX Association
+
+    Project Manager: Thierry Coduys (http://www.le-hub.org)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
+
+    This file was written by Guillaume Jacquemin.
+
+    IanniX is a free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "nxline.h"
+
+bool NxLine::isNull() const {
+    return (qFuzzyCompare(pt1.x(), pt2.x()) && qFuzzyCompare(pt1.y(), pt2.y())) ? true : false;
+}
+
+qreal NxLine::length() const {
+    qreal x = pt2.x() - pt1.x();
+    qreal y = pt2.y() - pt1.y();
+    qreal z = pt2.z() - pt1.z();
+    return qSqrt(x*x + y*y + z*z);
+}
+
+NxLine::IntersectType NxLine::intersect(const NxLine &l, NxPoint *intersectionPoint) const {
+    // ipmlementation is based on Graphics Gems III's "Faster Line Segment Intersection"
+    const NxPoint a = pt2 - pt1;
+    const NxPoint b = l.pt1 - l.pt2;
+    const NxPoint c = pt1 - l.pt1;
+
+    const qreal denominator = a.y() * b.x() - a.x() * b.y();
+    if (denominator == 0 || !qIsFinite(denominator))
+        return NoIntersection;
+
+    const qreal reciprocal = 1 / denominator;
+    const qreal na = (b.y() * c.x() - b.x() * c.y()) * reciprocal;
+    if (intersectionPoint)
+        *intersectionPoint = pt1 + a * na;
+
+    if (na < 0 || na > 1)
+        return UnboundedIntersection;
+
+    const qreal nb = (a.x() * c.y() - a.y() * c.x()) * reciprocal;
+    if (nb < 0 || nb > 1)
+        return UnboundedIntersection;
+
+    return BoundedIntersection;
+}
diff --git a/geometry/nxline.h b/geometry/nxline.h
index 02cebae..cd8d15b 100644
--- a/geometry/nxline.h
+++ b/geometry/nxline.h
@@ -1,221 +1,221 @@
-/*
-    This file is part of IanniX, a graphical real-time open-source sequencer for digital art
-    Copyright (C) 2010-2015 — IanniX Association
-
-    Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
-
-    This file was written by Guillaume Jacquemin.
-
-    IanniX is a free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef NXLINE_H
-#define NXLINE_H
-
-#include <QtCore/qmath.h>
-#include <qnumeric.h>
-#include "nxpoint.h"
-
-class NxLine {
-public:
-
-    enum IntersectType { NoIntersection, BoundedIntersection, UnboundedIntersection };
-
-    inline NxLine();
-    inline NxLine(const NxPoint &pt1, const NxPoint &pt2);
-    inline NxLine(qreal x1, qreal y1, qreal x2, qreal y2);
-    inline NxLine(qreal x1, qreal y1, qreal z1, qreal x2, qreal y2, qreal z2);
-
-    bool isNull() const;
-
-    inline NxPoint p1() const;
-    inline NxPoint p2() const;
-
-    inline qreal x1() const;
-    inline qreal y1() const;
-    inline qreal z1() const;
-
-    inline qreal x2() const;
-    inline qreal y2() const;
-    inline qreal z2() const;
-
-    inline qreal dx() const;
-    inline qreal dy() const;
-    inline qreal dz() const;
-
-    qreal length() const;
-    void setLength(qreal len);
-
-    // ### Qt 5: rename intersects() or intersection() and rename IntersectType IntersectionType
-    IntersectType intersect(const NxLine &l, NxPoint *intersectionPoint) const;
-
-    NxPoint pointAt(qreal t) const;
-    inline void translate(const NxPoint &p);
-    inline void translate(qreal dx, qreal dy, qreal dz);
-
-    inline NxLine translated(const NxPoint &p) const;
-    inline NxLine translated(qreal dx, qreal dy, qreal dz) const;
-
-    inline void setP1(const NxPoint &p1);
-    inline void setP2(const NxPoint &p2);
-    inline void setPoints(const NxPoint &p1, const NxPoint &p2);
-    inline void setLine(qreal x1, qreal y1, qreal z1, qreal x2, qreal y2, qreal z2);
-
-    inline bool operator==(const NxLine &d) const;
-    inline bool operator!=(const NxLine &d) const { return !(*this == d); }
-
-private:
-    NxPoint pt1, pt2;
-};
-Q_DECLARE_TYPEINFO(NxLine, Q_MOVABLE_TYPE);
-
-/*******************************************************************************
- * class NxLine inline members
- *******************************************************************************/
-
-inline NxLine::NxLine()
-{
-}
-
-inline NxLine::NxLine(const NxPoint &apt1, const NxPoint &apt2)
-    : pt1(apt1), pt2(apt2)
-{
-}
-
-inline NxLine::NxLine(qreal x1pos, qreal y1pos, qreal x2pos, qreal y2pos)
-    : pt1(x1pos, y1pos, 0), pt2(x2pos, y2pos, 0)
-{
-}
-
-inline NxLine::NxLine(qreal x1pos, qreal y1pos, qreal z1pos, qreal x2pos, qreal y2pos, qreal z2pos)
-    : pt1(x1pos, y1pos, z1pos), pt2(x2pos, y2pos, z2pos)
-{
-}
-
-inline qreal NxLine::x1() const
-{
-    return pt1.x();
-}
-
-inline qreal NxLine::y1() const
-{
-    return pt1.y();
-}
-
-inline qreal NxLine::z1() const
-{
-    return pt1.z();
-}
-
-inline qreal NxLine::x2() const
-{
-    return pt2.x();
-}
-
-inline qreal NxLine::y2() const
-{
-    return pt2.y();
-}
-
-inline qreal NxLine::z2() const
-{
-    return pt2.z();
-}
-
-inline NxPoint NxLine::p1() const
-{
-    return pt1;
-}
-
-inline NxPoint NxLine::p2() const
-{
-    return pt2;
-}
-
-inline qreal NxLine::dx() const
-{
-    return pt2.x() - pt1.x();
-}
-
-inline qreal NxLine::dy() const
-{
-    return pt2.y() - pt1.y();
-}
-
-inline qreal NxLine::dz() const
-{
-    return pt2.z() - pt1.z();
-}
-
-inline void NxLine::translate(const NxPoint &point)
-{
-    pt1 += point;
-    pt2 += point;
-}
-
-inline void NxLine::translate(qreal adx, qreal ady, qreal adz)
-{
-    this->translate(NxPoint(adx, ady, adz));
-}
-
-inline NxLine NxLine::translated(const NxPoint &p) const
-{
-    return NxLine(pt1 + p, pt2 + p);
-}
-
-inline NxLine NxLine::translated(qreal adx, qreal ady, qreal adz) const
-{
-    return translated(NxPoint(adx, ady, adz));
-}
-
-inline NxPoint NxLine::pointAt(qreal t) const
-{
-    qreal vx = pt2.x() - pt1.x();
-    qreal vy = pt2.y() - pt1.y();
-    qreal vz = pt2.z() - pt1.z();
-    return NxPoint(pt1.x() + vx * t, pt1.y() + vy * t, pt2.z() + vz * t);
-}
-
-
-inline void NxLine::setP1(const NxPoint &aP1)
-{
-    pt1 = aP1;
-}
-
-inline void NxLine::setP2(const NxPoint &aP2)
-{
-    pt2 = aP2;
-}
-
-inline void NxLine::setPoints(const NxPoint &aP1, const NxPoint &aP2)
-{
-    pt1 = aP1;
-    pt2 = aP2;
-}
-
-inline void NxLine::setLine(qreal aX1, qreal aY1, qreal aZ1, qreal aX2, qreal aY2, qreal aZ2)
-{
-    pt1 = NxPoint(aX1, aY1, aZ1);
-    pt2 = NxPoint(aX2, aY2, aZ2);
-}
-
-
-inline bool NxLine::operator==(const NxLine &d) const
-{
-    return pt1 == d.pt1 && pt2 == d.pt2;
-}
-
-
-#endif // NXLINE_H
+/*
+    This file is part of IanniX, a graphical real-time open-source sequencer for digital art
+    Copyright (C) 2010-2015 — IanniX Association
+
+    Project Manager: Thierry Coduys (http://www.le-hub.org)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
+
+    This file was written by Guillaume Jacquemin.
+
+    IanniX is a free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef NXLINE_H
+#define NXLINE_H
+
+#include <QtCore/qmath.h>
+#include <qnumeric.h>
+#include "nxpoint.h"
+
+class NxLine {
+public:
+
+    enum IntersectType { NoIntersection, BoundedIntersection, UnboundedIntersection };
+
+    inline NxLine();
+    inline NxLine(const NxPoint &pt1, const NxPoint &pt2);
+    inline NxLine(qreal x1, qreal y1, qreal x2, qreal y2);
+    inline NxLine(qreal x1, qreal y1, qreal z1, qreal x2, qreal y2, qreal z2);
+
+    bool isNull() const;
+
+    inline NxPoint p1() const;
+    inline NxPoint p2() const;
+
+    inline qreal x1() const;
+    inline qreal y1() const;
+    inline qreal z1() const;
+
+    inline qreal x2() const;
+    inline qreal y2() const;
+    inline qreal z2() const;
+
+    inline qreal dx() const;
+    inline qreal dy() const;
+    inline qreal dz() const;
+
+    qreal length() const;
+    void setLength(qreal len);
+
+    // ### Qt 5: rename intersects() or intersection() and rename IntersectType IntersectionType
+    IntersectType intersect(const NxLine &l, NxPoint *intersectionPoint) const;
+
+    NxPoint pointAt(qreal t) const;
+    inline void translate(const NxPoint &p);
+    inline void translate(qreal dx, qreal dy, qreal dz);
+
+    inline NxLine translated(const NxPoint &p) const;
+    inline NxLine translated(qreal dx, qreal dy, qreal dz) const;
+
+    inline void setP1(const NxPoint &p1);
+    inline void setP2(const NxPoint &p2);
+    inline void setPoints(const NxPoint &p1, const NxPoint &p2);
+    inline void setLine(qreal x1, qreal y1, qreal z1, qreal x2, qreal y2, qreal z2);
+
+    inline bool operator==(const NxLine &d) const;
+    inline bool operator!=(const NxLine &d) const { return !(*this == d); }
+
+private:
+    NxPoint pt1, pt2;
+};
+Q_DECLARE_TYPEINFO(NxLine, Q_MOVABLE_TYPE);
+
+/*******************************************************************************
+ * class NxLine inline members
+ *******************************************************************************/
+
+inline NxLine::NxLine()
+{
+}
+
+inline NxLine::NxLine(const NxPoint &apt1, const NxPoint &apt2)
+    : pt1(apt1), pt2(apt2)
+{
+}
+
+inline NxLine::NxLine(qreal x1pos, qreal y1pos, qreal x2pos, qreal y2pos)
+    : pt1(x1pos, y1pos, 0), pt2(x2pos, y2pos, 0)
+{
+}
+
+inline NxLine::NxLine(qreal x1pos, qreal y1pos, qreal z1pos, qreal x2pos, qreal y2pos, qreal z2pos)
+    : pt1(x1pos, y1pos, z1pos), pt2(x2pos, y2pos, z2pos)
+{
+}
+
+inline qreal NxLine::x1() const
+{
+    return pt1.x();
+}
+
+inline qreal NxLine::y1() const
+{
+    return pt1.y();
+}
+
+inline qreal NxLine::z1() const
+{
+    return pt1.z();
+}
+
+inline qreal NxLine::x2() const
+{
+    return pt2.x();
+}
+
+inline qreal NxLine::y2() const
+{
+    return pt2.y();
+}
+
+inline qreal NxLine::z2() const
+{
+    return pt2.z();
+}
+
+inline NxPoint NxLine::p1() const
+{
+    return pt1;
+}
+
+inline NxPoint NxLine::p2() const
+{
+    return pt2;
+}
+
+inline qreal NxLine::dx() const
+{
+    return pt2.x() - pt1.x();
+}
+
+inline qreal NxLine::dy() const
+{
+    return pt2.y() - pt1.y();
+}
+
+inline qreal NxLine::dz() const
+{
+    return pt2.z() - pt1.z();
+}
+
+inline void NxLine::translate(const NxPoint &point)
+{
+    pt1 += point;
+    pt2 += point;
+}
+
+inline void NxLine::translate(qreal adx, qreal ady, qreal adz)
+{
+    this->translate(NxPoint(adx, ady, adz));
+}
+
+inline NxLine NxLine::translated(const NxPoint &p) const
+{
+    return NxLine(pt1 + p, pt2 + p);
+}
+
+inline NxLine NxLine::translated(qreal adx, qreal ady, qreal adz) const
+{
+    return translated(NxPoint(adx, ady, adz));
+}
+
+inline NxPoint NxLine::pointAt(qreal t) const
+{
+    qreal vx = pt2.x() - pt1.x();
+    qreal vy = pt2.y() - pt1.y();
+    qreal vz = pt2.z() - pt1.z();
+    return NxPoint(pt1.x() + vx * t, pt1.y() + vy * t, pt2.z() + vz * t);
+}
+
+
+inline void NxLine::setP1(const NxPoint &aP1)
+{
+    pt1 = aP1;
+}
+
+inline void NxLine::setP2(const NxPoint &aP2)
+{
+    pt2 = aP2;
+}
+
+inline void NxLine::setPoints(const NxPoint &aP1, const NxPoint &aP2)
+{
+    pt1 = aP1;
+    pt2 = aP2;
+}
+
+inline void NxLine::setLine(qreal aX1, qreal aY1, qreal aZ1, qreal aX2, qreal aY2, qreal aZ2)
+{
+    pt1 = NxPoint(aX1, aY1, aZ1);
+    pt2 = NxPoint(aX2, aY2, aZ2);
+}
+
+
+inline bool NxLine::operator==(const NxLine &d) const
+{
+    return pt1 == d.pt1 && pt2 == d.pt2;
+}
+
+
+#endif // NXLINE_H
diff --git a/geometry/nxpoint.cpp b/geometry/nxpoint.cpp
index 5f09377..403ea24 100644
--- a/geometry/nxpoint.cpp
+++ b/geometry/nxpoint.cpp
@@ -1,67 +1,67 @@
-/*
-    This file is part of IanniX, a graphical real-time open-source sequencer for digital art
-    Copyright (C) 2010-2015 — IanniX Association
-
-    Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
-
-    This file was written by Guillaume Jacquemin.
-
-    IanniX is a free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "nxpoint.h"
-#include <QtCore/qdebug.h>
-#include <QtCore/qvariant.h>
-#include <QtCore/qmath.h>
-
-qreal NxPoint::length() const {
-    return qSqrt(xp * xp + yp * yp + zp * zp);
-}
-
-qreal NxPoint::lengthSquared() const {
-    return xp * xp + yp * yp + zp * zp;
-}
-
-NxPoint NxPoint::normalized() const {
-    // Need some extra precision if the length is very small.
-    double len = double(xp) * double(xp) +
-                 double(yp) * double(yp) +
-                 double(zp) * double(zp);
-    if (qFuzzyIsNull(len - 1.0f))
-        return *this;
-    else if (!qFuzzyIsNull(len))
-        return *this / qSqrt(len);
-    else
-        return NxPoint();
-}
-
-void NxPoint::normalize() {
-    // Need some extra precision if the length is very small.
-    double len = double(xp) * double(xp) +
-                 double(yp) * double(yp) +
-                 double(zp) * double(zp);
-    if (qFuzzyIsNull(len - 1.0f) || qFuzzyIsNull(len))
-        return;
-
-    len = qSqrt(len);
-
-    xp /= len;
-    yp /= len;
-    zp /= len;
-}
-
-qreal NxPoint::dotProduct(const NxPoint& v1, const NxPoint& v2) {
-    return v1.xp * v2.xp + v1.yp * v2.yp + v1.zp * v2.zp;
-}
+/*
+    This file is part of IanniX, a graphical real-time open-source sequencer for digital art
+    Copyright (C) 2010-2015 — IanniX Association
+
+    Project Manager: Thierry Coduys (http://www.le-hub.org)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
+
+    This file was written by Guillaume Jacquemin.
+
+    IanniX is a free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "nxpoint.h"
+#include <QtCore/qdebug.h>
+#include <QtCore/qvariant.h>
+#include <QtCore/qmath.h>
+
+qreal NxPoint::length() const {
+    return qSqrt(xp * xp + yp * yp + zp * zp);
+}
+
+qreal NxPoint::lengthSquared() const {
+    return xp * xp + yp * yp + zp * zp;
+}
+
+NxPoint NxPoint::normalized() const {
+    // Need some extra precision if the length is very small.
+    double len = double(xp) * double(xp) +
+                 double(yp) * double(yp) +
+                 double(zp) * double(zp);
+    if (qFuzzyIsNull(len - 1.0f))
+        return *this;
+    else if (!qFuzzyIsNull(len))
+        return *this / qSqrt(len);
+    else
+        return NxPoint();
+}
+
+void NxPoint::normalize() {
+    // Need some extra precision if the length is very small.
+    double len = double(xp) * double(xp) +
+                 double(yp) * double(yp) +
+                 double(zp) * double(zp);
+    if (qFuzzyIsNull(len - 1.0f) || qFuzzyIsNull(len))
+        return;
+
+    len = qSqrt(len);
+
+    xp /= len;
+    yp /= len;
+    zp /= len;
+}
+
+qreal NxPoint::dotProduct(const NxPoint& v1, const NxPoint& v2) {
+    return v1.xp * v2.xp + v1.yp * v2.yp + v1.zp * v2.zp;
+}
diff --git a/geometry/nxpoint.h b/geometry/nxpoint.h
index d1f57a2..28cdccb 100644
--- a/geometry/nxpoint.h
+++ b/geometry/nxpoint.h
@@ -1,223 +1,223 @@
-/*
-    This file is part of IanniX, a graphical real-time open-source sequencer for digital art
-    Copyright (C) 2010-2015 — IanniX Association
-
-    Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
-
-    This file was written by Guillaume Jacquemin.
-
-    IanniX is a free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef NXPOINT_H
-#define NXPOINT_H
-
-#include <QVariant>
-
-class NxPoint{
-public:
-    NxPoint();
-    NxPoint(qreal xpos, qreal ypos);
-    NxPoint(qreal xpos, qreal ypos, qreal zpos);
-    NxPoint(qreal xpos, qreal ypos, qreal zpos, qreal sx, qreal sy, qreal sz);
-    NxPoint(qreal xpos, qreal ypos, qreal zpos, qreal sx, qreal sy, qreal sz, qreal angleZ);
-    NxPoint(float xpos, float ypos, float zpos, int dummy);
-
-    bool isNull() const;
-
-    qreal x() const;
-    qreal y() const;
-    qreal z() const;
-    qreal sx() const;
-    qreal sy() const;
-    qreal sz() const;
-
-    qreal angleZ() const;
-
-    void setX(qreal x);
-    void setY(qreal y);
-    void setZ(qreal z);
-    void setSx(qreal sx);
-    void setSy(qreal sy);
-    void setSz(qreal sz);
-
-    qreal length() const;
-    qreal lengthSquared() const;
-
-    NxPoint normalized() const;
-    void normalize();
-
-    NxPoint &operator+=(const NxPoint &vector);
-    NxPoint &operator-=(const NxPoint &vector);
-    NxPoint &operator*=(qreal factor);
-    NxPoint &operator*=(const NxPoint &vector);
-    NxPoint &operator/=(qreal divisor);
-
-    static qreal dotProduct(const NxPoint& v1, const NxPoint& v2);
-
-    friend inline bool operator==(const NxPoint &v1, const NxPoint &v2);
-    friend inline bool operator!=(const NxPoint &v1, const NxPoint &v2);
-    friend inline const NxPoint operator+(const NxPoint &v1, const NxPoint &v2);
-    friend inline const NxPoint operator-(const NxPoint &v1, const NxPoint &v2);
-    friend inline const NxPoint operator*(qreal factor, const NxPoint &vector);
-    friend inline const NxPoint operator*(const NxPoint &vector, qreal factor);
-    friend inline const NxPoint operator*(const NxPoint &v1, const NxPoint& v2);
-    friend inline const NxPoint operator-(const NxPoint &vector);
-    friend inline const NxPoint operator/(const NxPoint &vector, qreal divisor);
-
-    friend inline bool qFuzzyCompare(const NxPoint& v1, const NxPoint& v2);
-
-    QPoint toPoint() const;
-    QPointF toPointF() const;
-
-private:
-    float xp, yp, zp;
-    float sxp, syp, szp;
-    float angleZp;
-};
-Q_DECLARE_TYPEINFO(NxPoint, Q_MOVABLE_TYPE);
-
-inline NxPoint::NxPoint()                                        : xp(0.0f), yp(0.0f), zp(0.0f), sxp(0.0f), syp(0.0f), szp(0.0f) {}
-inline NxPoint::NxPoint(qreal xpos, qreal ypos)                  : xp(xpos), yp(ypos), zp(0.0f), sxp(0.0f), syp(0.0f), szp(0.0f) {}
-inline NxPoint::NxPoint(qreal xpos, qreal ypos, qreal zpos)      : xp(xpos), yp(ypos), zp(zpos), sxp(0.0f), syp(0.0f), szp(0.0f) {}
-inline NxPoint::NxPoint(float xpos, float ypos, float zpos, int) : xp(xpos), yp(ypos), zp(zpos), sxp(0.0f), syp(0.0f), szp(0.0f) {}
-inline NxPoint::NxPoint(qreal xpos, qreal ypos, qreal zpos, qreal sx, qreal sy, qreal sz) : xp(xpos), yp(ypos), zp(zpos), sxp(sx), syp(sy), szp(sz) {}
-inline NxPoint::NxPoint(qreal xpos, qreal ypos, qreal zpos, qreal sx, qreal sy, qreal sz, qreal angleZ) : xp(xpos), yp(ypos), zp(zpos), sxp(sx), syp(sy), szp(sz), angleZp(angleZ) {}
-
-inline bool NxPoint::isNull() const {
-    return qIsNull(xp) && qIsNull(yp) && qIsNull(zp);
-}
-
-inline qreal NxPoint::x() const  { return qreal(xp); }
-inline qreal NxPoint::y() const  { return qreal(yp); }
-inline qreal NxPoint::z() const  { return qreal(zp); }
-inline qreal NxPoint::sx() const { return qreal(sxp); }
-inline qreal NxPoint::sy() const { return qreal(syp); }
-inline qreal NxPoint::sz() const { return qreal(szp); }
-inline qreal NxPoint::angleZ() const { return qreal(angleZp); }
-
-inline void NxPoint::setX(qreal aX)   { xp = aX; }
-inline void NxPoint::setY(qreal aY)   { yp = aY; }
-inline void NxPoint::setZ(qreal aZ)   { zp = aZ; }
-inline void NxPoint::setSx(qreal aSx) { sxp = aSx; }
-inline void NxPoint::setSy(qreal aSy) { syp = aSy; }
-inline void NxPoint::setSz(qreal aSz) { szp = aSz; }
-
-inline NxPoint &NxPoint::operator+=(const NxPoint &vector) {
-    xp += vector.xp;
-    yp += vector.yp;
-    zp += vector.zp;
-
-    sxp += vector.sxp;
-    syp += vector.syp;
-    szp += vector.szp;
-
-    return *this;
-}
-
-inline NxPoint &NxPoint::operator-=(const NxPoint &vector) {
-    xp -= vector.xp;
-    yp -= vector.yp;
-    zp -= vector.zp;
-
-    sxp -= vector.sxp;
-    syp -= vector.syp;
-    szp -= vector.szp;
-
-    return *this;
-}
-
-inline NxPoint &NxPoint::operator*=(qreal factor) {
-    xp *= factor;
-    yp *= factor;
-    zp *= factor;
-
-    sxp *= factor;
-    syp *= factor;
-    szp *= factor;
-
-    return *this;
-}
-
-inline NxPoint &NxPoint::operator*=(const NxPoint &vector) {
-    xp *= vector.xp;
-    yp *= vector.yp;
-    zp *= vector.zp;
-
-    sxp *= vector.sxp;
-    syp *= vector.syp;
-    szp *= vector.szp;
-
-    return *this;
-}
-
-inline NxPoint &NxPoint::operator/=(qreal divisor) {
-    xp /= divisor;
-    yp /= divisor;
-    zp /= divisor;
-
-    sxp *= divisor;
-    syp *= divisor;
-    szp *= divisor;
-
-    return *this;
-}
-
-inline bool operator==(const NxPoint &v1, const NxPoint &v2) {
-    return v1.xp == v2.xp && v1.yp == v2.yp && v1.zp == v2.zp && v1.sxp == v2.sxp && v1.syp == v2.syp && v1.szp == v2.szp;
-}
-
-inline bool operator!=(const NxPoint &v1, const NxPoint &v2) {
-    return v1.xp != v2.xp || v1.yp != v2.yp || v1.zp != v2.zp || v1.sxp != v2.sxp || v1.syp != v2.syp || v1.szp != v2.szp;
-}
-
-inline const NxPoint operator+(const NxPoint &v1, const NxPoint &v2) {
-    return NxPoint(v1.xp + v2.xp, v1.yp + v2.yp, v1.zp + v2.zp, v1.sxp + v2.sxp, v1.syp + v2.syp, v1.szp + v2.szp);
-}
-
-inline const NxPoint operator-(const NxPoint &v1, const NxPoint &v2) {
-    return NxPoint(v1.xp - v2.xp, v1.yp - v2.yp, v1.zp - v2.zp, v1.sxp - v2.sxp, v1.syp - v2.syp, v1.szp - v2.szp);
-}
-
-inline const NxPoint operator*(qreal factor, const NxPoint &vector) {
-    return NxPoint(vector.xp * factor, vector.yp * factor, vector.zp * factor, vector.sxp * factor, vector.syp * factor, vector.szp * factor);
-}
-
-inline const NxPoint operator*(const NxPoint &vector, qreal factor) {
-    return NxPoint(vector.xp * factor, vector.yp * factor, vector.zp * factor, vector.sxp * factor, vector.syp * factor, vector.szp * factor);
-}
-
-inline const NxPoint operator*(const NxPoint &v1, const NxPoint& v2) {
-    return NxPoint(v1.xp * v2.xp, v1.yp * v2.yp, v1.zp * v2.zp, v1.sxp * v2.sxp, v1.syp * v2.syp, v1.szp * v2.szp);
-}
-
-inline const NxPoint operator-(const NxPoint &vector) {
-    return NxPoint(-vector.xp, -vector.yp, -vector.zp, -vector.sxp, -vector.syp, -vector.szp);
-}
-
-inline const NxPoint operator/(const NxPoint &vector, qreal divisor) {
-    return NxPoint(vector.xp / divisor, vector.yp / divisor, vector.zp / divisor, vector.sxp / divisor, vector.syp / divisor, vector.szp / divisor);
-}
-
-inline bool qFuzzyCompare(const NxPoint& v1, const NxPoint& v2) {
-    return qFuzzyCompare(v1.xp, v2.xp) &&
-            qFuzzyCompare(v1.yp, v2.yp) &&
-            qFuzzyCompare(v1.zp, v2.zp) &&
-            qFuzzyCompare(v1.sxp, v2.sxp) &&
-            qFuzzyCompare(v1.syp, v2.syp) &&
-            qFuzzyCompare(v1.szp, v2.szp);
-}
-
-#endif
+/*
+    This file is part of IanniX, a graphical real-time open-source sequencer for digital art
+    Copyright (C) 2010-2015 — IanniX Association
+
+    Project Manager: Thierry Coduys (http://www.le-hub.org)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
+
+    This file was written by Guillaume Jacquemin.
+
+    IanniX is a free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef NXPOINT_H
+#define NXPOINT_H
+
+#include <QVariant>
+
+class NxPoint{
+public:
+    NxPoint();
+    NxPoint(qreal xpos, qreal ypos);
+    NxPoint(qreal xpos, qreal ypos, qreal zpos);
+    NxPoint(qreal xpos, qreal ypos, qreal zpos, qreal sx, qreal sy, qreal sz);
+    NxPoint(qreal xpos, qreal ypos, qreal zpos, qreal sx, qreal sy, qreal sz, qreal angleZ);
+    NxPoint(float xpos, float ypos, float zpos, int dummy);
+
+    bool isNull() const;
+
+    qreal x() const;
+    qreal y() const;
+    qreal z() const;
+    qreal sx() const;
+    qreal sy() const;
+    qreal sz() const;
+
+    qreal angleZ() const;
+
+    void setX(qreal x);
+    void setY(qreal y);
+    void setZ(qreal z);
+    void setSx(qreal sx);
+    void setSy(qreal sy);
+    void setSz(qreal sz);
+
+    qreal length() const;
+    qreal lengthSquared() const;
+
+    NxPoint normalized() const;
+    void normalize();
+
+    NxPoint &operator+=(const NxPoint &vector);
+    NxPoint &operator-=(const NxPoint &vector);
+    NxPoint &operator*=(qreal factor);
+    NxPoint &operator*=(const NxPoint &vector);
+    NxPoint &operator/=(qreal divisor);
+
+    static qreal dotProduct(const NxPoint& v1, const NxPoint& v2);
+
+    friend inline bool operator==(const NxPoint &v1, const NxPoint &v2);
+    friend inline bool operator!=(const NxPoint &v1, const NxPoint &v2);
+    friend inline const NxPoint operator+(const NxPoint &v1, const NxPoint &v2);
+    friend inline const NxPoint operator-(const NxPoint &v1, const NxPoint &v2);
+    friend inline const NxPoint operator*(qreal factor, const NxPoint &vector);
+    friend inline const NxPoint operator*(const NxPoint &vector, qreal factor);
+    friend inline const NxPoint operator*(const NxPoint &v1, const NxPoint& v2);
+    friend inline const NxPoint operator-(const NxPoint &vector);
+    friend inline const NxPoint operator/(const NxPoint &vector, qreal divisor);
+
+    friend inline bool qFuzzyCompare(const NxPoint& v1, const NxPoint& v2);
+
+    QPoint toPoint() const;
+    QPointF toPointF() const;
+
+private:
+    float xp, yp, zp;
+    float sxp, syp, szp;
+    float angleZp;
+};
+Q_DECLARE_TYPEINFO(NxPoint, Q_MOVABLE_TYPE);
+
+inline NxPoint::NxPoint()                                        : xp(0.0f), yp(0.0f), zp(0.0f), sxp(0.0f), syp(0.0f), szp(0.0f) {}
+inline NxPoint::NxPoint(qreal xpos, qreal ypos)                  : xp(xpos), yp(ypos), zp(0.0f), sxp(0.0f), syp(0.0f), szp(0.0f) {}
+inline NxPoint::NxPoint(qreal xpos, qreal ypos, qreal zpos)      : xp(xpos), yp(ypos), zp(zpos), sxp(0.0f), syp(0.0f), szp(0.0f) {}
+inline NxPoint::NxPoint(float xpos, float ypos, float zpos, int) : xp(xpos), yp(ypos), zp(zpos), sxp(0.0f), syp(0.0f), szp(0.0f) {}
+inline NxPoint::NxPoint(qreal xpos, qreal ypos, qreal zpos, qreal sx, qreal sy, qreal sz) : xp(xpos), yp(ypos), zp(zpos), sxp(sx), syp(sy), szp(sz) {}
+inline NxPoint::NxPoint(qreal xpos, qreal ypos, qreal zpos, qreal sx, qreal sy, qreal sz, qreal angleZ) : xp(xpos), yp(ypos), zp(zpos), sxp(sx), syp(sy), szp(sz), angleZp(angleZ) {}
+
+inline bool NxPoint::isNull() const {
+    return qIsNull(xp) && qIsNull(yp) && qIsNull(zp);
+}
+
+inline qreal NxPoint::x() const  { return qreal(xp); }
+inline qreal NxPoint::y() const  { return qreal(yp); }
+inline qreal NxPoint::z() const  { return qreal(zp); }
+inline qreal NxPoint::sx() const { return qreal(sxp); }
+inline qreal NxPoint::sy() const { return qreal(syp); }
+inline qreal NxPoint::sz() const { return qreal(szp); }
+inline qreal NxPoint::angleZ() const { return qreal(angleZp); }
+
+inline void NxPoint::setX(qreal aX)   { xp = aX; }
+inline void NxPoint::setY(qreal aY)   { yp = aY; }
+inline void NxPoint::setZ(qreal aZ)   { zp = aZ; }
+inline void NxPoint::setSx(qreal aSx) { sxp = aSx; }
+inline void NxPoint::setSy(qreal aSy) { syp = aSy; }
+inline void NxPoint::setSz(qreal aSz) { szp = aSz; }
+
+inline NxPoint &NxPoint::operator+=(const NxPoint &vector) {
+    xp += vector.xp;
+    yp += vector.yp;
+    zp += vector.zp;
+
+    sxp += vector.sxp;
+    syp += vector.syp;
+    szp += vector.szp;
+
+    return *this;
+}
+
+inline NxPoint &NxPoint::operator-=(const NxPoint &vector) {
+    xp -= vector.xp;
+    yp -= vector.yp;
+    zp -= vector.zp;
+
+    sxp -= vector.sxp;
+    syp -= vector.syp;
+    szp -= vector.szp;
+
+    return *this;
+}
+
+inline NxPoint &NxPoint::operator*=(qreal factor) {
+    xp *= factor;
+    yp *= factor;
+    zp *= factor;
+
+    sxp *= factor;
+    syp *= factor;
+    szp *= factor;
+
+    return *this;
+}
+
+inline NxPoint &NxPoint::operator*=(const NxPoint &vector) {
+    xp *= vector.xp;
+    yp *= vector.yp;
+    zp *= vector.zp;
+
+    sxp *= vector.sxp;
+    syp *= vector.syp;
+    szp *= vector.szp;
+
+    return *this;
+}
+
+inline NxPoint &NxPoint::operator/=(qreal divisor) {
+    xp /= divisor;
+    yp /= divisor;
+    zp /= divisor;
+
+    sxp *= divisor;
+    syp *= divisor;
+    szp *= divisor;
+
+    return *this;
+}
+
+inline bool operator==(const NxPoint &v1, const NxPoint &v2) {
+    return v1.xp == v2.xp && v1.yp == v2.yp && v1.zp == v2.zp && v1.sxp == v2.sxp && v1.syp == v2.syp && v1.szp == v2.szp;
+}
+
+inline bool operator!=(const NxPoint &v1, const NxPoint &v2) {
+    return v1.xp != v2.xp || v1.yp != v2.yp || v1.zp != v2.zp || v1.sxp != v2.sxp || v1.syp != v2.syp || v1.szp != v2.szp;
+}
+
+inline const NxPoint operator+(const NxPoint &v1, const NxPoint &v2) {
+    return NxPoint(v1.xp + v2.xp, v1.yp + v2.yp, v1.zp + v2.zp, v1.sxp + v2.sxp, v1.syp + v2.syp, v1.szp + v2.szp);
+}
+
+inline const NxPoint operator-(const NxPoint &v1, const NxPoint &v2) {
+    return NxPoint(v1.xp - v2.xp, v1.yp - v2.yp, v1.zp - v2.zp, v1.sxp - v2.sxp, v1.syp - v2.syp, v1.szp - v2.szp);
+}
+
+inline const NxPoint operator*(qreal factor, const NxPoint &vector) {
+    return NxPoint(vector.xp * factor, vector.yp * factor, vector.zp * factor, vector.sxp * factor, vector.syp * factor, vector.szp * factor);
+}
+
+inline const NxPoint operator*(const NxPoint &vector, qreal factor) {
+    return NxPoint(vector.xp * factor, vector.yp * factor, vector.zp * factor, vector.sxp * factor, vector.syp * factor, vector.szp * factor);
+}
+
+inline const NxPoint operator*(const NxPoint &v1, const NxPoint& v2) {
+    return NxPoint(v1.xp * v2.xp, v1.yp * v2.yp, v1.zp * v2.zp, v1.sxp * v2.sxp, v1.syp * v2.syp, v1.szp * v2.szp);
+}
+
+inline const NxPoint operator-(const NxPoint &vector) {
+    return NxPoint(-vector.xp, -vector.yp, -vector.zp, -vector.sxp, -vector.syp, -vector.szp);
+}
+
+inline const NxPoint operator/(const NxPoint &vector, qreal divisor) {
+    return NxPoint(vector.xp / divisor, vector.yp / divisor, vector.zp / divisor, vector.sxp / divisor, vector.syp / divisor, vector.szp / divisor);
+}
+
+inline bool qFuzzyCompare(const NxPoint& v1, const NxPoint& v2) {
+    return qFuzzyCompare(v1.xp, v2.xp) &&
+            qFuzzyCompare(v1.yp, v2.yp) &&
+            qFuzzyCompare(v1.zp, v2.zp) &&
+            qFuzzyCompare(v1.sxp, v2.sxp) &&
+            qFuzzyCompare(v1.syp, v2.syp) &&
+            qFuzzyCompare(v1.szp, v2.szp);
+}
+
+#endif
diff --git a/geometry/nxpolygon.cpp b/geometry/nxpolygon.cpp
index bb53ce4..ae5cef8 100644
--- a/geometry/nxpolygon.cpp
+++ b/geometry/nxpolygon.cpp
@@ -1,130 +1,130 @@
-/*
-    This file is part of IanniX, a graphical real-time open-source sequencer for digital art
-    Copyright (C) 2010-2015 — IanniX Association
-
-    Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
-
-    This file was written by Guillaume Jacquemin.
-
-    IanniX is a free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "nxpolygon.h"
-
-/*
-static void qt_polygon_isect_line(const NxPoint &p1, const NxPoint &p2, const NxPoint &pos, int *winding)
-{
-    qreal x1 = p1.x();
-    qreal y1 = p1.y();
-    //qreal z1 = p1.z();
-    qreal x2 = p2.x();
-    qreal y2 = p2.y();
-    //qreal z2 = p2.z();
-    qreal y = pos.y();
-
-    int dir = 1;
-
-    if (qFuzzyCompare(y1, y2)) {
-        // ignore horizontal lines according to scan conversion rule
-        return;
-    } else if (y2 < y1) {
-        qreal x_tmp = x2; x2 = x1; x1 = x_tmp;
-        qreal y_tmp = y2; y2 = y1; y1 = y_tmp;
-        dir = -1;
-    }
-
-    if (y >= y1 && y < y2) {
-        qreal x = x1 + ((x2 - x1) / (y2 - y1)) * (y - y1);
-
-        // count up the winding number if we're
-        if (x<=pos.x()) {
-            (*winding) += dir;
-        }
-    }
-}
-*/
-
-NxRect NxPolygon::boundingRect() const {
-    if (isEmpty())
-        return NxRect(0, 0, 0, 0, 0, 0);
-    register const NxPoint *pd = constData();
-    qreal minx, maxx, miny, maxy, minz, maxz;
-    minx = maxx = pd->x();
-    miny = maxy = pd->y();
-    minz = maxz = pd->z();
-    ++pd;
-    for (int i = 1; i < size(); ++i) {
-        if (pd->x() < minx)
-            minx = pd->x();
-        else if (pd->x() > maxx)
-            maxx = pd->x();
-        if (pd->y() < miny)
-            miny = pd->y();
-        else if (pd->y() > maxy)
-            maxy = pd->y();
-        if (pd->z() < minz)
-            minz = pd->z();
-        else if (pd->z() > maxz)
-            maxz = pd->z();
-        ++pd;
-    }
-    return NxRect(minx,miny,minz, maxx - minx, maxy - miny, maxz - minz);
-}
-
-
-bool NxPolygon::containsPoint(const NxPoint &pt, Qt::FillRule) const {
-    if (isEmpty())
-        return false;
-
-    /*
-    int winding_number = 0;
-
-    NxPoint last_pt = at(0);
-    NxPoint last_start = at(0);
-    for (int i = 1; i < size(); ++i) {
-        const NxPoint &e = at(i);
-        qt_polygon_isect_line(last_pt, e, pt, &winding_number);
-        last_pt = e;
-    }
-
-    // implicitly close last subpath
-    if (last_pt != last_start)
-        qt_polygon_isect_line(last_pt, last_start, pt, &winding_number);
-
-    return (fillRule == Qt::WindingFill
-            ? (winding_number != 0)
-            : ((winding_number % 2) != 0));
-    */
-    //qint16 sum = 0, sum2 = 0;
-    bool first = true, direction = true, directionOk = false;
-    for(quint16 i = 0 ; i < count() ; i++) {
-        NxPoint pt0 = at(i), pt1 = at((i+1)%count());
-        qreal val = (pt.y() - pt0.y()) * (pt1.x() - pt0.x()) - (pt.x() - pt0.x()) * (pt1.y() - pt0.y());
-        if(val > 0) {
-            if((!direction) && (directionOk) && (!first))
-                return false;
-            direction = true;
-            directionOk = true;
-        }
-        else if(val < 0) {
-            if((direction) && (directionOk) && (!first))
-                return false;
-            direction = false;
-            directionOk = true;
-        }
-        first = false;
-    }
-    return true;
-}
+/*
+    This file is part of IanniX, a graphical real-time open-source sequencer for digital art
+    Copyright (C) 2010-2015 — IanniX Association
+
+    Project Manager: Thierry Coduys (http://www.le-hub.org)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
+
+    This file was written by Guillaume Jacquemin.
+
+    IanniX is a free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "nxpolygon.h"
+
+/*
+static void qt_polygon_isect_line(const NxPoint &p1, const NxPoint &p2, const NxPoint &pos, int *winding)
+{
+    qreal x1 = p1.x();
+    qreal y1 = p1.y();
+    //qreal z1 = p1.z();
+    qreal x2 = p2.x();
+    qreal y2 = p2.y();
+    //qreal z2 = p2.z();
+    qreal y = pos.y();
+
+    int dir = 1;
+
+    if (qFuzzyCompare(y1, y2)) {
+        // ignore horizontal lines according to scan conversion rule
+        return;
+    } else if (y2 < y1) {
+        qreal x_tmp = x2; x2 = x1; x1 = x_tmp;
+        qreal y_tmp = y2; y2 = y1; y1 = y_tmp;
+        dir = -1;
+    }
+
+    if (y >= y1 && y < y2) {
+        qreal x = x1 + ((x2 - x1) / (y2 - y1)) * (y - y1);
+
+        // count up the winding number if we're
+        if (x<=pos.x()) {
+            (*winding) += dir;
+        }
+    }
+}
+*/
+
+NxRect NxPolygon::boundingRect() const {
+    if (isEmpty())
+        return NxRect(0, 0, 0, 0, 0, 0);
+    register const NxPoint *pd = constData();
+    qreal minx, maxx, miny, maxy, minz, maxz;
+    minx = maxx = pd->x();
+    miny = maxy = pd->y();
+    minz = maxz = pd->z();
+    ++pd;
+    for (int i = 1; i < size(); ++i) {
+        if (pd->x() < minx)
+            minx = pd->x();
+        else if (pd->x() > maxx)
+            maxx = pd->x();
+        if (pd->y() < miny)
+            miny = pd->y();
+        else if (pd->y() > maxy)
+            maxy = pd->y();
+        if (pd->z() < minz)
+            minz = pd->z();
+        else if (pd->z() > maxz)
+            maxz = pd->z();
+        ++pd;
+    }
+    return NxRect(minx,miny,minz, maxx - minx, maxy - miny, maxz - minz);
+}
+
+
+bool NxPolygon::containsPoint(const NxPoint &pt, Qt::FillRule) const {
+    if (isEmpty())
+        return false;
+
+    /*
+    int winding_number = 0;
+
+    NxPoint last_pt = at(0);
+    NxPoint last_start = at(0);
+    for (int i = 1; i < size(); ++i) {
+        const NxPoint &e = at(i);
+        qt_polygon_isect_line(last_pt, e, pt, &winding_number);
+        last_pt = e;
+    }
+
+    // implicitly close last subpath
+    if (last_pt != last_start)
+        qt_polygon_isect_line(last_pt, last_start, pt, &winding_number);
+
+    return (fillRule == Qt::WindingFill
+            ? (winding_number != 0)
+            : ((winding_number % 2) != 0));
+    */
+    //qint16 sum = 0, sum2 = 0;
+    bool first = true, direction = true, directionOk = false;
+    for(quint16 i = 0 ; i < count() ; i++) {
+        NxPoint pt0 = at(i), pt1 = at((i+1)%count());
+        qreal val = (pt.y() - pt0.y()) * (pt1.x() - pt0.x()) - (pt.x() - pt0.x()) * (pt1.y() - pt0.y());
+        if(val > 0) {
+            if((!direction) && (directionOk) && (!first))
+                return false;
+            direction = true;
+            directionOk = true;
+        }
+        else if(val < 0) {
+            if((direction) && (directionOk) && (!first))
+                return false;
+            direction = false;
+            directionOk = true;
+        }
+        first = false;
+    }
+    return true;
+}
diff --git a/geometry/nxpolygon.h b/geometry/nxpolygon.h
index d9c3660..4cb6679 100644
--- a/geometry/nxpolygon.h
+++ b/geometry/nxpolygon.h
@@ -1,47 +1,47 @@
-/*
-    This file is part of IanniX, a graphical real-time open-source sequencer for digital art
-    Copyright (C) 2010-2015 — IanniX Association
-
-    Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
-
-    This file was written by Guillaume Jacquemin.
-
-    IanniX is a free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef NXPOLYGON_H
-#define NXPOLYGON_H
-
-#include <QVector>
-#include "nxpoint.h"
-#include "nxrect.h"
-#include "math.h"
-
-class NxPolygon : public QVector<NxPoint> {
-public:
-    inline NxPolygon() {}
-    inline ~NxPolygon() {}
-    inline NxPolygon(int size);
-    inline NxPolygon(const NxPolygon &a) : QVector<NxPoint>(a) {}
-    inline NxPolygon(const QVector<NxPoint> &v) : QVector<NxPoint>(v) {}
-    NxPolygon(const QPolygon &a);
-
-    NxRect boundingRect() const;
-    bool containsPoint(const NxPoint &pt, Qt::FillRule fillRule) const;
-};
-
-inline NxPolygon::NxPolygon(int asize) : QVector<NxPoint>(asize) {}
-
-#endif // NXPOLYGON_H
+/*
+    This file is part of IanniX, a graphical real-time open-source sequencer for digital art
+    Copyright (C) 2010-2015 — IanniX Association
+
+    Project Manager: Thierry Coduys (http://www.le-hub.org)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
+
+    This file was written by Guillaume Jacquemin.
+
+    IanniX is a free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef NXPOLYGON_H
+#define NXPOLYGON_H
+
+#include <QVector>
+#include "nxpoint.h"
+#include "nxrect.h"
+#include "math.h"
+
+class NxPolygon : public QVector<NxPoint> {
+public:
+    inline NxPolygon() {}
+    inline ~NxPolygon() {}
+    inline NxPolygon(int size);
+    inline NxPolygon(const NxPolygon &a) : QVector<NxPoint>(a) {}
+    inline NxPolygon(const QVector<NxPoint> &v) : QVector<NxPoint>(v) {}
+    NxPolygon(const QPolygon &a);
+
+    NxRect boundingRect() const;
+    bool containsPoint(const NxPoint &pt, Qt::FillRule fillRule) const;
+};
+
+inline NxPolygon::NxPolygon(int asize) : QVector<NxPoint>(asize) {}
+
+#endif // NXPOLYGON_H
diff --git a/geometry/nxrect.cpp b/geometry/nxrect.cpp
index ce0cf7f..7b8080f 100644
--- a/geometry/nxrect.cpp
+++ b/geometry/nxrect.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/geometry/nxrect.h b/geometry/nxrect.h
index 6deeb8c..71d1f10 100644
--- a/geometry/nxrect.h
+++ b/geometry/nxrect.h
@@ -1,386 +1,386 @@
-/*
-    This file is part of IanniX, a graphical real-time open-source sequencer for digital art
-    Copyright (C) 2010-2015 — IanniX Association
-
-    Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
-
-    This file was written by Guillaume Jacquemin.
-
-    IanniX is a free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef NXRECT_H
-#define NXRECT_H
-
-#include <QVariant>
-#include "nxpoint.h"
-#include "nxsize.h"
-
-class NxRect {
-public:
-    NxRect() { xp = yp = zp = 0.; w = h = l = 0.; }
-    NxRect(const NxPoint &topleft, const NxSize &size);
-    NxRect(const NxPoint &topleft, const NxPoint &bottomRight);
-    NxRect(qreal left, qreal top, qreal width, qreal height);
-    NxRect(qreal left, qreal top, qreal z, qreal width, qreal height, qreal length);
-    NxRect(const QRect &rect);
-
-    bool isNull() const;
-    bool isEmpty() const;
-    bool isValid() const;
-    NxRect normalized() const;
-
-    inline qreal left()    const { return xp; }
-    inline qreal right()   const { return xp + w; }
-    inline qreal top()     const { return yp; }
-    inline qreal bottom()  const { return yp + h; }
-    inline qreal zTop()    const { return zp; }
-    inline qreal zBottom() const { return zp + l; }
-
-    inline qreal x() const;
-    inline qreal y() const;
-    inline qreal z() const;
-    inline void setLeft(qreal pos);
-    inline void setRight(qreal pos);
-    inline void setTop(qreal pos);
-    inline void setBottom(qreal pos);
-    inline void setzTop(qreal pos);
-    inline void setzBottom(qreal pos);
-    inline void setX(qreal pos) { setLeft(pos); }
-    inline void setY(qreal pos) { setTop(pos); }
-
-    inline NxPoint topLeft() const     { return NxPoint(xp,   yp,   zp); }
-    inline NxPoint topRight() const    { return NxPoint(xp+w, yp,   zp); }
-    inline NxPoint bottomLeft() const  { return NxPoint(xp,   yp+h, zp+l); }
-    inline NxPoint bottomRight() const { return NxPoint(xp+w, yp+h, zp+l); }
-    inline NxPoint center() const;
-
-    void setTopLeft(const NxPoint &p);
-    void setBottomRight(const NxPoint &p);
-    void setTopRight(const NxPoint &p);
-    void setBottomLeft(const NxPoint &p);
-
-    void moveLeft(qreal pos);
-    void moveTop(qreal pos);
-    void moveRight(qreal pos);
-    void moveBottom(qreal pos);
-    void moveTopLeft(const NxPoint &p);
-    void moveBottomRight(const NxPoint &p);
-    void moveTopRight(const NxPoint &p);
-    void moveBottomLeft(const NxPoint &p);
-    void moveCenter(const NxPoint &p);
-
-    void translate(qreal dx, qreal dy, qreal dz);
-    void translate(const NxPoint &p);
-
-    NxRect translated(qreal dx, qreal dy, qreal dz) const;
-    NxRect translated(const NxPoint &p) const;
-
-    void moveTo(qreal x, qreal y, qreal z);
-    void moveTo(const NxPoint &p);
-
-    void setRect(qreal x, qreal y, qreal z, qreal w, qreal h, qreal l);
-    void getRect(qreal *x, qreal *y, qreal *z, qreal *w, qreal *h, qreal *l) const;
-
-    void setCoords(qreal x1, qreal y1, qreal z1, qreal x2, qreal y2, qreal z2);
-    void getCoords(qreal *x1, qreal *y1, qreal *z1, qreal *x2, qreal *y2, qreal *z2) const;
-
-    inline void adjust(qreal x1, qreal y1, qreal z1, qreal x2, qreal y2, qreal z2);
-    inline NxRect adjusted(qreal x1, qreal y1, qreal z1, qreal x2, qreal y2, qreal z2) const;
-
-    NxSize size() const;
-    qreal width() const;
-    qreal height() const;
-    qreal length() const;
-    void setWidth(qreal w);
-    void setHeight(qreal h);
-    void setLength(qreal l);
-    void setSize(const NxSize &s);
-
-    NxRect operator|(const NxRect &r) const;
-    NxRect operator&(const NxRect &r) const;
-    NxRect& operator|=(const NxRect &r);
-    NxRect& operator&=(const NxRect &r);
-
-    bool contains(const NxPoint &p) const;
-    bool contains(qreal x, qreal y, qreal z) const;
-    bool contains(const NxRect &r) const;
-    NxRect unite(const NxRect &r) const;  // ### Qt 5: make QT4_SUPPORT
-    NxRect united(const NxRect &other) const;
-    NxRect intersect(const NxRect &r) const;  // ### Qt 5: make QT4_SUPPORT
-    NxRect intersected(const NxRect &other) const;
-    bool intersects(const NxRect &r) const;
-
-    friend bool operator==(const NxRect &, const NxRect &);
-    friend bool operator!=(const NxRect &, const NxRect &);
-
-private:
-    qreal xp;
-    qreal yp;
-    qreal zp;
-    qreal w;
-    qreal h;
-    qreal l;
-};
-Q_DECLARE_TYPEINFO(NxRect, Q_MOVABLE_TYPE);
-
-bool operator==(const NxRect &, const NxRect &);
-bool operator!=(const NxRect &, const NxRect &);
-
-
-/*****************************************************************************
-  NxRect inline member functions
- *****************************************************************************/
-
-inline NxRect::NxRect(qreal aleft, qreal atop, qreal az, qreal awidth, qreal aheight, qreal alength)
-    : xp(aleft), yp(atop), zp(az), w(awidth), h(aheight), l(alength)
-{}
-
-inline NxRect::NxRect(qreal aleft, qreal atop, qreal awidth, qreal aheight)
-    : xp(aleft), yp(atop), zp(0), w(awidth), h(aheight), l(0)
-{}
-
-inline NxRect::NxRect(const NxPoint &atopLeft, const NxSize &asize)
-{
-    xp = atopLeft.x();
-    yp = atopLeft.y();
-    zp = atopLeft.z();
-    w = asize.width();
-    h = asize.height();
-    l = asize.length();
-}
-
-inline NxRect::NxRect(const NxPoint &atopLeft, const NxPoint &abottomRight)
-{
-    xp = atopLeft.x();
-    yp = atopLeft.y();
-    zp = atopLeft.z();
-    w = abottomRight.x() - xp;
-    h = abottomRight.y() - yp;
-    l = abottomRight.z() - zp;
-}
-
-
-inline bool NxRect::isNull() const
-{ return w == 0. && h == 0. && l == 0.; }
-
-inline bool NxRect::isEmpty() const
-{ return w <= 0. || h <= 0. || l <= 0.; }
-
-inline bool NxRect::isValid() const
-{ return w > 0. && h > 0. && l > 0.; }
-
-inline qreal NxRect::x() const
-{ return xp; }
-
-inline qreal NxRect::y() const
-{ return yp; }
-
-inline qreal NxRect::z() const
-{ return zp; }
-
-inline void NxRect::setLeft(qreal pos)    { qreal diff = pos - xp; xp += diff; w -= diff; }
-inline void NxRect::setRight(qreal pos)   { w = pos - xp; }
-inline void NxRect::setTop(qreal pos)     { qreal diff = pos - yp; yp += diff; h -= diff; }
-inline void NxRect::setBottom(qreal pos)  { h = pos - yp; }
-inline void NxRect::setzTop(qreal pos)    { l = pos - zp; }
-inline void NxRect::setzBottom(qreal pos) { qreal diff = pos - zp; zp += diff; l -= diff; }
-
-
-inline void NxRect::setTopLeft(const NxPoint &p)     { setLeft(p.x());  setTop(p.y());    setzTop(p.z()); }
-inline void NxRect::setTopRight(const NxPoint &p)    { setRight(p.x()); setTop(p.y());    setzTop(p.z()); }
-inline void NxRect::setBottomLeft(const NxPoint &p)  { setLeft(p.x());  setBottom(p.y()); setzBottom(p.z()); }
-inline void NxRect::setBottomRight(const NxPoint &p) { setRight(p.x()); setBottom(p.y()); setzBottom(p.z()); }
-
-inline NxPoint NxRect::center() const
-{ return NxPoint(xp + w/2, yp + h/2, zp + l/2); }
-
-inline void NxRect::moveLeft(qreal pos) { xp = pos; }
-
-inline void NxRect::moveTop(qreal pos) { yp = pos; }
-
-inline void NxRect::moveRight(qreal pos) { xp = pos - w; }
-
-inline void NxRect::moveBottom(qreal pos) { yp = pos - h; }
-
-inline void NxRect::moveTopLeft(const NxPoint &p) { moveLeft(p.x()); moveTop(p.y()); }
-
-inline void NxRect::moveTopRight(const NxPoint &p) { moveRight(p.x()); moveTop(p.y()); }
-
-inline void NxRect::moveBottomLeft(const NxPoint &p) { moveLeft(p.x()); moveBottom(p.y()); }
-
-inline void NxRect::moveBottomRight(const NxPoint &p) { moveRight(p.x()); moveBottom(p.y()); }
-
-inline void NxRect::moveCenter(const NxPoint &p) { xp = p.x() - w/2; yp = p.y() - h/2; }
-
-inline qreal NxRect::width() const
-{ return w; }
-
-inline qreal NxRect::height() const
-{ return h; }
-
-inline qreal NxRect::length() const
-{ return l; }
-
-inline NxSize NxRect::size() const
-{ return NxSize(w, h, l); }
-
-inline void NxRect::translate(qreal dx, qreal dy, qreal dz)
-{
-    xp += dx;
-    yp += dy;
-    zp += dz;
-}
-
-inline void NxRect::translate(const NxPoint &p)
-{
-    xp += p.x();
-    yp += p.y();
-    zp += p.z();
-}
-
-inline void NxRect::moveTo(qreal ax, qreal ay, qreal az)
-{
-    xp = ax;
-    yp = ay;
-    zp = az;
-}
-
-inline void NxRect::moveTo(const NxPoint &p)
-{
-    xp = p.x();
-    yp = p.y();
-    zp = p.z();
-}
-
-inline NxRect NxRect::translated(qreal dx, qreal dy, qreal dz) const
-{ return NxRect(xp + dx, yp + dy, zp + dz, w, h, l); }
-
-inline NxRect NxRect::translated(const NxPoint &p) const
-{ return NxRect(xp + p.x(), yp + p.y(), zp + p.z(), w, h, l); }
-
-inline void NxRect::getRect(qreal *ax, qreal *ay, qreal *az, qreal *aaw, qreal *aah, qreal *aal) const
-{
-    *ax = this->xp;
-    *ay = this->yp;
-    *az = this->zp;
-    *aaw = this->w;
-    *aah = this->h;
-    *aal = this->l;
-}
-
-inline void NxRect::setRect(qreal ax, qreal ay, qreal az, qreal aaw, qreal aah, qreal aal)
-{
-    this->xp = ax;
-    this->yp = ay;
-    this->zp = az;
-    this->w = aaw;
-    this->h = aah;
-    this->l = aal;
-}
-
-inline void NxRect::getCoords(qreal *xp1, qreal *yp1, qreal *zp1, qreal *xp2, qreal *yp2, qreal *zp2) const
-{
-    *xp1 = xp;
-    *yp1 = yp;
-    *zp1 = zp;
-    *xp2 = xp + w;
-    *yp2 = yp + h;
-    *zp2 = zp + l;
-}
-
-inline void NxRect::setCoords(qreal xp1, qreal yp1, qreal zp1, qreal xp2, qreal yp2, qreal zp2)
-{
-    xp = xp1;
-    yp = yp1;
-    zp = zp1;
-    w = xp2 - xp1;
-    h = yp2 - yp1;
-    l = zp2 - zp1;
-}
-
-inline void NxRect::adjust(qreal xp1, qreal yp1, qreal zp1, qreal xp2, qreal yp2, qreal zp2)
-{ xp += xp1; yp += yp1; zp += zp1; w += xp2 - xp1; h += yp2 - yp1; l += zp2 - zp1; }
-
-inline NxRect NxRect::adjusted(qreal xp1, qreal yp1, qreal zp1, qreal xp2, qreal yp2, qreal zp2) const
-{ return NxRect(xp + xp1, yp + yp1, zp + zp1, w + xp2 - xp1, h + yp2 - yp1, l + zp2 - zp1); }
-
-inline void NxRect::setWidth(qreal aw)
-{ this->w = aw; }
-
-inline void NxRect::setHeight(qreal ah)
-{ this->h = ah; }
-
-inline void NxRect::setLength(qreal al)
-{ this->l = al; }
-
-
-inline void NxRect::setSize(const NxSize &s)
-{
-    w = s.width();
-    h = s.height();
-    l = s.length();
-}
-
-inline bool NxRect::contains(qreal ax, qreal ay, qreal az) const
-{
-    return contains(NxPoint(ax, ay, az));
-}
-
-inline NxRect& NxRect::operator|=(const NxRect &r)
-{
-    *this = *this | r;
-    return *this;
-}
-
-inline NxRect& NxRect::operator&=(const NxRect &r)
-{
-    *this = *this & r;
-    return *this;
-}
-
-inline NxRect NxRect::intersect(const NxRect &r) const
-{
-    return *this & r;
-}
-
-inline NxRect NxRect::intersected(const NxRect &r) const
-{
-    return intersect(r);
-}
-
-inline NxRect NxRect::unite(const NxRect &r) const
-{
-    return *this | r;
-}
-
-inline NxRect NxRect::united(const NxRect &r) const
-{
-    return unite(r);
-}
-
-inline bool operator==(const NxRect &r1, const NxRect &r2)
-{
-    return qFuzzyCompare(r1.xp, r2.xp) && qFuzzyCompare(r1.yp, r2.yp) && qFuzzyCompare(r1.zp, r2.zp)
-           && qFuzzyCompare(r1.w, r2.w) && qFuzzyCompare(r1.h, r2.h) && qFuzzyCompare(r1.l, r2.l);
-}
-
-inline bool operator!=(const NxRect &r1, const NxRect &r2)
-{
-    return !qFuzzyCompare(r1.xp, r2.xp) || !qFuzzyCompare(r1.yp, r2.yp) || !qFuzzyCompare(r1.zp, r2.zp)
-           || !qFuzzyCompare(r1.w, r2.w) || !qFuzzyCompare(r1.h, r2.h) || !qFuzzyCompare(r1.l, r2.l);
-}
-
-#endif // NXRECT_H
+/*
+    This file is part of IanniX, a graphical real-time open-source sequencer for digital art
+    Copyright (C) 2010-2015 — IanniX Association
+
+    Project Manager: Thierry Coduys (http://www.le-hub.org)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
+
+    This file was written by Guillaume Jacquemin.
+
+    IanniX is a free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef NXRECT_H
+#define NXRECT_H
+
+#include <QVariant>
+#include "nxpoint.h"
+#include "nxsize.h"
+
+class NxRect {
+public:
+    NxRect() { xp = yp = zp = 0.; w = h = l = 0.; }
+    NxRect(const NxPoint &topleft, const NxSize &size);
+    NxRect(const NxPoint &topleft, const NxPoint &bottomRight);
+    NxRect(qreal left, qreal top, qreal width, qreal height);
+    NxRect(qreal left, qreal top, qreal z, qreal width, qreal height, qreal length);
+    NxRect(const QRect &rect);
+
+    bool isNull() const;
+    bool isEmpty() const;
+    bool isValid() const;
+    NxRect normalized() const;
+
+    inline qreal left()    const { return xp; }
+    inline qreal right()   const { return xp + w; }
+    inline qreal top()     const { return yp; }
+    inline qreal bottom()  const { return yp + h; }
+    inline qreal zTop()    const { return zp; }
+    inline qreal zBottom() const { return zp + l; }
+
+    inline qreal x() const;
+    inline qreal y() const;
+    inline qreal z() const;
+    inline void setLeft(qreal pos);
+    inline void setRight(qreal pos);
+    inline void setTop(qreal pos);
+    inline void setBottom(qreal pos);
+    inline void setzTop(qreal pos);
+    inline void setzBottom(qreal pos);
+    inline void setX(qreal pos) { setLeft(pos); }
+    inline void setY(qreal pos) { setTop(pos); }
+
+    inline NxPoint topLeft() const     { return NxPoint(xp,   yp,   zp); }
+    inline NxPoint topRight() const    { return NxPoint(xp+w, yp,   zp); }
+    inline NxPoint bottomLeft() const  { return NxPoint(xp,   yp+h, zp+l); }
+    inline NxPoint bottomRight() const { return NxPoint(xp+w, yp+h, zp+l); }
+    inline NxPoint center() const;
+
+    void setTopLeft(const NxPoint &p);
+    void setBottomRight(const NxPoint &p);
+    void setTopRight(const NxPoint &p);
+    void setBottomLeft(const NxPoint &p);
+
+    void moveLeft(qreal pos);
+    void moveTop(qreal pos);
+    void moveRight(qreal pos);
+    void moveBottom(qreal pos);
+    void moveTopLeft(const NxPoint &p);
+    void moveBottomRight(const NxPoint &p);
+    void moveTopRight(const NxPoint &p);
+    void moveBottomLeft(const NxPoint &p);
+    void moveCenter(const NxPoint &p);
+
+    void translate(qreal dx, qreal dy, qreal dz);
+    void translate(const NxPoint &p);
+
+    NxRect translated(qreal dx, qreal dy, qreal dz) const;
+    NxRect translated(const NxPoint &p) const;
+
+    void moveTo(qreal x, qreal y, qreal z);
+    void moveTo(const NxPoint &p);
+
+    void setRect(qreal x, qreal y, qreal z, qreal w, qreal h, qreal l);
+    void getRect(qreal *x, qreal *y, qreal *z, qreal *w, qreal *h, qreal *l) const;
+
+    void setCoords(qreal x1, qreal y1, qreal z1, qreal x2, qreal y2, qreal z2);
+    void getCoords(qreal *x1, qreal *y1, qreal *z1, qreal *x2, qreal *y2, qreal *z2) const;
+
+    inline void adjust(qreal x1, qreal y1, qreal z1, qreal x2, qreal y2, qreal z2);
+    inline NxRect adjusted(qreal x1, qreal y1, qreal z1, qreal x2, qreal y2, qreal z2) const;
+
+    NxSize size() const;
+    qreal width() const;
+    qreal height() const;
+    qreal length() const;
+    void setWidth(qreal w);
+    void setHeight(qreal h);
+    void setLength(qreal l);
+    void setSize(const NxSize &s);
+
+    NxRect operator|(const NxRect &r) const;
+    NxRect operator&(const NxRect &r) const;
+    NxRect& operator|=(const NxRect &r);
+    NxRect& operator&=(const NxRect &r);
+
+    bool contains(const NxPoint &p) const;
+    bool contains(qreal x, qreal y, qreal z) const;
+    bool contains(const NxRect &r) const;
+    NxRect unite(const NxRect &r) const;  // ### Qt 5: make QT4_SUPPORT
+    NxRect united(const NxRect &other) const;
+    NxRect intersect(const NxRect &r) const;  // ### Qt 5: make QT4_SUPPORT
+    NxRect intersected(const NxRect &other) const;
+    bool intersects(const NxRect &r) const;
+
+    friend bool operator==(const NxRect &, const NxRect &);
+    friend bool operator!=(const NxRect &, const NxRect &);
+
+private:
+    qreal xp;
+    qreal yp;
+    qreal zp;
+    qreal w;
+    qreal h;
+    qreal l;
+};
+Q_DECLARE_TYPEINFO(NxRect, Q_MOVABLE_TYPE);
+
+bool operator==(const NxRect &, const NxRect &);
+bool operator!=(const NxRect &, const NxRect &);
+
+
+/*****************************************************************************
+  NxRect inline member functions
+ *****************************************************************************/
+
+inline NxRect::NxRect(qreal aleft, qreal atop, qreal az, qreal awidth, qreal aheight, qreal alength)
+    : xp(aleft), yp(atop), zp(az), w(awidth), h(aheight), l(alength)
+{}
+
+inline NxRect::NxRect(qreal aleft, qreal atop, qreal awidth, qreal aheight)
+    : xp(aleft), yp(atop), zp(0), w(awidth), h(aheight), l(0)
+{}
+
+inline NxRect::NxRect(const NxPoint &atopLeft, const NxSize &asize)
+{
+    xp = atopLeft.x();
+    yp = atopLeft.y();
+    zp = atopLeft.z();
+    w = asize.width();
+    h = asize.height();
+    l = asize.length();
+}
+
+inline NxRect::NxRect(const NxPoint &atopLeft, const NxPoint &abottomRight)
+{
+    xp = atopLeft.x();
+    yp = atopLeft.y();
+    zp = atopLeft.z();
+    w = abottomRight.x() - xp;
+    h = abottomRight.y() - yp;
+    l = abottomRight.z() - zp;
+}
+
+
+inline bool NxRect::isNull() const
+{ return w == 0. && h == 0. && l == 0.; }
+
+inline bool NxRect::isEmpty() const
+{ return w <= 0. || h <= 0. || l <= 0.; }
+
+inline bool NxRect::isValid() const
+{ return w > 0. && h > 0. && l > 0.; }
+
+inline qreal NxRect::x() const
+{ return xp; }
+
+inline qreal NxRect::y() const
+{ return yp; }
+
+inline qreal NxRect::z() const
+{ return zp; }
+
+inline void NxRect::setLeft(qreal pos)    { qreal diff = pos - xp; xp += diff; w -= diff; }
+inline void NxRect::setRight(qreal pos)   { w = pos - xp; }
+inline void NxRect::setTop(qreal pos)     { qreal diff = pos - yp; yp += diff; h -= diff; }
+inline void NxRect::setBottom(qreal pos)  { h = pos - yp; }
+inline void NxRect::setzTop(qreal pos)    { l = pos - zp; }
+inline void NxRect::setzBottom(qreal pos) { qreal diff = pos - zp; zp += diff; l -= diff; }
+
+
+inline void NxRect::setTopLeft(const NxPoint &p)     { setLeft(p.x());  setTop(p.y());    setzTop(p.z()); }
+inline void NxRect::setTopRight(const NxPoint &p)    { setRight(p.x()); setTop(p.y());    setzTop(p.z()); }
+inline void NxRect::setBottomLeft(const NxPoint &p)  { setLeft(p.x());  setBottom(p.y()); setzBottom(p.z()); }
+inline void NxRect::setBottomRight(const NxPoint &p) { setRight(p.x()); setBottom(p.y()); setzBottom(p.z()); }
+
+inline NxPoint NxRect::center() const
+{ return NxPoint(xp + w/2, yp + h/2, zp + l/2); }
+
+inline void NxRect::moveLeft(qreal pos) { xp = pos; }
+
+inline void NxRect::moveTop(qreal pos) { yp = pos; }
+
+inline void NxRect::moveRight(qreal pos) { xp = pos - w; }
+
+inline void NxRect::moveBottom(qreal pos) { yp = pos - h; }
+
+inline void NxRect::moveTopLeft(const NxPoint &p) { moveLeft(p.x()); moveTop(p.y()); }
+
+inline void NxRect::moveTopRight(const NxPoint &p) { moveRight(p.x()); moveTop(p.y()); }
+
+inline void NxRect::moveBottomLeft(const NxPoint &p) { moveLeft(p.x()); moveBottom(p.y()); }
+
+inline void NxRect::moveBottomRight(const NxPoint &p) { moveRight(p.x()); moveBottom(p.y()); }
+
+inline void NxRect::moveCenter(const NxPoint &p) { xp = p.x() - w/2; yp = p.y() - h/2; }
+
+inline qreal NxRect::width() const
+{ return w; }
+
+inline qreal NxRect::height() const
+{ return h; }
+
+inline qreal NxRect::length() const
+{ return l; }
+
+inline NxSize NxRect::size() const
+{ return NxSize(w, h, l); }
+
+inline void NxRect::translate(qreal dx, qreal dy, qreal dz)
+{
+    xp += dx;
+    yp += dy;
+    zp += dz;
+}
+
+inline void NxRect::translate(const NxPoint &p)
+{
+    xp += p.x();
+    yp += p.y();
+    zp += p.z();
+}
+
+inline void NxRect::moveTo(qreal ax, qreal ay, qreal az)
+{
+    xp = ax;
+    yp = ay;
+    zp = az;
+}
+
+inline void NxRect::moveTo(const NxPoint &p)
+{
+    xp = p.x();
+    yp = p.y();
+    zp = p.z();
+}
+
+inline NxRect NxRect::translated(qreal dx, qreal dy, qreal dz) const
+{ return NxRect(xp + dx, yp + dy, zp + dz, w, h, l); }
+
+inline NxRect NxRect::translated(const NxPoint &p) const
+{ return NxRect(xp + p.x(), yp + p.y(), zp + p.z(), w, h, l); }
+
+inline void NxRect::getRect(qreal *ax, qreal *ay, qreal *az, qreal *aaw, qreal *aah, qreal *aal) const
+{
+    *ax = this->xp;
+    *ay = this->yp;
+    *az = this->zp;
+    *aaw = this->w;
+    *aah = this->h;
+    *aal = this->l;
+}
+
+inline void NxRect::setRect(qreal ax, qreal ay, qreal az, qreal aaw, qreal aah, qreal aal)
+{
+    this->xp = ax;
+    this->yp = ay;
+    this->zp = az;
+    this->w = aaw;
+    this->h = aah;
+    this->l = aal;
+}
+
+inline void NxRect::getCoords(qreal *xp1, qreal *yp1, qreal *zp1, qreal *xp2, qreal *yp2, qreal *zp2) const
+{
+    *xp1 = xp;
+    *yp1 = yp;
+    *zp1 = zp;
+    *xp2 = xp + w;
+    *yp2 = yp + h;
+    *zp2 = zp + l;
+}
+
+inline void NxRect::setCoords(qreal xp1, qreal yp1, qreal zp1, qreal xp2, qreal yp2, qreal zp2)
+{
+    xp = xp1;
+    yp = yp1;
+    zp = zp1;
+    w = xp2 - xp1;
+    h = yp2 - yp1;
+    l = zp2 - zp1;
+}
+
+inline void NxRect::adjust(qreal xp1, qreal yp1, qreal zp1, qreal xp2, qreal yp2, qreal zp2)
+{ xp += xp1; yp += yp1; zp += zp1; w += xp2 - xp1; h += yp2 - yp1; l += zp2 - zp1; }
+
+inline NxRect NxRect::adjusted(qreal xp1, qreal yp1, qreal zp1, qreal xp2, qreal yp2, qreal zp2) const
+{ return NxRect(xp + xp1, yp + yp1, zp + zp1, w + xp2 - xp1, h + yp2 - yp1, l + zp2 - zp1); }
+
+inline void NxRect::setWidth(qreal aw)
+{ this->w = aw; }
+
+inline void NxRect::setHeight(qreal ah)
+{ this->h = ah; }
+
+inline void NxRect::setLength(qreal al)
+{ this->l = al; }
+
+
+inline void NxRect::setSize(const NxSize &s)
+{
+    w = s.width();
+    h = s.height();
+    l = s.length();
+}
+
+inline bool NxRect::contains(qreal ax, qreal ay, qreal az) const
+{
+    return contains(NxPoint(ax, ay, az));
+}
+
+inline NxRect& NxRect::operator|=(const NxRect &r)
+{
+    *this = *this | r;
+    return *this;
+}
+
+inline NxRect& NxRect::operator&=(const NxRect &r)
+{
+    *this = *this & r;
+    return *this;
+}
+
+inline NxRect NxRect::intersect(const NxRect &r) const
+{
+    return *this & r;
+}
+
+inline NxRect NxRect::intersected(const NxRect &r) const
+{
+    return intersect(r);
+}
+
+inline NxRect NxRect::unite(const NxRect &r) const
+{
+    return *this | r;
+}
+
+inline NxRect NxRect::united(const NxRect &r) const
+{
+    return unite(r);
+}
+
+inline bool operator==(const NxRect &r1, const NxRect &r2)
+{
+    return qFuzzyCompare(r1.xp, r2.xp) && qFuzzyCompare(r1.yp, r2.yp) && qFuzzyCompare(r1.zp, r2.zp)
+           && qFuzzyCompare(r1.w, r2.w) && qFuzzyCompare(r1.h, r2.h) && qFuzzyCompare(r1.l, r2.l);
+}
+
+inline bool operator!=(const NxRect &r1, const NxRect &r2)
+{
+    return !qFuzzyCompare(r1.xp, r2.xp) || !qFuzzyCompare(r1.yp, r2.yp) || !qFuzzyCompare(r1.zp, r2.zp)
+           || !qFuzzyCompare(r1.w, r2.w) || !qFuzzyCompare(r1.h, r2.h) || !qFuzzyCompare(r1.l, r2.l);
+}
+
+#endif // NXRECT_H
diff --git a/geometry/nxsize.cpp b/geometry/nxsize.cpp
index e7509e0..a3beb3d 100644
--- a/geometry/nxsize.cpp
+++ b/geometry/nxsize.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/geometry/nxsize.h b/geometry/nxsize.h
index 01d5afb..def4539 100644
--- a/geometry/nxsize.h
+++ b/geometry/nxsize.h
@@ -1,165 +1,165 @@
-/*
-    This file is part of IanniX, a graphical real-time open-source sequencer for digital art
-    Copyright (C) 2010-2015 — IanniX Association
-
-    Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
-
-    This file was written by Guillaume Jacquemin.
-
-    IanniX is a free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef NXSIZE_H
-#define NXSIZE_H
-
-#include <QVariant>
-
-class NxSize {
-public:
-    NxSize();
-    NxSize(qreal w, qreal h);
-    NxSize(qreal w, qreal h, qreal l);
-
-    bool isNull() const;
-    bool isEmpty() const;
-    bool isValid() const;
-
-    qreal width() const;
-    qreal height() const;
-    qreal length() const;
-    void setWidth(qreal w);
-    void setHeight(qreal h);
-    void setLength(qreal l);
-    void transpose();
-
-    void scale(qreal w, qreal h, qreal l, Qt::AspectRatioMode mode);
-    void scale(const NxSize &s, Qt::AspectRatioMode mode);
-
-    qreal &rwidth();
-    qreal &rheight();
-    qreal &rlength();
-
-    NxSize &operator+=(const NxSize &);
-    NxSize &operator-=(const NxSize &);
-    NxSize &operator*=(qreal c);
-    NxSize &operator/=(qreal c);
-
-    friend inline bool operator==(const NxSize &, const NxSize &);
-    friend inline bool operator!=(const NxSize &, const NxSize &);
-    friend inline const NxSize operator+(const NxSize &, const NxSize &);
-    friend inline const NxSize operator-(const NxSize &, const NxSize &);
-    friend inline const NxSize operator*(const NxSize &, qreal);
-    friend inline const NxSize operator*(qreal, const NxSize &);
-    friend inline const NxSize operator/(const NxSize &, qreal);
-
-private:
-    qreal wd;
-    qreal ht;
-    qreal lg;
-};
-Q_DECLARE_TYPEINFO(NxSize, Q_MOVABLE_TYPE);
-
-
-/*****************************************************************************
-  NxSize inline functions
- *****************************************************************************/
-
-inline NxSize::NxSize()
-{ wd = ht = lg = -1.; }
-
-inline NxSize::NxSize(qreal w, qreal h, qreal l)
-{ wd = w; ht = h; lg = l; }
-
-inline NxSize::NxSize(qreal w, qreal h)
-{ wd = w; ht = h; lg = 0; }
-
-inline bool NxSize::isNull() const
-{ return qIsNull(wd) && qIsNull(ht) && qIsNull(lg); }
-
-inline bool NxSize::isEmpty() const
-{ return wd <= 0. || ht <= 0.; }
-
-inline bool NxSize::isValid() const
-{ return wd >= 0. && ht >= 0.; }
-
-inline qreal NxSize::width() const
-{ return wd; }
-
-inline qreal NxSize::height() const
-{ return ht; }
-
-inline qreal NxSize::length() const
-{ return lg; }
-
-inline void NxSize::setWidth(qreal w)
-{ wd = w; }
-
-inline void NxSize::setHeight(qreal h)
-{ ht = h; }
-
-inline void NxSize::setLength(qreal l)
-{ lg = l; }
-
-inline void NxSize::scale(qreal w, qreal h, qreal l, Qt::AspectRatioMode mode)
-{ scale(NxSize(w, h, l), mode); }
-
-inline qreal &NxSize::rwidth()
-{ return wd; }
-
-inline qreal &NxSize::rheight()
-{ return ht; }
-
-inline qreal &NxSize::rlength()
-{ return lg; }
-
-inline NxSize &NxSize::operator+=(const NxSize &s)
-{ wd += s.wd; ht += s.ht; lg += s.lg; return *this; }
-
-inline NxSize &NxSize::operator-=(const NxSize &s)
-{ wd -= s.wd; ht -= s.ht; lg -= s.lg; return *this; }
-
-inline NxSize &NxSize::operator*=(qreal c)
-{ wd *= c; ht *= c; lg *= c; return *this; }
-
-inline bool operator==(const NxSize &s1, const NxSize &s2)
-{ return qFuzzyCompare(s1.wd, s2.wd) && qFuzzyCompare(s1.ht, s2.ht) && qFuzzyCompare(s1.lg, s2.lg); }
-
-inline bool operator!=(const NxSize &s1, const NxSize &s2)
-{ return !qFuzzyCompare(s1.wd, s2.wd) || !qFuzzyCompare(s1.ht, s2.ht) || !qFuzzyCompare(s1.lg, s2.lg); }
-
-inline const NxSize operator+(const NxSize & s1, const NxSize & s2)
-{ return NxSize(s1.wd+s2.wd, s1.ht+s2.ht, s1.lg+s2.lg); }
-
-inline const NxSize operator-(const NxSize &s1, const NxSize &s2)
-{ return NxSize(s1.wd-s2.wd, s1.ht-s2.ht, s1.lg-s2.lg); }
-
-inline const NxSize operator*(const NxSize &s, qreal c)
-{ return NxSize(s.wd*c, s.ht*c, s.lg*c); }
-
-inline const NxSize operator*(qreal c, const NxSize &s)
-{ return NxSize(s.wd*c, s.ht*c, s.lg*c); }
-
-inline NxSize &NxSize::operator/=(qreal c) {
-    Q_ASSERT(!qFuzzyIsNull(c));
-    wd = wd/c; ht = ht/c; lg = lg/c;
-    return *this;
-}
-
-inline const NxSize operator/(const NxSize &s, qreal c) {
-    Q_ASSERT(!qFuzzyIsNull(c));
-    return NxSize(s.wd/c, s.ht/c, s.lg/c);
-}
-
-#endif // NXSIZE_H
+/*
+    This file is part of IanniX, a graphical real-time open-source sequencer for digital art
+    Copyright (C) 2010-2015 — IanniX Association
+
+    Project Manager: Thierry Coduys (http://www.le-hub.org)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
+
+    This file was written by Guillaume Jacquemin.
+
+    IanniX is a free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef NXSIZE_H
+#define NXSIZE_H
+
+#include <QVariant>
+
+class NxSize {
+public:
+    NxSize();
+    NxSize(qreal w, qreal h);
+    NxSize(qreal w, qreal h, qreal l);
+
+    bool isNull() const;
+    bool isEmpty() const;
+    bool isValid() const;
+
+    qreal width() const;
+    qreal height() const;
+    qreal length() const;
+    void setWidth(qreal w);
+    void setHeight(qreal h);
+    void setLength(qreal l);
+    void transpose();
+
+    void scale(qreal w, qreal h, qreal l, Qt::AspectRatioMode mode);
+    void scale(const NxSize &s, Qt::AspectRatioMode mode);
+
+    qreal &rwidth();
+    qreal &rheight();
+    qreal &rlength();
+
+    NxSize &operator+=(const NxSize &);
+    NxSize &operator-=(const NxSize &);
+    NxSize &operator*=(qreal c);
+    NxSize &operator/=(qreal c);
+
+    friend inline bool operator==(const NxSize &, const NxSize &);
+    friend inline bool operator!=(const NxSize &, const NxSize &);
+    friend inline const NxSize operator+(const NxSize &, const NxSize &);
+    friend inline const NxSize operator-(const NxSize &, const NxSize &);
+    friend inline const NxSize operator*(const NxSize &, qreal);
+    friend inline const NxSize operator*(qreal, const NxSize &);
+    friend inline const NxSize operator/(const NxSize &, qreal);
+
+private:
+    qreal wd;
+    qreal ht;
+    qreal lg;
+};
+Q_DECLARE_TYPEINFO(NxSize, Q_MOVABLE_TYPE);
+
+
+/*****************************************************************************
+  NxSize inline functions
+ *****************************************************************************/
+
+inline NxSize::NxSize()
+{ wd = ht = lg = -1.; }
+
+inline NxSize::NxSize(qreal w, qreal h, qreal l)
+{ wd = w; ht = h; lg = l; }
+
+inline NxSize::NxSize(qreal w, qreal h)
+{ wd = w; ht = h; lg = 0; }
+
+inline bool NxSize::isNull() const
+{ return qIsNull(wd) && qIsNull(ht) && qIsNull(lg); }
+
+inline bool NxSize::isEmpty() const
+{ return wd <= 0. || ht <= 0.; }
+
+inline bool NxSize::isValid() const
+{ return wd >= 0. && ht >= 0.; }
+
+inline qreal NxSize::width() const
+{ return wd; }
+
+inline qreal NxSize::height() const
+{ return ht; }
+
+inline qreal NxSize::length() const
+{ return lg; }
+
+inline void NxSize::setWidth(qreal w)
+{ wd = w; }
+
+inline void NxSize::setHeight(qreal h)
+{ ht = h; }
+
+inline void NxSize::setLength(qreal l)
+{ lg = l; }
+
+inline void NxSize::scale(qreal w, qreal h, qreal l, Qt::AspectRatioMode mode)
+{ scale(NxSize(w, h, l), mode); }
+
+inline qreal &NxSize::rwidth()
+{ return wd; }
+
+inline qreal &NxSize::rheight()
+{ return ht; }
+
+inline qreal &NxSize::rlength()
+{ return lg; }
+
+inline NxSize &NxSize::operator+=(const NxSize &s)
+{ wd += s.wd; ht += s.ht; lg += s.lg; return *this; }
+
+inline NxSize &NxSize::operator-=(const NxSize &s)
+{ wd -= s.wd; ht -= s.ht; lg -= s.lg; return *this; }
+
+inline NxSize &NxSize::operator*=(qreal c)
+{ wd *= c; ht *= c; lg *= c; return *this; }
+
+inline bool operator==(const NxSize &s1, const NxSize &s2)
+{ return qFuzzyCompare(s1.wd, s2.wd) && qFuzzyCompare(s1.ht, s2.ht) && qFuzzyCompare(s1.lg, s2.lg); }
+
+inline bool operator!=(const NxSize &s1, const NxSize &s2)
+{ return !qFuzzyCompare(s1.wd, s2.wd) || !qFuzzyCompare(s1.ht, s2.ht) || !qFuzzyCompare(s1.lg, s2.lg); }
+
+inline const NxSize operator+(const NxSize & s1, const NxSize & s2)
+{ return NxSize(s1.wd+s2.wd, s1.ht+s2.ht, s1.lg+s2.lg); }
+
+inline const NxSize operator-(const NxSize &s1, const NxSize &s2)
+{ return NxSize(s1.wd-s2.wd, s1.ht-s2.ht, s1.lg-s2.lg); }
+
+inline const NxSize operator*(const NxSize &s, qreal c)
+{ return NxSize(s.wd*c, s.ht*c, s.lg*c); }
+
+inline const NxSize operator*(qreal c, const NxSize &s)
+{ return NxSize(s.wd*c, s.ht*c, s.lg*c); }
+
+inline NxSize &NxSize::operator/=(qreal c) {
+    Q_ASSERT(!qFuzzyIsNull(c));
+    wd = wd/c; ht = ht/c; lg = lg/c;
+    return *this;
+}
+
+inline const NxSize operator/(const NxSize &s, qreal c) {
+    Q_ASSERT(!qFuzzyIsNull(c));
+    return NxSize(s.wd/c, s.ht/c, s.lg/c);
+}
+
+#endif // NXSIZE_H
diff --git a/geometry/qmuparser/muParser.cpp b/geometry/qmuparser/muParser.cpp
old mode 100755
new mode 100644
index 39ea861..4f5863c
--- a/geometry/qmuparser/muParser.cpp
+++ b/geometry/qmuparser/muParser.cpp
@@ -1,397 +1,397 @@
-/* 
-                 __________                                      
-    _____   __ __\______   \_____  _______  ______  ____ _______ 
-   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
-  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
-  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|   
-        \/                       \/            \/      \/        
-
-  Copyright (C) 2013 Ingo Berg
-
-  Permission is hereby granted, free of charge, to any person obtaining a copy of this 
-  software and associated documentation files (the "Software"), to deal in the Software
-  without restriction, including without limitation the rights to use, copy, modify, 
-  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 
-  permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-  The above copyright notice and this permission notice shall be included in all copies or 
-  substantial portions of the Software.
-
-  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
-  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
-  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
-  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
-  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
-*/
-#include "muParser.h"
-#include "muParserTemplateMagic.h"
-
-//--- Standard includes ------------------------------------------------------------------------
-#include <cmath>
-#include <algorithm>
-#include <numeric>
-
-/** \brief Pi (what else?). */
-#define PARSER_CONST_PI  3.141592653589793238462643
-
-/** \brief The Eulerian number. */
-#define PARSER_CONST_E   2.718281828459045235360287
-
-using namespace std;
-
-/** \file
-    \brief Implementation of the standard floating point parser.
-*/
-
-
-
-/** \brief Namespace for mathematical applications. */
-namespace mu
-{
-
-
-  //---------------------------------------------------------------------------
-  // Trigonometric function
-  value_type Parser::Sin(value_type v)   { return MathImpl<value_type>::Sin(v);  }
-  value_type Parser::Cos(value_type v)   { return MathImpl<value_type>::Cos(v);  }
-  value_type Parser::Tan(value_type v)   { return MathImpl<value_type>::Tan(v);  }
-  value_type Parser::ASin(value_type v)  { return MathImpl<value_type>::ASin(v); }
-  value_type Parser::ACos(value_type v)  { return MathImpl<value_type>::ACos(v); }
-  value_type Parser::ATan(value_type v)  { return MathImpl<value_type>::ATan(v); }
-  value_type Parser::ATan2(value_type v1, value_type v2) { return MathImpl<value_type>::ATan2(v1, v2); }
-  value_type Parser::Sinh(value_type v)  { return MathImpl<value_type>::Sinh(v); }
-  value_type Parser::Cosh(value_type v)  { return MathImpl<value_type>::Cosh(v); }
-  value_type Parser::Tanh(value_type v)  { return MathImpl<value_type>::Tanh(v); }
-  value_type Parser::ASinh(value_type v) { return MathImpl<value_type>::ASinh(v); }
-  value_type Parser::ACosh(value_type v) { return MathImpl<value_type>::ACosh(v); }
-  value_type Parser::ATanh(value_type v) { return MathImpl<value_type>::ATanh(v); }
-
-  //---------------------------------------------------------------------------
-  // Logarithm functions
-
-  // Logarithm base 2
-  value_type Parser::Log2(value_type v)  
-  { 
-    #ifdef MUP_MATH_EXCEPTIONS
-        if (v<=0)
-          throw ParserError(ecDOMAIN_ERROR, _T("Log2"));
-    #endif
-
-    return MathImpl<value_type>::Log2(v);  
-  }  
-
-  // Logarithm base 10
-  value_type Parser::Log10(value_type v) 
-  { 
-    #ifdef MUP_MATH_EXCEPTIONS
-        if (v<=0)
-          throw ParserError(ecDOMAIN_ERROR, _T("Log10"));
-    #endif
-
-    return MathImpl<value_type>::Log10(v); 
-  } 
-
-// Logarithm base e (natural logarithm)
-  value_type Parser::Ln(value_type v)    
-  { 
-    #ifdef MUP_MATH_EXCEPTIONS
-        if (v<=0)
-          throw ParserError(ecDOMAIN_ERROR, _T("Ln"));
-    #endif
-
-    return MathImpl<value_type>::Log(v);   
-  } 
-
-  //---------------------------------------------------------------------------
-  //  misc
-  value_type Parser::Exp(value_type v)  { return MathImpl<value_type>::Exp(v);  }
-  value_type Parser::Abs(value_type v)  { return MathImpl<value_type>::Abs(v);  }
-  value_type Parser::Sqrt(value_type v) 
-  { 
-    #ifdef MUP_MATH_EXCEPTIONS
-        if (v<0)
-          throw ParserError(ecDOMAIN_ERROR, _T("sqrt"));
-    #endif
-
-    return MathImpl<value_type>::Sqrt(v); 
-  }
-  value_type Parser::Rint(value_type v) { return MathImpl<value_type>::Rint(v); }
-  value_type Parser::Sign(value_type v) { return MathImpl<value_type>::Sign(v); }
-
-  //---------------------------------------------------------------------------
-  /** \brief Callback for the unary minus operator.
-      \param v The value to negate
-      \return -v
-  */
-  value_type Parser::UnaryMinus(value_type v) 
-  { 
-    return -v; 
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Callback for the unary minus operator.
-      \param v The value to negate
-      \return -v
-  */
-  value_type Parser::UnaryPlus(value_type v) 
-  { 
-    return v; 
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Callback for adding multiple values. 
-      \param [in] a_afArg Vector with the function arguments
-      \param [in] a_iArgc The size of a_afArg
-  */
-  value_type Parser::Sum(const value_type *a_afArg, int a_iArgc)
-  { 
-    if (!a_iArgc)	
-      throw exception_type(_T("too few arguments for function sum."));
-
-    value_type fRes=0;
-    for (int i=0; i<a_iArgc; ++i) fRes += a_afArg[i];
-    return fRes;
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Callback for averaging multiple values. 
-      \param [in] a_afArg Vector with the function arguments
-      \param [in] a_iArgc The size of a_afArg
-  */
-  value_type Parser::Avg(const value_type *a_afArg, int a_iArgc)
-  { 
-    if (!a_iArgc)	
-      throw exception_type(_T("too few arguments for function sum."));
-
-    value_type fRes=0;
-    for (int i=0; i<a_iArgc; ++i) fRes += a_afArg[i];
-    return fRes/(value_type)a_iArgc;
-  }
-
-
-  //---------------------------------------------------------------------------
-  /** \brief Callback for determining the minimum value out of a vector. 
-      \param [in] a_afArg Vector with the function arguments
-      \param [in] a_iArgc The size of a_afArg
-  */
-  value_type Parser::Min(const value_type *a_afArg, int a_iArgc)
-  { 
-    if (!a_iArgc)	
-      throw exception_type(_T("too few arguments for function min."));
-
-    value_type fRes=a_afArg[0];
-    for (int i=0; i<a_iArgc; ++i) 
-      fRes = std::min(fRes, a_afArg[i]);
-
-    return fRes;
-  }
-
-
-  //---------------------------------------------------------------------------
-  /** \brief Callback for determining the maximum value out of a vector. 
-      \param [in] a_afArg Vector with the function arguments
-      \param [in] a_iArgc The size of a_afArg
-  */
-  value_type Parser::Max(const value_type *a_afArg, int a_iArgc)
-  { 
-    if (!a_iArgc)	
-      throw exception_type(_T("too few arguments for function min."));
-
-    value_type fRes=a_afArg[0];
-    for (int i=0; i<a_iArgc; ++i) fRes = std::max(fRes, a_afArg[i]);
-
-    return fRes;
-  }
-
-
-  //---------------------------------------------------------------------------
-  /** \brief Default value recognition callback. 
-      \param [in] a_szExpr Pointer to the expression
-      \param [in, out] a_iPos Pointer to an index storing the current position within the expression
-      \param [out] a_fVal Pointer where the value should be stored in case one is found.
-      \return 1 if a value was found 0 otherwise.
-  */
-  int Parser::IsVal(const char_type* a_szExpr, int *a_iPos, value_type *a_fVal)
-  {
-    value_type fVal(0);
-
-    stringstream_type stream(a_szExpr);
-    stream.seekg(0);        // todo:  check if this really is necessary
-    stream.imbue(Parser::s_locale);
-    stream >> fVal;
-    stringstream_type::pos_type iEnd = stream.tellg(); // Position after reading
-
-    if (iEnd==(stringstream_type::pos_type)-1)
-      return 0;
-
-    *a_iPos += (int)iEnd;
-    *a_fVal = fVal;
-    return 1;
-  }
-
-
-  //---------------------------------------------------------------------------
-  /** \brief Constructor. 
-
-    Call ParserBase class constructor and trigger Function, Operator and Constant initialization.
-  */
-  Parser::Parser()
-    :ParserBase()
-  {
-    AddValIdent(IsVal);
-
-    InitCharSets();
-    InitFun();
-    InitConst();
-    InitOprt();
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Define the character sets. 
-      \sa DefineNameChars, DefineOprtChars, DefineInfixOprtChars
-    
-    This function is used for initializing the default character sets that define
-    the characters to be useable in function and variable names and operators.
-  */
-  void Parser::InitCharSets()
-  {
-    DefineNameChars( _T("0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") );
-    DefineOprtChars( _T("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+-*^/?<>=#!$%&|~'_{}") );
-    DefineInfixOprtChars( _T("/+-*^?<>=#!$%&|~'_") );
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Initialize the default functions. */
-  void Parser::InitFun()
-  {
-    if (mu::TypeInfo<mu::value_type>::IsInteger())
-    {
-      // When setting MUP_BASETYPE to an integer type
-      // Place functions for dealing with integer values here
-      // ...
-      // ...
-      // ...
-    }
-    else
-    {
-      // trigonometric functions
-      DefineFun(_T("sin"), Sin);
-      DefineFun(_T("cos"), Cos);
-      DefineFun(_T("tan"), Tan);
-      // arcus functions
-      DefineFun(_T("asin"), ASin);
-      DefineFun(_T("acos"), ACos);
-      DefineFun(_T("atan"), ATan);
-      DefineFun(_T("atan2"), ATan2);
-      // hyperbolic functions
-      DefineFun(_T("sinh"), Sinh);
-      DefineFun(_T("cosh"), Cosh);
-      DefineFun(_T("tanh"), Tanh);
-      // arcus hyperbolic functions
-      DefineFun(_T("asinh"), ASinh);
-      DefineFun(_T("acosh"), ACosh);
-      DefineFun(_T("atanh"), ATanh);
-      // Logarithm functions
-      DefineFun(_T("log2"), Log2);
-      DefineFun(_T("log10"), Log10);
-      DefineFun(_T("log"), Ln);
-      DefineFun(_T("ln"), Ln);
-      // misc
-      DefineFun(_T("exp"), Exp);
-      DefineFun(_T("sqrt"), Sqrt);
-      DefineFun(_T("sign"), Sign);
-      DefineFun(_T("rint"), Rint);
-      DefineFun(_T("abs"), Abs);
-      // Functions with variable number of arguments
-      DefineFun(_T("sum"), Sum);
-      DefineFun(_T("avg"), Avg);
-      DefineFun(_T("min"), Min);
-      DefineFun(_T("max"), Max);
-    }
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Initialize constants.
-  
-    By default the parser recognizes two constants. Pi ("pi") and the Eulerian
-    number ("_e").
-  */
-  void Parser::InitConst()
-  {
-    DefineConst(_T("_pi"), (value_type)PARSER_CONST_PI);
-    DefineConst(_T("_e"), (value_type)PARSER_CONST_E);
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Initialize operators. 
-  
-    By default only the unary minus operator is added.
-  */
-  void Parser::InitOprt()
-  {
-    DefineInfixOprt(_T("-"), UnaryMinus);
-    DefineInfixOprt(_T("+"), UnaryPlus);
-  }
-
-  //---------------------------------------------------------------------------
-  void Parser::OnDetectVar(string_type * /*pExpr*/, int & /*nStart*/, int & /*nEnd*/)
-  {
-    // this is just sample code to illustrate modifying variable names on the fly.
-    // I'm not sure anyone really needs such a feature...
-    /*
-
-
-    string sVar(pExpr->begin()+nStart, pExpr->begin()+nEnd);
-    string sRepl = std::string("_") + sVar + "_";
-  
-    int nOrigVarEnd = nEnd;
-    cout << "variable detected!\n";
-    cout << "  Expr: " << *pExpr << "\n";
-    cout << "  Start: " << nStart << "\n";
-    cout << "  End: " << nEnd << "\n";
-    cout << "  Var: \"" << sVar << "\"\n";
-    cout << "  Repl: \"" << sRepl << "\"\n";
-    nEnd = nStart + sRepl.length();
-    cout << "  End: " << nEnd << "\n";
-    pExpr->replace(pExpr->begin()+nStart, pExpr->begin()+nOrigVarEnd, sRepl);
-    cout << "  New expr: " << *pExpr << "\n";
-    */
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Numerically differentiate with regard to a variable. 
-      \param [in] a_Var Pointer to the differentiation variable.
-      \param [in] a_fPos Position at which the differentiation should take place.
-      \param [in] a_fEpsilon Epsilon used for the numerical differentiation.
-
-    Numerical differentiation uses a 5 point operator yielding a 4th order 
-    formula. The default value for epsilon is 0.00074 which is
-    numeric_limits<double>::epsilon() ^ (1/5) as suggested in the muparser
-    forum:
-
-    http://sourceforge.net/forum/forum.php?thread_id=1994611&forum_id=462843
-  */
-  value_type Parser::Diff(value_type *a_Var, 
-                          value_type  a_fPos, 
-                          value_type  a_fEpsilon) const
-  {
-    value_type fRes(0), 
-               fBuf(*a_Var),
-               f[4] = {0,0,0,0},
-               fEpsilon(a_fEpsilon);
-
-    // Backwards compatible calculation of epsilon inc case the user doesn't provide
-    // his own epsilon
-    if (fEpsilon==0)
-      fEpsilon = (a_fPos==0) ? (value_type)1e-10 : (value_type)1e-7 * a_fPos;
-
-    *a_Var = a_fPos+2 * fEpsilon;  f[0] = Eval();
-    *a_Var = a_fPos+1 * fEpsilon;  f[1] = Eval();
-    *a_Var = a_fPos-1 * fEpsilon;  f[2] = Eval();
-    *a_Var = a_fPos-2 * fEpsilon;  f[3] = Eval();
-    *a_Var = fBuf; // restore variable
-
-    fRes = (-f[0] + 8*f[1] - 8*f[2] + f[3]) / (12*fEpsilon);
-    return fRes;
-  }
-} // namespace mu
+/*
+                 __________
+    _____   __ __\______   \_____  _______  ______  ____ _______
+   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
+  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
+  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|
+        \/                       \/            \/      \/
+
+  Copyright (C) 2013 Ingo Berg
+
+  Permission is hereby granted, free of charge, to any person obtaining a copy of this
+  software and associated documentation files (the "Software"), to deal in the Software
+  without restriction, including without limitation the rights to use, copy, modify,
+  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
+  permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included in all copies or
+  substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
+  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#include "muParser.h"
+#include "muParserTemplateMagic.h"
+
+//--- Standard includes ------------------------------------------------------------------------
+#include <cmath>
+#include <algorithm>
+#include <numeric>
+
+/** \brief Pi (what else?). */
+#define PARSER_CONST_PI  3.141592653589793238462643
+
+/** \brief The Eulerian number. */
+#define PARSER_CONST_E   2.718281828459045235360287
+
+using namespace std;
+
+/** \file
+    \brief Implementation of the standard floating point parser.
+*/
+
+
+
+/** \brief Namespace for mathematical applications. */
+namespace mu
+{
+
+
+  //---------------------------------------------------------------------------
+  // Trigonometric function
+  value_type Parser::Sin(value_type v)   { return MathImpl<value_type>::Sin(v);  }
+  value_type Parser::Cos(value_type v)   { return MathImpl<value_type>::Cos(v);  }
+  value_type Parser::Tan(value_type v)   { return MathImpl<value_type>::Tan(v);  }
+  value_type Parser::ASin(value_type v)  { return MathImpl<value_type>::ASin(v); }
+  value_type Parser::ACos(value_type v)  { return MathImpl<value_type>::ACos(v); }
+  value_type Parser::ATan(value_type v)  { return MathImpl<value_type>::ATan(v); }
+  value_type Parser::ATan2(value_type v1, value_type v2) { return MathImpl<value_type>::ATan2(v1, v2); }
+  value_type Parser::Sinh(value_type v)  { return MathImpl<value_type>::Sinh(v); }
+  value_type Parser::Cosh(value_type v)  { return MathImpl<value_type>::Cosh(v); }
+  value_type Parser::Tanh(value_type v)  { return MathImpl<value_type>::Tanh(v); }
+  value_type Parser::ASinh(value_type v) { return MathImpl<value_type>::ASinh(v); }
+  value_type Parser::ACosh(value_type v) { return MathImpl<value_type>::ACosh(v); }
+  value_type Parser::ATanh(value_type v) { return MathImpl<value_type>::ATanh(v); }
+
+  //---------------------------------------------------------------------------
+  // Logarithm functions
+
+  // Logarithm base 2
+  value_type Parser::Log2(value_type v)
+  {
+    #ifdef MUP_MATH_EXCEPTIONS
+        if (v<=0)
+          throw ParserError(ecDOMAIN_ERROR, _T("Log2"));
+    #endif
+
+    return MathImpl<value_type>::Log2(v);
+  }
+
+  // Logarithm base 10
+  value_type Parser::Log10(value_type v)
+  {
+    #ifdef MUP_MATH_EXCEPTIONS
+        if (v<=0)
+          throw ParserError(ecDOMAIN_ERROR, _T("Log10"));
+    #endif
+
+    return MathImpl<value_type>::Log10(v);
+  }
+
+// Logarithm base e (natural logarithm)
+  value_type Parser::Ln(value_type v)
+  {
+    #ifdef MUP_MATH_EXCEPTIONS
+        if (v<=0)
+          throw ParserError(ecDOMAIN_ERROR, _T("Ln"));
+    #endif
+
+    return MathImpl<value_type>::Log(v);
+  }
+
+  //---------------------------------------------------------------------------
+  //  misc
+  value_type Parser::Exp(value_type v)  { return MathImpl<value_type>::Exp(v);  }
+  value_type Parser::Abs(value_type v)  { return MathImpl<value_type>::Abs(v);  }
+  value_type Parser::Sqrt(value_type v)
+  {
+    #ifdef MUP_MATH_EXCEPTIONS
+        if (v<0)
+          throw ParserError(ecDOMAIN_ERROR, _T("sqrt"));
+    #endif
+
+    return MathImpl<value_type>::Sqrt(v);
+  }
+  value_type Parser::Rint(value_type v) { return MathImpl<value_type>::Rint(v); }
+  value_type Parser::Sign(value_type v) { return MathImpl<value_type>::Sign(v); }
+
+  //---------------------------------------------------------------------------
+  /** \brief Callback for the unary minus operator.
+      \param v The value to negate
+      \return -v
+  */
+  value_type Parser::UnaryMinus(value_type v)
+  {
+    return -v;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Callback for the unary minus operator.
+      \param v The value to negate
+      \return -v
+  */
+  value_type Parser::UnaryPlus(value_type v)
+  {
+    return v;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Callback for adding multiple values.
+      \param [in] a_afArg Vector with the function arguments
+      \param [in] a_iArgc The size of a_afArg
+  */
+  value_type Parser::Sum(const value_type *a_afArg, int a_iArgc)
+  {
+    if (!a_iArgc)
+      throw exception_type(_T("too few arguments for function sum."));
+
+    value_type fRes=0;
+    for (int i=0; i<a_iArgc; ++i) fRes += a_afArg[i];
+    return fRes;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Callback for averaging multiple values.
+      \param [in] a_afArg Vector with the function arguments
+      \param [in] a_iArgc The size of a_afArg
+  */
+  value_type Parser::Avg(const value_type *a_afArg, int a_iArgc)
+  {
+    if (!a_iArgc)
+      throw exception_type(_T("too few arguments for function sum."));
+
+    value_type fRes=0;
+    for (int i=0; i<a_iArgc; ++i) fRes += a_afArg[i];
+    return fRes/(value_type)a_iArgc;
+  }
+
+
+  //---------------------------------------------------------------------------
+  /** \brief Callback for determining the minimum value out of a vector.
+      \param [in] a_afArg Vector with the function arguments
+      \param [in] a_iArgc The size of a_afArg
+  */
+  value_type Parser::Min(const value_type *a_afArg, int a_iArgc)
+  {
+    if (!a_iArgc)
+      throw exception_type(_T("too few arguments for function min."));
+
+    value_type fRes=a_afArg[0];
+    for (int i=0; i<a_iArgc; ++i)
+      fRes = std::min(fRes, a_afArg[i]);
+
+    return fRes;
+  }
+
+
+  //---------------------------------------------------------------------------
+  /** \brief Callback for determining the maximum value out of a vector.
+      \param [in] a_afArg Vector with the function arguments
+      \param [in] a_iArgc The size of a_afArg
+  */
+  value_type Parser::Max(const value_type *a_afArg, int a_iArgc)
+  {
+    if (!a_iArgc)
+      throw exception_type(_T("too few arguments for function min."));
+
+    value_type fRes=a_afArg[0];
+    for (int i=0; i<a_iArgc; ++i) fRes = std::max(fRes, a_afArg[i]);
+
+    return fRes;
+  }
+
+
+  //---------------------------------------------------------------------------
+  /** \brief Default value recognition callback.
+      \param [in] a_szExpr Pointer to the expression
+      \param [in, out] a_iPos Pointer to an index storing the current position within the expression
+      \param [out] a_fVal Pointer where the value should be stored in case one is found.
+      \return 1 if a value was found 0 otherwise.
+  */
+  int Parser::IsVal(const char_type* a_szExpr, int *a_iPos, value_type *a_fVal)
+  {
+    value_type fVal(0);
+
+    stringstream_type stream(a_szExpr);
+    stream.seekg(0);        // todo:  check if this really is necessary
+    stream.imbue(Parser::s_locale);
+    stream >> fVal;
+    stringstream_type::pos_type iEnd = stream.tellg(); // Position after reading
+
+    if (iEnd==(stringstream_type::pos_type)-1)
+      return 0;
+
+    *a_iPos += (int)iEnd;
+    *a_fVal = fVal;
+    return 1;
+  }
+
+
+  //---------------------------------------------------------------------------
+  /** \brief Constructor.
+
+    Call ParserBase class constructor and trigger Function, Operator and Constant initialization.
+  */
+  Parser::Parser()
+    :ParserBase()
+  {
+    AddValIdent(IsVal);
+
+    InitCharSets();
+    InitFun();
+    InitConst();
+    InitOprt();
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Define the character sets.
+      \sa DefineNameChars, DefineOprtChars, DefineInfixOprtChars
+
+    This function is used for initializing the default character sets that define
+    the characters to be useable in function and variable names and operators.
+  */
+  void Parser::InitCharSets()
+  {
+    DefineNameChars( _T("0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") );
+    DefineOprtChars( _T("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+-*^/?<>=#!$%&|~'_{}") );
+    DefineInfixOprtChars( _T("/+-*^?<>=#!$%&|~'_") );
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Initialize the default functions. */
+  void Parser::InitFun()
+  {
+    if (mu::TypeInfo<mu::value_type>::IsInteger())
+    {
+      // When setting MUP_BASETYPE to an integer type
+      // Place functions for dealing with integer values here
+      // ...
+      // ...
+      // ...
+    }
+    else
+    {
+      // trigonometric functions
+      DefineFun(_T("sin"), Sin);
+      DefineFun(_T("cos"), Cos);
+      DefineFun(_T("tan"), Tan);
+      // arcus functions
+      DefineFun(_T("asin"), ASin);
+      DefineFun(_T("acos"), ACos);
+      DefineFun(_T("atan"), ATan);
+      DefineFun(_T("atan2"), ATan2);
+      // hyperbolic functions
+      DefineFun(_T("sinh"), Sinh);
+      DefineFun(_T("cosh"), Cosh);
+      DefineFun(_T("tanh"), Tanh);
+      // arcus hyperbolic functions
+      DefineFun(_T("asinh"), ASinh);
+      DefineFun(_T("acosh"), ACosh);
+      DefineFun(_T("atanh"), ATanh);
+      // Logarithm functions
+      DefineFun(_T("log2"), Log2);
+      DefineFun(_T("log10"), Log10);
+      DefineFun(_T("log"), Ln);
+      DefineFun(_T("ln"), Ln);
+      // misc
+      DefineFun(_T("exp"), Exp);
+      DefineFun(_T("sqrt"), Sqrt);
+      DefineFun(_T("sign"), Sign);
+      DefineFun(_T("rint"), Rint);
+      DefineFun(_T("abs"), Abs);
+      // Functions with variable number of arguments
+      DefineFun(_T("sum"), Sum);
+      DefineFun(_T("avg"), Avg);
+      DefineFun(_T("min"), Min);
+      DefineFun(_T("max"), Max);
+    }
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Initialize constants.
+
+    By default the parser recognizes two constants. Pi ("pi") and the Eulerian
+    number ("_e").
+  */
+  void Parser::InitConst()
+  {
+    DefineConst(_T("_pi"), (value_type)PARSER_CONST_PI);
+    DefineConst(_T("_e"), (value_type)PARSER_CONST_E);
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Initialize operators.
+
+    By default only the unary minus operator is added.
+  */
+  void Parser::InitOprt()
+  {
+    DefineInfixOprt(_T("-"), UnaryMinus);
+    DefineInfixOprt(_T("+"), UnaryPlus);
+  }
+
+  //---------------------------------------------------------------------------
+  void Parser::OnDetectVar(string_type * /*pExpr*/, int & /*nStart*/, int & /*nEnd*/)
+  {
+    // this is just sample code to illustrate modifying variable names on the fly.
+    // I'm not sure anyone really needs such a feature...
+    /*
+
+
+    string sVar(pExpr->begin()+nStart, pExpr->begin()+nEnd);
+    string sRepl = std::string("_") + sVar + "_";
+
+    int nOrigVarEnd = nEnd;
+    cout << "variable detected!\n";
+    cout << "  Expr: " << *pExpr << "\n";
+    cout << "  Start: " << nStart << "\n";
+    cout << "  End: " << nEnd << "\n";
+    cout << "  Var: \"" << sVar << "\"\n";
+    cout << "  Repl: \"" << sRepl << "\"\n";
+    nEnd = nStart + sRepl.length();
+    cout << "  End: " << nEnd << "\n";
+    pExpr->replace(pExpr->begin()+nStart, pExpr->begin()+nOrigVarEnd, sRepl);
+    cout << "  New expr: " << *pExpr << "\n";
+    */
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Numerically differentiate with regard to a variable.
+      \param [in] a_Var Pointer to the differentiation variable.
+      \param [in] a_fPos Position at which the differentiation should take place.
+      \param [in] a_fEpsilon Epsilon used for the numerical differentiation.
+
+    Numerical differentiation uses a 5 point operator yielding a 4th order
+    formula. The default value for epsilon is 0.00074 which is
+    numeric_limits<double>::epsilon() ^ (1/5) as suggested in the muparser
+    forum:
+
+    http://sourceforge.net/forum/forum.php?thread_id=1994611&forum_id=462843
+  */
+  value_type Parser::Diff(value_type *a_Var,
+                          value_type  a_fPos,
+                          value_type  a_fEpsilon) const
+  {
+    value_type fRes(0),
+               fBuf(*a_Var),
+               f[4] = {0,0,0,0},
+               fEpsilon(a_fEpsilon);
+
+    // Backwards compatible calculation of epsilon inc case the user doesn't provide
+    // his own epsilon
+    if (fEpsilon==0)
+      fEpsilon = (a_fPos==0) ? (value_type)1e-10 : (value_type)1e-7 * a_fPos;
+
+    *a_Var = a_fPos+2 * fEpsilon;  f[0] = Eval();
+    *a_Var = a_fPos+1 * fEpsilon;  f[1] = Eval();
+    *a_Var = a_fPos-1 * fEpsilon;  f[2] = Eval();
+    *a_Var = a_fPos-2 * fEpsilon;  f[3] = Eval();
+    *a_Var = fBuf; // restore variable
+
+    fRes = (-f[0] + 8*f[1] - 8*f[2] + f[3]) / (12*fEpsilon);
+    return fRes;
+  }
+} // namespace mu
diff --git a/geometry/qmuparser/muParser.h b/geometry/qmuparser/muParser.h
old mode 100755
new mode 100644
index 39fe137..04c8841
--- a/geometry/qmuparser/muParser.h
+++ b/geometry/qmuparser/muParser.h
@@ -1,115 +1,115 @@
-/*
-                 __________                                      
-    _____   __ __\______   \_____  _______  ______  ____ _______ 
-   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
-  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
-  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|   
-        \/                       \/            \/      \/        
-  Copyright (C) 2013 Ingo Berg
-
-  Permission is hereby granted, free of charge, to any person obtaining a copy of this 
-  software and associated documentation files (the "Software"), to deal in the Software
-  without restriction, including without limitation the rights to use, copy, modify, 
-  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 
-  permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-  The above copyright notice and this permission notice shall be included in all copies or 
-  substantial portions of the Software.
-
-  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
-  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
-  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
-  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
-  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
-*/
-#ifndef MU_PARSER_H
-#define MU_PARSER_H
-
-//--- Standard includes ------------------------------------------------------------------------
-#include <vector>
-
-//--- Parser includes --------------------------------------------------------------------------
-#include "muParserBase.h"
-#include "muParserTemplateMagic.h"
-
-/** \file
-    \brief Definition of the standard floating point parser.
-*/
-
-namespace mu
-{
-  /** \brief Mathematical expressions parser.
-    
-    Standard implementation of the mathematical expressions parser. 
-    Can be used as a reference implementation for subclassing the parser.
-
-    <small>
-    (C) 2011 Ingo Berg<br>
-    muparser(at)beltoforion.de
-    </small>
-  */
-  /* final */ class Parser : public ParserBase
-  {
-  public:
-
-    Parser();
-
-    virtual void InitCharSets();
-    virtual void InitFun();
-    virtual void InitConst();
-    virtual void InitOprt();
-    virtual void OnDetectVar(string_type *pExpr, int &nStart, int &nEnd);
-
-    value_type Diff(value_type *a_Var, 
-                    value_type a_fPos, 
-                    value_type a_fEpsilon = 0) const;
-
-  protected:
-
-    // Trigonometric functions
-    static value_type  Sin(value_type);
-    static value_type  Cos(value_type);
-    static value_type  Tan(value_type);
-    static value_type  Tan2(value_type, value_type);
-    // arcus functions
-    static value_type  ASin(value_type);
-    static value_type  ACos(value_type);
-    static value_type  ATan(value_type);
-    static value_type  ATan2(value_type, value_type);
-
-    // hyperbolic functions
-    static value_type  Sinh(value_type);
-    static value_type  Cosh(value_type);
-    static value_type  Tanh(value_type);
-    // arcus hyperbolic functions
-    static value_type  ASinh(value_type);
-    static value_type  ACosh(value_type);
-    static value_type  ATanh(value_type);
-    // Logarithm functions
-    static value_type  Log2(value_type);  // Logarithm Base 2
-    static value_type  Log10(value_type); // Logarithm Base 10
-    static value_type  Ln(value_type);    // Logarithm Base e (natural logarithm)
-    // misc
-    static value_type  Exp(value_type);
-    static value_type  Abs(value_type);
-    static value_type  Sqrt(value_type);
-    static value_type  Rint(value_type);
-    static value_type  Sign(value_type);
-
-    // Prefix operators
-    // !!! Unary Minus is a MUST if you want to use negative signs !!!
-    static value_type  UnaryMinus(value_type);
-    static value_type  UnaryPlus(value_type);
-
-    // Functions with variable number of arguments
-    static value_type Sum(const value_type*, int);  // sum
-    static value_type Avg(const value_type*, int);  // mean value
-    static value_type Min(const value_type*, int);  // minimum
-    static value_type Max(const value_type*, int);  // maximum
-
-    static int IsVal(const char_type* a_szExpr, int *a_iPos, value_type *a_fVal);
-  };
-} // namespace mu
-
-#endif
-
+/*
+                 __________
+    _____   __ __\______   \_____  _______  ______  ____ _______
+   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
+  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
+  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|
+        \/                       \/            \/      \/
+  Copyright (C) 2013 Ingo Berg
+
+  Permission is hereby granted, free of charge, to any person obtaining a copy of this
+  software and associated documentation files (the "Software"), to deal in the Software
+  without restriction, including without limitation the rights to use, copy, modify,
+  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
+  permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included in all copies or
+  substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
+  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#ifndef MU_PARSER_H
+#define MU_PARSER_H
+
+//--- Standard includes ------------------------------------------------------------------------
+#include <vector>
+
+//--- Parser includes --------------------------------------------------------------------------
+#include "muParserBase.h"
+#include "muParserTemplateMagic.h"
+
+/** \file
+    \brief Definition of the standard floating point parser.
+*/
+
+namespace mu
+{
+  /** \brief Mathematical expressions parser.
+
+    Standard implementation of the mathematical expressions parser.
+    Can be used as a reference implementation for subclassing the parser.
+
+    <small>
+    (C) 2011 Ingo Berg<br>
+    muparser(at)beltoforion.de
+    </small>
+  */
+  /* final */ class Parser : public ParserBase
+  {
+  public:
+
+    Parser();
+
+    virtual void InitCharSets();
+    virtual void InitFun();
+    virtual void InitConst();
+    virtual void InitOprt();
+    virtual void OnDetectVar(string_type *pExpr, int &nStart, int &nEnd);
+
+    value_type Diff(value_type *a_Var,
+                    value_type a_fPos,
+                    value_type a_fEpsilon = 0) const;
+
+  protected:
+
+    // Trigonometric functions
+    static value_type  Sin(value_type);
+    static value_type  Cos(value_type);
+    static value_type  Tan(value_type);
+    static value_type  Tan2(value_type, value_type);
+    // arcus functions
+    static value_type  ASin(value_type);
+    static value_type  ACos(value_type);
+    static value_type  ATan(value_type);
+    static value_type  ATan2(value_type, value_type);
+
+    // hyperbolic functions
+    static value_type  Sinh(value_type);
+    static value_type  Cosh(value_type);
+    static value_type  Tanh(value_type);
+    // arcus hyperbolic functions
+    static value_type  ASinh(value_type);
+    static value_type  ACosh(value_type);
+    static value_type  ATanh(value_type);
+    // Logarithm functions
+    static value_type  Log2(value_type);  // Logarithm Base 2
+    static value_type  Log10(value_type); // Logarithm Base 10
+    static value_type  Ln(value_type);    // Logarithm Base e (natural logarithm)
+    // misc
+    static value_type  Exp(value_type);
+    static value_type  Abs(value_type);
+    static value_type  Sqrt(value_type);
+    static value_type  Rint(value_type);
+    static value_type  Sign(value_type);
+
+    // Prefix operators
+    // !!! Unary Minus is a MUST if you want to use negative signs !!!
+    static value_type  UnaryMinus(value_type);
+    static value_type  UnaryPlus(value_type);
+
+    // Functions with variable number of arguments
+    static value_type Sum(const value_type*, int);  // sum
+    static value_type Avg(const value_type*, int);  // mean value
+    static value_type Min(const value_type*, int);  // minimum
+    static value_type Max(const value_type*, int);  // maximum
+
+    static int IsVal(const char_type* a_szExpr, int *a_iPos, value_type *a_fVal);
+  };
+} // namespace mu
+
+#endif
+
diff --git a/geometry/qmuparser/muParserBase.cpp b/geometry/qmuparser/muParserBase.cpp
old mode 100755
new mode 100644
index ea3699a..6f3904b
--- a/geometry/qmuparser/muParserBase.cpp
+++ b/geometry/qmuparser/muParserBase.cpp
@@ -1,1778 +1,1778 @@
-/*
-                 __________                                      
-    _____   __ __\______   \_____  _______  ______  ____ _______ 
-   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
-  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
-  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|   
-        \/                       \/            \/      \/        
-  Copyright (C) 2011 Ingo Berg
-
-  Permission is hereby granted, free of charge, to any person obtaining a copy of this 
-  software and associated documentation files (the "Software"), to deal in the Software
-  without restriction, including without limitation the rights to use, copy, modify, 
-  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 
-  permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-  The above copyright notice and this permission notice shall be included in all copies or 
-  substantial portions of the Software.
-
-  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
-  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
-  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
-  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
-  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
-*/
-
-#include "muParserBase.h"
-#include "muParserTemplateMagic.h"
-
-//--- Standard includes ------------------------------------------------------------------------
-#include <cassert>
-#include <algorithm>
-#include <cmath>
-#include <memory>
-#include <vector>
-#include <deque>
-#include <sstream>
-#include <locale>
-
-#ifdef MUP_USE_OPENMP
-  #include <omp.h>
-#endif
-
-using namespace std;
-
-/** \file
-    \brief This file contains the basic implementation of the muparser engine.
-*/
-
-namespace mu
-{
-  std::locale ParserBase::s_locale = std::locale(std::locale::classic(), new change_dec_sep<char_type>('.'));
-
-  bool ParserBase::g_DbgDumpCmdCode = false;
-  bool ParserBase::g_DbgDumpStack = false;
-
-  //------------------------------------------------------------------------------
-  /** \brief Identifiers for built in binary operators. 
-
-      When defining custom binary operators with #AddOprt(...) make sure not to choose 
-      names conflicting with these definitions. 
-  */
-  const char_type* ParserBase::c_DefaultOprt[] = 
-  { 
-    _T("<="), _T(">="),  _T("!="), 
-    _T("=="), _T("<"),   _T(">"), 
-    _T("+"),  _T("-"),   _T("*"), 
-    _T("/"),  _T("^"),   _T("&&"), 
-    _T("||"), _T("="),   _T("("),  
-    _T(")"),   _T("?"),  _T(":"), 0 
-  };
-
-  //------------------------------------------------------------------------------
-  /** \brief Constructor.
-      \param a_szFormula the formula to interpret.
-      \throw ParserException if a_szFormula is null.
-  */
-  ParserBase::ParserBase()
-    :m_pParseFormula(&ParserBase::ParseString)
-    ,m_vRPN()
-    ,m_vStringBuf()
-    ,m_pTokenReader()
-    ,m_FunDef()
-    ,m_PostOprtDef()
-    ,m_InfixOprtDef()
-    ,m_OprtDef()
-    ,m_ConstDef()
-    ,m_StrVarDef()
-    ,m_VarDef()
-    ,m_bBuiltInOp(true)
-    ,m_sNameChars()
-    ,m_sOprtChars()
-    ,m_sInfixOprtChars()
-    ,m_nIfElseCounter(0)
-    ,m_vStackBuffer()
-    ,m_nFinalResultIdx(0)
-  {
-    InitTokenReader();
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Copy constructor. 
-
-    The parser can be safely copy constructed but the bytecode is reset during
-    copy construction.
-  */
-  ParserBase::ParserBase(const ParserBase &a_Parser)
-    :m_pParseFormula(&ParserBase::ParseString)
-    ,m_vRPN()
-    ,m_vStringBuf()
-    ,m_pTokenReader()
-    ,m_FunDef()
-    ,m_PostOprtDef()
-    ,m_InfixOprtDef()
-    ,m_OprtDef()
-    ,m_ConstDef()
-    ,m_StrVarDef()
-    ,m_VarDef()
-    ,m_bBuiltInOp(true)
-    ,m_sNameChars()
-    ,m_sOprtChars()
-    ,m_sInfixOprtChars()
-    ,m_nIfElseCounter(0)
-  {
-    m_pTokenReader.reset(new token_reader_type(this));
-    Assign(a_Parser);
-  }
-
-  //---------------------------------------------------------------------------
-  ParserBase::~ParserBase()
-  {}
-
-  //---------------------------------------------------------------------------
-  /** \brief Assignment operator. 
-
-    Implemented by calling Assign(a_Parser). Self assignment is suppressed.
-    \param a_Parser Object to copy to this.
-    \return *this
-    \throw nothrow
-  */
-  ParserBase& ParserBase::operator=(const ParserBase &a_Parser)
-  {
-    Assign(a_Parser);
-    return *this;
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Copy state of a parser object to this. 
-
-    Clears Variables and Functions of this parser.
-    Copies the states of all internal variables.
-    Resets parse function to string parse mode.
-
-    \param a_Parser the source object.
-  */
-  void ParserBase::Assign(const ParserBase &a_Parser)
-  {
-    if (&a_Parser==this)
-      return;
-
-    // Don't copy bytecode instead cause the parser to create new bytecode
-    // by resetting the parse function.
-    ReInit();
-
-    m_ConstDef        = a_Parser.m_ConstDef;         // Copy user define constants
-    m_VarDef          = a_Parser.m_VarDef;           // Copy user defined variables
-    m_bBuiltInOp      = a_Parser.m_bBuiltInOp;
-    m_vStringBuf      = a_Parser.m_vStringBuf;
-    m_vStackBuffer    = a_Parser.m_vStackBuffer;
-    m_nFinalResultIdx = a_Parser.m_nFinalResultIdx;
-    m_StrVarDef       = a_Parser.m_StrVarDef;
-    m_vStringVarBuf   = a_Parser.m_vStringVarBuf;
-    m_nIfElseCounter  = a_Parser.m_nIfElseCounter;
-    m_pTokenReader.reset(a_Parser.m_pTokenReader->Clone(this));
-
-    // Copy function and operator callbacks
-    m_FunDef = a_Parser.m_FunDef;             // Copy function definitions
-    m_PostOprtDef = a_Parser.m_PostOprtDef;   // post value unary operators
-    m_InfixOprtDef = a_Parser.m_InfixOprtDef; // unary operators for infix notation
-    m_OprtDef = a_Parser.m_OprtDef;           // binary operators
-
-    m_sNameChars = a_Parser.m_sNameChars;
-    m_sOprtChars = a_Parser.m_sOprtChars;
-    m_sInfixOprtChars = a_Parser.m_sInfixOprtChars;
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Set the decimal separator.
-      \param cDecSep Decimal separator as a character value.
-      \sa SetThousandsSep
-
-      By default muparser uses the "C" locale. The decimal separator of this
-      locale is overwritten by the one provided here.
-  */
-  void ParserBase::SetDecSep(char_type cDecSep)
-  {
-    char_type cThousandsSep = std::use_facet< change_dec_sep<char_type> >(s_locale).thousands_sep();
-    s_locale = std::locale(std::locale("C"), new change_dec_sep<char_type>(cDecSep, cThousandsSep));
-  }
-  
-  //---------------------------------------------------------------------------
-  /** \brief Sets the thousands operator. 
-      \param cThousandsSep The thousands separator as a character
-      \sa SetDecSep
-
-      By default muparser uses the "C" locale. The thousands separator of this
-      locale is overwritten by the one provided here.
-  */
-  void ParserBase::SetThousandsSep(char_type cThousandsSep)
-  {
-    char_type cDecSep = std::use_facet< change_dec_sep<char_type> >(s_locale).decimal_point();
-    s_locale = std::locale(std::locale("C"), new change_dec_sep<char_type>(cDecSep, cThousandsSep));
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Resets the locale. 
-
-    The default locale used "." as decimal separator, no thousands separator and
-    "," as function argument separator.
-  */
-  void ParserBase::ResetLocale()
-  {
-    s_locale = std::locale(std::locale("C"), new change_dec_sep<char_type>('.'));
-    SetArgSep(',');
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Initialize the token reader. 
-
-    Create new token reader object and submit pointers to function, operator,
-    constant and variable definitions.
-
-    \post m_pTokenReader.get()!=0
-    \throw nothrow
-  */
-  void ParserBase::InitTokenReader()
-  {
-    m_pTokenReader.reset(new token_reader_type(this));
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Reset parser to string parsing mode and clear internal buffers.
-
-      Clear bytecode, reset the token reader.
-      \throw nothrow
-  */
-  void ParserBase::ReInit() const
-  {
-    m_pParseFormula = &ParserBase::ParseString;
-    m_vStringBuf.clear();
-    m_vRPN.clear();
-    m_pTokenReader->ReInit();
-    m_nIfElseCounter = 0;
-  }
-
-  //---------------------------------------------------------------------------
-  void ParserBase::OnDetectVar(string_type * /*pExpr*/, int & /*nStart*/, int & /*nEnd*/)
-  {}
-
-  //---------------------------------------------------------------------------
-  /** \brief Returns the version of muparser. 
-      \param eInfo A flag indicating whether the full version info should be 
-                   returned or not.
-
-    Format is as follows: "MAJOR.MINOR (COMPILER_FLAGS)" The COMPILER_FLAGS
-    are returned only if eInfo==pviFULL.
-  */
-  string_type ParserBase::GetVersion(EParserVersionInfo eInfo) const
-  {
-    stringstream_type ss;
-
-    ss << MUP_VERSION;
-
-    if (eInfo==pviFULL)
-    {
-      ss << _T(" (") << MUP_VERSION_DATE;
-      ss << std::dec << _T("; ") << sizeof(void*)*8 << _T("BIT");
-
-#ifdef _DEBUG
-      ss << _T("; DEBUG");
-#else 
-      ss << _T("; RELEASE");
-#endif
-
-#ifdef _UNICODE
-      ss << _T("; UNICODE");
-#else
-  #ifdef _MBCS
-      ss << _T("; MBCS");
-  #else
-      ss << _T("; ASCII");
-  #endif
-#endif
-
-#ifdef MUP_USE_OPENMP
-      ss << _T("; OPENMP");
-//#else
-//      ss << _T("; NO_OPENMP");
-#endif
-
-#if defined(MUP_MATH_EXCEPTIONS)
-      ss << _T("; MATHEXC");
-//#else
-//      ss << _T("; NO_MATHEXC");
-#endif
-
-      ss << _T(")");
-    }
-
-    return ss.str();
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Add a value parsing function. 
-      
-      When parsing an expression muParser tries to detect values in the expression
-      string using different valident callbacks. Thus it's possible to parse
-      for hex values, binary values and floating point values. 
-  */
-  void ParserBase::AddValIdent(identfun_type a_pCallback)
-  {
-    m_pTokenReader->AddValIdent(a_pCallback);
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Set a function that can create variable pointer for unknown expression variables. 
-      \param a_pFactory A pointer to the variable factory.
-      \param pUserData A user defined context pointer.
-  */
-  void ParserBase::SetVarFactory(facfun_type a_pFactory, void *pUserData)
-  {
-    m_pTokenReader->SetVarCreator(a_pFactory, pUserData);  
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Add a function or operator callback to the parser. */
-  void ParserBase::AddCallback( const string_type &a_strName,
-                                const ParserCallback &a_Callback, 
-                                funmap_type &a_Storage,
-                                const char_type *a_szCharSet )
-  {
-    if (a_Callback.GetAddr()==0)
-        Error(ecINVALID_FUN_PTR);
-
-    const funmap_type *pFunMap = &a_Storage;
-
-    // Check for conflicting operator or function names
-    if ( pFunMap!=&m_FunDef && m_FunDef.find(a_strName)!=m_FunDef.end() )
-      Error(ecNAME_CONFLICT, -1, a_strName);
-
-    if ( pFunMap!=&m_PostOprtDef && m_PostOprtDef.find(a_strName)!=m_PostOprtDef.end() )
-      Error(ecNAME_CONFLICT, -1, a_strName);
-
-    if ( pFunMap!=&m_InfixOprtDef && pFunMap!=&m_OprtDef && m_InfixOprtDef.find(a_strName)!=m_InfixOprtDef.end() )
-      Error(ecNAME_CONFLICT, -1, a_strName);
-
-    if ( pFunMap!=&m_InfixOprtDef && pFunMap!=&m_OprtDef && m_OprtDef.find(a_strName)!=m_OprtDef.end() )
-      Error(ecNAME_CONFLICT, -1, a_strName);
-
-    CheckOprt(a_strName, a_Callback, a_szCharSet);
-    a_Storage[a_strName] = a_Callback;
-    ReInit();
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Check if a name contains invalid characters. 
-
-      \throw ParserException if the name contains invalid characters.
-  */
-  void ParserBase::CheckOprt(const string_type &a_sName,
-                             const ParserCallback &a_Callback,
-                             const string_type &a_szCharSet) const
-  {
-    if ( !a_sName.length() ||
-        (a_sName.find_first_not_of(a_szCharSet)!=string_type::npos) ||
-        (a_sName[0]>='0' && a_sName[0]<='9'))
-    {
-      switch(a_Callback.GetCode())
-      {
-      case cmOPRT_POSTFIX: Error(ecINVALID_POSTFIX_IDENT, -1, a_sName);
-      case cmOPRT_INFIX:   Error(ecINVALID_INFIX_IDENT, -1, a_sName);
-      default:             Error(ecINVALID_NAME, -1, a_sName);
-      }
-    }
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Check if a name contains invalid characters. 
-
-      \throw ParserException if the name contains invalid characters.
-  */
-  void ParserBase::CheckName(const string_type &a_sName,
-                             const string_type &a_szCharSet) const
-  {
-    if ( !a_sName.length() ||
-        (a_sName.find_first_not_of(a_szCharSet)!=string_type::npos) ||
-        (a_sName[0]>='0' && a_sName[0]<='9'))
-    {
-      Error(ecINVALID_NAME);
-    }
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Set the formula. 
-      \param a_strFormula Formula as string_type
-      \throw ParserException in case of syntax errors.
-
-      Triggers first time calculation thus the creation of the bytecode and
-      scanning of used variables.
-  */
-  void ParserBase::SetExpr(const string_type &a_sExpr)
-  {
-    // Check locale compatibility
-    std::locale loc;
-    if (m_pTokenReader->GetArgSep()==std::use_facet<numpunct<char_type> >(loc).decimal_point())
-      Error(ecLOCALE);
-
-    // <ibg> 20060222: Bugfix for Borland-Kylix:
-    // adding a space to the expression will keep Borlands KYLIX from going wild
-    // when calling tellg on a stringstream created from the expression after 
-    // reading a value at the end of an expression. (mu::Parser::IsVal function)
-    // (tellg returns -1 otherwise causing the parser to ignore the value)
-    string_type sBuf(a_sExpr + _T(" ") );
-    m_pTokenReader->SetFormula(sBuf);
-    ReInit();
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Get the default symbols used for the built in operators. 
-      \sa c_DefaultOprt
-  */
-  const char_type** ParserBase::GetOprtDef() const
-  {
-    return (const char_type **)(&c_DefaultOprt[0]);
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Define the set of valid characters to be used in names of
-             functions, variables, constants.
-  */
-  void ParserBase::DefineNameChars(const char_type *a_szCharset)
-  {
-    m_sNameChars = a_szCharset;
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Define the set of valid characters to be used in names of
-             binary operators and postfix operators.
-  */
-  void ParserBase::DefineOprtChars(const char_type *a_szCharset)
-  {
-    m_sOprtChars = a_szCharset;
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Define the set of valid characters to be used in names of
-             infix operators.
-  */
-  void ParserBase::DefineInfixOprtChars(const char_type *a_szCharset)
-  {
-    m_sInfixOprtChars = a_szCharset;
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Virtual function that defines the characters allowed in name identifiers. 
-      \sa #ValidOprtChars, #ValidPrefixOprtChars
-  */ 
-  const char_type* ParserBase::ValidNameChars() const
-  {
-    assert(m_sNameChars.size());
-    return m_sNameChars.c_str();
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Virtual function that defines the characters allowed in operator definitions. 
-      \sa #ValidNameChars, #ValidPrefixOprtChars
-  */
-  const char_type* ParserBase::ValidOprtChars() const
-  {
-    assert(m_sOprtChars.size());
-    return m_sOprtChars.c_str();
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Virtual function that defines the characters allowed in infix operator definitions.
-      \sa #ValidNameChars, #ValidOprtChars
-  */
-  const char_type* ParserBase::ValidInfixOprtChars() const
-  {
-    assert(m_sInfixOprtChars.size());
-    return m_sInfixOprtChars.c_str();
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Add a user defined operator. 
-      \post Will reset the Parser to string parsing mode.
-  */
-  void ParserBase::DefinePostfixOprt(const string_type &a_sName, 
-                                     fun_type1 a_pFun,
-                                     bool a_bAllowOpt)
-  {
-    AddCallback(a_sName, 
-                ParserCallback(a_pFun, a_bAllowOpt, prPOSTFIX, cmOPRT_POSTFIX),
-                m_PostOprtDef, 
-                ValidOprtChars() );
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Initialize user defined functions. 
-   
-    Calls the virtual functions InitFun(), InitConst() and InitOprt().
-  */
-  void ParserBase::Init()
-  {
-    InitCharSets();
-    InitFun();
-    InitConst();
-    InitOprt();
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Add a user defined operator. 
-      \post Will reset the Parser to string parsing mode.
-      \param [in] a_sName  operator Identifier 
-      \param [in] a_pFun  Operator callback function
-      \param [in] a_iPrec  Operator Precedence (default=prSIGN)
-      \param [in] a_bAllowOpt  True if operator is volatile (default=false)
-      \sa EPrec
-  */
-  void ParserBase::DefineInfixOprt(const string_type &a_sName, 
-                                  fun_type1 a_pFun, 
-                                  int a_iPrec, 
-                                  bool a_bAllowOpt)
-  {
-    AddCallback(a_sName, 
-                ParserCallback(a_pFun, a_bAllowOpt, a_iPrec, cmOPRT_INFIX), 
-                m_InfixOprtDef, 
-                ValidInfixOprtChars() );
-  }
-
-
-  //---------------------------------------------------------------------------
-  /** \brief Define a binary operator. 
-      \param [in] a_sName The identifier of the operator.
-      \param [in] a_pFun Pointer to the callback function.
-      \param [in] a_iPrec Precedence of the operator.
-      \param [in] a_eAssociativity The associativity of the operator.
-      \param [in] a_bAllowOpt If this is true the operator may be optimized away.
-      
-      Adds a new Binary operator the the parser instance. 
-  */
-  void ParserBase::DefineOprt( const string_type &a_sName, 
-                               fun_type2 a_pFun, 
-                               unsigned a_iPrec, 
-                               EOprtAssociativity a_eAssociativity,
-                               bool a_bAllowOpt )
-  {
-    // Check for conflicts with built in operator names
-    for (int i=0; m_bBuiltInOp && i<cmENDIF; ++i)
-      if (a_sName == string_type(c_DefaultOprt[i]))
-        Error(ecBUILTIN_OVERLOAD, -1, a_sName);
-
-    AddCallback(a_sName, 
-                ParserCallback(a_pFun, a_bAllowOpt, a_iPrec, a_eAssociativity), 
-                m_OprtDef, 
-                ValidOprtChars() );
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Define a new string constant.
-      \param [in] a_strName The name of the constant.
-      \param [in] a_strVal the value of the constant. 
-  */
-  void ParserBase::DefineStrConst(const string_type &a_strName, const string_type &a_strVal)
-  {
-    // Test if a constant with that names already exists
-    if (m_StrVarDef.find(a_strName)!=m_StrVarDef.end())
-      Error(ecNAME_CONFLICT);
-
-    CheckName(a_strName, ValidNameChars());
-    
-    m_vStringVarBuf.push_back(a_strVal);                // Store variable string in internal buffer
-    m_StrVarDef[a_strName] = m_vStringVarBuf.size()-1;  // bind buffer index to variable name
-
-    ReInit();
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Add a user defined variable. 
-      \param [in] a_sName the variable name
-      \param [in] a_pVar A pointer to the variable value.
-      \post Will reset the Parser to string parsing mode.
-      \throw ParserException in case the name contains invalid signs or a_pVar is NULL.
-  */
-  void ParserBase::DefineVar(const string_type &a_sName, value_type *a_pVar)
-  {
-    if (a_pVar==0)
-      Error(ecINVALID_VAR_PTR);
-
-    // Test if a constant with that names already exists
-    if (m_ConstDef.find(a_sName)!=m_ConstDef.end())
-      Error(ecNAME_CONFLICT);
-
-    CheckName(a_sName, ValidNameChars());
-    m_VarDef[a_sName] = a_pVar;
-    ReInit();
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Add a user defined constant. 
-      \param [in] a_sName The name of the constant.
-      \param [in] a_fVal the value of the constant.
-      \post Will reset the Parser to string parsing mode.
-      \throw ParserException in case the name contains invalid signs.
-  */
-  void ParserBase::DefineConst(const string_type &a_sName, value_type a_fVal)
-  {
-    CheckName(a_sName, ValidNameChars());
-    m_ConstDef[a_sName] = a_fVal;
-    ReInit();
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Get operator priority.
-      \throw ParserException if a_Oprt is no operator code
-  */
-  int ParserBase::GetOprtPrecedence(const token_type &a_Tok) const
-  {
-    switch (a_Tok.GetCode())
-    {
-    // built in operators
-    case cmEND:      return -5;
-    case cmARG_SEP:  return -4;
-    case cmASSIGN:   return -1;               
-    case cmELSE:
-    case cmIF:       return  0;
-    case cmLAND:     return  prLAND;
-    case cmLOR:      return  prLOR;
-    case cmLT:
-    case cmGT:
-    case cmLE:
-    case cmGE:
-    case cmNEQ:
-    case cmEQ:       return  prCMP; 
-    case cmADD:
-    case cmSUB:      return  prADD_SUB;
-    case cmMUL:
-    case cmDIV:      return  prMUL_DIV;
-    case cmPOW:      return  prPOW;
-
-    // user defined binary operators
-    case cmOPRT_INFIX: 
-    case cmOPRT_BIN: return a_Tok.GetPri();
-    default:  Error(ecINTERNAL_ERROR, 5);
-              return 999;
-    }  
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Get operator priority.
-      \throw ParserException if a_Oprt is no operator code
-  */
-  EOprtAssociativity ParserBase::GetOprtAssociativity(const token_type &a_Tok) const
-  {
-    switch (a_Tok.GetCode())
-    {
-    case cmASSIGN:
-    case cmLAND:
-    case cmLOR:
-    case cmLT:
-    case cmGT:
-    case cmLE:
-    case cmGE:
-    case cmNEQ:
-    case cmEQ: 
-    case cmADD:
-    case cmSUB:
-    case cmMUL:
-    case cmDIV:      return oaLEFT;
-    case cmPOW:      return oaRIGHT;
-    case cmOPRT_BIN: return a_Tok.GetAssociativity();
-    default:         return oaNONE;
-    }  
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Return a map containing the used variables only. */
-  const varmap_type& ParserBase::GetUsedVar() const
-  {
-    try
-    {
-      m_pTokenReader->IgnoreUndefVar(true);
-      CreateRPN(); // try to create bytecode, but don't use it for any further calculations since it
-                   // may contain references to nonexisting variables.
-      m_pParseFormula = &ParserBase::ParseString;
-      m_pTokenReader->IgnoreUndefVar(false);
-    }
-    catch(exception_type & /*e*/)
-    {
-      // Make sure to stay in string parse mode, dont call ReInit()
-      // because it deletes the array with the used variables
-      m_pParseFormula = &ParserBase::ParseString;
-      m_pTokenReader->IgnoreUndefVar(false);
-      throw;
-    }
-    
-    return m_pTokenReader->GetUsedVar();
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Return a map containing the used variables only. */
-  const varmap_type& ParserBase::GetVar() const
-  {
-    return m_VarDef;
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Return a map containing all parser constants. */
-  const valmap_type& ParserBase::GetConst() const
-  {
-    return m_ConstDef;
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Return prototypes of all parser functions.
-      \return #m_FunDef
-      \sa FunProt
-      \throw nothrow
-      
-      The return type is a map of the public type #funmap_type containing the prototype
-      definitions for all numerical parser functions. String functions are not part of 
-      this map. The Prototype definition is encapsulated in objects of the class FunProt
-      one per parser function each associated with function names via a map construct.
-  */
-  const funmap_type& ParserBase::GetFunDef() const
-  {
-    return m_FunDef;
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Retrieve the formula. */
-  const string_type& ParserBase::GetExpr() const
-  {
-    return m_pTokenReader->GetExpr();
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Execute a function that takes a single string argument.
-      \param a_FunTok Function token.
-      \throw exception_type If the function token is not a string function
-  */
-  ParserBase::token_type ParserBase::ApplyStrFunc(const token_type &a_FunTok,
-                                                  const std::vector<token_type> &a_vArg) const
-  {
-    if (a_vArg.back().GetCode()!=cmSTRING)
-      Error(ecSTRING_EXPECTED, m_pTokenReader->GetPos(), a_FunTok.GetAsString());
-
-    token_type  valTok;
-    generic_fun_type pFunc = a_FunTok.GetFuncAddr();
-    assert(pFunc);
-
-    try
-    {
-      // Check function arguments; write dummy value into valtok to represent the result
-      switch(a_FunTok.GetArgCount())
-      {
-      case 0: valTok.SetVal(1); a_vArg[0].GetAsString();  break;
-      case 1: valTok.SetVal(1); a_vArg[1].GetAsString();  a_vArg[0].GetVal();  break;
-      case 2: valTok.SetVal(1); a_vArg[2].GetAsString();  a_vArg[1].GetVal();  a_vArg[0].GetVal();  break;
-      default: Error(ecINTERNAL_ERROR);
-      }
-    }
-    catch(ParserError& )
-    {
-      Error(ecVAL_EXPECTED, m_pTokenReader->GetPos(), a_FunTok.GetAsString());
-    }
-
-    // string functions won't be optimized
-    m_vRPN.AddStrFun(pFunc, a_FunTok.GetArgCount(), a_vArg.back().GetIdx());
-    
-    // Push dummy value representing the function result to the stack
-    return valTok;
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Apply a function token. 
-      \param iArgCount Number of Arguments actually gathered used only for multiarg functions.
-      \post The result is pushed to the value stack
-      \post The function token is removed from the stack
-      \throw exception_type if Argument count does not match function requirements.
-  */
-  void ParserBase::ApplyFunc( ParserStack<token_type> &a_stOpt,
-                              ParserStack<token_type> &a_stVal, 
-                              int a_iArgCount) const
-  { 
-    assert(m_pTokenReader.get());
-
-    // Operator stack empty or does not contain tokens with callback functions
-    if (a_stOpt.empty() || a_stOpt.top().GetFuncAddr()==0 )
-      return;
-
-    token_type funTok = a_stOpt.pop();
-    assert(funTok.GetFuncAddr());
-
-    // Binary operators must rely on their internal operator number
-    // since counting of operators relies on commas for function arguments
-    // binary operators do not have commas in their expression
-    int iArgCount = (funTok.GetCode()==cmOPRT_BIN) ? funTok.GetArgCount() : a_iArgCount;
-
-    // determine how many parameters the function needs. To remember iArgCount includes the 
-    // string parameter whilst GetArgCount() counts only numeric parameters.
-    int iArgRequired = funTok.GetArgCount() + ((funTok.GetType()==tpSTR) ? 1 : 0);
-
-    // Thats the number of numerical parameters
-    int iArgNumerical = iArgCount - ((funTok.GetType()==tpSTR) ? 1 : 0);
-
-    if (funTok.GetCode()==cmFUNC_STR && iArgCount-iArgNumerical>1)
-      Error(ecINTERNAL_ERROR);
-
-    if (funTok.GetArgCount()>=0 && iArgCount>iArgRequired) 
-      Error(ecTOO_MANY_PARAMS, m_pTokenReader->GetPos()-1, funTok.GetAsString());
-
-    if (funTok.GetCode()!=cmOPRT_BIN && iArgCount<iArgRequired )
-      Error(ecTOO_FEW_PARAMS, m_pTokenReader->GetPos()-1, funTok.GetAsString());
-
-    if (funTok.GetCode()==cmFUNC_STR && iArgCount>iArgRequired )
-      Error(ecTOO_MANY_PARAMS, m_pTokenReader->GetPos()-1, funTok.GetAsString());
-
-    // Collect the numeric function arguments from the value stack and store them
-    // in a vector
-    std::vector<token_type> stArg;  
-    for (int i=0; i<iArgNumerical; ++i)
-    {
-      stArg.push_back( a_stVal.pop() );
-      if ( stArg.back().GetType()==tpSTR && funTok.GetType()!=tpSTR )
-        Error(ecVAL_EXPECTED, m_pTokenReader->GetPos(), funTok.GetAsString());
-    }
-
-    switch(funTok.GetCode())
-    {
-    case  cmFUNC_STR:  
-          stArg.push_back(a_stVal.pop());
-          
-          if ( stArg.back().GetType()==tpSTR && funTok.GetType()!=tpSTR )
-            Error(ecVAL_EXPECTED, m_pTokenReader->GetPos(), funTok.GetAsString());
-
-          ApplyStrFunc(funTok, stArg); 
-          break;
-
-    case  cmFUNC_BULK: 
-          m_vRPN.AddBulkFun(funTok.GetFuncAddr(), (int)stArg.size()); 
-          break;
-
-    case  cmOPRT_BIN:
-    case  cmOPRT_POSTFIX:
-    case  cmOPRT_INFIX:
-    case  cmFUNC:
-          if (funTok.GetArgCount()==-1 && iArgCount==0)
-            Error(ecTOO_FEW_PARAMS, m_pTokenReader->GetPos(), funTok.GetAsString());
-
-          m_vRPN.AddFun(funTok.GetFuncAddr(), (funTok.GetArgCount()==-1) ? -iArgNumerical : iArgNumerical);
-          break;
-    }
-
-    // Push dummy value representing the function result to the stack
-    token_type token;
-    token.SetVal(1);  
-    a_stVal.push(token);
-  }
-
-  //---------------------------------------------------------------------------
-  void ParserBase::ApplyIfElse(ParserStack<token_type> &a_stOpt,
-                               ParserStack<token_type> &a_stVal) const
-  {
-    // Check if there is an if Else clause to be calculated
-    while (a_stOpt.size() && a_stOpt.top().GetCode()==cmELSE)
-    {
-      token_type opElse = a_stOpt.pop();
-      MUP_ASSERT(a_stOpt.size()>0);
-
-      // Take the value associated with the else branch from the value stack
-      token_type vVal2 = a_stVal.pop();
-
-      MUP_ASSERT(a_stOpt.size()>0);
-      MUP_ASSERT(a_stVal.size()>=2);
-
-      // it then else is a ternary operator Pop all three values from the value s
-      // tack and just return the right value
-      token_type vVal1 = a_stVal.pop();
-      token_type vExpr = a_stVal.pop();
-
-      a_stVal.push( (vExpr.GetVal()!=0) ? vVal1 : vVal2);
-
-      token_type opIf = a_stOpt.pop();
-      MUP_ASSERT(opElse.GetCode()==cmELSE);
-      MUP_ASSERT(opIf.GetCode()==cmIF);
-
-      m_vRPN.AddIfElse(cmENDIF);
-    } // while pending if-else-clause found
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Performs the necessary steps to write code for
-             the execution of binary operators into the bytecode. 
-  */
-  void ParserBase::ApplyBinOprt(ParserStack<token_type> &a_stOpt,
-                                ParserStack<token_type> &a_stVal) const
-  {
-    // is it a user defined binary operator?
-    if (a_stOpt.top().GetCode()==cmOPRT_BIN)
-    {
-      ApplyFunc(a_stOpt, a_stVal, 2);
-    }
-    else
-    {
-      MUP_ASSERT(a_stVal.size()>=2);
-      token_type valTok1 = a_stVal.pop(),
-                 valTok2 = a_stVal.pop(),
-                 optTok  = a_stOpt.pop(),
-                 resTok; 
-
-      if ( valTok1.GetType()!=valTok2.GetType() || 
-          (valTok1.GetType()==tpSTR && valTok2.GetType()==tpSTR) )
-        Error(ecOPRT_TYPE_CONFLICT, m_pTokenReader->GetPos(), optTok.GetAsString());
-
-      if (optTok.GetCode()==cmASSIGN)
-      {
-        if (valTok2.GetCode()!=cmVAR)
-          Error(ecUNEXPECTED_OPERATOR, -1, _T("="));
-                      
-        m_vRPN.AddAssignOp(valTok2.GetVar());
-      }
-      else
-        m_vRPN.AddOp(optTok.GetCode());
-
-      resTok.SetVal(1);
-      a_stVal.push(resTok);
-    }
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Apply a binary operator. 
-      \param a_stOpt The operator stack
-      \param a_stVal The value stack
-  */
-  void ParserBase::ApplyRemainingOprt(ParserStack<token_type> &stOpt,
-                                      ParserStack<token_type> &stVal) const
-  {
-    while (stOpt.size() && 
-           stOpt.top().GetCode() != cmBO &&
-           stOpt.top().GetCode() != cmIF)
-    {
-      token_type tok = stOpt.top();
-      switch (tok.GetCode())
-      {
-      case cmOPRT_INFIX:
-      case cmOPRT_BIN:
-      case cmLE:
-      case cmGE:
-      case cmNEQ:
-      case cmEQ:
-      case cmLT:
-      case cmGT:
-      case cmADD:
-      case cmSUB:
-      case cmMUL:
-      case cmDIV:
-      case cmPOW:
-      case cmLAND:
-      case cmLOR:
-      case cmASSIGN:
-          if (stOpt.top().GetCode()==cmOPRT_INFIX)
-            ApplyFunc(stOpt, stVal, 1);
-          else
-            ApplyBinOprt(stOpt, stVal);
-          break;
-
-      case cmELSE:
-          ApplyIfElse(stOpt, stVal);
-          break;
-
-      default:
-          Error(ecINTERNAL_ERROR);
-      }
-    }
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Parse the command code.
-      \sa ParseString(...)
-
-      Command code contains precalculated stack positions of the values and the
-      associated operators. The Stack is filled beginning from index one the 
-      value at index zero is not used at all.
-  */
-  value_type ParserBase::ParseCmdCode() const
-  {
-    return ParseCmdCodeBulk(0, 0);
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Evaluate the RPN. 
-      \param nOffset The offset added to variable addresses (for bulk mode)
-      \param nThreadID OpenMP Thread id of the calling thread
-  */
-  value_type ParserBase::ParseCmdCodeBulk(int nOffset, int nThreadID) const
-  {
-    assert(nThreadID<=s_MaxNumOpenMPThreads);
-
-    // Note: The check for nOffset==0 and nThreadID here is not necessary but 
-    //       brings a minor performance gain when not in bulk mode.
-    value_type *Stack = ((nOffset==0) && (nThreadID==0)) ? &m_vStackBuffer[0] : &m_vStackBuffer[nThreadID * (m_vStackBuffer.size() / s_MaxNumOpenMPThreads)];
-    value_type buf;
-    int sidx(0);
-    for (const SToken *pTok = m_vRPN.GetBase(); pTok->Cmd!=cmEND ; ++pTok)
-    {
-      switch (pTok->Cmd)
-      {
-      // built in binary operators
-      case  cmLE:   --sidx; Stack[sidx]  = Stack[sidx] <= Stack[sidx+1]; continue;
-      case  cmGE:   --sidx; Stack[sidx]  = Stack[sidx] >= Stack[sidx+1]; continue;
-      case  cmNEQ:  --sidx; Stack[sidx]  = Stack[sidx] != Stack[sidx+1]; continue;
-      case  cmEQ:   --sidx; Stack[sidx]  = Stack[sidx] == Stack[sidx+1]; continue;
-      case  cmLT:   --sidx; Stack[sidx]  = Stack[sidx] < Stack[sidx+1];  continue;
-      case  cmGT:   --sidx; Stack[sidx]  = Stack[sidx] > Stack[sidx+1];  continue;
-      case  cmADD:  --sidx; Stack[sidx] += Stack[1+sidx]; continue;
-      case  cmSUB:  --sidx; Stack[sidx] -= Stack[1+sidx]; continue;
-      case  cmMUL:  --sidx; Stack[sidx] *= Stack[1+sidx]; continue;
-      case  cmDIV:  --sidx;
-
-  #if defined(MUP_MATH_EXCEPTIONS)
-                  if (Stack[1+sidx]==0)
-                    Error(ecDIV_BY_ZERO);
-  #endif
-                  Stack[sidx] /= Stack[1+sidx]; 
-                  continue;
-
-      case  cmPOW: 
-              --sidx; Stack[sidx] = MathImpl<value_type>::Pow(Stack[sidx], Stack[1+sidx]);
-              continue;
-
-      case  cmLAND: --sidx; Stack[sidx]  = Stack[sidx] && Stack[sidx+1]; continue;
-      case  cmLOR:  --sidx; Stack[sidx]  = Stack[sidx] || Stack[sidx+1]; continue;
-
-      case  cmASSIGN: 
-          // Bugfix for Bulkmode:
-          // for details see:
-          //    https://groups.google.com/forum/embed/?place=forum/muparser-dev&showsearch=true&showpopout=true&showtabs=false&parenturl=http://muparser.beltoforion.de/mup_forum.html&afterlogin&pli=1#!topic/muparser-dev/szgatgoHTws
-          --sidx; Stack[sidx] = *(pTok->Oprt.ptr + nOffset) = Stack[sidx + 1]; continue;
-          // original code:
-          //--sidx; Stack[sidx] = *pTok->Oprt.ptr = Stack[sidx+1]; continue;
-
-      //case  cmBO:  // unused, listed for compiler optimization purposes
-      //case  cmBC:
-      //      MUP_FAIL(INVALID_CODE_IN_BYTECODE);
-      //      continue;
-
-      case  cmIF:
-            if (Stack[sidx--]==0)
-              pTok += pTok->Oprt.offset;
-            continue;
-
-      case  cmELSE:
-            pTok += pTok->Oprt.offset;
-            continue;
-
-      case  cmENDIF:
-            continue;
-
-      //case  cmARG_SEP:
-      //      MUP_FAIL(INVALID_CODE_IN_BYTECODE);
-      //      continue;
-
-      // value and variable tokens
-      case  cmVAR:    Stack[++sidx] = *(pTok->Val.ptr + nOffset);  continue;
-      case  cmVAL:    Stack[++sidx] =  pTok->Val.data2;  continue;
-      
-      case  cmVARPOW2: buf = *(pTok->Val.ptr + nOffset);
-                       Stack[++sidx] = buf*buf;
-                       continue;
-
-      case  cmVARPOW3: buf = *(pTok->Val.ptr + nOffset);
-                       Stack[++sidx] = buf*buf*buf;
-                       continue;
-
-      case  cmVARPOW4: buf = *(pTok->Val.ptr + nOffset);
-                       Stack[++sidx] = buf*buf*buf*buf;
-                       continue;
-      
-      case  cmVARMUL:  Stack[++sidx] = *(pTok->Val.ptr + nOffset) * pTok->Val.data + pTok->Val.data2;
-                       continue;
-
-      // Next is treatment of numeric functions
-      case  cmFUNC:
-            {
-              int iArgCount = pTok->Fun.argc;
-
-              // switch according to argument count
-              switch(iArgCount)  
-              {
-              case 0: sidx += 1; Stack[sidx] = (*(fun_type0)pTok->Fun.ptr)(); continue;
-              case 1:            Stack[sidx] = (*(fun_type1)pTok->Fun.ptr)(Stack[sidx]);   continue;
-              case 2: sidx -= 1; Stack[sidx] = (*(fun_type2)pTok->Fun.ptr)(Stack[sidx], Stack[sidx+1]); continue;
-              case 3: sidx -= 2; Stack[sidx] = (*(fun_type3)pTok->Fun.ptr)(Stack[sidx], Stack[sidx+1], Stack[sidx+2]); continue;
-              case 4: sidx -= 3; Stack[sidx] = (*(fun_type4)pTok->Fun.ptr)(Stack[sidx], Stack[sidx+1], Stack[sidx+2], Stack[sidx+3]); continue;
-              case 5: sidx -= 4; Stack[sidx] = (*(fun_type5)pTok->Fun.ptr)(Stack[sidx], Stack[sidx+1], Stack[sidx+2], Stack[sidx+3], Stack[sidx+4]); continue;
-              case 6: sidx -= 5; Stack[sidx] = (*(fun_type6)pTok->Fun.ptr)(Stack[sidx], Stack[sidx+1], Stack[sidx+2], Stack[sidx+3], Stack[sidx+4], Stack[sidx+5]); continue;
-              case 7: sidx -= 6; Stack[sidx] = (*(fun_type7)pTok->Fun.ptr)(Stack[sidx], Stack[sidx+1], Stack[sidx+2], Stack[sidx+3], Stack[sidx+4], Stack[sidx+5], Stack[sidx+6]); continue;
-              case 8: sidx -= 7; Stack[sidx] = (*(fun_type8)pTok->Fun.ptr)(Stack[sidx], Stack[sidx+1], Stack[sidx+2], Stack[sidx+3], Stack[sidx+4], Stack[sidx+5], Stack[sidx+6], Stack[sidx+7]); continue;
-              case 9: sidx -= 8; Stack[sidx] = (*(fun_type9)pTok->Fun.ptr)(Stack[sidx], Stack[sidx+1], Stack[sidx+2], Stack[sidx+3], Stack[sidx+4], Stack[sidx+5], Stack[sidx+6], Stack[sidx+7], Stack[sidx+8]); continue;
-              case 10:sidx -= 9; Stack[sidx] = (*(fun_type10)pTok->Fun.ptr)(Stack[sidx], Stack[sidx+1], Stack[sidx+2], Stack[sidx+3], Stack[sidx+4], Stack[sidx+5], Stack[sidx+6], Stack[sidx+7], Stack[sidx+8], Stack[sidx+9]); continue;
-              default:
-                if (iArgCount>0) // function with variable arguments store the number as a negative value
-                  Error(ecINTERNAL_ERROR, 1);
-
-                sidx -= -iArgCount - 1;
-                Stack[sidx] =(*(multfun_type)pTok->Fun.ptr)(&Stack[sidx], -iArgCount);
-                continue;
-              }
-            }
-
-      // Next is treatment of string functions
-      case  cmFUNC_STR:
-            {
-              sidx -= pTok->Fun.argc -1;
-
-              // The index of the string argument in the string table
-              int iIdxStack = pTok->Fun.idx;  
-              MUP_ASSERT( iIdxStack>=0 && iIdxStack<(int)m_vStringBuf.size() );
-
-              switch(pTok->Fun.argc)  // switch according to argument count
-              {
-              case 0: Stack[sidx] = (*(strfun_type1)pTok->Fun.ptr)(m_vStringBuf[iIdxStack].c_str()); continue;
-              case 1: Stack[sidx] = (*(strfun_type2)pTok->Fun.ptr)(m_vStringBuf[iIdxStack].c_str(), Stack[sidx]); continue;
-              case 2: Stack[sidx] = (*(strfun_type3)pTok->Fun.ptr)(m_vStringBuf[iIdxStack].c_str(), Stack[sidx], Stack[sidx+1]); continue;
-              }
-
-              continue;
-            }
-
-        case  cmFUNC_BULK:
-              {
-                int iArgCount = pTok->Fun.argc;
-
-                // switch according to argument count
-                switch(iArgCount)  
-                {
-                case 0: sidx += 1; Stack[sidx] = (*(bulkfun_type0 )pTok->Fun.ptr)(nOffset, nThreadID); continue;
-                case 1:            Stack[sidx] = (*(bulkfun_type1 )pTok->Fun.ptr)(nOffset, nThreadID, Stack[sidx]); continue;
-                case 2: sidx -= 1; Stack[sidx] = (*(bulkfun_type2 )pTok->Fun.ptr)(nOffset, nThreadID, Stack[sidx], Stack[sidx+1]); continue;
-                case 3: sidx -= 2; Stack[sidx] = (*(bulkfun_type3 )pTok->Fun.ptr)(nOffset, nThreadID, Stack[sidx], Stack[sidx+1], Stack[sidx+2]); continue;
-                case 4: sidx -= 3; Stack[sidx] = (*(bulkfun_type4 )pTok->Fun.ptr)(nOffset, nThreadID, Stack[sidx], Stack[sidx+1], Stack[sidx+2], Stack[sidx+3]); continue;
-                case 5: sidx -= 4; Stack[sidx] = (*(bulkfun_type5 )pTok->Fun.ptr)(nOffset, nThreadID, Stack[sidx], Stack[sidx+1], Stack[sidx+2], Stack[sidx+3], Stack[sidx+4]); continue;
-                case 6: sidx -= 5; Stack[sidx] = (*(bulkfun_type6 )pTok->Fun.ptr)(nOffset, nThreadID, Stack[sidx], Stack[sidx+1], Stack[sidx+2], Stack[sidx+3], Stack[sidx+4], Stack[sidx+5]); continue;
-                case 7: sidx -= 6; Stack[sidx] = (*(bulkfun_type7 )pTok->Fun.ptr)(nOffset, nThreadID, Stack[sidx], Stack[sidx+1], Stack[sidx+2], Stack[sidx+3], Stack[sidx+4], Stack[sidx+5], Stack[sidx+6]); continue;
-                case 8: sidx -= 7; Stack[sidx] = (*(bulkfun_type8 )pTok->Fun.ptr)(nOffset, nThreadID, Stack[sidx], Stack[sidx+1], Stack[sidx+2], Stack[sidx+3], Stack[sidx+4], Stack[sidx+5], Stack[sidx+6], Stack[sidx+7]); continue;
-                case 9: sidx -= 8; Stack[sidx] = (*(bulkfun_type9 )pTok->Fun.ptr)(nOffset, nThreadID, Stack[sidx], Stack[sidx+1], Stack[sidx+2], Stack[sidx+3], Stack[sidx+4], Stack[sidx+5], Stack[sidx+6], Stack[sidx+7], Stack[sidx+8]); continue;
-                case 10:sidx -= 9; Stack[sidx] = (*(bulkfun_type10)pTok->Fun.ptr)(nOffset, nThreadID, Stack[sidx], Stack[sidx+1], Stack[sidx+2], Stack[sidx+3], Stack[sidx+4], Stack[sidx+5], Stack[sidx+6], Stack[sidx+7], Stack[sidx+8], Stack[sidx+9]); continue;
-                default:
-                  Error(ecINTERNAL_ERROR, 2);
-                  continue;
-                }
-              }
-
-        default:
-              Error(ecINTERNAL_ERROR, 3);
-              return 0;
-      } // switch CmdCode
-    } // for all bytecode tokens
-
-    return Stack[m_nFinalResultIdx];  
-  }
-
-  //---------------------------------------------------------------------------
-  void ParserBase::CreateRPN() const
-  {
-    if (!m_pTokenReader->GetExpr().length())
-      Error(ecUNEXPECTED_EOF, 0);
-
-    ParserStack<token_type> stOpt, stVal;
-    ParserStack<int> stArgCount;
-    token_type opta, opt;  // for storing operators
-    token_type val, tval;  // for storing value
-
-    ReInit();
-    
-    // The outermost counter counts the number of separated items
-    // such as in "a=10,b=20,c=c+a"
-    stArgCount.push(1);
-    
-    for(;;)
-    {
-      opt = m_pTokenReader->ReadNextToken();
-
-      switch (opt.GetCode())
-      {
-        //
-        // Next three are different kind of value entries
-        //
-        case cmSTRING:
-                opt.SetIdx((int)m_vStringBuf.size());      // Assign buffer index to token 
-                stVal.push(opt);
-		            m_vStringBuf.push_back(opt.GetAsString()); // Store string in internal buffer
-                break;
-   
-        case cmVAR:
-                stVal.push(opt);
-                m_vRPN.AddVar( static_cast<value_type*>(opt.GetVar()) );
-                break;
-
-        case cmVAL:
-		        stVal.push(opt);
-                m_vRPN.AddVal( opt.GetVal() );
-                break;
-
-        case cmELSE:
-                m_nIfElseCounter--;
-                if (m_nIfElseCounter<0)
-                  Error(ecMISPLACED_COLON, m_pTokenReader->GetPos());
-
-                ApplyRemainingOprt(stOpt, stVal);
-                m_vRPN.AddIfElse(cmELSE);
-                stOpt.push(opt);
-                break;
-
-
-        case cmARG_SEP:
-                if (stArgCount.empty())
-                  Error(ecUNEXPECTED_ARG_SEP, m_pTokenReader->GetPos());
-
-                ++stArgCount.top();
-                // fallthrough intentional (no break!)
-
-        case cmEND:
-                ApplyRemainingOprt(stOpt, stVal);
-                break;
-
-       case cmBC:
-                {
-                  // The argument count for parameterless functions is zero
-                  // by default an opening bracket sets parameter count to 1
-                  // in preparation of arguments to come. If the last token
-                  // was an opening bracket we know better...
-                  if (opta.GetCode()==cmBO)
-                    --stArgCount.top();
-                  
-                  ApplyRemainingOprt(stOpt, stVal);
-
-                  // Check if the bracket content has been evaluated completely
-                  if (stOpt.size() && stOpt.top().GetCode()==cmBO)
-                  {
-                    // if opt is ")" and opta is "(" the bracket has been evaluated, now its time to check
-                    // if there is either a function or a sign pending
-                    // neither the opening nor the closing bracket will be pushed back to
-                    // the operator stack
-                    // Check if a function is standing in front of the opening bracket, 
-                    // if yes evaluate it afterwards check for infix operators
-                    assert(stArgCount.size());
-                    int iArgCount = stArgCount.pop();
-                    
-                    stOpt.pop(); // Take opening bracket from stack
-
-                    if (iArgCount>1 && ( stOpt.size()==0 || 
-                                        (stOpt.top().GetCode()!=cmFUNC && 
-                                         stOpt.top().GetCode()!=cmFUNC_BULK && 
-                                         stOpt.top().GetCode()!=cmFUNC_STR) ) )
-                      Error(ecUNEXPECTED_ARG, m_pTokenReader->GetPos());
-                    
-                    // The opening bracket was popped from the stack now check if there
-                    // was a function before this bracket
-                    if (stOpt.size() && 
-                        stOpt.top().GetCode()!=cmOPRT_INFIX && 
-                        stOpt.top().GetCode()!=cmOPRT_BIN && 
-                        stOpt.top().GetFuncAddr()!=0)
-                    {
-                      ApplyFunc(stOpt, stVal, iArgCount);
-                    }
-                  }
-                } // if bracket content is evaluated
-                break;
-
-        //
-        // Next are the binary operator entries
-        //
-        //case cmAND:   // built in binary operators
-        //case cmOR:
-        //case cmXOR:
-        case cmIF:
-                m_nIfElseCounter++;
-                // fallthrough intentional (no break!)
-
-        case cmLAND:
-        case cmLOR:
-        case cmLT:
-        case cmGT:
-        case cmLE:
-        case cmGE:
-        case cmNEQ:
-        case cmEQ:
-        case cmADD:
-        case cmSUB:
-        case cmMUL:
-        case cmDIV:
-        case cmPOW:
-        case cmASSIGN:
-        case cmOPRT_BIN:
-
-                // A binary operator (user defined or built in) has been found. 
-                while ( stOpt.size() && 
-                        stOpt.top().GetCode() != cmBO &&
-                        stOpt.top().GetCode() != cmELSE &&
-                        stOpt.top().GetCode() != cmIF)
-                {
-                  int nPrec1 = GetOprtPrecedence(stOpt.top()),
-                      nPrec2 = GetOprtPrecedence(opt);
-
-                  if (stOpt.top().GetCode()==opt.GetCode())
-                  {
-
-                    // Deal with operator associativity
-                    EOprtAssociativity eOprtAsct = GetOprtAssociativity(opt);
-                    if ( (eOprtAsct==oaRIGHT && (nPrec1 <= nPrec2)) || 
-                         (eOprtAsct==oaLEFT  && (nPrec1 <  nPrec2)) )
-                    {
-                      break;
-                    }
-                  }
-                  else if (nPrec1 < nPrec2)
-                  {
-                    // In case the operators are not equal the precedence decides alone...
-                    break;
-                  }
-                  
-                  if (stOpt.top().GetCode()==cmOPRT_INFIX)
-                    ApplyFunc(stOpt, stVal, 1);
-                  else
-                    ApplyBinOprt(stOpt, stVal);
-                } // while ( ... )
-
-                if (opt.GetCode()==cmIF)
-                  m_vRPN.AddIfElse(opt.GetCode());
-
-    			      // The operator can't be evaluated right now, push back to the operator stack
-                stOpt.push(opt);
-                break;
-
-        //
-        // Last section contains functions and operators implicitly mapped to functions
-        //
-        case cmBO:
-                stArgCount.push(1);
-                stOpt.push(opt);
-                break;
-
-        case cmOPRT_INFIX:
-        case cmFUNC:
-        case cmFUNC_BULK:
-        case cmFUNC_STR:  
-                stOpt.push(opt);
-                break;
-
-        case cmOPRT_POSTFIX:
-                stOpt.push(opt);
-                ApplyFunc(stOpt, stVal, 1);  // this is the postfix operator
-                break;
-
-        default:  Error(ecINTERNAL_ERROR, 3);
-      } // end of switch operator-token
-
-      opta = opt;
-
-      if ( opt.GetCode() == cmEND )
-      {
-        m_vRPN.Finalize();
-        break;
-      }
-
-      if (ParserBase::g_DbgDumpStack)
-      {
-        StackDump(stVal, stOpt);
-        m_vRPN.AsciiDump();
-      }
-    } // while (true)
-
-    if (ParserBase::g_DbgDumpCmdCode)
-      m_vRPN.AsciiDump();
-
-    if (m_nIfElseCounter>0)
-      Error(ecMISSING_ELSE_CLAUSE);
-
-    // get the last value (= final result) from the stack
-    MUP_ASSERT(stArgCount.size()==1);
-    m_nFinalResultIdx = stArgCount.top();
-    if (m_nFinalResultIdx==0)
-      Error(ecINTERNAL_ERROR, 9);
-
-    if (stVal.size()==0)
-      Error(ecEMPTY_EXPRESSION);
-
-    if (stVal.top().GetType()!=tpDBL)
-      Error(ecSTR_RESULT);
-
-    m_vStackBuffer.resize(m_vRPN.GetMaxStackSize() * s_MaxNumOpenMPThreads);
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief One of the two main parse functions.
-      \sa ParseCmdCode(...)
-
-    Parse expression from input string. Perform syntax checking and create 
-    bytecode. After parsing the string and creating the bytecode the function 
-    pointer #m_pParseFormula will be changed to the second parse routine the 
-    uses bytecode instead of string parsing.
-  */
-  value_type ParserBase::ParseString() const
-  {
-    try
-    {
-      CreateRPN();
-      m_pParseFormula = &ParserBase::ParseCmdCode;
-      return (this->*m_pParseFormula)(); 
-    }
-    catch(ParserError &exc)
-    {
-      exc.SetFormula(m_pTokenReader->GetExpr());
-      throw;
-    }
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Create an error containing the parse error position.
-
-    This function will create an Parser Exception object containing the error text and
-    its position.
-
-    \param a_iErrc [in] The error code of type #EErrorCodes.
-    \param a_iPos [in] The position where the error was detected.
-    \param a_strTok [in] The token string representation associated with the error.
-    \throw ParserException always throws thats the only purpose of this function.
-  */
-  void  ParserBase::Error(EErrorCodes a_iErrc, int a_iPos, const string_type &a_sTok) const
-  {
-    throw exception_type(a_iErrc, a_sTok, m_pTokenReader->GetExpr(), a_iPos);
-  }
-
-  //------------------------------------------------------------------------------
-  /** \brief Clear all user defined variables.
-      \throw nothrow
-
-      Resets the parser to string parsing mode by calling #ReInit.
-  */
-  void ParserBase::ClearVar()
-  {
-    m_VarDef.clear();
-    ReInit();
-  }
-
-  //------------------------------------------------------------------------------
-  /** \brief Remove a variable from internal storage.
-      \throw nothrow
-
-      Removes a variable if it exists. If the Variable does not exist nothing will be done.
-  */
-  void ParserBase::RemoveVar(const string_type &a_strVarName)
-  {
-    varmap_type::iterator item = m_VarDef.find(a_strVarName);
-    if (item!=m_VarDef.end())
-    {
-      m_VarDef.erase(item);
-      ReInit();
-    }
-  }
-
-  //------------------------------------------------------------------------------
-  /** \brief Clear all functions.
-      \post Resets the parser to string parsing mode.
-      \throw nothrow
-  */
-  void ParserBase::ClearFun()
-  {
-    m_FunDef.clear();
-    ReInit();
-  }
-
-  //------------------------------------------------------------------------------
-  /** \brief Clear all user defined constants.
-
-      Both numeric and string constants will be removed from the internal storage.
-      \post Resets the parser to string parsing mode.
-      \throw nothrow
-  */
-  void ParserBase::ClearConst()
-  {
-    m_ConstDef.clear();
-    m_StrVarDef.clear();
-    ReInit();
-  }
-
-  //------------------------------------------------------------------------------
-  /** \brief Clear all user defined postfix operators.
-      \post Resets the parser to string parsing mode.
-      \throw nothrow
-  */
-  void ParserBase::ClearPostfixOprt()
-  {
-    m_PostOprtDef.clear();
-    ReInit();
-  }
-
-  //------------------------------------------------------------------------------
-  /** \brief Clear all user defined binary operators.
-      \post Resets the parser to string parsing mode.
-      \throw nothrow
-  */
-  void ParserBase::ClearOprt()
-  {
-    m_OprtDef.clear();
-    ReInit();
-  }
-
-  //------------------------------------------------------------------------------
-  /** \brief Clear the user defined Prefix operators. 
-      \post Resets the parser to string parser mode.
-      \throw nothrow
-  */
-  void ParserBase::ClearInfixOprt()
-  {
-    m_InfixOprtDef.clear();
-    ReInit();
-  }
-
-  //------------------------------------------------------------------------------
-  /** \brief Enable or disable the formula optimization feature. 
-      \post Resets the parser to string parser mode.
-      \throw nothrow
-  */
-  void ParserBase::EnableOptimizer(bool a_bIsOn)
-  {
-    m_vRPN.EnableOptimizer(a_bIsOn);
-    ReInit();
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Enable the dumping of bytecode and stack content on the console. 
-      \param bDumpCmd Flag to enable dumping of the current bytecode to the console.
-      \param bDumpStack Flag to enable dumping of the stack content is written to the console.
-
-     This function is for debug purposes only!
-  */
-  void ParserBase::EnableDebugDump(bool bDumpCmd, bool bDumpStack)
-  {
-    ParserBase::g_DbgDumpCmdCode = bDumpCmd;
-    ParserBase::g_DbgDumpStack   = bDumpStack;
-  }
-
-  //------------------------------------------------------------------------------
-  /** \brief Enable or disable the built in binary operators.
-      \throw nothrow
-      \sa m_bBuiltInOp, ReInit()
-
-    If you disable the built in binary operators there will be no binary operators
-    defined. Thus you must add them manually one by one. It is not possible to
-    disable built in operators selectively. This function will Reinitialize the
-    parser by calling ReInit().
-  */
-  void ParserBase::EnableBuiltInOprt(bool a_bIsOn)
-  {
-    m_bBuiltInOp = a_bIsOn;
-    ReInit();
-  }
-
-  //------------------------------------------------------------------------------
-  /** \brief Query status of built in variables.
-      \return #m_bBuiltInOp; true if built in operators are enabled.
-      \throw nothrow
-  */
-  bool ParserBase::HasBuiltInOprt() const
-  {
-    return m_bBuiltInOp;
-  }
-
-  //------------------------------------------------------------------------------
-  /** \brief Get the argument separator character. 
-  */
-  char_type ParserBase::GetArgSep() const
-  {
-    return m_pTokenReader->GetArgSep();
-  }
-
-  //------------------------------------------------------------------------------
-  /** \brief Set argument separator. 
-      \param cArgSep the argument separator character.
-  */
-  void ParserBase::SetArgSep(char_type cArgSep)
-  {
-    m_pTokenReader->SetArgSep(cArgSep);
-  }
-
-  //------------------------------------------------------------------------------
-  /** \brief Dump stack content. 
-
-      This function is used for debugging only.
-  */
-  void ParserBase::StackDump(const ParserStack<token_type> &a_stVal, 
-                             const ParserStack<token_type> &a_stOprt) const
-  {
-    ParserStack<token_type> stOprt(a_stOprt), 
-                            stVal(a_stVal);
-
-    mu::console() << _T("\nValue stack:\n");
-    while ( !stVal.empty() ) 
-    {
-      token_type val = stVal.pop();
-      if (val.GetType()==tpSTR)
-        mu::console() << _T(" \"") << val.GetAsString() << _T("\" ");
-      else
-        mu::console() << _T(" ") << val.GetVal() << _T(" ");
-    }
-    mu::console() << "\nOperator stack:\n";
-
-    while ( !stOprt.empty() )
-    {
-      if (stOprt.top().GetCode()<=cmASSIGN) 
-      {
-        mu::console() << _T("OPRT_INTRNL \"")
-                      << ParserBase::c_DefaultOprt[stOprt.top().GetCode()] 
-                      << _T("\" \n");
-      }
-      else
-      {
-        switch(stOprt.top().GetCode())
-        {
-        case cmVAR:   mu::console() << _T("VAR\n");  break;
-        case cmVAL:   mu::console() << _T("VAL\n");  break;
-        case cmFUNC:  mu::console() << _T("FUNC \"") 
-                                    << stOprt.top().GetAsString() 
-                                    << _T("\"\n");   break;
-        case cmFUNC_BULK:  mu::console() << _T("FUNC_BULK \"") 
-                                         << stOprt.top().GetAsString() 
-                                         << _T("\"\n");   break;
-        case cmOPRT_INFIX: mu::console() << _T("OPRT_INFIX \"")
-                                         << stOprt.top().GetAsString() 
-                                         << _T("\"\n");      break;
-        case cmOPRT_BIN:   mu::console() << _T("OPRT_BIN \"") 
-                                         << stOprt.top().GetAsString() 
-                                         << _T("\"\n");           break;
-        case cmFUNC_STR: mu::console() << _T("FUNC_STR\n");       break;
-        case cmEND:      mu::console() << _T("END\n");            break;
-        case cmUNKNOWN:  mu::console() << _T("UNKNOWN\n");        break;
-        case cmBO:       mu::console() << _T("BRACKET \"(\"\n");  break;
-        case cmBC:       mu::console() << _T("BRACKET \")\"\n");  break;
-        case cmIF:       mu::console() << _T("IF\n");  break;
-        case cmELSE:     mu::console() << _T("ELSE\n");  break;
-        case cmENDIF:    mu::console() << _T("ENDIF\n");  break;
-        default:         mu::console() << stOprt.top().GetCode() << _T(" ");  break;
-        }
-      }	
-      stOprt.pop();
-    }
-
-    mu::console() << dec << endl;
-  }
-
-  //------------------------------------------------------------------------------
-  /** \brief Evaluate an expression containing comma separated subexpressions 
-      \param [out] nStackSize The total number of results available
-      \return Pointer to the array containing all expression results
-
-      This member function can be used to retrieve all results of an expression
-      made up of multiple comma separated subexpressions (i.e. "x+y,sin(x),cos(y)")
-  */
-  value_type* ParserBase::Eval(int &nStackSize) const
-  {
-    (this->*m_pParseFormula)(); 
-    nStackSize = m_nFinalResultIdx;
-
-    // (for historic reasons the stack starts at position 1)
-    return &m_vStackBuffer[1];
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Return the number of results on the calculation stack. 
-  
-    If the expression contains comma separated subexpressions (i.e. "sin(y), x+y"). 
-    There may be more than one return value. This function returns the number of 
-    available results.
-  */
-  int ParserBase::GetNumResults() const
-  {
-    return m_nFinalResultIdx;
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Calculate the result.
-
-    A note on const correctness: 
-    I consider it important that Calc is a const function.
-    Due to caching operations Calc changes only the state of internal variables with one exception
-    m_UsedVar this is reset during string parsing and accessible from the outside. Instead of making
-    Calc non const GetUsedVar is non const because it explicitly calls Eval() forcing this update. 
-
-    \pre A formula must be set.
-    \pre Variables must have been set (if needed)
-
-    \sa #m_pParseFormula
-    \return The evaluation result
-    \throw ParseException if no Formula is set or in case of any other error related to the formula.
-  */
-  value_type ParserBase::Eval() const
-  {
-    return (this->*m_pParseFormula)(); 
-  }
-
-  //---------------------------------------------------------------------------
-  void ParserBase::Eval(value_type *results, int nBulkSize)
-  {
-/* <ibg 2014-09-24/> Commented because it is making a unit test impossible
-
-    // Parallelization does not make sense for fewer than 10000 computations 
-    // due to thread creation overhead. If the bulk size is below 2000
-    // computation is refused. 
-    if (nBulkSize<2000)
-    {
-      throw ParserError(ecUNREASONABLE_NUMBER_OF_COMPUTATIONS);
-    }
-*/
-    CreateRPN();
-
-    int i = 0;
-
-#ifdef MUP_USE_OPENMP
-//#define DEBUG_OMP_STUFF
-    #ifdef DEBUG_OMP_STUFF
-    int *pThread = new int[nBulkSize];
-    int *pIdx = new int[nBulkSize];
-    #endif
-
-    int nMaxThreads = std::min(omp_get_max_threads(), s_MaxNumOpenMPThreads);
-	int nThreadID = 0, ct = 0;
-    omp_set_num_threads(nMaxThreads);
-
-    #pragma omp parallel for schedule(static, nBulkSize/nMaxThreads) private(nThreadID)
-    for (i=0; i<nBulkSize; ++i)
-    {
-      nThreadID = omp_get_thread_num();
-      results[i] = ParseCmdCodeBulk(i, nThreadID);
-
-      #ifdef DEBUG_OMP_STUFF
-      #pragma omp critical
-      {
-        pThread[ct] = nThreadID;  
-        pIdx[ct] = i; 
-        ct++;
-      }
-      #endif
-    }
-
-#ifdef DEBUG_OMP_STUFF
-    FILE *pFile = fopen("bulk_dbg.txt", "w");
-    for (i=0; i<nBulkSize; ++i)
-    {
-      fprintf(pFile, "idx: %d  thread: %d \n", pIdx[i], pThread[i]);
-    }
-    
-    delete [] pIdx;
-    delete [] pThread;
-
-    fclose(pFile);
-#endif
-
-#else
-    for (i=0; i<nBulkSize; ++i)
-    {
-      results[i] = ParseCmdCodeBulk(i, 0);
-    }
-#endif
-
-  }
-} // namespace mu
+/*
+                 __________
+    _____   __ __\______   \_____  _______  ______  ____ _______
+   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
+  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
+  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|
+        \/                       \/            \/      \/
+  Copyright (C) 2011 Ingo Berg
+
+  Permission is hereby granted, free of charge, to any person obtaining a copy of this
+  software and associated documentation files (the "Software"), to deal in the Software
+  without restriction, including without limitation the rights to use, copy, modify,
+  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
+  permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included in all copies or
+  substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
+  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include "muParserBase.h"
+#include "muParserTemplateMagic.h"
+
+//--- Standard includes ------------------------------------------------------------------------
+#include <cassert>
+#include <algorithm>
+#include <cmath>
+#include <memory>
+#include <vector>
+#include <deque>
+#include <sstream>
+#include <locale>
+
+#ifdef MUP_USE_OPENMP
+  #include <omp.h>
+#endif
+
+using namespace std;
+
+/** \file
+    \brief This file contains the basic implementation of the muparser engine.
+*/
+
+namespace mu
+{
+  std::locale ParserBase::s_locale = std::locale(std::locale::classic(), new change_dec_sep<char_type>('.'));
+
+  bool ParserBase::g_DbgDumpCmdCode = false;
+  bool ParserBase::g_DbgDumpStack = false;
+
+  //------------------------------------------------------------------------------
+  /** \brief Identifiers for built in binary operators.
+
+      When defining custom binary operators with #AddOprt(...) make sure not to choose
+      names conflicting with these definitions.
+  */
+  const char_type* ParserBase::c_DefaultOprt[] =
+  {
+    _T("<="), _T(">="),  _T("!="),
+    _T("=="), _T("<"),   _T(">"),
+    _T("+"),  _T("-"),   _T("*"),
+    _T("/"),  _T("^"),   _T("&&"),
+    _T("||"), _T("="),   _T("("),
+    _T(")"),   _T("?"),  _T(":"), 0
+  };
+
+  //------------------------------------------------------------------------------
+  /** \brief Constructor.
+      \param a_szFormula the formula to interpret.
+      \throw ParserException if a_szFormula is null.
+  */
+  ParserBase::ParserBase()
+    :m_pParseFormula(&ParserBase::ParseString)
+    ,m_vRPN()
+    ,m_vStringBuf()
+    ,m_pTokenReader()
+    ,m_FunDef()
+    ,m_PostOprtDef()
+    ,m_InfixOprtDef()
+    ,m_OprtDef()
+    ,m_ConstDef()
+    ,m_StrVarDef()
+    ,m_VarDef()
+    ,m_bBuiltInOp(true)
+    ,m_sNameChars()
+    ,m_sOprtChars()
+    ,m_sInfixOprtChars()
+    ,m_nIfElseCounter(0)
+    ,m_vStackBuffer()
+    ,m_nFinalResultIdx(0)
+  {
+    InitTokenReader();
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Copy constructor.
+
+    The parser can be safely copy constructed but the bytecode is reset during
+    copy construction.
+  */
+  ParserBase::ParserBase(const ParserBase &a_Parser)
+    :m_pParseFormula(&ParserBase::ParseString)
+    ,m_vRPN()
+    ,m_vStringBuf()
+    ,m_pTokenReader()
+    ,m_FunDef()
+    ,m_PostOprtDef()
+    ,m_InfixOprtDef()
+    ,m_OprtDef()
+    ,m_ConstDef()
+    ,m_StrVarDef()
+    ,m_VarDef()
+    ,m_bBuiltInOp(true)
+    ,m_sNameChars()
+    ,m_sOprtChars()
+    ,m_sInfixOprtChars()
+    ,m_nIfElseCounter(0)
+  {
+    m_pTokenReader.reset(new token_reader_type(this));
+    Assign(a_Parser);
+  }
+
+  //---------------------------------------------------------------------------
+  ParserBase::~ParserBase()
+  {}
+
+  //---------------------------------------------------------------------------
+  /** \brief Assignment operator.
+
+    Implemented by calling Assign(a_Parser). Self assignment is suppressed.
+    \param a_Parser Object to copy to this.
+    \return *this
+    \throw nothrow
+  */
+  ParserBase& ParserBase::operator=(const ParserBase &a_Parser)
+  {
+    Assign(a_Parser);
+    return *this;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Copy state of a parser object to this.
+
+    Clears Variables and Functions of this parser.
+    Copies the states of all internal variables.
+    Resets parse function to string parse mode.
+
+    \param a_Parser the source object.
+  */
+  void ParserBase::Assign(const ParserBase &a_Parser)
+  {
+    if (&a_Parser==this)
+      return;
+
+    // Don't copy bytecode instead cause the parser to create new bytecode
+    // by resetting the parse function.
+    ReInit();
+
+    m_ConstDef        = a_Parser.m_ConstDef;         // Copy user define constants
+    m_VarDef          = a_Parser.m_VarDef;           // Copy user defined variables
+    m_bBuiltInOp      = a_Parser.m_bBuiltInOp;
+    m_vStringBuf      = a_Parser.m_vStringBuf;
+    m_vStackBuffer    = a_Parser.m_vStackBuffer;
+    m_nFinalResultIdx = a_Parser.m_nFinalResultIdx;
+    m_StrVarDef       = a_Parser.m_StrVarDef;
+    m_vStringVarBuf   = a_Parser.m_vStringVarBuf;
+    m_nIfElseCounter  = a_Parser.m_nIfElseCounter;
+    m_pTokenReader.reset(a_Parser.m_pTokenReader->Clone(this));
+
+    // Copy function and operator callbacks
+    m_FunDef = a_Parser.m_FunDef;             // Copy function definitions
+    m_PostOprtDef = a_Parser.m_PostOprtDef;   // post value unary operators
+    m_InfixOprtDef = a_Parser.m_InfixOprtDef; // unary operators for infix notation
+    m_OprtDef = a_Parser.m_OprtDef;           // binary operators
+
+    m_sNameChars = a_Parser.m_sNameChars;
+    m_sOprtChars = a_Parser.m_sOprtChars;
+    m_sInfixOprtChars = a_Parser.m_sInfixOprtChars;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Set the decimal separator.
+      \param cDecSep Decimal separator as a character value.
+      \sa SetThousandsSep
+
+      By default muparser uses the "C" locale. The decimal separator of this
+      locale is overwritten by the one provided here.
+  */
+  void ParserBase::SetDecSep(char_type cDecSep)
+  {
+    char_type cThousandsSep = std::use_facet< change_dec_sep<char_type> >(s_locale).thousands_sep();
+    s_locale = std::locale(std::locale("C"), new change_dec_sep<char_type>(cDecSep, cThousandsSep));
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Sets the thousands operator.
+      \param cThousandsSep The thousands separator as a character
+      \sa SetDecSep
+
+      By default muparser uses the "C" locale. The thousands separator of this
+      locale is overwritten by the one provided here.
+  */
+  void ParserBase::SetThousandsSep(char_type cThousandsSep)
+  {
+    char_type cDecSep = std::use_facet< change_dec_sep<char_type> >(s_locale).decimal_point();
+    s_locale = std::locale(std::locale("C"), new change_dec_sep<char_type>(cDecSep, cThousandsSep));
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Resets the locale.
+
+    The default locale used "." as decimal separator, no thousands separator and
+    "," as function argument separator.
+  */
+  void ParserBase::ResetLocale()
+  {
+    s_locale = std::locale(std::locale("C"), new change_dec_sep<char_type>('.'));
+    SetArgSep(',');
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Initialize the token reader.
+
+    Create new token reader object and submit pointers to function, operator,
+    constant and variable definitions.
+
+    \post m_pTokenReader.get()!=0
+    \throw nothrow
+  */
+  void ParserBase::InitTokenReader()
+  {
+    m_pTokenReader.reset(new token_reader_type(this));
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Reset parser to string parsing mode and clear internal buffers.
+
+      Clear bytecode, reset the token reader.
+      \throw nothrow
+  */
+  void ParserBase::ReInit() const
+  {
+    m_pParseFormula = &ParserBase::ParseString;
+    m_vStringBuf.clear();
+    m_vRPN.clear();
+    m_pTokenReader->ReInit();
+    m_nIfElseCounter = 0;
+  }
+
+  //---------------------------------------------------------------------------
+  void ParserBase::OnDetectVar(string_type * /*pExpr*/, int & /*nStart*/, int & /*nEnd*/)
+  {}
+
+  //---------------------------------------------------------------------------
+  /** \brief Returns the version of muparser.
+      \param eInfo A flag indicating whether the full version info should be
+                   returned or not.
+
+    Format is as follows: "MAJOR.MINOR (COMPILER_FLAGS)" The COMPILER_FLAGS
+    are returned only if eInfo==pviFULL.
+  */
+  string_type ParserBase::GetVersion(EParserVersionInfo eInfo) const
+  {
+    stringstream_type ss;
+
+    ss << MUP_VERSION;
+
+    if (eInfo==pviFULL)
+    {
+      ss << _T(" (") << MUP_VERSION_DATE;
+      ss << std::dec << _T("; ") << sizeof(void*)*8 << _T("BIT");
+
+#ifdef _DEBUG
+      ss << _T("; DEBUG");
+#else
+      ss << _T("; RELEASE");
+#endif
+
+#ifdef _UNICODE
+      ss << _T("; UNICODE");
+#else
+  #ifdef _MBCS
+      ss << _T("; MBCS");
+  #else
+      ss << _T("; ASCII");
+  #endif
+#endif
+
+#ifdef MUP_USE_OPENMP
+      ss << _T("; OPENMP");
+//#else
+//      ss << _T("; NO_OPENMP");
+#endif
+
+#if defined(MUP_MATH_EXCEPTIONS)
+      ss << _T("; MATHEXC");
+//#else
+//      ss << _T("; NO_MATHEXC");
+#endif
+
+      ss << _T(")");
+    }
+
+    return ss.str();
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Add a value parsing function.
+
+      When parsing an expression muParser tries to detect values in the expression
+      string using different valident callbacks. Thus it's possible to parse
+      for hex values, binary values and floating point values.
+  */
+  void ParserBase::AddValIdent(identfun_type a_pCallback)
+  {
+    m_pTokenReader->AddValIdent(a_pCallback);
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Set a function that can create variable pointer for unknown expression variables.
+      \param a_pFactory A pointer to the variable factory.
+      \param pUserData A user defined context pointer.
+  */
+  void ParserBase::SetVarFactory(facfun_type a_pFactory, void *pUserData)
+  {
+    m_pTokenReader->SetVarCreator(a_pFactory, pUserData);
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Add a function or operator callback to the parser. */
+  void ParserBase::AddCallback( const string_type &a_strName,
+                                const ParserCallback &a_Callback,
+                                funmap_type &a_Storage,
+                                const char_type *a_szCharSet )
+  {
+    if (a_Callback.GetAddr()==0)
+        Error(ecINVALID_FUN_PTR);
+
+    const funmap_type *pFunMap = &a_Storage;
+
+    // Check for conflicting operator or function names
+    if ( pFunMap!=&m_FunDef && m_FunDef.find(a_strName)!=m_FunDef.end() )
+      Error(ecNAME_CONFLICT, -1, a_strName);
+
+    if ( pFunMap!=&m_PostOprtDef && m_PostOprtDef.find(a_strName)!=m_PostOprtDef.end() )
+      Error(ecNAME_CONFLICT, -1, a_strName);
+
+    if ( pFunMap!=&m_InfixOprtDef && pFunMap!=&m_OprtDef && m_InfixOprtDef.find(a_strName)!=m_InfixOprtDef.end() )
+      Error(ecNAME_CONFLICT, -1, a_strName);
+
+    if ( pFunMap!=&m_InfixOprtDef && pFunMap!=&m_OprtDef && m_OprtDef.find(a_strName)!=m_OprtDef.end() )
+      Error(ecNAME_CONFLICT, -1, a_strName);
+
+    CheckOprt(a_strName, a_Callback, a_szCharSet);
+    a_Storage[a_strName] = a_Callback;
+    ReInit();
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Check if a name contains invalid characters.
+
+      \throw ParserException if the name contains invalid characters.
+  */
+  void ParserBase::CheckOprt(const string_type &a_sName,
+                             const ParserCallback &a_Callback,
+                             const string_type &a_szCharSet) const
+  {
+    if ( !a_sName.length() ||
+        (a_sName.find_first_not_of(a_szCharSet)!=string_type::npos) ||
+        (a_sName[0]>='0' && a_sName[0]<='9'))
+    {
+      switch(a_Callback.GetCode())
+      {
+      case cmOPRT_POSTFIX: Error(ecINVALID_POSTFIX_IDENT, -1, a_sName);
+      case cmOPRT_INFIX:   Error(ecINVALID_INFIX_IDENT, -1, a_sName);
+      default:             Error(ecINVALID_NAME, -1, a_sName);
+      }
+    }
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Check if a name contains invalid characters.
+
+      \throw ParserException if the name contains invalid characters.
+  */
+  void ParserBase::CheckName(const string_type &a_sName,
+                             const string_type &a_szCharSet) const
+  {
+    if ( !a_sName.length() ||
+        (a_sName.find_first_not_of(a_szCharSet)!=string_type::npos) ||
+        (a_sName[0]>='0' && a_sName[0]<='9'))
+    {
+      Error(ecINVALID_NAME);
+    }
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Set the formula.
+      \param a_strFormula Formula as string_type
+      \throw ParserException in case of syntax errors.
+
+      Triggers first time calculation thus the creation of the bytecode and
+      scanning of used variables.
+  */
+  void ParserBase::SetExpr(const string_type &a_sExpr)
+  {
+    // Check locale compatibility
+    std::locale loc;
+    if (m_pTokenReader->GetArgSep()==std::use_facet<numpunct<char_type> >(loc).decimal_point())
+      Error(ecLOCALE);
+
+    // <ibg> 20060222: Bugfix for Borland-Kylix:
+    // adding a space to the expression will keep Borlands KYLIX from going wild
+    // when calling tellg on a stringstream created from the expression after
+    // reading a value at the end of an expression. (mu::Parser::IsVal function)
+    // (tellg returns -1 otherwise causing the parser to ignore the value)
+    string_type sBuf(a_sExpr + _T(" ") );
+    m_pTokenReader->SetFormula(sBuf);
+    ReInit();
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Get the default symbols used for the built in operators.
+      \sa c_DefaultOprt
+  */
+  const char_type** ParserBase::GetOprtDef() const
+  {
+    return (const char_type **)(&c_DefaultOprt[0]);
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Define the set of valid characters to be used in names of
+             functions, variables, constants.
+  */
+  void ParserBase::DefineNameChars(const char_type *a_szCharset)
+  {
+    m_sNameChars = a_szCharset;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Define the set of valid characters to be used in names of
+             binary operators and postfix operators.
+  */
+  void ParserBase::DefineOprtChars(const char_type *a_szCharset)
+  {
+    m_sOprtChars = a_szCharset;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Define the set of valid characters to be used in names of
+             infix operators.
+  */
+  void ParserBase::DefineInfixOprtChars(const char_type *a_szCharset)
+  {
+    m_sInfixOprtChars = a_szCharset;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Virtual function that defines the characters allowed in name identifiers.
+      \sa #ValidOprtChars, #ValidPrefixOprtChars
+  */
+  const char_type* ParserBase::ValidNameChars() const
+  {
+    assert(m_sNameChars.size());
+    return m_sNameChars.c_str();
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Virtual function that defines the characters allowed in operator definitions.
+      \sa #ValidNameChars, #ValidPrefixOprtChars
+  */
+  const char_type* ParserBase::ValidOprtChars() const
+  {
+    assert(m_sOprtChars.size());
+    return m_sOprtChars.c_str();
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Virtual function that defines the characters allowed in infix operator definitions.
+      \sa #ValidNameChars, #ValidOprtChars
+  */
+  const char_type* ParserBase::ValidInfixOprtChars() const
+  {
+    assert(m_sInfixOprtChars.size());
+    return m_sInfixOprtChars.c_str();
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Add a user defined operator.
+      \post Will reset the Parser to string parsing mode.
+  */
+  void ParserBase::DefinePostfixOprt(const string_type &a_sName,
+                                     fun_type1 a_pFun,
+                                     bool a_bAllowOpt)
+  {
+    AddCallback(a_sName,
+                ParserCallback(a_pFun, a_bAllowOpt, prPOSTFIX, cmOPRT_POSTFIX),
+                m_PostOprtDef,
+                ValidOprtChars() );
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Initialize user defined functions.
+
+    Calls the virtual functions InitFun(), InitConst() and InitOprt().
+  */
+  void ParserBase::Init()
+  {
+    InitCharSets();
+    InitFun();
+    InitConst();
+    InitOprt();
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Add a user defined operator.
+      \post Will reset the Parser to string parsing mode.
+      \param [in] a_sName  operator Identifier
+      \param [in] a_pFun  Operator callback function
+      \param [in] a_iPrec  Operator Precedence (default=prSIGN)
+      \param [in] a_bAllowOpt  True if operator is volatile (default=false)
+      \sa EPrec
+  */
+  void ParserBase::DefineInfixOprt(const string_type &a_sName,
+                                  fun_type1 a_pFun,
+                                  int a_iPrec,
+                                  bool a_bAllowOpt)
+  {
+    AddCallback(a_sName,
+                ParserCallback(a_pFun, a_bAllowOpt, a_iPrec, cmOPRT_INFIX),
+                m_InfixOprtDef,
+                ValidInfixOprtChars() );
+  }
+
+
+  //---------------------------------------------------------------------------
+  /** \brief Define a binary operator.
+      \param [in] a_sName The identifier of the operator.
+      \param [in] a_pFun Pointer to the callback function.
+      \param [in] a_iPrec Precedence of the operator.
+      \param [in] a_eAssociativity The associativity of the operator.
+      \param [in] a_bAllowOpt If this is true the operator may be optimized away.
+
+      Adds a new Binary operator the the parser instance.
+  */
+  void ParserBase::DefineOprt( const string_type &a_sName,
+                               fun_type2 a_pFun,
+                               unsigned a_iPrec,
+                               EOprtAssociativity a_eAssociativity,
+                               bool a_bAllowOpt )
+  {
+    // Check for conflicts with built in operator names
+    for (int i=0; m_bBuiltInOp && i<cmENDIF; ++i)
+      if (a_sName == string_type(c_DefaultOprt[i]))
+        Error(ecBUILTIN_OVERLOAD, -1, a_sName);
+
+    AddCallback(a_sName,
+                ParserCallback(a_pFun, a_bAllowOpt, a_iPrec, a_eAssociativity),
+                m_OprtDef,
+                ValidOprtChars() );
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Define a new string constant.
+      \param [in] a_strName The name of the constant.
+      \param [in] a_strVal the value of the constant.
+  */
+  void ParserBase::DefineStrConst(const string_type &a_strName, const string_type &a_strVal)
+  {
+    // Test if a constant with that names already exists
+    if (m_StrVarDef.find(a_strName)!=m_StrVarDef.end())
+      Error(ecNAME_CONFLICT);
+
+    CheckName(a_strName, ValidNameChars());
+
+    m_vStringVarBuf.push_back(a_strVal);                // Store variable string in internal buffer
+    m_StrVarDef[a_strName] = m_vStringVarBuf.size()-1;  // bind buffer index to variable name
+
+    ReInit();
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Add a user defined variable.
+      \param [in] a_sName the variable name
+      \param [in] a_pVar A pointer to the variable value.
+      \post Will reset the Parser to string parsing mode.
+      \throw ParserException in case the name contains invalid signs or a_pVar is NULL.
+  */
+  void ParserBase::DefineVar(const string_type &a_sName, value_type *a_pVar)
+  {
+    if (a_pVar==0)
+      Error(ecINVALID_VAR_PTR);
+
+    // Test if a constant with that names already exists
+    if (m_ConstDef.find(a_sName)!=m_ConstDef.end())
+      Error(ecNAME_CONFLICT);
+
+    CheckName(a_sName, ValidNameChars());
+    m_VarDef[a_sName] = a_pVar;
+    ReInit();
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Add a user defined constant.
+      \param [in] a_sName The name of the constant.
+      \param [in] a_fVal the value of the constant.
+      \post Will reset the Parser to string parsing mode.
+      \throw ParserException in case the name contains invalid signs.
+  */
+  void ParserBase::DefineConst(const string_type &a_sName, value_type a_fVal)
+  {
+    CheckName(a_sName, ValidNameChars());
+    m_ConstDef[a_sName] = a_fVal;
+    ReInit();
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Get operator priority.
+      \throw ParserException if a_Oprt is no operator code
+  */
+  int ParserBase::GetOprtPrecedence(const token_type &a_Tok) const
+  {
+    switch (a_Tok.GetCode())
+    {
+    // built in operators
+    case cmEND:      return -5;
+    case cmARG_SEP:  return -4;
+    case cmASSIGN:   return -1;
+    case cmELSE:
+    case cmIF:       return  0;
+    case cmLAND:     return  prLAND;
+    case cmLOR:      return  prLOR;
+    case cmLT:
+    case cmGT:
+    case cmLE:
+    case cmGE:
+    case cmNEQ:
+    case cmEQ:       return  prCMP;
+    case cmADD:
+    case cmSUB:      return  prADD_SUB;
+    case cmMUL:
+    case cmDIV:      return  prMUL_DIV;
+    case cmPOW:      return  prPOW;
+
+    // user defined binary operators
+    case cmOPRT_INFIX:
+    case cmOPRT_BIN: return a_Tok.GetPri();
+    default:  Error(ecINTERNAL_ERROR, 5);
+              return 999;
+    }
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Get operator priority.
+      \throw ParserException if a_Oprt is no operator code
+  */
+  EOprtAssociativity ParserBase::GetOprtAssociativity(const token_type &a_Tok) const
+  {
+    switch (a_Tok.GetCode())
+    {
+    case cmASSIGN:
+    case cmLAND:
+    case cmLOR:
+    case cmLT:
+    case cmGT:
+    case cmLE:
+    case cmGE:
+    case cmNEQ:
+    case cmEQ:
+    case cmADD:
+    case cmSUB:
+    case cmMUL:
+    case cmDIV:      return oaLEFT;
+    case cmPOW:      return oaRIGHT;
+    case cmOPRT_BIN: return a_Tok.GetAssociativity();
+    default:         return oaNONE;
+    }
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Return a map containing the used variables only. */
+  const varmap_type& ParserBase::GetUsedVar() const
+  {
+    try
+    {
+      m_pTokenReader->IgnoreUndefVar(true);
+      CreateRPN(); // try to create bytecode, but don't use it for any further calculations since it
+                   // may contain references to nonexisting variables.
+      m_pParseFormula = &ParserBase::ParseString;
+      m_pTokenReader->IgnoreUndefVar(false);
+    }
+    catch(exception_type & /*e*/)
+    {
+      // Make sure to stay in string parse mode, dont call ReInit()
+      // because it deletes the array with the used variables
+      m_pParseFormula = &ParserBase::ParseString;
+      m_pTokenReader->IgnoreUndefVar(false);
+      throw;
+    }
+
+    return m_pTokenReader->GetUsedVar();
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Return a map containing the used variables only. */
+  const varmap_type& ParserBase::GetVar() const
+  {
+    return m_VarDef;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Return a map containing all parser constants. */
+  const valmap_type& ParserBase::GetConst() const
+  {
+    return m_ConstDef;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Return prototypes of all parser functions.
+      \return #m_FunDef
+      \sa FunProt
+      \throw nothrow
+
+      The return type is a map of the public type #funmap_type containing the prototype
+      definitions for all numerical parser functions. String functions are not part of
+      this map. The Prototype definition is encapsulated in objects of the class FunProt
+      one per parser function each associated with function names via a map construct.
+  */
+  const funmap_type& ParserBase::GetFunDef() const
+  {
+    return m_FunDef;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Retrieve the formula. */
+  const string_type& ParserBase::GetExpr() const
+  {
+    return m_pTokenReader->GetExpr();
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Execute a function that takes a single string argument.
+      \param a_FunTok Function token.
+      \throw exception_type If the function token is not a string function
+  */
+  ParserBase::token_type ParserBase::ApplyStrFunc(const token_type &a_FunTok,
+                                                  const std::vector<token_type> &a_vArg) const
+  {
+    if (a_vArg.back().GetCode()!=cmSTRING)
+      Error(ecSTRING_EXPECTED, m_pTokenReader->GetPos(), a_FunTok.GetAsString());
+
+    token_type  valTok;
+    generic_fun_type pFunc = a_FunTok.GetFuncAddr();
+    assert(pFunc);
+
+    try
+    {
+      // Check function arguments; write dummy value into valtok to represent the result
+      switch(a_FunTok.GetArgCount())
+      {
+      case 0: valTok.SetVal(1); a_vArg[0].GetAsString();  break;
+      case 1: valTok.SetVal(1); a_vArg[1].GetAsString();  a_vArg[0].GetVal();  break;
+      case 2: valTok.SetVal(1); a_vArg[2].GetAsString();  a_vArg[1].GetVal();  a_vArg[0].GetVal();  break;
+      default: Error(ecINTERNAL_ERROR);
+      }
+    }
+    catch(ParserError& )
+    {
+      Error(ecVAL_EXPECTED, m_pTokenReader->GetPos(), a_FunTok.GetAsString());
+    }
+
+    // string functions won't be optimized
+    m_vRPN.AddStrFun(pFunc, a_FunTok.GetArgCount(), a_vArg.back().GetIdx());
+
+    // Push dummy value representing the function result to the stack
+    return valTok;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Apply a function token.
+      \param iArgCount Number of Arguments actually gathered used only for multiarg functions.
+      \post The result is pushed to the value stack
+      \post The function token is removed from the stack
+      \throw exception_type if Argument count does not match function requirements.
+  */
+  void ParserBase::ApplyFunc( ParserStack<token_type> &a_stOpt,
+                              ParserStack<token_type> &a_stVal,
+                              int a_iArgCount) const
+  {
+    assert(m_pTokenReader.get());
+
+    // Operator stack empty or does not contain tokens with callback functions
+    if (a_stOpt.empty() || a_stOpt.top().GetFuncAddr()==0 )
+      return;
+
+    token_type funTok = a_stOpt.pop();
+    assert(funTok.GetFuncAddr());
+
+    // Binary operators must rely on their internal operator number
+    // since counting of operators relies on commas for function arguments
+    // binary operators do not have commas in their expression
+    int iArgCount = (funTok.GetCode()==cmOPRT_BIN) ? funTok.GetArgCount() : a_iArgCount;
+
+    // determine how many parameters the function needs. To remember iArgCount includes the
+    // string parameter whilst GetArgCount() counts only numeric parameters.
+    int iArgRequired = funTok.GetArgCount() + ((funTok.GetType()==tpSTR) ? 1 : 0);
+
+    // Thats the number of numerical parameters
+    int iArgNumerical = iArgCount - ((funTok.GetType()==tpSTR) ? 1 : 0);
+
+    if (funTok.GetCode()==cmFUNC_STR && iArgCount-iArgNumerical>1)
+      Error(ecINTERNAL_ERROR);
+
+    if (funTok.GetArgCount()>=0 && iArgCount>iArgRequired)
+      Error(ecTOO_MANY_PARAMS, m_pTokenReader->GetPos()-1, funTok.GetAsString());
+
+    if (funTok.GetCode()!=cmOPRT_BIN && iArgCount<iArgRequired )
+      Error(ecTOO_FEW_PARAMS, m_pTokenReader->GetPos()-1, funTok.GetAsString());
+
+    if (funTok.GetCode()==cmFUNC_STR && iArgCount>iArgRequired )
+      Error(ecTOO_MANY_PARAMS, m_pTokenReader->GetPos()-1, funTok.GetAsString());
+
+    // Collect the numeric function arguments from the value stack and store them
+    // in a vector
+    std::vector<token_type> stArg;
+    for (int i=0; i<iArgNumerical; ++i)
+    {
+      stArg.push_back( a_stVal.pop() );
+      if ( stArg.back().GetType()==tpSTR && funTok.GetType()!=tpSTR )
+        Error(ecVAL_EXPECTED, m_pTokenReader->GetPos(), funTok.GetAsString());
+    }
+
+    switch(funTok.GetCode())
+    {
+    case  cmFUNC_STR:
+          stArg.push_back(a_stVal.pop());
+
+          if ( stArg.back().GetType()==tpSTR && funTok.GetType()!=tpSTR )
+            Error(ecVAL_EXPECTED, m_pTokenReader->GetPos(), funTok.GetAsString());
+
+          ApplyStrFunc(funTok, stArg);
+          break;
+
+    case  cmFUNC_BULK:
+          m_vRPN.AddBulkFun(funTok.GetFuncAddr(), (int)stArg.size());
+          break;
+
+    case  cmOPRT_BIN:
+    case  cmOPRT_POSTFIX:
+    case  cmOPRT_INFIX:
+    case  cmFUNC:
+          if (funTok.GetArgCount()==-1 && iArgCount==0)
+            Error(ecTOO_FEW_PARAMS, m_pTokenReader->GetPos(), funTok.GetAsString());
+
+          m_vRPN.AddFun(funTok.GetFuncAddr(), (funTok.GetArgCount()==-1) ? -iArgNumerical : iArgNumerical);
+          break;
+    }
+
+    // Push dummy value representing the function result to the stack
+    token_type token;
+    token.SetVal(1);
+    a_stVal.push(token);
+  }
+
+  //---------------------------------------------------------------------------
+  void ParserBase::ApplyIfElse(ParserStack<token_type> &a_stOpt,
+                               ParserStack<token_type> &a_stVal) const
+  {
+    // Check if there is an if Else clause to be calculated
+    while (a_stOpt.size() && a_stOpt.top().GetCode()==cmELSE)
+    {
+      token_type opElse = a_stOpt.pop();
+      MUP_ASSERT(a_stOpt.size()>0);
+
+      // Take the value associated with the else branch from the value stack
+      token_type vVal2 = a_stVal.pop();
+
+      MUP_ASSERT(a_stOpt.size()>0);
+      MUP_ASSERT(a_stVal.size()>=2);
+
+      // it then else is a ternary operator Pop all three values from the value s
+      // tack and just return the right value
+      token_type vVal1 = a_stVal.pop();
+      token_type vExpr = a_stVal.pop();
+
+      a_stVal.push( (vExpr.GetVal()!=0) ? vVal1 : vVal2);
+
+      token_type opIf = a_stOpt.pop();
+      MUP_ASSERT(opElse.GetCode()==cmELSE);
+      MUP_ASSERT(opIf.GetCode()==cmIF);
+
+      m_vRPN.AddIfElse(cmENDIF);
+    } // while pending if-else-clause found
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Performs the necessary steps to write code for
+             the execution of binary operators into the bytecode.
+  */
+  void ParserBase::ApplyBinOprt(ParserStack<token_type> &a_stOpt,
+                                ParserStack<token_type> &a_stVal) const
+  {
+    // is it a user defined binary operator?
+    if (a_stOpt.top().GetCode()==cmOPRT_BIN)
+    {
+      ApplyFunc(a_stOpt, a_stVal, 2);
+    }
+    else
+    {
+      MUP_ASSERT(a_stVal.size()>=2);
+      token_type valTok1 = a_stVal.pop(),
+                 valTok2 = a_stVal.pop(),
+                 optTok  = a_stOpt.pop(),
+                 resTok;
+
+      if ( valTok1.GetType()!=valTok2.GetType() ||
+          (valTok1.GetType()==tpSTR && valTok2.GetType()==tpSTR) )
+        Error(ecOPRT_TYPE_CONFLICT, m_pTokenReader->GetPos(), optTok.GetAsString());
+
+      if (optTok.GetCode()==cmASSIGN)
+      {
+        if (valTok2.GetCode()!=cmVAR)
+          Error(ecUNEXPECTED_OPERATOR, -1, _T("="));
+
+        m_vRPN.AddAssignOp(valTok2.GetVar());
+      }
+      else
+        m_vRPN.AddOp(optTok.GetCode());
+
+      resTok.SetVal(1);
+      a_stVal.push(resTok);
+    }
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Apply a binary operator.
+      \param a_stOpt The operator stack
+      \param a_stVal The value stack
+  */
+  void ParserBase::ApplyRemainingOprt(ParserStack<token_type> &stOpt,
+                                      ParserStack<token_type> &stVal) const
+  {
+    while (stOpt.size() &&
+           stOpt.top().GetCode() != cmBO &&
+           stOpt.top().GetCode() != cmIF)
+    {
+      token_type tok = stOpt.top();
+      switch (tok.GetCode())
+      {
+      case cmOPRT_INFIX:
+      case cmOPRT_BIN:
+      case cmLE:
+      case cmGE:
+      case cmNEQ:
+      case cmEQ:
+      case cmLT:
+      case cmGT:
+      case cmADD:
+      case cmSUB:
+      case cmMUL:
+      case cmDIV:
+      case cmPOW:
+      case cmLAND:
+      case cmLOR:
+      case cmASSIGN:
+          if (stOpt.top().GetCode()==cmOPRT_INFIX)
+            ApplyFunc(stOpt, stVal, 1);
+          else
+            ApplyBinOprt(stOpt, stVal);
+          break;
+
+      case cmELSE:
+          ApplyIfElse(stOpt, stVal);
+          break;
+
+      default:
+          Error(ecINTERNAL_ERROR);
+      }
+    }
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Parse the command code.
+      \sa ParseString(...)
+
+      Command code contains precalculated stack positions of the values and the
+      associated operators. The Stack is filled beginning from index one the
+      value at index zero is not used at all.
+  */
+  value_type ParserBase::ParseCmdCode() const
+  {
+    return ParseCmdCodeBulk(0, 0);
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Evaluate the RPN.
+      \param nOffset The offset added to variable addresses (for bulk mode)
+      \param nThreadID OpenMP Thread id of the calling thread
+  */
+  value_type ParserBase::ParseCmdCodeBulk(int nOffset, int nThreadID) const
+  {
+    assert(nThreadID<=s_MaxNumOpenMPThreads);
+
+    // Note: The check for nOffset==0 and nThreadID here is not necessary but
+    //       brings a minor performance gain when not in bulk mode.
+    value_type *Stack = ((nOffset==0) && (nThreadID==0)) ? &m_vStackBuffer[0] : &m_vStackBuffer[nThreadID * (m_vStackBuffer.size() / s_MaxNumOpenMPThreads)];
+    value_type buf;
+    int sidx(0);
+    for (const SToken *pTok = m_vRPN.GetBase(); pTok->Cmd!=cmEND ; ++pTok)
+    {
+      switch (pTok->Cmd)
+      {
+      // built in binary operators
+      case  cmLE:   --sidx; Stack[sidx]  = Stack[sidx] <= Stack[sidx+1]; continue;
+      case  cmGE:   --sidx; Stack[sidx]  = Stack[sidx] >= Stack[sidx+1]; continue;
+      case  cmNEQ:  --sidx; Stack[sidx]  = Stack[sidx] != Stack[sidx+1]; continue;
+      case  cmEQ:   --sidx; Stack[sidx]  = Stack[sidx] == Stack[sidx+1]; continue;
+      case  cmLT:   --sidx; Stack[sidx]  = Stack[sidx] < Stack[sidx+1];  continue;
+      case  cmGT:   --sidx; Stack[sidx]  = Stack[sidx] > Stack[sidx+1];  continue;
+      case  cmADD:  --sidx; Stack[sidx] += Stack[1+sidx]; continue;
+      case  cmSUB:  --sidx; Stack[sidx] -= Stack[1+sidx]; continue;
+      case  cmMUL:  --sidx; Stack[sidx] *= Stack[1+sidx]; continue;
+      case  cmDIV:  --sidx;
+
+  #if defined(MUP_MATH_EXCEPTIONS)
+                  if (Stack[1+sidx]==0)
+                    Error(ecDIV_BY_ZERO);
+  #endif
+                  Stack[sidx] /= Stack[1+sidx];
+                  continue;
+
+      case  cmPOW:
+              --sidx; Stack[sidx] = MathImpl<value_type>::Pow(Stack[sidx], Stack[1+sidx]);
+              continue;
+
+      case  cmLAND: --sidx; Stack[sidx]  = Stack[sidx] && Stack[sidx+1]; continue;
+      case  cmLOR:  --sidx; Stack[sidx]  = Stack[sidx] || Stack[sidx+1]; continue;
+
+      case  cmASSIGN:
+          // Bugfix for Bulkmode:
+          // for details see:
+          //    https://groups.google.com/forum/embed/?place=forum/muparser-dev&showsearch=true&showpopout=true&showtabs=false&parenturl=http://muparser.beltoforion.de/mup_forum.html&afterlogin&pli=1#!topic/muparser-dev/szgatgoHTws
+          --sidx; Stack[sidx] = *(pTok->Oprt.ptr + nOffset) = Stack[sidx + 1]; continue;
+          // original code:
+          //--sidx; Stack[sidx] = *pTok->Oprt.ptr = Stack[sidx+1]; continue;
+
+      //case  cmBO:  // unused, listed for compiler optimization purposes
+      //case  cmBC:
+      //      MUP_FAIL(INVALID_CODE_IN_BYTECODE);
+      //      continue;
+
+      case  cmIF:
+            if (Stack[sidx--]==0)
+              pTok += pTok->Oprt.offset;
+            continue;
+
+      case  cmELSE:
+            pTok += pTok->Oprt.offset;
+            continue;
+
+      case  cmENDIF:
+            continue;
+
+      //case  cmARG_SEP:
+      //      MUP_FAIL(INVALID_CODE_IN_BYTECODE);
+      //      continue;
+
+      // value and variable tokens
+      case  cmVAR:    Stack[++sidx] = *(pTok->Val.ptr + nOffset);  continue;
+      case  cmVAL:    Stack[++sidx] =  pTok->Val.data2;  continue;
+
+      case  cmVARPOW2: buf = *(pTok->Val.ptr + nOffset);
+                       Stack[++sidx] = buf*buf;
+                       continue;
+
+      case  cmVARPOW3: buf = *(pTok->Val.ptr + nOffset);
+                       Stack[++sidx] = buf*buf*buf;
+                       continue;
+
+      case  cmVARPOW4: buf = *(pTok->Val.ptr + nOffset);
+                       Stack[++sidx] = buf*buf*buf*buf;
+                       continue;
+
+      case  cmVARMUL:  Stack[++sidx] = *(pTok->Val.ptr + nOffset) * pTok->Val.data + pTok->Val.data2;
+                       continue;
+
+      // Next is treatment of numeric functions
+      case  cmFUNC:
+            {
+              int iArgCount = pTok->Fun.argc;
+
+              // switch according to argument count
+              switch(iArgCount)
+              {
+              case 0: sidx += 1; Stack[sidx] = (*(fun_type0)pTok->Fun.ptr)(); continue;
+              case 1:            Stack[sidx] = (*(fun_type1)pTok->Fun.ptr)(Stack[sidx]);   continue;
+              case 2: sidx -= 1; Stack[sidx] = (*(fun_type2)pTok->Fun.ptr)(Stack[sidx], Stack[sidx+1]); continue;
+              case 3: sidx -= 2; Stack[sidx] = (*(fun_type3)pTok->Fun.ptr)(Stack[sidx], Stack[sidx+1], Stack[sidx+2]); continue;
+              case 4: sidx -= 3; Stack[sidx] = (*(fun_type4)pTok->Fun.ptr)(Stack[sidx], Stack[sidx+1], Stack[sidx+2], Stack[sidx+3]); continue;
+              case 5: sidx -= 4; Stack[sidx] = (*(fun_type5)pTok->Fun.ptr)(Stack[sidx], Stack[sidx+1], Stack[sidx+2], Stack[sidx+3], Stack[sidx+4]); continue;
+              case 6: sidx -= 5; Stack[sidx] = (*(fun_type6)pTok->Fun.ptr)(Stack[sidx], Stack[sidx+1], Stack[sidx+2], Stack[sidx+3], Stack[sidx+4], Stack[sidx+5]); continue;
+              case 7: sidx -= 6; Stack[sidx] = (*(fun_type7)pTok->Fun.ptr)(Stack[sidx], Stack[sidx+1], Stack[sidx+2], Stack[sidx+3], Stack[sidx+4], Stack[sidx+5], Stack[sidx+6]); continue;
+              case 8: sidx -= 7; Stack[sidx] = (*(fun_type8)pTok->Fun.ptr)(Stack[sidx], Stack[sidx+1], Stack[sidx+2], Stack[sidx+3], Stack[sidx+4], Stack[sidx+5], Stack[sidx+6], Stack[sidx+7]); continue;
+              case 9: sidx -= 8; Stack[sidx] = (*(fun_type9)pTok->Fun.ptr)(Stack[sidx], Stack[sidx+1], Stack[sidx+2], Stack[sidx+3], Stack[sidx+4], Stack[sidx+5], Stack[sidx+6], Stack[sidx+7], Stack[sidx+8]); continue;
+              case 10:sidx -= 9; Stack[sidx] = (*(fun_type10)pTok->Fun.ptr)(Stack[sidx], Stack[sidx+1], Stack[sidx+2], Stack[sidx+3], Stack[sidx+4], Stack[sidx+5], Stack[sidx+6], Stack[sidx+7], Stack[sidx+8], Stack[sidx+9]); continue;
+              default:
+                if (iArgCount>0) // function with variable arguments store the number as a negative value
+                  Error(ecINTERNAL_ERROR, 1);
+
+                sidx -= -iArgCount - 1;
+                Stack[sidx] =(*(multfun_type)pTok->Fun.ptr)(&Stack[sidx], -iArgCount);
+                continue;
+              }
+            }
+
+      // Next is treatment of string functions
+      case  cmFUNC_STR:
+            {
+              sidx -= pTok->Fun.argc -1;
+
+              // The index of the string argument in the string table
+              int iIdxStack = pTok->Fun.idx;
+              MUP_ASSERT( iIdxStack>=0 && iIdxStack<(int)m_vStringBuf.size() );
+
+              switch(pTok->Fun.argc)  // switch according to argument count
+              {
+              case 0: Stack[sidx] = (*(strfun_type1)pTok->Fun.ptr)(m_vStringBuf[iIdxStack].c_str()); continue;
+              case 1: Stack[sidx] = (*(strfun_type2)pTok->Fun.ptr)(m_vStringBuf[iIdxStack].c_str(), Stack[sidx]); continue;
+              case 2: Stack[sidx] = (*(strfun_type3)pTok->Fun.ptr)(m_vStringBuf[iIdxStack].c_str(), Stack[sidx], Stack[sidx+1]); continue;
+              }
+
+              continue;
+            }
+
+        case  cmFUNC_BULK:
+              {
+                int iArgCount = pTok->Fun.argc;
+
+                // switch according to argument count
+                switch(iArgCount)
+                {
+                case 0: sidx += 1; Stack[sidx] = (*(bulkfun_type0 )pTok->Fun.ptr)(nOffset, nThreadID); continue;
+                case 1:            Stack[sidx] = (*(bulkfun_type1 )pTok->Fun.ptr)(nOffset, nThreadID, Stack[sidx]); continue;
+                case 2: sidx -= 1; Stack[sidx] = (*(bulkfun_type2 )pTok->Fun.ptr)(nOffset, nThreadID, Stack[sidx], Stack[sidx+1]); continue;
+                case 3: sidx -= 2; Stack[sidx] = (*(bulkfun_type3 )pTok->Fun.ptr)(nOffset, nThreadID, Stack[sidx], Stack[sidx+1], Stack[sidx+2]); continue;
+                case 4: sidx -= 3; Stack[sidx] = (*(bulkfun_type4 )pTok->Fun.ptr)(nOffset, nThreadID, Stack[sidx], Stack[sidx+1], Stack[sidx+2], Stack[sidx+3]); continue;
+                case 5: sidx -= 4; Stack[sidx] = (*(bulkfun_type5 )pTok->Fun.ptr)(nOffset, nThreadID, Stack[sidx], Stack[sidx+1], Stack[sidx+2], Stack[sidx+3], Stack[sidx+4]); continue;
+                case 6: sidx -= 5; Stack[sidx] = (*(bulkfun_type6 )pTok->Fun.ptr)(nOffset, nThreadID, Stack[sidx], Stack[sidx+1], Stack[sidx+2], Stack[sidx+3], Stack[sidx+4], Stack[sidx+5]); continue;
+                case 7: sidx -= 6; Stack[sidx] = (*(bulkfun_type7 )pTok->Fun.ptr)(nOffset, nThreadID, Stack[sidx], Stack[sidx+1], Stack[sidx+2], Stack[sidx+3], Stack[sidx+4], Stack[sidx+5], Stack[sidx+6]); continue;
+                case 8: sidx -= 7; Stack[sidx] = (*(bulkfun_type8 )pTok->Fun.ptr)(nOffset, nThreadID, Stack[sidx], Stack[sidx+1], Stack[sidx+2], Stack[sidx+3], Stack[sidx+4], Stack[sidx+5], Stack[sidx+6], Stack[sidx+7]); continue;
+                case 9: sidx -= 8; Stack[sidx] = (*(bulkfun_type9 )pTok->Fun.ptr)(nOffset, nThreadID, Stack[sidx], Stack[sidx+1], Stack[sidx+2], Stack[sidx+3], Stack[sidx+4], Stack[sidx+5], Stack[sidx+6], Stack[sidx+7], Stack[sidx+8]); continue;
+                case 10:sidx -= 9; Stack[sidx] = (*(bulkfun_type10)pTok->Fun.ptr)(nOffset, nThreadID, Stack[sidx], Stack[sidx+1], Stack[sidx+2], Stack[sidx+3], Stack[sidx+4], Stack[sidx+5], Stack[sidx+6], Stack[sidx+7], Stack[sidx+8], Stack[sidx+9]); continue;
+                default:
+                  Error(ecINTERNAL_ERROR, 2);
+                  continue;
+                }
+              }
+
+        default:
+              Error(ecINTERNAL_ERROR, 3);
+              return 0;
+      } // switch CmdCode
+    } // for all bytecode tokens
+
+    return Stack[m_nFinalResultIdx];
+  }
+
+  //---------------------------------------------------------------------------
+  void ParserBase::CreateRPN() const
+  {
+    if (!m_pTokenReader->GetExpr().length())
+      Error(ecUNEXPECTED_EOF, 0);
+
+    ParserStack<token_type> stOpt, stVal;
+    ParserStack<int> stArgCount;
+    token_type opta, opt;  // for storing operators
+    token_type val, tval;  // for storing value
+
+    ReInit();
+
+    // The outermost counter counts the number of separated items
+    // such as in "a=10,b=20,c=c+a"
+    stArgCount.push(1);
+
+    for(;;)
+    {
+      opt = m_pTokenReader->ReadNextToken();
+
+      switch (opt.GetCode())
+      {
+        //
+        // Next three are different kind of value entries
+        //
+        case cmSTRING:
+                opt.SetIdx((int)m_vStringBuf.size());      // Assign buffer index to token
+                stVal.push(opt);
+		            m_vStringBuf.push_back(opt.GetAsString()); // Store string in internal buffer
+                break;
+
+        case cmVAR:
+                stVal.push(opt);
+                m_vRPN.AddVar( static_cast<value_type*>(opt.GetVar()) );
+                break;
+
+        case cmVAL:
+		        stVal.push(opt);
+                m_vRPN.AddVal( opt.GetVal() );
+                break;
+
+        case cmELSE:
+                m_nIfElseCounter--;
+                if (m_nIfElseCounter<0)
+                  Error(ecMISPLACED_COLON, m_pTokenReader->GetPos());
+
+                ApplyRemainingOprt(stOpt, stVal);
+                m_vRPN.AddIfElse(cmELSE);
+                stOpt.push(opt);
+                break;
+
+
+        case cmARG_SEP:
+                if (stArgCount.empty())
+                  Error(ecUNEXPECTED_ARG_SEP, m_pTokenReader->GetPos());
+
+                ++stArgCount.top();
+                // fallthrough intentional (no break!)
+
+        case cmEND:
+                ApplyRemainingOprt(stOpt, stVal);
+                break;
+
+       case cmBC:
+                {
+                  // The argument count for parameterless functions is zero
+                  // by default an opening bracket sets parameter count to 1
+                  // in preparation of arguments to come. If the last token
+                  // was an opening bracket we know better...
+                  if (opta.GetCode()==cmBO)
+                    --stArgCount.top();
+
+                  ApplyRemainingOprt(stOpt, stVal);
+
+                  // Check if the bracket content has been evaluated completely
+                  if (stOpt.size() && stOpt.top().GetCode()==cmBO)
+                  {
+                    // if opt is ")" and opta is "(" the bracket has been evaluated, now its time to check
+                    // if there is either a function or a sign pending
+                    // neither the opening nor the closing bracket will be pushed back to
+                    // the operator stack
+                    // Check if a function is standing in front of the opening bracket,
+                    // if yes evaluate it afterwards check for infix operators
+                    assert(stArgCount.size());
+                    int iArgCount = stArgCount.pop();
+
+                    stOpt.pop(); // Take opening bracket from stack
+
+                    if (iArgCount>1 && ( stOpt.size()==0 ||
+                                        (stOpt.top().GetCode()!=cmFUNC &&
+                                         stOpt.top().GetCode()!=cmFUNC_BULK &&
+                                         stOpt.top().GetCode()!=cmFUNC_STR) ) )
+                      Error(ecUNEXPECTED_ARG, m_pTokenReader->GetPos());
+
+                    // The opening bracket was popped from the stack now check if there
+                    // was a function before this bracket
+                    if (stOpt.size() &&
+                        stOpt.top().GetCode()!=cmOPRT_INFIX &&
+                        stOpt.top().GetCode()!=cmOPRT_BIN &&
+                        stOpt.top().GetFuncAddr()!=0)
+                    {
+                      ApplyFunc(stOpt, stVal, iArgCount);
+                    }
+                  }
+                } // if bracket content is evaluated
+                break;
+
+        //
+        // Next are the binary operator entries
+        //
+        //case cmAND:   // built in binary operators
+        //case cmOR:
+        //case cmXOR:
+        case cmIF:
+                m_nIfElseCounter++;
+                // fallthrough intentional (no break!)
+
+        case cmLAND:
+        case cmLOR:
+        case cmLT:
+        case cmGT:
+        case cmLE:
+        case cmGE:
+        case cmNEQ:
+        case cmEQ:
+        case cmADD:
+        case cmSUB:
+        case cmMUL:
+        case cmDIV:
+        case cmPOW:
+        case cmASSIGN:
+        case cmOPRT_BIN:
+
+                // A binary operator (user defined or built in) has been found.
+                while ( stOpt.size() &&
+                        stOpt.top().GetCode() != cmBO &&
+                        stOpt.top().GetCode() != cmELSE &&
+                        stOpt.top().GetCode() != cmIF)
+                {
+                  int nPrec1 = GetOprtPrecedence(stOpt.top()),
+                      nPrec2 = GetOprtPrecedence(opt);
+
+                  if (stOpt.top().GetCode()==opt.GetCode())
+                  {
+
+                    // Deal with operator associativity
+                    EOprtAssociativity eOprtAsct = GetOprtAssociativity(opt);
+                    if ( (eOprtAsct==oaRIGHT && (nPrec1 <= nPrec2)) ||
+                         (eOprtAsct==oaLEFT  && (nPrec1 <  nPrec2)) )
+                    {
+                      break;
+                    }
+                  }
+                  else if (nPrec1 < nPrec2)
+                  {
+                    // In case the operators are not equal the precedence decides alone...
+                    break;
+                  }
+
+                  if (stOpt.top().GetCode()==cmOPRT_INFIX)
+                    ApplyFunc(stOpt, stVal, 1);
+                  else
+                    ApplyBinOprt(stOpt, stVal);
+                } // while ( ... )
+
+                if (opt.GetCode()==cmIF)
+                  m_vRPN.AddIfElse(opt.GetCode());
+
+    			      // The operator can't be evaluated right now, push back to the operator stack
+                stOpt.push(opt);
+                break;
+
+        //
+        // Last section contains functions and operators implicitly mapped to functions
+        //
+        case cmBO:
+                stArgCount.push(1);
+                stOpt.push(opt);
+                break;
+
+        case cmOPRT_INFIX:
+        case cmFUNC:
+        case cmFUNC_BULK:
+        case cmFUNC_STR:
+                stOpt.push(opt);
+                break;
+
+        case cmOPRT_POSTFIX:
+                stOpt.push(opt);
+                ApplyFunc(stOpt, stVal, 1);  // this is the postfix operator
+                break;
+
+        default:  Error(ecINTERNAL_ERROR, 3);
+      } // end of switch operator-token
+
+      opta = opt;
+
+      if ( opt.GetCode() == cmEND )
+      {
+        m_vRPN.Finalize();
+        break;
+      }
+
+      if (ParserBase::g_DbgDumpStack)
+      {
+        StackDump(stVal, stOpt);
+        m_vRPN.AsciiDump();
+      }
+    } // while (true)
+
+    if (ParserBase::g_DbgDumpCmdCode)
+      m_vRPN.AsciiDump();
+
+    if (m_nIfElseCounter>0)
+      Error(ecMISSING_ELSE_CLAUSE);
+
+    // get the last value (= final result) from the stack
+    MUP_ASSERT(stArgCount.size()==1);
+    m_nFinalResultIdx = stArgCount.top();
+    if (m_nFinalResultIdx==0)
+      Error(ecINTERNAL_ERROR, 9);
+
+    if (stVal.size()==0)
+      Error(ecEMPTY_EXPRESSION);
+
+    if (stVal.top().GetType()!=tpDBL)
+      Error(ecSTR_RESULT);
+
+    m_vStackBuffer.resize(m_vRPN.GetMaxStackSize() * s_MaxNumOpenMPThreads);
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief One of the two main parse functions.
+      \sa ParseCmdCode(...)
+
+    Parse expression from input string. Perform syntax checking and create
+    bytecode. After parsing the string and creating the bytecode the function
+    pointer #m_pParseFormula will be changed to the second parse routine the
+    uses bytecode instead of string parsing.
+  */
+  value_type ParserBase::ParseString() const
+  {
+    try
+    {
+      CreateRPN();
+      m_pParseFormula = &ParserBase::ParseCmdCode;
+      return (this->*m_pParseFormula)();
+    }
+    catch(ParserError &exc)
+    {
+      exc.SetFormula(m_pTokenReader->GetExpr());
+      throw;
+    }
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Create an error containing the parse error position.
+
+    This function will create an Parser Exception object containing the error text and
+    its position.
+
+    \param a_iErrc [in] The error code of type #EErrorCodes.
+    \param a_iPos [in] The position where the error was detected.
+    \param a_strTok [in] The token string representation associated with the error.
+    \throw ParserException always throws thats the only purpose of this function.
+  */
+  void  ParserBase::Error(EErrorCodes a_iErrc, int a_iPos, const string_type &a_sTok) const
+  {
+    throw exception_type(a_iErrc, a_sTok, m_pTokenReader->GetExpr(), a_iPos);
+  }
+
+  //------------------------------------------------------------------------------
+  /** \brief Clear all user defined variables.
+      \throw nothrow
+
+      Resets the parser to string parsing mode by calling #ReInit.
+  */
+  void ParserBase::ClearVar()
+  {
+    m_VarDef.clear();
+    ReInit();
+  }
+
+  //------------------------------------------------------------------------------
+  /** \brief Remove a variable from internal storage.
+      \throw nothrow
+
+      Removes a variable if it exists. If the Variable does not exist nothing will be done.
+  */
+  void ParserBase::RemoveVar(const string_type &a_strVarName)
+  {
+    varmap_type::iterator item = m_VarDef.find(a_strVarName);
+    if (item!=m_VarDef.end())
+    {
+      m_VarDef.erase(item);
+      ReInit();
+    }
+  }
+
+  //------------------------------------------------------------------------------
+  /** \brief Clear all functions.
+      \post Resets the parser to string parsing mode.
+      \throw nothrow
+  */
+  void ParserBase::ClearFun()
+  {
+    m_FunDef.clear();
+    ReInit();
+  }
+
+  //------------------------------------------------------------------------------
+  /** \brief Clear all user defined constants.
+
+      Both numeric and string constants will be removed from the internal storage.
+      \post Resets the parser to string parsing mode.
+      \throw nothrow
+  */
+  void ParserBase::ClearConst()
+  {
+    m_ConstDef.clear();
+    m_StrVarDef.clear();
+    ReInit();
+  }
+
+  //------------------------------------------------------------------------------
+  /** \brief Clear all user defined postfix operators.
+      \post Resets the parser to string parsing mode.
+      \throw nothrow
+  */
+  void ParserBase::ClearPostfixOprt()
+  {
+    m_PostOprtDef.clear();
+    ReInit();
+  }
+
+  //------------------------------------------------------------------------------
+  /** \brief Clear all user defined binary operators.
+      \post Resets the parser to string parsing mode.
+      \throw nothrow
+  */
+  void ParserBase::ClearOprt()
+  {
+    m_OprtDef.clear();
+    ReInit();
+  }
+
+  //------------------------------------------------------------------------------
+  /** \brief Clear the user defined Prefix operators.
+      \post Resets the parser to string parser mode.
+      \throw nothrow
+  */
+  void ParserBase::ClearInfixOprt()
+  {
+    m_InfixOprtDef.clear();
+    ReInit();
+  }
+
+  //------------------------------------------------------------------------------
+  /** \brief Enable or disable the formula optimization feature.
+      \post Resets the parser to string parser mode.
+      \throw nothrow
+  */
+  void ParserBase::EnableOptimizer(bool a_bIsOn)
+  {
+    m_vRPN.EnableOptimizer(a_bIsOn);
+    ReInit();
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Enable the dumping of bytecode and stack content on the console.
+      \param bDumpCmd Flag to enable dumping of the current bytecode to the console.
+      \param bDumpStack Flag to enable dumping of the stack content is written to the console.
+
+     This function is for debug purposes only!
+  */
+  void ParserBase::EnableDebugDump(bool bDumpCmd, bool bDumpStack)
+  {
+    ParserBase::g_DbgDumpCmdCode = bDumpCmd;
+    ParserBase::g_DbgDumpStack   = bDumpStack;
+  }
+
+  //------------------------------------------------------------------------------
+  /** \brief Enable or disable the built in binary operators.
+      \throw nothrow
+      \sa m_bBuiltInOp, ReInit()
+
+    If you disable the built in binary operators there will be no binary operators
+    defined. Thus you must add them manually one by one. It is not possible to
+    disable built in operators selectively. This function will Reinitialize the
+    parser by calling ReInit().
+  */
+  void ParserBase::EnableBuiltInOprt(bool a_bIsOn)
+  {
+    m_bBuiltInOp = a_bIsOn;
+    ReInit();
+  }
+
+  //------------------------------------------------------------------------------
+  /** \brief Query status of built in variables.
+      \return #m_bBuiltInOp; true if built in operators are enabled.
+      \throw nothrow
+  */
+  bool ParserBase::HasBuiltInOprt() const
+  {
+    return m_bBuiltInOp;
+  }
+
+  //------------------------------------------------------------------------------
+  /** \brief Get the argument separator character.
+  */
+  char_type ParserBase::GetArgSep() const
+  {
+    return m_pTokenReader->GetArgSep();
+  }
+
+  //------------------------------------------------------------------------------
+  /** \brief Set argument separator.
+      \param cArgSep the argument separator character.
+  */
+  void ParserBase::SetArgSep(char_type cArgSep)
+  {
+    m_pTokenReader->SetArgSep(cArgSep);
+  }
+
+  //------------------------------------------------------------------------------
+  /** \brief Dump stack content.
+
+      This function is used for debugging only.
+  */
+  void ParserBase::StackDump(const ParserStack<token_type> &a_stVal,
+                             const ParserStack<token_type> &a_stOprt) const
+  {
+    ParserStack<token_type> stOprt(a_stOprt),
+                            stVal(a_stVal);
+
+    mu::console() << _T("\nValue stack:\n");
+    while ( !stVal.empty() )
+    {
+      token_type val = stVal.pop();
+      if (val.GetType()==tpSTR)
+        mu::console() << _T(" \"") << val.GetAsString() << _T("\" ");
+      else
+        mu::console() << _T(" ") << val.GetVal() << _T(" ");
+    }
+    mu::console() << "\nOperator stack:\n";
+
+    while ( !stOprt.empty() )
+    {
+      if (stOprt.top().GetCode()<=cmASSIGN)
+      {
+        mu::console() << _T("OPRT_INTRNL \"")
+                      << ParserBase::c_DefaultOprt[stOprt.top().GetCode()]
+                      << _T("\" \n");
+      }
+      else
+      {
+        switch(stOprt.top().GetCode())
+        {
+        case cmVAR:   mu::console() << _T("VAR\n");  break;
+        case cmVAL:   mu::console() << _T("VAL\n");  break;
+        case cmFUNC:  mu::console() << _T("FUNC \"")
+                                    << stOprt.top().GetAsString()
+                                    << _T("\"\n");   break;
+        case cmFUNC_BULK:  mu::console() << _T("FUNC_BULK \"")
+                                         << stOprt.top().GetAsString()
+                                         << _T("\"\n");   break;
+        case cmOPRT_INFIX: mu::console() << _T("OPRT_INFIX \"")
+                                         << stOprt.top().GetAsString()
+                                         << _T("\"\n");      break;
+        case cmOPRT_BIN:   mu::console() << _T("OPRT_BIN \"")
+                                         << stOprt.top().GetAsString()
+                                         << _T("\"\n");           break;
+        case cmFUNC_STR: mu::console() << _T("FUNC_STR\n");       break;
+        case cmEND:      mu::console() << _T("END\n");            break;
+        case cmUNKNOWN:  mu::console() << _T("UNKNOWN\n");        break;
+        case cmBO:       mu::console() << _T("BRACKET \"(\"\n");  break;
+        case cmBC:       mu::console() << _T("BRACKET \")\"\n");  break;
+        case cmIF:       mu::console() << _T("IF\n");  break;
+        case cmELSE:     mu::console() << _T("ELSE\n");  break;
+        case cmENDIF:    mu::console() << _T("ENDIF\n");  break;
+        default:         mu::console() << stOprt.top().GetCode() << _T(" ");  break;
+        }
+      }
+      stOprt.pop();
+    }
+
+    mu::console() << dec << endl;
+  }
+
+  //------------------------------------------------------------------------------
+  /** \brief Evaluate an expression containing comma separated subexpressions
+      \param [out] nStackSize The total number of results available
+      \return Pointer to the array containing all expression results
+
+      This member function can be used to retrieve all results of an expression
+      made up of multiple comma separated subexpressions (i.e. "x+y,sin(x),cos(y)")
+  */
+  value_type* ParserBase::Eval(int &nStackSize) const
+  {
+    (this->*m_pParseFormula)();
+    nStackSize = m_nFinalResultIdx;
+
+    // (for historic reasons the stack starts at position 1)
+    return &m_vStackBuffer[1];
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Return the number of results on the calculation stack.
+
+    If the expression contains comma separated subexpressions (i.e. "sin(y), x+y").
+    There may be more than one return value. This function returns the number of
+    available results.
+  */
+  int ParserBase::GetNumResults() const
+  {
+    return m_nFinalResultIdx;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Calculate the result.
+
+    A note on const correctness:
+    I consider it important that Calc is a const function.
+    Due to caching operations Calc changes only the state of internal variables with one exception
+    m_UsedVar this is reset during string parsing and accessible from the outside. Instead of making
+    Calc non const GetUsedVar is non const because it explicitly calls Eval() forcing this update.
+
+    \pre A formula must be set.
+    \pre Variables must have been set (if needed)
+
+    \sa #m_pParseFormula
+    \return The evaluation result
+    \throw ParseException if no Formula is set or in case of any other error related to the formula.
+  */
+  value_type ParserBase::Eval() const
+  {
+    return (this->*m_pParseFormula)();
+  }
+
+  //---------------------------------------------------------------------------
+  void ParserBase::Eval(value_type *results, int nBulkSize)
+  {
+/* <ibg 2014-09-24/> Commented because it is making a unit test impossible
+
+    // Parallelization does not make sense for fewer than 10000 computations
+    // due to thread creation overhead. If the bulk size is below 2000
+    // computation is refused.
+    if (nBulkSize<2000)
+    {
+      throw ParserError(ecUNREASONABLE_NUMBER_OF_COMPUTATIONS);
+    }
+*/
+    CreateRPN();
+
+    int i = 0;
+
+#ifdef MUP_USE_OPENMP
+//#define DEBUG_OMP_STUFF
+    #ifdef DEBUG_OMP_STUFF
+    int *pThread = new int[nBulkSize];
+    int *pIdx = new int[nBulkSize];
+    #endif
+
+    int nMaxThreads = std::min(omp_get_max_threads(), s_MaxNumOpenMPThreads);
+	int nThreadID = 0, ct = 0;
+    omp_set_num_threads(nMaxThreads);
+
+    #pragma omp parallel for schedule(static, nBulkSize/nMaxThreads) private(nThreadID)
+    for (i=0; i<nBulkSize; ++i)
+    {
+      nThreadID = omp_get_thread_num();
+      results[i] = ParseCmdCodeBulk(i, nThreadID);
+
+      #ifdef DEBUG_OMP_STUFF
+      #pragma omp critical
+      {
+        pThread[ct] = nThreadID;
+        pIdx[ct] = i;
+        ct++;
+      }
+      #endif
+    }
+
+#ifdef DEBUG_OMP_STUFF
+    FILE *pFile = fopen("bulk_dbg.txt", "w");
+    for (i=0; i<nBulkSize; ++i)
+    {
+      fprintf(pFile, "idx: %d  thread: %d \n", pIdx[i], pThread[i]);
+    }
+
+    delete [] pIdx;
+    delete [] pThread;
+
+    fclose(pFile);
+#endif
+
+#else
+    for (i=0; i<nBulkSize; ++i)
+    {
+      results[i] = ParseCmdCodeBulk(i, 0);
+    }
+#endif
+
+  }
+} // namespace mu
diff --git a/geometry/qmuparser/muParserBase.h b/geometry/qmuparser/muParserBase.h
old mode 100755
new mode 100644
index beb15bb..004fe20
--- a/geometry/qmuparser/muParserBase.h
+++ b/geometry/qmuparser/muParserBase.h
@@ -1,317 +1,317 @@
-/*
-                 __________                                      
-    _____   __ __\______   \_____  _______  ______  ____ _______ 
-   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
-  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
-  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|   
-        \/                       \/            \/      \/        
-  Copyright (C) 2013 Ingo Berg
-
-  Permission is hereby granted, free of charge, to any person obtaining a copy of this 
-  software and associated documentation files (the "Software"), to deal in the Software
-  without restriction, including without limitation the rights to use, copy, modify, 
-  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 
-  permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-  The above copyright notice and this permission notice shall be included in all copies or 
-  substantial portions of the Software.
-
-  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
-  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
-  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
-  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
-  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
-*/
-#ifndef MU_PARSER_BASE_H
-#define MU_PARSER_BASE_H
-
-//--- Standard includes ------------------------------------------------------------------------
-#include <cmath>
-#include <string>
-#include <iostream>
-#include <map>
-#include <memory>
-#include <locale>
-#include <limits.h>
-
-//--- Parser includes --------------------------------------------------------------------------
-#include "muParserDef.h"
-#include "muParserStack.h"
-#include "muParserTokenReader.h"
-#include "muParserBytecode.h"
-#include "muParserError.h"
-
-
-namespace mu
-{
-/** \file
-    \brief This file contains the class definition of the muparser engine.
-*/
-
-//--------------------------------------------------------------------------------------------------
-/** \brief Mathematical expressions parser (base parser engine).
-    \author (C) 2013 Ingo Berg
-
-  This is the implementation of a bytecode based mathematical expressions parser. 
-  The formula will be parsed from string and converted into a bytecode. 
-  Future calculations will be done with the bytecode instead the formula string
-  resulting in a significant performance increase. 
-  Complementary to a set of internally implemented functions the parser is able to handle 
-  user defined functions and variables. 
-*/
-class ParserBase 
-{
-friend class ParserTokenReader;
-
-private:
-
-    /** \brief Typedef for the parse functions. 
-    
-      The parse function do the actual work. The parser exchanges
-      the function pointer to the parser function depending on 
-      which state it is in. (i.e. bytecode parser vs. string parser)
-    */
-    typedef value_type (ParserBase::*ParseFunction)() const;  
-
-    /** \brief Type used for storing an array of values. */
-    typedef std::vector<value_type> valbuf_type;
-
-    /** \brief Type for a vector of strings. */
-    typedef std::vector<string_type> stringbuf_type;
-
-    /** \brief Typedef for the token reader. */
-    typedef ParserTokenReader token_reader_type;
-    
-    /** \brief Type used for parser tokens. */
-    typedef ParserToken<value_type, string_type> token_type;
-
-    /** \brief Maximum number of threads spawned by OpenMP when using the bulk mode. */
-    static const int s_MaxNumOpenMPThreads = 16;
-
- public:
-
-    /** \brief Type of the error class. 
-    
-      Included for backwards compatibility.
-    */
-    typedef ParserError exception_type;
-
-    static void EnableDebugDump(bool bDumpCmd, bool bDumpStack);
-
-    ParserBase(); 
-    ParserBase(const ParserBase &a_Parser);
-    ParserBase& operator=(const ParserBase &a_Parser);
-
-    virtual ~ParserBase();
-    
-	  value_type  Eval() const;
-    value_type* Eval(int &nStackSize) const;
-    void Eval(value_type *results, int nBulkSize);
-
-    int GetNumResults() const;
-
-    void SetExpr(const string_type &a_sExpr);
-    void SetVarFactory(facfun_type a_pFactory, void *pUserData = NULL);
-
-    void SetDecSep(char_type cDecSep);
-    void SetThousandsSep(char_type cThousandsSep = 0);
-    void ResetLocale();
-
-    void EnableOptimizer(bool a_bIsOn=true);
-    void EnableBuiltInOprt(bool a_bIsOn=true);
-
-    bool HasBuiltInOprt() const;
-    void AddValIdent(identfun_type a_pCallback);
-
-    /** \fn void mu::ParserBase::DefineFun(const string_type &a_strName, fun_type0 a_pFun, bool a_bAllowOpt = true) 
-        \brief Define a parser function without arguments.
-        \param a_strName Name of the function
-        \param a_pFun Pointer to the callback function
-        \param a_bAllowOpt A flag indicating this function may be optimized
-    */
-    template<typename T>
-    void DefineFun(const string_type &a_strName, T a_pFun, bool a_bAllowOpt = true)
-    {
-      AddCallback( a_strName, ParserCallback(a_pFun, a_bAllowOpt), m_FunDef, ValidNameChars() );
-    }
-
-    void DefineOprt(const string_type &a_strName, 
-                    fun_type2 a_pFun, 
-                    unsigned a_iPri=0, 
-                    EOprtAssociativity a_eAssociativity = oaLEFT,
-                    bool a_bAllowOpt = false);
-    void DefineConst(const string_type &a_sName, value_type a_fVal);
-    void DefineStrConst(const string_type &a_sName, const string_type &a_strVal);
-    void DefineVar(const string_type &a_sName, value_type *a_fVar);
-    void DefinePostfixOprt(const string_type &a_strFun, fun_type1 a_pOprt, bool a_bAllowOpt=true);
-    void DefineInfixOprt(const string_type &a_strName, fun_type1 a_pOprt, int a_iPrec=prINFIX, bool a_bAllowOpt=true);
-
-    // Clear user defined variables, constants or functions
-    void ClearVar();
-    void ClearFun();
-    void ClearConst();
-    void ClearInfixOprt();
-    void ClearPostfixOprt();
-    void ClearOprt();
-    
-    void RemoveVar(const string_type &a_strVarName);
-    const varmap_type& GetUsedVar() const;
-    const varmap_type& GetVar() const;
-    const valmap_type& GetConst() const;
-    const string_type& GetExpr() const;
-    const funmap_type& GetFunDef() const;
-    string_type GetVersion(EParserVersionInfo eInfo = pviFULL) const;
-
-    const char_type ** GetOprtDef() const;
-    void DefineNameChars(const char_type *a_szCharset);
-    void DefineOprtChars(const char_type *a_szCharset);
-    void DefineInfixOprtChars(const char_type *a_szCharset);
-
-    const char_type* ValidNameChars() const;
-    const char_type* ValidOprtChars() const;
-    const char_type* ValidInfixOprtChars() const;
-
-    void SetArgSep(char_type cArgSep);
-    char_type GetArgSep() const;
-    
-    void  Error(EErrorCodes a_iErrc, 
-                int a_iPos = (int)mu::string_type::npos, 
-                const string_type &a_strTok = string_type() ) const;
-
- protected:
-	  
-    void Init();
-
-    virtual void InitCharSets() = 0;
-    virtual void InitFun() = 0;
-    virtual void InitConst() = 0;
-    virtual void InitOprt() = 0; 
-
-    virtual void OnDetectVar(string_type *pExpr, int &nStart, int &nEnd);
-
-    static const char_type *c_DefaultOprt[]; 
-    static std::locale s_locale;  ///< The locale used by the parser
-    static bool g_DbgDumpCmdCode;
-    static bool g_DbgDumpStack;
-
-    /** \brief A facet class used to change decimal and thousands separator. */
-    template<class TChar>
-    class change_dec_sep : public std::numpunct<TChar>
-    {
-    public:
-      
-      explicit change_dec_sep(char_type cDecSep, char_type cThousandsSep = 0, int nGroup = 3)
-        :std::numpunct<TChar>()
-        ,m_nGroup(nGroup)
-        ,m_cDecPoint(cDecSep)
-        ,m_cThousandsSep(cThousandsSep)
-      {}
-      
-    protected:
-      
-      virtual char_type do_decimal_point() const
-      {
-        return m_cDecPoint;
-      }
-
-      virtual char_type do_thousands_sep() const
-      {
-        return m_cThousandsSep;
-      }
-
-      virtual std::string do_grouping() const 
-      { 
-		// fix for issue 4: https://code.google.com/p/muparser/issues/detail?id=4
-		// courtesy of Jens Bartsch
-		// original code:
-		//        return std::string(1, (char)m_nGroup); 
-		// new code:
-		return std::string(1, (char)(m_cThousandsSep > 0 ? m_nGroup : CHAR_MAX));
-      }
-
-    private:
-
-      int m_nGroup;
-      char_type m_cDecPoint;  
-      char_type m_cThousandsSep;
-    };
-
- private:
-
-    void Assign(const ParserBase &a_Parser);
-    void InitTokenReader();
-    void ReInit() const;
-
-    void AddCallback( const string_type &a_strName, 
-                      const ParserCallback &a_Callback, 
-                      funmap_type &a_Storage,
-                      const char_type *a_szCharSet );
-
-    void ApplyRemainingOprt(ParserStack<token_type> &a_stOpt,
-                                ParserStack<token_type> &a_stVal) const;
-    void ApplyBinOprt(ParserStack<token_type> &a_stOpt,
-                      ParserStack<token_type> &a_stVal) const;
-
-    void ApplyIfElse(ParserStack<token_type> &a_stOpt,
-                     ParserStack<token_type> &a_stVal) const;
-
-    void ApplyFunc(ParserStack<token_type> &a_stOpt,
-                   ParserStack<token_type> &a_stVal, 
-                   int iArgCount) const; 
-
-    token_type ApplyStrFunc(const token_type &a_FunTok,
-                            const std::vector<token_type> &a_vArg) const;
-
-    int GetOprtPrecedence(const token_type &a_Tok) const;
-    EOprtAssociativity GetOprtAssociativity(const token_type &a_Tok) const;
-
-    void CreateRPN() const;
-
-    value_type ParseString() const; 
-    value_type ParseCmdCode() const;
-    value_type ParseCmdCodeBulk(int nOffset, int nThreadID) const;
-
-    void  CheckName(const string_type &a_strName, const string_type &a_CharSet) const;
-    void  CheckOprt(const string_type &a_sName,
-                    const ParserCallback &a_Callback,
-                    const string_type &a_szCharSet) const;
-
-    void StackDump(const ParserStack<token_type > &a_stVal, 
-                   const ParserStack<token_type > &a_stOprt) const;
-
-    /** \brief Pointer to the parser function. 
-    
-      Eval() calls the function whose address is stored there.
-    */
-    mutable ParseFunction  m_pParseFormula;
-    mutable ParserByteCode m_vRPN;        ///< The Bytecode class.
-    mutable stringbuf_type  m_vStringBuf; ///< String buffer, used for storing string function arguments
-    stringbuf_type  m_vStringVarBuf;
-
-    std::auto_ptr<token_reader_type> m_pTokenReader; ///< Managed pointer to the token reader object.
-
-    funmap_type  m_FunDef;         ///< Map of function names and pointers.
-    funmap_type  m_PostOprtDef;    ///< Postfix operator callbacks
-    funmap_type  m_InfixOprtDef;   ///< unary infix operator.
-    funmap_type  m_OprtDef;        ///< Binary operator callbacks
-    valmap_type  m_ConstDef;       ///< user constants.
-    strmap_type  m_StrVarDef;      ///< user defined string constants
-    varmap_type  m_VarDef;         ///< user defind variables.
-
-    bool m_bBuiltInOp;             ///< Flag that can be used for switching built in operators on and off
-
-    string_type m_sNameChars;      ///< Charset for names
-    string_type m_sOprtChars;      ///< Charset for postfix/ binary operator tokens
-    string_type m_sInfixOprtChars; ///< Charset for infix operator tokens
-    
-    mutable int m_nIfElseCounter;  ///< Internal counter for keeping track of nested if-then-else clauses
-
-    // items merely used for caching state information
-    mutable valbuf_type m_vStackBuffer; ///< This is merely a buffer used for the stack in the cmd parsing routine
-    mutable int m_nFinalResultIdx;
-};
-
-} // namespace mu
-
-#endif
-
+/*
+                 __________
+    _____   __ __\______   \_____  _______  ______  ____ _______
+   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
+  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
+  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|
+        \/                       \/            \/      \/
+  Copyright (C) 2013 Ingo Berg
+
+  Permission is hereby granted, free of charge, to any person obtaining a copy of this
+  software and associated documentation files (the "Software"), to deal in the Software
+  without restriction, including without limitation the rights to use, copy, modify,
+  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
+  permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included in all copies or
+  substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
+  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#ifndef MU_PARSER_BASE_H
+#define MU_PARSER_BASE_H
+
+//--- Standard includes ------------------------------------------------------------------------
+#include <cmath>
+#include <string>
+#include <iostream>
+#include <map>
+#include <memory>
+#include <locale>
+#include <limits.h>
+
+//--- Parser includes --------------------------------------------------------------------------
+#include "muParserDef.h"
+#include "muParserStack.h"
+#include "muParserTokenReader.h"
+#include "muParserBytecode.h"
+#include "muParserError.h"
+
+
+namespace mu
+{
+/** \file
+    \brief This file contains the class definition of the muparser engine.
+*/
+
+//--------------------------------------------------------------------------------------------------
+/** \brief Mathematical expressions parser (base parser engine).
+    \author (C) 2013 Ingo Berg
+
+  This is the implementation of a bytecode based mathematical expressions parser.
+  The formula will be parsed from string and converted into a bytecode.
+  Future calculations will be done with the bytecode instead the formula string
+  resulting in a significant performance increase.
+  Complementary to a set of internally implemented functions the parser is able to handle
+  user defined functions and variables.
+*/
+class ParserBase
+{
+friend class ParserTokenReader;
+
+private:
+
+    /** \brief Typedef for the parse functions.
+
+      The parse function do the actual work. The parser exchanges
+      the function pointer to the parser function depending on
+      which state it is in. (i.e. bytecode parser vs. string parser)
+    */
+    typedef value_type (ParserBase::*ParseFunction)() const;
+
+    /** \brief Type used for storing an array of values. */
+    typedef std::vector<value_type> valbuf_type;
+
+    /** \brief Type for a vector of strings. */
+    typedef std::vector<string_type> stringbuf_type;
+
+    /** \brief Typedef for the token reader. */
+    typedef ParserTokenReader token_reader_type;
+
+    /** \brief Type used for parser tokens. */
+    typedef ParserToken<value_type, string_type> token_type;
+
+    /** \brief Maximum number of threads spawned by OpenMP when using the bulk mode. */
+    static const int s_MaxNumOpenMPThreads = 16;
+
+ public:
+
+    /** \brief Type of the error class.
+
+      Included for backwards compatibility.
+    */
+    typedef ParserError exception_type;
+
+    static void EnableDebugDump(bool bDumpCmd, bool bDumpStack);
+
+    ParserBase();
+    ParserBase(const ParserBase &a_Parser);
+    ParserBase& operator=(const ParserBase &a_Parser);
+
+    virtual ~ParserBase();
+
+	  value_type  Eval() const;
+    value_type* Eval(int &nStackSize) const;
+    void Eval(value_type *results, int nBulkSize);
+
+    int GetNumResults() const;
+
+    void SetExpr(const string_type &a_sExpr);
+    void SetVarFactory(facfun_type a_pFactory, void *pUserData = NULL);
+
+    void SetDecSep(char_type cDecSep);
+    void SetThousandsSep(char_type cThousandsSep = 0);
+    void ResetLocale();
+
+    void EnableOptimizer(bool a_bIsOn=true);
+    void EnableBuiltInOprt(bool a_bIsOn=true);
+
+    bool HasBuiltInOprt() const;
+    void AddValIdent(identfun_type a_pCallback);
+
+    /** \fn void mu::ParserBase::DefineFun(const string_type &a_strName, fun_type0 a_pFun, bool a_bAllowOpt = true)
+        \brief Define a parser function without arguments.
+        \param a_strName Name of the function
+        \param a_pFun Pointer to the callback function
+        \param a_bAllowOpt A flag indicating this function may be optimized
+    */
+    template<typename T>
+    void DefineFun(const string_type &a_strName, T a_pFun, bool a_bAllowOpt = true)
+    {
+      AddCallback( a_strName, ParserCallback(a_pFun, a_bAllowOpt), m_FunDef, ValidNameChars() );
+    }
+
+    void DefineOprt(const string_type &a_strName,
+                    fun_type2 a_pFun,
+                    unsigned a_iPri=0,
+                    EOprtAssociativity a_eAssociativity = oaLEFT,
+                    bool a_bAllowOpt = false);
+    void DefineConst(const string_type &a_sName, value_type a_fVal);
+    void DefineStrConst(const string_type &a_sName, const string_type &a_strVal);
+    void DefineVar(const string_type &a_sName, value_type *a_fVar);
+    void DefinePostfixOprt(const string_type &a_strFun, fun_type1 a_pOprt, bool a_bAllowOpt=true);
+    void DefineInfixOprt(const string_type &a_strName, fun_type1 a_pOprt, int a_iPrec=prINFIX, bool a_bAllowOpt=true);
+
+    // Clear user defined variables, constants or functions
+    void ClearVar();
+    void ClearFun();
+    void ClearConst();
+    void ClearInfixOprt();
+    void ClearPostfixOprt();
+    void ClearOprt();
+
+    void RemoveVar(const string_type &a_strVarName);
+    const varmap_type& GetUsedVar() const;
+    const varmap_type& GetVar() const;
+    const valmap_type& GetConst() const;
+    const string_type& GetExpr() const;
+    const funmap_type& GetFunDef() const;
+    string_type GetVersion(EParserVersionInfo eInfo = pviFULL) const;
+
+    const char_type ** GetOprtDef() const;
+    void DefineNameChars(const char_type *a_szCharset);
+    void DefineOprtChars(const char_type *a_szCharset);
+    void DefineInfixOprtChars(const char_type *a_szCharset);
+
+    const char_type* ValidNameChars() const;
+    const char_type* ValidOprtChars() const;
+    const char_type* ValidInfixOprtChars() const;
+
+    void SetArgSep(char_type cArgSep);
+    char_type GetArgSep() const;
+
+    void  Error(EErrorCodes a_iErrc,
+                int a_iPos = (int)mu::string_type::npos,
+                const string_type &a_strTok = string_type() ) const;
+
+ protected:
+
+    void Init();
+
+    virtual void InitCharSets() = 0;
+    virtual void InitFun() = 0;
+    virtual void InitConst() = 0;
+    virtual void InitOprt() = 0;
+
+    virtual void OnDetectVar(string_type *pExpr, int &nStart, int &nEnd);
+
+    static const char_type *c_DefaultOprt[];
+    static std::locale s_locale;  ///< The locale used by the parser
+    static bool g_DbgDumpCmdCode;
+    static bool g_DbgDumpStack;
+
+    /** \brief A facet class used to change decimal and thousands separator. */
+    template<class TChar>
+    class change_dec_sep : public std::numpunct<TChar>
+    {
+    public:
+
+      explicit change_dec_sep(char_type cDecSep, char_type cThousandsSep = 0, int nGroup = 3)
+        :std::numpunct<TChar>()
+        ,m_nGroup(nGroup)
+        ,m_cDecPoint(cDecSep)
+        ,m_cThousandsSep(cThousandsSep)
+      {}
+
+    protected:
+
+      virtual char_type do_decimal_point() const
+      {
+        return m_cDecPoint;
+      }
+
+      virtual char_type do_thousands_sep() const
+      {
+        return m_cThousandsSep;
+      }
+
+      virtual std::string do_grouping() const
+      {
+		// fix for issue 4: https://code.google.com/p/muparser/issues/detail?id=4
+		// courtesy of Jens Bartsch
+		// original code:
+		//        return std::string(1, (char)m_nGroup);
+		// new code:
+		return std::string(1, (char)(m_cThousandsSep > 0 ? m_nGroup : CHAR_MAX));
+      }
+
+    private:
+
+      int m_nGroup;
+      char_type m_cDecPoint;
+      char_type m_cThousandsSep;
+    };
+
+ private:
+
+    void Assign(const ParserBase &a_Parser);
+    void InitTokenReader();
+    void ReInit() const;
+
+    void AddCallback( const string_type &a_strName,
+                      const ParserCallback &a_Callback,
+                      funmap_type &a_Storage,
+                      const char_type *a_szCharSet );
+
+    void ApplyRemainingOprt(ParserStack<token_type> &a_stOpt,
+                                ParserStack<token_type> &a_stVal) const;
+    void ApplyBinOprt(ParserStack<token_type> &a_stOpt,
+                      ParserStack<token_type> &a_stVal) const;
+
+    void ApplyIfElse(ParserStack<token_type> &a_stOpt,
+                     ParserStack<token_type> &a_stVal) const;
+
+    void ApplyFunc(ParserStack<token_type> &a_stOpt,
+                   ParserStack<token_type> &a_stVal,
+                   int iArgCount) const;
+
+    token_type ApplyStrFunc(const token_type &a_FunTok,
+                            const std::vector<token_type> &a_vArg) const;
+
+    int GetOprtPrecedence(const token_type &a_Tok) const;
+    EOprtAssociativity GetOprtAssociativity(const token_type &a_Tok) const;
+
+    void CreateRPN() const;
+
+    value_type ParseString() const;
+    value_type ParseCmdCode() const;
+    value_type ParseCmdCodeBulk(int nOffset, int nThreadID) const;
+
+    void  CheckName(const string_type &a_strName, const string_type &a_CharSet) const;
+    void  CheckOprt(const string_type &a_sName,
+                    const ParserCallback &a_Callback,
+                    const string_type &a_szCharSet) const;
+
+    void StackDump(const ParserStack<token_type > &a_stVal,
+                   const ParserStack<token_type > &a_stOprt) const;
+
+    /** \brief Pointer to the parser function.
+
+      Eval() calls the function whose address is stored there.
+    */
+    mutable ParseFunction  m_pParseFormula;
+    mutable ParserByteCode m_vRPN;        ///< The Bytecode class.
+    mutable stringbuf_type  m_vStringBuf; ///< String buffer, used for storing string function arguments
+    stringbuf_type  m_vStringVarBuf;
+
+    std::auto_ptr<token_reader_type> m_pTokenReader; ///< Managed pointer to the token reader object.
+
+    funmap_type  m_FunDef;         ///< Map of function names and pointers.
+    funmap_type  m_PostOprtDef;    ///< Postfix operator callbacks
+    funmap_type  m_InfixOprtDef;   ///< unary infix operator.
+    funmap_type  m_OprtDef;        ///< Binary operator callbacks
+    valmap_type  m_ConstDef;       ///< user constants.
+    strmap_type  m_StrVarDef;      ///< user defined string constants
+    varmap_type  m_VarDef;         ///< user defind variables.
+
+    bool m_bBuiltInOp;             ///< Flag that can be used for switching built in operators on and off
+
+    string_type m_sNameChars;      ///< Charset for names
+    string_type m_sOprtChars;      ///< Charset for postfix/ binary operator tokens
+    string_type m_sInfixOprtChars; ///< Charset for infix operator tokens
+
+    mutable int m_nIfElseCounter;  ///< Internal counter for keeping track of nested if-then-else clauses
+
+    // items merely used for caching state information
+    mutable valbuf_type m_vStackBuffer; ///< This is merely a buffer used for the stack in the cmd parsing routine
+    mutable int m_nFinalResultIdx;
+};
+
+} // namespace mu
+
+#endif
+
diff --git a/geometry/qmuparser/muParserBytecode.cpp b/geometry/qmuparser/muParserBytecode.cpp
old mode 100755
new mode 100644
index 3964998..f2c4deb
--- a/geometry/qmuparser/muParserBytecode.cpp
+++ b/geometry/qmuparser/muParserBytecode.cpp
@@ -1,588 +1,588 @@
-/*
-                 __________                                      
-    _____   __ __\______   \_____  _______  ______  ____ _______ 
-   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
-  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
-  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|   
-        \/                       \/            \/      \/        
-  Copyright (C) 2011 Ingo Berg
-
-  Permission is hereby granted, free of charge, to any person obtaining a copy of this 
-  software and associated documentation files (the "Software"), to deal in the Software
-  without restriction, including without limitation the rights to use, copy, modify, 
-  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 
-  permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-  The above copyright notice and this permission notice shall be included in all copies or 
-  substantial portions of the Software.
-
-  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
-  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
-  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
-  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
-  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
-*/
-
-#include "muParserBytecode.h"
-
-#include <algorithm>
-#include <cassert>
-#include <string>
-#include <stack>
-#include <vector>
-#include <iostream>
-
-#include "muParserDef.h"
-#include "muParserError.h"
-#include "muParserToken.h"
-#include "muParserStack.h"
-#include "muParserTemplateMagic.h"
-
-
-namespace mu
-{
-  //---------------------------------------------------------------------------
-  /** \brief Bytecode default constructor. */
-  ParserByteCode::ParserByteCode()
-    :m_iStackPos(0)
-    ,m_iMaxStackSize(0)
-    ,m_vRPN()
-    ,m_bEnableOptimizer(true)
-  {
-    m_vRPN.reserve(50);
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Copy constructor. 
-    
-      Implemented in Terms of Assign(const ParserByteCode &a_ByteCode)
-  */
-  ParserByteCode::ParserByteCode(const ParserByteCode &a_ByteCode)
-  {
-    Assign(a_ByteCode);
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Assignment operator.
-    
-      Implemented in Terms of Assign(const ParserByteCode &a_ByteCode)
-  */
-  ParserByteCode& ParserByteCode::operator=(const ParserByteCode &a_ByteCode)
-  {
-    Assign(a_ByteCode);
-    return *this;
-  }
-
-  //---------------------------------------------------------------------------
-  void ParserByteCode::EnableOptimizer(bool bStat)
-  {
-    m_bEnableOptimizer = bStat;
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Copy state of another object to this. 
-    
-      \throw nowthrow
-  */
-  void ParserByteCode::Assign(const ParserByteCode &a_ByteCode)
-  {
-    if (this==&a_ByteCode)    
-      return;
-
-    m_iStackPos = a_ByteCode.m_iStackPos;
-    m_vRPN = a_ByteCode.m_vRPN;
-    m_iMaxStackSize = a_ByteCode.m_iMaxStackSize;
-	m_bEnableOptimizer = a_ByteCode.m_bEnableOptimizer;
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Add a Variable pointer to bytecode. 
-      \param a_pVar Pointer to be added.
-      \throw nothrow
-  */
-  void ParserByteCode::AddVar(value_type *a_pVar)
-  {
-    ++m_iStackPos;
-    m_iMaxStackSize = std::max(m_iMaxStackSize, (size_t)m_iStackPos);
-
-    // optimization does not apply
-    SToken tok;
-    tok.Cmd       = cmVAR;
-    tok.Val.ptr   = a_pVar;
-    tok.Val.data  = 1;
-    tok.Val.data2 = 0;
-    m_vRPN.push_back(tok);
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Add a Variable pointer to bytecode. 
-
-      Value entries in byte code consist of:
-      <ul>
-        <li>value array position of the value</li>
-        <li>the operator code according to ParserToken::cmVAL</li>
-        <li>the value stored in #mc_iSizeVal number of bytecode entries.</li>
-      </ul>
-
-      \param a_pVal Value to be added.
-      \throw nothrow
-  */
-  void ParserByteCode::AddVal(value_type a_fVal)
-  {
-    ++m_iStackPos;
-    m_iMaxStackSize = std::max(m_iMaxStackSize, (size_t)m_iStackPos);
-
-    // If optimization does not apply
-    SToken tok;
-    tok.Cmd = cmVAL;
-    tok.Val.ptr   = NULL;
-    tok.Val.data  = 0;
-    tok.Val.data2 = a_fVal;
-    m_vRPN.push_back(tok);
-  }
-
-  //---------------------------------------------------------------------------
-  void ParserByteCode::ConstantFolding(ECmdCode a_Oprt)
-  {
-    std::size_t sz = m_vRPN.size();
-    value_type &x = m_vRPN[sz-2].Val.data2,
-               &y = m_vRPN[sz-1].Val.data2;
-    switch (a_Oprt)
-    {
-    case cmLAND: x = (int)x && (int)y; m_vRPN.pop_back(); break;
-    case cmLOR:  x = (int)x || (int)y; m_vRPN.pop_back(); break;
-    case cmLT:   x = x < y;  m_vRPN.pop_back();  break;
-    case cmGT:   x = x > y;  m_vRPN.pop_back();  break;
-    case cmLE:   x = x <= y; m_vRPN.pop_back();  break;
-    case cmGE:   x = x >= y; m_vRPN.pop_back();  break;
-    case cmNEQ:  x = x != y; m_vRPN.pop_back();  break;
-    case cmEQ:   x = x == y; m_vRPN.pop_back();  break;
-    case cmADD:  x = x + y;  m_vRPN.pop_back();  break;
-    case cmSUB:  x = x - y;  m_vRPN.pop_back();  break;
-    case cmMUL:  x = x * y;  m_vRPN.pop_back();  break;
-    case cmDIV: 
-
-#if defined(MUP_MATH_EXCEPTIONS)
-        if (y==0)
-          throw ParserError(ecDIV_BY_ZERO, _T("0"));
-#endif
-
-        x = x / y;   
-        m_vRPN.pop_back();
-        break;
-
-    case cmPOW: x = MathImpl<value_type>::Pow(x, y); 
-                m_vRPN.pop_back();
-                break;
-
-    default:
-        break;
-    } // switch opcode
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Add an operator identifier to bytecode. 
-    
-      Operator entries in byte code consist of:
-      <ul>
-        <li>value array position of the result</li>
-        <li>the operator code according to ParserToken::ECmdCode</li>
-      </ul>
-
-      \sa  ParserToken::ECmdCode
-  */
-  void ParserByteCode::AddOp(ECmdCode a_Oprt)
-  {
-    bool bOptimized = false;
-
-    if (m_bEnableOptimizer)
-    {
-      std::size_t sz = m_vRPN.size();
-
-      // Check for foldable constants like:
-      //   cmVAL cmVAL cmADD 
-      // where cmADD can stand fopr any binary operator applied to
-      // two constant values.
-      if (sz>=2 && m_vRPN[sz-2].Cmd == cmVAL && m_vRPN[sz-1].Cmd == cmVAL)
-      {
-        ConstantFolding(a_Oprt);
-        bOptimized = true;
-      }
-      else
-      {
-        switch(a_Oprt)
-        {
-        case  cmPOW:
-              // Optimization for polynomials of low order
-              if (m_vRPN[sz-2].Cmd == cmVAR && m_vRPN[sz-1].Cmd == cmVAL)
-              {
-                if (m_vRPN[sz-1].Val.data2==2)
-                  m_vRPN[sz-2].Cmd = cmVARPOW2;
-                else if (m_vRPN[sz-1].Val.data2==3)
-                  m_vRPN[sz-2].Cmd = cmVARPOW3;
-                else if (m_vRPN[sz-1].Val.data2==4)
-                  m_vRPN[sz-2].Cmd = cmVARPOW4;
-                else
-                  break;
-
-                m_vRPN.pop_back();
-                bOptimized = true;
-              }
-              break;
-
-        case  cmSUB:
-        case  cmADD:
-              // Simple optimization based on pattern recognition for a shitload of different
-              // bytecode combinations of addition/subtraction
-              if ( (m_vRPN[sz-1].Cmd == cmVAR    && m_vRPN[sz-2].Cmd == cmVAL)    ||
-                   (m_vRPN[sz-1].Cmd == cmVAL    && m_vRPN[sz-2].Cmd == cmVAR)    || 
-                   (m_vRPN[sz-1].Cmd == cmVAL    && m_vRPN[sz-2].Cmd == cmVARMUL) ||
-                   (m_vRPN[sz-1].Cmd == cmVARMUL && m_vRPN[sz-2].Cmd == cmVAL)    ||
-                   (m_vRPN[sz-1].Cmd == cmVAR    && m_vRPN[sz-2].Cmd == cmVAR    && m_vRPN[sz-2].Val.ptr == m_vRPN[sz-1].Val.ptr) ||
-                   (m_vRPN[sz-1].Cmd == cmVAR    && m_vRPN[sz-2].Cmd == cmVARMUL && m_vRPN[sz-2].Val.ptr == m_vRPN[sz-1].Val.ptr) ||
-                   (m_vRPN[sz-1].Cmd == cmVARMUL && m_vRPN[sz-2].Cmd == cmVAR    && m_vRPN[sz-2].Val.ptr == m_vRPN[sz-1].Val.ptr) ||
-                   (m_vRPN[sz-1].Cmd == cmVARMUL && m_vRPN[sz-2].Cmd == cmVARMUL && m_vRPN[sz-2].Val.ptr == m_vRPN[sz-1].Val.ptr) )
-              {
-                assert( (m_vRPN[sz-2].Val.ptr==NULL && m_vRPN[sz-1].Val.ptr!=NULL) ||
-                        (m_vRPN[sz-2].Val.ptr!=NULL && m_vRPN[sz-1].Val.ptr==NULL) || 
-                        (m_vRPN[sz-2].Val.ptr == m_vRPN[sz-1].Val.ptr) );
-
-                m_vRPN[sz-2].Cmd = cmVARMUL;
-                m_vRPN[sz-2].Val.ptr    = (value_type*)((long long)(m_vRPN[sz-2].Val.ptr) | (long long)(m_vRPN[sz-1].Val.ptr));    // variable
-                m_vRPN[sz-2].Val.data2 += ((a_Oprt==cmSUB) ? -1 : 1) * m_vRPN[sz-1].Val.data2;  // offset
-                m_vRPN[sz-2].Val.data  += ((a_Oprt==cmSUB) ? -1 : 1) * m_vRPN[sz-1].Val.data;   // multiplicand
-                m_vRPN.pop_back();
-                bOptimized = true;
-              } 
-              break;
-
-        case  cmMUL:
-              if ( (m_vRPN[sz-1].Cmd == cmVAR && m_vRPN[sz-2].Cmd == cmVAL) ||
-                   (m_vRPN[sz-1].Cmd == cmVAL && m_vRPN[sz-2].Cmd == cmVAR) ) 
-              {
-                m_vRPN[sz-2].Cmd        = cmVARMUL;
-                m_vRPN[sz-2].Val.ptr    = (value_type*)((long long)(m_vRPN[sz-2].Val.ptr) | (long long)(m_vRPN[sz-1].Val.ptr));
-                m_vRPN[sz-2].Val.data   = m_vRPN[sz-2].Val.data2 + m_vRPN[sz-1].Val.data2;
-                m_vRPN[sz-2].Val.data2  = 0;
-                m_vRPN.pop_back();
-                bOptimized = true;
-              } 
-              else if ( (m_vRPN[sz-1].Cmd == cmVAL    && m_vRPN[sz-2].Cmd == cmVARMUL) ||
-                        (m_vRPN[sz-1].Cmd == cmVARMUL && m_vRPN[sz-2].Cmd == cmVAL) )
-              {
-                // Optimization: 2*(3*b+1) or (3*b+1)*2 -> 6*b+2
-                m_vRPN[sz-2].Cmd     = cmVARMUL;
-                m_vRPN[sz-2].Val.ptr = (value_type*)((long long)(m_vRPN[sz-2].Val.ptr) | (long long)(m_vRPN[sz-1].Val.ptr));
-                if (m_vRPN[sz-1].Cmd == cmVAL)
-                {
-                  m_vRPN[sz-2].Val.data  *= m_vRPN[sz-1].Val.data2;
-                  m_vRPN[sz-2].Val.data2 *= m_vRPN[sz-1].Val.data2;
-                }
-                else
-                {
-                  m_vRPN[sz-2].Val.data  = m_vRPN[sz-1].Val.data  * m_vRPN[sz-2].Val.data2;
-                  m_vRPN[sz-2].Val.data2 = m_vRPN[sz-1].Val.data2 * m_vRPN[sz-2].Val.data2;
-                }
-                m_vRPN.pop_back();
-                bOptimized = true;
-              }
-              else if (m_vRPN[sz-1].Cmd == cmVAR && m_vRPN[sz-2].Cmd == cmVAR &&
-                       m_vRPN[sz-1].Val.ptr == m_vRPN[sz-2].Val.ptr)
-              {
-                // Optimization: a*a -> a^2
-                m_vRPN[sz-2].Cmd = cmVARPOW2;
-                m_vRPN.pop_back();
-                bOptimized = true;
-              }
-              break;
-
-        case cmDIV:
-              if (m_vRPN[sz-1].Cmd == cmVAL && m_vRPN[sz-2].Cmd == cmVARMUL && m_vRPN[sz-1].Val.data2!=0)
-              {
-                // Optimization: 4*a/2 -> 2*a
-                m_vRPN[sz-2].Val.data  /= m_vRPN[sz-1].Val.data2;
-                m_vRPN[sz-2].Val.data2 /= m_vRPN[sz-1].Val.data2;
-                m_vRPN.pop_back();
-                bOptimized = true;
-              }
-              break;
-              
-        } // switch a_Oprt
-      }
-    }
-
-    // If optimization can't be applied just write the value
-    if (!bOptimized)
-    {
-      --m_iStackPos;
-      SToken tok;
-      tok.Cmd = a_Oprt;
-      m_vRPN.push_back(tok);
-    }
-  }
-
-  //---------------------------------------------------------------------------
-  void ParserByteCode::AddIfElse(ECmdCode a_Oprt)
-  {
-    SToken tok;
-    tok.Cmd = a_Oprt;
-    m_vRPN.push_back(tok);
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Add an assignment operator
-    
-      Operator entries in byte code consist of:
-      <ul>
-        <li>cmASSIGN code</li>
-        <li>the pointer of the destination variable</li>
-      </ul>
-
-      \sa  ParserToken::ECmdCode
-  */
-  void ParserByteCode::AddAssignOp(value_type *a_pVar)
-  {
-    --m_iStackPos;
-
-    SToken tok;
-    tok.Cmd = cmASSIGN;
-    tok.Oprt.ptr = a_pVar;
-    m_vRPN.push_back(tok);
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Add function to bytecode. 
-
-      \param a_iArgc Number of arguments, negative numbers indicate multiarg functions.
-      \param a_pFun Pointer to function callback.
-  */
-  void ParserByteCode::AddFun(generic_fun_type a_pFun, int a_iArgc)
-  {
-    if (a_iArgc>=0)
-    {
-      m_iStackPos = m_iStackPos - a_iArgc + 1; 
-    }
-    else
-    {
-      // function with unlimited number of arguments
-      m_iStackPos = m_iStackPos + a_iArgc + 1; 
-    }
-    m_iMaxStackSize = std::max(m_iMaxStackSize, (size_t)m_iStackPos);
-
-    SToken tok;
-    tok.Cmd = cmFUNC;
-    tok.Fun.argc = a_iArgc;
-    tok.Fun.ptr = a_pFun;
-    m_vRPN.push_back(tok);
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Add a bulk function to bytecode. 
-
-      \param a_iArgc Number of arguments, negative numbers indicate multiarg functions.
-      \param a_pFun Pointer to function callback.
-  */
-  void ParserByteCode::AddBulkFun(generic_fun_type a_pFun, int a_iArgc)
-  {
-    m_iStackPos = m_iStackPos - a_iArgc + 1; 
-    m_iMaxStackSize = std::max(m_iMaxStackSize, (size_t)m_iStackPos);
-
-    SToken tok;
-    tok.Cmd = cmFUNC_BULK;
-    tok.Fun.argc = a_iArgc;
-    tok.Fun.ptr = a_pFun;
-    m_vRPN.push_back(tok);
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Add Strung function entry to the parser bytecode. 
-      \throw nothrow
-
-      A string function entry consists of the stack position of the return value,
-      followed by a cmSTRFUNC code, the function pointer and an index into the 
-      string buffer maintained by the parser.
-  */
-  void ParserByteCode::AddStrFun(generic_fun_type a_pFun, int a_iArgc, int a_iIdx)
-  {
-    m_iStackPos = m_iStackPos - a_iArgc + 1;
-
-    SToken tok;
-    tok.Cmd = cmFUNC_STR;
-    tok.Fun.argc = a_iArgc;
-    tok.Fun.idx = a_iIdx;
-    tok.Fun.ptr = a_pFun;
-    m_vRPN.push_back(tok);
-
-    m_iMaxStackSize = std::max(m_iMaxStackSize, (size_t)m_iStackPos);
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Add end marker to bytecode.
-      
-      \throw nothrow 
-  */
-  void ParserByteCode::Finalize()
-  {
-    SToken tok;
-    tok.Cmd = cmEND;
-    m_vRPN.push_back(tok);
-    rpn_type(m_vRPN).swap(m_vRPN);     // shrink bytecode vector to fit
-
-    // Determine the if-then-else jump offsets
-    ParserStack<int> stIf, stElse;
-    int idx;
-    for (int i=0; i<(int)m_vRPN.size(); ++i)
-    {
-      switch(m_vRPN[i].Cmd)
-      {
-      case cmIF:
-            stIf.push(i);
-            break;
-
-      case  cmELSE:
-            stElse.push(i);
-            idx = stIf.pop();
-            m_vRPN[idx].Oprt.offset = i - idx;
-            break;
-      
-      case cmENDIF:
-            idx = stElse.pop();
-            m_vRPN[idx].Oprt.offset = i - idx;
-            break;
-
-      default:
-            break;
-      }
-    }
-  }
-
-  //---------------------------------------------------------------------------
-  const SToken* ParserByteCode::GetBase() const
-  {
-    if (m_vRPN.size()==0)
-      throw ParserError(ecINTERNAL_ERROR);
-    else
-      return &m_vRPN[0];
-  }
-
-  //---------------------------------------------------------------------------
-  std::size_t ParserByteCode::GetMaxStackSize() const
-  {
-    return m_iMaxStackSize+1;
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Returns the number of entries in the bytecode. */
-  std::size_t ParserByteCode::GetSize() const
-  {
-    return m_vRPN.size();
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Delete the bytecode. 
-  
-      \throw nothrow
-
-      The name of this function is a violation of my own coding guidelines
-      but this way it's more in line with the STL functions thus more 
-      intuitive.
-  */
-  void ParserByteCode::clear()
-  {
-    m_vRPN.clear();
-    m_iStackPos = 0;
-    m_iMaxStackSize = 0;
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Dump bytecode (for debugging only!). */
-  void ParserByteCode::AsciiDump()
-  {
-    if (!m_vRPN.size()) 
-    {
-      mu::console() << _T("No bytecode available\n");
-      return;
-    }
-
-    mu::console() << _T("Number of RPN tokens:") << (int)m_vRPN.size() << _T("\n");
-    for (std::size_t i=0; i<m_vRPN.size() && m_vRPN[i].Cmd!=cmEND; ++i)
-    {
-      mu::console() << std::dec << i << _T(" : \t");
-      switch (m_vRPN[i].Cmd)
-      {
-      case cmVAL:   mu::console() << _T("VAL \t");
-                    mu::console() << _T("[") << m_vRPN[i].Val.data2 << _T("]\n");
-                    break;
-
-      case cmVAR:   mu::console() << _T("VAR \t");
-	                  mu::console() << _T("[ADDR: 0x") << std::hex << m_vRPN[i].Val.ptr << _T("]\n"); 
-                    break;
-
-      case cmVARPOW2: mu::console() << _T("VARPOW2 \t");
-	                    mu::console() << _T("[ADDR: 0x") << std::hex << m_vRPN[i].Val.ptr << _T("]\n"); 
-                      break;
-
-      case cmVARPOW3: mu::console() << _T("VARPOW3 \t");
-	                    mu::console() << _T("[ADDR: 0x") << std::hex << m_vRPN[i].Val.ptr << _T("]\n"); 
-                      break;
-
-      case cmVARPOW4: mu::console() << _T("VARPOW4 \t");
-	                    mu::console() << _T("[ADDR: 0x") << std::hex << m_vRPN[i].Val.ptr << _T("]\n"); 
-                      break;
-
-      case cmVARMUL:  mu::console() << _T("VARMUL \t");
-	                    mu::console() << _T("[ADDR: 0x") << std::hex << m_vRPN[i].Val.ptr << _T("]"); 
-                      mu::console() << _T(" * [") << m_vRPN[i].Val.data << _T("]");
-                      mu::console() << _T(" + [") << m_vRPN[i].Val.data2 << _T("]\n");
-                      break;
-
-      case cmFUNC:  mu::console() << _T("CALL\t");
-                    mu::console() << _T("[ARG:") << std::dec << m_vRPN[i].Fun.argc << _T("]"); 
-                    mu::console() << _T("[ADDR: 0x") << std::hex << m_vRPN[i].Fun.ptr << _T("]"); 
-                    mu::console() << _T("\n");
-                    break;
-
-      case cmFUNC_STR:
-                    mu::console() << _T("CALL STRFUNC\t");
-                    mu::console() << _T("[ARG:") << std::dec << m_vRPN[i].Fun.argc << _T("]");
-                    mu::console() << _T("[IDX:") << std::dec << m_vRPN[i].Fun.idx << _T("]");
-                    mu::console() << _T("[ADDR: 0x") << m_vRPN[i].Fun.ptr << _T("]\n"); 
-                    break;
-
-      case cmLT:    mu::console() << _T("LT\n");  break;
-      case cmGT:    mu::console() << _T("GT\n");  break;
-      case cmLE:    mu::console() << _T("LE\n");  break;
-      case cmGE:    mu::console() << _T("GE\n");  break;
-      case cmEQ:    mu::console() << _T("EQ\n");  break;
-      case cmNEQ:   mu::console() << _T("NEQ\n"); break;
-      case cmADD:   mu::console() << _T("ADD\n"); break;
-      case cmLAND:  mu::console() << _T("&&\n"); break;
-      case cmLOR:   mu::console() << _T("||\n"); break;
-      case cmSUB:   mu::console() << _T("SUB\n"); break;
-      case cmMUL:   mu::console() << _T("MUL\n"); break;
-      case cmDIV:   mu::console() << _T("DIV\n"); break;
-      case cmPOW:   mu::console() << _T("POW\n"); break;
-
-      case cmIF:    mu::console() << _T("IF\t");
-                    mu::console() << _T("[OFFSET:") << std::dec << m_vRPN[i].Oprt.offset << _T("]\n");
-                    break;
-
-      case cmELSE:  mu::console() << _T("ELSE\t");
-                    mu::console() << _T("[OFFSET:") << std::dec << m_vRPN[i].Oprt.offset << _T("]\n");
-                    break;
-
-      case cmENDIF: mu::console() << _T("ENDIF\n"); break;
-
-      case cmASSIGN: 
-                    mu::console() << _T("ASSIGN\t");
-                    mu::console() << _T("[ADDR: 0x") << m_vRPN[i].Oprt.ptr << _T("]\n"); 
-                    break; 
-
-      default:      mu::console() << _T("(unknown code: ") << m_vRPN[i].Cmd << _T(")\n"); 
-                    break;
-      } // switch cmdCode
-    } // while bytecode
-
-    mu::console() << _T("END") << std::endl;
-  }
-} // namespace mu
+/*
+                 __________
+    _____   __ __\______   \_____  _______  ______  ____ _______
+   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
+  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
+  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|
+        \/                       \/            \/      \/
+  Copyright (C) 2011 Ingo Berg
+
+  Permission is hereby granted, free of charge, to any person obtaining a copy of this
+  software and associated documentation files (the "Software"), to deal in the Software
+  without restriction, including without limitation the rights to use, copy, modify,
+  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
+  permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included in all copies or
+  substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
+  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include "muParserBytecode.h"
+
+#include <algorithm>
+#include <cassert>
+#include <string>
+#include <stack>
+#include <vector>
+#include <iostream>
+
+#include "muParserDef.h"
+#include "muParserError.h"
+#include "muParserToken.h"
+#include "muParserStack.h"
+#include "muParserTemplateMagic.h"
+
+
+namespace mu
+{
+  //---------------------------------------------------------------------------
+  /** \brief Bytecode default constructor. */
+  ParserByteCode::ParserByteCode()
+    :m_iStackPos(0)
+    ,m_iMaxStackSize(0)
+    ,m_vRPN()
+    ,m_bEnableOptimizer(true)
+  {
+    m_vRPN.reserve(50);
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Copy constructor.
+
+      Implemented in Terms of Assign(const ParserByteCode &a_ByteCode)
+  */
+  ParserByteCode::ParserByteCode(const ParserByteCode &a_ByteCode)
+  {
+    Assign(a_ByteCode);
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Assignment operator.
+
+      Implemented in Terms of Assign(const ParserByteCode &a_ByteCode)
+  */
+  ParserByteCode& ParserByteCode::operator=(const ParserByteCode &a_ByteCode)
+  {
+    Assign(a_ByteCode);
+    return *this;
+  }
+
+  //---------------------------------------------------------------------------
+  void ParserByteCode::EnableOptimizer(bool bStat)
+  {
+    m_bEnableOptimizer = bStat;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Copy state of another object to this.
+
+      \throw nowthrow
+  */
+  void ParserByteCode::Assign(const ParserByteCode &a_ByteCode)
+  {
+    if (this==&a_ByteCode)
+      return;
+
+    m_iStackPos = a_ByteCode.m_iStackPos;
+    m_vRPN = a_ByteCode.m_vRPN;
+    m_iMaxStackSize = a_ByteCode.m_iMaxStackSize;
+	m_bEnableOptimizer = a_ByteCode.m_bEnableOptimizer;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Add a Variable pointer to bytecode.
+      \param a_pVar Pointer to be added.
+      \throw nothrow
+  */
+  void ParserByteCode::AddVar(value_type *a_pVar)
+  {
+    ++m_iStackPos;
+    m_iMaxStackSize = std::max(m_iMaxStackSize, (size_t)m_iStackPos);
+
+    // optimization does not apply
+    SToken tok;
+    tok.Cmd       = cmVAR;
+    tok.Val.ptr   = a_pVar;
+    tok.Val.data  = 1;
+    tok.Val.data2 = 0;
+    m_vRPN.push_back(tok);
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Add a Variable pointer to bytecode.
+
+      Value entries in byte code consist of:
+      <ul>
+        <li>value array position of the value</li>
+        <li>the operator code according to ParserToken::cmVAL</li>
+        <li>the value stored in #mc_iSizeVal number of bytecode entries.</li>
+      </ul>
+
+      \param a_pVal Value to be added.
+      \throw nothrow
+  */
+  void ParserByteCode::AddVal(value_type a_fVal)
+  {
+    ++m_iStackPos;
+    m_iMaxStackSize = std::max(m_iMaxStackSize, (size_t)m_iStackPos);
+
+    // If optimization does not apply
+    SToken tok;
+    tok.Cmd = cmVAL;
+    tok.Val.ptr   = NULL;
+    tok.Val.data  = 0;
+    tok.Val.data2 = a_fVal;
+    m_vRPN.push_back(tok);
+  }
+
+  //---------------------------------------------------------------------------
+  void ParserByteCode::ConstantFolding(ECmdCode a_Oprt)
+  {
+    std::size_t sz = m_vRPN.size();
+    value_type &x = m_vRPN[sz-2].Val.data2,
+               &y = m_vRPN[sz-1].Val.data2;
+    switch (a_Oprt)
+    {
+    case cmLAND: x = (int)x && (int)y; m_vRPN.pop_back(); break;
+    case cmLOR:  x = (int)x || (int)y; m_vRPN.pop_back(); break;
+    case cmLT:   x = x < y;  m_vRPN.pop_back();  break;
+    case cmGT:   x = x > y;  m_vRPN.pop_back();  break;
+    case cmLE:   x = x <= y; m_vRPN.pop_back();  break;
+    case cmGE:   x = x >= y; m_vRPN.pop_back();  break;
+    case cmNEQ:  x = x != y; m_vRPN.pop_back();  break;
+    case cmEQ:   x = x == y; m_vRPN.pop_back();  break;
+    case cmADD:  x = x + y;  m_vRPN.pop_back();  break;
+    case cmSUB:  x = x - y;  m_vRPN.pop_back();  break;
+    case cmMUL:  x = x * y;  m_vRPN.pop_back();  break;
+    case cmDIV:
+
+#if defined(MUP_MATH_EXCEPTIONS)
+        if (y==0)
+          throw ParserError(ecDIV_BY_ZERO, _T("0"));
+#endif
+
+        x = x / y;
+        m_vRPN.pop_back();
+        break;
+
+    case cmPOW: x = MathImpl<value_type>::Pow(x, y);
+                m_vRPN.pop_back();
+                break;
+
+    default:
+        break;
+    } // switch opcode
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Add an operator identifier to bytecode.
+
+      Operator entries in byte code consist of:
+      <ul>
+        <li>value array position of the result</li>
+        <li>the operator code according to ParserToken::ECmdCode</li>
+      </ul>
+
+      \sa  ParserToken::ECmdCode
+  */
+  void ParserByteCode::AddOp(ECmdCode a_Oprt)
+  {
+    bool bOptimized = false;
+
+    if (m_bEnableOptimizer)
+    {
+      std::size_t sz = m_vRPN.size();
+
+      // Check for foldable constants like:
+      //   cmVAL cmVAL cmADD
+      // where cmADD can stand fopr any binary operator applied to
+      // two constant values.
+      if (sz>=2 && m_vRPN[sz-2].Cmd == cmVAL && m_vRPN[sz-1].Cmd == cmVAL)
+      {
+        ConstantFolding(a_Oprt);
+        bOptimized = true;
+      }
+      else
+      {
+        switch(a_Oprt)
+        {
+        case  cmPOW:
+              // Optimization for polynomials of low order
+              if (m_vRPN[sz-2].Cmd == cmVAR && m_vRPN[sz-1].Cmd == cmVAL)
+              {
+                if (m_vRPN[sz-1].Val.data2==2)
+                  m_vRPN[sz-2].Cmd = cmVARPOW2;
+                else if (m_vRPN[sz-1].Val.data2==3)
+                  m_vRPN[sz-2].Cmd = cmVARPOW3;
+                else if (m_vRPN[sz-1].Val.data2==4)
+                  m_vRPN[sz-2].Cmd = cmVARPOW4;
+                else
+                  break;
+
+                m_vRPN.pop_back();
+                bOptimized = true;
+              }
+              break;
+
+        case  cmSUB:
+        case  cmADD:
+              // Simple optimization based on pattern recognition for a shitload of different
+              // bytecode combinations of addition/subtraction
+              if ( (m_vRPN[sz-1].Cmd == cmVAR    && m_vRPN[sz-2].Cmd == cmVAL)    ||
+                   (m_vRPN[sz-1].Cmd == cmVAL    && m_vRPN[sz-2].Cmd == cmVAR)    ||
+                   (m_vRPN[sz-1].Cmd == cmVAL    && m_vRPN[sz-2].Cmd == cmVARMUL) ||
+                   (m_vRPN[sz-1].Cmd == cmVARMUL && m_vRPN[sz-2].Cmd == cmVAL)    ||
+                   (m_vRPN[sz-1].Cmd == cmVAR    && m_vRPN[sz-2].Cmd == cmVAR    && m_vRPN[sz-2].Val.ptr == m_vRPN[sz-1].Val.ptr) ||
+                   (m_vRPN[sz-1].Cmd == cmVAR    && m_vRPN[sz-2].Cmd == cmVARMUL && m_vRPN[sz-2].Val.ptr == m_vRPN[sz-1].Val.ptr) ||
+                   (m_vRPN[sz-1].Cmd == cmVARMUL && m_vRPN[sz-2].Cmd == cmVAR    && m_vRPN[sz-2].Val.ptr == m_vRPN[sz-1].Val.ptr) ||
+                   (m_vRPN[sz-1].Cmd == cmVARMUL && m_vRPN[sz-2].Cmd == cmVARMUL && m_vRPN[sz-2].Val.ptr == m_vRPN[sz-1].Val.ptr) )
+              {
+                assert( (m_vRPN[sz-2].Val.ptr==NULL && m_vRPN[sz-1].Val.ptr!=NULL) ||
+                        (m_vRPN[sz-2].Val.ptr!=NULL && m_vRPN[sz-1].Val.ptr==NULL) ||
+                        (m_vRPN[sz-2].Val.ptr == m_vRPN[sz-1].Val.ptr) );
+
+                m_vRPN[sz-2].Cmd = cmVARMUL;
+                m_vRPN[sz-2].Val.ptr    = (value_type*)((long long)(m_vRPN[sz-2].Val.ptr) | (long long)(m_vRPN[sz-1].Val.ptr));    // variable
+                m_vRPN[sz-2].Val.data2 += ((a_Oprt==cmSUB) ? -1 : 1) * m_vRPN[sz-1].Val.data2;  // offset
+                m_vRPN[sz-2].Val.data  += ((a_Oprt==cmSUB) ? -1 : 1) * m_vRPN[sz-1].Val.data;   // multiplicand
+                m_vRPN.pop_back();
+                bOptimized = true;
+              }
+              break;
+
+        case  cmMUL:
+              if ( (m_vRPN[sz-1].Cmd == cmVAR && m_vRPN[sz-2].Cmd == cmVAL) ||
+                   (m_vRPN[sz-1].Cmd == cmVAL && m_vRPN[sz-2].Cmd == cmVAR) )
+              {
+                m_vRPN[sz-2].Cmd        = cmVARMUL;
+                m_vRPN[sz-2].Val.ptr    = (value_type*)((long long)(m_vRPN[sz-2].Val.ptr) | (long long)(m_vRPN[sz-1].Val.ptr));
+                m_vRPN[sz-2].Val.data   = m_vRPN[sz-2].Val.data2 + m_vRPN[sz-1].Val.data2;
+                m_vRPN[sz-2].Val.data2  = 0;
+                m_vRPN.pop_back();
+                bOptimized = true;
+              }
+              else if ( (m_vRPN[sz-1].Cmd == cmVAL    && m_vRPN[sz-2].Cmd == cmVARMUL) ||
+                        (m_vRPN[sz-1].Cmd == cmVARMUL && m_vRPN[sz-2].Cmd == cmVAL) )
+              {
+                // Optimization: 2*(3*b+1) or (3*b+1)*2 -> 6*b+2
+                m_vRPN[sz-2].Cmd     = cmVARMUL;
+                m_vRPN[sz-2].Val.ptr = (value_type*)((long long)(m_vRPN[sz-2].Val.ptr) | (long long)(m_vRPN[sz-1].Val.ptr));
+                if (m_vRPN[sz-1].Cmd == cmVAL)
+                {
+                  m_vRPN[sz-2].Val.data  *= m_vRPN[sz-1].Val.data2;
+                  m_vRPN[sz-2].Val.data2 *= m_vRPN[sz-1].Val.data2;
+                }
+                else
+                {
+                  m_vRPN[sz-2].Val.data  = m_vRPN[sz-1].Val.data  * m_vRPN[sz-2].Val.data2;
+                  m_vRPN[sz-2].Val.data2 = m_vRPN[sz-1].Val.data2 * m_vRPN[sz-2].Val.data2;
+                }
+                m_vRPN.pop_back();
+                bOptimized = true;
+              }
+              else if (m_vRPN[sz-1].Cmd == cmVAR && m_vRPN[sz-2].Cmd == cmVAR &&
+                       m_vRPN[sz-1].Val.ptr == m_vRPN[sz-2].Val.ptr)
+              {
+                // Optimization: a*a -> a^2
+                m_vRPN[sz-2].Cmd = cmVARPOW2;
+                m_vRPN.pop_back();
+                bOptimized = true;
+              }
+              break;
+
+        case cmDIV:
+              if (m_vRPN[sz-1].Cmd == cmVAL && m_vRPN[sz-2].Cmd == cmVARMUL && m_vRPN[sz-1].Val.data2!=0)
+              {
+                // Optimization: 4*a/2 -> 2*a
+                m_vRPN[sz-2].Val.data  /= m_vRPN[sz-1].Val.data2;
+                m_vRPN[sz-2].Val.data2 /= m_vRPN[sz-1].Val.data2;
+                m_vRPN.pop_back();
+                bOptimized = true;
+              }
+              break;
+
+        } // switch a_Oprt
+      }
+    }
+
+    // If optimization can't be applied just write the value
+    if (!bOptimized)
+    {
+      --m_iStackPos;
+      SToken tok;
+      tok.Cmd = a_Oprt;
+      m_vRPN.push_back(tok);
+    }
+  }
+
+  //---------------------------------------------------------------------------
+  void ParserByteCode::AddIfElse(ECmdCode a_Oprt)
+  {
+    SToken tok;
+    tok.Cmd = a_Oprt;
+    m_vRPN.push_back(tok);
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Add an assignment operator
+
+      Operator entries in byte code consist of:
+      <ul>
+        <li>cmASSIGN code</li>
+        <li>the pointer of the destination variable</li>
+      </ul>
+
+      \sa  ParserToken::ECmdCode
+  */
+  void ParserByteCode::AddAssignOp(value_type *a_pVar)
+  {
+    --m_iStackPos;
+
+    SToken tok;
+    tok.Cmd = cmASSIGN;
+    tok.Oprt.ptr = a_pVar;
+    m_vRPN.push_back(tok);
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Add function to bytecode.
+
+      \param a_iArgc Number of arguments, negative numbers indicate multiarg functions.
+      \param a_pFun Pointer to function callback.
+  */
+  void ParserByteCode::AddFun(generic_fun_type a_pFun, int a_iArgc)
+  {
+    if (a_iArgc>=0)
+    {
+      m_iStackPos = m_iStackPos - a_iArgc + 1;
+    }
+    else
+    {
+      // function with unlimited number of arguments
+      m_iStackPos = m_iStackPos + a_iArgc + 1;
+    }
+    m_iMaxStackSize = std::max(m_iMaxStackSize, (size_t)m_iStackPos);
+
+    SToken tok;
+    tok.Cmd = cmFUNC;
+    tok.Fun.argc = a_iArgc;
+    tok.Fun.ptr = a_pFun;
+    m_vRPN.push_back(tok);
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Add a bulk function to bytecode.
+
+      \param a_iArgc Number of arguments, negative numbers indicate multiarg functions.
+      \param a_pFun Pointer to function callback.
+  */
+  void ParserByteCode::AddBulkFun(generic_fun_type a_pFun, int a_iArgc)
+  {
+    m_iStackPos = m_iStackPos - a_iArgc + 1;
+    m_iMaxStackSize = std::max(m_iMaxStackSize, (size_t)m_iStackPos);
+
+    SToken tok;
+    tok.Cmd = cmFUNC_BULK;
+    tok.Fun.argc = a_iArgc;
+    tok.Fun.ptr = a_pFun;
+    m_vRPN.push_back(tok);
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Add Strung function entry to the parser bytecode.
+      \throw nothrow
+
+      A string function entry consists of the stack position of the return value,
+      followed by a cmSTRFUNC code, the function pointer and an index into the
+      string buffer maintained by the parser.
+  */
+  void ParserByteCode::AddStrFun(generic_fun_type a_pFun, int a_iArgc, int a_iIdx)
+  {
+    m_iStackPos = m_iStackPos - a_iArgc + 1;
+
+    SToken tok;
+    tok.Cmd = cmFUNC_STR;
+    tok.Fun.argc = a_iArgc;
+    tok.Fun.idx = a_iIdx;
+    tok.Fun.ptr = a_pFun;
+    m_vRPN.push_back(tok);
+
+    m_iMaxStackSize = std::max(m_iMaxStackSize, (size_t)m_iStackPos);
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Add end marker to bytecode.
+
+      \throw nothrow
+  */
+  void ParserByteCode::Finalize()
+  {
+    SToken tok;
+    tok.Cmd = cmEND;
+    m_vRPN.push_back(tok);
+    rpn_type(m_vRPN).swap(m_vRPN);     // shrink bytecode vector to fit
+
+    // Determine the if-then-else jump offsets
+    ParserStack<int> stIf, stElse;
+    int idx;
+    for (int i=0; i<(int)m_vRPN.size(); ++i)
+    {
+      switch(m_vRPN[i].Cmd)
+      {
+      case cmIF:
+            stIf.push(i);
+            break;
+
+      case  cmELSE:
+            stElse.push(i);
+            idx = stIf.pop();
+            m_vRPN[idx].Oprt.offset = i - idx;
+            break;
+
+      case cmENDIF:
+            idx = stElse.pop();
+            m_vRPN[idx].Oprt.offset = i - idx;
+            break;
+
+      default:
+            break;
+      }
+    }
+  }
+
+  //---------------------------------------------------------------------------
+  const SToken* ParserByteCode::GetBase() const
+  {
+    if (m_vRPN.size()==0)
+      throw ParserError(ecINTERNAL_ERROR);
+    else
+      return &m_vRPN[0];
+  }
+
+  //---------------------------------------------------------------------------
+  std::size_t ParserByteCode::GetMaxStackSize() const
+  {
+    return m_iMaxStackSize+1;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Returns the number of entries in the bytecode. */
+  std::size_t ParserByteCode::GetSize() const
+  {
+    return m_vRPN.size();
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Delete the bytecode.
+
+      \throw nothrow
+
+      The name of this function is a violation of my own coding guidelines
+      but this way it's more in line with the STL functions thus more
+      intuitive.
+  */
+  void ParserByteCode::clear()
+  {
+    m_vRPN.clear();
+    m_iStackPos = 0;
+    m_iMaxStackSize = 0;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Dump bytecode (for debugging only!). */
+  void ParserByteCode::AsciiDump()
+  {
+    if (!m_vRPN.size())
+    {
+      mu::console() << _T("No bytecode available\n");
+      return;
+    }
+
+    mu::console() << _T("Number of RPN tokens:") << (int)m_vRPN.size() << _T("\n");
+    for (std::size_t i=0; i<m_vRPN.size() && m_vRPN[i].Cmd!=cmEND; ++i)
+    {
+      mu::console() << std::dec << i << _T(" : \t");
+      switch (m_vRPN[i].Cmd)
+      {
+      case cmVAL:   mu::console() << _T("VAL \t");
+                    mu::console() << _T("[") << m_vRPN[i].Val.data2 << _T("]\n");
+                    break;
+
+      case cmVAR:   mu::console() << _T("VAR \t");
+	                  mu::console() << _T("[ADDR: 0x") << std::hex << m_vRPN[i].Val.ptr << _T("]\n");
+                    break;
+
+      case cmVARPOW2: mu::console() << _T("VARPOW2 \t");
+	                    mu::console() << _T("[ADDR: 0x") << std::hex << m_vRPN[i].Val.ptr << _T("]\n");
+                      break;
+
+      case cmVARPOW3: mu::console() << _T("VARPOW3 \t");
+	                    mu::console() << _T("[ADDR: 0x") << std::hex << m_vRPN[i].Val.ptr << _T("]\n");
+                      break;
+
+      case cmVARPOW4: mu::console() << _T("VARPOW4 \t");
+	                    mu::console() << _T("[ADDR: 0x") << std::hex << m_vRPN[i].Val.ptr << _T("]\n");
+                      break;
+
+      case cmVARMUL:  mu::console() << _T("VARMUL \t");
+	                    mu::console() << _T("[ADDR: 0x") << std::hex << m_vRPN[i].Val.ptr << _T("]");
+                      mu::console() << _T(" * [") << m_vRPN[i].Val.data << _T("]");
+                      mu::console() << _T(" + [") << m_vRPN[i].Val.data2 << _T("]\n");
+                      break;
+
+      case cmFUNC:  mu::console() << _T("CALL\t");
+                    mu::console() << _T("[ARG:") << std::dec << m_vRPN[i].Fun.argc << _T("]");
+                    mu::console() << _T("[ADDR: 0x") << std::hex << m_vRPN[i].Fun.ptr << _T("]");
+                    mu::console() << _T("\n");
+                    break;
+
+      case cmFUNC_STR:
+                    mu::console() << _T("CALL STRFUNC\t");
+                    mu::console() << _T("[ARG:") << std::dec << m_vRPN[i].Fun.argc << _T("]");
+                    mu::console() << _T("[IDX:") << std::dec << m_vRPN[i].Fun.idx << _T("]");
+                    mu::console() << _T("[ADDR: 0x") << m_vRPN[i].Fun.ptr << _T("]\n");
+                    break;
+
+      case cmLT:    mu::console() << _T("LT\n");  break;
+      case cmGT:    mu::console() << _T("GT\n");  break;
+      case cmLE:    mu::console() << _T("LE\n");  break;
+      case cmGE:    mu::console() << _T("GE\n");  break;
+      case cmEQ:    mu::console() << _T("EQ\n");  break;
+      case cmNEQ:   mu::console() << _T("NEQ\n"); break;
+      case cmADD:   mu::console() << _T("ADD\n"); break;
+      case cmLAND:  mu::console() << _T("&&\n"); break;
+      case cmLOR:   mu::console() << _T("||\n"); break;
+      case cmSUB:   mu::console() << _T("SUB\n"); break;
+      case cmMUL:   mu::console() << _T("MUL\n"); break;
+      case cmDIV:   mu::console() << _T("DIV\n"); break;
+      case cmPOW:   mu::console() << _T("POW\n"); break;
+
+      case cmIF:    mu::console() << _T("IF\t");
+                    mu::console() << _T("[OFFSET:") << std::dec << m_vRPN[i].Oprt.offset << _T("]\n");
+                    break;
+
+      case cmELSE:  mu::console() << _T("ELSE\t");
+                    mu::console() << _T("[OFFSET:") << std::dec << m_vRPN[i].Oprt.offset << _T("]\n");
+                    break;
+
+      case cmENDIF: mu::console() << _T("ENDIF\n"); break;
+
+      case cmASSIGN:
+                    mu::console() << _T("ASSIGN\t");
+                    mu::console() << _T("[ADDR: 0x") << m_vRPN[i].Oprt.ptr << _T("]\n");
+                    break;
+
+      default:      mu::console() << _T("(unknown code: ") << m_vRPN[i].Cmd << _T(")\n");
+                    break;
+      } // switch cmdCode
+    } // while bytecode
+
+    mu::console() << _T("END") << std::endl;
+  }
+} // namespace mu
diff --git a/geometry/qmuparser/muParserBytecode.h b/geometry/qmuparser/muParserBytecode.h
old mode 100755
new mode 100644
index 39ab39d..6f931f9
--- a/geometry/qmuparser/muParserBytecode.h
+++ b/geometry/qmuparser/muParserBytecode.h
@@ -1,141 +1,141 @@
-/*
-                 __________                                      
-    _____   __ __\______   \_____  _______  ______  ____ _______ 
-   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
-  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
-  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|   
-        \/                       \/            \/      \/        
-  Copyright (C) 2004-2013 Ingo Berg
-
-  Permission is hereby granted, free of charge, to any person obtaining a copy of this 
-  software and associated documentation files (the "Software"), to deal in the Software
-  without restriction, including without limitation the rights to use, copy, modify, 
-  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 
-  permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-  The above copyright notice and this permission notice shall be included in all copies or 
-  substantial portions of the Software.
-
-  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
-  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
-  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
-  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
-  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
-*/
-#ifndef MU_PARSER_BYTECODE_H
-#define MU_PARSER_BYTECODE_H
-
-#include <cassert>
-#include <string>
-#include <stack>
-#include <vector>
-
-#include "muParserDef.h"
-#include "muParserError.h"
-#include "muParserToken.h"
-
-/** \file
-    \brief Definition of the parser bytecode class.
-*/
-
-
-namespace mu
-{
-  struct SToken
-  {
-    ECmdCode Cmd;
-    int StackPos;
-
-    union
-    {
-      struct //SValData
-      {
-        value_type *ptr;
-        value_type  data;
-        value_type  data2;
-      } Val;
-
-      struct //SFunData
-      {
-        // Note: generic_fun_type is merely a placeholder. The real type could be 
-        //       anything between gun_type1 and fun_type9. I can't use a void
-        //       pointer due to constraints in the ANSI standard which allows
-        //       data pointers and function pointers to differ in size.
-        generic_fun_type ptr;
-        int   argc;
-        int   idx;
-      } Fun;
-
-      struct //SOprtData
-      {
-        value_type *ptr;
-        int offset;
-      } Oprt;
-    };
-  };
-  
-  
-  /** \brief Bytecode implementation of the Math Parser.
-
-  The bytecode contains the formula converted to revers polish notation stored in a continious
-  memory area. Associated with this data are operator codes, variable pointers, constant 
-  values and function pointers. Those are necessary in order to calculate the result.
-  All those data items will be casted to the underlying datatype of the bytecode.
-
-  \author (C) 2004-2013 Ingo Berg 
-*/
-class ParserByteCode
-{
-private:
-
-    /** \brief Token type for internal use only. */
-    typedef ParserToken<value_type, string_type> token_type;
-
-    /** \brief Token vector for storing the RPN. */
-    typedef std::vector<SToken> rpn_type;
-
-    /** \brief Position in the Calculation array. */
-    unsigned m_iStackPos;
-
-    /** \brief Maximum size needed for the stack. */
-    std::size_t m_iMaxStackSize;
-    
-    /** \brief The actual rpn storage. */
-    rpn_type  m_vRPN;
-
-    bool m_bEnableOptimizer;
-
-    void ConstantFolding(ECmdCode a_Oprt);
-
-public:
-
-    ParserByteCode();
-    ParserByteCode(const ParserByteCode &a_ByteCode);
-    ParserByteCode& operator=(const ParserByteCode &a_ByteCode);
-    void Assign(const ParserByteCode &a_ByteCode);
-
-    void AddVar(value_type *a_pVar);
-    void AddVal(value_type a_fVal);
-    void AddOp(ECmdCode a_Oprt);
-    void AddIfElse(ECmdCode a_Oprt);
-    void AddAssignOp(value_type *a_pVar);
-    void AddFun(generic_fun_type a_pFun, int a_iArgc);
-    void AddBulkFun(generic_fun_type a_pFun, int a_iArgc);
-    void AddStrFun(generic_fun_type a_pFun, int a_iArgc, int a_iIdx);
-
-    void EnableOptimizer(bool bStat);
-
-    void Finalize();
-    void clear();
-    std::size_t GetMaxStackSize() const;
-    std::size_t GetSize() const;
-
-    const SToken* GetBase() const;
-    void AsciiDump();
-};
-
-} // namespace mu
-
-#endif
-
-
+/*
+                 __________
+    _____   __ __\______   \_____  _______  ______  ____ _______
+   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
+  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
+  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|
+        \/                       \/            \/      \/
+  Copyright (C) 2004-2013 Ingo Berg
+
+  Permission is hereby granted, free of charge, to any person obtaining a copy of this
+  software and associated documentation files (the "Software"), to deal in the Software
+  without restriction, including without limitation the rights to use, copy, modify,
+  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
+  permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included in all copies or
+  substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
+  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#ifndef MU_PARSER_BYTECODE_H
+#define MU_PARSER_BYTECODE_H
+
+#include <cassert>
+#include <string>
+#include <stack>
+#include <vector>
+
+#include "muParserDef.h"
+#include "muParserError.h"
+#include "muParserToken.h"
+
+/** \file
+    \brief Definition of the parser bytecode class.
+*/
+
+
+namespace mu
+{
+  struct SToken
+  {
+    ECmdCode Cmd;
+    int StackPos;
+
+    union
+    {
+      struct //SValData
+      {
+        value_type *ptr;
+        value_type  data;
+        value_type  data2;
+      } Val;
+
+      struct //SFunData
+      {
+        // Note: generic_fun_type is merely a placeholder. The real type could be
+        //       anything between gun_type1 and fun_type9. I can't use a void
+        //       pointer due to constraints in the ANSI standard which allows
+        //       data pointers and function pointers to differ in size.
+        generic_fun_type ptr;
+        int   argc;
+        int   idx;
+      } Fun;
+
+      struct //SOprtData
+      {
+        value_type *ptr;
+        int offset;
+      } Oprt;
+    };
+  };
+
+
+  /** \brief Bytecode implementation of the Math Parser.
+
+  The bytecode contains the formula converted to revers polish notation stored in a continious
+  memory area. Associated with this data are operator codes, variable pointers, constant
+  values and function pointers. Those are necessary in order to calculate the result.
+  All those data items will be casted to the underlying datatype of the bytecode.
+
+  \author (C) 2004-2013 Ingo Berg
+*/
+class ParserByteCode
+{
+private:
+
+    /** \brief Token type for internal use only. */
+    typedef ParserToken<value_type, string_type> token_type;
+
+    /** \brief Token vector for storing the RPN. */
+    typedef std::vector<SToken> rpn_type;
+
+    /** \brief Position in the Calculation array. */
+    unsigned m_iStackPos;
+
+    /** \brief Maximum size needed for the stack. */
+    std::size_t m_iMaxStackSize;
+
+    /** \brief The actual rpn storage. */
+    rpn_type  m_vRPN;
+
+    bool m_bEnableOptimizer;
+
+    void ConstantFolding(ECmdCode a_Oprt);
+
+public:
+
+    ParserByteCode();
+    ParserByteCode(const ParserByteCode &a_ByteCode);
+    ParserByteCode& operator=(const ParserByteCode &a_ByteCode);
+    void Assign(const ParserByteCode &a_ByteCode);
+
+    void AddVar(value_type *a_pVar);
+    void AddVal(value_type a_fVal);
+    void AddOp(ECmdCode a_Oprt);
+    void AddIfElse(ECmdCode a_Oprt);
+    void AddAssignOp(value_type *a_pVar);
+    void AddFun(generic_fun_type a_pFun, int a_iArgc);
+    void AddBulkFun(generic_fun_type a_pFun, int a_iArgc);
+    void AddStrFun(generic_fun_type a_pFun, int a_iArgc, int a_iIdx);
+
+    void EnableOptimizer(bool bStat);
+
+    void Finalize();
+    void clear();
+    std::size_t GetMaxStackSize() const;
+    std::size_t GetSize() const;
+
+    const SToken* GetBase() const;
+    void AsciiDump();
+};
+
+} // namespace mu
+
+#endif
+
+
diff --git a/geometry/qmuparser/muParserCallback.cpp b/geometry/qmuparser/muParserCallback.cpp
old mode 100755
new mode 100644
index 2044fe1..b05c881
--- a/geometry/qmuparser/muParserCallback.cpp
+++ b/geometry/qmuparser/muParserCallback.cpp
@@ -1,463 +1,463 @@
-/*
-                 __________                                      
-    _____   __ __\______   \_____  _______  ______  ____ _______ 
-   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
-  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
-  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|   
-        \/                       \/            \/      \/        
-  Copyright (C) 2004-2011 Ingo Berg
-
-  Permission is hereby granted, free of charge, to any person obtaining a copy of this 
-  software and associated documentation files (the "Software"), to deal in the Software
-  without restriction, including without limitation the rights to use, copy, modify, 
-  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 
-  permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-  The above copyright notice and this permission notice shall be included in all copies or 
-  substantial portions of the Software.
-
-  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
-  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
-  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
-  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
-  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
-*/
-
-#include "muParserCallback.h"
-
-/** \file
-    \brief Implementation of the parser callback class.
-*/
-
-
-namespace mu
-{
-  //---------------------------------------------------------------------------
-  ParserCallback::ParserCallback(fun_type0 a_pFun, bool a_bAllowOpti)
-    :m_pFun((void*)a_pFun)
-    ,m_iArgc(0)
-    ,m_iPri(-1)
-    ,m_eOprtAsct(oaNONE)
-    ,m_iCode(cmFUNC)
-    ,m_iType(tpDBL)
-    ,m_bAllowOpti(a_bAllowOpti)
-  {}
-
-  //---------------------------------------------------------------------------
-  ParserCallback::ParserCallback(fun_type1 a_pFun, bool a_bAllowOpti, int a_iPrec, ECmdCode a_iCode)
-    :m_pFun((void*)a_pFun)
-    ,m_iArgc(1)
-    ,m_iPri(a_iPrec)
-    ,m_eOprtAsct(oaNONE)
-    ,m_iCode(a_iCode)
-    ,m_iType(tpDBL)
-    ,m_bAllowOpti(a_bAllowOpti)
-  {}
-
-
-  //---------------------------------------------------------------------------
-  /** \brief Constructor for constructing function callbacks taking two arguments. 
-      \throw nothrow
-  */
-  ParserCallback::ParserCallback(fun_type2 a_pFun, bool a_bAllowOpti)
-    :m_pFun((void*)a_pFun)
-    ,m_iArgc(2)
-    ,m_iPri(-1)
-    ,m_eOprtAsct(oaNONE)
-    ,m_iCode(cmFUNC)
-    ,m_iType(tpDBL)
-    ,m_bAllowOpti(a_bAllowOpti)
-  {}
-
-  //---------------------------------------------------------------------------
-  /** \brief Constructor for constructing binary operator callbacks. 
-      \param a_pFun Pointer to a static function taking two arguments
-      \param a_bAllowOpti A flag indicating this function can be optimized
-      \param a_iPrec The operator precedence
-      \param a_eOprtAsct The operators associativity
-      \throw nothrow
-  */
-  ParserCallback::ParserCallback(fun_type2 a_pFun, 
-                                 bool a_bAllowOpti, 
-                                 int a_iPrec, 
-                                 EOprtAssociativity a_eOprtAsct)
-    :m_pFun((void*)a_pFun)
-    ,m_iArgc(2)
-    ,m_iPri(a_iPrec)
-    ,m_eOprtAsct(a_eOprtAsct)
-    ,m_iCode(cmOPRT_BIN)
-    ,m_iType(tpDBL)
-    ,m_bAllowOpti(a_bAllowOpti)
-  {}
-
-  //---------------------------------------------------------------------------
-  ParserCallback::ParserCallback(fun_type3 a_pFun, bool a_bAllowOpti)
-    :m_pFun((void*)a_pFun)
-    ,m_iArgc(3)
-    ,m_iPri(-1)
-    ,m_eOprtAsct(oaNONE)
-    ,m_iCode(cmFUNC)
-    ,m_iType(tpDBL)
-    ,m_bAllowOpti(a_bAllowOpti)
-  {}
-
-
-  //---------------------------------------------------------------------------
-  ParserCallback::ParserCallback(fun_type4 a_pFun, bool a_bAllowOpti)
-    :m_pFun((void*)a_pFun)
-    ,m_iArgc(4)
-    ,m_iPri(-1)
-    ,m_eOprtAsct(oaNONE)
-    ,m_iCode(cmFUNC)
-    ,m_iType(tpDBL)
-    ,m_bAllowOpti(a_bAllowOpti)
-  {}
-
-
-  //---------------------------------------------------------------------------
-  ParserCallback::ParserCallback(fun_type5 a_pFun, bool a_bAllowOpti)
-    :m_pFun((void*)a_pFun)
-    ,m_iArgc(5)
-    ,m_iPri(-1)
-    ,m_eOprtAsct(oaNONE)
-    ,m_iCode(cmFUNC)
-    ,m_iType(tpDBL)
-    ,m_bAllowOpti(a_bAllowOpti)
-  {}
-
-  //---------------------------------------------------------------------------
-  ParserCallback::ParserCallback(fun_type6 a_pFun, bool a_bAllowOpti)
-    :m_pFun((void*)a_pFun)
-    ,m_iArgc(6)
-    ,m_iPri(-1)
-    ,m_eOprtAsct(oaNONE)
-    ,m_iCode(cmFUNC)
-    ,m_iType(tpDBL)
-    ,m_bAllowOpti(a_bAllowOpti)
-  {}
-
-  //---------------------------------------------------------------------------
-  ParserCallback::ParserCallback(fun_type7 a_pFun, bool a_bAllowOpti)
-    :m_pFun((void*)a_pFun)
-    ,m_iArgc(7)
-    ,m_iPri(-1)
-    ,m_eOprtAsct(oaNONE)
-    ,m_iCode(cmFUNC)
-    ,m_iType(tpDBL)
-    ,m_bAllowOpti(a_bAllowOpti)
-  {}
-
-  //---------------------------------------------------------------------------
-  ParserCallback::ParserCallback(fun_type8 a_pFun, bool a_bAllowOpti)
-    :m_pFun((void*)a_pFun)
-    ,m_iArgc(8)
-    ,m_iPri(-1)
-    ,m_eOprtAsct(oaNONE)
-    ,m_iCode(cmFUNC)
-    ,m_iType(tpDBL)
-    ,m_bAllowOpti(a_bAllowOpti)
-  {}
-
-  //---------------------------------------------------------------------------
-  ParserCallback::ParserCallback(fun_type9 a_pFun, bool a_bAllowOpti)
-    :m_pFun((void*)a_pFun)
-    ,m_iArgc(9)
-    ,m_iPri(-1)
-    ,m_eOprtAsct(oaNONE)
-    ,m_iCode(cmFUNC)
-    ,m_iType(tpDBL)
-    ,m_bAllowOpti(a_bAllowOpti)
-  {}
-
-  //---------------------------------------------------------------------------
-  ParserCallback::ParserCallback(fun_type10 a_pFun, bool a_bAllowOpti)
-    :m_pFun((void*)a_pFun)
-    ,m_iArgc(10)
-    ,m_iPri(-1)
-    ,m_eOprtAsct(oaNONE)
-    ,m_iCode(cmFUNC)
-    ,m_iType(tpDBL)
-    ,m_bAllowOpti(a_bAllowOpti)
-  {}
-
-  //---------------------------------------------------------------------------
-  ParserCallback::ParserCallback(bulkfun_type0 a_pFun, bool a_bAllowOpti)
-    :m_pFun((void*)a_pFun)
-    ,m_iArgc(0)
-    ,m_iPri(-1)
-    ,m_eOprtAsct(oaNONE)
-    ,m_iCode(cmFUNC_BULK)
-    ,m_iType(tpDBL)
-    ,m_bAllowOpti(a_bAllowOpti)
-  {}
-
-  //---------------------------------------------------------------------------
-  ParserCallback::ParserCallback(bulkfun_type1 a_pFun, bool a_bAllowOpti)
-    :m_pFun((void*)a_pFun)
-    ,m_iArgc(1)
-    ,m_iPri(-1)
-    ,m_eOprtAsct(oaNONE)
-    ,m_iCode(cmFUNC_BULK)
-    ,m_iType(tpDBL)
-    ,m_bAllowOpti(a_bAllowOpti)
-  {}
-
-
-  //---------------------------------------------------------------------------
-  /** \brief Constructor for constructing function callbacks taking two arguments. 
-      \throw nothrow
-  */
-  ParserCallback::ParserCallback(bulkfun_type2 a_pFun, bool a_bAllowOpti)
-    :m_pFun((void*)a_pFun)
-    ,m_iArgc(2)
-    ,m_iPri(-1)
-    ,m_eOprtAsct(oaNONE)
-    ,m_iCode(cmFUNC_BULK)
-    ,m_iType(tpDBL)
-    ,m_bAllowOpti(a_bAllowOpti)
-  {}
-
-  //---------------------------------------------------------------------------
-  ParserCallback::ParserCallback(bulkfun_type3 a_pFun, bool a_bAllowOpti)
-    :m_pFun((void*)a_pFun)
-    ,m_iArgc(3)
-    ,m_iPri(-1)
-    ,m_eOprtAsct(oaNONE)
-    ,m_iCode(cmFUNC_BULK)
-    ,m_iType(tpDBL)
-    ,m_bAllowOpti(a_bAllowOpti)
-  {}
-
-
-  //---------------------------------------------------------------------------
-  ParserCallback::ParserCallback(bulkfun_type4 a_pFun, bool a_bAllowOpti)
-    :m_pFun((void*)a_pFun)
-    ,m_iArgc(4)
-    ,m_iPri(-1)
-    ,m_eOprtAsct(oaNONE)
-    ,m_iCode(cmFUNC_BULK)
-    ,m_iType(tpDBL)
-    ,m_bAllowOpti(a_bAllowOpti)
-  {}
-
-
-  //---------------------------------------------------------------------------
-  ParserCallback::ParserCallback(bulkfun_type5 a_pFun, bool a_bAllowOpti)
-    :m_pFun((void*)a_pFun)
-    ,m_iArgc(5)
-    ,m_iPri(-1)
-    ,m_eOprtAsct(oaNONE)
-    ,m_iCode(cmFUNC_BULK)
-    ,m_iType(tpDBL)
-    ,m_bAllowOpti(a_bAllowOpti)
-  {}
-
-  //---------------------------------------------------------------------------
-  ParserCallback::ParserCallback(bulkfun_type6 a_pFun, bool a_bAllowOpti)
-    :m_pFun((void*)a_pFun)
-    ,m_iArgc(6)
-    ,m_iPri(-1)
-    ,m_eOprtAsct(oaNONE)
-    ,m_iCode(cmFUNC_BULK)
-    ,m_iType(tpDBL)
-    ,m_bAllowOpti(a_bAllowOpti)
-  {}
-
-  //---------------------------------------------------------------------------
-  ParserCallback::ParserCallback(bulkfun_type7 a_pFun, bool a_bAllowOpti)
-    :m_pFun((void*)a_pFun)
-    ,m_iArgc(7)
-    ,m_iPri(-1)
-    ,m_eOprtAsct(oaNONE)
-    ,m_iCode(cmFUNC_BULK)
-    ,m_iType(tpDBL)
-    ,m_bAllowOpti(a_bAllowOpti)
-  {}
-
-  //---------------------------------------------------------------------------
-  ParserCallback::ParserCallback(bulkfun_type8 a_pFun, bool a_bAllowOpti)
-    :m_pFun((void*)a_pFun)
-    ,m_iArgc(8)
-    ,m_iPri(-1)
-    ,m_eOprtAsct(oaNONE)
-    ,m_iCode(cmFUNC_BULK)
-    ,m_iType(tpDBL)
-    ,m_bAllowOpti(a_bAllowOpti)
-  {}
-
-  //---------------------------------------------------------------------------
-  ParserCallback::ParserCallback(bulkfun_type9 a_pFun, bool a_bAllowOpti)
-    :m_pFun((void*)a_pFun)
-    ,m_iArgc(9)
-    ,m_iPri(-1)
-    ,m_eOprtAsct(oaNONE)
-    ,m_iCode(cmFUNC_BULK)
-    ,m_iType(tpDBL)
-    ,m_bAllowOpti(a_bAllowOpti)
-  {}
-
-  //---------------------------------------------------------------------------
-  ParserCallback::ParserCallback(bulkfun_type10 a_pFun, bool a_bAllowOpti)
-    :m_pFun((void*)a_pFun)
-    ,m_iArgc(10)
-    ,m_iPri(-1)
-    ,m_eOprtAsct(oaNONE)
-    ,m_iCode(cmFUNC_BULK)
-    ,m_iType(tpDBL)
-    ,m_bAllowOpti(a_bAllowOpti)
-  {}
-
-
-  //---------------------------------------------------------------------------
-  ParserCallback::ParserCallback(multfun_type a_pFun, bool a_bAllowOpti)
-    :m_pFun((void*)a_pFun)
-    ,m_iArgc(-1)
-    ,m_iPri(-1)
-    ,m_eOprtAsct(oaNONE)
-    ,m_iCode(cmFUNC)
-    ,m_iType(tpDBL)
-    ,m_bAllowOpti(a_bAllowOpti)
-  {}
-
-
-  //---------------------------------------------------------------------------
-  ParserCallback::ParserCallback(strfun_type1 a_pFun, bool a_bAllowOpti)
-    :m_pFun((void*)a_pFun)
-    ,m_iArgc(0)
-    ,m_iPri(-1)
-    ,m_eOprtAsct(oaNONE)
-    ,m_iCode(cmFUNC_STR)
-    ,m_iType(tpSTR)
-    ,m_bAllowOpti(a_bAllowOpti)
-  {}
-
-
-  //---------------------------------------------------------------------------
-  ParserCallback::ParserCallback(strfun_type2 a_pFun, bool a_bAllowOpti)
-    :m_pFun((void*)a_pFun)
-    ,m_iArgc(1)
-    ,m_iPri(-1)
-    ,m_eOprtAsct(oaNONE)
-    ,m_iCode(cmFUNC_STR)
-    ,m_iType(tpSTR)
-    ,m_bAllowOpti(a_bAllowOpti)
-  {}
-
-
-  //---------------------------------------------------------------------------
-  ParserCallback::ParserCallback(strfun_type3 a_pFun, bool a_bAllowOpti)
-    :m_pFun((void*)a_pFun)
-    ,m_iArgc(2)
-    ,m_iPri(-1)
-    ,m_eOprtAsct(oaNONE)
-    ,m_iCode(cmFUNC_STR)
-    ,m_iType(tpSTR)
-    ,m_bAllowOpti(a_bAllowOpti)
-  {}
-
-
-  //---------------------------------------------------------------------------
-  /** \brief Default constructor. 
-      \throw nothrow
-  */
-  ParserCallback::ParserCallback()
-    :m_pFun(0)
-    ,m_iArgc(0)
-    ,m_iPri(-1)
-    ,m_eOprtAsct(oaNONE)
-    ,m_iCode(cmUNKNOWN)
-    ,m_iType(tpVOID)
-    ,m_bAllowOpti(0)
-  {}
-
-
-  //---------------------------------------------------------------------------
-  /** \brief Copy constructor. 
-      \throw nothrow
-  */
-  ParserCallback::ParserCallback(const ParserCallback &ref)
-  {
-    m_pFun       = ref.m_pFun;
-    m_iArgc      = ref.m_iArgc;
-    m_bAllowOpti = ref.m_bAllowOpti;
-    m_iCode      = ref.m_iCode;
-    m_iType      = ref.m_iType;
-    m_iPri       = ref.m_iPri;
-    m_eOprtAsct  = ref.m_eOprtAsct;
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Clone this instance and return a pointer to the new instance. */
-  ParserCallback* ParserCallback::Clone() const
-  {
-    return new ParserCallback(*this);
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Return tru if the function is conservative.
-
-      Conservative functions return always the same result for the same argument.
-      \throw nothrow
-  */
-  bool ParserCallback::IsOptimizable() const  
-  { 
-    return m_bAllowOpti; 
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Get the callback address for the parser function. 
-  
-      The type of the address is void. It needs to be recasted according to the
-      argument number to the right type.
-
-      \throw nothrow
-      \return #pFun
-  */
-  void* ParserCallback::GetAddr() const 
-  { 
-    return m_pFun;  
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Return the callback code. */
-  ECmdCode  ParserCallback::GetCode() const 
-  { 
-    return m_iCode; 
-  }
-  
-  //---------------------------------------------------------------------------
-  ETypeCode ParserCallback::GetType() const 
-  { 
-    return m_iType; 
-  }
-
-
-  //---------------------------------------------------------------------------
-  /** \brief Return the operator precedence. 
-      \throw nothrown
-
-     Only valid if the callback token is an operator token (binary or infix).
-  */
-  int ParserCallback::GetPri()  const 
-  { 
-    return m_iPri;  
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Return the operators associativity. 
-      \throw nothrown
-
-     Only valid if the callback token is a binary operator token.
-  */
-  EOprtAssociativity ParserCallback::GetAssociativity() const
-  {
-    return m_eOprtAsct;
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Returns the number of function Arguments. */
-  int ParserCallback::GetArgc() const 
-  { 
-    return m_iArgc; 
-  }
-} // namespace mu
+/*
+                 __________
+    _____   __ __\______   \_____  _______  ______  ____ _______
+   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
+  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
+  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|
+        \/                       \/            \/      \/
+  Copyright (C) 2004-2011 Ingo Berg
+
+  Permission is hereby granted, free of charge, to any person obtaining a copy of this
+  software and associated documentation files (the "Software"), to deal in the Software
+  without restriction, including without limitation the rights to use, copy, modify,
+  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
+  permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included in all copies or
+  substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
+  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include "muParserCallback.h"
+
+/** \file
+    \brief Implementation of the parser callback class.
+*/
+
+
+namespace mu
+{
+  //---------------------------------------------------------------------------
+  ParserCallback::ParserCallback(fun_type0 a_pFun, bool a_bAllowOpti)
+    :m_pFun((void*)a_pFun)
+    ,m_iArgc(0)
+    ,m_iPri(-1)
+    ,m_eOprtAsct(oaNONE)
+    ,m_iCode(cmFUNC)
+    ,m_iType(tpDBL)
+    ,m_bAllowOpti(a_bAllowOpti)
+  {}
+
+  //---------------------------------------------------------------------------
+  ParserCallback::ParserCallback(fun_type1 a_pFun, bool a_bAllowOpti, int a_iPrec, ECmdCode a_iCode)
+    :m_pFun((void*)a_pFun)
+    ,m_iArgc(1)
+    ,m_iPri(a_iPrec)
+    ,m_eOprtAsct(oaNONE)
+    ,m_iCode(a_iCode)
+    ,m_iType(tpDBL)
+    ,m_bAllowOpti(a_bAllowOpti)
+  {}
+
+
+  //---------------------------------------------------------------------------
+  /** \brief Constructor for constructing function callbacks taking two arguments.
+      \throw nothrow
+  */
+  ParserCallback::ParserCallback(fun_type2 a_pFun, bool a_bAllowOpti)
+    :m_pFun((void*)a_pFun)
+    ,m_iArgc(2)
+    ,m_iPri(-1)
+    ,m_eOprtAsct(oaNONE)
+    ,m_iCode(cmFUNC)
+    ,m_iType(tpDBL)
+    ,m_bAllowOpti(a_bAllowOpti)
+  {}
+
+  //---------------------------------------------------------------------------
+  /** \brief Constructor for constructing binary operator callbacks.
+      \param a_pFun Pointer to a static function taking two arguments
+      \param a_bAllowOpti A flag indicating this function can be optimized
+      \param a_iPrec The operator precedence
+      \param a_eOprtAsct The operators associativity
+      \throw nothrow
+  */
+  ParserCallback::ParserCallback(fun_type2 a_pFun,
+                                 bool a_bAllowOpti,
+                                 int a_iPrec,
+                                 EOprtAssociativity a_eOprtAsct)
+    :m_pFun((void*)a_pFun)
+    ,m_iArgc(2)
+    ,m_iPri(a_iPrec)
+    ,m_eOprtAsct(a_eOprtAsct)
+    ,m_iCode(cmOPRT_BIN)
+    ,m_iType(tpDBL)
+    ,m_bAllowOpti(a_bAllowOpti)
+  {}
+
+  //---------------------------------------------------------------------------
+  ParserCallback::ParserCallback(fun_type3 a_pFun, bool a_bAllowOpti)
+    :m_pFun((void*)a_pFun)
+    ,m_iArgc(3)
+    ,m_iPri(-1)
+    ,m_eOprtAsct(oaNONE)
+    ,m_iCode(cmFUNC)
+    ,m_iType(tpDBL)
+    ,m_bAllowOpti(a_bAllowOpti)
+  {}
+
+
+  //---------------------------------------------------------------------------
+  ParserCallback::ParserCallback(fun_type4 a_pFun, bool a_bAllowOpti)
+    :m_pFun((void*)a_pFun)
+    ,m_iArgc(4)
+    ,m_iPri(-1)
+    ,m_eOprtAsct(oaNONE)
+    ,m_iCode(cmFUNC)
+    ,m_iType(tpDBL)
+    ,m_bAllowOpti(a_bAllowOpti)
+  {}
+
+
+  //---------------------------------------------------------------------------
+  ParserCallback::ParserCallback(fun_type5 a_pFun, bool a_bAllowOpti)
+    :m_pFun((void*)a_pFun)
+    ,m_iArgc(5)
+    ,m_iPri(-1)
+    ,m_eOprtAsct(oaNONE)
+    ,m_iCode(cmFUNC)
+    ,m_iType(tpDBL)
+    ,m_bAllowOpti(a_bAllowOpti)
+  {}
+
+  //---------------------------------------------------------------------------
+  ParserCallback::ParserCallback(fun_type6 a_pFun, bool a_bAllowOpti)
+    :m_pFun((void*)a_pFun)
+    ,m_iArgc(6)
+    ,m_iPri(-1)
+    ,m_eOprtAsct(oaNONE)
+    ,m_iCode(cmFUNC)
+    ,m_iType(tpDBL)
+    ,m_bAllowOpti(a_bAllowOpti)
+  {}
+
+  //---------------------------------------------------------------------------
+  ParserCallback::ParserCallback(fun_type7 a_pFun, bool a_bAllowOpti)
+    :m_pFun((void*)a_pFun)
+    ,m_iArgc(7)
+    ,m_iPri(-1)
+    ,m_eOprtAsct(oaNONE)
+    ,m_iCode(cmFUNC)
+    ,m_iType(tpDBL)
+    ,m_bAllowOpti(a_bAllowOpti)
+  {}
+
+  //---------------------------------------------------------------------------
+  ParserCallback::ParserCallback(fun_type8 a_pFun, bool a_bAllowOpti)
+    :m_pFun((void*)a_pFun)
+    ,m_iArgc(8)
+    ,m_iPri(-1)
+    ,m_eOprtAsct(oaNONE)
+    ,m_iCode(cmFUNC)
+    ,m_iType(tpDBL)
+    ,m_bAllowOpti(a_bAllowOpti)
+  {}
+
+  //---------------------------------------------------------------------------
+  ParserCallback::ParserCallback(fun_type9 a_pFun, bool a_bAllowOpti)
+    :m_pFun((void*)a_pFun)
+    ,m_iArgc(9)
+    ,m_iPri(-1)
+    ,m_eOprtAsct(oaNONE)
+    ,m_iCode(cmFUNC)
+    ,m_iType(tpDBL)
+    ,m_bAllowOpti(a_bAllowOpti)
+  {}
+
+  //---------------------------------------------------------------------------
+  ParserCallback::ParserCallback(fun_type10 a_pFun, bool a_bAllowOpti)
+    :m_pFun((void*)a_pFun)
+    ,m_iArgc(10)
+    ,m_iPri(-1)
+    ,m_eOprtAsct(oaNONE)
+    ,m_iCode(cmFUNC)
+    ,m_iType(tpDBL)
+    ,m_bAllowOpti(a_bAllowOpti)
+  {}
+
+  //---------------------------------------------------------------------------
+  ParserCallback::ParserCallback(bulkfun_type0 a_pFun, bool a_bAllowOpti)
+    :m_pFun((void*)a_pFun)
+    ,m_iArgc(0)
+    ,m_iPri(-1)
+    ,m_eOprtAsct(oaNONE)
+    ,m_iCode(cmFUNC_BULK)
+    ,m_iType(tpDBL)
+    ,m_bAllowOpti(a_bAllowOpti)
+  {}
+
+  //---------------------------------------------------------------------------
+  ParserCallback::ParserCallback(bulkfun_type1 a_pFun, bool a_bAllowOpti)
+    :m_pFun((void*)a_pFun)
+    ,m_iArgc(1)
+    ,m_iPri(-1)
+    ,m_eOprtAsct(oaNONE)
+    ,m_iCode(cmFUNC_BULK)
+    ,m_iType(tpDBL)
+    ,m_bAllowOpti(a_bAllowOpti)
+  {}
+
+
+  //---------------------------------------------------------------------------
+  /** \brief Constructor for constructing function callbacks taking two arguments.
+      \throw nothrow
+  */
+  ParserCallback::ParserCallback(bulkfun_type2 a_pFun, bool a_bAllowOpti)
+    :m_pFun((void*)a_pFun)
+    ,m_iArgc(2)
+    ,m_iPri(-1)
+    ,m_eOprtAsct(oaNONE)
+    ,m_iCode(cmFUNC_BULK)
+    ,m_iType(tpDBL)
+    ,m_bAllowOpti(a_bAllowOpti)
+  {}
+
+  //---------------------------------------------------------------------------
+  ParserCallback::ParserCallback(bulkfun_type3 a_pFun, bool a_bAllowOpti)
+    :m_pFun((void*)a_pFun)
+    ,m_iArgc(3)
+    ,m_iPri(-1)
+    ,m_eOprtAsct(oaNONE)
+    ,m_iCode(cmFUNC_BULK)
+    ,m_iType(tpDBL)
+    ,m_bAllowOpti(a_bAllowOpti)
+  {}
+
+
+  //---------------------------------------------------------------------------
+  ParserCallback::ParserCallback(bulkfun_type4 a_pFun, bool a_bAllowOpti)
+    :m_pFun((void*)a_pFun)
+    ,m_iArgc(4)
+    ,m_iPri(-1)
+    ,m_eOprtAsct(oaNONE)
+    ,m_iCode(cmFUNC_BULK)
+    ,m_iType(tpDBL)
+    ,m_bAllowOpti(a_bAllowOpti)
+  {}
+
+
+  //---------------------------------------------------------------------------
+  ParserCallback::ParserCallback(bulkfun_type5 a_pFun, bool a_bAllowOpti)
+    :m_pFun((void*)a_pFun)
+    ,m_iArgc(5)
+    ,m_iPri(-1)
+    ,m_eOprtAsct(oaNONE)
+    ,m_iCode(cmFUNC_BULK)
+    ,m_iType(tpDBL)
+    ,m_bAllowOpti(a_bAllowOpti)
+  {}
+
+  //---------------------------------------------------------------------------
+  ParserCallback::ParserCallback(bulkfun_type6 a_pFun, bool a_bAllowOpti)
+    :m_pFun((void*)a_pFun)
+    ,m_iArgc(6)
+    ,m_iPri(-1)
+    ,m_eOprtAsct(oaNONE)
+    ,m_iCode(cmFUNC_BULK)
+    ,m_iType(tpDBL)
+    ,m_bAllowOpti(a_bAllowOpti)
+  {}
+
+  //---------------------------------------------------------------------------
+  ParserCallback::ParserCallback(bulkfun_type7 a_pFun, bool a_bAllowOpti)
+    :m_pFun((void*)a_pFun)
+    ,m_iArgc(7)
+    ,m_iPri(-1)
+    ,m_eOprtAsct(oaNONE)
+    ,m_iCode(cmFUNC_BULK)
+    ,m_iType(tpDBL)
+    ,m_bAllowOpti(a_bAllowOpti)
+  {}
+
+  //---------------------------------------------------------------------------
+  ParserCallback::ParserCallback(bulkfun_type8 a_pFun, bool a_bAllowOpti)
+    :m_pFun((void*)a_pFun)
+    ,m_iArgc(8)
+    ,m_iPri(-1)
+    ,m_eOprtAsct(oaNONE)
+    ,m_iCode(cmFUNC_BULK)
+    ,m_iType(tpDBL)
+    ,m_bAllowOpti(a_bAllowOpti)
+  {}
+
+  //---------------------------------------------------------------------------
+  ParserCallback::ParserCallback(bulkfun_type9 a_pFun, bool a_bAllowOpti)
+    :m_pFun((void*)a_pFun)
+    ,m_iArgc(9)
+    ,m_iPri(-1)
+    ,m_eOprtAsct(oaNONE)
+    ,m_iCode(cmFUNC_BULK)
+    ,m_iType(tpDBL)
+    ,m_bAllowOpti(a_bAllowOpti)
+  {}
+
+  //---------------------------------------------------------------------------
+  ParserCallback::ParserCallback(bulkfun_type10 a_pFun, bool a_bAllowOpti)
+    :m_pFun((void*)a_pFun)
+    ,m_iArgc(10)
+    ,m_iPri(-1)
+    ,m_eOprtAsct(oaNONE)
+    ,m_iCode(cmFUNC_BULK)
+    ,m_iType(tpDBL)
+    ,m_bAllowOpti(a_bAllowOpti)
+  {}
+
+
+  //---------------------------------------------------------------------------
+  ParserCallback::ParserCallback(multfun_type a_pFun, bool a_bAllowOpti)
+    :m_pFun((void*)a_pFun)
+    ,m_iArgc(-1)
+    ,m_iPri(-1)
+    ,m_eOprtAsct(oaNONE)
+    ,m_iCode(cmFUNC)
+    ,m_iType(tpDBL)
+    ,m_bAllowOpti(a_bAllowOpti)
+  {}
+
+
+  //---------------------------------------------------------------------------
+  ParserCallback::ParserCallback(strfun_type1 a_pFun, bool a_bAllowOpti)
+    :m_pFun((void*)a_pFun)
+    ,m_iArgc(0)
+    ,m_iPri(-1)
+    ,m_eOprtAsct(oaNONE)
+    ,m_iCode(cmFUNC_STR)
+    ,m_iType(tpSTR)
+    ,m_bAllowOpti(a_bAllowOpti)
+  {}
+
+
+  //---------------------------------------------------------------------------
+  ParserCallback::ParserCallback(strfun_type2 a_pFun, bool a_bAllowOpti)
+    :m_pFun((void*)a_pFun)
+    ,m_iArgc(1)
+    ,m_iPri(-1)
+    ,m_eOprtAsct(oaNONE)
+    ,m_iCode(cmFUNC_STR)
+    ,m_iType(tpSTR)
+    ,m_bAllowOpti(a_bAllowOpti)
+  {}
+
+
+  //---------------------------------------------------------------------------
+  ParserCallback::ParserCallback(strfun_type3 a_pFun, bool a_bAllowOpti)
+    :m_pFun((void*)a_pFun)
+    ,m_iArgc(2)
+    ,m_iPri(-1)
+    ,m_eOprtAsct(oaNONE)
+    ,m_iCode(cmFUNC_STR)
+    ,m_iType(tpSTR)
+    ,m_bAllowOpti(a_bAllowOpti)
+  {}
+
+
+  //---------------------------------------------------------------------------
+  /** \brief Default constructor.
+      \throw nothrow
+  */
+  ParserCallback::ParserCallback()
+    :m_pFun(0)
+    ,m_iArgc(0)
+    ,m_iPri(-1)
+    ,m_eOprtAsct(oaNONE)
+    ,m_iCode(cmUNKNOWN)
+    ,m_iType(tpVOID)
+    ,m_bAllowOpti(0)
+  {}
+
+
+  //---------------------------------------------------------------------------
+  /** \brief Copy constructor.
+      \throw nothrow
+  */
+  ParserCallback::ParserCallback(const ParserCallback &ref)
+  {
+    m_pFun       = ref.m_pFun;
+    m_iArgc      = ref.m_iArgc;
+    m_bAllowOpti = ref.m_bAllowOpti;
+    m_iCode      = ref.m_iCode;
+    m_iType      = ref.m_iType;
+    m_iPri       = ref.m_iPri;
+    m_eOprtAsct  = ref.m_eOprtAsct;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Clone this instance and return a pointer to the new instance. */
+  ParserCallback* ParserCallback::Clone() const
+  {
+    return new ParserCallback(*this);
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Return tru if the function is conservative.
+
+      Conservative functions return always the same result for the same argument.
+      \throw nothrow
+  */
+  bool ParserCallback::IsOptimizable() const
+  {
+    return m_bAllowOpti;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Get the callback address for the parser function.
+
+      The type of the address is void. It needs to be recasted according to the
+      argument number to the right type.
+
+      \throw nothrow
+      \return #pFun
+  */
+  void* ParserCallback::GetAddr() const
+  {
+    return m_pFun;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Return the callback code. */
+  ECmdCode  ParserCallback::GetCode() const
+  {
+    return m_iCode;
+  }
+
+  //---------------------------------------------------------------------------
+  ETypeCode ParserCallback::GetType() const
+  {
+    return m_iType;
+  }
+
+
+  //---------------------------------------------------------------------------
+  /** \brief Return the operator precedence.
+      \throw nothrown
+
+     Only valid if the callback token is an operator token (binary or infix).
+  */
+  int ParserCallback::GetPri()  const
+  {
+    return m_iPri;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Return the operators associativity.
+      \throw nothrown
+
+     Only valid if the callback token is a binary operator token.
+  */
+  EOprtAssociativity ParserCallback::GetAssociativity() const
+  {
+    return m_eOprtAsct;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Returns the number of function Arguments. */
+  int ParserCallback::GetArgc() const
+  {
+    return m_iArgc;
+  }
+} // namespace mu
diff --git a/geometry/qmuparser/muParserCallback.h b/geometry/qmuparser/muParserCallback.h
old mode 100755
new mode 100644
index ef32b49..9ecd61a
--- a/geometry/qmuparser/muParserCallback.h
+++ b/geometry/qmuparser/muParserCallback.h
@@ -1,118 +1,118 @@
-/*
-                 __________                                      
-    _____   __ __\______   \_____  _______  ______  ____ _______ 
-   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
-  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
-  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|   
-        \/                       \/            \/      \/        
-  Copyright (C) 2004-2011 Ingo Berg
-
-  Permission is hereby granted, free of charge, to any person obtaining a copy of this 
-  software and associated documentation files (the "Software"), to deal in the Software
-  without restriction, including without limitation the rights to use, copy, modify, 
-  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 
-  permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-  The above copyright notice and this permission notice shall be included in all copies or 
-  substantial portions of the Software.
-
-  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
-  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
-  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
-  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
-  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
-*/
-
-#ifndef MU_PARSER_CALLBACK_H
-#define MU_PARSER_CALLBACK_H
-
-#include "muParserDef.h"
-
-/** \file
-    \brief Definition of the parser callback class.
-*/
-
-namespace mu
-{
-
-/** \brief Encapsulation of prototypes for a numerical parser function.
-
-    Encapsulates the prototyp for numerical parser functions. The class
-    stores the number of arguments for parser functions as well
-    as additional flags indication the function is non optimizeable.
-    The pointer to the callback function pointer is stored as void* 
-    and needs to be casted according to the argument count.
-    Negative argument counts indicate a parser function with a variable number
-    of arguments. 
-
-    \author (C) 2004-2011 Ingo Berg
-*/
-class ParserCallback
-{
-public:
-    ParserCallback(fun_type0  a_pFun, bool a_bAllowOpti);
-    ParserCallback(fun_type1  a_pFun, bool a_bAllowOpti, int a_iPrec = -1, ECmdCode a_iCode=cmFUNC);
-    ParserCallback(fun_type2  a_pFun, bool a_bAllowOpti, int a_iPrec, EOprtAssociativity a_eAssociativity);
-    ParserCallback(fun_type2  a_pFun, bool a_bAllowOpti);
-    ParserCallback(fun_type3  a_pFun, bool a_bAllowOpti);
-    ParserCallback(fun_type4  a_pFun, bool a_bAllowOpti);
-    ParserCallback(fun_type5  a_pFun, bool a_bAllowOpti);
-    ParserCallback(fun_type6  a_pFun, bool a_bAllowOpti);
-    ParserCallback(fun_type7  a_pFun, bool a_bAllowOpti);
-    ParserCallback(fun_type8  a_pFun, bool a_bAllowOpti);
-    ParserCallback(fun_type9  a_pFun, bool a_bAllowOpti);
-    ParserCallback(fun_type10 a_pFun, bool a_bAllowOpti);
-
-    ParserCallback(bulkfun_type0  a_pFun, bool a_bAllowOpti);
-    ParserCallback(bulkfun_type1  a_pFun, bool a_bAllowOpti);
-    ParserCallback(bulkfun_type2  a_pFun, bool a_bAllowOpti);
-    ParserCallback(bulkfun_type3  a_pFun, bool a_bAllowOpti);
-    ParserCallback(bulkfun_type4  a_pFun, bool a_bAllowOpti);
-    ParserCallback(bulkfun_type5  a_pFun, bool a_bAllowOpti);
-    ParserCallback(bulkfun_type6  a_pFun, bool a_bAllowOpti);
-    ParserCallback(bulkfun_type7  a_pFun, bool a_bAllowOpti);
-    ParserCallback(bulkfun_type8  a_pFun, bool a_bAllowOpti);
-    ParserCallback(bulkfun_type9  a_pFun, bool a_bAllowOpti);
-    ParserCallback(bulkfun_type10 a_pFun, bool a_bAllowOpti);
-
-    ParserCallback(multfun_type a_pFun, bool a_bAllowOpti);
-    ParserCallback(strfun_type1 a_pFun, bool a_bAllowOpti);
-    ParserCallback(strfun_type2 a_pFun, bool a_bAllowOpti);
-    ParserCallback(strfun_type3 a_pFun, bool a_bAllowOpti);
-    ParserCallback();
-    ParserCallback(const ParserCallback &a_Fun);
-    
-    ParserCallback* Clone() const;
-
-    bool  IsOptimizable() const;
-    void* GetAddr() const;
-    ECmdCode  GetCode() const;
-    ETypeCode GetType() const;
-    int GetPri()  const;
-    EOprtAssociativity GetAssociativity() const;
-    int GetArgc() const;
-
-private:
-    void *m_pFun;                   ///< Pointer to the callback function, casted to void
-    
-    /** \brief Number of numeric function arguments
-    
-        This number is negative for functions with variable number of arguments. in this cases
-        they represent the actual number of arguments found.
-    */
-    int   m_iArgc;      
-    int   m_iPri;                   ///< Valid only for binary and infix operators; Operator precedence.
-    EOprtAssociativity m_eOprtAsct; ///< Operator associativity; Valid only for binary operators 
-    ECmdCode  m_iCode;
-    ETypeCode m_iType;
-    bool  m_bAllowOpti;             ///< Flag indication optimizeability 
-};
-
-//------------------------------------------------------------------------------
-/** \brief Container for Callback objects. */
-typedef std::map<string_type, ParserCallback> funmap_type; 
-
-} // namespace mu
-
-#endif
-
+/*
+                 __________
+    _____   __ __\______   \_____  _______  ______  ____ _______
+   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
+  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
+  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|
+        \/                       \/            \/      \/
+  Copyright (C) 2004-2011 Ingo Berg
+
+  Permission is hereby granted, free of charge, to any person obtaining a copy of this
+  software and associated documentation files (the "Software"), to deal in the Software
+  without restriction, including without limitation the rights to use, copy, modify,
+  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
+  permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included in all copies or
+  substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
+  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef MU_PARSER_CALLBACK_H
+#define MU_PARSER_CALLBACK_H
+
+#include "muParserDef.h"
+
+/** \file
+    \brief Definition of the parser callback class.
+*/
+
+namespace mu
+{
+
+/** \brief Encapsulation of prototypes for a numerical parser function.
+
+    Encapsulates the prototyp for numerical parser functions. The class
+    stores the number of arguments for parser functions as well
+    as additional flags indication the function is non optimizeable.
+    The pointer to the callback function pointer is stored as void*
+    and needs to be casted according to the argument count.
+    Negative argument counts indicate a parser function with a variable number
+    of arguments.
+
+    \author (C) 2004-2011 Ingo Berg
+*/
+class ParserCallback
+{
+public:
+    ParserCallback(fun_type0  a_pFun, bool a_bAllowOpti);
+    ParserCallback(fun_type1  a_pFun, bool a_bAllowOpti, int a_iPrec = -1, ECmdCode a_iCode=cmFUNC);
+    ParserCallback(fun_type2  a_pFun, bool a_bAllowOpti, int a_iPrec, EOprtAssociativity a_eAssociativity);
+    ParserCallback(fun_type2  a_pFun, bool a_bAllowOpti);
+    ParserCallback(fun_type3  a_pFun, bool a_bAllowOpti);
+    ParserCallback(fun_type4  a_pFun, bool a_bAllowOpti);
+    ParserCallback(fun_type5  a_pFun, bool a_bAllowOpti);
+    ParserCallback(fun_type6  a_pFun, bool a_bAllowOpti);
+    ParserCallback(fun_type7  a_pFun, bool a_bAllowOpti);
+    ParserCallback(fun_type8  a_pFun, bool a_bAllowOpti);
+    ParserCallback(fun_type9  a_pFun, bool a_bAllowOpti);
+    ParserCallback(fun_type10 a_pFun, bool a_bAllowOpti);
+
+    ParserCallback(bulkfun_type0  a_pFun, bool a_bAllowOpti);
+    ParserCallback(bulkfun_type1  a_pFun, bool a_bAllowOpti);
+    ParserCallback(bulkfun_type2  a_pFun, bool a_bAllowOpti);
+    ParserCallback(bulkfun_type3  a_pFun, bool a_bAllowOpti);
+    ParserCallback(bulkfun_type4  a_pFun, bool a_bAllowOpti);
+    ParserCallback(bulkfun_type5  a_pFun, bool a_bAllowOpti);
+    ParserCallback(bulkfun_type6  a_pFun, bool a_bAllowOpti);
+    ParserCallback(bulkfun_type7  a_pFun, bool a_bAllowOpti);
+    ParserCallback(bulkfun_type8  a_pFun, bool a_bAllowOpti);
+    ParserCallback(bulkfun_type9  a_pFun, bool a_bAllowOpti);
+    ParserCallback(bulkfun_type10 a_pFun, bool a_bAllowOpti);
+
+    ParserCallback(multfun_type a_pFun, bool a_bAllowOpti);
+    ParserCallback(strfun_type1 a_pFun, bool a_bAllowOpti);
+    ParserCallback(strfun_type2 a_pFun, bool a_bAllowOpti);
+    ParserCallback(strfun_type3 a_pFun, bool a_bAllowOpti);
+    ParserCallback();
+    ParserCallback(const ParserCallback &a_Fun);
+
+    ParserCallback* Clone() const;
+
+    bool  IsOptimizable() const;
+    void* GetAddr() const;
+    ECmdCode  GetCode() const;
+    ETypeCode GetType() const;
+    int GetPri()  const;
+    EOprtAssociativity GetAssociativity() const;
+    int GetArgc() const;
+
+private:
+    void *m_pFun;                   ///< Pointer to the callback function, casted to void
+
+    /** \brief Number of numeric function arguments
+
+        This number is negative for functions with variable number of arguments. in this cases
+        they represent the actual number of arguments found.
+    */
+    int   m_iArgc;
+    int   m_iPri;                   ///< Valid only for binary and infix operators; Operator precedence.
+    EOprtAssociativity m_eOprtAsct; ///< Operator associativity; Valid only for binary operators
+    ECmdCode  m_iCode;
+    ETypeCode m_iType;
+    bool  m_bAllowOpti;             ///< Flag indication optimizeability
+};
+
+//------------------------------------------------------------------------------
+/** \brief Container for Callback objects. */
+typedef std::map<string_type, ParserCallback> funmap_type;
+
+} // namespace mu
+
+#endif
+
diff --git a/geometry/qmuparser/muParserDLL.cpp b/geometry/qmuparser/muParserDLL.cpp
old mode 100755
new mode 100644
index 15c8800..d91a158
--- a/geometry/qmuparser/muParserDLL.cpp
+++ b/geometry/qmuparser/muParserDLL.cpp
@@ -1,1096 +1,1096 @@
-/*
-                 __________
-                 _____   __ __\______   \_____  _______  ______  ____ _______
-                 /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
-                 |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
-                 |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|
-                 \/                       \/            \/      \/
-                 Copyright (C) 2004-2011 Ingo Berg
-
-                 Permission is hereby granted, free of charge, to any person obtaining a copy of this
-                 software and associated documentation files (the "Software"), to deal in the Software
-                 without restriction, including without limitation the rights to use, copy, modify,
-                 merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
-                 permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-                 The above copyright notice and this permission notice shall be included in all copies or
-                 substantial portions of the Software.
-
-                 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
-                 NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-                 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-                 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-                 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-                 */
-#if defined(MUPARSER_DLL) 
-
-#if defined(_WIN32)
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#endif
-
-#include "muParserDLL.h"
-#include "muParser.h"
-#include "muParserInt.h"
-#include "muParserError.h"
-
-
-#define MU_TRY  \
-    try     \
-        {
-
-#define MU_CATCH                                                 \
-        }                                                        \
-        catch (muError_t &e)                                      \
-        {                                                        \
-        ParserTag *pTag = static_cast<ParserTag*>(a_hParser);  \
-        pTag->exc = e;                                         \
-        pTag->bError = true;                                   \
-if (pTag->errHandler)                                  \
-    (pTag->errHandler)(a_hParser);                       \
-        }                                                        \
-        catch (...)                                               \
-        {                                                        \
-        ParserTag *pTag = static_cast<ParserTag*>(a_hParser);  \
-        pTag->exc = muError_t(mu::ecINTERNAL_ERROR);           \
-        pTag->bError = true;                                   \
-if (pTag->errHandler)                                  \
-    (pTag->errHandler)(a_hParser);                       \
-        }
-
-/** \file
-    \brief This file contains the implementation of the DLL interface of muparser.
-    */
-
-//---------------------------------------------------------------------------
-// private types
-typedef mu::ParserBase::exception_type muError_t;
-typedef mu::ParserBase muParser_t;
-
-int g_nBulkSize;
-
-//---------------------------------------------------------------------------
-class ParserTag
-{
-public:
-    ParserTag(int nType)
-        :pParser((nType == muBASETYPE_FLOAT) ? (mu::ParserBase*)new mu::Parser() :
-        (nType == muBASETYPE_INT) ? (mu::ParserBase*)new mu::ParserInt() : NULL)
-        , exc()
-        , errHandler(NULL)
-        , bError(false)
-        , m_nParserType(nType)
-    {}
-
-    ~ParserTag()
-    {
-        delete pParser;
-    }
-
-    mu::ParserBase *pParser;
-    mu::ParserBase::exception_type exc;
-    muErrorHandler_t errHandler;
-    bool bError;
-
-private:
-    ParserTag(const ParserTag &ref);
-    ParserTag& operator=(const ParserTag &ref);
-
-    int m_nParserType;
-};
-
-static muChar_t s_tmpOutBuf[2048];
-
-//---------------------------------------------------------------------------
-//
-//
-//  unexported functions
-//
-//
-//---------------------------------------------------------------------------
-
-//---------------------------------------------------------------------------
-muParser_t* AsParser(muParserHandle_t a_hParser)
-{
-    return static_cast<ParserTag*>(a_hParser)->pParser;
-}
-
-//---------------------------------------------------------------------------
-ParserTag* AsParserTag(muParserHandle_t a_hParser)
-{
-    return static_cast<ParserTag*>(a_hParser);
-}
-
-//---------------------------------------------------------------------------
-#if defined(_WIN32)
-#define _CRT_SECURE_NO_DEPRECATE
-
-BOOL APIENTRY DllMain(HANDLE /*hModule*/,
-    DWORD ul_reason_for_call,
-    LPVOID /*lpReserved*/)
-{
-    switch (ul_reason_for_call)
-    {
-    case  DLL_PROCESS_ATTACH:
-        break;
-
-    case  DLL_THREAD_ATTACH:
-    case  DLL_THREAD_DETACH:
-    case  DLL_PROCESS_DETACH:
-        break;
-    }
-
-    return TRUE;
-}
-
-#endif
-
-//---------------------------------------------------------------------------
-//
-//
-//  exported functions
-//
-//
-//---------------------------------------------------------------------------
-
-API_EXPORT(void) mupSetVarFactory(muParserHandle_t a_hParser, muFacFun_t a_pFactory, void *pUserData)
-{
-    MU_TRY
-        muParser_t* p(AsParser(a_hParser));
-    p->SetVarFactory(a_pFactory, pUserData);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-/** \brief Create a new Parser instance and return its handle.
-*/
-API_EXPORT(muParserHandle_t) mupCreate(int nBaseType)
-{
-    switch (nBaseType)
-    {
-    case  muBASETYPE_FLOAT:   return (void*)(new ParserTag(muBASETYPE_FLOAT));
-    case  muBASETYPE_INT:     return (void*)(new ParserTag(muBASETYPE_INT));
-    default:                  return NULL;
-    }
-}
-
-//---------------------------------------------------------------------------
-/** \brief Release the parser instance related with a parser handle.
-*/
-API_EXPORT(void) mupRelease(muParserHandle_t a_hParser)
-{
-    MU_TRY
-        ParserTag* p = static_cast<ParserTag*>(a_hParser);
-    delete p;
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(const muChar_t*) mupGetVersion(muParserHandle_t a_hParser)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-
-#ifndef _UNICODE
-    sprintf(s_tmpOutBuf, "%s", p->GetVersion().c_str());
-#else
-    wsprintf(s_tmpOutBuf, _T("%s"), p->GetVersion().c_str());
-#endif
-
-    return s_tmpOutBuf;
-    MU_CATCH
-
-        return _T("");
-}
-
-//---------------------------------------------------------------------------
-/** \brief Evaluate the expression.
-*/
-API_EXPORT(muFloat_t) mupEval(muParserHandle_t a_hParser)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    return p->Eval();
-    MU_CATCH
-
-        return 0;
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(muFloat_t*) mupEvalMulti(muParserHandle_t a_hParser, int *nNum)
-{
-    MU_TRY
-        assert(nNum != NULL);
-
-    muParser_t* const p(AsParser(a_hParser));
-    return p->Eval(*nNum);
-    MU_CATCH
-
-        return 0;
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupEvalBulk(muParserHandle_t a_hParser, muFloat_t *a_res, int nSize)
-{
-    MU_TRY
-        muParser_t* p(AsParser(a_hParser));
-    p->Eval(a_res, nSize);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupSetExpr(muParserHandle_t a_hParser, const muChar_t* a_szExpr)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->SetExpr(a_szExpr);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupRemoveVar(muParserHandle_t a_hParser, const muChar_t* a_szName)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->RemoveVar(a_szName);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-/** \brief Release all parser variables.
-    \param a_hParser Handle to the parser instance.
-    */
-API_EXPORT(void) mupClearVar(muParserHandle_t a_hParser)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->ClearVar();
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-/** \brief Release all parser variables.
-    \param a_hParser Handle to the parser instance.
-    */
-API_EXPORT(void) mupClearConst(muParserHandle_t a_hParser)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->ClearConst();
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-/** \brief Clear all user defined operators.
-    \param a_hParser Handle to the parser instance.
-    */
-API_EXPORT(void) mupClearOprt(muParserHandle_t a_hParser)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->ClearOprt();
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupClearFun(muParserHandle_t a_hParser)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->ClearFun();
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineFun0(muParserHandle_t a_hParser,
-    const muChar_t* a_szName,
-    muFun0_t a_pFun,
-    muBool_t a_bAllowOpt)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineFun1(muParserHandle_t a_hParser,
-    const muChar_t* a_szName,
-    muFun1_t a_pFun,
-    muBool_t a_bAllowOpt)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineFun2(muParserHandle_t a_hParser,
-    const muChar_t* a_szName,
-    muFun2_t a_pFun,
-    muBool_t a_bAllowOpt)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineFun3(muParserHandle_t a_hParser,
-    const muChar_t *a_szName,
-    muFun3_t a_pFun,
-    muBool_t a_bAllowOpt)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineFun4(muParserHandle_t a_hParser,
-    const muChar_t *a_szName,
-    muFun4_t a_pFun,
-    muBool_t a_bAllowOpt)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineFun5(muParserHandle_t a_hParser,
-    const muChar_t *a_szName,
-    muFun5_t a_pFun,
-    muBool_t a_bAllowOpt)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineFun6(muParserHandle_t a_hParser,
-    const muChar_t *a_szName,
-    muFun6_t a_pFun,
-    muBool_t a_bAllowOpt)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineFun7(muParserHandle_t a_hParser,
-    const muChar_t *a_szName,
-    muFun7_t a_pFun,
-    muBool_t a_bAllowOpt)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineFun8(muParserHandle_t a_hParser,
-    const muChar_t *a_szName,
-    muFun8_t a_pFun,
-    muBool_t a_bAllowOpt)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineFun9(muParserHandle_t a_hParser,
-    const muChar_t *a_szName,
-    muFun9_t a_pFun,
-    muBool_t a_bAllowOpt)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineFun10(muParserHandle_t a_hParser,
-    const muChar_t *a_szName,
-    muFun10_t a_pFun,
-    muBool_t a_bAllowOpt)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineBulkFun0(muParserHandle_t a_hParser,
-    const muChar_t* a_szName,
-    muBulkFun0_t a_pFun)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->DefineFun(a_szName, a_pFun, false);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineBulkFun1(muParserHandle_t a_hParser,
-    const muChar_t* a_szName,
-    muBulkFun1_t a_pFun)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->DefineFun(a_szName, a_pFun, false);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineBulkFun2(muParserHandle_t a_hParser,
-    const muChar_t* a_szName,
-    muBulkFun2_t a_pFun)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->DefineFun(a_szName, a_pFun, false);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineBulkFun3(muParserHandle_t a_hParser,
-    const muChar_t *a_szName,
-    muBulkFun3_t a_pFun)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->DefineFun(a_szName, a_pFun, false);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineBulkFun4(muParserHandle_t a_hParser,
-    const muChar_t *a_szName,
-    muBulkFun4_t a_pFun)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->DefineFun(a_szName, a_pFun, false);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineBulkFun5(muParserHandle_t a_hParser,
-    const muChar_t *a_szName,
-    muBulkFun5_t a_pFun)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->DefineFun(a_szName, a_pFun, false);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineBulkFun6(muParserHandle_t a_hParser,
-    const muChar_t *a_szName,
-    muBulkFun6_t a_pFun)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->DefineFun(a_szName, a_pFun, false);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineBulkFun7(muParserHandle_t a_hParser,
-    const muChar_t *a_szName,
-    muBulkFun7_t a_pFun)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->DefineFun(a_szName, a_pFun, false);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineBulkFun8(muParserHandle_t a_hParser,
-    const muChar_t *a_szName,
-    muBulkFun8_t a_pFun)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->DefineFun(a_szName, a_pFun, false);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineBulkFun9(muParserHandle_t a_hParser,
-    const muChar_t *a_szName,
-    muBulkFun9_t a_pFun)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->DefineFun(a_szName, a_pFun, false);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineBulkFun10(muParserHandle_t a_hParser,
-    const muChar_t *a_szName,
-    muBulkFun10_t a_pFun)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->DefineFun(a_szName, a_pFun, false);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineStrFun1(muParserHandle_t a_hParser,
-    const muChar_t *a_szName,
-    muStrFun1_t a_pFun)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->DefineFun(a_szName, a_pFun, false);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineStrFun2(muParserHandle_t a_hParser,
-    const muChar_t* a_szName,
-    muStrFun2_t a_pFun)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->DefineFun(a_szName, a_pFun, false);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineStrFun3(muParserHandle_t a_hParser,
-    const muChar_t* a_szName,
-    muStrFun3_t a_pFun)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->DefineFun(a_szName, a_pFun, false);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineMultFun(muParserHandle_t a_hParser,
-    const muChar_t *a_szName,
-    muMultFun_t a_pFun,
-    muBool_t a_bAllowOpt)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineOprt(muParserHandle_t a_hParser,
-    const muChar_t* a_szName,
-    muFun2_t a_pFun,
-    muInt_t a_nPrec,
-    muInt_t a_nOprtAsct,
-    muBool_t a_bAllowOpt)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->DefineOprt(a_szName,
-        a_pFun,
-        a_nPrec,
-        (mu::EOprtAssociativity)a_nOprtAsct,
-        a_bAllowOpt != 0);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineVar(muParserHandle_t a_hParser,
-    const muChar_t *a_szName,
-    muFloat_t *a_pVar)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->DefineVar(a_szName, a_pVar);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineBulkVar(muParserHandle_t a_hParser,
-    const muChar_t *a_szName,
-    muFloat_t *a_pVar)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->DefineVar(a_szName, a_pVar);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineConst(muParserHandle_t a_hParser,
-    const muChar_t *a_szName,
-    muFloat_t a_fVal)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->DefineConst(a_szName, a_fVal);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineStrConst(muParserHandle_t a_hParser,
-    const muChar_t *a_szName,
-    const muChar_t *a_szVal)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->DefineStrConst(a_szName, a_szVal);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(const muChar_t*) mupGetExpr(muParserHandle_t a_hParser)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-
-    // C# explodes when pMsg is returned directly. For some reason it can't access
-    // the memory where the message lies directly.
-#ifndef _UNICODE
-    sprintf(s_tmpOutBuf, "%s", p->GetExpr().c_str());
-#else
-    wsprintf(s_tmpOutBuf, _T("%s"), p->GetExpr().c_str());
-#endif
-
-    return s_tmpOutBuf;
-
-    MU_CATCH
-
-        return _T("");
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefinePostfixOprt(muParserHandle_t a_hParser,
-    const muChar_t* a_szName,
-    muFun1_t a_pOprt,
-    muBool_t a_bAllowOpt)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->DefinePostfixOprt(a_szName, a_pOprt, a_bAllowOpt != 0);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineInfixOprt(muParserHandle_t a_hParser,
-    const muChar_t* a_szName,
-    muFun1_t a_pOprt,
-    muBool_t a_bAllowOpt)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->DefineInfixOprt(a_szName, a_pOprt, a_bAllowOpt != 0);
-    MU_CATCH
-}
-
-// Define character sets for identifiers
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineNameChars(muParserHandle_t a_hParser,
-    const muChar_t* a_szCharset)
-{
-    muParser_t* const p(AsParser(a_hParser));
-    p->DefineNameChars(a_szCharset);
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineOprtChars(muParserHandle_t a_hParser,
-    const muChar_t* a_szCharset)
-{
-    muParser_t* const p(AsParser(a_hParser));
-    p->DefineOprtChars(a_szCharset);
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupDefineInfixOprtChars(muParserHandle_t a_hParser,
-    const muChar_t *a_szCharset)
-{
-    muParser_t* const p(AsParser(a_hParser));
-    p->DefineInfixOprtChars(a_szCharset);
-}
-
-//---------------------------------------------------------------------------
-/** \brief Get the number of variables defined in the parser.
-    \param a_hParser [in] Must be a valid parser handle.
-    \return The number of used variables.
-    \sa mupGetExprVar
-    */
-API_EXPORT(int) mupGetVarNum(muParserHandle_t a_hParser)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    const mu::varmap_type VarMap = p->GetVar();
-    return (int)VarMap.size();
-    MU_CATCH
-
-        return 0; // never reached
-}
-
-//---------------------------------------------------------------------------
-/** \brief Return a variable that is used in an expression.
-    \param a_hParser [in] A valid parser handle.
-    \param a_iVar [in] The index of the variable to return.
-    \param a_szName [out] Pointer to the variable name.
-    \param a_pVar [out] Pointer to the variable.
-    \throw nothrow
-
-    Prior to calling this function call mupGetExprVarNum in order to get the
-    number of variables in the expression. If the parameter a_iVar is greater
-    than the number of variables both a_szName and a_pVar will be set to zero.
-    As a side effect this function will trigger an internal calculation of the
-    expression undefined variables will be set to zero during this calculation.
-    During the calculation user defined callback functions present in the expression
-    will be called, this is unavoidable.
-    */
-API_EXPORT(void) mupGetVar(muParserHandle_t a_hParser,
-    unsigned a_iVar,
-    const muChar_t **a_szName,
-    muFloat_t **a_pVar)
-{
-    // A static buffer is needed for the name since i cant return the
-    // pointer from the map.
-    static muChar_t  szName[1024];
-
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    const mu::varmap_type VarMap = p->GetVar();
-
-    if (a_iVar >= VarMap.size())
-    {
-        *a_szName = 0;
-        *a_pVar = 0;
-        return;
-    }
-    mu::varmap_type::const_iterator item;
-
-    item = VarMap.begin();
-    for (unsigned i = 0; i < a_iVar; ++i)
-        ++item;
-
-#ifndef _UNICODE
-    strncpy(szName, item->first.c_str(), sizeof(szName));
-#else
-    wcsncpy(szName, item->first.c_str(), sizeof(szName));
-#endif
-
-    szName[sizeof(szName)-1] = 0;
-
-    *a_szName = &szName[0];
-    *a_pVar = item->second;
-    return;
-
-    MU_CATCH
-
-        *a_szName = 0;
-    *a_pVar = 0;
-}
-
-//---------------------------------------------------------------------------
-/** \brief Get the number of variables used in the expression currently set in the parser.
-    \param a_hParser [in] Must be a valid parser handle.
-    \return The number of used variables.
-    \sa mupGetExprVar
-    */
-API_EXPORT(int) mupGetExprVarNum(muParserHandle_t a_hParser)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    const mu::varmap_type VarMap = p->GetUsedVar();
-    return (int)VarMap.size();
-    MU_CATCH
-
-        return 0; // never reached
-}
-
-//---------------------------------------------------------------------------
-/** \brief Return a variable that is used in an expression.
-
-    Prior to calling this function call mupGetExprVarNum in order to get the
-    number of variables in the expression. If the parameter a_iVar is greater
-    than the number of variables both a_szName and a_pVar will be set to zero.
-    As a side effect this function will trigger an internal calculation of the
-    expression undefined variables will be set to zero during this calculation.
-    During the calculation user defined callback functions present in the expression
-    will be called, this is unavoidable.
-
-    \param a_hParser [in] A valid parser handle.
-    \param a_iVar [in] The index of the variable to return.
-    \param a_szName [out] Pointer to the variable name.
-    \param a_pVar [out] Pointer to the variable.
-    \throw nothrow
-    */
-API_EXPORT(void) mupGetExprVar(muParserHandle_t a_hParser,
-    unsigned a_iVar,
-    const muChar_t **a_szName,
-    muFloat_t **a_pVar)
-{
-    // A static buffer is needed for the name since i cant return the
-    // pointer from the map.
-    static muChar_t  szName[1024];
-
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    const mu::varmap_type VarMap = p->GetUsedVar();
-
-    if (a_iVar >= VarMap.size())
-    {
-        *a_szName = 0;
-        *a_pVar = 0;
-        return;
-    }
-    mu::varmap_type::const_iterator item;
-
-    item = VarMap.begin();
-    for (unsigned i = 0; i < a_iVar; ++i)
-        ++item;
-
-#ifndef _UNICODE
-    strncpy(szName, item->first.c_str(), sizeof(szName));
-#else
-    wcsncpy(szName, item->first.c_str(), sizeof(szName));
-#endif
-
-    szName[sizeof(szName)-1] = 0;
-
-    *a_szName = &szName[0];
-    *a_pVar = item->second;
-    return;
-
-    MU_CATCH
-
-        *a_szName = 0;
-    *a_pVar = 0;
-}
-
-//---------------------------------------------------------------------------
-/** \brief Return the number of constants defined in a parser. */
-API_EXPORT(int) mupGetConstNum(muParserHandle_t a_hParser)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    const mu::valmap_type ValMap = p->GetConst();
-    return (int)ValMap.size();
-    MU_CATCH
-
-        return 0; // never reached
-}
-
-//-----------------------------------------------------------------------------------------------------
-API_EXPORT(void) mupSetArgSep(muParserHandle_t a_hParser, const muChar_t cArgSep)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->SetArgSep(cArgSep);
-    MU_CATCH
-}
-
-//-----------------------------------------------------------------------------------------------------
-API_EXPORT(void) mupResetLocale(muParserHandle_t a_hParser)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->ResetLocale();
-    MU_CATCH
-}
-
-//-----------------------------------------------------------------------------------------------------
-API_EXPORT(void) mupSetDecSep(muParserHandle_t a_hParser, const muChar_t cDecSep)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->SetDecSep(cDecSep);
-    MU_CATCH
-}
-
-//-----------------------------------------------------------------------------------------------------
-API_EXPORT(void) mupSetThousandsSep(muParserHandle_t a_hParser, const muChar_t cThousandsSep)
-{
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    p->SetThousandsSep(cThousandsSep);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-/** \brief Retrieve name and value of a single parser constant.
-    \param a_hParser [in] a valid parser handle
-    \param a_iVar [in] Index of the constant to query
-    \param a_pszName [out] pointer to a null terminated string with the constant name
-    \param [out] The constant value
-    */
-API_EXPORT(void) mupGetConst(muParserHandle_t a_hParser,
-    unsigned a_iVar,
-    const muChar_t **a_pszName,
-    muFloat_t *a_fVal)
-{
-    // A static buffer is needed for the name since i cant return the
-    // pointer from the map.
-    static muChar_t szName[1024];
-
-    MU_TRY
-        muParser_t* const p(AsParser(a_hParser));
-    const mu::valmap_type ValMap = p->GetConst();
-
-    if (a_iVar >= ValMap.size())
-    {
-        *a_pszName = 0;
-        *a_fVal = 0;
-        return;
-    }
-
-    mu::valmap_type::const_iterator item;
-    item = ValMap.begin();
-    for (unsigned i = 0; i < a_iVar; ++i)
-        ++item;
-
-#ifndef _UNICODE
-    strncpy(szName, item->first.c_str(), sizeof(szName));
-#else
-    wcsncpy(szName, item->first.c_str(), sizeof(szName));
-#endif
-
-    szName[sizeof(szName)-1] = 0;
-
-    *a_pszName = &szName[0];
-    *a_fVal = item->second;
-    return;
-
-    MU_CATCH
-
-        *a_pszName = 0;
-    *a_fVal = 0;
-}
-
-//---------------------------------------------------------------------------
-/** \brief Add a custom value recognition function.
-*/
-API_EXPORT(void) mupAddValIdent(muParserHandle_t a_hParser,
-    muIdentFun_t a_pFun)
-{
-    MU_TRY
-        muParser_t* p(AsParser(a_hParser));
-    p->AddValIdent(a_pFun);
-    MU_CATCH
-}
-
-//---------------------------------------------------------------------------
-/** \brief Query if an error occurred.
-
-    After querying the internal error bit will be reset. So a consecutive call
-    will return false.
-    */
-API_EXPORT(muBool_t) mupError(muParserHandle_t a_hParser)
-{
-    bool bError(AsParserTag(a_hParser)->bError);
-    AsParserTag(a_hParser)->bError = false;
-    return bError;
-}
-
-//---------------------------------------------------------------------------
-/** \brief Reset the internal error flag.
-*/
-API_EXPORT(void) mupErrorReset(muParserHandle_t a_hParser)
-{
-    AsParserTag(a_hParser)->bError = false;
-}
-
-//---------------------------------------------------------------------------
-API_EXPORT(void) mupSetErrorHandler(muParserHandle_t a_hParser, muErrorHandler_t a_pHandler)
-{
-    AsParserTag(a_hParser)->errHandler = a_pHandler;
-}
-
-//---------------------------------------------------------------------------
-/** \brief Return the message associated with the last error.
-*/
-API_EXPORT(const muChar_t*) mupGetErrorMsg(muParserHandle_t a_hParser)
-{
-    ParserTag* const p(AsParserTag(a_hParser));
-    const muChar_t *pMsg = p->exc.GetMsg().c_str();
-
-    // C# explodes when pMsg is returned directly. For some reason it can't access
-    // the memory where the message lies directly.
-#ifndef _UNICODE
-    sprintf(s_tmpOutBuf, "%s", pMsg);
-#else
-    wsprintf(s_tmpOutBuf, _T("%s"), pMsg);
-#endif
-
-    return s_tmpOutBuf;
-}
-
-//---------------------------------------------------------------------------
-/** \brief Return the message associated with the last error.
-*/
-API_EXPORT(const muChar_t*) mupGetErrorToken(muParserHandle_t a_hParser)
-{
-    ParserTag* const p(AsParserTag(a_hParser));
-    const muChar_t *pToken = p->exc.GetToken().c_str();
-
-    // C# explodes when pMsg is returned directly. For some reason it can't access
-    // the memory where the message lies directly.
-#ifndef _UNICODE
-    sprintf(s_tmpOutBuf, "%s", pToken);
-#else
-    wsprintf(s_tmpOutBuf, _T("%s"), pToken);
-#endif
-
-    return s_tmpOutBuf;
-}
-
-//---------------------------------------------------------------------------
-/** \brief Return the code associated with the last error.
-*/
-API_EXPORT(int) mupGetErrorCode(muParserHandle_t a_hParser)
-{
-    return AsParserTag(a_hParser)->exc.GetCode();
-}
-
-//---------------------------------------------------------------------------
-/** \brief Return the position associated with the last error. */
-API_EXPORT(int) mupGetErrorPos(muParserHandle_t a_hParser)
-{
-    return (int)AsParserTag(a_hParser)->exc.GetPos();
-}
-
-////-----------------------------------------------------------------------------------------------------
-//API_EXPORT(const muChar_t*) mupGetErrorExpr(muParserHandle_t a_hParser)
-//{
-//  return AsParserTag(a_hParser)->exc.GetExpr().c_str();
-//}
-
-//-----------------------------------------------------------------------------------------------------
-API_EXPORT(muFloat_t*) mupCreateVar()
-{
-    return new muFloat_t(0);
-}
-
-//-----------------------------------------------------------------------------------------------------
-API_EXPORT(void) mupReleaseVar(muFloat_t *ptr)
-{
-    delete ptr;
-}
-
-#endif      // MUPARSER_DLL
+/*
+                 __________
+                 _____   __ __\______   \_____  _______  ______  ____ _______
+                 /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
+                 |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
+                 |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|
+                 \/                       \/            \/      \/
+                 Copyright (C) 2004-2011 Ingo Berg
+
+                 Permission is hereby granted, free of charge, to any person obtaining a copy of this
+                 software and associated documentation files (the "Software"), to deal in the Software
+                 without restriction, including without limitation the rights to use, copy, modify,
+                 merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
+                 permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+                 The above copyright notice and this permission notice shall be included in all copies or
+                 substantial portions of the Software.
+
+                 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
+                 NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+                 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+                 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+                 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+                 */
+#if defined(MUPARSER_DLL)
+
+#if defined(_WIN32)
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#endif
+
+#include "muParserDLL.h"
+#include "muParser.h"
+#include "muParserInt.h"
+#include "muParserError.h"
+
+
+#define MU_TRY  \
+    try     \
+        {
+
+#define MU_CATCH                                                 \
+        }                                                        \
+        catch (muError_t &e)                                      \
+        {                                                        \
+        ParserTag *pTag = static_cast<ParserTag*>(a_hParser);  \
+        pTag->exc = e;                                         \
+        pTag->bError = true;                                   \
+if (pTag->errHandler)                                  \
+    (pTag->errHandler)(a_hParser);                       \
+        }                                                        \
+        catch (...)                                               \
+        {                                                        \
+        ParserTag *pTag = static_cast<ParserTag*>(a_hParser);  \
+        pTag->exc = muError_t(mu::ecINTERNAL_ERROR);           \
+        pTag->bError = true;                                   \
+if (pTag->errHandler)                                  \
+    (pTag->errHandler)(a_hParser);                       \
+        }
+
+/** \file
+    \brief This file contains the implementation of the DLL interface of muparser.
+    */
+
+//---------------------------------------------------------------------------
+// private types
+typedef mu::ParserBase::exception_type muError_t;
+typedef mu::ParserBase muParser_t;
+
+int g_nBulkSize;
+
+//---------------------------------------------------------------------------
+class ParserTag
+{
+public:
+    ParserTag(int nType)
+        :pParser((nType == muBASETYPE_FLOAT) ? (mu::ParserBase*)new mu::Parser() :
+        (nType == muBASETYPE_INT) ? (mu::ParserBase*)new mu::ParserInt() : NULL)
+        , exc()
+        , errHandler(NULL)
+        , bError(false)
+        , m_nParserType(nType)
+    {}
+
+    ~ParserTag()
+    {
+        delete pParser;
+    }
+
+    mu::ParserBase *pParser;
+    mu::ParserBase::exception_type exc;
+    muErrorHandler_t errHandler;
+    bool bError;
+
+private:
+    ParserTag(const ParserTag &ref);
+    ParserTag& operator=(const ParserTag &ref);
+
+    int m_nParserType;
+};
+
+static muChar_t s_tmpOutBuf[2048];
+
+//---------------------------------------------------------------------------
+//
+//
+//  unexported functions
+//
+//
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+muParser_t* AsParser(muParserHandle_t a_hParser)
+{
+    return static_cast<ParserTag*>(a_hParser)->pParser;
+}
+
+//---------------------------------------------------------------------------
+ParserTag* AsParserTag(muParserHandle_t a_hParser)
+{
+    return static_cast<ParserTag*>(a_hParser);
+}
+
+//---------------------------------------------------------------------------
+#if defined(_WIN32)
+#define _CRT_SECURE_NO_DEPRECATE
+
+BOOL APIENTRY DllMain(HANDLE /*hModule*/,
+    DWORD ul_reason_for_call,
+    LPVOID /*lpReserved*/)
+{
+    switch (ul_reason_for_call)
+    {
+    case  DLL_PROCESS_ATTACH:
+        break;
+
+    case  DLL_THREAD_ATTACH:
+    case  DLL_THREAD_DETACH:
+    case  DLL_PROCESS_DETACH:
+        break;
+    }
+
+    return TRUE;
+}
+
+#endif
+
+//---------------------------------------------------------------------------
+//
+//
+//  exported functions
+//
+//
+//---------------------------------------------------------------------------
+
+API_EXPORT(void) mupSetVarFactory(muParserHandle_t a_hParser, muFacFun_t a_pFactory, void *pUserData)
+{
+    MU_TRY
+        muParser_t* p(AsParser(a_hParser));
+    p->SetVarFactory(a_pFactory, pUserData);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+/** \brief Create a new Parser instance and return its handle.
+*/
+API_EXPORT(muParserHandle_t) mupCreate(int nBaseType)
+{
+    switch (nBaseType)
+    {
+    case  muBASETYPE_FLOAT:   return (void*)(new ParserTag(muBASETYPE_FLOAT));
+    case  muBASETYPE_INT:     return (void*)(new ParserTag(muBASETYPE_INT));
+    default:                  return NULL;
+    }
+}
+
+//---------------------------------------------------------------------------
+/** \brief Release the parser instance related with a parser handle.
+*/
+API_EXPORT(void) mupRelease(muParserHandle_t a_hParser)
+{
+    MU_TRY
+        ParserTag* p = static_cast<ParserTag*>(a_hParser);
+    delete p;
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(const muChar_t*) mupGetVersion(muParserHandle_t a_hParser)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+
+#ifndef _UNICODE
+    sprintf(s_tmpOutBuf, "%s", p->GetVersion().c_str());
+#else
+    wsprintf(s_tmpOutBuf, _T("%s"), p->GetVersion().c_str());
+#endif
+
+    return s_tmpOutBuf;
+    MU_CATCH
+
+        return _T("");
+}
+
+//---------------------------------------------------------------------------
+/** \brief Evaluate the expression.
+*/
+API_EXPORT(muFloat_t) mupEval(muParserHandle_t a_hParser)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    return p->Eval();
+    MU_CATCH
+
+        return 0;
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(muFloat_t*) mupEvalMulti(muParserHandle_t a_hParser, int *nNum)
+{
+    MU_TRY
+        assert(nNum != NULL);
+
+    muParser_t* const p(AsParser(a_hParser));
+    return p->Eval(*nNum);
+    MU_CATCH
+
+        return 0;
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupEvalBulk(muParserHandle_t a_hParser, muFloat_t *a_res, int nSize)
+{
+    MU_TRY
+        muParser_t* p(AsParser(a_hParser));
+    p->Eval(a_res, nSize);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupSetExpr(muParserHandle_t a_hParser, const muChar_t* a_szExpr)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->SetExpr(a_szExpr);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupRemoveVar(muParserHandle_t a_hParser, const muChar_t* a_szName)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->RemoveVar(a_szName);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+/** \brief Release all parser variables.
+    \param a_hParser Handle to the parser instance.
+    */
+API_EXPORT(void) mupClearVar(muParserHandle_t a_hParser)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->ClearVar();
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+/** \brief Release all parser variables.
+    \param a_hParser Handle to the parser instance.
+    */
+API_EXPORT(void) mupClearConst(muParserHandle_t a_hParser)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->ClearConst();
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+/** \brief Clear all user defined operators.
+    \param a_hParser Handle to the parser instance.
+    */
+API_EXPORT(void) mupClearOprt(muParserHandle_t a_hParser)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->ClearOprt();
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupClearFun(muParserHandle_t a_hParser)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->ClearFun();
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineFun0(muParserHandle_t a_hParser,
+    const muChar_t* a_szName,
+    muFun0_t a_pFun,
+    muBool_t a_bAllowOpt)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineFun1(muParserHandle_t a_hParser,
+    const muChar_t* a_szName,
+    muFun1_t a_pFun,
+    muBool_t a_bAllowOpt)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineFun2(muParserHandle_t a_hParser,
+    const muChar_t* a_szName,
+    muFun2_t a_pFun,
+    muBool_t a_bAllowOpt)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineFun3(muParserHandle_t a_hParser,
+    const muChar_t *a_szName,
+    muFun3_t a_pFun,
+    muBool_t a_bAllowOpt)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineFun4(muParserHandle_t a_hParser,
+    const muChar_t *a_szName,
+    muFun4_t a_pFun,
+    muBool_t a_bAllowOpt)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineFun5(muParserHandle_t a_hParser,
+    const muChar_t *a_szName,
+    muFun5_t a_pFun,
+    muBool_t a_bAllowOpt)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineFun6(muParserHandle_t a_hParser,
+    const muChar_t *a_szName,
+    muFun6_t a_pFun,
+    muBool_t a_bAllowOpt)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineFun7(muParserHandle_t a_hParser,
+    const muChar_t *a_szName,
+    muFun7_t a_pFun,
+    muBool_t a_bAllowOpt)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineFun8(muParserHandle_t a_hParser,
+    const muChar_t *a_szName,
+    muFun8_t a_pFun,
+    muBool_t a_bAllowOpt)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineFun9(muParserHandle_t a_hParser,
+    const muChar_t *a_szName,
+    muFun9_t a_pFun,
+    muBool_t a_bAllowOpt)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineFun10(muParserHandle_t a_hParser,
+    const muChar_t *a_szName,
+    muFun10_t a_pFun,
+    muBool_t a_bAllowOpt)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineBulkFun0(muParserHandle_t a_hParser,
+    const muChar_t* a_szName,
+    muBulkFun0_t a_pFun)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->DefineFun(a_szName, a_pFun, false);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineBulkFun1(muParserHandle_t a_hParser,
+    const muChar_t* a_szName,
+    muBulkFun1_t a_pFun)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->DefineFun(a_szName, a_pFun, false);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineBulkFun2(muParserHandle_t a_hParser,
+    const muChar_t* a_szName,
+    muBulkFun2_t a_pFun)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->DefineFun(a_szName, a_pFun, false);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineBulkFun3(muParserHandle_t a_hParser,
+    const muChar_t *a_szName,
+    muBulkFun3_t a_pFun)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->DefineFun(a_szName, a_pFun, false);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineBulkFun4(muParserHandle_t a_hParser,
+    const muChar_t *a_szName,
+    muBulkFun4_t a_pFun)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->DefineFun(a_szName, a_pFun, false);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineBulkFun5(muParserHandle_t a_hParser,
+    const muChar_t *a_szName,
+    muBulkFun5_t a_pFun)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->DefineFun(a_szName, a_pFun, false);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineBulkFun6(muParserHandle_t a_hParser,
+    const muChar_t *a_szName,
+    muBulkFun6_t a_pFun)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->DefineFun(a_szName, a_pFun, false);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineBulkFun7(muParserHandle_t a_hParser,
+    const muChar_t *a_szName,
+    muBulkFun7_t a_pFun)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->DefineFun(a_szName, a_pFun, false);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineBulkFun8(muParserHandle_t a_hParser,
+    const muChar_t *a_szName,
+    muBulkFun8_t a_pFun)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->DefineFun(a_szName, a_pFun, false);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineBulkFun9(muParserHandle_t a_hParser,
+    const muChar_t *a_szName,
+    muBulkFun9_t a_pFun)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->DefineFun(a_szName, a_pFun, false);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineBulkFun10(muParserHandle_t a_hParser,
+    const muChar_t *a_szName,
+    muBulkFun10_t a_pFun)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->DefineFun(a_szName, a_pFun, false);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineStrFun1(muParserHandle_t a_hParser,
+    const muChar_t *a_szName,
+    muStrFun1_t a_pFun)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->DefineFun(a_szName, a_pFun, false);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineStrFun2(muParserHandle_t a_hParser,
+    const muChar_t* a_szName,
+    muStrFun2_t a_pFun)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->DefineFun(a_szName, a_pFun, false);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineStrFun3(muParserHandle_t a_hParser,
+    const muChar_t* a_szName,
+    muStrFun3_t a_pFun)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->DefineFun(a_szName, a_pFun, false);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineMultFun(muParserHandle_t a_hParser,
+    const muChar_t *a_szName,
+    muMultFun_t a_pFun,
+    muBool_t a_bAllowOpt)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineOprt(muParserHandle_t a_hParser,
+    const muChar_t* a_szName,
+    muFun2_t a_pFun,
+    muInt_t a_nPrec,
+    muInt_t a_nOprtAsct,
+    muBool_t a_bAllowOpt)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->DefineOprt(a_szName,
+        a_pFun,
+        a_nPrec,
+        (mu::EOprtAssociativity)a_nOprtAsct,
+        a_bAllowOpt != 0);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineVar(muParserHandle_t a_hParser,
+    const muChar_t *a_szName,
+    muFloat_t *a_pVar)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->DefineVar(a_szName, a_pVar);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineBulkVar(muParserHandle_t a_hParser,
+    const muChar_t *a_szName,
+    muFloat_t *a_pVar)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->DefineVar(a_szName, a_pVar);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineConst(muParserHandle_t a_hParser,
+    const muChar_t *a_szName,
+    muFloat_t a_fVal)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->DefineConst(a_szName, a_fVal);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineStrConst(muParserHandle_t a_hParser,
+    const muChar_t *a_szName,
+    const muChar_t *a_szVal)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->DefineStrConst(a_szName, a_szVal);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(const muChar_t*) mupGetExpr(muParserHandle_t a_hParser)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+
+    // C# explodes when pMsg is returned directly. For some reason it can't access
+    // the memory where the message lies directly.
+#ifndef _UNICODE
+    sprintf(s_tmpOutBuf, "%s", p->GetExpr().c_str());
+#else
+    wsprintf(s_tmpOutBuf, _T("%s"), p->GetExpr().c_str());
+#endif
+
+    return s_tmpOutBuf;
+
+    MU_CATCH
+
+        return _T("");
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefinePostfixOprt(muParserHandle_t a_hParser,
+    const muChar_t* a_szName,
+    muFun1_t a_pOprt,
+    muBool_t a_bAllowOpt)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->DefinePostfixOprt(a_szName, a_pOprt, a_bAllowOpt != 0);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineInfixOprt(muParserHandle_t a_hParser,
+    const muChar_t* a_szName,
+    muFun1_t a_pOprt,
+    muBool_t a_bAllowOpt)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->DefineInfixOprt(a_szName, a_pOprt, a_bAllowOpt != 0);
+    MU_CATCH
+}
+
+// Define character sets for identifiers
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineNameChars(muParserHandle_t a_hParser,
+    const muChar_t* a_szCharset)
+{
+    muParser_t* const p(AsParser(a_hParser));
+    p->DefineNameChars(a_szCharset);
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineOprtChars(muParserHandle_t a_hParser,
+    const muChar_t* a_szCharset)
+{
+    muParser_t* const p(AsParser(a_hParser));
+    p->DefineOprtChars(a_szCharset);
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupDefineInfixOprtChars(muParserHandle_t a_hParser,
+    const muChar_t *a_szCharset)
+{
+    muParser_t* const p(AsParser(a_hParser));
+    p->DefineInfixOprtChars(a_szCharset);
+}
+
+//---------------------------------------------------------------------------
+/** \brief Get the number of variables defined in the parser.
+    \param a_hParser [in] Must be a valid parser handle.
+    \return The number of used variables.
+    \sa mupGetExprVar
+    */
+API_EXPORT(int) mupGetVarNum(muParserHandle_t a_hParser)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    const mu::varmap_type VarMap = p->GetVar();
+    return (int)VarMap.size();
+    MU_CATCH
+
+        return 0; // never reached
+}
+
+//---------------------------------------------------------------------------
+/** \brief Return a variable that is used in an expression.
+    \param a_hParser [in] A valid parser handle.
+    \param a_iVar [in] The index of the variable to return.
+    \param a_szName [out] Pointer to the variable name.
+    \param a_pVar [out] Pointer to the variable.
+    \throw nothrow
+
+    Prior to calling this function call mupGetExprVarNum in order to get the
+    number of variables in the expression. If the parameter a_iVar is greater
+    than the number of variables both a_szName and a_pVar will be set to zero.
+    As a side effect this function will trigger an internal calculation of the
+    expression undefined variables will be set to zero during this calculation.
+    During the calculation user defined callback functions present in the expression
+    will be called, this is unavoidable.
+    */
+API_EXPORT(void) mupGetVar(muParserHandle_t a_hParser,
+    unsigned a_iVar,
+    const muChar_t **a_szName,
+    muFloat_t **a_pVar)
+{
+    // A static buffer is needed for the name since i cant return the
+    // pointer from the map.
+    static muChar_t  szName[1024];
+
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    const mu::varmap_type VarMap = p->GetVar();
+
+    if (a_iVar >= VarMap.size())
+    {
+        *a_szName = 0;
+        *a_pVar = 0;
+        return;
+    }
+    mu::varmap_type::const_iterator item;
+
+    item = VarMap.begin();
+    for (unsigned i = 0; i < a_iVar; ++i)
+        ++item;
+
+#ifndef _UNICODE
+    strncpy(szName, item->first.c_str(), sizeof(szName));
+#else
+    wcsncpy(szName, item->first.c_str(), sizeof(szName));
+#endif
+
+    szName[sizeof(szName)-1] = 0;
+
+    *a_szName = &szName[0];
+    *a_pVar = item->second;
+    return;
+
+    MU_CATCH
+
+        *a_szName = 0;
+    *a_pVar = 0;
+}
+
+//---------------------------------------------------------------------------
+/** \brief Get the number of variables used in the expression currently set in the parser.
+    \param a_hParser [in] Must be a valid parser handle.
+    \return The number of used variables.
+    \sa mupGetExprVar
+    */
+API_EXPORT(int) mupGetExprVarNum(muParserHandle_t a_hParser)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    const mu::varmap_type VarMap = p->GetUsedVar();
+    return (int)VarMap.size();
+    MU_CATCH
+
+        return 0; // never reached
+}
+
+//---------------------------------------------------------------------------
+/** \brief Return a variable that is used in an expression.
+
+    Prior to calling this function call mupGetExprVarNum in order to get the
+    number of variables in the expression. If the parameter a_iVar is greater
+    than the number of variables both a_szName and a_pVar will be set to zero.
+    As a side effect this function will trigger an internal calculation of the
+    expression undefined variables will be set to zero during this calculation.
+    During the calculation user defined callback functions present in the expression
+    will be called, this is unavoidable.
+
+    \param a_hParser [in] A valid parser handle.
+    \param a_iVar [in] The index of the variable to return.
+    \param a_szName [out] Pointer to the variable name.
+    \param a_pVar [out] Pointer to the variable.
+    \throw nothrow
+    */
+API_EXPORT(void) mupGetExprVar(muParserHandle_t a_hParser,
+    unsigned a_iVar,
+    const muChar_t **a_szName,
+    muFloat_t **a_pVar)
+{
+    // A static buffer is needed for the name since i cant return the
+    // pointer from the map.
+    static muChar_t  szName[1024];
+
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    const mu::varmap_type VarMap = p->GetUsedVar();
+
+    if (a_iVar >= VarMap.size())
+    {
+        *a_szName = 0;
+        *a_pVar = 0;
+        return;
+    }
+    mu::varmap_type::const_iterator item;
+
+    item = VarMap.begin();
+    for (unsigned i = 0; i < a_iVar; ++i)
+        ++item;
+
+#ifndef _UNICODE
+    strncpy(szName, item->first.c_str(), sizeof(szName));
+#else
+    wcsncpy(szName, item->first.c_str(), sizeof(szName));
+#endif
+
+    szName[sizeof(szName)-1] = 0;
+
+    *a_szName = &szName[0];
+    *a_pVar = item->second;
+    return;
+
+    MU_CATCH
+
+        *a_szName = 0;
+    *a_pVar = 0;
+}
+
+//---------------------------------------------------------------------------
+/** \brief Return the number of constants defined in a parser. */
+API_EXPORT(int) mupGetConstNum(muParserHandle_t a_hParser)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    const mu::valmap_type ValMap = p->GetConst();
+    return (int)ValMap.size();
+    MU_CATCH
+
+        return 0; // never reached
+}
+
+//-----------------------------------------------------------------------------------------------------
+API_EXPORT(void) mupSetArgSep(muParserHandle_t a_hParser, const muChar_t cArgSep)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->SetArgSep(cArgSep);
+    MU_CATCH
+}
+
+//-----------------------------------------------------------------------------------------------------
+API_EXPORT(void) mupResetLocale(muParserHandle_t a_hParser)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->ResetLocale();
+    MU_CATCH
+}
+
+//-----------------------------------------------------------------------------------------------------
+API_EXPORT(void) mupSetDecSep(muParserHandle_t a_hParser, const muChar_t cDecSep)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->SetDecSep(cDecSep);
+    MU_CATCH
+}
+
+//-----------------------------------------------------------------------------------------------------
+API_EXPORT(void) mupSetThousandsSep(muParserHandle_t a_hParser, const muChar_t cThousandsSep)
+{
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    p->SetThousandsSep(cThousandsSep);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+/** \brief Retrieve name and value of a single parser constant.
+    \param a_hParser [in] a valid parser handle
+    \param a_iVar [in] Index of the constant to query
+    \param a_pszName [out] pointer to a null terminated string with the constant name
+    \param [out] The constant value
+    */
+API_EXPORT(void) mupGetConst(muParserHandle_t a_hParser,
+    unsigned a_iVar,
+    const muChar_t **a_pszName,
+    muFloat_t *a_fVal)
+{
+    // A static buffer is needed for the name since i cant return the
+    // pointer from the map.
+    static muChar_t szName[1024];
+
+    MU_TRY
+        muParser_t* const p(AsParser(a_hParser));
+    const mu::valmap_type ValMap = p->GetConst();
+
+    if (a_iVar >= ValMap.size())
+    {
+        *a_pszName = 0;
+        *a_fVal = 0;
+        return;
+    }
+
+    mu::valmap_type::const_iterator item;
+    item = ValMap.begin();
+    for (unsigned i = 0; i < a_iVar; ++i)
+        ++item;
+
+#ifndef _UNICODE
+    strncpy(szName, item->first.c_str(), sizeof(szName));
+#else
+    wcsncpy(szName, item->first.c_str(), sizeof(szName));
+#endif
+
+    szName[sizeof(szName)-1] = 0;
+
+    *a_pszName = &szName[0];
+    *a_fVal = item->second;
+    return;
+
+    MU_CATCH
+
+        *a_pszName = 0;
+    *a_fVal = 0;
+}
+
+//---------------------------------------------------------------------------
+/** \brief Add a custom value recognition function.
+*/
+API_EXPORT(void) mupAddValIdent(muParserHandle_t a_hParser,
+    muIdentFun_t a_pFun)
+{
+    MU_TRY
+        muParser_t* p(AsParser(a_hParser));
+    p->AddValIdent(a_pFun);
+    MU_CATCH
+}
+
+//---------------------------------------------------------------------------
+/** \brief Query if an error occurred.
+
+    After querying the internal error bit will be reset. So a consecutive call
+    will return false.
+    */
+API_EXPORT(muBool_t) mupError(muParserHandle_t a_hParser)
+{
+    bool bError(AsParserTag(a_hParser)->bError);
+    AsParserTag(a_hParser)->bError = false;
+    return bError;
+}
+
+//---------------------------------------------------------------------------
+/** \brief Reset the internal error flag.
+*/
+API_EXPORT(void) mupErrorReset(muParserHandle_t a_hParser)
+{
+    AsParserTag(a_hParser)->bError = false;
+}
+
+//---------------------------------------------------------------------------
+API_EXPORT(void) mupSetErrorHandler(muParserHandle_t a_hParser, muErrorHandler_t a_pHandler)
+{
+    AsParserTag(a_hParser)->errHandler = a_pHandler;
+}
+
+//---------------------------------------------------------------------------
+/** \brief Return the message associated with the last error.
+*/
+API_EXPORT(const muChar_t*) mupGetErrorMsg(muParserHandle_t a_hParser)
+{
+    ParserTag* const p(AsParserTag(a_hParser));
+    const muChar_t *pMsg = p->exc.GetMsg().c_str();
+
+    // C# explodes when pMsg is returned directly. For some reason it can't access
+    // the memory where the message lies directly.
+#ifndef _UNICODE
+    sprintf(s_tmpOutBuf, "%s", pMsg);
+#else
+    wsprintf(s_tmpOutBuf, _T("%s"), pMsg);
+#endif
+
+    return s_tmpOutBuf;
+}
+
+//---------------------------------------------------------------------------
+/** \brief Return the message associated with the last error.
+*/
+API_EXPORT(const muChar_t*) mupGetErrorToken(muParserHandle_t a_hParser)
+{
+    ParserTag* const p(AsParserTag(a_hParser));
+    const muChar_t *pToken = p->exc.GetToken().c_str();
+
+    // C# explodes when pMsg is returned directly. For some reason it can't access
+    // the memory where the message lies directly.
+#ifndef _UNICODE
+    sprintf(s_tmpOutBuf, "%s", pToken);
+#else
+    wsprintf(s_tmpOutBuf, _T("%s"), pToken);
+#endif
+
+    return s_tmpOutBuf;
+}
+
+//---------------------------------------------------------------------------
+/** \brief Return the code associated with the last error.
+*/
+API_EXPORT(int) mupGetErrorCode(muParserHandle_t a_hParser)
+{
+    return AsParserTag(a_hParser)->exc.GetCode();
+}
+
+//---------------------------------------------------------------------------
+/** \brief Return the position associated with the last error. */
+API_EXPORT(int) mupGetErrorPos(muParserHandle_t a_hParser)
+{
+    return (int)AsParserTag(a_hParser)->exc.GetPos();
+}
+
+////-----------------------------------------------------------------------------------------------------
+//API_EXPORT(const muChar_t*) mupGetErrorExpr(muParserHandle_t a_hParser)
+//{
+//  return AsParserTag(a_hParser)->exc.GetExpr().c_str();
+//}
+
+//-----------------------------------------------------------------------------------------------------
+API_EXPORT(muFloat_t*) mupCreateVar()
+{
+    return new muFloat_t(0);
+}
+
+//-----------------------------------------------------------------------------------------------------
+API_EXPORT(void) mupReleaseVar(muFloat_t *ptr)
+{
+    delete ptr;
+}
+
+#endif      // MUPARSER_DLL
diff --git a/geometry/qmuparser/muParserDLL.h b/geometry/qmuparser/muParserDLL.h
old mode 100755
new mode 100644
index 155ef8a..dc0709c
--- a/geometry/qmuparser/muParserDLL.h
+++ b/geometry/qmuparser/muParserDLL.h
@@ -1,241 +1,241 @@
-/*
-                 __________                                      
-    _____   __ __\______   \_____  _______  ______  ____ _______ 
-   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
-  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
-  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|   
-        \/                       \/            \/      \/        
-  Copyright (C) 2011 Ingo Berg
-
-  Permission is hereby granted, free of charge, to any person obtaining a copy of this 
-  software and associated documentation files (the "Software"), to deal in the Software
-  without restriction, including without limitation the rights to use, copy, modify, 
-  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 
-  permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-  The above copyright notice and this permission notice shall be included in all copies or 
-  substantial portions of the Software.
-
-  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
-  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
-  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
-  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
-  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
-*/
-#ifndef MU_PARSER_DLL_H
-#define MU_PARSER_DLL_H
-
-#if defined(WIN32) || defined(_WIN32)
-    #ifdef MUPARSERLIB_EXPORTS
-        #define API_EXPORT(TYPE) __declspec(dllexport) TYPE __cdecl
-    #else
-        #define API_EXPORT(TYPE) __declspec(dllimport) TYPE __cdecl
-    #endif
-#else
-    #define API_EXPORT(TYPE) TYPE
-#endif
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-/** \file 
-    \brief This file contains the DLL interface of muparser.
-*/
-
-// Basic types
-typedef void*  muParserHandle_t;    // parser handle
-
-#ifndef _UNICODE
-    typedef char   muChar_t;            // character type
-#else
-    typedef wchar_t   muChar_t;            // character type
-#endif
-
-typedef int    muBool_t;            // boolean type
-typedef int    muInt_t;             // integer type 
-typedef double muFloat_t;           // floating point type
-
-// function types for calculation
-typedef muFloat_t (*muFun0_t )(); 
-typedef muFloat_t (*muFun1_t )(muFloat_t); 
-typedef muFloat_t (*muFun2_t )(muFloat_t, muFloat_t); 
-typedef muFloat_t (*muFun3_t )(muFloat_t, muFloat_t, muFloat_t); 
-typedef muFloat_t (*muFun4_t )(muFloat_t, muFloat_t, muFloat_t, muFloat_t); 
-typedef muFloat_t (*muFun5_t )(muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); 
-typedef muFloat_t (*muFun6_t )(muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); 
-typedef muFloat_t (*muFun7_t )(muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); 
-typedef muFloat_t (*muFun8_t )(muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); 
-typedef muFloat_t (*muFun9_t )(muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); 
-typedef muFloat_t (*muFun10_t)(muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); 
-
-// Function prototypes for bulkmode functions
-typedef muFloat_t (*muBulkFun0_t )(int, int); 
-typedef muFloat_t (*muBulkFun1_t )(int, int, muFloat_t); 
-typedef muFloat_t (*muBulkFun2_t )(int, int, muFloat_t, muFloat_t); 
-typedef muFloat_t (*muBulkFun3_t )(int, int, muFloat_t, muFloat_t, muFloat_t); 
-typedef muFloat_t (*muBulkFun4_t )(int, int, muFloat_t, muFloat_t, muFloat_t, muFloat_t); 
-typedef muFloat_t (*muBulkFun5_t )(int, int, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); 
-typedef muFloat_t (*muBulkFun6_t )(int, int, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); 
-typedef muFloat_t (*muBulkFun7_t )(int, int, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); 
-typedef muFloat_t (*muBulkFun8_t )(int, int, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); 
-typedef muFloat_t (*muBulkFun9_t )(int, int, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); 
-typedef muFloat_t (*muBulkFun10_t)(int, int, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t); 
-
-typedef muFloat_t (*muMultFun_t)(const muFloat_t*, muInt_t);
-typedef muFloat_t (*muStrFun1_t)(const muChar_t*);
-typedef muFloat_t (*muStrFun2_t)(const muChar_t*, muFloat_t);
-typedef muFloat_t (*muStrFun3_t)(const muChar_t*, muFloat_t, muFloat_t);
-
-// Functions for parser management
-typedef void (*muErrorHandler_t)(muParserHandle_t a_hParser);           // [optional] callback to an error handler
-typedef muFloat_t* (*muFacFun_t)(const muChar_t*, void*);               // [optional] callback for creating new variables
-typedef muInt_t (*muIdentFun_t)(const muChar_t*, muInt_t*, muFloat_t*); // [optional] value identification callbacks
-
-//-----------------------------------------------------------------------------------------------------
-// Constants
-static const int muOPRT_ASCT_LEFT  = 0;
-static const int muOPRT_ASCT_RIGHT = 1;
-
-static const int muBASETYPE_FLOAT  = 0;
-static const int muBASETYPE_INT    = 1;
-
-//-----------------------------------------------------------------------------------------------------
-//
-//
-// muParser C compatible bindings
-//
-//
-//-----------------------------------------------------------------------------------------------------
-
-
-// Basic operations / initialization  
-API_EXPORT(muParserHandle_t) mupCreate(int nBaseType);
-API_EXPORT(void) mupRelease(muParserHandle_t a_hParser);
-API_EXPORT(const muChar_t*) mupGetExpr(muParserHandle_t a_hParser);
-API_EXPORT(void) mupSetExpr(muParserHandle_t a_hParser, const muChar_t *a_szExpr);
-API_EXPORT(void) mupSetVarFactory(muParserHandle_t a_hParser, muFacFun_t a_pFactory, void* pUserData);
-API_EXPORT(const muChar_t*) mupGetVersion(muParserHandle_t a_hParser);
-API_EXPORT(muFloat_t) mupEval(muParserHandle_t a_hParser);
-API_EXPORT(muFloat_t*) mupEvalMulti(muParserHandle_t a_hParser, int *nNum);
-API_EXPORT(void) mupEvalBulk(muParserHandle_t a_hParser, muFloat_t *a_fResult, int nSize);
-
-// Defining callbacks / variables / constants
-API_EXPORT(void) mupDefineFun0(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun0_t a_pFun, muBool_t a_bOptimize);
-API_EXPORT(void) mupDefineFun1(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun1_t a_pFun, muBool_t a_bOptimize);
-API_EXPORT(void) mupDefineFun2(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun2_t a_pFun, muBool_t a_bOptimize);
-API_EXPORT(void) mupDefineFun3(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun3_t a_pFun, muBool_t a_bOptimize);
-API_EXPORT(void) mupDefineFun4(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun4_t a_pFun, muBool_t a_bOptimize);
-API_EXPORT(void) mupDefineFun5(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun5_t a_pFun, muBool_t a_bOptimize);
-API_EXPORT(void) mupDefineFun6(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun6_t a_pFun, muBool_t a_bOptimize);
-API_EXPORT(void) mupDefineFun7(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun7_t a_pFun, muBool_t a_bOptimize);
-API_EXPORT(void) mupDefineFun8(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun8_t a_pFun, muBool_t a_bOptimize);
-API_EXPORT(void) mupDefineFun9(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun9_t a_pFun, muBool_t a_bOptimize);
-API_EXPORT(void) mupDefineFun10(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun10_t a_pFun, muBool_t a_bOptimize);
-
-// Defining bulkmode functions
-API_EXPORT(void) mupDefineBulkFun0(muParserHandle_t a_hParser, const muChar_t *a_szName, muBulkFun0_t a_pFun);
-API_EXPORT(void) mupDefineBulkFun1(muParserHandle_t a_hParser, const muChar_t *a_szName, muBulkFun1_t a_pFun);
-API_EXPORT(void) mupDefineBulkFun2(muParserHandle_t a_hParser, const muChar_t *a_szName, muBulkFun2_t a_pFun);
-API_EXPORT(void) mupDefineBulkFun3(muParserHandle_t a_hParser, const muChar_t *a_szName, muBulkFun3_t a_pFun);
-API_EXPORT(void) mupDefineBulkFun4(muParserHandle_t a_hParser, const muChar_t *a_szName, muBulkFun4_t a_pFun);
-API_EXPORT(void) mupDefineBulkFun5(muParserHandle_t a_hParser, const muChar_t *a_szName, muBulkFun5_t a_pFun);
-API_EXPORT(void) mupDefineBulkFun6(muParserHandle_t a_hParser, const muChar_t *a_szName, muBulkFun6_t a_pFun);
-API_EXPORT(void) mupDefineBulkFun7(muParserHandle_t a_hParser, const muChar_t *a_szName, muBulkFun7_t a_pFun);
-API_EXPORT(void) mupDefineBulkFun8(muParserHandle_t a_hParser, const muChar_t *a_szName, muBulkFun8_t a_pFun);
-API_EXPORT(void) mupDefineBulkFun9(muParserHandle_t a_hParser, const muChar_t *a_szName, muBulkFun9_t a_pFun);
-API_EXPORT(void) mupDefineBulkFun10(muParserHandle_t a_hParser, const muChar_t *a_szName, muBulkFun10_t a_pFun);
-
-// string functions
-API_EXPORT(void) mupDefineStrFun1(muParserHandle_t a_hParser, const muChar_t *a_szName, muStrFun1_t a_pFun);
-API_EXPORT(void) mupDefineStrFun2(muParserHandle_t a_hParser, const muChar_t *a_szName, muStrFun2_t a_pFun);
-API_EXPORT(void) mupDefineStrFun3(muParserHandle_t a_hParser, const muChar_t *a_szName, muStrFun3_t a_pFun);
-
-API_EXPORT(void) mupDefineMultFun( muParserHandle_t a_hParser, 
-                                   const muChar_t* a_szName, 
-                                   muMultFun_t a_pFun, 
-                                   muBool_t a_bOptimize);
-
-API_EXPORT(void) mupDefineOprt( muParserHandle_t a_hParser, 
-                                const muChar_t* a_szName, 
-                                muFun2_t a_pFun, 
-                                muInt_t a_nPrec, 
-                                muInt_t a_nOprtAsct,
-                                muBool_t a_bOptimize);
-
-API_EXPORT(void) mupDefineConst( muParserHandle_t a_hParser, 
-                                 const muChar_t* a_szName, 
-                                 muFloat_t a_fVal );
-
-API_EXPORT(void) mupDefineStrConst( muParserHandle_t a_hParser, 
-                                    const muChar_t* a_szName, 
-                                    const muChar_t *a_sVal );
-
-API_EXPORT(void) mupDefineVar( muParserHandle_t a_hParser, 
-                               const muChar_t* a_szName, 
-                               muFloat_t *a_fVar);
-
-API_EXPORT(void) mupDefineBulkVar( muParserHandle_t a_hParser, 
-                               const muChar_t* a_szName, 
-                               muFloat_t *a_fVar);
-
-API_EXPORT(void) mupDefinePostfixOprt( muParserHandle_t a_hParser, 
-                                       const muChar_t* a_szName, 
-                                       muFun1_t a_pOprt, 
-                                       muBool_t a_bOptimize);
-
-
-API_EXPORT(void) mupDefineInfixOprt( muParserHandle_t a_hParser, 
-                                     const muChar_t* a_szName, 
-                                     muFun1_t a_pOprt, 
-                                     muBool_t a_bOptimize);
-
-// Define character sets for identifiers
-API_EXPORT(void) mupDefineNameChars(muParserHandle_t a_hParser, const muChar_t* a_szCharset);
-API_EXPORT(void) mupDefineOprtChars(muParserHandle_t a_hParser, const muChar_t* a_szCharset);
-API_EXPORT(void) mupDefineInfixOprtChars(muParserHandle_t a_hParser, const muChar_t* a_szCharset);
-
-// Remove all / single variables
-API_EXPORT(void) mupRemoveVar(muParserHandle_t a_hParser, const muChar_t* a_szName);
-API_EXPORT(void) mupClearVar(muParserHandle_t a_hParser);
-API_EXPORT(void) mupClearConst(muParserHandle_t a_hParser);
-API_EXPORT(void) mupClearOprt(muParserHandle_t a_hParser);
-API_EXPORT(void) mupClearFun(muParserHandle_t a_hParser);
-
-// Querying variables / expression variables / constants
-API_EXPORT(int) mupGetExprVarNum(muParserHandle_t a_hParser);
-API_EXPORT(int) mupGetVarNum(muParserHandle_t a_hParser);
-API_EXPORT(int) mupGetConstNum(muParserHandle_t a_hParser);
-API_EXPORT(void) mupGetExprVar(muParserHandle_t a_hParser, unsigned a_iVar, const muChar_t** a_pszName, muFloat_t** a_pVar);
-API_EXPORT(void) mupGetVar(muParserHandle_t a_hParser, unsigned a_iVar, const muChar_t** a_pszName, muFloat_t** a_pVar);
-API_EXPORT(void) mupGetConst(muParserHandle_t a_hParser, unsigned a_iVar, const muChar_t** a_pszName, muFloat_t* a_pVar);
-API_EXPORT(void) mupSetArgSep(muParserHandle_t a_hParser, const muChar_t cArgSep);
-API_EXPORT(void) mupSetDecSep(muParserHandle_t a_hParser, const muChar_t cArgSep);
-API_EXPORT(void) mupSetThousandsSep(muParserHandle_t a_hParser, const muChar_t cArgSep);
-API_EXPORT(void) mupResetLocale(muParserHandle_t a_hParser);
-
-// Add value recognition callbacks
-API_EXPORT(void) mupAddValIdent(muParserHandle_t a_hParser, muIdentFun_t);
-
-// Error handling
-API_EXPORT(muBool_t) mupError(muParserHandle_t a_hParser);
-API_EXPORT(void) mupErrorReset(muParserHandle_t a_hParser);
-API_EXPORT(void) mupSetErrorHandler(muParserHandle_t a_hParser, muErrorHandler_t a_pErrHandler);
-API_EXPORT(const muChar_t*) mupGetErrorMsg(muParserHandle_t a_hParser);
-API_EXPORT(muInt_t) mupGetErrorCode(muParserHandle_t a_hParser);
-API_EXPORT(muInt_t) mupGetErrorPos(muParserHandle_t a_hParser);
-API_EXPORT(const muChar_t*) mupGetErrorToken(muParserHandle_t a_hParser);
-//API_EXPORT(const muChar_t*) mupGetErrorExpr(muParserHandle_t a_hParser);
-
-// This is used for .NET only. It creates a new variable allowing the dll to
-// manage the variable rather than the .NET garbage collector.
-API_EXPORT(muFloat_t*) mupCreateVar();
-API_EXPORT(void) mupReleaseVar(muFloat_t*);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // include guard
+/*
+                 __________
+    _____   __ __\______   \_____  _______  ______  ____ _______
+   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
+  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
+  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|
+        \/                       \/            \/      \/
+  Copyright (C) 2011 Ingo Berg
+
+  Permission is hereby granted, free of charge, to any person obtaining a copy of this
+  software and associated documentation files (the "Software"), to deal in the Software
+  without restriction, including without limitation the rights to use, copy, modify,
+  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
+  permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included in all copies or
+  substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
+  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#ifndef MU_PARSER_DLL_H
+#define MU_PARSER_DLL_H
+
+#if defined(WIN32) || defined(_WIN32)
+    #ifdef MUPARSERLIB_EXPORTS
+        #define API_EXPORT(TYPE) __declspec(dllexport) TYPE __cdecl
+    #else
+        #define API_EXPORT(TYPE) __declspec(dllimport) TYPE __cdecl
+    #endif
+#else
+    #define API_EXPORT(TYPE) TYPE
+#endif
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/** \file
+    \brief This file contains the DLL interface of muparser.
+*/
+
+// Basic types
+typedef void*  muParserHandle_t;    // parser handle
+
+#ifndef _UNICODE
+    typedef char   muChar_t;            // character type
+#else
+    typedef wchar_t   muChar_t;            // character type
+#endif
+
+typedef int    muBool_t;            // boolean type
+typedef int    muInt_t;             // integer type
+typedef double muFloat_t;           // floating point type
+
+// function types for calculation
+typedef muFloat_t (*muFun0_t )();
+typedef muFloat_t (*muFun1_t )(muFloat_t);
+typedef muFloat_t (*muFun2_t )(muFloat_t, muFloat_t);
+typedef muFloat_t (*muFun3_t )(muFloat_t, muFloat_t, muFloat_t);
+typedef muFloat_t (*muFun4_t )(muFloat_t, muFloat_t, muFloat_t, muFloat_t);
+typedef muFloat_t (*muFun5_t )(muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t);
+typedef muFloat_t (*muFun6_t )(muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t);
+typedef muFloat_t (*muFun7_t )(muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t);
+typedef muFloat_t (*muFun8_t )(muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t);
+typedef muFloat_t (*muFun9_t )(muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t);
+typedef muFloat_t (*muFun10_t)(muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t);
+
+// Function prototypes for bulkmode functions
+typedef muFloat_t (*muBulkFun0_t )(int, int);
+typedef muFloat_t (*muBulkFun1_t )(int, int, muFloat_t);
+typedef muFloat_t (*muBulkFun2_t )(int, int, muFloat_t, muFloat_t);
+typedef muFloat_t (*muBulkFun3_t )(int, int, muFloat_t, muFloat_t, muFloat_t);
+typedef muFloat_t (*muBulkFun4_t )(int, int, muFloat_t, muFloat_t, muFloat_t, muFloat_t);
+typedef muFloat_t (*muBulkFun5_t )(int, int, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t);
+typedef muFloat_t (*muBulkFun6_t )(int, int, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t);
+typedef muFloat_t (*muBulkFun7_t )(int, int, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t);
+typedef muFloat_t (*muBulkFun8_t )(int, int, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t);
+typedef muFloat_t (*muBulkFun9_t )(int, int, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t);
+typedef muFloat_t (*muBulkFun10_t)(int, int, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t, muFloat_t);
+
+typedef muFloat_t (*muMultFun_t)(const muFloat_t*, muInt_t);
+typedef muFloat_t (*muStrFun1_t)(const muChar_t*);
+typedef muFloat_t (*muStrFun2_t)(const muChar_t*, muFloat_t);
+typedef muFloat_t (*muStrFun3_t)(const muChar_t*, muFloat_t, muFloat_t);
+
+// Functions for parser management
+typedef void (*muErrorHandler_t)(muParserHandle_t a_hParser);           // [optional] callback to an error handler
+typedef muFloat_t* (*muFacFun_t)(const muChar_t*, void*);               // [optional] callback for creating new variables
+typedef muInt_t (*muIdentFun_t)(const muChar_t*, muInt_t*, muFloat_t*); // [optional] value identification callbacks
+
+//-----------------------------------------------------------------------------------------------------
+// Constants
+static const int muOPRT_ASCT_LEFT  = 0;
+static const int muOPRT_ASCT_RIGHT = 1;
+
+static const int muBASETYPE_FLOAT  = 0;
+static const int muBASETYPE_INT    = 1;
+
+//-----------------------------------------------------------------------------------------------------
+//
+//
+// muParser C compatible bindings
+//
+//
+//-----------------------------------------------------------------------------------------------------
+
+
+// Basic operations / initialization
+API_EXPORT(muParserHandle_t) mupCreate(int nBaseType);
+API_EXPORT(void) mupRelease(muParserHandle_t a_hParser);
+API_EXPORT(const muChar_t*) mupGetExpr(muParserHandle_t a_hParser);
+API_EXPORT(void) mupSetExpr(muParserHandle_t a_hParser, const muChar_t *a_szExpr);
+API_EXPORT(void) mupSetVarFactory(muParserHandle_t a_hParser, muFacFun_t a_pFactory, void* pUserData);
+API_EXPORT(const muChar_t*) mupGetVersion(muParserHandle_t a_hParser);
+API_EXPORT(muFloat_t) mupEval(muParserHandle_t a_hParser);
+API_EXPORT(muFloat_t*) mupEvalMulti(muParserHandle_t a_hParser, int *nNum);
+API_EXPORT(void) mupEvalBulk(muParserHandle_t a_hParser, muFloat_t *a_fResult, int nSize);
+
+// Defining callbacks / variables / constants
+API_EXPORT(void) mupDefineFun0(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun0_t a_pFun, muBool_t a_bOptimize);
+API_EXPORT(void) mupDefineFun1(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun1_t a_pFun, muBool_t a_bOptimize);
+API_EXPORT(void) mupDefineFun2(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun2_t a_pFun, muBool_t a_bOptimize);
+API_EXPORT(void) mupDefineFun3(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun3_t a_pFun, muBool_t a_bOptimize);
+API_EXPORT(void) mupDefineFun4(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun4_t a_pFun, muBool_t a_bOptimize);
+API_EXPORT(void) mupDefineFun5(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun5_t a_pFun, muBool_t a_bOptimize);
+API_EXPORT(void) mupDefineFun6(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun6_t a_pFun, muBool_t a_bOptimize);
+API_EXPORT(void) mupDefineFun7(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun7_t a_pFun, muBool_t a_bOptimize);
+API_EXPORT(void) mupDefineFun8(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun8_t a_pFun, muBool_t a_bOptimize);
+API_EXPORT(void) mupDefineFun9(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun9_t a_pFun, muBool_t a_bOptimize);
+API_EXPORT(void) mupDefineFun10(muParserHandle_t a_hParser, const muChar_t *a_szName, muFun10_t a_pFun, muBool_t a_bOptimize);
+
+// Defining bulkmode functions
+API_EXPORT(void) mupDefineBulkFun0(muParserHandle_t a_hParser, const muChar_t *a_szName, muBulkFun0_t a_pFun);
+API_EXPORT(void) mupDefineBulkFun1(muParserHandle_t a_hParser, const muChar_t *a_szName, muBulkFun1_t a_pFun);
+API_EXPORT(void) mupDefineBulkFun2(muParserHandle_t a_hParser, const muChar_t *a_szName, muBulkFun2_t a_pFun);
+API_EXPORT(void) mupDefineBulkFun3(muParserHandle_t a_hParser, const muChar_t *a_szName, muBulkFun3_t a_pFun);
+API_EXPORT(void) mupDefineBulkFun4(muParserHandle_t a_hParser, const muChar_t *a_szName, muBulkFun4_t a_pFun);
+API_EXPORT(void) mupDefineBulkFun5(muParserHandle_t a_hParser, const muChar_t *a_szName, muBulkFun5_t a_pFun);
+API_EXPORT(void) mupDefineBulkFun6(muParserHandle_t a_hParser, const muChar_t *a_szName, muBulkFun6_t a_pFun);
+API_EXPORT(void) mupDefineBulkFun7(muParserHandle_t a_hParser, const muChar_t *a_szName, muBulkFun7_t a_pFun);
+API_EXPORT(void) mupDefineBulkFun8(muParserHandle_t a_hParser, const muChar_t *a_szName, muBulkFun8_t a_pFun);
+API_EXPORT(void) mupDefineBulkFun9(muParserHandle_t a_hParser, const muChar_t *a_szName, muBulkFun9_t a_pFun);
+API_EXPORT(void) mupDefineBulkFun10(muParserHandle_t a_hParser, const muChar_t *a_szName, muBulkFun10_t a_pFun);
+
+// string functions
+API_EXPORT(void) mupDefineStrFun1(muParserHandle_t a_hParser, const muChar_t *a_szName, muStrFun1_t a_pFun);
+API_EXPORT(void) mupDefineStrFun2(muParserHandle_t a_hParser, const muChar_t *a_szName, muStrFun2_t a_pFun);
+API_EXPORT(void) mupDefineStrFun3(muParserHandle_t a_hParser, const muChar_t *a_szName, muStrFun3_t a_pFun);
+
+API_EXPORT(void) mupDefineMultFun( muParserHandle_t a_hParser,
+                                   const muChar_t* a_szName,
+                                   muMultFun_t a_pFun,
+                                   muBool_t a_bOptimize);
+
+API_EXPORT(void) mupDefineOprt( muParserHandle_t a_hParser,
+                                const muChar_t* a_szName,
+                                muFun2_t a_pFun,
+                                muInt_t a_nPrec,
+                                muInt_t a_nOprtAsct,
+                                muBool_t a_bOptimize);
+
+API_EXPORT(void) mupDefineConst( muParserHandle_t a_hParser,
+                                 const muChar_t* a_szName,
+                                 muFloat_t a_fVal );
+
+API_EXPORT(void) mupDefineStrConst( muParserHandle_t a_hParser,
+                                    const muChar_t* a_szName,
+                                    const muChar_t *a_sVal );
+
+API_EXPORT(void) mupDefineVar( muParserHandle_t a_hParser,
+                               const muChar_t* a_szName,
+                               muFloat_t *a_fVar);
+
+API_EXPORT(void) mupDefineBulkVar( muParserHandle_t a_hParser,
+                               const muChar_t* a_szName,
+                               muFloat_t *a_fVar);
+
+API_EXPORT(void) mupDefinePostfixOprt( muParserHandle_t a_hParser,
+                                       const muChar_t* a_szName,
+                                       muFun1_t a_pOprt,
+                                       muBool_t a_bOptimize);
+
+
+API_EXPORT(void) mupDefineInfixOprt( muParserHandle_t a_hParser,
+                                     const muChar_t* a_szName,
+                                     muFun1_t a_pOprt,
+                                     muBool_t a_bOptimize);
+
+// Define character sets for identifiers
+API_EXPORT(void) mupDefineNameChars(muParserHandle_t a_hParser, const muChar_t* a_szCharset);
+API_EXPORT(void) mupDefineOprtChars(muParserHandle_t a_hParser, const muChar_t* a_szCharset);
+API_EXPORT(void) mupDefineInfixOprtChars(muParserHandle_t a_hParser, const muChar_t* a_szCharset);
+
+// Remove all / single variables
+API_EXPORT(void) mupRemoveVar(muParserHandle_t a_hParser, const muChar_t* a_szName);
+API_EXPORT(void) mupClearVar(muParserHandle_t a_hParser);
+API_EXPORT(void) mupClearConst(muParserHandle_t a_hParser);
+API_EXPORT(void) mupClearOprt(muParserHandle_t a_hParser);
+API_EXPORT(void) mupClearFun(muParserHandle_t a_hParser);
+
+// Querying variables / expression variables / constants
+API_EXPORT(int) mupGetExprVarNum(muParserHandle_t a_hParser);
+API_EXPORT(int) mupGetVarNum(muParserHandle_t a_hParser);
+API_EXPORT(int) mupGetConstNum(muParserHandle_t a_hParser);
+API_EXPORT(void) mupGetExprVar(muParserHandle_t a_hParser, unsigned a_iVar, const muChar_t** a_pszName, muFloat_t** a_pVar);
+API_EXPORT(void) mupGetVar(muParserHandle_t a_hParser, unsigned a_iVar, const muChar_t** a_pszName, muFloat_t** a_pVar);
+API_EXPORT(void) mupGetConst(muParserHandle_t a_hParser, unsigned a_iVar, const muChar_t** a_pszName, muFloat_t* a_pVar);
+API_EXPORT(void) mupSetArgSep(muParserHandle_t a_hParser, const muChar_t cArgSep);
+API_EXPORT(void) mupSetDecSep(muParserHandle_t a_hParser, const muChar_t cArgSep);
+API_EXPORT(void) mupSetThousandsSep(muParserHandle_t a_hParser, const muChar_t cArgSep);
+API_EXPORT(void) mupResetLocale(muParserHandle_t a_hParser);
+
+// Add value recognition callbacks
+API_EXPORT(void) mupAddValIdent(muParserHandle_t a_hParser, muIdentFun_t);
+
+// Error handling
+API_EXPORT(muBool_t) mupError(muParserHandle_t a_hParser);
+API_EXPORT(void) mupErrorReset(muParserHandle_t a_hParser);
+API_EXPORT(void) mupSetErrorHandler(muParserHandle_t a_hParser, muErrorHandler_t a_pErrHandler);
+API_EXPORT(const muChar_t*) mupGetErrorMsg(muParserHandle_t a_hParser);
+API_EXPORT(muInt_t) mupGetErrorCode(muParserHandle_t a_hParser);
+API_EXPORT(muInt_t) mupGetErrorPos(muParserHandle_t a_hParser);
+API_EXPORT(const muChar_t*) mupGetErrorToken(muParserHandle_t a_hParser);
+//API_EXPORT(const muChar_t*) mupGetErrorExpr(muParserHandle_t a_hParser);
+
+// This is used for .NET only. It creates a new variable allowing the dll to
+// manage the variable rather than the .NET garbage collector.
+API_EXPORT(muFloat_t*) mupCreateVar();
+API_EXPORT(void) mupReleaseVar(muFloat_t*);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // include guard
diff --git a/geometry/qmuparser/muParserDef.h b/geometry/qmuparser/muParserDef.h
old mode 100755
new mode 100644
index 437f2ea..543a392
--- a/geometry/qmuparser/muParserDef.h
+++ b/geometry/qmuparser/muParserDef.h
@@ -1,368 +1,370 @@
-/*
-                 __________                                      
-    _____   __ __\______   \_____  _______  ______  ____ _______ 
-   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
-  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
-  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|   
-        \/                       \/            \/      \/        
-  Copyright (C) 2014 Ingo Berg
-
-  Permission is hereby granted, free of charge, to any person obtaining a copy of this 
-  software and associated documentation files (the "Software"), to deal in the Software
-  without restriction, including without limitation the rights to use, copy, modify, 
-  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 
-  permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-  The above copyright notice and this permission notice shall be included in all copies or 
-  substantial portions of the Software.
-
-  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
-  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
-  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
-  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
-  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
-*/
-#ifndef MUP_DEF_H
-#define MUP_DEF_H
-
-#include <iostream>
-#include <string>
-#include <sstream>
-#include <map>
-
-#include "muParserFixes.h"
-
-/** \file
-    \brief This file contains standard definitions used by the parser.
-*/
-
-#define MUP_VERSION _T("2.2.5")
-#define MUP_VERSION_DATE _T("20150427; GC")
-
-#define MUP_CHARS _T("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
-
-/** \brief If this macro is defined mathematical exceptions (div by zero) will be thrown as exceptions. */
-//#define MUP_MATH_EXCEPTIONS
-
-/** \brief Define the base datatype for values.
-
-  This datatype must be a built in value type. You can not use custom classes.
-  It should be working with all types except "int"!
-*/
-#define MUP_BASETYPE double
-
-/** \brief Activate this option in order to compile with OpenMP support. 
-
-  OpenMP is used only in the bulk mode it may increase the performance a bit. 
-*/
-//#define MUP_USE_OPENMP
-
-#if defined(_UNICODE)
-  /** \brief Definition of the basic parser string type. */
-  #define MUP_STRING_TYPE std::wstring
-
-  #if !defined(_T)
-    #define _T(x) L##x
-  #endif // not defined _T
-#else
-  #ifndef _T
-  #define _T(x) x
-  #endif
-  
-  /** \brief Definition of the basic parser string type. */
-  #define MUP_STRING_TYPE std::string
-#endif
-
-#if defined(_DEBUG)
-  /** \brief Debug macro to force an abortion of the programm with a certain message.
-  */
-  #define MUP_FAIL(MSG)     \
-          {                 \
-            bool MSG=false; \
-            assert(MSG);    \
-          }
-
-    /** \brief An assertion that does not kill the program.
-
-        This macro is neutralised in UNICODE builds. It's
-        too difficult to translate.
-    */
-    #define MUP_ASSERT(COND)                         \
-            if (!(COND))                             \
-            {                                        \
-              stringstream_type ss;                  \
-              ss << _T("Assertion \"") _T(#COND) _T("\" failed: ") \
-                 << __FILE__ << _T(" line ")         \
-                 << __LINE__ << _T(".");             \
-              throw ParserError( ss.str() );         \
-            }
-#else
-  #define MUP_FAIL(MSG)
-  #define MUP_ASSERT(COND)
-#endif
-
-
-namespace mu
-{
-#if defined(_UNICODE)
-
-  //------------------------------------------------------------------------------
-  /** \brief Encapsulate wcout. */
-  inline std::wostream& console()
-  {
-    return std::wcout;
-  }
-
-  /** \brief Encapsulate cin. */
-  inline std::wistream& console_in()
-  {
-    return std::wcin;
-  }
-
-#else
-
-  /** \brief Encapsulate cout. 
-  
-    Used for supporting UNICODE more easily.
-  */
-  inline std::ostream& console()
-  {
-    return std::cout;
-  }
-
-  /** \brief Encapsulate cin. 
-
-    Used for supporting UNICODE more easily.
-  */
-  inline std::istream& console_in()
-  {
-    return std::cin;
-  }
-
-#endif
-
-  //------------------------------------------------------------------------------
-  /** \brief Bytecode values.
-
-      \attention The order of the operator entries must match the order in ParserBase::c_DefaultOprt!
-  */
-  enum ECmdCode
-  {
-    // The following are codes for built in binary operators
-    // apart from built in operators the user has the opportunity to
-    // add user defined operators.
-    cmLE            = 0,   ///< Operator item:  less or equal
-    cmGE            = 1,   ///< Operator item:  greater or equal
-    cmNEQ           = 2,   ///< Operator item:  not equal
-    cmEQ            = 3,   ///< Operator item:  equals
-    cmLT            = 4,   ///< Operator item:  less than
-    cmGT            = 5,   ///< Operator item:  greater than
-    cmADD           = 6,   ///< Operator item:  add
-    cmSUB           = 7,   ///< Operator item:  subtract
-    cmMUL           = 8,   ///< Operator item:  multiply
-    cmDIV           = 9,   ///< Operator item:  division
-    cmPOW           = 10,  ///< Operator item:  y to the power of ...
-    cmLAND          = 11,
-    cmLOR           = 12,
-    cmASSIGN        = 13,  ///< Operator item:  Assignment operator
-    cmBO            = 14,  ///< Operator item:  opening bracket
-    cmBC            = 15,  ///< Operator item:  closing bracket
-    cmIF            = 16,  ///< For use in the ternary if-then-else operator
-    cmELSE          = 17,  ///< For use in the ternary if-then-else operator
-    cmENDIF         = 18,  ///< For use in the ternary if-then-else operator
-    cmARG_SEP       = 19,  ///< function argument separator
-    cmVAR           = 20,  ///< variable item
-    cmVAL           = 21,  ///< value item
-
-    // For optimization purposes
-    cmVARPOW2,
-    cmVARPOW3,
-    cmVARPOW4,
-    cmVARMUL,
-    cmPOW2,
-
-    // operators and functions
-    cmFUNC,                ///< Code for a generic function item
-    cmFUNC_STR,            ///< Code for a function with a string parameter
-    cmFUNC_BULK,           ///< Special callbacks for Bulk mode with an additional parameter for the bulk index 
-    cmSTRING,              ///< Code for a string token
-    cmOPRT_BIN,            ///< user defined binary operator
-    cmOPRT_POSTFIX,        ///< code for postfix operators
-    cmOPRT_INFIX,          ///< code for infix operators
-    cmEND,                 ///< end of formula
-    cmUNKNOWN              ///< uninitialized item
-  };
-
-  //------------------------------------------------------------------------------
-  /** \brief Types internally used by the parser.
-  */
-  enum ETypeCode
-  {
-    tpSTR  = 0,     ///< String type (Function arguments and constants only, no string variables)
-    tpDBL  = 1,     ///< Floating point variables
-    tpVOID = 2      ///< Undefined type.
-  };
-
-  //------------------------------------------------------------------------------
-  enum EParserVersionInfo
-  {
-    pviBRIEF,
-    pviFULL
-  };
-
-  //------------------------------------------------------------------------------
-  /** \brief Parser operator precedence values. */
-  enum EOprtAssociativity
-  {
-    oaLEFT  = 0,
-    oaRIGHT = 1,
-    oaNONE  = 2
-  };
-
-  //------------------------------------------------------------------------------
-  /** \brief Parser operator precedence values. */
-  enum EOprtPrecedence
-  {
-    // binary operators
-    prLOR     = 1,
-    prLAND    = 2,
-    prLOGIC   = 3,  ///< logic operators
-    prCMP     = 4,  ///< comparsion operators
-    prADD_SUB = 5,  ///< addition
-    prMUL_DIV = 6,  ///< multiplication/division
-    prPOW     = 7,  ///< power operator priority (highest)
-
-    // infix operators
-    prINFIX   = 6, ///< Signs have a higher priority than ADD_SUB, but lower than power operator
-    prPOSTFIX = 6  ///< Postfix operator priority (currently unused)
-  };
-
-  //------------------------------------------------------------------------------
-  // basic types
-
-  /** \brief The numeric datatype used by the parser. 
-  
-    Normally this is a floating point type either single or double precision.
-  */
-  typedef MUP_BASETYPE value_type;
-
-  /** \brief The stringtype used by the parser. 
-
-    Depends on wether UNICODE is used or not.
-  */
-  typedef MUP_STRING_TYPE string_type;
-
-  /** \brief The character type used by the parser. 
-  
-    Depends on wether UNICODE is used or not.
-  */
-  typedef string_type::value_type char_type;
-
-  /** \brief Typedef for easily using stringstream that respect the parser stringtype. */
-  typedef std::basic_stringstream<char_type,
-                                  std::char_traits<char_type>,
-                                  std::allocator<char_type> > stringstream_type;
-
-  // Data container types
-
-  /** \brief Type used for storing variables. */
-  typedef std::map<string_type, value_type*> varmap_type;
-  
-  /** \brief Type used for storing constants. */
-  typedef std::map<string_type, value_type> valmap_type;
-  
-  /** \brief Type for assigning a string name to an index in the internal string table. */
-  typedef std::map<string_type, std::size_t> strmap_type;
-
-  // Parser callbacks
-  
-  /** \brief Callback type used for functions without arguments. */
-  typedef value_type (*generic_fun_type)();
-
-  /** \brief Callback type used for functions without arguments. */
-  typedef value_type (*fun_type0)();
-
-  /** \brief Callback type used for functions with a single arguments. */
-  typedef value_type (*fun_type1)(value_type);
-
-  /** \brief Callback type used for functions with two arguments. */
-  typedef value_type (*fun_type2)(value_type, value_type);
-
-  /** \brief Callback type used for functions with three arguments. */
-  typedef value_type (*fun_type3)(value_type, value_type, value_type);
-
-  /** \brief Callback type used for functions with four arguments. */
-  typedef value_type (*fun_type4)(value_type, value_type, value_type, value_type);
-
-  /** \brief Callback type used for functions with five arguments. */
-  typedef value_type (*fun_type5)(value_type, value_type, value_type, value_type, value_type);
-
-  /** \brief Callback type used for functions with five arguments. */
-  typedef value_type (*fun_type6)(value_type, value_type, value_type, value_type, value_type, value_type);
-
-  /** \brief Callback type used for functions with five arguments. */
-  typedef value_type (*fun_type7)(value_type, value_type, value_type, value_type, value_type, value_type, value_type);
-
-  /** \brief Callback type used for functions with five arguments. */
-  typedef value_type (*fun_type8)(value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type);
-
-  /** \brief Callback type used for functions with five arguments. */
-  typedef value_type (*fun_type9)(value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type);
-
-  /** \brief Callback type used for functions with five arguments. */
-  typedef value_type (*fun_type10)(value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type);
-
-  /** \brief Callback type used for functions without arguments. */
-  typedef value_type (*bulkfun_type0)(int, int);
-
-  /** \brief Callback type used for functions with a single arguments. */
-  typedef value_type (*bulkfun_type1)(int, int, value_type);
-
-  /** \brief Callback type used for functions with two arguments. */
-  typedef value_type (*bulkfun_type2)(int, int, value_type, value_type);
-
-  /** \brief Callback type used for functions with three arguments. */
-  typedef value_type (*bulkfun_type3)(int, int, value_type, value_type, value_type);
-
-  /** \brief Callback type used for functions with four arguments. */
-  typedef value_type (*bulkfun_type4)(int, int, value_type, value_type, value_type, value_type);
-
-  /** \brief Callback type used for functions with five arguments. */
-  typedef value_type (*bulkfun_type5)(int, int, value_type, value_type, value_type, value_type, value_type);
-
-  /** \brief Callback type used for functions with five arguments. */
-  typedef value_type (*bulkfun_type6)(int, int, value_type, value_type, value_type, value_type, value_type, value_type);
-
-  /** \brief Callback type used for functions with five arguments. */
-  typedef value_type (*bulkfun_type7)(int, int, value_type, value_type, value_type, value_type, value_type, value_type, value_type);
-
-  /** \brief Callback type used for functions with five arguments. */
-  typedef value_type (*bulkfun_type8)(int, int, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type);
-
-  /** \brief Callback type used for functions with five arguments. */
-  typedef value_type (*bulkfun_type9)(int, int, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type);
-
-  /** \brief Callback type used for functions with five arguments. */
-  typedef value_type (*bulkfun_type10)(int, int, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type);
-
-  /** \brief Callback type used for functions with a variable argument list. */
-  typedef value_type (*multfun_type)(const value_type*, int);
-
-  /** \brief Callback type used for functions taking a string as an argument. */
-  typedef value_type (*strfun_type1)(const char_type*);
-
-  /** \brief Callback type used for functions taking a string and a value as arguments. */
-  typedef value_type (*strfun_type2)(const char_type*, value_type);
-
-  /** \brief Callback type used for functions taking a string and two values as arguments. */
-  typedef value_type (*strfun_type3)(const char_type*, value_type, value_type);
-
-  /** \brief Callback used for functions that identify values in a string. */
-  typedef int (*identfun_type)(const char_type *sExpr, int *nPos, value_type *fVal);
-
-  /** \brief Callback used for variable creation factory functions. */
-  typedef value_type* (*facfun_type)(const char_type*, void*);
-} // end of namespace
-
-#endif
-
+/*
+                 __________
+    _____   __ __\______   \_____  _______  ______  ____ _______
+   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
+  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
+  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|
+        \/                       \/            \/      \/
+  Copyright (C) 2014 Ingo Berg
+
+  Permission is hereby granted, free of charge, to any person obtaining a copy of this
+  software and associated documentation files (the "Software"), to deal in the Software
+  without restriction, including without limitation the rights to use, copy, modify,
+  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
+  permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included in all copies or
+  substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
+  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#ifndef MUP_DEF_H
+#define MUP_DEF_H
+
+#include <iostream>
+#include <string>
+#include <sstream>
+#include <map>
+
+#include "muParserFixes.h"
+
+/** \file
+    \brief This file contains standard definitions used by the parser.
+*/
+
+#define MUP_VERSION _T("2.2.5")
+#define MUP_VERSION_DATE _T("20150427; GC")
+
+#define MUP_CHARS _T("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
+
+/** \brief If this macro is defined mathematical exceptions (div by zero) will be thrown as exceptions. */
+//#define MUP_MATH_EXCEPTIONS
+
+/** \brief Define the base datatype for values.
+
+  This datatype must be a built in value type. You can not use custom classes.
+  It should be working with all types except "int"!
+*/
+#ifndef MUP_BASETYPE
+# define MUP_BASETYPE double
+#endif /* MUP_BASETYPE */
+
+/** \brief Activate this option in order to compile with OpenMP support.
+
+  OpenMP is used only in the bulk mode it may increase the performance a bit.
+*/
+//#define MUP_USE_OPENMP
+
+#if defined(_UNICODE)
+  /** \brief Definition of the basic parser string type. */
+  #define MUP_STRING_TYPE std::wstring
+
+  #if !defined(_T)
+    #define _T(x) L##x
+  #endif // not defined _T
+#else
+  #ifndef _T
+  #define _T(x) x
+  #endif
+
+  /** \brief Definition of the basic parser string type. */
+  #define MUP_STRING_TYPE std::string
+#endif
+
+#if defined(_DEBUG)
+  /** \brief Debug macro to force an abortion of the programm with a certain message.
+  */
+  #define MUP_FAIL(MSG)     \
+          {                 \
+            bool MSG=false; \
+            assert(MSG);    \
+          }
+
+    /** \brief An assertion that does not kill the program.
+
+        This macro is neutralised in UNICODE builds. It's
+        too difficult to translate.
+    */
+    #define MUP_ASSERT(COND)                         \
+            if (!(COND))                             \
+            {                                        \
+              stringstream_type ss;                  \
+              ss << _T("Assertion \"") _T(#COND) _T("\" failed: ") \
+                 << __FILE__ << _T(" line ")         \
+                 << __LINE__ << _T(".");             \
+              throw ParserError( ss.str() );         \
+            }
+#else
+  #define MUP_FAIL(MSG)
+  #define MUP_ASSERT(COND)
+#endif
+
+
+namespace mu
+{
+#if defined(_UNICODE)
+
+  //------------------------------------------------------------------------------
+  /** \brief Encapsulate wcout. */
+  inline std::wostream& console()
+  {
+    return std::wcout;
+  }
+
+  /** \brief Encapsulate cin. */
+  inline std::wistream& console_in()
+  {
+    return std::wcin;
+  }
+
+#else
+
+  /** \brief Encapsulate cout.
+
+    Used for supporting UNICODE more easily.
+  */
+  inline std::ostream& console()
+  {
+    return std::cout;
+  }
+
+  /** \brief Encapsulate cin.
+
+    Used for supporting UNICODE more easily.
+  */
+  inline std::istream& console_in()
+  {
+    return std::cin;
+  }
+
+#endif
+
+  //------------------------------------------------------------------------------
+  /** \brief Bytecode values.
+
+      \attention The order of the operator entries must match the order in ParserBase::c_DefaultOprt!
+  */
+  enum ECmdCode
+  {
+    // The following are codes for built in binary operators
+    // apart from built in operators the user has the opportunity to
+    // add user defined operators.
+    cmLE            = 0,   ///< Operator item:  less or equal
+    cmGE            = 1,   ///< Operator item:  greater or equal
+    cmNEQ           = 2,   ///< Operator item:  not equal
+    cmEQ            = 3,   ///< Operator item:  equals
+    cmLT            = 4,   ///< Operator item:  less than
+    cmGT            = 5,   ///< Operator item:  greater than
+    cmADD           = 6,   ///< Operator item:  add
+    cmSUB           = 7,   ///< Operator item:  subtract
+    cmMUL           = 8,   ///< Operator item:  multiply
+    cmDIV           = 9,   ///< Operator item:  division
+    cmPOW           = 10,  ///< Operator item:  y to the power of ...
+    cmLAND          = 11,
+    cmLOR           = 12,
+    cmASSIGN        = 13,  ///< Operator item:  Assignment operator
+    cmBO            = 14,  ///< Operator item:  opening bracket
+    cmBC            = 15,  ///< Operator item:  closing bracket
+    cmIF            = 16,  ///< For use in the ternary if-then-else operator
+    cmELSE          = 17,  ///< For use in the ternary if-then-else operator
+    cmENDIF         = 18,  ///< For use in the ternary if-then-else operator
+    cmARG_SEP       = 19,  ///< function argument separator
+    cmVAR           = 20,  ///< variable item
+    cmVAL           = 21,  ///< value item
+
+    // For optimization purposes
+    cmVARPOW2,
+    cmVARPOW3,
+    cmVARPOW4,
+    cmVARMUL,
+    cmPOW2,
+
+    // operators and functions
+    cmFUNC,                ///< Code for a generic function item
+    cmFUNC_STR,            ///< Code for a function with a string parameter
+    cmFUNC_BULK,           ///< Special callbacks for Bulk mode with an additional parameter for the bulk index
+    cmSTRING,              ///< Code for a string token
+    cmOPRT_BIN,            ///< user defined binary operator
+    cmOPRT_POSTFIX,        ///< code for postfix operators
+    cmOPRT_INFIX,          ///< code for infix operators
+    cmEND,                 ///< end of formula
+    cmUNKNOWN              ///< uninitialized item
+  };
+
+  //------------------------------------------------------------------------------
+  /** \brief Types internally used by the parser.
+  */
+  enum ETypeCode
+  {
+    tpSTR  = 0,     ///< String type (Function arguments and constants only, no string variables)
+    tpDBL  = 1,     ///< Floating point variables
+    tpVOID = 2      ///< Undefined type.
+  };
+
+  //------------------------------------------------------------------------------
+  enum EParserVersionInfo
+  {
+    pviBRIEF,
+    pviFULL
+  };
+
+  //------------------------------------------------------------------------------
+  /** \brief Parser operator precedence values. */
+  enum EOprtAssociativity
+  {
+    oaLEFT  = 0,
+    oaRIGHT = 1,
+    oaNONE  = 2
+  };
+
+  //------------------------------------------------------------------------------
+  /** \brief Parser operator precedence values. */
+  enum EOprtPrecedence
+  {
+    // binary operators
+    prLOR     = 1,
+    prLAND    = 2,
+    prLOGIC   = 3,  ///< logic operators
+    prCMP     = 4,  ///< comparsion operators
+    prADD_SUB = 5,  ///< addition
+    prMUL_DIV = 6,  ///< multiplication/division
+    prPOW     = 7,  ///< power operator priority (highest)
+
+    // infix operators
+    prINFIX   = 6, ///< Signs have a higher priority than ADD_SUB, but lower than power operator
+    prPOSTFIX = 6  ///< Postfix operator priority (currently unused)
+  };
+
+  //------------------------------------------------------------------------------
+  // basic types
+
+  /** \brief The numeric datatype used by the parser.
+
+    Normally this is a floating point type either single or double precision.
+  */
+  typedef MUP_BASETYPE value_type;
+
+  /** \brief The stringtype used by the parser.
+
+    Depends on wether UNICODE is used or not.
+  */
+  typedef MUP_STRING_TYPE string_type;
+
+  /** \brief The character type used by the parser.
+
+    Depends on wether UNICODE is used or not.
+  */
+  typedef string_type::value_type char_type;
+
+  /** \brief Typedef for easily using stringstream that respect the parser stringtype. */
+  typedef std::basic_stringstream<char_type,
+                                  std::char_traits<char_type>,
+                                  std::allocator<char_type> > stringstream_type;
+
+  // Data container types
+
+  /** \brief Type used for storing variables. */
+  typedef std::map<string_type, value_type*> varmap_type;
+
+  /** \brief Type used for storing constants. */
+  typedef std::map<string_type, value_type> valmap_type;
+
+  /** \brief Type for assigning a string name to an index in the internal string table. */
+  typedef std::map<string_type, std::size_t> strmap_type;
+
+  // Parser callbacks
+
+  /** \brief Callback type used for functions without arguments. */
+  typedef value_type (*generic_fun_type)();
+
+  /** \brief Callback type used for functions without arguments. */
+  typedef value_type (*fun_type0)();
+
+  /** \brief Callback type used for functions with a single arguments. */
+  typedef value_type (*fun_type1)(value_type);
+
+  /** \brief Callback type used for functions with two arguments. */
+  typedef value_type (*fun_type2)(value_type, value_type);
+
+  /** \brief Callback type used for functions with three arguments. */
+  typedef value_type (*fun_type3)(value_type, value_type, value_type);
+
+  /** \brief Callback type used for functions with four arguments. */
+  typedef value_type (*fun_type4)(value_type, value_type, value_type, value_type);
+
+  /** \brief Callback type used for functions with five arguments. */
+  typedef value_type (*fun_type5)(value_type, value_type, value_type, value_type, value_type);
+
+  /** \brief Callback type used for functions with five arguments. */
+  typedef value_type (*fun_type6)(value_type, value_type, value_type, value_type, value_type, value_type);
+
+  /** \brief Callback type used for functions with five arguments. */
+  typedef value_type (*fun_type7)(value_type, value_type, value_type, value_type, value_type, value_type, value_type);
+
+  /** \brief Callback type used for functions with five arguments. */
+  typedef value_type (*fun_type8)(value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type);
+
+  /** \brief Callback type used for functions with five arguments. */
+  typedef value_type (*fun_type9)(value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type);
+
+  /** \brief Callback type used for functions with five arguments. */
+  typedef value_type (*fun_type10)(value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type);
+
+  /** \brief Callback type used for functions without arguments. */
+  typedef value_type (*bulkfun_type0)(int, int);
+
+  /** \brief Callback type used for functions with a single arguments. */
+  typedef value_type (*bulkfun_type1)(int, int, value_type);
+
+  /** \brief Callback type used for functions with two arguments. */
+  typedef value_type (*bulkfun_type2)(int, int, value_type, value_type);
+
+  /** \brief Callback type used for functions with three arguments. */
+  typedef value_type (*bulkfun_type3)(int, int, value_type, value_type, value_type);
+
+  /** \brief Callback type used for functions with four arguments. */
+  typedef value_type (*bulkfun_type4)(int, int, value_type, value_type, value_type, value_type);
+
+  /** \brief Callback type used for functions with five arguments. */
+  typedef value_type (*bulkfun_type5)(int, int, value_type, value_type, value_type, value_type, value_type);
+
+  /** \brief Callback type used for functions with five arguments. */
+  typedef value_type (*bulkfun_type6)(int, int, value_type, value_type, value_type, value_type, value_type, value_type);
+
+  /** \brief Callback type used for functions with five arguments. */
+  typedef value_type (*bulkfun_type7)(int, int, value_type, value_type, value_type, value_type, value_type, value_type, value_type);
+
+  /** \brief Callback type used for functions with five arguments. */
+  typedef value_type (*bulkfun_type8)(int, int, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type);
+
+  /** \brief Callback type used for functions with five arguments. */
+  typedef value_type (*bulkfun_type9)(int, int, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type);
+
+  /** \brief Callback type used for functions with five arguments. */
+  typedef value_type (*bulkfun_type10)(int, int, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type);
+
+  /** \brief Callback type used for functions with a variable argument list. */
+  typedef value_type (*multfun_type)(const value_type*, int);
+
+  /** \brief Callback type used for functions taking a string as an argument. */
+  typedef value_type (*strfun_type1)(const char_type*);
+
+  /** \brief Callback type used for functions taking a string and a value as arguments. */
+  typedef value_type (*strfun_type2)(const char_type*, value_type);
+
+  /** \brief Callback type used for functions taking a string and two values as arguments. */
+  typedef value_type (*strfun_type3)(const char_type*, value_type, value_type);
+
+  /** \brief Callback used for functions that identify values in a string. */
+  typedef int (*identfun_type)(const char_type *sExpr, int *nPos, value_type *fVal);
+
+  /** \brief Callback used for variable creation factory functions. */
+  typedef value_type* (*facfun_type)(const char_type*, void*);
+} // end of namespace
+
+#endif
+
diff --git a/geometry/qmuparser/muParserError.cpp b/geometry/qmuparser/muParserError.cpp
old mode 100755
new mode 100644
index 6fe4e1d..3a1e28f
--- a/geometry/qmuparser/muParserError.cpp
+++ b/geometry/qmuparser/muParserError.cpp
@@ -1,337 +1,337 @@
-/*
-                 __________                                      
-    _____   __ __\______   \_____  _______  ______  ____ _______ 
-   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
-  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
-  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|   
-        \/                       \/            \/      \/        
-  Copyright (C) 2011 Ingo Berg
-
-  Permission is hereby granted, free of charge, to any person obtaining a copy of this 
-  software and associated documentation files (the "Software"), to deal in the Software
-  without restriction, including without limitation the rights to use, copy, modify, 
-  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 
-  permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-  The above copyright notice and this permission notice shall be included in all copies or 
-  substantial portions of the Software.
-
-  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
-  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
-  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
-  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
-  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
-*/
-#include "muParserError.h"
-
-
-namespace mu
-{
-  const ParserErrorMsg ParserErrorMsg::m_Instance;
-
-  //------------------------------------------------------------------------------
-  const ParserErrorMsg& ParserErrorMsg::Instance()
-  {
-    return m_Instance;
-  }
-
-  //------------------------------------------------------------------------------
-  string_type ParserErrorMsg::operator[](unsigned a_iIdx) const
-  {
-    return (a_iIdx<m_vErrMsg.size()) ? m_vErrMsg[a_iIdx] : string_type();
-  }
-
-  //---------------------------------------------------------------------------
-  ParserErrorMsg::~ParserErrorMsg()
-  {}
-
-  //---------------------------------------------------------------------------
-  /** \brief Assignement operator is deactivated.
-  */
-  ParserErrorMsg& ParserErrorMsg::operator=(const ParserErrorMsg& )
-  {
-    assert(false);
-    return *this;
-  }
-
-  //---------------------------------------------------------------------------
-  ParserErrorMsg::ParserErrorMsg(const ParserErrorMsg&)
-  {}
-
-  //---------------------------------------------------------------------------
-  ParserErrorMsg::ParserErrorMsg()
-    :m_vErrMsg(0)
-  {
-    m_vErrMsg.resize(ecCOUNT);
-
-    m_vErrMsg[ecUNASSIGNABLE_TOKEN]     = _T("Unexpected token \"$TOK$\" found at position $POS$.");
-    m_vErrMsg[ecINTERNAL_ERROR]         = _T("Internal error");
-    m_vErrMsg[ecINVALID_NAME]           = _T("Invalid function-, variable- or constant name: \"$TOK$\".");
-    m_vErrMsg[ecINVALID_BINOP_IDENT]    = _T("Invalid binary operator identifier: \"$TOK$\".");
-    m_vErrMsg[ecINVALID_INFIX_IDENT]    = _T("Invalid infix operator identifier: \"$TOK$\".");
-    m_vErrMsg[ecINVALID_POSTFIX_IDENT]  = _T("Invalid postfix operator identifier: \"$TOK$\".");
-    m_vErrMsg[ecINVALID_FUN_PTR]        = _T("Invalid pointer to callback function.");
-    m_vErrMsg[ecEMPTY_EXPRESSION]       = _T("Expression is empty.");
-    m_vErrMsg[ecINVALID_VAR_PTR]        = _T("Invalid pointer to variable.");
-    m_vErrMsg[ecUNEXPECTED_OPERATOR]    = _T("Unexpected operator \"$TOK$\" found at position $POS$");
-    m_vErrMsg[ecUNEXPECTED_EOF]         = _T("Unexpected end of expression at position $POS$");
-    m_vErrMsg[ecUNEXPECTED_ARG_SEP]     = _T("Unexpected argument separator at position $POS$");
-    m_vErrMsg[ecUNEXPECTED_PARENS]      = _T("Unexpected parenthesis \"$TOK$\" at position $POS$");
-    m_vErrMsg[ecUNEXPECTED_FUN]         = _T("Unexpected function \"$TOK$\" at position $POS$");
-    m_vErrMsg[ecUNEXPECTED_VAL]         = _T("Unexpected value \"$TOK$\" found at position $POS$");
-    m_vErrMsg[ecUNEXPECTED_VAR]         = _T("Unexpected variable \"$TOK$\" found at position $POS$");
-    m_vErrMsg[ecUNEXPECTED_ARG]         = _T("Function arguments used without a function (position: $POS$)");
-    m_vErrMsg[ecMISSING_PARENS]         = _T("Missing parenthesis");
-    m_vErrMsg[ecTOO_MANY_PARAMS]        = _T("Too many parameters for function \"$TOK$\" at expression position $POS$");
-    m_vErrMsg[ecTOO_FEW_PARAMS]         = _T("Too few parameters for function \"$TOK$\" at expression position $POS$");
-    m_vErrMsg[ecDIV_BY_ZERO]            = _T("Divide by zero");
-    m_vErrMsg[ecDOMAIN_ERROR]           = _T("Domain error");
-    m_vErrMsg[ecNAME_CONFLICT]          = _T("Name conflict");
-    m_vErrMsg[ecOPT_PRI]                = _T("Invalid value for operator priority (must be greater or equal to zero).");
-    m_vErrMsg[ecBUILTIN_OVERLOAD]       = _T("user defined binary operator \"$TOK$\" conflicts with a built in operator.");
-    m_vErrMsg[ecUNEXPECTED_STR]         = _T("Unexpected string token found at position $POS$.");
-    m_vErrMsg[ecUNTERMINATED_STRING]    = _T("Unterminated string starting at position $POS$.");
-    m_vErrMsg[ecSTRING_EXPECTED]        = _T("String function called with a non string type of argument.");
-    m_vErrMsg[ecVAL_EXPECTED]           = _T("String value used where a numerical argument is expected.");
-    m_vErrMsg[ecOPRT_TYPE_CONFLICT]     = _T("No suitable overload for operator \"$TOK$\" at position $POS$.");
-    m_vErrMsg[ecSTR_RESULT]             = _T("Function result is a string.");
-    m_vErrMsg[ecGENERIC]                = _T("Parser error.");
-    m_vErrMsg[ecLOCALE]                 = _T("Decimal separator is identic to function argument separator.");
-    m_vErrMsg[ecUNEXPECTED_CONDITIONAL] = _T("The \"$TOK$\" operator must be preceeded by a closing bracket.");
-    m_vErrMsg[ecMISSING_ELSE_CLAUSE]    = _T("If-then-else operator is missing an else clause");
-    m_vErrMsg[ecMISPLACED_COLON]        = _T("Misplaced colon at position $POS$");
-    m_vErrMsg[ecUNREASONABLE_NUMBER_OF_COMPUTATIONS] = _T("Number of computations to small for bulk mode. (Vectorisation overhead too costly)");
-    
-    #if defined(_DEBUG)
-      for (int i=0; i<ecCOUNT; ++i)
-        if (!m_vErrMsg[i].length())
-          assert(false);
-    #endif
-  }
-
-  //---------------------------------------------------------------------------
-  //
-  //  ParserError class
-  //
-  //---------------------------------------------------------------------------
-
-  /** \brief Default constructor. */
-  ParserError::ParserError()
-    :m_strMsg()
-    ,m_strFormula()
-    ,m_strTok()
-    ,m_iPos(-1)
-    ,m_iErrc(ecUNDEFINED)
-    ,m_ErrMsg(ParserErrorMsg::Instance())
-  {
-  }
-
-  //------------------------------------------------------------------------------
-  /** \brief This Constructor is used for internal exceptions only. 
-      
-    It does not contain any information but the error code.
-  */
-  ParserError::ParserError(EErrorCodes a_iErrc) 
-    :m_strMsg()
-    ,m_strFormula()
-    ,m_strTok()
-    ,m_iPos(-1)
-    ,m_iErrc(a_iErrc)
-    ,m_ErrMsg(ParserErrorMsg::Instance())
-  {
-    m_strMsg = m_ErrMsg[m_iErrc];
-    stringstream_type stream;
-    stream << (int)m_iPos;
-    ReplaceSubString(m_strMsg, _T("$POS$"), stream.str());
-    ReplaceSubString(m_strMsg, _T("$TOK$"), m_strTok);
-  }
-
-  //------------------------------------------------------------------------------
-  /** \brief Construct an error from a message text. */
-  ParserError::ParserError(const string_type &sMsg) 
-    :m_ErrMsg(ParserErrorMsg::Instance())
-  {
-    Reset();
-    m_strMsg = sMsg;
-  }
-
-  //------------------------------------------------------------------------------
-  /** \brief Construct an error object. 
-      \param [in] a_iErrc the error code.
-      \param [in] sTok The token string related to this error.
-      \param [in] sExpr The expression related to the error.
-      \param [in] a_iPos the position in the expression where the error occurred. 
-  */
-  ParserError::ParserError( EErrorCodes iErrc,
-                            const string_type &sTok,
-                            const string_type &sExpr,
-                            int iPos )
-    :m_strMsg()
-    ,m_strFormula(sExpr)
-    ,m_strTok(sTok)
-    ,m_iPos(iPos)
-    ,m_iErrc(iErrc)
-    ,m_ErrMsg(ParserErrorMsg::Instance())
-  {
-    m_strMsg = m_ErrMsg[m_iErrc];
-    stringstream_type stream;
-    stream << (int)m_iPos;
-    ReplaceSubString(m_strMsg, _T("$POS$"), stream.str());
-    ReplaceSubString(m_strMsg, _T("$TOK$"), m_strTok);
-  }
-
-  //------------------------------------------------------------------------------
-  /** \brief Construct an error object. 
-      \param [in] iErrc the error code.
-      \param [in] iPos the position in the expression where the error occurred. 
-      \param [in] sTok The token string related to this error.
-  */
-  ParserError::ParserError(EErrorCodes iErrc, int iPos, const string_type &sTok) 
-    :m_strMsg()
-    ,m_strFormula()
-    ,m_strTok(sTok)
-    ,m_iPos(iPos)
-    ,m_iErrc(iErrc)
-    ,m_ErrMsg(ParserErrorMsg::Instance())
-  {
-    m_strMsg = m_ErrMsg[m_iErrc];
-    stringstream_type stream;
-    stream << (int)m_iPos;
-    ReplaceSubString(m_strMsg, _T("$POS$"), stream.str());
-    ReplaceSubString(m_strMsg, _T("$TOK$"), m_strTok);
-  }
-
-  //------------------------------------------------------------------------------
-  /** \brief Construct an error object. 
-      \param [in] szMsg The error message text.
-      \param [in] iPos the position related to the error.
-      \param [in] sTok The token string related to this error.
-  */
-  ParserError::ParserError(const char_type *szMsg, int iPos, const string_type &sTok) 
-    :m_strMsg(szMsg)
-    ,m_strFormula()
-    ,m_strTok(sTok)
-    ,m_iPos(iPos)
-    ,m_iErrc(ecGENERIC)
-    ,m_ErrMsg(ParserErrorMsg::Instance())
-  {
-    stringstream_type stream;
-    stream << (int)m_iPos;
-    ReplaceSubString(m_strMsg, _T("$POS$"), stream.str());
-    ReplaceSubString(m_strMsg, _T("$TOK$"), m_strTok);
-  }
-
-  //------------------------------------------------------------------------------
-  /** \brief Copy constructor. */
-  ParserError::ParserError(const ParserError &a_Obj)
-    :m_strMsg(a_Obj.m_strMsg)
-    ,m_strFormula(a_Obj.m_strFormula)
-    ,m_strTok(a_Obj.m_strTok)
-    ,m_iPos(a_Obj.m_iPos)
-    ,m_iErrc(a_Obj.m_iErrc)
-    ,m_ErrMsg(ParserErrorMsg::Instance())
-  {
-  }
-
-  //------------------------------------------------------------------------------
-  /** \brief Assignment operator. */
-  ParserError& ParserError::operator=(const ParserError &a_Obj)
-  {
-    if (this==&a_Obj)
-      return *this;
-
-    m_strMsg = a_Obj.m_strMsg;
-    m_strFormula = a_Obj.m_strFormula;
-    m_strTok = a_Obj.m_strTok;
-    m_iPos = a_Obj.m_iPos;
-    m_iErrc = a_Obj.m_iErrc;
-    return *this;
-  }
-
-  //------------------------------------------------------------------------------
-  ParserError::~ParserError()
-  {}
-
-  //------------------------------------------------------------------------------
-  /** \brief Replace all occurrences of a substring with another string. 
-      \param strFind The string that shall be replaced.
-      \param strReplaceWith The string that should be inserted instead of strFind
-  */
-  void ParserError::ReplaceSubString( string_type &strSource,
-                                      const string_type &strFind,
-                                      const string_type &strReplaceWith)
-  {
-    string_type strResult;
-    string_type::size_type iPos(0), iNext(0);
-
-    for(;;)
-    {
-      iNext = strSource.find(strFind, iPos);
-      strResult.append(strSource, iPos, iNext-iPos);
-
-      if( iNext==string_type::npos )
-        break;
-
-      strResult.append(strReplaceWith);
-      iPos = iNext + strFind.length();
-    } 
-
-    strSource.swap(strResult);
-  }
-
-  //------------------------------------------------------------------------------
-  /** \brief Reset the erro object. */
-  void ParserError::Reset()
-  {
-    m_strMsg = _T("");
-    m_strFormula = _T("");
-    m_strTok = _T("");
-    m_iPos = -1;
-    m_iErrc = ecUNDEFINED;
-  }
-      
-  //------------------------------------------------------------------------------
-  /** \brief Set the expression related to this error. */
-  void ParserError::SetFormula(const string_type &a_strFormula)
-  {
-    m_strFormula = a_strFormula;
-  }
-
-  //------------------------------------------------------------------------------
-  /** \brief gets the expression related tp this error.*/
-  const string_type& ParserError::GetExpr() const 
-  {
-    return m_strFormula;
-  }
-
-  //------------------------------------------------------------------------------
-  /** \brief Returns the message string for this error. */
-  const string_type& ParserError::GetMsg() const
-  {
-    return m_strMsg;
-  }
-
-  //------------------------------------------------------------------------------
-  /** \brief Return the formula position related to the error. 
-
-    If the error is not related to a distinct position this will return -1
-  */
-  int ParserError::GetPos() const
-  {
-    return m_iPos;
-  }
-
-  //------------------------------------------------------------------------------
-  /** \brief Return string related with this token (if available). */
-  const string_type& ParserError::GetToken() const
-  {
-    return m_strTok;
-  }
-
-  //------------------------------------------------------------------------------
-  /** \brief Return the error code. */
-  EErrorCodes ParserError::GetCode() const
-  {
-    return m_iErrc;
-  }
-} // namespace mu
+/*
+                 __________
+    _____   __ __\______   \_____  _______  ______  ____ _______
+   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
+  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
+  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|
+        \/                       \/            \/      \/
+  Copyright (C) 2011 Ingo Berg
+
+  Permission is hereby granted, free of charge, to any person obtaining a copy of this
+  software and associated documentation files (the "Software"), to deal in the Software
+  without restriction, including without limitation the rights to use, copy, modify,
+  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
+  permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included in all copies or
+  substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
+  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#include "muParserError.h"
+
+
+namespace mu
+{
+  const ParserErrorMsg ParserErrorMsg::m_Instance;
+
+  //------------------------------------------------------------------------------
+  const ParserErrorMsg& ParserErrorMsg::Instance()
+  {
+    return m_Instance;
+  }
+
+  //------------------------------------------------------------------------------
+  string_type ParserErrorMsg::operator[](unsigned a_iIdx) const
+  {
+    return (a_iIdx<m_vErrMsg.size()) ? m_vErrMsg[a_iIdx] : string_type();
+  }
+
+  //---------------------------------------------------------------------------
+  ParserErrorMsg::~ParserErrorMsg()
+  {}
+
+  //---------------------------------------------------------------------------
+  /** \brief Assignement operator is deactivated.
+  */
+  ParserErrorMsg& ParserErrorMsg::operator=(const ParserErrorMsg& )
+  {
+    assert(false);
+    return *this;
+  }
+
+  //---------------------------------------------------------------------------
+  ParserErrorMsg::ParserErrorMsg(const ParserErrorMsg&)
+  {}
+
+  //---------------------------------------------------------------------------
+  ParserErrorMsg::ParserErrorMsg()
+    :m_vErrMsg(0)
+  {
+    m_vErrMsg.resize(ecCOUNT);
+
+    m_vErrMsg[ecUNASSIGNABLE_TOKEN]     = _T("Unexpected token \"$TOK$\" found at position $POS$.");
+    m_vErrMsg[ecINTERNAL_ERROR]         = _T("Internal error");
+    m_vErrMsg[ecINVALID_NAME]           = _T("Invalid function-, variable- or constant name: \"$TOK$\".");
+    m_vErrMsg[ecINVALID_BINOP_IDENT]    = _T("Invalid binary operator identifier: \"$TOK$\".");
+    m_vErrMsg[ecINVALID_INFIX_IDENT]    = _T("Invalid infix operator identifier: \"$TOK$\".");
+    m_vErrMsg[ecINVALID_POSTFIX_IDENT]  = _T("Invalid postfix operator identifier: \"$TOK$\".");
+    m_vErrMsg[ecINVALID_FUN_PTR]        = _T("Invalid pointer to callback function.");
+    m_vErrMsg[ecEMPTY_EXPRESSION]       = _T("Expression is empty.");
+    m_vErrMsg[ecINVALID_VAR_PTR]        = _T("Invalid pointer to variable.");
+    m_vErrMsg[ecUNEXPECTED_OPERATOR]    = _T("Unexpected operator \"$TOK$\" found at position $POS$");
+    m_vErrMsg[ecUNEXPECTED_EOF]         = _T("Unexpected end of expression at position $POS$");
+    m_vErrMsg[ecUNEXPECTED_ARG_SEP]     = _T("Unexpected argument separator at position $POS$");
+    m_vErrMsg[ecUNEXPECTED_PARENS]      = _T("Unexpected parenthesis \"$TOK$\" at position $POS$");
+    m_vErrMsg[ecUNEXPECTED_FUN]         = _T("Unexpected function \"$TOK$\" at position $POS$");
+    m_vErrMsg[ecUNEXPECTED_VAL]         = _T("Unexpected value \"$TOK$\" found at position $POS$");
+    m_vErrMsg[ecUNEXPECTED_VAR]         = _T("Unexpected variable \"$TOK$\" found at position $POS$");
+    m_vErrMsg[ecUNEXPECTED_ARG]         = _T("Function arguments used without a function (position: $POS$)");
+    m_vErrMsg[ecMISSING_PARENS]         = _T("Missing parenthesis");
+    m_vErrMsg[ecTOO_MANY_PARAMS]        = _T("Too many parameters for function \"$TOK$\" at expression position $POS$");
+    m_vErrMsg[ecTOO_FEW_PARAMS]         = _T("Too few parameters for function \"$TOK$\" at expression position $POS$");
+    m_vErrMsg[ecDIV_BY_ZERO]            = _T("Divide by zero");
+    m_vErrMsg[ecDOMAIN_ERROR]           = _T("Domain error");
+    m_vErrMsg[ecNAME_CONFLICT]          = _T("Name conflict");
+    m_vErrMsg[ecOPT_PRI]                = _T("Invalid value for operator priority (must be greater or equal to zero).");
+    m_vErrMsg[ecBUILTIN_OVERLOAD]       = _T("user defined binary operator \"$TOK$\" conflicts with a built in operator.");
+    m_vErrMsg[ecUNEXPECTED_STR]         = _T("Unexpected string token found at position $POS$.");
+    m_vErrMsg[ecUNTERMINATED_STRING]    = _T("Unterminated string starting at position $POS$.");
+    m_vErrMsg[ecSTRING_EXPECTED]        = _T("String function called with a non string type of argument.");
+    m_vErrMsg[ecVAL_EXPECTED]           = _T("String value used where a numerical argument is expected.");
+    m_vErrMsg[ecOPRT_TYPE_CONFLICT]     = _T("No suitable overload for operator \"$TOK$\" at position $POS$.");
+    m_vErrMsg[ecSTR_RESULT]             = _T("Function result is a string.");
+    m_vErrMsg[ecGENERIC]                = _T("Parser error.");
+    m_vErrMsg[ecLOCALE]                 = _T("Decimal separator is identic to function argument separator.");
+    m_vErrMsg[ecUNEXPECTED_CONDITIONAL] = _T("The \"$TOK$\" operator must be preceded by a closing bracket.");
+    m_vErrMsg[ecMISSING_ELSE_CLAUSE]    = _T("If-then-else operator is missing an else clause");
+    m_vErrMsg[ecMISPLACED_COLON]        = _T("Misplaced colon at position $POS$");
+    m_vErrMsg[ecUNREASONABLE_NUMBER_OF_COMPUTATIONS] = _T("Number of computations to small for bulk mode. (Vectorisation overhead too costly)");
+
+    #if defined(_DEBUG)
+      for (int i=0; i<ecCOUNT; ++i)
+        if (!m_vErrMsg[i].length())
+          assert(false);
+    #endif
+  }
+
+  //---------------------------------------------------------------------------
+  //
+  //  ParserError class
+  //
+  //---------------------------------------------------------------------------
+
+  /** \brief Default constructor. */
+  ParserError::ParserError()
+    :m_strMsg()
+    ,m_strFormula()
+    ,m_strTok()
+    ,m_iPos(-1)
+    ,m_iErrc(ecUNDEFINED)
+    ,m_ErrMsg(ParserErrorMsg::Instance())
+  {
+  }
+
+  //------------------------------------------------------------------------------
+  /** \brief This Constructor is used for internal exceptions only.
+
+    It does not contain any information but the error code.
+  */
+  ParserError::ParserError(EErrorCodes a_iErrc)
+    :m_strMsg()
+    ,m_strFormula()
+    ,m_strTok()
+    ,m_iPos(-1)
+    ,m_iErrc(a_iErrc)
+    ,m_ErrMsg(ParserErrorMsg::Instance())
+  {
+    m_strMsg = m_ErrMsg[m_iErrc];
+    stringstream_type stream;
+    stream << (int)m_iPos;
+    ReplaceSubString(m_strMsg, _T("$POS$"), stream.str());
+    ReplaceSubString(m_strMsg, _T("$TOK$"), m_strTok);
+  }
+
+  //------------------------------------------------------------------------------
+  /** \brief Construct an error from a message text. */
+  ParserError::ParserError(const string_type &sMsg)
+    :m_ErrMsg(ParserErrorMsg::Instance())
+  {
+    Reset();
+    m_strMsg = sMsg;
+  }
+
+  //------------------------------------------------------------------------------
+  /** \brief Construct an error object.
+      \param [in] a_iErrc the error code.
+      \param [in] sTok The token string related to this error.
+      \param [in] sExpr The expression related to the error.
+      \param [in] a_iPos the position in the expression where the error occurred.
+  */
+  ParserError::ParserError( EErrorCodes iErrc,
+                            const string_type &sTok,
+                            const string_type &sExpr,
+                            int iPos )
+    :m_strMsg()
+    ,m_strFormula(sExpr)
+    ,m_strTok(sTok)
+    ,m_iPos(iPos)
+    ,m_iErrc(iErrc)
+    ,m_ErrMsg(ParserErrorMsg::Instance())
+  {
+    m_strMsg = m_ErrMsg[m_iErrc];
+    stringstream_type stream;
+    stream << (int)m_iPos;
+    ReplaceSubString(m_strMsg, _T("$POS$"), stream.str());
+    ReplaceSubString(m_strMsg, _T("$TOK$"), m_strTok);
+  }
+
+  //------------------------------------------------------------------------------
+  /** \brief Construct an error object.
+      \param [in] iErrc the error code.
+      \param [in] iPos the position in the expression where the error occurred.
+      \param [in] sTok The token string related to this error.
+  */
+  ParserError::ParserError(EErrorCodes iErrc, int iPos, const string_type &sTok)
+    :m_strMsg()
+    ,m_strFormula()
+    ,m_strTok(sTok)
+    ,m_iPos(iPos)
+    ,m_iErrc(iErrc)
+    ,m_ErrMsg(ParserErrorMsg::Instance())
+  {
+    m_strMsg = m_ErrMsg[m_iErrc];
+    stringstream_type stream;
+    stream << (int)m_iPos;
+    ReplaceSubString(m_strMsg, _T("$POS$"), stream.str());
+    ReplaceSubString(m_strMsg, _T("$TOK$"), m_strTok);
+  }
+
+  //------------------------------------------------------------------------------
+  /** \brief Construct an error object.
+      \param [in] szMsg The error message text.
+      \param [in] iPos the position related to the error.
+      \param [in] sTok The token string related to this error.
+  */
+  ParserError::ParserError(const char_type *szMsg, int iPos, const string_type &sTok)
+    :m_strMsg(szMsg)
+    ,m_strFormula()
+    ,m_strTok(sTok)
+    ,m_iPos(iPos)
+    ,m_iErrc(ecGENERIC)
+    ,m_ErrMsg(ParserErrorMsg::Instance())
+  {
+    stringstream_type stream;
+    stream << (int)m_iPos;
+    ReplaceSubString(m_strMsg, _T("$POS$"), stream.str());
+    ReplaceSubString(m_strMsg, _T("$TOK$"), m_strTok);
+  }
+
+  //------------------------------------------------------------------------------
+  /** \brief Copy constructor. */
+  ParserError::ParserError(const ParserError &a_Obj)
+    :m_strMsg(a_Obj.m_strMsg)
+    ,m_strFormula(a_Obj.m_strFormula)
+    ,m_strTok(a_Obj.m_strTok)
+    ,m_iPos(a_Obj.m_iPos)
+    ,m_iErrc(a_Obj.m_iErrc)
+    ,m_ErrMsg(ParserErrorMsg::Instance())
+  {
+  }
+
+  //------------------------------------------------------------------------------
+  /** \brief Assignment operator. */
+  ParserError& ParserError::operator=(const ParserError &a_Obj)
+  {
+    if (this==&a_Obj)
+      return *this;
+
+    m_strMsg = a_Obj.m_strMsg;
+    m_strFormula = a_Obj.m_strFormula;
+    m_strTok = a_Obj.m_strTok;
+    m_iPos = a_Obj.m_iPos;
+    m_iErrc = a_Obj.m_iErrc;
+    return *this;
+  }
+
+  //------------------------------------------------------------------------------
+  ParserError::~ParserError()
+  {}
+
+  //------------------------------------------------------------------------------
+  /** \brief Replace all occurrences of a substring with another string.
+      \param strFind The string that shall be replaced.
+      \param strReplaceWith The string that should be inserted instead of strFind
+  */
+  void ParserError::ReplaceSubString( string_type &strSource,
+                                      const string_type &strFind,
+                                      const string_type &strReplaceWith)
+  {
+    string_type strResult;
+    string_type::size_type iPos(0), iNext(0);
+
+    for(;;)
+    {
+      iNext = strSource.find(strFind, iPos);
+      strResult.append(strSource, iPos, iNext-iPos);
+
+      if( iNext==string_type::npos )
+        break;
+
+      strResult.append(strReplaceWith);
+      iPos = iNext + strFind.length();
+    }
+
+    strSource.swap(strResult);
+  }
+
+  //------------------------------------------------------------------------------
+  /** \brief Reset the erro object. */
+  void ParserError::Reset()
+  {
+    m_strMsg = _T("");
+    m_strFormula = _T("");
+    m_strTok = _T("");
+    m_iPos = -1;
+    m_iErrc = ecUNDEFINED;
+  }
+
+  //------------------------------------------------------------------------------
+  /** \brief Set the expression related to this error. */
+  void ParserError::SetFormula(const string_type &a_strFormula)
+  {
+    m_strFormula = a_strFormula;
+  }
+
+  //------------------------------------------------------------------------------
+  /** \brief gets the expression related tp this error.*/
+  const string_type& ParserError::GetExpr() const
+  {
+    return m_strFormula;
+  }
+
+  //------------------------------------------------------------------------------
+  /** \brief Returns the message string for this error. */
+  const string_type& ParserError::GetMsg() const
+  {
+    return m_strMsg;
+  }
+
+  //------------------------------------------------------------------------------
+  /** \brief Return the formula position related to the error.
+
+    If the error is not related to a distinct position this will return -1
+  */
+  int ParserError::GetPos() const
+  {
+    return m_iPos;
+  }
+
+  //------------------------------------------------------------------------------
+  /** \brief Return string related with this token (if available). */
+  const string_type& ParserError::GetToken() const
+  {
+    return m_strTok;
+  }
+
+  //------------------------------------------------------------------------------
+  /** \brief Return the error code. */
+  EErrorCodes ParserError::GetCode() const
+  {
+    return m_iErrc;
+  }
+} // namespace mu
diff --git a/geometry/qmuparser/muParserError.h b/geometry/qmuparser/muParserError.h
old mode 100755
new mode 100644
index 7f88e99..fe817d8
--- a/geometry/qmuparser/muParserError.h
+++ b/geometry/qmuparser/muParserError.h
@@ -1,176 +1,176 @@
-/*
-                 __________                                      
-    _____   __ __\______   \_____  _______  ______  ____ _______ 
-   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
-  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
-  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|   
-        \/                       \/            \/      \/        
-  Copyright (C) 2004-2011 Ingo Berg
-
-  Permission is hereby granted, free of charge, to any person obtaining a copy of this 
-  software and associated documentation files (the "Software"), to deal in the Software
-  without restriction, including without limitation the rights to use, copy, modify, 
-  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 
-  permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-  The above copyright notice and this permission notice shall be included in all copies or 
-  substantial portions of the Software.
-
-  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
-  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
-  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
-  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
-  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
-*/
-
-#ifndef MU_PARSER_ERROR_H
-#define MU_PARSER_ERROR_H
-
-#include <cassert>
-#include <stdexcept>
-#include <string>
-#include <sstream>
-#include <vector>
-#include <memory>
-
-#include "muParserDef.h"
-
-/** \file 
-    \brief This file defines the error class used by the parser.
-*/
-
-namespace mu
-{
-
-/** \brief Error codes. */
-enum EErrorCodes
-{
-  // Formula syntax errors
-  ecUNEXPECTED_OPERATOR    = 0,  ///< Unexpected binary operator found
-  ecUNASSIGNABLE_TOKEN     = 1,  ///< Token cant be identified.
-  ecUNEXPECTED_EOF         = 2,  ///< Unexpected end of formula. (Example: "2+sin(")
-  ecUNEXPECTED_ARG_SEP     = 3,  ///< An unexpected comma has been found. (Example: "1,23")
-  ecUNEXPECTED_ARG         = 4,  ///< An unexpected argument has been found
-  ecUNEXPECTED_VAL         = 5,  ///< An unexpected value token has been found
-  ecUNEXPECTED_VAR         = 6,  ///< An unexpected variable token has been found
-  ecUNEXPECTED_PARENS      = 7,  ///< Unexpected Parenthesis, opening or closing
-  ecUNEXPECTED_STR         = 8,  ///< A string has been found at an inapropriate position
-  ecSTRING_EXPECTED        = 9,  ///< A string function has been called with a different type of argument
-  ecVAL_EXPECTED           = 10, ///< A numerical function has been called with a non value type of argument
-  ecMISSING_PARENS         = 11, ///< Missing parens. (Example: "3*sin(3")
-  ecUNEXPECTED_FUN         = 12, ///< Unexpected function found. (Example: "sin(8)cos(9)")
-  ecUNTERMINATED_STRING    = 13, ///< unterminated string constant. (Example: "3*valueof("hello)")
-  ecTOO_MANY_PARAMS        = 14, ///< Too many function parameters
-  ecTOO_FEW_PARAMS         = 15, ///< Too few function parameters. (Example: "ite(1<2,2)")
-  ecOPRT_TYPE_CONFLICT     = 16, ///< binary operators may only be applied to value items of the same type
-  ecSTR_RESULT             = 17, ///< result is a string
-
-  // Invalid Parser input Parameters
-  ecINVALID_NAME           = 18, ///< Invalid function, variable or constant name.
-  ecINVALID_BINOP_IDENT    = 19, ///< Invalid binary operator identifier
-  ecINVALID_INFIX_IDENT    = 20, ///< Invalid function, variable or constant name.
-  ecINVALID_POSTFIX_IDENT  = 21, ///< Invalid function, variable or constant name.
-
-  ecBUILTIN_OVERLOAD       = 22, ///< Trying to overload builtin operator
-  ecINVALID_FUN_PTR        = 23, ///< Invalid callback function pointer 
-  ecINVALID_VAR_PTR        = 24, ///< Invalid variable pointer 
-  ecEMPTY_EXPRESSION       = 25, ///< The Expression is empty
-  ecNAME_CONFLICT          = 26, ///< Name conflict
-  ecOPT_PRI                = 27, ///< Invalid operator priority
-  // 
-  ecDOMAIN_ERROR           = 28, ///< catch division by zero, sqrt(-1), log(0) (currently unused)
-  ecDIV_BY_ZERO            = 29, ///< Division by zero (currently unused)
-  ecGENERIC                = 30, ///< Generic error
-  ecLOCALE                 = 31, ///< Conflict with current locale
-
-  ecUNEXPECTED_CONDITIONAL = 32,
-  ecMISSING_ELSE_CLAUSE    = 33, 
-  ecMISPLACED_COLON        = 34,
-
-  ecUNREASONABLE_NUMBER_OF_COMPUTATIONS = 35,
-
-  // internal errors
-  ecINTERNAL_ERROR         = 36, ///< Internal error of any kind.
-  
-  // The last two are special entries 
-  ecCOUNT,                      ///< This is no error code, It just stores just the total number of error codes
-  ecUNDEFINED              = -1  ///< Undefined message, placeholder to detect unassigned error messages
-};
-
-//---------------------------------------------------------------------------
-/** \brief A class that handles the error messages.
-*/
-class ParserErrorMsg
-{
-public:
-    typedef ParserErrorMsg self_type;
-
-    ParserErrorMsg& operator=(const ParserErrorMsg &);
-    ParserErrorMsg(const ParserErrorMsg&);
-    ParserErrorMsg();
-
-   ~ParserErrorMsg();
-
-    static const ParserErrorMsg& Instance();
-    string_type operator[](unsigned a_iIdx) const;
-
-private:
-    std::vector<string_type>  m_vErrMsg;  ///< A vector with the predefined error messages
-    static const self_type m_Instance;    ///< The instance pointer
-};
-
-//---------------------------------------------------------------------------
-/** \brief Error class of the parser. 
-    \author Ingo Berg
-
-  Part of the math parser package.
-*/
-class ParserError
-{
-private:
-
-    /** \brief Replace all ocuurences of a substring with another string. */
-    void ReplaceSubString( string_type &strSource, 
-                           const string_type &strFind,
-                           const string_type &strReplaceWith);
-    void Reset();
-
-public:
-
-    ParserError();
-    explicit ParserError(EErrorCodes a_iErrc);
-    explicit ParserError(const string_type &sMsg);
-    ParserError( EErrorCodes a_iErrc,
-                 const string_type &sTok,
-                 const string_type &sFormula = string_type(),
-                 int a_iPos = -1);
-    ParserError( EErrorCodes a_iErrc, 
-                 int a_iPos, 
-                 const string_type &sTok);
-    ParserError( const char_type *a_szMsg, 
-                 int a_iPos = -1, 
-                 const string_type &sTok = string_type());
-    ParserError(const ParserError &a_Obj);
-    ParserError& operator=(const ParserError &a_Obj);
-   ~ParserError();
-
-    void SetFormula(const string_type &a_strFormula);
-    const string_type& GetExpr() const;
-    const string_type& GetMsg() const;
-    int GetPos() const;
-    const string_type& GetToken() const;
-    EErrorCodes GetCode() const;
-
-private:
-    string_type m_strMsg;     ///< The message string
-    string_type m_strFormula; ///< Formula string
-    string_type m_strTok;     ///< Token related with the error
-    int m_iPos;               ///< Formula position related to the error 
-    EErrorCodes m_iErrc;      ///< Error code
-    const ParserErrorMsg &m_ErrMsg;
-};		
-
-} // namespace mu
-
-#endif
-
+/*
+                 __________
+    _____   __ __\______   \_____  _______  ______  ____ _______
+   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
+  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
+  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|
+        \/                       \/            \/      \/
+  Copyright (C) 2004-2011 Ingo Berg
+
+  Permission is hereby granted, free of charge, to any person obtaining a copy of this
+  software and associated documentation files (the "Software"), to deal in the Software
+  without restriction, including without limitation the rights to use, copy, modify,
+  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
+  permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included in all copies or
+  substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
+  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef MU_PARSER_ERROR_H
+#define MU_PARSER_ERROR_H
+
+#include <cassert>
+#include <stdexcept>
+#include <string>
+#include <sstream>
+#include <vector>
+#include <memory>
+
+#include "muParserDef.h"
+
+/** \file
+    \brief This file defines the error class used by the parser.
+*/
+
+namespace mu
+{
+
+/** \brief Error codes. */
+enum EErrorCodes
+{
+  // Formula syntax errors
+  ecUNEXPECTED_OPERATOR    = 0,  ///< Unexpected binary operator found
+  ecUNASSIGNABLE_TOKEN     = 1,  ///< Token cant be identified.
+  ecUNEXPECTED_EOF         = 2,  ///< Unexpected end of formula. (Example: "2+sin(")
+  ecUNEXPECTED_ARG_SEP     = 3,  ///< An unexpected comma has been found. (Example: "1,23")
+  ecUNEXPECTED_ARG         = 4,  ///< An unexpected argument has been found
+  ecUNEXPECTED_VAL         = 5,  ///< An unexpected value token has been found
+  ecUNEXPECTED_VAR         = 6,  ///< An unexpected variable token has been found
+  ecUNEXPECTED_PARENS      = 7,  ///< Unexpected Parenthesis, opening or closing
+  ecUNEXPECTED_STR         = 8,  ///< A string has been found at an inapropriate position
+  ecSTRING_EXPECTED        = 9,  ///< A string function has been called with a different type of argument
+  ecVAL_EXPECTED           = 10, ///< A numerical function has been called with a non value type of argument
+  ecMISSING_PARENS         = 11, ///< Missing parens. (Example: "3*sin(3")
+  ecUNEXPECTED_FUN         = 12, ///< Unexpected function found. (Example: "sin(8)cos(9)")
+  ecUNTERMINATED_STRING    = 13, ///< unterminated string constant. (Example: "3*valueof("hello)")
+  ecTOO_MANY_PARAMS        = 14, ///< Too many function parameters
+  ecTOO_FEW_PARAMS         = 15, ///< Too few function parameters. (Example: "ite(1<2,2)")
+  ecOPRT_TYPE_CONFLICT     = 16, ///< binary operators may only be applied to value items of the same type
+  ecSTR_RESULT             = 17, ///< result is a string
+
+  // Invalid Parser input Parameters
+  ecINVALID_NAME           = 18, ///< Invalid function, variable or constant name.
+  ecINVALID_BINOP_IDENT    = 19, ///< Invalid binary operator identifier
+  ecINVALID_INFIX_IDENT    = 20, ///< Invalid function, variable or constant name.
+  ecINVALID_POSTFIX_IDENT  = 21, ///< Invalid function, variable or constant name.
+
+  ecBUILTIN_OVERLOAD       = 22, ///< Trying to overload builtin operator
+  ecINVALID_FUN_PTR        = 23, ///< Invalid callback function pointer
+  ecINVALID_VAR_PTR        = 24, ///< Invalid variable pointer
+  ecEMPTY_EXPRESSION       = 25, ///< The Expression is empty
+  ecNAME_CONFLICT          = 26, ///< Name conflict
+  ecOPT_PRI                = 27, ///< Invalid operator priority
+  //
+  ecDOMAIN_ERROR           = 28, ///< catch division by zero, sqrt(-1), log(0) (currently unused)
+  ecDIV_BY_ZERO            = 29, ///< Division by zero (currently unused)
+  ecGENERIC                = 30, ///< Generic error
+  ecLOCALE                 = 31, ///< Conflict with current locale
+
+  ecUNEXPECTED_CONDITIONAL = 32,
+  ecMISSING_ELSE_CLAUSE    = 33,
+  ecMISPLACED_COLON        = 34,
+
+  ecUNREASONABLE_NUMBER_OF_COMPUTATIONS = 35,
+
+  // internal errors
+  ecINTERNAL_ERROR         = 36, ///< Internal error of any kind.
+
+  // The last two are special entries
+  ecCOUNT,                      ///< This is no error code, It just stores just the total number of error codes
+  ecUNDEFINED              = -1  ///< Undefined message, placeholder to detect unassigned error messages
+};
+
+//---------------------------------------------------------------------------
+/** \brief A class that handles the error messages.
+*/
+class ParserErrorMsg
+{
+public:
+    typedef ParserErrorMsg self_type;
+
+    ParserErrorMsg& operator=(const ParserErrorMsg &);
+    ParserErrorMsg(const ParserErrorMsg&);
+    ParserErrorMsg();
+
+   ~ParserErrorMsg();
+
+    static const ParserErrorMsg& Instance();
+    string_type operator[](unsigned a_iIdx) const;
+
+private:
+    std::vector<string_type>  m_vErrMsg;  ///< A vector with the predefined error messages
+    static const self_type m_Instance;    ///< The instance pointer
+};
+
+//---------------------------------------------------------------------------
+/** \brief Error class of the parser.
+    \author Ingo Berg
+
+  Part of the math parser package.
+*/
+class ParserError
+{
+private:
+
+    /** \brief Replace all ocuurences of a substring with another string. */
+    void ReplaceSubString( string_type &strSource,
+                           const string_type &strFind,
+                           const string_type &strReplaceWith);
+    void Reset();
+
+public:
+
+    ParserError();
+    explicit ParserError(EErrorCodes a_iErrc);
+    explicit ParserError(const string_type &sMsg);
+    ParserError( EErrorCodes a_iErrc,
+                 const string_type &sTok,
+                 const string_type &sFormula = string_type(),
+                 int a_iPos = -1);
+    ParserError( EErrorCodes a_iErrc,
+                 int a_iPos,
+                 const string_type &sTok);
+    ParserError( const char_type *a_szMsg,
+                 int a_iPos = -1,
+                 const string_type &sTok = string_type());
+    ParserError(const ParserError &a_Obj);
+    ParserError& operator=(const ParserError &a_Obj);
+   ~ParserError();
+
+    void SetFormula(const string_type &a_strFormula);
+    const string_type& GetExpr() const;
+    const string_type& GetMsg() const;
+    int GetPos() const;
+    const string_type& GetToken() const;
+    EErrorCodes GetCode() const;
+
+private:
+    string_type m_strMsg;     ///< The message string
+    string_type m_strFormula; ///< Formula string
+    string_type m_strTok;     ///< Token related with the error
+    int m_iPos;               ///< Formula position related to the error
+    EErrorCodes m_iErrc;      ///< Error code
+    const ParserErrorMsg &m_ErrMsg;
+};
+
+} // namespace mu
+
+#endif
+
diff --git a/geometry/qmuparser/muParserFixes.h b/geometry/qmuparser/muParserFixes.h
old mode 100755
new mode 100644
index 1cd15e0..31d9c14
--- a/geometry/qmuparser/muParserFixes.h
+++ b/geometry/qmuparser/muParserFixes.h
@@ -1,62 +1,62 @@
-/*
-                 __________                                      
-    _____   __ __\______   \_____  _______  ______  ____ _______ 
-   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
-  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
-  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|   
-        \/                       \/            \/      \/        
-  Copyright (C) 2013 Ingo Berg
-
-  Permission is hereby granted, free of charge, to any person obtaining a copy of this 
-  software and associated documentation files (the "Software"), to deal in the Software
-  without restriction, including without limitation the rights to use, copy, modify, 
-  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 
-  permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-  The above copyright notice and this permission notice shall be included in all copies or 
-  substantial portions of the Software.
-
-  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
-  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
-  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
-  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
-  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
-*/
-
-#ifndef MU_PARSER_FIXES_H
-#define MU_PARSER_FIXES_H
-
-/** \file
-    \brief This file contains compatibility fixes for some platforms.
-*/
-
-//
-// Compatibility fixes
-//
-
-//---------------------------------------------------------------------------
-//
-// Intel Compiler
-//
-//---------------------------------------------------------------------------
-
-#ifdef __INTEL_COMPILER
-
-// remark #981: operands are evaluated in unspecified order
-// disabled -> completely pointless if the functions do not have side effects
-//
-#pragma warning(disable:981)
-
-// remark #383: value copied to temporary, reference to temporary used
-#pragma warning(disable:383)
-
-// remark #1572: floating-point equality and inequality comparisons are unreliable
-// disabled -> everyone knows it, the parser passes this problem
-//             deliberately to the user
-#pragma warning(disable:1572)
-
-#endif
-
-#endif // include guard
-
-
+/*
+                 __________
+    _____   __ __\______   \_____  _______  ______  ____ _______
+   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
+  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
+  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|
+        \/                       \/            \/      \/
+  Copyright (C) 2013 Ingo Berg
+
+  Permission is hereby granted, free of charge, to any person obtaining a copy of this
+  software and associated documentation files (the "Software"), to deal in the Software
+  without restriction, including without limitation the rights to use, copy, modify,
+  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
+  permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included in all copies or
+  substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
+  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef MU_PARSER_FIXES_H
+#define MU_PARSER_FIXES_H
+
+/** \file
+    \brief This file contains compatibility fixes for some platforms.
+*/
+
+//
+// Compatibility fixes
+//
+
+//---------------------------------------------------------------------------
+//
+// Intel Compiler
+//
+//---------------------------------------------------------------------------
+
+#ifdef __INTEL_COMPILER
+
+// remark #981: operands are evaluated in unspecified order
+// disabled -> completely pointless if the functions do not have side effects
+//
+#pragma warning(disable:981)
+
+// remark #383: value copied to temporary, reference to temporary used
+#pragma warning(disable:383)
+
+// remark #1572: floating-point equality and inequality comparisons are unreliable
+// disabled -> everyone knows it, the parser passes this problem
+//             deliberately to the user
+#pragma warning(disable:1572)
+
+#endif
+
+#endif // include guard
+
+
diff --git a/geometry/qmuparser/muParserInt.cpp b/geometry/qmuparser/muParserInt.cpp
old mode 100755
new mode 100644
index 8b5aae6..c268056
--- a/geometry/qmuparser/muParserInt.cpp
+++ b/geometry/qmuparser/muParserInt.cpp
@@ -1,280 +1,280 @@
-/*
-                 __________                                      
-    _____   __ __\______   \_____  _______  ______  ____ _______ 
-   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
-  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
-  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|   
-        \/                       \/            \/      \/        
-  Copyright (C) 2011 Ingo Berg
-
-  Permission is hereby granted, free of charge, to any person obtaining a copy of this 
-  software and associated documentation files (the "Software"), to deal in the Software
-  without restriction, including without limitation the rights to use, copy, modify, 
-  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 
-  permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-  The above copyright notice and this permission notice shall be included in all copies or 
-  substantial portions of the Software.
-
-  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
-  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
-  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
-  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
-  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
-*/
-
-#include "muParserInt.h"
-
-#include <cmath>
-#include <algorithm>
-#include <numeric>
-
-using namespace std;
-
-/** \file
-    \brief Implementation of a parser using integer value.
-*/
-
-/** \brief Namespace for mathematical applications. */
-namespace mu
-{
-value_type ParserInt::Abs(value_type v)  { return (value_type)Round(fabs((double)v)); }
-value_type ParserInt::Sign(value_type v) { return (Round(v)<0) ? -1 : (Round(v)>0) ? 1 : 0; }
-value_type ParserInt::Ite(value_type v1, 
-                          value_type v2, 
-                          value_type v3) { return (Round(v1)==1) ? Round(v2) : Round(v3); }
-value_type ParserInt::Add(value_type v1, value_type v2) { return Round(v1)  + Round(v2); }
-value_type ParserInt::Sub(value_type v1, value_type v2) { return Round(v1)  - Round(v2); }
-value_type ParserInt::Mul(value_type v1, value_type v2) { return Round(v1)  * Round(v2); }
-value_type ParserInt::Div(value_type v1, value_type v2) { return Round(v1)  / Round(v2); }
-value_type ParserInt::Mod(value_type v1, value_type v2) { return Round(v1)  % Round(v2); }
-value_type ParserInt::Shr(value_type v1, value_type v2) { return Round(v1) >> Round(v2); }
-value_type ParserInt::Shl(value_type v1, value_type v2) { return Round(v1) << Round(v2); }
-value_type ParserInt::LogAnd(value_type v1, value_type v2) { return Round(v1) & Round(v2); }
-value_type ParserInt::LogOr(value_type v1, value_type v2)  { return Round(v1) | Round(v2); }
-value_type ParserInt::And(value_type v1, value_type v2) { return Round(v1) && Round(v2); }
-value_type ParserInt::Or(value_type v1, value_type v2)  { return Round(v1) || Round(v2); }
-value_type ParserInt::Less(value_type v1, value_type v2)      { return Round(v1)  < Round(v2); }
-value_type ParserInt::Greater(value_type v1, value_type v2)   { return Round(v1)  > Round(v2); }
-value_type ParserInt::LessEq(value_type v1, value_type v2)    { return Round(v1) <= Round(v2); }
-value_type ParserInt::GreaterEq(value_type v1, value_type v2) { return Round(v1) >= Round(v2); }
-value_type ParserInt::Equal(value_type v1, value_type v2)     { return Round(v1) == Round(v2); }
-value_type ParserInt::NotEqual(value_type v1, value_type v2)  { return Round(v1) != Round(v2); }
-value_type ParserInt::Not(value_type v) { return !Round(v); }
-
-value_type ParserInt::Pow(value_type v1, value_type v2) 
-{ 
-  return std::pow((double)Round(v1), (double)Round(v2)); 
-}
-
-//---------------------------------------------------------------------------
-// Unary operator Callbacks: Infix operators
-value_type ParserInt::UnaryMinus(value_type v) 
-{ 
-  return -Round(v); 
-}
-
-//---------------------------------------------------------------------------
-value_type ParserInt::Sum(const value_type* a_afArg, int a_iArgc)
-{ 
-  if (!a_iArgc)	
-    throw ParserError(_T("too few arguments for function sum."));
-
-  value_type fRes=0;
-  for (int i=0; i<a_iArgc; ++i) 
-    fRes += a_afArg[i];
-
-  return fRes;
-}
-
-//---------------------------------------------------------------------------
-value_type ParserInt::Min(const value_type* a_afArg, int a_iArgc)
-{ 
-  if (!a_iArgc)	
-    throw ParserError( _T("too few arguments for function min.") );
-
-  value_type fRes=a_afArg[0];
-  for (int i=0; i<a_iArgc; ++i) 
-    fRes = std::min(fRes, a_afArg[i]);
-
-  return fRes;
-}
-
-//---------------------------------------------------------------------------
-value_type ParserInt::Max(const value_type* a_afArg, int a_iArgc)
-{ 
-  if (!a_iArgc)	
-    throw ParserError(_T("too few arguments for function min."));
-
-  value_type fRes=a_afArg[0];
-  for (int i=0; i<a_iArgc; ++i) 
-    fRes = std::max(fRes, a_afArg[i]);
-
-  return fRes;
-}
-
-//---------------------------------------------------------------------------
-// Default value recognition callback
-int ParserInt::IsVal(const char_type *a_szExpr, int *a_iPos, value_type *a_fVal)
-{
-  string_type buf(a_szExpr);
-  std::size_t pos = buf.find_first_not_of(_T("0123456789"));
-
-  if (pos==std::string::npos)
-    return 0;
-
-  stringstream_type stream( buf.substr(0, pos ) );
-  int iVal(0);
-
-  stream >> iVal;
-  if (stream.fail())
-    return 0;
-      
-  stringstream_type::pos_type iEnd = stream.tellg();   // Position after reading
-  if (stream.fail())
-    iEnd = stream.str().length();  
-
-  if (iEnd==(stringstream_type::pos_type)-1)
-    return 0;
-
-  *a_iPos += (int)iEnd;
-  *a_fVal = (value_type)iVal;
-  return 1;
-}
-
-//---------------------------------------------------------------------------
-/** \brief Check a given position in the expression for the presence of 
-           a hex value. 
-    \param a_szExpr Pointer to the expression string
-    \param [in/out] a_iPos Pointer to an integer value holding the current parsing 
-           position in the expression.
-    \param [out] a_fVal Pointer to the position where the detected value shall be stored.
-
-  Hey values must be prefixed with "0x" in order to be detected properly.
-*/
-int ParserInt::IsHexVal(const char_type *a_szExpr, int *a_iPos, value_type *a_fVal)
-{
-  if (a_szExpr[1]==0 || (a_szExpr[0]!='0' || a_szExpr[1]!='x') ) 
-    return 0;
-
-  unsigned iVal(0);
-
-  // New code based on streams for UNICODE compliance:
-  stringstream_type::pos_type nPos(0);
-  stringstream_type ss(a_szExpr + 2);
-  ss >> std::hex >> iVal;
-  nPos = ss.tellg();
-
-  if (nPos==(stringstream_type::pos_type)0)
-    return 1;
-
-  *a_iPos += (int)(2 + nPos);
-  *a_fVal = (value_type)iVal;
-  return 1;
-}
-
-//---------------------------------------------------------------------------
-int ParserInt::IsBinVal(const char_type *a_szExpr, int *a_iPos, value_type *a_fVal)
-{
-  if (a_szExpr[0]!='#') 
-    return 0;
-
-  unsigned iVal(0), 
-           iBits(sizeof(iVal)*8),
-           i(0);
-
-  for (i=0; (a_szExpr[i+1]=='0' || a_szExpr[i+1]=='1') && i<iBits; ++i)
-    iVal |= (int)(a_szExpr[i+1]=='1') << ((iBits-1)-i);
-
-  if (i==0) 
-    return 0;
-
-  if (i==iBits)
-    throw exception_type(_T("Binary to integer conversion error (overflow)."));
-
-  *a_fVal = (unsigned)(iVal >> (iBits-i) );
-  *a_iPos += i+1;
-
-  return 1;
-}
-
-//---------------------------------------------------------------------------
-/** \brief Constructor. 
-
-  Call ParserBase class constructor and trigger Function, Operator and Constant initialization.
-*/
-ParserInt::ParserInt()
-  :ParserBase()
-{
-  AddValIdent(IsVal);    // lowest priority
-  AddValIdent(IsBinVal);
-  AddValIdent(IsHexVal); // highest priority
-
-  InitCharSets();
-  InitFun();
-  InitOprt();
-}
-
-//---------------------------------------------------------------------------
-void ParserInt::InitConst()
-{
-}
-
-//---------------------------------------------------------------------------
-void ParserInt::InitCharSets()
-{
-  DefineNameChars( _T("0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") );
-  DefineOprtChars( _T("+-*^/?<>=!%&|~'_") );
-  DefineInfixOprtChars( _T("/+-*^?<>=!%&|~'_") );
-}
-
-//---------------------------------------------------------------------------
-/** \brief Initialize the default functions. */
-void ParserInt::InitFun()
-{
-  DefineFun( _T("sign"), Sign);
-  DefineFun( _T("abs"), Abs);
-  DefineFun( _T("if"), Ite);
-  DefineFun( _T("sum"), Sum);
-  DefineFun( _T("min"), Min);
-  DefineFun( _T("max"), Max);
-}
-
-//---------------------------------------------------------------------------
-/** \brief Initialize operators. */
-void ParserInt::InitOprt()
-{
-  // disable all built in operators, not all of them useful for integer numbers
-  // (they don't do rounding of values)
-  EnableBuiltInOprt(false);
-
-  // Disable all built in operators, they wont work with integer numbers
-  // since they are designed for floating point numbers
-  DefineInfixOprt( _T("-"), UnaryMinus);
-  DefineInfixOprt( _T("!"), Not);
-
-  DefineOprt( _T("&"), LogAnd, prLOGIC);
-  DefineOprt( _T("|"), LogOr, prLOGIC);
-  DefineOprt( _T("&&"), And, prLOGIC);
-  DefineOprt( _T("||"), Or, prLOGIC);
-
-  DefineOprt( _T("<"), Less, prCMP);
-  DefineOprt( _T(">"), Greater, prCMP);
-  DefineOprt( _T("<="), LessEq, prCMP);
-  DefineOprt( _T(">="), GreaterEq, prCMP);
-  DefineOprt( _T("=="), Equal, prCMP);
-  DefineOprt( _T("!="), NotEqual, prCMP);
-
-  DefineOprt( _T("+"), Add, prADD_SUB);
-  DefineOprt( _T("-"), Sub, prADD_SUB);
-
-  DefineOprt( _T("*"), Mul, prMUL_DIV);
-  DefineOprt( _T("/"), Div, prMUL_DIV);
-  DefineOprt( _T("%"), Mod, prMUL_DIV);
-
-  DefineOprt( _T("^"), Pow, prPOW, oaRIGHT);
-  DefineOprt( _T(">>"), Shr, prMUL_DIV+1);
-  DefineOprt( _T("<<"), Shl, prMUL_DIV+1);
-}
-
-} // namespace mu
+/*
+                 __________
+    _____   __ __\______   \_____  _______  ______  ____ _______
+   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
+  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
+  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|
+        \/                       \/            \/      \/
+  Copyright (C) 2011 Ingo Berg
+
+  Permission is hereby granted, free of charge, to any person obtaining a copy of this
+  software and associated documentation files (the "Software"), to deal in the Software
+  without restriction, including without limitation the rights to use, copy, modify,
+  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
+  permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included in all copies or
+  substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
+  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include "muParserInt.h"
+
+#include <cmath>
+#include <algorithm>
+#include <numeric>
+
+using namespace std;
+
+/** \file
+    \brief Implementation of a parser using integer value.
+*/
+
+/** \brief Namespace for mathematical applications. */
+namespace mu
+{
+value_type ParserInt::Abs(value_type v)  { return (value_type)Round(fabs((double)v)); }
+value_type ParserInt::Sign(value_type v) { return (Round(v)<0) ? -1 : (Round(v)>0) ? 1 : 0; }
+value_type ParserInt::Ite(value_type v1,
+                          value_type v2,
+                          value_type v3) { return (Round(v1)==1) ? Round(v2) : Round(v3); }
+value_type ParserInt::Add(value_type v1, value_type v2) { return Round(v1)  + Round(v2); }
+value_type ParserInt::Sub(value_type v1, value_type v2) { return Round(v1)  - Round(v2); }
+value_type ParserInt::Mul(value_type v1, value_type v2) { return Round(v1)  * Round(v2); }
+value_type ParserInt::Div(value_type v1, value_type v2) { return Round(v1)  / Round(v2); }
+value_type ParserInt::Mod(value_type v1, value_type v2) { return Round(v1)  % Round(v2); }
+value_type ParserInt::Shr(value_type v1, value_type v2) { return Round(v1) >> Round(v2); }
+value_type ParserInt::Shl(value_type v1, value_type v2) { return Round(v1) << Round(v2); }
+value_type ParserInt::LogAnd(value_type v1, value_type v2) { return Round(v1) & Round(v2); }
+value_type ParserInt::LogOr(value_type v1, value_type v2)  { return Round(v1) | Round(v2); }
+value_type ParserInt::And(value_type v1, value_type v2) { return Round(v1) && Round(v2); }
+value_type ParserInt::Or(value_type v1, value_type v2)  { return Round(v1) || Round(v2); }
+value_type ParserInt::Less(value_type v1, value_type v2)      { return Round(v1)  < Round(v2); }
+value_type ParserInt::Greater(value_type v1, value_type v2)   { return Round(v1)  > Round(v2); }
+value_type ParserInt::LessEq(value_type v1, value_type v2)    { return Round(v1) <= Round(v2); }
+value_type ParserInt::GreaterEq(value_type v1, value_type v2) { return Round(v1) >= Round(v2); }
+value_type ParserInt::Equal(value_type v1, value_type v2)     { return Round(v1) == Round(v2); }
+value_type ParserInt::NotEqual(value_type v1, value_type v2)  { return Round(v1) != Round(v2); }
+value_type ParserInt::Not(value_type v) { return !Round(v); }
+
+value_type ParserInt::Pow(value_type v1, value_type v2)
+{
+  return std::pow((double)Round(v1), (double)Round(v2));
+}
+
+//---------------------------------------------------------------------------
+// Unary operator Callbacks: Infix operators
+value_type ParserInt::UnaryMinus(value_type v)
+{
+  return -Round(v);
+}
+
+//---------------------------------------------------------------------------
+value_type ParserInt::Sum(const value_type* a_afArg, int a_iArgc)
+{
+  if (!a_iArgc)
+    throw ParserError(_T("too few arguments for function sum."));
+
+  value_type fRes=0;
+  for (int i=0; i<a_iArgc; ++i)
+    fRes += a_afArg[i];
+
+  return fRes;
+}
+
+//---------------------------------------------------------------------------
+value_type ParserInt::Min(const value_type* a_afArg, int a_iArgc)
+{
+  if (!a_iArgc)
+    throw ParserError( _T("too few arguments for function min.") );
+
+  value_type fRes=a_afArg[0];
+  for (int i=0; i<a_iArgc; ++i)
+    fRes = std::min(fRes, a_afArg[i]);
+
+  return fRes;
+}
+
+//---------------------------------------------------------------------------
+value_type ParserInt::Max(const value_type* a_afArg, int a_iArgc)
+{
+  if (!a_iArgc)
+    throw ParserError(_T("too few arguments for function min."));
+
+  value_type fRes=a_afArg[0];
+  for (int i=0; i<a_iArgc; ++i)
+    fRes = std::max(fRes, a_afArg[i]);
+
+  return fRes;
+}
+
+//---------------------------------------------------------------------------
+// Default value recognition callback
+int ParserInt::IsVal(const char_type *a_szExpr, int *a_iPos, value_type *a_fVal)
+{
+  string_type buf(a_szExpr);
+  std::size_t pos = buf.find_first_not_of(_T("0123456789"));
+
+  if (pos==std::string::npos)
+    return 0;
+
+  stringstream_type stream( buf.substr(0, pos ) );
+  int iVal(0);
+
+  stream >> iVal;
+  if (stream.fail())
+    return 0;
+
+  stringstream_type::pos_type iEnd = stream.tellg();   // Position after reading
+  if (stream.fail())
+    iEnd = stream.str().length();
+
+  if (iEnd==(stringstream_type::pos_type)-1)
+    return 0;
+
+  *a_iPos += (int)iEnd;
+  *a_fVal = (value_type)iVal;
+  return 1;
+}
+
+//---------------------------------------------------------------------------
+/** \brief Check a given position in the expression for the presence of
+           a hex value.
+    \param a_szExpr Pointer to the expression string
+    \param [in/out] a_iPos Pointer to an integer value holding the current parsing
+           position in the expression.
+    \param [out] a_fVal Pointer to the position where the detected value shall be stored.
+
+  Hey values must be prefixed with "0x" in order to be detected properly.
+*/
+int ParserInt::IsHexVal(const char_type *a_szExpr, int *a_iPos, value_type *a_fVal)
+{
+  if (a_szExpr[1]==0 || (a_szExpr[0]!='0' || a_szExpr[1]!='x') )
+    return 0;
+
+  unsigned iVal(0);
+
+  // New code based on streams for UNICODE compliance:
+  stringstream_type::pos_type nPos(0);
+  stringstream_type ss(a_szExpr + 2);
+  ss >> std::hex >> iVal;
+  nPos = ss.tellg();
+
+  if (nPos==(stringstream_type::pos_type)0)
+    return 1;
+
+  *a_iPos += (int)(2 + nPos);
+  *a_fVal = (value_type)iVal;
+  return 1;
+}
+
+//---------------------------------------------------------------------------
+int ParserInt::IsBinVal(const char_type *a_szExpr, int *a_iPos, value_type *a_fVal)
+{
+  if (a_szExpr[0]!='#')
+    return 0;
+
+  unsigned iVal(0),
+           iBits(sizeof(iVal)*8),
+           i(0);
+
+  for (i=0; (a_szExpr[i+1]=='0' || a_szExpr[i+1]=='1') && i<iBits; ++i)
+    iVal |= (int)(a_szExpr[i+1]=='1') << ((iBits-1)-i);
+
+  if (i==0)
+    return 0;
+
+  if (i==iBits)
+    throw exception_type(_T("Binary to integer conversion error (overflow)."));
+
+  *a_fVal = (unsigned)(iVal >> (iBits-i) );
+  *a_iPos += i+1;
+
+  return 1;
+}
+
+//---------------------------------------------------------------------------
+/** \brief Constructor.
+
+  Call ParserBase class constructor and trigger Function, Operator and Constant initialization.
+*/
+ParserInt::ParserInt()
+  :ParserBase()
+{
+  AddValIdent(IsVal);    // lowest priority
+  AddValIdent(IsBinVal);
+  AddValIdent(IsHexVal); // highest priority
+
+  InitCharSets();
+  InitFun();
+  InitOprt();
+}
+
+//---------------------------------------------------------------------------
+void ParserInt::InitConst()
+{
+}
+
+//---------------------------------------------------------------------------
+void ParserInt::InitCharSets()
+{
+  DefineNameChars( _T("0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") );
+  DefineOprtChars( _T("+-*^/?<>=!%&|~'_") );
+  DefineInfixOprtChars( _T("/+-*^?<>=!%&|~'_") );
+}
+
+//---------------------------------------------------------------------------
+/** \brief Initialize the default functions. */
+void ParserInt::InitFun()
+{
+  DefineFun( _T("sign"), Sign);
+  DefineFun( _T("abs"), Abs);
+  DefineFun( _T("if"), Ite);
+  DefineFun( _T("sum"), Sum);
+  DefineFun( _T("min"), Min);
+  DefineFun( _T("max"), Max);
+}
+
+//---------------------------------------------------------------------------
+/** \brief Initialize operators. */
+void ParserInt::InitOprt()
+{
+  // disable all built in operators, not all of them useful for integer numbers
+  // (they don't do rounding of values)
+  EnableBuiltInOprt(false);
+
+  // Disable all built in operators, they wont work with integer numbers
+  // since they are designed for floating point numbers
+  DefineInfixOprt( _T("-"), UnaryMinus);
+  DefineInfixOprt( _T("!"), Not);
+
+  DefineOprt( _T("&"), LogAnd, prLOGIC);
+  DefineOprt( _T("|"), LogOr, prLOGIC);
+  DefineOprt( _T("&&"), And, prLOGIC);
+  DefineOprt( _T("||"), Or, prLOGIC);
+
+  DefineOprt( _T("<"), Less, prCMP);
+  DefineOprt( _T(">"), Greater, prCMP);
+  DefineOprt( _T("<="), LessEq, prCMP);
+  DefineOprt( _T(">="), GreaterEq, prCMP);
+  DefineOprt( _T("=="), Equal, prCMP);
+  DefineOprt( _T("!="), NotEqual, prCMP);
+
+  DefineOprt( _T("+"), Add, prADD_SUB);
+  DefineOprt( _T("-"), Sub, prADD_SUB);
+
+  DefineOprt( _T("*"), Mul, prMUL_DIV);
+  DefineOprt( _T("/"), Div, prMUL_DIV);
+  DefineOprt( _T("%"), Mod, prMUL_DIV);
+
+  DefineOprt( _T("^"), Pow, prPOW, oaRIGHT);
+  DefineOprt( _T(">>"), Shr, prMUL_DIV+1);
+  DefineOprt( _T("<<"), Shl, prMUL_DIV+1);
+}
+
+} // namespace mu
diff --git a/geometry/qmuparser/muParserInt.h b/geometry/qmuparser/muParserInt.h
old mode 100755
new mode 100644
index 136de33..8833b99
--- a/geometry/qmuparser/muParserInt.h
+++ b/geometry/qmuparser/muParserInt.h
@@ -1,140 +1,140 @@
-/*
-                 __________                                      
-    _____   __ __\______   \_____  _______  ______  ____ _______ 
-   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
-  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
-  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|   
-        \/                       \/            \/      \/        
-  Copyright (C) 2004-2013 Ingo Berg
-
-  Permission is hereby granted, free of charge, to any person obtaining a copy of this 
-  software and associated documentation files (the "Software"), to deal in the Software
-  without restriction, including without limitation the rights to use, copy, modify, 
-  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 
-  permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-  The above copyright notice and this permission notice shall be included in all copies or 
-  substantial portions of the Software.
-
-  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
-  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
-  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
-  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
-  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
-*/
-
-#ifndef MU_PARSER_INT_H
-#define MU_PARSER_INT_H
-
-#include "muParserBase.h"
-#include <vector>
-
-
-/** \file
-    \brief Definition of a parser using integer value.
-*/
-
-
-namespace mu
-{
-
-/** \brief Mathematical expressions parser.
-  
-  This version of the parser handles only integer numbers. It disables the built in operators thus it is 
-  slower than muParser. Integer values are stored in the double value_type and converted if needed.
-*/
-class ParserInt : public ParserBase
-{
-private:
-    static int  Round(value_type v) { return (int)(v + ((v>=0) ? 0.5 : -0.5) ); };
-  
-    static value_type  Abs(value_type);
-    static value_type  Sign(value_type);
-    static value_type  Ite(value_type, value_type, value_type);
-    // !! The unary Minus is a MUST, otherwise you cant use negative signs !!
-    static value_type  UnaryMinus(value_type);
-    // Functions with variable number of arguments
-    static value_type  Sum(const value_type* a_afArg, int a_iArgc);  // sum
-    static value_type  Min(const value_type* a_afArg, int a_iArgc);  // minimum
-    static value_type  Max(const value_type* a_afArg, int a_iArgc);  // maximum
-    // binary operator callbacks
-    static value_type  Add(value_type v1, value_type v2);
-    static value_type  Sub(value_type v1, value_type v2);
-    static value_type  Mul(value_type v1, value_type v2);
-    static value_type  Div(value_type v1, value_type v2);
-    static value_type  Mod(value_type v1, value_type v2);
-    static value_type  Pow(value_type v1, value_type v2);
-    static value_type  Shr(value_type v1, value_type v2);
-    static value_type  Shl(value_type v1, value_type v2);
-    static value_type  LogAnd(value_type v1, value_type v2);
-    static value_type  LogOr(value_type v1, value_type v2);
-    static value_type  And(value_type v1, value_type v2);
-    static value_type  Or(value_type v1, value_type v2);
-    static value_type  Xor(value_type v1, value_type v2);
-    static value_type  Less(value_type v1, value_type v2);
-    static value_type  Greater(value_type v1, value_type v2);
-    static value_type  LessEq(value_type v1, value_type v2);
-    static value_type  GreaterEq(value_type v1, value_type v2);
-    static value_type  Equal(value_type v1, value_type v2);
-    static value_type  NotEqual(value_type v1, value_type v2);
-    static value_type  Not(value_type v1);
-
-    static int IsHexVal(const char_type* a_szExpr, int *a_iPos, value_type *a_iVal);
-    static int IsBinVal(const char_type* a_szExpr, int *a_iPos, value_type *a_iVal);
-    static int IsVal   (const char_type* a_szExpr, int *a_iPos, value_type *a_iVal);
-
-    /** \brief A facet class used to change decimal and thousands separator. */
-    template<class TChar>
-    class change_dec_sep : public std::numpunct<TChar>
-    {
-    public:
-      
-      explicit change_dec_sep(char_type cDecSep, char_type cThousandsSep = 0, int nGroup = 3)
-        :std::numpunct<TChar>()
-        ,m_cDecPoint(cDecSep)
-        ,m_cThousandsSep(cThousandsSep)
-        ,m_nGroup(nGroup)
-      {}
-      
-    protected:
-      
-      virtual char_type do_decimal_point() const
-      {
-        return m_cDecPoint;
-      }
-
-      virtual char_type do_thousands_sep() const
-      {
-        return m_cThousandsSep;
-      }
-
-      virtual std::string do_grouping() const 
-      { 
-        // fix for issue 4: https://code.google.com/p/muparser/issues/detail?id=4
-        // courtesy of Jens Bartsch
-        // original code:
-        //        return std::string(1, (char)m_nGroup); 
-        // new code:
-        return std::string(1, (char)(m_cThousandsSep > 0 ? m_nGroup : CHAR_MAX));
-      }
-
-    private:
-
-      int m_nGroup;
-      char_type m_cDecPoint;  
-      char_type m_cThousandsSep;
-    };
-
-public:
-    ParserInt();
-
-    virtual void InitFun();
-    virtual void InitOprt();
-    virtual void InitConst();
-    virtual void InitCharSets();
-};
-
-} // namespace mu
-
-#endif
-
+/*
+                 __________
+    _____   __ __\______   \_____  _______  ______  ____ _______
+   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
+  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
+  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|
+        \/                       \/            \/      \/
+  Copyright (C) 2004-2013 Ingo Berg
+
+  Permission is hereby granted, free of charge, to any person obtaining a copy of this
+  software and associated documentation files (the "Software"), to deal in the Software
+  without restriction, including without limitation the rights to use, copy, modify,
+  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
+  permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included in all copies or
+  substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
+  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef MU_PARSER_INT_H
+#define MU_PARSER_INT_H
+
+#include "muParserBase.h"
+#include <vector>
+
+
+/** \file
+    \brief Definition of a parser using integer value.
+*/
+
+
+namespace mu
+{
+
+/** \brief Mathematical expressions parser.
+
+  This version of the parser handles only integer numbers. It disables the built in operators thus it is
+  slower than muParser. Integer values are stored in the double value_type and converted if needed.
+*/
+class ParserInt : public ParserBase
+{
+private:
+    static int  Round(value_type v) { return (int)(v + ((v>=0) ? 0.5 : -0.5) ); };
+
+    static value_type  Abs(value_type);
+    static value_type  Sign(value_type);
+    static value_type  Ite(value_type, value_type, value_type);
+    // !! The unary Minus is a MUST, otherwise you cant use negative signs !!
+    static value_type  UnaryMinus(value_type);
+    // Functions with variable number of arguments
+    static value_type  Sum(const value_type* a_afArg, int a_iArgc);  // sum
+    static value_type  Min(const value_type* a_afArg, int a_iArgc);  // minimum
+    static value_type  Max(const value_type* a_afArg, int a_iArgc);  // maximum
+    // binary operator callbacks
+    static value_type  Add(value_type v1, value_type v2);
+    static value_type  Sub(value_type v1, value_type v2);
+    static value_type  Mul(value_type v1, value_type v2);
+    static value_type  Div(value_type v1, value_type v2);
+    static value_type  Mod(value_type v1, value_type v2);
+    static value_type  Pow(value_type v1, value_type v2);
+    static value_type  Shr(value_type v1, value_type v2);
+    static value_type  Shl(value_type v1, value_type v2);
+    static value_type  LogAnd(value_type v1, value_type v2);
+    static value_type  LogOr(value_type v1, value_type v2);
+    static value_type  And(value_type v1, value_type v2);
+    static value_type  Or(value_type v1, value_type v2);
+    static value_type  Xor(value_type v1, value_type v2);
+    static value_type  Less(value_type v1, value_type v2);
+    static value_type  Greater(value_type v1, value_type v2);
+    static value_type  LessEq(value_type v1, value_type v2);
+    static value_type  GreaterEq(value_type v1, value_type v2);
+    static value_type  Equal(value_type v1, value_type v2);
+    static value_type  NotEqual(value_type v1, value_type v2);
+    static value_type  Not(value_type v1);
+
+    static int IsHexVal(const char_type* a_szExpr, int *a_iPos, value_type *a_iVal);
+    static int IsBinVal(const char_type* a_szExpr, int *a_iPos, value_type *a_iVal);
+    static int IsVal   (const char_type* a_szExpr, int *a_iPos, value_type *a_iVal);
+
+    /** \brief A facet class used to change decimal and thousands separator. */
+    template<class TChar>
+    class change_dec_sep : public std::numpunct<TChar>
+    {
+    public:
+
+      explicit change_dec_sep(char_type cDecSep, char_type cThousandsSep = 0, int nGroup = 3)
+        :std::numpunct<TChar>()
+        ,m_cDecPoint(cDecSep)
+        ,m_cThousandsSep(cThousandsSep)
+        ,m_nGroup(nGroup)
+      {}
+
+    protected:
+
+      virtual char_type do_decimal_point() const
+      {
+        return m_cDecPoint;
+      }
+
+      virtual char_type do_thousands_sep() const
+      {
+        return m_cThousandsSep;
+      }
+
+      virtual std::string do_grouping() const
+      {
+        // fix for issue 4: https://code.google.com/p/muparser/issues/detail?id=4
+        // courtesy of Jens Bartsch
+        // original code:
+        //        return std::string(1, (char)m_nGroup);
+        // new code:
+        return std::string(1, (char)(m_cThousandsSep > 0 ? m_nGroup : CHAR_MAX));
+      }
+
+    private:
+
+      int m_nGroup;
+      char_type m_cDecPoint;
+      char_type m_cThousandsSep;
+    };
+
+public:
+    ParserInt();
+
+    virtual void InitFun();
+    virtual void InitOprt();
+    virtual void InitConst();
+    virtual void InitCharSets();
+};
+
+} // namespace mu
+
+#endif
+
diff --git a/geometry/qmuparser/muParserStack.h b/geometry/qmuparser/muParserStack.h
old mode 100755
new mode 100644
index f8437e3..40a9908
--- a/geometry/qmuparser/muParserStack.h
+++ b/geometry/qmuparser/muParserStack.h
@@ -1,125 +1,125 @@
-/*
-                 __________                                      
-    _____   __ __\______   \_____  _______  ______  ____ _______ 
-   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
-  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
-  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|   
-        \/                       \/            \/      \/        
-  Copyright (C) 2004-2011 Ingo Berg
-
-  Permission is hereby granted, free of charge, to any person obtaining a copy of this 
-  software and associated documentation files (the "Software"), to deal in the Software
-  without restriction, including without limitation the rights to use, copy, modify, 
-  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 
-  permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-  The above copyright notice and this permission notice shall be included in all copies or 
-  substantial portions of the Software.
-
-  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
-  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
-  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
-  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
-  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
-*/
-
-#ifndef MU_PARSER_STACK_H
-#define MU_PARSER_STACK_H
-
-#include <cassert>
-#include <string>
-#include <stack>
-#include <vector>
-
-#include "muParserError.h"
-#include "muParserToken.h"
-
-/** \file 
-    \brief This file defines the stack used by muparser.
-*/
-
-namespace mu
-{
-
-  /** \brief Parser stack implementation. 
-
-      Stack implementation based on a std::stack. The behaviour of pop() had been
-      slightly changed in order to get an error code if the stack is empty.
-      The stack is used within the Parser both as a value stack and as an operator stack.
-
-      \author (C) 2004-2011 Ingo Berg 
-  */
-  template <typename TValueType>
-  class ParserStack 
-  {
-    private:
-
-      /** \brief Type of the underlying stack implementation. */
-      typedef std::stack<TValueType, std::vector<TValueType> > impl_type;
-      
-      impl_type m_Stack;  ///< This is the actual stack.
-
-    public:	
-  	 
-      //---------------------------------------------------------------------------
-      ParserStack()
-        :m_Stack()
-      {}
-
-      //---------------------------------------------------------------------------
-      virtual ~ParserStack()
-      {}
-
-      //---------------------------------------------------------------------------
-      /** \brief Pop a value from the stack.
-       
-        Unlike the standard implementation this function will return the value that
-        is going to be taken from the stack.
-
-        \throw ParserException in case the stack is empty.
-        \sa pop(int &a_iErrc)
-      */
-	    TValueType pop()
-      {
-        if (empty())
-          throw ParserError( _T("stack is empty.") );
-
-        TValueType el = top();
-        m_Stack.pop();
-        return el;
-      }
-
-      /** \brief Push an object into the stack. 
-
-          \param a_Val object to push into the stack.
-          \throw nothrow
-      */
-      void push(const TValueType& a_Val) 
-      { 
-        m_Stack.push(a_Val); 
-      }
-
-      /** \brief Return the number of stored elements. */
-      unsigned size() const
-      { 
-        return (unsigned)m_Stack.size(); 
-      }
-
-      /** \brief Returns true if stack is empty false otherwise. */
-      bool empty() const
-      {
-        return m_Stack.empty(); 
-      }
-       
-      /** \brief Return reference to the top object in the stack. 
-       
-          The top object is the one pushed most recently.
-      */
-      TValueType& top() 
-      { 
-        return m_Stack.top(); 
-      }
-  };
-} // namespace MathUtils
-
-#endif
+/*
+                 __________
+    _____   __ __\______   \_____  _______  ______  ____ _______
+   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
+  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
+  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|
+        \/                       \/            \/      \/
+  Copyright (C) 2004-2011 Ingo Berg
+
+  Permission is hereby granted, free of charge, to any person obtaining a copy of this
+  software and associated documentation files (the "Software"), to deal in the Software
+  without restriction, including without limitation the rights to use, copy, modify,
+  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
+  permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included in all copies or
+  substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
+  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef MU_PARSER_STACK_H
+#define MU_PARSER_STACK_H
+
+#include <cassert>
+#include <string>
+#include <stack>
+#include <vector>
+
+#include "muParserError.h"
+#include "muParserToken.h"
+
+/** \file
+    \brief This file defines the stack used by muparser.
+*/
+
+namespace mu
+{
+
+  /** \brief Parser stack implementation.
+
+      Stack implementation based on a std::stack. The behaviour of pop() had been
+      slightly changed in order to get an error code if the stack is empty.
+      The stack is used within the Parser both as a value stack and as an operator stack.
+
+      \author (C) 2004-2011 Ingo Berg
+  */
+  template <typename TValueType>
+  class ParserStack
+  {
+    private:
+
+      /** \brief Type of the underlying stack implementation. */
+      typedef std::stack<TValueType, std::vector<TValueType> > impl_type;
+
+      impl_type m_Stack;  ///< This is the actual stack.
+
+    public:
+
+      //---------------------------------------------------------------------------
+      ParserStack()
+        :m_Stack()
+      {}
+
+      //---------------------------------------------------------------------------
+      virtual ~ParserStack()
+      {}
+
+      //---------------------------------------------------------------------------
+      /** \brief Pop a value from the stack.
+
+        Unlike the standard implementation this function will return the value that
+        is going to be taken from the stack.
+
+        \throw ParserException in case the stack is empty.
+        \sa pop(int &a_iErrc)
+      */
+	    TValueType pop()
+      {
+        if (empty())
+          throw ParserError( _T("stack is empty.") );
+
+        TValueType el = top();
+        m_Stack.pop();
+        return el;
+      }
+
+      /** \brief Push an object into the stack.
+
+          \param a_Val object to push into the stack.
+          \throw nothrow
+      */
+      void push(const TValueType& a_Val)
+      {
+        m_Stack.push(a_Val);
+      }
+
+      /** \brief Return the number of stored elements. */
+      unsigned size() const
+      {
+        return (unsigned)m_Stack.size();
+      }
+
+      /** \brief Returns true if stack is empty false otherwise. */
+      bool empty() const
+      {
+        return m_Stack.empty();
+      }
+
+      /** \brief Return reference to the top object in the stack.
+
+          The top object is the one pushed most recently.
+      */
+      TValueType& top()
+      {
+        return m_Stack.top();
+      }
+  };
+} // namespace MathUtils
+
+#endif
diff --git a/geometry/qmuparser/muParserTemplateMagic.h b/geometry/qmuparser/muParserTemplateMagic.h
old mode 100755
new mode 100644
index 1626cae..d212fda
--- a/geometry/qmuparser/muParserTemplateMagic.h
+++ b/geometry/qmuparser/muParserTemplateMagic.h
@@ -1,113 +1,113 @@
-#ifndef MU_PARSER_TEMPLATE_MAGIC_H
-#define MU_PARSER_TEMPLATE_MAGIC_H
-
-#include <cmath>
-#include "muParserError.h"
-
-
-namespace mu
-{
-  //-----------------------------------------------------------------------------------------------
-  //
-  // Compile time type detection
-  //
-  //-----------------------------------------------------------------------------------------------
-
-  /** \brief A class singling out integer types at compile time using 
-             template meta programming.
-  */
-  template<typename T>
-  struct TypeInfo
-  {
-    static bool IsInteger() { return false; }
-  };
-
-  template<>
-  struct TypeInfo<char>
-  {
-    static bool IsInteger() { return true;  }
-  };
-
-  template<>
-  struct TypeInfo<short>
-  {
-    static bool IsInteger() { return true;  }
-  };
-
-  template<>
-  struct TypeInfo<int>
-  {
-    static bool IsInteger() { return true;  }
-  };
-
-  template<>
-  struct TypeInfo<long>
-  {
-    static bool IsInteger() { return true;  }
-  };
-
-  template<>
-  struct TypeInfo<unsigned char>
-  {
-    static bool IsInteger() { return true;  }
-  };
-
-  template<>
-  struct TypeInfo<unsigned short>
-  {
-    static bool IsInteger() { return true;  }
-  };
-
-  template<>
-  struct TypeInfo<unsigned int>
-  {
-    static bool IsInteger() { return true;  }
-  };
-
-  template<>
-  struct TypeInfo<unsigned long>
-  {
-    static bool IsInteger() { return true;  }
-  };
-
-
-  //-----------------------------------------------------------------------------------------------
-  //
-  // Standard math functions with dummy overload for integer types
-  //
-  //-----------------------------------------------------------------------------------------------
-
-  /** \brief A template class for providing wrappers for essential math functions.
-
-    This template is spezialized for several types in order to provide a unified interface
-    for parser internal math function calls regardless of the data type.
-  */
-  template<typename T>
-  struct MathImpl
-  {
-    static T Sin(T v)   { return sin(v);  }
-    static T Cos(T v)   { return cos(v);  }
-    static T Tan(T v)   { return tan(v);  }
-    static T ASin(T v)  { return asin(v); }
-    static T ACos(T v)  { return acos(v); }
-    static T ATan(T v)  { return atan(v); }
-    static T ATan2(T v1, T v2) { return atan2(v1, v2); }
-    static T Sinh(T v)  { return sinh(v); }
-    static T Cosh(T v)  { return cosh(v); }
-    static T Tanh(T v)  { return tanh(v); }
-    static T ASinh(T v) { return log(v + sqrt(v * v + 1)); }
-    static T ACosh(T v) { return log(v + sqrt(v * v - 1)); }
-    static T ATanh(T v) { return ((T)0.5 * log((1 + v) / (1 - v))); }
-    static T Log(T v)   { return log(v); } 
-    static T Log2(T v)  { return log(v)/log((T)2); } // Logarithm base 2
-    static T Log10(T v) { return log10(v); }         // Logarithm base 10
-    static T Exp(T v)   { return exp(v);   }
-    static T Abs(T v)   { return (v>=0) ? v : -v; }
-    static T Sqrt(T v)  { return sqrt(v); }
-    static T Rint(T v)  { return floor(v + (T)0.5); }
-    static T Sign(T v)  { return (T)((v<0) ? -1 : (v>0) ? 1 : 0); }
-    static T Pow(T v1, T v2) { return std::pow(v1, v2); }
-  };
-}
-
-#endif
+#ifndef MU_PARSER_TEMPLATE_MAGIC_H
+#define MU_PARSER_TEMPLATE_MAGIC_H
+
+#include <cmath>
+#include "muParserError.h"
+
+
+namespace mu
+{
+  //-----------------------------------------------------------------------------------------------
+  //
+  // Compile time type detection
+  //
+  //-----------------------------------------------------------------------------------------------
+
+  /** \brief A class singling out integer types at compile time using
+             template meta programming.
+  */
+  template<typename T>
+  struct TypeInfo
+  {
+    static bool IsInteger() { return false; }
+  };
+
+  template<>
+  struct TypeInfo<char>
+  {
+    static bool IsInteger() { return true;  }
+  };
+
+  template<>
+  struct TypeInfo<short>
+  {
+    static bool IsInteger() { return true;  }
+  };
+
+  template<>
+  struct TypeInfo<int>
+  {
+    static bool IsInteger() { return true;  }
+  };
+
+  template<>
+  struct TypeInfo<long>
+  {
+    static bool IsInteger() { return true;  }
+  };
+
+  template<>
+  struct TypeInfo<unsigned char>
+  {
+    static bool IsInteger() { return true;  }
+  };
+
+  template<>
+  struct TypeInfo<unsigned short>
+  {
+    static bool IsInteger() { return true;  }
+  };
+
+  template<>
+  struct TypeInfo<unsigned int>
+  {
+    static bool IsInteger() { return true;  }
+  };
+
+  template<>
+  struct TypeInfo<unsigned long>
+  {
+    static bool IsInteger() { return true;  }
+  };
+
+
+  //-----------------------------------------------------------------------------------------------
+  //
+  // Standard math functions with dummy overload for integer types
+  //
+  //-----------------------------------------------------------------------------------------------
+
+  /** \brief A template class for providing wrappers for essential math functions.
+
+    This template is spezialized for several types in order to provide a unified interface
+    for parser internal math function calls regardless of the data type.
+  */
+  template<typename T>
+  struct MathImpl
+  {
+    static T Sin(T v)   { return sin(v);  }
+    static T Cos(T v)   { return cos(v);  }
+    static T Tan(T v)   { return tan(v);  }
+    static T ASin(T v)  { return asin(v); }
+    static T ACos(T v)  { return acos(v); }
+    static T ATan(T v)  { return atan(v); }
+    static T ATan2(T v1, T v2) { return atan2(v1, v2); }
+    static T Sinh(T v)  { return sinh(v); }
+    static T Cosh(T v)  { return cosh(v); }
+    static T Tanh(T v)  { return tanh(v); }
+    static T ASinh(T v) { return log(v + sqrt(v * v + 1)); }
+    static T ACosh(T v) { return log(v + sqrt(v * v - 1)); }
+    static T ATanh(T v) { return ((T)0.5 * log((1 + v) / (1 - v))); }
+    static T Log(T v)   { return log(v); }
+    static T Log2(T v)  { return log(v)/log((T)2); } // Logarithm base 2
+    static T Log10(T v) { return log10(v); }         // Logarithm base 10
+    static T Exp(T v)   { return exp(v);   }
+    static T Abs(T v)   { return (v>=0) ? v : -v; }
+    static T Sqrt(T v)  { return sqrt(v); }
+    static T Rint(T v)  { return floor(v + (T)0.5); }
+    static T Sign(T v)  { return (T)((v<0) ? -1 : (v>0) ? 1 : 0); }
+    static T Pow(T v1, T v2) { return std::pow(v1, v2); }
+  };
+}
+
+#endif
diff --git a/geometry/qmuparser/muParserTest.cpp b/geometry/qmuparser/muParserTest.cpp
old mode 100755
new mode 100644
index 4006b27..a94eeab
--- a/geometry/qmuparser/muParserTest.cpp
+++ b/geometry/qmuparser/muParserTest.cpp
@@ -1,1552 +1,1552 @@
-/*
-                 __________                                      
-    _____   __ __\______   \_____  _______  ______  ____ _______ 
-   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
-  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
-  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|   
-        \/                       \/            \/      \/        
-  Copyright (C) 2013 Ingo Berg
-
-  Permission is hereby granted, free of charge, to any person obtaining a copy of this 
-  software and associated documentation files (the "Software"), to deal in the Software
-  without restriction, including without limitation the rights to use, copy, modify, 
-  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 
-  permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-  The above copyright notice and this permission notice shall be included in all copies or 
-  substantial portions of the Software.
-
-  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
-  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
-  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
-  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
-  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
-*/
-
-#include "muParserTest.h"
-
-#include <cstdio>
-#include <cmath>
-#include <iostream>
-#include <limits>
-
-#define PARSER_CONST_PI  3.141592653589793238462643
-#define PARSER_CONST_E   2.718281828459045235360287
-
-using namespace std;
-
-/** \file
-    \brief This file contains the implementation of parser test cases.
-*/
-
-namespace mu
-{
-  namespace Test
-  {
-    int ParserTester::c_iCount = 0;
-
-    //---------------------------------------------------------------------------------------------
-    ParserTester::ParserTester()
-      :m_vTestFun()
-    {
-      AddTest(&ParserTester::TestNames);
-      AddTest(&ParserTester::TestSyntax);
-      AddTest(&ParserTester::TestPostFix);
-      AddTest(&ParserTester::TestInfixOprt);
-      AddTest(&ParserTester::TestVarConst);
-      AddTest(&ParserTester::TestMultiArg);
-      AddTest(&ParserTester::TestExpression);
-      AddTest(&ParserTester::TestIfThenElse);
-      AddTest(&ParserTester::TestInterface);
-      AddTest(&ParserTester::TestBinOprt);
-      AddTest(&ParserTester::TestException);
-      AddTest(&ParserTester::TestStrArg);
-      AddTest(&ParserTester::TestBulkMode);
-
-      ParserTester::c_iCount = 0;
-    }
-
-    //---------------------------------------------------------------------------------------------
-    int ParserTester::IsHexVal(const char_type *a_szExpr, int *a_iPos, value_type *a_fVal)
-    {
-      if (a_szExpr[1]==0 || (a_szExpr[0]!='0' || a_szExpr[1]!='x') ) 
-        return 0;
-
-      unsigned iVal(0);
-
-      // New code based on streams for UNICODE compliance:
-      stringstream_type::pos_type nPos(0);
-      stringstream_type ss(a_szExpr + 2);
-      ss >> std::hex >> iVal;
-      nPos = ss.tellg();
-
-      if (nPos==(stringstream_type::pos_type)0)
-        return 1;
-
-      *a_iPos += (int)(2 + nPos);
-      *a_fVal = (value_type)iVal;
-      return 1;
-    }
-
-    //---------------------------------------------------------------------------------------------
-    int ParserTester::TestInterface()
-    {
-      int iStat = 0;
-      mu::console() << _T("testing member functions...");
-   
-      // Test RemoveVar
-      value_type afVal[3] = {1,2,3};
-      Parser p;
-  
-      try
-      {
-        p.DefineVar( _T("a"), &afVal[0]);
-        p.DefineVar( _T("b"), &afVal[1]);
-        p.DefineVar( _T("c"), &afVal[2]);
-        p.SetExpr( _T("a+b+c") );
-        p.Eval();
-      }
-      catch(...)
-      {
-        iStat += 1;  // this is not supposed to happen 
-      }
-
-      try
-      {
-        p.RemoveVar( _T("c") );
-        p.Eval();
-        iStat += 1;  // not supposed to reach this, nonexisting variable "c" deleted...
-      }
-      catch(...)
-      {
-        // failure is expected...
-      }
-
-      if (iStat==0) 
-        mu::console() << _T("passed") << endl;
-      else 
-        mu::console() << _T("\n  failed with ") << iStat << _T(" errors") << endl;
-
-      return iStat;
-    }
-
-    //---------------------------------------------------------------------------------------------
-    int ParserTester::TestStrArg()
-    {
-      int iStat = 0;
-      mu::console() << _T("testing string arguments...");
- 
-      iStat += EqnTest(_T("valueof(\"\")"), 123, true);   // empty string arguments caused a crash
-      iStat += EqnTest(_T("valueof(\"aaa\")+valueof(\"bbb\")  "), 246, true);
-      iStat += EqnTest(_T("2*(valueof(\"aaa\")-23)+valueof(\"bbb\")"), 323, true);
-      // use in expressions with variables
-      iStat += EqnTest(_T("a*(atof(\"10\")-b)"), 8, true);
-      iStat += EqnTest(_T("a-(atof(\"10\")*b)"), -19, true);
-      // string + numeric arguments
-      iStat += EqnTest(_T("strfun1(\"100\")"), 100, true);
-      iStat += EqnTest(_T("strfun2(\"100\",1)"), 101, true);
-      iStat += EqnTest(_T("strfun3(\"99\",1,2)"), 102, true);
-      // string constants
-      iStat += EqnTest(_T("atof(str1)+atof(str2)"), 3.33, true);
-
-      if (iStat==0)
-        mu::console() << _T("passed") << endl;
-      else 
-        mu::console() << _T("\n  failed with ") << iStat << _T(" errors") << endl;
-
-      return iStat;
-    }
-
-    //---------------------------------------------------------------------------------------------
-    int ParserTester::TestBulkMode()
-    {
-        int iStat = 0;
-        mu::console() << _T("testing bulkmode...");
-
-#define EQN_TEST_BULK(EXPR, R1, R2, R3, R4, PASS) \
-        { \
-          double res[] = { R1, R2, R3, R4 }; \
-          iStat += EqnTestBulk(_T(EXPR), res, (PASS)); \
-        }
-
-        // Bulk Variables for the test:
-        // a: 1,2,3,4
-        // b: 2,2,2,2
-        // c: 3,3,3,3
-        // d: 5,4,3,2
-        EQN_TEST_BULK("a",   1, 1, 1, 1, false)
-        EQN_TEST_BULK("a",   1, 2, 3, 4, true)
-        EQN_TEST_BULK("b=a", 1, 2, 3, 4, true)
-        EQN_TEST_BULK("b=a, b*10", 10, 20, 30, 40, true)
-        EQN_TEST_BULK("b=a, b*10, a", 1, 2, 3, 4, true)
-        EQN_TEST_BULK("a+b", 3, 4, 5, 6, true)
-        EQN_TEST_BULK("c*(a+b)", 9, 12, 15, 18, true)
-#undef EQN_TEST_BULK
-
-        if (iStat == 0)
-            mu::console() << _T("passed") << endl;
-        else
-            mu::console() << _T("\n  failed with ") << iStat << _T(" errors") << endl;
-
-        return iStat;
-    }
-
-    //---------------------------------------------------------------------------------------------
-    int ParserTester::TestBinOprt()
-    {
-      int iStat = 0;
-      mu::console() << _T("testing binary operators...");
-   
-      // built in operators
-      // xor operator
-
-      iStat += EqnTest(_T("a++b"), 3, true);
-      iStat += EqnTest(_T("a ++ b"), 3, true);
-      iStat += EqnTest(_T("1++2"), 3, true);
-      iStat += EqnTest(_T("1 ++ 2"), 3, true);
-      iStat += EqnTest(_T("a add b"), 3, true);
-      iStat += EqnTest(_T("1 add 2"), 3, true);
-      iStat += EqnTest(_T("a<b"), 1, true);
-      iStat += EqnTest(_T("b>a"), 1, true);
-      iStat += EqnTest(_T("a>a"), 0, true);
-      iStat += EqnTest(_T("a<a"), 0, true);
-      iStat += EqnTest(_T("a>a"), 0, true);
-      iStat += EqnTest(_T("a<=a"), 1, true);
-      iStat += EqnTest(_T("a<=b"), 1, true);
-      iStat += EqnTest(_T("b<=a"), 0, true);
-      iStat += EqnTest(_T("a>=a"), 1, true);
-      iStat += EqnTest(_T("b>=a"), 1, true);
-      iStat += EqnTest(_T("a>=b"), 0, true);
-
-      // Test logical operators, especially if user defined "&" and the internal "&&" collide
-      iStat += EqnTest(_T("1 && 1"), 1, true); 
-      iStat += EqnTest(_T("1 && 0"), 0, true); 
-      iStat += EqnTest(_T("(a<b) && (b>a)"), 1, true); 
-      iStat += EqnTest(_T("(a<b) && (a>b)"), 0, true); 
-      //iStat += EqnTest(_T("12 and 255"), 12, true); 
-      //iStat += EqnTest(_T("12 and 0"), 0, true); 
-      iStat += EqnTest(_T("12 & 255"), 12, true); 
-      iStat += EqnTest(_T("12 & 0"), 0, true); 
-      iStat += EqnTest(_T("12&255"), 12, true); 
-      iStat += EqnTest(_T("12&0"), 0, true); 
-
-      // Assignment operator
-      iStat += EqnTest(_T("a = b"), 2, true); 
-      iStat += EqnTest(_T("a = sin(b)"), 0.909297, true); 
-      iStat += EqnTest(_T("a = 1+sin(b)"), 1.909297, true);
-      iStat += EqnTest(_T("(a=b)*2"), 4, true);
-      iStat += EqnTest(_T("2*(a=b)"), 4, true);
-      iStat += EqnTest(_T("2*(a=b+1)"), 6, true);
-      iStat += EqnTest(_T("(a=b+1)*2"), 6, true);
-      iStat += EqnTest(_T("a=c, a*10"), 30, true);
-
-      iStat += EqnTest(_T("2^2^3"), 256, true); 
-      iStat += EqnTest(_T("1/2/3"), 1.0/6.0, true); 
-
-      // reference: http://www.wolframalpha.com/input/?i=3%2B4*2%2F%281-5%29^2^3
-      iStat += EqnTest(_T("3+4*2/(1-5)^2^3"), 3.0001220703125, true); 
-
-      // Test user defined binary operators
-      iStat += EqnTestInt(_T("1 | 2"), 3, true);          
-      iStat += EqnTestInt(_T("1 || 2"), 1, true);          
-      iStat += EqnTestInt(_T("123 & 456"), 72, true);          
-      iStat += EqnTestInt(_T("(123 & 456) % 10"), 2, true);
-      iStat += EqnTestInt(_T("1 && 0"), 0, true);          
-      iStat += EqnTestInt(_T("123 && 456"), 1, true);          
-      iStat += EqnTestInt(_T("1 << 3"), 8, true);          
-      iStat += EqnTestInt(_T("8 >> 3"), 1, true);          
-      iStat += EqnTestInt(_T("9 / 4"), 2, true);  
-      iStat += EqnTestInt(_T("9 % 4"), 1, true);  
-      iStat += EqnTestInt(_T("if(5%2,1,0)"), 1, true);
-      iStat += EqnTestInt(_T("if(4%2,1,0)"), 0, true);
-      iStat += EqnTestInt(_T("-10+1"), -9, true);
-      iStat += EqnTestInt(_T("1+2*3"), 7, true);
-      iStat += EqnTestInt(_T("const1 != const2"), 1, true);
-      iStat += EqnTestInt(_T("const1 != const2"), 0, false);
-      iStat += EqnTestInt(_T("const1 == const2"), 0, true);
-      iStat += EqnTestInt(_T("const1 == 1"), 1, true);
-      iStat += EqnTestInt(_T("10*(const1 == 1)"), 10, true);
-      iStat += EqnTestInt(_T("2*(const1 | const2)"), 6, true);
-      iStat += EqnTestInt(_T("2*(const1 | const2)"), 7, false);
-      iStat += EqnTestInt(_T("const1 < const2"), 1, true);
-      iStat += EqnTestInt(_T("const2 > const1"), 1, true);
-      iStat += EqnTestInt(_T("const1 <= 1"), 1, true);
-      iStat += EqnTestInt(_T("const2 >= 2"), 1, true);
-      iStat += EqnTestInt(_T("2*(const1 + const2)"), 6, true);
-      iStat += EqnTestInt(_T("2*(const1 - const2)"), -2, true);
-      iStat += EqnTestInt(_T("a != b"), 1, true);
-      iStat += EqnTestInt(_T("a != b"), 0, false);
-      iStat += EqnTestInt(_T("a == b"), 0, true);
-      iStat += EqnTestInt(_T("a == 1"), 1, true);
-      iStat += EqnTestInt(_T("10*(a == 1)"), 10, true);
-      iStat += EqnTestInt(_T("2*(a | b)"), 6, true);
-      iStat += EqnTestInt(_T("2*(a | b)"), 7, false);
-      iStat += EqnTestInt(_T("a < b"), 1, true);
-      iStat += EqnTestInt(_T("b > a"), 1, true);
-      iStat += EqnTestInt(_T("a <= 1"), 1, true);
-      iStat += EqnTestInt(_T("b >= 2"), 1, true);
-      iStat += EqnTestInt(_T("2*(a + b)"), 6, true);
-      iStat += EqnTestInt(_T("2*(a - b)"), -2, true);
-      iStat += EqnTestInt(_T("a + (a << b)"), 5, true);
-      iStat += EqnTestInt(_T("-2^2"), -4, true);
-      iStat += EqnTestInt(_T("3--a"), 4, true);
-      iStat += EqnTestInt(_T("3+-3^2"), -6, true);
-
-      // Test reading of hex values:
-      iStat += EqnTestInt(_T("0xff"), 255, true);
-      iStat += EqnTestInt(_T("10+0xff"), 265, true);
-      iStat += EqnTestInt(_T("0xff+10"), 265, true);
-      iStat += EqnTestInt(_T("10*0xff"), 2550, true);
-      iStat += EqnTestInt(_T("0xff*10"), 2550, true);
-      iStat += EqnTestInt(_T("10+0xff+1"), 266, true);
-      iStat += EqnTestInt(_T("1+0xff+10"), 266, true);
-
-// incorrect: '^' is yor here, not power
-//    iStat += EqnTestInt("-(1+2)^2", -9, true);
-//    iStat += EqnTestInt("-1^3", -1, true);          
-
-      // Test precedence
-      // a=1, b=2, c=3
-      iStat += EqnTestInt(_T("a + b * c"), 7, true);
-      iStat += EqnTestInt(_T("a * b + c"), 5, true);
-      iStat += EqnTestInt(_T("a<b && b>10"), 0, true);
-      iStat += EqnTestInt(_T("a<b && b<10"), 1, true);
-
-      iStat += EqnTestInt(_T("a + b << c"), 17, true);
-      iStat += EqnTestInt(_T("a << b + c"), 7, true);
-      iStat += EqnTestInt(_T("c * b < a"), 0, true);
-      iStat += EqnTestInt(_T("c * b == 6 * a"), 1, true);
-      iStat += EqnTestInt(_T("2^2^3"), 256, true); 
-
-
-      if (iStat==0)
-        mu::console() << _T("passed") << endl;
-      else 
-        mu::console() << _T("\n  failed with ") << iStat << _T(" errors") << endl;
-
-      return iStat;
-    }
-
-    //---------------------------------------------------------------------------------------------
-    /** \brief Check muParser name restriction enforcement. */
-    int ParserTester::TestNames()
-    {
-      int  iStat= 0,
-           iErr = 0;
-
-      mu::console() << "testing name restriction enforcement...";
-    
-      Parser p;
-
-  #define PARSER_THROWCHECK(DOMAIN, FAIL, EXPR, ARG) \
-      iErr = 0;                                      \
-      ParserTester::c_iCount++;                      \
-      try                                            \
-      {                                              \
-        p.Define##DOMAIN(EXPR, ARG);                 \
-      }                                              \
-      catch(Parser::exception_type&)                 \
-      {                                              \
-        iErr = (FAIL==false) ? 0 : 1;                \
-      }                                              \
-      iStat += iErr;      
-      
-      // constant names
-      PARSER_THROWCHECK(Const, false, _T("0a"), 1)
-      PARSER_THROWCHECK(Const, false, _T("9a"), 1)
-      PARSER_THROWCHECK(Const, false, _T("+a"), 1)
-      PARSER_THROWCHECK(Const, false, _T("-a"), 1)
-      PARSER_THROWCHECK(Const, false, _T("a-"), 1)
-      PARSER_THROWCHECK(Const, false, _T("a*"), 1)
-      PARSER_THROWCHECK(Const, false, _T("a?"), 1)
-      PARSER_THROWCHECK(Const, true, _T("a"), 1)
-      PARSER_THROWCHECK(Const, true, _T("a_min"), 1)
-      PARSER_THROWCHECK(Const, true, _T("a_min0"), 1)
-      PARSER_THROWCHECK(Const, true, _T("a_min9"), 1)
-      // variable names
-      value_type a;
-      p.ClearConst();
-      PARSER_THROWCHECK(Var, false, _T("123abc"), &a)
-      PARSER_THROWCHECK(Var, false, _T("9a"), &a)
-      PARSER_THROWCHECK(Var, false, _T("0a"), &a)
-      PARSER_THROWCHECK(Var, false, _T("+a"), &a)
-      PARSER_THROWCHECK(Var, false, _T("-a"), &a)
-      PARSER_THROWCHECK(Var, false, _T("?a"), &a)
-      PARSER_THROWCHECK(Var, false, _T("!a"), &a)
-      PARSER_THROWCHECK(Var, false, _T("a+"), &a)
-      PARSER_THROWCHECK(Var, false, _T("a-"), &a)
-      PARSER_THROWCHECK(Var, false, _T("a*"), &a)
-      PARSER_THROWCHECK(Var, false, _T("a?"), &a)
-      PARSER_THROWCHECK(Var, true, _T("a"), &a)
-      PARSER_THROWCHECK(Var, true, _T("a_min"), &a)
-      PARSER_THROWCHECK(Var, true, _T("a_min0"), &a)
-      PARSER_THROWCHECK(Var, true, _T("a_min9"), &a)
-      PARSER_THROWCHECK(Var, false, _T("a_min9"), 0)
-      // Postfix operators
-      // fail
-      PARSER_THROWCHECK(PostfixOprt, false, _T("(k"), f1of1)
-      PARSER_THROWCHECK(PostfixOprt, false, _T("9+"), f1of1)
-      PARSER_THROWCHECK(PostfixOprt, false, _T("+"), 0)
-      // pass
-      PARSER_THROWCHECK(PostfixOprt, true, _T("-a"),  f1of1)
-      PARSER_THROWCHECK(PostfixOprt, true, _T("?a"),  f1of1)
-      PARSER_THROWCHECK(PostfixOprt, true, _T("_"),   f1of1)
-      PARSER_THROWCHECK(PostfixOprt, true, _T("#"),   f1of1)
-      PARSER_THROWCHECK(PostfixOprt, true, _T("&&"),  f1of1)
-      PARSER_THROWCHECK(PostfixOprt, true, _T("||"),  f1of1)
-      PARSER_THROWCHECK(PostfixOprt, true, _T("&"),   f1of1)
-      PARSER_THROWCHECK(PostfixOprt, true, _T("|"),   f1of1)
-      PARSER_THROWCHECK(PostfixOprt, true, _T("++"),  f1of1)
-      PARSER_THROWCHECK(PostfixOprt, true, _T("--"),  f1of1)
-      PARSER_THROWCHECK(PostfixOprt, true, _T("?>"),  f1of1)
-      PARSER_THROWCHECK(PostfixOprt, true, _T("?<"),  f1of1)
-      PARSER_THROWCHECK(PostfixOprt, true, _T("**"),  f1of1)
-      PARSER_THROWCHECK(PostfixOprt, true, _T("xor"), f1of1)
-      PARSER_THROWCHECK(PostfixOprt, true, _T("and"), f1of1)
-      PARSER_THROWCHECK(PostfixOprt, true, _T("or"),  f1of1)
-      PARSER_THROWCHECK(PostfixOprt, true, _T("not"), f1of1)
-      PARSER_THROWCHECK(PostfixOprt, true, _T("!"),   f1of1)
-      // Binary operator
-      // The following must fail with builtin operators activated
-      // p.EnableBuiltInOp(true); -> this is the default
-      p.ClearPostfixOprt();
-      PARSER_THROWCHECK(Oprt, false, _T("+"),  f1of2)
-      PARSER_THROWCHECK(Oprt, false, _T("-"),  f1of2)
-      PARSER_THROWCHECK(Oprt, false, _T("*"),  f1of2)
-      PARSER_THROWCHECK(Oprt, false, _T("/"),  f1of2)
-      PARSER_THROWCHECK(Oprt, false, _T("^"),  f1of2)
-      PARSER_THROWCHECK(Oprt, false, _T("&&"),  f1of2)
-      PARSER_THROWCHECK(Oprt, false, _T("||"),  f1of2)
-      // without activated built in operators it should work
-      p.EnableBuiltInOprt(false);
-      PARSER_THROWCHECK(Oprt, true, _T("+"),  f1of2)
-      PARSER_THROWCHECK(Oprt, true, _T("-"),  f1of2)
-      PARSER_THROWCHECK(Oprt, true, _T("*"),  f1of2)
-      PARSER_THROWCHECK(Oprt, true, _T("/"),  f1of2)
-      PARSER_THROWCHECK(Oprt, true, _T("^"),  f1of2)
-      PARSER_THROWCHECK(Oprt, true, _T("&&"),  f1of2)
-      PARSER_THROWCHECK(Oprt, true, _T("||"),  f1of2)
-  #undef PARSER_THROWCHECK
-
-      if (iStat==0) 
-        mu::console() << _T("passed") << endl;
-      else 
-        mu::console() << _T("\n  failed with ") << iStat << _T(" errors") << endl;
-
-      return iStat;
-    }
-
-    //---------------------------------------------------------------------------
-    int ParserTester::TestSyntax()
-    {
-      int iStat = 0;
-      mu::console() << _T("testing syntax engine...");
-
-      iStat += ThrowTest(_T("1,"), ecUNEXPECTED_EOF);  // incomplete hex definition
-      iStat += ThrowTest(_T("a,"), ecUNEXPECTED_EOF);  // incomplete hex definition
-      iStat += ThrowTest(_T("sin(8),"), ecUNEXPECTED_EOF);  // incomplete hex definition
-      iStat += ThrowTest(_T("(sin(8)),"), ecUNEXPECTED_EOF);  // incomplete hex definition
-      iStat += ThrowTest(_T("a{m},"), ecUNEXPECTED_EOF);  // incomplete hex definition
-
-      iStat += EqnTest(_T("(1+ 2*a)"), 3, true);   // Spaces within formula
-      iStat += EqnTest(_T("sqrt((4))"), 2, true);  // Multiple brackets
-      iStat += EqnTest(_T("sqrt((2)+2)"), 2, true);// Multiple brackets
-      iStat += EqnTest(_T("sqrt(2+(2))"), 2, true);// Multiple brackets
-      iStat += EqnTest(_T("sqrt(a+(3))"), 2, true);// Multiple brackets
-      iStat += EqnTest(_T("sqrt((3)+a)"), 2, true);// Multiple brackets
-      iStat += EqnTest(_T("order(1,2)"), 1, true); // May not cause name collision with operator "or"
-      iStat += EqnTest(_T("(2+"), 0, false);       // missing closing bracket 
-      iStat += EqnTest(_T("2++4"), 0, false);      // unexpected operator
-      iStat += EqnTest(_T("2+-4"), 0, false);      // unexpected operator
-      iStat += EqnTest(_T("(2+)"), 0, false);      // unexpected closing bracket
-      iStat += EqnTest(_T("--2"), 0, false);       // double sign
-      iStat += EqnTest(_T("ksdfj"), 0, false);     // unknown token
-      iStat += EqnTest(_T("()"), 0, false);        // empty bracket without a function
-      iStat += EqnTest(_T("5+()"), 0, false);      // empty bracket without a function
-      iStat += EqnTest(_T("sin(cos)"), 0, false);  // unexpected function
-      iStat += EqnTest(_T("5t6"), 0, false);       // unknown token
-      iStat += EqnTest(_T("5 t 6"), 0, false);     // unknown token
-      iStat += EqnTest(_T("8*"), 0, false);        // unexpected end of formula
-      iStat += EqnTest(_T(",3"), 0, false);        // unexpected comma
-      iStat += EqnTest(_T("3,5"), 0, false);       // unexpected comma
-      iStat += EqnTest(_T("sin(8,8)"), 0, false);  // too many function args
-      iStat += EqnTest(_T("(7,8)"), 0, false);     // too many function args
-      iStat += EqnTest(_T("sin)"), 0, false);      // unexpected closing bracket
-      iStat += EqnTest(_T("a)"), 0, false);        // unexpected closing bracket
-      iStat += EqnTest(_T("pi)"), 0, false);       // unexpected closing bracket
-      iStat += EqnTest(_T("sin(())"), 0, false);   // unexpected closing bracket
-      iStat += EqnTest(_T("sin()"), 0, false);     // unexpected closing bracket
-
-      if (iStat==0)
-        mu::console() << _T("passed") << endl;
-      else 
-        mu::console() << _T("\n  failed with ") << iStat << _T(" errors") << endl;
-
-      return iStat;
-    }
-
-    //---------------------------------------------------------------------------
-    int ParserTester::TestVarConst()
-    {
-      int iStat = 0;
-      mu::console() << _T("testing variable/constant detection...");
-
-      // Test if the result changes when a variable changes
-      iStat += EqnTestWithVarChange( _T("a"), 1, 1, 2, 2 );
-      iStat += EqnTestWithVarChange( _T("2*a"), 2, 4, 3, 6 );
-
-      // distinguish constants with same basename
-      iStat += EqnTest( _T("const"), 1, true);
-      iStat += EqnTest( _T("const1"), 2, true);
-      iStat += EqnTest( _T("const2"), 3, true);
-      iStat += EqnTest( _T("2*const"), 2, true);
-      iStat += EqnTest( _T("2*const1"), 4, true);
-      iStat += EqnTest( _T("2*const2"), 6, true);
-      iStat += EqnTest( _T("2*const+1"), 3, true);
-      iStat += EqnTest( _T("2*const1+1"), 5, true);
-      iStat += EqnTest( _T("2*const2+1"), 7, true);
-      iStat += EqnTest( _T("const"), 0, false);
-      iStat += EqnTest( _T("const1"), 0, false);
-      iStat += EqnTest( _T("const2"), 0, false);
-
-      // distinguish variables with same basename
-      iStat += EqnTest( _T("a"), 1, true);
-      iStat += EqnTest( _T("aa"), 2, true);
-      iStat += EqnTest( _T("2*a"), 2, true);
-      iStat += EqnTest( _T("2*aa"), 4, true);
-      iStat += EqnTest( _T("2*a-1"), 1, true);
-      iStat += EqnTest( _T("2*aa-1"), 3, true);
-
-      // custom value recognition
-      iStat += EqnTest( _T("0xff"), 255, true);
-      iStat += EqnTest( _T("0x97 + 0xff"), 406, true);
-
-      // Finally test querying of used variables
-      try
-      {
-        int idx;
-        mu::Parser p;
-        mu::value_type vVarVal[] = { 1, 2, 3, 4, 5};
-        p.DefineVar( _T("a"), &vVarVal[0]);
-        p.DefineVar( _T("b"), &vVarVal[1]);
-        p.DefineVar( _T("c"), &vVarVal[2]);
-        p.DefineVar( _T("d"), &vVarVal[3]);
-        p.DefineVar( _T("e"), &vVarVal[4]);
-
-        // Test lookup of defined variables
-        // 4 used variables
-        p.SetExpr( _T("a+b+c+d") );
-        mu::varmap_type UsedVar = p.GetUsedVar();
-        int iCount = (int)UsedVar.size();
-        if (iCount!=4) 
-          throw false;
-        
-        // the next check will fail if the parser 
-        // erroneously creates new variables internally
-        if (p.GetVar().size()!=5)
-          throw false;
-
-        mu::varmap_type::const_iterator item = UsedVar.begin();
-        for (idx=0; item!=UsedVar.end(); ++item)
-        {
-          if (&vVarVal[idx++]!=item->second) 
-            throw false;
-        }
-
-        // Test lookup of undefined variables
-        p.SetExpr( _T("undef1+undef2+undef3") );
-        UsedVar = p.GetUsedVar();
-        iCount = (int)UsedVar.size();
-        if (iCount!=3) 
-          throw false;
-
-        // the next check will fail if the parser 
-        // erroneously creates new variables internally
-        if (p.GetVar().size()!=5)
-          throw false;
-
-        for (item = UsedVar.begin(); item!=UsedVar.end(); ++item)
-        {
-          if (item->second!=0) 
-            throw false; // all pointers to undefined variables must be null
-        }
-
-        // 1 used variables
-        p.SetExpr( _T("a+b") );
-        UsedVar = p.GetUsedVar();
-        iCount = (int)UsedVar.size();
-        if (iCount!=2) throw false;
-        item = UsedVar.begin();
-        for (idx=0; item!=UsedVar.end(); ++item)
-          if (&vVarVal[idx++]!=item->second) throw false;
-
-      }
-      catch(...)
-      {
-        iStat += 1;
-      }
-
-      if (iStat==0)  
-        mu::console() << _T("passed") << endl;
-      else
-        mu::console() << _T("\n  failed with ") << iStat << _T(" errors") << endl;
-
-      return iStat;
-    }
-
-    //---------------------------------------------------------------------------
-    int ParserTester::TestMultiArg()
-    {
-      int iStat = 0;
-      mu::console() << _T("testing multiarg functions...");
-    
-      // Compound expressions
-      iStat += EqnTest( _T("1,2,3"), 3, true);
-      iStat += EqnTest( _T("a,b,c"), 3, true);
-      iStat += EqnTest( _T("a=10,b=20,c=a*b"), 200, true);
-      iStat += EqnTest( _T("1,\n2,\n3"), 3, true);
-      iStat += EqnTest( _T("a,\nb,\nc"), 3, true);
-      iStat += EqnTest( _T("a=10,\nb=20,\nc=a*b"), 200, true);
-      iStat += EqnTest( _T("1,\r\n2,\r\n3"), 3, true);
-      iStat += EqnTest( _T("a,\r\nb,\r\nc"), 3, true);
-      iStat += EqnTest( _T("a=10,\r\nb=20,\r\nc=a*b"), 200, true);
-
-      // picking the right argument
-      iStat += EqnTest( _T("f1of1(1)"), 1, true);
-      iStat += EqnTest( _T("f1of2(1, 2)"), 1, true);
-      iStat += EqnTest( _T("f2of2(1, 2)"), 2, true);
-      iStat += EqnTest( _T("f1of3(1, 2, 3)"), 1, true);
-      iStat += EqnTest( _T("f2of3(1, 2, 3)"), 2, true);
-      iStat += EqnTest( _T("f3of3(1, 2, 3)"), 3, true);
-      iStat += EqnTest( _T("f1of4(1, 2, 3, 4)"), 1, true);
-      iStat += EqnTest( _T("f2of4(1, 2, 3, 4)"), 2, true);
-      iStat += EqnTest( _T("f3of4(1, 2, 3, 4)"), 3, true);
-      iStat += EqnTest( _T("f4of4(1, 2, 3, 4)"), 4, true);
-      iStat += EqnTest( _T("f1of5(1, 2, 3, 4, 5)"), 1, true);
-      iStat += EqnTest( _T("f2of5(1, 2, 3, 4, 5)"), 2, true);
-      iStat += EqnTest( _T("f3of5(1, 2, 3, 4, 5)"), 3, true);
-      iStat += EqnTest( _T("f4of5(1, 2, 3, 4, 5)"), 4, true);
-      iStat += EqnTest( _T("f5of5(1, 2, 3, 4, 5)"), 5, true);
-      // Too few arguments / Too many arguments
-      iStat += EqnTest( _T("1+ping()"), 11, true);
-      iStat += EqnTest( _T("ping()+1"), 11, true);
-      iStat += EqnTest( _T("2*ping()"), 20, true);
-      iStat += EqnTest( _T("ping()*2"), 20, true);
-      iStat += EqnTest( _T("ping(1,2)"), 0, false);
-      iStat += EqnTest( _T("1+ping(1,2)"), 0, false);
-      iStat += EqnTest( _T("f1of1(1,2)"), 0, false);
-      iStat += EqnTest( _T("f1of1()"), 0, false);
-      iStat += EqnTest( _T("f1of2(1, 2, 3)"), 0, false);
-      iStat += EqnTest( _T("f1of2(1)"), 0, false);
-      iStat += EqnTest( _T("f1of3(1, 2, 3, 4)"), 0, false);
-      iStat += EqnTest( _T("f1of3(1)"), 0, false);
-      iStat += EqnTest( _T("f1of4(1, 2, 3, 4, 5)"), 0, false);
-      iStat += EqnTest( _T("f1of4(1)"), 0, false);
-      iStat += EqnTest( _T("(1,2,3)"), 0, false);
-      iStat += EqnTest( _T("1,2,3"), 0, false);
-      iStat += EqnTest( _T("(1*a,2,3)"), 0, false);
-      iStat += EqnTest( _T("1,2*a,3"), 0, false);
-     
-      // correct calculation of arguments
-      iStat += EqnTest( _T("min(a, 1)"),  1, true);
-      iStat += EqnTest( _T("min(3*2, 1)"),  1, true);
-      iStat += EqnTest( _T("min(3*2, 1)"),  6, false);
-      iStat += EqnTest( _T("firstArg(2,3,4)"), 2, true);
-      iStat += EqnTest( _T("lastArg(2,3,4)"), 4, true);
-      iStat += EqnTest( _T("min(3*a+1, 1)"),  1, true);
-      iStat += EqnTest( _T("max(3*a+1, 1)"),  4, true);
-      iStat += EqnTest( _T("max(3*a+1, 1)*2"),  8, true);
-      iStat += EqnTest( _T("2*max(3*a+1, 1)+2"),  10, true);
-
-      // functions with Variable argument count
-      iStat += EqnTest( _T("sum(a)"), 1, true);
-      iStat += EqnTest( _T("sum(1,2,3)"),  6, true);
-      iStat += EqnTest( _T("sum(a,b,c)"),  6, true);
-      iStat += EqnTest( _T("sum(1,-max(1,2),3)*2"),  4, true);
-      iStat += EqnTest( _T("2*sum(1,2,3)"),  12, true);
-      iStat += EqnTest( _T("2*sum(1,2,3)+2"),  14, true);
-      iStat += EqnTest( _T("2*sum(-1,2,3)+2"),  10, true);
-      iStat += EqnTest( _T("2*sum(-1,2,-(-a))+2"),  6, true);
-      iStat += EqnTest( _T("2*sum(-1,10,-a)+2"),  18, true);
-      iStat += EqnTest( _T("2*sum(1,2,3)*2"),  24, true);
-      iStat += EqnTest( _T("sum(1,-max(1,2),3)*2"),  4, true);
-      iStat += EqnTest( _T("sum(1*3, 4, a+2)"),  10, true);
-      iStat += EqnTest( _T("sum(1*3, 2*sum(1,2,2), a+2)"),  16, true);
-      iStat += EqnTest( _T("sum(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2)"), 24, true);
-
-      // some failures
-      iStat += EqnTest( _T("sum()"),  0, false);
-      iStat += EqnTest( _T("sum(,)"),  0, false);
-      iStat += EqnTest( _T("sum(1,2,)"),  0, false);
-      iStat += EqnTest( _T("sum(,1,2)"),  0, false);
-
-      if (iStat==0) 
-        mu::console() << _T("passed") << endl;
-      else
-        mu::console() << _T("\n  failed with ") << iStat << _T(" errors") << endl;
-  
-      return iStat;
-    }
-
-
-    //---------------------------------------------------------------------------
-    int ParserTester::TestInfixOprt()
-    {
-      int iStat(0);
-      mu::console() << "testing infix operators...";
-
-      iStat += EqnTest( _T("+1"),    +1, true);
-      iStat += EqnTest( _T("-(+1)"), -1, true);
-      iStat += EqnTest( _T("-(+1)*2"),  -2, true);
-      iStat += EqnTest( _T("-(+2)*sqrt(4)"),  -4, true);
-      iStat += EqnTest( _T("3-+a"), 2, true);
-      iStat += EqnTest( _T("+1*3"),  3, true);
-
-      iStat += EqnTest( _T("-1"),    -1, true);
-      iStat += EqnTest( _T("-(-1)"),  1, true);
-      iStat += EqnTest( _T("-(-1)*2"),  2, true);
-      iStat += EqnTest( _T("-(-2)*sqrt(4)"),  4, true);
-      iStat += EqnTest( _T("-_pi"), -PARSER_CONST_PI, true);
-      iStat += EqnTest( _T("-a"),  -1, true);
-      iStat += EqnTest( _T("-(a)"),  -1, true);
-      iStat += EqnTest( _T("-(-a)"),  1, true);
-      iStat += EqnTest( _T("-(-a)*2"),  2, true);
-      iStat += EqnTest( _T("-(8)"), -8, true);
-      iStat += EqnTest( _T("-8"), -8, true);
-      iStat += EqnTest( _T("-(2+1)"), -3, true);
-      iStat += EqnTest( _T("-(f1of1(1+2*3)+1*2)"), -9, true);
-      iStat += EqnTest( _T("-(-f1of1(1+2*3)+1*2)"), 5, true);
-      iStat += EqnTest( _T("-sin(8)"), -0.989358, true);
-      iStat += EqnTest( _T("3-(-a)"), 4, true);
-      iStat += EqnTest( _T("3--a"), 4, true);
-      iStat += EqnTest( _T("-1*3"),  -3, true);
-
-      // Postfix / infix priorities
-      iStat += EqnTest( _T("~2#"), 8, true);
-      iStat += EqnTest( _T("~f1of1(2)#"), 8, true);
-      iStat += EqnTest( _T("~(b)#"), 8, true);
-      iStat += EqnTest( _T("(~b)#"), 12, true);
-      iStat += EqnTest( _T("~(2#)"), 8, true);
-      iStat += EqnTest( _T("~(f1of1(2)#)"), 8, true);
-      //
-      iStat += EqnTest( _T("-2^2"),-4, true);
-      iStat += EqnTest( _T("-(a+b)^2"),-9, true);
-      iStat += EqnTest( _T("(-3)^2"),9, true);
-      iStat += EqnTest( _T("-(-2^2)"),4, true);
-      iStat += EqnTest( _T("3+-3^2"),-6, true);
-      // The following assumes use of sqr as postfix operator ("§") together
-      // with a sign operator of low priority:
-      iStat += EqnTest( _T("-2'"), -4, true);
-      iStat += EqnTest( _T("-(1+1)'"),-4, true);
-      iStat += EqnTest( _T("2+-(1+1)'"),-2, true);
-      iStat += EqnTest( _T("2+-2'"), -2, true);
-      // This is the classic behaviour of the infix sign operator (here: "$") which is
-      // now deprecated:
-      iStat += EqnTest( _T("$2^2"),4, true);
-      iStat += EqnTest( _T("$(a+b)^2"),9, true);
-      iStat += EqnTest( _T("($3)^2"),9, true);
-      iStat += EqnTest( _T("$($2^2)"),-4, true);
-      iStat += EqnTest( _T("3+$3^2"),12, true);
-
-      // infix operators sharing the first few characters
-      iStat += EqnTest( _T("~ 123"),  123+2, true);
-      iStat += EqnTest( _T("~~ 123"),  123+2, true);
-
-      if (iStat==0)
-        mu::console() << _T("passed") << endl;
-      else
-        mu::console() << _T("\n  failed with ") << iStat << _T(" errors") << endl;
-
-      return iStat;
-    }
-
-
-    //---------------------------------------------------------------------------
-    int ParserTester::TestPostFix()
-    {
-      int iStat = 0;
-      mu::console() << _T("testing postfix operators...");
-
-      // application
-      iStat += EqnTest( _T("3{m}+5"), 5.003, true);
-      iStat += EqnTest( _T("1000{m}"), 1, true);
-      iStat += EqnTest( _T("1000 {m}"), 1, true);
-      iStat += EqnTest( _T("(a){m}"), 1e-3, true);
-      iStat += EqnTest( _T("a{m}"), 1e-3, true);
-      iStat += EqnTest( _T("a {m}"), 1e-3, true);
-      iStat += EqnTest( _T("-(a){m}"), -1e-3, true);
-      iStat += EqnTest( _T("-2{m}"), -2e-3, true);
-      iStat += EqnTest( _T("-2 {m}"), -2e-3, true);
-      iStat += EqnTest( _T("f1of1(1000){m}"), 1, true);
-      iStat += EqnTest( _T("-f1of1(1000){m}"), -1, true);
-      iStat += EqnTest( _T("-f1of1(-1000){m}"), 1, true);
-      iStat += EqnTest( _T("f4of4(0,0,0,1000){m}"), 1, true);
-      iStat += EqnTest( _T("2+(a*1000){m}"), 3, true);
-
-      // can postfix operators "m" und "meg" be told apart properly?
-      iStat += EqnTest( _T("2*3000meg+2"), 2*3e9+2, true);   
-
-      // some incorrect results
-      iStat += EqnTest( _T("1000{m}"), 0.1, false);
-      iStat += EqnTest( _T("(a){m}"), 2, false);
-      // failure due to syntax checking
-      iStat += ThrowTest(_T("0x"), ecUNASSIGNABLE_TOKEN);  // incomplete hex definition
-      iStat += ThrowTest(_T("3+"), ecUNEXPECTED_EOF);
-      iStat += ThrowTest( _T("4 + {m}"), ecUNASSIGNABLE_TOKEN);
-      iStat += ThrowTest( _T("{m}4"), ecUNASSIGNABLE_TOKEN);
-      iStat += ThrowTest( _T("sin({m})"), ecUNASSIGNABLE_TOKEN);
-      iStat += ThrowTest( _T("{m} {m}"), ecUNASSIGNABLE_TOKEN);
-      iStat += ThrowTest( _T("{m}(8)"), ecUNASSIGNABLE_TOKEN);
-      iStat += ThrowTest( _T("4,{m}"), ecUNASSIGNABLE_TOKEN);
-      iStat += ThrowTest( _T("-{m}"), ecUNASSIGNABLE_TOKEN);
-      iStat += ThrowTest( _T("2(-{m})"), ecUNEXPECTED_PARENS);
-      iStat += ThrowTest( _T("2({m})"), ecUNEXPECTED_PARENS);
- 
-      iStat += ThrowTest( _T("multi*1.0"), ecUNASSIGNABLE_TOKEN);
-
-      if (iStat==0)
-        mu::console() << _T("passed") << endl;
-      else
-        mu::console() << _T("\n  failed with ") << iStat << _T(" errors") << endl;
-
-      return iStat;
-    }
-
-    //---------------------------------------------------------------------------
-    int ParserTester::TestExpression()
-    {
-      int iStat = 0;
-      mu::console() << _T("testing expression samples...");
-
-      value_type b = 2;
-
-      // Optimization
-      iStat += EqnTest( _T("2*b*5"), 20, true);
-      iStat += EqnTest( _T("2*b*5 + 4*b"), 28, true);
-      iStat += EqnTest( _T("2*a/3"), 2.0/3.0, true);
-
-      // Addition auf cmVARMUL 
-      iStat += EqnTest( _T("3+b"), b+3, true);
-      iStat += EqnTest( _T("b+3"), b+3, true);
-      iStat += EqnTest( _T("b*3+2"), b*3+2, true);
-      iStat += EqnTest( _T("3*b+2"), b*3+2, true);
-      iStat += EqnTest( _T("2+b*3"), b*3+2, true);
-      iStat += EqnTest( _T("2+3*b"), b*3+2, true);
-      iStat += EqnTest( _T("b+3*b"), b+3*b, true);
-      iStat += EqnTest( _T("3*b+b"), b+3*b, true);
-
-      iStat += EqnTest( _T("2+b*3+b"), 2+b*3+b, true);
-      iStat += EqnTest( _T("b+2+b*3"), b+2+b*3, true);
-
-      iStat += EqnTest( _T("(2*b+1)*4"), (2*b+1)*4, true);
-      iStat += EqnTest( _T("4*(2*b+1)"), (2*b+1)*4, true);
-
-      // operator precedences
-      iStat += EqnTest( _T("1+2-3*4/5^6"), 2.99923, true);
-      iStat += EqnTest( _T("1^2/3*4-5+6"), 2.33333333, true);
-      iStat += EqnTest( _T("1+2*3"), 7, true);
-      iStat += EqnTest( _T("1+2*3"), 7, true);
-      iStat += EqnTest( _T("(1+2)*3"), 9, true);
-      iStat += EqnTest( _T("(1+2)*(-3)"), -9, true);
-      iStat += EqnTest( _T("2/4"), 0.5, true);
-
-      iStat += EqnTest( _T("exp(ln(7))"), 7, true);
-      iStat += EqnTest( _T("e^ln(7)"), 7, true);
-      iStat += EqnTest( _T("e^(ln(7))"), 7, true);
-      iStat += EqnTest( _T("(e^(ln(7)))"), 7, true);
-      iStat += EqnTest( _T("1-(e^(ln(7)))"), -6, true);
-      iStat += EqnTest( _T("2*(e^(ln(7)))"), 14, true);
-      iStat += EqnTest( _T("10^log(5)"), pow(10.0, log(5.0)), true);
-      iStat += EqnTest( _T("10^log10(5)"), 5, true);
-      iStat += EqnTest( _T("2^log2(4)"), 4, true);
-      iStat += EqnTest( _T("-(sin(0)+1)"), -1, true);
-      iStat += EqnTest( _T("-(2^1.1)"), -2.14354692, true);
-
-      iStat += EqnTest( _T("(cos(2.41)/b)"), -0.372056, true);
-      iStat += EqnTest( _T("(1*(2*(3*(4*(5*(6*(a+b)))))))"), 2160, true);
-      iStat += EqnTest( _T("(1*(2*(3*(4*(5*(6*(7*(a+b))))))))"), 15120, true);
-      iStat += EqnTest( _T("(a/((((b+(((e*(((((pi*((((3.45*((pi+a)+pi))+b)+b)*a))+0.68)+e)+a)/a))+a)+b))+b)*a)-pi))"), 0.00377999, true);
-
-      // long formula (Reference: Matlab)
-      iStat += EqnTest(
-        _T("(((-9))-e/(((((((pi-(((-7)+(-3)/4/e))))/(((-5))-2)-((pi+(-0))*(sqrt((e+e))*(-8))*(((-pi)+(-pi)-(-9)*(6*5))")
-        _T("/(-e)-e))/2)/((((sqrt(2/(-e)+6)-(4-2))+((5/(-2))/(1*(-pi)+3))/8)*pi*((pi/((-2)/(-6)*1*(-1))*(-6)+(-e)))))/")
-        _T("((e+(-2)+(-e)*((((-3)*9+(-e)))+(-9)))))))-((((e-7+(((5/pi-(3/1+pi)))))/e)/(-5))/(sqrt((((((1+(-7))))+((((-")
-        _T("e)*(-e)))-8))*(-5)/((-e)))*(-6)-((((((-2)-(-9)-(-e)-1)/3))))/(sqrt((8+(e-((-6))+(9*(-9))))*(((3+2-8))*(7+6")
-        _T("+(-5))+((0/(-e)*(-pi))+7)))+(((((-e)/e/e)+((-6)*5)*e+(3+(-5)/pi))))+pi))/sqrt((((9))+((((pi))-8+2))+pi))/e")
-        _T("*4)*((-5)/(((-pi))*(sqrt(e)))))-(((((((-e)*(e)-pi))/4+(pi)*(-9)))))))+(-pi)"), -12.23016549, true);
-
-      // long formula (Reference: Matlab)
-      iStat += EqnTest(
-          _T("(atan(sin((((((((((((((((pi/cos((a/((((0.53-b)-pi)*e)/b))))+2.51)+a)-0.54)/0.98)+b)*b)+e)/a)+b)+a)+b)+pi)/e")
-          _T(")+a)))*2.77)"), -2.16995656, true);
-
-      // long formula (Reference: Matlab)
-      iStat += EqnTest( _T("1+2-3*4/5^6*(2*(1-5+(3*7^9)*(4+6*7-3)))+12"), -7995810.09926, true);
-	  
-      if (iStat==0) 
-        mu::console() << _T("passed") << endl;  
-      else 
-        mu::console() << _T("\n  failed with ") << iStat << _T(" errors") << endl;
-
-      return iStat;
-    }
-
-
-
-    //---------------------------------------------------------------------------
-    int ParserTester::TestIfThenElse()
-    {
-      int iStat = 0;
-      mu::console() << _T("testing if-then-else operator...");
-
-      // Test error detection
-      iStat += ThrowTest(_T(":3"), ecUNEXPECTED_CONDITIONAL); 
-      iStat += ThrowTest(_T("? 1 : 2"), ecUNEXPECTED_CONDITIONAL); 
-      iStat += ThrowTest(_T("(a<b) ? (b<c) ? 1 : 2"), ecMISSING_ELSE_CLAUSE); 
-      iStat += ThrowTest(_T("(a<b) ? 1"), ecMISSING_ELSE_CLAUSE); 
-      iStat += ThrowTest(_T("(a<b) ? a"), ecMISSING_ELSE_CLAUSE); 
-      iStat += ThrowTest(_T("(a<b) ? a+b"), ecMISSING_ELSE_CLAUSE); 
-      iStat += ThrowTest(_T("a : b"), ecMISPLACED_COLON); 
-      iStat += ThrowTest(_T("1 : 2"), ecMISPLACED_COLON); 
-      iStat += ThrowTest(_T("(1) ? 1 : 2 : 3"), ecMISPLACED_COLON); 
-      iStat += ThrowTest(_T("(true) ? 1 : 2 : 3"), ecUNASSIGNABLE_TOKEN); 
-
-      iStat += EqnTest(_T("1 ? 128 : 255"), 128, true);
-      iStat += EqnTest(_T("1<2 ? 128 : 255"), 128, true);
-      iStat += EqnTest(_T("a<b ? 128 : 255"), 128, true);
-      iStat += EqnTest(_T("(a<b) ? 128 : 255"), 128, true);
-      iStat += EqnTest(_T("(1) ? 10 : 11"), 10, true);
-      iStat += EqnTest(_T("(0) ? 10 : 11"), 11, true);
-      iStat += EqnTest(_T("(1) ? a+b : c+d"), 3, true);
-      iStat += EqnTest(_T("(0) ? a+b : c+d"), 1, true);
-      iStat += EqnTest(_T("(1) ? 0 : 1"), 0, true);
-      iStat += EqnTest(_T("(0) ? 0 : 1"), 1, true);
-      iStat += EqnTest(_T("(a<b) ? 10 : 11"), 10, true);
-      iStat += EqnTest(_T("(a>b) ? 10 : 11"), 11, true);
-      iStat += EqnTest(_T("(a<b) ? c : d"), 3, true);
-      iStat += EqnTest(_T("(a>b) ? c : d"), -2, true);
-
-      iStat += EqnTest(_T("(a>b) ? 1 : 0"), 0, true);
-      iStat += EqnTest(_T("((a>b) ? 1 : 0) ? 1 : 2"), 2, true);
-      iStat += EqnTest(_T("((a>b) ? 1 : 0) ? 1 : sum((a>b) ? 1 : 2)"), 2, true);
-      iStat += EqnTest(_T("((a>b) ? 0 : 1) ? 1 : sum((a>b) ? 1 : 2)"), 1, true);
-
-      iStat += EqnTest(_T("sum((a>b) ? 1 : 2)"), 2, true);
-      iStat += EqnTest(_T("sum((1) ? 1 : 2)"), 1, true);
-      iStat += EqnTest(_T("sum((a>b) ? 1 : 2, 100)"), 102, true);
-      iStat += EqnTest(_T("sum((1) ? 1 : 2, 100)"), 101, true);
-      iStat += EqnTest(_T("sum(3, (a>b) ? 3 : 10)"), 13, true);
-      iStat += EqnTest(_T("sum(3, (a<b) ? 3 : 10)"), 6, true);
-      iStat += EqnTest(_T("10*sum(3, (a>b) ? 3 : 10)"), 130, true);
-      iStat += EqnTest(_T("10*sum(3, (a<b) ? 3 : 10)"), 60, true);
-      iStat += EqnTest(_T("sum(3, (a>b) ? 3 : 10)*10"), 130, true);
-      iStat += EqnTest(_T("sum(3, (a<b) ? 3 : 10)*10"), 60, true);
-      iStat += EqnTest(_T("(a<b) ? sum(3, (a<b) ? 3 : 10)*10 : 99"), 60, true);
-      iStat += EqnTest(_T("(a>b) ? sum(3, (a<b) ? 3 : 10)*10 : 99"), 99, true);
-      iStat += EqnTest(_T("(a<b) ? sum(3, (a<b) ? 3 : 10,10,20)*10 : 99"), 360, true);
-      iStat += EqnTest(_T("(a>b) ? sum(3, (a<b) ? 3 : 10,10,20)*10 : 99"), 99, true);
-      iStat += EqnTest(_T("(a>b) ? sum(3, (a<b) ? 3 : 10,10,20)*10 : sum(3, (a<b) ? 3 : 10)*10"), 60, true);
-
-      // todo: auch für muParserX hinzufügen!
-      iStat += EqnTest(_T("(a<b)&&(a<b) ? 128 : 255"), 128, true);
-      iStat += EqnTest(_T("(a>b)&&(a<b) ? 128 : 255"), 255, true);
-      iStat += EqnTest(_T("(1<2)&&(1<2) ? 128 : 255"), 128, true);
-      iStat += EqnTest(_T("(1>2)&&(1<2) ? 128 : 255"), 255, true);
-      iStat += EqnTest(_T("((1<2)&&(1<2)) ? 128 : 255"), 128, true);
-      iStat += EqnTest(_T("((1>2)&&(1<2)) ? 128 : 255"), 255, true);
-      iStat += EqnTest(_T("((a<b)&&(a<b)) ? 128 : 255"), 128, true);
-      iStat += EqnTest(_T("((a>b)&&(a<b)) ? 128 : 255"), 255, true);
-
-      iStat += EqnTest(_T("1>0 ? 1>2 ? 128 : 255 : 1>0 ? 32 : 64"), 255, true);
-      iStat += EqnTest(_T("1>0 ? 1>2 ? 128 : 255 :(1>0 ? 32 : 64)"), 255, true);
-      iStat += EqnTest(_T("1>0 ? 1>0 ? 128 : 255 : 1>2 ? 32 : 64"), 128, true);
-      iStat += EqnTest(_T("1>0 ? 1>0 ? 128 : 255 :(1>2 ? 32 : 64)"), 128, true);
-      iStat += EqnTest(_T("1>2 ? 1>2 ? 128 : 255 : 1>0 ? 32 : 64"), 32, true);
-      iStat += EqnTest(_T("1>2 ? 1>0 ? 128 : 255 : 1>2 ? 32 : 64"), 64, true);
-      iStat += EqnTest(_T("1>0 ? 50 :  1>0 ? 128 : 255"), 50, true);
-      iStat += EqnTest(_T("1>0 ? 50 : (1>0 ? 128 : 255)"), 50, true);
-      iStat += EqnTest(_T("1>0 ? 1>0 ? 128 : 255 : 50"), 128, true);
-      iStat += EqnTest(_T("1>2 ? 1>2 ? 128 : 255 : 1>0 ? 32 : 1>2 ? 64 : 16"), 32, true);
-      iStat += EqnTest(_T("1>2 ? 1>2 ? 128 : 255 : 1>0 ? 32 :(1>2 ? 64 : 16)"), 32, true);
-      iStat += EqnTest(_T("1>0 ? 1>2 ? 128 : 255 :  1>0 ? 32 :1>2 ? 64 : 16"), 255, true);
-      iStat += EqnTest(_T("1>0 ? 1>2 ? 128 : 255 : (1>0 ? 32 :1>2 ? 64 : 16)"), 255, true);
-      iStat += EqnTest(_T("1 ? 0 ? 128 : 255 : 1 ? 32 : 64"), 255, true);
-
-      // assignment operators
-      iStat += EqnTest(_T("a= 0 ? 128 : 255, a"), 255, true);
-      iStat += EqnTest(_T("a=((a>b)&&(a<b)) ? 128 : 255, a"), 255, true);
-      iStat += EqnTest(_T("c=(a<b)&&(a<b) ? 128 : 255, c"), 128, true);
-      iStat += EqnTest(_T("0 ? a=a+1 : 666, a"), 1, true);
-      iStat += EqnTest(_T("1?a=10:a=20, a"), 10, true);
-      iStat += EqnTest(_T("0?a=10:a=20, a"), 20, true);
-      iStat += EqnTest(_T("0?a=sum(3,4):10, a"), 1, true);  // a should not change its value due to lazy calculation
-      
-      iStat += EqnTest(_T("a=1?b=1?3:4:5, a"), 3, true);
-      iStat += EqnTest(_T("a=1?b=1?3:4:5, b"), 3, true);
-      iStat += EqnTest(_T("a=0?b=1?3:4:5, a"), 5, true);
-      iStat += EqnTest(_T("a=0?b=1?3:4:5, b"), 2, true);
-
-      iStat += EqnTest(_T("a=1?5:b=1?3:4, a"), 5, true);
-      iStat += EqnTest(_T("a=1?5:b=1?3:4, b"), 2, true);
-      iStat += EqnTest(_T("a=0?5:b=1?3:4, a"), 3, true);
-      iStat += EqnTest(_T("a=0?5:b=1?3:4, b"), 3, true);
-
-      if (iStat==0) 
-        mu::console() << _T("passed") << endl;  
-      else 
-        mu::console() << _T("\n  failed with ") << iStat << _T(" errors") << endl;
-
-      return iStat;
-    }
-
-    //---------------------------------------------------------------------------
-    int ParserTester::TestException()
-    {
-      int  iStat = 0;
-      mu::console() << _T("testing error codes...");
-
-      iStat += ThrowTest(_T("3+"),           ecUNEXPECTED_EOF);
-      iStat += ThrowTest(_T("3+)"),          ecUNEXPECTED_PARENS);
-      iStat += ThrowTest(_T("()"),           ecUNEXPECTED_PARENS);
-      iStat += ThrowTest(_T("3+()"),         ecUNEXPECTED_PARENS);
-      iStat += ThrowTest(_T("sin(3,4)"),     ecTOO_MANY_PARAMS);
-      iStat += ThrowTest(_T("sin()"),        ecTOO_FEW_PARAMS);
-      iStat += ThrowTest(_T("(1+2"),         ecMISSING_PARENS);
-      iStat += ThrowTest(_T("sin(3)3"),      ecUNEXPECTED_VAL);
-      iStat += ThrowTest(_T("sin(3)xyz"),    ecUNASSIGNABLE_TOKEN);
-      iStat += ThrowTest(_T("sin(3)cos(3)"), ecUNEXPECTED_FUN);
-      iStat += ThrowTest(_T("a+b+c=10"),     ecUNEXPECTED_OPERATOR);
-      iStat += ThrowTest(_T("a=b=3"),        ecUNEXPECTED_OPERATOR);
-      
-#if defined(MUP_MATH_EXCEPTIONS)
-      // divide by zero whilst constant folding
-      iStat += ThrowTest(_T("1/0"),          ecDIV_BY_ZERO);
-      // square root of a negative number
-      iStat += ThrowTest(_T("sqrt(-1)"),     ecDOMAIN_ERROR);
-      // logarithms of zero
-      iStat += ThrowTest(_T("ln(0)"),        ecDOMAIN_ERROR);
-      iStat += ThrowTest(_T("log2(0)"),      ecDOMAIN_ERROR);
-      iStat += ThrowTest(_T("log10(0)"),     ecDOMAIN_ERROR);
-      iStat += ThrowTest(_T("log(0)"),       ecDOMAIN_ERROR);
-      // logarithms of negative values
-      iStat += ThrowTest(_T("ln(-1)"),       ecDOMAIN_ERROR);
-      iStat += ThrowTest(_T("log2(-1)"),     ecDOMAIN_ERROR);
-      iStat += ThrowTest(_T("log10(-1)"),    ecDOMAIN_ERROR);
-      iStat += ThrowTest(_T("log(-1)"),      ecDOMAIN_ERROR);
-#endif
-
-      // functions without parameter
-      iStat += ThrowTest( _T("3+ping(2)"),    ecTOO_MANY_PARAMS);
-      iStat += ThrowTest( _T("3+ping(a+2)"),  ecTOO_MANY_PARAMS);
-      iStat += ThrowTest( _T("3+ping(sin(a)+2)"),  ecTOO_MANY_PARAMS);
-      iStat += ThrowTest( _T("3+ping(1+sin(a))"),  ecTOO_MANY_PARAMS);
-
-      // String function related
-      iStat += ThrowTest( _T("valueof(\"xxx\")"),  999, false);
-      iStat += ThrowTest( _T("valueof()"),          ecUNEXPECTED_PARENS);
-      iStat += ThrowTest( _T("1+valueof(\"abc\""),  ecMISSING_PARENS);
-      iStat += ThrowTest( _T("valueof(\"abc\""),    ecMISSING_PARENS);
-      iStat += ThrowTest( _T("valueof(\"abc"),      ecUNTERMINATED_STRING);
-      iStat += ThrowTest( _T("valueof(\"abc\",3)"), ecTOO_MANY_PARAMS);
-      iStat += ThrowTest( _T("valueof(3)"),         ecSTRING_EXPECTED);
-      iStat += ThrowTest( _T("sin(\"abc\")"),       ecVAL_EXPECTED);
-      iStat += ThrowTest( _T("valueof(\"\\\"abc\\\"\")"),  999, false);
-      iStat += ThrowTest( _T("\"hello world\""),    ecSTR_RESULT);
-      iStat += ThrowTest( _T("(\"hello world\")"),  ecSTR_RESULT);
-      iStat += ThrowTest( _T("\"abcd\"+100"),       ecOPRT_TYPE_CONFLICT);
-      iStat += ThrowTest( _T("\"a\"+\"b\""),        ecOPRT_TYPE_CONFLICT);
-      iStat += ThrowTest( _T("strfun1(\"100\",3)"),     ecTOO_MANY_PARAMS);
-      iStat += ThrowTest( _T("strfun2(\"100\",3,5)"),   ecTOO_MANY_PARAMS);
-      iStat += ThrowTest( _T("strfun3(\"100\",3,5,6)"), ecTOO_MANY_PARAMS);
-      iStat += ThrowTest( _T("strfun2(\"100\")"),       ecTOO_FEW_PARAMS);
-      iStat += ThrowTest( _T("strfun3(\"100\",6)"),   ecTOO_FEW_PARAMS);
-      iStat += ThrowTest( _T("strfun2(1,1)"),         ecSTRING_EXPECTED);
-      iStat += ThrowTest( _T("strfun2(a,1)"),         ecSTRING_EXPECTED);
-      iStat += ThrowTest( _T("strfun2(1,1,1)"),       ecTOO_MANY_PARAMS);
-      iStat += ThrowTest( _T("strfun2(a,1,1)"),       ecTOO_MANY_PARAMS);
-      iStat += ThrowTest( _T("strfun3(1,2,3)"),         ecSTRING_EXPECTED);
-      iStat += ThrowTest( _T("strfun3(1, \"100\",3)"),  ecSTRING_EXPECTED);
-      iStat += ThrowTest( _T("strfun3(\"1\", \"100\",3)"),  ecVAL_EXPECTED);
-      iStat += ThrowTest( _T("strfun3(\"1\", 3, \"100\")"),  ecVAL_EXPECTED);
-      iStat += ThrowTest( _T("strfun3(\"1\", \"100\", \"100\", \"100\")"),  ecTOO_MANY_PARAMS);
-
-      // assignment operator
-      iStat += ThrowTest( _T("3=4"), ecUNEXPECTED_OPERATOR);
-      iStat += ThrowTest( _T("sin(8)=4"), ecUNEXPECTED_OPERATOR);
-      iStat += ThrowTest( _T("\"test\"=a"), ecUNEXPECTED_OPERATOR);
-
-      // <ibg 20090529>
-      // this is now legal, for reference see:
-      // https://sourceforge.net/forum/message.php?msg_id=7411373
-      //      iStat += ThrowTest( _T("sin=9"), ecUNEXPECTED_OPERATOR);    
-      // </ibg>
-
-      iStat += ThrowTest( _T("(8)=5"), ecUNEXPECTED_OPERATOR);
-      iStat += ThrowTest( _T("(a)=5"), ecUNEXPECTED_OPERATOR);
-      iStat += ThrowTest( _T("a=\"tttt\""), ecOPRT_TYPE_CONFLICT);
-
-      if (iStat==0) 
-        mu::console() << _T("passed") << endl;
-      else 
-        mu::console() << _T("\n  failed with ") << iStat << _T(" errors") << endl;
-
-      return iStat;
-    }
-
-
-    //---------------------------------------------------------------------------
-    void ParserTester::AddTest(testfun_type a_pFun)
-    {
-      m_vTestFun.push_back(a_pFun);
-    }
-
-    //---------------------------------------------------------------------------
-    void ParserTester::Run()
-    {
-      int iStat = 0;
-      try
-      {
-        for (int i=0; i<(int)m_vTestFun.size(); ++i)
-          iStat += (this->*m_vTestFun[i])();
-      }
-      catch(Parser::exception_type &e)
-      {
-        mu::console() << "\n" << e.GetMsg() << endl;
-        mu::console() << e.GetToken() << endl;
-        Abort();
-      }
-      catch(std::exception &e)
-      {
-        mu::console() << e.what() << endl;
-        Abort();
-      }
-      catch(...)
-      {
-        mu::console() << "Internal error";
-        Abort();
-      }
-
-      if (iStat==0) 
-      {
-        mu::console() << "Test passed (" <<  ParserTester::c_iCount << " expressions)" << endl;
-      }
-      else 
-      {
-        mu::console() << "Test failed with " << iStat 
-                  << " errors (" <<  ParserTester::c_iCount 
-                  << " expressions)" << endl;
-      }
-      ParserTester::c_iCount = 0;
-    }
-
-
-    //---------------------------------------------------------------------------
-    int ParserTester::ThrowTest(const string_type &a_str, int a_iErrc, bool a_bFail)
-    {
-      ParserTester::c_iCount++;
-
-      try
-      {
-        value_type fVal[] = {1,1,1};
-        Parser p;
-
-        p.DefineVar( _T("a"), &fVal[0]);
-        p.DefineVar( _T("b"), &fVal[1]);
-        p.DefineVar( _T("c"), &fVal[2]);
-        p.DefinePostfixOprt( _T("{m}"), Milli);
-        p.DefinePostfixOprt( _T("m"), Milli);
-        p.DefineFun( _T("ping"), Ping);
-        p.DefineFun( _T("valueof"), ValueOf);
-        p.DefineFun( _T("strfun1"), StrFun1);
-        p.DefineFun( _T("strfun2"), StrFun2);
-        p.DefineFun( _T("strfun3"), StrFun3);
-        p.SetExpr(a_str);
-        p.Eval();
-      }
-      catch(ParserError &e)
-      {
-        // output the formula in case of an failed test
-        if (a_bFail==false || (a_bFail==true && a_iErrc!=e.GetCode()) )
-        {
-          mu::console() << _T("\n  ") 
-                        << _T("Expression: ") << a_str 
-                        << _T("  Code:") << e.GetCode() << _T("(") << e.GetMsg() << _T(")")
-                        << _T("  Expected:") << a_iErrc;
-        }
-
-        return (a_iErrc==e.GetCode()) ? 0 : 1;
-      }
-
-      // if a_bFail==false no exception is expected
-      bool bRet((a_bFail==false) ? 0 : 1);
-      if (bRet==1)
-      {
-        mu::console() << _T("\n  ") 
-                      << _T("Expression: ") << a_str 
-                      << _T("  did evaluate; Expected error:") << a_iErrc;
-      }
-
-      return bRet; 
-    }
-
-    //---------------------------------------------------------------------------
-    /** \brief Evaluate a tet expression. 
-
-        \return 1 in case of a failure, 0 otherwise.
-    */
-    int ParserTester::EqnTestWithVarChange(const string_type &a_str, 
-                                           double a_fVar1, 
-                                           double a_fRes1, 
-                                           double a_fVar2, 
-                                           double a_fRes2)
-    {
-      ParserTester::c_iCount++;
-
-      try
-      {
-        value_type fVal[2] = {-999, -999 }; // should be equal
-	  
-        Parser  p;
-        value_type var = 0;
-
-        // variable
-        p.DefineVar( _T("a"), &var);
-        p.SetExpr(a_str);
-
-        var = a_fVar1;
-        fVal[0] = p.Eval();
-
-        var = a_fVar2;
-        fVal[1] = p.Eval();
-        
-        if ( fabs(a_fRes1-fVal[0]) > 0.0000000001)
-          throw std::runtime_error("incorrect result (first pass)");
-
-        if ( fabs(a_fRes2-fVal[1]) > 0.0000000001)
-          throw std::runtime_error("incorrect result (second pass)");
-      }
-      catch(Parser::exception_type &e)
-      {
-        mu::console() << _T("\n  fail: ") << a_str.c_str() << _T(" (") << e.GetMsg() << _T(")");
-        return 1;
-      }
-      catch(std::exception &e)
-      {
-        mu::console() << _T("\n  fail: ") << a_str.c_str() << _T(" (") << e.what() << _T(")");
-        return 1;  // always return a failure since this exception is not expected
-      }
-      catch(...)
-      {
-        mu::console() << _T("\n  fail: ") << a_str.c_str() <<  _T(" (unexpected exception)");
-        return 1;  // exceptions other than ParserException are not allowed
-      }
-
-      return 0;
-    }
-
-    //---------------------------------------------------------------------------
-    /** \brief Evaluate a tet expression. 
-
-        \return 1 in case of a failure, 0 otherwise.
-    */
-    int ParserTester::EqnTest(const string_type &a_str, double a_fRes, bool a_fPass)
-    {
-      ParserTester::c_iCount++;
-      int iRet(0);
-      value_type fVal[5] = {-999, -998, -997, -996, -995}; // initially should be different
-
-      try
-      {
-        std::auto_ptr<Parser> p1;
-        Parser  p2, p3;   // three parser objects
-                          // they will be used for testing copy and assignment operators
-        // p1 is a pointer since i'm going to delete it in order to test if
-        // parsers after copy construction still refer to members of it.
-        // !! If this is the case this function will crash !!
-      
-        p1.reset(new mu::Parser()); 
-        // Add constants
-        p1->DefineConst( _T("pi"), (value_type)PARSER_CONST_PI);
-        p1->DefineConst( _T("e"), (value_type)PARSER_CONST_E);
-        p1->DefineConst( _T("const"), 1);
-        p1->DefineConst( _T("const1"), 2);
-        p1->DefineConst( _T("const2"), 3);
-        // string constants
-        p1->DefineStrConst( _T("str1"), _T("1.11"));
-        p1->DefineStrConst( _T("str2"), _T("2.22"));
-        // variables
-        value_type vVarVal[] = { 1, 2, 3, -2};
-        p1->DefineVar( _T("a"), &vVarVal[0]);
-        p1->DefineVar( _T("aa"), &vVarVal[1]);
-        p1->DefineVar( _T("b"), &vVarVal[1]);
-        p1->DefineVar( _T("c"), &vVarVal[2]);
-        p1->DefineVar( _T("d"), &vVarVal[3]);
-        
-        // custom value ident functions
-        p1->AddValIdent(&ParserTester::IsHexVal);        
-
-        // functions
-        p1->DefineFun( _T("ping"), Ping);
-        p1->DefineFun( _T("f1of1"), f1of1);  // one parameter
-        p1->DefineFun( _T("f1of2"), f1of2);  // two parameter
-        p1->DefineFun( _T("f2of2"), f2of2);
-        p1->DefineFun( _T("f1of3"), f1of3);  // three parameter
-        p1->DefineFun( _T("f2of3"), f2of3);
-        p1->DefineFun( _T("f3of3"), f3of3);
-        p1->DefineFun( _T("f1of4"), f1of4);  // four parameter
-        p1->DefineFun( _T("f2of4"), f2of4);
-        p1->DefineFun( _T("f3of4"), f3of4);
-        p1->DefineFun( _T("f4of4"), f4of4);
-        p1->DefineFun( _T("f1of5"), f1of5);  // five parameter
-        p1->DefineFun( _T("f2of5"), f2of5);
-        p1->DefineFun( _T("f3of5"), f3of5);
-        p1->DefineFun( _T("f4of5"), f4of5);
-        p1->DefineFun( _T("f5of5"), f5of5);
-
-        // binary operators
-        p1->DefineOprt( _T("add"), add, 0);
-        p1->DefineOprt( _T("++"), add, 0);
-        p1->DefineOprt( _T("&"), land, prLAND);
-
-        // sample functions
-        p1->DefineFun( _T("min"), Min);
-        p1->DefineFun( _T("max"), Max);
-        p1->DefineFun( _T("sum"), Sum);
-        p1->DefineFun( _T("valueof"), ValueOf);
-        p1->DefineFun( _T("atof"), StrToFloat);
-        p1->DefineFun( _T("strfun1"), StrFun1);
-        p1->DefineFun( _T("strfun2"), StrFun2);
-        p1->DefineFun( _T("strfun3"), StrFun3);
-        p1->DefineFun( _T("lastArg"), LastArg);
-        p1->DefineFun( _T("firstArg"), FirstArg);
-        p1->DefineFun( _T("order"), FirstArg);
-
-        // infix / postfix operator
-        // Note: Identifiers used here do not have any meaning 
-        //       they are mere placeholders to test certain features.
-        p1->DefineInfixOprt( _T("$"), sign, prPOW+1);  // sign with high priority
-        p1->DefineInfixOprt( _T("~"), plus2);          // high priority
-        p1->DefineInfixOprt( _T("~~"), plus2);
-        p1->DefinePostfixOprt( _T("{m}"), Milli);
-        p1->DefinePostfixOprt( _T("{M}"), Mega);
-        p1->DefinePostfixOprt( _T("m"), Milli);
-        p1->DefinePostfixOprt( _T("meg"), Mega);
-        p1->DefinePostfixOprt( _T("#"), times3);
-        p1->DefinePostfixOprt( _T("'"), sqr); 
-        p1->SetExpr(a_str);
-
-        // Test bytecode integrity
-        // String parsing and bytecode parsing must yield the same result
-        fVal[0] = p1->Eval(); // result from stringparsing
-        fVal[1] = p1->Eval(); // result from bytecode
-        if (fVal[0]!=fVal[1])
-          throw Parser::exception_type( _T("Bytecode / string parsing mismatch.") );
-
-        // Test copy and assignment operators
-        try
-        {
-          // Test copy constructor
-          std::vector<mu::Parser> vParser;
-          vParser.push_back(*(p1.get()));
-          mu::Parser p2 = vParser[0];   // take parser from vector
-        
-          // destroy the originals from p2
-          vParser.clear();              // delete the vector
-          p1.reset(0);
-
-          fVal[2] = p2.Eval();
-
-          // Test assignment operator
-          // additionally  disable Optimizer this time
-          mu::Parser p3;
-          p3 = p2;
-          p3.EnableOptimizer(false);
-          fVal[3] = p3.Eval();
-
-          // Test Eval function for multiple return values
-          // use p2 since it has the optimizer enabled!
-          int nNum;
-          value_type *v = p2.Eval(nNum);
-          fVal[4] = v[nNum-1];
-        }
-        catch(std::exception &e)
-        {
-          mu::console() << _T("\n  ") << e.what() << _T("\n");
-        }
-
-        // limited floating point accuracy requires the following test
-        bool bCloseEnough(true);
-        for (unsigned i=0; i<sizeof(fVal)/sizeof(value_type); ++i)
-        {
-          bCloseEnough &= (fabs(a_fRes-fVal[i]) <= fabs(fVal[i]*0.00001));
-
-          // The tests equations never result in infinity, if they do thats a bug.
-          // reference:
-          // http://sourceforge.net/projects/muparser/forums/forum/462843/topic/5037825
-          #pragma warning(push)
-          #pragma warning(disable:4127)
-		  if (std::numeric_limits<value_type>::has_infinity)
-          #pragma warning(pop)
-		  {
-            bCloseEnough &= (fabs(fVal[i]) != numeric_limits<value_type>::infinity());
-		  }
-		}
-
-        iRet = ((bCloseEnough && a_fPass) || (!bCloseEnough && !a_fPass)) ? 0 : 1;
-        
-        
-        if (iRet==1)
-        {
-          mu::console() << _T("\n  fail: ") << a_str.c_str() 
-                        << _T(" (incorrect result; expected: ") << a_fRes
-                        << _T(" ;calculated: ") << fVal[0] << _T(",") 
-                                                << fVal[1] << _T(",")
-                                                << fVal[2] << _T(",")
-                                                << fVal[3] << _T(",")
-                                                << fVal[4] << _T(").");
-        }
-      }
-      catch(Parser::exception_type &e)
-      {
-        if (a_fPass)
-        {
-          if (fVal[0]!=fVal[2] && fVal[0]!=-999 && fVal[1]!=-998)
-            mu::console() << _T("\n  fail: ") << a_str.c_str() << _T(" (copy construction)");
-          else
-            mu::console() << _T("\n  fail: ") << a_str.c_str() << _T(" (") << e.GetMsg() << _T(")");
-          return 1;
-        }
-      }
-      catch(std::exception &e)
-      {
-        mu::console() << _T("\n  fail: ") << a_str.c_str() << _T(" (") << e.what() << _T(")");
-        return 1;  // always return a failure since this exception is not expected
-      }
-      catch(...)
-      {
-        mu::console() << _T("\n  fail: ") << a_str.c_str() <<  _T(" (unexpected exception)");
-        return 1;  // exceptions other than ParserException are not allowed
-      }
-
-      return iRet;
-    }
-
-    //---------------------------------------------------------------------------
-    int ParserTester::EqnTestInt(const string_type &a_str, double a_fRes, bool a_fPass)
-    {
-      ParserTester::c_iCount++;
-
-      value_type vVarVal[] = {1, 2, 3};   // variable values
-      int iRet(0);
-
-      try
-      {
-        value_type fVal[2] = {-99, -999};   // results: initially should be different
-        ParserInt p;
-        p.DefineConst( _T("const1"), 1);
-        p.DefineConst( _T("const2"), 2);
-        p.DefineVar( _T("a"), &vVarVal[0]);
-        p.DefineVar( _T("b"), &vVarVal[1]);
-        p.DefineVar( _T("c"), &vVarVal[2]);
-
-        p.SetExpr(a_str);
-        fVal[0] = p.Eval(); // result from stringparsing
-        fVal[1] = p.Eval(); // result from bytecode
-
-        if (fVal[0]!=fVal[1])
-          throw Parser::exception_type( _T("Bytecode corrupt.") );
-
-        iRet =  ( (a_fRes==fVal[0] &&  a_fPass) || 
-                  (a_fRes!=fVal[0] && !a_fPass) ) ? 0 : 1;
-        if (iRet==1)
-        {
-          mu::console() << _T("\n  fail: ") << a_str.c_str() 
-                        << _T(" (incorrect result; expected: ") << a_fRes 
-                        << _T(" ;calculated: ") << fVal[0]<< _T(").");
-        }
-      }
-      catch(Parser::exception_type &e)
-      {
-        if (a_fPass)
-        {
-          mu::console() << _T("\n  fail: ") << e.GetExpr() << _T(" : ") << e.GetMsg();
-          iRet = 1;
-        }
-      }
-      catch(...)
-      {
-        mu::console() << _T("\n  fail: ") << a_str.c_str() <<  _T(" (unexpected exception)");
-        iRet = 1;  // exceptions other than ParserException are not allowed
-      }
-
-      return iRet;
-    }
-
-    //---------------------------------------------------------------------------
-    /** \brief Test an expression in Bulk Mode. */
-    int ParserTester::EqnTestBulk(const string_type &a_str, double a_fRes[4], bool a_fPass)
-    {
-        ParserTester::c_iCount++;
-
-        // Define Bulk Variables
-        int nBulkSize = 4;
-        value_type vVariableA[] = { 1, 2, 3, 4 };   // variable values
-        value_type vVariableB[] = { 2, 2, 2, 2 };   // variable values
-        value_type vVariableC[] = { 3, 3, 3, 3 };   // variable values
-        value_type vResults[] = { 0, 0, 0, 0 };   // variable values
-        int iRet(0);
-
-        try
-        {
-            Parser p;
-            p.DefineConst(_T("const1"), 1);
-            p.DefineConst(_T("const2"), 2);
-            p.DefineVar(_T("a"), vVariableA);
-            p.DefineVar(_T("b"), vVariableB);
-            p.DefineVar(_T("c"), vVariableC);
-
-            p.SetExpr(a_str);
-            p.Eval(vResults, nBulkSize);
-
-            bool bCloseEnough(true);
-            for (int i = 0; i < nBulkSize; ++i)
-            {
-                bCloseEnough &= (fabs(a_fRes[i] - vResults[i]) <= fabs(a_fRes[i] * 0.00001));
-            }
-
-            iRet = ((bCloseEnough && a_fPass) || (!bCloseEnough && !a_fPass)) ? 0 : 1;
-            if (iRet == 1)
-            {
-                mu::console() << _T("\n  fail: ") << a_str.c_str()
-                    << _T(" (incorrect result; expected: {") << a_fRes[0] << _T(",") << a_fRes[1] << _T(",") << a_fRes[2] << _T(",") << a_fRes[3] << _T("}")
-                    << _T(" ;calculated: ") << vResults[0] << _T(",") << vResults[1] << _T(",") << vResults[2] << _T(",") << vResults[3] << _T("}");
-            }
-        }
-        catch (Parser::exception_type &e)
-        {
-            if (a_fPass)
-            {
-                mu::console() << _T("\n  fail: ") << e.GetExpr() << _T(" : ") << e.GetMsg();
-                iRet = 1;
-            }
-        }
-        catch (...)
-        {
-            mu::console() << _T("\n  fail: ") << a_str.c_str() << _T(" (unexpected exception)");
-            iRet = 1;  // exceptions other than ParserException are not allowed
-        }
-
-        return iRet;
-    }
-
-    //---------------------------------------------------------------------------
-    /** \brief Internal error in test class Test is going to be aborted. */
-    void ParserTester::Abort() const
-    {
-      mu::console() << _T("Test failed (internal error in test class)") << endl;
-      while (!getchar());
-      exit(-1);
-    }
-  } // namespace test
-} // namespace mu
+/*
+                 __________
+    _____   __ __\______   \_____  _______  ______  ____ _______
+   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
+  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
+  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|
+        \/                       \/            \/      \/
+  Copyright (C) 2013 Ingo Berg
+
+  Permission is hereby granted, free of charge, to any person obtaining a copy of this
+  software and associated documentation files (the "Software"), to deal in the Software
+  without restriction, including without limitation the rights to use, copy, modify,
+  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
+  permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included in all copies or
+  substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
+  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include "muParserTest.h"
+
+#include <cstdio>
+#include <cmath>
+#include <iostream>
+#include <limits>
+
+#define PARSER_CONST_PI  3.141592653589793238462643
+#define PARSER_CONST_E   2.718281828459045235360287
+
+using namespace std;
+
+/** \file
+    \brief This file contains the implementation of parser test cases.
+*/
+
+namespace mu
+{
+  namespace Test
+  {
+    int ParserTester::c_iCount = 0;
+
+    //---------------------------------------------------------------------------------------------
+    ParserTester::ParserTester()
+      :m_vTestFun()
+    {
+      AddTest(&ParserTester::TestNames);
+      AddTest(&ParserTester::TestSyntax);
+      AddTest(&ParserTester::TestPostFix);
+      AddTest(&ParserTester::TestInfixOprt);
+      AddTest(&ParserTester::TestVarConst);
+      AddTest(&ParserTester::TestMultiArg);
+      AddTest(&ParserTester::TestExpression);
+      AddTest(&ParserTester::TestIfThenElse);
+      AddTest(&ParserTester::TestInterface);
+      AddTest(&ParserTester::TestBinOprt);
+      AddTest(&ParserTester::TestException);
+      AddTest(&ParserTester::TestStrArg);
+      AddTest(&ParserTester::TestBulkMode);
+
+      ParserTester::c_iCount = 0;
+    }
+
+    //---------------------------------------------------------------------------------------------
+    int ParserTester::IsHexVal(const char_type *a_szExpr, int *a_iPos, value_type *a_fVal)
+    {
+      if (a_szExpr[1]==0 || (a_szExpr[0]!='0' || a_szExpr[1]!='x') )
+        return 0;
+
+      unsigned iVal(0);
+
+      // New code based on streams for UNICODE compliance:
+      stringstream_type::pos_type nPos(0);
+      stringstream_type ss(a_szExpr + 2);
+      ss >> std::hex >> iVal;
+      nPos = ss.tellg();
+
+      if (nPos==(stringstream_type::pos_type)0)
+        return 1;
+
+      *a_iPos += (int)(2 + nPos);
+      *a_fVal = (value_type)iVal;
+      return 1;
+    }
+
+    //---------------------------------------------------------------------------------------------
+    int ParserTester::TestInterface()
+    {
+      int iStat = 0;
+      mu::console() << _T("testing member functions...");
+
+      // Test RemoveVar
+      value_type afVal[3] = {1,2,3};
+      Parser p;
+
+      try
+      {
+        p.DefineVar( _T("a"), &afVal[0]);
+        p.DefineVar( _T("b"), &afVal[1]);
+        p.DefineVar( _T("c"), &afVal[2]);
+        p.SetExpr( _T("a+b+c") );
+        p.Eval();
+      }
+      catch(...)
+      {
+        iStat += 1;  // this is not supposed to happen
+      }
+
+      try
+      {
+        p.RemoveVar( _T("c") );
+        p.Eval();
+        iStat += 1;  // not supposed to reach this, nonexisting variable "c" deleted...
+      }
+      catch(...)
+      {
+        // failure is expected...
+      }
+
+      if (iStat==0)
+        mu::console() << _T("passed") << endl;
+      else
+        mu::console() << _T("\n  failed with ") << iStat << _T(" errors") << endl;
+
+      return iStat;
+    }
+
+    //---------------------------------------------------------------------------------------------
+    int ParserTester::TestStrArg()
+    {
+      int iStat = 0;
+      mu::console() << _T("testing string arguments...");
+
+      iStat += EqnTest(_T("valueof(\"\")"), 123, true);   // empty string arguments caused a crash
+      iStat += EqnTest(_T("valueof(\"aaa\")+valueof(\"bbb\")  "), 246, true);
+      iStat += EqnTest(_T("2*(valueof(\"aaa\")-23)+valueof(\"bbb\")"), 323, true);
+      // use in expressions with variables
+      iStat += EqnTest(_T("a*(atof(\"10\")-b)"), 8, true);
+      iStat += EqnTest(_T("a-(atof(\"10\")*b)"), -19, true);
+      // string + numeric arguments
+      iStat += EqnTest(_T("strfun1(\"100\")"), 100, true);
+      iStat += EqnTest(_T("strfun2(\"100\",1)"), 101, true);
+      iStat += EqnTest(_T("strfun3(\"99\",1,2)"), 102, true);
+      // string constants
+      iStat += EqnTest(_T("atof(str1)+atof(str2)"), 3.33, true);
+
+      if (iStat==0)
+        mu::console() << _T("passed") << endl;
+      else
+        mu::console() << _T("\n  failed with ") << iStat << _T(" errors") << endl;
+
+      return iStat;
+    }
+
+    //---------------------------------------------------------------------------------------------
+    int ParserTester::TestBulkMode()
+    {
+        int iStat = 0;
+        mu::console() << _T("testing bulkmode...");
+
+#define EQN_TEST_BULK(EXPR, R1, R2, R3, R4, PASS) \
+        { \
+          double res[] = { R1, R2, R3, R4 }; \
+          iStat += EqnTestBulk(_T(EXPR), res, (PASS)); \
+        }
+
+        // Bulk Variables for the test:
+        // a: 1,2,3,4
+        // b: 2,2,2,2
+        // c: 3,3,3,3
+        // d: 5,4,3,2
+        EQN_TEST_BULK("a",   1, 1, 1, 1, false)
+        EQN_TEST_BULK("a",   1, 2, 3, 4, true)
+        EQN_TEST_BULK("b=a", 1, 2, 3, 4, true)
+        EQN_TEST_BULK("b=a, b*10", 10, 20, 30, 40, true)
+        EQN_TEST_BULK("b=a, b*10, a", 1, 2, 3, 4, true)
+        EQN_TEST_BULK("a+b", 3, 4, 5, 6, true)
+        EQN_TEST_BULK("c*(a+b)", 9, 12, 15, 18, true)
+#undef EQN_TEST_BULK
+
+        if (iStat == 0)
+            mu::console() << _T("passed") << endl;
+        else
+            mu::console() << _T("\n  failed with ") << iStat << _T(" errors") << endl;
+
+        return iStat;
+    }
+
+    //---------------------------------------------------------------------------------------------
+    int ParserTester::TestBinOprt()
+    {
+      int iStat = 0;
+      mu::console() << _T("testing binary operators...");
+
+      // built in operators
+      // xor operator
+
+      iStat += EqnTest(_T("a++b"), 3, true);
+      iStat += EqnTest(_T("a ++ b"), 3, true);
+      iStat += EqnTest(_T("1++2"), 3, true);
+      iStat += EqnTest(_T("1 ++ 2"), 3, true);
+      iStat += EqnTest(_T("a add b"), 3, true);
+      iStat += EqnTest(_T("1 add 2"), 3, true);
+      iStat += EqnTest(_T("a<b"), 1, true);
+      iStat += EqnTest(_T("b>a"), 1, true);
+      iStat += EqnTest(_T("a>a"), 0, true);
+      iStat += EqnTest(_T("a<a"), 0, true);
+      iStat += EqnTest(_T("a>a"), 0, true);
+      iStat += EqnTest(_T("a<=a"), 1, true);
+      iStat += EqnTest(_T("a<=b"), 1, true);
+      iStat += EqnTest(_T("b<=a"), 0, true);
+      iStat += EqnTest(_T("a>=a"), 1, true);
+      iStat += EqnTest(_T("b>=a"), 1, true);
+      iStat += EqnTest(_T("a>=b"), 0, true);
+
+      // Test logical operators, especially if user defined "&" and the internal "&&" collide
+      iStat += EqnTest(_T("1 && 1"), 1, true);
+      iStat += EqnTest(_T("1 && 0"), 0, true);
+      iStat += EqnTest(_T("(a<b) && (b>a)"), 1, true);
+      iStat += EqnTest(_T("(a<b) && (a>b)"), 0, true);
+      //iStat += EqnTest(_T("12 and 255"), 12, true);
+      //iStat += EqnTest(_T("12 and 0"), 0, true);
+      iStat += EqnTest(_T("12 & 255"), 12, true);
+      iStat += EqnTest(_T("12 & 0"), 0, true);
+      iStat += EqnTest(_T("12&255"), 12, true);
+      iStat += EqnTest(_T("12&0"), 0, true);
+
+      // Assignment operator
+      iStat += EqnTest(_T("a = b"), 2, true);
+      iStat += EqnTest(_T("a = sin(b)"), 0.909297, true);
+      iStat += EqnTest(_T("a = 1+sin(b)"), 1.909297, true);
+      iStat += EqnTest(_T("(a=b)*2"), 4, true);
+      iStat += EqnTest(_T("2*(a=b)"), 4, true);
+      iStat += EqnTest(_T("2*(a=b+1)"), 6, true);
+      iStat += EqnTest(_T("(a=b+1)*2"), 6, true);
+      iStat += EqnTest(_T("a=c, a*10"), 30, true);
+
+      iStat += EqnTest(_T("2^2^3"), 256, true);
+      iStat += EqnTest(_T("1/2/3"), 1.0/6.0, true);
+
+      // reference: http://www.wolframalpha.com/input/?i=3%2B4*2%2F%281-5%29^2^3
+      iStat += EqnTest(_T("3+4*2/(1-5)^2^3"), 3.0001220703125, true);
+
+      // Test user defined binary operators
+      iStat += EqnTestInt(_T("1 | 2"), 3, true);
+      iStat += EqnTestInt(_T("1 || 2"), 1, true);
+      iStat += EqnTestInt(_T("123 & 456"), 72, true);
+      iStat += EqnTestInt(_T("(123 & 456) % 10"), 2, true);
+      iStat += EqnTestInt(_T("1 && 0"), 0, true);
+      iStat += EqnTestInt(_T("123 && 456"), 1, true);
+      iStat += EqnTestInt(_T("1 << 3"), 8, true);
+      iStat += EqnTestInt(_T("8 >> 3"), 1, true);
+      iStat += EqnTestInt(_T("9 / 4"), 2, true);
+      iStat += EqnTestInt(_T("9 % 4"), 1, true);
+      iStat += EqnTestInt(_T("if(5%2,1,0)"), 1, true);
+      iStat += EqnTestInt(_T("if(4%2,1,0)"), 0, true);
+      iStat += EqnTestInt(_T("-10+1"), -9, true);
+      iStat += EqnTestInt(_T("1+2*3"), 7, true);
+      iStat += EqnTestInt(_T("const1 != const2"), 1, true);
+      iStat += EqnTestInt(_T("const1 != const2"), 0, false);
+      iStat += EqnTestInt(_T("const1 == const2"), 0, true);
+      iStat += EqnTestInt(_T("const1 == 1"), 1, true);
+      iStat += EqnTestInt(_T("10*(const1 == 1)"), 10, true);
+      iStat += EqnTestInt(_T("2*(const1 | const2)"), 6, true);
+      iStat += EqnTestInt(_T("2*(const1 | const2)"), 7, false);
+      iStat += EqnTestInt(_T("const1 < const2"), 1, true);
+      iStat += EqnTestInt(_T("const2 > const1"), 1, true);
+      iStat += EqnTestInt(_T("const1 <= 1"), 1, true);
+      iStat += EqnTestInt(_T("const2 >= 2"), 1, true);
+      iStat += EqnTestInt(_T("2*(const1 + const2)"), 6, true);
+      iStat += EqnTestInt(_T("2*(const1 - const2)"), -2, true);
+      iStat += EqnTestInt(_T("a != b"), 1, true);
+      iStat += EqnTestInt(_T("a != b"), 0, false);
+      iStat += EqnTestInt(_T("a == b"), 0, true);
+      iStat += EqnTestInt(_T("a == 1"), 1, true);
+      iStat += EqnTestInt(_T("10*(a == 1)"), 10, true);
+      iStat += EqnTestInt(_T("2*(a | b)"), 6, true);
+      iStat += EqnTestInt(_T("2*(a | b)"), 7, false);
+      iStat += EqnTestInt(_T("a < b"), 1, true);
+      iStat += EqnTestInt(_T("b > a"), 1, true);
+      iStat += EqnTestInt(_T("a <= 1"), 1, true);
+      iStat += EqnTestInt(_T("b >= 2"), 1, true);
+      iStat += EqnTestInt(_T("2*(a + b)"), 6, true);
+      iStat += EqnTestInt(_T("2*(a - b)"), -2, true);
+      iStat += EqnTestInt(_T("a + (a << b)"), 5, true);
+      iStat += EqnTestInt(_T("-2^2"), -4, true);
+      iStat += EqnTestInt(_T("3--a"), 4, true);
+      iStat += EqnTestInt(_T("3+-3^2"), -6, true);
+
+      // Test reading of hex values:
+      iStat += EqnTestInt(_T("0xff"), 255, true);
+      iStat += EqnTestInt(_T("10+0xff"), 265, true);
+      iStat += EqnTestInt(_T("0xff+10"), 265, true);
+      iStat += EqnTestInt(_T("10*0xff"), 2550, true);
+      iStat += EqnTestInt(_T("0xff*10"), 2550, true);
+      iStat += EqnTestInt(_T("10+0xff+1"), 266, true);
+      iStat += EqnTestInt(_T("1+0xff+10"), 266, true);
+
+// incorrect: '^' is yor here, not power
+//    iStat += EqnTestInt("-(1+2)^2", -9, true);
+//    iStat += EqnTestInt("-1^3", -1, true);
+
+      // Test precedence
+      // a=1, b=2, c=3
+      iStat += EqnTestInt(_T("a + b * c"), 7, true);
+      iStat += EqnTestInt(_T("a * b + c"), 5, true);
+      iStat += EqnTestInt(_T("a<b && b>10"), 0, true);
+      iStat += EqnTestInt(_T("a<b && b<10"), 1, true);
+
+      iStat += EqnTestInt(_T("a + b << c"), 17, true);
+      iStat += EqnTestInt(_T("a << b + c"), 7, true);
+      iStat += EqnTestInt(_T("c * b < a"), 0, true);
+      iStat += EqnTestInt(_T("c * b == 6 * a"), 1, true);
+      iStat += EqnTestInt(_T("2^2^3"), 256, true);
+
+
+      if (iStat==0)
+        mu::console() << _T("passed") << endl;
+      else
+        mu::console() << _T("\n  failed with ") << iStat << _T(" errors") << endl;
+
+      return iStat;
+    }
+
+    //---------------------------------------------------------------------------------------------
+    /** \brief Check muParser name restriction enforcement. */
+    int ParserTester::TestNames()
+    {
+      int  iStat= 0,
+           iErr = 0;
+
+      mu::console() << "testing name restriction enforcement...";
+
+      Parser p;
+
+  #define PARSER_THROWCHECK(DOMAIN, FAIL, EXPR, ARG) \
+      iErr = 0;                                      \
+      ParserTester::c_iCount++;                      \
+      try                                            \
+      {                                              \
+        p.Define##DOMAIN(EXPR, ARG);                 \
+      }                                              \
+      catch(Parser::exception_type&)                 \
+      {                                              \
+        iErr = (FAIL==false) ? 0 : 1;                \
+      }                                              \
+      iStat += iErr;
+
+      // constant names
+      PARSER_THROWCHECK(Const, false, _T("0a"), 1)
+      PARSER_THROWCHECK(Const, false, _T("9a"), 1)
+      PARSER_THROWCHECK(Const, false, _T("+a"), 1)
+      PARSER_THROWCHECK(Const, false, _T("-a"), 1)
+      PARSER_THROWCHECK(Const, false, _T("a-"), 1)
+      PARSER_THROWCHECK(Const, false, _T("a*"), 1)
+      PARSER_THROWCHECK(Const, false, _T("a?"), 1)
+      PARSER_THROWCHECK(Const, true, _T("a"), 1)
+      PARSER_THROWCHECK(Const, true, _T("a_min"), 1)
+      PARSER_THROWCHECK(Const, true, _T("a_min0"), 1)
+      PARSER_THROWCHECK(Const, true, _T("a_min9"), 1)
+      // variable names
+      value_type a;
+      p.ClearConst();
+      PARSER_THROWCHECK(Var, false, _T("123abc"), &a)
+      PARSER_THROWCHECK(Var, false, _T("9a"), &a)
+      PARSER_THROWCHECK(Var, false, _T("0a"), &a)
+      PARSER_THROWCHECK(Var, false, _T("+a"), &a)
+      PARSER_THROWCHECK(Var, false, _T("-a"), &a)
+      PARSER_THROWCHECK(Var, false, _T("?a"), &a)
+      PARSER_THROWCHECK(Var, false, _T("!a"), &a)
+      PARSER_THROWCHECK(Var, false, _T("a+"), &a)
+      PARSER_THROWCHECK(Var, false, _T("a-"), &a)
+      PARSER_THROWCHECK(Var, false, _T("a*"), &a)
+      PARSER_THROWCHECK(Var, false, _T("a?"), &a)
+      PARSER_THROWCHECK(Var, true, _T("a"), &a)
+      PARSER_THROWCHECK(Var, true, _T("a_min"), &a)
+      PARSER_THROWCHECK(Var, true, _T("a_min0"), &a)
+      PARSER_THROWCHECK(Var, true, _T("a_min9"), &a)
+      PARSER_THROWCHECK(Var, false, _T("a_min9"), 0)
+      // Postfix operators
+      // fail
+      PARSER_THROWCHECK(PostfixOprt, false, _T("(k"), f1of1)
+      PARSER_THROWCHECK(PostfixOprt, false, _T("9+"), f1of1)
+      PARSER_THROWCHECK(PostfixOprt, false, _T("+"), 0)
+      // pass
+      PARSER_THROWCHECK(PostfixOprt, true, _T("-a"),  f1of1)
+      PARSER_THROWCHECK(PostfixOprt, true, _T("?a"),  f1of1)
+      PARSER_THROWCHECK(PostfixOprt, true, _T("_"),   f1of1)
+      PARSER_THROWCHECK(PostfixOprt, true, _T("#"),   f1of1)
+      PARSER_THROWCHECK(PostfixOprt, true, _T("&&"),  f1of1)
+      PARSER_THROWCHECK(PostfixOprt, true, _T("||"),  f1of1)
+      PARSER_THROWCHECK(PostfixOprt, true, _T("&"),   f1of1)
+      PARSER_THROWCHECK(PostfixOprt, true, _T("|"),   f1of1)
+      PARSER_THROWCHECK(PostfixOprt, true, _T("++"),  f1of1)
+      PARSER_THROWCHECK(PostfixOprt, true, _T("--"),  f1of1)
+      PARSER_THROWCHECK(PostfixOprt, true, _T("?>"),  f1of1)
+      PARSER_THROWCHECK(PostfixOprt, true, _T("?<"),  f1of1)
+      PARSER_THROWCHECK(PostfixOprt, true, _T("**"),  f1of1)
+      PARSER_THROWCHECK(PostfixOprt, true, _T("xor"), f1of1)
+      PARSER_THROWCHECK(PostfixOprt, true, _T("and"), f1of1)
+      PARSER_THROWCHECK(PostfixOprt, true, _T("or"),  f1of1)
+      PARSER_THROWCHECK(PostfixOprt, true, _T("not"), f1of1)
+      PARSER_THROWCHECK(PostfixOprt, true, _T("!"),   f1of1)
+      // Binary operator
+      // The following must fail with builtin operators activated
+      // p.EnableBuiltInOp(true); -> this is the default
+      p.ClearPostfixOprt();
+      PARSER_THROWCHECK(Oprt, false, _T("+"),  f1of2)
+      PARSER_THROWCHECK(Oprt, false, _T("-"),  f1of2)
+      PARSER_THROWCHECK(Oprt, false, _T("*"),  f1of2)
+      PARSER_THROWCHECK(Oprt, false, _T("/"),  f1of2)
+      PARSER_THROWCHECK(Oprt, false, _T("^"),  f1of2)
+      PARSER_THROWCHECK(Oprt, false, _T("&&"),  f1of2)
+      PARSER_THROWCHECK(Oprt, false, _T("||"),  f1of2)
+      // without activated built in operators it should work
+      p.EnableBuiltInOprt(false);
+      PARSER_THROWCHECK(Oprt, true, _T("+"),  f1of2)
+      PARSER_THROWCHECK(Oprt, true, _T("-"),  f1of2)
+      PARSER_THROWCHECK(Oprt, true, _T("*"),  f1of2)
+      PARSER_THROWCHECK(Oprt, true, _T("/"),  f1of2)
+      PARSER_THROWCHECK(Oprt, true, _T("^"),  f1of2)
+      PARSER_THROWCHECK(Oprt, true, _T("&&"),  f1of2)
+      PARSER_THROWCHECK(Oprt, true, _T("||"),  f1of2)
+  #undef PARSER_THROWCHECK
+
+      if (iStat==0)
+        mu::console() << _T("passed") << endl;
+      else
+        mu::console() << _T("\n  failed with ") << iStat << _T(" errors") << endl;
+
+      return iStat;
+    }
+
+    //---------------------------------------------------------------------------
+    int ParserTester::TestSyntax()
+    {
+      int iStat = 0;
+      mu::console() << _T("testing syntax engine...");
+
+      iStat += ThrowTest(_T("1,"), ecUNEXPECTED_EOF);  // incomplete hex definition
+      iStat += ThrowTest(_T("a,"), ecUNEXPECTED_EOF);  // incomplete hex definition
+      iStat += ThrowTest(_T("sin(8),"), ecUNEXPECTED_EOF);  // incomplete hex definition
+      iStat += ThrowTest(_T("(sin(8)),"), ecUNEXPECTED_EOF);  // incomplete hex definition
+      iStat += ThrowTest(_T("a{m},"), ecUNEXPECTED_EOF);  // incomplete hex definition
+
+      iStat += EqnTest(_T("(1+ 2*a)"), 3, true);   // Spaces within formula
+      iStat += EqnTest(_T("sqrt((4))"), 2, true);  // Multiple brackets
+      iStat += EqnTest(_T("sqrt((2)+2)"), 2, true);// Multiple brackets
+      iStat += EqnTest(_T("sqrt(2+(2))"), 2, true);// Multiple brackets
+      iStat += EqnTest(_T("sqrt(a+(3))"), 2, true);// Multiple brackets
+      iStat += EqnTest(_T("sqrt((3)+a)"), 2, true);// Multiple brackets
+      iStat += EqnTest(_T("order(1,2)"), 1, true); // May not cause name collision with operator "or"
+      iStat += EqnTest(_T("(2+"), 0, false);       // missing closing bracket
+      iStat += EqnTest(_T("2++4"), 0, false);      // unexpected operator
+      iStat += EqnTest(_T("2+-4"), 0, false);      // unexpected operator
+      iStat += EqnTest(_T("(2+)"), 0, false);      // unexpected closing bracket
+      iStat += EqnTest(_T("--2"), 0, false);       // double sign
+      iStat += EqnTest(_T("ksdfj"), 0, false);     // unknown token
+      iStat += EqnTest(_T("()"), 0, false);        // empty bracket without a function
+      iStat += EqnTest(_T("5+()"), 0, false);      // empty bracket without a function
+      iStat += EqnTest(_T("sin(cos)"), 0, false);  // unexpected function
+      iStat += EqnTest(_T("5t6"), 0, false);       // unknown token
+      iStat += EqnTest(_T("5 t 6"), 0, false);     // unknown token
+      iStat += EqnTest(_T("8*"), 0, false);        // unexpected end of formula
+      iStat += EqnTest(_T(",3"), 0, false);        // unexpected comma
+      iStat += EqnTest(_T("3,5"), 0, false);       // unexpected comma
+      iStat += EqnTest(_T("sin(8,8)"), 0, false);  // too many function args
+      iStat += EqnTest(_T("(7,8)"), 0, false);     // too many function args
+      iStat += EqnTest(_T("sin)"), 0, false);      // unexpected closing bracket
+      iStat += EqnTest(_T("a)"), 0, false);        // unexpected closing bracket
+      iStat += EqnTest(_T("pi)"), 0, false);       // unexpected closing bracket
+      iStat += EqnTest(_T("sin(())"), 0, false);   // unexpected closing bracket
+      iStat += EqnTest(_T("sin()"), 0, false);     // unexpected closing bracket
+
+      if (iStat==0)
+        mu::console() << _T("passed") << endl;
+      else
+        mu::console() << _T("\n  failed with ") << iStat << _T(" errors") << endl;
+
+      return iStat;
+    }
+
+    //---------------------------------------------------------------------------
+    int ParserTester::TestVarConst()
+    {
+      int iStat = 0;
+      mu::console() << _T("testing variable/constant detection...");
+
+      // Test if the result changes when a variable changes
+      iStat += EqnTestWithVarChange( _T("a"), 1, 1, 2, 2 );
+      iStat += EqnTestWithVarChange( _T("2*a"), 2, 4, 3, 6 );
+
+      // distinguish constants with same basename
+      iStat += EqnTest( _T("const"), 1, true);
+      iStat += EqnTest( _T("const1"), 2, true);
+      iStat += EqnTest( _T("const2"), 3, true);
+      iStat += EqnTest( _T("2*const"), 2, true);
+      iStat += EqnTest( _T("2*const1"), 4, true);
+      iStat += EqnTest( _T("2*const2"), 6, true);
+      iStat += EqnTest( _T("2*const+1"), 3, true);
+      iStat += EqnTest( _T("2*const1+1"), 5, true);
+      iStat += EqnTest( _T("2*const2+1"), 7, true);
+      iStat += EqnTest( _T("const"), 0, false);
+      iStat += EqnTest( _T("const1"), 0, false);
+      iStat += EqnTest( _T("const2"), 0, false);
+
+      // distinguish variables with same basename
+      iStat += EqnTest( _T("a"), 1, true);
+      iStat += EqnTest( _T("aa"), 2, true);
+      iStat += EqnTest( _T("2*a"), 2, true);
+      iStat += EqnTest( _T("2*aa"), 4, true);
+      iStat += EqnTest( _T("2*a-1"), 1, true);
+      iStat += EqnTest( _T("2*aa-1"), 3, true);
+
+      // custom value recognition
+      iStat += EqnTest( _T("0xff"), 255, true);
+      iStat += EqnTest( _T("0x97 + 0xff"), 406, true);
+
+      // Finally test querying of used variables
+      try
+      {
+        int idx;
+        mu::Parser p;
+        mu::value_type vVarVal[] = { 1, 2, 3, 4, 5};
+        p.DefineVar( _T("a"), &vVarVal[0]);
+        p.DefineVar( _T("b"), &vVarVal[1]);
+        p.DefineVar( _T("c"), &vVarVal[2]);
+        p.DefineVar( _T("d"), &vVarVal[3]);
+        p.DefineVar( _T("e"), &vVarVal[4]);
+
+        // Test lookup of defined variables
+        // 4 used variables
+        p.SetExpr( _T("a+b+c+d") );
+        mu::varmap_type UsedVar = p.GetUsedVar();
+        int iCount = (int)UsedVar.size();
+        if (iCount!=4)
+          throw false;
+
+        // the next check will fail if the parser
+        // erroneously creates new variables internally
+        if (p.GetVar().size()!=5)
+          throw false;
+
+        mu::varmap_type::const_iterator item = UsedVar.begin();
+        for (idx=0; item!=UsedVar.end(); ++item)
+        {
+          if (&vVarVal[idx++]!=item->second)
+            throw false;
+        }
+
+        // Test lookup of undefined variables
+        p.SetExpr( _T("undef1+undef2+undef3") );
+        UsedVar = p.GetUsedVar();
+        iCount = (int)UsedVar.size();
+        if (iCount!=3)
+          throw false;
+
+        // the next check will fail if the parser
+        // erroneously creates new variables internally
+        if (p.GetVar().size()!=5)
+          throw false;
+
+        for (item = UsedVar.begin(); item!=UsedVar.end(); ++item)
+        {
+          if (item->second!=0)
+            throw false; // all pointers to undefined variables must be null
+        }
+
+        // 1 used variables
+        p.SetExpr( _T("a+b") );
+        UsedVar = p.GetUsedVar();
+        iCount = (int)UsedVar.size();
+        if (iCount!=2) throw false;
+        item = UsedVar.begin();
+        for (idx=0; item!=UsedVar.end(); ++item)
+          if (&vVarVal[idx++]!=item->second) throw false;
+
+      }
+      catch(...)
+      {
+        iStat += 1;
+      }
+
+      if (iStat==0)
+        mu::console() << _T("passed") << endl;
+      else
+        mu::console() << _T("\n  failed with ") << iStat << _T(" errors") << endl;
+
+      return iStat;
+    }
+
+    //---------------------------------------------------------------------------
+    int ParserTester::TestMultiArg()
+    {
+      int iStat = 0;
+      mu::console() << _T("testing multiarg functions...");
+
+      // Compound expressions
+      iStat += EqnTest( _T("1,2,3"), 3, true);
+      iStat += EqnTest( _T("a,b,c"), 3, true);
+      iStat += EqnTest( _T("a=10,b=20,c=a*b"), 200, true);
+      iStat += EqnTest( _T("1,\n2,\n3"), 3, true);
+      iStat += EqnTest( _T("a,\nb,\nc"), 3, true);
+      iStat += EqnTest( _T("a=10,\nb=20,\nc=a*b"), 200, true);
+      iStat += EqnTest( _T("1,\r\n2,\r\n3"), 3, true);
+      iStat += EqnTest( _T("a,\r\nb,\r\nc"), 3, true);
+      iStat += EqnTest( _T("a=10,\r\nb=20,\r\nc=a*b"), 200, true);
+
+      // picking the right argument
+      iStat += EqnTest( _T("f1of1(1)"), 1, true);
+      iStat += EqnTest( _T("f1of2(1, 2)"), 1, true);
+      iStat += EqnTest( _T("f2of2(1, 2)"), 2, true);
+      iStat += EqnTest( _T("f1of3(1, 2, 3)"), 1, true);
+      iStat += EqnTest( _T("f2of3(1, 2, 3)"), 2, true);
+      iStat += EqnTest( _T("f3of3(1, 2, 3)"), 3, true);
+      iStat += EqnTest( _T("f1of4(1, 2, 3, 4)"), 1, true);
+      iStat += EqnTest( _T("f2of4(1, 2, 3, 4)"), 2, true);
+      iStat += EqnTest( _T("f3of4(1, 2, 3, 4)"), 3, true);
+      iStat += EqnTest( _T("f4of4(1, 2, 3, 4)"), 4, true);
+      iStat += EqnTest( _T("f1of5(1, 2, 3, 4, 5)"), 1, true);
+      iStat += EqnTest( _T("f2of5(1, 2, 3, 4, 5)"), 2, true);
+      iStat += EqnTest( _T("f3of5(1, 2, 3, 4, 5)"), 3, true);
+      iStat += EqnTest( _T("f4of5(1, 2, 3, 4, 5)"), 4, true);
+      iStat += EqnTest( _T("f5of5(1, 2, 3, 4, 5)"), 5, true);
+      // Too few arguments / Too many arguments
+      iStat += EqnTest( _T("1+ping()"), 11, true);
+      iStat += EqnTest( _T("ping()+1"), 11, true);
+      iStat += EqnTest( _T("2*ping()"), 20, true);
+      iStat += EqnTest( _T("ping()*2"), 20, true);
+      iStat += EqnTest( _T("ping(1,2)"), 0, false);
+      iStat += EqnTest( _T("1+ping(1,2)"), 0, false);
+      iStat += EqnTest( _T("f1of1(1,2)"), 0, false);
+      iStat += EqnTest( _T("f1of1()"), 0, false);
+      iStat += EqnTest( _T("f1of2(1, 2, 3)"), 0, false);
+      iStat += EqnTest( _T("f1of2(1)"), 0, false);
+      iStat += EqnTest( _T("f1of3(1, 2, 3, 4)"), 0, false);
+      iStat += EqnTest( _T("f1of3(1)"), 0, false);
+      iStat += EqnTest( _T("f1of4(1, 2, 3, 4, 5)"), 0, false);
+      iStat += EqnTest( _T("f1of4(1)"), 0, false);
+      iStat += EqnTest( _T("(1,2,3)"), 0, false);
+      iStat += EqnTest( _T("1,2,3"), 0, false);
+      iStat += EqnTest( _T("(1*a,2,3)"), 0, false);
+      iStat += EqnTest( _T("1,2*a,3"), 0, false);
+
+      // correct calculation of arguments
+      iStat += EqnTest( _T("min(a, 1)"),  1, true);
+      iStat += EqnTest( _T("min(3*2, 1)"),  1, true);
+      iStat += EqnTest( _T("min(3*2, 1)"),  6, false);
+      iStat += EqnTest( _T("firstArg(2,3,4)"), 2, true);
+      iStat += EqnTest( _T("lastArg(2,3,4)"), 4, true);
+      iStat += EqnTest( _T("min(3*a+1, 1)"),  1, true);
+      iStat += EqnTest( _T("max(3*a+1, 1)"),  4, true);
+      iStat += EqnTest( _T("max(3*a+1, 1)*2"),  8, true);
+      iStat += EqnTest( _T("2*max(3*a+1, 1)+2"),  10, true);
+
+      // functions with Variable argument count
+      iStat += EqnTest( _T("sum(a)"), 1, true);
+      iStat += EqnTest( _T("sum(1,2,3)"),  6, true);
+      iStat += EqnTest( _T("sum(a,b,c)"),  6, true);
+      iStat += EqnTest( _T("sum(1,-max(1,2),3)*2"),  4, true);
+      iStat += EqnTest( _T("2*sum(1,2,3)"),  12, true);
+      iStat += EqnTest( _T("2*sum(1,2,3)+2"),  14, true);
+      iStat += EqnTest( _T("2*sum(-1,2,3)+2"),  10, true);
+      iStat += EqnTest( _T("2*sum(-1,2,-(-a))+2"),  6, true);
+      iStat += EqnTest( _T("2*sum(-1,10,-a)+2"),  18, true);
+      iStat += EqnTest( _T("2*sum(1,2,3)*2"),  24, true);
+      iStat += EqnTest( _T("sum(1,-max(1,2),3)*2"),  4, true);
+      iStat += EqnTest( _T("sum(1*3, 4, a+2)"),  10, true);
+      iStat += EqnTest( _T("sum(1*3, 2*sum(1,2,2), a+2)"),  16, true);
+      iStat += EqnTest( _T("sum(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2)"), 24, true);
+
+      // some failures
+      iStat += EqnTest( _T("sum()"),  0, false);
+      iStat += EqnTest( _T("sum(,)"),  0, false);
+      iStat += EqnTest( _T("sum(1,2,)"),  0, false);
+      iStat += EqnTest( _T("sum(,1,2)"),  0, false);
+
+      if (iStat==0)
+        mu::console() << _T("passed") << endl;
+      else
+        mu::console() << _T("\n  failed with ") << iStat << _T(" errors") << endl;
+
+      return iStat;
+    }
+
+
+    //---------------------------------------------------------------------------
+    int ParserTester::TestInfixOprt()
+    {
+      int iStat(0);
+      mu::console() << "testing infix operators...";
+
+      iStat += EqnTest( _T("+1"),    +1, true);
+      iStat += EqnTest( _T("-(+1)"), -1, true);
+      iStat += EqnTest( _T("-(+1)*2"),  -2, true);
+      iStat += EqnTest( _T("-(+2)*sqrt(4)"),  -4, true);
+      iStat += EqnTest( _T("3-+a"), 2, true);
+      iStat += EqnTest( _T("+1*3"),  3, true);
+
+      iStat += EqnTest( _T("-1"),    -1, true);
+      iStat += EqnTest( _T("-(-1)"),  1, true);
+      iStat += EqnTest( _T("-(-1)*2"),  2, true);
+      iStat += EqnTest( _T("-(-2)*sqrt(4)"),  4, true);
+      iStat += EqnTest( _T("-_pi"), -PARSER_CONST_PI, true);
+      iStat += EqnTest( _T("-a"),  -1, true);
+      iStat += EqnTest( _T("-(a)"),  -1, true);
+      iStat += EqnTest( _T("-(-a)"),  1, true);
+      iStat += EqnTest( _T("-(-a)*2"),  2, true);
+      iStat += EqnTest( _T("-(8)"), -8, true);
+      iStat += EqnTest( _T("-8"), -8, true);
+      iStat += EqnTest( _T("-(2+1)"), -3, true);
+      iStat += EqnTest( _T("-(f1of1(1+2*3)+1*2)"), -9, true);
+      iStat += EqnTest( _T("-(-f1of1(1+2*3)+1*2)"), 5, true);
+      iStat += EqnTest( _T("-sin(8)"), -0.989358, true);
+      iStat += EqnTest( _T("3-(-a)"), 4, true);
+      iStat += EqnTest( _T("3--a"), 4, true);
+      iStat += EqnTest( _T("-1*3"),  -3, true);
+
+      // Postfix / infix priorities
+      iStat += EqnTest( _T("~2#"), 8, true);
+      iStat += EqnTest( _T("~f1of1(2)#"), 8, true);
+      iStat += EqnTest( _T("~(b)#"), 8, true);
+      iStat += EqnTest( _T("(~b)#"), 12, true);
+      iStat += EqnTest( _T("~(2#)"), 8, true);
+      iStat += EqnTest( _T("~(f1of1(2)#)"), 8, true);
+      //
+      iStat += EqnTest( _T("-2^2"),-4, true);
+      iStat += EqnTest( _T("-(a+b)^2"),-9, true);
+      iStat += EqnTest( _T("(-3)^2"),9, true);
+      iStat += EqnTest( _T("-(-2^2)"),4, true);
+      iStat += EqnTest( _T("3+-3^2"),-6, true);
+      // The following assumes use of sqr as postfix operator ("§") together
+      // with a sign operator of low priority:
+      iStat += EqnTest( _T("-2'"), -4, true);
+      iStat += EqnTest( _T("-(1+1)'"),-4, true);
+      iStat += EqnTest( _T("2+-(1+1)'"),-2, true);
+      iStat += EqnTest( _T("2+-2'"), -2, true);
+      // This is the classic behaviour of the infix sign operator (here: "$") which is
+      // now deprecated:
+      iStat += EqnTest( _T("$2^2"),4, true);
+      iStat += EqnTest( _T("$(a+b)^2"),9, true);
+      iStat += EqnTest( _T("($3)^2"),9, true);
+      iStat += EqnTest( _T("$($2^2)"),-4, true);
+      iStat += EqnTest( _T("3+$3^2"),12, true);
+
+      // infix operators sharing the first few characters
+      iStat += EqnTest( _T("~ 123"),  123+2, true);
+      iStat += EqnTest( _T("~~ 123"),  123+2, true);
+
+      if (iStat==0)
+        mu::console() << _T("passed") << endl;
+      else
+        mu::console() << _T("\n  failed with ") << iStat << _T(" errors") << endl;
+
+      return iStat;
+    }
+
+
+    //---------------------------------------------------------------------------
+    int ParserTester::TestPostFix()
+    {
+      int iStat = 0;
+      mu::console() << _T("testing postfix operators...");
+
+      // application
+      iStat += EqnTest( _T("3{m}+5"), 5.003, true);
+      iStat += EqnTest( _T("1000{m}"), 1, true);
+      iStat += EqnTest( _T("1000 {m}"), 1, true);
+      iStat += EqnTest( _T("(a){m}"), 1e-3, true);
+      iStat += EqnTest( _T("a{m}"), 1e-3, true);
+      iStat += EqnTest( _T("a {m}"), 1e-3, true);
+      iStat += EqnTest( _T("-(a){m}"), -1e-3, true);
+      iStat += EqnTest( _T("-2{m}"), -2e-3, true);
+      iStat += EqnTest( _T("-2 {m}"), -2e-3, true);
+      iStat += EqnTest( _T("f1of1(1000){m}"), 1, true);
+      iStat += EqnTest( _T("-f1of1(1000){m}"), -1, true);
+      iStat += EqnTest( _T("-f1of1(-1000){m}"), 1, true);
+      iStat += EqnTest( _T("f4of4(0,0,0,1000){m}"), 1, true);
+      iStat += EqnTest( _T("2+(a*1000){m}"), 3, true);
+
+      // can postfix operators "m" und "meg" be told apart properly?
+      iStat += EqnTest( _T("2*3000meg+2"), 2*3e9+2, true);
+
+      // some incorrect results
+      iStat += EqnTest( _T("1000{m}"), 0.1, false);
+      iStat += EqnTest( _T("(a){m}"), 2, false);
+      // failure due to syntax checking
+      iStat += ThrowTest(_T("0x"), ecUNASSIGNABLE_TOKEN);  // incomplete hex definition
+      iStat += ThrowTest(_T("3+"), ecUNEXPECTED_EOF);
+      iStat += ThrowTest( _T("4 + {m}"), ecUNASSIGNABLE_TOKEN);
+      iStat += ThrowTest( _T("{m}4"), ecUNASSIGNABLE_TOKEN);
+      iStat += ThrowTest( _T("sin({m})"), ecUNASSIGNABLE_TOKEN);
+      iStat += ThrowTest( _T("{m} {m}"), ecUNASSIGNABLE_TOKEN);
+      iStat += ThrowTest( _T("{m}(8)"), ecUNASSIGNABLE_TOKEN);
+      iStat += ThrowTest( _T("4,{m}"), ecUNASSIGNABLE_TOKEN);
+      iStat += ThrowTest( _T("-{m}"), ecUNASSIGNABLE_TOKEN);
+      iStat += ThrowTest( _T("2(-{m})"), ecUNEXPECTED_PARENS);
+      iStat += ThrowTest( _T("2({m})"), ecUNEXPECTED_PARENS);
+
+      iStat += ThrowTest( _T("multi*1.0"), ecUNASSIGNABLE_TOKEN);
+
+      if (iStat==0)
+        mu::console() << _T("passed") << endl;
+      else
+        mu::console() << _T("\n  failed with ") << iStat << _T(" errors") << endl;
+
+      return iStat;
+    }
+
+    //---------------------------------------------------------------------------
+    int ParserTester::TestExpression()
+    {
+      int iStat = 0;
+      mu::console() << _T("testing expression samples...");
+
+      value_type b = 2;
+
+      // Optimization
+      iStat += EqnTest( _T("2*b*5"), 20, true);
+      iStat += EqnTest( _T("2*b*5 + 4*b"), 28, true);
+      iStat += EqnTest( _T("2*a/3"), 2.0/3.0, true);
+
+      // Addition auf cmVARMUL
+      iStat += EqnTest( _T("3+b"), b+3, true);
+      iStat += EqnTest( _T("b+3"), b+3, true);
+      iStat += EqnTest( _T("b*3+2"), b*3+2, true);
+      iStat += EqnTest( _T("3*b+2"), b*3+2, true);
+      iStat += EqnTest( _T("2+b*3"), b*3+2, true);
+      iStat += EqnTest( _T("2+3*b"), b*3+2, true);
+      iStat += EqnTest( _T("b+3*b"), b+3*b, true);
+      iStat += EqnTest( _T("3*b+b"), b+3*b, true);
+
+      iStat += EqnTest( _T("2+b*3+b"), 2+b*3+b, true);
+      iStat += EqnTest( _T("b+2+b*3"), b+2+b*3, true);
+
+      iStat += EqnTest( _T("(2*b+1)*4"), (2*b+1)*4, true);
+      iStat += EqnTest( _T("4*(2*b+1)"), (2*b+1)*4, true);
+
+      // operator precedences
+      iStat += EqnTest( _T("1+2-3*4/5^6"), 2.99923, true);
+      iStat += EqnTest( _T("1^2/3*4-5+6"), 2.33333333, true);
+      iStat += EqnTest( _T("1+2*3"), 7, true);
+      iStat += EqnTest( _T("1+2*3"), 7, true);
+      iStat += EqnTest( _T("(1+2)*3"), 9, true);
+      iStat += EqnTest( _T("(1+2)*(-3)"), -9, true);
+      iStat += EqnTest( _T("2/4"), 0.5, true);
+
+      iStat += EqnTest( _T("exp(ln(7))"), 7, true);
+      iStat += EqnTest( _T("e^ln(7)"), 7, true);
+      iStat += EqnTest( _T("e^(ln(7))"), 7, true);
+      iStat += EqnTest( _T("(e^(ln(7)))"), 7, true);
+      iStat += EqnTest( _T("1-(e^(ln(7)))"), -6, true);
+      iStat += EqnTest( _T("2*(e^(ln(7)))"), 14, true);
+      iStat += EqnTest( _T("10^log(5)"), pow(10.0, log(5.0)), true);
+      iStat += EqnTest( _T("10^log10(5)"), 5, true);
+      iStat += EqnTest( _T("2^log2(4)"), 4, true);
+      iStat += EqnTest( _T("-(sin(0)+1)"), -1, true);
+      iStat += EqnTest( _T("-(2^1.1)"), -2.14354692, true);
+
+      iStat += EqnTest( _T("(cos(2.41)/b)"), -0.372056, true);
+      iStat += EqnTest( _T("(1*(2*(3*(4*(5*(6*(a+b)))))))"), 2160, true);
+      iStat += EqnTest( _T("(1*(2*(3*(4*(5*(6*(7*(a+b))))))))"), 15120, true);
+      iStat += EqnTest( _T("(a/((((b+(((e*(((((pi*((((3.45*((pi+a)+pi))+b)+b)*a))+0.68)+e)+a)/a))+a)+b))+b)*a)-pi))"), 0.00377999, true);
+
+      // long formula (Reference: Matlab)
+      iStat += EqnTest(
+        _T("(((-9))-e/(((((((pi-(((-7)+(-3)/4/e))))/(((-5))-2)-((pi+(-0))*(sqrt((e+e))*(-8))*(((-pi)+(-pi)-(-9)*(6*5))")
+        _T("/(-e)-e))/2)/((((sqrt(2/(-e)+6)-(4-2))+((5/(-2))/(1*(-pi)+3))/8)*pi*((pi/((-2)/(-6)*1*(-1))*(-6)+(-e)))))/")
+        _T("((e+(-2)+(-e)*((((-3)*9+(-e)))+(-9)))))))-((((e-7+(((5/pi-(3/1+pi)))))/e)/(-5))/(sqrt((((((1+(-7))))+((((-")
+        _T("e)*(-e)))-8))*(-5)/((-e)))*(-6)-((((((-2)-(-9)-(-e)-1)/3))))/(sqrt((8+(e-((-6))+(9*(-9))))*(((3+2-8))*(7+6")
+        _T("+(-5))+((0/(-e)*(-pi))+7)))+(((((-e)/e/e)+((-6)*5)*e+(3+(-5)/pi))))+pi))/sqrt((((9))+((((pi))-8+2))+pi))/e")
+        _T("*4)*((-5)/(((-pi))*(sqrt(e)))))-(((((((-e)*(e)-pi))/4+(pi)*(-9)))))))+(-pi)"), -12.23016549, true);
+
+      // long formula (Reference: Matlab)
+      iStat += EqnTest(
+          _T("(atan(sin((((((((((((((((pi/cos((a/((((0.53-b)-pi)*e)/b))))+2.51)+a)-0.54)/0.98)+b)*b)+e)/a)+b)+a)+b)+pi)/e")
+          _T(")+a)))*2.77)"), -2.16995656, true);
+
+      // long formula (Reference: Matlab)
+      iStat += EqnTest( _T("1+2-3*4/5^6*(2*(1-5+(3*7^9)*(4+6*7-3)))+12"), -7995810.09926, true);
+
+      if (iStat==0)
+        mu::console() << _T("passed") << endl;
+      else
+        mu::console() << _T("\n  failed with ") << iStat << _T(" errors") << endl;
+
+      return iStat;
+    }
+
+
+
+    //---------------------------------------------------------------------------
+    int ParserTester::TestIfThenElse()
+    {
+      int iStat = 0;
+      mu::console() << _T("testing if-then-else operator...");
+
+      // Test error detection
+      iStat += ThrowTest(_T(":3"), ecUNEXPECTED_CONDITIONAL);
+      iStat += ThrowTest(_T("? 1 : 2"), ecUNEXPECTED_CONDITIONAL);
+      iStat += ThrowTest(_T("(a<b) ? (b<c) ? 1 : 2"), ecMISSING_ELSE_CLAUSE);
+      iStat += ThrowTest(_T("(a<b) ? 1"), ecMISSING_ELSE_CLAUSE);
+      iStat += ThrowTest(_T("(a<b) ? a"), ecMISSING_ELSE_CLAUSE);
+      iStat += ThrowTest(_T("(a<b) ? a+b"), ecMISSING_ELSE_CLAUSE);
+      iStat += ThrowTest(_T("a : b"), ecMISPLACED_COLON);
+      iStat += ThrowTest(_T("1 : 2"), ecMISPLACED_COLON);
+      iStat += ThrowTest(_T("(1) ? 1 : 2 : 3"), ecMISPLACED_COLON);
+      iStat += ThrowTest(_T("(true) ? 1 : 2 : 3"), ecUNASSIGNABLE_TOKEN);
+
+      iStat += EqnTest(_T("1 ? 128 : 255"), 128, true);
+      iStat += EqnTest(_T("1<2 ? 128 : 255"), 128, true);
+      iStat += EqnTest(_T("a<b ? 128 : 255"), 128, true);
+      iStat += EqnTest(_T("(a<b) ? 128 : 255"), 128, true);
+      iStat += EqnTest(_T("(1) ? 10 : 11"), 10, true);
+      iStat += EqnTest(_T("(0) ? 10 : 11"), 11, true);
+      iStat += EqnTest(_T("(1) ? a+b : c+d"), 3, true);
+      iStat += EqnTest(_T("(0) ? a+b : c+d"), 1, true);
+      iStat += EqnTest(_T("(1) ? 0 : 1"), 0, true);
+      iStat += EqnTest(_T("(0) ? 0 : 1"), 1, true);
+      iStat += EqnTest(_T("(a<b) ? 10 : 11"), 10, true);
+      iStat += EqnTest(_T("(a>b) ? 10 : 11"), 11, true);
+      iStat += EqnTest(_T("(a<b) ? c : d"), 3, true);
+      iStat += EqnTest(_T("(a>b) ? c : d"), -2, true);
+
+      iStat += EqnTest(_T("(a>b) ? 1 : 0"), 0, true);
+      iStat += EqnTest(_T("((a>b) ? 1 : 0) ? 1 : 2"), 2, true);
+      iStat += EqnTest(_T("((a>b) ? 1 : 0) ? 1 : sum((a>b) ? 1 : 2)"), 2, true);
+      iStat += EqnTest(_T("((a>b) ? 0 : 1) ? 1 : sum((a>b) ? 1 : 2)"), 1, true);
+
+      iStat += EqnTest(_T("sum((a>b) ? 1 : 2)"), 2, true);
+      iStat += EqnTest(_T("sum((1) ? 1 : 2)"), 1, true);
+      iStat += EqnTest(_T("sum((a>b) ? 1 : 2, 100)"), 102, true);
+      iStat += EqnTest(_T("sum((1) ? 1 : 2, 100)"), 101, true);
+      iStat += EqnTest(_T("sum(3, (a>b) ? 3 : 10)"), 13, true);
+      iStat += EqnTest(_T("sum(3, (a<b) ? 3 : 10)"), 6, true);
+      iStat += EqnTest(_T("10*sum(3, (a>b) ? 3 : 10)"), 130, true);
+      iStat += EqnTest(_T("10*sum(3, (a<b) ? 3 : 10)"), 60, true);
+      iStat += EqnTest(_T("sum(3, (a>b) ? 3 : 10)*10"), 130, true);
+      iStat += EqnTest(_T("sum(3, (a<b) ? 3 : 10)*10"), 60, true);
+      iStat += EqnTest(_T("(a<b) ? sum(3, (a<b) ? 3 : 10)*10 : 99"), 60, true);
+      iStat += EqnTest(_T("(a>b) ? sum(3, (a<b) ? 3 : 10)*10 : 99"), 99, true);
+      iStat += EqnTest(_T("(a<b) ? sum(3, (a<b) ? 3 : 10,10,20)*10 : 99"), 360, true);
+      iStat += EqnTest(_T("(a>b) ? sum(3, (a<b) ? 3 : 10,10,20)*10 : 99"), 99, true);
+      iStat += EqnTest(_T("(a>b) ? sum(3, (a<b) ? 3 : 10,10,20)*10 : sum(3, (a<b) ? 3 : 10)*10"), 60, true);
+
+      // todo: auch für muParserX hinzufügen!
+      iStat += EqnTest(_T("(a<b)&&(a<b) ? 128 : 255"), 128, true);
+      iStat += EqnTest(_T("(a>b)&&(a<b) ? 128 : 255"), 255, true);
+      iStat += EqnTest(_T("(1<2)&&(1<2) ? 128 : 255"), 128, true);
+      iStat += EqnTest(_T("(1>2)&&(1<2) ? 128 : 255"), 255, true);
+      iStat += EqnTest(_T("((1<2)&&(1<2)) ? 128 : 255"), 128, true);
+      iStat += EqnTest(_T("((1>2)&&(1<2)) ? 128 : 255"), 255, true);
+      iStat += EqnTest(_T("((a<b)&&(a<b)) ? 128 : 255"), 128, true);
+      iStat += EqnTest(_T("((a>b)&&(a<b)) ? 128 : 255"), 255, true);
+
+      iStat += EqnTest(_T("1>0 ? 1>2 ? 128 : 255 : 1>0 ? 32 : 64"), 255, true);
+      iStat += EqnTest(_T("1>0 ? 1>2 ? 128 : 255 :(1>0 ? 32 : 64)"), 255, true);
+      iStat += EqnTest(_T("1>0 ? 1>0 ? 128 : 255 : 1>2 ? 32 : 64"), 128, true);
+      iStat += EqnTest(_T("1>0 ? 1>0 ? 128 : 255 :(1>2 ? 32 : 64)"), 128, true);
+      iStat += EqnTest(_T("1>2 ? 1>2 ? 128 : 255 : 1>0 ? 32 : 64"), 32, true);
+      iStat += EqnTest(_T("1>2 ? 1>0 ? 128 : 255 : 1>2 ? 32 : 64"), 64, true);
+      iStat += EqnTest(_T("1>0 ? 50 :  1>0 ? 128 : 255"), 50, true);
+      iStat += EqnTest(_T("1>0 ? 50 : (1>0 ? 128 : 255)"), 50, true);
+      iStat += EqnTest(_T("1>0 ? 1>0 ? 128 : 255 : 50"), 128, true);
+      iStat += EqnTest(_T("1>2 ? 1>2 ? 128 : 255 : 1>0 ? 32 : 1>2 ? 64 : 16"), 32, true);
+      iStat += EqnTest(_T("1>2 ? 1>2 ? 128 : 255 : 1>0 ? 32 :(1>2 ? 64 : 16)"), 32, true);
+      iStat += EqnTest(_T("1>0 ? 1>2 ? 128 : 255 :  1>0 ? 32 :1>2 ? 64 : 16"), 255, true);
+      iStat += EqnTest(_T("1>0 ? 1>2 ? 128 : 255 : (1>0 ? 32 :1>2 ? 64 : 16)"), 255, true);
+      iStat += EqnTest(_T("1 ? 0 ? 128 : 255 : 1 ? 32 : 64"), 255, true);
+
+      // assignment operators
+      iStat += EqnTest(_T("a= 0 ? 128 : 255, a"), 255, true);
+      iStat += EqnTest(_T("a=((a>b)&&(a<b)) ? 128 : 255, a"), 255, true);
+      iStat += EqnTest(_T("c=(a<b)&&(a<b) ? 128 : 255, c"), 128, true);
+      iStat += EqnTest(_T("0 ? a=a+1 : 666, a"), 1, true);
+      iStat += EqnTest(_T("1?a=10:a=20, a"), 10, true);
+      iStat += EqnTest(_T("0?a=10:a=20, a"), 20, true);
+      iStat += EqnTest(_T("0?a=sum(3,4):10, a"), 1, true);  // a should not change its value due to lazy calculation
+
+      iStat += EqnTest(_T("a=1?b=1?3:4:5, a"), 3, true);
+      iStat += EqnTest(_T("a=1?b=1?3:4:5, b"), 3, true);
+      iStat += EqnTest(_T("a=0?b=1?3:4:5, a"), 5, true);
+      iStat += EqnTest(_T("a=0?b=1?3:4:5, b"), 2, true);
+
+      iStat += EqnTest(_T("a=1?5:b=1?3:4, a"), 5, true);
+      iStat += EqnTest(_T("a=1?5:b=1?3:4, b"), 2, true);
+      iStat += EqnTest(_T("a=0?5:b=1?3:4, a"), 3, true);
+      iStat += EqnTest(_T("a=0?5:b=1?3:4, b"), 3, true);
+
+      if (iStat==0)
+        mu::console() << _T("passed") << endl;
+      else
+        mu::console() << _T("\n  failed with ") << iStat << _T(" errors") << endl;
+
+      return iStat;
+    }
+
+    //---------------------------------------------------------------------------
+    int ParserTester::TestException()
+    {
+      int  iStat = 0;
+      mu::console() << _T("testing error codes...");
+
+      iStat += ThrowTest(_T("3+"),           ecUNEXPECTED_EOF);
+      iStat += ThrowTest(_T("3+)"),          ecUNEXPECTED_PARENS);
+      iStat += ThrowTest(_T("()"),           ecUNEXPECTED_PARENS);
+      iStat += ThrowTest(_T("3+()"),         ecUNEXPECTED_PARENS);
+      iStat += ThrowTest(_T("sin(3,4)"),     ecTOO_MANY_PARAMS);
+      iStat += ThrowTest(_T("sin()"),        ecTOO_FEW_PARAMS);
+      iStat += ThrowTest(_T("(1+2"),         ecMISSING_PARENS);
+      iStat += ThrowTest(_T("sin(3)3"),      ecUNEXPECTED_VAL);
+      iStat += ThrowTest(_T("sin(3)xyz"),    ecUNASSIGNABLE_TOKEN);
+      iStat += ThrowTest(_T("sin(3)cos(3)"), ecUNEXPECTED_FUN);
+      iStat += ThrowTest(_T("a+b+c=10"),     ecUNEXPECTED_OPERATOR);
+      iStat += ThrowTest(_T("a=b=3"),        ecUNEXPECTED_OPERATOR);
+
+#if defined(MUP_MATH_EXCEPTIONS)
+      // divide by zero whilst constant folding
+      iStat += ThrowTest(_T("1/0"),          ecDIV_BY_ZERO);
+      // square root of a negative number
+      iStat += ThrowTest(_T("sqrt(-1)"),     ecDOMAIN_ERROR);
+      // logarithms of zero
+      iStat += ThrowTest(_T("ln(0)"),        ecDOMAIN_ERROR);
+      iStat += ThrowTest(_T("log2(0)"),      ecDOMAIN_ERROR);
+      iStat += ThrowTest(_T("log10(0)"),     ecDOMAIN_ERROR);
+      iStat += ThrowTest(_T("log(0)"),       ecDOMAIN_ERROR);
+      // logarithms of negative values
+      iStat += ThrowTest(_T("ln(-1)"),       ecDOMAIN_ERROR);
+      iStat += ThrowTest(_T("log2(-1)"),     ecDOMAIN_ERROR);
+      iStat += ThrowTest(_T("log10(-1)"),    ecDOMAIN_ERROR);
+      iStat += ThrowTest(_T("log(-1)"),      ecDOMAIN_ERROR);
+#endif
+
+      // functions without parameter
+      iStat += ThrowTest( _T("3+ping(2)"),    ecTOO_MANY_PARAMS);
+      iStat += ThrowTest( _T("3+ping(a+2)"),  ecTOO_MANY_PARAMS);
+      iStat += ThrowTest( _T("3+ping(sin(a)+2)"),  ecTOO_MANY_PARAMS);
+      iStat += ThrowTest( _T("3+ping(1+sin(a))"),  ecTOO_MANY_PARAMS);
+
+      // String function related
+      iStat += ThrowTest( _T("valueof(\"xxx\")"),  999, false);
+      iStat += ThrowTest( _T("valueof()"),          ecUNEXPECTED_PARENS);
+      iStat += ThrowTest( _T("1+valueof(\"abc\""),  ecMISSING_PARENS);
+      iStat += ThrowTest( _T("valueof(\"abc\""),    ecMISSING_PARENS);
+      iStat += ThrowTest( _T("valueof(\"abc"),      ecUNTERMINATED_STRING);
+      iStat += ThrowTest( _T("valueof(\"abc\",3)"), ecTOO_MANY_PARAMS);
+      iStat += ThrowTest( _T("valueof(3)"),         ecSTRING_EXPECTED);
+      iStat += ThrowTest( _T("sin(\"abc\")"),       ecVAL_EXPECTED);
+      iStat += ThrowTest( _T("valueof(\"\\\"abc\\\"\")"),  999, false);
+      iStat += ThrowTest( _T("\"hello world\""),    ecSTR_RESULT);
+      iStat += ThrowTest( _T("(\"hello world\")"),  ecSTR_RESULT);
+      iStat += ThrowTest( _T("\"abcd\"+100"),       ecOPRT_TYPE_CONFLICT);
+      iStat += ThrowTest( _T("\"a\"+\"b\""),        ecOPRT_TYPE_CONFLICT);
+      iStat += ThrowTest( _T("strfun1(\"100\",3)"),     ecTOO_MANY_PARAMS);
+      iStat += ThrowTest( _T("strfun2(\"100\",3,5)"),   ecTOO_MANY_PARAMS);
+      iStat += ThrowTest( _T("strfun3(\"100\",3,5,6)"), ecTOO_MANY_PARAMS);
+      iStat += ThrowTest( _T("strfun2(\"100\")"),       ecTOO_FEW_PARAMS);
+      iStat += ThrowTest( _T("strfun3(\"100\",6)"),   ecTOO_FEW_PARAMS);
+      iStat += ThrowTest( _T("strfun2(1,1)"),         ecSTRING_EXPECTED);
+      iStat += ThrowTest( _T("strfun2(a,1)"),         ecSTRING_EXPECTED);
+      iStat += ThrowTest( _T("strfun2(1,1,1)"),       ecTOO_MANY_PARAMS);
+      iStat += ThrowTest( _T("strfun2(a,1,1)"),       ecTOO_MANY_PARAMS);
+      iStat += ThrowTest( _T("strfun3(1,2,3)"),         ecSTRING_EXPECTED);
+      iStat += ThrowTest( _T("strfun3(1, \"100\",3)"),  ecSTRING_EXPECTED);
+      iStat += ThrowTest( _T("strfun3(\"1\", \"100\",3)"),  ecVAL_EXPECTED);
+      iStat += ThrowTest( _T("strfun3(\"1\", 3, \"100\")"),  ecVAL_EXPECTED);
+      iStat += ThrowTest( _T("strfun3(\"1\", \"100\", \"100\", \"100\")"),  ecTOO_MANY_PARAMS);
+
+      // assignment operator
+      iStat += ThrowTest( _T("3=4"), ecUNEXPECTED_OPERATOR);
+      iStat += ThrowTest( _T("sin(8)=4"), ecUNEXPECTED_OPERATOR);
+      iStat += ThrowTest( _T("\"test\"=a"), ecUNEXPECTED_OPERATOR);
+
+      // <ibg 20090529>
+      // this is now legal, for reference see:
+      // https://sourceforge.net/forum/message.php?msg_id=7411373
+      //      iStat += ThrowTest( _T("sin=9"), ecUNEXPECTED_OPERATOR);
+      // </ibg>
+
+      iStat += ThrowTest( _T("(8)=5"), ecUNEXPECTED_OPERATOR);
+      iStat += ThrowTest( _T("(a)=5"), ecUNEXPECTED_OPERATOR);
+      iStat += ThrowTest( _T("a=\"tttt\""), ecOPRT_TYPE_CONFLICT);
+
+      if (iStat==0)
+        mu::console() << _T("passed") << endl;
+      else
+        mu::console() << _T("\n  failed with ") << iStat << _T(" errors") << endl;
+
+      return iStat;
+    }
+
+
+    //---------------------------------------------------------------------------
+    void ParserTester::AddTest(testfun_type a_pFun)
+    {
+      m_vTestFun.push_back(a_pFun);
+    }
+
+    //---------------------------------------------------------------------------
+    void ParserTester::Run()
+    {
+      int iStat = 0;
+      try
+      {
+        for (int i=0; i<(int)m_vTestFun.size(); ++i)
+          iStat += (this->*m_vTestFun[i])();
+      }
+      catch(Parser::exception_type &e)
+      {
+        mu::console() << "\n" << e.GetMsg() << endl;
+        mu::console() << e.GetToken() << endl;
+        Abort();
+      }
+      catch(std::exception &e)
+      {
+        mu::console() << e.what() << endl;
+        Abort();
+      }
+      catch(...)
+      {
+        mu::console() << "Internal error";
+        Abort();
+      }
+
+      if (iStat==0)
+      {
+        mu::console() << "Test passed (" <<  ParserTester::c_iCount << " expressions)" << endl;
+      }
+      else
+      {
+        mu::console() << "Test failed with " << iStat
+                  << " errors (" <<  ParserTester::c_iCount
+                  << " expressions)" << endl;
+      }
+      ParserTester::c_iCount = 0;
+    }
+
+
+    //---------------------------------------------------------------------------
+    int ParserTester::ThrowTest(const string_type &a_str, int a_iErrc, bool a_bFail)
+    {
+      ParserTester::c_iCount++;
+
+      try
+      {
+        value_type fVal[] = {1,1,1};
+        Parser p;
+
+        p.DefineVar( _T("a"), &fVal[0]);
+        p.DefineVar( _T("b"), &fVal[1]);
+        p.DefineVar( _T("c"), &fVal[2]);
+        p.DefinePostfixOprt( _T("{m}"), Milli);
+        p.DefinePostfixOprt( _T("m"), Milli);
+        p.DefineFun( _T("ping"), Ping);
+        p.DefineFun( _T("valueof"), ValueOf);
+        p.DefineFun( _T("strfun1"), StrFun1);
+        p.DefineFun( _T("strfun2"), StrFun2);
+        p.DefineFun( _T("strfun3"), StrFun3);
+        p.SetExpr(a_str);
+        p.Eval();
+      }
+      catch(ParserError &e)
+      {
+        // output the formula in case of an failed test
+        if (a_bFail==false || (a_bFail==true && a_iErrc!=e.GetCode()) )
+        {
+          mu::console() << _T("\n  ")
+                        << _T("Expression: ") << a_str
+                        << _T("  Code:") << e.GetCode() << _T("(") << e.GetMsg() << _T(")")
+                        << _T("  Expected:") << a_iErrc;
+        }
+
+        return (a_iErrc==e.GetCode()) ? 0 : 1;
+      }
+
+      // if a_bFail==false no exception is expected
+      bool bRet((a_bFail==false) ? 0 : 1);
+      if (bRet==1)
+      {
+        mu::console() << _T("\n  ")
+                      << _T("Expression: ") << a_str
+                      << _T("  did evaluate; Expected error:") << a_iErrc;
+      }
+
+      return bRet;
+    }
+
+    //---------------------------------------------------------------------------
+    /** \brief Evaluate a tet expression.
+
+        \return 1 in case of a failure, 0 otherwise.
+    */
+    int ParserTester::EqnTestWithVarChange(const string_type &a_str,
+                                           double a_fVar1,
+                                           double a_fRes1,
+                                           double a_fVar2,
+                                           double a_fRes2)
+    {
+      ParserTester::c_iCount++;
+
+      try
+      {
+        value_type fVal[2] = {-999, -999 }; // should be equal
+
+        Parser  p;
+        value_type var = 0;
+
+        // variable
+        p.DefineVar( _T("a"), &var);
+        p.SetExpr(a_str);
+
+        var = a_fVar1;
+        fVal[0] = p.Eval();
+
+        var = a_fVar2;
+        fVal[1] = p.Eval();
+
+        if ( fabs(a_fRes1-fVal[0]) > 0.0000000001)
+          throw std::runtime_error("incorrect result (first pass)");
+
+        if ( fabs(a_fRes2-fVal[1]) > 0.0000000001)
+          throw std::runtime_error("incorrect result (second pass)");
+      }
+      catch(Parser::exception_type &e)
+      {
+        mu::console() << _T("\n  fail: ") << a_str.c_str() << _T(" (") << e.GetMsg() << _T(")");
+        return 1;
+      }
+      catch(std::exception &e)
+      {
+        mu::console() << _T("\n  fail: ") << a_str.c_str() << _T(" (") << e.what() << _T(")");
+        return 1;  // always return a failure since this exception is not expected
+      }
+      catch(...)
+      {
+        mu::console() << _T("\n  fail: ") << a_str.c_str() <<  _T(" (unexpected exception)");
+        return 1;  // exceptions other than ParserException are not allowed
+      }
+
+      return 0;
+    }
+
+    //---------------------------------------------------------------------------
+    /** \brief Evaluate a tet expression.
+
+        \return 1 in case of a failure, 0 otherwise.
+    */
+    int ParserTester::EqnTest(const string_type &a_str, double a_fRes, bool a_fPass)
+    {
+      ParserTester::c_iCount++;
+      int iRet(0);
+      value_type fVal[5] = {-999, -998, -997, -996, -995}; // initially should be different
+
+      try
+      {
+        std::auto_ptr<Parser> p1;
+        Parser  p2, p3;   // three parser objects
+                          // they will be used for testing copy and assignment operators
+        // p1 is a pointer since i'm going to delete it in order to test if
+        // parsers after copy construction still refer to members of it.
+        // !! If this is the case this function will crash !!
+
+        p1.reset(new mu::Parser());
+        // Add constants
+        p1->DefineConst( _T("pi"), (value_type)PARSER_CONST_PI);
+        p1->DefineConst( _T("e"), (value_type)PARSER_CONST_E);
+        p1->DefineConst( _T("const"), 1);
+        p1->DefineConst( _T("const1"), 2);
+        p1->DefineConst( _T("const2"), 3);
+        // string constants
+        p1->DefineStrConst( _T("str1"), _T("1.11"));
+        p1->DefineStrConst( _T("str2"), _T("2.22"));
+        // variables
+        value_type vVarVal[] = { 1, 2, 3, -2};
+        p1->DefineVar( _T("a"), &vVarVal[0]);
+        p1->DefineVar( _T("aa"), &vVarVal[1]);
+        p1->DefineVar( _T("b"), &vVarVal[1]);
+        p1->DefineVar( _T("c"), &vVarVal[2]);
+        p1->DefineVar( _T("d"), &vVarVal[3]);
+
+        // custom value ident functions
+        p1->AddValIdent(&ParserTester::IsHexVal);
+
+        // functions
+        p1->DefineFun( _T("ping"), Ping);
+        p1->DefineFun( _T("f1of1"), f1of1);  // one parameter
+        p1->DefineFun( _T("f1of2"), f1of2);  // two parameter
+        p1->DefineFun( _T("f2of2"), f2of2);
+        p1->DefineFun( _T("f1of3"), f1of3);  // three parameter
+        p1->DefineFun( _T("f2of3"), f2of3);
+        p1->DefineFun( _T("f3of3"), f3of3);
+        p1->DefineFun( _T("f1of4"), f1of4);  // four parameter
+        p1->DefineFun( _T("f2of4"), f2of4);
+        p1->DefineFun( _T("f3of4"), f3of4);
+        p1->DefineFun( _T("f4of4"), f4of4);
+        p1->DefineFun( _T("f1of5"), f1of5);  // five parameter
+        p1->DefineFun( _T("f2of5"), f2of5);
+        p1->DefineFun( _T("f3of5"), f3of5);
+        p1->DefineFun( _T("f4of5"), f4of5);
+        p1->DefineFun( _T("f5of5"), f5of5);
+
+        // binary operators
+        p1->DefineOprt( _T("add"), add, 0);
+        p1->DefineOprt( _T("++"), add, 0);
+        p1->DefineOprt( _T("&"), land, prLAND);
+
+        // sample functions
+        p1->DefineFun( _T("min"), Min);
+        p1->DefineFun( _T("max"), Max);
+        p1->DefineFun( _T("sum"), Sum);
+        p1->DefineFun( _T("valueof"), ValueOf);
+        p1->DefineFun( _T("atof"), StrToFloat);
+        p1->DefineFun( _T("strfun1"), StrFun1);
+        p1->DefineFun( _T("strfun2"), StrFun2);
+        p1->DefineFun( _T("strfun3"), StrFun3);
+        p1->DefineFun( _T("lastArg"), LastArg);
+        p1->DefineFun( _T("firstArg"), FirstArg);
+        p1->DefineFun( _T("order"), FirstArg);
+
+        // infix / postfix operator
+        // Note: Identifiers used here do not have any meaning
+        //       they are mere placeholders to test certain features.
+        p1->DefineInfixOprt( _T("$"), sign, prPOW+1);  // sign with high priority
+        p1->DefineInfixOprt( _T("~"), plus2);          // high priority
+        p1->DefineInfixOprt( _T("~~"), plus2);
+        p1->DefinePostfixOprt( _T("{m}"), Milli);
+        p1->DefinePostfixOprt( _T("{M}"), Mega);
+        p1->DefinePostfixOprt( _T("m"), Milli);
+        p1->DefinePostfixOprt( _T("meg"), Mega);
+        p1->DefinePostfixOprt( _T("#"), times3);
+        p1->DefinePostfixOprt( _T("'"), sqr);
+        p1->SetExpr(a_str);
+
+        // Test bytecode integrity
+        // String parsing and bytecode parsing must yield the same result
+        fVal[0] = p1->Eval(); // result from stringparsing
+        fVal[1] = p1->Eval(); // result from bytecode
+        if (fVal[0]!=fVal[1])
+          throw Parser::exception_type( _T("Bytecode / string parsing mismatch.") );
+
+        // Test copy and assignment operators
+        try
+        {
+          // Test copy constructor
+          std::vector<mu::Parser> vParser;
+          vParser.push_back(*(p1.get()));
+          mu::Parser p2 = vParser[0];   // take parser from vector
+
+          // destroy the originals from p2
+          vParser.clear();              // delete the vector
+          p1.reset(0);
+
+          fVal[2] = p2.Eval();
+
+          // Test assignment operator
+          // additionally  disable Optimizer this time
+          mu::Parser p3;
+          p3 = p2;
+          p3.EnableOptimizer(false);
+          fVal[3] = p3.Eval();
+
+          // Test Eval function for multiple return values
+          // use p2 since it has the optimizer enabled!
+          int nNum;
+          value_type *v = p2.Eval(nNum);
+          fVal[4] = v[nNum-1];
+        }
+        catch(std::exception &e)
+        {
+          mu::console() << _T("\n  ") << e.what() << _T("\n");
+        }
+
+        // limited floating point accuracy requires the following test
+        bool bCloseEnough(true);
+        for (unsigned i=0; i<sizeof(fVal)/sizeof(value_type); ++i)
+        {
+          bCloseEnough &= (fabs(a_fRes-fVal[i]) <= fabs(fVal[i]*0.00001));
+
+          // The tests equations never result in infinity, if they do thats a bug.
+          // reference:
+          // http://sourceforge.net/projects/muparser/forums/forum/462843/topic/5037825
+          #pragma warning(push)
+          #pragma warning(disable:4127)
+		  if (std::numeric_limits<value_type>::has_infinity)
+          #pragma warning(pop)
+		  {
+            bCloseEnough &= (fabs(fVal[i]) != numeric_limits<value_type>::infinity());
+		  }
+		}
+
+        iRet = ((bCloseEnough && a_fPass) || (!bCloseEnough && !a_fPass)) ? 0 : 1;
+
+
+        if (iRet==1)
+        {
+          mu::console() << _T("\n  fail: ") << a_str.c_str()
+                        << _T(" (incorrect result; expected: ") << a_fRes
+                        << _T(" ;calculated: ") << fVal[0] << _T(",")
+                                                << fVal[1] << _T(",")
+                                                << fVal[2] << _T(",")
+                                                << fVal[3] << _T(",")
+                                                << fVal[4] << _T(").");
+        }
+      }
+      catch(Parser::exception_type &e)
+      {
+        if (a_fPass)
+        {
+          if (fVal[0]!=fVal[2] && fVal[0]!=-999 && fVal[1]!=-998)
+            mu::console() << _T("\n  fail: ") << a_str.c_str() << _T(" (copy construction)");
+          else
+            mu::console() << _T("\n  fail: ") << a_str.c_str() << _T(" (") << e.GetMsg() << _T(")");
+          return 1;
+        }
+      }
+      catch(std::exception &e)
+      {
+        mu::console() << _T("\n  fail: ") << a_str.c_str() << _T(" (") << e.what() << _T(")");
+        return 1;  // always return a failure since this exception is not expected
+      }
+      catch(...)
+      {
+        mu::console() << _T("\n  fail: ") << a_str.c_str() <<  _T(" (unexpected exception)");
+        return 1;  // exceptions other than ParserException are not allowed
+      }
+
+      return iRet;
+    }
+
+    //---------------------------------------------------------------------------
+    int ParserTester::EqnTestInt(const string_type &a_str, double a_fRes, bool a_fPass)
+    {
+      ParserTester::c_iCount++;
+
+      value_type vVarVal[] = {1, 2, 3};   // variable values
+      int iRet(0);
+
+      try
+      {
+        value_type fVal[2] = {-99, -999};   // results: initially should be different
+        ParserInt p;
+        p.DefineConst( _T("const1"), 1);
+        p.DefineConst( _T("const2"), 2);
+        p.DefineVar( _T("a"), &vVarVal[0]);
+        p.DefineVar( _T("b"), &vVarVal[1]);
+        p.DefineVar( _T("c"), &vVarVal[2]);
+
+        p.SetExpr(a_str);
+        fVal[0] = p.Eval(); // result from stringparsing
+        fVal[1] = p.Eval(); // result from bytecode
+
+        if (fVal[0]!=fVal[1])
+          throw Parser::exception_type( _T("Bytecode corrupt.") );
+
+        iRet =  ( (a_fRes==fVal[0] &&  a_fPass) ||
+                  (a_fRes!=fVal[0] && !a_fPass) ) ? 0 : 1;
+        if (iRet==1)
+        {
+          mu::console() << _T("\n  fail: ") << a_str.c_str()
+                        << _T(" (incorrect result; expected: ") << a_fRes
+                        << _T(" ;calculated: ") << fVal[0]<< _T(").");
+        }
+      }
+      catch(Parser::exception_type &e)
+      {
+        if (a_fPass)
+        {
+          mu::console() << _T("\n  fail: ") << e.GetExpr() << _T(" : ") << e.GetMsg();
+          iRet = 1;
+        }
+      }
+      catch(...)
+      {
+        mu::console() << _T("\n  fail: ") << a_str.c_str() <<  _T(" (unexpected exception)");
+        iRet = 1;  // exceptions other than ParserException are not allowed
+      }
+
+      return iRet;
+    }
+
+    //---------------------------------------------------------------------------
+    /** \brief Test an expression in Bulk Mode. */
+    int ParserTester::EqnTestBulk(const string_type &a_str, double a_fRes[4], bool a_fPass)
+    {
+        ParserTester::c_iCount++;
+
+        // Define Bulk Variables
+        int nBulkSize = 4;
+        value_type vVariableA[] = { 1, 2, 3, 4 };   // variable values
+        value_type vVariableB[] = { 2, 2, 2, 2 };   // variable values
+        value_type vVariableC[] = { 3, 3, 3, 3 };   // variable values
+        value_type vResults[] = { 0, 0, 0, 0 };   // variable values
+        int iRet(0);
+
+        try
+        {
+            Parser p;
+            p.DefineConst(_T("const1"), 1);
+            p.DefineConst(_T("const2"), 2);
+            p.DefineVar(_T("a"), vVariableA);
+            p.DefineVar(_T("b"), vVariableB);
+            p.DefineVar(_T("c"), vVariableC);
+
+            p.SetExpr(a_str);
+            p.Eval(vResults, nBulkSize);
+
+            bool bCloseEnough(true);
+            for (int i = 0; i < nBulkSize; ++i)
+            {
+                bCloseEnough &= (fabs(a_fRes[i] - vResults[i]) <= fabs(a_fRes[i] * 0.00001));
+            }
+
+            iRet = ((bCloseEnough && a_fPass) || (!bCloseEnough && !a_fPass)) ? 0 : 1;
+            if (iRet == 1)
+            {
+                mu::console() << _T("\n  fail: ") << a_str.c_str()
+                    << _T(" (incorrect result; expected: {") << a_fRes[0] << _T(",") << a_fRes[1] << _T(",") << a_fRes[2] << _T(",") << a_fRes[3] << _T("}")
+                    << _T(" ;calculated: ") << vResults[0] << _T(",") << vResults[1] << _T(",") << vResults[2] << _T(",") << vResults[3] << _T("}");
+            }
+        }
+        catch (Parser::exception_type &e)
+        {
+            if (a_fPass)
+            {
+                mu::console() << _T("\n  fail: ") << e.GetExpr() << _T(" : ") << e.GetMsg();
+                iRet = 1;
+            }
+        }
+        catch (...)
+        {
+            mu::console() << _T("\n  fail: ") << a_str.c_str() << _T(" (unexpected exception)");
+            iRet = 1;  // exceptions other than ParserException are not allowed
+        }
+
+        return iRet;
+    }
+
+    //---------------------------------------------------------------------------
+    /** \brief Internal error in test class Test is going to be aborted. */
+    void ParserTester::Abort() const
+    {
+      mu::console() << _T("Test failed (internal error in test class)") << endl;
+      while (!getchar());
+      exit(-1);
+    }
+  } // namespace test
+} // namespace mu
diff --git a/geometry/qmuparser/muParserTest.h b/geometry/qmuparser/muParserTest.h
old mode 100755
new mode 100644
index c02b021..1e2b4d0
--- a/geometry/qmuparser/muParserTest.h
+++ b/geometry/qmuparser/muParserTest.h
@@ -1,214 +1,214 @@
-/*
-                 __________                                      
-    _____   __ __\______   \_____  _______  ______  ____ _______ 
-   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
-  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
-  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|   
-        \/                       \/            \/      \/        
-  Copyright (C) 2013 Ingo Berg
-
-  Permission is hereby granted, free of charge, to any person obtaining a copy of this 
-  software and associated documentation files (the "Software"), to deal in the Software
-  without restriction, including without limitation the rights to use, copy, modify, 
-  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 
-  permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-  The above copyright notice and this permission notice shall be included in all copies or 
-  substantial portions of the Software.
-
-  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
-  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
-  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
-  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
-  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
-*/
-
-#ifndef MU_PARSER_TEST_H
-#define MU_PARSER_TEST_H
-
-#include <string>
-#include <cstdlib>
-#include <numeric> // for accumulate
-#include "muParser.h"
-#include "muParserInt.h"
-
-/** \file
-    \brief This file contains the parser test class.
-*/
-
-namespace mu
-{
-  /** \brief Namespace for test cases. */
-  namespace Test
-  {
-    //------------------------------------------------------------------------------
-    /** \brief Test cases for unit testing.
-
-      (C) 2004-2011 Ingo Berg
-    */
-    class ParserTester // final
-    {
-    private:
-        static int c_iCount;
-
-        // Multiarg callbacks
-        static value_type f1of1(value_type v) { return v;};
-      	
-        static value_type f1of2(value_type v, value_type  ) {return v;};
-        static value_type f2of2(value_type  , value_type v) {return v;};
-
-        static value_type f1of3(value_type v, value_type  , value_type  ) {return v;};
-        static value_type f2of3(value_type  , value_type v, value_type  ) {return v;};
-        static value_type f3of3(value_type  , value_type  , value_type v) {return v;};
-      	
-        static value_type f1of4(value_type v, value_type,   value_type  , value_type  ) {return v;}
-        static value_type f2of4(value_type  , value_type v, value_type  , value_type  ) {return v;}
-        static value_type f3of4(value_type  , value_type,   value_type v, value_type  ) {return v;}
-        static value_type f4of4(value_type  , value_type,   value_type  , value_type v) {return v;}
-
-        static value_type f1of5(value_type v, value_type,   value_type  , value_type  , value_type  ) { return v; }
-        static value_type f2of5(value_type  , value_type v, value_type  , value_type  , value_type  ) { return v; }
-        static value_type f3of5(value_type  , value_type,   value_type v, value_type  , value_type  ) { return v; }
-        static value_type f4of5(value_type  , value_type,   value_type  , value_type v, value_type  ) { return v; }
-        static value_type f5of5(value_type  , value_type,   value_type  , value_type  , value_type v) { return v; }
-
-        static value_type Min(value_type a_fVal1, value_type a_fVal2) { return (a_fVal1<a_fVal2) ? a_fVal1 : a_fVal2; }
-  	    static value_type Max(value_type a_fVal1, value_type a_fVal2) { return (a_fVal1>a_fVal2) ? a_fVal1 : a_fVal2; }
-
-        static value_type plus2(value_type v1) { return v1+2; }
-        static value_type times3(value_type v1) { return v1*3; }
-        static value_type sqr(value_type v1) { return v1*v1; }
-        static value_type sign(value_type v) { return -v; }
-        static value_type add(value_type v1, value_type v2) { return v1+v2; }
-        static value_type land(value_type v1, value_type v2) { return (int)v1 & (int)v2; }
-        
-
-        static value_type FirstArg(const value_type* a_afArg, int a_iArgc)
-        {
-          if (!a_iArgc)	
-            throw mu::Parser::exception_type( _T("too few arguments for function FirstArg.") );
-
-          return  a_afArg[0];
-        }
-
-        static value_type LastArg(const value_type* a_afArg, int a_iArgc)
-        {
-          if (!a_iArgc)	
-            throw mu::Parser::exception_type( _T("too few arguments for function LastArg.") );
-
-          return  a_afArg[a_iArgc-1];
-        }
-
-        static value_type Sum(const value_type* a_afArg, int a_iArgc)
-        { 
-          if (!a_iArgc)	
-            throw mu::Parser::exception_type( _T("too few arguments for function sum.") );
-
-          value_type fRes=0;
-          for (int i=0; i<a_iArgc; ++i) fRes += a_afArg[i];
-          return fRes;
-        }
-
-        static value_type Rnd(value_type v)
-        {
-          return (value_type)(1+(v*std::rand()/(RAND_MAX+1.0)));
-        }
-
-        static value_type RndWithString(const char_type*)
-        {
-          return (value_type)( 1 + (1000.0f * std::rand() / (RAND_MAX + 1.0) ) );
-        }
-
-        static value_type Ping()
-        { 
-          return 10; 
-        }
-
-        static value_type ValueOf(const char_type*)      
-        { 
-          return 123; 
-        }
-
-        static value_type StrFun1(const char_type* v1)                               
-        { 
-          int val(0);
-          stringstream_type(v1) >> val;
-          return (value_type)val;
-        }
-
-        static value_type StrFun2(const char_type* v1, value_type v2)                
-        { 
-          int val(0);
-          stringstream_type(v1) >> val;
-          return (value_type)(val + v2);
-        }
-        
-        static value_type StrFun3(const char_type* v1, value_type v2, value_type v3) 
-        { 
-          int val(0);
-          stringstream_type(v1) >> val;
-          return val + v2 + v3;
-        }
-
-        static value_type StrToFloat(const char_type* a_szMsg)
-        {
-          value_type val(0);
-          stringstream_type(a_szMsg) >> val;
-          return val;
-        }
-
-        // postfix operator callback
-        static value_type Mega(value_type a_fVal)  { return a_fVal * (value_type)1e6; }
-        static value_type Micro(value_type a_fVal) { return a_fVal * (value_type)1e-6; }
-        static value_type Milli(value_type a_fVal) { return a_fVal / (value_type)1e3; }
-
-        // Custom value recognition
-        static int IsHexVal(const char_type *a_szExpr, int *a_iPos, value_type *a_fVal);
-
-        int TestNames();
-        int TestSyntax();
-        int TestMultiArg();
-        int TestPostFix();
-        int TestExpression();
-        int TestInfixOprt();
-        int TestBinOprt();
-        int TestVarConst();
-        int TestInterface();
-        int TestException();
-        int TestStrArg();
-        int TestIfThenElse();
-        int TestBulkMode();
-
-        void Abort() const;
-
-    public:
-        typedef int (ParserTester::*testfun_type)();
-
-	      ParserTester();
-	      void Run();
-
-    private:
-        std::vector<testfun_type> m_vTestFun;
-	      void AddTest(testfun_type a_pFun);
-
-        // Test Double Parser
-        int EqnTest(const string_type& a_str, double a_fRes, bool a_fPass);
-        int EqnTestWithVarChange(const string_type& a_str, 
-                                 double a_fRes1, 
-                                 double a_fVar1, 
-                                 double a_fRes2, 
-                                 double a_fVar2);
-        int ThrowTest(const string_type& a_str, int a_iErrc, bool a_bFail = true);
-
-        // Test Int Parser
-        int EqnTestInt(const string_type& a_str, double a_fRes, bool a_fPass);
-
-        // Test Bulkmode
-        int EqnTestBulk(const string_type& a_str, double a_fRes[4], bool a_fPass);
-    };
-  } // namespace Test
-} // namespace mu
-
-#endif
-
-
+/*
+                 __________
+    _____   __ __\______   \_____  _______  ______  ____ _______
+   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
+  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
+  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|
+        \/                       \/            \/      \/
+  Copyright (C) 2013 Ingo Berg
+
+  Permission is hereby granted, free of charge, to any person obtaining a copy of this
+  software and associated documentation files (the "Software"), to deal in the Software
+  without restriction, including without limitation the rights to use, copy, modify,
+  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
+  permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included in all copies or
+  substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
+  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef MU_PARSER_TEST_H
+#define MU_PARSER_TEST_H
+
+#include <string>
+#include <cstdlib>
+#include <numeric> // for accumulate
+#include "muParser.h"
+#include "muParserInt.h"
+
+/** \file
+    \brief This file contains the parser test class.
+*/
+
+namespace mu
+{
+  /** \brief Namespace for test cases. */
+  namespace Test
+  {
+    //------------------------------------------------------------------------------
+    /** \brief Test cases for unit testing.
+
+      (C) 2004-2011 Ingo Berg
+    */
+    class ParserTester // final
+    {
+    private:
+        static int c_iCount;
+
+        // Multiarg callbacks
+        static value_type f1of1(value_type v) { return v;};
+
+        static value_type f1of2(value_type v, value_type  ) {return v;};
+        static value_type f2of2(value_type  , value_type v) {return v;};
+
+        static value_type f1of3(value_type v, value_type  , value_type  ) {return v;};
+        static value_type f2of3(value_type  , value_type v, value_type  ) {return v;};
+        static value_type f3of3(value_type  , value_type  , value_type v) {return v;};
+
+        static value_type f1of4(value_type v, value_type,   value_type  , value_type  ) {return v;}
+        static value_type f2of4(value_type  , value_type v, value_type  , value_type  ) {return v;}
+        static value_type f3of4(value_type  , value_type,   value_type v, value_type  ) {return v;}
+        static value_type f4of4(value_type  , value_type,   value_type  , value_type v) {return v;}
+
+        static value_type f1of5(value_type v, value_type,   value_type  , value_type  , value_type  ) { return v; }
+        static value_type f2of5(value_type  , value_type v, value_type  , value_type  , value_type  ) { return v; }
+        static value_type f3of5(value_type  , value_type,   value_type v, value_type  , value_type  ) { return v; }
+        static value_type f4of5(value_type  , value_type,   value_type  , value_type v, value_type  ) { return v; }
+        static value_type f5of5(value_type  , value_type,   value_type  , value_type  , value_type v) { return v; }
+
+        static value_type Min(value_type a_fVal1, value_type a_fVal2) { return (a_fVal1<a_fVal2) ? a_fVal1 : a_fVal2; }
+  	    static value_type Max(value_type a_fVal1, value_type a_fVal2) { return (a_fVal1>a_fVal2) ? a_fVal1 : a_fVal2; }
+
+        static value_type plus2(value_type v1) { return v1+2; }
+        static value_type times3(value_type v1) { return v1*3; }
+        static value_type sqr(value_type v1) { return v1*v1; }
+        static value_type sign(value_type v) { return -v; }
+        static value_type add(value_type v1, value_type v2) { return v1+v2; }
+        static value_type land(value_type v1, value_type v2) { return (int)v1 & (int)v2; }
+
+
+        static value_type FirstArg(const value_type* a_afArg, int a_iArgc)
+        {
+          if (!a_iArgc)
+            throw mu::Parser::exception_type( _T("too few arguments for function FirstArg.") );
+
+          return  a_afArg[0];
+        }
+
+        static value_type LastArg(const value_type* a_afArg, int a_iArgc)
+        {
+          if (!a_iArgc)
+            throw mu::Parser::exception_type( _T("too few arguments for function LastArg.") );
+
+          return  a_afArg[a_iArgc-1];
+        }
+
+        static value_type Sum(const value_type* a_afArg, int a_iArgc)
+        {
+          if (!a_iArgc)
+            throw mu::Parser::exception_type( _T("too few arguments for function sum.") );
+
+          value_type fRes=0;
+          for (int i=0; i<a_iArgc; ++i) fRes += a_afArg[i];
+          return fRes;
+        }
+
+        static value_type Rnd(value_type v)
+        {
+          return (value_type)(1+(v*std::rand()/(RAND_MAX+1.0)));
+        }
+
+        static value_type RndWithString(const char_type*)
+        {
+          return (value_type)( 1 + (1000.0f * std::rand() / (RAND_MAX + 1.0) ) );
+        }
+
+        static value_type Ping()
+        {
+          return 10;
+        }
+
+        static value_type ValueOf(const char_type*)
+        {
+          return 123;
+        }
+
+        static value_type StrFun1(const char_type* v1)
+        {
+          int val(0);
+          stringstream_type(v1) >> val;
+          return (value_type)val;
+        }
+
+        static value_type StrFun2(const char_type* v1, value_type v2)
+        {
+          int val(0);
+          stringstream_type(v1) >> val;
+          return (value_type)(val + v2);
+        }
+
+        static value_type StrFun3(const char_type* v1, value_type v2, value_type v3)
+        {
+          int val(0);
+          stringstream_type(v1) >> val;
+          return val + v2 + v3;
+        }
+
+        static value_type StrToFloat(const char_type* a_szMsg)
+        {
+          value_type val(0);
+          stringstream_type(a_szMsg) >> val;
+          return val;
+        }
+
+        // postfix operator callback
+        static value_type Mega(value_type a_fVal)  { return a_fVal * (value_type)1e6; }
+        static value_type Micro(value_type a_fVal) { return a_fVal * (value_type)1e-6; }
+        static value_type Milli(value_type a_fVal) { return a_fVal / (value_type)1e3; }
+
+        // Custom value recognition
+        static int IsHexVal(const char_type *a_szExpr, int *a_iPos, value_type *a_fVal);
+
+        int TestNames();
+        int TestSyntax();
+        int TestMultiArg();
+        int TestPostFix();
+        int TestExpression();
+        int TestInfixOprt();
+        int TestBinOprt();
+        int TestVarConst();
+        int TestInterface();
+        int TestException();
+        int TestStrArg();
+        int TestIfThenElse();
+        int TestBulkMode();
+
+        void Abort() const;
+
+    public:
+        typedef int (ParserTester::*testfun_type)();
+
+	      ParserTester();
+	      void Run();
+
+    private:
+        std::vector<testfun_type> m_vTestFun;
+	      void AddTest(testfun_type a_pFun);
+
+        // Test Double Parser
+        int EqnTest(const string_type& a_str, double a_fRes, bool a_fPass);
+        int EqnTestWithVarChange(const string_type& a_str,
+                                 double a_fRes1,
+                                 double a_fVar1,
+                                 double a_fRes2,
+                                 double a_fVar2);
+        int ThrowTest(const string_type& a_str, int a_iErrc, bool a_bFail = true);
+
+        // Test Int Parser
+        int EqnTestInt(const string_type& a_str, double a_fRes, bool a_fPass);
+
+        // Test Bulkmode
+        int EqnTestBulk(const string_type& a_str, double a_fRes[4], bool a_fPass);
+    };
+  } // namespace Test
+} // namespace mu
+
+#endif
+
+
diff --git a/geometry/qmuparser/muParserToken.h b/geometry/qmuparser/muParserToken.h
old mode 100755
new mode 100644
index fc91d78..b3a879a
--- a/geometry/qmuparser/muParserToken.h
+++ b/geometry/qmuparser/muParserToken.h
@@ -1,401 +1,401 @@
-/*
-                 __________                                      
-    _____   __ __\______   \_____  _______  ______  ____ _______ 
-   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
-  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
-  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|   
-        \/                       \/            \/      \/        
-  Copyright (C) 2004-2013 Ingo Berg
-
-  Permission is hereby granted, free of charge, to any person obtaining a copy of this 
-  software and associated documentation files (the "Software"), to deal in the Software
-  without restriction, including without limitation the rights to use, copy, modify, 
-  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 
-  permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-  The above copyright notice and this permission notice shall be included in all copies or 
-  substantial portions of the Software.
-
-  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
-  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
-  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
-  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
-  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
-*/
-
-#ifndef MU_PARSER_TOKEN_H
-#define MU_PARSER_TOKEN_H
-
-#include <cassert>
-#include <string>
-#include <stack>
-#include <vector>
-#include <memory>
-
-#include "muParserError.h"
-#include "muParserCallback.h"
-
-/** \file
-    \brief This file contains the parser token definition.
-*/
-
-namespace mu
-{
-  /** \brief Encapsulation of the data for a single formula token. 
-
-    Formula token implementation. Part of the Math Parser Package.
-    Formula tokens can be either one of the following:
-    <ul>
-      <li>value</li>
-      <li>variable</li>
-      <li>function with numerical arguments</li>
-      <li>functions with a string as argument</li>
-      <li>prefix operators</li>
-      <li>infix operators</li>
-	    <li>binary operator</li>
-    </ul>
-
-   \author (C) 2004-2013 Ingo Berg 
-  */
-  template<typename TBase, typename TString>
-  class ParserToken
-  {
-  private:
-
-      ECmdCode  m_iCode;  ///< Type of the token; The token type is a constant of type #ECmdCode.
-      ETypeCode m_iType;
-      void  *m_pTok;      ///< Stores Token pointer; not applicable for all tokens
-      int  m_iIdx;        ///< An otional index to an external buffer storing the token data
-      TString m_strTok;   ///< Token string
-      TString m_strVal;   ///< Value for string variables
-      value_type m_fVal;  ///< the value 
-      std::auto_ptr<ParserCallback> m_pCallback;
-
-  public:
-
-      //---------------------------------------------------------------------------
-      /** \brief Constructor (default).
-        
-          Sets token to an neutral state of type cmUNKNOWN.
-          \throw nothrow
-          \sa ECmdCode
-      */
-      ParserToken()
-        :m_iCode(cmUNKNOWN)
-        ,m_iType(tpVOID)
-        ,m_pTok(0)
-        ,m_iIdx(-1)
-        ,m_strTok()
-		,m_strVal()
-		,m_fVal(0)
-        ,m_pCallback()
-      {}
-
-      //------------------------------------------------------------------------------
-      /** \brief Create token from another one.
-      
-          Implemented by calling Assign(...)
-          \throw nothrow
-          \post m_iType==cmUNKNOWN
-          \sa #Assign
-      */
-      ParserToken(const ParserToken &a_Tok)
-      {
-        Assign(a_Tok);
-      }
-      
-      //------------------------------------------------------------------------------
-      /** \brief Assignement operator. 
-      
-          Copy token state from another token and return this.
-          Implemented by calling Assign(...).
-          \throw nothrow
-      */
-      ParserToken& operator=(const ParserToken &a_Tok)
-      {
-        Assign(a_Tok);
-        return *this;
-      }
-
-      //------------------------------------------------------------------------------
-      /** \brief Copy token information from argument.
-      
-          \throw nothrow
-      */
-      void Assign(const ParserToken &a_Tok)
-      {
-        m_iCode = a_Tok.m_iCode;
-        m_pTok = a_Tok.m_pTok;
-        m_strTok = a_Tok.m_strTok;
-        m_iIdx = a_Tok.m_iIdx;
-        m_strVal = a_Tok.m_strVal;
-        m_iType = a_Tok.m_iType;
-        m_fVal = a_Tok.m_fVal;
-        // create new callback object if a_Tok has one 
-        m_pCallback.reset(a_Tok.m_pCallback.get() ? a_Tok.m_pCallback->Clone() : 0);
-      }
-
-      //------------------------------------------------------------------------------
-      /** \brief Assign a token type. 
-
-        Token may not be of type value, variable or function. Those have seperate set functions. 
-
-        \pre [assert] a_iType!=cmVAR
-        \pre [assert] a_iType!=cmVAL
-        \pre [assert] a_iType!=cmFUNC
-        \post m_fVal = 0
-        \post m_pTok = 0
-      */
-      ParserToken& Set(ECmdCode a_iType, const TString &a_strTok=TString())
-      {
-        // The following types cant be set this way, they have special Set functions
-        assert(a_iType!=cmVAR);
-        assert(a_iType!=cmVAL);
-        assert(a_iType!=cmFUNC);
-
-        m_iCode = a_iType;
-        m_iType = tpVOID;
-        m_pTok = 0;
-        m_strTok = a_strTok;
-        m_iIdx = -1;
-
-        return *this;
-      }
-
-      //------------------------------------------------------------------------------
-      /** \brief Set Callback type. */
-      ParserToken& Set(const ParserCallback &a_pCallback, const TString &a_sTok)
-      {
-        assert(a_pCallback.GetAddr());
-
-        m_iCode = a_pCallback.GetCode();
-        m_iType = tpVOID;
-        m_strTok = a_sTok;
-        m_pCallback.reset(new ParserCallback(a_pCallback));
-
-        m_pTok = 0;
-        m_iIdx = -1;
-        
-        return *this;
-      }
-
-      //------------------------------------------------------------------------------
-      /** \brief Make this token a value token. 
-      
-          Member variables not necessary for value tokens will be invalidated.
-          \throw nothrow
-      */
-      ParserToken& SetVal(TBase a_fVal, const TString &a_strTok=TString())
-      {
-        m_iCode = cmVAL;
-        m_iType = tpDBL;
-        m_fVal = a_fVal;
-        m_strTok = a_strTok;
-        m_iIdx = -1;
-        
-        m_pTok = 0;
-        m_pCallback.reset(0);
-
-        return *this;
-      }
-
-      //------------------------------------------------------------------------------
-      /** \brief make this token a variable token. 
-      
-          Member variables not necessary for variable tokens will be invalidated.
-          \throw nothrow
-      */
-      ParserToken& SetVar(TBase *a_pVar, const TString &a_strTok)
-      {
-        m_iCode = cmVAR;
-        m_iType = tpDBL;
-        m_strTok = a_strTok;
-        m_iIdx = -1;
-        m_pTok = (void*)a_pVar;
-        m_pCallback.reset(0);
-        return *this;
-      }
-
-      //------------------------------------------------------------------------------
-      /** \brief Make this token a variable token. 
-      
-          Member variables not necessary for variable tokens will be invalidated.
-          \throw nothrow
-      */
-      ParserToken& SetString(const TString &a_strTok, std::size_t a_iSize)
-      {
-        m_iCode = cmSTRING;
-        m_iType = tpSTR;
-        m_strTok = a_strTok;
-        m_iIdx = static_cast<int>(a_iSize);
-
-        m_pTok = 0;
-        m_pCallback.reset(0);
-        return *this;
-      }
-
-      //------------------------------------------------------------------------------
-      /** \brief Set an index associated with the token related data. 
-      
-          In cmSTRFUNC - This is the index to a string table in the main parser.
-          \param a_iIdx The index the string function result will take in the bytecode parser.
-          \throw exception_type if #a_iIdx<0 or #m_iType!=cmSTRING
-      */
-      void SetIdx(int a_iIdx)
-      {
-        if (m_iCode!=cmSTRING || a_iIdx<0)
-	        throw ParserError(ecINTERNAL_ERROR);
-        
-        m_iIdx = a_iIdx;
-      }
-
-      //------------------------------------------------------------------------------
-      /** \brief Return Index associated with the token related data. 
-      
-          In cmSTRFUNC - This is the index to a string table in the main parser.
-
-          \throw exception_type if #m_iIdx<0 or #m_iType!=cmSTRING
-          \return The index the result will take in the Bytecode calculatin array (#m_iIdx).
-      */
-      int GetIdx() const
-      {
-        if (m_iIdx<0 || m_iCode!=cmSTRING )
-          throw ParserError(ecINTERNAL_ERROR);
-
-        return m_iIdx;
-      }
-
-      //------------------------------------------------------------------------------
-      /** \brief Return the token type.
-      
-          \return #m_iType
-          \throw nothrow
-      */
-      ECmdCode GetCode() const
-      {
-        if (m_pCallback.get())
-        {
-          return m_pCallback->GetCode();
-        }
-        else
-        {
-          return m_iCode;
-        }
-      }
-
-      //------------------------------------------------------------------------------
-      ETypeCode GetType() const
-      {
-        if (m_pCallback.get())
-        {
-          return m_pCallback->GetType();
-        }
-        else
-        {
-          return m_iType;
-        }
-      }
-      
-      //------------------------------------------------------------------------------
-      int GetPri() const
-      {
-        if ( !m_pCallback.get())
-	        throw ParserError(ecINTERNAL_ERROR);
-            
-        if ( m_pCallback->GetCode()!=cmOPRT_BIN && m_pCallback->GetCode()!=cmOPRT_INFIX)
-	        throw ParserError(ecINTERNAL_ERROR);
-
-        return m_pCallback->GetPri();
-      }
-
-      //------------------------------------------------------------------------------
-      EOprtAssociativity GetAssociativity() const
-      {
-        if (m_pCallback.get()==NULL || m_pCallback->GetCode()!=cmOPRT_BIN)
-	        throw ParserError(ecINTERNAL_ERROR);
-
-        return m_pCallback->GetAssociativity();
-      }
-
-      //------------------------------------------------------------------------------
-      /** \brief Return the address of the callback function assoziated with
-                 function and operator tokens.
-
-          \return The pointer stored in #m_pTok.
-          \throw exception_type if token type is non of:
-                 <ul>
-                   <li>cmFUNC</li>
-                   <li>cmSTRFUNC</li>
-                   <li>cmPOSTOP</li>
-                   <li>cmINFIXOP</li>
-                   <li>cmOPRT_BIN</li>
-                 </ul>
-          \sa ECmdCode
-      */
-      generic_fun_type GetFuncAddr() const
-      {
-        return (m_pCallback.get()) ? (generic_fun_type)m_pCallback->GetAddr() : 0;
-      }
-
-      //------------------------------------------------------------------------------
-      /** \biref Get value of the token.
-        
-          Only applicable to variable and value tokens.
-          \throw exception_type if token is no value/variable token.
-      */
-      TBase GetVal() const
-      {
-        switch (m_iCode)
-        {
-          case cmVAL:  return m_fVal;
-          case cmVAR:  return *((TBase*)m_pTok);
-          default:     throw ParserError(ecVAL_EXPECTED);
-        }
-      }
-
-      //------------------------------------------------------------------------------
-      /** \brief Get address of a variable token.
-
-        Valid only if m_iType==CmdVar.
-        \throw exception_type if token is no variable token.
-      */
-      TBase* GetVar() const
-      {
-        if (m_iCode!=cmVAR)
-	        throw ParserError(ecINTERNAL_ERROR);
-
-        return (TBase*)m_pTok;
-      }
-
-      //------------------------------------------------------------------------------
-      /** \brief Return the number of function arguments. 
-
-        Valid only if m_iType==CmdFUNC.
-      */
-      int GetArgCount() const
-      {
-        assert(m_pCallback.get());
-
-        if (!m_pCallback->GetAddr())
-	        throw ParserError(ecINTERNAL_ERROR);
-
-        return m_pCallback->GetArgc();
-      }
-
-      //------------------------------------------------------------------------------
-      /** \brief Return the token identifier. 
-          
-          If #m_iType is cmSTRING the token identifier is the value of the string argument
-          for a string function.
-          \return #m_strTok
-          \throw nothrow
-          \sa m_strTok
-      */
-      const TString& GetAsString() const
-      {
-        return m_strTok;
-      }
-  };
-} // namespace mu
-
-#endif
+/*
+                 __________
+    _____   __ __\______   \_____  _______  ______  ____ _______
+   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
+  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
+  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|
+        \/                       \/            \/      \/
+  Copyright (C) 2004-2013 Ingo Berg
+
+  Permission is hereby granted, free of charge, to any person obtaining a copy of this
+  software and associated documentation files (the "Software"), to deal in the Software
+  without restriction, including without limitation the rights to use, copy, modify,
+  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
+  permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included in all copies or
+  substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
+  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef MU_PARSER_TOKEN_H
+#define MU_PARSER_TOKEN_H
+
+#include <cassert>
+#include <string>
+#include <stack>
+#include <vector>
+#include <memory>
+
+#include "muParserError.h"
+#include "muParserCallback.h"
+
+/** \file
+    \brief This file contains the parser token definition.
+*/
+
+namespace mu
+{
+  /** \brief Encapsulation of the data for a single formula token.
+
+    Formula token implementation. Part of the Math Parser Package.
+    Formula tokens can be either one of the following:
+    <ul>
+      <li>value</li>
+      <li>variable</li>
+      <li>function with numerical arguments</li>
+      <li>functions with a string as argument</li>
+      <li>prefix operators</li>
+      <li>infix operators</li>
+	    <li>binary operator</li>
+    </ul>
+
+   \author (C) 2004-2013 Ingo Berg
+  */
+  template<typename TBase, typename TString>
+  class ParserToken
+  {
+  private:
+
+      ECmdCode  m_iCode;  ///< Type of the token; The token type is a constant of type #ECmdCode.
+      ETypeCode m_iType;
+      void  *m_pTok;      ///< Stores Token pointer; not applicable for all tokens
+      int  m_iIdx;        ///< An otional index to an external buffer storing the token data
+      TString m_strTok;   ///< Token string
+      TString m_strVal;   ///< Value for string variables
+      value_type m_fVal;  ///< the value
+      std::auto_ptr<ParserCallback> m_pCallback;
+
+  public:
+
+      //---------------------------------------------------------------------------
+      /** \brief Constructor (default).
+
+          Sets token to an neutral state of type cmUNKNOWN.
+          \throw nothrow
+          \sa ECmdCode
+      */
+      ParserToken()
+        :m_iCode(cmUNKNOWN)
+        ,m_iType(tpVOID)
+        ,m_pTok(0)
+        ,m_iIdx(-1)
+        ,m_strTok()
+		,m_strVal()
+		,m_fVal(0)
+        ,m_pCallback()
+      {}
+
+      //------------------------------------------------------------------------------
+      /** \brief Create token from another one.
+
+          Implemented by calling Assign(...)
+          \throw nothrow
+          \post m_iType==cmUNKNOWN
+          \sa #Assign
+      */
+      ParserToken(const ParserToken &a_Tok)
+      {
+        Assign(a_Tok);
+      }
+
+      //------------------------------------------------------------------------------
+      /** \brief Assignement operator.
+
+          Copy token state from another token and return this.
+          Implemented by calling Assign(...).
+          \throw nothrow
+      */
+      ParserToken& operator=(const ParserToken &a_Tok)
+      {
+        Assign(a_Tok);
+        return *this;
+      }
+
+      //------------------------------------------------------------------------------
+      /** \brief Copy token information from argument.
+
+          \throw nothrow
+      */
+      void Assign(const ParserToken &a_Tok)
+      {
+        m_iCode = a_Tok.m_iCode;
+        m_pTok = a_Tok.m_pTok;
+        m_strTok = a_Tok.m_strTok;
+        m_iIdx = a_Tok.m_iIdx;
+        m_strVal = a_Tok.m_strVal;
+        m_iType = a_Tok.m_iType;
+        m_fVal = a_Tok.m_fVal;
+        // create new callback object if a_Tok has one
+        m_pCallback.reset(a_Tok.m_pCallback.get() ? a_Tok.m_pCallback->Clone() : 0);
+      }
+
+      //------------------------------------------------------------------------------
+      /** \brief Assign a token type.
+
+        Token may not be of type value, variable or function. Those have seperate set functions.
+
+        \pre [assert] a_iType!=cmVAR
+        \pre [assert] a_iType!=cmVAL
+        \pre [assert] a_iType!=cmFUNC
+        \post m_fVal = 0
+        \post m_pTok = 0
+      */
+      ParserToken& Set(ECmdCode a_iType, const TString &a_strTok=TString())
+      {
+        // The following types cant be set this way, they have special Set functions
+        assert(a_iType!=cmVAR);
+        assert(a_iType!=cmVAL);
+        assert(a_iType!=cmFUNC);
+
+        m_iCode = a_iType;
+        m_iType = tpVOID;
+        m_pTok = 0;
+        m_strTok = a_strTok;
+        m_iIdx = -1;
+
+        return *this;
+      }
+
+      //------------------------------------------------------------------------------
+      /** \brief Set Callback type. */
+      ParserToken& Set(const ParserCallback &a_pCallback, const TString &a_sTok)
+      {
+        assert(a_pCallback.GetAddr());
+
+        m_iCode = a_pCallback.GetCode();
+        m_iType = tpVOID;
+        m_strTok = a_sTok;
+        m_pCallback.reset(new ParserCallback(a_pCallback));
+
+        m_pTok = 0;
+        m_iIdx = -1;
+
+        return *this;
+      }
+
+      //------------------------------------------------------------------------------
+      /** \brief Make this token a value token.
+
+          Member variables not necessary for value tokens will be invalidated.
+          \throw nothrow
+      */
+      ParserToken& SetVal(TBase a_fVal, const TString &a_strTok=TString())
+      {
+        m_iCode = cmVAL;
+        m_iType = tpDBL;
+        m_fVal = a_fVal;
+        m_strTok = a_strTok;
+        m_iIdx = -1;
+
+        m_pTok = 0;
+        m_pCallback.reset(0);
+
+        return *this;
+      }
+
+      //------------------------------------------------------------------------------
+      /** \brief make this token a variable token.
+
+          Member variables not necessary for variable tokens will be invalidated.
+          \throw nothrow
+      */
+      ParserToken& SetVar(TBase *a_pVar, const TString &a_strTok)
+      {
+        m_iCode = cmVAR;
+        m_iType = tpDBL;
+        m_strTok = a_strTok;
+        m_iIdx = -1;
+        m_pTok = (void*)a_pVar;
+        m_pCallback.reset(0);
+        return *this;
+      }
+
+      //------------------------------------------------------------------------------
+      /** \brief Make this token a variable token.
+
+          Member variables not necessary for variable tokens will be invalidated.
+          \throw nothrow
+      */
+      ParserToken& SetString(const TString &a_strTok, std::size_t a_iSize)
+      {
+        m_iCode = cmSTRING;
+        m_iType = tpSTR;
+        m_strTok = a_strTok;
+        m_iIdx = static_cast<int>(a_iSize);
+
+        m_pTok = 0;
+        m_pCallback.reset(0);
+        return *this;
+      }
+
+      //------------------------------------------------------------------------------
+      /** \brief Set an index associated with the token related data.
+
+          In cmSTRFUNC - This is the index to a string table in the main parser.
+          \param a_iIdx The index the string function result will take in the bytecode parser.
+          \throw exception_type if #a_iIdx<0 or #m_iType!=cmSTRING
+      */
+      void SetIdx(int a_iIdx)
+      {
+        if (m_iCode!=cmSTRING || a_iIdx<0)
+	        throw ParserError(ecINTERNAL_ERROR);
+
+        m_iIdx = a_iIdx;
+      }
+
+      //------------------------------------------------------------------------------
+      /** \brief Return Index associated with the token related data.
+
+          In cmSTRFUNC - This is the index to a string table in the main parser.
+
+          \throw exception_type if #m_iIdx<0 or #m_iType!=cmSTRING
+          \return The index the result will take in the Bytecode calculatin array (#m_iIdx).
+      */
+      int GetIdx() const
+      {
+        if (m_iIdx<0 || m_iCode!=cmSTRING )
+          throw ParserError(ecINTERNAL_ERROR);
+
+        return m_iIdx;
+      }
+
+      //------------------------------------------------------------------------------
+      /** \brief Return the token type.
+
+          \return #m_iType
+          \throw nothrow
+      */
+      ECmdCode GetCode() const
+      {
+        if (m_pCallback.get())
+        {
+          return m_pCallback->GetCode();
+        }
+        else
+        {
+          return m_iCode;
+        }
+      }
+
+      //------------------------------------------------------------------------------
+      ETypeCode GetType() const
+      {
+        if (m_pCallback.get())
+        {
+          return m_pCallback->GetType();
+        }
+        else
+        {
+          return m_iType;
+        }
+      }
+
+      //------------------------------------------------------------------------------
+      int GetPri() const
+      {
+        if ( !m_pCallback.get())
+	        throw ParserError(ecINTERNAL_ERROR);
+
+        if ( m_pCallback->GetCode()!=cmOPRT_BIN && m_pCallback->GetCode()!=cmOPRT_INFIX)
+	        throw ParserError(ecINTERNAL_ERROR);
+
+        return m_pCallback->GetPri();
+      }
+
+      //------------------------------------------------------------------------------
+      EOprtAssociativity GetAssociativity() const
+      {
+        if (m_pCallback.get()==NULL || m_pCallback->GetCode()!=cmOPRT_BIN)
+	        throw ParserError(ecINTERNAL_ERROR);
+
+        return m_pCallback->GetAssociativity();
+      }
+
+      //------------------------------------------------------------------------------
+      /** \brief Return the address of the callback function assoziated with
+                 function and operator tokens.
+
+          \return The pointer stored in #m_pTok.
+          \throw exception_type if token type is non of:
+                 <ul>
+                   <li>cmFUNC</li>
+                   <li>cmSTRFUNC</li>
+                   <li>cmPOSTOP</li>
+                   <li>cmINFIXOP</li>
+                   <li>cmOPRT_BIN</li>
+                 </ul>
+          \sa ECmdCode
+      */
+      generic_fun_type GetFuncAddr() const
+      {
+        return (m_pCallback.get()) ? (generic_fun_type)m_pCallback->GetAddr() : 0;
+      }
+
+      //------------------------------------------------------------------------------
+      /** \biref Get value of the token.
+
+          Only applicable to variable and value tokens.
+          \throw exception_type if token is no value/variable token.
+      */
+      TBase GetVal() const
+      {
+        switch (m_iCode)
+        {
+          case cmVAL:  return m_fVal;
+          case cmVAR:  return *((TBase*)m_pTok);
+          default:     throw ParserError(ecVAL_EXPECTED);
+        }
+      }
+
+      //------------------------------------------------------------------------------
+      /** \brief Get address of a variable token.
+
+        Valid only if m_iType==CmdVar.
+        \throw exception_type if token is no variable token.
+      */
+      TBase* GetVar() const
+      {
+        if (m_iCode!=cmVAR)
+	        throw ParserError(ecINTERNAL_ERROR);
+
+        return (TBase*)m_pTok;
+      }
+
+      //------------------------------------------------------------------------------
+      /** \brief Return the number of function arguments.
+
+        Valid only if m_iType==CmdFUNC.
+      */
+      int GetArgCount() const
+      {
+        assert(m_pCallback.get());
+
+        if (!m_pCallback->GetAddr())
+	        throw ParserError(ecINTERNAL_ERROR);
+
+        return m_pCallback->GetArgc();
+      }
+
+      //------------------------------------------------------------------------------
+      /** \brief Return the token identifier.
+
+          If #m_iType is cmSTRING the token identifier is the value of the string argument
+          for a string function.
+          \return #m_strTok
+          \throw nothrow
+          \sa m_strTok
+      */
+      const TString& GetAsString() const
+      {
+        return m_strTok;
+      }
+  };
+} // namespace mu
+
+#endif
diff --git a/geometry/qmuparser/muParserTokenReader.cpp b/geometry/qmuparser/muParserTokenReader.cpp
old mode 100755
new mode 100644
index 8da1e40..bf630c6
--- a/geometry/qmuparser/muParserTokenReader.cpp
+++ b/geometry/qmuparser/muParserTokenReader.cpp
@@ -1,958 +1,958 @@
-/*
-                 __________                                      
-    _____   __ __\______   \_____  _______  ______  ____ _______ 
-   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
-  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
-  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|   
-        \/                       \/            \/      \/        
-  Copyright (C) 2013 Ingo Berg
-
-  Permission is hereby granted, free of charge, to any person obtaining a copy of this 
-  software and associated documentation files (the "Software"), to deal in the Software
-  without restriction, including without limitation the rights to use, copy, modify, 
-  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 
-  permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-  The above copyright notice and this permission notice shall be included in all copies or 
-  substantial portions of the Software.
-
-  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
-  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
-  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
-  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
-  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
-*/
-#include <cassert>
-#include <cstdio>
-#include <cstring>
-#include <map>
-#include <stack>
-#include <string>
-
-#include "muParserTokenReader.h"
-#include "muParserBase.h"
-
-/** \file
-    \brief This file contains the parser token reader implementation.
-*/
-
-
-namespace mu
-{
-
-  // Forward declaration
-  class ParserBase;
-
-  //---------------------------------------------------------------------------
-  /** \brief Copy constructor.
-
-      \sa Assign
-      \throw nothrow
-  */
-  ParserTokenReader::ParserTokenReader(const ParserTokenReader &a_Reader) 
-  { 
-    Assign(a_Reader);
-  }
-    
-  //---------------------------------------------------------------------------
-  /** \brief Assignment operator.
-
-      Self assignment will be suppressed otherwise #Assign is called.
-
-      \param a_Reader Object to copy to this token reader.
-      \throw nothrow
-  */
-  ParserTokenReader& ParserTokenReader::operator=(const ParserTokenReader &a_Reader) 
-  {
-    if (&a_Reader!=this)
-      Assign(a_Reader);
-
-    return *this;
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Assign state of a token reader to this token reader. 
-      
-      \param a_Reader Object from which the state should be copied.
-      \throw nothrow
-  */
-  void ParserTokenReader::Assign(const ParserTokenReader &a_Reader)
-  {
-    m_pParser = a_Reader.m_pParser;
-    m_strFormula = a_Reader.m_strFormula;
-    m_iPos = a_Reader.m_iPos;
-    m_iSynFlags = a_Reader.m_iSynFlags;
-    
-    m_UsedVar         = a_Reader.m_UsedVar;
-    m_pFunDef         = a_Reader.m_pFunDef;
-    m_pConstDef       = a_Reader.m_pConstDef;
-    m_pVarDef         = a_Reader.m_pVarDef;
-    m_pStrVarDef      = a_Reader.m_pStrVarDef;
-    m_pPostOprtDef    = a_Reader.m_pPostOprtDef;
-    m_pInfixOprtDef   = a_Reader.m_pInfixOprtDef;
-    m_pOprtDef        = a_Reader.m_pOprtDef;
-    m_bIgnoreUndefVar = a_Reader.m_bIgnoreUndefVar;
-    m_vIdentFun       = a_Reader.m_vIdentFun;
-    m_pFactory        = a_Reader.m_pFactory;
-    m_pFactoryData    = a_Reader.m_pFactoryData;
-    m_iBrackets       = a_Reader.m_iBrackets;
-    m_cArgSep         = a_Reader.m_cArgSep;
-	m_fZero           = a_Reader.m_fZero;
-	m_lastTok         = a_Reader.m_lastTok;
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Constructor. 
-      
-      Create a Token reader and bind it to a parser object. 
-
-      \pre [assert] a_pParser may not be NULL
-      \post #m_pParser==a_pParser
-      \param a_pParent Parent parser object of the token reader.
-  */
-  ParserTokenReader::ParserTokenReader(ParserBase *a_pParent)
-    :m_pParser(a_pParent)
-    ,m_strFormula()
-    ,m_iPos(0)
-    ,m_iSynFlags(0)
-    ,m_bIgnoreUndefVar(false)
-    ,m_pFunDef(NULL)
-    ,m_pPostOprtDef(NULL)
-    ,m_pInfixOprtDef(NULL)
-    ,m_pOprtDef(NULL)
-    ,m_pConstDef(NULL)
-    ,m_pStrVarDef(NULL)
-    ,m_pVarDef(NULL)
-    ,m_pFactory(NULL)
-    ,m_pFactoryData(NULL)
-    ,m_vIdentFun()
-    ,m_UsedVar()
-    ,m_fZero(0)
-    ,m_iBrackets(0)
-    ,m_lastTok()
-    ,m_cArgSep(',')
-  {
-    assert(m_pParser);
-    SetParent(m_pParser);
-  }
-    
-  //---------------------------------------------------------------------------
-  /** \brief Create instance of a ParserTokenReader identical with this 
-              and return its pointer. 
-
-      This is a factory method the calling function must take care of the object destruction.
-
-      \return A new ParserTokenReader object.
-      \throw nothrow
-  */
-  ParserTokenReader* ParserTokenReader::Clone(ParserBase *a_pParent) const
-  {
-    std::auto_ptr<ParserTokenReader> ptr(new ParserTokenReader(*this));
-    ptr->SetParent(a_pParent);
-    return ptr.release();
-  }
-
-  //---------------------------------------------------------------------------
-  ParserTokenReader::token_type& ParserTokenReader::SaveBeforeReturn(const token_type &tok)
-  {
-    m_lastTok = tok;
-    return m_lastTok;
-  }
-
-  //---------------------------------------------------------------------------
-  void ParserTokenReader::AddValIdent(identfun_type a_pCallback)
-  {
-    // Use push_front is used to give user defined callbacks a higher priority than
-    // the built in ones. Otherwise reading hex numbers would not work
-    // since the "0" in "0xff" would always be read first making parsing of 
-    // the rest impossible.
-    // reference:
-    // http://sourceforge.net/projects/muparser/forums/forum/462843/topic/4824956
-    m_vIdentFun.push_front(a_pCallback);
-  }
-
-  //---------------------------------------------------------------------------
-  void ParserTokenReader::SetVarCreator(facfun_type a_pFactory, void *pUserData)
-  {
-    m_pFactory = a_pFactory;
-    m_pFactoryData = pUserData;
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Return the current position of the token reader in the formula string. 
-
-      \return #m_iPos
-      \throw nothrow
-  */
-  int ParserTokenReader::GetPos() const
-  {
-    return m_iPos;
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Return a reference to the formula. 
-
-      \return #m_strFormula
-      \throw nothrow
-  */
-  const string_type& ParserTokenReader::GetExpr() const
-  {
-    return m_strFormula;
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Return a map containing the used variables only. */
-  varmap_type& ParserTokenReader::GetUsedVar() 
-  {
-    return m_UsedVar;
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Initialize the token Reader. 
-  
-      Sets the formula position index to zero and set Syntax flags to default for initial formula parsing.
-      \pre [assert] triggered if a_szFormula==0
-  */
-  void ParserTokenReader::SetFormula(const string_type &a_strFormula)
-  {
-    m_strFormula = a_strFormula;
-    ReInit();
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Set Flag that controls behaviour in case of undefined variables being found. 
-  
-    If true, the parser does not throw an exception if an undefined variable is found. 
-    otherwise it does. This variable is used internally only!
-    It suppresses a "undefined variable" exception in GetUsedVar().  
-    Those function should return a complete list of variables including 
-    those the are not defined by the time of it's call.
-  */
-  void ParserTokenReader::IgnoreUndefVar(bool bIgnore)
-  {
-    m_bIgnoreUndefVar = bIgnore;
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Reset the token reader to the start of the formula. 
-
-      The syntax flags will be reset to a value appropriate for the 
-      start of a formula.
-      \post #m_iPos==0, #m_iSynFlags = noOPT | noBC | noPOSTOP | noSTR
-      \throw nothrow
-      \sa ESynCodes
-  */
-  void ParserTokenReader::ReInit()
-  {
-    m_iPos = 0;
-    m_iSynFlags = sfSTART_OF_LINE;
-    m_iBrackets = 0;
-    m_UsedVar.clear();
-    m_lastTok = token_type();
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Read the next token from the string. */ 
-  ParserTokenReader::token_type ParserTokenReader::ReadNextToken()
-  {
-    assert(m_pParser);
-
-    const char_type *szFormula = m_strFormula.c_str();
-    token_type tok;
-
-    // Ignore all non printable characters when reading the expression
-    while (szFormula[m_iPos]>0 && szFormula[m_iPos]<=0x20) 
-      ++m_iPos;
-
-    if ( IsEOF(tok) )        return SaveBeforeReturn(tok); // Check for end of formula
-    if ( IsOprt(tok) )       return SaveBeforeReturn(tok); // Check for user defined binary operator
-    if ( IsFunTok(tok) )     return SaveBeforeReturn(tok); // Check for function token
-    if ( IsBuiltIn(tok) )    return SaveBeforeReturn(tok); // Check built in operators / tokens
-    if ( IsArgSep(tok) )     return SaveBeforeReturn(tok); // Check for function argument separators
-    if ( IsValTok(tok) )     return SaveBeforeReturn(tok); // Check for values / constant tokens
-    if ( IsVarTok(tok) )     return SaveBeforeReturn(tok); // Check for variable tokens
-    if ( IsStrVarTok(tok) )  return SaveBeforeReturn(tok); // Check for string variables
-    if ( IsString(tok) )     return SaveBeforeReturn(tok); // Check for String tokens
-    if ( IsInfixOpTok(tok) ) return SaveBeforeReturn(tok); // Check for unary operators
-    if ( IsPostOpTok(tok) )  return SaveBeforeReturn(tok); // Check for unary operators
-
-    // Check String for undefined variable token. Done only if a 
-    // flag is set indicating to ignore undefined variables.
-    // This is a way to conditionally avoid an error if 
-    // undefined variables occur. 
-    // (The GetUsedVar function must suppress the error for
-    // undefined variables in order to collect all variable 
-    // names including the undefined ones.)
-    if ( (m_bIgnoreUndefVar || m_pFactory) && IsUndefVarTok(tok) )  
-      return SaveBeforeReturn(tok);
-
-    // Check for unknown token
-    // 
-    // !!! From this point on there is no exit without an exception possible...
-    // 
-    string_type strTok;
-    int iEnd = ExtractToken(m_pParser->ValidNameChars(), strTok, m_iPos);
-    if (iEnd!=m_iPos)
-      Error(ecUNASSIGNABLE_TOKEN, m_iPos, strTok);
-
-    Error(ecUNASSIGNABLE_TOKEN, m_iPos, m_strFormula.substr(m_iPos));
-    return token_type(); // never reached
-  }
-
-  //---------------------------------------------------------------------------
-  void ParserTokenReader::SetParent(ParserBase *a_pParent)
-  {
-    m_pParser       = a_pParent; 
-    m_pFunDef       = &a_pParent->m_FunDef;
-    m_pOprtDef      = &a_pParent->m_OprtDef;
-    m_pInfixOprtDef = &a_pParent->m_InfixOprtDef;
-    m_pPostOprtDef  = &a_pParent->m_PostOprtDef;
-    m_pVarDef       = &a_pParent->m_VarDef;
-    m_pStrVarDef    = &a_pParent->m_StrVarDef;
-    m_pConstDef     = &a_pParent->m_ConstDef;
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Extract all characters that belong to a certain charset.
-
-    \param a_szCharSet [in] Const char array of the characters allowed in the token. 
-    \param a_strTok [out]  The string that consists entirely of characters listed in a_szCharSet.
-    \param a_iPos [in] Position in the string from where to start reading.
-    \return The Position of the first character not listed in a_szCharSet.
-    \throw nothrow
-  */
-  int ParserTokenReader::ExtractToken(const char_type *a_szCharSet, 
-                                      string_type &a_sTok, 
-                                      int a_iPos) const
-  {
-    int iEnd = (int)m_strFormula.find_first_not_of(a_szCharSet, a_iPos);
-
-    if (iEnd==(int)string_type::npos)
-        iEnd = (int)m_strFormula.length();
-    
-    // Assign token string if there was something found
-    if (a_iPos!=iEnd)
-      a_sTok = string_type( m_strFormula.begin()+a_iPos, m_strFormula.begin()+iEnd);
-
-    return iEnd;
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Check Expression for the presence of a binary operator token.
-  
-    Userdefined binary operator "++" gives inconsistent parsing result for
-    the equations "a++b" and "a ++ b" if alphabetic characters are allowed
-    in operator tokens. To avoid this this function checks specifically
-    for operator tokens.
-  */
-  int ParserTokenReader::ExtractOperatorToken(string_type &a_sTok, 
-                                              int a_iPos) const
-  {
-    // Changed as per Issue 6: https://code.google.com/p/muparser/issues/detail?id=6
-    int iEnd = (int)m_strFormula.find_first_not_of(m_pParser->ValidOprtChars(), a_iPos);
-    if (iEnd==(int)string_type::npos)
-      iEnd = (int)m_strFormula.length();
-
-    // Assign token string if there was something found
-    if (a_iPos!=iEnd)
-    {
-      a_sTok = string_type( m_strFormula.begin() + a_iPos, m_strFormula.begin() + iEnd);
-      return iEnd;
-    }
-    else
-    {
-      // There is still the chance of having to deal with an operator consisting exclusively
-      // of alphabetic characters.
-      return ExtractToken(MUP_CHARS, a_sTok, a_iPos);
-    }
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Check if a built in operator or other token can be found
-      \param a_Tok  [out] Operator token if one is found. This can either be a binary operator or an infix operator token.
-      \return true if an operator token has been found.
-  */
-  bool ParserTokenReader::IsBuiltIn(token_type &a_Tok)
-  {
-    const char_type **const pOprtDef = m_pParser->GetOprtDef(),
-                     *const szFormula = m_strFormula.c_str();
-
-    // Compare token with function and operator strings
-    // check string for operator/function
-    for (int i=0; pOprtDef[i]; i++)
-    {
-      std::size_t len( std::char_traits<char_type>::length(pOprtDef[i]) );
-      if ( string_type(pOprtDef[i]) == string_type(szFormula + m_iPos, szFormula + m_iPos + len) )
-      {
-        switch(i)
-        {
-        //case cmAND:
-        //case cmOR:
-        //case cmXOR:
-        case cmLAND:
-        case cmLOR:
-        case cmLT:
-        case cmGT:
-        case cmLE:
-        case cmGE:
-        case cmNEQ:  
-        case cmEQ:
-        case cmADD:
-        case cmSUB:
-        case cmMUL:
-        case cmDIV:
-        case cmPOW:
-        case cmASSIGN:
-              //if (len!=sTok.length())
-              //  continue;
-
-              // The assignment operator need special treatment
-              if (i==cmASSIGN && m_iSynFlags & noASSIGN)
-                Error(ecUNEXPECTED_OPERATOR, m_iPos, pOprtDef[i]);
-
-              if (!m_pParser->HasBuiltInOprt()) continue;
-              if (m_iSynFlags & noOPT) 
-              {
-                // Maybe its an infix operator not an operator
-                // Both operator types can share characters in 
-                // their identifiers
-                if ( IsInfixOpTok(a_Tok) ) 
-                  return true;
-
-                Error(ecUNEXPECTED_OPERATOR, m_iPos, pOprtDef[i]);
-              }
-
-              m_iSynFlags  = noBC | noOPT | noARG_SEP | noPOSTOP | noASSIGN | noIF | noELSE | noEND;
-              break;
-
-		    case cmBO:
-              if (m_iSynFlags & noBO)
-	              Error(ecUNEXPECTED_PARENS, m_iPos, pOprtDef[i]);
-              
-              if (m_lastTok.GetCode()==cmFUNC)
-                m_iSynFlags = noOPT | noEND | noARG_SEP | noPOSTOP | noASSIGN | noIF | noELSE;
-              else
-                m_iSynFlags = noBC | noOPT | noEND | noARG_SEP | noPOSTOP | noASSIGN| noIF | noELSE;
-
-              ++m_iBrackets;
-              break;
-
-		    case cmBC:
-              if (m_iSynFlags & noBC)
-                Error(ecUNEXPECTED_PARENS, m_iPos, pOprtDef[i]);
-
-              m_iSynFlags  = noBO | noVAR | noVAL | noFUN | noINFIXOP | noSTR | noASSIGN;
-
-              if (--m_iBrackets<0)
-                Error(ecUNEXPECTED_PARENS, m_iPos, pOprtDef[i]);
-              break;
-
-        case cmELSE:
-              if (m_iSynFlags & noELSE)
-                Error(ecUNEXPECTED_CONDITIONAL, m_iPos, pOprtDef[i]);
-
-              m_iSynFlags = noBC | noPOSTOP | noEND | noOPT | noIF | noELSE;
-              break;
-
-        case cmIF:
-              if (m_iSynFlags & noIF)
-                Error(ecUNEXPECTED_CONDITIONAL, m_iPos, pOprtDef[i]);
-
-              m_iSynFlags = noBC | noPOSTOP | noEND | noOPT | noIF | noELSE;
-              break;
-
-		    default:      // The operator is listed in c_DefaultOprt, but not here. This is a bad thing...
-              Error(ecINTERNAL_ERROR);
-        } // switch operator id
-
-        m_iPos += (int)len;
-        a_Tok.Set( (ECmdCode)i, pOprtDef[i] );
-        return true;
-	    } // if operator string found
-    } // end of for all operator strings
-  
-    return false;
-  }
-
-  //---------------------------------------------------------------------------
-  bool ParserTokenReader::IsArgSep(token_type &a_Tok)
-  {
-    const char_type* szFormula = m_strFormula.c_str();
-
-    if (szFormula[m_iPos]==m_cArgSep)
-    {
-      // copy the separator into null terminated string
-      char_type szSep[2];
-      szSep[0] = m_cArgSep;
-      szSep[1] = 0;
-
-      if (m_iSynFlags & noARG_SEP)
-        Error(ecUNEXPECTED_ARG_SEP, m_iPos, szSep);
-
-      m_iSynFlags  = noBC | noOPT | noEND | noARG_SEP | noPOSTOP | noASSIGN;
-      m_iPos++;
-      a_Tok.Set(cmARG_SEP, szSep);
-      return true;
-    }
-
-    return false;
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Check for End of Formula.
-
-      \return true if an end of formula is found false otherwise.
-      \param a_Tok [out] If an eof is found the corresponding token will be stored there.
-      \throw nothrow
-      \sa IsOprt, IsFunTok, IsStrFunTok, IsValTok, IsVarTok, IsString, IsInfixOpTok, IsPostOpTok
-  */
-  bool ParserTokenReader::IsEOF(token_type &a_Tok)
-  {
-    const char_type* szFormula = m_strFormula.c_str();
-
-    // check for EOF
-    if ( !szFormula[m_iPos] /*|| szFormula[m_iPos] == '\n'*/)
-    {
-      if ( m_iSynFlags & noEND )
-        Error(ecUNEXPECTED_EOF, m_iPos);
-
-      if (m_iBrackets>0)
-        Error(ecMISSING_PARENS, m_iPos, _T(")"));
-
-      m_iSynFlags = 0;
-      a_Tok.Set(cmEND);
-      return true;
-    }
-
-    return false;
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Check if a string position contains a unary infix operator. 
-      \return true if a function token has been found false otherwise.
-  */
-  bool ParserTokenReader::IsInfixOpTok(token_type &a_Tok)
-  {
-    string_type sTok;
-    int iEnd = ExtractToken(m_pParser->ValidInfixOprtChars(), sTok, m_iPos);
-    if (iEnd==m_iPos)
-      return false;
-
-    // iterate over all postfix operator strings
-    funmap_type::const_reverse_iterator it = m_pInfixOprtDef->rbegin();
-    for ( ; it!=m_pInfixOprtDef->rend(); ++it)
-    {
-      if (sTok.find(it->first)!=0)
-        continue;
-
-      a_Tok.Set(it->second, it->first);
-      m_iPos += (int)it->first.length();
-
-      if (m_iSynFlags & noINFIXOP) 
-        Error(ecUNEXPECTED_OPERATOR, m_iPos, a_Tok.GetAsString());
-
-      m_iSynFlags = noPOSTOP | noINFIXOP | noOPT | noBC | noSTR | noASSIGN;
-      return true;
-    }
-
-    return false;
-
-/*
-    a_Tok.Set(item->second, sTok);
-    m_iPos = (int)iEnd;
-
-    if (m_iSynFlags & noINFIXOP) 
-      Error(ecUNEXPECTED_OPERATOR, m_iPos, a_Tok.GetAsString());
-
-    m_iSynFlags = noPOSTOP | noINFIXOP | noOPT | noBC | noSTR | noASSIGN; 
-    return true;
-*/
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Check whether the token at a given position is a function token.
-      \param a_Tok [out] If a value token is found it will be placed here.
-      \throw ParserException if Syntaxflags do not allow a function at a_iPos
-      \return true if a function token has been found false otherwise.
-      \pre [assert] m_pParser!=0
-  */
-  bool ParserTokenReader::IsFunTok(token_type &a_Tok)
-  {
-    string_type strTok;
-    int iEnd = ExtractToken(m_pParser->ValidNameChars(), strTok, m_iPos);
-    if (iEnd==m_iPos)
-      return false;
-
-    funmap_type::const_iterator item = m_pFunDef->find(strTok);
-    if (item==m_pFunDef->end())
-      return false;
-
-    // Check if the next sign is an opening bracket
-    const char_type *szFormula = m_strFormula.c_str();
-    if (szFormula[iEnd]!='(')
-      return false;
-
-    a_Tok.Set(item->second, strTok);
-
-    m_iPos = (int)iEnd;
-    if (m_iSynFlags & noFUN)
-      Error(ecUNEXPECTED_FUN, m_iPos-(int)a_Tok.GetAsString().length(), a_Tok.GetAsString());
-
-    m_iSynFlags = noANY ^ noBO;
-    return true;
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Check if a string position contains a binary operator.
-      \param a_Tok  [out] Operator token if one is found. This can either be a binary operator or an infix operator token.
-      \return true if an operator token has been found.
-  */
-  bool ParserTokenReader::IsOprt(token_type &a_Tok)
-  {
-    const char_type *const szExpr = m_strFormula.c_str();
-    string_type strTok;
-
-    int iEnd = ExtractOperatorToken(strTok, m_iPos);
-    if (iEnd==m_iPos)
-      return false;
-
-    // Check if the operator is a built in operator, if so ignore it here
-    const char_type **const pOprtDef = m_pParser->GetOprtDef();
-    for (int i=0; m_pParser->HasBuiltInOprt() && pOprtDef[i]; ++i)
-    {
-      if (string_type(pOprtDef[i])==strTok)
-        return false;
-    }
-
-    // Note:
-    // All tokens in oprt_bin_maptype are have been sorted by their length
-    // Long operators must come first! Otherwise short names (like: "add") that
-    // are part of long token names (like: "add123") will be found instead 
-    // of the long ones.
-    // Length sorting is done with ascending length so we use a reverse iterator here.
-    funmap_type::const_reverse_iterator it = m_pOprtDef->rbegin();
-    for ( ; it!=m_pOprtDef->rend(); ++it)
-    {
-      const string_type &sID = it->first;
-      if ( sID == string_type(szExpr + m_iPos, szExpr + m_iPos + sID.length()) )
-      {
-        a_Tok.Set(it->second, strTok);
-
-        // operator was found
-        if (m_iSynFlags & noOPT) 
-        {
-          // An operator was found but is not expected to occur at
-          // this position of the formula, maybe it is an infix 
-          // operator, not a binary operator. Both operator types
-          // can share characters in their identifiers.
-          if ( IsInfixOpTok(a_Tok) ) 
-            return true;
-          else
-          {
-            // nope, no infix operator
-            return false;
-            //Error(ecUNEXPECTED_OPERATOR, m_iPos, a_Tok.GetAsString()); 
-          }
-
-        }
-
-        m_iPos += (int)sID.length();
-        m_iSynFlags  = noBC | noOPT | noARG_SEP | noPOSTOP | noEND | noASSIGN;
-        return true;
-      }
-    }
-
-    return false;
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Check if a string position contains a unary post value operator. */
-  bool ParserTokenReader::IsPostOpTok(token_type &a_Tok)
-  {
-    // <ibg 20110629> Do not check for postfix operators if they are not allowed at
-    //                the current expression index.
-    //
-    //  This will fix the bug reported here:  
-    //
-    //  http://sourceforge.net/tracker/index.php?func=detail&aid=3343891&group_id=137191&atid=737979
-    //
-    if (m_iSynFlags & noPOSTOP)
-      return false;
-    // </ibg>
-
-    // Tricky problem with equations like "3m+5":
-    //     m is a postfix operator, + is a valid sign for postfix operators and 
-    //     for binary operators parser detects "m+" as operator string and 
-    //     finds no matching postfix operator.
-    // 
-    // This is a special case so this routine slightly differs from the other
-    // token readers.
-    
-    // Test if there could be a postfix operator
-    string_type sTok;
-    int iEnd = ExtractToken(m_pParser->ValidOprtChars(), sTok, m_iPos);
-    if (iEnd==m_iPos)
-      return false;
-
-    // iterate over all postfix operator strings
-    funmap_type::const_reverse_iterator it = m_pPostOprtDef->rbegin();
-    for ( ; it!=m_pPostOprtDef->rend(); ++it)
-    {
-      if (sTok.find(it->first)!=0)
-        continue;
-
-      a_Tok.Set(it->second, sTok);
-  	  m_iPos += (int)it->first.length();
-
-      m_iSynFlags = noVAL | noVAR | noFUN | noBO | noPOSTOP | noSTR | noASSIGN;
-      return true;
-    }
-
-    return false;
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Check whether the token at a given position is a value token.
-
-    Value tokens are either values or constants.
-
-    \param a_Tok [out] If a value token is found it will be placed here.
-    \return true if a value token has been found.
-  */
-  bool ParserTokenReader::IsValTok(token_type &a_Tok)
-  {
-    assert(m_pConstDef);
-    assert(m_pParser);
-
-    string_type strTok;
-    value_type fVal(0);
-    int iEnd(0);
-    
-    // 2.) Check for user defined constant
-    // Read everything that could be a constant name
-    iEnd = ExtractToken(m_pParser->ValidNameChars(), strTok, m_iPos);
-    if (iEnd!=m_iPos)
-    {
-      valmap_type::const_iterator item = m_pConstDef->find(strTok);
-      if (item!=m_pConstDef->end())
-      {
-        m_iPos = iEnd;
-        a_Tok.SetVal(item->second, strTok);
-
-        if (m_iSynFlags & noVAL)
-          Error(ecUNEXPECTED_VAL, m_iPos - (int)strTok.length(), strTok);
-
-        m_iSynFlags = noVAL | noVAR | noFUN | noBO | noINFIXOP | noSTR | noASSIGN; 
-        return true;
-      }
-    }
-
-    // 3.call the value recognition functions provided by the user
-    // Call user defined value recognition functions
-    std::list<identfun_type>::const_iterator item = m_vIdentFun.begin();
-    for (item = m_vIdentFun.begin(); item!=m_vIdentFun.end(); ++item)
-    {
-      int iStart = m_iPos;
-      if ( (*item)(m_strFormula.c_str() + m_iPos, &m_iPos, &fVal)==1 )
-      {
-        // 2013-11-27 Issue 2:  https://code.google.com/p/muparser/issues/detail?id=2
-        strTok.assign(m_strFormula.c_str(), iStart, m_iPos-iStart);
-
-        if (m_iSynFlags & noVAL)
-          Error(ecUNEXPECTED_VAL, m_iPos - (int)strTok.length(), strTok);
-
-        a_Tok.SetVal(fVal, strTok);
-        m_iSynFlags = noVAL | noVAR | noFUN | noBO | noINFIXOP | noSTR | noASSIGN;
-        return true;
-      }
-    }
-
-    return false;
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Check wheter a token at a given position is a variable token. 
-      \param a_Tok [out] If a variable token has been found it will be placed here.
-	    \return true if a variable token has been found.
-  */
-  bool ParserTokenReader::IsVarTok(token_type &a_Tok)
-  {
-    if (m_pVarDef->empty())
-      return false;
-
-    string_type strTok;
-    int iEnd = ExtractToken(m_pParser->ValidNameChars(), strTok, m_iPos);
-    if (iEnd==m_iPos)
-      return false;
-
-    varmap_type::const_iterator item =  m_pVarDef->find(strTok);
-    if (item==m_pVarDef->end())
-      return false;
-
-    if (m_iSynFlags & noVAR)
-      Error(ecUNEXPECTED_VAR, m_iPos, strTok);
-
-    m_pParser->OnDetectVar(&m_strFormula, m_iPos, iEnd);
-
-    m_iPos = iEnd;
-    a_Tok.SetVar(item->second, strTok);
-    m_UsedVar[item->first] = item->second;  // Add variable to used-var-list
-
-    m_iSynFlags = noVAL | noVAR | noFUN | noBO | noINFIXOP | noSTR;
-
-//  Zur Info hier die SynFlags von IsVal():
-//    m_iSynFlags = noVAL | noVAR | noFUN | noBO | noINFIXOP | noSTR | noASSIGN; 
-    return true;
-  }
-
-  //---------------------------------------------------------------------------
-  bool ParserTokenReader::IsStrVarTok(token_type &a_Tok)
-  {
-    if (!m_pStrVarDef || m_pStrVarDef->empty())
-      return false;
-
-    string_type strTok;
-    int iEnd = ExtractToken(m_pParser->ValidNameChars(), strTok, m_iPos);
-    if (iEnd==m_iPos)
-      return false;
-
-    strmap_type::const_iterator item =  m_pStrVarDef->find(strTok);
-    if (item==m_pStrVarDef->end())
-      return false;
-
-    if (m_iSynFlags & noSTR)
-      Error(ecUNEXPECTED_VAR, m_iPos, strTok);
-
-    m_iPos = iEnd;
-    if (!m_pParser->m_vStringVarBuf.size())
-      Error(ecINTERNAL_ERROR);
-
-    a_Tok.SetString(m_pParser->m_vStringVarBuf[item->second], m_pParser->m_vStringVarBuf.size() );
-
-    m_iSynFlags = noANY ^ ( noBC | noOPT | noEND | noARG_SEP);
-    return true;
-  }
-
-
-  //---------------------------------------------------------------------------
-  /** \brief Check wheter a token at a given position is an undefined variable. 
-
-      \param a_Tok [out] If a variable tom_pParser->m_vStringBufken has been found it will be placed here.
-	    \return true if a variable token has been found.
-      \throw nothrow
-  */
-  bool ParserTokenReader::IsUndefVarTok(token_type &a_Tok)
-  {
-    string_type strTok;
-    int iEnd( ExtractToken(m_pParser->ValidNameChars(), strTok, m_iPos) );
-    if ( iEnd==m_iPos )
-      return false;
-
-    if (m_iSynFlags & noVAR)
-    {
-      // <ibg/> 20061021 added token string strTok instead of a_Tok.GetAsString() as the 
-      //                 token identifier. 
-      // related bug report:
-      // http://sourceforge.net/tracker/index.php?func=detail&aid=1578779&group_id=137191&atid=737979
-      Error(ecUNEXPECTED_VAR, m_iPos - (int)a_Tok.GetAsString().length(), strTok);
-    }
-
-    // If a factory is available implicitely create new variables
-    if (m_pFactory)
-    {
-      value_type *fVar = m_pFactory(strTok.c_str(), m_pFactoryData);
-      a_Tok.SetVar(fVar, strTok );
-
-      // Do not use m_pParser->DefineVar( strTok, fVar );
-      // in order to define the new variable, it will clear the
-      // m_UsedVar array which will kill previously defined variables
-      // from the list
-      // This is safe because the new variable can never override an existing one
-      // because they are checked first!
-      (*m_pVarDef)[strTok] = fVar;
-      m_UsedVar[strTok] = fVar;  // Add variable to used-var-list
-    }
-    else
-    {
-      a_Tok.SetVar((value_type*)&m_fZero, strTok);
-      m_UsedVar[strTok] = 0;  // Add variable to used-var-list
-    }
-
-    m_iPos = iEnd;
-
-    // Call the variable factory in order to let it define a new parser variable
-    m_iSynFlags = noVAL | noVAR | noFUN | noBO | noPOSTOP | noINFIXOP | noSTR;
-    return true;
-  }
-
-
-  //---------------------------------------------------------------------------
-  /** \brief Check wheter a token at a given position is a string.
-      \param a_Tok [out] If a variable token has been found it will be placed here.
-  	  \return true if a string token has been found.
-      \sa IsOprt, IsFunTok, IsStrFunTok, IsValTok, IsVarTok, IsEOF, IsInfixOpTok, IsPostOpTok
-      \throw nothrow
-  */
-  bool ParserTokenReader::IsString(token_type &a_Tok)
-  {
-    if (m_strFormula[m_iPos]!='"') 
-      return false;
-
-    string_type strBuf(&m_strFormula[m_iPos+1]);
-    std::size_t iEnd(0), iSkip(0);
-
-    // parser over escaped '\"' end replace them with '"'
-    for(iEnd=(int)strBuf.find( _T("\"") ); iEnd!=0 && iEnd!=string_type::npos; iEnd=(int)strBuf.find( _T("\""), iEnd))
-    {
-      if (strBuf[iEnd-1]!='\\') break;
-      strBuf.replace(iEnd-1, 2, _T("\"") );
-      iSkip++;
-    }
-
-    if (iEnd==string_type::npos)
-      Error(ecUNTERMINATED_STRING, m_iPos, _T("\"") );
-
-    string_type strTok(strBuf.begin(), strBuf.begin()+iEnd);
-
-    if (m_iSynFlags & noSTR)
-      Error(ecUNEXPECTED_STR, m_iPos, strTok);
-
-		m_pParser->m_vStringBuf.push_back(strTok); // Store string in internal buffer
-    a_Tok.SetString(strTok, m_pParser->m_vStringBuf.size());
-
-    m_iPos += (int)strTok.length() + 2 + (int)iSkip;  // +2 wg Anführungszeichen; +iSkip für entfernte escape zeichen
-    m_iSynFlags = noANY ^ ( noARG_SEP | noBC | noOPT | noEND );
-
-    return true;
-  }
-
-  //---------------------------------------------------------------------------
-  /** \brief Create an error containing the parse error position.
-
-    This function will create an Parser Exception object containing the error text and its position.
-
-    \param a_iErrc [in] The error code of type #EErrorCodes.
-    \param a_iPos [in] The position where the error was detected.
-    \param a_strTok [in] The token string representation associated with the error.
-    \throw ParserException always throws thats the only purpose of this function.
-  */
-  void  ParserTokenReader::Error( EErrorCodes a_iErrc, 
-                                  int a_iPos, 
-                                  const string_type &a_sTok) const
-  {
-    m_pParser->Error(a_iErrc, a_iPos, a_sTok);
-  }
-
-  //---------------------------------------------------------------------------
-  void ParserTokenReader::SetArgSep(char_type cArgSep)
-  {
-    m_cArgSep = cArgSep;
-  }
-
-  //---------------------------------------------------------------------------
-  char_type ParserTokenReader::GetArgSep() const
-  {
-    return m_cArgSep;
-  }
-} // namespace mu
-
+/*
+                 __________
+    _____   __ __\______   \_____  _______  ______  ____ _______
+   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
+  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
+  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|
+        \/                       \/            \/      \/
+  Copyright (C) 2013 Ingo Berg
+
+  Permission is hereby granted, free of charge, to any person obtaining a copy of this
+  software and associated documentation files (the "Software"), to deal in the Software
+  without restriction, including without limitation the rights to use, copy, modify,
+  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
+  permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included in all copies or
+  substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
+  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#include <cassert>
+#include <cstdio>
+#include <cstring>
+#include <map>
+#include <stack>
+#include <string>
+
+#include "muParserTokenReader.h"
+#include "muParserBase.h"
+
+/** \file
+    \brief This file contains the parser token reader implementation.
+*/
+
+
+namespace mu
+{
+
+  // Forward declaration
+  class ParserBase;
+
+  //---------------------------------------------------------------------------
+  /** \brief Copy constructor.
+
+      \sa Assign
+      \throw nothrow
+  */
+  ParserTokenReader::ParserTokenReader(const ParserTokenReader &a_Reader)
+  {
+    Assign(a_Reader);
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Assignment operator.
+
+      Self assignment will be suppressed otherwise #Assign is called.
+
+      \param a_Reader Object to copy to this token reader.
+      \throw nothrow
+  */
+  ParserTokenReader& ParserTokenReader::operator=(const ParserTokenReader &a_Reader)
+  {
+    if (&a_Reader!=this)
+      Assign(a_Reader);
+
+    return *this;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Assign state of a token reader to this token reader.
+
+      \param a_Reader Object from which the state should be copied.
+      \throw nothrow
+  */
+  void ParserTokenReader::Assign(const ParserTokenReader &a_Reader)
+  {
+    m_pParser = a_Reader.m_pParser;
+    m_strFormula = a_Reader.m_strFormula;
+    m_iPos = a_Reader.m_iPos;
+    m_iSynFlags = a_Reader.m_iSynFlags;
+
+    m_UsedVar         = a_Reader.m_UsedVar;
+    m_pFunDef         = a_Reader.m_pFunDef;
+    m_pConstDef       = a_Reader.m_pConstDef;
+    m_pVarDef         = a_Reader.m_pVarDef;
+    m_pStrVarDef      = a_Reader.m_pStrVarDef;
+    m_pPostOprtDef    = a_Reader.m_pPostOprtDef;
+    m_pInfixOprtDef   = a_Reader.m_pInfixOprtDef;
+    m_pOprtDef        = a_Reader.m_pOprtDef;
+    m_bIgnoreUndefVar = a_Reader.m_bIgnoreUndefVar;
+    m_vIdentFun       = a_Reader.m_vIdentFun;
+    m_pFactory        = a_Reader.m_pFactory;
+    m_pFactoryData    = a_Reader.m_pFactoryData;
+    m_iBrackets       = a_Reader.m_iBrackets;
+    m_cArgSep         = a_Reader.m_cArgSep;
+	m_fZero           = a_Reader.m_fZero;
+	m_lastTok         = a_Reader.m_lastTok;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Constructor.
+
+      Create a Token reader and bind it to a parser object.
+
+      \pre [assert] a_pParser may not be NULL
+      \post #m_pParser==a_pParser
+      \param a_pParent Parent parser object of the token reader.
+  */
+  ParserTokenReader::ParserTokenReader(ParserBase *a_pParent)
+    :m_pParser(a_pParent)
+    ,m_strFormula()
+    ,m_iPos(0)
+    ,m_iSynFlags(0)
+    ,m_bIgnoreUndefVar(false)
+    ,m_pFunDef(NULL)
+    ,m_pPostOprtDef(NULL)
+    ,m_pInfixOprtDef(NULL)
+    ,m_pOprtDef(NULL)
+    ,m_pConstDef(NULL)
+    ,m_pStrVarDef(NULL)
+    ,m_pVarDef(NULL)
+    ,m_pFactory(NULL)
+    ,m_pFactoryData(NULL)
+    ,m_vIdentFun()
+    ,m_UsedVar()
+    ,m_fZero(0)
+    ,m_iBrackets(0)
+    ,m_lastTok()
+    ,m_cArgSep(',')
+  {
+    assert(m_pParser);
+    SetParent(m_pParser);
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Create instance of a ParserTokenReader identical with this
+              and return its pointer.
+
+      This is a factory method the calling function must take care of the object destruction.
+
+      \return A new ParserTokenReader object.
+      \throw nothrow
+  */
+  ParserTokenReader* ParserTokenReader::Clone(ParserBase *a_pParent) const
+  {
+    std::auto_ptr<ParserTokenReader> ptr(new ParserTokenReader(*this));
+    ptr->SetParent(a_pParent);
+    return ptr.release();
+  }
+
+  //---------------------------------------------------------------------------
+  ParserTokenReader::token_type& ParserTokenReader::SaveBeforeReturn(const token_type &tok)
+  {
+    m_lastTok = tok;
+    return m_lastTok;
+  }
+
+  //---------------------------------------------------------------------------
+  void ParserTokenReader::AddValIdent(identfun_type a_pCallback)
+  {
+    // Use push_front is used to give user defined callbacks a higher priority than
+    // the built in ones. Otherwise reading hex numbers would not work
+    // since the "0" in "0xff" would always be read first making parsing of
+    // the rest impossible.
+    // reference:
+    // http://sourceforge.net/projects/muparser/forums/forum/462843/topic/4824956
+    m_vIdentFun.push_front(a_pCallback);
+  }
+
+  //---------------------------------------------------------------------------
+  void ParserTokenReader::SetVarCreator(facfun_type a_pFactory, void *pUserData)
+  {
+    m_pFactory = a_pFactory;
+    m_pFactoryData = pUserData;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Return the current position of the token reader in the formula string.
+
+      \return #m_iPos
+      \throw nothrow
+  */
+  int ParserTokenReader::GetPos() const
+  {
+    return m_iPos;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Return a reference to the formula.
+
+      \return #m_strFormula
+      \throw nothrow
+  */
+  const string_type& ParserTokenReader::GetExpr() const
+  {
+    return m_strFormula;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Return a map containing the used variables only. */
+  varmap_type& ParserTokenReader::GetUsedVar()
+  {
+    return m_UsedVar;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Initialize the token Reader.
+
+      Sets the formula position index to zero and set Syntax flags to default for initial formula parsing.
+      \pre [assert] triggered if a_szFormula==0
+  */
+  void ParserTokenReader::SetFormula(const string_type &a_strFormula)
+  {
+    m_strFormula = a_strFormula;
+    ReInit();
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Set Flag that controls behaviour in case of undefined variables being found.
+
+    If true, the parser does not throw an exception if an undefined variable is found.
+    otherwise it does. This variable is used internally only!
+    It suppresses a "undefined variable" exception in GetUsedVar().
+    Those function should return a complete list of variables including
+    those the are not defined by the time of it's call.
+  */
+  void ParserTokenReader::IgnoreUndefVar(bool bIgnore)
+  {
+    m_bIgnoreUndefVar = bIgnore;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Reset the token reader to the start of the formula.
+
+      The syntax flags will be reset to a value appropriate for the
+      start of a formula.
+      \post #m_iPos==0, #m_iSynFlags = noOPT | noBC | noPOSTOP | noSTR
+      \throw nothrow
+      \sa ESynCodes
+  */
+  void ParserTokenReader::ReInit()
+  {
+    m_iPos = 0;
+    m_iSynFlags = sfSTART_OF_LINE;
+    m_iBrackets = 0;
+    m_UsedVar.clear();
+    m_lastTok = token_type();
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Read the next token from the string. */
+  ParserTokenReader::token_type ParserTokenReader::ReadNextToken()
+  {
+    assert(m_pParser);
+
+    const char_type *szFormula = m_strFormula.c_str();
+    token_type tok;
+
+    // Ignore all non printable characters when reading the expression
+    while (szFormula[m_iPos]>0 && szFormula[m_iPos]<=0x20)
+      ++m_iPos;
+
+    if ( IsEOF(tok) )        return SaveBeforeReturn(tok); // Check for end of formula
+    if ( IsOprt(tok) )       return SaveBeforeReturn(tok); // Check for user defined binary operator
+    if ( IsFunTok(tok) )     return SaveBeforeReturn(tok); // Check for function token
+    if ( IsBuiltIn(tok) )    return SaveBeforeReturn(tok); // Check built in operators / tokens
+    if ( IsArgSep(tok) )     return SaveBeforeReturn(tok); // Check for function argument separators
+    if ( IsValTok(tok) )     return SaveBeforeReturn(tok); // Check for values / constant tokens
+    if ( IsVarTok(tok) )     return SaveBeforeReturn(tok); // Check for variable tokens
+    if ( IsStrVarTok(tok) )  return SaveBeforeReturn(tok); // Check for string variables
+    if ( IsString(tok) )     return SaveBeforeReturn(tok); // Check for String tokens
+    if ( IsInfixOpTok(tok) ) return SaveBeforeReturn(tok); // Check for unary operators
+    if ( IsPostOpTok(tok) )  return SaveBeforeReturn(tok); // Check for unary operators
+
+    // Check String for undefined variable token. Done only if a
+    // flag is set indicating to ignore undefined variables.
+    // This is a way to conditionally avoid an error if
+    // undefined variables occur.
+    // (The GetUsedVar function must suppress the error for
+    // undefined variables in order to collect all variable
+    // names including the undefined ones.)
+    if ( (m_bIgnoreUndefVar || m_pFactory) && IsUndefVarTok(tok) )
+      return SaveBeforeReturn(tok);
+
+    // Check for unknown token
+    //
+    // !!! From this point on there is no exit without an exception possible...
+    //
+    string_type strTok;
+    int iEnd = ExtractToken(m_pParser->ValidNameChars(), strTok, m_iPos);
+    if (iEnd!=m_iPos)
+      Error(ecUNASSIGNABLE_TOKEN, m_iPos, strTok);
+
+    Error(ecUNASSIGNABLE_TOKEN, m_iPos, m_strFormula.substr(m_iPos));
+    return token_type(); // never reached
+  }
+
+  //---------------------------------------------------------------------------
+  void ParserTokenReader::SetParent(ParserBase *a_pParent)
+  {
+    m_pParser       = a_pParent;
+    m_pFunDef       = &a_pParent->m_FunDef;
+    m_pOprtDef      = &a_pParent->m_OprtDef;
+    m_pInfixOprtDef = &a_pParent->m_InfixOprtDef;
+    m_pPostOprtDef  = &a_pParent->m_PostOprtDef;
+    m_pVarDef       = &a_pParent->m_VarDef;
+    m_pStrVarDef    = &a_pParent->m_StrVarDef;
+    m_pConstDef     = &a_pParent->m_ConstDef;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Extract all characters that belong to a certain charset.
+
+    \param a_szCharSet [in] Const char array of the characters allowed in the token.
+    \param a_strTok [out]  The string that consists entirely of characters listed in a_szCharSet.
+    \param a_iPos [in] Position in the string from where to start reading.
+    \return The Position of the first character not listed in a_szCharSet.
+    \throw nothrow
+  */
+  int ParserTokenReader::ExtractToken(const char_type *a_szCharSet,
+                                      string_type &a_sTok,
+                                      int a_iPos) const
+  {
+    int iEnd = (int)m_strFormula.find_first_not_of(a_szCharSet, a_iPos);
+
+    if (iEnd==(int)string_type::npos)
+        iEnd = (int)m_strFormula.length();
+
+    // Assign token string if there was something found
+    if (a_iPos!=iEnd)
+      a_sTok = string_type( m_strFormula.begin()+a_iPos, m_strFormula.begin()+iEnd);
+
+    return iEnd;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Check Expression for the presence of a binary operator token.
+
+    Userdefined binary operator "++" gives inconsistent parsing result for
+    the equations "a++b" and "a ++ b" if alphabetic characters are allowed
+    in operator tokens. To avoid this this function checks specifically
+    for operator tokens.
+  */
+  int ParserTokenReader::ExtractOperatorToken(string_type &a_sTok,
+                                              int a_iPos) const
+  {
+    // Changed as per Issue 6: https://code.google.com/p/muparser/issues/detail?id=6
+    int iEnd = (int)m_strFormula.find_first_not_of(m_pParser->ValidOprtChars(), a_iPos);
+    if (iEnd==(int)string_type::npos)
+      iEnd = (int)m_strFormula.length();
+
+    // Assign token string if there was something found
+    if (a_iPos!=iEnd)
+    {
+      a_sTok = string_type( m_strFormula.begin() + a_iPos, m_strFormula.begin() + iEnd);
+      return iEnd;
+    }
+    else
+    {
+      // There is still the chance of having to deal with an operator consisting exclusively
+      // of alphabetic characters.
+      return ExtractToken(MUP_CHARS, a_sTok, a_iPos);
+    }
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Check if a built in operator or other token can be found
+      \param a_Tok  [out] Operator token if one is found. This can either be a binary operator or an infix operator token.
+      \return true if an operator token has been found.
+  */
+  bool ParserTokenReader::IsBuiltIn(token_type &a_Tok)
+  {
+    const char_type **const pOprtDef = m_pParser->GetOprtDef(),
+                     *const szFormula = m_strFormula.c_str();
+
+    // Compare token with function and operator strings
+    // check string for operator/function
+    for (int i=0; pOprtDef[i]; i++)
+    {
+      std::size_t len( std::char_traits<char_type>::length(pOprtDef[i]) );
+      if ( string_type(pOprtDef[i]) == string_type(szFormula + m_iPos, szFormula + m_iPos + len) )
+      {
+        switch(i)
+        {
+        //case cmAND:
+        //case cmOR:
+        //case cmXOR:
+        case cmLAND:
+        case cmLOR:
+        case cmLT:
+        case cmGT:
+        case cmLE:
+        case cmGE:
+        case cmNEQ:
+        case cmEQ:
+        case cmADD:
+        case cmSUB:
+        case cmMUL:
+        case cmDIV:
+        case cmPOW:
+        case cmASSIGN:
+              //if (len!=sTok.length())
+              //  continue;
+
+              // The assignment operator need special treatment
+              if (i==cmASSIGN && m_iSynFlags & noASSIGN)
+                Error(ecUNEXPECTED_OPERATOR, m_iPos, pOprtDef[i]);
+
+              if (!m_pParser->HasBuiltInOprt()) continue;
+              if (m_iSynFlags & noOPT)
+              {
+                // Maybe its an infix operator not an operator
+                // Both operator types can share characters in
+                // their identifiers
+                if ( IsInfixOpTok(a_Tok) )
+                  return true;
+
+                Error(ecUNEXPECTED_OPERATOR, m_iPos, pOprtDef[i]);
+              }
+
+              m_iSynFlags  = noBC | noOPT | noARG_SEP | noPOSTOP | noASSIGN | noIF | noELSE | noEND;
+              break;
+
+		    case cmBO:
+              if (m_iSynFlags & noBO)
+	              Error(ecUNEXPECTED_PARENS, m_iPos, pOprtDef[i]);
+
+              if (m_lastTok.GetCode()==cmFUNC)
+                m_iSynFlags = noOPT | noEND | noARG_SEP | noPOSTOP | noASSIGN | noIF | noELSE;
+              else
+                m_iSynFlags = noBC | noOPT | noEND | noARG_SEP | noPOSTOP | noASSIGN| noIF | noELSE;
+
+              ++m_iBrackets;
+              break;
+
+		    case cmBC:
+              if (m_iSynFlags & noBC)
+                Error(ecUNEXPECTED_PARENS, m_iPos, pOprtDef[i]);
+
+              m_iSynFlags  = noBO | noVAR | noVAL | noFUN | noINFIXOP | noSTR | noASSIGN;
+
+              if (--m_iBrackets<0)
+                Error(ecUNEXPECTED_PARENS, m_iPos, pOprtDef[i]);
+              break;
+
+        case cmELSE:
+              if (m_iSynFlags & noELSE)
+                Error(ecUNEXPECTED_CONDITIONAL, m_iPos, pOprtDef[i]);
+
+              m_iSynFlags = noBC | noPOSTOP | noEND | noOPT | noIF | noELSE;
+              break;
+
+        case cmIF:
+              if (m_iSynFlags & noIF)
+                Error(ecUNEXPECTED_CONDITIONAL, m_iPos, pOprtDef[i]);
+
+              m_iSynFlags = noBC | noPOSTOP | noEND | noOPT | noIF | noELSE;
+              break;
+
+		    default:      // The operator is listed in c_DefaultOprt, but not here. This is a bad thing...
+              Error(ecINTERNAL_ERROR);
+        } // switch operator id
+
+        m_iPos += (int)len;
+        a_Tok.Set( (ECmdCode)i, pOprtDef[i] );
+        return true;
+	    } // if operator string found
+    } // end of for all operator strings
+
+    return false;
+  }
+
+  //---------------------------------------------------------------------------
+  bool ParserTokenReader::IsArgSep(token_type &a_Tok)
+  {
+    const char_type* szFormula = m_strFormula.c_str();
+
+    if (szFormula[m_iPos]==m_cArgSep)
+    {
+      // copy the separator into null terminated string
+      char_type szSep[2];
+      szSep[0] = m_cArgSep;
+      szSep[1] = 0;
+
+      if (m_iSynFlags & noARG_SEP)
+        Error(ecUNEXPECTED_ARG_SEP, m_iPos, szSep);
+
+      m_iSynFlags  = noBC | noOPT | noEND | noARG_SEP | noPOSTOP | noASSIGN;
+      m_iPos++;
+      a_Tok.Set(cmARG_SEP, szSep);
+      return true;
+    }
+
+    return false;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Check for End of Formula.
+
+      \return true if an end of formula is found false otherwise.
+      \param a_Tok [out] If an eof is found the corresponding token will be stored there.
+      \throw nothrow
+      \sa IsOprt, IsFunTok, IsStrFunTok, IsValTok, IsVarTok, IsString, IsInfixOpTok, IsPostOpTok
+  */
+  bool ParserTokenReader::IsEOF(token_type &a_Tok)
+  {
+    const char_type* szFormula = m_strFormula.c_str();
+
+    // check for EOF
+    if ( !szFormula[m_iPos] /*|| szFormula[m_iPos] == '\n'*/)
+    {
+      if ( m_iSynFlags & noEND )
+        Error(ecUNEXPECTED_EOF, m_iPos);
+
+      if (m_iBrackets>0)
+        Error(ecMISSING_PARENS, m_iPos, _T(")"));
+
+      m_iSynFlags = 0;
+      a_Tok.Set(cmEND);
+      return true;
+    }
+
+    return false;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Check if a string position contains a unary infix operator.
+      \return true if a function token has been found false otherwise.
+  */
+  bool ParserTokenReader::IsInfixOpTok(token_type &a_Tok)
+  {
+    string_type sTok;
+    int iEnd = ExtractToken(m_pParser->ValidInfixOprtChars(), sTok, m_iPos);
+    if (iEnd==m_iPos)
+      return false;
+
+    // iterate over all postfix operator strings
+    funmap_type::const_reverse_iterator it = m_pInfixOprtDef->rbegin();
+    for ( ; it!=m_pInfixOprtDef->rend(); ++it)
+    {
+      if (sTok.find(it->first)!=0)
+        continue;
+
+      a_Tok.Set(it->second, it->first);
+      m_iPos += (int)it->first.length();
+
+      if (m_iSynFlags & noINFIXOP)
+        Error(ecUNEXPECTED_OPERATOR, m_iPos, a_Tok.GetAsString());
+
+      m_iSynFlags = noPOSTOP | noINFIXOP | noOPT | noBC | noSTR | noASSIGN;
+      return true;
+    }
+
+    return false;
+
+/*
+    a_Tok.Set(item->second, sTok);
+    m_iPos = (int)iEnd;
+
+    if (m_iSynFlags & noINFIXOP)
+      Error(ecUNEXPECTED_OPERATOR, m_iPos, a_Tok.GetAsString());
+
+    m_iSynFlags = noPOSTOP | noINFIXOP | noOPT | noBC | noSTR | noASSIGN;
+    return true;
+*/
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Check whether the token at a given position is a function token.
+      \param a_Tok [out] If a value token is found it will be placed here.
+      \throw ParserException if Syntaxflags do not allow a function at a_iPos
+      \return true if a function token has been found false otherwise.
+      \pre [assert] m_pParser!=0
+  */
+  bool ParserTokenReader::IsFunTok(token_type &a_Tok)
+  {
+    string_type strTok;
+    int iEnd = ExtractToken(m_pParser->ValidNameChars(), strTok, m_iPos);
+    if (iEnd==m_iPos)
+      return false;
+
+    funmap_type::const_iterator item = m_pFunDef->find(strTok);
+    if (item==m_pFunDef->end())
+      return false;
+
+    // Check if the next sign is an opening bracket
+    const char_type *szFormula = m_strFormula.c_str();
+    if (szFormula[iEnd]!='(')
+      return false;
+
+    a_Tok.Set(item->second, strTok);
+
+    m_iPos = (int)iEnd;
+    if (m_iSynFlags & noFUN)
+      Error(ecUNEXPECTED_FUN, m_iPos-(int)a_Tok.GetAsString().length(), a_Tok.GetAsString());
+
+    m_iSynFlags = noANY ^ noBO;
+    return true;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Check if a string position contains a binary operator.
+      \param a_Tok  [out] Operator token if one is found. This can either be a binary operator or an infix operator token.
+      \return true if an operator token has been found.
+  */
+  bool ParserTokenReader::IsOprt(token_type &a_Tok)
+  {
+    const char_type *const szExpr = m_strFormula.c_str();
+    string_type strTok;
+
+    int iEnd = ExtractOperatorToken(strTok, m_iPos);
+    if (iEnd==m_iPos)
+      return false;
+
+    // Check if the operator is a built in operator, if so ignore it here
+    const char_type **const pOprtDef = m_pParser->GetOprtDef();
+    for (int i=0; m_pParser->HasBuiltInOprt() && pOprtDef[i]; ++i)
+    {
+      if (string_type(pOprtDef[i])==strTok)
+        return false;
+    }
+
+    // Note:
+    // All tokens in oprt_bin_maptype are have been sorted by their length
+    // Long operators must come first! Otherwise short names (like: "add") that
+    // are part of long token names (like: "add123") will be found instead
+    // of the long ones.
+    // Length sorting is done with ascending length so we use a reverse iterator here.
+    funmap_type::const_reverse_iterator it = m_pOprtDef->rbegin();
+    for ( ; it!=m_pOprtDef->rend(); ++it)
+    {
+      const string_type &sID = it->first;
+      if ( sID == string_type(szExpr + m_iPos, szExpr + m_iPos + sID.length()) )
+      {
+        a_Tok.Set(it->second, strTok);
+
+        // operator was found
+        if (m_iSynFlags & noOPT)
+        {
+          // An operator was found but is not expected to occur at
+          // this position of the formula, maybe it is an infix
+          // operator, not a binary operator. Both operator types
+          // can share characters in their identifiers.
+          if ( IsInfixOpTok(a_Tok) )
+            return true;
+          else
+          {
+            // nope, no infix operator
+            return false;
+            //Error(ecUNEXPECTED_OPERATOR, m_iPos, a_Tok.GetAsString());
+          }
+
+        }
+
+        m_iPos += (int)sID.length();
+        m_iSynFlags  = noBC | noOPT | noARG_SEP | noPOSTOP | noEND | noASSIGN;
+        return true;
+      }
+    }
+
+    return false;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Check if a string position contains a unary post value operator. */
+  bool ParserTokenReader::IsPostOpTok(token_type &a_Tok)
+  {
+    // <ibg 20110629> Do not check for postfix operators if they are not allowed at
+    //                the current expression index.
+    //
+    //  This will fix the bug reported here:
+    //
+    //  http://sourceforge.net/tracker/index.php?func=detail&aid=3343891&group_id=137191&atid=737979
+    //
+    if (m_iSynFlags & noPOSTOP)
+      return false;
+    // </ibg>
+
+    // Tricky problem with equations like "3m+5":
+    //     m is a postfix operator, + is a valid sign for postfix operators and
+    //     for binary operators parser detects "m+" as operator string and
+    //     finds no matching postfix operator.
+    //
+    // This is a special case so this routine slightly differs from the other
+    // token readers.
+
+    // Test if there could be a postfix operator
+    string_type sTok;
+    int iEnd = ExtractToken(m_pParser->ValidOprtChars(), sTok, m_iPos);
+    if (iEnd==m_iPos)
+      return false;
+
+    // iterate over all postfix operator strings
+    funmap_type::const_reverse_iterator it = m_pPostOprtDef->rbegin();
+    for ( ; it!=m_pPostOprtDef->rend(); ++it)
+    {
+      if (sTok.find(it->first)!=0)
+        continue;
+
+      a_Tok.Set(it->second, sTok);
+  	  m_iPos += (int)it->first.length();
+
+      m_iSynFlags = noVAL | noVAR | noFUN | noBO | noPOSTOP | noSTR | noASSIGN;
+      return true;
+    }
+
+    return false;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Check whether the token at a given position is a value token.
+
+    Value tokens are either values or constants.
+
+    \param a_Tok [out] If a value token is found it will be placed here.
+    \return true if a value token has been found.
+  */
+  bool ParserTokenReader::IsValTok(token_type &a_Tok)
+  {
+    assert(m_pConstDef);
+    assert(m_pParser);
+
+    string_type strTok;
+    value_type fVal(0);
+    int iEnd(0);
+
+    // 2.) Check for user defined constant
+    // Read everything that could be a constant name
+    iEnd = ExtractToken(m_pParser->ValidNameChars(), strTok, m_iPos);
+    if (iEnd!=m_iPos)
+    {
+      valmap_type::const_iterator item = m_pConstDef->find(strTok);
+      if (item!=m_pConstDef->end())
+      {
+        m_iPos = iEnd;
+        a_Tok.SetVal(item->second, strTok);
+
+        if (m_iSynFlags & noVAL)
+          Error(ecUNEXPECTED_VAL, m_iPos - (int)strTok.length(), strTok);
+
+        m_iSynFlags = noVAL | noVAR | noFUN | noBO | noINFIXOP | noSTR | noASSIGN;
+        return true;
+      }
+    }
+
+    // 3.call the value recognition functions provided by the user
+    // Call user defined value recognition functions
+    std::list<identfun_type>::const_iterator item = m_vIdentFun.begin();
+    for (item = m_vIdentFun.begin(); item!=m_vIdentFun.end(); ++item)
+    {
+      int iStart = m_iPos;
+      if ( (*item)(m_strFormula.c_str() + m_iPos, &m_iPos, &fVal)==1 )
+      {
+        // 2013-11-27 Issue 2:  https://code.google.com/p/muparser/issues/detail?id=2
+        strTok.assign(m_strFormula.c_str(), iStart, m_iPos-iStart);
+
+        if (m_iSynFlags & noVAL)
+          Error(ecUNEXPECTED_VAL, m_iPos - (int)strTok.length(), strTok);
+
+        a_Tok.SetVal(fVal, strTok);
+        m_iSynFlags = noVAL | noVAR | noFUN | noBO | noINFIXOP | noSTR | noASSIGN;
+        return true;
+      }
+    }
+
+    return false;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Check wheter a token at a given position is a variable token.
+      \param a_Tok [out] If a variable token has been found it will be placed here.
+	    \return true if a variable token has been found.
+  */
+  bool ParserTokenReader::IsVarTok(token_type &a_Tok)
+  {
+    if (m_pVarDef->empty())
+      return false;
+
+    string_type strTok;
+    int iEnd = ExtractToken(m_pParser->ValidNameChars(), strTok, m_iPos);
+    if (iEnd==m_iPos)
+      return false;
+
+    varmap_type::const_iterator item =  m_pVarDef->find(strTok);
+    if (item==m_pVarDef->end())
+      return false;
+
+    if (m_iSynFlags & noVAR)
+      Error(ecUNEXPECTED_VAR, m_iPos, strTok);
+
+    m_pParser->OnDetectVar(&m_strFormula, m_iPos, iEnd);
+
+    m_iPos = iEnd;
+    a_Tok.SetVar(item->second, strTok);
+    m_UsedVar[item->first] = item->second;  // Add variable to used-var-list
+
+    m_iSynFlags = noVAL | noVAR | noFUN | noBO | noINFIXOP | noSTR;
+
+//  Zur Info hier die SynFlags von IsVal():
+//    m_iSynFlags = noVAL | noVAR | noFUN | noBO | noINFIXOP | noSTR | noASSIGN;
+    return true;
+  }
+
+  //---------------------------------------------------------------------------
+  bool ParserTokenReader::IsStrVarTok(token_type &a_Tok)
+  {
+    if (!m_pStrVarDef || m_pStrVarDef->empty())
+      return false;
+
+    string_type strTok;
+    int iEnd = ExtractToken(m_pParser->ValidNameChars(), strTok, m_iPos);
+    if (iEnd==m_iPos)
+      return false;
+
+    strmap_type::const_iterator item =  m_pStrVarDef->find(strTok);
+    if (item==m_pStrVarDef->end())
+      return false;
+
+    if (m_iSynFlags & noSTR)
+      Error(ecUNEXPECTED_VAR, m_iPos, strTok);
+
+    m_iPos = iEnd;
+    if (!m_pParser->m_vStringVarBuf.size())
+      Error(ecINTERNAL_ERROR);
+
+    a_Tok.SetString(m_pParser->m_vStringVarBuf[item->second], m_pParser->m_vStringVarBuf.size() );
+
+    m_iSynFlags = noANY ^ ( noBC | noOPT | noEND | noARG_SEP);
+    return true;
+  }
+
+
+  //---------------------------------------------------------------------------
+  /** \brief Check wheter a token at a given position is an undefined variable.
+
+      \param a_Tok [out] If a variable tom_pParser->m_vStringBufken has been found it will be placed here.
+	    \return true if a variable token has been found.
+      \throw nothrow
+  */
+  bool ParserTokenReader::IsUndefVarTok(token_type &a_Tok)
+  {
+    string_type strTok;
+    int iEnd( ExtractToken(m_pParser->ValidNameChars(), strTok, m_iPos) );
+    if ( iEnd==m_iPos )
+      return false;
+
+    if (m_iSynFlags & noVAR)
+    {
+      // <ibg/> 20061021 added token string strTok instead of a_Tok.GetAsString() as the
+      //                 token identifier.
+      // related bug report:
+      // http://sourceforge.net/tracker/index.php?func=detail&aid=1578779&group_id=137191&atid=737979
+      Error(ecUNEXPECTED_VAR, m_iPos - (int)a_Tok.GetAsString().length(), strTok);
+    }
+
+    // If a factory is available implicitely create new variables
+    if (m_pFactory)
+    {
+      value_type *fVar = m_pFactory(strTok.c_str(), m_pFactoryData);
+      a_Tok.SetVar(fVar, strTok );
+
+      // Do not use m_pParser->DefineVar( strTok, fVar );
+      // in order to define the new variable, it will clear the
+      // m_UsedVar array which will kill previously defined variables
+      // from the list
+      // This is safe because the new variable can never override an existing one
+      // because they are checked first!
+      (*m_pVarDef)[strTok] = fVar;
+      m_UsedVar[strTok] = fVar;  // Add variable to used-var-list
+    }
+    else
+    {
+      a_Tok.SetVar((value_type*)&m_fZero, strTok);
+      m_UsedVar[strTok] = 0;  // Add variable to used-var-list
+    }
+
+    m_iPos = iEnd;
+
+    // Call the variable factory in order to let it define a new parser variable
+    m_iSynFlags = noVAL | noVAR | noFUN | noBO | noPOSTOP | noINFIXOP | noSTR;
+    return true;
+  }
+
+
+  //---------------------------------------------------------------------------
+  /** \brief Check wheter a token at a given position is a string.
+      \param a_Tok [out] If a variable token has been found it will be placed here.
+  	  \return true if a string token has been found.
+      \sa IsOprt, IsFunTok, IsStrFunTok, IsValTok, IsVarTok, IsEOF, IsInfixOpTok, IsPostOpTok
+      \throw nothrow
+  */
+  bool ParserTokenReader::IsString(token_type &a_Tok)
+  {
+    if (m_strFormula[m_iPos]!='"')
+      return false;
+
+    string_type strBuf(&m_strFormula[m_iPos+1]);
+    std::size_t iEnd(0), iSkip(0);
+
+    // parser over escaped '\"' end replace them with '"'
+    for(iEnd=(int)strBuf.find( _T("\"") ); iEnd!=0 && iEnd!=string_type::npos; iEnd=(int)strBuf.find( _T("\""), iEnd))
+    {
+      if (strBuf[iEnd-1]!='\\') break;
+      strBuf.replace(iEnd-1, 2, _T("\"") );
+      iSkip++;
+    }
+
+    if (iEnd==string_type::npos)
+      Error(ecUNTERMINATED_STRING, m_iPos, _T("\"") );
+
+    string_type strTok(strBuf.begin(), strBuf.begin()+iEnd);
+
+    if (m_iSynFlags & noSTR)
+      Error(ecUNEXPECTED_STR, m_iPos, strTok);
+
+		m_pParser->m_vStringBuf.push_back(strTok); // Store string in internal buffer
+    a_Tok.SetString(strTok, m_pParser->m_vStringBuf.size());
+
+    m_iPos += (int)strTok.length() + 2 + (int)iSkip;  // +2 wg Anführungszeichen; +iSkip für entfernte escape zeichen
+    m_iSynFlags = noANY ^ ( noARG_SEP | noBC | noOPT | noEND );
+
+    return true;
+  }
+
+  //---------------------------------------------------------------------------
+  /** \brief Create an error containing the parse error position.
+
+    This function will create an Parser Exception object containing the error text and its position.
+
+    \param a_iErrc [in] The error code of type #EErrorCodes.
+    \param a_iPos [in] The position where the error was detected.
+    \param a_strTok [in] The token string representation associated with the error.
+    \throw ParserException always throws thats the only purpose of this function.
+  */
+  void  ParserTokenReader::Error( EErrorCodes a_iErrc,
+                                  int a_iPos,
+                                  const string_type &a_sTok) const
+  {
+    m_pParser->Error(a_iErrc, a_iPos, a_sTok);
+  }
+
+  //---------------------------------------------------------------------------
+  void ParserTokenReader::SetArgSep(char_type cArgSep)
+  {
+    m_cArgSep = cArgSep;
+  }
+
+  //---------------------------------------------------------------------------
+  char_type ParserTokenReader::GetArgSep() const
+  {
+    return m_cArgSep;
+  }
+} // namespace mu
+
diff --git a/geometry/qmuparser/muParserTokenReader.h b/geometry/qmuparser/muParserTokenReader.h
old mode 100755
new mode 100644
index 9d96225..52b3c1a
--- a/geometry/qmuparser/muParserTokenReader.h
+++ b/geometry/qmuparser/muParserTokenReader.h
@@ -1,161 +1,161 @@
-/*
-                 __________                                      
-    _____   __ __\______   \_____  _______  ______  ____ _______ 
-   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
-  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
-  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|   
-        \/                       \/            \/      \/        
-  Copyright (C) 2004-2013 Ingo Berg
-
-  Permission is hereby granted, free of charge, to any person obtaining a copy of this 
-  software and associated documentation files (the "Software"), to deal in the Software
-  without restriction, including without limitation the rights to use, copy, modify, 
-  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 
-  permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-  The above copyright notice and this permission notice shall be included in all copies or 
-  substantial portions of the Software.
-
-  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
-  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
-  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
-  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
-  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
-*/
-
-#ifndef MU_PARSER_TOKEN_READER_H
-#define MU_PARSER_TOKEN_READER_H
-
-#include <cassert>
-#include <cstdio>
-#include <cstring>
-#include <list>
-#include <map>
-#include <memory>
-#include <stack>
-#include <string>
-
-#include "muParserDef.h"
-#include "muParserToken.h"
-
-/** \file
-    \brief This file contains the parser token reader definition.
-*/
-
-
-namespace mu
-{
-  // Forward declaration
-  class ParserBase;
-
-  /** \brief Token reader for the ParserBase class.
-
-  */
-  class ParserTokenReader 
-  {
-  private:
-
-      typedef ParserToken<value_type, string_type> token_type;
-
-  public:
-
-      ParserTokenReader(ParserBase *a_pParent);
-      ParserTokenReader* Clone(ParserBase *a_pParent) const;
-
-      void AddValIdent(identfun_type a_pCallback);
-      void SetVarCreator(facfun_type a_pFactory, void *pUserData);
-      void SetFormula(const string_type &a_strFormula);
-      void SetArgSep(char_type cArgSep);
-
-      int GetPos() const;
-      const string_type& GetExpr() const;
-      varmap_type& GetUsedVar();
-      char_type GetArgSep() const;
-
-      void IgnoreUndefVar(bool bIgnore);
-      void ReInit();
-      token_type ReadNextToken();
-
-  private:
-
-      /** \brief Syntax codes. 
-  	
-	        The syntax codes control the syntax check done during the first time parsing of 
-          the expression string. They are flags that indicate which tokens are allowed next
-          if certain tokens are identified.
-  	  */
-      enum ESynCodes
-      {
-        noBO      = 1 << 0,  ///< to avoid i.e. "cos(7)(" 
-        noBC      = 1 << 1,  ///< to avoid i.e. "sin)" or "()"
-        noVAL     = 1 << 2,  ///< to avoid i.e. "tan 2" or "sin(8)3.14"
-        noVAR     = 1 << 3,  ///< to avoid i.e. "sin a" or "sin(8)a"
-        noARG_SEP = 1 << 4,  ///< to avoid i.e. ",," or "+," ...
-        noFUN     = 1 << 5,  ///< to avoid i.e. "sqrt cos" or "(1)sin"	
-        noOPT     = 1 << 6,  ///< to avoid i.e. "(+)"
-        noPOSTOP  = 1 << 7,  ///< to avoid i.e. "(5!!)" "sin!"
-	      noINFIXOP = 1 << 8,  ///< to avoid i.e. "++4" "!!4"
-        noEND     = 1 << 9,  ///< to avoid unexpected end of formula
-        noSTR     = 1 << 10, ///< to block numeric arguments on string functions
-        noASSIGN  = 1 << 11, ///< to block assignement to constant i.e. "4=7"
-        noIF      = 1 << 12,
-        noELSE    = 1 << 13,
-        sfSTART_OF_LINE = noOPT | noBC | noPOSTOP | noASSIGN | noIF | noELSE | noARG_SEP,
-        noANY     = ~0       ///< All of he above flags set
-      };	
-
-      ParserTokenReader(const ParserTokenReader &a_Reader);
-      ParserTokenReader& operator=(const ParserTokenReader &a_Reader);
-      void Assign(const ParserTokenReader &a_Reader);
-
-      void SetParent(ParserBase *a_pParent);
-      int ExtractToken(const char_type *a_szCharSet, 
-                       string_type &a_strTok, 
-                       int a_iPos) const;
-      int ExtractOperatorToken(string_type &a_sTok, int a_iPos) const;
-
-      bool IsBuiltIn(token_type &a_Tok);
-      bool IsArgSep(token_type &a_Tok);
-      bool IsEOF(token_type &a_Tok);
-      bool IsInfixOpTok(token_type &a_Tok);
-      bool IsFunTok(token_type &a_Tok);
-      bool IsPostOpTok(token_type &a_Tok);
-      bool IsOprt(token_type &a_Tok);
-      bool IsValTok(token_type &a_Tok);
-      bool IsVarTok(token_type &a_Tok);
-      bool IsStrVarTok(token_type &a_Tok);
-      bool IsUndefVarTok(token_type &a_Tok);
-      bool IsString(token_type &a_Tok);
-      void Error(EErrorCodes a_iErrc, 
-                 int a_iPos = -1, 
-                 const string_type &a_sTok = string_type() ) const;
-
-      token_type& SaveBeforeReturn(const token_type &tok);
-
-      ParserBase *m_pParser;
-      string_type m_strFormula;
-      int  m_iPos;
-      int  m_iSynFlags;
-      bool m_bIgnoreUndefVar;
-
-      const funmap_type *m_pFunDef;
-      const funmap_type *m_pPostOprtDef;
-      const funmap_type *m_pInfixOprtDef;
-      const funmap_type *m_pOprtDef;
-      const valmap_type *m_pConstDef;
-      const strmap_type *m_pStrVarDef;
-      varmap_type *m_pVarDef;  ///< The only non const pointer to parser internals
-      facfun_type m_pFactory;
-      void *m_pFactoryData;
-      std::list<identfun_type> m_vIdentFun; ///< Value token identification function
-      varmap_type m_UsedVar;
-      value_type m_fZero;      ///< Dummy value of zero, referenced by undefined variables
-      int m_iBrackets;
-      token_type m_lastTok;
-      char_type m_cArgSep;     ///< The character used for separating function arguments
-  };
-} // namespace mu
-
-#endif
-
-
+/*
+                 __________
+    _____   __ __\______   \_____  _______  ______  ____ _______
+   /     \ |  |  \|     ___/\__  \ \_  __ \/  ___/_/ __ \\_  __ \
+  |  Y Y  \|  |  /|    |     / __ \_|  | \/\___ \ \  ___/ |  | \/
+  |__|_|  /|____/ |____|    (____  /|__|  /____  > \___  >|__|
+        \/                       \/            \/      \/
+  Copyright (C) 2004-2013 Ingo Berg
+
+  Permission is hereby granted, free of charge, to any person obtaining a copy of this
+  software and associated documentation files (the "Software"), to deal in the Software
+  without restriction, including without limitation the rights to use, copy, modify,
+  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
+  permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included in all copies or
+  substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
+  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef MU_PARSER_TOKEN_READER_H
+#define MU_PARSER_TOKEN_READER_H
+
+#include <cassert>
+#include <cstdio>
+#include <cstring>
+#include <list>
+#include <map>
+#include <memory>
+#include <stack>
+#include <string>
+
+#include "muParserDef.h"
+#include "muParserToken.h"
+
+/** \file
+    \brief This file contains the parser token reader definition.
+*/
+
+
+namespace mu
+{
+  // Forward declaration
+  class ParserBase;
+
+  /** \brief Token reader for the ParserBase class.
+
+  */
+  class ParserTokenReader
+  {
+  private:
+
+      typedef ParserToken<value_type, string_type> token_type;
+
+  public:
+
+      ParserTokenReader(ParserBase *a_pParent);
+      ParserTokenReader* Clone(ParserBase *a_pParent) const;
+
+      void AddValIdent(identfun_type a_pCallback);
+      void SetVarCreator(facfun_type a_pFactory, void *pUserData);
+      void SetFormula(const string_type &a_strFormula);
+      void SetArgSep(char_type cArgSep);
+
+      int GetPos() const;
+      const string_type& GetExpr() const;
+      varmap_type& GetUsedVar();
+      char_type GetArgSep() const;
+
+      void IgnoreUndefVar(bool bIgnore);
+      void ReInit();
+      token_type ReadNextToken();
+
+  private:
+
+      /** \brief Syntax codes.
+
+	        The syntax codes control the syntax check done during the first time parsing of
+          the expression string. They are flags that indicate which tokens are allowed next
+          if certain tokens are identified.
+  	  */
+      enum ESynCodes
+      {
+        noBO      = 1 << 0,  ///< to avoid i.e. "cos(7)("
+        noBC      = 1 << 1,  ///< to avoid i.e. "sin)" or "()"
+        noVAL     = 1 << 2,  ///< to avoid i.e. "tan 2" or "sin(8)3.14"
+        noVAR     = 1 << 3,  ///< to avoid i.e. "sin a" or "sin(8)a"
+        noARG_SEP = 1 << 4,  ///< to avoid i.e. ",," or "+," ...
+        noFUN     = 1 << 5,  ///< to avoid i.e. "sqrt cos" or "(1)sin"
+        noOPT     = 1 << 6,  ///< to avoid i.e. "(+)"
+        noPOSTOP  = 1 << 7,  ///< to avoid i.e. "(5!!)" "sin!"
+	      noINFIXOP = 1 << 8,  ///< to avoid i.e. "++4" "!!4"
+        noEND     = 1 << 9,  ///< to avoid unexpected end of formula
+        noSTR     = 1 << 10, ///< to block numeric arguments on string functions
+        noASSIGN  = 1 << 11, ///< to block assignement to constant i.e. "4=7"
+        noIF      = 1 << 12,
+        noELSE    = 1 << 13,
+        sfSTART_OF_LINE = noOPT | noBC | noPOSTOP | noASSIGN | noIF | noELSE | noARG_SEP,
+        noANY     = ~0       ///< All of he above flags set
+      };
+
+      ParserTokenReader(const ParserTokenReader &a_Reader);
+      ParserTokenReader& operator=(const ParserTokenReader &a_Reader);
+      void Assign(const ParserTokenReader &a_Reader);
+
+      void SetParent(ParserBase *a_pParent);
+      int ExtractToken(const char_type *a_szCharSet,
+                       string_type &a_strTok,
+                       int a_iPos) const;
+      int ExtractOperatorToken(string_type &a_sTok, int a_iPos) const;
+
+      bool IsBuiltIn(token_type &a_Tok);
+      bool IsArgSep(token_type &a_Tok);
+      bool IsEOF(token_type &a_Tok);
+      bool IsInfixOpTok(token_type &a_Tok);
+      bool IsFunTok(token_type &a_Tok);
+      bool IsPostOpTok(token_type &a_Tok);
+      bool IsOprt(token_type &a_Tok);
+      bool IsValTok(token_type &a_Tok);
+      bool IsVarTok(token_type &a_Tok);
+      bool IsStrVarTok(token_type &a_Tok);
+      bool IsUndefVarTok(token_type &a_Tok);
+      bool IsString(token_type &a_Tok);
+      void Error(EErrorCodes a_iErrc,
+                 int a_iPos = -1,
+                 const string_type &a_sTok = string_type() ) const;
+
+      token_type& SaveBeforeReturn(const token_type &tok);
+
+      ParserBase *m_pParser;
+      string_type m_strFormula;
+      int  m_iPos;
+      int  m_iSynFlags;
+      bool m_bIgnoreUndefVar;
+
+      const funmap_type *m_pFunDef;
+      const funmap_type *m_pPostOprtDef;
+      const funmap_type *m_pInfixOprtDef;
+      const funmap_type *m_pOprtDef;
+      const valmap_type *m_pConstDef;
+      const strmap_type *m_pStrVarDef;
+      varmap_type *m_pVarDef;  ///< The only non const pointer to parser internals
+      facfun_type m_pFactory;
+      void *m_pFactoryData;
+      std::list<identfun_type> m_vIdentFun; ///< Value token identification function
+      varmap_type m_UsedVar;
+      value_type m_fZero;      ///< Dummy value of zero, referenced by undefined variables
+      int m_iBrackets;
+      token_type m_lastTok;
+      char_type m_cArgSep;     ///< The character used for separating function arguments
+  };
+} // namespace mu
+
+#endif
+
+
diff --git a/gui/qffmpeg/QVideoDecoder.cpp b/gui/qffmpeg/QVideoDecoder.cpp
index 3988bd2..e54c700 100644
--- a/gui/qffmpeg/QVideoDecoder.cpp
+++ b/gui/qffmpeg/QVideoDecoder.cpp
@@ -1,531 +1,531 @@
-/*
-	QTFFmpegWrapper - QT FFmpeg Wrapper Class 
-	Copyright (C) 2009,2010:
-			Daniel Roggen, droggen at gmail.com			
-			
-	All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
-   1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-   2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include "QVideoDecoder.h"
-#include <limits.h>
-#include <stdint.h>
-#include "ffmpeg.h"
-
-
-/******************************************************************************
-*******************************************************************************
-* QVideoDecoder   QVideoDecoder   QVideoDecoder   QVideoDecoder   QVideoDecoder
-*******************************************************************************
-******************************************************************************/
-
-/******************************************************************************
-* PUBLIC   PUBLIC   PUBLIC   PUBLIC   PUBLIC   PUBLIC   PUBLIC   PUBLIC   PUBLIC
-******************************************************************************/
-
-
-/**
-   \brief Constructor - opens a video on later openFile call
-**/
-QVideoDecoder::QVideoDecoder()
-{
-   InitVars();
-   initCodec();
-}
-/**
-   \brief Constructor - opens directly a video
-**/
-QVideoDecoder::QVideoDecoder(QString file)
-{
-   InitVars();
-   initCodec();
-
-   ok = openFile(file.toStdString().c_str());
-}
-
-QVideoDecoder::~QVideoDecoder()
-{
-   close();
-}
-
-void QVideoDecoder::InitVars()
-{
-   ok=false;
-   pFormatCtx=0;
-   pCodecCtx=0;
-   pCodec=0;
-   pFrame=0;
-   pFrameRGB=0;
-   buffer=0;
-   img_convert_ctx=0;
-}
-
-void QVideoDecoder::close()
-{
-   if(!ok)
-      return;
-
-   // Free the RGB image
-   if(buffer)
-      delete [] buffer;
-
-   // Free the YUV frame
-   if(pFrame)
-      av_free(pFrame);
-
-   // Free the RGB frame
-   if(pFrameRGB)
-      av_free(pFrameRGB);
-
-   // Close the codec
-   if(pCodecCtx)
-      avcodec_close(pCodecCtx);
-
-   // Close the video file
-   if(pFormatCtx)
-      av_close_input_file(pFormatCtx);
-
-   InitVars();
-}
-
-
-bool QVideoDecoder::initCodec()
-{
-   ffmpeg::avcodec_init();
-   ffmpeg::avcodec_register_all();
-   ffmpeg::av_register_all();
-
-   qDebug("License: %s\n",ffmpeg::avformat_license());
-   qDebug("AVCodec version %d\n",ffmpeg::avformat_version());
-   qDebug("AVFormat configuration: %s\n",ffmpeg::avformat_configuration());
-
-   return true;
-}
-
-bool QVideoDecoder::openFile(QString filename)
-{
-   // Close last video..
-   close();
-
-   LastLastFrameTime=INT_MIN;       // Last last must be small to handle the seek well
-   LastFrameTime=0;
-   LastLastFrameNumber=INT_MIN;
-   LastFrameNumber=0;
-   DesiredFrameTime=DesiredFrameNumber=0;
-   LastFrameOk=false;
-
-
-   // Open video file
-   if(av_open_input_file(&pFormatCtx, filename.toStdString().c_str(), NULL, 0, NULL)!=0)
-       return false; // Couldn't open file
-
-   // Retrieve stream information
-   if(av_find_stream_info(pFormatCtx)<0)
-       return false; // Couldn't find stream information
-
-   // Dump information about file onto standard error
-   dump_format(pFormatCtx, 0, filename.toStdString().c_str(), false);
-
-   // Find the first video stream
-   videoStream=-1;
-   for(unsigned i=0; i<pFormatCtx->nb_streams; i++)
-       if(pFormatCtx->streams[i]->codec->codec_type==ffmpeg::AVMEDIA_TYPE_VIDEO)
-       {
-           videoStream=i;
-           break;
-       }
-   if(videoStream==-1)
-       return false; // Didn't find a video stream
-
-   // Get a pointer to the codec context for the video stream
-   pCodecCtx=pFormatCtx->streams[videoStream]->codec;
-
-   // Find the decoder for the video stream
-   pCodec=avcodec_find_decoder(pCodecCtx->codec_id);
-   if(pCodec==NULL)
-       return false; // Codec not found
-
-   // Open codec
-   if(avcodec_open(pCodecCtx, pCodec)<0)
-       return false; // Could not open codec
-
-   // Hack to correct wrong frame rates that seem to be generated by some
-   // codecs
-  if(pCodecCtx->time_base.num>1000 && pCodecCtx->time_base.den==1)
-     pCodecCtx->time_base.den=1000;
-
-   // Allocate video frame
-   pFrame=ffmpeg::avcodec_alloc_frame();
-
-   // Allocate an AVFrame structure
-   pFrameRGB=ffmpeg::avcodec_alloc_frame();
-   if(pFrameRGB==NULL)
-       return false;
-
-   // Determine required buffer size and allocate buffer
-   numBytes=ffmpeg::avpicture_get_size(ffmpeg::PIX_FMT_RGB24, pCodecCtx->width,pCodecCtx->height);
-   buffer=new uint8_t[numBytes];
-
-   // Assign appropriate parts of buffer to image planes in pFrameRGB
-   avpicture_fill((ffmpeg::AVPicture *)pFrameRGB, buffer, ffmpeg::PIX_FMT_RGB24,
-       pCodecCtx->width, pCodecCtx->height);
-
-   ok=true;
-   return true;
-}
-bool QVideoDecoder::isOk()
-{
-   return ok;
-}
-
-/**
-   Decodes the video stream until the first frame with number larger or equal than 'after' is found.
-
-   Returns:
-   - true if a frame is found, false otherwise.
-   - the image as a QImage if img is non-null
-   - time frame time, if frametime is non-null
-   - the frame number, if framenumber is non-null
-
-   All times are in milliseconds.
-**/
-bool QVideoDecoder::decodeSeekFrame(int after)
-{
-   if(!ok)
-      return false;
-
-   //qDebug("decodeSeekFrame. after: %d. LLT: %d. LT: %d. LLF: %d. LF: %d. LastFrameOk: %d.\n",after,LastLastFrameTime,LastFrameTime,LastLastFrameNumber,LastFrameNumber,(int)LastFrameOk);
-
-
-
-   // If the last decoded frame satisfies the time condition we return it
-   //if( after!=-1 && ( LastDataInvalid==false && after>=LastLastFrameTime && after <= LastFrameTime))
-   if( after!=-1 && ( LastFrameOk==true && after>=LastLastFrameNumber && after <= LastFrameNumber))
-   {
-      // This is the frame we want to return
-
-      // Compute desired frame time
-      ffmpeg::AVRational millisecondbase = {1, 1000};
-      DesiredFrameTime = ffmpeg::av_rescale_q(after,pFormatCtx->streams[videoStream]->time_base,millisecondbase);
-
-      //qDebug("Returning already available frame %d @ %d. DesiredFrameTime: %d\n",LastFrameNumber,LastFrameTime,DesiredFrameTime);
-
-      return true;
-   }   
-
-   // The last decoded frame wasn't ok; either we need any new frame (after=-1), or a specific new frame with time>after
-
-   bool done=false;
-   while(!done)
-   {
-      // Read a frame
-      if(av_read_frame(pFormatCtx, &packet)<0)
-         return false;                             // Frame read failed (e.g. end of stream)
-
-      //qDebug("Packet of stream %d, size %d\n",packet.stream_index,packet.size);
-
-      if(packet.stream_index==videoStream)
-      {
-         // Is this a packet from the video stream -> decode video frame
-
-         int frameFinished;
-         avcodec_decode_video2(pCodecCtx,pFrame,&frameFinished,&packet);
-
-         //qDebug("used %d out of %d bytes\n",len,packet.size);
-
-         //qDebug("Frame type: ");
-         //if(pFrame->pict_type == FF_B_TYPE)
-         //   qDebug("B\n");
-         //else if (pFrame->pict_type == FF_I_TYPE)
-         //   qDebug("I\n");
-         //else
-         //   qDebug("P\n");
-
-
-         /*qDebug("codecctx time base: num: %d den: %d\n",pCodecCtx->time_base.num,pCodecCtx->time_base.den);
-         qDebug("formatctx time base: num: %d den: %d\n",pFormatCtx->streams[videoStream]->time_base.num,pFormatCtx->streams[videoStream]->time_base.den);
-         qDebug("pts: %ld\n",pts);
-         qDebug("dts: %ld\n",dts);*/
-
-
-
-
-         // Did we get a video frame?
-         if(frameFinished)
-         {
-            ffmpeg::AVRational millisecondbase = {1, 1000};
-            int f = packet.dts;
-            int t = ffmpeg::av_rescale_q(packet.dts,pFormatCtx->streams[videoStream]->time_base,millisecondbase);
-            if(LastFrameOk==false)
-            {
-               LastFrameOk=true;
-               LastLastFrameTime=LastFrameTime=t;
-               LastLastFrameNumber=LastFrameNumber=f;
-            }
-            else
-            {
-               // If we decoded 2 frames in a row, the last times are okay
-               LastLastFrameTime = LastFrameTime;
-               LastLastFrameNumber = LastFrameNumber;
-               LastFrameTime=t;
-               LastFrameNumber=f;
-            }
-            //qDebug("Frame %d @ %d. LastLastT: %d. LastLastF: %d. LastFrameOk: %d\n",LastFrameNumber,LastFrameTime,LastLastFrameTime,LastLastFrameNumber,(int)LastFrameOk);
-
-            // Is this frame the desired frame?
-            if(after==-1 || LastFrameNumber>=after)
-            {
-               // It's the desired frame
-
-               // Convert the image format (init the context the first time)
-               int w = pCodecCtx->width;
-               int h = pCodecCtx->height;
-               img_convert_ctx = ffmpeg::sws_getCachedContext(img_convert_ctx,w, h, pCodecCtx->pix_fmt, w, h, ffmpeg::PIX_FMT_RGB24, SWS_BICUBIC, NULL, NULL, NULL);
-
-               if(img_convert_ctx == NULL)
-               {
-                  qDebug("Cannot initialize the conversion context!\n");
-                  return false;
-               }
-               ffmpeg::sws_scale(img_convert_ctx, pFrame->data, pFrame->linesize, 0, pCodecCtx->height, pFrameRGB->data, pFrameRGB->linesize);
-
-               // Convert the frame to QImage
-               LastFrame=QImage(w,h,QImage::Format_RGB888);
-
-               for(int y=0;y<h;y++)
-                  memcpy(LastFrame.scanLine(y),pFrameRGB->data[0]+y*pFrameRGB->linesize[0],w*3);
-
-               // Set the time
-               DesiredFrameTime = ffmpeg::av_rescale_q(after,pFormatCtx->streams[videoStream]->time_base,millisecondbase);
-               LastFrameOk=true;
-
-
-               done = true;
-
-            } // frame of interest
-         }  // frameFinished
-      }  // stream_index==videoStream
-      av_free_packet(&packet);      // Free the packet that was allocated by av_read_frame
-   }
-   //qDebug("Returning new frame %d @ %d. LastLastT: %d. LastLastF: %d. LastFrameOk: %d\n",LastFrameNumber,LastFrameTime,LastLastFrameTime,LastLastFrameNumber,(int)LastFrameOk);
-   //qDebug("\n");
-   return done;   // done indicates whether or not we found a frame
-}
-
-/**
-   \brief Decodes the next frame in the video stream
-
-
-**/
-bool QVideoDecoder::seekNextFrame()
-{
-   bool ret = decodeSeekFrame(DesiredFrameNumber+1);
-
-   if(ret)
-      DesiredFrameNumber++;   // Only updates the DesiredFrameNumber if we were successful in getting that frame
-   else
-      LastFrameOk=false;      // We didn't find the next frame (e.g. seek out of range) - mark we don't know where we are.
-   return ret;
-}
-
-/**
-  \brief Seek to millisecond
-**/
-bool QVideoDecoder::seekMs(int tsms)
-{
-   if(!ok)
-      return false;
-
-
-   //qDebug("**** SEEK TO ms %d. LLT: %d. LT: %d. LLF: %d. LF: %d. LastFrameOk: %d\n",tsms,LastLastFrameTime,LastFrameTime,LastLastFrameNumber,LastFrameNumber,(int)LastFrameOk);
-
-   // Convert time into frame number
-   DesiredFrameNumber = ffmpeg::av_rescale(tsms,pFormatCtx->streams[videoStream]->time_base.den,pFormatCtx->streams[videoStream]->time_base.num);
-   DesiredFrameNumber/=1000;
-
-   return seekFrame(DesiredFrameNumber);
-}
-/**
-  \brief Seek to frame
-**/
-bool QVideoDecoder::seekFrame(int64_t frame)
-{
-
-   if(!ok)
-      return false;
-
-   //qDebug("**** seekFrame to %d. LLT: %d. LT: %d. LLF: %d. LF: %d. LastFrameOk: %d\n",(int)frame,LastLastFrameTime,LastFrameTime,LastLastFrameNumber,LastFrameNumber,(int)LastFrameOk);
-
-   // Seek if:
-   // - we don't know where we are (Ok=false)
-   // - we know where we are but:
-   //    - the desired frame is after the last decoded frame (this could be optimized: if the distance is small, calling decodeSeekFrame may be faster than seeking from the last key frame)
-   //    - the desired frame is smaller or equal than the previous to the last decoded frame. Equal because if frame==LastLastFrameNumber we don't want the LastFrame, but the one before->we need to seek there
-   if( (LastFrameOk==false) || ((LastFrameOk==true) && (frame<=LastLastFrameNumber || frame>LastFrameNumber) ) )
-   {
-      //qDebug("\t avformat_seek_file\n");
-      if(ffmpeg::avformat_seek_file(pFormatCtx,videoStream,0,frame,frame,AVSEEK_FLAG_FRAME)<0)
-         return false;
-
-      avcodec_flush_buffers(pCodecCtx);
-
-      DesiredFrameNumber = frame;
-      LastFrameOk=false;
-   }
-   //qDebug("\t decodeSeekFrame\n");
-
-   return decodeSeekFrame(frame);
-
-   return true;
-}
-
-
-
-bool QVideoDecoder::getFrame(QImage&img,int *effectiveframenumber,int *effectiveframetime,int *desiredframenumber,int *desiredframetime)
-{
-   img = LastFrame;
-
-   if(effectiveframenumber)
-      *effectiveframenumber = LastFrameNumber;
-   if(effectiveframetime)
-      *effectiveframetime = LastFrameTime;
-   if(desiredframenumber)
-      *desiredframenumber = DesiredFrameNumber;
-   if(desiredframetime)
-      *desiredframetime = DesiredFrameTime;
-
-   //qDebug("getFrame. Returning valid? %s. Desired %d @ %d. Effective %d @ %d\n",LastFrameOk?"yes":"no",DesiredFrameNumber,DesiredFrameTime,LastFrameNumber,LastFrameTime);
-
-   return LastFrameOk;
-}
-
-
-/**
-  \brief Debug function: saves a frame as PPM
-**/
-void QVideoDecoder::saveFramePPM(ffmpeg::AVFrame *pFrame, int width, int height, int iFrame)
-{
-    FILE *pFile;
-    char szFilename[32];
-    int  y;
-
-    // Open file
-    sprintf(szFilename, "frame%d.ppm", iFrame);
-    pFile=fopen(szFilename, "wb");
-    if(pFile==NULL)
-        return;
-
-    // Write header
-    fprintf(pFile, "P6\n%d %d\n255\n", width, height);
-
-    // Write pixel data
-    for(y=0; y<height; y++)
-        fwrite(pFrame->data[0]+y*pFrame->linesize[0], 1, width*3, pFile);
-
-    // Close file
-    fclose(pFile);
-}
-
-
-
-void QVideoDecoder::dumpFormat(ffmpeg::AVFormatContext *ic,
-                 int index,
-                 const char *url,
-                 int is_output)
-{
-    //int i;
-    uint8_t *printed = (uint8_t*)ffmpeg::av_mallocz(ic->nb_streams);
-    if (ic->nb_streams && !printed)
-        return;
-
-    qDebug("AV_TIME_BASE: %d\n",AV_TIME_BASE);
-
-    qDebug("%s #%d, %s,\n %s '%s':\n",
-            is_output ? "Output" : "Input",
-            index,
-            is_output ? ic->oformat->name : ic->iformat->name,
-            is_output ? "to" : "from", url);
-    if (!is_output) {
-        qDebug("  Duration: ");
-        //if (ic->duration != AV_NOPTS_VALUE)
-        {
-            int hours, mins, secs, us;
-            secs = ic->duration / AV_TIME_BASE;
-            us = ic->duration % AV_TIME_BASE;
-            mins = secs / 60;
-            secs %= 60;
-            hours = mins / 60;
-            mins %= 60;
-            qDebug("%02d:%02d:%02d.%02d\n", hours, mins, secs,
-                   (100 * us) / AV_TIME_BASE);
-        } //else {
-            //qDebug("N/A");
-        //}
-        //if (ic->start_time != AV_NOPTS_VALUE)
-        {
-            int secs, us;
-            qDebug(", start: ");
-            secs = ic->start_time / AV_TIME_BASE;
-            us = ic->start_time % AV_TIME_BASE;
-            qDebug("%d.%06d\n",
-                   secs, (int)ffmpeg::av_rescale(us, 1000000, AV_TIME_BASE));
-        }
-        qDebug(", bitrate: ");
-        if (ic->bit_rate) {
-            qDebug("%d kb/s\n", ic->bit_rate / 1000);
-        } else {
-            qDebug("N/A\n");
-        }
-        qDebug("\n");
-    }
-    if(ic->nb_programs) {
-        unsigned int j, total=0;
-        for(j=0; j<ic->nb_programs; j++) {
-            ffmpeg::AVMetadataTag *name = av_metadata_get(ic->programs[j]->metadata,
-                                                  "name", NULL, 0);
-            qDebug("  Program %d %s\n", ic->programs[j]->id,
-                   name ? name->value : "");
-            /*for(k=0; k<ic->programs[j]->nb_stream_indexes; k++) {
-                dump_stream_format(ic, ic->programs[j]->stream_index[k], index, is_output);
-                printed[ic->programs[j]->stream_index[k]] = 1;
-            }*/
-            total += ic->programs[j]->nb_stream_indexes;
-        }
-        if (total < ic->nb_streams)
-            qDebug( "  No Program\n");
-    }
-    /*for(i=0;i<ic->nb_streams;i++)
-        if (!printed[i])
-            ffmpeg::dump_stream_format(ic, i, index, is_output);*/
-
-    if (ic->metadata) {
-        ffmpeg::AVMetadataTag *tag=NULL;
-        qDebug("  Metadata\n");
-        while((tag=av_metadata_get(ic->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) {
-            qDebug("    %-16s: %s\n", tag->key, tag->value);
-        }
-    }
-    ffmpeg::av_free(printed);
-}
-
-int QVideoDecoder::getVideoLengthMs()
-{
-   if(!isOk())
-      return -1;
-
-
-   int secs = pFormatCtx->duration / AV_TIME_BASE;
-   int us = pFormatCtx->duration % AV_TIME_BASE;
-   int l = secs*1000 + us/1000;
-
-
-   dumpFormat(pFormatCtx,videoStream,"test video",0);
-
-   return l;
-}
+/*
+	QTFFmpegWrapper - QT FFmpeg Wrapper Class
+	Copyright (C) 2009,2010:
+			Daniel Roggen, droggen at gmail.com
+
+	All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+   1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "QVideoDecoder.h"
+#include <limits.h>
+#include <stdint.h>
+#include "ffmpeg.h"
+
+
+/******************************************************************************
+*******************************************************************************
+* QVideoDecoder   QVideoDecoder   QVideoDecoder   QVideoDecoder   QVideoDecoder
+*******************************************************************************
+******************************************************************************/
+
+/******************************************************************************
+* PUBLIC   PUBLIC   PUBLIC   PUBLIC   PUBLIC   PUBLIC   PUBLIC   PUBLIC   PUBLIC
+******************************************************************************/
+
+
+/**
+   \brief Constructor - opens a video on later openFile call
+**/
+QVideoDecoder::QVideoDecoder()
+{
+   InitVars();
+   initCodec();
+}
+/**
+   \brief Constructor - opens directly a video
+**/
+QVideoDecoder::QVideoDecoder(QString file)
+{
+   InitVars();
+   initCodec();
+
+   ok = openFile(file.toStdString().c_str());
+}
+
+QVideoDecoder::~QVideoDecoder()
+{
+   close();
+}
+
+void QVideoDecoder::InitVars()
+{
+   ok=false;
+   pFormatCtx=0;
+   pCodecCtx=0;
+   pCodec=0;
+   pFrame=0;
+   pFrameRGB=0;
+   buffer=0;
+   img_convert_ctx=0;
+}
+
+void QVideoDecoder::close()
+{
+   if(!ok)
+      return;
+
+   // Free the RGB image
+   if(buffer)
+      delete [] buffer;
+
+   // Free the YUV frame
+   if(pFrame)
+      av_free(pFrame);
+
+   // Free the RGB frame
+   if(pFrameRGB)
+      av_free(pFrameRGB);
+
+   // Close the codec
+   if(pCodecCtx)
+      avcodec_close(pCodecCtx);
+
+   // Close the video file
+   if(pFormatCtx)
+      av_close_input_file(pFormatCtx);
+
+   InitVars();
+}
+
+
+bool QVideoDecoder::initCodec()
+{
+   ffmpeg::avcodec_init();
+   ffmpeg::avcodec_register_all();
+   ffmpeg::av_register_all();
+
+   qDebug("License: %s\n",ffmpeg::avformat_license());
+   qDebug("AVCodec version %d\n",ffmpeg::avformat_version());
+   qDebug("AVFormat configuration: %s\n",ffmpeg::avformat_configuration());
+
+   return true;
+}
+
+bool QVideoDecoder::openFile(QString filename)
+{
+   // Close last video..
+   close();
+
+   LastLastFrameTime=INT_MIN;       // Last last must be small to handle the seek well
+   LastFrameTime=0;
+   LastLastFrameNumber=INT_MIN;
+   LastFrameNumber=0;
+   DesiredFrameTime=DesiredFrameNumber=0;
+   LastFrameOk=false;
+
+
+   // Open video file
+   if(av_open_input_file(&pFormatCtx, filename.toStdString().c_str(), NULL, 0, NULL)!=0)
+       return false; // Couldn't open file
+
+   // Retrieve stream information
+   if(av_find_stream_info(pFormatCtx)<0)
+       return false; // Couldn't find stream information
+
+   // Dump information about file onto standard error
+   dump_format(pFormatCtx, 0, filename.toStdString().c_str(), false);
+
+   // Find the first video stream
+   videoStream=-1;
+   for(unsigned i=0; i<pFormatCtx->nb_streams; i++)
+       if(pFormatCtx->streams[i]->codec->codec_type==ffmpeg::AVMEDIA_TYPE_VIDEO)
+       {
+           videoStream=i;
+           break;
+       }
+   if(videoStream==-1)
+       return false; // Didn't find a video stream
+
+   // Get a pointer to the codec context for the video stream
+   pCodecCtx=pFormatCtx->streams[videoStream]->codec;
+
+   // Find the decoder for the video stream
+   pCodec=avcodec_find_decoder(pCodecCtx->codec_id);
+   if(pCodec==NULL)
+       return false; // Codec not found
+
+   // Open codec
+   if(avcodec_open(pCodecCtx, pCodec)<0)
+       return false; // Could not open codec
+
+   // Hack to correct wrong frame rates that seem to be generated by some
+   // codecs
+  if(pCodecCtx->time_base.num>1000 && pCodecCtx->time_base.den==1)
+     pCodecCtx->time_base.den=1000;
+
+   // Allocate video frame
+   pFrame=ffmpeg::avcodec_alloc_frame();
+
+   // Allocate an AVFrame structure
+   pFrameRGB=ffmpeg::avcodec_alloc_frame();
+   if(pFrameRGB==NULL)
+       return false;
+
+   // Determine required buffer size and allocate buffer
+   numBytes=ffmpeg::avpicture_get_size(ffmpeg::PIX_FMT_RGB24, pCodecCtx->width,pCodecCtx->height);
+   buffer=new uint8_t[numBytes];
+
+   // Assign appropriate parts of buffer to image planes in pFrameRGB
+   avpicture_fill((ffmpeg::AVPicture *)pFrameRGB, buffer, ffmpeg::PIX_FMT_RGB24,
+       pCodecCtx->width, pCodecCtx->height);
+
+   ok=true;
+   return true;
+}
+bool QVideoDecoder::isOk()
+{
+   return ok;
+}
+
+/**
+   Decodes the video stream until the first frame with number larger or equal than 'after' is found.
+
+   Returns:
+   - true if a frame is found, false otherwise.
+   - the image as a QImage if img is non-null
+   - time frame time, if frametime is non-null
+   - the frame number, if framenumber is non-null
+
+   All times are in milliseconds.
+**/
+bool QVideoDecoder::decodeSeekFrame(int after)
+{
+   if(!ok)
+      return false;
+
+   //qDebug("decodeSeekFrame. after: %d. LLT: %d. LT: %d. LLF: %d. LF: %d. LastFrameOk: %d.\n",after,LastLastFrameTime,LastFrameTime,LastLastFrameNumber,LastFrameNumber,(int)LastFrameOk);
+
+
+
+   // If the last decoded frame satisfies the time condition we return it
+   //if( after!=-1 && ( LastDataInvalid==false && after>=LastLastFrameTime && after <= LastFrameTime))
+   if( after!=-1 && ( LastFrameOk==true && after>=LastLastFrameNumber && after <= LastFrameNumber))
+   {
+      // This is the frame we want to return
+
+      // Compute desired frame time
+      ffmpeg::AVRational millisecondbase = {1, 1000};
+      DesiredFrameTime = ffmpeg::av_rescale_q(after,pFormatCtx->streams[videoStream]->time_base,millisecondbase);
+
+      //qDebug("Returning already available frame %d @ %d. DesiredFrameTime: %d\n",LastFrameNumber,LastFrameTime,DesiredFrameTime);
+
+      return true;
+   }
+
+   // The last decoded frame wasn't ok; either we need any new frame (after=-1), or a specific new frame with time>after
+
+   bool done=false;
+   while(!done)
+   {
+      // Read a frame
+      if(av_read_frame(pFormatCtx, &packet)<0)
+         return false;                             // Frame read failed (e.g. end of stream)
+
+      //qDebug("Packet of stream %d, size %d\n",packet.stream_index,packet.size);
+
+      if(packet.stream_index==videoStream)
+      {
+         // Is this a packet from the video stream -> decode video frame
+
+         int frameFinished;
+         avcodec_decode_video2(pCodecCtx,pFrame,&frameFinished,&packet);
+
+         //qDebug("used %d out of %d bytes\n",len,packet.size);
+
+         //qDebug("Frame type: ");
+         //if(pFrame->pict_type == FF_B_TYPE)
+         //   qDebug("B\n");
+         //else if (pFrame->pict_type == FF_I_TYPE)
+         //   qDebug("I\n");
+         //else
+         //   qDebug("P\n");
+
+
+         /*qDebug("codecctx time base: num: %d den: %d\n",pCodecCtx->time_base.num,pCodecCtx->time_base.den);
+         qDebug("formatctx time base: num: %d den: %d\n",pFormatCtx->streams[videoStream]->time_base.num,pFormatCtx->streams[videoStream]->time_base.den);
+         qDebug("pts: %ld\n",pts);
+         qDebug("dts: %ld\n",dts);*/
+
+
+
+
+         // Did we get a video frame?
+         if(frameFinished)
+         {
+            ffmpeg::AVRational millisecondbase = {1, 1000};
+            int f = packet.dts;
+            int t = ffmpeg::av_rescale_q(packet.dts,pFormatCtx->streams[videoStream]->time_base,millisecondbase);
+            if(LastFrameOk==false)
+            {
+               LastFrameOk=true;
+               LastLastFrameTime=LastFrameTime=t;
+               LastLastFrameNumber=LastFrameNumber=f;
+            }
+            else
+            {
+               // If we decoded 2 frames in a row, the last times are okay
+               LastLastFrameTime = LastFrameTime;
+               LastLastFrameNumber = LastFrameNumber;
+               LastFrameTime=t;
+               LastFrameNumber=f;
+            }
+            //qDebug("Frame %d @ %d. LastLastT: %d. LastLastF: %d. LastFrameOk: %d\n",LastFrameNumber,LastFrameTime,LastLastFrameTime,LastLastFrameNumber,(int)LastFrameOk);
+
+            // Is this frame the desired frame?
+            if(after==-1 || LastFrameNumber>=after)
+            {
+               // It's the desired frame
+
+               // Convert the image format (init the context the first time)
+               int w = pCodecCtx->width;
+               int h = pCodecCtx->height;
+               img_convert_ctx = ffmpeg::sws_getCachedContext(img_convert_ctx,w, h, pCodecCtx->pix_fmt, w, h, ffmpeg::PIX_FMT_RGB24, SWS_BICUBIC, NULL, NULL, NULL);
+
+               if(img_convert_ctx == NULL)
+               {
+                  qDebug("Cannot initialize the conversion context!\n");
+                  return false;
+               }
+               ffmpeg::sws_scale(img_convert_ctx, pFrame->data, pFrame->linesize, 0, pCodecCtx->height, pFrameRGB->data, pFrameRGB->linesize);
+
+               // Convert the frame to QImage
+               LastFrame=QImage(w,h,QImage::Format_RGB888);
+
+               for(int y=0;y<h;y++)
+                  memcpy(LastFrame.scanLine(y),pFrameRGB->data[0]+y*pFrameRGB->linesize[0],w*3);
+
+               // Set the time
+               DesiredFrameTime = ffmpeg::av_rescale_q(after,pFormatCtx->streams[videoStream]->time_base,millisecondbase);
+               LastFrameOk=true;
+
+
+               done = true;
+
+            } // frame of interest
+         }  // frameFinished
+      }  // stream_index==videoStream
+      av_free_packet(&packet);      // Free the packet that was allocated by av_read_frame
+   }
+   //qDebug("Returning new frame %d @ %d. LastLastT: %d. LastLastF: %d. LastFrameOk: %d\n",LastFrameNumber,LastFrameTime,LastLastFrameTime,LastLastFrameNumber,(int)LastFrameOk);
+   //qDebug("\n");
+   return done;   // done indicates whether or not we found a frame
+}
+
+/**
+   \brief Decodes the next frame in the video stream
+
+
+**/
+bool QVideoDecoder::seekNextFrame()
+{
+   bool ret = decodeSeekFrame(DesiredFrameNumber+1);
+
+   if(ret)
+      DesiredFrameNumber++;   // Only updates the DesiredFrameNumber if we were successful in getting that frame
+   else
+      LastFrameOk=false;      // We didn't find the next frame (e.g. seek out of range) - mark we don't know where we are.
+   return ret;
+}
+
+/**
+  \brief Seek to millisecond
+**/
+bool QVideoDecoder::seekMs(int tsms)
+{
+   if(!ok)
+      return false;
+
+
+   //qDebug("**** SEEK TO ms %d. LLT: %d. LT: %d. LLF: %d. LF: %d. LastFrameOk: %d\n",tsms,LastLastFrameTime,LastFrameTime,LastLastFrameNumber,LastFrameNumber,(int)LastFrameOk);
+
+   // Convert time into frame number
+   DesiredFrameNumber = ffmpeg::av_rescale(tsms,pFormatCtx->streams[videoStream]->time_base.den,pFormatCtx->streams[videoStream]->time_base.num);
+   DesiredFrameNumber/=1000;
+
+   return seekFrame(DesiredFrameNumber);
+}
+/**
+  \brief Seek to frame
+**/
+bool QVideoDecoder::seekFrame(int64_t frame)
+{
+
+   if(!ok)
+      return false;
+
+   //qDebug("**** seekFrame to %d. LLT: %d. LT: %d. LLF: %d. LF: %d. LastFrameOk: %d\n",(int)frame,LastLastFrameTime,LastFrameTime,LastLastFrameNumber,LastFrameNumber,(int)LastFrameOk);
+
+   // Seek if:
+   // - we don't know where we are (Ok=false)
+   // - we know where we are but:
+   //    - the desired frame is after the last decoded frame (this could be optimized: if the distance is small, calling decodeSeekFrame may be faster than seeking from the last key frame)
+   //    - the desired frame is smaller or equal than the previous to the last decoded frame. Equal because if frame==LastLastFrameNumber we don't want the LastFrame, but the one before->we need to seek there
+   if( (LastFrameOk==false) || ((LastFrameOk==true) && (frame<=LastLastFrameNumber || frame>LastFrameNumber) ) )
+   {
+      //qDebug("\t avformat_seek_file\n");
+      if(ffmpeg::avformat_seek_file(pFormatCtx,videoStream,0,frame,frame,AVSEEK_FLAG_FRAME)<0)
+         return false;
+
+      avcodec_flush_buffers(pCodecCtx);
+
+      DesiredFrameNumber = frame;
+      LastFrameOk=false;
+   }
+   //qDebug("\t decodeSeekFrame\n");
+
+   return decodeSeekFrame(frame);
+
+   return true;
+}
+
+
+
+bool QVideoDecoder::getFrame(QImage&img,int *effectiveframenumber,int *effectiveframetime,int *desiredframenumber,int *desiredframetime)
+{
+   img = LastFrame;
+
+   if(effectiveframenumber)
+      *effectiveframenumber = LastFrameNumber;
+   if(effectiveframetime)
+      *effectiveframetime = LastFrameTime;
+   if(desiredframenumber)
+      *desiredframenumber = DesiredFrameNumber;
+   if(desiredframetime)
+      *desiredframetime = DesiredFrameTime;
+
+   //qDebug("getFrame. Returning valid? %s. Desired %d @ %d. Effective %d @ %d\n",LastFrameOk?"yes":"no",DesiredFrameNumber,DesiredFrameTime,LastFrameNumber,LastFrameTime);
+
+   return LastFrameOk;
+}
+
+
+/**
+  \brief Debug function: saves a frame as PPM
+**/
+void QVideoDecoder::saveFramePPM(ffmpeg::AVFrame *pFrame, int width, int height, int iFrame)
+{
+    FILE *pFile;
+    char szFilename[32];
+    int  y;
+
+    // Open file
+    sprintf(szFilename, "frame%d.ppm", iFrame);
+    pFile=fopen(szFilename, "wb");
+    if(pFile==NULL)
+        return;
+
+    // Write header
+    fprintf(pFile, "P6\n%d %d\n255\n", width, height);
+
+    // Write pixel data
+    for(y=0; y<height; y++)
+        fwrite(pFrame->data[0]+y*pFrame->linesize[0], 1, width*3, pFile);
+
+    // Close file
+    fclose(pFile);
+}
+
+
+
+void QVideoDecoder::dumpFormat(ffmpeg::AVFormatContext *ic,
+                 int index,
+                 const char *url,
+                 int is_output)
+{
+    //int i;
+    uint8_t *printed = (uint8_t*)ffmpeg::av_mallocz(ic->nb_streams);
+    if (ic->nb_streams && !printed)
+        return;
+
+    qDebug("AV_TIME_BASE: %d\n",AV_TIME_BASE);
+
+    qDebug("%s #%d, %s,\n %s '%s':\n",
+            is_output ? "Output" : "Input",
+            index,
+            is_output ? ic->oformat->name : ic->iformat->name,
+            is_output ? "to" : "from", url);
+    if (!is_output) {
+        qDebug("  Duration: ");
+        //if (ic->duration != AV_NOPTS_VALUE)
+        {
+            int hours, mins, secs, us;
+            secs = ic->duration / AV_TIME_BASE;
+            us = ic->duration % AV_TIME_BASE;
+            mins = secs / 60;
+            secs %= 60;
+            hours = mins / 60;
+            mins %= 60;
+            qDebug("%02d:%02d:%02d.%02d\n", hours, mins, secs,
+                   (100 * us) / AV_TIME_BASE);
+        } //else {
+            //qDebug("N/A");
+        //}
+        //if (ic->start_time != AV_NOPTS_VALUE)
+        {
+            int secs, us;
+            qDebug(", start: ");
+            secs = ic->start_time / AV_TIME_BASE;
+            us = ic->start_time % AV_TIME_BASE;
+            qDebug("%d.%06d\n",
+                   secs, (int)ffmpeg::av_rescale(us, 1000000, AV_TIME_BASE));
+        }
+        qDebug(", bitrate: ");
+        if (ic->bit_rate) {
+            qDebug("%d kb/s\n", ic->bit_rate / 1000);
+        } else {
+            qDebug("N/A\n");
+        }
+        qDebug("\n");
+    }
+    if(ic->nb_programs) {
+        unsigned int j, total=0;
+        for(j=0; j<ic->nb_programs; j++) {
+            ffmpeg::AVMetadataTag *name = av_metadata_get(ic->programs[j]->metadata,
+                                                  "name", NULL, 0);
+            qDebug("  Program %d %s\n", ic->programs[j]->id,
+                   name ? name->value : "");
+            /*for(k=0; k<ic->programs[j]->nb_stream_indexes; k++) {
+                dump_stream_format(ic, ic->programs[j]->stream_index[k], index, is_output);
+                printed[ic->programs[j]->stream_index[k]] = 1;
+            }*/
+            total += ic->programs[j]->nb_stream_indexes;
+        }
+        if (total < ic->nb_streams)
+            qDebug( "  No Program\n");
+    }
+    /*for(i=0;i<ic->nb_streams;i++)
+        if (!printed[i])
+            ffmpeg::dump_stream_format(ic, i, index, is_output);*/
+
+    if (ic->metadata) {
+        ffmpeg::AVMetadataTag *tag=NULL;
+        qDebug("  Metadata\n");
+        while((tag=av_metadata_get(ic->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) {
+            qDebug("    %-16s: %s\n", tag->key, tag->value);
+        }
+    }
+    ffmpeg::av_free(printed);
+}
+
+int QVideoDecoder::getVideoLengthMs()
+{
+   if(!isOk())
+      return -1;
+
+
+   int secs = pFormatCtx->duration / AV_TIME_BASE;
+   int us = pFormatCtx->duration % AV_TIME_BASE;
+   int l = secs*1000 + us/1000;
+
+
+   dumpFormat(pFormatCtx,videoStream,"test video",0);
+
+   return l;
+}
diff --git a/gui/qffmpeg/QVideoDecoder.h b/gui/qffmpeg/QVideoDecoder.h
index 74e9ae8..94cbcb3 100644
--- a/gui/qffmpeg/QVideoDecoder.h
+++ b/gui/qffmpeg/QVideoDecoder.h
@@ -1,78 +1,78 @@
-/*
-	QTFFmpegWrapper - QT FFmpeg Wrapper Class 
-	Copyright (C) 2009,2010:
-			Daniel Roggen, droggen at gmail.com			
-			
-	All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
-   1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-   2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef __QVIDEODECODER_H
-#define __QVIDEODECODER_H
-
-
-#include <QIODevice>
-#include <QFile>
-#include <QImage>
-
-#include "ffmpeg.h"
-
-class QVideoDecoder
-{
-   protected:
-      // Basic FFmpeg stuff
-      ffmpeg::AVFormatContext *pFormatCtx;
-      int videoStream;
-      ffmpeg::AVCodecContext  *pCodecCtx;
-      ffmpeg::AVCodec         *pCodec;
-      ffmpeg::AVFrame         *pFrame;
-      ffmpeg::AVFrame         *pFrameRGB;
-      ffmpeg::AVPacket        packet;
-      ffmpeg::SwsContext      *img_convert_ctx;
-      uint8_t                 *buffer;
-      int                     numBytes;
-
-      // State infos for the wrapper
-      bool ok;
-      QImage LastFrame;
-      int LastFrameTime,LastLastFrameTime,LastLastFrameNumber,LastFrameNumber;
-      int DesiredFrameTime,DesiredFrameNumber;
-      bool LastFrameOk;                // Set upon start or after a seek we don't have a frame yet
-
-      // Initialization functions
-      virtual bool initCodec();
-      virtual void InitVars();
-
-      // Helpers
-      virtual void dumpFormat(ffmpeg::AVFormatContext *ic,int index,const char *url,int is_output);
-      virtual void saveFramePPM(ffmpeg::AVFrame *pFrame, int width, int height, int iFrame);
-
-      // Seek
-      virtual bool decodeSeekFrame(int after);
-
-   public:
-      // Public interface
-      QVideoDecoder();
-      QVideoDecoder(QString file);
-      virtual ~QVideoDecoder();
-
-      virtual bool openFile(QString file);
-      virtual void close();
-
-      virtual bool getFrame(QImage&img,int *effectiveframenumber=0,int *effectiveframetime=0,int *desiredframenumber=0,int *desiredframetime=0);
-      virtual bool seekNextFrame();
-      virtual bool seekMs(int ts);
-      virtual bool seekFrame(int64_t frame);
-      virtual int getVideoLengthMs();
-
-
-      virtual bool isOk();
-};
-
-#endif // __QVIDEODECODER_H
+/*
+	QTFFmpegWrapper - QT FFmpeg Wrapper Class
+	Copyright (C) 2009,2010:
+			Daniel Roggen, droggen at gmail.com
+
+	All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+   1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef __QVIDEODECODER_H
+#define __QVIDEODECODER_H
+
+
+#include <QIODevice>
+#include <QFile>
+#include <QImage>
+
+#include "ffmpeg.h"
+
+class QVideoDecoder
+{
+   protected:
+      // Basic FFmpeg stuff
+      ffmpeg::AVFormatContext *pFormatCtx;
+      int videoStream;
+      ffmpeg::AVCodecContext  *pCodecCtx;
+      ffmpeg::AVCodec         *pCodec;
+      ffmpeg::AVFrame         *pFrame;
+      ffmpeg::AVFrame         *pFrameRGB;
+      ffmpeg::AVPacket        packet;
+      ffmpeg::SwsContext      *img_convert_ctx;
+      uint8_t                 *buffer;
+      int                     numBytes;
+
+      // State infos for the wrapper
+      bool ok;
+      QImage LastFrame;
+      int LastFrameTime,LastLastFrameTime,LastLastFrameNumber,LastFrameNumber;
+      int DesiredFrameTime,DesiredFrameNumber;
+      bool LastFrameOk;                // Set upon start or after a seek we don't have a frame yet
+
+      // Initialization functions
+      virtual bool initCodec();
+      virtual void InitVars();
+
+      // Helpers
+      virtual void dumpFormat(ffmpeg::AVFormatContext *ic,int index,const char *url,int is_output);
+      virtual void saveFramePPM(ffmpeg::AVFrame *pFrame, int width, int height, int iFrame);
+
+      // Seek
+      virtual bool decodeSeekFrame(int after);
+
+   public:
+      // Public interface
+      QVideoDecoder();
+      QVideoDecoder(QString file);
+      virtual ~QVideoDecoder();
+
+      virtual bool openFile(QString file);
+      virtual void close();
+
+      virtual bool getFrame(QImage&img,int *effectiveframenumber=0,int *effectiveframetime=0,int *desiredframenumber=0,int *desiredframetime=0);
+      virtual bool seekNextFrame();
+      virtual bool seekMs(int ts);
+      virtual bool seekFrame(int64_t frame);
+      virtual int getVideoLengthMs();
+
+
+      virtual bool isOk();
+};
+
+#endif // __QVIDEODECODER_H
diff --git a/gui/qffmpeg/QVideoEncoder.cpp b/gui/qffmpeg/QVideoEncoder.cpp
index b18f93f..ff5e52a 100644
--- a/gui/qffmpeg/QVideoEncoder.cpp
+++ b/gui/qffmpeg/QVideoEncoder.cpp
@@ -1,549 +1,549 @@
-/*
-   QTFFmpegWrapper - QT FFmpeg Wrapper Class
-   Copyright (C) 2009-2012:
-         Daniel Roggen, droggen at gmail.com
-
-   All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
-   1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-   2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <QPainter>
-#include "QVideoEncoder.h"
-#include "ffmpeg.h"
-
-
-
-/******************************************************************************
-*******************************************************************************
-* QVideoEncoder   QVideoEncoder   QVideoEncoder   QVideoEncoder   QVideoEncoder
-*******************************************************************************
-******************************************************************************/
-
-
-/******************************************************************************
-* PUBLIC   PUBLIC   PUBLIC   PUBLIC   PUBLIC   PUBLIC   PUBLIC   PUBLIC   PUBLIC
-******************************************************************************/
-
-/**
-  gop: maximal interval in frames between keyframes
-**/
-QVideoEncoder::QVideoEncoder()
-{
-   initVars();
-   initCodec();
-}
-
-QVideoEncoder::~QVideoEncoder()
-{
-   close();
-   /*if(Initmodefile)
-   {
-      writeFooter();
-      Outdev->close();
-      delete Outdev;
-      Outdev=0;
-   }
-   else
-   {
-      // nothing to do
-   }*/
-}
-
-bool QVideoEncoder::createFile(QString fileName,unsigned width,unsigned height,unsigned bitrate,unsigned gop,unsigned fps)
-{
-   // If we had an open video, close it.
-   close();
-
-   Width=width;
-   Height=height;
-   Gop=gop;
-   Bitrate=bitrate;
-
-   if(!isSizeValid())
-   {
-      qDebug("Invalid size\n");
-      return false;
-   }
-
-   pOutputFormat = ffmpeg::av_guess_format(NULL, fileName.toStdString().c_str(), NULL);
-   if (!pOutputFormat) {
-      qDebug("Could not deduce output format from file extension: using MPEG.\n");
-      pOutputFormat = ffmpeg::av_guess_format("mpeg", NULL, NULL);
-   }
-
-   pFormatCtx=ffmpeg::avformat_alloc_context();
-   if(!pFormatCtx)
-   {
-      qDebug("Error allocating format context\n");
-      return false;
-   }
-   pFormatCtx->oformat = pOutputFormat;
-   snprintf(pFormatCtx->filename, sizeof(pFormatCtx->filename), "%s", fileName.toStdString().c_str());
-
-
-   // Add the video stream
-
-   pVideoStream = av_new_stream(pFormatCtx,0);
-   if(!pVideoStream )
-   {
-      qDebug("Could not allocate stream\n");
-      return false;
-   }
-
-
-   pCodecCtx=pVideoStream->codec;
-   pCodecCtx->codec_id = pOutputFormat->video_codec;
-   pCodecCtx->codec_type = ffmpeg::AVMEDIA_TYPE_VIDEO;
-
-   pCodecCtx->bit_rate = Bitrate;
-   pCodecCtx->width = getWidth();
-   pCodecCtx->height = getHeight();
-   pCodecCtx->time_base.den = fps;
-   pCodecCtx->time_base.num = 1;
-   pCodecCtx->gop_size = Gop;
-   pCodecCtx->pix_fmt = ffmpeg::PIX_FMT_YUV420P;
-
-
-   avcodec_thread_init(pCodecCtx, 10);
-
-   //if (c->codec_id == CODEC_ID_MPEG2VIDEO)
-   //{
-      //c->max_b_frames = 2;  // just for testing, we also add B frames
-   //}
-
-   // some formats want stream headers to be separate
-   if(pFormatCtx->oformat->flags & AVFMT_GLOBALHEADER)
-      pCodecCtx->flags |= CODEC_FLAG_GLOBAL_HEADER;
-
-
-   if (av_set_parameters(pFormatCtx, NULL) < 0)
-   {
-      qDebug("Invalid output format parameters\n");
-      return false;
-   }
-
-   ffmpeg::dump_format(pFormatCtx, 0, fileName.toStdString().c_str(), 1);
-
-   // open_video
-   // find the video encoder
-   pCodec = avcodec_find_encoder(pCodecCtx->codec_id);
-   if (!pCodec)
-   {
-      qDebug("codec not found\n");
-      return false;
-   }
-   // open the codec
-   if (avcodec_open(pCodecCtx, pCodec) < 0)
-   {
-      qDebug("could not open codec\n");
-      return false;
-   }
-
-   // Allocate memory for output
-   if(!initOutputBuf())
-   {
-      qDebug("Can't allocate memory for output bitstream\n");
-      return false;
-   }
-
-   // Allocate the YUV frame
-   if(!initFrame())
-   {
-      qDebug("Can't init frame\n");
-      return false;
-   }
-
-   if (url_fopen(&pFormatCtx->pb, fileName.toStdString().c_str(), URL_WRONLY) < 0)
-   {
-      qDebug( "Could not open '%s'\n", fileName.toStdString().c_str());
-      return false;
-   }
-
-   av_write_header(pFormatCtx);
-
-
-
-   ok=true;
-
-   return true;
-}
-
-/**
-   \brief Completes writing the stream, closes it, release resources.
-**/
-bool QVideoEncoder::close()
-{
-   if(!isOk())
-      return false;
-
-   av_write_trailer(pFormatCtx);
-
-   // close_video
-
-   avcodec_close(pVideoStream->codec);
-   freeFrame();
-   freeOutputBuf();
-
-
-   /* free the streams */
-
-   for(int i = 0; i < pFormatCtx->nb_streams; i++)
-   {
-      av_freep(&pFormatCtx->streams[i]->codec);
-      av_freep(&pFormatCtx->streams[i]);
-   }
-
-   // Close file
-   url_fclose(pFormatCtx->pb);
-
-   // Free the stream
-   av_free(pFormatCtx);
-
-   initVars();
-   return true;
-}
-
-
-/**
-   \brief Encode one frame
-
-   The frame must be of the same size as specified in the createFile call.
-
-   This is the standard method to encode videos with fixed frame rates.
-   Each call to encodeImage adds a frame, which will be played back at the frame rate
-   specified in the createFile call.
-**/
-int QVideoEncoder::encodeImage(const QImage &img)
-{
-   return encodeImage_p(img);
-}
-/**
-   \brief Encode one frame
-
-   The frame must be of the same size as specified in the createFile call.
-
-   This mehtod allows to specify the presentation time stamp (pts) of the frame.
-   pts is specified in multiples of 1/framerate, where framerate was specified in the createFile call
-   E.g. to encode frames with a 1ms resolution: set the frame rate to 1000, and pts is the presentation
-   time in milliseconds.
-   pts must be monotonously increasing.
-   The first frame ought to have a pts of 0 to be immediately displayed.
-**/
-int QVideoEncoder::encodeImagePts(const QImage &img,unsigned pts)
-{
-   return encodeImage_p(img,true,pts);
-}
-
-
-/******************************************************************************
-* INTERNAL   INTERNAL   INTERNAL   INTERNAL   INTERNAL   INTERNAL   INTERNAL
-******************************************************************************/
-
-void QVideoEncoder::initVars()
-{
-   ok=false;
-   pFormatCtx=0;
-   pOutputFormat=0;
-   pCodecCtx=0;
-   pVideoStream=0;
-   pCodec=0;
-   ppicture=0;
-   outbuf=0;
-   picture_buf=0;
-   img_convert_ctx=0;
-}
-
-
-/**
-   \brief Register the codecs
-**/
-bool QVideoEncoder::initCodec()
-{
-   ffmpeg::avcodec_init();
-   ffmpeg::av_register_all();
-
-   qDebug("License: %s\n",ffmpeg::avformat_license());
-   qDebug("AVCodec version %d\n",ffmpeg::avformat_version());
-   qDebug("AVFormat configuration: %s\n",ffmpeg::avformat_configuration());
-
-   return true;
-}
-
-/**
-   \brief Encode one frame - internal function
-   custompts: true if a custom presentation time stamp  is used
-   pts: presentation time stamp in milliseconds
-**/
-int QVideoEncoder::encodeImage_p(const QImage &img,bool custompts, unsigned pts)
-{
-   if(!isOk())
-      return -1;
-
-   //convertImage(img);       // Custom conversion routine
-   convertImage_sws(img);     // SWS conversion
-
-
-
-   if(custompts)                             // Handle custom pts
-         pCodecCtx->coded_frame->pts = pts;  // Set the time stamp
-
-   int out_size = ffmpeg::avcodec_encode_video(pCodecCtx,outbuf,outbuf_size,ppicture);
-   //qDebug("Frame size: %d\n",out_size);
-
-
-   if(custompts)                             // Handle custom pts (must set it again for the rest of the processing)
-         pCodecCtx->coded_frame->pts = pts;  // Set the time stamp
-
-   if (out_size > 0)
-   {
-
-      av_init_packet(&pkt);
-
-      //if (pCodecCtx->coded_frame->pts != AV_NOPTS_VALUE)
-      if (pCodecCtx->coded_frame->pts != (0x8000000000000000LL))
-         pkt.pts= av_rescale_q(pCodecCtx->coded_frame->pts, pCodecCtx->time_base, pVideoStream->time_base);
-      if(pCodecCtx->coded_frame->key_frame)
-         pkt.flags |= AV_PKT_FLAG_KEY;
-
-      //qDebug("c %d. pts %d. codedframepts: %ld pkt.pts: %ld\n",custompts,pts,pCodecCtx->coded_frame->pts,pkt.pts);
-
-      pkt.stream_index= pVideoStream->index;
-      pkt.data= outbuf;
-      pkt.size= out_size;
-      int ret = av_interleaved_write_frame(pFormatCtx, &pkt);
-      //qDebug("Wrote %d\n",ret);
-      if(ret<0)
-         return -1;
-   }
-   return out_size;
-}
-
-
-
-/**
-  Ensures sizes are some reasonable multiples
-**/
-bool QVideoEncoder::isSizeValid()
-{
-   if(getWidth()%8)
-      return false;
-   if(getHeight()%8)
-      return false;
-   return true;
-}
-
-unsigned QVideoEncoder::getWidth()
-{
-   return Width;
-}
-unsigned QVideoEncoder::getHeight()
-{
-   return Height;
-}
-bool QVideoEncoder::isOk()
-{
-   return ok;
-}
-
-/**
-  Allocate memory for the compressed bitstream
-**/
-bool QVideoEncoder::initOutputBuf()
-{
-   outbuf_size = getWidth()*getHeight()*3;        // Some extremely generous memory allocation for the encoded frame.
-   outbuf = new uint8_t[outbuf_size];
-   if(outbuf==0)
-      return false;
-   return true;
-}
-/**
-  Free memory for the compressed bitstream
-**/
-void QVideoEncoder::freeOutputBuf()
-{
-   if(outbuf)
-   {
-      delete[] outbuf;
-      outbuf=0;
-   }
-}
-
-bool QVideoEncoder::initFrame()
-{
-   ppicture = ffmpeg::avcodec_alloc_frame();
-   if(ppicture==0)
-      return false;
-
-   int size = avpicture_get_size(pCodecCtx->pix_fmt, pCodecCtx->width, pCodecCtx->height);
-   picture_buf = new uint8_t[size];
-   if(picture_buf==0)
-   {
-      av_free(ppicture);
-      ppicture=0;
-      return false;
-   }
-
-   // Setup the planes
-   avpicture_fill((ffmpeg::AVPicture *)ppicture, picture_buf,pCodecCtx->pix_fmt, pCodecCtx->width, pCodecCtx->height);
-
-   return true;
-}
-void QVideoEncoder::freeFrame()
-{
-   if(picture_buf)
-   {
-      delete[] picture_buf;
-      picture_buf=0;
-   }
-   if(ppicture)
-   {
-      av_free(ppicture);
-      ppicture=0;
-   }
-}
-
-/**
-  \brief Convert the QImage to the internal YUV format
-
-  Custom conversion - not very optimized.
-
-**/
-
-bool QVideoEncoder::convertImage(const QImage &img)
-{
-   // Check if the image matches the size
-   if(img.width()!=getWidth() || img.height()!=getHeight())
-   {
-      qDebug("Wrong image size!\n");
-      return false;
-   }
-   if(img.format()!=QImage::Format_RGB32	&& img.format() != QImage::Format_ARGB32)
-   {
-      qDebug("Wrong image format\n");
-      return false;
-   }
-
-   // RGB32 to YUV420
-
-   int size = getWidth()*getHeight();
-   // Y
-   for(unsigned y=0;y<getHeight();y++)
-   {
-
-      unsigned char *s = (unsigned char*)img.scanLine(y);
-      unsigned char *d = (unsigned char*)&picture_buf[y*getWidth()];
-      //qDebug("Line %d. d: %p. picture_buf: %p\n",y,d,picture_buf);
-
-      for(unsigned x=0;x<getWidth();x++)
-      {
-         unsigned int r=s[2];
-         unsigned int g=s[1];
-         unsigned int b=s[0];
-
-         unsigned Y = (r*2104 + g*4130 + b*802 + 4096 + 131072) >> 13;
-         if(Y>235) Y=235;
-
-         *d = Y;
-
-         d+=1;
-         s+=4;
-      }
-   }
-
-   // U,V
-   for(unsigned y=0;y<getHeight();y+=2)
-   {
-      unsigned char *s = (unsigned char*)img.scanLine(y);
-      unsigned int ss = img.bytesPerLine();
-      unsigned char *d = (unsigned char*)&picture_buf[size+y/2*getWidth()/2];
-
-      //qDebug("Line %d. d: %p. picture_buf: %p\n",y,d,picture_buf);
-
-      for(unsigned x=0;x<getWidth();x+=2)
-      {
-         // Cr = 128 + 1/256 * ( 112.439 * R'd -  94.154 * G'd -  18.285 * B'd)
-         // Cb = 128 + 1/256 * (- 37.945 * R'd -  74.494 * G'd + 112.439 * B'd)
-
-         // Get the average RGB in a 2x2 block
-         int r=(s[2] + s[6] + s[ss+2] + s[ss+6] + 2) >> 2;
-         int g=(s[1] + s[5] + s[ss+1] + s[ss+5] + 2) >> 2;
-         int b=(s[0] + s[4] + s[ss+0] + s[ss+4] + 2) >> 2;
-
-         int Cb = (-1214*r - 2384*g + 3598*b + 4096 + 1048576)>>13;
-         if(Cb<16)
-            Cb=16;
-         if(Cb>240)
-            Cb=240;
-
-         int Cr = (3598*r - 3013*g - 585*b + 4096 + 1048576)>>13;
-         if(Cr<16)
-            Cr=16;
-         if(Cr>240)
-            Cr=240;
-
-         *d = Cb;
-         *(d+size/4) = Cr;
-
-         d+=1;
-         s+=8;
-      }
-   }
-   return true;
-}
-
-/**
-  \brief Convert the QImage to the internal YUV format
-
-  SWS conversion
-
-   Caution: the QImage is allocated by QT without guarantee about the alignment and bytes per lines.
-   It *should* be okay as we make sure the image is a multiple of many bytes (8 or 16)...
-   ... however it is not guaranteed that sws_scale won't at some point require more bytes per line.
-   We keep the custom conversion for that case.
-
-**/
-
-bool QVideoEncoder::convertImage_sws(const QImage &img)
-{
-   // Check if the image matches the size
-   if(img.width()!=getWidth() || img.height()!=getHeight())
-   {
-      qDebug("Wrong image size!\n");
-      return false;
-   }
-   if(img.format()!=QImage::Format_RGB32	&& img.format() != QImage::Format_ARGB32)
-   {
-      qDebug("Wrong image format\n");
-      return false;
-   }
-
-   img_convert_ctx = ffmpeg::sws_getCachedContext(img_convert_ctx,getWidth(),getHeight(),ffmpeg::PIX_FMT_BGRA,getWidth(),getHeight(),ffmpeg::PIX_FMT_YUV420P,SWS_BICUBIC, NULL, NULL, NULL);
-   //img_convert_ctx = ffmpeg::sws_getCachedContext(img_convert_ctx,getWidth(),getHeight(),ffmpeg::PIX_FMT_BGRA,getWidth(),getHeight(),ffmpeg::PIX_FMT_YUV420P,SWS_FAST_BILINEAR, NULL, NULL, NULL);
-   if (img_convert_ctx == NULL)
-   {
-      qDebug("Cannot initialize the conversion context\n");
-      return false;
-   }
-
-   uint8_t *srcplanes[3];
-   srcplanes[0]=(uint8_t*)img.bits();
-   srcplanes[1]=0;
-   srcplanes[2]=0;
-
-   int srcstride[3];
-   srcstride[0]=img.bytesPerLine();
-   srcstride[1]=0;
-   srcstride[2]=0;
-
-
-   ffmpeg::sws_scale(img_convert_ctx, srcplanes, srcstride,0, getHeight(), ppicture->data, ppicture->linesize);
-
-   return true;
-}
-
+/*
+   QTFFmpegWrapper - QT FFmpeg Wrapper Class
+   Copyright (C) 2009-2012:
+         Daniel Roggen, droggen at gmail.com
+
+   All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+   1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <QPainter>
+#include "QVideoEncoder.h"
+#include "ffmpeg.h"
+
+
+
+/******************************************************************************
+*******************************************************************************
+* QVideoEncoder   QVideoEncoder   QVideoEncoder   QVideoEncoder   QVideoEncoder
+*******************************************************************************
+******************************************************************************/
+
+
+/******************************************************************************
+* PUBLIC   PUBLIC   PUBLIC   PUBLIC   PUBLIC   PUBLIC   PUBLIC   PUBLIC   PUBLIC
+******************************************************************************/
+
+/**
+  gop: maximal interval in frames between keyframes
+**/
+QVideoEncoder::QVideoEncoder()
+{
+   initVars();
+   initCodec();
+}
+
+QVideoEncoder::~QVideoEncoder()
+{
+   close();
+   /*if(Initmodefile)
+   {
+      writeFooter();
+      Outdev->close();
+      delete Outdev;
+      Outdev=0;
+   }
+   else
+   {
+      // nothing to do
+   }*/
+}
+
+bool QVideoEncoder::createFile(QString fileName,unsigned width,unsigned height,unsigned bitrate,unsigned gop,unsigned fps)
+{
+   // If we had an open video, close it.
+   close();
+
+   Width=width;
+   Height=height;
+   Gop=gop;
+   Bitrate=bitrate;
+
+   if(!isSizeValid())
+   {
+      qDebug("Invalid size\n");
+      return false;
+   }
+
+   pOutputFormat = ffmpeg::av_guess_format(NULL, fileName.toStdString().c_str(), NULL);
+   if (!pOutputFormat) {
+      qDebug("Could not deduce output format from file extension: using MPEG.\n");
+      pOutputFormat = ffmpeg::av_guess_format("mpeg", NULL, NULL);
+   }
+
+   pFormatCtx=ffmpeg::avformat_alloc_context();
+   if(!pFormatCtx)
+   {
+      qDebug("Error allocating format context\n");
+      return false;
+   }
+   pFormatCtx->oformat = pOutputFormat;
+   snprintf(pFormatCtx->filename, sizeof(pFormatCtx->filename), "%s", fileName.toStdString().c_str());
+
+
+   // Add the video stream
+
+   pVideoStream = av_new_stream(pFormatCtx,0);
+   if(!pVideoStream )
+   {
+      qDebug("Could not allocate stream\n");
+      return false;
+   }
+
+
+   pCodecCtx=pVideoStream->codec;
+   pCodecCtx->codec_id = pOutputFormat->video_codec;
+   pCodecCtx->codec_type = ffmpeg::AVMEDIA_TYPE_VIDEO;
+
+   pCodecCtx->bit_rate = Bitrate;
+   pCodecCtx->width = getWidth();
+   pCodecCtx->height = getHeight();
+   pCodecCtx->time_base.den = fps;
+   pCodecCtx->time_base.num = 1;
+   pCodecCtx->gop_size = Gop;
+   pCodecCtx->pix_fmt = ffmpeg::PIX_FMT_YUV420P;
+
+
+   avcodec_thread_init(pCodecCtx, 10);
+
+   //if (c->codec_id == CODEC_ID_MPEG2VIDEO)
+   //{
+      //c->max_b_frames = 2;  // just for testing, we also add B frames
+   //}
+
+   // some formats want stream headers to be separate
+   if(pFormatCtx->oformat->flags & AVFMT_GLOBALHEADER)
+      pCodecCtx->flags |= CODEC_FLAG_GLOBAL_HEADER;
+
+
+   if (av_set_parameters(pFormatCtx, NULL) < 0)
+   {
+      qDebug("Invalid output format parameters\n");
+      return false;
+   }
+
+   ffmpeg::dump_format(pFormatCtx, 0, fileName.toStdString().c_str(), 1);
+
+   // open_video
+   // find the video encoder
+   pCodec = avcodec_find_encoder(pCodecCtx->codec_id);
+   if (!pCodec)
+   {
+      qDebug("codec not found\n");
+      return false;
+   }
+   // open the codec
+   if (avcodec_open(pCodecCtx, pCodec) < 0)
+   {
+      qDebug("could not open codec\n");
+      return false;
+   }
+
+   // Allocate memory for output
+   if(!initOutputBuf())
+   {
+      qDebug("Can't allocate memory for output bitstream\n");
+      return false;
+   }
+
+   // Allocate the YUV frame
+   if(!initFrame())
+   {
+      qDebug("Can't init frame\n");
+      return false;
+   }
+
+   if (url_fopen(&pFormatCtx->pb, fileName.toStdString().c_str(), URL_WRONLY) < 0)
+   {
+      qDebug( "Could not open '%s'\n", fileName.toStdString().c_str());
+      return false;
+   }
+
+   av_write_header(pFormatCtx);
+
+
+
+   ok=true;
+
+   return true;
+}
+
+/**
+   \brief Completes writing the stream, closes it, release resources.
+**/
+bool QVideoEncoder::close()
+{
+   if(!isOk())
+      return false;
+
+   av_write_trailer(pFormatCtx);
+
+   // close_video
+
+   avcodec_close(pVideoStream->codec);
+   freeFrame();
+   freeOutputBuf();
+
+
+   /* free the streams */
+
+   for(int i = 0; i < pFormatCtx->nb_streams; i++)
+   {
+      av_freep(&pFormatCtx->streams[i]->codec);
+      av_freep(&pFormatCtx->streams[i]);
+   }
+
+   // Close file
+   url_fclose(pFormatCtx->pb);
+
+   // Free the stream
+   av_free(pFormatCtx);
+
+   initVars();
+   return true;
+}
+
+
+/**
+   \brief Encode one frame
+
+   The frame must be of the same size as specified in the createFile call.
+
+   This is the standard method to encode videos with fixed frame rates.
+   Each call to encodeImage adds a frame, which will be played back at the frame rate
+   specified in the createFile call.
+**/
+int QVideoEncoder::encodeImage(const QImage &img)
+{
+   return encodeImage_p(img);
+}
+/**
+   \brief Encode one frame
+
+   The frame must be of the same size as specified in the createFile call.
+
+   This mehtod allows to specify the presentation time stamp (pts) of the frame.
+   pts is specified in multiples of 1/framerate, where framerate was specified in the createFile call
+   E.g. to encode frames with a 1ms resolution: set the frame rate to 1000, and pts is the presentation
+   time in milliseconds.
+   pts must be monotonously increasing.
+   The first frame ought to have a pts of 0 to be immediately displayed.
+**/
+int QVideoEncoder::encodeImagePts(const QImage &img,unsigned pts)
+{
+   return encodeImage_p(img,true,pts);
+}
+
+
+/******************************************************************************
+* INTERNAL   INTERNAL   INTERNAL   INTERNAL   INTERNAL   INTERNAL   INTERNAL
+******************************************************************************/
+
+void QVideoEncoder::initVars()
+{
+   ok=false;
+   pFormatCtx=0;
+   pOutputFormat=0;
+   pCodecCtx=0;
+   pVideoStream=0;
+   pCodec=0;
+   ppicture=0;
+   outbuf=0;
+   picture_buf=0;
+   img_convert_ctx=0;
+}
+
+
+/**
+   \brief Register the codecs
+**/
+bool QVideoEncoder::initCodec()
+{
+   ffmpeg::avcodec_init();
+   ffmpeg::av_register_all();
+
+   qDebug("License: %s\n",ffmpeg::avformat_license());
+   qDebug("AVCodec version %d\n",ffmpeg::avformat_version());
+   qDebug("AVFormat configuration: %s\n",ffmpeg::avformat_configuration());
+
+   return true;
+}
+
+/**
+   \brief Encode one frame - internal function
+   custompts: true if a custom presentation time stamp  is used
+   pts: presentation time stamp in milliseconds
+**/
+int QVideoEncoder::encodeImage_p(const QImage &img,bool custompts, unsigned pts)
+{
+   if(!isOk())
+      return -1;
+
+   //convertImage(img);       // Custom conversion routine
+   convertImage_sws(img);     // SWS conversion
+
+
+
+   if(custompts)                             // Handle custom pts
+         pCodecCtx->coded_frame->pts = pts;  // Set the time stamp
+
+   int out_size = ffmpeg::avcodec_encode_video(pCodecCtx,outbuf,outbuf_size,ppicture);
+   //qDebug("Frame size: %d\n",out_size);
+
+
+   if(custompts)                             // Handle custom pts (must set it again for the rest of the processing)
+         pCodecCtx->coded_frame->pts = pts;  // Set the time stamp
+
+   if (out_size > 0)
+   {
+
+      av_init_packet(&pkt);
+
+      //if (pCodecCtx->coded_frame->pts != AV_NOPTS_VALUE)
+      if (pCodecCtx->coded_frame->pts != (0x8000000000000000LL))
+         pkt.pts= av_rescale_q(pCodecCtx->coded_frame->pts, pCodecCtx->time_base, pVideoStream->time_base);
+      if(pCodecCtx->coded_frame->key_frame)
+         pkt.flags |= AV_PKT_FLAG_KEY;
+
+      //qDebug("c %d. pts %d. codedframepts: %ld pkt.pts: %ld\n",custompts,pts,pCodecCtx->coded_frame->pts,pkt.pts);
+
+      pkt.stream_index= pVideoStream->index;
+      pkt.data= outbuf;
+      pkt.size= out_size;
+      int ret = av_interleaved_write_frame(pFormatCtx, &pkt);
+      //qDebug("Wrote %d\n",ret);
+      if(ret<0)
+         return -1;
+   }
+   return out_size;
+}
+
+
+
+/**
+  Ensures sizes are some reasonable multiples
+**/
+bool QVideoEncoder::isSizeValid()
+{
+   if(getWidth()%8)
+      return false;
+   if(getHeight()%8)
+      return false;
+   return true;
+}
+
+unsigned QVideoEncoder::getWidth()
+{
+   return Width;
+}
+unsigned QVideoEncoder::getHeight()
+{
+   return Height;
+}
+bool QVideoEncoder::isOk()
+{
+   return ok;
+}
+
+/**
+  Allocate memory for the compressed bitstream
+**/
+bool QVideoEncoder::initOutputBuf()
+{
+   outbuf_size = getWidth()*getHeight()*3;        // Some extremely generous memory allocation for the encoded frame.
+   outbuf = new uint8_t[outbuf_size];
+   if(outbuf==0)
+      return false;
+   return true;
+}
+/**
+  Free memory for the compressed bitstream
+**/
+void QVideoEncoder::freeOutputBuf()
+{
+   if(outbuf)
+   {
+      delete[] outbuf;
+      outbuf=0;
+   }
+}
+
+bool QVideoEncoder::initFrame()
+{
+   ppicture = ffmpeg::avcodec_alloc_frame();
+   if(ppicture==0)
+      return false;
+
+   int size = avpicture_get_size(pCodecCtx->pix_fmt, pCodecCtx->width, pCodecCtx->height);
+   picture_buf = new uint8_t[size];
+   if(picture_buf==0)
+   {
+      av_free(ppicture);
+      ppicture=0;
+      return false;
+   }
+
+   // Setup the planes
+   avpicture_fill((ffmpeg::AVPicture *)ppicture, picture_buf,pCodecCtx->pix_fmt, pCodecCtx->width, pCodecCtx->height);
+
+   return true;
+}
+void QVideoEncoder::freeFrame()
+{
+   if(picture_buf)
+   {
+      delete[] picture_buf;
+      picture_buf=0;
+   }
+   if(ppicture)
+   {
+      av_free(ppicture);
+      ppicture=0;
+   }
+}
+
+/**
+  \brief Convert the QImage to the internal YUV format
+
+  Custom conversion - not very optimized.
+
+**/
+
+bool QVideoEncoder::convertImage(const QImage &img)
+{
+   // Check if the image matches the size
+   if(img.width()!=getWidth() || img.height()!=getHeight())
+   {
+      qDebug("Wrong image size!\n");
+      return false;
+   }
+   if(img.format()!=QImage::Format_RGB32	&& img.format() != QImage::Format_ARGB32)
+   {
+      qDebug("Wrong image format\n");
+      return false;
+   }
+
+   // RGB32 to YUV420
+
+   int size = getWidth()*getHeight();
+   // Y
+   for(unsigned y=0;y<getHeight();y++)
+   {
+
+      unsigned char *s = (unsigned char*)img.scanLine(y);
+      unsigned char *d = (unsigned char*)&picture_buf[y*getWidth()];
+      //qDebug("Line %d. d: %p. picture_buf: %p\n",y,d,picture_buf);
+
+      for(unsigned x=0;x<getWidth();x++)
+      {
+         unsigned int r=s[2];
+         unsigned int g=s[1];
+         unsigned int b=s[0];
+
+         unsigned Y = (r*2104 + g*4130 + b*802 + 4096 + 131072) >> 13;
+         if(Y>235) Y=235;
+
+         *d = Y;
+
+         d+=1;
+         s+=4;
+      }
+   }
+
+   // U,V
+   for(unsigned y=0;y<getHeight();y+=2)
+   {
+      unsigned char *s = (unsigned char*)img.scanLine(y);
+      unsigned int ss = img.bytesPerLine();
+      unsigned char *d = (unsigned char*)&picture_buf[size+y/2*getWidth()/2];
+
+      //qDebug("Line %d. d: %p. picture_buf: %p\n",y,d,picture_buf);
+
+      for(unsigned x=0;x<getWidth();x+=2)
+      {
+         // Cr = 128 + 1/256 * ( 112.439 * R'd -  94.154 * G'd -  18.285 * B'd)
+         // Cb = 128 + 1/256 * (- 37.945 * R'd -  74.494 * G'd + 112.439 * B'd)
+
+         // Get the average RGB in a 2x2 block
+         int r=(s[2] + s[6] + s[ss+2] + s[ss+6] + 2) >> 2;
+         int g=(s[1] + s[5] + s[ss+1] + s[ss+5] + 2) >> 2;
+         int b=(s[0] + s[4] + s[ss+0] + s[ss+4] + 2) >> 2;
+
+         int Cb = (-1214*r - 2384*g + 3598*b + 4096 + 1048576)>>13;
+         if(Cb<16)
+            Cb=16;
+         if(Cb>240)
+            Cb=240;
+
+         int Cr = (3598*r - 3013*g - 585*b + 4096 + 1048576)>>13;
+         if(Cr<16)
+            Cr=16;
+         if(Cr>240)
+            Cr=240;
+
+         *d = Cb;
+         *(d+size/4) = Cr;
+
+         d+=1;
+         s+=8;
+      }
+   }
+   return true;
+}
+
+/**
+  \brief Convert the QImage to the internal YUV format
+
+  SWS conversion
+
+   Caution: the QImage is allocated by QT without guarantee about the alignment and bytes per lines.
+   It *should* be okay as we make sure the image is a multiple of many bytes (8 or 16)...
+   ... however it is not guaranteed that sws_scale won't at some point require more bytes per line.
+   We keep the custom conversion for that case.
+
+**/
+
+bool QVideoEncoder::convertImage_sws(const QImage &img)
+{
+   // Check if the image matches the size
+   if(img.width()!=getWidth() || img.height()!=getHeight())
+   {
+      qDebug("Wrong image size!\n");
+      return false;
+   }
+   if(img.format()!=QImage::Format_RGB32	&& img.format() != QImage::Format_ARGB32)
+   {
+      qDebug("Wrong image format\n");
+      return false;
+   }
+
+   img_convert_ctx = ffmpeg::sws_getCachedContext(img_convert_ctx,getWidth(),getHeight(),ffmpeg::PIX_FMT_BGRA,getWidth(),getHeight(),ffmpeg::PIX_FMT_YUV420P,SWS_BICUBIC, NULL, NULL, NULL);
+   //img_convert_ctx = ffmpeg::sws_getCachedContext(img_convert_ctx,getWidth(),getHeight(),ffmpeg::PIX_FMT_BGRA,getWidth(),getHeight(),ffmpeg::PIX_FMT_YUV420P,SWS_FAST_BILINEAR, NULL, NULL, NULL);
+   if (img_convert_ctx == NULL)
+   {
+      qDebug("Cannot initialize the conversion context\n");
+      return false;
+   }
+
+   uint8_t *srcplanes[3];
+   srcplanes[0]=(uint8_t*)img.bits();
+   srcplanes[1]=0;
+   srcplanes[2]=0;
+
+   int srcstride[3];
+   srcstride[0]=img.bytesPerLine();
+   srcstride[1]=0;
+   srcstride[2]=0;
+
+
+   ffmpeg::sws_scale(img_convert_ctx, srcplanes, srcstride,0, getHeight(), ppicture->data, ppicture->linesize);
+
+   return true;
+}
+
diff --git a/gui/qffmpeg/QVideoEncoder.h b/gui/qffmpeg/QVideoEncoder.h
index 4cd1e81..50398c1 100644
--- a/gui/qffmpeg/QVideoEncoder.h
+++ b/gui/qffmpeg/QVideoEncoder.h
@@ -1,91 +1,91 @@
-/*
-   QTFFmpegWrapper - QT FFmpeg Wrapper Class
-   Copyright (C) 2009-2012:
-         Daniel Roggen, droggen at gmail.com
-
-   All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
-   1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-   2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef __QVideoEncoder_H
-#define __QVideoEncoder_H
-
-
-#include <QIODevice>
-#include <QFile>
-#include <QImage>
-
-#include "ffmpeg.h"
-
-class QVideoEncoder
-{
-   protected:
-      unsigned Width,Height;
-      unsigned Bitrate;
-      unsigned Gop;
-      bool ok;
-
-      // FFmpeg stuff
-      ffmpeg::AVFormatContext *pFormatCtx;
-      ffmpeg::AVOutputFormat *pOutputFormat;
-      ffmpeg::AVCodecContext *pCodecCtx;
-      ffmpeg::AVStream *pVideoStream;
-      ffmpeg::AVCodec *pCodec;
-      // Frame data
-      ffmpeg::AVFrame *ppicture;
-      uint8_t *picture_buf;
-      // Compressed data
-      int outbuf_size;
-      uint8_t* outbuf;
-      // Conversion
-      ffmpeg::SwsContext *img_convert_ctx;
-      // Packet
-      ffmpeg::AVPacket pkt;
-
-      QString fileName;
-
-      unsigned getWidth();
-      unsigned getHeight();
-      bool isSizeValid();
-
-      void initVars();
-      bool initCodec();
-
-      // Alloc/free the output buffer
-      bool initOutputBuf();
-      void freeOutputBuf();
-
-      // Alloc/free a frame
-      bool initFrame();
-      void freeFrame();
-
-      // Frame conversion
-      bool convertImage(const QImage &img);
-      bool convertImage_sws(const QImage &img);
-
-      virtual int encodeImage_p(const QImage &,bool custompts=false,unsigned pts=0);
-
-
-   public:
-      QVideoEncoder();
-      virtual ~QVideoEncoder();
-
-      bool createFile(QString filename,unsigned width,unsigned height,unsigned bitrate,unsigned gop,unsigned fps=25);
-      virtual bool close();
-
-      virtual int encodeImage(const QImage &);
-      virtual int encodeImagePts(const QImage &,unsigned pts);
-      virtual bool isOk();  
-
-};
-
-
-
-
-#endif // QVideoEncoder_H
+/*
+   QTFFmpegWrapper - QT FFmpeg Wrapper Class
+   Copyright (C) 2009-2012:
+         Daniel Roggen, droggen at gmail.com
+
+   All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+   1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef __QVideoEncoder_H
+#define __QVideoEncoder_H
+
+
+#include <QIODevice>
+#include <QFile>
+#include <QImage>
+
+#include "ffmpeg.h"
+
+class QVideoEncoder
+{
+   protected:
+      unsigned Width,Height;
+      unsigned Bitrate;
+      unsigned Gop;
+      bool ok;
+
+      // FFmpeg stuff
+      ffmpeg::AVFormatContext *pFormatCtx;
+      ffmpeg::AVOutputFormat *pOutputFormat;
+      ffmpeg::AVCodecContext *pCodecCtx;
+      ffmpeg::AVStream *pVideoStream;
+      ffmpeg::AVCodec *pCodec;
+      // Frame data
+      ffmpeg::AVFrame *ppicture;
+      uint8_t *picture_buf;
+      // Compressed data
+      int outbuf_size;
+      uint8_t* outbuf;
+      // Conversion
+      ffmpeg::SwsContext *img_convert_ctx;
+      // Packet
+      ffmpeg::AVPacket pkt;
+
+      QString fileName;
+
+      unsigned getWidth();
+      unsigned getHeight();
+      bool isSizeValid();
+
+      void initVars();
+      bool initCodec();
+
+      // Alloc/free the output buffer
+      bool initOutputBuf();
+      void freeOutputBuf();
+
+      // Alloc/free a frame
+      bool initFrame();
+      void freeFrame();
+
+      // Frame conversion
+      bool convertImage(const QImage &img);
+      bool convertImage_sws(const QImage &img);
+
+      virtual int encodeImage_p(const QImage &,bool custompts=false,unsigned pts=0);
+
+
+   public:
+      QVideoEncoder();
+      virtual ~QVideoEncoder();
+
+      bool createFile(QString filename,unsigned width,unsigned height,unsigned bitrate,unsigned gop,unsigned fps=25);
+      virtual bool close();
+
+      virtual int encodeImage(const QImage &);
+      virtual int encodeImagePts(const QImage &,unsigned pts);
+      virtual bool isOk();
+
+};
+
+
+
+
+#endif // QVideoEncoder_H
diff --git a/gui/qffmpeg/ffmpeg.h b/gui/qffmpeg/ffmpeg.h
index 600e7eb..405fcdb 100644
--- a/gui/qffmpeg/ffmpeg.h
+++ b/gui/qffmpeg/ffmpeg.h
@@ -1,63 +1,63 @@
-/*
-	QTFFmpegWrapper - QT FFmpeg Wrapper Class 
-	Copyright (C) 2009,2010:
-			Daniel Roggen, droggen at gmail.com			
-			
-	All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
-   1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-   2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-/*
-   Wraps the ffmpeg includes in a namespace and ensures extern "C"
-*/
-
-#ifndef _FFMPEG_H
-#define _FFMPEG_H
-
-namespace ffmpeg {
-extern "C" {
-
-/*#define INT64_C
-
-#define __STDC_CONSTANT_MACROS
-
-#include <stdint.h>*/
-
-
-
-#include "libavcodec/avcodec.h"
-#include "libavformat/avformat.h"
-#include "libavutil/mathematics.h"
-//#include "libavformat/riff.h"
-//#include "libavformat/metadata.h"
-//#include "libavformat/utils.h"
-#include "libavcodec/opt.h"
-#include "libavutil/rational.h"
-//#include "options.h"
-#include "libavutil/avstring.h"
-//#include "libavutil/internal.h"
-#include "libswscale/swscale.h"
-}
-}
-
-/*
-#ifndef INT64_MIN
-#define INT64_MIN       (-0x7fffffffffffffffLL-1)
-#endif
-
-#ifndef INT64_MAX
-#define INT64_MAX 9223372036854775807LL
-#endif*/
-
-
-/*#ifndef INT64_C
-#define INT64_C(value) __CONCAT(value, LL)
-#endif*/
-
-
-#endif // _FFMPEG_H
+/*
+	QTFFmpegWrapper - QT FFmpeg Wrapper Class
+	Copyright (C) 2009,2010:
+			Daniel Roggen, droggen at gmail.com
+
+	All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+   1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+/*
+   Wraps the ffmpeg includes in a namespace and ensures extern "C"
+*/
+
+#ifndef _FFMPEG_H
+#define _FFMPEG_H
+
+namespace ffmpeg {
+extern "C" {
+
+/*#define INT64_C
+
+#define __STDC_CONSTANT_MACROS
+
+#include <stdint.h>*/
+
+
+
+#include "libavcodec/avcodec.h"
+#include "libavformat/avformat.h"
+#include "libavutil/mathematics.h"
+//#include "libavformat/riff.h"
+//#include "libavformat/metadata.h"
+//#include "libavformat/utils.h"
+#include "libavcodec/opt.h"
+#include "libavutil/rational.h"
+//#include "options.h"
+#include "libavutil/avstring.h"
+//#include "libavutil/internal.h"
+#include "libswscale/swscale.h"
+}
+}
+
+/*
+#ifndef INT64_MIN
+#define INT64_MIN       (-0x7fffffffffffffffLL-1)
+#endif
+
+#ifndef INT64_MAX
+#define INT64_MAX 9223372036854775807LL
+#endif*/
+
+
+/*#ifndef INT64_C
+#define INT64_C(value) __CONCAT(value, LL)
+#endif*/
+
+
+#endif // _FFMPEG_H
diff --git a/gui/uihelp.cpp b/gui/uihelp.cpp
index 45c852f..9c09675 100644
--- a/gui/uihelp.cpp
+++ b/gui/uihelp.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/gui/uihelp.h b/gui/uihelp.h
index 882a1ca..3662ff5 100644
--- a/gui/uihelp.h
+++ b/gui/uihelp.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/gui/uiinspector.cpp b/gui/uiinspector.cpp
index 98660c9..fd62c74 100644
--- a/gui/uiinspector.cpp
+++ b/gui/uiinspector.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
@@ -79,6 +79,8 @@ UiInspector::UiInspector(QWidget *parent) :
     Help::syncHelpWith(ui->easingCombo,       COMMAND_CURSOR_START);
     Help::syncHelpWith(ui->patternLine,       COMMAND_CURSOR_START);
 
+    Help::syncHelpWith(ui->fireTriggers,      COMMAND_CURSOR_FIRE);
+
     Help::syncHelpWith(ui->colorCombo1,       COMMAND_COLOR_ACTIVE);
     Help::syncHelpWith(ui->colorCombo1,       COMMAND_COLOR_ACTIVE_HUE);
     Help::syncHelpWith(ui->colorCombo2,       COMMAND_COLOR_INACTIVE);
@@ -155,7 +157,6 @@ UiInspector::UiInspector(QWidget *parent) :
         ui->easingCombo->addItem(QIcon(easing.getPixmap()), tr("Easing") + QString(" %1").arg(type));
     }
 
-
     //Templates
     ui->equationTemplate->clear();
     addEquationTemplate("Templates", "", true);
@@ -351,6 +352,13 @@ void UiInspector::actionInfo() {
             Application::current->execute(QString("%1 selection %2 %3").arg(COMMAND_RESIZE).arg(ui->sizeWSpin->value()).arg(ui->sizeHSpin->value()), ExecuteSourceGui);
         else if((ui->patternLine == sender()) || (ui->easingCombo == sender()))
             Application::current->execute(QString("%1 selection %2 0 %3").arg(COMMAND_CURSOR_START).arg(ui->easingCombo->currentIndex()).arg(ui->patternLine->currentText().split(" - ").at(0)), ExecuteSourceGui);
+        else if(ui->fireTriggers == sender()) {
+            QString action = "";
+            if(ui->fireTriggers->currentIndex() == 0)           action = "none";
+            else if(ui->fireTriggers->currentIndex() == 1)      action = "group";
+            else if(ui->fireTriggers->currentIndex() == 2)      action = "all";
+            Application::current->execute(QString("%1 selection %2").arg(COMMAND_CURSOR_FIRE).arg(action), ExecuteSourceGui);
+        }
 
         else if((ui->equationTemplate == sender()) && (!ui->equationTemplate->itemData(ui->equationTemplate->currentIndex()).toString().isEmpty()))
             Application::current->execute(QString("%1 selection %2").arg(COMMAND_CURVE_EQUATION).arg(ui->equationTemplate->itemData(ui->equationTemplate->currentIndex()).toString()), ExecuteSourceGui);
@@ -596,6 +604,7 @@ void UiInspector::refresh() {
                 if(sender() != ui->patternLine)
                     change(indexObject, ui->patternLine, cursor->getStart().mid(4), prevCursor->getStart().mid(4), false);
                 change(indexObject, ui->easingCombo, cursor->getEasing(), prevCursor->getEasing());
+                change(indexObject, ui->fireTriggers, cursor->getFireValue(), prevCursor->getFireValue());
                 change(indexObject, ui->speedSpin, cursor->getTimeFactor(), prevCursor->getTimeFactor());
                 change(indexObject, ui->speedFSpin, cursor->getTimeFactorF(), prevCursor->getTimeFactorF());
                 change(indexObject, ui->cursorSpeedLock, cursor->getLockPathLength(), prevCursor->getLockPathLength());
@@ -724,6 +733,7 @@ void UiInspector::refresh() {
     ui->patternLine->setVisible(showCursorInfo);
     ui->easingLabel->setVisible(showCursorInfo);
     ui->easingCombo->setVisible(showCursorInfo);
+    ui->fireTriggers->setVisible(showCursorInfo);
     ui->patternLabel->setVisible(showCursorInfo);
     ui->offsetInitialSpin->setVisible(showCursorCurveInfo);
     ui->offsetStartSpin->setVisible(showCursorCurveInfo);
diff --git a/gui/uiinspector.h b/gui/uiinspector.h
index 074c752..027f7b1 100644
--- a/gui/uiinspector.h
+++ b/gui/uiinspector.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/gui/uiinspector.ui b/gui/uiinspector.ui
index 7775d0f..4fbe796 100644
--- a/gui/uiinspector.ui
+++ b/gui/uiinspector.ui
@@ -695,7 +695,7 @@ QDialogButtonBox QPushButton {
               <item>
                <widget class="QWidget" name="widgetStyle" native="true">
                 <property name="statusTip">
-                 <string>Objects style|Objects can have differents graphical behaviours:\n - you can change the colors and texture (images - only for triggers)\n - size or thickness of the object is customisable\n - a label can be set to add human readable information to the object</string>
+                 <string>Objects style|Objects can have different graphical behaviours:\n - you can change the colors and texture (images - only for triggers)\n - size or thickness of the object is customisable\n - a label can be set to add human readable information to the object</string>
                 </property>
                 <layout class="QVBoxLayout" name="verticalLayout_12">
                  <property name="spacing">
@@ -1072,7 +1072,7 @@ MULTIPLICATION</string>
                       </size>
                      </property>
                      <property name="toolTip">
-                      <string>Multiplies the color of objects by an other color in the palette or a custom color</string>
+                      <string>Multiplies the color of objects by another color in the palette or a custom color</string>
                      </property>
                      <property name="styleSheet">
                       <string notr="true">QComboBox QAbstractItemView {
@@ -1274,7 +1274,7 @@ if INACTIVE</string>
             </widget>
             <widget class="QWidget" name="ssTabInfoSpace">
              <property name="statusTip">
-              <string>Objects and 3D space|Objects are positionned in a 3D space. These options allows you to control how objects interact with space:\n - absolute position\n - size of curves\n - playhead cursor size\n - curve trajectory points (manual or mathematical edition)</string>
+              <string>Objects and 3D space|Objects are positioned in a 3D space. These options allows you to control how objects interact with space:\n - absolute position\n - size of curves\n - playhead cursor size\n - curve trajectory points (manual or mathematical edition)</string>
              </property>
              <attribute name="title">
               <string>3D SPACE</string>
@@ -2991,13 +2991,98 @@ EASING CURVE</string>
                   <property name="toolTip">
                    <string>Manages cursor acceleration on the curve (beta)</string>
                   </property>
+                 </widget>
+                </item>
+                <item>
+                 <spacer name="horizontalSpacer_13">
+                  <property name="orientation">
+                   <enum>Qt::Horizontal</enum>
+                  </property>
+                  <property name="sizeHint" stdset="0">
+                   <size>
+                    <width>40</width>
+                    <height>1</height>
+                   </size>
+                  </property>
+                 </spacer>
+                </item>
+               </layout>
+              </item>
+              <item>
+               <layout class="QHBoxLayout" name="horizontalLayout_39">
+                <property name="spacing">
+                 <number>10</number>
+                </property>
+                <item>
+                 <widget class="QLabel" name="fireTriggersLabel">
+                  <property name="minimumSize">
+                   <size>
+                    <width>85</width>
+                    <height>20</height>
+                   </size>
+                  </property>
+                  <property name="maximumSize">
+                   <size>
+                    <width>85</width>
+                    <height>16777215</height>
+                   </size>
+                  </property>
+                  <property name="text">
+                   <string>IMPACT ON TRIGGERS</string>
+                  </property>
+                  <property name="alignment">
+                   <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                  </property>
+                  <property name="wordWrap">
+                   <bool>true</bool>
+                  </property>
+                  <property name="buddy">
+                   <cstring>patternLine</cstring>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <widget class="QComboBox" name="fireTriggers">
+                  <property name="minimumSize">
+                   <size>
+                    <width>200</width>
+                    <height>22</height>
+                   </size>
+                  </property>
+                  <property name="maximumSize">
+                   <size>
+                    <width>200</width>
+                    <height>16777215</height>
+                   </size>
+                  </property>
+                  <property name="toolTip">
+                   <string>Defines the "speed pattern" of the cursor. Speeds are applied consecutively on each loop or run of the cursor on the curve.</string>
+                  </property>
+                  <property name="editable">
+                   <bool>true</bool>
+                  </property>
                   <property name="sizeAdjustPolicy">
                    <enum>QComboBox::AdjustToContents</enum>
                   </property>
+                  <item>
+                   <property name="text">
+                    <string>Doesn't fire triggers</string>
+                   </property>
+                  </item>
+                  <item>
+                   <property name="text">
+                    <string>Fires only triggers of the same group</string>
+                   </property>
+                  </item>
+                  <item>
+                   <property name="text">
+                    <string>Fires all triggers</string>
+                   </property>
+                  </item>
                  </widget>
                 </item>
                 <item>
-                 <spacer name="horizontalSpacer_13">
+                 <spacer name="horizontalSpacer_29">
                   <property name="orientation">
                    <enum>Qt::Horizontal</enum>
                   </property>
@@ -3057,12 +3142,24 @@ OFFSETS</string>
                     </property>
                     <item>
                      <widget class="QLabel" name="offsetLabel1">
+                      <property name="sizePolicy">
+                       <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+                        <horstretch>0</horstretch>
+                        <verstretch>0</verstretch>
+                       </sizepolicy>
+                      </property>
                       <property name="minimumSize">
                        <size>
                         <width>75</width>
                         <height>20</height>
                        </size>
                       </property>
+                      <property name="maximumSize">
+                       <size>
+                        <width>130</width>
+                        <height>16777215</height>
+                       </size>
+                      </property>
                       <property name="text">
                        <string>INITIALLY STARTS FROM</string>
                       </property>
@@ -3130,6 +3227,19 @@ OFFSETS</string>
                       </property>
                      </widget>
                     </item>
+                    <item>
+                     <spacer name="horizontalSpacer_5">
+                      <property name="orientation">
+                       <enum>Qt::Horizontal</enum>
+                      </property>
+                      <property name="sizeHint" stdset="0">
+                       <size>
+                        <width>40</width>
+                        <height>1</height>
+                       </size>
+                      </property>
+                     </spacer>
+                    </item>
                    </layout>
                   </item>
                   <item>
@@ -3376,7 +3486,7 @@ OFFSETS</string>
                    <string>Changes the amount of messages sent by objects (small values may be CPU and network intensive)</string>
                   </property>
                   <property name="specialValueText">
-                   <string>Messages are sent immediatly</string>
+                   <string>Messages are sent immediately</string>
                   </property>
                   <property name="prefix">
                    <string>Messages are sent each </string>
@@ -4264,10 +4374,10 @@ GOING FROM</string>
             </widget>
             <widget class="QWidget" name="ssTabRessource">
              <property name="statusTip">
-              <string>Score ressources|These two lists allows you to add external file (image file for triggers appearance or score background) or to create a color palette for your score. Each ressource is identified by a unique string. Once edited, your new ressources will be available in the first tab if you want to apply them on objects.</string>
+              <string>Score resources|These two lists allow you to add external files (image file for triggers appearance or score background) or to create a color palette for your score. Each resource is identified by a unique string. Once edited, your new resources will be available in the first tab if you want to apply them on objects.</string>
              </property>
              <attribute name="title">
-              <string>RESSOURCES</string>
+              <string>RESOURCES</string>
              </attribute>
              <layout class="QVBoxLayout" name="verticalLayout_14">
               <property name="spacing">
@@ -4583,7 +4693,7 @@ GOING FROM</string>
                </size>
               </property>
               <property name="toolTip">
-               <string>Camera point of view can be controled by an object. Type here the ID of this object.</string>
+               <string>Camera point of view can be controlled by an object. Type here the ID of this object.</string>
               </property>
               <property name="specialValueText">
                <string>no objects</string>
@@ -5123,8 +5233,8 @@ padding: 0px;</string>
    <slot>actionInfoGroup()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>331</x>
-     <y>152</y>
+     <x>266</x>
+     <y>124</y>
     </hint>
     <hint type="destinationlabel">
      <x>0</x>
@@ -5139,8 +5249,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>214</x>
-     <y>188</y>
+     <x>99</x>
+     <y>132</y>
     </hint>
     <hint type="destinationlabel">
      <x>0</x>
@@ -5155,8 +5265,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>331</x>
-     <y>257</y>
+     <x>260</x>
+     <y>136</y>
     </hint>
     <hint type="destinationlabel">
      <x>0</x>
@@ -5187,8 +5297,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>331</x>
-     <y>257</y>
+     <x>260</x>
+     <y>136</y>
     </hint>
     <hint type="destinationlabel">
      <x>375</x>
@@ -5203,8 +5313,8 @@ padding: 0px;</string>
    <slot>actionColor()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>331</x>
-     <y>287</y>
+     <x>263</x>
+     <y>129</y>
     </hint>
     <hint type="destinationlabel">
      <x>375</x>
@@ -5219,8 +5329,8 @@ padding: 0px;</string>
    <slot>actionColor()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>331</x>
-     <y>320</y>
+     <x>263</x>
+     <y>130</y>
     </hint>
     <hint type="destinationlabel">
      <x>0</x>
@@ -5235,8 +5345,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>211</x>
-     <y>222</y>
+     <x>140</x>
+     <y>135</y>
     </hint>
     <hint type="destinationlabel">
      <x>375</x>
@@ -5283,8 +5393,8 @@ padding: 0px;</string>
    <slot>actionCCButton()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>50</x>
-     <y>58</y>
+     <x>56</x>
+     <y>357</y>
     </hint>
     <hint type="destinationlabel">
      <x>55</x>
@@ -5299,8 +5409,8 @@ padding: 0px;</string>
    <slot>actionCCButton()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>93</x>
-     <y>58</y>
+     <x>292</x>
+     <y>357</y>
     </hint>
     <hint type="destinationlabel">
      <x>199</x>
@@ -5315,8 +5425,8 @@ padding: 0px;</string>
    <slot>actionCCButton()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>93</x>
-     <y>60</y>
+     <x>292</x>
+     <y>386</y>
     </hint>
     <hint type="destinationlabel">
      <x>282</x>
@@ -5331,8 +5441,8 @@ padding: 0px;</string>
    <slot>actionCCButton()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>50</x>
-     <y>60</y>
+     <x>56</x>
+     <y>386</y>
     </hint>
     <hint type="destinationlabel">
      <x>78</x>
@@ -5347,8 +5457,8 @@ padding: 0px;</string>
    <slot>actionCCButton()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>125</x>
-     <y>83</y>
+     <x>245</x>
+     <y>467</y>
     </hint>
     <hint type="destinationlabel">
      <x>34</x>
@@ -5363,8 +5473,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>186</x>
-     <y>121</y>
+     <x>111</x>
+     <y>130</y>
     </hint>
     <hint type="destinationlabel">
      <x>390</x>
@@ -5379,8 +5489,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>266</x>
-     <y>121</y>
+     <x>130</x>
+     <y>130</y>
     </hint>
     <hint type="destinationlabel">
      <x>390</x>
@@ -5395,8 +5505,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>346</x>
-     <y>121</y>
+     <x>150</x>
+     <y>130</y>
     </hint>
     <hint type="destinationlabel">
      <x>390</x>
@@ -5411,8 +5521,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>186</x>
-     <y>158</y>
+     <x>117</x>
+     <y>133</y>
     </hint>
     <hint type="destinationlabel">
      <x>390</x>
@@ -5427,8 +5537,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>266</x>
-     <y>158</y>
+     <x>143</x>
+     <y>133</y>
     </hint>
     <hint type="destinationlabel">
      <x>390</x>
@@ -5443,8 +5553,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>186</x>
-     <y>232</y>
+     <x>117</x>
+     <y>138</y>
     </hint>
     <hint type="destinationlabel">
      <x>390</x>
@@ -5459,8 +5569,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>266</x>
-     <y>232</y>
+     <x>143</x>
+     <y>138</y>
     </hint>
     <hint type="destinationlabel">
      <x>390</x>
@@ -5491,8 +5601,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>128</x>
-     <y>125</y>
+     <x>266</x>
+     <y>165</y>
     </hint>
     <hint type="destinationlabel">
      <x>390</x>
@@ -5507,8 +5617,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>97</x>
-     <y>125</y>
+     <x>176</x>
+     <y>165</y>
     </hint>
     <hint type="destinationlabel">
      <x>390</x>
@@ -5523,8 +5633,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>140</x>
-     <y>125</y>
+     <x>196</x>
+     <y>200</y>
     </hint>
     <hint type="destinationlabel">
      <x>390</x>
@@ -5539,8 +5649,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>257</x>
-     <y>118</y>
+     <x>316</x>
+     <y>228</y>
     </hint>
     <hint type="destinationlabel">
      <x>390</x>
@@ -5555,8 +5665,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>257</x>
-     <y>118</y>
+     <x>316</x>
+     <y>228</y>
     </hint>
     <hint type="destinationlabel">
      <x>390</x>
@@ -5571,8 +5681,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>257</x>
-     <y>120</y>
+     <x>316</x>
+     <y>257</y>
     </hint>
     <hint type="destinationlabel">
      <x>390</x>
@@ -5587,8 +5697,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>139</x>
-     <y>133</y>
+     <x>330</x>
+     <y>324</y>
     </hint>
     <hint type="destinationlabel">
      <x>390</x>
@@ -5603,8 +5713,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>135</x>
-     <y>133</y>
+     <x>254</x>
+     <y>356</y>
     </hint>
     <hint type="destinationlabel">
      <x>390</x>
@@ -5619,8 +5729,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>150</x>
-     <y>133</y>
+     <x>344</x>
+     <y>356</y>
     </hint>
     <hint type="destinationlabel">
      <x>390</x>
@@ -5651,8 +5761,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>243</x>
-     <y>124</y>
+     <x>240</x>
+     <y>130</y>
     </hint>
     <hint type="destinationlabel">
      <x>390</x>
@@ -5859,8 +5969,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>98</x>
-     <y>120</y>
+     <x>320</x>
+     <y>164</y>
     </hint>
     <hint type="destinationlabel">
      <x>390</x>
@@ -5875,8 +5985,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>322</x>
-     <y>406</y>
+     <x>99</x>
+     <y>142</y>
     </hint>
     <hint type="destinationlabel">
      <x>602</x>
@@ -5891,8 +6001,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>213</x>
-     <y>267</y>
+     <x>176</x>
+     <y>132</y>
     </hint>
     <hint type="destinationlabel">
      <x>553</x>
@@ -5907,8 +6017,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>319</x>
-     <y>376</y>
+     <x>261</x>
+     <y>143</y>
     </hint>
     <hint type="destinationlabel">
      <x>560</x>
@@ -5923,8 +6033,8 @@ padding: 0px;</string>
    <slot>actionTexture()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>331</x>
-     <y>386</y>
+     <x>263</x>
+     <y>132</y>
     </hint>
     <hint type="destinationlabel">
      <x>493</x>
@@ -5939,8 +6049,8 @@ padding: 0px;</string>
    <slot>actionTexture()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>331</x>
-     <y>419</y>
+     <x>263</x>
+     <y>133</y>
     </hint>
     <hint type="destinationlabel">
      <x>503</x>
@@ -5955,8 +6065,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>319</x>
-     <y>327</y>
+     <x>85</x>
+     <y>133</y>
     </hint>
     <hint type="destinationlabel">
      <x>497</x>
@@ -5971,8 +6081,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>319</x>
-     <y>346</y>
+     <x>85</x>
+     <y>137</y>
     </hint>
     <hint type="destinationlabel">
      <x>499</x>
@@ -6067,8 +6177,8 @@ padding: 0px;</string>
    <slot>actionCCButton()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>89</x>
-     <y>65</y>
+     <x>271</x>
+     <y>460</y>
     </hint>
     <hint type="destinationlabel">
      <x>693</x>
@@ -6083,8 +6193,8 @@ padding: 0px;</string>
    <slot>actionCCButton()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>141</x>
-     <y>56</y>
+     <x>185</x>
+     <y>521</y>
     </hint>
     <hint type="destinationlabel">
      <x>520</x>
@@ -6099,8 +6209,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>316</x>
-     <y>301</y>
+     <x>261</x>
+     <y>135</y>
     </hint>
     <hint type="destinationlabel">
      <x>702</x>
@@ -6115,8 +6225,8 @@ padding: 0px;</string>
    <slot>actionColor()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>331</x>
-     <y>353</y>
+     <x>263</x>
+     <y>131</y>
     </hint>
     <hint type="destinationlabel">
      <x>698</x>
@@ -6131,8 +6241,8 @@ padding: 0px;</string>
    <slot>actionColor()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>331</x>
-     <y>287</y>
+     <x>263</x>
+     <y>129</y>
     </hint>
     <hint type="destinationlabel">
      <x>656</x>
@@ -6147,8 +6257,8 @@ padding: 0px;</string>
    <slot>actionColor()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>331</x>
-     <y>320</y>
+     <x>263</x>
+     <y>130</y>
     </hint>
     <hint type="destinationlabel">
      <x>773</x>
@@ -6163,8 +6273,8 @@ padding: 0px;</string>
    <slot>actionColor()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>331</x>
-     <y>353</y>
+     <x>263</x>
+     <y>131</y>
     </hint>
     <hint type="destinationlabel">
      <x>815</x>
@@ -6179,8 +6289,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>314</x>
-     <y>267</y>
+     <x>150</x>
+     <y>132</y>
     </hint>
     <hint type="destinationlabel">
      <x>677</x>
@@ -6195,8 +6305,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>303</x>
-     <y>418</y>
+     <x>176</x>
+     <y>119</y>
     </hint>
     <hint type="destinationlabel">
      <x>1157</x>
@@ -6211,8 +6321,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>303</x>
-     <y>435</y>
+     <x>176</x>
+     <y>128</y>
     </hint>
     <hint type="destinationlabel">
      <x>1160</x>
@@ -6227,8 +6337,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>303</x>
-     <y>452</y>
+     <x>176</x>
+     <y>137</y>
     </hint>
     <hint type="destinationlabel">
      <x>1125</x>
@@ -6243,8 +6353,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>303</x>
-     <y>461</y>
+     <x>176</x>
+     <y>146</y>
     </hint>
     <hint type="destinationlabel">
      <x>1147</x>
@@ -6259,8 +6369,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>303</x>
-     <y>484</y>
+     <x>176</x>
+     <y>155</y>
     </hint>
     <hint type="destinationlabel">
      <x>1112</x>
@@ -6275,8 +6385,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>363</x>
-     <y>425</y>
+     <x>142</x>
+     <y>131</y>
     </hint>
     <hint type="destinationlabel">
      <x>859</x>
@@ -6291,8 +6401,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>363</x>
-     <y>442</y>
+     <x>142</x>
+     <y>140</y>
     </hint>
     <hint type="destinationlabel">
      <x>825</x>
@@ -6307,8 +6417,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>363</x>
-     <y>442</y>
+     <x>142</x>
+     <y>149</y>
     </hint>
     <hint type="destinationlabel">
      <x>755</x>
@@ -6323,8 +6433,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>363</x>
-     <y>466</y>
+     <x>142</x>
+     <y>158</y>
     </hint>
     <hint type="destinationlabel">
      <x>665</x>
@@ -6339,8 +6449,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>363</x>
-     <y>490</y>
+     <x>142</x>
+     <y>167</y>
     </hint>
     <hint type="destinationlabel">
      <x>624</x>
@@ -6355,8 +6465,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>318</x>
-     <y>506</y>
+     <x>99</x>
+     <y>182</y>
     </hint>
     <hint type="destinationlabel">
      <x>551</x>
@@ -6371,8 +6481,8 @@ padding: 0px;</string>
    <slot>actionInfo()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>135</x>
-     <y>177</y>
+     <x>130</x>
+     <y>135</y>
     </hint>
     <hint type="destinationlabel">
      <x>794</x>
@@ -6380,6 +6490,38 @@ padding: 0px;</string>
     </hint>
    </hints>
   </connection>
+  <connection>
+   <sender>fireTriggers</sender>
+   <signal>currentIndexChanged(int)</signal>
+   <receiver>UiInspector</receiver>
+   <slot>actionInfo()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>224</x>
+     <y>276</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>504</x>
+     <y>286</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>fireTriggers</sender>
+   <signal>editTextChanged(QString)</signal>
+   <receiver>UiInspector</receiver>
+   <slot>actionInfo()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>289</x>
+     <y>275</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>560</x>
+     <y>269</y>
+    </hint>
+   </hints>
+  </connection>
  </connections>
  <slots>
   <slot>actionTabChange(int)</slot>
diff --git a/gui/uimessagebox.cpp b/gui/uimessagebox.cpp
index fbdc8a5..920ff55 100644
--- a/gui/uimessagebox.cpp
+++ b/gui/uimessagebox.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/gui/uimessagebox.h b/gui/uimessagebox.h
index 4cf4fbb..ccb6fa4 100644
--- a/gui/uimessagebox.h
+++ b/gui/uimessagebox.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/gui/uisplashscreen.cpp b/gui/uisplashscreen.cpp
index 52f4366..f3b22e4 100644
--- a/gui/uisplashscreen.cpp
+++ b/gui/uisplashscreen.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/gui/uisplashscreen.h b/gui/uisplashscreen.h
index 96565f9..f4e45f9 100644
--- a/gui/uisplashscreen.h
+++ b/gui/uisplashscreen.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/gui/uiview.cpp b/gui/uiview.cpp
index 51ca33b..bab1332 100644
--- a/gui/uiview.cpp
+++ b/gui/uiview.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/gui/uiview.h b/gui/uiview.h
index 63b7abc..0cb604d 100644
--- a/gui/uiview.h
+++ b/gui/uiview.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/gui/uiview.ui b/gui/uiview.ui
index 0838929..8a15c89 100644
--- a/gui/uiview.ui
+++ b/gui/uiview.ui
@@ -1384,10 +1384,10 @@ QDialogButtonBox QPushButton {
     <string>Import text…</string>
    </property>
    <property name="toolTip">
-    <string>Imports glyphes (characters) to score</string>
+    <string>Imports glyphs (characters) to score</string>
    </property>
    <property name="statusTip">
-    <string>Text import|IanniX can import glyphes (characters) from fonts. Note that font sizes are based on print or display units whereas IanniX is based on seconds; you may need to rescale the imported data.</string>
+    <string>Text import|IanniX can import glyphs (characters) from fonts. Note that font sizes are based on print or display units whereas IanniX is based on seconds; you may need to rescale the imported data.</string>
    </property>
    <property name="shortcutContext">
     <enum>Qt::ApplicationShortcut</enum>
diff --git a/iannix.cpp b/iannix.cpp
index eb9de9a..323bc13 100644
--- a/iannix.cpp
+++ b/iannix.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
@@ -369,7 +369,7 @@ void IanniX::timerTick(bool force) {
 }
 
 void IanniX::timerTick(qreal delta) {
-	Transport::currentMSecsSinceEpoch = QDateTime::currentMSecsSinceEpoch();
+    Transport::currentMSecsSinceEpoch = QDateTime::currentMSecsSinceEpoch();
     if(Transport::forceTimeLocal) {
         delta = 0;
         if(schedulerActivity == SchedulerOneShot)
@@ -398,10 +398,11 @@ void IanniX::timerTick(qreal delta) {
             foreach(const NxGroup *group, document->groups) {
                 //Browse active/inactive objects
                 for(quint16 activityIterator = 0 ; activityIterator < ObjectsActivityLenght ; activityIterator++) {
-
-                    //Browse cursors
-                    foreach(const NxObject *objectCursor, group->objects[activityIterator][ObjectsTypeCursor]) {
-                        NxCursor *cursor = (NxCursor*)objectCursor;
+                    //Browse active cursors
+                    QHashIterator<quint16, NxObject*> cursorIterator(group->objects[activityIterator][ObjectsTypeCursor]);
+                    while (cursorIterator.hasNext()) {
+                        cursorIterator.next();
+                        NxCursor *cursor = (NxCursor*)cursorIterator.value();
                         NxCurve  *curve  = cursor->getCurve();
 
                         //Calculate curve
@@ -418,9 +419,8 @@ void IanniX::timerTick(qreal delta) {
                         cursor->setTime(delta * Transport::scoreSpeed);
 
                         //Is cursor active ?
-                        if((!Transport::forceTimeLocal) && (cursor->getActive()) && (((!isGroupSoloActive) && (group->isNotMuted())) || ((isGroupSoloActive) && (group->isSolo()))) && (((!isObjectSoloActive) && (cursor->isNotMuted())) || ((isObjectSoloActive) && (cursor->isSolo())))) {
+                        if((!Transport::forceTimeLocal) && (cursor->getActive()) && (((!isGroupSoloActive) && (group->isNotMuted())) || ((isGroupSoloActive) && (group->isSolo()))) && (((!isObjectSoloActive) && (cursor->isNotMuted())) || ((isObjectSoloActive) && (cursor->isSolo()))))
                             timerTrig(cursor);
-                        }
                     }
                 }
             }
@@ -442,28 +442,40 @@ void IanniX::timerTrig(void *object, bool force) {
         cursor->trig(force);
 
     //Browse documents
-    QHashIterator<QString, NxDocument*> documentIterator(documents);
-    while (documentIterator.hasNext()) {
-        documentIterator.next();
-        NxDocument *document = documentIterator.value();
+    if(cursor->getFireValue() > CURSOR_FIRE_NONE) {
+        QHashIterator<QString, NxDocument*> documentIterator(documents);
+        while (documentIterator.hasNext()) {
+            documentIterator.next();
+            NxDocument *document = documentIterator.value();
 
-        //Browse groups
-        foreach(const NxGroup *group, document->groups) {
-            //Browse active triggers
-            foreach(const NxObject *objectTrigger, group->objects[ObjectsActivityActive][ObjectsTypeTrigger]) {
-                NxTrigger *trigger = (NxTrigger*)objectTrigger;
-
-                //Check the collision
-                if((cursor->contains(trigger)) && (((!isObjectSoloActive) && (trigger->isNotMuted())) || ((isObjectSoloActive) && (trigger->isSolo()))) && ((!Application::allowPlaySelected) || (!render->isSelection()) || ((Application::allowPlaySelected) && (trigger->getSelected()))))
-                    trigger->trig(cursor);
-            }
+            //Browse groups
+            foreach(const NxGroup *group, document->groups) {
+                //Test if group is the right on
+                if((cursor->getFireValue() == CURSOR_FIRE_ALL) || ((cursor->getFireValue() == CURSOR_FIRE_GROUP) && (cursor->getGroupId() == group->getId()))) {
+                    //Browse active triggers
+                    QHashIterator<quint16, NxObject*> triggerIterator(group->objects[ObjectsActivityActive][ObjectsTypeTrigger]);
+                    while (triggerIterator.hasNext()) {
+                        triggerIterator.next();
+                        NxTrigger *trigger = (NxTrigger*)triggerIterator.value();
+
+                        //Check the collision
+                        if((cursor->contains(trigger)) && (((!isObjectSoloActive) && (trigger->isNotMuted())) || ((isObjectSoloActive) && (trigger->isSolo()))) && ((!Application::allowPlaySelected) || (!render->isSelection()) || ((Application::allowPlaySelected) && (trigger->getSelected()))))
+                            trigger->trig(cursor);
+                    }
+
+                    //Browse active curbes
+                    if(cursor->getPerformCollision()) {
+                        QHashIterator<quint16, NxObject*> curveIterator(group->objects[ObjectsActivityActive][ObjectsTypeCurve]);
+                        while (curveIterator.hasNext()) {
+                            curveIterator.next();
+                            NxCurve *objectCurve = (NxCurve*)curveIterator.value();
 
-            //Browse active curbes
-            if(cursor->getPerformCollision()) {
-                foreach(const NxObject *objectCurve, group->objects[ObjectsActivityActive][ObjectsTypeCurve]) {
-                    //Check the collision
-                    if((!Application::allowPlaySelected) || (!render->isSelection()) || ((Application::allowPlaySelected) && (objectCurve->getSelected())))
-                        cursor->trig((NxCurve*)objectCurve);
+                            //Check the collision
+                            if((!Application::allowPlaySelected) || (!render->isSelection()) || ((Application::allowPlaySelected) && (objectCurve->getSelected())))
+                                cursor->trig((NxCurve*)objectCurve);
+                        }
+
+                    }
                 }
             }
         }
@@ -1079,7 +1091,7 @@ const QVariant IanniX::execute(const QString &command, ExecuteSource source, boo
 
                 if(object) {
                     //String parameter
-                    if((commande == COMMAND_GROUP) || (commande == COMMAND_RESIZE) || (commande == COMMAND_POS) || (commande == COMMAND_POS_TRANSLATE) || (commande == COMMAND_LABEL) || (commande == COMMAND_CURSOR_BOUNDS_SOURCE) || (commande == COMMAND_CURSOR_BOUNDS_TARGET) || (commande == COMMAND_CURVE_EQUATION_PARAM) || (commande == COMMAND_CURVE_EQUATION_PARAM_LIST) || (commande == COMMAND_COLOR_ACTIVE) || (commande == COMMAND_COLOR_INACTIVE) || (commande == COMMAND_COLOR_ACTIVE_HUE) || (commande == COMMAND_COLOR_INACTIVE_HUE) || (commande == COMMAND_COLOR_MULTIPLY) || (commande == COMMAND_COLOR_MULTIPLY_HUE) || (commande == COMMAND_MESSAGE) || (commande == COMMAND_CURVE_ELL) || (commande == COMMAND_CURVE_POINT_SHIFT) || (commande == COMMAND_CURVE_POINT_TRANSLATE) || (commande == COMMAND_CURVE_POINT_TRANSLATE2) || (commande == COMMAND_CURVE_EQUATION) || (commande == COMMAND_TEXTURE_ACTIVE) || (commande == COMMAND_TEXTURE_INACTIVE) || (commande == COMMAND_LINE) || (commande == COMMAND_CURSOR_OFFSET) || (commande == COMMAND_CURSOR_START) || (commande == COMMAND_CURSOR_SPEED)) {
+                    if((commande == COMMAND_GROUP) || (commande == COMMAND_RESIZE) || (commande == COMMAND_POS) || (commande == COMMAND_POS_TRANSLATE) || (commande == COMMAND_LABEL) || (commande == COMMAND_CURSOR_BOUNDS_SOURCE) || (commande == COMMAND_CURSOR_BOUNDS_TARGET) || (commande == COMMAND_CURVE_EQUATION_PARAM) || (commande == COMMAND_CURVE_EQUATION_PARAM_LIST) || (commande == COMMAND_COLOR_ACTIVE) || (commande == COMMAND_COLOR_INACTIVE) || (commande == COMMAND_COLOR_ACTIVE_HUE) || (commande == COMMAND_COLOR_INACTIVE_HUE) || (commande == COMMAND_COLOR_MULTIPLY) || (commande == COMMAND_COLOR_MULTIPLY_HUE) || (commande == COMMAND_MESSAGE) || (commande == COMMAND_CURVE_ELL) || (commande == COMMAND_CURVE_POINT_SHIFT) || (commande == COMMAND_CURVE_POINT_TRANSLATE) || (commande == COMMAND_CURVE_POINT_TRANSLATE2) || (commande == COMMAND_CURVE_EQUATION) || (commande == COMMAND_TEXTURE_ACTIVE) || (commande == COMMAND_TEXTURE_INACTIVE) || (commande == COMMAND_LINE) || (commande == COMMAND_CURSOR_OFFSET) || (commande == COMMAND_CURSOR_START) || (commande == COMMAND_CURSOR_SPEED) || (commande == COMMAND_CURSOR_FIRE)) {
                         if(argc > 2)    object->dispatchProperty(qPrintable(commande), argvFullString(command, argv, 2));
                         if(needOutput)  return object->getProperty(qPrintable(commande));
                     }
diff --git a/iannix.h b/iannix.h
index eb1dfd2..7b64644 100644
--- a/iannix.h
+++ b/iannix.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/iannix_cmd.h b/iannix_cmd.h
index d44f715..118b89c 100644
--- a/iannix_cmd.h
+++ b/iannix_cmd.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
@@ -37,6 +37,7 @@
 #define COMMAND_TRIGGER_OFF                 "settriggeroff"
 #define COMMAND_ACTIVE                      "setactive"
 #define COMMAND_CURSOR_CURVE                "setcurve"
+#define COMMAND_CURSOR_FIRE                 "setfire"
 #define COMMAND_CURSOR_START                "setpattern"
 #define COMMAND_CURSOR_WIDTH                "setwidth"
 #define COMMAND_CURSOR_DEPTH                "setdepth"
diff --git a/iannix_spec.cpp b/iannix_spec.cpp
index efcec89..483d725 100644
--- a/iannix_spec.cpp
+++ b/iannix_spec.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/iannix_spec.h b/iannix_spec.h
index 5b56608..780c23a 100644
--- a/iannix_spec.h
+++ b/iannix_spec.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/iannixapp.cpp b/iannixapp.cpp
index be9670e..5cf2dd9 100644
--- a/iannixapp.cpp
+++ b/iannixapp.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
@@ -44,7 +44,7 @@ int main(int argc, char *argv[]) {
     //iannixApp.installTranslator(&translator);
 
     QString appName    = "IanniX ";
-    QString appVersion = "0.9.17";
+    QString appVersion = "0.9.18";
 
 #ifdef Q_OS_MAC
     appName += "Mac";
@@ -61,8 +61,8 @@ int main(int argc, char *argv[]) {
 
     QCoreApplication::setApplicationName   (appName.trimmed());
     QCoreApplication::setApplicationVersion(appVersion.trimmed());
-    QCoreApplication::setOrganizationName  ("buzzing light");
-    QCoreApplication::setOrganizationDomain("org.iannix.desktop");
+    QCoreApplication::setOrganizationName  ("IanniX");
+    QCoreApplication::setOrganizationDomain("iannix");
 
     iannixApp.launch(argc, argv);
 
@@ -103,7 +103,7 @@ void IanniXApp::launch(int &argc, char **argv) {
     if(Application::pathApplication.absoluteFilePath().endsWith("/IanniX-build"))
         Application::pathApplication = QFileInfo(Application::pathApplication.absoluteFilePath().remove("-build"));
 
-    qDebug("Pathes");
+    qDebug("Paths");
     qDebug("\tDocuments  : %s", qPrintable(Application::pathDocuments  .absoluteFilePath()));
     qDebug("\tApplication: %s", qPrintable(Application::pathApplication.absoluteFilePath()));
     qDebug("\tCurrent    : %s", qPrintable(Application::pathCurrent    .absoluteFilePath()));
@@ -350,6 +350,7 @@ void IanniXApp::setHelp() {
     Help::categories["commands"].infos << HelpInfo(COMMAND_ACTIVE					, tr(""), tr(""), tr("<target> <0|1>"));
     Help::categories["commands"].infos << HelpInfo(COMMAND_CURSOR_CURVE				, tr("Objects identification"), tr("Associates a cursor to a curve"), tr("<target> <curve_id>"));
     Help::categories["commands"].infos << HelpInfo(COMMAND_CURSOR_START				, tr(""), tr(""), tr("<target> <easing> <0> <loop_pattern>"));
+    Help::categories["commands"].infos << HelpInfo(COMMAND_CURSOR_FIRE				, tr(""), tr(""), tr("<target> <mode: none, group, all>"));
     Help::categories["commands"].infos << HelpInfo(COMMAND_CURSOR_WIDTH				, tr(""), tr(""), tr("<target> <width>"));
     Help::categories["commands"].infos << HelpInfo(COMMAND_CURSOR_DEPTH				, tr(""), tr(""), tr("<target> <depth>"));
     Help::categories["commands"].infos << HelpInfo(COMMAND_CURSOR_SPEED				, tr(""), tr(""), tr("<target> <speed>\n<target> auto <duration>\n<target> lock <fixed_speed\n<target> autolock <fixed_duration>"));
diff --git a/iannixapp.h b/iannixapp.h
index 86e5dbe..ded5947 100644
--- a/iannixapp.h
+++ b/iannixapp.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/icon.rc b/icon.rc
index 3c9a012..1a4d90f 100644
--- a/icon.rc
+++ b/icon.rc
@@ -1,10 +1,10 @@
 IDI_ICON1               ICON    DISCARDABLE     "icon.ico"
 
 #include <windows.h>
-#define VER_FILEVERSION             0,9,17,0
-#define VER_FILEVERSION_STR         "0.9,17\0"
-#define VER_PRODUCTVERSION          0,9,17,0
-#define VER_PRODUCTVERSION_STR      "0.9,17\0"
+#define VER_FILEVERSION             0,9,18,0
+#define VER_FILEVERSION_STR         "0.9,18\0"
+#define VER_PRODUCTVERSION          0,9,18,0
+#define VER_PRODUCTVERSION_STR      "0.9,18\0"
 #define VER_COMPANYNAME_STR         "IanniX Association"
 #define VER_FILEDESCRIPTION_STR     "IanniX"
 #define VER_INTERNALNAME_STR        "IanniX"
diff --git a/icons/res_icon_check_active_off.png b/icons/res_icon_check_active_off.png
old mode 100755
new mode 100644
diff --git a/icons/res_icon_check_active_on.png b/icons/res_icon_check_active_on.png
old mode 100755
new mode 100644
diff --git a/icons/res_icon_check_lock_off.png b/icons/res_icon_check_lock_off.png
old mode 100755
new mode 100644
diff --git a/icons/res_icon_check_lock_on.png b/icons/res_icon_check_lock_on.png
old mode 100755
new mode 100644
diff --git a/icons/res_icon_check_solo_off.png b/icons/res_icon_check_solo_off.png
old mode 100755
new mode 100644
diff --git a/icons/res_icon_check_solo_on.png b/icons/res_icon_check_solo_on.png
old mode 100755
new mode 100644
diff --git a/icons/res_icon_down.png b/icons/res_icon_down.png
old mode 100755
new mode 100644
diff --git a/icons/res_icon_minus.png b/icons/res_icon_minus.png
old mode 100755
new mode 100644
diff --git a/icons/res_icon_plus.png b/icons/res_icon_plus.png
old mode 100755
new mode 100644
diff --git a/interfaces/artnet/artnet.c b/interfaces/artnet/artnet.c
old mode 100755
new mode 100644
diff --git a/interfaces/artnet/artnet.h b/interfaces/artnet/artnet.h
old mode 100755
new mode 100644
diff --git a/interfaces/artnet/common.h b/interfaces/artnet/common.h
old mode 100755
new mode 100644
diff --git a/interfaces/artnet/misc.c b/interfaces/artnet/misc.c
old mode 100755
new mode 100644
diff --git a/interfaces/artnet/misc.h b/interfaces/artnet/misc.h
old mode 100755
new mode 100644
diff --git a/interfaces/artnet/network.c b/interfaces/artnet/network.c
old mode 100755
new mode 100644
diff --git a/interfaces/artnet/packets.h b/interfaces/artnet/packets.h
old mode 100755
new mode 100644
diff --git a/interfaces/artnet/private.h b/interfaces/artnet/private.h
old mode 100755
new mode 100644
diff --git a/interfaces/artnet/receive.c b/interfaces/artnet/receive.c
old mode 100755
new mode 100644
diff --git a/interfaces/artnet/tod.c b/interfaces/artnet/tod.c
old mode 100755
new mode 100644
diff --git a/interfaces/artnet/tod.h b/interfaces/artnet/tod.h
old mode 100755
new mode 100644
diff --git a/interfaces/artnet/transmit.c b/interfaces/artnet/transmit.c
old mode 100755
new mode 100644
diff --git a/interfaces/extoscpatternask.cpp b/interfaces/extoscpatternask.cpp
index c3bd460..d5e3234 100644
--- a/interfaces/extoscpatternask.cpp
+++ b/interfaces/extoscpatternask.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/interfaces/extoscpatternask.h b/interfaces/extoscpatternask.h
index 557f341..4c8df9f 100644
--- a/interfaces/extoscpatternask.h
+++ b/interfaces/extoscpatternask.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/interfaces/extoscpatternask.ui b/interfaces/extoscpatternask.ui
index 8936916..185fa37 100644
--- a/interfaces/extoscpatternask.ui
+++ b/interfaces/extoscpatternask.ui
@@ -1,221 +1,221 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>ExtOscPatternAsk</class>
- <widget class="QDialog" name="ExtOscPatternAsk">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>800</width>
-    <height>505</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>IanniX — Message editor</string>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout_2">
-   <property name="spacing">
-    <number>5</number>
-   </property>
-   <property name="margin">
-    <number>5</number>
-   </property>
-   <item>
-    <widget class="QSplitter" name="splitter">
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <widget class="QWidget" name="layoutWidget">
-      <layout class="QVBoxLayout" name="verticalLayout">
-       <property name="bottomMargin">
-        <number>5</number>
-       </property>
-       <item>
-        <widget class="QTabWidget" name="tabs">
-         <property name="minimumSize">
-          <size>
-           <width>775</width>
-           <height>20</height>
-          </size>
-         </property>
-         <property name="currentIndex">
-          <number>-1</number>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <layout class="QHBoxLayout" name="horizontalLayout">
-         <item>
-          <widget class="QPushButton" name="addButton">
-           <property name="minimumSize">
-            <size>
-             <width>170</width>
-             <height>22</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>170</width>
-             <height>27</height>
-            </size>
-           </property>
-           <property name="focusPolicy">
-            <enum>Qt::NoFocus</enum>
-           </property>
-           <property name="toolTip">
-            <string>Adds a new message</string>
-           </property>
-           <property name="text">
-            <string>ADD A NEW MESSAGE</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QPushButton" name="removeButton">
-           <property name="minimumSize">
-            <size>
-             <width>170</width>
-             <height>22</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>170</width>
-             <height>27</height>
-            </size>
-           </property>
-           <property name="focusPolicy">
-            <enum>Qt::NoFocus</enum>
-           </property>
-           <property name="toolTip">
-            <string>Removes current message</string>
-           </property>
-           <property name="text">
-            <string>REMOVE CURRENT MESSAGE</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <spacer name="horizontalSpacer">
-           <property name="orientation">
-            <enum>Qt::Horizontal</enum>
-           </property>
-           <property name="sizeHint" stdset="0">
-            <size>
-             <width>40</width>
-             <height>20</height>
-            </size>
-           </property>
-          </spacer>
-         </item>
-         <item>
-          <widget class="QDialogButtonBox" name="buttonBox">
-           <property name="focusPolicy">
-            <enum>Qt::NoFocus</enum>
-           </property>
-           <property name="orientation">
-            <enum>Qt::Horizontal</enum>
-           </property>
-           <property name="standardButtons">
-            <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </item>
-      </layout>
-     </widget>
-     <widget class="UiHelp" name="help" native="true">
-      <property name="focusPolicy">
-       <enum>Qt::NoFocus</enum>
-      </property>
-     </widget>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <customwidgets>
-  <customwidget>
-   <class>UiHelp</class>
-   <extends>QWidget</extends>
-   <header>gui/uihelp.h</header>
-   <container>1</container>
-  </customwidget>
- </customwidgets>
- <tabstops>
-  <tabstop>tabs</tabstop>
- </tabstops>
- <resources/>
- <connections>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>accepted()</signal>
-   <receiver>ExtOscPatternAsk</receiver>
-   <slot>accept()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>987</x>
-     <y>684</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>157</x>
-     <y>180</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>rejected()</signal>
-   <receiver>ExtOscPatternAsk</receiver>
-   <slot>reject()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>987</x>
-     <y>684</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>286</x>
-     <y>180</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>addButton</sender>
-   <signal>released()</signal>
-   <receiver>ExtOscPatternAsk</receiver>
-   <slot>actionAddMessage()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>42</x>
-     <y>684</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>-87</x>
-     <y>58</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>removeButton</sender>
-   <signal>released()</signal>
-   <receiver>ExtOscPatternAsk</receiver>
-   <slot>actionRemoveMessage()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>218</x>
-     <y>675</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>453</x>
-     <y>744</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
- <slots>
-  <slot>itemClicked(QListWidgetItem*)</slot>
-  <slot>actionAddMessage()</slot>
-  <slot>actionRemoveMessage()</slot>
-  <slot>help()</slot>
- </slots>
-</ui>
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ExtOscPatternAsk</class>
+ <widget class="QDialog" name="ExtOscPatternAsk">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>800</width>
+    <height>505</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>IanniX — Message editor</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout_2">
+   <property name="spacing">
+    <number>5</number>
+   </property>
+   <property name="margin">
+    <number>5</number>
+   </property>
+   <item>
+    <widget class="QSplitter" name="splitter">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <widget class="QWidget" name="layoutWidget">
+      <layout class="QVBoxLayout" name="verticalLayout">
+       <property name="bottomMargin">
+        <number>5</number>
+       </property>
+       <item>
+        <widget class="QTabWidget" name="tabs">
+         <property name="minimumSize">
+          <size>
+           <width>775</width>
+           <height>20</height>
+          </size>
+         </property>
+         <property name="currentIndex">
+          <number>-1</number>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout">
+         <item>
+          <widget class="QPushButton" name="addButton">
+           <property name="minimumSize">
+            <size>
+             <width>170</width>
+             <height>22</height>
+            </size>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>170</width>
+             <height>27</height>
+            </size>
+           </property>
+           <property name="focusPolicy">
+            <enum>Qt::NoFocus</enum>
+           </property>
+           <property name="toolTip">
+            <string>Adds a new message</string>
+           </property>
+           <property name="text">
+            <string>ADD A NEW MESSAGE</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="removeButton">
+           <property name="minimumSize">
+            <size>
+             <width>170</width>
+             <height>22</height>
+            </size>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>170</width>
+             <height>27</height>
+            </size>
+           </property>
+           <property name="focusPolicy">
+            <enum>Qt::NoFocus</enum>
+           </property>
+           <property name="toolTip">
+            <string>Removes current message</string>
+           </property>
+           <property name="text">
+            <string>REMOVE CURRENT MESSAGE</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="horizontalSpacer">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QDialogButtonBox" name="buttonBox">
+           <property name="focusPolicy">
+            <enum>Qt::NoFocus</enum>
+           </property>
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="standardButtons">
+            <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </widget>
+     <widget class="UiHelp" name="help" native="true">
+      <property name="focusPolicy">
+       <enum>Qt::NoFocus</enum>
+      </property>
+     </widget>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>UiHelp</class>
+   <extends>QWidget</extends>
+   <header>gui/uihelp.h</header>
+   <container>1</container>
+  </customwidget>
+ </customwidgets>
+ <tabstops>
+  <tabstop>tabs</tabstop>
+ </tabstops>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>ExtOscPatternAsk</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>987</x>
+     <y>684</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>180</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>ExtOscPatternAsk</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>987</x>
+     <y>684</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>180</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>addButton</sender>
+   <signal>released()</signal>
+   <receiver>ExtOscPatternAsk</receiver>
+   <slot>actionAddMessage()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>42</x>
+     <y>684</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>-87</x>
+     <y>58</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>removeButton</sender>
+   <signal>released()</signal>
+   <receiver>ExtOscPatternAsk</receiver>
+   <slot>actionRemoveMessage()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>218</x>
+     <y>675</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>453</x>
+     <y>744</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+ <slots>
+  <slot>itemClicked(QListWidgetItem*)</slot>
+  <slot>actionAddMessage()</slot>
+  <slot>actionRemoveMessage()</slot>
+  <slot>help()</slot>
+ </slots>
+</ui>
diff --git a/interfaces/extoscpatterneditor.cpp b/interfaces/extoscpatterneditor.cpp
index a745ae7..dd56fa2 100644
--- a/interfaces/extoscpatterneditor.cpp
+++ b/interfaces/extoscpatterneditor.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/interfaces/extoscpatterneditor.h b/interfaces/extoscpatterneditor.h
index f03aaa1..132c45e 100644
--- a/interfaces/extoscpatterneditor.h
+++ b/interfaces/extoscpatterneditor.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/interfaces/extscriptvariableask.cpp b/interfaces/extscriptvariableask.cpp
index 194cfe7..bfa7c8c 100644
--- a/interfaces/extscriptvariableask.cpp
+++ b/interfaces/extscriptvariableask.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/interfaces/extscriptvariableask.h b/interfaces/extscriptvariableask.h
index d850914..24c584c 100644
--- a/interfaces/extscriptvariableask.h
+++ b/interfaces/extscriptvariableask.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/interfaces/extwacommanager.h b/interfaces/extwacommanager.h
index 475dbff..560a592 100644
--- a/interfaces/extwacommanager.h
+++ b/interfaces/extwacommanager.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/interfaces/extwacommanager.mm b/interfaces/extwacommanager.mm
index 58caeeb..286311a 100644
--- a/interfaces/extwacommanager.mm
+++ b/interfaces/extwacommanager.mm
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/interfaces/interfacedirect.cpp b/interfaces/interfacedirect.cpp
index b058e02..d9d2176 100644
--- a/interfaces/interfacedirect.cpp
+++ b/interfaces/interfacedirect.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/interfaces/interfacedirect.h b/interfaces/interfacedirect.h
index 4666d99..b4f075a 100644
--- a/interfaces/interfacedirect.h
+++ b/interfaces/interfacedirect.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/interfaces/interfacehttp.cpp b/interfaces/interfacehttp.cpp
index acdb2cd..fef219e 100644
--- a/interfaces/interfacehttp.cpp
+++ b/interfaces/interfacehttp.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/interfaces/interfacehttp.h b/interfaces/interfacehttp.h
index b9f4afe..9d1625f 100644
--- a/interfaces/interfacehttp.h
+++ b/interfaces/interfacehttp.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/interfaces/interfacemidi.cpp b/interfaces/interfacemidi.cpp
index 34e512b..4818d0d 100644
--- a/interfaces/interfacemidi.cpp
+++ b/interfaces/interfacemidi.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/interfaces/interfacemidi.h b/interfaces/interfacemidi.h
index dfcbb3d..2077aed 100644
--- a/interfaces/interfacemidi.h
+++ b/interfaces/interfacemidi.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/interfaces/interfaceosc.cpp b/interfaces/interfaceosc.cpp
index e632403..23dd458 100644
--- a/interfaces/interfaceosc.cpp
+++ b/interfaces/interfaceosc.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
@@ -72,6 +72,7 @@ void InterfaceOsc::portChanged() {
     if(socket)
         delete socket;
     socket = new QUdpSocket(this);
+    socket->setSocketOption(QAbstractSocket::LowDelayOption, 1);
     connect(socket, SIGNAL(readyRead()), SLOT(parseOSC()));
 
     if(socket->bind(port))  ui->port->setStyleSheet(ihmFeedbackOk);
@@ -284,8 +285,7 @@ void InterfaceOsc::parseOSC() {
         //Extract host, port & UDP datagram
         QHostAddress receivedHost;
         quint16 receivedPort;
-        bufferISize = socket->readDatagram((char*)bufferI, 4096, &receivedHost, &receivedPort);
-
+        bufferISize = socket->readDatagram((char*)bufferI, 4096*4, &receivedHost, &receivedPort);
 
         if(enable) {
             quint16 indexBuffer = 0;
diff --git a/interfaces/interfaceosc.h b/interfaces/interfaceosc.h
index 2d89fdf..440cc02 100644
--- a/interfaces/interfaceosc.h
+++ b/interfaces/interfaceosc.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
@@ -70,7 +70,7 @@ public:
 
 class InterfaceOsc : public NetworkInterface {
     Q_OBJECT
-    
+
 public:
     explicit InterfaceOsc(QWidget *parent = 0);
     ~InterfaceOsc();
@@ -117,8 +117,8 @@ private:
     QList<Message> bundleMessages;
     quint64 bundleMessageId;
 private:
-    quint8 bufferI[4096], bufferO[4096];
-    quint16 bufferISize, bufferOSize;
+    quint8 bufferI[4096*4], bufferO[4096*4];
+    qint16 bufferISize, bufferOSize;
     char addressBuffer[255], argumentsBuffer[255];
     quint16 indexAddressBuffer, indexArgumentsBuffer;
 private slots:
diff --git a/interfaces/interfaceserial.cpp b/interfaces/interfaceserial.cpp
index 8c1d760..263b49c 100644
--- a/interfaces/interfaceserial.cpp
+++ b/interfaces/interfaceserial.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/interfaces/interfaceserial.h b/interfaces/interfaceserial.h
index 386d26b..6a047c3 100644
--- a/interfaces/interfaceserial.h
+++ b/interfaces/interfaceserial.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/interfaces/interfaceserial.ui b/interfaces/interfaceserial.ui
index 5d555c7..7f43c4c 100644
--- a/interfaces/interfaceserial.ui
+++ b/interfaces/interfaceserial.ui
@@ -69,7 +69,7 @@
         </size>
        </property>
        <property name="toolTip">
-        <string>Opens the folder where you can find examples of IanniX interfacing with softwares using serial port</string>
+        <string>Opens the folder where you can find examples of IanniX interfacing with software using serial port</string>
        </property>
        <property name="text">
         <string>OPEN EXAMPLES</string>
diff --git a/interfaces/interfacesyphon.h b/interfaces/interfacesyphon.h
index 56001b1..d05869b 100644
--- a/interfaces/interfacesyphon.h
+++ b/interfaces/interfacesyphon.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/interfaces/interfacesyphon.mm b/interfaces/interfacesyphon.mm
index b8c0c7a..97bd1d2 100644
--- a/interfaces/interfacesyphon.mm
+++ b/interfaces/interfacesyphon.mm
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/interfaces/interfacetcp.cpp b/interfaces/interfacetcp.cpp
index 57b7b88..f4d29f2 100644
--- a/interfaces/interfacetcp.cpp
+++ b/interfaces/interfacetcp.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/interfaces/interfacetcp.h b/interfaces/interfacetcp.h
index 9d707a2..0aed9c0 100644
--- a/interfaces/interfacetcp.h
+++ b/interfaces/interfacetcp.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/interfaces/interfacetcp.ui b/interfaces/interfacetcp.ui
index 8afb148..41eab37 100644
--- a/interfaces/interfacetcp.ui
+++ b/interfaces/interfacetcp.ui
@@ -69,7 +69,7 @@
         </size>
        </property>
        <property name="toolTip">
-        <string>Opens the folder where you can find examples of IanniX interfacing with softwares using TCP/XML</string>
+        <string>Opens the folder where you can find examples of IanniX interfacing with software using TCP/XML</string>
        </property>
        <property name="text">
         <string>OPEN EXAMPLES</string>
diff --git a/interfaces/interfaceudp.cpp b/interfaces/interfaceudp.cpp
index 0cc5d6c..fa55b6e 100644
--- a/interfaces/interfaceudp.cpp
+++ b/interfaces/interfaceudp.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
@@ -43,6 +43,7 @@ void InterfaceUdp::portChanged() {
     if(socket)
         delete socket;
     socket = new QUdpSocket(this);
+    socket->setSocketOption(QAbstractSocket::LowDelayOption, 1);
     connect(socket, SIGNAL(readyRead()), SLOT(parseOSC()));
 
     if(socket->bind(port))  ui->port->setStyleSheet(ihmFeedbackOk);
diff --git a/interfaces/interfaceudp.h b/interfaces/interfaceudp.h
index 7309ac8..7e59367 100644
--- a/interfaces/interfaceudp.h
+++ b/interfaces/interfaceudp.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/interfaces/interfaceudp.ui b/interfaces/interfaceudp.ui
index ade813a..5bcffec 100644
--- a/interfaces/interfaceudp.ui
+++ b/interfaces/interfaceudp.ui
@@ -69,7 +69,7 @@
         </size>
        </property>
        <property name="toolTip">
-        <string>Opens the folder where you can find examples of IanniX interfacing with softwares using raw UDP</string>
+        <string>Opens the folder where you can find examples of IanniX interfacing with software using raw UDP</string>
        </property>
        <property name="text">
         <string>OPEN EXAMPLES</string>
diff --git a/interfaces/qextserialport/qextserialenumerator.cpp b/interfaces/qextserialport/qextserialenumerator.cpp
index ec1491a..ce41095 100644
--- a/interfaces/qextserialport/qextserialenumerator.cpp
+++ b/interfaces/qextserialport/qextserialenumerator.cpp
@@ -1,163 +1,163 @@
-/****************************************************************************
-** Copyright (c) 2000-2003 Wayne Roth
-** Copyright (c) 2004-2007 Stefan Sander
-** Copyright (c) 2007 Michal Policht
-** Copyright (c) 2008 Brandon Fosdick
-** Copyright (c) 2009-2010 Liam Staskawicz
-** Copyright (c) 2011 Debao Zhang
-** All right reserved.
-** Web: http://code.google.com/p/qextserialport/
-**
-** Permission is hereby granted, free of charge, to any person obtaining
-** a copy of this software and associated documentation files (the
-** "Software"), to deal in the Software without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Software, and to
-** permit persons to whom the Software is furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be
-** included in all copies or substantial portions of the Software.
-**
-** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-**
-****************************************************************************/
-
-#include "qextserialenumerator.h"
-#include "qextserialenumerator_p.h"
-
-#include <QtCore/QDebug>
-#include <QtCore/QMetaType>
-#include <QtCore/QRegExp>
-
-QextSerialEnumeratorPrivate::QextSerialEnumeratorPrivate(QextSerialEnumerator *enumrator)
-    :q_ptr(enumrator)
-{
-    platformSpecificInit();
-}
-
-QextSerialEnumeratorPrivate::~QextSerialEnumeratorPrivate()
-{
-    platformSpecificDestruct();
-}
-
-/*!
-  \class QextPortInfo
-
-  \brief The QextPortInfo class containing port information.
-
-  Structure containing port information.
-
-  \code
-  QString portName;   ///< Port name.
-  QString physName;   ///< Physical name.
-  QString friendName; ///< Friendly name.
-  QString enumName;   ///< Enumerator name.
-  int vendorID;       ///< Vendor ID.
-  int productID;      ///< Product ID
-  \endcode
- */
-
-/*! \class QextSerialEnumerator
-
-    \brief The QextSerialEnumerator class provides list of ports available in the system.
-  
-    \section1 Usage
-    To poll the system for a list of connected devices, simply use getPorts().  Each
-    QextPortInfo structure will populated with information about the corresponding device.
-  
-    \bold Example
-    \code
-    QList<QextPortInfo> ports = QextSerialEnumerator::getPorts();
-    foreach (QextPortInfo port, ports) {
-        // inspect port...
-    }
-    \endcode
-  
-    To enable event-driven notification of device connection events, first call
-    setUpNotifications() and then connect to the deviceDiscovered() and deviceRemoved()
-    signals.  Event-driven behavior is currently available only on Windows and OS X.
-  
-    \bold Example
-    \code
-    QextSerialEnumerator *enumerator = new QextSerialEnumerator();
-    connect(enumerator, SIGNAL(deviceDiscovered(const QextPortInfo &)),
-               myClass, SLOT(onDeviceDiscovered(const QextPortInfo &)));
-    connect(enumerator, SIGNAL(deviceRemoved(const QextPortInfo &)),
-               myClass, SLOT(onDeviceRemoved(const QextPortInfo &)));
-    \endcode
-  
-    \section1 Credits
-    Windows implementation is based on Zach Gorman's work from
-    \l {http://www.codeproject.com}{The Code Project} (\l http://www.codeproject.com/system/setupdi.asp).
-  
-    OS X implementation, see \l http://developer.apple.com/documentation/DeviceDrivers/Conceptual/AccessingHardware/AH_Finding_Devices/chapter_4_section_2.html
-  
-    \bold author Michal Policht, Liam Staskawicz
-*/
-
-/*!
-    \fn void QextSerialEnumerator::deviceDiscovered(const QextPortInfo &info)
-    A new device has been connected to the system.
-  
-    setUpNotifications() must be called first to enable event-driven device notifications.
-    Currently only implemented on Windows and OS X.
-  
-    \a info The device that has been discovered.
-*/
-
-/*!
-   \fn void QextSerialEnumerator::deviceRemoved(const QextPortInfo &info);
-    A device has been disconnected from the system.
-  
-    setUpNotifications() must be called first to enable event-driven device notifications.
-    Currently only implemented on Windows and OS X.
-  
-    \a info The device that was disconnected.
-*/
-
-/*!
-   Constructs a QextSerialEnumerator object with the given \a parent.
-*/
-QextSerialEnumerator::QextSerialEnumerator(QObject *parent)
-    :QObject(parent), d_ptr(new QextSerialEnumeratorPrivate(this))
-{
-    if (!QMetaType::isRegistered(QMetaType::type("QextPortInfo")))
-        qRegisterMetaType<QextPortInfo>("QextPortInfo");
-}
-
-/*!
-   Destructs the QextSerialEnumerator object.
-*/
-QextSerialEnumerator::~QextSerialEnumerator()
-{
-    delete d_ptr;
-}
-
-/*!
-    Get list of ports.
-
-    return list of ports currently available in the system.
-*/
-QList<QextPortInfo> QextSerialEnumerator::getPorts()
-{
-    return QextSerialEnumeratorPrivate::getPorts_sys();
-}
-
-/*!
-    Enable event-driven notifications of board discovery/removal.
-*/
-void QextSerialEnumerator::setUpNotifications()
-{
-    Q_D(QextSerialEnumerator);
-    if (!d->setUpNotifications_sys(true))
-        QESP_WARNING("Setup Notification Failed...");
-}
-
-#include "moc_qextserialenumerator.cpp"
+/****************************************************************************
+** Copyright (c) 2000-2003 Wayne Roth
+** Copyright (c) 2004-2007 Stefan Sander
+** Copyright (c) 2007 Michal Policht
+** Copyright (c) 2008 Brandon Fosdick
+** Copyright (c) 2009-2010 Liam Staskawicz
+** Copyright (c) 2011 Debao Zhang
+** All right reserved.
+** Web: http://code.google.com/p/qextserialport/
+**
+** Permission is hereby granted, free of charge, to any person obtaining
+** a copy of this software and associated documentation files (the
+** "Software"), to deal in the Software without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Software, and to
+** permit persons to whom the Software is furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be
+** included in all copies or substantial portions of the Software.
+**
+** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+**
+****************************************************************************/
+
+#include "qextserialenumerator.h"
+#include "qextserialenumerator_p.h"
+
+#include <QtCore/QDebug>
+#include <QtCore/QMetaType>
+#include <QtCore/QRegExp>
+
+QextSerialEnumeratorPrivate::QextSerialEnumeratorPrivate(QextSerialEnumerator *enumrator)
+    :q_ptr(enumrator)
+{
+    platformSpecificInit();
+}
+
+QextSerialEnumeratorPrivate::~QextSerialEnumeratorPrivate()
+{
+    platformSpecificDestruct();
+}
+
+/*!
+  \class QextPortInfo
+
+  \brief The QextPortInfo class containing port information.
+
+  Structure containing port information.
+
+  \code
+  QString portName;   ///< Port name.
+  QString physName;   ///< Physical name.
+  QString friendName; ///< Friendly name.
+  QString enumName;   ///< Enumerator name.
+  int vendorID;       ///< Vendor ID.
+  int productID;      ///< Product ID
+  \endcode
+ */
+
+/*! \class QextSerialEnumerator
+
+    \brief The QextSerialEnumerator class provides list of ports available in the system.
+
+    \section1 Usage
+    To poll the system for a list of connected devices, simply use getPorts().  Each
+    QextPortInfo structure will populated with information about the corresponding device.
+
+    \bold Example
+    \code
+    QList<QextPortInfo> ports = QextSerialEnumerator::getPorts();
+    foreach (QextPortInfo port, ports) {
+        // inspect port...
+    }
+    \endcode
+
+    To enable event-driven notification of device connection events, first call
+    setUpNotifications() and then connect to the deviceDiscovered() and deviceRemoved()
+    signals.  Event-driven behavior is currently available only on Windows and OS X.
+
+    \bold Example
+    \code
+    QextSerialEnumerator *enumerator = new QextSerialEnumerator();
+    connect(enumerator, SIGNAL(deviceDiscovered(const QextPortInfo &)),
+               myClass, SLOT(onDeviceDiscovered(const QextPortInfo &)));
+    connect(enumerator, SIGNAL(deviceRemoved(const QextPortInfo &)),
+               myClass, SLOT(onDeviceRemoved(const QextPortInfo &)));
+    \endcode
+
+    \section1 Credits
+    Windows implementation is based on Zach Gorman's work from
+    \l {http://www.codeproject.com}{The Code Project} (\l http://www.codeproject.com/system/setupdi.asp).
+
+    OS X implementation, see \l http://developer.apple.com/documentation/DeviceDrivers/Conceptual/AccessingHardware/AH_Finding_Devices/chapter_4_section_2.html
+
+    \bold author Michal Policht, Liam Staskawicz
+*/
+
+/*!
+    \fn void QextSerialEnumerator::deviceDiscovered(const QextPortInfo &info)
+    A new device has been connected to the system.
+
+    setUpNotifications() must be called first to enable event-driven device notifications.
+    Currently only implemented on Windows and OS X.
+
+    \a info The device that has been discovered.
+*/
+
+/*!
+   \fn void QextSerialEnumerator::deviceRemoved(const QextPortInfo &info);
+    A device has been disconnected from the system.
+
+    setUpNotifications() must be called first to enable event-driven device notifications.
+    Currently only implemented on Windows and OS X.
+
+    \a info The device that was disconnected.
+*/
+
+/*!
+   Constructs a QextSerialEnumerator object with the given \a parent.
+*/
+QextSerialEnumerator::QextSerialEnumerator(QObject *parent)
+    :QObject(parent), d_ptr(new QextSerialEnumeratorPrivate(this))
+{
+    if (!QMetaType::isRegistered(QMetaType::type("QextPortInfo")))
+        qRegisterMetaType<QextPortInfo>("QextPortInfo");
+}
+
+/*!
+   Destructs the QextSerialEnumerator object.
+*/
+QextSerialEnumerator::~QextSerialEnumerator()
+{
+    delete d_ptr;
+}
+
+/*!
+    Get list of ports.
+
+    return list of ports currently available in the system.
+*/
+QList<QextPortInfo> QextSerialEnumerator::getPorts()
+{
+    return QextSerialEnumeratorPrivate::getPorts_sys();
+}
+
+/*!
+    Enable event-driven notifications of board discovery/removal.
+*/
+void QextSerialEnumerator::setUpNotifications()
+{
+    Q_D(QextSerialEnumerator);
+    if (!d->setUpNotifications_sys(true))
+        QESP_WARNING("Setup Notification Failed...");
+}
+
+#include "moc_qextserialenumerator.cpp"
diff --git a/interfaces/qextserialport/qextserialenumerator.h b/interfaces/qextserialport/qextserialenumerator.h
index 99f515d..f207d0d 100644
--- a/interfaces/qextserialport/qextserialenumerator.h
+++ b/interfaces/qextserialport/qextserialenumerator.h
@@ -1,72 +1,72 @@
-/****************************************************************************
-** Copyright (c) 2000-2003 Wayne Roth
-** Copyright (c) 2004-2007 Stefan Sander
-** Copyright (c) 2007 Michal Policht
-** Copyright (c) 2008 Brandon Fosdick
-** Copyright (c) 2009-2010 Liam Staskawicz
-** Copyright (c) 2011 Debao Zhang
-** All right reserved.
-** Web: http://code.google.com/p/qextserialport/
-**
-** Permission is hereby granted, free of charge, to any person obtaining
-** a copy of this software and associated documentation files (the
-** "Software"), to deal in the Software without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Software, and to
-** permit persons to whom the Software is furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be
-** included in all copies or substantial portions of the Software.
-**
-** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-**
-****************************************************************************/
-
-#ifndef _QEXTSERIALENUMERATOR_H_
-#define _QEXTSERIALENUMERATOR_H_
-
-#include <QtCore/QList>
-#include <QtCore/QObject>
-#include "qextserialport_global.h"
-
-struct QextPortInfo {
-    QString portName;   ///< Port name.
-    QString physName;   ///< Physical name.
-    QString friendName; ///< Friendly name.
-    QString enumName;   ///< Enumerator name.
-    int vendorID;       ///< Vendor ID.
-    int productID;      ///< Product ID
-};
-
-class QextSerialEnumeratorPrivate;
-class QEXTSERIALPORT_EXPORT QextSerialEnumerator : public QObject
-{
-    Q_OBJECT
-    Q_DECLARE_PRIVATE(QextSerialEnumerator)
-public:
-    QextSerialEnumerator(QObject *parent=0);
-    ~QextSerialEnumerator();
-
-    static QList<QextPortInfo> getPorts();
-    void setUpNotifications();
-
-Q_SIGNALS:
-    void deviceDiscovered(const QextPortInfo &info);
-    void deviceRemoved(const QextPortInfo &info);
-
-private:
-    Q_DISABLE_COPY(QextSerialEnumerator)
-#if defined(Q_OS_LINUX) && !defined(QESP_NO_UDEV)
-    Q_PRIVATE_SLOT(d_func(), void _q_deviceEvent())
-#endif
-    QextSerialEnumeratorPrivate *d_ptr;
-};
-
-#endif /*_QEXTSERIALENUMERATOR_H_*/
+/****************************************************************************
+** Copyright (c) 2000-2003 Wayne Roth
+** Copyright (c) 2004-2007 Stefan Sander
+** Copyright (c) 2007 Michal Policht
+** Copyright (c) 2008 Brandon Fosdick
+** Copyright (c) 2009-2010 Liam Staskawicz
+** Copyright (c) 2011 Debao Zhang
+** All right reserved.
+** Web: http://code.google.com/p/qextserialport/
+**
+** Permission is hereby granted, free of charge, to any person obtaining
+** a copy of this software and associated documentation files (the
+** "Software"), to deal in the Software without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Software, and to
+** permit persons to whom the Software is furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be
+** included in all copies or substantial portions of the Software.
+**
+** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+**
+****************************************************************************/
+
+#ifndef _QEXTSERIALENUMERATOR_H_
+#define _QEXTSERIALENUMERATOR_H_
+
+#include <QtCore/QList>
+#include <QtCore/QObject>
+#include "qextserialport_global.h"
+
+struct QextPortInfo {
+    QString portName;   ///< Port name.
+    QString physName;   ///< Physical name.
+    QString friendName; ///< Friendly name.
+    QString enumName;   ///< Enumerator name.
+    int vendorID;       ///< Vendor ID.
+    int productID;      ///< Product ID
+};
+
+class QextSerialEnumeratorPrivate;
+class QEXTSERIALPORT_EXPORT QextSerialEnumerator : public QObject
+{
+    Q_OBJECT
+    Q_DECLARE_PRIVATE(QextSerialEnumerator)
+public:
+    QextSerialEnumerator(QObject *parent=0);
+    ~QextSerialEnumerator();
+
+    static QList<QextPortInfo> getPorts();
+    void setUpNotifications();
+
+Q_SIGNALS:
+    void deviceDiscovered(const QextPortInfo &info);
+    void deviceRemoved(const QextPortInfo &info);
+
+private:
+    Q_DISABLE_COPY(QextSerialEnumerator)
+#if defined(Q_OS_LINUX) && !defined(QESP_NO_UDEV)
+    Q_PRIVATE_SLOT(d_func(), void _q_deviceEvent())
+#endif
+    QextSerialEnumeratorPrivate *d_ptr;
+};
+
+#endif /*_QEXTSERIALENUMERATOR_H_*/
diff --git a/interfaces/qextserialport/qextserialenumerator_linux.cpp b/interfaces/qextserialport/qextserialenumerator_linux.cpp
index a57dfe6..a760836 100644
--- a/interfaces/qextserialport/qextserialenumerator_linux.cpp
+++ b/interfaces/qextserialport/qextserialenumerator_linux.cpp
@@ -1,210 +1,210 @@
-/****************************************************************************
-** Copyright (c) 2000-2003 Wayne Roth
-** Copyright (c) 2004-2007 Stefan Sander
-** Copyright (c) 2007 Michal Policht
-** Copyright (c) 2008 Brandon Fosdick
-** Copyright (c) 2009-2010 Liam Staskawicz
-** Copyright (c) 2011 Debao Zhang
-** Copyright (c) 2012 Doug Brown
-** All right reserved.
-** Web: http://code.google.com/p/qextserialport/
-**
-** Permission is hereby granted, free of charge, to any person obtaining
-** a copy of this software and associated documentation files (the
-** "Software"), to deal in the Software without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Software, and to
-** permit persons to whom the Software is furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be
-** included in all copies or substantial portions of the Software.
-**
-** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-**
-****************************************************************************/
-
-#include "qextserialenumerator.h"
-#include "qextserialenumerator_p.h"
-#include <QtCore/QDebug>
-#include <QtCore/QStringList>
-#include <QtCore/QDir>
-
-void QextSerialEnumeratorPrivate::platformSpecificInit()
-{
-#ifndef QESP_NO_UDEV
-    monitor = NULL;
-    notifierFd = -1;
-    notifier = NULL;
-
-    udev = udev_new();
-    if (!udev)
-        qCritical() << "Unable to initialize udev notifications";
-#endif
-}
-
-void QextSerialEnumeratorPrivate::platformSpecificDestruct()
-{
-#ifndef QESP_NO_UDEV
-    if (notifier) {
-        notifier->setEnabled(false);
-        delete notifier;
-    }
-
-    if (monitor)
-        udev_monitor_unref(monitor);
-
-    if (udev)
-        udev_unref(udev);
-#endif
-}
-
-#ifndef QESP_NO_UDEV
-static QextPortInfo portInfoFromDevice(struct udev_device *dev)
-{
-    QString vendor = QString::fromLatin1(udev_device_get_property_value(dev, "ID_VENDOR_ID"));
-    QString product = QString::fromLatin1(udev_device_get_property_value(dev, "ID_MODEL_ID"));
-
-    QextPortInfo pi;
-    pi.vendorID = vendor.toInt(0, 16);
-    pi.productID = product.toInt(0, 16);
-    pi.portName = QString::fromLatin1(udev_device_get_devnode(dev));
-    pi.physName = pi.portName;
-
-    return pi;
-}
-#endif
-
-QList<QextPortInfo> QextSerialEnumeratorPrivate::getPorts_sys()
-{
-    QList<QextPortInfo> infoList;
-#ifndef QESP_NO_UDEV
-    struct udev *ud = udev_new();
-    if (!ud) {
-        qCritical() << "Unable to enumerate ports because udev is not initialized.";
-        return infoList;
-    }
-
-    struct udev_enumerate *enumerate = udev_enumerate_new(ud);
-    udev_enumerate_add_match_subsystem(enumerate, "tty");
-    udev_enumerate_scan_devices(enumerate);
-    struct udev_list_entry *list = udev_enumerate_get_list_entry(enumerate);
-    struct udev_list_entry *entry;
-    udev_list_entry_foreach(entry, list) {
-        const char *path;
-        struct udev_device *dev;
-
-        // Have to grab the actual udev device here...
-        path = udev_list_entry_get_name(entry);
-        dev = udev_device_new_from_syspath(ud, path);
-
-        infoList.append(portInfoFromDevice(dev));
-
-        // Done with this device
-        udev_device_unref(dev);
-    }
-    // Done with the list and this udev
-    udev_enumerate_unref(enumerate);
-    udev_unref(ud);
-#else
-    QStringList portNamePrefixes, portNameList;
-    portNamePrefixes << QLatin1String("ttyS*"); // list normal serial ports first
-
-    QDir dir(QLatin1String("/dev"));
-    portNameList = dir.entryList(portNamePrefixes, (QDir::System | QDir::Files), QDir::Name);
-
-    // remove the values which are not serial ports for e.g.  /dev/ttysa
-    for (int i = 0; i < portNameList.size(); i++) {
-        bool ok;
-        QString current = portNameList.at(i);
-        // remove the ttyS part, and check, if the other part is a number
-        current.remove(0,4).toInt(&ok, 10);
-        if (!ok) {
-            portNameList.removeAt(i);
-            i--;
-        }
-    }
-
-    // get the non standard serial ports names
-    // (USB-serial, bluetooth-serial, 18F PICs, and so on)
-    // if you know an other name prefix for serial ports please let us know
-    portNamePrefixes.clear();
-    portNamePrefixes << QLatin1String("ttyACM*") << QLatin1String("ttyUSB*") << QLatin1String("rfcomm*");
-    portNameList += dir.entryList(portNamePrefixes, (QDir::System | QDir::Files), QDir::Name);
-
-    foreach (QString str , portNameList) {
-        QextPortInfo inf;
-        inf.physName = QLatin1String("/dev/")+str;
-        inf.portName = str;
-
-        if (str.contains(QLatin1String("ttyS"))) {
-            inf.friendName = QLatin1String("Serial port ")+str.remove(0, 4);
-        }
-        else if (str.contains(QLatin1String("ttyUSB"))) {
-            inf.friendName = QLatin1String("USB-serial adapter ")+str.remove(0, 6);
-        }
-        else if (str.contains(QLatin1String("rfcomm"))) {
-            inf.friendName = QLatin1String("Bluetooth-serial adapter ")+str.remove(0, 6);
-        }
-        inf.enumName = QLatin1String("/dev"); // is there a more helpful name for this?
-        infoList.append(inf);
-    }
-#endif
-
-    return infoList;
-}
-
-bool QextSerialEnumeratorPrivate::setUpNotifications_sys(bool setup)
-{
-    Q_UNUSED(setup);
-#ifndef QESP_NO_UDEV
-    Q_Q(QextSerialEnumerator);
-    if (!udev) {
-        qCritical() << "Unable to initialize notifications because udev is not initialized.";
-        return false;
-    }
-
-    // Emit signals immediately for devices already connected (Windows version seems to behave
-    // this way)
-    foreach (QextPortInfo i, getPorts_sys())
-        Q_EMIT q->deviceDiscovered(i);
-
-    // Look for tty devices from udev.
-    monitor = udev_monitor_new_from_netlink(udev, "udev");
-    udev_monitor_filter_add_match_subsystem_devtype(monitor, "tty", NULL);
-    udev_monitor_enable_receiving(monitor);
-    notifierFd = udev_monitor_get_fd(monitor);
-    notifier = new QSocketNotifier(notifierFd, QSocketNotifier::Read);
-    q->connect(notifier, SIGNAL(activated(int)), q, SLOT(_q_deviceEvent()));
-    notifier->setEnabled(true);
-
-    return true;
-#else
-    return false;
-#endif
-}
-
-#ifndef QESP_NO_UDEV
-void QextSerialEnumeratorPrivate::_q_deviceEvent()
-{
-    Q_Q(QextSerialEnumerator);
-    struct udev_device *dev = udev_monitor_receive_device(monitor);
-    if (dev) {
-        QextPortInfo pi = portInfoFromDevice(dev);
-
-        QLatin1String action(udev_device_get_action(dev));
-        udev_device_unref(dev);
-
-        if (action == QLatin1String("add"))
-            Q_EMIT q->deviceDiscovered(pi);
-        else if (action == QLatin1String("remove"))
-            Q_EMIT q->deviceRemoved(pi);
-    }
-}
-#endif
+/****************************************************************************
+** Copyright (c) 2000-2003 Wayne Roth
+** Copyright (c) 2004-2007 Stefan Sander
+** Copyright (c) 2007 Michal Policht
+** Copyright (c) 2008 Brandon Fosdick
+** Copyright (c) 2009-2010 Liam Staskawicz
+** Copyright (c) 2011 Debao Zhang
+** Copyright (c) 2012 Doug Brown
+** All right reserved.
+** Web: http://code.google.com/p/qextserialport/
+**
+** Permission is hereby granted, free of charge, to any person obtaining
+** a copy of this software and associated documentation files (the
+** "Software"), to deal in the Software without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Software, and to
+** permit persons to whom the Software is furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be
+** included in all copies or substantial portions of the Software.
+**
+** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+**
+****************************************************************************/
+
+#include "qextserialenumerator.h"
+#include "qextserialenumerator_p.h"
+#include <QtCore/QDebug>
+#include <QtCore/QStringList>
+#include <QtCore/QDir>
+
+void QextSerialEnumeratorPrivate::platformSpecificInit()
+{
+#ifndef QESP_NO_UDEV
+    monitor = NULL;
+    notifierFd = -1;
+    notifier = NULL;
+
+    udev = udev_new();
+    if (!udev)
+        qCritical() << "Unable to initialize udev notifications";
+#endif
+}
+
+void QextSerialEnumeratorPrivate::platformSpecificDestruct()
+{
+#ifndef QESP_NO_UDEV
+    if (notifier) {
+        notifier->setEnabled(false);
+        delete notifier;
+    }
+
+    if (monitor)
+        udev_monitor_unref(monitor);
+
+    if (udev)
+        udev_unref(udev);
+#endif
+}
+
+#ifndef QESP_NO_UDEV
+static QextPortInfo portInfoFromDevice(struct udev_device *dev)
+{
+    QString vendor = QString::fromLatin1(udev_device_get_property_value(dev, "ID_VENDOR_ID"));
+    QString product = QString::fromLatin1(udev_device_get_property_value(dev, "ID_MODEL_ID"));
+
+    QextPortInfo pi;
+    pi.vendorID = vendor.toInt(0, 16);
+    pi.productID = product.toInt(0, 16);
+    pi.portName = QString::fromLatin1(udev_device_get_devnode(dev));
+    pi.physName = pi.portName;
+
+    return pi;
+}
+#endif
+
+QList<QextPortInfo> QextSerialEnumeratorPrivate::getPorts_sys()
+{
+    QList<QextPortInfo> infoList;
+#ifndef QESP_NO_UDEV
+    struct udev *ud = udev_new();
+    if (!ud) {
+        qCritical() << "Unable to enumerate ports because udev is not initialized.";
+        return infoList;
+    }
+
+    struct udev_enumerate *enumerate = udev_enumerate_new(ud);
+    udev_enumerate_add_match_subsystem(enumerate, "tty");
+    udev_enumerate_scan_devices(enumerate);
+    struct udev_list_entry *list = udev_enumerate_get_list_entry(enumerate);
+    struct udev_list_entry *entry;
+    udev_list_entry_foreach(entry, list) {
+        const char *path;
+        struct udev_device *dev;
+
+        // Have to grab the actual udev device here...
+        path = udev_list_entry_get_name(entry);
+        dev = udev_device_new_from_syspath(ud, path);
+
+        infoList.append(portInfoFromDevice(dev));
+
+        // Done with this device
+        udev_device_unref(dev);
+    }
+    // Done with the list and this udev
+    udev_enumerate_unref(enumerate);
+    udev_unref(ud);
+#else
+    QStringList portNamePrefixes, portNameList;
+    portNamePrefixes << QLatin1String("ttyS*"); // list normal serial ports first
+
+    QDir dir(QLatin1String("/dev"));
+    portNameList = dir.entryList(portNamePrefixes, (QDir::System | QDir::Files), QDir::Name);
+
+    // remove the values which are not serial ports for e.g.  /dev/ttysa
+    for (int i = 0; i < portNameList.size(); i++) {
+        bool ok;
+        QString current = portNameList.at(i);
+        // remove the ttyS part, and check, if the other part is a number
+        current.remove(0,4).toInt(&ok, 10);
+        if (!ok) {
+            portNameList.removeAt(i);
+            i--;
+        }
+    }
+
+    // get the non standard serial ports names
+    // (USB-serial, bluetooth-serial, 18F PICs, and so on)
+    // if you know an other name prefix for serial ports please let us know
+    portNamePrefixes.clear();
+    portNamePrefixes << QLatin1String("ttyACM*") << QLatin1String("ttyUSB*") << QLatin1String("rfcomm*");
+    portNameList += dir.entryList(portNamePrefixes, (QDir::System | QDir::Files), QDir::Name);
+
+    foreach (QString str , portNameList) {
+        QextPortInfo inf;
+        inf.physName = QLatin1String("/dev/")+str;
+        inf.portName = str;
+
+        if (str.contains(QLatin1String("ttyS"))) {
+            inf.friendName = QLatin1String("Serial port ")+str.remove(0, 4);
+        }
+        else if (str.contains(QLatin1String("ttyUSB"))) {
+            inf.friendName = QLatin1String("USB-serial adapter ")+str.remove(0, 6);
+        }
+        else if (str.contains(QLatin1String("rfcomm"))) {
+            inf.friendName = QLatin1String("Bluetooth-serial adapter ")+str.remove(0, 6);
+        }
+        inf.enumName = QLatin1String("/dev"); // is there a more helpful name for this?
+        infoList.append(inf);
+    }
+#endif
+
+    return infoList;
+}
+
+bool QextSerialEnumeratorPrivate::setUpNotifications_sys(bool setup)
+{
+    Q_UNUSED(setup);
+#ifndef QESP_NO_UDEV
+    Q_Q(QextSerialEnumerator);
+    if (!udev) {
+        qCritical() << "Unable to initialize notifications because udev is not initialized.";
+        return false;
+    }
+
+    // Emit signals immediately for devices already connected (Windows version seems to behave
+    // this way)
+    foreach (QextPortInfo i, getPorts_sys())
+        Q_EMIT q->deviceDiscovered(i);
+
+    // Look for tty devices from udev.
+    monitor = udev_monitor_new_from_netlink(udev, "udev");
+    udev_monitor_filter_add_match_subsystem_devtype(monitor, "tty", NULL);
+    udev_monitor_enable_receiving(monitor);
+    notifierFd = udev_monitor_get_fd(monitor);
+    notifier = new QSocketNotifier(notifierFd, QSocketNotifier::Read);
+    q->connect(notifier, SIGNAL(activated(int)), q, SLOT(_q_deviceEvent()));
+    notifier->setEnabled(true);
+
+    return true;
+#else
+    return false;
+#endif
+}
+
+#ifndef QESP_NO_UDEV
+void QextSerialEnumeratorPrivate::_q_deviceEvent()
+{
+    Q_Q(QextSerialEnumerator);
+    struct udev_device *dev = udev_monitor_receive_device(monitor);
+    if (dev) {
+        QextPortInfo pi = portInfoFromDevice(dev);
+
+        QLatin1String action(udev_device_get_action(dev));
+        udev_device_unref(dev);
+
+        if (action == QLatin1String("add"))
+            Q_EMIT q->deviceDiscovered(pi);
+        else if (action == QLatin1String("remove"))
+            Q_EMIT q->deviceRemoved(pi);
+    }
+}
+#endif
diff --git a/interfaces/qextserialport/qextserialenumerator_osx.cpp b/interfaces/qextserialport/qextserialenumerator_osx.cpp
index 2dd0357..89a6d88 100644
--- a/interfaces/qextserialport/qextserialenumerator_osx.cpp
+++ b/interfaces/qextserialport/qextserialenumerator_osx.cpp
@@ -1,307 +1,307 @@
-/****************************************************************************
-** Copyright (c) 2000-2003 Wayne Roth
-** Copyright (c) 2004-2007 Stefan Sander
-** Copyright (c) 2007 Michal Policht
-** Copyright (c) 2008 Brandon Fosdick
-** Copyright (c) 2009-2010 Liam Staskawicz
-** Copyright (c) 2011 Debao Zhang
-** All right reserved.
-** Web: http://code.google.com/p/qextserialport/
-**
-** Permission is hereby granted, free of charge, to any person obtaining
-** a copy of this software and associated documentation files (the
-** "Software"), to deal in the Software without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Software, and to
-** permit persons to whom the Software is furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be
-** included in all copies or substantial portions of the Software.
-**
-** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-**
-****************************************************************************/
-
-#include "qextserialenumerator.h"
-#include "qextserialenumerator_p.h"
-#include <QtCore/QDebug>
-#include <IOKit/serial/IOSerialKeys.h>
-#include <CoreFoundation/CFNumber.h>
-#include <sys/param.h>
-
-void QextSerialEnumeratorPrivate::platformSpecificInit()
-{
-}
-
-void QextSerialEnumeratorPrivate::platformSpecificDestruct()
-{
-    IONotificationPortDestroy(notificationPortRef);
-}
-
-// static
-QList<QextPortInfo> QextSerialEnumeratorPrivate::getPorts_sys()
-{
-    QList<QextPortInfo> infoList;
-    io_iterator_t serialPortIterator = 0;
-    kern_return_t kernResult = KERN_FAILURE;
-    CFMutableDictionaryRef matchingDictionary;
-
-    // first try to get any serialbsd devices, then try any USBCDC devices
-    if (!(matchingDictionary = IOServiceMatching(kIOSerialBSDServiceValue))) {
-        QESP_WARNING("IOServiceMatching returned a NULL dictionary.");
-        return infoList;
-    }
-    CFDictionaryAddValue(matchingDictionary, CFSTR(kIOSerialBSDTypeKey), CFSTR(kIOSerialBSDAllTypes));
-
-    // then create the iterator with all the matching devices
-    if (IOServiceGetMatchingServices(kIOMasterPortDefault, matchingDictionary, &serialPortIterator) != KERN_SUCCESS) {
-        qCritical() << "IOServiceGetMatchingServices failed, returned" << kernResult;
-        return infoList;
-    }
-    iterateServicesOSX(serialPortIterator, infoList);
-    IOObjectRelease(serialPortIterator);
-    serialPortIterator = 0;
-
-    if (!(matchingDictionary = IOServiceNameMatching("AppleUSBCDC"))) {
-        QESP_WARNING("IOServiceNameMatching returned a NULL dictionary.");
-        return infoList;
-    }
-
-    if (IOServiceGetMatchingServices(kIOMasterPortDefault, matchingDictionary, &serialPortIterator) != KERN_SUCCESS) {
-        qCritical() << "IOServiceGetMatchingServices failed, returned" << kernResult;
-        return infoList;
-    }
-    iterateServicesOSX(serialPortIterator, infoList);
-    IOObjectRelease(serialPortIterator);
-
-    return infoList;
-}
-
-void QextSerialEnumeratorPrivate::iterateServicesOSX(io_object_t service, QList<QextPortInfo> &infoList)
-{
-    // Iterate through all modems found.
-    io_object_t usbService;
-    while ((usbService = IOIteratorNext(service))) {
-        QextPortInfo info;
-        info.vendorID = 0;
-        info.productID = 0;
-        getServiceDetailsOSX(usbService, &info);
-        infoList.append(info);
-    }
-}
-
-bool QextSerialEnumeratorPrivate::getServiceDetailsOSX(io_object_t service, QextPortInfo *portInfo)
-{
-    bool retval = true;
-    CFTypeRef bsdPathAsCFString = NULL;
-    CFTypeRef productNameAsCFString = NULL;
-    CFTypeRef vendorIdAsCFNumber = NULL;
-    CFTypeRef productIdAsCFNumber = NULL;
-    // check the name of the modem's callout device
-    bsdPathAsCFString = IORegistryEntryCreateCFProperty(service, CFSTR(kIOCalloutDeviceKey),
-                                                        kCFAllocatorDefault, 0);
-
-    // wander up the hierarchy until we find the level that can give us the
-    // vendor/product IDs and the product name, if available
-    io_registry_entry_t parent;
-    kern_return_t kernResult = IORegistryEntryGetParentEntry(service, kIOServicePlane, &parent);
-    while (kernResult == KERN_SUCCESS && !vendorIdAsCFNumber && !productIdAsCFNumber) {
-        if (!productNameAsCFString)
-            productNameAsCFString = IORegistryEntrySearchCFProperty(parent,
-                                                                    kIOServicePlane,
-                                                                    CFSTR("Product Name"),
-                                                                    kCFAllocatorDefault, 0);
-        vendorIdAsCFNumber = IORegistryEntrySearchCFProperty(parent,
-                                                             kIOServicePlane,
-                                                             CFSTR(kUSBVendorID),
-                                                             kCFAllocatorDefault, 0);
-        productIdAsCFNumber = IORegistryEntrySearchCFProperty(parent,
-                                                              kIOServicePlane,
-                                                              CFSTR(kUSBProductID),
-                                                              kCFAllocatorDefault, 0);
-        io_registry_entry_t oldparent = parent;
-        kernResult = IORegistryEntryGetParentEntry(parent, kIOServicePlane, &parent);
-        IOObjectRelease(oldparent);
-    }
-
-    io_string_t ioPathName;
-    IORegistryEntryGetPath(service, kIOServicePlane, ioPathName);
-    portInfo->physName = ioPathName;
-
-    if (bsdPathAsCFString) {
-        char path[MAXPATHLEN];
-        if (CFStringGetCString((CFStringRef)bsdPathAsCFString, path,
-                               PATH_MAX, kCFStringEncodingUTF8))
-            portInfo->portName = path;
-        CFRelease(bsdPathAsCFString);
-    }
-
-    if (productNameAsCFString) {
-        char productName[MAXPATHLEN];
-        if (CFStringGetCString((CFStringRef)productNameAsCFString, productName,
-                               PATH_MAX, kCFStringEncodingUTF8))
-            portInfo->friendName = productName;
-        CFRelease(productNameAsCFString);
-    }
-
-    if (vendorIdAsCFNumber) {
-        SInt32 vID;
-        if (CFNumberGetValue((CFNumberRef)vendorIdAsCFNumber, kCFNumberSInt32Type, &vID))
-            portInfo->vendorID = vID;
-        CFRelease(vendorIdAsCFNumber);
-    }
-
-    if (productIdAsCFNumber) {
-        SInt32 pID;
-        if (CFNumberGetValue((CFNumberRef)productIdAsCFNumber, kCFNumberSInt32Type, &pID))
-            portInfo->productID = pID;
-        CFRelease(productIdAsCFNumber);
-    }
-    IOObjectRelease(service);
-    return retval;
-}
-
-// IOKit callbacks registered via setupNotifications()
-void deviceDiscoveredCallbackOSX(void *ctxt, io_iterator_t serialPortIterator)
-{
-    QextSerialEnumeratorPrivate *d = (QextSerialEnumeratorPrivate *)ctxt;
-    io_object_t serialService;
-    while ((serialService = IOIteratorNext(serialPortIterator)))
-        d->onDeviceDiscoveredOSX(serialService);
-}
-
-void deviceTerminatedCallbackOSX(void *ctxt, io_iterator_t serialPortIterator)
-{
-    QextSerialEnumeratorPrivate *d = (QextSerialEnumeratorPrivate *)ctxt;
-    io_object_t serialService;
-    while ((serialService = IOIteratorNext(serialPortIterator)))
-        d->onDeviceTerminatedOSX(serialService);
-}
-
-/*
-  A device has been discovered via IOKit.
-  Create a QextPortInfo if possible, and emit the signal indicating that we've found it.
-*/
-void QextSerialEnumeratorPrivate::onDeviceDiscoveredOSX(io_object_t service)
-{
-    Q_Q(QextSerialEnumerator);
-    QextPortInfo info;
-    info.vendorID = 0;
-    info.productID = 0;
-    if (getServiceDetailsOSX(service, &info))
-        Q_EMIT q->deviceDiscovered(info);
-}
-
-/*
-  Notification via IOKit that a device has been removed.
-  Create a QextPortInfo if possible, and emit the signal indicating that it's gone.
-*/
-void QextSerialEnumeratorPrivate::onDeviceTerminatedOSX(io_object_t service)
-{
-    Q_Q(QextSerialEnumerator);
-    QextPortInfo info;
-    info.vendorID = 0;
-    info.productID = 0;
-    if (getServiceDetailsOSX(service, &info))
-        Q_EMIT q->deviceRemoved(info);
-}
-
-/*
-  Create matching dictionaries for the devices we want to get notifications for,
-  and add them to the current run loop.  Invoke the callbacks that will be responding
-  to these notifications once to arm them, and discover any devices that
-  are currently connected at the time notifications are setup.
-*/
-bool QextSerialEnumeratorPrivate::setUpNotifications_sys(bool /*setup*/)
-{
-    kern_return_t kernResult;
-    mach_port_t masterPort;
-    CFRunLoopSourceRef notificationRunLoopSource;
-    CFMutableDictionaryRef classesToMatch;
-    CFMutableDictionaryRef cdcClassesToMatch;
-    io_iterator_t portIterator;
-
-    kernResult = IOMasterPort(MACH_PORT_NULL, &masterPort);
-    if (KERN_SUCCESS != kernResult) {
-        qDebug() << "IOMasterPort returned:" << kernResult;
-        return false;
-    }
-
-    classesToMatch = IOServiceMatching(kIOSerialBSDServiceValue);
-    if (classesToMatch == NULL)
-        qDebug("IOServiceMatching returned a NULL dictionary.");
-    else
-        CFDictionarySetValue(classesToMatch, CFSTR(kIOSerialBSDTypeKey), CFSTR(kIOSerialBSDAllTypes));
-
-    if (!(cdcClassesToMatch = IOServiceNameMatching("AppleUSBCDC"))) {
-        QESP_WARNING("couldn't create cdc matching dict");
-        return false;
-    }
-
-    // Retain an additional reference since each call to IOServiceAddMatchingNotification consumes one.
-    classesToMatch = (CFMutableDictionaryRef) CFRetain(classesToMatch);
-    cdcClassesToMatch = (CFMutableDictionaryRef) CFRetain(cdcClassesToMatch);
-
-    notificationPortRef = IONotificationPortCreate(masterPort);
-    if (notificationPortRef == NULL) {
-        qDebug("IONotificationPortCreate return a NULL IONotificationPortRef.");
-        return false;
-    }
-
-    notificationRunLoopSource = IONotificationPortGetRunLoopSource(notificationPortRef);
-    if (notificationRunLoopSource == NULL) {
-        qDebug("IONotificationPortGetRunLoopSource returned NULL CFRunLoopSourceRef.");
-        return false;
-    }
-
-    CFRunLoopAddSource(CFRunLoopGetCurrent(), notificationRunLoopSource, kCFRunLoopDefaultMode);
-
-    kernResult = IOServiceAddMatchingNotification(notificationPortRef, kIOMatchedNotification, classesToMatch,
-                                                  deviceDiscoveredCallbackOSX, this, &portIterator);
-    if (kernResult != KERN_SUCCESS) {
-        qDebug() << "IOServiceAddMatchingNotification return:" << kernResult;
-        return false;
-    }
-
-    // arm the callback, and grab any devices that are already connected
-    deviceDiscoveredCallbackOSX(this, portIterator);
-
-    kernResult = IOServiceAddMatchingNotification(notificationPortRef, kIOMatchedNotification, cdcClassesToMatch,
-                                                  deviceDiscoveredCallbackOSX, this, &portIterator);
-    if (kernResult != KERN_SUCCESS) {
-        qDebug() << "IOServiceAddMatchingNotification return:" << kernResult;
-        return false;
-    }
-
-    // arm the callback, and grab any devices that are already connected
-    deviceDiscoveredCallbackOSX(this, portIterator);
-
-    kernResult = IOServiceAddMatchingNotification(notificationPortRef, kIOTerminatedNotification, classesToMatch,
-                                                  deviceTerminatedCallbackOSX, this, &portIterator);
-    if (kernResult != KERN_SUCCESS) {
-        qDebug() << "IOServiceAddMatchingNotification return:" << kernResult;
-        return false;
-    }
-
-    // arm the callback, and clear any devices that are terminated
-    deviceTerminatedCallbackOSX(this, portIterator);
-
-    kernResult = IOServiceAddMatchingNotification(notificationPortRef, kIOTerminatedNotification, cdcClassesToMatch,
-                                                  deviceTerminatedCallbackOSX, this, &portIterator);
-    if (kernResult != KERN_SUCCESS) {
-        qDebug() << "IOServiceAddMatchingNotification return:" << kernResult;
-        return false;
-    }
-
-    // arm the callback, and clear any devices that are terminated
-    deviceTerminatedCallbackOSX(this, portIterator);
-    return true;
-}
-
+/****************************************************************************
+** Copyright (c) 2000-2003 Wayne Roth
+** Copyright (c) 2004-2007 Stefan Sander
+** Copyright (c) 2007 Michal Policht
+** Copyright (c) 2008 Brandon Fosdick
+** Copyright (c) 2009-2010 Liam Staskawicz
+** Copyright (c) 2011 Debao Zhang
+** All right reserved.
+** Web: http://code.google.com/p/qextserialport/
+**
+** Permission is hereby granted, free of charge, to any person obtaining
+** a copy of this software and associated documentation files (the
+** "Software"), to deal in the Software without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Software, and to
+** permit persons to whom the Software is furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be
+** included in all copies or substantial portions of the Software.
+**
+** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+**
+****************************************************************************/
+
+#include "qextserialenumerator.h"
+#include "qextserialenumerator_p.h"
+#include <QtCore/QDebug>
+#include <IOKit/serial/IOSerialKeys.h>
+#include <CoreFoundation/CFNumber.h>
+#include <sys/param.h>
+
+void QextSerialEnumeratorPrivate::platformSpecificInit()
+{
+}
+
+void QextSerialEnumeratorPrivate::platformSpecificDestruct()
+{
+    IONotificationPortDestroy(notificationPortRef);
+}
+
+// static
+QList<QextPortInfo> QextSerialEnumeratorPrivate::getPorts_sys()
+{
+    QList<QextPortInfo> infoList;
+    io_iterator_t serialPortIterator = 0;
+    kern_return_t kernResult = KERN_FAILURE;
+    CFMutableDictionaryRef matchingDictionary;
+
+    // first try to get any serialbsd devices, then try any USBCDC devices
+    if (!(matchingDictionary = IOServiceMatching(kIOSerialBSDServiceValue))) {
+        QESP_WARNING("IOServiceMatching returned a NULL dictionary.");
+        return infoList;
+    }
+    CFDictionaryAddValue(matchingDictionary, CFSTR(kIOSerialBSDTypeKey), CFSTR(kIOSerialBSDAllTypes));
+
+    // then create the iterator with all the matching devices
+    if (IOServiceGetMatchingServices(kIOMasterPortDefault, matchingDictionary, &serialPortIterator) != KERN_SUCCESS) {
+        qCritical() << "IOServiceGetMatchingServices failed, returned" << kernResult;
+        return infoList;
+    }
+    iterateServicesOSX(serialPortIterator, infoList);
+    IOObjectRelease(serialPortIterator);
+    serialPortIterator = 0;
+
+    if (!(matchingDictionary = IOServiceNameMatching("AppleUSBCDC"))) {
+        QESP_WARNING("IOServiceNameMatching returned a NULL dictionary.");
+        return infoList;
+    }
+
+    if (IOServiceGetMatchingServices(kIOMasterPortDefault, matchingDictionary, &serialPortIterator) != KERN_SUCCESS) {
+        qCritical() << "IOServiceGetMatchingServices failed, returned" << kernResult;
+        return infoList;
+    }
+    iterateServicesOSX(serialPortIterator, infoList);
+    IOObjectRelease(serialPortIterator);
+
+    return infoList;
+}
+
+void QextSerialEnumeratorPrivate::iterateServicesOSX(io_object_t service, QList<QextPortInfo> &infoList)
+{
+    // Iterate through all modems found.
+    io_object_t usbService;
+    while ((usbService = IOIteratorNext(service))) {
+        QextPortInfo info;
+        info.vendorID = 0;
+        info.productID = 0;
+        getServiceDetailsOSX(usbService, &info);
+        infoList.append(info);
+    }
+}
+
+bool QextSerialEnumeratorPrivate::getServiceDetailsOSX(io_object_t service, QextPortInfo *portInfo)
+{
+    bool retval = true;
+    CFTypeRef bsdPathAsCFString = NULL;
+    CFTypeRef productNameAsCFString = NULL;
+    CFTypeRef vendorIdAsCFNumber = NULL;
+    CFTypeRef productIdAsCFNumber = NULL;
+    // check the name of the modem's callout device
+    bsdPathAsCFString = IORegistryEntryCreateCFProperty(service, CFSTR(kIOCalloutDeviceKey),
+                                                        kCFAllocatorDefault, 0);
+
+    // wander up the hierarchy until we find the level that can give us the
+    // vendor/product IDs and the product name, if available
+    io_registry_entry_t parent;
+    kern_return_t kernResult = IORegistryEntryGetParentEntry(service, kIOServicePlane, &parent);
+    while (kernResult == KERN_SUCCESS && !vendorIdAsCFNumber && !productIdAsCFNumber) {
+        if (!productNameAsCFString)
+            productNameAsCFString = IORegistryEntrySearchCFProperty(parent,
+                                                                    kIOServicePlane,
+                                                                    CFSTR("Product Name"),
+                                                                    kCFAllocatorDefault, 0);
+        vendorIdAsCFNumber = IORegistryEntrySearchCFProperty(parent,
+                                                             kIOServicePlane,
+                                                             CFSTR(kUSBVendorID),
+                                                             kCFAllocatorDefault, 0);
+        productIdAsCFNumber = IORegistryEntrySearchCFProperty(parent,
+                                                              kIOServicePlane,
+                                                              CFSTR(kUSBProductID),
+                                                              kCFAllocatorDefault, 0);
+        io_registry_entry_t oldparent = parent;
+        kernResult = IORegistryEntryGetParentEntry(parent, kIOServicePlane, &parent);
+        IOObjectRelease(oldparent);
+    }
+
+    io_string_t ioPathName;
+    IORegistryEntryGetPath(service, kIOServicePlane, ioPathName);
+    portInfo->physName = ioPathName;
+
+    if (bsdPathAsCFString) {
+        char path[MAXPATHLEN];
+        if (CFStringGetCString((CFStringRef)bsdPathAsCFString, path,
+                               PATH_MAX, kCFStringEncodingUTF8))
+            portInfo->portName = path;
+        CFRelease(bsdPathAsCFString);
+    }
+
+    if (productNameAsCFString) {
+        char productName[MAXPATHLEN];
+        if (CFStringGetCString((CFStringRef)productNameAsCFString, productName,
+                               PATH_MAX, kCFStringEncodingUTF8))
+            portInfo->friendName = productName;
+        CFRelease(productNameAsCFString);
+    }
+
+    if (vendorIdAsCFNumber) {
+        SInt32 vID;
+        if (CFNumberGetValue((CFNumberRef)vendorIdAsCFNumber, kCFNumberSInt32Type, &vID))
+            portInfo->vendorID = vID;
+        CFRelease(vendorIdAsCFNumber);
+    }
+
+    if (productIdAsCFNumber) {
+        SInt32 pID;
+        if (CFNumberGetValue((CFNumberRef)productIdAsCFNumber, kCFNumberSInt32Type, &pID))
+            portInfo->productID = pID;
+        CFRelease(productIdAsCFNumber);
+    }
+    IOObjectRelease(service);
+    return retval;
+}
+
+// IOKit callbacks registered via setupNotifications()
+void deviceDiscoveredCallbackOSX(void *ctxt, io_iterator_t serialPortIterator)
+{
+    QextSerialEnumeratorPrivate *d = (QextSerialEnumeratorPrivate *)ctxt;
+    io_object_t serialService;
+    while ((serialService = IOIteratorNext(serialPortIterator)))
+        d->onDeviceDiscoveredOSX(serialService);
+}
+
+void deviceTerminatedCallbackOSX(void *ctxt, io_iterator_t serialPortIterator)
+{
+    QextSerialEnumeratorPrivate *d = (QextSerialEnumeratorPrivate *)ctxt;
+    io_object_t serialService;
+    while ((serialService = IOIteratorNext(serialPortIterator)))
+        d->onDeviceTerminatedOSX(serialService);
+}
+
+/*
+  A device has been discovered via IOKit.
+  Create a QextPortInfo if possible, and emit the signal indicating that we've found it.
+*/
+void QextSerialEnumeratorPrivate::onDeviceDiscoveredOSX(io_object_t service)
+{
+    Q_Q(QextSerialEnumerator);
+    QextPortInfo info;
+    info.vendorID = 0;
+    info.productID = 0;
+    if (getServiceDetailsOSX(service, &info))
+        Q_EMIT q->deviceDiscovered(info);
+}
+
+/*
+  Notification via IOKit that a device has been removed.
+  Create a QextPortInfo if possible, and emit the signal indicating that it's gone.
+*/
+void QextSerialEnumeratorPrivate::onDeviceTerminatedOSX(io_object_t service)
+{
+    Q_Q(QextSerialEnumerator);
+    QextPortInfo info;
+    info.vendorID = 0;
+    info.productID = 0;
+    if (getServiceDetailsOSX(service, &info))
+        Q_EMIT q->deviceRemoved(info);
+}
+
+/*
+  Create matching dictionaries for the devices we want to get notifications for,
+  and add them to the current run loop.  Invoke the callbacks that will be responding
+  to these notifications once to arm them, and discover any devices that
+  are currently connected at the time notifications are setup.
+*/
+bool QextSerialEnumeratorPrivate::setUpNotifications_sys(bool /*setup*/)
+{
+    kern_return_t kernResult;
+    mach_port_t masterPort;
+    CFRunLoopSourceRef notificationRunLoopSource;
+    CFMutableDictionaryRef classesToMatch;
+    CFMutableDictionaryRef cdcClassesToMatch;
+    io_iterator_t portIterator;
+
+    kernResult = IOMasterPort(MACH_PORT_NULL, &masterPort);
+    if (KERN_SUCCESS != kernResult) {
+        qDebug() << "IOMasterPort returned:" << kernResult;
+        return false;
+    }
+
+    classesToMatch = IOServiceMatching(kIOSerialBSDServiceValue);
+    if (classesToMatch == NULL)
+        qDebug("IOServiceMatching returned a NULL dictionary.");
+    else
+        CFDictionarySetValue(classesToMatch, CFSTR(kIOSerialBSDTypeKey), CFSTR(kIOSerialBSDAllTypes));
+
+    if (!(cdcClassesToMatch = IOServiceNameMatching("AppleUSBCDC"))) {
+        QESP_WARNING("couldn't create cdc matching dict");
+        return false;
+    }
+
+    // Retain an additional reference since each call to IOServiceAddMatchingNotification consumes one.
+    classesToMatch = (CFMutableDictionaryRef) CFRetain(classesToMatch);
+    cdcClassesToMatch = (CFMutableDictionaryRef) CFRetain(cdcClassesToMatch);
+
+    notificationPortRef = IONotificationPortCreate(masterPort);
+    if (notificationPortRef == NULL) {
+        qDebug("IONotificationPortCreate return a NULL IONotificationPortRef.");
+        return false;
+    }
+
+    notificationRunLoopSource = IONotificationPortGetRunLoopSource(notificationPortRef);
+    if (notificationRunLoopSource == NULL) {
+        qDebug("IONotificationPortGetRunLoopSource returned NULL CFRunLoopSourceRef.");
+        return false;
+    }
+
+    CFRunLoopAddSource(CFRunLoopGetCurrent(), notificationRunLoopSource, kCFRunLoopDefaultMode);
+
+    kernResult = IOServiceAddMatchingNotification(notificationPortRef, kIOMatchedNotification, classesToMatch,
+                                                  deviceDiscoveredCallbackOSX, this, &portIterator);
+    if (kernResult != KERN_SUCCESS) {
+        qDebug() << "IOServiceAddMatchingNotification return:" << kernResult;
+        return false;
+    }
+
+    // arm the callback, and grab any devices that are already connected
+    deviceDiscoveredCallbackOSX(this, portIterator);
+
+    kernResult = IOServiceAddMatchingNotification(notificationPortRef, kIOMatchedNotification, cdcClassesToMatch,
+                                                  deviceDiscoveredCallbackOSX, this, &portIterator);
+    if (kernResult != KERN_SUCCESS) {
+        qDebug() << "IOServiceAddMatchingNotification return:" << kernResult;
+        return false;
+    }
+
+    // arm the callback, and grab any devices that are already connected
+    deviceDiscoveredCallbackOSX(this, portIterator);
+
+    kernResult = IOServiceAddMatchingNotification(notificationPortRef, kIOTerminatedNotification, classesToMatch,
+                                                  deviceTerminatedCallbackOSX, this, &portIterator);
+    if (kernResult != KERN_SUCCESS) {
+        qDebug() << "IOServiceAddMatchingNotification return:" << kernResult;
+        return false;
+    }
+
+    // arm the callback, and clear any devices that are terminated
+    deviceTerminatedCallbackOSX(this, portIterator);
+
+    kernResult = IOServiceAddMatchingNotification(notificationPortRef, kIOTerminatedNotification, cdcClassesToMatch,
+                                                  deviceTerminatedCallbackOSX, this, &portIterator);
+    if (kernResult != KERN_SUCCESS) {
+        qDebug() << "IOServiceAddMatchingNotification return:" << kernResult;
+        return false;
+    }
+
+    // arm the callback, and clear any devices that are terminated
+    deviceTerminatedCallbackOSX(this, portIterator);
+    return true;
+}
+
diff --git a/interfaces/qextserialport/qextserialenumerator_p.h b/interfaces/qextserialport/qextserialenumerator_p.h
index 17fdeea..f7a8fd8 100644
--- a/interfaces/qextserialport/qextserialenumerator_p.h
+++ b/interfaces/qextserialport/qextserialenumerator_p.h
@@ -1,120 +1,120 @@
-/****************************************************************************
-** Copyright (c) 2000-2003 Wayne Roth
-** Copyright (c) 2004-2007 Stefan Sander
-** Copyright (c) 2007 Michal Policht
-** Copyright (c) 2008 Brandon Fosdick
-** Copyright (c) 2009-2010 Liam Staskawicz
-** Copyright (c) 2011 Debao Zhang
-** Copyright (c) 2012 Doug Brown
-** All right reserved.
-** Web: http://code.google.com/p/qextserialport/
-**
-** Permission is hereby granted, free of charge, to any person obtaining
-** a copy of this software and associated documentation files (the
-** "Software"), to deal in the Software without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Software, and to
-** permit persons to whom the Software is furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be
-** included in all copies or substantial portions of the Software.
-**
-** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-**
-****************************************************************************/
-#ifndef _QEXTSERIALENUMERATOR_P_H_
-#define _QEXTSERIALENUMERATOR_P_H_
-
-//
-//  W A R N I N G
-//  -------------
-//
-// This file is not part of the QESP API.  It exists for the convenience
-// of other QESP classes.  This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qextserialenumerator.h"
-
-#ifdef Q_OS_WIN
-// needed for mingw to pull in appropriate dbt business...
-// probably a better way to do this
-// http://mingw-users.1079350.n2.nabble.com/DEV-BROADCAST-DEVICEINTERFACE-was-not-declared-in-this-scope-td3552762.html
-#  ifdef  __MINGW32__
-#    define _WIN32_WINNT 0x0501
-#    define _WIN32_WINDOWS 0x0501
-#    define WINVER 0x0501
-#  endif
-#  include <QtCore/qt_windows.h>
-#endif /*Q_OS_WIN*/
-
-#ifdef Q_OS_MAC
-#  include <IOKit/usb/IOUSBLib.h>
-#endif /*Q_OS_MAC*/
-
-#if defined(Q_OS_LINUX) && !defined(QESP_NO_UDEV)
-#  include <QSocketNotifier>
-extern "C" {
-#  include <libudev.h>
-}
-#endif
-
-class QextSerialRegistrationWidget;
-class QextSerialEnumeratorPrivate
-{
-    Q_DECLARE_PUBLIC(QextSerialEnumerator)
-public:
-    QextSerialEnumeratorPrivate(QextSerialEnumerator *enumrator);
-    ~QextSerialEnumeratorPrivate();
-    void platformSpecificInit();
-    void platformSpecificDestruct();
-
-    static QList<QextPortInfo> getPorts_sys();
-    bool setUpNotifications_sys(bool setup);
-
-#ifdef Q_OS_WIN
-    LRESULT onDeviceChanged(WPARAM wParam, LPARAM lParam);
-    bool matchAndDispatchChangedDevice(const QString &deviceID, const GUID &guid, WPARAM wParam);
-#  ifdef QT_GUI_LIB
-    QextSerialRegistrationWidget *notificationWidget;
-#  endif
-#endif /*Q_OS_WIN*/
-
-#ifdef Q_OS_MAC
-    /*!
-     * Search for serial ports using IOKit.
-     *    \param infoList list with result.
-     */
-    static void iterateServicesOSX(io_object_t service, QList<QextPortInfo> &infoList);
-    static bool getServiceDetailsOSX(io_object_t service, QextPortInfo *portInfo);
-    void onDeviceDiscoveredOSX(io_object_t service);
-    void onDeviceTerminatedOSX(io_object_t service);
-    friend void deviceDiscoveredCallbackOSX(void *ctxt, io_iterator_t serialPortIterator);
-    friend void deviceTerminatedCallbackOSX(void *ctxt, io_iterator_t serialPortIterator);
-
-    IONotificationPortRef notificationPortRef;
-#endif // Q_OS_MAC
-
-#if defined(Q_OS_LINUX) && !defined(QESP_NO_UDEV)
-    QSocketNotifier *notifier;
-    int notifierFd;
-    struct udev *udev;
-    struct udev_monitor *monitor;
-
-    void _q_deviceEvent();
-#endif
-
-private:
-    QextSerialEnumerator *q_ptr;
-};
-
-#endif //_QEXTSERIALENUMERATOR_P_H_
+/****************************************************************************
+** Copyright (c) 2000-2003 Wayne Roth
+** Copyright (c) 2004-2007 Stefan Sander
+** Copyright (c) 2007 Michal Policht
+** Copyright (c) 2008 Brandon Fosdick
+** Copyright (c) 2009-2010 Liam Staskawicz
+** Copyright (c) 2011 Debao Zhang
+** Copyright (c) 2012 Doug Brown
+** All right reserved.
+** Web: http://code.google.com/p/qextserialport/
+**
+** Permission is hereby granted, free of charge, to any person obtaining
+** a copy of this software and associated documentation files (the
+** "Software"), to deal in the Software without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Software, and to
+** permit persons to whom the Software is furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be
+** included in all copies or substantial portions of the Software.
+**
+** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+**
+****************************************************************************/
+#ifndef _QEXTSERIALENUMERATOR_P_H_
+#define _QEXTSERIALENUMERATOR_P_H_
+
+//
+//  W A R N I N G
+//  -------------
+//
+// This file is not part of the QESP API.  It exists for the convenience
+// of other QESP classes.  This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qextserialenumerator.h"
+
+#ifdef Q_OS_WIN
+// needed for mingw to pull in appropriate dbt business...
+// probably a better way to do this
+// http://mingw-users.1079350.n2.nabble.com/DEV-BROADCAST-DEVICEINTERFACE-was-not-declared-in-this-scope-td3552762.html
+#  ifdef  __MINGW32__
+#    define _WIN32_WINNT 0x0501
+#    define _WIN32_WINDOWS 0x0501
+#    define WINVER 0x0501
+#  endif
+#  include <QtCore/qt_windows.h>
+#endif /*Q_OS_WIN*/
+
+#ifdef Q_OS_MAC
+#  include <IOKit/usb/IOUSBLib.h>
+#endif /*Q_OS_MAC*/
+
+#if defined(Q_OS_LINUX) && !defined(QESP_NO_UDEV)
+#  include <QSocketNotifier>
+extern "C" {
+#  include <libudev.h>
+}
+#endif
+
+class QextSerialRegistrationWidget;
+class QextSerialEnumeratorPrivate
+{
+    Q_DECLARE_PUBLIC(QextSerialEnumerator)
+public:
+    QextSerialEnumeratorPrivate(QextSerialEnumerator *enumrator);
+    ~QextSerialEnumeratorPrivate();
+    void platformSpecificInit();
+    void platformSpecificDestruct();
+
+    static QList<QextPortInfo> getPorts_sys();
+    bool setUpNotifications_sys(bool setup);
+
+#ifdef Q_OS_WIN
+    LRESULT onDeviceChanged(WPARAM wParam, LPARAM lParam);
+    bool matchAndDispatchChangedDevice(const QString &deviceID, const GUID &guid, WPARAM wParam);
+#  ifdef QT_GUI_LIB
+    QextSerialRegistrationWidget *notificationWidget;
+#  endif
+#endif /*Q_OS_WIN*/
+
+#ifdef Q_OS_MAC
+    /*!
+     * Search for serial ports using IOKit.
+     *    \param infoList list with result.
+     */
+    static void iterateServicesOSX(io_object_t service, QList<QextPortInfo> &infoList);
+    static bool getServiceDetailsOSX(io_object_t service, QextPortInfo *portInfo);
+    void onDeviceDiscoveredOSX(io_object_t service);
+    void onDeviceTerminatedOSX(io_object_t service);
+    friend void deviceDiscoveredCallbackOSX(void *ctxt, io_iterator_t serialPortIterator);
+    friend void deviceTerminatedCallbackOSX(void *ctxt, io_iterator_t serialPortIterator);
+
+    IONotificationPortRef notificationPortRef;
+#endif // Q_OS_MAC
+
+#if defined(Q_OS_LINUX) && !defined(QESP_NO_UDEV)
+    QSocketNotifier *notifier;
+    int notifierFd;
+    struct udev *udev;
+    struct udev_monitor *monitor;
+
+    void _q_deviceEvent();
+#endif
+
+private:
+    QextSerialEnumerator *q_ptr;
+};
+
+#endif //_QEXTSERIALENUMERATOR_P_H_
diff --git a/interfaces/qextserialport/qextserialenumerator_unix.cpp b/interfaces/qextserialport/qextserialenumerator_unix.cpp
index 80a4ad4..1e6615f 100644
--- a/interfaces/qextserialport/qextserialenumerator_unix.cpp
+++ b/interfaces/qextserialport/qextserialenumerator_unix.cpp
@@ -1,56 +1,56 @@
-/****************************************************************************
-** Copyright (c) 2000-2003 Wayne Roth
-** Copyright (c) 2004-2007 Stefan Sander
-** Copyright (c) 2007 Michal Policht
-** Copyright (c) 2008 Brandon Fosdick
-** Copyright (c) 2009-2010 Liam Staskawicz
-** Copyright (c) 2011 Debao Zhang
-** All right reserved.
-** Web: http://code.google.com/p/qextserialport/
-**
-** Permission is hereby granted, free of charge, to any person obtaining
-** a copy of this software and associated documentation files (the
-** "Software"), to deal in the Software without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Software, and to
-** permit persons to whom the Software is furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be
-** included in all copies or substantial portions of the Software.
-**
-** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-**
-****************************************************************************/
-
-#include "qextserialenumerator.h"
-#include "qextserialenumerator_p.h"
-#include <QtCore/QDebug>
-
-void QextSerialEnumeratorPrivate::platformSpecificInit()
-{
-}
-
-void QextSerialEnumeratorPrivate::platformSpecificDestruct()
-{
-}
-
-QList<QextPortInfo> QextSerialEnumeratorPrivate::getPorts_sys()
-{
-    QList<QextPortInfo> infoList;
-    QESP_WARNING("Enumeration for POSIX systems (except Linux) is not implemented yet.");
-    return infoList;
-}
-
-bool QextSerialEnumeratorPrivate::setUpNotifications_sys(bool setup)
-{
-    Q_UNUSED(setup)
-    QESP_WARNING("Notifications for *Nix/FreeBSD are not implemented yet");
-    return false;
-}
+/****************************************************************************
+** Copyright (c) 2000-2003 Wayne Roth
+** Copyright (c) 2004-2007 Stefan Sander
+** Copyright (c) 2007 Michal Policht
+** Copyright (c) 2008 Brandon Fosdick
+** Copyright (c) 2009-2010 Liam Staskawicz
+** Copyright (c) 2011 Debao Zhang
+** All right reserved.
+** Web: http://code.google.com/p/qextserialport/
+**
+** Permission is hereby granted, free of charge, to any person obtaining
+** a copy of this software and associated documentation files (the
+** "Software"), to deal in the Software without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Software, and to
+** permit persons to whom the Software is furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be
+** included in all copies or substantial portions of the Software.
+**
+** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+**
+****************************************************************************/
+
+#include "qextserialenumerator.h"
+#include "qextserialenumerator_p.h"
+#include <QtCore/QDebug>
+
+void QextSerialEnumeratorPrivate::platformSpecificInit()
+{
+}
+
+void QextSerialEnumeratorPrivate::platformSpecificDestruct()
+{
+}
+
+QList<QextPortInfo> QextSerialEnumeratorPrivate::getPorts_sys()
+{
+    QList<QextPortInfo> infoList;
+    QESP_WARNING("Enumeration for POSIX systems (except Linux) is not implemented yet.");
+    return infoList;
+}
+
+bool QextSerialEnumeratorPrivate::setUpNotifications_sys(bool setup)
+{
+    Q_UNUSED(setup)
+    QESP_WARNING("Notifications for *Nix/FreeBSD are not implemented yet");
+    return false;
+}
diff --git a/interfaces/qextserialport/qextserialenumerator_win.cpp b/interfaces/qextserialport/qextserialenumerator_win.cpp
index 30b656c..0269b76 100644
--- a/interfaces/qextserialport/qextserialenumerator_win.cpp
+++ b/interfaces/qextserialport/qextserialenumerator_win.cpp
@@ -1,318 +1,318 @@
-/****************************************************************************
-** Copyright (c) 2000-2003 Wayne Roth
-** Copyright (c) 2004-2007 Stefan Sander
-** Copyright (c) 2007 Michal Policht
-** Copyright (c) 2008 Brandon Fosdick
-** Copyright (c) 2009-2010 Liam Staskawicz
-** Copyright (c) 2011 Debao Zhang
-** All right reserved.
-** Web: http://code.google.com/p/qextserialport/
-**
-** Permission is hereby granted, free of charge, to any person obtaining
-** a copy of this software and associated documentation files (the
-** "Software"), to deal in the Software without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Software, and to
-** permit persons to whom the Software is furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be
-** included in all copies or substantial portions of the Software.
-**
-** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-**
-****************************************************************************/
-
-#include "qextserialenumerator.h"
-#include "qextserialenumerator_p.h"
-#include <QtCore/QDebug>
-#include <QtCore/QMetaType>
-#include <QtCore/QRegExp>
-#include <objbase.h>
-#include <initguid.h>
-#include <setupapi.h>
-#include <dbt.h>
-#include "qextserialport.h"
-
-#ifdef QT_GUI_LIB
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
-#include <QtGui/QWidget>
-class QextSerialRegistrationWidget : public QWidget
-#else
-#include <QtGui/QWindow>
-class QextSerialRegistrationWidget : public QWindow
-#endif
-{
-public:
-    QextSerialRegistrationWidget(QextSerialEnumeratorPrivate *qese) {
-        this->qese = qese;
-    }
-    ~QextSerialRegistrationWidget() {}
-
-protected:
-
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
-    bool winEvent(MSG *message, long *result) {
-#else
-    bool nativeEvent(const QByteArray & /*eventType*/, void *msg, long *result) {
-        MSG *message = static_cast<MSG *>(msg);
-#endif
-        if (message->message == WM_DEVICECHANGE) {
-            qese->onDeviceChanged(message->wParam, message->lParam);
-            *result = 1;
-            return true;
-        }
-        return false;
-    }
-private:
-    QextSerialEnumeratorPrivate *qese;
-};
-
-#endif // QT_GUI_LIB
-
-void QextSerialEnumeratorPrivate::platformSpecificInit()
-{
-#ifdef QT_GUI_LIB
-    notificationWidget = 0;
-#endif // QT_GUI_LIB
-}
-
-/*!
-  default
-*/
-void QextSerialEnumeratorPrivate::platformSpecificDestruct()
-{
-#ifdef QT_GUI_LIB
-    if (notificationWidget)
-        delete notificationWidget;
-#endif
-}
-
-// see http://msdn.microsoft.com/en-us/library/windows/hardware/ff553426(v=vs.85).aspx
-// for list of GUID classes
-const GUID deviceClassGuids[] =
-{
-    // Ports (COM & LPT ports), Class = Ports
-    {0x4D36E978, 0xE325, 0x11CE, {0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18}},
-    // Modem, Class = Modem
-    {0x4D36E96D, 0xE325, 0x11CE, {0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18}},
-    // Bluetooth Devices, Class = Bluetooth
-    {0xE0CBF06C, 0xCD8B, 0x4647, {0xBB, 0x8A, 0x26, 0x3B, 0x43, 0xF0, 0xF9, 0x74}},
-    // Added by Arne Kristian Jansen, for use with com0com virtual ports (See Issue 54)
-    {0xDF799E12, 0x3C56, 0x421B, {0xB2, 0x98, 0xB6, 0xD3, 0x64, 0x2B, 0xC8, 0x78}}
-};
-
-/* Gordon Schumacher's macros for TCHAR -> QString conversions and vice versa */
-#ifdef UNICODE
-    #define QStringToTCHAR(x)     (wchar_t *) x.utf16()
-    #define PQStringToTCHAR(x)    (wchar_t *) x->utf16()
-    #define TCHARToQString(x)     QString::fromUtf16((ushort *)(x))
-    #define TCHARToQStringN(x,y)  QString::fromUtf16((ushort *)(x),(y))
-#else
-    #define QStringToTCHAR(x)     x.local8Bit().constData()
-    #define PQStringToTCHAR(x)    x->local8Bit().constData()
-    #define TCHARToQString(x)     QString::fromLocal8Bit((char *)(x))
-    #define TCHARToQStringN(x,y)  QString::fromLocal8Bit((char *)(x),(y))
-#endif /*UNICODE*/
-
-/*!
-    \internal
-    Get value of specified property from the registry.
-        \a key handle to an open key.
-        \a property property name.
-
-        return property value.
-*/
-static QString getRegKeyValue(HKEY key, LPCTSTR property)
-{
-    DWORD size = 0;
-    DWORD type;
-    ::RegQueryValueEx(key, property, NULL, NULL, NULL, &size);
-    BYTE *buff = new BYTE[size];
-    QString result;
-    if (::RegQueryValueEx(key, property, NULL, &type, buff, &size) == ERROR_SUCCESS)
-        result = TCHARToQString(buff);
-    ::RegCloseKey(key);
-    delete [] buff;
-    return result;
-}
-
-/*!
-     \internal
-     Get specific property from registry.
-     \a devInfo pointer to the device information set that contains the interface
-        and its underlying device. Returned by SetupDiGetClassDevs() function.
-     \a devData pointer to an SP_DEVINFO_DATA structure that defines the device instance.
-        this is returned by SetupDiGetDeviceInterfaceDetail() function.
-     \a property registry property. One of defined SPDRP_* constants.
-
-     return property string.
- */
-static QString getDeviceProperty(HDEVINFO devInfo, PSP_DEVINFO_DATA devData, DWORD property)
-{
-    DWORD buffSize = 0;
-    ::SetupDiGetDeviceRegistryProperty(devInfo, devData, property, NULL, NULL, 0, &buffSize);
-    BYTE *buff = new BYTE[buffSize];
-    ::SetupDiGetDeviceRegistryProperty(devInfo, devData, property, NULL, buff, buffSize, NULL);
-    QString result = TCHARToQString(buff);
-    delete [] buff;
-    return result;
-}
-
-/*!
-     \internal
-*/
-static bool getDeviceDetailsWin(QextPortInfo *portInfo, HDEVINFO devInfo, PSP_DEVINFO_DATA devData
-                                 , WPARAM wParam = DBT_DEVICEARRIVAL)
-{
-    portInfo->friendName = getDeviceProperty(devInfo, devData, SPDRP_FRIENDLYNAME);
-    if (wParam == DBT_DEVICEARRIVAL)
-        portInfo->physName = getDeviceProperty(devInfo, devData, SPDRP_PHYSICAL_DEVICE_OBJECT_NAME);
-    portInfo->enumName = getDeviceProperty(devInfo, devData, SPDRP_ENUMERATOR_NAME);
-    QString hardwareIDs = getDeviceProperty(devInfo, devData, SPDRP_HARDWAREID);
-    HKEY devKey = ::SetupDiOpenDevRegKey(devInfo, devData, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_QUERY_VALUE);
-    portInfo->portName = getRegKeyValue(devKey, TEXT("PortName"));
-    QRegExp idRx(QLatin1String("VID_(\\w+)&PID_(\\w+)"));
-    if (hardwareIDs.toUpper().contains(idRx)) {
-        bool dummy;
-        portInfo->vendorID = idRx.cap(1).toInt(&dummy, 16);
-        portInfo->productID = idRx.cap(2).toInt(&dummy, 16);
-        //qDebug() << "got vid:" << vid << "pid:" << pid;
-    }
-    return true;
-}
-
-/*!
-     \internal
-*/
-static void enumerateDevicesWin(const GUID &guid, QList<QextPortInfo> *infoList)
-{
-    HDEVINFO devInfo;
-    if ((devInfo = ::SetupDiGetClassDevs(&guid, NULL, NULL, DIGCF_PRESENT)) != INVALID_HANDLE_VALUE) {
-        SP_DEVINFO_DATA devInfoData;
-        devInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
-        for(int i = 0; ::SetupDiEnumDeviceInfo(devInfo, i, &devInfoData); i++) {
-            QextPortInfo info;
-            info.productID = info.vendorID = 0;
-            getDeviceDetailsWin(&info, devInfo, &devInfoData);
-            if (!info.portName.startsWith(QLatin1String("LPT"), Qt::CaseInsensitive))
-                infoList->append(info);
-        }
-        ::SetupDiDestroyDeviceInfoList(devInfo);
-    }
-}
-
-
-static bool lessThan(const QextPortInfo &s1, const QextPortInfo &s2)
-{
-    if (s1.portName.startsWith(QLatin1String("COM"))
-            && s2.portName.startsWith(QLatin1String("COM"))) {
-        return s1.portName.mid(3).toInt()<s2.portName.mid(3).toInt();
-    }
-    return s1.portName < s2.portName;
-}
-
-
-/*!
-    Get list of ports.
-
-    return list of ports currently available in the system.
-*/
-QList<QextPortInfo> QextSerialEnumeratorPrivate::getPorts_sys()
-{
-    QList<QextPortInfo> ports;
-    const int count = sizeof(deviceClassGuids)/sizeof(deviceClassGuids[0]);
-    for (int i=0; i<count; ++i)
-        enumerateDevicesWin(deviceClassGuids[i], &ports);
-    qSort(ports.begin(), ports.end(), lessThan);
-    return ports;
-}
-
-
-/*
-    Enable event-driven notifications of board discovery/removal.
-*/
-bool QextSerialEnumeratorPrivate::setUpNotifications_sys(bool setup)
-{
-#ifndef QT_GUI_LIB
-    Q_UNUSED(setup)
-    QESP_WARNING("QextSerialEnumerator: GUI not enabled - can't register for device notifications.");
-    return false;
-#else
-    Q_Q(QextSerialEnumerator);
-    if (setup && notificationWidget) //already setup
-        return true;
-    notificationWidget = new QextSerialRegistrationWidget(this);
-
-    DEV_BROADCAST_DEVICEINTERFACE dbh;
-    ::ZeroMemory(&dbh, sizeof(dbh));
-    dbh.dbcc_size = sizeof(dbh);
-    dbh.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
-    // dbh.dbcc_classguid = GUID_DEVCLASS_PORTS; //Ignored in such case
-    DWORD flags = DEVICE_NOTIFY_WINDOW_HANDLE|DEVICE_NOTIFY_ALL_INTERFACE_CLASSES;
-    if (::RegisterDeviceNotification((HWND)notificationWidget->winId(), &dbh, flags) == NULL) {
-        QESP_WARNING() << "RegisterDeviceNotification failed:" << GetLastError();
-        return false;
-    }
-    // setting up notifications doesn't tell us about devices already connected
-    // so get those manually
-    foreach (QextPortInfo port, getPorts_sys())
-      Q_EMIT q->deviceDiscovered(port);
-    return true;
-#endif // QT_GUI_LIB
-}
-
-LRESULT QextSerialEnumeratorPrivate::onDeviceChanged(WPARAM wParam, LPARAM lParam)
-{
-    if (DBT_DEVICEARRIVAL == wParam || DBT_DEVICEREMOVECOMPLETE == wParam) {
-        PDEV_BROADCAST_HDR pHdr = (PDEV_BROADCAST_HDR)lParam;
-        if (pHdr->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) {
-            PDEV_BROADCAST_DEVICEINTERFACE pDevInf = (PDEV_BROADCAST_DEVICEINTERFACE)pHdr;
-             // delimiters are different across APIs...change to backslash.  ugh.
-            QString deviceID = TCHARToQString(pDevInf->dbcc_name).toUpper().replace(QLatin1String("#"), QLatin1String("\\"));
-
-            const int count = sizeof(deviceClassGuids)/sizeof(deviceClassGuids[0]);
-            for (int i=0; i<count; ++i) {
-                if (matchAndDispatchChangedDevice(deviceID, deviceClassGuids[i], wParam))
-                    break;
-            }
-        }
-    }
-    return 0;
-}
-
-bool QextSerialEnumeratorPrivate::matchAndDispatchChangedDevice(const QString &deviceID, const GUID &guid, WPARAM wParam)
-{
-    Q_Q(QextSerialEnumerator);
-    bool rv = false;
-    DWORD dwFlag = (DBT_DEVICEARRIVAL == wParam) ? DIGCF_PRESENT : DIGCF_ALLCLASSES;
-    HDEVINFO devInfo;
-    if ((devInfo = SetupDiGetClassDevs(&guid,NULL,NULL,dwFlag)) != INVALID_HANDLE_VALUE) {
-        SP_DEVINFO_DATA spDevInfoData;
-        spDevInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
-        for(int i=0; SetupDiEnumDeviceInfo(devInfo, i, &spDevInfoData); i++) {
-            DWORD nSize = 0;
-            TCHAR buf[MAX_PATH];
-            if (SetupDiGetDeviceInstanceId(devInfo, &spDevInfoData, buf, MAX_PATH, &nSize) &&
-                    deviceID.contains(TCHARToQString(buf))) { // we found a match
-                rv = true;
-                QextPortInfo info;
-                info.productID = info.vendorID = 0;
-                getDeviceDetailsWin(&info, devInfo, &spDevInfoData, wParam);
-                if (wParam == DBT_DEVICEARRIVAL)
-                    Q_EMIT q->deviceDiscovered(info);
-                else if (wParam == DBT_DEVICEREMOVECOMPLETE)
-                    Q_EMIT q->deviceRemoved(info);
-                break;
-            }
-        }
-        SetupDiDestroyDeviceInfoList(devInfo);
-    }
-    return rv;
-}
+/****************************************************************************
+** Copyright (c) 2000-2003 Wayne Roth
+** Copyright (c) 2004-2007 Stefan Sander
+** Copyright (c) 2007 Michal Policht
+** Copyright (c) 2008 Brandon Fosdick
+** Copyright (c) 2009-2010 Liam Staskawicz
+** Copyright (c) 2011 Debao Zhang
+** All right reserved.
+** Web: http://code.google.com/p/qextserialport/
+**
+** Permission is hereby granted, free of charge, to any person obtaining
+** a copy of this software and associated documentation files (the
+** "Software"), to deal in the Software without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Software, and to
+** permit persons to whom the Software is furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be
+** included in all copies or substantial portions of the Software.
+**
+** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+**
+****************************************************************************/
+
+#include "qextserialenumerator.h"
+#include "qextserialenumerator_p.h"
+#include <QtCore/QDebug>
+#include <QtCore/QMetaType>
+#include <QtCore/QRegExp>
+#include <objbase.h>
+#include <initguid.h>
+#include <setupapi.h>
+#include <dbt.h>
+#include "qextserialport.h"
+
+#ifdef QT_GUI_LIB
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#include <QtGui/QWidget>
+class QextSerialRegistrationWidget : public QWidget
+#else
+#include <QtGui/QWindow>
+class QextSerialRegistrationWidget : public QWindow
+#endif
+{
+public:
+    QextSerialRegistrationWidget(QextSerialEnumeratorPrivate *qese) {
+        this->qese = qese;
+    }
+    ~QextSerialRegistrationWidget() {}
+
+protected:
+
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+    bool winEvent(MSG *message, long *result) {
+#else
+    bool nativeEvent(const QByteArray & /*eventType*/, void *msg, long *result) {
+        MSG *message = static_cast<MSG *>(msg);
+#endif
+        if (message->message == WM_DEVICECHANGE) {
+            qese->onDeviceChanged(message->wParam, message->lParam);
+            *result = 1;
+            return true;
+        }
+        return false;
+    }
+private:
+    QextSerialEnumeratorPrivate *qese;
+};
+
+#endif // QT_GUI_LIB
+
+void QextSerialEnumeratorPrivate::platformSpecificInit()
+{
+#ifdef QT_GUI_LIB
+    notificationWidget = 0;
+#endif // QT_GUI_LIB
+}
+
+/*!
+  default
+*/
+void QextSerialEnumeratorPrivate::platformSpecificDestruct()
+{
+#ifdef QT_GUI_LIB
+    if (notificationWidget)
+        delete notificationWidget;
+#endif
+}
+
+// see http://msdn.microsoft.com/en-us/library/windows/hardware/ff553426(v=vs.85).aspx
+// for list of GUID classes
+const GUID deviceClassGuids[] =
+{
+    // Ports (COM & LPT ports), Class = Ports
+    {0x4D36E978, 0xE325, 0x11CE, {0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18}},
+    // Modem, Class = Modem
+    {0x4D36E96D, 0xE325, 0x11CE, {0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18}},
+    // Bluetooth Devices, Class = Bluetooth
+    {0xE0CBF06C, 0xCD8B, 0x4647, {0xBB, 0x8A, 0x26, 0x3B, 0x43, 0xF0, 0xF9, 0x74}},
+    // Added by Arne Kristian Jansen, for use with com0com virtual ports (See Issue 54)
+    {0xDF799E12, 0x3C56, 0x421B, {0xB2, 0x98, 0xB6, 0xD3, 0x64, 0x2B, 0xC8, 0x78}}
+};
+
+/* Gordon Schumacher's macros for TCHAR -> QString conversions and vice versa */
+#ifdef UNICODE
+    #define QStringToTCHAR(x)     (wchar_t *) x.utf16()
+    #define PQStringToTCHAR(x)    (wchar_t *) x->utf16()
+    #define TCHARToQString(x)     QString::fromUtf16((ushort *)(x))
+    #define TCHARToQStringN(x,y)  QString::fromUtf16((ushort *)(x),(y))
+#else
+    #define QStringToTCHAR(x)     x.local8Bit().constData()
+    #define PQStringToTCHAR(x)    x->local8Bit().constData()
+    #define TCHARToQString(x)     QString::fromLocal8Bit((char *)(x))
+    #define TCHARToQStringN(x,y)  QString::fromLocal8Bit((char *)(x),(y))
+#endif /*UNICODE*/
+
+/*!
+    \internal
+    Get value of specified property from the registry.
+        \a key handle to an open key.
+        \a property property name.
+
+        return property value.
+*/
+static QString getRegKeyValue(HKEY key, LPCTSTR property)
+{
+    DWORD size = 0;
+    DWORD type;
+    ::RegQueryValueEx(key, property, NULL, NULL, NULL, &size);
+    BYTE *buff = new BYTE[size];
+    QString result;
+    if (::RegQueryValueEx(key, property, NULL, &type, buff, &size) == ERROR_SUCCESS)
+        result = TCHARToQString(buff);
+    ::RegCloseKey(key);
+    delete [] buff;
+    return result;
+}
+
+/*!
+     \internal
+     Get specific property from registry.
+     \a devInfo pointer to the device information set that contains the interface
+        and its underlying device. Returned by SetupDiGetClassDevs() function.
+     \a devData pointer to an SP_DEVINFO_DATA structure that defines the device instance.
+        this is returned by SetupDiGetDeviceInterfaceDetail() function.
+     \a property registry property. One of defined SPDRP_* constants.
+
+     return property string.
+ */
+static QString getDeviceProperty(HDEVINFO devInfo, PSP_DEVINFO_DATA devData, DWORD property)
+{
+    DWORD buffSize = 0;
+    ::SetupDiGetDeviceRegistryProperty(devInfo, devData, property, NULL, NULL, 0, &buffSize);
+    BYTE *buff = new BYTE[buffSize];
+    ::SetupDiGetDeviceRegistryProperty(devInfo, devData, property, NULL, buff, buffSize, NULL);
+    QString result = TCHARToQString(buff);
+    delete [] buff;
+    return result;
+}
+
+/*!
+     \internal
+*/
+static bool getDeviceDetailsWin(QextPortInfo *portInfo, HDEVINFO devInfo, PSP_DEVINFO_DATA devData
+                                 , WPARAM wParam = DBT_DEVICEARRIVAL)
+{
+    portInfo->friendName = getDeviceProperty(devInfo, devData, SPDRP_FRIENDLYNAME);
+    if (wParam == DBT_DEVICEARRIVAL)
+        portInfo->physName = getDeviceProperty(devInfo, devData, SPDRP_PHYSICAL_DEVICE_OBJECT_NAME);
+    portInfo->enumName = getDeviceProperty(devInfo, devData, SPDRP_ENUMERATOR_NAME);
+    QString hardwareIDs = getDeviceProperty(devInfo, devData, SPDRP_HARDWAREID);
+    HKEY devKey = ::SetupDiOpenDevRegKey(devInfo, devData, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_QUERY_VALUE);
+    portInfo->portName = getRegKeyValue(devKey, TEXT("PortName"));
+    QRegExp idRx(QLatin1String("VID_(\\w+)&PID_(\\w+)"));
+    if (hardwareIDs.toUpper().contains(idRx)) {
+        bool dummy;
+        portInfo->vendorID = idRx.cap(1).toInt(&dummy, 16);
+        portInfo->productID = idRx.cap(2).toInt(&dummy, 16);
+        //qDebug() << "got vid:" << vid << "pid:" << pid;
+    }
+    return true;
+}
+
+/*!
+     \internal
+*/
+static void enumerateDevicesWin(const GUID &guid, QList<QextPortInfo> *infoList)
+{
+    HDEVINFO devInfo;
+    if ((devInfo = ::SetupDiGetClassDevs(&guid, NULL, NULL, DIGCF_PRESENT)) != INVALID_HANDLE_VALUE) {
+        SP_DEVINFO_DATA devInfoData;
+        devInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
+        for(int i = 0; ::SetupDiEnumDeviceInfo(devInfo, i, &devInfoData); i++) {
+            QextPortInfo info;
+            info.productID = info.vendorID = 0;
+            getDeviceDetailsWin(&info, devInfo, &devInfoData);
+            if (!info.portName.startsWith(QLatin1String("LPT"), Qt::CaseInsensitive))
+                infoList->append(info);
+        }
+        ::SetupDiDestroyDeviceInfoList(devInfo);
+    }
+}
+
+
+static bool lessThan(const QextPortInfo &s1, const QextPortInfo &s2)
+{
+    if (s1.portName.startsWith(QLatin1String("COM"))
+            && s2.portName.startsWith(QLatin1String("COM"))) {
+        return s1.portName.mid(3).toInt()<s2.portName.mid(3).toInt();
+    }
+    return s1.portName < s2.portName;
+}
+
+
+/*!
+    Get list of ports.
+
+    return list of ports currently available in the system.
+*/
+QList<QextPortInfo> QextSerialEnumeratorPrivate::getPorts_sys()
+{
+    QList<QextPortInfo> ports;
+    const int count = sizeof(deviceClassGuids)/sizeof(deviceClassGuids[0]);
+    for (int i=0; i<count; ++i)
+        enumerateDevicesWin(deviceClassGuids[i], &ports);
+    qSort(ports.begin(), ports.end(), lessThan);
+    return ports;
+}
+
+
+/*
+    Enable event-driven notifications of board discovery/removal.
+*/
+bool QextSerialEnumeratorPrivate::setUpNotifications_sys(bool setup)
+{
+#ifndef QT_GUI_LIB
+    Q_UNUSED(setup)
+    QESP_WARNING("QextSerialEnumerator: GUI not enabled - can't register for device notifications.");
+    return false;
+#else
+    Q_Q(QextSerialEnumerator);
+    if (setup && notificationWidget) //already setup
+        return true;
+    notificationWidget = new QextSerialRegistrationWidget(this);
+
+    DEV_BROADCAST_DEVICEINTERFACE dbh;
+    ::ZeroMemory(&dbh, sizeof(dbh));
+    dbh.dbcc_size = sizeof(dbh);
+    dbh.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
+    // dbh.dbcc_classguid = GUID_DEVCLASS_PORTS; //Ignored in such case
+    DWORD flags = DEVICE_NOTIFY_WINDOW_HANDLE|DEVICE_NOTIFY_ALL_INTERFACE_CLASSES;
+    if (::RegisterDeviceNotification((HWND)notificationWidget->winId(), &dbh, flags) == NULL) {
+        QESP_WARNING() << "RegisterDeviceNotification failed:" << GetLastError();
+        return false;
+    }
+    // setting up notifications doesn't tell us about devices already connected
+    // so get those manually
+    foreach (QextPortInfo port, getPorts_sys())
+      Q_EMIT q->deviceDiscovered(port);
+    return true;
+#endif // QT_GUI_LIB
+}
+
+LRESULT QextSerialEnumeratorPrivate::onDeviceChanged(WPARAM wParam, LPARAM lParam)
+{
+    if (DBT_DEVICEARRIVAL == wParam || DBT_DEVICEREMOVECOMPLETE == wParam) {
+        PDEV_BROADCAST_HDR pHdr = (PDEV_BROADCAST_HDR)lParam;
+        if (pHdr->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) {
+            PDEV_BROADCAST_DEVICEINTERFACE pDevInf = (PDEV_BROADCAST_DEVICEINTERFACE)pHdr;
+             // delimiters are different across APIs...change to backslash.  ugh.
+            QString deviceID = TCHARToQString(pDevInf->dbcc_name).toUpper().replace(QLatin1String("#"), QLatin1String("\\"));
+
+            const int count = sizeof(deviceClassGuids)/sizeof(deviceClassGuids[0]);
+            for (int i=0; i<count; ++i) {
+                if (matchAndDispatchChangedDevice(deviceID, deviceClassGuids[i], wParam))
+                    break;
+            }
+        }
+    }
+    return 0;
+}
+
+bool QextSerialEnumeratorPrivate::matchAndDispatchChangedDevice(const QString &deviceID, const GUID &guid, WPARAM wParam)
+{
+    Q_Q(QextSerialEnumerator);
+    bool rv = false;
+    DWORD dwFlag = (DBT_DEVICEARRIVAL == wParam) ? DIGCF_PRESENT : DIGCF_ALLCLASSES;
+    HDEVINFO devInfo;
+    if ((devInfo = SetupDiGetClassDevs(&guid,NULL,NULL,dwFlag)) != INVALID_HANDLE_VALUE) {
+        SP_DEVINFO_DATA spDevInfoData;
+        spDevInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
+        for(int i=0; SetupDiEnumDeviceInfo(devInfo, i, &spDevInfoData); i++) {
+            DWORD nSize = 0;
+            TCHAR buf[MAX_PATH];
+            if (SetupDiGetDeviceInstanceId(devInfo, &spDevInfoData, buf, MAX_PATH, &nSize) &&
+                    deviceID.contains(TCHARToQString(buf))) { // we found a match
+                rv = true;
+                QextPortInfo info;
+                info.productID = info.vendorID = 0;
+                getDeviceDetailsWin(&info, devInfo, &spDevInfoData, wParam);
+                if (wParam == DBT_DEVICEARRIVAL)
+                    Q_EMIT q->deviceDiscovered(info);
+                else if (wParam == DBT_DEVICEREMOVECOMPLETE)
+                    Q_EMIT q->deviceRemoved(info);
+                break;
+            }
+        }
+        SetupDiDestroyDeviceInfoList(devInfo);
+    }
+    return rv;
+}
diff --git a/interfaces/qextserialport/qextserialport.cpp b/interfaces/qextserialport/qextserialport.cpp
index 119bef8..9f8a119 100644
--- a/interfaces/qextserialport/qextserialport.cpp
+++ b/interfaces/qextserialport/qextserialport.cpp
@@ -1,1011 +1,1011 @@
-/****************************************************************************
-** Copyright (c) 2000-2003 Wayne Roth
-** Copyright (c) 2004-2007 Stefan Sander
-** Copyright (c) 2007 Michal Policht
-** Copyright (c) 2008 Brandon Fosdick
-** Copyright (c) 2009-2010 Liam Staskawicz
-** Copyright (c) 2011 Debao Zhang
-** All right reserved.
-** Web: http://code.google.com/p/qextserialport/
-**
-** Permission is hereby granted, free of charge, to any person obtaining
-** a copy of this software and associated documentation files (the
-** "Software"), to deal in the Software without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Software, and to
-** permit persons to whom the Software is furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be
-** included in all copies or substantial portions of the Software.
-**
-** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-**
-****************************************************************************/
-
-#include "qextserialport.h"
-#include "qextserialport_p.h"
-#include <stdio.h>
-#include <QtCore/QDebug>
-#include <QtCore/QReadLocker>
-#include <QtCore/QWriteLocker>
-
-/*!
-    \class PortSettings
-
-    \brief The PortSettings class contain port settings
-
-    Structure to contain port settings.
-
-    \code
-    BaudRateType BaudRate;
-    DataBitsType DataBits;
-    ParityType Parity;
-    StopBitsType StopBits;
-    FlowType FlowControl;
-    long Timeout_Millisec;
-    \endcode
-*/
-
-QextSerialPortPrivate::QextSerialPortPrivate(QextSerialPort *q)
-    :lock(QReadWriteLock::Recursive), q_ptr(q)
-{
-    lastErr = E_NO_ERROR;
-    settings.BaudRate = BAUD9600;
-    settings.Parity = PAR_NONE;
-    settings.FlowControl = FLOW_OFF;
-    settings.DataBits = DATA_8;
-    settings.StopBits = STOP_1;
-    settings.Timeout_Millisec = 10;
-    settingsDirtyFlags = DFE_ALL;
-
-    platformSpecificInit();
-}
-
-QextSerialPortPrivate::~QextSerialPortPrivate()
-{
-    platformSpecificDestruct();
-}
-
-void QextSerialPortPrivate::setBaudRate(BaudRateType baudRate, bool update)
-{
-    switch (baudRate) {
-#ifdef Q_OS_WIN
-    //Windows Special
-    case BAUD14400:
-    case BAUD56000:
-    case BAUD128000:
-    case BAUD256000:
-        QESP_PORTABILITY_WARNING()<<"QextSerialPort Portability Warning: POSIX does not support baudRate:"<<baudRate;
-#elif defined(Q_OS_UNIX)
-    //Unix Special
-    case BAUD50:
-    case BAUD75:
-    case BAUD134:
-    case BAUD150:
-    case BAUD200:
-    case BAUD1800:
-#  ifdef B76800
-    case BAUD76800:
-#  endif
-#  if defined(B230400) && defined(B4000000)
-    case BAUD230400:
-    case BAUD460800:
-    case BAUD500000:
-    case BAUD576000:
-    case BAUD921600:
-    case BAUD1000000:
-    case BAUD1152000:
-    case BAUD1500000:
-    case BAUD2000000:
-    case BAUD2500000:
-    case BAUD3000000:
-    case BAUD3500000:
-    case BAUD4000000:
-#  endif
-        QESP_PORTABILITY_WARNING()<<"QextSerialPort Portability Warning: Windows does not support baudRate:"<<baudRate;
-#endif
-    case BAUD110:
-    case BAUD300:
-    case BAUD600:
-    case BAUD1200:
-    case BAUD2400:
-    case BAUD4800:
-    case BAUD9600:
-    case BAUD19200:
-    case BAUD38400:
-    case BAUD57600:
-    case BAUD115200:
-#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
-    default:
-#endif
-        settings.BaudRate = baudRate;
-        settingsDirtyFlags |= DFE_BaudRate;
-        if (update && q_func()->isOpen())
-            updatePortSettings();
-        break;
-#if !(defined(Q_OS_WIN) || defined(Q_OS_MAC))
-    default:
-        QESP_WARNING()<<"QextSerialPort does not support baudRate:"<<baudRate;
-#endif
-    }
-}
-
-void QextSerialPortPrivate::setParity(ParityType parity, bool update)
-{
-    switch (parity) {
-    case PAR_SPACE:
-        if (settings.DataBits == DATA_8) {
-#ifdef Q_OS_WIN
-            QESP_PORTABILITY_WARNING("QextSerialPort Portability Warning: Space parity with 8 data bits is not supported by POSIX systems.");
-#else
-            QESP_WARNING("Space parity with 8 data bits is not supported by POSIX systems.");
-#endif
-        }
-        break;
-
-#ifdef Q_OS_WIN
-        /*mark parity - WINDOWS ONLY*/
-    case PAR_MARK:
-        QESP_PORTABILITY_WARNING("QextSerialPort Portability Warning:  Mark parity is not supported by POSIX systems");
-        break;
-#endif
-
-    case PAR_NONE:
-    case PAR_EVEN:
-    case PAR_ODD:
-        break;
-    default:
-        QESP_WARNING()<<"QextSerialPort does not support Parity:" << parity;
-    }
-
-    settings.Parity = parity;
-    settingsDirtyFlags |= DFE_Parity;
-    if (update && q_func()->isOpen())
-        updatePortSettings();
-}
-
-void QextSerialPortPrivate::setDataBits(DataBitsType dataBits, bool update)
-{
-    switch(dataBits) {
-
-    case DATA_5:
-        if (settings.StopBits == STOP_2) {
-            QESP_WARNING("QextSerialPort: 5 Data bits cannot be used with 2 stop bits.");
-        }
-        else {
-            settings.DataBits = dataBits;
-            settingsDirtyFlags |= DFE_DataBits;
-        }
-        break;
-
-    case DATA_6:
-#ifdef Q_OS_WIN
-        if (settings.StopBits == STOP_1_5) {
-            QESP_WARNING("QextSerialPort: 6 Data bits cannot be used with 1.5 stop bits.");
-        }
-        else
-#endif
-        {
-            settings.DataBits = dataBits;
-            settingsDirtyFlags |= DFE_DataBits;
-        }
-        break;
-
-    case DATA_7:
-#ifdef Q_OS_WIN
-        if (settings.StopBits == STOP_1_5) {
-            QESP_WARNING("QextSerialPort: 7 Data bits cannot be used with 1.5 stop bits.");
-        }
-        else
-#endif
-        {
-            settings.DataBits = dataBits;
-            settingsDirtyFlags |= DFE_DataBits;
-        }
-        break;
-
-    case DATA_8:
-#ifdef Q_OS_WIN
-        if (settings.StopBits == STOP_1_5) {
-            QESP_WARNING("QextSerialPort: 8 Data bits cannot be used with 1.5 stop bits.");
-        }
-        else
-#endif
-        {
-            settings.DataBits = dataBits;
-            settingsDirtyFlags |= DFE_DataBits;
-        }
-        break;
-    default:
-        QESP_WARNING()<<"QextSerialPort does not support Data bits:"<<dataBits;
-    }
-    if (update && q_func()->isOpen())
-        updatePortSettings();
-}
-
-void QextSerialPortPrivate::setStopBits(StopBitsType stopBits, bool update)
-{
-    switch (stopBits) {
-
-        /*one stop bit*/
-    case STOP_1:
-        settings.StopBits = stopBits;
-        settingsDirtyFlags |= DFE_StopBits;
-        break;
-
-#ifdef Q_OS_WIN
-        /*1.5 stop bits*/
-    case STOP_1_5:
-        QESP_PORTABILITY_WARNING("QextSerialPort Portability Warning: 1.5 stop bit operation is not supported by POSIX.");
-        if (settings.DataBits != DATA_5) {
-            QESP_WARNING("QextSerialPort: 1.5 stop bits can only be used with 5 data bits");
-        }
-        else {
-            settings.StopBits = stopBits;
-            settingsDirtyFlags |= DFE_StopBits;
-        }
-        break;
-#endif
-
-        /*two stop bits*/
-    case STOP_2:
-        if (settings.DataBits == DATA_5) {
-            QESP_WARNING("QextSerialPort: 2 stop bits cannot be used with 5 data bits");
-        }
-        else {
-            settings.StopBits = stopBits;
-            settingsDirtyFlags |= DFE_StopBits;
-        }
-        break;
-    default:
-        QESP_WARNING()<<"QextSerialPort does not support stop bits: "<<stopBits;
-    }
-    if (update && q_func()->isOpen())
-        updatePortSettings();
-}
-
-void QextSerialPortPrivate::setFlowControl(FlowType flow, bool update)
-{
-    settings.FlowControl = flow;
-    settingsDirtyFlags |= DFE_Flow;
-    if (update && q_func()->isOpen())
-        updatePortSettings();
-}
-
-void QextSerialPortPrivate::setTimeout(long millisec, bool update)
-{
-    settings.Timeout_Millisec = millisec;
-    settingsDirtyFlags |= DFE_TimeOut;
-    if (update && q_func()->isOpen())
-        updatePortSettings();
-}
-
-void QextSerialPortPrivate::setPortSettings(const PortSettings &settings, bool update)
-{
-    setBaudRate(settings.BaudRate, false);
-    setDataBits(settings.DataBits, false);
-    setStopBits(settings.StopBits, false);
-    setParity(settings.Parity, false);
-    setFlowControl(settings.FlowControl, false);
-    setTimeout(settings.Timeout_Millisec, false);
-    settingsDirtyFlags = DFE_ALL;
-    if (update && q_func()->isOpen())
-        updatePortSettings();
-}
-
-
-void QextSerialPortPrivate::_q_canRead()
-{
-    qint64 maxSize = bytesAvailable_sys();
-    if (maxSize > 0) {
-        char *writePtr = readBuffer.reserve(size_t(maxSize));
-        qint64 bytesRead = readData_sys(writePtr, maxSize);
-        if (bytesRead < maxSize)
-            readBuffer.chop(maxSize - bytesRead);
-        Q_Q(QextSerialPort);
-        Q_EMIT q->readyRead();
-    }
-}
-
-/*! \class QextSerialPort
-
-    \brief The QextSerialPort class encapsulates a serial port on both POSIX and Windows systems.
-
-    \section1 Usage
-    QextSerialPort offers both a polling and event driven API.  Event driven
-    is typically easier to use, since you never have to worry about checking
-    for new data.
-
-    \bold Example
-    \code
-    QextSerialPort *port = new QextSerialPort("COM1");
-    connect(port, SIGNAL(readyRead()), myClass, SLOT(onDataAvailable()));
-    port->open();
-
-    void MyClass::onDataAvailable()
-    {
-        QByteArray data = port->readAll();
-        processNewData(usbdata);
-    }
-    \endcode
-
-    \section1 Compatibility
-    The user will be notified of errors and possible portability conflicts at run-time
-    by default.
-
-    For example, if a application has used BAUD1800, when it is runing under unix, you
-    will get following message.
-
-    \code
-    QextSerialPort Portability Warning: Windows does not support baudRate:1800
-    \endcode
-
-    This behavior can be turned off by defining macro QESP_NO_WARN (to turn off all warnings)
-    or QESP_NO_PORTABILITY_WARN (to turn off portability warnings) in the project.
-
-
-    \bold Author: Stefan Sander, Michal Policht, Brandon Fosdick, Liam Staskawicz, Debao Zhang
-*/
-
-/*!
-  \enum QextSerialPort::QueryMode
-
-  This enum type specifies query mode used in a serial port:
-
-  \value Polling
-     asynchronously read and write
-  \value EventDriven
-     synchronously read and write
-*/
-
-/*!
-    \fn void QextSerialPort::dsrChanged(bool status)
-    This signal is emitted whenever dsr line has changed its state. You may
-    use this signal to check if device is connected.
-
-    \a status true when DSR signal is on, false otherwise.
- */
-
-
-/*!
-    \fn QueryMode QextSerialPort::queryMode() const
-    Get query mode.
- */
-
-/*!
-    Default constructor.  Note that the name of the device used by a QextSerialPort is dependent on
-    your OS. Possible naming conventions and their associated OS are:
-
-    \code
-
-    OS Constant       Used By         Naming Convention
-    -------------     -------------   ------------------------
-    Q_OS_WIN          Windows         COM1, COM2
-    Q_OS_IRIX         SGI/IRIX        /dev/ttyf1, /dev/ttyf2
-    Q_OS_HPUX         HP-UX           /dev/tty1p0, /dev/tty2p0
-    Q_OS_SOLARIS      SunOS/Slaris    /dev/ttya, /dev/ttyb
-    Q_OS_OSF          Digital UNIX    /dev/tty01, /dev/tty02
-    Q_OS_FREEBSD      FreeBSD         /dev/ttyd0, /dev/ttyd1
-    Q_OS_OPENBSD      OpenBSD         /dev/tty00, /dev/tty01
-    Q_OS_LINUX        Linux           /dev/ttyS0, /dev/ttyS1
-    <none>                            /dev/ttyS0, /dev/ttyS1
-    \endcode
-
-    This constructor assigns the device name to the name of the first port on the specified system.
-    See the other constructors if you need to open a different port. Default \a mode is EventDriven.
-    As a subclass of QObject, \a parent can be specified.
-*/
-
-QextSerialPort::QextSerialPort(QextSerialPort::QueryMode mode, QObject *parent)
-    : QIODevice(parent), d_ptr(new QextSerialPortPrivate(this))
-{
-#ifdef Q_OS_WIN
-    setPortName(QLatin1String("COM1"));
-
-#elif defined(Q_OS_IRIX)
-    setPortName(QLatin1String("/dev/ttyf1"));
-
-#elif defined(Q_OS_HPUX)
-    setPortName(QLatin1String("/dev/tty1p0"));
-
-#elif defined(Q_OS_SOLARIS)
-    setPortName(QLatin1String("/dev/ttya"));
-
-#elif defined(Q_OS_OSF) //formally DIGITAL UNIX
-    setPortName(QLatin1String("/dev/tty01"));
-
-#elif defined(Q_OS_FREEBSD)
-    setPortName(QLatin1String("/dev/ttyd1"));
-
-#elif defined(Q_OS_OPENBSD)
-    setPortName(QLatin1String("/dev/tty00"));
-
-#else
-    setPortName(QLatin1String("/dev/ttyS0"));
-#endif
-    setQueryMode(mode);
-}
-
-/*!
-    Constructs a serial port attached to the port specified by name.
-    \a name is the name of the device, which is windowsystem-specific,
-    e.g."COM1" or "/dev/ttyS0". \a mode
-*/
-QextSerialPort::QextSerialPort(const QString &name, QextSerialPort::QueryMode mode, QObject *parent)
-    : QIODevice(parent), d_ptr(new QextSerialPortPrivate(this))
-{
-    setQueryMode(mode);
-    setPortName(name);
-}
-
-/*!
-    Constructs a port with default name and specified \a settings.
-*/
-QextSerialPort::QextSerialPort(const PortSettings &settings, QextSerialPort::QueryMode mode, QObject *parent)
-    : QIODevice(parent), d_ptr(new QextSerialPortPrivate(this))
-{
-    Q_D(QextSerialPort);
-    setQueryMode(mode);
-    d->setPortSettings(settings);
-}
-
-/*!
-    Constructs a port with specified \a name , \a mode and \a settings.
-*/
-QextSerialPort::QextSerialPort(const QString &name, const PortSettings &settings, QextSerialPort::QueryMode mode, QObject *parent)
-    : QIODevice(parent), d_ptr(new QextSerialPortPrivate(this))
-{
-    Q_D(QextSerialPort);
-    setPortName(name);
-    setQueryMode(mode);
-    d->setPortSettings(settings);
-}
-
-/*!
-    Opens a serial port and sets its OpenMode to \a mode.
-    Note that this function does not specify which device to open.
-    Returns true if successful; otherwise returns false.This function has no effect
-    if the port associated with the class is already open.  The port is also
-    configured to the current settings, as stored in the settings structure.
-*/
-bool QextSerialPort::open(OpenMode mode)
-{
-    Q_D(QextSerialPort);
-    QWriteLocker locker(&d->lock);
-    if (mode != QIODevice::NotOpen && !isOpen())
-        d->open_sys(mode);
-
-    return isOpen();
-}
-
-
-/*! \reimp
-    Closes a serial port.  This function has no effect if the serial port associated with the class
-    is not currently open.
-*/
-void QextSerialPort::close()
-{
-    Q_D(QextSerialPort);
-    QWriteLocker locker(&d->lock);
-    if (isOpen()) {
-        // Be a good QIODevice and call QIODevice::close() before really close()
-        //  so the aboutToClose() signal is emitted at the proper time
-        QIODevice::close(); // mark ourselves as closed
-        d->close_sys();
-        d->readBuffer.clear();
-    }
-}
-
-/*!
-    Flushes all pending I/O to the serial port.  This function has no effect if the serial port
-    associated with the class is not currently open.
-*/
-void QextSerialPort::flush()
-{
-    Q_D(QextSerialPort);
-    QWriteLocker locker(&d->lock);
-    if (isOpen())
-        d->flush_sys();
-}
-
-/*! \reimp
-    Returns the number of bytes waiting in the port's receive queue.  This function will return 0 if
-    the port is not currently open, or -1 on error.
-*/
-qint64 QextSerialPort::bytesAvailable() const
-{
-    QWriteLocker locker(&d_func()->lock);
-    if (isOpen()) {
-        qint64 bytes = d_func()->bytesAvailable_sys();
-        if (bytes != -1) {
-            return bytes + d_func()->readBuffer.size()
-                    + QIODevice::bytesAvailable();
-        } else {
-            return -1;
-        }
-    }
-    return 0;
-}
-
-/*! \reimp
-
-*/
-bool QextSerialPort::canReadLine() const
-{
-    QReadLocker locker(&d_func()->lock);
-    return QIODevice::canReadLine() || d_func()->readBuffer.canReadLine();
-}
-
-/*!
- * Set desired serial communication handling style. You may choose from polling
- * or event driven approach. This function does nothing when port is open; to
- * apply changes port must be reopened.
- *
- * In event driven approach read() and write() functions are acting
- * asynchronously. They return immediately and the operation is performed in
- * the background, so they doesn't freeze the calling thread.
- * To determine when operation is finished, QextSerialPort runs separate thread
- * and monitors serial port events. Whenever the event occurs, adequate signal
- * is emitted.
- *
- * When polling is set, read() and write() are acting synchronously. Signals are
- * not working in this mode and some functions may not be available. The advantage
- * of polling is that it generates less overhead due to lack of signals emissions
- * and it doesn't start separate thread to monitor events.
- *
- * Generally event driven approach is more capable and friendly, although some
- * applications may need as low overhead as possible and then polling comes.
- *
- * \a mode query mode.
- */
-void QextSerialPort::setQueryMode(QueryMode mode)
-{
-    Q_D(QextSerialPort);
-    QWriteLocker locker(&d->lock);
-    if (mode != d->queryMode) {
-        d->queryMode = mode;
-    }
-}
-
-/*!
-    Sets the \a name of the device associated with the object, e.g. "COM1", or "/dev/ttyS0".
-*/
-void QextSerialPort::setPortName(const QString &name)
-{
-    Q_D(QextSerialPort);
-    QWriteLocker locker(&d->lock);
-    d->port = name;
-}
-
-/*!
-    Returns the name set by setPortName().
-*/
-QString QextSerialPort::portName() const
-{
-    QReadLocker locker(&d_func()->lock);
-    return d_func()->port;
-}
-
-QextSerialPort::QueryMode QextSerialPort::queryMode() const
-{
-    QReadLocker locker(&d_func()->lock);
-    return d_func()->queryMode;
-}
-
-/*!
-    Reads all available data from the device, and returns it as a QByteArray.
-    This function has no way of reporting errors; returning an empty QByteArray()
-    can mean either that no data was currently available for reading, or that an error occurred.
-*/
-QByteArray QextSerialPort::readAll()
-{
-    int avail = this->bytesAvailable();
-    return (avail > 0) ? this->read(avail) : QByteArray();
-}
-
-/*!
-    Returns the baud rate of the serial port.  For a list of possible return values see
-    the definition of the enum BaudRateType.
-*/
-BaudRateType QextSerialPort::baudRate() const
-{
-    QReadLocker locker(&d_func()->lock);
-    return d_func()->settings.BaudRate;
-}
-
-/*!
-    Returns the number of data bits used by the port.  For a list of possible values returned by
-    this function, see the definition of the enum DataBitsType.
-*/
-DataBitsType QextSerialPort::dataBits() const
-{
-    QReadLocker locker(&d_func()->lock);
-    return d_func()->settings.DataBits;
-}
-
-/*!
-    Returns the type of parity used by the port.  For a list of possible values returned by
-    this function, see the definition of the enum ParityType.
-*/
-ParityType QextSerialPort::parity() const
-{
-    QReadLocker locker(&d_func()->lock);
-    return d_func()->settings.Parity;
-}
-
-/*!
-    Returns the number of stop bits used by the port.  For a list of possible return values, see
-    the definition of the enum StopBitsType.
-*/
-StopBitsType QextSerialPort::stopBits() const
-{
-    QReadLocker locker(&d_func()->lock);
-    return d_func()->settings.StopBits;
-}
-
-/*!
-    Returns the type of flow control used by the port.  For a list of possible values returned
-    by this function, see the definition of the enum FlowType.
-*/
-FlowType QextSerialPort::flowControl() const
-{
-    QReadLocker locker(&d_func()->lock);
-    return d_func()->settings.FlowControl;
-}
-
-/*!
-    \reimp
-    Returns true if device is sequential, otherwise returns false. Serial port is sequential device
-    so this function always returns true. Check QIODevice::isSequential() documentation for more
-    information.
-*/
-bool QextSerialPort::isSequential() const
-{
-    return true;
-}
-
-/*!
-    Return the error number, or 0 if no error occurred.
-*/
-ulong QextSerialPort::lastError() const
-{
-    QReadLocker locker(&d_func()->lock);
-    return d_func()->lastErr;
-}
-
-/*!
-    Returns the line status as stored by the port function.  This function will retrieve the states
-    of the following lines: DCD, CTS, DSR, and RI.  On POSIX systems, the following additional lines
-    can be monitored: DTR, RTS, Secondary TXD, and Secondary RXD.  The value returned is an unsigned
-    long with specific bits indicating which lines are high.  The following constants should be used
-    to examine the states of individual lines:
-
-    \code
-    Mask        Line
-    ------      ----
-    LS_CTS      CTS
-    LS_DSR      DSR
-    LS_DCD      DCD
-    LS_RI       RI
-    LS_RTS      RTS (POSIX only)
-    LS_DTR      DTR (POSIX only)
-    LS_ST       Secondary TXD (POSIX only)
-    LS_SR       Secondary RXD (POSIX only)
-    \endcode
-
-    This function will return 0 if the port associated with the class is not currently open.
-*/
-unsigned long QextSerialPort::lineStatus()
-{
-    Q_D(QextSerialPort);
-    QWriteLocker locker(&d->lock);
-    if (isOpen())
-        return d->lineStatus_sys();
-    return 0;
-}
-
-/*!
-  Returns a human-readable description of the last device error that occurred.
-*/
-QString QextSerialPort::errorString()
-{
-    Q_D(QextSerialPort);
-    QReadLocker locker(&d->lock);
-    switch(d->lastErr) {
-    case E_NO_ERROR:
-        return tr("No Error has occurred");
-    case E_INVALID_FD:
-        return tr("Invalid file descriptor (port was not opened correctly)");
-    case E_NO_MEMORY:
-        return tr("Unable to allocate memory tables (POSIX)");
-    case E_CAUGHT_NON_BLOCKED_SIGNAL:
-        return tr("Caught a non-blocked signal (POSIX)");
-    case E_PORT_TIMEOUT:
-        return tr("Operation timed out (POSIX)");
-    case E_INVALID_DEVICE:
-        return tr("The file opened by the port is not a valid device");
-    case E_BREAK_CONDITION:
-        return tr("The port detected a break condition");
-    case E_FRAMING_ERROR:
-        return tr("The port detected a framing error (usually caused by incorrect baud rate settings)");
-    case E_IO_ERROR:
-        return tr("There was an I/O error while communicating with the port");
-    case E_BUFFER_OVERRUN:
-        return tr("Character buffer overrun");
-    case E_RECEIVE_OVERFLOW:
-        return tr("Receive buffer overflow");
-    case E_RECEIVE_PARITY_ERROR:
-        return tr("The port detected a parity error in the received data");
-    case E_TRANSMIT_OVERFLOW:
-        return tr("Transmit buffer overflow");
-    case E_READ_FAILED:
-        return tr("General read operation failure");
-    case E_WRITE_FAILED:
-        return tr("General write operation failure");
-    case E_FILE_NOT_FOUND:
-        return tr("The %1 file doesn't exists").arg(this->portName());
-    case E_PERMISSION_DENIED:
-        return tr("Permission denied");
-    case E_AGAIN:
-        return tr("Device is already locked");
-    default:
-        return tr("Unknown error: %1").arg(d->lastErr);
-    }
-}
-
-/*!
-   Destructs the QextSerialPort object.
-*/
-QextSerialPort::~QextSerialPort()
-{
-    if (isOpen()) {
-        close();
-    }
-    delete d_ptr;
-}
-
-/*!
-    Sets the flow control used by the port to \a flow.  Possible values of flow are:
-    \code
-        FLOW_OFF            No flow control
-        FLOW_HARDWARE       Hardware (RTS/CTS) flow control
-        FLOW_XONXOFF        Software (XON/XOFF) flow control
-    \endcode
-*/
-void QextSerialPort::setFlowControl(FlowType flow)
-{
-    Q_D(QextSerialPort);
-    QWriteLocker locker(&d->lock);
-    if (d->settings.FlowControl != flow)
-        d->setFlowControl(flow, true);
-}
-
-/*!
-    Sets the parity associated with the serial port to \a parity.  The possible values of parity are:
-    \code
-        PAR_SPACE       Space Parity
-        PAR_MARK        Mark Parity
-        PAR_NONE        No Parity
-        PAR_EVEN        Even Parity
-        PAR_ODD         Odd Parity
-    \endcode
-*/
-void QextSerialPort::setParity(ParityType parity)
-{
-    Q_D(QextSerialPort);
-    QWriteLocker locker(&d->lock);
-    if (d->settings.Parity != parity)
-        d->setParity(parity, true);
-}
-
-/*!
-    Sets the number of data bits used by the serial port to \a dataBits.  Possible values of dataBits are:
-    \code
-        DATA_5      5 data bits
-        DATA_6      6 data bits
-        DATA_7      7 data bits
-        DATA_8      8 data bits
-    \endcode
-
-    \bold note:
-    This function is subject to the following restrictions:
-    \list
-    \o 5 data bits cannot be used with 2 stop bits.
-    \o 1.5 stop bits can only be used with 5 data bits.
-    \o 8 data bits cannot be used with space parity on POSIX systems.
-    \endlist
-    */
-void QextSerialPort::setDataBits(DataBitsType dataBits)
-{
-    Q_D(QextSerialPort);
-    QWriteLocker locker(&d->lock);
-    if (d->settings.DataBits != dataBits)
-        d->setDataBits(dataBits, true);
-}
-
-/*!
-    Sets the number of stop bits used by the serial port to \a stopBits.  Possible values of stopBits are:
-    \code
-        STOP_1      1 stop bit
-        STOP_1_5    1.5 stop bits
-        STOP_2      2 stop bits
-    \endcode
-
-    \bold note:
-    This function is subject to the following restrictions:
-    \list
-    \o 2 stop bits cannot be used with 5 data bits.
-    \o 1.5 stop bits cannot be used with 6 or more data bits.
-    \o POSIX does not support 1.5 stop bits.
-    \endlist
-*/
-void QextSerialPort::setStopBits(StopBitsType stopBits)
-{
-    Q_D(QextSerialPort);
-    QWriteLocker locker(&d->lock);
-    if (d->settings.StopBits != stopBits)
-        d->setStopBits(stopBits, true);
-}
-
-/*!
-    Sets the baud rate of the serial port to \a baudRate.  Note that not all rates are applicable on
-    all platforms.  The following table shows translations of the various baud rate
-    constants on Windows(including NT/2000) and POSIX platforms.  Speeds marked with an *
-    are speeds that are usable on both Windows and POSIX.
-    \code
-
-      RATE          Windows Speed   POSIX Speed
-      -----------   -------------   -----------
-       BAUD50                   X          50
-       BAUD75                   X          75
-      *BAUD110                110         110
-       BAUD134                  X         134.5
-       BAUD150                  X         150
-       BAUD200                  X         200
-      *BAUD300                300         300
-      *BAUD600                600         600
-      *BAUD1200              1200        1200
-       BAUD1800                 X        1800
-      *BAUD2400              2400        2400
-      *BAUD4800              4800        4800
-      *BAUD9600              9600        9600
-       BAUD14400            14400           X
-      *BAUD19200            19200       19200
-      *BAUD38400            38400       38400
-       BAUD56000            56000           X
-      *BAUD57600            57600       57600
-       BAUD76800                X       76800
-      *BAUD115200          115200      115200
-       BAUD128000          128000           X
-       BAUD230400               X      230400
-       BAUD256000          256000           X
-       BAUD460800               X      460800
-       BAUD500000               X      500000
-       BAUD576000               X      576000
-       BAUD921600               X      921600
-       BAUD1000000              X     1000000
-       BAUD1152000              X     1152000
-       BAUD1500000              X     1500000
-       BAUD2000000              X     2000000
-       BAUD2500000              X     2500000
-       BAUD3000000              X     3000000
-       BAUD3500000              X     3500000
-       BAUD4000000              X     4000000
-    \endcode
-*/
-
-void QextSerialPort::setBaudRate(BaudRateType baudRate)
-{
-    Q_D(QextSerialPort);
-    QWriteLocker locker(&d->lock);
-    if (d->settings.BaudRate != baudRate)
-        d->setBaudRate(baudRate, true);
-}
-
-/*!
-    For Unix:
-
-    Sets the read and write timeouts for the port to \a millisec milliseconds.
-    Note that this is a per-character timeout, i.e. the port will wait this long for each
-    individual character, not for the whole read operation.  This timeout also applies to the
-    bytesWaiting() function.
-
-    \bold note:
-    POSIX does not support millisecond-level control for I/O timeout values.  Any
-    timeout set using this function will be set to the next lowest tenth of a second for
-    the purposes of detecting read or write timeouts.  For example a timeout of 550 milliseconds
-    will be seen by the class as a timeout of 500 milliseconds for the purposes of reading and
-    writing the port.  However millisecond-level control is allowed by the select() system call,
-    so for example a 550-millisecond timeout will be seen as 550 milliseconds on POSIX systems for
-    the purpose of detecting available bytes in the read buffer.
-
-    For Windows:
-
-    Sets the read and write timeouts for the port to \a millisec milliseconds.
-    Setting 0 indicates that timeouts are not used for read nor write operations;
-    however read() and write() functions will still block. Set -1 to provide
-    non-blocking behaviour (read() and write() will return immediately).
-
-    \bold note: this function does nothing in event driven mode.
-*/
-void QextSerialPort::setTimeout(long millisec)
-{
-    Q_D(QextSerialPort);
-    QWriteLocker locker(&d->lock);
-    if (d->settings.Timeout_Millisec != millisec)
-        d->setTimeout(millisec, true);
-}
-
-/*!
-    Sets DTR line to the requested state (\a set default to high).  This function will have no effect if
-    the port associated with the class is not currently open.
-*/
-void QextSerialPort::setDtr(bool set)
-{
-    Q_D(QextSerialPort);
-    QWriteLocker locker(&d->lock);
-    if (isOpen())
-        d->setDtr_sys(set);
-}
-
-/*!
-    Sets RTS line to the requested state \a set (high by default).
-    This function will have no effect if
-    the port associated with the class is not currently open.
-*/
-void QextSerialPort::setRts(bool set)
-{
-    Q_D(QextSerialPort);
-    QWriteLocker locker(&d->lock);
-    if (isOpen())
-        d->setRts_sys(set);
-}
-
-/*! \reimp
-    Reads a block of data from the serial port.  This function will read at most maxlen bytes from
-    the serial port and place them in the buffer pointed to by data.  Return value is the number of
-    bytes actually read, or -1 on error.
-
-    \warning before calling this function ensure that serial port associated with this class
-    is currently open (use isOpen() function to check if port is open).
-*/
-qint64 QextSerialPort::readData(char *data, qint64 maxSize)
-{
-    Q_D(QextSerialPort);
-    QWriteLocker locker(&d->lock);
-    qint64 bytesFromBuffer = 0;
-    if (!d->readBuffer.isEmpty()) {
-        bytesFromBuffer = d->readBuffer.read(data, maxSize);
-        if (bytesFromBuffer == maxSize)
-            return bytesFromBuffer;
-    }
-    qint64 bytesFromDevice = d->readData_sys(data+bytesFromBuffer, maxSize-bytesFromBuffer);
-    if (bytesFromDevice < 0) {
-        return -1;
-    }
-    return bytesFromBuffer + bytesFromDevice;
-}
-
-/*! \reimp
-    Writes a block of data to the serial port.  This function will write len bytes
-    from the buffer pointed to by data to the serial port.  Return value is the number
-    of bytes actually written, or -1 on error.
-
-    \warning before calling this function ensure that serial port associated with this class
-    is currently open (use isOpen() function to check if port is open).
-*/
-qint64 QextSerialPort::writeData(const char *data, qint64 maxSize)
-{
-    Q_D(QextSerialPort);
-    QWriteLocker locker(&d->lock);
-    return d->writeData_sys(data, maxSize);
-}
-
-#include "moc_qextserialport.cpp"
+/****************************************************************************
+** Copyright (c) 2000-2003 Wayne Roth
+** Copyright (c) 2004-2007 Stefan Sander
+** Copyright (c) 2007 Michal Policht
+** Copyright (c) 2008 Brandon Fosdick
+** Copyright (c) 2009-2010 Liam Staskawicz
+** Copyright (c) 2011 Debao Zhang
+** All right reserved.
+** Web: http://code.google.com/p/qextserialport/
+**
+** Permission is hereby granted, free of charge, to any person obtaining
+** a copy of this software and associated documentation files (the
+** "Software"), to deal in the Software without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Software, and to
+** permit persons to whom the Software is furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be
+** included in all copies or substantial portions of the Software.
+**
+** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+**
+****************************************************************************/
+
+#include "qextserialport.h"
+#include "qextserialport_p.h"
+#include <stdio.h>
+#include <QtCore/QDebug>
+#include <QtCore/QReadLocker>
+#include <QtCore/QWriteLocker>
+
+/*!
+    \class PortSettings
+
+    \brief The PortSettings class contain port settings
+
+    Structure to contain port settings.
+
+    \code
+    BaudRateType BaudRate;
+    DataBitsType DataBits;
+    ParityType Parity;
+    StopBitsType StopBits;
+    FlowType FlowControl;
+    long Timeout_Millisec;
+    \endcode
+*/
+
+QextSerialPortPrivate::QextSerialPortPrivate(QextSerialPort *q)
+    :lock(QReadWriteLock::Recursive), q_ptr(q)
+{
+    lastErr = E_NO_ERROR;
+    settings.BaudRate = BAUD9600;
+    settings.Parity = PAR_NONE;
+    settings.FlowControl = FLOW_OFF;
+    settings.DataBits = DATA_8;
+    settings.StopBits = STOP_1;
+    settings.Timeout_Millisec = 10;
+    settingsDirtyFlags = DFE_ALL;
+
+    platformSpecificInit();
+}
+
+QextSerialPortPrivate::~QextSerialPortPrivate()
+{
+    platformSpecificDestruct();
+}
+
+void QextSerialPortPrivate::setBaudRate(BaudRateType baudRate, bool update)
+{
+    switch (baudRate) {
+#ifdef Q_OS_WIN
+    //Windows Special
+    case BAUD14400:
+    case BAUD56000:
+    case BAUD128000:
+    case BAUD256000:
+        QESP_PORTABILITY_WARNING()<<"QextSerialPort Portability Warning: POSIX does not support baudRate:"<<baudRate;
+#elif defined(Q_OS_UNIX)
+    //Unix Special
+    case BAUD50:
+    case BAUD75:
+    case BAUD134:
+    case BAUD150:
+    case BAUD200:
+    case BAUD1800:
+#  ifdef B76800
+    case BAUD76800:
+#  endif
+#  if defined(B230400) && defined(B4000000)
+    case BAUD230400:
+    case BAUD460800:
+    case BAUD500000:
+    case BAUD576000:
+    case BAUD921600:
+    case BAUD1000000:
+    case BAUD1152000:
+    case BAUD1500000:
+    case BAUD2000000:
+    case BAUD2500000:
+    case BAUD3000000:
+    case BAUD3500000:
+    case BAUD4000000:
+#  endif
+        QESP_PORTABILITY_WARNING()<<"QextSerialPort Portability Warning: Windows does not support baudRate:"<<baudRate;
+#endif
+    case BAUD110:
+    case BAUD300:
+    case BAUD600:
+    case BAUD1200:
+    case BAUD2400:
+    case BAUD4800:
+    case BAUD9600:
+    case BAUD19200:
+    case BAUD38400:
+    case BAUD57600:
+    case BAUD115200:
+#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
+    default:
+#endif
+        settings.BaudRate = baudRate;
+        settingsDirtyFlags |= DFE_BaudRate;
+        if (update && q_func()->isOpen())
+            updatePortSettings();
+        break;
+#if !(defined(Q_OS_WIN) || defined(Q_OS_MAC))
+    default:
+        QESP_WARNING()<<"QextSerialPort does not support baudRate:"<<baudRate;
+#endif
+    }
+}
+
+void QextSerialPortPrivate::setParity(ParityType parity, bool update)
+{
+    switch (parity) {
+    case PAR_SPACE:
+        if (settings.DataBits == DATA_8) {
+#ifdef Q_OS_WIN
+            QESP_PORTABILITY_WARNING("QextSerialPort Portability Warning: Space parity with 8 data bits is not supported by POSIX systems.");
+#else
+            QESP_WARNING("Space parity with 8 data bits is not supported by POSIX systems.");
+#endif
+        }
+        break;
+
+#ifdef Q_OS_WIN
+        /*mark parity - WINDOWS ONLY*/
+    case PAR_MARK:
+        QESP_PORTABILITY_WARNING("QextSerialPort Portability Warning:  Mark parity is not supported by POSIX systems");
+        break;
+#endif
+
+    case PAR_NONE:
+    case PAR_EVEN:
+    case PAR_ODD:
+        break;
+    default:
+        QESP_WARNING()<<"QextSerialPort does not support Parity:" << parity;
+    }
+
+    settings.Parity = parity;
+    settingsDirtyFlags |= DFE_Parity;
+    if (update && q_func()->isOpen())
+        updatePortSettings();
+}
+
+void QextSerialPortPrivate::setDataBits(DataBitsType dataBits, bool update)
+{
+    switch(dataBits) {
+
+    case DATA_5:
+        if (settings.StopBits == STOP_2) {
+            QESP_WARNING("QextSerialPort: 5 Data bits cannot be used with 2 stop bits.");
+        }
+        else {
+            settings.DataBits = dataBits;
+            settingsDirtyFlags |= DFE_DataBits;
+        }
+        break;
+
+    case DATA_6:
+#ifdef Q_OS_WIN
+        if (settings.StopBits == STOP_1_5) {
+            QESP_WARNING("QextSerialPort: 6 Data bits cannot be used with 1.5 stop bits.");
+        }
+        else
+#endif
+        {
+            settings.DataBits = dataBits;
+            settingsDirtyFlags |= DFE_DataBits;
+        }
+        break;
+
+    case DATA_7:
+#ifdef Q_OS_WIN
+        if (settings.StopBits == STOP_1_5) {
+            QESP_WARNING("QextSerialPort: 7 Data bits cannot be used with 1.5 stop bits.");
+        }
+        else
+#endif
+        {
+            settings.DataBits = dataBits;
+            settingsDirtyFlags |= DFE_DataBits;
+        }
+        break;
+
+    case DATA_8:
+#ifdef Q_OS_WIN
+        if (settings.StopBits == STOP_1_5) {
+            QESP_WARNING("QextSerialPort: 8 Data bits cannot be used with 1.5 stop bits.");
+        }
+        else
+#endif
+        {
+            settings.DataBits = dataBits;
+            settingsDirtyFlags |= DFE_DataBits;
+        }
+        break;
+    default:
+        QESP_WARNING()<<"QextSerialPort does not support Data bits:"<<dataBits;
+    }
+    if (update && q_func()->isOpen())
+        updatePortSettings();
+}
+
+void QextSerialPortPrivate::setStopBits(StopBitsType stopBits, bool update)
+{
+    switch (stopBits) {
+
+        /*one stop bit*/
+    case STOP_1:
+        settings.StopBits = stopBits;
+        settingsDirtyFlags |= DFE_StopBits;
+        break;
+
+#ifdef Q_OS_WIN
+        /*1.5 stop bits*/
+    case STOP_1_5:
+        QESP_PORTABILITY_WARNING("QextSerialPort Portability Warning: 1.5 stop bit operation is not supported by POSIX.");
+        if (settings.DataBits != DATA_5) {
+            QESP_WARNING("QextSerialPort: 1.5 stop bits can only be used with 5 data bits");
+        }
+        else {
+            settings.StopBits = stopBits;
+            settingsDirtyFlags |= DFE_StopBits;
+        }
+        break;
+#endif
+
+        /*two stop bits*/
+    case STOP_2:
+        if (settings.DataBits == DATA_5) {
+            QESP_WARNING("QextSerialPort: 2 stop bits cannot be used with 5 data bits");
+        }
+        else {
+            settings.StopBits = stopBits;
+            settingsDirtyFlags |= DFE_StopBits;
+        }
+        break;
+    default:
+        QESP_WARNING()<<"QextSerialPort does not support stop bits: "<<stopBits;
+    }
+    if (update && q_func()->isOpen())
+        updatePortSettings();
+}
+
+void QextSerialPortPrivate::setFlowControl(FlowType flow, bool update)
+{
+    settings.FlowControl = flow;
+    settingsDirtyFlags |= DFE_Flow;
+    if (update && q_func()->isOpen())
+        updatePortSettings();
+}
+
+void QextSerialPortPrivate::setTimeout(long millisec, bool update)
+{
+    settings.Timeout_Millisec = millisec;
+    settingsDirtyFlags |= DFE_TimeOut;
+    if (update && q_func()->isOpen())
+        updatePortSettings();
+}
+
+void QextSerialPortPrivate::setPortSettings(const PortSettings &settings, bool update)
+{
+    setBaudRate(settings.BaudRate, false);
+    setDataBits(settings.DataBits, false);
+    setStopBits(settings.StopBits, false);
+    setParity(settings.Parity, false);
+    setFlowControl(settings.FlowControl, false);
+    setTimeout(settings.Timeout_Millisec, false);
+    settingsDirtyFlags = DFE_ALL;
+    if (update && q_func()->isOpen())
+        updatePortSettings();
+}
+
+
+void QextSerialPortPrivate::_q_canRead()
+{
+    qint64 maxSize = bytesAvailable_sys();
+    if (maxSize > 0) {
+        char *writePtr = readBuffer.reserve(size_t(maxSize));
+        qint64 bytesRead = readData_sys(writePtr, maxSize);
+        if (bytesRead < maxSize)
+            readBuffer.chop(maxSize - bytesRead);
+        Q_Q(QextSerialPort);
+        Q_EMIT q->readyRead();
+    }
+}
+
+/*! \class QextSerialPort
+
+    \brief The QextSerialPort class encapsulates a serial port on both POSIX and Windows systems.
+
+    \section1 Usage
+    QextSerialPort offers both a polling and event driven API.  Event driven
+    is typically easier to use, since you never have to worry about checking
+    for new data.
+
+    \bold Example
+    \code
+    QextSerialPort *port = new QextSerialPort("COM1");
+    connect(port, SIGNAL(readyRead()), myClass, SLOT(onDataAvailable()));
+    port->open();
+
+    void MyClass::onDataAvailable()
+    {
+        QByteArray data = port->readAll();
+        processNewData(usbdata);
+    }
+    \endcode
+
+    \section1 Compatibility
+    The user will be notified of errors and possible portability conflicts at run-time
+    by default.
+
+    For example, if a application has used BAUD1800, when it is runing under unix, you
+    will get following message.
+
+    \code
+    QextSerialPort Portability Warning: Windows does not support baudRate:1800
+    \endcode
+
+    This behavior can be turned off by defining macro QESP_NO_WARN (to turn off all warnings)
+    or QESP_NO_PORTABILITY_WARN (to turn off portability warnings) in the project.
+
+
+    \bold Author: Stefan Sander, Michal Policht, Brandon Fosdick, Liam Staskawicz, Debao Zhang
+*/
+
+/*!
+  \enum QextSerialPort::QueryMode
+
+  This enum type specifies query mode used in a serial port:
+
+  \value Polling
+     asynchronously read and write
+  \value EventDriven
+     synchronously read and write
+*/
+
+/*!
+    \fn void QextSerialPort::dsrChanged(bool status)
+    This signal is emitted whenever dsr line has changed its state. You may
+    use this signal to check if device is connected.
+
+    \a status true when DSR signal is on, false otherwise.
+ */
+
+
+/*!
+    \fn QueryMode QextSerialPort::queryMode() const
+    Get query mode.
+ */
+
+/*!
+    Default constructor.  Note that the name of the device used by a QextSerialPort is dependent on
+    your OS. Possible naming conventions and their associated OS are:
+
+    \code
+
+    OS Constant       Used By         Naming Convention
+    -------------     -------------   ------------------------
+    Q_OS_WIN          Windows         COM1, COM2
+    Q_OS_IRIX         SGI/IRIX        /dev/ttyf1, /dev/ttyf2
+    Q_OS_HPUX         HP-UX           /dev/tty1p0, /dev/tty2p0
+    Q_OS_SOLARIS      SunOS/Slaris    /dev/ttya, /dev/ttyb
+    Q_OS_OSF          Digital UNIX    /dev/tty01, /dev/tty02
+    Q_OS_FREEBSD      FreeBSD         /dev/ttyd0, /dev/ttyd1
+    Q_OS_OPENBSD      OpenBSD         /dev/tty00, /dev/tty01
+    Q_OS_LINUX        Linux           /dev/ttyS0, /dev/ttyS1
+    <none>                            /dev/ttyS0, /dev/ttyS1
+    \endcode
+
+    This constructor assigns the device name to the name of the first port on the specified system.
+    See the other constructors if you need to open a different port. Default \a mode is EventDriven.
+    As a subclass of QObject, \a parent can be specified.
+*/
+
+QextSerialPort::QextSerialPort(QextSerialPort::QueryMode mode, QObject *parent)
+    : QIODevice(parent), d_ptr(new QextSerialPortPrivate(this))
+{
+#ifdef Q_OS_WIN
+    setPortName(QLatin1String("COM1"));
+
+#elif defined(Q_OS_IRIX)
+    setPortName(QLatin1String("/dev/ttyf1"));
+
+#elif defined(Q_OS_HPUX)
+    setPortName(QLatin1String("/dev/tty1p0"));
+
+#elif defined(Q_OS_SOLARIS)
+    setPortName(QLatin1String("/dev/ttya"));
+
+#elif defined(Q_OS_OSF) //formally DIGITAL UNIX
+    setPortName(QLatin1String("/dev/tty01"));
+
+#elif defined(Q_OS_FREEBSD)
+    setPortName(QLatin1String("/dev/ttyd1"));
+
+#elif defined(Q_OS_OPENBSD)
+    setPortName(QLatin1String("/dev/tty00"));
+
+#else
+    setPortName(QLatin1String("/dev/ttyS0"));
+#endif
+    setQueryMode(mode);
+}
+
+/*!
+    Constructs a serial port attached to the port specified by name.
+    \a name is the name of the device, which is windowsystem-specific,
+    e.g."COM1" or "/dev/ttyS0". \a mode
+*/
+QextSerialPort::QextSerialPort(const QString &name, QextSerialPort::QueryMode mode, QObject *parent)
+    : QIODevice(parent), d_ptr(new QextSerialPortPrivate(this))
+{
+    setQueryMode(mode);
+    setPortName(name);
+}
+
+/*!
+    Constructs a port with default name and specified \a settings.
+*/
+QextSerialPort::QextSerialPort(const PortSettings &settings, QextSerialPort::QueryMode mode, QObject *parent)
+    : QIODevice(parent), d_ptr(new QextSerialPortPrivate(this))
+{
+    Q_D(QextSerialPort);
+    setQueryMode(mode);
+    d->setPortSettings(settings);
+}
+
+/*!
+    Constructs a port with specified \a name , \a mode and \a settings.
+*/
+QextSerialPort::QextSerialPort(const QString &name, const PortSettings &settings, QextSerialPort::QueryMode mode, QObject *parent)
+    : QIODevice(parent), d_ptr(new QextSerialPortPrivate(this))
+{
+    Q_D(QextSerialPort);
+    setPortName(name);
+    setQueryMode(mode);
+    d->setPortSettings(settings);
+}
+
+/*!
+    Opens a serial port and sets its OpenMode to \a mode.
+    Note that this function does not specify which device to open.
+    Returns true if successful; otherwise returns false.This function has no effect
+    if the port associated with the class is already open.  The port is also
+    configured to the current settings, as stored in the settings structure.
+*/
+bool QextSerialPort::open(OpenMode mode)
+{
+    Q_D(QextSerialPort);
+    QWriteLocker locker(&d->lock);
+    if (mode != QIODevice::NotOpen && !isOpen())
+        d->open_sys(mode);
+
+    return isOpen();
+}
+
+
+/*! \reimp
+    Closes a serial port.  This function has no effect if the serial port associated with the class
+    is not currently open.
+*/
+void QextSerialPort::close()
+{
+    Q_D(QextSerialPort);
+    QWriteLocker locker(&d->lock);
+    if (isOpen()) {
+        // Be a good QIODevice and call QIODevice::close() before really close()
+        //  so the aboutToClose() signal is emitted at the proper time
+        QIODevice::close(); // mark ourselves as closed
+        d->close_sys();
+        d->readBuffer.clear();
+    }
+}
+
+/*!
+    Flushes all pending I/O to the serial port.  This function has no effect if the serial port
+    associated with the class is not currently open.
+*/
+void QextSerialPort::flush()
+{
+    Q_D(QextSerialPort);
+    QWriteLocker locker(&d->lock);
+    if (isOpen())
+        d->flush_sys();
+}
+
+/*! \reimp
+    Returns the number of bytes waiting in the port's receive queue.  This function will return 0 if
+    the port is not currently open, or -1 on error.
+*/
+qint64 QextSerialPort::bytesAvailable() const
+{
+    QWriteLocker locker(&d_func()->lock);
+    if (isOpen()) {
+        qint64 bytes = d_func()->bytesAvailable_sys();
+        if (bytes != -1) {
+            return bytes + d_func()->readBuffer.size()
+                    + QIODevice::bytesAvailable();
+        } else {
+            return -1;
+        }
+    }
+    return 0;
+}
+
+/*! \reimp
+
+*/
+bool QextSerialPort::canReadLine() const
+{
+    QReadLocker locker(&d_func()->lock);
+    return QIODevice::canReadLine() || d_func()->readBuffer.canReadLine();
+}
+
+/*!
+ * Set desired serial communication handling style. You may choose from polling
+ * or event driven approach. This function does nothing when port is open; to
+ * apply changes port must be reopened.
+ *
+ * In event driven approach read() and write() functions are acting
+ * asynchronously. They return immediately and the operation is performed in
+ * the background, so they doesn't freeze the calling thread.
+ * To determine when operation is finished, QextSerialPort runs separate thread
+ * and monitors serial port events. Whenever the event occurs, adequate signal
+ * is emitted.
+ *
+ * When polling is set, read() and write() are acting synchronously. Signals are
+ * not working in this mode and some functions may not be available. The advantage
+ * of polling is that it generates less overhead due to lack of signals emissions
+ * and it doesn't start separate thread to monitor events.
+ *
+ * Generally event driven approach is more capable and friendly, although some
+ * applications may need as low overhead as possible and then polling comes.
+ *
+ * \a mode query mode.
+ */
+void QextSerialPort::setQueryMode(QueryMode mode)
+{
+    Q_D(QextSerialPort);
+    QWriteLocker locker(&d->lock);
+    if (mode != d->queryMode) {
+        d->queryMode = mode;
+    }
+}
+
+/*!
+    Sets the \a name of the device associated with the object, e.g. "COM1", or "/dev/ttyS0".
+*/
+void QextSerialPort::setPortName(const QString &name)
+{
+    Q_D(QextSerialPort);
+    QWriteLocker locker(&d->lock);
+    d->port = name;
+}
+
+/*!
+    Returns the name set by setPortName().
+*/
+QString QextSerialPort::portName() const
+{
+    QReadLocker locker(&d_func()->lock);
+    return d_func()->port;
+}
+
+QextSerialPort::QueryMode QextSerialPort::queryMode() const
+{
+    QReadLocker locker(&d_func()->lock);
+    return d_func()->queryMode;
+}
+
+/*!
+    Reads all available data from the device, and returns it as a QByteArray.
+    This function has no way of reporting errors; returning an empty QByteArray()
+    can mean either that no data was currently available for reading, or that an error occurred.
+*/
+QByteArray QextSerialPort::readAll()
+{
+    int avail = this->bytesAvailable();
+    return (avail > 0) ? this->read(avail) : QByteArray();
+}
+
+/*!
+    Returns the baud rate of the serial port.  For a list of possible return values see
+    the definition of the enum BaudRateType.
+*/
+BaudRateType QextSerialPort::baudRate() const
+{
+    QReadLocker locker(&d_func()->lock);
+    return d_func()->settings.BaudRate;
+}
+
+/*!
+    Returns the number of data bits used by the port.  For a list of possible values returned by
+    this function, see the definition of the enum DataBitsType.
+*/
+DataBitsType QextSerialPort::dataBits() const
+{
+    QReadLocker locker(&d_func()->lock);
+    return d_func()->settings.DataBits;
+}
+
+/*!
+    Returns the type of parity used by the port.  For a list of possible values returned by
+    this function, see the definition of the enum ParityType.
+*/
+ParityType QextSerialPort::parity() const
+{
+    QReadLocker locker(&d_func()->lock);
+    return d_func()->settings.Parity;
+}
+
+/*!
+    Returns the number of stop bits used by the port.  For a list of possible return values, see
+    the definition of the enum StopBitsType.
+*/
+StopBitsType QextSerialPort::stopBits() const
+{
+    QReadLocker locker(&d_func()->lock);
+    return d_func()->settings.StopBits;
+}
+
+/*!
+    Returns the type of flow control used by the port.  For a list of possible values returned
+    by this function, see the definition of the enum FlowType.
+*/
+FlowType QextSerialPort::flowControl() const
+{
+    QReadLocker locker(&d_func()->lock);
+    return d_func()->settings.FlowControl;
+}
+
+/*!
+    \reimp
+    Returns true if device is sequential, otherwise returns false. Serial port is sequential device
+    so this function always returns true. Check QIODevice::isSequential() documentation for more
+    information.
+*/
+bool QextSerialPort::isSequential() const
+{
+    return true;
+}
+
+/*!
+    Return the error number, or 0 if no error occurred.
+*/
+ulong QextSerialPort::lastError() const
+{
+    QReadLocker locker(&d_func()->lock);
+    return d_func()->lastErr;
+}
+
+/*!
+    Returns the line status as stored by the port function.  This function will retrieve the states
+    of the following lines: DCD, CTS, DSR, and RI.  On POSIX systems, the following additional lines
+    can be monitored: DTR, RTS, Secondary TXD, and Secondary RXD.  The value returned is an unsigned
+    long with specific bits indicating which lines are high.  The following constants should be used
+    to examine the states of individual lines:
+
+    \code
+    Mask        Line
+    ------      ----
+    LS_CTS      CTS
+    LS_DSR      DSR
+    LS_DCD      DCD
+    LS_RI       RI
+    LS_RTS      RTS (POSIX only)
+    LS_DTR      DTR (POSIX only)
+    LS_ST       Secondary TXD (POSIX only)
+    LS_SR       Secondary RXD (POSIX only)
+    \endcode
+
+    This function will return 0 if the port associated with the class is not currently open.
+*/
+unsigned long QextSerialPort::lineStatus()
+{
+    Q_D(QextSerialPort);
+    QWriteLocker locker(&d->lock);
+    if (isOpen())
+        return d->lineStatus_sys();
+    return 0;
+}
+
+/*!
+  Returns a human-readable description of the last device error that occurred.
+*/
+QString QextSerialPort::errorString()
+{
+    Q_D(QextSerialPort);
+    QReadLocker locker(&d->lock);
+    switch(d->lastErr) {
+    case E_NO_ERROR:
+        return tr("No Error has occurred");
+    case E_INVALID_FD:
+        return tr("Invalid file descriptor (port was not opened correctly)");
+    case E_NO_MEMORY:
+        return tr("Unable to allocate memory tables (POSIX)");
+    case E_CAUGHT_NON_BLOCKED_SIGNAL:
+        return tr("Caught a non-blocked signal (POSIX)");
+    case E_PORT_TIMEOUT:
+        return tr("Operation timed out (POSIX)");
+    case E_INVALID_DEVICE:
+        return tr("The file opened by the port is not a valid device");
+    case E_BREAK_CONDITION:
+        return tr("The port detected a break condition");
+    case E_FRAMING_ERROR:
+        return tr("The port detected a framing error (usually caused by incorrect baud rate settings)");
+    case E_IO_ERROR:
+        return tr("There was an I/O error while communicating with the port");
+    case E_BUFFER_OVERRUN:
+        return tr("Character buffer overrun");
+    case E_RECEIVE_OVERFLOW:
+        return tr("Receive buffer overflow");
+    case E_RECEIVE_PARITY_ERROR:
+        return tr("The port detected a parity error in the received data");
+    case E_TRANSMIT_OVERFLOW:
+        return tr("Transmit buffer overflow");
+    case E_READ_FAILED:
+        return tr("General read operation failure");
+    case E_WRITE_FAILED:
+        return tr("General write operation failure");
+    case E_FILE_NOT_FOUND:
+        return tr("The %1 file doesn't exists").arg(this->portName());
+    case E_PERMISSION_DENIED:
+        return tr("Permission denied");
+    case E_AGAIN:
+        return tr("Device is already locked");
+    default:
+        return tr("Unknown error: %1").arg(d->lastErr);
+    }
+}
+
+/*!
+   Destructs the QextSerialPort object.
+*/
+QextSerialPort::~QextSerialPort()
+{
+    if (isOpen()) {
+        close();
+    }
+    delete d_ptr;
+}
+
+/*!
+    Sets the flow control used by the port to \a flow.  Possible values of flow are:
+    \code
+        FLOW_OFF            No flow control
+        FLOW_HARDWARE       Hardware (RTS/CTS) flow control
+        FLOW_XONXOFF        Software (XON/XOFF) flow control
+    \endcode
+*/
+void QextSerialPort::setFlowControl(FlowType flow)
+{
+    Q_D(QextSerialPort);
+    QWriteLocker locker(&d->lock);
+    if (d->settings.FlowControl != flow)
+        d->setFlowControl(flow, true);
+}
+
+/*!
+    Sets the parity associated with the serial port to \a parity.  The possible values of parity are:
+    \code
+        PAR_SPACE       Space Parity
+        PAR_MARK        Mark Parity
+        PAR_NONE        No Parity
+        PAR_EVEN        Even Parity
+        PAR_ODD         Odd Parity
+    \endcode
+*/
+void QextSerialPort::setParity(ParityType parity)
+{
+    Q_D(QextSerialPort);
+    QWriteLocker locker(&d->lock);
+    if (d->settings.Parity != parity)
+        d->setParity(parity, true);
+}
+
+/*!
+    Sets the number of data bits used by the serial port to \a dataBits.  Possible values of dataBits are:
+    \code
+        DATA_5      5 data bits
+        DATA_6      6 data bits
+        DATA_7      7 data bits
+        DATA_8      8 data bits
+    \endcode
+
+    \bold note:
+    This function is subject to the following restrictions:
+    \list
+    \o 5 data bits cannot be used with 2 stop bits.
+    \o 1.5 stop bits can only be used with 5 data bits.
+    \o 8 data bits cannot be used with space parity on POSIX systems.
+    \endlist
+    */
+void QextSerialPort::setDataBits(DataBitsType dataBits)
+{
+    Q_D(QextSerialPort);
+    QWriteLocker locker(&d->lock);
+    if (d->settings.DataBits != dataBits)
+        d->setDataBits(dataBits, true);
+}
+
+/*!
+    Sets the number of stop bits used by the serial port to \a stopBits.  Possible values of stopBits are:
+    \code
+        STOP_1      1 stop bit
+        STOP_1_5    1.5 stop bits
+        STOP_2      2 stop bits
+    \endcode
+
+    \bold note:
+    This function is subject to the following restrictions:
+    \list
+    \o 2 stop bits cannot be used with 5 data bits.
+    \o 1.5 stop bits cannot be used with 6 or more data bits.
+    \o POSIX does not support 1.5 stop bits.
+    \endlist
+*/
+void QextSerialPort::setStopBits(StopBitsType stopBits)
+{
+    Q_D(QextSerialPort);
+    QWriteLocker locker(&d->lock);
+    if (d->settings.StopBits != stopBits)
+        d->setStopBits(stopBits, true);
+}
+
+/*!
+    Sets the baud rate of the serial port to \a baudRate.  Note that not all rates are applicable on
+    all platforms.  The following table shows translations of the various baud rate
+    constants on Windows(including NT/2000) and POSIX platforms.  Speeds marked with an *
+    are speeds that are usable on both Windows and POSIX.
+    \code
+
+      RATE          Windows Speed   POSIX Speed
+      -----------   -------------   -----------
+       BAUD50                   X          50
+       BAUD75                   X          75
+      *BAUD110                110         110
+       BAUD134                  X         134.5
+       BAUD150                  X         150
+       BAUD200                  X         200
+      *BAUD300                300         300
+      *BAUD600                600         600
+      *BAUD1200              1200        1200
+       BAUD1800                 X        1800
+      *BAUD2400              2400        2400
+      *BAUD4800              4800        4800
+      *BAUD9600              9600        9600
+       BAUD14400            14400           X
+      *BAUD19200            19200       19200
+      *BAUD38400            38400       38400
+       BAUD56000            56000           X
+      *BAUD57600            57600       57600
+       BAUD76800                X       76800
+      *BAUD115200          115200      115200
+       BAUD128000          128000           X
+       BAUD230400               X      230400
+       BAUD256000          256000           X
+       BAUD460800               X      460800
+       BAUD500000               X      500000
+       BAUD576000               X      576000
+       BAUD921600               X      921600
+       BAUD1000000              X     1000000
+       BAUD1152000              X     1152000
+       BAUD1500000              X     1500000
+       BAUD2000000              X     2000000
+       BAUD2500000              X     2500000
+       BAUD3000000              X     3000000
+       BAUD3500000              X     3500000
+       BAUD4000000              X     4000000
+    \endcode
+*/
+
+void QextSerialPort::setBaudRate(BaudRateType baudRate)
+{
+    Q_D(QextSerialPort);
+    QWriteLocker locker(&d->lock);
+    if (d->settings.BaudRate != baudRate)
+        d->setBaudRate(baudRate, true);
+}
+
+/*!
+    For Unix:
+
+    Sets the read and write timeouts for the port to \a millisec milliseconds.
+    Note that this is a per-character timeout, i.e. the port will wait this long for each
+    individual character, not for the whole read operation.  This timeout also applies to the
+    bytesWaiting() function.
+
+    \bold note:
+    POSIX does not support millisecond-level control for I/O timeout values.  Any
+    timeout set using this function will be set to the next lowest tenth of a second for
+    the purposes of detecting read or write timeouts.  For example a timeout of 550 milliseconds
+    will be seen by the class as a timeout of 500 milliseconds for the purposes of reading and
+    writing the port.  However millisecond-level control is allowed by the select() system call,
+    so for example a 550-millisecond timeout will be seen as 550 milliseconds on POSIX systems for
+    the purpose of detecting available bytes in the read buffer.
+
+    For Windows:
+
+    Sets the read and write timeouts for the port to \a millisec milliseconds.
+    Setting 0 indicates that timeouts are not used for read nor write operations;
+    however read() and write() functions will still block. Set -1 to provide
+    non-blocking behaviour (read() and write() will return immediately).
+
+    \bold note: this function does nothing in event driven mode.
+*/
+void QextSerialPort::setTimeout(long millisec)
+{
+    Q_D(QextSerialPort);
+    QWriteLocker locker(&d->lock);
+    if (d->settings.Timeout_Millisec != millisec)
+        d->setTimeout(millisec, true);
+}
+
+/*!
+    Sets DTR line to the requested state (\a set default to high).  This function will have no effect if
+    the port associated with the class is not currently open.
+*/
+void QextSerialPort::setDtr(bool set)
+{
+    Q_D(QextSerialPort);
+    QWriteLocker locker(&d->lock);
+    if (isOpen())
+        d->setDtr_sys(set);
+}
+
+/*!
+    Sets RTS line to the requested state \a set (high by default).
+    This function will have no effect if
+    the port associated with the class is not currently open.
+*/
+void QextSerialPort::setRts(bool set)
+{
+    Q_D(QextSerialPort);
+    QWriteLocker locker(&d->lock);
+    if (isOpen())
+        d->setRts_sys(set);
+}
+
+/*! \reimp
+    Reads a block of data from the serial port.  This function will read at most maxlen bytes from
+    the serial port and place them in the buffer pointed to by data.  Return value is the number of
+    bytes actually read, or -1 on error.
+
+    \warning before calling this function ensure that serial port associated with this class
+    is currently open (use isOpen() function to check if port is open).
+*/
+qint64 QextSerialPort::readData(char *data, qint64 maxSize)
+{
+    Q_D(QextSerialPort);
+    QWriteLocker locker(&d->lock);
+    qint64 bytesFromBuffer = 0;
+    if (!d->readBuffer.isEmpty()) {
+        bytesFromBuffer = d->readBuffer.read(data, maxSize);
+        if (bytesFromBuffer == maxSize)
+            return bytesFromBuffer;
+    }
+    qint64 bytesFromDevice = d->readData_sys(data+bytesFromBuffer, maxSize-bytesFromBuffer);
+    if (bytesFromDevice < 0) {
+        return -1;
+    }
+    return bytesFromBuffer + bytesFromDevice;
+}
+
+/*! \reimp
+    Writes a block of data to the serial port.  This function will write len bytes
+    from the buffer pointed to by data to the serial port.  Return value is the number
+    of bytes actually written, or -1 on error.
+
+    \warning before calling this function ensure that serial port associated with this class
+    is currently open (use isOpen() function to check if port is open).
+*/
+qint64 QextSerialPort::writeData(const char *data, qint64 maxSize)
+{
+    Q_D(QextSerialPort);
+    QWriteLocker locker(&d->lock);
+    return d->writeData_sys(data, maxSize);
+}
+
+#include "moc_qextserialport.cpp"
diff --git a/interfaces/qextserialport/qextserialport.h b/interfaces/qextserialport/qextserialport.h
index 5334e94..3f9a7bd 100644
--- a/interfaces/qextserialport/qextserialport.h
+++ b/interfaces/qextserialport/qextserialport.h
@@ -1,240 +1,240 @@
-/****************************************************************************
-** Copyright (c) 2000-2003 Wayne Roth
-** Copyright (c) 2004-2007 Stefan Sander
-** Copyright (c) 2007 Michal Policht
-** Copyright (c) 2008 Brandon Fosdick
-** Copyright (c) 2009-2010 Liam Staskawicz
-** Copyright (c) 2011 Debao Zhang
-** All right reserved.
-** Web: http://code.google.com/p/qextserialport/
-**
-** Permission is hereby granted, free of charge, to any person obtaining
-** a copy of this software and associated documentation files (the
-** "Software"), to deal in the Software without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Software, and to
-** permit persons to whom the Software is furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be
-** included in all copies or substantial portions of the Software.
-**
-** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-**
-****************************************************************************/
-
-#ifndef _QEXTSERIALPORT_H_
-#define _QEXTSERIALPORT_H_
-
-#include <QtCore/QIODevice>
-#include "qextserialport_global.h"
-#ifdef Q_OS_UNIX
-#include <termios.h>
-#endif
-/*line status constants*/
-// ### QESP2.0 move to enum
-#define LS_CTS  0x01
-#define LS_DSR  0x02
-#define LS_DCD  0x04
-#define LS_RI   0x08
-#define LS_RTS  0x10
-#define LS_DTR  0x20
-#define LS_ST   0x40
-#define LS_SR   0x80
-
-/*error constants*/
-// ### QESP2.0 move to enum
-#define E_NO_ERROR                   0
-#define E_INVALID_FD                 1
-#define E_NO_MEMORY                  2
-#define E_CAUGHT_NON_BLOCKED_SIGNAL  3
-#define E_PORT_TIMEOUT               4
-#define E_INVALID_DEVICE             5
-#define E_BREAK_CONDITION            6
-#define E_FRAMING_ERROR              7
-#define E_IO_ERROR                   8
-#define E_BUFFER_OVERRUN             9
-#define E_RECEIVE_OVERFLOW          10
-#define E_RECEIVE_PARITY_ERROR      11
-#define E_TRANSMIT_OVERFLOW         12
-#define E_READ_FAILED               13
-#define E_WRITE_FAILED              14
-#define E_FILE_NOT_FOUND            15
-#define E_PERMISSION_DENIED         16
-#define E_AGAIN                     17
-
-enum BaudRateType
-{
-#if defined(Q_OS_UNIX) || defined(qdoc)
-    BAUD50 = 50,                //POSIX ONLY
-    BAUD75 = 75,                //POSIX ONLY
-    BAUD134 = 134,              //POSIX ONLY
-    BAUD150 = 150,              //POSIX ONLY
-    BAUD200 = 200,              //POSIX ONLY
-    BAUD1800 = 1800,            //POSIX ONLY
-#  if defined(B76800) || defined(qdoc)
-    BAUD76800 = 76800,          //POSIX ONLY
-#  endif
-#  if (defined(B230400) && defined(B4000000)) || defined(qdoc)
-    BAUD230400 = 230400,        //POSIX ONLY
-    BAUD460800 = 460800,        //POSIX ONLY
-    BAUD500000 = 500000,        //POSIX ONLY
-    BAUD576000 = 576000,        //POSIX ONLY
-    BAUD921600 = 921600,        //POSIX ONLY
-    BAUD1000000 = 1000000,      //POSIX ONLY
-    BAUD1152000 = 1152000,      //POSIX ONLY
-    BAUD1500000 = 1500000,      //POSIX ONLY
-    BAUD2000000 = 2000000,      //POSIX ONLY
-    BAUD2500000 = 2500000,      //POSIX ONLY
-    BAUD3000000 = 3000000,      //POSIX ONLY
-    BAUD3500000 = 3500000,      //POSIX ONLY
-    BAUD4000000 = 4000000,      //POSIX ONLY
-#  endif
-#endif //Q_OS_UNIX
-#if defined(Q_OS_WIN) || defined(qdoc)
-    BAUD14400 = 14400,          //WINDOWS ONLY
-    BAUD56000 = 56000,          //WINDOWS ONLY
-    BAUD128000 = 128000,        //WINDOWS ONLY
-    BAUD256000 = 256000,        //WINDOWS ONLY
-#endif  //Q_OS_WIN
-    BAUD110 = 110,
-    BAUD300 = 300,
-    BAUD600 = 600,
-    BAUD1200 = 1200,
-    BAUD2400 = 2400,
-    BAUD4800 = 4800,
-    BAUD9600 = 9600,
-    BAUD19200 = 19200,
-    BAUD38400 = 38400,
-    BAUD57600 = 57600,
-    BAUD115200 = 115200
-};
-
-enum DataBitsType
-{
-    DATA_5 = 5,
-    DATA_6 = 6,
-    DATA_7 = 7,
-    DATA_8 = 8
-};
-
-enum ParityType
-{
-    PAR_NONE,
-    PAR_ODD,
-    PAR_EVEN,
-#if defined(Q_OS_WIN) || defined(qdoc)
-    PAR_MARK,               //WINDOWS ONLY
-#endif
-    PAR_SPACE
-};
-
-enum StopBitsType
-{
-    STOP_1,
-#if defined(Q_OS_WIN) || defined(qdoc)
-    STOP_1_5,               //WINDOWS ONLY
-#endif
-    STOP_2
-};
-
-enum FlowType
-{
-    FLOW_OFF,
-    FLOW_HARDWARE,
-    FLOW_XONXOFF
-};
-
-/**
- * structure to contain port settings
- */
-struct PortSettings
-{
-    BaudRateType BaudRate;
-    DataBitsType DataBits;
-    ParityType Parity;
-    StopBitsType StopBits;
-    FlowType FlowControl;
-    long Timeout_Millisec;
-};
-
-class QextSerialPortPrivate;
-class QEXTSERIALPORT_EXPORT QextSerialPort: public QIODevice
-{
-    Q_OBJECT
-    Q_DECLARE_PRIVATE(QextSerialPort)
-    Q_ENUMS(QueryMode)
-    Q_PROPERTY(QString portName READ portName WRITE setPortName)
-    Q_PROPERTY(QueryMode queryMode READ queryMode WRITE setQueryMode)
-public:
-    enum QueryMode {
-        Polling,
-        EventDriven
-    };
-
-    explicit QextSerialPort(QueryMode mode = EventDriven, QObject *parent = 0);
-    explicit QextSerialPort(const QString &name, QueryMode mode = EventDriven, QObject *parent = 0);
-    explicit QextSerialPort(const PortSettings &s, QueryMode mode = EventDriven, QObject *parent = 0);
-    QextSerialPort(const QString &name, const PortSettings &s, QueryMode mode = EventDriven, QObject *parent=0);
-
-    ~QextSerialPort();
-
-    QString portName() const;
-    QueryMode queryMode() const;
-    BaudRateType baudRate() const;
-    DataBitsType dataBits() const;
-    ParityType parity() const;
-    StopBitsType stopBits() const;
-    FlowType flowControl() const;
-
-    bool open(OpenMode mode);
-    bool isSequential() const;
-    void close();
-    void flush();
-    qint64 bytesAvailable() const;
-    bool canReadLine() const;
-    QByteArray readAll();
-
-    ulong lastError() const;
-
-    ulong lineStatus();
-    QString errorString();
-
-public Q_SLOTS:
-    void setPortName(const QString &name);
-    void setQueryMode(QueryMode mode);
-    void setBaudRate(BaudRateType);
-    void setDataBits(DataBitsType);
-    void setParity(ParityType);
-    void setStopBits(StopBitsType);
-    void setFlowControl(FlowType);
-    void setTimeout(long);
-
-    void setDtr(bool set=true);
-    void setRts(bool set=true);
-
-Q_SIGNALS:
-    void dsrChanged(bool status);
-
-protected:
-    qint64 readData(char *data, qint64 maxSize);
-    qint64 writeData(const char *data, qint64 maxSize);
-
-private:
-    Q_DISABLE_COPY(QextSerialPort)
-
-#ifdef Q_OS_WIN
-    Q_PRIVATE_SLOT(d_func(), void _q_onWinEvent(HANDLE))
-#endif
-    Q_PRIVATE_SLOT(d_func(), void _q_canRead())
-
-    QextSerialPortPrivate *const d_ptr;
-};
-
-#endif
+/****************************************************************************
+** Copyright (c) 2000-2003 Wayne Roth
+** Copyright (c) 2004-2007 Stefan Sander
+** Copyright (c) 2007 Michal Policht
+** Copyright (c) 2008 Brandon Fosdick
+** Copyright (c) 2009-2010 Liam Staskawicz
+** Copyright (c) 2011 Debao Zhang
+** All right reserved.
+** Web: http://code.google.com/p/qextserialport/
+**
+** Permission is hereby granted, free of charge, to any person obtaining
+** a copy of this software and associated documentation files (the
+** "Software"), to deal in the Software without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Software, and to
+** permit persons to whom the Software is furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be
+** included in all copies or substantial portions of the Software.
+**
+** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+**
+****************************************************************************/
+
+#ifndef _QEXTSERIALPORT_H_
+#define _QEXTSERIALPORT_H_
+
+#include <QtCore/QIODevice>
+#include "qextserialport_global.h"
+#ifdef Q_OS_UNIX
+#include <termios.h>
+#endif
+/*line status constants*/
+// ### QESP2.0 move to enum
+#define LS_CTS  0x01
+#define LS_DSR  0x02
+#define LS_DCD  0x04
+#define LS_RI   0x08
+#define LS_RTS  0x10
+#define LS_DTR  0x20
+#define LS_ST   0x40
+#define LS_SR   0x80
+
+/*error constants*/
+// ### QESP2.0 move to enum
+#define E_NO_ERROR                   0
+#define E_INVALID_FD                 1
+#define E_NO_MEMORY                  2
+#define E_CAUGHT_NON_BLOCKED_SIGNAL  3
+#define E_PORT_TIMEOUT               4
+#define E_INVALID_DEVICE             5
+#define E_BREAK_CONDITION            6
+#define E_FRAMING_ERROR              7
+#define E_IO_ERROR                   8
+#define E_BUFFER_OVERRUN             9
+#define E_RECEIVE_OVERFLOW          10
+#define E_RECEIVE_PARITY_ERROR      11
+#define E_TRANSMIT_OVERFLOW         12
+#define E_READ_FAILED               13
+#define E_WRITE_FAILED              14
+#define E_FILE_NOT_FOUND            15
+#define E_PERMISSION_DENIED         16
+#define E_AGAIN                     17
+
+enum BaudRateType
+{
+#if defined(Q_OS_UNIX) || defined(qdoc)
+    BAUD50 = 50,                //POSIX ONLY
+    BAUD75 = 75,                //POSIX ONLY
+    BAUD134 = 134,              //POSIX ONLY
+    BAUD150 = 150,              //POSIX ONLY
+    BAUD200 = 200,              //POSIX ONLY
+    BAUD1800 = 1800,            //POSIX ONLY
+#  if defined(B76800) || defined(qdoc)
+    BAUD76800 = 76800,          //POSIX ONLY
+#  endif
+#  if (defined(B230400) && defined(B4000000)) || defined(qdoc)
+    BAUD230400 = 230400,        //POSIX ONLY
+    BAUD460800 = 460800,        //POSIX ONLY
+    BAUD500000 = 500000,        //POSIX ONLY
+    BAUD576000 = 576000,        //POSIX ONLY
+    BAUD921600 = 921600,        //POSIX ONLY
+    BAUD1000000 = 1000000,      //POSIX ONLY
+    BAUD1152000 = 1152000,      //POSIX ONLY
+    BAUD1500000 = 1500000,      //POSIX ONLY
+    BAUD2000000 = 2000000,      //POSIX ONLY
+    BAUD2500000 = 2500000,      //POSIX ONLY
+    BAUD3000000 = 3000000,      //POSIX ONLY
+    BAUD3500000 = 3500000,      //POSIX ONLY
+    BAUD4000000 = 4000000,      //POSIX ONLY
+#  endif
+#endif //Q_OS_UNIX
+#if defined(Q_OS_WIN) || defined(qdoc)
+    BAUD14400 = 14400,          //WINDOWS ONLY
+    BAUD56000 = 56000,          //WINDOWS ONLY
+    BAUD128000 = 128000,        //WINDOWS ONLY
+    BAUD256000 = 256000,        //WINDOWS ONLY
+#endif  //Q_OS_WIN
+    BAUD110 = 110,
+    BAUD300 = 300,
+    BAUD600 = 600,
+    BAUD1200 = 1200,
+    BAUD2400 = 2400,
+    BAUD4800 = 4800,
+    BAUD9600 = 9600,
+    BAUD19200 = 19200,
+    BAUD38400 = 38400,
+    BAUD57600 = 57600,
+    BAUD115200 = 115200
+};
+
+enum DataBitsType
+{
+    DATA_5 = 5,
+    DATA_6 = 6,
+    DATA_7 = 7,
+    DATA_8 = 8
+};
+
+enum ParityType
+{
+    PAR_NONE,
+    PAR_ODD,
+    PAR_EVEN,
+#if defined(Q_OS_WIN) || defined(qdoc)
+    PAR_MARK,               //WINDOWS ONLY
+#endif
+    PAR_SPACE
+};
+
+enum StopBitsType
+{
+    STOP_1,
+#if defined(Q_OS_WIN) || defined(qdoc)
+    STOP_1_5,               //WINDOWS ONLY
+#endif
+    STOP_2
+};
+
+enum FlowType
+{
+    FLOW_OFF,
+    FLOW_HARDWARE,
+    FLOW_XONXOFF
+};
+
+/**
+ * structure to contain port settings
+ */
+struct PortSettings
+{
+    BaudRateType BaudRate;
+    DataBitsType DataBits;
+    ParityType Parity;
+    StopBitsType StopBits;
+    FlowType FlowControl;
+    long Timeout_Millisec;
+};
+
+class QextSerialPortPrivate;
+class QEXTSERIALPORT_EXPORT QextSerialPort: public QIODevice
+{
+    Q_OBJECT
+    Q_DECLARE_PRIVATE(QextSerialPort)
+    Q_ENUMS(QueryMode)
+    Q_PROPERTY(QString portName READ portName WRITE setPortName)
+    Q_PROPERTY(QueryMode queryMode READ queryMode WRITE setQueryMode)
+public:
+    enum QueryMode {
+        Polling,
+        EventDriven
+    };
+
+    explicit QextSerialPort(QueryMode mode = EventDriven, QObject *parent = 0);
+    explicit QextSerialPort(const QString &name, QueryMode mode = EventDriven, QObject *parent = 0);
+    explicit QextSerialPort(const PortSettings &s, QueryMode mode = EventDriven, QObject *parent = 0);
+    QextSerialPort(const QString &name, const PortSettings &s, QueryMode mode = EventDriven, QObject *parent=0);
+
+    ~QextSerialPort();
+
+    QString portName() const;
+    QueryMode queryMode() const;
+    BaudRateType baudRate() const;
+    DataBitsType dataBits() const;
+    ParityType parity() const;
+    StopBitsType stopBits() const;
+    FlowType flowControl() const;
+
+    bool open(OpenMode mode);
+    bool isSequential() const;
+    void close();
+    void flush();
+    qint64 bytesAvailable() const;
+    bool canReadLine() const;
+    QByteArray readAll();
+
+    ulong lastError() const;
+
+    ulong lineStatus();
+    QString errorString();
+
+public Q_SLOTS:
+    void setPortName(const QString &name);
+    void setQueryMode(QueryMode mode);
+    void setBaudRate(BaudRateType);
+    void setDataBits(DataBitsType);
+    void setParity(ParityType);
+    void setStopBits(StopBitsType);
+    void setFlowControl(FlowType);
+    void setTimeout(long);
+
+    void setDtr(bool set=true);
+    void setRts(bool set=true);
+
+Q_SIGNALS:
+    void dsrChanged(bool status);
+
+protected:
+    qint64 readData(char *data, qint64 maxSize);
+    qint64 writeData(const char *data, qint64 maxSize);
+
+private:
+    Q_DISABLE_COPY(QextSerialPort)
+
+#ifdef Q_OS_WIN
+    Q_PRIVATE_SLOT(d_func(), void _q_onWinEvent(HANDLE))
+#endif
+    Q_PRIVATE_SLOT(d_func(), void _q_canRead())
+
+    QextSerialPortPrivate *const d_ptr;
+};
+
+#endif
diff --git a/interfaces/qextserialport/qextserialport_global.h b/interfaces/qextserialport/qextserialport_global.h
index 824d455..507d2cf 100644
--- a/interfaces/qextserialport/qextserialport_global.h
+++ b/interfaces/qextserialport/qextserialport_global.h
@@ -1,72 +1,72 @@
-/****************************************************************************
-** Copyright (c) 2000-2003 Wayne Roth
-** Copyright (c) 2004-2007 Stefan Sander
-** Copyright (c) 2007 Michal Policht
-** Copyright (c) 2008 Brandon Fosdick
-** Copyright (c) 2009-2010 Liam Staskawicz
-** Copyright (c) 2011 Debao Zhang
-** All right reserved.
-** Web: http://code.google.com/p/qextserialport/
-**
-** Permission is hereby granted, free of charge, to any person obtaining
-** a copy of this software and associated documentation files (the
-** "Software"), to deal in the Software without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Software, and to
-** permit persons to whom the Software is furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be
-** included in all copies or substantial portions of the Software.
-**
-** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-**
-****************************************************************************/
-
-#ifndef QEXTSERIALPORT_GLOBAL_H
-#define QEXTSERIALPORT_GLOBAL_H
-
-#include <QtCore/QtGlobal>
-
-#ifdef QEXTSERIALPORT_BUILD_SHARED
-#  define QEXTSERIALPORT_EXPORT Q_DECL_EXPORT
-#elif defined(QEXTSERIALPORT_USING_SHARED)
-#  define QEXTSERIALPORT_EXPORT Q_DECL_IMPORT
-#else
-#  define QEXTSERIALPORT_EXPORT
-#endif
-
-// ### for compatible with old version. should be removed in QESP 2.0
-#ifdef _TTY_NOWARN_
-#  define QESP_NO_WARN
-#endif
-#ifdef _TTY_NOWARN_PORT_
-#  define QESP_NO_PORTABILITY_WARN
-#endif
-
-/*if all warning messages are turned off, flag portability warnings to be turned off as well*/
-#ifdef QESP_NO_WARN
-#  define QESP_NO_PORTABILITY_WARN
-#endif
-
-/*macros for warning and debug messages*/
-#ifdef QESP_NO_PORTABILITY_WARN
-#  define QESP_PORTABILITY_WARNING  while (false)qWarning
-#else
-#  define QESP_PORTABILITY_WARNING qWarning
-#endif /*QESP_NOWARN_PORT*/
-
-#ifdef QESP_NO_WARN
-#  define QESP_WARNING while (false)qWarning
-#else
-#  define QESP_WARNING qWarning
-#endif /*QESP_NOWARN*/
-
-#endif // QEXTSERIALPORT_GLOBAL_H
-
+/****************************************************************************
+** Copyright (c) 2000-2003 Wayne Roth
+** Copyright (c) 2004-2007 Stefan Sander
+** Copyright (c) 2007 Michal Policht
+** Copyright (c) 2008 Brandon Fosdick
+** Copyright (c) 2009-2010 Liam Staskawicz
+** Copyright (c) 2011 Debao Zhang
+** All right reserved.
+** Web: http://code.google.com/p/qextserialport/
+**
+** Permission is hereby granted, free of charge, to any person obtaining
+** a copy of this software and associated documentation files (the
+** "Software"), to deal in the Software without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Software, and to
+** permit persons to whom the Software is furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be
+** included in all copies or substantial portions of the Software.
+**
+** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+**
+****************************************************************************/
+
+#ifndef QEXTSERIALPORT_GLOBAL_H
+#define QEXTSERIALPORT_GLOBAL_H
+
+#include <QtCore/QtGlobal>
+
+#ifdef QEXTSERIALPORT_BUILD_SHARED
+#  define QEXTSERIALPORT_EXPORT Q_DECL_EXPORT
+#elif defined(QEXTSERIALPORT_USING_SHARED)
+#  define QEXTSERIALPORT_EXPORT Q_DECL_IMPORT
+#else
+#  define QEXTSERIALPORT_EXPORT
+#endif
+
+// ### for compatible with old version. should be removed in QESP 2.0
+#ifdef _TTY_NOWARN_
+#  define QESP_NO_WARN
+#endif
+#ifdef _TTY_NOWARN_PORT_
+#  define QESP_NO_PORTABILITY_WARN
+#endif
+
+/*if all warning messages are turned off, flag portability warnings to be turned off as well*/
+#ifdef QESP_NO_WARN
+#  define QESP_NO_PORTABILITY_WARN
+#endif
+
+/*macros for warning and debug messages*/
+#ifdef QESP_NO_PORTABILITY_WARN
+#  define QESP_PORTABILITY_WARNING  while (false)qWarning
+#else
+#  define QESP_PORTABILITY_WARNING qWarning
+#endif /*QESP_NOWARN_PORT*/
+
+#ifdef QESP_NO_WARN
+#  define QESP_WARNING while (false)qWarning
+#else
+#  define QESP_WARNING qWarning
+#endif /*QESP_NOWARN*/
+
+#endif // QEXTSERIALPORT_GLOBAL_H
+
diff --git a/interfaces/qextserialport/qextserialport_p.h b/interfaces/qextserialport/qextserialport_p.h
index d278a17..37d0e76 100644
--- a/interfaces/qextserialport/qextserialport_p.h
+++ b/interfaces/qextserialport/qextserialport_p.h
@@ -1,251 +1,251 @@
-/****************************************************************************
-** Copyright (c) 2000-2003 Wayne Roth
-** Copyright (c) 2004-2007 Stefan Sander
-** Copyright (c) 2007 Michal Policht
-** Copyright (c) 2008 Brandon Fosdick
-** Copyright (c) 2009-2010 Liam Staskawicz
-** Copyright (c) 2011 Debao Zhang
-** All right reserved.
-** Web: http://code.google.com/p/qextserialport/
-**
-** Permission is hereby granted, free of charge, to any person obtaining
-** a copy of this software and associated documentation files (the
-** "Software"), to deal in the Software without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Software, and to
-** permit persons to whom the Software is furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be
-** included in all copies or substantial portions of the Software.
-**
-** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-**
-****************************************************************************/
-
-#ifndef _QEXTSERIALPORT_P_H_
-#define _QEXTSERIALPORT_P_H_
-
-//
-//  W A R N I N G
-//  -------------
-//
-// This file is not part of the QESP API.  It exists for the convenience
-// of other QESP classes.  This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qextserialport.h"
-#include <QtCore/QReadWriteLock>
-#ifdef Q_OS_UNIX
-#  include <termios.h>
-#elif (defined Q_OS_WIN)
-#  include <QtCore/qt_windows.h>
-#endif
-#include <stdlib.h>
-
-// This is QextSerialPort's read buffer, needed by posix system.
-// ref: QRingBuffer & QIODevicePrivateLinearBuffer
-class QextReadBuffer
-{
-public:
-    inline QextReadBuffer(size_t growth=4096)
-        : len(0), first(0), buf(0), capacity(0), basicBlockSize(growth) {
-    }
-
-    ~QextReadBuffer() {
-        delete [] buf;
-    }
-
-    inline void clear() {
-        first = buf;
-        len = 0;
-    }
-
-    inline int size() const {
-        return len;
-    }
-
-    inline bool isEmpty() const {
-        return len == 0;
-    }
-
-    inline int read(char *target, int size) {
-        int r = qMin(size, len);
-        if (r == 1) {
-            *target = *first;
-            --len;
-            ++first;
-        } else {
-            memcpy(target, first, r);
-            len -= r;
-            first += r;
-        }
-        return r;
-    }
-
-    inline char *reserve(size_t size) {
-        if ((first - buf) + len + size > capacity) {
-            size_t newCapacity = qMax(capacity, basicBlockSize);
-            while (newCapacity < len + size)
-                newCapacity *= 2;
-            if (newCapacity > capacity) {
-                // allocate more space
-                char *newBuf = new char[newCapacity];
-                memmove(newBuf, first, len);
-                delete [] buf;
-                buf = newBuf;
-                capacity = newCapacity;
-            } else {
-                // shift any existing data to make space
-                memmove(buf, first, len);
-            }
-            first = buf;
-        }
-        char *writePtr = first + len;
-        len += (int)size;
-        return writePtr;
-    }
-
-    inline void chop(int size) {
-        if (size >= len) {
-            clear();
-        } else {
-            len -= size;
-        }
-    }
-
-    inline void squeeze() {
-        if (first != buf) {
-            memmove(buf, first, len);
-            first = buf;
-        }
-        size_t newCapacity = basicBlockSize;
-        while (newCapacity < size_t(len))
-            newCapacity *= 2;
-        if (newCapacity < capacity) {
-            char *tmp = static_cast<char *>(realloc(buf, newCapacity));
-            if (tmp) {
-                buf = tmp;
-                capacity = newCapacity;
-            }
-        }
-    }
-
-    inline QByteArray readAll() {
-        char *f = first;
-        int l = len;
-        clear();
-        return QByteArray(f, l);
-    }
-
-    inline int readLine(char *target, int size) {
-        int r = qMin(size, len);
-        char *eol = static_cast<char *>(memchr(first, '\n', r));
-        if (eol)
-            r = 1+(eol-first);
-        memcpy(target, first, r);
-        len -= r;
-        first += r;
-        return int(r);
-    }
-
-    inline bool canReadLine() const {
-        return memchr(first, '\n', len);
-    }
-
-private:
-    int len;
-    char *first;
-    char *buf;
-    size_t capacity;
-    size_t basicBlockSize;
-};
-
-class QWinEventNotifier;
-class QReadWriteLock;
-class QSocketNotifier;
-
-class QextSerialPortPrivate
-{
-    Q_DECLARE_PUBLIC(QextSerialPort)
-public:
-    QextSerialPortPrivate(QextSerialPort *q);
-    ~QextSerialPortPrivate();
-    enum DirtyFlagEnum
-    {
-        DFE_BaudRate = 0x0001,
-        DFE_Parity = 0x0002,
-        DFE_StopBits = 0x0004,
-        DFE_DataBits = 0x0008,
-        DFE_Flow = 0x0010,
-        DFE_TimeOut = 0x0100,
-        DFE_ALL = 0x0fff,
-        DFE_Settings_Mask = 0x00ff //without TimeOut
-    };
-    mutable QReadWriteLock lock;
-    QString port;
-    PortSettings settings;
-    QextReadBuffer readBuffer;
-    int settingsDirtyFlags;
-    ulong lastErr;
-    QextSerialPort::QueryMode queryMode;
-
-    // platform specific members
-#ifdef Q_OS_UNIX
-    int fd;
-    QSocketNotifier *readNotifier;
-    struct termios currentTermios;
-    struct termios oldTermios;
-#elif (defined Q_OS_WIN)
-    HANDLE handle;
-    OVERLAPPED overlap;
-    COMMCONFIG commConfig;
-    COMMTIMEOUTS commTimeouts;
-    QWinEventNotifier *winEventNotifier;
-    DWORD eventMask;
-    QList<OVERLAPPED *> pendingWrites;
-    QReadWriteLock *bytesToWriteLock;
-#endif
-
-    /*fill PortSettings*/
-    void setBaudRate(BaudRateType baudRate, bool update=true);
-    void setDataBits(DataBitsType dataBits, bool update=true);
-    void setParity(ParityType parity, bool update=true);
-    void setStopBits(StopBitsType stopbits, bool update=true);
-    void setFlowControl(FlowType flow, bool update=true);
-    void setTimeout(long millisec, bool update=true);
-    void setPortSettings(const PortSettings &settings, bool update=true);
-
-    void platformSpecificDestruct();
-    void platformSpecificInit();
-    void translateError(ulong error);
-    void updatePortSettings();
-
-    qint64 readData_sys(char *data, qint64 maxSize);
-    qint64 writeData_sys(const char *data, qint64 maxSize);
-    void setDtr_sys(bool set=true);
-    void setRts_sys(bool set=true);
-    bool open_sys(QIODevice::OpenMode mode);
-    bool close_sys();
-    bool flush_sys();
-    ulong lineStatus_sys();
-    qint64 bytesAvailable_sys() const;
-
-#ifdef Q_OS_WIN
-    void _q_onWinEvent(HANDLE h);
-#endif
-    void _q_canRead();
-
-    QextSerialPort *q_ptr;
-};
-
-#endif //_QEXTSERIALPORT_P_H_
+/****************************************************************************
+** Copyright (c) 2000-2003 Wayne Roth
+** Copyright (c) 2004-2007 Stefan Sander
+** Copyright (c) 2007 Michal Policht
+** Copyright (c) 2008 Brandon Fosdick
+** Copyright (c) 2009-2010 Liam Staskawicz
+** Copyright (c) 2011 Debao Zhang
+** All right reserved.
+** Web: http://code.google.com/p/qextserialport/
+**
+** Permission is hereby granted, free of charge, to any person obtaining
+** a copy of this software and associated documentation files (the
+** "Software"), to deal in the Software without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Software, and to
+** permit persons to whom the Software is furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be
+** included in all copies or substantial portions of the Software.
+**
+** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+**
+****************************************************************************/
+
+#ifndef _QEXTSERIALPORT_P_H_
+#define _QEXTSERIALPORT_P_H_
+
+//
+//  W A R N I N G
+//  -------------
+//
+// This file is not part of the QESP API.  It exists for the convenience
+// of other QESP classes.  This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qextserialport.h"
+#include <QtCore/QReadWriteLock>
+#ifdef Q_OS_UNIX
+#  include <termios.h>
+#elif (defined Q_OS_WIN)
+#  include <QtCore/qt_windows.h>
+#endif
+#include <stdlib.h>
+
+// This is QextSerialPort's read buffer, needed by posix system.
+// ref: QRingBuffer & QIODevicePrivateLinearBuffer
+class QextReadBuffer
+{
+public:
+    inline QextReadBuffer(size_t growth=4096)
+        : len(0), first(0), buf(0), capacity(0), basicBlockSize(growth) {
+    }
+
+    ~QextReadBuffer() {
+        delete [] buf;
+    }
+
+    inline void clear() {
+        first = buf;
+        len = 0;
+    }
+
+    inline int size() const {
+        return len;
+    }
+
+    inline bool isEmpty() const {
+        return len == 0;
+    }
+
+    inline int read(char *target, int size) {
+        int r = qMin(size, len);
+        if (r == 1) {
+            *target = *first;
+            --len;
+            ++first;
+        } else {
+            memcpy(target, first, r);
+            len -= r;
+            first += r;
+        }
+        return r;
+    }
+
+    inline char *reserve(size_t size) {
+        if ((first - buf) + len + size > capacity) {
+            size_t newCapacity = qMax(capacity, basicBlockSize);
+            while (newCapacity < len + size)
+                newCapacity *= 2;
+            if (newCapacity > capacity) {
+                // allocate more space
+                char *newBuf = new char[newCapacity];
+                memmove(newBuf, first, len);
+                delete [] buf;
+                buf = newBuf;
+                capacity = newCapacity;
+            } else {
+                // shift any existing data to make space
+                memmove(buf, first, len);
+            }
+            first = buf;
+        }
+        char *writePtr = first + len;
+        len += (int)size;
+        return writePtr;
+    }
+
+    inline void chop(int size) {
+        if (size >= len) {
+            clear();
+        } else {
+            len -= size;
+        }
+    }
+
+    inline void squeeze() {
+        if (first != buf) {
+            memmove(buf, first, len);
+            first = buf;
+        }
+        size_t newCapacity = basicBlockSize;
+        while (newCapacity < size_t(len))
+            newCapacity *= 2;
+        if (newCapacity < capacity) {
+            char *tmp = static_cast<char *>(realloc(buf, newCapacity));
+            if (tmp) {
+                buf = tmp;
+                capacity = newCapacity;
+            }
+        }
+    }
+
+    inline QByteArray readAll() {
+        char *f = first;
+        int l = len;
+        clear();
+        return QByteArray(f, l);
+    }
+
+    inline int readLine(char *target, int size) {
+        int r = qMin(size, len);
+        char *eol = static_cast<char *>(memchr(first, '\n', r));
+        if (eol)
+            r = 1+(eol-first);
+        memcpy(target, first, r);
+        len -= r;
+        first += r;
+        return int(r);
+    }
+
+    inline bool canReadLine() const {
+        return memchr(first, '\n', len);
+    }
+
+private:
+    int len;
+    char *first;
+    char *buf;
+    size_t capacity;
+    size_t basicBlockSize;
+};
+
+class QWinEventNotifier;
+class QReadWriteLock;
+class QSocketNotifier;
+
+class QextSerialPortPrivate
+{
+    Q_DECLARE_PUBLIC(QextSerialPort)
+public:
+    QextSerialPortPrivate(QextSerialPort *q);
+    ~QextSerialPortPrivate();
+    enum DirtyFlagEnum
+    {
+        DFE_BaudRate = 0x0001,
+        DFE_Parity = 0x0002,
+        DFE_StopBits = 0x0004,
+        DFE_DataBits = 0x0008,
+        DFE_Flow = 0x0010,
+        DFE_TimeOut = 0x0100,
+        DFE_ALL = 0x0fff,
+        DFE_Settings_Mask = 0x00ff //without TimeOut
+    };
+    mutable QReadWriteLock lock;
+    QString port;
+    PortSettings settings;
+    QextReadBuffer readBuffer;
+    int settingsDirtyFlags;
+    ulong lastErr;
+    QextSerialPort::QueryMode queryMode;
+
+    // platform specific members
+#ifdef Q_OS_UNIX
+    int fd;
+    QSocketNotifier *readNotifier;
+    struct termios currentTermios;
+    struct termios oldTermios;
+#elif (defined Q_OS_WIN)
+    HANDLE handle;
+    OVERLAPPED overlap;
+    COMMCONFIG commConfig;
+    COMMTIMEOUTS commTimeouts;
+    QWinEventNotifier *winEventNotifier;
+    DWORD eventMask;
+    QList<OVERLAPPED *> pendingWrites;
+    QReadWriteLock *bytesToWriteLock;
+#endif
+
+    /*fill PortSettings*/
+    void setBaudRate(BaudRateType baudRate, bool update=true);
+    void setDataBits(DataBitsType dataBits, bool update=true);
+    void setParity(ParityType parity, bool update=true);
+    void setStopBits(StopBitsType stopbits, bool update=true);
+    void setFlowControl(FlowType flow, bool update=true);
+    void setTimeout(long millisec, bool update=true);
+    void setPortSettings(const PortSettings &settings, bool update=true);
+
+    void platformSpecificDestruct();
+    void platformSpecificInit();
+    void translateError(ulong error);
+    void updatePortSettings();
+
+    qint64 readData_sys(char *data, qint64 maxSize);
+    qint64 writeData_sys(const char *data, qint64 maxSize);
+    void setDtr_sys(bool set=true);
+    void setRts_sys(bool set=true);
+    bool open_sys(QIODevice::OpenMode mode);
+    bool close_sys();
+    bool flush_sys();
+    ulong lineStatus_sys();
+    qint64 bytesAvailable_sys() const;
+
+#ifdef Q_OS_WIN
+    void _q_onWinEvent(HANDLE h);
+#endif
+    void _q_canRead();
+
+    QextSerialPort *q_ptr;
+};
+
+#endif //_QEXTSERIALPORT_P_H_
diff --git a/interfaces/qextserialport/qextserialport_unix.cpp b/interfaces/qextserialport/qextserialport_unix.cpp
index 4c02a20..29e1daa 100644
--- a/interfaces/qextserialport/qextserialport_unix.cpp
+++ b/interfaces/qextserialport/qextserialport_unix.cpp
@@ -1,460 +1,460 @@
-/****************************************************************************
-** Copyright (c) 2000-2003 Wayne Roth
-** Copyright (c) 2004-2007 Stefan Sander
-** Copyright (c) 2007 Michal Policht
-** Copyright (c) 2008 Brandon Fosdick
-** Copyright (c) 2009-2010 Liam Staskawicz
-** Copyright (c) 2011 Debao Zhang
-** All right reserved.
-** Web: http://code.google.com/p/qextserialport/
-**
-** Permission is hereby granted, free of charge, to any person obtaining
-** a copy of this software and associated documentation files (the
-** "Software"), to deal in the Software without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Software, and to
-** permit persons to whom the Software is furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be
-** included in all copies or substantial portions of the Software.
-**
-** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-**
-****************************************************************************/
-
-#include "qextserialport.h"
-#include "qextserialport_p.h"
-#include <fcntl.h>
-#include <stdio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
-#include <sys/select.h>
-#include <QtCore/QMutexLocker>
-#include <QtCore/QDebug>
-#include <QtCore/QSocketNotifier>
-
-void QextSerialPortPrivate::platformSpecificInit()
-{
-    fd = 0;
-    readNotifier = 0;
-}
-
-/*!
-    Standard destructor.
-*/
-void QextSerialPortPrivate::platformSpecificDestruct()
-{
-}
-
-static QString fullPortName(const QString &name)
-{
-    if (name.startsWith(QLatin1Char('/')))
-        return name;
-    return QLatin1String("/dev/")+name;
-}
-
-bool QextSerialPortPrivate::open_sys(QIODevice::OpenMode mode)
-{
-    Q_Q(QextSerialPort);
-    //note: linux 2.6.21 seems to ignore O_NDELAY flag
-    if ((fd = ::open(fullPortName(port).toLatin1() ,O_RDWR | O_NOCTTY | O_NDELAY)) != -1) {
-
-        /*In the Private class, We can not call QIODevice::open()*/
-        q->setOpenMode(mode);             // Flag the port as opened
-        ::tcgetattr(fd, &oldTermios);    // Save the old termios
-        currentTermios = oldTermios;   // Make a working copy
-        ::cfmakeraw(&currentTermios);   // Enable raw access
-
-        /*set up other port settings*/
-        currentTermios.c_cflag |= CREAD|CLOCAL;
-        currentTermios.c_lflag &= (~(ICANON|ECHO|ECHOE|ECHOK|ECHONL|ISIG));
-        currentTermios.c_iflag &= (~(INPCK|IGNPAR|PARMRK|ISTRIP|ICRNL|IXANY));
-        currentTermios.c_oflag &= (~OPOST);
-        currentTermios.c_cc[VMIN] = 0;
-#ifdef _POSIX_VDISABLE  // Is a disable character available on this system?
-        // Some systems allow for per-device disable-characters, so get the
-        //  proper value for the configured device
-        const long vdisable = ::fpathconf(fd, _PC_VDISABLE);
-        currentTermios.c_cc[VINTR] = vdisable;
-        currentTermios.c_cc[VQUIT] = vdisable;
-        currentTermios.c_cc[VSTART] = vdisable;
-        currentTermios.c_cc[VSTOP] = vdisable;
-        currentTermios.c_cc[VSUSP] = vdisable;
-#endif //_POSIX_VDISABLE
-        settingsDirtyFlags = DFE_ALL;
-        updatePortSettings();
-
-        if (queryMode == QextSerialPort::EventDriven) {
-            readNotifier = new QSocketNotifier(fd, QSocketNotifier::Read, q);
-            q->connect(readNotifier, SIGNAL(activated(int)), q, SLOT(_q_canRead()));
-        }
-        return true;
-    } else {
-        translateError(errno);
-        return false;
-    }
-}
-
-bool QextSerialPortPrivate::close_sys()
-{
-    // Force a flush and then restore the original termios
-    flush_sys();
-    // Using both TCSAFLUSH and TCSANOW here discards any pending input
-    ::tcsetattr(fd, TCSAFLUSH | TCSANOW, &oldTermios);   // Restore termios
-    ::close(fd);
-    if (readNotifier) {
-        delete readNotifier;
-        readNotifier = 0;
-    }
-    return true;
-}
-
-bool QextSerialPortPrivate::flush_sys()
-{
-    ::tcdrain(fd);
-    return true;
-}
-
-qint64 QextSerialPortPrivate::bytesAvailable_sys() const
-{
-    int bytesQueued;
-    if (::ioctl(fd, FIONREAD, &bytesQueued) == -1) {
-        return (qint64)-1;
-    }
-    return bytesQueued;
-}
-
-/*!
-    Translates a system-specific error code to a QextSerialPort error code.  Used internally.
-*/
-void QextSerialPortPrivate::translateError(ulong error)
-{
-    switch (error) {
-    case EBADF:
-    case ENOTTY:
-        lastErr = E_INVALID_FD;
-        break;
-    case EINTR:
-        lastErr = E_CAUGHT_NON_BLOCKED_SIGNAL;
-        break;
-    case ENOMEM:
-        lastErr = E_NO_MEMORY;
-        break;
-    case EACCES:
-        lastErr = E_PERMISSION_DENIED;
-        break;
-    case EAGAIN:
-        lastErr = E_AGAIN;
-        break;
-    }
-}
-
-void QextSerialPortPrivate::setDtr_sys(bool set)
-{
-    int status;
-    ::ioctl(fd, TIOCMGET, &status);
-    if (set)
-        status |= TIOCM_DTR;
-    else
-        status &= ~TIOCM_DTR;
-    ::ioctl(fd, TIOCMSET, &status);
-}
-
-void QextSerialPortPrivate::setRts_sys(bool set)
-{
-    int status;
-    ::ioctl(fd, TIOCMGET, &status);
-    if (set)
-        status |= TIOCM_RTS;
-    else
-        status &= ~TIOCM_RTS;
-    ::ioctl(fd, TIOCMSET, &status);
-}
-
-unsigned long QextSerialPortPrivate::lineStatus_sys()
-{
-    unsigned long Status=0, Temp=0;
-    ::ioctl(fd, TIOCMGET, &Temp);
-    if (Temp & TIOCM_CTS) Status |= LS_CTS;
-    if (Temp & TIOCM_DSR) Status |= LS_DSR;
-    if (Temp & TIOCM_RI) Status |= LS_RI;
-    if (Temp & TIOCM_CD) Status |= LS_DCD;
-    if (Temp & TIOCM_DTR) Status |= LS_DTR;
-    if (Temp & TIOCM_RTS) Status |= LS_RTS;
-    if (Temp & TIOCM_ST) Status |= LS_ST;
-    if (Temp & TIOCM_SR) Status |= LS_SR;
-    return Status;
-}
-
-/*!
-    Reads a block of data from the serial port.  This function will read at most maxSize bytes from
-    the serial port and place them in the buffer pointed to by data.  Return value is the number of
-    bytes actually read, or -1 on error.
-    
-    \warning before calling this function ensure that serial port associated with this class
-    is currently open (use isOpen() function to check if port is open).
-*/
-qint64 QextSerialPortPrivate::readData_sys(char *data, qint64 maxSize)
-{
-    int retVal = ::read(fd, data, maxSize);
-    if (retVal == -1)
-        lastErr = E_READ_FAILED;
-
-    return retVal;
-}
-
-/*!
-    Writes a block of data to the serial port.  This function will write maxSize bytes
-    from the buffer pointed to by data to the serial port.  Return value is the number
-    of bytes actually written, or -1 on error.
-    
-    \warning before calling this function ensure that serial port associated with this class
-    is currently open (use isOpen() function to check if port is open).
-*/
-qint64 QextSerialPortPrivate::writeData_sys(const char *data, qint64 maxSize)
-{
-    int retVal = ::write(fd, data, maxSize);
-    if (retVal == -1)
-        lastErr = E_WRITE_FAILED;
-
-    return (qint64)retVal;
-}
-
-static void setBaudRate2Termios(termios *config, int baudRate)
-{
-#ifdef CBAUD
-    config->c_cflag &= (~CBAUD);
-    config->c_cflag |= baudRate;
-#else
-    ::cfsetispeed(config, baudRate);
-    ::cfsetospeed(config, baudRate);
-#endif
-}
-
-/*
-    All the platform settings was performed in this function.
-*/
-void QextSerialPortPrivate::updatePortSettings()
-{
-    if (!q_func()->isOpen() || !settingsDirtyFlags)
-        return;
-
-    if (settingsDirtyFlags & DFE_BaudRate) {
-        switch (settings.BaudRate) {
-        case BAUD50:
-            setBaudRate2Termios(&currentTermios, B50);
-            break;
-        case BAUD75:
-            setBaudRate2Termios(&currentTermios, B75);
-            break;
-        case BAUD110:
-            setBaudRate2Termios(&currentTermios, B110);
-            break;
-        case BAUD134:
-            setBaudRate2Termios(&currentTermios, B134);
-            break;
-        case BAUD150:
-            setBaudRate2Termios(&currentTermios, B150);
-            break;
-        case BAUD200:
-            setBaudRate2Termios(&currentTermios, B200);
-            break;
-        case BAUD300:
-            setBaudRate2Termios(&currentTermios, B300);
-            break;
-        case BAUD600:
-            setBaudRate2Termios(&currentTermios, B600);
-            break;
-        case BAUD1200:
-            setBaudRate2Termios(&currentTermios, B1200);
-            break;
-        case BAUD1800:
-            setBaudRate2Termios(&currentTermios, B1800);
-            break;
-        case BAUD2400:
-            setBaudRate2Termios(&currentTermios, B2400);
-            break;
-        case BAUD4800:
-            setBaudRate2Termios(&currentTermios, B4800);
-            break;
-        case BAUD9600:
-            setBaudRate2Termios(&currentTermios, B9600);
-            break;
-        case BAUD19200:
-            setBaudRate2Termios(&currentTermios, B19200);
-            break;
-        case BAUD38400:
-            setBaudRate2Termios(&currentTermios, B38400);
-            break;
-        case BAUD57600:
-            setBaudRate2Termios(&currentTermios, B57600);
-            break;
-#ifdef B76800
-        case BAUD76800:
-            setBaudRate2Termios(&currentTermios, B76800);
-            break;
-#endif
-        case BAUD115200:
-            setBaudRate2Termios(&currentTermios, B115200);
-            break;
-#if defined(B230400) && defined(B4000000)
-        case BAUD230400:
-            setBaudRate2Termios(&currentTermios, B230400);
-            break;
-        case BAUD460800:
-            setBaudRate2Termios(&currentTermios, B460800);
-            break;
-        case BAUD500000:
-            setBaudRate2Termios(&currentTermios, B500000);
-            break;
-        case BAUD576000:
-            setBaudRate2Termios(&currentTermios, B576000);
-            break;
-        case BAUD921600:
-            setBaudRate2Termios(&currentTermios, B921600);
-            break;
-        case BAUD1000000:
-            setBaudRate2Termios(&currentTermios, B1000000);
-            break;
-        case BAUD1152000:
-            setBaudRate2Termios(&currentTermios, B1152000);
-            break;
-        case BAUD1500000:
-            setBaudRate2Termios(&currentTermios, B1500000);
-            break;
-        case BAUD2000000:
-            setBaudRate2Termios(&currentTermios, B2000000);
-            break;
-        case BAUD2500000:
-            setBaudRate2Termios(&currentTermios, B2500000);
-            break;
-        case BAUD3000000:
-            setBaudRate2Termios(&currentTermios, B3000000);
-            break;
-        case BAUD3500000:
-            setBaudRate2Termios(&currentTermios, B3500000);
-            break;
-        case BAUD4000000:
-            setBaudRate2Termios(&currentTermios, B4000000);
-            break;
-#endif
-#ifdef Q_OS_MAC
-        default:
-            setBaudRate2Termios(&currentTermios, settings.BaudRate);
-            break;
-#endif
-        }
-    }
-    if (settingsDirtyFlags & DFE_Parity) {
-        switch (settings.Parity) {
-        case PAR_SPACE:
-            /*space parity not directly supported - add an extra data bit to simulate it*/
-            settingsDirtyFlags |= DFE_DataBits;
-            break;
-        case PAR_NONE:
-            currentTermios.c_cflag &= (~PARENB);
-            break;
-        case PAR_EVEN:
-            currentTermios.c_cflag &= (~PARODD);
-            currentTermios.c_cflag |= PARENB;
-            break;
-        case PAR_ODD:
-            currentTermios.c_cflag |= (PARENB|PARODD);
-            break;
-        }
-    }
-    /*must after Parity settings*/
-    if (settingsDirtyFlags & DFE_DataBits) {
-        if (settings.Parity != PAR_SPACE) {
-            currentTermios.c_cflag &= (~CSIZE);
-            switch(settings.DataBits) {
-            case DATA_5:
-                currentTermios.c_cflag |= CS5;
-                break;
-            case DATA_6:
-                currentTermios.c_cflag |= CS6;
-                break;
-            case DATA_7:
-                currentTermios.c_cflag |= CS7;
-                break;
-            case DATA_8:
-                currentTermios.c_cflag |= CS8;
-                break;
-            }
-        } else {
-            /*space parity not directly supported - add an extra data bit to simulate it*/
-            currentTermios.c_cflag &= ~(PARENB|CSIZE);
-            switch(settings.DataBits) {
-            case DATA_5:
-                currentTermios.c_cflag |= CS6;
-                break;
-            case DATA_6:
-                currentTermios.c_cflag |= CS7;
-                break;
-            case DATA_7:
-                currentTermios.c_cflag |= CS8;
-                break;
-            case DATA_8:
-                /*this will never happen, put here to Suppress an warning*/
-                break;
-            }
-        }
-    }
-    if (settingsDirtyFlags & DFE_StopBits) {
-        switch (settings.StopBits) {
-        case STOP_1:
-            currentTermios.c_cflag &= (~CSTOPB);
-            break;
-        case STOP_2:
-            currentTermios.c_cflag |= CSTOPB;
-            break;
-        }
-    }
-    if (settingsDirtyFlags & DFE_Flow) {
-        switch(settings.FlowControl) {
-        case FLOW_OFF:
-            currentTermios.c_cflag &= (~CRTSCTS);
-            currentTermios.c_iflag &= (~(IXON|IXOFF|IXANY));
-            break;
-        case FLOW_XONXOFF:
-            /*software (XON/XOFF) flow control*/
-            currentTermios.c_cflag &= (~CRTSCTS);
-            currentTermios.c_iflag |= (IXON|IXOFF|IXANY);
-            break;
-        case FLOW_HARDWARE:
-            currentTermios.c_cflag |= CRTSCTS;
-            currentTermios.c_iflag &= (~(IXON|IXOFF|IXANY));
-            break;
-        }
-    }
-
-    /*if any thing in currentTermios changed, flush*/
-    if (settingsDirtyFlags & DFE_Settings_Mask)
-        ::tcsetattr(fd, TCSAFLUSH, &currentTermios);
-
-    if (settingsDirtyFlags & DFE_TimeOut) {
-        int millisec = settings.Timeout_Millisec;
-        if (millisec == -1) {
-            ::fcntl(fd, F_SETFL, O_NDELAY);
-        }
-        else {
-            //O_SYNC should enable blocking ::write()
-            //however this seems not working on Linux 2.6.21 (works on OpenBSD 4.2)
-            ::fcntl(fd, F_SETFL, O_SYNC);
-        }
-        ::tcgetattr(fd, &currentTermios);
-        currentTermios.c_cc[VTIME] = millisec/100;
-        ::tcsetattr(fd, TCSAFLUSH, &currentTermios);
-    }
-
-    settingsDirtyFlags = 0;
-}
+/****************************************************************************
+** Copyright (c) 2000-2003 Wayne Roth
+** Copyright (c) 2004-2007 Stefan Sander
+** Copyright (c) 2007 Michal Policht
+** Copyright (c) 2008 Brandon Fosdick
+** Copyright (c) 2009-2010 Liam Staskawicz
+** Copyright (c) 2011 Debao Zhang
+** All right reserved.
+** Web: http://code.google.com/p/qextserialport/
+**
+** Permission is hereby granted, free of charge, to any person obtaining
+** a copy of this software and associated documentation files (the
+** "Software"), to deal in the Software without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Software, and to
+** permit persons to whom the Software is furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be
+** included in all copies or substantial portions of the Software.
+**
+** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+**
+****************************************************************************/
+
+#include "qextserialport.h"
+#include "qextserialport_p.h"
+#include <fcntl.h>
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/time.h>
+#include <sys/ioctl.h>
+#include <sys/select.h>
+#include <QtCore/QMutexLocker>
+#include <QtCore/QDebug>
+#include <QtCore/QSocketNotifier>
+
+void QextSerialPortPrivate::platformSpecificInit()
+{
+    fd = 0;
+    readNotifier = 0;
+}
+
+/*!
+    Standard destructor.
+*/
+void QextSerialPortPrivate::platformSpecificDestruct()
+{
+}
+
+static QString fullPortName(const QString &name)
+{
+    if (name.startsWith(QLatin1Char('/')))
+        return name;
+    return QLatin1String("/dev/")+name;
+}
+
+bool QextSerialPortPrivate::open_sys(QIODevice::OpenMode mode)
+{
+    Q_Q(QextSerialPort);
+    //note: linux 2.6.21 seems to ignore O_NDELAY flag
+    if ((fd = ::open(fullPortName(port).toLatin1() ,O_RDWR | O_NOCTTY | O_NDELAY)) != -1) {
+
+        /*In the Private class, We can not call QIODevice::open()*/
+        q->setOpenMode(mode);             // Flag the port as opened
+        ::tcgetattr(fd, &oldTermios);    // Save the old termios
+        currentTermios = oldTermios;   // Make a working copy
+        ::cfmakeraw(&currentTermios);   // Enable raw access
+
+        /*set up other port settings*/
+        currentTermios.c_cflag |= CREAD|CLOCAL;
+        currentTermios.c_lflag &= (~(ICANON|ECHO|ECHOE|ECHOK|ECHONL|ISIG));
+        currentTermios.c_iflag &= (~(INPCK|IGNPAR|PARMRK|ISTRIP|ICRNL|IXANY));
+        currentTermios.c_oflag &= (~OPOST);
+        currentTermios.c_cc[VMIN] = 0;
+#ifdef _POSIX_VDISABLE  // Is a disable character available on this system?
+        // Some systems allow for per-device disable-characters, so get the
+        //  proper value for the configured device
+        const long vdisable = ::fpathconf(fd, _PC_VDISABLE);
+        currentTermios.c_cc[VINTR] = vdisable;
+        currentTermios.c_cc[VQUIT] = vdisable;
+        currentTermios.c_cc[VSTART] = vdisable;
+        currentTermios.c_cc[VSTOP] = vdisable;
+        currentTermios.c_cc[VSUSP] = vdisable;
+#endif //_POSIX_VDISABLE
+        settingsDirtyFlags = DFE_ALL;
+        updatePortSettings();
+
+        if (queryMode == QextSerialPort::EventDriven) {
+            readNotifier = new QSocketNotifier(fd, QSocketNotifier::Read, q);
+            q->connect(readNotifier, SIGNAL(activated(int)), q, SLOT(_q_canRead()));
+        }
+        return true;
+    } else {
+        translateError(errno);
+        return false;
+    }
+}
+
+bool QextSerialPortPrivate::close_sys()
+{
+    // Force a flush and then restore the original termios
+    flush_sys();
+    // Using both TCSAFLUSH and TCSANOW here discards any pending input
+    ::tcsetattr(fd, TCSAFLUSH | TCSANOW, &oldTermios);   // Restore termios
+    ::close(fd);
+    if (readNotifier) {
+        delete readNotifier;
+        readNotifier = 0;
+    }
+    return true;
+}
+
+bool QextSerialPortPrivate::flush_sys()
+{
+    ::tcdrain(fd);
+    return true;
+}
+
+qint64 QextSerialPortPrivate::bytesAvailable_sys() const
+{
+    int bytesQueued;
+    if (::ioctl(fd, FIONREAD, &bytesQueued) == -1) {
+        return (qint64)-1;
+    }
+    return bytesQueued;
+}
+
+/*!
+    Translates a system-specific error code to a QextSerialPort error code.  Used internally.
+*/
+void QextSerialPortPrivate::translateError(ulong error)
+{
+    switch (error) {
+    case EBADF:
+    case ENOTTY:
+        lastErr = E_INVALID_FD;
+        break;
+    case EINTR:
+        lastErr = E_CAUGHT_NON_BLOCKED_SIGNAL;
+        break;
+    case ENOMEM:
+        lastErr = E_NO_MEMORY;
+        break;
+    case EACCES:
+        lastErr = E_PERMISSION_DENIED;
+        break;
+    case EAGAIN:
+        lastErr = E_AGAIN;
+        break;
+    }
+}
+
+void QextSerialPortPrivate::setDtr_sys(bool set)
+{
+    int status;
+    ::ioctl(fd, TIOCMGET, &status);
+    if (set)
+        status |= TIOCM_DTR;
+    else
+        status &= ~TIOCM_DTR;
+    ::ioctl(fd, TIOCMSET, &status);
+}
+
+void QextSerialPortPrivate::setRts_sys(bool set)
+{
+    int status;
+    ::ioctl(fd, TIOCMGET, &status);
+    if (set)
+        status |= TIOCM_RTS;
+    else
+        status &= ~TIOCM_RTS;
+    ::ioctl(fd, TIOCMSET, &status);
+}
+
+unsigned long QextSerialPortPrivate::lineStatus_sys()
+{
+    unsigned long Status=0, Temp=0;
+    ::ioctl(fd, TIOCMGET, &Temp);
+    if (Temp & TIOCM_CTS) Status |= LS_CTS;
+    if (Temp & TIOCM_DSR) Status |= LS_DSR;
+    if (Temp & TIOCM_RI) Status |= LS_RI;
+    if (Temp & TIOCM_CD) Status |= LS_DCD;
+    if (Temp & TIOCM_DTR) Status |= LS_DTR;
+    if (Temp & TIOCM_RTS) Status |= LS_RTS;
+    if (Temp & TIOCM_ST) Status |= LS_ST;
+    if (Temp & TIOCM_SR) Status |= LS_SR;
+    return Status;
+}
+
+/*!
+    Reads a block of data from the serial port.  This function will read at most maxSize bytes from
+    the serial port and place them in the buffer pointed to by data.  Return value is the number of
+    bytes actually read, or -1 on error.
+
+    \warning before calling this function ensure that serial port associated with this class
+    is currently open (use isOpen() function to check if port is open).
+*/
+qint64 QextSerialPortPrivate::readData_sys(char *data, qint64 maxSize)
+{
+    int retVal = ::read(fd, data, maxSize);
+    if (retVal == -1)
+        lastErr = E_READ_FAILED;
+
+    return retVal;
+}
+
+/*!
+    Writes a block of data to the serial port.  This function will write maxSize bytes
+    from the buffer pointed to by data to the serial port.  Return value is the number
+    of bytes actually written, or -1 on error.
+
+    \warning before calling this function ensure that serial port associated with this class
+    is currently open (use isOpen() function to check if port is open).
+*/
+qint64 QextSerialPortPrivate::writeData_sys(const char *data, qint64 maxSize)
+{
+    int retVal = ::write(fd, data, maxSize);
+    if (retVal == -1)
+        lastErr = E_WRITE_FAILED;
+
+    return (qint64)retVal;
+}
+
+static void setBaudRate2Termios(termios *config, int baudRate)
+{
+#ifdef CBAUD
+    config->c_cflag &= (~CBAUD);
+    config->c_cflag |= baudRate;
+#else
+    ::cfsetispeed(config, baudRate);
+    ::cfsetospeed(config, baudRate);
+#endif
+}
+
+/*
+    All the platform settings was performed in this function.
+*/
+void QextSerialPortPrivate::updatePortSettings()
+{
+    if (!q_func()->isOpen() || !settingsDirtyFlags)
+        return;
+
+    if (settingsDirtyFlags & DFE_BaudRate) {
+        switch (settings.BaudRate) {
+        case BAUD50:
+            setBaudRate2Termios(&currentTermios, B50);
+            break;
+        case BAUD75:
+            setBaudRate2Termios(&currentTermios, B75);
+            break;
+        case BAUD110:
+            setBaudRate2Termios(&currentTermios, B110);
+            break;
+        case BAUD134:
+            setBaudRate2Termios(&currentTermios, B134);
+            break;
+        case BAUD150:
+            setBaudRate2Termios(&currentTermios, B150);
+            break;
+        case BAUD200:
+            setBaudRate2Termios(&currentTermios, B200);
+            break;
+        case BAUD300:
+            setBaudRate2Termios(&currentTermios, B300);
+            break;
+        case BAUD600:
+            setBaudRate2Termios(&currentTermios, B600);
+            break;
+        case BAUD1200:
+            setBaudRate2Termios(&currentTermios, B1200);
+            break;
+        case BAUD1800:
+            setBaudRate2Termios(&currentTermios, B1800);
+            break;
+        case BAUD2400:
+            setBaudRate2Termios(&currentTermios, B2400);
+            break;
+        case BAUD4800:
+            setBaudRate2Termios(&currentTermios, B4800);
+            break;
+        case BAUD9600:
+            setBaudRate2Termios(&currentTermios, B9600);
+            break;
+        case BAUD19200:
+            setBaudRate2Termios(&currentTermios, B19200);
+            break;
+        case BAUD38400:
+            setBaudRate2Termios(&currentTermios, B38400);
+            break;
+        case BAUD57600:
+            setBaudRate2Termios(&currentTermios, B57600);
+            break;
+#ifdef B76800
+        case BAUD76800:
+            setBaudRate2Termios(&currentTermios, B76800);
+            break;
+#endif
+        case BAUD115200:
+            setBaudRate2Termios(&currentTermios, B115200);
+            break;
+#if defined(B230400) && defined(B4000000)
+        case BAUD230400:
+            setBaudRate2Termios(&currentTermios, B230400);
+            break;
+        case BAUD460800:
+            setBaudRate2Termios(&currentTermios, B460800);
+            break;
+        case BAUD500000:
+            setBaudRate2Termios(&currentTermios, B500000);
+            break;
+        case BAUD576000:
+            setBaudRate2Termios(&currentTermios, B576000);
+            break;
+        case BAUD921600:
+            setBaudRate2Termios(&currentTermios, B921600);
+            break;
+        case BAUD1000000:
+            setBaudRate2Termios(&currentTermios, B1000000);
+            break;
+        case BAUD1152000:
+            setBaudRate2Termios(&currentTermios, B1152000);
+            break;
+        case BAUD1500000:
+            setBaudRate2Termios(&currentTermios, B1500000);
+            break;
+        case BAUD2000000:
+            setBaudRate2Termios(&currentTermios, B2000000);
+            break;
+        case BAUD2500000:
+            setBaudRate2Termios(&currentTermios, B2500000);
+            break;
+        case BAUD3000000:
+            setBaudRate2Termios(&currentTermios, B3000000);
+            break;
+        case BAUD3500000:
+            setBaudRate2Termios(&currentTermios, B3500000);
+            break;
+        case BAUD4000000:
+            setBaudRate2Termios(&currentTermios, B4000000);
+            break;
+#endif
+#ifdef Q_OS_MAC
+        default:
+            setBaudRate2Termios(&currentTermios, settings.BaudRate);
+            break;
+#endif
+        }
+    }
+    if (settingsDirtyFlags & DFE_Parity) {
+        switch (settings.Parity) {
+        case PAR_SPACE:
+            /*space parity not directly supported - add an extra data bit to simulate it*/
+            settingsDirtyFlags |= DFE_DataBits;
+            break;
+        case PAR_NONE:
+            currentTermios.c_cflag &= (~PARENB);
+            break;
+        case PAR_EVEN:
+            currentTermios.c_cflag &= (~PARODD);
+            currentTermios.c_cflag |= PARENB;
+            break;
+        case PAR_ODD:
+            currentTermios.c_cflag |= (PARENB|PARODD);
+            break;
+        }
+    }
+    /*must after Parity settings*/
+    if (settingsDirtyFlags & DFE_DataBits) {
+        if (settings.Parity != PAR_SPACE) {
+            currentTermios.c_cflag &= (~CSIZE);
+            switch(settings.DataBits) {
+            case DATA_5:
+                currentTermios.c_cflag |= CS5;
+                break;
+            case DATA_6:
+                currentTermios.c_cflag |= CS6;
+                break;
+            case DATA_7:
+                currentTermios.c_cflag |= CS7;
+                break;
+            case DATA_8:
+                currentTermios.c_cflag |= CS8;
+                break;
+            }
+        } else {
+            /*space parity not directly supported - add an extra data bit to simulate it*/
+            currentTermios.c_cflag &= ~(PARENB|CSIZE);
+            switch(settings.DataBits) {
+            case DATA_5:
+                currentTermios.c_cflag |= CS6;
+                break;
+            case DATA_6:
+                currentTermios.c_cflag |= CS7;
+                break;
+            case DATA_7:
+                currentTermios.c_cflag |= CS8;
+                break;
+            case DATA_8:
+                /*this will never happen, put here to Suppress an warning*/
+                break;
+            }
+        }
+    }
+    if (settingsDirtyFlags & DFE_StopBits) {
+        switch (settings.StopBits) {
+        case STOP_1:
+            currentTermios.c_cflag &= (~CSTOPB);
+            break;
+        case STOP_2:
+            currentTermios.c_cflag |= CSTOPB;
+            break;
+        }
+    }
+    if (settingsDirtyFlags & DFE_Flow) {
+        switch(settings.FlowControl) {
+        case FLOW_OFF:
+            currentTermios.c_cflag &= (~CRTSCTS);
+            currentTermios.c_iflag &= (~(IXON|IXOFF|IXANY));
+            break;
+        case FLOW_XONXOFF:
+            /*software (XON/XOFF) flow control*/
+            currentTermios.c_cflag &= (~CRTSCTS);
+            currentTermios.c_iflag |= (IXON|IXOFF|IXANY);
+            break;
+        case FLOW_HARDWARE:
+            currentTermios.c_cflag |= CRTSCTS;
+            currentTermios.c_iflag &= (~(IXON|IXOFF|IXANY));
+            break;
+        }
+    }
+
+    /*if any thing in currentTermios changed, flush*/
+    if (settingsDirtyFlags & DFE_Settings_Mask)
+        ::tcsetattr(fd, TCSAFLUSH, &currentTermios);
+
+    if (settingsDirtyFlags & DFE_TimeOut) {
+        int millisec = settings.Timeout_Millisec;
+        if (millisec == -1) {
+            ::fcntl(fd, F_SETFL, O_NDELAY);
+        }
+        else {
+            //O_SYNC should enable blocking ::write()
+            //however this seems not working on Linux 2.6.21 (works on OpenBSD 4.2)
+            ::fcntl(fd, F_SETFL, O_SYNC);
+        }
+        ::tcgetattr(fd, &currentTermios);
+        currentTermios.c_cc[VTIME] = millisec/100;
+        ::tcsetattr(fd, TCSAFLUSH, &currentTermios);
+    }
+
+    settingsDirtyFlags = 0;
+}
diff --git a/interfaces/qextserialport/qextserialport_win.cpp b/interfaces/qextserialport/qextserialport_win.cpp
index 4dfd97a..5ece3c7 100644
--- a/interfaces/qextserialport/qextserialport_win.cpp
+++ b/interfaces/qextserialport/qextserialport_win.cpp
@@ -1,418 +1,418 @@
-/****************************************************************************
-** Copyright (c) 2000-2003 Wayne Roth
-** Copyright (c) 2004-2007 Stefan Sander
-** Copyright (c) 2007 Michal Policht
-** Copyright (c) 2008 Brandon Fosdick
-** Copyright (c) 2009-2010 Liam Staskawicz
-** Copyright (c) 2011 Debao Zhang
-** All right reserved.
-** Web: http://code.google.com/p/qextserialport/
-**
-** Permission is hereby granted, free of charge, to any person obtaining
-** a copy of this software and associated documentation files (the
-** "Software"), to deal in the Software without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Software, and to
-** permit persons to whom the Software is furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be
-** included in all copies or substantial portions of the Software.
-**
-** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-**
-****************************************************************************/
-
-#include "qextserialport.h"
-#include "qextserialport_p.h"
-#include <QtCore/QThread>
-#include <QtCore/QReadWriteLock>
-#include <QtCore/QMutexLocker>
-#include <QtCore/QDebug>
-#include <QtCore/QRegExp>
-#include <QtCore/QMetaType>
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
-#  include <QtCore/QWinEventNotifier>
-#else
-#  include <QtCore/private/qwineventnotifier_p.h>
-#endif
-void QextSerialPortPrivate::platformSpecificInit()
-{
-    handle = INVALID_HANDLE_VALUE;
-    ZeroMemory(&overlap, sizeof(OVERLAPPED));
-    overlap.hEvent = CreateEvent(NULL, true, false, NULL);
-    winEventNotifier = 0;
-    bytesToWriteLock = new QReadWriteLock;
-}
-
-void QextSerialPortPrivate::platformSpecificDestruct() {
-    CloseHandle(overlap.hEvent);
-    delete bytesToWriteLock;
-}
-
-
-/*!
-    \internal
-    COM ports greater than 9 need \\.\ prepended
-
-    This is only need when open the port.
-*/
-static QString fullPortNameWin(const QString &name)
-{
-    QRegExp rx(QLatin1String("^COM(\\d+)"));
-    QString fullName(name);
-    if (fullName.contains(rx))
-        fullName.prepend(QLatin1String("\\\\.\\"));
-    return fullName;
-}
-
-bool QextSerialPortPrivate::open_sys(QIODevice::OpenMode mode)
-{
-    Q_Q(QextSerialPort);
-    DWORD confSize = sizeof(COMMCONFIG);
-    commConfig.dwSize = confSize;
-    DWORD dwFlagsAndAttributes = 0;
-    if (queryMode == QextSerialPort::EventDriven)
-        dwFlagsAndAttributes += FILE_FLAG_OVERLAPPED;
-
-    /*open the port*/
-    handle = CreateFileW((wchar_t *)fullPortNameWin(port).utf16(), GENERIC_READ|GENERIC_WRITE,
-                           0, NULL, OPEN_EXISTING, dwFlagsAndAttributes, NULL);
-    if (handle != INVALID_HANDLE_VALUE) {
-        q->setOpenMode(mode);
-        /*configure port settings*/
-        GetCommConfig(handle, &commConfig, &confSize);
-        GetCommState(handle, &(commConfig.dcb));
-
-        /*set up parameters*/
-        commConfig.dcb.fBinary = TRUE;
-        commConfig.dcb.fInX = FALSE;
-        commConfig.dcb.fOutX = FALSE;
-        commConfig.dcb.fAbortOnError = FALSE;
-        commConfig.dcb.fNull = FALSE;
-        /* Dtr default to true. See Issue 122*/
-        commConfig.dcb.fDtrControl = TRUE;
-        /*flush all settings*/
-        settingsDirtyFlags = DFE_ALL;
-        updatePortSettings();
-
-        //init event driven approach
-        if (queryMode == QextSerialPort::EventDriven) {
-            if (!SetCommMask(handle, EV_TXEMPTY | EV_RXCHAR | EV_DSR)) {
-                QESP_WARNING()<<"failed to set Comm Mask. Error code:"<<GetLastError();
-                return false;
-            }
-            winEventNotifier = new QWinEventNotifier(overlap.hEvent, q);
-            qRegisterMetaType<HANDLE>("HANDLE");
-            q->connect(winEventNotifier, SIGNAL(activated(HANDLE)), q, SLOT(_q_onWinEvent(HANDLE)), Qt::DirectConnection);
-            WaitCommEvent(handle, &eventMask, &overlap);
-        }
-        return true;
-    }
-    return false;
-}
-
-bool QextSerialPortPrivate::close_sys()
-{
-    flush_sys();
-    CancelIo(handle);
-    if (CloseHandle(handle))
-        handle = INVALID_HANDLE_VALUE;
-    if (winEventNotifier) {
-        winEventNotifier->setEnabled(false);
-        winEventNotifier->deleteLater();
-        winEventNotifier = 0;
-    }
-
-    foreach (OVERLAPPED *o, pendingWrites) {
-        CloseHandle(o->hEvent);
-        delete o;
-    }
-    pendingWrites.clear();
-    return true;
-}
-
-bool QextSerialPortPrivate::flush_sys()
-{
-    FlushFileBuffers(handle);
-    return true;
-}
-
-qint64 QextSerialPortPrivate::bytesAvailable_sys() const
-{
-    DWORD Errors;
-    COMSTAT Status;
-    if (ClearCommError(handle, &Errors, &Status)) {
-        return Status.cbInQue;
-    }
-    return (qint64)-1;
-}
-
-/*
-    Translates a system-specific error code to a QextSerialPort error code.  Used internally.
-*/
-void QextSerialPortPrivate::translateError(ulong error)
-{
-    if (error & CE_BREAK) {
-        lastErr = E_BREAK_CONDITION;
-    }
-    else if (error & CE_FRAME) {
-        lastErr = E_FRAMING_ERROR;
-    }
-    else if (error & CE_IOE) {
-        lastErr = E_IO_ERROR;
-    }
-    else if (error & CE_MODE) {
-        lastErr = E_INVALID_FD;
-    }
-    else if (error & CE_OVERRUN) {
-        lastErr = E_BUFFER_OVERRUN;
-    }
-    else if (error & CE_RXPARITY) {
-        lastErr = E_RECEIVE_PARITY_ERROR;
-    }
-    else if (error & CE_RXOVER) {
-        lastErr = E_RECEIVE_OVERFLOW;
-    }
-    else if (error & CE_TXFULL) {
-        lastErr = E_TRANSMIT_OVERFLOW;
-    }
-}
-
-/*
-    Reads a block of data from the serial port.  This function will read at most maxlen bytes from
-    the serial port and place them in the buffer pointed to by data.  Return value is the number of
-    bytes actually read, or -1 on error.
-    
-    \warning before calling this function ensure that serial port associated with this class
-    is currently open (use isOpen() function to check if port is open).
-*/
-qint64 QextSerialPortPrivate::readData_sys(char *data, qint64 maxSize)
-{
-    DWORD bytesRead = 0;
-    bool failed = false;
-    if (queryMode == QextSerialPort::EventDriven) {
-        OVERLAPPED overlapRead;
-        ZeroMemory(&overlapRead, sizeof(OVERLAPPED));
-        if (!ReadFile(handle, (void *)data, (DWORD)maxSize, &bytesRead, &overlapRead)) {
-            if (GetLastError() == ERROR_IO_PENDING)
-                GetOverlappedResult(handle, &overlapRead, &bytesRead, true);
-            else
-                failed = true;
-        }
-    } else if (!ReadFile(handle, (void *)data, (DWORD)maxSize, &bytesRead, NULL)) {
-        failed = true;
-    }
-    if (!failed)
-        return (qint64)bytesRead;
-
-    lastErr = E_READ_FAILED;
-    return -1;
-}
-
-/*
-    Writes a block of data to the serial port.  This function will write len bytes
-    from the buffer pointed to by data to the serial port.  Return value is the number
-    of bytes actually written, or -1 on error.
-    
-    \warning before calling this function ensure that serial port associated with this class
-    is currently open (use isOpen() function to check if port is open).
-*/
-qint64 QextSerialPortPrivate::writeData_sys(const char *data, qint64 maxSize)
-{
-    DWORD bytesWritten = 0;
-    bool failed = false;
-    if (queryMode == QextSerialPort::EventDriven) {
-        OVERLAPPED *newOverlapWrite = new OVERLAPPED;
-        ZeroMemory(newOverlapWrite, sizeof(OVERLAPPED));
-        newOverlapWrite->hEvent = CreateEvent(NULL, true, false, NULL);
-        if (WriteFile(handle, (void *)data, (DWORD)maxSize, &bytesWritten, newOverlapWrite)) {
-            CloseHandle(newOverlapWrite->hEvent);
-            delete newOverlapWrite;
-        }
-        else if (GetLastError() == ERROR_IO_PENDING) {
-            // writing asynchronously...not an error
-            QWriteLocker writelocker(bytesToWriteLock);
-            pendingWrites.append(newOverlapWrite);
-        }
-        else {
-            QESP_WARNING()<<"QextSerialPort write error:"<<GetLastError();
-            failed = true;
-            if (!CancelIo(newOverlapWrite->hEvent))
-                QESP_WARNING("QextSerialPort: couldn't cancel IO");
-            if (!CloseHandle(newOverlapWrite->hEvent))
-                QESP_WARNING("QextSerialPort: couldn't close OVERLAPPED handle");
-            delete newOverlapWrite;
-        }
-    } else if (!WriteFile(handle, (void *)data, (DWORD)maxSize, &bytesWritten, NULL)) {
-        failed = true;
-    }
-
-    if (!failed)
-        return (qint64)bytesWritten;
-
-    lastErr = E_WRITE_FAILED;
-    return -1;
-}
-
-void QextSerialPortPrivate::setDtr_sys(bool set) {
-    EscapeCommFunction(handle, set ? SETDTR : CLRDTR);
-}
-
-void QextSerialPortPrivate::setRts_sys(bool set) {
-    EscapeCommFunction(handle, set ? SETRTS : CLRRTS);
-}
-
-ulong QextSerialPortPrivate::lineStatus_sys(void) {
-    unsigned long Status = 0, Temp = 0;
-    GetCommModemStatus(handle, &Temp);
-    if (Temp & MS_CTS_ON) Status |= LS_CTS;
-    if (Temp & MS_DSR_ON) Status |= LS_DSR;
-    if (Temp & MS_RING_ON) Status |= LS_RI;
-    if (Temp & MS_RLSD_ON) Status |= LS_DCD;
-    return Status;
-}
-
-/*
-  Triggered when there's activity on our HANDLE.
-*/
-void QextSerialPortPrivate::_q_onWinEvent(HANDLE h)
-{
-    Q_Q(QextSerialPort);
-    if (h == overlap.hEvent) {
-        if (eventMask & EV_RXCHAR) {
-            if (q->sender() != q && bytesAvailable_sys() > 0)
-                _q_canRead();
-        }
-        if (eventMask & EV_TXEMPTY) {
-            /*
-              A write completed.  Run through the list of OVERLAPPED writes, and if
-              they completed successfully, take them off the list and delete them.
-              Otherwise, leave them on there so they can finish.
-            */
-            qint64 totalBytesWritten = 0;
-            QList<OVERLAPPED *> overlapsToDelete;
-            foreach (OVERLAPPED *o, pendingWrites) {
-                DWORD numBytes = 0;
-                if (GetOverlappedResult(handle, o, &numBytes, false)) {
-                    overlapsToDelete.append(o);
-                    totalBytesWritten += numBytes;
-                } else if (GetLastError() != ERROR_IO_INCOMPLETE) {
-                    overlapsToDelete.append(o);
-                    QESP_WARNING()<<"CommEvent overlapped write error:" << GetLastError();
-                }
-            }
-
-            if (q->sender() != q && totalBytesWritten > 0) {
-                QWriteLocker writelocker(bytesToWriteLock);
-                Q_EMIT q->bytesWritten(totalBytesWritten);
-            }
-
-            foreach (OVERLAPPED *o, overlapsToDelete) {
-                OVERLAPPED *toDelete = pendingWrites.takeAt(pendingWrites.indexOf(o));
-                CloseHandle(toDelete->hEvent);
-                delete toDelete;
-            }
-        }
-        if (eventMask & EV_DSR) {
-            if (lineStatus_sys() & LS_DSR)
-                Q_EMIT q->dsrChanged(true);
-            else
-                Q_EMIT q->dsrChanged(false);
-        }
-    }
-    WaitCommEvent(handle, &eventMask, &overlap);
-}
-
-void QextSerialPortPrivate::updatePortSettings()
-{
-    if (!q_ptr->isOpen() || !settingsDirtyFlags)
-        return;
-
-    //fill struct : COMMCONFIG
-    if (settingsDirtyFlags & DFE_BaudRate) {
-        commConfig.dcb.BaudRate = settings.BaudRate;
-    }
-    if (settingsDirtyFlags & DFE_Parity) {
-        commConfig.dcb.Parity = (BYTE)settings.Parity;
-        commConfig.dcb.fParity = (settings.Parity == PAR_NONE) ? FALSE : TRUE;
-    }
-    if (settingsDirtyFlags & DFE_DataBits) {
-        commConfig.dcb.ByteSize = (BYTE)settings.DataBits;
-    }
-    if (settingsDirtyFlags & DFE_StopBits) {
-        switch (settings.StopBits) {
-        case STOP_1:
-            commConfig.dcb.StopBits = ONESTOPBIT;
-            break;
-        case STOP_1_5:
-            commConfig.dcb.StopBits = ONE5STOPBITS;
-            break;
-        case STOP_2:
-            commConfig.dcb.StopBits = TWOSTOPBITS;
-            break;
-        }
-    }
-    if (settingsDirtyFlags & DFE_Flow) {
-        switch(settings.FlowControl) {
-        /*no flow control*/
-        case FLOW_OFF:
-            commConfig.dcb.fOutxCtsFlow = FALSE;
-            commConfig.dcb.fRtsControl = RTS_CONTROL_DISABLE;
-            commConfig.dcb.fInX = FALSE;
-            commConfig.dcb.fOutX = FALSE;
-            break;
-        /*software (XON/XOFF) flow control*/
-        case FLOW_XONXOFF:
-            commConfig.dcb.fOutxCtsFlow = FALSE;
-            commConfig.dcb.fRtsControl = RTS_CONTROL_DISABLE;
-            commConfig.dcb.fInX = TRUE;
-            commConfig.dcb.fOutX = TRUE;
-            break;
-        /*hardware flow control*/
-        case FLOW_HARDWARE:
-            commConfig.dcb.fOutxCtsFlow = TRUE;
-            commConfig.dcb.fRtsControl = RTS_CONTROL_HANDSHAKE;
-            commConfig.dcb.fInX = FALSE;
-            commConfig.dcb.fOutX = FALSE;
-            break;
-        }
-    }
-
-    //fill struct : COMMTIMEOUTS
-    if (settingsDirtyFlags & DFE_TimeOut) {
-        if (queryMode != QextSerialPort::EventDriven) {
-            int millisec = settings.Timeout_Millisec;
-            if (millisec == -1) {
-                commTimeouts.ReadIntervalTimeout = MAXDWORD;
-                commTimeouts.ReadTotalTimeoutConstant = 0;
-            } else {
-                commTimeouts.ReadIntervalTimeout = millisec;
-                commTimeouts.ReadTotalTimeoutConstant = millisec;
-            }
-            commTimeouts.ReadTotalTimeoutMultiplier = 0;
-            commTimeouts.WriteTotalTimeoutMultiplier = millisec;
-            commTimeouts.WriteTotalTimeoutConstant = 0;
-        }
-        else {
-            commTimeouts.ReadIntervalTimeout = MAXDWORD;
-            commTimeouts.ReadTotalTimeoutMultiplier = 0;
-            commTimeouts.ReadTotalTimeoutConstant = 0;
-            commTimeouts.WriteTotalTimeoutMultiplier = 0;
-            commTimeouts.WriteTotalTimeoutConstant = 0;
-        }
-    }
-
-
-    if (settingsDirtyFlags & DFE_Settings_Mask)
-        SetCommConfig(handle, &commConfig, sizeof(COMMCONFIG));
-    if ((settingsDirtyFlags & DFE_TimeOut))
-        SetCommTimeouts(handle, &commTimeouts);
-    settingsDirtyFlags = 0;
-}
+/****************************************************************************
+** Copyright (c) 2000-2003 Wayne Roth
+** Copyright (c) 2004-2007 Stefan Sander
+** Copyright (c) 2007 Michal Policht
+** Copyright (c) 2008 Brandon Fosdick
+** Copyright (c) 2009-2010 Liam Staskawicz
+** Copyright (c) 2011 Debao Zhang
+** All right reserved.
+** Web: http://code.google.com/p/qextserialport/
+**
+** Permission is hereby granted, free of charge, to any person obtaining
+** a copy of this software and associated documentation files (the
+** "Software"), to deal in the Software without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Software, and to
+** permit persons to whom the Software is furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be
+** included in all copies or substantial portions of the Software.
+**
+** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+**
+****************************************************************************/
+
+#include "qextserialport.h"
+#include "qextserialport_p.h"
+#include <QtCore/QThread>
+#include <QtCore/QReadWriteLock>
+#include <QtCore/QMutexLocker>
+#include <QtCore/QDebug>
+#include <QtCore/QRegExp>
+#include <QtCore/QMetaType>
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#  include <QtCore/QWinEventNotifier>
+#else
+#  include <QtCore/private/qwineventnotifier_p.h>
+#endif
+void QextSerialPortPrivate::platformSpecificInit()
+{
+    handle = INVALID_HANDLE_VALUE;
+    ZeroMemory(&overlap, sizeof(OVERLAPPED));
+    overlap.hEvent = CreateEvent(NULL, true, false, NULL);
+    winEventNotifier = 0;
+    bytesToWriteLock = new QReadWriteLock;
+}
+
+void QextSerialPortPrivate::platformSpecificDestruct() {
+    CloseHandle(overlap.hEvent);
+    delete bytesToWriteLock;
+}
+
+
+/*!
+    \internal
+    COM ports greater than 9 need \\.\ prepended
+
+    This is only need when open the port.
+*/
+static QString fullPortNameWin(const QString &name)
+{
+    QRegExp rx(QLatin1String("^COM(\\d+)"));
+    QString fullName(name);
+    if (fullName.contains(rx))
+        fullName.prepend(QLatin1String("\\\\.\\"));
+    return fullName;
+}
+
+bool QextSerialPortPrivate::open_sys(QIODevice::OpenMode mode)
+{
+    Q_Q(QextSerialPort);
+    DWORD confSize = sizeof(COMMCONFIG);
+    commConfig.dwSize = confSize;
+    DWORD dwFlagsAndAttributes = 0;
+    if (queryMode == QextSerialPort::EventDriven)
+        dwFlagsAndAttributes += FILE_FLAG_OVERLAPPED;
+
+    /*open the port*/
+    handle = CreateFileW((wchar_t *)fullPortNameWin(port).utf16(), GENERIC_READ|GENERIC_WRITE,
+                           0, NULL, OPEN_EXISTING, dwFlagsAndAttributes, NULL);
+    if (handle != INVALID_HANDLE_VALUE) {
+        q->setOpenMode(mode);
+        /*configure port settings*/
+        GetCommConfig(handle, &commConfig, &confSize);
+        GetCommState(handle, &(commConfig.dcb));
+
+        /*set up parameters*/
+        commConfig.dcb.fBinary = TRUE;
+        commConfig.dcb.fInX = FALSE;
+        commConfig.dcb.fOutX = FALSE;
+        commConfig.dcb.fAbortOnError = FALSE;
+        commConfig.dcb.fNull = FALSE;
+        /* Dtr default to true. See Issue 122*/
+        commConfig.dcb.fDtrControl = TRUE;
+        /*flush all settings*/
+        settingsDirtyFlags = DFE_ALL;
+        updatePortSettings();
+
+        //init event driven approach
+        if (queryMode == QextSerialPort::EventDriven) {
+            if (!SetCommMask(handle, EV_TXEMPTY | EV_RXCHAR | EV_DSR)) {
+                QESP_WARNING()<<"failed to set Comm Mask. Error code:"<<GetLastError();
+                return false;
+            }
+            winEventNotifier = new QWinEventNotifier(overlap.hEvent, q);
+            qRegisterMetaType<HANDLE>("HANDLE");
+            q->connect(winEventNotifier, SIGNAL(activated(HANDLE)), q, SLOT(_q_onWinEvent(HANDLE)), Qt::DirectConnection);
+            WaitCommEvent(handle, &eventMask, &overlap);
+        }
+        return true;
+    }
+    return false;
+}
+
+bool QextSerialPortPrivate::close_sys()
+{
+    flush_sys();
+    CancelIo(handle);
+    if (CloseHandle(handle))
+        handle = INVALID_HANDLE_VALUE;
+    if (winEventNotifier) {
+        winEventNotifier->setEnabled(false);
+        winEventNotifier->deleteLater();
+        winEventNotifier = 0;
+    }
+
+    foreach (OVERLAPPED *o, pendingWrites) {
+        CloseHandle(o->hEvent);
+        delete o;
+    }
+    pendingWrites.clear();
+    return true;
+}
+
+bool QextSerialPortPrivate::flush_sys()
+{
+    FlushFileBuffers(handle);
+    return true;
+}
+
+qint64 QextSerialPortPrivate::bytesAvailable_sys() const
+{
+    DWORD Errors;
+    COMSTAT Status;
+    if (ClearCommError(handle, &Errors, &Status)) {
+        return Status.cbInQue;
+    }
+    return (qint64)-1;
+}
+
+/*
+    Translates a system-specific error code to a QextSerialPort error code.  Used internally.
+*/
+void QextSerialPortPrivate::translateError(ulong error)
+{
+    if (error & CE_BREAK) {
+        lastErr = E_BREAK_CONDITION;
+    }
+    else if (error & CE_FRAME) {
+        lastErr = E_FRAMING_ERROR;
+    }
+    else if (error & CE_IOE) {
+        lastErr = E_IO_ERROR;
+    }
+    else if (error & CE_MODE) {
+        lastErr = E_INVALID_FD;
+    }
+    else if (error & CE_OVERRUN) {
+        lastErr = E_BUFFER_OVERRUN;
+    }
+    else if (error & CE_RXPARITY) {
+        lastErr = E_RECEIVE_PARITY_ERROR;
+    }
+    else if (error & CE_RXOVER) {
+        lastErr = E_RECEIVE_OVERFLOW;
+    }
+    else if (error & CE_TXFULL) {
+        lastErr = E_TRANSMIT_OVERFLOW;
+    }
+}
+
+/*
+    Reads a block of data from the serial port.  This function will read at most maxlen bytes from
+    the serial port and place them in the buffer pointed to by data.  Return value is the number of
+    bytes actually read, or -1 on error.
+
+    \warning before calling this function ensure that serial port associated with this class
+    is currently open (use isOpen() function to check if port is open).
+*/
+qint64 QextSerialPortPrivate::readData_sys(char *data, qint64 maxSize)
+{
+    DWORD bytesRead = 0;
+    bool failed = false;
+    if (queryMode == QextSerialPort::EventDriven) {
+        OVERLAPPED overlapRead;
+        ZeroMemory(&overlapRead, sizeof(OVERLAPPED));
+        if (!ReadFile(handle, (void *)data, (DWORD)maxSize, &bytesRead, &overlapRead)) {
+            if (GetLastError() == ERROR_IO_PENDING)
+                GetOverlappedResult(handle, &overlapRead, &bytesRead, true);
+            else
+                failed = true;
+        }
+    } else if (!ReadFile(handle, (void *)data, (DWORD)maxSize, &bytesRead, NULL)) {
+        failed = true;
+    }
+    if (!failed)
+        return (qint64)bytesRead;
+
+    lastErr = E_READ_FAILED;
+    return -1;
+}
+
+/*
+    Writes a block of data to the serial port.  This function will write len bytes
+    from the buffer pointed to by data to the serial port.  Return value is the number
+    of bytes actually written, or -1 on error.
+
+    \warning before calling this function ensure that serial port associated with this class
+    is currently open (use isOpen() function to check if port is open).
+*/
+qint64 QextSerialPortPrivate::writeData_sys(const char *data, qint64 maxSize)
+{
+    DWORD bytesWritten = 0;
+    bool failed = false;
+    if (queryMode == QextSerialPort::EventDriven) {
+        OVERLAPPED *newOverlapWrite = new OVERLAPPED;
+        ZeroMemory(newOverlapWrite, sizeof(OVERLAPPED));
+        newOverlapWrite->hEvent = CreateEvent(NULL, true, false, NULL);
+        if (WriteFile(handle, (void *)data, (DWORD)maxSize, &bytesWritten, newOverlapWrite)) {
+            CloseHandle(newOverlapWrite->hEvent);
+            delete newOverlapWrite;
+        }
+        else if (GetLastError() == ERROR_IO_PENDING) {
+            // writing asynchronously...not an error
+            QWriteLocker writelocker(bytesToWriteLock);
+            pendingWrites.append(newOverlapWrite);
+        }
+        else {
+            QESP_WARNING()<<"QextSerialPort write error:"<<GetLastError();
+            failed = true;
+            if (!CancelIo(newOverlapWrite->hEvent))
+                QESP_WARNING("QextSerialPort: couldn't cancel IO");
+            if (!CloseHandle(newOverlapWrite->hEvent))
+                QESP_WARNING("QextSerialPort: couldn't close OVERLAPPED handle");
+            delete newOverlapWrite;
+        }
+    } else if (!WriteFile(handle, (void *)data, (DWORD)maxSize, &bytesWritten, NULL)) {
+        failed = true;
+    }
+
+    if (!failed)
+        return (qint64)bytesWritten;
+
+    lastErr = E_WRITE_FAILED;
+    return -1;
+}
+
+void QextSerialPortPrivate::setDtr_sys(bool set) {
+    EscapeCommFunction(handle, set ? SETDTR : CLRDTR);
+}
+
+void QextSerialPortPrivate::setRts_sys(bool set) {
+    EscapeCommFunction(handle, set ? SETRTS : CLRRTS);
+}
+
+ulong QextSerialPortPrivate::lineStatus_sys(void) {
+    unsigned long Status = 0, Temp = 0;
+    GetCommModemStatus(handle, &Temp);
+    if (Temp & MS_CTS_ON) Status |= LS_CTS;
+    if (Temp & MS_DSR_ON) Status |= LS_DSR;
+    if (Temp & MS_RING_ON) Status |= LS_RI;
+    if (Temp & MS_RLSD_ON) Status |= LS_DCD;
+    return Status;
+}
+
+/*
+  Triggered when there's activity on our HANDLE.
+*/
+void QextSerialPortPrivate::_q_onWinEvent(HANDLE h)
+{
+    Q_Q(QextSerialPort);
+    if (h == overlap.hEvent) {
+        if (eventMask & EV_RXCHAR) {
+            if (q->sender() != q && bytesAvailable_sys() > 0)
+                _q_canRead();
+        }
+        if (eventMask & EV_TXEMPTY) {
+            /*
+              A write completed.  Run through the list of OVERLAPPED writes, and if
+              they completed successfully, take them off the list and delete them.
+              Otherwise, leave them on there so they can finish.
+            */
+            qint64 totalBytesWritten = 0;
+            QList<OVERLAPPED *> overlapsToDelete;
+            foreach (OVERLAPPED *o, pendingWrites) {
+                DWORD numBytes = 0;
+                if (GetOverlappedResult(handle, o, &numBytes, false)) {
+                    overlapsToDelete.append(o);
+                    totalBytesWritten += numBytes;
+                } else if (GetLastError() != ERROR_IO_INCOMPLETE) {
+                    overlapsToDelete.append(o);
+                    QESP_WARNING()<<"CommEvent overlapped write error:" << GetLastError();
+                }
+            }
+
+            if (q->sender() != q && totalBytesWritten > 0) {
+                QWriteLocker writelocker(bytesToWriteLock);
+                Q_EMIT q->bytesWritten(totalBytesWritten);
+            }
+
+            foreach (OVERLAPPED *o, overlapsToDelete) {
+                OVERLAPPED *toDelete = pendingWrites.takeAt(pendingWrites.indexOf(o));
+                CloseHandle(toDelete->hEvent);
+                delete toDelete;
+            }
+        }
+        if (eventMask & EV_DSR) {
+            if (lineStatus_sys() & LS_DSR)
+                Q_EMIT q->dsrChanged(true);
+            else
+                Q_EMIT q->dsrChanged(false);
+        }
+    }
+    WaitCommEvent(handle, &eventMask, &overlap);
+}
+
+void QextSerialPortPrivate::updatePortSettings()
+{
+    if (!q_ptr->isOpen() || !settingsDirtyFlags)
+        return;
+
+    //fill struct : COMMCONFIG
+    if (settingsDirtyFlags & DFE_BaudRate) {
+        commConfig.dcb.BaudRate = settings.BaudRate;
+    }
+    if (settingsDirtyFlags & DFE_Parity) {
+        commConfig.dcb.Parity = (BYTE)settings.Parity;
+        commConfig.dcb.fParity = (settings.Parity == PAR_NONE) ? FALSE : TRUE;
+    }
+    if (settingsDirtyFlags & DFE_DataBits) {
+        commConfig.dcb.ByteSize = (BYTE)settings.DataBits;
+    }
+    if (settingsDirtyFlags & DFE_StopBits) {
+        switch (settings.StopBits) {
+        case STOP_1:
+            commConfig.dcb.StopBits = ONESTOPBIT;
+            break;
+        case STOP_1_5:
+            commConfig.dcb.StopBits = ONE5STOPBITS;
+            break;
+        case STOP_2:
+            commConfig.dcb.StopBits = TWOSTOPBITS;
+            break;
+        }
+    }
+    if (settingsDirtyFlags & DFE_Flow) {
+        switch(settings.FlowControl) {
+        /*no flow control*/
+        case FLOW_OFF:
+            commConfig.dcb.fOutxCtsFlow = FALSE;
+            commConfig.dcb.fRtsControl = RTS_CONTROL_DISABLE;
+            commConfig.dcb.fInX = FALSE;
+            commConfig.dcb.fOutX = FALSE;
+            break;
+        /*software (XON/XOFF) flow control*/
+        case FLOW_XONXOFF:
+            commConfig.dcb.fOutxCtsFlow = FALSE;
+            commConfig.dcb.fRtsControl = RTS_CONTROL_DISABLE;
+            commConfig.dcb.fInX = TRUE;
+            commConfig.dcb.fOutX = TRUE;
+            break;
+        /*hardware flow control*/
+        case FLOW_HARDWARE:
+            commConfig.dcb.fOutxCtsFlow = TRUE;
+            commConfig.dcb.fRtsControl = RTS_CONTROL_HANDSHAKE;
+            commConfig.dcb.fInX = FALSE;
+            commConfig.dcb.fOutX = FALSE;
+            break;
+        }
+    }
+
+    //fill struct : COMMTIMEOUTS
+    if (settingsDirtyFlags & DFE_TimeOut) {
+        if (queryMode != QextSerialPort::EventDriven) {
+            int millisec = settings.Timeout_Millisec;
+            if (millisec == -1) {
+                commTimeouts.ReadIntervalTimeout = MAXDWORD;
+                commTimeouts.ReadTotalTimeoutConstant = 0;
+            } else {
+                commTimeouts.ReadIntervalTimeout = millisec;
+                commTimeouts.ReadTotalTimeoutConstant = millisec;
+            }
+            commTimeouts.ReadTotalTimeoutMultiplier = 0;
+            commTimeouts.WriteTotalTimeoutMultiplier = millisec;
+            commTimeouts.WriteTotalTimeoutConstant = 0;
+        }
+        else {
+            commTimeouts.ReadIntervalTimeout = MAXDWORD;
+            commTimeouts.ReadTotalTimeoutMultiplier = 0;
+            commTimeouts.ReadTotalTimeoutConstant = 0;
+            commTimeouts.WriteTotalTimeoutMultiplier = 0;
+            commTimeouts.WriteTotalTimeoutConstant = 0;
+        }
+    }
+
+
+    if (settingsDirtyFlags & DFE_Settings_Mask)
+        SetCommConfig(handle, &commConfig, sizeof(COMMCONFIG));
+    if ((settingsDirtyFlags & DFE_TimeOut))
+        SetCommTimeouts(handle, &commTimeouts);
+    settingsDirtyFlags = 0;
+}
diff --git a/interfaces/qwebsockets/LICENSE b/interfaces/qwebsockets/LICENSE
old mode 100755
new mode 100644
diff --git a/interfaces/qwebsockets/README.md b/interfaces/qwebsockets/README.md
old mode 100755
new mode 100644
diff --git a/interfaces/qwebsockets/dataprocessor.cpp b/interfaces/qwebsockets/dataprocessor.cpp
old mode 100755
new mode 100644
diff --git a/interfaces/qwebsockets/dataprocessor.h b/interfaces/qwebsockets/dataprocessor.h
old mode 100755
new mode 100644
diff --git a/interfaces/qwebsockets/handshakerequest.cpp b/interfaces/qwebsockets/handshakerequest.cpp
old mode 100755
new mode 100644
diff --git a/interfaces/qwebsockets/handshakerequest.h b/interfaces/qwebsockets/handshakerequest.h
old mode 100755
new mode 100644
diff --git a/interfaces/qwebsockets/handshakeresponse.cpp b/interfaces/qwebsockets/handshakeresponse.cpp
old mode 100755
new mode 100644
diff --git a/interfaces/qwebsockets/handshakeresponse.h b/interfaces/qwebsockets/handshakeresponse.h
old mode 100755
new mode 100644
diff --git a/interfaces/qwebsockets/websocket.cpp b/interfaces/qwebsockets/websocket.cpp
old mode 100755
new mode 100644
diff --git a/interfaces/qwebsockets/websocket.h b/interfaces/qwebsockets/websocket.h
old mode 100755
new mode 100644
diff --git a/interfaces/qwebsockets/websocketprotocol.cpp b/interfaces/qwebsockets/websocketprotocol.cpp
old mode 100755
new mode 100644
diff --git a/interfaces/qwebsockets/websocketprotocol.h b/interfaces/qwebsockets/websocketprotocol.h
old mode 100755
new mode 100644
diff --git a/interfaces/qwebsockets/websocketserver.cpp b/interfaces/qwebsockets/websocketserver.cpp
old mode 100755
new mode 100644
diff --git a/interfaces/qwebsockets/websocketserver.h b/interfaces/qwebsockets/websocketserver.h
old mode 100755
new mode 100644
diff --git a/interfaces/zeroconf/bonjourrecord.h b/interfaces/zeroconf/bonjourrecord.h
old mode 100755
new mode 100644
diff --git a/interfaces/zeroconf/bonjourservicebrowser.cpp b/interfaces/zeroconf/bonjourservicebrowser.cpp
old mode 100755
new mode 100644
diff --git a/interfaces/zeroconf/bonjourservicebrowser.h b/interfaces/zeroconf/bonjourservicebrowser.h
old mode 100755
new mode 100644
diff --git a/interfaces/zeroconf/bonjourserviceregister.cpp b/interfaces/zeroconf/bonjourserviceregister.cpp
old mode 100755
new mode 100644
diff --git a/interfaces/zeroconf/bonjourserviceregister.h b/interfaces/zeroconf/bonjourserviceregister.h
old mode 100755
new mode 100644
diff --git a/interfaces/zeroconf/bonjourserviceresolver.cpp b/interfaces/zeroconf/bonjourserviceresolver.cpp
old mode 100755
new mode 100644
diff --git a/interfaces/zeroconf/bonjourserviceresolver.h b/interfaces/zeroconf/bonjourserviceresolver.h
old mode 100755
new mode 100644
diff --git a/items/uicoloritem.cpp b/items/uicoloritem.cpp
index 3869e6a..98977d1 100644
--- a/items/uicoloritem.cpp
+++ b/items/uicoloritem.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/items/uicoloritem.h b/items/uicoloritem.h
index c2709eb..ba1697a 100644
--- a/items/uicoloritem.h
+++ b/items/uicoloritem.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/items/uifileitem.cpp b/items/uifileitem.cpp
index 03a78ed..3e10436 100644
--- a/items/uifileitem.cpp
+++ b/items/uifileitem.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/items/uifileitem.h b/items/uifileitem.h
index d0c8a1f..42e0ab8 100644
--- a/items/uifileitem.h
+++ b/items/uifileitem.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/items/uipathpointsitem.cpp b/items/uipathpointsitem.cpp
index 16a0049..f1c9024 100644
--- a/items/uipathpointsitem.cpp
+++ b/items/uipathpointsitem.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/items/uipathpointsitem.h b/items/uipathpointsitem.h
index c46d740..af0ed82 100644
--- a/items/uipathpointsitem.h
+++ b/items/uipathpointsitem.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/items/uitextureitem.cpp b/items/uitextureitem.cpp
index badcc87..7e0653c 100644
--- a/items/uitextureitem.cpp
+++ b/items/uitextureitem.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/items/uitextureitem.h b/items/uitextureitem.h
index fb2f920..c9a3c85 100644
--- a/items/uitextureitem.h
+++ b/items/uitextureitem.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/items/uitreedelegate.cpp b/items/uitreedelegate.cpp
index 3e8f238..1717a94 100644
--- a/items/uitreedelegate.cpp
+++ b/items/uitreedelegate.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/items/uitreedelegate.h b/items/uitreedelegate.h
index 05ff2e1..7a422be 100644
--- a/items/uitreedelegate.h
+++ b/items/uitreedelegate.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/items/uitreeview.cpp b/items/uitreeview.cpp
index 15ab4bf..2f3cdb7 100644
--- a/items/uitreeview.cpp
+++ b/items/uitreeview.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/items/uitreeview.h b/items/uitreeview.h
index 86ae812..1abc44b 100644
--- a/items/uitreeview.h
+++ b/items/uitreeview.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/items/uitreeviewwidget.cpp b/items/uitreeviewwidget.cpp
index c2d52c4..58fdfd9 100644
--- a/items/uitreeviewwidget.cpp
+++ b/items/uitreeviewwidget.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/items/uitreeviewwidget.h b/items/uitreeviewwidget.h
index 1bbe500..a60407d 100644
--- a/items/uitreeviewwidget.h
+++ b/items/uitreeviewwidget.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/messages/message.cpp b/messages/message.cpp
index ceeb222..d6a1e58 100644
--- a/messages/message.cpp
+++ b/messages/message.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/messages/message.h b/messages/message.h
index 3aefb29..49f7c17 100644
--- a/messages/message.h
+++ b/messages/message.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/messages/messagemanager.cpp b/messages/messagemanager.cpp
index 0d2aa99..f2ce917 100644
--- a/messages/messagemanager.cpp
+++ b/messages/messagemanager.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/messages/messagemanager.h b/messages/messagemanager.h
index da9bd2b..9f3d7d4 100644
--- a/messages/messagemanager.h
+++ b/messages/messagemanager.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/messages/messagemanagerlog.cpp b/messages/messagemanagerlog.cpp
index a8dd93e..8f80c7e 100644
--- a/messages/messagemanagerlog.cpp
+++ b/messages/messagemanagerlog.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/messages/messagemanagerlog.h b/messages/messagemanagerlog.h
index 5af40ef..49addef 100644
--- a/messages/messagemanagerlog.h
+++ b/messages/messagemanagerlog.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/messages/messagemanagerloginterface.h b/messages/messagemanagerloginterface.h
index 32f8157..49be519 100644
--- a/messages/messagemanagerloginterface.h
+++ b/messages/messagemanagerloginterface.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/messages/messagemanagerlogmini.cpp b/messages/messagemanagerlogmini.cpp
index d4faedf..e3701f5 100644
--- a/messages/messagemanagerlogmini.cpp
+++ b/messages/messagemanagerlogmini.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/messages/messagemanagerlogmini.h b/messages/messagemanagerlogmini.h
index 791f480..5e64462 100644
--- a/messages/messagemanagerlogmini.h
+++ b/messages/messagemanagerlogmini.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/misc/application.cpp b/misc/application.cpp
index 35e2935..aa2c04d 100644
--- a/misc/application.cpp
+++ b/misc/application.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/misc/application.h b/misc/application.h
index 725d7d1..3b23dcb 100644
--- a/misc/application.h
+++ b/misc/application.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
@@ -85,8 +85,8 @@ public slots:
 };
 
 #ifdef QT5
-//#define USE_OPENGLWIDGET
-#define USE_GLWIDGET
+#define USE_OPENGLWIDGET
+//#define USE_GLWIDGET
 #else
 #define USE_GLWIDGET
 #endif
diff --git a/misc/applicationexecute.cpp b/misc/applicationexecute.cpp
index 4a1708c..510730e 100644
--- a/misc/applicationexecute.cpp
+++ b/misc/applicationexecute.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/misc/applicationexecute.h b/misc/applicationexecute.h
index 3decff7..6a92954 100644
--- a/misc/applicationexecute.h
+++ b/misc/applicationexecute.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/misc/help.cpp b/misc/help.cpp
index f71e842..e944024 100644
--- a/misc/help.cpp
+++ b/misc/help.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/misc/help.h b/misc/help.h
index e6d5468..c1729a8 100644
--- a/misc/help.h
+++ b/misc/help.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/misc/options.cpp b/misc/options.cpp
index 7d6eaf2..2109ee8 100644
--- a/misc/options.cpp
+++ b/misc/options.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/misc/options.h b/misc/options.h
index 8cb6900..298a71f 100644
--- a/misc/options.h
+++ b/misc/options.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/objects/nxcursor.cpp b/objects/nxcursor.cpp
index e921b6f..a15d7ca 100644
--- a/objects/nxcursor.cpp
+++ b/objects/nxcursor.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
@@ -30,6 +30,7 @@ NxCursor::NxCursor(ApplicationCurrent *parent, QTreeWidgetItem *ccParentItem) :
     curve = 0;
     nextTimeOld = 0;
     timeOld = 0;
+    fire = 2;
     time = 0;
     timeLocal = 0;
     timeLocalOld = 0;
@@ -290,10 +291,10 @@ void NxCursor::paint() {
         else if(Render::colors->contains(colorInactive))                                                                color = Render::colors->value(colorInactive);
         else                                                                                                            color = Qt::gray;
     }
-    color.setRgb (qBound(0., color.red()   * colorMultiplyColor.redF(),   255.),
-                  qBound(0., color.green() * colorMultiplyColor.greenF(), 255.),
-                  qBound(0., color.blue()  * colorMultiplyColor.blueF(),  255.),
-                  qBound(0., color.alpha() * colorMultiplyColor.alphaF(), 255.));
+    color.setRgb (qBound(qreal(0.), color.red()   * colorMultiplyColor.redF(),   qreal(255.)),
+                  qBound(qreal(0.), color.green() * colorMultiplyColor.greenF(), qreal(255.)),
+                  qBound(qreal(0.), color.blue()  * colorMultiplyColor.blueF(),  qreal(255.)),
+                  qBound(qreal(0.), color.alpha() * colorMultiplyColor.alphaF(), qreal(255.)));
 
     if(color.alpha() > 0) {
         //Mouse hover
@@ -408,7 +409,7 @@ void NxCursor::paint() {
                 glRotatef(cursorAngle.z(), 0, 0, 1);
                 glRotatef(cursorAngle.y(), 0, 1, 0);
                 glRotatef(cursorAngle.x(), 1, 0, 0);
-                qreal size2 = Render::objectSize / 2 * qMin(1., width);
+                qreal size2 = Render::objectSize / 2 * qMin(qreal(1.), width);
                 glBegin(GL_TRIANGLE_FAN);
                 glLineWidth(2);
                 if(hasActivity) {
diff --git a/objects/nxcursor.h b/objects/nxcursor.h
index 34a13cf..ce3225d 100644
--- a/objects/nxcursor.h
+++ b/objects/nxcursor.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
@@ -30,6 +30,10 @@
 #include "objects/nxcurve.h"
 #include "objects/nxtrigger.h"
 
+#define CURSOR_FIRE_NONE  0
+#define CURSOR_FIRE_GROUP 1
+#define CURSOR_FIRE_ALL   2
+
 #ifndef M_PI
 #define M_PI    (3.14159265358979323846)
 #endif
@@ -51,6 +55,7 @@ class NxCursor : public NxObject, public NxCursorAbstraction {
     Q_PROPERTY(qreal   setdepth             READ getDepth              WRITE setDepth)
     Q_PROPERTY(qreal   settime              READ getTimeLocal          WRITE setTimeLocal)
     Q_PROPERTY(qreal   settimepercent       READ getTimeLocalPercent   WRITE setTimeLocalPercent)
+    Q_PROPERTY(QString setfire              READ getFire               WRITE setFire)
     Q_PROPERTY(bool    trig                 READ getForceTrig          WRITE setForceTrig)
     Q_PROPERTY(QString settextureactive   READ getTextureActive   WRITE setTextureActive)
     Q_PROPERTY(QString settextureinactive READ getTextureInactive WRITE setTextureInactive)
@@ -71,6 +76,7 @@ private:
     NxEasing easing;
     qreal timeFactor, timeFactorF;
     quint16 nbLoop, nbLoopOld;
+    quint8 fire;
     qreal width, depth;
     NxRect boundsSource, boundsTarget;
     bool previousCursorReliable, previousPreviousCursorReliable;
@@ -244,6 +250,20 @@ public:
         return easing.getType();
     }
 
+    inline void setFire(const QString _fire) {
+        if     (_fire == "none")     fire = CURSOR_FIRE_NONE;
+        else if(_fire == "group")    fire = CURSOR_FIRE_GROUP;
+        else if(_fire == "all")      fire = CURSOR_FIRE_ALL;
+    }
+    inline const QString getFire() const {
+        if     (fire == CURSOR_FIRE_NONE)  return "none";
+        else if(fire == CURSOR_FIRE_GROUP)  return "group";
+        return "all";
+    }
+    inline quint8 getFireValue() const {
+        return fire;
+    }
+
     inline void setTimeStartOffset(qreal _timeStartOffset) {
         timeStartOffset = _timeStartOffset;
         setTime(0);
diff --git a/objects/nxcurve.cpp b/objects/nxcurve.cpp
index e0bac2b..43e8507 100644
--- a/objects/nxcurve.cpp
+++ b/objects/nxcurve.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
@@ -22,6 +22,11 @@
 */
 
 #include "nxcurve.h"
+#ifdef Q_OS_WIN
+    #define MUSTR(a) QString(a).toStdWString()
+#else
+    #define MUSTR(a) QString(a).toStdString()
+#endif
 
 Q_CORE_EXPORT double qstrtod(const char *s00, char const **se, bool *ok);
 
@@ -67,21 +72,21 @@ void NxCurve::setEquation(const QString &type, const QString &_equation) {
         curveType = CurveTypeEquationCartesian;
 
     try {
-        equationParser.DefineConst("PI",         M_PI);
-        equationParser.DefineConst("TWO_PI",     M_PI*2.);
-        equationParser.DefineConst("THIRD_PI",   M_PI/3.);
-        equationParser.DefineConst("QUARTER_PI", M_PI/4.);
-        equationParser.DefineConst("HALF_PI",    M_PI/2.);
-        equationParser.DefineConst("SQRT1_2",    M_SQRT1_2);
-        equationParser.DefineConst("SQRT2",      M_SQRT2);
-        equationParser.DefineConst("E",          M_E);
-        equationParser.DefineConst("LN2",        M_LN2);
-        equationParser.DefineConst("LN10",       M_LN10);
-        equationParser.DefineConst("LOG2E",      M_LOG2E);
-        equationParser.DefineConst("LOG10E",     M_LOG10E);
-
-        equationParser.DefineVar("t", &equationVariableT);
-        equationParser.SetExpr(qPrintable(equation));
+        equationParser.DefineConst(MUSTR("PI"),         M_PI);
+        equationParser.DefineConst(MUSTR("TWO_PI"),     M_PI*2.);
+        equationParser.DefineConst(MUSTR("THIRD_PI"),   M_PI/3.);
+        equationParser.DefineConst(MUSTR("QUARTER_PI"), M_PI/4.);
+        equationParser.DefineConst(MUSTR("HALF_PI"),    M_PI/2.);
+        equationParser.DefineConst(MUSTR("SQRT1_2"),    M_SQRT1_2);
+        equationParser.DefineConst(MUSTR("SQRT2"),      M_SQRT2);
+        equationParser.DefineConst(MUSTR("E"),          M_E);
+        equationParser.DefineConst(MUSTR("LN2"),        M_LN2);
+        equationParser.DefineConst(MUSTR("LN10"),       M_LN10);
+        equationParser.DefineConst(MUSTR("LOG2E"),      M_LOG2E);
+        equationParser.DefineConst(MUSTR("LOG10E"),     M_LOG10E);
+
+        equationParser.DefineVar(MUSTR("t"), &equationVariableT);
+        equationParser.SetExpr(MUSTR(equation));
         curveNeedUpdate = true;
         //calcEquation();
         //calcBoundingRect();
@@ -102,7 +107,7 @@ void NxCurve::setEquationParam(const QString &param, qreal value) {
     if(!equationVariables.contains(param)) {
         equationVariables.insert(param, value);
         try {
-            equationParser.DefineVar(qPrintable(param), &equationVariables[param]);
+            equationParser.DefineVar(MUSTR(param), &equationVariables[param]);
         }
         catch (Parser::exception_type &e) {
             qDebug("[MathParser] Param error");
@@ -127,7 +132,11 @@ void NxCurve::calcEquation() {
             }
         }
         catch (Parser::exception_type &e) {
-            qDebug("[MathParser] Curve #%d Calculation error (%ld), %s\n%s", id, e.GetPos(), qPrintable(QString::fromStdString(e.GetMsg())), qPrintable(QString::fromStdString(e.GetExpr())));
+#ifdef Q_OS_WIN
+            qDebug("[MathParser] Curve #%d Calculation error (%d), %s\n%s", id, e.GetPos(), qPrintable(QString::fromStdWString(e.GetMsg())), qPrintable(QString::fromStdWString(e.GetExpr())));
+#else
+            qDebug("[MathParser] Curve #%d Calculation error (%d), %s\n%s", id, e.GetPos(), qPrintable(QString::fromStdString(e.GetMsg())), qPrintable(QString::fromStdString(e.GetExpr())));
+#endif
         }
     }
 }
@@ -155,10 +164,10 @@ void NxCurve::paint() {
         else if(Render::colors->contains(colorInactive))                                                                color = Render::colors->value(colorInactive);
         else                                                                                                            color = Qt::gray;
     }
-    color.setRgb (qBound(0., color.red()   * colorMultiplyColor.redF(),   255.),
-                  qBound(0., color.green() * colorMultiplyColor.greenF(), 255.),
-                  qBound(0., color.blue()  * colorMultiplyColor.blueF(),  255.),
-                  qBound(0., color.alpha() * colorMultiplyColor.alphaF(), 255.));
+    color.setRgb (qBound(qreal(0.), color.red()   * colorMultiplyColor.redF(),   qreal(255.)),
+                  qBound(qreal(0.), color.green() * colorMultiplyColor.greenF(), qreal(255.)),
+                  qBound(qreal(0.), color.blue()  * colorMultiplyColor.blueF(),  qreal(255.)),
+                  qBound(qreal(0.), color.alpha() * colorMultiplyColor.alphaF(), qreal(255.)));
 
     if(color.alpha() > 0) {
         //Mouse hover
diff --git a/objects/nxcurve.h b/objects/nxcurve.h
index 2bf4979..e5f262f 100644
--- a/objects/nxcurve.h
+++ b/objects/nxcurve.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
@@ -386,7 +386,7 @@ public:
         if(valItems.count() > 1)
             setEllipse(NxSize(valItems.at(0).toDouble(), valItems.at(1).toDouble()));
     }
-    const QString getEllipseStr() const {
+    const QString getEllipseStr() {
         return QString("%1 %2").arg(getResize().width()/2).arg(getResize().height()/2);
     }
 
@@ -431,10 +431,12 @@ public:
         if(sizeItems.count() > 1)
             setResize(NxSize(sizeItems.at(0).toDouble(), sizeItems.at(1).toDouble()));
     }
-    inline const NxSize getResize() const {
+    inline const NxSize getResize() {
+        calcBoundingRect();
         return boundingRect.size();
     }
-    inline QString getResizeStr() const {
+    inline QString getResizeStr() {
+        calcBoundingRect();
         return QString("%1 %2").arg(boundingRect.size().width()).arg(boundingRect.size().height());
     }
     inline void setResizeF(qreal sizeF) {
diff --git a/objects/nxdocument.cpp b/objects/nxdocument.cpp
index 237799b..07a5c8c 100644
--- a/objects/nxdocument.cpp
+++ b/objects/nxdocument.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
@@ -337,8 +337,8 @@ void NxDocument::restoreDefaults() {
     Render::defaultColors.insert("darktheme_simple_curve_active"    , QColor(115, 159,  89, 255));
     Render::defaultColors.insert("darktheme_simple_curve_inactive"  , QColor(115, 159,  89, 255));
     Render::defaultColors.insert("lighttheme_background"            , QColor(242, 241, 237, 255));
-    Render::defaultColors.insert("lighttheme_grid"                  , QColor(  0,   0,   0,  20));
-    Render::defaultColors.insert("lighttheme_axis"                  , QColor(  0,   0,   0,  13));
+    Render::defaultColors.insert("lighttheme_grid"                  , QColor(  0,   0,   0,  64));
+    Render::defaultColors.insert("lighttheme_axis"                  , QColor(  0,   0,   0,  64));
     Render::defaultColors.insert("lighttheme_gui_gridSnap"          , QColor(255, 190, 190, 255));
     Render::defaultColors.insert("lighttheme_gui_axisSnap"          , QColor(255, 190, 190, 255));
     Render::defaultColors.insert("lighttheme_gui_selection"         , QColor(  0,   0,   0,  40));
diff --git a/objects/nxdocument.h b/objects/nxdocument.h
index 6e115fb..db03a60 100644
--- a/objects/nxdocument.h
+++ b/objects/nxdocument.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/objects/nxgroup.cpp b/objects/nxgroup.cpp
index 17b6c5b..18984b2 100644
--- a/objects/nxgroup.cpp
+++ b/objects/nxgroup.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/objects/nxgroup.h b/objects/nxgroup.h
index c567092..d4bb852 100644
--- a/objects/nxgroup.h
+++ b/objects/nxgroup.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/objects/nxobject.cpp b/objects/nxobject.cpp
index c09d29f..70f5382 100644
--- a/objects/nxobject.cpp
+++ b/objects/nxobject.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/objects/nxobject.h b/objects/nxobject.h
index 7fd6758..98ac9f9 100644
--- a/objects/nxobject.h
+++ b/objects/nxobject.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/objects/nxtrigger.cpp b/objects/nxtrigger.cpp
index ec27357..e8c3a74 100644
--- a/objects/nxtrigger.cpp
+++ b/objects/nxtrigger.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
@@ -61,10 +61,10 @@ void NxTrigger::paint() {
         else if(Render::colors->contains(colorInactive))                                                                color = Render::colors->value(colorInactive);
         else                                                                                                            color = Qt::gray;
     }
-    color.setRgb (qBound(0., color.red()   * colorMultiplyColor.redF(),   255.),
-                  qBound(0., color.green() * colorMultiplyColor.greenF(), 255.),
-                  qBound(0., color.blue()  * colorMultiplyColor.blueF(),  255.),
-                  qBound(0., color.alpha() * colorMultiplyColor.alphaF(), 255.));
+    color.setRgb (qBound(qreal(0.), color.red()   * colorMultiplyColor.redF(),   qreal(255.)),
+                  qBound(qreal(0.), color.green() * colorMultiplyColor.greenF(), qreal(255.)),
+                  qBound(qreal(0.), color.blue()  * colorMultiplyColor.blueF(),  qreal(255.)),
+                  qBound(qreal(0.), color.alpha() * colorMultiplyColor.alphaF(), qreal(255.)));
 
     //Size of trigger
     if(cacheSize != Render::objectSize*size) {
@@ -179,8 +179,9 @@ void NxTrigger::trig(NxObject *cursor) {
     else                trigEnd();
 }
 void NxTrigger::trigEnd() {
+    NxObject *cursorTriggedTmp = cursorTrigged;
+    cursorTrigged = 0;
     if(triggerOff > 0) {
-        NxObject *cursorTriggedTmp = cursorTrigged;
         bool sendMessage = false;
         foreach(const QVector<QByteArray> & messagePattern, this->getMessagePatterns()) {
             foreach(const QByteArray &messageArgument, messagePattern) {
@@ -191,5 +192,4 @@ void NxTrigger::trigEnd() {
         if(sendMessage)
             MessageManager::outgoingMessage(MessageManagerDestination(this, this, cursorTriggedTmp));
     }
-    cursorTrigged = 0;
 }
diff --git a/objects/nxtrigger.h b/objects/nxtrigger.h
index 330ee33..8969822 100644
--- a/objects/nxtrigger.h
+++ b/objects/nxtrigger.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/render/uirender.cpp b/render/uirender.cpp
index 6554a9e..8c2bdf9 100644
--- a/render/uirender.cpp
+++ b/render/uirender.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
@@ -101,9 +101,11 @@ bool UiRender::loadTexture(UiRenderTexture *texture, bool gl) {
             glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tex.width(), tex.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, tex.bits());
 #ifdef Q_OS_MAC
             glGenerateMipmap(GL_TEXTURE_2D);
-#endif
             glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
             glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
+#else
+            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+#endif
             glDisable(GL_TEXTURE_2D);
             texture->originalSize = tex.size();
             texture->loaded = true;
diff --git a/render/uirender.h b/render/uirender.h
index eab88c7..73fe3c2 100644
--- a/render/uirender.h
+++ b/render/uirender.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/render/uirenderpreview.cpp b/render/uirenderpreview.cpp
index 6a5aad0..3153bbe 100644
--- a/render/uirenderpreview.cpp
+++ b/render/uirenderpreview.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/render/uirenderpreview.h b/render/uirenderpreview.h
index 1e9bb1f..0f6863b 100644
--- a/render/uirenderpreview.h
+++ b/render/uirenderpreview.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/shaders/Blur - copie 2.fsh b/shaders/Blur - copie 2.fsh
index 4084ffa..79fda53 100644
--- a/shaders/Blur - copie 2.fsh	
+++ b/shaders/Blur - copie 2.fsh	
@@ -1,36 +1,36 @@
-uniform float slide_up;
-uniform float slide_down;
-
-varying vec2 texcoord0;
-varying vec2 texcoord1;
-
-uniform sampler2D tex0;
-uniform sampler2D tex1;
-
-void main(void)
-{
-	vec4 su, sd, up, down, amount;
-
-	// sample inputs at texcoords
-	vec4 input0 = texture2D(tex0, texcoord0);
-	vec4 input1 = texture2D(tex1, texcoord1);
-	
-	// get contribution
-	amount.x = input0.x > input1.x ? 1.0 : 0.0;
-	amount.y = input0.y > input1.y ? 1.0 : 0.0;
-	amount.z = input0.z > input1.z ? 1.0 : 0.0;
-	amount.w = input0.w > input1.w ? 1.0 : 0.0;
-	
-	// calculate slide down
-	float d = max(1.0, abs(slide_down));
-	sd = vec4(1.0 / d);
-	down = input1 + ((input0 - input1) * sd);
-
-	// calculate slide up
-	float u = max(1.0, abs(slide_up));
-	su = vec4(1.0 / u);
-	up = input1 + ((input0 - input1) * su);
-
-	// mix between down and up
-	gl_FragColor = mix(down, up, amount);
-}
+uniform float slide_up;
+uniform float slide_down;
+
+varying vec2 texcoord0;
+varying vec2 texcoord1;
+
+uniform sampler2D tex0;
+uniform sampler2D tex1;
+
+void main(void)
+{
+	vec4 su, sd, up, down, amount;
+
+	// sample inputs at texcoords
+	vec4 input0 = texture2D(tex0, texcoord0);
+	vec4 input1 = texture2D(tex1, texcoord1);
+
+	// get contribution
+	amount.x = input0.x > input1.x ? 1.0 : 0.0;
+	amount.y = input0.y > input1.y ? 1.0 : 0.0;
+	amount.z = input0.z > input1.z ? 1.0 : 0.0;
+	amount.w = input0.w > input1.w ? 1.0 : 0.0;
+
+	// calculate slide down
+	float d = max(1.0, abs(slide_down));
+	sd = vec4(1.0 / d);
+	down = input1 + ((input0 - input1) * sd);
+
+	// calculate slide up
+	float u = max(1.0, abs(slide_up));
+	su = vec4(1.0 / u);
+	up = input1 + ((input0 - input1) * su);
+
+	// mix between down and up
+	gl_FragColor = mix(down, up, amount);
+}
diff --git a/shaders/Blur.fsh b/shaders/Blur.fsh
index db61e90..c5952b8 100644
--- a/shaders/Blur.fsh
+++ b/shaders/Blur.fsh
@@ -1,35 +1,35 @@
-uniform sampler2D tex0;
-uniform sampler2D tex1;
-
-uniform float slide_up;
-uniform float slide_down;
-
-varying vec2 texcoord0;
-varying vec2 texcoord1;
-
-void main(void) {
-	vec4 su, sd, up, down, amount;
-
-	// sample inputs at texcoords
-	vec4 input0 = texture2D(tex0, texcoord0);
-	vec4 input1 = texture2D(tex1, texcoord1);
-	
-	// get contribution
-	amount.x = input0.x > input1.x ? 1.0 : 0.0;
-	amount.y = input0.y > input1.y ? 1.0 : 0.0;
-	amount.z = input0.z > input1.z ? 1.0 : 0.0;
-	amount.w = input0.w > input1.w ? 1.0 : 0.0;
-	
-	// calculate slide down
-	float d = max(1.0, abs(slide_down));
-	sd = vec4(1.0 / d);
-	down = input1 + ((input0 - input1) * sd);
-
-	// calculate slide up
-	float u = max(1.0, abs(slide_up));
-	su = vec4(1.0 / u);
-	up = input1 + ((input0 - input1) * su);
-
-	// mix between down and up
-	gl_FragColor = mix(down, up, amount);
+uniform sampler2D tex0;
+uniform sampler2D tex1;
+
+uniform float slide_up;
+uniform float slide_down;
+
+varying vec2 texcoord0;
+varying vec2 texcoord1;
+
+void main(void) {
+	vec4 su, sd, up, down, amount;
+
+	// sample inputs at texcoords
+	vec4 input0 = texture2D(tex0, texcoord0);
+	vec4 input1 = texture2D(tex1, texcoord1);
+
+	// get contribution
+	amount.x = input0.x > input1.x ? 1.0 : 0.0;
+	amount.y = input0.y > input1.y ? 1.0 : 0.0;
+	amount.z = input0.z > input1.z ? 1.0 : 0.0;
+	amount.w = input0.w > input1.w ? 1.0 : 0.0;
+
+	// calculate slide down
+	float d = max(1.0, abs(slide_down));
+	sd = vec4(1.0 / d);
+	down = input1 + ((input0 - input1) * sd);
+
+	// calculate slide up
+	float u = max(1.0, abs(slide_up));
+	su = vec4(1.0 / u);
+	up = input1 + ((input0 - input1) * su);
+
+	// mix between down and up
+	gl_FragColor = mix(down, up, amount);
 }
\ No newline at end of file
diff --git a/shaders/Blur_.fsh b/shaders/Blur_.fsh
index b30762c..ec14049 100644
--- a/shaders/Blur_.fsh
+++ b/shaders/Blur_.fsh
@@ -1,72 +1,72 @@
-uniform float slide_up;
-uniform float slide_down;
-
-varying vec2 texcoord0;
-varying vec2 texcoord1;
-
-uniform sampler2D tex0;
-uniform sampler2D tex1;
-
-void main(void) {
-	vec4 su, sd, up, down, amount;
-
-	// sample inputs at texcoords
-	vec4 input0 = texture2D(tex0, texcoord0);
-	vec4 input1 = texture2D(tex1, texcoord1);
-	
-	// get contribution
-	amount.x = input0.x > input1.x ? 1.0 : 0.0;
-	amount.y = input0.y > input1.y ? 1.0 : 0.0;
-	amount.z = input0.z > input1.z ? 1.0 : 0.0;
-	amount.w = input0.w > input1.w ? 1.0 : 0.0;
-	
-	// calculate slide down
-	float d = max(1.0, abs(slide_down));
-	sd = vec4(1.0 / d);
-	down = input1 + ((input0 - input1) * sd);
-
-	// calculate slide up
-	float u = max(1.0, abs(slide_up));
-	su = vec4(1.0 / u);
-	up = input1 + ((input0 - input1) * su);
-
-	// mix between down and up
-	gl_FragColor = mix(down, up, amount);
-}
-
-/*
-void main(void) {
-	vec4 color0  = texture2D(tex0, texcoord0);
-	vec4 color1  = texture2D(tex1, texcoord1);
-	gl_FragColor = color0*0.5 + color1*0.5;
-}
-*/
-
-/*
-void main(void) {
-	vec4 su, sd, up, down, amount;
-
-	// sample inputs at texcoords
-	vec4 input0 = texture2D(tex0, texcoord0);
-	vec4 input1 = texture2D(tex1, texcoord1);
-	
-	// get contribution
-	amount.x = input0.x > input1.x ? 1.0 : 0.0;
-	amount.y = input0.y > input1.y ? 1.0 : 0.0;
-	amount.z = input0.z > input1.z ? 1.0 : 0.0;
-	amount.w = input0.w > input1.w ? 1.0 : 0.0;
-	
-	// calculate slide down
-	float d = max(1.0, abs(slide_down));
-	sd = vec4(1.0 / d);
-	down = input1 + ((input0 - input1) * sd);
-
-	// calculate slide up
-	float u = max(1.0, abs(slide_up));
-	su = vec4(1.0 / u);
-	up = input1 + ((input0 - input1) * su);
-
-	// mix between down and up
-	gl_FragColor = mix(down, up, amount);
-}
-*/
+uniform float slide_up;
+uniform float slide_down;
+
+varying vec2 texcoord0;
+varying vec2 texcoord1;
+
+uniform sampler2D tex0;
+uniform sampler2D tex1;
+
+void main(void) {
+	vec4 su, sd, up, down, amount;
+
+	// sample inputs at texcoords
+	vec4 input0 = texture2D(tex0, texcoord0);
+	vec4 input1 = texture2D(tex1, texcoord1);
+
+	// get contribution
+	amount.x = input0.x > input1.x ? 1.0 : 0.0;
+	amount.y = input0.y > input1.y ? 1.0 : 0.0;
+	amount.z = input0.z > input1.z ? 1.0 : 0.0;
+	amount.w = input0.w > input1.w ? 1.0 : 0.0;
+
+	// calculate slide down
+	float d = max(1.0, abs(slide_down));
+	sd = vec4(1.0 / d);
+	down = input1 + ((input0 - input1) * sd);
+
+	// calculate slide up
+	float u = max(1.0, abs(slide_up));
+	su = vec4(1.0 / u);
+	up = input1 + ((input0 - input1) * su);
+
+	// mix between down and up
+	gl_FragColor = mix(down, up, amount);
+}
+
+/*
+void main(void) {
+	vec4 color0  = texture2D(tex0, texcoord0);
+	vec4 color1  = texture2D(tex1, texcoord1);
+	gl_FragColor = color0*0.5 + color1*0.5;
+}
+*/
+
+/*
+void main(void) {
+	vec4 su, sd, up, down, amount;
+
+	// sample inputs at texcoords
+	vec4 input0 = texture2D(tex0, texcoord0);
+	vec4 input1 = texture2D(tex1, texcoord1);
+
+	// get contribution
+	amount.x = input0.x > input1.x ? 1.0 : 0.0;
+	amount.y = input0.y > input1.y ? 1.0 : 0.0;
+	amount.z = input0.z > input1.z ? 1.0 : 0.0;
+	amount.w = input0.w > input1.w ? 1.0 : 0.0;
+
+	// calculate slide down
+	float d = max(1.0, abs(slide_down));
+	sd = vec4(1.0 / d);
+	down = input1 + ((input0 - input1) * sd);
+
+	// calculate slide up
+	float u = max(1.0, abs(slide_up));
+	su = vec4(1.0 / u);
+	up = input1 + ((input0 - input1) * su);
+
+	// mix between down and up
+	gl_FragColor = mix(down, up, amount);
+}
+*/
diff --git a/shaders/Fragment.vsh b/shaders/Fragment.vsh
index 141aebf..395f5ab 100644
--- a/shaders/Fragment.vsh
+++ b/shaders/Fragment.vsh
@@ -1,14 +1,14 @@
-varying vec2 texcoord0;
-varying vec2 texcoord1;
-
-void main() {
-	gl_Position = ftransform();
-	//gl_TexCoord[0] = gl_MultiTexCoord0;
-	//gl_TexCoord[1] = gl_MultiTexCoord1;
-
-	texcoord0 = vec2(gl_TextureMatrix[0] * gl_MultiTexCoord0);
-	texcoord1 = vec2(gl_TextureMatrix[1] * gl_MultiTexCoord1);
-	
-	//texcoord0 = gl_MultiTexCoord0.st;
-	//texcoord1 = gl_MultiTexCoord1.st;
+varying vec2 texcoord0;
+varying vec2 texcoord1;
+
+void main() {
+	gl_Position = ftransform();
+	//gl_TexCoord[0] = gl_MultiTexCoord0;
+	//gl_TexCoord[1] = gl_MultiTexCoord1;
+
+	texcoord0 = vec2(gl_TextureMatrix[0] * gl_MultiTexCoord0);
+	texcoord1 = vec2(gl_TextureMatrix[1] * gl_MultiTexCoord1);
+
+	//texcoord0 = gl_MultiTexCoord0.st;
+	//texcoord1 = gl_MultiTexCoord1.st;
 }
\ No newline at end of file
diff --git a/transport/transport.cpp b/transport/transport.cpp
index a2f2efc..0d79771 100644
--- a/transport/transport.cpp
+++ b/transport/transport.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/transport/transport.h b/transport/transport.h
index 82de7d7..f599f65 100644
--- a/transport/transport.h
+++ b/transport/transport.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/transport/uiabout.cpp b/transport/uiabout.cpp
index fd0b859..d581e0a 100644
--- a/transport/uiabout.cpp
+++ b/transport/uiabout.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/transport/uiabout.h b/transport/uiabout.h
index 327472e..ab26de4 100644
--- a/transport/uiabout.h
+++ b/transport/uiabout.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/transport/uieditor.cpp b/transport/uieditor.cpp
index 69313dc..46e6925 100644
--- a/transport/uieditor.cpp
+++ b/transport/uieditor.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/transport/uieditor.h b/transport/uieditor.h
index ea89b35..6a6add8 100644
--- a/transport/uieditor.h
+++ b/transport/uieditor.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/transport/uitimer.cpp b/transport/uitimer.cpp
index 0ae066c..a3e6186 100644
--- a/transport/uitimer.cpp
+++ b/transport/uitimer.cpp
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 
diff --git a/transport/uitimer.h b/transport/uitimer.h
index 3617b67..a3e274d 100644
--- a/transport/uitimer.h
+++ b/transport/uitimer.h
@@ -3,7 +3,7 @@
     Copyright (C) 2010-2015 — IanniX Association
 
     Project Manager: Thierry Coduys (http://www.le-hub.org)
-    Development:     Guillaume Jacquemin (http://www.buzzinglight.com)
+    Development:     Guillaume Jacquemin (https://www.buzzinglight.com)
 
     This file was written by Guillaume Jacquemin.
 

-- 
iannix packaging



More information about the pkg-multimedia-commits mailing list