reorganized some callback functions into cb-impl.c

This commit is contained in:
hyung-hwan 2018-11-03 15:57:14 +00:00
parent 8537f8a67f
commit 140682dfc4
12 changed files with 1317 additions and 1214 deletions

View File

@ -102,7 +102,7 @@ libhcl_la_DEPENDENCIES += $(abs_builddir)/../mod/libhcl-str.la
endif
bin_PROGRAMS = hcl
hcl_SOURCES = main.c
hcl_SOURCES = main.c cb-impl.c cb-impl.h
hcl_CPPFLAGS = $(CPPFLAGS_ALL_COMMON) $(CPPFLAGS_PFMOD)
hcl_LDFLAGS = $(LDFLAGS_ALL_COMMON)
hcl_LDADD = $(LIBADD_LIB_COMMON) -lhcl
@ -123,21 +123,21 @@ libhclex_la_LIBADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) -lhcl
libhclex_la_DEPENDENCIES = libhcl.la
bin_PROGRAMS += hcls
hcls_SOURCES = main-s.c
hcls_SOURCES = main-s.c cb-impl.c cb-impl.h
hcls_CPPFLAGS = $(CPPFLAGS_ALL_COMMON)
hcls_LDFLAGS = $(LDFLAGS_ALL_COMMON)
hcls_LDADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) -lhcl -lhclex
hcls_DEPENDENCIES = libhclex.la
bin_PROGRAMS += hclc
hclc_SOURCES = main-c.c
hclc_SOURCES = main-c.c cb-impl.c cb-impl.h
hclc_CPPFLAGS = $(CPPFLAGS_ALL_COMMON)
hclc_LDFLAGS = $(LDFLAGS_ALL_COMMON)
hclc_LDADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) -lhcl -lhclex
hclc_DEPENDENCIES = libhclex.la
bin_PROGRAMS += hclj
hclj_SOURCES = main-j.c
hclj_SOURCES = main-j.c cb-impl.c cb-impl.h
hclj_CPPFLAGS = $(CPPFLAGS_ALL_COMMON)
hclj_LDFLAGS = $(LDFLAGS_ALL_COMMON)
hclj_LDADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) -lhcl -lhclex

View File

@ -183,25 +183,28 @@ libhclex_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
@ENABLE_HCLEX_TRUE@am__EXEEXT_1 = hcls$(EXEEXT) hclc$(EXEEXT) \
@ENABLE_HCLEX_TRUE@ hclj$(EXEEXT)
PROGRAMS = $(bin_PROGRAMS)
am_hcl_OBJECTS = hcl-main.$(OBJEXT)
am_hcl_OBJECTS = hcl-main.$(OBJEXT) hcl-cb-impl.$(OBJEXT)
hcl_OBJECTS = $(am_hcl_OBJECTS)
hcl_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(hcl_LDFLAGS) $(LDFLAGS) -o $@
am__hclc_SOURCES_DIST = main-c.c
@ENABLE_HCLEX_TRUE@am_hclc_OBJECTS = hclc-main-c.$(OBJEXT)
am__hclc_SOURCES_DIST = main-c.c cb-impl.c cb-impl.h
@ENABLE_HCLEX_TRUE@am_hclc_OBJECTS = hclc-main-c.$(OBJEXT) \
@ENABLE_HCLEX_TRUE@ hclc-cb-impl.$(OBJEXT)
hclc_OBJECTS = $(am_hclc_OBJECTS)
hclc_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(hclc_LDFLAGS) $(LDFLAGS) -o $@
am__hclj_SOURCES_DIST = main-j.c
@ENABLE_HCLEX_TRUE@am_hclj_OBJECTS = hclj-main-j.$(OBJEXT)
am__hclj_SOURCES_DIST = main-j.c cb-impl.c cb-impl.h
@ENABLE_HCLEX_TRUE@am_hclj_OBJECTS = hclj-main-j.$(OBJEXT) \
@ENABLE_HCLEX_TRUE@ hclj-cb-impl.$(OBJEXT)
hclj_OBJECTS = $(am_hclj_OBJECTS)
hclj_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(hclj_LDFLAGS) $(LDFLAGS) -o $@
am__hcls_SOURCES_DIST = main-s.c
@ENABLE_HCLEX_TRUE@am_hcls_OBJECTS = hcls-main-s.$(OBJEXT)
am__hcls_SOURCES_DIST = main-s.c cb-impl.c cb-impl.h
@ENABLE_HCLEX_TRUE@am_hcls_OBJECTS = hcls-main-s.$(OBJEXT) \
@ENABLE_HCLEX_TRUE@ hcls-cb-impl.$(OBJEXT)
hcls_OBJECTS = $(am_hcls_OBJECTS)
hcls_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
@ -495,7 +498,7 @@ libhcl_la_CPPFLAGS = $(CPPFLAGS_LIB_COMMON)
libhcl_la_LDFLAGS = $(LDFLAGS_LIB_COMMON)
libhcl_la_LIBADD = $(LIBADD_LIB_COMMON) $(am__append_6)
libhcl_la_DEPENDENCIES = $(am__append_7)
hcl_SOURCES = main.c
hcl_SOURCES = main.c cb-impl.c cb-impl.h
hcl_CPPFLAGS = $(CPPFLAGS_ALL_COMMON) $(CPPFLAGS_PFMOD)
hcl_LDFLAGS = $(LDFLAGS_ALL_COMMON)
hcl_LDADD = $(LIBADD_LIB_COMMON) -lhcl
@ -511,17 +514,17 @@ hcl_DEPENDENCIES = libhcl.la
@ENABLE_HCLEX_TRUE@libhclex_la_LDFLAGS = $(LDFLAGS_LIB_COMMON)
@ENABLE_HCLEX_TRUE@libhclex_la_LIBADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) -lhcl
@ENABLE_HCLEX_TRUE@libhclex_la_DEPENDENCIES = libhcl.la
@ENABLE_HCLEX_TRUE@hcls_SOURCES = main-s.c
@ENABLE_HCLEX_TRUE@hcls_SOURCES = main-s.c cb-impl.c cb-impl.h
@ENABLE_HCLEX_TRUE@hcls_CPPFLAGS = $(CPPFLAGS_ALL_COMMON)
@ENABLE_HCLEX_TRUE@hcls_LDFLAGS = $(LDFLAGS_ALL_COMMON)
@ENABLE_HCLEX_TRUE@hcls_LDADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) -lhcl -lhclex
@ENABLE_HCLEX_TRUE@hcls_DEPENDENCIES = libhclex.la
@ENABLE_HCLEX_TRUE@hclc_SOURCES = main-c.c
@ENABLE_HCLEX_TRUE@hclc_SOURCES = main-c.c cb-impl.c cb-impl.h
@ENABLE_HCLEX_TRUE@hclc_CPPFLAGS = $(CPPFLAGS_ALL_COMMON)
@ENABLE_HCLEX_TRUE@hclc_LDFLAGS = $(LDFLAGS_ALL_COMMON)
@ENABLE_HCLEX_TRUE@hclc_LDADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) -lhcl -lhclex
@ENABLE_HCLEX_TRUE@hclc_DEPENDENCIES = libhclex.la
@ENABLE_HCLEX_TRUE@hclj_SOURCES = main-j.c
@ENABLE_HCLEX_TRUE@hclj_SOURCES = main-j.c cb-impl.c cb-impl.h
@ENABLE_HCLEX_TRUE@hclj_CPPFLAGS = $(CPPFLAGS_ALL_COMMON)
@ENABLE_HCLEX_TRUE@hclj_LDFLAGS = $(LDFLAGS_ALL_COMMON)
@ENABLE_HCLEX_TRUE@hclj_LDADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) -lhcl -lhclex
@ -688,9 +691,13 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hcl-cb-impl.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hcl-main.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hclc-cb-impl.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hclc-main-c.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hclj-cb-impl.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hclj-main-j.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hcls-cb-impl.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hcls-main-s.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-bigint.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-comp.Plo@am__quote@
@ -939,6 +946,20 @@ hcl-main.obj: main.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hcl_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hcl-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi`
hcl-cb-impl.o: cb-impl.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hcl_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hcl-cb-impl.o -MD -MP -MF $(DEPDIR)/hcl-cb-impl.Tpo -c -o hcl-cb-impl.o `test -f 'cb-impl.c' || echo '$(srcdir)/'`cb-impl.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/hcl-cb-impl.Tpo $(DEPDIR)/hcl-cb-impl.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cb-impl.c' object='hcl-cb-impl.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hcl_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hcl-cb-impl.o `test -f 'cb-impl.c' || echo '$(srcdir)/'`cb-impl.c
hcl-cb-impl.obj: cb-impl.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hcl_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hcl-cb-impl.obj -MD -MP -MF $(DEPDIR)/hcl-cb-impl.Tpo -c -o hcl-cb-impl.obj `if test -f 'cb-impl.c'; then $(CYGPATH_W) 'cb-impl.c'; else $(CYGPATH_W) '$(srcdir)/cb-impl.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/hcl-cb-impl.Tpo $(DEPDIR)/hcl-cb-impl.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cb-impl.c' object='hcl-cb-impl.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hcl_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hcl-cb-impl.obj `if test -f 'cb-impl.c'; then $(CYGPATH_W) 'cb-impl.c'; else $(CYGPATH_W) '$(srcdir)/cb-impl.c'; fi`
hclc-main-c.o: main-c.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hclc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hclc-main-c.o -MD -MP -MF $(DEPDIR)/hclc-main-c.Tpo -c -o hclc-main-c.o `test -f 'main-c.c' || echo '$(srcdir)/'`main-c.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/hclc-main-c.Tpo $(DEPDIR)/hclc-main-c.Po
@ -953,6 +974,20 @@ hclc-main-c.obj: main-c.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hclc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hclc-main-c.obj `if test -f 'main-c.c'; then $(CYGPATH_W) 'main-c.c'; else $(CYGPATH_W) '$(srcdir)/main-c.c'; fi`
hclc-cb-impl.o: cb-impl.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hclc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hclc-cb-impl.o -MD -MP -MF $(DEPDIR)/hclc-cb-impl.Tpo -c -o hclc-cb-impl.o `test -f 'cb-impl.c' || echo '$(srcdir)/'`cb-impl.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/hclc-cb-impl.Tpo $(DEPDIR)/hclc-cb-impl.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cb-impl.c' object='hclc-cb-impl.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hclc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hclc-cb-impl.o `test -f 'cb-impl.c' || echo '$(srcdir)/'`cb-impl.c
hclc-cb-impl.obj: cb-impl.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hclc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hclc-cb-impl.obj -MD -MP -MF $(DEPDIR)/hclc-cb-impl.Tpo -c -o hclc-cb-impl.obj `if test -f 'cb-impl.c'; then $(CYGPATH_W) 'cb-impl.c'; else $(CYGPATH_W) '$(srcdir)/cb-impl.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/hclc-cb-impl.Tpo $(DEPDIR)/hclc-cb-impl.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cb-impl.c' object='hclc-cb-impl.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hclc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hclc-cb-impl.obj `if test -f 'cb-impl.c'; then $(CYGPATH_W) 'cb-impl.c'; else $(CYGPATH_W) '$(srcdir)/cb-impl.c'; fi`
hclj-main-j.o: main-j.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hclj_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hclj-main-j.o -MD -MP -MF $(DEPDIR)/hclj-main-j.Tpo -c -o hclj-main-j.o `test -f 'main-j.c' || echo '$(srcdir)/'`main-j.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/hclj-main-j.Tpo $(DEPDIR)/hclj-main-j.Po
@ -967,6 +1002,20 @@ hclj-main-j.obj: main-j.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hclj_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hclj-main-j.obj `if test -f 'main-j.c'; then $(CYGPATH_W) 'main-j.c'; else $(CYGPATH_W) '$(srcdir)/main-j.c'; fi`
hclj-cb-impl.o: cb-impl.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hclj_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hclj-cb-impl.o -MD -MP -MF $(DEPDIR)/hclj-cb-impl.Tpo -c -o hclj-cb-impl.o `test -f 'cb-impl.c' || echo '$(srcdir)/'`cb-impl.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/hclj-cb-impl.Tpo $(DEPDIR)/hclj-cb-impl.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cb-impl.c' object='hclj-cb-impl.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hclj_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hclj-cb-impl.o `test -f 'cb-impl.c' || echo '$(srcdir)/'`cb-impl.c
hclj-cb-impl.obj: cb-impl.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hclj_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hclj-cb-impl.obj -MD -MP -MF $(DEPDIR)/hclj-cb-impl.Tpo -c -o hclj-cb-impl.obj `if test -f 'cb-impl.c'; then $(CYGPATH_W) 'cb-impl.c'; else $(CYGPATH_W) '$(srcdir)/cb-impl.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/hclj-cb-impl.Tpo $(DEPDIR)/hclj-cb-impl.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cb-impl.c' object='hclj-cb-impl.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hclj_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hclj-cb-impl.obj `if test -f 'cb-impl.c'; then $(CYGPATH_W) 'cb-impl.c'; else $(CYGPATH_W) '$(srcdir)/cb-impl.c'; fi`
hcls-main-s.o: main-s.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hcls_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hcls-main-s.o -MD -MP -MF $(DEPDIR)/hcls-main-s.Tpo -c -o hcls-main-s.o `test -f 'main-s.c' || echo '$(srcdir)/'`main-s.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/hcls-main-s.Tpo $(DEPDIR)/hcls-main-s.Po
@ -981,6 +1030,20 @@ hcls-main-s.obj: main-s.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hcls_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hcls-main-s.obj `if test -f 'main-s.c'; then $(CYGPATH_W) 'main-s.c'; else $(CYGPATH_W) '$(srcdir)/main-s.c'; fi`
hcls-cb-impl.o: cb-impl.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hcls_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hcls-cb-impl.o -MD -MP -MF $(DEPDIR)/hcls-cb-impl.Tpo -c -o hcls-cb-impl.o `test -f 'cb-impl.c' || echo '$(srcdir)/'`cb-impl.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/hcls-cb-impl.Tpo $(DEPDIR)/hcls-cb-impl.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cb-impl.c' object='hcls-cb-impl.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hcls_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hcls-cb-impl.o `test -f 'cb-impl.c' || echo '$(srcdir)/'`cb-impl.c
hcls-cb-impl.obj: cb-impl.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hcls_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hcls-cb-impl.obj -MD -MP -MF $(DEPDIR)/hcls-cb-impl.Tpo -c -o hcls-cb-impl.obj `if test -f 'cb-impl.c'; then $(CYGPATH_W) 'cb-impl.c'; else $(CYGPATH_W) '$(srcdir)/cb-impl.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/hcls-cb-impl.Tpo $(DEPDIR)/hcls-cb-impl.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cb-impl.c' object='hcls-cb-impl.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hcls_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hcls-cb-impl.obj `if test -f 'cb-impl.c'; then $(CYGPATH_W) 'cb-impl.c'; else $(CYGPATH_W) '$(srcdir)/cb-impl.c'; fi`
mostlyclean-libtool:
-rm -f *.lo

1071
lib/cb-impl.c Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -132,7 +132,7 @@ static int vm_startup (hcl_t* hcl)
return -1;
}
}
hcl->vmprim.vm_gettime (hcl, &hcl->exec_start_time); /* raw time. no adjustment */
hcl->vmprim.gettime (hcl, &hcl->exec_start_time); /* raw time. no adjustment */
return 0;
}
@ -140,7 +140,7 @@ static int vm_startup (hcl_t* hcl)
static void vm_cleanup (hcl_t* hcl)
{
hcl_cb_t* cb;
hcl->vmprim.vm_gettime (hcl, &hcl->exec_end_time); /* raw time. no adjustment */
hcl->vmprim.gettime (hcl, &hcl->exec_end_time); /* raw time. no adjustment */
for (cb = hcl->cblist; cb; cb = cb->next)
{
if (cb->vm_cleanup) cb->vm_cleanup(hcl);
@ -1281,7 +1281,7 @@ static int execute (hcl_t* hcl)
if (hcl->sem_heap_count > 0)
{
hcl_ntime_t ft, now;
hcl->vmprim.vm_gettime (hcl, &now);
hcl->vmprim.gettime (hcl, &now);
do
{
@ -1325,8 +1325,8 @@ static int execute (hcl_t* hcl)
else if (hcl->processor->active == hcl->nil_process)
{
HCL_SUB_NTIME (&ft, &ft, (hcl_ntime_t*)&now);
hcl->vmprim.vm_sleep (hcl, &ft); /* TODO: change this to i/o multiplexer??? */
hcl->vmprim.vm_gettime (hcl, &now);
hcl->vmprim.sleep (hcl, &ft); /* TODO: change this to i/o multiplexer??? */
hcl->vmprim.gettime (hcl, &now);
}
else
{

View File

@ -26,6 +26,7 @@
#include "hcl-c.h"
#include "hcl-prv.h"
#include "cb-impl.h"
#include <string.h>
#include <errno.h>
@ -137,16 +138,6 @@ static void log_write_for_dummy (hcl_t* hcl, hcl_bitmask_t mask, const hcl_ooch_
client->prim.log_write (client, mask, msg, len);
}
static void syserrstrb (hcl_t* hcl, int syserr, hcl_bch_t* buf, hcl_oow_t len)
{
#if defined(HAVE_STRERROR_R)
strerror_r (syserr, buf, len);
#else
/* this may not be thread safe */
hcl_copy_bcstr (buf, len, strerror(syserr));
#endif
}
/* ========================================================================= */
static HCL_INLINE int is_spacechar (hcl_bch_t c)
@ -820,8 +811,8 @@ hcl_client_t* hcl_client_open (hcl_mmgr_t* mmgr, hcl_oow_t xtnsize, hcl_client_p
HCL_MEMSET (&vmprim, 0, HCL_SIZEOF(vmprim));
vmprim.log_write = log_write_for_dummy;
vmprim.syserrstrb = syserrstrb;
vmprim.assertfail = assert_fail;
vmprim.syserrstrb = hcl_vmprim_syserrstrb;
vmprim.assertfail = hcl_vmprim_assertfail;
hcl = hcl_open(mmgr, HCL_SIZEOF(*xtn), 2048, &vmprim, errnum);
if (!hcl)

View File

@ -28,6 +28,7 @@
#include "hcl-prv.h"
#include "hcl-tmr.h"
#include "hcl-xutl.h"
#include "cb-impl.h"
#include <stdio.h>
#include <string.h>
@ -354,15 +355,15 @@ struct hcl_server_t
/* ========================================================================= */
#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
# define IS_PATH_SEP(c) ((c) == '/' || (c) == '\\')
# define HCL_IS_PATH_SEP(c) ((c) == '/' || (c) == '\\')
# define PATH_SEP_CHAR ('\\')
#else
# define IS_PATH_SEP(c) ((c) == '/')
# define HCL_IS_PATH_SEP(c) ((c) == '/')
# define PATH_SEP_CHAR ('/')
#endif
/* TODO: handle path with a drive letter or in the UNC notation */
#define IS_PATH_ABSOLUTE(x) IS_PATH_SEP(x[0])
#define HCL_IS_PATH_ABSOLUTE(x) HCL_IS_PATH_SEP(x[0])
static const hcl_bch_t* get_base_name (const hcl_bch_t* path)
@ -371,7 +372,7 @@ static const hcl_bch_t* get_base_name (const hcl_bch_t* path)
for (p = path; *p != '\0'; p++)
{
if (IS_PATH_SEP(*p)) last = p;
if (HCL_IS_PATH_SEP(*p)) last = p;
}
return (last == HCL_NULL)? path: (last + 1);
@ -426,7 +427,7 @@ static HCL_INLINE int open_input (hcl_t* hcl, hcl_ioinarg_t* arg)
#else
hcl_copy_bchars (bb->fn, server->cfg.script_include_path, parlen);
#endif
if (!IS_PATH_SEP(bb->fn[parlen])) bb->fn[parlen++] = PATH_SEP_CHAR; /* +2 was used in hcl_callocmem() for this (+1 for this, +1 for '\0' */
if (!HCL_IS_PATH_SEP(bb->fn[parlen])) bb->fn[parlen++] = PATH_SEP_CHAR; /* +2 was used in hcl_callocmem() for this (+1 for this, +1 for '\0' */
}
else
{
@ -665,8 +666,6 @@ static void log_write_for_dummy (hcl_t* hcl, hcl_bitmask_t mask, const hcl_ooch_
pthread_mutex_unlock (&server->log_mutex);
}
#include "cb-impl.h"
/* ========================================================================= */
static int vm_startup (hcl_t* hcl)
@ -715,17 +714,19 @@ hcl_server_proto_t* hcl_server_proto_open (hcl_oow_t xtnsize, hcl_server_worker_
HCL_MEMSET (&vmprim, 0, HCL_SIZEOF(vmprim));
if (worker->server->cfg.trait & HCL_SERVER_TRAIT_USE_LARGE_PAGES)
{
vmprim.alloc_heap = alloc_heap;
vmprim.free_heap = free_heap;
vmprim.alloc_heap = hcl_vmprim_alloc_heap;
vmprim.free_heap = hcl_vmprim_free_heap;
}
vmprim.log_write = log_write;
vmprim.syserrstrb = syserrstrb;
vmprim.assertfail = assert_fail;
vmprim.dl_open = dl_open;
vmprim.dl_close = dl_close;
vmprim.dl_getsym = dl_getsym;
vmprim.vm_gettime = vm_gettime;
vmprim.vm_sleep = vm_sleep;
vmprim.syserrstrb = hcl_vmprim_syserrstrb;
vmprim.assertfail = hcl_vmprim_assertfail;
vmprim.dl_startup = hcl_vmprim_dl_startup;
vmprim.dl_cleanup = hcl_vmprim_dl_cleanup;
vmprim.dl_open = hcl_vmprim_dl_open;
vmprim.dl_close = hcl_vmprim_dl_close;
vmprim.dl_getsym = hcl_vmprim_dl_getsym;
vmprim.gettime = hcl_vmprim_gettime;
vmprim.sleep = hcl_vmprim_sleep;
proto = (hcl_server_proto_t*)hcl_server_allocmem(worker->server, HCL_SIZEOF(*proto));
if (!proto) return HCL_NULL;
@ -1190,7 +1191,7 @@ static int insert_exec_timer (hcl_server_proto_t* proto, const hcl_ntime_t* tmou
HCL_MEMSET (&event, 0, HCL_SIZEOF(event));
event.ctx = proto;
proto->hcl->vmprim.vm_gettime (proto->hcl, &event.when);
proto->hcl->vmprim.gettime (proto->hcl, &event.when);
HCL_ADD_NTIME (&event.when, &event.when, tmout);
event.handler = exec_runtime_handler;
event.updater = exec_runtime_updater;
@ -1582,12 +1583,15 @@ hcl_server_t* hcl_server_open (hcl_mmgr_t* mmgr, hcl_oow_t xtnsize, hcl_server_p
HCL_MEMSET (&vmprim, 0, HCL_SIZEOF(vmprim));
vmprim.log_write = log_write_for_dummy;
vmprim.syserrstrb = syserrstrb;
vmprim.dl_open = dl_open;
vmprim.dl_close = dl_close;
vmprim.dl_getsym = dl_getsym;
vmprim.vm_gettime = vm_gettime;
vmprim.vm_sleep = vm_sleep;
vmprim.syserrstrb = hcl_vmprim_syserrstrb;
vmprim.assertfail = hcl_vmprim_assertfail;
vmprim.dl_startup = hcl_vmprim_dl_startup;
vmprim.dl_cleanup = hcl_vmprim_dl_cleanup;
vmprim.dl_open = hcl_vmprim_dl_open;
vmprim.dl_close = hcl_vmprim_dl_close;
vmprim.dl_getsym = hcl_vmprim_dl_getsym;
vmprim.gettime = hcl_vmprim_gettime;
vmprim.sleep = hcl_vmprim_sleep;
#if defined(USE_LTDL)
lt_dlinit ();
@ -1605,7 +1609,7 @@ hcl_server_t* hcl_server_open (hcl_mmgr_t* mmgr, hcl_oow_t xtnsize, hcl_server_p
if (pipe(pfd) <= -1)
{
if (errnum) *errnum = syserrstrb(hcl, 0, errno, HCL_NULL, 0);
if (errnum) *errnum = hcl_vmprim_syserrstrb(hcl, 0, errno, HCL_NULL, 0);
goto oops;
}
@ -1682,9 +1686,6 @@ oops:
/* NOTE: pipe should be closed if jump to here is made after pipe() above */
if (tmr) hcl_tmr_close (tmr);
if (hcl) hcl_close (hcl);
#if defined(USE_LTDL)
lt_dlexit ();
#endif
if (server) HCL_MMGR_FREE (mmgr, server);
return HCL_NULL;
@ -1714,10 +1715,6 @@ void hcl_server_close (hcl_server_t* server)
hcl_tmr_close (server->tmr);
hcl_close (server->dummy_hcl);
#if defined(USE_LTDL)
lt_dlexit ();
#endif
HCL_MMGR_FREE (server->mmgr, server);
}
@ -1811,7 +1808,7 @@ static hcl_server_worker_t* alloc_worker (hcl_server_t* server, int cli_sck, con
worker->peeraddr = *peeraddr;
worker->server = server;
server->dummy_hcl->vmprim.vm_gettime (server->dummy_hcl, &worker->alloc_time); /* TODO: the callback may return monotonic time. find a way to guarantee it is realtime??? */
server->dummy_hcl->vmprim.gettime (server->dummy_hcl, &worker->alloc_time); /* TODO: the callback may return monotonic time. find a way to guarantee it is realtime??? */
if (server->wid_map.free_first == HCL_SERVER_WID_INVALID && prepare_to_acquire_wid(server) <= -1)
{

View File

@ -103,6 +103,14 @@ int hcl_init (hcl_t* hcl, hcl_mmgr_t* mmgr, hcl_oow_t heapsz, const hcl_vmprim_t
return -1;
}
#if !defined(HCL_BUILD_RELEASE)
if (!vmprim->assertfail)
{
hcl_seterrnum (hcl, HCL_EINVAL);
return -1;
}
#endif
HCL_MEMSET (hcl, 0, HCL_SIZEOF(*hcl));
hcl->mmgr = mmgr;
hcl->cmgr = hcl_get_utf8_cmgr();
@ -149,6 +157,7 @@ int hcl_init (hcl_t* hcl, hcl_mmgr_t* mmgr, hcl_oow_t heapsz, const hcl_vmprim_t
hcl->newheap = hcl_makeheap(hcl, heapsz);
if (!hcl->newheap) goto oops;
if (hcl->vmprim.dl_startup) hcl->vmprim.dl_startup (hcl);
return 0;
oops:
@ -284,6 +293,8 @@ void hcl_fini (hcl_t* hcl)
hcl->sprintf.xbuf.capa = 0;
hcl->sprintf.xbuf.len = 0;
}
if (hcl->vmprim.dl_cleanup) hcl->vmprim.dl_cleanup (hcl);
}
void hcl_reset (hcl_t* hcl)

View File

@ -843,6 +843,14 @@ enum hcl_vmprim_dlopen_flag_t
};
typedef enum hcl_vmprim_dlopen_flag_t hcl_vmprim_dlopen_flag_t;
typedef void (*hcl_vmprim_dlstartup_t) (
hcl_t* hcl
);
typedef void (*hcl_vmprim_dlcleanup_t) (
hcl_t* hcl
);
typedef void* (*hcl_vmprim_dlopen_t) (
hcl_t* hcl,
const hcl_ooch_t* name,
@ -867,7 +875,8 @@ typedef void (*hcl_vmprim_gettime_t) (
typedef void (*hcl_vmprim_sleep_t) (
hcl_t* hcl,
const hcl_ntime_t* duration);
const hcl_ntime_t* duration
);
struct hcl_vmprim_t
{
@ -888,12 +897,14 @@ struct hcl_vmprim_t
hcl_syserrstru_t syserrstru;
hcl_assertfail_t assertfail;
hcl_vmprim_dlstartup_t dl_startup; /* optional */
hcl_vmprim_dlcleanup_t dl_cleanup; /* optional */
hcl_vmprim_dlopen_t dl_open; /* required */
hcl_vmprim_dlclose_t dl_close; /* required */
hcl_vmprim_dlgetsym_t dl_getsym; /* requried */
hcl_vmprim_gettime_t vm_gettime; /* required */
hcl_vmprim_sleep_t vm_sleep; /* required */
hcl_vmprim_gettime_t gettime; /* required */
hcl_vmprim_sleep_t sleep; /* required */
};
typedef struct hcl_vmprim_t hcl_vmprim_t;

View File

@ -26,6 +26,7 @@
#include "hcl-json.h"
#include "hcl-prv.h"
#include "cb-impl.h"
#include <string.h>
#include <errno.h>
@ -119,16 +120,6 @@ static void log_write_for_dummy (hcl_t* hcl, hcl_bitmask_t mask, const hcl_ooch_
json->prim.log_write (json, mask, msg, len);
}
static void syserrstrb (hcl_t* hcl, int syserr, hcl_bch_t* buf, hcl_oow_t len)
{
#if defined(HAVE_STRERROR_R)
strerror_r (syserr, buf, len);
#else
/* this may not be thread safe */
hcl_copy_bcstr (buf, len, strerror(syserr));
#endif
}
/* ========================================================================= */
static HCL_INLINE int is_spacechar (hcl_bch_t c)
@ -909,8 +900,8 @@ hcl_json_t* hcl_json_open (hcl_mmgr_t* mmgr, hcl_oow_t xtnsize, hcl_json_prim_t*
HCL_MEMSET (&vmprim, 0, HCL_SIZEOF(vmprim));
vmprim.log_write = log_write_for_dummy;
vmprim.syserrstrb = syserrstrb;
vmprim.assertfail = assert_fail;
vmprim.syserrstrb = hcl_vmprim_syserrstrb;
vmprim.assertfail = hcl_vmprim_assertfail;
hcl = hcl_open(mmgr, HCL_SIZEOF(*xtn), 2048, &vmprim, errnum);
if (!hcl)

View File

@ -26,6 +26,7 @@
#include "hcl-prv.h"
#include "hcl-opt.h"
#include "cb-impl.h"
#include <stdio.h>
#include <stdlib.h>
@ -41,36 +42,24 @@
# include <fcntl.h>
# include <time.h>
# include <signal.h>
# if defined(HCL_HAVE_CFG_H) && defined(HCL_ENABLE_LIBLTDL)
# include <ltdl.h>
# define USE_LTDL
# else
# define USE_WIN_DLL
# endif
#elif defined(__OS2__)
# define INCL_DOSMODULEMGR
# define INCL_DOSPROCESS
# define INCL_DOSERRORS
# include <os2.h>
#elif defined(__MSDOS__)
#elif defined(__DOS__)
# include <dos.h>
# include <time.h>
#elif defined(macintosh)
# include <Timer.h>
#else
# if defined(HCL_ENABLE_LIBLTDL)
# include <ltdl.h>
# define USE_LTDL
# elif defined(HAVE_DLFCN_H)
# include <dlfcn.h>
# define USE_DLFCN
# elif defined(__APPLE__) || defined(__MACOSX__)
# define USE_MACH_O_DYLD
# include <mach-o/dyld.h>
# else
# error UNSUPPORTED DYNAMIC LINKER
# endif
# include <sys/types.h>
# include <errno.h>
# include <unistd.h>
# include <fcntl.h>
# if defined(HAVE_TIME_H)
# include <time.h>
@ -81,49 +70,7 @@
# if defined(HAVE_SIGNAL_H)
# include <signal.h>
# endif
# if defined(HAVE_SYS_MMAN_H)
# include <sys/mman.h>
# endif
# include <errno.h>
# include <unistd.h>
# include <fcntl.h>
#endif
#if !defined(HCL_DEFAULT_PFMODDIR)
# define HCL_DEFAULT_PFMODDIR ""
#endif
#if !defined(HCL_DEFAULT_PFMODPREFIX)
# if defined(_WIN32)
# define HCL_DEFAULT_PFMODPREFIX "hcl-"
# elif defined(__OS2__)
# define HCL_DEFAULT_PFMODPREFIX "hcl"
# elif defined(__DOS__)
# define HCL_DEFAULT_PFMODPREFIX "hcl"
# else
# define HCL_DEFAULT_PFMODPREFIX "libhcl-"
# endif
#endif
#if !defined(HCL_DEFAULT_PFMODPOSTFIX)
# if defined(_WIN32)
# define HCL_DEFAULT_PFMODPOSTFIX ""
# elif defined(__OS2__)
# define HCL_DEFAULT_PFMODPOSTFIX ""
# elif defined(__DOS__)
# define HCL_DEFAULT_PFMODPOSTFIX ""
# else
# if defined(USE_DLFCN)
# define HCL_DEFAULT_PFMODPOSTFIX ".so"
# elif defined(USE_MACH_O_DYLD)
# define HCL_DEFAULT_PFMODPOSTFIX ".dylib"
# else
# define HCL_DEFAULT_PFMODPOSTFIX ""
# endif
# endif
#endif
typedef struct bb_t bb_t;
@ -190,23 +137,13 @@ static hcl_mmgr_t sys_mmgr =
/* ========================================================================= */
#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
# define IS_PATH_SEP(c) ((c) == '/' || (c) == '\\')
#else
# define IS_PATH_SEP(c) ((c) == '/')
#endif
/* TODO: handle path with a drive letter or in the UNC notation */
#define IS_PATH_ABSOLUTE(x) IS_PATH_SEP(x[0])
static const hcl_bch_t* get_base_name (const hcl_bch_t* path)
{
const hcl_bch_t* p, * last = HCL_NULL;
for (p = path; *p != '\0'; p++)
{
if (IS_PATH_SEP(*p)) last = p;
if (HCL_IS_PATH_SEP(*p)) last = p;
}
return (last == HCL_NULL)? path: (last + 1);
@ -699,8 +636,6 @@ static void log_write (hcl_t* hcl, hcl_bitmask_t mask, const hcl_ooch_t* msg, hc
flush_log (hcl, logfd);
}
#include "cb-impl.h"
/* ========================================================================= */
static int vm_startup (hcl_t* hcl)
@ -882,113 +817,6 @@ static hcl_t* g_hcl = HCL_NULL;
/* ========================================================================= */
#if defined(__MSDOS__) && defined(_INTELC32_)
static void (*prev_timer_intr_handler) (void);
#pragma interrupt(timer_intr_handler)
static void timer_intr_handler (void)
{
/*
_XSTACK *stk;
int r;
stk = (_XSTACK *)_get_stk_frame();
r = (unsigned short)stk_ptr->eax;
*/
/* The timer interrupt (normally) occurs 18.2 times per second. */
if (g_hcl) hcl_switchprocess (g_hcl);
_chain_intr(prev_timer_intr_handler);
}
#elif defined(macintosh)
static TMTask g_tmtask;
static ProcessSerialNumber g_psn;
#define TMTASK_DELAY 50 /* milliseconds if positive, microseconds(after negation) if negative */
static pascal void timer_intr_handler (TMTask* task)
{
if (g_hcl) hcl_switchprocess (g_hcl);
WakeUpProcess (&g_psn);
PrimeTime ((QElem*)&g_tmtask, TMTASK_DELAY);
}
#else
static void arrange_process_switching (int sig)
{
if (g_hcl) hcl_switchprocess (g_hcl);
}
#endif
#if 0
static void setup_tick (void)
{
#if defined(__MSDOS__) && defined(_INTELC32_)
prev_timer_intr_handler = _dos_getvect (0x1C);
_dos_setvect (0x1C, timer_intr_handler);
#elif defined(macintosh)
GetCurrentProcess (&g_psn);
memset (&g_tmtask, 0, HCL_SIZEOF(g_tmtask));
g_tmtask.tmAddr = NewTimerProc (timer_intr_handler);
InsXTime ((QElem*)&g_tmtask);
PrimeTime ((QElem*)&g_tmtask, TMTASK_DELAY);
#elif defined(HAVE_SETITIMER) && defined(SIGVTALRM) && defined(ITIMER_VIRTUAL)
struct itimerval itv;
struct sigaction act;
sigemptyset (&act.sa_mask);
act.sa_handler = arrange_process_switching;
act.sa_flags = 0;
sigaction (SIGVTALRM, &act, HCL_NULL);
itv.it_interval.tv_sec = 0;
itv.it_interval.tv_usec = 100; /* 100 microseconds */
itv.it_value.tv_sec = 0;
itv.it_value.tv_usec = 100;
setitimer (ITIMER_VIRTUAL, &itv, HCL_NULL);
#else
# error UNSUPPORTED
#endif
}
static void cancel_tick (void)
{
#if defined(__MSDOS__) && defined(_INTELC32_)
_dos_setvect (0x1C, prev_timer_intr_handler);
#elif defined(macintosh)
RmvTime ((QElem*)&g_tmtask);
/*DisposeTimerProc (g_tmtask.tmAddr);*/
#elif defined(HAVE_SETITIMER) && defined(SIGVTALRM) && defined(ITIMER_VIRTUAL)
struct itimerval itv;
struct sigaction act;
itv.it_interval.tv_sec = 0;
itv.it_interval.tv_usec = 0;
itv.it_value.tv_sec = 0; /* make setitimer() one-shot only */
itv.it_value.tv_usec = 0;
setitimer (ITIMER_VIRTUAL, &itv, HCL_NULL);
sigemptyset (&act.sa_mask);
act.sa_handler = SIG_IGN; /* ignore the signal potentially fired by the one-shot arrange above */
act.sa_flags = 0;
sigaction (SIGVTALRM, &act, HCL_NULL);
#else
# error UNSUPPORTED
#endif
}
#endif
/* ========================================================================= */
#if defined(_WIN32) || defined(__MSDOS__) || defined(__OS2__) || defined(macintosh)
@ -1062,7 +890,6 @@ static void set_signal_to_default (int sig)
#endif
}
/* ========================================================================= */
static void print_synerr (hcl_t* hcl)
@ -1188,23 +1015,21 @@ int main (int argc, char* argv[])
memset (&vmprim, 0, HCL_SIZEOF(vmprim));
if (large_pages)
{
vmprim.alloc_heap = alloc_heap;
vmprim.free_heap = free_heap;
vmprim.alloc_heap = hcl_vmprim_alloc_heap;
vmprim.free_heap = hcl_vmprim_free_heap;
}
vmprim.log_write = log_write;
vmprim.syserrstrb = syserrstrb;
vmprim.assertfail = assert_fail;
vmprim.dl_open = dl_open;
vmprim.dl_close = dl_close;
vmprim.dl_getsym = dl_getsym;
vmprim.vm_gettime = vm_gettime;
vmprim.vm_sleep = vm_sleep;
vmprim.syserrstrb = hcl_vmprim_syserrstrb;
vmprim.assertfail = hcl_vmprim_assertfail;
vmprim.dl_startup = hcl_vmprim_dl_startup;
vmprim.dl_cleanup = hcl_vmprim_dl_cleanup;
vmprim.dl_open = hcl_vmprim_dl_open;
vmprim.dl_close = hcl_vmprim_dl_close;
vmprim.dl_getsym = hcl_vmprim_dl_getsym;
vmprim.gettime = hcl_vmprim_gettime;
vmprim.sleep = hcl_vmprim_sleep;
#if defined(USE_LTDL)
lt_dlinit ();
#endif
hcl = hcl_open (&sys_mmgr, HCL_SIZEOF(xtn_t), memsize, &vmprim, HCL_NULL);
hcl = hcl_open(&sys_mmgr, HCL_SIZEOF(xtn_t), memsize, &vmprim, HCL_NULL);
if (!hcl)
{
printf ("ERROR: cannot open hcl\n");
@ -1417,16 +1242,10 @@ count++;
set_signal_to_default (SIGINT);
hcl_close (hcl);
#if defined(USE_LTDL)
lt_dlexit ();
#endif
return 0;
oops:
set_signal_to_default (SIGINT); /* harmless to call multiple times without set_signal() */
if (hcl) hcl_close (hcl);
#if defined(USE_LTDL)
lt_dlexit ();
#endif
return -1;
}

View File

@ -244,7 +244,7 @@ int hcl_tmr_fire (hcl_tmr_t* tmr, const hcl_ntime_t* tm, hcl_oow_t* firecnt)
/* if the current time is not specified, get it from the system */
if (tm) now = *tm;
/*else if (hcl_gettime(&now) <= -1) return -1;*/
tmr->hcl->vmprim.vm_gettime (tmr->hcl, &now);
tmr->hcl->vmprim.gettime (tmr->hcl, &now);
while (tmr->size > 0)
{
@ -271,7 +271,7 @@ int hcl_tmr_gettmout (hcl_tmr_t* tmr, const hcl_ntime_t* tm, hcl_ntime_t* tmout)
/* if the current time is not specified, get it from the system */
if (tm) now = *tm;
/*else if (hcl_gettime(&now) <= -1) return -1;*/
tmr->hcl->vmprim.vm_gettime (tmr->hcl, &now);
tmr->hcl->vmprim.gettime (tmr->hcl, &now);
HCL_SUB_NTIME (tmout, &tmr->event[0].when, &now);
if (tmout->sec < 0) HCL_CLEAR_NTIME (tmout);