This commit is contained in:
Justin Ethier 2020-05-18 18:18:33 -04:00
parent 64b81aa803
commit cf6ccc25d9
5 changed files with 24 additions and 1 deletions

1
gc.c
View file

@ -968,6 +968,7 @@ char *gc_copy_obj(object dest, char *obj, gc_thread_data * thd)
case forward_tag:
return (char *)forward(obj);
case eof_tag:
case void_tag:
case primitive_tag:
case boolean_tag:
case symbol_tag:

View file

@ -31,6 +31,12 @@ extern const object quote_void;
*/
extern const object Cyc_EOF;
/**
* The void value.
* \ingroup objects
*/
extern const object Cyc_VOID;
/**
* \ingroup gc_minor
*/
@ -480,6 +486,7 @@ object Cyc_is_procedure(void *data, object o);
//object Cyc_is_opaque(object o);
#define Cyc_is_macro(o) (make_boolean(is_object_type(o) && ((list) o)->tag == macro_tag))
#define Cyc_is_eof_object(o) (make_boolean(is_object_type(o) && ((list) o)->tag == eof_tag))
#define Cyc_is_void_object(o) (make_boolean(is_object_type(o) && ((list) o)->tag == void_tag))
#define Cyc_is_cvar(o) (make_boolean(is_object_type(o) && ((list) o)->tag == cvar_tag))
#define Cyc_is_opaque(o) (make_boolean(is_object_type(o) && ((list) o)->tag == c_opaque_tag))
object Cyc_is_immutable(object obj);

View file

@ -69,6 +69,7 @@ enum object_tag {
, vector_tag = 20
, complex_num_tag = 21
, atomic_tag = 22
, void_tag = 23
};
/**

View file

@ -49,6 +49,7 @@ const char *tag_names[] = {
/*vector_tag */ , "vector"
/*complex_num_tag*/ , "complex number"
/*atomic_tag*/ , "atomic"
/*void_tag*/ , "void"
, "Reserved for future use"
};
@ -190,8 +191,10 @@ int _cyc_argc = 0;
char **_cyc_argv = NULL;
static symbol_type __EOF = { {0}, eof_tag, ""}; // symbol_type in lieu of custom type
static symbol_type __VOID = { {0}, void_tag, ""}; // symbol_type in lieu of custom type
const object Cyc_EOF = &__EOF;
const object Cyc_VOID = &__VOID;
static ck_hs_t lib_table;
static ck_hs_t symbol_table;
static int symbol_table_initial_size = 4096;
@ -1033,6 +1036,8 @@ object Cyc_display(void *data, object x, FILE * port)
case eof_tag:
fprintf(port, "<EOF>");
break;
case void_tag:
break;
case port_tag:
fprintf(port, "<port %p>", ((port_type *) x)->fp);
break;
@ -5857,6 +5862,7 @@ static char *gc_move(char *obj, gc_thread_data * thd, int *alloci, int *heap_gro
case forward_tag:
return (char *)forward(obj);
case eof_tag:
case void_tag:
break;
case primitive_tag:
break;
@ -6034,6 +6040,7 @@ int gc_minor(void *data, object low_limit, object high_limit, closure cont,
break;
// These types are not heap-allocated
case eof_tag:
case void_tag:
case primitive_tag:
case symbol_tag:
case boolean_tag:
@ -6100,6 +6107,7 @@ void Cyc_make_shared_object(void *data, object k, object obj)
// symbol_tag = 19
// closure0_tag = 3
// eof_tag = 9
// void_tag
// macro_tag = 13
// primitive_tag = 17

View file

@ -178,6 +178,7 @@
exact
inexact
eof-object
void
syntax-error
bytevector-copy
bytevector-copy!
@ -1444,6 +1445,11 @@
" return_closcall1(data, k, Cyc_EOF); "
"(void *data, object ptr)"
" return Cyc_EOF;")
(define-c void
"(void *data, int argc, closure _, object k)"
" return_closcall1(data, k, Cyc_VOID); "
"(void *data, object ptr)"
" return Cyc_VOID;")
(define-c input-port?
"(void *data, int argc, closure _, object k, object port)"
" port_type *p = (port_type *)port;