removed hcl_read() and hcl_compile().

in the next commit(), hcl_read2() and hcl_compile2() will get renamed to hcl_read() and hcl_compile() respectively
This commit is contained in:
hyung-hwan 2021-01-29 08:35:31 +00:00
parent 3dad8ce013
commit d4fbd0a298
9 changed files with 45 additions and 5617 deletions

View File

@ -1173,12 +1173,16 @@ hcl_logufmt (hcl, HCL_LOG_WARN, fmt, ustr, 0x6789);
} }
#endif #endif
#if 1
while (1) while (1)
{ {
hcl_cnode_t* obj; hcl_cnode_t* obj;
int n; int n;
/*
static int count = 0;
if (count %5 == 0) hcl_reset (hcl);
count++;
*/
obj = hcl_read2(hcl); obj = hcl_read2(hcl);
if (!obj) if (!obj)
{ {
@ -1269,111 +1273,6 @@ hcl_logufmt (hcl, HCL_LOG_WARN, fmt, ustr, 0x6789);
g_hcl = HCL_NULL; g_hcl = HCL_NULL;
} }
} }
#else
while (1)
{
hcl_oop_t obj;
/*
static int count = 0;
if (count %5 == 0) hcl_reset (hcl);
count++;
*/
obj = hcl_read(hcl);
if (!obj)
{
if (hcl->errnum == HCL_EFINIS)
{
/* end of input */
break;
}
else if (hcl->errnum == HCL_ESYNERR)
{
print_synerr (hcl);
if (xtn->reader_istty && hcl_getsynerrnum(hcl) != HCL_SYNERR_EOF)
{
/* TODO: drain remaining data in the reader including the actual inputstream and buffered data in hcl */
continue;
}
}
else
{
hcl_logbfmt (hcl, HCL_LOG_STDERR, "ERROR: cannot read object - [%d] %js\n", hcl_geterrnum(hcl), hcl_geterrmsg(hcl));
}
goto oops;
}
if (verbose && hcl_print(hcl, obj) <= -1)
{
hcl_logbfmt (hcl, HCL_LOG_STDERR, "ERROR: cannot print object - [%d] %js\n", hcl_geterrnum(hcl), hcl_geterrmsg(hcl));
}
else
{
if (xtn->reader_istty)
{
/* clear the byte code buffer */
/* TODO: create a proper function for this and call it */
hcl->code.bc.len = 0;
hcl->code.lit.len = 0;
}
if (verbose) hcl_prbfmt (hcl, "\n"); /* flush the output buffer by hcl_print above */
if (hcl_compile(hcl, obj) <= -1)
{
if (hcl->errnum == HCL_ESYNERR)
{
print_synerr (hcl);
}
else
{
hcl_logbfmt (hcl, HCL_LOG_STDERR, "ERROR: cannot compile object - [%d] %js\n", hcl_geterrnum(hcl), hcl_geterrmsg(hcl));
}
/* carry on? */
if (!xtn->reader_istty) goto oops;
}
else if (xtn->reader_istty)
{
/* interactive mode */
hcl_oop_t retv;
hcl_decode (hcl, 0, hcl_getbclen(hcl));
HCL_LOG0 (hcl, HCL_LOG_MNEMONIC, "------------------------------------------\n");
g_hcl = hcl;
//setup_tick ();
retv = hcl_execute(hcl);
/* flush pending output data in the interactive mode(e.g. printf without a newline) */
hcl_flushio (hcl);
if (!retv)
{
hcl_logbfmt (hcl, HCL_LOG_STDERR, "ERROR: cannot execute - [%d] %js\n", hcl_geterrnum(hcl), hcl_geterrmsg(hcl));
}
else
{
/* print the result in the interactive mode regardless 'verbose' */
hcl_logbfmt (hcl, HCL_LOG_STDOUT, "%O\n", retv);
/*
* print the value of ERRSTR.
hcl_oop_cons_t cons = hcl_getatsysdic(hcl, xtn->sym_errstr);
if (cons)
{
HCL_ASSERT (hcl, HCL_IS_CONS(hcl, cons));
HCL_ASSERT (hcl, HCL_CONS_CAR(cons) == xtn->sym_errstr);
hcl_print (hcl, HCL_CONS_CDR(cons));
}
*/
}
//cancel_tick();
g_hcl = HCL_NULL;
}
}
}
#endif
if (!xtn->reader_istty && hcl_getbclen(hcl) > 0) if (!xtn->reader_istty && hcl_getbclen(hcl) > 0)
{ {

View File

@ -65,7 +65,6 @@ libhcl_la_SOURCES = \
hcl-prv.h \ hcl-prv.h \
bigint.c \ bigint.c \
cnode.c \ cnode.c \
comp.c \
comp2.c \ comp2.c \
debug.c \ debug.c \
decode.c \ decode.c \
@ -84,7 +83,6 @@ libhcl_la_SOURCES = \
prim.c \ prim.c \
print.c \ print.c \
rbt.c \ rbt.c \
read.c \
read2.c \ read2.c \
sym.c \ sym.c \
utf8.c \ utf8.c \

View File

@ -151,14 +151,13 @@ am__DEPENDENCIES_5 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \
$(am__DEPENDENCIES_3) $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_4)
libhcl_la_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__append_6) libhcl_la_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__append_6)
am_libhcl_la_OBJECTS = libhcl_la-bigint.lo libhcl_la-cnode.lo \ am_libhcl_la_OBJECTS = libhcl_la-bigint.lo libhcl_la-cnode.lo \
libhcl_la-comp.lo libhcl_la-comp2.lo libhcl_la-debug.lo \ libhcl_la-comp2.lo libhcl_la-debug.lo libhcl_la-decode.lo \
libhcl_la-decode.lo libhcl_la-dic.lo libhcl_la-err.lo \ libhcl_la-dic.lo libhcl_la-err.lo libhcl_la-exec.lo \
libhcl_la-exec.lo libhcl_la-fmt.lo libhcl_la-gc.lo \ libhcl_la-fmt.lo libhcl_la-gc.lo libhcl_la-hcl.lo \
libhcl_la-hcl.lo libhcl_la-heap.lo libhcl_la-number.lo \ libhcl_la-heap.lo libhcl_la-number.lo libhcl_la-obj.lo \
libhcl_la-obj.lo libhcl_la-opt.lo libhcl_la-prim.lo \ libhcl_la-opt.lo libhcl_la-prim.lo libhcl_la-print.lo \
libhcl_la-print.lo libhcl_la-rbt.lo libhcl_la-read.lo \ libhcl_la-rbt.lo libhcl_la-read2.lo libhcl_la-sym.lo \
libhcl_la-read2.lo libhcl_la-sym.lo libhcl_la-utf8.lo \ libhcl_la-utf8.lo libhcl_la-utl.lo libhcl_la-xma.lo
libhcl_la-utl.lo libhcl_la-xma.lo
libhcl_la_OBJECTS = $(am_libhcl_la_OBJECTS) libhcl_la_OBJECTS = $(am_libhcl_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@) AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@ -197,7 +196,7 @@ DEFAULT_INCLUDES =
depcomp = $(SHELL) $(top_srcdir)/ac/depcomp depcomp = $(SHELL) $(top_srcdir)/ac/depcomp
am__maybe_remake_depfiles = depfiles am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/libhcl_la-bigint.Plo \ am__depfiles_remade = ./$(DEPDIR)/libhcl_la-bigint.Plo \
./$(DEPDIR)/libhcl_la-cnode.Plo ./$(DEPDIR)/libhcl_la-comp.Plo \ ./$(DEPDIR)/libhcl_la-cnode.Plo \
./$(DEPDIR)/libhcl_la-comp2.Plo \ ./$(DEPDIR)/libhcl_la-comp2.Plo \
./$(DEPDIR)/libhcl_la-debug.Plo \ ./$(DEPDIR)/libhcl_la-debug.Plo \
./$(DEPDIR)/libhcl_la-decode.Plo ./$(DEPDIR)/libhcl_la-dic.Plo \ ./$(DEPDIR)/libhcl_la-decode.Plo ./$(DEPDIR)/libhcl_la-dic.Plo \
@ -207,9 +206,9 @@ am__depfiles_remade = ./$(DEPDIR)/libhcl_la-bigint.Plo \
./$(DEPDIR)/libhcl_la-number.Plo ./$(DEPDIR)/libhcl_la-obj.Plo \ ./$(DEPDIR)/libhcl_la-number.Plo ./$(DEPDIR)/libhcl_la-obj.Plo \
./$(DEPDIR)/libhcl_la-opt.Plo ./$(DEPDIR)/libhcl_la-prim.Plo \ ./$(DEPDIR)/libhcl_la-opt.Plo ./$(DEPDIR)/libhcl_la-prim.Plo \
./$(DEPDIR)/libhcl_la-print.Plo ./$(DEPDIR)/libhcl_la-rbt.Plo \ ./$(DEPDIR)/libhcl_la-print.Plo ./$(DEPDIR)/libhcl_la-rbt.Plo \
./$(DEPDIR)/libhcl_la-read.Plo ./$(DEPDIR)/libhcl_la-read2.Plo \ ./$(DEPDIR)/libhcl_la-read2.Plo ./$(DEPDIR)/libhcl_la-sym.Plo \
./$(DEPDIR)/libhcl_la-sym.Plo ./$(DEPDIR)/libhcl_la-utf8.Plo \ ./$(DEPDIR)/libhcl_la-utf8.Plo ./$(DEPDIR)/libhcl_la-utl.Plo \
./$(DEPDIR)/libhcl_la-utl.Plo ./$(DEPDIR)/libhcl_la-xma.Plo \ ./$(DEPDIR)/libhcl_la-xma.Plo \
./$(DEPDIR)/libhclx_la-cb-impl.Plo \ ./$(DEPDIR)/libhclx_la-cb-impl.Plo \
./$(DEPDIR)/libhclx_la-hcl-c.Plo \ ./$(DEPDIR)/libhclx_la-hcl-c.Plo \
./$(DEPDIR)/libhclx_la-hcl-s.Plo \ ./$(DEPDIR)/libhclx_la-hcl-s.Plo \
@ -394,7 +393,6 @@ pdfdir = @pdfdir@
prefix = @prefix@ prefix = @prefix@
program_transform_name = @program_transform_name@ program_transform_name = @program_transform_name@
psdir = @psdir@ psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@ sharedstatedir = @sharedstatedir@
srcdir = @srcdir@ srcdir = @srcdir@
@ -440,7 +438,6 @@ libhcl_la_SOURCES = \
hcl-prv.h \ hcl-prv.h \
bigint.c \ bigint.c \
cnode.c \ cnode.c \
comp.c \
comp2.c \ comp2.c \
debug.c \ debug.c \
decode.c \ decode.c \
@ -459,7 +456,6 @@ libhcl_la_SOURCES = \
prim.c \ prim.c \
print.c \ print.c \
rbt.c \ rbt.c \
read.c \
read2.c \ read2.c \
sym.c \ sym.c \
utf8.c \ utf8.c \
@ -579,7 +575,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-bigint.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-bigint.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-cnode.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-cnode.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-comp.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-comp2.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-comp2.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-debug.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-debug.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-decode.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-decode.Plo@am__quote@ # am--include-marker
@ -596,7 +591,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-prim.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-prim.Plo@am__quote@ # am--include-marker
@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-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-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-read2.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-read2.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-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-utf8.Plo@am__quote@ # am--include-marker
@ -653,13 +647,6 @@ libhcl_la-cnode.lo: cnode.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @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-cnode.lo `test -f 'cnode.c' || echo '$(srcdir)/'`cnode.c @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-cnode.lo `test -f 'cnode.c' || echo '$(srcdir)/'`cnode.c
libhcl_la-comp.lo: comp.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-comp.lo -MD -MP -MF $(DEPDIR)/libhcl_la-comp.Tpo -c -o libhcl_la-comp.lo `test -f 'comp.c' || echo '$(srcdir)/'`comp.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhcl_la-comp.Tpo $(DEPDIR)/libhcl_la-comp.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='comp.c' object='libhcl_la-comp.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-comp.lo `test -f 'comp.c' || echo '$(srcdir)/'`comp.c
libhcl_la-comp2.lo: comp2.c libhcl_la-comp2.lo: comp2.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-comp2.lo -MD -MP -MF $(DEPDIR)/libhcl_la-comp2.Tpo -c -o libhcl_la-comp2.lo `test -f 'comp2.c' || echo '$(srcdir)/'`comp2.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-comp2.lo -MD -MP -MF $(DEPDIR)/libhcl_la-comp2.Tpo -c -o libhcl_la-comp2.lo `test -f 'comp2.c' || echo '$(srcdir)/'`comp2.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhcl_la-comp2.Tpo $(DEPDIR)/libhcl_la-comp2.Plo @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhcl_la-comp2.Tpo $(DEPDIR)/libhcl_la-comp2.Plo
@ -772,13 +759,6 @@ libhcl_la-rbt.lo: rbt.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @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-rbt.lo `test -f 'rbt.c' || echo '$(srcdir)/'`rbt.c @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-rbt.lo `test -f 'rbt.c' || echo '$(srcdir)/'`rbt.c
libhcl_la-read.lo: read.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-read.lo -MD -MP -MF $(DEPDIR)/libhcl_la-read.Tpo -c -o libhcl_la-read.lo `test -f 'read.c' || echo '$(srcdir)/'`read.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhcl_la-read.Tpo $(DEPDIR)/libhcl_la-read.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='read.c' object='libhcl_la-read.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-read.lo `test -f 'read.c' || echo '$(srcdir)/'`read.c
libhcl_la-read2.lo: read2.c libhcl_la-read2.lo: read2.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-read2.lo -MD -MP -MF $(DEPDIR)/libhcl_la-read2.Tpo -c -o libhcl_la-read2.lo `test -f 'read2.c' || echo '$(srcdir)/'`read2.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-read2.lo -MD -MP -MF $(DEPDIR)/libhcl_la-read2.Tpo -c -o libhcl_la-read2.lo `test -f 'read2.c' || echo '$(srcdir)/'`read2.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhcl_la-read2.Tpo $(DEPDIR)/libhcl_la-read2.Plo @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhcl_la-read2.Tpo $(DEPDIR)/libhcl_la-read2.Plo
@ -1013,7 +993,6 @@ clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \
distclean: distclean-am distclean: distclean-am
-rm -f ./$(DEPDIR)/libhcl_la-bigint.Plo -rm -f ./$(DEPDIR)/libhcl_la-bigint.Plo
-rm -f ./$(DEPDIR)/libhcl_la-cnode.Plo -rm -f ./$(DEPDIR)/libhcl_la-cnode.Plo
-rm -f ./$(DEPDIR)/libhcl_la-comp.Plo
-rm -f ./$(DEPDIR)/libhcl_la-comp2.Plo -rm -f ./$(DEPDIR)/libhcl_la-comp2.Plo
-rm -f ./$(DEPDIR)/libhcl_la-debug.Plo -rm -f ./$(DEPDIR)/libhcl_la-debug.Plo
-rm -f ./$(DEPDIR)/libhcl_la-decode.Plo -rm -f ./$(DEPDIR)/libhcl_la-decode.Plo
@ -1030,7 +1009,6 @@ distclean: distclean-am
-rm -f ./$(DEPDIR)/libhcl_la-prim.Plo -rm -f ./$(DEPDIR)/libhcl_la-prim.Plo
-rm -f ./$(DEPDIR)/libhcl_la-print.Plo -rm -f ./$(DEPDIR)/libhcl_la-print.Plo
-rm -f ./$(DEPDIR)/libhcl_la-rbt.Plo -rm -f ./$(DEPDIR)/libhcl_la-rbt.Plo
-rm -f ./$(DEPDIR)/libhcl_la-read.Plo
-rm -f ./$(DEPDIR)/libhcl_la-read2.Plo -rm -f ./$(DEPDIR)/libhcl_la-read2.Plo
-rm -f ./$(DEPDIR)/libhcl_la-sym.Plo -rm -f ./$(DEPDIR)/libhcl_la-sym.Plo
-rm -f ./$(DEPDIR)/libhcl_la-utf8.Plo -rm -f ./$(DEPDIR)/libhcl_la-utf8.Plo
@ -1090,7 +1068,6 @@ installcheck-am:
maintainer-clean: maintainer-clean-am maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/libhcl_la-bigint.Plo -rm -f ./$(DEPDIR)/libhcl_la-bigint.Plo
-rm -f ./$(DEPDIR)/libhcl_la-cnode.Plo -rm -f ./$(DEPDIR)/libhcl_la-cnode.Plo
-rm -f ./$(DEPDIR)/libhcl_la-comp.Plo
-rm -f ./$(DEPDIR)/libhcl_la-comp2.Plo -rm -f ./$(DEPDIR)/libhcl_la-comp2.Plo
-rm -f ./$(DEPDIR)/libhcl_la-debug.Plo -rm -f ./$(DEPDIR)/libhcl_la-debug.Plo
-rm -f ./$(DEPDIR)/libhcl_la-decode.Plo -rm -f ./$(DEPDIR)/libhcl_la-decode.Plo
@ -1107,7 +1084,6 @@ maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/libhcl_la-prim.Plo -rm -f ./$(DEPDIR)/libhcl_la-prim.Plo
-rm -f ./$(DEPDIR)/libhcl_la-print.Plo -rm -f ./$(DEPDIR)/libhcl_la-print.Plo
-rm -f ./$(DEPDIR)/libhcl_la-rbt.Plo -rm -f ./$(DEPDIR)/libhcl_la-rbt.Plo
-rm -f ./$(DEPDIR)/libhcl_la-read.Plo
-rm -f ./$(DEPDIR)/libhcl_la-read2.Plo -rm -f ./$(DEPDIR)/libhcl_la-read2.Plo
-rm -f ./$(DEPDIR)/libhcl_la-sym.Plo -rm -f ./$(DEPDIR)/libhcl_la-sym.Plo
-rm -f ./$(DEPDIR)/libhcl_la-utf8.Plo -rm -f ./$(DEPDIR)/libhcl_la-utf8.Plo

3000
lib/comp.c

File diff suppressed because it is too large Load Diff

View File

@ -994,7 +994,6 @@ static int compile_continue (hcl_t* hcl, hcl_cnode_t* src)
if (jump_offset > 3) jump_offset += HCL_HCL_CODE_LONG_PARAM_SIZE; if (jump_offset > 3) jump_offset += HCL_HCL_CODE_LONG_PARAM_SIZE;
if (emit_single_param_instruction(hcl, HCL_CODE_JUMP_BACKWARD_0, jump_offset, HCL_CNODE_GET_LOC(cmd)) <= -1) return -1; if (emit_single_param_instruction(hcl, HCL_CODE_JUMP_BACKWARD_0, jump_offset, HCL_CNODE_GET_LOC(cmd)) <= -1) return -1;
POP_CFRAME (hcl); POP_CFRAME (hcl);
return 0; return 0;
} }

View File

@ -1437,8 +1437,9 @@ int hcl_server_proto_handle_request (hcl_server_proto_t* proto)
case HCL_SERVER_PROTO_TOKEN_SCRIPT: case HCL_SERVER_PROTO_TOKEN_SCRIPT:
{ {
hcl_oop_t obj; hcl_cnode_t* obj;
hcl_ooci_t c; hcl_ooci_t c;
int n;
hcl_setinloc (proto->hcl, 1, 1); hcl_setinloc (proto->hcl, 1, 1);
@ -1456,22 +1457,29 @@ int hcl_server_proto_handle_request (hcl_server_proto_t* proto)
if (proto->req.state == HCL_SERVER_PROTO_REQ_IN_TOP_LEVEL) hcl_reset(proto->hcl); if (proto->req.state == HCL_SERVER_PROTO_REQ_IN_TOP_LEVEL) hcl_reset(proto->hcl);
proto->worker->opstate = HCL_SERVER_WORKER_OPSTATE_READ; proto->worker->opstate = HCL_SERVER_WORKER_OPSTATE_READ;
obj = hcl_read(proto->hcl); obj = hcl_read2(proto->hcl);
if (!obj) if (!obj)
{ {
if (hcl_geterrnum(proto->hcl) == HCL_ESYNERR) reformat_synerr (proto->hcl); if (hcl_geterrnum(proto->hcl) == HCL_ESYNERR) reformat_synerr (proto->hcl);
goto fail_with_errmsg; goto fail_with_errmsg;
} }
if (get_token(proto) <= -1) goto fail_with_errmsg; if (get_token(proto) <= -1)
{
hcl_freecnode (proto->hcl, obj);
goto fail_with_errmsg;
}
if (proto->tok.type != HCL_SERVER_PROTO_TOKEN_NL) if (proto->tok.type != HCL_SERVER_PROTO_TOKEN_NL)
{ {
hcl_seterrbfmt (proto->hcl, HCL_EINVAL, "No new line after .SCRIPT contents"); hcl_seterrbfmt (proto->hcl, HCL_EINVAL, "No new line after .SCRIPT contents");
hcl_freecnode (proto->hcl, obj);
goto fail_with_errmsg; goto fail_with_errmsg;
} }
proto->worker->opstate = HCL_SERVER_WORKER_OPSTATE_COMPILE; proto->worker->opstate = HCL_SERVER_WORKER_OPSTATE_COMPILE;
if (hcl_compile(proto->hcl, obj) <= -1) n = hcl_compile2(proto->hcl, obj);
hcl_freecnode (proto->hcl, obj);
if (n <= -1)
{ {
if (hcl_geterrnum(proto->hcl) == HCL_ESYNERR) reformat_synerr (proto->hcl); if (hcl_geterrnum(proto->hcl) == HCL_ESYNERR) reformat_synerr (proto->hcl);
goto fail_with_errmsg; goto fail_with_errmsg;

View File

@ -1992,10 +1992,6 @@ HCL_EXPORT void hcl_flushio (
hcl_t* hcl hcl_t* hcl
); );
HCL_EXPORT hcl_oop_t hcl_read (
hcl_t* hcl
);
HCL_EXPORT hcl_cnode_t* hcl_read2 ( HCL_EXPORT hcl_cnode_t* hcl_read2 (
hcl_t* hcl hcl_t* hcl
); );
@ -2020,9 +2016,9 @@ HCL_EXPORT hcl_ooi_t hcl_proutufmt (
... ...
); );
HCL_EXPORT int hcl_compile ( HCL_EXPORT int hcl_compile2 (
hcl_t* hcl, hcl_t* hcl,
hcl_oop_t obj hcl_cnode_t* obj
); );
/** /**

2456
lib/read.c

File diff suppressed because it is too large Load Diff

View File

@ -2075,8 +2075,6 @@ hcl_cnodetoobj (hcl_t* hcl, hcl_cnode_t* x)
} }
*/ */
#if 0
/* ========================================================================= */
/* TODO: rename compiler to something else that can include reader, printer, and compiler /* TODO: rename compiler to something else that can include reader, printer, and compiler
* move compiler intialization/finalization here to more common place */ * move compiler intialization/finalization here to more common place */
@ -2134,6 +2132,14 @@ static void fini_compiler (hcl_t* hcl)
hcl->c->cfs.capa = 0; hcl->c->cfs.capa = 0;
} }
if (hcl->c->cfs2.ptr)
{
hcl_freemem (hcl, hcl->c->cfs2.ptr);
hcl->c->cfs2.ptr = HCL_NULL;
hcl->c->cfs2.top = -1;
hcl->c->cfs2.capa = 0;
}
if (hcl->c->tv.ptr) if (hcl->c->tv.ptr)
{ {
hcl_freemem (hcl, hcl->c->tv.ptr); hcl_freemem (hcl, hcl->c->tv.ptr);
@ -2142,14 +2148,16 @@ static void fini_compiler (hcl_t* hcl)
hcl->c->tv.capa = 0; hcl->c->tv.capa = 0;
} }
if (hcl->c->tv2.ptr) if (hcl->c->tv2.s.ptr)
{ {
hcl_freemem (hcl, hcl->c->tv2.ptr); hcl_freemem (hcl, hcl->c->tv2.s.ptr);
hcl->c->tv2.ptr = HCL_NULL; hcl->c->tv2.s.ptr = HCL_NULL;
hcl->c->tv2.len = 0; hcl->c->tv2.s.len = 0;
hcl->c->tv2.capa = 0; hcl->c->tv2.capa = 0;
hcl->c->tv2.wcount = 0; hcl->c->tv2.wcount = 0;
} }
HCL_ASSERT (hcl, hcl->c->tv2.capa == 0);
HCL_ASSERT (hcl, hcl->c->tv2.wcount == 0);
if (hcl->c->blk.info) if (hcl->c->blk.info)
{ {
@ -2204,6 +2212,7 @@ int hcl_attachio (hcl_t* hcl, hcl_ioimpl_t reader, hcl_ioimpl_t printer)
hcl->c->r.e = hcl->_nil; hcl->c->r.e = hcl->_nil;
hcl->c->cfs.top = -1; hcl->c->cfs.top = -1;
hcl->c->cfs2.top = -1;
hcl->c->blk.depth = -1; hcl->c->blk.depth = -1;
} }
else if (hcl->c->reader || hcl->c->printer) else if (hcl->c->reader || hcl->c->printer)
@ -2321,4 +2330,3 @@ int hcl_unreadchar (hcl_t* hcl, const hcl_iolxc_t* c)
unget_char (hcl, c); unget_char (hcl, c);
return 0; return 0;
} }
#endif