@@ -171,11 +171,11 @@ pub mod borrowck;
171171///
172172/// * `argc` & `argv` - The argument vector. On Unix this information is used
173173/// by os::args.
174- /// * `crate_map` - Runtime information about the executing crate, mostly for logging
175174///
176175/// # Return value
177176///
178177/// The return value is used as the process return code. 0 on success, 101 on error.
178+ #[ cfg( stage0) ]
179179pub fn start ( argc : int , argv : * * u8 , crate_map : * u8 , main : ~fn ( ) ) -> int {
180180
181181 init ( argc, argv, crate_map) ;
@@ -184,25 +184,44 @@ pub fn start(argc: int, argv: **u8, crate_map: *u8, main: ~fn()) -> int {
184184
185185 return exit_code;
186186}
187+ #[ cfg( not( stage0) ) ]
188+ pub fn start ( argc : int , argv : * * u8 , main : ~fn ( ) ) -> int {
189+
190+ init ( argc, argv) ;
191+ let exit_code = run ( main) ;
192+ cleanup ( ) ;
193+
194+ return exit_code;
195+ }
187196
188197/// Like `start` but creates an additional scheduler on the current thread,
189198/// which in most cases will be the 'main' thread, and pins the main task to it.
190199///
191200/// This is appropriate for running code that must execute on the main thread,
192201/// such as the platform event loop and GUI.
202+ #[ cfg( stage0) ]
193203pub fn start_on_main_thread ( argc : int , argv : * * u8 , crate_map : * u8 , main : ~fn ( ) ) -> int {
194204 init ( argc, argv, crate_map) ;
195205 let exit_code = run_on_main_thread ( main) ;
196206 cleanup ( ) ;
197207
198208 return exit_code;
199209}
210+ #[ cfg( not( stage0) ) ]
211+ pub fn start_on_main_thread ( argc : int , argv : * * u8 , main : ~fn ( ) ) -> int {
212+ init ( argc, argv) ;
213+ let exit_code = run_on_main_thread ( main) ;
214+ cleanup ( ) ;
215+
216+ return exit_code;
217+ }
200218
201219/// One-time runtime initialization.
202220///
203221/// Initializes global state, including frobbing
204222/// the crate's logging flags, registering GC
205223/// metadata, and storing the process arguments.
224+ #[ cfg( stage0) ]
206225pub fn init ( argc : int , argv : * * u8 , crate_map : * u8 ) {
207226 // XXX: Derefing these pointers is not safe.
208227 // Need to propagate the unsafety to `start`.
@@ -212,6 +231,16 @@ pub fn init(argc: int, argv: **u8, crate_map: *u8) {
212231 logging:: init ( crate_map) ;
213232 }
214233}
234+ #[ cfg( not( stage0) ) ]
235+ pub fn init ( argc : int , argv : * * u8 ) {
236+ // XXX: Derefing these pointers is not safe.
237+ // Need to propagate the unsafety to `start`.
238+ unsafe {
239+ args:: init ( argc, argv) ;
240+ env:: init ( ) ;
241+ logging:: init ( ) ;
242+ }
243+ }
215244
216245/// One-time runtime cleanup.
217246pub fn cleanup ( ) {
0 commit comments