Post Scarcity
A prototype for a post scarcity programming environment
Loading...
Searching...
No Matches
init.c
Go to the documentation of this file.
1/*
2 * init.c
3 *
4 * Start up and initialise the environement - just enough to get working
5 * and (ultimately) hand off to the executive.
6 *
7 *
8 * (c) 2017 Simon Brooke <simon@journeyman.cc>
9 * Licensed under GPL version 2.0, or, at your option, any later version.
10 */
11
12#include <getopt.h>
13#include <locale.h>
14#include <stdbool.h>
15#include <stdio.h>
16#include <stdlib.h>
17#include <unistd.h>
18#include <wchar.h>
19
20/* libcurl, used for io */
21#include <curl/curl.h>
22
23#include "arith/ratio.h"
24#include "version.h"
25#include "memory/conspage.h"
27#include "memory/stack.h"
28#include "debug.h"
29#include "memory/hashmap.h"
30#include "ops/intern.h"
31#include "io/io.h"
32#include "io/fopen.h"
33#include "ops/lispops.h"
34#include "ops/meta.h"
35#include "arith/peano.h"
36#include "io/print.h"
37#include "repl.h"
38#include "io/fopen.h"
39#include "time/psse_time.h"
40
41/**
42 * @brief If `pointer` is an exception, display that exception to stderr,
43 * decrement that exception, and return NIL; else return the pointer.
44 *
45 * @param pointer a cons pointer.
46 * @param location_descriptor a description of where the pointer was caught.
47 * @return struct cons_pointer
48 */
50 char *location_descriptor ) {
51 struct cons_pointer result = NIL;
52
53 struct cons_space_object *object = &pointer2cell( pointer );
54
55 if ( exceptionp( pointer ) ) {
56 fprintf( stderr, "ERROR: Exception at %s: ", location_descriptor );
57 URL_FILE *ustderr = file_to_url_file( stderr );
58 fwide( stderr, 1 );
59 print( ustderr, object->payload.exception.payload );
60 free( ustderr );
61
62 dec_ref( pointer );
63 } else {
64 result = pointer;
65 }
66
67 return result;
68}
69
72
84
89
90/**
91 * Bind this compiled `executable` function, as a Lisp function, to
92 * this name in the `oblist`.
93 * \todo where a function is not compiled from source, we could cache
94 * the name on the source pointer. Would make stack frames potentially
95 * more readable and aid debugging generally.
96 */
97struct cons_pointer bind_function( wchar_t *name,
98 struct cons_pointer ( *executable )
99 ( struct stack_frame *,
100 struct cons_pointer,
101 struct cons_pointer ) ) {
102 struct cons_pointer n = c_string_to_lisp_symbol( name );
103 struct cons_pointer meta =
106 NIL ) );
107
108 struct cons_pointer r =
109 check_exception( deep_bind( n, make_function( meta, executable ) ),
110 "bind_function" );
111
112 dec_ref( n );
113
114 return r;
115}
116
117/**
118 * Bind this compiled `executable` function, as a Lisp special form, to
119 * this `name` in the `oblist`.
120 */
121struct cons_pointer bind_special( wchar_t *name,
122 struct cons_pointer ( *executable )
123 ( struct stack_frame *, struct cons_pointer,
124 struct cons_pointer ) ) {
125 struct cons_pointer n = c_string_to_lisp_symbol( name );
126
127 struct cons_pointer meta =
130
131 struct cons_pointer r =
132 check_exception( deep_bind( n, make_special( meta, executable ) ),
133 "bind_special" );
134
135 dec_ref( n );
136
137 return r;
138}
139
140/**
141 * Bind this `value` to this `symbol` in the `oblist`.
142 */
143struct cons_pointer
144bind_symbol_value( struct cons_pointer symbol, struct cons_pointer value,
145 bool lock ) {
146 struct cons_pointer r = check_exception( deep_bind( symbol, value ),
147 "bind_symbol_value" );
148
149 if ( lock && !exceptionp( r ) ) {
150 struct cons_space_object *cell = &pointer2cell( r );
151
152 cell->count = UINT32_MAX;
153 }
154
155 return r;
156}
157
158/**
159 * Bind this `value` to this `name` in the `oblist`.
160 */
161struct cons_pointer bind_value( wchar_t *name, struct cons_pointer value,
162 bool lock ) {
163 struct cons_pointer p = c_string_to_lisp_symbol( name );
164
165 struct cons_pointer r = bind_symbol_value( p, value, lock );
166
167 dec_ref( p );
168
169 return r;
170}
171
173 fwprintf( stdout, L"Post-Scarcity Software Environment version %s\n\n",
174 VERSION );
175}
176
177/**
178 * Print command line options to this `stream`.
179 *
180 * @stream the stream to print to.
181 */
182void print_options( FILE *stream ) {
183 fwprintf( stream, L"Expected options are:\n" );
184 fwprintf( stream,
185 L"\t-d\tDump memory to standard out at end of run (copious!);\n" );
186 fwprintf( stream, L"\t-h\tPrint this message and exit;\n" );
187 fwprintf( stream, L"\t-p\tShow a prompt (default is no prompt);\n" );
188 fwprintf( stream,
189 L"\t-v LEVEL\n\t\tSet verbosity to the specified level (0...512)\n" );
190 fwprintf( stream, L"\t\tWhere bits are interpreted as follows:\n" );
191 fwprintf( stream, L"\t\t1\tALLOC;\n" );
192 fwprintf( stream, L"\t\t2\tARITH;\n" );
193 fwprintf( stream, L"\t\t4\tBIND;\n" );
194 fwprintf( stream, L"\t\t8\tBOOTSTRAP;\n" );
195 fwprintf( stream, L"\t\t16\tEVAL;\n" );
196 fwprintf( stream, L"\t\t32\tINPUT/OUTPUT;\n" );
197 fwprintf( stream, L"\t\t64\tLAMBDA;\n" );
198 fwprintf( stream, L"\t\t128\tREPL;\n" );
199 fwprintf( stream, L"\t\t256\tSTACK.\n" );
200}
201
202/**
203 * main entry point; parse command line arguments, initialise the environment,
204 * and enter the read-eval-print loop.
205 */
206int main( int argc, char *argv[] ) {
207 int option;
208 bool dump_at_end = false;
209 bool show_prompt = false;
210 char *infilename = NULL;
211
212 setlocale( LC_ALL, "" );
213 if ( io_init( ) != 0 ) {
214 fputs( "Failed to initialise I/O subsystem\n", stderr );
215 exit( 1 );
216 }
217
218 while ( ( option = getopt( argc, argv, "phdv:i:" ) ) != -1 ) {
219 switch ( option ) {
220 case 'd':
221 dump_at_end = true;
222 break;
223 case 'h':
224 print_banner( );
225 print_options( stdout );
226 exit( 0 );
227 break;
228 case 'i':
229 infilename = optarg;
230 break;
231 case 'p':
232 show_prompt = true;
233 break;
234 case 'v':
235 verbosity = atoi( optarg );
236 break;
237 default:
238 fwprintf( stderr, L"Unexpected option %c\n", option );
239 print_options( stderr );
240 exit( 1 );
241 break;
242 }
243 }
244
246
248
249
250 if ( show_prompt ) {
251 print_banner( );
252 }
253
254 debug_print( L"About to initialise oblist\n", DEBUG_BOOTSTRAP );
255
256 oblist = make_hashmap( 32, NIL, TRUE );
257
258 debug_print( L"About to bind\n", DEBUG_BOOTSTRAP );
259
260 /*
261 * privileged variables (keywords)
262 */
264 bind_value( L"t", TRUE, true );
265
266 /*
267 * standard input, output, error and sink streams
268 * attempt to set wide character acceptance on all streams
269 */
270 URL_FILE *sink = url_fopen( "/dev/null", "w" );
271 fwide( stdin, 1 );
272 fwide( stdout, 1 );
273 fwide( stderr, 1 );
274 fwide( sink->handle.file, 1 );
275
276 FILE *infile = infilename == NULL ? stdin : fopen( infilename, "r" );
277
278
279 lisp_io_in =
284 ( L"url" ),
286 ( L"system:standard input" ) ),
287 NIL ) ), false );
293 ( L"url" ),
295 ( L"system:standard output]" ) ),
296 NIL ) ), false );
297 bind_value( L"*log*",
301 ( L"url" ),
303 ( L"system:standard log" ) ),
304 NIL ) ), false );
305 bind_value( L"*sink*",
306 make_write_stream( sink,
309 ( L"url" ),
311 ( L"system:standard sink" ) ),
312 NIL ) ), false );
313 /*
314 * the default prompt
315 */
316 prompt_name = bind_value( L"*prompt*",
317 show_prompt ? c_string_to_lisp_symbol( L":: " ) :
318 NIL, false );
319 /*
320 * primitive function operations
321 */
322 bind_function( L"absolute", &lisp_absolute );
323 bind_function( L"add", &lisp_add );
324 bind_function( L"append", &lisp_append );
325 bind_function( L"apply", &lisp_apply );
326 bind_function( L"assoc", &lisp_assoc );
327 bind_function( L"car", &lisp_car );
328 bind_function( L"cdr", &lisp_cdr );
329 bind_function( L"close", &lisp_close );
330 bind_function( L"cons", &lisp_cons );
331 bind_function( L"divide", &lisp_divide );
332 bind_function( L"eq", &lisp_eq );
333 bind_function( L"equal", &lisp_equal );
334 bind_function( L"eval", &lisp_eval );
335 bind_function( L"exception", &lisp_exception );
336 bind_function( L"get-hash", &lisp_get_hash );
337 bind_function( L"hashmap", lisp_make_hashmap );
338 bind_function( L"inspect", &lisp_inspect );
339 bind_function( L"keys", &lisp_keys );
340 bind_function( L"list", &lisp_list );
341 bind_function( L"mapcar", &lisp_mapcar );
342 bind_function( L"meta", &lisp_metadata );
343 bind_function( L"metadata", &lisp_metadata );
344 bind_function( L"multiply", &lisp_multiply );
345 bind_function( L"negative?", &lisp_is_negative );
346 bind_function( L"oblist", &lisp_oblist );
347 bind_function( L"open", &lisp_open );
348 bind_function( L"print", &lisp_print );
350 bind_function( L"put-all!", &lisp_hashmap_put_all );
351 bind_function( L"ratio->real", &lisp_ratio_to_real );
352 bind_function( L"read", &lisp_read );
353 bind_function( L"read-char", &lisp_read_char );
354 bind_function( L"repl", &lisp_repl );
355 bind_function( L"reverse", &lisp_reverse );
356 bind_function( L"set", &lisp_set );
357 bind_function( L"slurp", &lisp_slurp );
358 bind_function( L"source", &lisp_source );
359 bind_function( L"subtract", &lisp_subtract );
360 bind_function( L"throw", &lisp_exception );
361 bind_function( L"time", &lisp_time );
362 bind_function( L"type", &lisp_type );
363 bind_function( L"+", &lisp_add );
366 bind_function( L"/", &lisp_divide );
367 bind_function( L"=", &lisp_equal );
368 /*
369 * primitive special forms
370 */
371 bind_special( L"cond", &lisp_cond );
372 bind_special( L"lambda", &lisp_lambda );
373 bind_special( L"\u03bb", &lisp_lambda ); // λ
374 bind_special( L"let", &lisp_let );
375 bind_special( L"nlambda", &lisp_nlambda );
376 bind_special( L"n\u03bb", &lisp_nlambda );
377 bind_special( L"progn", &lisp_progn );
378 bind_special( L"quote", &lisp_quote );
379 bind_special( L"set!", &lisp_set_shriek );
380 bind_special( L"try", &lisp_try );
381 debug_print( L"Initialised oblist\n", DEBUG_BOOTSTRAP );
383
384 repl( show_prompt );
385
387 if ( dump_at_end ) {
388 dump_pages( file_to_url_file( stdout ) );
389 }
390
391 debug_print( L"Freeing oblist\n", DEBUG_BOOTSTRAP );
392 dec_ref( oblist );
394
396 curl_global_cleanup( );
397 return ( 0 );
398}
void dump_pages(URL_FILE *output)
dump the allocated pages to this output stream.
Definition conspage.c:124
void summarise_allocation()
Definition conspage.c:271
void initialise_cons_pages()
initialise the cons page system; to be called exactly once during startup.
Definition conspage.c:257
struct cons_pointer make_special(struct cons_pointer meta, struct cons_pointer(*executable)(struct stack_frame *frame, struct cons_pointer, struct cons_pointer env))
Construct a cell which points to an executable Lisp special form.
struct cons_pointer c_string_to_lisp_keyword(wchar_t *symbol)
Return a lisp keyword representation of this wide character string.
struct cons_pointer make_function(struct cons_pointer meta, struct cons_pointer(*executable)(struct stack_frame *, struct cons_pointer, struct cons_pointer))
Construct a cell which points to an executable Lisp function.
struct cons_pointer make_write_stream(URL_FILE *output, struct cons_pointer metadata)
Construct a cell which points to a stream open for writing.
struct cons_pointer c_string_to_lisp_string(wchar_t *string)
Return a lisp string representation of this wide character string.
struct cons_pointer make_read_stream(URL_FILE *input, struct cons_pointer metadata)
Construct a cell which points to a stream open for reading.
struct cons_pointer c_string_to_lisp_symbol(wchar_t *symbol)
Return a lisp symbol representation of this wide character string.
struct cons_pointer dec_ref(struct cons_pointer pointer)
Decrement the reference count of the object at this cons pointer.
struct cons_pointer make_cons(struct cons_pointer car, struct cons_pointer cdr)
Construct a cons cell from this pair of pointers.
#define exceptionp(conspoint)
true if conspoint points to an exception, else false
union cons_space_object::@3 payload
#define NIL
a cons pointer which points to the special NIL cell
#define nilp(conspoint)
true if conspoint points to the special cell NIL, else false (there should only be one of these so it...
uint32_t count
the count of the number of references to this cell
#define TRUE
a cons pointer which points to the special T cell
struct cons_pointer c_string_to_lisp_symbol(wchar_t *symbol)
Return a lisp symbol representation of this wide character string.
struct cons_pointer dec_ref(struct cons_pointer pointer)
Decrement the reference count of the object at this cons pointer.
#define pointer2cell(pointer)
given a cons_pointer as argument, return the cell.
An indirect pointer to a cons cell.
an object in cons space.
A stack frame.
int verbosity
the controlling flags for debug_print; set in init.c, q.v.
Definition debug.c:33
void debug_dump_object(struct cons_pointer pointer, int level)
Like dump_object, q.v., but protected by the verbosity mechanism.
Definition debug.c:136
void debug_print(wchar_t *message, int level)
print this debug message to stderr, if verbosity matches level.
Definition debug.c:41
#define DEBUG_BOOTSTRAP
Print messages debugging bootstrapping and teardown.
Definition debug.h:42
URL_FILE * url_fopen(const char *url, const char *operation)
Definition fopen.c:202
union fcurl_data::@0 handle
struct cons_pointer lisp_hashmap_put_all(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Lisp function expecting two arguments, a hashmap and an assoc list.
Definition hashmap.c:126
struct cons_pointer lisp_get_hash(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
A lisp function signature conforming wrapper around get_hash, q.v.
Definition hashmap.c:25
struct cons_pointer lisp_hashmap_put(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Expects frame->arg[1] to be a hashmap or namespace; frame->arg[2] to be a string-like-thing (perhaps ...
Definition hashmap.c:106
struct cons_pointer lisp_make_hashmap(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Lisp funtion of up to four args (all optional), where.
Definition hashmap.c:39
struct cons_pointer check_exception(struct cons_pointer pointer, char *location_descriptor)
If pointer is an exception, display that exception to stderr, decrement that exception,...
Definition init.c:49
int main(int argc, char *argv[])
main entry point; parse command line arguments, initialise the environment, and enter the read-eval-p...
Definition init.c:206
void maybe_bind_init_symbols()
Definition init.c:73
void print_options(FILE *stream)
Print command line options to this stream.
Definition init.c:182
struct cons_pointer bind_special(wchar_t *name, struct cons_pointer(*executable)(struct stack_frame *, struct cons_pointer, struct cons_pointer))
Bind this compiled executable function, as a Lisp special form, to this name in the oblist.
Definition init.c:121
struct cons_pointer bind_function(wchar_t *name, struct cons_pointer(*executable)(struct stack_frame *, struct cons_pointer, struct cons_pointer))
Bind this compiled executable function, as a Lisp function, to this name in the oblist.
Definition init.c:97
struct cons_pointer init_name_symbol
Definition init.c:70
struct cons_pointer init_primitive_symbol
Definition init.c:71
void free_init_symbols()
Definition init.c:85
void print_banner()
Definition init.c:172
struct cons_pointer bind_symbol_value(struct cons_pointer symbol, struct cons_pointer value, bool lock)
Bind this value to this symbol in the oblist.
Definition init.c:144
struct cons_pointer bind_value(wchar_t *name, struct cons_pointer value, bool lock)
Bind this value to this name in the oblist.
Definition init.c:161
struct cons_pointer privileged_symbol_nil
the symbol NIL, which is special!
Definition intern.c:54
struct cons_pointer make_hashmap(uint32_t n_buckets, struct cons_pointer hash_fn, struct cons_pointer write_acl)
Make a hashmap with this number of buckets, using this hash_fn.
Definition intern.c:137
struct cons_pointer oblist
The global object list/or, to put it differently, the root namespace.
Definition intern.c:48
struct cons_pointer deep_bind(struct cons_pointer key, struct cons_pointer value)
Binds this key to this value in the global oblist.
Definition intern.c:447
int io_init()
Initialise the I/O subsystem.
Definition io.c:69
struct cons_pointer lisp_io_in
bound to the Lisp string representing C_IO_IN in initialisation.
Definition io.c:51
struct cons_pointer lisp_open(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Function: return a stream open on the URL indicated by the first argument; if a second argument is pr...
Definition io.c:437
struct cons_pointer lisp_io_out
bound to the Lisp string representing C_IO_OUT in initialisation.
Definition io.c:55
struct cons_pointer lisp_slurp(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Function: return a string representing all characters from the stream indicated by arg 0; further arg...
Definition io.c:533
URL_FILE * file_to_url_file(FILE *f)
given this file handle f, return a new url_file handle wrapping it.
Definition io.c:134
struct cons_pointer lisp_close(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Function, sort-of: close the file indicated by my first arg, and return nil.
Definition io.c:254
struct cons_pointer lisp_read_char(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Function: return the next character from the stream indicated by arg 0; further arguments are ignored...
Definition io.c:504
#define C_IO_IN
Definition io.h:20
#define C_IO_OUT
Definition io.h:21
struct cons_pointer lisp_nlambda(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Construct an interpretable special form.
Definition lispops.c:240
struct cons_pointer lisp_assoc(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Function; look up the value of a key in a store.
Definition lispops.c:835
struct cons_pointer lisp_source(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Function.
Definition lispops.c:1377
struct cons_pointer lisp_mapcar(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Definition lispops.c:1468
struct cons_pointer lisp_cons(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Function; returns a cell constructed from a and b.
Definition lispops.c:702
struct cons_pointer lisp_eq(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Function; are these two objects the same object? Shallow, cheap equality.
Definition lispops.c:870
struct cons_pointer lisp_read(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Function; read one complete lisp form and return it.
Definition lispops.c:906
struct cons_pointer lisp_exception(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Function; create an exception.
Definition lispops.c:1244
struct cons_pointer lisp_car(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Function; returns the first item (head) of a sequence.
Definition lispops.c:735
struct cons_pointer lisp_let(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Special form: evaluate a series of forms in an environment in which these bindings are bound.
Definition lispops.c:1528
struct cons_pointer lisp_inspect(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Function: dump/inspect one complete lisp expression and return NIL.
Definition lispops.c:1001
struct cons_pointer lisp_try(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
OK, the idea here (and I know this is less than perfect) is that the basic try special form in PSSE t...
Definition lispops.c:157
struct cons_pointer lisp_apply(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Function; apply the function which is the result of evaluating the first argument to the list of valu...
Definition lispops.c:564
struct cons_pointer lisp_eval(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Function; evaluate the expression which is the first argument in the frame; further arguments are ign...
Definition lispops.c:504
struct cons_pointer lisp_type(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Function: get the Lisp type of the single argument.
Definition lispops.c:1086
struct cons_pointer lisp_progn(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Special form; evaluate the expressions which are listed in my arguments sequentially and return the v...
Definition lispops.c:1127
struct cons_pointer lisp_keys(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Definition lispops.c:854
struct cons_pointer lisp_equal(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Function; are these two arguments identical? Deep, expensive equality.
Definition lispops.c:887
struct cons_pointer lisp_repl(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Function: the read/eval/print loop.
Definition lispops.c:1263
struct cons_pointer lisp_set_shriek(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Special form; binds symbol in the namespace to value of value, altering the namespace in so doing,...
Definition lispops.c:654
struct cons_pointer lisp_append(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
should really be overwritten with a version in Lisp, since this is much easier to write in Lisp
Definition lispops.c:1456
struct cons_pointer lisp_quote(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Special form; returns its argument (strictly first argument - only one is expected but this isn't at ...
Definition lispops.c:594
struct cons_pointer lisp_set(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Function; binds the value of name in the namespace to value of value, altering the namespace in so do...
Definition lispops.c:616
struct cons_pointer lisp_lambda(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Construct an interpretable function.
Definition lispops.c:223
struct cons_pointer lisp_print(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Function; print one complete lisp expression and return NIL.
Definition lispops.c:1040
struct cons_pointer lisp_cdr(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Function; returns the remainder of a sequence when the head is removed.
Definition lispops.c:779
struct cons_pointer lisp_list(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Definition lispops.c:1510
struct cons_pointer lisp_oblist(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Return the object list (root namespace).
Definition lispops.c:186
struct cons_pointer lisp_cond(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Special form: conditional.
Definition lispops.c:1161
struct cons_pointer lisp_reverse(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Function; reverse the order of members in s sequence.
Definition lispops.c:981
struct cons_pointer prompt_name
the name of the symbol to which the prompt is bound;
Definition lispops.c:46
struct cons_pointer lisp_metadata(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Function: get metadata describing my first argument.
Definition meta.c:20
struct cons_pointer lisp_absolute(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Function: calculate the absolute value of a number.
Definition peano.c:207
struct cons_pointer lisp_ratio_to_real(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Function: return a real (approcimately) equal in value to the ratio which is the first argument.
Definition peano.c:755
struct cons_pointer lisp_is_negative(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Function: is this number negative?
Definition peano.c:531
struct cons_pointer lisp_subtract(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Subtract one number from another.
Definition peano.c:640
struct cons_pointer lisp_divide(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Divide one number by another.
Definition peano.c:655
struct cons_pointer lisp_multiply(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Multiply an indefinite number of numbers together.
Definition peano.c:453
struct cons_pointer lisp_add(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Add an indefinite number of numbers together.
Definition peano.c:314
struct cons_pointer print(URL_FILE *output, struct cons_pointer pointer)
Print the cons-space object indicated by pointer to the stream indicated by output.
Definition print.c:151
struct cons_pointer lisp_time(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Function; return a time representation of the first argument in the frame; further arguments are igno...
Definition psse_time.c:86
void repl()
The read/eval/print loop.
Definition repl.c:33
#define VERSION
version.h
Definition version.h:11