Commits

Paweł Wieczorek  committed f79bd6b Draft

branched

  • Participants
  • Parent commits cac44dd
  • Branches working

Comments (0)

Files changed (4)

 	${OCAMLFIND} install commandtree META ${LIB_FILES}
 
 remove deinstall uninstall:
-	${OCAMLFIND} remove CommandTree
+	${OCAMLFIND} remove commandtree
 
 doc:
 	${OCAMLBUILD} ${SOURCE_DIRS} src/CommandTree.docdir/index.html

File src/Executor.ml

 
 exception Invalid_usage of (string Lazy.t * error)
 
+type compiled_commands = (string, tree) Hashtbl.t
+
 (*********************************************************************************************************************
  * Hash table fillers
  ********************************************************************************************************************)
     invalid_usage (lazy (usage_of_leaf path command_module)) error
 
 (*********************************************************************************************************************
+ * Path follower
+ ********************************************************************************************************************)
+
+
+(*********************************************************************************************************************
  * Executor
  ********************************************************************************************************************)
 
  * Entries
  ********************************************************************************************************************)
 
+let compile_commands commands = prepare commands
+
+let execute_compiled_command_tree hash_table passed_arguments =
+    match passed_arguments with
+    | executable_name :: passed_arguments ->
+        execute [executable_name] hash_table passed_arguments
+
+    | [] ->
+        invalid_usage_of_node [] hash_table (NoCommand)
+
+let execute_compiled_command_tree_v hash_table passed_arguments_v =
+    let passed_arguments = Array.to_list passed_arguments_v in
+    execute_compiled_command_tree hash_table passed_arguments
+
 let execute_command_tree commands passed_arguments =
     let hash_table = prepare commands in
     match passed_arguments with
     let passed_arguments = Array.to_list passed_arguments_v in
     execute_command_tree commands passed_arguments
 
+let help_message hash_table passed_arguments =
+    raise Exit
+
+let help_message_v hash_table passed_arguments_v =
+    let passed_arguments = Array.to_list passed_arguments_v in
+    help_message hash_table passed_arguments
+
+

File src/Executor.mli

 
 exception Invalid_usage of (string Lazy.t * error)
 
+type compiled_commands
+
+val compile_commands : Type.command_tree list -> compiled_commands
+
+val execute_compiled_command_tree_v : compiled_commands -> string array -> int
+
+val execute_compiled_command_tree : compiled_commands -> string list -> int
+
 val execute_command_tree_v : Type.command_tree list -> string array -> int
 
 val execute_command_tree : Type.command_tree list -> string list -> int
+
+val help_message : compiled_commands -> string list -> string
+
+val help_message_v : compiled_commands -> string array -> string
 type command_tree
     = Leaf of (module Command)
     | Node of string * string * command_tree list
+