diff --git a/lib/Makefile.am b/lib/Makefile.am index 96e800a..d21d243 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -99,6 +99,7 @@ libhcl_la_LIBADD = $(LIBADD_LIB_COMMON) if ENABLE_STATIC_MODULE libhcl_la_LIBADD += ../mod/libhcl-arr.la +libhcl_la_LIBADD += ../mod/libhcl-core.la libhcl_la_LIBADD += ../mod/libhcl-dic.la libhcl_la_LIBADD += ../mod/libhcl-str.la libhcl_la_LIBADD += ../mod/libhcl-sys.la diff --git a/lib/Makefile.in b/lib/Makefile.in index 814ba85..6a66d04 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -93,6 +93,7 @@ host_triplet = @host@ @MACOSX_TRUE@@WIN32_FALSE@am__append_4 = -DHCL_DEFAULT_PFMODPOSTFIX=\".dylib\" @MACOSX_FALSE@@WIN32_FALSE@am__append_5 = -DHCL_DEFAULT_PFMODPOSTFIX=\".so\" @ENABLE_STATIC_MODULE_TRUE@am__append_6 = ../mod/libhcl-arr.la \ +@ENABLE_STATIC_MODULE_TRUE@ ../mod/libhcl-core.la \ @ENABLE_STATIC_MODULE_TRUE@ ../mod/libhcl-dic.la \ @ENABLE_STATIC_MODULE_TRUE@ ../mod/libhcl-str.la \ @ENABLE_STATIC_MODULE_TRUE@ ../mod/libhcl-sys.la diff --git a/lib/hcl.c b/lib/hcl.c index 8d7cbda..6cfcb2a 100644 --- a/lib/hcl.c +++ b/lib/hcl.c @@ -737,6 +737,7 @@ void hcl_freemem (hcl_t* hcl, void* ptr) #if defined(HCL_ENABLE_STATIC_MODULE) #include "../mod/_arr.h" +#include "../mod/_core.h" #include "../mod/_dic.h" #include "../mod/_str.h" #include "../mod/_sys.h" @@ -749,6 +750,7 @@ static struct static_modtab[] = { { "arr", hcl_mod_arr }, + { "core", hcl_mod_core }, { "dic", hcl_mod_dic }, { "str", hcl_mod_str }, { "sys", hcl_mod_sys } diff --git a/mod/Makefile.am b/mod/Makefile.am index 5ac0509..8b743e3 100644 --- a/mod/Makefile.am +++ b/mod/Makefile.am @@ -21,6 +21,7 @@ LIBADD_COMMON = noinst_LTLIBRARIES = noinst_LTLIBRARIES += libhcl-arr.la +noinst_LTLIBRARIES += libhcl-core.la noinst_LTLIBRARIES += libhcl-dic.la noinst_LTLIBRARIES += libhcl-str.la noinst_LTLIBRARIES += libhcl-sys.la @@ -37,6 +38,7 @@ pkgmodexecdir = $(libdir) pkgmodexec_LTLIBRARIES = pkgmodexec_LTLIBRARIES += libhcl-arr.la +pkgmodexec_LTLIBRARIES += libhcl-core.la pkgmodexec_LTLIBRARIES += libhcl-dic.la pkgmodexec_LTLIBRARIES += libhcl-str.la pkgmodexec_LTLIBRARIES += libhcl-sys.la @@ -47,22 +49,28 @@ libhcl_arr_la_SOURCES = arr.c _arr.h libhcl_arr_la_CPPFLAGS = $(CPPFLAGS_COMMON) libhcl_arr_la_CFLAGS = $(CFLAGS_COMMON) libhcl_arr_la_LDFLAGS = $(LDFLAGS_COMMON) -libhcl_arr_la_LIBADD = $(LIBADD_COMMON) +libhcl_arr_la_LIBADD = $(LIBADD_COMMON) + +libhcl_core_la_SOURCES = core.c _core.h +libhcl_core_la_CPPFLAGS = $(CPPFLAGS_COMMON) +libhcl_core_la_CFLAGS = $(CFLAGS_COMMON) +libhcl_core_la_LDFLAGS = $(LDFLAGS_COMMON) +libhcl_core_la_LIBADD = $(LIBADD_COMMON) libhcl_dic_la_SOURCES = dic.c _dic.h libhcl_dic_la_CPPFLAGS = $(CPPFLAGS_COMMON) libhcl_dic_la_CFLAGS = $(CFLAGS_COMMON) libhcl_dic_la_LDFLAGS = $(LDFLAGS_COMMON) -libhcl_dic_la_LIBADD = $(LIBADD_COMMON) +libhcl_dic_la_LIBADD = $(LIBADD_COMMON) libhcl_str_la_SOURCES = str.c _str.h libhcl_str_la_CPPFLAGS = $(CPPFLAGS_COMMON) libhcl_str_la_CFLAGS = $(CFLAGS_COMMON) libhcl_str_la_LDFLAGS = $(LDFLAGS_COMMON) -libhcl_str_la_LIBADD = $(LIBADD_COMMON) +libhcl_str_la_LIBADD = $(LIBADD_COMMON) libhcl_sys_la_SOURCES = sys.c _sys.h libhcl_sys_la_CPPFLAGS = $(CPPFLAGS_COMMON) libhcl_sys_la_CFLAGS = $(CFLAGS_COMMON) libhcl_sys_la_LDFLAGS = $(LDFLAGS_COMMON) -libhcl_sys_la_LIBADD = $(LIBADD_COMMON) +libhcl_sys_la_LIBADD = $(LIBADD_COMMON) diff --git a/mod/Makefile.in b/mod/Makefile.in index 4fd7ded..736804b 100644 --- a/mod/Makefile.in +++ b/mod/Makefile.in @@ -145,6 +145,16 @@ libhcl_arr_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ @ENABLE_STATIC_MODULE_FALSE@am_libhcl_arr_la_rpath = -rpath \ @ENABLE_STATIC_MODULE_FALSE@ $(pkgmodexecdir) @ENABLE_STATIC_MODULE_TRUE@am_libhcl_arr_la_rpath = +libhcl_core_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_libhcl_core_la_OBJECTS = libhcl_core_la-core.lo +libhcl_core_la_OBJECTS = $(am_libhcl_core_la_OBJECTS) +libhcl_core_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libhcl_core_la_CFLAGS) $(CFLAGS) $(libhcl_core_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +@ENABLE_STATIC_MODULE_FALSE@am_libhcl_core_la_rpath = -rpath \ +@ENABLE_STATIC_MODULE_FALSE@ $(pkgmodexecdir) +@ENABLE_STATIC_MODULE_TRUE@am_libhcl_core_la_rpath = libhcl_dic_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_libhcl_dic_la_OBJECTS = libhcl_dic_la-dic.lo libhcl_dic_la_OBJECTS = $(am_libhcl_dic_la_OBJECTS) @@ -188,6 +198,7 @@ DEFAULT_INCLUDES = depcomp = $(SHELL) $(top_srcdir)/ac/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/libhcl_arr_la-arr.Plo \ + ./$(DEPDIR)/libhcl_core_la-core.Plo \ ./$(DEPDIR)/libhcl_dic_la-dic.Plo \ ./$(DEPDIR)/libhcl_str_la-str.Plo \ ./$(DEPDIR)/libhcl_sys_la-sys.Plo @@ -210,10 +221,12 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = -SOURCES = $(libhcl_arr_la_SOURCES) $(libhcl_dic_la_SOURCES) \ - $(libhcl_str_la_SOURCES) $(libhcl_sys_la_SOURCES) -DIST_SOURCES = $(libhcl_arr_la_SOURCES) $(libhcl_dic_la_SOURCES) \ - $(libhcl_str_la_SOURCES) $(libhcl_sys_la_SOURCES) +SOURCES = $(libhcl_arr_la_SOURCES) $(libhcl_core_la_SOURCES) \ + $(libhcl_dic_la_SOURCES) $(libhcl_str_la_SOURCES) \ + $(libhcl_sys_la_SOURCES) +DIST_SOURCES = $(libhcl_arr_la_SOURCES) $(libhcl_core_la_SOURCES) \ + $(libhcl_dic_la_SOURCES) $(libhcl_str_la_SOURCES) \ + $(libhcl_sys_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -399,32 +412,37 @@ CFLAGS_COMMON = @ENABLE_STATIC_MODULE_FALSE@LIBADD_COMMON = -lhcl @ENABLE_STATIC_MODULE_TRUE@LIBADD_COMMON = @ENABLE_STATIC_MODULE_TRUE@noinst_LTLIBRARIES = libhcl-arr.la \ -@ENABLE_STATIC_MODULE_TRUE@ libhcl-dic.la libhcl-str.la \ -@ENABLE_STATIC_MODULE_TRUE@ libhcl-sys.la +@ENABLE_STATIC_MODULE_TRUE@ libhcl-core.la libhcl-dic.la \ +@ENABLE_STATIC_MODULE_TRUE@ libhcl-str.la libhcl-sys.la @ENABLE_STATIC_MODULE_FALSE@pkgmodexecdir = $(libdir) @ENABLE_STATIC_MODULE_FALSE@pkgmodexec_LTLIBRARIES = libhcl-arr.la \ -@ENABLE_STATIC_MODULE_FALSE@ libhcl-dic.la libhcl-str.la \ -@ENABLE_STATIC_MODULE_FALSE@ libhcl-sys.la +@ENABLE_STATIC_MODULE_FALSE@ libhcl-core.la libhcl-dic.la \ +@ENABLE_STATIC_MODULE_FALSE@ libhcl-str.la libhcl-sys.la libhcl_arr_la_SOURCES = arr.c _arr.h libhcl_arr_la_CPPFLAGS = $(CPPFLAGS_COMMON) libhcl_arr_la_CFLAGS = $(CFLAGS_COMMON) libhcl_arr_la_LDFLAGS = $(LDFLAGS_COMMON) -libhcl_arr_la_LIBADD = $(LIBADD_COMMON) +libhcl_arr_la_LIBADD = $(LIBADD_COMMON) +libhcl_core_la_SOURCES = core.c _core.h +libhcl_core_la_CPPFLAGS = $(CPPFLAGS_COMMON) +libhcl_core_la_CFLAGS = $(CFLAGS_COMMON) +libhcl_core_la_LDFLAGS = $(LDFLAGS_COMMON) +libhcl_core_la_LIBADD = $(LIBADD_COMMON) libhcl_dic_la_SOURCES = dic.c _dic.h libhcl_dic_la_CPPFLAGS = $(CPPFLAGS_COMMON) libhcl_dic_la_CFLAGS = $(CFLAGS_COMMON) libhcl_dic_la_LDFLAGS = $(LDFLAGS_COMMON) -libhcl_dic_la_LIBADD = $(LIBADD_COMMON) +libhcl_dic_la_LIBADD = $(LIBADD_COMMON) libhcl_str_la_SOURCES = str.c _str.h libhcl_str_la_CPPFLAGS = $(CPPFLAGS_COMMON) libhcl_str_la_CFLAGS = $(CFLAGS_COMMON) libhcl_str_la_LDFLAGS = $(LDFLAGS_COMMON) -libhcl_str_la_LIBADD = $(LIBADD_COMMON) +libhcl_str_la_LIBADD = $(LIBADD_COMMON) libhcl_sys_la_SOURCES = sys.c _sys.h libhcl_sys_la_CPPFLAGS = $(CPPFLAGS_COMMON) libhcl_sys_la_CFLAGS = $(CFLAGS_COMMON) libhcl_sys_la_LDFLAGS = $(LDFLAGS_COMMON) -libhcl_sys_la_LIBADD = $(LIBADD_COMMON) +libhcl_sys_la_LIBADD = $(LIBADD_COMMON) all: all-am .SUFFIXES: @@ -508,6 +526,9 @@ clean-pkgmodexecLTLIBRARIES: libhcl-arr.la: $(libhcl_arr_la_OBJECTS) $(libhcl_arr_la_DEPENDENCIES) $(EXTRA_libhcl_arr_la_DEPENDENCIES) $(AM_V_CCLD)$(libhcl_arr_la_LINK) $(am_libhcl_arr_la_rpath) $(libhcl_arr_la_OBJECTS) $(libhcl_arr_la_LIBADD) $(LIBS) +libhcl-core.la: $(libhcl_core_la_OBJECTS) $(libhcl_core_la_DEPENDENCIES) $(EXTRA_libhcl_core_la_DEPENDENCIES) + $(AM_V_CCLD)$(libhcl_core_la_LINK) $(am_libhcl_core_la_rpath) $(libhcl_core_la_OBJECTS) $(libhcl_core_la_LIBADD) $(LIBS) + libhcl-dic.la: $(libhcl_dic_la_OBJECTS) $(libhcl_dic_la_DEPENDENCIES) $(EXTRA_libhcl_dic_la_DEPENDENCIES) $(AM_V_CCLD)$(libhcl_dic_la_LINK) $(am_libhcl_dic_la_rpath) $(libhcl_dic_la_OBJECTS) $(libhcl_dic_la_LIBADD) $(LIBS) @@ -524,6 +545,7 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_arr_la-arr.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_core_la-core.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_dic_la-dic.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_str_la-str.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_sys_la-sys.Plo@am__quote@ # am--include-marker @@ -565,6 +587,13 @@ libhcl_arr_la-arr.lo: arr.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhcl_arr_la_CPPFLAGS) $(CPPFLAGS) $(libhcl_arr_la_CFLAGS) $(CFLAGS) -c -o libhcl_arr_la-arr.lo `test -f 'arr.c' || echo '$(srcdir)/'`arr.c +libhcl_core_la-core.lo: core.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhcl_core_la_CPPFLAGS) $(CPPFLAGS) $(libhcl_core_la_CFLAGS) $(CFLAGS) -MT libhcl_core_la-core.lo -MD -MP -MF $(DEPDIR)/libhcl_core_la-core.Tpo -c -o libhcl_core_la-core.lo `test -f 'core.c' || echo '$(srcdir)/'`core.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhcl_core_la-core.Tpo $(DEPDIR)/libhcl_core_la-core.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='core.c' object='libhcl_core_la-core.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhcl_core_la_CPPFLAGS) $(CPPFLAGS) $(libhcl_core_la_CFLAGS) $(CFLAGS) -c -o libhcl_core_la-core.lo `test -f 'core.c' || echo '$(srcdir)/'`core.c + libhcl_dic_la-dic.lo: dic.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhcl_dic_la_CPPFLAGS) $(CPPFLAGS) $(libhcl_dic_la_CFLAGS) $(CFLAGS) -MT libhcl_dic_la-dic.lo -MD -MP -MF $(DEPDIR)/libhcl_dic_la-dic.Tpo -c -o libhcl_dic_la-dic.lo `test -f 'dic.c' || echo '$(srcdir)/'`dic.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhcl_dic_la-dic.Tpo $(DEPDIR)/libhcl_dic_la-dic.Plo @@ -720,6 +749,7 @@ clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ distclean: distclean-am -rm -f ./$(DEPDIR)/libhcl_arr_la-arr.Plo + -rm -f ./$(DEPDIR)/libhcl_core_la-core.Plo -rm -f ./$(DEPDIR)/libhcl_dic_la-dic.Plo -rm -f ./$(DEPDIR)/libhcl_str_la-str.Plo -rm -f ./$(DEPDIR)/libhcl_sys_la-sys.Plo @@ -769,6 +799,7 @@ installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/libhcl_arr_la-arr.Plo + -rm -f ./$(DEPDIR)/libhcl_core_la-core.Plo -rm -f ./$(DEPDIR)/libhcl_dic_la-dic.Plo -rm -f ./$(DEPDIR)/libhcl_str_la-str.Plo -rm -f ./$(DEPDIR)/libhcl_sys_la-sys.Plo diff --git a/mod/_core.h b/mod/_core.h new file mode 100644 index 0000000..48ce188 --- /dev/null +++ b/mod/_core.h @@ -0,0 +1,43 @@ +/* + * $Id$ + * + Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _HCL_MOD_CORE_H_ +#define _HCL_MOD_CORE_H_ + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +HCL_EXPORT int hcl_mod_core (hcl_t* hcl, hcl_mod_t* mod); + +#if defined(__cplusplus) +} +#endif + +#endif + diff --git a/mod/core.c b/mod/core.c new file mode 100644 index 0000000..4810e9b --- /dev/null +++ b/mod/core.c @@ -0,0 +1,76 @@ +/* + * $Id$ + * + Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +#include "_core.h" + +static hcl_pfrc_t pf_core_get_class_name (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs) +{ + hcl_oop_oop_t obj; + + obj = (hcl_oop_oop_t)HCL_STACK_GETARG(hcl, nargs, 0); + + if (!HCL_IS_CLASS(hcl,obj)) + { + hcl_seterrbfmt (hcl, HCL_EINVAL, "parameter not a class - %O", obj); + return HCL_PF_FAILURE; + } + + HCL_STACK_SETRET (hcl, nargs, ((hcl_oop_class_t)obj)->name); + return HCL_PF_SUCCESS; +} + +static hcl_pfinfo_t pfinfos[] = +{ + { { 'c','l','a','s','s','_','n','a','m','e','\0' }, { HCL_PFBASE_FUNC, pf_core_get_class_name, 1, 1 } }, +/* + { { 'l','e','n','g','t','h','\0' }, { HCL_PFBASE_FUNC, pf_core_size, 1, 1 } }, + { { 'n','e','w','\0' }, { HCL_PFBASE_FUNC, pf_core_new, 1, 1 } }, + { { 'p','u','t','\0' }, { HCL_PFBASE_FUNC, pf_core_put, 3, 3 } }, + { { 's','i','z','e','\0' }, { HCL_PFBASE_FUNC, pf_core_size, 1, 1 } }, + { { 's','l','i','c','e','\0' }, { HCL_PFBASE_FUNC, pf_core_slice, 3, 3 } } +*/ +}; + +/* ------------------------------------------------------------------------ */ + +static hcl_pfbase_t* query (hcl_t* hcl, hcl_mod_t* mod, const hcl_ooch_t* name, hcl_oow_t namelen) +{ + return hcl_findpfbase(hcl, pfinfos, HCL_COUNTOF(pfinfos), name, namelen); +} + + +static void unload (hcl_t* hcl, hcl_mod_t* mod) +{ +} + +int hcl_mod_core (hcl_t* hcl, hcl_mod_t* mod) +{ + mod->query = query; + mod->unload = unload; + mod->ctx = HCL_NULL; + return 0; +} diff --git a/src/kernel.hcl b/src/kernel.hcl index 355b339..2ddd134 100644 --- a/src/kernel.hcl +++ b/src/kernel.hcl @@ -25,6 +25,10 @@ fun Collection:slice(index count) { } +fun Class:name() { + return (core.class_name self) +} + class String: Array (a b c) { }