Major refactoring. Major problems!
On the right path but it doesn't work yet.
This commit is contained in:
parent
ae8ba67ed7
commit
9937f344dc
20 changed files with 695 additions and 506 deletions
|
|
@ -278,13 +278,14 @@ struct cons_pointer {
|
|||
* here to avoid circularity. TODO: refactor.
|
||||
*/
|
||||
struct stack_frame {
|
||||
struct stack_frame *previous; /* the previous frame */
|
||||
struct cons_pointer previous; /* the previous frame */
|
||||
struct cons_pointer arg[args_in_frame];
|
||||
/*
|
||||
* first 8 arument bindings
|
||||
*/
|
||||
struct cons_pointer more; /* list of any further argument bindings */
|
||||
struct cons_pointer function; /* the function to be called */
|
||||
int args;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -311,7 +312,7 @@ struct cons_payload {
|
|||
*/
|
||||
struct exception_payload {
|
||||
struct cons_pointer message;
|
||||
struct stack_frame *frame;
|
||||
struct cons_pointer frame;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -326,6 +327,7 @@ struct exception_payload {
|
|||
struct function_payload {
|
||||
struct cons_pointer source;
|
||||
struct cons_pointer ( *executable ) ( struct stack_frame *,
|
||||
struct cons_pointer,
|
||||
struct cons_pointer );
|
||||
};
|
||||
|
||||
|
|
@ -379,13 +381,11 @@ struct real_payload {
|
|||
* its argument list) and a cons pointer (representing its environment) and a
|
||||
* stack frame (representing the previous stack frame) as arguments and returns
|
||||
* a cons pointer (representing its result).
|
||||
*
|
||||
* NOTE that this means that special forms do not appear on the lisp stack,
|
||||
* which may be confusing. TODO: think about this.
|
||||
*/
|
||||
struct special_payload {
|
||||
struct cons_pointer source;
|
||||
struct cons_pointer ( *executable ) ( struct stack_frame *,
|
||||
struct cons_pointer,
|
||||
struct cons_pointer );
|
||||
};
|
||||
|
||||
|
|
@ -421,7 +421,8 @@ struct vectorp_payload {
|
|||
* tag. */
|
||||
uint32_t value; /* the tag considered as a number */
|
||||
} tag;
|
||||
uint64_t address; /* the address of the actual vector space
|
||||
struct vector_space_object * address;
|
||||
/* the address of the actual vector space
|
||||
* object (TODO: will change when I actually
|
||||
* implement vector space) */
|
||||
};
|
||||
|
|
@ -514,20 +515,11 @@ void inc_ref( struct cons_pointer pointer );
|
|||
*/
|
||||
void dec_ref( struct cons_pointer pointer );
|
||||
|
||||
/**
|
||||
* dump the object at this cons_pointer to this output stream.
|
||||
*/
|
||||
void dump_object( FILE * output, struct cons_pointer pointer );
|
||||
|
||||
struct cons_pointer make_cons( struct cons_pointer car,
|
||||
struct cons_pointer cdr );
|
||||
/**
|
||||
* Construct an exception cell.
|
||||
* @param message should be a lisp string describing the problem, but actually any cons pointer will do;
|
||||
* @param frame should be the frame in which the exception occurred.
|
||||
*/
|
||||
|
||||
struct cons_pointer make_exception( struct cons_pointer message,
|
||||
struct stack_frame *frame );
|
||||
struct cons_pointer frame_pointer );
|
||||
|
||||
/**
|
||||
* Construct a cell which points to an executable Lisp special form.
|
||||
|
|
@ -535,6 +527,7 @@ struct cons_pointer make_exception( struct cons_pointer message,
|
|||
struct cons_pointer make_function( struct cons_pointer src,
|
||||
struct cons_pointer ( *executable )
|
||||
( struct stack_frame *,
|
||||
struct cons_pointer,
|
||||
struct cons_pointer ) );
|
||||
|
||||
/**
|
||||
|
|
@ -550,20 +543,13 @@ struct cons_pointer make_lambda( struct cons_pointer args,
|
|||
struct cons_pointer make_nlambda( struct cons_pointer args,
|
||||
struct cons_pointer body );
|
||||
|
||||
/**
|
||||
* Construct a ratio frame from these two pointers, expected to be integers
|
||||
* or (later) bignums, in the context of this stack_frame.
|
||||
*/
|
||||
struct cons_pointer make_ratio( struct stack_frame *frame,
|
||||
struct cons_pointer dividend,
|
||||
struct cons_pointer divisor );
|
||||
|
||||
/**
|
||||
* Construct a cell which points to an executable Lisp special form.
|
||||
*/
|
||||
struct cons_pointer make_special( struct cons_pointer src,
|
||||
struct cons_pointer ( *executable )
|
||||
( struct stack_frame *,
|
||||
struct cons_pointer,
|
||||
struct cons_pointer ) );
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue