summaryrefslogtreecommitdiff
path: root/src/piraha/Call.cc
diff options
context:
space:
mode:
authorsbrandt <sbrandt@17b73243-c579-4c4c-a9d2-2d5706c11dac>2013-02-26 22:08:02 +0000
committersbrandt <sbrandt@17b73243-c579-4c4c-a9d2-2d5706c11dac>2013-02-26 22:08:02 +0000
commit2808b605fea61bbd9ff50a46020061579fb19f41 (patch)
treee86334398ead087bb21c3a76ea7f9bff3a50f779 /src/piraha/Call.cc
parent2cf1b70f96d4a02c3e52eedfee4f3256a906ec2e (diff)
(1) Fix compilation issues on Pandora
(2) Disallow setting multiple parameters on one line (3) Allow sign in floating point format to be optional (4) Use package piraha (5) change PirahaParser to cctk_PirahaParser (6) remove size.py git-svn-id: http://svn.cactuscode.org/flesh/trunk@4966 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/piraha/Call.cc')
-rw-r--r--src/piraha/Call.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/piraha/Call.cc b/src/piraha/Call.cc
index 0ccce795..9df8fd10 100644
--- a/src/piraha/Call.cc
+++ b/src/piraha/Call.cc
@@ -7,6 +7,8 @@
#include <map>
#include <math.h>
+namespace piraha {
+
#define VAR(X) " " #X "=" << X
extern "C" int CCTK_ParameterFilename(int len, char *filename);
@@ -58,7 +60,7 @@ bool lookup_var(smart_ptr<Group> gr,std::string& res) {
return true;
} else if(gr->group(0)->substring() == "pi") {
std::ostringstream ostr;
- ostr << (4.0*atan2(1,1)) << std::flush;
+ ostr << (4.0*atan2(1.,1.)) << std::flush;
res = ostr.str();
return true;
}
@@ -176,9 +178,10 @@ void meval(smart_ptr<Group> gr,std::string& val) {
}
}
-extern "C" int PirahaParser(const char *buffer,unsigned long buffersize,int (*set_function)(const char *, const char *, int)) {
+extern "C" int cctk_PirahaParser(const char *buffer,unsigned long buffersize,int (*set_function)(const char *, const char *, int)) {
const char *par_file_src =
"skipper = ([ \\t\\r\\n]|\\#.*)*\n"
+ "skipeol = ([ \\t\\r]|\\#.*)*\\n\n"
"# Note that / occurs in some par files. It is my\n"
"# feeling that this should require quote marks.\n"
@@ -187,7 +190,7 @@ extern "C" int PirahaParser(const char *buffer,unsigned long buffersize,int (*se
"inquot = ({var}|\\\\.|[^\\\\\"])*\n"
"fname = \\.?/[-\\./0-9a-zA-Z_]+\n"
"quot = \"{inquot}\"|{fname}\n"
- "num = [-+]?([0-9]+(\\.[0-9]*|)|\\.[0-9]+)(e[+-][0-9]+|)\n"
+ "num = [-+]?([0-9]+(\\.[0-9]*|)|\\.[0-9]+)(e[+-]?[0-9]+|)\n"
"env = ENV\\{{name}\\}\n"
"var = \\$({env}|{name}|\\{{name}\\})\n"
@@ -205,7 +208,7 @@ extern "C" int PirahaParser(const char *buffer,unsigned long buffersize,int (*se
"int = [0-9]+\n"
"index = \\[ {int} \\]\n"
"active = (?i:ActiveThorns)\n"
- "set = ({active}|{par}( {index}|)) = ({array}|{aexpr})\n"
+ "set = ({active}|{par}( {index}|)) = ({array}|{aexpr}){-skipeol}\n"
"file = ( !DESC {quot}|)( ({set} )*)$\n";
smart_ptr<Grammar> g = new Grammar();
@@ -279,3 +282,5 @@ extern "C" int PirahaParser(const char *buffer,unsigned long buffersize,int (*se
}
return 0;
}
+
+}