mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-30 19:30:06 +00:00
Merge branch 'master' into macharena
This commit is contained in:
@@ -25,6 +25,10 @@ Block_createLocalWithParam :: proc (user_data: rawptr, user_proc: proc "c" (user
|
||||
b, _ := Block_createInternalWithParam(false, user_data, user_proc, {})
|
||||
return b
|
||||
}
|
||||
@(objc_type=Block, objc_name="invoke")
|
||||
Block_invoke :: proc "c" (self: ^Block, args: ..any) -> ^Object {
|
||||
return msgSend(^Object, self, "invoke:", ..args)
|
||||
}
|
||||
|
||||
@(private)
|
||||
Internal_Block_Literal_Base :: struct {
|
||||
|
||||
@@ -13,6 +13,23 @@ Data_init :: proc "c" (self: ^Data) -> ^Data {
|
||||
return msgSend(^Data, self, "init")
|
||||
}
|
||||
|
||||
@(objc_type=Data, objc_name="initWithBytes")
|
||||
Data_initWithBytes :: proc "c" (self: ^Data, bytes: []byte) -> ^Data {
|
||||
return msgSend(^Data, self, "initWithBytes:length:", raw_data(bytes), len(bytes))
|
||||
}
|
||||
|
||||
@(objc_type=Data, objc_name="initWithBytesNoCopy")
|
||||
Data_initWithBytesNoCopy :: proc "c" (self: ^Data, bytes: []byte, freeWhenDone: BOOL) -> ^Data {
|
||||
return msgSend(
|
||||
^Data,
|
||||
self,
|
||||
"initWithBytesNoCopy:length:freeWhenDone:",
|
||||
raw_data(bytes),
|
||||
len(bytes),
|
||||
freeWhenDone,
|
||||
)
|
||||
}
|
||||
|
||||
@(objc_type=Data, objc_name="mutableBytes")
|
||||
Data_mutableBytes :: proc "c" (self: ^Data) -> rawptr {
|
||||
return msgSend(rawptr, self, "mutableBytes")
|
||||
|
||||
@@ -18,6 +18,11 @@ Date_dateWithTimeIntervalSinceNow :: proc "c" (secs: TimeInterval) -> ^Date {
|
||||
return msgSend(^Date, Date, "dateWithTimeIntervalSinceNow:", secs)
|
||||
}
|
||||
|
||||
@(objc_type=Date, objc_name="timeIntervalSince1970")
|
||||
Date_timeIntervalSince1970 :: proc "c" (self: ^Date) -> f64 {
|
||||
return msgSend(f64, self, "timeIntervalSince1970")
|
||||
}
|
||||
|
||||
@(objc_type=Date, objc_name="distantFuture", objc_is_class_method=true)
|
||||
Date_distantFuture :: proc "c" () -> ^Date {
|
||||
return msgSend(^Date, Date, "distantFuture")
|
||||
|
||||
@@ -15,7 +15,7 @@ Dictionary_dictionaryWithObject :: proc "c" (object: ^Object, forKey: ^Object) -
|
||||
|
||||
@(objc_type=Dictionary, objc_name="dictionaryWithObjects", objc_is_class_method=true)
|
||||
Dictionary_dictionaryWithObjects :: proc "c" (objects: [^]^Object, forKeys: [^]^Object, count: UInteger) -> ^Dictionary {
|
||||
return msgSend(^Dictionary, Dictionary, "dictionaryWithObjects:forKeys:count", objects, forKeys, count)
|
||||
return msgSend(^Dictionary, Dictionary, "dictionaryWithObjects:forKeys:count:", objects, forKeys, count)
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ Dictionary_init :: proc "c" (self: ^Dictionary) -> ^Dictionary {
|
||||
|
||||
@(objc_type=Dictionary, objc_name="initWithObjects")
|
||||
Dictionary_initWithObjects :: proc "c" (self: ^Dictionary, objects: [^]^Object, forKeys: [^]^Object, count: UInteger) -> ^Dictionary {
|
||||
return msgSend(^Dictionary, self, "initWithObjects:forKeys:count", objects, forKeys, count)
|
||||
return msgSend(^Dictionary, self, "initWithObjects:forKeys:count:", objects, forKeys, count)
|
||||
}
|
||||
|
||||
@(objc_type=Dictionary, objc_name="objectForKey")
|
||||
|
||||
@@ -30,6 +30,7 @@ MenuItem :: struct {using _: Object}
|
||||
MenuItem_alloc :: proc "c" () -> ^MenuItem {
|
||||
return msgSend(^MenuItem, MenuItem, "alloc")
|
||||
}
|
||||
|
||||
@(objc_type=MenuItem, objc_name="registerActionCallback", objc_is_class_method=true)
|
||||
MenuItem_registerActionCallback :: proc "c" (name: cstring, callback: MenuItemCallback) -> SEL {
|
||||
s := string(name)
|
||||
@@ -50,11 +51,21 @@ MenuItem_registerActionCallback :: proc "c" (name: cstring, callback: MenuItemCa
|
||||
return sel
|
||||
}
|
||||
|
||||
@(objc_type=MenuItem, objc_name="separatorItem", objc_is_class_method=true)
|
||||
MenuItem_separatorItem :: proc "c" () -> ^MenuItem {
|
||||
return msgSend(^MenuItem, MenuItem, "separatorItem")
|
||||
}
|
||||
|
||||
@(objc_type=MenuItem, objc_name="init")
|
||||
MenuItem_init :: proc "c" (self: ^MenuItem) -> ^MenuItem {
|
||||
return msgSend(^MenuItem, self, "init")
|
||||
}
|
||||
|
||||
@(objc_type=MenuItem, objc_name="initWithTitle")
|
||||
MenuItem_initWithTitle :: proc "c" (self: ^MenuItem, title: ^String, action: SEL, keyEquivalent: ^String) -> ^MenuItem {
|
||||
return msgSend(^MenuItem, self, "initWithTitle:action:keyEquivalent:", title, action, keyEquivalent)
|
||||
}
|
||||
|
||||
@(objc_type=MenuItem, objc_name="setKeyEquivalentModifierMask")
|
||||
MenuItem_setKeyEquivalentModifierMask :: proc "c" (self: ^MenuItem, modifierMask: KeyEquivalentModifierMask) {
|
||||
msgSend(nil, self, "setKeyEquivalentModifierMask:", modifierMask)
|
||||
@@ -75,6 +86,11 @@ MenuItem_title :: proc "c" (self: ^MenuItem) -> ^String {
|
||||
return msgSend(^String, self, "title")
|
||||
}
|
||||
|
||||
@(objc_type=MenuItem, objc_name="setTitle")
|
||||
MenuItem_setTitle :: proc "c" (self: ^MenuItem, title: ^String) -> ^String {
|
||||
return msgSend(^String, self, "title:", title)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@(objc_class="NSMenu")
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package objc_Foundation
|
||||
|
||||
@(objc_class="NSObjectProtocol")
|
||||
ObjectProtocol :: struct {using _: Object}
|
||||
// TODO: implement NSObjectProtocol
|
||||
@@ -0,0 +1,203 @@
|
||||
package objc_Foundation
|
||||
|
||||
import "base:intrinsics"
|
||||
|
||||
import "core:c"
|
||||
|
||||
@(objc_class="NSProcessInfo")
|
||||
ProcessInfo :: struct {using _: Object}
|
||||
|
||||
// Getting the Process Information Agent
|
||||
|
||||
@(objc_type=ProcessInfo, objc_name="processInfo", objc_is_class_method=true)
|
||||
ProcessInfo_processInfo :: proc "c" () -> ^ProcessInfo {
|
||||
return msgSend(^ProcessInfo, ProcessInfo, "processInfo")
|
||||
}
|
||||
|
||||
// Accessing Process Information
|
||||
|
||||
@(objc_type=ProcessInfo, objc_name="arguments")
|
||||
ProcessInfo_arguments :: proc "c" (self: ^ProcessInfo) -> ^Array {
|
||||
return msgSend(^Array, self, "arguments")
|
||||
}
|
||||
|
||||
@(objc_type=ProcessInfo, objc_name="environment")
|
||||
ProcessInfo_environment :: proc "c" (self: ^ProcessInfo) -> ^Dictionary {
|
||||
return msgSend(^Dictionary, self, "environment")
|
||||
}
|
||||
|
||||
@(objc_type=ProcessInfo, objc_name="globallyUniqueString")
|
||||
ProcessInfo_globallyUniqueString :: proc "c" (self: ^ProcessInfo) -> ^String {
|
||||
return msgSend(^String, self, "globallyUniqueString")
|
||||
}
|
||||
|
||||
@(objc_type=ProcessInfo, objc_name="isMacCatalystApp")
|
||||
ProcessInfo_isMacCatalystApp :: proc "c" (self: ^ProcessInfo) -> bool {
|
||||
return msgSend(bool, self, "isMacCatalystApp")
|
||||
}
|
||||
|
||||
@(objc_type=ProcessInfo, objc_name="isiOSAppOnMac")
|
||||
ProcessInfo_isiOSAppOnMac :: proc "c" (self: ^ProcessInfo) -> bool {
|
||||
return msgSend(bool, self, "isiOSAppOnMac")
|
||||
}
|
||||
|
||||
@(objc_type=ProcessInfo, objc_name="processIdentifier")
|
||||
ProcessInfo_processIdentifier :: proc "c" (self: ^ProcessInfo) -> c.int {
|
||||
return msgSend(c.int, self, "processIdentifier")
|
||||
}
|
||||
|
||||
@(objc_type=ProcessInfo, objc_name="processName")
|
||||
ProcessInfo_processName :: proc "c" (self: ^ProcessInfo) -> ^String {
|
||||
return msgSend(^String, self, "processName")
|
||||
}
|
||||
|
||||
// Accessing User Information
|
||||
|
||||
@(objc_type=ProcessInfo, objc_name="userName")
|
||||
ProcessInfo_userName :: proc "c" (self: ^ProcessInfo) -> ^String {
|
||||
return msgSend(^String, self, "userName")
|
||||
}
|
||||
|
||||
@(objc_type=ProcessInfo, objc_name="fullUserName")
|
||||
ProcessInfo_fullUserName :: proc "c" (self: ^ProcessInfo) -> ^String {
|
||||
return msgSend(^String, self, "fullUserName")
|
||||
}
|
||||
|
||||
// Sudden Application Termination
|
||||
|
||||
@(objc_type=ProcessInfo, objc_name="disableSuddenTermination")
|
||||
ProcessInfo_disableSuddenTermination :: proc "c" (self: ^ProcessInfo) {
|
||||
msgSend(nil, self, "disableSuddenTermination")
|
||||
}
|
||||
|
||||
@(objc_type=ProcessInfo, objc_name="enableSuddenTermination")
|
||||
ProcessInfo_enableSuddenTermination :: proc "c" (self: ^ProcessInfo) {
|
||||
msgSend(nil, self, "enableSuddenTermination")
|
||||
}
|
||||
|
||||
// Controlling Automatic Termination
|
||||
|
||||
@(objc_type=ProcessInfo, objc_name="disableAutomaticTermination")
|
||||
ProcessInfo_disableAutomaticTermination :: proc "c" (self: ^ProcessInfo, reason: ^String) {
|
||||
msgSend(nil, self, "disableAutomaticTermination:", reason)
|
||||
}
|
||||
|
||||
@(objc_type=ProcessInfo, objc_name="enableAutomaticTermination")
|
||||
ProcessInfo_enableAutomaticTermination :: proc "c" (self: ^ProcessInfo, reason: ^String) {
|
||||
msgSend(nil, self, "enableAutomaticTermination:", reason)
|
||||
}
|
||||
|
||||
@(objc_type=ProcessInfo, objc_name="automaticTerminationSupportEnabled")
|
||||
ProcessInfo_automaticTerminationSupportEnabled :: proc "c" (self: ^ProcessInfo) -> bool {
|
||||
return msgSend(bool, self, "automaticTerminationSupportEnabled")
|
||||
}
|
||||
|
||||
@(objc_type=ProcessInfo, objc_name="setAutomaticTerminationSupportEnabled")
|
||||
ProcessInfo_setAutomaticTerminationSupportEnabled :: proc "c" (self: ^ProcessInfo, automaticTerminationSupportEnabled: bool) {
|
||||
msgSend(nil, self, "setAutomaticTerminationSupportEnabled:", automaticTerminationSupportEnabled)
|
||||
}
|
||||
|
||||
// Getting Host Information
|
||||
|
||||
@(objc_type=ProcessInfo, objc_name="hostName")
|
||||
ProcessInfo_hostName :: proc "c" (self: ^ProcessInfo) -> ^String {
|
||||
return msgSend(^String, self, "hostName")
|
||||
}
|
||||
|
||||
@(objc_type=ProcessInfo, objc_name="operatingSystemVersionString")
|
||||
ProcessInfo_operatingSystemVersionString :: proc "c" (self: ^ProcessInfo) -> ^String {
|
||||
return msgSend(^String, self, "operatingSystemVersionString")
|
||||
}
|
||||
|
||||
@(objc_type=ProcessInfo, objc_name="operatingSystemVersion")
|
||||
ProcessInfo_operatingSystemVersion :: proc "c" (self: ^ProcessInfo) -> OperatingSystemVersion {
|
||||
return msgSend(OperatingSystemVersion, self, "operatingSystemVersion")
|
||||
}
|
||||
|
||||
@(objc_type=ProcessInfo, objc_name="isOperatingSystemAtLeastVersion")
|
||||
ProcessInfo_isOperatingSystemAtLeastVersion :: proc "c" (self: ^ProcessInfo, version: OperatingSystemVersion) -> bool {
|
||||
return msgSend(bool, self, "isOperatingSystemAtLeastVersion:", version)
|
||||
}
|
||||
|
||||
// Getting Computer Information
|
||||
|
||||
@(objc_type=ProcessInfo, objc_name="processorCount")
|
||||
ProcessInfo_processorCount :: proc "c" (self: ^ProcessInfo) -> UInteger {
|
||||
return msgSend(UInteger, self, "processorCount")
|
||||
}
|
||||
|
||||
@(objc_type=ProcessInfo, objc_name="activeProcessorCount")
|
||||
ProcessInfo_activeProcessorCount :: proc "c" (self: ^ProcessInfo) -> UInteger {
|
||||
return msgSend(UInteger, self, "activeProcessorCount")
|
||||
}
|
||||
|
||||
@(objc_type=ProcessInfo, objc_name="physicalMemory")
|
||||
ProcessInfo_physicalMemory :: proc "c" (self: ^ProcessInfo) -> c.ulonglong {
|
||||
return msgSend(c.ulonglong, self, "physicalMemory")
|
||||
}
|
||||
|
||||
@(objc_type=ProcessInfo, objc_name="systemUptime")
|
||||
ProcessInfo_systemUptime :: proc "c" (self: ^ProcessInfo) -> TimeInterval {
|
||||
return msgSend(TimeInterval, self, "systemUptime")
|
||||
}
|
||||
|
||||
// Managing Activities
|
||||
|
||||
@(private)
|
||||
log2 :: intrinsics.constant_log2
|
||||
|
||||
ActivityOptionsBits :: enum u64 {
|
||||
IdleDisplaySleepDisabled = log2(1099511627776), // Require the screen to stay powered on.
|
||||
IdleSystemSleepDisabled = log2(1048576), // Prevent idle sleep.
|
||||
SuddenTerminationDisabled = log2(16384), // Prevent sudden termination.
|
||||
AutomaticTerminationDisabled = log2(32768), // Prevent automatic termination.
|
||||
AnimationTrackingEnabled = log2(35184372088832), // Track activity with an animation signpost interval.
|
||||
TrackingEnabled = log2(70368744177664), // Track activity with a signpost interval.
|
||||
UserInitiated = log2(16777215), // Performing a user-requested action.
|
||||
UserInitiatedAllowingIdleSystemSleep = log2(15728639), // Performing a user-requested action, but the system can sleep on idle.
|
||||
Background = log2(255), // Initiated some kind of work, but not as the direct result of a user request.
|
||||
LatencyCritical = log2(1095216660480), // Requires the highest amount of timer and I/O precision available.
|
||||
UserInteractive = log2(1095233437695), // Responding to user interaction.
|
||||
}
|
||||
ActivityOptions :: bit_set[ActivityOptionsBits; u64]
|
||||
|
||||
@(objc_type=ProcessInfo, objc_name="beginActivityWithOptions")
|
||||
ProcessInfo_beginActivityWithOptions :: proc "c" (self: ^ProcessInfo, options: ActivityOptions, reason: ^String) -> ^ObjectProtocol {
|
||||
return msgSend(^ObjectProtocol, self, "beginActivityWithOptions:reason:", options, reason)
|
||||
}
|
||||
|
||||
@(objc_type=ProcessInfo, objc_name="endActivity")
|
||||
ProcessInfo_endActivity :: proc "c" (self: ^ProcessInfo, activity: ^ObjectProtocol) {
|
||||
msgSend(nil, self, "endActivity:", activity)
|
||||
}
|
||||
|
||||
@(objc_type=ProcessInfo, objc_name="performActivityWithOptions")
|
||||
ProcessInfo_performActivityWithOptions :: proc "c" (self: ^ProcessInfo, options: ActivityOptions, reason: ^String, block: proc "c" ()) {
|
||||
msgSend(nil, self, "performActivityWithOptions:reason:usingBlock:", options, reason, block)
|
||||
}
|
||||
|
||||
@(objc_type=ProcessInfo, objc_name="performExpiringActivityWithReason")
|
||||
ProcessInfo_performExpiringActivityWithReason :: proc "c" (self: ^ProcessInfo, reason: ^String, block: proc "c" (expired: bool)) {
|
||||
msgSend(nil, self, "performExpiringActivityWithReason:usingBlock:", reason, block)
|
||||
}
|
||||
|
||||
// Getting the Thermal State
|
||||
|
||||
ProcessInfoThermalState :: enum c.long {
|
||||
Nominal,
|
||||
Fair,
|
||||
Serious,
|
||||
Critical,
|
||||
}
|
||||
|
||||
@(objc_type=ProcessInfo, objc_name="thermalState")
|
||||
ProcessInfo_thermalState :: proc "c" (self: ^ProcessInfo) -> ProcessInfoThermalState {
|
||||
return msgSend(ProcessInfoThermalState, self, "thermalState")
|
||||
}
|
||||
|
||||
// Determining Whether Low Power Mode is Enabled
|
||||
|
||||
@(objc_type=ProcessInfo, objc_name="isLowPowerModeEnabled")
|
||||
ProcessInfo_isLowPowerModeEnabled :: proc "c" (self: ^ProcessInfo) -> bool {
|
||||
return msgSend(bool, self, "isLowPowerModeEnabled")
|
||||
}
|
||||
@@ -7,3 +7,13 @@ SavePanel :: struct{ using _: Panel }
|
||||
SavePanel_runModal :: proc "c" (self: ^SavePanel) -> ModalResponse {
|
||||
return msgSend(ModalResponse, self, "runModal")
|
||||
}
|
||||
|
||||
@(objc_type=SavePanel, objc_name="savePanel", objc_is_class_method=true)
|
||||
SavePanel_savePanel :: proc "c" () -> ^SavePanel {
|
||||
return msgSend(^SavePanel, SavePanel, "savePanel")
|
||||
}
|
||||
|
||||
@(objc_type=SavePanel, objc_name="URL")
|
||||
SavePanel_URL :: proc "c" (self: ^SavePanel) -> ^URL {
|
||||
return msgSend(^URL, self, "URL")
|
||||
}
|
||||
|
||||
@@ -134,6 +134,11 @@ String_isEqualToString :: proc "c" (self, other: ^String) -> BOOL {
|
||||
return msgSend(BOOL, self, "isEqualToString:", other)
|
||||
}
|
||||
|
||||
@(objc_type=String, objc_name="stringByAppendingString")
|
||||
String_stringByAppendingString :: proc "c" (self, other: ^String) -> ^String {
|
||||
return msgSend(^String, self, "stringByAppendingString:", other)
|
||||
}
|
||||
|
||||
@(objc_type=String, objc_name="rangeOfString")
|
||||
String_rangeOfString :: proc "c" (self, other: ^String, options: StringCompareOptions) -> Range {
|
||||
return msgSend(Range, self, "rangeOfString:options:", other, options)
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package objc_Foundation
|
||||
@(objc_class = "NSToolbar")
|
||||
|
||||
Toolbar :: struct { using _: Object }
|
||||
|
||||
@(objc_type = Toolbar, objc_name = "alloc", objc_is_class_method = true)
|
||||
Toolbar_alloc :: proc "c" () -> ^Toolbar {
|
||||
return msgSend(^Toolbar, Toolbar, "alloc")
|
||||
}
|
||||
|
||||
@(objc_type = Toolbar, objc_name = "init")
|
||||
Toolbar_init :: proc "c" (self: ^Toolbar) -> ^Toolbar {
|
||||
return msgSend(^Toolbar, self, "init")
|
||||
}
|
||||
@@ -20,7 +20,7 @@ BOOL :: bool // TODO(bill): should this be `distinct`?
|
||||
YES :: true
|
||||
NO :: false
|
||||
|
||||
OperatingSystemVersion :: struct #packed {
|
||||
OperatingSystemVersion :: struct #align(8) {
|
||||
majorVersion: Integer,
|
||||
minorVersion: Integer,
|
||||
patchVersion: Integer,
|
||||
@@ -58,4 +58,4 @@ when size_of(Float) == 8 {
|
||||
} else {
|
||||
_POINT_ENCODING :: "{NSPoint=ff}"
|
||||
_SIZE_ENCODING :: "{NSSize=ff}"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,3 +28,8 @@ URL_initFileURLWithPath :: proc "c" (self: ^URL, path: ^String) -> ^URL {
|
||||
URL_fileSystemRepresentation :: proc "c" (self: ^URL) -> cstring {
|
||||
return msgSend(cstring, self, "fileSystemRepresentation")
|
||||
}
|
||||
|
||||
@(objc_type=URL, objc_name="relativePath")
|
||||
URL_relativePath :: proc "c" (self: ^URL) -> ^String {
|
||||
return msgSend(^String, self, "relativePath")
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package objc_Foundation
|
||||
|
||||
@(objc_class = "URLRequest")
|
||||
URLRequest :: struct { using _: Object }
|
||||
|
||||
@(objc_type = URLRequest, objc_name = "alloc", objc_is_class_method = true)
|
||||
URLRequest_alloc :: proc "c" () -> ^URLRequest {
|
||||
return msgSend(^URLRequest, URLRequest, "alloc")
|
||||
}
|
||||
|
||||
@(objc_type = URLRequest, objc_name = "requestWithURL", objc_is_class_method = true)
|
||||
URLRequest_requestWithURL :: proc "c" (url: ^URL) -> ^URLRequest {
|
||||
return msgSend(^URLRequest, URLRequest, "requestWithURL:", url)
|
||||
}
|
||||
|
||||
@(objc_type = URLRequest, objc_name = "init")
|
||||
URLRequest_init :: proc "c" (self: ^URLRequest) -> ^URLRequest {
|
||||
return msgSend(^URLRequest, URLRequest, "init")
|
||||
}
|
||||
|
||||
@(objc_type = URLRequest, objc_name = "url")
|
||||
URLRequest_url :: proc "c" (self: ^URLRequest) -> ^URL {
|
||||
return msgSend(^URL, self, "URL")
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package objc_Foundation
|
||||
|
||||
@(objc_class = "NSURLResponse")
|
||||
URLResponse :: struct { using _: Object }
|
||||
|
||||
@(objc_type = URLResponse, objc_name = "alloc", objc_is_class_method = true)
|
||||
URLResponse_alloc :: proc "c" () -> ^URLResponse {
|
||||
return msgSend(^URLResponse, URLResponse, "alloc")
|
||||
}
|
||||
|
||||
@(objc_type = URLResponse, objc_name = "init")
|
||||
URLResponse_init :: proc "c" (self: ^URLResponse) -> ^URLResponse {
|
||||
return msgSend(^URLResponse, URLResponse, "init")
|
||||
}
|
||||
|
||||
@(objc_type = URLResponse, objc_name = "initWithURL")
|
||||
URLResponse_initWithURL :: proc "c" (self: ^URLResponse, url: ^URL, mime_type: ^String, length: int, encoding: ^String ) -> ^URLResponse {
|
||||
return msgSend(^URLResponse, self, "initWithURL:MIMEType:expectedContentLength:textEncodingName:", url, mime_type, Integer(length), encoding)
|
||||
}
|
||||
@@ -129,6 +129,10 @@ WindowDelegateTemplate :: struct {
|
||||
windowDidExitVersionBrowser: proc(notification: ^Notification),
|
||||
}
|
||||
|
||||
Window_Title_Visibility :: enum UInteger {
|
||||
Visible,
|
||||
Hidden,
|
||||
}
|
||||
|
||||
WindowDelegate :: struct { using _: Object } // This is not the same as NSWindowDelegate
|
||||
_WindowDelegateInternal :: struct {
|
||||
@@ -616,6 +620,10 @@ View_setWantsLayer :: proc "c" (self: ^View, wantsLayer: BOOL) {
|
||||
View_convertPointFromView :: proc "c" (self: ^View, point: Point, view: ^View) -> Point {
|
||||
return msgSend(Point, self, "convertPoint:fromView:", point, view)
|
||||
}
|
||||
@(objc_type=View, objc_name="addSubview")
|
||||
View_addSubview :: proc "c" (self: ^View, view: ^View) {
|
||||
msgSend(nil, self, "addSubview:", view)
|
||||
}
|
||||
|
||||
@(objc_class="NSWindow")
|
||||
Window :: struct {using _: Responder}
|
||||
@@ -748,4 +756,28 @@ Window_hasTitleBar :: proc "c" (self: ^Window) -> BOOL {
|
||||
@(objc_type=Window, objc_name="orderedIndex")
|
||||
Window_orderedIndex :: proc "c" (self: ^Window) -> Integer {
|
||||
return msgSend(Integer, self, "orderedIndex")
|
||||
}
|
||||
@(objc_type=Window, objc_name="setMinSize")
|
||||
Window_setMinSize :: proc "c" (self: ^Window, size: Size) {
|
||||
msgSend(nil, self, "setMinSize:", size)
|
||||
}
|
||||
@(objc_type=Window, objc_name="setTitleVisibility")
|
||||
Window_setTitleVisibility :: proc "c" (self: ^Window, visibility: Window_Title_Visibility) {
|
||||
msgSend(nil, self, "setTitleVisibility:", visibility)
|
||||
}
|
||||
@(objc_type=Window, objc_name="performZoom")
|
||||
Window_performZoom :: proc "c" (self: ^Window) {
|
||||
msgSend(nil, self, "performZoom:", self)
|
||||
}
|
||||
@(objc_type=Window, objc_name="setFrameAutosaveName")
|
||||
NSWindow_setFrameAutosaveName :: proc "c" (self: ^Window, name: ^String) {
|
||||
msgSend(nil, self, "setFrameAutosaveName:", name)
|
||||
}
|
||||
@(objc_type=Window, objc_name="performWindowDragWithEvent")
|
||||
Window_performWindowDragWithEvent :: proc "c" (self: ^Window, event: ^Event) {
|
||||
msgSend(nil, self, "performWindowDragWithEvent:", event)
|
||||
}
|
||||
@(objc_type=Window, objc_name="setToolbar")
|
||||
Window_setToolbar :: proc "c" (self: ^Window, toolbar: ^Toolbar) {
|
||||
msgSend(nil, self, "setToolbar:", toolbar)
|
||||
}
|
||||
@@ -21,6 +21,7 @@ SYS_close : uintptr : 6
|
||||
SYS_getpid : uintptr : 20
|
||||
SYS_recvfrom : uintptr : 29
|
||||
SYS_accept : uintptr : 30
|
||||
SYS_getpeername: uintptr : 31
|
||||
SYS_getsockname: uintptr : 32
|
||||
SYS_fcntl : uintptr : 92
|
||||
SYS_fsync : uintptr : 95
|
||||
@@ -202,24 +203,36 @@ accept_nil :: proc "contextless" (s: Fd) -> (Fd, Errno) {
|
||||
|
||||
accept :: proc { accept_T, accept_nil }
|
||||
|
||||
getsockname_or_peername :: proc "contextless" (s: Fd, sockaddr: ^$T, is_peer: bool) -> Errno {
|
||||
// sockaddr must contain a valid pointer, or this will segfault because
|
||||
// we're telling the syscall that there's memory available to write to.
|
||||
addrlen: socklen_t = size_of(T)
|
||||
|
||||
result, ok := intrinsics.syscall_bsd(
|
||||
is_peer ? SYS_getpeername : SYS_getsockname,
|
||||
cast(uintptr)s,
|
||||
cast(uintptr)sockaddr,
|
||||
cast(uintptr)&addrlen)
|
||||
|
||||
if !ok {
|
||||
return cast(Errno)result
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Get name of connected peer
|
||||
//
|
||||
// The getpeername() system call appeared in 4.2BSD.
|
||||
getpeername :: proc "contextless" (s: Fd, sockaddr: ^$T) -> Errno {
|
||||
return getsockname_or_peername(s, sockaddr, true)
|
||||
}
|
||||
|
||||
// Get socket name.
|
||||
//
|
||||
// The getsockname() system call appeared in 4.2BSD.
|
||||
getsockname :: proc "contextless" (s: Fd, sockaddr: ^$T) -> Errno {
|
||||
// sockaddr must contain a valid pointer, or this will segfault because
|
||||
// we're telling the syscall that there's memory available to write to.
|
||||
addrlen: socklen_t = size_of(T)
|
||||
|
||||
result, ok := intrinsics.syscall_bsd(SYS_getsockname,
|
||||
cast(uintptr)s,
|
||||
cast(uintptr)sockaddr,
|
||||
cast(uintptr)&addrlen)
|
||||
|
||||
if !ok {
|
||||
return cast(Errno)result
|
||||
}
|
||||
|
||||
return nil
|
||||
return getsockname_or_peername(s, sockaddr, false)
|
||||
}
|
||||
|
||||
// Synchronize changes to a file.
|
||||
|
||||
@@ -1,26 +1,31 @@
|
||||
#+build haiku
|
||||
package sys_haiku
|
||||
|
||||
import "core:c"
|
||||
import "core:sys/posix"
|
||||
|
||||
Errno :: enum c.int {
|
||||
// Error baselines
|
||||
GENERAL_ERROR_BASE = min(c.int),
|
||||
OS_ERROR_BASE = GENERAL_ERROR_BASE + 0x1000,
|
||||
APP_ERROR_BASE = GENERAL_ERROR_BASE + 0x2000,
|
||||
INTERFACE_ERROR_BASE = GENERAL_ERROR_BASE + 0x3000,
|
||||
MEDIA_ERROR_BASE = GENERAL_ERROR_BASE + 0x4000,
|
||||
TRANSLATION_ERROR_BASE = GENERAL_ERROR_BASE + 0x4800,
|
||||
MIDI_ERROR_BASE = GENERAL_ERROR_BASE + 0x5000,
|
||||
STORAGE_ERROR_BASE = GENERAL_ERROR_BASE + 0x6000,
|
||||
POSIX_ERROR_BASE = GENERAL_ERROR_BASE + 0x7000,
|
||||
MAIL_ERROR_BASE = GENERAL_ERROR_BASE + 0x8000,
|
||||
PRINT_ERROR_BASE = GENERAL_ERROR_BASE + 0x9000,
|
||||
DEVICE_ERROR_BASE = GENERAL_ERROR_BASE + 0xa000,
|
||||
foreign import libroot "system:c"
|
||||
|
||||
// Developer-defined errors start at (ERRORS_END+1)
|
||||
ERRORS_END = GENERAL_ERROR_BASE + 0xffff,
|
||||
USE_POSITIVE_POSIX_ERRORS :: posix._HAIKU_USE_POSITIVE_POSIX_ERRORS
|
||||
POSIX_ERROR_FACTOR :: posix._POSIX_ERROR_FACTOR
|
||||
|
||||
// Error baselines
|
||||
GENERAL_ERROR_BASE :: min(i32)
|
||||
OS_ERROR_BASE :: GENERAL_ERROR_BASE + 0x1000
|
||||
APP_ERROR_BASE :: GENERAL_ERROR_BASE + 0x2000
|
||||
INTERFACE_ERROR_BASE :: GENERAL_ERROR_BASE + 0x3000
|
||||
MEDIA_ERROR_BASE :: GENERAL_ERROR_BASE + 0x4000
|
||||
TRANSLATION_ERROR_BASE :: GENERAL_ERROR_BASE + 0x4800
|
||||
MIDI_ERROR_BASE :: GENERAL_ERROR_BASE + 0x5000
|
||||
STORAGE_ERROR_BASE :: GENERAL_ERROR_BASE + 0x6000
|
||||
POSIX_ERROR_BASE :: GENERAL_ERROR_BASE + 0x7000
|
||||
MAIL_ERROR_BASE :: GENERAL_ERROR_BASE + 0x8000
|
||||
PRINT_ERROR_BASE :: GENERAL_ERROR_BASE + 0x9000
|
||||
DEVICE_ERROR_BASE :: GENERAL_ERROR_BASE + 0xA000
|
||||
|
||||
// Developer-defined errors start at (ERRORS_END+1)
|
||||
ERRORS_END :: GENERAL_ERROR_BASE + 0xFFFF
|
||||
|
||||
Errno :: enum i32 {
|
||||
// General Errors
|
||||
NO_MEMORY = GENERAL_ERROR_BASE + 0,
|
||||
IO_ERROR = GENERAL_ERROR_BASE + 1,
|
||||
@@ -107,31 +112,95 @@ Errno :: enum c.int {
|
||||
PARTIAL_READ = STORAGE_ERROR_BASE + 16,
|
||||
PARTIAL_WRITE = STORAGE_ERROR_BASE + 17,
|
||||
|
||||
// Some POSIX errors
|
||||
E2BIG = POSIX_ERROR_BASE + 1,
|
||||
EFBIG = POSIX_ERROR_BASE + 4,
|
||||
ENODEV = POSIX_ERROR_BASE + 7,
|
||||
ERANGE = POSIX_ERROR_BASE + 17,
|
||||
EOVERFLOW = POSIX_ERROR_BASE + 41,
|
||||
EOPNOTSUPP = POSIX_ERROR_BASE + 43,
|
||||
|
||||
ENOSYS = POSIX_ERROR_BASE + 9,
|
||||
EAGAIN = WOULD_BLOCK,
|
||||
EIO = posix.EIO,
|
||||
EACCES = posix.EACCES,
|
||||
EINVAL = posix.EINVAL,
|
||||
ETIMEDOUT = posix.ETIMEDOUT,
|
||||
EINTR = posix.EINTR,
|
||||
EAGAIN = posix.EAGAIN,
|
||||
EWOULDBLOCK = posix.EWOULDBLOCK,
|
||||
EBUSY = posix.EBUSY,
|
||||
EPERM = posix.EPERM,
|
||||
EFAULT = posix.EFAULT,
|
||||
ENOEXEC = posix.ENOEXEC,
|
||||
EBADF = posix.EBADF,
|
||||
EEXIST = posix.EEXIST,
|
||||
ENOENT = posix.ENOENT,
|
||||
ENAMETOOLONG = posix.ENAMETOOLONG,
|
||||
ENOTDIR = posix.ENOTDIR,
|
||||
ENOTEMPTY = posix.ENOTEMPTY,
|
||||
ENOSPC = posix.ENOSPC,
|
||||
EROFS = posix.EROFS,
|
||||
EISDIR = posix.EISDIR,
|
||||
EMFILE = posix.EMFILE,
|
||||
EXDEV = posix.EXDEV,
|
||||
ELOOP = posix.ELOOP,
|
||||
EPIPE = posix.EPIPE,
|
||||
ENOMEM = posix.ENOMEM,
|
||||
E2BIG = posix.E2BIG,
|
||||
ECHILD = posix.ECHILD,
|
||||
EDEADLK = posix.EDEADLK,
|
||||
EFBIG = posix.EFBIG,
|
||||
EMLINK = posix.EMLINK,
|
||||
ENFILE = posix.ENFILE,
|
||||
ENODEV = posix.ENODEV,
|
||||
ENOLCK = posix.ENOLCK,
|
||||
ENOSYS = posix.ENOSYS,
|
||||
ENOTTY = posix.ENOTTY,
|
||||
ENXIO = posix.ENXIO,
|
||||
ESPIPE = posix.ESPIPE,
|
||||
ESRCH = posix.ESRCH,
|
||||
EDOM = posix.EDOM,
|
||||
ERANGE = posix.ERANGE,
|
||||
EPROTOTYPE = posix.EPROTOTYPE,
|
||||
EPROTONOSUPPORT = posix.EPROTONOSUPPORT,
|
||||
EAFNOSUPPORT = posix.EAFNOSUPPORT,
|
||||
EADDRINUSE = posix.EADDRINUSE,
|
||||
EADDRNOTAVAIL = posix.EADDRNOTAVAIL,
|
||||
ENETDOWN = posix.ENETDOWN,
|
||||
ENETUNREACH = posix.ENETUNREACH,
|
||||
ENETRESET = posix.ENETRESET,
|
||||
ECONNABORTED = posix.ECONNABORTED,
|
||||
ECONNRESET = posix.ECONNRESET,
|
||||
EISCONN = posix.EISCONN,
|
||||
ENOTCONN = posix.ENOTCONN,
|
||||
ECONNREFUSED = posix.ECONNREFUSED,
|
||||
EHOSTUNREACH = posix.EHOSTUNREACH,
|
||||
ENOPROTOOPT = posix.ENOPROTOOPT,
|
||||
ENOBUFS = posix.ENOBUFS,
|
||||
EINPROGRESS = posix.EINPROGRESS,
|
||||
EALREADY = posix.EALREADY,
|
||||
EILSEQ = posix.EILSEQ,
|
||||
ENOMSG = posix.ENOMSG,
|
||||
ESTALE = posix.ESTALE,
|
||||
EOVERFLOW = posix.EOVERFLOW,
|
||||
EMSGSIZE = posix.EMSGSIZE,
|
||||
EOPNOTSUPP = posix.EOPNOTSUPP,
|
||||
ENOTSOCK = posix.ENOTSOCK,
|
||||
EBADMSG = posix.EBADMSG,
|
||||
ECANCELED = posix.ECANCELED,
|
||||
EDESTADDRREQ = posix.EDESTADDRREQ,
|
||||
EDQUOT = posix.EDQUOT,
|
||||
EIDRM = posix.EIDRM,
|
||||
EMULTIHOP = posix.EMULTIHOP,
|
||||
ENODATA = posix.ENODATA,
|
||||
ENOLINK = posix.ENOLINK,
|
||||
ENOSR = posix.ENOSR,
|
||||
ENOSTR = posix.ENOSTR,
|
||||
ENOTSUP = posix.ENOTSUP,
|
||||
EPROTO = posix.EPROTO,
|
||||
ETIME = posix.ETIME,
|
||||
ETXTBSY = posix.ETXTBSY,
|
||||
ENOTRECOVERABLE = posix.ENOTRECOVERABLE,
|
||||
EOWNERDEAD = posix.EOWNERDEAD,
|
||||
|
||||
// New error codes that can be mapped to POSIX errors
|
||||
TOO_MANY_ARGS_NEG = E2BIG,
|
||||
FILE_TOO_LARGE_NEG = EFBIG,
|
||||
DEVICE_NOT_FOUND_NEG = ENODEV,
|
||||
RESULT_NOT_REPRESENTABLE_NEG = ERANGE,
|
||||
BUFFER_OVERFLOW_NEG = EOVERFLOW,
|
||||
NOT_SUPPORTED_NEG = EOPNOTSUPP,
|
||||
|
||||
TOO_MANY_ARGS_POS = -E2BIG,
|
||||
FILE_TOO_LARGE_POS = -EFBIG,
|
||||
DEVICE_NOT_FOUND_POS = -ENODEV,
|
||||
RESULT_NOT_REPRESENTABLE_POS = -ERANGE,
|
||||
BUFFER_OVERFLOW_POS = -EOVERFLOW,
|
||||
NOT_SUPPORTED_POS = -EOPNOTSUPP,
|
||||
TOO_MANY_ARGS = POSIX_ERROR_FACTOR * E2BIG,
|
||||
FILE_TOO_LARGE = POSIX_ERROR_FACTOR * EFBIG,
|
||||
DEVICE_NOT_FOUND = POSIX_ERROR_FACTOR * ENODEV,
|
||||
RESULT_NOT_REPRESENTABLE = POSIX_ERROR_FACTOR * ERANGE,
|
||||
BUFFER_OVERFLOW = POSIX_ERROR_FACTOR * EOVERFLOW,
|
||||
NOT_SUPPORTED = POSIX_ERROR_FACTOR * EOPNOTSUPP,
|
||||
|
||||
// Media Kit Errors
|
||||
STREAM_NOT_FOUND = MEDIA_ERROR_BASE + 0,
|
||||
@@ -226,14 +295,8 @@ Errno :: enum c.int {
|
||||
ILLEGAL_DATA = TRANSLATION_ERROR_BASE + 2,
|
||||
}
|
||||
|
||||
errno :: #force_inline proc "contextless" () -> Errno {
|
||||
return Errno(_errnop()^)
|
||||
}
|
||||
|
||||
foreign import libroot "system:c"
|
||||
@(default_calling_convention="c")
|
||||
foreign libroot {
|
||||
_to_positive_error :: proc(error: c.int) -> c.int ---
|
||||
_to_negative_error :: proc(error: c.int) -> c.int ---
|
||||
|
||||
_errnop :: proc() -> ^c.int ---
|
||||
_to_positive_error :: proc(error: i32) -> i32 ---
|
||||
_to_negative_error :: proc(error: i32) -> i32 ---
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
#+build haiku
|
||||
package sys_haiku
|
||||
|
||||
import "core:c"
|
||||
import "base:intrinsics"
|
||||
|
||||
directory_which :: enum c.int {
|
||||
foreign import libroot "system:c"
|
||||
|
||||
directory_which :: enum i32 {
|
||||
// Per volume directories
|
||||
DESKTOP_DIRECTORY = 0,
|
||||
TRASH_DIRECTORY,
|
||||
@@ -110,17 +112,18 @@ directory_which :: enum c.int {
|
||||
BEOS_SOUNDS_DIRECTORY,
|
||||
}
|
||||
|
||||
find_path_flags :: enum c.int {
|
||||
CREATE_DIRECTORY = 0x0001,
|
||||
CREATE_PARENT_DIRECTORY = 0x0002,
|
||||
EXISTING_ONLY = 0x0004,
|
||||
find_path_flag :: enum u32 {
|
||||
CREATE_DIRECTORY = intrinsics.constant_log2(0x0001),
|
||||
CREATE_PARENT_DIRECTORY = intrinsics.constant_log2(0x0002),
|
||||
EXISTING_ONLY = intrinsics.constant_log2(0x0004),
|
||||
|
||||
// find_paths() only!
|
||||
SYSTEM_ONLY = 0x0010,
|
||||
USER_ONLY = 0x0020,
|
||||
// find_paths() only
|
||||
SYSTEM_ONLY = intrinsics.constant_log2(0x0010),
|
||||
USER_ONLY = intrinsics.constant_log2(0x0020),
|
||||
}
|
||||
find_path_flags :: distinct bit_set[find_path_flag; u32]
|
||||
|
||||
path_base_directory :: enum c.int {
|
||||
path_base_directory :: enum i32 {
|
||||
INSTALLATION_LOCATION_DIRECTORY,
|
||||
ADD_ONS_DIRECTORY,
|
||||
APPS_DIRECTORY,
|
||||
@@ -146,7 +149,7 @@ path_base_directory :: enum c.int {
|
||||
TRANSLATORS_DIRECTORY,
|
||||
VAR_DIRECTORY,
|
||||
|
||||
// find_path() only!
|
||||
// find_path() only
|
||||
IMAGE_PATH = 1000,
|
||||
PACKAGE_PATH,
|
||||
}
|
||||
@@ -154,15 +157,15 @@ path_base_directory :: enum c.int {
|
||||
// value that can be used instead of a pointer to a symbol in the program image
|
||||
APP_IMAGE_SYMBOL :: rawptr(addr_t(0))
|
||||
// pointer to a symbol in the callers image (same as B_CURRENT_IMAGE_SYMBOL)
|
||||
current_image_symbol :: proc() -> rawptr { return rawptr(current_image_symbol) }
|
||||
current_image_symbol :: proc "contextless" () -> rawptr { return rawptr(current_image_symbol) }
|
||||
|
||||
foreign import libroot "system:c"
|
||||
@(default_calling_convention="c")
|
||||
foreign libroot {
|
||||
find_directory :: proc(which: directory_which, volume: dev_t, createIt: bool, pathString: [^]c.char, length: i32) -> status_t ---
|
||||
find_path :: proc(codePointer: rawptr, baseDirectory: path_base_directory, subPath: cstring, pathBuffer: [^]c.char, bufferSize: c.size_t) -> status_t ---
|
||||
find_path_etc :: proc(codePointer: rawptr, dependency: cstring, architecture: cstring, baseDirectory: path_base_directory, subPath: cstring, flags: find_path_flags, pathBuffer: [^]c.char, bufferSize: c.size_t) -> status_t ---
|
||||
find_path_for_path :: proc(path: cstring, baseDirectory: path_base_directory, subPath: cstring, pathBuffer: [^]c.char, bufferSize: c.size_t) -> status_t ---
|
||||
find_path_for_path_etc :: proc(path: cstring, dependency: cstring, architecture: cstring, baseDirectory: path_base_directory, subPath: cstring, flags: find_path_flags, pathBuffer: [^]c.char, bufferSize: c.size_t) -> status_t ---
|
||||
find_paths :: proc(baseDirectory: path_base_directory, subPath: cstring, _paths: ^[^][^]c.char, _pathCount: ^c.size_t) -> status_t ---
|
||||
find_paths_etc :: proc(architecture: cstring, baseDirectory: path_base_directory, subPath: cstring, flags: find_path_flags, _paths: ^[^][^]c.char, _pathCount: ^c.size_t) -> status_t ---
|
||||
find_directory :: proc(which: directory_which, volume: dev_t, createIt: bool, pathString: [^]byte, length: i32) -> status_t ---
|
||||
find_path :: proc(codePointer: rawptr, baseDirectory: path_base_directory, subPath: cstring, pathBuffer: [^]byte, bufferSize: uint) -> status_t ---
|
||||
find_path_etc :: proc(codePointer: rawptr, dependency: cstring, architecture: cstring, baseDirectory: path_base_directory, subPath: cstring, flags: find_path_flags, pathBuffer: [^]byte, bufferSize: uint) -> status_t ---
|
||||
find_path_for_path :: proc(path: cstring, baseDirectory: path_base_directory, subPath: cstring, pathBuffer: [^]byte, bufferSize: uint) -> status_t ---
|
||||
find_path_for_path_etc :: proc(path: cstring, dependency: cstring, architecture: cstring, baseDirectory: path_base_directory, subPath: cstring, flags: find_path_flags, pathBuffer: [^]byte, bufferSize: uint) -> status_t ---
|
||||
find_paths :: proc(baseDirectory: path_base_directory, subPath: cstring, _paths: ^[^][^]byte, _pathCount: ^uint) -> status_t ---
|
||||
find_paths_etc :: proc(architecture: cstring, baseDirectory: path_base_directory, subPath: cstring, flags: find_path_flags, _paths: ^[^][^]byte, _pathCount: ^uint) -> status_t ---
|
||||
}
|
||||
|
||||
+141
-145
@@ -1,8 +1,8 @@
|
||||
#+build haiku
|
||||
package sys_haiku
|
||||
|
||||
import "core:c"
|
||||
import "core:sys/unix"
|
||||
import "base:intrinsics"
|
||||
import "core:sys/posix"
|
||||
|
||||
foreign import libroot "system:c"
|
||||
|
||||
@@ -18,8 +18,8 @@ OS_NAME_LENGTH :: 32
|
||||
|
||||
area_info :: struct {
|
||||
area: area_id,
|
||||
name: [OS_NAME_LENGTH]c.char,
|
||||
size: c.size_t,
|
||||
name: [OS_NAME_LENGTH]byte,
|
||||
size: uint,
|
||||
lock: u32,
|
||||
protection: u32,
|
||||
team: team_id,
|
||||
@@ -31,11 +31,11 @@ area_info :: struct {
|
||||
}
|
||||
|
||||
area_locking :: enum u32 {
|
||||
NO_LOCK = 0,
|
||||
LAZY_LOCK = 1,
|
||||
FULL_LOCK = 2,
|
||||
CONTIGUOUS = 3,
|
||||
LOMEM = 4, // CONTIGUOUS, < 16 MB physical address
|
||||
NO_LOCK = 0,
|
||||
LAZY_LOCK = 1,
|
||||
FULL_LOCK = 2,
|
||||
CONTIGUOUS = 3,
|
||||
LOMEM = 4, // CONTIGUOUS, < 16 MB physical address
|
||||
_32_BIT_FULL_LOCK = 5, // FULL_LOCK, < 4 GB physical addresses
|
||||
_32_BIT_CONTIGUOUS = 6, // CONTIGUOUS, < 4 GB physical address
|
||||
}
|
||||
@@ -52,27 +52,29 @@ address_spec :: enum u32 {
|
||||
RANDOMIZED_BASE_ADDRESS = 7,
|
||||
}
|
||||
|
||||
area_protection_flags :: enum u32 {
|
||||
READ_AREA = 1 << 0,
|
||||
WRITE_AREA = 1 << 1,
|
||||
EXECUTE_AREA = 1 << 2,
|
||||
area_protection_flag :: enum u32 {
|
||||
READ_AREA = 0,
|
||||
WRITE_AREA = 1,
|
||||
EXECUTE_AREA = 2,
|
||||
// "stack" protection is not available on most platforms - it's used
|
||||
// to only commit memory as needed, and have guard pages at the
|
||||
// bottom of the stack.
|
||||
STACK_AREA = 1 << 3,
|
||||
CLONEABLE_AREA = 1 << 8,
|
||||
STACK_AREA = 3,
|
||||
CLONEABLE_AREA = 8,
|
||||
}
|
||||
area_protection_flags :: distinct bit_set[area_protection_flag; u32]
|
||||
|
||||
@(default_calling_convention="c")
|
||||
foreign libroot {
|
||||
create_area :: proc(name: cstring, startAddress: ^rawptr, addressSpec: address_spec, size: c.size_t, lock: area_locking, protection: area_protection_flags) -> area_id ---
|
||||
create_area :: proc(name: cstring, startAddress: ^rawptr, addressSpec: address_spec, size: uint, lock: area_locking, protection: area_protection_flags) -> area_id ---
|
||||
clone_area :: proc(name: cstring, destAddress: ^rawptr, addressSpec: address_spec, protection: area_protection_flags, source: area_id) -> area_id ---
|
||||
find_area :: proc(name: cstring) -> area_id ---
|
||||
area_for :: proc(address: rawptr) -> area_id ---
|
||||
delete_area :: proc(id: area_id) -> status_t ---
|
||||
resize_area :: proc(id: area_id, newSize: c.size_t) -> status_t ---
|
||||
resize_area :: proc(id: area_id, newSize: uint) -> status_t ---
|
||||
set_area_protection :: proc(id: area_id, newProtection: area_protection_flags) -> status_t ---
|
||||
_get_area_info :: proc(id: area_id, areaInfo: ^area_info, size: c.size_t) -> status_t ---
|
||||
_get_next_area_info :: proc(team: team_id, cookie: ^c.ssize_t, areaInfo: ^area_info, size: c.size_t) -> status_t ---
|
||||
_get_area_info :: proc(id: area_id, areaInfo: ^area_info, size: uint) -> status_t ---
|
||||
_get_next_area_info :: proc(team: team_id, cookie: ^int, areaInfo: ^area_info, size: uint) -> status_t ---
|
||||
}
|
||||
|
||||
// Ports
|
||||
@@ -80,33 +82,35 @@ foreign libroot {
|
||||
port_info :: struct {
|
||||
port: port_id,
|
||||
team: team_id,
|
||||
name: [OS_NAME_LENGTH]c.char,
|
||||
name: [OS_NAME_LENGTH]byte,
|
||||
capacity: i32, // queue depth
|
||||
queue_count: i32, // # msgs waiting to be read
|
||||
total_count: i32, // total # msgs read so far
|
||||
}
|
||||
|
||||
port_flags :: enum u32 {
|
||||
USE_USER_MEMCPY = 0x80000000,
|
||||
port_flag :: enum u32 {
|
||||
USE_USER_MEMCPY = intrinsics.constant_log2(0x80000000),
|
||||
// read the message, but don't remove it; kernel-only; memory must be locked
|
||||
PEEK_PORT_MESSAGE = 0x100,
|
||||
PEEK_PORT_MESSAGE = intrinsics.constant_log2(0x100),
|
||||
}
|
||||
port_flags :: distinct bit_set[port_flag; u32]
|
||||
|
||||
@(default_calling_convention="c")
|
||||
foreign libroot {
|
||||
create_port :: proc(capacity: i32, name: cstring) -> port_id ---
|
||||
find_port :: proc(name: cstring) -> port_id ---
|
||||
read_port :: proc(port: port_id, code: ^i32, buffer: rawptr, bufferSize: c.size_t) -> c.ssize_t ---
|
||||
read_port_etc :: proc(port: port_id, code: ^i32, buffer: rawptr, bufferSize: c.size_t, flags: port_flags, timeout: bigtime_t) -> c.ssize_t ---
|
||||
write_port :: proc(port: port_id, code: i32, buffer: rawptr, bufferSize: c.size_t) -> status_t ---
|
||||
write_port_etc :: proc(port: port_id, code: i32, buffer: rawptr, bufferSize: c.size_t, flags: port_flags, timeout: bigtime_t) -> status_t ---
|
||||
read_port :: proc(port: port_id, code: ^i32, buffer: rawptr, bufferSize: uint) -> int ---
|
||||
read_port_etc :: proc(port: port_id, code: ^i32, buffer: rawptr, bufferSize: uint, flags: port_flags, timeout: bigtime_t) -> int ---
|
||||
write_port :: proc(port: port_id, code: i32, buffer: rawptr, bufferSize: uint) -> status_t ---
|
||||
write_port_etc :: proc(port: port_id, code: i32, buffer: rawptr, bufferSize: uint, flags: port_flags, timeout: bigtime_t) -> status_t ---
|
||||
close_port :: proc(port: port_id) -> status_t ---
|
||||
delete_port :: proc(port: port_id) -> status_t ---
|
||||
port_buffer_size :: proc(port: port_id) -> c.ssize_t ---
|
||||
port_buffer_size_etc :: proc(port: port_id, flags: port_flags, timeout: bigtime_t) -> c.ssize_t ---
|
||||
port_count :: proc(port: port_id) -> c.ssize_t ---
|
||||
port_buffer_size :: proc(port: port_id) -> int ---
|
||||
port_buffer_size_etc :: proc(port: port_id, flags: port_flags, timeout: bigtime_t) -> int ---
|
||||
port_count :: proc(port: port_id) -> int ---
|
||||
set_port_owner :: proc(port: port_id, team: team_id) -> status_t ---
|
||||
_get_port_info :: proc(port: port_id, portInfo: ^port_info, portInfoSize: c.size_t) -> status_t ---
|
||||
_get_next_port_info :: proc(team: team_id, cookie: ^i32, portInfo: ^port_info, portInfoSize: c.size_t) -> status_t ---
|
||||
_get_port_info :: proc(port: port_id, portInfo: ^port_info, portInfoSize: uint) -> status_t ---
|
||||
_get_next_port_info :: proc(team: team_id, cookie: ^i32, portInfo: ^port_info, portInfoSize: uint) -> status_t ---
|
||||
}
|
||||
|
||||
// Semaphores
|
||||
@@ -114,22 +118,24 @@ foreign libroot {
|
||||
sem_info :: struct {
|
||||
sem: sem_id,
|
||||
team: team_id,
|
||||
name: [OS_NAME_LENGTH]c.char,
|
||||
name: [OS_NAME_LENGTH]byte,
|
||||
count: i32,
|
||||
latest_holder: thread_id,
|
||||
}
|
||||
|
||||
semaphore_flags :: enum u32 {
|
||||
CAN_INTERRUPT = 0x01, // acquisition of the semaphore can be interrupted (system use only)
|
||||
CHECK_PERMISSION = 0x04, // ownership will be checked (system use only)
|
||||
KILL_CAN_INTERRUPT = 0x20, // acquisition of the semaphore can be interrupted by SIGKILL[THR], even if not CAN_INTERRUPT (system use only)
|
||||
semaphore_flag :: enum u32 {
|
||||
CAN_INTERRUPT = intrinsics.constant_log2(0x01), // acquisition of the semaphore can be interrupted (system use only)
|
||||
CHECK_PERMISSION = intrinsics.constant_log2(0x04), // ownership will be checked (system use only)
|
||||
KILL_CAN_INTERRUPT = intrinsics.constant_log2(0x20), // acquisition of the semaphore can be interrupted by SIGKILL[THR], even if not CAN_INTERRUPT (system use only)
|
||||
|
||||
// release_sem_etc() only flags
|
||||
DO_NOT_RESCHEDULE = 0x02, // thread is not rescheduled
|
||||
RELEASE_ALL = 0x08, // all waiting threads will be woken up, count will be zeroed
|
||||
RELEASE_IF_WAITING_ONLY = 0x10, // release count only if there are any threads waiting
|
||||
DO_NOT_RESCHEDULE = intrinsics.constant_log2(0x02), // thread is not rescheduled
|
||||
RELEASE_ALL = intrinsics.constant_log2(0x08), // all waiting threads will be woken up, count will be zeroed
|
||||
RELEASE_IF_WAITING_ONLY = intrinsics.constant_log2(0x10), // release count only if there are any threads waiting
|
||||
}
|
||||
semaphore_flags :: distinct bit_set[semaphore_flag; u32]
|
||||
|
||||
@(default_calling_convention="c")
|
||||
foreign libroot {
|
||||
create_sem :: proc(count: i32, name: cstring) -> sem_id ---
|
||||
delete_sem :: proc(id: sem_id) -> status_t ---
|
||||
@@ -141,8 +147,8 @@ foreign libroot {
|
||||
switch_sem_etc :: proc(semToBeReleased: sem_id, id: sem_id, count: i32, flags: semaphore_flags, timeout: bigtime_t) -> status_t ---
|
||||
get_sem_count :: proc(id: sem_id, threadCount: ^i32) -> status_t ---
|
||||
set_sem_owner :: proc(id: sem_id, team: team_id) -> status_t ---
|
||||
_get_sem_info :: proc(id: sem_id, info: ^sem_info, infoSize: c.size_t) -> status_t ---
|
||||
_get_next_sem_info :: proc(team: team_id, cookie: ^i32, info: ^sem_info, infoSize: c.size_t) -> status_t ---
|
||||
_get_sem_info :: proc(id: sem_id, info: ^sem_info, infoSize: uint) -> status_t ---
|
||||
_get_next_sem_info :: proc(team: team_id, cookie: ^i32, info: ^sem_info, infoSize: uint) -> status_t ---
|
||||
}
|
||||
|
||||
// Teams
|
||||
@@ -155,7 +161,7 @@ team_info :: struct {
|
||||
debugger_nub_thread: thread_id,
|
||||
debugger_nub_port: port_id,
|
||||
argc: i32,
|
||||
args: [64]c.char,
|
||||
args: [64]byte,
|
||||
uid: uid_t,
|
||||
gid: gid_t,
|
||||
|
||||
@@ -165,7 +171,7 @@ team_info :: struct {
|
||||
group_id: pid_t,
|
||||
session_id: pid_t,
|
||||
parent: team_id,
|
||||
name: [OS_NAME_LENGTH]c.char,
|
||||
name: [OS_NAME_LENGTH]byte,
|
||||
start_time: bigtime_t,
|
||||
}
|
||||
|
||||
@@ -183,17 +189,18 @@ team_usage_who :: enum i32 {
|
||||
CHILDREN = -1,
|
||||
}
|
||||
|
||||
@(default_calling_convention="c")
|
||||
foreign libroot {
|
||||
// see also: send_signal()
|
||||
kill_team :: proc(team: team_id) -> status_t ---
|
||||
_get_team_info :: proc(id: team_id, info: ^team_info, size: c.size_t) -> status_t ---
|
||||
_get_next_team_info :: proc(cookie: ^i32, info: ^team_info, size: c.size_t) -> status_t ---
|
||||
_get_team_usage_info :: proc(id: team_id, who: team_usage_who, info: ^team_usage_info, size: c.size_t) -> status_t ---
|
||||
_get_team_info :: proc(id: team_id, info: ^team_info, size: uint) -> status_t ---
|
||||
_get_next_team_info :: proc(cookie: ^i32, info: ^team_info, size: uint) -> status_t ---
|
||||
_get_team_usage_info :: proc(id: team_id, who: team_usage_who, info: ^team_usage_info, size: uint) -> status_t ---
|
||||
}
|
||||
|
||||
// Threads
|
||||
|
||||
thread_state :: enum c.int {
|
||||
thread_state :: enum i32 {
|
||||
RUNNING = 1,
|
||||
READY,
|
||||
RECEIVING,
|
||||
@@ -205,7 +212,7 @@ thread_state :: enum c.int {
|
||||
thread_info :: struct {
|
||||
thread: thread_id,
|
||||
team: team_id,
|
||||
name: [OS_NAME_LENGTH]c.char,
|
||||
name: [OS_NAME_LENGTH]byte,
|
||||
state: thread_state,
|
||||
priority: thread_priority,
|
||||
sem: sem_id,
|
||||
@@ -234,6 +241,7 @@ SYSTEM_TIMEBASE :: 0
|
||||
|
||||
thread_func :: #type proc "c" (rawptr) -> status_t
|
||||
|
||||
@(default_calling_convention="c")
|
||||
foreign libroot {
|
||||
spawn_thread :: proc(thread_func, name: cstring, priority: thread_priority, data: rawptr) -> thread_id ---
|
||||
kill_thread :: proc(thread: thread_id) -> status_t ---
|
||||
@@ -247,24 +255,25 @@ foreign libroot {
|
||||
wait_for_thread_etc :: proc(id: thread_id, flags: u32, timeout: bigtime_t, _returnCode: ^status_t) -> status_t ---
|
||||
on_exit_thread :: proc(callback: proc "c" (rawptr), data: rawptr) -> status_t ---
|
||||
find_thread :: proc(name: cstring) -> thread_id ---
|
||||
send_data :: proc(thread: thread_id, code: i32, buffer: rawptr, bufferSize: c.size_t) -> status_t ---
|
||||
receive_data :: proc(sender: ^thread_id, buffer: rawptr, bufferSize: c.size_t) -> i32 ---
|
||||
send_data :: proc(thread: thread_id, code: i32, buffer: rawptr, bufferSize: uint) -> status_t ---
|
||||
receive_data :: proc(sender: ^thread_id, buffer: rawptr, bufferSize: uint) -> i32 ---
|
||||
has_data :: proc(thread: thread_id) -> bool ---
|
||||
snooze :: proc(amount: bigtime_t) -> status_t ---
|
||||
// FIXME: Find and define those flags.
|
||||
snooze_etc :: proc(amount: bigtime_t, timeBase: c.int, flags: u32) -> status_t ---
|
||||
snooze_until :: proc(time: bigtime_t, timeBase: c.int) -> status_t ---
|
||||
_get_thread_info :: proc(id: thread_id, info: ^thread_info, size: c.size_t) -> status_t ---
|
||||
_get_next_thread_info :: proc(team: team_id, cookie: ^i32, info: ^thread_info, size: c.size_t) -> status_t ---
|
||||
snooze_etc :: proc(amount: bigtime_t, timeBase: i32, flags: u32) -> status_t ---
|
||||
snooze_until :: proc(time: bigtime_t, timeBase: i32) -> status_t ---
|
||||
_get_thread_info :: proc(id: thread_id, info: ^thread_info, size: uint) -> status_t ---
|
||||
_get_next_thread_info :: proc(team: team_id, cookie: ^i32, info: ^thread_info, size: uint) -> status_t ---
|
||||
// bridge to the pthread API
|
||||
get_pthread_thread_id :: proc(thread: pthread_t) -> thread_id ---
|
||||
}
|
||||
|
||||
// Time
|
||||
|
||||
@(default_calling_convention="c")
|
||||
foreign libroot {
|
||||
real_time_clock :: proc() -> c.ulong ---
|
||||
set_real_time_clock :: proc(secsSinceJan1st1970: c.ulong) ---
|
||||
real_time_clock :: proc() -> uint ---
|
||||
set_real_time_clock :: proc(secsSinceJan1st1970: uint) ---
|
||||
real_time_clock_usecs :: proc() -> bigtime_t ---
|
||||
// time since booting in microseconds
|
||||
system_time :: proc() -> bigtime_t ---
|
||||
@@ -280,12 +289,14 @@ alarm_mode :: enum u32 {
|
||||
PERIODIC_ALARM, // "when" specifies the period
|
||||
}
|
||||
|
||||
@(default_calling_convention="c")
|
||||
foreign libroot {
|
||||
set_alarm :: proc(_when: bigtime_t, mode: alarm_mode) -> bigtime_t ---
|
||||
}
|
||||
|
||||
// Debugger
|
||||
|
||||
@(default_calling_convention="c")
|
||||
foreign libroot {
|
||||
debugger :: proc(message: cstring) ---
|
||||
/*
|
||||
@@ -296,7 +307,7 @@ foreign libroot {
|
||||
|
||||
to re-enable the default debugger pass a zero.
|
||||
*/
|
||||
disable_debugger :: proc(state: c.int) -> c.int ---
|
||||
disable_debugger :: proc(state: i32) -> i32 ---
|
||||
}
|
||||
|
||||
// System information
|
||||
@@ -338,15 +349,15 @@ system_info :: struct {
|
||||
max_teams: u32,
|
||||
used_teams: u32,
|
||||
|
||||
kernel_name: [FILE_NAME_LENGTH]c.char,
|
||||
kernel_build_date: [OS_NAME_LENGTH]c.char,
|
||||
kernel_build_time: [OS_NAME_LENGTH]c.char,
|
||||
kernel_name: [FILE_NAME_LENGTH]byte,
|
||||
kernel_build_date: [OS_NAME_LENGTH]byte,
|
||||
kernel_build_time: [OS_NAME_LENGTH]byte,
|
||||
|
||||
kernel_version: i64,
|
||||
abi: u32, // the system API
|
||||
}
|
||||
|
||||
topology_level_type :: enum c.int {
|
||||
topology_level_type :: enum i32 {
|
||||
UNKNOWN,
|
||||
ROOT,
|
||||
SMT,
|
||||
@@ -354,7 +365,7 @@ topology_level_type :: enum c.int {
|
||||
PACKAGE,
|
||||
}
|
||||
|
||||
cpu_platform :: enum c.int {
|
||||
cpu_platform :: enum i32 {
|
||||
UNKNOWN,
|
||||
x86,
|
||||
x86_64,
|
||||
@@ -370,7 +381,7 @@ cpu_platform :: enum c.int {
|
||||
RISC_V,
|
||||
}
|
||||
|
||||
cpu_vendor :: enum c.int {
|
||||
cpu_vendor :: enum i32 {
|
||||
UNKNOWN,
|
||||
AMD,
|
||||
CYRIX,
|
||||
@@ -408,95 +419,80 @@ cpu_topology_node_info :: struct {
|
||||
},
|
||||
}
|
||||
|
||||
// FIXME: Add cpuid_info when bit fields are ready.
|
||||
when ODIN_ARCH == .amd64 || ODIN_ARCH == .i386 {
|
||||
cpuid_info :: struct #raw_union {
|
||||
eax_0: struct {
|
||||
max_eax: u32,
|
||||
vendor_id: [12]byte,
|
||||
},
|
||||
|
||||
eax_1: struct {
|
||||
using _: bit_field u32 {
|
||||
stepping: u32 | 4,
|
||||
model: u32 | 4,
|
||||
family: u32 | 4,
|
||||
type: u32 | 2,
|
||||
reserved_0: u32 | 2,
|
||||
extended_model: u32 | 4,
|
||||
extended_family: u32 | 8,
|
||||
reserved_1: u32 | 4,
|
||||
},
|
||||
|
||||
using _: bit_field u32 {
|
||||
brand_index: u32 | 8,
|
||||
clflush: u32 | 8,
|
||||
logical_cpus: u32 | 8,
|
||||
apic_id: u32 | 8,
|
||||
},
|
||||
|
||||
features: u32,
|
||||
extended_features: u32,
|
||||
},
|
||||
|
||||
eax_2: struct {
|
||||
call_num: u8,
|
||||
cache_descriptors: [15]u8,
|
||||
},
|
||||
|
||||
eax_3: struct {
|
||||
reserved: [2]u32,
|
||||
serial_number_high: u32,
|
||||
serial_number_low: u32,
|
||||
},
|
||||
|
||||
as_chars: [16]byte,
|
||||
|
||||
regs: struct {
|
||||
eax: u32,
|
||||
ebx: u32,
|
||||
edx: u32,
|
||||
ecx: u32,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@(default_calling_convention="c")
|
||||
foreign libroot {
|
||||
get_system_info :: proc(info: ^system_info) -> status_t ---
|
||||
_get_cpu_info_etc :: proc(firstCPU: u32, cpuCount: u32, info: ^cpu_info, size: c.size_t) -> status_t ---
|
||||
_get_cpu_info_etc :: proc(firstCPU: u32, cpuCount: u32, info: ^cpu_info, size: uint) -> status_t ---
|
||||
get_cpu_topology_info :: proc(topologyInfos: [^]cpu_topology_node_info, topologyInfoCount: ^u32) -> status_t ---
|
||||
|
||||
is_computer_on :: proc() -> i32 ---
|
||||
is_computer_on_fire :: proc() -> f64 ---
|
||||
when ODIN_ARCH == .amd64 || ODIN_ARCH == .i386 {
|
||||
get_cpuid :: proc(info: ^cpuid_info, eaxRegister: u32, cpuNum: u32) -> status_t ---
|
||||
}
|
||||
|
||||
is_computer_on :: proc() -> i32 ---
|
||||
is_computer_on_fire :: proc() -> f64 ---
|
||||
}
|
||||
|
||||
// Signal.h
|
||||
|
||||
SIG_BLOCK :: 1
|
||||
SIG_UNBLOCK :: 2
|
||||
SIG_SETMASK :: 3
|
||||
|
||||
/*
|
||||
* The list of all defined signals:
|
||||
*
|
||||
* The numbering of signals for Haiku attempts to maintain
|
||||
* some consistency with UN*X conventions so that things
|
||||
* like "kill -9" do what you expect.
|
||||
*/
|
||||
|
||||
SIGHUP :: 1 // hangup -- tty is gone!
|
||||
SIGINT :: 2 // interrupt
|
||||
SIGQUIT :: 3 // `quit' special character typed in tty
|
||||
SIGILL :: 4 // illegal instruction
|
||||
SIGCHLD :: 5 // child process exited
|
||||
SIGABRT :: 6 // abort() called, dont' catch
|
||||
SIGPIPE :: 7 // write to a pipe w/no readers
|
||||
SIGFPE :: 8 // floating point exception
|
||||
SIGKILL :: 9 // kill a team (not catchable)
|
||||
SIGSTOP :: 10 // suspend a thread (not catchable)
|
||||
SIGSEGV :: 11 // segmentation violation (read: invalid pointer)
|
||||
SIGCONT :: 12 // continue execution if suspended
|
||||
SIGTSTP :: 13 // `stop' special character typed in tty
|
||||
SIGALRM :: 14 // an alarm has gone off (see alarm())
|
||||
SIGTERM :: 15 // termination requested
|
||||
SIGTTIN :: 16 // read of tty from bg process
|
||||
SIGTTOU :: 17 // write to tty from bg process
|
||||
SIGUSR1 :: 18 // app defined signal 1
|
||||
SIGUSR2 :: 19 // app defined signal 2
|
||||
SIGWINCH :: 20 // tty window size changed
|
||||
SIGKILLTHR :: 21 // be specific: kill just the thread, not team
|
||||
SIGTRAP :: 22 // Trace/breakpoint trap
|
||||
SIGPOLL :: 23 // Pollable event
|
||||
SIGPROF :: 24 // Profiling timer expired
|
||||
SIGSYS :: 25 // Bad system call
|
||||
SIGURG :: 26 // High bandwidth data is available at socket
|
||||
SIGVTALRM :: 27 // Virtual timer expired
|
||||
SIGXCPU :: 28 // CPU time limit exceeded
|
||||
SIGXFSZ :: 29 // File size limit exceeded
|
||||
SIGBUS :: 30 // access to undefined portion of a memory object
|
||||
|
||||
sigval :: struct #raw_union {
|
||||
sival_int: c.int,
|
||||
sival_ptr: rawptr,
|
||||
}
|
||||
|
||||
siginfo_t :: struct {
|
||||
si_signo: c.int, // signal number
|
||||
si_code: c.int, // signal code
|
||||
si_errno: c.int, // if non zero, an error number associated with this signal
|
||||
|
||||
si_pid: pid_t, // sending process ID
|
||||
si_uid: uid_t, // real user ID of sending process
|
||||
si_addr: rawptr, // address of faulting instruction
|
||||
si_status: c.int, // exit value or signal
|
||||
si_band: c.long, // band event for SIGPOLL
|
||||
si_value: sigval, // signal value
|
||||
}
|
||||
// POSIX signals
|
||||
|
||||
@(default_calling_convention="c")
|
||||
foreign libroot {
|
||||
// signal set (sigset_t) manipulation
|
||||
sigemptyset :: proc(set: ^sigset_t) -> c.int ---
|
||||
sigfillset :: proc(set: ^sigset_t) -> c.int ---
|
||||
sigaddset :: proc(set: ^sigset_t, _signal: c.int) -> c.int ---
|
||||
sigdelset :: proc(set: ^sigset_t, _signal: c.int) -> c.int ---
|
||||
sigismember :: proc(set: ^sigset_t, _signal: c.int) -> c.int ---
|
||||
// querying and waiting for signals
|
||||
sigpending :: proc(set: ^sigset_t) -> c.int ---
|
||||
sigsuspend :: proc(mask: ^sigset_t) -> c.int ---
|
||||
sigpause :: proc(_signal: c.int) -> c.int ---
|
||||
sigwait :: proc(set: ^sigset_t, _signal: ^c.int) -> c.int ---
|
||||
sigwaitinfo :: proc(set: ^sigset_t, info: ^siginfo_t) -> c.int ---
|
||||
sigtimedwait :: proc(set: ^sigset_t, info: ^siginfo_t, timeout: ^unix.timespec) -> c.int ---
|
||||
/*
|
||||
Wait for queued signals.
|
||||
|
||||
send_signal :: proc(threadID: thread_id, signal: c.uint) -> c.int ---
|
||||
set_signal_stack :: proc(base: rawptr, size: c.size_t) ---
|
||||
[[ More; https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigtimedwait.html ]]
|
||||
*/
|
||||
sigtimedwait :: proc(set: ^posix.sigset_t, info: ^posix.siginfo_t, timeout: ^posix.timespec) -> posix.result ---
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#+build haiku
|
||||
package sys_haiku
|
||||
|
||||
import "core:c"
|
||||
|
||||
status_t :: i32
|
||||
status_t :: Errno
|
||||
bigtime_t :: i64
|
||||
nanotime_t :: i64
|
||||
type_code :: u32
|
||||
@@ -37,16 +35,20 @@ mode_t :: u32
|
||||
umode_t :: u32
|
||||
nlink_t :: i32
|
||||
|
||||
caddr_t :: ^c.char
|
||||
caddr_t :: [^]byte
|
||||
|
||||
addr_t :: phys_addr_t
|
||||
key_t :: i32
|
||||
|
||||
clockid_t :: i32
|
||||
|
||||
time_t :: i64 when ODIN_ARCH == .amd64 || ODIN_ARCH == .arm64 else i32
|
||||
time_t :: int
|
||||
timespec :: struct {
|
||||
tv_sec: time_t,
|
||||
tv_nsec: int,
|
||||
}
|
||||
|
||||
sig_atomic_t :: c.int
|
||||
sig_atomic_t :: i32
|
||||
sigset_t :: u64
|
||||
|
||||
image_id :: i32
|
||||
|
||||
@@ -23,6 +23,7 @@ CPU_Feature :: enum u64 {
|
||||
popcnt, // Hamming weight instruction POPCNT.
|
||||
rdrand, // RDRAND instruction (on-chip random number generator)
|
||||
rdseed, // RDSEED instruction (on-chip random number generator)
|
||||
sha, // SHA Extensions (SHA-1, SHA-224, SHA-256)
|
||||
sse2, // Streaming SIMD extension 2 (always available on amd64)
|
||||
sse3, // Streaming SIMD extension 3
|
||||
ssse3, // Supplemental streaming SIMD extension 3
|
||||
@@ -115,6 +116,7 @@ init_cpu_features :: proc "c" () {
|
||||
|
||||
_, ebx7, ecx7, edx7 := cpuid(7, 0)
|
||||
try_set(&set, .bmi1, 3, ebx7)
|
||||
try_set(&set, .sha, 29, ebx7)
|
||||
if os_supports_avx {
|
||||
try_set(&set, .avx2, 5, ebx7)
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ Made available under Odin's BSD-3 license.
|
||||
|
||||
List of contributors:
|
||||
Jeroen van Rijn: Initial implementation.
|
||||
Laytan: ARM and RISC-V CPU feature detection.
|
||||
Laytan: ARM and RISC-V CPU feature detection, iOS/macOS platform overhaul.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,596 +1,101 @@
|
||||
package sysinfo
|
||||
|
||||
import sys "core:sys/unix"
|
||||
import "core:strconv"
|
||||
import "core:strings"
|
||||
import "base:runtime"
|
||||
import "core:strconv"
|
||||
import "core:strings"
|
||||
import "core:sys/unix"
|
||||
import NS "core:sys/darwin/Foundation"
|
||||
|
||||
@(private)
|
||||
version_string_buf: [1024]u8
|
||||
|
||||
@(init, private)
|
||||
init_os_version :: proc () {
|
||||
os_version.platform = .MacOS
|
||||
init_platform :: proc() {
|
||||
ws :: strings.write_string
|
||||
wi :: strings.write_int
|
||||
|
||||
// Start building display version
|
||||
b := strings.builder_from_bytes(version_string_buf[:])
|
||||
|
||||
mib := []i32{sys.CTL_KERN, sys.KERN_OSVERSION}
|
||||
build_buf: [12]u8
|
||||
version: NS.OperatingSystemVersion
|
||||
{
|
||||
NS.scoped_autoreleasepool()
|
||||
|
||||
ok := sys.sysctl(mib, &build_buf)
|
||||
if !ok {
|
||||
strings.write_string(&b, "macOS Unknown")
|
||||
os_version.as_string = strings.to_string(b)
|
||||
return
|
||||
info := NS.ProcessInfo.processInfo()
|
||||
version = info->operatingSystemVersion()
|
||||
mem := info->physicalMemory()
|
||||
|
||||
ram.total_ram = int(mem)
|
||||
}
|
||||
|
||||
build := string(cstring(&build_buf[0]))
|
||||
macos_version = {int(version.majorVersion), int(version.minorVersion), int(version.patchVersion)}
|
||||
|
||||
// Do we have an exact match?
|
||||
match: Darwin_Match
|
||||
rel, exact := macos_release_map[build]
|
||||
|
||||
if exact {
|
||||
match = .Exact
|
||||
when ODIN_PLATFORM_SUBTARGET == .iOS {
|
||||
os_version.platform = .iOS
|
||||
ws(&b, "iOS")
|
||||
} else {
|
||||
os_version.platform = .MacOS
|
||||
switch version.majorVersion {
|
||||
case 15: ws(&b, "macOS Sequoia")
|
||||
case 14: ws(&b, "macOS Sonoma")
|
||||
case 13: ws(&b, "macOS Ventura")
|
||||
case 12: ws(&b, "macOS Monterey")
|
||||
case 11: ws(&b, "macOS Big Sur")
|
||||
case 10:
|
||||
switch version.minorVersion {
|
||||
case 15: ws(&b, "macOS Catalina")
|
||||
case 14: ws(&b, "macOS Mojave")
|
||||
case 13: ws(&b, "macOS High Sierra")
|
||||
case 12: ws(&b, "macOS Sierra")
|
||||
case 11: ws(&b, "OS X El Capitan")
|
||||
case 10: ws(&b, "OS X Yosemite")
|
||||
case:
|
||||
// `ProcessInfo.operatingSystemVersion` is 10.10 and up.
|
||||
unreachable()
|
||||
}
|
||||
case:
|
||||
// New version not yet added here.
|
||||
assert(version.majorVersion > 15)
|
||||
ws(&b, "macOS Unknown")
|
||||
}
|
||||
}
|
||||
|
||||
ws(&b, " ")
|
||||
wi(&b, int(version.majorVersion))
|
||||
ws(&b, ".")
|
||||
wi(&b, int(version.minorVersion))
|
||||
ws(&b, ".")
|
||||
wi(&b, int(version.patchVersion))
|
||||
|
||||
{
|
||||
build_buf: [12]u8
|
||||
mib := []i32{unix.CTL_KERN, unix.KERN_OSVERSION}
|
||||
ok := unix.sysctl(mib, &build_buf)
|
||||
build := string(cstring(raw_data(build_buf[:]))) if ok else "Unknown"
|
||||
|
||||
ws(&b, " (build ")
|
||||
|
||||
build_start := len(b.buf)
|
||||
ws(&b, build)
|
||||
os_version.version = string(b.buf[build_start:][:len(build)])
|
||||
}
|
||||
|
||||
{
|
||||
// Match on XNU kernel version
|
||||
mib = []i32{sys.CTL_KERN, sys.KERN_OSRELEASE}
|
||||
version_bits: [12]u8 // enough for 999.999.999\x00
|
||||
have_kernel_version := sys.sysctl(mib, &version_bits)
|
||||
mib := []i32{unix.CTL_KERN, unix.KERN_OSRELEASE}
|
||||
ok := unix.sysctl(mib, &version_bits)
|
||||
kernel := string(cstring(raw_data(version_bits[:]))) if ok else "Unknown"
|
||||
|
||||
major_ok, minor_ok, patch_ok: bool
|
||||
major, _, tail := strings.partition(kernel, ".")
|
||||
minor, _, patch := strings.partition(tail, ".")
|
||||
|
||||
tmp := runtime.default_temp_allocator_temp_begin()
|
||||
os_version.major, _ = strconv.parse_int(major, 10)
|
||||
os_version.minor, _ = strconv.parse_int(minor, 10)
|
||||
os_version.patch, _ = strconv.parse_int(patch, 10)
|
||||
|
||||
triplet := strings.split(string(cstring(&version_bits[0])), ".", context.temp_allocator)
|
||||
if len(triplet) != 3 {
|
||||
have_kernel_version = false
|
||||
} else {
|
||||
rel.darwin.x, major_ok = strconv.parse_int(triplet[0])
|
||||
rel.darwin.y, minor_ok = strconv.parse_int(triplet[1])
|
||||
rel.darwin.z, patch_ok = strconv.parse_int(triplet[2])
|
||||
|
||||
if !(major_ok && minor_ok && patch_ok) {
|
||||
have_kernel_version = false
|
||||
}
|
||||
}
|
||||
|
||||
runtime.default_temp_allocator_temp_end(tmp)
|
||||
|
||||
if !have_kernel_version {
|
||||
// We don't know the kernel version, but we do know the build
|
||||
strings.write_string(&b, "macOS Unknown (build ")
|
||||
l := strings.builder_len(b)
|
||||
strings.write_string(&b, build)
|
||||
os_version.version = strings.to_string(b)[l:]
|
||||
strings.write_rune(&b, ')')
|
||||
os_version.as_string = strings.to_string(b)
|
||||
return
|
||||
}
|
||||
rel, match = map_darwin_kernel_version_to_macos_release(build, rel.darwin)
|
||||
ws(&b, ", kernel ")
|
||||
ws(&b, kernel)
|
||||
ws(&b, ")")
|
||||
}
|
||||
|
||||
os_version.major = rel.darwin.x
|
||||
os_version.minor = rel.darwin.y
|
||||
os_version.patch = rel.darwin.z
|
||||
|
||||
macos_version = transmute(Version)rel.release.version
|
||||
|
||||
strings.write_string(&b, rel.os_name)
|
||||
if match == .Exact || match == .Nearest {
|
||||
strings.write_rune(&b, ' ')
|
||||
strings.write_string(&b, rel.release.name)
|
||||
strings.write_rune(&b, ' ')
|
||||
strings.write_int(&b, rel.release.version.x)
|
||||
if rel.release.version.y > 0 || rel.release.version.z > 0 {
|
||||
strings.write_rune(&b, '.')
|
||||
strings.write_int(&b, rel.release.version.y)
|
||||
}
|
||||
if rel.release.version.z > 0 {
|
||||
strings.write_rune(&b, '.')
|
||||
strings.write_int(&b, rel.release.version.z)
|
||||
}
|
||||
if match == .Nearest {
|
||||
strings.write_rune(&b, '?')
|
||||
}
|
||||
} else {
|
||||
strings.write_string(&b, " Unknown")
|
||||
}
|
||||
|
||||
strings.write_string(&b, " (build ")
|
||||
l := strings.builder_len(b)
|
||||
strings.write_string(&b, build)
|
||||
os_version.version = strings.to_string(b)[l:]
|
||||
|
||||
strings.write_string(&b, ", kernel ")
|
||||
strings.write_int(&b, rel.darwin.x)
|
||||
strings.write_rune(&b, '.')
|
||||
strings.write_int(&b, rel.darwin.y)
|
||||
strings.write_rune(&b, '.')
|
||||
strings.write_int(&b, rel.darwin.z)
|
||||
strings.write_rune(&b, ')')
|
||||
|
||||
os_version.as_string = strings.to_string(b)
|
||||
}
|
||||
|
||||
@(init, private)
|
||||
init_ram :: proc() {
|
||||
// Retrieve RAM info using `sysctl`
|
||||
|
||||
mib := []i32{sys.CTL_HW, sys.HW_MEMSIZE}
|
||||
mem_size: u64
|
||||
if sys.sysctl(mib, &mem_size) {
|
||||
ram.total_ram = int(mem_size)
|
||||
}
|
||||
}
|
||||
|
||||
@(private)
|
||||
Darwin_To_Release :: struct {
|
||||
darwin: [3]int, // Darwin kernel triplet
|
||||
os_name: string, // OS X, MacOS
|
||||
release: struct {
|
||||
name: string, // Monterey, Mojave, etc.
|
||||
version: [3]int, // 12.4, etc.
|
||||
},
|
||||
}
|
||||
|
||||
// Important: Order from lowest to highest kernel version
|
||||
@(private)
|
||||
macos_release_map: map[string]Darwin_To_Release = {
|
||||
// MacOS Tiger
|
||||
"8A428" = {{8, 0, 0}, "macOS", {"Tiger", {10, 4, 0}}},
|
||||
"8A432" = {{8, 0, 0}, "macOS", {"Tiger", {10, 4, 0}}},
|
||||
"8B15" = {{8, 1, 0}, "macOS", {"Tiger", {10, 4, 1}}},
|
||||
"8B17" = {{8, 1, 0}, "macOS", {"Tiger", {10, 4, 1}}},
|
||||
"8C46" = {{8, 2, 0}, "macOS", {"Tiger", {10, 4, 2}}},
|
||||
"8C47" = {{8, 2, 0}, "macOS", {"Tiger", {10, 4, 2}}},
|
||||
"8E102" = {{8, 2, 0}, "macOS", {"Tiger", {10, 4, 2}}},
|
||||
"8E45" = {{8, 2, 0}, "macOS", {"Tiger", {10, 4, 2}}},
|
||||
"8E90" = {{8, 2, 0}, "macOS", {"Tiger", {10, 4, 2}}},
|
||||
"8F46" = {{8, 3, 0}, "macOS", {"Tiger", {10, 4, 3}}},
|
||||
"8G32" = {{8, 4, 0}, "macOS", {"Tiger", {10, 4, 4}}},
|
||||
"8G1165" = {{8, 4, 0}, "macOS", {"Tiger", {10, 4, 4}}},
|
||||
"8H14" = {{8, 5, 0}, "macOS", {"Tiger", {10, 4, 5}}},
|
||||
"8G1454" = {{8, 5, 0}, "macOS", {"Tiger", {10, 4, 5}}},
|
||||
"8I127" = {{8, 6, 0}, "macOS", {"Tiger", {10, 4, 6}}},
|
||||
"8I1119" = {{8, 6, 0}, "macOS", {"Tiger", {10, 4, 6}}},
|
||||
"8J135" = {{8, 7, 0}, "macOS", {"Tiger", {10, 4, 7}}},
|
||||
"8J2135a" = {{8, 7, 0}, "macOS", {"Tiger", {10, 4, 7}}},
|
||||
"8K1079" = {{8, 7, 0}, "macOS", {"Tiger", {10, 4, 7}}},
|
||||
"8N5107" = {{8, 7, 0}, "macOS", {"Tiger", {10, 4, 7}}},
|
||||
"8L127" = {{8, 8, 0}, "macOS", {"Tiger", {10, 4, 8}}},
|
||||
"8L2127" = {{8, 8, 0}, "macOS", {"Tiger", {10, 4, 8}}},
|
||||
"8P135" = {{8, 9, 0}, "macOS", {"Tiger", {10, 4, 9}}},
|
||||
"8P2137" = {{8, 9, 0}, "macOS", {"Tiger", {10, 4, 9}}},
|
||||
"8R218" = {{8, 10, 0}, "macOS", {"Tiger", {10, 4, 10}}},
|
||||
"8R2218" = {{8, 10, 0}, "macOS", {"Tiger", {10, 4, 10}}},
|
||||
"8R2232" = {{8, 10, 0}, "macOS", {"Tiger", {10, 4, 10}}},
|
||||
"8S165" = {{8, 11, 0}, "macOS", {"Tiger", {10, 4, 11}}},
|
||||
"8S2167" = {{8, 11, 0}, "macOS", {"Tiger", {10, 4, 11}}},
|
||||
|
||||
// MacOS Leopard
|
||||
"9A581" = {{9, 0, 0}, "macOS", {"Leopard", {10, 5, 0}}},
|
||||
"9B18" = {{9, 1, 0}, "macOS", {"Leopard", {10, 5, 1}}},
|
||||
"9B2117" = {{9, 1, 1}, "macOS", {"Leopard", {10, 5, 1}}},
|
||||
"9C31" = {{9, 2, 0}, "macOS", {"Leopard", {10, 5, 2}}},
|
||||
"9C7010" = {{9, 2, 0}, "macOS", {"Leopard", {10, 5, 2}}},
|
||||
"9D34" = {{9, 3, 0}, "macOS", {"Leopard", {10, 5, 3}}},
|
||||
"9E17" = {{9, 4, 0}, "macOS", {"Leopard", {10, 5, 4}}},
|
||||
"9F33" = {{9, 5, 0}, "macOS", {"Leopard", {10, 5, 5}}},
|
||||
"9G55" = {{9, 6, 0}, "macOS", {"Leopard", {10, 5, 6}}},
|
||||
"9G66" = {{9, 6, 0}, "macOS", {"Leopard", {10, 5, 6}}},
|
||||
"9G71" = {{9, 6, 0}, "macOS", {"Leopard", {10, 5, 6}}},
|
||||
"9J61" = {{9, 7, 0}, "macOS", {"Leopard", {10, 5, 7}}},
|
||||
"9L30" = {{9, 8, 0}, "macOS", {"Leopard", {10, 5, 8}}},
|
||||
"9L34" = {{9, 8, 0}, "macOS", {"Leopard", {10, 5, 8}}},
|
||||
|
||||
// MacOS Snow Leopard
|
||||
"10A432" = {{10, 0, 0}, "macOS", {"Snow Leopard", {10, 6, 0}}},
|
||||
"10A433" = {{10, 0, 0}, "macOS", {"Snow Leopard", {10, 6, 0}}},
|
||||
"10B504" = {{10, 1, 0}, "macOS", {"Snow Leopard", {10, 6, 1}}},
|
||||
"10C540" = {{10, 2, 0}, "macOS", {"Snow Leopard", {10, 6, 2}}},
|
||||
"10D573" = {{10, 3, 0}, "macOS", {"Snow Leopard", {10, 6, 3}}},
|
||||
"10D575" = {{10, 3, 0}, "macOS", {"Snow Leopard", {10, 6, 3}}},
|
||||
"10D578" = {{10, 3, 0}, "macOS", {"Snow Leopard", {10, 6, 3}}},
|
||||
"10F569" = {{10, 4, 0}, "macOS", {"Snow Leopard", {10, 6, 4}}},
|
||||
"10H574" = {{10, 5, 0}, "macOS", {"Snow Leopard", {10, 6, 5}}},
|
||||
"10J567" = {{10, 6, 0}, "macOS", {"Snow Leopard", {10, 6, 6}}},
|
||||
"10J869" = {{10, 7, 0}, "macOS", {"Snow Leopard", {10, 6, 7}}},
|
||||
"10J3250" = {{10, 7, 0}, "macOS", {"Snow Leopard", {10, 6, 7}}},
|
||||
"10J4138" = {{10, 7, 0}, "macOS", {"Snow Leopard", {10, 6, 7}}},
|
||||
"10K540" = {{10, 8, 0}, "macOS", {"Snow Leopard", {10, 6, 8}}},
|
||||
"10K549" = {{10, 8, 0}, "macOS", {"Snow Leopard", {10, 6, 8}}},
|
||||
|
||||
// MacOS Lion
|
||||
"11A511" = {{11, 0, 0}, "macOS", {"Lion", {10, 7, 0}}},
|
||||
"11A511s" = {{11, 0, 0}, "macOS", {"Lion", {10, 7, 0}}},
|
||||
"11A2061" = {{11, 0, 2}, "macOS", {"Lion", {10, 7, 0}}},
|
||||
"11A2063" = {{11, 0, 2}, "macOS", {"Lion", {10, 7, 0}}},
|
||||
"11B26" = {{11, 1, 0}, "macOS", {"Lion", {10, 7, 1}}},
|
||||
"11B2118" = {{11, 1, 0}, "macOS", {"Lion", {10, 7, 1}}},
|
||||
"11C74" = {{11, 2, 0}, "macOS", {"Lion", {10, 7, 2}}},
|
||||
"11D50" = {{11, 3, 0}, "macOS", {"Lion", {10, 7, 3}}},
|
||||
"11E53" = {{11, 4, 0}, "macOS", {"Lion", {10, 7, 4}}},
|
||||
"11G56" = {{11, 4, 2}, "macOS", {"Lion", {10, 7, 5}}},
|
||||
"11G63" = {{11, 4, 2}, "macOS", {"Lion", {10, 7, 5}}},
|
||||
|
||||
// MacOS Mountain Lion
|
||||
"12A269" = {{12, 0, 0}, "macOS", {"Mountain Lion", {10, 8, 0}}},
|
||||
"12B19" = {{12, 1, 0}, "macOS", {"Mountain Lion", {10, 8, 1}}},
|
||||
"12C54" = {{12, 2, 0}, "macOS", {"Mountain Lion", {10, 8, 2}}},
|
||||
"12C60" = {{12, 2, 0}, "macOS", {"Mountain Lion", {10, 8, 2}}},
|
||||
"12C2034" = {{12, 2, 0}, "macOS", {"Mountain Lion", {10, 8, 2}}},
|
||||
"12C3104" = {{12, 2, 0}, "macOS", {"Mountain Lion", {10, 8, 2}}},
|
||||
"12D78" = {{12, 3, 0}, "macOS", {"Mountain Lion", {10, 8, 3}}},
|
||||
"12E55" = {{12, 4, 0}, "macOS", {"Mountain Lion", {10, 8, 4}}},
|
||||
"12E3067" = {{12, 4, 0}, "macOS", {"Mountain Lion", {10, 8, 4}}},
|
||||
"12E4022" = {{12, 4, 0}, "macOS", {"Mountain Lion", {10, 8, 4}}},
|
||||
"12F37" = {{12, 5, 0}, "macOS", {"Mountain Lion", {10, 8, 5}}},
|
||||
"12F45" = {{12, 5, 0}, "macOS", {"Mountain Lion", {10, 8, 5}}},
|
||||
"12F2501" = {{12, 5, 0}, "macOS", {"Mountain Lion", {10, 8, 5}}},
|
||||
"12F2518" = {{12, 5, 0}, "macOS", {"Mountain Lion", {10, 8, 5}}},
|
||||
"12F2542" = {{12, 5, 0}, "macOS", {"Mountain Lion", {10, 8, 5}}},
|
||||
"12F2560" = {{12, 5, 0}, "macOS", {"Mountain Lion", {10, 8, 5}}},
|
||||
|
||||
// MacOS Mavericks
|
||||
"13A603" = {{13, 0, 0}, "macOS", {"Mavericks", {10, 9, 0}}},
|
||||
"13B42" = {{13, 0, 0}, "macOS", {"Mavericks", {10, 9, 1}}},
|
||||
"13C64" = {{13, 1, 0}, "macOS", {"Mavericks", {10, 9, 2}}},
|
||||
"13C1021" = {{13, 1, 0}, "macOS", {"Mavericks", {10, 9, 2}}},
|
||||
"13D65" = {{13, 2, 0}, "macOS", {"Mavericks", {10, 9, 3}}},
|
||||
"13E28" = {{13, 3, 0}, "macOS", {"Mavericks", {10, 9, 4}}},
|
||||
"13F34" = {{13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}},
|
||||
"13F1066" = {{13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}},
|
||||
"13F1077" = {{13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}},
|
||||
"13F1096" = {{13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}},
|
||||
"13F1112" = {{13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}},
|
||||
"13F1134" = {{13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}},
|
||||
"13F1507" = {{13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}},
|
||||
"13F1603" = {{13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}},
|
||||
"13F1712" = {{13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}},
|
||||
"13F1808" = {{13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}},
|
||||
"13F1911" = {{13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}},
|
||||
|
||||
// MacOS Yosemite
|
||||
"14A389" = {{14, 0, 0}, "macOS", {"Yosemite", {10, 10, 0}}},
|
||||
"14B25" = {{14, 0, 0}, "macOS", {"Yosemite", {10, 10, 1}}},
|
||||
"14C109" = {{14, 1, 0}, "macOS", {"Yosemite", {10, 10, 2}}},
|
||||
"14C1510" = {{14, 1, 0}, "macOS", {"Yosemite", {10, 10, 2}}},
|
||||
"14C2043" = {{14, 1, 0}, "macOS", {"Yosemite", {10, 10, 2}}},
|
||||
"14C1514" = {{14, 1, 0}, "macOS", {"Yosemite", {10, 10, 2}}},
|
||||
"14C2513" = {{14, 1, 0}, "macOS", {"Yosemite", {10, 10, 2}}},
|
||||
"14D131" = {{14, 3, 0}, "macOS", {"Yosemite", {10, 10, 3}}},
|
||||
"14D136" = {{14, 3, 0}, "macOS", {"Yosemite", {10, 10, 3}}},
|
||||
"14E46" = {{14, 4, 0}, "macOS", {"Yosemite", {10, 10, 4}}},
|
||||
"14F27" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
|
||||
"14F1021" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
|
||||
"14F1505" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
|
||||
"14F1509" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
|
||||
"14F1605" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
|
||||
"14F1713" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
|
||||
"14F1808" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
|
||||
"14F1909" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
|
||||
"14F1912" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
|
||||
"14F2009" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
|
||||
"14F2109" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
|
||||
"14F2315" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
|
||||
"14F2411" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
|
||||
"14F2511" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
|
||||
|
||||
// MacOS El Capitan
|
||||
"15A284" = {{15, 0, 0}, "macOS", {"El Capitan", {10, 11, 0}}},
|
||||
"15B42" = {{15, 0, 0}, "macOS", {"El Capitan", {10, 11, 1}}},
|
||||
"15C50" = {{15, 2, 0}, "macOS", {"El Capitan", {10, 11, 2}}},
|
||||
"15D21" = {{15, 3, 0}, "macOS", {"El Capitan", {10, 11, 3}}},
|
||||
"15E65" = {{15, 4, 0}, "macOS", {"El Capitan", {10, 11, 4}}},
|
||||
"15F34" = {{15, 5, 0}, "macOS", {"El Capitan", {10, 11, 5}}},
|
||||
"15G31" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
|
||||
"15G1004" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
|
||||
"15G1011" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
|
||||
"15G1108" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
|
||||
"15G1212" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
|
||||
"15G1217" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
|
||||
"15G1421" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
|
||||
"15G1510" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
|
||||
"15G1611" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
|
||||
"15G17023" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
|
||||
"15G18013" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
|
||||
"15G19009" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
|
||||
"15G20015" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
|
||||
"15G21013" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
|
||||
"15G22010" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
|
||||
|
||||
// MacOS Sierra
|
||||
"16A323" = {{16, 0, 0}, "macOS", {"Sierra", {10, 12, 0}}},
|
||||
"16B2555" = {{16, 1, 0}, "macOS", {"Sierra", {10, 12, 1}}},
|
||||
"16B2657" = {{16, 1, 0}, "macOS", {"Sierra", {10, 12, 1}}},
|
||||
"16C67" = {{16, 3, 0}, "macOS", {"Sierra", {10, 12, 2}}},
|
||||
"16C68" = {{16, 3, 0}, "macOS", {"Sierra", {10, 12, 2}}},
|
||||
"16D32" = {{16, 4, 0}, "macOS", {"Sierra", {10, 12, 3}}},
|
||||
"16E195" = {{16, 5, 0}, "macOS", {"Sierra", {10, 12, 4}}},
|
||||
"16F73" = {{16, 6, 0}, "macOS", {"Sierra", {10, 12, 5}}},
|
||||
"16F2073" = {{16, 6, 0}, "macOS", {"Sierra", {10, 12, 5}}},
|
||||
"16G29" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
|
||||
"16G1036" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
|
||||
"16G1114" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
|
||||
"16G1212" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
|
||||
"16G1314" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
|
||||
"16G1408" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
|
||||
"16G1510" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
|
||||
"16G1618" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
|
||||
"16G1710" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
|
||||
"16G1815" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
|
||||
"16G1917" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
|
||||
"16G1918" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
|
||||
"16G2016" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
|
||||
"16G2127" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
|
||||
"16G2128" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
|
||||
"16G2136" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
|
||||
|
||||
// MacOS High Sierra
|
||||
"17A365" = {{17, 0, 0}, "macOS", {"High Sierra", {10, 13, 0}}},
|
||||
"17A405" = {{17, 0, 0}, "macOS", {"High Sierra", {10, 13, 0}}},
|
||||
"17B48" = {{17, 2, 0}, "macOS", {"High Sierra", {10, 13, 1}}},
|
||||
"17B1002" = {{17, 2, 0}, "macOS", {"High Sierra", {10, 13, 1}}},
|
||||
"17B1003" = {{17, 2, 0}, "macOS", {"High Sierra", {10, 13, 1}}},
|
||||
"17C88" = {{17, 3, 0}, "macOS", {"High Sierra", {10, 13, 2}}},
|
||||
"17C89" = {{17, 3, 0}, "macOS", {"High Sierra", {10, 13, 2}}},
|
||||
"17C205" = {{17, 3, 0}, "macOS", {"High Sierra", {10, 13, 2}}},
|
||||
"17C2205" = {{17, 3, 0}, "macOS", {"High Sierra", {10, 13, 2}}},
|
||||
"17D47" = {{17, 4, 0}, "macOS", {"High Sierra", {10, 13, 3}}},
|
||||
"17D2047" = {{17, 4, 0}, "macOS", {"High Sierra", {10, 13, 3}}},
|
||||
"17D102" = {{17, 4, 0}, "macOS", {"High Sierra", {10, 13, 3}}},
|
||||
"17D2102" = {{17, 4, 0}, "macOS", {"High Sierra", {10, 13, 3}}},
|
||||
"17E199" = {{17, 5, 0}, "macOS", {"High Sierra", {10, 13, 4}}},
|
||||
"17E202" = {{17, 5, 0}, "macOS", {"High Sierra", {10, 13, 4}}},
|
||||
"17F77" = {{17, 6, 0}, "macOS", {"High Sierra", {10, 13, 5}}},
|
||||
"17G65" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
"17G2208" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
"17G2307" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
"17G3025" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
"17G4015" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
"17G5019" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
"17G6029" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
"17G6030" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
"17G7024" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
"17G8029" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
"17G8030" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
"17G8037" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
"17G9016" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
"17G10021" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
"17G11023" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
"17G12034" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
"17G13033" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
"17G13035" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
"17G14019" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
"17G14033" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
"17G14042" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
|
||||
// MacOS Mojave
|
||||
"18A391" = {{18, 0, 0}, "macOS", {"Mojave", {10, 14, 0}}},
|
||||
"18B75" = {{18, 2, 0}, "macOS", {"Mojave", {10, 14, 1}}},
|
||||
"18B2107" = {{18, 2, 0}, "macOS", {"Mojave", {10, 14, 1}}},
|
||||
"18B3094" = {{18, 2, 0}, "macOS", {"Mojave", {10, 14, 1}}},
|
||||
"18C54" = {{18, 2, 0}, "macOS", {"Mojave", {10, 14, 2}}},
|
||||
"18D42" = {{18, 2, 0}, "macOS", {"Mojave", {10, 14, 3}}},
|
||||
"18D43" = {{18, 2, 0}, "macOS", {"Mojave", {10, 14, 3}}},
|
||||
"18D109" = {{18, 2, 0}, "macOS", {"Mojave", {10, 14, 3}}},
|
||||
"18E226" = {{18, 5, 0}, "macOS", {"Mojave", {10, 14, 4}}},
|
||||
"18E227" = {{18, 5, 0}, "macOS", {"Mojave", {10, 14, 4}}},
|
||||
"18F132" = {{18, 6, 0}, "macOS", {"Mojave", {10, 14, 5}}},
|
||||
"18G84" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
"18G87" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
"18G95" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
"18G103" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
"18G1012" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
"18G2022" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
"18G3020" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
"18G4032" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
"18G5033" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
"18G6020" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
"18G6032" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
"18G6042" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
"18G7016" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
"18G8012" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
"18G8022" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
"18G9028" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
"18G9216" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
"18G9323" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
|
||||
// MacOS Catalina
|
||||
"19A583" = {{19, 0, 0}, "macOS", {"Catalina", {10, 15, 0}}},
|
||||
"19A602" = {{19, 0, 0}, "macOS", {"Catalina", {10, 15, 0}}},
|
||||
"19A603" = {{19, 0, 0}, "macOS", {"Catalina", {10, 15, 0}}},
|
||||
"19B88" = {{19, 0, 0}, "macOS", {"Catalina", {10, 15, 1}}},
|
||||
"19C57" = {{19, 2, 0}, "macOS", {"Catalina", {10, 15, 2}}},
|
||||
"19C58" = {{19, 2, 0}, "macOS", {"Catalina", {10, 15, 2}}},
|
||||
"19D76" = {{19, 3, 0}, "macOS", {"Catalina", {10, 15, 3}}},
|
||||
"19E266" = {{19, 4, 0}, "macOS", {"Catalina", {10, 15, 4}}},
|
||||
"19E287" = {{19, 4, 0}, "macOS", {"Catalina", {10, 15, 4}}},
|
||||
"19F96" = {{19, 5, 0}, "macOS", {"Catalina", {10, 15, 5}}},
|
||||
"19F101" = {{19, 5, 0}, "macOS", {"Catalina", {10, 15, 5}}},
|
||||
"19G73" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 6}}},
|
||||
"19G2021" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 6}}},
|
||||
"19H2" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
"19H4" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
"19H15" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
"19H114" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
"19H512" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
"19H524" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
"19H1030" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
"19H1217" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
"19H1323" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
"19H1417" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
"19H1419" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
"19H1519" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
"19H1615" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
"19H1713" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
"19H1715" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
"19H1824" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
"19H1922" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
"19H2026" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
|
||||
// MacOS Big Sur
|
||||
"20A2411" = {{20, 1, 0}, "macOS", {"Big Sur", {11, 0, 0}}},
|
||||
"20B29" = {{20, 1, 0}, "macOS", {"Big Sur", {11, 0, 1}}},
|
||||
"20B50" = {{20, 1, 0}, "macOS", {"Big Sur", {11, 0, 1}}},
|
||||
"20C69" = {{20, 2, 0}, "macOS", {"Big Sur", {11, 1, 0}}},
|
||||
"20D64" = {{20, 3, 0}, "macOS", {"Big Sur", {11, 2, 0}}},
|
||||
"20D74" = {{20, 3, 0}, "macOS", {"Big Sur", {11, 2, 1}}},
|
||||
"20D75" = {{20, 3, 0}, "macOS", {"Big Sur", {11, 2, 1}}},
|
||||
"20D80" = {{20, 3, 0}, "macOS", {"Big Sur", {11, 2, 2}}},
|
||||
"20D91" = {{20, 3, 0}, "macOS", {"Big Sur", {11, 2, 3}}},
|
||||
"20E232" = {{20, 4, 0}, "macOS", {"Big Sur", {11, 3, 0}}},
|
||||
"20E241" = {{20, 4, 0}, "macOS", {"Big Sur", {11, 3, 1}}},
|
||||
"20F71" = {{20, 5, 0}, "macOS", {"Big Sur", {11, 4, 0}}},
|
||||
"20G71" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 5, 0}}},
|
||||
"20G80" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 5, 1}}},
|
||||
"20G95" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 5, 2}}},
|
||||
"20G165" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 6, 0}}},
|
||||
"20G224" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 6, 1}}},
|
||||
"20G314" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 6, 2}}},
|
||||
"20G415" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 6, 3}}},
|
||||
"20G417" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 6, 4}}},
|
||||
"20G527" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 6, 5}}},
|
||||
"20G624" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 6, 6}}},
|
||||
"20G630" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 6, 7}}},
|
||||
"20G730" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 6, 8}}},
|
||||
"20G817" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 7, 0}}},
|
||||
"20G918" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 7, 1}}},
|
||||
"20G1020" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 7, 2}}},
|
||||
"20G1116" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 7, 3}}},
|
||||
"20G1120" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 7, 4}}},
|
||||
"20G1225" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 7, 5}}},
|
||||
"20G1231" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 7, 6}}},
|
||||
"20G1345" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 7, 7}}},
|
||||
"20G1351" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 7, 8}}},
|
||||
"20G1426" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 7, 9}}},
|
||||
"20G1427" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 7, 10}}},
|
||||
|
||||
// MacOS Monterey
|
||||
"21A344" = {{21, 0, 1}, "macOS", {"Monterey", {12, 0, 0}}},
|
||||
"21A559" = {{21, 1, 0}, "macOS", {"Monterey", {12, 0, 1}}},
|
||||
"21C52" = {{21, 2, 0}, "macOS", {"Monterey", {12, 1, 0}}},
|
||||
"21D49" = {{21, 3, 0}, "macOS", {"Monterey", {12, 2, 0}}},
|
||||
"21D62" = {{21, 3, 0}, "macOS", {"Monterey", {12, 2, 1}}},
|
||||
"21E230" = {{21, 4, 0}, "macOS", {"Monterey", {12, 3, 0}}},
|
||||
"21E258" = {{21, 4, 0}, "macOS", {"Monterey", {12, 3, 1}}},
|
||||
"21F79" = {{21, 5, 0}, "macOS", {"Monterey", {12, 4, 0}}},
|
||||
"21F2081" = {{21, 5, 0}, "macOS", {"Monterey", {12, 4, 0}}},
|
||||
"21F2092" = {{21, 5, 0}, "macOS", {"Monterey", {12, 4, 0}}},
|
||||
"21G72" = {{21, 6, 0}, "macOS", {"Monterey", {12, 5, 0}}},
|
||||
"21G83" = {{21, 6, 0}, "macOS", {"Monterey", {12, 5, 1}}},
|
||||
"21G115" = {{21, 6, 0}, "macOS", {"Monterey", {12, 6, 0}}},
|
||||
"21G217" = {{21, 6, 0}, "macOS", {"Monterey", {12, 6, 1}}},
|
||||
"21G320" = {{21, 6, 0}, "macOS", {"Monterey", {12, 6, 2}}},
|
||||
"21G419" = {{21, 6, 0}, "macOS", {"Monterey", {12, 6, 3}}},
|
||||
"21G526" = {{21, 6, 0}, "macOS", {"Monterey", {12, 6, 4}}},
|
||||
"21G531" = {{21, 6, 0}, "macOS", {"Monterey", {12, 6, 5}}},
|
||||
"21G646" = {{21, 6, 0}, "macOS", {"Monterey", {12, 6, 6}}},
|
||||
"21G651" = {{21, 6, 0}, "macOS", {"Monterey", {12, 6, 7}}},
|
||||
"21G725" = {{21, 6, 0}, "macOS", {"Monterey", {12, 6, 8}}},
|
||||
"21G726" = {{21, 6, 0}, "macOS", {"Monterey", {12, 6, 9}}},
|
||||
"21G816" = {{21, 6, 0}, "macOS", {"Monterey", {12, 7, 0}}},
|
||||
"21G920" = {{21, 6, 0}, "macOS", {"Monterey", {12, 7, 1}}},
|
||||
"21G1974" = {{21, 6, 0}, "macOS", {"Monterey", {12, 7, 2}}},
|
||||
"21H1015" = {{21, 6, 0}, "macOS", {"Monterey", {12, 7, 3}}},
|
||||
"21H1123" = {{21, 6, 0}, "macOS", {"Monterey", {12, 7, 4}}},
|
||||
"21H1222" = {{21, 6, 0}, "macOS", {"Monterey", {12, 7, 5}}},
|
||||
"21H1320" = {{21, 6, 0}, "macOS", {"Monterey", {12, 7, 6}}},
|
||||
|
||||
// MacOS Ventura
|
||||
"22A380" = {{22, 1, 0}, "macOS", {"Ventura", {13, 0, 0}}},
|
||||
"22A400" = {{22, 1, 0}, "macOS", {"Ventura", {13, 0, 1}}},
|
||||
"22C65" = {{22, 2, 0}, "macOS", {"Ventura", {13, 1, 0}}},
|
||||
"22D49" = {{22, 3, 0}, "macOS", {"Ventura", {13, 2, 0}}},
|
||||
"22D68" = {{22, 3, 0}, "macOS", {"Ventura", {13, 2, 1}}},
|
||||
"22E252" = {{22, 4, 0}, "macOS", {"Ventura", {13, 3, 0}}},
|
||||
"22E261" = {{22, 4, 0}, "macOS", {"Ventura", {13, 3, 1}}},
|
||||
"22F66" = {{22, 5, 0}, "macOS", {"Ventura", {13, 4, 0}}},
|
||||
"22F82" = {{22, 5, 0}, "macOS", {"Ventura", {13, 4, 1}}},
|
||||
"22E772610a" = {{22, 5, 0}, "macOS", {"Ventura", {13, 4, 1}}},
|
||||
"22F770820d" = {{22, 5, 0}, "macOS", {"Ventura", {13, 4, 1}}},
|
||||
"22G74" = {{22, 6, 0}, "macOS", {"Ventura", {13, 5, 0}}},
|
||||
"22G90" = {{22, 6, 0}, "macOS", {"Ventura", {13, 5, 1}}},
|
||||
"22G91" = {{22, 6, 0}, "macOS", {"Ventura", {13, 5, 2}}},
|
||||
"22G120" = {{22, 6, 0}, "macOS", {"Ventura", {13, 6, 0}}},
|
||||
"22G313" = {{22, 6, 0}, "macOS", {"Ventura", {13, 6, 1}}},
|
||||
"22G320" = {{22, 6, 0}, "macOS", {"Ventura", {13, 6, 2}}},
|
||||
"22G436" = {{22, 6, 0}, "macOS", {"Ventura", {13, 6, 3}}},
|
||||
"22G513" = {{22, 6, 0}, "macOS", {"Ventura", {13, 6, 4}}},
|
||||
"22G621" = {{22, 6, 0}, "macOS", {"Ventura", {13, 6, 5}}},
|
||||
"22G630" = {{22, 6, 0}, "macOS", {"Ventura", {13, 6, 6}}},
|
||||
"22G720" = {{22, 6, 0}, "macOS", {"Ventura", {13, 6, 7}}},
|
||||
"22G820" = {{22, 6, 0}, "macOS", {"Ventura", {13, 6, 8}}},
|
||||
"22G830" = {{22, 6, 0}, "macOS", {"Ventura", {13, 6, 9}}},
|
||||
"22H123" = {{22, 6, 0}, "macOS", {"Ventura", {13, 7, 0}}},
|
||||
"22H221" = {{22, 6, 0}, "macOS", {"Ventura", {13, 7, 1}}},
|
||||
|
||||
// MacOS Sonoma
|
||||
"23A344" = {{23, 0, 0}, "macOS", {"Sonoma", {14, 0, 0}}},
|
||||
"23B74" = {{23, 1, 0}, "macOS", {"Sonoma", {14, 1, 0}}},
|
||||
"23B81" = {{23, 1, 0}, "macOS", {"Sonoma", {14, 1, 1}}},
|
||||
"23B2082" = {{23, 1, 0}, "macOS", {"Sonoma", {14, 1, 1}}},
|
||||
"23B92" = {{23, 1, 0}, "macOS", {"Sonoma", {14, 1, 2}}},
|
||||
"23B2091" = {{23, 1, 0}, "macOS", {"Sonoma", {14, 1, 2}}},
|
||||
"23C64" = {{23, 2, 0}, "macOS", {"Sonoma", {14, 2, 0}}},
|
||||
"23C71" = {{23, 2, 0}, "macOS", {"Sonoma", {14, 2, 1}}},
|
||||
"23D56" = {{23, 3, 0}, "macOS", {"Sonoma", {14, 3, 0}}},
|
||||
"23D60" = {{23, 3, 0}, "macOS", {"Sonoma", {14, 3, 1}}},
|
||||
"23E214" = {{23, 4, 0}, "macOS", {"Sonoma", {14, 4, 0}}},
|
||||
"23E224" = {{23, 4, 0}, "macOS", {"Sonoma", {14, 4, 1}}},
|
||||
"23F79" = {{23, 5, 0}, "macOS", {"Sonoma", {14, 5, 0}}},
|
||||
"23G80" = {{23, 6, 0}, "macOS", {"Sonoma", {14, 6, 0}}},
|
||||
"23G93" = {{23, 6, 0}, "macOS", {"Sonoma", {14, 6, 1}}},
|
||||
"23H124" = {{23, 6, 0}, "macOS", {"Sonoma", {14, 7, 0}}},
|
||||
"23H222" = {{23, 6, 0}, "macOS", {"Sonoma", {14, 7, 1}}},
|
||||
|
||||
// MacOS Sequoia
|
||||
"24A335" = {{24, 0, 0}, "macOS", {"Sequoia", {15, 0, 0}}},
|
||||
"24A348" = {{24, 0, 0}, "macOS", {"Sequoia", {15, 0, 1}}},
|
||||
"24B83" = {{24, 1, 0}, "macOS", {"Sequoia", {15, 1, 0}}},
|
||||
}
|
||||
|
||||
@(private)
|
||||
Darwin_Match :: enum {
|
||||
Unknown,
|
||||
Exact,
|
||||
Nearest,
|
||||
}
|
||||
|
||||
@(private)
|
||||
map_darwin_kernel_version_to_macos_release :: proc(build: string, darwin: [3]int) -> (res: Darwin_To_Release, match: Darwin_Match) {
|
||||
// Find exact release match if possible.
|
||||
if v, v_ok := macos_release_map[build]; v_ok {
|
||||
return v, .Exact
|
||||
}
|
||||
|
||||
nearest: Darwin_To_Release
|
||||
for _, v in macos_release_map {
|
||||
// Try an exact match on XNU version first.
|
||||
if darwin == v.darwin {
|
||||
return v, .Exact
|
||||
}
|
||||
|
||||
// Major kernel version needs to match exactly,
|
||||
// otherwise the release is considered .Unknown
|
||||
if darwin.x == v.darwin.x {
|
||||
if nearest == {} {
|
||||
nearest = v
|
||||
}
|
||||
if darwin.y >= v.darwin.y && v.darwin != nearest.darwin {
|
||||
nearest = v
|
||||
if darwin.z >= v.darwin.z && v.darwin != nearest.darwin {
|
||||
nearest = v
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if nearest == {} {
|
||||
return {darwin, "macOS", {"Unknown", {}}}, .Unknown
|
||||
} else {
|
||||
return nearest, .Nearest
|
||||
}
|
||||
os_version.as_string = string(b.buf[:])
|
||||
}
|
||||
|
||||
@@ -16,9 +16,13 @@ init_os_version :: proc () {
|
||||
b := strings.builder_from_bytes(version_string_buf[:])
|
||||
|
||||
// Try to parse `/etc/os-release` for `PRETTY_NAME="Ubuntu 20.04.3 LTS`
|
||||
{
|
||||
pretty_parse: {
|
||||
fd, errno := linux.open("/etc/os-release", {})
|
||||
assert(errno == .NONE, "Failed to read /etc/os-release")
|
||||
if errno != .NONE {
|
||||
strings.write_string(&b, "Unknown Linux Distro")
|
||||
break pretty_parse
|
||||
}
|
||||
|
||||
defer {
|
||||
cerrno := linux.close(fd)
|
||||
assert(cerrno == .NONE, "Failed to close the file descriptor")
|
||||
@@ -26,7 +30,10 @@ init_os_version :: proc () {
|
||||
|
||||
os_release_buf: [2048]u8
|
||||
n, read_errno := linux.read(fd, os_release_buf[:])
|
||||
assert(read_errno == .NONE, "Failed to read data from /etc/os-release")
|
||||
if read_errno != .NONE {
|
||||
strings.write_string(&b, "Unknown Linux Distro")
|
||||
break pretty_parse
|
||||
}
|
||||
release := string(os_release_buf[:n])
|
||||
|
||||
// Search the line in the file until we find "PRETTY_NAME="
|
||||
@@ -59,7 +66,7 @@ init_os_version :: proc () {
|
||||
os_version.as_string = strings.to_string(b)
|
||||
|
||||
// Parse the Linux version out of the release string
|
||||
{
|
||||
version_loop: {
|
||||
version_num, _, version_suffix := strings.partition(release_str, "-")
|
||||
os_version.version = version_suffix
|
||||
|
||||
@@ -72,11 +79,11 @@ init_os_version :: proc () {
|
||||
case 0: dst = &os_version.major
|
||||
case 1: dst = &os_version.minor
|
||||
case 2: dst = &os_version.patch
|
||||
case: break
|
||||
case: break version_loop
|
||||
}
|
||||
|
||||
num, ok := strconv.parse_int(part)
|
||||
if !ok { break }
|
||||
if !ok { break version_loop }
|
||||
|
||||
dst^ = num
|
||||
}
|
||||
|
||||
+80
-51
@@ -1,5 +1,10 @@
|
||||
package linux
|
||||
|
||||
import "base:intrinsics"
|
||||
|
||||
@(private)
|
||||
log2 :: intrinsics.constant_log2
|
||||
|
||||
|
||||
/*
|
||||
Represents an error returned by most of syscalls
|
||||
@@ -152,43 +157,65 @@ Errno :: enum i32 {
|
||||
RDONLY flag is not present, because it has the value of 0, i.e. it is the
|
||||
default, unless WRONLY or RDWR is specified.
|
||||
*/
|
||||
Open_Flags_Bits :: enum {
|
||||
WRONLY = 0,
|
||||
RDWR = 1,
|
||||
CREAT = 6,
|
||||
EXCL = 7,
|
||||
NOCTTY = 8,
|
||||
TRUNC = 9,
|
||||
APPEND = 10,
|
||||
NONBLOCK = 11,
|
||||
DSYNC = 12,
|
||||
ASYNC = 13,
|
||||
DIRECT = 14,
|
||||
LARGEFILE = 15,
|
||||
DIRECTORY = 16,
|
||||
NOFOLLOW = 17,
|
||||
NOATIME = 18,
|
||||
CLOEXEC = 19,
|
||||
PATH = 21,
|
||||
when ODIN_ARCH != .arm64 && ODIN_ARCH != .arm32 {
|
||||
Open_Flags_Bits :: enum {
|
||||
WRONLY = 0,
|
||||
RDWR = 1,
|
||||
CREAT = 6,
|
||||
EXCL = 7,
|
||||
NOCTTY = 8,
|
||||
TRUNC = 9,
|
||||
APPEND = 10,
|
||||
NONBLOCK = 11,
|
||||
DSYNC = 12,
|
||||
ASYNC = 13,
|
||||
DIRECT = 14,
|
||||
LARGEFILE = 15,
|
||||
DIRECTORY = 16,
|
||||
NOFOLLOW = 17,
|
||||
NOATIME = 18,
|
||||
CLOEXEC = 19,
|
||||
PATH = 21,
|
||||
}
|
||||
// https://github.com/torvalds/linux/blob/7367539ad4b0f8f9b396baf02110962333719a48/include/uapi/asm-generic/fcntl.h#L19
|
||||
#assert(1 << uint(Open_Flags_Bits.WRONLY) == 0o0000000_1)
|
||||
#assert(1 << uint(Open_Flags_Bits.RDWR) == 0o0000000_2)
|
||||
#assert(1 << uint(Open_Flags_Bits.CREAT) == 0o00000_100)
|
||||
#assert(1 << uint(Open_Flags_Bits.EXCL) == 0o00000_200)
|
||||
#assert(1 << uint(Open_Flags_Bits.NOCTTY) == 0o00000_400)
|
||||
#assert(1 << uint(Open_Flags_Bits.TRUNC) == 0o0000_1000)
|
||||
#assert(1 << uint(Open_Flags_Bits.APPEND) == 0o0000_2000)
|
||||
#assert(1 << uint(Open_Flags_Bits.NONBLOCK) == 0o0000_4000)
|
||||
#assert(1 << uint(Open_Flags_Bits.DSYNC) == 0o000_10000)
|
||||
#assert(1 << uint(Open_Flags_Bits.ASYNC) == 0o000_20000)
|
||||
#assert(1 << uint(Open_Flags_Bits.DIRECT) == 0o000_40000)
|
||||
#assert(1 << uint(Open_Flags_Bits.LARGEFILE) == 0o00_100000)
|
||||
#assert(1 << uint(Open_Flags_Bits.DIRECTORY) == 0o00_200000)
|
||||
#assert(1 << uint(Open_Flags_Bits.NOFOLLOW) == 0o00_400000)
|
||||
#assert(1 << uint(Open_Flags_Bits.NOATIME) == 0o0_1000000)
|
||||
#assert(1 << uint(Open_Flags_Bits.CLOEXEC) == 0o0_2000000)
|
||||
#assert(1 << uint(Open_Flags_Bits.PATH) == 0o_10000000)
|
||||
} else {
|
||||
Open_Flags_Bits :: enum {
|
||||
WRONLY = 0,
|
||||
RDWR = 1,
|
||||
CREAT = 6,
|
||||
EXCL = 7,
|
||||
NOCTTY = 8,
|
||||
TRUNC = 9,
|
||||
APPEND = 10,
|
||||
NONBLOCK = 11,
|
||||
DSYNC = 12,
|
||||
ASYNC = 13,
|
||||
DIRECTORY = 14,
|
||||
NOFOLLOW = 15,
|
||||
DIRECT = 16,
|
||||
LARGEFILE = 17,
|
||||
NOATIME = 18,
|
||||
CLOEXEC = 19,
|
||||
PATH = 21,
|
||||
}
|
||||
}
|
||||
// https://github.com/torvalds/linux/blob/7367539ad4b0f8f9b396baf02110962333719a48/include/uapi/asm-generic/fcntl.h#L19
|
||||
#assert(1 << uint(Open_Flags_Bits.WRONLY) == 0o0000000_1)
|
||||
#assert(1 << uint(Open_Flags_Bits.RDWR) == 0o0000000_2)
|
||||
#assert(1 << uint(Open_Flags_Bits.CREAT) == 0o00000_100)
|
||||
#assert(1 << uint(Open_Flags_Bits.EXCL) == 0o00000_200)
|
||||
#assert(1 << uint(Open_Flags_Bits.NOCTTY) == 0o00000_400)
|
||||
#assert(1 << uint(Open_Flags_Bits.TRUNC) == 0o0000_1000)
|
||||
#assert(1 << uint(Open_Flags_Bits.APPEND) == 0o0000_2000)
|
||||
#assert(1 << uint(Open_Flags_Bits.NONBLOCK) == 0o0000_4000)
|
||||
#assert(1 << uint(Open_Flags_Bits.DSYNC) == 0o000_10000)
|
||||
#assert(1 << uint(Open_Flags_Bits.ASYNC) == 0o000_20000)
|
||||
#assert(1 << uint(Open_Flags_Bits.DIRECT) == 0o000_40000)
|
||||
#assert(1 << uint(Open_Flags_Bits.LARGEFILE) == 0o00_100000)
|
||||
#assert(1 << uint(Open_Flags_Bits.DIRECTORY) == 0o00_200000)
|
||||
#assert(1 << uint(Open_Flags_Bits.NOFOLLOW) == 0o00_400000)
|
||||
#assert(1 << uint(Open_Flags_Bits.NOATIME) == 0o0_1000000)
|
||||
#assert(1 << uint(Open_Flags_Bits.CLOEXEC) == 0o0_2000000)
|
||||
#assert(1 << uint(Open_Flags_Bits.PATH) == 0o_10000000)
|
||||
|
||||
/*
|
||||
Bits for FD_Flags bitset
|
||||
@@ -1307,6 +1334,7 @@ Socket_Option :: enum {
|
||||
ACCEPTCONN = 30,
|
||||
PEERSEC = 31,
|
||||
PASSSEC = 34,
|
||||
IP_ADD_MEMBERSHIP = 35,
|
||||
MARK = 36,
|
||||
PROTOCOL = 38,
|
||||
DOMAIN = 39,
|
||||
@@ -1816,22 +1844,23 @@ EPoll_Flags_Bits :: enum {
|
||||
}
|
||||
|
||||
EPoll_Event_Kind :: enum u32 {
|
||||
IN = 0x001,
|
||||
PRI = 0x002,
|
||||
OUT = 0x004,
|
||||
RDNORM = 0x040,
|
||||
RDBAND = 0x080,
|
||||
WRNORM = 0x100,
|
||||
WRBAND = 0x200,
|
||||
MSG = 0x400,
|
||||
ERR = 0x008,
|
||||
HUP = 0x010,
|
||||
RDHUP = 0x2000,
|
||||
EXCLUSIVE = 1<<28,
|
||||
WAKEUP = 1<<29,
|
||||
ONESHOT = 1<<30,
|
||||
ET = 1<<31,
|
||||
IN = log2(0x001),
|
||||
PRI = log2(0x002),
|
||||
OUT = log2(0x004),
|
||||
RDNORM = log2(0x040),
|
||||
RDBAND = log2(0x080),
|
||||
WRNORM = log2(0x100),
|
||||
WRBAND = log2(0x200),
|
||||
MSG = log2(0x400),
|
||||
ERR = log2(0x008),
|
||||
HUP = log2(0x010),
|
||||
RDHUP = log2(0x2000),
|
||||
EXCLUSIVE = log2(1<<28),
|
||||
WAKEUP = log2(1<<29),
|
||||
ONESHOT = log2(1<<30),
|
||||
ET = log2(1<<31),
|
||||
}
|
||||
EPoll_Event_Set :: bit_set[EPoll_Event_Kind; u32]
|
||||
|
||||
EPoll_Ctl_Opcode :: enum i32 {
|
||||
ADD = 1,
|
||||
|
||||
@@ -138,8 +138,8 @@ errno_unwrap :: proc {errno_unwrap2, errno_unwrap3}
|
||||
when size_of(int) == 4 {
|
||||
// xxx64 system calls take some parameters as pairs of ulongs rather than a single pointer
|
||||
@(private)
|
||||
compat64_arg_pair :: #force_inline proc "contextless" (a: i64) -> (hi: uint, lo: uint) {
|
||||
no_sign := uint(a)
|
||||
compat64_arg_pair :: #force_inline proc "contextless" (a: i64) -> (lo: uint, hi: uint) {
|
||||
no_sign := u64(a)
|
||||
hi = uint(no_sign >> 32)
|
||||
lo = uint(no_sign & 0xffff_ffff)
|
||||
return
|
||||
|
||||
+29
-18
@@ -1,3 +1,4 @@
|
||||
#+build linux
|
||||
#+no-instrumentation
|
||||
package linux
|
||||
|
||||
@@ -151,7 +152,8 @@ lseek :: proc "contextless" (fd: Fd, off: i64, whence: Seek_Whence) -> (i64, Err
|
||||
return errno_unwrap(ret, i64)
|
||||
} else {
|
||||
result: i64 = ---
|
||||
ret := syscall(SYS__llseek, fd, compat64_arg_pair(off), &result, whence)
|
||||
lo, hi := compat64_arg_pair(off)
|
||||
ret := syscall(SYS__llseek, fd, hi, lo, &result, whence)
|
||||
return result, Errno(-ret)
|
||||
}
|
||||
}
|
||||
@@ -211,7 +213,7 @@ rt_sigreturn :: proc "c" () -> ! {
|
||||
/*
|
||||
Alter an action taken by a process.
|
||||
*/
|
||||
rt_sigaction :: proc "contextless" (sig: Signal, sigaction: ^Sig_Action($T), old_sigaction: ^Sig_Action) -> Errno {
|
||||
rt_sigaction :: proc "contextless" (sig: Signal, sigaction: ^Sig_Action($T), old_sigaction: ^Sig_Action($U)) -> Errno {
|
||||
// NOTE(jason): It appears that the restorer is required for i386 and amd64
|
||||
when ODIN_ARCH == .i386 || ODIN_ARCH == .amd64 {
|
||||
sigaction.flags += {.RESTORER}
|
||||
@@ -251,7 +253,11 @@ ioctl :: proc "contextless" (fd: Fd, request: u32, arg: uintptr) -> (uintptr) {
|
||||
Available since Linux 2.2.
|
||||
*/
|
||||
pread :: proc "contextless" (fd: Fd, buf: []u8, offset: i64) -> (int, Errno) {
|
||||
ret := syscall(SYS_pread64, fd, raw_data(buf), len(buf), compat64_arg_pair(offset))
|
||||
when ODIN_ARCH == .arm32 {
|
||||
ret := syscall(SYS_pread64, fd, raw_data(buf), len(buf), 0, compat64_arg_pair(offset))
|
||||
} else {
|
||||
ret := syscall(SYS_pread64, fd, raw_data(buf), len(buf), compat64_arg_pair(offset))
|
||||
}
|
||||
return errno_unwrap(ret, int)
|
||||
}
|
||||
|
||||
@@ -261,7 +267,11 @@ pread :: proc "contextless" (fd: Fd, buf: []u8, offset: i64) -> (int, Errno) {
|
||||
Available since Linux 2.2.
|
||||
*/
|
||||
pwrite :: proc "contextless" (fd: Fd, buf: []u8, offset: i64) -> (int, Errno) {
|
||||
ret := syscall(SYS_pwrite64, fd, raw_data(buf), len(buf), compat64_arg_pair(offset))
|
||||
when ODIN_ARCH == .arm32 {
|
||||
ret := syscall(SYS_pwrite64, fd, raw_data(buf), len(buf), 0, compat64_arg_pair(offset))
|
||||
} else {
|
||||
ret := syscall(SYS_pwrite64, fd, raw_data(buf), len(buf), compat64_arg_pair(offset))
|
||||
}
|
||||
return errno_unwrap(ret, int)
|
||||
}
|
||||
|
||||
@@ -1127,7 +1137,10 @@ fdatasync :: proc "contextless" (fd: Fd) -> (Errno) {
|
||||
On 32-bit architectures available since Linux 2.4.
|
||||
*/
|
||||
truncate :: proc "contextless" (name: cstring, length: i64) -> (Errno) {
|
||||
when size_of(int) == 4 {
|
||||
when ODIN_ARCH == .arm32 {
|
||||
ret := syscall(SYS_truncate64, cast(rawptr) name, 0, compat64_arg_pair(length))
|
||||
return Errno(-ret)
|
||||
} else when size_of(int) == 4 {
|
||||
ret := syscall(SYS_truncate64, cast(rawptr) name, compat64_arg_pair(length))
|
||||
return Errno(-ret)
|
||||
} else {
|
||||
@@ -1141,7 +1154,10 @@ truncate :: proc "contextless" (name: cstring, length: i64) -> (Errno) {
|
||||
On 32-bit architectures available since 2.4.
|
||||
*/
|
||||
ftruncate :: proc "contextless" (fd: Fd, length: i64) -> (Errno) {
|
||||
when size_of(int) == 4 {
|
||||
when ODIN_ARCH == .arm32 {
|
||||
ret := syscall(SYS_ftruncate64, fd, 0, compat64_arg_pair(length))
|
||||
return Errno(-ret)
|
||||
} else when size_of(int) == 4 {
|
||||
ret := syscall(SYS_ftruncate64, fd, compat64_arg_pair(length))
|
||||
return Errno(-ret)
|
||||
} else {
|
||||
@@ -1952,10 +1968,10 @@ sigaltstack :: proc "contextless" (stack: ^Sig_Stack, old_stack: ^Sig_Stack) ->
|
||||
*/
|
||||
mknod :: proc "contextless" (name: cstring, mode: Mode, dev: Dev) -> (Errno) {
|
||||
when ODIN_ARCH == .arm64 || ODIN_ARCH == .riscv64 {
|
||||
ret := syscall(SYS_mknodat, AT_FDCWD, cast(rawptr) name, transmute(u32) mode, dev)
|
||||
ret := syscall(SYS_mknodat, AT_FDCWD, cast(rawptr) name, transmute(u32) mode, cast(uint) dev)
|
||||
return Errno(-ret)
|
||||
} else {
|
||||
ret := syscall(SYS_mknod, cast(rawptr) name, transmute(u32) mode, dev)
|
||||
ret := syscall(SYS_mknod, cast(rawptr) name, transmute(u32) mode, cast(uint) dev)
|
||||
return Errno(-ret)
|
||||
}
|
||||
}
|
||||
@@ -1995,10 +2011,10 @@ statfs :: proc "contextless" (path: cstring, statfs: ^Stat_FS) -> (Errno) {
|
||||
*/
|
||||
fstatfs :: proc "contextless" (fd: Fd, statfs: ^Stat_FS) -> (Errno) {
|
||||
when size_of(int) == 8 {
|
||||
ret := syscall(SYS_statfs, fd, statfs)
|
||||
ret := syscall(SYS_fstatfs, fd, statfs)
|
||||
return Errno(-ret)
|
||||
} else {
|
||||
ret := syscall(SYS_statfs64, fd, size_of(Stat_FS), statfs)
|
||||
ret := syscall(SYS_fstatfs64, fd, size_of(Stat_FS), statfs)
|
||||
return Errno(-ret)
|
||||
}
|
||||
}
|
||||
@@ -2586,7 +2602,7 @@ mkdirat :: proc "contextless" (dirfd: Fd, name: cstring, mode: Mode) -> (Errno)
|
||||
Available since Linux 2.6.16.
|
||||
*/
|
||||
mknodat :: proc "contextless" (dirfd: Fd, name: cstring, mode: Mode, dev: Dev) -> (Errno) {
|
||||
ret := syscall(SYS_mknodat, dirfd, cast(rawptr) name, transmute(u32) mode, dev)
|
||||
ret := syscall(SYS_mknodat, dirfd, cast(rawptr) name, transmute(u32) mode, cast(uint) dev)
|
||||
return Errno(-ret)
|
||||
}
|
||||
|
||||
@@ -2684,13 +2700,8 @@ faccessat :: proc "contextless" (dirfd: Fd, name: cstring, mode: Mode = F_OK) ->
|
||||
Available since Linux 2.6.16.
|
||||
*/
|
||||
ppoll :: proc "contextless" (fds: []Poll_Fd, timeout: ^Time_Spec, sigmask: ^Sig_Set) -> (i32, Errno) {
|
||||
when size_of(int) == 8 {
|
||||
ret := syscall(SYS_ppoll, raw_data(fds), len(fds), timeout, sigmask, size_of(Sig_Set))
|
||||
return errno_unwrap(ret, i32)
|
||||
} else {
|
||||
ret := syscall(SYS_ppoll_time64, raw_data(fds), len(fds), timeout, sigmask, size_of(Sig_Set))
|
||||
return errno_unwrap(ret, i32)
|
||||
}
|
||||
ret := syscall(SYS_ppoll, raw_data(fds), len(fds), timeout, sigmask, size_of(Sig_Set))
|
||||
return errno_unwrap(ret, i32)
|
||||
}
|
||||
|
||||
// TODO(flysand): unshare
|
||||
|
||||
@@ -317,5 +317,18 @@ SYS_futex_waitv :: uintptr(449)
|
||||
SYS_set_mempolicy_home_node :: uintptr(450)
|
||||
SYS_cachestat :: uintptr(451)
|
||||
SYS_fchmodat2 :: uintptr(452)
|
||||
|
||||
SYS_map_shadow_stack :: uintptr(453)
|
||||
SYS_futex_wake :: uintptr(454)
|
||||
SYS_futex_wait :: uintptr(455)
|
||||
SYS_futex_requeue :: uintptr(456)
|
||||
SYS_statmount :: uintptr(457)
|
||||
SYS_listmount :: uintptr(458)
|
||||
SYS_lsm_get_self_attr :: uintptr(459)
|
||||
SYS_lsm_set_self_attr :: uintptr(460)
|
||||
SYS_lsm_list_modules :: uintptr(461)
|
||||
SYS_mseal :: uintptr(462)
|
||||
SYS_setxattrat :: uintptr(463)
|
||||
SYS_getxattrat :: uintptr(464)
|
||||
SYS_listxattrat :: uintptr(465)
|
||||
SYS_removexattrat :: uintptr(466)
|
||||
|
||||
|
||||
+167
-67
@@ -3,7 +3,7 @@ package linux
|
||||
/*
|
||||
Type for storage device handle.
|
||||
*/
|
||||
Dev :: distinct int
|
||||
Dev :: distinct u64
|
||||
|
||||
/*
|
||||
Type for 32-bit User IDs.
|
||||
@@ -153,6 +153,7 @@ when ODIN_ARCH == .amd64 {
|
||||
uid: Uid,
|
||||
gid: Gid,
|
||||
rdev: Dev,
|
||||
_: [4]u8,
|
||||
size: i64,
|
||||
blksize: uint,
|
||||
blocks: u64,
|
||||
@@ -516,79 +517,79 @@ Pid_FD_Flags :: bit_set[Pid_FD_Flags_Bits; i32]
|
||||
Sig_Set :: [_SIGSET_NWORDS]uint
|
||||
|
||||
@private SI_MAX_SIZE :: 128
|
||||
@private SI_ARCH_PREAMBLE :: 4 * size_of(i32)
|
||||
@private SI_ARCH_PREAMBLE :: 4 * size_of(i32) when size_of(rawptr) == 8 else 3 * size_of(i32)
|
||||
@private SI_PAD_SIZE :: SI_MAX_SIZE - SI_ARCH_PREAMBLE
|
||||
|
||||
Sig_Handler_Fn :: #type proc "c" (sig: Signal)
|
||||
Sig_Restore_Fn :: #type proc "c" () -> !
|
||||
|
||||
Sig_Info :: struct #packed {
|
||||
signo: Signal,
|
||||
errno: Errno,
|
||||
code: i32,
|
||||
_pad0: i32,
|
||||
using _union: struct #raw_union {
|
||||
_pad1: [SI_PAD_SIZE]u8,
|
||||
using _kill: struct {
|
||||
pid: Pid, /* sender's pid */
|
||||
uid: Uid, /* sender's uid */
|
||||
},
|
||||
using _timer: struct {
|
||||
timerid: i32, /* timer id */
|
||||
overrun: i32, /* overrun count */
|
||||
value: Sig_Val, /* timer value */
|
||||
},
|
||||
/* POSIX.1b signals */
|
||||
using _rt: struct {
|
||||
_pid0: Pid, /* sender's pid */
|
||||
_uid0: Uid, /* sender's uid */
|
||||
},
|
||||
/* SIGCHLD */
|
||||
using _sigchld: struct {
|
||||
_pid1: Pid, /* which child */
|
||||
_uid1: Uid, /* sender's uid */
|
||||
status: i32, /* exit code */
|
||||
utime: uint,
|
||||
stime: uint, //clock_t
|
||||
},
|
||||
/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
|
||||
using _sigfault: struct {
|
||||
addr: rawptr, /* faulting insn/memory ref. */
|
||||
using _: struct #raw_union {
|
||||
trapno: i32, /* Trap number that caused signal */
|
||||
addr_lsb: i16, /* LSB of the reported address */
|
||||
using _addr_bnd: struct {
|
||||
_pad2: u64,
|
||||
lower: rawptr, /* lower bound during fault */
|
||||
upper: rawptr, /* upper bound during fault */
|
||||
},
|
||||
using _addr_pkey: struct {
|
||||
_pad3: u64,
|
||||
pkey: u32, /* protection key on PTE that faulted */
|
||||
},
|
||||
using _perf: struct {
|
||||
perf_data: u64,
|
||||
perf_type: u32,
|
||||
perf_flags: u32,
|
||||
when size_of(rawptr) == 8 {
|
||||
Sig_Info :: struct #packed {
|
||||
signo: Signal,
|
||||
errno: Errno,
|
||||
code: i32,
|
||||
_pad0: i32,
|
||||
using _union: struct #raw_union {
|
||||
_pad1: [SI_PAD_SIZE]u8,
|
||||
using _kill: struct {
|
||||
pid: Pid, /* sender's pid */
|
||||
uid: Uid, /* sender's uid */
|
||||
},
|
||||
using _timer: struct {
|
||||
timerid: i32, /* timer id */
|
||||
overrun: i32, /* overrun count */
|
||||
value: Sig_Val, /* timer value */
|
||||
},
|
||||
/* POSIX.1b signals */
|
||||
using _rt: struct {
|
||||
_pid0: Pid, /* sender's pid */
|
||||
_uid0: Uid, /* sender's uid */
|
||||
},
|
||||
/* SIGCHLD */
|
||||
using _sigchld: struct {
|
||||
_pid1: Pid, /* which child */
|
||||
_uid1: Uid, /* sender's uid */
|
||||
status: i32, /* exit code */
|
||||
utime: uint,
|
||||
stime: uint, //clock_t
|
||||
},
|
||||
/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
|
||||
using _sigfault: struct {
|
||||
addr: rawptr, /* faulting insn/memory ref. */
|
||||
using _: struct #raw_union {
|
||||
trapno: i32, /* Trap number that caused signal */
|
||||
addr_lsb: i16, /* LSB of the reported address */
|
||||
using _addr_bnd: struct {
|
||||
_pad2: u64,
|
||||
lower: rawptr, /* lower bound during fault */
|
||||
upper: rawptr, /* upper bound during fault */
|
||||
},
|
||||
using _addr_pkey: struct {
|
||||
_pad3: u64,
|
||||
pkey: u32, /* protection key on PTE that faulted */
|
||||
},
|
||||
using _perf: struct {
|
||||
perf_data: u64,
|
||||
perf_type: u32,
|
||||
perf_flags: u32,
|
||||
},
|
||||
},
|
||||
},
|
||||
/* SIGPOLL */
|
||||
using _sigpoll: struct {
|
||||
band: int, /* POLL_IN, POLL_OUT, POLL_MSG */
|
||||
fd: Fd,
|
||||
},
|
||||
/* SIGSYS */
|
||||
using _sigsys: struct {
|
||||
call_addr: rawptr, /* calling user insn */
|
||||
syscall: i32, /* triggering system call number */
|
||||
arch: u32, /* AUDIT_ARCH_* of syscall */
|
||||
},
|
||||
},
|
||||
/* SIGPOLL */
|
||||
using _sigpoll: struct {
|
||||
band: int, /* POLL_IN, POLL_OUT, POLL_MSG */
|
||||
fd: Fd,
|
||||
},
|
||||
/* SIGSYS */
|
||||
using _sigsys: struct {
|
||||
call_addr: rawptr, /* calling user insn */
|
||||
syscall: i32, /* triggering system call number */
|
||||
arch: u32, /* AUDIT_ARCH_* of syscall */
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
#assert(size_of(Sig_Info) == 128)
|
||||
when ODIN_ARCH == .amd64 || ODIN_ARCH == .arm64 {
|
||||
#assert(size_of(Sig_Info) == 128)
|
||||
#assert(offset_of(Sig_Info, signo) == 0x00)
|
||||
#assert(offset_of(Sig_Info, errno) == 0x04)
|
||||
#assert(offset_of(Sig_Info, code) == 0x08)
|
||||
@@ -615,7 +616,96 @@ when ODIN_ARCH == .amd64 || ODIN_ARCH == .arm64 {
|
||||
#assert(offset_of(Sig_Info, syscall) == 0x18)
|
||||
#assert(offset_of(Sig_Info, arch) == 0x1C)
|
||||
} else {
|
||||
// TODO
|
||||
Sig_Info :: struct {
|
||||
signo: Signal,
|
||||
errno: Errno,
|
||||
code: i32,
|
||||
using _union: struct #raw_union {
|
||||
_pad1: [SI_PAD_SIZE]u8,
|
||||
using _kill: struct {
|
||||
pid: Pid, /* sender's pid */
|
||||
uid: Uid, /* sender's uid */
|
||||
},
|
||||
using _timer: struct {
|
||||
timerid: i32, /* timer id */
|
||||
overrun: i32, /* overrun count */
|
||||
value: Sig_Val, /* timer value */
|
||||
},
|
||||
/* POSIX.1b signals */
|
||||
using _rt: struct {
|
||||
_pid0: Pid, /* sender's pid */
|
||||
_uid0: Uid, /* sender's uid */
|
||||
},
|
||||
/* SIGCHLD */
|
||||
using _sigchld: struct {
|
||||
_pid1: Pid, /* which child */
|
||||
_uid1: Uid, /* sender's uid */
|
||||
status: i32, /* exit code */
|
||||
utime: uint,
|
||||
stime: uint, //clock_t
|
||||
},
|
||||
/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
|
||||
using _sigfault: struct {
|
||||
addr: rawptr, /* faulting insn/memory ref. */
|
||||
using _: struct #raw_union {
|
||||
trapno: i32, /* Trap number that caused signal */
|
||||
addr_lsb: i16, /* LSB of the reported address */
|
||||
using _addr_bnd: struct {
|
||||
_pad2: u32,
|
||||
lower: rawptr, /* lower bound during fault */
|
||||
upper: rawptr, /* upper bound during fault */
|
||||
},
|
||||
using _addr_pkey: struct {
|
||||
_pad3: u32,
|
||||
pkey: u32, /* protection key on PTE that faulted */
|
||||
},
|
||||
using _perf: struct {
|
||||
perf_data: u32,
|
||||
perf_type: u32,
|
||||
perf_flags: u32,
|
||||
},
|
||||
},
|
||||
},
|
||||
/* SIGPOLL */
|
||||
using _sigpoll: struct {
|
||||
band: int, /* POLL_IN, POLL_OUT, POLL_MSG */
|
||||
fd: Fd,
|
||||
},
|
||||
/* SIGSYS */
|
||||
using _sigsys: struct {
|
||||
call_addr: rawptr, /* calling user insn */
|
||||
syscall: i32, /* triggering system call number */
|
||||
arch: u32, /* AUDIT_ARCH_* of syscall */
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
#assert(size_of(Sig_Info) == 128)
|
||||
#assert(offset_of(Sig_Info, signo) == 0x00)
|
||||
#assert(offset_of(Sig_Info, errno) == 0x04)
|
||||
#assert(offset_of(Sig_Info, code) == 0x08)
|
||||
#assert(offset_of(Sig_Info, pid) == 0x0c)
|
||||
#assert(offset_of(Sig_Info, uid) == 0x10)
|
||||
#assert(offset_of(Sig_Info, timerid) == 0x0c)
|
||||
#assert(offset_of(Sig_Info, overrun) == 0x10)
|
||||
#assert(offset_of(Sig_Info, value) == 0x14)
|
||||
#assert(offset_of(Sig_Info, status) == 0x14)
|
||||
#assert(offset_of(Sig_Info, utime) == 0x18)
|
||||
#assert(offset_of(Sig_Info, stime) == 0x1c)
|
||||
#assert(offset_of(Sig_Info, addr) == 0x0c)
|
||||
#assert(offset_of(Sig_Info, addr_lsb) == 0x10)
|
||||
#assert(offset_of(Sig_Info, trapno) == 0x10)
|
||||
#assert(offset_of(Sig_Info, lower) == 0x14)
|
||||
#assert(offset_of(Sig_Info, upper) == 0x18)
|
||||
#assert(offset_of(Sig_Info, pkey) == 0x14)
|
||||
#assert(offset_of(Sig_Info, perf_data) == 0x10)
|
||||
#assert(offset_of(Sig_Info, perf_type) == 0x14)
|
||||
#assert(offset_of(Sig_Info, perf_flags) == 0x18)
|
||||
#assert(offset_of(Sig_Info, band) == 0x0c)
|
||||
#assert(offset_of(Sig_Info, fd) == 0x10)
|
||||
#assert(offset_of(Sig_Info, call_addr) == 0x0c)
|
||||
#assert(offset_of(Sig_Info, syscall) == 0x10)
|
||||
#assert(offset_of(Sig_Info, arch) == 0x14)
|
||||
}
|
||||
|
||||
SIGEV_MAX_SIZE :: 64
|
||||
@@ -684,6 +774,14 @@ Address_Family :: distinct Protocol_Family
|
||||
*/
|
||||
Socket_Msg :: bit_set[Socket_Msg_Bits; i32]
|
||||
|
||||
/*
|
||||
Struct representing a generic socket address.
|
||||
*/
|
||||
Sock_Addr :: struct #packed {
|
||||
sa_family: Address_Family,
|
||||
sa_data: [14]u8,
|
||||
}
|
||||
|
||||
/*
|
||||
Struct representing IPv4 socket address.
|
||||
*/
|
||||
@@ -691,6 +789,7 @@ Sock_Addr_In :: struct #packed {
|
||||
sin_family: Address_Family,
|
||||
sin_port: u16be,
|
||||
sin_addr: [4]u8,
|
||||
sin_zero: [size_of(Sock_Addr) - size_of(Address_Family) - size_of(u16be) - size_of([4]u8)]u8,
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -720,6 +819,7 @@ Sock_Addr_Any :: struct #raw_union {
|
||||
family: Address_Family,
|
||||
port: u16be,
|
||||
},
|
||||
using generic: Sock_Addr,
|
||||
using ipv4: Sock_Addr_In,
|
||||
using ipv6: Sock_Addr_In6,
|
||||
using uds: Sock_Addr_Un,
|
||||
@@ -1350,7 +1450,7 @@ EPoll_Data :: struct #raw_union {
|
||||
}
|
||||
|
||||
EPoll_Event :: struct #packed {
|
||||
events: EPoll_Event_Kind,
|
||||
events: EPoll_Event_Set,
|
||||
data: EPoll_Data,
|
||||
}
|
||||
|
||||
|
||||
@@ -86,22 +86,18 @@ dirent_iterate_buf :: proc "contextless" (buf: []u8, offs: ^int) -> (d: ^Dirent,
|
||||
/// The lifetime of the string is bound to the lifetime of the provided dirent structure
|
||||
dirent_name :: proc "contextless" (dirent: ^Dirent) -> string #no_bounds_check {
|
||||
str := ([^]u8)(&dirent.name)
|
||||
// Note(flysand): The string size calculated above applies only to the ideal case
|
||||
// we subtract 1 byte from the string size, because a null terminator is guaranteed
|
||||
// to be present. But! That said, the dirents are aligned to 8 bytes and the padding
|
||||
// between the null terminator and the start of the next struct may be not initialized
|
||||
// which means we also have to scan these garbage bytes.
|
||||
str_size := int(dirent.reclen) - 1 - cast(int)offset_of(Dirent, name)
|
||||
// This skips *only* over the garbage, since if we're not garbage we're at nul terminator,
|
||||
// which skips this loop
|
||||
for str[str_size] != 0 {
|
||||
str_size -= 1
|
||||
// Dirents are aligned to 8 bytes, so there is guaranteed to be a null
|
||||
// terminator in the last 8 bytes.
|
||||
str_size := int(dirent.reclen) - cast(int)offset_of(Dirent, name)
|
||||
|
||||
trunc := min(str_size, 8)
|
||||
str_size -= trunc
|
||||
for _ in 0..<trunc {
|
||||
if str[str_size] == 0 {
|
||||
break
|
||||
}
|
||||
str_size += 1
|
||||
}
|
||||
for str[str_size-1] == 0 {
|
||||
str_size -= 1
|
||||
}
|
||||
// Oh yeah btw i could also just `repne scasb` this thing, but honestly I started doing
|
||||
// it the painful way, might as well finish doing it that way
|
||||
return string(str[:str_size])
|
||||
}
|
||||
|
||||
@@ -117,4 +113,4 @@ perf_cache_config :: #force_inline proc "contextless" (id: Perf_Hardware_Cache_I
|
||||
op: Perf_Hardware_Cache_Op_Id,
|
||||
res: Perf_Hardware_Cache_Result_Id) -> u64 {
|
||||
return u64(id) | (u64(op) << 8) | (u64(res) << 16)
|
||||
}
|
||||
}
|
||||
|
||||
+47
-30
@@ -37,12 +37,7 @@ log_info :: proc "contextless" (msg: cstring, loc := #caller_location) {
|
||||
}
|
||||
|
||||
abort :: proc "contextless" (msg: cstring, loc := #caller_location) {
|
||||
abort_ext(
|
||||
cstring(raw_data(loc.procedure)),
|
||||
cstring(raw_data(loc.file_path)),
|
||||
loc.line,
|
||||
msg,
|
||||
)
|
||||
abort_ext(cstring(raw_data(loc.procedure)), cstring(raw_data(loc.file_path)), loc.line, msg)
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -55,7 +50,12 @@ list_entry :: proc "contextless" (elt: ^list_elt, $T: typeid, $member: string) -
|
||||
}
|
||||
|
||||
// Get the next entry in a list.
|
||||
list_next_entry :: proc "contextless" (list: ^list, elt: ^list_elt, $T: typeid, $member: string) -> ^T {
|
||||
list_next_entry :: proc "contextless" (
|
||||
list: ^list,
|
||||
elt: ^list_elt,
|
||||
$T: typeid,
|
||||
$member: string,
|
||||
) -> ^T {
|
||||
if elt.next != list.last {
|
||||
return list_entry(elt.next, T, member)
|
||||
}
|
||||
@@ -64,7 +64,12 @@ list_next_entry :: proc "contextless" (list: ^list, elt: ^list_elt, $T: typeid,
|
||||
}
|
||||
|
||||
// Get the previous entry in a list.
|
||||
list_prev_entry :: proc "contextless" (list: ^list, elt: ^list_elt, $T: typeid, $member: string) -> ^T {
|
||||
list_prev_entry :: proc "contextless" (
|
||||
list: ^list,
|
||||
elt: ^list_elt,
|
||||
$T: typeid,
|
||||
$member: string,
|
||||
) -> ^T {
|
||||
if elt.prev != list.last {
|
||||
return list_entry(elt.prev, T, member)
|
||||
}
|
||||
@@ -94,9 +99,23 @@ list_last_entry :: proc "contextless" (list: ^list, $T: typeid, $member: string)
|
||||
// _elt: ^list_elt
|
||||
// for elt in oc.list_for(list, &_elt, int, "elt") {
|
||||
// }
|
||||
list_for :: proc "contextless" (list: ^list, elt: ^^list_elt, $T: typeid, $member: string) -> (^T, bool) {
|
||||
list_for :: proc "contextless" (
|
||||
list: ^list,
|
||||
elt: ^^list_elt,
|
||||
$T: typeid,
|
||||
$member: string,
|
||||
) -> (
|
||||
^T,
|
||||
bool,
|
||||
) {
|
||||
if elt == nil {
|
||||
assert_fail(#file, #procedure, #line, "elt != nil", "misuse of `list_for`, expected `elt` to not be nil")
|
||||
assert_fail(
|
||||
#file,
|
||||
#procedure,
|
||||
#line,
|
||||
"elt != nil",
|
||||
"misuse of `list_for`, expected `elt` to not be nil",
|
||||
)
|
||||
}
|
||||
|
||||
if elt^ == nil {
|
||||
@@ -112,7 +131,15 @@ list_for :: proc "contextless" (list: ^list, elt: ^^list_elt, $T: typeid, $membe
|
||||
|
||||
list_iter :: list_for
|
||||
|
||||
list_for_reverse :: proc "contextless" (list: ^list, elt: ^^list_elt, $T: typeid, $member: string) -> (^T, bool) {
|
||||
list_for_reverse :: proc "contextless" (
|
||||
list: ^list,
|
||||
elt: ^^list_elt,
|
||||
$T: typeid,
|
||||
$member: string,
|
||||
) -> (
|
||||
^T,
|
||||
bool,
|
||||
) {
|
||||
if elt^ == nil {
|
||||
elt^ = list.last
|
||||
entry := list_checked_entry(elt^, T, member)
|
||||
@@ -226,27 +253,17 @@ str32_list_for :: proc "contextless" (list: ^str32_list, elt: ^^list_elt) -> (^s
|
||||
return list_for(&list.list, elt, str32_elt, "listElt")
|
||||
}
|
||||
|
||||
@(deferred_none=ui_box_end)
|
||||
ui_container :: proc "contextless" (name: string, flags: ui_flags = {}) -> ^ui_box {
|
||||
return ui_box_begin_str8(name, flags)
|
||||
@(deferred_none = ui_box_end)
|
||||
ui_container :: proc "contextless" (name: string) -> ^ui_box {
|
||||
return ui_box_begin_str8(name)
|
||||
}
|
||||
|
||||
@(deferred_none=ui_end_frame)
|
||||
ui_frame :: proc "contextless" (frame_size: [2]f32, style: ui_style, mask: ui_style_mask) {
|
||||
ui_begin_frame(frame_size, style, mask)
|
||||
@(deferred_none = ui_menu_end)
|
||||
ui_menu :: proc "contextless" (key, name: string) {
|
||||
ui_menu_begin_str8(key, name)
|
||||
}
|
||||
|
||||
@(deferred_none=ui_panel_end)
|
||||
ui_panel :: proc "contextless" (name: cstring, flags: ui_flags) {
|
||||
ui_panel_begin(name, flags)
|
||||
}
|
||||
|
||||
@(deferred_none=ui_menu_end)
|
||||
ui_menu :: proc "contextless" (name: cstring) {
|
||||
ui_menu_begin(name)
|
||||
}
|
||||
|
||||
@(deferred_none=ui_menu_bar_end)
|
||||
ui_menu_bar :: proc "contextless" (name: cstring) {
|
||||
ui_menu_bar_begin(name)
|
||||
@(deferred_none = ui_menu_bar_end)
|
||||
ui_menu_bar :: proc "contextless" (key: string) {
|
||||
ui_menu_bar_begin_str8(key)
|
||||
}
|
||||
|
||||
+13
-3
@@ -8,15 +8,25 @@ create_odin_logger :: proc(lowest := runtime.Logger_Level.Debug, ident := "") ->
|
||||
return runtime.Logger{odin_logger_proc, nil, lowest, {}}
|
||||
}
|
||||
|
||||
log_typed :: proc "contextless" (level: log_level, msg: cstring, loc := #caller_location) {
|
||||
log_ext(
|
||||
level,
|
||||
cstring(raw_data(loc.procedure)),
|
||||
cstring(raw_data(loc.file_path)),
|
||||
loc.line,
|
||||
msg,
|
||||
)
|
||||
}
|
||||
|
||||
odin_logger_proc :: proc(logger_data: rawptr, level: runtime.Logger_Level, text: string, options: runtime.Logger_Options, location := #caller_location) {
|
||||
cbuf := make([]byte, len(text)+1, context.temp_allocator)
|
||||
copy(cbuf, text)
|
||||
ctext := cstring(raw_data(cbuf))
|
||||
|
||||
switch level {
|
||||
case .Debug, .Info: log_info(ctext, location)
|
||||
case .Warning: log_warning(ctext, location)
|
||||
case .Debug, .Info: log_typed(.INFO, ctext, location)
|
||||
case .Warning: log_typed(.WARNING, ctext, location)
|
||||
case: fallthrough
|
||||
case .Error, .Fatal: log_error(ctext, location)
|
||||
case .Error, .Fatal: log_typed(.ERROR, ctext, location)
|
||||
}
|
||||
}
|
||||
|
||||
+526
-562
File diff suppressed because it is too large
Load Diff
@@ -1,10 +1,12 @@
|
||||
#+build darwin, linux, freebsd, openbsd, netbsd
|
||||
#+build darwin, linux, freebsd, openbsd, netbsd, haiku
|
||||
package posix
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == .Darwin {
|
||||
foreign import lib "system:System.framework"
|
||||
} else when ODIN_OS == .Haiku {
|
||||
foreign import lib "system:network"
|
||||
} else {
|
||||
foreign import lib "system:c"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build darwin, linux, freebsd, openbsd, netbsd
|
||||
#+build darwin, linux, freebsd, openbsd, netbsd, haiku
|
||||
package posix
|
||||
|
||||
import "core:c"
|
||||
@@ -219,12 +219,23 @@ when ODIN_OS == .Darwin {
|
||||
|
||||
} else when ODIN_OS == .Linux {
|
||||
|
||||
dirent :: struct {
|
||||
d_ino: u64, /* [PSX] file number of entry */
|
||||
d_off: i64, /* directory offset of the next entry */
|
||||
d_reclen: u16, /* length of this record */
|
||||
d_type: D_Type, /* file type */
|
||||
d_name: [256]c.char `fmt:"s,0"`, /* [PSX] entry name */
|
||||
}
|
||||
dirent :: struct {
|
||||
d_ino: u64, /* [PSX] file number of entry */
|
||||
d_off: i64, /* directory offset of the next entry */
|
||||
d_reclen: u16, /* length of this record */
|
||||
d_type: D_Type, /* file type */
|
||||
d_name: [256]c.char `fmt:"s,0"`, /* [PSX] entry name */
|
||||
}
|
||||
|
||||
} else when ODIN_OS == .Haiku {
|
||||
|
||||
dirent :: struct {
|
||||
d_dev: dev_t, /* device */
|
||||
d_pdev: dev_t, /* parent device (only for queries) */
|
||||
d_ino: ino_t, /* inode number */
|
||||
d_pino: ino_t, /* parent inode (only for queries) */
|
||||
d_reclen: c.ushort, /* length of this record, not the name */
|
||||
d_name: [0]c.char `fmt:"s,0"`, /* name of the entry (null byte terminated) */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build windows, darwin, linux, freebsd, openbsd, netbsd
|
||||
#+build windows, darwin, linux, freebsd, openbsd, netbsd, haiku
|
||||
package posix
|
||||
|
||||
import "core:c"
|
||||
@@ -536,5 +536,92 @@ when ODIN_OS == .Darwin {
|
||||
ETXTBSY :: 139
|
||||
EWOULDBLOCK :: 140
|
||||
EXDEV :: 18
|
||||
} else when ODIN_OS == .Haiku {
|
||||
_HAIKU_USE_POSITIVE_POSIX_ERRORS :: libc._HAIKU_USE_POSITIVE_POSIX_ERRORS
|
||||
_POSIX_ERROR_FACTOR :: libc._POSIX_ERROR_FACTOR
|
||||
|
||||
_GENERAL_ERROR_BASE :: min(c.int)
|
||||
_OS_ERROR_BASE :: _GENERAL_ERROR_BASE + 0x1000
|
||||
_STORAGE_ERROR_BASE :: _GENERAL_ERROR_BASE + 0x6000
|
||||
_POSIX_ERROR_BASE :: _GENERAL_ERROR_BASE + 0x7000
|
||||
|
||||
EIO :: _POSIX_ERROR_FACTOR * (_GENERAL_ERROR_BASE + 1) // B_IO_ERROR
|
||||
EACCES :: _POSIX_ERROR_FACTOR * (_GENERAL_ERROR_BASE + 2) // B_PERMISSION_DENIED
|
||||
EINVAL :: _POSIX_ERROR_FACTOR * (_GENERAL_ERROR_BASE + 5) // B_BAD_VALUE
|
||||
ETIMEDOUT :: _POSIX_ERROR_FACTOR * (_GENERAL_ERROR_BASE + 9) // B_TIMED_OUT
|
||||
EINTR :: _POSIX_ERROR_FACTOR * (_GENERAL_ERROR_BASE + 10) // B_INTERRUPTED
|
||||
EAGAIN :: _POSIX_ERROR_FACTOR * (_GENERAL_ERROR_BASE + 11) // B_WOULD_BLOCK /* SysV compatibility */
|
||||
EWOULDBLOCK :: _POSIX_ERROR_FACTOR * (_GENERAL_ERROR_BASE + 11) // B_WOULD_BLOCK /* BSD compatibility */
|
||||
EBUSY :: _POSIX_ERROR_FACTOR * (_GENERAL_ERROR_BASE + 14) // B_BUSY
|
||||
EPERM :: _POSIX_ERROR_FACTOR * (_GENERAL_ERROR_BASE + 15) // B_NOT_ALLOWED
|
||||
EFAULT :: _POSIX_ERROR_FACTOR * (_OS_ERROR_BASE + 0x301) // B_BAD_ADDRESS
|
||||
ENOEXEC :: _POSIX_ERROR_FACTOR * (_OS_ERROR_BASE + 0x302) // B_NOT_AN_EXECUTABLE
|
||||
EBADF :: _POSIX_ERROR_FACTOR * (_STORAGE_ERROR_BASE + 0) // B_FILE_ERROR
|
||||
EEXIST :: _POSIX_ERROR_FACTOR * (_STORAGE_ERROR_BASE + 2) // B_FILE_EXISTS
|
||||
ENOENT :: _POSIX_ERROR_FACTOR * (_STORAGE_ERROR_BASE + 3) // B_ENTRY_NOT_FOUND
|
||||
ENAMETOOLONG :: _POSIX_ERROR_FACTOR * (_STORAGE_ERROR_BASE + 4) // B_NAME_TOO_LONG
|
||||
ENOTDIR :: _POSIX_ERROR_FACTOR * (_STORAGE_ERROR_BASE + 5) // B_NOT_A_DIRECTORY
|
||||
ENOTEMPTY :: _POSIX_ERROR_FACTOR * (_STORAGE_ERROR_BASE + 6) // B_DIRECTORY_NOT_EMPTY
|
||||
ENOSPC :: _POSIX_ERROR_FACTOR * (_STORAGE_ERROR_BASE + 7) // B_DEVICE_FULL
|
||||
EROFS :: _POSIX_ERROR_FACTOR * (_STORAGE_ERROR_BASE + 8) // B_READ_ONLY_DEVICE
|
||||
EISDIR :: _POSIX_ERROR_FACTOR * (_STORAGE_ERROR_BASE + 9) // B_IS_A_DIRECTORY
|
||||
EMFILE :: _POSIX_ERROR_FACTOR * (_STORAGE_ERROR_BASE + 10) // B_NO_MORE_FDS
|
||||
EXDEV :: _POSIX_ERROR_FACTOR * (_STORAGE_ERROR_BASE + 11) // B_CROSS_DEVICE_LINK
|
||||
ELOOP :: _POSIX_ERROR_FACTOR * (_STORAGE_ERROR_BASE + 12) // B_LINK_LIMIT
|
||||
EPIPE :: _POSIX_ERROR_FACTOR * (_STORAGE_ERROR_BASE + 13) // B_BUSTED_PIPE
|
||||
ENOMEM :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 0) when _HAIKU_USE_POSITIVE_POSIX_ERRORS else (_GENERAL_ERROR_BASE + 0) // B_NO_MEMORY
|
||||
E2BIG :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 1)
|
||||
ECHILD :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 2)
|
||||
EDEADLK :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 3)
|
||||
EFBIG :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 4)
|
||||
EMLINK :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 5)
|
||||
ENFILE :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 6)
|
||||
ENODEV :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 7)
|
||||
ENOLCK :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 8)
|
||||
ENOSYS :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 9)
|
||||
ENOTTY :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 10)
|
||||
ENXIO :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 11)
|
||||
ESPIPE :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 12)
|
||||
ESRCH :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 13)
|
||||
EPROTOTYPE :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 18)
|
||||
EPROTONOSUPPORT :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 19)
|
||||
EAFNOSUPPORT :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 21)
|
||||
EADDRINUSE :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 22)
|
||||
EADDRNOTAVAIL :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 23)
|
||||
ENETDOWN :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 24)
|
||||
ENETUNREACH :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 25)
|
||||
ENETRESET :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 26)
|
||||
ECONNABORTED :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 27)
|
||||
ECONNRESET :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 28)
|
||||
EISCONN :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 29)
|
||||
ENOTCONN :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 30)
|
||||
ECONNREFUSED :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 32)
|
||||
EHOSTUNREACH :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 33)
|
||||
ENOPROTOOPT :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 34)
|
||||
ENOBUFS :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 35)
|
||||
EINPROGRESS :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 36)
|
||||
EALREADY :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 37)
|
||||
ENOMSG :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 39)
|
||||
ESTALE :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 40)
|
||||
EOVERFLOW :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 41)
|
||||
EMSGSIZE :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 42)
|
||||
EOPNOTSUPP :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 43)
|
||||
ENOTSOCK :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 44)
|
||||
EBADMSG :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 46)
|
||||
ECANCELED :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 47)
|
||||
EDESTADDRREQ :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 48)
|
||||
EDQUOT :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 49)
|
||||
EIDRM :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 50)
|
||||
EMULTIHOP :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 51)
|
||||
ENODATA :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 52)
|
||||
ENOLINK :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 53)
|
||||
ENOSR :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 54)
|
||||
ENOSTR :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 55)
|
||||
ENOTSUP :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 56)
|
||||
EPROTO :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 57)
|
||||
ETIME :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 58)
|
||||
ETXTBSY :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 59)
|
||||
ENOTRECOVERABLE :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 61)
|
||||
EOWNERDEAD :: _POSIX_ERROR_FACTOR * (_POSIX_ERROR_BASE + 62)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build linux, darwin, openbsd, freebsd, netbsd
|
||||
#+build linux, darwin, openbsd, freebsd, netbsd, haiku
|
||||
package posix
|
||||
|
||||
import "core:c"
|
||||
@@ -343,6 +343,7 @@ when ODIN_OS == .Darwin {
|
||||
l_type: Lock_Type, /* [PSX] type of lock */
|
||||
l_whence: c.short, /* [PSX] flag (Whence) of starting offset */
|
||||
}
|
||||
|
||||
} else when ODIN_OS == .OpenBSD {
|
||||
|
||||
off_t :: distinct c.int64_t
|
||||
@@ -408,6 +409,72 @@ when ODIN_OS == .Darwin {
|
||||
l_whence: c.short, /* [PSX] flag (Whence) of starting offset */
|
||||
}
|
||||
|
||||
} else when ODIN_OS == .Haiku {
|
||||
|
||||
off_t :: distinct c.int64_t
|
||||
pid_t :: distinct c.int32_t
|
||||
|
||||
/* commands that can be passed to fcntl() */
|
||||
F_DUPFD :: 0x0001 /* duplicate fd */
|
||||
F_GETFD :: 0x0002 /* get fd flags */
|
||||
F_SETFD :: 0x0004 /* set fd flags */
|
||||
F_GETFL :: 0x0008 /* get file status flags and access mode */
|
||||
F_SETFL :: 0x0010 /* set file status flags */
|
||||
F_GETLK :: 0x0020 /* get locking information */
|
||||
F_SETLK :: 0x0080 /* set locking information */
|
||||
F_SETLKW :: 0x0100 /* as above, but waits if blocked */
|
||||
F_DUPFD_CLOEXEC :: 0x0200 /* duplicate fd with close on exec set */
|
||||
F_GETOWN :: -1 // NOTE: Not supported.
|
||||
F_SETOWN :: -1 // NOTE: Not supported.
|
||||
|
||||
/* advisory locking types */
|
||||
F_RDLCK :: 0x0040 /* read or shared lock */
|
||||
F_UNLCK :: 0x0200 /* unlock */
|
||||
F_WRLCK :: 0x0400 /* write or exclusive lock */
|
||||
|
||||
/* file descriptor flags for fcntl() */
|
||||
FD_CLOEXEC :: 1
|
||||
|
||||
O_CLOEXEC :: 0x00000040
|
||||
O_CREAT :: 0x0200
|
||||
O_DIRECTORY :: 0x00200000
|
||||
O_EXCL :: 0x0100
|
||||
O_NOCTTY :: 0x1000
|
||||
O_NOFOLLOW :: 0x00080000
|
||||
O_TRUNC :: 0x0400
|
||||
|
||||
_O_TTY_INIT :: 0
|
||||
O_TTY_INIT :: O_Flags{} // NOTE: not defined in the headers
|
||||
|
||||
O_APPEND :: 0x0800
|
||||
O_DSYNC :: 0x040000
|
||||
O_NONBLOCK :: 0x0080
|
||||
O_SYNC :: 0x010000
|
||||
O_RSYNC :: 0x020000
|
||||
|
||||
O_EXEC :: 0x04000000 // NOTE: not defined in the headers
|
||||
O_RDONLY :: 0
|
||||
O_RDWR :: 0x0002
|
||||
O_WRONLY :: 0x0001
|
||||
|
||||
_O_SEARCH :: 0
|
||||
O_SEARCH :: O_Flags{} // NOTE: not defined in the headers
|
||||
|
||||
AT_FDCWD: FD: -100
|
||||
|
||||
AT_EACCESS :: 0x08
|
||||
AT_SYMLINK_NOFOLLOW :: 0x01
|
||||
AT_SYMLINK_FOLLOW :: 0x02
|
||||
AT_REMOVEDIR :: 0x04
|
||||
|
||||
flock :: struct {
|
||||
l_type: Lock_Type, /* [PSX] type of lock */
|
||||
l_whence: c.short, /* [PSX] flag (Whence) of starting offset */
|
||||
l_start: off_t, /* [PSX] relative offset in bytes */
|
||||
l_len: off_t, /* [PSX] size; if 0 then until EOF */
|
||||
l_pid: pid_t, /* [PSX] process ID of the process holding the lock */
|
||||
}
|
||||
|
||||
} else when ODIN_OS == .Linux {
|
||||
|
||||
off_t :: distinct c.int64_t
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build darwin, linux, openbsd, freebsd, netbsd
|
||||
#+build darwin, linux, openbsd, freebsd, netbsd, haiku
|
||||
package posix
|
||||
|
||||
import "core:c"
|
||||
@@ -46,7 +46,7 @@ FNM_Flag_Bits :: enum c.int {
|
||||
}
|
||||
FNM_Flags :: bit_set[FNM_Flag_Bits; c.int]
|
||||
|
||||
when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD {
|
||||
when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD || ODIN_OS == .Haiku {
|
||||
|
||||
FNM_NOMATCH :: 1
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
import "core:c"
|
||||
@@ -109,7 +109,7 @@ when ODIN_OS == .Darwin {
|
||||
GLOB_NOMATCH :: -3
|
||||
GLOB_NOSPACE :: -1
|
||||
|
||||
} else when ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD {
|
||||
} else when ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .Haiku {
|
||||
|
||||
glob_t :: struct {
|
||||
gl_pathc: c.size_t, /* [PSX] count of paths matched by pattern */
|
||||
@@ -134,7 +134,7 @@ when ODIN_OS == .Darwin {
|
||||
GLOB_ERR :: 0x0004
|
||||
GLOB_MARK :: 0x0008
|
||||
GLOB_NOCHECK :: 0x0010
|
||||
GLOB_NOESCAPE :: 0x2000 when ODIN_OS == .FreeBSD else 0x0100
|
||||
GLOB_NOESCAPE :: 0x2000 when ODIN_OS == .FreeBSD || ODIN_OS == .Haiku else 0x0100
|
||||
GLOB_NOSORT :: 0x0020
|
||||
|
||||
GLOB_ABORTED :: -2
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
import "core:c"
|
||||
@@ -115,7 +115,7 @@ foreign lib {
|
||||
getgrnam_r :: proc(name: cstring, grp: ^group, buffer: [^]byte, bufsize: c.size_t, result: ^^group) -> Errno ---
|
||||
}
|
||||
|
||||
when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD || ODIN_OS == .Linux {
|
||||
when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD || ODIN_OS == .Haiku || ODIN_OS == .Linux {
|
||||
|
||||
gid_t :: distinct c.uint32_t
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
import "core:c"
|
||||
@@ -143,7 +143,7 @@ nl_item :: enum nl_item_t {
|
||||
CRNCYSTR = CRNCYSTR,
|
||||
}
|
||||
|
||||
when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD {
|
||||
when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .Haiku {
|
||||
|
||||
// NOTE: declared with `_t` so we can enumerate the real `nl_info`.
|
||||
nl_item_t :: distinct c.int
|
||||
@@ -210,7 +210,7 @@ when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD {
|
||||
YESEXPR :: 52
|
||||
NOEXPR :: 53
|
||||
|
||||
CRNCYSTR :: 56
|
||||
CRNCYSTR :: 54 when ODIN_OS == .Haiku else 56
|
||||
|
||||
} else when ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD {
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
when ODIN_OS == .Darwin {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build windows, linux, darwin, netbsd, openbsd, freebsd
|
||||
#+build windows, linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
import "core:c/libc"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
import "core:c"
|
||||
|
||||
+41
-11
@@ -1,4 +1,4 @@
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
import "core:c"
|
||||
@@ -319,7 +319,7 @@ Info_Errno :: enum c.int {
|
||||
OVERFLOW = EAI_OVERFLOW,
|
||||
}
|
||||
|
||||
when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD || ODIN_OS == .OpenBSD || ODIN_OS == .Linux {
|
||||
when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD || ODIN_OS == .OpenBSD || ODIN_OS == .Linux || ODIN_OS == .Haiku {
|
||||
|
||||
hostent :: struct {
|
||||
h_name: cstring, /* [PSX] official name of host */
|
||||
@@ -352,15 +352,28 @@ when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS
|
||||
// The highest reserved port number.
|
||||
IPPORT_RESERVED :: 1024
|
||||
|
||||
addrinfo :: struct {
|
||||
ai_flags: Addrinfo_Flags, /* [PSX] input flags */
|
||||
ai_family: AF, /* [PSX] address family of socket */
|
||||
ai_socktype: Sock, /* [PSX] socket type */
|
||||
ai_protocol: Protocol, /* [PSX] protocol of socket */
|
||||
ai_addrlen: socklen_t, /* [PSX] length of socket address */
|
||||
ai_canonname: cstring, /* [PSX] canonical name of service location */
|
||||
ai_addr: ^sockaddr, /* [PSX] binary address */
|
||||
ai_next: ^addrinfo, /* [PSX] pointer to next in list */
|
||||
when ODIN_OS == .Linux || ODIN_OS == .OpenBSD {
|
||||
addrinfo :: struct {
|
||||
ai_flags: Addrinfo_Flags, /* [PSX] input flags */
|
||||
ai_family: AF, /* [PSX] address family of socket */
|
||||
ai_socktype: Sock, /* [PSX] socket type */
|
||||
ai_protocol: Protocol, /* [PSX] protocol of socket */
|
||||
ai_addrlen: socklen_t, /* [PSX] length of socket address */
|
||||
ai_addr: ^sockaddr, /* [PSX] binary address */
|
||||
ai_canonname: cstring, /* [PSX] canonical name of service location */
|
||||
ai_next: ^addrinfo, /* [PSX] pointer to next in list */
|
||||
}
|
||||
} else {
|
||||
addrinfo :: struct {
|
||||
ai_flags: Addrinfo_Flags, /* [PSX] input flags */
|
||||
ai_family: AF, /* [PSX] address family of socket */
|
||||
ai_socktype: Sock, /* [PSX] socket type */
|
||||
ai_protocol: Protocol, /* [PSX] protocol of socket */
|
||||
ai_addrlen: socklen_t, /* [PSX] length of socket address */
|
||||
ai_canonname: cstring, /* [PSX] canonical name of service location */
|
||||
ai_addr: ^sockaddr, /* [PSX] binary address */
|
||||
ai_next: ^addrinfo, /* [PSX] pointer to next in list */
|
||||
}
|
||||
}
|
||||
|
||||
when ODIN_OS == .Darwin {
|
||||
@@ -431,6 +444,23 @@ when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS
|
||||
NI_NUMERICSCOPE :: 0x100
|
||||
NI_DGRAM :: 16
|
||||
|
||||
} else when ODIN_OS == .Haiku {
|
||||
|
||||
AI_PASSIVE :: 0x001
|
||||
AI_CANONNAME :: 0x002
|
||||
AI_NUMERICHOST :: 0x004
|
||||
AI_NUMERICSERV :: 0x008
|
||||
AI_V4MAPPED :: 0x800
|
||||
AI_ALL :: 0x100
|
||||
AI_ADDRCONFIG :: 0x400
|
||||
|
||||
NI_NOFQDN :: 0x01
|
||||
NI_NUMERICHOST :: 0x02
|
||||
NI_NAMEREQD :: 0x04
|
||||
NI_NUMERICSERV :: 0x08
|
||||
NI_DGRAM :: 0x10
|
||||
NI_NUMERICSCOPE :: 0x40
|
||||
|
||||
}
|
||||
|
||||
when ODIN_OS == .OpenBSD {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
import "core:c"
|
||||
@@ -31,20 +31,31 @@ Protocol :: enum c.int {
|
||||
UDP = IPPROTO_UDP,
|
||||
}
|
||||
|
||||
when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD || ODIN_OS == .Linux {
|
||||
when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD || ODIN_OS == .Linux || ODIN_OS == .Haiku {
|
||||
|
||||
in_addr :: struct {
|
||||
s_addr: in_addr_t, /* [PSX] big endian address */
|
||||
}
|
||||
|
||||
in6_addr :: struct {
|
||||
using _: struct #raw_union {
|
||||
s6_addr: [16]c.uint8_t, /* [PSX] big endian address */
|
||||
__u6_addr16: [8]c.uint16_t,
|
||||
__u6_addr32: [4]c.uint32_t,
|
||||
},
|
||||
when ODIN_OS == .Haiku {
|
||||
in6_addr :: struct #packed {
|
||||
using _: struct #raw_union {
|
||||
s6_addr: [16]c.uint8_t, /* [PSX] big endian address */
|
||||
__u6_addr16: [8]c.uint16_t,
|
||||
__u6_addr32: [4]c.uint32_t,
|
||||
},
|
||||
}
|
||||
} else {
|
||||
in6_addr :: struct {
|
||||
using _: struct #raw_union {
|
||||
s6_addr: [16]c.uint8_t, /* [PSX] big endian address */
|
||||
__u6_addr16: [8]c.uint16_t,
|
||||
__u6_addr32: [4]c.uint32_t,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
when ODIN_OS == .Linux {
|
||||
|
||||
sockaddr_in :: struct {
|
||||
@@ -77,12 +88,20 @@ when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS
|
||||
|
||||
} else {
|
||||
|
||||
when ODIN_OS == .Haiku {
|
||||
@(private)
|
||||
_SIN_ZEROSIZE :: 24
|
||||
} else {
|
||||
@(private)
|
||||
_SIN_ZEROSIZE :: 8
|
||||
}
|
||||
|
||||
sockaddr_in :: struct {
|
||||
sin_len: c.uint8_t,
|
||||
sin_family: sa_family_t, /* [PSX] AF_INET (but a smaller size) */
|
||||
sin_port: in_port_t, /* [PSX] port number */
|
||||
sin_addr: in_addr, /* [PSX] IP address */
|
||||
sin_zero: [8]c.char,
|
||||
sin_zero: [_SIN_ZEROSIZE]c.char,
|
||||
}
|
||||
|
||||
sockaddr_in6 :: struct {
|
||||
@@ -99,13 +118,23 @@ when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS
|
||||
ipv6mr_interface: c.uint, /* [PSX] interface index */
|
||||
}
|
||||
|
||||
IPV6_JOIN_GROUP :: 12
|
||||
IPV6_LEAVE_GROUP :: 13
|
||||
IPV6_MULTICAST_HOPS :: 10
|
||||
IPV6_MULTICAST_IF :: 9
|
||||
IPV6_MULTICAST_LOOP :: 11
|
||||
IPV6_UNICAST_HOPS :: 4
|
||||
IPV6_V6ONLY :: 27
|
||||
when ODIN_OS == .Haiku {
|
||||
IPV6_JOIN_GROUP :: 28
|
||||
IPV6_LEAVE_GROUP :: 29
|
||||
IPV6_MULTICAST_HOPS :: 25
|
||||
IPV6_MULTICAST_IF :: 24
|
||||
IPV6_MULTICAST_LOOP :: 26
|
||||
IPV6_UNICAST_HOPS :: 27
|
||||
IPV6_V6ONLY :: 30
|
||||
} else {
|
||||
IPV6_JOIN_GROUP :: 12
|
||||
IPV6_LEAVE_GROUP :: 13
|
||||
IPV6_MULTICAST_HOPS :: 10
|
||||
IPV6_MULTICAST_IF :: 9
|
||||
IPV6_MULTICAST_LOOP :: 11
|
||||
IPV6_UNICAST_HOPS :: 4
|
||||
IPV6_V6ONLY :: 27
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
+36
-13
@@ -1,4 +1,4 @@
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
import "base:intrinsics"
|
||||
@@ -25,7 +25,11 @@ foreign lib {
|
||||
poll :: proc(fds: [^]pollfd, nfds: nfds_t, timeout: c.int) -> c.int ---
|
||||
}
|
||||
|
||||
nfds_t :: c.uint
|
||||
when ODIN_OS == .Haiku {
|
||||
nfds_t :: c.ulong
|
||||
} else {
|
||||
nfds_t :: c.uint
|
||||
}
|
||||
|
||||
Poll_Event_Bits :: enum c.short {
|
||||
// Data other than high-priority data may be read without blocking.
|
||||
@@ -53,7 +57,7 @@ Poll_Event_Bits :: enum c.short {
|
||||
}
|
||||
Poll_Event :: bit_set[Poll_Event_Bits; c.short]
|
||||
|
||||
when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD {
|
||||
when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD || ODIN_OS == .Haiku {
|
||||
|
||||
pollfd :: struct {
|
||||
fd: FD, /* [PSX] the following descriptor being polled */
|
||||
@@ -61,17 +65,36 @@ when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS
|
||||
revents: Poll_Event, /* [PSX] the output event flags */
|
||||
}
|
||||
|
||||
POLLIN :: 0x0001
|
||||
POLLRDNORM :: 0x0040
|
||||
POLLRDBAND :: 0x0080
|
||||
POLLPRI :: 0x0002
|
||||
POLLOUT :: 0x0004
|
||||
POLLWRNORM :: POLLOUT
|
||||
POLLWRBAND :: 0x0100
|
||||
when ODIN_OS == .Haiku {
|
||||
|
||||
POLLIN :: 0x0001 /* any readable data available */
|
||||
POLLOUT :: 0x0002 /* file descriptor is writeable */
|
||||
POLLRDNORM :: POLLIN
|
||||
POLLWRNORM :: POLLOUT
|
||||
POLLRDBAND :: 0x0008 /* priority readable data */
|
||||
POLLWRBAND :: 0x0010 /* priority data can be written */
|
||||
POLLPRI :: 0x0020 /* high priority readable data */
|
||||
|
||||
POLLERR :: 0x0004 /* errors pending */
|
||||
POLLHUP :: 0x0080 /* disconnected */
|
||||
POLLNVAL :: 0x1000 /* invalid file descriptor */
|
||||
|
||||
} else {
|
||||
|
||||
POLLIN :: 0x0001
|
||||
POLLRDNORM :: 0x0040
|
||||
POLLRDBAND :: 0x0080
|
||||
POLLPRI :: 0x0002
|
||||
POLLOUT :: 0x0004
|
||||
POLLWRNORM :: POLLOUT
|
||||
POLLWRBAND :: 0x0100
|
||||
|
||||
POLLERR :: 0x0008
|
||||
POLLHUP :: 0x0010
|
||||
POLLNVAL :: 0x0020
|
||||
|
||||
}
|
||||
|
||||
POLLERR :: 0x0008
|
||||
POLLHUP :: 0x0010
|
||||
POLLNVAL :: 0x0020
|
||||
|
||||
} else when ODIN_OS == .Linux {
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
import "core:c"
|
||||
@@ -554,6 +554,56 @@ when ODIN_OS == .Darwin {
|
||||
sched_priority: c.int, /* [PSX] process or thread execution scheduling priority */
|
||||
}
|
||||
|
||||
} else when ODIN_OS == .Haiku {
|
||||
|
||||
PTHREAD_CANCEL_ASYNCHRONOUS :: 2
|
||||
PTHREAD_CANCEL_DEFERRED :: 0
|
||||
|
||||
PTHREAD_CANCEL_DISABLE :: 1
|
||||
PTHREAD_CANCEL_ENABLE :: 0
|
||||
|
||||
PTHREAD_CANCELED :: rawptr(uintptr(1))
|
||||
|
||||
PTHREAD_CREATE_DETACHED :: 0x1
|
||||
PTHREAD_CREATE_JOINABLE :: 0
|
||||
|
||||
PTHREAD_EXPLICIT_SCHED :: 0
|
||||
PTHREAD_INHERIT_SCHED :: 0x4
|
||||
|
||||
PTHREAD_PRIO_INHERIT :: 1
|
||||
PTHREAD_PRIO_NONE :: 0
|
||||
PTHREAD_PRIO_PROTECT :: 2
|
||||
|
||||
PTHREAD_PROCESS_SHARED :: 1
|
||||
PTHREAD_PROCESS_PRIVATE :: 0
|
||||
|
||||
PTHREAD_SCOPE_PROCESS :: 0
|
||||
PTHREAD_SCOPE_SYSTEM :: 0x2
|
||||
|
||||
pthread_t :: distinct rawptr
|
||||
pthread_attr_t :: distinct rawptr
|
||||
pthread_key_t :: distinct c.int
|
||||
|
||||
pthread_mutex_t :: struct {
|
||||
flags: u32,
|
||||
lock: i32,
|
||||
unused: i32,
|
||||
owner: i32,
|
||||
owner_count: i32,
|
||||
}
|
||||
|
||||
pthread_cond_t :: struct {
|
||||
flags: u32,
|
||||
unused: i32,
|
||||
mutex: ^pthread_mutex_t,
|
||||
waiter_count: i32,
|
||||
lock: i32,
|
||||
}
|
||||
|
||||
sched_param :: struct {
|
||||
sched_priority: c.int, /* [PSX] process or thread execution scheduling priority */
|
||||
}
|
||||
|
||||
} else when ODIN_OS == .Linux {
|
||||
|
||||
PTHREAD_CANCEL_DEFERRED :: 0
|
||||
|
||||
+13
-1
@@ -1,4 +1,4 @@
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
import "core:c"
|
||||
@@ -176,4 +176,16 @@ when ODIN_OS == .Darwin || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD {
|
||||
pw_shell: cstring, /* Shell program. */
|
||||
}
|
||||
|
||||
} else when ODIN_OS == .Haiku {
|
||||
|
||||
passwd :: struct {
|
||||
pw_name: cstring, /* [PSX] user name */
|
||||
pw_passwd: cstring, /* encrypted password */
|
||||
pw_uid: uid_t, /* [PSX] user uid */
|
||||
pw_gid: gid_t, /* [PSX] user gid */
|
||||
pw_dir: cstring, /* Home directory. */
|
||||
pw_shell: cstring, /* Shell program. */
|
||||
pw_gecos: cstring, /* Real name. */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
import "core:c"
|
||||
@@ -101,4 +101,11 @@ when ODIN_OS == .Darwin {
|
||||
SCHED_FIFO :: 1
|
||||
SCHED_RR :: 2
|
||||
|
||||
} else when ODIN_OS == .Haiku {
|
||||
|
||||
SCHED_FIFO :: 1
|
||||
SCHED_RR :: 2
|
||||
// SCHED_SPORADIC :: 3 NOTE: not a thing on freebsd, netbsd and probably others, leaving it out
|
||||
SCHED_OTHER :: 4
|
||||
|
||||
}
|
||||
|
||||
+149
-2
@@ -1,4 +1,4 @@
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
import "base:intrinsics"
|
||||
@@ -565,7 +565,7 @@ when ODIN_OS == .Darwin {
|
||||
SS_ONSTACK :: 0x0001
|
||||
SS_DISABLE :: 0x0004
|
||||
|
||||
when ODIN_ARCH == .amd64 || ODIN_ARCH == .arm32 {
|
||||
when ODIN_ARCH == .arm64 || ODIN_ARCH == .arm32 {
|
||||
MINSIGSTKSZ :: 1024 * 4
|
||||
} else when ODIN_ARCH == .amd64 || ODIN_ARCH == .i386 {
|
||||
MINSIGSTKSZ :: 512 * 4
|
||||
@@ -1180,4 +1180,151 @@ when ODIN_OS == .Darwin {
|
||||
SI_TIMER :: -2
|
||||
SI_MESGQ :: -3
|
||||
SI_ASYNCIO :: -4
|
||||
|
||||
} else when ODIN_OS == .Haiku {
|
||||
|
||||
// Request that signal be held
|
||||
SIG_HOLD :: rawptr(uintptr(3))
|
||||
|
||||
uid_t :: distinct c.uint32_t
|
||||
sigset_t :: distinct u64
|
||||
|
||||
SIGHUP :: 1 // hangup -- tty is gone!
|
||||
//SIGINT :: 2 // interrupt
|
||||
SIGQUIT :: 3 // `quit' special character typed in tty
|
||||
//SIGILL :: 4 // illegal instruction
|
||||
SIGCHLD :: 5 // child process exited
|
||||
//SIGABRT :: 6 // abort() called, dont' catch
|
||||
SIGPIPE :: 7 // write to a pipe w/no readers
|
||||
//SIGFPE :: 8 // floating point exception
|
||||
SIGKILL :: 9 // kill a team (not catchable)
|
||||
SIGSTOP :: 10 // suspend a thread (not catchable)
|
||||
//SIGSEGV :: 11 // segmentation violation (read: invalid pointer)
|
||||
SIGCONT :: 12 // continue execution if suspended
|
||||
SIGTSTP :: 13 // `stop' special character typed in tty
|
||||
SIGALRM :: 14 // an alarm has gone off (see alarm())
|
||||
//SIGTERM :: 15 // termination requested
|
||||
SIGTTIN :: 16 // read of tty from bg process
|
||||
SIGTTOU :: 17 // write to tty from bg process
|
||||
SIGUSR1 :: 18 // app defined signal 1
|
||||
SIGUSR2 :: 19 // app defined signal 2
|
||||
SIGWINCH :: 20 // tty window size changed
|
||||
SIGKILLTHR :: 21 // be specific: kill just the thread, not team
|
||||
SIGTRAP :: 22 // Trace/breakpoint trap
|
||||
SIGPOLL :: 23 // Pollable event
|
||||
SIGPROF :: 24 // Profiling timer expired
|
||||
SIGSYS :: 25 // Bad system call
|
||||
SIGURG :: 26 // High bandwidth data is available at socket
|
||||
SIGVTALRM :: 27 // Virtual timer expired
|
||||
SIGXCPU :: 28 // CPU time limit exceeded
|
||||
SIGXFSZ :: 29 // File size limit exceeded
|
||||
SIGBUS :: 30 // access to undefined portion of a memory object
|
||||
|
||||
// NOTE: this is actually defined as `sigaction`, but due to the function with the same name
|
||||
// `_t` has been added.
|
||||
|
||||
sigaction_t :: struct {
|
||||
using _: struct #raw_union {
|
||||
sa_handler: proc "c" (Signal), /* [PSX] signal-catching function or one of the SIG_IGN or SIG_DFL */
|
||||
sa_sigaction: proc "c" (Signal, ^siginfo_t, rawptr), /* [PSX] signal-catching function */
|
||||
},
|
||||
sa_mask: sigset_t, /* [PSX] set of signals to be blocked during execution of the signal handling function */
|
||||
sa_flags: SA_Flags, /* [PSX] special flags */
|
||||
sa_userdata: rawptr, /* will be passed to the signal handler, BeOS extension */
|
||||
}
|
||||
|
||||
SIG_BLOCK :: 1
|
||||
SIG_UNBLOCK :: 2
|
||||
SIG_SETMASK :: 3
|
||||
|
||||
SA_NOCLDSTOP :: 0x01
|
||||
SA_NOCLDWAIT :: 0x02
|
||||
SA_RESETHAND :: 0x04
|
||||
SA_NODEFER :: 0x08
|
||||
SA_RESTART :: 0x10
|
||||
SA_ONSTACK :: 0x20
|
||||
SA_SIGINFO :: 0x40
|
||||
|
||||
SS_ONSTACK :: 1
|
||||
SS_DISABLE :: 2
|
||||
|
||||
MINSIGSTKSZ :: 8192
|
||||
SIGSTKSZ :: 16384
|
||||
|
||||
stack_t :: struct {
|
||||
ss_sp: rawptr, /* [PSX] stack base or pointer */
|
||||
ss_size: c.size_t, /* [PSX] stack size */
|
||||
ss_flags: SS_Flags, /* [PSX] flags */
|
||||
}
|
||||
|
||||
siginfo_t :: struct {
|
||||
si_signo: Signal, /* [PSX] signal number */
|
||||
si_code: struct #raw_union { /* [PSX] specific more detailed codes per signal */
|
||||
ill: ILL_Code,
|
||||
fpe: FPE_Code,
|
||||
segv: SEGV_Code,
|
||||
bus: BUS_Code,
|
||||
trap: TRAP_Code,
|
||||
chld: CLD_Code,
|
||||
poll: POLL_Code,
|
||||
any: Any_Code,
|
||||
},
|
||||
si_errno: Errno, /* [PSX] errno value associated with this signal */
|
||||
si_pid: pid_t, /* sending process ID */
|
||||
si_uid: uid_t, /* real user ID of sending process */
|
||||
si_addr: rawptr, /* address of faulting instruction */
|
||||
si_status: c.int, /* exit value or signal */
|
||||
si_band: c.long, /* band event for SIGPOLL */
|
||||
si_value: sigval, /* signal value */
|
||||
}
|
||||
|
||||
/* any signal */
|
||||
SI_USER :: 0 /* signal sent by user */
|
||||
SI_QUEUE :: 1 /* signal sent by sigqueue() */
|
||||
SI_TIMER :: 2 /* signal sent on timer_settime() timeout */
|
||||
SI_ASYNCIO :: 3 /* signal sent on asynchronous I/O completion */
|
||||
SI_MESGQ :: 4 /* signal sent on arrival of message on empty message queue */
|
||||
/* SIGILL */
|
||||
ILL_ILLOPC :: 10 /* illegal opcode */
|
||||
ILL_ILLOPN :: 11 /* illegal operand */
|
||||
ILL_ILLADR :: 12 /* illegal addressing mode */
|
||||
ILL_ILLTRP :: 13 /* illegal trap */
|
||||
ILL_PRVOPC :: 14 /* privileged opcode */
|
||||
ILL_PRVREG :: 15 /* privileged register */
|
||||
ILL_COPROC :: 16 /* coprocessor error */
|
||||
ILL_BADSTK :: 17 /* internal stack error */
|
||||
/* SIGFPE */
|
||||
FPE_INTDIV :: 20 /* integer division by zero */
|
||||
FPE_INTOVF :: 21 /* integer overflow */
|
||||
FPE_FLTDIV :: 22 /* floating-point division by zero */
|
||||
FPE_FLTOVF :: 23 /* floating-point overflow */
|
||||
FPE_FLTUND :: 24 /* floating-point underflow */
|
||||
FPE_FLTRES :: 25 /* floating-point inexact result */
|
||||
FPE_FLTINV :: 26 /* invalid floating-point operation */
|
||||
FPE_FLTSUB :: 27 /* subscript out of range */
|
||||
/* SIGSEGV */
|
||||
SEGV_MAPERR :: 30 /* address not mapped to object */
|
||||
SEGV_ACCERR :: 31 /* invalid permissions for mapped object */
|
||||
/* SIGBUS */
|
||||
BUS_ADRALN :: 40 /* invalid address alignment */
|
||||
BUS_ADRERR :: 41 /* nonexistent physical address */
|
||||
BUS_OBJERR :: 42 /* object-specific hardware error */
|
||||
/* SIGTRAP */
|
||||
TRAP_BRKPT :: 50 /* process breakpoint */
|
||||
TRAP_TRACE :: 51 /* process trace trap. */
|
||||
/* SIGCHLD */
|
||||
CLD_EXITED :: 60 /* child exited */
|
||||
CLD_KILLED :: 61 /* child terminated abnormally without core dump */
|
||||
CLD_DUMPED :: 62 /* child terminated abnormally with core dump */
|
||||
CLD_TRAPPED :: 63 /* traced child trapped */
|
||||
CLD_STOPPED :: 64 /* child stopped */
|
||||
CLD_CONTINUED :: 65 /* stopped child continued */
|
||||
/* SIGPOLL */
|
||||
POLL_IN :: 70 /* input available */
|
||||
POLL_OUT :: 71 /* output available */
|
||||
POLL_MSG :: 72 /* input message available */
|
||||
POLL_ERR :: 73 /* I/O error */
|
||||
POLL_PRI :: 74 /* high priority input available */
|
||||
POLL_HUP :: 75 /* device disconnected */
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build linux, windows, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, windows, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
import "base:intrinsics"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build linux, windows, linux, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, windows, linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
import "core:c"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
import "base:intrinsics"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build linux, windows, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, windows, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
import "base:intrinsics"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
import "core:c"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build linux, windows, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, windows, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
when ODIN_OS == .Windows {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
import "core:c"
|
||||
@@ -111,4 +111,27 @@ when ODIN_OS == .Darwin {
|
||||
IPC_SET :: 1
|
||||
IPC_STAT :: 2
|
||||
|
||||
} else when ODIN_OS == .Haiku {
|
||||
|
||||
key_t :: distinct c.int32_t
|
||||
|
||||
ipc_perm :: struct {
|
||||
key: key_t,
|
||||
uid: uid_t, /* [PSX] owner's user ID */
|
||||
gid: gid_t, /* [PSX] owner's group ID */
|
||||
cuid: uid_t, /* [PSX] creator's user ID */
|
||||
cgid: gid_t, /* [PSX] creator's group ID */
|
||||
mode: mode_t, /* [PSX] read/write perms */
|
||||
}
|
||||
|
||||
IPC_CREAT :: 0o01000
|
||||
IPC_EXCL :: 0o02000
|
||||
IPC_NOWAIT :: 0o04000
|
||||
|
||||
IPC_PRIVATE :: key_t(0)
|
||||
|
||||
IPC_RMID :: 0
|
||||
IPC_SET :: 1
|
||||
IPC_STAT :: 2
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
import "core:c"
|
||||
@@ -171,4 +171,22 @@ when ODIN_OS == .Darwin {
|
||||
__unused: [2]c.ulong,
|
||||
}
|
||||
|
||||
} else when ODIN_OS == .Haiku {
|
||||
|
||||
msgqnum_t :: distinct c.uint32_t
|
||||
msglen_t :: distinct c.uint32_t
|
||||
|
||||
MSG_NOERROR :: 0o10000
|
||||
|
||||
msqid_ds :: struct {
|
||||
msg_perm: ipc_perm, /* [PSX] operation permission structure */
|
||||
msg_qnum: msgqnum_t, /* [PSX] number of messages currently on queue */
|
||||
msg_qbytes: msglen_t, /* [PSX] maximum number of bytes allowed on queue */
|
||||
msg_lspid: pid_t, /* [PSX] process ID of last msgsnd() */
|
||||
msg_lrpid: pid_t, /* [PSX] process ID of last msgrcv() */
|
||||
msg_stime: time_t, /* [PSX] time of last msgsnd() */
|
||||
msg_rtime: time_t, /* [PSX] time of last msgrcv() */
|
||||
msg_ctime: time_t, /* [PSX] time of last change */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
import "core:c"
|
||||
@@ -96,15 +96,26 @@ when ODIN_OS == .NetBSD {
|
||||
@(private) LGETRUSAGE :: "getrusage"
|
||||
}
|
||||
|
||||
when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD || ODIN_OS == .Linux {
|
||||
when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD || ODIN_OS == .Linux || ODIN_OS == .Haiku {
|
||||
|
||||
PRIO_PROCESS :: 0
|
||||
PRIO_PGRP :: 1
|
||||
PRIO_USER :: 2
|
||||
|
||||
rlim_t :: distinct c.uint64_t
|
||||
when ODIN_OS == .Haiku {
|
||||
rlim_t :: distinct c.ulong
|
||||
} else {
|
||||
rlim_t :: distinct c.uint64_t
|
||||
}
|
||||
|
||||
RLIM_INFINITY :: ~rlim_t(0) when ODIN_OS == .Linux else (rlim_t(1) << 63) - 1
|
||||
when ODIN_OS == .Haiku {
|
||||
RLIM_INFINITY :: rlim_t(0xFFFFFFFF)
|
||||
} else when ODIN_OS == .Linux {
|
||||
RLIM_INFINITY :: ~rlim_t(0)
|
||||
} else {
|
||||
RLIM_INFINITY :: (rlim_t(1) << 63) - 1
|
||||
}
|
||||
|
||||
RLIM_SAVED_MAX :: RLIM_INFINITY
|
||||
RLIM_SAVED_CUR :: RLIM_INFINITY
|
||||
|
||||
@@ -140,19 +151,29 @@ when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS
|
||||
ru_nivcsw: c.long, /* involuntary " */
|
||||
}
|
||||
|
||||
RLIMIT_CORE :: 4
|
||||
RLIMIT_CPU :: 0
|
||||
RLIMIT_DATA :: 2
|
||||
RLIMIT_FSIZE :: 1
|
||||
RLIMIT_NOFILE :: 7 when ODIN_OS == .Linux else 8
|
||||
RLIMIT_STACK :: 3
|
||||
|
||||
when ODIN_OS == .Linux {
|
||||
RLIMIT_AS :: 9
|
||||
} else when ODIN_OS == .Darwin || ODIN_OS == .OpenBSD {
|
||||
RLIMIT_AS :: 5
|
||||
when ODIN_OS == .Haiku {
|
||||
RLIMIT_CORE :: 0
|
||||
RLIMIT_CPU :: 1
|
||||
RLIMIT_DATA :: 2
|
||||
RLIMIT_FSIZE :: 3
|
||||
RLIMIT_NOFILE :: 4
|
||||
RLIMIT_STACK :: 5
|
||||
RLIMIT_AS :: 6
|
||||
} else {
|
||||
RLIMIT_AS :: 10
|
||||
RLIMIT_CORE :: 4
|
||||
RLIMIT_CPU :: 0
|
||||
RLIMIT_DATA :: 2
|
||||
RLIMIT_FSIZE :: 1
|
||||
RLIMIT_NOFILE :: 7 when ODIN_OS == .Linux else 8
|
||||
RLIMIT_STACK :: 3
|
||||
|
||||
when ODIN_OS == .Linux {
|
||||
RLIMIT_AS :: 9
|
||||
} else when ODIN_OS == .Darwin || ODIN_OS == .OpenBSD {
|
||||
RLIMIT_AS :: 5
|
||||
} else {
|
||||
RLIMIT_AS :: 10
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
import "base:intrinsics"
|
||||
@@ -56,9 +56,9 @@ when ODIN_OS == .NetBSD {
|
||||
LSELECT :: "select"
|
||||
}
|
||||
|
||||
when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD || ODIN_OS == .Linux {
|
||||
when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD || ODIN_OS == .Linux || ODIN_OS == .Haiku {
|
||||
|
||||
suseconds_t :: distinct (c.int32_t when ODIN_OS == .Darwin || ODIN_OS == .NetBSD else c.long)
|
||||
suseconds_t :: distinct (c.int32_t when ODIN_OS == .Darwin || ODIN_OS == .NetBSD || ODIN_OS == .Haiku else c.long)
|
||||
|
||||
timeval :: struct {
|
||||
tv_sec: time_t, /* [PSX] seconds */
|
||||
@@ -75,8 +75,14 @@ when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS
|
||||
@(private)
|
||||
ALIGN :: align_of(c.long) when ODIN_OS == .FreeBSD || ODIN_OS == .Linux else align_of(c.int32_t)
|
||||
|
||||
fd_set :: struct #align(ALIGN) {
|
||||
fds_bits: [(FD_SETSIZE / __NFDBITS) when (FD_SETSIZE % __NFDBITS) == 0 else (FD_SETSIZE / __NFDBITS) + 1]c.int32_t,
|
||||
when ODIN_OS == .Haiku {
|
||||
fd_set :: struct #align(ALIGN) {
|
||||
fds_bits: [(FD_SETSIZE + (__NFDBITS - 1)) / __NFDBITS]c.int32_t,
|
||||
}
|
||||
} else {
|
||||
fd_set :: struct #align(ALIGN) {
|
||||
fds_bits: [(FD_SETSIZE / __NFDBITS) when (FD_SETSIZE % __NFDBITS) == 0 else (FD_SETSIZE / __NFDBITS) + 1]c.int32_t,
|
||||
}
|
||||
}
|
||||
|
||||
@(private)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
import "core:c"
|
||||
@@ -154,4 +154,30 @@ when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS
|
||||
sem_flg: c.short, /* [PSX] operation flags */
|
||||
}
|
||||
|
||||
} else when ODIN_OS == .Haiku {
|
||||
|
||||
SEM_UNDO :: 10 // undo the operation on exit
|
||||
|
||||
// Commands for `semctl'.
|
||||
GETPID :: 3
|
||||
GETVAL :: 4
|
||||
GETALL :: 5
|
||||
GETNCNT :: 6
|
||||
GETZCNT :: 7
|
||||
SETVAL :: 8
|
||||
SETALL :: 9
|
||||
|
||||
semid_ds :: struct {
|
||||
sem_perm: ipc_perm, // [PSX] operation permission structure
|
||||
sem_nsems: c.ushort, // [PSX] number of semaphores in set
|
||||
sem_otime: time_t, // [PSX] last semop()
|
||||
sem_ctime: time_t, // [PSX] last time changed by semctl()
|
||||
}
|
||||
|
||||
sembuf :: struct {
|
||||
sem_num: c.ushort, /* [PSX] semaphore number */
|
||||
sem_op: c.short, /* [PSX] semaphore operation */
|
||||
sem_flg: c.short, /* [PSX] operation flags */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
import "core:c"
|
||||
@@ -328,24 +328,32 @@ when ODIN_OS == .NetBSD {
|
||||
@(private) LSOCKET :: "socket"
|
||||
}
|
||||
|
||||
when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD || ODIN_OS == .Linux {
|
||||
when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD || ODIN_OS == .Linux || ODIN_OS == .Haiku {
|
||||
|
||||
socklen_t :: distinct c.uint
|
||||
|
||||
when ODIN_OS == .Haiku {
|
||||
@(private)
|
||||
_SA_DATASIZE :: 30
|
||||
} else {
|
||||
@(private)
|
||||
_SA_DATASIZE :: 14
|
||||
}
|
||||
|
||||
when ODIN_OS == .Linux {
|
||||
_sa_family_t :: distinct c.ushort
|
||||
|
||||
sockaddr :: struct {
|
||||
sa_family: sa_family_t, /* [PSX] address family */
|
||||
sa_data: [14]c.char, /* [PSX] socket address */
|
||||
sa_family: sa_family_t, /* [PSX] address family */
|
||||
sa_data: [_SA_DATASIZE]c.char, /* [PSX] socket address */
|
||||
}
|
||||
} else {
|
||||
_sa_family_t :: distinct c.uint8_t
|
||||
|
||||
sockaddr :: struct {
|
||||
sa_len: c.uint8_t, /* total length */
|
||||
sa_family: sa_family_t, /* [PSX] address family */
|
||||
sa_data: [14]c.char, /* [PSX] socket address */
|
||||
sa_len: c.uint8_t, /* total length */
|
||||
sa_family: sa_family_t, /* [PSX] address family */
|
||||
sa_data: [_SA_DATASIZE]c.char, /* [PSX] socket address */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -355,6 +363,11 @@ when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS
|
||||
_SS_PAD1SIZE :: 6
|
||||
@(private)
|
||||
_SS_PAD2SIZE :: 240
|
||||
} else when ODIN_OS == .Haiku {
|
||||
@(private)
|
||||
_SS_PAD1SIZE :: 6
|
||||
@(private)
|
||||
_SS_PAD2SIZE :: 112
|
||||
} else when ODIN_OS == .Linux {
|
||||
@(private)
|
||||
_SS_SIZE :: 128
|
||||
@@ -486,6 +499,26 @@ when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS
|
||||
|
||||
SO_RCVTIMEO :: 66
|
||||
SO_SNDTIMEO :: 67
|
||||
} else when ODIN_OS == .Haiku {
|
||||
SOL_SOCKET :: -1
|
||||
|
||||
SO_ACCEPTCONN :: 0x00000001
|
||||
SO_BROADCAST :: 0x00000002
|
||||
SO_DEBUG :: 0x00000004
|
||||
SO_DONTROUTE :: 0x00000008
|
||||
SO_ERROR :: 0x40000007
|
||||
SO_KEEPALIVE :: 0x00000010
|
||||
SO_OOBINLINE :: 0x00000020
|
||||
SO_RCVBUF :: 0x40000004
|
||||
SO_RCVLOWAT :: 0x40000005
|
||||
SO_REUSEADDR :: 0x00000040
|
||||
SO_SNDBUF :: 0x40000001
|
||||
SO_SNDLOWAT :: 0x40000002
|
||||
SO_TYPE :: 0x40000008
|
||||
|
||||
SO_LINGER :: 0x00000200
|
||||
SO_RCVTIMEO :: 0x40000006
|
||||
SO_SNDTIMEO :: 0x40000003
|
||||
} else {
|
||||
SOL_SOCKET :: 0xffff
|
||||
|
||||
@@ -523,7 +556,11 @@ when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS
|
||||
}
|
||||
|
||||
// The maximum backlog queue length for listen().
|
||||
SOMAXCONN :: 128
|
||||
when ODIN_OS == .Haiku {
|
||||
SOMAXCONN :: 32
|
||||
} else {
|
||||
SOMAXCONN :: 128
|
||||
}
|
||||
|
||||
when ODIN_OS == .Linux {
|
||||
MSG_CTRUNC :: 0x008
|
||||
@@ -549,11 +586,18 @@ when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS
|
||||
MSG_NOSIGNAL :: 0x00020000
|
||||
} else when ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD {
|
||||
MSG_NOSIGNAL :: 0x0400
|
||||
} else when ODIN_OS == .Haiku {
|
||||
MSG_NOSIGNAL :: 0x800
|
||||
}
|
||||
}
|
||||
|
||||
AF_INET :: 2
|
||||
AF_UNIX :: 1
|
||||
when ODIN_OS == .Haiku {
|
||||
AF_INET :: 1
|
||||
AF_UNIX :: 9
|
||||
} else {
|
||||
AF_INET :: 2
|
||||
AF_UNIX :: 1
|
||||
}
|
||||
|
||||
when ODIN_OS == .Darwin {
|
||||
AF_INET6 :: 30
|
||||
@@ -563,6 +607,8 @@ when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS
|
||||
AF_INET6 :: 24
|
||||
} else when ODIN_OS == .Linux {
|
||||
AF_INET6 :: 10
|
||||
} else when ODIN_OS == .Haiku {
|
||||
AF_INET6 :: 5
|
||||
}
|
||||
|
||||
SHUT_RD :: 0
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
import "core:c"
|
||||
@@ -428,6 +428,36 @@ when ODIN_OS == .Darwin {
|
||||
UTIME_NOW :: -2
|
||||
UTIME_OMIT :: -1
|
||||
|
||||
} else when ODIN_OS == .Haiku {
|
||||
|
||||
dev_t :: distinct c.int32_t
|
||||
nlink_t :: distinct c.int32_t
|
||||
_mode_t :: distinct c.uint32_t
|
||||
blkcnt_t :: distinct c.int64_t
|
||||
blksize_t :: distinct c.int32_t
|
||||
ino_t :: distinct c.int64_t
|
||||
|
||||
stat_t :: struct {
|
||||
st_dev: dev_t, /* [PSX] ID of device containing file */
|
||||
st_ino: ino_t, /* [PSX] file serial number */
|
||||
st_mode: mode_t, /* [PSX] mode of file */
|
||||
st_nlink: nlink_t, /* [PSX] number of hard links */
|
||||
st_uid: uid_t, /* [PSX] user ID of the file */
|
||||
st_gid: gid_t, /* [PSX] group ID of the file */
|
||||
st_size: off_t, /* [PSX] file size, in bytes */
|
||||
st_rdev: dev_t, /* [PSX] device ID */
|
||||
st_blksize: blksize_t, /* [PSX] optimal blocksize for I/O */
|
||||
st_atim: timespec, /* [PSX] time of last access */
|
||||
st_mtim: timespec, /* [PSX] time of last data modification */
|
||||
st_ctim: timespec, /* [PSX] time of last status change */
|
||||
st_crtim: timespec, /* [PSX] time of last status change */
|
||||
st_type: c.uint32_t,
|
||||
st_blocks: blkcnt_t, /* [PSX] blocks allocated for file */
|
||||
}
|
||||
|
||||
UTIME_NOW :: 1000000000
|
||||
UTIME_OMIT :: 1000000001
|
||||
|
||||
} else when ODIN_OS == .Linux {
|
||||
|
||||
dev_t :: distinct u64
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
import "core:c"
|
||||
@@ -78,4 +78,15 @@ when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS
|
||||
ITIMER_VIRTUAL :: 1
|
||||
ITIMER_PROF :: 2
|
||||
|
||||
} else when ODIN_OS == .Haiku {
|
||||
|
||||
itimerval :: struct {
|
||||
it_interval: timeval, /* [PSX] timer interval */
|
||||
it_value: timeval, /* [PSX] current value */
|
||||
}
|
||||
|
||||
ITIMER_REAL :: 1
|
||||
ITIMER_VIRTUAL :: 2
|
||||
ITIMER_PROF :: 3
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
when ODIN_OS == .Darwin {
|
||||
@@ -25,7 +25,7 @@ when ODIN_OS == .NetBSD {
|
||||
@(private) LTIMES :: "times"
|
||||
}
|
||||
|
||||
when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD || ODIN_OS == .Linux {
|
||||
when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD || ODIN_OS == .Linux || ODIN_OS == .Haiku {
|
||||
|
||||
tms :: struct {
|
||||
tms_utime: clock_t, /* [PSX] user CPU time */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
import "core:c"
|
||||
@@ -31,7 +31,7 @@ foreign libc {
|
||||
writev :: proc(fildes: FD, iov: [^]iovec, iovcnt: c.int) -> c.ssize_t ---
|
||||
}
|
||||
|
||||
when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD || ODIN_OS == .Linux {
|
||||
when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD || ODIN_OS == .Linux || ODIN_OS == .Haiku {
|
||||
|
||||
iovec :: struct {
|
||||
iov_base: rawptr, /* [PSX] base address of I/O memory region */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
import "core:c"
|
||||
@@ -20,4 +20,12 @@ when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS
|
||||
sun_path: [108]c.char, /* [PSX] socket pathname */
|
||||
}
|
||||
|
||||
} else when ODIN_OS == .Haiku {
|
||||
|
||||
sockaddr_un :: struct {
|
||||
sun_len: c.uint8_t,
|
||||
sun_family: sa_family_t, /* [PSX] address family */
|
||||
sun_path: [126]c.char, /* [PSX] socket pathname */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
import "core:c"
|
||||
@@ -38,10 +38,10 @@ foreign lib {
|
||||
uname :: proc(uname: ^utsname) -> c.int ---
|
||||
}
|
||||
|
||||
when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD {
|
||||
when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD || ODIN_OS == .Haiku {
|
||||
|
||||
@(private)
|
||||
_SYS_NAMELEN :: 256
|
||||
_SYS_NAMELEN :: 32 when ODIN_OS == .Haiku else 256
|
||||
|
||||
utsname :: struct {
|
||||
sysname: [_SYS_NAMELEN]c.char `fmt:"s,0"`, /* [PSX] name of OS */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
import "core:c"
|
||||
@@ -442,4 +442,56 @@ when ODIN_OS == .Darwin {
|
||||
_WIFCONTINUED :: #force_inline proc "contextless" (x: c.int) -> bool {
|
||||
return x == 0xffff
|
||||
}
|
||||
|
||||
} else when ODIN_OS == .Haiku {
|
||||
|
||||
id_t :: distinct c.int32_t
|
||||
|
||||
WCONTINUED :: 0x04
|
||||
WNOHANG :: 0x01
|
||||
WUNTRACED :: 0x02
|
||||
|
||||
WEXITED :: 0x08
|
||||
WNOWAIT :: 0x20
|
||||
WSTOPPED :: 0x10
|
||||
|
||||
_P_ALL :: 0
|
||||
_P_PID :: 1
|
||||
_P_PGID :: 2
|
||||
|
||||
@(private)
|
||||
_WIFEXITED :: #force_inline proc "contextless" (x: c.int) -> bool {
|
||||
return (x & ~(c.int)(0xff)) == 0
|
||||
}
|
||||
|
||||
@(private)
|
||||
_WEXITSTATUS :: #force_inline proc "contextless" (x: c.int) -> c.int {
|
||||
return x & 0xff
|
||||
}
|
||||
|
||||
@(private)
|
||||
_WIFSIGNALED :: #force_inline proc "contextless" (x: c.int) -> bool {
|
||||
return ((x >> 8) & 0xff) != 0
|
||||
}
|
||||
|
||||
@(private)
|
||||
_WTERMSIG :: #force_inline proc "contextless" (x: c.int) -> Signal {
|
||||
return Signal((x >> 8) & 0xff)
|
||||
}
|
||||
|
||||
@(private)
|
||||
_WIFSTOPPED :: #force_inline proc "contextless" (x: c.int) -> bool {
|
||||
return ((x >> 16) & 0xff) != 0
|
||||
}
|
||||
|
||||
@(private)
|
||||
_WSTOPSIG :: #force_inline proc "contextless" (x: c.int) -> Signal {
|
||||
return Signal((x >> 16) & 0xff)
|
||||
}
|
||||
|
||||
@(private)
|
||||
_WIFCONTINUED :: #force_inline proc "contextless" (x: c.int) -> bool {
|
||||
return (x & 0x20000) != 0
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+172
-12
@@ -1,4 +1,4 @@
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
import "core:c"
|
||||
@@ -138,17 +138,30 @@ CLocal_Flag_Bits :: enum tcflag_t {
|
||||
}
|
||||
CLocal_Flags :: bit_set[CLocal_Flag_Bits; tcflag_t]
|
||||
|
||||
CControl_Flag_Bits :: enum tcflag_t {
|
||||
// CS5 = log2(CS5), /* 5 bits (pseudo) (default) */
|
||||
CS6 = log2(CS6), /* 6 bits */
|
||||
CS7 = log2(CS7), /* 7 bits */
|
||||
CS8 = log2(CS8), /* 8 bits */
|
||||
CSTOPB = log2(CSTOPB), /* send 2 stop bits */
|
||||
CREAD = log2(CREAD), /* enable receiver */
|
||||
PARENB = log2(PARENB), /* parity enable */
|
||||
PARODD = log2(PARODD), /* odd parity, else even */
|
||||
HUPCL = log2(HUPCL), /* hang up on last close */
|
||||
CLOCAL = log2(CLOCAL), /* ignore modem status lines */
|
||||
when ODIN_OS == .Haiku {
|
||||
CControl_Flag_Bits :: enum tcflag_t {
|
||||
// CS7 = log2(CS7), /* 7 bits (default) */
|
||||
CS8 = log2(CS8), /* 8 bits */
|
||||
CSTOPB = log2(CSTOPB), /* send 2 stop bits */
|
||||
CREAD = log2(CREAD), /* enable receiver */
|
||||
PARENB = log2(PARENB), /* parity enable */
|
||||
PARODD = log2(PARODD), /* odd parity, else even */
|
||||
HUPCL = log2(HUPCL), /* hang up on last close */
|
||||
CLOCAL = log2(CLOCAL), /* ignore modem status lines */
|
||||
}
|
||||
} else {
|
||||
CControl_Flag_Bits :: enum tcflag_t {
|
||||
// CS5 = log2(CS5), /* 5 bits (pseudo) (default) */
|
||||
CS6 = log2(CS6), /* 6 bits */
|
||||
CS7 = log2(CS7), /* 7 bits */
|
||||
CS8 = log2(CS8), /* 8 bits */
|
||||
CSTOPB = log2(CSTOPB), /* send 2 stop bits */
|
||||
CREAD = log2(CREAD), /* enable receiver */
|
||||
PARENB = log2(PARENB), /* parity enable */
|
||||
PARODD = log2(PARODD), /* odd parity, else even */
|
||||
HUPCL = log2(HUPCL), /* hang up on last close */
|
||||
CLOCAL = log2(CLOCAL), /* ignore modem status lines */
|
||||
}
|
||||
}
|
||||
CControl_Flags :: bit_set[CControl_Flag_Bits; tcflag_t]
|
||||
|
||||
@@ -597,4 +610,151 @@ when ODIN_OS == .Darwin {
|
||||
TCOOFF :: 0
|
||||
TCOON :: 1
|
||||
|
||||
} else when ODIN_OS == .Haiku {
|
||||
|
||||
cc_t :: distinct c.uchar
|
||||
_speed_t :: distinct c.uint32_t
|
||||
tcflag_t :: distinct c.uint16_t
|
||||
|
||||
// Same as speed_t, but 16-bit.
|
||||
CSpeed :: enum tcflag_t {
|
||||
B0 = B0,
|
||||
B50 = B50,
|
||||
B75 = B75,
|
||||
B110 = B110,
|
||||
B134 = B134,
|
||||
B150 = B150,
|
||||
B200 = B200,
|
||||
B300 = B300,
|
||||
B600 = B600,
|
||||
B1200 = B1200,
|
||||
B1800 = B1800,
|
||||
B2400 = B2400,
|
||||
B4800 = B4800,
|
||||
B9600 = B9600,
|
||||
B19200 = B19200,
|
||||
B38400 = B38400,
|
||||
}
|
||||
|
||||
termios :: struct {
|
||||
c_iflag: CInput_Flags, /* [XBD] input flags */
|
||||
c_ispeed: CSpeed, /* input speed */
|
||||
c_oflag: COutput_Flags, /* [XBD] output flags */
|
||||
c_ospeed: CSpeed, /* output speed */
|
||||
c_cflag: CControl_Flags, /* [XBD] control flags */
|
||||
c_ispeed_high: tcflag_t, /* high word of input baudrate */
|
||||
c_lflag: CLocal_Flags, /* [XBD] local flag */
|
||||
c_ospeed_high: tcflag_t, /* high word of output baudrate */
|
||||
c_line: c.char,
|
||||
_padding: c.uchar,
|
||||
_padding2: c.uchar,
|
||||
c_cc: [NCCS]cc_t,
|
||||
}
|
||||
|
||||
NCCS :: 11
|
||||
|
||||
VINTR :: 0
|
||||
VQUIT :: 1
|
||||
VERASE :: 2
|
||||
VKILL :: 3
|
||||
VEOF :: 4
|
||||
VEOL :: 5
|
||||
VMIN :: 4
|
||||
VTIME :: 5
|
||||
VEOL2 :: 6
|
||||
VSWTCH :: 7
|
||||
VSTART :: 8
|
||||
VSTOP :: 9
|
||||
VSUSP :: 10
|
||||
|
||||
IGNBRK :: 0x01 /* ignore break condition */
|
||||
BRKINT :: 0x02 /* break sends interrupt */
|
||||
IGNPAR :: 0x04 /* ignore characters with parity errors */
|
||||
PARMRK :: 0x08 /* mark parity errors */
|
||||
INPCK :: 0x10 /* enable input parity checking */
|
||||
ISTRIP :: 0x20 /* strip high bit from characters */
|
||||
INLCR :: 0x40 /* maps newline to CR on input */
|
||||
IGNCR :: 0x80 /* ignore carriage returns */
|
||||
ICRNL :: 0x100 /* map CR to newline on input */
|
||||
IXON :: 0x400 /* enable input SW flow control */
|
||||
IXANY :: 0x800 /* any character will restart input */
|
||||
IXOFF :: 0x1000 /* enable output SW flow control */
|
||||
|
||||
OPOST :: 0x01 /* enable postprocessing of output */
|
||||
ONLCR :: 0x04 /* map NL to CR-NL on output */
|
||||
OCRNL :: 0x08 /* map CR to NL on output */
|
||||
ONOCR :: 0x10 /* no CR output when at column 0 */
|
||||
ONLRET :: 0x20 /* newline performs CR function */
|
||||
OFILL :: 0x40 /* use fill characters for delays */
|
||||
OFDEL :: 0x80 /* Fills are DEL, otherwise NUL */
|
||||
_NLDLY :: 0x100 /* Newline delays: */
|
||||
NL0 :: 0x000
|
||||
NL1 :: 0x100
|
||||
_CRDLY :: 0x600 /* Carriage return delays: */
|
||||
CR0 :: 0x000
|
||||
CR1 :: 0x200
|
||||
CR2 :: 0x400
|
||||
CR3 :: 0x600
|
||||
_TABDLY :: 0x1800 /* Tab delays: */
|
||||
TAB0 :: 0x0000
|
||||
TAB1 :: 0x0800
|
||||
TAB3 :: 0x1800
|
||||
_BSDLY :: 0x2000 /* Backspace delays: */
|
||||
BS0 :: 0x0000
|
||||
BS1 :: 0x2000
|
||||
_VTDLY :: 0x4000 /* Vertical tab delays: */
|
||||
VT0 :: 0x0000
|
||||
VT1 :: 0x4000
|
||||
_FFDLY :: 0x8000 /* Form feed delays: */
|
||||
FF0 :: 0x0000
|
||||
FF1 :: 0x8000
|
||||
|
||||
B0 :: 0x00 /* hang up */
|
||||
B50 :: 0x01 /* 50 baud */
|
||||
B75 :: 0x02
|
||||
B110 :: 0x03
|
||||
B134 :: 0x04
|
||||
B150 :: 0x05
|
||||
B200 :: 0x06
|
||||
B300 :: 0x07
|
||||
B600 :: 0x08
|
||||
B1200 :: 0x09
|
||||
B1800 :: 0x0A
|
||||
B2400 :: 0x0B
|
||||
B4800 :: 0x0C
|
||||
B9600 :: 0x0D
|
||||
B19200 :: 0x0E
|
||||
B38400 :: 0x0F
|
||||
|
||||
_CSIZE :: 0x20 /* character size */
|
||||
//CS5 :: 0x00 /* only 7 and 8 bits supported */
|
||||
//CS6 :: 0x00 /* Note, it was not very wise to set all of these */
|
||||
//CS7 :: 0x00 /* to zero, but there is not much we can do about it*/
|
||||
CS8 :: 0x20
|
||||
CSTOPB :: 0x40 /* send 2 stop bits, not 1 */
|
||||
CREAD :: 0x80 /* enable receiver */
|
||||
PARENB :: 0x100 /* parity enable */
|
||||
PARODD :: 0x200 /* odd parity, else even */
|
||||
HUPCL :: 0x400 /* hangs up on last close */
|
||||
CLOCAL :: 0x800 /* indicates local line */
|
||||
|
||||
ISIG :: 0x01 /* enable signals */
|
||||
ICANON :: 0x02 /* Canonical input */
|
||||
ECHO :: 0x08 /* Enable echo */
|
||||
ECHOE :: 0x10 /* Echo erase as bs-sp-bs */
|
||||
ECHOK :: 0x20 /* Echo nl after kill */
|
||||
ECHONL :: 0x40 /* Echo nl */
|
||||
NOFLSH :: 0x80 /* Disable flush after int or quit */
|
||||
TOSTOP :: 0x100 /* stop bg processes that write to tty */
|
||||
IEXTEN :: 0x200 /* implementation defined extensions */
|
||||
|
||||
TCIFLUSH :: 1
|
||||
TCOFLUSH :: 2
|
||||
TCIOFLUSH :: 3
|
||||
|
||||
TCIOFF :: 0x04
|
||||
TCION :: 0x08
|
||||
TCOOFF :: 0x01
|
||||
TCOON :: 0x02
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
import "core:c"
|
||||
@@ -230,6 +230,17 @@ when ODIN_OS == .Darwin {
|
||||
|
||||
getdate_err: Errno = .ENOSYS // NOTE: looks like it's not a thing on OpenBSD.
|
||||
|
||||
} else when ODIN_OS == .Haiku {
|
||||
|
||||
clockid_t :: distinct c.int32_t
|
||||
|
||||
CLOCK_MONOTONIC :: 0
|
||||
CLOCK_PROCESS_CPUTIME_ID :: -2
|
||||
CLOCK_REALTIME :: -1
|
||||
CLOCK_THREAD_CPUTIME_ID :: -3
|
||||
|
||||
getdate_err: Errno = .ENOSYS // NOTE: looks like it's not a thing on Haiku.
|
||||
|
||||
} else when ODIN_OS == .Linux {
|
||||
|
||||
clockid_t :: distinct c.int
|
||||
|
||||
+381
-171
@@ -1,4 +1,4 @@
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
import "core:c"
|
||||
@@ -899,7 +899,7 @@ CS :: enum c.int {
|
||||
}
|
||||
|
||||
PC :: enum c.int {
|
||||
_2_SYMLINK = _PC_2_SYMLINK,
|
||||
_2_SYMLINKS = _PC_2_SYMLINKS,
|
||||
_ALLOC_SIZE_MIN = _PC_ALLOC_SIZE_MIN,
|
||||
_ASYNC_IO = _PC_ASYNC_IO,
|
||||
_CHOWN_RESTRICTED = _PC_CHOWN_RESTRICTED,
|
||||
@@ -1099,7 +1099,7 @@ when ODIN_OS == .Darwin {
|
||||
_PC_CHOWN_RESTRICTED :: 7
|
||||
_PC_NO_TRUNC :: 8
|
||||
_PC_VDISABLE :: 9
|
||||
_PC_2_SYMLINK :: 15
|
||||
_PC_2_SYMLINKS :: 15
|
||||
_PC_ALLOC_SIZE_MIN :: 16
|
||||
_PC_ASYNC_IO :: 17
|
||||
_PC_FILESIZEBITS :: 18
|
||||
@@ -1280,7 +1280,7 @@ when ODIN_OS == .Darwin {
|
||||
_PC_CHOWN_RESTRICTED :: 7
|
||||
_PC_NO_TRUNC :: 8
|
||||
_PC_VDISABLE :: 9
|
||||
_PC_2_SYMLINK :: 13 // NOTE: not in headers (freebsd)
|
||||
_PC_2_SYMLINKS :: 13 // NOTE: not in headers (freebsd)
|
||||
_PC_ALLOC_SIZE_MIN :: 10
|
||||
_PC_ASYNC_IO :: 53
|
||||
_PC_FILESIZEBITS :: 12
|
||||
@@ -1461,7 +1461,7 @@ when ODIN_OS == .Darwin {
|
||||
_PC_CHOWN_RESTRICTED :: 7
|
||||
_PC_NO_TRUNC :: 8
|
||||
_PC_VDISABLE :: 9
|
||||
_PC_2_SYMLINK :: 13 // NOTE: not in headers
|
||||
_PC_2_SYMLINKS :: 13 // NOTE: not in headers
|
||||
_PC_ALLOC_SIZE_MIN :: 10 // NOTE: not in headers
|
||||
_PC_ASYNC_IO :: 53 // NOTE: not in headers
|
||||
_PC_FILESIZEBITS :: 11
|
||||
@@ -1646,7 +1646,7 @@ when ODIN_OS == .Darwin {
|
||||
_PC_CHOWN_RESTRICTED :: 7
|
||||
_PC_NO_TRUNC :: 8
|
||||
_PC_VDISABLE :: 9
|
||||
_PC_2_SYMLINK :: 10
|
||||
_PC_2_SYMLINKS :: 10
|
||||
_PC_ALLOC_SIZE_MIN :: 11
|
||||
_PC_ASYNC_IO :: 12
|
||||
_PC_FILESIZEBITS :: 13
|
||||
@@ -1816,180 +1816,390 @@ when ODIN_OS == .Darwin {
|
||||
F_TLOCK :: 2
|
||||
F_ULOCK :: 0
|
||||
|
||||
_CS_PATH :: 1
|
||||
_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS :: 2
|
||||
_CS_PATH :: 0
|
||||
_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS :: 1
|
||||
_CS_GNU_LIBC_VERSION :: 2
|
||||
_CS_GNU_LIBPTHREAD_VERSION :: 3
|
||||
_CS_POSIX_V5_WIDTH_RESTRICTED_ENVS :: 4
|
||||
_CS_POSIX_V7_WIDTH_RESTRICTED_ENVS :: 5
|
||||
|
||||
_CS_POSIX_V6_ILP32_OFF32_CFLAGS :: 1116
|
||||
_CS_POSIX_V6_ILP32_OFF32_LDFLAGS :: 1117
|
||||
_CS_POSIX_V6_ILP32_OFF32_LIBS :: 1118
|
||||
_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS :: 1120
|
||||
_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS :: 1121
|
||||
_CS_POSIX_V6_ILP32_OFFBIG_LIBS :: 1122
|
||||
_CS_POSIX_V6_LP64_OFF64_CFLAGS :: 1124
|
||||
_CS_POSIX_V6_LP64_OFF64_LDFLAGS :: 1125
|
||||
_CS_POSIX_V6_LP64_OFF64_LIBS :: 1126
|
||||
_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS :: 1128
|
||||
_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS :: 1129
|
||||
_CS_POSIX_V6_LPBIG_OFFBIG_LIBS :: 1130
|
||||
_CS_POSIX_V6_ILP32_OFF32_CFLAGS :: 1116
|
||||
_CS_POSIX_V6_ILP32_OFF32_LDFLAGS :: 1117
|
||||
_CS_POSIX_V6_ILP32_OFF32_LIBS :: 1118
|
||||
_CS_POSIX_V6_ILP32_OFF32_LINTFLAGS :: 1119
|
||||
_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS :: 1120
|
||||
_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS :: 1121
|
||||
_CS_POSIX_V6_ILP32_OFFBIG_LIBS :: 1122
|
||||
_CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS :: 1123
|
||||
_CS_POSIX_V6_LP64_OFF64_CFLAGS :: 1124
|
||||
_CS_POSIX_V6_LP64_OFF64_LDFLAGS :: 1125
|
||||
_CS_POSIX_V6_LP64_OFF64_LIBS :: 1126
|
||||
_CS_POSIX_V6_LP64_OFF64_LINTFLAGS :: 1127
|
||||
_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS :: 1128
|
||||
_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS :: 1129
|
||||
_CS_POSIX_V6_LPBIG_OFFBIG_LIBS :: 1130
|
||||
_CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS :: 1131
|
||||
_CS_POSIX_V7_ILP32_OFF32_CFLAGS :: 1132
|
||||
_CS_POSIX_V7_ILP32_OFF32_LDFLAGS :: 1133
|
||||
_CS_POSIX_V7_ILP32_OFF32_LIBS :: 1134
|
||||
_CS_POSIX_V7_ILP32_OFF32_LINTFLAGS :: 1135
|
||||
_CS_POSIX_V7_ILP32_OFFBIG_CFLAGS :: 1136
|
||||
_CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS :: 1137
|
||||
_CS_POSIX_V7_ILP32_OFFBIG_LIBS :: 1138
|
||||
_CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS :: 1139
|
||||
_CS_POSIX_V7_LP64_OFF64_CFLAGS :: 1140
|
||||
_CS_POSIX_V7_LP64_OFF64_LDFLAGS :: 1141
|
||||
_CS_POSIX_V7_LP64_OFF64_LIBS :: 1142
|
||||
_CS_POSIX_V7_LP64_OFF64_LINTFLAGS :: 1143
|
||||
_CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS :: 1144
|
||||
_CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS :: 1145
|
||||
_CS_POSIX_V7_LPBIG_OFFBIG_LIBS :: 1146
|
||||
_CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS :: 1147
|
||||
_CS_V6_ENV :: 1148
|
||||
_CS_V7_ENV :: 1149
|
||||
_CS_POSIX_V7_THREADS_CFLAGS :: 1150
|
||||
_CS_POSIX_V7_THREADS_LDFLAGS :: 1151
|
||||
|
||||
_PC_LINK_MAX :: 1
|
||||
_PC_MAX_CANON :: 2
|
||||
_PC_MAX_INPUT :: 3
|
||||
_PC_NAME_MAX :: 4
|
||||
_PC_PATH_MAX :: 5
|
||||
_PC_PIPE_BUF :: 6
|
||||
_PC_CHOWN_RESTRICTED :: 7
|
||||
_PC_NO_TRUNC :: 8
|
||||
_PC_VDISABLE :: 9
|
||||
_PC_SYNC_IO :: 10
|
||||
_PC_ASYNC_IO :: 11
|
||||
_PC_PRIO_IO :: 12
|
||||
_PC_FILESIZEBITS :: 14
|
||||
_PC_REC_INCR_XFER_SIZE :: 15
|
||||
_PC_REC_MAX_XFER_SIZE :: 16
|
||||
_PC_REC_MIN_XFER_SIZE :: 17
|
||||
_PC_REC_XFER_ALIGN :: 18
|
||||
_PC_ALLOC_SIZE_MIN :: 19
|
||||
_PC_SYMLINK_MAX :: 20
|
||||
_PC_2_SYMLINK :: 21
|
||||
_PC_LINK_MAX :: 0
|
||||
_PC_MAX_CANON :: 1
|
||||
_PC_MAX_INPUT :: 2
|
||||
_PC_NAME_MAX :: 3
|
||||
_PC_PATH_MAX :: 4
|
||||
_PC_PIPE_BUF :: 5
|
||||
_PC_CHOWN_RESTRICTED :: 6
|
||||
_PC_NO_TRUNC :: 7
|
||||
_PC_VDISABLE :: 8
|
||||
_PC_SYNC_IO :: 9
|
||||
_PC_ASYNC_IO :: 10
|
||||
_PC_PRIO_IO :: 11
|
||||
_PC_SOCK_MAXBUF :: 12
|
||||
_PC_FILESIZEBITS :: 13
|
||||
_PC_REC_INCR_XFER_SIZE :: 14
|
||||
_PC_REC_MAX_XFER_SIZE :: 15
|
||||
_PC_REC_MIN_XFER_SIZE :: 16
|
||||
_PC_REC_XFER_ALIGN :: 17
|
||||
_PC_ALLOC_SIZE_MIN :: 18
|
||||
_PC_SYMLINK_MAX :: 19
|
||||
_PC_2_SYMLINKS :: 20
|
||||
|
||||
_SC_ARG_MAX :: 1
|
||||
_SC_CHILD_MAX :: 2
|
||||
_SC_CLK_TCK :: 3
|
||||
_SC_NGROUPS_MAX :: 4
|
||||
_SC_OPEN_MAX :: 5
|
||||
_SC_STREAM_MAX :: 6
|
||||
_SC_TZNAME_MAX :: 7
|
||||
_SC_JOB_CONTROL :: 8
|
||||
_SC_SAVED_IDS :: 9
|
||||
_SC_REALTIME_SIGNALS :: 10
|
||||
_SC_PRIORITY_SCHEDULING :: 11
|
||||
_SC_TIMERS :: 12
|
||||
_SC_ASYNCHRONOUS_IO :: 13
|
||||
_SC_PRIORITIZED_IO :: 14
|
||||
_SC_SYNCHRONIZED_IO :: 15
|
||||
_SC_FSYNC :: 16
|
||||
_SC_MAPPED_FILES :: 17
|
||||
_SC_MEMLOCK :: 18
|
||||
_SC_MEMLOCK_RANGE :: 19
|
||||
_SC_MEMORY_PROTECTION :: 20
|
||||
_SC_MESSAGE_PASSING :: 21
|
||||
_SC_SEMAPHORES :: 22
|
||||
_SC_SHARED_MEMORY_OBJECTS :: 23
|
||||
_SC_AIO_LISTIO_MAX :: 24
|
||||
_SC_AIO_MAX :: 25
|
||||
_SC_AIO_PRIO_DELTA_MAX :: 26
|
||||
_SC_DELAYTIMER_MAX :: 27
|
||||
_SC_MQ_OPEN_MAX :: 28
|
||||
_SC_MQ_PRIO_MAX :: 29
|
||||
_SC_VERSION :: 30
|
||||
_SC_PAGESIZE :: 31
|
||||
_SC_PAGE_SIZE :: _SC_PAGESIZE
|
||||
_SC_RTSIG_MAX :: 32
|
||||
_SC_SEM_NSEMS_MAX :: 33
|
||||
_SC_SEM_VALUE_MAX :: 34
|
||||
_SC_SIGQUEUE_MAX :: 35
|
||||
_SC_TIMER_MAX :: 36
|
||||
_SC_BC_BASE_MAX :: 37
|
||||
_SC_BC_DIM_MAX :: 38
|
||||
_SC_BC_SCALE_MAX :: 39
|
||||
_SC_BC_STRING_MAX :: 40
|
||||
_SC_COLL_WEIGHTS_MAX :: 41
|
||||
_SC_EXPR_NEST_MAX :: 43
|
||||
_SC_LINE_MAX :: 44
|
||||
_SC_RE_DUP_MAX :: 45
|
||||
_SC_2_VERSION :: 47
|
||||
_SC_2_C_BIND :: 48
|
||||
_SC_2_C_DEV :: 49
|
||||
_SC_2_FORT_DEV :: 50
|
||||
_SC_2_FORT_RUN :: 51
|
||||
_SC_2_SW_DEV :: 52
|
||||
_SC_2_LOCALEDEF :: 53
|
||||
|
||||
_SC_IOV_MAX :: 62
|
||||
_SC_THREADS :: 69
|
||||
_SC_THREAD_SAFE_FUNCTIONS :: 70
|
||||
_SC_GETGR_R_SIZE_MAX :: 71
|
||||
_SC_GETPW_R_SIZE_MAX :: 72
|
||||
_SC_LOGIN_NAME_MAX :: 73
|
||||
_SC_TTY_NAME_MAX :: 74
|
||||
_SC_THREAD_DESTRUCTOR_ITERATIONS :: 75
|
||||
_SC_THREAD_KEYS_MAX :: 76
|
||||
_SC_THREAD_STACK_MIN :: 77
|
||||
_SC_THREAD_THREADS_MAX :: 78
|
||||
_SC_THREAD_ATTR_STACKADDR :: 79
|
||||
_SC_THREAD_ATTR_STACKSIZE :: 80
|
||||
_SC_THREAD_PRIORITY_SCHEDULING :: 81
|
||||
_SC_THREAD_PRIO_INHERIT :: 82
|
||||
_SC_THREAD_PRIO_PROTECT :: 83
|
||||
_SC_THREAD_PROCESS_SHARED :: 84
|
||||
_SC_NPROCESSORS_CONF :: 85
|
||||
_SC_NPROCESSORS_ONLN :: 86
|
||||
_SC_PHYS_PAGES :: 87
|
||||
_SC_AVPHYS_PAGES :: 88
|
||||
_SC_ATEXIT_MAX :: 89
|
||||
_SC_PASS_MAX :: 90
|
||||
_SC_XOPEN_VERSION :: 91
|
||||
_SC_XOPEN_UNIX :: 92
|
||||
_SC_XOPEN_CRYPT :: 93
|
||||
_SC_XOPEN_ENH_I18N :: 94
|
||||
_SC_XOPEN_SHM :: 95
|
||||
_SC_2_CHAR_TERM :: 96
|
||||
_SC_ARG_MAX :: 0
|
||||
_SC_CHILD_MAX :: 1
|
||||
_SC_CLK_TCK :: 2
|
||||
_SC_NGROUPS_MAX :: 3
|
||||
_SC_OPEN_MAX :: 4
|
||||
_SC_STREAM_MAX :: 5
|
||||
_SC_TZNAME_MAX :: 6
|
||||
_SC_JOB_CONTROL :: 7
|
||||
_SC_SAVED_IDS :: 8
|
||||
_SC_REALTIME_SIGNALS :: 9
|
||||
_SC_PRIORITY_SCHEDULING :: 10
|
||||
_SC_TIMERS :: 11
|
||||
_SC_ASYNCHRONOUS_IO :: 12
|
||||
_SC_PRIORITIZED_IO :: 13
|
||||
_SC_SYNCHRONIZED_IO :: 14
|
||||
_SC_FSYNC :: 15
|
||||
_SC_MAPPED_FILES :: 16
|
||||
_SC_MEMLOCK :: 17
|
||||
_SC_MEMLOCK_RANGE :: 18
|
||||
_SC_MEMORY_PROTECTION :: 19
|
||||
_SC_MESSAGE_PASSING :: 20
|
||||
_SC_SEMAPHORES :: 21
|
||||
_SC_SHARED_MEMORY_OBJECTS :: 22
|
||||
_SC_AIO_LISTIO_MAX :: 23
|
||||
_SC_AIO_MAX :: 24
|
||||
_SC_AIO_PRIO_DELTA_MAX :: 25
|
||||
_SC_DELAYTIMER_MAX :: 26
|
||||
_SC_MQ_OPEN_MAX :: 27
|
||||
_SC_MQ_PRIO_MAX :: 28
|
||||
_SC_VERSION :: 29
|
||||
_SC_PAGE_SIZE :: 30
|
||||
_SC_PAGESIZE :: _SC_PAGE_SIZE
|
||||
_SC_RTSIG_MAX :: 31
|
||||
_SC_SEM_NSEMS_MAX :: 32
|
||||
_SC_SEM_VALUE_MAX :: 33
|
||||
_SC_SIGQUEUE_MAX :: 34
|
||||
_SC_TIMER_MAX :: 35
|
||||
_SC_BC_BASE_MAX :: 36
|
||||
_SC_BC_DIM_MAX :: 37
|
||||
_SC_BC_SCALE_MAX :: 38
|
||||
_SC_BC_STRING_MAX :: 39
|
||||
_SC_COLL_WEIGHTS_MAX :: 40
|
||||
_SC_EXPR_NEST_MAX :: 42
|
||||
_SC_LINE_MAX :: 43
|
||||
_SC_RE_DUP_MAX :: 44
|
||||
_SC_2_VERSION :: 46
|
||||
_SC_2_C_BIND :: 47
|
||||
_SC_2_C_DEV :: 48
|
||||
_SC_2_FORT_DEV :: 49
|
||||
_SC_2_FORT_RUN :: 50
|
||||
_SC_2_SW_DEV :: 51
|
||||
_SC_2_LOCALEDEF :: 52
|
||||
_SC_UIO_MAXIOV :: 60
|
||||
_SC_IOV_MAX :: _SC_UIO_MAXIOV
|
||||
_SC_THREADS :: 67
|
||||
_SC_THREAD_SAFE_FUNCTIONS :: 68
|
||||
_SC_GETGR_R_SIZE_MAX :: 69
|
||||
_SC_GETPW_R_SIZE_MAX :: 70
|
||||
_SC_LOGIN_NAME_MAX :: 71
|
||||
_SC_TTY_NAME_MAX :: 72
|
||||
_SC_THREAD_DESTRUCTOR_ITERATIONS :: 73
|
||||
_SC_THREAD_KEYS_MAX :: 74
|
||||
_SC_THREAD_STACK_MIN :: 75
|
||||
_SC_THREAD_THREADS_MAX :: 76
|
||||
_SC_THREAD_ATTR_STACKADDR :: 77
|
||||
_SC_THREAD_ATTR_STACKSIZE :: 78
|
||||
_SC_THREAD_PRIORITY_SCHEDULING :: 79
|
||||
_SC_THREAD_PRIO_INHERIT :: 80
|
||||
_SC_THREAD_PRIO_PROTECT :: 81
|
||||
_SC_THREAD_PROCESS_SHARED :: 82
|
||||
_SC_NPROCESSORS_CONF :: 83
|
||||
_SC_NPROCESSORS_ONLN :: 84
|
||||
_SC_PHYS_PAGES :: 85
|
||||
_SC_AVPHYS_PAGES :: 86
|
||||
_SC_ATEXIT_MAX :: 87
|
||||
_SC_PASS_MAX :: 88
|
||||
_SC_XOPEN_VERSION :: 89
|
||||
_SC_XOPEN_XCU_VERSION :: 90
|
||||
_SC_XOPEN_UNIX :: 91
|
||||
_SC_XOPEN_CRYPT :: 92
|
||||
_SC_XOPEN_ENH_I18N :: 93
|
||||
_SC_XOPEN_SHM :: 94
|
||||
_SC_2_CHAR_TERM :: 95
|
||||
_SC_2_UPE :: 97
|
||||
_SC_XOPEN_XPG2 :: 98
|
||||
_SC_XOPEN_XPG3 :: 99
|
||||
_SC_XOPEN_XPG4 :: 100
|
||||
_SC_NZERO :: 109
|
||||
_SC_XBS5_ILP32_OFF32 :: 125
|
||||
_SC_XBS5_ILP32_OFFBIG :: 126
|
||||
_SC_XBS5_LP64_OFF64 :: 127
|
||||
_SC_XBS5_LPBIG_OFFBIG :: 128
|
||||
_SC_XOPEN_LEGACY :: 129
|
||||
_SC_XOPEN_REALTIME :: 130
|
||||
_SC_XOPEN_REALTIME_THREADS :: 131
|
||||
_SC_ADVISORY_INFO :: 132
|
||||
_SC_BARRIERS :: 133
|
||||
_SC_CLOCK_SELECTION :: 137
|
||||
_SC_CPUTIME :: 138
|
||||
_SC_THREAD_CPUTIME :: 139
|
||||
_SC_MONOTONIC_CLOCK :: 149
|
||||
_SC_READER_WRITER_LOCKS :: 153
|
||||
_SC_SPIN_LOCKS :: 154
|
||||
_SC_REGEXP :: 155
|
||||
_SC_SHELL :: 157
|
||||
_SC_SPAWN :: 159
|
||||
_SC_SPORADIC_SERVER :: 160
|
||||
_SC_THREAD_SPORADIC_SERVER :: 161
|
||||
_SC_TIMEOUTS :: 164
|
||||
_SC_TYPED_MEMORY_OBJECTS :: 165
|
||||
_SC_2_PBS :: 168
|
||||
_SC_2_PBS_ACCOUNTING :: 169
|
||||
_SC_2_PBS_LOCATE :: 170
|
||||
_SC_2_PBS_MESSAGE :: 171
|
||||
_SC_2_PBS_TRACK :: 172
|
||||
_SC_SYMLOOP_MAX :: 173
|
||||
_SC_STREAMS :: 174
|
||||
_SC_2_PBS_CHECKPOINT :: 175
|
||||
_SC_V6_ILP32_OFF32 :: 176
|
||||
_SC_V6_ILP32_OFFBIG :: 177
|
||||
_SC_V6_LP64_OFF64 :: 178
|
||||
_SC_V6_LPBIG_OFFBIG :: 179
|
||||
_SC_HOST_NAME_MAX :: 180
|
||||
_SC_TRACE :: 181
|
||||
_SC_TRACE_EVENT_FILTER :: 182
|
||||
_SC_TRACE_INHERIT :: 183
|
||||
_SC_TRACE_LOG :: 184
|
||||
|
||||
_SC_XOPEN_LEGACY :: 129
|
||||
_SC_XOPEN_REALTIME :: 130
|
||||
_SC_XOPEN_REALTIME_THREADS :: 131
|
||||
_SC_ADVISORY_INFO :: 132
|
||||
_SC_BARRIERS :: 133
|
||||
_SC_CLOCK_SELECTION :: 137
|
||||
_SC_CPUTIME :: 138
|
||||
_SC_THREAD_CPUTIME :: 139
|
||||
_SC_MONOTONIC_CLOCK :: 149
|
||||
_SC_READER_WRITER_LOCKS :: 153
|
||||
_SC_SPIN_LOCKS :: 154
|
||||
_SC_REGEXP :: 155
|
||||
_SC_SHELL :: 157
|
||||
_SC_SPAWN :: 159
|
||||
_SC_SPORADIC_SERVER :: 160
|
||||
_SC_THREAD_SPORADIC_SERVER :: 161
|
||||
_SC_TIMEOUTS :: 164
|
||||
_SC_TYPED_MEMORY_OBJECTS :: 165
|
||||
_SC_2_PBS :: 168
|
||||
_SC_2_PBS_ACCOUNTING :: 169
|
||||
_SC_2_PBS_LOCATE :: 170
|
||||
_SC_2_PBS_MESSAGE :: 171
|
||||
_SC_2_PBS_TRACK :: 172
|
||||
_SC_SYMLOOP_MAX :: 173
|
||||
_SC_2_PBS_CHECKPOINT :: 174
|
||||
_SC_V6_ILP32_OFF32 :: 175
|
||||
_SC_V6_ILP32_OFFBIG :: 176
|
||||
_SC_V6_LP64_OFF64 :: 177
|
||||
_SC_V6_LPBIG_OFFBIG :: 178
|
||||
_SC_HOST_NAME_MAX :: 179
|
||||
_SC_TRACE :: 180
|
||||
_SC_TRACE_EVENT_FILTER :: 181
|
||||
_SC_TRACE_INHERIT :: 182
|
||||
_SC_TRACE_LOG :: 183
|
||||
|
||||
_SC_IPV6 :: 234
|
||||
_SC_RAW_SOCKETS :: 235
|
||||
_SC_V7_ILP32_OFF32 :: 236
|
||||
_SC_V7_ILP32_OFFBIG :: 237
|
||||
_SC_V7_LP64_OFF64 :: 238
|
||||
_SC_V7_LPBIG_OFFBIG :: 239
|
||||
_SC_SS_REPL_MAX :: 240
|
||||
_SC_TRACE_EVENT_NAME_MAX :: 241
|
||||
_SC_TRACE_NAME_MAX :: 242
|
||||
_SC_TRACE_SYS_MAX :: 243
|
||||
_SC_TRACE_USER_EVENT_MAX :: 244
|
||||
_SC_XOPEN_STREAMS :: 245
|
||||
_SC_THREAD_ROBUST_PRIO_INHERIT :: 246
|
||||
_SC_THREAD_ROBUST_PRIO_PROTECT :: 247
|
||||
_SC_IPV6 :: 235
|
||||
_SC_RAW_SOCKETS :: 236
|
||||
_SC_V7_ILP32_OFF32 :: 237
|
||||
_SC_V7_ILP32_OFFBIG :: 238
|
||||
_SC_V7_LP64_OFF64 :: 239
|
||||
_SC_V7_LPBIG_OFFBIG :: 240
|
||||
_SC_SS_REPL_MAX :: 241
|
||||
_SC_TRACE_EVENT_NAME_MAX :: 242
|
||||
_SC_TRACE_NAME_MAX :: 243
|
||||
_SC_TRACE_SYS_MAX :: 244
|
||||
_SC_TRACE_USER_EVENT_MAX :: 245
|
||||
_SC_XOPEN_STREAMS :: 246
|
||||
_SC_THREAD_ROBUST_PRIO_INHERIT :: 247
|
||||
_SC_THREAD_ROBUST_PRIO_PROTECT :: 248
|
||||
_SC_MINSIGSTKSZ :: 249
|
||||
_SC_SIGSTKSZ :: 250
|
||||
|
||||
// NOTE: Not implemented.
|
||||
_SC_XOPEN_UUCP :: 0
|
||||
// NOTE: Not implemented.
|
||||
_POSIX_VDISABLE :: 0
|
||||
|
||||
} else when ODIN_OS == .Haiku {
|
||||
|
||||
_F_OK :: 0
|
||||
X_OK :: 1
|
||||
W_OK :: 2
|
||||
R_OK :: 4
|
||||
|
||||
F_LOCK :: 1
|
||||
F_TEST :: 3
|
||||
F_TLOCK :: 2
|
||||
F_ULOCK :: 0
|
||||
|
||||
_CS_PATH :: 1
|
||||
_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS :: 0 // Undefined.
|
||||
_CS_POSIX_V6_ILP32_OFF32_CFLAGS :: 0 // Undefined.
|
||||
_CS_POSIX_V6_ILP32_OFF32_LDFLAGS :: 0 // Undefined.
|
||||
_CS_POSIX_V6_ILP32_OFF32_LIBS :: 0 // Undefined.
|
||||
_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS :: 0 // Undefined.
|
||||
_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS :: 0 // Undefined.
|
||||
_CS_POSIX_V6_ILP32_OFFBIG_LIBS :: 0 // Undefined.
|
||||
_CS_POSIX_V6_LP64_OFF64_CFLAGS :: 0 // Undefined.
|
||||
_CS_POSIX_V6_LP64_OFF64_LDFLAGS :: 0 // Undefined.
|
||||
_CS_POSIX_V6_LP64_OFF64_LIBS :: 0 // Undefined.
|
||||
_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS :: 0 // Undefined.
|
||||
_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS :: 0 // Undefined.
|
||||
_CS_POSIX_V6_LPBIG_OFFBIG_LIBS :: 0 // Undefined.
|
||||
|
||||
_SC_ASYNCHRONOUS_IO :: 0 // Undefined.
|
||||
_SC_RAW_SOCKETS :: 0 // Undefined.
|
||||
_SC_SS_REPL_MAX :: 0 // Undefined.
|
||||
_SC_TRACE_EVENT_NAME_MAX :: 0 // Undefined.
|
||||
_SC_TRACE_NAME_MAX :: 0 // Undefined.
|
||||
_SC_TRACE_SYS_MAX :: 0 // Undefined.
|
||||
_SC_TRACE_USER_EVENT_MAX :: 0 // Undefined.
|
||||
|
||||
_PC_CHOWN_RESTRICTED :: 1
|
||||
_PC_MAX_CANON :: 2
|
||||
_PC_MAX_INPUT :: 3
|
||||
_PC_NAME_MAX :: 4
|
||||
_PC_NO_TRUNC :: 5
|
||||
_PC_PATH_MAX :: 6
|
||||
_PC_PIPE_BUF :: 7
|
||||
_PC_VDISABLE :: 8
|
||||
_PC_LINK_MAX :: 25
|
||||
_PC_SYNC_IO :: 26
|
||||
_PC_ASYNC_IO :: 27
|
||||
_PC_PRIO_IO :: 28
|
||||
_PC_FILESIZEBITS :: 30
|
||||
_PC_REC_INCR_XFER_SIZE :: 31
|
||||
_PC_REC_MAX_XFER_SIZE :: 32
|
||||
_PC_REC_MIN_XFER_SIZE :: 33
|
||||
_PC_REC_XFER_ALIGN :: 34
|
||||
_PC_ALLOC_SIZE_MIN :: 35
|
||||
_PC_SYMLINK_MAX :: 36
|
||||
_PC_2_SYMLINKS :: 37
|
||||
|
||||
_SC_ARG_MAX :: 15
|
||||
_SC_CHILD_MAX :: 16
|
||||
_SC_CLK_TCK :: 17
|
||||
_SC_JOB_CONTROL :: 18
|
||||
_SC_NGROUPS_MAX :: 19
|
||||
_SC_OPEN_MAX :: 20
|
||||
_SC_SAVED_IDS :: 21
|
||||
_SC_STREAM_MAX :: 22
|
||||
_SC_TZNAME_MAX :: 23
|
||||
_SC_VERSION :: 24
|
||||
_SC_GETGR_R_SIZE_MAX :: 25
|
||||
_SC_GETPW_R_SIZE_MAX :: 26
|
||||
_SC_PAGE_SIZE :: 27
|
||||
_SC_PAGESIZE :: _SC_PAGE_SIZE
|
||||
_SC_SEM_NSEMS_MAX :: 28
|
||||
_SC_SEM_VALUE_MAX :: 29
|
||||
_SC_SEMAPHORES :: 30
|
||||
_SC_THREADS :: 31
|
||||
_SC_IOV_MAX :: 32
|
||||
_SC_NPROCESSORS_CONF :: 34
|
||||
_SC_NPROCESSORS_ONLN :: 35
|
||||
_SC_ATEXIT_MAX :: 37
|
||||
_SC_MAPPED_FILES :: 45
|
||||
_SC_THREAD_PROCESS_SHARED :: 46
|
||||
_SC_THREAD_STACK_MIN :: 47
|
||||
_SC_THREAD_ATTR_STACKADDR :: 48
|
||||
_SC_THREAD_ATTR_STACKSIZE :: 49
|
||||
_SC_THREAD_PRIORITY_SCHEDULING :: 50
|
||||
_SC_REALTIME_SIGNALS :: 51
|
||||
_SC_MEMORY_PROTECTION :: 52
|
||||
_SC_SIGQUEUE_MAX :: 53
|
||||
_SC_RTSIG_MAX :: 54
|
||||
_SC_MONOTONIC_CLOCK :: 55
|
||||
_SC_DELAYTIMER_MAX :: 56
|
||||
_SC_TIMER_MAX :: 57
|
||||
_SC_TIMERS :: 58
|
||||
_SC_CPUTIME :: 59
|
||||
_SC_THREAD_CPUTIME :: 60
|
||||
_SC_HOST_NAME_MAX :: 61
|
||||
_SC_REGEXP :: 62
|
||||
_SC_SYMLOOP_MAX :: 63
|
||||
_SC_SHELL :: 64
|
||||
_SC_TTY_NAME_MAX :: 65
|
||||
_SC_ADVISORY_INFO :: 66
|
||||
_SC_BARRIERS :: 67
|
||||
_SC_CLOCK_SELECTION :: 68
|
||||
_SC_FSYNC :: 69
|
||||
_SC_IPV6 :: 70
|
||||
_SC_MEMLOCK :: 71
|
||||
_SC_MEMLOCK_RANGE :: 72
|
||||
_SC_MESSAGE_PASSING :: 73
|
||||
_SC_PRIORITIZED_IO :: 74
|
||||
_SC_PRIORITY_SCHEDULING :: 75
|
||||
_SC_READER_WRITER_LOCKS :: 76
|
||||
_SC_SHARED_MEMORY_OBJECTS :: 77
|
||||
_SC_SPAWN :: 78
|
||||
_SC_SPIN_LOCKS :: 79
|
||||
_SC_SPORADIC_SERVER :: 80
|
||||
_SC_SYNCHRONIZED_IO :: 81
|
||||
_SC_THREAD_PRIO_INHERIT :: 82
|
||||
_SC_THREAD_PRIO_PROTECT :: 83
|
||||
_SC_THREAD_SAFE_FUNCTIONS :: 86
|
||||
_SC_THREAD_SPORADIC_SERVER :: 87
|
||||
_SC_TIMEOUTS :: 88
|
||||
_SC_TRACE :: 89
|
||||
_SC_TRACE_EVENT_FILTER :: 90
|
||||
_SC_TRACE_INHERIT :: 91
|
||||
_SC_TRACE_LOG :: 92
|
||||
_SC_TYPED_MEMORY_OBJECTS :: 93
|
||||
_SC_V6_ILP32_OFF32 :: 94
|
||||
_SC_V6_ILP32_OFFBIG :: 95
|
||||
_SC_V6_LP64_OFF64 :: 96
|
||||
_SC_V6_LPBIG_OFFBIG :: 97
|
||||
_SC_2_C_BIND :: 102
|
||||
_SC_2_C_DEV :: 103
|
||||
_SC_2_CHAR_TERM :: 104
|
||||
_SC_2_FORT_DEV :: 105
|
||||
_SC_2_FORT_RUN :: 106
|
||||
_SC_2_LOCALEDEF :: 107
|
||||
_SC_2_PBS :: 108
|
||||
_SC_2_PBS_ACCOUNTING :: 109
|
||||
_SC_2_PBS_CHECKPOINT :: 110
|
||||
_SC_2_PBS_LOCATE :: 111
|
||||
_SC_2_PBS_MESSAGE :: 112
|
||||
_SC_2_PBS_TRACK :: 113
|
||||
_SC_2_SW_DEV :: 114
|
||||
_SC_2_UPE :: 115
|
||||
_SC_2_VERSION :: 116
|
||||
_SC_XOPEN_CRYPT :: 117
|
||||
_SC_XOPEN_ENH_I18N :: 118
|
||||
_SC_XOPEN_REALTIME :: 119
|
||||
_SC_XOPEN_REALTIME_THREADS :: 120
|
||||
_SC_XOPEN_SHM :: 121
|
||||
_SC_XOPEN_STREAMS :: 122
|
||||
_SC_XOPEN_UNIX :: 123
|
||||
_SC_XOPEN_VERSION :: 125
|
||||
_SC_AIO_LISTIO_MAX :: 126
|
||||
_SC_AIO_MAX :: 127
|
||||
_SC_AIO_PRIO_DELTA_MAX :: 128
|
||||
_SC_BC_BASE_MAX :: 129
|
||||
_SC_BC_DIM_MAX :: 130
|
||||
_SC_BC_SCALE_MAX :: 131
|
||||
_SC_BC_STRING_MAX :: 132
|
||||
_SC_COLL_WEIGHTS_MAX :: 133
|
||||
_SC_EXPR_NEST_MAX :: 134
|
||||
_SC_LINE_MAX :: 135
|
||||
_SC_LOGIN_NAME_MAX :: 136
|
||||
_SC_MQ_OPEN_MAX :: 137
|
||||
_SC_MQ_PRIO_MAX :: 138
|
||||
_SC_THREAD_DESTRUCTOR_ITERATIONS :: 139
|
||||
_SC_THREAD_KEYS_MAX :: 140
|
||||
_SC_THREAD_THREADS_MAX :: 141
|
||||
_SC_RE_DUP_MAX :: 142
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build linux, windows, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, windows, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
import "core:c"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package posix
|
||||
|
||||
when ODIN_OS == .Darwin {
|
||||
@@ -25,7 +25,7 @@ when ODIN_OS == .NetBSD {
|
||||
@(private) LUTIME :: "utime"
|
||||
}
|
||||
|
||||
when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD || ODIN_OS == .Linux {
|
||||
when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD || ODIN_OS == .Linux || ODIN_OS == .Haiku {
|
||||
|
||||
utimbuf :: struct {
|
||||
actime: time_t, /* [PSX] access time (seconds since epoch) */
|
||||
|
||||
@@ -189,7 +189,7 @@ Key_Location :: enum u8 {
|
||||
KEYBOARD_MAX_KEY_SIZE :: 32
|
||||
KEYBOARD_MAX_CODE_SIZE :: 32
|
||||
|
||||
GAMEPAD_MAX_ID_SIZE :: 64
|
||||
GAMEPAD_MAX_ID_SIZE :: 96
|
||||
GAMEPAD_MAX_MAPPING_SIZE :: 64
|
||||
|
||||
GAMEPAD_MAX_BUTTONS :: 64
|
||||
@@ -239,6 +239,12 @@ Gamepad_State :: struct {
|
||||
_mapping_buf: [GAMEPAD_MAX_MAPPING_SIZE]byte `fmt:"-"`,
|
||||
}
|
||||
|
||||
Pointer_Type :: enum u8 {
|
||||
Mouse,
|
||||
Pen,
|
||||
Touch,
|
||||
}
|
||||
|
||||
Event :: struct {
|
||||
kind: Event_Kind,
|
||||
target_kind: Event_Target_Kind,
|
||||
@@ -275,6 +281,8 @@ Event :: struct {
|
||||
|
||||
repeat: bool,
|
||||
|
||||
char: rune,
|
||||
|
||||
_key_len: int `fmt:"-"`,
|
||||
_code_len: int `fmt:"-"`,
|
||||
_key_buf: [KEYBOARD_MAX_KEY_SIZE]byte `fmt:"-"`,
|
||||
@@ -295,6 +303,21 @@ Event :: struct {
|
||||
|
||||
button: i16,
|
||||
buttons: bit_set[0..<16; u16],
|
||||
|
||||
pointer: struct {
|
||||
altitude_angle: f64,
|
||||
azimuth_angle: f64,
|
||||
persistent_device_id: int,
|
||||
pointer_id: int,
|
||||
width: int,
|
||||
height: int,
|
||||
pressure: f64,
|
||||
tangential_pressure: f64,
|
||||
tilt: [2]f64,
|
||||
twist: f64,
|
||||
pointer_type: Pointer_Type,
|
||||
is_primary: bool,
|
||||
},
|
||||
},
|
||||
|
||||
gamepad: Gamepad_State,
|
||||
@@ -323,13 +346,13 @@ add_event_listener :: proc(id: string, kind: Event_Kind, user_data: rawptr, call
|
||||
return _add_event_listener(id, event_kind_string[kind], kind, user_data, callback, use_capture)
|
||||
}
|
||||
|
||||
remove_event_listener :: proc(id: string, kind: Event_Kind, user_data: rawptr, callback: proc(e: Event)) -> bool {
|
||||
remove_event_listener :: proc(id: string, kind: Event_Kind, user_data: rawptr, callback: proc(e: Event), use_capture := false) -> bool {
|
||||
@(default_calling_convention="contextless")
|
||||
foreign dom_lib {
|
||||
@(link_name="remove_event_listener")
|
||||
_remove_event_listener :: proc(id: string, name: string, user_data: rawptr, callback: proc "odin" (Event)) -> bool ---
|
||||
_remove_event_listener :: proc(id: string, name: string, user_data: rawptr, callback: proc "odin" (Event), use_capture: bool) -> bool ---
|
||||
}
|
||||
return _remove_event_listener(id, event_kind_string[kind], user_data, callback)
|
||||
return _remove_event_listener(id, event_kind_string[kind], user_data, callback, use_capture)
|
||||
}
|
||||
|
||||
add_window_event_listener :: proc(kind: Event_Kind, user_data: rawptr, callback: proc(e: Event), use_capture := false) -> bool {
|
||||
@@ -341,20 +364,26 @@ add_window_event_listener :: proc(kind: Event_Kind, user_data: rawptr, callback:
|
||||
return _add_window_event_listener(event_kind_string[kind], kind, user_data, callback, use_capture)
|
||||
}
|
||||
|
||||
remove_window_event_listener :: proc(kind: Event_Kind, user_data: rawptr, callback: proc(e: Event)) -> bool {
|
||||
remove_window_event_listener :: proc(kind: Event_Kind, user_data: rawptr, callback: proc(e: Event), use_capture := false) -> bool {
|
||||
@(default_calling_convention="contextless")
|
||||
foreign dom_lib {
|
||||
@(link_name="remove_window_event_listener")
|
||||
_remove_window_event_listener :: proc(name: string, user_data: rawptr, callback: proc "odin" (Event)) -> bool ---
|
||||
_remove_window_event_listener :: proc(name: string, user_data: rawptr, callback: proc "odin" (Event), use_capture: bool) -> bool ---
|
||||
}
|
||||
return _remove_window_event_listener(event_kind_string[kind], user_data, callback)
|
||||
return _remove_window_event_listener(event_kind_string[kind], user_data, callback, use_capture)
|
||||
}
|
||||
|
||||
remove_event_listener_from_event :: proc(e: Event) -> bool {
|
||||
from_use_capture_false: bool
|
||||
from_use_capture_true: bool
|
||||
if e.id == "" {
|
||||
return remove_window_event_listener(e.kind, e.user_data, e.callback)
|
||||
from_use_capture_false = remove_window_event_listener(e.kind, e.user_data, e.callback, false)
|
||||
from_use_capture_true = remove_window_event_listener(e.kind, e.user_data, e.callback, true)
|
||||
} else {
|
||||
from_use_capture_false = remove_event_listener(e.id, e.kind, e.user_data, e.callback, false)
|
||||
from_use_capture_true = remove_event_listener(e.id, e.kind, e.user_data, e.callback, true)
|
||||
}
|
||||
return remove_event_listener(e.id, e.kind, e.user_data, e.callback)
|
||||
return from_use_capture_false || from_use_capture_true
|
||||
}
|
||||
|
||||
add_custom_event_listener :: proc(id: string, name: string, user_data: rawptr, callback: proc(e: Event), use_capture := false) -> bool {
|
||||
@@ -365,13 +394,13 @@ add_custom_event_listener :: proc(id: string, name: string, user_data: rawptr, c
|
||||
}
|
||||
return _add_event_listener(id, name, .Custom, user_data, callback, use_capture)
|
||||
}
|
||||
remove_custom_event_listener :: proc(id: string, name: string, user_data: rawptr, callback: proc(e: Event)) -> bool {
|
||||
remove_custom_event_listener :: proc(id: string, name: string, user_data: rawptr, callback: proc(e: Event), use_capture := false) -> bool {
|
||||
@(default_calling_convention="contextless")
|
||||
foreign dom_lib {
|
||||
@(link_name="remove_event_listener")
|
||||
_remove_event_listener :: proc(id: string, name: string, user_data: rawptr, callback: proc "odin" (Event)) -> bool ---
|
||||
_remove_event_listener :: proc(id: string, name: string, user_data: rawptr, callback: proc "odin" (Event), use_capture: bool) -> bool ---
|
||||
}
|
||||
return _remove_event_listener(id, name, user_data, callback)
|
||||
return _remove_event_listener(id, name, user_data, callback, use_capture)
|
||||
}
|
||||
|
||||
get_gamepad_state :: proc "contextless" (index: int, s: ^Gamepad_State) -> bool {
|
||||
@@ -384,7 +413,14 @@ get_gamepad_state :: proc "contextless" (index: int, s: ^Gamepad_State) -> bool
|
||||
if s == nil {
|
||||
return false
|
||||
}
|
||||
return _get_gamepad_state(index, s)
|
||||
|
||||
if !_get_gamepad_state(index, s) {
|
||||
return false
|
||||
}
|
||||
|
||||
s.id = string(s._id_buf[:s._id_len])
|
||||
s.mapping = string(s._mapping_buf[:s._mapping_len])
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -415,4 +451,4 @@ do_event_callback :: proc(user_data: rawptr, callback: proc(e: Event)) {
|
||||
|
||||
callback(event)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,7 +263,7 @@ add_event_listener :: proc(id: string, kind: Event_Kind, user_data: rawptr, call
|
||||
panic("vendor:wasm/js not supported on non JS targets")
|
||||
}
|
||||
|
||||
remove_event_listener :: proc(id: string, kind: Event_Kind, user_data: rawptr, callback: proc(e: Event)) -> bool {
|
||||
remove_event_listener :: proc(id: string, kind: Event_Kind, user_data: rawptr, callback: proc(e: Event), use_capture := false) -> bool {
|
||||
panic("vendor:wasm/js not supported on non JS targets")
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ add_window_event_listener :: proc(kind: Event_Kind, user_data: rawptr, callback:
|
||||
panic("vendor:wasm/js not supported on non JS targets")
|
||||
}
|
||||
|
||||
remove_window_event_listener :: proc(kind: Event_Kind, user_data: rawptr, callback: proc(e: Event)) -> bool {
|
||||
remove_window_event_listener :: proc(kind: Event_Kind, user_data: rawptr, callback: proc(e: Event), use_capture := false) -> bool {
|
||||
panic("vendor:wasm/js not supported on non JS targets")
|
||||
}
|
||||
|
||||
@@ -282,6 +282,6 @@ remove_event_listener_from_event :: proc(e: Event) -> bool {
|
||||
add_custom_event_listener :: proc(id: string, name: string, user_data: rawptr, callback: proc(e: Event), use_capture := false) -> bool {
|
||||
panic("vendor:wasm/js not supported on non JS targets")
|
||||
}
|
||||
remove_custom_event_listener :: proc(id: string, name: string, user_data: rawptr, callback: proc(e: Event)) -> bool {
|
||||
remove_custom_event_listener :: proc(id: string, name: string, user_data: rawptr, callback: proc(e: Event), use_capture := false) -> bool {
|
||||
panic("vendor:wasm/js not supported on non JS targets")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,4 +9,5 @@ foreign odin_env {
|
||||
abort :: proc() -> ! ---
|
||||
alert :: proc(msg: string) ---
|
||||
evaluate :: proc(str: string) ---
|
||||
}
|
||||
open :: proc(url: string, name := "", specs := "") ---
|
||||
}
|
||||
|
||||
+120
-28
@@ -17,7 +17,7 @@ class WasmMemoryInterface {
|
||||
constructor() {
|
||||
this.memory = null;
|
||||
this.exports = null;
|
||||
this.listenerMap = {};
|
||||
this.listenerMap = new Map();
|
||||
|
||||
// Size (in bytes) of the integer type, should be 4 on `js_wasm32` and 8 on `js_wasm64p32`
|
||||
this.intSize = 4;
|
||||
@@ -110,7 +110,10 @@ class WasmMemoryInterface {
|
||||
}
|
||||
|
||||
loadCstring(ptr) {
|
||||
const start = this.loadPtr(ptr);
|
||||
return this.loadCstringDirect(this.loadPtr(ptr));
|
||||
}
|
||||
|
||||
loadCstringDirect(start) {
|
||||
if (start == 0) {
|
||||
return null;
|
||||
}
|
||||
@@ -399,6 +402,9 @@ class WebGLInterface {
|
||||
BlendEquation: (mode) => {
|
||||
this.ctx.blendEquation(mode);
|
||||
},
|
||||
BlendEquationSeparate: (modeRGB, modeAlpha) => {
|
||||
this.ctx.blendEquationSeparate(modeRGB, modeAlpha);
|
||||
},
|
||||
BlendFunc: (sfactor, dfactor) => {
|
||||
this.ctx.blendFunc(sfactor, dfactor);
|
||||
},
|
||||
@@ -630,6 +636,13 @@ class WebGLInterface {
|
||||
GetParameter: (pname) => {
|
||||
return this.ctx.getParameter(pname);
|
||||
},
|
||||
GetParameter4i: (pname, v0, v1, v2, v3) => {
|
||||
const i4 = this.ctx.getParameter(pname);
|
||||
this.mem.storeI32(v0, i4[0]);
|
||||
this.mem.storeI32(v1, i4[1]);
|
||||
this.mem.storeI32(v2, i4[2]);
|
||||
this.mem.storeI32(v3, i4[3]);
|
||||
},
|
||||
GetProgramParameter: (program, pname) => {
|
||||
return this.ctx.getProgramParameter(this.programs[program], pname)
|
||||
},
|
||||
@@ -1312,18 +1325,20 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement, memory) {
|
||||
} else if (!line.includes("\n")) {
|
||||
currentLine[isError] = currentLine[isError].concat(line);
|
||||
} else {
|
||||
let lines = line.split("\n");
|
||||
let lines = line.trimEnd().split("\n");
|
||||
let printLast = lines.length > 1 && line.endsWith("\n");
|
||||
println(currentLine[isError].concat(lines[0]));
|
||||
currentLine[isError] = "";
|
||||
for (let i = 1; i < lines.length-1; i++) {
|
||||
println(lines[i]);
|
||||
}
|
||||
let last = lines[lines.length-1];
|
||||
if (printLast) {
|
||||
println(last);
|
||||
} else {
|
||||
currentLine[isError] = last;
|
||||
if (lines.length > 1) {
|
||||
let last = lines[lines.length-1];
|
||||
if (printLast) {
|
||||
println(last);
|
||||
} else {
|
||||
currentLine[isError] = last;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1390,6 +1405,10 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement, memory) {
|
||||
info.scrollTop = info.scrollHeight;
|
||||
};
|
||||
|
||||
const listener_key = (id, name, data, callback, useCapture) => {
|
||||
return `${id}-${name}-data:${data}-callback:${callback}-useCapture:${useCapture}`;
|
||||
};
|
||||
|
||||
let webglContext = new WebGLInterface(wasmMemoryInterface);
|
||||
|
||||
const env = {};
|
||||
@@ -1418,6 +1437,13 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement, memory) {
|
||||
abort: () => { Module.abort() },
|
||||
evaluate: (str_ptr, str_len) => { eval.call(null, wasmMemoryInterface.loadString(str_ptr, str_len)); },
|
||||
|
||||
open: (url_ptr, url_len, name_ptr, name_len, specs_ptr, specs_len) => {
|
||||
const url = wasmMemoryInterface.loadString(url_ptr, url_len);
|
||||
const name = wasmMemoryInterface.loadString(name_ptr, name_len);
|
||||
const specs = wasmMemoryInterface.loadString(specs_ptr, specs_len);
|
||||
window.open(url, name, specs);
|
||||
},
|
||||
|
||||
// return a bigint to be converted to i64
|
||||
time_now: () => BigInt(Date.now()),
|
||||
tick_now: () => performance.now(),
|
||||
@@ -1530,6 +1556,29 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement, memory) {
|
||||
|
||||
wmi.storeI16(off(2), e.button);
|
||||
wmi.storeU16(off(2), e.buttons);
|
||||
|
||||
if (e instanceof PointerEvent) {
|
||||
wmi.storeF64(off(8), e.altitudeAngle);
|
||||
wmi.storeF64(off(8), e.azimuthAngle);
|
||||
wmi.storeInt(off(W), e.persistentDeviceId);
|
||||
wmi.storeInt(off(W), e.pointerId);
|
||||
wmi.storeInt(off(W), e.width);
|
||||
wmi.storeInt(off(W), e.height);
|
||||
wmi.storeF64(off(8), e.pressure);
|
||||
wmi.storeF64(off(8), e.tangentialPressure);
|
||||
wmi.storeF64(off(8), e.tiltX);
|
||||
wmi.storeF64(off(8), e.tiltY);
|
||||
wmi.storeF64(off(8), e.twist);
|
||||
if (e.pointerType == "pen") {
|
||||
wmi.storeU8(off(1), 1);
|
||||
} else if (e.pointerType == "touch") {
|
||||
wmi.storeU8(off(1), 2);
|
||||
} else {
|
||||
wmi.storeU8(off(1), 0);
|
||||
}
|
||||
wmi.storeU8(off(1), !!e.isPrimary);
|
||||
}
|
||||
|
||||
} else if (e instanceof KeyboardEvent) {
|
||||
// Note: those strings are constructed
|
||||
// on the native side from buffers that
|
||||
@@ -1546,6 +1595,8 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement, memory) {
|
||||
|
||||
wmi.storeU8(off(1), !!e.repeat);
|
||||
|
||||
wmi.storeI32(off(4), e.charCode);
|
||||
|
||||
wmi.storeInt(off(W, W), e.key.length)
|
||||
wmi.storeInt(off(W, W), e.code.length)
|
||||
wmi.storeString(off(32, 1), e.key);
|
||||
@@ -1585,10 +1636,24 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement, memory) {
|
||||
}
|
||||
}
|
||||
|
||||
wmi.storeInt(off(W, W), e.gamepad.id.length)
|
||||
wmi.storeInt(off(W, W), e.gamepad.mapping.length)
|
||||
wmi.storeString(off(64, 1), e.gamepad.id);
|
||||
wmi.storeString(off(64, 1), e.gamepad.mapping);
|
||||
let idLength = e.gamepad.id.length;
|
||||
let id = e.gamepad.id;
|
||||
if (idLength > 96) {
|
||||
idLength = 96;
|
||||
id = id.slice(0, 93) + '...';
|
||||
}
|
||||
|
||||
let mappingLength = e.gamepad.mapping.length;
|
||||
let mapping = e.gamepad.mapping;
|
||||
if (mappingLength > 64) {
|
||||
mappingLength = 61;
|
||||
mapping = mapping.slice(0, 61) + '...';
|
||||
}
|
||||
|
||||
wmi.storeInt(off(W, W), idLength);
|
||||
wmi.storeInt(off(W, W), mappingLength);
|
||||
wmi.storeString(off(96, 1), id);
|
||||
wmi.storeString(off(64, 1), mapping);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1599,6 +1664,10 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement, memory) {
|
||||
if (element == undefined) {
|
||||
return false;
|
||||
}
|
||||
let key = listener_key(id, name, data, callback, !!use_capture);
|
||||
if (wasmMemoryInterface.listenerMap.has(key)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let listener = (e) => {
|
||||
let event_data = {};
|
||||
@@ -1609,7 +1678,7 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement, memory) {
|
||||
|
||||
onEventReceived(event_data, data, callback);
|
||||
};
|
||||
wasmMemoryInterface.listenerMap[{data: data, callback: callback}] = listener;
|
||||
wasmMemoryInterface.listenerMap.set(key, listener);
|
||||
element.addEventListener(name, listener, !!use_capture);
|
||||
return true;
|
||||
},
|
||||
@@ -1617,6 +1686,11 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement, memory) {
|
||||
add_window_event_listener: (name_ptr, name_len, name_code, data, callback, use_capture) => {
|
||||
let name = wasmMemoryInterface.loadString(name_ptr, name_len);
|
||||
let element = window;
|
||||
let key = listener_key('window', name, data, callback, !!use_capture);
|
||||
if (wasmMemoryInterface.listenerMap.has(key)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let listener = (e) => {
|
||||
let event_data = {};
|
||||
event_data.id_ptr = 0;
|
||||
@@ -1626,12 +1700,12 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement, memory) {
|
||||
|
||||
onEventReceived(event_data, data, callback);
|
||||
};
|
||||
wasmMemoryInterface.listenerMap[{data: data, callback: callback}] = listener;
|
||||
wasmMemoryInterface.listenerMap.set(key, listener);
|
||||
element.addEventListener(name, listener, !!use_capture);
|
||||
return true;
|
||||
},
|
||||
|
||||
remove_event_listener: (id_ptr, id_len, name_ptr, name_len, data, callback) => {
|
||||
remove_event_listener: (id_ptr, id_len, name_ptr, name_len, data, callback, use_capture) => {
|
||||
let id = wasmMemoryInterface.loadString(id_ptr, id_len);
|
||||
let name = wasmMemoryInterface.loadString(name_ptr, name_len);
|
||||
let element = getElement(id);
|
||||
@@ -1639,24 +1713,28 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement, memory) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let listener = wasmMemoryInterface.listenerMap[{data: data, callback: callback}];
|
||||
if (listener == undefined) {
|
||||
let key = listener_key(id, name, data, callback, !!use_capture);
|
||||
let listener = wasmMemoryInterface.listenerMap.get(key);
|
||||
if (listener === undefined) {
|
||||
return false;
|
||||
}
|
||||
element.removeEventListener(name, listener);
|
||||
wasmMemoryInterface.listenerMap.delete(key);
|
||||
|
||||
element.removeEventListener(name, listener, !!use_capture);
|
||||
return true;
|
||||
},
|
||||
remove_window_event_listener: (name_ptr, name_len, data, callback) => {
|
||||
remove_window_event_listener: (name_ptr, name_len, data, callback, use_capture) => {
|
||||
let name = wasmMemoryInterface.loadString(name_ptr, name_len);
|
||||
let element = window;
|
||||
let key = {data: data, callback: callback};
|
||||
let listener = wasmMemoryInterface.listenerMap[key];
|
||||
if (!listener) {
|
||||
|
||||
let key = listener_key('window', name, data, callback, !!use_capture);
|
||||
let listener = wasmMemoryInterface.listenerMap.get(key);
|
||||
if (listener === undefined) {
|
||||
return false;
|
||||
}
|
||||
wasmMemoryInterface.listenerMap[key] = undefined;
|
||||
wasmMemoryInterface.listenerMap.delete(key);
|
||||
|
||||
element.removeEventListener(name, listener);
|
||||
element.removeEventListener(name, listener, !!use_capture);
|
||||
return true;
|
||||
},
|
||||
|
||||
@@ -1753,10 +1831,24 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement, memory) {
|
||||
}
|
||||
}
|
||||
|
||||
wmi.storeInt(off(W, W), gamepad.id.length)
|
||||
wmi.storeInt(off(W, W), gamepad.mapping.length)
|
||||
wmi.storeString(off(64, 1), gamepad.id);
|
||||
wmi.storeString(off(64, 1), gamepad.mapping);
|
||||
let idLength = gamepad.id.length;
|
||||
let id = gamepad.id;
|
||||
if (idLength > 96) {
|
||||
idLength = 96;
|
||||
id = id.slice(0, 93) + '...';
|
||||
}
|
||||
|
||||
let mappingLength = gamepad.mapping.length;
|
||||
let mapping = gamepad.mapping;
|
||||
if (mappingLength > 64) {
|
||||
mappingLength = 61;
|
||||
mapping = mapping.slice(0, 61) + '...';
|
||||
}
|
||||
|
||||
wmi.storeInt(off(W, W), idLength);
|
||||
wmi.storeInt(off(W, W), mappingLength);
|
||||
wmi.storeString(off(96, 1), id);
|
||||
wmi.storeString(off(64, 1), mapping);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -15,7 +15,7 @@ MINIDUMP_DIRECTORY :: struct {
|
||||
Location: MINIDUMP_LOCATION_DESCRIPTOR,
|
||||
}
|
||||
|
||||
MINIDUMP_EXCEPTION_INFORMATION :: struct {
|
||||
MINIDUMP_EXCEPTION_INFORMATION :: struct #max_field_align(4) {
|
||||
ThreadId: DWORD,
|
||||
ExceptionPointers: ^EXCEPTION_POINTERS,
|
||||
ClientPointers: BOOL,
|
||||
|
||||
@@ -5,6 +5,6 @@ foreign import "system:Dnsapi.lib"
|
||||
|
||||
@(default_calling_convention="system")
|
||||
foreign Dnsapi {
|
||||
DnsQuery_UTF8 :: proc(name: cstring, type: u16, options: DWORD, extra: PVOID, results: ^^DNS_RECORD, reserved: PVOID) -> DNS_STATUS ---
|
||||
DnsQuery_UTF8 :: proc(name: cstring, type: u16, options: DNS_QUERY_OPTIONS, extra: PVOID, results: ^^DNS_RECORD, reserved: PVOID) -> DNS_STATUS ---
|
||||
DnsRecordListFree :: proc(list: ^DNS_RECORD, options: DWORD) ---
|
||||
}
|
||||
|
||||
@@ -38,6 +38,13 @@ DWMNCRENDERINGPOLICY :: enum {
|
||||
DWMNCRP_LAST,
|
||||
}
|
||||
|
||||
DWM_WINDOW_CORNER_PREFERENCE :: enum c_int {
|
||||
DEFAULT,
|
||||
DONOTROUND,
|
||||
ROUND,
|
||||
ROUNDSMALL,
|
||||
}
|
||||
|
||||
@(default_calling_convention="system")
|
||||
foreign dwmapi {
|
||||
DwmFlush :: proc() -> HRESULT ---
|
||||
|
||||
@@ -20,6 +20,15 @@ COMMON_LVB_GRID_RVERTICAL :: WORD(0x1000)
|
||||
COMMON_LVB_REVERSE_VIDEO :: WORD(0x4000)
|
||||
COMMON_LVB_UNDERSCORE :: WORD(0x8000)
|
||||
COMMON_LVB_SBCSDBCS :: WORD(0x0300)
|
||||
EV_BREAK :: DWORD(0x0040)
|
||||
EV_CTS :: DWORD(0x0008)
|
||||
EV_DSR :: DWORD(0x0010)
|
||||
EV_ERR :: DWORD(0x0080)
|
||||
EV_RING :: DWORD(0x0100)
|
||||
EV_RLSD :: DWORD(0x0020)
|
||||
EV_RXCHAR :: DWORD(0x0001)
|
||||
EV_RXFLAG :: DWORD(0x0002)
|
||||
EV_TXEMPTY :: DWORD(0x0004)
|
||||
|
||||
@(default_calling_convention="system")
|
||||
foreign kernel32 {
|
||||
@@ -109,9 +118,12 @@ foreign kernel32 {
|
||||
ClearCommError :: proc(hFile: HANDLE, lpErrors: ^Com_Error, lpStat: ^COMSTAT) -> BOOL ---
|
||||
GetCommState :: proc(handle: HANDLE, dcb: ^DCB) -> BOOL ---
|
||||
SetCommState :: proc(handle: HANDLE, dcb: ^DCB) -> BOOL ---
|
||||
GetCommPorts :: proc(lpPortNumbers: PULONG, uPortNumbersCount: ULONG, puPortNumbersFound: PULONG) -> ULONG ---
|
||||
SetCommMask :: proc(handle: HANDLE, dwEvtMap: DWORD) -> BOOL ---
|
||||
GetCommMask :: proc(handle: HANDLE, lpEvtMask: LPDWORD) -> BOOL ---
|
||||
WaitCommEvent :: proc(handle: HANDLE, lpEvtMask: LPDWORD, lpOverlapped: LPOVERLAPPED) -> BOOL ---
|
||||
GetCommandLineW :: proc() -> LPCWSTR ---
|
||||
GetTempPathW :: proc(nBufferLength: DWORD, lpBuffer: LPCWSTR) -> DWORD ---
|
||||
GetTempFileNameW :: proc(lpPathName: LPCWSTR, lpPrefixString: LPCWSTR, uUnique: c_int, lpTempFileName: LPWSTR) -> c_uint ---
|
||||
GetCurrentProcess :: proc() -> HANDLE ---
|
||||
GetCurrentProcessId :: proc() -> DWORD ---
|
||||
GetCurrentThread :: proc() -> HANDLE ---
|
||||
@@ -239,6 +251,10 @@ foreign kernel32 {
|
||||
hThread: HANDLE,
|
||||
lpContext: LPCONTEXT,
|
||||
) -> BOOL ---
|
||||
SetThreadContext :: proc(
|
||||
hThread: HANDLE,
|
||||
lpContext: LPCONTEXT,
|
||||
) -> BOOL ---
|
||||
CreateProcessW :: proc(
|
||||
lpApplicationName: LPCWSTR,
|
||||
lpCommandLine: LPWSTR,
|
||||
@@ -1068,6 +1084,11 @@ foreign one_core {
|
||||
PageProtection: ULONG,
|
||||
PreferredNode: ULONG,
|
||||
) -> PVOID ---
|
||||
GetCommPorts :: proc(
|
||||
lpPortNumbers: PULONG,
|
||||
uPortNumbersCount: ULONG,
|
||||
puPortNumbersFound: PULONG,
|
||||
) -> ULONG ---
|
||||
}
|
||||
|
||||
|
||||
@@ -1220,3 +1241,31 @@ GHND :: (GMEM_MOVEABLE | GMEM_ZEROINIT)
|
||||
GPTR :: (GMEM_FIXED | GMEM_ZEROINIT)
|
||||
|
||||
LPTOP_LEVEL_EXCEPTION_FILTER :: PVECTORED_EXCEPTION_HANDLER
|
||||
|
||||
ACTCTXW :: struct {
|
||||
Size: ULONG,
|
||||
Flags: DWORD,
|
||||
Source: LPCWSTR,
|
||||
ProcessorArchitecture: USHORT,
|
||||
LangId: LANGID,
|
||||
AssemblyDirectory: LPCWSTR,
|
||||
ResourceName: LPCWSTR,
|
||||
ApplicationName: LPCWSTR,
|
||||
Module: HMODULE,
|
||||
}
|
||||
PACTCTXW :: ^ACTCTXW
|
||||
PCACTCTXW :: ^ACTCTXW
|
||||
|
||||
ACTCTX_FLAG_PROCESSOR_ARCHITECTURE_VALID :: 0x001
|
||||
ACTCTX_FLAG_LANGID_VALID :: 0x002
|
||||
ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID :: 0x004
|
||||
ACTCTX_FLAG_RESOURCE_NAME_VALID :: 0x008
|
||||
ACTCTX_FLAG_SET_PROCESS_DEFAULT :: 0x010
|
||||
ACTCTX_FLAG_APPLICATION_NAME_VALID :: 0x020
|
||||
ACTCTX_FLAG_HMODULE_VALID :: 0x080
|
||||
|
||||
@(default_calling_convention="system")
|
||||
foreign kernel32 {
|
||||
CreateActCtxW :: proc(pActCtx: ^ACTCTXW) -> HANDLE ---
|
||||
ActivateActCtx :: proc(hActCtx: HANDLE, lpCookie: ^ULONG_PTR) -> BOOL ---
|
||||
}
|
||||
|
||||
+535
-4
@@ -66,6 +66,7 @@ PULONG_PTR :: ^ULONG_PTR
|
||||
LPULONG_PTR :: ^ULONG_PTR
|
||||
DWORD_PTR :: ULONG_PTR
|
||||
LONG_PTR :: int
|
||||
INT_PTR :: int
|
||||
UINT_PTR :: uintptr
|
||||
ULONG :: c_ulong
|
||||
ULONGLONG :: c_ulonglong
|
||||
@@ -143,6 +144,7 @@ LPWSAPROTOCOL_INFO :: ^WSAPROTOCOL_INFO
|
||||
LPSTR :: ^CHAR
|
||||
LPWSTR :: ^WCHAR
|
||||
OLECHAR :: WCHAR
|
||||
BSTR :: ^OLECHAR
|
||||
LPOLESTR :: ^OLECHAR
|
||||
LPCOLESTR :: LPCSTR
|
||||
LPFILETIME :: ^FILETIME
|
||||
@@ -541,6 +543,44 @@ COLOR_3DHIGHLIGHT :: COLOR_BTNHIGHLIGHT
|
||||
COLOR_3DHILIGHT :: COLOR_BTNHIGHLIGHT
|
||||
COLOR_BTNHILIGHT :: COLOR_BTNHIGHLIGHT
|
||||
|
||||
// Common Control Notification Code Ranges
|
||||
NM_FIRST :: 0
|
||||
NM_LAST :: ~DWORD(99 - 1)
|
||||
LVN_FIRST :: ~DWORD(100 - 1)
|
||||
LVN_LAST :: ~DWORD(199 - 1)
|
||||
HDN_FIRST :: ~DWORD(300 - 1)
|
||||
HDN_LAST :: ~DWORD(399 - 1)
|
||||
TVN_FIRST :: ~DWORD(400 - 1)
|
||||
TVN_LAST :: ~DWORD(499 - 1)
|
||||
TTN_FIRST :: ~DWORD(520 - 1)
|
||||
TTN_LAST :: ~DWORD(549 - 1)
|
||||
TCN_FIRST :: ~DWORD(550 - 1)
|
||||
TCN_LAST :: ~DWORD(580 - 1)
|
||||
CDN_FIRST :: ~DWORD(601 - 1)
|
||||
CDN_LAST :: ~DWORD(699 - 1)
|
||||
TBN_FIRST :: ~DWORD(700 - 1)
|
||||
TBN_LAST :: ~DWORD(720 - 1)
|
||||
UDN_FIRST :: ~DWORD(721 - 1)
|
||||
UDN_LAST :: ~DWORD(740 - 1)
|
||||
MCN_FIRST :: ~DWORD(750 - 1)
|
||||
MCN_LAST :: ~DWORD(759 - 1)
|
||||
DTN_FIRST :: ~DWORD(760 - 1)
|
||||
DTN_LAST :: ~DWORD(799 - 1)
|
||||
CBEN_FIRST :: ~DWORD(800 - 1)
|
||||
CBEN_LAST :: ~DWORD(830 - 1)
|
||||
RBN_FIRST :: ~DWORD(831 - 1)
|
||||
RBN_LAST :: ~DWORD(859 - 1)
|
||||
IPN_FIRST :: ~DWORD(860 - 1)
|
||||
IPN_LAST :: ~DWORD(879 - 1)
|
||||
SBN_FIRST :: ~DWORD(880 - 1)
|
||||
SBN_LAST :: ~DWORD(899 - 1)
|
||||
PGN_FIRST :: ~DWORD(900 - 1)
|
||||
PGN_LAST :: ~DWORD(950 - 1)
|
||||
WMN_FIRST :: ~DWORD(1000 - 1)
|
||||
WMN_LAST :: ~DWORD(1200 - 1)
|
||||
BCN_FIRST :: ~DWORD(1250 - 1)
|
||||
BCN_LAST :: ~DWORD(1350 - 1)
|
||||
|
||||
// Combo Box Notification Codes
|
||||
CBN_ERRSPACE :: -1
|
||||
CBN_SELCHANGE :: 1
|
||||
@@ -623,6 +663,10 @@ BST_INDETERMINATE :: 0x0002
|
||||
BST_PUSHED :: 0x0004
|
||||
BST_FOCUS :: 0x0008
|
||||
|
||||
// Button Control Notification Codes
|
||||
BCN_HOTITEMCHANGE :: (BCN_FIRST + 0x0001)
|
||||
BCN_DROPDOWN :: (BCN_FIRST + 0x0002)
|
||||
|
||||
// Static Control Constants
|
||||
SS_LEFT :: 0x00000000
|
||||
SS_CENTER :: 0x00000001
|
||||
@@ -685,6 +729,416 @@ EN_VSCROLL :: 0x0602
|
||||
EN_ALIGN_LTR_EC :: 0x0700
|
||||
EN_ALIGN_RTL_EC :: 0x0701
|
||||
|
||||
// Toolbar Styles
|
||||
TBS_AUTOTICKS :: 0x001
|
||||
TBS_VERT :: 0x002
|
||||
TBS_HORZ :: 0x000
|
||||
TBS_TOP :: 0x004
|
||||
TBS_BOTTOM :: 0x000
|
||||
TBS_LEFT :: 0x004
|
||||
TBS_RIGHT :: 0x000
|
||||
TBS_BOTH :: 0x008
|
||||
TBS_NOTICKS :: 0x010
|
||||
TBS_ENABLESELRANGE :: 0x020
|
||||
TBS_FIXEDLENGTH :: 0x040
|
||||
TBS_NOTHUMB :: 0x080
|
||||
TBS_TOOLTIPS :: 0x100
|
||||
TBS_REVERSED :: 0x200
|
||||
TBS_DOWNISLEFT :: 0x400
|
||||
|
||||
// Toolbar Button Styles
|
||||
TBSTYLE_BUTTON :: 0x0000
|
||||
TBSTYLE_SEP :: 0x0001
|
||||
TBSTYLE_CHECK :: 0x0002
|
||||
TBSTYLE_GROUP :: 0x0004
|
||||
TBSTYLE_CHECKGROUP :: (TBSTYLE_GROUP | TBSTYLE_CHECK)
|
||||
TBSTYLE_DROPDOWN :: 0x0008
|
||||
TBSTYLE_AUTOSIZE :: 0x0010
|
||||
TBSTYLE_NOPREFIX :: 0x0020
|
||||
TBSTYLE_TOOLTIPS :: 0x0100
|
||||
TBSTYLE_WRAPABLE :: 0x0200
|
||||
TBSTYLE_ALTDRAG :: 0x0400
|
||||
TBSTYLE_FLAT :: 0x0800
|
||||
TBSTYLE_LIST :: 0x1000
|
||||
TBSTYLE_CUSTOMERASE :: 0x2000
|
||||
TBSTYLE_REGISTERDROP :: 0x4000
|
||||
TBSTYLE_TRANSPARENT :: 0x8000
|
||||
|
||||
// Toolbar Button Styles (Aliases)
|
||||
BTNS_BUTTON :: TBSTYLE_BUTTON
|
||||
BTNS_SEP :: TBSTYLE_SEP
|
||||
BTNS_CHECK :: TBSTYLE_CHECK
|
||||
BTNS_GROUP :: TBSTYLE_GROUP
|
||||
BTNS_CHECKGROUP :: TBSTYLE_CHECKGROUP
|
||||
BTNS_DROPDOWN :: TBSTYLE_DROPDOWN
|
||||
BTNS_AUTOSIZE :: TBSTYLE_AUTOSIZE
|
||||
BTNS_NOPREFIX :: TBSTYLE_NOPREFIX
|
||||
BTNS_SHOWTEXT :: 0x40
|
||||
BTNS_WHOLEDROPDOWN :: 0x80
|
||||
|
||||
// Toolbar Extended Styles
|
||||
TBSTYLE_EX_DRAWDDARROWS :: 0x01
|
||||
TBSTYLE_EX_MIXEDBUTTONS :: 0x08
|
||||
TBSTYLE_EX_HIDECLIPPEDBUTTONS :: 0x10
|
||||
TBSTYLE_EX_DOUBLEBUFFER :: 0x80
|
||||
|
||||
// Toolbar Item State Codes
|
||||
TBSTATE_CHECKED :: 0x01
|
||||
TBSTATE_PRESSED :: 0x02
|
||||
TBSTATE_ENABLED :: 0x04
|
||||
TBSTATE_HIDDEN :: 0x08
|
||||
TBSTATE_INDETERMINATE :: 0x10
|
||||
TBSTATE_WRAP :: 0x20
|
||||
TBSTATE_ELLIPSES :: 0x40
|
||||
TBSTATE_MARKED :: 0x80
|
||||
|
||||
// Toolbar Constants
|
||||
TBCDRF_NOEDGES :: 0x010000
|
||||
TBCDRF_HILITEHOTTRACK :: 0x020000
|
||||
TBCDRF_NOOFFSET :: 0x040000
|
||||
TBCDRF_NOMARK :: 0x080000
|
||||
TBCDRF_NOETCHEDEFFECT :: 0x100000
|
||||
TBCDRF_BLENDICON :: 0x200000
|
||||
TBCDRF_NOBACKGROUND :: 0x400000
|
||||
|
||||
TBBF_LARGE :: 0x1
|
||||
|
||||
TBIF_IMAGE :: 0x00000001
|
||||
TBIF_TEXT :: 0x00000002
|
||||
TBIF_STATE :: 0x00000004
|
||||
TBIF_STYLE :: 0x00000008
|
||||
TBIF_LPARAM :: 0x00000010
|
||||
TBIF_COMMAND :: 0x00000020
|
||||
TBIF_SIZE :: 0x00000040
|
||||
TBIF_BYINDEX :: 0x80000000
|
||||
|
||||
TBMF_PAD :: 0x1
|
||||
TBMF_BARPAD :: 0x2
|
||||
TBMF_BUTTONSPACING :: 0x4
|
||||
|
||||
IDB_STD_SMALL_COLOR :: 0
|
||||
IDB_STD_LARGE_COLOR :: 1
|
||||
IDB_VIEW_SMALL_COLOR :: 4
|
||||
IDB_VIEW_LARGE_COLOR :: 5
|
||||
IDB_HIST_SMALL_COLOR :: 8
|
||||
IDB_HIST_LARGE_COLOR :: 9
|
||||
|
||||
STD_CUT :: 0
|
||||
STD_COPY :: 1
|
||||
STD_PASTE :: 2
|
||||
STD_UNDO :: 3
|
||||
STD_REDOW :: 4
|
||||
STD_DELETE :: 5
|
||||
STD_FILENEW :: 6
|
||||
STD_FILEOPEN :: 7
|
||||
STD_FILESAVE :: 8
|
||||
STD_PRINTPRE :: 9
|
||||
STD_PROPERTIES :: 10
|
||||
STD_HELP :: 11
|
||||
STD_FIND :: 12
|
||||
STD_REPLACE :: 13
|
||||
STD_PRINT :: 14
|
||||
|
||||
VIEW_LARGEICONS :: 0
|
||||
VIEW_SMALLICONS :: 1
|
||||
VIEW_LIST :: 2
|
||||
VIEW_DETAILS :: 3
|
||||
VIEW_SORTNAME :: 4
|
||||
VIEW_SORTSIZE :: 5
|
||||
VIEW_SORTDATE :: 6
|
||||
VIEW_SORTTYPE :: 7
|
||||
VIEW_PARENTFOLDER :: 8
|
||||
VIEW_NETCONNECT :: 9
|
||||
VIEW_NETDISCONNECT :: 10
|
||||
VIEW_NEWFOLDER :: 11
|
||||
VIEW_VIEWMENU :: 12
|
||||
|
||||
HIST_BACK :: 0
|
||||
HIST_FORWARD :: 1
|
||||
HIST_FAVORITES :: 2
|
||||
HIST_ADDTOFAVORITES :: 3
|
||||
HIST_VIEWTREE :: 4
|
||||
|
||||
// Header Control Styles
|
||||
HDS_HORZ :: 0x000
|
||||
HDS_BUTTONS :: 0x002
|
||||
HDS_HOTTRACK :: 0x004
|
||||
HDS_HIDDEN :: 0x008
|
||||
HDS_DRAGDROP :: 0x040
|
||||
HDS_FULLDRAG :: 0x080
|
||||
HDS_FILTERBAR :: 0x100
|
||||
HDS_FLAT :: 0x200
|
||||
|
||||
// Header Control Notifications
|
||||
HDN_ITEMCHANGINGA :: (HDN_FIRST-0)
|
||||
HDN_ITEMCHANGEDA :: (HDN_FIRST-1)
|
||||
HDN_ITEMCLICKA :: (HDN_FIRST-2)
|
||||
HDN_ITEMDBLCLICKA :: (HDN_FIRST-3)
|
||||
HDN_DIVIDERDBLCLICKA :: (HDN_FIRST-5)
|
||||
HDN_BEGINTRACKA :: (HDN_FIRST-6)
|
||||
HDN_ENDTRACKA :: (HDN_FIRST-7)
|
||||
HDN_TRACKA :: (HDN_FIRST-8)
|
||||
HDN_GETDISPINFOA :: (HDN_FIRST-9)
|
||||
HDN_BEGINDRAG :: (HDN_FIRST-10)
|
||||
HDN_ENDDRAG :: (HDN_FIRST-11)
|
||||
HDN_FILTERCHANGE :: (HDN_FIRST-12)
|
||||
HDN_FILTERBTNCLICK :: (HDN_FIRST-13)
|
||||
HDN_ITEMCHANGINGW :: (HDN_FIRST-20)
|
||||
HDN_ITEMCHANGEDW :: (HDN_FIRST-21)
|
||||
HDN_ITEMCLICKW :: (HDN_FIRST-22)
|
||||
HDN_ITEMDBLCLICKW :: (HDN_FIRST-23)
|
||||
HDN_DIVIDERDBLCLICKW :: (HDN_FIRST-25)
|
||||
HDN_BEGINTRACKW :: (HDN_FIRST-26)
|
||||
HDN_ENDTRACKW :: (HDN_FIRST-27)
|
||||
HDN_TRACKW :: (HDN_FIRST-28)
|
||||
HDN_GETDISPINFOW :: (HDN_FIRST-29)
|
||||
|
||||
// Header Control Constants
|
||||
HDFT_ISSTRING :: 0x0000
|
||||
HDFT_ISNUMBER :: 0x0001
|
||||
HDFT_HASNOVALUE :: 0x8000
|
||||
|
||||
HDI_WIDTH :: 0x001
|
||||
HDI_HEIGHT :: HDI_WIDTH
|
||||
HDI_TEXT :: 0x002
|
||||
HDI_FORMAT :: 0x004
|
||||
HDI_LPARAM :: 0x008
|
||||
HDI_BITMAP :: 0x010
|
||||
HDI_IMAGE :: 0x020
|
||||
HDI_DI_SETITEM :: 0x040
|
||||
HDI_ORDER :: 0x080
|
||||
HDI_FILTER :: 0x100
|
||||
|
||||
HDF_LEFT :: 0x0000000
|
||||
HDF_RIGHT :: 0x0000001
|
||||
HDF_CENTER :: 0x0000002
|
||||
HDF_JUSTIFYMASK :: 0x0000003
|
||||
HDF_RTLREADING :: 0x0000004
|
||||
HDF_CHECKBOX :: 0x0000040
|
||||
HDF_CHECKED :: 0x0000080
|
||||
HDF_FIXEDWIDTH :: 0x0000100
|
||||
HDF_SORTDOWN :: 0x0000200
|
||||
HDF_SORTUP :: 0x0000400
|
||||
HDF_IMAGE :: 0x0000800
|
||||
HDF_BITMAP_ON_RIGHT :: 0x0001000
|
||||
HDF_BITMAP :: 0x0002000
|
||||
HDF_STRING :: 0x0004000
|
||||
HDF_OWNERDRAW :: 0x0008000
|
||||
HDF_SPLITBUTTON :: 0x1000000
|
||||
|
||||
HHT_NOWHERE :: 0x001
|
||||
HHT_ONHEADER :: 0x002
|
||||
HHT_ONDIVIDER :: 0x004
|
||||
HHT_ONDIVOPEN :: 0x008
|
||||
HHT_ONFILTER :: 0x010
|
||||
HHT_ONFILTERBUTTON :: 0x020
|
||||
HHT_ABOVE :: 0x100
|
||||
HHT_BELOW :: 0x200
|
||||
HHT_TORIGHT :: 0x400
|
||||
HHT_TOLEFT :: 0x800
|
||||
|
||||
// Rebar Control Styles
|
||||
RBS_TOOLTIPS :: 0x0100
|
||||
RBS_VARHEIGHT :: 0x0200
|
||||
RBS_BANDBORDERS :: 0x0400
|
||||
RBS_FIXEDORDER :: 0x0800
|
||||
RBS_REGISTERDROP :: 0x1000
|
||||
RBS_AUTOSIZE :: 0x2000
|
||||
RBS_VERTICALGRIPPER :: 0x4000
|
||||
RBS_DBLCLKTOGGLE :: 0x8000
|
||||
|
||||
// Tooltip Control Styles
|
||||
TTS_ALWAYSTIP :: 0x01
|
||||
TTS_NOPREFIX :: 0x02
|
||||
TTS_NOANIMATE :: 0x10
|
||||
TTS_NOFADE :: 0x20
|
||||
TTS_BALLOON :: 0x40
|
||||
TTS_CLOSE :: 0x80
|
||||
|
||||
// Statusbar Control Styles
|
||||
SBARS_SIZEGRIP :: 0x100
|
||||
SBARS_TOOLTIPS :: 0x800
|
||||
|
||||
// Statusbar Control Constants
|
||||
SBT_TOOLTIPS :: 0x800
|
||||
|
||||
// Up-Down Control Styles
|
||||
UDS_WRAP :: 0x001
|
||||
UDS_SETBUDDYINT :: 0x002
|
||||
UDS_ALIGNRIGHT :: 0x004
|
||||
UDS_ALIGNLEFT :: 0x008
|
||||
UDS_AUTOBUDDY :: 0x010
|
||||
UDS_ARROWKEYS :: 0x020
|
||||
UDS_HORZ :: 0x040
|
||||
UDS_NOTHOUSANDS :: 0x080
|
||||
UDS_HOTTRACK :: 0x100
|
||||
|
||||
// Common Control Styles
|
||||
CCS_TOP :: 0x01
|
||||
CCS_NOMOVEY :: 0x02
|
||||
CCS_BOTTOM :: 0x03
|
||||
CCS_NORESIZE :: 0x04
|
||||
CCS_NOPARENTALIGN :: 0x08
|
||||
CCS_ADJUSTABLE :: 0x20
|
||||
CCS_NODIVIDER :: 0x40
|
||||
CCS_VERT :: 0x80
|
||||
CCS_LEFT :: (CCS_VERT | CCS_TOP)
|
||||
CCS_RIGHT :: (CCS_VERT | CCS_BOTTOM)
|
||||
CCS_NOMOVEX :: (CCS_VERT | CCS_NOMOVEY)
|
||||
|
||||
// List-View Control Styles
|
||||
LVS_ICON :: 0x0000
|
||||
LVS_REPORT :: 0x0001
|
||||
LVS_SMALLICON :: 0x0002
|
||||
LVS_LIST :: 0x0003
|
||||
LVS_TYPEMASK :: 0x0003
|
||||
LVS_SINGLESEL :: 0x0004
|
||||
LVS_SHOWSELALWAYS :: 0x0008
|
||||
LVS_SORTASCENDING :: 0x0010
|
||||
LVS_SORTDESCENDING :: 0x0020
|
||||
LVS_SHAREIMAGELISTS :: 0x0040
|
||||
LVS_NOLABELWRAP :: 0x0080
|
||||
LVS_AUTOARRANGE :: 0x0100
|
||||
LVS_EDITLABELS :: 0x0200
|
||||
LVS_OWNERDATA :: 0x1000
|
||||
LVS_NOSCROLL :: 0x2000
|
||||
LVS_TYPESTYLEMASK :: 0xFC00
|
||||
LVS_ALIGNTOP :: 0x0000
|
||||
LVS_ALIGNLEFT :: 0x0800
|
||||
LVS_ALIGNMASK :: 0x0C00
|
||||
LVS_OWNERDRAWFIXED :: 0x0400
|
||||
LVS_NOCOLUMNHEADER :: 0x4000
|
||||
LVS_NOSORTHEADER :: 0x8000
|
||||
|
||||
// Tree-View Control Styles
|
||||
TVS_HASBUTTONS :: 0x0001
|
||||
TVS_HASLINES :: 0x0002
|
||||
TVS_LINESATROOT :: 0x0004
|
||||
TVS_EDITLABELS :: 0x0008
|
||||
TVS_DISABLEDRAGDROP :: 0x0010
|
||||
TVS_SHOWSELALWAYS :: 0x0020
|
||||
TVS_RTLREADING :: 0x0040
|
||||
TVS_NOTOOLTIPS :: 0x0080
|
||||
TVS_CHECKBOXES :: 0x0100
|
||||
TVS_TRACKSELECT :: 0x0200
|
||||
TVS_SINGLEEXPAND :: 0x0400
|
||||
TVS_INFOTIP :: 0x0800
|
||||
TVS_FULLROWSELECT :: 0x1000
|
||||
TVS_NOSCROLL :: 0x2000
|
||||
TVS_NONEVENHEIGHT :: 0x4000
|
||||
TVS_NOHSCROLL :: 0x8000
|
||||
|
||||
// Tree-View Control Constants
|
||||
TVE_COLLAPSE :: 0x0001
|
||||
TVE_EXPAND :: 0x0002
|
||||
TVE_TOGGLE :: 0x0003
|
||||
TVE_EXPANDPARTIAL :: 0x4000
|
||||
TVE_COLLAPSERESET :: 0x8000
|
||||
|
||||
TVSIL_NORMAL :: 0
|
||||
TVSIL_STATE :: 2
|
||||
|
||||
TVGN_ROOT :: 0x0
|
||||
TVGN_NEXT :: 0x1
|
||||
TVGN_PREVIOUS :: 0x2
|
||||
TVGN_PARENT :: 0x3
|
||||
TVGN_CHILD :: 0x4
|
||||
TVGN_FIRSTVISIBLE :: 0x5
|
||||
TVGN_NEXTVISIBLE :: 0x6
|
||||
TVGN_PREVIOUSVISIBLE :: 0x7
|
||||
TVGN_DROPHILITE :: 0x8
|
||||
TVGN_CARET :: 0x9
|
||||
TVGN_LASTVISIBLE :: 0xA
|
||||
|
||||
TVSI_NOSINGLEEXPAND :: 0x8000
|
||||
|
||||
TVHT_NOWHERE :: 0x001
|
||||
TVHT_ONITEMICON :: 0x002
|
||||
TVHT_ONITEMLABEL :: 0x004
|
||||
TVHT_ONITEM :: (TVHT_ONITEMICON | TVHT_ONITEMLABEL | TVHT_ONITEMSTATEICON)
|
||||
TVHT_ONITEMINDENT :: 0x008
|
||||
TVHT_ONITEMBUTTON :: 0x010
|
||||
TVHT_ONITEMRIGHT :: 0x020
|
||||
TVHT_ONITEMSTATEICON :: 0x040
|
||||
TVHT_ABOVE :: 0x100
|
||||
TVHT_BELOW :: 0x200
|
||||
TVHT_TORIGHT :: 0x400
|
||||
TVHT_TOLEFT :: 0x800
|
||||
|
||||
// Tab Control Styles
|
||||
TCS_SCROLLOPPOSITE :: 0x0001
|
||||
TCS_BOTTOM :: 0x0002
|
||||
TCS_RIGHT :: 0x0002
|
||||
TCS_MULTISELECT :: 0x0004
|
||||
TCS_FLATBUTTONS :: 0x0008
|
||||
TCS_FORCEICONLEFT :: 0x0010
|
||||
TCS_FORCELABELLEFT :: 0x0020
|
||||
TCS_HOTTRACK :: 0x0040
|
||||
TCS_VERTICAL :: 0x0080
|
||||
TCS_TABS :: 0x0000
|
||||
TCS_BUTTONS :: 0x0100
|
||||
TCS_SINGLELINE :: 0x0000
|
||||
TCS_MULTILINE :: 0x0200
|
||||
TCS_RIGHTJUSTIFY :: 0x0000
|
||||
TCS_FIXEDWIDTH :: 0x0400
|
||||
TCS_RAGGEDRIGHT :: 0x0800
|
||||
TCS_FOCUSONBUTTONDOWN :: 0x1000
|
||||
TCS_OWNERDRAWFIXED :: 0x2000
|
||||
TCS_TOOLTIPS :: 0x4000
|
||||
TCS_FOCUSNEVER :: 0x8000
|
||||
|
||||
// Tab Control Constants
|
||||
TCIF_TEXT :: 0x01
|
||||
TCIF_IMAGE :: 0x02
|
||||
TCIF_RTLREADING :: 0x04
|
||||
TCIF_PARAM :: 0x08
|
||||
TCIF_STATE :: 0x10
|
||||
|
||||
TCIS_BUTTONPRESSED :: 0x1
|
||||
TCIS_HIGHLIGHTED :: 0x2
|
||||
|
||||
TCHT_NOWHERE :: 0x1
|
||||
TCHT_ONITEMICON :: 0x2
|
||||
TCHT_ONITEMLABEL :: 0x4
|
||||
TCHT_ONITEM :: (TCHT_ONITEMICON | TCHT_ONITEMLABEL)
|
||||
|
||||
// Animation Control Styles
|
||||
ACS_CENTER :: 0x1
|
||||
ACS_TRANSPARENT :: 0x2
|
||||
ACS_AUTOPLAY :: 0x4
|
||||
ACS_TIMER :: 0x8
|
||||
|
||||
// Month-Calendar Control Styles
|
||||
MCS_DAYSTATE :: 0x01
|
||||
MCS_MULTISELECT :: 0x02
|
||||
MCS_WEEKNUMBERS :: 0x04
|
||||
MCS_NOTODAYCIRCLE :: 0x08
|
||||
MCS_NOTODAY :: 0x10
|
||||
|
||||
// Date-and-Time Picker Control Styles
|
||||
DTS_UPDOWN :: 0x01
|
||||
DTS_SHOWNONE :: 0x02
|
||||
DTS_SHORTDATEFORMAT :: 0x00
|
||||
DTS_LONGDATEFORMAT :: 0x04
|
||||
DTS_SHORTDATECENTURYFORMAT :: 0x0C
|
||||
DTS_TIMEFORMAT :: 0x09
|
||||
DTS_APPCANPARSE :: 0x10
|
||||
DTS_RIGHTALIGN :: 0x20
|
||||
|
||||
// Pager Control Styles
|
||||
PGS_VERT :: 0x0
|
||||
PGS_HORZ :: 0x1
|
||||
PGS_AUTOSCROLL :: 0x2
|
||||
PGS_DRAGNDROP :: 0x4
|
||||
|
||||
// Native Font Control Styles
|
||||
NFS_EDIT :: 0x01
|
||||
NFS_STATIC :: 0x02
|
||||
NFS_LISTCOMBO :: 0x04
|
||||
NFS_BUTTON :: 0x08
|
||||
NFS_ALL :: 0x10
|
||||
NFS_USEFONTASSOC :: 0x20
|
||||
|
||||
// Font Weights
|
||||
FW_DONTCARE :: 0
|
||||
FW_THIN :: 100
|
||||
@@ -795,6 +1249,8 @@ TIMERPROC :: #type proc "system" (HWND, UINT, UINT_PTR, DWORD)
|
||||
|
||||
WNDPROC :: #type proc "system" (HWND, UINT, WPARAM, LPARAM) -> LRESULT
|
||||
|
||||
SUBCLASSPROC :: #type proc "system" (HWND, UINT, WPARAM, LPARAM, UINT_PTR, DWORD_PTR) -> LRESULT
|
||||
|
||||
HOOKPROC :: #type proc "system" (code: c_int, wParam: WPARAM, lParam: LPARAM) -> LRESULT
|
||||
|
||||
WINEVENTPROC :: #type proc "system" (
|
||||
@@ -1203,6 +1659,16 @@ NMHDR :: struct {
|
||||
code: UINT, // NM_ code
|
||||
}
|
||||
|
||||
NMCUSTOMDRAW :: struct {
|
||||
hdr: NMHDR,
|
||||
dwDrawStage: DWORD,
|
||||
hdc: HDC,
|
||||
rc: RECT,
|
||||
dwItemSpec: DWORD_PTR,
|
||||
uItemState: UINT,
|
||||
lItemlParam: LPARAM,
|
||||
}
|
||||
|
||||
NCCALCSIZE_PARAMS :: struct {
|
||||
rgrc: [3]RECT,
|
||||
lppos: PWINDOWPOS,
|
||||
@@ -2201,7 +2667,24 @@ DUPLICATE_SAME_ACCESS: DWORD : 0x00000002
|
||||
CONDITION_VARIABLE_INIT :: CONDITION_VARIABLE{}
|
||||
SRWLOCK_INIT :: SRWLOCK{}
|
||||
|
||||
STARTF_USESTDHANDLES: DWORD : 0x00000100
|
||||
// Flags in STARTUPINFOW.dwFlags.
|
||||
STARTF_USESHOWWINDOW: DWORD : 0x00000001
|
||||
STARTF_USESIZE: DWORD : 0x00000002
|
||||
STARTF_USEPOSITION: DWORD : 0x00000004
|
||||
STARTF_USECOUNTCHARS: DWORD : 0x00000008
|
||||
STARTF_USEFILLATTRIBUTE: DWORD : 0x00000010
|
||||
STARTF_RUNFULLSCREEN: DWORD : 0x00000020 // ignored for non-x86 platforms
|
||||
STARTF_FORCEONFEEDBACK: DWORD : 0x00000040
|
||||
STARTF_FORCEOFFFEEDBACK: DWORD : 0x00000080
|
||||
STARTF_USESTDHANDLES: DWORD : 0x00000100
|
||||
// WINVER >= 0x400
|
||||
STARTF_USEHOTKEY: DWORD : 0x00000200
|
||||
STARTF_TITLEISLINKNAME: DWORD : 0x00000800
|
||||
STARTF_TITLEISAPPID: DWORD : 0x00001000
|
||||
STARTF_PREVENTPINNING: DWORD : 0x00002000
|
||||
// WINVER >= 0x600
|
||||
STARTF_UNTRUSTEDSOURCE: DWORD : 0x00008000
|
||||
|
||||
|
||||
VOLUME_NAME_DOS: DWORD : 0x0
|
||||
|
||||
@@ -2694,11 +3177,23 @@ EXCEPTION_MAXIMUM_PARAMETERS :: 15
|
||||
|
||||
EXCEPTION_DATATYPE_MISALIGNMENT :: 0x80000002
|
||||
EXCEPTION_BREAKPOINT :: 0x80000003
|
||||
EXCEPTION_SINGLE_STEP :: 0x80000004
|
||||
EXCEPTION_ACCESS_VIOLATION :: 0xC0000005
|
||||
EXCEPTION_IN_PAGE_ERROR :: 0xC0000006
|
||||
EXCEPTION_ILLEGAL_INSTRUCTION :: 0xC000001D
|
||||
EXCEPTION_NONCONTINUABLE_EXCEPTION :: 0xC0000025
|
||||
EXCEPTION_INVALID_DISPOSITION :: 0xC0000026
|
||||
EXCEPTION_ARRAY_BOUNDS_EXCEEDED :: 0xC000008C
|
||||
EXCEPTION_FLT_DENORMAL_OPERAND :: 0xC000008D
|
||||
EXCEPTION_FLT_DIVIDE_BY_ZERO :: 0xC000008E
|
||||
EXCEPTION_FLT_INEXACT_RESULT :: 0xC000008F
|
||||
EXCEPTION_FLT_INVALID_OPERATION :: 0xC0000090
|
||||
EXCEPTION_FLT_OVERFLOW :: 0xC0000091
|
||||
EXCEPTION_FLT_STACK_CHECK :: 0xC0000092
|
||||
EXCEPTION_FLT_UNDERFLOW :: 0xC0000093
|
||||
EXCEPTION_INT_DIVIDE_BY_ZERO :: 0xC0000094
|
||||
EXCEPTION_INT_OVERFLOW :: 0xC0000095
|
||||
EXCEPTION_PRIV_INSTRUCTION :: 0xC0000096
|
||||
EXCEPTION_STACK_OVERFLOW :: 0xC00000FD
|
||||
STATUS_PRIVILEGED_INSTRUCTION :: 0xC0000096
|
||||
|
||||
@@ -3415,8 +3910,6 @@ TIME_ZONE_INFORMATION :: struct {
|
||||
DaylightBias: LONG,
|
||||
}
|
||||
|
||||
|
||||
@(private="file")
|
||||
IMAGE_DOS_HEADER :: struct {
|
||||
e_magic: WORD,
|
||||
e_cblp: WORD,
|
||||
@@ -3534,6 +4027,19 @@ IMAGE_EXPORT_DIRECTORY :: struct {
|
||||
AddressOfNameOrdinals: DWORD, // RVA from base of image
|
||||
}
|
||||
|
||||
IMAGE_DEBUG_DIRECTORY :: struct {
|
||||
Characteristics: DWORD,
|
||||
TimeDateStamp: DWORD,
|
||||
MajorVersion: WORD,
|
||||
MinorVersion: WORD,
|
||||
Type: DWORD,
|
||||
SizeOfData: DWORD,
|
||||
AddressOfRawData: DWORD,
|
||||
PointerToRawData: DWORD,
|
||||
}
|
||||
|
||||
IMAGE_DEBUG_TYPE_CODEVIEW :: 2
|
||||
|
||||
SICHINTF :: DWORD
|
||||
SHCONTF :: DWORD
|
||||
SFGAOF :: ULONG
|
||||
@@ -4519,7 +5025,7 @@ DNS_RECORD :: struct { // aka DNS_RECORDA
|
||||
Flags: DWORD,
|
||||
dwTtl: DWORD,
|
||||
_: DWORD,
|
||||
Data: struct #raw_union {
|
||||
Data: struct #raw_union #align(4) {
|
||||
CNAME: DNS_PTR_DATAA,
|
||||
A: u32be, // Ipv4 Address
|
||||
AAAA: u128be, // Ipv6 Address
|
||||
@@ -4550,6 +5056,31 @@ DNS_SRV_DATAA :: struct {
|
||||
_: WORD, // padding
|
||||
}
|
||||
|
||||
// See https://learn.microsoft.com/en-us/windows/win32/dns/dns-constants
|
||||
DNS_QUERY_OPTION :: enum DWORD {
|
||||
ACCEPT_TRUNCATED_RESPONSE = 0,
|
||||
DNS_QUERY_USE_TCP_ONLY = 1,
|
||||
NO_RECURSION = 2,
|
||||
BYPASS_CACHE = 3,
|
||||
NO_WIRE_QUERY = 4,
|
||||
NO_LOCAL_NAME = 5,
|
||||
NO_HOSTS_FILE = 6,
|
||||
NO_NETBT = 7,
|
||||
WIRE_ONLY = 8,
|
||||
RETURN_MESSAGE = 9,
|
||||
MULTICAST_ONLY = 10,
|
||||
NO_MULTICAST = 11,
|
||||
TREAT_AS_FQDN = 12,
|
||||
ADDRCONFIG = 13,
|
||||
DUAL_ADDR = 14,
|
||||
MULTICAST_WAIT = 17,
|
||||
MULTICAST_VERIFY = 18,
|
||||
DONT_RESET_TTL_VALUES = 20,
|
||||
DISABLE_IDN_ENCODING = 21,
|
||||
APPEND_MULTILABEL = 23,
|
||||
}
|
||||
DNS_QUERY_OPTIONS :: bit_set[DNS_QUERY_OPTION; DWORD]
|
||||
|
||||
SOCKADDR :: struct {
|
||||
sa_family: ADDRESS_FAMILY,
|
||||
sa_data: [14]CHAR,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
package sys_windows
|
||||
|
||||
import "base:intrinsics"
|
||||
import "core:c"
|
||||
foreign import user32 "system:User32.lib"
|
||||
|
||||
@(default_calling_convention="system")
|
||||
@@ -32,6 +33,8 @@ foreign user32 {
|
||||
RegisterClassExW :: proc(^WNDCLASSEXW) -> ATOM ---
|
||||
UnregisterClassW :: proc(lpClassName: LPCWSTR, hInstance: HINSTANCE) -> BOOL ---
|
||||
|
||||
RegisterHotKey :: proc(hnwd: HWND, id: c.int, fsModifiers: UINT, vk: UINT) -> BOOL ---
|
||||
|
||||
CreateWindowExW :: proc(
|
||||
dwExStyle: DWORD,
|
||||
lpClassName: LPCWSTR,
|
||||
@@ -51,6 +54,7 @@ foreign user32 {
|
||||
IsWindowVisible :: proc(hwnd: HWND) -> BOOL ---
|
||||
IsWindowEnabled :: proc(hwnd: HWND) -> BOOL ---
|
||||
IsIconic :: proc(hwnd: HWND) -> BOOL ---
|
||||
IsZoomed :: proc(hwnd: HWND) -> BOOL ---
|
||||
BringWindowToTop :: proc(hWnd: HWND) -> BOOL ---
|
||||
GetTopWindow :: proc(hWnd: HWND) -> HWND ---
|
||||
SetForegroundWindow :: proc(hWnd: HWND) -> BOOL ---
|
||||
@@ -59,6 +63,8 @@ foreign user32 {
|
||||
UpdateWindow :: proc(hWnd: HWND) -> BOOL ---
|
||||
SetActiveWindow :: proc(hWnd: HWND) -> HWND ---
|
||||
GetActiveWindow :: proc() -> HWND ---
|
||||
SetFocus :: proc(hWnd: HWND) -> HWND ---
|
||||
GetFocus :: proc() -> HWND ---
|
||||
RedrawWindow :: proc(hwnd: HWND, lprcUpdate: LPRECT, hrgnUpdate: HRGN, flags: RedrawWindowFlags) -> BOOL ---
|
||||
SetParent :: proc(hWndChild: HWND, hWndNewParent: HWND) -> HWND ---
|
||||
SetPropW :: proc(hWnd: HWND, lpString: LPCWSTR, hData: HANDLE) -> BOOL ---
|
||||
@@ -207,6 +213,7 @@ foreign user32 {
|
||||
EnumDisplayMonitors :: proc(hdc: HDC, lprcClip: LPRECT, lpfnEnum: Monitor_Enum_Proc, dwData: LPARAM) -> BOOL ---
|
||||
|
||||
EnumWindows :: proc(lpEnumFunc: Window_Enum_Proc, lParam: LPARAM) -> BOOL ---
|
||||
EnumChildWindows :: proc(hWndParent: HWND, lpEnumFunc: Window_Enum_Proc, lParam: LPARAM) -> BOOL ---
|
||||
|
||||
IsProcessDPIAware :: proc() -> BOOL ---
|
||||
SetProcessDPIAware :: proc() -> BOOL ---
|
||||
@@ -548,11 +555,11 @@ RI_KEY_TERMSRV_SHADOW :: 0x10
|
||||
MOUSE_MOVE_RELATIVE :: 0x00
|
||||
MOUSE_MOVE_ABSOLUTE :: 0x01
|
||||
MOUSE_VIRTUAL_DESKTOP :: 0x02
|
||||
MOUSE_ATTRIUBTTES_CHANGED :: 0x04
|
||||
MOUSE_ATTRIBUTES_CHANGED :: 0x04
|
||||
MOUSE_MOVE_NOCOALESCE :: 0x08
|
||||
|
||||
RI_MOUSE_BUTTON_1_DOWN :: 0x0001
|
||||
RI_MOUSE_LEFT_BUTTON_DOWNS :: RI_MOUSE_BUTTON_1_DOWN
|
||||
RI_MOUSE_LEFT_BUTTON_DOWN :: RI_MOUSE_BUTTON_1_DOWN
|
||||
RI_MOUSE_BUTTON_1_UP :: 0x0002
|
||||
RI_MOUSE_LEFT_BUTTON_UP :: RI_MOUSE_BUTTON_1_UP
|
||||
RI_MOUSE_BUTTON_2_DOWN :: 0x0004
|
||||
@@ -842,3 +849,23 @@ FKF_CONFIRMHOTKEY :: 0x8
|
||||
FKF_HOTKEYSOUND :: 0x10
|
||||
FKF_INDICATOR :: 0x20
|
||||
FKF_CLICKON :: 0x40
|
||||
|
||||
NONCLIENTMETRICSW :: struct {
|
||||
cbSize: UINT,
|
||||
iBorderWidth: i32,
|
||||
iScrollWidth: i32,
|
||||
iScrollHeight: i32,
|
||||
iCaptionWidth: i32,
|
||||
iCaptionHeight: i32,
|
||||
lfCaptionFont: LOGFONTW,
|
||||
iSmCaptionWidth: i32,
|
||||
iSmCaptionHeight: i32,
|
||||
lfSmCaptionFont: LOGFONTW,
|
||||
iMenuWidth: i32,
|
||||
iMenuHeight: i32,
|
||||
lfMenuFont: LOGFONTW,
|
||||
lfStatusFont: LOGFONTW,
|
||||
lfMessageFont: LOGFONTW,
|
||||
iPaddedBorderWidth: i32,
|
||||
}
|
||||
LPNONCLIENTMETRICSW :: ^NONCLIENTMETRICSW
|
||||
|
||||
@@ -9,4 +9,5 @@ PMARGINS :: ^MARGINS
|
||||
@(default_calling_convention="system")
|
||||
foreign uxtheme {
|
||||
IsThemeActive :: proc() -> BOOL ---
|
||||
SetWindowTheme :: proc(hWnd: HWND, pszSubAppName, pszSubIdList: LPCWSTR) -> HRESULT ---
|
||||
}
|
||||
|
||||
@@ -687,10 +687,14 @@ EM_GETAUTOURLDETECT :: 0x045c
|
||||
TB_GETSTRINGA :: 0x045c
|
||||
EM_SETPALETTE :: 0x045d
|
||||
EM_GETTEXTEX :: 0x045e
|
||||
TB_SETHOTITEM2 :: 0x045e
|
||||
EM_GETTEXTLENGTHEX :: 0x045f
|
||||
EM_SHOWSCROLLBAR :: 0x0460
|
||||
TB_SETLISTGAP :: 0x0460
|
||||
EM_SETTEXTEX :: 0x0461
|
||||
TB_GETIMAGELISTCOUNT :: 0x0462
|
||||
TAPI_REPLY :: 0x0463
|
||||
TB_GETIDEALSIZE :: 0x0463
|
||||
ACM_OPENA :: 0x0464
|
||||
BFFM_SETSTATUSTEXTA :: 0x0464
|
||||
CDM_FIRST :: 0x0464
|
||||
@@ -704,6 +708,7 @@ CDM_GETFILEPATH :: 0x0465
|
||||
EM_GETPUNCTUATION :: 0x0465
|
||||
IPM_SETADDRESS :: 0x0465
|
||||
PSM_SETCURSEL :: 0x0465
|
||||
TB_GETMETRICS :: 0x0465
|
||||
UDM_SETRANGE :: 0x0465
|
||||
WM_CHOOSEFONT_SETLOGFONT :: 0x0465
|
||||
ACM_STOP :: 0x0466
|
||||
@@ -712,6 +717,7 @@ CDM_GETFOLDERPATH :: 0x0466
|
||||
EM_SETWORDWRAPMODE :: 0x0466
|
||||
IPM_GETADDRESS :: 0x0466
|
||||
PSM_REMOVEPAGE :: 0x0466
|
||||
TB_SETMETRICS :: 0x0466
|
||||
UDM_GETRANGE :: 0x0466
|
||||
WM_CAP_SET_CALLBACK_ERRORW :: 0x0466
|
||||
WM_CHOOSEFONT_SETFLAGS :: 0x0466
|
||||
@@ -721,6 +727,7 @@ CDM_GETFOLDERIDLIST :: 0x0467
|
||||
EM_GETWORDWRAPMODE :: 0x0467
|
||||
IPM_SETRANGE :: 0x0467
|
||||
PSM_ADDPAGE :: 0x0467
|
||||
TB_GETITEMDROPDOWNRECT :: 0x0467
|
||||
UDM_SETPOS :: 0x0467
|
||||
WM_CAP_SET_CALLBACK_STATUSW :: 0x0467
|
||||
BFFM_SETSTATUSTEXTW :: 0x0468
|
||||
@@ -728,11 +735,13 @@ CDM_SETCONTROLTEXT :: 0x0468
|
||||
EM_SETIMECOLOR :: 0x0468
|
||||
IPM_SETFOCUS :: 0x0468
|
||||
PSM_CHANGED :: 0x0468
|
||||
TB_SETPRESSEDIMAGELIST :: 0x0468
|
||||
UDM_GETPOS :: 0x0468
|
||||
CDM_HIDECONTROL :: 0x0469
|
||||
EM_GETIMECOLOR :: 0x0469
|
||||
IPM_ISBLANK :: 0x0469
|
||||
PSM_RESTARTWINDOWS :: 0x0469
|
||||
TB_GETPRESSEDIMAGELIST :: 0x0469
|
||||
UDM_SETBUDDY :: 0x0469
|
||||
CDM_SETDEFEXT :: 0x046a
|
||||
EM_SETIMEOPTIONS :: 0x046a
|
||||
@@ -915,6 +924,10 @@ FM_GETDRIVEINFOW :: 0x0611
|
||||
FM_GETFILESELW :: 0x0614
|
||||
FM_GETFILESELLFNW :: 0x0615
|
||||
WLX_WM_SAS :: 0x0659
|
||||
LM_HITTEST :: 0x0700
|
||||
LM_GETIDEALHEIGHT :: 0x0701
|
||||
LM_SETITEM :: 0x0702
|
||||
LM_GETITEM :: 0x0703
|
||||
SM_GETSELCOUNT :: 0x07e8
|
||||
UM_GETSELCOUNT :: 0x07e8
|
||||
WM_CPL_LAUNCH :: 0x07e8
|
||||
@@ -1011,6 +1024,7 @@ LVM_GETITEMW :: 0x104b
|
||||
LVM_SETITEMW :: 0x104c
|
||||
LVM_INSERTITEMW :: 0x104d
|
||||
LVM_GETTOOLTIPS :: 0x104e
|
||||
LVM_SORTITEMSEX :: 0x1051
|
||||
LVM_FINDITEMW :: 0x1053
|
||||
LVM_GETSTRINGWIDTHW :: 0x1057
|
||||
LVM_GETCOLUMNW :: 0x105f
|
||||
@@ -1065,7 +1079,143 @@ LVM_GETFOOTERITEM :: 0x10d0
|
||||
LVM_GETITEMINDEXRECT :: 0x10d1
|
||||
LVM_SETITEMINDEXSTATE :: 0x10d2
|
||||
LVM_GETNEXTITEMINDEX :: 0x10d3
|
||||
TV_FIRST :: 0x1100
|
||||
TVM_INSERTITEMA :: (TV_FIRST+0)
|
||||
TVM_DELETEITEM :: (TV_FIRST+1)
|
||||
TVM_EXPAND :: (TV_FIRST+2)
|
||||
TVM_GETITEMRECT :: (TV_FIRST+4)
|
||||
TVM_GETCOUNT :: (TV_FIRST+5)
|
||||
TVM_GETINDENT :: (TV_FIRST+6)
|
||||
TVM_SETINDENT :: (TV_FIRST+7)
|
||||
TVM_GETIMAGELIST :: (TV_FIRST+8)
|
||||
TVM_SETIMAGELIST :: (TV_FIRST+9)
|
||||
TVM_GETNEXTITEM :: (TV_FIRST+10)
|
||||
TVM_SELECTITEM :: (TV_FIRST+11)
|
||||
TVM_GETITEMA :: (TV_FIRST+12)
|
||||
TVM_SETITEMA :: (TV_FIRST+13)
|
||||
TVM_EDITLABELA :: (TV_FIRST+14)
|
||||
TVM_GETEDITCONTROL :: (TV_FIRST+15)
|
||||
TVM_GETVISIBLECOUNT :: (TV_FIRST+16)
|
||||
TVM_HITTEST :: (TV_FIRST+17)
|
||||
TVM_CREATEDRAGIMAGE :: (TV_FIRST+18)
|
||||
TVM_SORTCHILDREN :: (TV_FIRST+19)
|
||||
TVM_ENSUREVISIBLE :: (TV_FIRST+20)
|
||||
TVM_SORTCHILDRENCB :: (TV_FIRST+21)
|
||||
TVM_ENDEDITLABELNOW :: (TV_FIRST+22)
|
||||
TVM_GETISEARCHSTRINGA :: (TV_FIRST+23)
|
||||
TVM_SETTOOLTIPS :: (TV_FIRST+24)
|
||||
TVM_GETTOOLTIPS :: (TV_FIRST+25)
|
||||
TVM_SETINSERTMARK :: (TV_FIRST+26)
|
||||
TVM_SETUNICODEFORMAT :: CCM_SETUNICODEFORMAT
|
||||
TVM_GETUNICODEFORMAT :: CCM_GETUNICODEFORMAT
|
||||
TVM_SETITEMHEIGHT :: (TV_FIRST+27)
|
||||
TVM_GETITEMHEIGHT :: (TV_FIRST+28)
|
||||
TVM_SETBKCOLOR :: (TV_FIRST+29)
|
||||
TVM_SETTEXTCOLOR :: (TV_FIRST+30)
|
||||
TVM_GETBKCOLOR :: (TV_FIRST+31)
|
||||
TVM_GETTEXTCOLOR :: (TV_FIRST+32)
|
||||
TVM_SETSCROLLTIME :: (TV_FIRST+33)
|
||||
TVM_GETSCROLLTIME :: (TV_FIRST+34)
|
||||
TVM_SETINSERTMARKCOLOR :: (TV_FIRST+37)
|
||||
TVM_GETINSERTMARKCOLOR :: (TV_FIRST+38)
|
||||
TVM_GETITEMSTATE :: (TV_FIRST+39)
|
||||
TVM_SETLINECOLOR :: (TV_FIRST+40)
|
||||
TVM_GETLINECOLOR :: (TV_FIRST+41)
|
||||
TVM_MAPACCIDTOHTREEITEM :: (TV_FIRST+42)
|
||||
TVM_MAPHTREEITEMTOACCID :: (TV_FIRST+43)
|
||||
TVM_INSERTITEMW :: (TV_FIRST+50)
|
||||
TVM_GETITEMW :: (TV_FIRST+62)
|
||||
TVM_SETITEMW :: (TV_FIRST+63)
|
||||
TVM_GETISEARCHSTRINGW :: (TV_FIRST+64)
|
||||
TVM_EDITLABELW :: (TV_FIRST+65)
|
||||
HDM_FIRST :: 0x1200
|
||||
HDM_GETITEMCOUNT :: (HDM_FIRST+0)
|
||||
HDM_INSERTITEMA :: (HDM_FIRST+1)
|
||||
HDM_DELETEITEM :: (HDM_FIRST+2)
|
||||
HDM_GETITEMA :: (HDM_FIRST+3)
|
||||
HDM_SETITEMA :: (HDM_FIRST+4)
|
||||
HDM_LAYOUT :: (HDM_FIRST+5)
|
||||
HDM_HITTEST :: (HDM_FIRST+6)
|
||||
HDM_GETITEMRECT :: (HDM_FIRST+7)
|
||||
HDM_SETIMAGELIST :: (HDM_FIRST+8)
|
||||
HDM_GETIMAGELIST :: (HDM_FIRST+9)
|
||||
HDM_INSERTITEMW :: (HDM_FIRST+10)
|
||||
HDM_GETITEMW :: (HDM_FIRST+11)
|
||||
HDM_SETITEMW :: (HDM_FIRST+12)
|
||||
HDM_ORDERTOINDEX :: (HDM_FIRST+15)
|
||||
HDM_CREATEDRAGIMAGE :: (HDM_FIRST+16)
|
||||
HDM_GETORDERARRAY :: (HDM_FIRST+17)
|
||||
HDM_SETORDERARRAY :: (HDM_FIRST+18)
|
||||
HDM_SETHOTDIVIDER :: (HDM_FIRST+19)
|
||||
HDM_SETBITMAPMARGIN :: (HDM_FIRST+20)
|
||||
HDM_GETBITMAPMARGIN :: (HDM_FIRST+21)
|
||||
HDM_SETFILTERCHANGETIMEOUT :: (HDM_FIRST+22)
|
||||
HDM_SETUNICODEFORMAT :: CCM_SETUNICODEFORMAT
|
||||
HDM_GETUNICODEFORMAT :: CCM_GETUNICODEFORMAT
|
||||
HDM_EDITFILTER :: (HDM_FIRST+23)
|
||||
HDM_CLEARFILTER :: (HDM_FIRST+24)
|
||||
TCM_FIRST :: 0x1300
|
||||
TCM_GETIMAGELIST :: (TCM_FIRST+2)
|
||||
TCM_SETIMAGELIST :: (TCM_FIRST+3)
|
||||
TCM_GETITEMCOUNT :: (TCM_FIRST+4)
|
||||
TCM_GETITEMA :: (TCM_FIRST+5)
|
||||
TCM_SETITEMA :: (TCM_FIRST+6)
|
||||
TCM_INSERTITEMA :: (TCM_FIRST+7)
|
||||
TCM_DELETEITEM :: (TCM_FIRST+8)
|
||||
TCM_DELETEALLITEMS :: (TCM_FIRST+9)
|
||||
TCM_GETITEMRECT :: (TCM_FIRST+10)
|
||||
TCM_GETCURSEL :: (TCM_FIRST+11)
|
||||
TCM_SETCURSEL :: (TCM_FIRST+12)
|
||||
TCM_HITTEST :: (TCM_FIRST+13)
|
||||
TCM_SETITEMEXTRA :: (TCM_FIRST+14)
|
||||
TCM_ADJUSTRECT :: (TCM_FIRST+40)
|
||||
TCM_SETITEMSIZE :: (TCM_FIRST+41)
|
||||
TCM_REMOVEIMAGE :: (TCM_FIRST+42)
|
||||
TCM_SETPADDING :: (TCM_FIRST+43)
|
||||
TCM_GETROWCOUNT :: (TCM_FIRST+44)
|
||||
TCM_GETTOOLTIPS :: (TCM_FIRST+45)
|
||||
TCM_SETTOOLTIPS :: (TCM_FIRST+46)
|
||||
TCM_GETCURFOCUS :: (TCM_FIRST+47)
|
||||
TCM_SETCURFOCUS :: (TCM_FIRST+48)
|
||||
TCM_SETMINTABWIDTH :: (TCM_FIRST+49)
|
||||
TCM_DESELECTALL :: (TCM_FIRST+50)
|
||||
TCM_HIGHLIGHTITEM :: (TCM_FIRST+51)
|
||||
TCM_SETEXTENDEDSTYLE :: (TCM_FIRST+52)
|
||||
TCM_GETEXTENDEDSTYLE :: (TCM_FIRST+53)
|
||||
TCM_SETUNICODEFORMAT :: CCM_SETUNICODEFORMAT
|
||||
TCM_GETUNICODEFORMAT :: CCM_GETUNICODEFORMAT
|
||||
TCM_GETITEMW :: (TCM_FIRST+60)
|
||||
TCM_SETITEMW :: (TCM_FIRST+61)
|
||||
TCM_INSERTITEMW :: (TCM_FIRST+62)
|
||||
PGM_FIRST :: 0x1400
|
||||
PGM_SETCHILD :: (PGM_FIRST+1)
|
||||
PGM_RECALCSIZE :: (PGM_FIRST+2)
|
||||
PGM_FORWARDMOUSE :: (PGM_FIRST+3)
|
||||
PGM_SETBKCOLOR :: (PGM_FIRST+4)
|
||||
PGM_GETBKCOLOR :: (PGM_FIRST+5)
|
||||
PGM_SETBORDER :: (PGM_FIRST+6)
|
||||
PGM_GETBORDER :: (PGM_FIRST+7)
|
||||
PGM_SETPOS :: (PGM_FIRST+8)
|
||||
PGM_GETPOS :: (PGM_FIRST+9)
|
||||
PGM_SETBUTTONSIZE :: (PGM_FIRST+10)
|
||||
PGM_GETBUTTONSIZE :: (PGM_FIRST+11)
|
||||
PGM_GETBUTTONSTATE :: (PGM_FIRST+12)
|
||||
PGM_GETDROPTARGET :: CCM_GETDROPTARGET
|
||||
ECM_FIRST :: 0x1500
|
||||
EM_SETCUEBANNER :: ECM_FIRST + 0x0001
|
||||
EM_GETCUEBANNER :: ECM_FIRST + 0x0002
|
||||
EM_SHOWBALLOONTIP :: ECM_FIRST + 0x0003
|
||||
EM_HIDEBALLOONTIP :: ECM_FIRST + 0x0004
|
||||
EM_SETHILITE :: ECM_FIRST + 0x0005
|
||||
EM_GETHILITE :: ECM_FIRST + 0x0006
|
||||
EM_NOSETFOCUS :: ECM_FIRST + 0x0007
|
||||
EM_TAKEFOCUS :: ECM_FIRST + 0x0008
|
||||
BCM_FIRST :: 0x1600
|
||||
BCM_GETIDEALSIZE :: BCM_FIRST + 0x0001
|
||||
BCM_SETIMAGELIST :: BCM_FIRST + 0x0002
|
||||
BCM_GETIMAGELIST :: BCM_FIRST + 0x0003
|
||||
BCM_SETTEXTMARGIN :: BCM_FIRST + 0x0004
|
||||
BCM_GETTEXTMARGIN :: BCM_FIRST + 0x0005
|
||||
BCM_SETDROPDOWNSTATE :: BCM_FIRST + 0x0006
|
||||
BCM_SETSPLITINFO :: BCM_FIRST + 0x0007
|
||||
BCM_GETSPLITINFO :: BCM_FIRST + 0x0008
|
||||
@@ -1073,9 +1223,29 @@ BCM_SETNOTE :: BCM_FIRST + 0x0009
|
||||
BCM_GETNOTE :: BCM_FIRST + 0x000A
|
||||
BCM_GETNOTELENGTH :: BCM_FIRST + 0x000B
|
||||
BCM_SETSHIELD :: BCM_FIRST + 0x000C
|
||||
CBM_FIRST :: 0x1700
|
||||
CB_SETMINVISIBLE :: CBM_FIRST + 0x0001
|
||||
CB_GETMINVISIBLE :: CBM_FIRST + 0x0002
|
||||
CCM_FIRST :: 0x2000
|
||||
CCM_LAST :: (CCM_FIRST+0x200)
|
||||
CCM_SETBKCOLOR :: (CCM_FIRST+1)
|
||||
CCM_SETCOLORSCHEME :: (CCM_FIRST+2)
|
||||
CCM_GETCOLORSCHEME :: (CCM_FIRST+3)
|
||||
CCM_GETDROPTARGET :: (CCM_FIRST+4)
|
||||
CCM_SETUNICODEFORMAT :: (CCM_FIRST+5)
|
||||
CCM_GETUNICODEFORMAT :: (CCM_FIRST+6)
|
||||
CCM_SETVERSION :: (CCM_FIRST+7)
|
||||
CCM_GETVERSION :: (CCM_FIRST+8)
|
||||
CCM_SETNOTIFYWINDOW :: (CCM_FIRST+9)
|
||||
CCM_SETWINDOWTHEME :: (CCM_FIRST+11)
|
||||
CCM_DPISCALE :: (CCM_FIRST+12)
|
||||
OCM__BASE :: 0x2000
|
||||
LVM_SETUNICODEFORMAT :: 0x2005
|
||||
SB_SETUNICODEFORMAT :: 0x2005
|
||||
LVM_GETUNICODEFORMAT :: 0x2006
|
||||
SB_GETUNICODEFORMAT :: 0x2006
|
||||
CBEM_SETWINDOWTHEME :: 0x200b
|
||||
TB_SETWINDOWTHEME :: 0x200b
|
||||
OCM_CTLCOLOR :: 0x2019
|
||||
OCM_DRAWITEM :: 0x202b
|
||||
OCM_MEASUREITEM :: 0x202c
|
||||
|
||||
@@ -91,6 +91,7 @@ foreign ws2_32 {
|
||||
WSACleanup :: proc() -> c_int ---
|
||||
// [MS-Docs](https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsagetlasterror)
|
||||
WSAGetLastError :: proc() -> c_int ---
|
||||
WSASetLastError :: proc(err: c_int) ---
|
||||
// [MS-Docs](https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsapoll)
|
||||
WSAPoll :: proc(fdArray: ^WSA_POLLFD, fds: c_ulong, timeout: c_int) -> c_int ---
|
||||
// [MS-Docs](https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsaduplicatesocketw)
|
||||
|
||||
@@ -0,0 +1,210 @@
|
||||
#+build windows
|
||||
package sys_windows
|
||||
|
||||
foreign import "system:xinput.lib"
|
||||
|
||||
// Device types available in XINPUT_CAPABILITIES
|
||||
// Correspond to XINPUT_DEVTYPE_...
|
||||
XINPUT_DEVTYPE :: enum BYTE {
|
||||
GAMEPAD = 0x01,
|
||||
}
|
||||
|
||||
// Device subtypes available in XINPUT_CAPABILITIES
|
||||
// Correspond to XINPUT_DEVSUBTYPE_...
|
||||
XINPUT_DEVSUBTYPE :: enum BYTE {
|
||||
UNKNOWN = 0x00,
|
||||
GAMEPAD = 0x01,
|
||||
WHEEL = 0x02,
|
||||
ARCADE_STICK = 0x03,
|
||||
FLIGHT_STICK = 0x04,
|
||||
DANCE_PAD = 0x05,
|
||||
GUITAR = 0x06,
|
||||
GUITAR_ALTERNATE = 0x07,
|
||||
DRUM_KIT = 0x08,
|
||||
GUITAR_BASS = 0x0B,
|
||||
ARCADE_PAD = 0x13,
|
||||
}
|
||||
|
||||
// Flags for XINPUT_CAPABILITIES
|
||||
// Correspond to log2(XINPUT_CAPS_...)
|
||||
XINPUT_CAP :: enum WORD {
|
||||
FFB_SUPPORTED = 0,
|
||||
WIRELESS = 1,
|
||||
VOICE_SUPPORTED = 2,
|
||||
PMD_SUPPORTED = 3,
|
||||
NO_NAVIGATION = 4,
|
||||
}
|
||||
XINPUT_CAPS :: distinct bit_set[XINPUT_CAP;WORD]
|
||||
|
||||
// Constants for gamepad buttons
|
||||
// Correspond to log2(XINPUT_GAMEPAD_...)
|
||||
XINPUT_GAMEPAD_BUTTON_BIT :: enum WORD {
|
||||
DPAD_UP = 0,
|
||||
DPAD_DOWN = 1,
|
||||
DPAD_LEFT = 2,
|
||||
DPAD_RIGHT = 3,
|
||||
START = 4,
|
||||
BACK = 5,
|
||||
LEFT_THUMB = 6,
|
||||
RIGHT_THUMB = 7,
|
||||
LEFT_SHOULDER = 8,
|
||||
RIGHT_SHOULDER = 9,
|
||||
A = 12,
|
||||
B = 13,
|
||||
X = 14,
|
||||
Y = 15,
|
||||
}
|
||||
XINPUT_GAMEPAD_BUTTON :: distinct bit_set[XINPUT_GAMEPAD_BUTTON_BIT;WORD]
|
||||
|
||||
// Gamepad thresholds
|
||||
XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE: SHORT : 7849
|
||||
XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE: SHORT : 8689
|
||||
XINPUT_GAMEPAD_TRIGGER_THRESHOLD: SHORT : 30
|
||||
|
||||
// Flags to pass to XInputGetCapabilities
|
||||
// Corresponds to log2(XINPUT_FLAG_...)
|
||||
XINPUT_FLAG_BIT :: enum WORD {
|
||||
GAMEPAD = 0,
|
||||
}
|
||||
XINPUT_FLAG :: distinct bit_set[XINPUT_FLAG_BIT;DWORD]
|
||||
|
||||
// Devices that support batteries
|
||||
// Corresponds to BATTERY_DEVTYPE_...
|
||||
BATTERY_DEVTYPE :: enum BYTE {
|
||||
GAMEPAD = 0x00,
|
||||
HEADSET = 0x01,
|
||||
}
|
||||
|
||||
// Flags for battery status level
|
||||
// Correspond to BATTERY_TYPE_...
|
||||
BATTERY_TYPE :: enum BYTE {
|
||||
DISCONNECTED = 0x00, // This device is not connected
|
||||
WIRED = 0x01, // Wired device, no battery
|
||||
ALKALINE = 0x02, // Alkaline battery source
|
||||
NIMH = 0x03, // Nickel Metal Hydride battery source
|
||||
UNKNOWN = 0xFF, // Cannot determine the battery type
|
||||
}
|
||||
|
||||
// These are only valid for wireless, connected devices, with known battery types
|
||||
// The amount of use time remaining depends on the type of device.
|
||||
// Correspond to BATTERY_LEVEL_...
|
||||
BATTERY_LEVEL :: enum BYTE {
|
||||
EMPTY = 0x00,
|
||||
LOW = 0x01,
|
||||
MEDIUM = 0x02,
|
||||
FULL = 0x03,
|
||||
}
|
||||
|
||||
// User index definitions
|
||||
|
||||
// Index of the gamer associated with the device
|
||||
XUSER :: enum DWORD {
|
||||
One = 0,
|
||||
Two = 1,
|
||||
Three = 2,
|
||||
Four = 3,
|
||||
Any = 0x000000FF, // Can be only used with XInputGetKeystroke
|
||||
}
|
||||
|
||||
XUSER_MAX_COUNT :: 4
|
||||
|
||||
// Codes returned for the gamepad keystroke
|
||||
// Corresponds to VK_PAD_...
|
||||
VK_PAD :: enum WORD {
|
||||
A = 0x5800,
|
||||
B = 0x5801,
|
||||
X = 0x5802,
|
||||
Y = 0x5803,
|
||||
RSHOULDER = 0x5804,
|
||||
LSHOULDER = 0x5805,
|
||||
LTRIGGER = 0x5806,
|
||||
RTRIGGER = 0x5807,
|
||||
DPAD_UP = 0x5810,
|
||||
DPAD_DOWN = 0x5811,
|
||||
DPAD_LEFT = 0x5812,
|
||||
DPAD_RIGHT = 0x5813,
|
||||
START = 0x5814,
|
||||
BACK = 0x5815,
|
||||
LTHUMB_PRESS = 0x5816,
|
||||
RTHUMB_PRESS = 0x5817,
|
||||
LTHUMB_UP = 0x5820,
|
||||
LTHUMB_DOWN = 0x5821,
|
||||
LTHUMB_RIGHT = 0x5822,
|
||||
LTHUMB_LEFT = 0x5823,
|
||||
LTHUMB_UPLEFT = 0x5824,
|
||||
LTHUMB_UPRIGHT = 0x5825,
|
||||
LTHUMB_DOWNRIGHT = 0x5826,
|
||||
LTHUMB_DOWNLEFT = 0x5827,
|
||||
RTHUMB_UP = 0x5830,
|
||||
RTHUMB_DOWN = 0x5831,
|
||||
RTHUMB_RIGHT = 0x5832,
|
||||
RTHUMB_LEFT = 0x5833,
|
||||
RTHUMB_UPLEFT = 0x5834,
|
||||
RTHUMB_UPRIGHT = 0x5835,
|
||||
RTHUMB_DOWNRIGHT = 0x5836,
|
||||
RTHUMB_DOWNLEFT = 0x5837,
|
||||
}
|
||||
|
||||
// Flags used in XINPUT_KEYSTROKE
|
||||
// Correspond to log2(XINPUT_KEYSTROKE_...)
|
||||
XINPUT_KEYSTROKE_BIT :: enum WORD {
|
||||
KEYDOWN = 0,
|
||||
KEYUP = 1,
|
||||
REPEAT = 2,
|
||||
}
|
||||
XINPUT_KEYSTROKES :: distinct bit_set[XINPUT_KEYSTROKE_BIT;WORD]
|
||||
|
||||
// Structures used by XInput APIs
|
||||
XINPUT_GAMEPAD :: struct {
|
||||
wButtons: XINPUT_GAMEPAD_BUTTON,
|
||||
bLeftTrigger: BYTE,
|
||||
bRightTrigger: BYTE,
|
||||
sThumbLX: SHORT,
|
||||
sThumbLY: SHORT,
|
||||
sThumbRX: SHORT,
|
||||
sThumbRY: SHORT,
|
||||
}
|
||||
|
||||
XINPUT_STATE :: struct {
|
||||
dwPacketNumber: DWORD,
|
||||
Gamepad: XINPUT_GAMEPAD,
|
||||
}
|
||||
|
||||
XINPUT_VIBRATION :: struct {
|
||||
wLeftMotorSpeed: WORD,
|
||||
wRightMotorSpeed: WORD,
|
||||
}
|
||||
|
||||
XINPUT_CAPABILITIES :: struct {
|
||||
Type: XINPUT_DEVTYPE,
|
||||
SubType: XINPUT_DEVSUBTYPE,
|
||||
Flags: XINPUT_CAPS,
|
||||
Gamepad: XINPUT_GAMEPAD,
|
||||
Vibration: XINPUT_VIBRATION,
|
||||
}
|
||||
|
||||
XINPUT_BATTERY_INFORMATION :: struct {
|
||||
BatteryType: BATTERY_TYPE,
|
||||
BatteryLevel: BATTERY_LEVEL,
|
||||
}
|
||||
|
||||
XINPUT_KEYSTROKE :: struct {
|
||||
VirtualKey: VK_PAD,
|
||||
Unicode: WCHAR,
|
||||
Flags: XINPUT_KEYSTROKES,
|
||||
UserIndex: XUSER,
|
||||
HidCode: BYTE,
|
||||
}
|
||||
|
||||
// XInput APIs
|
||||
@(default_calling_convention = "system")
|
||||
foreign xinput {
|
||||
XInputGetState :: proc(user: XUSER, pState: ^XINPUT_STATE) -> System_Error ---
|
||||
XInputSetState :: proc(user: XUSER, pVibration: ^XINPUT_VIBRATION) -> System_Error ---
|
||||
XInputGetCapabilities :: proc(user: XUSER, dwFlags: XINPUT_FLAG, pCapabilities: ^XINPUT_CAPABILITIES) -> System_Error ---
|
||||
XInputEnable :: proc(enable: BOOL) ---
|
||||
XInputGetAudioDeviceIds :: proc(user: XUSER, pRenderDeviceId: LPWSTR, pRenderCount: ^UINT, pCaptureDeviceId: LPWSTR, pCaptureCount: ^UINT) -> System_Error ---
|
||||
XInputGetBatteryInformation :: proc(user: XUSER, devType: BATTERY_DEVTYPE, pBatteryInformation: ^XINPUT_BATTERY_INFORMATION) -> System_Error ---
|
||||
XInputGetKeystroke :: proc(user: XUSER, dwReserved: DWORD, pKeystroke: ^XINPUT_KEYSTROKE) -> System_Error ---
|
||||
XInputGetDSoundAudioDeviceGuids :: proc(user: XUSER, pDSoundRenderGuid: ^GUID, pDSoundCaptureGuid: ^GUID) -> System_Error ---
|
||||
}
|
||||
Reference in New Issue
Block a user