diff --git a/.ikc3_history b/.ikc3_history
index 0a5cb4f..0147367 100644
--- a/.ikc3_history
+++ b/.ikc3_history
@@ -1,31 +1,3 @@
-Str.ftime(Time.now(), "%a")
-Str.ftime(Time.now(), "%a, %d")
-Str.ftime(Time.now(), "%a, %G")
-Str.ftime(Time.now(), "%a, %m %d %G")
-Str.ftime(Time.now(), "%a, %b %d %G")
-Str.ftime(Time.now(), "%a, %b %d %G %T %Z")
-cow 1
-cow(1)
-cow 1
-cow 1 + 1
-quote cow 1 + 1
-a = cow 1 + 1
-a
-a + 1
-a <- 3
-a = cow 1 + 1
-a
-a = cow 1 + 1
-a
-a = cow 1 + 1
-a
-a = cow 1 + 1
-a
-Str.split("./fx/README", "/")
-op = ?
-op <- 1
-op
-type(op)
?0x4c21af5a1f0
Str.split("/plop/hop/", "/")
Str.split("/1/2/3/", "/")
@@ -97,3 +69,31 @@ puts(Sh.escape("abc"))
puts(Sh.escape("ab c"))
puts(Sh.escape("ab(c"))
puts(Sh.escape("abc"))
+1 + 1
+1 + 10000000000000000000000000000000000000000000000000
+2 * 10000000000000000000000000000000000000000000000000
+type(10000000000000000000000000000000000000000000000000)
+type(1)
+type(255)
+type(256)
+quote fn (x) { x * x }
+quote if true do if false do 1 else fn (x) { x * x } end end
+quote if true do if false do 1 else fn (x) do x * x end end end
+quote if true do if false do %KC3.Operator{sym: :-, symbol_value: 3} else fn (x) do x * x end end end
+if true do if true do %KC3.Operator{sym: :-, symbol_value: 3} else fn (x) do x * x end end end
+type(0)
+type(-1)
+def operator_muul = %KC3.Operator{sym: :****, symbol_value: fn (a, b) { a * a + b * b }
+}
+3 **** 5
+3 * 3 + 5 * 5
+system(["ls", "-l"])
+tem(["ls", "-l"])
+human_size(2024024)
+to_lisp
+to_lisp(quote 1 + 1)
+to_lisp(quote 1 + 1 * 2 / 3 - 4)
+to_lisp(quote a = ?; a <- 1; a)
+Facts.database()
+a = Facts.database()
+(Facts) a
diff --git a/httpd/fx/app/controllers/fx_controller.kc3 b/httpd/fx/app/controllers/fx_controller.kc3
index 63d6c2d..7001d26 100644
--- a/httpd/fx/app/controllers/fx_controller.kc3
+++ b/httpd/fx/app/controllers/fx_controller.kc3
@@ -100,6 +100,7 @@ defmodule FXController do
}
def tag_create = fn (path, tag) {
+ Fx.tag_create(
body = """
<html>
<head>
diff --git a/httpd/fx/app/models/fx.kc3 b/httpd/fx/app/models/fx.kc3
new file mode 100644
index 0000000..df936f6
--- /dev/null
+++ b/httpd/fx/app/models/fx.kc3
@@ -0,0 +1,11 @@
+defmodule Fx
+
+ def db = Facts.database()
+
+ def tag_list = fn (path) {
+ Facts.collect_with_tags(db, path, :tag, tag = ?, fn (fact) {
+ tag
+ })
+ }
+
+
diff --git a/ikc3/.ikc3_history b/ikc3/.ikc3_history
index 030b287..0147367 100644
--- a/ikc3/.ikc3_history
+++ b/ikc3/.ikc3_history
@@ -1,99 +1,99 @@
-to_lisp(quote a = ? <- 1 ; 2)
-quote if true do if true do %KC3.Operator{symbol_value: void} end end
-quote if true do if true do %KC3.Operator{sym: :-, symbol_value: void} end end
-to_lisp(quote a = ? <- 1 ; 2)
-quote a = ? <- 1 ; 2
-quote 1 + 20 / 3 * 4 - 5
-quote 1 + 20 / 3 * 4
-quote 1 + 20 / 3 * 4 - 5
-1 + 1
-1 + 1000000000000000000000000000000000000000000000000000000
-(1 + 1000000000000000000000000000000000000000000000000000000) * 2
-sqrt(1 + 1000000000000000000000000000000000000000000000000000000)
-List.reverse([1, 2, 3, 4])
-List.reverse
-List.reverse([1, 2, 3, 4])
-List.map([1, 2, 3, 4], fn (x) { x * 2 })
-List.has?([1, 2, 3, 4], 1)
-List.has?([1, 2, 3, 4], 0)
-quote if true do if true do %KC3.Operator{} end end
-quote if true do if true do %KC3.Operator{sym: :-} end end
-quote if true do if true do %KC3.Operator{sym: :-, symbol_value: void} end end
-quote if true do if true do %KC3.Operator{sym: :-, symbol_value: void} else 0 end else 1 end
-a = ?
-b = ?
-a = ? ; void
-Facts.with_tags(Facts.env_facts(), KC3, :operator, ?, fn (fact) { puts(fact.object); 1 })
-EKC3.html_escape("plop <1>")
-Facts.first_with_tags(Facts.env_facts(), KC3, :operator, ?, fn (fact) { fact.object })
-first_operator = Facts.first_with_tags(Facts.env_facts(), KC3, :operator, ?, fn (fact) { fact.object })
-first_operator
-List.append([1, 2, 3], 4)
-HTTPd.routes
-a = :dir
-file = %{type: :dir}
-file.type
-file.type == :dir
-file = %{type: :dir, items = [%{type: file, items: []}]}
-file = %{type: :dir, items: [%{type: file, items: []}]}
-file = %{type: :dir, items: [%{type: :file, items: []}]}
-file = "plop.md"
-Str.starts_with?(file, ".") ||
-(Sw) 4 > 0
-q
-List.sort([1, 2, 3, 4])
-List.sort([4, 3, 2, 1])
-List.sort(["1. a", "2. bc", "3. cde", "4. fghi"])
-List.sort(["1. abcd", "2. efg", "3. hi", "4. j"])
-
-1/3
-1/3 * 2
-2/6 * 2
-double = fn (x) { x * 2 }
-double(4)
-double(21)
-List.map([1, 2, 3, 4], double)
-List.reverse([1, 2, 3, 4])
-Time.now
-Time.now()
-Str.ftime(Time.now(), "%a")
-Str.ftim
-Str.ftime
-Str.ftime(Time.now(), "%a")
-Str.ftime(Time.now(), "%a, %d")
-Str.ftime(Time.now(), "%a, %G")
-Str.ftime(Time.now(), "%a, %m %d %G")
-Str.ftime(Time.now(), "%a, %b %d %G")
-Str.ftime(Time.now(), "%a, %b %d %G %T %Z")
-cow 1
-cow(1)
-cow 1
-cow 1 + 1
-quote cow 1 + 1
-a = cow 1 + 1
-a
-a + 1
-a <- 3
-a = cow 1 + 1
-a
-a = cow 1 + 1
-a
-a = cow 1 + 1
-a
-a = cow 1 + 1
-a
-a = cow 1
-a <- 2
-a
-system(["ls"])
+?0x4c21af5a1f0
+Str.split("/plop/hop/", "/")
+Str.split("/1/2/3/", "/")
+List.join(Str.split("/1/2/3/", "/"), "/")
+HTTP.mime_type(".txt")
+HTTP.mime_type("plop.txt")
+HTTP.mime_type("txt")
+HTTP.mime_type_load("httpd/fx/config/mime.types")
+HTTP.mime_type("txt")
+HTTP.mime_type(".txt")
+HTTP.mime_type("pplop.txt")
+HTTP.mime_type("txt")
+File.ext("Plop.html")
+HTTP.mime_type(File.ext("Plop.html"))
+(Str) HTTP.mime_type(File.ext("Plop.html"))
+Str.split((Str) HTTP.mime_type(File.ext("Plop.html")), "/")
+List.to_tuple(Str.split((Str) HTTP.mime_type(File.ext("Plop.html")), "/"))
+(Tuple) (Str.split((Str) HTTP.mime_type(File.ext("Plop.html")), "/"))
+(Str.split((Str) HTTP.mime_type(File.ext("Plop.html")), "/"))
+hd(Str.split((Str) HTTP.mime_type(File.ext("Plop.html")), "/"))
+List.first(Str.split((Str) HTTP.mime_type(File.ext("Plop.html")), "/"))
+first(Str.split((Str) HTTP.mime_type(File.ext("Plop.html")), "/"))
+(Sym) first(Str.split((Str) HTTP.mime_type(File.ext("Plop.html")), "/"))
+SH.run("file -b ${SH.escape(path)}")
size = 10
+if (size > 1024 * 1024 * 1024 * 1024) do
+if (size > 1024 * 1024 * 1024 * 1024) do
+ s = size * 10 / 1024 / 1024 / 1024 / 1024
+"#{s / 10}.#{s % 10}Tb"
+size = 100
if (size > 1024) do
s = size * 10 / 1024
"#{s / 10}.#{s % 10}Kb"
-size = 10
-if (size > 1024) do
-s = size * 10 / 1024
-"#{s}"
-else
-"#{size}b"
-end
+quote %
+10 % 3
+human_size(1024)
+human_size(1025)
+human_size(1024)
+human_size(2024024)
+human_size(100)
+Str.size("abc")
+human_size(0)
+human_size((Uw) 114)
+type(1024 * 1024 * 1024 * 1024)
+human_size((Uw) 114)
+system(["ls", "-l"])
+puts(system(["ls", "-l"]))
+puts(system(["ls", "-l"])
+)
+1 +
+2
+1 + 2
+1 + 100000000000000000000000000000000000000000000
+1 + 100000000000000000000000000000000000000000000.
+1 + 10000000000000000000000000000000000000000000.
+1 + 10000000000000000000000000000000000000000000
+1 + 10000000000000.0
+1 + 10000000000000/2
+1 + 10000000000000/3
+1 + 2/3
+3 **** 4
+def op = %KC3.Operator{sym: :****, symbol_value: fn (a, b) { a * b * 4 }}
+3 **** 4
+3 * 4 * 4
+Sh.escape("abc")
+Sh.escape("abc;")
+puts(Sh.escape("abc;"))
+puts(Sh.escape("abc"))
+puts(Sh.escape("ab c"))
+puts(Sh.escape("ab(c"))
+puts(Sh.escape("abc"))
+1 + 1
+1 + 10000000000000000000000000000000000000000000000000
+2 * 10000000000000000000000000000000000000000000000000
+type(10000000000000000000000000000000000000000000000000)
+type(1)
+type(255)
+type(256)
+quote fn (x) { x * x }
+quote if true do if false do 1 else fn (x) { x * x } end end
+quote if true do if false do 1 else fn (x) do x * x end end end
+quote if true do if false do %KC3.Operator{sym: :-, symbol_value: 3} else fn (x) do x * x end end end
+if true do if true do %KC3.Operator{sym: :-, symbol_value: 3} else fn (x) do x * x end end end
+type(0)
+type(-1)
+def operator_muul = %KC3.Operator{sym: :****, symbol_value: fn (a, b) { a * a + b * b }
+}
+3 **** 5
+3 * 3 + 5 * 5
+system(["ls", "-l"])
+tem(["ls", "-l"])
+human_size(2024024)
+to_lisp
+to_lisp(quote 1 + 1)
+to_lisp(quote 1 + 1 * 2 / 3 - 4)
+to_lisp(quote a = ?; a <- 1; a)
+Facts.database()
+a = Facts.database()
+(Facts) a
diff --git a/lib/kc3/0.1/facts.kc3 b/lib/kc3/0.1/facts.kc3
index f3295a5..0fcb9f5 100644
--- a/lib/kc3/0.1/facts.kc3
+++ b/lib/kc3/0.1/facts.kc3
@@ -12,11 +12,19 @@ defmodule Facts do
rwlock_thread: (Ptr) 0,
transaction: (Ptr) 0]
+ def add_tags = cfn Fact "facts_add_tags" (Facts, Tag, Tag, Tag, Result)
+
def cast = cfn Tag "tag_init_cast_struct" (Result, Sym, Tag)
+ def clean = cfn Void "facts_clean" (Facts)
+
def collect_with_tags = cfn Tag "kc3_facts_collect_with_tags" (Facts,
Tag, Tag, Tag, Fn, Result)
+ def database = cfn Ptr "facts_database" (Result)
+
+ def delete = cfn Void "facts_delete" (Facts)
+
# env_facts() -> facts
def env_facts = cfn Ptr "kc3_env_facts" ()
diff --git a/lib/kc3/0.1/httpd.kc3 b/lib/kc3/0.1/httpd.kc3
index 9eca262..0f87a9d 100644
--- a/lib/kc3/0.1/httpd.kc3
+++ b/lib/kc3/0.1/httpd.kc3
@@ -20,7 +20,12 @@ defmodule HTTPd do
List.each(files, fn (file) {
if (! Str.starts_with?(file, ".") &&
! Str.ends_with?(file, "~")) do
- load(dir + file)
+ path = dir + file
+ if File.is_directory?(path) do
+ load_directory(path + "/")
+ else
+ load(path)
+ end
end
})
end
diff --git a/libkc3/facts.c b/libkc3/facts.c
index b5fddb7..7cee440 100644
--- a/libkc3/facts.c
+++ b/libkc3/facts.c
@@ -166,6 +166,12 @@ int facts_compare_pfact_id_reverse (const void *a, const void *b)
return 0;
}
+s_facts ** facts_database (s_facts **facts)
+{
+ *facts = facts_new();
+ return facts;
+}
+
void facts_delete (s_facts *facts)
{
assert(facts);