@@ -15,32 +15,26 @@ import CSystem
1515// TODO: Should CSystem just include all the header files we need?
1616
1717#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
18- import Darwin
18+ @ _implementationOnly import Darwin
1919#elseif os(Linux) || os(FreeBSD) || os(Android)
20- import Glibc
20+ @ _implementationOnly import Glibc
2121#elseif os(Windows)
22- import ucrt
22+ @ _implementationOnly import ucrt
2323#else
2424#error("Unsupported Platform")
2525#endif
2626
27- public typealias COffT = off_t
28-
29- #if os(Windows)
30- public typealias CModeT = CInt
31- #else
32- public typealias CModeT = mode_t
33- #endif
27+ internal typealias _COffT = off_t
3428
3529// MARK: syscalls and variables
3630
3731#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
38- public var system_errno : CInt {
32+ internal var system_errno : CInt {
3933 get { Darwin . errno }
4034 set { Darwin . errno = newValue }
4135}
4236#elseif os(Windows)
43- public var system_errno : CInt {
37+ internal var system_errno : CInt {
4438 get {
4539 var value : CInt = 0
4640 // TODO(compnerd) handle the error?
@@ -52,7 +46,7 @@ public var system_errno: CInt {
5246 }
5347}
5448#else
55- public var system_errno : CInt {
49+ internal var system_errno : CInt {
5650 get { Glibc . errno }
5751 set { Glibc . errno = newValue }
5852}
@@ -62,33 +56,21 @@ public var system_errno: CInt {
6256
6357// Convention: `system_foo` is system's wrapper for `foo`.
6458
65- public func system_strerror( _ __errnum: Int32 ) -> UnsafeMutablePointer < Int8 > ! {
59+ internal func system_strerror( _ __errnum: Int32 ) -> UnsafeMutablePointer < Int8 > ! {
6660 strerror ( __errnum)
6761}
6862
69- public func system_strlen( _ s: UnsafePointer < Int8 > ) -> Int {
63+ internal func system_strlen( _ s: UnsafePointer < Int8 > ) -> Int {
7064 strlen ( s)
7165}
7266
73- #if os(Windows)
74- public typealias _PlatformChar = UInt16
75- #else
76- public typealias _PlatformChar = CChar
77- #endif
78- #if os(Windows)
79- public typealias _PlatformUnicodeEncoding = UTF16
80- #else
81- public typealias _PlatformUnicodeEncoding = UTF8
82- #endif
83-
84-
8567// Convention: `system_platform_foo` is a
8668// platform-representation-abstracted wrapper around `foo`-like functionality.
8769// Type and layout differences such as the `char` vs `wchar` are abstracted.
8870//
8971
9072// strlen for the platform string
91- public func system_platform_strlen( _ s: UnsafePointer < _PlatformChar > ) -> Int {
73+ internal func system_platform_strlen( _ s: UnsafePointer < CInterop . PlatformChar > ) -> Int {
9274 #if os(Windows)
9375 return wcslen ( s)
9476 #else
@@ -98,8 +80,8 @@ public func system_platform_strlen(_ s: UnsafePointer<_PlatformChar>) -> Int {
9880
9981// Interop between String and platfrom string
10082extension String {
101- public func _withPlatformString< Result> (
102- _ body: ( UnsafePointer < _PlatformChar > ) throws -> Result
83+ internal func _withPlatformString< Result> (
84+ _ body: ( UnsafePointer < CInterop . PlatformChar > ) throws -> Result
10385 ) rethrows -> Result {
10486 // Need to #if because CChar may be signed
10587 #if os(Windows)
@@ -109,7 +91,7 @@ extension String {
10991 #endif
11092 }
11193
112- public init ? ( _platformString platformString: UnsafePointer < _PlatformChar > ) {
94+ internal init ? ( _platformString platformString: UnsafePointer < CInterop . PlatformChar > ) {
11395 // Need to #if because CChar may be signed
11496 #if os(Windows)
11597 guard let strRes = String . decodeCString (
@@ -126,8 +108,8 @@ extension String {
126108 #endif
127109 }
128110
129- public init (
130- _errorCorrectingPlatformString platformString: UnsafePointer < _PlatformChar >
111+ internal init (
112+ _errorCorrectingPlatformString platformString: UnsafePointer < CInterop . PlatformChar >
131113 ) {
132114 // Need to #if because CChar may be signed
133115 #if os(Windows)
0 commit comments