From f43fda4e635370689fc248bb7e94e5861151df2c Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 9 Jul 2021 08:21:15 -0700 Subject: defstruct: diagnose built-in type being redefined. * eval.c (eval_init): Register built-in-type-p intrinsic. * lib.c (buitin_type_p): Rename to built_in_type_p since the word built-in is hyphenated. The function also tests whether the argument is a COBJ class. (cobj_class_exists): Function removed. * stdlib/doc-syms.tl: Updated. * stdlib/struct.tl (defstruct): Add built-in-type-p check. * struct.c (make_struct_type): Call only built_in_type_p; cobj_class_exists is gone. * txr.1: Document built-in-type-p. --- lib.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib.h') diff --git a/lib.h b/lib.h index 077f5d98..a306830b 100644 --- a/lib.h +++ b/lib.h @@ -563,7 +563,7 @@ extern alloc_bytes_t malloc_bytes; extern alloc_bytes_t gc_bytes; val identity(val obj); -val builtin_type_p(val sym); +val built_in_type_p(val sym); val typeof(val obj); val subtypep(val sub, val sup); val typep(val obj, val type); @@ -1100,7 +1100,6 @@ val length_str_lt(val str, val len); val length_str_le(val str, val len); struct cobj_class *cobj_register(val cls_sym); struct cobj_class *cobj_register_super(val cls_sym, struct cobj_class *super); -int cobj_class_exists(val cls_sym); val cobj(mem_t *handle, struct cobj_class *cls, struct cobj_ops *ops); val cobjp(val obj); val cobjclassp(val obj, struct cobj_class *); -- cgit v1.2.3