diff options
Diffstat (limited to 'stdlib/source/library/lux/world/program.lux')
-rw-r--r-- | stdlib/source/library/lux/world/program.lux | 114 |
1 files changed, 57 insertions, 57 deletions
diff --git a/stdlib/source/library/lux/world/program.lux b/stdlib/source/library/lux/world/program.lux index c846f1b7d..3216c6b93 100644 --- a/stdlib/source/library/lux/world/program.lux +++ b/stdlib/source/library/lux/world/program.lux @@ -108,8 +108,8 @@ (def: (exit code) (io.io (error! (%.int code))))))) -## Do not trust the values of environment variables -## https://wiki.sei.cmu.edu/confluence/display/java/ENV02-J.+Do+not+trust+the+values+of+environment+variables +... Do not trust the values of environment variables +... https://wiki.sei.cmu.edu/confluence/display/java/ENV02-J.+Do+not+trust+the+values+of+environment+variables (with_expansions [<jvm> (as_is (import: java/lang/String) @@ -276,28 +276,28 @@ ["#::." (#static exit [Int] #io Nothing)])) - ## @.php - ## (as_is (ffi.import: (exit [Int] #io Nothing)) - ## ## https://www.php.net/manual/en/function.exit.php - ## (ffi.import: (getcwd [] #io ffi.String)) - ## ## https://www.php.net/manual/en/function.getcwd.php - ## (ffi.import: (getenv #as getenv/1 [ffi.String] #io ffi.String)) - ## (ffi.import: (getenv #as getenv/0 [] #io (Array ffi.String))) - ## ## https://www.php.net/manual/en/function.getenv.php - ## ## https://www.php.net/manual/en/function.array-keys.php - ## (ffi.import: (array_keys [(Array ffi.String)] (Array ffi.String))) - ## ) - - ## @.scheme - ## (as_is (ffi.import: (exit [Int] #io Nothing)) - ## ## https://srfi.schemers.org/srfi-98/srfi-98.html - ## (abstract: Pair Any) - ## (abstract: PList Any) - ## (ffi.import: (get-environment-variables [] #io PList)) - ## (ffi.import: (car [Pair] Text)) - ## (ffi.import: (cdr [Pair] Text)) - ## (ffi.import: (car #as head [PList] Pair)) - ## (ffi.import: (cdr #as tail [PList] PList))) + ... @.php + ... (as_is (ffi.import: (exit [Int] #io Nothing)) + ... ... https://www.php.net/manual/en/function.exit.php + ... (ffi.import: (getcwd [] #io ffi.String)) + ... ... https://www.php.net/manual/en/function.getcwd.php + ... (ffi.import: (getenv #as getenv/1 [ffi.String] #io ffi.String)) + ... (ffi.import: (getenv #as getenv/0 [] #io (Array ffi.String))) + ... ... https://www.php.net/manual/en/function.getenv.php + ... ... https://www.php.net/manual/en/function.array-keys.php + ... (ffi.import: (array_keys [(Array ffi.String)] (Array ffi.String))) + ... ) + + ... @.scheme + ... (as_is (ffi.import: (exit [Int] #io Nothing)) + ... ... https://srfi.schemers.org/srfi-98/srfi-98.html + ... (abstract: Pair Any) + ... (abstract: PList Any) + ... (ffi.import: (get-environment-variables [] #io PList)) + ... (ffi.import: (car [Pair] Text)) + ... (ffi.import: (cdr [Pair] Text)) + ... (ffi.import: (car #as head [PList] Pair)) + ... (ffi.import: (cdr #as tail [PList] PList))) } (as_is))) @@ -322,28 +322,28 @@ (list)) (list))) @.python (\ io.monad map array.list (os/environ::keys [])) - ## Lua offers no way to get all the environment variables available. + ... Lua offers no way to get all the environment variables available. @.lua (io.io (list)) @.ruby (|> (RubyEnv::keys []) array.list io.io) - ## @.php (do io.monad - ## [environment (..getenv/0 [])] - ## (in (|> environment - ## ..array_keys - ## array.list - ## (list\map (function (_ variable) - ## [variable ("php array read" (:as Nat variable) environment)])) - ## (dictionary.of_list text.hash)))) - ## @.scheme (do io.monad - ## [input (..get-environment-variables [])] - ## (loop [input input - ## output environment.empty] - ## (if ("scheme object nil?" input) - ## (in output) - ## (let [entry (..head input)] - ## (recur (..tail input) - ## (dictionary.put (..car entry) (..cdr entry) output)))))) + ... @.php (do io.monad + ... [environment (..getenv/0 [])] + ... (in (|> environment + ... ..array_keys + ... array.list + ... (list\map (function (_ variable) + ... [variable ("php array read" (:as Nat variable) environment)])) + ... (dictionary.of_list text.hash)))) + ... @.scheme (do io.monad + ... [input (..get-environment-variables [])] + ... (loop [input input + ... output environment.empty] + ... (if ("scheme object nil?" input) + ... (in output) + ... (let [entry (..head input)] + ... (recur (..tail input) + ... (dictionary.put (..car entry) (..cdr entry) output)))))) }))) (def: (variable name) @@ -389,13 +389,13 @@ @.python (os/path::expanduser ["~"]) @.lua (..run_command "~" "echo ~") @.ruby (io.io (RubyDir::home)) - ## @.php (do io.monad - ## [output (..getenv/1 ["HOME"])] - ## (in (if (bit\= false (:as Bit output)) - ## "~" - ## output))) + ... @.php (do io.monad + ... [output (..getenv/1 ["HOME"])] + ... (in (if (bit\= false (:as Bit output)) + ... "~" + ... output))) } - ## TODO: Replace dummy implementation. + ... TODO: Replace dummy implementation. <default>)))) (def: directory @@ -420,13 +420,13 @@ (..run_command default "pwd") (in on_windows))) @.ruby (io.io (RubyFileUtils::pwd)) - ## @.php (do io.monad - ## [output (..getcwd [])] - ## (in (if (bit\= false (:as Bit output)) - ## "." - ## output))) + ... @.php (do io.monad + ... [output (..getcwd [])] + ... (in (if (bit\= false (:as Bit output)) + ... "." + ... output))) } - ## TODO: Replace dummy implementation. + ... TODO: Replace dummy implementation. (io.io <default>))))) (def: (exit code) @@ -441,11 +441,11 @@ ffi.on_browser? (..exit_browser! code) - ## else + ... else (..default_exit! code)) @.python (os::_exit [code]) @.lua (os/exit [code]) @.ruby (RubyKernel::exit [code]) - ## @.php (..exit [code]) - ## @.scheme (..exit [code]) + ... @.php (..exit [code]) + ... @.scheme (..exit [code]) })))) |