From 7c3e41979478d6826f73a956a26c967aae1687a2 Mon Sep 17 00:00:00 2001 From: LLLL Colonq Date: Mon, 16 Jun 2025 03:33:52 -0400 Subject: fig-utils: Guile FFI --- fig-web/main/Main.hs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'fig-web/main') diff --git a/fig-web/main/Main.hs b/fig-web/main/Main.hs index 909127e..b1cc006 100644 --- a/fig-web/main/Main.hs +++ b/fig-web/main/Main.hs @@ -8,6 +8,7 @@ import Options.Applicative import Fig.Web.Types import Fig.Web.Utils +import qualified Fig.Utils.FFI as FFI import qualified Fig.Web.Public as Public import qualified Fig.Web.Secure as Secure @@ -23,11 +24,13 @@ parseSecureOptions = do data Command = Public PublicOptions | Secure SecureOptions + | TestFFI parseCommand :: Parser Command parseCommand = hsubparser $ mconcat [ command "public" $ info (Public <$> parsePublicOptions) (progDesc "Launch the public web server") , command "secure" $ info (Secure <$> parseSecureOptions) (progDesc "Launch the private web server (intended to be run behind authentication proxy)") + , command "testffi" $ info (pure TestFFI) (progDesc "Test the FFI") ] data Opts = Opts @@ -55,3 +58,8 @@ main = do case opts.cmd of Public o -> Public.server o cfg (opts.busHost, opts.busPort) Secure o -> Secure.server o cfg (opts.busHost, opts.busPort) + TestFFI -> do + log "testing FFI" + res <- FFI.checkAnswer "(lambda (d) (define (loop) (loop)) (loop) (string-length d))" + "hello computer" + log $ "result: " <> tshow res -- cgit v1.2.3