Import Debian changes 20180207-1
[hcoop/debian/mlton.git] / runtime / platform.c
CommitLineData
7f918cf1
CE
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
10Bool MLton_Platform_CygwinUseMmap = TRUE;
11
12void GC_setCygwinUseMmap (bool b) {
13 MLton_Platform_CygwinUseMmap = b;
14}
15
16void 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
28void MLton_halt (GC_state s, C_Int_t status) {
29 GC_done (s);
30 exit (status);
31}
32
33void MLton_heapCheckTooLarge (void) {
34 die ("Out of memory. Unable to check heap for more than %"PRIuMAX" bytes.\n",
35 (uintmax_t)SIZE_MAX);
36}