PreviousUpNext

15.4.42  src/app/lex/export-lex-fn.pkg

# export-lex-fn.pkg
#
# Revision 1.2  2000/03/07 04:01:05  blume
# - build script now uses the new bin/build-an-executable-mythryl-heap-image script

# Compiled by:
#     src/app/lex/mythryl-lex.lib



###            "A good workman is known by his tools."
###
###                                -- proverb.


stipulate
    package fil =  file__premicrothread;                                # file__premicrothread  is from   src/lib/std/src/posix/file--premicrothread.pkg
herein

    package export_lex_fn: (weak)   api {
                                        lex_fn
                                            :
                                            (String, List(String))
                                            ->
                                            winix__premicrothread::process::Status;
                                    }
    {
        include package   trap_control_c;                                       # trap_control_c        is from   src/lib/std/trap-control-c.pkg

        fun err msg
            =
            fil::write  (fil::stderr,  string::cat  msg);

        fun lex_fn (name, args)
            =
            {   fun lex_fn' ()
                    =
                    case args
                        #                  
                        []    => {  err [name, ": missing filename\n"];
                                    winix__premicrothread::process::exit 1;
                                 };
                        #
                        files => list::apply
                                     lex_fn::lex_fn
                                     files;
                    esac;

                {   catch_interrupt_signal  lex_fn';
                    #
                    winix__premicrothread::process::success;
                }
                except
                    CONTROL_C_SIGNAL
                        =>
                        {   err [name, ": Interrupt\n"];
                            winix__premicrothread::process::failure;
                        };

                    any =>
                        {   err [   name,
                                    ": uncaught exception ",
                                    exceptions::exception_message any,
                                    "\n"
                                ];

                            winix__premicrothread::process::failure;
                        };
                end;
            };
    };
end;


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext