103 if ( iswblank( c ) || iswcntrl( c ) ) {
122 if ( iswalpha( c ) ) {
143 if ( !
nilp( prefix ) ) {
165 c ==
'\0' || iswblank( c ) || iswcntrl( c );
171 ( L
"End of file while reading" ), frame_pointer );
181 ( L
"End of input while reading" ),
187 ( frame, frame_pointer, env, input,
192 read_list( frame, frame_pointer, env, input,
196 result =
read_map( frame, frame_pointer, env, input,
205 if ( iswdigit( next ) ) {
217 if ( iswdigit( next ) ) {
222 }
else if ( iswblank( next ) ) {
229 ( L
"read_continuation: dotted pair; read cdr ",
248 && ( iswblank( cn ) || iswcntrl( cn ) ) ) {
262 if ( iswdigit( c ) ) {
264 read_number( frame, frame_pointer, input, c,
false );
265 }
else if ( iswprint( c ) ) {
270 ( L
"Unrecognised start of input character" ),
291 wint_t initial,
bool seen_period ) {
299 int places_of_decimals = 0;
301 bool neg = initial == btowc(
'-' );
310 for ( c = initial; iswdigit( c )
315 if ( seen_period || !
nilp( dividend ) ) {
317 ( L
"Malformed number: too many periods" ),
326 if ( seen_period || !
nilp( dividend ) ) {
328 ( L
"Malformed number: dividend of rational must be integer" ),
347 (
int )
'0',
NIL ) );
350 L
"read_number: added character %c, result now ",
356 places_of_decimals++;
372 places_of_decimals ),
379 }
else if (
integerp( dividend ) ) {
381 result =
make_ratio( dividend, result,
true );
385 debug_print( L
"read_number: converting result to negative\n",
408 if ( initial !=
')' ) {
410 L
"read_list starting '%C' (%d)\n", initial, initial );
417 iswblank( c ) || iswcntrl( c ); c =
url_fgetwc( input ) );
432 read_list( frame, frame_pointer, env, input, c ) );
455 for ( c =
url_fgetwc( input ); iswblank( c ) || iswcntrl( c );
463 c ==
LCOMMA || iswblank( c ) || iswcntrl( c );
468 eval_form( frame, frame_pointer, value, env ) );
532 if ( iswprint( initial )
533 && !iswblank( initial ) ) {
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_string(wint_t c, struct cons_pointer tail)
Construct a string from the character c and this tail.
struct cons_pointer c_string_to_lisp_string(wchar_t *string)
Return a lisp string representation of this wide character string.
struct cons_pointer inc_ref(struct cons_pointer pointer)
increment the reference count of the object at this cons pointer.
struct cons_pointer c_car(struct cons_pointer arg)
Implementation of car in C.
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 KEYTV
The string KEYW, considered as an unsigned int.
#define SYMBOLTV
The string SYMB, considered as an unsigned int.
#define NIL
a cons pointer which points to the special NIL cell
struct cons_pointer c_cdr(struct cons_pointer arg)
Implementation of cdr in C.
#define nilp(conspoint)
true if conspoint points to the special cell NIL, else false (there should only be one of these so it...
#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 c_car(struct cons_pointer arg)
Implementation of car in C.
struct cons_pointer dec_ref(struct cons_pointer pointer)
Decrement the reference count of the object at this cons pointer.
#define integerp(conspoint)
true if conspoint points to an integer cell, else false
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_printf(int level, wchar_t *format,...)
wprintf adapted for the debug logging system.
void debug_print(wchar_t *message, int level)
print this debug message to stderr, if verbosity matches level.
void debug_print_object(struct cons_pointer pointer, int level)
print the object indicated by this pointer to stderr, if verbosity matches level.
#define DEBUG_IO
Print messages debugging input/output operations.
int url_feof(URL_FILE *file)
#define DFLT_HASHMAP_BUCKETS
struct cons_pointer multiply_integers(struct cons_pointer a, struct cons_pointer b)
Return a pointer to an integer representing the product of the integers pointed to by a and b.
struct cons_pointer add_integers(struct cons_pointer a, struct cons_pointer b)
Return a pointer to an integer representing the sum of the integers pointed to by a and b.
struct cons_pointer acquire_integer(int64_t value, struct cons_pointer more)
Supply small valued integers from the small integer cache, if available.
struct cons_pointer hashmap_put(struct cons_pointer mapp, struct cons_pointer key, struct cons_pointer val)
Store this val as the value of this key in this hashmap mapp.
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.
wint_t url_ungetwc(wint_t wc, URL_FILE *input)
wint_t url_fgetwc(URL_FILE *input)
get one wide character from the buffer.
struct cons_pointer throw_exception(struct cons_pointer message, struct cons_pointer frame_pointer)
Throw an exception.
struct cons_pointer eval_form(struct stack_frame *parent, struct cons_pointer parent_pointer, struct cons_pointer form, struct cons_pointer env)
Useful building block; evaluate this single form in the context of this parent stack frame and this e...
struct cons_pointer negative(struct cons_pointer arg)
return a cons_pointer indicating a number which is the 0 - the number indicated by arg.
long double to_long_double(struct cons_pointer arg)
Return the closest possible binary64 representation to the value of this arg, expected to be an integ...
struct cons_pointer make_ratio(struct cons_pointer dividend, struct cons_pointer divisor, bool simplify)
Construct a ratio frame from this dividend and divisor, expected to be integers, in the context of th...
struct cons_pointer c_quote(struct cons_pointer arg)
quote reader macro in C (!)
struct cons_pointer read_string(URL_FILE *input, wint_t initial)
Read a string.
struct cons_pointer read_number(struct stack_frame *frame, struct cons_pointer frame_pointer, URL_FILE *input, wint_t initial, bool seen_period)
read a number from this input stream, given this initial character.
struct cons_pointer read_path(URL_FILE *input, wint_t initial, struct cons_pointer q)
Read a path macro from the stream.
struct cons_pointer read_continuation(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env, URL_FILE *input, wint_t initial)
Read the next object on this input stream and return a cons_pointer to it, treating this initial char...
struct cons_pointer read_list(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env, URL_FILE *input, wint_t initial)
Read a list from this input stream, which no longer contains the opening left parenthesis.
struct cons_pointer read(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env, URL_FILE *input)
Read the next object on this input stream and return a cons_pointer to it.
struct cons_pointer read_symbol_or_key(URL_FILE *input, uint32_t tag, wint_t initial)
struct cons_pointer read_map(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env, URL_FILE *input, wint_t initial)
struct cons_pointer make_real(long double value)
Allocate a real number cell representing this value and return a cons pointer to it.
#define pointer_to_vso(pointer)
given a pointer to a vector space object, return the object.