Commit Graph

172 Commits

Author SHA1 Message Date
Dave Abrahams
41c244a065 [stdlib] Unicode[Encoding|Parser] => Unicode.[Encoding|Parser] 2017-05-11 17:21:39 -07:00
Dave Abrahams
01d886fe3d [stdlib] Swift.UTF[8|16|32] availability 2017-05-11 15:23:25 -07:00
Dave Abrahams
ddf7ad517f UnicodeScalar => Unicode.Scalar 2017-05-11 15:23:25 -07:00
Dave Abrahams
97f875ad84 [stdlib] De-underscore Unicode "namespace" 2017-05-11 15:23:25 -07:00
Dave Abrahams
e7b32f9dc9 [stdlib] UnicodeEncoding: hide/internalize APIs we're not sure about
The best high-level APIs for decoding/transcoding are still under active
investigation.  It's likely we want more views.  Therefore, leave
de-underscored/public only the lowest-level APIs for now.
2017-05-09 10:20:29 -07:00
Dave Abrahams
c5d6880053 [stdlib] Add ASCII UnicodeEncoding, drop uses of legacy codecs
Preparation for new C-string interop.
2017-05-07 20:43:44 -07:00
Dave Abrahams
f4610e1638 [stdlib] encode/transcode => [encode/transcode]IfRepresentable...
...to make room for a more useful encode/transcode that inject replacement
characters when encoding fails.
2017-05-07 20:43:44 -07:00
Dave Abrahams
776e0a632a [stdlib] Make a generic more idiomatic
NFC
2017-05-06 19:29:29 -07:00
Dave Abrahams
fc35acaac7 [stdlib] Every UnicodeCodec is a UnicodeEncoding 2017-05-06 19:26:58 -07:00
Dave Abrahams
796d004fd0 [stdlib] Allow Unicode Encoding to fail
This is needed for encodings such as Latin-1
2017-05-06 16:53:35 -07:00
Dave Abrahams
dfd9eb34cf [stdlib] Implement New UTF32 transcoding 2017-05-05 09:53:44 -07:00
Dave Abrahams
bea71aa80e [stdlib] Legacy UTF16 decoding in terms of new components 2017-05-04 11:03:46 -07:00
Dave Abrahams
b1ebc5cd48 [stdlib] Inline legacy UTF8.decode 2017-05-02 16:54:28 -07:00
Dave Abrahams
e8cb3cabd8 [stdlib] Inline transcode() 2017-05-02 16:54:28 -07:00
Dave Abrahams
40b66e5935 [stdlib] Implement legacy UTF8 APIs in terms of new components 2017-05-02 16:54:27 -07:00
Dave Abrahams
feea061d32 [stdlib] Move new Unicode decoders into the stdlib
No expected change in benchmarks, as legacy components aren't using this yet.
2017-05-01 17:08:08 -07:00
Max Moiseev
a1682a887c Speeding up the build by breaking complex expressions into smaller pieces 2017-04-04 16:29:54 -07:00
Max Moiseev
d128ed42b0 Merge remote-tracking branch 'origin/master' into new-integer-protocols 2017-01-19 14:16:32 -08:00
Max Moiseev
195691523f [stdlib] Eliminating some 'unsafeBitcast' related warnings 2017-01-10 12:36:22 -08:00
Max Moiseev
aecccc7e48 Merge remote-tracking branch 'origin/master' into new-integer-protocols 2017-01-09 17:38:04 -08:00
practicalswift
3918d9d251 [gardening] Replace likely word processor artefacts with ASCII equivalents (— → --, … → ...) 2017-01-08 15:23:06 +01:00
Max Moiseev
27889c6376 Merge remote-tracking branch 'origin/master' into new-integer-protocols 2017-01-06 15:54:44 -08:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
JP Simard
7301b79342 remove superfluous parentheses in control statements in stdlib source
since this appears to be the convention followed elsewhere in the code base.
2016-12-31 18:40:15 -08:00
Max Moiseev
70b2343626 Merge branch 'master' into new-integer-protocols 2016-11-28 15:25:01 -08:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Max Moiseev
ffeeaca8b1 Using faster initializer for integers where appropriate 2016-11-16 14:45:33 -08:00
Max Moiseev
8fea72db20 Using more masking shifts 2016-11-16 14:45:32 -08:00
Max Moiseev
f34808be11 using masking shifts 2016-11-14 10:16:28 -08:00
Max Moiseev
6935316638 Merge branch 'master' into new-integer-protocols 2016-10-24 14:54:21 -07:00
Slava Pestov
af8d13e9d3 stdlib: Make UnicodeDecodingResult fixed-layout 2016-10-24 02:16:20 -07:00
Max Moiseev
2190819e99 Breaking up complex expression to improve compilation time 2016-10-12 15:04:54 -07:00
Max Moiseev
ea8e0f0e15 Merge remote-tracking branch 'origin/master' into new-integer-protocols 2016-09-21 14:48:35 -07:00
Dmitri Gribenko
e8e8b35610 stdlib: use SipHash-1-3 for string hashing on non-ObjC platforms
Part of rdar://problem/24109692
2016-09-06 20:41:03 -07:00
Rintaro Ishizaki
2a9b78e193 stdlib: Add unavailable declarations for APIs renamed in SE-0118
Sequence.sort(_:) => sorted(by:)
Sequence.sort() => sorted()
Sequence.elementsEqual(_:isEquivalent) => elementsEqual(_:by:)
Sequence.contains(_:) => contains(where:)
Sequence reduce(_:combine:) => reduce(_:_:)
UnicodeCodec.encode(_:output:) => encode(_:into:)
ManagedBuffer.create(_:initialValue:)
  => create(minimumCapacity:makingHeaderWith:)
ManagedBufferPointer.init(bufferClass:minimumCapacity:initialValue)
  => init(bufferClass:minimumCapacity:makingHeaderWith:)
2016-08-14 03:28:01 +09:00
Ted Kremenek
b5d9ffb258 Merge pull request #4259 from natecook1000/nc-fixes-04
[stdlib] Documentation revisions
2016-08-12 21:48:48 -07:00
Nate Cook
8b39706c3f [stdlib] Documentation revisions
- Various edits
- Standardized complexity formatting
2016-08-12 12:24:36 -05:00
Xiaodi Wu
f9435b9ce8 [stdlib] Restore MemoryLayout.*(ofValue:) 2016-08-08 10:46:37 -05:00
Michael Ilseman
b7c9eddd11 [noescape by default] drop @noescape from stdlib 2016-08-04 16:09:01 -07:00
Dave Abrahams
f06a9a1154 Merge 'origin/master' into new-integer-protocols 2016-07-29 17:52:49 -07:00
Rintaro Ishizaki
091506315b [SE-0101] Implement: Reconfiguring sizeof and related functions into MemoryLayout struct
As of now:

* old APIs are just marked as `deprecated` not `unavaiable`. To make it
  easier to co-operate with other toolchain repos.
* Value variant of API is implemented as public @private
  `_ofInstance(_:)`.
2016-07-30 03:09:28 +09:00
Maxim Moiseev
1dd6c2d3d4 Addressing some of the FIXMEs 2016-07-29 13:31:21 +03:00
Andrew Trick
0b75ee975e Remove "illegal" UnsafePointer casts from the stdlib.
Update for SE-0107: UnsafeRawPointer

This adds a "mutating" initialize to UnsafePointer to make
Immutable -> Mutable conversions explicit.

These are quick fixes to stdlib, overlays, and test cases that are necessary
in order to remove arbitrary UnsafePointer conversions.

Many cases can be expressed better up by reworking the surrounding
code, but we first need a working starting point.
2016-07-28 20:42:23 -07:00
Xin Tong
9709b0e510 Merge pull request #3662 from trentxintong/unicodescalar
SE-0128 - Change unicodescalar initializer to failable
2016-07-26 16:44:14 -07:00
Andrew Trick
c7aa8284c9 Add basic CString <-> UTF8 API variants.
As proposed by SE-0107: UnsafeRawPointer:
https://github.com/apple/swift-evolution/blob/master/proposals/0107-unsaferawpointer.md#cstring-conversion
Adds String.init(cString: UnsafePointer<UInt8>)
Adds String.nulTerminatedUTF8CString: ContiguousArray<CChar>

This is necessary for eliminating UnsafePointer conversion.  Such
conversion is extremely common for interoperability between Swift
strings and C strings to bridge the difference between CChar and
UTF8.CodeUnit. The standard library does not provide any convenient
utilities for converting between the differently typed
buffers. These APIs will handle the simplest cases involving C
interoperability. More convenience can be added later.
2016-07-22 23:41:13 -07:00
Xin Tong
bbf86865d6 Change unicodescalar to failable
We were using a precondition which crashes the program when invalid input is
provided. We want to provide a way to gracefully check and handle invalid input
or shutdown the program if necessary.

SR-1930
2016-07-21 15:27:13 -07:00
Doug Gregor
0bf7c005b3 [SE-0091 Follow-up] Move global operators for non-generic concrete types into the type.
In various cases where we had global operators for non-generic
concrete types (such as String + String), move those operators into
the type. This should not affect the sources, but makes the exposition
of the library cleaner.

Plus, it's a good test for the compiler, which uncovered a few issues
where the compiler was coupled with the library.
2016-07-21 12:54:27 -07:00
Dave Abrahams
a68f648fab encode(_:output:) => encode(_:into processCodeUnit:) 2016-07-19 07:13:00 -06:00
Michael Gottesman
fc37603c5f Revert "Implement SE-0118" 2016-07-18 16:44:58 -07:00
Dave Abrahams
da2947f079 encode(_:output:) => encode(_:into processCodeUnit:) 2016-07-18 14:30:46 -06:00