


## mythryld-app.pkg
#
# Start-of-execution for the mythryld executable,
# which is to say the entire Mythryl interactive
# compiler/etc system.
# Compiled by:
# src/lib/core/internal/interactive-system.libstipulate
package mcb = mythryl_compiler; # mythryl_compiler is from src/lib/core/compiler/set-mythryl_compiler-to-mythryl_compiler_for_intel32_posix.pkg # # mythryl_compiler_g is from src/lib/compiler/toplevel/compiler/mythryl-compiler-g.pkg package myp = mythryl_parser; # mythryl_parser is from src/lib/compiler/front/parser/main/mythryl-parser.pkg #
package wix = winix; # winix is from src/lib/std/winix.pkg #
herein
package mythryld_app
: Mythryld_App # Mythryld_App is from src/lib/core/internal/mythryld-app.api {
fun open_main_log ()
=
{
fd = file::open_for_append "main.log~";
file::write (fd, "src/lib/core/internal/make-mythryld-executable.pkg: START\n");
file::flush fd;
file::close_output fd;
};
# We are invoked (only) from:
# src/lib/core/internal/make-mythryld-executable.pkg #
fun main do_all_requested_compiles # do_all_requested_compiles is ultimately run_commandline from src/app/makelib/main/makelib-g.pkg =
{
#################################################
#
# START OF THE Mythryld WORLD
#
# Congratulations! You've found the start-
# of-execution for the mythryld executable --
# the equivalent of main() in a C program.
#################################################
open_main_log ();
file::set_logger_to (file::LOG_TO_FILE "unknown.log");
# fd = file::open_for_append "mythryld-app.pkg.log";
# file::write (fd, "src/lib/core/internal/mythryld-app.pkg\n");
# file::flush fd;
# file::close_output fd;
# When our mythryl.c wrapper invokes us to run a script, # mythryl.c is from src/c/o/mythryl.c
# it sets MYTHRYL_SCRIPT=<stdin> in the environment. # See start_subprocess() in src/c/o/mythryl.c
#
# This is our cue to disable interactive prompts,
# which otherwise generate unexpected and ugly clutter.
#
# In this case, we also skip processing commandline
# arguments, in deference to the script logic:
#
#
script_name
=
case (kludge::get_script_name ()) # kludge is from src/lib/src/kludge.pkg # #
THE script_name => { myp::print_interactive_prompts := FALSE; # 'script_name' is contents of MYTHRYL_SCRIPT environment variable at startup,
script_name; # set by start_subprocess() in src/c/o/mythryl.c
}; # and then read and cleared by process_commandline_options in src/c/main/runtime-main.c
_ => { do_all_requested_compiles (); # Typically does not return.
"<stdin>"; # Can we ever actually get here? If so, why?
};
esac;
mcb::rpl::read_eval_print_from_script script_name; # 'script_name' can be "<stdin>" or the filename of the script.
}; # See src/lib/compiler/toplevel/interact/read-eval-print-loops-g.pkg };
end;


