let segfault bug "fixed". *But* I suspect there's memory leaking here.
This commit is contained in:
parent
3665326c55
commit
90e862cc59
2 changed files with 27 additions and 25 deletions
|
|
@ -1639,7 +1639,6 @@ struct cons_pointer lisp_let( struct stack_frame *frame,
|
||||||
|
|
||||||
bindings =
|
bindings =
|
||||||
make_cons( make_cons( symbol, val ), bindings );
|
make_cons( make_cons( symbol, val ), bindings );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
result =
|
result =
|
||||||
throw_exception( c_string_to_lisp_string
|
throw_exception( c_string_to_lisp_string
|
||||||
|
|
@ -1649,6 +1648,8 @@ struct cons_pointer lisp_let( struct stack_frame *frame,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
debug_print( L"\nlet: bindings complete.\n", DEBUG_BIND);
|
||||||
|
|
||||||
/* i.e., no exception yet */
|
/* i.e., no exception yet */
|
||||||
for ( int form = 1; !exceptionp( result ) && form < frame->args; form++ ) {
|
for ( int form = 1; !exceptionp( result ) && form < frame->args; form++ ) {
|
||||||
result =
|
result =
|
||||||
|
|
@ -1656,10 +1657,11 @@ struct cons_pointer lisp_let( struct stack_frame *frame,
|
||||||
bindings );
|
bindings );
|
||||||
}
|
}
|
||||||
|
|
||||||
// release the local bindings as they go out of scope!
|
/* release the local bindings as they go out of scope! **BUT**
|
||||||
for (struct cons_pointer cursor = bindings; !eq( cursor, env); cursor = c_cdr(cursor)) {
|
* bindings were consed onto the front of env, so caution... */
|
||||||
dec_ref( cursor);
|
// for (struct cons_pointer cursor = bindings; !eq( cursor, env); cursor = c_cdr(cursor)) {
|
||||||
}
|
// dec_ref( cursor);
|
||||||
|
// }
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,28 +2,28 @@
|
||||||
|
|
||||||
result=0
|
result=0
|
||||||
|
|
||||||
# echo -n "$0: let with two bindings, one form in body..."
|
echo -n "$0: let with two bindings, one form in body..."
|
||||||
# expected='11'
|
expected='11'
|
||||||
# actual=`echo "(let ((a . 5)(b . 6)) (+ a b))" | target/psse 2>/dev/null | tail -1`
|
actual=`echo "(let ((a . 5)(b . 6)) (+ a b))" | target/psse 2>/dev/null | tail -1`
|
||||||
|
|
||||||
# if [ "${expected}" = "${actual}" ]
|
if [ "${expected}" = "${actual}" ]
|
||||||
# then
|
then
|
||||||
# echo "OK"
|
echo "OK"
|
||||||
# else
|
else
|
||||||
# echo "Fail: expected '$expected', got '$actual'"
|
echo "Fail: expected '$expected', got '$actual'"
|
||||||
# result=`echo "${result} + 1" | bc`
|
result=`echo "${result} + 1" | bc`
|
||||||
# fi
|
fi
|
||||||
|
|
||||||
# echo -n "$0: let with two bindings, two forms in body..."
|
echo -n "$0: let with two bindings, two forms in body..."
|
||||||
# expected='1'
|
expected='1'
|
||||||
# actual=`echo "(let ((a . 5)(b . 6)) (+ a b) (- b a))" | target/psse 2>/dev/null | tail -1`
|
actual=`echo "(let ((a . 5)(b . 6)) (+ a b) (- b a))" | target/psse 2>/dev/null | tail -1`
|
||||||
|
|
||||||
# if [ "${expected}" = "${actual}" ]
|
if [ "${expected}" = "${actual}" ]
|
||||||
# then
|
then
|
||||||
# echo "OK"
|
echo "OK"
|
||||||
# else
|
else
|
||||||
# echo "Fail: expected '$expected', got '$actual'"
|
echo "Fail: expected '$expected', got '$actual'"
|
||||||
# result=`echo "${result} + 1" | bc`
|
result=`echo "${result} + 1" | bc`
|
||||||
# fi
|
fi
|
||||||
|
|
||||||
exit ${result}
|
exit ${result}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue