arg::nomore(); fixes in collatz3

This commit is contained in:
Zeno Rogue 2019-04-22 22:59:37 +02:00
parent 98381f5526
commit 49877fbfc9
3 changed files with 5 additions and 2 deletions

View File

@ -65,6 +65,8 @@ namespace arg {
lshift(); if(pos > isize(argument)) { printf("Missing parameter\n"); exit(1); }
}
bool nomore() { return pos >= isize(argument); }
const string& args() { return argument[pos]; }
const char* argcs() { return args().c_str(); }
int argi() { return atoi(argcs()); }

View File

@ -2292,6 +2292,7 @@ namespace arg {
int argi();
ld argf();
bool argis(const string& s);
bool nomore();
unsigned arghex();
inline void shift_arg_formula(ld& x, const reaction_t& r = reaction_t()) { shift(); x = argf();

View File

@ -1721,9 +1721,9 @@ int readArgs() {
shift();
transmatrix *T = &T2;
while(true) {
if(arg::pos >= isize(arg::argument)) break;
if(arg::nomore()) break;
else if(argis("fd")) { shift(); *T = *T * xpush(argf()); shift(); }
else if(argcs()[0] == 't') { shift(); *T = *T * hr::cspin(dimid(argcs()[1]),dimid(argcs()[2]),argf()); shift(); }
else if(argcs()[0] == 't') { int x = dimid(argcs()[1]); int y = dimid(argcs()[2]); shift(); *T = *T * hr::cspin(x, y, argf()); shift(); }
else if(argis("/")) { shift(); if(T == &T2) T = &T3; else break; }
else break;
}