v/vlib/builtin/cfns.c.v

453 lines
7.2 KiB
V
Raw Normal View History

2019-10-24 13:51:22 +02:00
module builtin
2019-10-26 10:14:16 +02:00
// <string.h>
2019-10-26 10:43:25 +02:00
fn C.memcpy(byteptr, byteptr, int) voidptr
2019-10-26 10:14:16 +02:00
2020-07-14 00:16:31 +02:00
fn C.memcmp(byteptr, byteptr, int) int
2019-12-19 21:52:45 +01:00
fn C.memmove(byteptr, byteptr, int) voidptr
fn C.calloc(int) byteptr
fn C.malloc(int) byteptr
fn C.realloc(a byteptr, b int) byteptr
fn C.free(ptr voidptr)
fn C.exit(code int)
2019-12-19 21:52:45 +01:00
2020-05-18 21:38:06 +02:00
fn C.qsort(voidptr, int, int, qsort_callback_func)
2019-12-19 21:52:45 +01:00
2020-02-04 09:54:15 +01:00
fn C.sprintf(a ...voidptr) int
2019-12-19 21:52:45 +01:00
2020-07-14 00:16:31 +02:00
fn C.strlen(s charptr) int
2019-10-25 11:07:50 +02:00
fn C.sscanf(byteptr, byteptr,...byteptr) int
2019-12-19 21:52:45 +01:00
fn C.isdigit(s byteptr) bool
// stdio.h
2020-07-14 00:16:31 +02:00
fn C.popen(c charptr, t charptr) voidptr
2020-03-22 14:47:43 +01:00
2019-10-26 00:55:16 +02:00
// <execinfo.h>
fn C.backtrace(a &voidptr, size int) int
fn C.backtrace_symbols(a &voidptr, size int) &charptr
fn C.backtrace_symbols_fd(a &voidptr, size int, fd int)
2019-10-26 00:55:16 +02:00
// <libproc.h>
pub fn proc_pidpath(int, voidptr, int) int
2019-10-26 00:55:16 +02:00
2019-12-19 21:52:45 +01:00
2020-07-14 00:16:31 +02:00
fn C.realpath(charptr, charptr) &char
2019-11-14 23:07:38 +01:00
2019-12-19 21:52:45 +01:00
fn C.chmod(byteptr, int) int
2019-11-24 04:27:02 +01:00
2019-11-25 11:54:07 +01:00
fn C.printf(byteptr, ...byteptr) int
2019-12-19 21:52:45 +01:00
fn C.puts(byteptr) int
2019-12-19 21:52:45 +01:00
2019-11-25 11:54:07 +01:00
fn C.fputs(byteptr) int
2019-12-19 21:52:45 +01:00
2019-11-24 04:27:02 +01:00
fn C.fflush(byteptr) int
// TODO define args in these functions
fn C.fseek() int
2019-12-19 21:52:45 +01:00
2019-12-12 19:03:08 +01:00
fn C.fopen() voidptr
2019-12-19 21:52:45 +01:00
fn C.fileno(voidptr) int
2019-11-24 04:27:02 +01:00
fn C.fwrite() int
2019-12-19 21:52:45 +01:00
2019-11-24 04:27:02 +01:00
fn C.fclose() int
2019-12-19 21:52:45 +01:00
2019-11-24 04:27:02 +01:00
fn C.pclose() int
2019-12-19 21:52:45 +01:00
2019-11-24 04:27:02 +01:00
fn C.system() int
fn C.posix_spawn(&int, charptr, voidptr, voidptr, &charptr, voidptr) int
fn C.waitpid(int, voidptr, int) int
2019-12-19 21:52:45 +01:00
2020-07-14 00:16:31 +02:00
fn C.setenv(charptr) int
2019-12-19 21:52:45 +01:00
2020-07-14 00:16:31 +02:00
fn C.unsetenv(charptr) int
2019-12-19 21:52:45 +01:00
2019-11-24 04:27:02 +01:00
fn C.access() int
2019-12-19 21:52:45 +01:00
2019-11-24 04:27:02 +01:00
fn C.remove() int
2019-12-19 21:52:45 +01:00
2019-11-24 04:27:02 +01:00
fn C.rmdir() int
2019-12-19 21:52:45 +01:00
2019-11-24 04:27:02 +01:00
fn C.chdir() int
2019-12-19 21:52:45 +01:00
2019-11-24 04:27:02 +01:00
fn C.fread() int
2019-12-19 21:52:45 +01:00
2019-11-24 04:27:02 +01:00
fn C.rewind() int
2019-12-19 21:52:45 +01:00
2020-07-14 00:16:31 +02:00
fn C.stat(charptr) int
2019-12-19 21:52:45 +01:00
2019-12-04 21:53:11 +01:00
fn C.lstat() int
2019-12-19 21:52:45 +01:00
2019-11-24 04:27:02 +01:00
fn C.rename() int
2019-12-19 21:52:45 +01:00
2019-11-24 04:27:02 +01:00
fn C.fgets() int
2019-12-19 21:52:45 +01:00
2019-11-24 04:27:02 +01:00
fn C.memset() int
2019-12-19 21:52:45 +01:00
2019-11-24 04:27:02 +01:00
fn C.sigemptyset() int
2019-12-19 21:52:45 +01:00
2019-11-24 04:27:02 +01:00
fn C.getcwd() int
2019-12-19 21:52:45 +01:00
2019-11-24 04:27:02 +01:00
fn C.signal() int
2019-12-19 21:52:45 +01:00
2019-11-24 04:27:02 +01:00
fn C.mktime() int
2019-12-19 21:52:45 +01:00
2019-11-24 04:27:02 +01:00
fn C.gettimeofday() int
2019-12-19 21:52:45 +01:00
2020-08-09 11:22:11 +02:00
[trusted]
fn C.sleep(int) int
2019-12-19 21:52:45 +01:00
2019-11-24 04:27:02 +01:00
fn C.usleep() int
2019-12-19 21:52:45 +01:00
2019-11-24 04:27:02 +01:00
fn C.opendir() voidptr
2019-12-19 21:52:45 +01:00
2019-11-24 04:27:02 +01:00
fn C.closedir() int
2019-12-19 21:52:45 +01:00
2019-11-24 04:27:02 +01:00
fn C.mkdir() int
2019-12-19 21:52:45 +01:00
2019-11-24 04:27:02 +01:00
fn C.srand() int
2019-12-19 21:52:45 +01:00
2019-11-24 04:27:02 +01:00
fn C.atof() int
2019-12-19 21:52:45 +01:00
2019-11-24 04:27:02 +01:00
fn C.tolower() int
2019-12-19 21:52:45 +01:00
2019-11-24 04:27:02 +01:00
fn C.toupper() int
2019-12-19 21:52:45 +01:00
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
2020-08-09 11:22:11 +02:00
[trusted]
fn C.strerror(int) charptr
2019-12-19 21:52:45 +01:00
2019-11-24 04:27:02 +01:00
fn C.snprintf() int
2019-12-19 21:52:45 +01:00
2019-11-24 04:27:02 +01:00
fn C.fprintf(byteptr, ...byteptr)
2019-12-19 21:52:45 +01:00
2019-11-24 04:27:02 +01:00
fn C.WIFEXITED() bool
2019-12-19 21:52:45 +01:00
2019-11-24 04:27:02 +01:00
fn C.WEXITSTATUS() int
2019-12-19 21:52:45 +01:00
2019-11-24 04:27:02 +01:00
fn C.WIFSIGNALED() bool
2019-12-19 21:52:45 +01:00
2019-11-24 04:27:02 +01:00
fn C.WTERMSIG() int
2019-12-19 21:52:45 +01:00
fn C.isatty() int
2019-11-24 04:27:02 +01:00
2019-12-19 21:52:45 +01:00
fn C.syscall() int
2019-11-24 04:27:02 +01:00
2019-11-24 13:16:05 +01:00
2019-12-19 21:52:45 +01:00
fn C.sysctl() int
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
fn C.GetModuleFileName() int
2019-11-16 00:30:50 +01:00
fn C.GetModuleFileNameW(hModule voidptr, lpFilename &u16, nSize u32) u32
2019-12-19 21:52:45 +01:00
fn C.CreateFile() voidptr
fn C.CreateFileW(lpFilename &u16, dwDesiredAccess u32, dwShareMode u32, lpSecurityAttributes &u16, dwCreationDisposition u32, dwFlagsAndAttributes u32, hTemplateFile voidptr) u32
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
fn C.SendMessageTimeout() u32
fn C.SendMessageTimeoutW(hWnd voidptr, Msg u32, wParam &u16, lParam &u32, fuFlags u32, uTimeout u32, lpdwResult &u64) u32
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
fn C.ReadFile(hFile voidptr, lpBuffer voidptr, nNumberOfBytesToRead u32, lpNumberOfBytesRead C.LPDWORD, lpOverlapped voidptr) bool
2019-12-19 21:52:45 +01:00
2019-11-16 00:30:50 +01:00
fn C.GetFileAttributesW(lpFileName byteptr) u32
2019-12-19 21:52:45 +01:00
fn C.RegQueryValueEx() voidptr
2020-05-16 16:12:23 +02:00
fn C.RegQueryValueExW(hKey voidptr, lpValueName &u16, lp_reserved &u32, lpType &u32, lpData byteptr, lpcbData &u32) int
2019-12-19 21:52:45 +01:00
fn C.RegOpenKeyEx() voidptr
2019-11-16 00:30: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
fn C.RegSetValueEx() voidptr
fn C.RegSetValueExW(hKey voidptr, lpValueName &u16, Reserved u32, dwType u32, lpData byteptr, lpcbData u32) int
2019-12-19 21:52:45 +01:00
fn C.RegCloseKey()
2019-12-19 21:52:45 +01:00
2019-11-24 04:27:02 +01:00
fn C.RemoveDirectory() int
2019-12-19 21:52:45 +01:00
//fn C.GetStdHandle() voidptr
fn C.GetStdHandle(u32) voidptr
2019-12-19 21:52:45 +01:00
//fn C.SetConsoleMode()
fn C.SetConsoleMode(voidptr, u32)
2019-12-19 21:52:45 +01:00
//fn C.GetConsoleMode() int
fn C.GetConsoleMode(voidptr, &u32) 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
//fn C.setbuf()
fn C.setbuf(voidptr, charptr)
2019-12-19 21:52:45 +01:00
2019-11-24 13:16:05 +01:00
fn C.SymCleanup()
2019-12-19 21:52:45 +01:00
2019-11-24 13:16:05 +01:00
fn C.MultiByteToWideChar() int
2019-12-19 21:52:45 +01:00
2019-11-24 13:16:05 +01:00
fn C.wcslen() int
2019-12-19 21:52:45 +01:00
fn C.WideCharToMultiByte() int
2019-12-19 21:52:45 +01:00
2019-11-24 13:16:05 +01:00
fn C._wstat()
2019-12-19 21:52:45 +01:00
2019-11-24 13:16:05 +01:00
fn C._wrename()
2019-12-19 21:52:45 +01:00
2019-11-24 13:16:05 +01:00
fn C._wfopen() voidptr
2019-12-19 21:52:45 +01:00
2019-11-24 13:16:05 +01:00
fn C._wpopen() voidptr
2019-12-19 21:52:45 +01:00
2019-11-24 13:16:05 +01:00
fn C._pclose() int
2019-12-19 21:52:45 +01:00
2019-11-24 13:16:05 +01:00
fn C._wsystem() int
2019-12-19 21:52:45 +01:00
2019-11-24 13:16:05 +01:00
fn C._wgetenv() voidptr
2019-12-19 21:52:45 +01:00
2019-11-24 13:16:05 +01:00
fn C._putenv() int
2019-12-19 21:52:45 +01:00
2019-11-24 13:16:05 +01:00
fn C._waccess() int
2019-12-19 21:52:45 +01:00
2020-06-24 14:01:19 +02:00
fn C._wremove() int
2019-12-19 21:52:45 +01:00
fn C.ReadConsole() voidptr
fn C.WriteConsole() voidptr
fn C.WriteFile() voidptr
2019-12-19 21:52:45 +01:00
2019-11-24 13:16:05 +01:00
fn C._wchdir()
2019-12-19 21:52:45 +01:00
2019-11-24 13:16:05 +01:00
fn C._wgetcwd() 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
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
2019-11-24 13:16:05 +01:00
fn C.FindFirstFileW() voidptr
2019-12-19 21:52:45 +01:00
2019-11-24 13:16:05 +01:00
fn C.FindFirstFile() voidptr
2019-12-19 21:52:45 +01:00
2020-03-28 10:19:38 +01:00
fn C.FindNextFile() int
2019-12-19 21:52:45 +01:00
2019-11-24 13:16:05 +01:00
fn C.FindClose()
2019-12-19 21:52:45 +01:00
2019-11-24 13:16:05 +01:00
fn C.MAKELANGID() int
2019-12-19 21:52:45 +01:00
2019-11-24 13:16:05 +01:00
fn C.FormatMessage() 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
2019-11-24 13:21:49 +01:00
fn C.GetExitCodeProcess()
2019-12-19 21:52:45 +01:00
2019-11-24 13:31:51 +01:00
fn C.GetTickCount() i64
2019-11-25 02:35:41 +01:00
2019-12-19 21:52:45 +01:00
2019-11-25 02:35:41 +01:00
fn C.Sleep()
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
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
fn C.request(&C.TlsContext, int, &u16, byteptr, &byteptr)
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)
2019-11-25 02:35:41 +01:00
fn C.GetLastError() u32
2019-12-19 21:52:45 +01:00
2019-11-25 02:35:41 +01:00
fn C.CreateDirectory(byteptr, int) bool
2019-12-19 21:52:45 +01:00
// win crypto
2019-12-19 21:52:45 +01:00
fn C.BCryptGenRandom(int, voidptr, int, int) int
// win synchronization
2019-12-19 21:52:45 +01:00
fn C.CreateMutex(int, bool, byteptr) voidptr
fn C.WaitForSingleObject(voidptr, int) int
2019-12-01 08:33:26 +01:00
fn C.ReleaseMutex(voidptr) bool
fn C.CreateEvent(int, bool, bool, byteptr) voidptr
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
fn C.ReleaseSemaphore(voidptr, int, voidptr) voidptr
fn C.InitializeSRWLock(voidptr)
fn C.AcquireSRWLockShared(voidptr)
fn C.AcquireSRWLockExclusive(voidptr)
fn C.ReleaseSRWLockShared(voidptr)
fn C.ReleaseSRWLockExclusive(voidptr)
2020-05-15 22:23:31 +02:00
// pthread.h
2020-05-15 22:23:31 +02:00
fn C.pthread_mutex_init(voidptr, voidptr) int
fn C.pthread_mutex_lock(voidptr) int
fn C.pthread_mutex_unlock(voidptr) int
2020-08-06 15:28:19 +02:00
fn C.pthread_mutex_destroy(voidptr) int
2020-05-15 22:23:31 +02:00
fn C.pthread_rwlockattr_init(voidptr) int
fn C.pthread_rwlockattr_setkind_np(voidptr, int) int
fn C.pthread_rwlockattr_setpshared(voidptr, int) int
fn C.pthread_rwlock_init(voidptr, voidptr) int
fn C.pthread_rwlock_rdlock(voidptr) int
fn C.pthread_rwlock_wrlock(voidptr) int
fn C.pthread_rwlock_unlock(voidptr) int
2020-07-15 10:22:33 +02:00
fn C.pthread_condattr_init(voidptr) int
fn C.pthread_condattr_setpshared(voidptr, int) int
2020-08-06 15:28:19 +02:00
fn C.pthread_condattr_destroy(voidptr) int
2020-07-15 10:22:33 +02:00
fn C.pthread_cond_init(voidptr, voidptr) int
fn C.pthread_cond_signal(voidptr) int
fn C.pthread_cond_wait(voidptr, voidptr) int
fn C.pthread_cond_timedwait(voidptr, voidptr, voidptr) int
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
fn C.sem_post(voidptr) int
fn C.sem_wait(voidptr) int
fn C.sem_trywait(voidptr) int
fn C.sem_timedwait(voidptr, voidptr) int
2020-08-06 15:28:19 +02:00
fn C.sem_destroy(voidptr) int
2020-07-15 10:22:33 +02:00
// MacOS semaphore functions
fn C.dispatch_semaphore_create(i64) voidptr
fn C.dispatch_semaphore_signal(voidptr) i64
fn C.dispatch_semaphore_wait(voidptr, u64) i64
fn C.dispatch_time(u64, i64) u64
fn C.dispatch_release(voidptr)
2020-06-01 21:11:40 +02:00
fn C.read(fd int, buf voidptr, count size_t) int
fn C.write(fd int, buf voidptr, count size_t) int
fn C.close(fd int) int
// used by gl, stbi, freetype
fn C.glTexImage2D()