From 9c8a8fd762d9c199da1fe0cf9f9f8df24e8314dc Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 15 May 2019 06:28:38 -0700 Subject: oop: new function: struct-type-name. * struct.c (struct_init): Register struct-type-name intrinsic. (struct_type_name): New function. * struct.h (struct_type_name): Declared. * txr.1: Documented. --- struct.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'struct.c') diff --git a/struct.c b/struct.c index 48f961b6..4810d6e5 100644 --- a/struct.c +++ b/struct.c @@ -184,6 +184,7 @@ void struct_init(void) reg_fun(intern(lit("static-slot-p"), user_package), func_n2(static_slot_p)); reg_fun(intern(lit("structp"), user_package), func_n1(structp)); reg_fun(intern(lit("struct-type"), user_package), func_n1(struct_type)); + reg_fun(intern(lit("struct-type-name"), user_package), func_n1(struct_type_name)); reg_fun(intern(lit("method"), user_package), func_n2v(method_args)); reg_fun(intern(lit("super-method"), user_package), func_n2(super_method)); reg_fun(intern(lit("uslot"), user_package), func_n1(uslot)); @@ -1334,6 +1335,12 @@ val struct_type(val strct) return si->type->self; } +val struct_type_name(val stype) +{ + struct struct_type *st = stype_handle(&stype, lit("struct-type-name")); + return st->name; +} + static val method_fun(val env, varg args) { cons_bind (fun, strct, env); -- cgit v1.2.3