|
Post Scarcity
A prototype for a post scarcity programming environment
|
#include <math.h>#include <stdbool.h>#include "memory/conspage.h"#include "memory/consspaceobject.h"#include "arith/integer.h"#include "arith/peano.h"#include "arith/ratio.h"#include "debug.h"Go to the source code of this file.
Functions | |
| bool | end_of_string (struct cons_pointer string) |
| Some strings will be null terminated and some will be NIL terminated... ooops! | |
| bool | eq (struct cons_pointer a, struct cons_pointer b) |
| Shallow, and thus cheap, equality: true if these two objects are the same object, else false. | |
| bool | equal (struct cons_pointer a, struct cons_pointer b) |
| Deep, and thus expensive, equality: true if these two objects have identical structure, else false. | |
| bool | equal_integer_number (struct cons_pointer a, struct cons_pointer b) |
| Private function, don't use. | |
| bool | equal_integer_real (struct cons_pointer a, struct cons_pointer b) |
| Private function, don't use. | |
| bool | equal_ld_ld (long double a, long double b) |
| compare two long doubles and returns true if they are the same to within a tolerance of one part in a billion. | |
| bool | equal_number_number (struct cons_pointer a, struct cons_pointer b) |
| Private function, don't use. | |
| bool | equal_real_number (struct cons_pointer a, struct cons_pointer b) |
| Private function, don't use. | |
| bool | same_type (struct cons_pointer a, struct cons_pointer b) |
| True if the objects at these two cons pointers have the same tag, else false. | |
| bool end_of_string | ( | struct cons_pointer | string | ) |
Some strings will be null terminated and some will be NIL terminated... ooops!
| string | the string to test |
Definition at line 47 of file equal.c.
References nilp, cons_space_object::payload, and pointer2cell.
Referenced by equal().
| bool eq | ( | struct cons_pointer | a, |
| struct cons_pointer | b | ||
| ) |
Shallow, and thus cheap, equality: true if these two objects are the same object, else false.
Definition at line 24 of file equal.c.
References cons_pointer::offset, and cons_pointer::page.
Referenced by equal(), equal_number_number(), lisp_add(), lisp_eq(), lisp_repl(), make_ratio(), and release_integer().
| bool equal | ( | struct cons_pointer | a, |
| struct cons_pointer | b | ||
| ) |
Deep, and thus expensive, equality: true if these two objects have identical structure, else false.
Definition at line 247 of file equal.c.
References CONSTV, DEBUG_ARITH, debug_print(), debug_print_object(), debug_printf(), end_of_string(), eq(), equal(), equal_number_number(), equal_ratio_ratio(), INTEGERTV, KEYTV, LAMBDATV, NLAMBDATV, numberp, cons_space_object::payload, pointer2cell, RATIOTV, REALTV, same_type(), STRINGTV, SYMBOLTV, cons_space_object::tag, and to_long_double().
Referenced by c_assoc(), equal(), internedp(), and lisp_equal().
| bool equal_integer_number | ( | struct cons_pointer | a, |
| struct cons_pointer | b | ||
| ) |
Private function, don't use.
It depends on its arguments being numbers and doesn't sanity check them.
| a | a lisp integer – if it isn't an integer, things will break. |
| b | a lisp number. |
Definition at line 120 of file equal.c.
References DEBUG_ARITH, debug_print(), debug_print_object(), debug_printf(), equal_integer_integer(), equal_integer_real(), INTEGERTV, pointer2cell, RATIOTV, REALTV, and cons_space_object::tag.
Referenced by equal_number_number().
| bool equal_integer_real | ( | struct cons_pointer | a, |
| struct cons_pointer | b | ||
| ) |
Private function, don't use.
It depends on its arguments being numbers and doesn't sanity check them.
| a | a lisp integer – if it isn't an integer, things will break. |
| b | a lisp real – if it isn't a real, things will break. |
Definition at line 87 of file equal.c.
References DEBUG_ARITH, debug_print(), debug_print_object(), debug_printf(), equal_ld_ld(), nilp, cons_space_object::payload, and pointer2cell.
Referenced by equal_integer_number(), and equal_real_number().
| bool equal_ld_ld | ( | long double | a, |
| long double | b | ||
| ) |
compare two long doubles and returns true if they are the same to within a tolerance of one part in a billion.
| a | |
| b |
a and b are equal to within one part in a billion. Definition at line 61 of file equal.c.
References DEBUG_ARITH, and debug_printf().
Referenced by equal_integer_real(), and equal_real_number().
| bool equal_number_number | ( | struct cons_pointer | a, |
| struct cons_pointer | b | ||
| ) |
Private function, don't use.
It depends on its arguments being numbers and doesn't sanity check them.
| a | a number |
| b | a number |
Definition at line 195 of file equal.c.
References DEBUG_ARITH, debug_print(), debug_print_object(), debug_printf(), eq(), equal_integer_number(), equal_ratio_ratio(), equal_real_number(), INTEGERTV, pointer2cell, RATIOTV, REALTV, and cons_space_object::tag.
Referenced by equal().
| bool equal_real_number | ( | struct cons_pointer | a, |
| struct cons_pointer | b | ||
| ) |
Private function, don't use.
It depends on its arguments being numbers and doesn't sanity check them.
| a | a lisp real – if it isn't an real, things will break. |
| b | a lisp number. |
Definition at line 155 of file equal.c.
References c_ratio_to_ld(), DEBUG_ARITH, debug_print(), debug_print_object(), debug_printf(), equal_integer_real(), equal_ld_ld(), INTEGERTV, cons_space_object::payload, pointer2cell, RATIOTV, REALTV, and cons_space_object::tag.
Referenced by equal_number_number().
| bool same_type | ( | struct cons_pointer | a, |
| struct cons_pointer | b | ||
| ) |
True if the objects at these two cons pointers have the same tag, else false.
| a | a pointer to a cons-space object; |
| b | another pointer to a cons-space object. |
Definition at line 35 of file equal.c.
References pointer2cell, and cons_space_object::tag.
Referenced by equal().