diff --git a/.ikc3_history b/.ikc3_history
index e4b5499..be370d5 100644
--- a/.ikc3_history
+++ b/.ikc3_history
@@ -1,6 +1,3 @@
-type(123456)
-type(123456789)
-type(123456789012)
type(1234567890123456789)
type(123456789012345678901234)
type(123456789012345678901234/2)
@@ -97,3 +94,6 @@ pid()
man getpid
t = Thread.new(fn () { puts("ok") })
quote t = Thread.new(fn () { puts("ok") })
+List.count(10)
+List.map(List.count(10), fn (x) { {x, x} })
+List.map(List.count(10), fn (x) { %{id: x} })
diff --git a/lib/kc3/0.1/httpd.kc3 b/lib/kc3/0.1/httpd.kc3
index 79fd872..c7bfa6c 100644
--- a/lib/kc3/0.1/httpd.kc3
+++ b/lib/kc3/0.1/httpd.kc3
@@ -104,22 +104,29 @@ defmodule HTTPd do
def time_zero = %Time{}
- def server = fn (host, port) {
- if socket = Socket.listen(host, port) do
- daemonize()
- if event_base = Event.base_new() do
- puts("KC3 HTTPd: listening on #{host}:#{port}")
- load_app()
- acceptor_ev = Event.new(event_base, socket.fd, [:read, :persist],
- acceptor, void)
- r = Event.add(acceptor_ev, time_zero)
- r = Event.dispatch(event_base)
- if r do
- e = errno()
- puts("KC3 HTTPd: event dispatch error: #{strerror(e)}")
- end
- Socket.close(socket)
+ def server_thread = fn () {
+ if event_base = Event.base_new() do
+ puts("KC3 HTTPd: listening on #{host}:#{port}")
+ load_app()
+ acceptor_ev = Event.new(event_base, socket.fd, [:read, :persist],
+ acceptor, void)
+ r = Event.add(acceptor_ev, time_zero)
+ r = Event.dispatch(event_base)
+ if r do
+ e = errno()
+ puts("KC3 HTTPd: event dispatch error: #{strerror(e)}")
end
+ Socket.close(socket)
+ end
+ }
+
+ def server = fn (host, port) {
+ def socket = Socket.listen(host, port)
+ daemonize()
+ i = 1
+ while i > 0 do
+ Thread.new(server_thread)
+ i = i - 1
end
}
diff --git a/lib/kc3/0.1/list.kc3 b/lib/kc3/0.1/list.kc3
index a501818..9ae723c 100644
--- a/lib/kc3/0.1/list.kc3
+++ b/lib/kc3/0.1/list.kc3
@@ -4,6 +4,18 @@ defmodule List do
def cast = cfn List "list_init_cast" (Result, Sym, Tag)
+ def count = fn {
+ (n) { count(n, []) }
+ (0, acc) { acc }
+ (n, acc) {
+ if n > 0 do
+ count(n - 1, [n | acc])
+ else
+ []
+ end
+ }
+ }
+
def each = cfn Bool "list_each" (List, Callable, Result)
def filter = cfn List "list_filter" (List, Callable, Result)
diff --git a/libkc3/env.c b/libkc3/env.c
index e4c70d8..030537f 100644
--- a/libkc3/env.c
+++ b/libkc3/env.c
@@ -2754,7 +2754,7 @@ s_env * env_init_copy (s_env *env, s_env *src)
tmp.err = src->err;
//tmp.error_handler = NULL;
tmp.facts = src->facts;
- //tmp.frame = NULL;
+ tmp.frame = frame_new_copy(src->frame);
tmp.global_frame = src->global_frame;
tmp.in = src->in;
tmp.module_path = src->module_path;
diff --git a/test/Makefile b/test/Makefile
index b7b3660..9b23a4d 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -166,6 +166,18 @@ test_http_cov:
test_http_debug:
KC3S=${SRC_TOP}/kc3s/kc3s_debug time ./http_test
+test_httpd:
+ ${MAKE} -C httpd main
+
+test_httpd_asan:
+ ${MAKE} -C httpd asan
+
+test_httpd_cov:
+ ${MAKE} -C httpd cov
+
+test_httpd_debug:
+ ${MAKE} -C httpd debug
+
test_ikc3:
IKC3=${SRC_TOP}/ikc3/ikc3 time ./ikc3_test