peachsim 0.1.1667 → 0.1.1673
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/cli/bridge-flow-runner.ts +4 -1
- package/cli/commands/coverage-swift.ts +291 -0
- package/cli/commands/coverage.ts +168 -24
- package/cli/commands/diagnose.ts +1 -19
- package/cli/commands/react.ts +3 -18
- package/cli/commands/screenshot.ts +1 -1
- package/cli/commands/screenshots-capture.ts +1 -1
- package/cli/drivers/playwright-provisioning.ts +1 -4
- package/cli/drivers/playwright.ts +15 -1
- package/cli/scene-video.ts +1 -1
- package/cli/ui.ts +20 -0
- package/cli/ws-bridge.ts +7 -36
- package/detox/frame-identity.cjs +21 -0
- package/detox/frame-identity.d.cts +6 -0
- package/detox/index.ts +39 -33
- package/detox/jest-environment.cjs +4 -1
- package/detox/jest-setup-after-env.cjs +0 -4
- package/detox/navigation-lifecycle.ts +2 -2
- package/detox/proof-observer.ts +126 -0
- package/dist-lib/agent-daemon-client.cjs +29 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +10 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/bundle-channel.cjs +530 -154
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +5074 -7353
- package/dist-lib/detox/jest-environment.cjs +4 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +578 -151
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +660 -192
- package/dist-lib/host/fetch-proxy-handler.cjs +2 -2
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +206 -6
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +10 -1
- package/dist-lib/metro-production-bundle.mjs +12 -1
- package/dist-lib/metro.cjs +155 -5
- package/dist-lib/native-app-identity-project.cjs +43 -5
- package/dist-lib/native-app-identity-project.mjs +43 -5
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +21 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +73 -27
- package/dist-lib/public-origins-lib-static.json +1 -1
- package/dist-lib/public-origins-lib.json +563 -183
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/reap-browser.cjs +964 -0
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +963 -521
- package/dist-lib/swift-compile.cjs +276 -86
- package/dist-lib/swift-compile.mjs +276 -86
- package/dist-lib/swift-package.cjs +34 -4
- package/dist-lib/swift-package.mjs +33 -4
- package/dist-lib/swift-submit.cjs +2 -2
- package/dist-lib/swift-submit.mjs +2 -2
- package/dist-lib/swift-toolchain.cjs +25 -44
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +579 -113
- package/dist-lib/vite.cjs +61 -2
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/engine/clipboardContract.d.ts +7 -0
- package/dist-types/packages/peach-engine/src/engine/glass-material.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/engine/inspect-outline.d.ts +2 -1
- package/dist-types/packages/peach-engine/src/engine/liquid-glass.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/paint-boundary.d.ts +3 -1
- package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +7 -0
- package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime-kind.d.ts +24 -0
- package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +4 -2
- package/dist-types/packages/peach-engine/src/settings/devices.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/clipboardBridgeContract.d.ts +18 -0
- package/dist-types/packages/peach-globals/src/index.d.ts +1 -1
- package/dist-types/packages/peach-globals/src/nodeContract.d.ts +1 -0
- package/dist-types/packages/peach-kit/src/capabilities.d.ts +1 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFString.h +2 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +36 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStore.h +439 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStoreCopySpecific.h +216 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStoreKey.h +267 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetwork.h +204 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetworkConfiguration.h +1393 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetworkConnection.h +568 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetworkReachability.h +369 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCPreferences.h +473 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCPreferencesPath.h +179 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCPreferencesSetSpecific.h +95 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCSchemaDefinitions.h +2395 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SystemConfiguration.h +184 -0
- package/sdk/ios/usr/include/libkern/OSByteOrder.h +315 -0
- package/sdk/ios/usr/include/libkern/machine/OSByteOrder.h +147 -0
- package/src/bridge-contract.ts +42 -0
- package/src/chromium-admission.ts +196 -0
- package/src/host/bridge-host.ts +6 -43
- package/src/launch-deadline.ts +74 -0
- package/src/nitro-adapter.lock.json +3 -3
- package/src/profiles.ts +21 -0
- package/src/react-native-coverage/capability-reference-resolution.ts +402 -0
- package/src/react-native-coverage/capability-source-references.ts +1296 -0
- package/src/react-native-coverage/native-typescript-parser.ts +74 -0
- package/src/react-native-coverage/project-aliases.ts +207 -0
- package/src/react-native-coverage/verified-reach.ts +47 -0
- package/src/reap-browser.ts +1019 -0
- package/src/skills/builtin/a11y-review.ts +1 -1
- package/src/skills/builtin/perf-profile.ts +1 -1
- package/src/skills/builtin/screenshot-all.ts +1 -1
- package/src/skills/builtin/visual-diff.ts +1 -1
- package/src/swift-compile.ts +107 -56
- package/src/swift-coverage/indexdump.ts +80 -0
- package/src/swift-coverage/indexing.ts +147 -0
- package/src/swift-coverage/package.ts +230 -0
- package/src/swift-coverage/provenance.ts +47 -0
- package/src/swift-coverage/reader.ts +81 -0
- package/src/swift-coverage/source.ts +252 -0
- package/src/swift-coverage/types.ts +58 -0
- package/src/swift-coverage/xcode-assets.ts +175 -0
- package/src/swift-coverage/xcode-bridging.ts +160 -0
- package/src/swift-coverage/xcode-packages.ts +251 -0
- package/src/swift-coverage/xcode-strings.ts +78 -0
- package/src/swift-coverage/xcode.ts +656 -0
- package/src/swift-distribution.lock.json +8 -8
- package/src/swift-host.ts +21 -1
- package/src/swift-objc-import.ts +191 -27
- package/src/swift-objc-standin.ts +4 -2
- package/src/swift-package-manifest.ts +134 -13
- package/src/swift-package.ts +46 -4
- package/src/swift-submit.ts +2 -1
- package/src/swift-toolchain.ts +36 -61
- package/src/worker-system-chunks.ts +3 -10
- package/src/xcode-project.ts +5 -5
- package/detox/attempt-events.cjs +0 -914
- package/detox/attempt-events.d.cts +0 -113
- package/detox/motion-change.cjs +0 -524
- package/detox/motion-change.d.cts +0 -140
- package/detox/motion-leg-starts.cjs +0 -20
- package/detox/motion-leg-starts.d.cts +0 -8
- package/detox/proof-frame.cjs +0 -190
- package/detox/record-block-execution.cjs +0 -78
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2000-2004, 2006, 2008-2010, 2012, 2015, 2017, 2018, 2021 Apple Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* @APPLE_LICENSE_HEADER_START@
|
|
5
|
+
*
|
|
6
|
+
* This file contains Original Code and/or Modifications of Original Code
|
|
7
|
+
* as defined in and that are subject to the Apple Public Source License
|
|
8
|
+
* Version 2.0 (the 'License'). You may not use this file except in
|
|
9
|
+
* compliance with the License. Please obtain a copy of the License at
|
|
10
|
+
* http://www.opensource.apple.com/apsl/ and read it before using this
|
|
11
|
+
* file.
|
|
12
|
+
*
|
|
13
|
+
* The Original Code and all software distributed under the License are
|
|
14
|
+
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
|
15
|
+
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
|
16
|
+
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
|
18
|
+
* Please see the License for the specific language governing rights and
|
|
19
|
+
* limitations under the License.
|
|
20
|
+
*
|
|
21
|
+
* @APPLE_LICENSE_HEADER_END@
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
#ifndef _SYSTEMCONFIGURATION_H
|
|
25
|
+
#define _SYSTEMCONFIGURATION_H
|
|
26
|
+
|
|
27
|
+
#include <os/availability.h>
|
|
28
|
+
#include <sys/cdefs.h>
|
|
29
|
+
#include <CoreFoundation/CoreFoundation.h>
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
/*!
|
|
33
|
+
@header SystemConfiguration
|
|
34
|
+
@discussion The System Configuration framework provides access to the
|
|
35
|
+
data used to configure a running system. The APIs provided
|
|
36
|
+
by this framework communicate with the configd daemon.
|
|
37
|
+
|
|
38
|
+
The configd daemon manages a dynamic store reflecting the
|
|
39
|
+
desired configuration settings as well as the current state
|
|
40
|
+
of the system. The daemon provides a notification mechanism
|
|
41
|
+
for processes that need to be aware of changes made to the
|
|
42
|
+
data. Lastly, the daemon loads a number of bundles (or
|
|
43
|
+
plug-ins) that monitor low-level kernel events and, through
|
|
44
|
+
a set of policy modules, keep the state data up to date.
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
/*!
|
|
48
|
+
@enum Error codes
|
|
49
|
+
@discussion Returned error codes.
|
|
50
|
+
@constant kSCStatusOK Success
|
|
51
|
+
@constant kSCStatusFailed Non-specific Failure
|
|
52
|
+
@constant kSCStatusInvalidArgument Invalid argument
|
|
53
|
+
@constant kSCStatusAccessError Permission denied
|
|
54
|
+
@constant kSCStatusNoKey No such key
|
|
55
|
+
@constant kSCStatusKeyExists Data associated with key already defined
|
|
56
|
+
@constant kSCStatusLocked Lock already held
|
|
57
|
+
@constant kSCStatusNeedLock Lock required for this operation
|
|
58
|
+
@constant kSCStatusNoStoreSession Configuration daemon session not active
|
|
59
|
+
@constant kSCStatusNoStoreServer Configuration daemon not (or no longer) available
|
|
60
|
+
@constant kSCStatusNotifierActive Notifier is currently active
|
|
61
|
+
@constant kSCStatusNoPrefsSession Preferences session not active
|
|
62
|
+
@constant kSCStatusPrefsBusy Preferences update currently in progress
|
|
63
|
+
@constant kSCStatusNoConfigFile Configuration file not found
|
|
64
|
+
@constant kSCStatusNoLink No such link
|
|
65
|
+
@constant kSCStatusStale Write attempted on stale version of object
|
|
66
|
+
@constant kSCStatusMaxLink Maximum link count exceeded
|
|
67
|
+
@constant kSCStatusReachabilityUnknown
|
|
68
|
+
A determination could not be made regarding the reachability
|
|
69
|
+
of the specified nodename or address.
|
|
70
|
+
@constant kSCStatusConnectionNoService Network service for connection not available
|
|
71
|
+
*/
|
|
72
|
+
enum {
|
|
73
|
+
/*
|
|
74
|
+
* Generic error codes
|
|
75
|
+
*/
|
|
76
|
+
kSCStatusOK = 0, /* Success */
|
|
77
|
+
kSCStatusFailed = 1001, /* Non-specific failure */
|
|
78
|
+
kSCStatusInvalidArgument = 1002, /* Invalid argument */
|
|
79
|
+
kSCStatusAccessError = 1003, /* Permission denied
|
|
80
|
+
- must be root to obtain lock
|
|
81
|
+
- could not create access/create preferences
|
|
82
|
+
*/
|
|
83
|
+
kSCStatusNoKey = 1004, /* No such key */
|
|
84
|
+
kSCStatusKeyExists = 1005, /* Key already defined */
|
|
85
|
+
kSCStatusLocked = 1006, /* Lock already held */
|
|
86
|
+
kSCStatusNeedLock = 1007, /* Lock required for this operation */
|
|
87
|
+
/*
|
|
88
|
+
* SCDynamicStore error codes
|
|
89
|
+
*/
|
|
90
|
+
kSCStatusNoStoreSession = 2001, /* Configuration daemon session not active */
|
|
91
|
+
kSCStatusNoStoreServer = 2002, /* Configuration daemon not (no longer) available */
|
|
92
|
+
kSCStatusNotifierActive = 2003, /* Notifier is currently active */
|
|
93
|
+
/*
|
|
94
|
+
* SCPreferences error codes
|
|
95
|
+
*/
|
|
96
|
+
kSCStatusNoPrefsSession = 3001, /* Preference session not active */
|
|
97
|
+
kSCStatusPrefsBusy = 3002, /* Preferences update currently in progress */
|
|
98
|
+
kSCStatusNoConfigFile = 3003, /* Configuration file not found */
|
|
99
|
+
kSCStatusNoLink = 3004, /* No such link */
|
|
100
|
+
kSCStatusStale = 3005, /* Write attempted on stale version of object */
|
|
101
|
+
kSCStatusMaxLink = 3006, /* Maximum link count exceeded */
|
|
102
|
+
/*
|
|
103
|
+
* SCNetwork error codes
|
|
104
|
+
*/
|
|
105
|
+
kSCStatusReachabilityUnknown = 4001, /* Network reachability cannot be determined */
|
|
106
|
+
/*
|
|
107
|
+
* SCNetworkConnection error codes
|
|
108
|
+
*/
|
|
109
|
+
kSCStatusConnectionNoService
|
|
110
|
+
API_AVAILABLE(macos(10.6))
|
|
111
|
+
API_UNAVAILABLE(ios, tvos, watchos)
|
|
112
|
+
= 5001, /* Network service for connection not available */
|
|
113
|
+
kSCStatusConnectionIgnore
|
|
114
|
+
API_AVAILABLE(macos(10.9))
|
|
115
|
+
API_UNAVAILABLE(ios, tvos, watchos)
|
|
116
|
+
= 5002, /* Network connection information not available at this time */
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
/* SCDynamicStore APIs */
|
|
121
|
+
#include <SystemConfiguration/SCDynamicStore.h>
|
|
122
|
+
#include <SystemConfiguration/SCDynamicStoreKey.h>
|
|
123
|
+
#include <SystemConfiguration/SCDynamicStoreCopySpecific.h>
|
|
124
|
+
|
|
125
|
+
/* SCPreferences APIs */
|
|
126
|
+
#include <SystemConfiguration/SCPreferences.h>
|
|
127
|
+
#include <SystemConfiguration/SCPreferencesPath.h>
|
|
128
|
+
#include <SystemConfiguration/SCPreferencesSetSpecific.h>
|
|
129
|
+
|
|
130
|
+
/* Schema Definitions (for SCDynamicStore and SCPreferences) */
|
|
131
|
+
#include <SystemConfiguration/SCSchemaDefinitions.h>
|
|
132
|
+
|
|
133
|
+
/* SCNetworkConfiguration APIs */
|
|
134
|
+
#include <SystemConfiguration/SCNetworkConfiguration.h>
|
|
135
|
+
|
|
136
|
+
/* SCNetworkReachability and SCNetworkConnection APIs */
|
|
137
|
+
#include <SystemConfiguration/SCNetwork.h>
|
|
138
|
+
#include <SystemConfiguration/SCNetworkReachability.h>
|
|
139
|
+
#include <SystemConfiguration/SCNetworkConnection.h>
|
|
140
|
+
|
|
141
|
+
CF_IMPLICIT_BRIDGING_ENABLED
|
|
142
|
+
CF_ASSUME_NONNULL_BEGIN
|
|
143
|
+
|
|
144
|
+
/*!
|
|
145
|
+
@const kCFErrorDomainSystemConfiguration
|
|
146
|
+
@discussion CFError domain associated with errors reported by
|
|
147
|
+
the SystemConfiguration.framework.
|
|
148
|
+
*/
|
|
149
|
+
extern const CFStringRef kCFErrorDomainSystemConfiguration API_AVAILABLE(macos(10.5), ios(2.0));
|
|
150
|
+
|
|
151
|
+
__BEGIN_DECLS
|
|
152
|
+
|
|
153
|
+
/*!
|
|
154
|
+
@function SCCopyLastError
|
|
155
|
+
@discussion Returns the most recent status or error code generated
|
|
156
|
+
as the result of calling a System Configuration framework API.
|
|
157
|
+
@result Returns the last error encountered.
|
|
158
|
+
*/
|
|
159
|
+
CFErrorRef SCCopyLastError (void) API_AVAILABLE(macos(10.5), ios(2.0));
|
|
160
|
+
|
|
161
|
+
/*!
|
|
162
|
+
@function SCError
|
|
163
|
+
@discussion Returns the most recent status or error code generated
|
|
164
|
+
as the result of calling a System Configuration framework API.
|
|
165
|
+
@result Returns the last error encountered.
|
|
166
|
+
*/
|
|
167
|
+
int SCError (void) API_AVAILABLE(macos(10.1), ios(2.0));
|
|
168
|
+
|
|
169
|
+
/*!
|
|
170
|
+
@function SCErrorString
|
|
171
|
+
@discussion Returns a pointer to the message string
|
|
172
|
+
associated with the specified status or error
|
|
173
|
+
number.
|
|
174
|
+
@param status The status or error number.
|
|
175
|
+
@result Returns a pointer to the error message string.
|
|
176
|
+
*/
|
|
177
|
+
const char * SCErrorString (int status) API_AVAILABLE(macos(10.1), ios(2.0));
|
|
178
|
+
|
|
179
|
+
__END_DECLS
|
|
180
|
+
|
|
181
|
+
CF_ASSUME_NONNULL_END
|
|
182
|
+
CF_IMPLICIT_BRIDGING_DISABLED
|
|
183
|
+
|
|
184
|
+
#endif /* _SYSTEMCONFIGURATION_H */
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
|
5
|
+
*
|
|
6
|
+
* This file contains Original Code and/or Modifications of Original Code
|
|
7
|
+
* as defined in and that are subject to the Apple Public Source License
|
|
8
|
+
* Version 2.0 (the 'License'). You may not use this file except in
|
|
9
|
+
* compliance with the License. The rights granted to you under the License
|
|
10
|
+
* may not be used to create, or enable the creation or redistribution of,
|
|
11
|
+
* unlawful or unlicensed copies of an Apple operating system, or to
|
|
12
|
+
* circumvent, violate, or enable the circumvention or violation of, any
|
|
13
|
+
* terms of an Apple operating system software license agreement.
|
|
14
|
+
*
|
|
15
|
+
* Please obtain a copy of the License at
|
|
16
|
+
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
|
17
|
+
*
|
|
18
|
+
* The Original Code and all software distributed under the License are
|
|
19
|
+
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
|
20
|
+
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
|
21
|
+
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
|
23
|
+
* Please see the License for the specific language governing rights and
|
|
24
|
+
* limitations under the License.
|
|
25
|
+
*
|
|
26
|
+
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
#ifndef _OS_OSBYTEORDER_H
|
|
30
|
+
#define _OS_OSBYTEORDER_H
|
|
31
|
+
|
|
32
|
+
#include <stdint.h>
|
|
33
|
+
#include <libkern/_OSByteOrder.h>
|
|
34
|
+
|
|
35
|
+
/* Macros for swapping constant values in the preprocessing stage. */
|
|
36
|
+
#define OSSwapConstInt16(x) __DARWIN_OSSwapConstInt16(x)
|
|
37
|
+
#define OSSwapConstInt32(x) __DARWIN_OSSwapConstInt32(x)
|
|
38
|
+
#define OSSwapConstInt64(x) __DARWIN_OSSwapConstInt64(x)
|
|
39
|
+
|
|
40
|
+
#if !defined(__DARWIN_OS_INLINE)
|
|
41
|
+
# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
|
42
|
+
# define __DARWIN_OS_INLINE static inline
|
|
43
|
+
# elif defined(__MWERKS__) || defined(__cplusplus)
|
|
44
|
+
# define __DARWIN_OS_INLINE static inline
|
|
45
|
+
# else
|
|
46
|
+
# define __DARWIN_OS_INLINE static __inline__
|
|
47
|
+
# endif
|
|
48
|
+
#endif
|
|
49
|
+
|
|
50
|
+
#if defined(__GNUC__)
|
|
51
|
+
|
|
52
|
+
#if defined (__arm__) || defined(__arm64__)
|
|
53
|
+
#include <libkern/arm/OSByteOrder.h>
|
|
54
|
+
#else
|
|
55
|
+
#include <libkern/machine/OSByteOrder.h>
|
|
56
|
+
#endif
|
|
57
|
+
|
|
58
|
+
#else /* ! __GNUC__ */
|
|
59
|
+
|
|
60
|
+
#include <libkern/machine/OSByteOrder.h>
|
|
61
|
+
|
|
62
|
+
#endif /* __GNUC__ */
|
|
63
|
+
|
|
64
|
+
#define OSSwapInt16(x) __DARWIN_OSSwapInt16(x)
|
|
65
|
+
#define OSSwapInt32(x) __DARWIN_OSSwapInt32(x)
|
|
66
|
+
#define OSSwapInt64(x) __DARWIN_OSSwapInt64(x)
|
|
67
|
+
|
|
68
|
+
enum {
|
|
69
|
+
OSUnknownByteOrder,
|
|
70
|
+
OSLittleEndian,
|
|
71
|
+
OSBigEndian
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
__DARWIN_OS_INLINE
|
|
75
|
+
int32_t
|
|
76
|
+
OSHostByteOrder(void)
|
|
77
|
+
{
|
|
78
|
+
#if defined(__LITTLE_ENDIAN__)
|
|
79
|
+
return OSLittleEndian;
|
|
80
|
+
#elif defined(__BIG_ENDIAN__)
|
|
81
|
+
return OSBigEndian;
|
|
82
|
+
#else
|
|
83
|
+
return OSUnknownByteOrder;
|
|
84
|
+
#endif
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
#define OSReadBigInt(x, y) OSReadBigInt32(x, y)
|
|
88
|
+
#define OSWriteBigInt(x, y, z) OSWriteBigInt32(x, y, z)
|
|
89
|
+
#define OSSwapBigToHostInt(x) OSSwapBigToHostInt32(x)
|
|
90
|
+
#define OSSwapHostToBigInt(x) OSSwapHostToBigInt32(x)
|
|
91
|
+
#define OSReadLittleInt(x, y) OSReadLittleInt32(x, y)
|
|
92
|
+
#define OSWriteLittleInt(x, y, z) OSWriteLittleInt32(x, y, z)
|
|
93
|
+
#define OSSwapHostToLittleInt(x) OSSwapHostToLittleInt32(x)
|
|
94
|
+
#define OSSwapLittleToHostInt(x) OSSwapLittleToHostInt32(x)
|
|
95
|
+
|
|
96
|
+
/* Functions for loading native endian values. */
|
|
97
|
+
|
|
98
|
+
__DARWIN_OS_INLINE
|
|
99
|
+
uint16_t
|
|
100
|
+
_OSReadInt16(
|
|
101
|
+
const volatile void * base,
|
|
102
|
+
uintptr_t byteOffset
|
|
103
|
+
)
|
|
104
|
+
{
|
|
105
|
+
return *(volatile uint16_t *)((uintptr_t)base + byteOffset);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
__DARWIN_OS_INLINE
|
|
109
|
+
uint32_t
|
|
110
|
+
_OSReadInt32(
|
|
111
|
+
const volatile void * base,
|
|
112
|
+
uintptr_t byteOffset
|
|
113
|
+
)
|
|
114
|
+
{
|
|
115
|
+
return *(volatile uint32_t *)((uintptr_t)base + byteOffset);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
__DARWIN_OS_INLINE
|
|
119
|
+
uint64_t
|
|
120
|
+
_OSReadInt64(
|
|
121
|
+
const volatile void * base,
|
|
122
|
+
uintptr_t byteOffset
|
|
123
|
+
)
|
|
124
|
+
{
|
|
125
|
+
return *(volatile uint64_t *)((uintptr_t)base + byteOffset);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/* Functions for storing native endian values. */
|
|
129
|
+
|
|
130
|
+
__DARWIN_OS_INLINE
|
|
131
|
+
void
|
|
132
|
+
_OSWriteInt16(
|
|
133
|
+
volatile void * base,
|
|
134
|
+
uintptr_t byteOffset,
|
|
135
|
+
uint16_t data
|
|
136
|
+
)
|
|
137
|
+
{
|
|
138
|
+
*(volatile uint16_t *)((uintptr_t)base + byteOffset) = data;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
__DARWIN_OS_INLINE
|
|
142
|
+
void
|
|
143
|
+
_OSWriteInt32(
|
|
144
|
+
volatile void * base,
|
|
145
|
+
uintptr_t byteOffset,
|
|
146
|
+
uint32_t data
|
|
147
|
+
)
|
|
148
|
+
{
|
|
149
|
+
*(volatile uint32_t *)((uintptr_t)base + byteOffset) = data;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
__DARWIN_OS_INLINE
|
|
153
|
+
void
|
|
154
|
+
_OSWriteInt64(
|
|
155
|
+
volatile void * base,
|
|
156
|
+
uintptr_t byteOffset,
|
|
157
|
+
uint64_t data
|
|
158
|
+
)
|
|
159
|
+
{
|
|
160
|
+
*(volatile uint64_t *)((uintptr_t)base + byteOffset) = data;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
#if defined(__BIG_ENDIAN__)
|
|
164
|
+
|
|
165
|
+
/* Functions for loading big endian to host endianess. */
|
|
166
|
+
|
|
167
|
+
#define OSReadBigInt16(base, byteOffset) _OSReadInt16(base, byteOffset)
|
|
168
|
+
#define OSReadBigInt32(base, byteOffset) _OSReadInt32(base, byteOffset)
|
|
169
|
+
#define OSReadBigInt64(base, byteOffset) _OSReadInt64(base, byteOffset)
|
|
170
|
+
|
|
171
|
+
/* Functions for storing host endianess to big endian. */
|
|
172
|
+
|
|
173
|
+
#define OSWriteBigInt16(base, byteOffset, data) _OSWriteInt16(base, byteOffset, data)
|
|
174
|
+
#define OSWriteBigInt32(base, byteOffset, data) _OSWriteInt32(base, byteOffset, data)
|
|
175
|
+
#define OSWriteBigInt64(base, byteOffset, data) _OSWriteInt64(base, byteOffset, data)
|
|
176
|
+
|
|
177
|
+
/* Functions for loading little endian to host endianess. */
|
|
178
|
+
|
|
179
|
+
#define OSReadLittleInt16(base, byteOffset) OSReadSwapInt16(base, byteOffset)
|
|
180
|
+
#define OSReadLittleInt32(base, byteOffset) OSReadSwapInt32(base, byteOffset)
|
|
181
|
+
#define OSReadLittleInt64(base, byteOffset) OSReadSwapInt64(base, byteOffset)
|
|
182
|
+
|
|
183
|
+
/* Functions for storing host endianess to little endian. */
|
|
184
|
+
|
|
185
|
+
#define OSWriteLittleInt16(base, byteOffset, data) OSWriteSwapInt16(base, byteOffset, data)
|
|
186
|
+
#define OSWriteLittleInt32(base, byteOffset, data) OSWriteSwapInt32(base, byteOffset, data)
|
|
187
|
+
#define OSWriteLittleInt64(base, byteOffset, data) OSWriteSwapInt64(base, byteOffset, data)
|
|
188
|
+
|
|
189
|
+
/* Host endianess to big endian byte swapping macros for constants. */
|
|
190
|
+
|
|
191
|
+
#define OSSwapHostToBigConstInt16(x) ((uint16_t)(x))
|
|
192
|
+
#define OSSwapHostToBigConstInt32(x) ((uint32_t)(x))
|
|
193
|
+
#define OSSwapHostToBigConstInt64(x) ((uint64_t)(x))
|
|
194
|
+
|
|
195
|
+
/* Generic host endianess to big endian byte swapping functions. */
|
|
196
|
+
|
|
197
|
+
#define OSSwapHostToBigInt16(x) ((uint16_t)(x))
|
|
198
|
+
#define OSSwapHostToBigInt32(x) ((uint32_t)(x))
|
|
199
|
+
#define OSSwapHostToBigInt64(x) ((uint64_t)(x))
|
|
200
|
+
|
|
201
|
+
/* Host endianess to little endian byte swapping macros for constants. */
|
|
202
|
+
|
|
203
|
+
#define OSSwapHostToLittleConstInt16(x) OSSwapConstInt16(x)
|
|
204
|
+
#define OSSwapHostToLittleConstInt32(x) OSSwapConstInt32(x)
|
|
205
|
+
#define OSSwapHostToLittleConstInt64(x) OSSwapConstInt64(x)
|
|
206
|
+
|
|
207
|
+
/* Generic host endianess to little endian byte swapping functions. */
|
|
208
|
+
|
|
209
|
+
#define OSSwapHostToLittleInt16(x) OSSwapInt16(x)
|
|
210
|
+
#define OSSwapHostToLittleInt32(x) OSSwapInt32(x)
|
|
211
|
+
#define OSSwapHostToLittleInt64(x) OSSwapInt64(x)
|
|
212
|
+
|
|
213
|
+
/* Big endian to host endianess byte swapping macros for constants. */
|
|
214
|
+
|
|
215
|
+
#define OSSwapBigToHostConstInt16(x) ((uint16_t)(x))
|
|
216
|
+
#define OSSwapBigToHostConstInt32(x) ((uint32_t)(x))
|
|
217
|
+
#define OSSwapBigToHostConstInt64(x) ((uint64_t)(x))
|
|
218
|
+
|
|
219
|
+
/* Generic big endian to host endianess byte swapping functions. */
|
|
220
|
+
|
|
221
|
+
#define OSSwapBigToHostInt16(x) ((uint16_t)(x))
|
|
222
|
+
#define OSSwapBigToHostInt32(x) ((uint32_t)(x))
|
|
223
|
+
#define OSSwapBigToHostInt64(x) ((uint64_t)(x))
|
|
224
|
+
|
|
225
|
+
/* Little endian to host endianess byte swapping macros for constants. */
|
|
226
|
+
|
|
227
|
+
#define OSSwapLittleToHostConstInt16(x) OSSwapConstInt16(x)
|
|
228
|
+
#define OSSwapLittleToHostConstInt32(x) OSSwapConstInt32(x)
|
|
229
|
+
#define OSSwapLittleToHostConstInt64(x) OSSwapConstInt64(x)
|
|
230
|
+
|
|
231
|
+
/* Generic little endian to host endianess byte swapping functions. */
|
|
232
|
+
|
|
233
|
+
#define OSSwapLittleToHostInt16(x) OSSwapInt16(x)
|
|
234
|
+
#define OSSwapLittleToHostInt32(x) OSSwapInt32(x)
|
|
235
|
+
#define OSSwapLittleToHostInt64(x) OSSwapInt64(x)
|
|
236
|
+
|
|
237
|
+
#elif defined(__LITTLE_ENDIAN__)
|
|
238
|
+
|
|
239
|
+
/* Functions for loading big endian to host endianess. */
|
|
240
|
+
|
|
241
|
+
#define OSReadBigInt16(base, byteOffset) OSReadSwapInt16(base, byteOffset)
|
|
242
|
+
#define OSReadBigInt32(base, byteOffset) OSReadSwapInt32(base, byteOffset)
|
|
243
|
+
#define OSReadBigInt64(base, byteOffset) OSReadSwapInt64(base, byteOffset)
|
|
244
|
+
|
|
245
|
+
/* Functions for storing host endianess to big endian. */
|
|
246
|
+
|
|
247
|
+
#define OSWriteBigInt16(base, byteOffset, data) OSWriteSwapInt16(base, byteOffset, data)
|
|
248
|
+
#define OSWriteBigInt32(base, byteOffset, data) OSWriteSwapInt32(base, byteOffset, data)
|
|
249
|
+
#define OSWriteBigInt64(base, byteOffset, data) OSWriteSwapInt64(base, byteOffset, data)
|
|
250
|
+
|
|
251
|
+
/* Functions for loading little endian to host endianess. */
|
|
252
|
+
|
|
253
|
+
#define OSReadLittleInt16(base, byteOffset) _OSReadInt16(base, byteOffset)
|
|
254
|
+
#define OSReadLittleInt32(base, byteOffset) _OSReadInt32(base, byteOffset)
|
|
255
|
+
#define OSReadLittleInt64(base, byteOffset) _OSReadInt64(base, byteOffset)
|
|
256
|
+
|
|
257
|
+
/* Functions for storing host endianess to little endian. */
|
|
258
|
+
|
|
259
|
+
#define OSWriteLittleInt16(base, byteOffset, data) _OSWriteInt16(base, byteOffset, data)
|
|
260
|
+
#define OSWriteLittleInt32(base, byteOffset, data) _OSWriteInt32(base, byteOffset, data)
|
|
261
|
+
#define OSWriteLittleInt64(base, byteOffset, data) _OSWriteInt64(base, byteOffset, data)
|
|
262
|
+
|
|
263
|
+
/* Host endianess to big endian byte swapping macros for constants. */
|
|
264
|
+
|
|
265
|
+
#define OSSwapHostToBigConstInt16(x) OSSwapConstInt16(x)
|
|
266
|
+
#define OSSwapHostToBigConstInt32(x) OSSwapConstInt32(x)
|
|
267
|
+
#define OSSwapHostToBigConstInt64(x) OSSwapConstInt64(x)
|
|
268
|
+
|
|
269
|
+
/* Generic host endianess to big endian byte swapping functions. */
|
|
270
|
+
|
|
271
|
+
#define OSSwapHostToBigInt16(x) OSSwapInt16(x)
|
|
272
|
+
#define OSSwapHostToBigInt32(x) OSSwapInt32(x)
|
|
273
|
+
#define OSSwapHostToBigInt64(x) OSSwapInt64(x)
|
|
274
|
+
|
|
275
|
+
/* Host endianess to little endian byte swapping macros for constants. */
|
|
276
|
+
|
|
277
|
+
#define OSSwapHostToLittleConstInt16(x) ((uint16_t)(x))
|
|
278
|
+
#define OSSwapHostToLittleConstInt32(x) ((uint32_t)(x))
|
|
279
|
+
#define OSSwapHostToLittleConstInt64(x) ((uint64_t)(x))
|
|
280
|
+
|
|
281
|
+
/* Generic host endianess to little endian byte swapping functions. */
|
|
282
|
+
|
|
283
|
+
#define OSSwapHostToLittleInt16(x) ((uint16_t)(x))
|
|
284
|
+
#define OSSwapHostToLittleInt32(x) ((uint32_t)(x))
|
|
285
|
+
#define OSSwapHostToLittleInt64(x) ((uint64_t)(x))
|
|
286
|
+
|
|
287
|
+
/* Big endian to host endianess byte swapping macros for constants. */
|
|
288
|
+
|
|
289
|
+
#define OSSwapBigToHostConstInt16(x) OSSwapConstInt16(x)
|
|
290
|
+
#define OSSwapBigToHostConstInt32(x) OSSwapConstInt32(x)
|
|
291
|
+
#define OSSwapBigToHostConstInt64(x) OSSwapConstInt64(x)
|
|
292
|
+
|
|
293
|
+
/* Generic big endian to host endianess byte swapping functions. */
|
|
294
|
+
|
|
295
|
+
#define OSSwapBigToHostInt16(x) OSSwapInt16(x)
|
|
296
|
+
#define OSSwapBigToHostInt32(x) OSSwapInt32(x)
|
|
297
|
+
#define OSSwapBigToHostInt64(x) OSSwapInt64(x)
|
|
298
|
+
|
|
299
|
+
/* Little endian to host endianess byte swapping macros for constants. */
|
|
300
|
+
|
|
301
|
+
#define OSSwapLittleToHostConstInt16(x) ((uint16_t)(x))
|
|
302
|
+
#define OSSwapLittleToHostConstInt32(x) ((uint32_t)(x))
|
|
303
|
+
#define OSSwapLittleToHostConstInt64(x) ((uint64_t)(x))
|
|
304
|
+
|
|
305
|
+
/* Generic little endian to host endianess byte swapping functions. */
|
|
306
|
+
|
|
307
|
+
#define OSSwapLittleToHostInt16(x) ((uint16_t)(x))
|
|
308
|
+
#define OSSwapLittleToHostInt32(x) ((uint32_t)(x))
|
|
309
|
+
#define OSSwapLittleToHostInt64(x) ((uint64_t)(x))
|
|
310
|
+
|
|
311
|
+
#else
|
|
312
|
+
#error Unknown endianess.
|
|
313
|
+
#endif
|
|
314
|
+
|
|
315
|
+
#endif /* ! _OS_OSBYTEORDER_H */
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2000-2023 Apple Computer, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
|
5
|
+
*
|
|
6
|
+
* This file contains Original Code and/or Modifications of Original Code
|
|
7
|
+
* as defined in and that are subject to the Apple Public Source License
|
|
8
|
+
* Version 2.0 (the 'License'). You may not use this file except in
|
|
9
|
+
* compliance with the License. The rights granted to you under the License
|
|
10
|
+
* may not be used to create, or enable the creation or redistribution of,
|
|
11
|
+
* unlawful or unlicensed copies of an Apple operating system, or to
|
|
12
|
+
* circumvent, violate, or enable the circumvention or violation of, any
|
|
13
|
+
* terms of an Apple operating system software license agreement.
|
|
14
|
+
*
|
|
15
|
+
* Please obtain a copy of the License at
|
|
16
|
+
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
|
17
|
+
*
|
|
18
|
+
* The Original Code and all software distributed under the License are
|
|
19
|
+
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
|
20
|
+
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
|
21
|
+
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
|
23
|
+
* Please see the License for the specific language governing rights and
|
|
24
|
+
* limitations under the License.
|
|
25
|
+
*
|
|
26
|
+
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
#ifndef _OS_OSBYTEORDERMACHINE_H
|
|
30
|
+
#define _OS_OSBYTEORDERMACHINE_H
|
|
31
|
+
|
|
32
|
+
#if !defined(__GNUC__) || (!defined(__i386__) && !defined(__x86_64__) && !defined (__arm__) && !defined(__arm64__))
|
|
33
|
+
|
|
34
|
+
#include <stdint.h>
|
|
35
|
+
|
|
36
|
+
#if !defined(OS_INLINE)
|
|
37
|
+
# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
|
38
|
+
# define OS_INLINE static inline
|
|
39
|
+
# elif defined(__MWERKS__) || defined(__cplusplus)
|
|
40
|
+
# define OS_INLINE static inline
|
|
41
|
+
# else
|
|
42
|
+
# define OS_INLINE static __inline__
|
|
43
|
+
# endif
|
|
44
|
+
#endif
|
|
45
|
+
|
|
46
|
+
/* Generic byte swapping functions. */
|
|
47
|
+
|
|
48
|
+
OS_INLINE
|
|
49
|
+
uint16_t
|
|
50
|
+
_OSSwapInt16(
|
|
51
|
+
uint16_t data
|
|
52
|
+
)
|
|
53
|
+
{
|
|
54
|
+
return OSSwapConstInt16(data);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
OS_INLINE
|
|
58
|
+
uint32_t
|
|
59
|
+
_OSSwapInt32(
|
|
60
|
+
uint32_t data
|
|
61
|
+
)
|
|
62
|
+
{
|
|
63
|
+
return OSSwapConstInt32(data);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
OS_INLINE
|
|
67
|
+
uint64_t
|
|
68
|
+
_OSSwapInt64(
|
|
69
|
+
uint64_t data
|
|
70
|
+
)
|
|
71
|
+
{
|
|
72
|
+
return OSSwapConstInt64(data);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/* Functions for byte reversed loads. */
|
|
76
|
+
|
|
77
|
+
OS_INLINE
|
|
78
|
+
uint16_t
|
|
79
|
+
OSReadSwapInt16(
|
|
80
|
+
const volatile void * base,
|
|
81
|
+
uintptr_t byteOffset
|
|
82
|
+
)
|
|
83
|
+
{
|
|
84
|
+
uint16_t data = *(volatile uint16_t *)((uintptr_t)base + byteOffset);
|
|
85
|
+
return _OSSwapInt16(data);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
OS_INLINE
|
|
89
|
+
uint32_t
|
|
90
|
+
OSReadSwapInt32(
|
|
91
|
+
const volatile void * base,
|
|
92
|
+
uintptr_t byteOffset
|
|
93
|
+
)
|
|
94
|
+
{
|
|
95
|
+
uint32_t data = *(volatile uint32_t *)((uintptr_t)base + byteOffset);
|
|
96
|
+
return _OSSwapInt32(data);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
OS_INLINE
|
|
100
|
+
uint64_t
|
|
101
|
+
OSReadSwapInt64(
|
|
102
|
+
const volatile void * base,
|
|
103
|
+
uintptr_t byteOffset
|
|
104
|
+
)
|
|
105
|
+
{
|
|
106
|
+
uint64_t data = *(volatile uint64_t *)((uintptr_t)base + byteOffset);
|
|
107
|
+
return _OSSwapInt64(data);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* Functions for byte reversed stores. */
|
|
111
|
+
|
|
112
|
+
OS_INLINE
|
|
113
|
+
void
|
|
114
|
+
OSWriteSwapInt16(
|
|
115
|
+
volatile void * base,
|
|
116
|
+
uintptr_t byteOffset,
|
|
117
|
+
uint16_t data
|
|
118
|
+
)
|
|
119
|
+
{
|
|
120
|
+
*(volatile uint16_t *)((uintptr_t)base + byteOffset) = _OSSwapInt16(data);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
OS_INLINE
|
|
124
|
+
void
|
|
125
|
+
OSWriteSwapInt32(
|
|
126
|
+
volatile void * base,
|
|
127
|
+
uintptr_t byteOffset,
|
|
128
|
+
uint32_t data
|
|
129
|
+
)
|
|
130
|
+
{
|
|
131
|
+
*(volatile uint32_t *)((uintptr_t)base + byteOffset) = _OSSwapInt32(data);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
OS_INLINE
|
|
135
|
+
void
|
|
136
|
+
OSWriteSwapInt64(
|
|
137
|
+
volatile void * base,
|
|
138
|
+
uintptr_t byteOffset,
|
|
139
|
+
uint64_t data
|
|
140
|
+
)
|
|
141
|
+
{
|
|
142
|
+
*(volatile uint64_t *)((uintptr_t)base + byteOffset) = _OSSwapInt64(data);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
#endif /* !defined(__GNUC__) || (!defined(__i386__) && !defined(__x86_64__) && !defined (__arm__) && !defined(__arm64__)) */
|
|
146
|
+
|
|
147
|
+
#endif /* ! _OS_OSBYTEORDERMACHINE_H */
|
package/src/bridge-contract.ts
CHANGED
|
@@ -691,3 +691,45 @@ export function commandWritesSim(msg: {
|
|
|
691
691
|
if (msg.readOnly === true) return false
|
|
692
692
|
return WRITE_COMMAND_TYPES.has(msg.type)
|
|
693
693
|
}
|
|
694
|
+
|
|
695
|
+
// one sim (or contrast tab) the bridge host reports from bridge:list-sims.
|
|
696
|
+
export interface BridgeSimInfo {
|
|
697
|
+
id: string
|
|
698
|
+
origin?: string
|
|
699
|
+
url?: string
|
|
700
|
+
title?: string
|
|
701
|
+
userAgent?: string
|
|
702
|
+
connectedAt: number
|
|
703
|
+
lastSeenAt: number
|
|
704
|
+
lastActiveAt?: number
|
|
705
|
+
isPrimary: boolean
|
|
706
|
+
readyState: 'open' | 'closing' | 'closed'
|
|
707
|
+
attachedCliCount?: number
|
|
708
|
+
lockedBy?: string
|
|
709
|
+
lockedByKind?: 'cli' | 'user-active'
|
|
710
|
+
lockExpiresAt?: number
|
|
711
|
+
// true when the lease belongs to the caller asking for this list. the
|
|
712
|
+
// server computes it because `lockedBy` is a display string (a cliLabel
|
|
713
|
+
// like "open --describe", or "active user") and cannot be compared
|
|
714
|
+
// against an identity key by the client.
|
|
715
|
+
lockedByMe?: boolean
|
|
716
|
+
userFocused?: boolean
|
|
717
|
+
userVisible?: boolean
|
|
718
|
+
visibilityState?: string
|
|
719
|
+
documentFocused?: boolean
|
|
720
|
+
/** registration "kind" — lets a single daemon host multiple surface
|
|
721
|
+
* types. omitted / unknown defaults to 'sootsim'. the contrast web
|
|
722
|
+
* IDE registers with kind='contrast'; CLI consumers filter by this
|
|
723
|
+
* rather than running a parallel bridge. */
|
|
724
|
+
kind?: string
|
|
725
|
+
/** opaque metadata supplied at register time (e.g. projectId, route,
|
|
726
|
+
* attached iOS sim id for a contrast tab). free-form by design — the
|
|
727
|
+
* daemon does not interpret it, only stores + reports it back. */
|
|
728
|
+
meta?: Record<string, unknown>
|
|
729
|
+
/** why a retained disconnected sim left, e.g. which owned browser host
|
|
730
|
+
* exited. present only on readyState 'closed' entries served with
|
|
731
|
+
* includeRetained. */
|
|
732
|
+
disconnectCause?: string
|
|
733
|
+
/** epoch-ms the sim socket closed. present with disconnectCause. */
|
|
734
|
+
disconnectedAt?: number
|
|
735
|
+
}
|