Much better debugging, but it still doesn't work

This commit is contained in:
Simon Brooke 2018-12-27 21:37:38 +00:00
parent 3d5c27cb10
commit 75abfb4050
23 changed files with 395 additions and 233 deletions

View file

@ -13,6 +13,7 @@
#include "conspage.h"
#include "consspaceobject.h"
#include "debug.h"
/**
* return the numeric value of this cell, as a C primitive double, not
@ -40,9 +41,7 @@ struct cons_pointer make_integer( int64_t value ) {
struct cons_space_object *cell = &pointer2cell( result );
cell->payload.integer.value = value;
#ifdef DEBUG
dump_object( stderr, result );
#endif
debug_dump_object( result, DEBUG_ARITH );
return result;
}

View file

@ -16,6 +16,7 @@
#include "consspaceobject.h"
#include "conspage.h"
#include "debug.h"
#include "equal.h"
#include "integer.h"
#include "intern.h"
@ -86,8 +87,8 @@ long double to_long_double( struct cons_pointer arg ) {
break;
}
fputws( L"to_long_double( ", stderr );
print( stderr, arg );
debug_print( L"to_long_double( ", DEBUG_ARITH );
debug_print_object( arg, DEBUG_ARITH );
fwprintf( stderr, L") => %lf\n", result );
return result;
@ -129,13 +130,11 @@ struct cons_pointer add_2( struct stack_frame *frame,
struct cons_space_object cell1 = pointer2cell( arg1 );
struct cons_space_object cell2 = pointer2cell( arg2 );
#ifdef DEBUG
fputws( L"add_2( arg1 = ", stderr );
print( stderr, arg1 );
fputws( L"; arg2 = ", stderr );
print( stderr, arg2 );
fputws( L")\n", stderr );
#endif
debug_print( L"add_2( arg1 = ", DEBUG_ARITH );
debug_print_object( arg1, DEBUG_ARITH );
debug_print( L"; arg2 = ", DEBUG_ARITH );
debug_print_object( arg2, DEBUG_ARITH );
debug_print( L"\n", DEBUG_ARITH );
if ( zerop( arg1 ) ) {
result = arg2;
@ -209,11 +208,9 @@ struct cons_pointer add_2( struct stack_frame *frame,
}
}
#ifdef DEBUG
fputws( L"}; => ", stderr );
print( stderr, arg2 );
fputws( L"\n", stderr );
#endif
debug_print( L"}; => ", DEBUG_ARITH );
debug_print_object( arg2, DEBUG_ARITH );
debug_print( L"\n", DEBUG_ARITH );
return result;
}
@ -267,13 +264,11 @@ struct cons_pointer multiply_2( struct stack_frame *frame,
struct cons_space_object cell1 = pointer2cell( arg1 );
struct cons_space_object cell2 = pointer2cell( arg2 );
#ifdef DEBUG
fputws( L"multiply_2( arg1 = ", stderr );
print( stderr, arg1 );
fputws( L"; arg2 = ", stderr );
print( stderr, arg2 );
fputws( L")\n", stderr );
#endif
debug_print( L"multiply_2( arg1 = ", DEBUG_ARITH );
debug_print_object( arg1, DEBUG_ARITH );
debug_print( L"; arg2 = ", DEBUG_ARITH );
debug_print_object( arg2, DEBUG_ARITH );
debug_print( L")", DEBUG_ARITH );
if ( zerop( arg1 ) ) {
result = arg2;
@ -348,11 +343,9 @@ struct cons_pointer multiply_2( struct stack_frame *frame,
}
}
#ifdef DEBUG
fputws( L" => ", stderr );
print( stderr, arg2 );
fputws( L"\n", stderr );
#endif
debug_print( L" => ", DEBUG_ARITH );
debug_print_object( arg2, DEBUG_ARITH );
debug_print( L"\n", DEBUG_ARITH );
return result;
}

View file

@ -13,7 +13,7 @@
#include "conspage.h"
#include "consspaceobject.h"
#include "dump.h"
#include "debug.h"
#include "equal.h"
#include "integer.h"
#include "lispops.h"
@ -332,9 +332,8 @@ struct cons_pointer make_ratio( struct cons_pointer frame_pointer,
( "Dividend and divisor of a ratio must be integers" ),
frame_pointer );
}
#ifdef DEBUG
dump_object( stderr, result );
#endif
debug_dump_object( result, DEBUG_ARITH );
return result;
}

View file

@ -9,7 +9,7 @@
#include "conspage.h"
#include "consspaceobject.h"
#include "dump.h"
#include "debug.h"
#include "read.h"
/**
@ -23,9 +23,7 @@ struct cons_pointer make_real( long double value ) {
struct cons_space_object *cell = &pointer2cell( result );
cell->payload.real.value = value;
#ifdef DEBUG
dump_object( stderr, result );
#endif
debug_dump_object( result, DEBUG_ARITH );
return result;
}