2019-10-24 13:51:22 +02:00
|
|
|
module builtin
|
2020-04-07 03:27:06 +02:00
|
|
|
|
2022-04-29 03:31:51 +02:00
|
|
|
// struct C.FILE {}
|
|
|
|
|
2019-10-26 10:14:16 +02:00
|
|
|
// <string.h>
|
2021-09-08 12:09:32 +02:00
|
|
|
fn C.memcpy(dest voidptr, const_src voidptr, n usize) voidptr
|
2019-10-26 10:14:16 +02:00
|
|
|
|
2021-09-08 12:09:32 +02:00
|
|
|
fn C.memcmp(const_s1 voidptr, const_s2 voidptr, n usize) int
|
2020-11-16 17:32:50 +01:00
|
|
|
|
2021-09-08 12:09:32 +02:00
|
|
|
fn C.memmove(dest voidptr, const_src voidptr, n usize) voidptr
|
2021-08-12 20:46:38 +02:00
|
|
|
|
2021-09-08 12:09:32 +02:00
|
|
|
fn C.memset(str voidptr, c int, n usize) voidptr
|
2020-11-16 17:32:50 +01:00
|
|
|
|
2021-02-14 19:37:32 +01:00
|
|
|
[trusted]
|
2022-04-28 10:30:36 +02:00
|
|
|
fn C.calloc(int, int) &u8
|
2020-11-16 17:32:50 +01:00
|
|
|
|
2022-04-29 03:31:51 +02:00
|
|
|
fn C.atoi(&char) int
|
|
|
|
|
2022-04-28 10:30:36 +02:00
|
|
|
fn C.malloc(int) &u8
|
2020-11-16 17:32:50 +01:00
|
|
|
|
2022-04-28 10:30:36 +02:00
|
|
|
fn C.realloc(a &u8, b int) &u8
|
2020-11-16 17:32:50 +01:00
|
|
|
|
2020-04-07 03:27:06 +02:00
|
|
|
fn C.free(ptr voidptr)
|
2019-10-24 14:41:29 +02:00
|
|
|
|
2021-07-05 04:05:37 +02:00
|
|
|
[noreturn; trusted]
|
2020-11-16 17:32:50 +01:00
|
|
|
fn C.exit(code int)
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-09-08 12:09:32 +02:00
|
|
|
fn C.qsort(base voidptr, items usize, item_size usize, cb C.qsort_callback_func)
|
2019-10-24 14:41:29 +02:00
|
|
|
|
2020-02-04 09:54:15 +01:00
|
|
|
fn C.sprintf(a ...voidptr) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-04 16:43:32 +02:00
|
|
|
fn C.strlen(s &char) int
|
2019-10-25 11:07:50 +02:00
|
|
|
|
2022-04-15 13:45:52 +02:00
|
|
|
fn C.sscanf(&u8, &u8, ...&u8) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-02-14 19:37:32 +01:00
|
|
|
[trusted]
|
|
|
|
fn C.isdigit(c int) bool
|
2020-11-16 17:32:50 +01:00
|
|
|
|
2019-10-31 22:52:08 +01:00
|
|
|
// stdio.h
|
2021-04-04 16:43:32 +02:00
|
|
|
fn C.popen(c &char, t &char) voidptr
|
2020-03-22 14:47:43 +01:00
|
|
|
|
2019-10-26 00:55:16 +02:00
|
|
|
// <execinfo.h>
|
2020-05-15 14:23:58 +02:00
|
|
|
fn C.backtrace(a &voidptr, size int) int
|
2020-11-16 17:32:50 +01:00
|
|
|
|
2021-04-04 16:43:32 +02:00
|
|
|
fn C.backtrace_symbols(a &voidptr, size int) &&char
|
2020-11-16 17:32:50 +01:00
|
|
|
|
2020-05-15 14:23:58 +02:00
|
|
|
fn C.backtrace_symbols_fd(a &voidptr, size int, fd int)
|
|
|
|
|
2019-10-26 00:55:16 +02:00
|
|
|
// <libproc.h>
|
2020-05-18 22:54:08 +02:00
|
|
|
pub fn proc_pidpath(int, voidptr, int) int
|
2019-10-26 00:55:16 +02:00
|
|
|
|
2021-04-04 16:43:32 +02:00
|
|
|
fn C.realpath(&char, &char) &char
|
2019-11-14 23:07:38 +01:00
|
|
|
|
2021-03-05 15:41:11 +01:00
|
|
|
// fn C.chmod(byteptr, mode_t) int
|
2021-04-05 21:13:53 +02:00
|
|
|
fn C.chmod(&char, u32) int
|
2019-10-24 14:41:29 +02:00
|
|
|
|
2021-04-05 21:13:53 +02:00
|
|
|
fn C.printf(&char, ...voidptr) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-05 21:13:53 +02:00
|
|
|
fn C.puts(&char) int
|
2022-04-20 12:03:22 +02:00
|
|
|
fn C.abs(f64) f64
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-05 21:13:53 +02:00
|
|
|
fn C.fputs(str &char, stream &C.FILE) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-01-30 18:33:36 +01:00
|
|
|
fn C.fflush(&C.FILE) int
|
2020-11-16 17:32:50 +01:00
|
|
|
|
2019-11-24 04:27:02 +01:00
|
|
|
// TODO define args in these functions
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C.fseek(stream &C.FILE, offset int, whence int) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-04 16:43:32 +02:00
|
|
|
fn C.fopen(filename &char, mode &char) &C.FILE
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-01-30 18:33:36 +01:00
|
|
|
fn C.fileno(&C.FILE) int
|
2020-05-19 12:38:06 +02:00
|
|
|
|
2021-09-08 12:09:32 +02:00
|
|
|
fn C.fread(ptr voidptr, item_size usize, items usize, stream &C.FILE) usize
|
2021-01-15 11:15:22 +01:00
|
|
|
|
2021-09-08 12:09:32 +02:00
|
|
|
fn C.fwrite(ptr voidptr, item_size usize, items usize, stream &C.FILE) usize
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C.fclose(stream &C.FILE) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C.pclose(stream &C.FILE) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2020-11-16 17:32:50 +01:00
|
|
|
// process execution, os.process:
|
2021-04-04 16:05:06 +02:00
|
|
|
[trusted]
|
2020-11-16 17:32:50 +01:00
|
|
|
fn C.getpid() int
|
|
|
|
|
2021-05-05 13:20:11 +02:00
|
|
|
fn C.getuid() int
|
|
|
|
|
|
|
|
fn C.geteuid() int
|
|
|
|
|
2021-04-04 16:43:32 +02:00
|
|
|
fn C.system(cmd &char) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-04 16:43:32 +02:00
|
|
|
fn C.posix_spawn(child_pid &int, path &char, file_actions voidptr, attrp voidptr, argv &&char, envp &&char) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-04 16:43:32 +02:00
|
|
|
fn C.posix_spawnp(child_pid &int, exefile &char, file_actions voidptr, attrp voidptr, argv &&char, envp &&char) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-04 16:43:32 +02:00
|
|
|
fn C.execve(cmd_path &char, args voidptr, envs voidptr) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-05 20:39:32 +02:00
|
|
|
fn C.execvp(cmd_path &char, args &&char) int
|
2021-04-04 16:05:06 +02:00
|
|
|
|
2021-04-05 20:39:32 +02:00
|
|
|
fn C._execve(cmd_path &char, args voidptr, envs voidptr) int
|
2021-04-04 16:05:06 +02:00
|
|
|
|
2021-04-05 20:39:32 +02:00
|
|
|
fn C._execvp(cmd_path &char, args &&char) int
|
2021-04-04 16:05:06 +02:00
|
|
|
|
2021-02-14 19:37:32 +01:00
|
|
|
[trusted]
|
2020-11-16 17:32:50 +01:00
|
|
|
fn C.fork() int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2020-11-16 17:32:50 +01:00
|
|
|
fn C.wait(status &int) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2020-11-16 17:32:50 +01:00
|
|
|
fn C.waitpid(pid int, status &int, options int) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-04 16:05:06 +02:00
|
|
|
[trusted]
|
2020-11-16 17:32:50 +01:00
|
|
|
fn C.kill(pid int, sig int) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-04 16:43:32 +02:00
|
|
|
fn C.setenv(&char, &char, int) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-04 16:43:32 +02:00
|
|
|
fn C.unsetenv(&char) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-04 16:43:32 +02:00
|
|
|
fn C.access(path &char, amode int) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-04 16:43:32 +02:00
|
|
|
fn C.remove(filename &char) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-04 16:43:32 +02:00
|
|
|
fn C.rmdir(path &char) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-04 16:43:32 +02:00
|
|
|
fn C.chdir(path &char) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C.rewind(stream &C.FILE) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2022-04-29 03:31:51 +02:00
|
|
|
fn C.ftell(&C.FILE) int
|
|
|
|
|
2021-04-04 16:43:32 +02:00
|
|
|
fn C.stat(&char, voidptr) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-04 16:43:32 +02:00
|
|
|
fn C.lstat(path &char, buf &C.stat) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-04 16:43:32 +02:00
|
|
|
fn C.rename(old_filename &char, new_filename &char) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-04 16:43:32 +02:00
|
|
|
fn C.fgets(str &char, n int, stream &C.FILE) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-04 16:05:06 +02:00
|
|
|
[trusted]
|
2019-11-24 04:27:02 +01:00
|
|
|
fn C.sigemptyset() int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-09-08 12:09:32 +02:00
|
|
|
fn C.getcwd(buf &char, size usize) &char
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-04 16:05:06 +02:00
|
|
|
[trusted]
|
2019-11-24 04:27:02 +01:00
|
|
|
fn C.mktime() int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C.gettimeofday(tv &C.timeval, tz &C.timezone) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2020-08-09 11:22:11 +02:00
|
|
|
[trusted]
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C.sleep(seconds u32) u32
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-03-05 15:41:11 +01:00
|
|
|
// fn C.usleep(usec useconds_t) int
|
2021-04-04 16:05:06 +02:00
|
|
|
[trusted]
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C.usleep(usec u32) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-10-22 16:08:08 +02:00
|
|
|
[typedef]
|
|
|
|
struct C.DIR {
|
|
|
|
}
|
|
|
|
|
|
|
|
fn C.opendir(&char) &C.DIR
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C.closedir(dirp &C.DIR) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-04 16:43:32 +02:00
|
|
|
// fn C.mkdir(path &char, mode mode_t) int
|
|
|
|
fn C.mkdir(path &char, mode u32) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-02-14 19:37:32 +01:00
|
|
|
// C.rand returns a pseudorandom integer from 0 (inclusive) to C.RAND_MAX (exclusive)
|
|
|
|
[trusted]
|
|
|
|
fn C.rand() int
|
|
|
|
|
|
|
|
// C.srand seeds the internal PRNG with the given value.
|
|
|
|
[trusted]
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C.srand(seed u32)
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-04 16:43:32 +02:00
|
|
|
fn C.atof(str &char) f64
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-04 16:05:06 +02:00
|
|
|
[trusted]
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C.tolower(c int) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-04 16:05:06 +02:00
|
|
|
[trusted]
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C.toupper(c int) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2022-01-25 18:15:45 +01:00
|
|
|
[trusted]
|
|
|
|
fn C.isspace(c int) int
|
|
|
|
|
2022-01-19 13:26:24 +01:00
|
|
|
fn C.strchr(s &char, c int) &char
|
|
|
|
|
2020-08-09 11:22:11 +02:00
|
|
|
[trusted]
|
2019-11-24 04:27:02 +01:00
|
|
|
fn C.getchar() int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2022-01-24 04:14:31 +01:00
|
|
|
fn C.strdup(s &char) &char
|
|
|
|
|
|
|
|
fn C.strncasecmp(s &char, s2 &char, n int) int
|
|
|
|
|
|
|
|
fn C.strcasecmp(s &char, s2 &char) int
|
|
|
|
|
2022-01-25 18:15:45 +01:00
|
|
|
fn C.strncmp(s &char, s2 &char, n int) int
|
|
|
|
|
2020-08-09 11:22:11 +02:00
|
|
|
[trusted]
|
2021-04-04 16:43:32 +02:00
|
|
|
fn C.strerror(int) &char
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-09-08 12:09:32 +02:00
|
|
|
fn C.snprintf(str &char, size usize, format &char, opt ...voidptr) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-05 21:24:17 +02:00
|
|
|
fn C.fprintf(voidptr, &char, ...voidptr)
|
2019-11-24 04:27:02 +01:00
|
|
|
|
2021-04-04 16:05:06 +02:00
|
|
|
[trusted]
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C.WIFEXITED(status int) bool
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-04 16:05:06 +02:00
|
|
|
[trusted]
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C.WEXITSTATUS(status int) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-04 16:05:06 +02:00
|
|
|
[trusted]
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C.WIFSIGNALED(status int) bool
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-04 16:05:06 +02:00
|
|
|
[trusted]
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C.WTERMSIG(status int) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-04 16:05:06 +02:00
|
|
|
[trusted]
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C.isatty(fd int) int
|
2019-11-24 04:27:02 +01:00
|
|
|
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C.syscall(number int, va ...voidptr) int
|
2019-11-24 04:27:02 +01:00
|
|
|
|
2021-09-08 12:09:32 +02:00
|
|
|
fn C.sysctl(name &int, namelen u32, oldp voidptr, oldlenp voidptr, newp voidptr, newlen usize) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-04 16:05:06 +02:00
|
|
|
[trusted]
|
2019-10-24 14:41:29 +02:00
|
|
|
fn C._fileno(int) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2019-11-16 00:30:50 +01:00
|
|
|
fn C._get_osfhandle(fd int) C.intptr_t
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C.GetModuleFileName(hModule voidptr, lpFilename &u16, nSize u32) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2020-11-16 17:32:50 +01:00
|
|
|
fn C.GetModuleFileNameW(hModule voidptr, lpFilename &u16, nSize u32) u32
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C.CreateFile(lpFilename &u16, dwDesiredAccess u32, dwShareMode u32, lpSecurityAttributes &u16, dwCreationDisposition u32, dwFlagsAndAttributes u32, hTemplateFile voidptr) voidptr
|
2020-07-16 18:33:26 +02:00
|
|
|
|
2020-11-16 17:32:50 +01:00
|
|
|
fn C.CreateFileW(lpFilename &u16, dwDesiredAccess u32, dwShareMode u32, lpSecurityAttributes &u16, dwCreationDisposition u32, dwFlagsAndAttributes u32, hTemplateFile voidptr) u32
|
2020-07-16 18:33:26 +02:00
|
|
|
|
|
|
|
fn C.GetFinalPathNameByHandleW(hFile voidptr, lpFilePath &u16, nSize u32, dwFlags u32) int
|
|
|
|
|
2019-11-16 00:30:50 +01:00
|
|
|
fn C.CreatePipe(hReadPipe &voidptr, hWritePipe &voidptr, lpPipeAttributes voidptr, nSize u32) bool
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2020-05-16 16:12:23 +02:00
|
|
|
fn C.SetHandleInformation(hObject voidptr, dwMask u32, dw_flags u32) bool
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2019-11-16 00:30:50 +01:00
|
|
|
fn C.ExpandEnvironmentStringsW(lpSrc &u16, lpDst &u16, nSize u32) u32
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-24 12:22:04 +02:00
|
|
|
fn C.GetComputerNameW(&u16, &u32) bool
|
|
|
|
|
2021-04-25 17:16:14 +02:00
|
|
|
fn C.GetUserNameW(&u16, &u32) bool
|
|
|
|
|
2021-04-04 16:05:06 +02:00
|
|
|
[trusted]
|
2020-06-08 09:19:31 +02:00
|
|
|
fn C.SendMessageTimeout() u32
|
|
|
|
|
2021-08-13 16:03:39 +02:00
|
|
|
fn C.SendMessageTimeoutW(hWnd voidptr, msg u32, wParam &u16, lParam &u32, fuFlags u32, uTimeout u32, lpdwResult &u64) u32
|
2020-06-08 09:19:31 +02:00
|
|
|
|
2019-11-16 00:30:50 +01:00
|
|
|
fn C.CreateProcessW(lpApplicationName &u16, lpCommandLine &u16, lpProcessAttributes voidptr, lpThreadAttributes voidptr, bInheritHandles bool, dwCreationFlags u32, lpEnvironment voidptr, lpCurrentDirectory &u16, lpStartupInfo voidptr, lpProcessInformation voidptr) bool
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2020-09-16 16:40:02 +02:00
|
|
|
fn C.ReadFile(hFile voidptr, lpBuffer voidptr, nNumberOfBytesToRead u32, lpNumberOfBytesRead C.LPDWORD, lpOverlapped voidptr) bool
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2022-04-15 13:45:52 +02:00
|
|
|
fn C.GetFileAttributesW(lpFileName &u8) u32
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2022-04-15 13:45:52 +02:00
|
|
|
fn C.RegQueryValueEx(hKey voidptr, lpValueName &u16, lp_reserved &u32, lpType &u32, lpData &u8, lpcbData &u32) voidptr
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2022-04-15 13:45:52 +02:00
|
|
|
fn C.RegQueryValueExW(hKey voidptr, lpValueName &u16, lp_reserved &u32, lpType &u32, lpData &u8, lpcbData &u32) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C.RegOpenKeyEx(hKey voidptr, lpSubKey &u16, ulOptions u32, samDesired u32, phkResult voidptr) voidptr
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2020-11-16 17:32:50 +01:00
|
|
|
fn C.RegOpenKeyExW(hKey voidptr, lpSubKey &u16, ulOptions u32, samDesired u32, phkResult voidptr) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2020-06-08 09:19:31 +02:00
|
|
|
fn C.RegSetValueEx() voidptr
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2022-04-15 13:45:52 +02:00
|
|
|
fn C.RegSetValueExW(hKey voidptr, lpValueName &u16, reserved u32, dwType u32, lpData &u8, lpcbData u32) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C.RegCloseKey(hKey voidptr)
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-06-18 19:07:25 +02:00
|
|
|
fn C.RemoveDirectory(lpPathName &u16) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2020-11-16 17:32:50 +01:00
|
|
|
// fn C.GetStdHandle() voidptr
|
2020-02-10 08:32:08 +01:00
|
|
|
fn C.GetStdHandle(u32) voidptr
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2020-11-16 17:32:50 +01:00
|
|
|
// fn C.SetConsoleMode()
|
2021-02-14 07:33:24 +01:00
|
|
|
fn C.SetConsoleMode(voidptr, u32) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2020-11-16 17:32:50 +01:00
|
|
|
// fn C.GetConsoleMode() int
|
2020-02-10 08:32:08 +01:00
|
|
|
fn C.GetConsoleMode(voidptr, &u32) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-04 16:05:06 +02:00
|
|
|
[trusted]
|
2020-11-16 17:32:50 +01:00
|
|
|
fn C.GetCurrentProcessId() int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2019-11-24 11:16:02 +01:00
|
|
|
fn C.wprintf()
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2020-11-16 17:32:50 +01:00
|
|
|
// fn C.setbuf()
|
2021-04-04 16:43:32 +02:00
|
|
|
fn C.setbuf(voidptr, &char)
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C.SymCleanup(hProcess voidptr)
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-04 16:43:32 +02:00
|
|
|
fn C.MultiByteToWideChar(codePage u32, dwFlags u32, lpMultiMyteStr &char, cbMultiByte int, lpWideCharStr &u16, cchWideChar int) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C.wcslen(str &u16) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-04 16:43:32 +02:00
|
|
|
fn C.WideCharToMultiByte(codePage u32, dwFlags u32, lpWideCharStr &u16, cchWideChar int, lpMultiByteStr &char, cbMultiByte int, lpDefaultChar &char, lpUsedDefaultChar &int) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-19 13:57:25 +02:00
|
|
|
fn C._wstat(path &u16, buffer &C._stat) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C._wrename(oldname &u16, newname &u16) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C._wfopen(filename &u16, mode &u16) voidptr
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C._wpopen(command &u16, mode &u16) voidptr
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C._pclose(stream &C.FILE) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C._wsystem(command &u16) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C._wgetenv(varname &u16) voidptr
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-04 16:43:32 +02:00
|
|
|
fn C._putenv(envstring &char) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C._waccess(path &u16, mode int) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C._wremove(path &u16) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-02-27 11:50:15 +01:00
|
|
|
fn C.ReadConsole(in_input_handle voidptr, out_buffer voidptr, in_chars_to_read u32, out_read_chars &u32, in_input_control voidptr) bool
|
2020-01-09 22:47:13 +01:00
|
|
|
|
|
|
|
fn C.WriteConsole() voidptr
|
|
|
|
|
|
|
|
fn C.WriteFile() voidptr
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C._wchdir(dirname &u16)
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C._wgetcwd(buffer &u16, maxlen int) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2019-11-24 13:16:05 +01:00
|
|
|
fn C._fullpath() int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-02-19 10:20:06 +01:00
|
|
|
fn C.GetFullPathName(voidptr, u32, voidptr, voidptr) u32
|
|
|
|
|
2021-04-04 16:05:06 +02:00
|
|
|
[trusted]
|
2019-11-24 13:16:05 +01:00
|
|
|
fn C.GetCommandLine() voidptr
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2019-11-24 13:16:05 +01:00
|
|
|
fn C.LocalFree()
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C.FindFirstFileW(lpFileName &u16, lpFindFileData voidptr) voidptr
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2022-04-15 13:45:52 +02:00
|
|
|
fn C.FindFirstFile(lpFileName &u8, lpFindFileData voidptr) voidptr
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C.FindNextFile(hFindFile voidptr, lpFindFileData voidptr) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C.FindClose(hFindFile voidptr)
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-03-05 15:41:11 +01:00
|
|
|
// macro
|
|
|
|
fn C.MAKELANGID(lgid voidptr, srtid voidptr) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-08-13 16:03:39 +02:00
|
|
|
fn C.FormatMessage(dwFlags u32, lpSource voidptr, dwMessageId u32, dwLanguageId u32, lpBuffer voidptr, nSize int, arguments ...voidptr) voidptr
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2020-08-06 15:28:19 +02:00
|
|
|
fn C.CloseHandle(voidptr) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C.GetExitCodeProcess(hProcess voidptr, lpExitCode &u32)
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2021-04-04 16:05:06 +02:00
|
|
|
[trusted]
|
2019-11-24 13:31:51 +01:00
|
|
|
fn C.GetTickCount() i64
|
2019-11-25 02:35:41 +01:00
|
|
|
|
2021-04-04 16:05:06 +02:00
|
|
|
[trusted]
|
2021-03-05 15:41:11 +01:00
|
|
|
fn C.Sleep(dwMilliseconds u32)
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2019-11-25 02:35:41 +01:00
|
|
|
fn C.WSAStartup(u16, &voidptr) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2022-01-25 18:31:40 +01:00
|
|
|
[trusted]
|
2019-11-25 02:35:41 +01:00
|
|
|
fn C.WSAGetLastError() int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2019-11-25 02:35:41 +01:00
|
|
|
fn C.closesocket(int) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2019-11-25 02:35:41 +01:00
|
|
|
fn C.vschannel_init(&C.TlsContext)
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2022-04-15 13:45:52 +02:00
|
|
|
fn C.request(&C.TlsContext, int, &u16, &u8, &&u8) int
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2019-11-25 02:35:41 +01:00
|
|
|
fn C.vschannel_cleanup(&C.TlsContext)
|
2019-12-19 21:52:45 +01:00
|
|
|
|
|
|
|
fn C.URLDownloadToFile(int, &u16, &u16, int, int)
|
|
|
|
|
2022-01-25 18:31:40 +01:00
|
|
|
[trusted]
|
2019-11-25 02:35:41 +01:00
|
|
|
fn C.GetLastError() u32
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2022-04-15 13:45:52 +02:00
|
|
|
fn C.CreateDirectory(&u8, int) bool
|
2019-12-19 21:52:45 +01:00
|
|
|
|
2020-06-22 19:23:42 +02:00
|
|
|
// win crypto
|
2019-12-19 21:52:45 +01:00
|
|
|
fn C.BCryptGenRandom(int, voidptr, int, int) int
|
|
|
|
|
2020-06-22 19:23:42 +02:00
|
|
|
// win synchronization
|
2022-04-15 13:45:52 +02:00
|
|
|
fn C.CreateMutex(int, bool, &u8) voidptr
|
2020-11-16 17:32:50 +01:00
|
|
|
|
2019-12-19 21:52:45 +01:00
|
|
|
fn C.WaitForSingleObject(voidptr, int) int
|
2020-11-16 17:32:50 +01:00
|
|
|
|
2019-12-01 08:33:26 +01:00
|
|
|
fn C.ReleaseMutex(voidptr) bool
|
2020-11-16 17:32:50 +01:00
|
|
|
|
2022-04-15 13:45:52 +02:00
|
|
|
fn C.CreateEvent(int, bool, bool, &u8) voidptr
|
2020-11-16 17:32:50 +01:00
|
|
|
|
2020-06-22 19:23:42 +02:00
|
|
|
fn C.SetEvent(voidptr) int
|
2020-05-15 22:23:31 +02:00
|
|
|
|
2020-07-15 10:22:33 +02:00
|
|
|
fn C.CreateSemaphore(voidptr, int, int, voidptr) voidptr
|
2020-11-16 17:32:50 +01:00
|
|
|
|
2020-07-15 10:22:33 +02:00
|
|
|
fn C.ReleaseSemaphore(voidptr, int, voidptr) voidptr
|
|
|
|
|
2020-07-05 22:53:28 +02:00
|
|
|
fn C.InitializeSRWLock(voidptr)
|
2020-11-16 17:32:50 +01:00
|
|
|
|
2020-07-05 22:53:28 +02:00
|
|
|
fn C.AcquireSRWLockShared(voidptr)
|
2020-11-16 17:32:50 +01:00
|
|
|
|
2020-07-05 22:53:28 +02:00
|
|
|
fn C.AcquireSRWLockExclusive(voidptr)
|
2020-11-16 17:32:50 +01:00
|
|
|
|
2020-07-05 22:53:28 +02:00
|
|
|
fn C.ReleaseSRWLockShared(voidptr)
|
2020-11-16 17:32:50 +01:00
|
|
|
|
2020-07-05 22:53:28 +02:00
|
|
|
fn C.ReleaseSRWLockExclusive(voidptr)
|
2020-05-15 22:23:31 +02:00
|
|
|
|
2020-06-22 19:23:42 +02:00
|
|
|
// pthread.h
|
2020-05-15 22:23:31 +02:00
|
|
|
fn C.pthread_mutex_init(voidptr, voidptr) int
|
2021-02-18 08:02:56 +01:00
|
|
|
|
2020-05-15 22:23:31 +02:00
|
|
|
fn C.pthread_mutex_lock(voidptr) int
|
2021-02-18 08:02:56 +01:00
|
|
|
|
2020-05-15 22:23:31 +02:00
|
|
|
fn C.pthread_mutex_unlock(voidptr) int
|
2021-02-18 08:02:56 +01:00
|
|
|
|
2020-08-06 15:28:19 +02:00
|
|
|
fn C.pthread_mutex_destroy(voidptr) int
|
2021-02-18 08:02:56 +01:00
|
|
|
|
2020-07-05 22:53:28 +02:00
|
|
|
fn C.pthread_rwlockattr_init(voidptr) int
|
2021-02-18 08:02:56 +01:00
|
|
|
|
2020-07-05 22:53:28 +02:00
|
|
|
fn C.pthread_rwlockattr_setkind_np(voidptr, int) int
|
2021-02-18 08:02:56 +01:00
|
|
|
|
2020-07-07 01:57:31 +02:00
|
|
|
fn C.pthread_rwlockattr_setpshared(voidptr, int) int
|
2021-02-18 08:02:56 +01:00
|
|
|
|
2020-07-05 22:53:28 +02:00
|
|
|
fn C.pthread_rwlock_init(voidptr, voidptr) int
|
2021-02-18 08:02:56 +01:00
|
|
|
|
2020-07-05 22:53:28 +02:00
|
|
|
fn C.pthread_rwlock_rdlock(voidptr) int
|
2021-02-18 08:02:56 +01:00
|
|
|
|
2020-07-05 22:53:28 +02:00
|
|
|
fn C.pthread_rwlock_wrlock(voidptr) int
|
2021-02-18 08:02:56 +01:00
|
|
|
|
2020-07-05 22:53:28 +02:00
|
|
|
fn C.pthread_rwlock_unlock(voidptr) int
|
|
|
|
|
2020-07-15 10:22:33 +02:00
|
|
|
fn C.pthread_condattr_init(voidptr) int
|
2021-02-18 08:02:56 +01:00
|
|
|
|
2020-07-15 10:22:33 +02:00
|
|
|
fn C.pthread_condattr_setpshared(voidptr, int) int
|
2021-02-18 08:02:56 +01:00
|
|
|
|
2020-08-06 15:28:19 +02:00
|
|
|
fn C.pthread_condattr_destroy(voidptr) int
|
2021-02-18 08:02:56 +01:00
|
|
|
|
2020-07-15 10:22:33 +02:00
|
|
|
fn C.pthread_cond_init(voidptr, voidptr) int
|
2021-02-18 08:02:56 +01:00
|
|
|
|
2020-07-15 10:22:33 +02:00
|
|
|
fn C.pthread_cond_signal(voidptr) int
|
2021-02-18 08:02:56 +01:00
|
|
|
|
2020-07-15 10:22:33 +02:00
|
|
|
fn C.pthread_cond_wait(voidptr, voidptr) int
|
2021-02-18 08:02:56 +01:00
|
|
|
|
2020-07-15 10:22:33 +02:00
|
|
|
fn C.pthread_cond_timedwait(voidptr, voidptr, voidptr) int
|
2021-02-18 08:02:56 +01:00
|
|
|
|
2020-08-06 15:28:19 +02:00
|
|
|
fn C.pthread_cond_destroy(voidptr) int
|
2020-07-15 10:22:33 +02:00
|
|
|
|
|
|
|
fn C.sem_init(voidptr, int, u32) int
|
2021-02-18 08:02:56 +01:00
|
|
|
|
2020-07-15 10:22:33 +02:00
|
|
|
fn C.sem_post(voidptr) int
|
2021-02-18 08:02:56 +01:00
|
|
|
|
2020-07-15 10:22:33 +02:00
|
|
|
fn C.sem_wait(voidptr) int
|
2021-02-18 08:02:56 +01:00
|
|
|
|
2020-07-15 10:22:33 +02:00
|
|
|
fn C.sem_trywait(voidptr) int
|
2021-02-18 08:02:56 +01:00
|
|
|
|
2020-07-15 10:22:33 +02:00
|
|
|
fn C.sem_timedwait(voidptr, voidptr) int
|
2021-02-18 08:02:56 +01:00
|
|
|
|
2020-08-06 15:28:19 +02:00
|
|
|
fn C.sem_destroy(voidptr) int
|
2020-07-15 10:22:33 +02:00
|
|
|
|
2020-08-12 03:45:09 +02:00
|
|
|
// MacOS semaphore functions
|
2022-01-25 18:31:40 +01:00
|
|
|
[trusted]
|
2020-08-12 03:45:09 +02:00
|
|
|
fn C.dispatch_semaphore_create(i64) voidptr
|
2020-11-16 17:32:50 +01:00
|
|
|
|
2020-08-12 03:45:09 +02:00
|
|
|
fn C.dispatch_semaphore_signal(voidptr) i64
|
2020-11-16 17:32:50 +01:00
|
|
|
|
2020-08-12 03:45:09 +02:00
|
|
|
fn C.dispatch_semaphore_wait(voidptr, u64) i64
|
2020-11-16 17:32:50 +01:00
|
|
|
|
2022-01-25 18:31:40 +01:00
|
|
|
[trusted]
|
2020-08-12 03:45:09 +02:00
|
|
|
fn C.dispatch_time(u64, i64) u64
|
2020-11-16 17:32:50 +01:00
|
|
|
|
2020-08-12 03:45:09 +02:00
|
|
|
fn C.dispatch_release(voidptr)
|
|
|
|
|
2020-11-16 17:32:50 +01:00
|
|
|
// file descriptor based reading/writing
|
2021-09-08 12:09:32 +02:00
|
|
|
fn C.read(fd int, buf voidptr, count usize) int
|
2020-11-16 17:32:50 +01:00
|
|
|
|
2021-09-08 12:09:32 +02:00
|
|
|
fn C.write(fd int, buf voidptr, count usize) int
|
2020-11-16 17:32:50 +01:00
|
|
|
|
2020-06-01 21:11:40 +02:00
|
|
|
fn C.close(fd int) int
|
2020-06-11 20:16:12 +02:00
|
|
|
|
2020-11-16 17:32:50 +01:00
|
|
|
// pipes
|
|
|
|
fn C.pipe(pipefds &int) int
|
|
|
|
|
|
|
|
fn C.dup2(oldfd int, newfd int) int
|
|
|
|
|
2020-06-11 20:16:12 +02:00
|
|
|
// used by gl, stbi, freetype
|
|
|
|
fn C.glTexImage2D()
|
2021-04-10 16:40:43 +02:00
|
|
|
|
|
|
|
// used by ios for println
|
2022-04-15 13:45:52 +02:00
|
|
|
fn C.WrappedNSLog(str &u8)
|
2022-04-26 00:34:26 +02:00
|
|
|
|
|
|
|
// absolute value
|
|
|
|
fn C.abs(number int) int
|