From e01f723be423796639598cf34b1ee3e01a7925c5 Mon Sep 17 00:00:00 2001 From: hl-valdemar Date: Thu, 16 Jul 2026 23:14:42 +0200 Subject: [PATCH] file io --- ffi/c/errno.hon | 120 +++++ ffi/c/fcntl.hon | 393 ++++++++++++++++ ffi/c/posix.hon | 3 - ffi/c/stdio.hon | 5 +- ffi/c/stdlib.hon | 1092 ++++++++++++++++++++++++++++++++++++++++++- ffi/c/unistd.hon | 661 ++++++++++++++++++++++++++ std/debug/debug.hon | 32 +- std/io/file.hon | 144 ++++++ std/io/io.hon | 212 ++++----- std/mem/mem.hon | 14 +- 10 files changed, 2532 insertions(+), 144 deletions(-) create mode 100644 ffi/c/errno.hon create mode 100644 ffi/c/fcntl.hon delete mode 100644 ffi/c/posix.hon create mode 100644 ffi/c/unistd.hon create mode 100644 std/io/file.hon diff --git a/ffi/c/errno.hon b/ffi/c/errno.hon new file mode 100644 index 0000000..17c2484 --- /dev/null +++ b/ffi/c/errno.hon @@ -0,0 +1,120 @@ +# generated by brolang translate-c from errno.h + +errno_t :: alias c_int + +EPERM c_int :: 1 +ENOENT c_int :: 2 +ESRCH c_int :: 3 +EINTR c_int :: 4 +EIO c_int :: 5 +ENXIO c_int :: 6 +E2BIG c_int :: 7 +ENOEXEC c_int :: 8 +EBADF c_int :: 9 +ECHILD c_int :: 10 +EDEADLK c_int :: 11 +ENOMEM c_int :: 12 +EACCES c_int :: 13 +EFAULT c_int :: 14 +ENOTBLK c_int :: 15 +EBUSY c_int :: 16 +EEXIST c_int :: 17 +EXDEV c_int :: 18 +ENODEV c_int :: 19 +ENOTDIR c_int :: 20 +EISDIR c_int :: 21 +EINVAL c_int :: 22 +ENFILE c_int :: 23 +EMFILE c_int :: 24 +ENOTTY c_int :: 25 +ETXTBSY c_int :: 26 +EFBIG c_int :: 27 +ENOSPC c_int :: 28 +ESPIPE c_int :: 29 +EROFS c_int :: 30 +EMLINK c_int :: 31 +EPIPE c_int :: 32 +EDOM c_int :: 33 +ERANGE c_int :: 34 +EAGAIN c_int :: 35 +EINPROGRESS c_int :: 36 +EALREADY c_int :: 37 +ENOTSOCK c_int :: 38 +EDESTADDRREQ c_int :: 39 +EMSGSIZE c_int :: 40 +EPROTOTYPE c_int :: 41 +ENOPROTOOPT c_int :: 42 +EPROTONOSUPPORT c_int :: 43 +ESOCKTNOSUPPORT c_int :: 44 +ENOTSUP c_int :: 45 +EPFNOSUPPORT c_int :: 46 +EAFNOSUPPORT c_int :: 47 +EADDRINUSE c_int :: 48 +EADDRNOTAVAIL c_int :: 49 +ENETDOWN c_int :: 50 +ENETUNREACH c_int :: 51 +ENETRESET c_int :: 52 +ECONNABORTED c_int :: 53 +ECONNRESET c_int :: 54 +ENOBUFS c_int :: 55 +EISCONN c_int :: 56 +ENOTCONN c_int :: 57 +ESHUTDOWN c_int :: 58 +ETOOMANYREFS c_int :: 59 +ETIMEDOUT c_int :: 60 +ECONNREFUSED c_int :: 61 +ELOOP c_int :: 62 +ENAMETOOLONG c_int :: 63 +EHOSTDOWN c_int :: 64 +EHOSTUNREACH c_int :: 65 +ENOTEMPTY c_int :: 66 +EPROCLIM c_int :: 67 +EUSERS c_int :: 68 +EDQUOT c_int :: 69 +ESTALE c_int :: 70 +EREMOTE c_int :: 71 +EBADRPC c_int :: 72 +ERPCMISMATCH c_int :: 73 +EPROGUNAVAIL c_int :: 74 +EPROGMISMATCH c_int :: 75 +EPROCUNAVAIL c_int :: 76 +ENOLCK c_int :: 77 +ENOSYS c_int :: 78 +EFTYPE c_int :: 79 +EAUTH c_int :: 80 +ENEEDAUTH c_int :: 81 +EPWROFF c_int :: 82 +EDEVERR c_int :: 83 +EOVERFLOW c_int :: 84 +EBADEXEC c_int :: 85 +EBADARCH c_int :: 86 +ESHLIBVERS c_int :: 87 +EBADMACHO c_int :: 88 +ECANCELED c_int :: 89 +EIDRM c_int :: 90 +ENOMSG c_int :: 91 +EILSEQ c_int :: 92 +ENOATTR c_int :: 93 +EBADMSG c_int :: 94 +EMULTIHOP c_int :: 95 +ENODATA c_int :: 96 +ENOLINK c_int :: 97 +ENOSR c_int :: 98 +ENOSTR c_int :: 99 +EPROTO c_int :: 100 +ETIME c_int :: 101 +EOPNOTSUPP c_int :: 102 +ENOPOLICY c_int :: 103 +ENOTRECOVERABLE c_int :: 104 +EOWNERDEAD c_int :: 105 +EQFULL c_int :: 106 +ENOTCAPABLE c_int :: 107 +ELAST c_int :: 107 + +__error c_func() ?*mut c_int + +# unsupported in bindings: _SYS_ERRNO_H_ — C macro has no replacement value +# unsupported in bindings: _CDEFS_H_ — C macro has no replacement value +# unsupported in bindings: _ERRNO_T — C macro has no replacement value +# unsupported in bindings: errno — C macro is not a supported constant +# unsupported in bindings: EWOULDBLOCK — C macro is not a supported constant diff --git a/ffi/c/fcntl.hon b/ffi/c/fcntl.hon new file mode 100644 index 0000000..b53ec39 --- /dev/null +++ b/ffi/c/fcntl.hon @@ -0,0 +1,393 @@ +# generated by brolang translate-c from fcntl.h + +# unsupported in bindings: C union '__mbstate_t' has no native spelling +__c_fcntl_bro_flock_record :: c_struct { + l_start c_longlong + l_len c_longlong + l_pid c_int + l_type c_short + l_whence c_short +} +flocktimeout :: c_struct { + fl __c_fcntl_bro_flock_record + timeout timespec +} +radvisory :: c_struct { + ra_offset c_longlong + ra_count c_int +} +fsignatures :: c_struct { + fs_file_start c_longlong + fs_blob_start ?*mut anyopaque + fs_blob_size c_ulong + fs_fsignatures_size c_ulong + fs_cdhash [20]c_char + fs_hash_type c_int +} +fsupplement :: c_struct { + fs_file_start c_longlong + fs_blob_start c_longlong + fs_blob_size c_ulong + fs_orig_fd c_int +} +fchecklv :: c_struct { + lv_file_start c_longlong + lv_error_message_size c_ulong + lv_error_message ?*mut anyopaque +} +fgetsigsinfo :: c_struct { + fg_file_start c_longlong + fg_info_request c_int + fg_sig_is_platform c_int +} +fstore :: c_struct { + fst_flags c_uint + fst_posmode c_int + fst_offset c_longlong + fst_length c_longlong + fst_bytesalloc c_longlong +} +fpunchhole :: c_struct { + fp_flags c_uint + reserved c_uint + fp_offset c_longlong + fp_length c_longlong +} +ftrimactivefile :: c_struct { + fta_offset c_longlong + fta_length c_longlong +} +fspecread :: c_struct { + fsr_flags c_uint + reserved c_uint + fsr_offset c_longlong + fsr_length c_longlong +} +fattributiontag :: c_struct { + ft_flags c_uint + ft_hash c_ulonglong + ft_attribution_name [255]c_char +} +log2phys :: c_struct { + l2p_flags c_uint + l2p_contigbytes c_longlong + l2p_devoffset c_longlong +} +_filesec :: opaque + +# unsupported in bindings: typedef '__mbstate_t' — underlying type has no native spelling +# unsupported in bindings: typedef '__darwin_mbstate_t' — underlying type has no native spelling +fsignatures_t :: alias fsignatures +fsupplement_t :: alias fsupplement +fchecklv_t :: alias fchecklv +fgetsigsinfo_t :: alias fgetsigsinfo +fstore_t :: alias fstore +fpunchhole_t :: alias fpunchhole +ftrimactivefile_t :: alias ftrimactivefile +fspecread_t :: alias fspecread +fattributiontag_t :: alias fattributiontag +# unsupported in bindings: typedef '_filesec' — underlying type has no native spelling +filesec_t :: alias ?*mut _filesec +filesec_property_t :: alias c_uint + +O_RDONLY c_int :: 0 +O_WRONLY c_int :: 1 +O_RDWR c_int :: 2 +O_ACCMODE c_int :: 3 +FREAD c_int :: 1 +FWRITE c_int :: 2 +O_NONBLOCK c_int :: 4 +O_APPEND c_int :: 8 +O_SYNC c_int :: 128 +O_SHLOCK c_int :: 16 +O_EXLOCK c_int :: 32 +O_ASYNC c_int :: 64 +O_NOFOLLOW c_int :: 256 +O_CREAT c_int :: 512 +O_TRUNC c_int :: 1024 +O_EXCL c_int :: 2048 +O_RESOLVE_BENEATH c_int :: 4096 +O_UNIQUE c_int :: 8192 +O_EVTONLY c_int :: 32768 +O_NOCTTY c_int :: 131072 +O_DIRECTORY c_int :: 1048576 +O_SYMLINK c_int :: 2097152 +O_DSYNC c_int :: 4194304 +O_CLOEXEC c_int :: 16777216 +O_NOFOLLOW_ANY c_int :: 536870912 +O_EXEC c_int :: 1073741824 +AT_FDCWD c_int :: -2 +AT_EACCESS c_int :: 16 +AT_SYMLINK_NOFOLLOW c_int :: 32 +AT_SYMLINK_FOLLOW c_int :: 64 +AT_REMOVEDIR c_int :: 128 +AT_REALDEV c_int :: 512 +AT_FDONLY c_int :: 1024 +AT_SYMLINK_NOFOLLOW_ANY c_int :: 2048 +AT_RESOLVE_BENEATH c_int :: 8192 +AT_NODELETEBUSY c_int :: 16384 +AT_UNIQUE c_int :: 32768 +O_DP_GETRAWENCRYPTED c_int :: 1 +O_DP_GETRAWUNENCRYPTED c_int :: 2 +O_DP_AUTHENTICATE c_int :: 4 +AUTH_OPEN_NOAUTHFD c_int :: -1 +CPF_OVERWRITE c_int :: 1 +CPF_IGNORE_MODE c_int :: 2 +F_DUPFD c_int :: 0 +F_GETFD c_int :: 1 +F_SETFD c_int :: 2 +F_GETFL c_int :: 3 +F_SETFL c_int :: 4 +F_GETOWN c_int :: 5 +F_SETOWN c_int :: 6 +F_GETLK c_int :: 7 +F_SETLK c_int :: 8 +F_SETLKW c_int :: 9 +F_SETLKWTIMEOUT c_int :: 10 +F_FLUSH_DATA c_int :: 40 +F_CHKCLEAN c_int :: 41 +F_PREALLOCATE c_int :: 42 +F_SETSIZE c_int :: 43 +F_RDADVISE c_int :: 44 +F_RDAHEAD c_int :: 45 +F_NOCACHE c_int :: 48 +F_LOG2PHYS c_int :: 49 +F_GETPATH c_int :: 50 +F_FULLFSYNC c_int :: 51 +F_PATHPKG_CHECK c_int :: 52 +F_FREEZE_FS c_int :: 53 +F_THAW_FS c_int :: 54 +F_GLOBAL_NOCACHE c_int :: 55 +F_ADDSIGS c_int :: 59 +F_ADDFILESIGS c_int :: 61 +F_NODIRECT c_int :: 62 +F_GETPROTECTIONCLASS c_int :: 63 +F_SETPROTECTIONCLASS c_int :: 64 +F_LOG2PHYS_EXT c_int :: 65 +F_GETLKPID c_int :: 66 +F_SETBACKINGSTORE c_int :: 70 +F_GETPATH_MTMINFO c_int :: 71 +F_GETCODEDIR c_int :: 72 +F_SETNOSIGPIPE c_int :: 73 +F_GETNOSIGPIPE c_int :: 74 +F_TRANSCODEKEY c_int :: 75 +F_SINGLE_WRITER c_int :: 76 +F_GETPROTECTIONLEVEL c_int :: 77 +F_FINDSIGS c_int :: 78 +F_ADDFILESIGS_FOR_DYLD_SIM c_int :: 83 +F_BARRIERFSYNC c_int :: 85 +F_OFD_SETLK c_int :: 90 +F_OFD_SETLKW c_int :: 91 +F_OFD_GETLK c_int :: 92 +F_OFD_SETLKWTIMEOUT c_int :: 93 +F_ADDFILESIGS_RETURN c_int :: 97 +F_CHECK_LV c_int :: 98 +F_PUNCHHOLE c_int :: 99 +F_TRIM_ACTIVE_FILE c_int :: 100 +F_SPECULATIVE_READ c_int :: 101 +F_GETPATH_NOFIRMLINK c_int :: 102 +F_ADDFILESIGS_INFO c_int :: 103 +F_ADDFILESUPPL c_int :: 104 +F_GETSIGSINFO c_int :: 105 +F_SETLEASE c_int :: 106 +F_GETLEASE c_int :: 107 +F_TRANSFEREXTENTS c_int :: 110 +F_ATTRIBUTION_TAG c_int :: 111 +F_NOCACHE_EXT c_int :: 112 +F_ADDSIGS_MAIN_BINARY c_int :: 113 +FCNTL_FS_SPECIFIC_BASE c_int :: 65536 +F_DUPFD_CLOEXEC c_int :: 67 +FD_CLOEXEC c_int :: 1 +F_RDLCK c_int :: 1 +F_UNLCK c_int :: 2 +F_WRLCK c_int :: 3 +S_IFMT c_int :: 61440 +S_IFIFO c_int :: 4096 +S_IFCHR c_int :: 8192 +S_IFDIR c_int :: 16384 +S_IFBLK c_int :: 24576 +S_IFREG c_int :: 32768 +S_IFLNK c_int :: 40960 +S_IFSOCK c_int :: 49152 +S_IFWHT c_int :: 57344 +S_IRWXU c_int :: 448 +S_IRUSR c_int :: 256 +S_IWUSR c_int :: 128 +S_IXUSR c_int :: 64 +S_IRWXG c_int :: 56 +S_IRGRP c_int :: 32 +S_IWGRP c_int :: 16 +S_IXGRP c_int :: 8 +S_IRWXO c_int :: 7 +S_IROTH c_int :: 4 +S_IWOTH c_int :: 2 +S_IXOTH c_int :: 1 +S_ISUID c_int :: 2048 +S_ISGID c_int :: 1024 +S_ISVTX c_int :: 512 +F_ALLOCATECONTIG c_int :: 2 +F_ALLOCATEALL c_int :: 4 +F_ALLOCATEPERSIST c_int :: 8 +F_PEOFPOSMODE c_int :: 3 +F_VOLPOSMODE c_int :: 4 +USER_FSIGNATURES_CDHASH_LEN c_int :: 20 +GETSIGSINFO_PLATFORM_BINARY c_int :: 1 +LOCK_SH c_int :: 1 +LOCK_EX c_int :: 2 +LOCK_NB c_int :: 4 +LOCK_UN c_int :: 8 +ATTRIBUTION_NAME_MAX c_int :: 255 +F_CREATE_TAG c_int :: 1 +F_DELETE_TAG c_int :: 2 +F_QUERY_TAG c_int :: 4 +O_POPUP c_uint :: 2147483648 +O_ALERT c_int :: 536870912 +FILESEC_OWNER c_uint :: 1 +FILESEC_GROUP c_uint :: 2 +FILESEC_UUID c_uint :: 3 +FILESEC_MODE c_uint :: 4 +FILESEC_ACL c_uint :: 5 +FILESEC_GRPUUID c_uint :: 6 +FILESEC_ACL_RAW c_uint :: 100 +FILESEC_ACL_ALLOCSIZE c_uint :: 101 + +open c_func(_ ?*c_char, _ c_int, ...) c_int +openat c_func(_ c_int, _ ?*c_char, _ c_int, ...) c_int +creat c_func(_ ?*c_char, _ c_ushort) c_int +fcntl c_func(_ c_int, _ c_int, ...) c_int +openx_np c_func(_ ?*c_char, _ c_int, _ ?*mut _filesec) c_int +open_dprotected_np c_func(_ ?*c_char, _ c_int, _ c_int, _ c_int, ...) c_int +openat_dprotected_np c_func(_ c_int, _ ?*c_char, _ c_int, _ c_int, _ c_int, ...) c_int +openat_authenticated_np c_func(_ c_int, _ ?*c_char, _ c_int, _ c_int) c_int +flock c_func(_ c_int, _ c_int) c_int +filesec_init c_func() ?*mut _filesec +filesec_dup c_func(_ ?*mut _filesec) ?*mut _filesec +filesec_free c_func(_ ?*mut _filesec) void +filesec_get_property c_func(_ ?*mut _filesec, _ c_uint, _ ?*mut anyopaque) c_int +filesec_query_property c_func(_ ?*mut _filesec, _ c_uint, _ ?*mut c_int) c_int +filesec_set_property c_func(_ ?*mut _filesec, _ c_uint, _ ?*anyopaque) c_int +filesec_unset_property c_func(_ ?*mut _filesec, _ c_uint) c_int + +# unsupported in bindings: _SYS_FCNTL_H_ — C macro has no replacement value +# unsupported in bindings: _SYS__TYPES_H_ — C macro has no replacement value +# unsupported in bindings: _CDEFS_H_ — C macro has no replacement value +# unsupported in bindings: _BSD_MACHINE__TYPES_H_ — C macro has no replacement value +# unsupported in bindings: _BSD_ARM__TYPES_H_ — C macro has no replacement value +# unsupported in bindings: _SYS__PTHREAD_TYPES_H_ — C macro has no replacement value +# unsupported in bindings: MAC_OS_X_VERSION_10_0 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_1 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_2 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_3 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_4 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_5 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_6 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_7 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_8 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_9 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_10 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_10_2 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_10_3 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_11 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_11_2 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_11_3 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_11_4 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_12 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_12_1 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_12_2 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_12_4 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_13 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_13_1 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_13_2 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_13_4 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_14 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_14_1 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_14_4 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_14_5 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_14_6 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_15 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_15_1 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_15_4 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_16 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_11_0 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_11_1 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_11_3 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_11_4 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_11_5 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_11_6 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_12_0 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_12_1 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_12_2 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_12_3 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_12_4 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_12_5 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_12_6 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_12_7 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_13_0 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_13_1 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_13_2 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_13_3 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_13_4 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_13_5 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_13_6 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_13_7 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_14_0 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_14_1 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_14_2 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_14_3 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_14_4 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_14_5 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_14_6 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_14_7 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_15_0 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_15_1 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_15_2 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_15_3 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_15_4 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_15_5 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_15_6 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_16_0 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_26_0 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_26_1 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_26_2 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_26_3 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_26_4 — C macro is not a supported constant +# unsupported in bindings: _SIZE_T — C macro has no replacement value +# unsupported in bindings: _MODE_T — C macro has no replacement value +# unsupported in bindings: _OFF_T — C macro has no replacement value +# unsupported in bindings: _PID_T — C macro has no replacement value +# unsupported in bindings: O_FSYNC — C macro is not a supported constant +# unsupported in bindings: O_SEARCH — C macro is not a supported constant +# unsupported in bindings: FAPPEND — C macro is not a supported constant +# unsupported in bindings: FASYNC — C macro is not a supported constant +# unsupported in bindings: FFSYNC — C macro is not a supported constant +# unsupported in bindings: FFDSYNC — C macro is not a supported constant +# unsupported in bindings: FNONBLOCK — C macro is not a supported constant +# unsupported in bindings: FNDELAY — C macro is not a supported constant +# unsupported in bindings: O_NDELAY — C macro is not a supported constant +# unsupported in bindings: CPF_MASK — C macro is not a supported constant +# unsupported in bindings: F_SETLEASE_ARG — C function-like macros are not supported +# unsupported in bindings: _SEEK_SET_H_ — C macro has no replacement value +# unsupported in bindings: S_ISTXT — C macro is not a supported constant +# unsupported in bindings: S_IREAD — C macro is not a supported constant +# unsupported in bindings: S_IWRITE — C macro is not a supported constant +# unsupported in bindings: S_IEXEC — C macro is not a supported constant +# unsupported in bindings: _STRUCT_TIMESPEC — C macro is not a supported constant +# unsupported in bindings: _BSD_MACHINE_TYPES_H_ — C macro has no replacement value +# unsupported in bindings: _ARM_MACHTYPES_H_ — C macro has no replacement value +# unsupported in bindings: _MACHTYPES_H_ — C macro has no replacement value +# unsupported in bindings: _INT8_T — C macro has no replacement value +# unsupported in bindings: _INT16_T — C macro has no replacement value +# unsupported in bindings: _INT32_T — C macro has no replacement value +# unsupported in bindings: _INT64_T — C macro has no replacement value +# unsupported in bindings: _U_INT8_T — C macro has no replacement value +# unsupported in bindings: _U_INT16_T — C macro has no replacement value +# unsupported in bindings: _U_INT32_T — C macro has no replacement value +# unsupported in bindings: _U_INT64_T — C macro has no replacement value +# unsupported in bindings: _INTPTR_T — C macro has no replacement value +# unsupported in bindings: _UINTPTR_T — C macro has no replacement value +# unsupported in bindings: USER_ADDR_NULL — C macro is not a supported constant +# unsupported in bindings: CAST_USER_ADDR_T — C function-like macros are not supported +# unsupported in bindings: _FILESEC_T — C macro has no replacement value +# unsupported in bindings: FILESEC_GUID — C macro is not a supported constant +# unsupported in bindings: _FILESEC_UNSET_PROPERTY — C macro is not a supported constant +# unsupported in bindings: _FILESEC_REMOVE_ACL — C macro is not a supported constant diff --git a/ffi/c/posix.hon b/ffi/c/posix.hon deleted file mode 100644 index 7b4a190..0000000 --- a/ffi/c/posix.hon +++ /dev/null @@ -1,3 +0,0 @@ -read c_func(_ c_int, _ ?*mut anyopaque, _ c_ulong) c_long -write c_func(_ c_int, _ ?*anyopaque, _ c_ulong) c_long -__error c_func() *mut c_int diff --git a/ffi/c/stdio.hon b/ffi/c/stdio.hon index 3f64bc9..bfb5081 100644 --- a/ffi/c/stdio.hon +++ b/ffi/c/stdio.hon @@ -1,6 +1,7 @@ # generated by brolang translate-c from stdio.h # unsupported in bindings: C union '__mbstate_t' has no native spelling +__mbstate_t :: opaque __darwin_pthread_handler_rec :: c_struct { __routine ?*c_func(_ ?*mut anyopaque) void __arg ?*mut anyopaque @@ -82,7 +83,8 @@ __uint64_t :: alias c_ulonglong __darwin_intptr_t :: alias c_long __darwin_natural_t :: alias c_uint __darwin_ct_rune_t :: alias c_int -__darwin_mbstate_t :: alias __mbstate_t +# unsupported in bindings: typedef '__mbstate_t' — underlying type has no native spelling +# unsupported in bindings: typedef '__darwin_mbstate_t' — underlying type has no native spelling __darwin_ptrdiff_t :: alias c_long __darwin_size_t :: alias c_ulong __darwin_va_list :: alias ?*mut c_char @@ -148,6 +150,7 @@ syscall_arg_t :: alias c_ulonglong va_list :: alias ?*mut c_char size_t :: alias c_ulong fpos_t :: alias c_longlong +# unsupported in bindings: typedef '__sFILEX' — underlying type has no native spelling FILE :: alias __sFILE off_t :: alias c_longlong ssize_t :: alias c_long diff --git a/ffi/c/stdlib.hon b/ffi/c/stdlib.hon index c2a0b3b..4840145 100644 --- a/ffi/c/stdlib.hon +++ b/ffi/c/stdlib.hon @@ -1,4 +1,1094 @@ +# generated by brolang translate-c from stdlib.h + +# unsupported in bindings: C union '__mbstate_t' has no native spelling +__darwin_arm_exception_state :: c_struct { + __exception c_uint + __fsr c_uint + __far c_uint +} +__darwin_arm_exception_state64 :: c_struct { + __far c_ulonglong + __esr c_uint + __exception c_uint +} +__darwin_arm_exception_state64_v2 :: c_struct { + __far c_ulonglong + __esr c_ulonglong +} +__darwin_arm_thread_state :: c_struct { + __r [13]c_uint + __sp c_uint + __lr c_uint + __pc c_uint + __cpsr c_uint +} +__darwin_arm_thread_state64 :: c_struct { + __x [29]c_ulonglong + __fp c_ulonglong + __lr c_ulonglong + __sp c_ulonglong + __pc c_ulonglong + __cpsr c_uint + __pad c_uint +} +__darwin_arm_vfp_state :: c_struct { + __r [64]c_uint + __fpscr c_uint +} +__darwin_arm_neon_state64 :: opaque +__darwin_arm_neon_state :: opaque +__arm_pagein_state :: c_struct { + __pagein_error c_int +} +__darwin_arm_sme_state :: c_struct { + __svcr c_ulonglong + __tpidr2_el0 c_ulonglong + __svl_b c_ushort +} +__darwin_arm_sve_z_state :: c_struct { + __z [16][256]c_char +} +__darwin_arm_sve_p_state :: c_struct { + __p [16][32]c_char +} +__darwin_arm_sme_za_state :: c_struct { + __za [4096]c_char +} +__darwin_arm_sme2_state :: c_struct { + __zt0 [64]c_char +} +__arm_legacy_debug_state :: c_struct { + __bvr [16]c_uint + __bcr [16]c_uint + __wvr [16]c_uint + __wcr [16]c_uint +} +__darwin_arm_debug_state32 :: c_struct { + __bvr [16]c_uint + __bcr [16]c_uint + __wvr [16]c_uint + __wcr [16]c_uint + __mdscr_el1 c_ulonglong +} +__darwin_arm_debug_state64 :: c_struct { + __bvr [16]c_ulonglong + __bcr [16]c_ulonglong + __wvr [16]c_ulonglong + __wcr [16]c_ulonglong + __mdscr_el1 c_ulonglong +} +__darwin_arm_cpmu_state64 :: c_struct { + __ctrs [16]c_ulonglong +} +__darwin_mcontext32 :: c_struct { + __es __darwin_arm_exception_state + __ss __darwin_arm_thread_state + __fs __darwin_arm_vfp_state +} +# unsupported in bindings: C record '__darwin_mcontext64' contains an unsupported field type +__darwin_mcontext64 :: opaque +__darwin_sigaltstack :: c_struct { + ss_sp ?*mut anyopaque + ss_size c_ulong + ss_flags c_int +} +__darwin_ucontext :: c_struct { + uc_onstack c_int + uc_sigmask c_uint + uc_stack __darwin_sigaltstack + uc_link ?*mut __darwin_ucontext + uc_mcsize c_ulong + uc_mcontext ?*mut __darwin_mcontext64 +} +# unsupported in bindings: C union 'sigval' has no native spelling +sigval :: opaque +# unsupported in bindings: C record 'sigevent' contains an unsupported field type +sigevent :: opaque +# unsupported in bindings: C record '__siginfo' contains an unsupported field type +__siginfo :: opaque +# unsupported in bindings: C union '__sigaction_u' has no native spelling +__sigaction_u :: opaque +# unsupported in bindings: C record '__sigaction' contains an unsupported field type +__sigaction :: opaque +# unsupported in bindings: C record 'sigaction' contains an unsupported field type +sigaction :: opaque +sigvec :: c_struct { + sv_handler ?*c_func(_ c_int) void + sv_mask c_int + sv_flags c_int +} +sigstack :: c_struct { + ss_sp ?*mut c_char + ss_onstack c_int +} +timeval :: c_struct { + tv_sec c_long + tv_usec c_int +} +rusage :: c_struct { + ru_utime timeval + ru_stime timeval + ru_maxrss c_long + ru_ixrss c_long + ru_idrss c_long + ru_isrss c_long + ru_minflt c_long + ru_majflt c_long + ru_nswap c_long + ru_inblock c_long + ru_oublock c_long + ru_msgsnd c_long + ru_msgrcv c_long + ru_nsignals c_long + ru_nvcsw c_long + ru_nivcsw c_long +} +rusage_info_v0 :: c_struct { + ri_uuid [16]c_uchar + ri_user_time c_ulonglong + ri_system_time c_ulonglong + ri_pkg_idle_wkups c_ulonglong + ri_interrupt_wkups c_ulonglong + ri_pageins c_ulonglong + ri_wired_size c_ulonglong + ri_resident_size c_ulonglong + ri_phys_footprint c_ulonglong + ri_proc_start_abstime c_ulonglong + ri_proc_exit_abstime c_ulonglong +} +rusage_info_v1 :: c_struct { + ri_uuid [16]c_uchar + ri_user_time c_ulonglong + ri_system_time c_ulonglong + ri_pkg_idle_wkups c_ulonglong + ri_interrupt_wkups c_ulonglong + ri_pageins c_ulonglong + ri_wired_size c_ulonglong + ri_resident_size c_ulonglong + ri_phys_footprint c_ulonglong + ri_proc_start_abstime c_ulonglong + ri_proc_exit_abstime c_ulonglong + ri_child_user_time c_ulonglong + ri_child_system_time c_ulonglong + ri_child_pkg_idle_wkups c_ulonglong + ri_child_interrupt_wkups c_ulonglong + ri_child_pageins c_ulonglong + ri_child_elapsed_abstime c_ulonglong +} +rusage_info_v2 :: c_struct { + ri_uuid [16]c_uchar + ri_user_time c_ulonglong + ri_system_time c_ulonglong + ri_pkg_idle_wkups c_ulonglong + ri_interrupt_wkups c_ulonglong + ri_pageins c_ulonglong + ri_wired_size c_ulonglong + ri_resident_size c_ulonglong + ri_phys_footprint c_ulonglong + ri_proc_start_abstime c_ulonglong + ri_proc_exit_abstime c_ulonglong + ri_child_user_time c_ulonglong + ri_child_system_time c_ulonglong + ri_child_pkg_idle_wkups c_ulonglong + ri_child_interrupt_wkups c_ulonglong + ri_child_pageins c_ulonglong + ri_child_elapsed_abstime c_ulonglong + ri_diskio_bytesread c_ulonglong + ri_diskio_byteswritten c_ulonglong +} +rusage_info_v3 :: c_struct { + ri_uuid [16]c_uchar + ri_user_time c_ulonglong + ri_system_time c_ulonglong + ri_pkg_idle_wkups c_ulonglong + ri_interrupt_wkups c_ulonglong + ri_pageins c_ulonglong + ri_wired_size c_ulonglong + ri_resident_size c_ulonglong + ri_phys_footprint c_ulonglong + ri_proc_start_abstime c_ulonglong + ri_proc_exit_abstime c_ulonglong + ri_child_user_time c_ulonglong + ri_child_system_time c_ulonglong + ri_child_pkg_idle_wkups c_ulonglong + ri_child_interrupt_wkups c_ulonglong + ri_child_pageins c_ulonglong + ri_child_elapsed_abstime c_ulonglong + ri_diskio_bytesread c_ulonglong + ri_diskio_byteswritten c_ulonglong + ri_cpu_time_qos_default c_ulonglong + ri_cpu_time_qos_maintenance c_ulonglong + ri_cpu_time_qos_background c_ulonglong + ri_cpu_time_qos_utility c_ulonglong + ri_cpu_time_qos_legacy c_ulonglong + ri_cpu_time_qos_user_initiated c_ulonglong + ri_cpu_time_qos_user_interactive c_ulonglong + ri_billed_system_time c_ulonglong + ri_serviced_system_time c_ulonglong +} +rusage_info_v4 :: c_struct { + ri_uuid [16]c_uchar + ri_user_time c_ulonglong + ri_system_time c_ulonglong + ri_pkg_idle_wkups c_ulonglong + ri_interrupt_wkups c_ulonglong + ri_pageins c_ulonglong + ri_wired_size c_ulonglong + ri_resident_size c_ulonglong + ri_phys_footprint c_ulonglong + ri_proc_start_abstime c_ulonglong + ri_proc_exit_abstime c_ulonglong + ri_child_user_time c_ulonglong + ri_child_system_time c_ulonglong + ri_child_pkg_idle_wkups c_ulonglong + ri_child_interrupt_wkups c_ulonglong + ri_child_pageins c_ulonglong + ri_child_elapsed_abstime c_ulonglong + ri_diskio_bytesread c_ulonglong + ri_diskio_byteswritten c_ulonglong + ri_cpu_time_qos_default c_ulonglong + ri_cpu_time_qos_maintenance c_ulonglong + ri_cpu_time_qos_background c_ulonglong + ri_cpu_time_qos_utility c_ulonglong + ri_cpu_time_qos_legacy c_ulonglong + ri_cpu_time_qos_user_initiated c_ulonglong + ri_cpu_time_qos_user_interactive c_ulonglong + ri_billed_system_time c_ulonglong + ri_serviced_system_time c_ulonglong + ri_logical_writes c_ulonglong + ri_lifetime_max_phys_footprint c_ulonglong + ri_instructions c_ulonglong + ri_cycles c_ulonglong + ri_billed_energy c_ulonglong + ri_serviced_energy c_ulonglong + ri_interval_max_phys_footprint c_ulonglong + ri_runnable_time c_ulonglong +} +rusage_info_v5 :: c_struct { + ri_uuid [16]c_uchar + ri_user_time c_ulonglong + ri_system_time c_ulonglong + ri_pkg_idle_wkups c_ulonglong + ri_interrupt_wkups c_ulonglong + ri_pageins c_ulonglong + ri_wired_size c_ulonglong + ri_resident_size c_ulonglong + ri_phys_footprint c_ulonglong + ri_proc_start_abstime c_ulonglong + ri_proc_exit_abstime c_ulonglong + ri_child_user_time c_ulonglong + ri_child_system_time c_ulonglong + ri_child_pkg_idle_wkups c_ulonglong + ri_child_interrupt_wkups c_ulonglong + ri_child_pageins c_ulonglong + ri_child_elapsed_abstime c_ulonglong + ri_diskio_bytesread c_ulonglong + ri_diskio_byteswritten c_ulonglong + ri_cpu_time_qos_default c_ulonglong + ri_cpu_time_qos_maintenance c_ulonglong + ri_cpu_time_qos_background c_ulonglong + ri_cpu_time_qos_utility c_ulonglong + ri_cpu_time_qos_legacy c_ulonglong + ri_cpu_time_qos_user_initiated c_ulonglong + ri_cpu_time_qos_user_interactive c_ulonglong + ri_billed_system_time c_ulonglong + ri_serviced_system_time c_ulonglong + ri_logical_writes c_ulonglong + ri_lifetime_max_phys_footprint c_ulonglong + ri_instructions c_ulonglong + ri_cycles c_ulonglong + ri_billed_energy c_ulonglong + ri_serviced_energy c_ulonglong + ri_interval_max_phys_footprint c_ulonglong + ri_runnable_time c_ulonglong + ri_flags c_ulonglong +} +rusage_info_v6 :: c_struct { + ri_uuid [16]c_uchar + ri_user_time c_ulonglong + ri_system_time c_ulonglong + ri_pkg_idle_wkups c_ulonglong + ri_interrupt_wkups c_ulonglong + ri_pageins c_ulonglong + ri_wired_size c_ulonglong + ri_resident_size c_ulonglong + ri_phys_footprint c_ulonglong + ri_proc_start_abstime c_ulonglong + ri_proc_exit_abstime c_ulonglong + ri_child_user_time c_ulonglong + ri_child_system_time c_ulonglong + ri_child_pkg_idle_wkups c_ulonglong + ri_child_interrupt_wkups c_ulonglong + ri_child_pageins c_ulonglong + ri_child_elapsed_abstime c_ulonglong + ri_diskio_bytesread c_ulonglong + ri_diskio_byteswritten c_ulonglong + ri_cpu_time_qos_default c_ulonglong + ri_cpu_time_qos_maintenance c_ulonglong + ri_cpu_time_qos_background c_ulonglong + ri_cpu_time_qos_utility c_ulonglong + ri_cpu_time_qos_legacy c_ulonglong + ri_cpu_time_qos_user_initiated c_ulonglong + ri_cpu_time_qos_user_interactive c_ulonglong + ri_billed_system_time c_ulonglong + ri_serviced_system_time c_ulonglong + ri_logical_writes c_ulonglong + ri_lifetime_max_phys_footprint c_ulonglong + ri_instructions c_ulonglong + ri_cycles c_ulonglong + ri_billed_energy c_ulonglong + ri_serviced_energy c_ulonglong + ri_interval_max_phys_footprint c_ulonglong + ri_runnable_time c_ulonglong + ri_flags c_ulonglong + ri_user_ptime c_ulonglong + ri_system_ptime c_ulonglong + ri_pinstructions c_ulonglong + ri_pcycles c_ulonglong + ri_energy_nj c_ulonglong + ri_penergy_nj c_ulonglong + ri_secure_time_in_system c_ulonglong + ri_secure_ptime_in_system c_ulonglong + ri_neural_footprint c_ulonglong + ri_lifetime_max_neural_footprint c_ulonglong + ri_interval_max_neural_footprint c_ulonglong + ri_reserved [9]c_ulonglong +} +rlimit :: c_struct { + rlim_cur c_ulonglong + rlim_max c_ulonglong +} +proc_rlimit_control_wakeupmon :: c_struct { + wm_flags c_uint + wm_rate c_int +} +# unsupported in bindings: C union '__c_stdlib_bro_wait_record' has no native spelling +__c_stdlib_bro_wait_record :: opaque +__c_stdlib_bro_record_53 :: opaque +__c_stdlib_bro_record_54 :: opaque +div_t :: c_struct { + quot c_int + rem c_int +} +ldiv_t :: c_struct { + quot c_long + rem c_long +} +lldiv_t :: c_struct { + quot c_longlong + rem c_longlong +} +_malloc_zone_t :: opaque + +# unsupported in bindings: typedef '__mbstate_t' — underlying type has no native spelling +# unsupported in bindings: typedef '__darwin_mbstate_t' — underlying type has no native spelling +idtype_t :: alias c_uint +pid_t :: alias c_int +id_t :: alias c_uint +sig_atomic_t :: alias c_int +# unsupported in bindings: typedef '__darwin_arm_neon_state64' — underlying type has no native spelling +# unsupported in bindings: typedef '__darwin_arm_neon_state' — underlying type has no native spelling +# unsupported in bindings: typedef '__darwin_mcontext64' — underlying type has no native spelling +mcontext_t :: alias ?*mut __darwin_mcontext64 +pthread_attr_t :: alias _opaque_pthread_attr_t +stack_t :: alias __darwin_sigaltstack +ucontext_t :: alias __darwin_ucontext +sigset_t :: alias c_uint +uid_t :: alias c_uint +# unsupported in bindings: typedef 'sigval' — underlying type has no native spelling +# unsupported in bindings: typedef 'sigevent' — underlying type has no native spelling +# unsupported in bindings: typedef '__siginfo' — underlying type has no native spelling +# unsupported in bindings: typedef 'siginfo_t' — underlying type has no native spelling +# unsupported in bindings: typedef '__sigaction_u' — underlying type has no native spelling +# unsupported in bindings: typedef '__sigaction' — underlying type has no native spelling +# unsupported in bindings: typedef 'sigaction' — underlying type has no native spelling +sig_t :: alias ?*c_func(_ c_int) void +uint8_t :: alias c_uchar +uint16_t :: alias c_ushort +uint32_t :: alias c_uint +uint64_t :: alias c_ulonglong +int_least8_t :: alias c_schar +int_least16_t :: alias c_short +int_least32_t :: alias c_int +int_least64_t :: alias c_longlong +uint_least8_t :: alias c_uchar +uint_least16_t :: alias c_ushort +uint_least32_t :: alias c_uint +uint_least64_t :: alias c_ulonglong +int_fast8_t :: alias c_schar +int_fast16_t :: alias c_short +int_fast32_t :: alias c_int +int_fast64_t :: alias c_longlong +uint_fast8_t :: alias c_uchar +uint_fast16_t :: alias c_ushort +uint_fast32_t :: alias c_uint +uint_fast64_t :: alias c_ulonglong +intmax_t :: alias c_long +uintmax_t :: alias c_ulong +rlim_t :: alias c_ulonglong +rusage_info_t :: alias ?*mut anyopaque +rusage_info_current :: alias rusage_info_v6 +# unsupported in bindings: typedef 'wait' — underlying type has no native spelling +ct_rune_t :: alias c_int +rune_t :: alias c_int +wchar_t :: alias c_int +malloc_type_id_t :: alias c_ulonglong +# unsupported in bindings: typedef '_malloc_zone_t' — underlying type has no native spelling +# unsupported in bindings: typedef 'malloc_zone_t' — underlying type has no native spelling +dev_t :: alias c_int +mode_t :: alias c_ushort + +_ARM_SIGNAL_ c_int :: 1 +SIGHUP c_int :: 1 +SIGINT c_int :: 2 +SIGQUIT c_int :: 3 +SIGILL c_int :: 4 +SIGTRAP c_int :: 5 +SIGABRT c_int :: 6 +SIGEMT c_int :: 7 +SIGFPE c_int :: 8 +SIGKILL c_int :: 9 +SIGBUS c_int :: 10 +SIGSEGV c_int :: 11 +SIGSYS c_int :: 12 +SIGPIPE c_int :: 13 +SIGALRM c_int :: 14 +SIGTERM c_int :: 15 +SIGURG c_int :: 16 +SIGSTOP c_int :: 17 +SIGTSTP c_int :: 18 +SIGCONT c_int :: 19 +SIGCHLD c_int :: 20 +SIGTTIN c_int :: 21 +SIGTTOU c_int :: 22 +SIGIO c_int :: 23 +SIGXCPU c_int :: 24 +SIGXFSZ c_int :: 25 +SIGVTALRM c_int :: 26 +SIGPROF c_int :: 27 +SIGWINCH c_int :: 28 +SIGINFO c_int :: 29 +SIGUSR1 c_int :: 30 +SIGUSR2 c_int :: 31 +SIGEV_NONE c_int :: 0 +SIGEV_SIGNAL c_int :: 1 +SIGEV_THREAD c_int :: 3 +SIGEV_KEVENT c_int :: 4 +ILL_NOOP c_int :: 0 +ILL_ILLOPC c_int :: 1 +ILL_ILLTRP c_int :: 2 +ILL_PRVOPC c_int :: 3 +ILL_ILLOPN c_int :: 4 +ILL_ILLADR c_int :: 5 +ILL_PRVREG c_int :: 6 +ILL_COPROC c_int :: 7 +ILL_BADSTK c_int :: 8 +FPE_NOOP c_int :: 0 +FPE_FLTDIV c_int :: 1 +FPE_FLTOVF c_int :: 2 +FPE_FLTUND c_int :: 3 +FPE_FLTRES c_int :: 4 +FPE_FLTINV c_int :: 5 +FPE_FLTSUB c_int :: 6 +FPE_INTDIV c_int :: 7 +FPE_INTOVF c_int :: 8 +SEGV_NOOP c_int :: 0 +SEGV_MAPERR c_int :: 1 +SEGV_ACCERR c_int :: 2 +BUS_NOOP c_int :: 0 +BUS_ADRALN c_int :: 1 +BUS_ADRERR c_int :: 2 +BUS_OBJERR c_int :: 3 +TRAP_BRKPT c_int :: 1 +TRAP_TRACE c_int :: 2 +CLD_NOOP c_int :: 0 +CLD_EXITED c_int :: 1 +CLD_KILLED c_int :: 2 +CLD_DUMPED c_int :: 3 +CLD_TRAPPED c_int :: 4 +CLD_STOPPED c_int :: 5 +CLD_CONTINUED c_int :: 6 +POLL_IN c_int :: 1 +POLL_OUT c_int :: 2 +POLL_MSG c_int :: 3 +POLL_ERR c_int :: 4 +POLL_PRI c_int :: 5 +POLL_HUP c_int :: 6 +SA_ONSTACK c_int :: 1 +SA_RESTART c_int :: 2 +SA_RESETHAND c_int :: 4 +SA_NOCLDSTOP c_int :: 8 +SA_NODEFER c_int :: 16 +SA_NOCLDWAIT c_int :: 32 +SA_SIGINFO c_int :: 64 +SA_USERTRAMP c_int :: 256 +SA_64REGSET c_int :: 512 +SIG_BLOCK c_int :: 1 +SIG_UNBLOCK c_int :: 2 +SIG_SETMASK c_int :: 3 +SI_USER c_int :: 65537 +SI_QUEUE c_int :: 65538 +SI_TIMER c_int :: 65539 +SI_ASYNCIO c_int :: 65540 +SI_MESGQ c_int :: 65541 +SS_ONSTACK c_int :: 1 +SS_DISABLE c_int :: 4 +MINSIGSTKSZ c_int :: 32768 +SIGSTKSZ c_int :: 131072 +INT8_MAX c_int :: 127 +INT16_MAX c_int :: 32767 +INT32_MAX c_int :: 2147483647 +INT64_MAX c_longlong :: 9223372036854775807 +INT8_MIN c_int :: -128 +INT16_MIN c_int :: -32768 +UINT8_MAX c_int :: 255 +UINT16_MAX c_int :: 65535 +UINT32_MAX c_uint :: 4294967295 +UINT64_MAX c_ulonglong :: 18446744073709551615 +INTPTR_MAX c_long :: 9223372036854775807 +UINTPTR_MAX c_ulong :: 18446744073709551615 +PRIO_PROCESS c_int :: 0 +PRIO_PGRP c_int :: 1 +PRIO_USER c_int :: 2 +PRIO_DARWIN_THREAD c_int :: 3 +PRIO_DARWIN_PROCESS c_int :: 4 +PRIO_MIN c_int :: -20 +PRIO_MAX c_int :: 20 +PRIO_DARWIN_BG c_int :: 4096 +PRIO_DARWIN_NONUI c_int :: 4097 +RUSAGE_SELF c_int :: 0 +RUSAGE_CHILDREN c_int :: -1 +RUSAGE_INFO_V0 c_int :: 0 +RUSAGE_INFO_V1 c_int :: 1 +RUSAGE_INFO_V2 c_int :: 2 +RUSAGE_INFO_V3 c_int :: 3 +RUSAGE_INFO_V4 c_int :: 4 +RUSAGE_INFO_V5 c_int :: 5 +RUSAGE_INFO_V6 c_int :: 6 +RU_PROC_RUNS_RESLIDE c_int :: 1 +RLIMIT_CPU c_int :: 0 +RLIMIT_FSIZE c_int :: 1 +RLIMIT_DATA c_int :: 2 +RLIMIT_STACK c_int :: 3 +RLIMIT_CORE c_int :: 4 +RLIMIT_AS c_int :: 5 +RLIMIT_MEMLOCK c_int :: 6 +RLIMIT_NPROC c_int :: 7 +RLIMIT_NOFILE c_int :: 8 +RLIM_NLIMITS c_int :: 9 +_RLIMIT_POSIX_FLAG c_int :: 4096 +RLIMIT_WAKEUPS_MONITOR c_int :: 1 +RLIMIT_CPU_USAGE_MONITOR c_int :: 2 +RLIMIT_THREAD_CPULIMITS c_int :: 3 +RLIMIT_FOOTPRINT_INTERVAL c_int :: 4 +WAKEMON_ENABLE c_int :: 1 +WAKEMON_DISABLE c_int :: 2 +WAKEMON_GET_PARAMS c_int :: 4 +WAKEMON_SET_DEFAULTS c_int :: 8 +WAKEMON_MAKE_FATAL c_int :: 16 +CPUMON_MAKE_FATAL c_int :: 4096 +FOOTPRINT_INTERVAL_RESET c_int :: 1 +IOPOL_TYPE_DISK c_int :: 0 +IOPOL_TYPE_VFS_ATIME_UPDATES c_int :: 2 +IOPOL_TYPE_VFS_MATERIALIZE_DATALESS_FILES c_int :: 3 +IOPOL_TYPE_VFS_STATFS_NO_DATA_VOLUME c_int :: 4 +IOPOL_TYPE_VFS_TRIGGER_RESOLVE c_int :: 5 +IOPOL_TYPE_VFS_IGNORE_CONTENT_PROTECTION c_int :: 6 +IOPOL_TYPE_VFS_IGNORE_PERMISSIONS c_int :: 7 +IOPOL_TYPE_VFS_SKIP_MTIME_UPDATE c_int :: 8 +IOPOL_TYPE_VFS_ALLOW_LOW_SPACE_WRITES c_int :: 9 +IOPOL_TYPE_VFS_DISALLOW_RW_FOR_O_EVTONLY c_int :: 10 +IOPOL_TYPE_VFS_ENTITLED_RESERVE_ACCESS c_int :: 14 +IOPOL_SCOPE_PROCESS c_int :: 0 +IOPOL_SCOPE_THREAD c_int :: 1 +IOPOL_SCOPE_DARWIN_BG c_int :: 2 +IOPOL_DEFAULT c_int :: 0 +IOPOL_IMPORTANT c_int :: 1 +IOPOL_PASSIVE c_int :: 2 +IOPOL_THROTTLE c_int :: 3 +IOPOL_UTILITY c_int :: 4 +IOPOL_STANDARD c_int :: 5 +IOPOL_ATIME_UPDATES_DEFAULT c_int :: 0 +IOPOL_ATIME_UPDATES_OFF c_int :: 1 +IOPOL_MATERIALIZE_DATALESS_FILES_DEFAULT c_int :: 0 +IOPOL_MATERIALIZE_DATALESS_FILES_OFF c_int :: 1 +IOPOL_MATERIALIZE_DATALESS_FILES_ON c_int :: 2 +IOPOL_MATERIALIZE_DATALESS_FILES_ORIG c_int :: 4 +IOPOL_MATERIALIZE_DATALESS_FILES_BASIC_MASK c_int :: 3 +IOPOL_VFS_STATFS_NO_DATA_VOLUME_DEFAULT c_int :: 0 +IOPOL_VFS_STATFS_FORCE_NO_DATA_VOLUME c_int :: 1 +IOPOL_VFS_TRIGGER_RESOLVE_DEFAULT c_int :: 0 +IOPOL_VFS_TRIGGER_RESOLVE_OFF c_int :: 1 +IOPOL_VFS_CONTENT_PROTECTION_DEFAULT c_int :: 0 +IOPOL_VFS_CONTENT_PROTECTION_IGNORE c_int :: 1 +IOPOL_VFS_IGNORE_PERMISSIONS_OFF c_int :: 0 +IOPOL_VFS_IGNORE_PERMISSIONS_ON c_int :: 1 +IOPOL_VFS_SKIP_MTIME_UPDATE_OFF c_int :: 0 +IOPOL_VFS_SKIP_MTIME_UPDATE_ON c_int :: 1 +IOPOL_VFS_SKIP_MTIME_UPDATE_IGNORE c_int :: 2 +IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_OFF c_int :: 0 +IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_ON c_int :: 1 +IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_DEFAULT c_int :: 0 +IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_ON c_int :: 1 +IOPOL_VFS_NOCACHE_WRITE_FS_BLKSIZE_DEFAULT c_int :: 0 +IOPOL_VFS_NOCACHE_WRITE_FS_BLKSIZE_ON c_int :: 1 +IOPOL_VFS_ENTITLED_RESERVE_ACCESS_OFF c_int :: 0 +IOPOL_VFS_ENTITLED_RESERVE_ACCESS_ON c_int :: 1 +WNOHANG c_int :: 1 +WUNTRACED c_int :: 2 +WCOREFLAG c_int :: 128 +_WSTOPPED c_int :: 127 +WEXITED c_int :: 4 +WSTOPPED c_int :: 8 +WCONTINUED c_int :: 16 +WNOWAIT c_int :: 32 +WAIT_MYPGRP c_int :: 0 +_QUAD_HIGHWORD c_int :: 1 +_QUAD_LOWWORD c_int :: 0 +EXIT_FAILURE c_int :: 1 +EXIT_SUCCESS c_int :: 0 +RAND_MAX c_int :: 2147483647 +_MALLOC_TYPE_MALLOC_BACKDEPLOY_PUBLIC c_int :: 1 +P_ALL c_uint :: 0 +P_PID c_uint :: 1 +P_PGID c_uint :: 2 + +signal c_func(_ c_int, _ ?*c_func(_ c_int) void) ?*c_func(_ c_int) void +getpriority c_func(_ c_int, _ c_uint) c_int +getiopolicy_np c_func(_ c_int, _ c_int) c_int +getrlimit c_func(_ c_int, _ ?*mut rlimit) c_int +getrusage c_func(_ c_int, _ ?*mut rusage) c_int +setpriority c_func(_ c_int, _ c_uint, _ c_int) c_int +setiopolicy_np c_func(_ c_int, _ c_int, _ c_int) c_int +setrlimit c_func(_ c_int, _ ?*rlimit) c_int +# unsupported in bindings: function '_OSSwapInt16' is a static inline function (needs trampoline) +# unsupported in bindings: function '_OSSwapInt32' is a static inline function (needs trampoline) +# unsupported in bindings: function '_OSSwapInt64' is a static inline function (needs trampoline) +wait c_func(_ ?*mut c_int) c_int +waitpid c_func(_ c_int, _ ?*mut c_int, _ c_int) c_int +waitid c_func(_ c_uint, _ c_uint, _ ?*mut __siginfo, _ c_int) c_int +wait3 c_func(_ ?*mut c_int, _ c_int, _ ?*mut rusage) c_int +wait4 c_func(_ c_int, _ ?*mut c_int, _ c_int, _ ?*mut rusage) c_int +alloca c_func(__size c_ulong) ?*mut anyopaque +malloc_type_malloc c_func(size c_ulong, type_id c_ulonglong) ?*mut anyopaque +malloc_type_calloc c_func(count c_ulong, size c_ulong, type_id c_ulonglong) ?*mut anyopaque +malloc_type_free c_func(ptr ?*mut anyopaque, type_id c_ulonglong) void +malloc_type_realloc c_func(ptr ?*mut anyopaque, size c_ulong, type_id c_ulonglong) ?*mut anyopaque +malloc_type_valloc c_func(size c_ulong, type_id c_ulonglong) ?*mut anyopaque +malloc_type_aligned_alloc c_func(alignment c_ulong, size c_ulong, type_id c_ulonglong) ?*mut anyopaque +malloc_type_posix_memalign c_func(memptr ?*mut ?*mut anyopaque, alignment c_ulong, size c_ulong, type_id c_ulonglong) c_int +malloc_type_zone_malloc c_func(zone ?*mut _malloc_zone_t, size c_ulong, type_id c_ulonglong) ?*mut anyopaque +malloc_type_zone_calloc c_func(zone ?*mut _malloc_zone_t, count c_ulong, size c_ulong, type_id c_ulonglong) ?*mut anyopaque +malloc_type_zone_free c_func(zone ?*mut _malloc_zone_t, ptr ?*mut anyopaque, type_id c_ulonglong) void +malloc_type_zone_realloc c_func(zone ?*mut _malloc_zone_t, ptr ?*mut anyopaque, size c_ulong, type_id c_ulonglong) ?*mut anyopaque +malloc_type_zone_valloc c_func(zone ?*mut _malloc_zone_t, size c_ulong, type_id c_ulonglong) ?*mut anyopaque +malloc_type_zone_memalign c_func(zone ?*mut _malloc_zone_t, alignment c_ulong, size c_ulong, type_id c_ulonglong) ?*mut anyopaque malloc c_func(__size c_ulong) ?*mut anyopaque -realloc c_func(__ptr ?*mut anyopaque, __size c_ulong) ?*mut anyopaque +calloc c_func(__count c_ulong, __size c_ulong) ?*mut anyopaque free c_func(_ ?*mut anyopaque) void +realloc c_func(__ptr ?*mut anyopaque, __size c_ulong) ?*mut anyopaque +reallocf c_func(__ptr ?*mut anyopaque, __size c_ulong) ?*mut anyopaque +valloc c_func(__size c_ulong) ?*mut anyopaque +aligned_alloc c_func(__alignment c_ulong, __size c_ulong) ?*mut anyopaque posix_memalign c_func(__memptr ?*mut ?*mut anyopaque, __alignment c_ulong, __size c_ulong) c_int +abort c_func() void +abs c_func(_ c_int) c_int +atexit c_func(_ ?*c_func() void) c_int +at_quick_exit c_func(_ ?*c_func() void) c_int +atof c_func(_ ?*c_char) c_double +atoi c_func(_ ?*c_char) c_int +atol c_func(_ ?*c_char) c_long +atoll c_func(_ ?*c_char) c_longlong +bsearch c_func(__key ?*anyopaque, __base ?*anyopaque, __nel c_ulong, __width c_ulong, __compar ?*c_func(_ ?*anyopaque, _ ?*anyopaque) c_int) ?*mut anyopaque +div c_func(_ c_int, _ c_int) div_t +exit c_func(_ c_int) void +getenv c_func(_ ?*c_char) ?*mut c_char +labs c_func(_ c_long) c_long +ldiv c_func(_ c_long, _ c_long) ldiv_t +llabs c_func(_ c_longlong) c_longlong +lldiv c_func(_ c_longlong, _ c_longlong) lldiv_t +mblen c_func(__s ?*c_char, __n c_ulong) c_int +mbstowcs c_func(_ ?*mut c_int, _ ?*c_char, __n c_ulong) c_ulong +mbtowc c_func(_ ?*mut c_int, _ ?*c_char, __n c_ulong) c_int +qsort c_func(__base ?*mut anyopaque, __nel c_ulong, __width c_ulong, __compar ?*c_func(_ ?*anyopaque, _ ?*anyopaque) c_int) void +quick_exit c_func(_ c_int) void +rand c_func() c_int +srand c_func(_ c_uint) void +strtod c_func(_ ?*c_char, _ ?*mut ?*mut c_char) c_double +strtof c_func(_ ?*c_char, _ ?*mut ?*mut c_char) c_float +strtol c_func(__str ?*c_char, __endptr ?*mut ?*mut c_char, __base c_int) c_long +strtold c_func(_ ?*c_char, _ ?*mut ?*mut c_char) c_longdouble +strtoll c_func(__str ?*c_char, __endptr ?*mut ?*mut c_char, __base c_int) c_longlong +strtoul c_func(__str ?*c_char, __endptr ?*mut ?*mut c_char, __base c_int) c_ulong +strtoull c_func(__str ?*c_char, __endptr ?*mut ?*mut c_char, __base c_int) c_ulonglong +system c_func(_ ?*c_char) c_int +wcstombs c_func(_ ?*mut c_char, _ ?*c_int, __n c_ulong) c_ulong +wctomb c_func(_ ?*mut c_char, _ c_int) c_int +_Exit c_func(_ c_int) void +a64l c_func(_ ?*c_char) c_long +drand48 c_func() c_double +ecvt c_func(_ c_double, _ c_int, _ ?*mut c_int, _ ?*mut c_int) ?*mut c_char +erand48 c_func(_ ?*mut c_ushort) c_double +fcvt c_func(_ c_double, _ c_int, _ ?*mut c_int, _ ?*mut c_int) ?*mut c_char +gcvt c_func(_ c_double, _ c_int, _ ?*mut c_char) ?*mut c_char +getsubopt c_func(_ ?*mut ?*mut c_char, _ ?*?*mut c_char, _ ?*mut ?*mut c_char) c_int +grantpt c_func(_ c_int) c_int +initstate c_func(_ c_uint, _ ?*mut c_char, __size c_ulong) ?*mut c_char +jrand48 c_func(_ ?*mut c_ushort) c_long +l64a c_func(_ c_long) ?*mut c_char +lcong48 c_func(_ ?*mut c_ushort) void +lrand48 c_func() c_long +mktemp c_func(_ ?*mut c_char) ?*mut c_char +mkstemp c_func(_ ?*mut c_char) c_int +mrand48 c_func() c_long +nrand48 c_func(_ ?*mut c_ushort) c_long +posix_openpt c_func(_ c_int) c_int +ptsname c_func(_ c_int) ?*mut c_char +ptsname_r c_func(fildes c_int, buffer ?*mut c_char, buflen c_ulong) c_int +putenv c_func(_ ?*mut c_char) c_int +random c_func() c_long +rand_r c_func(_ ?*mut c_uint) c_int +realpath c_func(_ ?*c_char, _ ?*mut c_char) ?*mut c_char +seed48 c_func(_ ?*mut c_ushort) ?*mut c_ushort +setenv c_func(__name ?*c_char, __value ?*c_char, __overwrite c_int) c_int +setkey c_func(_ ?*c_char) void +setstate c_func(_ ?*c_char) ?*mut c_char +srand48 c_func(_ c_long) void +srandom c_func(_ c_uint) void +unlockpt c_func(_ c_int) c_int +unsetenv c_func(_ ?*c_char) c_int +arc4random c_func() c_uint +arc4random_addrandom c_func(_ ?*mut c_uchar, __datlen c_int) void +arc4random_buf c_func(__buf ?*mut anyopaque, __nbytes c_ulong) void +arc4random_stir c_func() void +arc4random_uniform c_func(__upper_bound c_uint) c_uint +# unsupported in bindings: function 'atexit_b' — function parameter type is not supported +# unsupported in bindings: function 'bsearch_b' — function parameter type is not supported +cgetcap c_func(_ ?*mut c_char, _ ?*c_char, _ c_int) ?*mut c_char +cgetclose c_func() c_int +cgetent c_func(_ ?*mut ?*mut c_char, _ ?*mut ?*mut c_char, _ ?*c_char) c_int +cgetfirst c_func(_ ?*mut ?*mut c_char, _ ?*mut ?*mut c_char) c_int +cgetmatch c_func(_ ?*c_char, _ ?*c_char) c_int +cgetnext c_func(_ ?*mut ?*mut c_char, _ ?*mut ?*mut c_char) c_int +cgetnum c_func(_ ?*mut c_char, _ ?*c_char, _ ?*mut c_long) c_int +cgetset c_func(_ ?*c_char) c_int +cgetstr c_func(_ ?*mut c_char, _ ?*c_char, _ ?*mut ?*mut c_char) c_int +cgetustr c_func(_ ?*mut c_char, _ ?*c_char, _ ?*mut ?*mut c_char) c_int +daemon c_func(_ c_int, _ c_int) c_int +devname c_func(_ c_int, _ c_ushort) ?*mut c_char +devname_r c_func(_ c_int, _ c_ushort, buf ?*mut c_char, len c_int) ?*mut c_char +getbsize c_func(_ ?*mut c_int, _ ?*mut c_long) ?*mut c_char +getloadavg c_func(_ ?*mut c_double, __nelem c_int) c_int +getprogname c_func() ?*c_char +setprogname c_func(_ ?*c_char) void +heapsort c_func(__base ?*mut anyopaque, __nel c_ulong, __width c_ulong, __compar ?*c_func(_ ?*anyopaque, _ ?*anyopaque) c_int) c_int +# unsupported in bindings: function 'heapsort_b' — function parameter type is not supported +mergesort c_func(__base ?*mut anyopaque, __nel c_ulong, __width c_ulong, __compar ?*c_func(_ ?*anyopaque, _ ?*anyopaque) c_int) c_int +# unsupported in bindings: function 'mergesort_b' — function parameter type is not supported +psort c_func(__base ?*mut anyopaque, __nel c_ulong, __width c_ulong, __compar ?*c_func(_ ?*anyopaque, _ ?*anyopaque) c_int) void +# unsupported in bindings: function 'psort_b' — function parameter type is not supported +psort_r c_func(__base ?*mut anyopaque, __nel c_ulong, __width c_ulong, _ ?*mut anyopaque, __compar ?*c_func(_ ?*mut anyopaque, _ ?*anyopaque, _ ?*anyopaque) c_int) void +# unsupported in bindings: function 'qsort_b' — function parameter type is not supported +qsort_r c_func(__base ?*mut anyopaque, __nel c_ulong, __width c_ulong, _ ?*mut anyopaque, __compar ?*c_func(_ ?*mut anyopaque, _ ?*anyopaque, _ ?*anyopaque) c_int) void +radixsort c_func(__base ?*mut ?*c_uchar, __nel c_int, __table ?*c_uchar, __endbyte c_uint) c_int +rpmatch c_func(_ ?*c_char) c_int +sradixsort c_func(__base ?*mut ?*c_uchar, __nel c_int, __table ?*c_uchar, __endbyte c_uint) c_int +sranddev c_func() void +srandomdev c_func() void +strtonum c_func(__numstr ?*c_char, __minval c_longlong, __maxval c_longlong, __errstrp ?*mut ?*c_char) c_longlong +strtoq c_func(__str ?*c_char, __endptr ?*mut ?*mut c_char, __base c_int) c_longlong +strtouq c_func(__str ?*c_char, __endptr ?*mut ?*mut c_char, __base c_int) c_ulonglong + +# unsupported in bindings: external variable '__mb_cur_max' has no native spelling +# unsupported in bindings: external variable 'suboptarg' has no native spelling +# unsupported in bindings: _STDLIB_H_ — C macro has no replacement value +# unsupported in bindings: _LIBC_COUNT__MB_LEN_MAX — C macro is not a supported constant +# unsupported in bindings: _LIBC_COUNT__PATH_MAX — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_0 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_1 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_2 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_3 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_4 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_5 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_6 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_7 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_8 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_9 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_10 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_10_2 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_10_3 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_11 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_11_2 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_11_3 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_11_4 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_12 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_12_1 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_12_2 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_12_4 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_13 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_13_1 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_13_2 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_13_4 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_14 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_14_1 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_14_4 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_14_5 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_14_6 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_15 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_15_1 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_15_4 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_16 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_11_0 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_11_1 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_11_3 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_11_4 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_11_5 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_11_6 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_12_0 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_12_1 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_12_2 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_12_3 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_12_4 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_12_5 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_12_6 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_12_7 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_13_0 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_13_1 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_13_2 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_13_3 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_13_4 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_13_5 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_13_6 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_13_7 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_14_0 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_14_1 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_14_2 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_14_3 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_14_4 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_14_5 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_14_6 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_14_7 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_15_0 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_15_1 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_15_2 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_15_3 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_15_4 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_15_5 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_15_6 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_16_0 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_26_0 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_26_1 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_26_2 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_26_3 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_26_4 — C macro is not a supported constant +# unsupported in bindings: _CDEFS_H_ — C macro has no replacement value +# unsupported in bindings: _LIBC_BOUNDS_H_ — C macro has no replacement value +# unsupported in bindings: _LIBC_COUNT — C function-like macros are not supported +# unsupported in bindings: _LIBC_COUNT_OR_NULL — C function-like macros are not supported +# unsupported in bindings: _LIBC_SIZE — C function-like macros are not supported +# unsupported in bindings: _LIBC_SIZE_OR_NULL — C function-like macros are not supported +# unsupported in bindings: _LIBC_ENDED_BY — C function-like macros are not supported +# unsupported in bindings: _LIBC_SINGLE — C macro has no replacement value +# unsupported in bindings: _LIBC_UNSAFE_INDEXABLE — C macro has no replacement value +# unsupported in bindings: _LIBC_CSTR — C macro has no replacement value +# unsupported in bindings: _LIBC_NULL_TERMINATED — C macro has no replacement value +# unsupported in bindings: _LIBC_FLEX_COUNT — C function-like macros are not supported +# unsupported in bindings: _LIBC_SINGLE_BY_DEFAULT — C function-like macros are not supported +# unsupported in bindings: _LIBC_PTRCHECK_REPLACED — C function-like macros are not supported +# unsupported in bindings: _LIBC_FORGE_PTR — C function-like macros are not supported +# unsupported in bindings: _SYS__TYPES_H_ — C macro has no replacement value +# unsupported in bindings: _BSD_MACHINE__TYPES_H_ — C macro has no replacement value +# unsupported in bindings: _BSD_ARM__TYPES_H_ — C macro has no replacement value +# unsupported in bindings: _SYS__PTHREAD_TYPES_H_ — C macro has no replacement value +# unsupported in bindings: _SYS_WAIT_H_ — C macro has no replacement value +# unsupported in bindings: _PID_T — C macro has no replacement value +# unsupported in bindings: _ID_T — C macro has no replacement value +# unsupported in bindings: _SYS_SIGNAL_H_ — C macro has no replacement value +# unsupported in bindings: NSIG — C macro is not a supported constant +# unsupported in bindings: _BSD_MACHINE_SIGNAL_H_ — C macro has no replacement value +# unsupported in bindings: SIGIOT — C macro is not a supported constant +# unsupported in bindings: SIG_DFL — C macro is not a supported constant +# unsupported in bindings: SIG_IGN — C macro is not a supported constant +# unsupported in bindings: SIG_HOLD — C macro is not a supported constant +# unsupported in bindings: SIG_ERR — C macro is not a supported constant +# unsupported in bindings: _BSD_MACHINE__MCONTEXT_H_ — C macro has no replacement value +# unsupported in bindings: _MACH_MACHINE__STRUCTS_H_ — C macro has no replacement value +# unsupported in bindings: _MACH_ARM__STRUCTS_H_ — C macro has no replacement value +# unsupported in bindings: _BSD_MACHINE_TYPES_H_ — C macro has no replacement value +# unsupported in bindings: _ARM_MACHTYPES_H_ — C macro has no replacement value +# unsupported in bindings: _MACHTYPES_H_ — C macro has no replacement value +# unsupported in bindings: _INT8_T — C macro has no replacement value +# unsupported in bindings: _INT16_T — C macro has no replacement value +# unsupported in bindings: _INT32_T — C macro has no replacement value +# unsupported in bindings: _INT64_T — C macro has no replacement value +# unsupported in bindings: _U_INT8_T — C macro has no replacement value +# unsupported in bindings: _U_INT16_T — C macro has no replacement value +# unsupported in bindings: _U_INT32_T — C macro has no replacement value +# unsupported in bindings: _U_INT64_T — C macro has no replacement value +# unsupported in bindings: _INTPTR_T — C macro has no replacement value +# unsupported in bindings: _UINTPTR_T — C macro has no replacement value +# unsupported in bindings: USER_ADDR_NULL — C macro is not a supported constant +# unsupported in bindings: CAST_USER_ADDR_T — C function-like macros are not supported +# unsupported in bindings: _STRUCT_ARM_EXCEPTION_STATE — C macro is not a supported constant +# unsupported in bindings: _STRUCT_ARM_EXCEPTION_STATE64 — C macro is not a supported constant +# unsupported in bindings: _STRUCT_ARM_EXCEPTION_STATE64_V2 — C macro is not a supported constant +# unsupported in bindings: _STRUCT_ARM_THREAD_STATE — C macro is not a supported constant +# unsupported in bindings: _STRUCT_ARM_THREAD_STATE64 — C macro is not a supported constant +# unsupported in bindings: _STRUCT_ARM_VFP_STATE — C macro is not a supported constant +# unsupported in bindings: _STRUCT_ARM_NEON_STATE64 — C macro is not a supported constant +# unsupported in bindings: _STRUCT_ARM_NEON_STATE — C macro is not a supported constant +# unsupported in bindings: _STRUCT_ARM_PAGEIN_STATE — C macro is not a supported constant +# unsupported in bindings: _STRUCT_ARM_SME_STATE — C macro is not a supported constant +# unsupported in bindings: _STRUCT_ARM_SVE_Z_STATE — C macro is not a supported constant +# unsupported in bindings: _STRUCT_ARM_SVE_P_STATE — C macro is not a supported constant +# unsupported in bindings: _STRUCT_ARM_SME_ZA_STATE — C macro is not a supported constant +# unsupported in bindings: _STRUCT_ARM_SME2_STATE — C macro is not a supported constant +# unsupported in bindings: _STRUCT_ARM_LEGACY_DEBUG_STATE — C macro is not a supported constant +# unsupported in bindings: _STRUCT_ARM_DEBUG_STATE32 — C macro is not a supported constant +# unsupported in bindings: _STRUCT_ARM_DEBUG_STATE64 — C macro is not a supported constant +# unsupported in bindings: _STRUCT_ARM_CPMU_STATE64 — C macro is not a supported constant +# unsupported in bindings: _STRUCT_MCONTEXT32 — C macro is not a supported constant +# unsupported in bindings: _STRUCT_MCONTEXT64 — C macro is not a supported constant +# unsupported in bindings: _MCONTEXT_T — C macro has no replacement value +# unsupported in bindings: _STRUCT_MCONTEXT — C macro is not a supported constant +# unsupported in bindings: _PTHREAD_ATTR_T — C macro has no replacement value +# unsupported in bindings: _STRUCT_SIGALTSTACK — C macro is not a supported constant +# unsupported in bindings: _STRUCT_UCONTEXT — C macro is not a supported constant +# unsupported in bindings: _SIGSET_T — C macro has no replacement value +# unsupported in bindings: _SIZE_T — C macro has no replacement value +# unsupported in bindings: _UID_T — C macro has no replacement value +# unsupported in bindings: sa_handler — C macro is not a supported constant +# unsupported in bindings: sa_sigaction — C macro is not a supported constant +# unsupported in bindings: SA_USERSPACE_MASK — C macro is not a supported constant +# unsupported in bindings: SV_ONSTACK — C macro is not a supported constant +# unsupported in bindings: SV_INTERRUPT — C macro is not a supported constant +# unsupported in bindings: SV_RESETHAND — C macro is not a supported constant +# unsupported in bindings: SV_NODEFER — C macro is not a supported constant +# unsupported in bindings: SV_NOCLDSTOP — C macro is not a supported constant +# unsupported in bindings: SV_SIGINFO — C macro is not a supported constant +# unsupported in bindings: sv_onstack — C macro is not a supported constant +# unsupported in bindings: sigmask — C function-like macros are not supported +# unsupported in bindings: BADSIG — C macro is not a supported constant +# unsupported in bindings: _SYS_RESOURCE_H_ — C macro has no replacement value +# unsupported in bindings: _STDINT_H_ — C macro has no replacement value +# unsupported in bindings: _UINT8_T — C macro has no replacement value +# unsupported in bindings: _UINT16_T — C macro has no replacement value +# unsupported in bindings: _UINT32_T — C macro has no replacement value +# unsupported in bindings: _UINT64_T — C macro has no replacement value +# unsupported in bindings: _INTMAX_T — C macro has no replacement value +# unsupported in bindings: _UINTMAX_T — C macro has no replacement value +# unsupported in bindings: INT8_C — C function-like macros are not supported +# unsupported in bindings: INT16_C — C function-like macros are not supported +# unsupported in bindings: INT32_C — C function-like macros are not supported +# unsupported in bindings: INT64_C — C function-like macros are not supported +# unsupported in bindings: UINT8_C — C function-like macros are not supported +# unsupported in bindings: UINT16_C — C function-like macros are not supported +# unsupported in bindings: UINT32_C — C function-like macros are not supported +# unsupported in bindings: UINT64_C — C function-like macros are not supported +# unsupported in bindings: INTMAX_C — C function-like macros are not supported +# unsupported in bindings: UINTMAX_C — C function-like macros are not supported +# unsupported in bindings: INT32_MIN — C macro is not a supported constant +# unsupported in bindings: INT64_MIN — C macro is not a supported constant +# unsupported in bindings: INT_LEAST8_MIN — C macro is not a supported constant +# unsupported in bindings: INT_LEAST16_MIN — C macro is not a supported constant +# unsupported in bindings: INT_LEAST32_MIN — C macro is not a supported constant +# unsupported in bindings: INT_LEAST64_MIN — C macro is not a supported constant +# unsupported in bindings: INT_LEAST8_MAX — C macro is not a supported constant +# unsupported in bindings: INT_LEAST16_MAX — C macro is not a supported constant +# unsupported in bindings: INT_LEAST32_MAX — C macro is not a supported constant +# unsupported in bindings: INT_LEAST64_MAX — C macro is not a supported constant +# unsupported in bindings: UINT_LEAST8_MAX — C macro is not a supported constant +# unsupported in bindings: UINT_LEAST16_MAX — C macro is not a supported constant +# unsupported in bindings: UINT_LEAST32_MAX — C macro is not a supported constant +# unsupported in bindings: UINT_LEAST64_MAX — C macro is not a supported constant +# unsupported in bindings: INT_FAST8_MIN — C macro is not a supported constant +# unsupported in bindings: INT_FAST16_MIN — C macro is not a supported constant +# unsupported in bindings: INT_FAST32_MIN — C macro is not a supported constant +# unsupported in bindings: INT_FAST64_MIN — C macro is not a supported constant +# unsupported in bindings: INT_FAST8_MAX — C macro is not a supported constant +# unsupported in bindings: INT_FAST16_MAX — C macro is not a supported constant +# unsupported in bindings: INT_FAST32_MAX — C macro is not a supported constant +# unsupported in bindings: INT_FAST64_MAX — C macro is not a supported constant +# unsupported in bindings: UINT_FAST8_MAX — C macro is not a supported constant +# unsupported in bindings: UINT_FAST16_MAX — C macro is not a supported constant +# unsupported in bindings: UINT_FAST32_MAX — C macro is not a supported constant +# unsupported in bindings: UINT_FAST64_MAX — C macro is not a supported constant +# unsupported in bindings: INTPTR_MIN — C macro is not a supported constant +# unsupported in bindings: INTMAX_MAX — C macro is not a supported constant +# unsupported in bindings: UINTMAX_MAX — C macro is not a supported constant +# unsupported in bindings: INTMAX_MIN — C macro is not a supported constant +# unsupported in bindings: PTRDIFF_MIN — C macro is not a supported constant +# unsupported in bindings: PTRDIFF_MAX — C macro is not a supported constant +# unsupported in bindings: SIZE_MAX — C macro is not a supported constant +# unsupported in bindings: RSIZE_MAX — C macro is not a supported constant +# unsupported in bindings: WCHAR_MAX — C macro is not a supported constant +# unsupported in bindings: WCHAR_MIN — C macro is not a supported constant +# unsupported in bindings: WINT_MIN — C macro is not a supported constant +# unsupported in bindings: WINT_MAX — C macro is not a supported constant +# unsupported in bindings: SIG_ATOMIC_MIN — C macro is not a supported constant +# unsupported in bindings: SIG_ATOMIC_MAX — C macro is not a supported constant +# unsupported in bindings: _STRUCT_TIMEVAL — C macro is not a supported constant +# unsupported in bindings: ru_first — C macro is not a supported constant +# unsupported in bindings: ru_last — C macro is not a supported constant +# unsupported in bindings: RUSAGE_INFO_CURRENT — C macro is not a supported constant +# unsupported in bindings: RLIM_INFINITY — C macro is not a supported constant +# unsupported in bindings: RLIM_SAVED_MAX — C macro is not a supported constant +# unsupported in bindings: RLIM_SAVED_CUR — C macro is not a supported constant +# unsupported in bindings: RLIMIT_RSS — C macro is not a supported constant +# unsupported in bindings: IOPOL_APPLICATION — C macro is not a supported constant +# unsupported in bindings: IOPOL_NORMAL — C macro is not a supported constant +# unsupported in bindings: _W_INT — C function-like macros are not supported +# unsupported in bindings: _WSTATUS — C function-like macros are not supported +# unsupported in bindings: WEXITSTATUS — C function-like macros are not supported +# unsupported in bindings: WSTOPSIG — C function-like macros are not supported +# unsupported in bindings: WIFCONTINUED — C function-like macros are not supported +# unsupported in bindings: WIFSTOPPED — C function-like macros are not supported +# unsupported in bindings: WIFEXITED — C function-like macros are not supported +# unsupported in bindings: WIFSIGNALED — C function-like macros are not supported +# unsupported in bindings: WTERMSIG — C function-like macros are not supported +# unsupported in bindings: WCOREDUMP — C function-like macros are not supported +# unsupported in bindings: W_EXITCODE — C function-like macros are not supported +# unsupported in bindings: W_STOPCODE — C function-like macros are not supported +# unsupported in bindings: WAIT_ANY — C macro is not a supported constant +# unsupported in bindings: _BSD_MACHINE_ENDIAN_H_ — C macro has no replacement value +# unsupported in bindings: _ARM__ENDIAN_H_ — C macro has no replacement value +# unsupported in bindings: _SYS__ENDIAN_H_ — C macro has no replacement value +# unsupported in bindings: _BSD_MACHINE__ENDIAN_H_ — C macro has no replacement value +# unsupported in bindings: _ARM___ENDIAN_H_ — C macro has no replacement value +# unsupported in bindings: _SYS___ENDIAN_H_ — C macro has no replacement value +# unsupported in bindings: LITTLE_ENDIAN — C macro is not a supported constant +# unsupported in bindings: BIG_ENDIAN — C macro is not a supported constant +# unsupported in bindings: PDP_ENDIAN — C macro is not a supported constant +# unsupported in bindings: BYTE_ORDER — C macro is not a supported constant +# unsupported in bindings: _OS__OSBYTEORDER_H — C macro has no replacement value +# unsupported in bindings: _OS__OSBYTEORDERARM_H — C macro has no replacement value +# unsupported in bindings: ntohs — C function-like macros are not supported +# unsupported in bindings: htons — C function-like macros are not supported +# unsupported in bindings: ntohl — C function-like macros are not supported +# unsupported in bindings: htonl — C function-like macros are not supported +# unsupported in bindings: ntohll — C function-like macros are not supported +# unsupported in bindings: htonll — C function-like macros are not supported +# unsupported in bindings: NTOHL — C function-like macros are not supported +# unsupported in bindings: NTOHS — C function-like macros are not supported +# unsupported in bindings: NTOHLL — C function-like macros are not supported +# unsupported in bindings: HTONL — C function-like macros are not supported +# unsupported in bindings: HTONS — C function-like macros are not supported +# unsupported in bindings: HTONLL — C function-like macros are not supported +# unsupported in bindings: w_termsig — C macro is not a supported constant +# unsupported in bindings: w_coredump — C macro is not a supported constant +# unsupported in bindings: w_retcode — C macro is not a supported constant +# unsupported in bindings: w_stopval — C macro is not a supported constant +# unsupported in bindings: w_stopsig — C macro is not a supported constant +# unsupported in bindings: _ALLOCA_H_ — C macro has no replacement value +# unsupported in bindings: alloca — C function-like macros are not supported +# unsupported in bindings: _CT_RUNE_T — C macro has no replacement value +# unsupported in bindings: _RUNE_T — C macro has no replacement value +# unsupported in bindings: _WCHAR_T — C macro has no replacement value +# unsupported in bindings: NULL — C macro is not a supported constant +# unsupported in bindings: MB_CUR_MAX — C macro is not a supported constant +# unsupported in bindings: _MALLOC_UNDERSCORE_MALLOC_H_ — C macro has no replacement value +# unsupported in bindings: _MALLOC_UNDERSCORE_MALLOC_TYPE_H_ — C macro has no replacement value +# unsupported in bindings: _MALLOC_UNDERSCORE_PTRCHECK_H_ — C macro has no replacement value +# unsupported in bindings: _MALLOC_TYPED — C function-like macros are not supported +# unsupported in bindings: _DEV_T — C macro has no replacement value +# unsupported in bindings: _MODE_T — C macro has no replacement value diff --git a/ffi/c/unistd.hon b/ffi/c/unistd.hon new file mode 100644 index 0000000..6995147 --- /dev/null +++ b/ffi/c/unistd.hon @@ -0,0 +1,661 @@ +# generated by brolang translate-c from unistd.h + +# unsupported in bindings: C union '__mbstate_t' has no native spelling +accessx_descriptor :: c_struct { + ad_name_offset c_uint + ad_flags c_int + ad_pad [2]c_int +} +fd_set :: c_struct { + fds_bits [32]c_int +} +timespec :: c_struct { + tv_sec c_long + tv_nsec c_long +} +fssearchblock :: opaque +searchstate :: opaque + +# unsupported in bindings: typedef '__mbstate_t' — underlying type has no native spelling +# unsupported in bindings: typedef '__darwin_mbstate_t' — underlying type has no native spelling +gid_t :: alias c_uint +useconds_t :: alias c_uint +time_t :: alias c_long +suseconds_t :: alias c_int +uuid_t :: alias [16]c_uchar +# unsupported in bindings: typedef 'fssearchblock' — underlying type has no native spelling +# unsupported in bindings: typedef 'searchstate' — underlying type has no native spelling + +_POSIX_VERSION c_long :: 200112 +_POSIX2_VERSION c_long :: 200112 +_POSIX_THREAD_KEYS_MAX c_int :: 128 +F_OK c_int :: 0 +ACCESSX_MAX_DESCRIPTORS c_int :: 100 +_PC_LINK_MAX c_int :: 1 +_PC_MAX_CANON c_int :: 2 +_PC_MAX_INPUT c_int :: 3 +_PC_NAME_MAX c_int :: 4 +_PC_PATH_MAX c_int :: 5 +_PC_PIPE_BUF c_int :: 6 +_PC_CHOWN_RESTRICTED c_int :: 7 +_PC_NO_TRUNC c_int :: 8 +_PC_VDISABLE c_int :: 9 +_PC_NAME_CHARS_MAX c_int :: 10 +_PC_CASE_SENSITIVE c_int :: 11 +_PC_CASE_PRESERVING c_int :: 12 +_PC_EXTENDED_SECURITY_NP c_int :: 13 +_PC_AUTH_OPAQUE_NP c_int :: 14 +_PC_2_SYMLINKS c_int :: 15 +_PC_ALLOC_SIZE_MIN c_int :: 16 +_PC_ASYNC_IO c_int :: 17 +_PC_FILESIZEBITS c_int :: 18 +_PC_PRIO_IO c_int :: 19 +_PC_REC_INCR_XFER_SIZE c_int :: 20 +_PC_REC_MAX_XFER_SIZE c_int :: 21 +_PC_REC_MIN_XFER_SIZE c_int :: 22 +_PC_REC_XFER_ALIGN c_int :: 23 +_PC_SYMLINK_MAX c_int :: 24 +_PC_SYNC_IO c_int :: 25 +_PC_XATTR_SIZE_BITS c_int :: 26 +_PC_MIN_HOLE_SIZE c_int :: 27 +_CS_PATH c_int :: 1 +STDIN_FILENO c_int :: 0 +STDOUT_FILENO c_int :: 1 +STDERR_FILENO c_int :: 2 +_XOPEN_VERSION c_int :: 600 +_XOPEN_XCU_VERSION c_int :: 4 +_POSIX_CHOWN_RESTRICTED c_long :: 200112 +_POSIX_FSYNC c_long :: 200112 +_POSIX_IPV6 c_long :: 200112 +_POSIX_JOB_CONTROL c_long :: 200112 +_POSIX_MAPPED_FILES c_long :: 200112 +_POSIX_MEMORY_PROTECTION c_long :: 200112 +_POSIX_NO_TRUNC c_long :: 200112 +_POSIX_READER_WRITER_LOCKS c_long :: 200112 +_POSIX_REGEXP c_long :: 200112 +_POSIX_SAVED_IDS c_long :: 200112 +_POSIX_SHELL c_long :: 200112 +_POSIX_SPAWN c_long :: 200112 +_POSIX_THREAD_ATTR_STACKADDR c_long :: 200112 +_POSIX_THREAD_ATTR_STACKSIZE c_long :: 200112 +_POSIX_THREAD_PROCESS_SHARED c_long :: 200112 +_POSIX_THREAD_SAFE_FUNCTIONS c_long :: 200112 +_POSIX_THREADS c_long :: 200112 +_POSIX2_C_BIND c_long :: 200112 +_POSIX2_C_DEV c_long :: 200112 +_POSIX2_CHAR_TERM c_long :: 200112 +_POSIX2_FORT_RUN c_long :: 200112 +_POSIX2_LOCALEDEF c_long :: 200112 +_POSIX2_SW_DEV c_long :: 200112 +_POSIX2_UPE c_long :: 200112 +_SC_ARG_MAX c_int :: 1 +_SC_CHILD_MAX c_int :: 2 +_SC_CLK_TCK c_int :: 3 +_SC_NGROUPS_MAX c_int :: 4 +_SC_OPEN_MAX c_int :: 5 +_SC_JOB_CONTROL c_int :: 6 +_SC_SAVED_IDS c_int :: 7 +_SC_VERSION c_int :: 8 +_SC_BC_BASE_MAX c_int :: 9 +_SC_BC_DIM_MAX c_int :: 10 +_SC_BC_SCALE_MAX c_int :: 11 +_SC_BC_STRING_MAX c_int :: 12 +_SC_COLL_WEIGHTS_MAX c_int :: 13 +_SC_EXPR_NEST_MAX c_int :: 14 +_SC_LINE_MAX c_int :: 15 +_SC_RE_DUP_MAX c_int :: 16 +_SC_2_VERSION c_int :: 17 +_SC_2_C_BIND c_int :: 18 +_SC_2_C_DEV c_int :: 19 +_SC_2_CHAR_TERM c_int :: 20 +_SC_2_FORT_DEV c_int :: 21 +_SC_2_FORT_RUN c_int :: 22 +_SC_2_LOCALEDEF c_int :: 23 +_SC_2_SW_DEV c_int :: 24 +_SC_2_UPE c_int :: 25 +_SC_STREAM_MAX c_int :: 26 +_SC_TZNAME_MAX c_int :: 27 +_SC_ASYNCHRONOUS_IO c_int :: 28 +_SC_PAGESIZE c_int :: 29 +_SC_MEMLOCK c_int :: 30 +_SC_MEMLOCK_RANGE c_int :: 31 +_SC_MEMORY_PROTECTION c_int :: 32 +_SC_MESSAGE_PASSING c_int :: 33 +_SC_PRIORITIZED_IO c_int :: 34 +_SC_PRIORITY_SCHEDULING c_int :: 35 +_SC_REALTIME_SIGNALS c_int :: 36 +_SC_SEMAPHORES c_int :: 37 +_SC_FSYNC c_int :: 38 +_SC_SHARED_MEMORY_OBJECTS c_int :: 39 +_SC_SYNCHRONIZED_IO c_int :: 40 +_SC_TIMERS c_int :: 41 +_SC_AIO_LISTIO_MAX c_int :: 42 +_SC_AIO_MAX c_int :: 43 +_SC_AIO_PRIO_DELTA_MAX c_int :: 44 +_SC_DELAYTIMER_MAX c_int :: 45 +_SC_MQ_OPEN_MAX c_int :: 46 +_SC_MAPPED_FILES c_int :: 47 +_SC_RTSIG_MAX c_int :: 48 +_SC_SEM_NSEMS_MAX c_int :: 49 +_SC_SEM_VALUE_MAX c_int :: 50 +_SC_SIGQUEUE_MAX c_int :: 51 +_SC_TIMER_MAX c_int :: 52 +_SC_NPROCESSORS_CONF c_int :: 57 +_SC_NPROCESSORS_ONLN c_int :: 58 +_SC_2_PBS c_int :: 59 +_SC_2_PBS_ACCOUNTING c_int :: 60 +_SC_2_PBS_CHECKPOINT c_int :: 61 +_SC_2_PBS_LOCATE c_int :: 62 +_SC_2_PBS_MESSAGE c_int :: 63 +_SC_2_PBS_TRACK c_int :: 64 +_SC_ADVISORY_INFO c_int :: 65 +_SC_BARRIERS c_int :: 66 +_SC_CLOCK_SELECTION c_int :: 67 +_SC_CPUTIME c_int :: 68 +_SC_FILE_LOCKING c_int :: 69 +_SC_GETGR_R_SIZE_MAX c_int :: 70 +_SC_GETPW_R_SIZE_MAX c_int :: 71 +_SC_HOST_NAME_MAX c_int :: 72 +_SC_LOGIN_NAME_MAX c_int :: 73 +_SC_MONOTONIC_CLOCK c_int :: 74 +_SC_MQ_PRIO_MAX c_int :: 75 +_SC_READER_WRITER_LOCKS c_int :: 76 +_SC_REGEXP c_int :: 77 +_SC_SHELL c_int :: 78 +_SC_SPAWN c_int :: 79 +_SC_SPIN_LOCKS c_int :: 80 +_SC_SPORADIC_SERVER c_int :: 81 +_SC_THREAD_ATTR_STACKADDR c_int :: 82 +_SC_THREAD_ATTR_STACKSIZE c_int :: 83 +_SC_THREAD_CPUTIME c_int :: 84 +_SC_THREAD_DESTRUCTOR_ITERATIONS c_int :: 85 +_SC_THREAD_KEYS_MAX c_int :: 86 +_SC_THREAD_PRIO_INHERIT c_int :: 87 +_SC_THREAD_PRIO_PROTECT c_int :: 88 +_SC_THREAD_PRIORITY_SCHEDULING c_int :: 89 +_SC_THREAD_PROCESS_SHARED c_int :: 90 +_SC_THREAD_SAFE_FUNCTIONS c_int :: 91 +_SC_THREAD_SPORADIC_SERVER c_int :: 92 +_SC_THREAD_STACK_MIN c_int :: 93 +_SC_THREAD_THREADS_MAX c_int :: 94 +_SC_TIMEOUTS c_int :: 95 +_SC_THREADS c_int :: 96 +_SC_TRACE c_int :: 97 +_SC_TRACE_EVENT_FILTER c_int :: 98 +_SC_TRACE_INHERIT c_int :: 99 +_SC_TRACE_LOG c_int :: 100 +_SC_TTY_NAME_MAX c_int :: 101 +_SC_TYPED_MEMORY_OBJECTS c_int :: 102 +_SC_V6_ILP32_OFF32 c_int :: 103 +_SC_V6_ILP32_OFFBIG c_int :: 104 +_SC_V6_LP64_OFF64 c_int :: 105 +_SC_V6_LPBIG_OFFBIG c_int :: 106 +_SC_IPV6 c_int :: 118 +_SC_RAW_SOCKETS c_int :: 119 +_SC_SYMLOOP_MAX c_int :: 120 +_SC_ATEXIT_MAX c_int :: 107 +_SC_IOV_MAX c_int :: 56 +_SC_XOPEN_CRYPT c_int :: 108 +_SC_XOPEN_ENH_I18N c_int :: 109 +_SC_XOPEN_LEGACY c_int :: 110 +_SC_XOPEN_REALTIME c_int :: 111 +_SC_XOPEN_REALTIME_THREADS c_int :: 112 +_SC_XOPEN_SHM c_int :: 113 +_SC_XOPEN_STREAMS c_int :: 114 +_SC_XOPEN_UNIX c_int :: 115 +_SC_XOPEN_VERSION c_int :: 116 +_SC_XOPEN_XCU_VERSION c_int :: 121 +_SC_XBS5_ILP32_OFF32 c_int :: 122 +_SC_XBS5_ILP32_OFFBIG c_int :: 123 +_SC_XBS5_LP64_OFF64 c_int :: 124 +_SC_XBS5_LPBIG_OFFBIG c_int :: 125 +_SC_SS_REPL_MAX c_int :: 126 +_SC_TRACE_EVENT_NAME_MAX c_int :: 127 +_SC_TRACE_NAME_MAX c_int :: 128 +_SC_TRACE_SYS_MAX c_int :: 129 +_SC_TRACE_USER_EVENT_MAX c_int :: 130 +_SC_PASS_MAX c_int :: 131 +_SC_PHYS_PAGES c_int :: 200 +_CS_POSIX_V6_ILP32_OFF32_CFLAGS c_int :: 2 +_CS_POSIX_V6_ILP32_OFF32_LDFLAGS c_int :: 3 +_CS_POSIX_V6_ILP32_OFF32_LIBS c_int :: 4 +_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS c_int :: 5 +_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS c_int :: 6 +_CS_POSIX_V6_ILP32_OFFBIG_LIBS c_int :: 7 +_CS_POSIX_V6_LP64_OFF64_CFLAGS c_int :: 8 +_CS_POSIX_V6_LP64_OFF64_LDFLAGS c_int :: 9 +_CS_POSIX_V6_LP64_OFF64_LIBS c_int :: 10 +_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS c_int :: 11 +_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS c_int :: 12 +_CS_POSIX_V6_LPBIG_OFFBIG_LIBS c_int :: 13 +_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS c_int :: 14 +_CS_XBS5_ILP32_OFF32_CFLAGS c_int :: 20 +_CS_XBS5_ILP32_OFF32_LDFLAGS c_int :: 21 +_CS_XBS5_ILP32_OFF32_LIBS c_int :: 22 +_CS_XBS5_ILP32_OFF32_LINTFLAGS c_int :: 23 +_CS_XBS5_ILP32_OFFBIG_CFLAGS c_int :: 24 +_CS_XBS5_ILP32_OFFBIG_LDFLAGS c_int :: 25 +_CS_XBS5_ILP32_OFFBIG_LIBS c_int :: 26 +_CS_XBS5_ILP32_OFFBIG_LINTFLAGS c_int :: 27 +_CS_XBS5_LP64_OFF64_CFLAGS c_int :: 28 +_CS_XBS5_LP64_OFF64_LDFLAGS c_int :: 29 +_CS_XBS5_LP64_OFF64_LIBS c_int :: 30 +_CS_XBS5_LP64_OFF64_LINTFLAGS c_int :: 31 +_CS_XBS5_LPBIG_OFFBIG_CFLAGS c_int :: 32 +_CS_XBS5_LPBIG_OFFBIG_LDFLAGS c_int :: 33 +_CS_XBS5_LPBIG_OFFBIG_LIBS c_int :: 34 +_CS_XBS5_LPBIG_OFFBIG_LINTFLAGS c_int :: 35 +_CS_DARWIN_USER_DIR c_int :: 65536 +_CS_DARWIN_USER_TEMP_DIR c_int :: 65537 +_CS_DARWIN_USER_CACHE_DIR c_int :: 65538 +F_ULOCK c_int :: 0 +F_LOCK c_int :: 1 +F_TLOCK c_int :: 2 +F_TEST c_int :: 3 +SYNC_VOLUME_FULLSYNC c_int :: 1 +SYNC_VOLUME_WAIT c_int :: 2 + +getattrlistbulk c_func(_ c_int, _ ?*mut anyopaque, _ ?*mut anyopaque, _ c_ulong, _ c_ulonglong) c_int +getattrlistat c_func(_ c_int, _ ?*c_char, _ ?*mut anyopaque, _ ?*mut anyopaque, _ c_ulong, _ c_ulong) c_int +setattrlistat c_func(_ c_int, _ ?*c_char, _ ?*mut anyopaque, _ ?*mut anyopaque, _ c_ulong, _ c_uint) c_int +freadlink c_func(_ c_int, _ ?*mut c_char, _ c_ulong) c_long +faccessat c_func(_ c_int, _ ?*c_char, _ c_int, _ c_int) c_int +fchownat c_func(_ c_int, _ ?*c_char, _ c_uint, _ c_uint, _ c_int) c_int +linkat c_func(_ c_int, _ ?*c_char, _ c_int, _ ?*c_char, _ c_int) c_int +readlinkat c_func(_ c_int, _ ?*c_char, _ ?*mut c_char, _ c_ulong) c_long +symlinkat c_func(_ ?*c_char, _ c_int, _ ?*c_char) c_int +unlinkat c_func(_ c_int, _ ?*c_char, _ c_int) c_int +_exit c_func(_ c_int) void +access c_func(_ ?*c_char, _ c_int) c_int +alarm c_func(_ c_uint) c_uint +chdir c_func(_ ?*c_char) c_int +chown c_func(_ ?*c_char, _ c_uint, _ c_uint) c_int +close c_func(_ c_int) c_int +dup c_func(_ c_int) c_int +dup2 c_func(_ c_int, _ c_int) c_int +execl c_func(__path ?*c_char, __arg0 ?*c_char, ...) c_int +execle c_func(__path ?*c_char, __arg0 ?*c_char, ...) c_int +execlp c_func(__file ?*c_char, __arg0 ?*c_char, ...) c_int +execv c_func(__path ?*c_char, __argv ?*?*mut c_char) c_int +execve c_func(__file ?*c_char, __argv ?*?*mut c_char, __envp ?*?*mut c_char) c_int +execvp c_func(__file ?*c_char, __argv ?*?*mut c_char) c_int +fork c_func() c_int +fpathconf c_func(_ c_int, _ c_int) c_long +getcwd c_func(_ ?*mut c_char, __size c_ulong) ?*mut c_char +getegid c_func() c_uint +geteuid c_func() c_uint +getgid c_func() c_uint +getgroups c_func(__gidsetsize c_int, _ ?*mut c_uint) c_int +getlogin c_func() ?*mut c_char +getpgrp c_func() c_int +getpid c_func() c_int +getppid c_func() c_int +getuid c_func() c_uint +isatty c_func(_ c_int) c_int +link c_func(_ ?*c_char, _ ?*c_char) c_int +lseek c_func(_ c_int, _ c_longlong, _ c_int) c_longlong +pathconf c_func(_ ?*c_char, _ c_int) c_long +pause c_func() c_int +pipe c_func(_ ?*mut c_int) c_int +read c_func(_ c_int, _ ?*mut anyopaque, __nbyte c_ulong) c_long +rmdir c_func(_ ?*c_char) c_int +setgid c_func(_ c_uint) c_int +setpgid c_func(_ c_int, _ c_int) c_int +setsid c_func() c_int +setuid c_func(_ c_uint) c_int +sleep c_func(_ c_uint) c_uint +sysconf c_func(_ c_int) c_long +tcgetpgrp c_func(_ c_int) c_int +tcsetpgrp c_func(_ c_int, _ c_int) c_int +ttyname c_func(_ c_int) ?*mut c_char +ttyname_r c_func(_ c_int, _ ?*mut c_char, __len c_ulong) c_int +unlink c_func(_ ?*c_char) c_int +write c_func(__fd c_int, __buf ?*anyopaque, __nbyte c_ulong) c_long +confstr c_func(_ c_int, _ ?*mut c_char, __len c_ulong) c_ulong +getopt c_func(__argc c_int, _ ?*?*mut c_char, _ ?*c_char) c_int +brk c_func(_ ?*anyopaque) ?*mut anyopaque +chroot c_func(_ ?*c_char) c_int +crypt c_func(_ ?*c_char, _ ?*c_char) ?*mut c_char +encrypt c_func(_ ?*mut c_char, _ c_int) void +fchdir c_func(_ c_int) c_int +gethostid c_func() c_long +getpgid c_func(_ c_int) c_int +getsid c_func(_ c_int) c_int +getdtablesize c_func() c_int +getpagesize c_func() c_int +getpass c_func(_ ?*c_char) ?*mut c_char +getwd c_func(_ ?*mut c_char) ?*mut c_char +lchown c_func(_ ?*c_char, _ c_uint, _ c_uint) c_int +lockf c_func(_ c_int, _ c_int, _ c_longlong) c_int +nice c_func(_ c_int) c_int +pread c_func(__fd c_int, __buf ?*mut anyopaque, __nbyte c_ulong, __offset c_longlong) c_long +pwrite c_func(__fd c_int, __buf ?*anyopaque, __nbyte c_ulong, __offset c_longlong) c_long +sbrk c_func(_ c_int) ?*mut anyopaque +setpgrp c_func() c_int +setregid c_func(_ c_uint, _ c_uint) c_int +setreuid c_func(_ c_uint, _ c_uint) c_int +swab c_func(_ ?*anyopaque, _ ?*mut anyopaque, __nbytes c_long) void +sync c_func() void +truncate c_func(_ ?*c_char, _ c_longlong) c_int +ualarm c_func(_ c_uint, _ c_uint) c_uint +usleep c_func(_ c_uint) c_int +vfork c_func() c_int +fsync c_func(_ c_int) c_int +ftruncate c_func(_ c_int, _ c_longlong) c_int +getlogin_r c_func(_ ?*mut c_char, __namelen c_ulong) c_int +fchown c_func(_ c_int, _ c_uint, _ c_uint) c_int +gethostname c_func(_ ?*mut c_char, __namelen c_ulong) c_int +readlink c_func(_ ?*c_char, _ ?*mut c_char, __bufsize c_ulong) c_long +setegid c_func(_ c_uint) c_int +seteuid c_func(_ c_uint) c_int +symlink c_func(_ ?*c_char, _ ?*c_char) c_int +__darwin_check_fd_set_overflow c_func(_ c_int, _ ?*anyopaque, _ c_int) c_int +__darwin_check_fd_set c_func(_a c_int, _b ?*anyopaque) c_int +__darwin_fd_isset c_func(_fd c_int, _p ?*fd_set) c_int +__darwin_fd_set c_func(_fd c_int, _p ?*mut fd_set) void +__darwin_fd_clr c_func(_fd c_int, _p ?*mut fd_set) void +pselect c_func(_ c_int, _ ?*mut fd_set, _ ?*mut fd_set, _ ?*mut fd_set, _ ?*timespec, _ ?*c_uint) c_int +select c_func(_ c_int, _ ?*mut fd_set, _ ?*mut fd_set, _ ?*mut fd_set, _ ?*mut timeval) c_int +accessx_np c_func(_ ?*accessx_descriptor, __sz c_ulong, _ ?*mut c_int, _ c_uint) c_int +acct c_func(_ ?*c_char) c_int +add_profil c_func(_ ?*mut c_char, __bufsiz c_ulong, _ c_ulong, _ c_uint) c_int +endusershell c_func() void +execvP c_func(__file ?*c_char, __searchpath ?*c_char, __argv ?*?*mut c_char) c_int +fflagstostr c_func(_ c_ulong) ?*mut c_char +getdomainname c_func(_ ?*mut c_char, __namelen c_int) c_int +getgrouplist c_func(_ ?*c_char, _ c_int, _ ?*mut c_int, __ngroups ?*mut c_int) c_int +gethostuuid c_func(_ ?*mut c_uchar, _ ?*timespec) c_int +getmode c_func(_ ?*anyopaque, _ c_ushort) c_ushort +getpeereid c_func(_ c_int, _ ?*mut c_uint, _ ?*mut c_uint) c_int +getsgroups_np c_func(_ ?*mut c_int, _ ?*mut c_uchar) c_int +getusershell c_func() ?*mut c_char +getwgroups_np c_func(_ ?*mut c_int, _ ?*mut c_uchar) c_int +initgroups c_func(_ ?*c_char, _ c_int) c_int +issetugid c_func() c_int +mkdtemp c_func(_ ?*mut c_char) ?*mut c_char +mknod c_func(_ ?*c_char, _ c_ushort, _ c_int) c_int +mkpath_np c_func(path ?*c_char, omode c_ushort) c_int +mkpathat_np c_func(dfd c_int, path ?*c_char, omode c_ushort) c_int +mkstemps c_func(_ ?*mut c_char, _ c_int) c_int +mkostemp c_func(path ?*mut c_char, oflags c_int) c_int +mkostemps c_func(path ?*mut c_char, slen c_int, oflags c_int) c_int +mkstemp_dprotected_np c_func(path ?*mut c_char, dpclass c_int, dpflags c_int) c_int +mkdtempat_np c_func(dfd c_int, path ?*mut c_char) ?*mut c_char +mkstempsat_np c_func(dfd c_int, path ?*mut c_char, slen c_int) c_int +mkostempsat_np c_func(dfd c_int, path ?*mut c_char, slen c_int, oflags c_int) c_int +nfssvc c_func(_ c_int, _ ?*mut anyopaque) c_int +profil c_func(_ ?*mut c_char, __bufsiz c_ulong, _ c_ulong, _ c_uint) c_int +pthread_setugid_np c_func(_ c_uint, _ c_uint) c_int +pthread_getugid_np c_func(_ ?*mut c_uint, _ ?*mut c_uint) c_int +reboot c_func(_ c_int) c_int +revoke c_func(_ ?*c_char) c_int +rcmd c_func(_ ?*mut ?*mut c_char, _ c_int, _ ?*c_char, _ ?*c_char, _ ?*c_char, _ ?*mut c_int) c_int +rcmd_af c_func(_ ?*mut ?*mut c_char, _ c_int, _ ?*c_char, _ ?*c_char, _ ?*c_char, _ ?*mut c_int, _ c_int) c_int +rresvport c_func(_ ?*mut c_int) c_int +rresvport_af c_func(_ ?*mut c_int, _ c_int) c_int +iruserok c_func(_ c_ulong, _ c_int, _ ?*c_char, _ ?*c_char) c_int +iruserok_sa c_func(_ ?*anyopaque, _ c_int, _ c_int, _ ?*c_char, _ ?*c_char) c_int +ruserok c_func(_ ?*c_char, _ c_int, _ ?*c_char, _ ?*c_char) c_int +setdomainname c_func(_ ?*c_char, __namelen c_int) c_int +setgroups c_func(_ c_int, _ ?*c_uint) c_int +sethostid c_func(_ c_long) void +sethostname c_func(_ ?*c_char, __namelen c_int) c_int +setlogin c_func(_ ?*c_char) c_int +setmode c_func(_ ?*c_char) ?*mut anyopaque +setrgid c_func(_ c_uint) c_int +setruid c_func(_ c_uint) c_int +setsgroups_np c_func(_ c_int, _ ?*mut c_uchar) c_int +setusershell c_func() void +setwgroups_np c_func(_ c_int, _ ?*mut c_uchar) c_int +strtofflags c_func(_ ?*mut ?*mut c_char, _ ?*mut c_ulong, _ ?*mut c_ulong) c_int +swapon c_func(_ ?*c_char) c_int +ttyslot c_func() c_int +undelete c_func(_ ?*c_char) c_int +unwhiteout c_func(_ ?*c_char) c_int +syscall c_func(_ c_int, ...) c_int +fgetattrlist c_func(_ c_int, _ ?*mut anyopaque, _ ?*mut anyopaque, __attrBufSize c_ulong, _ c_uint) c_int +fsetattrlist c_func(_ c_int, _ ?*mut anyopaque, _ ?*mut anyopaque, __attrBufSize c_ulong, _ c_uint) c_int +getattrlist c_func(_ ?*c_char, _ ?*mut anyopaque, _ ?*mut anyopaque, __attrBufSize c_ulong, _ c_uint) c_int +setattrlist c_func(_ ?*c_char, _ ?*mut anyopaque, _ ?*mut anyopaque, __attrBufSize c_ulong, _ c_uint) c_int +exchangedata c_func(_ ?*c_char, _ ?*c_char, _ c_uint) c_int +getdirentriesattr c_func(_ c_int, _ ?*mut anyopaque, _ ?*mut anyopaque, __attrBufSize c_ulong, _ ?*mut c_uint, _ ?*mut c_uint, _ ?*mut c_uint, _ c_uint) c_int +searchfs c_func(_ ?*c_char, _ ?*mut fssearchblock, _ ?*mut c_ulong, _ c_uint, _ c_uint, _ ?*mut searchstate) c_int +fsctl c_func(_ ?*c_char, _ c_ulong, _ ?*mut anyopaque, _ c_uint) c_int +ffsctl c_func(_ c_int, _ c_ulong, _ ?*mut anyopaque, _ c_uint) c_int +fsync_volume_np c_func(_ c_int, _ c_int) c_int +sync_volume_np c_func(_ ?*c_char, _ c_int) c_int + +# unsupported in bindings: external variable 'optarg' has no native spelling +# unsupported in bindings: external variable 'optind' has no native spelling +# unsupported in bindings: external variable 'opterr' has no native spelling +# unsupported in bindings: external variable 'optopt' has no native spelling +# unsupported in bindings: external variable 'suboptarg' has no native spelling +# unsupported in bindings: external variable 'optreset' has no native spelling +# unsupported in bindings: _UNISTD_H_ — C macro has no replacement value +# unsupported in bindings: _LIBC_BOUNDS_H_ — C macro has no replacement value +# unsupported in bindings: _CDEFS_H_ — C macro has no replacement value +# unsupported in bindings: _LIBC_COUNT — C function-like macros are not supported +# unsupported in bindings: _LIBC_COUNT_OR_NULL — C function-like macros are not supported +# unsupported in bindings: _LIBC_SIZE — C function-like macros are not supported +# unsupported in bindings: _LIBC_SIZE_OR_NULL — C function-like macros are not supported +# unsupported in bindings: _LIBC_ENDED_BY — C function-like macros are not supported +# unsupported in bindings: _LIBC_SINGLE — C macro has no replacement value +# unsupported in bindings: _LIBC_UNSAFE_INDEXABLE — C macro has no replacement value +# unsupported in bindings: _LIBC_CSTR — C macro has no replacement value +# unsupported in bindings: _LIBC_NULL_TERMINATED — C macro has no replacement value +# unsupported in bindings: _LIBC_FLEX_COUNT — C function-like macros are not supported +# unsupported in bindings: _LIBC_SINGLE_BY_DEFAULT — C function-like macros are not supported +# unsupported in bindings: _LIBC_PTRCHECK_REPLACED — C function-like macros are not supported +# unsupported in bindings: _LIBC_FORGE_PTR — C function-like macros are not supported +# unsupported in bindings: _SYS__TYPES_H_ — C macro has no replacement value +# unsupported in bindings: _BSD_MACHINE__TYPES_H_ — C macro has no replacement value +# unsupported in bindings: _BSD_ARM__TYPES_H_ — C macro has no replacement value +# unsupported in bindings: _SYS__PTHREAD_TYPES_H_ — C macro has no replacement value +# unsupported in bindings: _SYS_UNISTD_H_ — C macro has no replacement value +# unsupported in bindings: _POSIX_VDISABLE — C macro is not a supported constant +# unsupported in bindings: X_OK — C macro is not a supported constant +# unsupported in bindings: W_OK — C macro is not a supported constant +# unsupported in bindings: R_OK — C macro is not a supported constant +# unsupported in bindings: _READ_OK — C macro is not a supported constant +# unsupported in bindings: _WRITE_OK — C macro is not a supported constant +# unsupported in bindings: _EXECUTE_OK — C macro is not a supported constant +# unsupported in bindings: _DELETE_OK — C macro is not a supported constant +# unsupported in bindings: _APPEND_OK — C macro is not a supported constant +# unsupported in bindings: _RMFILE_OK — C macro is not a supported constant +# unsupported in bindings: _RATTR_OK — C macro is not a supported constant +# unsupported in bindings: _WATTR_OK — C macro is not a supported constant +# unsupported in bindings: _REXT_OK — C macro is not a supported constant +# unsupported in bindings: _WEXT_OK — C macro is not a supported constant +# unsupported in bindings: _RPERM_OK — C macro is not a supported constant +# unsupported in bindings: _WPERM_OK — C macro is not a supported constant +# unsupported in bindings: _CHOWN_OK — C macro is not a supported constant +# unsupported in bindings: _ACCESS_EXTENDED_MASK — C macro is not a supported constant +# unsupported in bindings: _SEEK_SET_H_ — C macro has no replacement value +# unsupported in bindings: L_SET — C macro is not a supported constant +# unsupported in bindings: L_INCR — C macro is not a supported constant +# unsupported in bindings: L_XTND — C macro is not a supported constant +# unsupported in bindings: ACCESSX_MAX_TABLESIZE — C macro is not a supported constant +# unsupported in bindings: _SIZE_T — C macro has no replacement value +# unsupported in bindings: _SSIZE_T — C macro has no replacement value +# unsupported in bindings: _BSD_MACHINE_TYPES_H_ — C macro has no replacement value +# unsupported in bindings: _ARM_MACHTYPES_H_ — C macro has no replacement value +# unsupported in bindings: _MACHTYPES_H_ — C macro has no replacement value +# unsupported in bindings: _INT8_T — C macro has no replacement value +# unsupported in bindings: _INT16_T — C macro has no replacement value +# unsupported in bindings: _INT32_T — C macro has no replacement value +# unsupported in bindings: _INT64_T — C macro has no replacement value +# unsupported in bindings: _U_INT8_T — C macro has no replacement value +# unsupported in bindings: _U_INT16_T — C macro has no replacement value +# unsupported in bindings: _U_INT32_T — C macro has no replacement value +# unsupported in bindings: _U_INT64_T — C macro has no replacement value +# unsupported in bindings: _INTPTR_T — C macro has no replacement value +# unsupported in bindings: _UINTPTR_T — C macro has no replacement value +# unsupported in bindings: USER_ADDR_NULL — C macro is not a supported constant +# unsupported in bindings: CAST_USER_ADDR_T — C function-like macros are not supported +# unsupported in bindings: _UINT64_T — C macro has no replacement value +# unsupported in bindings: _UINT32_T — C macro has no replacement value +# unsupported in bindings: MAC_OS_X_VERSION_10_0 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_1 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_2 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_3 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_4 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_5 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_6 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_7 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_8 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_9 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_10 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_10_2 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_10_3 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_11 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_11_2 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_11_3 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_11_4 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_12 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_12_1 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_12_2 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_12_4 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_13 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_13_1 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_13_2 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_13_4 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_14 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_14_1 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_14_4 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_14_5 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_14_6 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_15 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_15_1 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_15_4 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_X_VERSION_10_16 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_11_0 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_11_1 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_11_3 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_11_4 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_11_5 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_11_6 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_12_0 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_12_1 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_12_2 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_12_3 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_12_4 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_12_5 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_12_6 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_12_7 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_13_0 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_13_1 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_13_2 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_13_3 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_13_4 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_13_5 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_13_6 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_13_7 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_14_0 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_14_1 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_14_2 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_14_3 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_14_4 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_14_5 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_14_6 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_14_7 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_15_0 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_15_1 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_15_2 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_15_3 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_15_4 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_15_5 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_15_6 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_16_0 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_26_0 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_26_1 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_26_2 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_26_3 — C macro is not a supported constant +# unsupported in bindings: MAC_OS_VERSION_26_4 — C macro is not a supported constant +# unsupported in bindings: _UID_T — C macro has no replacement value +# unsupported in bindings: _GID_T — C macro has no replacement value +# unsupported in bindings: _LIBC_COUNT__PATH_MAX — C macro is not a supported constant +# unsupported in bindings: _OFF_T — C macro has no replacement value +# unsupported in bindings: _PID_T — C macro has no replacement value +# unsupported in bindings: _USECONDS_T — C macro has no replacement value +# unsupported in bindings: NULL — C macro is not a supported constant +# unsupported in bindings: _POSIX_ADVISORY_INFO — C macro is not a supported constant +# unsupported in bindings: _POSIX_ASYNCHRONOUS_IO — C macro is not a supported constant +# unsupported in bindings: _POSIX_BARRIERS — C macro is not a supported constant +# unsupported in bindings: _POSIX_CLOCK_SELECTION — C macro is not a supported constant +# unsupported in bindings: _POSIX_CPUTIME — C macro is not a supported constant +# unsupported in bindings: _POSIX_MEMLOCK — C macro is not a supported constant +# unsupported in bindings: _POSIX_MEMLOCK_RANGE — C macro is not a supported constant +# unsupported in bindings: _POSIX_MESSAGE_PASSING — C macro is not a supported constant +# unsupported in bindings: _POSIX_MONOTONIC_CLOCK — C macro is not a supported constant +# unsupported in bindings: _POSIX_PRIORITIZED_IO — C macro is not a supported constant +# unsupported in bindings: _POSIX_PRIORITY_SCHEDULING — C macro is not a supported constant +# unsupported in bindings: _POSIX_RAW_SOCKETS — C macro is not a supported constant +# unsupported in bindings: _POSIX_REALTIME_SIGNALS — C macro is not a supported constant +# unsupported in bindings: _POSIX_SEMAPHORES — C macro is not a supported constant +# unsupported in bindings: _POSIX_SHARED_MEMORY_OBJECTS — C macro is not a supported constant +# unsupported in bindings: _POSIX_SPIN_LOCKS — C macro is not a supported constant +# unsupported in bindings: _POSIX_SPORADIC_SERVER — C macro is not a supported constant +# unsupported in bindings: _POSIX_SYNCHRONIZED_IO — C macro is not a supported constant +# unsupported in bindings: _POSIX_THREAD_CPUTIME — C macro is not a supported constant +# unsupported in bindings: _POSIX_THREAD_PRIO_INHERIT — C macro is not a supported constant +# unsupported in bindings: _POSIX_THREAD_PRIO_PROTECT — C macro is not a supported constant +# unsupported in bindings: _POSIX_THREAD_PRIORITY_SCHEDULING — C macro is not a supported constant +# unsupported in bindings: _POSIX_THREAD_SPORADIC_SERVER — C macro is not a supported constant +# unsupported in bindings: _POSIX_TIMEOUTS — C macro is not a supported constant +# unsupported in bindings: _POSIX_TIMERS — C macro is not a supported constant +# unsupported in bindings: _POSIX_TRACE — C macro is not a supported constant +# unsupported in bindings: _POSIX_TRACE_EVENT_FILTER — C macro is not a supported constant +# unsupported in bindings: _POSIX_TRACE_INHERIT — C macro is not a supported constant +# unsupported in bindings: _POSIX_TRACE_LOG — C macro is not a supported constant +# unsupported in bindings: _POSIX_TYPED_MEMORY_OBJECTS — C macro is not a supported constant +# unsupported in bindings: _POSIX2_FORT_DEV — C macro is not a supported constant +# unsupported in bindings: _POSIX2_PBS — C macro is not a supported constant +# unsupported in bindings: _POSIX2_PBS_ACCOUNTING — C macro is not a supported constant +# unsupported in bindings: _POSIX2_PBS_CHECKPOINT — C macro is not a supported constant +# unsupported in bindings: _POSIX2_PBS_LOCATE — C macro is not a supported constant +# unsupported in bindings: _POSIX2_PBS_MESSAGE — C macro is not a supported constant +# unsupported in bindings: _POSIX2_PBS_TRACK — C macro is not a supported constant +# unsupported in bindings: _POSIX_V6_ILP32_OFF32 — C macro is not a supported constant +# unsupported in bindings: _POSIX_V6_ILP32_OFFBIG — C macro is not a supported constant +# unsupported in bindings: _POSIX_V6_LP64_OFF64 — C macro is not a supported constant +# unsupported in bindings: _POSIX_V6_LPBIG_OFFBIG — C macro is not a supported constant +# unsupported in bindings: _POSIX_V7_ILP32_OFF32 — C macro is not a supported constant +# unsupported in bindings: _POSIX_V7_ILP32_OFFBIG — C macro is not a supported constant +# unsupported in bindings: _POSIX_V7_LP64_OFF64 — C macro is not a supported constant +# unsupported in bindings: _POSIX_V7_LPBIG_OFFBIG — C macro is not a supported constant +# unsupported in bindings: _V6_ILP32_OFF32 — C macro is not a supported constant +# unsupported in bindings: _V6_ILP32_OFFBIG — C macro is not a supported constant +# unsupported in bindings: _V6_LP64_OFF64 — C macro is not a supported constant +# unsupported in bindings: _V6_LPBIG_OFFBIG — C macro is not a supported constant +# unsupported in bindings: _XBS5_ILP32_OFF32 — C macro is not a supported constant +# unsupported in bindings: _XBS5_ILP32_OFFBIG — C macro is not a supported constant +# unsupported in bindings: _XBS5_LP64_OFF64 — C macro is not a supported constant +# unsupported in bindings: _XBS5_LPBIG_OFFBIG — C macro is not a supported constant +# unsupported in bindings: _XOPEN_CRYPT — C macro is not a supported constant +# unsupported in bindings: _XOPEN_ENH_I18N — C macro is not a supported constant +# unsupported in bindings: _XOPEN_LEGACY — C macro is not a supported constant +# unsupported in bindings: _XOPEN_REALTIME — C macro is not a supported constant +# unsupported in bindings: _XOPEN_REALTIME_THREADS — C macro is not a supported constant +# unsupported in bindings: _XOPEN_SHM — C macro is not a supported constant +# unsupported in bindings: _XOPEN_STREAMS — C macro is not a supported constant +# unsupported in bindings: _XOPEN_UNIX — C macro is not a supported constant +# unsupported in bindings: _SC_PAGE_SIZE — C macro is not a supported constant +# unsupported in bindings: _CTERMID_H_ — C macro has no replacement value +# unsupported in bindings: _LIBC_COUNT__L_CTERMID — C macro is not a supported constant +# unsupported in bindings: _SYS_SELECT_H_ — C macro has no replacement value +# unsupported in bindings: _FD_SET — C macro has no replacement value +# unsupported in bindings: _STRUCT_TIMESPEC — C macro is not a supported constant +# unsupported in bindings: _STRUCT_TIMEVAL — C macro is not a supported constant +# unsupported in bindings: _TIME_T — C macro has no replacement value +# unsupported in bindings: _SUSECONDS_T — C macro has no replacement value +# unsupported in bindings: _SIGSET_T — C macro has no replacement value +# unsupported in bindings: FD_SETSIZE — C macro is not a supported constant +# unsupported in bindings: FD_SET — C function-like macros are not supported +# unsupported in bindings: FD_CLR — C function-like macros are not supported +# unsupported in bindings: FD_ISSET — C function-like macros are not supported +# unsupported in bindings: FD_ZERO — C function-like macros are not supported +# unsupported in bindings: FD_COPY — C function-like macros are not supported +# unsupported in bindings: _SYS__SELECT_H_ — C macro has no replacement value +# unsupported in bindings: _DEV_T — C macro has no replacement value +# unsupported in bindings: _MODE_T — C macro has no replacement value +# unsupported in bindings: _UUID_T — C macro has no replacement value diff --git a/std/debug/debug.hon b/std/debug/debug.hon index ecaaeeb..edb7e87 100644 --- a/std/debug/debug.hon +++ b/std/debug/debug.hon @@ -1,36 +1,28 @@ import "@ffi/c" import "@std/io" -hide write func(_ ?*mut anyopaque, _ io.WriteStream, bytes []u8) usize ! io.WriteError { +print func($format []u8, $Args type, args Args) void { + writer io.Writer :: io.Writer{ + context = none, + handle = io.Handle{ file_desc = c_int(io.Stream.stderr) }, + write = write, + } + io.print(writer, format, Args, args) catch |_| {} +} + +hide write func(_ ?@mut anyopaque, handle io.Handle, bytes []u8) usize ! io.WriteError { request usize = bytes.len maximum usize :: usize(maxval!(c_long)) if request > maximum { request = maximum } while true { - count c_long :: c.write(2, bytes.ptr, c_ulong(request)) + count c_long :: c.write(handle.file_desc, bytes.ptr, c_ulong(request)) if count >= 0 { return usize(count) } - if c.__error()^ != 4 { + if c.__error()?^ != c.EINTR { return .write_failed } } } - -hide read func(_ ?*mut anyopaque, _ io.ReadStream, _ []mut u8) usize ! io.ReadError { - return .read_failed -} - -hide vtable io.IoVTable :: io.IoVTable { - read = read, - write = write, -} - -print func($format []u8, $Args type, args Args) void { - writer io.Writer :: io.Writer { - impl = io.Io {context = none, vtable = &vtable}, - stream = .stderr, - } - io.print(writer, format, Args, args) catch |_| {} -} diff --git a/std/io/file.hon b/std/io/file.hon new file mode 100644 index 0000000..9e98b05 --- /dev/null +++ b/std/io/file.hon @@ -0,0 +1,144 @@ +import "@ffi/c" + +File :: struct { + io Io + handle Handle +} + +FileMode :: enum { + read_only + write_only + read_write +} + +OpenError :: enum { + open_failed +} + +CloseError :: enum { + close_failed +} + +open func(io Io, path [;0]u8, mode FileMode) File ! OpenError { + handle Handle :: io.vtable.open(io.context, path, mode) catch |err| { + return err + } + return File {io = io, handle = handle} +} + +close func(file File) void ! CloseError { + try file.io.vtable.close(file.io.context, file.handle) +} + +reader func(file File) Reader { + return Reader { + context = file.io.context, + handle = file.handle, + read = file.io.vtable.read, + } +} + +writer func(file File) Writer { + return Writer { + context = file.io.context, + handle = file.handle, + write = file.io.vtable.write, + } +} + +hide system_read func(_ ?@mut anyopaque, handle Handle, buffer []mut u8) usize ! ReadError { + request usize = buffer.len + maximum usize :: usize(maxval!(c_long)) + if request > maximum { + request = maximum + } + while true { + count c_long :: c.read(handle.file_desc, buffer.ptr, c_ulong(request)) + if count >= 0 { + return usize(count) + } + errno c_int :: c.__error()?^ + if errno == c.EINTR { + continue + } + if errno == c.EBADF { + return .not_open_for_reading + } + return .read_failed + } +} + +hide system_write func(_ ?@mut anyopaque, handle Handle, bytes []u8) usize ! WriteError { + request usize = bytes.len + maximum usize :: usize(maxval!(c_long)) + if request > maximum { + request = maximum + } + while true { + count c_long :: c.write(handle.file_desc, bytes.ptr, c_ulong(request)) + if count >= 0 { + return usize(count) + } + errno c_int :: c.__error()?^ + if errno == c.EINTR { + continue + } + if errno == c.EBADF { + return .not_open_for_writing + } + return .write_failed + } +} + +hide system_open func(_ ?@mut anyopaque, path [;0]u8, mode FileMode) Handle ! OpenError { + flags c_int = c.O_RDONLY + match mode { + .read_only: flags = c.O_RDONLY + .write_only: flags = c.O_WRONLY + .read_write: flags = c.O_RDWR + } + while true { + fd c_int :: c.open(ptrcast!(c_char, path.ptr), flags) + if fd >= 0 { + return Handle {file_desc = fd} + } + if c.__error()?^ != c.EINTR { + return .open_failed + } + } +} + +hide system_close func(_ ?@mut anyopaque, handle Handle) void ! CloseError { + if c.close(handle.file_desc) != 0 { + return .close_failed + } +} + +hide system_stdin func(_ ?@mut anyopaque) Handle { + return Handle {file_desc = c_int(Stream.stdin)} +} + +hide system_stdout func(_ ?@mut anyopaque) Handle { + return Handle {file_desc = c_int(Stream.stdout)} +} + +hide system_stderr func(_ ?@mut anyopaque) Handle { + return Handle {file_desc = c_int(Stream.stderr)} +} + +hide system_vtable IoVTable :: IoVTable { + read = system_read, + write = system_write, + open = system_open, + close = system_close, + stdin = system_stdin, + stdout = system_stdout, + stderr = system_stderr, +} + +hide system func() Io { + return Io { + context = none, + vtable = &system_vtable, + } +} diff --git a/std/io/io.hon b/std/io/io.hon index c231018..11e2c4b 100644 --- a/std/io/io.hon +++ b/std/io/io.hon @@ -2,69 +2,80 @@ import "@ffi/c" import "@std/meta" ReadError :: enum { + not_open_for_reading read_failed } WriteError :: enum { + not_open_for_writing write_failed no_progress } +Handle :: union { + file_desc c_int + ptr @mut anyopaque +} + +Stream :: enum(c_int) { + stdin = c.STDIN_FILENO + stdout = c.STDOUT_FILENO + stderr = c.STDERR_FILENO +} + Io :: struct { - context ?*mut anyopaque + context ?@mut anyopaque vtable @IoVTable } IoVTable :: struct { - read @func(context ?*mut anyopaque, stream ReadStream, buffer []mut u8) usize ! ReadError - write @func(context ?*mut anyopaque, stream WriteStream, bytes []u8) usize ! WriteError -} - -ReadStream :: enum(c_int) { - stdin = 0 -} - -WriteStream :: enum(c_int) { - stdout = 1 - stderr = 2 + read @func(context ?@mut anyopaque, handle Handle, buffer []mut u8) usize ! ReadError + write @func(context ?@mut anyopaque, handle Handle, bytes []u8) usize ! WriteError + open @func(context ?@mut anyopaque, path [;0]u8, mode FileMode) Handle ! OpenError + close @func(context ?@mut anyopaque, handle Handle) void ! CloseError + stdin @func(context ?@mut anyopaque) Handle + stdout @func(context ?@mut anyopaque) Handle + stderr @func(context ?@mut anyopaque) Handle } Reader :: struct { - impl Io - stream ReadStream + context ?@mut anyopaque + handle Handle + read @func(context ?@mut anyopaque, handle Handle, buffer []mut u8) usize ! ReadError } Writer :: struct { - impl Io - stream WriteStream + context ?@mut anyopaque + handle Handle + write @func(context ?@mut anyopaque, handle Handle, bytes []u8) usize ! WriteError } -read func(reader Reader, buffer []mut u8) usize ! ReadError { +read func(input Reader, buffer []mut u8) usize ! ReadError { if buffer.len == 0 { return 0 } - count usize :: try reader.impl.vtable.read(reader.impl.context, reader.stream, buffer) + count usize :: try input.read(input.context, input.handle, buffer) if count > buffer.len { return .read_failed } return count } -write func(writer Writer, bytes []u8) usize ! WriteError { +write func(output Writer, bytes []u8) usize ! WriteError { if bytes.len == 0 { return 0 } - count usize :: try writer.impl.vtable.write(writer.impl.context, writer.stream, bytes) + count usize :: try output.write(output.context, output.handle, bytes) if count > bytes.len { return .write_failed } return count } -write_all func(writer Writer, bytes []u8) void ! WriteError { +write_all func(output Writer, bytes []u8) void ! WriteError { offset usize = 0 while offset < bytes.len { - count usize :: write(writer, bytes[offset..]) catch |err| { + count usize :: write(output, bytes[offset..]) catch |err| { return err } if count == 0 { @@ -75,7 +86,49 @@ write_all func(writer Writer, bytes []u8) void ! WriteError { return } -hide write_integer_signed func(writer Writer, value i64, base u64, uppercase bool) void ! WriteError { +stdin func(io Io) Reader { + return Reader { + context = io.context, + handle = io.vtable.stdin(io.context), + read = io.vtable.read, + } +} + +stdout func(io Io) Writer { + return Writer { + context = io.context, + handle = io.vtable.stdout(io.context), + write = io.vtable.write, + } +} + +stderr func(io Io) Writer { + return Writer { + context = io.context, + handle = io.vtable.stderr(io.context), + write = io.vtable.write, + } +} + +print func(output Writer, $format []u8, $Args type, args Args) void ! WriteError { + expand for parse_format(format.len, format, Args) |token| { + match token.kind { + .unused: break + .literal: try write_all(output, format[token.start..token.end]) + .string: try write_all(output, field!(args, token.field)) + .default: try write_default(output, field!(args, token.field)) + .decimal: try write_decimal(output, field!(args, token.field)) + .binary: try write_integer(output, field!(args, token.field), 2, false) + .octal: try write_integer(output, field!(args, token.field), 8, false) + .hex_lower: try write_integer(output, field!(args, token.field), 16, false) + .hex_upper: try write_integer(output, field!(args, token.field), 16, true) + .character: try write_character(output, field!(args, token.field)) + else: try write_float(output, field!(args, token.field), true) + } + } +} + +hide write_integer_signed func(output Writer, value i64, base u64, uppercase bool) void ! WriteError { buffer [65]mut u8 = undefined end usize = buffer.len current i64 = value @@ -104,11 +157,11 @@ hide write_integer_signed func(writer Writer, value i64, base u64, uppercase boo end -= 1 buffer[end] = '-' } - try write_all(writer, buffer[end..]) + try write_all(output, buffer[end..]) return } -hide write_integer_unsigned func(writer Writer, value u64, base u64, uppercase bool) void ! WriteError { +hide write_integer_unsigned func(output Writer, value u64, base u64, uppercase bool) void ! WriteError { buffer [65]mut u8 = undefined end usize = buffer.len current u64 = value @@ -127,7 +180,7 @@ hide write_integer_unsigned func(writer Writer, value u64, base u64, uppercase b break } } - try write_all(writer, buffer[end..]) + try write_all(output, buffer[end..]) return } @@ -264,12 +317,12 @@ hide format_field_name func($T type, index usize) []u8 { } } -hide write_integer func(writer Writer, $T type, value T, base u64, uppercase bool) void ! WriteError { +hide write_integer func(output Writer, $T type, value T, base u64, uppercase bool) void ! WriteError { match typeinfo!(T) { .integer: if minval!(T) < 0 { - try write_integer_signed(writer, i64(value), base, uppercase) + try write_integer_signed(output, i64(value), base, uppercase) } else { - try write_integer_unsigned(writer, u64(value), base, uppercase) + try write_integer_unsigned(output, u64(value), base, uppercase) } else: compile_error!("io.print integer format requires an integer argument") } @@ -277,7 +330,7 @@ hide write_integer func(writer Writer, $T type, value T, base u64, uppercase boo } # note: libc keeps float formatting small; replace it with a native shortest-roundtrip writer if locale independence matters. -hide write_float func(writer Writer, $T type, value T, scientific bool) void ! WriteError { +hide write_float func(output Writer, $T type, value T, scientific bool) void ! WriteError { match typeinfo!(T) { .float: { buffer [64]mut u8 = undefined @@ -296,53 +349,53 @@ hide write_float func(writer Writer, $T type, value T, scientific bool) void ! W if count < 0 or usize(count) >= buffer.len { return .write_failed } - try write_all(writer, buffer[0..usize(count)]) + try write_all(output, buffer[0..usize(count)]) } else: compile_error!("io.print float format requires a float argument") } return } -hide write_decimal func(writer Writer, $T type, value T) void ! WriteError { +hide write_decimal func(output Writer, $T type, value T) void ! WriteError { match typeinfo!(T) { - .integer: try write_integer(writer, value, 10, false) - .float: try write_float(writer, value, false) + .integer: try write_integer(output, value, 10, false) + .float: try write_float(output, value, false) else: compile_error!("io.print '{d}' requires an integer or float argument") } return } -hide write_character func(writer Writer, $T type, value T) void ! WriteError { +hide write_character func(output Writer, $T type, value T) void ! WriteError { match typeinfo!(T) { .integer: { if minval!(T) < 0 or maxval!(T) > 255 { compile_error!("io.print '{c}' requires an unsigned integer that fits in u8") } buffer [1]u8 = [u8(value)] - try write_all(writer, buffer[..]) + try write_all(output, buffer[..]) } else: compile_error!("io.print '{c}' requires an unsigned integer that fits in u8") } return } -hide write_default func(writer Writer, $T type, value T) void ! WriteError { +hide write_default func(output Writer, $T type, value T) void ! WriteError { match typeinfo!(T) { .bool: if value { - try write_all(writer, "true") + try write_all(output, "true") } else { - try write_all(writer, "false") + try write_all(output, "false") } - .integer: try write_integer(writer, value, 10, false) - .float: try write_float(writer, value, false) - .array: try write_all(writer, value) - .pointer: try write_all(writer, value) - .slice: try write_all(writer, value) + .integer: try write_integer(output, value, 10, false) + .float: try write_float(output, value, false) + .array: try write_all(output, value) + .pointer: try write_all(output, value) + .slice: try write_all(output, value) .enum |enum_info|: { - inline for enum_info.fields |field| { + expand for enum_info.fields |field| { if value == field!(T, field.name) { - try write_all(writer, ".") - try write_all(writer, field.name) + try write_all(output, ".") + try write_all(output, field.name) return } } @@ -352,68 +405,3 @@ hide write_default func(writer Writer, $T type, value T) void ! WriteError { } return } - -print func(writer Writer, $format []u8, $Args type, args Args) void ! WriteError { - inline for parse_format(format.len, format, Args) |token| { - match token.kind { - .unused: break - .literal: try write_all(writer, format[token.start..token.end]) - .string: try write_all(writer, field!(args, token.field)) - .default: try write_default(writer, field!(args, token.field)) - .decimal: try write_decimal(writer, field!(args, token.field)) - .binary: try write_integer(writer, field!(args, token.field), 2, false) - .octal: try write_integer(writer, field!(args, token.field), 8, false) - .hex_lower: try write_integer(writer, field!(args, token.field), 16, false) - .hex_upper: try write_integer(writer, field!(args, token.field), 16, true) - .character: try write_character(writer, field!(args, token.field)) - else: try write_float(writer, field!(args, token.field), true) - } - } -} - -hide system_read func(_ ?*mut anyopaque, stream ReadStream, buffer []mut u8) usize ! ReadError { - request usize = buffer.len - maximum usize :: usize(maxval!(c_long)) - if request > maximum { - request = maximum - } - while true { - count c_long :: c.read(c_int(stream), buffer.ptr, c_ulong(request)) - if count >= 0 { - return usize(count) - } - if c.__error()^ != 4 { - return .read_failed - } - } -} - -hide system_write func(_ ?*mut anyopaque, stream WriteStream, bytes []u8) usize ! WriteError { - fd c_int :: c_int(stream) - request usize = bytes.len - maximum usize :: usize(maxval!(c_long)) - if request > maximum { - request = maximum - } - while true { - count c_long :: c.write(fd, bytes.ptr, c_ulong(request)) - if count >= 0 { - return usize(count) - } - if c.__error()^ != 4 { - return .write_failed - } - } -} - -hide system_vtable IoVTable :: IoVTable { - read = system_read, - write = system_write, -} - -hide system func() Io { - return Io { - context = none, - vtable = &system_vtable, - } -} diff --git a/std/mem/mem.hon b/std/mem/mem.hon index 12a75dd..6f97d01 100644 --- a/std/mem/mem.hon +++ b/std/mem/mem.hon @@ -5,14 +5,14 @@ AllocError :: enum { } Allocator :: struct { - context ?*mut anyopaque + context ?@mut anyopaque vtable @AllocatorVTable } AllocatorVTable :: struct { - alloc @func(context ?*mut anyopaque, size usize, alignment usize) ?*mut u8 - realloc @func(context ?*mut anyopaque, memory ?*mut u8, old_size usize, new_size usize, alignment usize) ?*mut u8 - free @func(context ?*mut anyopaque, memory ?*mut u8, size usize, alignment usize) void + alloc @func(context ?@mut anyopaque, size usize, alignment usize) ?*mut u8 + realloc @func(context ?@mut anyopaque, memory ?*mut u8, old_size usize, new_size usize, alignment usize) ?*mut u8 + free @func(context ?@mut anyopaque, memory ?*mut u8, size usize, alignment usize) void } raw_alloc func(allocator Allocator, size usize, alignment usize) ?*mut u8 { @@ -135,7 +135,7 @@ hide power_of_two func(value usize) bool { return true } -hide c_alloc func(_ ?*mut anyopaque, size usize, alignment usize) ?*mut u8 { +hide c_alloc func(_ ?@mut anyopaque, size usize, alignment usize) ?*mut u8 { if power_of_two(alignment) == false { return none } @@ -153,7 +153,7 @@ hide c_alloc func(_ ?*mut anyopaque, size usize, alignment usize) ?*mut u8 { return ptrcast!(u8, memory[0]) } -hide c_realloc func(_ ?*mut anyopaque, memory ?*mut u8, old_size usize, new_size usize, alignment usize) ?*mut u8 { +hide c_realloc func(_ ?@mut anyopaque, memory ?*mut u8, old_size usize, new_size usize, alignment usize) ?*mut u8 { if power_of_two(alignment) == false { return none } @@ -186,7 +186,7 @@ hide c_realloc func(_ ?*mut anyopaque, memory ?*mut u8, old_size usize, new_size return c_alloc(none, new_size, alignment) } -hide c_free func(_ ?*mut anyopaque, memory ?*mut u8, _ usize, _ usize) void { +hide c_free func(_ ?@mut anyopaque, memory ?*mut u8, _ usize, _ usize) void { c.free(memory) }