Skip to content

Commit 0430a2e

Browse files
authored
Merge pull request #5 from briantoby/Xcode_fix
patch variable to avoid naming problems on MacOS & Linux
2 parents fc1732e + 7735ad3 commit 0430a2e

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

libpdffit2/StringUtils.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ string FormatValueWithStd::operator() (double x, double dx)
4141
out << x << setprecision(f_std_precision);
4242
// do not write dx when it is too small
4343
if (dx > fabs(x)*1e-8) out << " (" << dx << ')';
44-
else if (isnan(dx)) out << " (NaN)";
44+
else if (std::isnan(dx)) out << " (NaN)";
4545
// left-pad string to the width
4646
string rv = out.str();
4747
int rvlen = rv.size();

libpdffit2/parser.cc

+10-10
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include "MathUtils.h"
2828
#include "pdffit.h"
2929

30-
static vector<double> stack;
30+
static vector<double> vstack;
3131
static vector<vector<double> > dstack; // stack with derivative vectors
3232
static bool deriv;
3333

@@ -81,7 +81,7 @@ string Fit::substitute_pars(string &expr)
8181
if (i==used.size())
8282
{
8383
used.push_back(ipar);
84-
stack.push_back(p[ipar]);
84+
vstack.push_back(p[ipar]);
8585
}
8686

8787
expr.replace(bopen,bclose-bopen,stackvar(i));
@@ -177,12 +177,12 @@ double Fit::getnum(istringstream &inexpr, vector<double> &dnumdp)
177177
inexpr >> id;
178178
if (!inexpr)
179179
throw parseError(inexpr.str());
180-
num = iter->second.func(stack[id]);
180+
num = iter->second.func(vstack[id]);
181181

182182
// fill the partial derivatives if function argument had derivatives
183183
if (deriv && !dstack[id].empty())
184184
{
185-
double fder=iter->second.deriv(stack[id]);
185+
double fder=iter->second.deriv(vstack[id]);
186186
dnumdp = vector<double>(used.size());
187187
for(unsigned int i=0; i<used.size(); i++)
188188
dnumdp[i] = fder*dstack[id][i];
@@ -193,7 +193,7 @@ double Fit::getnum(istringstream &inexpr, vector<double> &dnumdp)
193193
inexpr >> id;
194194
if (!inexpr)
195195
throw parseError(inexpr.str());
196-
num = stack[id];
196+
num = vstack[id];
197197
if (deriv && !dstack[id].empty()) dnumdp = dstack[id];
198198
}
199199
else
@@ -333,8 +333,8 @@ double Fit::compute(string &expr, vector<double> &dnumdp)
333333
end = inexpr.tellg();
334334

335335
// replace computed substring by stack pointer, and push value on the stack
336-
expr.replace(pos,end-pos,stackvar(stack.size()));
337-
stack.push_back(num);
336+
expr.replace(pos,end-pos,stackvar(vstack.size()));
337+
vstack.push_back(num);
338338

339339
// store the derivatives as well. Note that the derivative vector may be empty
340340
// if no derivatives was non-zero.
@@ -364,7 +364,7 @@ double Fit::parse(string line, vector<double> &dnumdp)
364364
throw parseError("Illegal character in formula");
365365

366366
// the first elements on the stack will be the used parameter values
367-
stack.clear();
367+
vstack.clear();
368368
used.clear();
369369

370370
// Search for parameters, check their existence and put on the stack
@@ -385,8 +385,8 @@ double Fit::parse(string line, vector<double> &dnumdp)
385385

386386
// put the bracket-value on the stack and replace substring by stack pointer,
387387
// and push new value on the stack
388-
line.replace(bopen,bclose-bopen+1,stackvar(stack.size()));
389-
stack.push_back(num);
388+
line.replace(bopen,bclose-bopen+1,stackvar(vstack.size()));
389+
vstack.push_back(num);
390390

391391
if (deriv)
392392
dstack.push_back(dnumdp);

0 commit comments

Comments
 (0)