mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-16 17:27:33 +02:00
Beginning to add u8vector type
This commit is contained in:
parent
9889248cab
commit
c59b01fe00
3 changed files with 18 additions and 4 deletions
|
@ -29,6 +29,7 @@
|
|||
#define Cyc_check_str(d,obj) Cyc_check_type(d,Cyc_is_string, string_tag, obj);
|
||||
#define Cyc_check_sym(d,obj) Cyc_check_type(d,Cyc_is_symbol, symbol_tag, obj);
|
||||
#define Cyc_check_vec(d,obj) Cyc_check_type(d,Cyc_is_vector, vector_tag, obj);
|
||||
#define Cyc_check_bvec(d,obj) Cyc_check_type(d,Cyc_is_bytevector, bytevector_tag, obj);
|
||||
#define Cyc_check_port(d,obj) Cyc_check_type(d,Cyc_is_port, port_tag, obj);
|
||||
#define Cyc_check_mutex(d,obj) Cyc_check_type(d,Cyc_is_mutex, mutex_tag, obj);
|
||||
#define Cyc_check_cond_var(d,obj) Cyc_check_type(d,Cyc_is_cond_var, cond_var_tag, obj);
|
||||
|
@ -198,6 +199,7 @@ object Cyc_is_number(object o);
|
|||
object Cyc_is_real(object o);
|
||||
object Cyc_is_integer(object o);
|
||||
object Cyc_is_vector(object o);
|
||||
object Cyc_is_bytevector(object o);
|
||||
object Cyc_is_port(object o);
|
||||
object Cyc_is_mutex(object o);
|
||||
object Cyc_is_cond_var(object o);
|
||||
|
|
|
@ -185,6 +185,7 @@ typedef long tag_type;
|
|||
#define macro_tag 18
|
||||
#define mutex_tag 19
|
||||
#define cond_var_tag 20
|
||||
#define bytevector_tag 21
|
||||
|
||||
#define nil NULL
|
||||
#define eq(x,y) (x == y)
|
||||
|
@ -297,6 +298,11 @@ typedef vector_type *vector;
|
|||
|
||||
#define make_empty_vector(v) vector_type v; v.hdr.mark = gc_color_red; v.hdr.grayed = 0; v.tag = vector_tag; v.num_elt = 0; v.elts = NULL;
|
||||
|
||||
/* Bytevector type */
|
||||
|
||||
typedef struct {gc_header_type hdr; tag_type tag; int len; char *data;} bytevector_type;
|
||||
typedef bytevector_type *bytevector;
|
||||
|
||||
/* Define cons type. */
|
||||
|
||||
typedef struct {gc_header_type hdr; tag_type tag; object cons_car,cons_cdr;} cons_type;
|
||||
|
|
14
runtime.c
14
runtime.c
|
@ -27,15 +27,15 @@ object Cyc_global_set(void *thd, object *glo, object value)
|
|||
|
||||
/* Error checking section - type mismatch, num args, etc */
|
||||
/* Type names to use for error messages */
|
||||
const char *tag_names[22] = { \
|
||||
const char *tag_names[23] = { \
|
||||
"pair" \
|
||||
, "symbol" \
|
||||
, "" \
|
||||
, "procedure" \
|
||||
, "procedure" \
|
||||
, "procedure" \
|
||||
, "procedure" \
|
||||
, "procedure" \
|
||||
, "" \
|
||||
, "" \
|
||||
, "" \
|
||||
, "procedure" \
|
||||
, "number" \
|
||||
, "number" \
|
||||
|
@ -49,6 +49,7 @@ const char *tag_names[22] = { \
|
|||
, "macro" \
|
||||
, "mutex" \
|
||||
, "condition variable" \
|
||||
, "bytevector" \
|
||||
, "Reserved for future use" };
|
||||
|
||||
void Cyc_invalid_type_error(void *data, int tag, object found) {
|
||||
|
@ -840,6 +841,11 @@ object Cyc_is_vector(object o){
|
|||
return boolean_t;
|
||||
return boolean_f;}
|
||||
|
||||
object Cyc_is_bytevector(object o){
|
||||
if (!nullp(o) && !is_value_type(o) && ((list)o)->tag == bytevector_tag)
|
||||
return boolean_t;
|
||||
return boolean_f;}
|
||||
|
||||
object Cyc_is_port(object o){
|
||||
if (!nullp(o) && !is_value_type(o) && ((list)o)->tag == port_tag)
|
||||
return boolean_t;
|
||||
|
|
Loading…
Add table
Reference in a new issue