All tests still pass and a lot of debugging junk is gone
This commit is contained in:
parent
306f520082
commit
5dee093e65
|
@ -167,7 +167,7 @@ struct cons_pointer allocate_cell( char *tag ) {
|
||||||
fprintf( stderr,
|
fprintf( stderr,
|
||||||
"Allocated cell of type '%s' at %d, %d \n", tag,
|
"Allocated cell of type '%s' at %d, %d \n", tag,
|
||||||
result.page, result.offset );
|
result.page, result.offset );
|
||||||
dump_object( stderr, result );
|
// dump_object( stderr, result );
|
||||||
} else {
|
} else {
|
||||||
fprintf( stderr, "WARNING: Allocating non-free cell!" );
|
fprintf( stderr, "WARNING: Allocating non-free cell!" );
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ void dump_object( FILE * output, struct cons_pointer pointer ) {
|
||||||
cell.payload.real.value );
|
cell.payload.real.value );
|
||||||
} else if ( check_tag( pointer, STRINGTAG ) ) {
|
} else if ( check_tag( pointer, STRINGTAG ) ) {
|
||||||
fwprintf( output,
|
fwprintf( output,
|
||||||
L"String cell: character '%1c' (%1d) next at page %2d offset %3d\n",
|
L"\t\tString cell: character '%1c' (%1d) next at page %2d offset %3d\n",
|
||||||
cell.payload.string.character,
|
cell.payload.string.character,
|
||||||
cell.payload.string.cdr.page,
|
cell.payload.string.cdr.page,
|
||||||
cell.payload.string.cdr.offset );
|
cell.payload.string.cdr.offset );
|
||||||
|
@ -150,9 +150,9 @@ make_string_like_thing( wint_t c, struct cons_pointer tail, char *tag ) {
|
||||||
inc_ref( tail );
|
inc_ref( tail );
|
||||||
cell->payload.string.character = c;
|
cell->payload.string.character = c;
|
||||||
cell->payload.string.cdr.page = tail.page;
|
cell->payload.string.cdr.page = tail.page;
|
||||||
|
/* TODO: There's a problem here. Sometimes the offsets on
|
||||||
|
* strings are quite massively off. */
|
||||||
cell->payload.string.cdr.offset = tail.offset;
|
cell->payload.string.cdr.offset = tail.offset;
|
||||||
|
|
||||||
dump_object( stderr, pointer);
|
|
||||||
} else {
|
} else {
|
||||||
fwprintf( stderr,
|
fwprintf( stderr,
|
||||||
L"Warning: only NIL and %s can be appended to %s\n",
|
L"Warning: only NIL and %s can be appended to %s\n",
|
||||||
|
@ -184,14 +184,6 @@ struct cons_pointer make_symbol( wint_t c, struct cons_pointer tail ) {
|
||||||
*/
|
*/
|
||||||
struct cons_pointer
|
struct cons_pointer
|
||||||
make_special( struct cons_pointer src, struct cons_pointer ( *executable )
|
make_special( struct cons_pointer src, struct cons_pointer ( *executable )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
( struct cons_pointer s_expr,
|
( struct cons_pointer s_expr,
|
||||||
struct cons_pointer env, struct stack_frame * frame ) ) {
|
struct cons_pointer env, struct stack_frame * frame ) ) {
|
||||||
struct cons_pointer pointer = allocate_cell( SPECIALTAG );
|
struct cons_pointer pointer = allocate_cell( SPECIALTAG );
|
||||||
|
|
11
src/init.c
11
src/init.c
|
@ -28,14 +28,6 @@ void bind_function( char *name, struct cons_pointer ( *executable )
|
||||||
}
|
}
|
||||||
|
|
||||||
void bind_special( char *name, struct cons_pointer ( *executable )
|
void bind_special( char *name, struct cons_pointer ( *executable )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
( struct cons_pointer s_expr, struct cons_pointer env,
|
( struct cons_pointer s_expr, struct cons_pointer env,
|
||||||
struct stack_frame * frame ) ) {
|
struct stack_frame * frame ) ) {
|
||||||
deep_bind( intern( c_string_to_lisp_symbol( name ), oblist ),
|
deep_bind( intern( c_string_to_lisp_symbol( name ), oblist ),
|
||||||
|
@ -101,10 +93,9 @@ int main( int argc, char *argv[] ) {
|
||||||
bind_special( "quote", &lisp_quote );
|
bind_special( "quote", &lisp_quote );
|
||||||
|
|
||||||
repl( stdin, stdout, stderr, show_prompt );
|
repl( stdin, stdout, stderr, show_prompt );
|
||||||
// print( stdout, lisp_eval( input, oblist, NULL));
|
|
||||||
|
|
||||||
if ( dump_at_end ) {
|
if ( dump_at_end ) {
|
||||||
dump_pages( stderr );
|
dump_pages( stdout );
|
||||||
}
|
}
|
||||||
|
|
||||||
return ( 0 );
|
return ( 0 );
|
||||||
|
|
|
@ -34,6 +34,12 @@ repl( FILE * in_stream, FILE * out_stream, FILE * error_stream,
|
||||||
if ( show_prompt ) {
|
if ( show_prompt ) {
|
||||||
fwprintf( out_stream, L"\n-> " );
|
fwprintf( out_stream, L"\n-> " );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* OK, I think what's going wrong here is we're passing by
|
||||||
|
* value and I think we should be passing by reference.
|
||||||
|
* I'm not certain about that, and as it will be a really
|
||||||
|
* major change I'm going to think some more before making
|
||||||
|
* in */
|
||||||
// print( out_stream, lisp_eval(input, oblist, NULL));
|
// print( out_stream, lisp_eval(input, oblist, NULL));
|
||||||
print( out_stream, input );
|
print( out_stream, input );
|
||||||
fwprintf( out_stream, L"\n" );
|
fwprintf( out_stream, L"\n" );
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
value=354
|
value=354
|
||||||
expected="Integer cell: value ${value}"
|
expected="Integer cell: value ${value}"
|
||||||
echo ${value} | target/psse 2>&1 | grep "${expected}" > /dev/null
|
echo ${value} | target/psse -d 2>&1 | grep "${expected}" > /dev/null
|
||||||
|
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
then
|
then
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
value='"Fred"'
|
value='"Fred"'
|
||||||
expected="String cell: character 'F'"
|
expected="String cell: character 'F'"
|
||||||
echo ${value} | target/psse 2>&1 | grep "${expected}" > /dev/null
|
echo ${value} | target/psse -d 2>&1 | grep "${expected}" > /dev/null
|
||||||
|
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
then
|
then
|
||||||
|
|
Loading…
Reference in a new issue