/* print a bug message and exit (2) */ void MLton_bug (String8_t msg) { uintmax_t size = GC_getArrayLength ((pointer)msg); fprintf (stderr, "MLton bug: "); fwrite ((const void*)msg, (size_t)size, 1, stderr); fprintf (stderr, "\nPlease send a bug report to [email protected].\n"); exit (2); }
/* Should only be called with a write or read-write buffer */ Bool writeBuffer(Pointer p_machine /* simplecl_machine */, int type_size, Pointer p_buffer /* buffer to read from */, Pointer p_array /* array to read to */) { int size = GC_getArrayLength(p_array); int i = sclWriteBuffer((simplecl_machine)p_machine, (cl_mem)p_buffer, size, (size_t)type_size, (void*)p_array); if (i != SIMPLECL_SUCCESS) { return 0; } else { return 1; } }
C_Errno_t(C_Int_t) Posix_Process_exece (NullString8_t pNStr, Array(NullString8_t) aStr, Array(NullString8_t) eStr) { const char *path; char **args; char **env; uintmax_t aLen; uintmax_t eLen; char *aSaved; char *eSaved; int res; path = (const char *) pNStr; args = (char **) aStr; aLen = GC_getArrayLength((pointer)aStr); aSaved = args[aLen - 1]; args[aLen - 1] = NULL; env = (char **) eStr; eLen = GC_getArrayLength((pointer)eStr); eSaved = env[eLen - 1]; env[eLen - 1] = NULL; res = EXECVE (path, (char * const *)args, (char * const *)env); /* exece failed */ args[aLen - 1] = aSaved; env[eLen - 1] = eSaved; return (C_Errno_t(C_Int_t))res; }