PreviousUpNext

15.4.736  src/lib/core/internal/mythryld-app.pkg

##  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.lib


stipulate
    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__premicrothread;                                                       # winix__premicrothread         is from   src/lib/std/winix--premicrothread.pkg
    #
herein

    package   mythryld_app
    :         Mythryld_App                                                                      # Mythryld_App                  is from   src/lib/core/internal/mythryld-app.api
    {
        # 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
            =
            {
# printf "                                mythryld:   starting up             To attach gdb do   gdb bin/mythryl-runtime-intel32 %d\n" (posixlib::get_process_id ());
                #################################################
                #                                              
                #         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.    
                #################################################


                # 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;


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext