added more code for scm
This commit is contained in:
parent
f24fe05409
commit
758037fac0
@ -126,6 +126,7 @@ DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
|
@ -111,6 +111,7 @@ DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
|
@ -98,6 +98,7 @@ DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
|
@ -97,6 +97,7 @@ DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
|
@ -98,6 +98,7 @@ DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
|
@ -148,6 +148,7 @@ int scm_main (int argc, qse_char_t* argv[])
|
||||
qse_scm_t* scm;
|
||||
qse_scm_obj_t* obj;
|
||||
|
||||
QSE_ASSERT (0 == 1);
|
||||
if (handle_args (argc, argv) == -1) return -1;
|
||||
|
||||
scm = qse_scm_open (QSE_NULL, 0, opt_memsize, opt_meminc);
|
||||
|
@ -97,6 +97,7 @@ DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
|
133
qse/configure
vendored
133
qse/configure
vendored
@ -792,6 +792,7 @@ build_vendor
|
||||
build_cpu
|
||||
build
|
||||
LIBTOOL
|
||||
ECHO
|
||||
TRUE
|
||||
RMDIR
|
||||
RM
|
||||
@ -5046,6 +5047,98 @@ else
|
||||
TRUE="$ac_cv_prog_TRUE"
|
||||
fi
|
||||
|
||||
if test -n "$ac_tool_prefix"; then
|
||||
# Extract the first word of "${ac_tool_prefix}echo", so it can be a program name with args.
|
||||
set dummy ${ac_tool_prefix}echo; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
$as_echo_n "checking for $ac_word... " >&6; }
|
||||
if test "${ac_cv_prog_ECHO+set}" = set; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if test -n "$ECHO"; then
|
||||
ac_cv_prog_ECHO="$ECHO" # Let the user override the test.
|
||||
else
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
ac_cv_prog_ECHO="${ac_tool_prefix}echo"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
fi
|
||||
fi
|
||||
ECHO=$ac_cv_prog_ECHO
|
||||
if test -n "$ECHO"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ECHO" >&5
|
||||
$as_echo "$ECHO" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
if test -z "$ac_cv_prog_ECHO"; then
|
||||
ac_ct_ECHO=$ECHO
|
||||
# Extract the first word of "echo", so it can be a program name with args.
|
||||
set dummy echo; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
$as_echo_n "checking for $ac_word... " >&6; }
|
||||
if test "${ac_cv_prog_ac_ct_ECHO+set}" = set; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if test -n "$ac_ct_ECHO"; then
|
||||
ac_cv_prog_ac_ct_ECHO="$ac_ct_ECHO" # Let the user override the test.
|
||||
else
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
ac_cv_prog_ac_ct_ECHO="echo"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
fi
|
||||
fi
|
||||
ac_ct_ECHO=$ac_cv_prog_ac_ct_ECHO
|
||||
if test -n "$ac_ct_ECHO"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_ECHO" >&5
|
||||
$as_echo "$ac_ct_ECHO" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
if test "x$ac_ct_ECHO" = x; then
|
||||
ECHO=""
|
||||
else
|
||||
case $cross_compiling:$ac_tool_warned in
|
||||
yes:)
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
|
||||
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
|
||||
ac_tool_warned=yes ;;
|
||||
esac
|
||||
ECHO=$ac_ct_ECHO
|
||||
fi
|
||||
else
|
||||
ECHO="$ac_cv_prog_ECHO"
|
||||
fi
|
||||
|
||||
|
||||
RM="$RM -f"
|
||||
|
||||
@ -5599,13 +5692,13 @@ if test "${lt_cv_nm_interface+set}" = set; then :
|
||||
else
|
||||
lt_cv_nm_interface="BSD nm"
|
||||
echo "int some_variable = 0;" > conftest.$ac_ext
|
||||
(eval echo "\"\$as_me:5602: $ac_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:5695: $ac_compile\"" >&5)
|
||||
(eval "$ac_compile" 2>conftest.err)
|
||||
cat conftest.err >&5
|
||||
(eval echo "\"\$as_me:5605: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
|
||||
(eval echo "\"\$as_me:5698: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
|
||||
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
|
||||
cat conftest.err >&5
|
||||
(eval echo "\"\$as_me:5608: output\"" >&5)
|
||||
(eval echo "\"\$as_me:5701: output\"" >&5)
|
||||
cat conftest.out >&5
|
||||
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
|
||||
lt_cv_nm_interface="MS dumpbin"
|
||||
@ -6800,7 +6893,7 @@ ia64-*-hpux*)
|
||||
;;
|
||||
*-*-irix6*)
|
||||
# Find out which ABI we are using.
|
||||
echo '#line 6803 "configure"' > conftest.$ac_ext
|
||||
echo '#line 6896 "configure"' > conftest.$ac_ext
|
||||
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
|
||||
(eval $ac_compile) 2>&5
|
||||
ac_status=$?
|
||||
@ -8856,11 +8949,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:8859: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:8952: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:8863: \$? = $ac_status" >&5
|
||||
echo "$as_me:8956: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings other than the usual output.
|
||||
@ -9195,11 +9288,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:9198: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:9291: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:9202: \$? = $ac_status" >&5
|
||||
echo "$as_me:9295: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings other than the usual output.
|
||||
@ -9300,11 +9393,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:9303: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:9396: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
echo "$as_me:9307: \$? = $ac_status" >&5
|
||||
echo "$as_me:9400: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
@ -9355,11 +9448,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:9358: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:9451: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
echo "$as_me:9362: \$? = $ac_status" >&5
|
||||
echo "$as_me:9455: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
@ -11739,7 +11832,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 11742 "configure"
|
||||
#line 11835 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -11835,7 +11928,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 11838 "configure"
|
||||
#line 11931 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -13791,11 +13884,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:13794: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:13887: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:13798: \$? = $ac_status" >&5
|
||||
echo "$as_me:13891: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings other than the usual output.
|
||||
@ -13890,11 +13983,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:13893: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:13986: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
echo "$as_me:13897: \$? = $ac_status" >&5
|
||||
echo "$as_me:13990: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
@ -13942,11 +14035,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:13945: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:14038: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
echo "$as_me:13949: \$? = $ac_status" >&5
|
||||
echo "$as_me:14042: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
|
@ -30,6 +30,7 @@ dnl check other tools
|
||||
AC_CHECK_TOOL(RM, rm)
|
||||
AC_CHECK_TOOL(RMDIR, rmdir)
|
||||
AC_CHECK_TOOL(TRUE, true)
|
||||
AC_CHECK_TOOL(ECHO, echo)
|
||||
|
||||
dnl avoid "'/bin/rm: cannot remove `libtoolT': No such file or directory"
|
||||
RM="$RM -f"
|
||||
|
@ -115,6 +115,7 @@ DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
|
@ -74,6 +74,7 @@ DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
|
@ -112,6 +112,7 @@ DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
|
@ -140,6 +140,7 @@ DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
|
@ -101,6 +101,7 @@ DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
|
@ -104,6 +104,7 @@ DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
|
@ -101,6 +101,7 @@ DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
|
@ -99,6 +99,7 @@ DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
|
@ -87,8 +87,23 @@ struct qse_http_req_t
|
||||
qse_http_octb_t con;
|
||||
};
|
||||
|
||||
#if 0
|
||||
struct qse_http_rep_node_t
|
||||
{
|
||||
int type; /* TEXT, RESOURCE */
|
||||
qse_http_req_node_t* next;
|
||||
};
|
||||
|
||||
typedef struct qse_http_rep_t qse_http_rep_t;
|
||||
|
||||
struct qse_http_rep_t
|
||||
{
|
||||
};
|
||||
#endif
|
||||
|
||||
typedef struct qse_http_reqcbs_t qse_http_reqcbs_t;
|
||||
|
||||
|
||||
struct qse_http_reqcbs_t
|
||||
{
|
||||
int (*request) (qse_http_t* http, qse_http_req_t* req);
|
||||
@ -122,8 +137,9 @@ struct qse_http_t
|
||||
/* buffers needed to for processing a request */
|
||||
struct
|
||||
{
|
||||
qse_http_octb_t raw;
|
||||
qse_http_octb_t tra;
|
||||
qse_http_octb_t raw; /* buffer to hold raw octets */
|
||||
qse_http_octb_t tra; /* buffer for handling trailers */
|
||||
qse_http_octb_t pen; /* buffer for raw octets during pending period */
|
||||
} b;
|
||||
|
||||
/* points to the head of the combined header list */
|
||||
|
@ -99,6 +99,7 @@ DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
|
@ -101,6 +101,7 @@ DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
|
@ -111,6 +111,7 @@ DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
|
@ -138,6 +138,7 @@ DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
|
@ -140,6 +140,7 @@ DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
|
@ -90,6 +90,20 @@ void qse_assert_failed (
|
||||
|
||||
qse_sio_puts (QSE_SIO_ERR, QSE_T("=[ASSERTION FAILURE]============================================================\n"));
|
||||
|
||||
#if 1
|
||||
qse_sio_puts (QSE_SIO_ERR, QSE_T(" __ \n"));
|
||||
qse_sio_puts (QSE_SIO_ERR, QSE_T(" _____ _____ _____ _____| |\n"));
|
||||
qse_sio_puts (QSE_SIO_ERR, QSE_T("| | | _ | __| |\n"));
|
||||
qse_sio_puts (QSE_SIO_ERR, QSE_T("| | | | | __|__ |__|\n"));
|
||||
qse_sio_puts (QSE_SIO_ERR, QSE_T("|_____|_____|__| |_____|__|\n"));
|
||||
#else
|
||||
qse_sio_puts (QSE_SIO_ERR, QSE_T(" __ \n"));
|
||||
qse_sio_puts (QSE_SIO_ERR, QSE_T(" _____ _____ _____ _____ | |\n"));
|
||||
qse_sio_puts (QSE_SIO_ERR, QSE_T("| | | _ | __| | |\n"));
|
||||
qse_sio_puts (QSE_SIO_ERR, QSE_T("| | | | | __|__ | |__|\n"));
|
||||
qse_sio_puts (QSE_SIO_ERR, QSE_T("|_____|_____|__| |_____| |__|\n"));
|
||||
#endif
|
||||
|
||||
qse_sio_puts (QSE_SIO_ERR, QSE_T("FILE "));
|
||||
qse_sio_puts (QSE_SIO_ERR, file);
|
||||
qse_sio_puts (QSE_SIO_ERR, QSE_T(" LINE "));
|
||||
|
@ -136,6 +136,7 @@ DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
|
@ -117,6 +117,7 @@ DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
|
@ -18,7 +18,7 @@
|
||||
License along with QSE. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <qse/utl/http.h>
|
||||
#include <qse/http/http.h>
|
||||
#include <qse/cmn/chr.h>
|
||||
#include "../cmn/mem.h"
|
||||
|
||||
@ -229,11 +229,13 @@ qse_http_t* qse_http_init (qse_http_t* http, qse_mmgr_t* mmgr)
|
||||
|
||||
init_buffer (http, &http->reqx.b.raw);
|
||||
init_buffer (http, &http->reqx.b.tra);
|
||||
init_buffer (http, &http->reqx.b.pen);
|
||||
init_buffer (http, &http->req.con);
|
||||
|
||||
if (qse_htb_init (&http->req.hdrtab, mmgr, 60, 70, 1, 1) == QSE_NULL)
|
||||
{
|
||||
fini_buffer (http, &http->req.con);
|
||||
fini_buffer (http, &http->reqx.b.pen);
|
||||
fini_buffer (http, &http->reqx.b.tra);
|
||||
fini_buffer (http, &http->reqx.b.raw);
|
||||
return QSE_NULL;
|
||||
@ -247,6 +249,7 @@ void qse_http_fini (qse_http_t* http)
|
||||
qse_htb_fini (&http->req.hdrtab);
|
||||
clear_combined_headers (http);
|
||||
fini_buffer (http, &http->req.con);
|
||||
fini_buffer (http, &http->reqx.b.pen);
|
||||
fini_buffer (http, &http->reqx.b.tra);
|
||||
fini_buffer (http, &http->reqx.b.raw);
|
||||
}
|
||||
@ -993,8 +996,21 @@ int qse_http_feed (qse_http_t* http, const qse_byte_t* req, qse_size_t len)
|
||||
const qse_byte_t* end = req + len;
|
||||
const qse_byte_t* ptr = req;
|
||||
|
||||
#if 0
|
||||
if (http->reqx.pending)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
/* does this goto drop code maintainability? */
|
||||
if (http->reqx.s.need > 0) goto content_resume;
|
||||
if (http->reqx.s.need > 0)
|
||||
{
|
||||
/* we're in need of as many octets as http->reqx.s.need
|
||||
* for contents body. make a proper jump to resume
|
||||
* content handling */
|
||||
goto content_resume;
|
||||
}
|
||||
|
||||
switch (http->reqx.s.chunk.phase)
|
||||
{
|
||||
case GET_CHUNK_LEN:
|
||||
@ -1099,14 +1115,16 @@ int qse_http_feed (qse_http_t* http, const qse_byte_t* req, qse_size_t len)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* we need to read as many octets as Content-Length */
|
||||
/* we need to read as many octets as
|
||||
* Content-Length */
|
||||
http->reqx.s.need = http->req.attr.content_length;
|
||||
}
|
||||
|
||||
if (http->reqx.s.need > 0)
|
||||
{
|
||||
/* content-length or chunked data length specified */
|
||||
|
||||
/* content-length or chunked data length
|
||||
* specified */
|
||||
|
||||
qse_size_t avail;
|
||||
|
||||
content_resume:
|
||||
@ -1230,3 +1248,19 @@ feedme_more:
|
||||
return 0;
|
||||
}
|
||||
|
||||
int qse_http_addtext (qse_http_t* http, const qse_byte_t* ptr, qse_size_t len)
|
||||
{
|
||||
}
|
||||
|
||||
int qse_http_addresource (qse_http_t* http, const void* ptr, qse_size_t len)
|
||||
{
|
||||
}
|
||||
|
||||
int qse_http_addheader (
|
||||
qse_http_t* http, const qse_byte_t* key, const qse_byte_t* val)
|
||||
{
|
||||
}
|
||||
|
||||
int qse_http_emit (qse_http_t* http)
|
||||
{
|
||||
}
|
||||
|
@ -117,6 +117,7 @@ DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
|
@ -22,6 +22,8 @@
|
||||
|
||||
QSE_IMPLEMENT_COMMON_FUNCTIONS (scm)
|
||||
|
||||
#define IS_NIL(x) ((x) != scm->nil)
|
||||
|
||||
static qse_scm_t* qse_scm_init (
|
||||
qse_scm_t* scm,
|
||||
qse_mmgr_t* mmgr,
|
||||
@ -29,9 +31,15 @@ static qse_scm_t* qse_scm_init (
|
||||
qse_size_t mem_ubound_inc
|
||||
);
|
||||
|
||||
static void qse_scm_fini (qse_scm_t* scm);
|
||||
static qse_scm_val_t* mkcons (
|
||||
qse_scm_t* scm, qse_scm_val_t* car, qse_scm_val_t* cdr);
|
||||
static void qse_scm_fini (
|
||||
qse_scm_t* scm
|
||||
);
|
||||
|
||||
static qse_scm_ent_t* make_pair_entity (
|
||||
qse_scm_t* scm,
|
||||
qse_scm_ent_t* car,
|
||||
qse_scm_ent_t* cdr
|
||||
);
|
||||
|
||||
qse_scm_t* qse_scm_open (
|
||||
qse_mmgr_t* mmgr, qse_size_t xtnsize,
|
||||
@ -71,11 +79,11 @@ void qse_scm_close (qse_scm_t* scm)
|
||||
|
||||
static QSE_INLINE void delete_all_value_blocks (qse_scm_t* scm)
|
||||
{
|
||||
while (scm->mem.vbl)
|
||||
while (scm->mem.ebl)
|
||||
{
|
||||
qse_scm_vbl_t* vbl = scm->mem.vbl;
|
||||
scm->mem.vbl = scm->mem.vbl->next;
|
||||
QSE_MMGR_FREE (scm->mmgr, vbl);
|
||||
qse_scm_enb_t* enb = scm->mem.ebl;
|
||||
scm->mem.ebl = scm->mem.ebl->next;
|
||||
QSE_MMGR_FREE (scm->mmgr, enb);
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,17 +91,17 @@ static qse_scm_t* qse_scm_init (
|
||||
qse_scm_t* scm, qse_mmgr_t* mmgr,
|
||||
qse_size_t mem_ubound, qse_size_t mem_ubound_inc)
|
||||
{
|
||||
#if 0
|
||||
static qse_scm_val_t static_values[3] =
|
||||
static qse_scm_ent_t static_values[3] =
|
||||
{
|
||||
/* dswcount, mark, atom, type */
|
||||
|
||||
/* nil */
|
||||
{ (QSE_SCM_VAL_ATOM | QSE_SCM_VAL_MARK) },
|
||||
{ 0, 1, 1, QSE_SCM_ENT_NIL },
|
||||
/* f */
|
||||
{ (QSE_SCM_VAL_ATOM | QSE_SCM_VAL_MARK) },
|
||||
{ 0, 1, 1, QSE_SCM_ENT_T },
|
||||
/* t */
|
||||
{ (QSE_SCM_VAL_ATOM | QSE_SCM_VAL_MARK) }
|
||||
{ 0, 1, 1, QSE_SCM_ENT_F }
|
||||
};
|
||||
#endif
|
||||
|
||||
if (mmgr == QSE_NULL) mmgr = QSE_MMGR_GETDFL();
|
||||
|
||||
@ -119,17 +127,15 @@ static qse_scm_t* qse_scm_init (
|
||||
return QSE_NULL;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* initialize common values */
|
||||
scm->nil = &static_values[0];
|
||||
scm->f = &static_values[1];
|
||||
scm->t = &static_values[2];
|
||||
#endif
|
||||
scm->f = &static_values[1];
|
||||
scm->t = &static_values[2];
|
||||
|
||||
scm->mem.vbl = QSE_NULL;
|
||||
scm->mem.ebl = QSE_NULL;
|
||||
scm->mem.free = scm->nil;
|
||||
|
||||
scm->genv = mkcons (scm, scm->nil, scm->nil);
|
||||
scm->genv = make_pair_entity (scm, scm->nil, scm->nil);
|
||||
if (scm->genv == QSE_NULL)
|
||||
{
|
||||
delete_all_value_blocks (scm);
|
||||
@ -138,6 +144,8 @@ static qse_scm_t* qse_scm_init (
|
||||
return QSE_NULL;
|
||||
}
|
||||
|
||||
scm->symtab = scm->nil;
|
||||
|
||||
scm->reg.dmp = scm->nil;
|
||||
scm->reg.env = scm->genv;
|
||||
|
||||
@ -186,7 +194,7 @@ int qse_scm_attachio (qse_scm_t* scm, qse_scm_io_t* io)
|
||||
if (io->out (scm, QSE_SCM_IO_OPEN, &scm->io.arg.out, QSE_NULL, 0) <= -1)
|
||||
{
|
||||
if (scm->err.num == QSE_SCM_ENOERR)
|
||||
qse_scm_seterror (scm,QSE_SCM_EIO, QSE_NULL, QSE_NULL);
|
||||
qse_scm_seterror (scm, QSE_SCM_EIO, QSE_NULL, QSE_NULL);
|
||||
io->in (scm, QSE_SCM_IO_CLOSE, &scm->io.arg.in, QSE_NULL, 0);
|
||||
return -1;
|
||||
}
|
||||
@ -199,60 +207,50 @@ int qse_scm_attachio (qse_scm_t* scm, qse_scm_io_t* io)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static qse_scm_vbl_t* newvbl (qse_scm_t* scm, qse_size_t len)
|
||||
static qse_scm_enb_t* new_entity_block (qse_scm_t* scm, qse_size_t len)
|
||||
{
|
||||
/*
|
||||
* create a new value block containing as many slots as len
|
||||
*/
|
||||
|
||||
qse_scm_vbl_t* blk;
|
||||
qse_scm_val_t* v;
|
||||
qse_scm_enb_t* blk;
|
||||
qse_scm_ent_t* v;
|
||||
qse_size_t i;
|
||||
|
||||
blk = (qse_scm_vbl_t*) QSE_MMGR_ALLOC (
|
||||
blk = (qse_scm_enb_t*) QSE_MMGR_ALLOC (
|
||||
scm->mmgr,
|
||||
QSE_SIZEOF(qse_scm_vbl_t) +
|
||||
QSE_SIZEOF(qse_scm_val_t) * len
|
||||
QSE_SIZEOF(qse_scm_enb_t) +
|
||||
QSE_SIZEOF(qse_scm_ent_t) * len
|
||||
);
|
||||
if (blk == QSE_NULL)
|
||||
{
|
||||
scm->err.num = QSE_SCM_ENOMEM;
|
||||
qse_scm_seterror (scm, QSE_SCM_ENOMEM, QSE_NULL, QSE_NULL);
|
||||
return QSE_NULL;
|
||||
}
|
||||
|
||||
/* initialize the block fields */
|
||||
blk->ptr = (qse_scm_val_t*)(blk + 1);
|
||||
blk->ptr = (qse_scm_ent_t*)(blk + 1);
|
||||
blk->len = len;
|
||||
|
||||
/* chain the value block to the block list */
|
||||
blk->next = scm->mem.vbl;
|
||||
scm->mem.vbl = blk;
|
||||
blk->next = scm->mem.ebl;
|
||||
scm->mem.ebl = blk;
|
||||
|
||||
/* chain each slot to the free slot list */
|
||||
/* chain each slot to the free slot list using
|
||||
* the CDR field of an entity */
|
||||
v = &blk->ptr[0];
|
||||
for (i = 0; i < len -1; i++)
|
||||
{
|
||||
qse_scm_val_t* tmp = v++;
|
||||
tmp->u.cons.cdr = v;
|
||||
qse_scm_ent_t* tmp = v++;
|
||||
PAIR_CDR(tmp) = v;
|
||||
}
|
||||
v->u.cons.cdr = scm->mem.free;
|
||||
PAIR_CDR(v) = scm->mem.free;
|
||||
scm->mem.free = &blk->ptr[0];
|
||||
|
||||
return blk;
|
||||
};
|
||||
|
||||
/* TODO: redefine this ... */
|
||||
#define IS_ATOM(v) ((v)->flags & (QSE_SCM_VAL_STRING | QSE_SCM_VAL_NUMBER | QSE_SCM_VAL_PROC)
|
||||
|
||||
#define IS_MARKED(v) ((v)->mark)
|
||||
#define SET_MARK(v) ((v)->mark = 1)
|
||||
#define CLEAR_MARK(v) ((v)->mark = 0)
|
||||
|
||||
#define ZERO_DSW_COUNT(v) ((v)->dsw_count = 0)
|
||||
#define GET_DSW_COUNT(v) ((v)->dsw_count)
|
||||
#define INC_DSW_COUNT(v) ((v)->dsw_count++)
|
||||
|
||||
static void mark (qse_scm_t* scm, qse_scm_val_t* v)
|
||||
static void mark (qse_scm_t* scm, qse_scm_ent_t* v)
|
||||
{
|
||||
/*
|
||||
* mark values non-recursively with Deutsch-Schorr-Waite(DSW) algorithm
|
||||
@ -260,24 +258,23 @@ static void mark (qse_scm_t* scm, qse_scm_val_t* v)
|
||||
* with the help of additional variables.
|
||||
*/
|
||||
|
||||
qse_scm_val_t* parent, * me;
|
||||
qse_scm_ent_t* parent, * me;
|
||||
|
||||
#if 0
|
||||
/* initialization */
|
||||
parent = QSE_NULL;
|
||||
me = v;
|
||||
|
||||
SET_MARK (me);
|
||||
/*if (!IS_ATOM(me))*/ ZERO_DSW_COUNT (me);
|
||||
MARK(me) = 1;
|
||||
/*if (!ATOM(me))*/ DSWCOUNT(me) = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (IS_ATOM(me) || GET_DSW_COUNT(me) >= 2)
|
||||
if (ATOM(me) || DSWCOUNT(me) >= QSE_COUNTOF(me->u.ref.ent))
|
||||
{
|
||||
/*
|
||||
* backtrack to the parent node
|
||||
*/
|
||||
qse_scm_val_t* child;
|
||||
qse_scm_ent_t* child;
|
||||
|
||||
/* nothing more to backtrack? end of marking */
|
||||
if (parent == QSE_NULL) return;
|
||||
@ -289,30 +286,30 @@ static void mark (qse_scm_t* scm, qse_scm_val_t* v)
|
||||
me = parent;
|
||||
|
||||
/* change the parent to the parent of parent */
|
||||
parent = me->u.cona.val[GET_DSW_COUNT(me)];
|
||||
parent = me->u.ref.ent[DSWCOUNT(me)];
|
||||
|
||||
/* restore the cell contents */
|
||||
me->u.cona.val[GET_DSW_COUNT(me)] = child;
|
||||
me->u.ref.ent[DSWCOUNT(me)] = child;
|
||||
|
||||
/* increment the counter to indicate that the
|
||||
* 'count'th field has been processed.
|
||||
INC_DSW_COUNT (me);
|
||||
* 'count'th field has been processed. */
|
||||
DSWCOUNT(me)++;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* move on to an unprocessed child
|
||||
*/
|
||||
qse_scm_val_t* child;
|
||||
qse_scm_ent_t* child;
|
||||
|
||||
child = me->u.cona.val[GET_DSW_COUNT(me)];
|
||||
child = me->u.ref.ent[DSWCOUNT(me)];
|
||||
|
||||
/* process the field */
|
||||
if (child && !ismark(child))
|
||||
if (child && !MARK(child))
|
||||
{
|
||||
/* change the contents of the child chonse
|
||||
* to point to the current parent */
|
||||
me->u.cona.val[GET_DSW_COUNT(me)] = parent;
|
||||
me->u.ref.ent[DSWCOUNT(me)] = parent;
|
||||
|
||||
/* link me to the head of parent list */
|
||||
parent = me;
|
||||
@ -320,23 +317,23 @@ static void mark (qse_scm_t* scm, qse_scm_val_t* v)
|
||||
/* let me point to the child chosen */
|
||||
me = child;
|
||||
|
||||
SET_MARK (me);
|
||||
/*if (!IS_ATOM(me))*/ ZERO_DSW_COUNT (me);
|
||||
MARK(me) = 1;
|
||||
/*if (!ATOM(me))*/ DSWCOUNT(me) = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
INC_DSW_COUNT (me)
|
||||
/* increment the count */
|
||||
DSWCOUNT(me)++;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
static void mark (qse_scm_t* scm, qse_scm_val_t* v)
|
||||
static void mark (qse_scm_t* scm, qse_scm_ent_t* v)
|
||||
{
|
||||
qse_scm_val_t* t, * p, * q;
|
||||
qse_scm_ent_t* t, * p, * q;
|
||||
|
||||
t = QSE_NULL;
|
||||
p = v;
|
||||
@ -389,9 +386,9 @@ E6:
|
||||
}
|
||||
#endif
|
||||
|
||||
static void gc (qse_scm_t* scm, qse_scm_val_t* x, qse_scm_val_t* y)
|
||||
static void gc (qse_scm_t* scm, qse_scm_ent_t* x, qse_scm_ent_t* y)
|
||||
{
|
||||
//mark (scm, scm->oblist);
|
||||
//mark (scm, scm->symtab);
|
||||
mark (scm, scm->genv);
|
||||
|
||||
mark (scm, scm->reg.arg);
|
||||
@ -399,45 +396,276 @@ static void gc (qse_scm_t* scm, qse_scm_val_t* x, qse_scm_val_t* y)
|
||||
mark (scm, scm->reg.cod);
|
||||
mark (scm, scm->reg.dmp);
|
||||
|
||||
/* mark the temporaries */
|
||||
mark (scm, x);
|
||||
mark (scm, y);
|
||||
|
||||
|
||||
/* scan the allocated values */
|
||||
}
|
||||
|
||||
static qse_scm_val_t* mkval (qse_scm_t* scm, qse_scm_val_t* x, qse_scm_val_t* y)
|
||||
/*
|
||||
|
||||
rsr4
|
||||
|
||||
the following identifiers are syntatic keywors and should not be
|
||||
used as variables.
|
||||
|
||||
=> do or
|
||||
and else quasiquote
|
||||
begin if quote
|
||||
case lambda set!
|
||||
cond let unquote
|
||||
define let* unquote-splicing
|
||||
delay letrec
|
||||
|
||||
however, you can allow for these keywords to be used as variables...
|
||||
|
||||
biniding, unbound...
|
||||
environment.. a set of visible bindings at some point in a program.
|
||||
|
||||
|
||||
|
||||
type atom cons
|
||||
number NUMBER Y
|
||||
string STRING Y
|
||||
symbol SYMBOL name,NIL
|
||||
syntax SYNTAX|SYMBOL name,NIL
|
||||
proc PROC Y
|
||||
pair PAIR Y
|
||||
closure
|
||||
continuation
|
||||
|
||||
an atom does not reference any other values.
|
||||
a symbol can be assoicated with property list
|
||||
(put 'a 'name "brian")
|
||||
(put 'a 'city "daegu")
|
||||
-------------------------
|
||||
(define a1 'a)
|
||||
(put a1 'name "brian")
|
||||
(put a1 'city "daegu")
|
||||
-------------------------
|
||||
(get a1 'name)
|
||||
(get a1 'city)
|
||||
|
||||
a procedure is a privimitive routine built-in to scheme.
|
||||
a closure is an anonymous routine defined with lambda.
|
||||
both can be bound to a variable in the environment.
|
||||
|
||||
a syntax is more primitive than a procedure.
|
||||
a syntax is created as if it is a symbol but not registerd
|
||||
into an environment
|
||||
|
||||
car cdr
|
||||
| STR | PTR CHR ARR | -1 |
|
||||
| PROC | PROCNUM | |
|
||||
| SYM | REF STR | REF PROP LIST |
|
||||
| SYN | REF STR | REF PROP LIST |
|
||||
|
||||
*/
|
||||
|
||||
static qse_scm_ent_t* alloc_entity (
|
||||
qse_scm_t* scm, qse_scm_ent_t* x, qse_scm_ent_t* y)
|
||||
{
|
||||
qse_scm_val_t* v;
|
||||
/* find a free value slot and return it.
|
||||
* two parameters x and y are saved from garbage collection */
|
||||
|
||||
qse_scm_ent_t* v;
|
||||
|
||||
if (scm->mem.free == scm->nil)
|
||||
{
|
||||
gc (scm, x, y);
|
||||
/* if no free slot is available */
|
||||
gc (scm, x, y); /* perform garbage collection */
|
||||
if (scm->mem.free == scm->nil)
|
||||
{
|
||||
if (newvbl (scm, 1000) == QSE_NULL) return QSE_NULL;
|
||||
/* if no free slot is available after garbage collection,
|
||||
* make new value blocks containing more free slots */
|
||||
|
||||
/* TODO: make the value block size configurable */
|
||||
if (new_entity_block (scm, 1000) == QSE_NULL) return QSE_NULL;
|
||||
QSE_ASSERT (scm->mem.free != scm->nil);
|
||||
}
|
||||
}
|
||||
|
||||
v = scm->mem.free;
|
||||
scm->mem.free = v->u.cons.cdr;
|
||||
scm->mem.free = PAIR_CDR(v);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
static qse_scm_val_t* mkcons (
|
||||
qse_scm_t* scm, qse_scm_val_t* car, qse_scm_val_t* cdr)
|
||||
static qse_scm_ent_t* make_pair_entity (
|
||||
qse_scm_t* scm, qse_scm_ent_t* car, qse_scm_ent_t* cdr)
|
||||
{
|
||||
qse_scm_val_t* v;
|
||||
qse_scm_ent_t* v;
|
||||
|
||||
v = mkval (scm, car, cdr);
|
||||
v = alloc_entity (scm, car, cdr);
|
||||
if (v == QSE_NULL) return QSE_NULL;
|
||||
|
||||
#if 0
|
||||
v->flag = QSE_SCM_VAL_PAIR;
|
||||
v->u.cons.car = car;
|
||||
v->u.cons.cdr = car;
|
||||
#endif
|
||||
TYPE(v) = QSE_SCM_ENT_PAIR;
|
||||
ATOM(v) = 0; /* a pair is not an atom as it references other entities */
|
||||
PAIR_CAR(v) = car;
|
||||
PAIR_CDR(v) = cdr;
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
static qse_scm_ent_t* make_string_entity (
|
||||
qse_scm_t* scm, const qse_char_t* str, qse_size_t len)
|
||||
{
|
||||
qse_scm_ent_t* v;
|
||||
|
||||
v = alloc_entity (scm, scm->nil, scm->nil);
|
||||
if (v == QSE_NULL) return QSE_NULL;
|
||||
|
||||
TYPE(v) = QSE_SCM_ENT_STR;
|
||||
ATOM(v) = 1;
|
||||
/* TODO: allocate a string from internal managed region .
|
||||
Calling strdup is not an option as it is not managed...
|
||||
*/
|
||||
STR_PTR(v) = qse_strxdup (str, len, QSE_MMGR(scm));
|
||||
if (STR_PTR(v) == QSE_NULL)
|
||||
{
|
||||
qse_scm_seterror (scm, QSE_SCM_ENOMEM, QSE_NULL, QSE_NULL);
|
||||
return QSE_NULL;
|
||||
}
|
||||
STR_LEN(v) = len;
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
static qse_scm_ent_t* make_name_entity (qse_scm_t* scm, const qse_char_t* str)
|
||||
{
|
||||
qse_scm_ent_t* v;
|
||||
|
||||
v = alloc_entity (scm, scm->nil, scm->nil);
|
||||
if (v == QSE_NULL) return QSE_NULL;
|
||||
|
||||
TYPE(v) = QSE_SCM_ENT_NAM;
|
||||
ATOM(v) = 1;
|
||||
/* TODO: allocate a string from internal managed region .
|
||||
Calling strdup is not an option as it is not managed...
|
||||
*/
|
||||
LAB_PTR(v) = qse_strdup (str, QSE_MMGR(scm));
|
||||
if (LAB_PTR(v) == QSE_NULL)
|
||||
{
|
||||
qse_scm_seterror (scm, QSE_SCM_ENOMEM, QSE_NULL, QSE_NULL);
|
||||
return QSE_NULL;
|
||||
}
|
||||
LAB_CODE(v) = 0;
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
static qse_scm_ent_t* make_symbol_entity (qse_scm_t* scm, const qse_char_t* name)
|
||||
{
|
||||
qse_scm_ent_t* pair, * sym, * nam;
|
||||
|
||||
/* TODO: use a hash table, red-black tree to maintain symbol table
|
||||
* The current linear search algo is not performance friendly...
|
||||
*/
|
||||
|
||||
/* find if the symbol already exists by traversing the pair list
|
||||
* and inspecting the symbol name pointed to by CAR of each pair.
|
||||
*
|
||||
* the symbol table is a list of pairs whose CAR points to a symbol
|
||||
* and CDR is used for chaining.
|
||||
*
|
||||
* +-----+-----+
|
||||
* | | |
|
||||
* +-----+-----+
|
||||
* car | | cdr +-----+-----+
|
||||
* | +----------> | | |
|
||||
* V +-----+-----+
|
||||
* +--------+ car |
|
||||
* | symbol | V
|
||||
* +--------+ +--------+
|
||||
* | symbol |
|
||||
* +--------+
|
||||
*/
|
||||
for (pair = scm->symtab; !IS_NIL(pair); pair = PAIR_CDR(pair))
|
||||
{
|
||||
sym = PAIR_CAR(pair);
|
||||
if (qse_strcmp(name, LAB_PTR(SYM_NAME(sym))) == 0) return sym;
|
||||
}
|
||||
|
||||
/* no existing symbol with such a name is found.
|
||||
* let's create a new symbol. the first step is to create a
|
||||
* string entity to contain the symbol name */
|
||||
nam = make_name_entity (scm, name);
|
||||
if (nam == QSE_NULL) return QSE_NULL;
|
||||
|
||||
/* let's allocate the actual symbol entity that references the
|
||||
* the symbol name entity created above */
|
||||
sym = alloc_entity (scm, nam, scm->nil);
|
||||
if (sym == QSE_NULL) return QSE_NULL;
|
||||
TYPE(sym) = QSE_SCM_ENT_SYM;
|
||||
ATOM(sym) = 0;
|
||||
SYM_NAME(sym) = nam;
|
||||
SYM_PROP(sym) = scm->nil; /* no properties yet */
|
||||
|
||||
/* chain the symbol entity to the symbol table for lookups later */
|
||||
pair = make_pair_entity (scm, sym, scm->symtab);
|
||||
if (pair == QSE_NULL) return QSE_NULL;
|
||||
scm->symtab = pair;
|
||||
|
||||
return sym;
|
||||
}
|
||||
|
||||
static qse_scm_ent_t* make_syntax_entity (
|
||||
qse_scm_t* scm, const qse_char_t* name, int code)
|
||||
{
|
||||
qse_scm_ent_t* v;
|
||||
|
||||
QSE_ASSERTX (code > 0, "Syntax code must be greater than 0");
|
||||
|
||||
v = make_symbol_entity (scm, name);
|
||||
if (v == QSE_NULL) return QSE_NULL;
|
||||
|
||||
/* we piggy-back the syntax code to a symbol name.
|
||||
* the syntax entity is basically a symbol except that the
|
||||
* code field of its label entity is set to non-zero.
|
||||
*/
|
||||
TYPE(v) |= QSE_SCM_ENT_SYNT;
|
||||
SYNT_CODE(v) = code;
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
static qse_scm_ent_t* make_proc_entity (
|
||||
qse_scm_t* scm, const qse_char_t* name, int code)
|
||||
{
|
||||
qse_scm_ent_t* sym, * proc, * pair;
|
||||
|
||||
/* a procedure entity is a built-in function that
|
||||
* that can be overridden by a user while a syntax entity
|
||||
* represents a lower-level syntatic function that can't
|
||||
* be overriden.
|
||||
* (define lambda 10) is legal but does not change the
|
||||
* meaning of lambda when used as a function name.
|
||||
* (define eval 10) changes the meaning of eval totally.
|
||||
*/
|
||||
|
||||
/* create a symbol containing the name */
|
||||
sym = make_symbol_entity (scm, name);
|
||||
if (sym == QSE_NULL) return QSE_NULL;
|
||||
|
||||
/* create an actual procecure value which is a number containing
|
||||
* the opcode for the procedure */
|
||||
proc = alloc_entity (scm, scm->nil, scm->nil);
|
||||
if (proc == QSE_NULL) return QSE_NULL;
|
||||
TYPE(proc) = QSE_SCM_ENT_PROC;
|
||||
ATOM(proc) = 1;
|
||||
PROC_CODE(proc) = code;
|
||||
|
||||
/* create a pair containing the name symbol and the procedure value */
|
||||
pair = make_pair_entity (scm, sym, proc);
|
||||
if (pair == QSE_NULL) return QSE_NULL;
|
||||
|
||||
/* link it to the global environment */
|
||||
pair = make_pair_entity (scm, pair, PAIR_CAR(scm->genv));
|
||||
if (pair == QSE_NULL) return QSE_NULL;
|
||||
PAIR_CAR(scm->genv) = pair;
|
||||
|
||||
return proc;
|
||||
}
|
||||
|
@ -40,65 +40,100 @@
|
||||
#define QSE_SCM_TOUPPER(scm,c) QSE_TOUPPER(c)
|
||||
#define QSE_SCM_TOLOWER(scm,c) QSE_TOLOWER(c)
|
||||
|
||||
#define QSE_SCM_VAL_STRING 1 /* 0000000000000001 */
|
||||
#define QSE_SCM_VAL_NUMBER 2 /* 0000000000000010 */
|
||||
#define QSE_SCM_VAL_SYMBOL 4 /* 0000000000000100 */
|
||||
#define QSE_SCM_VAL_SYNTAX 8 /* 0000000000001000 */
|
||||
#define QSE_SCM_VAL_PROC 16 /* 0000000000010000 */
|
||||
|
||||
#define QSE_SCM_VAL_PAIR 32 /* 0000000000100000 */
|
||||
#define QSE_SCM_VAL_CLOSURE 64 /* 0000000001000000 */
|
||||
#define QSE_SCM_VAL_CONTINUATION 128 /* 0000000010000000 */
|
||||
#define QSE_SCM_VAL_MACRO 256 /* 0000000100000000 */
|
||||
#define QSE_SCM_VAL_PROMISE 512 /* 0000001000000000 */
|
||||
#define QSE_SCM_VAL_ATOM 4096 /* 0001000000000000 */ /* only for gc */
|
||||
|
||||
typedef struct qse_scm_val_t qse_scm_val_t;
|
||||
struct qse_scm_val_t
|
||||
enum qse_scm_ent_type_t
|
||||
{
|
||||
qse_uint16_t dsw_count: 2;
|
||||
qse_uint16_t mark: 1;
|
||||
qse_uint16_t types: 13;
|
||||
QSE_SCM_ENT_NIL = (1 << 0),
|
||||
QSE_SCM_ENT_T = (1 << 1),
|
||||
QSE_SCM_ENT_F = (1 << 2),
|
||||
QSE_SCM_ENT_NUM = (1 << 3),
|
||||
QSE_SCM_ENT_STR = (1 << 4),
|
||||
QSE_SCM_ENT_NAM = (1 << 5),
|
||||
QSE_SCM_ENT_SYM = (1 << 6),
|
||||
QSE_SCM_ENT_PAIR = (1 << 7),
|
||||
QSE_SCM_ENT_PROC = (1 << 8),
|
||||
QSE_SCM_ENT_SYNT = (1 << 9)
|
||||
|
||||
};
|
||||
|
||||
#if 0
|
||||
#define QSE_SCM_ENT_CLOSURE 64 /* 0000000001000000 */
|
||||
#define QSE_SCM_ENT_CONTINUATION 128 /* 0000000010000000 */
|
||||
#define QSE_SCM_ENT_MACRO 256 /* 0000000100000000 */
|
||||
#define QSE_SCM_ENT_PROMISE 512 /* 0000001000000000 */
|
||||
#endif
|
||||
|
||||
typedef struct qse_scm_ent_t qse_scm_ent_t;
|
||||
|
||||
/**
|
||||
* The qse_scm_ent_t type defines an entity that represents an individual
|
||||
* value in scheme.
|
||||
*/
|
||||
struct qse_scm_ent_t
|
||||
{
|
||||
qse_uint16_t dswcount: 2;
|
||||
qse_uint16_t mark: 1;
|
||||
qse_uint16_t atom: 1;
|
||||
qse_uint16_t type: 12;
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
qse_char_t* ptr;
|
||||
qse_size_t len;
|
||||
} str;
|
||||
qse_long_t val;
|
||||
} num; /* number */
|
||||
|
||||
struct
|
||||
{
|
||||
qse_long_t val;
|
||||
} num;
|
||||
/* a string doesn't need to be null-terminated
|
||||
* as the length is remembered */
|
||||
qse_char_t* ptr;
|
||||
qse_size_t len;
|
||||
} str; /* string */
|
||||
|
||||
struct
|
||||
{
|
||||
qse_char_t* ptr; /* null-terminated string */
|
||||
int code; /* used for syntax entities only */
|
||||
} lab; /* label */
|
||||
|
||||
struct
|
||||
{
|
||||
int code;
|
||||
} proc;
|
||||
|
||||
struct
|
||||
{
|
||||
qse_scm_val_t* car;
|
||||
qse_scm_val_t* cdr;
|
||||
} cons;
|
||||
|
||||
/* arrayed cons. cona must maintain the
|
||||
* same size as cons */
|
||||
struct
|
||||
{
|
||||
qse_scm_val_t* val[2];
|
||||
} cona;
|
||||
qse_scm_ent_t* ent[2];
|
||||
} ref;
|
||||
} u;
|
||||
};
|
||||
|
||||
#define DSWCOUNT(v) ((v)->dswcount)
|
||||
#define MARK(v) ((v)->mark)
|
||||
#define TYPE(v) ((v)->type)
|
||||
#define ATOM(v) ((v)->atom)
|
||||
#define NUM_VALUE(v) ((v)->u.num.val)
|
||||
#define STR_PTR(v) ((v)->u.str.ptr)
|
||||
#define STR_LEN(v) ((v)->u.str.len)
|
||||
#define LAB_PTR(v) ((v)->u.lab.ptr)
|
||||
#define LAB_CODE(v) ((v)->u.lab.code)
|
||||
#define SYM_NAME(v) ((v)->u.ref.ent[0])
|
||||
#define SYM_PROP(v) ((v)->u.ref.ent[1])
|
||||
#define PAIR_CAR(v) ((v)->u.ref.ent[0])
|
||||
#define PAIR_CDR(v) ((v)->u.ref.ent[1])
|
||||
#define PROC_CODE(v) ((v)->u.proc.code)
|
||||
#define SYNT_CODE(v) LAB_CODE(SYM_NAME(v))
|
||||
|
||||
/**
|
||||
* The qse_scm_vbl_t type defines a value block. A value block is allocated
|
||||
* The qse_scm_enb_t type defines a value block. A value block is allocated
|
||||
* when more memory is requested and is chained to existing value blocks.
|
||||
*/
|
||||
typedef struct qse_scm_vbl_t qse_scm_vbl_t;
|
||||
struct qse_scm_vbl_t
|
||||
typedef struct qse_scm_enb_t qse_scm_enb_t;
|
||||
struct qse_scm_enb_t
|
||||
{
|
||||
qse_scm_val_t* ptr;
|
||||
qse_scm_ent_t* ptr;
|
||||
qse_size_t len;
|
||||
qse_scm_vbl_t* next;
|
||||
qse_scm_enb_t* next;
|
||||
};
|
||||
|
||||
struct qse_scm_t
|
||||
@ -144,26 +179,29 @@ struct qse_scm_t
|
||||
} r;
|
||||
|
||||
/* common values */
|
||||
qse_scm_val_t* nil;
|
||||
qse_scm_val_t* t;
|
||||
qse_scm_val_t* f;
|
||||
qse_scm_ent_t* nil;
|
||||
qse_scm_ent_t* t;
|
||||
qse_scm_ent_t* f;
|
||||
|
||||
/* global environment */
|
||||
qse_scm_val_t* genv;
|
||||
qse_scm_ent_t* genv;
|
||||
|
||||
/* symbol table */
|
||||
qse_scm_ent_t* symtab;
|
||||
|
||||
/* registers */
|
||||
struct
|
||||
{
|
||||
qse_scm_val_t* arg; /* function arguments */
|
||||
qse_scm_val_t* env; /* current environment */
|
||||
qse_scm_val_t* cod; /* current code */
|
||||
qse_scm_val_t* dmp; /* stack register for next evaluation */
|
||||
qse_scm_ent_t* arg; /* function arguments */
|
||||
qse_scm_ent_t* env; /* current environment */
|
||||
qse_scm_ent_t* cod; /* current code */
|
||||
qse_scm_ent_t* dmp; /* stack register for next evaluation */
|
||||
} reg;
|
||||
|
||||
struct
|
||||
{
|
||||
qse_scm_vbl_t* vbl; /* value block list */
|
||||
qse_scm_val_t* free;
|
||||
qse_scm_enb_t* ebl; /* entity block list */
|
||||
qse_scm_ent_t* free;
|
||||
} mem;
|
||||
};
|
||||
|
||||
|
@ -136,6 +136,7 @@ DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
|
@ -112,6 +112,7 @@ DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
|
@ -74,6 +74,7 @@ DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
|
@ -74,6 +74,7 @@ DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
|
@ -112,6 +112,7 @@ DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
|
@ -147,6 +147,7 @@ DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
|
@ -165,6 +165,7 @@ DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
|
@ -96,6 +96,7 @@ DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
|
@ -96,6 +96,7 @@ DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include <qse/utl/http.h>
|
||||
#include <qse/http/http.h>
|
||||
#include <qse/cmn/mem.h>
|
||||
#include <qse/cmn/str.h>
|
||||
#include <qse/cmn/stdio.h>
|
||||
@ -7,6 +7,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <sys/socket.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
@ -20,12 +21,9 @@ typedef struct client_array_t client_array_t;
|
||||
|
||||
struct client_t
|
||||
{
|
||||
int fd;
|
||||
struct sockaddr_in addr;
|
||||
qse_http_t* http;
|
||||
|
||||
pending_requests???
|
||||
action_t actions[10];
|
||||
int fd;
|
||||
struct sockaddr_storage addr;
|
||||
qse_http_t* http;
|
||||
};
|
||||
|
||||
struct client_array_t
|
||||
@ -50,28 +48,43 @@ int handle_request (qse_http_t* http, qse_http_req_t* req)
|
||||
|
||||
if (req->method == QSE_HTTP_REQ_GET)
|
||||
{
|
||||
#if 0
|
||||
/* determine what to do with the request
|
||||
* and set the right action for it */
|
||||
xtn->action.type = SENDFILE;
|
||||
xtn->action.data.sendfile.path = filename;
|
||||
xtn->action.data.sendfile.ifnewer = xxxx;
|
||||
#endif
|
||||
#if 0
|
||||
qse_http_rep_t* rep;
|
||||
|
||||
#if 0
|
||||
int fd = open (req->path.ptr, O_RDONLY);
|
||||
if (fd <= -1)
|
||||
{
|
||||
qse_http_addtext (http,
|
||||
"<html><title>FILE NOT FOUND</title><body></body></html>");
|
||||
}
|
||||
else
|
||||
{
|
||||
#if 0
|
||||
qse_http_addheader (
|
||||
http, "Content-Type", detect_file_type(req->path.ptr)
|
||||
);
|
||||
|
||||
qse_http_addtext (http, .....);
|
||||
qse_http_adddata (http,
|
||||
|
||||
qse_http_addoutputdata (http, fd);
|
||||
#endif
|
||||
|
||||
/*
|
||||
struct stat st;
|
||||
|
||||
fstat (fd, &st);
|
||||
sendfile (xtn->array->data[xtn->index].fd, fd, NULL, st.st_size);
|
||||
close (fd);
|
||||
*/
|
||||
}
|
||||
#endif
|
||||
|
||||
rep = qse_http_emit (http);
|
||||
if (rep == NULL)
|
||||
{
|
||||
/* ERROR */
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -116,18 +129,18 @@ qse_http_reqcbs_t http_reqcbs =
|
||||
int mkserver (const char* portstr)
|
||||
{
|
||||
int s, flag, port = atoi(portstr);
|
||||
struct sockaddr_in addr;
|
||||
struct sockaddr_in6 addr;
|
||||
|
||||
s = socket (PF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
s = socket (PF_INET6, SOCK_STREAM, IPPROTO_TCP);
|
||||
if (s <= -1) return -1;
|
||||
|
||||
flag = 1;
|
||||
setsockopt (s, SOL_SOCKET, SO_REUSEADDR, &flag, sizeof(flag));
|
||||
|
||||
memset (&addr, 0, sizeof(addr));
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_addr.s_addr = htonl (INADDR_ANY);
|
||||
addr.sin_port = htons (port);
|
||||
addr.sin6_family = AF_INET6;
|
||||
addr.sin6_port = htons(port);
|
||||
inet_pton (AF_INET6, "::1", &addr.sin6_addr);
|
||||
|
||||
if (bind (s, (struct sockaddr*)&addr, sizeof(addr)) <= -1)
|
||||
{
|
||||
@ -183,7 +196,7 @@ static void fini_client_array (client_array_t* array)
|
||||
}
|
||||
|
||||
static client_t* insert_into_client_array (
|
||||
client_array_t* array, int fd, struct sockaddr_in* addr)
|
||||
client_array_t* array, int fd, struct sockaddr_storage* addr)
|
||||
{
|
||||
http_xtn_t* xtn;
|
||||
|
||||
@ -219,7 +232,8 @@ static client_t* insert_into_client_array (
|
||||
return &array->data[fd];
|
||||
}
|
||||
|
||||
static int make_fd_set_from_client_array (client_array_t* ca, int s, fd_set* r, fd_set* w)
|
||||
static int make_fd_set_from_client_array (
|
||||
client_array_t* ca, int s, fd_set* r, fd_set* w)
|
||||
{
|
||||
int fd, max = s;
|
||||
|
||||
@ -285,48 +299,23 @@ int main (int argc, char* argv[])
|
||||
fd_set r, w;
|
||||
struct timeval tv;
|
||||
|
||||
#if 0
|
||||
if (ca->need_cpu)
|
||||
{
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
tv.tv_sec = 1;
|
||||
tv.tv_usec = 0;
|
||||
#if 0
|
||||
}
|
||||
#endif
|
||||
tv.tv_sec = 1;
|
||||
tv.tv_usec = 0;
|
||||
|
||||
max = make_fd_set_from_client_array (&ca, s, &r, &w);
|
||||
n = select (max + 1, &r, &w, NULL, &tv);
|
||||
if (n <= -1)
|
||||
{
|
||||
if (errno == EINTR) continue;
|
||||
|
||||
qse_fprintf (QSE_STDERR, QSE_T("Error: select returned failure\n"));
|
||||
break;
|
||||
}
|
||||
if (n == 0)
|
||||
{
|
||||
#if 0
|
||||
/* no input and no writable sockets.
|
||||
*/
|
||||
for (fd = 0; fd < ca.capa; fd++)
|
||||
{
|
||||
/* process internal things */
|
||||
qse_http_pump (ca.data[fd].http);
|
||||
}
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
if (n == 0) continue;
|
||||
|
||||
if (FD_ISSET(s, &r))
|
||||
{
|
||||
int flag;
|
||||
struct sockaddr_in addr;
|
||||
struct sockaddr_storage addr;
|
||||
socklen_t addrlen = sizeof(addr);
|
||||
int c = accept (s, (struct sockaddr*)&addr, &addrlen);
|
||||
if (c <= -1)
|
||||
@ -408,7 +397,7 @@ int main (int argc, char* argv[])
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (FD_ISSET(client->fd, &w) && client->has_data_to_send)
|
||||
if (FD_ISSET(client->fd, &w) && client->rep)
|
||||
{
|
||||
/* ready to send output */
|
||||
if (handle_output (xxxxx) <= -1)
|
||||
|
@ -118,6 +118,7 @@ DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
|
Loading…
Reference in New Issue
Block a user