aboutsummaryrefslogtreecommitdiff
path: root/lib/std/unicode.zig
AgeCommit message (Collapse)Author
2022-06-11Sema: handle tuple and anon_struct in resolveTypeFullyVeikka Tuominen
2022-06-03std: disable tests that crash stage2Veikka Tuominen
2022-04-15Add `std.unicode.replacement_character`r00ster91
2022-04-12Reuse code in `Utf8Iterator.nextCodepoint`r00ster
2022-01-30Full response file (*.rsp) supportPhaseMage
I hit the "quotes in an RSP file" issue when trying to compile gRPC using "zig cc". As a fun exercise, I decided to see if I could fix it myself. I'm fully open to this code being flat-out rejected. Or I can take feedback to fix it up. This modifies (and renames) _ArgIteratorWindows_ in process.zig such that it works with arbitrary strings (or the contents of an RSP file). In main.zig, this new _ArgIteratorGeneral_ is used to address the "TODO" listed in _ClangArgIterator_. This change closes #4833. **Pros:** - It has the nice attribute of handling "RSP file" arguments in the same way it handles "cmd_line" arguments. - High Performance, minimal allocations - Fixed bug in previous _ArgIteratorWindows_, where final trailing backslashes in a command line were entirely dropped - Added a test case for the above bug - Harmonized the _ArgIteratorXxxx._initWithAllocator()_ and _next()_ interface across Windows/Posix/Wasi (Moved Windows errors to _initWithAllocator()_ rather than _next()_) - Likely perf benefit on Windows by doing _utf16leToUtf8AllocZ()_ only once for the entire cmd_line **Cons:** - Breaking Change in std library on Windows: Call _ArgIterator.initWithAllocator()_ instead of _ArgIterator.init()_ - PhaseMage is new with contributions to Zig, might need a lot of hand-holding - PhaseMage is a Windows person, non-Windows stuff will need to be double-checked **Testing Done:** - Wrote a few new test cases in process.zig - zig.exe build test -Dskip-release (no new failures seen) - zig cc now builds gRPC without error
2021-11-30allocgate: std Allocator interface refactorLee Cannon
2021-11-30std lib API deprecations for the upcoming 0.9.0 releaseAndrew Kelley
See #3811
2021-11-04Replace ArrayList.init/ensureTotalCapacity pairs with initCapacityRyan Liptak
Because ArrayList.initCapacity uses 'precise' capacity allocation, this should save memory on average, and definitely will save memory in cases where ArrayList is used where a regular allocated slice could have also be used.
2021-10-04migrate from `std.Target.current` to `@import("builtin").target`Andrew Kelley
closes #9388 closes #9321
2021-09-19Update all ensureCapacity calls to the relevant non-deprecated versionRyan Liptak
2021-09-16std.unicode: cleanup allocations on error in allocating functionsRyan Liptak
Fixes leaks when `utf16leToUtf8Alloc`/`utf16leToUtf8AllocZ`/`utf8ToUtf16LeWithNull` return an error and adds relevant test cases
2021-08-24remove redundant license headers from zig standard libraryAndrew Kelley
We already have a LICENSE file that covers the Zig Standard Library. We no longer need to remind everyone that the license is MIT in every single file. Previously this was introduced to clarify the situation for a fork of Zig that made Zig's LICENSE file harder to find, and replaced it with their own license that required annual payments to their company. However that fork now appears to be dead. So there is no need to reinforce the copyright notice in every single file.
2021-07-15Add std.unicode.fmtUtf16leJonathan Marler
2021-07-02move "unreachable code" error from stage1 to stage2Andrew Kelley
* AstGen: implement "unreachable code" error for blocks. This works at the statement level. * stage1: remove the "unreachable code" error implementation, which means removing the `is_gen` field from IrInstSrc. This is one small step towards a smaller memory footprint for stage1. The benefits won't be realized until a future commit because this flag took advantage of padding. There may be a regression here with "union has no associated enum" error, and there is a regression with the following code: ```zig const a = noreturn; ``` A future commit will address these regressions.
2021-06-21fix code broken from previous commitJacob G-W
2021-05-08Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgenAndrew Kelley
Conflicts: * doc/langref.html.in * lib/std/enums.zig * lib/std/fmt.zig * lib/std/hash/auto_hash.zig * lib/std/math.zig * lib/std/mem.zig * lib/std/meta.zig * test/behavior/alignof.zig * test/behavior/bitcast.zig * test/behavior/bugs/1421.zig * test/behavior/cast.zig * test/behavior/ptrcast.zig * test/behavior/type_info.zig * test/behavior/vector.zig Master branch added `try` to a bunch of testing function calls, and some lines also had changed how to refer to the native architecture and other `@import("builtin")` stuff.
2021-05-08std: update usage of std.testingVeikka Tuominen
2021-04-28Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgenAndrew Kelley
In particular I wanted to take advantage of the new hex float parsing code.
2021-04-15std: change `@import("builtin")` to `std.builtin`Andrew Kelley
2021-04-11std.meta: add isErrorxackus
2020-12-31Year++Frank Denis
2020-11-30Switch to using unicode when parsing the command line on windows (#7241)Rageoholic
* Switch to using unicode when parsing the command line on windows * Apply changes by LemonBoy and *hopefully* fix tests on MIPs Co-authored-by: LemonBoy <LemonBoy@users.noreply.github.com> * Fix up next and skip * Move comment to more relevant place Co-authored-by: LemonBoy <LemonBoy@users.noreply.github.com>
2020-11-05std: Make utf8CountCodepoints much fasterLemonBoy
Make the code easier for the optimizer to work with and introduce a fast path for ASCII sequences. Introduce a benchmark harness to start tracking the performance of ops on utf8.
2020-11-05std: Introduce std.unicode.utf8ValidCodepointLemonBoy
2020-11-05std: Introduce std.unicode.utf8CountCodepointsLemonBoy
2020-11-02std: Fix std.unicode test cases for BE targetsLemonBoy
2020-08-20add license header to all std lib filesAndrew Kelley
add SPDX license identifier copyright ownership is zig contributors
2020-06-18Add std.unicode.Utf8Iterator.peekMichael Rees
2020-04-24Add mips support to standard libraryTimon Kruiper
2020-04-02new ArrayList API: fix everything elsexackus
2020-03-19update std lib to take advantage of slicing with comptime indexesAndrew Kelley
2020-03-07Implement UTF-8 to UTF-16LE literal conversionJared Miller
2020-02-21remove @bytesToSlice, @sliceToBytes from std libxackus
2020-02-12Switch a bunch of FBA to use testing.allocatorBenjamin Feng
2020-02-09fix off-by-one error in std.unicode.utf8ToUtf16LeWithNullAndrew Kelley
and fix larger-than-one-byte sentinels when being freed Thank you to João Pedro for identifying both problems and providing example code to solve them. closes #4413
2020-01-29Promoted "leak_count_allocator" to the main testing.allocatorBenjamin Feng
2020-01-29Create leak_count_allocatorBenjamin Feng
2020-01-29Move debug.global_allocator to testing.allocatorBenjamin Feng
2019-12-29std: sentinel terminated pointers for utf16 apisdaurnimator
2019-12-28std: unicode codepoints are 21 bitsdaurnimator
2019-12-28std: simplify utf8ToUtf16Ledaurnimator
Also faster, on my machine unicode/throughput_test.zig now gives e.g. > original utf8ToUtf16Le: elapsed: 1048 ns (0 ms) > new utf8ToUtf16Le: elapsed: 971 ns (0 ms)
2019-12-28std: optimise utf8ByteSequenceLengthdaurnimator
Also tested (but not as fast): ```zig pub fn utf8ByteSequenceLength(first_byte: u8) !u3 { const len = @clz(u8, ~first_byte); if (len == 0) return 1; if (len < 4) return @intCast(u3, len); return error.Utf8InvalidStartByte; } ```
2019-12-28std: fix unicode encoding of astral plane codepoints to utf16daurnimator
2019-12-16Fixes utf8ToUtf16Le (#3923)Dmitry Atamanov
2019-12-08std.fmt.format: tuple parameter instead of var argsAndrew Kelley
2019-11-27remove type coercion from array values to referencesAndrew Kelley
* Implements #3768. This is a sweeping breaking change that requires many (trivial) edits to Zig source code. Array values no longer coerced to slices; however one may use `&` to obtain a reference to an array value, which may then be coerced to a slice. * Adds `IrInstruction::dump`, for debugging purposes. It's useful to call to inspect the instruction when debugging Zig IR. * Fixes bugs with result location semantics. See the new behavior test cases, and compile error test cases. * Fixes bugs with `@typeInfo` not properly resolving const values. * Behavior tests are passing but std lib tests are not yet. There is more work to do before merging this branch.
2019-11-08update more of the std lib to use `@as`Andrew Kelley
2019-11-08update the codebase to use `@as`Andrew Kelley
2019-09-25mv std/ lib/Andrew Kelley
that's all this commit does. further commits will fix cli flags and such. see #2221