Whitespace changes only - trying to keep the format regular
This commit is contained in:
parent
e43c9a7b33
commit
79f7492390
36
src/peano.c
36
src/peano.c
|
@ -50,15 +50,13 @@ lisp_add(struct stack_frame *frame, struct cons_pointer env) {
|
||||||
d_accumulator += arg.payload.real.value;
|
d_accumulator += arg.payload.real.value;
|
||||||
is_int = false;
|
is_int = false;
|
||||||
default:
|
default:
|
||||||
lisp_throw(
|
lisp_throw( c_string_to_lisp_string( "Cannot add: not a number" ),
|
||||||
c_string_to_lisp_string("Cannot add: not a number"),
|
|
||||||
frame );
|
frame );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !nilp( frame->more ) ) {
|
if ( !nilp( frame->more ) ) {
|
||||||
lisp_throw(
|
lisp_throw( c_string_to_lisp_string
|
||||||
c_string_to_lisp_string("Cannot yet add more than 8 numbers"),
|
( "Cannot yet add more than 8 numbers" ), frame );
|
||||||
frame);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( is_int ) {
|
if ( is_int ) {
|
||||||
|
@ -96,15 +94,13 @@ lisp_multiply(struct stack_frame *frame, struct cons_pointer env) {
|
||||||
d_accumulator *= arg.payload.real.value;
|
d_accumulator *= arg.payload.real.value;
|
||||||
is_int = false;
|
is_int = false;
|
||||||
default:
|
default:
|
||||||
lisp_throw(
|
lisp_throw( c_string_to_lisp_string
|
||||||
c_string_to_lisp_string("Cannot multiply: not a number"),
|
( "Cannot multiply: not a number" ), frame );
|
||||||
frame);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !nilp( frame->more ) ) {
|
if ( !nilp( frame->more ) ) {
|
||||||
lisp_throw(
|
lisp_throw( c_string_to_lisp_string
|
||||||
c_string_to_lisp_string("Cannot yet multiply more than 8 numbers"),
|
( "Cannot yet multiply more than 8 numbers" ), frame );
|
||||||
frame);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( is_int ) {
|
if ( is_int ) {
|
||||||
|
@ -131,19 +127,23 @@ lisp_subtract(struct stack_frame *frame, struct cons_pointer env) {
|
||||||
struct cons_space_object arg1 = pointer2cell( frame->arg[1] );
|
struct cons_space_object arg1 = pointer2cell( frame->arg[1] );
|
||||||
|
|
||||||
if ( integerp( frame->arg[0] ) && integerp( frame->arg[1] ) ) {
|
if ( integerp( frame->arg[0] ) && integerp( frame->arg[1] ) ) {
|
||||||
result = make_integer(arg0.payload.integer.value - arg1.payload.integer.value);
|
result =
|
||||||
|
make_integer( arg0.payload.integer.value -
|
||||||
|
arg1.payload.integer.value );
|
||||||
} else if ( realp( frame->arg[0] ) && realp( frame->arg[1] ) ) {
|
} else if ( realp( frame->arg[0] ) && realp( frame->arg[1] ) ) {
|
||||||
result = make_real(arg0.payload.real.value - arg1.payload.real.value);
|
result =
|
||||||
|
make_real( arg0.payload.real.value - arg1.payload.real.value );
|
||||||
} else if ( integerp( frame->arg[0] ) && realp( frame->arg[1] ) ) {
|
} else if ( integerp( frame->arg[0] ) && realp( frame->arg[1] ) ) {
|
||||||
result = make_real( numeric_value(frame->arg[0]) - arg1.payload.real.value);
|
result =
|
||||||
|
make_real( numeric_value( frame->arg[0] ) -
|
||||||
|
arg1.payload.real.value );
|
||||||
} else if ( realp( frame->arg[0] ) && integerp( frame->arg[1] ) ) {
|
} else if ( realp( frame->arg[0] ) && integerp( frame->arg[1] ) ) {
|
||||||
result = make_real( arg0.payload.real.value - numeric_value(frame->arg[0]));
|
result =
|
||||||
|
make_real( arg0.payload.real.value -
|
||||||
|
numeric_value( frame->arg[0] ) );
|
||||||
} // else we have an error!
|
} // else we have an error!
|
||||||
|
|
||||||
// and if not nilp[frame->arg[2]) we also have an error.
|
// and if not nilp[frame->arg[2]) we also have an error.
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,4 @@ lisp_subtract(struct stack_frame *frame, struct cons_pointer env);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* PEANO_H */
|
#endif /* PEANO_H */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue