@@ -250,9 +250,9 @@ string value_t::getstr() const
250
250
return boost::get<string>(val);
251
251
}
252
252
253
- value_t eval (expr); // forward declaration
253
+ value_t eval (const expr& ); // forward declaration
254
254
255
- value_t getvar (expr var, int use_preset = 0 )
255
+ value_t getvar (const expr& var, int use_preset = 0 )
256
256
{
257
257
// Construct index array. The cast to mpz_class automatically
258
258
// verifies that the index value is of type mpz_class.
@@ -277,7 +277,7 @@ value_t getvar(expr var, int use_preset = 0)
277
277
exit (exit_failure);
278
278
}
279
279
280
- void setvar (expr var, value_t val, int use_preset = 0 )
280
+ void setvar (const expr& var, value_t val, int use_preset = 0 )
281
281
{
282
282
// Construct index array. The cast to mpz_class automatically
283
283
// verifies that the index value is of type mpz_class.
@@ -302,22 +302,22 @@ void setvar(expr var, value_t val, int use_preset = 0)
302
302
(*revlist)[var][val].insert (ind);
303
303
}
304
304
305
- void setvars (vector<parse_t > varlist, int use_preset = 0 )
305
+ void setvars (const vector<parse_t >& varlist, int use_preset = 0 )
306
306
{
307
307
for (size_t i=0 ; i<varlist.size (); i++) {
308
308
setvar (varlist[i].args [0 ],eval (varlist[i].args [1 ]),use_preset);
309
309
}
310
310
}
311
311
312
- void unsetvars (args_t varlist)
312
+ void unsetvars (const args_t & varlist)
313
313
{
314
314
for (size_t i=0 ; i<varlist.size (); i++) {
315
315
variable.erase (varlist[i].val );
316
316
rev_variable.erase (varlist[i].val );
317
317
}
318
318
}
319
319
320
- value_t value (expr x)
320
+ value_t value (const expr& x)
321
321
{
322
322
debug (" value '%s'" ,x.val .c_str ());
323
323
@@ -477,7 +477,7 @@ value_t evalfun(args_t funargs)
477
477
exit (exit_failure);
478
478
}
479
479
480
- value_t eval (expr e)
480
+ value_t eval (const expr& e)
481
481
{
482
482
debug (" eval op='%c', val='%s', #args=%d" ,e.op ,e.val .c_str (),(int )e.args .size ());
483
483
switch ( e.op ) {
@@ -500,7 +500,7 @@ value_t eval(expr e)
500
500
}
501
501
}
502
502
503
- bool compare (expr cmp)
503
+ bool compare (const expr& cmp)
504
504
{
505
505
string op = cmp.val ;
506
506
value_t l = eval (cmp.args [0 ]);
@@ -518,7 +518,7 @@ bool compare(expr cmp)
518
518
exit (exit_failure);
519
519
}
520
520
521
- bool unique (args_t varlist)
521
+ bool unique (const args_t & varlist)
522
522
{
523
523
debug (" unique, #args=%d" ,(int )varlist.size ());
524
524
@@ -585,7 +585,7 @@ bool unique(args_t varlist)
585
585
return true ;
586
586
}
587
587
588
- bool inarray (expr e, expr array)
588
+ bool inarray (const expr& e, const expr& array)
589
589
{
590
590
string var = array.val ;
591
591
value_t val = eval (e);
@@ -601,7 +601,7 @@ bool inarray(expr e, expr array)
601
601
return rev_variable[var].count (val) && rev_variable[var][val].size ()>0 ;
602
602
}
603
603
604
- bool dotest (test t)
604
+ bool dotest (const test& t)
605
605
{
606
606
debug (" test op='%c', #args=%d" ,t.op ,(int )t.args .size ());
607
607
switch ( t.op ) {
@@ -836,7 +836,7 @@ string genregex(string exp)
836
836
}
837
837
838
838
// Parse {min,max}decimals in FLOATP command.
839
- void getdecrange (command cmd, int *decrange)
839
+ void getdecrange (const command& cmd, int *decrange)
840
840
{
841
841
// Read {min,max}decimals range for float.
842
842
for (int i=0 ; i<2 ; i++) {
@@ -960,7 +960,7 @@ void gentoken(command cmd, ostream &datastream)
960
960
}
961
961
}
962
962
963
- void checktoken (command cmd)
963
+ void checktoken (const command& cmd)
964
964
{
965
965
currcmd = cmd;
966
966
debug (" checking token %s at %lu,%lu" ,
@@ -986,7 +986,9 @@ void checktoken(command cmd)
986
986
mpz_class hi = eval (cmd.args [1 ]);
987
987
988
988
// debug("%s <= %s <= %s",lo.get_str().c_str(),num.c_str(),hi.get_str().c_str());
989
- if ( cmd.nargs ()>=3 ) debug (" '%s' = '%s'" ,cmd.args [2 ].c_str (),num.c_str ());
989
+ if ( cmd.nargs ()>=3 ) debug (" '%s' = '%s'" ,
990
+ const_cast <char *>(cmd.args [2 ].c_str ()),
991
+ const_cast <char *>(num.c_str ()));
990
992
991
993
if ( num.size ()==0 ) error ();
992
994
if ( num.size ()>=2 && num[0 ]==' 0' ) error (" prefix zero(s)" );
0 commit comments