-
-
Save remi6397/e5adb3694385f2fc724de73ef5d229c0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open Containers | |
open Intf | |
type state_class += | |
| Post_hello | |
let rec hello_world_transform ic oc state = | |
if List.mem ~eq:(Equal.physical) Post_hello state then | |
None | |
else | |
Lwt_io.write_line "hello"; | |
Some Post_hello | |
let () = | |
transforms := hello_world_transform :: transforms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type state_class = .. | |
type state_data = state_class list | |
type transform = (Lwt_io.input_channel -> Lwt_io.output_channel -> state_data -> state_class option) | |
let transforms : (transform list) ref = ref [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(jbuild_version 1) | |
(executable | |
((name loader) | |
(libraries (containers sqlite3 lwt lwt.unix dynlink)))) | |
(library | |
((name first_plugin) | |
(libraries (containers lwt lwt.unix)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open Container | |
open Lwt | |
open Intf | |
exception No_plugins_loaded | |
let () = | |
let open Dynlink in | |
Sys.readdir extdir | |
|> Array.filter Sys.is_directory | |
|> Array.iter Dynlink.loadfile; | |
if List.length !transforms = 0 then raise No_plugins_loaded else () | |
(* …cut… *) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment