aboutsummaryrefslogtreecommitdiff
path: root/src/main.ml
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.ml')
-rwxr-xr-xsrc/main.ml19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/main.ml b/src/main.ml
index 4491025..8e557ce 100755
--- a/src/main.ml
+++ b/src/main.ml
@@ -1,3 +1,5 @@
+module E:Sym_expr.SYM_EXPR = Evaluate
+
let u = UTF8.from_utf8string
let redraw t screen =
@@ -13,6 +15,8 @@ let action f msg (t, screen) = begin
t', screen'
end
+let catalog = Functions.C.compile @@ Functions.built_in Functions.C.empty
+
let f screen = ActionParser.(
begin match Screen.read_key screen with
| "\027" -> ESC
@@ -127,14 +131,17 @@ let rec normal_mode (t, screen) = begin
normal_mode @@ redraw t' screen
end
+(*
| Actions.Search ->
let expr = Screen.search screen
|> Expression.load in
- let pattern = Expression.eval expr (fun _ -> ScTypes.Refs.Single None) in
+ (*let pattern = Expression.eval expr (fun _ -> ScTypes.Refs.Single None) in*)
+ let pattern = Expression.eval' expr catalog in
begin match Sheet.search (`Pattern (Some pattern)) t with
| Some t' -> normal_mode @@ redraw t' screen
| None -> normal_mode (t, screen)
end
+*)
| Actions.Button1_clicked coord ->
begin match Screen.get_cell screen coord with
@@ -227,7 +234,7 @@ and command (t, screen) action = begin
normal_mode @@ redraw t screen
*)
| ("enew", _) -> (* Start a new spreadsheet *)
- normal_mode @@ redraw (Sheet.create Sheet.Raw.empty) screen
+ normal_mode @@ redraw (Sheet.create catalog Sheet.Raw.empty) screen
| ("q", _) -> (* Quit *)
t
| _ -> normal_mode @@ redraw t screen
@@ -235,16 +242,12 @@ end
let () = begin
- let catalog = Functions.built_in Functions.C.empty in
- ignore @@ Evaluator.set_catalog (Functions.C.compile catalog);
-
-
let sheet =
if Array.length Sys.argv = 1 then
Sheet.Raw.empty
else
- Odf.load Sys.argv.(1) in
+ Odf.load catalog Sys.argv.(1) in
Screen.run (fun window ->
- ignore @@ normal_mode @@ redraw (Sheet.create sheet) window)
+ ignore @@ normal_mode @@ redraw (Sheet.create catalog sheet) window)
end