Commit Graph

43 Commits (118d41ef8325b4c1ca8be1fea66c2e8368b67e32)

Author SHA1 Message Date
Andrew Kelley 43085417be update github.com/zig-lang to github.com/ziglang 2018-05-24 21:27:44 -04:00
Andrew Kelley 99fc2bd4dd Merge remote-tracking branch 'origin/master' into pointer-reform 2018-05-17 00:56:35 -04:00
Andrew Kelley 4a3d689550 std.fmt: use SI prefixes for printing bytes
closes #1015
2018-05-16 18:22:39 -04:00
Andrew Kelley 5cfabdd493 Merge remote-tracking branch 'origin/master' into pointer-reform 2018-05-16 00:02:26 -04:00
Andrew Kelley 492a214d4c std.fmt.format: support {B} for human readable bytes 2018-05-15 22:11:03 -04:00
Andrew Kelley ac4d55dec1 behavior tests passing with new pointer deref syntax 2018-05-01 01:53:04 -04:00
Marc Tiehuis e5175d432e Fix release float printing errors
Fixes #564.
Fixes #669.
Fixes #928.
2018-04-23 17:22:51 +12:00
Marc Tiehuis d8ba1bc120 Improve fmt float-printing
- Fix errors printing very small numbers
 - Add explicit scientific output mode
 - Add rounding based on a specific precision for both decimal/exp
 modes.
 - Test and confirm exp/decimal against libc for all f32 values. Various
 changes to better match libc.
2018-04-23 17:22:51 +12:00
Andrew Kelley 0dcadc61b4 Merge branch 'std.os.time' of https://github.com/tgschultz/zig into tgschultz-std.os.time 2018-04-22 13:24:25 -04:00
tgschultz 8b66dd8c7d Added unstaged changes. 2018-04-18 13:55:42 -05:00
Andrew Kelley b7af9edb8a add std.os.createThread
this adds kernel thread support to the standard library for
linux.

See #174
2018-04-14 02:24:05 -04:00
Andrew Kelley 0d22a00f6f *WIP* async/await TCP server 2018-04-08 18:26:24 -04:00
Ben Noordhuis 0845cbe277 name types inside functions after variable
Before this commit:

    fn f() []const u8 {
        const S = struct {};
        return @typeName(S);  // "f()", unexpected.
    }

And now:

    fn f() []const u8 {
        const S = struct {};
        return @typeName(S);  // "S", expected.
    }

Fixes #675.
2018-02-22 19:54:02 +01:00
Andrew Kelley f9be970375 Merge remote-tracking branch 'origin/master' into error-sets 2018-02-08 20:45:26 -05:00
Andrew Kelley 0d5ff6f462 error sets - most tests passing 2018-02-08 02:08:45 -05:00
Ben Noordhuis 79ad1d9610 format struct pointers as "<typename>@<address>" (#752) 2018-02-07 16:18:48 -05:00
Andrew Kelley f99b8b006f error sets - fix most std lib compile errors 2018-02-05 18:09:13 -05:00
Andrew Kelley abf5ae6897 *WIP* error sets - support fns called at comptime 2018-02-03 11:51:29 -05:00
Andrew Kelley 39d5f44863 *WI* error sets - basic support working 2018-02-02 14:26:14 -05:00
Andrew Kelley 406496ca33 *WIP* error sets - allow peer type resolution to create new error set 2018-02-01 23:32:09 -05:00
Andrew Kelley 13b36d458f *WIP* error sets - fix implicit cast 2018-02-01 10:23:25 -05:00
Andrew Kelley 5f518dbeb9 *WIP* error sets converting std lib 2018-01-31 22:48:40 -05:00
Andrew Kelley 3671582c15 syntax: functions require return type. remove `->`
The purpose of this is:

 * Only one way to do things
 * Changing a function with void return type to return a possible
   error becomes a 1 character change, subtly encouraging
   people to use errors.

See #632

Here are some imperfect sed commands for performing this update:

remove arrow:

```
sed -i 's/\(\bfn\b.*\)-> /\1/g' $(find . -name "*.zig")
```

add void:

```
sed -i 's/\(\bfn\b.*\))\s*{/\1) void {/g' $(find ../ -name "*.zig")
```

Some cleanup may be necessary, but this should do the bulk of the work.
2018-01-25 04:10:11 -05:00
Andrew Kelley 3c094116aa remove %% prefix operator
See #632
closes #545
closes #510

this makes #651 higher priority
2018-01-09 00:51:51 -05:00
Andrew Kelley 632d143bff replace `a %% b` with `a catch b`
See #632

better fits the convention of using keywords for control flow
2018-01-07 17:28:20 -05:00
Andrew Kelley 66717db735 replace `%return` with `try`
See #632

better fits the convention of using keywords for control flow
2018-01-07 16:53:13 -05:00
Andrew Kelley 0ea50b3157 ir: new pass iteration strategy
Before:
 * IR basic blocks are in arbitrary order
 * when doing an IR pass, when a block is encountered, code
   must look at all the instructions in the old basic block,
   determine what blocks are referenced, and queue up those
   old basic blocks first.
 * This had a bug (See #667)

Now:
 * IR basic blocks are required to be in an order that guarantees
   they will be referenced by a branch, before any instructions
   within are referenced.
   ir pass1 is updated to meet this constraint.
 * When doing an IR pass, we iterate over old basic blocks
   in the order they appear. Blocks which have not been
   referenced are discarded.
 * After the pass is complete, we must iterate again to look
   for old basic blocks which now point to incomplete new
   basic blocks, due to comptime code generation.
 * This last part can probably be optimized - most of the time
   we don't need to iterate over the basic block again.

closes #667
2018-01-02 21:08:12 -05:00
Peter Rönnquist d15b02a6b6 Added format for floating point numbers. {.x} where x is the number of decimals. 2017-12-31 00:27:58 +01:00
Andrew Kelley 4183c6f1a5 move std/debug.zig to a subdirectory
self hosted compiler parser tests do some fuzz testing
2017-12-23 22:15:48 -05:00
Josh Wolfe 0e7fb69bea bufPrint returns an error 2017-12-22 00:52:01 -07:00
Andrew Kelley d917815d81 explicitly return from blocks
instead of last statement being expression value

closes #629
2017-12-22 00:50:30 -05:00
Andrew Kelley 9e234d4208 breaking change to std.io API
* Merge io.InStream and io.OutStream into io.File
 * Introduce io.OutStream and io.InStream interfaces
   - io.File implements both of these
 * Move mem.IncrementingAllocator to heap.IncrementingAllocator

Instead of:

```
%return std.io.stderr.printf("hello\n");
```

now do:

```
std.debug.warn("hello\n");
```

To print to stdout, see `io.getStdOut()`.

 * Rename std.ArrayList.resizeDown to std.ArrayList.shrink.
2017-10-31 04:47:55 -04:00
Andrew Kelley 73fe5f63c6 add some sanity tests for float printing 2017-10-24 21:57:58 -04:00
scurest 262b7428cf More corrections to float printing
Testing suggests all f32s are now printed accurately.
2017-10-24 14:18:50 -05:00
scurest 03a0dfbeca Print better floats 2017-10-23 15:40:49 -05:00
Andrew Kelley 9b91c76088 std.fmt.format supports ints smaller than u8
closes #546

thanks to @Dimenus for the fix
2017-10-21 13:03:08 -04:00
Andrew Kelley 224cd8a01e add fmt.parseInt 2017-09-26 19:40:51 -04:00
Andrew Kelley 5c2db5a942 add std.fmt.trim 2017-09-26 03:03:12 -04:00
Andrew Kelley d9eabde319 add Child property of slice type
also rename child field to Child for pointer and array
2017-09-13 14:30:57 -04:00
Andrew Kelley 5fdf3fa195 std.fmt knows how to format &[N]u8 2017-09-09 19:42:31 -04:00
Andrew Kelley c73a0c92d0 fix floating point printing 2017-08-19 19:11:43 -04:00
Andrew Kelley 558ece8f6f slightly nicer floating point printing 2017-08-18 18:05:28 -04:00
Andrew Kelley 7f0620a20f partial implementation of printing floating point numbers with errol3
also add bitCast builtin function. closes #387
2017-06-14 00:24:25 -04:00