## kludge.api
#
# A home for regrettable kludges.
# Compiled by:
#
src/lib/std/standard.lib# This api is implemented in:
#
#
src/lib/src/kludge.pkgapi Kludge {
#
get_script_name: Void -> Null_Or( String );
#
# This is a little kludge in support of
# script-style execution of Mythryl code via
#
# #!/usr/bin/mythryl
#
# shebang lines. It works so:
#
# 1) In start_subprocess in src/c/o/mythryl.c
# we set the MYTHRYL_SCRIPT environment variable to the
# name of the script being executed or "<stdin>".
#
# 2) In process_commandline_options in src/c/main/runtime-main.c
# we copy the value of MYTHRYL_SCRIPT into C global mythryl_script__global
# and then remove MYTHRYL_SCRIPT from the environment.
# (Letting it be inherited by subprocesses is a Really Bad Idea -- Voice of Experiece.)
#
# 3) In do_get_script_name in src/c/lib/kludge/libmythryl-kludge.c
# we export the contents of mythryl_script__global to the Mythryl level.
#
# 4) In get_script_name in
src/lib/src/kludge.pkg # we make the above generaly available.
#
# 5) In main in
src/lib/core/internal/mythryld-app.pkg # we check kludge::get_script_name and if it is not NULL
# we execute special code to compile from stdin and
# suppress interactive prompts and otherwise make Mythryl
# scripts perform as expected.
};
## Jeff Prothero Copyright (c) 2012,
## released per terms of SMLNJ-COPYRIGHT.