


## export.pkg
# Compiled by:
# src/lib/std/src/standard-core.sublibstipulate
package rs = runtime_signals; # runtime_signals is from src/lib/std/src/nj/runtime-signals.pkg package ci = mythryl_callable_c_library_interface; # mythryl_callable_c_library_interface is from src/lib/std/src/unsafe/mythryl-callable-c-library-interface.pkgherein
package export
: (weak) Export # Export is from src/lib/std/src/nj/export.api {
Fork_Result = AM_PARENT | AM_CHILD;
#
package process = winix_process;
fun runtime_fn fun_name
=
ci::find_c_function { lib_name => "heap", fun_name };
my export_heap: String -> Bool
= runtime_fn "export_heap"; # "export_heap" def in src/c/lib/heap/export-heap.c
# We need the pair wrapper type to make sure that the second argument will
# be fully wrapped when it is passed to the run-time system.
# [also see wrap-export.pkg]
#
Cmdt = wrap_export::Pair( String, List( String ) ) -> winix_types::process::Status; # "Cmdt" may be "Command_Type"
my spawn_to_disk' : (String, Cmdt) -> Void
=
runtime_fn "spawn_to_disk"; # "spawn_to_disk" def in src/c/lib/heap/export-fun.c
fun null_filename ()
=
raise exception runtime::RUNTIME_EXCEPTION ("empty heap file name", NULL);
# Export the current Mythryl heap to the given file:
#
fun fork_to_disk ""
=>
null_filename ();
fork_to_disk file_name
=>
{ at::run_functions_scheduled_to_run at::FORK_TO_DISK;
#
if (export_heap file_name)
#
at::run_functions_scheduled_to_run at::STARTUP;
AM_CHILD;
else
AM_PARENT;
fi;
};
end;
# inline_t is from src/lib/core/init/built-in.pkg fun spawn_to_disk ("", f)
=>
null_filename ();
spawn_to_disk (file_name, f)
=>
{ rs::mask_signals rs::MASK_ALL;
#
at::run_functions_scheduled_to_run at::SPAWN_TO_DISK;
#
runtime::pervasive_package_pickle_list__global
:=
inline_t::cast ();
#
spawn_to_disk' (file_name, wrap_export::wrap f); # Never returns.
};
end;
}; # package export
end;
## COPYRIGHT (c) 1995 AT&T Bell Laboratories.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2012,
## released under Gnu Public Licence version 3.


