adding hcl_openstd()
This commit is contained in:
@ -84,6 +84,7 @@ libhcl_la_SOURCES = \
|
||||
print.c \
|
||||
rbt.c \
|
||||
read.c \
|
||||
std.c \
|
||||
sym.c \
|
||||
utf8.c \
|
||||
utl.c \
|
||||
|
@ -156,8 +156,9 @@ am_libhcl_la_OBJECTS = libhcl_la-bigint.lo libhcl_la-cnode.lo \
|
||||
libhcl_la-fmt.lo libhcl_la-gc.lo libhcl_la-hcl.lo \
|
||||
libhcl_la-heap.lo libhcl_la-number.lo libhcl_la-obj.lo \
|
||||
libhcl_la-opt.lo libhcl_la-prim.lo libhcl_la-print.lo \
|
||||
libhcl_la-rbt.lo libhcl_la-read.lo libhcl_la-sym.lo \
|
||||
libhcl_la-utf8.lo libhcl_la-utl.lo libhcl_la-xma.lo
|
||||
libhcl_la-rbt.lo libhcl_la-read.lo libhcl_la-std.lo \
|
||||
libhcl_la-sym.lo libhcl_la-utf8.lo libhcl_la-utl.lo \
|
||||
libhcl_la-xma.lo
|
||||
libhcl_la_OBJECTS = $(am_libhcl_la_OBJECTS)
|
||||
AM_V_lt = $(am__v_lt_@AM_V@)
|
||||
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
|
||||
@ -205,9 +206,9 @@ am__depfiles_remade = ./$(DEPDIR)/libhcl_la-bigint.Plo \
|
||||
./$(DEPDIR)/libhcl_la-number.Plo ./$(DEPDIR)/libhcl_la-obj.Plo \
|
||||
./$(DEPDIR)/libhcl_la-opt.Plo ./$(DEPDIR)/libhcl_la-prim.Plo \
|
||||
./$(DEPDIR)/libhcl_la-print.Plo ./$(DEPDIR)/libhcl_la-rbt.Plo \
|
||||
./$(DEPDIR)/libhcl_la-read.Plo ./$(DEPDIR)/libhcl_la-sym.Plo \
|
||||
./$(DEPDIR)/libhcl_la-utf8.Plo ./$(DEPDIR)/libhcl_la-utl.Plo \
|
||||
./$(DEPDIR)/libhcl_la-xma.Plo \
|
||||
./$(DEPDIR)/libhcl_la-read.Plo ./$(DEPDIR)/libhcl_la-std.Plo \
|
||||
./$(DEPDIR)/libhcl_la-sym.Plo ./$(DEPDIR)/libhcl_la-utf8.Plo \
|
||||
./$(DEPDIR)/libhcl_la-utl.Plo ./$(DEPDIR)/libhcl_la-xma.Plo \
|
||||
./$(DEPDIR)/libhclx_la-cb-impl.Plo \
|
||||
./$(DEPDIR)/libhclx_la-hcl-c.Plo \
|
||||
./$(DEPDIR)/libhclx_la-hcl-s.Plo \
|
||||
@ -392,6 +393,7 @@ pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
runstatedir = @runstatedir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
@ -456,6 +458,7 @@ libhcl_la_SOURCES = \
|
||||
print.c \
|
||||
rbt.c \
|
||||
read.c \
|
||||
std.c \
|
||||
sym.c \
|
||||
utf8.c \
|
||||
utl.c \
|
||||
@ -591,6 +594,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-print.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-rbt.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-read.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-std.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-sym.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-utf8.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-utl.Plo@am__quote@ # am--include-marker
|
||||
@ -765,6 +769,13 @@ libhcl_la-read.lo: read.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_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libhcl_la-read.lo `test -f 'read.c' || echo '$(srcdir)/'`read.c
|
||||
|
||||
libhcl_la-std.lo: std.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhcl_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libhcl_la-std.lo -MD -MP -MF $(DEPDIR)/libhcl_la-std.Tpo -c -o libhcl_la-std.lo `test -f 'std.c' || echo '$(srcdir)/'`std.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhcl_la-std.Tpo $(DEPDIR)/libhcl_la-std.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='std.c' object='libhcl_la-std.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_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libhcl_la-std.lo `test -f 'std.c' || echo '$(srcdir)/'`std.c
|
||||
|
||||
libhcl_la-sym.lo: sym.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhcl_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libhcl_la-sym.lo -MD -MP -MF $(DEPDIR)/libhcl_la-sym.Tpo -c -o libhcl_la-sym.lo `test -f 'sym.c' || echo '$(srcdir)/'`sym.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhcl_la-sym.Tpo $(DEPDIR)/libhcl_la-sym.Plo
|
||||
@ -1009,6 +1020,7 @@ distclean: distclean-am
|
||||
-rm -f ./$(DEPDIR)/libhcl_la-print.Plo
|
||||
-rm -f ./$(DEPDIR)/libhcl_la-rbt.Plo
|
||||
-rm -f ./$(DEPDIR)/libhcl_la-read.Plo
|
||||
-rm -f ./$(DEPDIR)/libhcl_la-std.Plo
|
||||
-rm -f ./$(DEPDIR)/libhcl_la-sym.Plo
|
||||
-rm -f ./$(DEPDIR)/libhcl_la-utf8.Plo
|
||||
-rm -f ./$(DEPDIR)/libhcl_la-utl.Plo
|
||||
@ -1084,6 +1096,7 @@ maintainer-clean: maintainer-clean-am
|
||||
-rm -f ./$(DEPDIR)/libhcl_la-print.Plo
|
||||
-rm -f ./$(DEPDIR)/libhcl_la-rbt.Plo
|
||||
-rm -f ./$(DEPDIR)/libhcl_la-read.Plo
|
||||
-rm -f ./$(DEPDIR)/libhcl_la-std.Plo
|
||||
-rm -f ./$(DEPDIR)/libhcl_la-sym.Plo
|
||||
-rm -f ./$(DEPDIR)/libhcl_la-utf8.Plo
|
||||
-rm -f ./$(DEPDIR)/libhcl_la-utl.Plo
|
||||
|
1076
lib/cb-impl.c
1076
lib/cb-impl.c
File diff suppressed because it is too large
Load Diff
71
lib/exec.c
71
lib/exec.c
@ -3824,33 +3824,6 @@ hcl_pfrc_t hcl_pf_semaphore_new (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs)
|
||||
return HCL_PF_SUCCESS;
|
||||
}
|
||||
|
||||
hcl_pfrc_t hcl_pf_semaphore_wait (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs)
|
||||
{
|
||||
hcl_oop_semaphore_t sem;
|
||||
|
||||
sem = (hcl_oop_semaphore_t)HCL_STACK_GETARG(hcl, nargs, 0);
|
||||
if (!HCL_IS_SEMAPHORE(hcl, sem))
|
||||
{
|
||||
hcl_seterrbfmt (hcl, HCL_EINVAL, "parameter not semaphore - %O", sem);
|
||||
return HCL_PF_FAILURE;
|
||||
}
|
||||
|
||||
if (!can_await_semaphore(hcl, sem))
|
||||
{
|
||||
hcl_seterrbfmt (hcl, HCL_EPERM, "not allowed to wait on a semaphore that belongs to a semaphore group");
|
||||
return HCL_PF_FAILURE;
|
||||
}
|
||||
|
||||
/* i must set the return value before calling await_semaphore().
|
||||
* await_semaphore() may switch the active process and the stack
|
||||
* manipulation macros target at the active process. i'm not supposed
|
||||
* to change the return value of a new active process. */
|
||||
HCL_STACK_SETRET (hcl, nargs, (hcl_oop_t)sem);
|
||||
|
||||
await_semaphore (hcl, sem);
|
||||
return HCL_PF_SUCCESS;
|
||||
}
|
||||
|
||||
hcl_pfrc_t hcl_pf_semaphore_signal (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs)
|
||||
{
|
||||
hcl_oop_semaphore_t sem;
|
||||
@ -3952,16 +3925,19 @@ hcl_pfrc_t hcl_pf_semaphore_signal (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs)
|
||||
return HCL_PF_SUCCESS;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static hcl_pfrc_t __semaphore_signal_on_io (hcl_t* hcl, hcl_ooi_t nargs, hcl_semaphore_io_type_t io_type)
|
||||
{
|
||||
hcl_oop_semaphore_t sem;
|
||||
hcl_oop_t fd;
|
||||
|
||||
sem = (hcl_oop_semaphore_t)HCL_STACK_GETRCV(hcl, nargs);
|
||||
HCL_PF_CHECK_RCV (hcl, hcl_iskindof(hcl, (hcl_oop_t)sem, hcl->_semaphore));
|
||||
sem = (hcl_oop_semaphore_t)HCL_STACK_GETARG(hcl, nargs, 0);
|
||||
if (!HCL_IS_SEMAPHORE(hcl, sem))
|
||||
{
|
||||
hcl_seterrbfmt (hcl, HCL_EINVAL, "parameter not semaphore - %O", sem);
|
||||
return HCL_PF_FAILURE;
|
||||
}
|
||||
|
||||
fd = HCL_STACK_GETARG(hcl, nargs, 0);
|
||||
fd = HCL_STACK_GETARG(hcl, nargs, 1);
|
||||
|
||||
if (!HCL_OOP_IS_SMOOI(fd))
|
||||
{
|
||||
@ -3997,7 +3973,7 @@ static hcl_pfrc_t __semaphore_signal_on_io (hcl_t* hcl, hcl_ooi_t nargs, hcl_sem
|
||||
return HCL_PF_FAILURE;
|
||||
}
|
||||
|
||||
HCL_STACK_SETRETTORCV (hcl, nargs); /* ^self */
|
||||
HCL_STACK_SETRET (hcl, nargs, (hcl_oop_t)sem);
|
||||
return HCL_PF_SUCCESS;
|
||||
}
|
||||
|
||||
@ -4011,6 +3987,7 @@ hcl_pfrc_t hcl_pf_semaphore_signal_on_output (hcl_t* hcl, hcl_mod_t* mod, hcl_oo
|
||||
return __semaphore_signal_on_io(hcl, nargs, HCL_SEMAPHORE_IO_TYPE_OUTPUT);
|
||||
}
|
||||
|
||||
#if 0
|
||||
hcl_pfrc_t hcl_pf_semaphore_signal_on_gcfin (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs)
|
||||
{
|
||||
hcl_oop_semaphore_t sem;
|
||||
@ -4026,6 +4003,34 @@ hcl_pfrc_t hcl_pf_semaphore_signal_on_gcfin (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi
|
||||
}
|
||||
#endif
|
||||
|
||||
hcl_pfrc_t hcl_pf_semaphore_wait (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs)
|
||||
{
|
||||
hcl_oop_semaphore_t sem;
|
||||
|
||||
sem = (hcl_oop_semaphore_t)HCL_STACK_GETARG(hcl, nargs, 0);
|
||||
if (!HCL_IS_SEMAPHORE(hcl, sem))
|
||||
{
|
||||
hcl_seterrbfmt (hcl, HCL_EINVAL, "parameter not semaphore - %O", sem);
|
||||
return HCL_PF_FAILURE;
|
||||
}
|
||||
|
||||
if (!can_await_semaphore(hcl, sem))
|
||||
{
|
||||
hcl_seterrbfmt (hcl, HCL_EPERM, "not allowed to wait on a semaphore that belongs to a semaphore group");
|
||||
return HCL_PF_FAILURE;
|
||||
}
|
||||
|
||||
/* i must set the return value before calling await_semaphore().
|
||||
* await_semaphore() may switch the active process and the stack
|
||||
* manipulation macros target at the active process. i'm not supposed
|
||||
* to change the return value of a new active process. */
|
||||
HCL_STACK_SETRET (hcl, nargs, (hcl_oop_t)sem);
|
||||
|
||||
await_semaphore (hcl, sem);
|
||||
return HCL_PF_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
hcl_pfrc_t hcl_pf_semaphore_unsignal (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs)
|
||||
{
|
||||
/* remove a semaphore from processor's signal scheduling.
|
||||
@ -4090,8 +4095,6 @@ TODO: add this back if gcfin support is added
|
||||
return HCL_PF_SUCCESS;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
hcl_pfrc_t hcl_pf_semaphore_group_new (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs)
|
||||
{
|
||||
|
@ -3,6 +3,9 @@
|
||||
/* Define if building universal (internal helper macro) */
|
||||
#undef AC_APPLE_UNIVERSAL_BUILD
|
||||
|
||||
/* Define to 1 if you have the `accept4' function. */
|
||||
#undef HAVE_ACCEPT4
|
||||
|
||||
/* Define to 1 if you have the `acosq' function. */
|
||||
#undef HAVE_ACOSQ
|
||||
|
||||
@ -45,6 +48,12 @@
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the `epoll_create' function. */
|
||||
#undef HAVE_EPOLL_CREATE
|
||||
|
||||
/* Define to 1 if you have the `epoll_create1' function. */
|
||||
#undef HAVE_EPOLL_CREATE1
|
||||
|
||||
/* Define to 1 if you have the <errno.h> header file. */
|
||||
#undef HAVE_ERRNO_H
|
||||
|
||||
@ -81,6 +90,12 @@
|
||||
/* Define to 1 if you have the `isatty' function. */
|
||||
#undef HAVE_ISATTY
|
||||
|
||||
/* Define to 1 if you have the `kqueue' function. */
|
||||
#undef HAVE_KQUEUE
|
||||
|
||||
/* Define to 1 if you have the `kqueue1' function. */
|
||||
#undef HAVE_KQUEUE1
|
||||
|
||||
/* Define to 1 if you have the <libunwind.h> header file. */
|
||||
#undef HAVE_LIBUNWIND_H
|
||||
|
||||
@ -111,6 +126,9 @@
|
||||
/* Define to 1 if you have the `nanosleep' function. */
|
||||
#undef HAVE_NANOSLEEP
|
||||
|
||||
/* Define to 1 if you have the `pipe2' function. */
|
||||
#undef HAVE_PIPE2
|
||||
|
||||
/* Define to 1 if you have the <poll.h> header file. */
|
||||
#undef HAVE_POLL_H
|
||||
|
||||
@ -129,9 +147,6 @@
|
||||
/* Define to 1 if you have the `quadmath_snprintf' function. */
|
||||
#undef HAVE_QUADMATH_SNPRINTF
|
||||
|
||||
/* Define to 1 if you have the `readv' function. */
|
||||
#undef HAVE_READV
|
||||
|
||||
/* Define to 1 if you have the `roundq' function. */
|
||||
#undef HAVE_ROUNDQ
|
||||
|
||||
@ -144,6 +159,12 @@
|
||||
/* Define to 1 if you have the `settimeofday' function. */
|
||||
#undef HAVE_SETTIMEOFDAY
|
||||
|
||||
/* Define to 1 if you have the `sigaction' function. */
|
||||
#undef HAVE_SIGACTION
|
||||
|
||||
/* Define to 1 if you have the `signal' function. */
|
||||
#undef HAVE_SIGNAL
|
||||
|
||||
/* Define to 1 if you have the <signal.h> header file. */
|
||||
#undef HAVE_SIGNAL_H
|
||||
|
||||
@ -171,6 +192,9 @@
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the `strerror_r' function. */
|
||||
#undef HAVE_STRERROR_R
|
||||
|
||||
/* strftime supports %z */
|
||||
#undef HAVE_STRFTIME_SMALL_Z
|
||||
|
||||
@ -240,9 +264,6 @@
|
||||
/* Define to 1 if you have the <wctype.h> header file. */
|
||||
#undef HAVE_WCTYPE_H
|
||||
|
||||
/* Define to 1 if you have the `writev' function. */
|
||||
#undef HAVE_WRITEV
|
||||
|
||||
/* Define to 1 if you have the `_vsnprintf' function. */
|
||||
#undef HAVE__VSNPRINTF
|
||||
|
||||
|
@ -1356,7 +1356,7 @@ hcl_pfrc_t hcl_pf_semaphore_signal (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs)
|
||||
hcl_pfrc_t hcl_pf_semaphore_signal_timed (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs);
|
||||
hcl_pfrc_t hcl_pf_semaphore_signal_on_input (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs);
|
||||
hcl_pfrc_t hcl_pf_semaphore_signal_on_output (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs);
|
||||
hcl_pfrc_t hcl_pf_semaphore_signal_on_gcfin (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs);
|
||||
/*hcl_pfrc_t hcl_pf_semaphore_signal_on_gcfin (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs);*/
|
||||
hcl_pfrc_t hcl_pf_semaphore_unsignal (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs);
|
||||
|
||||
hcl_pfrc_t hcl_pf_semaphore_group_new (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs);
|
||||
|
71
lib/hcl.c
71
lib/hcl.c
@ -318,6 +318,18 @@ void hcl_fini (hcl_t* hcl)
|
||||
hcl->log.len = 0;
|
||||
}
|
||||
|
||||
if (hcl->option.log_target)
|
||||
{
|
||||
hcl_freemem (hcl, hcl->option.log_target);
|
||||
hcl->option.log_target = HCL_NULL;
|
||||
}
|
||||
|
||||
if (hcl->option.log_targetx)
|
||||
{
|
||||
hcl_freemem (hcl, hcl->option.log_targetx);
|
||||
hcl->option.log_targetx = HCL_NULL;
|
||||
}
|
||||
|
||||
if (hcl->inttostr.xbuf.ptr)
|
||||
{
|
||||
hcl_freemem (hcl, hcl->inttostr.xbuf.ptr);
|
||||
@ -378,6 +390,8 @@ void hcl_setinloc (hcl_t* hcl, hcl_oow_t line, hcl_oow_t colm)
|
||||
|
||||
int hcl_setoption (hcl_t* hcl, hcl_option_t id, const void* value)
|
||||
{
|
||||
hcl_cb_t* cb;
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case HCL_TRAIT:
|
||||
@ -385,15 +399,43 @@ int hcl_setoption (hcl_t* hcl, hcl_option_t id, const void* value)
|
||||
#if defined(HCL_BUILD_DEBUG)
|
||||
hcl->option.karatsuba_cutoff = ((hcl->option.trait & HCL_TRAIT_DEBUG_BIGINT)? HCL_KARATSUBA_CUTOFF_DEBUG: HCL_KARATSUBA_CUTOFF);
|
||||
#endif
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case HCL_LOG_MASK:
|
||||
hcl->option.log_mask = *(const hcl_bitmask_t*)value;
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case HCL_LOG_MAXCAPA:
|
||||
hcl->option.log_maxcapa = *(hcl_oow_t*)value;
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case HCL_LOG_TARGET:
|
||||
{
|
||||
hcl_ooch_t* v1;
|
||||
#if defined(HCL_OOCH_IS_UCH)
|
||||
hcl_bch_t* v2;
|
||||
#else
|
||||
hcl_uch_t* v2;
|
||||
#endif
|
||||
|
||||
v1 = hcl_dupoochars(hcl, value, hcl_count_oocstr(value));
|
||||
if (HCL_UNLIKELY(!v1)) return -1;
|
||||
|
||||
#if defined(HCL_OOCH_IS_UCH)
|
||||
v2 = hcl_dupootobcstr(hcl, value, HCL_NULL);
|
||||
#else
|
||||
v2 = hcl_dupootoucstr(hcl, value, HCL_NULL);
|
||||
#endif
|
||||
if (HCL_UNLIKELY(!v2))
|
||||
{
|
||||
hcl_freemem (hcl, v1);
|
||||
return -1;
|
||||
}
|
||||
hcl->option.log_targetx = v2;
|
||||
hcl->option.log_target = v1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case HCL_SYMTAB_SIZE:
|
||||
{
|
||||
@ -403,7 +445,7 @@ int hcl_setoption (hcl_t* hcl, hcl_option_t id, const void* value)
|
||||
if (w <= 0 || w > HCL_SMOOI_MAX) goto einval;
|
||||
|
||||
hcl->option.dfl_symtab_size = *(hcl_oow_t*)value;
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
|
||||
case HCL_SYSDIC_SIZE:
|
||||
@ -414,7 +456,7 @@ int hcl_setoption (hcl_t* hcl, hcl_option_t id, const void* value)
|
||||
if (w <= 0 || w > HCL_SMOOI_MAX) goto einval;
|
||||
|
||||
hcl->option.dfl_sysdic_size = *(hcl_oow_t*)value;
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
|
||||
case HCL_PROCSTK_SIZE:
|
||||
@ -425,14 +467,25 @@ int hcl_setoption (hcl_t* hcl, hcl_option_t id, const void* value)
|
||||
if (w <= 0 || w > HCL_SMOOI_MAX) goto einval;
|
||||
|
||||
hcl->option.dfl_procstk_size = *(hcl_oow_t*)value;
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
|
||||
case HCL_MOD_INCTX:
|
||||
hcl->option.mod_inctx = *(void**)value;
|
||||
return 0;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
goto einval;
|
||||
}
|
||||
|
||||
for (cb = hcl->cblist; cb; cb = cb->next)
|
||||
{
|
||||
if (cb->opt_set) cb->opt_set (hcl, id, value);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
einval:
|
||||
hcl_seterrnum (hcl, HCL_EINVAL);
|
||||
return -1;
|
||||
@ -454,6 +507,10 @@ int hcl_getoption (hcl_t* hcl, hcl_option_t id, void* value)
|
||||
*(hcl_oow_t*)value = hcl->option.log_maxcapa;
|
||||
return 0;
|
||||
|
||||
case HCL_LOG_TARGET:
|
||||
*(hcl_ooch_t**)value = hcl->option.log_target;
|
||||
return 0;
|
||||
|
||||
case HCL_SYMTAB_SIZE:
|
||||
*(hcl_oow_t*)value = hcl->option.dfl_symtab_size;
|
||||
return 0;
|
||||
|
15
lib/hcl.h
15
lib/hcl.h
@ -163,6 +163,7 @@ enum hcl_option_t
|
||||
HCL_TRAIT,
|
||||
HCL_LOG_MASK,
|
||||
HCL_LOG_MAXCAPA,
|
||||
HCL_LOG_TARGET,
|
||||
HCL_SYMTAB_SIZE, /* default system table size */
|
||||
HCL_SYSDIC_SIZE, /* default system dictionary size */
|
||||
HCL_PROCSTK_SIZE, /* default process stack size */
|
||||
@ -1183,6 +1184,7 @@ typedef int (*hcl_ioimpl_t) (
|
||||
* ========================================================================= */
|
||||
|
||||
|
||||
typedef void (*hcl_cb_opt_set_t) (hcl_t* hcl, hcl_option_t id, const void* val);
|
||||
typedef void (*hcl_cb_fini_t) (hcl_t* hcl);
|
||||
typedef void (*hcl_cb_gc_t) (hcl_t* hcl);
|
||||
typedef int (*hcl_cb_vm_startup_t) (hcl_t* hcl);
|
||||
@ -1192,6 +1194,7 @@ typedef void (*hcl_cb_vm_checkbc_t) (hcl_t* hcl, hcl_oob_t bcode);
|
||||
typedef struct hcl_cb_t hcl_cb_t;
|
||||
struct hcl_cb_t
|
||||
{
|
||||
hcl_cb_opt_set_t opt_set;
|
||||
hcl_cb_gc_t gc;
|
||||
hcl_cb_fini_t fini;
|
||||
|
||||
@ -1356,6 +1359,12 @@ struct hcl_t
|
||||
hcl_bitmask_t trait;
|
||||
hcl_bitmask_t log_mask;
|
||||
hcl_oow_t log_maxcapa;
|
||||
hcl_ooch_t* log_target;
|
||||
#if defined(HCL_OOCH_IS_UCH)
|
||||
hcl_bch_t* log_targetx;
|
||||
#else
|
||||
hcl_uch_t* log_targetx;
|
||||
#endif
|
||||
hcl_oow_t dfl_symtab_size;
|
||||
hcl_oow_t dfl_sysdic_size;
|
||||
hcl_oow_t dfl_procstk_size;
|
||||
@ -1737,6 +1746,12 @@ HCL_EXPORT hcl_t* hcl_open (
|
||||
hcl_errnum_t* errnum
|
||||
);
|
||||
|
||||
HCL_EXPORT hcl_t* hcl_openstd (
|
||||
hcl_oow_t xtnsize,
|
||||
hcl_oow_t heapsize,
|
||||
hcl_errnum_t* errnum
|
||||
);
|
||||
|
||||
HCL_EXPORT void hcl_close (
|
||||
hcl_t* vm
|
||||
);
|
||||
|
@ -848,6 +848,8 @@ static pf_t builtin_prims[] =
|
||||
{ 0, 0, hcl_pf_semaphore_new, 7, { 's','e','m','-','n','e','w'} },
|
||||
{ 1, 1, hcl_pf_semaphore_wait, 8, { 's','e','m','-','w','a','i','t'} },
|
||||
{ 1, 3, hcl_pf_semaphore_signal, 10, { 's','e','m','-','s','i','g','n','a','l'} },
|
||||
{ 2, 2, hcl_pf_semaphore_signal_on_input, 19, { 's','e','m','-','s','i','g','n','a','l','-','o','n','-','i','n','p','u','t'} },
|
||||
{ 2, 2, hcl_pf_semaphore_signal_on_output, 20, { 's','e','m','-','s','i','g','n','a','l','-','o','n','-','o','u','t','p','u','t'} },
|
||||
{ 1, 1, hcl_pf_semaphore_unsignal, 12, { 's','e','m','-','u','n','s','i','g','n','a','l'} },
|
||||
|
||||
{ 0, 0, hcl_pf_semaphore_group_new, 9, { 's','e','m','g','r','-','n','e','w'} },
|
||||
|
Reference in New Issue
Block a user