Merge branch 'master' into develop
This commit is contained in:
commit
bef9be4914
9 changed files with 307 additions and 15 deletions
|
|
@ -87,9 +87,10 @@ __int128_t cell_value( struct cons_pointer c, char op, bool is_first_cell ) {
|
|||
|
||||
/**
|
||||
* Overwrite the value field of the integer indicated by `new` with
|
||||
* the least significant 60 bits of `val`, and return the more significant
|
||||
* bits (if any) right-shifted by 60 places. Destructive, primitive, do not
|
||||
* use in any context except primitive operations on integers.
|
||||
* the least significant INTEGER_BITS bits of `val`, and return the
|
||||
* more significant bits (if any) right-shifted by INTEGER_BITS places.
|
||||
* Destructive, primitive, do not use in any context except primitive
|
||||
* operations on integers.
|
||||
*
|
||||
* @param val the value to represent;
|
||||
* @param less_significant the less significant words of this bignum, if any,
|
||||
|
|
|
|||
|
|
@ -22,7 +22,10 @@
|
|||
* So left shifting and right shifting by 60 bits is correct.
|
||||
*/
|
||||
#define MAX_INTEGER ((__int128_t)0x0fffffffffffffffL)
|
||||
|
||||
/**
|
||||
* @brief Number of value bits in an integer cell
|
||||
*
|
||||
*/
|
||||
#define INTEGER_BIT_SHIFT (60)
|
||||
|
||||
bool zerop( struct cons_pointer arg );
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ struct cons_pointer read_path( URL_FILE * input, wint_t initial,
|
|||
prefix = c_string_to_lisp_symbol( L"oblist" );
|
||||
break;
|
||||
case '$':
|
||||
case L'§':
|
||||
case LSESSION:
|
||||
prefix = c_string_to_lisp_symbol( L"session" );
|
||||
break;
|
||||
}
|
||||
|
|
@ -245,7 +245,7 @@ struct cons_pointer read_continuation( struct stack_frame *frame,
|
|||
}
|
||||
break;
|
||||
case '$':
|
||||
case L'§':
|
||||
case LSESSION:
|
||||
result = read_path( input, c, NIL );
|
||||
break;
|
||||
default:
|
||||
|
|
@ -298,9 +298,9 @@ struct cons_pointer read_number( struct stack_frame *frame,
|
|||
initial );
|
||||
|
||||
for ( c = initial; iswdigit( c )
|
||||
|| c == L'.' || c == L'/' || c == L','; c = url_fgetwc( input ) ) {
|
||||
|| c == LPERIOD || c == LSLASH || c == LCOMMA; c = url_fgetwc( input ) ) {
|
||||
switch ( c ) {
|
||||
case L'.':
|
||||
case LPERIOD:
|
||||
if ( seen_period || !nilp( dividend ) ) {
|
||||
return throw_exception( c_string_to_lisp_string
|
||||
( L"Malformed number: too many periods" ),
|
||||
|
|
@ -311,7 +311,7 @@ struct cons_pointer read_number( struct stack_frame *frame,
|
|||
seen_period = true;
|
||||
}
|
||||
break;
|
||||
case L'/':
|
||||
case LSLASH:
|
||||
if ( seen_period || !nilp( dividend ) ) {
|
||||
return throw_exception( c_string_to_lisp_string
|
||||
( L"Malformed number: dividend of rational must be integer" ),
|
||||
|
|
@ -324,11 +324,12 @@ struct cons_pointer read_number( struct stack_frame *frame,
|
|||
result = make_integer( 0, NIL );
|
||||
}
|
||||
break;
|
||||
case L',':
|
||||
case LCOMMA:
|
||||
// silently ignore it.
|
||||
break;
|
||||
default:
|
||||
result = add_integers( multiply_integers( result, base ),
|
||||
/* /todo: this won't work for hex digits */
|
||||
make_integer( ( int ) c - ( int ) '0',
|
||||
NIL ) );
|
||||
|
||||
|
|
@ -402,7 +403,7 @@ struct cons_pointer read_list( struct stack_frame *frame,
|
|||
for ( c = url_fgetwc( input );
|
||||
iswblank( c ) || iswcntrl( c ); c = url_fgetwc( input ) );
|
||||
|
||||
if ( c == L'.' ) {
|
||||
if ( c == LPERIOD ) {
|
||||
/* might be a dotted pair; indeed, if we rule out numbers with
|
||||
* initial periods, it must be a dotted pair. \todo Ought to check,
|
||||
* howerver, that there's only one form after the period. */
|
||||
|
|
@ -433,7 +434,7 @@ struct cons_pointer read_map( struct stack_frame *frame,
|
|||
make_hashmap( DFLT_HASHMAP_BUCKETS, NIL, TRUE );
|
||||
wint_t c = initial;
|
||||
|
||||
while ( c != L'}' ) {
|
||||
while ( c != LCBRACE ) {
|
||||
struct cons_pointer key =
|
||||
read_continuation( frame, frame_pointer, env, input, c );
|
||||
|
||||
|
|
@ -446,7 +447,7 @@ struct cons_pointer read_map( struct stack_frame *frame,
|
|||
|
||||
/* skip commaa and whitespace at this point. */
|
||||
for ( c = url_fgetwc( input );
|
||||
c == L',' || iswblank( c ) || iswcntrl( c );
|
||||
c == LCOMMA || iswblank( c ) || iswcntrl( c );
|
||||
c = url_fgetwc( input ) );
|
||||
|
||||
result =
|
||||
|
|
|
|||
|
|
@ -13,6 +13,15 @@
|
|||
|
||||
#include "memory/consspaceobject.h"
|
||||
|
||||
/* characters (other than arabic numberals) used in number representations */
|
||||
#define LCOMMA L','
|
||||
#define LPERIOD L'.'
|
||||
#define LSLASH L'/'
|
||||
/* ... used in map representations */
|
||||
#define LCBRACE L'}'
|
||||
/* ... used in path representations */
|
||||
#define LSESSION L'§'
|
||||
|
||||
/**
|
||||
* read the next object on this input stream and return a cons_pointer to it.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue