scmno****@osdn*****
scmno****@osdn*****
Sun Jun 24 04:38:17 JST 2018
changeset 2c805fd0d70d in quipu/quipu details: http://hg.osdn.jp/view/quipu/quipu?cmd=changeset;node=2c805fd0d70d user: Agustina Arzille <avarz****@riseu*****> date: Sat Jun 23 19:38:02 2018 +0000 description: Some improvements here and there diffstat: compiler.cpp | 2 +- cons.cpp | 6 ++---- eval.cpp | 10 ++++------ utils/genopnames.py | 14 ++++++++++++++ 4 files changed, 21 insertions(+), 11 deletions(-) diffs (70 lines): diff -r 379800647e9f -r 2c805fd0d70d compiler.cpp --- a/compiler.cpp Fri Jun 22 18:09:12 2018 -0300 +++ b/compiler.cpp Sat Jun 23 19:38:02 2018 +0000 @@ -1041,7 +1041,7 @@ int len, cnt = global_builtins[builtin].argcnt; if (cnt >= 0 && (len = len_L (this->interp, xcdr (expr))) != cnt) - this->interp->raise_nargs (global_builtins[builtin].name, len, len, cnt); + this->interp->raise_nargs (global_builtins[builtin].name, cnt, cnt, len); object instr = global_builtins[builtin].code; diff -r 379800647e9f -r 2c805fd0d70d cons.cpp --- a/cons.cpp Fri Jun 22 18:09:12 2018 -0300 +++ b/cons.cpp Sat Jun 23 19:38:02 2018 +0000 @@ -11,10 +11,8 @@ int len_L (interpreter *interp, object lst, object& dotc) { int ret = 0; - for (interp->aux = lst; cons_p (interp->aux); - interp->aux = xcdr (interp->aux), ++ret) ; - - dotc = interp->aux; + for (; cons_p (lst); lst = xcdr (lst), ++ret) ; + dotc = lst; return (ret); } diff -r 379800647e9f -r 2c805fd0d70d eval.cpp --- a/eval.cpp Fri Jun 22 18:09:12 2018 -0300 +++ b/eval.cpp Sat Jun 23 19:38:02 2018 +0000 @@ -162,13 +162,11 @@ else ix = fetch32 (ip), sx = fetch32 (ip); - for (interp->retval = interp->stack[interp->cur_frame - 5]; sx != 0; --sx) - { - array *ap = as_array (interp->retval); - interp->retval = ap->data[ap->len - 1]; - } + object env = interp->stack[interp->cur_frame - 5]; + for (; sx != 0; --sx) + env = xaref (env, as_array(env)->len - 1); - return (xaref (interp->retval, ix)); + return (xaref (env, ix)); } static int diff -r 379800647e9f -r 2c805fd0d70d utils/genopnames.py --- a/utils/genopnames.py Fri Jun 22 18:09:12 2018 -0300 +++ b/utils/genopnames.py Sat Jun 23 19:38:02 2018 +0000 @@ -36,3 +36,17 @@ print (" { %s, %s }, // %s" % (offsets[i], flags[i], pnames[i])) print (" { 0, 0 }\n};") + +ulen = 2 +print ("\n\nconst void* const LABELS[] =\n{\n ", end = '') +for name in pnames: + s = "P_(" + name.replace('.', '').upper () + ")," + ulen += len (s) + if ulen > 64: + print ("\n %s" % s, end = '') + ulen = 2 + else: + print ("%s " % s, end = '') + ulen += 1 + +print ("\n};")