40 wchar_t c = cell->
payload.string.character;
45 pointer = cell->
payload.string.cdr;
67 bool initial_space ) {
70 switch ( cell->
tag.value ) {
72 if ( initial_space ) {
83 print( output, pointer );
102 print( output, key );
126 fwprintf( stderr, L
"Unrecognised vector-space type '%d'\n",
136 fwprintf( stderr, L
"0" );
138 char str[40] = { 0 };
139 char *s = str +
sizeof( str ) - 1;
144 *--s =
"0123456789"[n % 10];
164 switch ( cell.
tag.value ) {
187 url_fputws( L
"<Anonymous Function: ", output );
193 print( output, to_print );
203 url_fputws( L
"<Anonymous Special Form: ", output );
209 print( output, to_print );
229 buffer = (
char * ) malloc( 24 );
230 memset( buffer, 0, 24 );
232 sprintf( buffer,
"%-.23Lg", cell.
payload.real.value );
233 if ( strchr( buffer,
'.' ) != NULL ) {
234 for (
int i = strlen( buffer ) - 1; buffer[i] ==
'0'; i-- ) {
272 L
"Error: Unrecognised tag value %d (%4.4s)\n",
273 cell.
tag.value, &cell.
tag.bytes[0] );
303 if (
writep( out_stream ) ) {
306 output =
pointer2cell( out_stream ).payload.stream.stream;
315 result =
print( output, frame->arg[0] );
320 if (
writep( out_stream ) ) {
349 if (
writep( out_stream ) ) {
350 output =
pointer2cell( out_stream ).payload.stream.stream;
358 if (
writep( out_stream ) ) {
struct cons_pointer c_cdr(struct cons_pointer arg)
Implementation of cdr in C.
struct cons_pointer c_car(struct cons_pointer arg)
Implementation of car in C.
#define KEYTV
The string KEYW, considered as an unsigned int.
#define SPECIALTV
The string SPFM, considered as an unsigned int.
#define writep(conspoint)
true if conspoint points to a write stream cell, else false.
#define VECTORPOINTTV
The string VECP, considered as an unsigned int.
#define SYMBOLTV
The string SYMB, considered as an unsigned int.
union cons_space_object::@2 tag
union cons_space_object::@3 payload
#define NIL
a cons pointer which points to the special NIL cell
#define FUNCTIONTV
The string FUNC, considered as an unsigned int.
#define STRINGTV
The string STRG, considered as an unsigned int.
#define TIMETV
The string TIME, considered as an unsigned int.
#define INTEGERTV
The string INTR, considered as an unsigned int.
#define RATIOTV
The string RTIO, considered as an unsigned int.
#define CONSTV
The string CONS, considered as an unsigned int.
#define nilp(conspoint)
true if conspoint points to the special cell NIL, else false (there should only be one of these so it...
#define NLAMBDATV
The string NLMD, considered as an unsigned int.
#define TRUETV
The string TRUE, considered as an unsigned int.
#define symbolp(conspoint)
true if conspoint points to a symbol cell, else false
#define REALTV
The string REAL, considered as an unsigned int.
struct cons_pointer inc_ref(struct cons_pointer pointer)
increment the reference count of the object at this cons pointer.
#define NILTV
The string NIL, considered as an unsigned int.
#define EXCEPTIONTV
The string EXEP, considered as an unsigned int.
#define stringp(conspoint)
true if conspoint points to a string cell, else false
struct cons_pointer c_string_to_lisp_symbol(wchar_t *symbol)
Return a lisp symbol representation of this wide character string.
#define keywordp(conspoint)
true if conspoint points to a keyword, else false
#define LAMBDATV
The string LMDA, considered as an unsigned int.
#define WRITETV
The string WRIT, considered as an unsigned int.
#define READTV
The string READ, considered as an unsigned int.
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.
struct cons_pointer make_cons(struct cons_pointer car, struct cons_pointer cdr)
Construct a cons cell from this pair of pointers.
An indirect pointer to a cons cell.
void debug_dump_object(struct cons_pointer pointer, int level)
Like dump_object, q.v., but protected by the verbosity mechanism.
void debug_print(wchar_t *message, int level)
print this debug message to stderr, if verbosity matches level.
#define DEBUG_IO
Print messages debugging input/output operations.
#define url_fputwc(wc, f)
#define url_fputws(ws, f)
#define url_fwprintf(f,...)
struct cons_pointer integer_to_string(struct cons_pointer int_pointer, int base)
return a string representation of this integer, which may be a bignum.
struct cons_pointer hashmap_get(struct cons_pointer mapp, struct cons_pointer key)
Get a value from a hashmap.
struct cons_pointer hashmap_keys(struct cons_pointer mapp)
return a flat list of all the keys in the hashmap indicated by map.
URL_FILE * file_to_url_file(FILE *f)
given this file handle f, return a new url_file handle wrapping it.
struct cons_pointer get_default_stream(bool inputp, struct cons_pointer env)
Resutn the current default input, or of inputp is false, output stream from this environment.
void print_string(URL_FILE *output, struct cons_pointer pointer)
print all the characters in the string indicated by pointer onto the stream at this output,...
void print_vso(URL_FILE *output, struct cons_pointer pointer)
void print_list_contents(URL_FILE *output, struct cons_pointer pointer, bool initial_space)
Print a single list cell (cons cell) indicated by pointer to the stream indicated by output.
void print_list(URL_FILE *output, struct cons_pointer pointer)
struct cons_pointer lisp_println(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
(prinln out-stream): Print a new line character to out-stream, if it is specified and is an output st...
void print_map(URL_FILE *output, struct cons_pointer map)
void print_string_contents(URL_FILE *output, struct cons_pointer pointer)
print all the characters in the symbol or string indicated by pointer onto this output; if pointer do...
void println(URL_FILE *output)
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.
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.
void print_128bit(URL_FILE *output, __int128_t n)
stolen from https://stackoverflow.com/questions/11656241/how-to-print-uint128-t-number-using-gcc
struct cons_pointer time_to_string(struct cons_pointer pointer)
This is temporary, for bootstrapping.
void dump_stack_trace(URL_FILE *output, struct cons_pointer pointer)
#define pointer_to_vso(pointer)
given a pointer to a vector space object, return the object.
#define hashmapp(conspoint)
struct vector_space_header header
the header of this object
union vector_space_header::@4 tag
the tag (type) of this vector-space object.
a vector_space_object is just a vector_space_header followed by a lump of bytes; what we deem to be i...