|
Post Scarcity
A prototype for a post scarcity programming environment
|
#include <stdlib.h>#include "memory/consspaceobject.h"#include "memory/conspage.h"#include "debug.h"#include "memory/dump.h"#include "ops/lispops.h"#include "io/print.h"#include "memory/stack.h"#include "memory/vectorspace.h"Go to the source code of this file.
Functions | |
| void | dump_frame (URL_FILE *output, struct cons_pointer frame_pointer) |
| Dump a stackframe to this stream for debugging. | |
| void | dump_stack_trace (URL_FILE *output, struct cons_pointer pointer) |
| struct cons_pointer | fetch_arg (struct stack_frame *frame, unsigned int index) |
| Fetch a pointer to the value of the local variable at this index. | |
| void | free_stack_frame (struct stack_frame *frame) |
| Free this stack frame. | |
| struct stack_frame * | get_stack_frame (struct cons_pointer pointer) |
get the actual stackframe object from this pointer, or NULL if pointer is not a stackframe pointer. | |
| struct cons_pointer | make_empty_frame (struct cons_pointer previous) |
| Make an empty stack frame, and return it. | |
| struct cons_pointer | make_special_frame (struct cons_pointer previous, struct cons_pointer args, struct cons_pointer env) |
| A 'special' frame is exactly like a normal stack frame except that the arguments are unevaluated. | |
| struct cons_pointer | make_stack_frame (struct cons_pointer previous, struct cons_pointer args, struct cons_pointer env) |
| Allocate a new stack frame with its previous pointer set to this value, its arguments set up from these args, evaluated in this env. | |
| void | set_reg (struct stack_frame *frame, int reg, struct cons_pointer value) |
| set a register in a stack frame. | |
| void dump_frame | ( | URL_FILE * | output, |
| struct cons_pointer | frame_pointer | ||
| ) |
Dump a stackframe to this stream for debugging.
| output | the stream |
| frame_pointer | the pointer to the frame |
Definition at line 244 of file stack.c.
References stack_frame::arg, stack_frame::args, cons_space_object::count, get_stack_frame(), stack_frame::more, nilp, pointer2cell, print(), cons_space_object::tag, url_fputws, and url_fwprintf.
Referenced by dump_object(), and dump_stack_trace().
| void dump_stack_trace | ( | URL_FILE * | output, |
| struct cons_pointer | pointer | ||
| ) |
Definition at line 268 of file stack.c.
References dump_frame(), dump_stack_trace(), exceptionp, get_stack_frame(), cons_space_object::payload, pointer2cell, pointer_to_vso, stack_frame::previous, print(), stackframep, url_fputws, and vectorpointp.
Referenced by dump_object(), dump_stack_trace(), and print().
| struct cons_pointer fetch_arg | ( | struct stack_frame * | frame, |
| unsigned int | index | ||
| ) |
Fetch a pointer to the value of the local variable at this index.
Definition at line 286 of file stack.c.
References args_in_frame, NIL, and pointer2cell.
Referenced by lisp_append(), lisp_let(), and lisp_list().
| void free_stack_frame | ( | struct stack_frame * | frame | ) |
Free this stack frame.
Definition at line 224 of file stack.c.
References stack_frame::arg, args_in_frame, DEBUG_ALLOC, debug_print(), dec_ref(), stack_frame::more, and nilp.
Referenced by free_vso().
| struct stack_frame * get_stack_frame | ( | struct cons_pointer | pointer | ) |
get the actual stackframe object from this pointer, or NULL if pointer is not a stackframe pointer.
Definition at line 53 of file stack.c.
References debug_print(), debug_printf(), DEBUG_STACK, vector_space_object::payload, pointer2cell, stackframep, and vectorpointp.
Referenced by c_apply(), dump_frame(), dump_stack_trace(), eval_form(), free_vso(), lisp_repl(), make_empty_frame(), make_special_frame(), make_stack_frame(), and repl().
| struct cons_pointer make_empty_frame | ( | struct cons_pointer | previous | ) |
Make an empty stack frame, and return it.
| previous | the current top-of-stack; |
| env | the environment in which evaluation happens. |
Definition at line 75 of file stack.c.
References stack_frame::arg, stack_frame::args, args_in_frame, DEBUG_ALLOC, debug_dump_object(), debug_print(), stack_frame::function, get_stack_frame(), make_vso(), stack_frame::more, NIL, nilp, stack_frame::previous, and STACKFRAMETV.
Referenced by eval_form(), make_special_frame(), and make_stack_frame().
| struct cons_pointer make_special_frame | ( | struct cons_pointer | previous, |
| struct cons_pointer | args, | ||
| struct cons_pointer | env | ||
| ) |
A 'special' frame is exactly like a normal stack frame except that the arguments are unevaluated.
| previous | the previous stack frame; |
| args | a list of the arguments to be stored in this stack frame; |
| env | the execution environment; |
Definition at line 183 of file stack.c.
References stack_frame::args, args_in_frame, c_string_to_lisp_string(), consp, debug_dump_object(), debug_print(), DEBUG_STACK, exceptionp, get_stack_frame(), inc_ref(), make_empty_frame(), make_exception(), stack_frame::more, nilp, cons_space_object::payload, pointer2cell, and set_reg().
Referenced by c_apply().
| struct cons_pointer make_stack_frame | ( | struct cons_pointer | previous, |
| struct cons_pointer | args, | ||
| struct cons_pointer | env | ||
| ) |
Allocate a new stack frame with its previous pointer set to this value, its arguments set up from these args, evaluated in this env.
| previous | the current top-of-stack; @args the arguments to load into this frame; |
| env | the environment in which evaluation happens. |
Definition at line 116 of file stack.c.
References stack_frame::args, args_in_frame, c_string_to_lisp_string(), consp, debug_dump_object(), debug_print(), debug_print_object(), debug_printf(), DEBUG_STACK, eval_form(), eval_forms(), exceptionp, get_stack_frame(), inc_ref(), make_empty_frame(), make_exception(), stack_frame::more, nilp, cons_space_object::payload, pointer2cell, and set_reg().
| void set_reg | ( | struct stack_frame * | frame, |
| int | reg, | ||
| struct cons_pointer | value | ||
| ) |
set a register in a stack frame.
Alwaye use this to do so, because that way we can be sure the inc_ref happens!
Definition at line 33 of file stack.c.
References stack_frame::arg, stack_frame::args, debug_print_object(), debug_printf(), debug_println(), DEBUG_STACK, dec_ref(), and inc_ref().
Referenced by eval_form(), lisp_apply(), make_special_frame(), and make_stack_frame().