peachsim 0.1.1667 → 0.1.1674

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.
Files changed (204) hide show
  1. package/README.md +1 -1
  2. package/cli/bridge-flow-runner.ts +4 -1
  3. package/cli/commands/coverage-swift.ts +291 -0
  4. package/cli/commands/coverage.ts +168 -24
  5. package/cli/commands/diagnose.ts +1 -19
  6. package/cli/commands/inspect/settling.ts +37 -4
  7. package/cli/commands/react.ts +3 -18
  8. package/cli/commands/screenshot.ts +1 -1
  9. package/cli/commands/screenshots-capture.ts +1 -1
  10. package/cli/drivers/playwright-provisioning.ts +1 -4
  11. package/cli/drivers/playwright.ts +15 -1
  12. package/cli/scene-video.ts +1 -1
  13. package/cli/ui.ts +20 -0
  14. package/cli/ws-bridge.ts +7 -36
  15. package/detox/frame-identity.cjs +21 -0
  16. package/detox/frame-identity.d.cts +6 -0
  17. package/detox/index.ts +39 -33
  18. package/detox/jest-environment.cjs +4 -1
  19. package/detox/jest-setup-after-env.cjs +0 -4
  20. package/detox/navigation-lifecycle.ts +2 -2
  21. package/detox/proof-observer.ts +126 -0
  22. package/dist-lib/agent-daemon-client.cjs +29 -1
  23. package/dist-lib/agent-events.cjs +1 -1
  24. package/dist-lib/attached-projects.cjs +10 -1
  25. package/dist-lib/auth/shared-session.cjs +1 -1
  26. package/dist-lib/backend-origin.cjs +1 -1
  27. package/dist-lib/beta.cjs +1 -1
  28. package/dist-lib/beta.mjs +1 -1
  29. package/dist-lib/bridge-constants.cjs +1 -1
  30. package/dist-lib/bridge-contract-input.cjs +1 -1
  31. package/dist-lib/bridge-contract-input.mjs +1 -1
  32. package/dist-lib/bridge-contract.cjs +1 -1
  33. package/dist-lib/bridge-contract.mjs +1 -1
  34. package/dist-lib/bundle-channel.cjs +557 -158
  35. package/dist-lib/capture-contract.cjs +1 -1
  36. package/dist-lib/capture-contract.mjs +1 -1
  37. package/dist-lib/cloud-contract.cjs +1 -1
  38. package/dist-lib/cloud-contract.mjs +1 -1
  39. package/dist-lib/cloud-test-args.cjs +1 -1
  40. package/dist-lib/cloud-test-args.mjs +1 -1
  41. package/dist-lib/cloud.cjs +1 -1
  42. package/dist-lib/cloud.mjs +1 -1
  43. package/dist-lib/config.cjs +1 -1
  44. package/dist-lib/config.mjs +1 -1
  45. package/dist-lib/detox/index.cjs +5098 -7344
  46. package/dist-lib/detox/jest-environment.cjs +4 -1
  47. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  48. package/dist-lib/expo-swift-bundle.cjs +602 -152
  49. package/dist-lib/expo-swift-metadata.cjs +1 -1
  50. package/dist-lib/expo-swift-metadata.mjs +1 -1
  51. package/dist-lib/home-paths.cjs +1 -1
  52. package/dist-lib/host/bridge-host.cjs +688 -194
  53. package/dist-lib/host/fetch-proxy-handler.cjs +6 -3
  54. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  55. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  56. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  57. package/dist-lib/host/websocket-proxy.cjs +1 -1
  58. package/dist-lib/index.cjs +247 -11
  59. package/dist-lib/jump-to-source-babel.cjs +1 -1
  60. package/dist-lib/jump-to-source-native.cjs +1 -1
  61. package/dist-lib/kotlin-host.cjs +1 -1
  62. package/dist-lib/menu.cjs +1 -1
  63. package/dist-lib/menu.mjs +1 -1
  64. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  65. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  66. package/dist-lib/metro-production-bundle.cjs +10 -1
  67. package/dist-lib/metro-production-bundle.mjs +12 -1
  68. package/dist-lib/metro.cjs +155 -5
  69. package/dist-lib/native-app-identity-project.cjs +43 -5
  70. package/dist-lib/native-app-identity-project.mjs +43 -5
  71. package/dist-lib/native-app-identity.cjs +1 -1
  72. package/dist-lib/native-app-identity.mjs +1 -1
  73. package/dist-lib/native-firebase-metadata.cjs +1 -1
  74. package/dist-lib/native-firebase-metadata.mjs +1 -1
  75. package/dist-lib/plist.cjs +1 -1
  76. package/dist-lib/plist.mjs +1 -1
  77. package/dist-lib/profiles.cjs +21 -1
  78. package/dist-lib/public-brand.cjs +1 -1
  79. package/dist-lib/public-origins-lib-esm.json +73 -27
  80. package/dist-lib/public-origins-lib-static.json +1 -1
  81. package/dist-lib/public-origins-lib.json +563 -183
  82. package/dist-lib/react-native-host-modules.cjs +1 -1
  83. package/dist-lib/react-native-host-modules.mjs +1 -1
  84. package/dist-lib/reap-browser.cjs +964 -0
  85. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  86. package/dist-lib/sdk.cjs +38 -5
  87. package/dist-lib/sdk.mjs +38 -5
  88. package/dist-lib/skills.cjs +1031 -530
  89. package/dist-lib/swift-compile.cjs +298 -86
  90. package/dist-lib/swift-compile.mjs +298 -86
  91. package/dist-lib/swift-package.cjs +53 -4
  92. package/dist-lib/swift-package.mjs +52 -4
  93. package/dist-lib/swift-submit.cjs +2 -2
  94. package/dist-lib/swift-submit.mjs +2 -2
  95. package/dist-lib/swift-toolchain.cjs +25 -44
  96. package/dist-lib/swift.cjs +1 -1
  97. package/dist-lib/vite-swift.cjs +603 -114
  98. package/dist-lib/vite.cjs +65 -3
  99. package/dist-lib/worklet-executable.cjs +1 -1
  100. package/dist-lib/worklet-executable.mjs +1 -1
  101. package/dist-types/packages/peach-engine/src/engine/clipboardContract.d.ts +7 -0
  102. package/dist-types/packages/peach-engine/src/engine/glass-material.d.ts +1 -1
  103. package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +2 -0
  104. package/dist-types/packages/peach-engine/src/engine/inspect-outline.d.ts +2 -1
  105. package/dist-types/packages/peach-engine/src/engine/liquid-glass.d.ts +1 -0
  106. package/dist-types/packages/peach-engine/src/engine/paint-boundary.d.ts +4 -1
  107. package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +7 -0
  108. package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime-kind.d.ts +24 -0
  109. package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +4 -2
  110. package/dist-types/packages/peach-engine/src/rolldown-bundle-inventory.d.ts +1 -1
  111. package/dist-types/packages/peach-engine/src/settings/devices.d.ts +1 -0
  112. package/dist-types/packages/peach-globals/src/clipboardBridgeContract.d.ts +18 -0
  113. package/dist-types/packages/peach-globals/src/compositorBridgeContract.d.ts +10 -1
  114. package/dist-types/packages/peach-globals/src/index.d.ts +2 -2
  115. package/dist-types/packages/peach-globals/src/nodeContract.d.ts +1 -0
  116. package/dist-types/packages/peach-kit/src/capabilities.d.ts +1 -0
  117. package/package.json +1 -1
  118. package/runtime-companion.json +1 -1
  119. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFString.h +2 -0
  120. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +54 -0
  121. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +23 -4
  122. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStore.h +439 -0
  123. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStoreCopySpecific.h +216 -0
  124. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStoreKey.h +267 -0
  125. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetwork.h +204 -0
  126. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetworkConfiguration.h +1393 -0
  127. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetworkConnection.h +568 -0
  128. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetworkReachability.h +369 -0
  129. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCPreferences.h +473 -0
  130. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCPreferencesPath.h +179 -0
  131. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCPreferencesSetSpecific.h +95 -0
  132. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCSchemaDefinitions.h +2395 -0
  133. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SystemConfiguration.h +184 -0
  134. package/sdk/ios/usr/include/_ctype.h +388 -0
  135. package/sdk/ios/usr/include/_inttypes.h +296 -0
  136. package/sdk/ios/usr/include/_locale.h +83 -0
  137. package/sdk/ios/usr/include/_locale_posix2008.h +65 -0
  138. package/sdk/ios/usr/include/_time.h +207 -0
  139. package/sdk/ios/usr/include/ctype.h +70 -0
  140. package/sdk/ios/usr/include/dispatch/dispatch.h +69 -6
  141. package/sdk/ios/usr/include/inttypes.h +35 -0
  142. package/sdk/ios/usr/include/libkern/OSByteOrder.h +315 -0
  143. package/sdk/ios/usr/include/libkern/machine/OSByteOrder.h +147 -0
  144. package/sdk/ios/usr/include/locale.h +59 -0
  145. package/sdk/ios/usr/include/runetype.h +118 -0
  146. package/sdk/ios/usr/include/setjmp.h +99 -0
  147. package/sdk/ios/usr/include/sys/_types/_clock_t.h +32 -0
  148. package/sdk/ios/usr/include/sys/_types/_ct_rune_t.h +33 -0
  149. package/sdk/ios/usr/include/sys/_types/_rune_t.h +32 -0
  150. package/sdk/ios/usr/include/sys/_types/_time_t.h +32 -0
  151. package/sdk/ios/usr/include/sys/_types/_wint_t.h +33 -0
  152. package/sdk/ios/usr/include/sys/cdefs.h +2 -0
  153. package/sdk/ios/usr/include/time.h +67 -2
  154. package/src/bridge-contract.ts +42 -0
  155. package/src/chromium-admission.ts +196 -0
  156. package/src/host/bridge-host.ts +6 -43
  157. package/src/host/rolldown-bundle-forward.ts +4 -1
  158. package/src/launch-deadline.ts +74 -0
  159. package/src/nitro-adapter.lock.json +3 -3
  160. package/src/profiles.ts +21 -0
  161. package/src/react-native-coverage/capability-reference-resolution.ts +402 -0
  162. package/src/react-native-coverage/capability-source-references.ts +1296 -0
  163. package/src/react-native-coverage/native-typescript-parser.ts +74 -0
  164. package/src/react-native-coverage/project-aliases.ts +207 -0
  165. package/src/react-native-coverage/verified-reach.ts +47 -0
  166. package/src/reap-browser.ts +1019 -0
  167. package/src/skills/builtin/a11y-review.ts +1 -1
  168. package/src/skills/builtin/perf-profile.ts +1 -1
  169. package/src/skills/builtin/screenshot-all.ts +1 -1
  170. package/src/skills/builtin/visual-diff.ts +1 -1
  171. package/src/swift-compile.ts +109 -57
  172. package/src/swift-coverage/indexdump.ts +80 -0
  173. package/src/swift-coverage/indexing.ts +147 -0
  174. package/src/swift-coverage/package.ts +230 -0
  175. package/src/swift-coverage/provenance.ts +47 -0
  176. package/src/swift-coverage/reader.ts +81 -0
  177. package/src/swift-coverage/source.ts +252 -0
  178. package/src/swift-coverage/types.ts +58 -0
  179. package/src/swift-coverage/xcode-assets.ts +175 -0
  180. package/src/swift-coverage/xcode-bridging.ts +160 -0
  181. package/src/swift-coverage/xcode-packages.ts +251 -0
  182. package/src/swift-coverage/xcode-strings.ts +78 -0
  183. package/src/swift-coverage/xcode.ts +656 -0
  184. package/src/swift-distribution.lock.json +8 -8
  185. package/src/swift-host.ts +21 -1
  186. package/src/swift-objc-compile.ts +7 -3
  187. package/src/swift-objc-import.ts +191 -27
  188. package/src/swift-objc-metadata.ts +2 -2
  189. package/src/swift-objc-standin.ts +9 -2
  190. package/src/swift-package-manifest.ts +134 -13
  191. package/src/swift-package.ts +69 -4
  192. package/src/swift-standins.ts +4 -1
  193. package/src/swift-submit.ts +2 -1
  194. package/src/swift-toolchain.ts +36 -61
  195. package/src/worker-system-chunks.ts +3 -10
  196. package/src/xcode-project.ts +5 -5
  197. package/detox/attempt-events.cjs +0 -914
  198. package/detox/attempt-events.d.cts +0 -113
  199. package/detox/motion-change.cjs +0 -524
  200. package/detox/motion-change.d.cts +0 -140
  201. package/detox/motion-leg-starts.cjs +0 -20
  202. package/detox/motion-leg-starts.d.cts +0 -8
  203. package/detox/proof-frame.cjs +0 -190
  204. 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,388 @@
1
+ /*
2
+ * Copyright (c) 2000, 2005, 2008 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
+ * Copyright (c) 1989, 1993
25
+ * The Regents of the University of California. All rights reserved.
26
+ * (c) UNIX System Laboratories, Inc.
27
+ * All or some portions of this file are derived from material licensed
28
+ * to the University of California by American Telephone and Telegraph
29
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
30
+ * the permission of UNIX System Laboratories, Inc.
31
+ *
32
+ * This code is derived from software contributed to Berkeley by
33
+ * Paul Borman at Krystal Technologies.
34
+ *
35
+ * Redistribution and use in source and binary forms, with or without
36
+ * modification, are permitted provided that the following conditions
37
+ * are met:
38
+ * 1. Redistributions of source code must retain the above copyright
39
+ * notice, this list of conditions and the following disclaimer.
40
+ * 2. Redistributions in binary form must reproduce the above copyright
41
+ * notice, this list of conditions and the following disclaimer in the
42
+ * documentation and/or other materials provided with the distribution.
43
+ * 3. All advertising materials mentioning features or use of this software
44
+ * must display the following acknowledgement:
45
+ * This product includes software developed by the University of
46
+ * California, Berkeley and its contributors.
47
+ * 4. Neither the name of the University nor the names of its contributors
48
+ * may be used to endorse or promote products derived from this software
49
+ * without specific prior written permission.
50
+ *
51
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
52
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
53
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
54
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
55
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
56
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
57
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
58
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
59
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
60
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
61
+ * SUCH DAMAGE.
62
+ *
63
+ * @(#)ctype.h 8.4 (Berkeley) 1/21/94
64
+ */
65
+
66
+ #ifndef _CTYPE_H_
67
+ #define _CTYPE_H_
68
+ #define __CTYPE_H_
69
+
70
+ #include <sys/cdefs.h>
71
+ #include <_bounds.h>
72
+ #include <runetype.h>
73
+
74
+ _LIBC_SINGLE_BY_DEFAULT()
75
+
76
+ #define _CTYPE_A 0x00000100L /* Alpha */
77
+ #define _CTYPE_C 0x00000200L /* Control */
78
+ #define _CTYPE_D 0x00000400L /* Digit */
79
+ #define _CTYPE_G 0x00000800L /* Graph */
80
+ #define _CTYPE_L 0x00001000L /* Lower */
81
+ #define _CTYPE_P 0x00002000L /* Punct */
82
+ #define _CTYPE_S 0x00004000L /* Space */
83
+ #define _CTYPE_U 0x00008000L /* Upper */
84
+ #define _CTYPE_X 0x00010000L /* X digit */
85
+ #define _CTYPE_B 0x00020000L /* Blank */
86
+ #define _CTYPE_R 0x00040000L /* Print */
87
+ #define _CTYPE_I 0x00080000L /* Ideogram */
88
+ #define _CTYPE_T 0x00100000L /* Special */
89
+ #define _CTYPE_Q 0x00200000L /* Phonogram */
90
+ #define _CTYPE_SW0 0x20000000L /* 0 width character */
91
+ #define _CTYPE_SW1 0x40000000L /* 1 width character */
92
+ #define _CTYPE_SW2 0x80000000L /* 2 width character */
93
+ #define _CTYPE_SW3 0xc0000000L /* 3 width character */
94
+ #define _CTYPE_SWM 0xe0000000L /* Mask for screen width data */
95
+ #define _CTYPE_SWS 30 /* Bits to shift to get width */
96
+
97
+ #ifdef _NONSTD_SOURCE
98
+ /*
99
+ * Backward compatibility
100
+ */
101
+ #define _A _CTYPE_A /* Alpha */
102
+ #define _C _CTYPE_C /* Control */
103
+ #define _D _CTYPE_D /* Digit */
104
+ #define _G _CTYPE_G /* Graph */
105
+ #define _L _CTYPE_L /* Lower */
106
+ #define _P _CTYPE_P /* Punct */
107
+ #define _S _CTYPE_S /* Space */
108
+ #define _U _CTYPE_U /* Upper */
109
+ #define _X _CTYPE_X /* X digit */
110
+ #define _B _CTYPE_B /* Blank */
111
+ #define _R _CTYPE_R /* Print */
112
+ #define _I _CTYPE_I /* Ideogram */
113
+ #define _T _CTYPE_T /* Special */
114
+ #define _Q _CTYPE_Q /* Phonogram */
115
+ #define _SW0 _CTYPE_SW0 /* 0 width character */
116
+ #define _SW1 _CTYPE_SW1 /* 1 width character */
117
+ #define _SW2 _CTYPE_SW2 /* 2 width character */
118
+ #define _SW3 _CTYPE_SW3 /* 3 width character */
119
+ #endif /* _NONSTD_SOURCE */
120
+
121
+ #define __DARWIN_CTYPE_inline __header_inline
122
+
123
+ #define __DARWIN_CTYPE_TOP_inline __header_inline
124
+
125
+
126
+ /*
127
+ * Use inline functions if we are allowed to and the compiler supports them.
128
+ */
129
+ #if !defined(_DONT_USE_CTYPE_INLINE_) && \
130
+ (defined(_USE_CTYPE_INLINE_) || defined(__GNUC__) || defined(__cplusplus))
131
+
132
+ /* See comments in <machine/_type.h> about __darwin_ct_rune_t. */
133
+ __BEGIN_DECLS
134
+ unsigned long ___runetype(__darwin_ct_rune_t);
135
+ __darwin_ct_rune_t ___tolower(__darwin_ct_rune_t);
136
+ __darwin_ct_rune_t ___toupper(__darwin_ct_rune_t);
137
+ __END_DECLS
138
+
139
+ __DARWIN_CTYPE_TOP_inline int
140
+ isascii(int _c)
141
+ {
142
+ return ((_c & ~0x7F) == 0);
143
+ }
144
+
145
+ #ifdef USE_ASCII
146
+ __DARWIN_CTYPE_inline int
147
+ __maskrune(__darwin_ct_rune_t _c, unsigned long _f)
148
+ {
149
+ return (int)_DefaultRuneLocale.__runetype[_c & 0xff] & (__uint32_t)_f;
150
+ }
151
+ #else /* !USE_ASCII */
152
+ __BEGIN_DECLS
153
+ int __maskrune(__darwin_ct_rune_t, unsigned long);
154
+ __END_DECLS
155
+ #endif /* USE_ASCII */
156
+
157
+ __DARWIN_CTYPE_inline int
158
+ __istype(__darwin_ct_rune_t _c, unsigned long _f)
159
+ {
160
+ #ifdef USE_ASCII
161
+ return !!(__maskrune(_c, _f));
162
+ #else /* USE_ASCII */
163
+ return (isascii(_c) ? !!(_DefaultRuneLocale.__runetype[_c] & _f)
164
+ : !!__maskrune(_c, _f));
165
+ #endif /* USE_ASCII */
166
+ }
167
+
168
+ __DARWIN_CTYPE_inline __darwin_ct_rune_t
169
+ __isctype(__darwin_ct_rune_t _c, unsigned long _f)
170
+ {
171
+ #ifdef USE_ASCII
172
+ return !!(__maskrune(_c, _f));
173
+ #else /* USE_ASCII */
174
+ return (_c < 0 || _c >= _CACHED_RUNES) ? 0 :
175
+ !!(_DefaultRuneLocale.__runetype[_c] & _f);
176
+ #endif /* USE_ASCII */
177
+ }
178
+
179
+ #ifdef USE_ASCII
180
+ __DARWIN_CTYPE_inline __darwin_ct_rune_t
181
+ __toupper(__darwin_ct_rune_t _c)
182
+ {
183
+ return _DefaultRuneLocale.__mapupper[_c & 0xff];
184
+ }
185
+
186
+ __DARWIN_CTYPE_inline __darwin_ct_rune_t
187
+ __tolower(__darwin_ct_rune_t _c)
188
+ {
189
+ return _DefaultRuneLocale.__maplower[_c & 0xff];
190
+ }
191
+ #else /* !USE_ASCII */
192
+ __BEGIN_DECLS
193
+ __darwin_ct_rune_t __toupper(__darwin_ct_rune_t);
194
+ __darwin_ct_rune_t __tolower(__darwin_ct_rune_t);
195
+ __END_DECLS
196
+ #endif /* USE_ASCII */
197
+
198
+ __DARWIN_CTYPE_inline int
199
+ __wcwidth(__darwin_ct_rune_t _c)
200
+ {
201
+ unsigned int _x;
202
+
203
+ if (_c == 0)
204
+ return (0);
205
+ _x = (unsigned int)__maskrune(_c, _CTYPE_SWM|_CTYPE_R);
206
+ if ((_x & _CTYPE_SWM) != 0)
207
+ return ((_x & _CTYPE_SWM) >> _CTYPE_SWS);
208
+ return ((_x & _CTYPE_R) != 0 ? 1 : -1);
209
+ }
210
+
211
+ #ifndef _EXTERNALIZE_CTYPE_INLINES_
212
+
213
+ #define _tolower(c) __tolower(c)
214
+ #define _toupper(c) __toupper(c)
215
+
216
+ __DARWIN_CTYPE_TOP_inline int
217
+ isalnum(int _c)
218
+ {
219
+ return (__istype(_c, _CTYPE_A|_CTYPE_D));
220
+ }
221
+
222
+ __DARWIN_CTYPE_TOP_inline int
223
+ isalpha(int _c)
224
+ {
225
+ return (__istype(_c, _CTYPE_A));
226
+ }
227
+
228
+ __DARWIN_CTYPE_TOP_inline int
229
+ isblank(int _c)
230
+ {
231
+ return (__istype(_c, _CTYPE_B));
232
+ }
233
+
234
+ __DARWIN_CTYPE_TOP_inline int
235
+ iscntrl(int _c)
236
+ {
237
+ return (__istype(_c, _CTYPE_C));
238
+ }
239
+
240
+ /* ANSI -- locale independent */
241
+ __DARWIN_CTYPE_TOP_inline int
242
+ isdigit(int _c)
243
+ {
244
+ return (__isctype(_c, _CTYPE_D));
245
+ }
246
+
247
+ __DARWIN_CTYPE_TOP_inline int
248
+ isgraph(int _c)
249
+ {
250
+ return (__istype(_c, _CTYPE_G));
251
+ }
252
+
253
+ __DARWIN_CTYPE_TOP_inline int
254
+ islower(int _c)
255
+ {
256
+ return (__istype(_c, _CTYPE_L));
257
+ }
258
+
259
+ __DARWIN_CTYPE_TOP_inline int
260
+ isprint(int _c)
261
+ {
262
+ return (__istype(_c, _CTYPE_R));
263
+ }
264
+
265
+ __DARWIN_CTYPE_TOP_inline int
266
+ ispunct(int _c)
267
+ {
268
+ return (__istype(_c, _CTYPE_P));
269
+ }
270
+
271
+ __DARWIN_CTYPE_TOP_inline int
272
+ isspace(int _c)
273
+ {
274
+ return (__istype(_c, _CTYPE_S));
275
+ }
276
+
277
+ __DARWIN_CTYPE_TOP_inline int
278
+ isupper(int _c)
279
+ {
280
+ return (__istype(_c, _CTYPE_U));
281
+ }
282
+
283
+ /* ANSI -- locale independent */
284
+ __DARWIN_CTYPE_TOP_inline int
285
+ isxdigit(int _c)
286
+ {
287
+ return (__isctype(_c, _CTYPE_X));
288
+ }
289
+
290
+ __DARWIN_CTYPE_TOP_inline int
291
+ toascii(int _c)
292
+ {
293
+ return (_c & 0x7F);
294
+ }
295
+
296
+ __DARWIN_CTYPE_TOP_inline int
297
+ tolower(int _c)
298
+ {
299
+ return (__tolower(_c));
300
+ }
301
+
302
+ __DARWIN_CTYPE_TOP_inline int
303
+ toupper(int _c)
304
+ {
305
+ return (__toupper(_c));
306
+ }
307
+
308
+ #if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
309
+ __DARWIN_CTYPE_TOP_inline int
310
+ digittoint(int _c)
311
+ {
312
+ return (__maskrune(_c, 0x0F));
313
+ }
314
+
315
+ __DARWIN_CTYPE_TOP_inline int
316
+ ishexnumber(int _c)
317
+ {
318
+ return (__istype(_c, _CTYPE_X));
319
+ }
320
+
321
+ __DARWIN_CTYPE_TOP_inline int
322
+ isideogram(int _c)
323
+ {
324
+ return (__istype(_c, _CTYPE_I));
325
+ }
326
+
327
+ __DARWIN_CTYPE_TOP_inline int
328
+ isnumber(int _c)
329
+ {
330
+ return (__istype(_c, _CTYPE_D));
331
+ }
332
+
333
+ __DARWIN_CTYPE_TOP_inline int
334
+ isphonogram(int _c)
335
+ {
336
+ return (__istype(_c, _CTYPE_Q));
337
+ }
338
+
339
+ __DARWIN_CTYPE_TOP_inline int
340
+ isrune(int _c)
341
+ {
342
+ return (__istype(_c, 0xFFFFFFF0L));
343
+ }
344
+
345
+ __DARWIN_CTYPE_TOP_inline int
346
+ isspecial(int _c)
347
+ {
348
+ return (__istype(_c, _CTYPE_T));
349
+ }
350
+ #endif /* !_ANSI_SOURCE && (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
351
+ #endif /* _EXTERNALIZE_CTYPE_INLINES_ */
352
+
353
+ #else /* not using inlines */
354
+
355
+ __BEGIN_DECLS
356
+ int isalnum(int);
357
+ int isalpha(int);
358
+ int isblank(int);
359
+ int iscntrl(int);
360
+ int isdigit(int);
361
+ int isgraph(int);
362
+ int islower(int);
363
+ int isprint(int);
364
+ int ispunct(int);
365
+ int isspace(int);
366
+ int isupper(int);
367
+ int isxdigit(int);
368
+ int tolower(int);
369
+ int toupper(int);
370
+ int isascii(int);
371
+ int toascii(int);
372
+
373
+ #if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
374
+ int _tolower(int);
375
+ int _toupper(int);
376
+ int digittoint(int);
377
+ int ishexnumber(int);
378
+ int isideogram(int);
379
+ int isnumber(int);
380
+ int isphonogram(int);
381
+ int isrune(int);
382
+ int isspecial(int);
383
+ #endif
384
+ __END_DECLS
385
+
386
+ #endif /* using inlines */
387
+
388
+ #endif /* !_CTYPE_H_ */