Post Scarcity 0.0.6
A prototype for a post scarcity programming environment
Loading...
Searching...
No Matches
consspaceobject.h
Go to the documentation of this file.
1/*
2 * consspaceobject.h
3 *
4 * Declarations common to all cons space objects.
5 *
6 *
7 * (c) 2017 Simon Brooke <simon@journeyman.cc>
8 * Licensed under GPL version 2.0, or, at your option, any later version.
9 */
10
11#ifndef __psse_consspaceobject_h
12#define __psse_consspaceobject_h
13
14#include <stdbool.h>
15#include <stdint.h>
16#include <stdio.h>
17/*
18 * wide characters
19 */
20#include <wchar.h>
21#include <wctype.h>
22
23#include "io/fopen.h"
24// #include "memory/conspage.h"
25
26
27/**
28 * The length of a tag, in bytes.
29 */
30#define TAGLENGTH 4
31
32/*
33 * tag values, all of which must be 4 bytes. Must not collide with vector space
34 * tag values
35 */
36
37/**
38 * An ordinary cons cell:
39 */
40#define CONSTAG "CONS"
41
42/**
43 * The string `CONS`, considered as an `unsigned int`.
44 * @todo tag values should be collected into an enum.
45 */
46#define CONSTV 1397641027
47
48/**
49 * An exception. TODO: we need a means of dealing with different classes of
50 * exception, and we don't have one yet.
51 */
52#define EXCEPTIONTAG "EXEP"
53
54/**
55 * The string `EXEP`, considered as an `unsigned int`.
56 */
57#define EXCEPTIONTV 1346721861
58
59/**
60 * Keywords used when constructing exceptions: `:location`. Instantiated in
61 * `init.c`.
62 */
64
65/**
66 * Keywords used when constructing exceptions: `:payload`. Instantiated in
67 * `init.c`.
68 */
70
71/**
72 * Keywords used when constructing exceptions: `:cause`. Instantiated in
73 * `init.c`.
74 */
76
77/**
78 * @brief keywords used in documentation: `:documentation`. Instantiated in
79 * `init.c`, q. v.
80 */
82
83/**
84 * @brief keywords used in documentation: `:name`. Instantiated in
85 * `init.c`, q. v.
86 */
88
89/**
90 * @brief keywords used in documentation: `:primitive`. Instantiated in
91 * `init.c`, q. v.
92 */
94
95/**
96 * An unallocated cell on the free list - should never be encountered by a Lisp
97 * function.
98 */
99#define FREETAG "FREE"
100
101/**
102 * The string `FREE`, considered as an `unsigned int`.
103 */
104#define FREETV 1162170950
105
106/**
107 * An ordinary Lisp function - one whose arguments are pre-evaluated.
108 * \see LAMBDATAG for interpretable functions.
109 * \see SPECIALTAG for functions whose arguments are not pre-evaluated.
110 */
111#define FUNCTIONTAG "FUNC"
112
113/**
114 * The string `FUNC`, considered as an `unsigned int`.
115 */
116#define FUNCTIONTV 1129207110
117
118/**
119 * An integer number (bignums are integers).
120 */
121#define INTEGERTAG "INTR"
122
123/**
124 * The string `INTR`, considered as an `unsigned int`.
125 */
126#define INTEGERTV 1381256777
127
128/**
129 * A keyword - an interned, self-evaluating string.
130 */
131#define KEYTAG "KEYW"
132
133/**
134 * The string `KEYW`, considered as an `unsigned int`.
135 */
136#define KEYTV 1465468235
137
138/**
139 * A lambda cell. Lambdas are the interpretable (source) versions of functions.
140 * \see FUNCTIONTAG.
141 */
142#define LAMBDATAG "LMDA"
143
144/**
145 * The string `LMDA`, considered as an `unsigned int`.
146 */
147#define LAMBDATV 1094995276
148
149/**
150 * A loop exit is a special kind of exception which has exactly the same
151 * payload as an exception.
152 */
153#define LOOPTAG "LOOP"
154
155/**
156 * The string `LOOX`, considered as an `unsigned int`.
157 */
158#define LOOPTV 1347374924
159
160/**
161 * @brief Tag for a lazy cons cell.
162 *
163 * A lazy cons cell is like a cons cell, but lazy.
164 *
165 */
166#define LAZYCONSTAG "LZYC"
167
168/**
169 * @brief Tag for a lazy string cell.
170 *
171 * A lazy string cell is like a string cell, but lazy.
172 *
173 */
174#define LAZYSTRTAG "LZYS"
175
176/**
177 * @brief Tag for a lazy worker cell.
178 *
179 * A lazy
180 *
181 */
182#define LAZYWRKRTAG "WRKR"
183
184/**
185 * The special cons cell at address {0,0} whose car and cdr both point to
186 * itself.
187 */
188#define NILTAG "NIL "
189
190/**
191 * The string `NIL `, considered as an `unsigned int`.
192 */
193#define NILTV 541870414
194
195/**
196 * An nlambda cell. NLambdas are the interpretable (source) versions of special
197 * forms. \see SPECIALTAG.
198 */
199#define NLAMBDATAG "NLMD"
200
201/**
202 * The string `NLMD`, considered as an `unsigned int`.
203 */
204#define NLAMBDATV 1145916494
205
206/**
207 * A rational number, stored as pointers two integers representing dividend
208 * and divisor respectively.
209 */
210#define RATIOTAG "RTIO"
211
212/**
213 * The string `RTIO`, considered as an `unsigned int`.
214 */
215#define RATIOTV 1330205778
216
217/**
218 * An open read stream.
219 */
220#define READTAG "READ"
221
222/**
223 * The string `READ`, considered as an `unsigned int`.
224 */
225#define READTV 1145128274
226
227/**
228 * A real number, represented internally as an IEEE 754-2008 `binary128`.
229 */
230#define REALTAG "REAL"
231
232/**
233 * The string `REAL`, considered as an `unsigned int`.
234 */
235#define REALTV 1279346002
236
237/**
238 * A special form - one whose arguments are not pre-evaluated but passed as
239 * provided.
240 * \see NLAMBDATAG.
241 */
242#define SPECIALTAG "SPFM"
243
244/**
245 * The string `SPFM`, considered as an `unsigned int`.
246 */
247#define SPECIALTV 1296453715
248
249/**
250 * A string of characters, organised as a linked list.
251 */
252#define STRINGTAG "STRG"
253
254/**
255 * The string `STRG`, considered as an `unsigned int`.
256 */
257#define STRINGTV 1196577875
258
259/**
260 * A symbol is just like a keyword except not self-evaluating.
261 */
262#define SYMBOLTAG "SYMB"
263
264/**
265 * The string `SYMB`, considered as an `unsigned int`.
266 */
267#define SYMBOLTV 1112365395
268
269/**
270 * A time stamp.
271 */
272#define TIMETAG "TIME"
273
274/**
275 * The string `TIME`, considered as an `unsigned int`.
276 */
277#define TIMETV 1162692948
278
279/**
280 * The special cons cell at address {0,1} which is canonically different
281 * from NIL.
282 */
283#define TRUETAG "TRUE"
284
285/**
286 * The string `TRUE`, considered as an `unsigned int`.
287 */
288#define TRUETV 1163219540
289
290/**
291 * A pointer to an object in vector space.
292 */
293#define VECTORPOINTTAG "VECP"
294
295/**
296 * The string `VECP`, considered as an `unsigned int`.
297 */
298#define VECTORPOINTTV 1346585942
299
300/**
301 * An open write stream.
302 */
303#define WRITETAG "WRIT"
304
305/**
306 * The string `WRIT`, considered as an `unsigned int`.
307 */
308#define WRITETV 1414091351
309
310/**
311 * a cons pointer which points to the special NIL cell
312 */
313#define NIL (struct cons_pointer){ 0, 0}
314
315/**
316 * a cons pointer which points to the special T cell
317 */
318#define TRUE (struct cons_pointer){ 0, 1}
319
320/**
321 * the maximum possible value of a reference count
322 */
323#define MAXREFERENCE 4294967295
324
325/**
326 * a macro to convert a tag into a number
327 */
328#define tag2uint(tag) ((uint32_t)*tag)
329
330/**
331 * given a cons_pointer as argument, return the cell.
332 */
333#define pointer2cell(pointer) ((conspages[pointer.page]->cell[pointer.offset]))
334
335/**
336 * true if `conspoint` points to the special cell NIL, else false
337 * (there should only be one of these so it's slightly redundant).
338 */
339#define nilp(conspoint) (check_tag(conspoint,NILTV))
340
341/**
342 * true if `conspoint` points to a cons cell, else false
343 */
344#define consp(conspoint) (check_tag(conspoint,CONSTV))
345
346/**
347 * true if `conspoint` points to an exception, else false
348 */
349#define exceptionp(conspoint) (check_tag(conspoint,EXCEPTIONTV))
350
351/**
352 * true if `conspoint` points to an unassigned cell, else false
353 */
354#define freep(conspoint) (check_tag(conspoint,FREETV))
355
356/**
357 * true if `conspoint` points to a function cell, else false
358 */
359#define functionp(conspoint) (check_tag(conspoint,FUNCTIONTV))
360
361/**
362 * true if `conspoint` points to a keyword, else false
363 */
364#define keywordp(conspoint) (check_tag(conspoint,KEYTV))
365
366/**
367 * true if `conspoint` points to a Lambda binding cell, else false
368 */
369#define lambdap(conspoint) (check_tag(conspoint,LAMBDATV))
370
371/**
372 * true if `conspoint` points to a loop recursion, else false.
373 */
374#define loopp(conspoint) (check_tag(conspoint,LOOPTV))
375
376/**
377 * true if `conspoint` points to a special form cell, else false
378 */
379#define specialp(conspoint) (check_tag(conspoint,SPECIALTV))
380
381/**
382 * true if `conspoint` points to a string cell, else false
383 */
384#define stringp(conspoint) (check_tag(conspoint,STRINGTV))
385
386/**
387 * true if `conspoint` points to a symbol cell, else false
388 */
389#define symbolp(conspoint) (check_tag(conspoint,SYMBOLTV))
390
391/**
392 * true if `conspoint` points to an integer cell, else false
393 */
394#define integerp(conspoint) (check_tag(conspoint,INTEGERTV))
395
396/**
397 * true if `conspoint` points to a rational number cell, else false
398 */
399#define ratiop(conspoint) (check_tag(conspoint,RATIOTV))
400
401/**
402 * true if `conspoint` points to a read stream cell, else false
403 */
404#define readp(conspoint) (check_tag(conspoint,READTV))
405
406/**
407 * true if `conspoint` points to a real number cell, else false
408 */
409#define realp(conspoint) (check_tag(conspoint,REALTV))
410
411/**
412 * true if `conspoint` points to some sort of a number cell,
413 * else false
414 */
415#define numberp(conspoint) (check_tag(conspoint,INTEGERTV)||check_tag(conspoint,RATIOTV)||check_tag(conspoint,REALTV))
416
417/**
418 * true if `conspoint` points to a sequence (list, string or, later, vector),
419 * else false.
420 */
421#define sequencep(conspoint) (check_tag(conspoint,CONSTV)||check_tag(conspoint,STRINGTV)||check_tag(conspoint,SYMBOLTV))
422
423/**
424 * true if `conspoint` points to a vector pointer, else false.
425 */
426#define vectorpointp(conspoint) (check_tag(conspoint,VECTORPOINTTV))
427
428/**
429 * true if `conspoint` points to a write stream cell, else false.
430 */
431#define writep(conspoint) (check_tag(conspoint,WRITETV))
432
433#define streamp(conspoint) (check_tag(conspoint,READTV)||check_tag(conspoint,WRITETV))
434
435/**
436 * true if `conspoint` points to a true cell, else false
437 * (there should only be one of these so it's slightly redundant).
438 * Also note that anything that is not NIL is truthy.
439 */
440#define tp(conspoint) (check_tag(conspoint,TRUETV))
441
442/**
443 * true if `conspoint` points to a time cell, else false.
444 */
445#define timep(conspoint) (check_tag(conspoint,TIMETV))
446
447/**
448 * true if `conspoint` points to something that is truthy, i.e.
449 * anything but NIL.
450 */
451#define truep(conspoint) (!check_tag(conspoint,NILTV))
452
453/**
454 * An indirect pointer to a cons cell
455 */
457 /** the index of the page on which this cell resides */
458 uint32_t page;
459 /** the index of the cell within the page */
460 uint32_t offset;
461};
462
463/*
464 * number of arguments stored in a stack frame
465 */
466#define args_in_frame 8
467
468/**
469 * A stack frame. Yes, I know it isn't a cons-space object, but it's defined
470 * here to avoid circularity. \todo refactor.
471 */
473 /** the previous frame. */
475 /** first 8 arument bindings. */
477 /** list of any further argument bindings. */
479 /** the function to be called. */
481 /** the number of arguments provided. */
482 int args;
483 /** the depth of the stack below this frame */
484 int depth;
485};
486
487/**
488 * payload of a cons cell.
489 */
491 /** Contents of the Address Register, naturally. */
493 /** Contents of the Decrement Register, naturally. */
495};
496
497/**
498 * Payload of an exception.
499 * Message should be a Lisp string; frame should be a pointer to an (unfreed) stack frame.
500 */
502 /** The payload: usually a Lisp string but in practice anything printable will do. */
504 /** pointer to the (unfreed) stack frame in which the exception was thrown. */
506};
507
508/**
509 * Payload of a function cell.
510 * source points to the source from which the function was compiled, or NIL
511 * if it is a primitive.
512 * executable points to a function which takes a pointer to a stack frame
513 * (representing its stack frame) and a cons pointer (representing its
514 * environment) as arguments and returns a cons pointer (representing its
515 * result).
516 */
518 /**
519 * pointer to metadata (e.g. the source from which the function was compiled).
520 */
522 /** pointer to a function which takes a cons pointer (representing
523 * its argument list) and a cons pointer (representing its environment) and a
524 * stack frame (representing the previous stack frame) as arguments and returns
525 * a cons pointer (representing its result).
526 * \todo check this documentation is current!
527 */
528 struct cons_pointer ( *executable ) ( struct stack_frame *,
529 struct cons_pointer,
530 struct cons_pointer );
531};
532
533/**
534 * payload of a free cell. For the time being identical to a cons cell,
535 * but it may not be so in future.
536 */
540};
541
542/**
543 * payload of an integer cell. An integer is in principle a sequence of cells;
544 * only 60 bits (+ sign bit) are actually used in each cell. If the value
545 * exceeds 60 bits, the least significant 60 bits are stored in the first cell
546 * in the chain, the next 60 in the next cell, and so on. Only the value of the
547 * first cell in any chain should be negative.
548 *
549 * \todo Why is this 60, and not 64 bits?
550 */
552 /** the value of the payload (i.e. 60 bits) of this cell. */
554 /** the next (more significant) cell in the chain, or `NIL` if there are no
555 * more. */
557};
558
559/**
560 * payload for lambda and nlambda cells.
561 */
563 /** the arument list */
565 /** the body of the function to be applied to the arguments. */
567};
568
569/**
570 * payload for ratio cells. Both `dividend` and `divisor` must point to integer cells.
571 */
573 /** a pointer to an integer representing the dividend */
575 /** a pointer to an integer representing the divisor. */
577};
578
579/**
580 * payload for a real number cell. Internals of this liable to change to give 128 bits
581 * precision, but I'm not sure of the detail.
582 */
584 /** the value of the number */
585 long double value;
586};
587
588/**
589 * Payload of a special form cell. Currently identical to the payload of a
590 * function cell.
591 * \see function_payload
592 */
594 /**
595 * pointer to the source from which the special form was compiled, or NIL
596 * if it is a primitive.
597 */
599 /** pointer to a function which takes a cons pointer (representing
600 * its argument list) and a cons pointer (representing its environment) and a
601 * stack frame (representing the previous stack frame) as arguments and returns
602 * a cons pointer (representing its result). */
603 struct cons_pointer ( *executable ) ( struct stack_frame *,
604 struct cons_pointer,
605 struct cons_pointer );
606};
607
608/**
609 * payload of a read or write stream cell.
610 */
612 /** the stream to read from or write to. */
614 /** metadata on the stream (e.g. its file attributes if a file, its HTTP
615 * headers if a URL, etc). Expected to be an association, or nil. Not yet
616 * implemented. */
618};
619
620/**
621 * payload of a string cell. At least at first, only one UTF character will
622 * be stored in each cell. The doctrine that 'a symbol is just a string'
623 * didn't work; however, the payload of a symbol or keyword cell is identical
624 * to the payload of a string cell, except that a keyword may store a hash
625 * of its own value in the padding.
626 */
628 /** the actual character stored in this cell */
629 wint_t character;
630 /** a hash of the string value, computed at store time. */
631 uint32_t hash;
632 /** the remainder of the string following this character. */
634};
635
636/**
637 * The payload of a time cell: an unsigned 128 bit value representing micro-
638 * seconds since the estimated date of the Big Bang (actually, for
639 * convenience, 14Bn years before 1st Jan 1970 (the UNIX epoch))
640 */
642 unsigned __int128 value;
643};
644
645/**
646 * payload of a vector pointer cell.
647 */
649 /** the tag of the vector-space object. NOTE that the vector space object
650 * should itself have the identical tag. */
651 union {
652 /** the tag (type) of the vector-space object this cell
653 * points to, considered as bytes. */
654 char bytes[TAGLENGTH];
655 /** the tag considered as a number */
656 uint32_t value;
658 /** unused padding to word-align the address */
659 uint32_t padding;
660 /** the address of the actual vector space
661 * object (\todo will change when I actually
662 * implement vector space) */
663 void *address;
664};
665
666/**
667 * an object in cons space.
668 */
670 union {
671 /** the tag (type) of this cell,
672 * considered as bytes */
673 char bytes[TAGLENGTH];
674 /** the tag considered as a number */
675 uint32_t value;
677 /** the count of the number of references to this cell */
678 uint32_t count;
679 /** cons pointer to the access control list of this cell */
681 union {
682 /**
683 * if tag == CONSTAG
684 */
685 struct cons_payload cons;
686 /**
687 * if tag == EXCEPTIONTAG || tag == LOOPTAG
688 */
689 struct exception_payload exception;
690 /**
691 * if tag == FREETAG
692 */
693 struct free_payload free;
694 /**
695 * if tag == FUNCTIONTAG
696 */
697 struct function_payload function;
698 /**
699 * if tag == INTEGERTAG
700 */
701 struct integer_payload integer;
702 /**
703 * if tag == LAMBDATAG or NLAMBDATAG
704 */
705 struct lambda_payload lambda;
706 /**
707 * if tag == NILTAG; we'll treat the special cell NIL as just a cons
708 */
709 struct cons_payload nil;
710 /**
711 * if tag == RATIOTAG
712 */
713 struct ratio_payload ratio;
714 /**
715 * if tag == READTAG || tag == WRITETAG
716 */
717 struct stream_payload stream;
718 /**
719 * if tag == REALTAG
720 */
721 struct real_payload real;
722 /**
723 * if tag == SPECIALTAG
724 */
725 struct special_payload special;
726 /**
727 * if tag == STRINGTAG || tag == SYMBOLTAG
728 */
729 struct string_payload string;
730 /**
731 * if tag == TIMETAG
732 */
733 struct time_payload time;
734 /**
735 * if tag == TRUETAG; we'll treat the special cell T as just a cons
736 */
737 struct cons_payload t;
738 /**
739 * if tag == VECTORPTAG
740 */
743};
744
745bool check_tag( struct cons_pointer pointer, uint32_t value );
746
747struct cons_pointer inc_ref( struct cons_pointer pointer );
748
749struct cons_pointer dec_ref( struct cons_pointer pointer );
750
751/**
752 * given a cons_pointer as argument, return the tag.
753 */
754uint32_t get_tag_value( struct cons_pointer pointer );
755
756struct cons_pointer c_type( struct cons_pointer pointer );
757
758struct cons_pointer c_car( struct cons_pointer arg );
759
760struct cons_pointer c_cdr( struct cons_pointer arg );
761
762int c_length( struct cons_pointer arg );
763
764struct cons_pointer make_cons( struct cons_pointer car,
765 struct cons_pointer cdr );
766
767struct cons_pointer make_exception( struct cons_pointer message,
768 struct cons_pointer frame_pointer );
769
770struct cons_pointer make_function( struct cons_pointer src,
771 struct cons_pointer ( *executable )
772 ( struct stack_frame *,
773 struct cons_pointer,
774 struct cons_pointer ) );
775
776struct cons_pointer c_string_to_lisp_keyword( wchar_t *symbol );
777
778struct cons_pointer make_lambda( struct cons_pointer args,
779 struct cons_pointer body );
780
781struct cons_pointer make_nlambda( struct cons_pointer args,
782 struct cons_pointer body );
783
785 struct cons_pointer ( *executable )
786 ( struct stack_frame *,
787 struct cons_pointer,
788 struct cons_pointer ) );
789
790struct cons_pointer make_string_like_thing( wint_t c, struct cons_pointer tail,
791 uint32_t tag );
792
793struct cons_pointer make_string( wint_t c, struct cons_pointer tail );
794
795struct cons_pointer make_symbol_or_key( wint_t c, struct cons_pointer tail,
796 uint32_t tag );
797
798#define make_symbol(c, t) (make_symbol_or_key( c, t, SYMBOLTV))
799
800#define make_keyword(c, t) (make_symbol_or_key( c, t, KEYTV))
801
803 struct cons_pointer metadata );
804
806 struct cons_pointer metadata );
807
808struct cons_pointer c_string_to_lisp_string( wchar_t *string );
809
810struct cons_pointer c_string_to_lisp_symbol( wchar_t *symbol );
811
812#endif
struct cons_pointer divisor
a pointer to an integer representing the divisor.
struct cons_pointer more
list of any further argument bindings.
uint32_t hash
a hash of the string value, computed at store time.
int args
the number of arguments provided.
struct cons_pointer privileged_keyword_primitive
keywords used in documentation: :primitive.
#define args_in_frame
union cons_space_object::@2 tag
union cons_space_object::@3 payload
uint32_t page
the index of the page on which this cell resides
struct cons_pointer make_exception(struct cons_pointer message, struct cons_pointer frame_pointer)
Construct an exception cell.
struct cons_pointer body
the body of the function to be applied to the arguments.
struct cons_pointer make_lambda(struct cons_pointer args, struct cons_pointer body)
Construct a lambda (interpretable source) cell.
struct cons_pointer make_symbol_or_key(wint_t c, struct cons_pointer tail, uint32_t tag)
Construct a symbol or keyword from the character c and this tail.
struct cons_pointer make_special(struct cons_pointer src, struct cons_pointer(*executable)(struct stack_frame *, struct cons_pointer, struct cons_pointer))
struct cons_pointer dividend
a pointer to an integer representing the dividend
struct cons_pointer c_string_to_lisp_keyword(wchar_t *symbol)
Return a lisp keyword representation of this wide character string.
struct cons_pointer c_cdr(struct cons_pointer arg)
Implementation of cdr in C.
struct cons_pointer make_string_like_thing(wint_t c, struct cons_pointer tail, uint32_t tag)
Construct a string from this character (which later will be UTF) and this tail.
struct cons_pointer meta
metadata on the stream (e.g.
URL_FILE * stream
the stream to read from or write to.
struct cons_pointer cdr
Contents of the Decrement Register, naturally.
struct cons_pointer args
the arument list
union vectorp_payload::@1 tag
the tag of the vector-space object.
#define TAGLENGTH
The length of a tag, in bytes.
int c_length(struct cons_pointer arg)
Implementation of length in C.
struct cons_pointer access
cons pointer to the access control list of this cell
struct cons_pointer privileged_keyword_cause
Keywords used when constructing exceptions: :cause.
struct cons_pointer frame
pointer to the (unfreed) stack frame in which the exception was thrown.
struct cons_pointer make_string(wint_t c, struct cons_pointer tail)
Construct a string from the character c and this tail.
struct cons_pointer privileged_keyword_name
keywords used in documentation: :name.
struct cons_pointer previous
the previous frame.
bool check_tag(struct cons_pointer pointer, uint32_t value)
True if the value of the tag on the cell at this pointer is this value, or, if the tag of the cell is...
uint32_t count
the count of the number of references to this cell
uint32_t offset
the index of the cell within the page
struct cons_pointer make_function(struct cons_pointer src, struct cons_pointer(*executable)(struct stack_frame *, struct cons_pointer, struct cons_pointer))
Construct a cell which points to an executable Lisp function.
uint32_t get_tag_value(struct cons_pointer pointer)
given a cons_pointer as argument, return the tag.
struct cons_pointer privileged_keyword_documentation
keywords used in documentation: :documentation.
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.
long double value
the value of the number
struct cons_pointer inc_ref(struct cons_pointer pointer)
increment the reference count of the object at this cons pointer.
struct cons_pointer function
the function to be called.
uint32_t padding
unused padding to word-align the address
void * address
the address of the actual vector space object (
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 payload
The payload: usually a Lisp string but in practice anything printable will do.
struct cons_pointer privileged_keyword_payload
Keywords used when constructing exceptions: :payload.
int64_t value
the value of the payload (i.e.
struct cons_pointer c_string_to_lisp_symbol(wchar_t *symbol)
Return a lisp symbol representation of this wide character string.
struct cons_pointer c_car(struct cons_pointer arg)
Implementation of car in C.
int depth
the depth of the stack below this frame
wint_t character
the actual character stored in this cell
struct cons_pointer c_type(struct cons_pointer pointer)
Get the Lisp type of the single argument.
struct cons_pointer make_nlambda(struct cons_pointer args, struct cons_pointer body)
Construct an nlambda (interpretable source) cell; to a lambda as a special form is to a function.
struct cons_pointer arg[args_in_frame]
first 8 arument bindings.
struct cons_pointer dec_ref(struct cons_pointer pointer)
Decrement the reference count of the object at this cons pointer.
struct cons_pointer privileged_keyword_location
Keywords used when constructing exceptions: :location.
unsigned __int128 value
struct cons_pointer car
Contents of the Address Register, naturally.
struct cons_pointer make_cons(struct cons_pointer car, struct cons_pointer cdr)
Construct a cons cell from this pair of pointers.
payload of a cons cell.
An indirect pointer to a cons cell.
an object in cons space.
Payload of an exception.
payload of a free cell.
payload of an integer cell.
payload for lambda and nlambda cells.
payload for ratio cells.
payload for a real number cell.
A stack frame.
payload of a read or write stream cell.
payload of a string cell.
The payload of a time cell: an unsigned 128 bit value representing micro- seconds since the estimated...
payload of a vector pointer cell.
Payload of a function cell.
struct cons_pointer meta
pointer to metadata (e.g.
struct cons_pointer(* executable)(struct stack_frame *, struct cons_pointer, struct cons_pointer)
pointer to a function which takes a cons pointer (representing its argument list) and a cons pointer ...
Payload of a special form cell.
struct cons_pointer meta
pointer to the source from which the special form was compiled, or NIL if it is a primitive.
struct cons_pointer(* executable)(struct stack_frame *, struct cons_pointer, struct cons_pointer)
pointer to a function which takes a cons pointer (representing its argument list) and a cons pointer ...
#define vectorp(conspoint)
Definition vectorspace.h:50