| 1 | /* Copyright (C) 2004-2009 Henry Cejtin, Matthew Fluet, Suresh |
| 2 | * Jagannathan, and Stephen Weeks. |
| 3 | * |
| 4 | * MLton is released under a BSD-style license. |
| 5 | * See the file MLton-LICENSE for details. |
| 6 | */ |
| 7 | |
| 8 | #include "platform.h" |
| 9 | |
| 10 | Bool MLton_Platform_CygwinUseMmap = TRUE; |
| 11 | |
| 12 | void GC_setCygwinUseMmap (bool b) { |
| 13 | MLton_Platform_CygwinUseMmap = b; |
| 14 | } |
| 15 | |
| 16 | void MLton_init (int argc, char **argv, GC_state s) { |
| 17 | int start; |
| 18 | |
| 19 | Posix_ProcEnv_environ = (C_StringArray_t)environ; |
| 20 | start = GC_init (s, argc, argv); |
| 21 | /* Setup argv and argc that SML sees. */ |
| 22 | /* start is now the index of the first real arg. */ |
| 23 | CommandLine_commandName = (C_String_t)(argv[0]); |
| 24 | CommandLine_argc = argc - start; |
| 25 | CommandLine_argv = (C_StringArray_t)(argv + start); |
| 26 | } |
| 27 | |
| 28 | void MLton_halt (GC_state s, C_Int_t status) { |
| 29 | GC_done (s); |
| 30 | exit (status); |
| 31 | } |
| 32 | |
| 33 | void MLton_heapCheckTooLarge (void) { |
| 34 | die ("Out of memory. Unable to check heap for more than %"PRIuMAX" bytes.\n", |
| 35 | (uintmax_t)SIZE_MAX); |
| 36 | } |