authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-05-28 20:23:55-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-05-29 04:23:38-04:00
log0c16cd2d0ed78be2d160f9c865cd0a8703348232
treee7ff390d89611797776f2e67151c1157059d6147
parentcdf30c31ea36365859dd81c207aede3c45c4e022

run zig fmt on the codebase

See #1003

102 files changed, 5969 insertions(+), 3599 deletions(-)

std/base64.zig+1
...@@ -81,6 +81,7 @@ pub const Base64Decoder = struct {...@@ -81,6 +81,7 @@ pub const Base64Decoder = struct {
81 /// e.g. 'A' => 0.81 /// e.g. 'A' => 0.
82 /// undefined for any value not in the 64 alphabet chars.82 /// undefined for any value not in the 64 alphabet chars.
83 char_to_index: [256]u8,83 char_to_index: [256]u8,
84
84 /// true only for the 64 chars in the alphabet, not the pad char.85 /// true only for the 64 chars in the alphabet, not the pad char.
85 char_in_alphabet: [256]bool,86 char_in_alphabet: [256]bool,
86 pad_char: u8,87 pad_char: u8,
std/crypto/blake2.zig+22-226
...@@ -49,16 +49,16 @@ fn Blake2s(comptime out_len: usize) type {...@@ -49,16 +49,16 @@ fn Blake2s(comptime out_len: usize) type {
49 };49 };
5050
51 const sigma = [10][16]u8{51 const sigma = [10][16]u8{
52 []const u8 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },52 []const u8{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
53 []const u8 { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 },53 []const u8{ 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 },
54 []const u8 { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 },54 []const u8{ 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 },
55 []const u8 { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 },55 []const u8{ 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 },
56 []const u8 { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 },56 []const u8{ 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 },
57 []const u8 { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 },57 []const u8{ 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 },
58 []const u8 { 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 },58 []const u8{ 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 },
59 []const u8 { 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 },59 []const u8{ 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 },
60 []const u8 { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 },60 []const u8{ 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 },
61 []const u8 { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0 },61 []const u8{ 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0 },
62 };62 };
6363
64 h: [8]u32,64 h: [8]u32,
...@@ -282,222 +282,18 @@ fn Blake2b(comptime out_len: usize) type {...@@ -282,222 +282,18 @@ fn Blake2b(comptime out_len: usize) type {
282 };282 };
283283
284 const sigma = [12][16]u8{284 const sigma = [12][16]u8{
285 []const u8{285 []const u8{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
286 0,286 []const u8{ 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 },
287 1,287 []const u8{ 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 },
288 2,288 []const u8{ 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 },
289 3,289 []const u8{ 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 },
290 4,290 []const u8{ 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 },
291 5,291 []const u8{ 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 },
292 6,292 []const u8{ 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 },
293 7,293 []const u8{ 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 },
294 8,294 []const u8{ 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0 },
295 9,295 []const u8{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
296 10,296 []const u8{ 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 },
297 11,
298 12,
299 13,
300 14,
301 15,
302 },
303 []const u8{
304 14,
305 10,
306 4,
307 8,
308 9,
309 15,
310 13,
311 6,
312 1,
313 12,
314 0,
315 2,
316 11,
317 7,
318 5,
319 3,
320 },
321 []const u8{
322 11,
323 8,
324 12,
325 0,
326 5,
327 2,
328 15,
329 13,
330 10,
331 14,
332 3,
333 6,
334 7,
335 1,
336 9,
337 4,
338 },
339 []const u8{
340 7,
341 9,
342 3,
343 1,
344 13,
345 12,
346 11,
347 14,
348 2,
349 6,
350 5,
351 10,
352 4,
353 0,
354 15,
355 8,
356 },
357 []const u8{
358 9,
359 0,
360 5,
361 7,
362 2,
363 4,
364 10,
365 15,
366 14,
367 1,
368 11,
369 12,
370 6,
371 8,
372 3,
373 13,
374 },
375 []const u8{
376 2,
377 12,
378 6,
379 10,
380 0,
381 11,
382 8,
383 3,
384 4,
385 13,
386 7,
387 5,
388 15,
389 14,
390 1,
391 9,
392 },
393 []const u8{
394 12,
395 5,
396 1,
397 15,
398 14,
399 13,
400 4,
401 10,
402 0,
403 7,
404 6,
405 3,
406 9,
407 2,
408 8,
409 11,
410 },
411 []const u8{
412 13,
413 11,
414 7,
415 14,
416 12,
417 1,
418 3,
419 9,
420 5,
421 0,
422 15,
423 4,
424 8,
425 6,
426 2,
427 10,
428 },
429 []const u8{
430 6,
431 15,
432 14,
433 9,
434 11,
435 3,
436 0,
437 8,
438 12,
439 2,
440 13,
441 7,
442 1,
443 4,
444 10,
445 5,
446 },
447 []const u8{
448 10,
449 2,
450 8,
451 4,
452 7,
453 6,
454 1,
455 5,
456 15,
457 11,
458 9,
459 14,
460 3,
461 12,
462 13,
463 0,
464 },
465 []const u8{
466 0,
467 1,
468 2,
469 3,
470 4,
471 5,
472 6,
473 7,
474 8,
475 9,
476 10,
477 11,
478 12,
479 13,
480 14,
481 15,
482 },
483 []const u8{
484 14,
485 10,
486 4,
487 8,
488 9,
489 15,
490 13,
491 6,
492 1,
493 12,
494 0,
495 2,
496 11,
497 7,
498 5,
499 3,
500 },
501 };297 };
502298
503 h: [8]u64,299 h: [8]u64,
std/fmt/errol/index.zig+1-2
...@@ -98,7 +98,6 @@ pub fn errol3(value: f64, buffer: []u8) FloatDecimal {...@@ -98,7 +98,6 @@ pub fn errol3(value: f64, buffer: []u8) FloatDecimal {
98/// Uncorrected Errol3 double to ASCII conversion.98/// Uncorrected Errol3 double to ASCII conversion.
99fn errol3u(val: f64, buffer: []u8) FloatDecimal {99fn errol3u(val: f64, buffer: []u8) FloatDecimal {
100 // check if in integer or fixed range100 // check if in integer or fixed range
101
102 if (val > 9.007199254740992e15 and val < 3.40282366920938e+38) {101 if (val > 9.007199254740992e15 and val < 3.40282366920938e+38) {
103 return errolInt(val, buffer);102 return errolInt(val, buffer);
104 } else if (val >= 16.0 and val < 9.007199254740992e15) {103 } else if (val >= 16.0 and val < 9.007199254740992e15) {
...@@ -420,7 +419,7 @@ fn fpprev(val: f64) f64 {...@@ -420,7 +419,7 @@ fn fpprev(val: f64) f64 {
420 return @bitCast(f64, @bitCast(u64, val) -% 1);419 return @bitCast(f64, @bitCast(u64, val) -% 1);
421}420}
422421
423pub const c_digits_lut = []u8 {422pub const c_digits_lut = []u8{
424 '0', '0', '0', '1', '0', '2', '0', '3', '0', '4', '0', '5', '0', '6',423 '0', '0', '0', '1', '0', '2', '0', '3', '0', '4', '0', '5', '0', '6',
425 '0', '7', '0', '8', '0', '9', '1', '0', '1', '1', '1', '2', '1', '3',424 '0', '7', '0', '8', '0', '9', '1', '0', '1', '1', '1', '2', '1', '3',
426 '1', '4', '1', '5', '1', '6', '1', '7', '1', '8', '1', '9', '2', '0',425 '1', '4', '1', '5', '1', '6', '1', '7', '1', '8', '1', '9', '2', '0',
std/fmt/errol/lookup.zig+600-600
...@@ -3,604 +3,604 @@ pub const HP = struct {...@@ -3,604 +3,604 @@ pub const HP = struct {
3 off: f64,3 off: f64,
4};4};
5pub const lookup_table = []HP{5pub const lookup_table = []HP{
6 HP{.val=1.000000e+308, .off= -1.097906362944045488e+291 },6 HP{ .val = 1.000000e+308, .off = -1.097906362944045488e+291 },
7 HP{.val=1.000000e+307, .off= 1.396894023974354241e+290 },7 HP{ .val = 1.000000e+307, .off = 1.396894023974354241e+290 },
8 HP{.val=1.000000e+306, .off= -1.721606459673645508e+289 },8 HP{ .val = 1.000000e+306, .off = -1.721606459673645508e+289 },
9 HP{.val=1.000000e+305, .off= 6.074644749446353973e+288 },9 HP{ .val = 1.000000e+305, .off = 6.074644749446353973e+288 },
10 HP{.val=1.000000e+304, .off= 6.074644749446353567e+287 },10 HP{ .val = 1.000000e+304, .off = 6.074644749446353567e+287 },
11 HP{.val=1.000000e+303, .off= -1.617650767864564452e+284 },11 HP{ .val = 1.000000e+303, .off = -1.617650767864564452e+284 },
12 HP{.val=1.000000e+302, .off= -7.629703079084895055e+285 },12 HP{ .val = 1.000000e+302, .off = -7.629703079084895055e+285 },
13 HP{.val=1.000000e+301, .off= -5.250476025520442286e+284 },13 HP{ .val = 1.000000e+301, .off = -5.250476025520442286e+284 },
14 HP{.val=1.000000e+300, .off= -5.250476025520441956e+283 },14 HP{ .val = 1.000000e+300, .off = -5.250476025520441956e+283 },
15 HP{.val=1.000000e+299, .off= -5.250476025520441750e+282 },15 HP{ .val = 1.000000e+299, .off = -5.250476025520441750e+282 },
16 HP{.val=1.000000e+298, .off= 4.043379652465702264e+281 },16 HP{ .val = 1.000000e+298, .off = 4.043379652465702264e+281 },
17 HP{.val=1.000000e+297, .off= -1.765280146275637946e+280 },17 HP{ .val = 1.000000e+297, .off = -1.765280146275637946e+280 },
18 HP{.val=1.000000e+296, .off= 1.865132227937699609e+279 },18 HP{ .val = 1.000000e+296, .off = 1.865132227937699609e+279 },
19 HP{.val=1.000000e+295, .off= 1.865132227937699609e+278 },19 HP{ .val = 1.000000e+295, .off = 1.865132227937699609e+278 },
20 HP{.val=1.000000e+294, .off= -6.643646774124810287e+277 },20 HP{ .val = 1.000000e+294, .off = -6.643646774124810287e+277 },
21 HP{.val=1.000000e+293, .off= 7.537651562646039934e+276 },21 HP{ .val = 1.000000e+293, .off = 7.537651562646039934e+276 },
22 HP{.val=1.000000e+292, .off= -1.325659897835741608e+275 },22 HP{ .val = 1.000000e+292, .off = -1.325659897835741608e+275 },
23 HP{.val=1.000000e+291, .off= 4.213909764965371606e+274 },23 HP{ .val = 1.000000e+291, .off = 4.213909764965371606e+274 },
24 HP{.val=1.000000e+290, .off= -6.172783352786715670e+273 },24 HP{ .val = 1.000000e+290, .off = -6.172783352786715670e+273 },
25 HP{.val=1.000000e+289, .off= -6.172783352786715670e+272 },25 HP{ .val = 1.000000e+289, .off = -6.172783352786715670e+272 },
26 HP{.val=1.000000e+288, .off= -7.630473539575035471e+270 },26 HP{ .val = 1.000000e+288, .off = -7.630473539575035471e+270 },
27 HP{.val=1.000000e+287, .off= -7.525217352494018700e+270 },27 HP{ .val = 1.000000e+287, .off = -7.525217352494018700e+270 },
28 HP{.val=1.000000e+286, .off= -3.298861103408696612e+269 },28 HP{ .val = 1.000000e+286, .off = -3.298861103408696612e+269 },
29 HP{.val=1.000000e+285, .off= 1.984084207947955778e+268 },29 HP{ .val = 1.000000e+285, .off = 1.984084207947955778e+268 },
30 HP{.val=1.000000e+284, .off= -7.921438250845767591e+267 },30 HP{ .val = 1.000000e+284, .off = -7.921438250845767591e+267 },
31 HP{.val=1.000000e+283, .off= 4.460464822646386735e+266 },31 HP{ .val = 1.000000e+283, .off = 4.460464822646386735e+266 },
32 HP{.val=1.000000e+282, .off= -3.278224598286209647e+265 },32 HP{ .val = 1.000000e+282, .off = -3.278224598286209647e+265 },
33 HP{.val=1.000000e+281, .off= -3.278224598286209737e+264 },33 HP{ .val = 1.000000e+281, .off = -3.278224598286209737e+264 },
34 HP{.val=1.000000e+280, .off= -3.278224598286209961e+263 },34 HP{ .val = 1.000000e+280, .off = -3.278224598286209961e+263 },
35 HP{.val=1.000000e+279, .off= -5.797329227496039232e+262 },35 HP{ .val = 1.000000e+279, .off = -5.797329227496039232e+262 },
36 HP{.val=1.000000e+278, .off= 3.649313132040821498e+261 },36 HP{ .val = 1.000000e+278, .off = 3.649313132040821498e+261 },
37 HP{.val=1.000000e+277, .off= -2.867878510995372374e+259 },37 HP{ .val = 1.000000e+277, .off = -2.867878510995372374e+259 },
38 HP{.val=1.000000e+276, .off= -5.206914080024985409e+259 },38 HP{ .val = 1.000000e+276, .off = -5.206914080024985409e+259 },
39 HP{.val=1.000000e+275, .off= 4.018322599210230404e+258 },39 HP{ .val = 1.000000e+275, .off = 4.018322599210230404e+258 },
40 HP{.val=1.000000e+274, .off= 7.862171215558236495e+257 },40 HP{ .val = 1.000000e+274, .off = 7.862171215558236495e+257 },
41 HP{.val=1.000000e+273, .off= 5.459765830340732821e+256 },41 HP{ .val = 1.000000e+273, .off = 5.459765830340732821e+256 },
42 HP{.val=1.000000e+272, .off= -6.552261095746788047e+255 },42 HP{ .val = 1.000000e+272, .off = -6.552261095746788047e+255 },
43 HP{.val=1.000000e+271, .off= 4.709014147460262298e+254 },43 HP{ .val = 1.000000e+271, .off = 4.709014147460262298e+254 },
44 HP{.val=1.000000e+270, .off= -4.675381888545612729e+253 },44 HP{ .val = 1.000000e+270, .off = -4.675381888545612729e+253 },
45 HP{.val=1.000000e+269, .off= -4.675381888545612892e+252 },45 HP{ .val = 1.000000e+269, .off = -4.675381888545612892e+252 },
46 HP{.val=1.000000e+268, .off= 2.656177514583977380e+251 },46 HP{ .val = 1.000000e+268, .off = 2.656177514583977380e+251 },
47 HP{.val=1.000000e+267, .off= 2.656177514583977190e+250 },47 HP{ .val = 1.000000e+267, .off = 2.656177514583977190e+250 },
48 HP{.val=1.000000e+266, .off= -3.071603269111014892e+249 },48 HP{ .val = 1.000000e+266, .off = -3.071603269111014892e+249 },
49 HP{.val=1.000000e+265, .off= -6.651466258920385440e+248 },49 HP{ .val = 1.000000e+265, .off = -6.651466258920385440e+248 },
50 HP{.val=1.000000e+264, .off= -4.414051890289528972e+247 },50 HP{ .val = 1.000000e+264, .off = -4.414051890289528972e+247 },
51 HP{.val=1.000000e+263, .off= -1.617283929500958387e+246 },51 HP{ .val = 1.000000e+263, .off = -1.617283929500958387e+246 },
52 HP{.val=1.000000e+262, .off= -1.617283929500958241e+245 },52 HP{ .val = 1.000000e+262, .off = -1.617283929500958241e+245 },
53 HP{.val=1.000000e+261, .off= 7.122615947963323868e+244 },53 HP{ .val = 1.000000e+261, .off = 7.122615947963323868e+244 },
54 HP{.val=1.000000e+260, .off= -6.533477610574617382e+243 },54 HP{ .val = 1.000000e+260, .off = -6.533477610574617382e+243 },
55 HP{.val=1.000000e+259, .off= 7.122615947963323982e+242 },55 HP{ .val = 1.000000e+259, .off = 7.122615947963323982e+242 },
56 HP{.val=1.000000e+258, .off= -5.679971763165996225e+241 },56 HP{ .val = 1.000000e+258, .off = -5.679971763165996225e+241 },
57 HP{.val=1.000000e+257, .off= -3.012765990014054219e+240 },57 HP{ .val = 1.000000e+257, .off = -3.012765990014054219e+240 },
58 HP{.val=1.000000e+256, .off= -3.012765990014054219e+239 },58 HP{ .val = 1.000000e+256, .off = -3.012765990014054219e+239 },
59 HP{.val=1.000000e+255, .off= 1.154743030535854616e+238 },59 HP{ .val = 1.000000e+255, .off = 1.154743030535854616e+238 },
60 HP{.val=1.000000e+254, .off= 6.364129306223240767e+237 },60 HP{ .val = 1.000000e+254, .off = 6.364129306223240767e+237 },
61 HP{.val=1.000000e+253, .off= 6.364129306223241129e+236 },61 HP{ .val = 1.000000e+253, .off = 6.364129306223241129e+236 },
62 HP{.val=1.000000e+252, .off= -9.915202805299840595e+235 },62 HP{ .val = 1.000000e+252, .off = -9.915202805299840595e+235 },
63 HP{.val=1.000000e+251, .off= -4.827911520448877980e+234 },63 HP{ .val = 1.000000e+251, .off = -4.827911520448877980e+234 },
64 HP{.val=1.000000e+250, .off= 7.890316691678530146e+233 },64 HP{ .val = 1.000000e+250, .off = 7.890316691678530146e+233 },
65 HP{.val=1.000000e+249, .off= 7.890316691678529484e+232 },65 HP{ .val = 1.000000e+249, .off = 7.890316691678529484e+232 },
66 HP{.val=1.000000e+248, .off= -4.529828046727141859e+231 },66 HP{ .val = 1.000000e+248, .off = -4.529828046727141859e+231 },
67 HP{.val=1.000000e+247, .off= 4.785280507077111924e+230 },67 HP{ .val = 1.000000e+247, .off = 4.785280507077111924e+230 },
68 HP{.val=1.000000e+246, .off= -6.858605185178205305e+229 },68 HP{ .val = 1.000000e+246, .off = -6.858605185178205305e+229 },
69 HP{.val=1.000000e+245, .off= -4.432795665958347728e+228 },69 HP{ .val = 1.000000e+245, .off = -4.432795665958347728e+228 },
70 HP{.val=1.000000e+244, .off= -7.465057564983169531e+227 },70 HP{ .val = 1.000000e+244, .off = -7.465057564983169531e+227 },
71 HP{.val=1.000000e+243, .off= -7.465057564983169741e+226 },71 HP{ .val = 1.000000e+243, .off = -7.465057564983169741e+226 },
72 HP{.val=1.000000e+242, .off= -5.096102956370027445e+225 },72 HP{ .val = 1.000000e+242, .off = -5.096102956370027445e+225 },
73 HP{.val=1.000000e+241, .off= -5.096102956370026952e+224 },73 HP{ .val = 1.000000e+241, .off = -5.096102956370026952e+224 },
74 HP{.val=1.000000e+240, .off= -1.394611380411992474e+223 },74 HP{ .val = 1.000000e+240, .off = -1.394611380411992474e+223 },
75 HP{.val=1.000000e+239, .off= 9.188208545617793960e+221 },75 HP{ .val = 1.000000e+239, .off = 9.188208545617793960e+221 },
76 HP{.val=1.000000e+238, .off= -4.864759732872650359e+221 },76 HP{ .val = 1.000000e+238, .off = -4.864759732872650359e+221 },
77 HP{.val=1.000000e+237, .off= 5.979453868566904629e+220 },77 HP{ .val = 1.000000e+237, .off = 5.979453868566904629e+220 },
78 HP{.val=1.000000e+236, .off= -5.316601966265964857e+219 },78 HP{ .val = 1.000000e+236, .off = -5.316601966265964857e+219 },
79 HP{.val=1.000000e+235, .off= -5.316601966265964701e+218 },79 HP{ .val = 1.000000e+235, .off = -5.316601966265964701e+218 },
80 HP{.val=1.000000e+234, .off= -1.786584517880693123e+217 },80 HP{ .val = 1.000000e+234, .off = -1.786584517880693123e+217 },
81 HP{.val=1.000000e+233, .off= 2.625937292600896716e+216 },81 HP{ .val = 1.000000e+233, .off = 2.625937292600896716e+216 },
82 HP{.val=1.000000e+232, .off= -5.647541102052084079e+215 },82 HP{ .val = 1.000000e+232, .off = -5.647541102052084079e+215 },
83 HP{.val=1.000000e+231, .off= -5.647541102052083888e+214 },83 HP{ .val = 1.000000e+231, .off = -5.647541102052083888e+214 },
84 HP{.val=1.000000e+230, .off= -9.956644432600511943e+213 },84 HP{ .val = 1.000000e+230, .off = -9.956644432600511943e+213 },
85 HP{.val=1.000000e+229, .off= 8.161138937705571862e+211 },85 HP{ .val = 1.000000e+229, .off = 8.161138937705571862e+211 },
86 HP{.val=1.000000e+228, .off= 7.549087847752475275e+211 },86 HP{ .val = 1.000000e+228, .off = 7.549087847752475275e+211 },
87 HP{.val=1.000000e+227, .off= -9.283347037202319948e+210 },87 HP{ .val = 1.000000e+227, .off = -9.283347037202319948e+210 },
88 HP{.val=1.000000e+226, .off= 3.866992716668613820e+209 },88 HP{ .val = 1.000000e+226, .off = 3.866992716668613820e+209 },
89 HP{.val=1.000000e+225, .off= 7.154577655136347262e+208 },89 HP{ .val = 1.000000e+225, .off = 7.154577655136347262e+208 },
90 HP{.val=1.000000e+224, .off= 3.045096482051680688e+207 },90 HP{ .val = 1.000000e+224, .off = 3.045096482051680688e+207 },
91 HP{.val=1.000000e+223, .off= -4.660180717482069567e+206 },91 HP{ .val = 1.000000e+223, .off = -4.660180717482069567e+206 },
92 HP{.val=1.000000e+222, .off= -4.660180717482070101e+205 },92 HP{ .val = 1.000000e+222, .off = -4.660180717482070101e+205 },
93 HP{.val=1.000000e+221, .off= -4.660180717482069544e+204 },93 HP{ .val = 1.000000e+221, .off = -4.660180717482069544e+204 },
94 HP{.val=1.000000e+220, .off= 3.562757926310489022e+202 },94 HP{ .val = 1.000000e+220, .off = 3.562757926310489022e+202 },
95 HP{.val=1.000000e+219, .off= 3.491561111451748149e+202 },95 HP{ .val = 1.000000e+219, .off = 3.491561111451748149e+202 },
96 HP{.val=1.000000e+218, .off= -8.265758834125874135e+201 },96 HP{ .val = 1.000000e+218, .off = -8.265758834125874135e+201 },
97 HP{.val=1.000000e+217, .off= 3.981449442517482365e+200 },97 HP{ .val = 1.000000e+217, .off = 3.981449442517482365e+200 },
98 HP{.val=1.000000e+216, .off= -2.142154695804195936e+199 },98 HP{ .val = 1.000000e+216, .off = -2.142154695804195936e+199 },
99 HP{.val=1.000000e+215, .off= 9.339603063548950188e+198 },99 HP{ .val = 1.000000e+215, .off = 9.339603063548950188e+198 },
100 HP{.val=1.000000e+214, .off= 4.555537330485139746e+197 },100 HP{ .val = 1.000000e+214, .off = 4.555537330485139746e+197 },
101 HP{.val=1.000000e+213, .off= 1.565496247320257804e+196 },101 HP{ .val = 1.000000e+213, .off = 1.565496247320257804e+196 },
102 HP{.val=1.000000e+212, .off= 9.040598955232462036e+195 },102 HP{ .val = 1.000000e+212, .off = 9.040598955232462036e+195 },
103 HP{.val=1.000000e+211, .off= 4.368659762787334780e+194 },103 HP{ .val = 1.000000e+211, .off = 4.368659762787334780e+194 },
104 HP{.val=1.000000e+210, .off= 7.288621758065539072e+193 },104 HP{ .val = 1.000000e+210, .off = 7.288621758065539072e+193 },
105 HP{.val=1.000000e+209, .off= -7.311188218325485628e+192 },105 HP{ .val = 1.000000e+209, .off = -7.311188218325485628e+192 },
106 HP{.val=1.000000e+208, .off= 1.813693016918905189e+191 },106 HP{ .val = 1.000000e+208, .off = 1.813693016918905189e+191 },
107 HP{.val=1.000000e+207, .off= -3.889357755108838992e+190 },107 HP{ .val = 1.000000e+207, .off = -3.889357755108838992e+190 },
108 HP{.val=1.000000e+206, .off= -3.889357755108838992e+189 },108 HP{ .val = 1.000000e+206, .off = -3.889357755108838992e+189 },
109 HP{.val=1.000000e+205, .off= -1.661603547285501360e+188 },109 HP{ .val = 1.000000e+205, .off = -1.661603547285501360e+188 },
110 HP{.val=1.000000e+204, .off= 1.123089212493670643e+187 },110 HP{ .val = 1.000000e+204, .off = 1.123089212493670643e+187 },
111 HP{.val=1.000000e+203, .off= 1.123089212493670643e+186 },111 HP{ .val = 1.000000e+203, .off = 1.123089212493670643e+186 },
112 HP{.val=1.000000e+202, .off= 9.825254086803583029e+185 },112 HP{ .val = 1.000000e+202, .off = 9.825254086803583029e+185 },
113 HP{.val=1.000000e+201, .off= -3.771878529305654999e+184 },113 HP{ .val = 1.000000e+201, .off = -3.771878529305654999e+184 },
114 HP{.val=1.000000e+200, .off= 3.026687778748963675e+183 },114 HP{ .val = 1.000000e+200, .off = 3.026687778748963675e+183 },
115 HP{.val=1.000000e+199, .off= -9.720624048853446693e+182 },115 HP{ .val = 1.000000e+199, .off = -9.720624048853446693e+182 },
116 HP{.val=1.000000e+198, .off= -1.753554156601940139e+181 },116 HP{ .val = 1.000000e+198, .off = -1.753554156601940139e+181 },
117 HP{.val=1.000000e+197, .off= 4.885670753607648963e+180 },117 HP{ .val = 1.000000e+197, .off = 4.885670753607648963e+180 },
118 HP{.val=1.000000e+196, .off= 4.885670753607648963e+179 },118 HP{ .val = 1.000000e+196, .off = 4.885670753607648963e+179 },
119 HP{.val=1.000000e+195, .off= 2.292223523057028076e+178 },119 HP{ .val = 1.000000e+195, .off = 2.292223523057028076e+178 },
120 HP{.val=1.000000e+194, .off= 5.534032561245303825e+177 },120 HP{ .val = 1.000000e+194, .off = 5.534032561245303825e+177 },
121 HP{.val=1.000000e+193, .off= -6.622751331960730683e+176 },121 HP{ .val = 1.000000e+193, .off = -6.622751331960730683e+176 },
122 HP{.val=1.000000e+192, .off= -4.090088020876139692e+175 },122 HP{ .val = 1.000000e+192, .off = -4.090088020876139692e+175 },
123 HP{.val=1.000000e+191, .off= -7.255917159731877552e+174 },123 HP{ .val = 1.000000e+191, .off = -7.255917159731877552e+174 },
124 HP{.val=1.000000e+190, .off= -7.255917159731877992e+173 },124 HP{ .val = 1.000000e+190, .off = -7.255917159731877992e+173 },
125 HP{.val=1.000000e+189, .off= -2.309309130269787104e+172 },125 HP{ .val = 1.000000e+189, .off = -2.309309130269787104e+172 },
126 HP{.val=1.000000e+188, .off= -2.309309130269787019e+171 },126 HP{ .val = 1.000000e+188, .off = -2.309309130269787019e+171 },
127 HP{.val=1.000000e+187, .off= 9.284303438781988230e+170 },127 HP{ .val = 1.000000e+187, .off = 9.284303438781988230e+170 },
128 HP{.val=1.000000e+186, .off= 2.038295583124628364e+169 },128 HP{ .val = 1.000000e+186, .off = 2.038295583124628364e+169 },
129 HP{.val=1.000000e+185, .off= 2.038295583124628532e+168 },129 HP{ .val = 1.000000e+185, .off = 2.038295583124628532e+168 },
130 HP{.val=1.000000e+184, .off= -1.735666841696912925e+167 },130 HP{ .val = 1.000000e+184, .off = -1.735666841696912925e+167 },
131 HP{.val=1.000000e+183, .off= 5.340512704843477241e+166 },131 HP{ .val = 1.000000e+183, .off = 5.340512704843477241e+166 },
132 HP{.val=1.000000e+182, .off= -6.453119872723839321e+165 },132 HP{ .val = 1.000000e+182, .off = -6.453119872723839321e+165 },
133 HP{.val=1.000000e+181, .off= 8.288920849235306587e+164 },133 HP{ .val = 1.000000e+181, .off = 8.288920849235306587e+164 },
134 HP{.val=1.000000e+180, .off= -9.248546019891598293e+162 },134 HP{ .val = 1.000000e+180, .off = -9.248546019891598293e+162 },
135 HP{.val=1.000000e+179, .off= 1.954450226518486016e+162 },135 HP{ .val = 1.000000e+179, .off = 1.954450226518486016e+162 },
136 HP{.val=1.000000e+178, .off= -5.243811844750628197e+161 },136 HP{ .val = 1.000000e+178, .off = -5.243811844750628197e+161 },
137 HP{.val=1.000000e+177, .off= -7.448980502074320639e+159 },137 HP{ .val = 1.000000e+177, .off = -7.448980502074320639e+159 },
138 HP{.val=1.000000e+176, .off= -7.448980502074319858e+158 },138 HP{ .val = 1.000000e+176, .off = -7.448980502074319858e+158 },
139 HP{.val=1.000000e+175, .off= 6.284654753766312753e+158 },139 HP{ .val = 1.000000e+175, .off = 6.284654753766312753e+158 },
140 HP{.val=1.000000e+174, .off= -6.895756753684458388e+157 },140 HP{ .val = 1.000000e+174, .off = -6.895756753684458388e+157 },
141 HP{.val=1.000000e+173, .off= -1.403918625579970616e+156 },141 HP{ .val = 1.000000e+173, .off = -1.403918625579970616e+156 },
142 HP{.val=1.000000e+172, .off= -8.268716285710580522e+155 },142 HP{ .val = 1.000000e+172, .off = -8.268716285710580522e+155 },
143 HP{.val=1.000000e+171, .off= 4.602779327034313170e+154 },143 HP{ .val = 1.000000e+171, .off = 4.602779327034313170e+154 },
144 HP{.val=1.000000e+170, .off= -3.441905430931244940e+153 },144 HP{ .val = 1.000000e+170, .off = -3.441905430931244940e+153 },
145 HP{.val=1.000000e+169, .off= 6.613950516525702884e+152 },145 HP{ .val = 1.000000e+169, .off = 6.613950516525702884e+152 },
146 HP{.val=1.000000e+168, .off= 6.613950516525702652e+151 },146 HP{ .val = 1.000000e+168, .off = 6.613950516525702652e+151 },
147 HP{.val=1.000000e+167, .off= -3.860899428741951187e+150 },147 HP{ .val = 1.000000e+167, .off = -3.860899428741951187e+150 },
148 HP{.val=1.000000e+166, .off= 5.959272394946474605e+149 },148 HP{ .val = 1.000000e+166, .off = 5.959272394946474605e+149 },
149 HP{.val=1.000000e+165, .off= 1.005101065481665103e+149 },149 HP{ .val = 1.000000e+165, .off = 1.005101065481665103e+149 },
150 HP{.val=1.000000e+164, .off= -1.783349948587918355e+146 },150 HP{ .val = 1.000000e+164, .off = -1.783349948587918355e+146 },
151 HP{.val=1.000000e+163, .off= 6.215006036188360099e+146 },151 HP{ .val = 1.000000e+163, .off = 6.215006036188360099e+146 },
152 HP{.val=1.000000e+162, .off= 6.215006036188360099e+145 },152 HP{ .val = 1.000000e+162, .off = 6.215006036188360099e+145 },
153 HP{.val=1.000000e+161, .off= -3.774589324822814903e+144 },153 HP{ .val = 1.000000e+161, .off = -3.774589324822814903e+144 },
154 HP{.val=1.000000e+160, .off= -6.528407745068226929e+142 },154 HP{ .val = 1.000000e+160, .off = -6.528407745068226929e+142 },
155 HP{.val=1.000000e+159, .off= 7.151530601283157561e+142 },155 HP{ .val = 1.000000e+159, .off = 7.151530601283157561e+142 },
156 HP{.val=1.000000e+158, .off= 4.712664546348788765e+141 },156 HP{ .val = 1.000000e+158, .off = 4.712664546348788765e+141 },
157 HP{.val=1.000000e+157, .off= 1.664081977680827856e+140 },157 HP{ .val = 1.000000e+157, .off = 1.664081977680827856e+140 },
158 HP{.val=1.000000e+156, .off= 1.664081977680827750e+139 },158 HP{ .val = 1.000000e+156, .off = 1.664081977680827750e+139 },
159 HP{.val=1.000000e+155, .off= -7.176231540910168265e+137 },159 HP{ .val = 1.000000e+155, .off = -7.176231540910168265e+137 },
160 HP{.val=1.000000e+154, .off= -3.694754568805822650e+137 },160 HP{ .val = 1.000000e+154, .off = -3.694754568805822650e+137 },
161 HP{.val=1.000000e+153, .off= 2.665969958768462622e+134 },161 HP{ .val = 1.000000e+153, .off = 2.665969958768462622e+134 },
162 HP{.val=1.000000e+152, .off= -4.625108135904199522e+135 },162 HP{ .val = 1.000000e+152, .off = -4.625108135904199522e+135 },
163 HP{.val=1.000000e+151, .off= -1.717753238721771919e+134 },163 HP{ .val = 1.000000e+151, .off = -1.717753238721771919e+134 },
164 HP{.val=1.000000e+150, .off= 1.916440382756262433e+133 },164 HP{ .val = 1.000000e+150, .off = 1.916440382756262433e+133 },
165 HP{.val=1.000000e+149, .off= -4.897672657515052040e+132 },165 HP{ .val = 1.000000e+149, .off = -4.897672657515052040e+132 },
166 HP{.val=1.000000e+148, .off= -4.897672657515052198e+131 },166 HP{ .val = 1.000000e+148, .off = -4.897672657515052198e+131 },
167 HP{.val=1.000000e+147, .off= 2.200361759434233991e+130 },167 HP{ .val = 1.000000e+147, .off = 2.200361759434233991e+130 },
168 HP{.val=1.000000e+146, .off= 6.636633270027537273e+129 },168 HP{ .val = 1.000000e+146, .off = 6.636633270027537273e+129 },
169 HP{.val=1.000000e+145, .off= 1.091293881785907977e+128 },169 HP{ .val = 1.000000e+145, .off = 1.091293881785907977e+128 },
170 HP{.val=1.000000e+144, .off= -2.374543235865110597e+127 },170 HP{ .val = 1.000000e+144, .off = -2.374543235865110597e+127 },
171 HP{.val=1.000000e+143, .off= -2.374543235865110537e+126 },171 HP{ .val = 1.000000e+143, .off = -2.374543235865110537e+126 },
172 HP{.val=1.000000e+142, .off= -5.082228484029969099e+125 },172 HP{ .val = 1.000000e+142, .off = -5.082228484029969099e+125 },
173 HP{.val=1.000000e+141, .off= -1.697621923823895943e+124 },173 HP{ .val = 1.000000e+141, .off = -1.697621923823895943e+124 },
174 HP{.val=1.000000e+140, .off= -5.928380124081487212e+123 },174 HP{ .val = 1.000000e+140, .off = -5.928380124081487212e+123 },
175 HP{.val=1.000000e+139, .off= -3.284156248920492522e+122 },175 HP{ .val = 1.000000e+139, .off = -3.284156248920492522e+122 },
176 HP{.val=1.000000e+138, .off= -3.284156248920492706e+121 },176 HP{ .val = 1.000000e+138, .off = -3.284156248920492706e+121 },
177 HP{.val=1.000000e+137, .off= -3.284156248920492476e+120 },177 HP{ .val = 1.000000e+137, .off = -3.284156248920492476e+120 },
178 HP{.val=1.000000e+136, .off= -5.866406127007401066e+119 },178 HP{ .val = 1.000000e+136, .off = -5.866406127007401066e+119 },
179 HP{.val=1.000000e+135, .off= 3.817030915818506056e+118 },179 HP{ .val = 1.000000e+135, .off = 3.817030915818506056e+118 },
180 HP{.val=1.000000e+134, .off= 7.851796350329300951e+117 },180 HP{ .val = 1.000000e+134, .off = 7.851796350329300951e+117 },
181 HP{.val=1.000000e+133, .off= -2.235117235947686077e+116 },181 HP{ .val = 1.000000e+133, .off = -2.235117235947686077e+116 },
182 HP{.val=1.000000e+132, .off= 9.170432597638723691e+114 },182 HP{ .val = 1.000000e+132, .off = 9.170432597638723691e+114 },
183 HP{.val=1.000000e+131, .off= 8.797444499042767883e+114 },183 HP{ .val = 1.000000e+131, .off = 8.797444499042767883e+114 },
184 HP{.val=1.000000e+130, .off= -5.978307824605161274e+113 },184 HP{ .val = 1.000000e+130, .off = -5.978307824605161274e+113 },
185 HP{.val=1.000000e+129, .off= 1.782556435814758516e+111 },185 HP{ .val = 1.000000e+129, .off = 1.782556435814758516e+111 },
186 HP{.val=1.000000e+128, .off= -7.517448691651820362e+111 },186 HP{ .val = 1.000000e+128, .off = -7.517448691651820362e+111 },
187 HP{.val=1.000000e+127, .off= 4.507089332150205498e+110 },187 HP{ .val = 1.000000e+127, .off = 4.507089332150205498e+110 },
188 HP{.val=1.000000e+126, .off= 7.513223838100711695e+109 },188 HP{ .val = 1.000000e+126, .off = 7.513223838100711695e+109 },
189 HP{.val=1.000000e+125, .off= 7.513223838100712113e+108 },189 HP{ .val = 1.000000e+125, .off = 7.513223838100712113e+108 },
190 HP{.val=1.000000e+124, .off= 5.164681255326878494e+107 },190 HP{ .val = 1.000000e+124, .off = 5.164681255326878494e+107 },
191 HP{.val=1.000000e+123, .off= 2.229003026859587122e+106 },191 HP{ .val = 1.000000e+123, .off = 2.229003026859587122e+106 },
192 HP{.val=1.000000e+122, .off= -1.440594758724527399e+105 },192 HP{ .val = 1.000000e+122, .off = -1.440594758724527399e+105 },
193 HP{.val=1.000000e+121, .off= -3.734093374714598783e+104 },193 HP{ .val = 1.000000e+121, .off = -3.734093374714598783e+104 },
194 HP{.val=1.000000e+120, .off= 1.999653165260579757e+103 },194 HP{ .val = 1.000000e+120, .off = 1.999653165260579757e+103 },
195 HP{.val=1.000000e+119, .off= 5.583244752745066693e+102 },195 HP{ .val = 1.000000e+119, .off = 5.583244752745066693e+102 },
196 HP{.val=1.000000e+118, .off= 3.343500010567262234e+101 },196 HP{ .val = 1.000000e+118, .off = 3.343500010567262234e+101 },
197 HP{.val=1.000000e+117, .off= -5.055542772599503556e+100 },197 HP{ .val = 1.000000e+117, .off = -5.055542772599503556e+100 },
198 HP{.val=1.000000e+116, .off= -1.555941612946684331e+99 },198 HP{ .val = 1.000000e+116, .off = -1.555941612946684331e+99 },
199 HP{.val=1.000000e+115, .off= -1.555941612946684331e+98 },199 HP{ .val = 1.000000e+115, .off = -1.555941612946684331e+98 },
200 HP{.val=1.000000e+114, .off= -1.555941612946684293e+97 },200 HP{ .val = 1.000000e+114, .off = -1.555941612946684293e+97 },
201 HP{.val=1.000000e+113, .off= -1.555941612946684246e+96 },201 HP{ .val = 1.000000e+113, .off = -1.555941612946684246e+96 },
202 HP{.val=1.000000e+112, .off= 6.988006530736955847e+95 },202 HP{ .val = 1.000000e+112, .off = 6.988006530736955847e+95 },
203 HP{.val=1.000000e+111, .off= 4.318022735835818244e+94 },203 HP{ .val = 1.000000e+111, .off = 4.318022735835818244e+94 },
204 HP{.val=1.000000e+110, .off= -2.356936751417025578e+93 },204 HP{ .val = 1.000000e+110, .off = -2.356936751417025578e+93 },
205 HP{.val=1.000000e+109, .off= 1.814912928116001926e+92 },205 HP{ .val = 1.000000e+109, .off = 1.814912928116001926e+92 },
206 HP{.val=1.000000e+108, .off= -3.399899171300282744e+91 },206 HP{ .val = 1.000000e+108, .off = -3.399899171300282744e+91 },
207 HP{.val=1.000000e+107, .off= 3.118615952970072913e+90 },207 HP{ .val = 1.000000e+107, .off = 3.118615952970072913e+90 },
208 HP{.val=1.000000e+106, .off= -9.103599905036843605e+89 },208 HP{ .val = 1.000000e+106, .off = -9.103599905036843605e+89 },
209 HP{.val=1.000000e+105, .off= 6.174169917471802325e+88 },209 HP{ .val = 1.000000e+105, .off = 6.174169917471802325e+88 },
210 HP{.val=1.000000e+104, .off= -1.915675085734668657e+86 },210 HP{ .val = 1.000000e+104, .off = -1.915675085734668657e+86 },
211 HP{.val=1.000000e+103, .off= -1.915675085734668864e+85 },211 HP{ .val = 1.000000e+103, .off = -1.915675085734668864e+85 },
212 HP{.val=1.000000e+102, .off= 2.295048673475466221e+85 },212 HP{ .val = 1.000000e+102, .off = 2.295048673475466221e+85 },
213 HP{.val=1.000000e+101, .off= 2.295048673475466135e+84 },213 HP{ .val = 1.000000e+101, .off = 2.295048673475466135e+84 },
214 HP{.val=1.000000e+100, .off= -1.590289110975991792e+83 },214 HP{ .val = 1.000000e+100, .off = -1.590289110975991792e+83 },
215 HP{.val=1.000000e+99, .off= 3.266383119588331155e+82 },215 HP{ .val = 1.000000e+99, .off = 3.266383119588331155e+82 },
216 HP{.val=1.000000e+98, .off= 2.309629754856292029e+80 },216 HP{ .val = 1.000000e+98, .off = 2.309629754856292029e+80 },
217 HP{.val=1.000000e+97, .off= -7.357587384771124533e+80 },217 HP{ .val = 1.000000e+97, .off = -7.357587384771124533e+80 },
218 HP{.val=1.000000e+96, .off= -4.986165397190889509e+79 },218 HP{ .val = 1.000000e+96, .off = -4.986165397190889509e+79 },
219 HP{.val=1.000000e+95, .off= -2.021887912715594741e+78 },219 HP{ .val = 1.000000e+95, .off = -2.021887912715594741e+78 },
220 HP{.val=1.000000e+94, .off= -2.021887912715594638e+77 },220 HP{ .val = 1.000000e+94, .off = -2.021887912715594638e+77 },
221 HP{.val=1.000000e+93, .off= -4.337729697461918675e+76 },221 HP{ .val = 1.000000e+93, .off = -4.337729697461918675e+76 },
222 HP{.val=1.000000e+92, .off= -4.337729697461918997e+75 },222 HP{ .val = 1.000000e+92, .off = -4.337729697461918997e+75 },
223 HP{.val=1.000000e+91, .off= -7.956232486128049702e+74 },223 HP{ .val = 1.000000e+91, .off = -7.956232486128049702e+74 },
224 HP{.val=1.000000e+90, .off= 3.351588728453609882e+73 },224 HP{ .val = 1.000000e+90, .off = 3.351588728453609882e+73 },
225 HP{.val=1.000000e+89, .off= 5.246334248081951113e+71 },225 HP{ .val = 1.000000e+89, .off = 5.246334248081951113e+71 },
226 HP{.val=1.000000e+88, .off= 4.058327554364963672e+71 },226 HP{ .val = 1.000000e+88, .off = 4.058327554364963672e+71 },
227 HP{.val=1.000000e+87, .off= 4.058327554364963918e+70 },227 HP{ .val = 1.000000e+87, .off = 4.058327554364963918e+70 },
228 HP{.val=1.000000e+86, .off= -1.463069523067487266e+69 },228 HP{ .val = 1.000000e+86, .off = -1.463069523067487266e+69 },
229 HP{.val=1.000000e+85, .off= -1.463069523067487314e+68 },229 HP{ .val = 1.000000e+85, .off = -1.463069523067487314e+68 },
230 HP{.val=1.000000e+84, .off= -5.776660989811589441e+67 },230 HP{ .val = 1.000000e+84, .off = -5.776660989811589441e+67 },
231 HP{.val=1.000000e+83, .off= -3.080666323096525761e+66 },231 HP{ .val = 1.000000e+83, .off = -3.080666323096525761e+66 },
232 HP{.val=1.000000e+82, .off= 3.659320343691134468e+65 },232 HP{ .val = 1.000000e+82, .off = 3.659320343691134468e+65 },
233 HP{.val=1.000000e+81, .off= 7.871812010433421235e+64 },233 HP{ .val = 1.000000e+81, .off = 7.871812010433421235e+64 },
234 HP{.val=1.000000e+80, .off= -2.660986470836727449e+61 },234 HP{ .val = 1.000000e+80, .off = -2.660986470836727449e+61 },
235 HP{.val=1.000000e+79, .off= 3.264399249934044627e+62 },235 HP{ .val = 1.000000e+79, .off = 3.264399249934044627e+62 },
236 HP{.val=1.000000e+78, .off= -8.493621433689703070e+60 },236 HP{ .val = 1.000000e+78, .off = -8.493621433689703070e+60 },
237 HP{.val=1.000000e+77, .off= 1.721738727445414063e+60 },237 HP{ .val = 1.000000e+77, .off = 1.721738727445414063e+60 },
238 HP{.val=1.000000e+76, .off= -4.706013449590547218e+59 },238 HP{ .val = 1.000000e+76, .off = -4.706013449590547218e+59 },
239 HP{.val=1.000000e+75, .off= 7.346021882351880518e+58 },239 HP{ .val = 1.000000e+75, .off = 7.346021882351880518e+58 },
240 HP{.val=1.000000e+74, .off= 4.835181188197207515e+57 },240 HP{ .val = 1.000000e+74, .off = 4.835181188197207515e+57 },
241 HP{.val=1.000000e+73, .off= 1.696630320503867482e+56 },241 HP{ .val = 1.000000e+73, .off = 1.696630320503867482e+56 },
242 HP{.val=1.000000e+72, .off= 5.619818905120542959e+55 },242 HP{ .val = 1.000000e+72, .off = 5.619818905120542959e+55 },
243 HP{.val=1.000000e+71, .off= -4.188152556421145598e+54 },243 HP{ .val = 1.000000e+71, .off = -4.188152556421145598e+54 },
244 HP{.val=1.000000e+70, .off= -7.253143638152923145e+53 },244 HP{ .val = 1.000000e+70, .off = -7.253143638152923145e+53 },
245 HP{.val=1.000000e+69, .off= -7.253143638152923145e+52 },245 HP{ .val = 1.000000e+69, .off = -7.253143638152923145e+52 },
246 HP{.val=1.000000e+68, .off= 4.719477774861832896e+51 },246 HP{ .val = 1.000000e+68, .off = 4.719477774861832896e+51 },
247 HP{.val=1.000000e+67, .off= 1.726322421608144052e+50 },247 HP{ .val = 1.000000e+67, .off = 1.726322421608144052e+50 },
248 HP{.val=1.000000e+66, .off= 5.467766613175255107e+49 },248 HP{ .val = 1.000000e+66, .off = 5.467766613175255107e+49 },
249 HP{.val=1.000000e+65, .off= 7.909613737163661911e+47 },249 HP{ .val = 1.000000e+65, .off = 7.909613737163661911e+47 },
250 HP{.val=1.000000e+64, .off= -2.132041900945439564e+47 },250 HP{ .val = 1.000000e+64, .off = -2.132041900945439564e+47 },
251 HP{.val=1.000000e+63, .off= -5.785795994272697265e+46 },251 HP{ .val = 1.000000e+63, .off = -5.785795994272697265e+46 },
252 HP{.val=1.000000e+62, .off= -3.502199685943161329e+45 },252 HP{ .val = 1.000000e+62, .off = -3.502199685943161329e+45 },
253 HP{.val=1.000000e+61, .off= 5.061286470292598274e+44 },253 HP{ .val = 1.000000e+61, .off = 5.061286470292598274e+44 },
254 HP{.val=1.000000e+60, .off= 5.061286470292598472e+43 },254 HP{ .val = 1.000000e+60, .off = 5.061286470292598472e+43 },
255 HP{.val=1.000000e+59, .off= 2.831211950439536034e+42 },255 HP{ .val = 1.000000e+59, .off = 2.831211950439536034e+42 },
256 HP{.val=1.000000e+58, .off= 5.618805100255863927e+41 },256 HP{ .val = 1.000000e+58, .off = 5.618805100255863927e+41 },
257 HP{.val=1.000000e+57, .off= -4.834669211555366251e+40 },257 HP{ .val = 1.000000e+57, .off = -4.834669211555366251e+40 },
258 HP{.val=1.000000e+56, .off= -9.190283508143378583e+39 },258 HP{ .val = 1.000000e+56, .off = -9.190283508143378583e+39 },
259 HP{.val=1.000000e+55, .off= -1.023506702040855158e+38 },259 HP{ .val = 1.000000e+55, .off = -1.023506702040855158e+38 },
260 HP{.val=1.000000e+54, .off= -7.829154040459624616e+37 },260 HP{ .val = 1.000000e+54, .off = -7.829154040459624616e+37 },
261 HP{.val=1.000000e+53, .off= 6.779051325638372659e+35 },261 HP{ .val = 1.000000e+53, .off = 6.779051325638372659e+35 },
262 HP{.val=1.000000e+52, .off= 6.779051325638372290e+34 },262 HP{ .val = 1.000000e+52, .off = 6.779051325638372290e+34 },
263 HP{.val=1.000000e+51, .off= 6.779051325638371598e+33 },263 HP{ .val = 1.000000e+51, .off = 6.779051325638371598e+33 },
264 HP{.val=1.000000e+50, .off= -7.629769841091887392e+33 },264 HP{ .val = 1.000000e+50, .off = -7.629769841091887392e+33 },
265 HP{.val=1.000000e+49, .off= 5.350972305245182400e+32 },265 HP{ .val = 1.000000e+49, .off = 5.350972305245182400e+32 },
266 HP{.val=1.000000e+48, .off= -4.384584304507619764e+31 },266 HP{ .val = 1.000000e+48, .off = -4.384584304507619764e+31 },
267 HP{.val=1.000000e+47, .off= -4.384584304507619876e+30 },267 HP{ .val = 1.000000e+47, .off = -4.384584304507619876e+30 },
268 HP{.val=1.000000e+46, .off= 6.860180964052978705e+28 },268 HP{ .val = 1.000000e+46, .off = 6.860180964052978705e+28 },
269 HP{.val=1.000000e+45, .off= 7.024271097546444878e+28 },269 HP{ .val = 1.000000e+45, .off = 7.024271097546444878e+28 },
270 HP{.val=1.000000e+44, .off= -8.821361405306422641e+27 },270 HP{ .val = 1.000000e+44, .off = -8.821361405306422641e+27 },
271 HP{.val=1.000000e+43, .off= -1.393721169594140991e+26 },271 HP{ .val = 1.000000e+43, .off = -1.393721169594140991e+26 },
272 HP{.val=1.000000e+42, .off= -4.488571267807591679e+25 },272 HP{ .val = 1.000000e+42, .off = -4.488571267807591679e+25 },
273 HP{.val=1.000000e+41, .off= -6.200086450407783195e+23 },273 HP{ .val = 1.000000e+41, .off = -6.200086450407783195e+23 },
274 HP{.val=1.000000e+40, .off= -3.037860284270036669e+23 },274 HP{ .val = 1.000000e+40, .off = -3.037860284270036669e+23 },
275 HP{.val=1.000000e+39, .off= 6.029083362839682141e+22 },275 HP{ .val = 1.000000e+39, .off = 6.029083362839682141e+22 },
276 HP{.val=1.000000e+38, .off= 2.251190176543965970e+21 },276 HP{ .val = 1.000000e+38, .off = 2.251190176543965970e+21 },
277 HP{.val=1.000000e+37, .off= 4.612373417978788577e+20 },277 HP{ .val = 1.000000e+37, .off = 4.612373417978788577e+20 },
278 HP{.val=1.000000e+36, .off= -4.242063737401796198e+19 },278 HP{ .val = 1.000000e+36, .off = -4.242063737401796198e+19 },
279 HP{.val=1.000000e+35, .off= 3.136633892082024448e+18 },279 HP{ .val = 1.000000e+35, .off = 3.136633892082024448e+18 },
280 HP{.val=1.000000e+34, .off= 5.442476901295718400e+17 },280 HP{ .val = 1.000000e+34, .off = 5.442476901295718400e+17 },
281 HP{.val=1.000000e+33, .off= 5.442476901295718400e+16 },281 HP{ .val = 1.000000e+33, .off = 5.442476901295718400e+16 },
282 HP{.val=1.000000e+32, .off= -5.366162204393472000e+15 },282 HP{ .val = 1.000000e+32, .off = -5.366162204393472000e+15 },
283 HP{.val=1.000000e+31, .off= 3.641037050347520000e+14 },283 HP{ .val = 1.000000e+31, .off = 3.641037050347520000e+14 },
284 HP{.val=1.000000e+30, .off= -1.988462483865600000e+13 },284 HP{ .val = 1.000000e+30, .off = -1.988462483865600000e+13 },
285 HP{.val=1.000000e+29, .off= 8.566849142784000000e+12 },285 HP{ .val = 1.000000e+29, .off = 8.566849142784000000e+12 },
286 HP{.val=1.000000e+28, .off= 4.168802631680000000e+11 },286 HP{ .val = 1.000000e+28, .off = 4.168802631680000000e+11 },
287 HP{.val=1.000000e+27, .off= -1.328755507200000000e+10 },287 HP{ .val = 1.000000e+27, .off = -1.328755507200000000e+10 },
288 HP{.val=1.000000e+26, .off= -4.764729344000000000e+09 },288 HP{ .val = 1.000000e+26, .off = -4.764729344000000000e+09 },
289 HP{.val=1.000000e+25, .off= -9.059696640000000000e+08 },289 HP{ .val = 1.000000e+25, .off = -9.059696640000000000e+08 },
290 HP{.val=1.000000e+24, .off= 1.677721600000000000e+07 },290 HP{ .val = 1.000000e+24, .off = 1.677721600000000000e+07 },
291 HP{.val=1.000000e+23, .off= 8.388608000000000000e+06 },291 HP{ .val = 1.000000e+23, .off = 8.388608000000000000e+06 },
292 HP{.val=1.000000e+22, .off= 0.000000000000000000e+00 },292 HP{ .val = 1.000000e+22, .off = 0.000000000000000000e+00 },
293 HP{.val=1.000000e+21, .off= 0.000000000000000000e+00 },293 HP{ .val = 1.000000e+21, .off = 0.000000000000000000e+00 },
294 HP{.val=1.000000e+20, .off= 0.000000000000000000e+00 },294 HP{ .val = 1.000000e+20, .off = 0.000000000000000000e+00 },
295 HP{.val=1.000000e+19, .off= 0.000000000000000000e+00 },295 HP{ .val = 1.000000e+19, .off = 0.000000000000000000e+00 },
296 HP{.val=1.000000e+18, .off= 0.000000000000000000e+00 },296 HP{ .val = 1.000000e+18, .off = 0.000000000000000000e+00 },
297 HP{.val=1.000000e+17, .off= 0.000000000000000000e+00 },297 HP{ .val = 1.000000e+17, .off = 0.000000000000000000e+00 },
298 HP{.val=1.000000e+16, .off= 0.000000000000000000e+00 },298 HP{ .val = 1.000000e+16, .off = 0.000000000000000000e+00 },
299 HP{.val=1.000000e+15, .off= 0.000000000000000000e+00 },299 HP{ .val = 1.000000e+15, .off = 0.000000000000000000e+00 },
300 HP{.val=1.000000e+14, .off= 0.000000000000000000e+00 },300 HP{ .val = 1.000000e+14, .off = 0.000000000000000000e+00 },
301 HP{.val=1.000000e+13, .off= 0.000000000000000000e+00 },301 HP{ .val = 1.000000e+13, .off = 0.000000000000000000e+00 },
302 HP{.val=1.000000e+12, .off= 0.000000000000000000e+00 },302 HP{ .val = 1.000000e+12, .off = 0.000000000000000000e+00 },
303 HP{.val=1.000000e+11, .off= 0.000000000000000000e+00 },303 HP{ .val = 1.000000e+11, .off = 0.000000000000000000e+00 },
304 HP{.val=1.000000e+10, .off= 0.000000000000000000e+00 },304 HP{ .val = 1.000000e+10, .off = 0.000000000000000000e+00 },
305 HP{.val=1.000000e+09, .off= 0.000000000000000000e+00 },305 HP{ .val = 1.000000e+09, .off = 0.000000000000000000e+00 },
306 HP{.val=1.000000e+08, .off= 0.000000000000000000e+00 },306 HP{ .val = 1.000000e+08, .off = 0.000000000000000000e+00 },
307 HP{.val=1.000000e+07, .off= 0.000000000000000000e+00 },307 HP{ .val = 1.000000e+07, .off = 0.000000000000000000e+00 },
308 HP{.val=1.000000e+06, .off= 0.000000000000000000e+00 },308 HP{ .val = 1.000000e+06, .off = 0.000000000000000000e+00 },
309 HP{.val=1.000000e+05, .off= 0.000000000000000000e+00 },309 HP{ .val = 1.000000e+05, .off = 0.000000000000000000e+00 },
310 HP{.val=1.000000e+04, .off= 0.000000000000000000e+00 },310 HP{ .val = 1.000000e+04, .off = 0.000000000000000000e+00 },
311 HP{.val=1.000000e+03, .off= 0.000000000000000000e+00 },311 HP{ .val = 1.000000e+03, .off = 0.000000000000000000e+00 },
312 HP{.val=1.000000e+02, .off= 0.000000000000000000e+00 },312 HP{ .val = 1.000000e+02, .off = 0.000000000000000000e+00 },
313 HP{.val=1.000000e+01, .off= 0.000000000000000000e+00 },313 HP{ .val = 1.000000e+01, .off = 0.000000000000000000e+00 },
314 HP{.val=1.000000e+00, .off= 0.000000000000000000e+00 },314 HP{ .val = 1.000000e+00, .off = 0.000000000000000000e+00 },
315 HP{.val=1.000000e-01, .off= -5.551115123125783010e-18 },315 HP{ .val = 1.000000e-01, .off = -5.551115123125783010e-18 },
316 HP{.val=1.000000e-02, .off= -2.081668171172168436e-19 },316 HP{ .val = 1.000000e-02, .off = -2.081668171172168436e-19 },
317 HP{.val=1.000000e-03, .off= -2.081668171172168557e-20 },317 HP{ .val = 1.000000e-03, .off = -2.081668171172168557e-20 },
318 HP{.val=1.000000e-04, .off= -4.792173602385929943e-21 },318 HP{ .val = 1.000000e-04, .off = -4.792173602385929943e-21 },
319 HP{.val=1.000000e-05, .off= -8.180305391403130547e-22 },319 HP{ .val = 1.000000e-05, .off = -8.180305391403130547e-22 },
320 HP{.val=1.000000e-06, .off= 4.525188817411374069e-23 },320 HP{ .val = 1.000000e-06, .off = 4.525188817411374069e-23 },
321 HP{.val=1.000000e-07, .off= 4.525188817411373922e-24 },321 HP{ .val = 1.000000e-07, .off = 4.525188817411373922e-24 },
322 HP{.val=1.000000e-08, .off= -2.092256083012847109e-25 },322 HP{ .val = 1.000000e-08, .off = -2.092256083012847109e-25 },
323 HP{.val=1.000000e-09, .off= -6.228159145777985254e-26 },323 HP{ .val = 1.000000e-09, .off = -6.228159145777985254e-26 },
324 HP{.val=1.000000e-10, .off= -3.643219731549774344e-27 },324 HP{ .val = 1.000000e-10, .off = -3.643219731549774344e-27 },
325 HP{.val=1.000000e-11, .off= 6.050303071806019080e-28 },325 HP{ .val = 1.000000e-11, .off = 6.050303071806019080e-28 },
326 HP{.val=1.000000e-12, .off= 2.011335237074438524e-29 },326 HP{ .val = 1.000000e-12, .off = 2.011335237074438524e-29 },
327 HP{.val=1.000000e-13, .off= -3.037374556340037101e-30 },327 HP{ .val = 1.000000e-13, .off = -3.037374556340037101e-30 },
328 HP{.val=1.000000e-14, .off= 1.180690645440101289e-32 },328 HP{ .val = 1.000000e-14, .off = 1.180690645440101289e-32 },
329 HP{.val=1.000000e-15, .off= -7.770539987666107583e-32 },329 HP{ .val = 1.000000e-15, .off = -7.770539987666107583e-32 },
330 HP{.val=1.000000e-16, .off= 2.090221327596539779e-33 },330 HP{ .val = 1.000000e-16, .off = 2.090221327596539779e-33 },
331 HP{.val=1.000000e-17, .off= -7.154242405462192144e-34 },331 HP{ .val = 1.000000e-17, .off = -7.154242405462192144e-34 },
332 HP{.val=1.000000e-18, .off= -7.154242405462192572e-35 },332 HP{ .val = 1.000000e-18, .off = -7.154242405462192572e-35 },
333 HP{.val=1.000000e-19, .off= 2.475407316473986894e-36 },333 HP{ .val = 1.000000e-19, .off = 2.475407316473986894e-36 },
334 HP{.val=1.000000e-20, .off= 5.484672854579042914e-37 },334 HP{ .val = 1.000000e-20, .off = 5.484672854579042914e-37 },
335 HP{.val=1.000000e-21, .off= 9.246254777210362522e-38 },335 HP{ .val = 1.000000e-21, .off = 9.246254777210362522e-38 },
336 HP{.val=1.000000e-22, .off= -4.859677432657087182e-39 },336 HP{ .val = 1.000000e-22, .off = -4.859677432657087182e-39 },
337 HP{.val=1.000000e-23, .off= 3.956530198510069291e-40 },337 HP{ .val = 1.000000e-23, .off = 3.956530198510069291e-40 },
338 HP{.val=1.000000e-24, .off= 7.629950044829717753e-41 },338 HP{ .val = 1.000000e-24, .off = 7.629950044829717753e-41 },
339 HP{.val=1.000000e-25, .off= -3.849486974919183692e-42 },339 HP{ .val = 1.000000e-25, .off = -3.849486974919183692e-42 },
340 HP{.val=1.000000e-26, .off= -3.849486974919184170e-43 },340 HP{ .val = 1.000000e-26, .off = -3.849486974919184170e-43 },
341 HP{.val=1.000000e-27, .off= -3.849486974919184070e-44 },341 HP{ .val = 1.000000e-27, .off = -3.849486974919184070e-44 },
342 HP{.val=1.000000e-28, .off= 2.876745653839937870e-45 },342 HP{ .val = 1.000000e-28, .off = 2.876745653839937870e-45 },
343 HP{.val=1.000000e-29, .off= 5.679342582489572168e-46 },343 HP{ .val = 1.000000e-29, .off = 5.679342582489572168e-46 },
344 HP{.val=1.000000e-30, .off= -8.333642060758598930e-47 },344 HP{ .val = 1.000000e-30, .off = -8.333642060758598930e-47 },
345 HP{.val=1.000000e-31, .off= -8.333642060758597958e-48 },345 HP{ .val = 1.000000e-31, .off = -8.333642060758597958e-48 },
346 HP{.val=1.000000e-32, .off= -5.596730997624190224e-49 },346 HP{ .val = 1.000000e-32, .off = -5.596730997624190224e-49 },
347 HP{.val=1.000000e-33, .off= -5.596730997624190604e-50 },347 HP{ .val = 1.000000e-33, .off = -5.596730997624190604e-50 },
348 HP{.val=1.000000e-34, .off= 7.232539610818348498e-51 },348 HP{ .val = 1.000000e-34, .off = 7.232539610818348498e-51 },
349 HP{.val=1.000000e-35, .off= -7.857545194582380514e-53 },349 HP{ .val = 1.000000e-35, .off = -7.857545194582380514e-53 },
350 HP{.val=1.000000e-36, .off= 5.896157255772251528e-53 },350 HP{ .val = 1.000000e-36, .off = 5.896157255772251528e-53 },
351 HP{.val=1.000000e-37, .off= -6.632427322784915796e-54 },351 HP{ .val = 1.000000e-37, .off = -6.632427322784915796e-54 },
352 HP{.val=1.000000e-38, .off= 3.808059826012723592e-55 },352 HP{ .val = 1.000000e-38, .off = 3.808059826012723592e-55 },
353 HP{.val=1.000000e-39, .off= 7.070712060011985131e-56 },353 HP{ .val = 1.000000e-39, .off = 7.070712060011985131e-56 },
354 HP{.val=1.000000e-40, .off= 7.070712060011985584e-57 },354 HP{ .val = 1.000000e-40, .off = 7.070712060011985584e-57 },
355 HP{.val=1.000000e-41, .off= -5.761291134237854167e-59 },355 HP{ .val = 1.000000e-41, .off = -5.761291134237854167e-59 },
356 HP{.val=1.000000e-42, .off= -3.762312935688689794e-59 },356 HP{ .val = 1.000000e-42, .off = -3.762312935688689794e-59 },
357 HP{.val=1.000000e-43, .off= -7.745042713519821150e-60 },357 HP{ .val = 1.000000e-43, .off = -7.745042713519821150e-60 },
358 HP{.val=1.000000e-44, .off= 4.700987842202462817e-61 },358 HP{ .val = 1.000000e-44, .off = 4.700987842202462817e-61 },
359 HP{.val=1.000000e-45, .off= 1.589480203271891964e-62 },359 HP{ .val = 1.000000e-45, .off = 1.589480203271891964e-62 },
360 HP{.val=1.000000e-46, .off= -2.299904345391321765e-63 },360 HP{ .val = 1.000000e-46, .off = -2.299904345391321765e-63 },
361 HP{.val=1.000000e-47, .off= 2.561826340437695261e-64 },361 HP{ .val = 1.000000e-47, .off = 2.561826340437695261e-64 },
362 HP{.val=1.000000e-48, .off= 2.561826340437695345e-65 },362 HP{ .val = 1.000000e-48, .off = 2.561826340437695345e-65 },
363 HP{.val=1.000000e-49, .off= 6.360053438741614633e-66 },363 HP{ .val = 1.000000e-49, .off = 6.360053438741614633e-66 },
364 HP{.val=1.000000e-50, .off= -7.616223705782342295e-68 },364 HP{ .val = 1.000000e-50, .off = -7.616223705782342295e-68 },
365 HP{.val=1.000000e-51, .off= -7.616223705782343324e-69 },365 HP{ .val = 1.000000e-51, .off = -7.616223705782343324e-69 },
366 HP{.val=1.000000e-52, .off= -7.616223705782342295e-70 },366 HP{ .val = 1.000000e-52, .off = -7.616223705782342295e-70 },
367 HP{.val=1.000000e-53, .off= -3.079876214757872338e-70 },367 HP{ .val = 1.000000e-53, .off = -3.079876214757872338e-70 },
368 HP{.val=1.000000e-54, .off= -3.079876214757872821e-71 },368 HP{ .val = 1.000000e-54, .off = -3.079876214757872821e-71 },
369 HP{.val=1.000000e-55, .off= 5.423954167728123147e-73 },369 HP{ .val = 1.000000e-55, .off = 5.423954167728123147e-73 },
370 HP{.val=1.000000e-56, .off= -3.985444122640543680e-73 },370 HP{ .val = 1.000000e-56, .off = -3.985444122640543680e-73 },
371 HP{.val=1.000000e-57, .off= 4.504255013759498850e-74 },371 HP{ .val = 1.000000e-57, .off = 4.504255013759498850e-74 },
372 HP{.val=1.000000e-58, .off= -2.570494266573869991e-75 },372 HP{ .val = 1.000000e-58, .off = -2.570494266573869991e-75 },
373 HP{.val=1.000000e-59, .off= -2.570494266573869930e-76 },373 HP{ .val = 1.000000e-59, .off = -2.570494266573869930e-76 },
374 HP{.val=1.000000e-60, .off= 2.956653608686574324e-77 },374 HP{ .val = 1.000000e-60, .off = 2.956653608686574324e-77 },
375 HP{.val=1.000000e-61, .off= -3.952281235388981376e-78 },375 HP{ .val = 1.000000e-61, .off = -3.952281235388981376e-78 },
376 HP{.val=1.000000e-62, .off= -3.952281235388981376e-79 },376 HP{ .val = 1.000000e-62, .off = -3.952281235388981376e-79 },
377 HP{.val=1.000000e-63, .off= -6.651083908855995172e-80 },377 HP{ .val = 1.000000e-63, .off = -6.651083908855995172e-80 },
378 HP{.val=1.000000e-64, .off= 3.469426116645307030e-81 },378 HP{ .val = 1.000000e-64, .off = 3.469426116645307030e-81 },
379 HP{.val=1.000000e-65, .off= 7.686305293937516319e-82 },379 HP{ .val = 1.000000e-65, .off = 7.686305293937516319e-82 },
380 HP{.val=1.000000e-66, .off= 2.415206322322254927e-83 },380 HP{ .val = 1.000000e-66, .off = 2.415206322322254927e-83 },
381 HP{.val=1.000000e-67, .off= 5.709643179581793251e-84 },381 HP{ .val = 1.000000e-67, .off = 5.709643179581793251e-84 },
382 HP{.val=1.000000e-68, .off= -6.644495035141475923e-85 },382 HP{ .val = 1.000000e-68, .off = -6.644495035141475923e-85 },
383 HP{.val=1.000000e-69, .off= 3.650620143794581913e-86 },383 HP{ .val = 1.000000e-69, .off = 3.650620143794581913e-86 },
384 HP{.val=1.000000e-70, .off= 4.333966503770636492e-88 },384 HP{ .val = 1.000000e-70, .off = 4.333966503770636492e-88 },
385 HP{.val=1.000000e-71, .off= 8.476455383920859113e-88 },385 HP{ .val = 1.000000e-71, .off = 8.476455383920859113e-88 },
386 HP{.val=1.000000e-72, .off= 3.449543675455986564e-89 },386 HP{ .val = 1.000000e-72, .off = 3.449543675455986564e-89 },
387 HP{.val=1.000000e-73, .off= 3.077238576654418974e-91 },387 HP{ .val = 1.000000e-73, .off = 3.077238576654418974e-91 },
388 HP{.val=1.000000e-74, .off= 4.234998629903623140e-91 },388 HP{ .val = 1.000000e-74, .off = 4.234998629903623140e-91 },
389 HP{.val=1.000000e-75, .off= 4.234998629903623412e-92 },389 HP{ .val = 1.000000e-75, .off = 4.234998629903623412e-92 },
390 HP{.val=1.000000e-76, .off= 7.303182045714702338e-93 },390 HP{ .val = 1.000000e-76, .off = 7.303182045714702338e-93 },
391 HP{.val=1.000000e-77, .off= 7.303182045714701699e-94 },391 HP{ .val = 1.000000e-77, .off = 7.303182045714701699e-94 },
392 HP{.val=1.000000e-78, .off= 1.121271649074855759e-96 },392 HP{ .val = 1.000000e-78, .off = 1.121271649074855759e-96 },
393 HP{.val=1.000000e-79, .off= 1.121271649074855863e-97 },393 HP{ .val = 1.000000e-79, .off = 1.121271649074855863e-97 },
394 HP{.val=1.000000e-80, .off= 3.857468248661243988e-97 },394 HP{ .val = 1.000000e-80, .off = 3.857468248661243988e-97 },
395 HP{.val=1.000000e-81, .off= 3.857468248661244248e-98 },395 HP{ .val = 1.000000e-81, .off = 3.857468248661244248e-98 },
396 HP{.val=1.000000e-82, .off= 3.857468248661244410e-99 },396 HP{ .val = 1.000000e-82, .off = 3.857468248661244410e-99 },
397 HP{.val=1.000000e-83, .off= -3.457651055545315679e-100 },397 HP{ .val = 1.000000e-83, .off = -3.457651055545315679e-100 },
398 HP{.val=1.000000e-84, .off= -3.457651055545315933e-101 },398 HP{ .val = 1.000000e-84, .off = -3.457651055545315933e-101 },
399 HP{.val=1.000000e-85, .off= 2.257285900866059216e-102 },399 HP{ .val = 1.000000e-85, .off = 2.257285900866059216e-102 },
400 HP{.val=1.000000e-86, .off= -8.458220892405268345e-103 },400 HP{ .val = 1.000000e-86, .off = -8.458220892405268345e-103 },
401 HP{.val=1.000000e-87, .off= -1.761029146610688867e-104 },401 HP{ .val = 1.000000e-87, .off = -1.761029146610688867e-104 },
402 HP{.val=1.000000e-88, .off= 6.610460535632536565e-105 },402 HP{ .val = 1.000000e-88, .off = 6.610460535632536565e-105 },
403 HP{.val=1.000000e-89, .off= -3.853901567171494935e-106 },403 HP{ .val = 1.000000e-89, .off = -3.853901567171494935e-106 },
404 HP{.val=1.000000e-90, .off= 5.062493089968513723e-108 },404 HP{ .val = 1.000000e-90, .off = 5.062493089968513723e-108 },
405 HP{.val=1.000000e-91, .off= -2.218844988608365240e-108 },405 HP{ .val = 1.000000e-91, .off = -2.218844988608365240e-108 },
406 HP{.val=1.000000e-92, .off= 1.187522883398155383e-109 },406 HP{ .val = 1.000000e-92, .off = 1.187522883398155383e-109 },
407 HP{.val=1.000000e-93, .off= 9.703442563414457296e-110 },407 HP{ .val = 1.000000e-93, .off = 9.703442563414457296e-110 },
408 HP{.val=1.000000e-94, .off= 4.380992763404268896e-111 },408 HP{ .val = 1.000000e-94, .off = 4.380992763404268896e-111 },
409 HP{.val=1.000000e-95, .off= 1.054461638397900823e-112 },409 HP{ .val = 1.000000e-95, .off = 1.054461638397900823e-112 },
410 HP{.val=1.000000e-96, .off= 9.370789450913819736e-113 },410 HP{ .val = 1.000000e-96, .off = 9.370789450913819736e-113 },
411 HP{.val=1.000000e-97, .off= -3.623472756142303998e-114 },411 HP{ .val = 1.000000e-97, .off = -3.623472756142303998e-114 },
412 HP{.val=1.000000e-98, .off= 6.122223899149788839e-115 },412 HP{ .val = 1.000000e-98, .off = 6.122223899149788839e-115 },
413 HP{.val=1.000000e-99, .off= -1.999189980260288281e-116 },413 HP{ .val = 1.000000e-99, .off = -1.999189980260288281e-116 },
414 HP{.val=1.000000e-100, .off= -1.999189980260288281e-117 },414 HP{ .val = 1.000000e-100, .off = -1.999189980260288281e-117 },
415 HP{.val=1.000000e-101, .off= -5.171617276904849634e-118 },415 HP{ .val = 1.000000e-101, .off = -5.171617276904849634e-118 },
416 HP{.val=1.000000e-102, .off= 6.724985085512256320e-119 },416 HP{ .val = 1.000000e-102, .off = 6.724985085512256320e-119 },
417 HP{.val=1.000000e-103, .off= 4.246526260008692213e-120 },417 HP{ .val = 1.000000e-103, .off = 4.246526260008692213e-120 },
418 HP{.val=1.000000e-104, .off= 7.344599791888147003e-121 },418 HP{ .val = 1.000000e-104, .off = 7.344599791888147003e-121 },
419 HP{.val=1.000000e-105, .off= 3.472007877038828407e-122 },419 HP{ .val = 1.000000e-105, .off = 3.472007877038828407e-122 },
420 HP{.val=1.000000e-106, .off= 5.892377823819652194e-123 },420 HP{ .val = 1.000000e-106, .off = 5.892377823819652194e-123 },
421 HP{.val=1.000000e-107, .off= -1.585470431324073925e-125 },421 HP{ .val = 1.000000e-107, .off = -1.585470431324073925e-125 },
422 HP{.val=1.000000e-108, .off= -3.940375084977444795e-125 },422 HP{ .val = 1.000000e-108, .off = -3.940375084977444795e-125 },
423 HP{.val=1.000000e-109, .off= 7.869099673288519908e-127 },423 HP{ .val = 1.000000e-109, .off = 7.869099673288519908e-127 },
424 HP{.val=1.000000e-110, .off= -5.122196348054018581e-127 },424 HP{ .val = 1.000000e-110, .off = -5.122196348054018581e-127 },
425 HP{.val=1.000000e-111, .off= -8.815387795168313713e-128 },425 HP{ .val = 1.000000e-111, .off = -8.815387795168313713e-128 },
426 HP{.val=1.000000e-112, .off= 5.034080131510290214e-129 },426 HP{ .val = 1.000000e-112, .off = 5.034080131510290214e-129 },
427 HP{.val=1.000000e-113, .off= 2.148774313452247863e-130 },427 HP{ .val = 1.000000e-113, .off = 2.148774313452247863e-130 },
428 HP{.val=1.000000e-114, .off= -5.064490231692858416e-131 },428 HP{ .val = 1.000000e-114, .off = -5.064490231692858416e-131 },
429 HP{.val=1.000000e-115, .off= -5.064490231692858166e-132 },429 HP{ .val = 1.000000e-115, .off = -5.064490231692858166e-132 },
430 HP{.val=1.000000e-116, .off= 5.708726942017560559e-134 },430 HP{ .val = 1.000000e-116, .off = 5.708726942017560559e-134 },
431 HP{.val=1.000000e-117, .off= -2.951229134482377772e-134 },431 HP{ .val = 1.000000e-117, .off = -2.951229134482377772e-134 },
432 HP{.val=1.000000e-118, .off= 1.451398151372789513e-135 },432 HP{ .val = 1.000000e-118, .off = 1.451398151372789513e-135 },
433 HP{.val=1.000000e-119, .off= -1.300243902286690040e-136 },433 HP{ .val = 1.000000e-119, .off = -1.300243902286690040e-136 },
434 HP{.val=1.000000e-120, .off= 2.139308664787659449e-137 },434 HP{ .val = 1.000000e-120, .off = 2.139308664787659449e-137 },
435 HP{.val=1.000000e-121, .off= 2.139308664787659329e-138 },435 HP{ .val = 1.000000e-121, .off = 2.139308664787659329e-138 },
436 HP{.val=1.000000e-122, .off= -5.922142664292847471e-139 },436 HP{ .val = 1.000000e-122, .off = -5.922142664292847471e-139 },
437 HP{.val=1.000000e-123, .off= -5.922142664292846912e-140 },437 HP{ .val = 1.000000e-123, .off = -5.922142664292846912e-140 },
438 HP{.val=1.000000e-124, .off= 6.673875037395443799e-141 },438 HP{ .val = 1.000000e-124, .off = 6.673875037395443799e-141 },
439 HP{.val=1.000000e-125, .off= -1.198636026159737932e-142 },439 HP{ .val = 1.000000e-125, .off = -1.198636026159737932e-142 },
440 HP{.val=1.000000e-126, .off= 5.361789860136246995e-143 },440 HP{ .val = 1.000000e-126, .off = 5.361789860136246995e-143 },
441 HP{.val=1.000000e-127, .off= -2.838742497733733936e-144 },441 HP{ .val = 1.000000e-127, .off = -2.838742497733733936e-144 },
442 HP{.val=1.000000e-128, .off= -5.401408859568103261e-145 },442 HP{ .val = 1.000000e-128, .off = -5.401408859568103261e-145 },
443 HP{.val=1.000000e-129, .off= 7.411922949603743011e-146 },443 HP{ .val = 1.000000e-129, .off = 7.411922949603743011e-146 },
444 HP{.val=1.000000e-130, .off= -8.604741811861064385e-147 },444 HP{ .val = 1.000000e-130, .off = -8.604741811861064385e-147 },
445 HP{.val=1.000000e-131, .off= 1.405673664054439890e-148 },445 HP{ .val = 1.000000e-131, .off = 1.405673664054439890e-148 },
446 HP{.val=1.000000e-132, .off= 1.405673664054439933e-149 },446 HP{ .val = 1.000000e-132, .off = 1.405673664054439933e-149 },
447 HP{.val=1.000000e-133, .off= -6.414963426504548053e-150 },447 HP{ .val = 1.000000e-133, .off = -6.414963426504548053e-150 },
448 HP{.val=1.000000e-134, .off= -3.971014335704864578e-151 },448 HP{ .val = 1.000000e-134, .off = -3.971014335704864578e-151 },
449 HP{.val=1.000000e-135, .off= -3.971014335704864748e-152 },449 HP{ .val = 1.000000e-135, .off = -3.971014335704864748e-152 },
450 HP{.val=1.000000e-136, .off= -1.523438813303585576e-154 },450 HP{ .val = 1.000000e-136, .off = -1.523438813303585576e-154 },
451 HP{.val=1.000000e-137, .off= 2.234325152653707766e-154 },451 HP{ .val = 1.000000e-137, .off = 2.234325152653707766e-154 },
452 HP{.val=1.000000e-138, .off= -6.715683724786540160e-155 },452 HP{ .val = 1.000000e-138, .off = -6.715683724786540160e-155 },
453 HP{.val=1.000000e-139, .off= -2.986513359186437306e-156 },453 HP{ .val = 1.000000e-139, .off = -2.986513359186437306e-156 },
454 HP{.val=1.000000e-140, .off= 1.674949597813692102e-157 },454 HP{ .val = 1.000000e-140, .off = 1.674949597813692102e-157 },
455 HP{.val=1.000000e-141, .off= -4.151879098436469092e-158 },455 HP{ .val = 1.000000e-141, .off = -4.151879098436469092e-158 },
456 HP{.val=1.000000e-142, .off= -4.151879098436469295e-159 },456 HP{ .val = 1.000000e-142, .off = -4.151879098436469295e-159 },
457 HP{.val=1.000000e-143, .off= 4.952540739454407825e-160 },457 HP{ .val = 1.000000e-143, .off = 4.952540739454407825e-160 },
458 HP{.val=1.000000e-144, .off= 4.952540739454407667e-161 },458 HP{ .val = 1.000000e-144, .off = 4.952540739454407667e-161 },
459 HP{.val=1.000000e-145, .off= 8.508954738630531443e-162 },459 HP{ .val = 1.000000e-145, .off = 8.508954738630531443e-162 },
460 HP{.val=1.000000e-146, .off= -2.604839008794855481e-163 },460 HP{ .val = 1.000000e-146, .off = -2.604839008794855481e-163 },
461 HP{.val=1.000000e-147, .off= 2.952057864917838382e-164 },461 HP{ .val = 1.000000e-147, .off = 2.952057864917838382e-164 },
462 HP{.val=1.000000e-148, .off= 6.425118410988271757e-165 },462 HP{ .val = 1.000000e-148, .off = 6.425118410988271757e-165 },
463 HP{.val=1.000000e-149, .off= 2.083792728400229858e-166 },463 HP{ .val = 1.000000e-149, .off = 2.083792728400229858e-166 },
464 HP{.val=1.000000e-150, .off= -6.295358232172964237e-168 },464 HP{ .val = 1.000000e-150, .off = -6.295358232172964237e-168 },
465 HP{.val=1.000000e-151, .off= 6.153785555826519421e-168 },465 HP{ .val = 1.000000e-151, .off = 6.153785555826519421e-168 },
466 HP{.val=1.000000e-152, .off= -6.564942029880634994e-169 },466 HP{ .val = 1.000000e-152, .off = -6.564942029880634994e-169 },
467 HP{.val=1.000000e-153, .off= -3.915207116191644540e-170 },467 HP{ .val = 1.000000e-153, .off = -3.915207116191644540e-170 },
468 HP{.val=1.000000e-154, .off= 2.709130168030831503e-171 },468 HP{ .val = 1.000000e-154, .off = 2.709130168030831503e-171 },
469 HP{.val=1.000000e-155, .off= -1.431080634608215966e-172 },469 HP{ .val = 1.000000e-155, .off = -1.431080634608215966e-172 },
470 HP{.val=1.000000e-156, .off= -4.018712386257620994e-173 },470 HP{ .val = 1.000000e-156, .off = -4.018712386257620994e-173 },
471 HP{.val=1.000000e-157, .off= 5.684906682427646782e-174 },471 HP{ .val = 1.000000e-157, .off = 5.684906682427646782e-174 },
472 HP{.val=1.000000e-158, .off= -6.444617153428937489e-175 },472 HP{ .val = 1.000000e-158, .off = -6.444617153428937489e-175 },
473 HP{.val=1.000000e-159, .off= 1.136335243981427681e-176 },473 HP{ .val = 1.000000e-159, .off = 1.136335243981427681e-176 },
474 HP{.val=1.000000e-160, .off= 1.136335243981427725e-177 },474 HP{ .val = 1.000000e-160, .off = 1.136335243981427725e-177 },
475 HP{.val=1.000000e-161, .off= -2.812077463003137395e-178 },475 HP{ .val = 1.000000e-161, .off = -2.812077463003137395e-178 },
476 HP{.val=1.000000e-162, .off= 4.591196362592922204e-179 },476 HP{ .val = 1.000000e-162, .off = 4.591196362592922204e-179 },
477 HP{.val=1.000000e-163, .off= 7.675893789924613703e-180 },477 HP{ .val = 1.000000e-163, .off = 7.675893789924613703e-180 },
478 HP{.val=1.000000e-164, .off= 3.820022005759999543e-181 },478 HP{ .val = 1.000000e-164, .off = 3.820022005759999543e-181 },
479 HP{.val=1.000000e-165, .off= -9.998177244457686588e-183 },479 HP{ .val = 1.000000e-165, .off = -9.998177244457686588e-183 },
480 HP{.val=1.000000e-166, .off= -4.012217555824373639e-183 },480 HP{ .val = 1.000000e-166, .off = -4.012217555824373639e-183 },
481 HP{.val=1.000000e-167, .off= -2.467177666011174334e-185 },481 HP{ .val = 1.000000e-167, .off = -2.467177666011174334e-185 },
482 HP{.val=1.000000e-168, .off= -4.953592503130188139e-185 },482 HP{ .val = 1.000000e-168, .off = -4.953592503130188139e-185 },
483 HP{.val=1.000000e-169, .off= -2.011795792799518887e-186 },483 HP{ .val = 1.000000e-169, .off = -2.011795792799518887e-186 },
484 HP{.val=1.000000e-170, .off= 1.665450095113817423e-187 },484 HP{ .val = 1.000000e-170, .off = 1.665450095113817423e-187 },
485 HP{.val=1.000000e-171, .off= 1.665450095113817487e-188 },485 HP{ .val = 1.000000e-171, .off = 1.665450095113817487e-188 },
486 HP{.val=1.000000e-172, .off= -4.080246604750770577e-189 },486 HP{ .val = 1.000000e-172, .off = -4.080246604750770577e-189 },
487 HP{.val=1.000000e-173, .off= -4.080246604750770677e-190 },487 HP{ .val = 1.000000e-173, .off = -4.080246604750770677e-190 },
488 HP{.val=1.000000e-174, .off= 4.085789420184387951e-192 },488 HP{ .val = 1.000000e-174, .off = 4.085789420184387951e-192 },
489 HP{.val=1.000000e-175, .off= 4.085789420184388146e-193 },489 HP{ .val = 1.000000e-175, .off = 4.085789420184388146e-193 },
490 HP{.val=1.000000e-176, .off= 4.085789420184388146e-194 },490 HP{ .val = 1.000000e-176, .off = 4.085789420184388146e-194 },
491 HP{.val=1.000000e-177, .off= 4.792197640035244894e-194 },491 HP{ .val = 1.000000e-177, .off = 4.792197640035244894e-194 },
492 HP{.val=1.000000e-178, .off= 4.792197640035244742e-195 },492 HP{ .val = 1.000000e-178, .off = 4.792197640035244742e-195 },
493 HP{.val=1.000000e-179, .off= -2.057206575616014662e-196 },493 HP{ .val = 1.000000e-179, .off = -2.057206575616014662e-196 },
494 HP{.val=1.000000e-180, .off= -2.057206575616014662e-197 },494 HP{ .val = 1.000000e-180, .off = -2.057206575616014662e-197 },
495 HP{.val=1.000000e-181, .off= -4.732755097354788053e-198 },495 HP{ .val = 1.000000e-181, .off = -4.732755097354788053e-198 },
496 HP{.val=1.000000e-182, .off= -4.732755097354787867e-199 },496 HP{ .val = 1.000000e-182, .off = -4.732755097354787867e-199 },
497 HP{.val=1.000000e-183, .off= -5.522105321379546765e-201 },497 HP{ .val = 1.000000e-183, .off = -5.522105321379546765e-201 },
498 HP{.val=1.000000e-184, .off= -5.777891238658996019e-201 },498 HP{ .val = 1.000000e-184, .off = -5.777891238658996019e-201 },
499 HP{.val=1.000000e-185, .off= 7.542096444923057046e-203 },499 HP{ .val = 1.000000e-185, .off = 7.542096444923057046e-203 },
500 HP{.val=1.000000e-186, .off= 8.919335748431433483e-203 },500 HP{ .val = 1.000000e-186, .off = 8.919335748431433483e-203 },
501 HP{.val=1.000000e-187, .off= -1.287071881492476028e-204 },501 HP{ .val = 1.000000e-187, .off = -1.287071881492476028e-204 },
502 HP{.val=1.000000e-188, .off= 5.091932887209967018e-205 },502 HP{ .val = 1.000000e-188, .off = 5.091932887209967018e-205 },
503 HP{.val=1.000000e-189, .off= -6.868701054107114024e-206 },503 HP{ .val = 1.000000e-189, .off = -6.868701054107114024e-206 },
504 HP{.val=1.000000e-190, .off= -1.885103578558330118e-207 },504 HP{ .val = 1.000000e-190, .off = -1.885103578558330118e-207 },
505 HP{.val=1.000000e-191, .off= -1.885103578558330205e-208 },505 HP{ .val = 1.000000e-191, .off = -1.885103578558330205e-208 },
506 HP{.val=1.000000e-192, .off= -9.671974634103305058e-209 },506 HP{ .val = 1.000000e-192, .off = -9.671974634103305058e-209 },
507 HP{.val=1.000000e-193, .off= -4.805180224387695640e-210 },507 HP{ .val = 1.000000e-193, .off = -4.805180224387695640e-210 },
508 HP{.val=1.000000e-194, .off= -1.763433718315439838e-211 },508 HP{ .val = 1.000000e-194, .off = -1.763433718315439838e-211 },
509 HP{.val=1.000000e-195, .off= -9.367799983496079132e-212 },509 HP{ .val = 1.000000e-195, .off = -9.367799983496079132e-212 },
510 HP{.val=1.000000e-196, .off= -4.615071067758179837e-213 },510 HP{ .val = 1.000000e-196, .off = -4.615071067758179837e-213 },
511 HP{.val=1.000000e-197, .off= 1.325840076914194777e-214 },511 HP{ .val = 1.000000e-197, .off = 1.325840076914194777e-214 },
512 HP{.val=1.000000e-198, .off= 8.751979007754662425e-215 },512 HP{ .val = 1.000000e-198, .off = 8.751979007754662425e-215 },
513 HP{.val=1.000000e-199, .off= 1.789973760091724198e-216 },513 HP{ .val = 1.000000e-199, .off = 1.789973760091724198e-216 },
514 HP{.val=1.000000e-200, .off= 1.789973760091724077e-217 },514 HP{ .val = 1.000000e-200, .off = 1.789973760091724077e-217 },
515 HP{.val=1.000000e-201, .off= 5.416018159916171171e-218 },515 HP{ .val = 1.000000e-201, .off = 5.416018159916171171e-218 },
516 HP{.val=1.000000e-202, .off= -3.649092839644947067e-219 },516 HP{ .val = 1.000000e-202, .off = -3.649092839644947067e-219 },
517 HP{.val=1.000000e-203, .off= -3.649092839644947067e-220 },517 HP{ .val = 1.000000e-203, .off = -3.649092839644947067e-220 },
518 HP{.val=1.000000e-204, .off= -1.080338554413850956e-222 },518 HP{ .val = 1.000000e-204, .off = -1.080338554413850956e-222 },
519 HP{.val=1.000000e-205, .off= -1.080338554413850841e-223 },519 HP{ .val = 1.000000e-205, .off = -1.080338554413850841e-223 },
520 HP{.val=1.000000e-206, .off= -2.874486186850417807e-223 },520 HP{ .val = 1.000000e-206, .off = -2.874486186850417807e-223 },
521 HP{.val=1.000000e-207, .off= 7.499710055933455072e-224 },521 HP{ .val = 1.000000e-207, .off = 7.499710055933455072e-224 },
522 HP{.val=1.000000e-208, .off= -9.790617015372999087e-225 },522 HP{ .val = 1.000000e-208, .off = -9.790617015372999087e-225 },
523 HP{.val=1.000000e-209, .off= -4.387389805589732612e-226 },523 HP{ .val = 1.000000e-209, .off = -4.387389805589732612e-226 },
524 HP{.val=1.000000e-210, .off= -4.387389805589732612e-227 },524 HP{ .val = 1.000000e-210, .off = -4.387389805589732612e-227 },
525 HP{.val=1.000000e-211, .off= -8.608661063232909897e-228 },525 HP{ .val = 1.000000e-211, .off = -8.608661063232909897e-228 },
526 HP{.val=1.000000e-212, .off= 4.582811616902018972e-229 },526 HP{ .val = 1.000000e-212, .off = 4.582811616902018972e-229 },
527 HP{.val=1.000000e-213, .off= 4.582811616902019155e-230 },527 HP{ .val = 1.000000e-213, .off = 4.582811616902019155e-230 },
528 HP{.val=1.000000e-214, .off= 8.705146829444184930e-231 },528 HP{ .val = 1.000000e-214, .off = 8.705146829444184930e-231 },
529 HP{.val=1.000000e-215, .off= -4.177150709750081830e-232 },529 HP{ .val = 1.000000e-215, .off = -4.177150709750081830e-232 },
530 HP{.val=1.000000e-216, .off= -4.177150709750082366e-233 },530 HP{ .val = 1.000000e-216, .off = -4.177150709750082366e-233 },
531 HP{.val=1.000000e-217, .off= -8.202868690748290237e-234 },531 HP{ .val = 1.000000e-217, .off = -8.202868690748290237e-234 },
532 HP{.val=1.000000e-218, .off= -3.170721214500530119e-235 },532 HP{ .val = 1.000000e-218, .off = -3.170721214500530119e-235 },
533 HP{.val=1.000000e-219, .off= -3.170721214500529857e-236 },533 HP{ .val = 1.000000e-219, .off = -3.170721214500529857e-236 },
534 HP{.val=1.000000e-220, .off= 7.606440013180328441e-238 },534 HP{ .val = 1.000000e-220, .off = 7.606440013180328441e-238 },
535 HP{.val=1.000000e-221, .off= -1.696459258568569049e-238 },535 HP{ .val = 1.000000e-221, .off = -1.696459258568569049e-238 },
536 HP{.val=1.000000e-222, .off= -4.767838333426821244e-239 },536 HP{ .val = 1.000000e-222, .off = -4.767838333426821244e-239 },
537 HP{.val=1.000000e-223, .off= 2.910609353718809138e-240 },537 HP{ .val = 1.000000e-223, .off = 2.910609353718809138e-240 },
538 HP{.val=1.000000e-224, .off= -1.888420450747209784e-241 },538 HP{ .val = 1.000000e-224, .off = -1.888420450747209784e-241 },
539 HP{.val=1.000000e-225, .off= 4.110366804835314035e-242 },539 HP{ .val = 1.000000e-225, .off = 4.110366804835314035e-242 },
540 HP{.val=1.000000e-226, .off= 7.859608839574391006e-243 },540 HP{ .val = 1.000000e-226, .off = 7.859608839574391006e-243 },
541 HP{.val=1.000000e-227, .off= 5.516332567862468419e-244 },541 HP{ .val = 1.000000e-227, .off = 5.516332567862468419e-244 },
542 HP{.val=1.000000e-228, .off= -3.270953451057244613e-245 },542 HP{ .val = 1.000000e-228, .off = -3.270953451057244613e-245 },
543 HP{.val=1.000000e-229, .off= -6.932322625607124670e-246 },543 HP{ .val = 1.000000e-229, .off = -6.932322625607124670e-246 },
544 HP{.val=1.000000e-230, .off= -4.643966891513449762e-247 },544 HP{ .val = 1.000000e-230, .off = -4.643966891513449762e-247 },
545 HP{.val=1.000000e-231, .off= 1.076922443720738305e-248 },545 HP{ .val = 1.000000e-231, .off = 1.076922443720738305e-248 },
546 HP{.val=1.000000e-232, .off= -2.498633390800628939e-249 },546 HP{ .val = 1.000000e-232, .off = -2.498633390800628939e-249 },
547 HP{.val=1.000000e-233, .off= 4.205533798926934891e-250 },547 HP{ .val = 1.000000e-233, .off = 4.205533798926934891e-250 },
548 HP{.val=1.000000e-234, .off= 4.205533798926934891e-251 },548 HP{ .val = 1.000000e-234, .off = 4.205533798926934891e-251 },
549 HP{.val=1.000000e-235, .off= 4.205533798926934697e-252 },549 HP{ .val = 1.000000e-235, .off = 4.205533798926934697e-252 },
550 HP{.val=1.000000e-236, .off= -4.523850562697497656e-253 },550 HP{ .val = 1.000000e-236, .off = -4.523850562697497656e-253 },
551 HP{.val=1.000000e-237, .off= 9.320146633177728298e-255 },551 HP{ .val = 1.000000e-237, .off = 9.320146633177728298e-255 },
552 HP{.val=1.000000e-238, .off= 9.320146633177728062e-256 },552 HP{ .val = 1.000000e-238, .off = 9.320146633177728062e-256 },
553 HP{.val=1.000000e-239, .off= -7.592774752331086440e-256 },553 HP{ .val = 1.000000e-239, .off = -7.592774752331086440e-256 },
554 HP{.val=1.000000e-240, .off= 3.063212017229987840e-257 },554 HP{ .val = 1.000000e-240, .off = 3.063212017229987840e-257 },
555 HP{.val=1.000000e-241, .off= 3.063212017229987562e-258 },555 HP{ .val = 1.000000e-241, .off = 3.063212017229987562e-258 },
556 HP{.val=1.000000e-242, .off= 3.063212017229987562e-259 },556 HP{ .val = 1.000000e-242, .off = 3.063212017229987562e-259 },
557 HP{.val=1.000000e-243, .off= 4.616527473176159842e-261 },557 HP{ .val = 1.000000e-243, .off = 4.616527473176159842e-261 },
558 HP{.val=1.000000e-244, .off= 6.965550922098544975e-261 },558 HP{ .val = 1.000000e-244, .off = 6.965550922098544975e-261 },
559 HP{.val=1.000000e-245, .off= 6.965550922098544749e-262 },559 HP{ .val = 1.000000e-245, .off = 6.965550922098544749e-262 },
560 HP{.val=1.000000e-246, .off= 4.424965697574744679e-263 },560 HP{ .val = 1.000000e-246, .off = 4.424965697574744679e-263 },
561 HP{.val=1.000000e-247, .off= -1.926497363734756420e-264 },561 HP{ .val = 1.000000e-247, .off = -1.926497363734756420e-264 },
562 HP{.val=1.000000e-248, .off= 2.043167049583681740e-265 },562 HP{ .val = 1.000000e-248, .off = 2.043167049583681740e-265 },
563 HP{.val=1.000000e-249, .off= -5.399953725388390154e-266 },563 HP{ .val = 1.000000e-249, .off = -5.399953725388390154e-266 },
564 HP{.val=1.000000e-250, .off= -5.399953725388389982e-267 },564 HP{ .val = 1.000000e-250, .off = -5.399953725388389982e-267 },
565 HP{.val=1.000000e-251, .off= -1.523328321757102663e-268 },565 HP{ .val = 1.000000e-251, .off = -1.523328321757102663e-268 },
566 HP{.val=1.000000e-252, .off= 5.745344310051561161e-269 },566 HP{ .val = 1.000000e-252, .off = 5.745344310051561161e-269 },
567 HP{.val=1.000000e-253, .off= -6.369110076296211879e-270 },567 HP{ .val = 1.000000e-253, .off = -6.369110076296211879e-270 },
568 HP{.val=1.000000e-254, .off= 8.773957906638504842e-271 },568 HP{ .val = 1.000000e-254, .off = 8.773957906638504842e-271 },
569 HP{.val=1.000000e-255, .off= -6.904595826956931908e-273 },569 HP{ .val = 1.000000e-255, .off = -6.904595826956931908e-273 },
570 HP{.val=1.000000e-256, .off= 2.267170882721243669e-273 },570 HP{ .val = 1.000000e-256, .off = 2.267170882721243669e-273 },
571 HP{.val=1.000000e-257, .off= 2.267170882721243669e-274 },571 HP{ .val = 1.000000e-257, .off = 2.267170882721243669e-274 },
572 HP{.val=1.000000e-258, .off= 4.577819683828225398e-275 },572 HP{ .val = 1.000000e-258, .off = 4.577819683828225398e-275 },
573 HP{.val=1.000000e-259, .off= -6.975424321706684210e-276 },573 HP{ .val = 1.000000e-259, .off = -6.975424321706684210e-276 },
574 HP{.val=1.000000e-260, .off= 3.855741933482293648e-277 },574 HP{ .val = 1.000000e-260, .off = 3.855741933482293648e-277 },
575 HP{.val=1.000000e-261, .off= 1.599248963651256552e-278 },575 HP{ .val = 1.000000e-261, .off = 1.599248963651256552e-278 },
576 HP{.val=1.000000e-262, .off= -1.221367248637539543e-279 },576 HP{ .val = 1.000000e-262, .off = -1.221367248637539543e-279 },
577 HP{.val=1.000000e-263, .off= -1.221367248637539494e-280 },577 HP{ .val = 1.000000e-263, .off = -1.221367248637539494e-280 },
578 HP{.val=1.000000e-264, .off= -1.221367248637539647e-281 },578 HP{ .val = 1.000000e-264, .off = -1.221367248637539647e-281 },
579 HP{.val=1.000000e-265, .off= 1.533140771175737943e-282 },579 HP{ .val = 1.000000e-265, .off = 1.533140771175737943e-282 },
580 HP{.val=1.000000e-266, .off= 1.533140771175737895e-283 },580 HP{ .val = 1.000000e-266, .off = 1.533140771175737895e-283 },
581 HP{.val=1.000000e-267, .off= 1.533140771175738074e-284 },581 HP{ .val = 1.000000e-267, .off = 1.533140771175738074e-284 },
582 HP{.val=1.000000e-268, .off= 4.223090009274641634e-285 },582 HP{ .val = 1.000000e-268, .off = 4.223090009274641634e-285 },
583 HP{.val=1.000000e-269, .off= 4.223090009274641634e-286 },583 HP{ .val = 1.000000e-269, .off = 4.223090009274641634e-286 },
584 HP{.val=1.000000e-270, .off= -4.183001359784432924e-287 },584 HP{ .val = 1.000000e-270, .off = -4.183001359784432924e-287 },
585 HP{.val=1.000000e-271, .off= 3.697709298708449474e-288 },585 HP{ .val = 1.000000e-271, .off = 3.697709298708449474e-288 },
586 HP{.val=1.000000e-272, .off= 6.981338739747150474e-289 },586 HP{ .val = 1.000000e-272, .off = 6.981338739747150474e-289 },
587 HP{.val=1.000000e-273, .off= -9.436808465446354751e-290 },587 HP{ .val = 1.000000e-273, .off = -9.436808465446354751e-290 },
588 HP{.val=1.000000e-274, .off= 3.389869038611071740e-291 },588 HP{ .val = 1.000000e-274, .off = 3.389869038611071740e-291 },
589 HP{.val=1.000000e-275, .off= 6.596538414625427829e-292 },589 HP{ .val = 1.000000e-275, .off = 6.596538414625427829e-292 },
590 HP{.val=1.000000e-276, .off= -9.436808465446354618e-293 },590 HP{ .val = 1.000000e-276, .off = -9.436808465446354618e-293 },
591 HP{.val=1.000000e-277, .off= 3.089243784609725523e-294 },591 HP{ .val = 1.000000e-277, .off = 3.089243784609725523e-294 },
592 HP{.val=1.000000e-278, .off= 6.220756847123745836e-295 },592 HP{ .val = 1.000000e-278, .off = 6.220756847123745836e-295 },
593 HP{.val=1.000000e-279, .off= -5.522417137303829470e-296 },593 HP{ .val = 1.000000e-279, .off = -5.522417137303829470e-296 },
594 HP{.val=1.000000e-280, .off= 4.263561183052483059e-297 },594 HP{ .val = 1.000000e-280, .off = 4.263561183052483059e-297 },
595 HP{.val=1.000000e-281, .off= -1.852675267170212272e-298 },595 HP{ .val = 1.000000e-281, .off = -1.852675267170212272e-298 },
596 HP{.val=1.000000e-282, .off= -1.852675267170212378e-299 },596 HP{ .val = 1.000000e-282, .off = -1.852675267170212378e-299 },
597 HP{.val=1.000000e-283, .off= 5.314789322934508480e-300 },597 HP{ .val = 1.000000e-283, .off = 5.314789322934508480e-300 },
598 HP{.val=1.000000e-284, .off= -3.644541414696392675e-301 },598 HP{ .val = 1.000000e-284, .off = -3.644541414696392675e-301 },
599 HP{.val=1.000000e-285, .off= -7.377595888709267777e-302 },599 HP{ .val = 1.000000e-285, .off = -7.377595888709267777e-302 },
600 HP{.val=1.000000e-286, .off= -5.044436842451220838e-303 },600 HP{ .val = 1.000000e-286, .off = -5.044436842451220838e-303 },
601 HP{.val=1.000000e-287, .off= -2.127988034628661760e-304 },601 HP{ .val = 1.000000e-287, .off = -2.127988034628661760e-304 },
602 HP{.val=1.000000e-288, .off= -5.773549044406860911e-305 },602 HP{ .val = 1.000000e-288, .off = -5.773549044406860911e-305 },
603 HP{.val=1.000000e-289, .off= -1.216597782184112068e-306 },603 HP{ .val = 1.000000e-289, .off = -1.216597782184112068e-306 },
604 HP{.val=1.000000e-290, .off= -6.912786859962547924e-307 },604 HP{ .val = 1.000000e-290, .off = -6.912786859962547924e-307 },
605 HP{.val=1.000000e-291, .off= 3.767567660872018813e-308 },605 HP{ .val = 1.000000e-291, .off = 3.767567660872018813e-308 },
606};606};
std/fmt/index.zig+38-32
...@@ -107,7 +107,7 @@ pub fn format(context: var, comptime Errors: type, output: fn(@typeOf(context),...@@ -107,7 +107,7 @@ pub fn format(context: var, comptime Errors: type, output: fn(@typeOf(context),
107 '}' => {107 '}' => {
108 return output(context, args[next_arg]);108 return output(context, args[next_arg]);
109 },109 },
110 '0' ... '9' => {110 '0'...'9' => {
111 width_start = i;111 width_start = i;
112 state = State.BufWidth;112 state = State.BufWidth;
113 },113 },
...@@ -127,7 +127,7 @@ pub fn format(context: var, comptime Errors: type, output: fn(@typeOf(context),...@@ -127,7 +127,7 @@ pub fn format(context: var, comptime Errors: type, output: fn(@typeOf(context),
127 state = State.Start;127 state = State.Start;
128 start_index = i + 1;128 start_index = i + 1;
129 },129 },
130 '0' ... '9' => {130 '0'...'9' => {
131 width_start = i;131 width_start = i;
132 state = State.IntegerWidth;132 state = State.IntegerWidth;
133 },133 },
...@@ -141,7 +141,7 @@ pub fn format(context: var, comptime Errors: type, output: fn(@typeOf(context),...@@ -141,7 +141,7 @@ pub fn format(context: var, comptime Errors: type, output: fn(@typeOf(context),
141 state = State.Start;141 state = State.Start;
142 start_index = i + 1;142 start_index = i + 1;
143 },143 },
144 '0' ... '9' => {},144 '0'...'9' => {},
145 else => @compileError("Unexpected character in format string: " ++ []u8{c}),145 else => @compileError("Unexpected character in format string: " ++ []u8{c}),
146 },146 },
147 State.FloatScientific => switch (c) {147 State.FloatScientific => switch (c) {
...@@ -151,7 +151,7 @@ pub fn format(context: var, comptime Errors: type, output: fn(@typeOf(context),...@@ -151,7 +151,7 @@ pub fn format(context: var, comptime Errors: type, output: fn(@typeOf(context),
151 state = State.Start;151 state = State.Start;
152 start_index = i + 1;152 start_index = i + 1;
153 },153 },
154 '0' ... '9' => {154 '0'...'9' => {
155 width_start = i;155 width_start = i;
156 state = State.FloatScientificWidth;156 state = State.FloatScientificWidth;
157 },157 },
...@@ -165,7 +165,7 @@ pub fn format(context: var, comptime Errors: type, output: fn(@typeOf(context),...@@ -165,7 +165,7 @@ pub fn format(context: var, comptime Errors: type, output: fn(@typeOf(context),
165 state = State.Start;165 state = State.Start;
166 start_index = i + 1;166 start_index = i + 1;
167 },167 },
168 '0' ... '9' => {},168 '0'...'9' => {},
169 else => @compileError("Unexpected character in format string: " ++ []u8{c}),169 else => @compileError("Unexpected character in format string: " ++ []u8{c}),
170 },170 },
171 State.Float => switch (c) {171 State.Float => switch (c) {
...@@ -175,7 +175,7 @@ pub fn format(context: var, comptime Errors: type, output: fn(@typeOf(context),...@@ -175,7 +175,7 @@ pub fn format(context: var, comptime Errors: type, output: fn(@typeOf(context),
175 state = State.Start;175 state = State.Start;
176 start_index = i + 1;176 start_index = i + 1;
177 },177 },
178 '0' ... '9' => {178 '0'...'9' => {
179 width_start = i;179 width_start = i;
180 state = State.FloatWidth;180 state = State.FloatWidth;
181 },181 },
...@@ -189,7 +189,7 @@ pub fn format(context: var, comptime Errors: type, output: fn(@typeOf(context),...@@ -189,7 +189,7 @@ pub fn format(context: var, comptime Errors: type, output: fn(@typeOf(context),
189 state = State.Start;189 state = State.Start;
190 start_index = i + 1;190 start_index = i + 1;
191 },191 },
192 '0' ... '9' => {},192 '0'...'9' => {},
193 else => @compileError("Unexpected character in format string: " ++ []u8{c}),193 else => @compileError("Unexpected character in format string: " ++ []u8{c}),
194 },194 },
195 State.BufWidth => switch (c) {195 State.BufWidth => switch (c) {
...@@ -200,7 +200,7 @@ pub fn format(context: var, comptime Errors: type, output: fn(@typeOf(context),...@@ -200,7 +200,7 @@ pub fn format(context: var, comptime Errors: type, output: fn(@typeOf(context),
200 state = State.Start;200 state = State.Start;
201 start_index = i + 1;201 start_index = i + 1;
202 },202 },
203 '0' ... '9' => {},203 '0'...'9' => {},
204 else => @compileError("Unexpected character in format string: " ++ []u8{c}),204 else => @compileError("Unexpected character in format string: " ++ []u8{c}),
205 },205 },
206 State.Character => switch (c) {206 State.Character => switch (c) {
...@@ -223,7 +223,7 @@ pub fn format(context: var, comptime Errors: type, output: fn(@typeOf(context),...@@ -223,7 +223,7 @@ pub fn format(context: var, comptime Errors: type, output: fn(@typeOf(context),
223 radix = 1024;223 radix = 1024;
224 state = State.BytesBase;224 state = State.BytesBase;
225 },225 },
226 '0' ... '9' => {226 '0'...'9' => {
227 width_start = i;227 width_start = i;
228 state = State.BytesWidth;228 state = State.BytesWidth;
229 },229 },
...@@ -236,7 +236,7 @@ pub fn format(context: var, comptime Errors: type, output: fn(@typeOf(context),...@@ -236,7 +236,7 @@ pub fn format(context: var, comptime Errors: type, output: fn(@typeOf(context),
236 state = State.Start;236 state = State.Start;
237 start_index = i + 1;237 start_index = i + 1;
238 },238 },
239 '0' ... '9' => {239 '0'...'9' => {
240 width_start = i;240 width_start = i;
241 state = State.BytesWidth;241 state = State.BytesWidth;
242 },242 },
...@@ -250,7 +250,7 @@ pub fn format(context: var, comptime Errors: type, output: fn(@typeOf(context),...@@ -250,7 +250,7 @@ pub fn format(context: var, comptime Errors: type, output: fn(@typeOf(context),
250 state = State.Start;250 state = State.Start;
251 start_index = i + 1;251 start_index = i + 1;
252 },252 },
253 '0' ... '9' => {},253 '0'...'9' => {},
254 else => @compileError("Unexpected character in format string: " ++ []u8{c}),254 else => @compileError("Unexpected character in format string: " ++ []u8{c}),
255 },255 },
256 }256 }
...@@ -562,9 +562,14 @@ pub fn formatFloatDecimal(value: var, maybe_precision: ?usize, context: var, com...@@ -562,9 +562,14 @@ pub fn formatFloatDecimal(value: var, maybe_precision: ?usize, context: var, com
562 }562 }
563}563}
564564
565pub fn formatBytes(value: var, width: ?usize, comptime radix: usize,565pub fn formatBytes(
566 context: var, comptime Errors: type, output: fn(@typeOf(context), []const u8)Errors!void) Errors!void566 value: var,
567{567 width: ?usize,
568 comptime radix: usize,
569 context: var,
570 comptime Errors: type,
571 output: fn(@typeOf(context), []const u8) Errors!void,
572) Errors!void {
568 if (value == 0) {573 if (value == 0) {
569 return output(context, "0B");574 return output(context, "0B");
570 }575 }
...@@ -585,16 +590,22 @@ pub fn formatBytes(value: var, width: ?usize, comptime radix: usize,...@@ -585,16 +590,22 @@ pub fn formatBytes(value: var, width: ?usize, comptime radix: usize,
585 }590 }
586591
587 const buf = switch (radix) {592 const buf = switch (radix) {
588 1000 => []u8 { suffix, 'B' },593 1000 => []u8{ suffix, 'B' },
589 1024 => []u8 { suffix, 'i', 'B' },594 1024 => []u8{ suffix, 'i', 'B' },
590 else => unreachable,595 else => unreachable,
591 };596 };
592 return output(context, buf);597 return output(context, buf);
593}598}
594599
595pub fn formatInt(value: var, base: u8, uppercase: bool, width: usize,600pub fn formatInt(
596 context: var, comptime Errors: type, output: fn(@typeOf(context), []const u8)Errors!void) Errors!void601 value: var,
597{602 base: u8,
603 uppercase: bool,
604 width: usize,
605 context: var,
606 comptime Errors: type,
607 output: fn(@typeOf(context), []const u8) Errors!void,
608) Errors!void {
598 if (@typeOf(value).is_signed) {609 if (@typeOf(value).is_signed) {
599 return formatIntSigned(value, base, uppercase, width, context, Errors, output);610 return formatIntSigned(value, base, uppercase, width, context, Errors, output);
600 } else {611 } else {
...@@ -717,9 +728,9 @@ pub fn parseUnsigned(comptime T: type, buf: []const u8, radix: u8) ParseUnsigned...@@ -717,9 +728,9 @@ pub fn parseUnsigned(comptime T: type, buf: []const u8, radix: u8) ParseUnsigned
717728
718pub fn charToDigit(c: u8, radix: u8) (error{InvalidCharacter}!u8) {729pub fn charToDigit(c: u8, radix: u8) (error{InvalidCharacter}!u8) {
719 const value = switch (c) {730 const value = switch (c) {
720 '0' ... '9' => c - '0',731 '0'...'9' => c - '0',
721 'A' ... 'Z' => c - 'A' + 10,732 'A'...'Z' => c - 'A' + 10,
722 'a' ... 'z' => c - 'a' + 10,733 'a'...'z' => c - 'a' + 10,
723 else => return error.InvalidCharacter,734 else => return error.InvalidCharacter,
724 };735 };
725736
...@@ -730,8 +741,8 @@ pub fn charToDigit(c: u8, radix: u8) (error{InvalidCharacter}!u8) {...@@ -730,8 +741,8 @@ pub fn charToDigit(c: u8, radix: u8) (error{InvalidCharacter}!u8) {
730741
731fn digitToChar(digit: u8, uppercase: bool) u8 {742fn digitToChar(digit: u8, uppercase: bool) u8 {
732 return switch (digit) {743 return switch (digit) {
733 0 ... 9 => digit + '0',744 0...9 => digit + '0',
734 10 ... 35 => digit + ((if (uppercase) u8('A') else u8('a')) - 10),745 10...35 => digit + ((if (uppercase) u8('A') else u8('a')) - 10),
735 else => unreachable,746 else => unreachable,
736 };747 };
737}748}
...@@ -754,8 +765,7 @@ pub fn bufPrint(buf: []u8, comptime fmt: []const u8, args: ...) ![]u8 {...@@ -754,8 +765,7 @@ pub fn bufPrint(buf: []u8, comptime fmt: []const u8, args: ...) ![]u8 {
754765
755pub fn allocPrint(allocator: &mem.Allocator, comptime fmt: []const u8, args: ...) ![]u8 {766pub fn allocPrint(allocator: &mem.Allocator, comptime fmt: []const u8, args: ...) ![]u8 {
756 var size: usize = 0;767 var size: usize = 0;
757 format(&size, error{}, countSize, fmt, args) catch |err| switch (err) {768 format(&size, error{}, countSize, fmt, args) catch |err| switch (err) {};
758 };
759 const buf = try allocator.alloc(u8, size);769 const buf = try allocator.alloc(u8, size);
760 return bufPrint(buf, fmt, args);770 return bufPrint(buf, fmt, args);
761}771}
...@@ -1043,8 +1053,7 @@ test "fmt.format" {...@@ -1043,8 +1053,7 @@ test "fmt.format" {
1043fn testFmt(expected: []const u8, comptime template: []const u8, args: ...) !void {1053fn testFmt(expected: []const u8, comptime template: []const u8, args: ...) !void {
1044 var buf: [100]u8 = undefined;1054 var buf: [100]u8 = undefined;
1045 const result = try bufPrint(buf[0..], template, args);1055 const result = try bufPrint(buf[0..], template, args);
1046 if (mem.eql(u8, result, expected))1056 if (mem.eql(u8, result, expected)) return;
1047 return;
10481057
1049 std.debug.warn("\n====== expected this output: =========\n");1058 std.debug.warn("\n====== expected this output: =========\n");
1050 std.debug.warn("{}", expected);1059 std.debug.warn("{}", expected);
...@@ -1082,10 +1091,7 @@ test "fmt.trim" {...@@ -1082,10 +1091,7 @@ test "fmt.trim" {
10821091
1083pub fn isWhiteSpace(byte: u8) bool {1092pub fn isWhiteSpace(byte: u8) bool {
1084 return switch (byte) {1093 return switch (byte) {
1085 ' ',1094 ' ', '\t', '\n', '\r' => true,
1086 '\t',
1087 '\n',
1088 '\r' => true,
1089 else => false,1095 else => false,
1090 };1096 };
1091}1097}
std/hash/adler.zig+6-11
...@@ -13,9 +13,7 @@ pub const Adler32 = struct {...@@ -13,9 +13,7 @@ pub const Adler32 = struct {
13 adler: u32,13 adler: u32,
1414
15 pub fn init() Adler32 {15 pub fn init() Adler32 {
16 return Adler32 {16 return Adler32{ .adler = 1 };
17 .adler = 1,
18 };
19 }17 }
2018
21 // This fast variant is taken from zlib. It reduces the required modulos and unrolls longer19 // This fast variant is taken from zlib. It reduces the required modulos and unrolls longer
...@@ -33,8 +31,7 @@ pub const Adler32 = struct {...@@ -33,8 +31,7 @@ pub const Adler32 = struct {
33 if (s2 >= base) {31 if (s2 >= base) {
34 s2 -= base;32 s2 -= base;
35 }33 }
36 }34 } else if (input.len < 16) {
37 else if (input.len < 16) {
38 for (input) |b| {35 for (input) |b| {
39 s1 +%= b;36 s1 +%= b;
40 s2 +%= s1;37 s2 +%= s1;
...@@ -44,8 +41,7 @@ pub const Adler32 = struct {...@@ -44,8 +41,7 @@ pub const Adler32 = struct {
44 }41 }
4542
46 s2 %= base;43 s2 %= base;
47 }44 } else {
48 else {
49 var i: usize = 0;45 var i: usize = 0;
50 while (i + nmax <= input.len) : (i += nmax) {46 while (i + nmax <= input.len) : (i += nmax) {
51 const n = nmax / 16; // note: 16 | nmax47 const n = nmax / 16; // note: 16 | nmax
...@@ -98,15 +94,14 @@ test "adler32 sanity" {...@@ -98,15 +94,14 @@ test "adler32 sanity" {
98}94}
9995
100test "adler32 long" {96test "adler32 long" {
101 const long1 = []u8 {1} ** 1024;97 const long1 = []u8{1} ** 1024;
102 debug.assert(Adler32.hash(long1[0..]) == 0x06780401);98 debug.assert(Adler32.hash(long1[0..]) == 0x06780401);
10399
104 const long2 = []u8 {1} ** 1025;100 const long2 = []u8{1} ** 1025;
105 debug.assert(Adler32.hash(long2[0..]) == 0x0a7a0402);101 debug.assert(Adler32.hash(long2[0..]) == 0x0a7a0402);
106}102}
107103
108test "adler32 very long" {104test "adler32 very long" {
109 const long = []u8 {1} ** 5553;105 const long = []u8{1} ** 5553;
110 debug.assert(Adler32.hash(long[0..]) == 0x707f15b2);106 debug.assert(Adler32.hash(long[0..]) == 0x707f15b2);
111}107}
112
std/hash/crc.zig+2-3
...@@ -69,7 +69,6 @@ pub fn Crc32WithPoly(comptime poly: u32) type {...@@ -69,7 +69,6 @@ pub fn Crc32WithPoly(comptime poly: u32) type {
69 self.crc ^= (u32(p[2]) << 16);69 self.crc ^= (u32(p[2]) << 16);
70 self.crc ^= (u32(p[3]) << 24);70 self.crc ^= (u32(p[3]) << 24);
7171
72
73 self.crc =72 self.crc =
74 lookup_tables[0][p[7]] ^73 lookup_tables[0][p[7]] ^
75 lookup_tables[1][p[6]] ^74 lookup_tables[1][p[6]] ^
...@@ -77,8 +76,8 @@ pub fn Crc32WithPoly(comptime poly: u32) type {...@@ -77,8 +76,8 @@ pub fn Crc32WithPoly(comptime poly: u32) type {
77 lookup_tables[3][p[4]] ^76 lookup_tables[3][p[4]] ^
78 lookup_tables[4][@truncate(u8, self.crc >> 24)] ^77 lookup_tables[4][@truncate(u8, self.crc >> 24)] ^
79 lookup_tables[5][@truncate(u8, self.crc >> 16)] ^78 lookup_tables[5][@truncate(u8, self.crc >> 16)] ^
80 lookup_tables[6][@truncate(u8, self.crc >> 8)] ^79 lookup_tables[6][@truncate(u8, self.crc >> 8)] ^
81 lookup_tables[7][@truncate(u8, self.crc >> 0)];80 lookup_tables[7][@truncate(u8, self.crc >> 0)];
82 }81 }
8382
84 while (i < input.len) : (i += 1) {83 while (i < input.len) : (i += 1) {
std/hash/fnv.zig+2-4
...@@ -7,7 +7,7 @@...@@ -7,7 +7,7 @@
7const std = @import("../index.zig");7const std = @import("../index.zig");
8const debug = std.debug;8const debug = std.debug;
99
10pub const Fnv1a_32 = Fnv1a(u32, 0x01000193 , 0x811c9dc5);10pub const Fnv1a_32 = Fnv1a(u32, 0x01000193, 0x811c9dc5);
11pub const Fnv1a_64 = Fnv1a(u64, 0x100000001b3, 0xcbf29ce484222325);11pub const Fnv1a_64 = Fnv1a(u64, 0x100000001b3, 0xcbf29ce484222325);
12pub const Fnv1a_128 = Fnv1a(u128, 0x1000000000000000000013b, 0x6c62272e07bb014262b821756295c58d);12pub const Fnv1a_128 = Fnv1a(u128, 0x1000000000000000000013b, 0x6c62272e07bb014262b821756295c58d);
1313
...@@ -18,9 +18,7 @@ fn Fnv1a(comptime T: type, comptime prime: T, comptime offset: T) type {...@@ -18,9 +18,7 @@ fn Fnv1a(comptime T: type, comptime prime: T, comptime offset: T) type {
18 value: T,18 value: T,
1919
20 pub fn init() Self {20 pub fn init() Self {
21 return Self {21 return Self{ .value = offset };
22 .value = offset,
23 };
24 }22 }
2523
26 pub fn update(self: &Self, input: []const u8) void {24 pub fn update(self: &Self, input: []const u8) void {
std/hash/siphash.zig+3-3
...@@ -45,7 +45,7 @@ fn SipHash(comptime T: type, comptime c_rounds: usize, comptime d_rounds: usize)...@@ -45,7 +45,7 @@ fn SipHash(comptime T: type, comptime c_rounds: usize, comptime d_rounds: usize)
45 const k0 = mem.readInt(key[0..8], u64, Endian.Little);45 const k0 = mem.readInt(key[0..8], u64, Endian.Little);
46 const k1 = mem.readInt(key[8..16], u64, Endian.Little);46 const k1 = mem.readInt(key[8..16], u64, Endian.Little);
4747
48 var d = Self {48 var d = Self{
49 .v0 = k0 ^ 0x736f6d6570736575,49 .v0 = k0 ^ 0x736f6d6570736575,
50 .v1 = k1 ^ 0x646f72616e646f6d,50 .v1 = k1 ^ 0x646f72616e646f6d,
51 .v2 = k0 ^ 0x6c7967656e657261,51 .v2 = k0 ^ 0x6c7967656e657261,
...@@ -162,7 +162,7 @@ fn SipHash(comptime T: type, comptime c_rounds: usize, comptime d_rounds: usize)...@@ -162,7 +162,7 @@ fn SipHash(comptime T: type, comptime c_rounds: usize, comptime d_rounds: usize)
162const test_key = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f";162const test_key = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f";
163163
164test "siphash64-2-4 sanity" {164test "siphash64-2-4 sanity" {
165 const vectors = [][]const u8 {165 const vectors = [][]const u8{
166 "\x31\x0e\x0e\xdd\x47\xdb\x6f\x72", // ""166 "\x31\x0e\x0e\xdd\x47\xdb\x6f\x72", // ""
167 "\xfd\x67\xdc\x93\xc5\x39\xf8\x74", // "\x00"167 "\xfd\x67\xdc\x93\xc5\x39\xf8\x74", // "\x00"
168 "\x5a\x4f\xa9\xd9\x09\x80\x6c\x0d", // "\x00\x01" ... etc168 "\x5a\x4f\xa9\xd9\x09\x80\x6c\x0d", // "\x00\x01" ... etc
...@@ -241,7 +241,7 @@ test "siphash64-2-4 sanity" {...@@ -241,7 +241,7 @@ test "siphash64-2-4 sanity" {
241}241}
242242
243test "siphash128-2-4 sanity" {243test "siphash128-2-4 sanity" {
244 const vectors = [][]const u8 {244 const vectors = [][]const u8{
245 "\xa3\x81\x7f\x04\xba\x25\xa8\xe6\x6d\xf6\x72\x14\xc7\x55\x02\x93",245 "\xa3\x81\x7f\x04\xba\x25\xa8\xe6\x6d\xf6\x72\x14\xc7\x55\x02\x93",
246 "\xda\x87\xc1\xd8\x6b\x99\xaf\x44\x34\x76\x59\x11\x9b\x22\xfc\x45",246 "\xda\x87\xc1\xd8\x6b\x99\xaf\x44\x34\x76\x59\x11\x9b\x22\xfc\x45",
247 "\x81\x77\x22\x8d\xa4\xa4\x5d\xc7\xfc\xa3\x8b\xde\xf6\x0a\xff\xe4",247 "\x81\x77\x22\x8d\xa4\xa4\x5d\xc7\xfc\xa3\x8b\xde\xf6\x0a\xff\xe4",
std/heap.zig+4-10
...@@ -68,9 +68,7 @@ pub const DirectAllocator = struct {...@@ -68,9 +68,7 @@ pub const DirectAllocator = struct {
68 const self = @fieldParentPtr(DirectAllocator, "allocator", allocator);68 const self = @fieldParentPtr(DirectAllocator, "allocator", allocator);
6969
70 switch (builtin.os) {70 switch (builtin.os) {
71 Os.linux,71 Os.linux, Os.macosx, Os.ios => {
72 Os.macosx,
73 Os.ios => {
74 const p = os.posix;72 const p = os.posix;
75 const alloc_size = if (alignment <= os.page_size) n else n + alignment;73 const alloc_size = if (alignment <= os.page_size) n else n + alignment;
76 const addr = p.mmap(null, alloc_size, p.PROT_READ | p.PROT_WRITE, p.MAP_PRIVATE | p.MAP_ANONYMOUS, -1, 0);74 const addr = p.mmap(null, alloc_size, p.PROT_READ | p.PROT_WRITE, p.MAP_PRIVATE | p.MAP_ANONYMOUS, -1, 0);
...@@ -121,9 +119,7 @@ pub const DirectAllocator = struct {...@@ -121,9 +119,7 @@ pub const DirectAllocator = struct {
121 const self = @fieldParentPtr(DirectAllocator, "allocator", allocator);119 const self = @fieldParentPtr(DirectAllocator, "allocator", allocator);
122120
123 switch (builtin.os) {121 switch (builtin.os) {
124 Os.linux,122 Os.linux, Os.macosx, Os.ios => {
125 Os.macosx,
126 Os.ios => {
127 if (new_size <= old_mem.len) {123 if (new_size <= old_mem.len) {
128 const base_addr = @ptrToInt(old_mem.ptr);124 const base_addr = @ptrToInt(old_mem.ptr);
129 const old_addr_end = base_addr + old_mem.len;125 const old_addr_end = base_addr + old_mem.len;
...@@ -168,9 +164,7 @@ pub const DirectAllocator = struct {...@@ -168,9 +164,7 @@ pub const DirectAllocator = struct {
168 const self = @fieldParentPtr(DirectAllocator, "allocator", allocator);164 const self = @fieldParentPtr(DirectAllocator, "allocator", allocator);
169165
170 switch (builtin.os) {166 switch (builtin.os) {
171 Os.linux,167 Os.linux, Os.macosx, Os.ios => {
172 Os.macosx,
173 Os.ios => {
174 _ = os.posix.munmap(@ptrToInt(bytes.ptr), bytes.len);168 _ = os.posix.munmap(@ptrToInt(bytes.ptr), bytes.len);
175 },169 },
176 Os.windows => {170 Os.windows => {
...@@ -430,7 +424,7 @@ fn testAllocator(allocator: &mem.Allocator) !void {...@@ -430,7 +424,7 @@ fn testAllocator(allocator: &mem.Allocator) !void {
430}424}
431425
432fn testAllocatorLargeAlignment(allocator: &mem.Allocator) mem.Allocator.Error!void {426fn testAllocatorLargeAlignment(allocator: &mem.Allocator) mem.Allocator.Error!void {
433 //Maybe a platform's page_size is actually the same as or 427 //Maybe a platform's page_size is actually the same as or
434 // very near usize?428 // very near usize?
435 if (os.page_size << 2 > @maxValue(usize)) return;429 if (os.page_size << 2 > @maxValue(usize)) return;
436430
std/io_test.zig+1-1
...@@ -42,7 +42,7 @@ test "write a file, read it, then delete it" {...@@ -42,7 +42,7 @@ test "write a file, read it, then delete it" {
4242
43 assert(mem.eql(u8, contents[0.."begin".len], "begin"));43 assert(mem.eql(u8, contents[0.."begin".len], "begin"));
44 assert(mem.eql(u8, contents["begin".len..contents.len - "end".len], data));44 assert(mem.eql(u8, contents["begin".len..contents.len - "end".len], data));
45 assert(mem.eql(u8, contents[contents.len - "end".len ..], "end"));45 assert(mem.eql(u8, contents[contents.len - "end".len..], "end"));
46 }46 }
47 try os.deleteFile(allocator, tmp_file_name);47 try os.deleteFile(allocator, tmp_file_name);
48}48}
std/json.zig+32-74
...@@ -252,7 +252,7 @@ pub const StreamingJsonParser = struct {...@@ -252,7 +252,7 @@ pub const StreamingJsonParser = struct {
252 p.after_value_state = State.TopLevelEnd;252 p.after_value_state = State.TopLevelEnd;
253 p.count = 0;253 p.count = 0;
254 },254 },
255 '1' ... '9' => {255 '1'...'9' => {
256 p.number_is_integer = true;256 p.number_is_integer = true;
257 p.state = State.NumberMaybeDigitOrDotOrExponent;257 p.state = State.NumberMaybeDigitOrDotOrExponent;
258 p.after_value_state = State.TopLevelEnd;258 p.after_value_state = State.TopLevelEnd;
...@@ -281,10 +281,7 @@ pub const StreamingJsonParser = struct {...@@ -281,10 +281,7 @@ pub const StreamingJsonParser = struct {
281 p.after_value_state = State.TopLevelEnd;281 p.after_value_state = State.TopLevelEnd;
282 p.count = 0;282 p.count = 0;
283 },283 },
284 0x09,284 0x09, 0x0A, 0x0D, 0x20 => {
285 0x0A,
286 0x0D,
287 0x20 => {
288 // whitespace285 // whitespace
289 },286 },
290 else => {287 else => {
...@@ -293,10 +290,7 @@ pub const StreamingJsonParser = struct {...@@ -293,10 +290,7 @@ pub const StreamingJsonParser = struct {
293 },290 },
294291
295 State.TopLevelEnd => switch (c) {292 State.TopLevelEnd => switch (c) {
296 0x09,293 0x09, 0x0A, 0x0D, 0x20 => {
297 0x0A,
298 0x0D,
299 0x20 => {
300 // whitespace294 // whitespace
301 },295 },
302 else => {296 else => {
...@@ -392,7 +386,7 @@ pub const StreamingJsonParser = struct {...@@ -392,7 +386,7 @@ pub const StreamingJsonParser = struct {
392 p.state = State.NumberMaybeDotOrExponent;386 p.state = State.NumberMaybeDotOrExponent;
393 p.count = 0;387 p.count = 0;
394 },388 },
395 '1' ... '9' => {389 '1'...'9' => {
396 p.state = State.NumberMaybeDigitOrDotOrExponent;390 p.state = State.NumberMaybeDigitOrDotOrExponent;
397 p.count = 0;391 p.count = 0;
398 },392 },
...@@ -412,10 +406,7 @@ pub const StreamingJsonParser = struct {...@@ -412,10 +406,7 @@ pub const StreamingJsonParser = struct {
412 p.state = State.NullLiteral1;406 p.state = State.NullLiteral1;
413 p.count = 0;407 p.count = 0;
414 },408 },
415 0x09,409 0x09, 0x0A, 0x0D, 0x20 => {
416 0x0A,
417 0x0D,
418 0x20 => {
419 // whitespace410 // whitespace
420 },411 },
421 else => {412 else => {
...@@ -461,7 +452,7 @@ pub const StreamingJsonParser = struct {...@@ -461,7 +452,7 @@ pub const StreamingJsonParser = struct {
461 p.state = State.NumberMaybeDotOrExponent;452 p.state = State.NumberMaybeDotOrExponent;
462 p.count = 0;453 p.count = 0;
463 },454 },
464 '1' ... '9' => {455 '1'...'9' => {
465 p.state = State.NumberMaybeDigitOrDotOrExponent;456 p.state = State.NumberMaybeDigitOrDotOrExponent;
466 p.count = 0;457 p.count = 0;
467 },458 },
...@@ -481,10 +472,7 @@ pub const StreamingJsonParser = struct {...@@ -481,10 +472,7 @@ pub const StreamingJsonParser = struct {
481 p.state = State.NullLiteral1;472 p.state = State.NullLiteral1;
482 p.count = 0;473 p.count = 0;
483 },474 },
484 0x09,475 0x09, 0x0A, 0x0D, 0x20 => {
485 0x0A,
486 0x0D,
487 0x20 => {
488 // whitespace476 // whitespace
489 },477 },
490 else => {478 else => {
...@@ -533,10 +521,7 @@ pub const StreamingJsonParser = struct {...@@ -533,10 +521,7 @@ pub const StreamingJsonParser = struct {
533521
534 token.* = Token.initMarker(Token.Id.ObjectEnd);522 token.* = Token.initMarker(Token.Id.ObjectEnd);
535 },523 },
536 0x09,524 0x09, 0x0A, 0x0D, 0x20 => {
537 0x0A,
538 0x0D,
539 0x20 => {
540 // whitespace525 // whitespace
541 },526 },
542 else => {527 else => {
...@@ -549,10 +534,7 @@ pub const StreamingJsonParser = struct {...@@ -549,10 +534,7 @@ pub const StreamingJsonParser = struct {
549 p.state = State.ValueBegin;534 p.state = State.ValueBegin;
550 p.after_string_state = State.ValueEnd;535 p.after_string_state = State.ValueEnd;
551 },536 },
552 0x09,537 0x09, 0x0A, 0x0D, 0x20 => {
553 0x0A,
554 0x0D,
555 0x20 => {
556 // whitespace538 // whitespace
557 },539 },
558 else => {540 else => {
...@@ -561,7 +543,7 @@ pub const StreamingJsonParser = struct {...@@ -561,7 +543,7 @@ pub const StreamingJsonParser = struct {
561 },543 },
562544
563 State.String => switch (c) {545 State.String => switch (c) {
564 0x00 ... 0x1F => {546 0x00...0x1F => {
565 return error.InvalidControlCharacter;547 return error.InvalidControlCharacter;
566 },548 },
567 '"' => {549 '"' => {
...@@ -576,19 +558,16 @@ pub const StreamingJsonParser = struct {...@@ -576,19 +558,16 @@ pub const StreamingJsonParser = struct {
576 '\\' => {558 '\\' => {
577 p.state = State.StringEscapeCharacter;559 p.state = State.StringEscapeCharacter;
578 },560 },
579 0x20,561 0x20, 0x21, 0x23...0x5B, 0x5D...0x7F => {
580 0x21,
581 0x23 ... 0x5B,
582 0x5D ... 0x7F => {
583 // non-control ascii562 // non-control ascii
584 },563 },
585 0xC0 ... 0xDF => {564 0xC0...0xDF => {
586 p.state = State.StringUtf8Byte1;565 p.state = State.StringUtf8Byte1;
587 },566 },
588 0xE0 ... 0xEF => {567 0xE0...0xEF => {
589 p.state = State.StringUtf8Byte2;568 p.state = State.StringUtf8Byte2;
590 },569 },
591 0xF0 ... 0xFF => {570 0xF0...0xFF => {
592 p.state = State.StringUtf8Byte3;571 p.state = State.StringUtf8Byte3;
593 },572 },
594 else => {573 else => {
...@@ -620,14 +599,7 @@ pub const StreamingJsonParser = struct {...@@ -620,14 +599,7 @@ pub const StreamingJsonParser = struct {
620 // The current JSONTestSuite tests rely on both of this behaviour being present599 // The current JSONTestSuite tests rely on both of this behaviour being present
621 // however, so we default to the status quo where both are accepted until this600 // however, so we default to the status quo where both are accepted until this
622 // is further clarified.601 // is further clarified.
623 '"',602 '"', '\\', '/', 'b', 'f', 'n', 'r', 't' => {
624 '\\',
625 '/',
626 'b',
627 'f',
628 'n',
629 'r',
630 't' => {
631 p.string_has_escape = true;603 p.string_has_escape = true;
632 p.state = State.String;604 p.state = State.String;
633 },605 },
...@@ -641,36 +613,28 @@ pub const StreamingJsonParser = struct {...@@ -641,36 +613,28 @@ pub const StreamingJsonParser = struct {
641 },613 },
642614
643 State.StringEscapeHexUnicode4 => switch (c) {615 State.StringEscapeHexUnicode4 => switch (c) {
644 '0' ... '9',616 '0'...'9', 'A'...'F', 'a'...'f' => {
645 'A' ... 'F',
646 'a' ... 'f' => {
647 p.state = State.StringEscapeHexUnicode3;617 p.state = State.StringEscapeHexUnicode3;
648 },618 },
649 else => return error.InvalidUnicodeHexSymbol,619 else => return error.InvalidUnicodeHexSymbol,
650 },620 },
651621
652 State.StringEscapeHexUnicode3 => switch (c) {622 State.StringEscapeHexUnicode3 => switch (c) {
653 '0' ... '9',623 '0'...'9', 'A'...'F', 'a'...'f' => {
654 'A' ... 'F',
655 'a' ... 'f' => {
656 p.state = State.StringEscapeHexUnicode2;624 p.state = State.StringEscapeHexUnicode2;
657 },625 },
658 else => return error.InvalidUnicodeHexSymbol,626 else => return error.InvalidUnicodeHexSymbol,
659 },627 },
660628
661 State.StringEscapeHexUnicode2 => switch (c) {629 State.StringEscapeHexUnicode2 => switch (c) {
662 '0' ... '9',630 '0'...'9', 'A'...'F', 'a'...'f' => {
663 'A' ... 'F',
664 'a' ... 'f' => {
665 p.state = State.StringEscapeHexUnicode1;631 p.state = State.StringEscapeHexUnicode1;
666 },632 },
667 else => return error.InvalidUnicodeHexSymbol,633 else => return error.InvalidUnicodeHexSymbol,
668 },634 },
669635
670 State.StringEscapeHexUnicode1 => switch (c) {636 State.StringEscapeHexUnicode1 => switch (c) {
671 '0' ... '9',637 '0'...'9', 'A'...'F', 'a'...'f' => {
672 'A' ... 'F',
673 'a' ... 'f' => {
674 p.state = State.String;638 p.state = State.String;
675 },639 },
676 else => return error.InvalidUnicodeHexSymbol,640 else => return error.InvalidUnicodeHexSymbol,
...@@ -682,7 +646,7 @@ pub const StreamingJsonParser = struct {...@@ -682,7 +646,7 @@ pub const StreamingJsonParser = struct {
682 '0' => {646 '0' => {
683 p.state = State.NumberMaybeDotOrExponent;647 p.state = State.NumberMaybeDotOrExponent;
684 },648 },
685 '1' ... '9' => {649 '1'...'9' => {
686 p.state = State.NumberMaybeDigitOrDotOrExponent;650 p.state = State.NumberMaybeDigitOrDotOrExponent;
687 },651 },
688 else => {652 else => {
...@@ -698,8 +662,7 @@ pub const StreamingJsonParser = struct {...@@ -698,8 +662,7 @@ pub const StreamingJsonParser = struct {
698 p.number_is_integer = false;662 p.number_is_integer = false;
699 p.state = State.NumberFractionalRequired;663 p.state = State.NumberFractionalRequired;
700 },664 },
701 'e',665 'e', 'E' => {
702 'E' => {
703 p.number_is_integer = false;666 p.number_is_integer = false;
704 p.state = State.NumberExponent;667 p.state = State.NumberExponent;
705 },668 },
...@@ -718,12 +681,11 @@ pub const StreamingJsonParser = struct {...@@ -718,12 +681,11 @@ pub const StreamingJsonParser = struct {
718 p.number_is_integer = false;681 p.number_is_integer = false;
719 p.state = State.NumberFractionalRequired;682 p.state = State.NumberFractionalRequired;
720 },683 },
721 'e',684 'e', 'E' => {
722 'E' => {
723 p.number_is_integer = false;685 p.number_is_integer = false;
724 p.state = State.NumberExponent;686 p.state = State.NumberExponent;
725 },687 },
726 '0' ... '9' => {688 '0'...'9' => {
727 // another digit689 // another digit
728 },690 },
729 else => {691 else => {
...@@ -737,7 +699,7 @@ pub const StreamingJsonParser = struct {...@@ -737,7 +699,7 @@ pub const StreamingJsonParser = struct {
737 State.NumberFractionalRequired => {699 State.NumberFractionalRequired => {
738 p.complete = p.after_value_state == State.TopLevelEnd;700 p.complete = p.after_value_state == State.TopLevelEnd;
739 switch (c) {701 switch (c) {
740 '0' ... '9' => {702 '0'...'9' => {
741 p.state = State.NumberFractional;703 p.state = State.NumberFractional;
742 },704 },
743 else => {705 else => {
...@@ -749,11 +711,10 @@ pub const StreamingJsonParser = struct {...@@ -749,11 +711,10 @@ pub const StreamingJsonParser = struct {
749 State.NumberFractional => {711 State.NumberFractional => {
750 p.complete = p.after_value_state == State.TopLevelEnd;712 p.complete = p.after_value_state == State.TopLevelEnd;
751 switch (c) {713 switch (c) {
752 '0' ... '9' => {714 '0'...'9' => {
753 // another digit715 // another digit
754 },716 },
755 'e',717 'e', 'E' => {
756 'E' => {
757 p.number_is_integer = false;718 p.number_is_integer = false;
758 p.state = State.NumberExponent;719 p.state = State.NumberExponent;
759 },720 },
...@@ -768,8 +729,7 @@ pub const StreamingJsonParser = struct {...@@ -768,8 +729,7 @@ pub const StreamingJsonParser = struct {
768 State.NumberMaybeExponent => {729 State.NumberMaybeExponent => {
769 p.complete = p.after_value_state == State.TopLevelEnd;730 p.complete = p.after_value_state == State.TopLevelEnd;
770 switch (c) {731 switch (c) {
771 'e',732 'e', 'E' => {
772 'E' => {
773 p.number_is_integer = false;733 p.number_is_integer = false;
774 p.state = State.NumberExponent;734 p.state = State.NumberExponent;
775 },735 },
...@@ -782,12 +742,11 @@ pub const StreamingJsonParser = struct {...@@ -782,12 +742,11 @@ pub const StreamingJsonParser = struct {
782 },742 },
783743
784 State.NumberExponent => switch (c) {744 State.NumberExponent => switch (c) {
785 '-',745 '-', '+' => {
786 '+' => {
787 p.complete = false;746 p.complete = false;
788 p.state = State.NumberExponentDigitsRequired;747 p.state = State.NumberExponentDigitsRequired;
789 },748 },
790 '0' ... '9' => {749 '0'...'9' => {
791 p.complete = p.after_value_state == State.TopLevelEnd;750 p.complete = p.after_value_state == State.TopLevelEnd;
792 p.state = State.NumberExponentDigits;751 p.state = State.NumberExponentDigits;
793 },752 },
...@@ -797,7 +756,7 @@ pub const StreamingJsonParser = struct {...@@ -797,7 +756,7 @@ pub const StreamingJsonParser = struct {
797 },756 },
798757
799 State.NumberExponentDigitsRequired => switch (c) {758 State.NumberExponentDigitsRequired => switch (c) {
800 '0' ... '9' => {759 '0'...'9' => {
801 p.complete = p.after_value_state == State.TopLevelEnd;760 p.complete = p.after_value_state == State.TopLevelEnd;
802 p.state = State.NumberExponentDigits;761 p.state = State.NumberExponentDigits;
803 },762 },
...@@ -809,7 +768,7 @@ pub const StreamingJsonParser = struct {...@@ -809,7 +768,7 @@ pub const StreamingJsonParser = struct {
809 State.NumberExponentDigits => {768 State.NumberExponentDigits => {
810 p.complete = p.after_value_state == State.TopLevelEnd;769 p.complete = p.after_value_state == State.TopLevelEnd;
811 switch (c) {770 switch (c) {
812 '0' ... '9' => {771 '0'...'9' => {
813 // another digit772 // another digit
814 },773 },
815 else => {774 else => {
...@@ -1257,8 +1216,7 @@ pub const JsonParser = struct {...@@ -1257,8 +1216,7 @@ pub const JsonParser = struct {
1257 Token.Id.Null => {1216 Token.Id.Null => {
1258 try p.stack.append(Value.Null);1217 try p.stack.append(Value.Null);
1259 },1218 },
1260 Token.Id.ObjectEnd,1219 Token.Id.ObjectEnd, Token.Id.ArrayEnd => {
1261 Token.Id.ArrayEnd => {
1262 unreachable;1220 unreachable;
1263 },1221 },
1264 },1222 },
std/macho.zig+11-9
...@@ -58,15 +58,15 @@ pub const SymbolTable = struct {...@@ -58,15 +58,15 @@ pub const SymbolTable = struct {
58 // code, its displacement is different.58 // code, its displacement is different.
59 pub fn deinit(self: &SymbolTable) void {59 pub fn deinit(self: &SymbolTable) void {
60 self.allocator.free(self.symbols);60 self.allocator.free(self.symbols);
61 self.symbols = []const Symbol {};61 self.symbols = []const Symbol{};
6262
63 self.allocator.free(self.strings);63 self.allocator.free(self.strings);
64 self.strings = []const u8 {};64 self.strings = []const u8{};
65 }65 }
6666
67 pub fn search(self: &const SymbolTable, address: usize) ?&const Symbol {67 pub fn search(self: &const SymbolTable, address: usize) ?&const Symbol {
68 var min: usize = 0;68 var min: usize = 0;
69 var max: usize = self.symbols.len - 1; // Exclude sentinel.69 var max: usize = self.symbols.len - 1; // Exclude sentinel.
70 while (min < max) {70 while (min < max) {
71 const mid = min + (max - min) / 2;71 const mid = min + (max - min) / 2;
72 const curr = &self.symbols[mid];72 const curr = &self.symbols[mid];
...@@ -118,10 +118,11 @@ pub fn loadSymbols(allocator: &mem.Allocator, in: &io.FileInStream) !SymbolTable...@@ -118,10 +118,11 @@ pub fn loadSymbols(allocator: &mem.Allocator, in: &io.FileInStream) !SymbolTable
118 try in.stream.readNoEof(strings);118 try in.stream.readNoEof(strings);
119119
120 var nsyms: usize = 0;120 var nsyms: usize = 0;
121 for (syms) |sym| if (isSymbol(sym)) nsyms += 1;121 for (syms) |sym|
122 if (isSymbol(sym)) nsyms += 1;
122 if (nsyms == 0) return error.MissingDebugInfo;123 if (nsyms == 0) return error.MissingDebugInfo;
123124
124 var symbols = try allocator.alloc(Symbol, nsyms + 1); // Room for sentinel.125 var symbols = try allocator.alloc(Symbol, nsyms + 1); // Room for sentinel.
125 errdefer allocator.free(symbols);126 errdefer allocator.free(symbols);
126127
127 var pie_slide: usize = 0;128 var pie_slide: usize = 0;
...@@ -132,7 +133,7 @@ pub fn loadSymbols(allocator: &mem.Allocator, in: &io.FileInStream) !SymbolTable...@@ -132,7 +133,7 @@ pub fn loadSymbols(allocator: &mem.Allocator, in: &io.FileInStream) !SymbolTable
132 const end = ??mem.indexOfScalarPos(u8, strings, start, 0);133 const end = ??mem.indexOfScalarPos(u8, strings, start, 0);
133 const name = strings[start..end];134 const name = strings[start..end];
134 const address = sym.n_value;135 const address = sym.n_value;
135 symbols[nsym] = Symbol { .name = name, .address = address };136 symbols[nsym] = Symbol{ .name = name, .address = address };
136 nsym += 1;137 nsym += 1;
137 if (is_pie and mem.eql(u8, name, "_SymbolTable_deinit")) {138 if (is_pie and mem.eql(u8, name, "_SymbolTable_deinit")) {
138 pie_slide = @ptrToInt(SymbolTable.deinit) - address;139 pie_slide = @ptrToInt(SymbolTable.deinit) - address;
...@@ -145,13 +146,14 @@ pub fn loadSymbols(allocator: &mem.Allocator, in: &io.FileInStream) !SymbolTable...@@ -145,13 +146,14 @@ pub fn loadSymbols(allocator: &mem.Allocator, in: &io.FileInStream) !SymbolTable
145 // Insert the sentinel. Since we don't know where the last function ends,146 // Insert the sentinel. Since we don't know where the last function ends,
146 // we arbitrarily limit it to the start address + 4 KB.147 // we arbitrarily limit it to the start address + 4 KB.
147 const top = symbols[nsyms - 1].address + 4096;148 const top = symbols[nsyms - 1].address + 4096;
148 symbols[nsyms] = Symbol { .name = "", .address = top };149 symbols[nsyms] = Symbol{ .name = "", .address = top };
149150
150 if (pie_slide != 0) {151 if (pie_slide != 0) {
151 for (symbols) |*symbol| symbol.address += pie_slide;152 for (symbols) |*symbol|
153 symbol.address += pie_slide;
152 }154 }
153155
154 return SymbolTable {156 return SymbolTable{
155 .allocator = allocator,157 .allocator = allocator,
156 .symbols = symbols,158 .symbols = symbols,
157 .strings = strings,159 .strings = strings,
std/math/atan.zig+15-17
...@@ -17,25 +17,25 @@ pub fn atan(x: var) @typeOf(x) {...@@ -17,25 +17,25 @@ pub fn atan(x: var) @typeOf(x) {
17}17}
1818
19fn atan32(x_: f32) f32 {19fn atan32(x_: f32) f32 {
20 const atanhi = []const f32 {20 const atanhi = []const f32{
21 4.6364760399e-01, // atan(0.5)hi21 4.6364760399e-01, // atan(0.5)hi
22 7.8539812565e-01, // atan(1.0)hi22 7.8539812565e-01, // atan(1.0)hi
23 9.8279368877e-01, // atan(1.5)hi23 9.8279368877e-01, // atan(1.5)hi
24 1.5707962513e+00, // atan(inf)hi24 1.5707962513e+00, // atan(inf)hi
25 };25 };
2626
27 const atanlo = []const f32 {27 const atanlo = []const f32{
28 5.0121582440e-09, // atan(0.5)lo28 5.0121582440e-09, // atan(0.5)lo
29 3.7748947079e-08, // atan(1.0)lo29 3.7748947079e-08, // atan(1.0)lo
30 3.4473217170e-08, // atan(1.5)lo30 3.4473217170e-08, // atan(1.5)lo
31 7.5497894159e-08, // atan(inf)lo31 7.5497894159e-08, // atan(inf)lo
32 };32 };
3333
34 const aT = []const f32 {34 const aT = []const f32{
35 3.3333328366e-01,35 3.3333328366e-01,
36 -1.9999158382e-01,36 -1.9999158382e-01,
37 1.4253635705e-01,37 1.4253635705e-01,
38 -1.0648017377e-01,38 -1.0648017377e-01,
39 6.1687607318e-02,39 6.1687607318e-02,
40 };40 };
4141
...@@ -80,8 +80,7 @@ fn atan32(x_: f32) f32 {...@@ -80,8 +80,7 @@ fn atan32(x_: f32) f32 {
80 id = 1;80 id = 1;
81 x = (x - 1.0) / (x + 1.0);81 x = (x - 1.0) / (x + 1.0);
82 }82 }
83 }83 } else {
84 else {
85 // |x| < 2.437584 // |x| < 2.4375
86 if (ix < 0x401C0000) {85 if (ix < 0x401C0000) {
87 id = 2;86 id = 2;
...@@ -109,31 +108,31 @@ fn atan32(x_: f32) f32 {...@@ -109,31 +108,31 @@ fn atan32(x_: f32) f32 {
109}108}
110109
111fn atan64(x_: f64) f64 {110fn atan64(x_: f64) f64 {
112 const atanhi = []const f64 {111 const atanhi = []const f64{
113 4.63647609000806093515e-01, // atan(0.5)hi112 4.63647609000806093515e-01, // atan(0.5)hi
114 7.85398163397448278999e-01, // atan(1.0)hi113 7.85398163397448278999e-01, // atan(1.0)hi
115 9.82793723247329054082e-01, // atan(1.5)hi114 9.82793723247329054082e-01, // atan(1.5)hi
116 1.57079632679489655800e+00, // atan(inf)hi115 1.57079632679489655800e+00, // atan(inf)hi
117 };116 };
118117
119 const atanlo = []const f64 {118 const atanlo = []const f64{
120 2.26987774529616870924e-17, // atan(0.5)lo119 2.26987774529616870924e-17, // atan(0.5)lo
121 3.06161699786838301793e-17, // atan(1.0)lo120 3.06161699786838301793e-17, // atan(1.0)lo
122 1.39033110312309984516e-17, // atan(1.5)lo121 1.39033110312309984516e-17, // atan(1.5)lo
123 6.12323399573676603587e-17, // atan(inf)lo122 6.12323399573676603587e-17, // atan(inf)lo
124 };123 };
125124
126 const aT = []const f64 {125 const aT = []const f64{
127 3.33333333333329318027e-01,126 3.33333333333329318027e-01,
128 -1.99999999998764832476e-01,127 -1.99999999998764832476e-01,
129 1.42857142725034663711e-01,128 1.42857142725034663711e-01,
130 -1.11111104054623557880e-01,129 -1.11111104054623557880e-01,
131 9.09088713343650656196e-02,130 9.09088713343650656196e-02,
132 -7.69187620504482999495e-02,131 -7.69187620504482999495e-02,
133 6.66107313738753120669e-02,132 6.66107313738753120669e-02,
134 -5.83357013379057348645e-02,133 -5.83357013379057348645e-02,
135 4.97687799461593236017e-02,134 4.97687799461593236017e-02,
136 -3.65315727442169155270e-02,135 -3.65315727442169155270e-02,
137 1.62858201153657823623e-02,136 1.62858201153657823623e-02,
138 };137 };
139138
...@@ -179,8 +178,7 @@ fn atan64(x_: f64) f64 {...@@ -179,8 +178,7 @@ fn atan64(x_: f64) f64 {
179 id = 1;178 id = 1;
180 x = (x - 1.0) / (x + 1.0);179 x = (x - 1.0) / (x + 1.0);
181 }180 }
182 }181 } else {
183 else {
184 // |x| < 2.4375182 // |x| < 2.4375
185 if (ix < 0x40038000) {183 if (ix < 0x40038000) {
186 id = 2;184 id = 2;
std/math/atan2.zig+2-4
...@@ -53,8 +53,7 @@ fn atan2_32(y: f32, x: f32) f32 {...@@ -53,8 +53,7 @@ fn atan2_32(y: f32, x: f32) f32 {
5353
54 if (iy == 0) {54 if (iy == 0) {
55 switch (m) {55 switch (m) {
56 0,56 0, 1 => return y, // atan(+-0, +...)
57 1 => return y, // atan(+-0, +...)
58 2 => return pi, // atan(+0, -...)57 2 => return pi, // atan(+0, -...)
59 3 => return -pi, // atan(-0, -...)58 3 => return -pi, // atan(-0, -...)
60 else => unreachable,59 else => unreachable,
...@@ -144,8 +143,7 @@ fn atan2_64(y: f64, x: f64) f64 {...@@ -144,8 +143,7 @@ fn atan2_64(y: f64, x: f64) f64 {
144143
145 if (iy | ly == 0) {144 if (iy | ly == 0) {
146 switch (m) {145 switch (m) {
147 0,146 0, 1 => return y, // atan(+-0, +...)
148 1 => return y, // atan(+-0, +...)
149 2 => return pi, // atan(+0, -...)147 2 => return pi, // atan(+0, -...)
150 3 => return -pi, // atan(-0, -...)148 3 => return -pi, // atan(-0, -...)
151 else => unreachable,149 else => unreachable,
std/math/complex/index.zig+11-11
...@@ -31,28 +31,28 @@ pub fn Complex(comptime T: type) type {...@@ -31,28 +31,28 @@ pub fn Complex(comptime T: type) type {
31 im: T,31 im: T,
3232
33 pub fn new(re: T, im: T) Self {33 pub fn new(re: T, im: T) Self {
34 return Self {34 return Self{
35 .re = re,35 .re = re,
36 .im = im,36 .im = im,
37 };37 };
38 }38 }
3939
40 pub fn add(self: &const Self, other: &const Self) Self {40 pub fn add(self: &const Self, other: &const Self) Self {
41 return Self {41 return Self{
42 .re = self.re + other.re,42 .re = self.re + other.re,
43 .im = self.im + other.im,43 .im = self.im + other.im,
44 };44 };
45 }45 }
4646
47 pub fn sub(self: &const Self, other: &const Self) Self {47 pub fn sub(self: &const Self, other: &const Self) Self {
48 return Self {48 return Self{
49 .re = self.re - other.re,49 .re = self.re - other.re,
50 .im = self.im - other.im,50 .im = self.im - other.im,
51 };51 };
52 }52 }
5353
54 pub fn mul(self: &const Self, other: &const Self) Self {54 pub fn mul(self: &const Self, other: &const Self) Self {
55 return Self {55 return Self{
56 .re = self.re * other.re - self.im * other.im,56 .re = self.re * other.re - self.im * other.im,
57 .im = self.im * other.re + self.re * other.im,57 .im = self.im * other.re + self.re * other.im,
58 };58 };
...@@ -63,14 +63,14 @@ pub fn Complex(comptime T: type) type {...@@ -63,14 +63,14 @@ pub fn Complex(comptime T: type) type {
63 const im_num = self.im * other.re - self.re * other.im;63 const im_num = self.im * other.re - self.re * other.im;
64 const den = other.re * other.re + other.im * other.im;64 const den = other.re * other.re + other.im * other.im;
6565
66 return Self {66 return Self{
67 .re = re_num / den,67 .re = re_num / den,
68 .im = im_num / den,68 .im = im_num / den,
69 };69 };
70 }70 }
7171
72 pub fn conjugate(self: &const Self) Self {72 pub fn conjugate(self: &const Self) Self {
73 return Self {73 return Self{
74 .re = self.re,74 .re = self.re,
75 .im = -self.im,75 .im = -self.im,
76 };76 };
...@@ -78,7 +78,7 @@ pub fn Complex(comptime T: type) type {...@@ -78,7 +78,7 @@ pub fn Complex(comptime T: type) type {
7878
79 pub fn reciprocal(self: &const Self) Self {79 pub fn reciprocal(self: &const Self) Self {
80 const m = self.re * self.re + self.im * self.im;80 const m = self.re * self.re + self.im * self.im;
81 return Self {81 return Self{
82 .re = self.re / m,82 .re = self.re / m,
83 .im = -self.im / m,83 .im = -self.im / m,
84 };84 };
...@@ -121,8 +121,8 @@ test "complex.div" {...@@ -121,8 +121,8 @@ test "complex.div" {
121 const b = Complex(f32).new(2, 7);121 const b = Complex(f32).new(2, 7);
122 const c = a.div(b);122 const c = a.div(b);
123123
124 debug.assert(math.approxEq(f32, c.re, f32(31)/53, epsilon) and124 debug.assert(math.approxEq(f32, c.re, f32(31) / 53, epsilon) and
125 math.approxEq(f32, c.im, f32(-29)/53, epsilon));125 math.approxEq(f32, c.im, f32(-29) / 53, epsilon));
126}126}
127127
128test "complex.conjugate" {128test "complex.conjugate" {
...@@ -136,8 +136,8 @@ test "complex.reciprocal" {...@@ -136,8 +136,8 @@ test "complex.reciprocal" {
136 const a = Complex(f32).new(5, 3);136 const a = Complex(f32).new(5, 3);
137 const c = a.reciprocal();137 const c = a.reciprocal();
138138
139 debug.assert(math.approxEq(f32, c.re, f32(5)/34, epsilon) and139 debug.assert(math.approxEq(f32, c.re, f32(5) / 34, epsilon) and
140 math.approxEq(f32, c.im, f32(-3)/34, epsilon));140 math.approxEq(f32, c.im, f32(-3) / 34, epsilon));
141}141}
142142
143test "complex.magnitude" {143test "complex.magnitude" {
std/math/complex/tanh.zig+2-2
...@@ -98,7 +98,7 @@ test "complex.ctanh32" {...@@ -98,7 +98,7 @@ test "complex.ctanh32" {
98 const a = Complex(f32).new(5, 3);98 const a = Complex(f32).new(5, 3);
99 const c = tanh(a);99 const c = tanh(a);
100100
101 debug.assert(math.approxEq(f32, c.re, 0.999913, epsilon));101 debug.assert(math.approxEq(f32, c.re, 0.999913, epsilon));
102 debug.assert(math.approxEq(f32, c.im, -0.000025, epsilon));102 debug.assert(math.approxEq(f32, c.im, -0.000025, epsilon));
103}103}
104104
...@@ -106,6 +106,6 @@ test "complex.ctanh64" {...@@ -106,6 +106,6 @@ test "complex.ctanh64" {
106 const a = Complex(f64).new(5, 3);106 const a = Complex(f64).new(5, 3);
107 const c = tanh(a);107 const c = tanh(a);
108108
109 debug.assert(math.approxEq(f64, c.re, 0.999913, epsilon));109 debug.assert(math.approxEq(f64, c.re, 0.999913, epsilon));
110 debug.assert(math.approxEq(f64, c.im, -0.000025, epsilon));110 debug.assert(math.approxEq(f64, c.im, -0.000025, epsilon));
111}111}
std/math/exp.zig+13-17
...@@ -20,10 +20,10 @@ pub fn exp(x: var) @typeOf(x) {...@@ -20,10 +20,10 @@ pub fn exp(x: var) @typeOf(x) {
20fn exp32(x_: f32) f32 {20fn exp32(x_: f32) f32 {
21 @setFloatMode(this, builtin.FloatMode.Strict);21 @setFloatMode(this, builtin.FloatMode.Strict);
2222
23 const half = []f32 { 0.5, -0.5 };23 const half = []f32{ 0.5, -0.5 };
24 const ln2hi = 6.9314575195e-1;24 const ln2hi = 6.9314575195e-1;
25 const ln2lo = 1.4286067653e-6;25 const ln2lo = 1.4286067653e-6;
26 const invln2 = 1.4426950216e+0;26 const invln2 = 1.4426950216e+0;
27 const P1 = 1.6666625440e-1;27 const P1 = 1.6666625440e-1;
28 const P2 = -2.7667332906e-3;28 const P2 = -2.7667332906e-3;
2929
...@@ -47,7 +47,7 @@ fn exp32(x_: f32) f32 {...@@ -47,7 +47,7 @@ fn exp32(x_: f32) f32 {
47 return x * 0x1.0p127;47 return x * 0x1.0p127;
48 }48 }
49 if (sign != 0) {49 if (sign != 0) {
50 math.forceEval(-0x1.0p-149 / x); // overflow50 math.forceEval(-0x1.0p-149 / x); // overflow
51 // x <= -103.97208451 // x <= -103.972084
52 if (hx >= 0x42CFF1B5) {52 if (hx >= 0x42CFF1B5) {
53 return 0;53 return 0;
...@@ -64,8 +64,7 @@ fn exp32(x_: f32) f32 {...@@ -64,8 +64,7 @@ fn exp32(x_: f32) f32 {
64 // |x| > 1.5 * ln264 // |x| > 1.5 * ln2
65 if (hx > 0x3F851592) {65 if (hx > 0x3F851592) {
66 k = i32(invln2 * x + half[usize(sign)]);66 k = i32(invln2 * x + half[usize(sign)]);
67 }67 } else {
68 else {
69 k = 1 - sign - sign;68 k = 1 - sign - sign;
70 }69 }
7170
...@@ -79,8 +78,7 @@ fn exp32(x_: f32) f32 {...@@ -79,8 +78,7 @@ fn exp32(x_: f32) f32 {
79 k = 0;78 k = 0;
80 hi = x;79 hi = x;
81 lo = 0;80 lo = 0;
82 }81 } else {
83 else {
84 math.forceEval(0x1.0p127 + x); // inexact82 math.forceEval(0x1.0p127 + x); // inexact
85 return 1 + x;83 return 1 + x;
86 }84 }
...@@ -99,15 +97,15 @@ fn exp32(x_: f32) f32 {...@@ -99,15 +97,15 @@ fn exp32(x_: f32) f32 {
99fn exp64(x_: f64) f64 {97fn exp64(x_: f64) f64 {
100 @setFloatMode(this, builtin.FloatMode.Strict);98 @setFloatMode(this, builtin.FloatMode.Strict);
10199
102 const half = []const f64 { 0.5, -0.5 };100 const half = []const f64{ 0.5, -0.5 };
103 const ln2hi: f64 = 6.93147180369123816490e-01;101 const ln2hi: f64 = 6.93147180369123816490e-01;
104 const ln2lo: f64 = 1.90821492927058770002e-10;102 const ln2lo: f64 = 1.90821492927058770002e-10;
105 const invln2: f64 = 1.44269504088896338700e+00;103 const invln2: f64 = 1.44269504088896338700e+00;
106 const P1: f64 = 1.66666666666666019037e-01;104 const P1: f64 = 1.66666666666666019037e-01;
107 const P2: f64 = -2.77777777770155933842e-03;105 const P2: f64 = -2.77777777770155933842e-03;
108 const P3: f64 = 6.61375632143793436117e-05;106 const P3: f64 = 6.61375632143793436117e-05;
109 const P4: f64 = -1.65339022054652515390e-06;107 const P4: f64 = -1.65339022054652515390e-06;
110 const P5: f64 = 4.13813679705723846039e-08;108 const P5: f64 = 4.13813679705723846039e-08;
111109
112 var x = x_;110 var x = x_;
113 var ux = @bitCast(u64, x);111 var ux = @bitCast(u64, x);
...@@ -151,8 +149,7 @@ fn exp64(x_: f64) f64 {...@@ -151,8 +149,7 @@ fn exp64(x_: f64) f64 {
151 // |x| >= 1.5 * ln2149 // |x| >= 1.5 * ln2
152 if (hx > 0x3FF0A2B2) {150 if (hx > 0x3FF0A2B2) {
153 k = i32(invln2 * x + half[usize(sign)]);151 k = i32(invln2 * x + half[usize(sign)]);
154 }152 } else {
155 else {
156 k = 1 - sign - sign;153 k = 1 - sign - sign;
157 }154 }
158155
...@@ -166,8 +163,7 @@ fn exp64(x_: f64) f64 {...@@ -166,8 +163,7 @@ fn exp64(x_: f64) f64 {
166 k = 0;163 k = 0;
167 hi = x;164 hi = x;
168 lo = 0;165 lo = 0;
169 }166 } else {
170 else {
171 // inexact if x != 0167 // inexact if x != 0
172 // math.forceEval(0x1.0p1023 + x);168 // math.forceEval(0x1.0p1023 + x);
173 return 1 + x;169 return 1 + x;
std/math/exp2.zig+140-140
...@@ -16,7 +16,7 @@ pub fn exp2(x: var) @typeOf(x) {...@@ -16,7 +16,7 @@ pub fn exp2(x: var) @typeOf(x) {
16 };16 };
17}17}
1818
19const exp2ft = []const f64 {19const exp2ft = []const f64{
20 0x1.6a09e667f3bcdp-1,20 0x1.6a09e667f3bcdp-1,
21 0x1.7a11473eb0187p-1,21 0x1.7a11473eb0187p-1,
22 0x1.8ace5422aa0dbp-1,22 0x1.8ace5422aa0dbp-1,
...@@ -92,195 +92,195 @@ fn exp2_32(x: f32) f32 {...@@ -92,195 +92,195 @@ fn exp2_32(x: f32) f32 {
92 return f32(r * uk);92 return f32(r * uk);
93}93}
9494
95const exp2dt = []f64 {95const exp2dt = []f64{
96 // exp2(z + eps) eps96 // exp2(z + eps) eps
97 0x1.6a09e667f3d5dp-1, 0x1.9880p-44,97 0x1.6a09e667f3d5dp-1, 0x1.9880p-44,
98 0x1.6b052fa751744p-1, 0x1.8000p-50,98 0x1.6b052fa751744p-1, 0x1.8000p-50,
99 0x1.6c012750bd9fep-1, -0x1.8780p-45,99 0x1.6c012750bd9fep-1, -0x1.8780p-45,
100 0x1.6cfdcddd476bfp-1, 0x1.ec00p-46,100 0x1.6cfdcddd476bfp-1, 0x1.ec00p-46,
101 0x1.6dfb23c651a29p-1, -0x1.8000p-50,101 0x1.6dfb23c651a29p-1, -0x1.8000p-50,
102 0x1.6ef9298593ae3p-1, -0x1.c000p-52,102 0x1.6ef9298593ae3p-1, -0x1.c000p-52,
103 0x1.6ff7df9519386p-1, -0x1.fd80p-45,103 0x1.6ff7df9519386p-1, -0x1.fd80p-45,
104 0x1.70f7466f42da3p-1, -0x1.c880p-45,104 0x1.70f7466f42da3p-1, -0x1.c880p-45,
105 0x1.71f75e8ec5fc3p-1, 0x1.3c00p-46,105 0x1.71f75e8ec5fc3p-1, 0x1.3c00p-46,
106 0x1.72f8286eacf05p-1, -0x1.8300p-44,106 0x1.72f8286eacf05p-1, -0x1.8300p-44,
107 0x1.73f9a48a58152p-1, -0x1.0c00p-47,107 0x1.73f9a48a58152p-1, -0x1.0c00p-47,
108 0x1.74fbd35d7ccfcp-1, 0x1.f880p-45,108 0x1.74fbd35d7ccfcp-1, 0x1.f880p-45,
109 0x1.75feb564267f1p-1, 0x1.3e00p-47,109 0x1.75feb564267f1p-1, 0x1.3e00p-47,
110 0x1.77024b1ab6d48p-1, -0x1.7d00p-45,110 0x1.77024b1ab6d48p-1, -0x1.7d00p-45,
111 0x1.780694fde5d38p-1, -0x1.d000p-50,111 0x1.780694fde5d38p-1, -0x1.d000p-50,
112 0x1.790b938ac1d00p-1, 0x1.3000p-49,112 0x1.790b938ac1d00p-1, 0x1.3000p-49,
113 0x1.7a11473eb0178p-1, -0x1.d000p-49,113 0x1.7a11473eb0178p-1, -0x1.d000p-49,
114 0x1.7b17b0976d060p-1, 0x1.0400p-45,114 0x1.7b17b0976d060p-1, 0x1.0400p-45,
115 0x1.7c1ed0130c133p-1, 0x1.0000p-53,115 0x1.7c1ed0130c133p-1, 0x1.0000p-53,
116 0x1.7d26a62ff8636p-1, -0x1.6900p-45,116 0x1.7d26a62ff8636p-1, -0x1.6900p-45,
117 0x1.7e2f336cf4e3bp-1, -0x1.2e00p-47,117 0x1.7e2f336cf4e3bp-1, -0x1.2e00p-47,
118 0x1.7f3878491c3e8p-1, -0x1.4580p-45,118 0x1.7f3878491c3e8p-1, -0x1.4580p-45,
119 0x1.80427543e1b4ep-1, 0x1.3000p-44,119 0x1.80427543e1b4ep-1, 0x1.3000p-44,
120 0x1.814d2add1071ap-1, 0x1.f000p-47,120 0x1.814d2add1071ap-1, 0x1.f000p-47,
121 0x1.82589994ccd7ep-1, -0x1.1c00p-45,121 0x1.82589994ccd7ep-1, -0x1.1c00p-45,
122 0x1.8364c1eb942d0p-1, 0x1.9d00p-45,122 0x1.8364c1eb942d0p-1, 0x1.9d00p-45,
123 0x1.8471a4623cab5p-1, 0x1.7100p-43,123 0x1.8471a4623cab5p-1, 0x1.7100p-43,
124 0x1.857f4179f5bbcp-1, 0x1.2600p-45,124 0x1.857f4179f5bbcp-1, 0x1.2600p-45,
125 0x1.868d99b4491afp-1, -0x1.2c40p-44,125 0x1.868d99b4491afp-1, -0x1.2c40p-44,
126 0x1.879cad931a395p-1, -0x1.3000p-45,126 0x1.879cad931a395p-1, -0x1.3000p-45,
127 0x1.88ac7d98a65b8p-1, -0x1.a800p-45,127 0x1.88ac7d98a65b8p-1, -0x1.a800p-45,
128 0x1.89bd0a4785800p-1, -0x1.d000p-49,128 0x1.89bd0a4785800p-1, -0x1.d000p-49,
129 0x1.8ace5422aa223p-1, 0x1.3280p-44,129 0x1.8ace5422aa223p-1, 0x1.3280p-44,
130 0x1.8be05bad619fap-1, 0x1.2b40p-43,130 0x1.8be05bad619fap-1, 0x1.2b40p-43,
131 0x1.8cf3216b54383p-1, -0x1.ed00p-45,131 0x1.8cf3216b54383p-1, -0x1.ed00p-45,
132 0x1.8e06a5e08664cp-1, -0x1.0500p-45,132 0x1.8e06a5e08664cp-1, -0x1.0500p-45,
133 0x1.8f1ae99157807p-1, 0x1.8280p-45,133 0x1.8f1ae99157807p-1, 0x1.8280p-45,
134 0x1.902fed0282c0ep-1, -0x1.cb00p-46,134 0x1.902fed0282c0ep-1, -0x1.cb00p-46,
135 0x1.9145b0b91ff96p-1, -0x1.5e00p-47,135 0x1.9145b0b91ff96p-1, -0x1.5e00p-47,
136 0x1.925c353aa2ff9p-1, 0x1.5400p-48,136 0x1.925c353aa2ff9p-1, 0x1.5400p-48,
137 0x1.93737b0cdc64ap-1, 0x1.7200p-46,137 0x1.93737b0cdc64ap-1, 0x1.7200p-46,
138 0x1.948b82b5f98aep-1, -0x1.9000p-47,138 0x1.948b82b5f98aep-1, -0x1.9000p-47,
139 0x1.95a44cbc852cbp-1, 0x1.5680p-45,139 0x1.95a44cbc852cbp-1, 0x1.5680p-45,
140 0x1.96bdd9a766f21p-1, -0x1.6d00p-44,140 0x1.96bdd9a766f21p-1, -0x1.6d00p-44,
141 0x1.97d829fde4e2ap-1, -0x1.1000p-47,141 0x1.97d829fde4e2ap-1, -0x1.1000p-47,
142 0x1.98f33e47a23a3p-1, 0x1.d000p-45,142 0x1.98f33e47a23a3p-1, 0x1.d000p-45,
143 0x1.9a0f170ca0604p-1, -0x1.8a40p-44,143 0x1.9a0f170ca0604p-1, -0x1.8a40p-44,
144 0x1.9b2bb4d53ff89p-1, 0x1.55c0p-44,144 0x1.9b2bb4d53ff89p-1, 0x1.55c0p-44,
145 0x1.9c49182a3f15bp-1, 0x1.6b80p-45,145 0x1.9c49182a3f15bp-1, 0x1.6b80p-45,
146 0x1.9d674194bb8c5p-1, -0x1.c000p-49,146 0x1.9d674194bb8c5p-1, -0x1.c000p-49,
147 0x1.9e86319e3238ep-1, 0x1.7d00p-46,147 0x1.9e86319e3238ep-1, 0x1.7d00p-46,
148 0x1.9fa5e8d07f302p-1, 0x1.6400p-46,148 0x1.9fa5e8d07f302p-1, 0x1.6400p-46,
149 0x1.a0c667b5de54dp-1, -0x1.5000p-48,149 0x1.a0c667b5de54dp-1, -0x1.5000p-48,
150 0x1.a1e7aed8eb8f6p-1, 0x1.9e00p-47,150 0x1.a1e7aed8eb8f6p-1, 0x1.9e00p-47,
151 0x1.a309bec4a2e27p-1, 0x1.ad80p-45,151 0x1.a309bec4a2e27p-1, 0x1.ad80p-45,
152 0x1.a42c980460a5dp-1, -0x1.af00p-46,152 0x1.a42c980460a5dp-1, -0x1.af00p-46,
153 0x1.a5503b23e259bp-1, 0x1.b600p-47,153 0x1.a5503b23e259bp-1, 0x1.b600p-47,
154 0x1.a674a8af46213p-1, 0x1.8880p-44,154 0x1.a674a8af46213p-1, 0x1.8880p-44,
155 0x1.a799e1330b3a7p-1, 0x1.1200p-46,155 0x1.a799e1330b3a7p-1, 0x1.1200p-46,
156 0x1.a8bfe53c12e8dp-1, 0x1.6c00p-47,156 0x1.a8bfe53c12e8dp-1, 0x1.6c00p-47,
157 0x1.a9e6b5579fcd2p-1, -0x1.9b80p-45,157 0x1.a9e6b5579fcd2p-1, -0x1.9b80p-45,
158 0x1.ab0e521356fb8p-1, 0x1.b700p-45,158 0x1.ab0e521356fb8p-1, 0x1.b700p-45,
159 0x1.ac36bbfd3f381p-1, 0x1.9000p-50,159 0x1.ac36bbfd3f381p-1, 0x1.9000p-50,
160 0x1.ad5ff3a3c2780p-1, 0x1.4000p-49,160 0x1.ad5ff3a3c2780p-1, 0x1.4000p-49,
161 0x1.ae89f995ad2a3p-1, -0x1.c900p-45,161 0x1.ae89f995ad2a3p-1, -0x1.c900p-45,
162 0x1.afb4ce622f367p-1, 0x1.6500p-46,162 0x1.afb4ce622f367p-1, 0x1.6500p-46,
163 0x1.b0e07298db790p-1, 0x1.fd40p-45,163 0x1.b0e07298db790p-1, 0x1.fd40p-45,
164 0x1.b20ce6c9a89a9p-1, 0x1.2700p-46,164 0x1.b20ce6c9a89a9p-1, 0x1.2700p-46,
165 0x1.b33a2b84f1a4bp-1, 0x1.d470p-43,165 0x1.b33a2b84f1a4bp-1, 0x1.d470p-43,
166 0x1.b468415b747e7p-1, -0x1.8380p-44,166 0x1.b468415b747e7p-1, -0x1.8380p-44,
167 0x1.b59728de5593ap-1, 0x1.8000p-54,167 0x1.b59728de5593ap-1, 0x1.8000p-54,
168 0x1.b6c6e29f1c56ap-1, 0x1.ad00p-47,168 0x1.b6c6e29f1c56ap-1, 0x1.ad00p-47,
169 0x1.b7f76f2fb5e50p-1, 0x1.e800p-50,169 0x1.b7f76f2fb5e50p-1, 0x1.e800p-50,
170 0x1.b928cf22749b2p-1, -0x1.4c00p-47,170 0x1.b928cf22749b2p-1, -0x1.4c00p-47,
171 0x1.ba5b030a10603p-1, -0x1.d700p-47,171 0x1.ba5b030a10603p-1, -0x1.d700p-47,
172 0x1.bb8e0b79a6f66p-1, 0x1.d900p-47,172 0x1.bb8e0b79a6f66p-1, 0x1.d900p-47,
173 0x1.bcc1e904bc1ffp-1, 0x1.2a00p-47,173 0x1.bcc1e904bc1ffp-1, 0x1.2a00p-47,
174 0x1.bdf69c3f3a16fp-1, -0x1.f780p-46,174 0x1.bdf69c3f3a16fp-1, -0x1.f780p-46,
175 0x1.bf2c25bd71db8p-1, -0x1.0a00p-46,175 0x1.bf2c25bd71db8p-1, -0x1.0a00p-46,
176 0x1.c06286141b2e9p-1, -0x1.1400p-46,176 0x1.c06286141b2e9p-1, -0x1.1400p-46,
177 0x1.c199bdd8552e0p-1, 0x1.be00p-47,177 0x1.c199bdd8552e0p-1, 0x1.be00p-47,
178 0x1.c2d1cd9fa64eep-1, -0x1.9400p-47,178 0x1.c2d1cd9fa64eep-1, -0x1.9400p-47,
179 0x1.c40ab5fffd02fp-1, -0x1.ed00p-47,179 0x1.c40ab5fffd02fp-1, -0x1.ed00p-47,
180 0x1.c544778fafd15p-1, 0x1.9660p-44,180 0x1.c544778fafd15p-1, 0x1.9660p-44,
181 0x1.c67f12e57d0cbp-1, -0x1.a100p-46,181 0x1.c67f12e57d0cbp-1, -0x1.a100p-46,
182 0x1.c7ba88988c1b6p-1, -0x1.8458p-42,182 0x1.c7ba88988c1b6p-1, -0x1.8458p-42,
183 0x1.c8f6d9406e733p-1, -0x1.a480p-46,183 0x1.c8f6d9406e733p-1, -0x1.a480p-46,
184 0x1.ca3405751c4dfp-1, 0x1.b000p-51,184 0x1.ca3405751c4dfp-1, 0x1.b000p-51,
185 0x1.cb720dcef9094p-1, 0x1.1400p-47,185 0x1.cb720dcef9094p-1, 0x1.1400p-47,
186 0x1.ccb0f2e6d1689p-1, 0x1.0200p-48,186 0x1.ccb0f2e6d1689p-1, 0x1.0200p-48,
187 0x1.cdf0b555dc412p-1, 0x1.3600p-48,187 0x1.cdf0b555dc412p-1, 0x1.3600p-48,
188 0x1.cf3155b5bab3bp-1, -0x1.6900p-47,188 0x1.cf3155b5bab3bp-1, -0x1.6900p-47,
189 0x1.d072d4a0789bcp-1, 0x1.9a00p-47,189 0x1.d072d4a0789bcp-1, 0x1.9a00p-47,
190 0x1.d1b532b08c8fap-1, -0x1.5e00p-46,190 0x1.d1b532b08c8fap-1, -0x1.5e00p-46,
191 0x1.d2f87080d8a85p-1, 0x1.d280p-46,191 0x1.d2f87080d8a85p-1, 0x1.d280p-46,
192 0x1.d43c8eacaa203p-1, 0x1.1a00p-47,192 0x1.d43c8eacaa203p-1, 0x1.1a00p-47,
193 0x1.d5818dcfba491p-1, 0x1.f000p-50,193 0x1.d5818dcfba491p-1, 0x1.f000p-50,
194 0x1.d6c76e862e6a1p-1, -0x1.3a00p-47,194 0x1.d6c76e862e6a1p-1, -0x1.3a00p-47,
195 0x1.d80e316c9834ep-1, -0x1.cd80p-47,195 0x1.d80e316c9834ep-1, -0x1.cd80p-47,
196 0x1.d955d71ff6090p-1, 0x1.4c00p-48,196 0x1.d955d71ff6090p-1, 0x1.4c00p-48,
197 0x1.da9e603db32aep-1, 0x1.f900p-48,197 0x1.da9e603db32aep-1, 0x1.f900p-48,
198 0x1.dbe7cd63a8325p-1, 0x1.9800p-49,198 0x1.dbe7cd63a8325p-1, 0x1.9800p-49,
199 0x1.dd321f301b445p-1, -0x1.5200p-48,199 0x1.dd321f301b445p-1, -0x1.5200p-48,
200 0x1.de7d5641c05bfp-1, -0x1.d700p-46,200 0x1.de7d5641c05bfp-1, -0x1.d700p-46,
201 0x1.dfc97337b9aecp-1, -0x1.6140p-46,201 0x1.dfc97337b9aecp-1, -0x1.6140p-46,
202 0x1.e11676b197d5ep-1, 0x1.b480p-47,202 0x1.e11676b197d5ep-1, 0x1.b480p-47,
203 0x1.e264614f5a3e7p-1, 0x1.0ce0p-43,203 0x1.e264614f5a3e7p-1, 0x1.0ce0p-43,
204 0x1.e3b333b16ee5cp-1, 0x1.c680p-47,204 0x1.e3b333b16ee5cp-1, 0x1.c680p-47,
205 0x1.e502ee78b3fb4p-1, -0x1.9300p-47,205 0x1.e502ee78b3fb4p-1, -0x1.9300p-47,
206 0x1.e653924676d68p-1, -0x1.5000p-49,206 0x1.e653924676d68p-1, -0x1.5000p-49,
207 0x1.e7a51fbc74c44p-1, -0x1.7f80p-47,207 0x1.e7a51fbc74c44p-1, -0x1.7f80p-47,
208 0x1.e8f7977cdb726p-1, -0x1.3700p-48,208 0x1.e8f7977cdb726p-1, -0x1.3700p-48,
209 0x1.ea4afa2a490e8p-1, 0x1.5d00p-49,209 0x1.ea4afa2a490e8p-1, 0x1.5d00p-49,
210 0x1.eb9f4867ccae4p-1, 0x1.61a0p-46,210 0x1.eb9f4867ccae4p-1, 0x1.61a0p-46,
211 0x1.ecf482d8e680dp-1, 0x1.5500p-48,211 0x1.ecf482d8e680dp-1, 0x1.5500p-48,
212 0x1.ee4aaa2188514p-1, 0x1.6400p-51,212 0x1.ee4aaa2188514p-1, 0x1.6400p-51,
213 0x1.efa1bee615a13p-1, -0x1.e800p-49,213 0x1.efa1bee615a13p-1, -0x1.e800p-49,
214 0x1.f0f9c1cb64106p-1, -0x1.a880p-48,214 0x1.f0f9c1cb64106p-1, -0x1.a880p-48,
215 0x1.f252b376bb963p-1, -0x1.c900p-45,215 0x1.f252b376bb963p-1, -0x1.c900p-45,
216 0x1.f3ac948dd7275p-1, 0x1.a000p-53,216 0x1.f3ac948dd7275p-1, 0x1.a000p-53,
217 0x1.f50765b6e4524p-1, -0x1.4f00p-48,217 0x1.f50765b6e4524p-1, -0x1.4f00p-48,
218 0x1.f6632798844fdp-1, 0x1.a800p-51,218 0x1.f6632798844fdp-1, 0x1.a800p-51,
219 0x1.f7bfdad9cbe38p-1, 0x1.abc0p-48,219 0x1.f7bfdad9cbe38p-1, 0x1.abc0p-48,
220 0x1.f91d802243c82p-1, -0x1.4600p-50,220 0x1.f91d802243c82p-1, -0x1.4600p-50,
221 0x1.fa7c1819e908ep-1, -0x1.b0c0p-47,221 0x1.fa7c1819e908ep-1, -0x1.b0c0p-47,
222 0x1.fbdba3692d511p-1, -0x1.0e00p-51,222 0x1.fbdba3692d511p-1, -0x1.0e00p-51,
223 0x1.fd3c22b8f7194p-1, -0x1.0de8p-46,223 0x1.fd3c22b8f7194p-1, -0x1.0de8p-46,
224 0x1.fe9d96b2a23eep-1, 0x1.e430p-49,224 0x1.fe9d96b2a23eep-1, 0x1.e430p-49,
225 0x1.0000000000000p+0, 0x0.0000p+0,225 0x1.0000000000000p+0, 0x0.0000p+0,
226 0x1.00b1afa5abcbep+0, -0x1.3400p-52,226 0x1.00b1afa5abcbep+0, -0x1.3400p-52,
227 0x1.0163da9fb3303p+0, -0x1.2170p-46,227 0x1.0163da9fb3303p+0, -0x1.2170p-46,
228 0x1.02168143b0282p+0, 0x1.a400p-52,228 0x1.02168143b0282p+0, 0x1.a400p-52,
229 0x1.02c9a3e77806cp+0, 0x1.f980p-49,229 0x1.02c9a3e77806cp+0, 0x1.f980p-49,
230 0x1.037d42e11bbcap+0, -0x1.7400p-51,230 0x1.037d42e11bbcap+0, -0x1.7400p-51,
231 0x1.04315e86e7f89p+0, 0x1.8300p-50,231 0x1.04315e86e7f89p+0, 0x1.8300p-50,
232 0x1.04e5f72f65467p+0, -0x1.a3f0p-46,232 0x1.04e5f72f65467p+0, -0x1.a3f0p-46,
233 0x1.059b0d315855ap+0, -0x1.2840p-47,233 0x1.059b0d315855ap+0, -0x1.2840p-47,
234 0x1.0650a0e3c1f95p+0, 0x1.1600p-48,234 0x1.0650a0e3c1f95p+0, 0x1.1600p-48,
235 0x1.0706b29ddf71ap+0, 0x1.5240p-46,235 0x1.0706b29ddf71ap+0, 0x1.5240p-46,
236 0x1.07bd42b72a82dp+0, -0x1.9a00p-49,236 0x1.07bd42b72a82dp+0, -0x1.9a00p-49,
237 0x1.0874518759bd0p+0, 0x1.6400p-49,237 0x1.0874518759bd0p+0, 0x1.6400p-49,
238 0x1.092bdf66607c8p+0, -0x1.0780p-47,238 0x1.092bdf66607c8p+0, -0x1.0780p-47,
239 0x1.09e3ecac6f383p+0, -0x1.8000p-54,239 0x1.09e3ecac6f383p+0, -0x1.8000p-54,
240 0x1.0a9c79b1f3930p+0, 0x1.fa00p-48,240 0x1.0a9c79b1f3930p+0, 0x1.fa00p-48,
241 0x1.0b5586cf988fcp+0, -0x1.ac80p-48,241 0x1.0b5586cf988fcp+0, -0x1.ac80p-48,
242 0x1.0c0f145e46c8ap+0, 0x1.9c00p-50,242 0x1.0c0f145e46c8ap+0, 0x1.9c00p-50,
243 0x1.0cc922b724816p+0, 0x1.5200p-47,243 0x1.0cc922b724816p+0, 0x1.5200p-47,
244 0x1.0d83b23395dd8p+0, -0x1.ad00p-48,244 0x1.0d83b23395dd8p+0, -0x1.ad00p-48,
245 0x1.0e3ec32d3d1f3p+0, 0x1.bac0p-46,245 0x1.0e3ec32d3d1f3p+0, 0x1.bac0p-46,
246 0x1.0efa55fdfa9a6p+0, -0x1.4e80p-47,246 0x1.0efa55fdfa9a6p+0, -0x1.4e80p-47,
247 0x1.0fb66affed2f0p+0, -0x1.d300p-47,247 0x1.0fb66affed2f0p+0, -0x1.d300p-47,
248 0x1.1073028d7234bp+0, 0x1.1500p-48,248 0x1.1073028d7234bp+0, 0x1.1500p-48,
249 0x1.11301d0125b5bp+0, 0x1.c000p-49,249 0x1.11301d0125b5bp+0, 0x1.c000p-49,
250 0x1.11edbab5e2af9p+0, 0x1.6bc0p-46,250 0x1.11edbab5e2af9p+0, 0x1.6bc0p-46,
251 0x1.12abdc06c31d5p+0, 0x1.8400p-49,251 0x1.12abdc06c31d5p+0, 0x1.8400p-49,
252 0x1.136a814f2047dp+0, -0x1.ed00p-47,252 0x1.136a814f2047dp+0, -0x1.ed00p-47,
253 0x1.1429aaea92de9p+0, 0x1.8e00p-49,253 0x1.1429aaea92de9p+0, 0x1.8e00p-49,
254 0x1.14e95934f3138p+0, 0x1.b400p-49,254 0x1.14e95934f3138p+0, 0x1.b400p-49,
255 0x1.15a98c8a58e71p+0, 0x1.5300p-47,255 0x1.15a98c8a58e71p+0, 0x1.5300p-47,
256 0x1.166a45471c3dfp+0, 0x1.3380p-47,256 0x1.166a45471c3dfp+0, 0x1.3380p-47,
257 0x1.172b83c7d5211p+0, 0x1.8d40p-45,257 0x1.172b83c7d5211p+0, 0x1.8d40p-45,
258 0x1.17ed48695bb9fp+0, -0x1.5d00p-47,258 0x1.17ed48695bb9fp+0, -0x1.5d00p-47,
259 0x1.18af9388c8d93p+0, -0x1.c880p-46,259 0x1.18af9388c8d93p+0, -0x1.c880p-46,
260 0x1.1972658375d66p+0, 0x1.1f00p-46,260 0x1.1972658375d66p+0, 0x1.1f00p-46,
261 0x1.1a35beb6fcba7p+0, 0x1.0480p-46,261 0x1.1a35beb6fcba7p+0, 0x1.0480p-46,
262 0x1.1af99f81387e3p+0, -0x1.7390p-43,262 0x1.1af99f81387e3p+0, -0x1.7390p-43,
263 0x1.1bbe084045d54p+0, 0x1.4e40p-45,263 0x1.1bbe084045d54p+0, 0x1.4e40p-45,
264 0x1.1c82f95281c43p+0, -0x1.a200p-47,264 0x1.1c82f95281c43p+0, -0x1.a200p-47,
265 0x1.1d4873168b9b2p+0, 0x1.3800p-49,265 0x1.1d4873168b9b2p+0, 0x1.3800p-49,
266 0x1.1e0e75eb44031p+0, 0x1.ac00p-49,266 0x1.1e0e75eb44031p+0, 0x1.ac00p-49,
267 0x1.1ed5022fcd938p+0, 0x1.1900p-47,267 0x1.1ed5022fcd938p+0, 0x1.1900p-47,
268 0x1.1f9c18438cdf7p+0, -0x1.b780p-46,268 0x1.1f9c18438cdf7p+0, -0x1.b780p-46,
269 0x1.2063b88628d8fp+0, 0x1.d940p-45,269 0x1.2063b88628d8fp+0, 0x1.d940p-45,
270 0x1.212be3578a81ep+0, 0x1.8000p-50,270 0x1.212be3578a81ep+0, 0x1.8000p-50,
271 0x1.21f49917ddd41p+0, 0x1.b340p-45,271 0x1.21f49917ddd41p+0, 0x1.b340p-45,
272 0x1.22bdda2791323p+0, 0x1.9f80p-46,272 0x1.22bdda2791323p+0, 0x1.9f80p-46,
273 0x1.2387a6e7561e7p+0, -0x1.9c80p-46,273 0x1.2387a6e7561e7p+0, -0x1.9c80p-46,
274 0x1.2451ffb821427p+0, 0x1.2300p-47,274 0x1.2451ffb821427p+0, 0x1.2300p-47,
275 0x1.251ce4fb2a602p+0, -0x1.3480p-46,275 0x1.251ce4fb2a602p+0, -0x1.3480p-46,
276 0x1.25e85711eceb0p+0, 0x1.2700p-46,276 0x1.25e85711eceb0p+0, 0x1.2700p-46,
277 0x1.26b4565e27d16p+0, 0x1.1d00p-46,277 0x1.26b4565e27d16p+0, 0x1.1d00p-46,
278 0x1.2780e341de00fp+0, 0x1.1ee0p-44,278 0x1.2780e341de00fp+0, 0x1.1ee0p-44,
279 0x1.284dfe1f5633ep+0, -0x1.4c00p-46,279 0x1.284dfe1f5633ep+0, -0x1.4c00p-46,
280 0x1.291ba7591bb30p+0, -0x1.3d80p-46,280 0x1.291ba7591bb30p+0, -0x1.3d80p-46,
281 0x1.29e9df51fdf09p+0, 0x1.8b00p-47,281 0x1.29e9df51fdf09p+0, 0x1.8b00p-47,
282 0x1.2ab8a66d10e9bp+0, -0x1.27c0p-45,282 0x1.2ab8a66d10e9bp+0, -0x1.27c0p-45,
283 0x1.2b87fd0dada3ap+0, 0x1.a340p-45,283 0x1.2b87fd0dada3ap+0, 0x1.a340p-45,
284 0x1.2c57e39771af9p+0, -0x1.0800p-46,284 0x1.2c57e39771af9p+0, -0x1.0800p-46,
285 0x1.2d285a6e402d9p+0, -0x1.ed00p-47,285 0x1.2d285a6e402d9p+0, -0x1.ed00p-47,
286 0x1.2df961f641579p+0, -0x1.4200p-48,286 0x1.2df961f641579p+0, -0x1.4200p-48,
...@@ -290,78 +290,78 @@ const exp2dt = []f64 {...@@ -290,78 +290,78 @@ const exp2dt = []f64 {
290 0x1.31432edeea50bp+0, -0x1.0df8p-40,290 0x1.31432edeea50bp+0, -0x1.0df8p-40,
291 0x1.32170fc4cd7b8p+0, -0x1.2480p-45,291 0x1.32170fc4cd7b8p+0, -0x1.2480p-45,
292 0x1.32eb83ba8e9a2p+0, -0x1.5980p-45,292 0x1.32eb83ba8e9a2p+0, -0x1.5980p-45,
293 0x1.33c08b2641766p+0, 0x1.ed00p-46,293 0x1.33c08b2641766p+0, 0x1.ed00p-46,
294 0x1.3496266e3fa27p+0, -0x1.c000p-50,294 0x1.3496266e3fa27p+0, -0x1.c000p-50,
295 0x1.356c55f929f0fp+0, -0x1.0d80p-44,295 0x1.356c55f929f0fp+0, -0x1.0d80p-44,
296 0x1.36431a2de88b9p+0, 0x1.2c80p-45,296 0x1.36431a2de88b9p+0, 0x1.2c80p-45,
297 0x1.371a7373aaa39p+0, 0x1.0600p-45,297 0x1.371a7373aaa39p+0, 0x1.0600p-45,
298 0x1.37f26231e74fep+0, -0x1.6600p-46,298 0x1.37f26231e74fep+0, -0x1.6600p-46,
299 0x1.38cae6d05d838p+0, -0x1.ae00p-47,299 0x1.38cae6d05d838p+0, -0x1.ae00p-47,
300 0x1.39a401b713ec3p+0, -0x1.4720p-43,300 0x1.39a401b713ec3p+0, -0x1.4720p-43,
301 0x1.3a7db34e5a020p+0, 0x1.8200p-47,301 0x1.3a7db34e5a020p+0, 0x1.8200p-47,
302 0x1.3b57fbfec6e95p+0, 0x1.e800p-44,302 0x1.3b57fbfec6e95p+0, 0x1.e800p-44,
303 0x1.3c32dc313a8f2p+0, 0x1.f800p-49,303 0x1.3c32dc313a8f2p+0, 0x1.f800p-49,
304 0x1.3d0e544ede122p+0, -0x1.7a00p-46,304 0x1.3d0e544ede122p+0, -0x1.7a00p-46,
305 0x1.3dea64c1234bbp+0, 0x1.6300p-45,305 0x1.3dea64c1234bbp+0, 0x1.6300p-45,
306 0x1.3ec70df1c4eccp+0, -0x1.8a60p-43,306 0x1.3ec70df1c4eccp+0, -0x1.8a60p-43,
307 0x1.3fa4504ac7e8cp+0, -0x1.cdc0p-44,307 0x1.3fa4504ac7e8cp+0, -0x1.cdc0p-44,
308 0x1.40822c367a0bbp+0, 0x1.5b80p-45,308 0x1.40822c367a0bbp+0, 0x1.5b80p-45,
309 0x1.4160a21f72e95p+0, 0x1.ec00p-46,309 0x1.4160a21f72e95p+0, 0x1.ec00p-46,
310 0x1.423fb27094646p+0, -0x1.3600p-46,310 0x1.423fb27094646p+0, -0x1.3600p-46,
311 0x1.431f5d950a920p+0, 0x1.3980p-45,311 0x1.431f5d950a920p+0, 0x1.3980p-45,
312 0x1.43ffa3f84b9ebp+0, 0x1.a000p-48,312 0x1.43ffa3f84b9ebp+0, 0x1.a000p-48,
313 0x1.44e0860618919p+0, -0x1.6c00p-48,313 0x1.44e0860618919p+0, -0x1.6c00p-48,
314 0x1.45c2042a7d201p+0, -0x1.bc00p-47,314 0x1.45c2042a7d201p+0, -0x1.bc00p-47,
315 0x1.46a41ed1d0016p+0, -0x1.2800p-46,315 0x1.46a41ed1d0016p+0, -0x1.2800p-46,
316 0x1.4786d668b3326p+0, 0x1.0e00p-44,316 0x1.4786d668b3326p+0, 0x1.0e00p-44,
317 0x1.486a2b5c13c00p+0, -0x1.d400p-45,317 0x1.486a2b5c13c00p+0, -0x1.d400p-45,
318 0x1.494e1e192af04p+0, 0x1.c200p-47,318 0x1.494e1e192af04p+0, 0x1.c200p-47,
319 0x1.4a32af0d7d372p+0, -0x1.e500p-46,319 0x1.4a32af0d7d372p+0, -0x1.e500p-46,
320 0x1.4b17dea6db801p+0, 0x1.7800p-47,320 0x1.4b17dea6db801p+0, 0x1.7800p-47,
321 0x1.4bfdad53629e1p+0, -0x1.3800p-46,321 0x1.4bfdad53629e1p+0, -0x1.3800p-46,
322 0x1.4ce41b817c132p+0, 0x1.0800p-47,322 0x1.4ce41b817c132p+0, 0x1.0800p-47,
323 0x1.4dcb299fddddbp+0, 0x1.c700p-45,323 0x1.4dcb299fddddbp+0, 0x1.c700p-45,
324 0x1.4eb2d81d8ab96p+0, -0x1.ce00p-46,324 0x1.4eb2d81d8ab96p+0, -0x1.ce00p-46,
325 0x1.4f9b2769d2d02p+0, 0x1.9200p-46,325 0x1.4f9b2769d2d02p+0, 0x1.9200p-46,
326 0x1.508417f4531c1p+0, -0x1.8c00p-47,326 0x1.508417f4531c1p+0, -0x1.8c00p-47,
327 0x1.516daa2cf662ap+0, -0x1.a000p-48,327 0x1.516daa2cf662ap+0, -0x1.a000p-48,
328 0x1.5257de83f51eap+0, 0x1.a080p-43,328 0x1.5257de83f51eap+0, 0x1.a080p-43,
329 0x1.5342b569d4edap+0, -0x1.6d80p-45,329 0x1.5342b569d4edap+0, -0x1.6d80p-45,
330 0x1.542e2f4f6ac1ap+0, -0x1.2440p-44,330 0x1.542e2f4f6ac1ap+0, -0x1.2440p-44,
331 0x1.551a4ca5d94dbp+0, 0x1.83c0p-43,331 0x1.551a4ca5d94dbp+0, 0x1.83c0p-43,
332 0x1.56070dde9116bp+0, 0x1.4b00p-45,332 0x1.56070dde9116bp+0, 0x1.4b00p-45,
333 0x1.56f4736b529dep+0, 0x1.15a0p-43,333 0x1.56f4736b529dep+0, 0x1.15a0p-43,
334 0x1.57e27dbe2c40ep+0, -0x1.9e00p-45,334 0x1.57e27dbe2c40ep+0, -0x1.9e00p-45,
335 0x1.58d12d497c76fp+0, -0x1.3080p-45,335 0x1.58d12d497c76fp+0, -0x1.3080p-45,
336 0x1.59c0827ff0b4cp+0, 0x1.dec0p-43,336 0x1.59c0827ff0b4cp+0, 0x1.dec0p-43,
337 0x1.5ab07dd485427p+0, -0x1.4000p-51,337 0x1.5ab07dd485427p+0, -0x1.4000p-51,
338 0x1.5ba11fba87af4p+0, 0x1.0080p-44,338 0x1.5ba11fba87af4p+0, 0x1.0080p-44,
339 0x1.5c9268a59460bp+0, -0x1.6c80p-45,339 0x1.5c9268a59460bp+0, -0x1.6c80p-45,
340 0x1.5d84590998e3fp+0, 0x1.69a0p-43,340 0x1.5d84590998e3fp+0, 0x1.69a0p-43,
341 0x1.5e76f15ad20e1p+0, -0x1.b400p-46,341 0x1.5e76f15ad20e1p+0, -0x1.b400p-46,
342 0x1.5f6a320dcebcap+0, 0x1.7700p-46,342 0x1.5f6a320dcebcap+0, 0x1.7700p-46,
343 0x1.605e1b976dcb8p+0, 0x1.6f80p-45,343 0x1.605e1b976dcb8p+0, 0x1.6f80p-45,
344 0x1.6152ae6cdf715p+0, 0x1.1000p-47,344 0x1.6152ae6cdf715p+0, 0x1.1000p-47,
345 0x1.6247eb03a5531p+0, -0x1.5d00p-46,345 0x1.6247eb03a5531p+0, -0x1.5d00p-46,
346 0x1.633dd1d1929b5p+0, -0x1.2d00p-46,346 0x1.633dd1d1929b5p+0, -0x1.2d00p-46,
347 0x1.6434634ccc313p+0, -0x1.a800p-49,347 0x1.6434634ccc313p+0, -0x1.a800p-49,
348 0x1.652b9febc8efap+0, -0x1.8600p-45,348 0x1.652b9febc8efap+0, -0x1.8600p-45,
349 0x1.6623882553397p+0, 0x1.1fe0p-40,349 0x1.6623882553397p+0, 0x1.1fe0p-40,
350 0x1.671c1c708328ep+0, -0x1.7200p-44,350 0x1.671c1c708328ep+0, -0x1.7200p-44,
351 0x1.68155d44ca97ep+0, 0x1.6800p-49,351 0x1.68155d44ca97ep+0, 0x1.6800p-49,
352 0x1.690f4b19e9471p+0, -0x1.9780p-45,352 0x1.690f4b19e9471p+0, -0x1.9780p-45,
353};353};
354354
355fn exp2_64(x: f64) f64 {355fn exp2_64(x: f64) f64 {
356 @setFloatMode(this, @import("builtin").FloatMode.Strict);356 @setFloatMode(this, @import("builtin").FloatMode.Strict);
357357
358 const tblsiz = u32(exp2dt.len / 2);358 const tblsiz = u32(exp2dt.len / 2);
359 const redux: f64 = 0x1.8p52 / f64(tblsiz);359 const redux: f64 = 0x1.8p52 / f64(tblsiz);
360 const P1: f64 = 0x1.62e42fefa39efp-1;360 const P1: f64 = 0x1.62e42fefa39efp-1;
361 const P2: f64 = 0x1.ebfbdff82c575p-3;361 const P2: f64 = 0x1.ebfbdff82c575p-3;
362 const P3: f64 = 0x1.c6b08d704a0a6p-5;362 const P3: f64 = 0x1.c6b08d704a0a6p-5;
363 const P4: f64 = 0x1.3b2ab88f70400p-7;363 const P4: f64 = 0x1.3b2ab88f70400p-7;
364 const P5: f64 = 0x1.5d88003875c74p-10;364 const P5: f64 = 0x1.5d88003875c74p-10;
365365
366 const ux = @bitCast(u64, x);366 const ux = @bitCast(u64, x);
367 const ix = u32(ux >> 32) & 0x7FFFFFFF;367 const ix = u32(ux >> 32) & 0x7FFFFFFF;
std/math/expm1.zig+11-13
...@@ -21,11 +21,11 @@ pub fn expm1(x: var) @typeOf(x) {...@@ -21,11 +21,11 @@ pub fn expm1(x: var) @typeOf(x) {
21fn expm1_32(x_: f32) f32 {21fn expm1_32(x_: f32) f32 {
22 @setFloatMode(this, builtin.FloatMode.Strict);22 @setFloatMode(this, builtin.FloatMode.Strict);
23 const o_threshold: f32 = 8.8721679688e+01;23 const o_threshold: f32 = 8.8721679688e+01;
24 const ln2_hi: f32 = 6.9313812256e-01;24 const ln2_hi: f32 = 6.9313812256e-01;
25 const ln2_lo: f32 = 9.0580006145e-06;25 const ln2_lo: f32 = 9.0580006145e-06;
26 const invln2: f32 = 1.4426950216e+00;26 const invln2: f32 = 1.4426950216e+00;
27 const Q1: f32 = -3.3333212137e-2;27 const Q1: f32 = -3.3333212137e-2;
28 const Q2: f32 = 1.5807170421e-3;28 const Q2: f32 = 1.5807170421e-3;
2929
30 var x = x_;30 var x = x_;
31 const ux = @bitCast(u32, x);31 const ux = @bitCast(u32, x);
...@@ -93,8 +93,7 @@ fn expm1_32(x_: f32) f32 {...@@ -93,8 +93,7 @@ fn expm1_32(x_: f32) f32 {
93 math.forceEval(x * x);93 math.forceEval(x * x);
94 }94 }
95 return x;95 return x;
96 }96 } else {
97 else {
98 k = 0;97 k = 0;
99 }98 }
10099
...@@ -148,13 +147,13 @@ fn expm1_32(x_: f32) f32 {...@@ -148,13 +147,13 @@ fn expm1_32(x_: f32) f32 {
148fn expm1_64(x_: f64) f64 {147fn expm1_64(x_: f64) f64 {
149 @setFloatMode(this, builtin.FloatMode.Strict);148 @setFloatMode(this, builtin.FloatMode.Strict);
150 const o_threshold: f64 = 7.09782712893383973096e+02;149 const o_threshold: f64 = 7.09782712893383973096e+02;
151 const ln2_hi: f64 = 6.93147180369123816490e-01;150 const ln2_hi: f64 = 6.93147180369123816490e-01;
152 const ln2_lo: f64 = 1.90821492927058770002e-10;151 const ln2_lo: f64 = 1.90821492927058770002e-10;
153 const invln2: f64 = 1.44269504088896338700e+00;152 const invln2: f64 = 1.44269504088896338700e+00;
154 const Q1: f64 = -3.33333333333331316428e-02;153 const Q1: f64 = -3.33333333333331316428e-02;
155 const Q2: f64 = 1.58730158725481460165e-03;154 const Q2: f64 = 1.58730158725481460165e-03;
156 const Q3: f64 = -7.93650757867487942473e-05;155 const Q3: f64 = -7.93650757867487942473e-05;
157 const Q4: f64 = 4.00821782732936239552e-06;156 const Q4: f64 = 4.00821782732936239552e-06;
158 const Q5: f64 = -2.01099218183624371326e-07;157 const Q5: f64 = -2.01099218183624371326e-07;
159158
160 var x = x_;159 var x = x_;
...@@ -223,8 +222,7 @@ fn expm1_64(x_: f64) f64 {...@@ -223,8 +222,7 @@ fn expm1_64(x_: f64) f64 {
223 math.forceEval(f32(x));222 math.forceEval(f32(x));
224 }223 }
225 return x;224 return x;
226 }225 } else {
227 else {
228 k = 0;226 k = 0;
229 }227 }
230228
std/math/index.zig+1-1
...@@ -501,7 +501,7 @@ test "math.negateCast" {...@@ -501,7 +501,7 @@ test "math.negateCast" {
501 if (negateCast(u32(@maxValue(i32) + 10))) |_| unreachable else |err| assert(err == error.Overflow);501 if (negateCast(u32(@maxValue(i32) + 10))) |_| unreachable else |err| assert(err == error.Overflow);
502}502}
503503
504/// Cast an integer to a different integer type. If the value doesn't fit, 504/// Cast an integer to a different integer type. If the value doesn't fit,
505/// return an error.505/// return an error.
506pub fn cast(comptime T: type, x: var) (error{Overflow}!T) {506pub fn cast(comptime T: type, x: var) (error{Overflow}!T) {
507 comptime assert(@typeId(T) == builtin.TypeId.Int); // must pass an integer507 comptime assert(@typeId(T) == builtin.TypeId.Int); // must pass an integer
std/math/log1p.zig+1-2
...@@ -138,8 +138,7 @@ fn log1p_64(x: f64) f64 {...@@ -138,8 +138,7 @@ fn log1p_64(x: f64) f64 {
138 c = 0;138 c = 0;
139 f = x;139 f = x;
140 }140 }
141 }141 } else if (hx >= 0x7FF00000) {
142 else if (hx >= 0x7FF00000) {
143 return x;142 return x;
144 }143 }
145144
std/math/pow.zig-1
...@@ -28,7 +28,6 @@ const assert = std.debug.assert;...@@ -28,7 +28,6 @@ const assert = std.debug.assert;
2828
29// This implementation is taken from the go stlib, musl is a bit more complex.29// This implementation is taken from the go stlib, musl is a bit more complex.
30pub fn pow(comptime T: type, x: T, y: T) T {30pub fn pow(comptime T: type, x: T, y: T) T {
31
32 @setFloatMode(this, @import("builtin").FloatMode.Strict);31 @setFloatMode(this, @import("builtin").FloatMode.Strict);
3332
34 if (T != f32 and T != f64) {33 if (T != f32 and T != f64) {
std/net.zig+19-13
...@@ -19,24 +19,30 @@ pub const Address = struct {...@@ -19,24 +19,30 @@ pub const Address = struct {
19 os_addr: OsAddress,19 os_addr: OsAddress,
2020
21 pub fn initIp4(ip4: u32, port: u16) Address {21 pub fn initIp4(ip4: u32, port: u16) Address {
22 return Address{ .os_addr = posix.sockaddr{ .in = posix.sockaddr_in{22 return Address{
23 .family = posix.AF_INET,23 .os_addr = posix.sockaddr{
24 .port = std.mem.endianSwapIfLe(u16, port),24 .in = posix.sockaddr_in{
25 .addr = ip4,25 .family = posix.AF_INET,
26 .zero = []u8{0} ** 8,26 .port = std.mem.endianSwapIfLe(u16, port),
27 } } };27 .addr = ip4,
28 .zero = []u8{0} ** 8,
29 },
30 },
31 };
28 }32 }
2933
30 pub fn initIp6(ip6: &const Ip6Addr, port: u16) Address {34 pub fn initIp6(ip6: &const Ip6Addr, port: u16) Address {
31 return Address{35 return Address{
32 .family = posix.AF_INET6,36 .family = posix.AF_INET6,
33 .os_addr = posix.sockaddr{ .in6 = posix.sockaddr_in6{37 .os_addr = posix.sockaddr{
34 .family = posix.AF_INET6,38 .in6 = posix.sockaddr_in6{
35 .port = std.mem.endianSwapIfLe(u16, port),39 .family = posix.AF_INET6,
36 .flowinfo = 0,40 .port = std.mem.endianSwapIfLe(u16, port),
37 .addr = ip6.addr,41 .flowinfo = 0,
38 .scope_id = ip6.scope_id,42 .addr = ip6.addr,
39 } },43 .scope_id = ip6.scope_id,
44 },
45 },
40 };46 };
41 }47 }
4248
std/os/child_process.zig+3-8
...@@ -387,15 +387,12 @@ pub const ChildProcess = struct {...@@ -387,15 +387,12 @@ pub const ChildProcess = struct {
387 const pid_err = posix.getErrno(pid_result);387 const pid_err = posix.getErrno(pid_result);
388 if (pid_err > 0) {388 if (pid_err > 0) {
389 return switch (pid_err) {389 return switch (pid_err) {
390 posix.EAGAIN,390 posix.EAGAIN, posix.ENOMEM, posix.ENOSYS => error.SystemResources,
391 posix.ENOMEM,
392 posix.ENOSYS => error.SystemResources,
393 else => os.unexpectedErrorPosix(pid_err),391 else => os.unexpectedErrorPosix(pid_err),
394 };392 };
395 }393 }
396 if (pid_result == 0) {394 if (pid_result == 0) {
397 // we are the child395 // we are the child
398
399 setUpChildIo(self.stdin_behavior, stdin_pipe[0], posix.STDIN_FILENO, dev_null_fd) catch |err| forkChildErrReport(err_pipe[1], err);396 setUpChildIo(self.stdin_behavior, stdin_pipe[0], posix.STDIN_FILENO, dev_null_fd) catch |err| forkChildErrReport(err_pipe[1], err);
400 setUpChildIo(self.stdout_behavior, stdout_pipe[1], posix.STDOUT_FILENO, dev_null_fd) catch |err| forkChildErrReport(err_pipe[1], err);397 setUpChildIo(self.stdout_behavior, stdout_pipe[1], posix.STDOUT_FILENO, dev_null_fd) catch |err| forkChildErrReport(err_pipe[1], err);
401 setUpChildIo(self.stderr_behavior, stderr_pipe[1], posix.STDERR_FILENO, dev_null_fd) catch |err| forkChildErrReport(err_pipe[1], err);398 setUpChildIo(self.stderr_behavior, stderr_pipe[1], posix.STDERR_FILENO, dev_null_fd) catch |err| forkChildErrReport(err_pipe[1], err);
...@@ -646,8 +643,7 @@ fn windowsCreateProcess(app_name: &u8, cmd_line: &u8, envp_ptr: ?&u8, cwd_ptr: ?...@@ -646,8 +643,7 @@ fn windowsCreateProcess(app_name: &u8, cmd_line: &u8, envp_ptr: ?&u8, cwd_ptr: ?
646 if (windows.CreateProcessA(app_name, cmd_line, null, null, windows.TRUE, 0, @ptrCast(?&c_void, envp_ptr), cwd_ptr, lpStartupInfo, lpProcessInformation) == 0) {643 if (windows.CreateProcessA(app_name, cmd_line, null, null, windows.TRUE, 0, @ptrCast(?&c_void, envp_ptr), cwd_ptr, lpStartupInfo, lpProcessInformation) == 0) {
647 const err = windows.GetLastError();644 const err = windows.GetLastError();
648 return switch (err) {645 return switch (err) {
649 windows.ERROR.FILE_NOT_FOUND,646 windows.ERROR.FILE_NOT_FOUND, windows.ERROR.PATH_NOT_FOUND => error.FileNotFound,
650 windows.ERROR.PATH_NOT_FOUND => error.FileNotFound,
651 windows.ERROR.INVALID_PARAMETER => unreachable,647 windows.ERROR.INVALID_PARAMETER => unreachable,
652 windows.ERROR.INVALID_NAME => error.InvalidName,648 windows.ERROR.INVALID_NAME => error.InvalidName,
653 else => os.unexpectedErrorWindows(err),649 else => os.unexpectedErrorWindows(err),
...@@ -745,8 +741,7 @@ fn makePipe() ![2]i32 {...@@ -745,8 +741,7 @@ fn makePipe() ![2]i32 {
745 const err = posix.getErrno(posix.pipe(&fds));741 const err = posix.getErrno(posix.pipe(&fds));
746 if (err > 0) {742 if (err > 0) {
747 return switch (err) {743 return switch (err) {
748 posix.EMFILE,744 posix.EMFILE, posix.ENFILE => error.SystemResources,
749 posix.ENFILE => error.SystemResources,
750 else => os.unexpectedErrorPosix(err),745 else => os.unexpectedErrorPosix(err),
751 };746 };
752 }747 }
std/os/darwin.zig+66
...@@ -12,52 +12,71 @@ pub const STDERR_FILENO = 2;...@@ -12,52 +12,71 @@ pub const STDERR_FILENO = 2;
1212
13/// [MC2] no permissions13/// [MC2] no permissions
14pub const PROT_NONE = 0x00;14pub const PROT_NONE = 0x00;
15
15/// [MC2] pages can be read16/// [MC2] pages can be read
16pub const PROT_READ = 0x01;17pub const PROT_READ = 0x01;
18
17/// [MC2] pages can be written19/// [MC2] pages can be written
18pub const PROT_WRITE = 0x02;20pub const PROT_WRITE = 0x02;
21
19/// [MC2] pages can be executed22/// [MC2] pages can be executed
20pub const PROT_EXEC = 0x04;23pub const PROT_EXEC = 0x04;
2124
22/// allocated from memory, swap space25/// allocated from memory, swap space
23pub const MAP_ANONYMOUS = 0x1000;26pub const MAP_ANONYMOUS = 0x1000;
27
24/// map from file (default)28/// map from file (default)
25pub const MAP_FILE = 0x0000;29pub const MAP_FILE = 0x0000;
30
26/// interpret addr exactly31/// interpret addr exactly
27pub const MAP_FIXED = 0x0010;32pub const MAP_FIXED = 0x0010;
33
28/// region may contain semaphores34/// region may contain semaphores
29pub const MAP_HASSEMAPHORE = 0x0200;35pub const MAP_HASSEMAPHORE = 0x0200;
36
30/// changes are private37/// changes are private
31pub const MAP_PRIVATE = 0x0002;38pub const MAP_PRIVATE = 0x0002;
39
32/// share changes40/// share changes
33pub const MAP_SHARED = 0x0001;41pub const MAP_SHARED = 0x0001;
42
34/// don't cache pages for this mapping43/// don't cache pages for this mapping
35pub const MAP_NOCACHE = 0x0400;44pub const MAP_NOCACHE = 0x0400;
45
36/// don't reserve needed swap area46/// don't reserve needed swap area
37pub const MAP_NORESERVE = 0x0040;47pub const MAP_NORESERVE = 0x0040;
38pub const MAP_FAILED = @maxValue(usize);48pub const MAP_FAILED = @maxValue(usize);
3949
40/// [XSI] no hang in wait/no child to reap50/// [XSI] no hang in wait/no child to reap
41pub const WNOHANG = 0x00000001;51pub const WNOHANG = 0x00000001;
52
42/// [XSI] notify on stop, untraced child53/// [XSI] notify on stop, untraced child
43pub const WUNTRACED = 0x00000002;54pub const WUNTRACED = 0x00000002;
4455
45/// take signal on signal stack56/// take signal on signal stack
46pub const SA_ONSTACK = 0x0001;57pub const SA_ONSTACK = 0x0001;
58
47/// restart system on signal return59/// restart system on signal return
48pub const SA_RESTART = 0x0002;60pub const SA_RESTART = 0x0002;
61
49/// reset to SIG_DFL when taking signal62/// reset to SIG_DFL when taking signal
50pub const SA_RESETHAND = 0x0004;63pub const SA_RESETHAND = 0x0004;
64
51/// do not generate SIGCHLD on child stop65/// do not generate SIGCHLD on child stop
52pub const SA_NOCLDSTOP = 0x0008;66pub const SA_NOCLDSTOP = 0x0008;
67
53/// don't mask the signal we're delivering68/// don't mask the signal we're delivering
54pub const SA_NODEFER = 0x0010;69pub const SA_NODEFER = 0x0010;
70
55/// don't keep zombies around71/// don't keep zombies around
56pub const SA_NOCLDWAIT = 0x0020;72pub const SA_NOCLDWAIT = 0x0020;
73
57/// signal handler with SA_SIGINFO args74/// signal handler with SA_SIGINFO args
58pub const SA_SIGINFO = 0x0040;75pub const SA_SIGINFO = 0x0040;
76
59/// do not bounce off kernel's sigtramp77/// do not bounce off kernel's sigtramp
60pub const SA_USERTRAMP = 0x0100;78pub const SA_USERTRAMP = 0x0100;
79
61/// signal handler with SA_SIGINFO args with 64bit regs information80/// signal handler with SA_SIGINFO args with 64bit regs information
62pub const SA_64REGSET = 0x0200;81pub const SA_64REGSET = 0x0200;
6382
...@@ -71,30 +90,43 @@ pub const R_OK = 4;...@@ -71,30 +90,43 @@ pub const R_OK = 4;
7190
72/// open for reading only91/// open for reading only
73pub const O_RDONLY = 0x0000;92pub const O_RDONLY = 0x0000;
93
74/// open for writing only94/// open for writing only
75pub const O_WRONLY = 0x0001;95pub const O_WRONLY = 0x0001;
96
76/// open for reading and writing97/// open for reading and writing
77pub const O_RDWR = 0x0002;98pub const O_RDWR = 0x0002;
99
78/// do not block on open or for data to become available100/// do not block on open or for data to become available
79pub const O_NONBLOCK = 0x0004;101pub const O_NONBLOCK = 0x0004;
102
80/// append on each write103/// append on each write
81pub const O_APPEND = 0x0008;104pub const O_APPEND = 0x0008;
105
82/// create file if it does not exist106/// create file if it does not exist
83pub const O_CREAT = 0x0200;107pub const O_CREAT = 0x0200;
108
84/// truncate size to 0109/// truncate size to 0
85pub const O_TRUNC = 0x0400;110pub const O_TRUNC = 0x0400;
111
86/// error if O_CREAT and the file exists112/// error if O_CREAT and the file exists
87pub const O_EXCL = 0x0800;113pub const O_EXCL = 0x0800;
114
88/// atomically obtain a shared lock115/// atomically obtain a shared lock
89pub const O_SHLOCK = 0x0010;116pub const O_SHLOCK = 0x0010;
117
90/// atomically obtain an exclusive lock118/// atomically obtain an exclusive lock
91pub const O_EXLOCK = 0x0020;119pub const O_EXLOCK = 0x0020;
120
92/// do not follow symlinks121/// do not follow symlinks
93pub const O_NOFOLLOW = 0x0100;122pub const O_NOFOLLOW = 0x0100;
123
94/// allow open of symlinks124/// allow open of symlinks
95pub const O_SYMLINK = 0x200000;125pub const O_SYMLINK = 0x200000;
126
96/// descriptor requested for event notifications only127/// descriptor requested for event notifications only
97pub const O_EVTONLY = 0x8000;128pub const O_EVTONLY = 0x8000;
129
98/// mark as close-on-exec130/// mark as close-on-exec
99pub const O_CLOEXEC = 0x1000000;131pub const O_CLOEXEC = 0x1000000;
100132
...@@ -126,75 +158,109 @@ pub const DT_WHT = 14;...@@ -126,75 +158,109 @@ pub const DT_WHT = 14;
126158
127/// block specified signal set159/// block specified signal set
128pub const SIG_BLOCK = 1;160pub const SIG_BLOCK = 1;
161
129/// unblock specified signal set162/// unblock specified signal set
130pub const SIG_UNBLOCK = 2;163pub const SIG_UNBLOCK = 2;
164
131/// set specified signal set165/// set specified signal set
132pub const SIG_SETMASK = 3;166pub const SIG_SETMASK = 3;
133167
134/// hangup168/// hangup
135pub const SIGHUP = 1;169pub const SIGHUP = 1;
170
136/// interrupt171/// interrupt
137pub const SIGINT = 2;172pub const SIGINT = 2;
173
138/// quit174/// quit
139pub const SIGQUIT = 3;175pub const SIGQUIT = 3;
176
140/// illegal instruction (not reset when caught)177/// illegal instruction (not reset when caught)
141pub const SIGILL = 4;178pub const SIGILL = 4;
179
142/// trace trap (not reset when caught)180/// trace trap (not reset when caught)
143pub const SIGTRAP = 5;181pub const SIGTRAP = 5;
182
144/// abort()183/// abort()
145pub const SIGABRT = 6;184pub const SIGABRT = 6;
185
146/// pollable event ([XSR] generated, not supported)186/// pollable event ([XSR] generated, not supported)
147pub const SIGPOLL = 7;187pub const SIGPOLL = 7;
188
148/// compatibility189/// compatibility
149pub const SIGIOT = SIGABRT;190pub const SIGIOT = SIGABRT;
191
150/// EMT instruction192/// EMT instruction
151pub const SIGEMT = 7;193pub const SIGEMT = 7;
194
152/// floating point exception195/// floating point exception
153pub const SIGFPE = 8;196pub const SIGFPE = 8;
197
154/// kill (cannot be caught or ignored)198/// kill (cannot be caught or ignored)
155pub const SIGKILL = 9;199pub const SIGKILL = 9;
200
156/// bus error201/// bus error
157pub const SIGBUS = 10;202pub const SIGBUS = 10;
203
158/// segmentation violation204/// segmentation violation
159pub const SIGSEGV = 11;205pub const SIGSEGV = 11;
206
160/// bad argument to system call207/// bad argument to system call
161pub const SIGSYS = 12;208pub const SIGSYS = 12;
209
162/// write on a pipe with no one to read it210/// write on a pipe with no one to read it
163pub const SIGPIPE = 13;211pub const SIGPIPE = 13;
212
164/// alarm clock213/// alarm clock
165pub const SIGALRM = 14;214pub const SIGALRM = 14;
215
166/// software termination signal from kill216/// software termination signal from kill
167pub const SIGTERM = 15;217pub const SIGTERM = 15;
218
168/// urgent condition on IO channel219/// urgent condition on IO channel
169pub const SIGURG = 16;220pub const SIGURG = 16;
221
170/// sendable stop signal not from tty222/// sendable stop signal not from tty
171pub const SIGSTOP = 17;223pub const SIGSTOP = 17;
224
172/// stop signal from tty225/// stop signal from tty
173pub const SIGTSTP = 18;226pub const SIGTSTP = 18;
227
174/// continue a stopped process228/// continue a stopped process
175pub const SIGCONT = 19;229pub const SIGCONT = 19;
230
176/// to parent on child stop or exit231/// to parent on child stop or exit
177pub const SIGCHLD = 20;232pub const SIGCHLD = 20;
233
178/// to readers pgrp upon background tty read234/// to readers pgrp upon background tty read
179pub const SIGTTIN = 21;235pub const SIGTTIN = 21;
236
180/// like TTIN for output if (tp->t_local&LTOSTOP)237/// like TTIN for output if (tp->t_local&LTOSTOP)
181pub const SIGTTOU = 22;238pub const SIGTTOU = 22;
239
182/// input/output possible signal240/// input/output possible signal
183pub const SIGIO = 23;241pub const SIGIO = 23;
242
184/// exceeded CPU time limit243/// exceeded CPU time limit
185pub const SIGXCPU = 24;244pub const SIGXCPU = 24;
245
186/// exceeded file size limit246/// exceeded file size limit
187pub const SIGXFSZ = 25;247pub const SIGXFSZ = 25;
248
188/// virtual time alarm249/// virtual time alarm
189pub const SIGVTALRM = 26;250pub const SIGVTALRM = 26;
251
190/// profiling time alarm252/// profiling time alarm
191pub const SIGPROF = 27;253pub const SIGPROF = 27;
254
192/// window size changes255/// window size changes
193pub const SIGWINCH = 28;256pub const SIGWINCH = 28;
257
194/// information request258/// information request
195pub const SIGINFO = 29;259pub const SIGINFO = 29;
260
196/// user defined signal 1261/// user defined signal 1
197pub const SIGUSR1 = 30;262pub const SIGUSR1 = 30;
263
198/// user defined signal 2264/// user defined signal 2
199pub const SIGUSR2 = 31;265pub const SIGUSR2 = 31;
200266
std/os/darwin_errno.zig+294-108
...@@ -1,142 +1,328 @@...@@ -1,142 +1,328 @@
1/// Operation not permitted
2pub const EPERM = 1;
13
2pub const EPERM = 1; /// Operation not permitted4/// No such file or directory
3pub const ENOENT = 2; /// No such file or directory5pub const ENOENT = 2;
4pub const ESRCH = 3; /// No such process6
5pub const EINTR = 4; /// Interrupted system call7/// No such process
6pub const EIO = 5; /// Input/output error8pub const ESRCH = 3;
7pub const ENXIO = 6; /// Device not configured9
8pub const E2BIG = 7; /// Argument list too long10/// Interrupted system call
9pub const ENOEXEC = 8; /// Exec format error11pub const EINTR = 4;
10pub const EBADF = 9; /// Bad file descriptor12
11pub const ECHILD = 10; /// No child processes13/// Input/output error
12pub const EDEADLK = 11; /// Resource deadlock avoided14pub const EIO = 5;
1315
14pub const ENOMEM = 12; /// Cannot allocate memory16/// Device not configured
15pub const EACCES = 13; /// Permission denied17pub const ENXIO = 6;
16pub const EFAULT = 14; /// Bad address18
17pub const ENOTBLK = 15; /// Block device required19/// Argument list too long
18pub const EBUSY = 16; /// Device / Resource busy20pub const E2BIG = 7;
19pub const EEXIST = 17; /// File exists21
20pub const EXDEV = 18; /// Cross-device link22/// Exec format error
21pub const ENODEV = 19; /// Operation not supported by device23pub const ENOEXEC = 8;
22pub const ENOTDIR = 20; /// Not a directory24
23pub const EISDIR = 21; /// Is a directory25/// Bad file descriptor
24pub const EINVAL = 22; /// Invalid argument26pub const EBADF = 9;
25pub const ENFILE = 23; /// Too many open files in system27
26pub const EMFILE = 24; /// Too many open files28/// No child processes
27pub const ENOTTY = 25; /// Inappropriate ioctl for device29pub const ECHILD = 10;
28pub const ETXTBSY = 26; /// Text file busy30
29pub const EFBIG = 27; /// File too large31/// Resource deadlock avoided
30pub const ENOSPC = 28; /// No space left on device32pub const EDEADLK = 11;
31pub const ESPIPE = 29; /// Illegal seek33
32pub const EROFS = 30; /// Read-only file system34/// Cannot allocate memory
33pub const EMLINK = 31; /// Too many links35pub const ENOMEM = 12;
34pub const EPIPE = 32; /// Broken pipe36
37/// Permission denied
38pub const EACCES = 13;
39
40/// Bad address
41pub const EFAULT = 14;
42
43/// Block device required
44pub const ENOTBLK = 15;
45
46/// Device / Resource busy
47pub const EBUSY = 16;
48
49/// File exists
50pub const EEXIST = 17;
51
52/// Cross-device link
53pub const EXDEV = 18;
54
55/// Operation not supported by device
56pub const ENODEV = 19;
57
58/// Not a directory
59pub const ENOTDIR = 20;
60
61/// Is a directory
62pub const EISDIR = 21;
63
64/// Invalid argument
65pub const EINVAL = 22;
66
67/// Too many open files in system
68pub const ENFILE = 23;
69
70/// Too many open files
71pub const EMFILE = 24;
72
73/// Inappropriate ioctl for device
74pub const ENOTTY = 25;
75
76/// Text file busy
77pub const ETXTBSY = 26;
78
79/// File too large
80pub const EFBIG = 27;
81
82/// No space left on device
83pub const ENOSPC = 28;
84
85/// Illegal seek
86pub const ESPIPE = 29;
87
88/// Read-only file system
89pub const EROFS = 30;
90
91/// Too many links
92pub const EMLINK = 31;
93/// Broken pipe
3594
36// math software95// math software
37pub const EDOM = 33; /// Numerical argument out of domain96pub const EPIPE = 32;
38pub const ERANGE = 34; /// Result too large97
98/// Numerical argument out of domain
99pub const EDOM = 33;
100/// Result too large
39101
40// non-blocking and interrupt i/o102// non-blocking and interrupt i/o
41pub const EAGAIN = 35; /// Resource temporarily unavailable103pub const ERANGE = 34;
42pub const EWOULDBLOCK = EAGAIN; /// Operation would block104
43pub const EINPROGRESS = 36; /// Operation now in progress105/// Resource temporarily unavailable
44pub const EALREADY = 37; /// Operation already in progress106pub const EAGAIN = 35;
107
108/// Operation would block
109pub const EWOULDBLOCK = EAGAIN;
110
111/// Operation now in progress
112pub const EINPROGRESS = 36;
113/// Operation already in progress
45114
46// ipc/network software -- argument errors115// ipc/network software -- argument errors
47pub const ENOTSOCK = 38; /// Socket operation on non-socket116pub const EALREADY = 37;
48pub const EDESTADDRREQ = 39; /// Destination address required117
49pub const EMSGSIZE = 40; /// Message too long118/// Socket operation on non-socket
50pub const EPROTOTYPE = 41; /// Protocol wrong type for socket119pub const ENOTSOCK = 38;
51pub const ENOPROTOOPT = 42; /// Protocol not available120
52pub const EPROTONOSUPPORT = 43; /// Protocol not supported121/// Destination address required
122pub const EDESTADDRREQ = 39;
123
124/// Message too long
125pub const EMSGSIZE = 40;
126
127/// Protocol wrong type for socket
128pub const EPROTOTYPE = 41;
129
130/// Protocol not available
131pub const ENOPROTOOPT = 42;
132
133/// Protocol not supported
134pub const EPROTONOSUPPORT = 43;
135
136/// Socket type not supported
137pub const ESOCKTNOSUPPORT = 44;
53138
54pub const ESOCKTNOSUPPORT = 44; /// Socket type not supported139/// Operation not supported
140pub const ENOTSUP = 45;
55141
56pub const ENOTSUP = 45; /// Operation not supported142/// Protocol family not supported
143pub const EPFNOSUPPORT = 46;
57144
58pub const EPFNOSUPPORT = 46; /// Protocol family not supported145/// Address family not supported by protocol family
59pub const EAFNOSUPPORT = 47; /// Address family not supported by protocol family146pub const EAFNOSUPPORT = 47;
60pub const EADDRINUSE = 48; /// Address already in use147
61pub const EADDRNOTAVAIL = 49; /// Can't assign requested address148/// Address already in use
149pub const EADDRINUSE = 48;
150/// Can't assign requested address
62151
63// ipc/network software -- operational errors152// ipc/network software -- operational errors
64pub const ENETDOWN = 50; /// Network is down153pub const EADDRNOTAVAIL = 49;
65pub const ENETUNREACH = 51; /// Network is unreachable154
66pub const ENETRESET = 52; /// Network dropped connection on reset155/// Network is down
67pub const ECONNABORTED = 53; /// Software caused connection abort156pub const ENETDOWN = 50;
68pub const ECONNRESET = 54; /// Connection reset by peer157
69pub const ENOBUFS = 55; /// No buffer space available158/// Network is unreachable
70pub const EISCONN = 56; /// Socket is already connected159pub const ENETUNREACH = 51;
71pub const ENOTCONN = 57; /// Socket is not connected160
161/// Network dropped connection on reset
162pub const ENETRESET = 52;
163
164/// Software caused connection abort
165pub const ECONNABORTED = 53;
166
167/// Connection reset by peer
168pub const ECONNRESET = 54;
169
170/// No buffer space available
171pub const ENOBUFS = 55;
172
173/// Socket is already connected
174pub const EISCONN = 56;
175
176/// Socket is not connected
177pub const ENOTCONN = 57;
178
179/// Can't send after socket shutdown
180pub const ESHUTDOWN = 58;
72181
73pub const ESHUTDOWN = 58; /// Can't send after socket shutdown182/// Too many references: can't splice
74pub const ETOOMANYREFS = 59; /// Too many references: can't splice183pub const ETOOMANYREFS = 59;
75184
76pub const ETIMEDOUT = 60; /// Operation timed out185/// Operation timed out
77pub const ECONNREFUSED = 61; /// Connection refused186pub const ETIMEDOUT = 60;
78187
79pub const ELOOP = 62; /// Too many levels of symbolic links188/// Connection refused
80pub const ENAMETOOLONG = 63; /// File name too long189pub const ECONNREFUSED = 61;
81190
82pub const EHOSTDOWN = 64; /// Host is down191/// Too many levels of symbolic links
83pub const EHOSTUNREACH = 65; /// No route to host192pub const ELOOP = 62;
84pub const ENOTEMPTY = 66; /// Directory not empty193
194/// File name too long
195pub const ENAMETOOLONG = 63;
196
197/// Host is down
198pub const EHOSTDOWN = 64;
199
200/// No route to host
201pub const EHOSTUNREACH = 65;
202/// Directory not empty
85203
86// quotas & mush204// quotas & mush
87pub const EPROCLIM = 67; /// Too many processes205pub const ENOTEMPTY = 66;
88pub const EUSERS = 68; /// Too many users206
89pub const EDQUOT = 69; /// Disc quota exceeded207/// Too many processes
208pub const EPROCLIM = 67;
209
210/// Too many users
211pub const EUSERS = 68;
212/// Disc quota exceeded
90213
91// Network File System214// Network File System
92pub const ESTALE = 70; /// Stale NFS file handle215pub const EDQUOT = 69;
93pub const EREMOTE = 71; /// Too many levels of remote in path216
94pub const EBADRPC = 72; /// RPC struct is bad217/// Stale NFS file handle
95pub const ERPCMISMATCH = 73; /// RPC version wrong218pub const ESTALE = 70;
96pub const EPROGUNAVAIL = 74; /// RPC prog. not avail219
97pub const EPROGMISMATCH = 75; /// Program version wrong220/// Too many levels of remote in path
98pub const EPROCUNAVAIL = 76; /// Bad procedure for program221pub const EREMOTE = 71;
222
223/// RPC struct is bad
224pub const EBADRPC = 72;
225
226/// RPC version wrong
227pub const ERPCMISMATCH = 73;
228
229/// RPC prog. not avail
230pub const EPROGUNAVAIL = 74;
99231
100pub const ENOLCK = 77; /// No locks available232/// Program version wrong
101pub const ENOSYS = 78; /// Function not implemented233pub const EPROGMISMATCH = 75;
102234
103pub const EFTYPE = 79; /// Inappropriate file type or format235/// Bad procedure for program
104pub const EAUTH = 80; /// Authentication error236pub const EPROCUNAVAIL = 76;
105pub const ENEEDAUTH = 81; /// Need authenticator237
238/// No locks available
239pub const ENOLCK = 77;
240
241/// Function not implemented
242pub const ENOSYS = 78;
243
244/// Inappropriate file type or format
245pub const EFTYPE = 79;
246
247/// Authentication error
248pub const EAUTH = 80;
249/// Need authenticator
106250
107// Intelligent device errors251// Intelligent device errors
108pub const EPWROFF = 82; /// Device power is off252pub const ENEEDAUTH = 81;
109pub const EDEVERR = 83; /// Device error, e.g. paper out253
254/// Device power is off
255pub const EPWROFF = 82;
110256
111pub const EOVERFLOW = 84; /// Value too large to be stored in data type257/// Device error, e.g. paper out
258pub const EDEVERR = 83;
259/// Value too large to be stored in data type
112260
113// Program loading errors261// Program loading errors
114pub const EBADEXEC = 85; /// Bad executable262pub const EOVERFLOW = 84;
115pub const EBADARCH = 86; /// Bad CPU type in executable263
116pub const ESHLIBVERS = 87; /// Shared library version mismatch264/// Bad executable
117pub const EBADMACHO = 88; /// Malformed Macho file265pub const EBADEXEC = 85;
266
267/// Bad CPU type in executable
268pub const EBADARCH = 86;
269
270/// Shared library version mismatch
271pub const ESHLIBVERS = 87;
272
273/// Malformed Macho file
274pub const EBADMACHO = 88;
275
276/// Operation canceled
277pub const ECANCELED = 89;
278
279/// Identifier removed
280pub const EIDRM = 90;
281
282/// No message of desired type
283pub const ENOMSG = 91;
284
285/// Illegal byte sequence
286pub const EILSEQ = 92;
287
288/// Attribute not found
289pub const ENOATTR = 93;
290
291/// Bad message
292pub const EBADMSG = 94;
293
294/// Reserved
295pub const EMULTIHOP = 95;
296
297/// No message available on STREAM
298pub const ENODATA = 96;
299
300/// Reserved
301pub const ENOLINK = 97;
302
303/// No STREAM resources
304pub const ENOSR = 98;
305
306/// Not a STREAM
307pub const ENOSTR = 99;
118308
119pub const ECANCELED = 89; /// Operation canceled309/// Protocol error
310pub const EPROTO = 100;
120311
121pub const EIDRM = 90; /// Identifier removed312/// STREAM ioctl timeout
122pub const ENOMSG = 91; /// No message of desired type313pub const ETIME = 101;
123pub const EILSEQ = 92; /// Illegal byte sequence
124pub const ENOATTR = 93; /// Attribute not found
125314
126pub const EBADMSG = 94; /// Bad message315/// No such policy registered
127pub const EMULTIHOP = 95; /// Reserved316pub const ENOPOLICY = 103;
128pub const ENODATA = 96; /// No message available on STREAM
129pub const ENOLINK = 97; /// Reserved
130pub const ENOSR = 98; /// No STREAM resources
131pub const ENOSTR = 99; /// Not a STREAM
132pub const EPROTO = 100; /// Protocol error
133pub const ETIME = 101; /// STREAM ioctl timeout
134317
135pub const ENOPOLICY = 103; /// No such policy registered318/// State not recoverable
319pub const ENOTRECOVERABLE = 104;
136320
137pub const ENOTRECOVERABLE = 104; /// State not recoverable321/// Previous owner died
138pub const EOWNERDEAD = 105; /// Previous owner died322pub const EOWNERDEAD = 105;
139323
140pub const EQFULL = 106; /// Interface output queue is full324/// Interface output queue is full
141pub const ELAST = 106; /// Must be equal largest errno325pub const EQFULL = 106;
142326
327/// Must be equal largest errno
328pub const ELAST = 106;
std/os/epoch.zig+23-23
...@@ -1,26 +1,26 @@...@@ -1,26 +1,26 @@
1/// Epoch reference times in terms of their difference from1/// Epoch reference times in terms of their difference from
2/// posix epoch in seconds.2/// posix epoch in seconds.
3pub const posix = 0; //Jan 01, 1970 AD3pub const posix = 0; //Jan 01, 1970 AD
4pub const dos = 315532800; //Jan 01, 1980 AD4pub const dos = 315532800; //Jan 01, 1980 AD
5pub const ios = 978307200; //Jan 01, 2001 AD5pub const ios = 978307200; //Jan 01, 2001 AD
6pub const openvms = -3506716800; //Nov 17, 1858 AD6pub const openvms = -3506716800; //Nov 17, 1858 AD
7pub const zos = -2208988800; //Jan 01, 1900 AD7pub const zos = -2208988800; //Jan 01, 1900 AD
8pub const windows = -11644473600; //Jan 01, 1601 AD8pub const windows = -11644473600; //Jan 01, 1601 AD
9pub const amiga = 252460800; //Jan 01, 1978 AD9pub const amiga = 252460800; //Jan 01, 1978 AD
10pub const pickos = -63244800; //Dec 31, 1967 AD10pub const pickos = -63244800; //Dec 31, 1967 AD
11pub const gps = 315964800; //Jan 06, 1980 AD11pub const gps = 315964800; //Jan 06, 1980 AD
12pub const clr = -62135769600; //Jan 01, 0001 AD12pub const clr = -62135769600; //Jan 01, 0001 AD
1313
14pub const unix = posix;
15pub const android = posix;
16pub const os2 = dos;
17pub const bios = dos;
18pub const vfat = dos;
19pub const ntfs = windows;
20pub const ntp = zos;
21pub const jbase = pickos;
22pub const aros = amiga;
23pub const morphos = amiga;
24pub const brew = gps;
25pub const atsc = gps;
26pub const go = clr;
\ No newline at end of file
14pub const unix = posix;
15pub const android = posix;
16pub const os2 = dos;
17pub const bios = dos;
18pub const vfat = dos;
19pub const ntfs = windows;
20pub const ntp = zos;
21pub const jbase = pickos;
22pub const aros = amiga;
23pub const morphos = amiga;
24pub const brew = gps;
25pub const atsc = gps;
26pub const go = clr;
std/os/file.zig+35-24
...@@ -21,12 +21,18 @@ pub const File = struct {...@@ -21,12 +21,18 @@ pub const File = struct {
21 /// Call close to clean up.21 /// Call close to clean up.
22 pub fn openRead(allocator: &mem.Allocator, path: []const u8) OpenError!File {22 pub fn openRead(allocator: &mem.Allocator, path: []const u8) OpenError!File {
23 if (is_posix) {23 if (is_posix) {
24 const flags = posix.O_LARGEFILE|posix.O_RDONLY;24 const flags = posix.O_LARGEFILE | posix.O_RDONLY;
25 const fd = try os.posixOpen(allocator, path, flags, 0);25 const fd = try os.posixOpen(allocator, path, flags, 0);
26 return openHandle(fd);26 return openHandle(fd);
27 } else if (is_windows) {27 } else if (is_windows) {
28 const handle = try os.windowsOpen(allocator, path, windows.GENERIC_READ, windows.FILE_SHARE_READ,28 const handle = try os.windowsOpen(
29 windows.OPEN_EXISTING, windows.FILE_ATTRIBUTE_NORMAL);29 allocator,
30 path,
31 windows.GENERIC_READ,
32 windows.FILE_SHARE_READ,
33 windows.OPEN_EXISTING,
34 windows.FILE_ATTRIBUTE_NORMAL,
35 );
30 return openHandle(handle);36 return openHandle(handle);
31 } else {37 } else {
32 @compileError("TODO implement openRead for this OS");38 @compileError("TODO implement openRead for this OS");
...@@ -36,7 +42,6 @@ pub const File = struct {...@@ -36,7 +42,6 @@ pub const File = struct {
36 /// Calls `openWriteMode` with os.default_file_mode for the mode.42 /// Calls `openWriteMode` with os.default_file_mode for the mode.
37 pub fn openWrite(allocator: &mem.Allocator, path: []const u8) OpenError!File {43 pub fn openWrite(allocator: &mem.Allocator, path: []const u8) OpenError!File {
38 return openWriteMode(allocator, path, os.default_file_mode);44 return openWriteMode(allocator, path, os.default_file_mode);
39
40 }45 }
4146
42 /// If the path does not exist it will be created.47 /// If the path does not exist it will be created.
...@@ -45,18 +50,22 @@ pub const File = struct {...@@ -45,18 +50,22 @@ pub const File = struct {
45 /// Call close to clean up.50 /// Call close to clean up.
46 pub fn openWriteMode(allocator: &mem.Allocator, path: []const u8, file_mode: os.FileMode) OpenError!File {51 pub fn openWriteMode(allocator: &mem.Allocator, path: []const u8, file_mode: os.FileMode) OpenError!File {
47 if (is_posix) {52 if (is_posix) {
48 const flags = posix.O_LARGEFILE|posix.O_WRONLY|posix.O_CREAT|posix.O_CLOEXEC|posix.O_TRUNC;53 const flags = posix.O_LARGEFILE | posix.O_WRONLY | posix.O_CREAT | posix.O_CLOEXEC | posix.O_TRUNC;
49 const fd = try os.posixOpen(allocator, path, flags, file_mode);54 const fd = try os.posixOpen(allocator, path, flags, file_mode);
50 return openHandle(fd);55 return openHandle(fd);
51 } else if (is_windows) {56 } else if (is_windows) {
52 const handle = try os.windowsOpen(allocator, path, windows.GENERIC_WRITE,57 const handle = try os.windowsOpen(
53 windows.FILE_SHARE_WRITE|windows.FILE_SHARE_READ|windows.FILE_SHARE_DELETE,58 allocator,
54 windows.CREATE_ALWAYS, windows.FILE_ATTRIBUTE_NORMAL);59 path,
60 windows.GENERIC_WRITE,
61 windows.FILE_SHARE_WRITE | windows.FILE_SHARE_READ | windows.FILE_SHARE_DELETE,
62 windows.CREATE_ALWAYS,
63 windows.FILE_ATTRIBUTE_NORMAL,
64 );
55 return openHandle(handle);65 return openHandle(handle);
56 } else {66 } else {
57 @compileError("TODO implement openWriteMode for this OS");67 @compileError("TODO implement openWriteMode for this OS");
58 }68 }
59
60 }69 }
6170
62 /// If the path does not exist it will be created.71 /// If the path does not exist it will be created.
...@@ -65,24 +74,26 @@ pub const File = struct {...@@ -65,24 +74,26 @@ pub const File = struct {
65 /// Call close to clean up.74 /// Call close to clean up.
66 pub fn openWriteNoClobber(allocator: &mem.Allocator, path: []const u8, file_mode: os.FileMode) OpenError!File {75 pub fn openWriteNoClobber(allocator: &mem.Allocator, path: []const u8, file_mode: os.FileMode) OpenError!File {
67 if (is_posix) {76 if (is_posix) {
68 const flags = posix.O_LARGEFILE|posix.O_WRONLY|posix.O_CREAT|posix.O_CLOEXEC|posix.O_EXCL;77 const flags = posix.O_LARGEFILE | posix.O_WRONLY | posix.O_CREAT | posix.O_CLOEXEC | posix.O_EXCL;
69 const fd = try os.posixOpen(allocator, path, flags, file_mode);78 const fd = try os.posixOpen(allocator, path, flags, file_mode);
70 return openHandle(fd);79 return openHandle(fd);
71 } else if (is_windows) {80 } else if (is_windows) {
72 const handle = try os.windowsOpen(allocator, path, windows.GENERIC_WRITE,81 const handle = try os.windowsOpen(
73 windows.FILE_SHARE_WRITE|windows.FILE_SHARE_READ|windows.FILE_SHARE_DELETE,82 allocator,
74 windows.CREATE_NEW, windows.FILE_ATTRIBUTE_NORMAL);83 path,
84 windows.GENERIC_WRITE,
85 windows.FILE_SHARE_WRITE | windows.FILE_SHARE_READ | windows.FILE_SHARE_DELETE,
86 windows.CREATE_NEW,
87 windows.FILE_ATTRIBUTE_NORMAL,
88 );
75 return openHandle(handle);89 return openHandle(handle);
76 } else {90 } else {
77 @compileError("TODO implement openWriteMode for this OS");91 @compileError("TODO implement openWriteMode for this OS");
78 }92 }
79
80 }93 }
8194
82 pub fn openHandle(handle: os.FileHandle) File {95 pub fn openHandle(handle: os.FileHandle) File {
83 return File {96 return File{ .handle = handle };
84 .handle = handle,
85 };
86 }97 }
8798
88 pub fn access(allocator: &mem.Allocator, path: []const u8, file_mode: os.FileMode) !bool {99 pub fn access(allocator: &mem.Allocator, path: []const u8, file_mode: os.FileMode) !bool {
...@@ -217,7 +228,7 @@ pub const File = struct {...@@ -217,7 +228,7 @@ pub const File = struct {
217 return result;228 return result;
218 },229 },
219 Os.windows => {230 Os.windows => {
220 var pos : windows.LARGE_INTEGER = undefined;231 var pos: windows.LARGE_INTEGER = undefined;
221 if (windows.SetFilePointerEx(self.handle, 0, &pos, windows.FILE_CURRENT) == 0) {232 if (windows.SetFilePointerEx(self.handle, 0, &pos, windows.FILE_CURRENT) == 0) {
222 const err = windows.GetLastError();233 const err = windows.GetLastError();
223 return switch (err) {234 return switch (err) {
...@@ -268,7 +279,7 @@ pub const File = struct {...@@ -268,7 +279,7 @@ pub const File = struct {
268 }279 }
269 }280 }
270281
271 pub const ModeError = error {282 pub const ModeError = error{
272 BadFd,283 BadFd,
273 SystemResources,284 SystemResources,
274 Unexpected,285 Unexpected,
...@@ -296,7 +307,7 @@ pub const File = struct {...@@ -296,7 +307,7 @@ pub const File = struct {
296 }307 }
297 }308 }
298309
299 pub const ReadError = error {};310 pub const ReadError = error{};
300311
301 pub fn read(self: &File, buffer: []u8) !usize {312 pub fn read(self: &File, buffer: []u8) !usize {
302 if (is_posix) {313 if (is_posix) {
...@@ -306,12 +317,12 @@ pub const File = struct {...@@ -306,12 +317,12 @@ pub const File = struct {
306 const read_err = posix.getErrno(amt_read);317 const read_err = posix.getErrno(amt_read);
307 if (read_err > 0) {318 if (read_err > 0) {
308 switch (read_err) {319 switch (read_err) {
309 posix.EINTR => continue,320 posix.EINTR => continue,
310 posix.EINVAL => unreachable,321 posix.EINVAL => unreachable,
311 posix.EFAULT => unreachable,322 posix.EFAULT => unreachable,
312 posix.EBADF => return error.BadFd,323 posix.EBADF => return error.BadFd,
313 posix.EIO => return error.Io,324 posix.EIO => return error.Io,
314 else => return os.unexpectedErrorPosix(read_err),325 else => return os.unexpectedErrorPosix(read_err),
315 }326 }
316 }327 }
317 if (amt_read == 0) return index;328 if (amt_read == 0) return index;
std/os/get_user_id.zig+3-3
...@@ -74,7 +74,7 @@ pub fn posixGetUserInfo(name: []const u8) !UserInfo {...@@ -74,7 +74,7 @@ pub fn posixGetUserInfo(name: []const u8) !UserInfo {
74 '\n' => return error.CorruptPasswordFile,74 '\n' => return error.CorruptPasswordFile,
75 else => {75 else => {
76 const digit = switch (byte) {76 const digit = switch (byte) {
77 '0' ... '9' => byte - '0',77 '0'...'9' => byte - '0',
78 else => return error.CorruptPasswordFile,78 else => return error.CorruptPasswordFile,
79 };79 };
80 if (@mulWithOverflow(u32, uid, 10, &uid)) return error.CorruptPasswordFile;80 if (@mulWithOverflow(u32, uid, 10, &uid)) return error.CorruptPasswordFile;
...@@ -83,14 +83,14 @@ pub fn posixGetUserInfo(name: []const u8) !UserInfo {...@@ -83,14 +83,14 @@ pub fn posixGetUserInfo(name: []const u8) !UserInfo {
83 },83 },
84 State.ReadGroupId => switch (byte) {84 State.ReadGroupId => switch (byte) {
85 '\n', ':' => {85 '\n', ':' => {
86 return UserInfo {86 return UserInfo{
87 .uid = uid,87 .uid = uid,
88 .gid = gid,88 .gid = gid,
89 };89 };
90 },90 },
91 else => {91 else => {
92 const digit = switch (byte) {92 const digit = switch (byte) {
93 '0' ... '9' => byte - '0',93 '0'...'9' => byte - '0',
94 else => return error.CorruptPasswordFile,94 else => return error.CorruptPasswordFile,
95 };95 };
96 if (@mulWithOverflow(u32, gid, 10, &gid)) return error.CorruptPasswordFile;96 if (@mulWithOverflow(u32, gid, 10, &gid)) return error.CorruptPasswordFile;
std/os/index.zig+62-106
...@@ -3,8 +3,7 @@ const builtin = @import("builtin");...@@ -3,8 +3,7 @@ const builtin = @import("builtin");
3const Os = builtin.Os;3const Os = builtin.Os;
4const is_windows = builtin.os == Os.windows;4const is_windows = builtin.os == Os.windows;
5const is_posix = switch (builtin.os) {5const is_posix = switch (builtin.os) {
6 builtin.Os.linux,6 builtin.Os.linux, builtin.Os.macosx => true,
7 builtin.Os.macosx => true,
8 else => false,7 else => false,
9};8};
10const os = this;9const os = this;
...@@ -27,8 +26,7 @@ pub const linux = @import("linux/index.zig");...@@ -27,8 +26,7 @@ pub const linux = @import("linux/index.zig");
27pub const zen = @import("zen.zig");26pub const zen = @import("zen.zig");
28pub const posix = switch (builtin.os) {27pub const posix = switch (builtin.os) {
29 Os.linux => linux,28 Os.linux => linux,
30 Os.macosx,29 Os.macosx, Os.ios => darwin,
31 Os.ios => darwin,
32 Os.zen => zen,30 Os.zen => zen,
33 else => @compileError("Unsupported OS"),31 else => @compileError("Unsupported OS"),
34};32};
...@@ -112,8 +110,7 @@ pub fn getRandomBytes(buf: []u8) !void {...@@ -112,8 +110,7 @@ pub fn getRandomBytes(buf: []u8) !void {
112 }110 }
113 return;111 return;
114 },112 },
115 Os.macosx,113 Os.macosx, Os.ios => {
116 Os.ios => {
117 const fd = try posixOpenC(c"/dev/urandom", posix.O_RDONLY | posix.O_CLOEXEC, 0);114 const fd = try posixOpenC(c"/dev/urandom", posix.O_RDONLY | posix.O_CLOEXEC, 0);
118 defer close(fd);115 defer close(fd);
119116
...@@ -175,9 +172,7 @@ pub fn abort() noreturn {...@@ -175,9 +172,7 @@ pub fn abort() noreturn {
175 c.abort();172 c.abort();
176 }173 }
177 switch (builtin.os) {174 switch (builtin.os) {
178 Os.linux,175 Os.linux, Os.macosx, Os.ios => {
179 Os.macosx,
180 Os.ios => {
181 _ = posix.raise(posix.SIGABRT);176 _ = posix.raise(posix.SIGABRT);
182 _ = posix.raise(posix.SIGKILL);177 _ = posix.raise(posix.SIGKILL);
183 while (true) {}178 while (true) {}
...@@ -199,9 +194,7 @@ pub fn exit(status: u8) noreturn {...@@ -199,9 +194,7 @@ pub fn exit(status: u8) noreturn {
199 c.exit(status);194 c.exit(status);
200 }195 }
201 switch (builtin.os) {196 switch (builtin.os) {
202 Os.linux,197 Os.linux, Os.macosx, Os.ios => {
203 Os.macosx,
204 Os.ios => {
205 posix.exit(status);198 posix.exit(status);
206 },199 },
207 Os.windows => {200 Os.windows => {
...@@ -250,14 +243,12 @@ pub fn posixRead(fd: i32, buf: []u8) !void {...@@ -250,14 +243,12 @@ pub fn posixRead(fd: i32, buf: []u8) !void {
250 if (err > 0) {243 if (err > 0) {
251 return switch (err) {244 return switch (err) {
252 posix.EINTR => continue,245 posix.EINTR => continue,
253 posix.EINVAL,246 posix.EINVAL, posix.EFAULT => unreachable,
254 posix.EFAULT => unreachable,
255 posix.EAGAIN => error.WouldBlock,247 posix.EAGAIN => error.WouldBlock,
256 posix.EBADF => error.FileClosed,248 posix.EBADF => error.FileClosed,
257 posix.EIO => error.InputOutput,249 posix.EIO => error.InputOutput,
258 posix.EISDIR => error.IsDir,250 posix.EISDIR => error.IsDir,
259 posix.ENOBUFS,251 posix.ENOBUFS, posix.ENOMEM => error.SystemResources,
260 posix.ENOMEM => error.SystemResources,
261 else => unexpectedErrorPosix(err),252 else => unexpectedErrorPosix(err),
262 };253 };
263 }254 }
...@@ -292,8 +283,7 @@ pub fn posixWrite(fd: i32, bytes: []const u8) !void {...@@ -292,8 +283,7 @@ pub fn posixWrite(fd: i32, bytes: []const u8) !void {
292 if (write_err > 0) {283 if (write_err > 0) {
293 return switch (write_err) {284 return switch (write_err) {
294 posix.EINTR => continue,285 posix.EINTR => continue,
295 posix.EINVAL,286 posix.EINVAL, posix.EFAULT => unreachable,
296 posix.EFAULT => unreachable,
297 posix.EAGAIN => PosixWriteError.WouldBlock,287 posix.EAGAIN => PosixWriteError.WouldBlock,
298 posix.EBADF => PosixWriteError.FileClosed,288 posix.EBADF => PosixWriteError.FileClosed,
299 posix.EDESTADDRREQ => PosixWriteError.DestinationAddressRequired,289 posix.EDESTADDRREQ => PosixWriteError.DestinationAddressRequired,
...@@ -349,8 +339,7 @@ pub fn posixOpenC(file_path: &const u8, flags: u32, perm: usize) !i32 {...@@ -349,8 +339,7 @@ pub fn posixOpenC(file_path: &const u8, flags: u32, perm: usize) !i32 {
349 posix.EFAULT => unreachable,339 posix.EFAULT => unreachable,
350 posix.EINVAL => unreachable,340 posix.EINVAL => unreachable,
351 posix.EACCES => return PosixOpenError.AccessDenied,341 posix.EACCES => return PosixOpenError.AccessDenied,
352 posix.EFBIG,342 posix.EFBIG, posix.EOVERFLOW => return PosixOpenError.FileTooBig,
353 posix.EOVERFLOW => return PosixOpenError.FileTooBig,
354 posix.EISDIR => return PosixOpenError.IsDir,343 posix.EISDIR => return PosixOpenError.IsDir,
355 posix.ELOOP => return PosixOpenError.SymLinkLoop,344 posix.ELOOP => return PosixOpenError.SymLinkLoop,
356 posix.EMFILE => return PosixOpenError.ProcessFdQuotaExceeded,345 posix.EMFILE => return PosixOpenError.ProcessFdQuotaExceeded,
...@@ -375,8 +364,7 @@ pub fn posixDup2(old_fd: i32, new_fd: i32) !void {...@@ -375,8 +364,7 @@ pub fn posixDup2(old_fd: i32, new_fd: i32) !void {
375 const err = posix.getErrno(posix.dup2(old_fd, new_fd));364 const err = posix.getErrno(posix.dup2(old_fd, new_fd));
376 if (err > 0) {365 if (err > 0) {
377 return switch (err) {366 return switch (err) {
378 posix.EBUSY,367 posix.EBUSY, posix.EINTR => continue,
379 posix.EINTR => continue,
380 posix.EMFILE => error.ProcessFdQuotaExceeded,368 posix.EMFILE => error.ProcessFdQuotaExceeded,
381 posix.EINVAL => unreachable,369 posix.EINVAL => unreachable,
382 else => unexpectedErrorPosix(err),370 else => unexpectedErrorPosix(err),
...@@ -493,17 +481,10 @@ fn posixExecveErrnoToErr(err: usize) PosixExecveError {...@@ -493,17 +481,10 @@ fn posixExecveErrnoToErr(err: usize) PosixExecveError {
493 assert(err > 0);481 assert(err > 0);
494 return switch (err) {482 return switch (err) {
495 posix.EFAULT => unreachable,483 posix.EFAULT => unreachable,
496 posix.E2BIG,484 posix.E2BIG, posix.EMFILE, posix.ENAMETOOLONG, posix.ENFILE, posix.ENOMEM => error.SystemResources,
497 posix.EMFILE,485 posix.EACCES, posix.EPERM => error.AccessDenied,
498 posix.ENAMETOOLONG,486 posix.EINVAL, posix.ENOEXEC => error.InvalidExe,
499 posix.ENFILE,487 posix.EIO, posix.ELOOP => error.FileSystem,
500 posix.ENOMEM => error.SystemResources,
501 posix.EACCES,
502 posix.EPERM => error.AccessDenied,
503 posix.EINVAL,
504 posix.ENOEXEC => error.InvalidExe,
505 posix.EIO,
506 posix.ELOOP => error.FileSystem,
507 posix.EISDIR => error.IsDir,488 posix.EISDIR => error.IsDir,
508 posix.ENOENT => error.FileNotFound,489 posix.ENOENT => error.FileNotFound,
509 posix.ENOTDIR => error.NotDir,490 posix.ENOTDIR => error.NotDir,
...@@ -717,10 +698,8 @@ pub fn symLinkPosix(allocator: &Allocator, existing_path: []const u8, new_path:...@@ -717,10 +698,8 @@ pub fn symLinkPosix(allocator: &Allocator, existing_path: []const u8, new_path:
717 const err = posix.getErrno(posix.symlink(existing_buf.ptr, new_buf.ptr));698 const err = posix.getErrno(posix.symlink(existing_buf.ptr, new_buf.ptr));
718 if (err > 0) {699 if (err > 0) {
719 return switch (err) {700 return switch (err) {
720 posix.EFAULT,701 posix.EFAULT, posix.EINVAL => unreachable,
721 posix.EINVAL => unreachable,702 posix.EACCES, posix.EPERM => error.AccessDenied,
722 posix.EACCES,
723 posix.EPERM => error.AccessDenied,
724 posix.EDQUOT => error.DiskQuota,703 posix.EDQUOT => error.DiskQuota,
725 posix.EEXIST => error.PathAlreadyExists,704 posix.EEXIST => error.PathAlreadyExists,
726 posix.EIO => error.FileSystem,705 posix.EIO => error.FileSystem,
...@@ -787,8 +766,7 @@ pub fn deleteFileWindows(allocator: &Allocator, file_path: []const u8) !void {...@@ -787,8 +766,7 @@ pub fn deleteFileWindows(allocator: &Allocator, file_path: []const u8) !void {
787 return switch (err) {766 return switch (err) {
788 windows.ERROR.FILE_NOT_FOUND => error.FileNotFound,767 windows.ERROR.FILE_NOT_FOUND => error.FileNotFound,
789 windows.ERROR.ACCESS_DENIED => error.AccessDenied,768 windows.ERROR.ACCESS_DENIED => error.AccessDenied,
790 windows.ERROR.FILENAME_EXCED_RANGE,769 windows.ERROR.FILENAME_EXCED_RANGE, windows.ERROR.INVALID_PARAMETER => error.NameTooLong,
791 windows.ERROR.INVALID_PARAMETER => error.NameTooLong,
792 else => unexpectedErrorWindows(err),770 else => unexpectedErrorWindows(err),
793 };771 };
794 }772 }
...@@ -804,11 +782,9 @@ pub fn deleteFilePosix(allocator: &Allocator, file_path: []const u8) !void {...@@ -804,11 +782,9 @@ pub fn deleteFilePosix(allocator: &Allocator, file_path: []const u8) !void {
804 const err = posix.getErrno(posix.unlink(buf.ptr));782 const err = posix.getErrno(posix.unlink(buf.ptr));
805 if (err > 0) {783 if (err > 0) {
806 return switch (err) {784 return switch (err) {
807 posix.EACCES,785 posix.EACCES, posix.EPERM => error.AccessDenied,
808 posix.EPERM => error.AccessDenied,
809 posix.EBUSY => error.FileBusy,786 posix.EBUSY => error.FileBusy,
810 posix.EFAULT,787 posix.EFAULT, posix.EINVAL => unreachable,
811 posix.EINVAL => unreachable,
812 posix.EIO => error.FileSystem,788 posix.EIO => error.FileSystem,
813 posix.EISDIR => error.IsDir,789 posix.EISDIR => error.IsDir,
814 posix.ELOOP => error.SymLinkLoop,790 posix.ELOOP => error.SymLinkLoop,
...@@ -948,12 +924,10 @@ pub fn rename(allocator: &Allocator, old_path: []const u8, new_path: []const u8)...@@ -948,12 +924,10 @@ pub fn rename(allocator: &Allocator, old_path: []const u8, new_path: []const u8)
948 const err = posix.getErrno(posix.rename(old_buf.ptr, new_buf.ptr));924 const err = posix.getErrno(posix.rename(old_buf.ptr, new_buf.ptr));
949 if (err > 0) {925 if (err > 0) {
950 return switch (err) {926 return switch (err) {
951 posix.EACCES,927 posix.EACCES, posix.EPERM => error.AccessDenied,
952 posix.EPERM => error.AccessDenied,
953 posix.EBUSY => error.FileBusy,928 posix.EBUSY => error.FileBusy,
954 posix.EDQUOT => error.DiskQuota,929 posix.EDQUOT => error.DiskQuota,
955 posix.EFAULT,930 posix.EFAULT, posix.EINVAL => unreachable,
956 posix.EINVAL => unreachable,
957 posix.EISDIR => error.IsDir,931 posix.EISDIR => error.IsDir,
958 posix.ELOOP => error.SymLinkLoop,932 posix.ELOOP => error.SymLinkLoop,
959 posix.EMLINK => error.LinkQuotaExceeded,933 posix.EMLINK => error.LinkQuotaExceeded,
...@@ -962,8 +936,7 @@ pub fn rename(allocator: &Allocator, old_path: []const u8, new_path: []const u8)...@@ -962,8 +936,7 @@ pub fn rename(allocator: &Allocator, old_path: []const u8, new_path: []const u8)
962 posix.ENOTDIR => error.NotDir,936 posix.ENOTDIR => error.NotDir,
963 posix.ENOMEM => error.SystemResources,937 posix.ENOMEM => error.SystemResources,
964 posix.ENOSPC => error.NoSpaceLeft,938 posix.ENOSPC => error.NoSpaceLeft,
965 posix.EEXIST,939 posix.EEXIST, posix.ENOTEMPTY => error.PathAlreadyExists,
966 posix.ENOTEMPTY => error.PathAlreadyExists,
967 posix.EROFS => error.ReadOnlyFileSystem,940 posix.EROFS => error.ReadOnlyFileSystem,
968 posix.EXDEV => error.RenameAcrossMountPoints,941 posix.EXDEV => error.RenameAcrossMountPoints,
969 else => unexpectedErrorPosix(err),942 else => unexpectedErrorPosix(err),
...@@ -1001,8 +974,7 @@ pub fn makeDirPosix(allocator: &Allocator, dir_path: []const u8) !void {...@@ -1001,8 +974,7 @@ pub fn makeDirPosix(allocator: &Allocator, dir_path: []const u8) !void {
1001 const err = posix.getErrno(posix.mkdir(path_buf.ptr, 0o755));974 const err = posix.getErrno(posix.mkdir(path_buf.ptr, 0o755));
1002 if (err > 0) {975 if (err > 0) {
1003 return switch (err) {976 return switch (err) {
1004 posix.EACCES,977 posix.EACCES, posix.EPERM => error.AccessDenied,
1005 posix.EPERM => error.AccessDenied,
1006 posix.EDQUOT => error.DiskQuota,978 posix.EDQUOT => error.DiskQuota,
1007 posix.EEXIST => error.PathAlreadyExists,979 posix.EEXIST => error.PathAlreadyExists,
1008 posix.EFAULT => unreachable,980 posix.EFAULT => unreachable,
...@@ -1065,18 +1037,15 @@ pub fn deleteDir(allocator: &Allocator, dir_path: []const u8) !void {...@@ -1065,18 +1037,15 @@ pub fn deleteDir(allocator: &Allocator, dir_path: []const u8) !void {
1065 const err = posix.getErrno(posix.rmdir(path_buf.ptr));1037 const err = posix.getErrno(posix.rmdir(path_buf.ptr));
1066 if (err > 0) {1038 if (err > 0) {
1067 return switch (err) {1039 return switch (err) {
1068 posix.EACCES,1040 posix.EACCES, posix.EPERM => error.AccessDenied,
1069 posix.EPERM => error.AccessDenied,
1070 posix.EBUSY => error.FileBusy,1041 posix.EBUSY => error.FileBusy,
1071 posix.EFAULT,1042 posix.EFAULT, posix.EINVAL => unreachable,
1072 posix.EINVAL => unreachable,
1073 posix.ELOOP => error.SymLinkLoop,1043 posix.ELOOP => error.SymLinkLoop,
1074 posix.ENAMETOOLONG => error.NameTooLong,1044 posix.ENAMETOOLONG => error.NameTooLong,
1075 posix.ENOENT => error.FileNotFound,1045 posix.ENOENT => error.FileNotFound,
1076 posix.ENOMEM => error.SystemResources,1046 posix.ENOMEM => error.SystemResources,
1077 posix.ENOTDIR => error.NotDir,1047 posix.ENOTDIR => error.NotDir,
1078 posix.EEXIST,1048 posix.EEXIST, posix.ENOTEMPTY => error.DirNotEmpty,
1079 posix.ENOTEMPTY => error.DirNotEmpty,
1080 posix.EROFS => error.ReadOnlyFileSystem,1049 posix.EROFS => error.ReadOnlyFileSystem,
1081 else => unexpectedErrorPosix(err),1050 else => unexpectedErrorPosix(err),
1082 };1051 };
...@@ -1128,7 +1097,8 @@ pub fn deleteTree(allocator: &Allocator, full_path: []const u8) DeleteTreeError!...@@ -1128,7 +1097,8 @@ pub fn deleteTree(allocator: &Allocator, full_path: []const u8) DeleteTreeError!
1128 error.NotDir,1097 error.NotDir,
1129 error.FileSystem,1098 error.FileSystem,
1130 error.FileBusy,1099 error.FileBusy,
1131 error.Unexpected => return err,1100 error.Unexpected,
1101 => return err,
1132 }1102 }
1133 {1103 {
1134 var dir = Dir.open(allocator, full_path) catch |err| switch (err) {1104 var dir = Dir.open(allocator, full_path) catch |err| switch (err) {
...@@ -1152,7 +1122,8 @@ pub fn deleteTree(allocator: &Allocator, full_path: []const u8) DeleteTreeError!...@@ -1152,7 +1122,8 @@ pub fn deleteTree(allocator: &Allocator, full_path: []const u8) DeleteTreeError!
1152 error.SystemResources,1122 error.SystemResources,
1153 error.NoSpaceLeft,1123 error.NoSpaceLeft,
1154 error.PathAlreadyExists,1124 error.PathAlreadyExists,
1155 error.Unexpected => return err,1125 error.Unexpected,
1126 => return err,
1156 };1127 };
1157 defer dir.close();1128 defer dir.close();
11581129
...@@ -1182,8 +1153,7 @@ pub const Dir = struct {...@@ -1182,8 +1153,7 @@ pub const Dir = struct {
1182 end_index: usize,1153 end_index: usize,
11831154
1184 const darwin_seek_t = switch (builtin.os) {1155 const darwin_seek_t = switch (builtin.os) {
1185 Os.macosx,1156 Os.macosx, Os.ios => i64,
1186 Os.ios => i64,
1187 else => void,1157 else => void,
1188 };1158 };
11891159
...@@ -1208,13 +1178,16 @@ pub const Dir = struct {...@@ -1208,13 +1178,16 @@ pub const Dir = struct {
1208 const fd = switch (builtin.os) {1178 const fd = switch (builtin.os) {
1209 Os.windows => @compileError("TODO support Dir.open for windows"),1179 Os.windows => @compileError("TODO support Dir.open for windows"),
1210 Os.linux => try posixOpen(allocator, dir_path, posix.O_RDONLY | posix.O_DIRECTORY | posix.O_CLOEXEC, 0),1180 Os.linux => try posixOpen(allocator, dir_path, posix.O_RDONLY | posix.O_DIRECTORY | posix.O_CLOEXEC, 0),
1211 Os.macosx,1181 Os.macosx, Os.ios => try posixOpen(
1212 Os.ios => try posixOpen(allocator, dir_path, posix.O_RDONLY | posix.O_NONBLOCK | posix.O_DIRECTORY | posix.O_CLOEXEC, 0),1182 allocator,
1183 dir_path,
1184 posix.O_RDONLY | posix.O_NONBLOCK | posix.O_DIRECTORY | posix.O_CLOEXEC,
1185 0,
1186 ),
1213 else => @compileError("Dir.open is not supported for this platform"),1187 else => @compileError("Dir.open is not supported for this platform"),
1214 };1188 };
1215 const darwin_seek_init = switch (builtin.os) {1189 const darwin_seek_init = switch (builtin.os) {
1216 Os.macosx,1190 Os.macosx, Os.ios => 0,
1217 Os.ios => 0,
1218 else => {},1191 else => {},
1219 };1192 };
1220 return Dir{1193 return Dir{
...@@ -1237,8 +1210,7 @@ pub const Dir = struct {...@@ -1237,8 +1210,7 @@ pub const Dir = struct {
1237 pub fn next(self: &Dir) !?Entry {1210 pub fn next(self: &Dir) !?Entry {
1238 switch (builtin.os) {1211 switch (builtin.os) {
1239 Os.linux => return self.nextLinux(),1212 Os.linux => return self.nextLinux(),
1240 Os.macosx,1213 Os.macosx, Os.ios => return self.nextDarwin(),
1241 Os.ios => return self.nextDarwin(),
1242 Os.windows => return self.nextWindows(),1214 Os.windows => return self.nextWindows(),
1243 else => @compileError("Dir.next not supported on " ++ @tagName(builtin.os)),1215 else => @compileError("Dir.next not supported on " ++ @tagName(builtin.os)),
1244 }1216 }
...@@ -1256,9 +1228,7 @@ pub const Dir = struct {...@@ -1256,9 +1228,7 @@ pub const Dir = struct {
1256 const err = posix.getErrno(result);1228 const err = posix.getErrno(result);
1257 if (err > 0) {1229 if (err > 0) {
1258 switch (err) {1230 switch (err) {
1259 posix.EBADF,1231 posix.EBADF, posix.EFAULT, posix.ENOTDIR => unreachable,
1260 posix.EFAULT,
1261 posix.ENOTDIR => unreachable,
1262 posix.EINVAL => {1232 posix.EINVAL => {
1263 self.buf = try self.allocator.realloc(u8, self.buf, self.buf.len * 2);1233 self.buf = try self.allocator.realloc(u8, self.buf, self.buf.len * 2);
1264 continue;1234 continue;
...@@ -1317,9 +1287,7 @@ pub const Dir = struct {...@@ -1317,9 +1287,7 @@ pub const Dir = struct {
1317 const err = posix.getErrno(result);1287 const err = posix.getErrno(result);
1318 if (err > 0) {1288 if (err > 0) {
1319 switch (err) {1289 switch (err) {
1320 posix.EBADF,1290 posix.EBADF, posix.EFAULT, posix.ENOTDIR => unreachable,
1321 posix.EFAULT,
1322 posix.ENOTDIR => unreachable,
1323 posix.EINVAL => {1291 posix.EINVAL => {
1324 self.buf = try self.allocator.realloc(u8, self.buf, self.buf.len * 2);1292 self.buf = try self.allocator.realloc(u8, self.buf, self.buf.len * 2);
1325 continue;1293 continue;
...@@ -1402,8 +1370,7 @@ pub fn readLink(allocator: &Allocator, pathname: []const u8) ![]u8 {...@@ -1402,8 +1370,7 @@ pub fn readLink(allocator: &Allocator, pathname: []const u8) ![]u8 {
1402 if (err > 0) {1370 if (err > 0) {
1403 return switch (err) {1371 return switch (err) {
1404 posix.EACCES => error.AccessDenied,1372 posix.EACCES => error.AccessDenied,
1405 posix.EFAULT,1373 posix.EFAULT, posix.EINVAL => unreachable,
1406 posix.EINVAL => unreachable,
1407 posix.EIO => error.FileSystem,1374 posix.EIO => error.FileSystem,
1408 posix.ELOOP => error.SymLinkLoop,1375 posix.ELOOP => error.SymLinkLoop,
1409 posix.ENAMETOOLONG => error.NameTooLong,1376 posix.ENAMETOOLONG => error.NameTooLong,
...@@ -1545,8 +1512,7 @@ pub const ArgIteratorWindows = struct {...@@ -1545,8 +1512,7 @@ pub const ArgIteratorWindows = struct {
1545 const byte = self.cmd_line[self.index];1512 const byte = self.cmd_line[self.index];
1546 switch (byte) {1513 switch (byte) {
1547 0 => return null,1514 0 => return null,
1548 ' ',1515 ' ', '\t' => continue,
1549 '\t' => continue,
1550 else => break,1516 else => break,
1551 }1517 }
1552 }1518 }
...@@ -1560,8 +1526,7 @@ pub const ArgIteratorWindows = struct {...@@ -1560,8 +1526,7 @@ pub const ArgIteratorWindows = struct {
1560 const byte = self.cmd_line[self.index];1526 const byte = self.cmd_line[self.index];
1561 switch (byte) {1527 switch (byte) {
1562 0 => return false,1528 0 => return false,
1563 ' ',1529 ' ', '\t' => continue,
1564 '\t' => continue,
1565 else => break,1530 else => break,
1566 }1531 }
1567 }1532 }
...@@ -1580,8 +1545,7 @@ pub const ArgIteratorWindows = struct {...@@ -1580,8 +1545,7 @@ pub const ArgIteratorWindows = struct {
1580 '\\' => {1545 '\\' => {
1581 backslash_count += 1;1546 backslash_count += 1;
1582 },1547 },
1583 ' ',1548 ' ', '\t' => {
1584 '\t' => {
1585 if (self.seen_quote_count % 2 == 0 or self.seen_quote_count == self.quote_count) {1549 if (self.seen_quote_count % 2 == 0 or self.seen_quote_count == self.quote_count) {
1586 return true;1550 return true;
1587 }1551 }
...@@ -1621,8 +1585,7 @@ pub const ArgIteratorWindows = struct {...@@ -1621,8 +1585,7 @@ pub const ArgIteratorWindows = struct {
1621 '\\' => {1585 '\\' => {
1622 backslash_count += 1;1586 backslash_count += 1;
1623 },1587 },
1624 ' ',1588 ' ', '\t' => {
1625 '\t' => {
1626 try self.emitBackslashes(&buf, backslash_count);1589 try self.emitBackslashes(&buf, backslash_count);
1627 backslash_count = 0;1590 backslash_count = 0;
1628 if (self.seen_quote_count % 2 == 1 and self.seen_quote_count != self.quote_count) {1591 if (self.seen_quote_count % 2 == 1 and self.seen_quote_count != self.quote_count) {
...@@ -1840,8 +1803,7 @@ pub fn openSelfExe() !os.File {...@@ -1840,8 +1803,7 @@ pub fn openSelfExe() !os.File {
1840 var fixed_allocator = std.heap.FixedBufferAllocator.init(fixed_buffer_mem[0..]);1803 var fixed_allocator = std.heap.FixedBufferAllocator.init(fixed_buffer_mem[0..]);
1841 return os.File.openRead(&fixed_allocator.allocator, proc_file_path);1804 return os.File.openRead(&fixed_allocator.allocator, proc_file_path);
1842 },1805 },
1843 Os.macosx,1806 Os.macosx, Os.ios => {
1844 Os.ios => {
1845 var fixed_buffer_mem: [darwin.PATH_MAX * 2]u8 = undefined;1807 var fixed_buffer_mem: [darwin.PATH_MAX * 2]u8 = undefined;
1846 var fixed_allocator = std.heap.FixedBufferAllocator.init(fixed_buffer_mem[0..]);1808 var fixed_allocator = std.heap.FixedBufferAllocator.init(fixed_buffer_mem[0..]);
1847 const self_exe_path = try selfExePath(&fixed_allocator.allocator);1809 const self_exe_path = try selfExePath(&fixed_allocator.allocator);
...@@ -1853,9 +1815,7 @@ pub fn openSelfExe() !os.File {...@@ -1853,9 +1815,7 @@ pub fn openSelfExe() !os.File {
18531815
1854test "openSelfExe" {1816test "openSelfExe" {
1855 switch (builtin.os) {1817 switch (builtin.os) {
1856 Os.linux,1818 Os.linux, Os.macosx, Os.ios => (try openSelfExe()).close(),
1857 Os.macosx,
1858 Os.ios => (try openSelfExe()).close(),
1859 else => return, // Unsupported OS.1819 else => return, // Unsupported OS.
1860 }1820 }
1861}1821}
...@@ -1893,8 +1853,7 @@ pub fn selfExePath(allocator: &mem.Allocator) ![]u8 {...@@ -1893,8 +1853,7 @@ pub fn selfExePath(allocator: &mem.Allocator) ![]u8 {
1893 try out_path.resize(new_len);1853 try out_path.resize(new_len);
1894 }1854 }
1895 },1855 },
1896 Os.macosx,1856 Os.macosx, Os.ios => {
1897 Os.ios => {
1898 var u32_len: u32 = 0;1857 var u32_len: u32 = 0;
1899 const ret1 = c._NSGetExecutablePath(undefined, &u32_len);1858 const ret1 = c._NSGetExecutablePath(undefined, &u32_len);
1900 assert(ret1 != 0);1859 assert(ret1 != 0);
...@@ -1922,9 +1881,7 @@ pub fn selfExeDirPath(allocator: &mem.Allocator) ![]u8 {...@@ -1922,9 +1881,7 @@ pub fn selfExeDirPath(allocator: &mem.Allocator) ![]u8 {
1922 const dir = path.dirname(full_exe_path);1881 const dir = path.dirname(full_exe_path);
1923 return allocator.shrink(u8, full_exe_path, dir.len);1882 return allocator.shrink(u8, full_exe_path, dir.len);
1924 },1883 },
1925 Os.windows,1884 Os.windows, Os.macosx, Os.ios => {
1926 Os.macosx,
1927 Os.ios => {
1928 const self_exe_path = try selfExePath(allocator);1885 const self_exe_path = try selfExePath(allocator);
1929 errdefer allocator.free(self_exe_path);1886 errdefer allocator.free(self_exe_path);
1930 const dirname = os.path.dirname(self_exe_path);1887 const dirname = os.path.dirname(self_exe_path);
...@@ -1981,8 +1938,7 @@ pub fn posixSocket(domain: u32, socket_type: u32, protocol: u32) !i32 {...@@ -1981,8 +1938,7 @@ pub fn posixSocket(domain: u32, socket_type: u32, protocol: u32) !i32 {
1981 posix.EINVAL => return PosixSocketError.ProtocolFamilyNotAvailable,1938 posix.EINVAL => return PosixSocketError.ProtocolFamilyNotAvailable,
1982 posix.EMFILE => return PosixSocketError.ProcessFdQuotaExceeded,1939 posix.EMFILE => return PosixSocketError.ProcessFdQuotaExceeded,
1983 posix.ENFILE => return PosixSocketError.SystemFdQuotaExceeded,1940 posix.ENFILE => return PosixSocketError.SystemFdQuotaExceeded,
1984 posix.ENOBUFS,1941 posix.ENOBUFS, posix.ENOMEM => return PosixSocketError.SystemResources,
1985 posix.ENOMEM => return PosixSocketError.SystemResources,
1986 posix.EPROTONOSUPPORT => return PosixSocketError.ProtocolNotSupported,1942 posix.EPROTONOSUPPORT => return PosixSocketError.ProtocolNotSupported,
1987 else => return unexpectedErrorPosix(err),1943 else => return unexpectedErrorPosix(err),
1988 }1944 }
...@@ -1990,7 +1946,7 @@ pub fn posixSocket(domain: u32, socket_type: u32, protocol: u32) !i32 {...@@ -1990,7 +1946,7 @@ pub fn posixSocket(domain: u32, socket_type: u32, protocol: u32) !i32 {
19901946
1991pub const PosixBindError = error{1947pub const PosixBindError = error{
1992 /// The address is protected, and the user is not the superuser.1948 /// The address is protected, and the user is not the superuser.
1993 /// For UNIX domain sockets: Search permission is denied on a component 1949 /// For UNIX domain sockets: Search permission is denied on a component
1994 /// of the path prefix.1950 /// of the path prefix.
1995 AccessDenied,1951 AccessDenied,
19961952
...@@ -2151,8 +2107,7 @@ pub fn posixAccept(fd: i32, addr: &posix.sockaddr, flags: u32) PosixAcceptError!...@@ -2151,8 +2107,7 @@ pub fn posixAccept(fd: i32, addr: &posix.sockaddr, flags: u32) PosixAcceptError!
2151 posix.EINVAL => return PosixAcceptError.InvalidSyscall,2107 posix.EINVAL => return PosixAcceptError.InvalidSyscall,
2152 posix.EMFILE => return PosixAcceptError.ProcessFdQuotaExceeded,2108 posix.EMFILE => return PosixAcceptError.ProcessFdQuotaExceeded,
2153 posix.ENFILE => return PosixAcceptError.SystemFdQuotaExceeded,2109 posix.ENFILE => return PosixAcceptError.SystemFdQuotaExceeded,
2154 posix.ENOBUFS,2110 posix.ENOBUFS, posix.ENOMEM => return PosixAcceptError.SystemResources,
2155 posix.ENOMEM => return PosixAcceptError.SystemResources,
2156 posix.ENOTSOCK => return PosixAcceptError.FileDescriptorNotASocket,2111 posix.ENOTSOCK => return PosixAcceptError.FileDescriptorNotASocket,
2157 posix.EOPNOTSUPP => return PosixAcceptError.OperationNotSupported,2112 posix.EOPNOTSUPP => return PosixAcceptError.OperationNotSupported,
2158 posix.EPROTO => return PosixAcceptError.ProtocolFailure,2113 posix.EPROTO => return PosixAcceptError.ProtocolFailure,
...@@ -2363,8 +2318,7 @@ pub fn posixConnectAsync(sockfd: i32, sockaddr: &const posix.sockaddr) PosixConn...@@ -2363,8 +2318,7 @@ pub fn posixConnectAsync(sockfd: i32, sockaddr: &const posix.sockaddr) PosixConn
2363 const rc = posix.connect(sockfd, sockaddr, @sizeOf(posix.sockaddr));2318 const rc = posix.connect(sockfd, sockaddr, @sizeOf(posix.sockaddr));
2364 const err = posix.getErrno(rc);2319 const err = posix.getErrno(rc);
2365 switch (err) {2320 switch (err) {
2366 0,2321 0, posix.EINPROGRESS => return,
2367 posix.EINPROGRESS => return,
2368 else => return unexpectedErrorPosix(err),2322 else => return unexpectedErrorPosix(err),
23692323
2370 posix.EACCES => return PosixConnectError.PermissionDenied,2324 posix.EACCES => return PosixConnectError.PermissionDenied,
...@@ -2416,7 +2370,7 @@ pub fn posixGetSockOptConnectError(sockfd: i32) PosixConnectError!void {...@@ -2416,7 +2370,7 @@ pub fn posixGetSockOptConnectError(sockfd: i32) PosixConnectError!void {
2416 },2370 },
2417 else => return unexpectedErrorPosix(err),2371 else => return unexpectedErrorPosix(err),
2418 posix.EBADF => unreachable, // The argument sockfd is not a valid file descriptor.2372 posix.EBADF => unreachable, // The argument sockfd is not a valid file descriptor.
2419 posix.EFAULT => unreachable, // The address pointed to by optval or optlen is not in a valid part of the process address space. 2373 posix.EFAULT => unreachable, // The address pointed to by optval or optlen is not in a valid part of the process address space.
2420 posix.EINVAL => unreachable,2374 posix.EINVAL => unreachable,
2421 posix.ENOPROTOOPT => unreachable, // The option is unknown at the level indicated.2375 posix.ENOPROTOOPT => unreachable, // The option is unknown at the level indicated.
2422 posix.ENOTSOCK => unreachable, // The file descriptor sockfd does not refer to a socket.2376 posix.ENOTSOCK => unreachable, // The file descriptor sockfd does not refer to a socket.
...@@ -2427,11 +2381,13 @@ pub const Thread = struct {...@@ -2427,11 +2381,13 @@ pub const Thread = struct {
2427 data: Data,2381 data: Data,
24282382
2429 pub const use_pthreads = is_posix and builtin.link_libc;2383 pub const use_pthreads = is_posix and builtin.link_libc;
2430 const Data = if (use_pthreads) struct {2384 const Data = if (use_pthreads)
2431 handle: c.pthread_t,2385 struct {
2432 stack_addr: usize,2386 handle: c.pthread_t,
2433 stack_len: usize,2387 stack_addr: usize,
2434 } else switch (builtin.os) {2388 stack_len: usize,
2389 }
2390 else switch (builtin.os) {
2435 builtin.Os.linux => struct {2391 builtin.Os.linux => struct {
2436 pid: i32,2392 pid: i32,
2437 stack_addr: usize,2393 stack_addr: usize,
std/os/linux/errno.zig+425-144
...@@ -1,146 +1,427 @@...@@ -1,146 +1,427 @@
1pub const EPERM = 1; /// Operation not permitted1/// Operation not permitted
2pub const ENOENT = 2; /// No such file or directory2pub const EPERM = 1;
3pub const ESRCH = 3; /// No such process3
4pub const EINTR = 4; /// Interrupted system call4/// No such file or directory
5pub const EIO = 5; /// I/O error5pub const ENOENT = 2;
6pub const ENXIO = 6; /// No such device or address6
7pub const E2BIG = 7; /// Arg list too long7/// No such process
8pub const ENOEXEC = 8; /// Exec format error8pub const ESRCH = 3;
9pub const EBADF = 9; /// Bad file number9
10pub const ECHILD = 10; /// No child processes10/// Interrupted system call
11pub const EAGAIN = 11; /// Try again11pub const EINTR = 4;
12pub const ENOMEM = 12; /// Out of memory12
13pub const EACCES = 13; /// Permission denied13/// I/O error
14pub const EFAULT = 14; /// Bad address14pub const EIO = 5;
15pub const ENOTBLK = 15; /// Block device required15
16pub const EBUSY = 16; /// Device or resource busy16/// No such device or address
17pub const EEXIST = 17; /// File exists17pub const ENXIO = 6;
18pub const EXDEV = 18; /// Cross-device link18
19pub const ENODEV = 19; /// No such device19/// Arg list too long
20pub const ENOTDIR = 20; /// Not a directory20pub const E2BIG = 7;
21pub const EISDIR = 21; /// Is a directory21
22pub const EINVAL = 22; /// Invalid argument22/// Exec format error
23pub const ENFILE = 23; /// File table overflow23pub const ENOEXEC = 8;
24pub const EMFILE = 24; /// Too many open files24
25pub const ENOTTY = 25; /// Not a typewriter25/// Bad file number
26pub const ETXTBSY = 26; /// Text file busy26pub const EBADF = 9;
27pub const EFBIG = 27; /// File too large27
28pub const ENOSPC = 28; /// No space left on device28/// No child processes
29pub const ESPIPE = 29; /// Illegal seek29pub const ECHILD = 10;
30pub const EROFS = 30; /// Read-only file system30
31pub const EMLINK = 31; /// Too many links31/// Try again
32pub const EPIPE = 32; /// Broken pipe32pub const EAGAIN = 11;
33pub const EDOM = 33; /// Math argument out of domain of func33
34pub const ERANGE = 34; /// Math result not representable34/// Out of memory
35pub const EDEADLK = 35; /// Resource deadlock would occur35pub const ENOMEM = 12;
36pub const ENAMETOOLONG = 36; /// File name too long36
37pub const ENOLCK = 37; /// No record locks available37/// Permission denied
38pub const ENOSYS = 38; /// Function not implemented38pub const EACCES = 13;
39pub const ENOTEMPTY = 39; /// Directory not empty39
40pub const ELOOP = 40; /// Too many symbolic links encountered40/// Bad address
41pub const EWOULDBLOCK = EAGAIN; /// Operation would block41pub const EFAULT = 14;
42pub const ENOMSG = 42; /// No message of desired type42
43pub const EIDRM = 43; /// Identifier removed43/// Block device required
44pub const ECHRNG = 44; /// Channel number out of range44pub const ENOTBLK = 15;
45pub const EL2NSYNC = 45; /// Level 2 not synchronized45
46pub const EL3HLT = 46; /// Level 3 halted46/// Device or resource busy
47pub const EL3RST = 47; /// Level 3 reset47pub const EBUSY = 16;
48pub const ELNRNG = 48; /// Link number out of range48
49pub const EUNATCH = 49; /// Protocol driver not attached49/// File exists
50pub const ENOCSI = 50; /// No CSI structure available50pub const EEXIST = 17;
51pub const EL2HLT = 51; /// Level 2 halted51
52pub const EBADE = 52; /// Invalid exchange52/// Cross-device link
53pub const EBADR = 53; /// Invalid request descriptor53pub const EXDEV = 18;
54pub const EXFULL = 54; /// Exchange full54
55pub const ENOANO = 55; /// No anode55/// No such device
56pub const EBADRQC = 56; /// Invalid request code56pub const ENODEV = 19;
57pub const EBADSLT = 57; /// Invalid slot57
5858/// Not a directory
59pub const EBFONT = 59; /// Bad font file format59pub const ENOTDIR = 20;
60pub const ENOSTR = 60; /// Device not a stream60
61pub const ENODATA = 61; /// No data available61/// Is a directory
62pub const ETIME = 62; /// Timer expired62pub const EISDIR = 21;
63pub const ENOSR = 63; /// Out of streams resources63
64pub const ENONET = 64; /// Machine is not on the network64/// Invalid argument
65pub const ENOPKG = 65; /// Package not installed65pub const EINVAL = 22;
66pub const EREMOTE = 66; /// Object is remote66
67pub const ENOLINK = 67; /// Link has been severed67/// File table overflow
68pub const EADV = 68; /// Advertise error68pub const ENFILE = 23;
69pub const ESRMNT = 69; /// Srmount error69
70pub const ECOMM = 70; /// Communication error on send70/// Too many open files
71pub const EPROTO = 71; /// Protocol error71pub const EMFILE = 24;
72pub const EMULTIHOP = 72; /// Multihop attempted72
73pub const EDOTDOT = 73; /// RFS specific error73/// Not a typewriter
74pub const EBADMSG = 74; /// Not a data message74pub const ENOTTY = 25;
75pub const EOVERFLOW = 75; /// Value too large for defined data type75
76pub const ENOTUNIQ = 76; /// Name not unique on network76/// Text file busy
77pub const EBADFD = 77; /// File descriptor in bad state77pub const ETXTBSY = 26;
78pub const EREMCHG = 78; /// Remote address changed78
79pub const ELIBACC = 79; /// Can not access a needed shared library79/// File too large
80pub const ELIBBAD = 80; /// Accessing a corrupted shared library80pub const EFBIG = 27;
81pub const ELIBSCN = 81; /// .lib section in a.out corrupted81
82pub const ELIBMAX = 82; /// Attempting to link in too many shared libraries82/// No space left on device
83pub const ELIBEXEC = 83; /// Cannot exec a shared library directly83pub const ENOSPC = 28;
84pub const EILSEQ = 84; /// Illegal byte sequence84
85pub const ERESTART = 85; /// Interrupted system call should be restarted85/// Illegal seek
86pub const ESTRPIPE = 86; /// Streams pipe error86pub const ESPIPE = 29;
87pub const EUSERS = 87; /// Too many users87
88pub const ENOTSOCK = 88; /// Socket operation on non-socket88/// Read-only file system
89pub const EDESTADDRREQ = 89; /// Destination address required89pub const EROFS = 30;
90pub const EMSGSIZE = 90; /// Message too long90
91pub const EPROTOTYPE = 91; /// Protocol wrong type for socket91/// Too many links
92pub const ENOPROTOOPT = 92; /// Protocol not available92pub const EMLINK = 31;
93pub const EPROTONOSUPPORT = 93; /// Protocol not supported93
94pub const ESOCKTNOSUPPORT = 94; /// Socket type not supported94/// Broken pipe
95pub const EOPNOTSUPP = 95; /// Operation not supported on transport endpoint95pub const EPIPE = 32;
96pub const EPFNOSUPPORT = 96; /// Protocol family not supported96
97pub const EAFNOSUPPORT = 97; /// Address family not supported by protocol97/// Math argument out of domain of func
98pub const EADDRINUSE = 98; /// Address already in use98pub const EDOM = 33;
99pub const EADDRNOTAVAIL = 99; /// Cannot assign requested address99
100pub const ENETDOWN = 100; /// Network is down100/// Math result not representable
101pub const ENETUNREACH = 101; /// Network is unreachable101pub const ERANGE = 34;
102pub const ENETRESET = 102; /// Network dropped connection because of reset102
103pub const ECONNABORTED = 103; /// Software caused connection abort103/// Resource deadlock would occur
104pub const ECONNRESET = 104; /// Connection reset by peer104pub const EDEADLK = 35;
105pub const ENOBUFS = 105; /// No buffer space available105
106pub const EISCONN = 106; /// Transport endpoint is already connected106/// File name too long
107pub const ENOTCONN = 107; /// Transport endpoint is not connected107pub const ENAMETOOLONG = 36;
108pub const ESHUTDOWN = 108; /// Cannot send after transport endpoint shutdown108
109pub const ETOOMANYREFS = 109; /// Too many references: cannot splice109/// No record locks available
110pub const ETIMEDOUT = 110; /// Connection timed out110pub const ENOLCK = 37;
111pub const ECONNREFUSED = 111; /// Connection refused111
112pub const EHOSTDOWN = 112; /// Host is down112/// Function not implemented
113pub const EHOSTUNREACH = 113; /// No route to host113pub const ENOSYS = 38;
114pub const EALREADY = 114; /// Operation already in progress114
115pub const EINPROGRESS = 115; /// Operation now in progress115/// Directory not empty
116pub const ESTALE = 116; /// Stale NFS file handle116pub const ENOTEMPTY = 39;
117pub const EUCLEAN = 117; /// Structure needs cleaning117
118pub const ENOTNAM = 118; /// Not a XENIX named type file118/// Too many symbolic links encountered
119pub const ENAVAIL = 119; /// No XENIX semaphores available119pub const ELOOP = 40;
120pub const EISNAM = 120; /// Is a named type file120
121pub const EREMOTEIO = 121; /// Remote I/O error121/// Operation would block
122pub const EDQUOT = 122; /// Quota exceeded122pub const EWOULDBLOCK = EAGAIN;
123123
124pub const ENOMEDIUM = 123; /// No medium found124/// No message of desired type
125pub const EMEDIUMTYPE = 124; /// Wrong medium type125pub const ENOMSG = 42;
126
127/// Identifier removed
128pub const EIDRM = 43;
129
130/// Channel number out of range
131pub const ECHRNG = 44;
132
133/// Level 2 not synchronized
134pub const EL2NSYNC = 45;
135
136/// Level 3 halted
137pub const EL3HLT = 46;
138
139/// Level 3 reset
140pub const EL3RST = 47;
141
142/// Link number out of range
143pub const ELNRNG = 48;
144
145/// Protocol driver not attached
146pub const EUNATCH = 49;
147
148/// No CSI structure available
149pub const ENOCSI = 50;
150
151/// Level 2 halted
152pub const EL2HLT = 51;
153
154/// Invalid exchange
155pub const EBADE = 52;
156
157/// Invalid request descriptor
158pub const EBADR = 53;
159
160/// Exchange full
161pub const EXFULL = 54;
162
163/// No anode
164pub const ENOANO = 55;
165
166/// Invalid request code
167pub const EBADRQC = 56;
168
169/// Invalid slot
170pub const EBADSLT = 57;
171
172/// Bad font file format
173pub const EBFONT = 59;
174
175/// Device not a stream
176pub const ENOSTR = 60;
177
178/// No data available
179pub const ENODATA = 61;
180
181/// Timer expired
182pub const ETIME = 62;
183
184/// Out of streams resources
185pub const ENOSR = 63;
186
187/// Machine is not on the network
188pub const ENONET = 64;
189
190/// Package not installed
191pub const ENOPKG = 65;
192
193/// Object is remote
194pub const EREMOTE = 66;
195
196/// Link has been severed
197pub const ENOLINK = 67;
198
199/// Advertise error
200pub const EADV = 68;
201
202/// Srmount error
203pub const ESRMNT = 69;
204
205/// Communication error on send
206pub const ECOMM = 70;
207
208/// Protocol error
209pub const EPROTO = 71;
210
211/// Multihop attempted
212pub const EMULTIHOP = 72;
213
214/// RFS specific error
215pub const EDOTDOT = 73;
216
217/// Not a data message
218pub const EBADMSG = 74;
219
220/// Value too large for defined data type
221pub const EOVERFLOW = 75;
222
223/// Name not unique on network
224pub const ENOTUNIQ = 76;
225
226/// File descriptor in bad state
227pub const EBADFD = 77;
228
229/// Remote address changed
230pub const EREMCHG = 78;
231
232/// Can not access a needed shared library
233pub const ELIBACC = 79;
234
235/// Accessing a corrupted shared library
236pub const ELIBBAD = 80;
237
238/// .lib section in a.out corrupted
239pub const ELIBSCN = 81;
240
241/// Attempting to link in too many shared libraries
242pub const ELIBMAX = 82;
243
244/// Cannot exec a shared library directly
245pub const ELIBEXEC = 83;
246
247/// Illegal byte sequence
248pub const EILSEQ = 84;
249
250/// Interrupted system call should be restarted
251pub const ERESTART = 85;
252
253/// Streams pipe error
254pub const ESTRPIPE = 86;
255
256/// Too many users
257pub const EUSERS = 87;
258
259/// Socket operation on non-socket
260pub const ENOTSOCK = 88;
261
262/// Destination address required
263pub const EDESTADDRREQ = 89;
264
265/// Message too long
266pub const EMSGSIZE = 90;
267
268/// Protocol wrong type for socket
269pub const EPROTOTYPE = 91;
270
271/// Protocol not available
272pub const ENOPROTOOPT = 92;
273
274/// Protocol not supported
275pub const EPROTONOSUPPORT = 93;
276
277/// Socket type not supported
278pub const ESOCKTNOSUPPORT = 94;
279
280/// Operation not supported on transport endpoint
281pub const EOPNOTSUPP = 95;
282
283/// Protocol family not supported
284pub const EPFNOSUPPORT = 96;
285
286/// Address family not supported by protocol
287pub const EAFNOSUPPORT = 97;
288
289/// Address already in use
290pub const EADDRINUSE = 98;
291
292/// Cannot assign requested address
293pub const EADDRNOTAVAIL = 99;
294
295/// Network is down
296pub const ENETDOWN = 100;
297
298/// Network is unreachable
299pub const ENETUNREACH = 101;
300
301/// Network dropped connection because of reset
302pub const ENETRESET = 102;
303
304/// Software caused connection abort
305pub const ECONNABORTED = 103;
306
307/// Connection reset by peer
308pub const ECONNRESET = 104;
309
310/// No buffer space available
311pub const ENOBUFS = 105;
312
313/// Transport endpoint is already connected
314pub const EISCONN = 106;
315
316/// Transport endpoint is not connected
317pub const ENOTCONN = 107;
318
319/// Cannot send after transport endpoint shutdown
320pub const ESHUTDOWN = 108;
321
322/// Too many references: cannot splice
323pub const ETOOMANYREFS = 109;
324
325/// Connection timed out
326pub const ETIMEDOUT = 110;
327
328/// Connection refused
329pub const ECONNREFUSED = 111;
330
331/// Host is down
332pub const EHOSTDOWN = 112;
333
334/// No route to host
335pub const EHOSTUNREACH = 113;
336
337/// Operation already in progress
338pub const EALREADY = 114;
339
340/// Operation now in progress
341pub const EINPROGRESS = 115;
342
343/// Stale NFS file handle
344pub const ESTALE = 116;
345
346/// Structure needs cleaning
347pub const EUCLEAN = 117;
348
349/// Not a XENIX named type file
350pub const ENOTNAM = 118;
351
352/// No XENIX semaphores available
353pub const ENAVAIL = 119;
354
355/// Is a named type file
356pub const EISNAM = 120;
357
358/// Remote I/O error
359pub const EREMOTEIO = 121;
360
361/// Quota exceeded
362pub const EDQUOT = 122;
363
364/// No medium found
365pub const ENOMEDIUM = 123;
366
367/// Wrong medium type
368pub const EMEDIUMTYPE = 124;
126369
127// nameserver query return codes370// nameserver query return codes
128pub const ENSROK = 0; /// DNS server returned answer with no data371
129pub const ENSRNODATA = 160; /// DNS server returned answer with no data372/// DNS server returned answer with no data
130pub const ENSRFORMERR = 161; /// DNS server claims query was misformatted373pub const ENSROK = 0;
131pub const ENSRSERVFAIL = 162; /// DNS server returned general failure374
132pub const ENSRNOTFOUND = 163; /// Domain name not found375/// DNS server returned answer with no data
133pub const ENSRNOTIMP = 164; /// DNS server does not implement requested operation376pub const ENSRNODATA = 160;
134pub const ENSRREFUSED = 165; /// DNS server refused query377
135pub const ENSRBADQUERY = 166; /// Misformatted DNS query378/// DNS server claims query was misformatted
136pub const ENSRBADNAME = 167; /// Misformatted domain name379pub const ENSRFORMERR = 161;
137pub const ENSRBADFAMILY = 168; /// Unsupported address family380
138pub const ENSRBADRESP = 169; /// Misformatted DNS reply381/// DNS server returned general failure
139pub const ENSRCONNREFUSED = 170; /// Could not contact DNS servers382pub const ENSRSERVFAIL = 162;
140pub const ENSRTIMEOUT = 171; /// Timeout while contacting DNS servers383
141pub const ENSROF = 172; /// End of file384/// Domain name not found
142pub const ENSRFILE = 173; /// Error reading file385pub const ENSRNOTFOUND = 163;
143pub const ENSRNOMEM = 174; /// Out of memory386
144pub const ENSRDESTRUCTION = 175; /// Application terminated lookup387/// DNS server does not implement requested operation
145pub const ENSRQUERYDOMAINTOOLONG = 176; /// Domain name is too long388pub const ENSRNOTIMP = 164;
146pub const ENSRCNAMELOOP = 177; /// Domain name is too long389
390/// DNS server refused query
391pub const ENSRREFUSED = 165;
392
393/// Misformatted DNS query
394pub const ENSRBADQUERY = 166;
395
396/// Misformatted domain name
397pub const ENSRBADNAME = 167;
398
399/// Unsupported address family
400pub const ENSRBADFAMILY = 168;
401
402/// Misformatted DNS reply
403pub const ENSRBADRESP = 169;
404
405/// Could not contact DNS servers
406pub const ENSRCONNREFUSED = 170;
407
408/// Timeout while contacting DNS servers
409pub const ENSRTIMEOUT = 171;
410
411/// End of file
412pub const ENSROF = 172;
413
414/// Error reading file
415pub const ENSRFILE = 173;
416
417/// Out of memory
418pub const ENSRNOMEM = 174;
419
420/// Application terminated lookup
421pub const ENSRDESTRUCTION = 175;
422
423/// Domain name is too long
424pub const ENSRQUERYDOMAINTOOLONG = 176;
425
426/// Domain name is too long
427pub const ENSRCNAMELOOP = 177;
std/os/linux/index.zig+1-2
...@@ -823,8 +823,7 @@ pub fn clock_gettime(clk_id: i32, tp: &timespec) usize {...@@ -823,8 +823,7 @@ pub fn clock_gettime(clk_id: i32, tp: &timespec) usize {
823 if (@ptrToInt(f) != 0) {823 if (@ptrToInt(f) != 0) {
824 const rc = f(clk_id, tp);824 const rc = f(clk_id, tp);
825 switch (rc) {825 switch (rc) {
826 0,826 0, @bitCast(usize, isize(-EINVAL)) => return rc,
827 @bitCast(usize, isize(-EINVAL)) => return rc,
828 else => {},827 else => {},
829 }828 }
830 }829 }
std/os/linux/test.zig+6-6
...@@ -11,22 +11,22 @@ test "timer" {...@@ -11,22 +11,22 @@ test "timer" {
11 const timer_fd = linux.timerfd_create(linux.CLOCK_MONOTONIC, 0);11 const timer_fd = linux.timerfd_create(linux.CLOCK_MONOTONIC, 0);
12 assert(linux.getErrno(timer_fd) == 0);12 assert(linux.getErrno(timer_fd) == 0);
1313
14 const time_interval = linux.timespec {14 const time_interval = linux.timespec{
15 .tv_sec = 0,15 .tv_sec = 0,
16 .tv_nsec = 200000016 .tv_nsec = 2000000,
17 };17 };
1818
19 const new_time = linux.itimerspec {19 const new_time = linux.itimerspec{
20 .it_interval = time_interval,20 .it_interval = time_interval,
21 .it_value = time_interval21 .it_value = time_interval,
22 };22 };
2323
24 err = linux.timerfd_settime(i32(timer_fd), 0, &new_time, null);24 err = linux.timerfd_settime(i32(timer_fd), 0, &new_time, null);
25 assert(err == 0);25 assert(err == 0);
2626
27 var event = linux.epoll_event {27 var event = linux.epoll_event{
28 .events = linux.EPOLLIN | linux.EPOLLOUT | linux.EPOLLET,28 .events = linux.EPOLLIN | linux.EPOLLOUT | linux.EPOLLET,
29 .data = linux.epoll_data { .ptr = 0 },29 .data = linux.epoll_data{ .ptr = 0 },
30 };30 };
3131
32 err = linux.epoll_ctl(i32(epoll_fd), linux.EPOLL_CTL_ADD, i32(timer_fd), &event);32 err = linux.epoll_ctl(i32(epoll_fd), linux.EPOLL_CTL_ADD, i32(timer_fd), &event);
std/os/linux/vdso.zig+11-9
...@@ -16,7 +16,10 @@ pub fn lookup(vername: []const u8, name: []const u8) usize {...@@ -16,7 +16,10 @@ pub fn lookup(vername: []const u8, name: []const u8) usize {
16 var base: usize = @maxValue(usize);16 var base: usize = @maxValue(usize);
17 {17 {
18 var i: usize = 0;18 var i: usize = 0;
19 while (i < eh.e_phnum) : ({i += 1; ph_addr += eh.e_phentsize;}) {19 while (i < eh.e_phnum) : ({
20 i += 1;
21 ph_addr += eh.e_phentsize;
22 }) {
20 const this_ph = @intToPtr(&elf.Phdr, ph_addr);23 const this_ph = @intToPtr(&elf.Phdr, ph_addr);
21 switch (this_ph.p_type) {24 switch (this_ph.p_type) {
22 elf.PT_LOAD => base = vdso_addr + this_ph.p_offset - this_ph.p_vaddr,25 elf.PT_LOAD => base = vdso_addr + this_ph.p_offset - this_ph.p_vaddr,
...@@ -54,15 +57,14 @@ pub fn lookup(vername: []const u8, name: []const u8) usize {...@@ -54,15 +57,14 @@ pub fn lookup(vername: []const u8, name: []const u8) usize {
54 const hashtab = maybe_hashtab ?? return 0;57 const hashtab = maybe_hashtab ?? return 0;
55 if (maybe_verdef == null) maybe_versym = null;58 if (maybe_verdef == null) maybe_versym = null;
5659
5760 const OK_TYPES = (1 << elf.STT_NOTYPE | 1 << elf.STT_OBJECT | 1 << elf.STT_FUNC | 1 << elf.STT_COMMON);
58 const OK_TYPES = (1<<elf.STT_NOTYPE | 1<<elf.STT_OBJECT | 1<<elf.STT_FUNC | 1<<elf.STT_COMMON);61 const OK_BINDS = (1 << elf.STB_GLOBAL | 1 << elf.STB_WEAK | 1 << elf.STB_GNU_UNIQUE);
59 const OK_BINDS = (1<<elf.STB_GLOBAL | 1<<elf.STB_WEAK | 1<<elf.STB_GNU_UNIQUE);
6062
61 var i: usize = 0;63 var i: usize = 0;
62 while (i < hashtab[1]) : (i += 1) {64 while (i < hashtab[1]) : (i += 1) {
63 if (0==(u32(1)<<u5(syms[i].st_info&0xf) & OK_TYPES)) continue;65 if (0 == (u32(1) << u5(syms[i].st_info & 0xf) & OK_TYPES)) continue;
64 if (0==(u32(1)<<u5(syms[i].st_info>>4) & OK_BINDS)) continue;66 if (0 == (u32(1) << u5(syms[i].st_info >> 4) & OK_BINDS)) continue;
65 if (0==syms[i].st_shndx) continue;67 if (0 == syms[i].st_shndx) continue;
66 if (!mem.eql(u8, name, cstr.toSliceConst(&strings[syms[i].st_name]))) continue;68 if (!mem.eql(u8, name, cstr.toSliceConst(&strings[syms[i].st_name]))) continue;
67 if (maybe_versym) |versym| {69 if (maybe_versym) |versym| {
68 if (!checkver(??maybe_verdef, versym[i], vername, strings))70 if (!checkver(??maybe_verdef, versym[i], vername, strings))
...@@ -78,12 +80,12 @@ fn checkver(def_arg: &elf.Verdef, vsym_arg: i32, vername: []const u8, strings: &...@@ -78,12 +80,12 @@ fn checkver(def_arg: &elf.Verdef, vsym_arg: i32, vername: []const u8, strings: &
78 var def = def_arg;80 var def = def_arg;
79 const vsym = @bitCast(u32, vsym_arg) & 0x7fff;81 const vsym = @bitCast(u32, vsym_arg) & 0x7fff;
80 while (true) {82 while (true) {
81 if (0==(def.vd_flags & elf.VER_FLG_BASE) and (def.vd_ndx & 0x7fff) == vsym)83 if (0 == (def.vd_flags & elf.VER_FLG_BASE) and (def.vd_ndx & 0x7fff) == vsym)
82 break;84 break;
83 if (def.vd_next == 0)85 if (def.vd_next == 0)
84 return false;86 return false;
85 def = @intToPtr(&elf.Verdef, @ptrToInt(def) + def.vd_next);87 def = @intToPtr(&elf.Verdef, @ptrToInt(def) + def.vd_next);
86 }88 }
87 const aux = @intToPtr(&elf.Verdaux, @ptrToInt(def ) + def.vd_aux);89 const aux = @intToPtr(&elf.Verdaux, @ptrToInt(def) + def.vd_aux);
88 return mem.eql(u8, vername, cstr.toSliceConst(&strings[aux.vda_name]));90 return mem.eql(u8, vername, cstr.toSliceConst(&strings[aux.vda_name]));
89}91}
std/os/linux/x86_64.zig+63-51
...@@ -330,26 +330,26 @@ pub const SYS_userfaultfd = 323;...@@ -330,26 +330,26 @@ pub const SYS_userfaultfd = 323;
330pub const SYS_membarrier = 324;330pub const SYS_membarrier = 324;
331pub const SYS_mlock2 = 325;331pub const SYS_mlock2 = 325;
332332
333pub const O_CREAT = 0o100;333pub const O_CREAT = 0o100;
334pub const O_EXCL = 0o200;334pub const O_EXCL = 0o200;
335pub const O_NOCTTY = 0o400;335pub const O_NOCTTY = 0o400;
336pub const O_TRUNC = 0o1000;336pub const O_TRUNC = 0o1000;
337pub const O_APPEND = 0o2000;337pub const O_APPEND = 0o2000;
338pub const O_NONBLOCK = 0o4000;338pub const O_NONBLOCK = 0o4000;
339pub const O_DSYNC = 0o10000;339pub const O_DSYNC = 0o10000;
340pub const O_SYNC = 0o4010000;340pub const O_SYNC = 0o4010000;
341pub const O_RSYNC = 0o4010000;341pub const O_RSYNC = 0o4010000;
342pub const O_DIRECTORY = 0o200000;342pub const O_DIRECTORY = 0o200000;
343pub const O_NOFOLLOW = 0o400000;343pub const O_NOFOLLOW = 0o400000;
344pub const O_CLOEXEC = 0o2000000;344pub const O_CLOEXEC = 0o2000000;
345345
346pub const O_ASYNC = 0o20000;346pub const O_ASYNC = 0o20000;
347pub const O_DIRECT = 0o40000;347pub const O_DIRECT = 0o40000;
348pub const O_LARGEFILE = 0;348pub const O_LARGEFILE = 0;
349pub const O_NOATIME = 0o1000000;349pub const O_NOATIME = 0o1000000;
350pub const O_PATH = 0o10000000;350pub const O_PATH = 0o10000000;
351pub const O_TMPFILE = 0o20200000;351pub const O_TMPFILE = 0o20200000;
352pub const O_NDELAY = O_NONBLOCK;352pub const O_NDELAY = O_NONBLOCK;
353353
354pub const F_DUPFD = 0;354pub const F_DUPFD = 0;
355pub const F_GETFD = 1;355pub const F_GETFD = 1;
...@@ -371,7 +371,6 @@ pub const F_GETOWN_EX = 16;...@@ -371,7 +371,6 @@ pub const F_GETOWN_EX = 16;
371371
372pub const F_GETOWNER_UIDS = 17;372pub const F_GETOWNER_UIDS = 17;
373373
374
375pub const VDSO_USEFUL = true;374pub const VDSO_USEFUL = true;
376pub const VDSO_CGT_SYM = "__vdso_clock_gettime";375pub const VDSO_CGT_SYM = "__vdso_clock_gettime";
377pub const VDSO_CGT_VER = "LINUX_2.6";376pub const VDSO_CGT_VER = "LINUX_2.6";
...@@ -382,72 +381,85 @@ pub fn syscall0(number: usize) usize {...@@ -382,72 +381,85 @@ pub fn syscall0(number: usize) usize {
382 return asm volatile ("syscall"381 return asm volatile ("syscall"
383 : [ret] "={rax}" (-> usize)382 : [ret] "={rax}" (-> usize)
384 : [number] "{rax}" (number)383 : [number] "{rax}" (number)
385 : "rcx", "r11");384 : "rcx", "r11"
385 );
386}386}
387387
388pub fn syscall1(number: usize, arg1: usize) usize {388pub fn syscall1(number: usize, arg1: usize) usize {
389 return asm volatile ("syscall"389 return asm volatile ("syscall"
390 : [ret] "={rax}" (-> usize)390 : [ret] "={rax}" (-> usize)
391 : [number] "{rax}" (number),391 : [number] "{rax}" (number),
392 [arg1] "{rdi}" (arg1)392 [arg1] "{rdi}" (arg1)
393 : "rcx", "r11");393 : "rcx", "r11"
394 );
394}395}
395396
396pub fn syscall2(number: usize, arg1: usize, arg2: usize) usize {397pub fn syscall2(number: usize, arg1: usize, arg2: usize) usize {
397 return asm volatile ("syscall"398 return asm volatile ("syscall"
398 : [ret] "={rax}" (-> usize)399 : [ret] "={rax}" (-> usize)
399 : [number] "{rax}" (number),400 : [number] "{rax}" (number),
400 [arg1] "{rdi}" (arg1),401 [arg1] "{rdi}" (arg1),
401 [arg2] "{rsi}" (arg2)402 [arg2] "{rsi}" (arg2)
402 : "rcx", "r11");403 : "rcx", "r11"
404 );
403}405}
404406
405pub fn syscall3(number: usize, arg1: usize, arg2: usize, arg3: usize) usize {407pub fn syscall3(number: usize, arg1: usize, arg2: usize, arg3: usize) usize {
406 return asm volatile ("syscall"408 return asm volatile ("syscall"
407 : [ret] "={rax}" (-> usize)409 : [ret] "={rax}" (-> usize)
408 : [number] "{rax}" (number),410 : [number] "{rax}" (number),
409 [arg1] "{rdi}" (arg1),411 [arg1] "{rdi}" (arg1),
410 [arg2] "{rsi}" (arg2),412 [arg2] "{rsi}" (arg2),
411 [arg3] "{rdx}" (arg3)413 [arg3] "{rdx}" (arg3)
412 : "rcx", "r11");414 : "rcx", "r11"
415 );
413}416}
414417
415pub fn syscall4(number: usize, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize {418pub fn syscall4(number: usize, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize {
416 return asm volatile ("syscall"419 return asm volatile ("syscall"
417 : [ret] "={rax}" (-> usize)420 : [ret] "={rax}" (-> usize)
418 : [number] "{rax}" (number),421 : [number] "{rax}" (number),
419 [arg1] "{rdi}" (arg1),422 [arg1] "{rdi}" (arg1),
420 [arg2] "{rsi}" (arg2),423 [arg2] "{rsi}" (arg2),
421 [arg3] "{rdx}" (arg3),424 [arg3] "{rdx}" (arg3),
422 [arg4] "{r10}" (arg4)425 [arg4] "{r10}" (arg4)
423 : "rcx", "r11");426 : "rcx", "r11"
427 );
424}428}
425429
426pub fn syscall5(number: usize, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize {430pub fn syscall5(number: usize, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize {
427 return asm volatile ("syscall"431 return asm volatile ("syscall"
428 : [ret] "={rax}" (-> usize)432 : [ret] "={rax}" (-> usize)
429 : [number] "{rax}" (number),433 : [number] "{rax}" (number),
430 [arg1] "{rdi}" (arg1),434 [arg1] "{rdi}" (arg1),
431 [arg2] "{rsi}" (arg2),435 [arg2] "{rsi}" (arg2),
432 [arg3] "{rdx}" (arg3),436 [arg3] "{rdx}" (arg3),
433 [arg4] "{r10}" (arg4),437 [arg4] "{r10}" (arg4),
434 [arg5] "{r8}" (arg5)438 [arg5] "{r8}" (arg5)
435 : "rcx", "r11");439 : "rcx", "r11"
440 );
436}441}
437442
438pub fn syscall6(number: usize, arg1: usize, arg2: usize, arg3: usize, arg4: usize,443pub fn syscall6(
439 arg5: usize, arg6: usize) usize444 number: usize,
440{445 arg1: usize,
446 arg2: usize,
447 arg3: usize,
448 arg4: usize,
449 arg5: usize,
450 arg6: usize,
451) usize {
441 return asm volatile ("syscall"452 return asm volatile ("syscall"
442 : [ret] "={rax}" (-> usize)453 : [ret] "={rax}" (-> usize)
443 : [number] "{rax}" (number),454 : [number] "{rax}" (number),
444 [arg1] "{rdi}" (arg1),455 [arg1] "{rdi}" (arg1),
445 [arg2] "{rsi}" (arg2),456 [arg2] "{rsi}" (arg2),
446 [arg3] "{rdx}" (arg3),457 [arg3] "{rdx}" (arg3),
447 [arg4] "{r10}" (arg4),458 [arg4] "{r10}" (arg4),
448 [arg5] "{r8}" (arg5),459 [arg5] "{r8}" (arg5),
449 [arg6] "{r9}" (arg6)460 [arg6] "{r9}" (arg6)
450 : "rcx", "r11");461 : "rcx", "r11"
462 );
451}463}
452464
453/// This matches the libc clone function.465/// This matches the libc clone function.
...@@ -457,10 +469,10 @@ pub nakedcc fn restore_rt() void {...@@ -457,10 +469,10 @@ pub nakedcc fn restore_rt() void {
457 return asm volatile ("syscall"469 return asm volatile ("syscall"
458 :470 :
459 : [number] "{rax}" (usize(SYS_rt_sigreturn))471 : [number] "{rax}" (usize(SYS_rt_sigreturn))
460 : "rcx", "r11");472 : "rcx", "r11"
473 );
461}474}
462475
463
464pub const msghdr = extern struct {476pub const msghdr = extern struct {
465 msg_name: &u8,477 msg_name: &u8,
466 msg_namelen: socklen_t,478 msg_namelen: socklen_t,
std/os/path.zig+41-52
...@@ -55,9 +55,7 @@ test "os.path.join" {...@@ -55,9 +55,7 @@ test "os.path.join" {
55 assert(mem.eql(u8, try joinWindows(debug.global_allocator, "c:\\", "a", "b\\", "c"), "c:\\a\\b\\c"));55 assert(mem.eql(u8, try joinWindows(debug.global_allocator, "c:\\", "a", "b\\", "c"), "c:\\a\\b\\c"));
56 assert(mem.eql(u8, try joinWindows(debug.global_allocator, "c:\\a\\", "b\\", "c"), "c:\\a\\b\\c"));56 assert(mem.eql(u8, try joinWindows(debug.global_allocator, "c:\\a\\", "b\\", "c"), "c:\\a\\b\\c"));
5757
58 assert(mem.eql(u8, try joinWindows(debug.global_allocator,58 assert(mem.eql(u8, try joinWindows(debug.global_allocator, "c:\\home\\andy\\dev\\zig\\build\\lib\\zig\\std", "io.zig"), "c:\\home\\andy\\dev\\zig\\build\\lib\\zig\\std\\io.zig"));
59 "c:\\home\\andy\\dev\\zig\\build\\lib\\zig\\std", "io.zig"),
60 "c:\\home\\andy\\dev\\zig\\build\\lib\\zig\\std\\io.zig"));
6159
62 assert(mem.eql(u8, try joinPosix(debug.global_allocator, "/a/b", "c"), "/a/b/c"));60 assert(mem.eql(u8, try joinPosix(debug.global_allocator, "/a/b", "c"), "/a/b/c"));
63 assert(mem.eql(u8, try joinPosix(debug.global_allocator, "/a/b/", "c"), "/a/b/c"));61 assert(mem.eql(u8, try joinPosix(debug.global_allocator, "/a/b/", "c"), "/a/b/c"));
...@@ -65,8 +63,7 @@ test "os.path.join" {...@@ -65,8 +63,7 @@ test "os.path.join" {
65 assert(mem.eql(u8, try joinPosix(debug.global_allocator, "/", "a", "b/", "c"), "/a/b/c"));63 assert(mem.eql(u8, try joinPosix(debug.global_allocator, "/", "a", "b/", "c"), "/a/b/c"));
66 assert(mem.eql(u8, try joinPosix(debug.global_allocator, "/a/", "b/", "c"), "/a/b/c"));64 assert(mem.eql(u8, try joinPosix(debug.global_allocator, "/a/", "b/", "c"), "/a/b/c"));
6765
68 assert(mem.eql(u8, try joinPosix(debug.global_allocator, "/home/andy/dev/zig/build/lib/zig/std", "io.zig"),66 assert(mem.eql(u8, try joinPosix(debug.global_allocator, "/home/andy/dev/zig/build/lib/zig/std", "io.zig"), "/home/andy/dev/zig/build/lib/zig/std/io.zig"));
69 "/home/andy/dev/zig/build/lib/zig/std/io.zig"));
70}67}
7168
72pub fn isAbsolute(path: []const u8) bool {69pub fn isAbsolute(path: []const u8) bool {
...@@ -151,22 +148,22 @@ pub const WindowsPath = struct {...@@ -151,22 +148,22 @@ pub const WindowsPath = struct {
151148
152pub fn windowsParsePath(path: []const u8) WindowsPath {149pub fn windowsParsePath(path: []const u8) WindowsPath {
153 if (path.len >= 2 and path[1] == ':') {150 if (path.len >= 2 and path[1] == ':') {
154 return WindowsPath {151 return WindowsPath{
155 .is_abs = isAbsoluteWindows(path),152 .is_abs = isAbsoluteWindows(path),
156 .kind = WindowsPath.Kind.Drive,153 .kind = WindowsPath.Kind.Drive,
157 .disk_designator = path[0..2],154 .disk_designator = path[0..2],
158 };155 };
159 }156 }
160 if (path.len >= 1 and (path[0] == '/' or path[0] == '\\') and157 if (path.len >= 1 and (path[0] == '/' or path[0] == '\\') and
161 (path.len == 1 or (path[1] != '/' and path[1] != '\\')))158 (path.len == 1 or (path[1] != '/' and path[1] != '\\')))
162 {159 {
163 return WindowsPath {160 return WindowsPath{
164 .is_abs = true,161 .is_abs = true,
165 .kind = WindowsPath.Kind.None,162 .kind = WindowsPath.Kind.None,
166 .disk_designator = path[0..0],163 .disk_designator = path[0..0],
167 };164 };
168 }165 }
169 const relative_path = WindowsPath {166 const relative_path = WindowsPath{
170 .kind = WindowsPath.Kind.None,167 .kind = WindowsPath.Kind.None,
171 .disk_designator = []u8{},168 .disk_designator = []u8{},
172 .is_abs = false,169 .is_abs = false,
...@@ -178,7 +175,7 @@ pub fn windowsParsePath(path: []const u8) WindowsPath {...@@ -178,7 +175,7 @@ pub fn windowsParsePath(path: []const u8) WindowsPath {
178 // TODO when I combined these together with `inline for` the compiler crashed175 // TODO when I combined these together with `inline for` the compiler crashed
179 {176 {
180 const this_sep = '/';177 const this_sep = '/';
181 const two_sep = []u8{this_sep, this_sep};178 const two_sep = []u8{ this_sep, this_sep };
182 if (mem.startsWith(u8, path, two_sep)) {179 if (mem.startsWith(u8, path, two_sep)) {
183 if (path[2] == this_sep) {180 if (path[2] == this_sep) {
184 return relative_path;181 return relative_path;
...@@ -187,7 +184,7 @@ pub fn windowsParsePath(path: []const u8) WindowsPath {...@@ -187,7 +184,7 @@ pub fn windowsParsePath(path: []const u8) WindowsPath {
187 var it = mem.split(path, []u8{this_sep});184 var it = mem.split(path, []u8{this_sep});
188 _ = (it.next() ?? return relative_path);185 _ = (it.next() ?? return relative_path);
189 _ = (it.next() ?? return relative_path);186 _ = (it.next() ?? return relative_path);
190 return WindowsPath {187 return WindowsPath{
191 .is_abs = isAbsoluteWindows(path),188 .is_abs = isAbsoluteWindows(path),
192 .kind = WindowsPath.Kind.NetworkShare,189 .kind = WindowsPath.Kind.NetworkShare,
193 .disk_designator = path[0..it.index],190 .disk_designator = path[0..it.index],
...@@ -196,7 +193,7 @@ pub fn windowsParsePath(path: []const u8) WindowsPath {...@@ -196,7 +193,7 @@ pub fn windowsParsePath(path: []const u8) WindowsPath {
196 }193 }
197 {194 {
198 const this_sep = '\\';195 const this_sep = '\\';
199 const two_sep = []u8{this_sep, this_sep};196 const two_sep = []u8{ this_sep, this_sep };
200 if (mem.startsWith(u8, path, two_sep)) {197 if (mem.startsWith(u8, path, two_sep)) {
201 if (path[2] == this_sep) {198 if (path[2] == this_sep) {
202 return relative_path;199 return relative_path;
...@@ -205,7 +202,7 @@ pub fn windowsParsePath(path: []const u8) WindowsPath {...@@ -205,7 +202,7 @@ pub fn windowsParsePath(path: []const u8) WindowsPath {
205 var it = mem.split(path, []u8{this_sep});202 var it = mem.split(path, []u8{this_sep});
206 _ = (it.next() ?? return relative_path);203 _ = (it.next() ?? return relative_path);
207 _ = (it.next() ?? return relative_path);204 _ = (it.next() ?? return relative_path);
208 return WindowsPath {205 return WindowsPath{
209 .is_abs = isAbsoluteWindows(path),206 .is_abs = isAbsoluteWindows(path),
210 .kind = WindowsPath.Kind.NetworkShare,207 .kind = WindowsPath.Kind.NetworkShare,
211 .disk_designator = path[0..it.index],208 .disk_designator = path[0..it.index],
...@@ -296,7 +293,7 @@ fn compareDiskDesignators(kind: WindowsPath.Kind, p1: []const u8, p2: []const u8...@@ -296,7 +293,7 @@ fn compareDiskDesignators(kind: WindowsPath.Kind, p1: []const u8, p2: []const u8
296293
297fn asciiUpper(byte: u8) u8 {294fn asciiUpper(byte: u8) u8 {
298 return switch (byte) {295 return switch (byte) {
299 'a' ... 'z' => 'A' + (byte - 'a'),296 'a'...'z' => 'A' + (byte - 'a'),
300 else => byte,297 else => byte,
301 };298 };
302}299}
...@@ -372,7 +369,6 @@ pub fn resolveWindows(allocator: &Allocator, paths: []const []const u8) ![]u8 {...@@ -372,7 +369,6 @@ pub fn resolveWindows(allocator: &Allocator, paths: []const []const u8) ![]u8 {
372 max_size += p.len + 1;369 max_size += p.len + 1;
373 }370 }
374371
375
376 // if we will result with a disk designator, loop again to determine372 // if we will result with a disk designator, loop again to determine
377 // which is the last time the disk designator is absolutely specified, if any373 // which is the last time the disk designator is absolutely specified, if any
378 // and count up the max bytes for paths related to this disk designator374 // and count up the max bytes for paths related to this disk designator
...@@ -386,8 +382,7 @@ pub fn resolveWindows(allocator: &Allocator, paths: []const []const u8) ![]u8 {...@@ -386,8 +382,7 @@ pub fn resolveWindows(allocator: &Allocator, paths: []const []const u8) ![]u8 {
386 const parsed = windowsParsePath(p);382 const parsed = windowsParsePath(p);
387 if (parsed.kind != WindowsPath.Kind.None) {383 if (parsed.kind != WindowsPath.Kind.None) {
388 if (parsed.kind == have_drive_kind) {384 if (parsed.kind == have_drive_kind) {
389 correct_disk_designator = compareDiskDesignators(have_drive_kind,385 correct_disk_designator = compareDiskDesignators(have_drive_kind, result_disk_designator, parsed.disk_designator);
390 result_disk_designator, parsed.disk_designator);
391 } else {386 } else {
392 continue;387 continue;
393 }388 }
...@@ -404,7 +399,6 @@ pub fn resolveWindows(allocator: &Allocator, paths: []const []const u8) ![]u8 {...@@ -404,7 +399,6 @@ pub fn resolveWindows(allocator: &Allocator, paths: []const []const u8) ![]u8 {
404 }399 }
405 }400 }
406401
407
408 // Allocate result and fill in the disk designator, calling getCwd if we have to.402 // Allocate result and fill in the disk designator, calling getCwd if we have to.
409 var result: []u8 = undefined;403 var result: []u8 = undefined;
410 var result_index: usize = 0;404 var result_index: usize = 0;
...@@ -433,7 +427,7 @@ pub fn resolveWindows(allocator: &Allocator, paths: []const []const u8) ![]u8 {...@@ -433,7 +427,7 @@ pub fn resolveWindows(allocator: &Allocator, paths: []const []const u8) ![]u8 {
433 result_index += 1;427 result_index += 1;
434 mem.copy(u8, result[result_index..], other_name);428 mem.copy(u8, result[result_index..], other_name);
435 result_index += other_name.len;429 result_index += other_name.len;
436 430
437 result_disk_designator = result[0..result_index];431 result_disk_designator = result[0..result_index];
438 },432 },
439 WindowsPath.Kind.None => {433 WindowsPath.Kind.None => {
...@@ -478,8 +472,7 @@ pub fn resolveWindows(allocator: &Allocator, paths: []const []const u8) ![]u8 {...@@ -478,8 +472,7 @@ pub fn resolveWindows(allocator: &Allocator, paths: []const []const u8) ![]u8 {
478472
479 if (parsed.kind != WindowsPath.Kind.None) {473 if (parsed.kind != WindowsPath.Kind.None) {
480 if (parsed.kind == have_drive_kind) {474 if (parsed.kind == have_drive_kind) {
481 correct_disk_designator = compareDiskDesignators(have_drive_kind,475 correct_disk_designator = compareDiskDesignators(have_drive_kind, result_disk_designator, parsed.disk_designator);
482 result_disk_designator, parsed.disk_designator);
483 } else {476 } else {
484 continue;477 continue;
485 }478 }
...@@ -591,7 +584,7 @@ test "os.path.resolve" {...@@ -591,7 +584,7 @@ test "os.path.resolve" {
591 }584 }
592 assert(mem.eql(u8, testResolveWindows([][]const u8{"."}), cwd));585 assert(mem.eql(u8, testResolveWindows([][]const u8{"."}), cwd));
593 } else {586 } else {
594 assert(mem.eql(u8, testResolvePosix([][]const u8{"a/b/c/", "../../.."}), cwd));587 assert(mem.eql(u8, testResolvePosix([][]const u8{ "a/b/c/", "../../.." }), cwd));
595 assert(mem.eql(u8, testResolvePosix([][]const u8{"."}), cwd));588 assert(mem.eql(u8, testResolvePosix([][]const u8{"."}), cwd));
596 }589 }
597}590}
...@@ -601,16 +594,15 @@ test "os.path.resolveWindows" {...@@ -601,16 +594,15 @@ test "os.path.resolveWindows" {
601 const cwd = try os.getCwd(debug.global_allocator);594 const cwd = try os.getCwd(debug.global_allocator);
602 const parsed_cwd = windowsParsePath(cwd);595 const parsed_cwd = windowsParsePath(cwd);
603 {596 {
604 const result = testResolveWindows([][]const u8{"/usr/local", "lib\\zig\\std\\array_list.zig"});597 const result = testResolveWindows([][]const u8{ "/usr/local", "lib\\zig\\std\\array_list.zig" });
605 const expected = try join(debug.global_allocator,598 const expected = try join(debug.global_allocator, parsed_cwd.disk_designator, "usr\\local\\lib\\zig\\std\\array_list.zig");
606 parsed_cwd.disk_designator, "usr\\local\\lib\\zig\\std\\array_list.zig");
607 if (parsed_cwd.kind == WindowsPath.Kind.Drive) {599 if (parsed_cwd.kind == WindowsPath.Kind.Drive) {
608 expected[0] = asciiUpper(parsed_cwd.disk_designator[0]);600 expected[0] = asciiUpper(parsed_cwd.disk_designator[0]);
609 }601 }
610 assert(mem.eql(u8, result, expected));602 assert(mem.eql(u8, result, expected));
611 }603 }
612 {604 {
613 const result = testResolveWindows([][]const u8{"usr/local", "lib\\zig"});605 const result = testResolveWindows([][]const u8{ "usr/local", "lib\\zig" });
614 const expected = try join(debug.global_allocator, cwd, "usr\\local\\lib\\zig");606 const expected = try join(debug.global_allocator, cwd, "usr\\local\\lib\\zig");
615 if (parsed_cwd.kind == WindowsPath.Kind.Drive) {607 if (parsed_cwd.kind == WindowsPath.Kind.Drive) {
616 expected[0] = asciiUpper(parsed_cwd.disk_designator[0]);608 expected[0] = asciiUpper(parsed_cwd.disk_designator[0]);
...@@ -619,33 +611,32 @@ test "os.path.resolveWindows" {...@@ -619,33 +611,32 @@ test "os.path.resolveWindows" {
619 }611 }
620 }612 }
621613
622 assert(mem.eql(u8, testResolveWindows([][]const u8{"c:\\a\\b\\c", "/hi", "ok"}), "C:\\hi\\ok"));614 assert(mem.eql(u8, testResolveWindows([][]const u8{ "c:\\a\\b\\c", "/hi", "ok" }), "C:\\hi\\ok"));
623 assert(mem.eql(u8, testResolveWindows([][]const u8{"c:/blah\\blah", "d:/games", "c:../a"}), "C:\\blah\\a"));615 assert(mem.eql(u8, testResolveWindows([][]const u8{ "c:/blah\\blah", "d:/games", "c:../a" }), "C:\\blah\\a"));
624 assert(mem.eql(u8, testResolveWindows([][]const u8{"c:/blah\\blah", "d:/games", "C:../a"}), "C:\\blah\\a"));616 assert(mem.eql(u8, testResolveWindows([][]const u8{ "c:/blah\\blah", "d:/games", "C:../a" }), "C:\\blah\\a"));
625 assert(mem.eql(u8, testResolveWindows([][]const u8{"c:/ignore", "d:\\a/b\\c/d", "\\e.exe"}), "D:\\e.exe"));617 assert(mem.eql(u8, testResolveWindows([][]const u8{ "c:/ignore", "d:\\a/b\\c/d", "\\e.exe" }), "D:\\e.exe"));
626 assert(mem.eql(u8, testResolveWindows([][]const u8{"c:/ignore", "c:/some/file"}), "C:\\some\\file"));618 assert(mem.eql(u8, testResolveWindows([][]const u8{ "c:/ignore", "c:/some/file" }), "C:\\some\\file"));
627 assert(mem.eql(u8, testResolveWindows([][]const u8{"d:/ignore", "d:some/dir//"}), "D:\\ignore\\some\\dir"));619 assert(mem.eql(u8, testResolveWindows([][]const u8{ "d:/ignore", "d:some/dir//" }), "D:\\ignore\\some\\dir"));
628 assert(mem.eql(u8, testResolveWindows([][]const u8{"//server/share", "..", "relative\\"}), "\\\\server\\share\\relative"));620 assert(mem.eql(u8, testResolveWindows([][]const u8{ "//server/share", "..", "relative\\" }), "\\\\server\\share\\relative"));
629 assert(mem.eql(u8, testResolveWindows([][]const u8{"c:/", "//"}), "C:\\"));621 assert(mem.eql(u8, testResolveWindows([][]const u8{ "c:/", "//" }), "C:\\"));
630 assert(mem.eql(u8, testResolveWindows([][]const u8{"c:/", "//dir"}), "C:\\dir"));622 assert(mem.eql(u8, testResolveWindows([][]const u8{ "c:/", "//dir" }), "C:\\dir"));
631 assert(mem.eql(u8, testResolveWindows([][]const u8{"c:/", "//server/share"}), "\\\\server\\share\\"));623 assert(mem.eql(u8, testResolveWindows([][]const u8{ "c:/", "//server/share" }), "\\\\server\\share\\"));
632 assert(mem.eql(u8, testResolveWindows([][]const u8{"c:/", "//server//share"}), "\\\\server\\share\\"));624 assert(mem.eql(u8, testResolveWindows([][]const u8{ "c:/", "//server//share" }), "\\\\server\\share\\"));
633 assert(mem.eql(u8, testResolveWindows([][]const u8{"c:/", "///some//dir"}), "C:\\some\\dir"));625 assert(mem.eql(u8, testResolveWindows([][]const u8{ "c:/", "///some//dir" }), "C:\\some\\dir"));
634 assert(mem.eql(u8, testResolveWindows([][]const u8{"C:\\foo\\tmp.3\\", "..\\tmp.3\\cycles\\root.js"}),626 assert(mem.eql(u8, testResolveWindows([][]const u8{ "C:\\foo\\tmp.3\\", "..\\tmp.3\\cycles\\root.js" }), "C:\\foo\\tmp.3\\cycles\\root.js"));
635 "C:\\foo\\tmp.3\\cycles\\root.js"));
636}627}
637628
638test "os.path.resolvePosix" {629test "os.path.resolvePosix" {
639 assert(mem.eql(u8, testResolvePosix([][]const u8{"/a/b", "c"}), "/a/b/c"));630 assert(mem.eql(u8, testResolvePosix([][]const u8{ "/a/b", "c" }), "/a/b/c"));
640 assert(mem.eql(u8, testResolvePosix([][]const u8{"/a/b", "c", "//d", "e///"}), "/d/e"));631 assert(mem.eql(u8, testResolvePosix([][]const u8{ "/a/b", "c", "//d", "e///" }), "/d/e"));
641 assert(mem.eql(u8, testResolvePosix([][]const u8{"/a/b/c", "..", "../"}), "/a"));632 assert(mem.eql(u8, testResolvePosix([][]const u8{ "/a/b/c", "..", "../" }), "/a"));
642 assert(mem.eql(u8, testResolvePosix([][]const u8{"/", "..", ".."}), "/"));633 assert(mem.eql(u8, testResolvePosix([][]const u8{ "/", "..", ".." }), "/"));
643 assert(mem.eql(u8, testResolvePosix([][]const u8{"/a/b/c/"}), "/a/b/c"));634 assert(mem.eql(u8, testResolvePosix([][]const u8{"/a/b/c/"}), "/a/b/c"));
644635
645 assert(mem.eql(u8, testResolvePosix([][]const u8{"/var/lib", "../", "file/"}), "/var/file"));636 assert(mem.eql(u8, testResolvePosix([][]const u8{ "/var/lib", "../", "file/" }), "/var/file"));
646 assert(mem.eql(u8, testResolvePosix([][]const u8{"/var/lib", "/../", "file/"}), "/file"));637 assert(mem.eql(u8, testResolvePosix([][]const u8{ "/var/lib", "/../", "file/" }), "/file"));
647 assert(mem.eql(u8, testResolvePosix([][]const u8{"/some/dir", ".", "/absolute/"}), "/absolute"));638 assert(mem.eql(u8, testResolvePosix([][]const u8{ "/some/dir", ".", "/absolute/" }), "/absolute"));
648 assert(mem.eql(u8, testResolvePosix([][]const u8{"/foo/tmp.3/", "../tmp.3/cycles/root.js"}), "/foo/tmp.3/cycles/root.js"));639 assert(mem.eql(u8, testResolvePosix([][]const u8{ "/foo/tmp.3/", "../tmp.3/cycles/root.js" }), "/foo/tmp.3/cycles/root.js"));
649}640}
650641
651fn testResolveWindows(paths: []const []const u8) []u8 {642fn testResolveWindows(paths: []const []const u8) []u8 {
...@@ -1079,9 +1070,7 @@ pub fn real(allocator: &Allocator, pathname: []const u8) ![]u8 {...@@ -1079,9 +1070,7 @@ pub fn real(allocator: &Allocator, pathname: []const u8) ![]u8 {
1079 mem.copy(u8, pathname_buf, pathname);1070 mem.copy(u8, pathname_buf, pathname);
1080 pathname_buf[pathname.len] = 0;1071 pathname_buf[pathname.len] = 0;
10811072
1082 const h_file = windows.CreateFileA(pathname_buf.ptr,1073 const h_file = windows.CreateFileA(pathname_buf.ptr, windows.GENERIC_READ, windows.FILE_SHARE_READ, null, windows.OPEN_EXISTING, windows.FILE_ATTRIBUTE_NORMAL, null);
1083 windows.GENERIC_READ, windows.FILE_SHARE_READ, null, windows.OPEN_EXISTING,
1084 windows.FILE_ATTRIBUTE_NORMAL, null);
1085 if (h_file == windows.INVALID_HANDLE_VALUE) {1074 if (h_file == windows.INVALID_HANDLE_VALUE) {
1086 const err = windows.GetLastError();1075 const err = windows.GetLastError();
1087 return switch (err) {1076 return switch (err) {
...@@ -1161,7 +1150,7 @@ pub fn real(allocator: &Allocator, pathname: []const u8) ![]u8 {...@@ -1161,7 +1150,7 @@ pub fn real(allocator: &Allocator, pathname: []const u8) ![]u8 {
1161 return allocator.shrink(u8, result_buf, cstr.len(result_buf.ptr));1150 return allocator.shrink(u8, result_buf, cstr.len(result_buf.ptr));
1162 },1151 },
1163 Os.linux => {1152 Os.linux => {
1164 const fd = try os.posixOpen(allocator, pathname, posix.O_PATH|posix.O_NONBLOCK|posix.O_CLOEXEC, 0);1153 const fd = try os.posixOpen(allocator, pathname, posix.O_PATH | posix.O_NONBLOCK | posix.O_CLOEXEC, 0);
1165 defer os.close(fd);1154 defer os.close(fd);
11661155
1167 var buf: ["/proc/self/fd/-2147483648".len]u8 = undefined;1156 var buf: ["/proc/self/fd/-2147483648".len]u8 = undefined;
std/os/time.zig+31-38
...@@ -27,7 +27,7 @@ pub fn sleep(seconds: usize, nanoseconds: usize) void {...@@ -27,7 +27,7 @@ pub fn sleep(seconds: usize, nanoseconds: usize) void {
2727
28const u63 = @IntType(false, 63);28const u63 = @IntType(false, 63);
29pub fn posixSleep(seconds: u63, nanoseconds: u63) void {29pub fn posixSleep(seconds: u63, nanoseconds: u63) void {
30 var req = posix.timespec {30 var req = posix.timespec{
31 .tv_sec = seconds,31 .tv_sec = seconds,
32 .tv_nsec = nanoseconds,32 .tv_nsec = nanoseconds,
33 };33 };
...@@ -71,7 +71,7 @@ fn milliTimestampWindows() u64 {...@@ -71,7 +71,7 @@ fn milliTimestampWindows() u64 {
71 var ft: i64 = undefined;71 var ft: i64 = undefined;
72 windows.GetSystemTimeAsFileTime(&ft);72 windows.GetSystemTimeAsFileTime(&ft);
73 const hns_per_ms = (ns_per_s / 100) / ms_per_s;73 const hns_per_ms = (ns_per_s / 100) / ms_per_s;
74 const epoch_adj = epoch.windows * ms_per_s;74 const epoch_adj = epoch.windows * ms_per_s;
75 return u64(@divFloor(ft, hns_per_ms) + epoch_adj);75 return u64(@divFloor(ft, hns_per_ms) + epoch_adj);
76}76}
7777
...@@ -83,7 +83,7 @@ fn milliTimestampDarwin() u64 {...@@ -83,7 +83,7 @@ fn milliTimestampDarwin() u64 {
83 debug.assert(err == 0);83 debug.assert(err == 0);
84 const sec_ms = u64(tv.tv_sec) * ms_per_s;84 const sec_ms = u64(tv.tv_sec) * ms_per_s;
85 const usec_ms = @divFloor(u64(tv.tv_usec), us_per_s / ms_per_s);85 const usec_ms = @divFloor(u64(tv.tv_usec), us_per_s / ms_per_s);
86 return u64(sec_ms) + u64(usec_ms); 86 return u64(sec_ms) + u64(usec_ms);
87}87}
8888
89fn milliTimestampPosix() u64 {89fn milliTimestampPosix() u64 {
...@@ -110,17 +110,16 @@ pub const s_per_hour = s_per_min * 60;...@@ -110,17 +110,16 @@ pub const s_per_hour = s_per_min * 60;
110pub const s_per_day = s_per_hour * 24;110pub const s_per_day = s_per_hour * 24;
111pub const s_per_week = s_per_day * 7;111pub const s_per_week = s_per_day * 7;
112112
113
114/// A monotonic high-performance timer.113/// A monotonic high-performance timer.
115/// Timer.start() must be called to initialize the struct, which captures114/// Timer.start() must be called to initialize the struct, which captures
116/// the counter frequency on windows and darwin, records the resolution,115/// the counter frequency on windows and darwin, records the resolution,
117/// and gives the user an oportunity to check for the existnece of116/// and gives the user an oportunity to check for the existnece of
118/// monotonic clocks without forcing them to check for error on each read.117/// monotonic clocks without forcing them to check for error on each read.
119/// .resolution is in nanoseconds on all platforms but .start_time's meaning 118/// .resolution is in nanoseconds on all platforms but .start_time's meaning
120/// depends on the OS. On Windows and Darwin it is a hardware counter 119/// depends on the OS. On Windows and Darwin it is a hardware counter
121/// value that requires calculation to convert to a meaninful unit.120/// value that requires calculation to convert to a meaninful unit.
122pub const Timer = struct {121pub const Timer = struct {
123 122
124 //if we used resolution's value when performing the123 //if we used resolution's value when performing the
125 // performance counter calc on windows/darwin, it would124 // performance counter calc on windows/darwin, it would
126 // be less precise125 // be less precise
...@@ -131,10 +130,9 @@ pub const Timer = struct {...@@ -131,10 +130,9 @@ pub const Timer = struct {
131 },130 },
132 resolution: u64,131 resolution: u64,
133 start_time: u64,132 start_time: u64,
134 133
135
136 //At some point we may change our minds on RAW, but for now we're134 //At some point we may change our minds on RAW, but for now we're
137 // sticking with posix standard MONOTONIC. For more information, see: 135 // sticking with posix standard MONOTONIC. For more information, see:
138 // https://github.com/ziglang/zig/pull/933136 // https://github.com/ziglang/zig/pull/933
139 //137 //
140 //const monotonic_clock_id = switch(builtin.os) {138 //const monotonic_clock_id = switch(builtin.os) {
...@@ -142,20 +140,21 @@ pub const Timer = struct {...@@ -142,20 +140,21 @@ pub const Timer = struct {
142 // else => posix.CLOCK_MONOTONIC,140 // else => posix.CLOCK_MONOTONIC,
143 //};141 //};
144 const monotonic_clock_id = posix.CLOCK_MONOTONIC;142 const monotonic_clock_id = posix.CLOCK_MONOTONIC;
145
146
147 /// Initialize the timer structure.143 /// Initialize the timer structure.
148 //This gives us an oportunity to grab the counter frequency in windows.144 //This gives us an oportunity to grab the counter frequency in windows.
149 //On Windows: QueryPerformanceCounter will succeed on anything >= XP/2000.145 //On Windows: QueryPerformanceCounter will succeed on anything >= XP/2000.
150 //On Posix: CLOCK_MONOTONIC will only fail if the monotonic counter is not 146 //On Posix: CLOCK_MONOTONIC will only fail if the monotonic counter is not
151 // supported, or if the timespec pointer is out of bounds, which should be 147 // supported, or if the timespec pointer is out of bounds, which should be
152 // impossible here barring cosmic rays or other such occurances of148 // impossible here barring cosmic rays or other such occurances of
153 // incredibly bad luck.149 // incredibly bad luck.
154 //On Darwin: This cannot fail, as far as I am able to tell.150 //On Darwin: This cannot fail, as far as I am able to tell.
155 const TimerError = error{TimerUnsupported, Unexpected};151 const TimerError = error{
152 TimerUnsupported,
153 Unexpected,
154 };
156 pub fn start() TimerError!Timer {155 pub fn start() TimerError!Timer {
157 var self: Timer = undefined;156 var self: Timer = undefined;
158 157
159 switch (builtin.os) {158 switch (builtin.os) {
160 Os.windows => {159 Os.windows => {
161 var freq: i64 = undefined;160 var freq: i64 = undefined;
...@@ -163,7 +162,7 @@ pub const Timer = struct {...@@ -163,7 +162,7 @@ pub const Timer = struct {
163 if (err == windows.FALSE) return error.TimerUnsupported;162 if (err == windows.FALSE) return error.TimerUnsupported;
164 self.frequency = u64(freq);163 self.frequency = u64(freq);
165 self.resolution = @divFloor(ns_per_s, self.frequency);164 self.resolution = @divFloor(ns_per_s, self.frequency);
166 165
167 var start_time: i64 = undefined;166 var start_time: i64 = undefined;
168 err = windows.QueryPerformanceCounter(&start_time);167 err = windows.QueryPerformanceCounter(&start_time);
169 debug.assert(err != windows.FALSE);168 debug.assert(err != windows.FALSE);
...@@ -171,9 +170,9 @@ pub const Timer = struct {...@@ -171,9 +170,9 @@ pub const Timer = struct {
171 },170 },
172 Os.linux => {171 Os.linux => {
173 //On Linux, seccomp can do arbitrary things to our ability to call172 //On Linux, seccomp can do arbitrary things to our ability to call
174 // syscalls, including return any errno value it wants and 173 // syscalls, including return any errno value it wants and
175 // inconsistently throwing errors. Since we can't account for174 // inconsistently throwing errors. Since we can't account for
176 // abuses of seccomp in a reasonable way, we'll assume that if 175 // abuses of seccomp in a reasonable way, we'll assume that if
177 // seccomp is going to block us it will at least do so consistently176 // seccomp is going to block us it will at least do so consistently
178 var ts: posix.timespec = undefined;177 var ts: posix.timespec = undefined;
179 var result = posix.clock_getres(monotonic_clock_id, &ts);178 var result = posix.clock_getres(monotonic_clock_id, &ts);
...@@ -184,7 +183,7 @@ pub const Timer = struct {...@@ -184,7 +183,7 @@ pub const Timer = struct {
184 else => return std.os.unexpectedErrorPosix(errno),183 else => return std.os.unexpectedErrorPosix(errno),
185 }184 }
186 self.resolution = u64(ts.tv_sec) * u64(ns_per_s) + u64(ts.tv_nsec);185 self.resolution = u64(ts.tv_sec) * u64(ns_per_s) + u64(ts.tv_nsec);
187 186
188 result = posix.clock_gettime(monotonic_clock_id, &ts);187 result = posix.clock_gettime(monotonic_clock_id, &ts);
189 errno = posix.getErrno(result);188 errno = posix.getErrno(result);
190 if (errno != 0) return std.os.unexpectedErrorPosix(errno);189 if (errno != 0) return std.os.unexpectedErrorPosix(errno);
...@@ -199,7 +198,7 @@ pub const Timer = struct {...@@ -199,7 +198,7 @@ pub const Timer = struct {
199 }198 }
200 return self;199 return self;
201 }200 }
202 201
203 /// Reads the timer value since start or the last reset in nanoseconds202 /// Reads the timer value since start or the last reset in nanoseconds
204 pub fn read(self: &Timer) u64 {203 pub fn read(self: &Timer) u64 {
205 var clock = clockNative() - self.start_time;204 var clock = clockNative() - self.start_time;
...@@ -210,13 +209,12 @@ pub const Timer = struct {...@@ -210,13 +209,12 @@ pub const Timer = struct {
210 else => @compileError("Unsupported OS"),209 else => @compileError("Unsupported OS"),
211 };210 };
212 }211 }
213 212
214 /// Resets the timer value to 0/now.213 /// Resets the timer value to 0/now.
215 pub fn reset(self: &Timer) void214 pub fn reset(self: &Timer) void {
216 {
217 self.start_time = clockNative();215 self.start_time = clockNative();
218 }216 }
219 217
220 /// Returns the current value of the timer in nanoseconds, then resets it218 /// Returns the current value of the timer in nanoseconds, then resets it
221 pub fn lap(self: &Timer) u64 {219 pub fn lap(self: &Timer) u64 {
222 var now = clockNative();220 var now = clockNative();
...@@ -224,26 +222,25 @@ pub const Timer = struct {...@@ -224,26 +222,25 @@ pub const Timer = struct {
224 self.start_time = now;222 self.start_time = now;
225 return lap_time;223 return lap_time;
226 }224 }
227 225
228
229 const clockNative = switch (builtin.os) {226 const clockNative = switch (builtin.os) {
230 Os.windows => clockWindows,227 Os.windows => clockWindows,
231 Os.linux => clockLinux,228 Os.linux => clockLinux,
232 Os.macosx, Os.ios => clockDarwin,229 Os.macosx, Os.ios => clockDarwin,
233 else => @compileError("Unsupported OS"),230 else => @compileError("Unsupported OS"),
234 };231 };
235 232
236 fn clockWindows() u64 {233 fn clockWindows() u64 {
237 var result: i64 = undefined;234 var result: i64 = undefined;
238 var err = windows.QueryPerformanceCounter(&result);235 var err = windows.QueryPerformanceCounter(&result);
239 debug.assert(err != windows.FALSE);236 debug.assert(err != windows.FALSE);
240 return u64(result);237 return u64(result);
241 }238 }
242 239
243 fn clockDarwin() u64 {240 fn clockDarwin() u64 {
244 return darwin.mach_absolute_time();241 return darwin.mach_absolute_time();
245 }242 }
246 243
247 fn clockLinux() u64 {244 fn clockLinux() u64 {
248 var ts: posix.timespec = undefined;245 var ts: posix.timespec = undefined;
249 var result = posix.clock_gettime(monotonic_clock_id, &ts);246 var result = posix.clock_gettime(monotonic_clock_id, &ts);
...@@ -252,10 +249,6 @@ pub const Timer = struct {...@@ -252,10 +249,6 @@ pub const Timer = struct {
252 }249 }
253};250};
254251
255
256
257
258
259test "os.time.sleep" {252test "os.time.sleep" {
260 sleep(0, 1);253 sleep(0, 1);
261}254}
...@@ -263,7 +256,7 @@ test "os.time.sleep" {...@@ -263,7 +256,7 @@ test "os.time.sleep" {
263test "os.time.timestamp" {256test "os.time.timestamp" {
264 const ns_per_ms = (ns_per_s / ms_per_s);257 const ns_per_ms = (ns_per_s / ms_per_s);
265 const margin = 50;258 const margin = 50;
266 259
267 const time_0 = milliTimestamp();260 const time_0 = milliTimestamp();
268 sleep(0, ns_per_ms);261 sleep(0, ns_per_ms);
269 const time_1 = milliTimestamp();262 const time_1 = milliTimestamp();
...@@ -274,15 +267,15 @@ test "os.time.timestamp" {...@@ -274,15 +267,15 @@ test "os.time.timestamp" {
274test "os.time.Timer" {267test "os.time.Timer" {
275 const ns_per_ms = (ns_per_s / ms_per_s);268 const ns_per_ms = (ns_per_s / ms_per_s);
276 const margin = ns_per_ms * 50;269 const margin = ns_per_ms * 50;
277 270
278 var timer = try Timer.start();271 var timer = try Timer.start();
279 sleep(0, 10 * ns_per_ms);272 sleep(0, 10 * ns_per_ms);
280 const time_0 = timer.read();273 const time_0 = timer.read();
281 debug.assert(time_0 > 0 and time_0 < margin);274 debug.assert(time_0 > 0 and time_0 < margin);
282 275
283 const time_1 = timer.lap();276 const time_1 = timer.lap();
284 debug.assert(time_1 >= time_0);277 debug.assert(time_1 >= time_0);
285 278
286 timer.reset();279 timer.reset();
287 debug.assert(timer.read() < time_1);280 debug.assert(timer.read() < time_1);
288}281}
std/os/windows/error.zig+1188
...@@ -1,2379 +1,3567 @@...@@ -1,2379 +1,3567 @@
1/// The operation completed successfully.1/// The operation completed successfully.
2pub const SUCCESS = 0;2pub const SUCCESS = 0;
3
3/// Incorrect function.4/// Incorrect function.
4pub const INVALID_FUNCTION = 1;5pub const INVALID_FUNCTION = 1;
6
5/// The system cannot find the file specified.7/// The system cannot find the file specified.
6pub const FILE_NOT_FOUND = 2;8pub const FILE_NOT_FOUND = 2;
9
7/// The system cannot find the path specified.10/// The system cannot find the path specified.
8pub const PATH_NOT_FOUND = 3;11pub const PATH_NOT_FOUND = 3;
12
9/// The system cannot open the file.13/// The system cannot open the file.
10pub const TOO_MANY_OPEN_FILES = 4;14pub const TOO_MANY_OPEN_FILES = 4;
15
11/// Access is denied.16/// Access is denied.
12pub const ACCESS_DENIED = 5;17pub const ACCESS_DENIED = 5;
18
13/// The handle is invalid.19/// The handle is invalid.
14pub const INVALID_HANDLE = 6;20pub const INVALID_HANDLE = 6;
21
15/// The storage control blocks were destroyed.22/// The storage control blocks were destroyed.
16pub const ARENA_TRASHED = 7;23pub const ARENA_TRASHED = 7;
24
17/// Not enough storage is available to process this command.25/// Not enough storage is available to process this command.
18pub const NOT_ENOUGH_MEMORY = 8;26pub const NOT_ENOUGH_MEMORY = 8;
27
19/// The storage control block address is invalid.28/// The storage control block address is invalid.
20pub const INVALID_BLOCK = 9;29pub const INVALID_BLOCK = 9;
30
21/// The environment is incorrect.31/// The environment is incorrect.
22pub const BAD_ENVIRONMENT = 10;32pub const BAD_ENVIRONMENT = 10;
33
23/// An attempt was made to load a program with an incorrect format.34/// An attempt was made to load a program with an incorrect format.
24pub const BAD_FORMAT = 11;35pub const BAD_FORMAT = 11;
36
25/// The access code is invalid.37/// The access code is invalid.
26pub const INVALID_ACCESS = 12;38pub const INVALID_ACCESS = 12;
39
27/// The data is invalid.40/// The data is invalid.
28pub const INVALID_DATA = 13;41pub const INVALID_DATA = 13;
42
29/// Not enough storage is available to complete this operation.43/// Not enough storage is available to complete this operation.
30pub const OUTOFMEMORY = 14;44pub const OUTOFMEMORY = 14;
45
31/// The system cannot find the drive specified.46/// The system cannot find the drive specified.
32pub const INVALID_DRIVE = 15;47pub const INVALID_DRIVE = 15;
48
33/// The directory cannot be removed.49/// The directory cannot be removed.
34pub const CURRENT_DIRECTORY = 16;50pub const CURRENT_DIRECTORY = 16;
51
35/// The system cannot move the file to a different disk drive.52/// The system cannot move the file to a different disk drive.
36pub const NOT_SAME_DEVICE = 17;53pub const NOT_SAME_DEVICE = 17;
54
37/// There are no more files.55/// There are no more files.
38pub const NO_MORE_FILES = 18;56pub const NO_MORE_FILES = 18;
57
39/// The media is write protected.58/// The media is write protected.
40pub const WRITE_PROTECT = 19;59pub const WRITE_PROTECT = 19;
60
41/// The system cannot find the device specified.61/// The system cannot find the device specified.
42pub const BAD_UNIT = 20;62pub const BAD_UNIT = 20;
63
43/// The device is not ready.64/// The device is not ready.
44pub const NOT_READY = 21;65pub const NOT_READY = 21;
66
45/// The device does not recognize the command.67/// The device does not recognize the command.
46pub const BAD_COMMAND = 22;68pub const BAD_COMMAND = 22;
69
47/// Data error (cyclic redundancy check).70/// Data error (cyclic redundancy check).
48pub const CRC = 23;71pub const CRC = 23;
72
49/// The program issued a command but the command length is incorrect.73/// The program issued a command but the command length is incorrect.
50pub const BAD_LENGTH = 24;74pub const BAD_LENGTH = 24;
75
51/// The drive cannot locate a specific area or track on the disk.76/// The drive cannot locate a specific area or track on the disk.
52pub const SEEK = 25;77pub const SEEK = 25;
78
53/// The specified disk or diskette cannot be accessed.79/// The specified disk or diskette cannot be accessed.
54pub const NOT_DOS_DISK = 26;80pub const NOT_DOS_DISK = 26;
81
55/// The drive cannot find the sector requested.82/// The drive cannot find the sector requested.
56pub const SECTOR_NOT_FOUND = 27;83pub const SECTOR_NOT_FOUND = 27;
84
57/// The printer is out of paper.85/// The printer is out of paper.
58pub const OUT_OF_PAPER = 28;86pub const OUT_OF_PAPER = 28;
87
59/// The system cannot write to the specified device.88/// The system cannot write to the specified device.
60pub const WRITE_FAULT = 29;89pub const WRITE_FAULT = 29;
90
61/// The system cannot read from the specified device.91/// The system cannot read from the specified device.
62pub const READ_FAULT = 30;92pub const READ_FAULT = 30;
93
63/// A device attached to the system is not functioning.94/// A device attached to the system is not functioning.
64pub const GEN_FAILURE = 31;95pub const GEN_FAILURE = 31;
96
65/// The process cannot access the file because it is being used by another process.97/// The process cannot access the file because it is being used by another process.
66pub const SHARING_VIOLATION = 32;98pub const SHARING_VIOLATION = 32;
99
67/// The process cannot access the file because another process has locked a portion of the file.100/// The process cannot access the file because another process has locked a portion of the file.
68pub const LOCK_VIOLATION = 33;101pub const LOCK_VIOLATION = 33;
102
69/// The wrong diskette is in the drive. Insert %2 (Volume Serial Number: %3) into drive %1.103/// The wrong diskette is in the drive. Insert %2 (Volume Serial Number: %3) into drive %1.
70pub const WRONG_DISK = 34;104pub const WRONG_DISK = 34;
105
71/// Too many files opened for sharing.106/// Too many files opened for sharing.
72pub const SHARING_BUFFER_EXCEEDED = 36;107pub const SHARING_BUFFER_EXCEEDED = 36;
108
73/// Reached the end of the file.109/// Reached the end of the file.
74pub const HANDLE_EOF = 38;110pub const HANDLE_EOF = 38;
111
75/// The disk is full.112/// The disk is full.
76pub const HANDLE_DISK_FULL = 39;113pub const HANDLE_DISK_FULL = 39;
114
77/// The request is not supported.115/// The request is not supported.
78pub const NOT_SUPPORTED = 50;116pub const NOT_SUPPORTED = 50;
117
79/// Windows cannot find the network path. Verify that the network path is correct and the destination computer is not busy or turned off. If Windows still cannot find the network path, contact your network administrator.118/// Windows cannot find the network path. Verify that the network path is correct and the destination computer is not busy or turned off. If Windows still cannot find the network path, contact your network administrator.
80pub const REM_NOT_LIST = 51;119pub const REM_NOT_LIST = 51;
120
81/// You were not connected because a duplicate name exists on the network. If joining a domain, go to System in Control Panel to change the computer name and try again. If joining a workgroup, choose another workgroup name.121/// You were not connected because a duplicate name exists on the network. If joining a domain, go to System in Control Panel to change the computer name and try again. If joining a workgroup, choose another workgroup name.
82pub const DUP_NAME = 52;122pub const DUP_NAME = 52;
123
83/// The network path was not found.124/// The network path was not found.
84pub const BAD_NETPATH = 53;125pub const BAD_NETPATH = 53;
126
85/// The network is busy.127/// The network is busy.
86pub const NETWORK_BUSY = 54;128pub const NETWORK_BUSY = 54;
129
87/// The specified network resource or device is no longer available.130/// The specified network resource or device is no longer available.
88pub const DEV_NOT_EXIST = 55;131pub const DEV_NOT_EXIST = 55;
132
89/// The network BIOS command limit has been reached.133/// The network BIOS command limit has been reached.
90pub const TOO_MANY_CMDS = 56;134pub const TOO_MANY_CMDS = 56;
135
91/// A network adapter hardware error occurred.136/// A network adapter hardware error occurred.
92pub const ADAP_HDW_ERR = 57;137pub const ADAP_HDW_ERR = 57;
138
93/// The specified server cannot perform the requested operation.139/// The specified server cannot perform the requested operation.
94pub const BAD_NET_RESP = 58;140pub const BAD_NET_RESP = 58;
141
95/// An unexpected network error occurred.142/// An unexpected network error occurred.
96pub const UNEXP_NET_ERR = 59;143pub const UNEXP_NET_ERR = 59;
144
97/// The remote adapter is not compatible.145/// The remote adapter is not compatible.
98pub const BAD_REM_ADAP = 60;146pub const BAD_REM_ADAP = 60;
147
99/// The printer queue is full.148/// The printer queue is full.
100pub const PRINTQ_FULL = 61;149pub const PRINTQ_FULL = 61;
150
101/// Space to store the file waiting to be printed is not available on the server.151/// Space to store the file waiting to be printed is not available on the server.
102pub const NO_SPOOL_SPACE = 62;152pub const NO_SPOOL_SPACE = 62;
153
103/// Your file waiting to be printed was deleted.154/// Your file waiting to be printed was deleted.
104pub const PRINT_CANCELLED = 63;155pub const PRINT_CANCELLED = 63;
156
105/// The specified network name is no longer available.157/// The specified network name is no longer available.
106pub const NETNAME_DELETED = 64;158pub const NETNAME_DELETED = 64;
159
107/// Network access is denied.160/// Network access is denied.
108pub const NETWORK_ACCESS_DENIED = 65;161pub const NETWORK_ACCESS_DENIED = 65;
162
109/// The network resource type is not correct.163/// The network resource type is not correct.
110pub const BAD_DEV_TYPE = 66;164pub const BAD_DEV_TYPE = 66;
165
111/// The network name cannot be found.166/// The network name cannot be found.
112pub const BAD_NET_NAME = 67;167pub const BAD_NET_NAME = 67;
168
113/// The name limit for the local computer network adapter card was exceeded.169/// The name limit for the local computer network adapter card was exceeded.
114pub const TOO_MANY_NAMES = 68;170pub const TOO_MANY_NAMES = 68;
171
115/// The network BIOS session limit was exceeded.172/// The network BIOS session limit was exceeded.
116pub const TOO_MANY_SESS = 69;173pub const TOO_MANY_SESS = 69;
174
117/// The remote server has been paused or is in the process of being started.175/// The remote server has been paused or is in the process of being started.
118pub const SHARING_PAUSED = 70;176pub const SHARING_PAUSED = 70;
177
119/// No more connections can be made to this remote computer at this time because there are already as many connections as the computer can accept.178/// No more connections can be made to this remote computer at this time because there are already as many connections as the computer can accept.
120pub const REQ_NOT_ACCEP = 71;179pub const REQ_NOT_ACCEP = 71;
180
121/// The specified printer or disk device has been paused.181/// The specified printer or disk device has been paused.
122pub const REDIR_PAUSED = 72;182pub const REDIR_PAUSED = 72;
183
123/// The file exists.184/// The file exists.
124pub const FILE_EXISTS = 80;185pub const FILE_EXISTS = 80;
186
125/// The directory or file cannot be created.187/// The directory or file cannot be created.
126pub const CANNOT_MAKE = 82;188pub const CANNOT_MAKE = 82;
189
127/// Fail on INT 24.190/// Fail on INT 24.
128pub const FAIL_I24 = 83;191pub const FAIL_I24 = 83;
192
129/// Storage to process this request is not available.193/// Storage to process this request is not available.
130pub const OUT_OF_STRUCTURES = 84;194pub const OUT_OF_STRUCTURES = 84;
195
131/// The local device name is already in use.196/// The local device name is already in use.
132pub const ALREADY_ASSIGNED = 85;197pub const ALREADY_ASSIGNED = 85;
198
133/// The specified network password is not correct.199/// The specified network password is not correct.
134pub const INVALID_PASSWORD = 86;200pub const INVALID_PASSWORD = 86;
201
135/// The parameter is incorrect.202/// The parameter is incorrect.
136pub const INVALID_PARAMETER = 87;203pub const INVALID_PARAMETER = 87;
204
137/// A write fault occurred on the network.205/// A write fault occurred on the network.
138pub const NET_WRITE_FAULT = 88;206pub const NET_WRITE_FAULT = 88;
207
139/// The system cannot start another process at this time.208/// The system cannot start another process at this time.
140pub const NO_PROC_SLOTS = 89;209pub const NO_PROC_SLOTS = 89;
210
141/// Cannot create another system semaphore.211/// Cannot create another system semaphore.
142pub const TOO_MANY_SEMAPHORES = 100;212pub const TOO_MANY_SEMAPHORES = 100;
213
143/// The exclusive semaphore is owned by another process.214/// The exclusive semaphore is owned by another process.
144pub const EXCL_SEM_ALREADY_OWNED = 101;215pub const EXCL_SEM_ALREADY_OWNED = 101;
216
145/// The semaphore is set and cannot be closed.217/// The semaphore is set and cannot be closed.
146pub const SEM_IS_SET = 102;218pub const SEM_IS_SET = 102;
219
147/// The semaphore cannot be set again.220/// The semaphore cannot be set again.
148pub const TOO_MANY_SEM_REQUESTS = 103;221pub const TOO_MANY_SEM_REQUESTS = 103;
222
149/// Cannot request exclusive semaphores at interrupt time.223/// Cannot request exclusive semaphores at interrupt time.
150pub const INVALID_AT_INTERRUPT_TIME = 104;224pub const INVALID_AT_INTERRUPT_TIME = 104;
225
151/// The previous ownership of this semaphore has ended.226/// The previous ownership of this semaphore has ended.
152pub const SEM_OWNER_DIED = 105;227pub const SEM_OWNER_DIED = 105;
228
153/// Insert the diskette for drive %1.229/// Insert the diskette for drive %1.
154pub const SEM_USER_LIMIT = 106;230pub const SEM_USER_LIMIT = 106;
231
155/// The program stopped because an alternate diskette was not inserted.232/// The program stopped because an alternate diskette was not inserted.
156pub const DISK_CHANGE = 107;233pub const DISK_CHANGE = 107;
234
157/// The disk is in use or locked by another process.235/// The disk is in use or locked by another process.
158pub const DRIVE_LOCKED = 108;236pub const DRIVE_LOCKED = 108;
237
159/// The pipe has been ended.238/// The pipe has been ended.
160pub const BROKEN_PIPE = 109;239pub const BROKEN_PIPE = 109;
240
161/// The system cannot open the device or file specified.241/// The system cannot open the device or file specified.
162pub const OPEN_FAILED = 110;242pub const OPEN_FAILED = 110;
243
163/// The file name is too long.244/// The file name is too long.
164pub const BUFFER_OVERFLOW = 111;245pub const BUFFER_OVERFLOW = 111;
246
165/// There is not enough space on the disk.247/// There is not enough space on the disk.
166pub const DISK_FULL = 112;248pub const DISK_FULL = 112;
249
167/// No more internal file identifiers available.250/// No more internal file identifiers available.
168pub const NO_MORE_SEARCH_HANDLES = 113;251pub const NO_MORE_SEARCH_HANDLES = 113;
252
169/// The target internal file identifier is incorrect.253/// The target internal file identifier is incorrect.
170pub const INVALID_TARGET_HANDLE = 114;254pub const INVALID_TARGET_HANDLE = 114;
255
171/// The IOCTL call made by the application program is not correct.256/// The IOCTL call made by the application program is not correct.
172pub const INVALID_CATEGORY = 117;257pub const INVALID_CATEGORY = 117;
258
173/// The verify-on-write switch parameter value is not correct.259/// The verify-on-write switch parameter value is not correct.
174pub const INVALID_VERIFY_SWITCH = 118;260pub const INVALID_VERIFY_SWITCH = 118;
261
175/// The system does not support the command requested.262/// The system does not support the command requested.
176pub const BAD_DRIVER_LEVEL = 119;263pub const BAD_DRIVER_LEVEL = 119;
264
177/// This function is not supported on this system.265/// This function is not supported on this system.
178pub const CALL_NOT_IMPLEMENTED = 120;266pub const CALL_NOT_IMPLEMENTED = 120;
267
179/// The semaphore timeout period has expired.268/// The semaphore timeout period has expired.
180pub const SEM_TIMEOUT = 121;269pub const SEM_TIMEOUT = 121;
270
181/// The data area passed to a system call is too small.271/// The data area passed to a system call is too small.
182pub const INSUFFICIENT_BUFFER = 122;272pub const INSUFFICIENT_BUFFER = 122;
273
183/// The filename, directory name, or volume label syntax is incorrect.274/// The filename, directory name, or volume label syntax is incorrect.
184pub const INVALID_NAME = 123;275pub const INVALID_NAME = 123;
276
185/// The system call level is not correct.277/// The system call level is not correct.
186pub const INVALID_LEVEL = 124;278pub const INVALID_LEVEL = 124;
279
187/// The disk has no volume label.280/// The disk has no volume label.
188pub const NO_VOLUME_LABEL = 125;281pub const NO_VOLUME_LABEL = 125;
282
189/// The specified module could not be found.283/// The specified module could not be found.
190pub const MOD_NOT_FOUND = 126;284pub const MOD_NOT_FOUND = 126;
285
191/// The specified procedure could not be found.286/// The specified procedure could not be found.
192pub const PROC_NOT_FOUND = 127;287pub const PROC_NOT_FOUND = 127;
288
193/// There are no child processes to wait for.289/// There are no child processes to wait for.
194pub const WAIT_NO_CHILDREN = 128;290pub const WAIT_NO_CHILDREN = 128;
291
195/// The %1 application cannot be run in Win32 mode.292/// The %1 application cannot be run in Win32 mode.
196pub const CHILD_NOT_COMPLETE = 129;293pub const CHILD_NOT_COMPLETE = 129;
294
197/// Attempt to use a file handle to an open disk partition for an operation other than raw disk I/O.295/// Attempt to use a file handle to an open disk partition for an operation other than raw disk I/O.
198pub const DIRECT_ACCESS_HANDLE = 130;296pub const DIRECT_ACCESS_HANDLE = 130;
297
199/// An attempt was made to move the file pointer before the beginning of the file.298/// An attempt was made to move the file pointer before the beginning of the file.
200pub const NEGATIVE_SEEK = 131;299pub const NEGATIVE_SEEK = 131;
300
201/// The file pointer cannot be set on the specified device or file.301/// The file pointer cannot be set on the specified device or file.
202pub const SEEK_ON_DEVICE = 132;302pub const SEEK_ON_DEVICE = 132;
303
203/// A JOIN or SUBST command cannot be used for a drive that contains previously joined drives.304/// A JOIN or SUBST command cannot be used for a drive that contains previously joined drives.
204pub const IS_JOIN_TARGET = 133;305pub const IS_JOIN_TARGET = 133;
306
205/// An attempt was made to use a JOIN or SUBST command on a drive that has already been joined.307/// An attempt was made to use a JOIN or SUBST command on a drive that has already been joined.
206pub const IS_JOINED = 134;308pub const IS_JOINED = 134;
309
207/// An attempt was made to use a JOIN or SUBST command on a drive that has already been substituted.310/// An attempt was made to use a JOIN or SUBST command on a drive that has already been substituted.
208pub const IS_SUBSTED = 135;311pub const IS_SUBSTED = 135;
312
209/// The system tried to delete the JOIN of a drive that is not joined.313/// The system tried to delete the JOIN of a drive that is not joined.
210pub const NOT_JOINED = 136;314pub const NOT_JOINED = 136;
315
211/// The system tried to delete the substitution of a drive that is not substituted.316/// The system tried to delete the substitution of a drive that is not substituted.
212pub const NOT_SUBSTED = 137;317pub const NOT_SUBSTED = 137;
318
213/// The system tried to join a drive to a directory on a joined drive.319/// The system tried to join a drive to a directory on a joined drive.
214pub const JOIN_TO_JOIN = 138;320pub const JOIN_TO_JOIN = 138;
321
215/// The system tried to substitute a drive to a directory on a substituted drive.322/// The system tried to substitute a drive to a directory on a substituted drive.
216pub const SUBST_TO_SUBST = 139;323pub const SUBST_TO_SUBST = 139;
324
217/// The system tried to join a drive to a directory on a substituted drive.325/// The system tried to join a drive to a directory on a substituted drive.
218pub const JOIN_TO_SUBST = 140;326pub const JOIN_TO_SUBST = 140;
327
219/// The system tried to SUBST a drive to a directory on a joined drive.328/// The system tried to SUBST a drive to a directory on a joined drive.
220pub const SUBST_TO_JOIN = 141;329pub const SUBST_TO_JOIN = 141;
330
221/// The system cannot perform a JOIN or SUBST at this time.331/// The system cannot perform a JOIN or SUBST at this time.
222pub const BUSY_DRIVE = 142;332pub const BUSY_DRIVE = 142;
333
223/// The system cannot join or substitute a drive to or for a directory on the same drive.334/// The system cannot join or substitute a drive to or for a directory on the same drive.
224pub const SAME_DRIVE = 143;335pub const SAME_DRIVE = 143;
336
225/// The directory is not a subdirectory of the root directory.337/// The directory is not a subdirectory of the root directory.
226pub const DIR_NOT_ROOT = 144;338pub const DIR_NOT_ROOT = 144;
339
227/// The directory is not empty.340/// The directory is not empty.
228pub const DIR_NOT_EMPTY = 145;341pub const DIR_NOT_EMPTY = 145;
342
229/// The path specified is being used in a substitute.343/// The path specified is being used in a substitute.
230pub const IS_SUBST_PATH = 146;344pub const IS_SUBST_PATH = 146;
345
231/// Not enough resources are available to process this command.346/// Not enough resources are available to process this command.
232pub const IS_JOIN_PATH = 147;347pub const IS_JOIN_PATH = 147;
348
233/// The path specified cannot be used at this time.349/// The path specified cannot be used at this time.
234pub const PATH_BUSY = 148;350pub const PATH_BUSY = 148;
351
235/// An attempt was made to join or substitute a drive for which a directory on the drive is the target of a previous substitute.352/// An attempt was made to join or substitute a drive for which a directory on the drive is the target of a previous substitute.
236pub const IS_SUBST_TARGET = 149;353pub const IS_SUBST_TARGET = 149;
354
237/// System trace information was not specified in your CONFIG.SYS file, or tracing is disallowed.355/// System trace information was not specified in your CONFIG.SYS file, or tracing is disallowed.
238pub const SYSTEM_TRACE = 150;356pub const SYSTEM_TRACE = 150;
357
239/// The number of specified semaphore events for DosMuxSemWait is not correct.358/// The number of specified semaphore events for DosMuxSemWait is not correct.
240pub const INVALID_EVENT_COUNT = 151;359pub const INVALID_EVENT_COUNT = 151;
360
241/// DosMuxSemWait did not execute; too many semaphores are already set.361/// DosMuxSemWait did not execute; too many semaphores are already set.
242pub const TOO_MANY_MUXWAITERS = 152;362pub const TOO_MANY_MUXWAITERS = 152;
363
243/// The DosMuxSemWait list is not correct.364/// The DosMuxSemWait list is not correct.
244pub const INVALID_LIST_FORMAT = 153;365pub const INVALID_LIST_FORMAT = 153;
366
245/// The volume label you entered exceeds the label character limit of the target file system.367/// The volume label you entered exceeds the label character limit of the target file system.
246pub const LABEL_TOO_LONG = 154;368pub const LABEL_TOO_LONG = 154;
369
247/// Cannot create another thread.370/// Cannot create another thread.
248pub const TOO_MANY_TCBS = 155;371pub const TOO_MANY_TCBS = 155;
372
249/// The recipient process has refused the signal.373/// The recipient process has refused the signal.
250pub const SIGNAL_REFUSED = 156;374pub const SIGNAL_REFUSED = 156;
375
251/// The segment is already discarded and cannot be locked.376/// The segment is already discarded and cannot be locked.
252pub const DISCARDED = 157;377pub const DISCARDED = 157;
378
253/// The segment is already unlocked.379/// The segment is already unlocked.
254pub const NOT_LOCKED = 158;380pub const NOT_LOCKED = 158;
381
255/// The address for the thread ID is not correct.382/// The address for the thread ID is not correct.
256pub const BAD_THREADID_ADDR = 159;383pub const BAD_THREADID_ADDR = 159;
384
257/// One or more arguments are not correct.385/// One or more arguments are not correct.
258pub const BAD_ARGUMENTS = 160;386pub const BAD_ARGUMENTS = 160;
387
259/// The specified path is invalid.388/// The specified path is invalid.
260pub const BAD_PATHNAME = 161;389pub const BAD_PATHNAME = 161;
390
261/// A signal is already pending.391/// A signal is already pending.
262pub const SIGNAL_PENDING = 162;392pub const SIGNAL_PENDING = 162;
393
263/// No more threads can be created in the system.394/// No more threads can be created in the system.
264pub const MAX_THRDS_REACHED = 164;395pub const MAX_THRDS_REACHED = 164;
396
265/// Unable to lock a region of a file.397/// Unable to lock a region of a file.
266pub const LOCK_FAILED = 167;398pub const LOCK_FAILED = 167;
399
267/// The requested resource is in use.400/// The requested resource is in use.
268pub const BUSY = 170;401pub const BUSY = 170;
402
269/// Device's command support detection is in progress.403/// Device's command support detection is in progress.
270pub const DEVICE_SUPPORT_IN_PROGRESS = 171;404pub const DEVICE_SUPPORT_IN_PROGRESS = 171;
405
271/// A lock request was not outstanding for the supplied cancel region.406/// A lock request was not outstanding for the supplied cancel region.
272pub const CANCEL_VIOLATION = 173;407pub const CANCEL_VIOLATION = 173;
408
273/// The file system does not support atomic changes to the lock type.409/// The file system does not support atomic changes to the lock type.
274pub const ATOMIC_LOCKS_NOT_SUPPORTED = 174;410pub const ATOMIC_LOCKS_NOT_SUPPORTED = 174;
411
275/// The system detected a segment number that was not correct.412/// The system detected a segment number that was not correct.
276pub const INVALID_SEGMENT_NUMBER = 180;413pub const INVALID_SEGMENT_NUMBER = 180;
414
277/// The operating system cannot run %1.415/// The operating system cannot run %1.
278pub const INVALID_ORDINAL = 182;416pub const INVALID_ORDINAL = 182;
417
279/// Cannot create a file when that file already exists.418/// Cannot create a file when that file already exists.
280pub const ALREADY_EXISTS = 183;419pub const ALREADY_EXISTS = 183;
420
281/// The flag passed is not correct.421/// The flag passed is not correct.
282pub const INVALID_FLAG_NUMBER = 186;422pub const INVALID_FLAG_NUMBER = 186;
423
283/// The specified system semaphore name was not found.424/// The specified system semaphore name was not found.
284pub const SEM_NOT_FOUND = 187;425pub const SEM_NOT_FOUND = 187;
426
285/// The operating system cannot run %1.427/// The operating system cannot run %1.
286pub const INVALID_STARTING_CODESEG = 188;428pub const INVALID_STARTING_CODESEG = 188;
429
287/// The operating system cannot run %1.430/// The operating system cannot run %1.
288pub const INVALID_STACKSEG = 189;431pub const INVALID_STACKSEG = 189;
432
289/// The operating system cannot run %1.433/// The operating system cannot run %1.
290pub const INVALID_MODULETYPE = 190;434pub const INVALID_MODULETYPE = 190;
435
291/// Cannot run %1 in Win32 mode.436/// Cannot run %1 in Win32 mode.
292pub const INVALID_EXE_SIGNATURE = 191;437pub const INVALID_EXE_SIGNATURE = 191;
438
293/// The operating system cannot run %1.439/// The operating system cannot run %1.
294pub const EXE_MARKED_INVALID = 192;440pub const EXE_MARKED_INVALID = 192;
441
295/// %1 is not a valid Win32 application.442/// %1 is not a valid Win32 application.
296pub const BAD_EXE_FORMAT = 193;443pub const BAD_EXE_FORMAT = 193;
444
297/// The operating system cannot run %1.445/// The operating system cannot run %1.
298pub const ITERATED_DATA_EXCEEDS_64k = 194;446pub const ITERATED_DATA_EXCEEDS_64k = 194;
447
299/// The operating system cannot run %1.448/// The operating system cannot run %1.
300pub const INVALID_MINALLOCSIZE = 195;449pub const INVALID_MINALLOCSIZE = 195;
450
301/// The operating system cannot run this application program.451/// The operating system cannot run this application program.
302pub const DYNLINK_FROM_INVALID_RING = 196;452pub const DYNLINK_FROM_INVALID_RING = 196;
453
303/// The operating system is not presently configured to run this application.454/// The operating system is not presently configured to run this application.
304pub const IOPL_NOT_ENABLED = 197;455pub const IOPL_NOT_ENABLED = 197;
456
305/// The operating system cannot run %1.457/// The operating system cannot run %1.
306pub const INVALID_SEGDPL = 198;458pub const INVALID_SEGDPL = 198;
459
307/// The operating system cannot run this application program.460/// The operating system cannot run this application program.
308pub const AUTODATASEG_EXCEEDS_64k = 199;461pub const AUTODATASEG_EXCEEDS_64k = 199;
462
309/// The code segment cannot be greater than or equal to 64K.463/// The code segment cannot be greater than or equal to 64K.
310pub const RING2SEG_MUST_BE_MOVABLE = 200;464pub const RING2SEG_MUST_BE_MOVABLE = 200;
465
311/// The operating system cannot run %1.466/// The operating system cannot run %1.
312pub const RELOC_CHAIN_XEEDS_SEGLIM = 201;467pub const RELOC_CHAIN_XEEDS_SEGLIM = 201;
468
313/// The operating system cannot run %1.469/// The operating system cannot run %1.
314pub const INFLOOP_IN_RELOC_CHAIN = 202;470pub const INFLOOP_IN_RELOC_CHAIN = 202;
471
315/// The system could not find the environment option that was entered.472/// The system could not find the environment option that was entered.
316pub const ENVVAR_NOT_FOUND = 203;473pub const ENVVAR_NOT_FOUND = 203;
474
317/// No process in the command subtree has a signal handler.475/// No process in the command subtree has a signal handler.
318pub const NO_SIGNAL_SENT = 205;476pub const NO_SIGNAL_SENT = 205;
477
319/// The filename or extension is too long.478/// The filename or extension is too long.
320pub const FILENAME_EXCED_RANGE = 206;479pub const FILENAME_EXCED_RANGE = 206;
480
321/// The ring 2 stack is in use.481/// The ring 2 stack is in use.
322pub const RING2_STACK_IN_USE = 207;482pub const RING2_STACK_IN_USE = 207;
483
323/// The global filename characters, * or ?, are entered incorrectly or too many global filename characters are specified.484/// The global filename characters, * or ?, are entered incorrectly or too many global filename characters are specified.
324pub const META_EXPANSION_TOO_LONG = 208;485pub const META_EXPANSION_TOO_LONG = 208;
486
325/// The signal being posted is not correct.487/// The signal being posted is not correct.
326pub const INVALID_SIGNAL_NUMBER = 209;488pub const INVALID_SIGNAL_NUMBER = 209;
489
327/// The signal handler cannot be set.490/// The signal handler cannot be set.
328pub const THREAD_1_INACTIVE = 210;491pub const THREAD_1_INACTIVE = 210;
492
329/// The segment is locked and cannot be reallocated.493/// The segment is locked and cannot be reallocated.
330pub const LOCKED = 212;494pub const LOCKED = 212;
495
331/// Too many dynamic-link modules are attached to this program or dynamic-link module.496/// Too many dynamic-link modules are attached to this program or dynamic-link module.
332pub const TOO_MANY_MODULES = 214;497pub const TOO_MANY_MODULES = 214;
498
333/// Cannot nest calls to LoadModule.499/// Cannot nest calls to LoadModule.
334pub const NESTING_NOT_ALLOWED = 215;500pub const NESTING_NOT_ALLOWED = 215;
501
335/// This version of %1 is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher.502/// This version of %1 is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher.
336pub const EXE_MACHINE_TYPE_MISMATCH = 216;503pub const EXE_MACHINE_TYPE_MISMATCH = 216;
504
337/// The image file %1 is signed, unable to modify.505/// The image file %1 is signed, unable to modify.
338pub const EXE_CANNOT_MODIFY_SIGNED_BINARY = 217;506pub const EXE_CANNOT_MODIFY_SIGNED_BINARY = 217;
507
339/// The image file %1 is strong signed, unable to modify.508/// The image file %1 is strong signed, unable to modify.
340pub const EXE_CANNOT_MODIFY_STRONG_SIGNED_BINARY = 218;509pub const EXE_CANNOT_MODIFY_STRONG_SIGNED_BINARY = 218;
510
341/// This file is checked out or locked for editing by another user.511/// This file is checked out or locked for editing by another user.
342pub const FILE_CHECKED_OUT = 220;512pub const FILE_CHECKED_OUT = 220;
513
343/// The file must be checked out before saving changes.514/// The file must be checked out before saving changes.
344pub const CHECKOUT_REQUIRED = 221;515pub const CHECKOUT_REQUIRED = 221;
516
345/// The file type being saved or retrieved has been blocked.517/// The file type being saved or retrieved has been blocked.
346pub const BAD_FILE_TYPE = 222;518pub const BAD_FILE_TYPE = 222;
519
347/// The file size exceeds the limit allowed and cannot be saved.520/// The file size exceeds the limit allowed and cannot be saved.
348pub const FILE_TOO_LARGE = 223;521pub const FILE_TOO_LARGE = 223;
522
349/// Access Denied. Before opening files in this location, you must first add the web site to your trusted sites list, browse to the web site, and select the option to login automatically.523/// Access Denied. Before opening files in this location, you must first add the web site to your trusted sites list, browse to the web site, and select the option to login automatically.
350pub const FORMS_AUTH_REQUIRED = 224;524pub const FORMS_AUTH_REQUIRED = 224;
525
351/// Operation did not complete successfully because the file contains a virus or potentially unwanted software.526/// Operation did not complete successfully because the file contains a virus or potentially unwanted software.
352pub const VIRUS_INFECTED = 225;527pub const VIRUS_INFECTED = 225;
528
353/// This file contains a virus or potentially unwanted software and cannot be opened. Due to the nature of this virus or potentially unwanted software, the file has been removed from this location.529/// This file contains a virus or potentially unwanted software and cannot be opened. Due to the nature of this virus or potentially unwanted software, the file has been removed from this location.
354pub const VIRUS_DELETED = 226;530pub const VIRUS_DELETED = 226;
531
355/// The pipe is local.532/// The pipe is local.
356pub const PIPE_LOCAL = 229;533pub const PIPE_LOCAL = 229;
534
357/// The pipe state is invalid.535/// The pipe state is invalid.
358pub const BAD_PIPE = 230;536pub const BAD_PIPE = 230;
537
359/// All pipe instances are busy.538/// All pipe instances are busy.
360pub const PIPE_BUSY = 231;539pub const PIPE_BUSY = 231;
540
361/// The pipe is being closed.541/// The pipe is being closed.
362pub const NO_DATA = 232;542pub const NO_DATA = 232;
543
363/// No process is on the other end of the pipe.544/// No process is on the other end of the pipe.
364pub const PIPE_NOT_CONNECTED = 233;545pub const PIPE_NOT_CONNECTED = 233;
546
365/// More data is available.547/// More data is available.
366pub const MORE_DATA = 234;548pub const MORE_DATA = 234;
549
367/// The session was canceled.550/// The session was canceled.
368pub const VC_DISCONNECTED = 240;551pub const VC_DISCONNECTED = 240;
552
369/// The specified extended attribute name was invalid.553/// The specified extended attribute name was invalid.
370pub const INVALID_EA_NAME = 254;554pub const INVALID_EA_NAME = 254;
555
371/// The extended attributes are inconsistent.556/// The extended attributes are inconsistent.
372pub const EA_LIST_INCONSISTENT = 255;557pub const EA_LIST_INCONSISTENT = 255;
558
373/// The wait operation timed out.559/// The wait operation timed out.
374pub const IMEOUT = 258;560pub const IMEOUT = 258;
561
375/// No more data is available.562/// No more data is available.
376pub const NO_MORE_ITEMS = 259;563pub const NO_MORE_ITEMS = 259;
564
377/// The copy functions cannot be used.565/// The copy functions cannot be used.
378pub const CANNOT_COPY = 266;566pub const CANNOT_COPY = 266;
567
379/// The directory name is invalid.568/// The directory name is invalid.
380pub const DIRECTORY = 267;569pub const DIRECTORY = 267;
570
381/// The extended attributes did not fit in the buffer.571/// The extended attributes did not fit in the buffer.
382pub const EAS_DIDNT_FIT = 275;572pub const EAS_DIDNT_FIT = 275;
573
383/// The extended attribute file on the mounted file system is corrupt.574/// The extended attribute file on the mounted file system is corrupt.
384pub const EA_FILE_CORRUPT = 276;575pub const EA_FILE_CORRUPT = 276;
576
385/// The extended attribute table file is full.577/// The extended attribute table file is full.
386pub const EA_TABLE_FULL = 277;578pub const EA_TABLE_FULL = 277;
579
387/// The specified extended attribute handle is invalid.580/// The specified extended attribute handle is invalid.
388pub const INVALID_EA_HANDLE = 278;581pub const INVALID_EA_HANDLE = 278;
582
389/// The mounted file system does not support extended attributes.583/// The mounted file system does not support extended attributes.
390pub const EAS_NOT_SUPPORTED = 282;584pub const EAS_NOT_SUPPORTED = 282;
585
391/// Attempt to release mutex not owned by caller.586/// Attempt to release mutex not owned by caller.
392pub const NOT_OWNER = 288;587pub const NOT_OWNER = 288;
588
393/// Too many posts were made to a semaphore.589/// Too many posts were made to a semaphore.
394pub const TOO_MANY_POSTS = 298;590pub const TOO_MANY_POSTS = 298;
591
395/// Only part of a ReadProcessMemory or WriteProcessMemory request was completed.592/// Only part of a ReadProcessMemory or WriteProcessMemory request was completed.
396pub const PARTIAL_COPY = 299;593pub const PARTIAL_COPY = 299;
594
397/// The oplock request is denied.595/// The oplock request is denied.
398pub const OPLOCK_NOT_GRANTED = 300;596pub const OPLOCK_NOT_GRANTED = 300;
597
399/// An invalid oplock acknowledgment was received by the system.598/// An invalid oplock acknowledgment was received by the system.
400pub const INVALID_OPLOCK_PROTOCOL = 301;599pub const INVALID_OPLOCK_PROTOCOL = 301;
600
401/// The volume is too fragmented to complete this operation.601/// The volume is too fragmented to complete this operation.
402pub const DISK_TOO_FRAGMENTED = 302;602pub const DISK_TOO_FRAGMENTED = 302;
603
403/// The file cannot be opened because it is in the process of being deleted.604/// The file cannot be opened because it is in the process of being deleted.
404pub const DELETE_PENDING = 303;605pub const DELETE_PENDING = 303;
606
405/// Short name settings may not be changed on this volume due to the global registry setting.607/// Short name settings may not be changed on this volume due to the global registry setting.
406pub const INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING = 304;608pub const INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING = 304;
609
407/// Short names are not enabled on this volume.610/// Short names are not enabled on this volume.
408pub const SHORT_NAMES_NOT_ENABLED_ON_VOLUME = 305;611pub const SHORT_NAMES_NOT_ENABLED_ON_VOLUME = 305;
612
409/// The security stream for the given volume is in an inconsistent state. Please run CHKDSK on the volume.613/// The security stream for the given volume is in an inconsistent state. Please run CHKDSK on the volume.
410pub const SECURITY_STREAM_IS_INCONSISTENT = 306;614pub const SECURITY_STREAM_IS_INCONSISTENT = 306;
615
411/// A requested file lock operation cannot be processed due to an invalid byte range.616/// A requested file lock operation cannot be processed due to an invalid byte range.
412pub const INVALID_LOCK_RANGE = 307;617pub const INVALID_LOCK_RANGE = 307;
618
413/// The subsystem needed to support the image type is not present.619/// The subsystem needed to support the image type is not present.
414pub const IMAGE_SUBSYSTEM_NOT_PRESENT = 308;620pub const IMAGE_SUBSYSTEM_NOT_PRESENT = 308;
621
415/// The specified file already has a notification GUID associated with it.622/// The specified file already has a notification GUID associated with it.
416pub const NOTIFICATION_GUID_ALREADY_DEFINED = 309;623pub const NOTIFICATION_GUID_ALREADY_DEFINED = 309;
624
417/// An invalid exception handler routine has been detected.625/// An invalid exception handler routine has been detected.
418pub const INVALID_EXCEPTION_HANDLER = 310;626pub const INVALID_EXCEPTION_HANDLER = 310;
627
419/// Duplicate privileges were specified for the token.628/// Duplicate privileges were specified for the token.
420pub const DUPLICATE_PRIVILEGES = 311;629pub const DUPLICATE_PRIVILEGES = 311;
630
421/// No ranges for the specified operation were able to be processed.631/// No ranges for the specified operation were able to be processed.
422pub const NO_RANGES_PROCESSED = 312;632pub const NO_RANGES_PROCESSED = 312;
633
423/// Operation is not allowed on a file system internal file.634/// Operation is not allowed on a file system internal file.
424pub const NOT_ALLOWED_ON_SYSTEM_FILE = 313;635pub const NOT_ALLOWED_ON_SYSTEM_FILE = 313;
636
425/// The physical resources of this disk have been exhausted.637/// The physical resources of this disk have been exhausted.
426pub const DISK_RESOURCES_EXHAUSTED = 314;638pub const DISK_RESOURCES_EXHAUSTED = 314;
639
427/// The token representing the data is invalid.640/// The token representing the data is invalid.
428pub const INVALID_TOKEN = 315;641pub const INVALID_TOKEN = 315;
642
429/// The device does not support the command feature.643/// The device does not support the command feature.
430pub const DEVICE_FEATURE_NOT_SUPPORTED = 316;644pub const DEVICE_FEATURE_NOT_SUPPORTED = 316;
645
431/// The system cannot find message text for message number 0x%1 in the message file for %2.646/// The system cannot find message text for message number 0x%1 in the message file for %2.
432pub const MR_MID_NOT_FOUND = 317;647pub const MR_MID_NOT_FOUND = 317;
648
433/// The scope specified was not found.649/// The scope specified was not found.
434pub const SCOPE_NOT_FOUND = 318;650pub const SCOPE_NOT_FOUND = 318;
651
435/// The Central Access Policy specified is not defined on the target machine.652/// The Central Access Policy specified is not defined on the target machine.
436pub const UNDEFINED_SCOPE = 319;653pub const UNDEFINED_SCOPE = 319;
654
437/// The Central Access Policy obtained from Active Directory is invalid.655/// The Central Access Policy obtained from Active Directory is invalid.
438pub const INVALID_CAP = 320;656pub const INVALID_CAP = 320;
657
439/// The device is unreachable.658/// The device is unreachable.
440pub const DEVICE_UNREACHABLE = 321;659pub const DEVICE_UNREACHABLE = 321;
660
441/// The target device has insufficient resources to complete the operation.661/// The target device has insufficient resources to complete the operation.
442pub const DEVICE_NO_RESOURCES = 322;662pub const DEVICE_NO_RESOURCES = 322;
663
443/// A data integrity checksum error occurred. Data in the file stream is corrupt.664/// A data integrity checksum error occurred. Data in the file stream is corrupt.
444pub const DATA_CHECKSUM_ERROR = 323;665pub const DATA_CHECKSUM_ERROR = 323;
666
445/// An attempt was made to modify both a KERNEL and normal Extended Attribute (EA) in the same operation.667/// An attempt was made to modify both a KERNEL and normal Extended Attribute (EA) in the same operation.
446pub const INTERMIXED_KERNEL_EA_OPERATION = 324;668pub const INTERMIXED_KERNEL_EA_OPERATION = 324;
669
447/// Device does not support file-level TRIM.670/// Device does not support file-level TRIM.
448pub const FILE_LEVEL_TRIM_NOT_SUPPORTED = 326;671pub const FILE_LEVEL_TRIM_NOT_SUPPORTED = 326;
672
449/// The command specified a data offset that does not align to the device's granularity/alignment.673/// The command specified a data offset that does not align to the device's granularity/alignment.
450pub const OFFSET_ALIGNMENT_VIOLATION = 327;674pub const OFFSET_ALIGNMENT_VIOLATION = 327;
675
451/// The command specified an invalid field in its parameter list.676/// The command specified an invalid field in its parameter list.
452pub const INVALID_FIELD_IN_PARAMETER_LIST = 328;677pub const INVALID_FIELD_IN_PARAMETER_LIST = 328;
678
453/// An operation is currently in progress with the device.679/// An operation is currently in progress with the device.
454pub const OPERATION_IN_PROGRESS = 329;680pub const OPERATION_IN_PROGRESS = 329;
681
455/// An attempt was made to send down the command via an invalid path to the target device.682/// An attempt was made to send down the command via an invalid path to the target device.
456pub const BAD_DEVICE_PATH = 330;683pub const BAD_DEVICE_PATH = 330;
684
457/// The command specified a number of descriptors that exceeded the maximum supported by the device.685/// The command specified a number of descriptors that exceeded the maximum supported by the device.
458pub const TOO_MANY_DESCRIPTORS = 331;686pub const TOO_MANY_DESCRIPTORS = 331;
687
459/// Scrub is disabled on the specified file.688/// Scrub is disabled on the specified file.
460pub const SCRUB_DATA_DISABLED = 332;689pub const SCRUB_DATA_DISABLED = 332;
690
461/// The storage device does not provide redundancy.691/// The storage device does not provide redundancy.
462pub const NOT_REDUNDANT_STORAGE = 333;692pub const NOT_REDUNDANT_STORAGE = 333;
693
463/// An operation is not supported on a resident file.694/// An operation is not supported on a resident file.
464pub const RESIDENT_FILE_NOT_SUPPORTED = 334;695pub const RESIDENT_FILE_NOT_SUPPORTED = 334;
696
465/// An operation is not supported on a compressed file.697/// An operation is not supported on a compressed file.
466pub const COMPRESSED_FILE_NOT_SUPPORTED = 335;698pub const COMPRESSED_FILE_NOT_SUPPORTED = 335;
699
467/// An operation is not supported on a directory.700/// An operation is not supported on a directory.
468pub const DIRECTORY_NOT_SUPPORTED = 336;701pub const DIRECTORY_NOT_SUPPORTED = 336;
702
469/// The specified copy of the requested data could not be read.703/// The specified copy of the requested data could not be read.
470pub const NOT_READ_FROM_COPY = 337;704pub const NOT_READ_FROM_COPY = 337;
705
471/// No action was taken as a system reboot is required.706/// No action was taken as a system reboot is required.
472pub const FAIL_NOACTION_REBOOT = 350;707pub const FAIL_NOACTION_REBOOT = 350;
708
473/// The shutdown operation failed.709/// The shutdown operation failed.
474pub const FAIL_SHUTDOWN = 351;710pub const FAIL_SHUTDOWN = 351;
711
475/// The restart operation failed.712/// The restart operation failed.
476pub const FAIL_RESTART = 352;713pub const FAIL_RESTART = 352;
714
477/// The maximum number of sessions has been reached.715/// The maximum number of sessions has been reached.
478pub const MAX_SESSIONS_REACHED = 353;716pub const MAX_SESSIONS_REACHED = 353;
717
479/// The thread is already in background processing mode.718/// The thread is already in background processing mode.
480pub const THREAD_MODE_ALREADY_BACKGROUND = 400;719pub const THREAD_MODE_ALREADY_BACKGROUND = 400;
720
481/// The thread is not in background processing mode.721/// The thread is not in background processing mode.
482pub const THREAD_MODE_NOT_BACKGROUND = 401;722pub const THREAD_MODE_NOT_BACKGROUND = 401;
723
483/// The process is already in background processing mode.724/// The process is already in background processing mode.
484pub const PROCESS_MODE_ALREADY_BACKGROUND = 402;725pub const PROCESS_MODE_ALREADY_BACKGROUND = 402;
726
485/// The process is not in background processing mode.727/// The process is not in background processing mode.
486pub const PROCESS_MODE_NOT_BACKGROUND = 403;728pub const PROCESS_MODE_NOT_BACKGROUND = 403;
729
487/// Attempt to access invalid address.730/// Attempt to access invalid address.
488pub const INVALID_ADDRESS = 487;731pub const INVALID_ADDRESS = 487;
732
489/// User profile cannot be loaded.733/// User profile cannot be loaded.
490pub const USER_PROFILE_LOAD = 500;734pub const USER_PROFILE_LOAD = 500;
735
491/// Arithmetic result exceeded 32 bits.736/// Arithmetic result exceeded 32 bits.
492pub const ARITHMETIC_OVERFLOW = 534;737pub const ARITHMETIC_OVERFLOW = 534;
738
493/// There is a process on other end of the pipe.739/// There is a process on other end of the pipe.
494pub const PIPE_CONNECTED = 535;740pub const PIPE_CONNECTED = 535;
741
495/// Waiting for a process to open the other end of the pipe.742/// Waiting for a process to open the other end of the pipe.
496pub const PIPE_LISTENING = 536;743pub const PIPE_LISTENING = 536;
744
497/// Application verifier has found an error in the current process.745/// Application verifier has found an error in the current process.
498pub const VERIFIER_STOP = 537;746pub const VERIFIER_STOP = 537;
747
499/// An error occurred in the ABIOS subsystem.748/// An error occurred in the ABIOS subsystem.
500pub const ABIOS_ERROR = 538;749pub const ABIOS_ERROR = 538;
750
501/// A warning occurred in the WX86 subsystem.751/// A warning occurred in the WX86 subsystem.
502pub const WX86_WARNING = 539;752pub const WX86_WARNING = 539;
753
503/// An error occurred in the WX86 subsystem.754/// An error occurred in the WX86 subsystem.
504pub const WX86_ERROR = 540;755pub const WX86_ERROR = 540;
756
505/// An attempt was made to cancel or set a timer that has an associated APC and the subject thread is not the thread that originally set the timer with an associated APC routine.757/// An attempt was made to cancel or set a timer that has an associated APC and the subject thread is not the thread that originally set the timer with an associated APC routine.
506pub const TIMER_NOT_CANCELED = 541;758pub const TIMER_NOT_CANCELED = 541;
759
507/// Unwind exception code.760/// Unwind exception code.
508pub const UNWIND = 542;761pub const UNWIND = 542;
762
509/// An invalid or unaligned stack was encountered during an unwind operation.763/// An invalid or unaligned stack was encountered during an unwind operation.
510pub const BAD_STACK = 543;764pub const BAD_STACK = 543;
765
511/// An invalid unwind target was encountered during an unwind operation.766/// An invalid unwind target was encountered during an unwind operation.
512pub const INVALID_UNWIND_TARGET = 544;767pub const INVALID_UNWIND_TARGET = 544;
768
513/// Invalid Object Attributes specified to NtCreatePort or invalid Port Attributes specified to NtConnectPort769/// Invalid Object Attributes specified to NtCreatePort or invalid Port Attributes specified to NtConnectPort
514pub const INVALID_PORT_ATTRIBUTES = 545;770pub const INVALID_PORT_ATTRIBUTES = 545;
771
515/// Length of message passed to NtRequestPort or NtRequestWaitReplyPort was longer than the maximum message allowed by the port.772/// Length of message passed to NtRequestPort or NtRequestWaitReplyPort was longer than the maximum message allowed by the port.
516pub const PORT_MESSAGE_TOO_LONG = 546;773pub const PORT_MESSAGE_TOO_LONG = 546;
774
517/// An attempt was made to lower a quota limit below the current usage.775/// An attempt was made to lower a quota limit below the current usage.
518pub const INVALID_QUOTA_LOWER = 547;776pub const INVALID_QUOTA_LOWER = 547;
777
519/// An attempt was made to attach to a device that was already attached to another device.778/// An attempt was made to attach to a device that was already attached to another device.
520pub const DEVICE_ALREADY_ATTACHED = 548;779pub const DEVICE_ALREADY_ATTACHED = 548;
780
521/// An attempt was made to execute an instruction at an unaligned address and the host system does not support unaligned instruction references.781/// An attempt was made to execute an instruction at an unaligned address and the host system does not support unaligned instruction references.
522pub const INSTRUCTION_MISALIGNMENT = 549;782pub const INSTRUCTION_MISALIGNMENT = 549;
783
523/// Profiling not started.784/// Profiling not started.
524pub const PROFILING_NOT_STARTED = 550;785pub const PROFILING_NOT_STARTED = 550;
786
525/// Profiling not stopped.787/// Profiling not stopped.
526pub const PROFILING_NOT_STOPPED = 551;788pub const PROFILING_NOT_STOPPED = 551;
789
527/// The passed ACL did not contain the minimum required information.790/// The passed ACL did not contain the minimum required information.
528pub const COULD_NOT_INTERPRET = 552;791pub const COULD_NOT_INTERPRET = 552;
792
529/// The number of active profiling objects is at the maximum and no more may be started.793/// The number of active profiling objects is at the maximum and no more may be started.
530pub const PROFILING_AT_LIMIT = 553;794pub const PROFILING_AT_LIMIT = 553;
795
531/// Used to indicate that an operation cannot continue without blocking for I/O.796/// Used to indicate that an operation cannot continue without blocking for I/O.
532pub const CANT_WAIT = 554;797pub const CANT_WAIT = 554;
798
533/// Indicates that a thread attempted to terminate itself by default (called NtTerminateThread with NULL) and it was the last thread in the current process.799/// Indicates that a thread attempted to terminate itself by default (called NtTerminateThread with NULL) and it was the last thread in the current process.
534pub const CANT_TERMINATE_SELF = 555;800pub const CANT_TERMINATE_SELF = 555;
801
535/// If an MM error is returned which is not defined in the standard FsRtl filter, it is converted to one of the following errors which is guaranteed to be in the filter. In this case information is lost, however, the filter correctly handles the exception.802/// If an MM error is returned which is not defined in the standard FsRtl filter, it is converted to one of the following errors which is guaranteed to be in the filter. In this case information is lost, however, the filter correctly handles the exception.
536pub const UNEXPECTED_MM_CREATE_ERR = 556;803pub const UNEXPECTED_MM_CREATE_ERR = 556;
804
537/// If an MM error is returned which is not defined in the standard FsRtl filter, it is converted to one of the following errors which is guaranteed to be in the filter. In this case information is lost, however, the filter correctly handles the exception.805/// If an MM error is returned which is not defined in the standard FsRtl filter, it is converted to one of the following errors which is guaranteed to be in the filter. In this case information is lost, however, the filter correctly handles the exception.
538pub const UNEXPECTED_MM_MAP_ERROR = 557;806pub const UNEXPECTED_MM_MAP_ERROR = 557;
807
539/// If an MM error is returned which is not defined in the standard FsRtl filter, it is converted to one of the following errors which is guaranteed to be in the filter. In this case information is lost, however, the filter correctly handles the exception.808/// If an MM error is returned which is not defined in the standard FsRtl filter, it is converted to one of the following errors which is guaranteed to be in the filter. In this case information is lost, however, the filter correctly handles the exception.
540pub const UNEXPECTED_MM_EXTEND_ERR = 558;809pub const UNEXPECTED_MM_EXTEND_ERR = 558;
810
541/// A malformed function table was encountered during an unwind operation.811/// A malformed function table was encountered during an unwind operation.
542pub const BAD_FUNCTION_TABLE = 559;812pub const BAD_FUNCTION_TABLE = 559;
813
543/// Indicates that an attempt was made to assign protection to a file system file or directory and one of the SIDs in the security descriptor could not be translated into a GUID that could be stored by the file system. This causes the protection attempt to fail, which may cause a file creation attempt to fail.814/// Indicates that an attempt was made to assign protection to a file system file or directory and one of the SIDs in the security descriptor could not be translated into a GUID that could be stored by the file system. This causes the protection attempt to fail, which may cause a file creation attempt to fail.
544pub const NO_GUID_TRANSLATION = 560;815pub const NO_GUID_TRANSLATION = 560;
816
545/// Indicates that an attempt was made to grow an LDT by setting its size, or that the size was not an even number of selectors.817/// Indicates that an attempt was made to grow an LDT by setting its size, or that the size was not an even number of selectors.
546pub const INVALID_LDT_SIZE = 561;818pub const INVALID_LDT_SIZE = 561;
819
547/// Indicates that the starting value for the LDT information was not an integral multiple of the selector size.820/// Indicates that the starting value for the LDT information was not an integral multiple of the selector size.
548pub const INVALID_LDT_OFFSET = 563;821pub const INVALID_LDT_OFFSET = 563;
822
549/// Indicates that the user supplied an invalid descriptor when trying to set up Ldt descriptors.823/// Indicates that the user supplied an invalid descriptor when trying to set up Ldt descriptors.
550pub const INVALID_LDT_DESCRIPTOR = 564;824pub const INVALID_LDT_DESCRIPTOR = 564;
825
551/// Indicates a process has too many threads to perform the requested action. For example, assignment of a primary token may only be performed when a process has zero or one threads.826/// Indicates a process has too many threads to perform the requested action. For example, assignment of a primary token may only be performed when a process has zero or one threads.
552pub const TOO_MANY_THREADS = 565;827pub const TOO_MANY_THREADS = 565;
828
553/// An attempt was made to operate on a thread within a specific process, but the thread specified is not in the process specified.829/// An attempt was made to operate on a thread within a specific process, but the thread specified is not in the process specified.
554pub const THREAD_NOT_IN_PROCESS = 566;830pub const THREAD_NOT_IN_PROCESS = 566;
831
555/// Page file quota was exceeded.832/// Page file quota was exceeded.
556pub const PAGEFILE_QUOTA_EXCEEDED = 567;833pub const PAGEFILE_QUOTA_EXCEEDED = 567;
834
557/// The Netlogon service cannot start because another Netlogon service running in the domain conflicts with the specified role.835/// The Netlogon service cannot start because another Netlogon service running in the domain conflicts with the specified role.
558pub const LOGON_SERVER_CONFLICT = 568;836pub const LOGON_SERVER_CONFLICT = 568;
837
559/// The SAM database on a Windows Server is significantly out of synchronization with the copy on the Domain Controller. A complete synchronization is required.838/// The SAM database on a Windows Server is significantly out of synchronization with the copy on the Domain Controller. A complete synchronization is required.
560pub const SYNCHRONIZATION_REQUIRED = 569;839pub const SYNCHRONIZATION_REQUIRED = 569;
840
561/// The NtCreateFile API failed. This error should never be returned to an application, it is a place holder for the Windows Lan Manager Redirector to use in its internal error mapping routines.841/// The NtCreateFile API failed. This error should never be returned to an application, it is a place holder for the Windows Lan Manager Redirector to use in its internal error mapping routines.
562pub const NET_OPEN_FAILED = 570;842pub const NET_OPEN_FAILED = 570;
843
563/// {Privilege Failed} The I/O permissions for the process could not be changed.844/// {Privilege Failed} The I/O permissions for the process could not be changed.
564pub const IO_PRIVILEGE_FAILED = 571;845pub const IO_PRIVILEGE_FAILED = 571;
846
565/// {Application Exit by CTRL+C} The application terminated as a result of a CTRL+C.847/// {Application Exit by CTRL+C} The application terminated as a result of a CTRL+C.
566pub const CONTROL_C_EXIT = 572;848pub const CONTROL_C_EXIT = 572;
849
567/// {Missing System File} The required system file %hs is bad or missing.850/// {Missing System File} The required system file %hs is bad or missing.
568pub const MISSING_SYSTEMFILE = 573;851pub const MISSING_SYSTEMFILE = 573;
852
569/// {Application Error} The exception %s (0x%08lx) occurred in the application at location 0x%08lx.853/// {Application Error} The exception %s (0x%08lx) occurred in the application at location 0x%08lx.
570pub const UNHANDLED_EXCEPTION = 574;854pub const UNHANDLED_EXCEPTION = 574;
855
571/// {Application Error} The application was unable to start correctly (0x%lx). Click OK to close the application.856/// {Application Error} The application was unable to start correctly (0x%lx). Click OK to close the application.
572pub const APP_INIT_FAILURE = 575;857pub const APP_INIT_FAILURE = 575;
858
573/// {Unable to Create Paging File} The creation of the paging file %hs failed (%lx). The requested size was %ld.859/// {Unable to Create Paging File} The creation of the paging file %hs failed (%lx). The requested size was %ld.
574pub const PAGEFILE_CREATE_FAILED = 576;860pub const PAGEFILE_CREATE_FAILED = 576;
861
575/// Windows cannot verify the digital signature for this file. A recent hardware or software change might have installed a file that is signed incorrectly or damaged, or that might be malicious software from an unknown source.862/// Windows cannot verify the digital signature for this file. A recent hardware or software change might have installed a file that is signed incorrectly or damaged, or that might be malicious software from an unknown source.
576pub const INVALID_IMAGE_HASH = 577;863pub const INVALID_IMAGE_HASH = 577;
864
577/// {No Paging File Specified} No paging file was specified in the system configuration.865/// {No Paging File Specified} No paging file was specified in the system configuration.
578pub const NO_PAGEFILE = 578;866pub const NO_PAGEFILE = 578;
867
579/// {EXCEPTION} A real-mode application issued a floating-point instruction and floating-point hardware is not present.868/// {EXCEPTION} A real-mode application issued a floating-point instruction and floating-point hardware is not present.
580pub const ILLEGAL_FLOAT_CONTEXT = 579;869pub const ILLEGAL_FLOAT_CONTEXT = 579;
870
581/// An event pair synchronization operation was performed using the thread specific client/server event pair object, but no event pair object was associated with the thread.871/// An event pair synchronization operation was performed using the thread specific client/server event pair object, but no event pair object was associated with the thread.
582pub const NO_EVENT_PAIR = 580;872pub const NO_EVENT_PAIR = 580;
873
583/// A Windows Server has an incorrect configuration.874/// A Windows Server has an incorrect configuration.
584pub const DOMAIN_CTRLR_CONFIG_ERROR = 581;875pub const DOMAIN_CTRLR_CONFIG_ERROR = 581;
876
585/// An illegal character was encountered. For a multi-byte character set this includes a lead byte without a succeeding trail byte. For the Unicode character set this includes the characters 0xFFFF and 0xFFFE.877/// An illegal character was encountered. For a multi-byte character set this includes a lead byte without a succeeding trail byte. For the Unicode character set this includes the characters 0xFFFF and 0xFFFE.
586pub const ILLEGAL_CHARACTER = 582;878pub const ILLEGAL_CHARACTER = 582;
879
587/// The Unicode character is not defined in the Unicode character set installed on the system.880/// The Unicode character is not defined in the Unicode character set installed on the system.
588pub const UNDEFINED_CHARACTER = 583;881pub const UNDEFINED_CHARACTER = 583;
882
589/// The paging file cannot be created on a floppy diskette.883/// The paging file cannot be created on a floppy diskette.
590pub const FLOPPY_VOLUME = 584;884pub const FLOPPY_VOLUME = 584;
885
591/// The system BIOS failed to connect a system interrupt to the device or bus for which the device is connected.886/// The system BIOS failed to connect a system interrupt to the device or bus for which the device is connected.
592pub const BIOS_FAILED_TO_CONNECT_INTERRUPT = 585;887pub const BIOS_FAILED_TO_CONNECT_INTERRUPT = 585;
888
593/// This operation is only allowed for the Primary Domain Controller of the domain.889/// This operation is only allowed for the Primary Domain Controller of the domain.
594pub const BACKUP_CONTROLLER = 586;890pub const BACKUP_CONTROLLER = 586;
891
595/// An attempt was made to acquire a mutant such that its maximum count would have been exceeded.892/// An attempt was made to acquire a mutant such that its maximum count would have been exceeded.
596pub const MUTANT_LIMIT_EXCEEDED = 587;893pub const MUTANT_LIMIT_EXCEEDED = 587;
894
597/// A volume has been accessed for which a file system driver is required that has not yet been loaded.895/// A volume has been accessed for which a file system driver is required that has not yet been loaded.
598pub const FS_DRIVER_REQUIRED = 588;896pub const FS_DRIVER_REQUIRED = 588;
897
599/// {Registry File Failure} The registry cannot load the hive (file): %hs or its log or alternate. It is corrupt, absent, or not writable.898/// {Registry File Failure} The registry cannot load the hive (file): %hs or its log or alternate. It is corrupt, absent, or not writable.
600pub const CANNOT_LOAD_REGISTRY_FILE = 589;899pub const CANNOT_LOAD_REGISTRY_FILE = 589;
900
601/// {Unexpected Failure in DebugActiveProcess} An unexpected failure occurred while processing a DebugActiveProcess API request. You may choose OK to terminate the process, or Cancel to ignore the error.901/// {Unexpected Failure in DebugActiveProcess} An unexpected failure occurred while processing a DebugActiveProcess API request. You may choose OK to terminate the process, or Cancel to ignore the error.
602pub const DEBUG_ATTACH_FAILED = 590;902pub const DEBUG_ATTACH_FAILED = 590;
903
603/// {Fatal System Error} The %hs system process terminated unexpectedly with a status of 0x%08x (0x%08x 0x%08x). The system has been shut down.904/// {Fatal System Error} The %hs system process terminated unexpectedly with a status of 0x%08x (0x%08x 0x%08x). The system has been shut down.
604pub const SYSTEM_PROCESS_TERMINATED = 591;905pub const SYSTEM_PROCESS_TERMINATED = 591;
906
605/// {Data Not Accepted} The TDI client could not handle the data received during an indication.907/// {Data Not Accepted} The TDI client could not handle the data received during an indication.
606pub const DATA_NOT_ACCEPTED = 592;908pub const DATA_NOT_ACCEPTED = 592;
909
607/// NTVDM encountered a hard error.910/// NTVDM encountered a hard error.
608pub const VDM_HARD_ERROR = 593;911pub const VDM_HARD_ERROR = 593;
912
609/// {Cancel Timeout} The driver %hs failed to complete a cancelled I/O request in the allotted time.913/// {Cancel Timeout} The driver %hs failed to complete a cancelled I/O request in the allotted time.
610pub const DRIVER_CANCEL_TIMEOUT = 594;914pub const DRIVER_CANCEL_TIMEOUT = 594;
915
611/// {Reply Message Mismatch} An attempt was made to reply to an LPC message, but the thread specified by the client ID in the message was not waiting on that message.916/// {Reply Message Mismatch} An attempt was made to reply to an LPC message, but the thread specified by the client ID in the message was not waiting on that message.
612pub const REPLY_MESSAGE_MISMATCH = 595;917pub const REPLY_MESSAGE_MISMATCH = 595;
918
613/// {Delayed Write Failed} Windows was unable to save all the data for the file %hs. The data has been lost. This error may be caused by a failure of your computer hardware or network connection. Please try to save this file elsewhere.919/// {Delayed Write Failed} Windows was unable to save all the data for the file %hs. The data has been lost. This error may be caused by a failure of your computer hardware or network connection. Please try to save this file elsewhere.
614pub const LOST_WRITEBEHIND_DATA = 596;920pub const LOST_WRITEBEHIND_DATA = 596;
921
615/// The parameter(s) passed to the server in the client/server shared memory window were invalid. Too much data may have been put in the shared memory window.922/// The parameter(s) passed to the server in the client/server shared memory window were invalid. Too much data may have been put in the shared memory window.
616pub const CLIENT_SERVER_PARAMETERS_INVALID = 597;923pub const CLIENT_SERVER_PARAMETERS_INVALID = 597;
924
617/// The stream is not a tiny stream.925/// The stream is not a tiny stream.
618pub const NOT_TINY_STREAM = 598;926pub const NOT_TINY_STREAM = 598;
927
619/// The request must be handled by the stack overflow code.928/// The request must be handled by the stack overflow code.
620pub const STACK_OVERFLOW_READ = 599;929pub const STACK_OVERFLOW_READ = 599;
930
621/// Internal OFS status codes indicating how an allocation operation is handled. Either it is retried after the containing onode is moved or the extent stream is converted to a large stream.931/// Internal OFS status codes indicating how an allocation operation is handled. Either it is retried after the containing onode is moved or the extent stream is converted to a large stream.
622pub const CONVERT_TO_LARGE = 600;932pub const CONVERT_TO_LARGE = 600;
933
623/// The attempt to find the object found an object matching by ID on the volume but it is out of the scope of the handle used for the operation.934/// The attempt to find the object found an object matching by ID on the volume but it is out of the scope of the handle used for the operation.
624pub const FOUND_OUT_OF_SCOPE = 601;935pub const FOUND_OUT_OF_SCOPE = 601;
936
625/// The bucket array must be grown. Retry transaction after doing so.937/// The bucket array must be grown. Retry transaction after doing so.
626pub const ALLOCATE_BUCKET = 602;938pub const ALLOCATE_BUCKET = 602;
939
627/// The user/kernel marshalling buffer has overflowed.940/// The user/kernel marshalling buffer has overflowed.
628pub const MARSHALL_OVERFLOW = 603;941pub const MARSHALL_OVERFLOW = 603;
942
629/// The supplied variant structure contains invalid data.943/// The supplied variant structure contains invalid data.
630pub const INVALID_VARIANT = 604;944pub const INVALID_VARIANT = 604;
945
631/// The specified buffer contains ill-formed data.946/// The specified buffer contains ill-formed data.
632pub const BAD_COMPRESSION_BUFFER = 605;947pub const BAD_COMPRESSION_BUFFER = 605;
948
633/// {Audit Failed} An attempt to generate a security audit failed.949/// {Audit Failed} An attempt to generate a security audit failed.
634pub const AUDIT_FAILED = 606;950pub const AUDIT_FAILED = 606;
951
635/// The timer resolution was not previously set by the current process.952/// The timer resolution was not previously set by the current process.
636pub const TIMER_RESOLUTION_NOT_SET = 607;953pub const TIMER_RESOLUTION_NOT_SET = 607;
954
637/// There is insufficient account information to log you on.955/// There is insufficient account information to log you on.
638pub const INSUFFICIENT_LOGON_INFO = 608;956pub const INSUFFICIENT_LOGON_INFO = 608;
957
639/// {Invalid DLL Entrypoint} The dynamic link library %hs is not written correctly. The stack pointer has been left in an inconsistent state. The entrypoint should be declared as WINAPI or STDCALL. Select YES to fail the DLL load. Select NO to continue execution. Selecting NO may cause the application to operate incorrectly.958/// {Invalid DLL Entrypoint} The dynamic link library %hs is not written correctly. The stack pointer has been left in an inconsistent state. The entrypoint should be declared as WINAPI or STDCALL. Select YES to fail the DLL load. Select NO to continue execution. Selecting NO may cause the application to operate incorrectly.
640pub const BAD_DLL_ENTRYPOINT = 609;959pub const BAD_DLL_ENTRYPOINT = 609;
960
641/// {Invalid Service Callback Entrypoint} The %hs service is not written correctly. The stack pointer has been left in an inconsistent state. The callback entrypoint should be declared as WINAPI or STDCALL. Selecting OK will cause the service to continue operation. However, the service process may operate incorrectly.961/// {Invalid Service Callback Entrypoint} The %hs service is not written correctly. The stack pointer has been left in an inconsistent state. The callback entrypoint should be declared as WINAPI or STDCALL. Selecting OK will cause the service to continue operation. However, the service process may operate incorrectly.
642pub const BAD_SERVICE_ENTRYPOINT = 610;962pub const BAD_SERVICE_ENTRYPOINT = 610;
963
643/// There is an IP address conflict with another system on the network.964/// There is an IP address conflict with another system on the network.
644pub const IP_ADDRESS_CONFLICT1 = 611;965pub const IP_ADDRESS_CONFLICT1 = 611;
966
645/// There is an IP address conflict with another system on the network.967/// There is an IP address conflict with another system on the network.
646pub const IP_ADDRESS_CONFLICT2 = 612;968pub const IP_ADDRESS_CONFLICT2 = 612;
969
647/// {Low On Registry Space} The system has reached the maximum size allowed for the system part of the registry. Additional storage requests will be ignored.970/// {Low On Registry Space} The system has reached the maximum size allowed for the system part of the registry. Additional storage requests will be ignored.
648pub const REGISTRY_QUOTA_LIMIT = 613;971pub const REGISTRY_QUOTA_LIMIT = 613;
972
649/// A callback return system service cannot be executed when no callback is active.973/// A callback return system service cannot be executed when no callback is active.
650pub const NO_CALLBACK_ACTIVE = 614;974pub const NO_CALLBACK_ACTIVE = 614;
975
651/// The password provided is too short to meet the policy of your user account. Please choose a longer password.976/// The password provided is too short to meet the policy of your user account. Please choose a longer password.
652pub const PWD_TOO_SHORT = 615;977pub const PWD_TOO_SHORT = 615;
978
653/// The policy of your user account does not allow you to change passwords too frequently. This is done to prevent users from changing back to a familiar, but potentially discovered, password. If you feel your password has been compromised then please contact your administrator immediately to have a new one assigned.979/// The policy of your user account does not allow you to change passwords too frequently. This is done to prevent users from changing back to a familiar, but potentially discovered, password. If you feel your password has been compromised then please contact your administrator immediately to have a new one assigned.
654pub const PWD_TOO_RECENT = 616;980pub const PWD_TOO_RECENT = 616;
981
655/// You have attempted to change your password to one that you have used in the past. The policy of your user account does not allow this. Please select a password that you have not previously used.982/// You have attempted to change your password to one that you have used in the past. The policy of your user account does not allow this. Please select a password that you have not previously used.
656pub const PWD_HISTORY_CONFLICT = 617;983pub const PWD_HISTORY_CONFLICT = 617;
984
657/// The specified compression format is unsupported.985/// The specified compression format is unsupported.
658pub const UNSUPPORTED_COMPRESSION = 618;986pub const UNSUPPORTED_COMPRESSION = 618;
987
659/// The specified hardware profile configuration is invalid.988/// The specified hardware profile configuration is invalid.
660pub const INVALID_HW_PROFILE = 619;989pub const INVALID_HW_PROFILE = 619;
990
661/// The specified Plug and Play registry device path is invalid.991/// The specified Plug and Play registry device path is invalid.
662pub const INVALID_PLUGPLAY_DEVICE_PATH = 620;992pub const INVALID_PLUGPLAY_DEVICE_PATH = 620;
993
663/// The specified quota list is internally inconsistent with its descriptor.994/// The specified quota list is internally inconsistent with its descriptor.
664pub const QUOTA_LIST_INCONSISTENT = 621;995pub const QUOTA_LIST_INCONSISTENT = 621;
996
665/// {Windows Evaluation Notification} The evaluation period for this installation of Windows has expired. This system will shutdown in 1 hour. To restore access to this installation of Windows, please upgrade this installation using a licensed distribution of this product.997/// {Windows Evaluation Notification} The evaluation period for this installation of Windows has expired. This system will shutdown in 1 hour. To restore access to this installation of Windows, please upgrade this installation using a licensed distribution of this product.
666pub const EVALUATION_EXPIRATION = 622;998pub const EVALUATION_EXPIRATION = 622;
999
667/// {Illegal System DLL Relocation} The system DLL %hs was relocated in memory. The application will not run properly. The relocation occurred because the DLL %hs occupied an address range reserved for Windows system DLLs. The vendor supplying the DLL should be contacted for a new DLL.1000/// {Illegal System DLL Relocation} The system DLL %hs was relocated in memory. The application will not run properly. The relocation occurred because the DLL %hs occupied an address range reserved for Windows system DLLs. The vendor supplying the DLL should be contacted for a new DLL.
668pub const ILLEGAL_DLL_RELOCATION = 623;1001pub const ILLEGAL_DLL_RELOCATION = 623;
1002
669/// {DLL Initialization Failed} The application failed to initialize because the window station is shutting down.1003/// {DLL Initialization Failed} The application failed to initialize because the window station is shutting down.
670pub const DLL_INIT_FAILED_LOGOFF = 624;1004pub const DLL_INIT_FAILED_LOGOFF = 624;
1005
671/// The validation process needs to continue on to the next step.1006/// The validation process needs to continue on to the next step.
672pub const VALIDATE_CONTINUE = 625;1007pub const VALIDATE_CONTINUE = 625;
1008
673/// There are no more matches for the current index enumeration.1009/// There are no more matches for the current index enumeration.
674pub const NO_MORE_MATCHES = 626;1010pub const NO_MORE_MATCHES = 626;
1011
675/// The range could not be added to the range list because of a conflict.1012/// The range could not be added to the range list because of a conflict.
676pub const RANGE_LIST_CONFLICT = 627;1013pub const RANGE_LIST_CONFLICT = 627;
1014
677/// The server process is running under a SID different than that required by client.1015/// The server process is running under a SID different than that required by client.
678pub const SERVER_SID_MISMATCH = 628;1016pub const SERVER_SID_MISMATCH = 628;
1017
679/// A group marked use for deny only cannot be enabled.1018/// A group marked use for deny only cannot be enabled.
680pub const CANT_ENABLE_DENY_ONLY = 629;1019pub const CANT_ENABLE_DENY_ONLY = 629;
1020
681/// {EXCEPTION} Multiple floating point faults.1021/// {EXCEPTION} Multiple floating point faults.
682pub const FLOAT_MULTIPLE_FAULTS = 630;1022pub const FLOAT_MULTIPLE_FAULTS = 630;
1023
683/// {EXCEPTION} Multiple floating point traps.1024/// {EXCEPTION} Multiple floating point traps.
684pub const FLOAT_MULTIPLE_TRAPS = 631;1025pub const FLOAT_MULTIPLE_TRAPS = 631;
1026
685/// The requested interface is not supported.1027/// The requested interface is not supported.
686pub const NOINTERFACE = 632;1028pub const NOINTERFACE = 632;
1029
687/// {System Standby Failed} The driver %hs does not support standby mode. Updating this driver may allow the system to go to standby mode.1030/// {System Standby Failed} The driver %hs does not support standby mode. Updating this driver may allow the system to go to standby mode.
688pub const DRIVER_FAILED_SLEEP = 633;1031pub const DRIVER_FAILED_SLEEP = 633;
1032
689/// The system file %1 has become corrupt and has been replaced.1033/// The system file %1 has become corrupt and has been replaced.
690pub const CORRUPT_SYSTEM_FILE = 634;1034pub const CORRUPT_SYSTEM_FILE = 634;
1035
691/// {Virtual Memory Minimum Too Low} Your system is low on virtual memory. Windows is increasing the size of your virtual memory paging file. During this process, memory requests for some applications may be denied. For more information, see Help.1036/// {Virtual Memory Minimum Too Low} Your system is low on virtual memory. Windows is increasing the size of your virtual memory paging file. During this process, memory requests for some applications may be denied. For more information, see Help.
692pub const COMMITMENT_MINIMUM = 635;1037pub const COMMITMENT_MINIMUM = 635;
1038
693/// A device was removed so enumeration must be restarted.1039/// A device was removed so enumeration must be restarted.
694pub const PNP_RESTART_ENUMERATION = 636;1040pub const PNP_RESTART_ENUMERATION = 636;
1041
695/// {Fatal System Error} The system image %s is not properly signed. The file has been replaced with the signed file. The system has been shut down.1042/// {Fatal System Error} The system image %s is not properly signed. The file has been replaced with the signed file. The system has been shut down.
696pub const SYSTEM_IMAGE_BAD_SIGNATURE = 637;1043pub const SYSTEM_IMAGE_BAD_SIGNATURE = 637;
1044
697/// Device will not start without a reboot.1045/// Device will not start without a reboot.
698pub const PNP_REBOOT_REQUIRED = 638;1046pub const PNP_REBOOT_REQUIRED = 638;
1047
699/// There is not enough power to complete the requested operation.1048/// There is not enough power to complete the requested operation.
700pub const INSUFFICIENT_POWER = 639;1049pub const INSUFFICIENT_POWER = 639;
1050
701/// ERROR_MULTIPLE_FAULT_VIOLATION1051/// ERROR_MULTIPLE_FAULT_VIOLATION
702pub const MULTIPLE_FAULT_VIOLATION = 640;1052pub const MULTIPLE_FAULT_VIOLATION = 640;
1053
703/// The system is in the process of shutting down.1054/// The system is in the process of shutting down.
704pub const SYSTEM_SHUTDOWN = 641;1055pub const SYSTEM_SHUTDOWN = 641;
1056
705/// An attempt to remove a processes DebugPort was made, but a port was not already associated with the process.1057/// An attempt to remove a processes DebugPort was made, but a port was not already associated with the process.
706pub const PORT_NOT_SET = 642;1058pub const PORT_NOT_SET = 642;
1059
707/// This version of Windows is not compatible with the behavior version of directory forest, domain or domain controller.1060/// This version of Windows is not compatible with the behavior version of directory forest, domain or domain controller.
708pub const DS_VERSION_CHECK_FAILURE = 643;1061pub const DS_VERSION_CHECK_FAILURE = 643;
1062
709/// The specified range could not be found in the range list.1063/// The specified range could not be found in the range list.
710pub const RANGE_NOT_FOUND = 644;1064pub const RANGE_NOT_FOUND = 644;
1065
711/// The driver was not loaded because the system is booting into safe mode.1066/// The driver was not loaded because the system is booting into safe mode.
712pub const NOT_SAFE_MODE_DRIVER = 646;1067pub const NOT_SAFE_MODE_DRIVER = 646;
1068
713/// The driver was not loaded because it failed its initialization call.1069/// The driver was not loaded because it failed its initialization call.
714pub const FAILED_DRIVER_ENTRY = 647;1070pub const FAILED_DRIVER_ENTRY = 647;
1071
715/// The "%hs" encountered an error while applying power or reading the device configuration. This may be caused by a failure of your hardware or by a poor connection.1072/// The "%hs" encountered an error while applying power or reading the device configuration. This may be caused by a failure of your hardware or by a poor connection.
716pub const DEVICE_ENUMERATION_ERROR = 648;1073pub const DEVICE_ENUMERATION_ERROR = 648;
1074
717/// The create operation failed because the name contained at least one mount point which resolves to a volume to which the specified device object is not attached.1075/// The create operation failed because the name contained at least one mount point which resolves to a volume to which the specified device object is not attached.
718pub const MOUNT_POINT_NOT_RESOLVED = 649;1076pub const MOUNT_POINT_NOT_RESOLVED = 649;
1077
719/// The device object parameter is either not a valid device object or is not attached to the volume specified by the file name.1078/// The device object parameter is either not a valid device object or is not attached to the volume specified by the file name.
720pub const INVALID_DEVICE_OBJECT_PARAMETER = 650;1079pub const INVALID_DEVICE_OBJECT_PARAMETER = 650;
1080
721/// A Machine Check Error has occurred. Please check the system eventlog for additional information.1081/// A Machine Check Error has occurred. Please check the system eventlog for additional information.
722pub const MCA_OCCURED = 651;1082pub const MCA_OCCURED = 651;
1083
723/// There was error [%2] processing the driver database.1084/// There was error [%2] processing the driver database.
724pub const DRIVER_DATABASE_ERROR = 652;1085pub const DRIVER_DATABASE_ERROR = 652;
1086
725/// System hive size has exceeded its limit.1087/// System hive size has exceeded its limit.
726pub const SYSTEM_HIVE_TOO_LARGE = 653;1088pub const SYSTEM_HIVE_TOO_LARGE = 653;
1089
727/// The driver could not be loaded because a previous version of the driver is still in memory.1090/// The driver could not be loaded because a previous version of the driver is still in memory.
728pub const DRIVER_FAILED_PRIOR_UNLOAD = 654;1091pub const DRIVER_FAILED_PRIOR_UNLOAD = 654;
1092
729/// {Volume Shadow Copy Service} Please wait while the Volume Shadow Copy Service prepares volume %hs for hibernation.1093/// {Volume Shadow Copy Service} Please wait while the Volume Shadow Copy Service prepares volume %hs for hibernation.
730pub const VOLSNAP_PREPARE_HIBERNATE = 655;1094pub const VOLSNAP_PREPARE_HIBERNATE = 655;
1095
731/// The system has failed to hibernate (The error code is %hs). Hibernation will be disabled until the system is restarted.1096/// The system has failed to hibernate (The error code is %hs). Hibernation will be disabled until the system is restarted.
732pub const HIBERNATION_FAILURE = 656;1097pub const HIBERNATION_FAILURE = 656;
1098
733/// The password provided is too long to meet the policy of your user account. Please choose a shorter password.1099/// The password provided is too long to meet the policy of your user account. Please choose a shorter password.
734pub const PWD_TOO_LONG = 657;1100pub const PWD_TOO_LONG = 657;
1101
735/// The requested operation could not be completed due to a file system limitation.1102/// The requested operation could not be completed due to a file system limitation.
736pub const FILE_SYSTEM_LIMITATION = 665;1103pub const FILE_SYSTEM_LIMITATION = 665;
1104
737/// An assertion failure has occurred.1105/// An assertion failure has occurred.
738pub const ASSERTION_FAILURE = 668;1106pub const ASSERTION_FAILURE = 668;
1107
739/// An error occurred in the ACPI subsystem.1108/// An error occurred in the ACPI subsystem.
740pub const ACPI_ERROR = 669;1109pub const ACPI_ERROR = 669;
1110
741/// WOW Assertion Error.1111/// WOW Assertion Error.
742pub const WOW_ASSERTION = 670;1112pub const WOW_ASSERTION = 670;
1113
743/// A device is missing in the system BIOS MPS table. This device will not be used. Please contact your system vendor for system BIOS update.1114/// A device is missing in the system BIOS MPS table. This device will not be used. Please contact your system vendor for system BIOS update.
744pub const PNP_BAD_MPS_TABLE = 671;1115pub const PNP_BAD_MPS_TABLE = 671;
1116
745/// A translator failed to translate resources.1117/// A translator failed to translate resources.
746pub const PNP_TRANSLATION_FAILED = 672;1118pub const PNP_TRANSLATION_FAILED = 672;
1119
747/// A IRQ translator failed to translate resources.1120/// A IRQ translator failed to translate resources.
748pub const PNP_IRQ_TRANSLATION_FAILED = 673;1121pub const PNP_IRQ_TRANSLATION_FAILED = 673;
1122
749/// Driver %2 returned invalid ID for a child device (%3).1123/// Driver %2 returned invalid ID for a child device (%3).
750pub const PNP_INVALID_ID = 674;1124pub const PNP_INVALID_ID = 674;
1125
751/// {Kernel Debugger Awakened} the system debugger was awakened by an interrupt.1126/// {Kernel Debugger Awakened} the system debugger was awakened by an interrupt.
752pub const WAKE_SYSTEM_DEBUGGER = 675;1127pub const WAKE_SYSTEM_DEBUGGER = 675;
1128
753/// {Handles Closed} Handles to objects have been automatically closed as a result of the requested operation.1129/// {Handles Closed} Handles to objects have been automatically closed as a result of the requested operation.
754pub const HANDLES_CLOSED = 676;1130pub const HANDLES_CLOSED = 676;
1131
755/// {Too Much Information} The specified access control list (ACL) contained more information than was expected.1132/// {Too Much Information} The specified access control list (ACL) contained more information than was expected.
756pub const EXTRANEOUS_INFORMATION = 677;1133pub const EXTRANEOUS_INFORMATION = 677;
1134
757/// This warning level status indicates that the transaction state already exists for the registry sub-tree, but that a transaction commit was previously aborted. The commit has NOT been completed, but has not been rolled back either (so it may still be committed if desired).1135/// This warning level status indicates that the transaction state already exists for the registry sub-tree, but that a transaction commit was previously aborted. The commit has NOT been completed, but has not been rolled back either (so it may still be committed if desired).
758pub const RXACT_COMMIT_NECESSARY = 678;1136pub const RXACT_COMMIT_NECESSARY = 678;
1137
759/// {Media Changed} The media may have changed.1138/// {Media Changed} The media may have changed.
760pub const MEDIA_CHECK = 679;1139pub const MEDIA_CHECK = 679;
1140
761/// {GUID Substitution} During the translation of a global identifier (GUID) to a Windows security ID (SID), no administratively-defined GUID prefix was found. A substitute prefix was used, which will not compromise system security. However, this may provide a more restrictive access than intended.1141/// {GUID Substitution} During the translation of a global identifier (GUID) to a Windows security ID (SID), no administratively-defined GUID prefix was found. A substitute prefix was used, which will not compromise system security. However, this may provide a more restrictive access than intended.
762pub const GUID_SUBSTITUTION_MADE = 680;1142pub const GUID_SUBSTITUTION_MADE = 680;
1143
763/// The create operation stopped after reaching a symbolic link.1144/// The create operation stopped after reaching a symbolic link.
764pub const STOPPED_ON_SYMLINK = 681;1145pub const STOPPED_ON_SYMLINK = 681;
1146
765/// A long jump has been executed.1147/// A long jump has been executed.
766pub const LONGJUMP = 682;1148pub const LONGJUMP = 682;
1149
767/// The Plug and Play query operation was not successful.1150/// The Plug and Play query operation was not successful.
768pub const PLUGPLAY_QUERY_VETOED = 683;1151pub const PLUGPLAY_QUERY_VETOED = 683;
1152
769/// A frame consolidation has been executed.1153/// A frame consolidation has been executed.
770pub const UNWIND_CONSOLIDATE = 684;1154pub const UNWIND_CONSOLIDATE = 684;
1155
771/// {Registry Hive Recovered} Registry hive (file): %hs was corrupted and it has been recovered. Some data might have been lost.1156/// {Registry Hive Recovered} Registry hive (file): %hs was corrupted and it has been recovered. Some data might have been lost.
772pub const REGISTRY_HIVE_RECOVERED = 685;1157pub const REGISTRY_HIVE_RECOVERED = 685;
1158
773/// The application is attempting to run executable code from the module %hs. This may be insecure. An alternative, %hs, is available. Should the application use the secure module %hs?1159/// The application is attempting to run executable code from the module %hs. This may be insecure. An alternative, %hs, is available. Should the application use the secure module %hs?
774pub const DLL_MIGHT_BE_INSECURE = 686;1160pub const DLL_MIGHT_BE_INSECURE = 686;
1161
775/// The application is loading executable code from the module %hs. This is secure, but may be incompatible with previous releases of the operating system. An alternative, %hs, is available. Should the application use the secure module %hs?1162/// The application is loading executable code from the module %hs. This is secure, but may be incompatible with previous releases of the operating system. An alternative, %hs, is available. Should the application use the secure module %hs?
776pub const DLL_MIGHT_BE_INCOMPATIBLE = 687;1163pub const DLL_MIGHT_BE_INCOMPATIBLE = 687;
1164
777/// Debugger did not handle the exception.1165/// Debugger did not handle the exception.
778pub const DBG_EXCEPTION_NOT_HANDLED = 688;1166pub const DBG_EXCEPTION_NOT_HANDLED = 688;
1167
779/// Debugger will reply later.1168/// Debugger will reply later.
780pub const DBG_REPLY_LATER = 689;1169pub const DBG_REPLY_LATER = 689;
1170
781/// Debugger cannot provide handle.1171/// Debugger cannot provide handle.
782pub const DBG_UNABLE_TO_PROVIDE_HANDLE = 690;1172pub const DBG_UNABLE_TO_PROVIDE_HANDLE = 690;
1173
783/// Debugger terminated thread.1174/// Debugger terminated thread.
784pub const DBG_TERMINATE_THREAD = 691;1175pub const DBG_TERMINATE_THREAD = 691;
1176
785/// Debugger terminated process.1177/// Debugger terminated process.
786pub const DBG_TERMINATE_PROCESS = 692;1178pub const DBG_TERMINATE_PROCESS = 692;
1179
787/// Debugger got control C.1180/// Debugger got control C.
788pub const DBG_CONTROL_C = 693;1181pub const DBG_CONTROL_C = 693;
1182
789/// Debugger printed exception on control C.1183/// Debugger printed exception on control C.
790pub const DBG_PRINTEXCEPTION_C = 694;1184pub const DBG_PRINTEXCEPTION_C = 694;
1185
791/// Debugger received RIP exception.1186/// Debugger received RIP exception.
792pub const DBG_RIPEXCEPTION = 695;1187pub const DBG_RIPEXCEPTION = 695;
1188
793/// Debugger received control break.1189/// Debugger received control break.
794pub const DBG_CONTROL_BREAK = 696;1190pub const DBG_CONTROL_BREAK = 696;
1191
795/// Debugger command communication exception.1192/// Debugger command communication exception.
796pub const DBG_COMMAND_EXCEPTION = 697;1193pub const DBG_COMMAND_EXCEPTION = 697;
1194
797/// {Object Exists} An attempt was made to create an object and the object name already existed.1195/// {Object Exists} An attempt was made to create an object and the object name already existed.
798pub const OBJECT_NAME_EXISTS = 698;1196pub const OBJECT_NAME_EXISTS = 698;
1197
799/// {Thread Suspended} A thread termination occurred while the thread was suspended. The thread was resumed, and termination proceeded.1198/// {Thread Suspended} A thread termination occurred while the thread was suspended. The thread was resumed, and termination proceeded.
800pub const THREAD_WAS_SUSPENDED = 699;1199pub const THREAD_WAS_SUSPENDED = 699;
1200
801/// {Image Relocated} An image file could not be mapped at the address specified in the image file. Local fixups must be performed on this image.1201/// {Image Relocated} An image file could not be mapped at the address specified in the image file. Local fixups must be performed on this image.
802pub const IMAGE_NOT_AT_BASE = 700;1202pub const IMAGE_NOT_AT_BASE = 700;
1203
803/// This informational level status indicates that a specified registry sub-tree transaction state did not yet exist and had to be created.1204/// This informational level status indicates that a specified registry sub-tree transaction state did not yet exist and had to be created.
804pub const RXACT_STATE_CREATED = 701;1205pub const RXACT_STATE_CREATED = 701;
1206
805/// {Segment Load} A virtual DOS machine (VDM) is loading, unloading, or moving an MS-DOS or Win16 program segment image. An exception is raised so a debugger can load, unload or track symbols and breakpoints within these 16-bit segments.1207/// {Segment Load} A virtual DOS machine (VDM) is loading, unloading, or moving an MS-DOS or Win16 program segment image. An exception is raised so a debugger can load, unload or track symbols and breakpoints within these 16-bit segments.
806pub const SEGMENT_NOTIFICATION = 702;1208pub const SEGMENT_NOTIFICATION = 702;
1209
807/// {Invalid Current Directory} The process cannot switch to the startup current directory %hs. Select OK to set current directory to %hs, or select CANCEL to exit.1210/// {Invalid Current Directory} The process cannot switch to the startup current directory %hs. Select OK to set current directory to %hs, or select CANCEL to exit.
808pub const BAD_CURRENT_DIRECTORY = 703;1211pub const BAD_CURRENT_DIRECTORY = 703;
1212
809/// {Redundant Read} To satisfy a read request, the NT fault-tolerant file system successfully read the requested data from a redundant copy. This was done because the file system encountered a failure on a member of the fault-tolerant volume, but was unable to reassign the failing area of the device.1213/// {Redundant Read} To satisfy a read request, the NT fault-tolerant file system successfully read the requested data from a redundant copy. This was done because the file system encountered a failure on a member of the fault-tolerant volume, but was unable to reassign the failing area of the device.
810pub const FT_READ_RECOVERY_FROM_BACKUP = 704;1214pub const FT_READ_RECOVERY_FROM_BACKUP = 704;
1215
811/// {Redundant Write} To satisfy a write request, the NT fault-tolerant file system successfully wrote a redundant copy of the information. This was done because the file system encountered a failure on a member of the fault-tolerant volume, but was not able to reassign the failing area of the device.1216/// {Redundant Write} To satisfy a write request, the NT fault-tolerant file system successfully wrote a redundant copy of the information. This was done because the file system encountered a failure on a member of the fault-tolerant volume, but was not able to reassign the failing area of the device.
812pub const FT_WRITE_RECOVERY = 705;1217pub const FT_WRITE_RECOVERY = 705;
1218
813/// {Machine Type Mismatch} The image file %hs is valid, but is for a machine type other than the current machine. Select OK to continue, or CANCEL to fail the DLL load.1219/// {Machine Type Mismatch} The image file %hs is valid, but is for a machine type other than the current machine. Select OK to continue, or CANCEL to fail the DLL load.
814pub const IMAGE_MACHINE_TYPE_MISMATCH = 706;1220pub const IMAGE_MACHINE_TYPE_MISMATCH = 706;
1221
815/// {Partial Data Received} The network transport returned partial data to its client. The remaining data will be sent later.1222/// {Partial Data Received} The network transport returned partial data to its client. The remaining data will be sent later.
816pub const RECEIVE_PARTIAL = 707;1223pub const RECEIVE_PARTIAL = 707;
1224
817/// {Expedited Data Received} The network transport returned data to its client that was marked as expedited by the remote system.1225/// {Expedited Data Received} The network transport returned data to its client that was marked as expedited by the remote system.
818pub const RECEIVE_EXPEDITED = 708;1226pub const RECEIVE_EXPEDITED = 708;
1227
819/// {Partial Expedited Data Received} The network transport returned partial data to its client and this data was marked as expedited by the remote system. The remaining data will be sent later.1228/// {Partial Expedited Data Received} The network transport returned partial data to its client and this data was marked as expedited by the remote system. The remaining data will be sent later.
820pub const RECEIVE_PARTIAL_EXPEDITED = 709;1229pub const RECEIVE_PARTIAL_EXPEDITED = 709;
1230
821/// {TDI Event Done} The TDI indication has completed successfully.1231/// {TDI Event Done} The TDI indication has completed successfully.
822pub const EVENT_DONE = 710;1232pub const EVENT_DONE = 710;
1233
823/// {TDI Event Pending} The TDI indication has entered the pending state.1234/// {TDI Event Pending} The TDI indication has entered the pending state.
824pub const EVENT_PENDING = 711;1235pub const EVENT_PENDING = 711;
1236
825/// Checking file system on %wZ.1237/// Checking file system on %wZ.
826pub const CHECKING_FILE_SYSTEM = 712;1238pub const CHECKING_FILE_SYSTEM = 712;
1239
827/// {Fatal Application Exit} %hs.1240/// {Fatal Application Exit} %hs.
828pub const FATAL_APP_EXIT = 713;1241pub const FATAL_APP_EXIT = 713;
1242
829/// The specified registry key is referenced by a predefined handle.1243/// The specified registry key is referenced by a predefined handle.
830pub const PREDEFINED_HANDLE = 714;1244pub const PREDEFINED_HANDLE = 714;
1245
831/// {Page Unlocked} The page protection of a locked page was changed to 'No Access' and the page was unlocked from memory and from the process.1246/// {Page Unlocked} The page protection of a locked page was changed to 'No Access' and the page was unlocked from memory and from the process.
832pub const WAS_UNLOCKED = 715;1247pub const WAS_UNLOCKED = 715;
1248
833/// %hs1249/// %hs
834pub const SERVICE_NOTIFICATION = 716;1250pub const SERVICE_NOTIFICATION = 716;
1251
835/// {Page Locked} One of the pages to lock was already locked.1252/// {Page Locked} One of the pages to lock was already locked.
836pub const WAS_LOCKED = 717;1253pub const WAS_LOCKED = 717;
1254
837/// Application popup: %1 : %21255/// Application popup: %1 : %2
838pub const LOG_HARD_ERROR = 718;1256pub const LOG_HARD_ERROR = 718;
1257
839/// ERROR_ALREADY_WIN321258/// ERROR_ALREADY_WIN32
840pub const ALREADY_WIN32 = 719;1259pub const ALREADY_WIN32 = 719;
1260
841/// {Machine Type Mismatch} The image file %hs is valid, but is for a machine type other than the current machine.1261/// {Machine Type Mismatch} The image file %hs is valid, but is for a machine type other than the current machine.
842pub const IMAGE_MACHINE_TYPE_MISMATCH_EXE = 720;1262pub const IMAGE_MACHINE_TYPE_MISMATCH_EXE = 720;
1263
843/// A yield execution was performed and no thread was available to run.1264/// A yield execution was performed and no thread was available to run.
844pub const NO_YIELD_PERFORMED = 721;1265pub const NO_YIELD_PERFORMED = 721;
1266
845/// The resumable flag to a timer API was ignored.1267/// The resumable flag to a timer API was ignored.
846pub const TIMER_RESUME_IGNORED = 722;1268pub const TIMER_RESUME_IGNORED = 722;
1269
847/// The arbiter has deferred arbitration of these resources to its parent.1270/// The arbiter has deferred arbitration of these resources to its parent.
848pub const ARBITRATION_UNHANDLED = 723;1271pub const ARBITRATION_UNHANDLED = 723;
1272
849/// The inserted CardBus device cannot be started because of a configuration error on "%hs".1273/// The inserted CardBus device cannot be started because of a configuration error on "%hs".
850pub const CARDBUS_NOT_SUPPORTED = 724;1274pub const CARDBUS_NOT_SUPPORTED = 724;
1275
851/// The CPUs in this multiprocessor system are not all the same revision level. To use all processors the operating system restricts itself to the features of the least capable processor in the system. Should problems occur with this system, contact the CPU manufacturer to see if this mix of processors is supported.1276/// The CPUs in this multiprocessor system are not all the same revision level. To use all processors the operating system restricts itself to the features of the least capable processor in the system. Should problems occur with this system, contact the CPU manufacturer to see if this mix of processors is supported.
852pub const MP_PROCESSOR_MISMATCH = 725;1277pub const MP_PROCESSOR_MISMATCH = 725;
1278
853/// The system was put into hibernation.1279/// The system was put into hibernation.
854pub const HIBERNATED = 726;1280pub const HIBERNATED = 726;
1281
855/// The system was resumed from hibernation.1282/// The system was resumed from hibernation.
856pub const RESUME_HIBERNATION = 727;1283pub const RESUME_HIBERNATION = 727;
1284
857/// Windows has detected that the system firmware (BIOS) was updated [previous firmware date = %2, current firmware date %3].1285/// Windows has detected that the system firmware (BIOS) was updated [previous firmware date = %2, current firmware date %3].
858pub const FIRMWARE_UPDATED = 728;1286pub const FIRMWARE_UPDATED = 728;
1287
859/// A device driver is leaking locked I/O pages causing system degradation. The system has automatically enabled tracking code in order to try and catch the culprit.1288/// A device driver is leaking locked I/O pages causing system degradation. The system has automatically enabled tracking code in order to try and catch the culprit.
860pub const DRIVERS_LEAKING_LOCKED_PAGES = 729;1289pub const DRIVERS_LEAKING_LOCKED_PAGES = 729;
1290
861/// The system has awoken.1291/// The system has awoken.
862pub const WAKE_SYSTEM = 730;1292pub const WAKE_SYSTEM = 730;
1293
863/// ERROR_WAIT_11294/// ERROR_WAIT_1
864pub const WAIT_1 = 731;1295pub const WAIT_1 = 731;
1296
865/// ERROR_WAIT_21297/// ERROR_WAIT_2
866pub const WAIT_2 = 732;1298pub const WAIT_2 = 732;
1299
867/// ERROR_WAIT_31300/// ERROR_WAIT_3
868pub const WAIT_3 = 733;1301pub const WAIT_3 = 733;
1302
869/// ERROR_WAIT_631303/// ERROR_WAIT_63
870pub const WAIT_63 = 734;1304pub const WAIT_63 = 734;
1305
871/// ERROR_ABANDONED_WAIT_01306/// ERROR_ABANDONED_WAIT_0
872pub const ABANDONED_WAIT_0 = 735;1307pub const ABANDONED_WAIT_0 = 735;
1308
873/// ERROR_ABANDONED_WAIT_631309/// ERROR_ABANDONED_WAIT_63
874pub const ABANDONED_WAIT_63 = 736;1310pub const ABANDONED_WAIT_63 = 736;
1311
875/// ERROR_USER_APC1312/// ERROR_USER_APC
876pub const USER_APC = 737;1313pub const USER_APC = 737;
1314
877/// ERROR_KERNEL_APC1315/// ERROR_KERNEL_APC
878pub const KERNEL_APC = 738;1316pub const KERNEL_APC = 738;
1317
879/// ERROR_ALERTED1318/// ERROR_ALERTED
880pub const ALERTED = 739;1319pub const ALERTED = 739;
1320
881/// The requested operation requires elevation.1321/// The requested operation requires elevation.
882pub const ELEVATION_REQUIRED = 740;1322pub const ELEVATION_REQUIRED = 740;
1323
883/// A reparse should be performed by the Object Manager since the name of the file resulted in a symbolic link.1324/// A reparse should be performed by the Object Manager since the name of the file resulted in a symbolic link.
884pub const REPARSE = 741;1325pub const REPARSE = 741;
1326
885/// An open/create operation completed while an oplock break is underway.1327/// An open/create operation completed while an oplock break is underway.
886pub const OPLOCK_BREAK_IN_PROGRESS = 742;1328pub const OPLOCK_BREAK_IN_PROGRESS = 742;
1329
887/// A new volume has been mounted by a file system.1330/// A new volume has been mounted by a file system.
888pub const VOLUME_MOUNTED = 743;1331pub const VOLUME_MOUNTED = 743;
1332
889/// This success level status indicates that the transaction state already exists for the registry sub-tree, but that a transaction commit was previously aborted. The commit has now been completed.1333/// This success level status indicates that the transaction state already exists for the registry sub-tree, but that a transaction commit was previously aborted. The commit has now been completed.
890pub const RXACT_COMMITTED = 744;1334pub const RXACT_COMMITTED = 744;
1335
891/// This indicates that a notify change request has been completed due to closing the handle which made the notify change request.1336/// This indicates that a notify change request has been completed due to closing the handle which made the notify change request.
892pub const NOTIFY_CLEANUP = 745;1337pub const NOTIFY_CLEANUP = 745;
1338
893/// {Connect Failure on Primary Transport} An attempt was made to connect to the remote server %hs on the primary transport, but the connection failed. The computer WAS able to connect on a secondary transport.1339/// {Connect Failure on Primary Transport} An attempt was made to connect to the remote server %hs on the primary transport, but the connection failed. The computer WAS able to connect on a secondary transport.
894pub const PRIMARY_TRANSPORT_CONNECT_FAILED = 746;1340pub const PRIMARY_TRANSPORT_CONNECT_FAILED = 746;
1341
895/// Page fault was a transition fault.1342/// Page fault was a transition fault.
896pub const PAGE_FAULT_TRANSITION = 747;1343pub const PAGE_FAULT_TRANSITION = 747;
1344
897/// Page fault was a demand zero fault.1345/// Page fault was a demand zero fault.
898pub const PAGE_FAULT_DEMAND_ZERO = 748;1346pub const PAGE_FAULT_DEMAND_ZERO = 748;
1347
899/// Page fault was a demand zero fault.1348/// Page fault was a demand zero fault.
900pub const PAGE_FAULT_COPY_ON_WRITE = 749;1349pub const PAGE_FAULT_COPY_ON_WRITE = 749;
1350
901/// Page fault was a demand zero fault.1351/// Page fault was a demand zero fault.
902pub const PAGE_FAULT_GUARD_PAGE = 750;1352pub const PAGE_FAULT_GUARD_PAGE = 750;
1353
903/// Page fault was satisfied by reading from a secondary storage device.1354/// Page fault was satisfied by reading from a secondary storage device.
904pub const PAGE_FAULT_PAGING_FILE = 751;1355pub const PAGE_FAULT_PAGING_FILE = 751;
1356
905/// Cached page was locked during operation.1357/// Cached page was locked during operation.
906pub const CACHE_PAGE_LOCKED = 752;1358pub const CACHE_PAGE_LOCKED = 752;
1359
907/// Crash dump exists in paging file.1360/// Crash dump exists in paging file.
908pub const CRASH_DUMP = 753;1361pub const CRASH_DUMP = 753;
1362
909/// Specified buffer contains all zeros.1363/// Specified buffer contains all zeros.
910pub const BUFFER_ALL_ZEROS = 754;1364pub const BUFFER_ALL_ZEROS = 754;
1365
911/// A reparse should be performed by the Object Manager since the name of the file resulted in a symbolic link.1366/// A reparse should be performed by the Object Manager since the name of the file resulted in a symbolic link.
912pub const REPARSE_OBJECT = 755;1367pub const REPARSE_OBJECT = 755;
1368
913/// The device has succeeded a query-stop and its resource requirements have changed.1369/// The device has succeeded a query-stop and its resource requirements have changed.
914pub const RESOURCE_REQUIREMENTS_CHANGED = 756;1370pub const RESOURCE_REQUIREMENTS_CHANGED = 756;
1371
915/// The translator has translated these resources into the global space and no further translations should be performed.1372/// The translator has translated these resources into the global space and no further translations should be performed.
916pub const TRANSLATION_COMPLETE = 757;1373pub const TRANSLATION_COMPLETE = 757;
1374
917/// A process being terminated has no threads to terminate.1375/// A process being terminated has no threads to terminate.
918pub const NOTHING_TO_TERMINATE = 758;1376pub const NOTHING_TO_TERMINATE = 758;
1377
919/// The specified process is not part of a job.1378/// The specified process is not part of a job.
920pub const PROCESS_NOT_IN_JOB = 759;1379pub const PROCESS_NOT_IN_JOB = 759;
1380
921/// The specified process is part of a job.1381/// The specified process is part of a job.
922pub const PROCESS_IN_JOB = 760;1382pub const PROCESS_IN_JOB = 760;
1383
923/// {Volume Shadow Copy Service} The system is now ready for hibernation.1384/// {Volume Shadow Copy Service} The system is now ready for hibernation.
924pub const VOLSNAP_HIBERNATE_READY = 761;1385pub const VOLSNAP_HIBERNATE_READY = 761;
1386
925/// A file system or file system filter driver has successfully completed an FsFilter operation.1387/// A file system or file system filter driver has successfully completed an FsFilter operation.
926pub const FSFILTER_OP_COMPLETED_SUCCESSFULLY = 762;1388pub const FSFILTER_OP_COMPLETED_SUCCESSFULLY = 762;
1389
927/// The specified interrupt vector was already connected.1390/// The specified interrupt vector was already connected.
928pub const INTERRUPT_VECTOR_ALREADY_CONNECTED = 763;1391pub const INTERRUPT_VECTOR_ALREADY_CONNECTED = 763;
1392
929/// The specified interrupt vector is still connected.1393/// The specified interrupt vector is still connected.
930pub const INTERRUPT_STILL_CONNECTED = 764;1394pub const INTERRUPT_STILL_CONNECTED = 764;
1395
931/// An operation is blocked waiting for an oplock.1396/// An operation is blocked waiting for an oplock.
932pub const WAIT_FOR_OPLOCK = 765;1397pub const WAIT_FOR_OPLOCK = 765;
1398
933/// Debugger handled exception.1399/// Debugger handled exception.
934pub const DBG_EXCEPTION_HANDLED = 766;1400pub const DBG_EXCEPTION_HANDLED = 766;
1401
935/// Debugger continued.1402/// Debugger continued.
936pub const DBG_CONTINUE = 767;1403pub const DBG_CONTINUE = 767;
1404
937/// An exception occurred in a user mode callback and the kernel callback frame should be removed.1405/// An exception occurred in a user mode callback and the kernel callback frame should be removed.
938pub const CALLBACK_POP_STACK = 768;1406pub const CALLBACK_POP_STACK = 768;
1407
939/// Compression is disabled for this volume.1408/// Compression is disabled for this volume.
940pub const COMPRESSION_DISABLED = 769;1409pub const COMPRESSION_DISABLED = 769;
1410
941/// The data provider cannot fetch backwards through a result set.1411/// The data provider cannot fetch backwards through a result set.
942pub const CANTFETCHBACKWARDS = 770;1412pub const CANTFETCHBACKWARDS = 770;
1413
943/// The data provider cannot scroll backwards through a result set.1414/// The data provider cannot scroll backwards through a result set.
944pub const CANTSCROLLBACKWARDS = 771;1415pub const CANTSCROLLBACKWARDS = 771;
1416
945/// The data provider requires that previously fetched data is released before asking for more data.1417/// The data provider requires that previously fetched data is released before asking for more data.
946pub const ROWSNOTRELEASED = 772;1418pub const ROWSNOTRELEASED = 772;
1419
947/// The data provider was not able to interpret the flags set for a column binding in an accessor.1420/// The data provider was not able to interpret the flags set for a column binding in an accessor.
948pub const BAD_ACCESSOR_FLAGS = 773;1421pub const BAD_ACCESSOR_FLAGS = 773;
1422
949/// One or more errors occurred while processing the request.1423/// One or more errors occurred while processing the request.
950pub const ERRORS_ENCOUNTERED = 774;1424pub const ERRORS_ENCOUNTERED = 774;
1425
951/// The implementation is not capable of performing the request.1426/// The implementation is not capable of performing the request.
952pub const NOT_CAPABLE = 775;1427pub const NOT_CAPABLE = 775;
1428
953/// The client of a component requested an operation which is not valid given the state of the component instance.1429/// The client of a component requested an operation which is not valid given the state of the component instance.
954pub const REQUEST_OUT_OF_SEQUENCE = 776;1430pub const REQUEST_OUT_OF_SEQUENCE = 776;
1431
955/// A version number could not be parsed.1432/// A version number could not be parsed.
956pub const VERSION_PARSE_ERROR = 777;1433pub const VERSION_PARSE_ERROR = 777;
1434
957/// The iterator's start position is invalid.1435/// The iterator's start position is invalid.
958pub const BADSTARTPOSITION = 778;1436pub const BADSTARTPOSITION = 778;
1437
959/// The hardware has reported an uncorrectable memory error.1438/// The hardware has reported an uncorrectable memory error.
960pub const MEMORY_HARDWARE = 779;1439pub const MEMORY_HARDWARE = 779;
1440
961/// The attempted operation required self healing to be enabled.1441/// The attempted operation required self healing to be enabled.
962pub const DISK_REPAIR_DISABLED = 780;1442pub const DISK_REPAIR_DISABLED = 780;
1443
963/// The Desktop heap encountered an error while allocating session memory. There is more information in the system event log.1444/// The Desktop heap encountered an error while allocating session memory. There is more information in the system event log.
964pub const INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE = 781;1445pub const INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE = 781;
1446
965/// The system power state is transitioning from %2 to %3.1447/// The system power state is transitioning from %2 to %3.
966pub const SYSTEM_POWERSTATE_TRANSITION = 782;1448pub const SYSTEM_POWERSTATE_TRANSITION = 782;
1449
967/// The system power state is transitioning from %2 to %3 but could enter %4.1450/// The system power state is transitioning from %2 to %3 but could enter %4.
968pub const SYSTEM_POWERSTATE_COMPLEX_TRANSITION = 783;1451pub const SYSTEM_POWERSTATE_COMPLEX_TRANSITION = 783;
1452
969/// A thread is getting dispatched with MCA EXCEPTION because of MCA.1453/// A thread is getting dispatched with MCA EXCEPTION because of MCA.
970pub const MCA_EXCEPTION = 784;1454pub const MCA_EXCEPTION = 784;
1455
971/// Access to %1 is monitored by policy rule %2.1456/// Access to %1 is monitored by policy rule %2.
972pub const ACCESS_AUDIT_BY_POLICY = 785;1457pub const ACCESS_AUDIT_BY_POLICY = 785;
1458
973/// Access to %1 has been restricted by your Administrator by policy rule %2.1459/// Access to %1 has been restricted by your Administrator by policy rule %2.
974pub const ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY = 786;1460pub const ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY = 786;
1461
975/// A valid hibernation file has been invalidated and should be abandoned.1462/// A valid hibernation file has been invalidated and should be abandoned.
976pub const ABANDON_HIBERFILE = 787;1463pub const ABANDON_HIBERFILE = 787;
1464
977/// {Delayed Write Failed} Windows was unable to save all the data for the file %hs; the data has been lost. This error may be caused by network connectivity issues. Please try to save this file elsewhere.1465/// {Delayed Write Failed} Windows was unable to save all the data for the file %hs; the data has been lost. This error may be caused by network connectivity issues. Please try to save this file elsewhere.
978pub const LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED = 788;1466pub const LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED = 788;
1467
979/// {Delayed Write Failed} Windows was unable to save all the data for the file %hs; the data has been lost. This error was returned by the server on which the file exists. Please try to save this file elsewhere.1468/// {Delayed Write Failed} Windows was unable to save all the data for the file %hs; the data has been lost. This error was returned by the server on which the file exists. Please try to save this file elsewhere.
980pub const LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR = 789;1469pub const LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR = 789;
1470
981/// {Delayed Write Failed} Windows was unable to save all the data for the file %hs; the data has been lost. This error may be caused if the device has been removed or the media is write-protected.1471/// {Delayed Write Failed} Windows was unable to save all the data for the file %hs; the data has been lost. This error may be caused if the device has been removed or the media is write-protected.
982pub const LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR = 790;1472pub const LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR = 790;
1473
983/// The resources required for this device conflict with the MCFG table.1474/// The resources required for this device conflict with the MCFG table.
984pub const BAD_MCFG_TABLE = 791;1475pub const BAD_MCFG_TABLE = 791;
1476
985/// The volume repair could not be performed while it is online. Please schedule to take the volume offline so that it can be repaired.1477/// The volume repair could not be performed while it is online. Please schedule to take the volume offline so that it can be repaired.
986pub const DISK_REPAIR_REDIRECTED = 792;1478pub const DISK_REPAIR_REDIRECTED = 792;
1479
987/// The volume repair was not successful.1480/// The volume repair was not successful.
988pub const DISK_REPAIR_UNSUCCESSFUL = 793;1481pub const DISK_REPAIR_UNSUCCESSFUL = 793;
1482
989/// One of the volume corruption logs is full. Further corruptions that may be detected won't be logged.1483/// One of the volume corruption logs is full. Further corruptions that may be detected won't be logged.
990pub const CORRUPT_LOG_OVERFULL = 794;1484pub const CORRUPT_LOG_OVERFULL = 794;
1485
991/// One of the volume corruption logs is internally corrupted and needs to be recreated. The volume may contain undetected corruptions and must be scanned.1486/// One of the volume corruption logs is internally corrupted and needs to be recreated. The volume may contain undetected corruptions and must be scanned.
992pub const CORRUPT_LOG_CORRUPTED = 795;1487pub const CORRUPT_LOG_CORRUPTED = 795;
1488
993/// One of the volume corruption logs is unavailable for being operated on.1489/// One of the volume corruption logs is unavailable for being operated on.
994pub const CORRUPT_LOG_UNAVAILABLE = 796;1490pub const CORRUPT_LOG_UNAVAILABLE = 796;
1491
995/// One of the volume corruption logs was deleted while still having corruption records in them. The volume contains detected corruptions and must be scanned.1492/// One of the volume corruption logs was deleted while still having corruption records in them. The volume contains detected corruptions and must be scanned.
996pub const CORRUPT_LOG_DELETED_FULL = 797;1493pub const CORRUPT_LOG_DELETED_FULL = 797;
1494
997/// One of the volume corruption logs was cleared by chkdsk and no longer contains real corruptions.1495/// One of the volume corruption logs was cleared by chkdsk and no longer contains real corruptions.
998pub const CORRUPT_LOG_CLEARED = 798;1496pub const CORRUPT_LOG_CLEARED = 798;
1497
999/// Orphaned files exist on the volume but could not be recovered because no more new names could be created in the recovery directory. Files must be moved from the recovery directory.1498/// Orphaned files exist on the volume but could not be recovered because no more new names could be created in the recovery directory. Files must be moved from the recovery directory.
1000pub const ORPHAN_NAME_EXHAUSTED = 799;1499pub const ORPHAN_NAME_EXHAUSTED = 799;
1500
1001/// The oplock that was associated with this handle is now associated with a different handle.1501/// The oplock that was associated with this handle is now associated with a different handle.
1002pub const OPLOCK_SWITCHED_TO_NEW_HANDLE = 800;1502pub const OPLOCK_SWITCHED_TO_NEW_HANDLE = 800;
1503
1003/// An oplock of the requested level cannot be granted. An oplock of a lower level may be available.1504/// An oplock of the requested level cannot be granted. An oplock of a lower level may be available.
1004pub const CANNOT_GRANT_REQUESTED_OPLOCK = 801;1505pub const CANNOT_GRANT_REQUESTED_OPLOCK = 801;
1506
1005/// The operation did not complete successfully because it would cause an oplock to be broken. The caller has requested that existing oplocks not be broken.1507/// The operation did not complete successfully because it would cause an oplock to be broken. The caller has requested that existing oplocks not be broken.
1006pub const CANNOT_BREAK_OPLOCK = 802;1508pub const CANNOT_BREAK_OPLOCK = 802;
1509
1007/// The handle with which this oplock was associated has been closed. The oplock is now broken.1510/// The handle with which this oplock was associated has been closed. The oplock is now broken.
1008pub const OPLOCK_HANDLE_CLOSED = 803;1511pub const OPLOCK_HANDLE_CLOSED = 803;
1512
1009/// The specified access control entry (ACE) does not contain a condition.1513/// The specified access control entry (ACE) does not contain a condition.
1010pub const NO_ACE_CONDITION = 804;1514pub const NO_ACE_CONDITION = 804;
1515
1011/// The specified access control entry (ACE) contains an invalid condition.1516/// The specified access control entry (ACE) contains an invalid condition.
1012pub const INVALID_ACE_CONDITION = 805;1517pub const INVALID_ACE_CONDITION = 805;
1518
1013/// Access to the specified file handle has been revoked.1519/// Access to the specified file handle has been revoked.
1014pub const FILE_HANDLE_REVOKED = 806;1520pub const FILE_HANDLE_REVOKED = 806;
1521
1015/// An image file was mapped at a different address from the one specified in the image file but fixups will still be automatically performed on the image.1522/// An image file was mapped at a different address from the one specified in the image file but fixups will still be automatically performed on the image.
1016pub const IMAGE_AT_DIFFERENT_BASE = 807;1523pub const IMAGE_AT_DIFFERENT_BASE = 807;
1524
1017/// Access to the extended attribute was denied.1525/// Access to the extended attribute was denied.
1018pub const EA_ACCESS_DENIED = 994;1526pub const EA_ACCESS_DENIED = 994;
1527
1019/// The I/O operation has been aborted because of either a thread exit or an application request.1528/// The I/O operation has been aborted because of either a thread exit or an application request.
1020pub const OPERATION_ABORTED = 995;1529pub const OPERATION_ABORTED = 995;
1530
1021/// Overlapped I/O event is not in a signaled state.1531/// Overlapped I/O event is not in a signaled state.
1022pub const IO_INCOMPLETE = 996;1532pub const IO_INCOMPLETE = 996;
1533
1023/// Overlapped I/O operation is in progress.1534/// Overlapped I/O operation is in progress.
1024pub const IO_PENDING = 997;1535pub const IO_PENDING = 997;
1536
1025/// Invalid access to memory location.1537/// Invalid access to memory location.
1026pub const NOACCESS = 998;1538pub const NOACCESS = 998;
1539
1027/// Error performing inpage operation.1540/// Error performing inpage operation.
1028pub const SWAPERROR = 999;1541pub const SWAPERROR = 999;
1542
1029/// Recursion too deep; the stack overflowed.1543/// Recursion too deep; the stack overflowed.
1030pub const STACK_OVERFLOW = 1001;1544pub const STACK_OVERFLOW = 1001;
1545
1031/// The window cannot act on the sent message.1546/// The window cannot act on the sent message.
1032pub const INVALID_MESSAGE = 1002;1547pub const INVALID_MESSAGE = 1002;
1548
1033/// Cannot complete this function.1549/// Cannot complete this function.
1034pub const CAN_NOT_COMPLETE = 1003;1550pub const CAN_NOT_COMPLETE = 1003;
1551
1035/// Invalid flags.1552/// Invalid flags.
1036pub const INVALID_FLAGS = 1004;1553pub const INVALID_FLAGS = 1004;
1554
1037/// The volume does not contain a recognized file system. Please make sure that all required file system drivers are loaded and that the volume is not corrupted.1555/// The volume does not contain a recognized file system. Please make sure that all required file system drivers are loaded and that the volume is not corrupted.
1038pub const UNRECOGNIZED_VOLUME = 1005;1556pub const UNRECOGNIZED_VOLUME = 1005;
1557
1039/// The volume for a file has been externally altered so that the opened file is no longer valid.1558/// The volume for a file has been externally altered so that the opened file is no longer valid.
1040pub const FILE_INVALID = 1006;1559pub const FILE_INVALID = 1006;
1560
1041/// The requested operation cannot be performed in full-screen mode.1561/// The requested operation cannot be performed in full-screen mode.
1042pub const FULLSCREEN_MODE = 1007;1562pub const FULLSCREEN_MODE = 1007;
1563
1043/// An attempt was made to reference a token that does not exist.1564/// An attempt was made to reference a token that does not exist.
1044pub const NO_TOKEN = 1008;1565pub const NO_TOKEN = 1008;
1566
1045/// The configuration registry database is corrupt.1567/// The configuration registry database is corrupt.
1046pub const BADDB = 1009;1568pub const BADDB = 1009;
1569
1047/// The configuration registry key is invalid.1570/// The configuration registry key is invalid.
1048pub const BADKEY = 1010;1571pub const BADKEY = 1010;
1572
1049/// The configuration registry key could not be opened.1573/// The configuration registry key could not be opened.
1050pub const CANTOPEN = 1011;1574pub const CANTOPEN = 1011;
1575
1051/// The configuration registry key could not be read.1576/// The configuration registry key could not be read.
1052pub const CANTREAD = 1012;1577pub const CANTREAD = 1012;
1578
1053/// The configuration registry key could not be written.1579/// The configuration registry key could not be written.
1054pub const CANTWRITE = 1013;1580pub const CANTWRITE = 1013;
1581
1055/// One of the files in the registry database had to be recovered by use of a log or alternate copy. The recovery was successful.1582/// One of the files in the registry database had to be recovered by use of a log or alternate copy. The recovery was successful.
1056pub const REGISTRY_RECOVERED = 1014;1583pub const REGISTRY_RECOVERED = 1014;
1584
1057/// The registry is corrupted. The structure of one of the files containing registry data is corrupted, or the system's memory image of the file is corrupted, or the file could not be recovered because the alternate copy or log was absent or corrupted.1585/// The registry is corrupted. The structure of one of the files containing registry data is corrupted, or the system's memory image of the file is corrupted, or the file could not be recovered because the alternate copy or log was absent or corrupted.
1058pub const REGISTRY_CORRUPT = 1015;1586pub const REGISTRY_CORRUPT = 1015;
1587
1059/// An I/O operation initiated by the registry failed unrecoverably. The registry could not read in, or write out, or flush, one of the files that contain the system's image of the registry.1588/// An I/O operation initiated by the registry failed unrecoverably. The registry could not read in, or write out, or flush, one of the files that contain the system's image of the registry.
1060pub const REGISTRY_IO_FAILED = 1016;1589pub const REGISTRY_IO_FAILED = 1016;
1590
1061/// The system has attempted to load or restore a file into the registry, but the specified file is not in a registry file format.1591/// The system has attempted to load or restore a file into the registry, but the specified file is not in a registry file format.
1062pub const NOT_REGISTRY_FILE = 1017;1592pub const NOT_REGISTRY_FILE = 1017;
1593
1063/// Illegal operation attempted on a registry key that has been marked for deletion.1594/// Illegal operation attempted on a registry key that has been marked for deletion.
1064pub const KEY_DELETED = 1018;1595pub const KEY_DELETED = 1018;
1596
1065/// System could not allocate the required space in a registry log.1597/// System could not allocate the required space in a registry log.
1066pub const NO_LOG_SPACE = 1019;1598pub const NO_LOG_SPACE = 1019;
1599
1067/// Cannot create a symbolic link in a registry key that already has subkeys or values.1600/// Cannot create a symbolic link in a registry key that already has subkeys or values.
1068pub const KEY_HAS_CHILDREN = 1020;1601pub const KEY_HAS_CHILDREN = 1020;
1602
1069/// Cannot create a stable subkey under a volatile parent key.1603/// Cannot create a stable subkey under a volatile parent key.
1070pub const CHILD_MUST_BE_VOLATILE = 1021;1604pub const CHILD_MUST_BE_VOLATILE = 1021;
1605
1071/// A notify change request is being completed and the information is not being returned in the caller's buffer. The caller now needs to enumerate the files to find the changes.1606/// A notify change request is being completed and the information is not being returned in the caller's buffer. The caller now needs to enumerate the files to find the changes.
1072pub const NOTIFY_ENUM_DIR = 1022;1607pub const NOTIFY_ENUM_DIR = 1022;
1608
1073/// A stop control has been sent to a service that other running services are dependent on.1609/// A stop control has been sent to a service that other running services are dependent on.
1074pub const DEPENDENT_SERVICES_RUNNING = 1051;1610pub const DEPENDENT_SERVICES_RUNNING = 1051;
1611
1075/// The requested control is not valid for this service.1612/// The requested control is not valid for this service.
1076pub const INVALID_SERVICE_CONTROL = 1052;1613pub const INVALID_SERVICE_CONTROL = 1052;
1614
1077/// The service did not respond to the start or control request in a timely fashion.1615/// The service did not respond to the start or control request in a timely fashion.
1078pub const SERVICE_REQUEST_TIMEOUT = 1053;1616pub const SERVICE_REQUEST_TIMEOUT = 1053;
1617
1079/// A thread could not be created for the service.1618/// A thread could not be created for the service.
1080pub const SERVICE_NO_THREAD = 1054;1619pub const SERVICE_NO_THREAD = 1054;
1620
1081/// The service database is locked.1621/// The service database is locked.
1082pub const SERVICE_DATABASE_LOCKED = 1055;1622pub const SERVICE_DATABASE_LOCKED = 1055;
1623
1083/// An instance of the service is already running.1624/// An instance of the service is already running.
1084pub const SERVICE_ALREADY_RUNNING = 1056;1625pub const SERVICE_ALREADY_RUNNING = 1056;
1626
1085/// The account name is invalid or does not exist, or the password is invalid for the account name specified.1627/// The account name is invalid or does not exist, or the password is invalid for the account name specified.
1086pub const INVALID_SERVICE_ACCOUNT = 1057;1628pub const INVALID_SERVICE_ACCOUNT = 1057;
1629
1087/// The service cannot be started, either because it is disabled or because it has no enabled devices associated with it.1630/// The service cannot be started, either because it is disabled or because it has no enabled devices associated with it.
1088pub const SERVICE_DISABLED = 1058;1631pub const SERVICE_DISABLED = 1058;
1632
1089/// Circular service dependency was specified.1633/// Circular service dependency was specified.
1090pub const CIRCULAR_DEPENDENCY = 1059;1634pub const CIRCULAR_DEPENDENCY = 1059;
1635
1091/// The specified service does not exist as an installed service.1636/// The specified service does not exist as an installed service.
1092pub const SERVICE_DOES_NOT_EXIST = 1060;1637pub const SERVICE_DOES_NOT_EXIST = 1060;
1638
1093/// The service cannot accept control messages at this time.1639/// The service cannot accept control messages at this time.
1094pub const SERVICE_CANNOT_ACCEPT_CTRL = 1061;1640pub const SERVICE_CANNOT_ACCEPT_CTRL = 1061;
1641
1095/// The service has not been started.1642/// The service has not been started.
1096pub const SERVICE_NOT_ACTIVE = 1062;1643pub const SERVICE_NOT_ACTIVE = 1062;
1644
1097/// The service process could not connect to the service controller.1645/// The service process could not connect to the service controller.
1098pub const FAILED_SERVICE_CONTROLLER_CONNECT = 1063;1646pub const FAILED_SERVICE_CONTROLLER_CONNECT = 1063;
1647
1099/// An exception occurred in the service when handling the control request.1648/// An exception occurred in the service when handling the control request.
1100pub const EXCEPTION_IN_SERVICE = 1064;1649pub const EXCEPTION_IN_SERVICE = 1064;
1650
1101/// The database specified does not exist.1651/// The database specified does not exist.
1102pub const DATABASE_DOES_NOT_EXIST = 1065;1652pub const DATABASE_DOES_NOT_EXIST = 1065;
1653
1103/// The service has returned a service-specific error code.1654/// The service has returned a service-specific error code.
1104pub const SERVICE_SPECIFIC_ERROR = 1066;1655pub const SERVICE_SPECIFIC_ERROR = 1066;
1656
1105/// The process terminated unexpectedly.1657/// The process terminated unexpectedly.
1106pub const PROCESS_ABORTED = 1067;1658pub const PROCESS_ABORTED = 1067;
1659
1107/// The dependency service or group failed to start.1660/// The dependency service or group failed to start.
1108pub const SERVICE_DEPENDENCY_FAIL = 1068;1661pub const SERVICE_DEPENDENCY_FAIL = 1068;
1662
1109/// The service did not start due to a logon failure.1663/// The service did not start due to a logon failure.
1110pub const SERVICE_LOGON_FAILED = 1069;1664pub const SERVICE_LOGON_FAILED = 1069;
1665
1111/// After starting, the service hung in a start-pending state.1666/// After starting, the service hung in a start-pending state.
1112pub const SERVICE_START_HANG = 1070;1667pub const SERVICE_START_HANG = 1070;
1668
1113/// The specified service database lock is invalid.1669/// The specified service database lock is invalid.
1114pub const INVALID_SERVICE_LOCK = 1071;1670pub const INVALID_SERVICE_LOCK = 1071;
1671
1115/// The specified service has been marked for deletion.1672/// The specified service has been marked for deletion.
1116pub const SERVICE_MARKED_FOR_DELETE = 1072;1673pub const SERVICE_MARKED_FOR_DELETE = 1072;
1674
1117/// The specified service already exists.1675/// The specified service already exists.
1118pub const SERVICE_EXISTS = 1073;1676pub const SERVICE_EXISTS = 1073;
1677
1119/// The system is currently running with the last-known-good configuration.1678/// The system is currently running with the last-known-good configuration.
1120pub const ALREADY_RUNNING_LKG = 1074;1679pub const ALREADY_RUNNING_LKG = 1074;
1680
1121/// The dependency service does not exist or has been marked for deletion.1681/// The dependency service does not exist or has been marked for deletion.
1122pub const SERVICE_DEPENDENCY_DELETED = 1075;1682pub const SERVICE_DEPENDENCY_DELETED = 1075;
1683
1123/// The current boot has already been accepted for use as the last-known-good control set.1684/// The current boot has already been accepted for use as the last-known-good control set.
1124pub const BOOT_ALREADY_ACCEPTED = 1076;1685pub const BOOT_ALREADY_ACCEPTED = 1076;
1686
1125/// No attempts to start the service have been made since the last boot.1687/// No attempts to start the service have been made since the last boot.
1126pub const SERVICE_NEVER_STARTED = 1077;1688pub const SERVICE_NEVER_STARTED = 1077;
1689
1127/// The name is already in use as either a service name or a service display name.1690/// The name is already in use as either a service name or a service display name.
1128pub const DUPLICATE_SERVICE_NAME = 1078;1691pub const DUPLICATE_SERVICE_NAME = 1078;
1692
1129/// The account specified for this service is different from the account specified for other services running in the same process.1693/// The account specified for this service is different from the account specified for other services running in the same process.
1130pub const DIFFERENT_SERVICE_ACCOUNT = 1079;1694pub const DIFFERENT_SERVICE_ACCOUNT = 1079;
1695
1131/// Failure actions can only be set for Win32 services, not for drivers.1696/// Failure actions can only be set for Win32 services, not for drivers.
1132pub const CANNOT_DETECT_DRIVER_FAILURE = 1080;1697pub const CANNOT_DETECT_DRIVER_FAILURE = 1080;
1698
1133/// This service runs in the same process as the service control manager. Therefore, the service control manager cannot take action if this service's process terminates unexpectedly.1699/// This service runs in the same process as the service control manager. Therefore, the service control manager cannot take action if this service's process terminates unexpectedly.
1134pub const CANNOT_DETECT_PROCESS_ABORT = 1081;1700pub const CANNOT_DETECT_PROCESS_ABORT = 1081;
1701
1135/// No recovery program has been configured for this service.1702/// No recovery program has been configured for this service.
1136pub const NO_RECOVERY_PROGRAM = 1082;1703pub const NO_RECOVERY_PROGRAM = 1082;
1704
1137/// The executable program that this service is configured to run in does not implement the service.1705/// The executable program that this service is configured to run in does not implement the service.
1138pub const SERVICE_NOT_IN_EXE = 1083;1706pub const SERVICE_NOT_IN_EXE = 1083;
1707
1139/// This service cannot be started in Safe Mode.1708/// This service cannot be started in Safe Mode.
1140pub const NOT_SAFEBOOT_SERVICE = 1084;1709pub const NOT_SAFEBOOT_SERVICE = 1084;
1710
1141/// The physical end of the tape has been reached.1711/// The physical end of the tape has been reached.
1142pub const END_OF_MEDIA = 1100;1712pub const END_OF_MEDIA = 1100;
1713
1143/// A tape access reached a filemark.1714/// A tape access reached a filemark.
1144pub const FILEMARK_DETECTED = 1101;1715pub const FILEMARK_DETECTED = 1101;
1716
1145/// The beginning of the tape or a partition was encountered.1717/// The beginning of the tape or a partition was encountered.
1146pub const BEGINNING_OF_MEDIA = 1102;1718pub const BEGINNING_OF_MEDIA = 1102;
1719
1147/// A tape access reached the end of a set of files.1720/// A tape access reached the end of a set of files.
1148pub const SETMARK_DETECTED = 1103;1721pub const SETMARK_DETECTED = 1103;
1722
1149/// No more data is on the tape.1723/// No more data is on the tape.
1150pub const NO_DATA_DETECTED = 1104;1724pub const NO_DATA_DETECTED = 1104;
1725
1151/// Tape could not be partitioned.1726/// Tape could not be partitioned.
1152pub const PARTITION_FAILURE = 1105;1727pub const PARTITION_FAILURE = 1105;
1728
1153/// When accessing a new tape of a multivolume partition, the current block size is incorrect.1729/// When accessing a new tape of a multivolume partition, the current block size is incorrect.
1154pub const INVALID_BLOCK_LENGTH = 1106;1730pub const INVALID_BLOCK_LENGTH = 1106;
1731
1155/// Tape partition information could not be found when loading a tape.1732/// Tape partition information could not be found when loading a tape.
1156pub const DEVICE_NOT_PARTITIONED = 1107;1733pub const DEVICE_NOT_PARTITIONED = 1107;
1734
1157/// Unable to lock the media eject mechanism.1735/// Unable to lock the media eject mechanism.
1158pub const UNABLE_TO_LOCK_MEDIA = 1108;1736pub const UNABLE_TO_LOCK_MEDIA = 1108;
1737
1159/// Unable to unload the media.1738/// Unable to unload the media.
1160pub const UNABLE_TO_UNLOAD_MEDIA = 1109;1739pub const UNABLE_TO_UNLOAD_MEDIA = 1109;
1740
1161/// The media in the drive may have changed.1741/// The media in the drive may have changed.
1162pub const MEDIA_CHANGED = 1110;1742pub const MEDIA_CHANGED = 1110;
1743
1163/// The I/O bus was reset.1744/// The I/O bus was reset.
1164pub const BUS_RESET = 1111;1745pub const BUS_RESET = 1111;
1746
1165/// No media in drive.1747/// No media in drive.
1166pub const NO_MEDIA_IN_DRIVE = 1112;1748pub const NO_MEDIA_IN_DRIVE = 1112;
1749
1167/// No mapping for the Unicode character exists in the target multi-byte code page.1750/// No mapping for the Unicode character exists in the target multi-byte code page.
1168pub const NO_UNICODE_TRANSLATION = 1113;1751pub const NO_UNICODE_TRANSLATION = 1113;
1752
1169/// A dynamic link library (DLL) initialization routine failed.1753/// A dynamic link library (DLL) initialization routine failed.
1170pub const DLL_INIT_FAILED = 1114;1754pub const DLL_INIT_FAILED = 1114;
1755
1171/// A system shutdown is in progress.1756/// A system shutdown is in progress.
1172pub const SHUTDOWN_IN_PROGRESS = 1115;1757pub const SHUTDOWN_IN_PROGRESS = 1115;
1758
1173/// Unable to abort the system shutdown because no shutdown was in progress.1759/// Unable to abort the system shutdown because no shutdown was in progress.
1174pub const NO_SHUTDOWN_IN_PROGRESS = 1116;1760pub const NO_SHUTDOWN_IN_PROGRESS = 1116;
1761
1175/// The request could not be performed because of an I/O device error.1762/// The request could not be performed because of an I/O device error.
1176pub const IO_DEVICE = 1117;1763pub const IO_DEVICE = 1117;
1764
1177/// No serial device was successfully initialized. The serial driver will unload.1765/// No serial device was successfully initialized. The serial driver will unload.
1178pub const SERIAL_NO_DEVICE = 1118;1766pub const SERIAL_NO_DEVICE = 1118;
1767
1179/// Unable to open a device that was sharing an interrupt request (IRQ) with other devices. At least one other device that uses that IRQ was already opened.1768/// Unable to open a device that was sharing an interrupt request (IRQ) with other devices. At least one other device that uses that IRQ was already opened.
1180pub const IRQ_BUSY = 1119;1769pub const IRQ_BUSY = 1119;
1770
1181/// A serial I/O operation was completed by another write to the serial port. The IOCTL_SERIAL_XOFF_COUNTER reached zero.)1771/// A serial I/O operation was completed by another write to the serial port. The IOCTL_SERIAL_XOFF_COUNTER reached zero.)
1182pub const MORE_WRITES = 1120;1772pub const MORE_WRITES = 1120;
1773
1183/// A serial I/O operation completed because the timeout period expired. The IOCTL_SERIAL_XOFF_COUNTER did not reach zero.)1774/// A serial I/O operation completed because the timeout period expired. The IOCTL_SERIAL_XOFF_COUNTER did not reach zero.)
1184pub const COUNTER_TIMEOUT = 1121;1775pub const COUNTER_TIMEOUT = 1121;
1776
1185/// No ID address mark was found on the floppy disk.1777/// No ID address mark was found on the floppy disk.
1186pub const FLOPPY_ID_MARK_NOT_FOUND = 1122;1778pub const FLOPPY_ID_MARK_NOT_FOUND = 1122;
1779
1187/// Mismatch between the floppy disk sector ID field and the floppy disk controller track address.1780/// Mismatch between the floppy disk sector ID field and the floppy disk controller track address.
1188pub const FLOPPY_WRONG_CYLINDER = 1123;1781pub const FLOPPY_WRONG_CYLINDER = 1123;
1782
1189/// The floppy disk controller reported an error that is not recognized by the floppy disk driver.1783/// The floppy disk controller reported an error that is not recognized by the floppy disk driver.
1190pub const FLOPPY_UNKNOWN_ERROR = 1124;1784pub const FLOPPY_UNKNOWN_ERROR = 1124;
1785
1191/// The floppy disk controller returned inconsistent results in its registers.1786/// The floppy disk controller returned inconsistent results in its registers.
1192pub const FLOPPY_BAD_REGISTERS = 1125;1787pub const FLOPPY_BAD_REGISTERS = 1125;
1788
1193/// While accessing the hard disk, a recalibrate operation failed, even after retries.1789/// While accessing the hard disk, a recalibrate operation failed, even after retries.
1194pub const DISK_RECALIBRATE_FAILED = 1126;1790pub const DISK_RECALIBRATE_FAILED = 1126;
1791
1195/// While accessing the hard disk, a disk operation failed even after retries.1792/// While accessing the hard disk, a disk operation failed even after retries.
1196pub const DISK_OPERATION_FAILED = 1127;1793pub const DISK_OPERATION_FAILED = 1127;
1794
1197/// While accessing the hard disk, a disk controller reset was needed, but even that failed.1795/// While accessing the hard disk, a disk controller reset was needed, but even that failed.
1198pub const DISK_RESET_FAILED = 1128;1796pub const DISK_RESET_FAILED = 1128;
1797
1199/// Physical end of tape encountered.1798/// Physical end of tape encountered.
1200pub const EOM_OVERFLOW = 1129;1799pub const EOM_OVERFLOW = 1129;
1800
1201/// Not enough server storage is available to process this command.1801/// Not enough server storage is available to process this command.
1202pub const NOT_ENOUGH_SERVER_MEMORY = 1130;1802pub const NOT_ENOUGH_SERVER_MEMORY = 1130;
1803
1203/// A potential deadlock condition has been detected.1804/// A potential deadlock condition has been detected.
1204pub const POSSIBLE_DEADLOCK = 1131;1805pub const POSSIBLE_DEADLOCK = 1131;
1806
1205/// The base address or the file offset specified does not have the proper alignment.1807/// The base address or the file offset specified does not have the proper alignment.
1206pub const MAPPED_ALIGNMENT = 1132;1808pub const MAPPED_ALIGNMENT = 1132;
1809
1207/// An attempt to change the system power state was vetoed by another application or driver.1810/// An attempt to change the system power state was vetoed by another application or driver.
1208pub const SET_POWER_STATE_VETOED = 1140;1811pub const SET_POWER_STATE_VETOED = 1140;
1812
1209/// The system BIOS failed an attempt to change the system power state.1813/// The system BIOS failed an attempt to change the system power state.
1210pub const SET_POWER_STATE_FAILED = 1141;1814pub const SET_POWER_STATE_FAILED = 1141;
1815
1211/// An attempt was made to create more links on a file than the file system supports.1816/// An attempt was made to create more links on a file than the file system supports.
1212pub const TOO_MANY_LINKS = 1142;1817pub const TOO_MANY_LINKS = 1142;
1818
1213/// The specified program requires a newer version of Windows.1819/// The specified program requires a newer version of Windows.
1214pub const OLD_WIN_VERSION = 1150;1820pub const OLD_WIN_VERSION = 1150;
1821
1215/// The specified program is not a Windows or MS-DOS program.1822/// The specified program is not a Windows or MS-DOS program.
1216pub const APP_WRONG_OS = 1151;1823pub const APP_WRONG_OS = 1151;
1824
1217/// Cannot start more than one instance of the specified program.1825/// Cannot start more than one instance of the specified program.
1218pub const SINGLE_INSTANCE_APP = 1152;1826pub const SINGLE_INSTANCE_APP = 1152;
1827
1219/// The specified program was written for an earlier version of Windows.1828/// The specified program was written for an earlier version of Windows.
1220pub const RMODE_APP = 1153;1829pub const RMODE_APP = 1153;
1830
1221/// One of the library files needed to run this application is damaged.1831/// One of the library files needed to run this application is damaged.
1222pub const INVALID_DLL = 1154;1832pub const INVALID_DLL = 1154;
1833
1223/// No application is associated with the specified file for this operation.1834/// No application is associated with the specified file for this operation.
1224pub const NO_ASSOCIATION = 1155;1835pub const NO_ASSOCIATION = 1155;
1836
1225/// An error occurred in sending the command to the application.1837/// An error occurred in sending the command to the application.
1226pub const DDE_FAIL = 1156;1838pub const DDE_FAIL = 1156;
1839
1227/// One of the library files needed to run this application cannot be found.1840/// One of the library files needed to run this application cannot be found.
1228pub const DLL_NOT_FOUND = 1157;1841pub const DLL_NOT_FOUND = 1157;
1842
1229/// The current process has used all of its system allowance of handles for Window Manager objects.1843/// The current process has used all of its system allowance of handles for Window Manager objects.
1230pub const NO_MORE_USER_HANDLES = 1158;1844pub const NO_MORE_USER_HANDLES = 1158;
1845
1231/// The message can be used only with synchronous operations.1846/// The message can be used only with synchronous operations.
1232pub const MESSAGE_SYNC_ONLY = 1159;1847pub const MESSAGE_SYNC_ONLY = 1159;
1848
1233/// The indicated source element has no media.1849/// The indicated source element has no media.
1234pub const SOURCE_ELEMENT_EMPTY = 1160;1850pub const SOURCE_ELEMENT_EMPTY = 1160;
1851
1235/// The indicated destination element already contains media.1852/// The indicated destination element already contains media.
1236pub const DESTINATION_ELEMENT_FULL = 1161;1853pub const DESTINATION_ELEMENT_FULL = 1161;
1854
1237/// The indicated element does not exist.1855/// The indicated element does not exist.
1238pub const ILLEGAL_ELEMENT_ADDRESS = 1162;1856pub const ILLEGAL_ELEMENT_ADDRESS = 1162;
1857
1239/// The indicated element is part of a magazine that is not present.1858/// The indicated element is part of a magazine that is not present.
1240pub const MAGAZINE_NOT_PRESENT = 1163;1859pub const MAGAZINE_NOT_PRESENT = 1163;
1860
1241/// The indicated device requires reinitialization due to hardware errors.1861/// The indicated device requires reinitialization due to hardware errors.
1242pub const DEVICE_REINITIALIZATION_NEEDED = 1164;1862pub const DEVICE_REINITIALIZATION_NEEDED = 1164;
1863
1243/// The device has indicated that cleaning is required before further operations are attempted.1864/// The device has indicated that cleaning is required before further operations are attempted.
1244pub const DEVICE_REQUIRES_CLEANING = 1165;1865pub const DEVICE_REQUIRES_CLEANING = 1165;
1866
1245/// The device has indicated that its door is open.1867/// The device has indicated that its door is open.
1246pub const DEVICE_DOOR_OPEN = 1166;1868pub const DEVICE_DOOR_OPEN = 1166;
1869
1247/// The device is not connected.1870/// The device is not connected.
1248pub const DEVICE_NOT_CONNECTED = 1167;1871pub const DEVICE_NOT_CONNECTED = 1167;
1872
1249/// Element not found.1873/// Element not found.
1250pub const NOT_FOUND = 1168;1874pub const NOT_FOUND = 1168;
1875
1251/// There was no match for the specified key in the index.1876/// There was no match for the specified key in the index.
1252pub const NO_MATCH = 1169;1877pub const NO_MATCH = 1169;
1878
1253/// The property set specified does not exist on the object.1879/// The property set specified does not exist on the object.
1254pub const SET_NOT_FOUND = 1170;1880pub const SET_NOT_FOUND = 1170;
1881
1255/// The point passed to GetMouseMovePoints is not in the buffer.1882/// The point passed to GetMouseMovePoints is not in the buffer.
1256pub const POINT_NOT_FOUND = 1171;1883pub const POINT_NOT_FOUND = 1171;
1884
1257/// The tracking (workstation) service is not running.1885/// The tracking (workstation) service is not running.
1258pub const NO_TRACKING_SERVICE = 1172;1886pub const NO_TRACKING_SERVICE = 1172;
1887
1259/// The Volume ID could not be found.1888/// The Volume ID could not be found.
1260pub const NO_VOLUME_ID = 1173;1889pub const NO_VOLUME_ID = 1173;
1890
1261/// Unable to remove the file to be replaced.1891/// Unable to remove the file to be replaced.
1262pub const UNABLE_TO_REMOVE_REPLACED = 1175;1892pub const UNABLE_TO_REMOVE_REPLACED = 1175;
1893
1263/// Unable to move the replacement file to the file to be replaced. The file to be replaced has retained its original name.1894/// Unable to move the replacement file to the file to be replaced. The file to be replaced has retained its original name.
1264pub const UNABLE_TO_MOVE_REPLACEMENT = 1176;1895pub const UNABLE_TO_MOVE_REPLACEMENT = 1176;
1896
1265/// Unable to move the replacement file to the file to be replaced. The file to be replaced has been renamed using the backup name.1897/// Unable to move the replacement file to the file to be replaced. The file to be replaced has been renamed using the backup name.
1266pub const UNABLE_TO_MOVE_REPLACEMENT_2 = 1177;1898pub const UNABLE_TO_MOVE_REPLACEMENT_2 = 1177;
1899
1267/// The volume change journal is being deleted.1900/// The volume change journal is being deleted.
1268pub const JOURNAL_DELETE_IN_PROGRESS = 1178;1901pub const JOURNAL_DELETE_IN_PROGRESS = 1178;
1902
1269/// The volume change journal is not active.1903/// The volume change journal is not active.
1270pub const JOURNAL_NOT_ACTIVE = 1179;1904pub const JOURNAL_NOT_ACTIVE = 1179;
1905
1271/// A file was found, but it may not be the correct file.1906/// A file was found, but it may not be the correct file.
1272pub const POTENTIAL_FILE_FOUND = 1180;1907pub const POTENTIAL_FILE_FOUND = 1180;
1908
1273/// The journal entry has been deleted from the journal.1909/// The journal entry has been deleted from the journal.
1274pub const JOURNAL_ENTRY_DELETED = 1181;1910pub const JOURNAL_ENTRY_DELETED = 1181;
1911
1275/// A system shutdown has already been scheduled.1912/// A system shutdown has already been scheduled.
1276pub const SHUTDOWN_IS_SCHEDULED = 1190;1913pub const SHUTDOWN_IS_SCHEDULED = 1190;
1914
1277/// The system shutdown cannot be initiated because there are other users logged on to the computer.1915/// The system shutdown cannot be initiated because there are other users logged on to the computer.
1278pub const SHUTDOWN_USERS_LOGGED_ON = 1191;1916pub const SHUTDOWN_USERS_LOGGED_ON = 1191;
1917
1279/// The specified device name is invalid.1918/// The specified device name is invalid.
1280pub const BAD_DEVICE = 1200;1919pub const BAD_DEVICE = 1200;
1920
1281/// The device is not currently connected but it is a remembered connection.1921/// The device is not currently connected but it is a remembered connection.
1282pub const CONNECTION_UNAVAIL = 1201;1922pub const CONNECTION_UNAVAIL = 1201;
1923
1283/// The local device name has a remembered connection to another network resource.1924/// The local device name has a remembered connection to another network resource.
1284pub const DEVICE_ALREADY_REMEMBERED = 1202;1925pub const DEVICE_ALREADY_REMEMBERED = 1202;
1926
1285/// The network path was either typed incorrectly, does not exist, or the network provider is not currently available. Please try retyping the path or contact your network administrator.1927/// The network path was either typed incorrectly, does not exist, or the network provider is not currently available. Please try retyping the path or contact your network administrator.
1286pub const NO_NET_OR_BAD_PATH = 1203;1928pub const NO_NET_OR_BAD_PATH = 1203;
1929
1287/// The specified network provider name is invalid.1930/// The specified network provider name is invalid.
1288pub const BAD_PROVIDER = 1204;1931pub const BAD_PROVIDER = 1204;
1932
1289/// Unable to open the network connection profile.1933/// Unable to open the network connection profile.
1290pub const CANNOT_OPEN_PROFILE = 1205;1934pub const CANNOT_OPEN_PROFILE = 1205;
1935
1291/// The network connection profile is corrupted.1936/// The network connection profile is corrupted.
1292pub const BAD_PROFILE = 1206;1937pub const BAD_PROFILE = 1206;
1938
1293/// Cannot enumerate a noncontainer.1939/// Cannot enumerate a noncontainer.
1294pub const NOT_CONTAINER = 1207;1940pub const NOT_CONTAINER = 1207;
1941
1295/// An extended error has occurred.1942/// An extended error has occurred.
1296pub const EXTENDED_ERROR = 1208;1943pub const EXTENDED_ERROR = 1208;
1944
1297/// The format of the specified group name is invalid.1945/// The format of the specified group name is invalid.
1298pub const INVALID_GROUPNAME = 1209;1946pub const INVALID_GROUPNAME = 1209;
1947
1299/// The format of the specified computer name is invalid.1948/// The format of the specified computer name is invalid.
1300pub const INVALID_COMPUTERNAME = 1210;1949pub const INVALID_COMPUTERNAME = 1210;
1950
1301/// The format of the specified event name is invalid.1951/// The format of the specified event name is invalid.
1302pub const INVALID_EVENTNAME = 1211;1952pub const INVALID_EVENTNAME = 1211;
1953
1303/// The format of the specified domain name is invalid.1954/// The format of the specified domain name is invalid.
1304pub const INVALID_DOMAINNAME = 1212;1955pub const INVALID_DOMAINNAME = 1212;
1956
1305/// The format of the specified service name is invalid.1957/// The format of the specified service name is invalid.
1306pub const INVALID_SERVICENAME = 1213;1958pub const INVALID_SERVICENAME = 1213;
1959
1307/// The format of the specified network name is invalid.1960/// The format of the specified network name is invalid.
1308pub const INVALID_NETNAME = 1214;1961pub const INVALID_NETNAME = 1214;
1962
1309/// The format of the specified share name is invalid.1963/// The format of the specified share name is invalid.
1310pub const INVALID_SHARENAME = 1215;1964pub const INVALID_SHARENAME = 1215;
1965
1311/// The format of the specified password is invalid.1966/// The format of the specified password is invalid.
1312pub const INVALID_PASSWORDNAME = 1216;1967pub const INVALID_PASSWORDNAME = 1216;
1968
1313/// The format of the specified message name is invalid.1969/// The format of the specified message name is invalid.
1314pub const INVALID_MESSAGENAME = 1217;1970pub const INVALID_MESSAGENAME = 1217;
1971
1315/// The format of the specified message destination is invalid.1972/// The format of the specified message destination is invalid.
1316pub const INVALID_MESSAGEDEST = 1218;1973pub const INVALID_MESSAGEDEST = 1218;
1974
1317/// Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed. Disconnect all previous connections to the server or shared resource and try again.1975/// Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed. Disconnect all previous connections to the server or shared resource and try again.
1318pub const SESSION_CREDENTIAL_CONFLICT = 1219;1976pub const SESSION_CREDENTIAL_CONFLICT = 1219;
1977
1319/// An attempt was made to establish a session to a network server, but there are already too many sessions established to that server.1978/// An attempt was made to establish a session to a network server, but there are already too many sessions established to that server.
1320pub const REMOTE_SESSION_LIMIT_EXCEEDED = 1220;1979pub const REMOTE_SESSION_LIMIT_EXCEEDED = 1220;
1980
1321/// The workgroup or domain name is already in use by another computer on the network.1981/// The workgroup or domain name is already in use by another computer on the network.
1322pub const DUP_DOMAINNAME = 1221;1982pub const DUP_DOMAINNAME = 1221;
1983
1323/// The network is not present or not started.1984/// The network is not present or not started.
1324pub const NO_NETWORK = 1222;1985pub const NO_NETWORK = 1222;
1986
1325/// The operation was canceled by the user.1987/// The operation was canceled by the user.
1326pub const CANCELLED = 1223;1988pub const CANCELLED = 1223;
1989
1327/// The requested operation cannot be performed on a file with a user-mapped section open.1990/// The requested operation cannot be performed on a file with a user-mapped section open.
1328pub const USER_MAPPED_FILE = 1224;1991pub const USER_MAPPED_FILE = 1224;
1992
1329/// The remote computer refused the network connection.1993/// The remote computer refused the network connection.
1330pub const CONNECTION_REFUSED = 1225;1994pub const CONNECTION_REFUSED = 1225;
1995
1331/// The network connection was gracefully closed.1996/// The network connection was gracefully closed.
1332pub const GRACEFUL_DISCONNECT = 1226;1997pub const GRACEFUL_DISCONNECT = 1226;
1998
1333/// The network transport endpoint already has an address associated with it.1999/// The network transport endpoint already has an address associated with it.
1334pub const ADDRESS_ALREADY_ASSOCIATED = 1227;2000pub const ADDRESS_ALREADY_ASSOCIATED = 1227;
2001
1335/// An address has not yet been associated with the network endpoint.2002/// An address has not yet been associated with the network endpoint.
1336pub const ADDRESS_NOT_ASSOCIATED = 1228;2003pub const ADDRESS_NOT_ASSOCIATED = 1228;
2004
1337/// An operation was attempted on a nonexistent network connection.2005/// An operation was attempted on a nonexistent network connection.
1338pub const CONNECTION_INVALID = 1229;2006pub const CONNECTION_INVALID = 1229;
2007
1339/// An invalid operation was attempted on an active network connection.2008/// An invalid operation was attempted on an active network connection.
1340pub const CONNECTION_ACTIVE = 1230;2009pub const CONNECTION_ACTIVE = 1230;
2010
1341/// The network location cannot be reached. For information about network troubleshooting, see Windows Help.2011/// The network location cannot be reached. For information about network troubleshooting, see Windows Help.
1342pub const NETWORK_UNREACHABLE = 1231;2012pub const NETWORK_UNREACHABLE = 1231;
2013
1343/// The network location cannot be reached. For information about network troubleshooting, see Windows Help.2014/// The network location cannot be reached. For information about network troubleshooting, see Windows Help.
1344pub const HOST_UNREACHABLE = 1232;2015pub const HOST_UNREACHABLE = 1232;
2016
1345/// The network location cannot be reached. For information about network troubleshooting, see Windows Help.2017/// The network location cannot be reached. For information about network troubleshooting, see Windows Help.
1346pub const PROTOCOL_UNREACHABLE = 1233;2018pub const PROTOCOL_UNREACHABLE = 1233;
2019
1347/// No service is operating at the destination network endpoint on the remote system.2020/// No service is operating at the destination network endpoint on the remote system.
1348pub const PORT_UNREACHABLE = 1234;2021pub const PORT_UNREACHABLE = 1234;
2022
1349/// The request was aborted.2023/// The request was aborted.
1350pub const REQUEST_ABORTED = 1235;2024pub const REQUEST_ABORTED = 1235;
2025
1351/// The network connection was aborted by the local system.2026/// The network connection was aborted by the local system.
1352pub const CONNECTION_ABORTED = 1236;2027pub const CONNECTION_ABORTED = 1236;
2028
1353/// The operation could not be completed. A retry should be performed.2029/// The operation could not be completed. A retry should be performed.
1354pub const RETRY = 1237;2030pub const RETRY = 1237;
2031
1355/// A connection to the server could not be made because the limit on the number of concurrent connections for this account has been reached.2032/// A connection to the server could not be made because the limit on the number of concurrent connections for this account has been reached.
1356pub const CONNECTION_COUNT_LIMIT = 1238;2033pub const CONNECTION_COUNT_LIMIT = 1238;
2034
1357/// Attempting to log in during an unauthorized time of day for this account.2035/// Attempting to log in during an unauthorized time of day for this account.
1358pub const LOGIN_TIME_RESTRICTION = 1239;2036pub const LOGIN_TIME_RESTRICTION = 1239;
2037
1359/// The account is not authorized to log in from this station.2038/// The account is not authorized to log in from this station.
1360pub const LOGIN_WKSTA_RESTRICTION = 1240;2039pub const LOGIN_WKSTA_RESTRICTION = 1240;
2040
1361/// The network address could not be used for the operation requested.2041/// The network address could not be used for the operation requested.
1362pub const INCORRECT_ADDRESS = 1241;2042pub const INCORRECT_ADDRESS = 1241;
2043
1363/// The service is already registered.2044/// The service is already registered.
1364pub const ALREADY_REGISTERED = 1242;2045pub const ALREADY_REGISTERED = 1242;
2046
1365/// The specified service does not exist.2047/// The specified service does not exist.
1366pub const SERVICE_NOT_FOUND = 1243;2048pub const SERVICE_NOT_FOUND = 1243;
2049
1367/// The operation being requested was not performed because the user has not been authenticated.2050/// The operation being requested was not performed because the user has not been authenticated.
1368pub const NOT_AUTHENTICATED = 1244;2051pub const NOT_AUTHENTICATED = 1244;
2052
1369/// The operation being requested was not performed because the user has not logged on to the network. The specified service does not exist.2053/// The operation being requested was not performed because the user has not logged on to the network. The specified service does not exist.
1370pub const NOT_LOGGED_ON = 1245;2054pub const NOT_LOGGED_ON = 1245;
2055
1371/// Continue with work in progress.2056/// Continue with work in progress.
1372pub const CONTINUE = 1246;2057pub const CONTINUE = 1246;
2058
1373/// An attempt was made to perform an initialization operation when initialization has already been completed.2059/// An attempt was made to perform an initialization operation when initialization has already been completed.
1374pub const ALREADY_INITIALIZED = 1247;2060pub const ALREADY_INITIALIZED = 1247;
2061
1375/// No more local devices.2062/// No more local devices.
1376pub const NO_MORE_DEVICES = 1248;2063pub const NO_MORE_DEVICES = 1248;
2064
1377/// The specified site does not exist.2065/// The specified site does not exist.
1378pub const NO_SUCH_SITE = 1249;2066pub const NO_SUCH_SITE = 1249;
2067
1379/// A domain controller with the specified name already exists.2068/// A domain controller with the specified name already exists.
1380pub const DOMAIN_CONTROLLER_EXISTS = 1250;2069pub const DOMAIN_CONTROLLER_EXISTS = 1250;
2070
1381/// This operation is supported only when you are connected to the server.2071/// This operation is supported only when you are connected to the server.
1382pub const ONLY_IF_CONNECTED = 1251;2072pub const ONLY_IF_CONNECTED = 1251;
2073
1383/// The group policy framework should call the extension even if there are no changes.2074/// The group policy framework should call the extension even if there are no changes.
1384pub const OVERRIDE_NOCHANGES = 1252;2075pub const OVERRIDE_NOCHANGES = 1252;
2076
1385/// The specified user does not have a valid profile.2077/// The specified user does not have a valid profile.
1386pub const BAD_USER_PROFILE = 1253;2078pub const BAD_USER_PROFILE = 1253;
2079
1387/// This operation is not supported on a computer running Windows Server 2003 for Small Business Server.2080/// This operation is not supported on a computer running Windows Server 2003 for Small Business Server.
1388pub const NOT_SUPPORTED_ON_SBS = 1254;2081pub const NOT_SUPPORTED_ON_SBS = 1254;
2082
1389/// The server machine is shutting down.2083/// The server machine is shutting down.
1390pub const SERVER_SHUTDOWN_IN_PROGRESS = 1255;2084pub const SERVER_SHUTDOWN_IN_PROGRESS = 1255;
2085
1391/// The remote system is not available. For information about network troubleshooting, see Windows Help.2086/// The remote system is not available. For information about network troubleshooting, see Windows Help.
1392pub const HOST_DOWN = 1256;2087pub const HOST_DOWN = 1256;
2088
1393/// The security identifier provided is not from an account domain.2089/// The security identifier provided is not from an account domain.
1394pub const NON_ACCOUNT_SID = 1257;2090pub const NON_ACCOUNT_SID = 1257;
2091
1395/// The security identifier provided does not have a domain component.2092/// The security identifier provided does not have a domain component.
1396pub const NON_DOMAIN_SID = 1258;2093pub const NON_DOMAIN_SID = 1258;
2094
1397/// AppHelp dialog canceled thus preventing the application from starting.2095/// AppHelp dialog canceled thus preventing the application from starting.
1398pub const APPHELP_BLOCK = 1259;2096pub const APPHELP_BLOCK = 1259;
2097
1399/// This program is blocked by group policy. For more information, contact your system administrator.2098/// This program is blocked by group policy. For more information, contact your system administrator.
1400pub const ACCESS_DISABLED_BY_POLICY = 1260;2099pub const ACCESS_DISABLED_BY_POLICY = 1260;
2100
1401/// A program attempt to use an invalid register value. Normally caused by an uninitialized register. This error is Itanium specific.2101/// A program attempt to use an invalid register value. Normally caused by an uninitialized register. This error is Itanium specific.
1402pub const REG_NAT_CONSUMPTION = 1261;2102pub const REG_NAT_CONSUMPTION = 1261;
2103
1403/// The share is currently offline or does not exist.2104/// The share is currently offline or does not exist.
1404pub const CSCSHARE_OFFLINE = 1262;2105pub const CSCSHARE_OFFLINE = 1262;
2106
1405/// The Kerberos protocol encountered an error while validating the KDC certificate during smartcard logon. There is more information in the system event log.2107/// The Kerberos protocol encountered an error while validating the KDC certificate during smartcard logon. There is more information in the system event log.
1406pub const PKINIT_FAILURE = 1263;2108pub const PKINIT_FAILURE = 1263;
2109
1407/// The Kerberos protocol encountered an error while attempting to utilize the smartcard subsystem.2110/// The Kerberos protocol encountered an error while attempting to utilize the smartcard subsystem.
1408pub const SMARTCARD_SUBSYSTEM_FAILURE = 1264;2111pub const SMARTCARD_SUBSYSTEM_FAILURE = 1264;
2112
1409/// The system cannot contact a domain controller to service the authentication request. Please try again later.2113/// The system cannot contact a domain controller to service the authentication request. Please try again later.
1410pub const DOWNGRADE_DETECTED = 1265;2114pub const DOWNGRADE_DETECTED = 1265;
2115
1411/// The machine is locked and cannot be shut down without the force option.2116/// The machine is locked and cannot be shut down without the force option.
1412pub const MACHINE_LOCKED = 1271;2117pub const MACHINE_LOCKED = 1271;
2118
1413/// An application-defined callback gave invalid data when called.2119/// An application-defined callback gave invalid data when called.
1414pub const CALLBACK_SUPPLIED_INVALID_DATA = 1273;2120pub const CALLBACK_SUPPLIED_INVALID_DATA = 1273;
2121
1415/// The group policy framework should call the extension in the synchronous foreground policy refresh.2122/// The group policy framework should call the extension in the synchronous foreground policy refresh.
1416pub const SYNC_FOREGROUND_REFRESH_REQUIRED = 1274;2123pub const SYNC_FOREGROUND_REFRESH_REQUIRED = 1274;
2124
1417/// This driver has been blocked from loading.2125/// This driver has been blocked from loading.
1418pub const DRIVER_BLOCKED = 1275;2126pub const DRIVER_BLOCKED = 1275;
2127
1419/// A dynamic link library (DLL) referenced a module that was neither a DLL nor the process's executable image.2128/// A dynamic link library (DLL) referenced a module that was neither a DLL nor the process's executable image.
1420pub const INVALID_IMPORT_OF_NON_DLL = 1276;2129pub const INVALID_IMPORT_OF_NON_DLL = 1276;
2130
1421/// Windows cannot open this program since it has been disabled.2131/// Windows cannot open this program since it has been disabled.
1422pub const ACCESS_DISABLED_WEBBLADE = 1277;2132pub const ACCESS_DISABLED_WEBBLADE = 1277;
2133
1423/// Windows cannot open this program because the license enforcement system has been tampered with or become corrupted.2134/// Windows cannot open this program because the license enforcement system has been tampered with or become corrupted.
1424pub const ACCESS_DISABLED_WEBBLADE_TAMPER = 1278;2135pub const ACCESS_DISABLED_WEBBLADE_TAMPER = 1278;
2136
1425/// A transaction recover failed.2137/// A transaction recover failed.
1426pub const RECOVERY_FAILURE = 1279;2138pub const RECOVERY_FAILURE = 1279;
2139
1427/// The current thread has already been converted to a fiber.2140/// The current thread has already been converted to a fiber.
1428pub const ALREADY_FIBER = 1280;2141pub const ALREADY_FIBER = 1280;
2142
1429/// The current thread has already been converted from a fiber.2143/// The current thread has already been converted from a fiber.
1430pub const ALREADY_THREAD = 1281;2144pub const ALREADY_THREAD = 1281;
2145
1431/// The system detected an overrun of a stack-based buffer in this application. This overrun could potentially allow a malicious user to gain control of this application.2146/// The system detected an overrun of a stack-based buffer in this application. This overrun could potentially allow a malicious user to gain control of this application.
1432pub const STACK_BUFFER_OVERRUN = 1282;2147pub const STACK_BUFFER_OVERRUN = 1282;
2148
1433/// Data present in one of the parameters is more than the function can operate on.2149/// Data present in one of the parameters is more than the function can operate on.
1434pub const PARAMETER_QUOTA_EXCEEDED = 1283;2150pub const PARAMETER_QUOTA_EXCEEDED = 1283;
2151
1435/// An attempt to do an operation on a debug object failed because the object is in the process of being deleted.2152/// An attempt to do an operation on a debug object failed because the object is in the process of being deleted.
1436pub const DEBUGGER_INACTIVE = 1284;2153pub const DEBUGGER_INACTIVE = 1284;
2154
1437/// An attempt to delay-load a .dll or get a function address in a delay-loaded .dll failed.2155/// An attempt to delay-load a .dll or get a function address in a delay-loaded .dll failed.
1438pub const DELAY_LOAD_FAILED = 1285;2156pub const DELAY_LOAD_FAILED = 1285;
2157
1439/// %1 is a 16-bit application. You do not have permissions to execute 16-bit applications. Check your permissions with your system administrator.2158/// %1 is a 16-bit application. You do not have permissions to execute 16-bit applications. Check your permissions with your system administrator.
1440pub const VDM_DISALLOWED = 1286;2159pub const VDM_DISALLOWED = 1286;
2160
1441/// Insufficient information exists to identify the cause of failure.2161/// Insufficient information exists to identify the cause of failure.
1442pub const UNIDENTIFIED_ERROR = 1287;2162pub const UNIDENTIFIED_ERROR = 1287;
2163
1443/// The parameter passed to a C runtime function is incorrect.2164/// The parameter passed to a C runtime function is incorrect.
1444pub const INVALID_CRUNTIME_PARAMETER = 1288;2165pub const INVALID_CRUNTIME_PARAMETER = 1288;
2166
1445/// The operation occurred beyond the valid data length of the file.2167/// The operation occurred beyond the valid data length of the file.
1446pub const BEYOND_VDL = 1289;2168pub const BEYOND_VDL = 1289;
2169
1447/// The service start failed since one or more services in the same process have an incompatible service SID type setting. A service with restricted service SID type can only coexist in the same process with other services with a restricted SID type. If the service SID type for this service was just configured, the hosting process must be restarted in order to start this service.2170/// The service start failed since one or more services in the same process have an incompatible service SID type setting. A service with restricted service SID type can only coexist in the same process with other services with a restricted SID type. If the service SID type for this service was just configured, the hosting process must be restarted in order to start this service.
1448/// On Windows Server 2003 and Windows XP, an unrestricted service cannot coexist in the same process with other services. The service with the unrestricted service SID type must be moved to an owned process in order to start this service.2171/// On Windows Server 2003 and Windows XP, an unrestricted service cannot coexist in the same process with other services. The service with the unrestricted service SID type must be moved to an owned process in order to start this service.
1449pub const INCOMPATIBLE_SERVICE_SID_TYPE = 1290;2172pub const INCOMPATIBLE_SERVICE_SID_TYPE = 1290;
2173
1450/// The process hosting the driver for this device has been terminated.2174/// The process hosting the driver for this device has been terminated.
1451pub const DRIVER_PROCESS_TERMINATED = 1291;2175pub const DRIVER_PROCESS_TERMINATED = 1291;
2176
1452/// An operation attempted to exceed an implementation-defined limit.2177/// An operation attempted to exceed an implementation-defined limit.
1453pub const IMPLEMENTATION_LIMIT = 1292;2178pub const IMPLEMENTATION_LIMIT = 1292;
2179
1454/// Either the target process, or the target thread's containing process, is a protected process.2180/// Either the target process, or the target thread's containing process, is a protected process.
1455pub const PROCESS_IS_PROTECTED = 1293;2181pub const PROCESS_IS_PROTECTED = 1293;
2182
1456/// The service notification client is lagging too far behind the current state of services in the machine.2183/// The service notification client is lagging too far behind the current state of services in the machine.
1457pub const SERVICE_NOTIFY_CLIENT_LAGGING = 1294;2184pub const SERVICE_NOTIFY_CLIENT_LAGGING = 1294;
2185
1458/// The requested file operation failed because the storage quota was exceeded. To free up disk space, move files to a different location or delete unnecessary files. For more information, contact your system administrator.2186/// The requested file operation failed because the storage quota was exceeded. To free up disk space, move files to a different location or delete unnecessary files. For more information, contact your system administrator.
1459pub const DISK_QUOTA_EXCEEDED = 1295;2187pub const DISK_QUOTA_EXCEEDED = 1295;
2188
1460/// The requested file operation failed because the storage policy blocks that type of file. For more information, contact your system administrator.2189/// The requested file operation failed because the storage policy blocks that type of file. For more information, contact your system administrator.
1461pub const CONTENT_BLOCKED = 1296;2190pub const CONTENT_BLOCKED = 1296;
2191
1462/// A privilege that the service requires to function properly does not exist in the service account configuration. You may use the Services Microsoft Management Console (MMC) snap-in (services.msc) and the Local Security Settings MMC snap-in (secpol.msc) to view the service configuration and the account configuration.2192/// A privilege that the service requires to function properly does not exist in the service account configuration. You may use the Services Microsoft Management Console (MMC) snap-in (services.msc) and the Local Security Settings MMC snap-in (secpol.msc) to view the service configuration and the account configuration.
1463pub const INCOMPATIBLE_SERVICE_PRIVILEGE = 1297;2193pub const INCOMPATIBLE_SERVICE_PRIVILEGE = 1297;
2194
1464/// A thread involved in this operation appears to be unresponsive.2195/// A thread involved in this operation appears to be unresponsive.
1465pub const APP_HANG = 1298;2196pub const APP_HANG = 1298;
2197
1466/// Indicates a particular Security ID may not be assigned as the label of an object.2198/// Indicates a particular Security ID may not be assigned as the label of an object.
1467pub const INVALID_LABEL = 1299;2199pub const INVALID_LABEL = 1299;
2200
1468/// Not all privileges or groups referenced are assigned to the caller.2201/// Not all privileges or groups referenced are assigned to the caller.
1469pub const NOT_ALL_ASSIGNED = 1300;2202pub const NOT_ALL_ASSIGNED = 1300;
2203
1470/// Some mapping between account names and security IDs was not done.2204/// Some mapping between account names and security IDs was not done.
1471pub const SOME_NOT_MAPPED = 1301;2205pub const SOME_NOT_MAPPED = 1301;
2206
1472/// No system quota limits are specifically set for this account.2207/// No system quota limits are specifically set for this account.
1473pub const NO_QUOTAS_FOR_ACCOUNT = 1302;2208pub const NO_QUOTAS_FOR_ACCOUNT = 1302;
2209
1474/// No encryption key is available. A well-known encryption key was returned.2210/// No encryption key is available. A well-known encryption key was returned.
1475pub const LOCAL_USER_SESSION_KEY = 1303;2211pub const LOCAL_USER_SESSION_KEY = 1303;
2212
1476/// The password is too complex to be converted to a LAN Manager password. The LAN Manager password returned is a NULL string.2213/// The password is too complex to be converted to a LAN Manager password. The LAN Manager password returned is a NULL string.
1477pub const NULL_LM_PASSWORD = 1304;2214pub const NULL_LM_PASSWORD = 1304;
2215
1478/// The revision level is unknown.2216/// The revision level is unknown.
1479pub const UNKNOWN_REVISION = 1305;2217pub const UNKNOWN_REVISION = 1305;
2218
1480/// Indicates two revision levels are incompatible.2219/// Indicates two revision levels are incompatible.
1481pub const REVISION_MISMATCH = 1306;2220pub const REVISION_MISMATCH = 1306;
2221
1482/// This security ID may not be assigned as the owner of this object.2222/// This security ID may not be assigned as the owner of this object.
1483pub const INVALID_OWNER = 1307;2223pub const INVALID_OWNER = 1307;
2224
1484/// This security ID may not be assigned as the primary group of an object.2225/// This security ID may not be assigned as the primary group of an object.
1485pub const INVALID_PRIMARY_GROUP = 1308;2226pub const INVALID_PRIMARY_GROUP = 1308;
2227
1486/// An attempt has been made to operate on an impersonation token by a thread that is not currently impersonating a client.2228/// An attempt has been made to operate on an impersonation token by a thread that is not currently impersonating a client.
1487pub const NO_IMPERSONATION_TOKEN = 1309;2229pub const NO_IMPERSONATION_TOKEN = 1309;
2230
1488/// The group may not be disabled.2231/// The group may not be disabled.
1489pub const CANT_DISABLE_MANDATORY = 1310;2232pub const CANT_DISABLE_MANDATORY = 1310;
2233
1490/// There are currently no logon servers available to service the logon request.2234/// There are currently no logon servers available to service the logon request.
1491pub const NO_LOGON_SERVERS = 1311;2235pub const NO_LOGON_SERVERS = 1311;
2236
1492/// A specified logon session does not exist. It may already have been terminated.2237/// A specified logon session does not exist. It may already have been terminated.
1493pub const NO_SUCH_LOGON_SESSION = 1312;2238pub const NO_SUCH_LOGON_SESSION = 1312;
2239
1494/// A specified privilege does not exist.2240/// A specified privilege does not exist.
1495pub const NO_SUCH_PRIVILEGE = 1313;2241pub const NO_SUCH_PRIVILEGE = 1313;
2242
1496/// A required privilege is not held by the client.2243/// A required privilege is not held by the client.
1497pub const PRIVILEGE_NOT_HELD = 1314;2244pub const PRIVILEGE_NOT_HELD = 1314;
2245
1498/// The name provided is not a properly formed account name.2246/// The name provided is not a properly formed account name.
1499pub const INVALID_ACCOUNT_NAME = 1315;2247pub const INVALID_ACCOUNT_NAME = 1315;
2248
1500/// The specified account already exists.2249/// The specified account already exists.
1501pub const USER_EXISTS = 1316;2250pub const USER_EXISTS = 1316;
2251
1502/// The specified account does not exist.2252/// The specified account does not exist.
1503pub const NO_SUCH_USER = 1317;2253pub const NO_SUCH_USER = 1317;
2254
1504/// The specified group already exists.2255/// The specified group already exists.
1505pub const GROUP_EXISTS = 1318;2256pub const GROUP_EXISTS = 1318;
2257
1506/// The specified group does not exist.2258/// The specified group does not exist.
1507pub const NO_SUCH_GROUP = 1319;2259pub const NO_SUCH_GROUP = 1319;
2260
1508/// Either the specified user account is already a member of the specified group, or the specified group cannot be deleted because it contains a member.2261/// Either the specified user account is already a member of the specified group, or the specified group cannot be deleted because it contains a member.
1509pub const MEMBER_IN_GROUP = 1320;2262pub const MEMBER_IN_GROUP = 1320;
2263
1510/// The specified user account is not a member of the specified group account.2264/// The specified user account is not a member of the specified group account.
1511pub const MEMBER_NOT_IN_GROUP = 1321;2265pub const MEMBER_NOT_IN_GROUP = 1321;
2266
1512/// This operation is disallowed as it could result in an administration account being disabled, deleted or unable to log on.2267/// This operation is disallowed as it could result in an administration account being disabled, deleted or unable to log on.
1513pub const LAST_ADMIN = 1322;2268pub const LAST_ADMIN = 1322;
2269
1514/// Unable to update the password. The value provided as the current password is incorrect.2270/// Unable to update the password. The value provided as the current password is incorrect.
1515pub const WRONG_PASSWORD = 1323;2271pub const WRONG_PASSWORD = 1323;
2272
1516/// Unable to update the password. The value provided for the new password contains values that are not allowed in passwords.2273/// Unable to update the password. The value provided for the new password contains values that are not allowed in passwords.
1517pub const ILL_FORMED_PASSWORD = 1324;2274pub const ILL_FORMED_PASSWORD = 1324;
2275
1518/// Unable to update the password. The value provided for the new password does not meet the length, complexity, or history requirements of the domain.2276/// Unable to update the password. The value provided for the new password does not meet the length, complexity, or history requirements of the domain.
1519pub const PASSWORD_RESTRICTION = 1325;2277pub const PASSWORD_RESTRICTION = 1325;
2278
1520/// The user name or password is incorrect.2279/// The user name or password is incorrect.
1521pub const LOGON_FAILURE = 1326;2280pub const LOGON_FAILURE = 1326;
2281
1522/// Account restrictions are preventing this user from signing in. For example: blank passwords aren't allowed, sign-in times are limited, or a policy restriction has been enforced.2282/// Account restrictions are preventing this user from signing in. For example: blank passwords aren't allowed, sign-in times are limited, or a policy restriction has been enforced.
1523pub const ACCOUNT_RESTRICTION = 1327;2283pub const ACCOUNT_RESTRICTION = 1327;
2284
1524/// Your account has time restrictions that keep you from signing in right now.2285/// Your account has time restrictions that keep you from signing in right now.
1525pub const INVALID_LOGON_HOURS = 1328;2286pub const INVALID_LOGON_HOURS = 1328;
2287
1526/// This user isn't allowed to sign in to this computer.2288/// This user isn't allowed to sign in to this computer.
1527pub const INVALID_WORKSTATION = 1329;2289pub const INVALID_WORKSTATION = 1329;
2290
1528/// The password for this account has expired.2291/// The password for this account has expired.
1529pub const PASSWORD_EXPIRED = 1330;2292pub const PASSWORD_EXPIRED = 1330;
2293
1530/// This user can't sign in because this account is currently disabled.2294/// This user can't sign in because this account is currently disabled.
1531pub const ACCOUNT_DISABLED = 1331;2295pub const ACCOUNT_DISABLED = 1331;
2296
1532/// No mapping between account names and security IDs was done.2297/// No mapping between account names and security IDs was done.
1533pub const NONE_MAPPED = 1332;2298pub const NONE_MAPPED = 1332;
2299
1534/// Too many local user identifiers (LUIDs) were requested at one time.2300/// Too many local user identifiers (LUIDs) were requested at one time.
1535pub const TOO_MANY_LUIDS_REQUESTED = 1333;2301pub const TOO_MANY_LUIDS_REQUESTED = 1333;
2302
1536/// No more local user identifiers (LUIDs) are available.2303/// No more local user identifiers (LUIDs) are available.
1537pub const LUIDS_EXHAUSTED = 1334;2304pub const LUIDS_EXHAUSTED = 1334;
2305
1538/// The subauthority part of a security ID is invalid for this particular use.2306/// The subauthority part of a security ID is invalid for this particular use.
1539pub const INVALID_SUB_AUTHORITY = 1335;2307pub const INVALID_SUB_AUTHORITY = 1335;
2308
1540/// The access control list (ACL) structure is invalid.2309/// The access control list (ACL) structure is invalid.
1541pub const INVALID_ACL = 1336;2310pub const INVALID_ACL = 1336;
2311
1542/// The security ID structure is invalid.2312/// The security ID structure is invalid.
1543pub const INVALID_SID = 1337;2313pub const INVALID_SID = 1337;
2314
1544/// The security descriptor structure is invalid.2315/// The security descriptor structure is invalid.
1545pub const INVALID_SECURITY_DESCR = 1338;2316pub const INVALID_SECURITY_DESCR = 1338;
2317
1546/// The inherited access control list (ACL) or access control entry (ACE) could not be built.2318/// The inherited access control list (ACL) or access control entry (ACE) could not be built.
1547pub const BAD_INHERITANCE_ACL = 1340;2319pub const BAD_INHERITANCE_ACL = 1340;
2320
1548/// The server is currently disabled.2321/// The server is currently disabled.
1549pub const SERVER_DISABLED = 1341;2322pub const SERVER_DISABLED = 1341;
2323
1550/// The server is currently enabled.2324/// The server is currently enabled.
1551pub const SERVER_NOT_DISABLED = 1342;2325pub const SERVER_NOT_DISABLED = 1342;
2326
1552/// The value provided was an invalid value for an identifier authority.2327/// The value provided was an invalid value for an identifier authority.
1553pub const INVALID_ID_AUTHORITY = 1343;2328pub const INVALID_ID_AUTHORITY = 1343;
2329
1554/// No more memory is available for security information updates.2330/// No more memory is available for security information updates.
1555pub const ALLOTTED_SPACE_EXCEEDED = 1344;2331pub const ALLOTTED_SPACE_EXCEEDED = 1344;
2332
1556/// The specified attributes are invalid, or incompatible with the attributes for the group as a whole.2333/// The specified attributes are invalid, or incompatible with the attributes for the group as a whole.
1557pub const INVALID_GROUP_ATTRIBUTES = 1345;2334pub const INVALID_GROUP_ATTRIBUTES = 1345;
2335
1558/// Either a required impersonation level was not provided, or the provided impersonation level is invalid.2336/// Either a required impersonation level was not provided, or the provided impersonation level is invalid.
1559pub const BAD_IMPERSONATION_LEVEL = 1346;2337pub const BAD_IMPERSONATION_LEVEL = 1346;
2338
1560/// Cannot open an anonymous level security token.2339/// Cannot open an anonymous level security token.
1561pub const CANT_OPEN_ANONYMOUS = 1347;2340pub const CANT_OPEN_ANONYMOUS = 1347;
2341
1562/// The validation information class requested was invalid.2342/// The validation information class requested was invalid.
1563pub const BAD_VALIDATION_CLASS = 1348;2343pub const BAD_VALIDATION_CLASS = 1348;
2344
1564/// The type of the token is inappropriate for its attempted use.2345/// The type of the token is inappropriate for its attempted use.
1565pub const BAD_TOKEN_TYPE = 1349;2346pub const BAD_TOKEN_TYPE = 1349;
2347
1566/// Unable to perform a security operation on an object that has no associated security.2348/// Unable to perform a security operation on an object that has no associated security.
1567pub const NO_SECURITY_ON_OBJECT = 1350;2349pub const NO_SECURITY_ON_OBJECT = 1350;
2350
1568/// Configuration information could not be read from the domain controller, either because the machine is unavailable, or access has been denied.2351/// Configuration information could not be read from the domain controller, either because the machine is unavailable, or access has been denied.
1569pub const CANT_ACCESS_DOMAIN_INFO = 1351;2352pub const CANT_ACCESS_DOMAIN_INFO = 1351;
2353
1570/// The security account manager (SAM) or local security authority (LSA) server was in the wrong state to perform the security operation.2354/// The security account manager (SAM) or local security authority (LSA) server was in the wrong state to perform the security operation.
1571pub const INVALID_SERVER_STATE = 1352;2355pub const INVALID_SERVER_STATE = 1352;
2356
1572/// The domain was in the wrong state to perform the security operation.2357/// The domain was in the wrong state to perform the security operation.
1573pub const INVALID_DOMAIN_STATE = 1353;2358pub const INVALID_DOMAIN_STATE = 1353;
2359
1574/// This operation is only allowed for the Primary Domain Controller of the domain.2360/// This operation is only allowed for the Primary Domain Controller of the domain.
1575pub const INVALID_DOMAIN_ROLE = 1354;2361pub const INVALID_DOMAIN_ROLE = 1354;
2362
1576/// The specified domain either does not exist or could not be contacted.2363/// The specified domain either does not exist or could not be contacted.
1577pub const NO_SUCH_DOMAIN = 1355;2364pub const NO_SUCH_DOMAIN = 1355;
2365
1578/// The specified domain already exists.2366/// The specified domain already exists.
1579pub const DOMAIN_EXISTS = 1356;2367pub const DOMAIN_EXISTS = 1356;
2368
1580/// An attempt was made to exceed the limit on the number of domains per server.2369/// An attempt was made to exceed the limit on the number of domains per server.
1581pub const DOMAIN_LIMIT_EXCEEDED = 1357;2370pub const DOMAIN_LIMIT_EXCEEDED = 1357;
2371
1582/// Unable to complete the requested operation because of either a catastrophic media failure or a data structure corruption on the disk.2372/// Unable to complete the requested operation because of either a catastrophic media failure or a data structure corruption on the disk.
1583pub const INTERNAL_DB_CORRUPTION = 1358;2373pub const INTERNAL_DB_CORRUPTION = 1358;
2374
1584/// An internal error occurred.2375/// An internal error occurred.
1585pub const INTERNAL_ERROR = 1359;2376pub const INTERNAL_ERROR = 1359;
2377
1586/// Generic access types were contained in an access mask which should already be mapped to nongeneric types.2378/// Generic access types were contained in an access mask which should already be mapped to nongeneric types.
1587pub const GENERIC_NOT_MAPPED = 1360;2379pub const GENERIC_NOT_MAPPED = 1360;
2380
1588/// A security descriptor is not in the right format (absolute or self-relative).2381/// A security descriptor is not in the right format (absolute or self-relative).
1589pub const BAD_DESCRIPTOR_FORMAT = 1361;2382pub const BAD_DESCRIPTOR_FORMAT = 1361;
2383
1590/// The requested action is restricted for use by logon processes only. The calling process has not registered as a logon process.2384/// The requested action is restricted for use by logon processes only. The calling process has not registered as a logon process.
1591pub const NOT_LOGON_PROCESS = 1362;2385pub const NOT_LOGON_PROCESS = 1362;
2386
1592/// Cannot start a new logon session with an ID that is already in use.2387/// Cannot start a new logon session with an ID that is already in use.
1593pub const LOGON_SESSION_EXISTS = 1363;2388pub const LOGON_SESSION_EXISTS = 1363;
2389
1594/// A specified authentication package is unknown.2390/// A specified authentication package is unknown.
1595pub const NO_SUCH_PACKAGE = 1364;2391pub const NO_SUCH_PACKAGE = 1364;
2392
1596/// The logon session is not in a state that is consistent with the requested operation.2393/// The logon session is not in a state that is consistent with the requested operation.
1597pub const BAD_LOGON_SESSION_STATE = 1365;2394pub const BAD_LOGON_SESSION_STATE = 1365;
2395
1598/// The logon session ID is already in use.2396/// The logon session ID is already in use.
1599pub const LOGON_SESSION_COLLISION = 1366;2397pub const LOGON_SESSION_COLLISION = 1366;
2398
1600/// A logon request contained an invalid logon type value.2399/// A logon request contained an invalid logon type value.
1601pub const INVALID_LOGON_TYPE = 1367;2400pub const INVALID_LOGON_TYPE = 1367;
2401
1602/// Unable to impersonate using a named pipe until data has been read from that pipe.2402/// Unable to impersonate using a named pipe until data has been read from that pipe.
1603pub const CANNOT_IMPERSONATE = 1368;2403pub const CANNOT_IMPERSONATE = 1368;
2404
1604/// The transaction state of a registry subtree is incompatible with the requested operation.2405/// The transaction state of a registry subtree is incompatible with the requested operation.
1605pub const RXACT_INVALID_STATE = 1369;2406pub const RXACT_INVALID_STATE = 1369;
2407
1606/// An internal security database corruption has been encountered.2408/// An internal security database corruption has been encountered.
1607pub const RXACT_COMMIT_FAILURE = 1370;2409pub const RXACT_COMMIT_FAILURE = 1370;
2410
1608/// Cannot perform this operation on built-in accounts.2411/// Cannot perform this operation on built-in accounts.
1609pub const SPECIAL_ACCOUNT = 1371;2412pub const SPECIAL_ACCOUNT = 1371;
2413
1610/// Cannot perform this operation on this built-in special group.2414/// Cannot perform this operation on this built-in special group.
1611pub const SPECIAL_GROUP = 1372;2415pub const SPECIAL_GROUP = 1372;
2416
1612/// Cannot perform this operation on this built-in special user.2417/// Cannot perform this operation on this built-in special user.
1613pub const SPECIAL_USER = 1373;2418pub const SPECIAL_USER = 1373;
2419
1614/// The user cannot be removed from a group because the group is currently the user's primary group.2420/// The user cannot be removed from a group because the group is currently the user's primary group.
1615pub const MEMBERS_PRIMARY_GROUP = 1374;2421pub const MEMBERS_PRIMARY_GROUP = 1374;
2422
1616/// The token is already in use as a primary token.2423/// The token is already in use as a primary token.
1617pub const TOKEN_ALREADY_IN_USE = 1375;2424pub const TOKEN_ALREADY_IN_USE = 1375;
2425
1618/// The specified local group does not exist.2426/// The specified local group does not exist.
1619pub const NO_SUCH_ALIAS = 1376;2427pub const NO_SUCH_ALIAS = 1376;
2428
1620/// The specified account name is not a member of the group.2429/// The specified account name is not a member of the group.
1621pub const MEMBER_NOT_IN_ALIAS = 1377;2430pub const MEMBER_NOT_IN_ALIAS = 1377;
2431
1622/// The specified account name is already a member of the group.2432/// The specified account name is already a member of the group.
1623pub const MEMBER_IN_ALIAS = 1378;2433pub const MEMBER_IN_ALIAS = 1378;
2434
1624/// The specified local group already exists.2435/// The specified local group already exists.
1625pub const ALIAS_EXISTS = 1379;2436pub const ALIAS_EXISTS = 1379;
2437
1626/// Logon failure: the user has not been granted the requested logon type at this computer.2438/// Logon failure: the user has not been granted the requested logon type at this computer.
1627pub const LOGON_NOT_GRANTED = 1380;2439pub const LOGON_NOT_GRANTED = 1380;
2440
1628/// The maximum number of secrets that may be stored in a single system has been exceeded.2441/// The maximum number of secrets that may be stored in a single system has been exceeded.
1629pub const TOO_MANY_SECRETS = 1381;2442pub const TOO_MANY_SECRETS = 1381;
2443
1630/// The length of a secret exceeds the maximum length allowed.2444/// The length of a secret exceeds the maximum length allowed.
1631pub const SECRET_TOO_LONG = 1382;2445pub const SECRET_TOO_LONG = 1382;
2446
1632/// The local security authority database contains an internal inconsistency.2447/// The local security authority database contains an internal inconsistency.
1633pub const INTERNAL_DB_ERROR = 1383;2448pub const INTERNAL_DB_ERROR = 1383;
2449
1634/// During a logon attempt, the user's security context accumulated too many security IDs.2450/// During a logon attempt, the user's security context accumulated too many security IDs.
1635pub const TOO_MANY_CONTEXT_IDS = 1384;2451pub const TOO_MANY_CONTEXT_IDS = 1384;
2452
1636/// Logon failure: the user has not been granted the requested logon type at this computer.2453/// Logon failure: the user has not been granted the requested logon type at this computer.
1637pub const LOGON_TYPE_NOT_GRANTED = 1385;2454pub const LOGON_TYPE_NOT_GRANTED = 1385;
2455
1638/// A cross-encrypted password is necessary to change a user password.2456/// A cross-encrypted password is necessary to change a user password.
1639pub const NT_CROSS_ENCRYPTION_REQUIRED = 1386;2457pub const NT_CROSS_ENCRYPTION_REQUIRED = 1386;
2458
1640/// A member could not be added to or removed from the local group because the member does not exist.2459/// A member could not be added to or removed from the local group because the member does not exist.
1641pub const NO_SUCH_MEMBER = 1387;2460pub const NO_SUCH_MEMBER = 1387;
2461
1642/// A new member could not be added to a local group because the member has the wrong account type.2462/// A new member could not be added to a local group because the member has the wrong account type.
1643pub const INVALID_MEMBER = 1388;2463pub const INVALID_MEMBER = 1388;
2464
1644/// Too many security IDs have been specified.2465/// Too many security IDs have been specified.
1645pub const TOO_MANY_SIDS = 1389;2466pub const TOO_MANY_SIDS = 1389;
2467
1646/// A cross-encrypted password is necessary to change this user password.2468/// A cross-encrypted password is necessary to change this user password.
1647pub const LM_CROSS_ENCRYPTION_REQUIRED = 1390;2469pub const LM_CROSS_ENCRYPTION_REQUIRED = 1390;
2470
1648/// Indicates an ACL contains no inheritable components.2471/// Indicates an ACL contains no inheritable components.
1649pub const NO_INHERITANCE = 1391;2472pub const NO_INHERITANCE = 1391;
2473
1650/// The file or directory is corrupted and unreadable.2474/// The file or directory is corrupted and unreadable.
1651pub const FILE_CORRUPT = 1392;2475pub const FILE_CORRUPT = 1392;
2476
1652/// The disk structure is corrupted and unreadable.2477/// The disk structure is corrupted and unreadable.
1653pub const DISK_CORRUPT = 1393;2478pub const DISK_CORRUPT = 1393;
2479
1654/// There is no user session key for the specified logon session.2480/// There is no user session key for the specified logon session.
1655pub const NO_USER_SESSION_KEY = 1394;2481pub const NO_USER_SESSION_KEY = 1394;
2482
1656/// The service being accessed is licensed for a particular number of connections. No more connections can be made to the service at this time because there are already as many connections as the service can accept.2483/// The service being accessed is licensed for a particular number of connections. No more connections can be made to the service at this time because there are already as many connections as the service can accept.
1657pub const LICENSE_QUOTA_EXCEEDED = 1395;2484pub const LICENSE_QUOTA_EXCEEDED = 1395;
2485
1658/// The target account name is incorrect.2486/// The target account name is incorrect.
1659pub const WRONG_TARGET_NAME = 1396;2487pub const WRONG_TARGET_NAME = 1396;
2488
1660/// Mutual Authentication failed. The server's password is out of date at the domain controller.2489/// Mutual Authentication failed. The server's password is out of date at the domain controller.
1661pub const MUTUAL_AUTH_FAILED = 1397;2490pub const MUTUAL_AUTH_FAILED = 1397;
2491
1662/// There is a time and/or date difference between the client and server.2492/// There is a time and/or date difference between the client and server.
1663pub const TIME_SKEW = 1398;2493pub const TIME_SKEW = 1398;
2494
1664/// This operation cannot be performed on the current domain.2495/// This operation cannot be performed on the current domain.
1665pub const CURRENT_DOMAIN_NOT_ALLOWED = 1399;2496pub const CURRENT_DOMAIN_NOT_ALLOWED = 1399;
2497
1666/// Invalid window handle.2498/// Invalid window handle.
1667pub const INVALID_WINDOW_HANDLE = 1400;2499pub const INVALID_WINDOW_HANDLE = 1400;
2500
1668/// Invalid menu handle.2501/// Invalid menu handle.
1669pub const INVALID_MENU_HANDLE = 1401;2502pub const INVALID_MENU_HANDLE = 1401;
2503
1670/// Invalid cursor handle.2504/// Invalid cursor handle.
1671pub const INVALID_CURSOR_HANDLE = 1402;2505pub const INVALID_CURSOR_HANDLE = 1402;
2506
1672/// Invalid accelerator table handle.2507/// Invalid accelerator table handle.
1673pub const INVALID_ACCEL_HANDLE = 1403;2508pub const INVALID_ACCEL_HANDLE = 1403;
2509
1674/// Invalid hook handle.2510/// Invalid hook handle.
1675pub const INVALID_HOOK_HANDLE = 1404;2511pub const INVALID_HOOK_HANDLE = 1404;
2512
1676/// Invalid handle to a multiple-window position structure.2513/// Invalid handle to a multiple-window position structure.
1677pub const INVALID_DWP_HANDLE = 1405;2514pub const INVALID_DWP_HANDLE = 1405;
2515
1678/// Cannot create a top-level child window.2516/// Cannot create a top-level child window.
1679pub const TLW_WITH_WSCHILD = 1406;2517pub const TLW_WITH_WSCHILD = 1406;
2518
1680/// Cannot find window class.2519/// Cannot find window class.
1681pub const CANNOT_FIND_WND_CLASS = 1407;2520pub const CANNOT_FIND_WND_CLASS = 1407;
2521
1682/// Invalid window; it belongs to other thread.2522/// Invalid window; it belongs to other thread.
1683pub const WINDOW_OF_OTHER_THREAD = 1408;2523pub const WINDOW_OF_OTHER_THREAD = 1408;
2524
1684/// Hot key is already registered.2525/// Hot key is already registered.
1685pub const HOTKEY_ALREADY_REGISTERED = 1409;2526pub const HOTKEY_ALREADY_REGISTERED = 1409;
2527
1686/// Class already exists.2528/// Class already exists.
1687pub const CLASS_ALREADY_EXISTS = 1410;2529pub const CLASS_ALREADY_EXISTS = 1410;
2530
1688/// Class does not exist.2531/// Class does not exist.
1689pub const CLASS_DOES_NOT_EXIST = 1411;2532pub const CLASS_DOES_NOT_EXIST = 1411;
2533
1690/// Class still has open windows.2534/// Class still has open windows.
1691pub const CLASS_HAS_WINDOWS = 1412;2535pub const CLASS_HAS_WINDOWS = 1412;
2536
1692/// Invalid index.2537/// Invalid index.
1693pub const INVALID_INDEX = 1413;2538pub const INVALID_INDEX = 1413;
2539
1694/// Invalid icon handle.2540/// Invalid icon handle.
1695pub const INVALID_ICON_HANDLE = 1414;2541pub const INVALID_ICON_HANDLE = 1414;
2542
1696/// Using private DIALOG window words.2543/// Using private DIALOG window words.
1697pub const PRIVATE_DIALOG_INDEX = 1415;2544pub const PRIVATE_DIALOG_INDEX = 1415;
2545
1698/// The list box identifier was not found.2546/// The list box identifier was not found.
1699pub const LISTBOX_ID_NOT_FOUND = 1416;2547pub const LISTBOX_ID_NOT_FOUND = 1416;
2548
1700/// No wildcards were found.2549/// No wildcards were found.
1701pub const NO_WILDCARD_CHARACTERS = 1417;2550pub const NO_WILDCARD_CHARACTERS = 1417;
2551
1702/// Thread does not have a clipboard open.2552/// Thread does not have a clipboard open.
1703pub const CLIPBOARD_NOT_OPEN = 1418;2553pub const CLIPBOARD_NOT_OPEN = 1418;
2554
1704/// Hot key is not registered.2555/// Hot key is not registered.
1705pub const HOTKEY_NOT_REGISTERED = 1419;2556pub const HOTKEY_NOT_REGISTERED = 1419;
2557
1706/// The window is not a valid dialog window.2558/// The window is not a valid dialog window.
1707pub const WINDOW_NOT_DIALOG = 1420;2559pub const WINDOW_NOT_DIALOG = 1420;
2560
1708/// Control ID not found.2561/// Control ID not found.
1709pub const CONTROL_ID_NOT_FOUND = 1421;2562pub const CONTROL_ID_NOT_FOUND = 1421;
2563
1710/// Invalid message for a combo box because it does not have an edit control.2564/// Invalid message for a combo box because it does not have an edit control.
1711pub const INVALID_COMBOBOX_MESSAGE = 1422;2565pub const INVALID_COMBOBOX_MESSAGE = 1422;
2566
1712/// The window is not a combo box.2567/// The window is not a combo box.
1713pub const WINDOW_NOT_COMBOBOX = 1423;2568pub const WINDOW_NOT_COMBOBOX = 1423;
2569
1714/// Height must be less than 256.2570/// Height must be less than 256.
1715pub const INVALID_EDIT_HEIGHT = 1424;2571pub const INVALID_EDIT_HEIGHT = 1424;
2572
1716/// Invalid device context (DC) handle.2573/// Invalid device context (DC) handle.
1717pub const DC_NOT_FOUND = 1425;2574pub const DC_NOT_FOUND = 1425;
2575
1718/// Invalid hook procedure type.2576/// Invalid hook procedure type.
1719pub const INVALID_HOOK_FILTER = 1426;2577pub const INVALID_HOOK_FILTER = 1426;
2578
1720/// Invalid hook procedure.2579/// Invalid hook procedure.
1721pub const INVALID_FILTER_PROC = 1427;2580pub const INVALID_FILTER_PROC = 1427;
2581
1722/// Cannot set nonlocal hook without a module handle.2582/// Cannot set nonlocal hook without a module handle.
1723pub const HOOK_NEEDS_HMOD = 1428;2583pub const HOOK_NEEDS_HMOD = 1428;
2584
1724/// This hook procedure can only be set globally.2585/// This hook procedure can only be set globally.
1725pub const GLOBAL_ONLY_HOOK = 1429;2586pub const GLOBAL_ONLY_HOOK = 1429;
2587
1726/// The journal hook procedure is already installed.2588/// The journal hook procedure is already installed.
1727pub const JOURNAL_HOOK_SET = 1430;2589pub const JOURNAL_HOOK_SET = 1430;
2590
1728/// The hook procedure is not installed.2591/// The hook procedure is not installed.
1729pub const HOOK_NOT_INSTALLED = 1431;2592pub const HOOK_NOT_INSTALLED = 1431;
2593
1730/// Invalid message for single-selection list box.2594/// Invalid message for single-selection list box.
1731pub const INVALID_LB_MESSAGE = 1432;2595pub const INVALID_LB_MESSAGE = 1432;
2596
1732/// LB_SETCOUNT sent to non-lazy list box.2597/// LB_SETCOUNT sent to non-lazy list box.
1733pub const SETCOUNT_ON_BAD_LB = 1433;2598pub const SETCOUNT_ON_BAD_LB = 1433;
2599
1734/// This list box does not support tab stops.2600/// This list box does not support tab stops.
1735pub const LB_WITHOUT_TABSTOPS = 1434;2601pub const LB_WITHOUT_TABSTOPS = 1434;
2602
1736/// Cannot destroy object created by another thread.2603/// Cannot destroy object created by another thread.
1737pub const DESTROY_OBJECT_OF_OTHER_THREAD = 1435;2604pub const DESTROY_OBJECT_OF_OTHER_THREAD = 1435;
2605
1738/// Child windows cannot have menus.2606/// Child windows cannot have menus.
1739pub const CHILD_WINDOW_MENU = 1436;2607pub const CHILD_WINDOW_MENU = 1436;
2608
1740/// The window does not have a system menu.2609/// The window does not have a system menu.
1741pub const NO_SYSTEM_MENU = 1437;2610pub const NO_SYSTEM_MENU = 1437;
2611
1742/// Invalid message box style.2612/// Invalid message box style.
1743pub const INVALID_MSGBOX_STYLE = 1438;2613pub const INVALID_MSGBOX_STYLE = 1438;
2614
1744/// Invalid system-wide (SPI_*) parameter.2615/// Invalid system-wide (SPI_*) parameter.
1745pub const INVALID_SPI_VALUE = 1439;2616pub const INVALID_SPI_VALUE = 1439;
2617
1746/// Screen already locked.2618/// Screen already locked.
1747pub const SCREEN_ALREADY_LOCKED = 1440;2619pub const SCREEN_ALREADY_LOCKED = 1440;
2620
1748/// All handles to windows in a multiple-window position structure must have the same parent.2621/// All handles to windows in a multiple-window position structure must have the same parent.
1749pub const HWNDS_HAVE_DIFF_PARENT = 1441;2622pub const HWNDS_HAVE_DIFF_PARENT = 1441;
2623
1750/// The window is not a child window.2624/// The window is not a child window.
1751pub const NOT_CHILD_WINDOW = 1442;2625pub const NOT_CHILD_WINDOW = 1442;
2626
1752/// Invalid GW_* command.2627/// Invalid GW_* command.
1753pub const INVALID_GW_COMMAND = 1443;2628pub const INVALID_GW_COMMAND = 1443;
2629
1754/// Invalid thread identifier.2630/// Invalid thread identifier.
1755pub const INVALID_THREAD_ID = 1444;2631pub const INVALID_THREAD_ID = 1444;
2632
1756/// Cannot process a message from a window that is not a multiple document interface (MDI) window.2633/// Cannot process a message from a window that is not a multiple document interface (MDI) window.
1757pub const NON_MDICHILD_WINDOW = 1445;2634pub const NON_MDICHILD_WINDOW = 1445;
2635
1758/// Popup menu already active.2636/// Popup menu already active.
1759pub const POPUP_ALREADY_ACTIVE = 1446;2637pub const POPUP_ALREADY_ACTIVE = 1446;
2638
1760/// The window does not have scroll bars.2639/// The window does not have scroll bars.
1761pub const NO_SCROLLBARS = 1447;2640pub const NO_SCROLLBARS = 1447;
2641
1762/// Scroll bar range cannot be greater than MAXLONG.2642/// Scroll bar range cannot be greater than MAXLONG.
1763pub const INVALID_SCROLLBAR_RANGE = 1448;2643pub const INVALID_SCROLLBAR_RANGE = 1448;
2644
1764/// Cannot show or remove the window in the way specified.2645/// Cannot show or remove the window in the way specified.
1765pub const INVALID_SHOWWIN_COMMAND = 1449;2646pub const INVALID_SHOWWIN_COMMAND = 1449;
2647
1766/// Insufficient system resources exist to complete the requested service.2648/// Insufficient system resources exist to complete the requested service.
1767pub const NO_SYSTEM_RESOURCES = 1450;2649pub const NO_SYSTEM_RESOURCES = 1450;
2650
1768/// Insufficient system resources exist to complete the requested service.2651/// Insufficient system resources exist to complete the requested service.
1769pub const NONPAGED_SYSTEM_RESOURCES = 1451;2652pub const NONPAGED_SYSTEM_RESOURCES = 1451;
2653
1770/// Insufficient system resources exist to complete the requested service.2654/// Insufficient system resources exist to complete the requested service.
1771pub const PAGED_SYSTEM_RESOURCES = 1452;2655pub const PAGED_SYSTEM_RESOURCES = 1452;
2656
1772/// Insufficient quota to complete the requested service.2657/// Insufficient quota to complete the requested service.
1773pub const WORKING_SET_QUOTA = 1453;2658pub const WORKING_SET_QUOTA = 1453;
2659
1774/// Insufficient quota to complete the requested service.2660/// Insufficient quota to complete the requested service.
1775pub const PAGEFILE_QUOTA = 1454;2661pub const PAGEFILE_QUOTA = 1454;
2662
1776/// The paging file is too small for this operation to complete.2663/// The paging file is too small for this operation to complete.
1777pub const COMMITMENT_LIMIT = 1455;2664pub const COMMITMENT_LIMIT = 1455;
2665
1778/// A menu item was not found.2666/// A menu item was not found.
1779pub const MENU_ITEM_NOT_FOUND = 1456;2667pub const MENU_ITEM_NOT_FOUND = 1456;
2668
1780/// Invalid keyboard layout handle.2669/// Invalid keyboard layout handle.
1781pub const INVALID_KEYBOARD_HANDLE = 1457;2670pub const INVALID_KEYBOARD_HANDLE = 1457;
2671
1782/// Hook type not allowed.2672/// Hook type not allowed.
1783pub const HOOK_TYPE_NOT_ALLOWED = 1458;2673pub const HOOK_TYPE_NOT_ALLOWED = 1458;
2674
1784/// This operation requires an interactive window station.2675/// This operation requires an interactive window station.
1785pub const REQUIRES_INTERACTIVE_WINDOWSTATION = 1459;2676pub const REQUIRES_INTERACTIVE_WINDOWSTATION = 1459;
2677
1786/// This operation returned because the timeout period expired.2678/// This operation returned because the timeout period expired.
1787pub const TIMEOUT = 1460;2679pub const TIMEOUT = 1460;
2680
1788/// Invalid monitor handle.2681/// Invalid monitor handle.
1789pub const INVALID_MONITOR_HANDLE = 1461;2682pub const INVALID_MONITOR_HANDLE = 1461;
2683
1790/// Incorrect size argument.2684/// Incorrect size argument.
1791pub const INCORRECT_SIZE = 1462;2685pub const INCORRECT_SIZE = 1462;
2686
1792/// The symbolic link cannot be followed because its type is disabled.2687/// The symbolic link cannot be followed because its type is disabled.
1793pub const SYMLINK_CLASS_DISABLED = 1463;2688pub const SYMLINK_CLASS_DISABLED = 1463;
2689
1794/// This application does not support the current operation on symbolic links.2690/// This application does not support the current operation on symbolic links.
1795pub const SYMLINK_NOT_SUPPORTED = 1464;2691pub const SYMLINK_NOT_SUPPORTED = 1464;
2692
1796/// Windows was unable to parse the requested XML data.2693/// Windows was unable to parse the requested XML data.
1797pub const XML_PARSE_ERROR = 1465;2694pub const XML_PARSE_ERROR = 1465;
2695
1798/// An error was encountered while processing an XML digital signature.2696/// An error was encountered while processing an XML digital signature.
1799pub const XMLDSIG_ERROR = 1466;2697pub const XMLDSIG_ERROR = 1466;
2698
1800/// This application must be restarted.2699/// This application must be restarted.
1801pub const RESTART_APPLICATION = 1467;2700pub const RESTART_APPLICATION = 1467;
2701
1802/// The caller made the connection request in the wrong routing compartment.2702/// The caller made the connection request in the wrong routing compartment.
1803pub const WRONG_COMPARTMENT = 1468;2703pub const WRONG_COMPARTMENT = 1468;
2704
1804/// There was an AuthIP failure when attempting to connect to the remote host.2705/// There was an AuthIP failure when attempting to connect to the remote host.
1805pub const AUTHIP_FAILURE = 1469;2706pub const AUTHIP_FAILURE = 1469;
2707
1806/// Insufficient NVRAM resources exist to complete the requested service. A reboot might be required.2708/// Insufficient NVRAM resources exist to complete the requested service. A reboot might be required.
1807pub const NO_NVRAM_RESOURCES = 1470;2709pub const NO_NVRAM_RESOURCES = 1470;
2710
1808/// Unable to finish the requested operation because the specified process is not a GUI process.2711/// Unable to finish the requested operation because the specified process is not a GUI process.
1809pub const NOT_GUI_PROCESS = 1471;2712pub const NOT_GUI_PROCESS = 1471;
2713
1810/// The event log file is corrupted.2714/// The event log file is corrupted.
1811pub const EVENTLOG_FILE_CORRUPT = 1500;2715pub const EVENTLOG_FILE_CORRUPT = 1500;
2716
1812/// No event log file could be opened, so the event logging service did not start.2717/// No event log file could be opened, so the event logging service did not start.
1813pub const EVENTLOG_CANT_START = 1501;2718pub const EVENTLOG_CANT_START = 1501;
2719
1814/// The event log file is full.2720/// The event log file is full.
1815pub const LOG_FILE_FULL = 1502;2721pub const LOG_FILE_FULL = 1502;
2722
1816/// The event log file has changed between read operations.2723/// The event log file has changed between read operations.
1817pub const EVENTLOG_FILE_CHANGED = 1503;2724pub const EVENTLOG_FILE_CHANGED = 1503;
2725
1818/// The specified task name is invalid.2726/// The specified task name is invalid.
1819pub const INVALID_TASK_NAME = 1550;2727pub const INVALID_TASK_NAME = 1550;
2728
1820/// The specified task index is invalid.2729/// The specified task index is invalid.
1821pub const INVALID_TASK_INDEX = 1551;2730pub const INVALID_TASK_INDEX = 1551;
2731
1822/// The specified thread is already joining a task.2732/// The specified thread is already joining a task.
1823pub const THREAD_ALREADY_IN_TASK = 1552;2733pub const THREAD_ALREADY_IN_TASK = 1552;
2734
1824/// The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance.2735/// The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance.
1825pub const INSTALL_SERVICE_FAILURE = 1601;2736pub const INSTALL_SERVICE_FAILURE = 1601;
2737
1826/// User cancelled installation.2738/// User cancelled installation.
1827pub const INSTALL_USEREXIT = 1602;2739pub const INSTALL_USEREXIT = 1602;
2740
1828/// Fatal error during installation.2741/// Fatal error during installation.
1829pub const INSTALL_FAILURE = 1603;2742pub const INSTALL_FAILURE = 1603;
2743
1830/// Installation suspended, incomplete.2744/// Installation suspended, incomplete.
1831pub const INSTALL_SUSPEND = 1604;2745pub const INSTALL_SUSPEND = 1604;
2746
1832/// This action is only valid for products that are currently installed.2747/// This action is only valid for products that are currently installed.
1833pub const UNKNOWN_PRODUCT = 1605;2748pub const UNKNOWN_PRODUCT = 1605;
2749
1834/// Feature ID not registered.2750/// Feature ID not registered.
1835pub const UNKNOWN_FEATURE = 1606;2751pub const UNKNOWN_FEATURE = 1606;
2752
1836/// Component ID not registered.2753/// Component ID not registered.
1837pub const UNKNOWN_COMPONENT = 1607;2754pub const UNKNOWN_COMPONENT = 1607;
2755
1838/// Unknown property.2756/// Unknown property.
1839pub const UNKNOWN_PROPERTY = 1608;2757pub const UNKNOWN_PROPERTY = 1608;
2758
1840/// Handle is in an invalid state.2759/// Handle is in an invalid state.
1841pub const INVALID_HANDLE_STATE = 1609;2760pub const INVALID_HANDLE_STATE = 1609;
2761
1842/// The configuration data for this product is corrupt. Contact your support personnel.2762/// The configuration data for this product is corrupt. Contact your support personnel.
1843pub const BAD_CONFIGURATION = 1610;2763pub const BAD_CONFIGURATION = 1610;
2764
1844/// Component qualifier not present.2765/// Component qualifier not present.
1845pub const INDEX_ABSENT = 1611;2766pub const INDEX_ABSENT = 1611;
2767
1846/// The installation source for this product is not available. Verify that the source exists and that you can access it.2768/// The installation source for this product is not available. Verify that the source exists and that you can access it.
1847pub const INSTALL_SOURCE_ABSENT = 1612;2769pub const INSTALL_SOURCE_ABSENT = 1612;
2770
1848/// This installation package cannot be installed by the Windows Installer service. You must install a Windows service pack that contains a newer version of the Windows Installer service.2771/// This installation package cannot be installed by the Windows Installer service. You must install a Windows service pack that contains a newer version of the Windows Installer service.
1849pub const INSTALL_PACKAGE_VERSION = 1613;2772pub const INSTALL_PACKAGE_VERSION = 1613;
2773
1850/// Product is uninstalled.2774/// Product is uninstalled.
1851pub const PRODUCT_UNINSTALLED = 1614;2775pub const PRODUCT_UNINSTALLED = 1614;
2776
1852/// SQL query syntax invalid or unsupported.2777/// SQL query syntax invalid or unsupported.
1853pub const BAD_QUERY_SYNTAX = 1615;2778pub const BAD_QUERY_SYNTAX = 1615;
2779
1854/// Record field does not exist.2780/// Record field does not exist.
1855pub const INVALID_FIELD = 1616;2781pub const INVALID_FIELD = 1616;
2782
1856/// The device has been removed.2783/// The device has been removed.
1857pub const DEVICE_REMOVED = 1617;2784pub const DEVICE_REMOVED = 1617;
2785
1858/// Another installation is already in progress. Complete that installation before proceeding with this install.2786/// Another installation is already in progress. Complete that installation before proceeding with this install.
1859pub const INSTALL_ALREADY_RUNNING = 1618;2787pub const INSTALL_ALREADY_RUNNING = 1618;
2788
1860/// This installation package could not be opened. Verify that the package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer package.2789/// This installation package could not be opened. Verify that the package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer package.
1861pub const INSTALL_PACKAGE_OPEN_FAILED = 1619;2790pub const INSTALL_PACKAGE_OPEN_FAILED = 1619;
2791
1862/// This installation package could not be opened. Contact the application vendor to verify that this is a valid Windows Installer package.2792/// This installation package could not be opened. Contact the application vendor to verify that this is a valid Windows Installer package.
1863pub const INSTALL_PACKAGE_INVALID = 1620;2793pub const INSTALL_PACKAGE_INVALID = 1620;
2794
1864/// There was an error starting the Windows Installer service user interface. Contact your support personnel.2795/// There was an error starting the Windows Installer service user interface. Contact your support personnel.
1865pub const INSTALL_UI_FAILURE = 1621;2796pub const INSTALL_UI_FAILURE = 1621;
2797
1866/// Error opening installation log file. Verify that the specified log file location exists and that you can write to it.2798/// Error opening installation log file. Verify that the specified log file location exists and that you can write to it.
1867pub const INSTALL_LOG_FAILURE = 1622;2799pub const INSTALL_LOG_FAILURE = 1622;
2800
1868/// The language of this installation package is not supported by your system.2801/// The language of this installation package is not supported by your system.
1869pub const INSTALL_LANGUAGE_UNSUPPORTED = 1623;2802pub const INSTALL_LANGUAGE_UNSUPPORTED = 1623;
2803
1870/// Error applying transforms. Verify that the specified transform paths are valid.2804/// Error applying transforms. Verify that the specified transform paths are valid.
1871pub const INSTALL_TRANSFORM_FAILURE = 1624;2805pub const INSTALL_TRANSFORM_FAILURE = 1624;
2806
1872/// This installation is forbidden by system policy. Contact your system administrator.2807/// This installation is forbidden by system policy. Contact your system administrator.
1873pub const INSTALL_PACKAGE_REJECTED = 1625;2808pub const INSTALL_PACKAGE_REJECTED = 1625;
2809
1874/// Function could not be executed.2810/// Function could not be executed.
1875pub const FUNCTION_NOT_CALLED = 1626;2811pub const FUNCTION_NOT_CALLED = 1626;
2812
1876/// Function failed during execution.2813/// Function failed during execution.
1877pub const FUNCTION_FAILED = 1627;2814pub const FUNCTION_FAILED = 1627;
2815
1878/// Invalid or unknown table specified.2816/// Invalid or unknown table specified.
1879pub const INVALID_TABLE = 1628;2817pub const INVALID_TABLE = 1628;
2818
1880/// Data supplied is of wrong type.2819/// Data supplied is of wrong type.
1881pub const DATATYPE_MISMATCH = 1629;2820pub const DATATYPE_MISMATCH = 1629;
2821
1882/// Data of this type is not supported.2822/// Data of this type is not supported.
1883pub const UNSUPPORTED_TYPE = 1630;2823pub const UNSUPPORTED_TYPE = 1630;
2824
1884/// The Windows Installer service failed to start. Contact your support personnel.2825/// The Windows Installer service failed to start. Contact your support personnel.
1885pub const CREATE_FAILED = 1631;2826pub const CREATE_FAILED = 1631;
2827
1886/// The Temp folder is on a drive that is full or is inaccessible. Free up space on the drive or verify that you have write permission on the Temp folder.2828/// The Temp folder is on a drive that is full or is inaccessible. Free up space on the drive or verify that you have write permission on the Temp folder.
1887pub const INSTALL_TEMP_UNWRITABLE = 1632;2829pub const INSTALL_TEMP_UNWRITABLE = 1632;
2830
1888/// This installation package is not supported by this processor type. Contact your product vendor.2831/// This installation package is not supported by this processor type. Contact your product vendor.
1889pub const INSTALL_PLATFORM_UNSUPPORTED = 1633;2832pub const INSTALL_PLATFORM_UNSUPPORTED = 1633;
2833
1890/// Component not used on this computer.2834/// Component not used on this computer.
1891pub const INSTALL_NOTUSED = 1634;2835pub const INSTALL_NOTUSED = 1634;
2836
1892/// This update package could not be opened. Verify that the update package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer update package.2837/// This update package could not be opened. Verify that the update package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer update package.
1893pub const PATCH_PACKAGE_OPEN_FAILED = 1635;2838pub const PATCH_PACKAGE_OPEN_FAILED = 1635;
2839
1894/// This update package could not be opened. Contact the application vendor to verify that this is a valid Windows Installer update package.2840/// This update package could not be opened. Contact the application vendor to verify that this is a valid Windows Installer update package.
1895pub const PATCH_PACKAGE_INVALID = 1636;2841pub const PATCH_PACKAGE_INVALID = 1636;
2842
1896/// This update package cannot be processed by the Windows Installer service. You must install a Windows service pack that contains a newer version of the Windows Installer service.2843/// This update package cannot be processed by the Windows Installer service. You must install a Windows service pack that contains a newer version of the Windows Installer service.
1897pub const PATCH_PACKAGE_UNSUPPORTED = 1637;2844pub const PATCH_PACKAGE_UNSUPPORTED = 1637;
2845
1898/// Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel.2846/// Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel.
1899pub const PRODUCT_VERSION = 1638;2847pub const PRODUCT_VERSION = 1638;
2848
1900/// Invalid command line argument. Consult the Windows Installer SDK for detailed command line help.2849/// Invalid command line argument. Consult the Windows Installer SDK for detailed command line help.
1901pub const INVALID_COMMAND_LINE = 1639;2850pub const INVALID_COMMAND_LINE = 1639;
2851
1902/// Only administrators have permission to add, remove, or configure server software during a Terminal services remote session. If you want to install or configure software on the server, contact your network administrator.2852/// Only administrators have permission to add, remove, or configure server software during a Terminal services remote session. If you want to install or configure software on the server, contact your network administrator.
1903pub const INSTALL_REMOTE_DISALLOWED = 1640;2853pub const INSTALL_REMOTE_DISALLOWED = 1640;
2854
1904/// The requested operation completed successfully. The system will be restarted so the changes can take effect.2855/// The requested operation completed successfully. The system will be restarted so the changes can take effect.
1905pub const SUCCESS_REBOOT_INITIATED = 1641;2856pub const SUCCESS_REBOOT_INITIATED = 1641;
2857
1906/// The upgrade cannot be installed by the Windows Installer service because the program to be upgraded may be missing, or the upgrade may update a different version of the program. Verify that the program to be upgraded exists on your computer and that you have the correct upgrade.2858/// The upgrade cannot be installed by the Windows Installer service because the program to be upgraded may be missing, or the upgrade may update a different version of the program. Verify that the program to be upgraded exists on your computer and that you have the correct upgrade.
1907pub const PATCH_TARGET_NOT_FOUND = 1642;2859pub const PATCH_TARGET_NOT_FOUND = 1642;
2860
1908/// The update package is not permitted by software restriction policy.2861/// The update package is not permitted by software restriction policy.
1909pub const PATCH_PACKAGE_REJECTED = 1643;2862pub const PATCH_PACKAGE_REJECTED = 1643;
2863
1910/// One or more customizations are not permitted by software restriction policy.2864/// One or more customizations are not permitted by software restriction policy.
1911pub const INSTALL_TRANSFORM_REJECTED = 1644;2865pub const INSTALL_TRANSFORM_REJECTED = 1644;
2866
1912/// The Windows Installer does not permit installation from a Remote Desktop Connection.2867/// The Windows Installer does not permit installation from a Remote Desktop Connection.
1913pub const INSTALL_REMOTE_PROHIBITED = 1645;2868pub const INSTALL_REMOTE_PROHIBITED = 1645;
2869
1914/// Uninstallation of the update package is not supported.2870/// Uninstallation of the update package is not supported.
1915pub const PATCH_REMOVAL_UNSUPPORTED = 1646;2871pub const PATCH_REMOVAL_UNSUPPORTED = 1646;
2872
1916/// The update is not applied to this product.2873/// The update is not applied to this product.
1917pub const UNKNOWN_PATCH = 1647;2874pub const UNKNOWN_PATCH = 1647;
2875
1918/// No valid sequence could be found for the set of updates.2876/// No valid sequence could be found for the set of updates.
1919pub const PATCH_NO_SEQUENCE = 1648;2877pub const PATCH_NO_SEQUENCE = 1648;
2878
1920/// Update removal was disallowed by policy.2879/// Update removal was disallowed by policy.
1921pub const PATCH_REMOVAL_DISALLOWED = 1649;2880pub const PATCH_REMOVAL_DISALLOWED = 1649;
2881
1922/// The XML update data is invalid.2882/// The XML update data is invalid.
1923pub const INVALID_PATCH_XML = 1650;2883pub const INVALID_PATCH_XML = 1650;
2884
1924/// Windows Installer does not permit updating of managed advertised products. At least one feature of the product must be installed before applying the update.2885/// Windows Installer does not permit updating of managed advertised products. At least one feature of the product must be installed before applying the update.
1925pub const PATCH_MANAGED_ADVERTISED_PRODUCT = 1651;2886pub const PATCH_MANAGED_ADVERTISED_PRODUCT = 1651;
2887
1926/// The Windows Installer service is not accessible in Safe Mode. Please try again when your computer is not in Safe Mode or you can use System Restore to return your machine to a previous good state.2888/// The Windows Installer service is not accessible in Safe Mode. Please try again when your computer is not in Safe Mode or you can use System Restore to return your machine to a previous good state.
1927pub const INSTALL_SERVICE_SAFEBOOT = 1652;2889pub const INSTALL_SERVICE_SAFEBOOT = 1652;
2890
1928/// A fail fast exception occurred. Exception handlers will not be invoked and the process will be terminated immediately.2891/// A fail fast exception occurred. Exception handlers will not be invoked and the process will be terminated immediately.
1929pub const FAIL_FAST_EXCEPTION = 1653;2892pub const FAIL_FAST_EXCEPTION = 1653;
2893
1930/// The app that you are trying to run is not supported on this version of Windows.2894/// The app that you are trying to run is not supported on this version of Windows.
1931pub const INSTALL_REJECTED = 1654;2895pub const INSTALL_REJECTED = 1654;
2896
1932/// The string binding is invalid.2897/// The string binding is invalid.
1933pub const RPC_S_INVALID_STRING_BINDING = 1700;2898pub const RPC_S_INVALID_STRING_BINDING = 1700;
2899
1934/// The binding handle is not the correct type.2900/// The binding handle is not the correct type.
1935pub const RPC_S_WRONG_KIND_OF_BINDING = 1701;2901pub const RPC_S_WRONG_KIND_OF_BINDING = 1701;
2902
1936/// The binding handle is invalid.2903/// The binding handle is invalid.
1937pub const RPC_S_INVALID_BINDING = 1702;2904pub const RPC_S_INVALID_BINDING = 1702;
2905
1938/// The RPC protocol sequence is not supported.2906/// The RPC protocol sequence is not supported.
1939pub const RPC_S_PROTSEQ_NOT_SUPPORTED = 1703;2907pub const RPC_S_PROTSEQ_NOT_SUPPORTED = 1703;
2908
1940/// The RPC protocol sequence is invalid.2909/// The RPC protocol sequence is invalid.
1941pub const RPC_S_INVALID_RPC_PROTSEQ = 1704;2910pub const RPC_S_INVALID_RPC_PROTSEQ = 1704;
2911
1942/// The string universal unique identifier (UUID) is invalid.2912/// The string universal unique identifier (UUID) is invalid.
1943pub const RPC_S_INVALID_STRING_UUID = 1705;2913pub const RPC_S_INVALID_STRING_UUID = 1705;
2914
1944/// The endpoint format is invalid.2915/// The endpoint format is invalid.
1945pub const RPC_S_INVALID_ENDPOINT_FORMAT = 1706;2916pub const RPC_S_INVALID_ENDPOINT_FORMAT = 1706;
2917
1946/// The network address is invalid.2918/// The network address is invalid.
1947pub const RPC_S_INVALID_NET_ADDR = 1707;2919pub const RPC_S_INVALID_NET_ADDR = 1707;
2920
1948/// No endpoint was found.2921/// No endpoint was found.
1949pub const RPC_S_NO_ENDPOINT_FOUND = 1708;2922pub const RPC_S_NO_ENDPOINT_FOUND = 1708;
2923
1950/// The timeout value is invalid.2924/// The timeout value is invalid.
1951pub const RPC_S_INVALID_TIMEOUT = 1709;2925pub const RPC_S_INVALID_TIMEOUT = 1709;
2926
1952/// The object universal unique identifier (UUID) was not found.2927/// The object universal unique identifier (UUID) was not found.
1953pub const RPC_S_OBJECT_NOT_FOUND = 1710;2928pub const RPC_S_OBJECT_NOT_FOUND = 1710;
2929
1954/// The object universal unique identifier (UUID) has already been registered.2930/// The object universal unique identifier (UUID) has already been registered.
1955pub const RPC_S_ALREADY_REGISTERED = 1711;2931pub const RPC_S_ALREADY_REGISTERED = 1711;
2932
1956/// The type universal unique identifier (UUID) has already been registered.2933/// The type universal unique identifier (UUID) has already been registered.
1957pub const RPC_S_TYPE_ALREADY_REGISTERED = 1712;2934pub const RPC_S_TYPE_ALREADY_REGISTERED = 1712;
2935
1958/// The RPC server is already listening.2936/// The RPC server is already listening.
1959pub const RPC_S_ALREADY_LISTENING = 1713;2937pub const RPC_S_ALREADY_LISTENING = 1713;
2938
1960/// No protocol sequences have been registered.2939/// No protocol sequences have been registered.
1961pub const RPC_S_NO_PROTSEQS_REGISTERED = 1714;2940pub const RPC_S_NO_PROTSEQS_REGISTERED = 1714;
2941
1962/// The RPC server is not listening.2942/// The RPC server is not listening.
1963pub const RPC_S_NOT_LISTENING = 1715;2943pub const RPC_S_NOT_LISTENING = 1715;
2944
1964/// The manager type is unknown.2945/// The manager type is unknown.
1965pub const RPC_S_UNKNOWN_MGR_TYPE = 1716;2946pub const RPC_S_UNKNOWN_MGR_TYPE = 1716;
2947
1966/// The interface is unknown.2948/// The interface is unknown.
1967pub const RPC_S_UNKNOWN_IF = 1717;2949pub const RPC_S_UNKNOWN_IF = 1717;
2950
1968/// There are no bindings.2951/// There are no bindings.
1969pub const RPC_S_NO_BINDINGS = 1718;2952pub const RPC_S_NO_BINDINGS = 1718;
2953
1970/// There are no protocol sequences.2954/// There are no protocol sequences.
1971pub const RPC_S_NO_PROTSEQS = 1719;2955pub const RPC_S_NO_PROTSEQS = 1719;
2956
1972/// The endpoint cannot be created.2957/// The endpoint cannot be created.
1973pub const RPC_S_CANT_CREATE_ENDPOINT = 1720;2958pub const RPC_S_CANT_CREATE_ENDPOINT = 1720;
2959
1974/// Not enough resources are available to complete this operation.2960/// Not enough resources are available to complete this operation.
1975pub const RPC_S_OUT_OF_RESOURCES = 1721;2961pub const RPC_S_OUT_OF_RESOURCES = 1721;
2962
1976/// The RPC server is unavailable.2963/// The RPC server is unavailable.
1977pub const RPC_S_SERVER_UNAVAILABLE = 1722;2964pub const RPC_S_SERVER_UNAVAILABLE = 1722;
2965
1978/// The RPC server is too busy to complete this operation.2966/// The RPC server is too busy to complete this operation.
1979pub const RPC_S_SERVER_TOO_BUSY = 1723;2967pub const RPC_S_SERVER_TOO_BUSY = 1723;
2968
1980/// The network options are invalid.2969/// The network options are invalid.
1981pub const RPC_S_INVALID_NETWORK_OPTIONS = 1724;2970pub const RPC_S_INVALID_NETWORK_OPTIONS = 1724;
2971
1982/// There are no remote procedure calls active on this thread.2972/// There are no remote procedure calls active on this thread.
1983pub const RPC_S_NO_CALL_ACTIVE = 1725;2973pub const RPC_S_NO_CALL_ACTIVE = 1725;
2974
1984/// The remote procedure call failed.2975/// The remote procedure call failed.
1985pub const RPC_S_CALL_FAILED = 1726;2976pub const RPC_S_CALL_FAILED = 1726;
2977
1986/// The remote procedure call failed and did not execute.2978/// The remote procedure call failed and did not execute.
1987pub const RPC_S_CALL_FAILED_DNE = 1727;2979pub const RPC_S_CALL_FAILED_DNE = 1727;
2980
1988/// A remote procedure call (RPC) protocol error occurred.2981/// A remote procedure call (RPC) protocol error occurred.
1989pub const RPC_S_PROTOCOL_ERROR = 1728;2982pub const RPC_S_PROTOCOL_ERROR = 1728;
2983
1990/// Access to the HTTP proxy is denied.2984/// Access to the HTTP proxy is denied.
1991pub const RPC_S_PROXY_ACCESS_DENIED = 1729;2985pub const RPC_S_PROXY_ACCESS_DENIED = 1729;
2986
1992/// The transfer syntax is not supported by the RPC server.2987/// The transfer syntax is not supported by the RPC server.
1993pub const RPC_S_UNSUPPORTED_TRANS_SYN = 1730;2988pub const RPC_S_UNSUPPORTED_TRANS_SYN = 1730;
2989
1994/// The universal unique identifier (UUID) type is not supported.2990/// The universal unique identifier (UUID) type is not supported.
1995pub const RPC_S_UNSUPPORTED_TYPE = 1732;2991pub const RPC_S_UNSUPPORTED_TYPE = 1732;
2992
1996/// The tag is invalid.2993/// The tag is invalid.
1997pub const RPC_S_INVALID_TAG = 1733;2994pub const RPC_S_INVALID_TAG = 1733;
2995
1998/// The array bounds are invalid.2996/// The array bounds are invalid.
1999pub const RPC_S_INVALID_BOUND = 1734;2997pub const RPC_S_INVALID_BOUND = 1734;
2998
2000/// The binding does not contain an entry name.2999/// The binding does not contain an entry name.
2001pub const RPC_S_NO_ENTRY_NAME = 1735;3000pub const RPC_S_NO_ENTRY_NAME = 1735;
3001
2002/// The name syntax is invalid.3002/// The name syntax is invalid.
2003pub const RPC_S_INVALID_NAME_SYNTAX = 1736;3003pub const RPC_S_INVALID_NAME_SYNTAX = 1736;
3004
2004/// The name syntax is not supported.3005/// The name syntax is not supported.
2005pub const RPC_S_UNSUPPORTED_NAME_SYNTAX = 1737;3006pub const RPC_S_UNSUPPORTED_NAME_SYNTAX = 1737;
3007
2006/// No network address is available to use to construct a universal unique identifier (UUID).3008/// No network address is available to use to construct a universal unique identifier (UUID).
2007pub const RPC_S_UUID_NO_ADDRESS = 1739;3009pub const RPC_S_UUID_NO_ADDRESS = 1739;
3010
2008/// The endpoint is a duplicate.3011/// The endpoint is a duplicate.
2009pub const RPC_S_DUPLICATE_ENDPOINT = 1740;3012pub const RPC_S_DUPLICATE_ENDPOINT = 1740;
3013
2010/// The authentication type is unknown.3014/// The authentication type is unknown.
2011pub const RPC_S_UNKNOWN_AUTHN_TYPE = 1741;3015pub const RPC_S_UNKNOWN_AUTHN_TYPE = 1741;
3016
2012/// The maximum number of calls is too small.3017/// The maximum number of calls is too small.
2013pub const RPC_S_MAX_CALLS_TOO_SMALL = 1742;3018pub const RPC_S_MAX_CALLS_TOO_SMALL = 1742;
3019
2014/// The string is too long.3020/// The string is too long.
2015pub const RPC_S_STRING_TOO_LONG = 1743;3021pub const RPC_S_STRING_TOO_LONG = 1743;
3022
2016/// The RPC protocol sequence was not found.3023/// The RPC protocol sequence was not found.
2017pub const RPC_S_PROTSEQ_NOT_FOUND = 1744;3024pub const RPC_S_PROTSEQ_NOT_FOUND = 1744;
3025
2018/// The procedure number is out of range.3026/// The procedure number is out of range.
2019pub const RPC_S_PROCNUM_OUT_OF_RANGE = 1745;3027pub const RPC_S_PROCNUM_OUT_OF_RANGE = 1745;
3028
2020/// The binding does not contain any authentication information.3029/// The binding does not contain any authentication information.
2021pub const RPC_S_BINDING_HAS_NO_AUTH = 1746;3030pub const RPC_S_BINDING_HAS_NO_AUTH = 1746;
3031
2022/// The authentication service is unknown.3032/// The authentication service is unknown.
2023pub const RPC_S_UNKNOWN_AUTHN_SERVICE = 1747;3033pub const RPC_S_UNKNOWN_AUTHN_SERVICE = 1747;
3034
2024/// The authentication level is unknown.3035/// The authentication level is unknown.
2025pub const RPC_S_UNKNOWN_AUTHN_LEVEL = 1748;3036pub const RPC_S_UNKNOWN_AUTHN_LEVEL = 1748;
3037
2026/// The security context is invalid.3038/// The security context is invalid.
2027pub const RPC_S_INVALID_AUTH_IDENTITY = 1749;3039pub const RPC_S_INVALID_AUTH_IDENTITY = 1749;
3040
2028/// The authorization service is unknown.3041/// The authorization service is unknown.
2029pub const RPC_S_UNKNOWN_AUTHZ_SERVICE = 1750;3042pub const RPC_S_UNKNOWN_AUTHZ_SERVICE = 1750;
3043
2030/// The entry is invalid.3044/// The entry is invalid.
2031pub const EPT_S_INVALID_ENTRY = 1751;3045pub const EPT_S_INVALID_ENTRY = 1751;
3046
2032/// The server endpoint cannot perform the operation.3047/// The server endpoint cannot perform the operation.
2033pub const EPT_S_CANT_PERFORM_OP = 1752;3048pub const EPT_S_CANT_PERFORM_OP = 1752;
3049
2034/// There are no more endpoints available from the endpoint mapper.3050/// There are no more endpoints available from the endpoint mapper.
2035pub const EPT_S_NOT_REGISTERED = 1753;3051pub const EPT_S_NOT_REGISTERED = 1753;
3052
2036/// No interfaces have been exported.3053/// No interfaces have been exported.
2037pub const RPC_S_NOTHING_TO_EXPORT = 1754;3054pub const RPC_S_NOTHING_TO_EXPORT = 1754;
3055
2038/// The entry name is incomplete.3056/// The entry name is incomplete.
2039pub const RPC_S_INCOMPLETE_NAME = 1755;3057pub const RPC_S_INCOMPLETE_NAME = 1755;
3058
2040/// The version option is invalid.3059/// The version option is invalid.
2041pub const RPC_S_INVALID_VERS_OPTION = 1756;3060pub const RPC_S_INVALID_VERS_OPTION = 1756;
3061
2042/// There are no more members.3062/// There are no more members.
2043pub const RPC_S_NO_MORE_MEMBERS = 1757;3063pub const RPC_S_NO_MORE_MEMBERS = 1757;
3064
2044/// There is nothing to unexport.3065/// There is nothing to unexport.
2045pub const RPC_S_NOT_ALL_OBJS_UNEXPORTED = 1758;3066pub const RPC_S_NOT_ALL_OBJS_UNEXPORTED = 1758;
3067
2046/// The interface was not found.3068/// The interface was not found.
2047pub const RPC_S_INTERFACE_NOT_FOUND = 1759;3069pub const RPC_S_INTERFACE_NOT_FOUND = 1759;
3070
2048/// The entry already exists.3071/// The entry already exists.
2049pub const RPC_S_ENTRY_ALREADY_EXISTS = 1760;3072pub const RPC_S_ENTRY_ALREADY_EXISTS = 1760;
3073
2050/// The entry is not found.3074/// The entry is not found.
2051pub const RPC_S_ENTRY_NOT_FOUND = 1761;3075pub const RPC_S_ENTRY_NOT_FOUND = 1761;
3076
2052/// The name service is unavailable.3077/// The name service is unavailable.
2053pub const RPC_S_NAME_SERVICE_UNAVAILABLE = 1762;3078pub const RPC_S_NAME_SERVICE_UNAVAILABLE = 1762;
3079
2054/// The network address family is invalid.3080/// The network address family is invalid.
2055pub const RPC_S_INVALID_NAF_ID = 1763;3081pub const RPC_S_INVALID_NAF_ID = 1763;
3082
2056/// The requested operation is not supported.3083/// The requested operation is not supported.
2057pub const RPC_S_CANNOT_SUPPORT = 1764;3084pub const RPC_S_CANNOT_SUPPORT = 1764;
3085
2058/// No security context is available to allow impersonation.3086/// No security context is available to allow impersonation.
2059pub const RPC_S_NO_CONTEXT_AVAILABLE = 1765;3087pub const RPC_S_NO_CONTEXT_AVAILABLE = 1765;
3088
2060/// An internal error occurred in a remote procedure call (RPC).3089/// An internal error occurred in a remote procedure call (RPC).
2061pub const RPC_S_INTERNAL_ERROR = 1766;3090pub const RPC_S_INTERNAL_ERROR = 1766;
3091
2062/// The RPC server attempted an integer division by zero.3092/// The RPC server attempted an integer division by zero.
2063pub const RPC_S_ZERO_DIVIDE = 1767;3093pub const RPC_S_ZERO_DIVIDE = 1767;
3094
2064/// An addressing error occurred in the RPC server.3095/// An addressing error occurred in the RPC server.
2065pub const RPC_S_ADDRESS_ERROR = 1768;3096pub const RPC_S_ADDRESS_ERROR = 1768;
3097
2066/// A floating-point operation at the RPC server caused a division by zero.3098/// A floating-point operation at the RPC server caused a division by zero.
2067pub const RPC_S_FP_DIV_ZERO = 1769;3099pub const RPC_S_FP_DIV_ZERO = 1769;
3100
2068/// A floating-point underflow occurred at the RPC server.3101/// A floating-point underflow occurred at the RPC server.
2069pub const RPC_S_FP_UNDERFLOW = 1770;3102pub const RPC_S_FP_UNDERFLOW = 1770;
3103
2070/// A floating-point overflow occurred at the RPC server.3104/// A floating-point overflow occurred at the RPC server.
2071pub const RPC_S_FP_OVERFLOW = 1771;3105pub const RPC_S_FP_OVERFLOW = 1771;
3106
2072/// The list of RPC servers available for the binding of auto handles has been exhausted.3107/// The list of RPC servers available for the binding of auto handles has been exhausted.
2073pub const RPC_X_NO_MORE_ENTRIES = 1772;3108pub const RPC_X_NO_MORE_ENTRIES = 1772;
3109
2074/// Unable to open the character translation table file.3110/// Unable to open the character translation table file.
2075pub const RPC_X_SS_CHAR_TRANS_OPEN_FAIL = 1773;3111pub const RPC_X_SS_CHAR_TRANS_OPEN_FAIL = 1773;
3112
2076/// The file containing the character translation table has fewer than 512 bytes.3113/// The file containing the character translation table has fewer than 512 bytes.
2077pub const RPC_X_SS_CHAR_TRANS_SHORT_FILE = 1774;3114pub const RPC_X_SS_CHAR_TRANS_SHORT_FILE = 1774;
3115
2078/// A null context handle was passed from the client to the host during a remote procedure call.3116/// A null context handle was passed from the client to the host during a remote procedure call.
2079pub const RPC_X_SS_IN_NULL_CONTEXT = 1775;3117pub const RPC_X_SS_IN_NULL_CONTEXT = 1775;
3118
2080/// The context handle changed during a remote procedure call.3119/// The context handle changed during a remote procedure call.
2081pub const RPC_X_SS_CONTEXT_DAMAGED = 1777;3120pub const RPC_X_SS_CONTEXT_DAMAGED = 1777;
3121
2082/// The binding handles passed to a remote procedure call do not match.3122/// The binding handles passed to a remote procedure call do not match.
2083pub const RPC_X_SS_HANDLES_MISMATCH = 1778;3123pub const RPC_X_SS_HANDLES_MISMATCH = 1778;
3124
2084/// The stub is unable to get the remote procedure call handle.3125/// The stub is unable to get the remote procedure call handle.
2085pub const RPC_X_SS_CANNOT_GET_CALL_HANDLE = 1779;3126pub const RPC_X_SS_CANNOT_GET_CALL_HANDLE = 1779;
3127
2086/// A null reference pointer was passed to the stub.3128/// A null reference pointer was passed to the stub.
2087pub const RPC_X_NULL_REF_POINTER = 1780;3129pub const RPC_X_NULL_REF_POINTER = 1780;
3130
2088/// The enumeration value is out of range.3131/// The enumeration value is out of range.
2089pub const RPC_X_ENUM_VALUE_OUT_OF_RANGE = 1781;3132pub const RPC_X_ENUM_VALUE_OUT_OF_RANGE = 1781;
3133
2090/// The byte count is too small.3134/// The byte count is too small.
2091pub const RPC_X_BYTE_COUNT_TOO_SMALL = 1782;3135pub const RPC_X_BYTE_COUNT_TOO_SMALL = 1782;
3136
2092/// The stub received bad data.3137/// The stub received bad data.
2093pub const RPC_X_BAD_STUB_DATA = 1783;3138pub const RPC_X_BAD_STUB_DATA = 1783;
3139
2094/// The supplied user buffer is not valid for the requested operation.3140/// The supplied user buffer is not valid for the requested operation.
2095pub const INVALID_USER_BUFFER = 1784;3141pub const INVALID_USER_BUFFER = 1784;
3142
2096/// The disk media is not recognized. It may not be formatted.3143/// The disk media is not recognized. It may not be formatted.
2097pub const UNRECOGNIZED_MEDIA = 1785;3144pub const UNRECOGNIZED_MEDIA = 1785;
3145
2098/// The workstation does not have a trust secret.3146/// The workstation does not have a trust secret.
2099pub const NO_TRUST_LSA_SECRET = 1786;3147pub const NO_TRUST_LSA_SECRET = 1786;
3148
2100/// The security database on the server does not have a computer account for this workstation trust relationship.3149/// The security database on the server does not have a computer account for this workstation trust relationship.
2101pub const NO_TRUST_SAM_ACCOUNT = 1787;3150pub const NO_TRUST_SAM_ACCOUNT = 1787;
3151
2102/// The trust relationship between the primary domain and the trusted domain failed.3152/// The trust relationship between the primary domain and the trusted domain failed.
2103pub const TRUSTED_DOMAIN_FAILURE = 1788;3153pub const TRUSTED_DOMAIN_FAILURE = 1788;
3154
2104/// The trust relationship between this workstation and the primary domain failed.3155/// The trust relationship between this workstation and the primary domain failed.
2105pub const TRUSTED_RELATIONSHIP_FAILURE = 1789;3156pub const TRUSTED_RELATIONSHIP_FAILURE = 1789;
3157
2106/// The network logon failed.3158/// The network logon failed.
2107pub const TRUST_FAILURE = 1790;3159pub const TRUST_FAILURE = 1790;
3160
2108/// A remote procedure call is already in progress for this thread.3161/// A remote procedure call is already in progress for this thread.
2109pub const RPC_S_CALL_IN_PROGRESS = 1791;3162pub const RPC_S_CALL_IN_PROGRESS = 1791;
3163
2110/// An attempt was made to logon, but the network logon service was not started.3164/// An attempt was made to logon, but the network logon service was not started.
2111pub const NETLOGON_NOT_STARTED = 1792;3165pub const NETLOGON_NOT_STARTED = 1792;
3166
2112/// The user's account has expired.3167/// The user's account has expired.
2113pub const ACCOUNT_EXPIRED = 1793;3168pub const ACCOUNT_EXPIRED = 1793;
3169
2114/// The redirector is in use and cannot be unloaded.3170/// The redirector is in use and cannot be unloaded.
2115pub const REDIRECTOR_HAS_OPEN_HANDLES = 1794;3171pub const REDIRECTOR_HAS_OPEN_HANDLES = 1794;
3172
2116/// The specified printer driver is already installed.3173/// The specified printer driver is already installed.
2117pub const PRINTER_DRIVER_ALREADY_INSTALLED = 1795;3174pub const PRINTER_DRIVER_ALREADY_INSTALLED = 1795;
3175
2118/// The specified port is unknown.3176/// The specified port is unknown.
2119pub const UNKNOWN_PORT = 1796;3177pub const UNKNOWN_PORT = 1796;
3178
2120/// The printer driver is unknown.3179/// The printer driver is unknown.
2121pub const UNKNOWN_PRINTER_DRIVER = 1797;3180pub const UNKNOWN_PRINTER_DRIVER = 1797;
3181
2122/// The print processor is unknown.3182/// The print processor is unknown.
2123pub const UNKNOWN_PRINTPROCESSOR = 1798;3183pub const UNKNOWN_PRINTPROCESSOR = 1798;
3184
2124/// The specified separator file is invalid.3185/// The specified separator file is invalid.
2125pub const INVALID_SEPARATOR_FILE = 1799;3186pub const INVALID_SEPARATOR_FILE = 1799;
3187
2126/// The specified priority is invalid.3188/// The specified priority is invalid.
2127pub const INVALID_PRIORITY = 1800;3189pub const INVALID_PRIORITY = 1800;
3190
2128/// The printer name is invalid.3191/// The printer name is invalid.
2129pub const INVALID_PRINTER_NAME = 1801;3192pub const INVALID_PRINTER_NAME = 1801;
3193
2130/// The printer already exists.3194/// The printer already exists.
2131pub const PRINTER_ALREADY_EXISTS = 1802;3195pub const PRINTER_ALREADY_EXISTS = 1802;
3196
2132/// The printer command is invalid.3197/// The printer command is invalid.
2133pub const INVALID_PRINTER_COMMAND = 1803;3198pub const INVALID_PRINTER_COMMAND = 1803;
3199
2134/// The specified datatype is invalid.3200/// The specified datatype is invalid.
2135pub const INVALID_DATATYPE = 1804;3201pub const INVALID_DATATYPE = 1804;
3202
2136/// The environment specified is invalid.3203/// The environment specified is invalid.
2137pub const INVALID_ENVIRONMENT = 1805;3204pub const INVALID_ENVIRONMENT = 1805;
3205
2138/// There are no more bindings.3206/// There are no more bindings.
2139pub const RPC_S_NO_MORE_BINDINGS = 1806;3207pub const RPC_S_NO_MORE_BINDINGS = 1806;
3208
2140/// The account used is an interdomain trust account. Use your global user account or local user account to access this server.3209/// The account used is an interdomain trust account. Use your global user account or local user account to access this server.
2141pub const NOLOGON_INTERDOMAIN_TRUST_ACCOUNT = 1807;3210pub const NOLOGON_INTERDOMAIN_TRUST_ACCOUNT = 1807;
3211
2142/// The account used is a computer account. Use your global user account or local user account to access this server.3212/// The account used is a computer account. Use your global user account or local user account to access this server.
2143pub const NOLOGON_WORKSTATION_TRUST_ACCOUNT = 1808;3213pub const NOLOGON_WORKSTATION_TRUST_ACCOUNT = 1808;
3214
2144/// The account used is a server trust account. Use your global user account or local user account to access this server.3215/// The account used is a server trust account. Use your global user account or local user account to access this server.
2145pub const NOLOGON_SERVER_TRUST_ACCOUNT = 1809;3216pub const NOLOGON_SERVER_TRUST_ACCOUNT = 1809;
3217
2146/// The name or security ID (SID) of the domain specified is inconsistent with the trust information for that domain.3218/// The name or security ID (SID) of the domain specified is inconsistent with the trust information for that domain.
2147pub const DOMAIN_TRUST_INCONSISTENT = 1810;3219pub const DOMAIN_TRUST_INCONSISTENT = 1810;
3220
2148/// The server is in use and cannot be unloaded.3221/// The server is in use and cannot be unloaded.
2149pub const SERVER_HAS_OPEN_HANDLES = 1811;3222pub const SERVER_HAS_OPEN_HANDLES = 1811;
3223
2150/// The specified image file did not contain a resource section.3224/// The specified image file did not contain a resource section.
2151pub const RESOURCE_DATA_NOT_FOUND = 1812;3225pub const RESOURCE_DATA_NOT_FOUND = 1812;
3226
2152/// The specified resource type cannot be found in the image file.3227/// The specified resource type cannot be found in the image file.
2153pub const RESOURCE_TYPE_NOT_FOUND = 1813;3228pub const RESOURCE_TYPE_NOT_FOUND = 1813;
3229
2154/// The specified resource name cannot be found in the image file.3230/// The specified resource name cannot be found in the image file.
2155pub const RESOURCE_NAME_NOT_FOUND = 1814;3231pub const RESOURCE_NAME_NOT_FOUND = 1814;
3232
2156/// The specified resource language ID cannot be found in the image file.3233/// The specified resource language ID cannot be found in the image file.
2157pub const RESOURCE_LANG_NOT_FOUND = 1815;3234pub const RESOURCE_LANG_NOT_FOUND = 1815;
3235
2158/// Not enough quota is available to process this command.3236/// Not enough quota is available to process this command.
2159pub const NOT_ENOUGH_QUOTA = 1816;3237pub const NOT_ENOUGH_QUOTA = 1816;
3238
2160/// No interfaces have been registered.3239/// No interfaces have been registered.
2161pub const RPC_S_NO_INTERFACES = 1817;3240pub const RPC_S_NO_INTERFACES = 1817;
3241
2162/// The remote procedure call was cancelled.3242/// The remote procedure call was cancelled.
2163pub const RPC_S_CALL_CANCELLED = 1818;3243pub const RPC_S_CALL_CANCELLED = 1818;
3244
2164/// The binding handle does not contain all required information.3245/// The binding handle does not contain all required information.
2165pub const RPC_S_BINDING_INCOMPLETE = 1819;3246pub const RPC_S_BINDING_INCOMPLETE = 1819;
3247
2166/// A communications failure occurred during a remote procedure call.3248/// A communications failure occurred during a remote procedure call.
2167pub const RPC_S_COMM_FAILURE = 1820;3249pub const RPC_S_COMM_FAILURE = 1820;
3250
2168/// The requested authentication level is not supported.3251/// The requested authentication level is not supported.
2169pub const RPC_S_UNSUPPORTED_AUTHN_LEVEL = 1821;3252pub const RPC_S_UNSUPPORTED_AUTHN_LEVEL = 1821;
3253
2170/// No principal name registered.3254/// No principal name registered.
2171pub const RPC_S_NO_PRINC_NAME = 1822;3255pub const RPC_S_NO_PRINC_NAME = 1822;
3256
2172/// The error specified is not a valid Windows RPC error code.3257/// The error specified is not a valid Windows RPC error code.
2173pub const RPC_S_NOT_RPC_ERROR = 1823;3258pub const RPC_S_NOT_RPC_ERROR = 1823;
3259
2174/// A UUID that is valid only on this computer has been allocated.3260/// A UUID that is valid only on this computer has been allocated.
2175pub const RPC_S_UUID_LOCAL_ONLY = 1824;3261pub const RPC_S_UUID_LOCAL_ONLY = 1824;
3262
2176/// A security package specific error occurred.3263/// A security package specific error occurred.
2177pub const RPC_S_SEC_PKG_ERROR = 1825;3264pub const RPC_S_SEC_PKG_ERROR = 1825;
3265
2178/// Thread is not canceled.3266/// Thread is not canceled.
2179pub const RPC_S_NOT_CANCELLED = 1826;3267pub const RPC_S_NOT_CANCELLED = 1826;
3268
2180/// Invalid operation on the encoding/decoding handle.3269/// Invalid operation on the encoding/decoding handle.
2181pub const RPC_X_INVALID_ES_ACTION = 1827;3270pub const RPC_X_INVALID_ES_ACTION = 1827;
3271
2182/// Incompatible version of the serializing package.3272/// Incompatible version of the serializing package.
2183pub const RPC_X_WRONG_ES_VERSION = 1828;3273pub const RPC_X_WRONG_ES_VERSION = 1828;
3274
2184/// Incompatible version of the RPC stub.3275/// Incompatible version of the RPC stub.
2185pub const RPC_X_WRONG_STUB_VERSION = 1829;3276pub const RPC_X_WRONG_STUB_VERSION = 1829;
3277
2186/// The RPC pipe object is invalid or corrupted.3278/// The RPC pipe object is invalid or corrupted.
2187pub const RPC_X_INVALID_PIPE_OBJECT = 1830;3279pub const RPC_X_INVALID_PIPE_OBJECT = 1830;
3280
2188/// An invalid operation was attempted on an RPC pipe object.3281/// An invalid operation was attempted on an RPC pipe object.
2189pub const RPC_X_WRONG_PIPE_ORDER = 1831;3282pub const RPC_X_WRONG_PIPE_ORDER = 1831;
3283
2190/// Unsupported RPC pipe version.3284/// Unsupported RPC pipe version.
2191pub const RPC_X_WRONG_PIPE_VERSION = 1832;3285pub const RPC_X_WRONG_PIPE_VERSION = 1832;
3286
2192/// HTTP proxy server rejected the connection because the cookie authentication failed.3287/// HTTP proxy server rejected the connection because the cookie authentication failed.
2193pub const RPC_S_COOKIE_AUTH_FAILED = 1833;3288pub const RPC_S_COOKIE_AUTH_FAILED = 1833;
3289
2194/// The group member was not found.3290/// The group member was not found.
2195pub const RPC_S_GROUP_MEMBER_NOT_FOUND = 1898;3291pub const RPC_S_GROUP_MEMBER_NOT_FOUND = 1898;
3292
2196/// The endpoint mapper database entry could not be created.3293/// The endpoint mapper database entry could not be created.
2197pub const EPT_S_CANT_CREATE = 1899;3294pub const EPT_S_CANT_CREATE = 1899;
3295
2198/// The object universal unique identifier (UUID) is the nil UUID.3296/// The object universal unique identifier (UUID) is the nil UUID.
2199pub const RPC_S_INVALID_OBJECT = 1900;3297pub const RPC_S_INVALID_OBJECT = 1900;
3298
2200/// The specified time is invalid.3299/// The specified time is invalid.
2201pub const INVALID_TIME = 1901;3300pub const INVALID_TIME = 1901;
3301
2202/// The specified form name is invalid.3302/// The specified form name is invalid.
2203pub const INVALID_FORM_NAME = 1902;3303pub const INVALID_FORM_NAME = 1902;
3304
2204/// The specified form size is invalid.3305/// The specified form size is invalid.
2205pub const INVALID_FORM_SIZE = 1903;3306pub const INVALID_FORM_SIZE = 1903;
3307
2206/// The specified printer handle is already being waited on.3308/// The specified printer handle is already being waited on.
2207pub const ALREADY_WAITING = 1904;3309pub const ALREADY_WAITING = 1904;
3310
2208/// The specified printer has been deleted.3311/// The specified printer has been deleted.
2209pub const PRINTER_DELETED = 1905;3312pub const PRINTER_DELETED = 1905;
3313
2210/// The state of the printer is invalid.3314/// The state of the printer is invalid.
2211pub const INVALID_PRINTER_STATE = 1906;3315pub const INVALID_PRINTER_STATE = 1906;
3316
2212/// The user's password must be changed before signing in.3317/// The user's password must be changed before signing in.
2213pub const PASSWORD_MUST_CHANGE = 1907;3318pub const PASSWORD_MUST_CHANGE = 1907;
3319
2214/// Could not find the domain controller for this domain.3320/// Could not find the domain controller for this domain.
2215pub const DOMAIN_CONTROLLER_NOT_FOUND = 1908;3321pub const DOMAIN_CONTROLLER_NOT_FOUND = 1908;
3322
2216/// The referenced account is currently locked out and may not be logged on to.3323/// The referenced account is currently locked out and may not be logged on to.
2217pub const ACCOUNT_LOCKED_OUT = 1909;3324pub const ACCOUNT_LOCKED_OUT = 1909;
3325
2218/// The object exporter specified was not found.3326/// The object exporter specified was not found.
2219pub const OR_INVALID_OXID = 1910;3327pub const OR_INVALID_OXID = 1910;
3328
2220/// The object specified was not found.3329/// The object specified was not found.
2221pub const OR_INVALID_OID = 1911;3330pub const OR_INVALID_OID = 1911;
3331
2222/// The object resolver set specified was not found.3332/// The object resolver set specified was not found.
2223pub const OR_INVALID_SET = 1912;3333pub const OR_INVALID_SET = 1912;
3334
2224/// Some data remains to be sent in the request buffer.3335/// Some data remains to be sent in the request buffer.
2225pub const RPC_S_SEND_INCOMPLETE = 1913;3336pub const RPC_S_SEND_INCOMPLETE = 1913;
3337
2226/// Invalid asynchronous remote procedure call handle.3338/// Invalid asynchronous remote procedure call handle.
2227pub const RPC_S_INVALID_ASYNC_HANDLE = 1914;3339pub const RPC_S_INVALID_ASYNC_HANDLE = 1914;
3340
2228/// Invalid asynchronous RPC call handle for this operation.3341/// Invalid asynchronous RPC call handle for this operation.
2229pub const RPC_S_INVALID_ASYNC_CALL = 1915;3342pub const RPC_S_INVALID_ASYNC_CALL = 1915;
3343
2230/// The RPC pipe object has already been closed.3344/// The RPC pipe object has already been closed.
2231pub const RPC_X_PIPE_CLOSED = 1916;3345pub const RPC_X_PIPE_CLOSED = 1916;
3346
2232/// The RPC call completed before all pipes were processed.3347/// The RPC call completed before all pipes were processed.
2233pub const RPC_X_PIPE_DISCIPLINE_ERROR = 1917;3348pub const RPC_X_PIPE_DISCIPLINE_ERROR = 1917;
3349
2234/// No more data is available from the RPC pipe.3350/// No more data is available from the RPC pipe.
2235pub const RPC_X_PIPE_EMPTY = 1918;3351pub const RPC_X_PIPE_EMPTY = 1918;
3352
2236/// No site name is available for this machine.3353/// No site name is available for this machine.
2237pub const NO_SITENAME = 1919;3354pub const NO_SITENAME = 1919;
3355
2238/// The file cannot be accessed by the system.3356/// The file cannot be accessed by the system.
2239pub const CANT_ACCESS_FILE = 1920;3357pub const CANT_ACCESS_FILE = 1920;
3358
2240/// The name of the file cannot be resolved by the system.3359/// The name of the file cannot be resolved by the system.
2241pub const CANT_RESOLVE_FILENAME = 1921;3360pub const CANT_RESOLVE_FILENAME = 1921;
3361
2242/// The entry is not of the expected type.3362/// The entry is not of the expected type.
2243pub const RPC_S_ENTRY_TYPE_MISMATCH = 1922;3363pub const RPC_S_ENTRY_TYPE_MISMATCH = 1922;
3364
2244/// Not all object UUIDs could be exported to the specified entry.3365/// Not all object UUIDs could be exported to the specified entry.
2245pub const RPC_S_NOT_ALL_OBJS_EXPORTED = 1923;3366pub const RPC_S_NOT_ALL_OBJS_EXPORTED = 1923;
3367
2246/// Interface could not be exported to the specified entry.3368/// Interface could not be exported to the specified entry.
2247pub const RPC_S_INTERFACE_NOT_EXPORTED = 1924;3369pub const RPC_S_INTERFACE_NOT_EXPORTED = 1924;
3370
2248/// The specified profile entry could not be added.3371/// The specified profile entry could not be added.
2249pub const RPC_S_PROFILE_NOT_ADDED = 1925;3372pub const RPC_S_PROFILE_NOT_ADDED = 1925;
3373
2250/// The specified profile element could not be added.3374/// The specified profile element could not be added.
2251pub const RPC_S_PRF_ELT_NOT_ADDED = 1926;3375pub const RPC_S_PRF_ELT_NOT_ADDED = 1926;
3376
2252/// The specified profile element could not be removed.3377/// The specified profile element could not be removed.
2253pub const RPC_S_PRF_ELT_NOT_REMOVED = 1927;3378pub const RPC_S_PRF_ELT_NOT_REMOVED = 1927;
3379
2254/// The group element could not be added.3380/// The group element could not be added.
2255pub const RPC_S_GRP_ELT_NOT_ADDED = 1928;3381pub const RPC_S_GRP_ELT_NOT_ADDED = 1928;
3382
2256/// The group element could not be removed.3383/// The group element could not be removed.
2257pub const RPC_S_GRP_ELT_NOT_REMOVED = 1929;3384pub const RPC_S_GRP_ELT_NOT_REMOVED = 1929;
3385
2258/// The printer driver is not compatible with a policy enabled on your computer that blocks NT 4.0 drivers.3386/// The printer driver is not compatible with a policy enabled on your computer that blocks NT 4.0 drivers.
2259pub const KM_DRIVER_BLOCKED = 1930;3387pub const KM_DRIVER_BLOCKED = 1930;
3388
2260/// The context has expired and can no longer be used.3389/// The context has expired and can no longer be used.
2261pub const CONTEXT_EXPIRED = 1931;3390pub const CONTEXT_EXPIRED = 1931;
3391
2262/// The current user's delegated trust creation quota has been exceeded.3392/// The current user's delegated trust creation quota has been exceeded.
2263pub const PER_USER_TRUST_QUOTA_EXCEEDED = 1932;3393pub const PER_USER_TRUST_QUOTA_EXCEEDED = 1932;
3394
2264/// The total delegated trust creation quota has been exceeded.3395/// The total delegated trust creation quota has been exceeded.
2265pub const ALL_USER_TRUST_QUOTA_EXCEEDED = 1933;3396pub const ALL_USER_TRUST_QUOTA_EXCEEDED = 1933;
3397
2266/// The current user's delegated trust deletion quota has been exceeded.3398/// The current user's delegated trust deletion quota has been exceeded.
2267pub const USER_DELETE_TRUST_QUOTA_EXCEEDED = 1934;3399pub const USER_DELETE_TRUST_QUOTA_EXCEEDED = 1934;
3400
2268/// The computer you are signing into is protected by an authentication firewall. The specified account is not allowed to authenticate to the computer.3401/// The computer you are signing into is protected by an authentication firewall. The specified account is not allowed to authenticate to the computer.
2269pub const AUTHENTICATION_FIREWALL_FAILED = 1935;3402pub const AUTHENTICATION_FIREWALL_FAILED = 1935;
3403
2270/// Remote connections to the Print Spooler are blocked by a policy set on your machine.3404/// Remote connections to the Print Spooler are blocked by a policy set on your machine.
2271pub const REMOTE_PRINT_CONNECTIONS_BLOCKED = 1936;3405pub const REMOTE_PRINT_CONNECTIONS_BLOCKED = 1936;
3406
2272/// Authentication failed because NTLM authentication has been disabled.3407/// Authentication failed because NTLM authentication has been disabled.
2273pub const NTLM_BLOCKED = 1937;3408pub const NTLM_BLOCKED = 1937;
3409
2274/// Logon Failure: EAS policy requires that the user change their password before this operation can be performed.3410/// Logon Failure: EAS policy requires that the user change their password before this operation can be performed.
2275pub const PASSWORD_CHANGE_REQUIRED = 1938;3411pub const PASSWORD_CHANGE_REQUIRED = 1938;
3412
2276/// The pixel format is invalid.3413/// The pixel format is invalid.
2277pub const INVALID_PIXEL_FORMAT = 2000;3414pub const INVALID_PIXEL_FORMAT = 2000;
3415
2278/// The specified driver is invalid.3416/// The specified driver is invalid.
2279pub const BAD_DRIVER = 2001;3417pub const BAD_DRIVER = 2001;
3418
2280/// The window style or class attribute is invalid for this operation.3419/// The window style or class attribute is invalid for this operation.
2281pub const INVALID_WINDOW_STYLE = 2002;3420pub const INVALID_WINDOW_STYLE = 2002;
3421
2282/// The requested metafile operation is not supported.3422/// The requested metafile operation is not supported.
2283pub const METAFILE_NOT_SUPPORTED = 2003;3423pub const METAFILE_NOT_SUPPORTED = 2003;
3424
2284/// The requested transformation operation is not supported.3425/// The requested transformation operation is not supported.
2285pub const TRANSFORM_NOT_SUPPORTED = 2004;3426pub const TRANSFORM_NOT_SUPPORTED = 2004;
3427
2286/// The requested clipping operation is not supported.3428/// The requested clipping operation is not supported.
2287pub const CLIPPING_NOT_SUPPORTED = 2005;3429pub const CLIPPING_NOT_SUPPORTED = 2005;
3430
2288/// The specified color management module is invalid.3431/// The specified color management module is invalid.
2289pub const INVALID_CMM = 2010;3432pub const INVALID_CMM = 2010;
3433
2290/// The specified color profile is invalid.3434/// The specified color profile is invalid.
2291pub const INVALID_PROFILE = 2011;3435pub const INVALID_PROFILE = 2011;
3436
2292/// The specified tag was not found.3437/// The specified tag was not found.
2293pub const TAG_NOT_FOUND = 2012;3438pub const TAG_NOT_FOUND = 2012;
3439
2294/// A required tag is not present.3440/// A required tag is not present.
2295pub const TAG_NOT_PRESENT = 2013;3441pub const TAG_NOT_PRESENT = 2013;
3442
2296/// The specified tag is already present.3443/// The specified tag is already present.
2297pub const DUPLICATE_TAG = 2014;3444pub const DUPLICATE_TAG = 2014;
3445
2298/// The specified color profile is not associated with the specified device.3446/// The specified color profile is not associated with the specified device.
2299pub const PROFILE_NOT_ASSOCIATED_WITH_DEVICE = 2015;3447pub const PROFILE_NOT_ASSOCIATED_WITH_DEVICE = 2015;
3448
2300/// The specified color profile was not found.3449/// The specified color profile was not found.
2301pub const PROFILE_NOT_FOUND = 2016;3450pub const PROFILE_NOT_FOUND = 2016;
3451
2302/// The specified color space is invalid.3452/// The specified color space is invalid.
2303pub const INVALID_COLORSPACE = 2017;3453pub const INVALID_COLORSPACE = 2017;
3454
2304/// Image Color Management is not enabled.3455/// Image Color Management is not enabled.
2305pub const ICM_NOT_ENABLED = 2018;3456pub const ICM_NOT_ENABLED = 2018;
3457
2306/// There was an error while deleting the color transform.3458/// There was an error while deleting the color transform.
2307pub const DELETING_ICM_XFORM = 2019;3459pub const DELETING_ICM_XFORM = 2019;
3460
2308/// The specified color transform is invalid.3461/// The specified color transform is invalid.
2309pub const INVALID_TRANSFORM = 2020;3462pub const INVALID_TRANSFORM = 2020;
3463
2310/// The specified transform does not match the bitmap's color space.3464/// The specified transform does not match the bitmap's color space.
2311pub const COLORSPACE_MISMATCH = 2021;3465pub const COLORSPACE_MISMATCH = 2021;
3466
2312/// The specified named color index is not present in the profile.3467/// The specified named color index is not present in the profile.
2313pub const INVALID_COLORINDEX = 2022;3468pub const INVALID_COLORINDEX = 2022;
3469
2314/// The specified profile is intended for a device of a different type than the specified device.3470/// The specified profile is intended for a device of a different type than the specified device.
2315pub const PROFILE_DOES_NOT_MATCH_DEVICE = 2023;3471pub const PROFILE_DOES_NOT_MATCH_DEVICE = 2023;
3472
2316/// The network connection was made successfully, but the user had to be prompted for a password other than the one originally specified.3473/// The network connection was made successfully, but the user had to be prompted for a password other than the one originally specified.
2317pub const CONNECTED_OTHER_PASSWORD = 2108;3474pub const CONNECTED_OTHER_PASSWORD = 2108;
3475
2318/// The network connection was made successfully using default credentials.3476/// The network connection was made successfully using default credentials.
2319pub const CONNECTED_OTHER_PASSWORD_DEFAULT = 2109;3477pub const CONNECTED_OTHER_PASSWORD_DEFAULT = 2109;
3478
2320/// The specified username is invalid.3479/// The specified username is invalid.
2321pub const BAD_USERNAME = 2202;3480pub const BAD_USERNAME = 2202;
3481
2322/// This network connection does not exist.3482/// This network connection does not exist.
2323pub const NOT_CONNECTED = 2250;3483pub const NOT_CONNECTED = 2250;
3484
2324/// This network connection has files open or requests pending.3485/// This network connection has files open or requests pending.
2325pub const OPEN_FILES = 2401;3486pub const OPEN_FILES = 2401;
3487
2326/// Active connections still exist.3488/// Active connections still exist.
2327pub const ACTIVE_CONNECTIONS = 2402;3489pub const ACTIVE_CONNECTIONS = 2402;
3490
2328/// The device is in use by an active process and cannot be disconnected.3491/// The device is in use by an active process and cannot be disconnected.
2329pub const DEVICE_IN_USE = 2404;3492pub const DEVICE_IN_USE = 2404;
3493
2330/// The specified print monitor is unknown.3494/// The specified print monitor is unknown.
2331pub const UNKNOWN_PRINT_MONITOR = 3000;3495pub const UNKNOWN_PRINT_MONITOR = 3000;
3496
2332/// The specified printer driver is currently in use.3497/// The specified printer driver is currently in use.
2333pub const PRINTER_DRIVER_IN_USE = 3001;3498pub const PRINTER_DRIVER_IN_USE = 3001;
3499
2334/// The spool file was not found.3500/// The spool file was not found.
2335pub const SPOOL_FILE_NOT_FOUND = 3002;3501pub const SPOOL_FILE_NOT_FOUND = 3002;
3502
2336/// A StartDocPrinter call was not issued.3503/// A StartDocPrinter call was not issued.
2337pub const SPL_NO_STARTDOC = 3003;3504pub const SPL_NO_STARTDOC = 3003;
3505
2338/// An AddJob call was not issued.3506/// An AddJob call was not issued.
2339pub const SPL_NO_ADDJOB = 3004;3507pub const SPL_NO_ADDJOB = 3004;
3508
2340/// The specified print processor has already been installed.3509/// The specified print processor has already been installed.
2341pub const PRINT_PROCESSOR_ALREADY_INSTALLED = 3005;3510pub const PRINT_PROCESSOR_ALREADY_INSTALLED = 3005;
3511
2342/// The specified print monitor has already been installed.3512/// The specified print monitor has already been installed.
2343pub const PRINT_MONITOR_ALREADY_INSTALLED = 3006;3513pub const PRINT_MONITOR_ALREADY_INSTALLED = 3006;
3514
2344/// The specified print monitor does not have the required functions.3515/// The specified print monitor does not have the required functions.
2345pub const INVALID_PRINT_MONITOR = 3007;3516pub const INVALID_PRINT_MONITOR = 3007;
3517
2346/// The specified print monitor is currently in use.3518/// The specified print monitor is currently in use.
2347pub const PRINT_MONITOR_IN_USE = 3008;3519pub const PRINT_MONITOR_IN_USE = 3008;
3520
2348/// The requested operation is not allowed when there are jobs queued to the printer.3521/// The requested operation is not allowed when there are jobs queued to the printer.
2349pub const PRINTER_HAS_JOBS_QUEUED = 3009;3522pub const PRINTER_HAS_JOBS_QUEUED = 3009;
3523
2350/// The requested operation is successful. Changes will not be effective until the system is rebooted.3524/// The requested operation is successful. Changes will not be effective until the system is rebooted.
2351pub const SUCCESS_REBOOT_REQUIRED = 3010;3525pub const SUCCESS_REBOOT_REQUIRED = 3010;
3526
2352/// The requested operation is successful. Changes will not be effective until the service is restarted.3527/// The requested operation is successful. Changes will not be effective until the service is restarted.
2353pub const SUCCESS_RESTART_REQUIRED = 3011;3528pub const SUCCESS_RESTART_REQUIRED = 3011;
3529
2354/// No printers were found.3530/// No printers were found.
2355pub const PRINTER_NOT_FOUND = 3012;3531pub const PRINTER_NOT_FOUND = 3012;
3532
2356/// The printer driver is known to be unreliable.3533/// The printer driver is known to be unreliable.
2357pub const PRINTER_DRIVER_WARNED = 3013;3534pub const PRINTER_DRIVER_WARNED = 3013;
3535
2358/// The printer driver is known to harm the system.3536/// The printer driver is known to harm the system.
2359pub const PRINTER_DRIVER_BLOCKED = 3014;3537pub const PRINTER_DRIVER_BLOCKED = 3014;
3538
2360/// The specified printer driver package is currently in use.3539/// The specified printer driver package is currently in use.
2361pub const PRINTER_DRIVER_PACKAGE_IN_USE = 3015;3540pub const PRINTER_DRIVER_PACKAGE_IN_USE = 3015;
3541
2362/// Unable to find a core driver package that is required by the printer driver package.3542/// Unable to find a core driver package that is required by the printer driver package.
2363pub const CORE_DRIVER_PACKAGE_NOT_FOUND = 3016;3543pub const CORE_DRIVER_PACKAGE_NOT_FOUND = 3016;
3544
2364/// The requested operation failed. A system reboot is required to roll back changes made.3545/// The requested operation failed. A system reboot is required to roll back changes made.
2365pub const FAIL_REBOOT_REQUIRED = 3017;3546pub const FAIL_REBOOT_REQUIRED = 3017;
3547
2366/// The requested operation failed. A system reboot has been initiated to roll back changes made.3548/// The requested operation failed. A system reboot has been initiated to roll back changes made.
2367pub const FAIL_REBOOT_INITIATED = 3018;3549pub const FAIL_REBOOT_INITIATED = 3018;
3550
2368/// The specified printer driver was not found on the system and needs to be downloaded.3551/// The specified printer driver was not found on the system and needs to be downloaded.
2369pub const PRINTER_DRIVER_DOWNLOAD_NEEDED = 3019;3552pub const PRINTER_DRIVER_DOWNLOAD_NEEDED = 3019;
3553
2370/// The requested print job has failed to print. A print system update requires the job to be resubmitted.3554/// The requested print job has failed to print. A print system update requires the job to be resubmitted.
2371pub const PRINT_JOB_RESTART_REQUIRED = 3020;3555pub const PRINT_JOB_RESTART_REQUIRED = 3020;
3556
2372/// The printer driver does not contain a valid manifest, or contains too many manifests.3557/// The printer driver does not contain a valid manifest, or contains too many manifests.
2373pub const INVALID_PRINTER_DRIVER_MANIFEST = 3021;3558pub const INVALID_PRINTER_DRIVER_MANIFEST = 3021;
3559
2374/// The specified printer cannot be shared.3560/// The specified printer cannot be shared.
2375pub const PRINTER_NOT_SHAREABLE = 3022;3561pub const PRINTER_NOT_SHAREABLE = 3022;
3562
2376/// The operation was paused.3563/// The operation was paused.
2377pub const REQUEST_PAUSED = 3050;3564pub const REQUEST_PAUSED = 3050;
3565
2378/// Reissue the given operation as a cached IO operation.3566/// Reissue the given operation as a cached IO operation.
2379pub const IO_REISSUE_AS_CACHED = 3950;3567pub const IO_REISSUE_AS_CACHED = 3950;
std/os/windows/index.zig+113-65
...@@ -1,33 +1,59 @@...@@ -1,33 +1,59 @@
1pub const ERROR = @import("error.zig");1pub const ERROR = @import("error.zig");
22
3pub extern "advapi32" stdcallcc fn CryptAcquireContextA(phProv: &HCRYPTPROV, pszContainer: ?LPCSTR,3pub extern "advapi32" stdcallcc fn CryptAcquireContextA(
4 pszProvider: ?LPCSTR, dwProvType: DWORD, dwFlags: DWORD) BOOL;4 phProv: &HCRYPTPROV,
5 pszContainer: ?LPCSTR,
6 pszProvider: ?LPCSTR,
7 dwProvType: DWORD,
8 dwFlags: DWORD,
9) BOOL;
510
6pub extern "advapi32" stdcallcc fn CryptReleaseContext(hProv: HCRYPTPROV, dwFlags: DWORD) BOOL;11pub extern "advapi32" stdcallcc fn CryptReleaseContext(hProv: HCRYPTPROV, dwFlags: DWORD) BOOL;
712
8pub extern "advapi32" stdcallcc fn CryptGenRandom(hProv: HCRYPTPROV, dwLen: DWORD, pbBuffer: &BYTE) BOOL;13pub extern "advapi32" stdcallcc fn CryptGenRandom(hProv: HCRYPTPROV, dwLen: DWORD, pbBuffer: &BYTE) BOOL;
914
10
11pub extern "kernel32" stdcallcc fn CloseHandle(hObject: HANDLE) BOOL;15pub extern "kernel32" stdcallcc fn CloseHandle(hObject: HANDLE) BOOL;
1216
13pub extern "kernel32" stdcallcc fn CreateDirectoryA(lpPathName: LPCSTR,17pub extern "kernel32" stdcallcc fn CreateDirectoryA(
14 lpSecurityAttributes: ?&SECURITY_ATTRIBUTES) BOOL;18 lpPathName: LPCSTR,
1519 lpSecurityAttributes: ?&SECURITY_ATTRIBUTES,
16pub extern "kernel32" stdcallcc fn CreateFileA(lpFileName: LPCSTR, dwDesiredAccess: DWORD,20) BOOL;
17 dwShareMode: DWORD, lpSecurityAttributes: ?LPSECURITY_ATTRIBUTES, dwCreationDisposition: DWORD,21
18 dwFlagsAndAttributes: DWORD, hTemplateFile: ?HANDLE) HANDLE;22pub extern "kernel32" stdcallcc fn CreateFileA(
1923 lpFileName: LPCSTR,
20pub extern "kernel32" stdcallcc fn CreatePipe(hReadPipe: &HANDLE, hWritePipe: &HANDLE,24 dwDesiredAccess: DWORD,
21 lpPipeAttributes: &const SECURITY_ATTRIBUTES, nSize: DWORD) BOOL;25 dwShareMode: DWORD,
2226 lpSecurityAttributes: ?LPSECURITY_ATTRIBUTES,
23pub extern "kernel32" stdcallcc fn CreateProcessA(lpApplicationName: ?LPCSTR, lpCommandLine: LPSTR,27 dwCreationDisposition: DWORD,
24 lpProcessAttributes: ?&SECURITY_ATTRIBUTES, lpThreadAttributes: ?&SECURITY_ATTRIBUTES, bInheritHandles: BOOL,28 dwFlagsAndAttributes: DWORD,
25 dwCreationFlags: DWORD, lpEnvironment: ?&c_void, lpCurrentDirectory: ?LPCSTR, lpStartupInfo: &STARTUPINFOA,29 hTemplateFile: ?HANDLE,
26 lpProcessInformation: &PROCESS_INFORMATION) BOOL;30) HANDLE;
2731
28pub extern "kernel32" stdcallcc fn CreateSymbolicLinkA(lpSymlinkFileName: LPCSTR, lpTargetFileName: LPCSTR,32pub extern "kernel32" stdcallcc fn CreatePipe(
29 dwFlags: DWORD) BOOLEAN;33 hReadPipe: &HANDLE,
3034 hWritePipe: &HANDLE,
35 lpPipeAttributes: &const SECURITY_ATTRIBUTES,
36 nSize: DWORD,
37) BOOL;
38
39pub extern "kernel32" stdcallcc fn CreateProcessA(
40 lpApplicationName: ?LPCSTR,
41 lpCommandLine: LPSTR,
42 lpProcessAttributes: ?&SECURITY_ATTRIBUTES,
43 lpThreadAttributes: ?&SECURITY_ATTRIBUTES,
44 bInheritHandles: BOOL,
45 dwCreationFlags: DWORD,
46 lpEnvironment: ?&c_void,
47 lpCurrentDirectory: ?LPCSTR,
48 lpStartupInfo: &STARTUPINFOA,
49 lpProcessInformation: &PROCESS_INFORMATION,
50) BOOL;
51
52pub extern "kernel32" stdcallcc fn CreateSymbolicLinkA(
53 lpSymlinkFileName: LPCSTR,
54 lpTargetFileName: LPCSTR,
55 dwFlags: DWORD,
56) BOOLEAN;
3157
32pub extern "kernel32" stdcallcc fn CreateThread(lpThreadAttributes: ?LPSECURITY_ATTRIBUTES, dwStackSize: SIZE_T, lpStartAddress: LPTHREAD_START_ROUTINE, lpParameter: ?LPVOID, dwCreationFlags: DWORD, lpThreadId: ?LPDWORD) ?HANDLE;58pub extern "kernel32" stdcallcc fn CreateThread(lpThreadAttributes: ?LPSECURITY_ATTRIBUTES, dwStackSize: SIZE_T, lpStartAddress: LPTHREAD_START_ROUTINE, lpParameter: ?LPVOID, dwCreationFlags: DWORD, lpThreadId: ?LPDWORD) ?HANDLE;
3359
...@@ -55,12 +81,19 @@ pub extern "kernel32" stdcallcc fn GetModuleFileNameA(hModule: ?HMODULE, lpFilen...@@ -55,12 +81,19 @@ pub extern "kernel32" stdcallcc fn GetModuleFileNameA(hModule: ?HMODULE, lpFilen
5581
56pub extern "kernel32" stdcallcc fn GetLastError() DWORD;82pub extern "kernel32" stdcallcc fn GetLastError() DWORD;
5783
58pub extern "kernel32" stdcallcc fn GetFileInformationByHandleEx(in_hFile: HANDLE,84pub extern "kernel32" stdcallcc fn GetFileInformationByHandleEx(
59 in_FileInformationClass: FILE_INFO_BY_HANDLE_CLASS, out_lpFileInformation: &c_void,85 in_hFile: HANDLE,
60 in_dwBufferSize: DWORD) BOOL;86 in_FileInformationClass: FILE_INFO_BY_HANDLE_CLASS,
6187 out_lpFileInformation: &c_void,
62pub extern "kernel32" stdcallcc fn GetFinalPathNameByHandleA(hFile: HANDLE, lpszFilePath: LPSTR,88 in_dwBufferSize: DWORD,
63 cchFilePath: DWORD, dwFlags: DWORD) DWORD;89) BOOL;
90
91pub extern "kernel32" stdcallcc fn GetFinalPathNameByHandleA(
92 hFile: HANDLE,
93 lpszFilePath: LPSTR,
94 cchFilePath: DWORD,
95 dwFlags: DWORD,
96) DWORD;
6497
65pub extern "kernel32" stdcallcc fn GetProcessHeap() ?HANDLE;98pub extern "kernel32" stdcallcc fn GetProcessHeap() ?HANDLE;
6699
...@@ -80,21 +113,32 @@ pub extern "kernel32" stdcallcc fn HeapAlloc(hHeap: HANDLE, dwFlags: DWORD, dwBy...@@ -80,21 +113,32 @@ pub extern "kernel32" stdcallcc fn HeapAlloc(hHeap: HANDLE, dwFlags: DWORD, dwBy
80113
81pub extern "kernel32" stdcallcc fn HeapFree(hHeap: HANDLE, dwFlags: DWORD, lpMem: &c_void) BOOL;114pub extern "kernel32" stdcallcc fn HeapFree(hHeap: HANDLE, dwFlags: DWORD, lpMem: &c_void) BOOL;
82115
83pub extern "kernel32" stdcallcc fn MoveFileExA(lpExistingFileName: LPCSTR, lpNewFileName: LPCSTR,116pub extern "kernel32" stdcallcc fn MoveFileExA(
84 dwFlags: DWORD) BOOL;117 lpExistingFileName: LPCSTR,
85 118 lpNewFileName: LPCSTR,
119 dwFlags: DWORD,
120) BOOL;
121
86pub extern "kernel32" stdcallcc fn QueryPerformanceCounter(lpPerformanceCount: &LARGE_INTEGER) BOOL;122pub extern "kernel32" stdcallcc fn QueryPerformanceCounter(lpPerformanceCount: &LARGE_INTEGER) BOOL;
87123
88pub extern "kernel32" stdcallcc fn QueryPerformanceFrequency(lpFrequency: &LARGE_INTEGER) BOOL;124pub extern "kernel32" stdcallcc fn QueryPerformanceFrequency(lpFrequency: &LARGE_INTEGER) BOOL;
89125
90pub extern "kernel32" stdcallcc fn PathFileExists(pszPath: ?LPCTSTR) BOOL;126pub extern "kernel32" stdcallcc fn PathFileExists(pszPath: ?LPCTSTR) BOOL;
91127
92pub extern "kernel32" stdcallcc fn ReadFile(in_hFile: HANDLE, out_lpBuffer: &c_void,128pub extern "kernel32" stdcallcc fn ReadFile(
93 in_nNumberOfBytesToRead: DWORD, out_lpNumberOfBytesRead: &DWORD,129 in_hFile: HANDLE,
94 in_out_lpOverlapped: ?&OVERLAPPED) BOOL;130 out_lpBuffer: &c_void,
95131 in_nNumberOfBytesToRead: DWORD,
96pub extern "kernel32" stdcallcc fn SetFilePointerEx(in_fFile: HANDLE, in_liDistanceToMove: LARGE_INTEGER, 132 out_lpNumberOfBytesRead: &DWORD,
97 out_opt_ldNewFilePointer: ?&LARGE_INTEGER, in_dwMoveMethod: DWORD) BOOL;133 in_out_lpOverlapped: ?&OVERLAPPED,
134) BOOL;
135
136pub extern "kernel32" stdcallcc fn SetFilePointerEx(
137 in_fFile: HANDLE,
138 in_liDistanceToMove: LARGE_INTEGER,
139 out_opt_ldNewFilePointer: ?&LARGE_INTEGER,
140 in_dwMoveMethod: DWORD,
141) BOOL;
98142
99pub extern "kernel32" stdcallcc fn SetHandleInformation(hObject: HANDLE, dwMask: DWORD, dwFlags: DWORD) BOOL;143pub extern "kernel32" stdcallcc fn SetHandleInformation(hObject: HANDLE, dwMask: DWORD, dwFlags: DWORD) BOOL;
100144
...@@ -104,14 +148,18 @@ pub extern "kernel32" stdcallcc fn TerminateProcess(hProcess: HANDLE, uExitCode:...@@ -104,14 +148,18 @@ pub extern "kernel32" stdcallcc fn TerminateProcess(hProcess: HANDLE, uExitCode:
104148
105pub extern "kernel32" stdcallcc fn WaitForSingleObject(hHandle: HANDLE, dwMilliseconds: DWORD) DWORD;149pub extern "kernel32" stdcallcc fn WaitForSingleObject(hHandle: HANDLE, dwMilliseconds: DWORD) DWORD;
106150
107pub extern "kernel32" stdcallcc fn WriteFile(in_hFile: HANDLE, in_lpBuffer: &const c_void,151pub extern "kernel32" stdcallcc fn WriteFile(
108 in_nNumberOfBytesToWrite: DWORD, out_lpNumberOfBytesWritten: ?&DWORD,152 in_hFile: HANDLE,
109 in_out_lpOverlapped: ?&OVERLAPPED) BOOL;153 in_lpBuffer: &const c_void,
154 in_nNumberOfBytesToWrite: DWORD,
155 out_lpNumberOfBytesWritten: ?&DWORD,
156 in_out_lpOverlapped: ?&OVERLAPPED,
157) BOOL;
110158
111//TODO: call unicode versions instead of relying on ANSI code page159//TODO: call unicode versions instead of relying on ANSI code page
112pub extern "kernel32" stdcallcc fn LoadLibraryA(lpLibFileName: LPCSTR) ?HMODULE;160pub extern "kernel32" stdcallcc fn LoadLibraryA(lpLibFileName: LPCSTR) ?HMODULE;
113161
114pub extern "kernel32" stdcallcc fn FreeLibrary(hModule: HMODULE) BOOL; 162pub extern "kernel32" stdcallcc fn FreeLibrary(hModule: HMODULE) BOOL;
115163
116pub extern "user32" stdcallcc fn MessageBoxA(hWnd: ?HANDLE, lpText: ?LPCTSTR, lpCaption: ?LPCTSTR, uType: UINT) c_int;164pub extern "user32" stdcallcc fn MessageBoxA(hWnd: ?HANDLE, lpText: ?LPCTSTR, lpCaption: ?LPCTSTR, uType: UINT) c_int;
117165
...@@ -176,49 +224,51 @@ pub const MAX_PATH = 260;...@@ -176,49 +224,51 @@ pub const MAX_PATH = 260;
176224
177// TODO issue #305225// TODO issue #305
178pub const FILE_INFO_BY_HANDLE_CLASS = u32;226pub const FILE_INFO_BY_HANDLE_CLASS = u32;
179pub const FileBasicInfo = 0;227pub const FileBasicInfo = 0;
180pub const FileStandardInfo = 1;228pub const FileStandardInfo = 1;
181pub const FileNameInfo = 2;229pub const FileNameInfo = 2;
182pub const FileRenameInfo = 3;230pub const FileRenameInfo = 3;
183pub const FileDispositionInfo = 4;231pub const FileDispositionInfo = 4;
184pub const FileAllocationInfo = 5;232pub const FileAllocationInfo = 5;
185pub const FileEndOfFileInfo = 6;233pub const FileEndOfFileInfo = 6;
186pub const FileStreamInfo = 7;234pub const FileStreamInfo = 7;
187pub const FileCompressionInfo = 8;235pub const FileCompressionInfo = 8;
188pub const FileAttributeTagInfo = 9;236pub const FileAttributeTagInfo = 9;
189pub const FileIdBothDirectoryInfo = 10;237pub const FileIdBothDirectoryInfo = 10;
190pub const FileIdBothDirectoryRestartInfo = 11;238pub const FileIdBothDirectoryRestartInfo = 11;
191pub const FileIoPriorityHintInfo = 12;239pub const FileIoPriorityHintInfo = 12;
192pub const FileRemoteProtocolInfo = 13;240pub const FileRemoteProtocolInfo = 13;
193pub const FileFullDirectoryInfo = 14;241pub const FileFullDirectoryInfo = 14;
194pub const FileFullDirectoryRestartInfo = 15;242pub const FileFullDirectoryRestartInfo = 15;
195pub const FileStorageInfo = 16;243pub const FileStorageInfo = 16;
196pub const FileAlignmentInfo = 17;244pub const FileAlignmentInfo = 17;
197pub const FileIdInfo = 18;245pub const FileIdInfo = 18;
198pub const FileIdExtdDirectoryInfo = 19;246pub const FileIdExtdDirectoryInfo = 19;
199pub const FileIdExtdDirectoryRestartInfo = 20;247pub const FileIdExtdDirectoryRestartInfo = 20;
200248
201pub const FILE_NAME_INFO = extern struct {249pub const FILE_NAME_INFO = extern struct {
202 FileNameLength: DWORD,250 FileNameLength: DWORD,
203 FileName: [1]WCHAR,251 FileName: [1]WCHAR,
204};252};
205253
206
207/// Return the normalized drive name. This is the default.254/// Return the normalized drive name. This is the default.
208pub const FILE_NAME_NORMALIZED = 0x0;255pub const FILE_NAME_NORMALIZED = 0x0;
256
209/// Return the opened file name (not normalized).257/// Return the opened file name (not normalized).
210pub const FILE_NAME_OPENED = 0x8;258pub const FILE_NAME_OPENED = 0x8;
211259
212/// Return the path with the drive letter. This is the default.260/// Return the path with the drive letter. This is the default.
213pub const VOLUME_NAME_DOS = 0x0;261pub const VOLUME_NAME_DOS = 0x0;
262
214/// Return the path with a volume GUID path instead of the drive name.263/// Return the path with a volume GUID path instead of the drive name.
215pub const VOLUME_NAME_GUID = 0x1;264pub const VOLUME_NAME_GUID = 0x1;
265
216/// Return the path with no drive information.266/// Return the path with no drive information.
217pub const VOLUME_NAME_NONE = 0x4;267pub const VOLUME_NAME_NONE = 0x4;
268
218/// Return the path with the volume device path.269/// Return the path with the volume device path.
219pub const VOLUME_NAME_NT = 0x2;270pub const VOLUME_NAME_NT = 0x2;
220271
221
222pub const SECURITY_ATTRIBUTES = extern struct {272pub const SECURITY_ATTRIBUTES = extern struct {
223 nLength: DWORD,273 nLength: DWORD,
224 lpSecurityDescriptor: ?&c_void,274 lpSecurityDescriptor: ?&c_void,
...@@ -227,7 +277,6 @@ pub const SECURITY_ATTRIBUTES = extern struct {...@@ -227,7 +277,6 @@ pub const SECURITY_ATTRIBUTES = extern struct {
227pub const PSECURITY_ATTRIBUTES = &SECURITY_ATTRIBUTES;277pub const PSECURITY_ATTRIBUTES = &SECURITY_ATTRIBUTES;
228pub const LPSECURITY_ATTRIBUTES = &SECURITY_ATTRIBUTES;278pub const LPSECURITY_ATTRIBUTES = &SECURITY_ATTRIBUTES;
229279
230
231pub const GENERIC_READ = 0x80000000;280pub const GENERIC_READ = 0x80000000;
232pub const GENERIC_WRITE = 0x40000000;281pub const GENERIC_WRITE = 0x40000000;
233pub const GENERIC_EXECUTE = 0x20000000;282pub const GENERIC_EXECUTE = 0x20000000;
...@@ -243,7 +292,6 @@ pub const OPEN_ALWAYS = 4;...@@ -243,7 +292,6 @@ pub const OPEN_ALWAYS = 4;
243pub const OPEN_EXISTING = 3;292pub const OPEN_EXISTING = 3;
244pub const TRUNCATE_EXISTING = 5;293pub const TRUNCATE_EXISTING = 5;
245294
246
247pub const FILE_ATTRIBUTE_ARCHIVE = 0x20;295pub const FILE_ATTRIBUTE_ARCHIVE = 0x20;
248pub const FILE_ATTRIBUTE_ENCRYPTED = 0x4000;296pub const FILE_ATTRIBUTE_ENCRYPTED = 0x4000;
249pub const FILE_ATTRIBUTE_HIDDEN = 0x2;297pub const FILE_ATTRIBUTE_HIDDEN = 0x2;
std/os/windows/util.zig+18-19
...@@ -7,7 +7,7 @@ const mem = std.mem;...@@ -7,7 +7,7 @@ const mem = std.mem;
7const BufMap = std.BufMap;7const BufMap = std.BufMap;
8const cstr = std.cstr;8const cstr = std.cstr;
99
10pub const WaitError = error {10pub const WaitError = error{
11 WaitAbandoned,11 WaitAbandoned,
12 WaitTimeOut,12 WaitTimeOut,
13 Unexpected,13 Unexpected,
...@@ -33,7 +33,7 @@ pub fn windowsClose(handle: windows.HANDLE) void {...@@ -33,7 +33,7 @@ pub fn windowsClose(handle: windows.HANDLE) void {
33 assert(windows.CloseHandle(handle) != 0);33 assert(windows.CloseHandle(handle) != 0);
34}34}
3535
36pub const WriteError = error {36pub const WriteError = error{
37 SystemResources,37 SystemResources,
38 OperationAborted,38 OperationAborted,
39 IoPending,39 IoPending,
...@@ -68,20 +68,18 @@ pub fn windowsIsCygwinPty(handle: windows.HANDLE) bool {...@@ -68,20 +68,18 @@ pub fn windowsIsCygwinPty(handle: windows.HANDLE) bool {
68 const size = @sizeOf(windows.FILE_NAME_INFO);68 const size = @sizeOf(windows.FILE_NAME_INFO);
69 var name_info_bytes align(@alignOf(windows.FILE_NAME_INFO)) = []u8{0} ** (size + windows.MAX_PATH);69 var name_info_bytes align(@alignOf(windows.FILE_NAME_INFO)) = []u8{0} ** (size + windows.MAX_PATH);
7070
71 if (windows.GetFileInformationByHandleEx(handle, windows.FileNameInfo,71 if (windows.GetFileInformationByHandleEx(handle, windows.FileNameInfo, @ptrCast(&c_void, &name_info_bytes[0]), u32(name_info_bytes.len)) == 0) {
72 @ptrCast(&c_void, &name_info_bytes[0]), u32(name_info_bytes.len)) == 0)
73 {
74 return true;72 return true;
75 }73 }
7674
77 const name_info = @ptrCast(&const windows.FILE_NAME_INFO, &name_info_bytes[0]);75 const name_info = @ptrCast(&const windows.FILE_NAME_INFO, &name_info_bytes[0]);
78 const name_bytes = name_info_bytes[size..size + usize(name_info.FileNameLength)];76 const name_bytes = name_info_bytes[size..size + usize(name_info.FileNameLength)];
79 const name_wide = ([]u16)(name_bytes);77 const name_wide = ([]u16)(name_bytes);
80 return mem.indexOf(u16, name_wide, []u16{'m','s','y','s','-'}) != null or78 return mem.indexOf(u16, name_wide, []u16{ 'm', 's', 'y', 's', '-' }) != null or
81 mem.indexOf(u16, name_wide, []u16{'-','p','t','y'}) != null;79 mem.indexOf(u16, name_wide, []u16{ '-', 'p', 't', 'y' }) != null;
82}80}
8381
84pub const OpenError = error {82pub const OpenError = error{
85 SharingViolation,83 SharingViolation,
86 PathAlreadyExists,84 PathAlreadyExists,
87 FileNotFound,85 FileNotFound,
...@@ -92,15 +90,18 @@ pub const OpenError = error {...@@ -92,15 +90,18 @@ pub const OpenError = error {
92};90};
9391
94/// `file_path` needs to be copied in memory to add a null terminating byte, hence the allocator.92/// `file_path` needs to be copied in memory to add a null terminating byte, hence the allocator.
95pub fn windowsOpen(allocator: &mem.Allocator, file_path: []const u8, desired_access: windows.DWORD, share_mode: windows.DWORD,93pub fn windowsOpen(
96 creation_disposition: windows.DWORD, flags_and_attrs: windows.DWORD)94 allocator: &mem.Allocator,
97 OpenError!windows.HANDLE95 file_path: []const u8,
98{96 desired_access: windows.DWORD,
97 share_mode: windows.DWORD,
98 creation_disposition: windows.DWORD,
99 flags_and_attrs: windows.DWORD,
100) OpenError!windows.HANDLE {
99 const path_with_null = try cstr.addNullByte(allocator, file_path);101 const path_with_null = try cstr.addNullByte(allocator, file_path);
100 defer allocator.free(path_with_null);102 defer allocator.free(path_with_null);
101103
102 const result = windows.CreateFileA(path_with_null.ptr, desired_access, share_mode, null, creation_disposition,104 const result = windows.CreateFileA(path_with_null.ptr, desired_access, share_mode, null, creation_disposition, flags_and_attrs, null);
103 flags_and_attrs, null);
104105
105 if (result == windows.INVALID_HANDLE_VALUE) {106 if (result == windows.INVALID_HANDLE_VALUE) {
106 const err = windows.GetLastError();107 const err = windows.GetLastError();
...@@ -156,18 +157,16 @@ pub fn windowsLoadDll(allocator: &mem.Allocator, dll_path: []const u8) !windows....@@ -156,18 +157,16 @@ pub fn windowsLoadDll(allocator: &mem.Allocator, dll_path: []const u8) !windows.
156}157}
157158
158pub fn windowsUnloadDll(hModule: windows.HMODULE) void {159pub fn windowsUnloadDll(hModule: windows.HMODULE) void {
159 assert(windows.FreeLibrary(hModule)!= 0);160 assert(windows.FreeLibrary(hModule) != 0);
160}161}
161162
162
163test "InvalidDll" {163test "InvalidDll" {
164 if (builtin.os != builtin.Os.windows) return;164 if (builtin.os != builtin.Os.windows) return;
165165
166 const DllName = "asdf.dll";166 const DllName = "asdf.dll";
167 const allocator = std.debug.global_allocator;167 const allocator = std.debug.global_allocator;
168 const handle = os.windowsLoadDll(allocator, DllName) catch |err| {168 const handle = os.windowsLoadDll(allocator, DllName) catch |err| {
169 assert(err == error.DllNotFound);169 assert(err == error.DllNotFound);
170 return;170 return;
171 };171 };
172}172}
173
std/os/zen.zig+76-62
...@@ -3,35 +3,35 @@...@@ -3,35 +3,35 @@
3//////////////////////////3//////////////////////////
44
5pub const Message = struct {5pub const Message = struct {
6 sender: MailboxId,6 sender: MailboxId,
7 receiver: MailboxId,7 receiver: MailboxId,
8 type: usize,8 type: usize,
9 payload: usize,9 payload: usize,
1010
11 pub fn from(mailbox_id: &const MailboxId) Message {11 pub fn from(mailbox_id: &const MailboxId) Message {
12 return Message {12 return Message{
13 .sender = MailboxId.Undefined,13 .sender = MailboxId.Undefined,
14 .receiver = *mailbox_id,14 .receiver = *mailbox_id,
15 .type = 0,15 .type = 0,
16 .payload = 0,16 .payload = 0,
17 };17 };
18 }18 }
1919
20 pub fn to(mailbox_id: &const MailboxId, msg_type: usize) Message {20 pub fn to(mailbox_id: &const MailboxId, msg_type: usize) Message {
21 return Message {21 return Message{
22 .sender = MailboxId.This,22 .sender = MailboxId.This,
23 .receiver = *mailbox_id,23 .receiver = *mailbox_id,
24 .type = msg_type,24 .type = msg_type,
25 .payload = 0,25 .payload = 0,
26 };26 };
27 }27 }
2828
29 pub fn withData(mailbox_id: &const MailboxId, msg_type: usize, payload: usize) Message {29 pub fn withData(mailbox_id: &const MailboxId, msg_type: usize, payload: usize) Message {
30 return Message {30 return Message{
31 .sender = MailboxId.This,31 .sender = MailboxId.This,
32 .receiver = *mailbox_id,32 .receiver = *mailbox_id,
33 .type = msg_type,33 .type = msg_type,
34 .payload = payload,34 .payload = payload,
35 };35 };
36 }36 }
37};37};
...@@ -40,27 +40,25 @@ pub const MailboxId = union(enum) {...@@ -40,27 +40,25 @@ pub const MailboxId = union(enum) {
40 Undefined,40 Undefined,
41 This,41 This,
42 Kernel,42 Kernel,
43 Port: u16,43 Port: u16,
44 Thread: u16,44 Thread: u16,
45};45};
4646
47
48//////////////////////////////////////47//////////////////////////////////////
49//// Ports reserved for servers ////48//// Ports reserved for servers ////
50//////////////////////////////////////49//////////////////////////////////////
5150
52pub const Server = struct {51pub const Server = struct {
53 pub const Keyboard = MailboxId { .Port = 0 };52 pub const Keyboard = MailboxId{ .Port = 0 };
54 pub const Terminal = MailboxId { .Port = 1 };53 pub const Terminal = MailboxId{ .Port = 1 };
55};54};
5655
57
58////////////////////////56////////////////////////
59//// POSIX things ////57//// POSIX things ////
60////////////////////////58////////////////////////
6159
62// Standard streams.60// Standard streams.
63pub const STDIN_FILENO = 0;61pub const STDIN_FILENO = 0;
64pub const STDOUT_FILENO = 1;62pub const STDOUT_FILENO = 1;
65pub const STDERR_FILENO = 2;63pub const STDERR_FILENO = 2;
6664
...@@ -101,26 +99,24 @@ pub fn write(fd: i32, buf: &const u8, count: usize) usize {...@@ -101,26 +99,24 @@ pub fn write(fd: i32, buf: &const u8, count: usize) usize {
101 return count;99 return count;
102}100}
103101
104
105///////////////////////////102///////////////////////////
106//// Syscall numbers ////103//// Syscall numbers ////
107///////////////////////////104///////////////////////////
108105
109pub const Syscall = enum(usize) {106pub const Syscall = enum(usize) {
110 exit = 0,107 exit = 0,
111 createPort = 1,108 createPort = 1,
112 send = 2,109 send = 2,
113 receive = 3,110 receive = 3,
114 subscribeIRQ = 4,111 subscribeIRQ = 4,
115 inb = 5,112 inb = 5,
116 map = 6,113 map = 6,
117 createThread = 7,114 createThread = 7,
118 createProcess = 8,115 createProcess = 8,
119 wait = 9,116 wait = 9,
120 portReady = 10,117 portReady = 10,
121};118};
122119
123
124////////////////////120////////////////////
125//// Syscalls ////121//// Syscalls ////
126////////////////////122////////////////////
...@@ -157,7 +153,7 @@ pub fn map(v_addr: usize, p_addr: usize, size: usize, writable: bool) bool {...@@ -157,7 +153,7 @@ pub fn map(v_addr: usize, p_addr: usize, size: usize, writable: bool) bool {
157 return syscall4(Syscall.map, v_addr, p_addr, size, usize(writable)) != 0;153 return syscall4(Syscall.map, v_addr, p_addr, size, usize(writable)) != 0;
158}154}
159155
160pub fn createThread(function: fn()void) u16 {156pub fn createThread(function: fn() void) u16 {
161 return u16(syscall1(Syscall.createThread, @ptrToInt(function)));157 return u16(syscall1(Syscall.createThread, @ptrToInt(function)));
162}158}
163159
...@@ -180,66 +176,84 @@ pub fn portReady(port: u16) bool {...@@ -180,66 +176,84 @@ pub fn portReady(port: u16) bool {
180inline fn syscall0(number: Syscall) usize {176inline fn syscall0(number: Syscall) usize {
181 return asm volatile ("int $0x80"177 return asm volatile ("int $0x80"
182 : [ret] "={eax}" (-> usize)178 : [ret] "={eax}" (-> usize)
183 : [number] "{eax}" (number));179 : [number] "{eax}" (number)
180 );
184}181}
185182
186inline fn syscall1(number: Syscall, arg1: usize) usize {183inline fn syscall1(number: Syscall, arg1: usize) usize {
187 return asm volatile ("int $0x80"184 return asm volatile ("int $0x80"
188 : [ret] "={eax}" (-> usize)185 : [ret] "={eax}" (-> usize)
189 : [number] "{eax}" (number),186 : [number] "{eax}" (number),
190 [arg1] "{ecx}" (arg1));187 [arg1] "{ecx}" (arg1)
188 );
191}189}
192190
193inline fn syscall2(number: Syscall, arg1: usize, arg2: usize) usize {191inline fn syscall2(number: Syscall, arg1: usize, arg2: usize) usize {
194 return asm volatile ("int $0x80"192 return asm volatile ("int $0x80"
195 : [ret] "={eax}" (-> usize)193 : [ret] "={eax}" (-> usize)
196 : [number] "{eax}" (number),194 : [number] "{eax}" (number),
197 [arg1] "{ecx}" (arg1),195 [arg1] "{ecx}" (arg1),
198 [arg2] "{edx}" (arg2));196 [arg2] "{edx}" (arg2)
197 );
199}198}
200199
201inline fn syscall3(number: Syscall, arg1: usize, arg2: usize, arg3: usize) usize {200inline fn syscall3(number: Syscall, arg1: usize, arg2: usize, arg3: usize) usize {
202 return asm volatile ("int $0x80"201 return asm volatile ("int $0x80"
203 : [ret] "={eax}" (-> usize)202 : [ret] "={eax}" (-> usize)
204 : [number] "{eax}" (number),203 : [number] "{eax}" (number),
205 [arg1] "{ecx}" (arg1),204 [arg1] "{ecx}" (arg1),
206 [arg2] "{edx}" (arg2),205 [arg2] "{edx}" (arg2),
207 [arg3] "{ebx}" (arg3));206 [arg3] "{ebx}" (arg3)
207 );
208}208}
209209
210inline fn syscall4(number: Syscall, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize {210inline fn syscall4(number: Syscall, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize {
211 return asm volatile ("int $0x80"211 return asm volatile ("int $0x80"
212 : [ret] "={eax}" (-> usize)212 : [ret] "={eax}" (-> usize)
213 : [number] "{eax}" (number),213 : [number] "{eax}" (number),
214 [arg1] "{ecx}" (arg1),214 [arg1] "{ecx}" (arg1),
215 [arg2] "{edx}" (arg2),215 [arg2] "{edx}" (arg2),
216 [arg3] "{ebx}" (arg3),216 [arg3] "{ebx}" (arg3),
217 [arg4] "{esi}" (arg4));217 [arg4] "{esi}" (arg4)
218 );
218}219}
219220
220inline fn syscall5(number: Syscall, arg1: usize, arg2: usize, arg3: usize,221inline fn syscall5(
221 arg4: usize, arg5: usize) usize222 number: Syscall,
222{223 arg1: usize,
224 arg2: usize,
225 arg3: usize,
226 arg4: usize,
227 arg5: usize,
228) usize {
223 return asm volatile ("int $0x80"229 return asm volatile ("int $0x80"
224 : [ret] "={eax}" (-> usize)230 : [ret] "={eax}" (-> usize)
225 : [number] "{eax}" (number),231 : [number] "{eax}" (number),
226 [arg1] "{ecx}" (arg1),232 [arg1] "{ecx}" (arg1),
227 [arg2] "{edx}" (arg2),233 [arg2] "{edx}" (arg2),
228 [arg3] "{ebx}" (arg3),234 [arg3] "{ebx}" (arg3),
229 [arg4] "{esi}" (arg4),235 [arg4] "{esi}" (arg4),
230 [arg5] "{edi}" (arg5));236 [arg5] "{edi}" (arg5)
237 );
231}238}
232239
233inline fn syscall6(number: Syscall, arg1: usize, arg2: usize, arg3: usize,240inline fn syscall6(
234 arg4: usize, arg5: usize, arg6: usize) usize241 number: Syscall,
235{242 arg1: usize,
243 arg2: usize,
244 arg3: usize,
245 arg4: usize,
246 arg5: usize,
247 arg6: usize,
248) usize {
236 return asm volatile ("int $0x80"249 return asm volatile ("int $0x80"
237 : [ret] "={eax}" (-> usize)250 : [ret] "={eax}" (-> usize)
238 : [number] "{eax}" (number),251 : [number] "{eax}" (number),
239 [arg1] "{ecx}" (arg1),252 [arg1] "{ecx}" (arg1),
240 [arg2] "{edx}" (arg2),253 [arg2] "{edx}" (arg2),
241 [arg3] "{ebx}" (arg3),254 [arg3] "{ebx}" (arg3),
242 [arg4] "{esi}" (arg4),255 [arg4] "{esi}" (arg4),
243 [arg5] "{edi}" (arg5),256 [arg5] "{edi}" (arg5),
244 [arg6] "{ebp}" (arg6));257 [arg6] "{ebp}" (arg6)
258 );
245}259}
std/rand/index.zig+54-38
...@@ -69,7 +69,7 @@ pub const Random = struct {...@@ -69,7 +69,7 @@ pub const Random = struct {
69 break :x start;69 break :x start;
70 } else x: {70 } else x: {
71 // Can't overflow because the range is over signed ints71 // Can't overflow because the range is over signed ints
72 break :x math.negateCast(value - end_uint) catch unreachable;72 break :x math.negateCast(value - end_uint) catch unreachable;
73 };73 };
74 return result;74 return result;
75 } else {75 } else {
...@@ -156,7 +156,7 @@ const SplitMix64 = struct {...@@ -156,7 +156,7 @@ const SplitMix64 = struct {
156 s: u64,156 s: u64,
157157
158 pub fn init(seed: u64) SplitMix64 {158 pub fn init(seed: u64) SplitMix64 {
159 return SplitMix64 { .s = seed };159 return SplitMix64{ .s = seed };
160 }160 }
161161
162 pub fn next(self: &SplitMix64) u64 {162 pub fn next(self: &SplitMix64) u64 {
...@@ -172,7 +172,7 @@ const SplitMix64 = struct {...@@ -172,7 +172,7 @@ const SplitMix64 = struct {
172test "splitmix64 sequence" {172test "splitmix64 sequence" {
173 var r = SplitMix64.init(0xaeecf86f7878dd75);173 var r = SplitMix64.init(0xaeecf86f7878dd75);
174174
175 const seq = []const u64 {175 const seq = []const u64{
176 0x5dbd39db0178eb44,176 0x5dbd39db0178eb44,
177 0xa9900fb66b397da3,177 0xa9900fb66b397da3,
178 0x5c1a28b1aeebcf5c,178 0x5c1a28b1aeebcf5c,
...@@ -198,8 +198,8 @@ pub const Pcg = struct {...@@ -198,8 +198,8 @@ pub const Pcg = struct {
198 i: u64,198 i: u64,
199199
200 pub fn init(init_s: u64) Pcg {200 pub fn init(init_s: u64) Pcg {
201 var pcg = Pcg {201 var pcg = Pcg{
202 .random = Random { .fillFn = fill },202 .random = Random{ .fillFn = fill },
203 .s = undefined,203 .s = undefined,
204 .i = undefined,204 .i = undefined,
205 };205 };
...@@ -265,7 +265,7 @@ test "pcg sequence" {...@@ -265,7 +265,7 @@ test "pcg sequence" {
265 const s1: u64 = 0x84e9c579ef59bbf7;265 const s1: u64 = 0x84e9c579ef59bbf7;
266 r.seedTwo(s0, s1);266 r.seedTwo(s0, s1);
267267
268 const seq = []const u32 {268 const seq = []const u32{
269 2881561918,269 2881561918,
270 3063928540,270 3063928540,
271 1199791034,271 1199791034,
...@@ -288,8 +288,8 @@ pub const Xoroshiro128 = struct {...@@ -288,8 +288,8 @@ pub const Xoroshiro128 = struct {
288 s: [2]u64,288 s: [2]u64,
289289
290 pub fn init(init_s: u64) Xoroshiro128 {290 pub fn init(init_s: u64) Xoroshiro128 {
291 var x = Xoroshiro128 {291 var x = Xoroshiro128{
292 .random = Random { .fillFn = fill },292 .random = Random{ .fillFn = fill },
293 .s = undefined,293 .s = undefined,
294 };294 };
295295
...@@ -314,9 +314,9 @@ pub const Xoroshiro128 = struct {...@@ -314,9 +314,9 @@ pub const Xoroshiro128 = struct {
314 var s0: u64 = 0;314 var s0: u64 = 0;
315 var s1: u64 = 0;315 var s1: u64 = 0;
316316
317 const table = []const u64 {317 const table = []const u64{
318 0xbeac0467eba5facb,318 0xbeac0467eba5facb,
319 0xd86b048b86aa9922319 0xd86b048b86aa9922,
320 };320 };
321321
322 inline for (table) |entry| {322 inline for (table) |entry| {
...@@ -374,7 +374,7 @@ test "xoroshiro sequence" {...@@ -374,7 +374,7 @@ test "xoroshiro sequence" {
374 r.s[0] = 0xaeecf86f7878dd75;374 r.s[0] = 0xaeecf86f7878dd75;
375 r.s[1] = 0x01cd153642e72622;375 r.s[1] = 0x01cd153642e72622;
376376
377 const seq1 = []const u64 {377 const seq1 = []const u64{
378 0xb0ba0da5bb600397,378 0xb0ba0da5bb600397,
379 0x18a08afde614dccc,379 0x18a08afde614dccc,
380 0xa2635b956a31b929,380 0xa2635b956a31b929,
...@@ -387,10 +387,9 @@ test "xoroshiro sequence" {...@@ -387,10 +387,9 @@ test "xoroshiro sequence" {
387 std.debug.assert(s == r.next());387 std.debug.assert(s == r.next());
388 }388 }
389389
390
391 r.jump();390 r.jump();
392391
393 const seq2 = []const u64 {392 const seq2 = []const u64{
394 0x95344a13556d3e22,393 0x95344a13556d3e22,
395 0xb4fb32dafa4d00df,394 0xb4fb32dafa4d00df,
396 0xb2011d9ccdcfe2dd,395 0xb2011d9ccdcfe2dd,
...@@ -421,8 +420,8 @@ pub const Isaac64 = struct {...@@ -421,8 +420,8 @@ pub const Isaac64 = struct {
421 i: usize,420 i: usize,
422421
423 pub fn init(init_s: u64) Isaac64 {422 pub fn init(init_s: u64) Isaac64 {
424 var isaac = Isaac64 {423 var isaac = Isaac64{
425 .random = Random { .fillFn = fill },424 .random = Random{ .fillFn = fill },
426 .r = undefined,425 .r = undefined,
427 .m = undefined,426 .m = undefined,
428 .a = undefined,427 .a = undefined,
...@@ -456,20 +455,20 @@ pub const Isaac64 = struct {...@@ -456,20 +455,20 @@ pub const Isaac64 = struct {
456 {455 {
457 var i: usize = 0;456 var i: usize = 0;
458 while (i < midpoint) : (i += 4) {457 while (i < midpoint) : (i += 4) {
459 self.step( ~(self.a ^ (self.a << 21)), i + 0, 0, midpoint);458 self.step(~(self.a ^ (self.a << 21)), i + 0, 0, midpoint);
460 self.step( self.a ^ (self.a >> 5) , i + 1, 0, midpoint);459 self.step(self.a ^ (self.a >> 5), i + 1, 0, midpoint);
461 self.step( self.a ^ (self.a << 12) , i + 2, 0, midpoint);460 self.step(self.a ^ (self.a << 12), i + 2, 0, midpoint);
462 self.step( self.a ^ (self.a >> 33) , i + 3, 0, midpoint);461 self.step(self.a ^ (self.a >> 33), i + 3, 0, midpoint);
463 }462 }
464 }463 }
465464
466 {465 {
467 var i: usize = 0;466 var i: usize = 0;
468 while (i < midpoint) : (i += 4) {467 while (i < midpoint) : (i += 4) {
469 self.step( ~(self.a ^ (self.a << 21)), i + 0, midpoint, 0);468 self.step(~(self.a ^ (self.a << 21)), i + 0, midpoint, 0);
470 self.step( self.a ^ (self.a >> 5) , i + 1, midpoint, 0);469 self.step(self.a ^ (self.a >> 5), i + 1, midpoint, 0);
471 self.step( self.a ^ (self.a << 12) , i + 2, midpoint, 0);470 self.step(self.a ^ (self.a << 12), i + 2, midpoint, 0);
472 self.step( self.a ^ (self.a >> 33) , i + 3, midpoint, 0);471 self.step(self.a ^ (self.a >> 33), i + 3, midpoint, 0);
473 }472 }
474 }473 }
475474
...@@ -493,7 +492,7 @@ pub const Isaac64 = struct {...@@ -493,7 +492,7 @@ pub const Isaac64 = struct {
493 self.m[0] = init_s;492 self.m[0] = init_s;
494493
495 // prescrambled golden ratio constants494 // prescrambled golden ratio constants
496 var a = []const u64 {495 var a = []const u64{
497 0x647c4677a2884b7c,496 0x647c4677a2884b7c,
498 0xb9f8b322c73ac862,497 0xb9f8b322c73ac862,
499 0x8c0ea5053d4712a0,498 0x8c0ea5053d4712a0,
...@@ -513,14 +512,30 @@ pub const Isaac64 = struct {...@@ -513,14 +512,30 @@ pub const Isaac64 = struct {
513 a[x1] +%= self.m[j + x1];512 a[x1] +%= self.m[j + x1];
514 }513 }
515514
516 a[0] -%= a[4]; a[5] ^= a[7] >> 9; a[7] +%= a[0];515 a[0] -%= a[4];
517 a[1] -%= a[5]; a[6] ^= a[0] << 9; a[0] +%= a[1];516 a[5] ^= a[7] >> 9;
518 a[2] -%= a[6]; a[7] ^= a[1] >> 23; a[1] +%= a[2];517 a[7] +%= a[0];
519 a[3] -%= a[7]; a[0] ^= a[2] << 15; a[2] +%= a[3];518 a[1] -%= a[5];
520 a[4] -%= a[0]; a[1] ^= a[3] >> 14; a[3] +%= a[4];519 a[6] ^= a[0] << 9;
521 a[5] -%= a[1]; a[2] ^= a[4] << 20; a[4] +%= a[5];520 a[0] +%= a[1];
522 a[6] -%= a[2]; a[3] ^= a[5] >> 17; a[5] +%= a[6];521 a[2] -%= a[6];
523 a[7] -%= a[3]; a[4] ^= a[6] << 14; a[6] +%= a[7];522 a[7] ^= a[1] >> 23;
523 a[1] +%= a[2];
524 a[3] -%= a[7];
525 a[0] ^= a[2] << 15;
526 a[2] +%= a[3];
527 a[4] -%= a[0];
528 a[1] ^= a[3] >> 14;
529 a[3] +%= a[4];
530 a[5] -%= a[1];
531 a[2] ^= a[4] << 20;
532 a[4] +%= a[5];
533 a[6] -%= a[2];
534 a[3] ^= a[5] >> 17;
535 a[5] +%= a[6];
536 a[7] -%= a[3];
537 a[4] ^= a[6] << 14;
538 a[6] +%= a[7];
524539
525 comptime var x2: usize = 0;540 comptime var x2: usize = 0;
526 inline while (x2 < 8) : (x2 += 1) {541 inline while (x2 < 8) : (x2 += 1) {
...@@ -533,7 +548,7 @@ pub const Isaac64 = struct {...@@ -533,7 +548,7 @@ pub const Isaac64 = struct {
533 self.a = 0;548 self.a = 0;
534 self.b = 0;549 self.b = 0;
535 self.c = 0;550 self.c = 0;
536 self.i = self.r.len; // trigger refill on first value551 self.i = self.r.len; // trigger refill on first value
537 }552 }
538553
539 fn fill(r: &Random, buf: []u8) void {554 fn fill(r: &Random, buf: []u8) void {
...@@ -567,7 +582,7 @@ test "isaac64 sequence" {...@@ -567,7 +582,7 @@ test "isaac64 sequence" {
567 var r = Isaac64.init(0);582 var r = Isaac64.init(0);
568583
569 // from reference implementation584 // from reference implementation
570 const seq = []const u64 {585 const seq = []const u64{
571 0xf67dfba498e4937c,586 0xf67dfba498e4937c,
572 0x84a5066a9204f380,587 0x84a5066a9204f380,
573 0xfee34bd5f5514dbb,588 0xfee34bd5f5514dbb,
...@@ -609,7 +624,7 @@ test "Random float" {...@@ -609,7 +624,7 @@ test "Random float" {
609624
610test "Random scalar" {625test "Random scalar" {
611 var prng = DefaultPrng.init(0);626 var prng = DefaultPrng.init(0);
612 const s = prng .random.scalar(u64);627 const s = prng.random.scalar(u64);
613}628}
614629
615test "Random bytes" {630test "Random bytes" {
...@@ -621,8 +636,8 @@ test "Random bytes" {...@@ -621,8 +636,8 @@ test "Random bytes" {
621test "Random shuffle" {636test "Random shuffle" {
622 var prng = DefaultPrng.init(0);637 var prng = DefaultPrng.init(0);
623638
624 var seq = []const u8 { 0, 1, 2, 3, 4 };639 var seq = []const u8{ 0, 1, 2, 3, 4 };
625 var seen = []bool {false} ** 5;640 var seen = []bool{false} ** 5;
626641
627 var i: usize = 0;642 var i: usize = 0;
628 while (i < 1000) : (i += 1) {643 while (i < 1000) : (i += 1) {
...@@ -639,7 +654,8 @@ test "Random shuffle" {...@@ -639,7 +654,8 @@ test "Random shuffle" {
639654
640fn sumArray(s: []const u8) u32 {655fn sumArray(s: []const u8) u32 {
641 var r: u32 = 0;656 var r: u32 = 0;
642 for (s) |e| r += e;657 for (s) |e|
658 r += e;
643 return r;659 return r;
644}660}
645661
std/rand/ziggurat.zig+23-7
...@@ -64,8 +64,14 @@ pub const ZigTable = struct {...@@ -64,8 +64,14 @@ pub const ZigTable = struct {
64};64};
6565
66// zigNorInit66// zigNorInit
67fn ZigTableGen(comptime is_symmetric: bool, comptime r: f64, comptime v: f64, comptime f: fn(f64) f64,67fn ZigTableGen(
68 comptime f_inv: fn(f64) f64, comptime zero_case: fn(&Random, f64) f64) ZigTable {68 comptime is_symmetric: bool,
69 comptime r: f64,
70 comptime v: f64,
71 comptime f: fn(f64) f64,
72 comptime f_inv: fn(f64) f64,
73 comptime zero_case: fn(&Random, f64) f64,
74) ZigTable {
69 var tables: ZigTable = undefined;75 var tables: ZigTable = undefined;
7076
71 tables.is_symmetric = is_symmetric;77 tables.is_symmetric = is_symmetric;
...@@ -98,8 +104,12 @@ pub const NormDist = blk: {...@@ -98,8 +104,12 @@ pub const NormDist = blk: {
98const norm_r = 3.6541528853610088;104const norm_r = 3.6541528853610088;
99const norm_v = 0.00492867323399;105const norm_v = 0.00492867323399;
100106
101fn norm_f(x: f64) f64 { return math.exp(-x * x / 2.0); }107fn norm_f(x: f64) f64 {
102fn norm_f_inv(y: f64) f64 { return math.sqrt(-2.0 * math.ln(y)); }108 return math.exp(-x * x / 2.0);
109}
110fn norm_f_inv(y: f64) f64 {
111 return math.sqrt(-2.0 * math.ln(y));
112}
103fn norm_zero_case(random: &Random, u: f64) f64 {113fn norm_zero_case(random: &Random, u: f64) f64 {
104 var x: f64 = 1;114 var x: f64 = 1;
105 var y: f64 = 0;115 var y: f64 = 0;
...@@ -133,9 +143,15 @@ pub const ExpDist = blk: {...@@ -133,9 +143,15 @@ pub const ExpDist = blk: {
133const exp_r = 7.69711747013104972;143const exp_r = 7.69711747013104972;
134const exp_v = 0.0039496598225815571993;144const exp_v = 0.0039496598225815571993;
135145
136fn exp_f(x: f64) f64 { return math.exp(-x); }146fn exp_f(x: f64) f64 {
137fn exp_f_inv(y: f64) f64 { return -math.ln(y); }147 return math.exp(-x);
138fn exp_zero_case(random: &Random, _: f64) f64 { return exp_r - math.ln(random.float(f64)); }148}
149fn exp_f_inv(y: f64) f64 {
150 return -math.ln(y);
151}
152fn exp_zero_case(random: &Random, _: f64) f64 {
153 return exp_r - math.ln(random.float(f64));
154}
139155
140test "ziggurant exp dist sanity" {156test "ziggurant exp dist sanity" {
141 var prng = std.rand.DefaultPrng.init(0);157 var prng = std.rand.DefaultPrng.init(0);
std/segmented_list.zig+3-3
...@@ -5,7 +5,7 @@ const Allocator = std.mem.Allocator;...@@ -5,7 +5,7 @@ const Allocator = std.mem.Allocator;
5// Imagine that `fn at(self: &Self, index: usize) &T` is a customer asking for a box5// Imagine that `fn at(self: &Self, index: usize) &T` is a customer asking for a box
6// from a warehouse, based on a flat array, boxes ordered from 0 to N - 1.6// from a warehouse, based on a flat array, boxes ordered from 0 to N - 1.
7// But the warehouse actually stores boxes in shelves of increasing powers of 2 sizes.7// But the warehouse actually stores boxes in shelves of increasing powers of 2 sizes.
8// So when the customer requests a box index, we have to translate it to shelf index 8// So when the customer requests a box index, we have to translate it to shelf index
9// and box index within that shelf. Illustration:9// and box index within that shelf. Illustration:
10//10//
11// customer indexes:11// customer indexes:
...@@ -37,14 +37,14 @@ const Allocator = std.mem.Allocator;...@@ -37,14 +37,14 @@ const Allocator = std.mem.Allocator;
37// Now we complicate it a little bit further by adding a preallocated shelf, which must be37// Now we complicate it a little bit further by adding a preallocated shelf, which must be
38// a power of 2:38// a power of 2:
39// prealloc=439// prealloc=4
40// 40//
41// customer indexes:41// customer indexes:
42// prealloc: 0 1 2 342// prealloc: 0 1 2 3
43// shelf 0: 4 5 6 7 8 9 10 1143// shelf 0: 4 5 6 7 8 9 10 11
44// shelf 1: 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 2744// shelf 1: 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
45// shelf 2: 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 5945// shelf 2: 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
46// ...46// ...
47// 47//
48// warehouse indexes:48// warehouse indexes:
49// prealloc: 0 1 2 349// prealloc: 0 1 2 3
50// shelf 0: 0 1 2 3 4 5 6 750// shelf 0: 0 1 2 3 4 5 6 7
std/sort.zig-1
...@@ -317,7 +317,6 @@ pub fn sort(comptime T: type, items: []T, lessThan: fn(lhs: &const T, rhs: &cons...@@ -317,7 +317,6 @@ pub fn sort(comptime T: type, items: []T, lessThan: fn(lhs: &const T, rhs: &cons
317 // 6. merge each A block with any B values that follow, using the cache or the second internal buffer317 // 6. merge each A block with any B values that follow, using the cache or the second internal buffer
318 // 7. sort the second internal buffer if it exists318 // 7. sort the second internal buffer if it exists
319 // 8. redistribute the two internal buffers back into the items319 // 8. redistribute the two internal buffers back into the items
320
321 var block_size: usize = math.sqrt(iterator.length());320 var block_size: usize = math.sqrt(iterator.length());
322 var buffer_size = iterator.length() / block_size + 1;321 var buffer_size = iterator.length() / block_size + 1;
323322
std/special/bootstrap.zig+6-2
...@@ -27,10 +27,14 @@ extern fn zen_start() noreturn {...@@ -27,10 +27,14 @@ extern fn zen_start() noreturn {
27nakedcc fn _start() noreturn {27nakedcc fn _start() noreturn {
28 switch (builtin.arch) {28 switch (builtin.arch) {
29 builtin.Arch.x86_64 => {29 builtin.Arch.x86_64 => {
30 argc_ptr = asm ("lea (%%rsp), %[argc]" : [argc] "=r" (-> &usize));30 argc_ptr = asm ("lea (%%rsp), %[argc]"
31 : [argc] "=r" (-> &usize)
32 );
31 },33 },
32 builtin.Arch.i386 => {34 builtin.Arch.i386 => {
33 argc_ptr = asm ("lea (%%esp), %[argc]" : [argc] "=r" (-> &usize));35 argc_ptr = asm ("lea (%%esp), %[argc]"
36 : [argc] "=r" (-> &usize)
37 );
34 },38 },
35 else => @compileError("unsupported arch"),39 else => @compileError("unsupported arch"),
36 }40 }
std/special/bootstrap_lib.zig+5-3
...@@ -7,8 +7,10 @@ comptime {...@@ -7,8 +7,10 @@ comptime {
7 @export("_DllMainCRTStartup", _DllMainCRTStartup, builtin.GlobalLinkage.Strong);7 @export("_DllMainCRTStartup", _DllMainCRTStartup, builtin.GlobalLinkage.Strong);
8}8}
99
10stdcallcc fn _DllMainCRTStartup(hinstDLL: std.os.windows.HINSTANCE, fdwReason: std.os.windows.DWORD,10stdcallcc fn _DllMainCRTStartup(
11 lpReserved: std.os.windows.LPVOID) std.os.windows.BOOL11 hinstDLL: std.os.windows.HINSTANCE,
12{12 fdwReason: std.os.windows.DWORD,
13 lpReserved: std.os.windows.LPVOID,
14) std.os.windows.BOOL {
13 return std.os.windows.TRUE;15 return std.os.windows.TRUE;
14}16}
std/special/build_runner.zig+2-4
...@@ -24,7 +24,6 @@ pub fn main() !void {...@@ -24,7 +24,6 @@ pub fn main() !void {
2424
25 const allocator = &arena.allocator;25 const allocator = &arena.allocator;
2626
27
28 // skip my own exe name27 // skip my own exe name
29 _ = arg_it.skip();28 _ = arg_it.skip();
3029
...@@ -175,8 +174,7 @@ fn usage(builder: &Builder, already_ran_build: bool, out_stream: var) !void {...@@ -175,8 +174,7 @@ fn usage(builder: &Builder, already_ran_build: bool, out_stream: var) !void {
175 try out_stream.print(" (none)\n");174 try out_stream.print(" (none)\n");
176 } else {175 } else {
177 for (builder.available_options_list.toSliceConst()) |option| {176 for (builder.available_options_list.toSliceConst()) |option| {
178 const name = try fmt.allocPrint(allocator,177 const name = try fmt.allocPrint(allocator, " -D{}=[{}]", option.name, Builder.typeIdName(option.type_id));
179 " -D{}=[{}]", option.name, Builder.typeIdName(option.type_id));
180 defer allocator.free(name);178 defer allocator.free(name);
181 try out_stream.print("{s24} {}\n", name, option.description);179 try out_stream.print("{s24} {}\n", name, option.description);
182 }180 }
...@@ -202,7 +200,7 @@ fn usageAndErr(builder: &Builder, already_ran_build: bool, out_stream: var) erro...@@ -202,7 +200,7 @@ fn usageAndErr(builder: &Builder, already_ran_build: bool, out_stream: var) erro
202 return error.InvalidArgs;200 return error.InvalidArgs;
203}201}
204202
205const UnwrapArgError = error {OutOfMemory};203const UnwrapArgError = error{OutOfMemory};
206204
207fn unwrapArg(arg: UnwrapArgError![]u8) UnwrapArgError![]u8 {205fn unwrapArg(arg: UnwrapArgError![]u8) UnwrapArgError![]u8 {
208 return arg catch |err| {206 return arg catch |err| {
std/special/builtin.zig+41-19
...@@ -56,7 +56,8 @@ export fn memmove(dest: ?&u8, src: ?&const u8, n: usize) ?&u8 {...@@ -56,7 +56,8 @@ export fn memmove(dest: ?&u8, src: ?&const u8, n: usize) ?&u8 {
56comptime {56comptime {
57 if (builtin.mode != builtin.Mode.ReleaseFast and57 if (builtin.mode != builtin.Mode.ReleaseFast and
58 builtin.mode != builtin.Mode.ReleaseSmall and58 builtin.mode != builtin.Mode.ReleaseSmall and
59 builtin.os != builtin.Os.windows) {59 builtin.os != builtin.Os.windows)
60 {
60 @export("__stack_chk_fail", __stack_chk_fail, builtin.GlobalLinkage.Strong);61 @export("__stack_chk_fail", __stack_chk_fail, builtin.GlobalLinkage.Strong);
61 }62 }
62 if (builtin.os == builtin.Os.linux and builtin.arch == builtin.Arch.x86_64) {63 if (builtin.os == builtin.Os.linux and builtin.arch == builtin.Arch.x86_64) {
...@@ -101,15 +102,27 @@ nakedcc fn clone() void {...@@ -101,15 +102,27 @@ nakedcc fn clone() void {
101102
102const math = @import("../math/index.zig");103const math = @import("../math/index.zig");
103104
104export fn fmodf(x: f32, y: f32) f32 { return generic_fmod(f32, x, y); }105export fn fmodf(x: f32, y: f32) f32 {
105export fn fmod(x: f64, y: f64) f64 { return generic_fmod(f64, x, y); }106 return generic_fmod(f32, x, y);
107}
108export fn fmod(x: f64, y: f64) f64 {
109 return generic_fmod(f64, x, y);
110}
106111
107// TODO add intrinsics for these (and probably the double version too)112// TODO add intrinsics for these (and probably the double version too)
108// and have the math stuff use the intrinsic. same as @mod and @rem113// and have the math stuff use the intrinsic. same as @mod and @rem
109export fn floorf(x: f32) f32 { return math.floor(x); }114export fn floorf(x: f32) f32 {
110export fn ceilf(x: f32) f32 { return math.ceil(x); }115 return math.floor(x);
111export fn floor(x: f64) f64 { return math.floor(x); }116}
112export fn ceil(x: f64) f64 { return math.ceil(x); }117export fn ceilf(x: f32) f32 {
118 return math.ceil(x);
119}
120export fn floor(x: f64) f64 {
121 return math.floor(x);
122}
123export fn ceil(x: f64) f64 {
124 return math.ceil(x);
125}
113126
114fn generic_fmod(comptime T: type, x: T, y: T) T {127fn generic_fmod(comptime T: type, x: T, y: T) T {
115 @setRuntimeSafety(false);128 @setRuntimeSafety(false);
...@@ -139,7 +152,10 @@ fn generic_fmod(comptime T: type, x: T, y: T) T {...@@ -139,7 +152,10 @@ fn generic_fmod(comptime T: type, x: T, y: T) T {
139 // normalize x and y152 // normalize x and y
140 if (ex == 0) {153 if (ex == 0) {
141 i = ux << exp_bits;154 i = ux << exp_bits;
142 while (i >> bits_minus_1 == 0) : (b: {ex -= 1; break :b i <<= 1;}) {}155 while (i >> bits_minus_1 == 0) : (b: {
156 ex -= 1;
157 i <<= 1;
158 }) {}
143 ux <<= log2uint(@bitCast(u32, -ex + 1));159 ux <<= log2uint(@bitCast(u32, -ex + 1));
144 } else {160 } else {
145 ux &= @maxValue(uint) >> exp_bits;161 ux &= @maxValue(uint) >> exp_bits;
...@@ -147,7 +163,10 @@ fn generic_fmod(comptime T: type, x: T, y: T) T {...@@ -147,7 +163,10 @@ fn generic_fmod(comptime T: type, x: T, y: T) T {
147 }163 }
148 if (ey == 0) {164 if (ey == 0) {
149 i = uy << exp_bits;165 i = uy << exp_bits;
150 while (i >> bits_minus_1 == 0) : (b: {ey -= 1; break :b i <<= 1;}) {}166 while (i >> bits_minus_1 == 0) : (b: {
167 ey -= 1;
168 i <<= 1;
169 }) {}
151 uy <<= log2uint(@bitCast(u32, -ey + 1));170 uy <<= log2uint(@bitCast(u32, -ey + 1));
152 } else {171 } else {
153 uy &= @maxValue(uint) >> exp_bits;172 uy &= @maxValue(uint) >> exp_bits;
...@@ -170,7 +189,10 @@ fn generic_fmod(comptime T: type, x: T, y: T) T {...@@ -170,7 +189,10 @@ fn generic_fmod(comptime T: type, x: T, y: T) T {
170 return 0 * x;189 return 0 * x;
171 ux = i;190 ux = i;
172 }191 }
173 while (ux >> digits == 0) : (b: {ux <<= 1; break :b ex -= 1;}) {}192 while (ux >> digits == 0) : (b: {
193 ux <<= 1;
194 ex -= 1;
195 }) {}
174196
175 // scale result up197 // scale result up
176 if (ex > 0) {198 if (ex > 0) {
...@@ -298,7 +320,7 @@ export fn sqrt(x: f64) f64 {...@@ -298,7 +320,7 @@ export fn sqrt(x: f64) f64 {
298320
299 // rounding direction321 // rounding direction
300 if (ix0 | ix1 != 0) {322 if (ix0 | ix1 != 0) {
301 var z = 1.0 - tiny; // raise inexact323 var z = 1.0 - tiny; // raise inexact
302 if (z >= 1.0) {324 if (z >= 1.0) {
303 z = 1.0 + tiny;325 z = 1.0 + tiny;
304 if (q1 == 0xFFFFFFFF) {326 if (q1 == 0xFFFFFFFF) {
...@@ -336,13 +358,13 @@ export fn sqrtf(x: f32) f32 {...@@ -336,13 +358,13 @@ export fn sqrtf(x: f32) f32 {
336 var ix: i32 = @bitCast(i32, x);358 var ix: i32 = @bitCast(i32, x);
337359
338 if ((ix & 0x7F800000) == 0x7F800000) {360 if ((ix & 0x7F800000) == 0x7F800000) {
339 return x * x + x; // sqrt(nan) = nan, sqrt(+inf) = +inf, sqrt(-inf) = snan361 return x * x + x; // sqrt(nan) = nan, sqrt(+inf) = +inf, sqrt(-inf) = snan
340 }362 }
341363
342 // zero364 // zero
343 if (ix <= 0) {365 if (ix <= 0) {
344 if (ix & ~sign == 0) {366 if (ix & ~sign == 0) {
345 return x; // sqrt (+-0) = +-0367 return x; // sqrt (+-0) = +-0
346 }368 }
347 if (ix < 0) {369 if (ix < 0) {
348 return math.snan(f32);370 return math.snan(f32);
...@@ -360,20 +382,20 @@ export fn sqrtf(x: f32) f32 {...@@ -360,20 +382,20 @@ export fn sqrtf(x: f32) f32 {
360 m -= i - 1;382 m -= i - 1;
361 }383 }
362384
363 m -= 127; // unbias exponent385 m -= 127; // unbias exponent
364 ix = (ix & 0x007FFFFF) | 0x00800000;386 ix = (ix & 0x007FFFFF) | 0x00800000;
365387
366 if (m & 1 != 0) { // odd m, double x to even388 if (m & 1 != 0) { // odd m, double x to even
367 ix += ix;389 ix += ix;
368 }390 }
369391
370 m >>= 1; // m = [m / 2]392 m >>= 1; // m = [m / 2]
371393
372 // sqrt(x) bit by bit394 // sqrt(x) bit by bit
373 ix += ix;395 ix += ix;
374 var q: i32 = 0; // q = sqrt(x)396 var q: i32 = 0; // q = sqrt(x)
375 var s: i32 = 0;397 var s: i32 = 0;
376 var r: i32 = 0x01000000; // r = moving bit right -> left398 var r: i32 = 0x01000000; // r = moving bit right -> left
377399
378 while (r != 0) {400 while (r != 0) {
379 const t = s + r;401 const t = s + r;
...@@ -388,7 +410,7 @@ export fn sqrtf(x: f32) f32 {...@@ -388,7 +410,7 @@ export fn sqrtf(x: f32) f32 {
388410
389 // floating add to find rounding direction411 // floating add to find rounding direction
390 if (ix != 0) {412 if (ix != 0) {
391 var z = 1.0 - tiny; // inexact413 var z = 1.0 - tiny; // inexact
392 if (z >= 1.0) {414 if (z >= 1.0) {
393 z = 1.0 + tiny;415 z = 1.0 + tiny;
394 if (z > 1.0) {416 if (z > 1.0) {
std/special/compiler_rt/comparetf2.zig+25-32
...@@ -38,25 +38,22 @@ pub extern fn __letf2(a: f128, b: f128) c_int {...@@ -38,25 +38,22 @@ pub extern fn __letf2(a: f128, b: f128) c_int {
3838
39 // If at least one of a and b is positive, we get the same result comparing39 // If at least one of a and b is positive, we get the same result comparing
40 // a and b as signed integers as we would with a floating-point compare.40 // a and b as signed integers as we would with a floating-point compare.
41 return if ((aInt & bInt) >= 0)41 return if ((aInt & bInt) >= 0) if (aInt < bInt)
42 if (aInt < bInt)42 LE_LESS
43 LE_LESS43 else if (aInt == bInt)
44 else if (aInt == bInt)44 LE_EQUAL
45 LE_EQUAL
46 else
47 LE_GREATER
48 else45 else
49 // Otherwise, both are negative, so we need to flip the sense of the46 LE_GREATER else
50 // comparison to get the correct result. (This assumes a twos- or ones-47 // Otherwise, both are negative, so we need to flip the sense of the
51 // complement integer representation; if integers are represented in a48 // comparison to get the correct result. (This assumes a twos- or ones-
52 // sign-magnitude representation, then this flip is incorrect).49 // complement integer representation; if integers are represented in a
53 if (aInt > bInt)50 // sign-magnitude representation, then this flip is incorrect).
54 LE_LESS51 if (aInt > bInt)
55 else if (aInt == bInt)52 LE_LESS
56 LE_EQUAL53 else if (aInt == bInt)
57 else54 LE_EQUAL
58 LE_GREATER55 else
59 ;56 LE_GREATER;
60}57}
6158
62// TODO https://github.com/ziglang/zig/issues/30559// TODO https://github.com/ziglang/zig/issues/305
...@@ -76,21 +73,17 @@ pub extern fn __getf2(a: f128, b: f128) c_int {...@@ -76,21 +73,17 @@ pub extern fn __getf2(a: f128, b: f128) c_int {
7673
77 if (aAbs > infRep or bAbs > infRep) return GE_UNORDERED;74 if (aAbs > infRep or bAbs > infRep) return GE_UNORDERED;
78 if ((aAbs | bAbs) == 0) return GE_EQUAL;75 if ((aAbs | bAbs) == 0) return GE_EQUAL;
79 return if ((aInt & bInt) >= 0)76 return if ((aInt & bInt) >= 0) if (aInt < bInt)
80 if (aInt < bInt)77 GE_LESS
81 GE_LESS78 else if (aInt == bInt)
82 else if (aInt == bInt)79 GE_EQUAL
83 GE_EQUAL80 else
84 else81 GE_GREATER else if (aInt > bInt)
85 GE_GREATER82 GE_LESS
83 else if (aInt == bInt)
84 GE_EQUAL
86 else85 else
87 if (aInt > bInt)86 GE_GREATER;
88 GE_LESS
89 else if (aInt == bInt)
90 GE_EQUAL
91 else
92 GE_GREATER
93 ;
94}87}
9588
96pub extern fn __unordtf2(a: f128, b: f128) c_int {89pub extern fn __unordtf2(a: f128, b: f128) c_int {
std/special/compiler_rt/fixunsdfti_test.zig-1
...@@ -44,4 +44,3 @@ test "fixunsdfti" {...@@ -44,4 +44,3 @@ test "fixunsdfti" {
44 test__fixunsdfti(-0x1.FFFFFFFFFFFFFp+62, 0);44 test__fixunsdfti(-0x1.FFFFFFFFFFFFFp+62, 0);
45 test__fixunsdfti(-0x1.FFFFFFFFFFFFEp+62, 0);45 test__fixunsdfti(-0x1.FFFFFFFFFFFFEp+62, 0);
46}46}
47
std/special/compiler_rt/index.zig+9-5
...@@ -92,10 +92,10 @@ pub fn setXmm0(comptime T: type, value: T) void {...@@ -92,10 +92,10 @@ pub fn setXmm0(comptime T: type, value: T) void {
92 const aligned_value: T align(16) = value;92 const aligned_value: T align(16) = value;
93 asm volatile (93 asm volatile (
94 \\movaps (%[ptr]), %%xmm094 \\movaps (%[ptr]), %%xmm0
95 95 :
96 :
97 : [ptr] "r" (&aligned_value)96 : [ptr] "r" (&aligned_value)
98 : "xmm0");97 : "xmm0"
98 );
99}99}
100100
101extern fn __udivdi3(a: u64, b: u64) u64 {101extern fn __udivdi3(a: u64, b: u64) u64 {
...@@ -159,7 +159,8 @@ fn isArmArch() bool {...@@ -159,7 +159,8 @@ fn isArmArch() bool {
159 builtin.Arch.armebv6t2,159 builtin.Arch.armebv6t2,
160 builtin.Arch.armebv5,160 builtin.Arch.armebv5,
161 builtin.Arch.armebv5te,161 builtin.Arch.armebv5te,
162 builtin.Arch.armebv4t => true,162 builtin.Arch.armebv4t,
163 => true,
163 else => false,164 else => false,
164 };165 };
165}166}
...@@ -174,7 +175,10 @@ nakedcc fn __aeabi_uidivmod() void {...@@ -174,7 +175,10 @@ nakedcc fn __aeabi_uidivmod() void {
174 \\ ldr r1, [sp]175 \\ ldr r1, [sp]
175 \\ add sp, sp, #4176 \\ add sp, sp, #4
176 \\ pop { pc }177 \\ pop { pc }
177 ::: "r2", "r1");178 :
179 :
180 : "r2", "r1"
181 );
178}182}
179183
180// _chkstk (_alloca) routine - probe stack between %esp and (%esp-%eax) in 4k increments,184// _chkstk (_alloca) routine - probe stack between %esp and (%esp-%eax) in 4k increments,
std/unicode.zig+13-9
...@@ -58,6 +58,7 @@ pub fn utf8Encode(c: u32, out: []u8) !u3 {...@@ -58,6 +58,7 @@ pub fn utf8Encode(c: u32, out: []u8) !u3 {
58}58}
5959
60const Utf8DecodeError = Utf8Decode2Error || Utf8Decode3Error || Utf8Decode4Error;60const Utf8DecodeError = Utf8Decode2Error || Utf8Decode3Error || Utf8Decode4Error;
61
61/// Decodes the UTF-8 codepoint encoded in the given slice of bytes.62/// Decodes the UTF-8 codepoint encoded in the given slice of bytes.
62/// bytes.len must be equal to utf8ByteSequenceLength(bytes[0]) catch unreachable.63/// bytes.len must be equal to utf8ByteSequenceLength(bytes[0]) catch unreachable.
63/// If you already know the length at comptime, you can call one of64/// If you already know the length at comptime, you can call one of
...@@ -150,7 +151,9 @@ pub fn utf8ValidateSlice(s: []const u8) bool {...@@ -150,7 +151,9 @@ pub fn utf8ValidateSlice(s: []const u8) bool {
150 return false;151 return false;
151 }152 }
152153
153 if (utf8Decode(s[i..i+cp_len])) |_| {} else |_| { return false; }154 if (utf8Decode(s[i..i + cp_len])) |_| {} else |_| {
155 return false;
156 }
154 i += cp_len;157 i += cp_len;
155 } else |err| {158 } else |err| {
156 return false;159 return false;
...@@ -179,9 +182,7 @@ pub const Utf8View = struct {...@@ -179,9 +182,7 @@ pub const Utf8View = struct {
179 }182 }
180183
181 pub fn initUnchecked(s: []const u8) Utf8View {184 pub fn initUnchecked(s: []const u8) Utf8View {
182 return Utf8View {185 return Utf8View{ .bytes = s };
183 .bytes = s,
184 };
185 }186 }
186187
187 pub fn initComptime(comptime s: []const u8) Utf8View {188 pub fn initComptime(comptime s: []const u8) Utf8View {
...@@ -191,12 +192,12 @@ pub const Utf8View = struct {...@@ -191,12 +192,12 @@ pub const Utf8View = struct {
191 error.InvalidUtf8 => {192 error.InvalidUtf8 => {
192 @compileError("invalid utf8");193 @compileError("invalid utf8");
193 unreachable;194 unreachable;
194 }195 },
195 }196 }
196 }197 }
197198
198 pub fn iterator(s: &const Utf8View) Utf8Iterator {199 pub fn iterator(s: &const Utf8View) Utf8Iterator {
199 return Utf8Iterator {200 return Utf8Iterator{
200 .bytes = s.bytes,201 .bytes = s.bytes,
201 .i = 0,202 .i = 0,
202 };203 };
...@@ -215,7 +216,7 @@ const Utf8Iterator = struct {...@@ -215,7 +216,7 @@ const Utf8Iterator = struct {
215 const cp_len = utf8ByteSequenceLength(it.bytes[it.i]) catch unreachable;216 const cp_len = utf8ByteSequenceLength(it.bytes[it.i]) catch unreachable;
216217
217 it.i += cp_len;218 it.i += cp_len;
218 return it.bytes[it.i-cp_len..it.i];219 return it.bytes[it.i - cp_len..it.i];
219 }220 }
220221
221 pub fn nextCodepoint(it: &Utf8Iterator) ?u32 {222 pub fn nextCodepoint(it: &Utf8Iterator) ?u32 {
...@@ -304,9 +305,12 @@ test "utf8 view bad" {...@@ -304,9 +305,12 @@ test "utf8 view bad" {
304fn testUtf8ViewBad() void {305fn testUtf8ViewBad() void {
305 // Compile-time error.306 // Compile-time error.
306 // const s3 = Utf8View.initComptime("\xfe\xf2");307 // const s3 = Utf8View.initComptime("\xfe\xf2");
307
308 const s = Utf8View.init("hel\xadlo");308 const s = Utf8View.init("hel\xadlo");
309 if (s) |_| { unreachable; } else |err| { debug.assert(err == error.InvalidUtf8); }309 if (s) |_| {
310 unreachable;
311 } else |err| {
312 debug.assert(err == error.InvalidUtf8);
313 }
310}314}
311315
312test "utf8 view ok" {316test "utf8 view ok" {
std/zig/ast.zig+5-4
...@@ -388,7 +388,8 @@ pub const Node = struct {...@@ -388,7 +388,8 @@ pub const Node = struct {
388 Id.SwitchElse,388 Id.SwitchElse,
389 Id.FieldInitializer,389 Id.FieldInitializer,
390 Id.DocComment,390 Id.DocComment,
391 Id.TestDecl => return false,391 Id.TestDecl,
392 => return false,
392 Id.While => {393 Id.While => {
393 const while_node = @fieldParentPtr(While, "base", n);394 const while_node = @fieldParentPtr(While, "base", n);
394 if (while_node.@"else") |@"else"| {395 if (while_node.@"else") |@"else"| {
...@@ -608,8 +609,7 @@ pub const Node = struct {...@@ -608,8 +609,7 @@ pub const Node = struct {
608 if (i < 1) return t;609 if (i < 1) return t;
609 i -= 1;610 i -= 1;
610 },611 },
611 InitArg.None,612 InitArg.None, InitArg.Enum => {},
612 InitArg.Enum => {},
613 }613 }
614614
615 if (i < self.fields_and_decls.len) return self.fields_and_decls.at(i).*;615 if (i < self.fields_and_decls.len) return self.fields_and_decls.at(i).*;
...@@ -1475,7 +1475,8 @@ pub const Node = struct {...@@ -1475,7 +1475,8 @@ pub const Node = struct {
1475 Op.Range,1475 Op.Range,
1476 Op.Sub,1476 Op.Sub,
1477 Op.SubWrap,1477 Op.SubWrap,
1478 Op.UnwrapMaybe => {},1478 Op.UnwrapMaybe,
1479 => {},
1479 }1480 }
14801481
1481 if (i < 1) return self.rhs;1482 if (i < 1) return self.rhs;
std/zig/parse.zig+526-401
...@@ -81,10 +81,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -81,10 +81,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
81 });81 });
82 try root_node.decls.push(&test_node.base);82 try root_node.decls.push(&test_node.base);
83 try stack.append(State{ .Block = block });83 try stack.append(State{ .Block = block });
84 try stack.append(State{ .ExpectTokenSave = ExpectTokenSave{84 try stack.append(State{
85 .id = Token.Id.LBrace,85 .ExpectTokenSave = ExpectTokenSave{
86 .ptr = &block.lbrace,86 .id = Token.Id.LBrace,
87 } });87 .ptr = &block.lbrace,
88 },
89 });
88 try stack.append(State{ .StringLiteral = OptionalCtx{ .Required = &test_node.name } });90 try stack.append(State{ .StringLiteral = OptionalCtx{ .Required = &test_node.name } });
89 continue;91 continue;
90 },92 },
...@@ -95,13 +97,15 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -95,13 +97,15 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
95 },97 },
96 Token.Id.Keyword_pub => {98 Token.Id.Keyword_pub => {
97 stack.append(State.TopLevel) catch unreachable;99 stack.append(State.TopLevel) catch unreachable;
98 try stack.append(State{ .TopLevelExtern = TopLevelDeclCtx{100 try stack.append(State{
99 .decls = &root_node.decls,101 .TopLevelExtern = TopLevelDeclCtx{
100 .visib_token = token_index,102 .decls = &root_node.decls,
101 .extern_export_inline_token = null,103 .visib_token = token_index,
102 .lib_name = null,104 .extern_export_inline_token = null,
103 .comments = comments,105 .lib_name = null,
104 } });106 .comments = comments,
107 },
108 });
105 continue;109 continue;
106 },110 },
107 Token.Id.Keyword_comptime => {111 Token.Id.Keyword_comptime => {
...@@ -122,22 +126,26 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -122,22 +126,26 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
122126
123 stack.append(State.TopLevel) catch unreachable;127 stack.append(State.TopLevel) catch unreachable;
124 try stack.append(State{ .Block = block });128 try stack.append(State{ .Block = block });
125 try stack.append(State{ .ExpectTokenSave = ExpectTokenSave{129 try stack.append(State{
126 .id = Token.Id.LBrace,130 .ExpectTokenSave = ExpectTokenSave{
127 .ptr = &block.lbrace,131 .id = Token.Id.LBrace,
128 } });132 .ptr = &block.lbrace,
133 },
134 });
129 continue;135 continue;
130 },136 },
131 else => {137 else => {
132 prevToken(&tok_it, &tree);138 prevToken(&tok_it, &tree);
133 stack.append(State.TopLevel) catch unreachable;139 stack.append(State.TopLevel) catch unreachable;
134 try stack.append(State{ .TopLevelExtern = TopLevelDeclCtx{140 try stack.append(State{
135 .decls = &root_node.decls,141 .TopLevelExtern = TopLevelDeclCtx{
136 .visib_token = null,142 .decls = &root_node.decls,
137 .extern_export_inline_token = null,143 .visib_token = null,
138 .lib_name = null,144 .extern_export_inline_token = null,
139 .comments = comments,145 .lib_name = null,
140 } });146 .comments = comments,
147 },
148 });
141 continue;149 continue;
142 },150 },
143 }151 }
...@@ -147,31 +155,34 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -147,31 +155,34 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
147 const token_index = token.index;155 const token_index = token.index;
148 const token_ptr = token.ptr;156 const token_ptr = token.ptr;
149 switch (token_ptr.id) {157 switch (token_ptr.id) {
150 Token.Id.Keyword_export,158 Token.Id.Keyword_export, Token.Id.Keyword_inline => {
151 Token.Id.Keyword_inline => {159 stack.append(State{
152 stack.append(State{ .TopLevelDecl = TopLevelDeclCtx{160 .TopLevelDecl = TopLevelDeclCtx{
153 .decls = ctx.decls,161 .decls = ctx.decls,
154 .visib_token = ctx.visib_token,162 .visib_token = ctx.visib_token,
155 .extern_export_inline_token = AnnotatedToken{163 .extern_export_inline_token = AnnotatedToken{
156 .index = token_index,164 .index = token_index,
157 .ptr = token_ptr,165 .ptr = token_ptr,
166 },
167 .lib_name = null,
168 .comments = ctx.comments,
158 },169 },
159 .lib_name = null,170 }) catch unreachable;
160 .comments = ctx.comments,
161 } }) catch unreachable;
162 continue;171 continue;
163 },172 },
164 Token.Id.Keyword_extern => {173 Token.Id.Keyword_extern => {
165 stack.append(State{ .TopLevelLibname = TopLevelDeclCtx{174 stack.append(State{
166 .decls = ctx.decls,175 .TopLevelLibname = TopLevelDeclCtx{
167 .visib_token = ctx.visib_token,176 .decls = ctx.decls,
168 .extern_export_inline_token = AnnotatedToken{177 .visib_token = ctx.visib_token,
169 .index = token_index,178 .extern_export_inline_token = AnnotatedToken{
170 .ptr = token_ptr,179 .index = token_index,
180 .ptr = token_ptr,
181 },
182 .lib_name = null,
183 .comments = ctx.comments,
171 },184 },
172 .lib_name = null,185 }) catch unreachable;
173 .comments = ctx.comments,
174 } }) catch unreachable;
175 continue;186 continue;
176 },187 },
177 else => {188 else => {
...@@ -192,13 +203,15 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -192,13 +203,15 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
192 };203 };
193 };204 };
194205
195 stack.append(State{ .TopLevelDecl = TopLevelDeclCtx{206 stack.append(State{
196 .decls = ctx.decls,207 .TopLevelDecl = TopLevelDeclCtx{
197 .visib_token = ctx.visib_token,208 .decls = ctx.decls,
198 .extern_export_inline_token = ctx.extern_export_inline_token,209 .visib_token = ctx.visib_token,
199 .lib_name = lib_name,210 .extern_export_inline_token = ctx.extern_export_inline_token,
200 .comments = ctx.comments,211 .lib_name = lib_name,
201 } }) catch unreachable;212 .comments = ctx.comments,
213 },
214 }) catch unreachable;
202 continue;215 continue;
203 },216 },
204 State.TopLevelDecl => |ctx| {217 State.TopLevelDecl => |ctx| {
...@@ -222,15 +235,16 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -222,15 +235,16 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
222 });235 });
223 try ctx.decls.push(&node.base);236 try ctx.decls.push(&node.base);
224237
225 stack.append(State{ .ExpectTokenSave = ExpectTokenSave{238 stack.append(State{
226 .id = Token.Id.Semicolon,239 .ExpectTokenSave = ExpectTokenSave{
227 .ptr = &node.semicolon_token,240 .id = Token.Id.Semicolon,
228 } }) catch unreachable;241 .ptr = &node.semicolon_token,
242 },
243 }) catch unreachable;
229 try stack.append(State{ .Expression = OptionalCtx{ .Required = &node.expr } });244 try stack.append(State{ .Expression = OptionalCtx{ .Required = &node.expr } });
230 continue;245 continue;
231 },246 },
232 Token.Id.Keyword_var,247 Token.Id.Keyword_var, Token.Id.Keyword_const => {
233 Token.Id.Keyword_const => {
234 if (ctx.extern_export_inline_token) |annotated_token| {248 if (ctx.extern_export_inline_token) |annotated_token| {
235 if (annotated_token.ptr.id == Token.Id.Keyword_inline) {249 if (annotated_token.ptr.id == Token.Id.Keyword_inline) {
236 ((try tree.errors.addOne())).* = Error{ .InvalidToken = Error.InvalidToken{ .token = annotated_token.index } };250 ((try tree.errors.addOne())).* = Error{ .InvalidToken = Error.InvalidToken{ .token = annotated_token.index } };
...@@ -238,21 +252,20 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -238,21 +252,20 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
238 }252 }
239 }253 }
240254
241 try stack.append(State{ .VarDecl = VarDeclCtx{255 try stack.append(State{
242 .comments = ctx.comments,256 .VarDecl = VarDeclCtx{
243 .visib_token = ctx.visib_token,257 .comments = ctx.comments,
244 .lib_name = ctx.lib_name,258 .visib_token = ctx.visib_token,
245 .comptime_token = null,259 .lib_name = ctx.lib_name,
246 .extern_export_token = if (ctx.extern_export_inline_token) |at| at.index else null,260 .comptime_token = null,
247 .mut_token = token_index,261 .extern_export_token = if (ctx.extern_export_inline_token) |at| at.index else null,
248 .list = ctx.decls,262 .mut_token = token_index,
249 } });263 .list = ctx.decls,
264 },
265 });
250 continue;266 continue;
251 },267 },
252 Token.Id.Keyword_fn,268 Token.Id.Keyword_fn, Token.Id.Keyword_nakedcc, Token.Id.Keyword_stdcallcc, Token.Id.Keyword_async => {
253 Token.Id.Keyword_nakedcc,
254 Token.Id.Keyword_stdcallcc,
255 Token.Id.Keyword_async => {
256 const fn_proto = try arena.construct(ast.Node.FnProto{269 const fn_proto = try arena.construct(ast.Node.FnProto{
257 .base = ast.Node{ .id = ast.Node.Id.FnProto },270 .base = ast.Node{ .id = ast.Node.Id.FnProto },
258 .doc_comments = ctx.comments,271 .doc_comments = ctx.comments,
...@@ -274,13 +287,14 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -274,13 +287,14 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
274 try stack.append(State{ .FnProto = fn_proto });287 try stack.append(State{ .FnProto = fn_proto });
275288
276 switch (token_ptr.id) {289 switch (token_ptr.id) {
277 Token.Id.Keyword_nakedcc,290 Token.Id.Keyword_nakedcc, Token.Id.Keyword_stdcallcc => {
278 Token.Id.Keyword_stdcallcc => {
279 fn_proto.cc_token = token_index;291 fn_proto.cc_token = token_index;
280 try stack.append(State{ .ExpectTokenSave = ExpectTokenSave{292 try stack.append(State{
281 .id = Token.Id.Keyword_fn,293 .ExpectTokenSave = ExpectTokenSave{
282 .ptr = &fn_proto.fn_token,294 .id = Token.Id.Keyword_fn,
283 } });295 .ptr = &fn_proto.fn_token,
296 },
297 });
284 continue;298 continue;
285 },299 },
286 Token.Id.Keyword_async => {300 Token.Id.Keyword_async => {
...@@ -292,10 +306,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -292,10 +306,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
292 });306 });
293 fn_proto.async_attr = async_node;307 fn_proto.async_attr = async_node;
294308
295 try stack.append(State{ .ExpectTokenSave = ExpectTokenSave{309 try stack.append(State{
296 .id = Token.Id.Keyword_fn,310 .ExpectTokenSave = ExpectTokenSave{
297 .ptr = &fn_proto.fn_token,311 .id = Token.Id.Keyword_fn,
298 } });312 .ptr = &fn_proto.fn_token,
313 },
314 });
299 try stack.append(State{ .AsyncAllocator = async_node });315 try stack.append(State{ .AsyncAllocator = async_node });
300 continue;316 continue;
301 },317 },
...@@ -331,13 +347,15 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -331,13 +347,15 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
331 }347 }
332348
333 stack.append(State{ .ContainerDecl = ctx.container_decl }) catch unreachable;349 stack.append(State{ .ContainerDecl = ctx.container_decl }) catch unreachable;
334 try stack.append(State{ .TopLevelExtern = TopLevelDeclCtx{350 try stack.append(State{
335 .decls = &ctx.container_decl.fields_and_decls,351 .TopLevelExtern = TopLevelDeclCtx{
336 .visib_token = ctx.visib_token,352 .decls = &ctx.container_decl.fields_and_decls,
337 .extern_export_inline_token = null,353 .visib_token = ctx.visib_token,
338 .lib_name = null,354 .extern_export_inline_token = null,
339 .comments = ctx.comments,355 .lib_name = null,
340 } });356 .comments = ctx.comments,
357 },
358 });
341 continue;359 continue;
342 },360 },
343361
...@@ -361,9 +379,7 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -361,9 +379,7 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
361 .base = ast.Node{ .id = ast.Node.Id.ContainerDecl },379 .base = ast.Node{ .id = ast.Node.Id.ContainerDecl },
362 .layout_token = ctx.layout_token,380 .layout_token = ctx.layout_token,
363 .kind_token = switch (token_ptr.id) {381 .kind_token = switch (token_ptr.id) {
364 Token.Id.Keyword_struct,382 Token.Id.Keyword_struct, Token.Id.Keyword_union, Token.Id.Keyword_enum => token_index,
365 Token.Id.Keyword_union,
366 Token.Id.Keyword_enum => token_index,
367 else => {383 else => {
368 ((try tree.errors.addOne())).* = Error{ .ExpectedAggregateKw = Error.ExpectedAggregateKw{ .token = token_index } };384 ((try tree.errors.addOne())).* = Error{ .ExpectedAggregateKw = Error.ExpectedAggregateKw{ .token = token_index } };
369 return tree;385 return tree;
...@@ -377,10 +393,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -377,10 +393,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
377 ctx.opt_ctx.store(&node.base);393 ctx.opt_ctx.store(&node.base);
378394
379 stack.append(State{ .ContainerDecl = node }) catch unreachable;395 stack.append(State{ .ContainerDecl = node }) catch unreachable;
380 try stack.append(State{ .ExpectTokenSave = ExpectTokenSave{396 try stack.append(State{
381 .id = Token.Id.LBrace,397 .ExpectTokenSave = ExpectTokenSave{
382 .ptr = &node.lbrace_token,398 .id = Token.Id.LBrace,
383 } });399 .ptr = &node.lbrace_token,
400 },
401 });
384 try stack.append(State{ .ContainerInitArgStart = node });402 try stack.append(State{ .ContainerInitArgStart = node });
385 continue;403 continue;
386 },404 },
...@@ -481,35 +499,41 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -481,35 +499,41 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
481 Token.Id.Keyword_pub => {499 Token.Id.Keyword_pub => {
482 switch (tree.tokens.at(container_decl.kind_token).id) {500 switch (tree.tokens.at(container_decl.kind_token).id) {
483 Token.Id.Keyword_struct => {501 Token.Id.Keyword_struct => {
484 try stack.append(State{ .TopLevelExternOrField = TopLevelExternOrFieldCtx{502 try stack.append(State{
485 .visib_token = token_index,503 .TopLevelExternOrField = TopLevelExternOrFieldCtx{
486 .container_decl = container_decl,504 .visib_token = token_index,
487 .comments = comments,505 .container_decl = container_decl,
488 } });506 .comments = comments,
507 },
508 });
489 continue;509 continue;
490 },510 },
491 else => {511 else => {
492 stack.append(State{ .ContainerDecl = container_decl }) catch unreachable;512 stack.append(State{ .ContainerDecl = container_decl }) catch unreachable;
493 try stack.append(State{ .TopLevelExtern = TopLevelDeclCtx{513 try stack.append(State{
494 .decls = &container_decl.fields_and_decls,514 .TopLevelExtern = TopLevelDeclCtx{
495 .visib_token = token_index,515 .decls = &container_decl.fields_and_decls,
496 .extern_export_inline_token = null,516 .visib_token = token_index,
497 .lib_name = null,517 .extern_export_inline_token = null,
498 .comments = comments,518 .lib_name = null,
499 } });519 .comments = comments,
520 },
521 });
500 continue;522 continue;
501 },523 },
502 }524 }
503 },525 },
504 Token.Id.Keyword_export => {526 Token.Id.Keyword_export => {
505 stack.append(State{ .ContainerDecl = container_decl }) catch unreachable;527 stack.append(State{ .ContainerDecl = container_decl }) catch unreachable;
506 try stack.append(State{ .TopLevelExtern = TopLevelDeclCtx{528 try stack.append(State{
507 .decls = &container_decl.fields_and_decls,529 .TopLevelExtern = TopLevelDeclCtx{
508 .visib_token = token_index,530 .decls = &container_decl.fields_and_decls,
509 .extern_export_inline_token = null,531 .visib_token = token_index,
510 .lib_name = null,532 .extern_export_inline_token = null,
511 .comments = comments,533 .lib_name = null,
512 } });534 .comments = comments,
535 },
536 });
513 continue;537 continue;
514 },538 },
515 Token.Id.RBrace => {539 Token.Id.RBrace => {
...@@ -523,13 +547,15 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -523,13 +547,15 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
523 else => {547 else => {
524 prevToken(&tok_it, &tree);548 prevToken(&tok_it, &tree);
525 stack.append(State{ .ContainerDecl = container_decl }) catch unreachable;549 stack.append(State{ .ContainerDecl = container_decl }) catch unreachable;
526 try stack.append(State{ .TopLevelExtern = TopLevelDeclCtx{550 try stack.append(State{
527 .decls = &container_decl.fields_and_decls,551 .TopLevelExtern = TopLevelDeclCtx{
528 .visib_token = null,552 .decls = &container_decl.fields_and_decls,
529 .extern_export_inline_token = null,553 .visib_token = null,
530 .lib_name = null,554 .extern_export_inline_token = null,
531 .comments = comments,555 .lib_name = null,
532 } });556 .comments = comments,
557 },
558 });
533 continue;559 continue;
534 },560 },
535 }561 }
...@@ -557,10 +583,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -557,10 +583,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
557 try stack.append(State{ .VarDeclAlign = var_decl });583 try stack.append(State{ .VarDeclAlign = var_decl });
558 try stack.append(State{ .TypeExprBegin = OptionalCtx{ .RequiredNull = &var_decl.type_node } });584 try stack.append(State{ .TypeExprBegin = OptionalCtx{ .RequiredNull = &var_decl.type_node } });
559 try stack.append(State{ .IfToken = Token.Id.Colon });585 try stack.append(State{ .IfToken = Token.Id.Colon });
560 try stack.append(State{ .ExpectTokenSave = ExpectTokenSave{586 try stack.append(State{
561 .id = Token.Id.Identifier,587 .ExpectTokenSave = ExpectTokenSave{
562 .ptr = &var_decl.name_token,588 .id = Token.Id.Identifier,
563 } });589 .ptr = &var_decl.name_token,
590 },
591 });
564 continue;592 continue;
565 },593 },
566 State.VarDeclAlign => |var_decl| {594 State.VarDeclAlign => |var_decl| {
...@@ -605,10 +633,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -605,10 +633,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
605 const semicolon_token = nextToken(&tok_it, &tree);633 const semicolon_token = nextToken(&tok_it, &tree);
606634
607 if (semicolon_token.ptr.id != Token.Id.Semicolon) {635 if (semicolon_token.ptr.id != Token.Id.Semicolon) {
608 ((try tree.errors.addOne())).* = Error{ .ExpectedToken = Error.ExpectedToken{636 ((try tree.errors.addOne())).* = Error{
609 .token = semicolon_token.index,637 .ExpectedToken = Error.ExpectedToken{
610 .expected_id = Token.Id.Semicolon,638 .token = semicolon_token.index,
611 } };639 .expected_id = Token.Id.Semicolon,
640 },
641 };
612 return tree;642 return tree;
613 }643 }
614644
...@@ -713,10 +743,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -713,10 +743,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
713 });743 });
714 try fn_proto.params.push(&param_decl.base);744 try fn_proto.params.push(&param_decl.base);
715745
716 stack.append(State{ .ParamDeclEnd = ParamDeclEndCtx{746 stack.append(State{
717 .param_decl = param_decl,747 .ParamDeclEnd = ParamDeclEndCtx{
718 .fn_proto = fn_proto,748 .param_decl = param_decl,
719 } }) catch unreachable;749 .fn_proto = fn_proto,
750 },
751 }) catch unreachable;
720 try stack.append(State{ .ParamDeclName = param_decl });752 try stack.append(State{ .ParamDeclName = param_decl });
721 try stack.append(State{ .ParamDeclAliasOrComptime = param_decl });753 try stack.append(State{ .ParamDeclAliasOrComptime = param_decl });
722 continue;754 continue;
...@@ -769,10 +801,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -769,10 +801,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
769801
770 State.MaybeLabeledExpression => |ctx| {802 State.MaybeLabeledExpression => |ctx| {
771 if (eatToken(&tok_it, &tree, Token.Id.Colon)) |_| {803 if (eatToken(&tok_it, &tree, Token.Id.Colon)) |_| {
772 stack.append(State{ .LabeledExpression = LabelCtx{804 stack.append(State{
773 .label = ctx.label,805 .LabeledExpression = LabelCtx{
774 .opt_ctx = ctx.opt_ctx,806 .label = ctx.label,
775 } }) catch unreachable;807 .opt_ctx = ctx.opt_ctx,
808 },
809 }) catch unreachable;
776 continue;810 continue;
777 }811 }
778812
...@@ -797,21 +831,25 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -797,21 +831,25 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
797 continue;831 continue;
798 },832 },
799 Token.Id.Keyword_while => {833 Token.Id.Keyword_while => {
800 stack.append(State{ .While = LoopCtx{834 stack.append(State{
801 .label = ctx.label,835 .While = LoopCtx{
802 .inline_token = null,836 .label = ctx.label,
803 .loop_token = token_index,837 .inline_token = null,
804 .opt_ctx = ctx.opt_ctx.toRequired(),838 .loop_token = token_index,
805 } }) catch unreachable;839 .opt_ctx = ctx.opt_ctx.toRequired(),
840 },
841 }) catch unreachable;
806 continue;842 continue;
807 },843 },
808 Token.Id.Keyword_for => {844 Token.Id.Keyword_for => {
809 stack.append(State{ .For = LoopCtx{845 stack.append(State{
810 .label = ctx.label,846 .For = LoopCtx{
811 .inline_token = null,847 .label = ctx.label,
812 .loop_token = token_index,848 .inline_token = null,
813 .opt_ctx = ctx.opt_ctx.toRequired(),849 .loop_token = token_index,
814 } }) catch unreachable;850 .opt_ctx = ctx.opt_ctx.toRequired(),
851 },
852 }) catch unreachable;
815 continue;853 continue;
816 },854 },
817 Token.Id.Keyword_suspend => {855 Token.Id.Keyword_suspend => {
...@@ -828,11 +866,13 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -828,11 +866,13 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
828 continue;866 continue;
829 },867 },
830 Token.Id.Keyword_inline => {868 Token.Id.Keyword_inline => {
831 stack.append(State{ .Inline = InlineCtx{869 stack.append(State{
832 .label = ctx.label,870 .Inline = InlineCtx{
833 .inline_token = token_index,871 .label = ctx.label,
834 .opt_ctx = ctx.opt_ctx.toRequired(),872 .inline_token = token_index,
835 } }) catch unreachable;873 .opt_ctx = ctx.opt_ctx.toRequired(),
874 },
875 }) catch unreachable;
836 continue;876 continue;
837 },877 },
838 else => {878 else => {
...@@ -852,21 +892,25 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -852,21 +892,25 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
852 const token_ptr = token.ptr;892 const token_ptr = token.ptr;
853 switch (token_ptr.id) {893 switch (token_ptr.id) {
854 Token.Id.Keyword_while => {894 Token.Id.Keyword_while => {
855 stack.append(State{ .While = LoopCtx{895 stack.append(State{
856 .inline_token = ctx.inline_token,896 .While = LoopCtx{
857 .label = ctx.label,897 .inline_token = ctx.inline_token,
858 .loop_token = token_index,898 .label = ctx.label,
859 .opt_ctx = ctx.opt_ctx.toRequired(),899 .loop_token = token_index,
860 } }) catch unreachable;900 .opt_ctx = ctx.opt_ctx.toRequired(),
901 },
902 }) catch unreachable;
861 continue;903 continue;
862 },904 },
863 Token.Id.Keyword_for => {905 Token.Id.Keyword_for => {
864 stack.append(State{ .For = LoopCtx{906 stack.append(State{
865 .inline_token = ctx.inline_token,907 .For = LoopCtx{
866 .label = ctx.label,908 .inline_token = ctx.inline_token,
867 .loop_token = token_index,909 .label = ctx.label,
868 .opt_ctx = ctx.opt_ctx.toRequired(),910 .loop_token = token_index,
869 } }) catch unreachable;911 .opt_ctx = ctx.opt_ctx.toRequired(),
912 },
913 }) catch unreachable;
870 continue;914 continue;
871 },915 },
872 else => {916 else => {
...@@ -971,27 +1015,29 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -971,27 +1015,29 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
971 const token_ptr = token.ptr;1015 const token_ptr = token.ptr;
972 switch (token_ptr.id) {1016 switch (token_ptr.id) {
973 Token.Id.Keyword_comptime => {1017 Token.Id.Keyword_comptime => {
974 stack.append(State{ .ComptimeStatement = ComptimeStatementCtx{1018 stack.append(State{
975 .comptime_token = token_index,1019 .ComptimeStatement = ComptimeStatementCtx{
976 .block = block,1020 .comptime_token = token_index,
977 } }) catch unreachable;1021 .block = block,
978 continue;1022 },
979 },1023 }) catch unreachable;
980 Token.Id.Keyword_var,1024 continue;
981 Token.Id.Keyword_const => {1025 },
982 stack.append(State{ .VarDecl = VarDeclCtx{1026 Token.Id.Keyword_var, Token.Id.Keyword_const => {
983 .comments = null,1027 stack.append(State{
984 .visib_token = null,1028 .VarDecl = VarDeclCtx{
985 .comptime_token = null,1029 .comments = null,
986 .extern_export_token = null,1030 .visib_token = null,
987 .lib_name = null,1031 .comptime_token = null,
988 .mut_token = token_index,1032 .extern_export_token = null,
989 .list = &block.statements,1033 .lib_name = null,
990 } }) catch unreachable;1034 .mut_token = token_index,
1035 .list = &block.statements,
1036 },
1037 }) catch unreachable;
991 continue;1038 continue;
992 },1039 },
993 Token.Id.Keyword_defer,1040 Token.Id.Keyword_defer, Token.Id.Keyword_errdefer => {
994 Token.Id.Keyword_errdefer => {
995 const node = try arena.construct(ast.Node.Defer{1041 const node = try arena.construct(ast.Node.Defer{
996 .base = ast.Node{ .id = ast.Node.Id.Defer },1042 .base = ast.Node{ .id = ast.Node.Id.Defer },
997 .defer_token = token_index,1043 .defer_token = token_index,
...@@ -1036,17 +1082,18 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -1036,17 +1082,18 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
1036 const token_index = token.index;1082 const token_index = token.index;
1037 const token_ptr = token.ptr;1083 const token_ptr = token.ptr;
1038 switch (token_ptr.id) {1084 switch (token_ptr.id) {
1039 Token.Id.Keyword_var,1085 Token.Id.Keyword_var, Token.Id.Keyword_const => {
1040 Token.Id.Keyword_const => {1086 stack.append(State{
1041 stack.append(State{ .VarDecl = VarDeclCtx{1087 .VarDecl = VarDeclCtx{
1042 .comments = null,1088 .comments = null,
1043 .visib_token = null,1089 .visib_token = null,
1044 .comptime_token = ctx.comptime_token,1090 .comptime_token = ctx.comptime_token,
1045 .extern_export_token = null,1091 .extern_export_token = null,
1046 .lib_name = null,1092 .lib_name = null,
1047 .mut_token = token_index,1093 .mut_token = token_index,
1048 .list = &ctx.block.statements,1094 .list = &ctx.block.statements,
1049 } }) catch unreachable;1095 },
1096 }) catch unreachable;
1050 continue;1097 continue;
1051 },1098 },
1052 else => {1099 else => {
...@@ -1089,10 +1136,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -1089,10 +1136,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
10891136
1090 stack.append(State{ .AsmOutputItems = items }) catch unreachable;1137 stack.append(State{ .AsmOutputItems = items }) catch unreachable;
1091 try stack.append(State{ .IfToken = Token.Id.Comma });1138 try stack.append(State{ .IfToken = Token.Id.Comma });
1092 try stack.append(State{ .ExpectTokenSave = ExpectTokenSave{1139 try stack.append(State{
1093 .id = Token.Id.RParen,1140 .ExpectTokenSave = ExpectTokenSave{
1094 .ptr = &node.rparen,1141 .id = Token.Id.RParen,
1095 } });1142 .ptr = &node.rparen,
1143 },
1144 });
1096 try stack.append(State{ .AsmOutputReturnOrType = node });1145 try stack.append(State{ .AsmOutputReturnOrType = node });
1097 try stack.append(State{ .ExpectToken = Token.Id.LParen });1146 try stack.append(State{ .ExpectToken = Token.Id.LParen });
1098 try stack.append(State{ .StringLiteral = OptionalCtx{ .Required = &node.constraint } });1147 try stack.append(State{ .StringLiteral = OptionalCtx{ .Required = &node.constraint } });
...@@ -1141,10 +1190,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -1141,10 +1190,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
11411190
1142 stack.append(State{ .AsmInputItems = items }) catch unreachable;1191 stack.append(State{ .AsmInputItems = items }) catch unreachable;
1143 try stack.append(State{ .IfToken = Token.Id.Comma });1192 try stack.append(State{ .IfToken = Token.Id.Comma });
1144 try stack.append(State{ .ExpectTokenSave = ExpectTokenSave{1193 try stack.append(State{
1145 .id = Token.Id.RParen,1194 .ExpectTokenSave = ExpectTokenSave{
1146 .ptr = &node.rparen,1195 .id = Token.Id.RParen,
1147 } });1196 .ptr = &node.rparen,
1197 },
1198 });
1148 try stack.append(State{ .Expression = OptionalCtx{ .Required = &node.expr } });1199 try stack.append(State{ .Expression = OptionalCtx{ .Required = &node.expr } });
1149 try stack.append(State{ .ExpectToken = Token.Id.LParen });1200 try stack.append(State{ .ExpectToken = Token.Id.LParen });
1150 try stack.append(State{ .StringLiteral = OptionalCtx{ .Required = &node.constraint } });1201 try stack.append(State{ .StringLiteral = OptionalCtx{ .Required = &node.constraint } });
...@@ -1203,14 +1254,18 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -1203,14 +1254,18 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
1203 stack.append(State{ .FieldInitListCommaOrEnd = list_state }) catch unreachable;1254 stack.append(State{ .FieldInitListCommaOrEnd = list_state }) catch unreachable;
1204 try stack.append(State{ .Expression = OptionalCtx{ .Required = &node.expr } });1255 try stack.append(State{ .Expression = OptionalCtx{ .Required = &node.expr } });
1205 try stack.append(State{ .ExpectToken = Token.Id.Equal });1256 try stack.append(State{ .ExpectToken = Token.Id.Equal });
1206 try stack.append(State{ .ExpectTokenSave = ExpectTokenSave{1257 try stack.append(State{
1207 .id = Token.Id.Identifier,1258 .ExpectTokenSave = ExpectTokenSave{
1208 .ptr = &node.name_token,1259 .id = Token.Id.Identifier,
1209 } });1260 .ptr = &node.name_token,
1210 try stack.append(State{ .ExpectTokenSave = ExpectTokenSave{1261 },
1211 .id = Token.Id.Period,1262 });
1212 .ptr = &node.period_token,1263 try stack.append(State{
1213 } });1264 .ExpectTokenSave = ExpectTokenSave{
1265 .id = Token.Id.Period,
1266 .ptr = &node.period_token,
1267 },
1268 });
1214 continue;1269 continue;
1215 },1270 },
1216 State.FieldInitListCommaOrEnd => |list_state| {1271 State.FieldInitListCommaOrEnd => |list_state| {
...@@ -1320,10 +1375,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -1320,10 +1375,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
1320 });1375 });
1321 try switch_case.items.push(&else_node.base);1376 try switch_case.items.push(&else_node.base);
13221377
1323 try stack.append(State{ .ExpectTokenSave = ExpectTokenSave{1378 try stack.append(State{
1324 .id = Token.Id.EqualAngleBracketRight,1379 .ExpectTokenSave = ExpectTokenSave{
1325 .ptr = &switch_case.arrow_token,1380 .id = Token.Id.EqualAngleBracketRight,
1326 } });1381 .ptr = &switch_case.arrow_token,
1382 },
1383 });
1327 continue;1384 continue;
1328 } else {1385 } else {
1329 prevToken(&tok_it, &tree);1386 prevToken(&tok_it, &tree);
...@@ -1374,10 +1431,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -1374,10 +1431,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
1374 }1431 }
13751432
1376 async_node.rangle_bracket = TokenIndex(0);1433 async_node.rangle_bracket = TokenIndex(0);
1377 try stack.append(State{ .ExpectTokenSave = ExpectTokenSave{1434 try stack.append(State{
1378 .id = Token.Id.AngleBracketRight,1435 .ExpectTokenSave = ExpectTokenSave{
1379 .ptr = &??async_node.rangle_bracket,1436 .id = Token.Id.AngleBracketRight,
1380 } });1437 .ptr = &??async_node.rangle_bracket,
1438 },
1439 });
1381 try stack.append(State{ .TypeExprBegin = OptionalCtx{ .RequiredNull = &async_node.allocator_type } });1440 try stack.append(State{ .TypeExprBegin = OptionalCtx{ .RequiredNull = &async_node.allocator_type } });
1382 continue;1441 continue;
1383 },1442 },
...@@ -1430,10 +1489,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -1430,10 +1489,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
1430 continue;1489 continue;
1431 }1490 }
14321491
1433 stack.append(State{ .ContainerKind = ContainerKindCtx{1492 stack.append(State{
1434 .opt_ctx = ctx.opt_ctx,1493 .ContainerKind = ContainerKindCtx{
1435 .layout_token = ctx.extern_token,1494 .opt_ctx = ctx.opt_ctx,
1436 } }) catch unreachable;1495 .layout_token = ctx.extern_token,
1496 },
1497 }) catch unreachable;
1437 continue;1498 continue;
1438 },1499 },
1439 State.SliceOrArrayAccess => |node| {1500 State.SliceOrArrayAccess => |node| {
...@@ -1443,15 +1504,19 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -1443,15 +1504,19 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
1443 switch (token_ptr.id) {1504 switch (token_ptr.id) {
1444 Token.Id.Ellipsis2 => {1505 Token.Id.Ellipsis2 => {
1445 const start = node.op.ArrayAccess;1506 const start = node.op.ArrayAccess;
1446 node.op = ast.Node.SuffixOp.Op{ .Slice = ast.Node.SuffixOp.Op.Slice{1507 node.op = ast.Node.SuffixOp.Op{
1447 .start = start,1508 .Slice = ast.Node.SuffixOp.Op.Slice{
1448 .end = null,1509 .start = start,
1449 } };1510 .end = null,
1511 },
1512 };
14501513
1451 stack.append(State{ .ExpectTokenSave = ExpectTokenSave{1514 stack.append(State{
1452 .id = Token.Id.RBracket,1515 .ExpectTokenSave = ExpectTokenSave{
1453 .ptr = &node.rtoken,1516 .id = Token.Id.RBracket,
1454 } }) catch unreachable;1517 .ptr = &node.rtoken,
1518 },
1519 }) catch unreachable;
1455 try stack.append(State{ .Expression = OptionalCtx{ .Optional = &node.op.Slice.end } });1520 try stack.append(State{ .Expression = OptionalCtx{ .Optional = &node.op.Slice.end } });
1456 continue;1521 continue;
1457 },1522 },
...@@ -1467,11 +1532,13 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -1467,11 +1532,13 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
1467 },1532 },
1468 State.SliceOrArrayType => |node| {1533 State.SliceOrArrayType => |node| {
1469 if (eatToken(&tok_it, &tree, Token.Id.RBracket)) |_| {1534 if (eatToken(&tok_it, &tree, Token.Id.RBracket)) |_| {
1470 node.op = ast.Node.PrefixOp.Op{ .SliceType = ast.Node.PrefixOp.AddrOfInfo{1535 node.op = ast.Node.PrefixOp.Op{
1471 .align_info = null,1536 .SliceType = ast.Node.PrefixOp.AddrOfInfo{
1472 .const_token = null,1537 .align_info = null,
1473 .volatile_token = null,1538 .const_token = null,
1474 } };1539 .volatile_token = null,
1540 },
1541 };
1475 stack.append(State{ .TypeExprBegin = OptionalCtx{ .Required = &node.rhs } }) catch unreachable;1542 stack.append(State{ .TypeExprBegin = OptionalCtx{ .Required = &node.rhs } }) catch unreachable;
1476 try stack.append(State{ .AddrOfModifiers = &node.op.SliceType });1543 try stack.append(State{ .AddrOfModifiers = &node.op.SliceType });
1477 continue;1544 continue;
...@@ -1495,7 +1562,7 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -1495,7 +1562,7 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
1495 ((try tree.errors.addOne())).* = Error{ .ExtraAlignQualifier = Error.ExtraAlignQualifier{ .token = token_index } };1562 ((try tree.errors.addOne())).* = Error{ .ExtraAlignQualifier = Error.ExtraAlignQualifier{ .token = token_index } };
1496 return tree;1563 return tree;
1497 }1564 }
1498 addr_of_info.align_info = ast.Node.PrefixOp.AddrOfInfo.Align {1565 addr_of_info.align_info = ast.Node.PrefixOp.AddrOfInfo.Align{
1499 .node = undefined,1566 .node = undefined,
1500 .bit_range = null,1567 .bit_range = null,
1501 };1568 };
...@@ -1548,9 +1615,7 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -1548,9 +1615,7 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
1548 Token.Id.RParen => continue,1615 Token.Id.RParen => continue,
1549 else => {1616 else => {
1550 (try tree.errors.addOne()).* = Error{1617 (try tree.errors.addOne()).* = Error{
1551 .ExpectedColonOrRParen = Error.ExpectedColonOrRParen{1618 .ExpectedColonOrRParen = Error.ExpectedColonOrRParen{ .token = token.index },
1552 .token = token.index,
1553 }
1554 };1619 };
1555 return tree;1620 return tree;
1556 },1621 },
...@@ -1563,10 +1628,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -1563,10 +1628,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
1563 const token_ptr = token.ptr;1628 const token_ptr = token.ptr;
1564 if (token_ptr.id != Token.Id.Pipe) {1629 if (token_ptr.id != Token.Id.Pipe) {
1565 if (opt_ctx != OptionalCtx.Optional) {1630 if (opt_ctx != OptionalCtx.Optional) {
1566 ((try tree.errors.addOne())).* = Error{ .ExpectedToken = Error.ExpectedToken{1631 ((try tree.errors.addOne())).* = Error{
1567 .token = token_index,1632 .ExpectedToken = Error.ExpectedToken{
1568 .expected_id = Token.Id.Pipe,1633 .token = token_index,
1569 } };1634 .expected_id = Token.Id.Pipe,
1635 },
1636 };
1570 return tree;1637 return tree;
1571 }1638 }
15721639
...@@ -1582,10 +1649,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -1582,10 +1649,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
1582 });1649 });
1583 opt_ctx.store(&node.base);1650 opt_ctx.store(&node.base);
15841651
1585 stack.append(State{ .ExpectTokenSave = ExpectTokenSave{1652 stack.append(State{
1586 .id = Token.Id.Pipe,1653 .ExpectTokenSave = ExpectTokenSave{
1587 .ptr = &node.rpipe,1654 .id = Token.Id.Pipe,
1588 } }) catch unreachable;1655 .ptr = &node.rpipe,
1656 },
1657 }) catch unreachable;
1589 try stack.append(State{ .Identifier = OptionalCtx{ .Required = &node.error_symbol } });1658 try stack.append(State{ .Identifier = OptionalCtx{ .Required = &node.error_symbol } });
1590 continue;1659 continue;
1591 },1660 },
...@@ -1595,10 +1664,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -1595,10 +1664,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
1595 const token_ptr = token.ptr;1664 const token_ptr = token.ptr;
1596 if (token_ptr.id != Token.Id.Pipe) {1665 if (token_ptr.id != Token.Id.Pipe) {
1597 if (opt_ctx != OptionalCtx.Optional) {1666 if (opt_ctx != OptionalCtx.Optional) {
1598 ((try tree.errors.addOne())).* = Error{ .ExpectedToken = Error.ExpectedToken{1667 ((try tree.errors.addOne())).* = Error{
1599 .token = token_index,1668 .ExpectedToken = Error.ExpectedToken{
1600 .expected_id = Token.Id.Pipe,1669 .token = token_index,
1601 } };1670 .expected_id = Token.Id.Pipe,
1671 },
1672 };
1602 return tree;1673 return tree;
1603 }1674 }
16041675
...@@ -1615,15 +1686,19 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -1615,15 +1686,19 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
1615 });1686 });
1616 opt_ctx.store(&node.base);1687 opt_ctx.store(&node.base);
16171688
1618 try stack.append(State{ .ExpectTokenSave = ExpectTokenSave{1689 try stack.append(State{
1619 .id = Token.Id.Pipe,1690 .ExpectTokenSave = ExpectTokenSave{
1620 .ptr = &node.rpipe,1691 .id = Token.Id.Pipe,
1621 } });1692 .ptr = &node.rpipe,
1693 },
1694 });
1622 try stack.append(State{ .Identifier = OptionalCtx{ .Required = &node.value_symbol } });1695 try stack.append(State{ .Identifier = OptionalCtx{ .Required = &node.value_symbol } });
1623 try stack.append(State{ .OptionalTokenSave = OptionalTokenSave{1696 try stack.append(State{
1624 .id = Token.Id.Asterisk,1697 .OptionalTokenSave = OptionalTokenSave{
1625 .ptr = &node.ptr_token,1698 .id = Token.Id.Asterisk,
1626 } });1699 .ptr = &node.ptr_token,
1700 },
1701 });
1627 continue;1702 continue;
1628 },1703 },
1629 State.PointerIndexPayload => |opt_ctx| {1704 State.PointerIndexPayload => |opt_ctx| {
...@@ -1632,10 +1707,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -1632,10 +1707,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
1632 const token_ptr = token.ptr;1707 const token_ptr = token.ptr;
1633 if (token_ptr.id != Token.Id.Pipe) {1708 if (token_ptr.id != Token.Id.Pipe) {
1634 if (opt_ctx != OptionalCtx.Optional) {1709 if (opt_ctx != OptionalCtx.Optional) {
1635 ((try tree.errors.addOne())).* = Error{ .ExpectedToken = Error.ExpectedToken{1710 ((try tree.errors.addOne())).* = Error{
1636 .token = token_index,1711 .ExpectedToken = Error.ExpectedToken{
1637 .expected_id = Token.Id.Pipe,1712 .token = token_index,
1638 } };1713 .expected_id = Token.Id.Pipe,
1714 },
1715 };
1639 return tree;1716 return tree;
1640 }1717 }
16411718
...@@ -1653,17 +1730,21 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -1653,17 +1730,21 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
1653 });1730 });
1654 opt_ctx.store(&node.base);1731 opt_ctx.store(&node.base);
16551732
1656 stack.append(State{ .ExpectTokenSave = ExpectTokenSave{1733 stack.append(State{
1657 .id = Token.Id.Pipe,1734 .ExpectTokenSave = ExpectTokenSave{
1658 .ptr = &node.rpipe,1735 .id = Token.Id.Pipe,
1659 } }) catch unreachable;1736 .ptr = &node.rpipe,
1737 },
1738 }) catch unreachable;
1660 try stack.append(State{ .Identifier = OptionalCtx{ .RequiredNull = &node.index_symbol } });1739 try stack.append(State{ .Identifier = OptionalCtx{ .RequiredNull = &node.index_symbol } });
1661 try stack.append(State{ .IfToken = Token.Id.Comma });1740 try stack.append(State{ .IfToken = Token.Id.Comma });
1662 try stack.append(State{ .Identifier = OptionalCtx{ .Required = &node.value_symbol } });1741 try stack.append(State{ .Identifier = OptionalCtx{ .Required = &node.value_symbol } });
1663 try stack.append(State{ .OptionalTokenSave = OptionalTokenSave{1742 try stack.append(State{
1664 .id = Token.Id.Asterisk,1743 .OptionalTokenSave = OptionalTokenSave{
1665 .ptr = &node.ptr_token,1744 .id = Token.Id.Asterisk,
1666 } });1745 .ptr = &node.ptr_token,
1746 },
1747 });
1667 continue;1748 continue;
1668 },1749 },
16691750
...@@ -1672,9 +1753,7 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -1672,9 +1753,7 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
1672 const token_index = token.index;1753 const token_index = token.index;
1673 const token_ptr = token.ptr;1754 const token_ptr = token.ptr;
1674 switch (token_ptr.id) {1755 switch (token_ptr.id) {
1675 Token.Id.Keyword_return,1756 Token.Id.Keyword_return, Token.Id.Keyword_break, Token.Id.Keyword_continue => {
1676 Token.Id.Keyword_break,
1677 Token.Id.Keyword_continue => {
1678 const node = try arena.construct(ast.Node.ControlFlowExpression{1757 const node = try arena.construct(ast.Node.ControlFlowExpression{
1679 .base = ast.Node{ .id = ast.Node.Id.ControlFlowExpression },1758 .base = ast.Node{ .id = ast.Node.Id.ControlFlowExpression },
1680 .ltoken = token_index,1759 .ltoken = token_index,
...@@ -1703,9 +1782,7 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -1703,9 +1782,7 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
1703 }1782 }
1704 continue;1783 continue;
1705 },1784 },
1706 Token.Id.Keyword_try,1785 Token.Id.Keyword_try, Token.Id.Keyword_cancel, Token.Id.Keyword_resume => {
1707 Token.Id.Keyword_cancel,
1708 Token.Id.Keyword_resume => {
1709 const node = try arena.construct(ast.Node.PrefixOp{1786 const node = try arena.construct(ast.Node.PrefixOp{
1710 .base = ast.Node{ .id = ast.Node.Id.PrefixOp },1787 .base = ast.Node{ .id = ast.Node.Id.PrefixOp },
1711 .op_token = token_index,1788 .op_token = token_index,
...@@ -2078,10 +2155,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -2078,10 +2155,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
20782155
2079 stack.append(State{ .CurlySuffixExpressionEnd = opt_ctx.toRequired() }) catch unreachable;2156 stack.append(State{ .CurlySuffixExpressionEnd = opt_ctx.toRequired() }) catch unreachable;
2080 try stack.append(State{ .IfToken = Token.Id.LBrace });2157 try stack.append(State{ .IfToken = Token.Id.LBrace });
2081 try stack.append(State{ .FieldInitListItemOrEnd = ListSave(@typeOf(node.op.StructInitializer)){2158 try stack.append(State{
2082 .list = &node.op.StructInitializer,2159 .FieldInitListItemOrEnd = ListSave(@typeOf(node.op.StructInitializer)){
2083 .ptr = &node.rtoken,2160 .list = &node.op.StructInitializer,
2084 } });2161 .ptr = &node.rtoken,
2162 },
2163 });
2085 continue;2164 continue;
2086 }2165 }
20872166
...@@ -2094,11 +2173,13 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -2094,11 +2173,13 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
2094 opt_ctx.store(&node.base);2173 opt_ctx.store(&node.base);
2095 stack.append(State{ .CurlySuffixExpressionEnd = opt_ctx.toRequired() }) catch unreachable;2174 stack.append(State{ .CurlySuffixExpressionEnd = opt_ctx.toRequired() }) catch unreachable;
2096 try stack.append(State{ .IfToken = Token.Id.LBrace });2175 try stack.append(State{ .IfToken = Token.Id.LBrace });
2097 try stack.append(State{ .ExprListItemOrEnd = ExprListCtx{2176 try stack.append(State{
2098 .list = &node.op.ArrayInitializer,2177 .ExprListItemOrEnd = ExprListCtx{
2099 .end = Token.Id.RBrace,2178 .list = &node.op.ArrayInitializer,
2100 .ptr = &node.rtoken,2179 .end = Token.Id.RBrace,
2101 } });2180 .ptr = &node.rtoken,
2181 },
2182 });
2102 continue;2183 continue;
2103 },2184 },
21042185
...@@ -2171,10 +2252,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -2171,10 +2252,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
2171 .allocator_type = null,2252 .allocator_type = null,
2172 .rangle_bracket = null,2253 .rangle_bracket = null,
2173 });2254 });
2174 stack.append(State{ .AsyncEnd = AsyncEndCtx{2255 stack.append(State{
2175 .ctx = opt_ctx,2256 .AsyncEnd = AsyncEndCtx{
2176 .attribute = async_node,2257 .ctx = opt_ctx,
2177 } }) catch unreachable;2258 .attribute = async_node,
2259 },
2260 }) catch unreachable;
2178 try stack.append(State{ .SuffixOpExpressionEnd = opt_ctx.toRequired() });2261 try stack.append(State{ .SuffixOpExpressionEnd = opt_ctx.toRequired() });
2179 try stack.append(State{ .PrimaryExpression = opt_ctx.toRequired() });2262 try stack.append(State{ .PrimaryExpression = opt_ctx.toRequired() });
2180 try stack.append(State{ .AsyncAllocator = async_node });2263 try stack.append(State{ .AsyncAllocator = async_node });
...@@ -2197,20 +2280,24 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -2197,20 +2280,24 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
2197 const node = try arena.construct(ast.Node.SuffixOp{2280 const node = try arena.construct(ast.Node.SuffixOp{
2198 .base = ast.Node{ .id = ast.Node.Id.SuffixOp },2281 .base = ast.Node{ .id = ast.Node.Id.SuffixOp },
2199 .lhs = lhs,2282 .lhs = lhs,
2200 .op = ast.Node.SuffixOp.Op{ .Call = ast.Node.SuffixOp.Op.Call{2283 .op = ast.Node.SuffixOp.Op{
2201 .params = ast.Node.SuffixOp.Op.Call.ParamList.init(arena),2284 .Call = ast.Node.SuffixOp.Op.Call{
2202 .async_attr = null,2285 .params = ast.Node.SuffixOp.Op.Call.ParamList.init(arena),
2203 } },2286 .async_attr = null,
2287 },
2288 },
2204 .rtoken = undefined,2289 .rtoken = undefined,
2205 });2290 });
2206 opt_ctx.store(&node.base);2291 opt_ctx.store(&node.base);
22072292
2208 stack.append(State{ .SuffixOpExpressionEnd = opt_ctx.toRequired() }) catch unreachable;2293 stack.append(State{ .SuffixOpExpressionEnd = opt_ctx.toRequired() }) catch unreachable;
2209 try stack.append(State{ .ExprListItemOrEnd = ExprListCtx{2294 try stack.append(State{
2210 .list = &node.op.Call.params,2295 .ExprListItemOrEnd = ExprListCtx{
2211 .end = Token.Id.RParen,2296 .list = &node.op.Call.params,
2212 .ptr = &node.rtoken,2297 .end = Token.Id.RParen,
2213 } });2298 .ptr = &node.rtoken,
2299 },
2300 });
2214 continue;2301 continue;
2215 },2302 },
2216 Token.Id.LBracket => {2303 Token.Id.LBracket => {
...@@ -2278,8 +2365,7 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -2278,8 +2365,7 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
2278 _ = try createToCtxLiteral(arena, opt_ctx, ast.Node.UndefinedLiteral, token.index);2365 _ = try createToCtxLiteral(arena, opt_ctx, ast.Node.UndefinedLiteral, token.index);
2279 continue;2366 continue;
2280 },2367 },
2281 Token.Id.Keyword_true,2368 Token.Id.Keyword_true, Token.Id.Keyword_false => {
2282 Token.Id.Keyword_false => {
2283 _ = try createToCtxLiteral(arena, opt_ctx, ast.Node.BoolLiteral, token.index);2369 _ = try createToCtxLiteral(arena, opt_ctx, ast.Node.BoolLiteral, token.index);
2284 continue;2370 continue;
2285 },2371 },
...@@ -2321,8 +2407,7 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -2321,8 +2407,7 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
2321 try stack.append(State{ .Expression = OptionalCtx{ .Required = return_type_ptr } });2407 try stack.append(State{ .Expression = OptionalCtx{ .Required = return_type_ptr } });
2322 continue;2408 continue;
2323 },2409 },
2324 Token.Id.StringLiteral,2410 Token.Id.StringLiteral, Token.Id.MultilineStringLiteralLine => {
2325 Token.Id.MultilineStringLiteralLine => {
2326 opt_ctx.store((try parseStringLiteral(arena, &tok_it, token.ptr, token.index, &tree)) ?? unreachable);2411 opt_ctx.store((try parseStringLiteral(arena, &tok_it, token.ptr, token.index, &tree)) ?? unreachable);
2327 continue;2412 continue;
2328 },2413 },
...@@ -2335,10 +2420,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -2335,10 +2420,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
2335 });2420 });
2336 opt_ctx.store(&node.base);2421 opt_ctx.store(&node.base);
23372422
2338 stack.append(State{ .ExpectTokenSave = ExpectTokenSave{2423 stack.append(State{
2339 .id = Token.Id.RParen,2424 .ExpectTokenSave = ExpectTokenSave{
2340 .ptr = &node.rparen,2425 .id = Token.Id.RParen,
2341 } }) catch unreachable;2426 .ptr = &node.rparen,
2427 },
2428 }) catch unreachable;
2342 try stack.append(State{ .Expression = OptionalCtx{ .Required = &node.expr } });2429 try stack.append(State{ .Expression = OptionalCtx{ .Required = &node.expr } });
2343 continue;2430 continue;
2344 },2431 },
...@@ -2351,11 +2438,13 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -2351,11 +2438,13 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
2351 });2438 });
2352 opt_ctx.store(&node.base);2439 opt_ctx.store(&node.base);
23532440
2354 stack.append(State{ .ExprListItemOrEnd = ExprListCtx{2441 stack.append(State{
2355 .list = &node.params,2442 .ExprListItemOrEnd = ExprListCtx{
2356 .end = Token.Id.RParen,2443 .list = &node.params,
2357 .ptr = &node.rparen_token,2444 .end = Token.Id.RParen,
2358 } }) catch unreachable;2445 .ptr = &node.rparen_token,
2446 },
2447 }) catch unreachable;
2359 try stack.append(State{ .ExpectToken = Token.Id.LParen });2448 try stack.append(State{ .ExpectToken = Token.Id.LParen });
2360 continue;2449 continue;
2361 },2450 },
...@@ -2372,42 +2461,50 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -2372,42 +2461,50 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
2372 continue;2461 continue;
2373 },2462 },
2374 Token.Id.Keyword_error => {2463 Token.Id.Keyword_error => {
2375 stack.append(State{ .ErrorTypeOrSetDecl = ErrorTypeOrSetDeclCtx{2464 stack.append(State{
2376 .error_token = token.index,2465 .ErrorTypeOrSetDecl = ErrorTypeOrSetDeclCtx{
2377 .opt_ctx = opt_ctx,2466 .error_token = token.index,
2378 } }) catch unreachable;2467 .opt_ctx = opt_ctx,
2468 },
2469 }) catch unreachable;
2379 continue;2470 continue;
2380 },2471 },
2381 Token.Id.Keyword_packed => {2472 Token.Id.Keyword_packed => {
2382 stack.append(State{ .ContainerKind = ContainerKindCtx{2473 stack.append(State{
2383 .opt_ctx = opt_ctx,2474 .ContainerKind = ContainerKindCtx{
2384 .layout_token = token.index,2475 .opt_ctx = opt_ctx,
2385 } }) catch unreachable;2476 .layout_token = token.index,
2477 },
2478 }) catch unreachable;
2386 continue;2479 continue;
2387 },2480 },
2388 Token.Id.Keyword_extern => {2481 Token.Id.Keyword_extern => {
2389 stack.append(State{ .ExternType = ExternTypeCtx{2482 stack.append(State{
2390 .opt_ctx = opt_ctx,2483 .ExternType = ExternTypeCtx{
2391 .extern_token = token.index,2484 .opt_ctx = opt_ctx,
2392 .comments = null,2485 .extern_token = token.index,
2393 } }) catch unreachable;2486 .comments = null,
2487 },
2488 }) catch unreachable;
2394 continue;2489 continue;
2395 },2490 },
2396 Token.Id.Keyword_struct,2491 Token.Id.Keyword_struct, Token.Id.Keyword_union, Token.Id.Keyword_enum => {
2397 Token.Id.Keyword_union,
2398 Token.Id.Keyword_enum => {
2399 prevToken(&tok_it, &tree);2492 prevToken(&tok_it, &tree);
2400 stack.append(State{ .ContainerKind = ContainerKindCtx{2493 stack.append(State{
2401 .opt_ctx = opt_ctx,2494 .ContainerKind = ContainerKindCtx{
2402 .layout_token = null,2495 .opt_ctx = opt_ctx,
2403 } }) catch unreachable;2496 .layout_token = null,
2497 },
2498 }) catch unreachable;
2404 continue;2499 continue;
2405 },2500 },
2406 Token.Id.Identifier => {2501 Token.Id.Identifier => {
2407 stack.append(State{ .MaybeLabeledExpression = MaybeLabeledExpressionCtx{2502 stack.append(State{
2408 .label = token.index,2503 .MaybeLabeledExpression = MaybeLabeledExpressionCtx{
2409 .opt_ctx = opt_ctx,2504 .label = token.index,
2410 } }) catch unreachable;2505 .opt_ctx = opt_ctx,
2506 },
2507 }) catch unreachable;
2411 continue;2508 continue;
2412 },2509 },
2413 Token.Id.Keyword_fn => {2510 Token.Id.Keyword_fn => {
...@@ -2431,8 +2528,7 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -2431,8 +2528,7 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
2431 stack.append(State{ .FnProto = fn_proto }) catch unreachable;2528 stack.append(State{ .FnProto = fn_proto }) catch unreachable;
2432 continue;2529 continue;
2433 },2530 },
2434 Token.Id.Keyword_nakedcc,2531 Token.Id.Keyword_nakedcc, Token.Id.Keyword_stdcallcc => {
2435 Token.Id.Keyword_stdcallcc => {
2436 const fn_proto = try arena.construct(ast.Node.FnProto{2532 const fn_proto = try arena.construct(ast.Node.FnProto{
2437 .base = ast.Node{ .id = ast.Node.Id.FnProto },2533 .base = ast.Node{ .id = ast.Node.Id.FnProto },
2438 .doc_comments = null,2534 .doc_comments = null,
...@@ -2451,10 +2547,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -2451,10 +2547,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
2451 });2547 });
2452 opt_ctx.store(&fn_proto.base);2548 opt_ctx.store(&fn_proto.base);
2453 stack.append(State{ .FnProto = fn_proto }) catch unreachable;2549 stack.append(State{ .FnProto = fn_proto }) catch unreachable;
2454 try stack.append(State{ .ExpectTokenSave = ExpectTokenSave{2550 try stack.append(State{
2455 .id = Token.Id.Keyword_fn,2551 .ExpectTokenSave = ExpectTokenSave{
2456 .ptr = &fn_proto.fn_token,2552 .id = Token.Id.Keyword_fn,
2457 } });2553 .ptr = &fn_proto.fn_token,
2554 },
2555 });
2458 continue;2556 continue;
2459 },2557 },
2460 Token.Id.Keyword_asm => {2558 Token.Id.Keyword_asm => {
...@@ -2470,10 +2568,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -2470,10 +2568,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
2470 });2568 });
2471 opt_ctx.store(&node.base);2569 opt_ctx.store(&node.base);
24722570
2473 stack.append(State{ .ExpectTokenSave = ExpectTokenSave{2571 stack.append(State{
2474 .id = Token.Id.RParen,2572 .ExpectTokenSave = ExpectTokenSave{
2475 .ptr = &node.rparen,2573 .id = Token.Id.RParen,
2476 } }) catch unreachable;2574 .ptr = &node.rparen,
2575 },
2576 }) catch unreachable;
2477 try stack.append(State{ .AsmClobberItems = &node.clobbers });2577 try stack.append(State{ .AsmClobberItems = &node.clobbers });
2478 try stack.append(State{ .IfToken = Token.Id.Colon });2578 try stack.append(State{ .IfToken = Token.Id.Colon });
2479 try stack.append(State{ .AsmInputItems = &node.inputs });2579 try stack.append(State{ .AsmInputItems = &node.inputs });
...@@ -2482,17 +2582,21 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -2482,17 +2582,21 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
2482 try stack.append(State{ .IfToken = Token.Id.Colon });2582 try stack.append(State{ .IfToken = Token.Id.Colon });
2483 try stack.append(State{ .StringLiteral = OptionalCtx{ .Required = &node.template } });2583 try stack.append(State{ .StringLiteral = OptionalCtx{ .Required = &node.template } });
2484 try stack.append(State{ .ExpectToken = Token.Id.LParen });2584 try stack.append(State{ .ExpectToken = Token.Id.LParen });
2485 try stack.append(State{ .OptionalTokenSave = OptionalTokenSave{2585 try stack.append(State{
2486 .id = Token.Id.Keyword_volatile,2586 .OptionalTokenSave = OptionalTokenSave{
2487 .ptr = &node.volatile_token,2587 .id = Token.Id.Keyword_volatile,
2488 } });2588 .ptr = &node.volatile_token,
2589 },
2590 });
2489 },2591 },
2490 Token.Id.Keyword_inline => {2592 Token.Id.Keyword_inline => {
2491 stack.append(State{ .Inline = InlineCtx{2593 stack.append(State{
2492 .label = null,2594 .Inline = InlineCtx{
2493 .inline_token = token.index,2595 .label = null,
2494 .opt_ctx = opt_ctx,2596 .inline_token = token.index,
2495 } }) catch unreachable;2597 .opt_ctx = opt_ctx,
2598 },
2599 }) catch unreachable;
2496 continue;2600 continue;
2497 },2601 },
2498 else => {2602 else => {
...@@ -2522,10 +2626,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -2522,10 +2626,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
2522 });2626 });
2523 ctx.opt_ctx.store(&node.base);2627 ctx.opt_ctx.store(&node.base);
25242628
2525 stack.append(State{ .ErrorTagListItemOrEnd = ListSave(@typeOf(node.decls)){2629 stack.append(State{
2526 .list = &node.decls,2630 .ErrorTagListItemOrEnd = ListSave(@typeOf(node.decls)){
2527 .ptr = &node.rbrace_token,2631 .list = &node.decls,
2528 } }) catch unreachable;2632 .ptr = &node.rbrace_token,
2633 },
2634 }) catch unreachable;
2529 continue;2635 continue;
2530 },2636 },
2531 State.StringLiteral => |opt_ctx| {2637 State.StringLiteral => |opt_ctx| {
...@@ -2553,10 +2659,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -2553,10 +2659,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
2553 const token = nextToken(&tok_it, &tree);2659 const token = nextToken(&tok_it, &tree);
2554 const token_index = token.index;2660 const token_index = token.index;
2555 const token_ptr = token.ptr;2661 const token_ptr = token.ptr;
2556 ((try tree.errors.addOne())).* = Error{ .ExpectedToken = Error.ExpectedToken{2662 ((try tree.errors.addOne())).* = Error{
2557 .token = token_index,2663 .ExpectedToken = Error.ExpectedToken{
2558 .expected_id = Token.Id.Identifier,2664 .token = token_index,
2559 } };2665 .expected_id = Token.Id.Identifier,
2666 },
2667 };
2560 return tree;2668 return tree;
2561 }2669 }
2562 },2670 },
...@@ -2567,10 +2675,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -2567,10 +2675,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
2567 const ident_token_index = ident_token.index;2675 const ident_token_index = ident_token.index;
2568 const ident_token_ptr = ident_token.ptr;2676 const ident_token_ptr = ident_token.ptr;
2569 if (ident_token_ptr.id != Token.Id.Identifier) {2677 if (ident_token_ptr.id != Token.Id.Identifier) {
2570 ((try tree.errors.addOne())).* = Error{ .ExpectedToken = Error.ExpectedToken{2678 ((try tree.errors.addOne())).* = Error{
2571 .token = ident_token_index,2679 .ExpectedToken = Error.ExpectedToken{
2572 .expected_id = Token.Id.Identifier,2680 .token = ident_token_index,
2573 } };2681 .expected_id = Token.Id.Identifier,
2682 },
2683 };
2574 return tree;2684 return tree;
2575 }2685 }
25762686
...@@ -2588,10 +2698,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -2588,10 +2698,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
2588 const token_index = token.index;2698 const token_index = token.index;
2589 const token_ptr = token.ptr;2699 const token_ptr = token.ptr;
2590 if (token_ptr.id != token_id) {2700 if (token_ptr.id != token_id) {
2591 ((try tree.errors.addOne())).* = Error{ .ExpectedToken = Error.ExpectedToken{2701 ((try tree.errors.addOne())).* = Error{
2592 .token = token_index,2702 .ExpectedToken = Error.ExpectedToken{
2593 .expected_id = token_id,2703 .token = token_index,
2594 } };2704 .expected_id = token_id,
2705 },
2706 };
2595 return tree;2707 return tree;
2596 }2708 }
2597 continue;2709 continue;
...@@ -2601,10 +2713,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {...@@ -2601,10 +2713,12 @@ pub fn parse(allocator: &mem.Allocator, source: []const u8) !ast.Tree {
2601 const token_index = token.index;2713 const token_index = token.index;
2602 const token_ptr = token.ptr;2714 const token_ptr = token.ptr;
2603 if (token_ptr.id != expect_token_save.id) {2715 if (token_ptr.id != expect_token_save.id) {
2604 ((try tree.errors.addOne())).* = Error{ .ExpectedToken = Error.ExpectedToken{2716 ((try tree.errors.addOne())).* = Error{
2605 .token = token_index,2717 .ExpectedToken = Error.ExpectedToken{
2606 .expected_id = expect_token_save.id,2718 .token = token_index,
2607 } };2719 .expected_id = expect_token_save.id,
2720 },
2721 };
2608 return tree;2722 return tree;
2609 }2723 }
2610 expect_token_save.ptr.* = token_index;2724 expect_token_save.ptr.* = token_index;
...@@ -2997,21 +3111,25 @@ fn parseBlockExpr(stack: &std.ArrayList(State), arena: &mem.Allocator, ctx: &con...@@ -2997,21 +3111,25 @@ fn parseBlockExpr(stack: &std.ArrayList(State), arena: &mem.Allocator, ctx: &con
2997 return true;3111 return true;
2998 },3112 },
2999 Token.Id.Keyword_while => {3113 Token.Id.Keyword_while => {
3000 stack.append(State{ .While = LoopCtx{3114 stack.append(State{
3001 .label = null,3115 .While = LoopCtx{
3002 .inline_token = null,3116 .label = null,
3003 .loop_token = token_index,3117 .inline_token = null,
3004 .opt_ctx = ctx.*,3118 .loop_token = token_index,
3005 } }) catch unreachable;3119 .opt_ctx = ctx.*,
3120 },
3121 }) catch unreachable;
3006 return true;3122 return true;
3007 },3123 },
3008 Token.Id.Keyword_for => {3124 Token.Id.Keyword_for => {
3009 stack.append(State{ .For = LoopCtx{3125 stack.append(State{
3010 .label = null,3126 .For = LoopCtx{
3011 .inline_token = null,3127 .label = null,
3012 .loop_token = token_index,3128 .inline_token = null,
3013 .opt_ctx = ctx.*,3129 .loop_token = token_index,
3014 } }) catch unreachable;3130 .opt_ctx = ctx.*,
3131 },
3132 }) catch unreachable;
3015 return true;3133 return true;
3016 },3134 },
3017 Token.Id.Keyword_switch => {3135 Token.Id.Keyword_switch => {
...@@ -3024,10 +3142,12 @@ fn parseBlockExpr(stack: &std.ArrayList(State), arena: &mem.Allocator, ctx: &con...@@ -3024,10 +3142,12 @@ fn parseBlockExpr(stack: &std.ArrayList(State), arena: &mem.Allocator, ctx: &con
3024 });3142 });
3025 ctx.store(&node.base);3143 ctx.store(&node.base);
30263144
3027 stack.append(State{ .SwitchCaseOrEnd = ListSave(@typeOf(node.cases)){3145 stack.append(State{
3028 .list = &node.cases,3146 .SwitchCaseOrEnd = ListSave(@typeOf(node.cases)){
3029 .ptr = &node.rbrace,3147 .list = &node.cases,
3030 } }) catch unreachable;3148 .ptr = &node.rbrace,
3149 },
3150 }) catch unreachable;
3031 try stack.append(State{ .ExpectToken = Token.Id.LBrace });3151 try stack.append(State{ .ExpectToken = Token.Id.LBrace });
3032 try stack.append(State{ .ExpectToken = Token.Id.RParen });3152 try stack.append(State{ .ExpectToken = Token.Id.RParen });
3033 try stack.append(State{ .Expression = OptionalCtx{ .Required = &node.expr } });3153 try stack.append(State{ .Expression = OptionalCtx{ .Required = &node.expr } });
...@@ -3080,10 +3200,14 @@ fn expectCommaOrEnd(tok_it: &ast.Tree.TokenList.Iterator, tree: &ast.Tree, end:...@@ -3080,10 +3200,14 @@ fn expectCommaOrEnd(tok_it: &ast.Tree.TokenList.Iterator, tree: &ast.Tree, end:
3080 return ExpectCommaOrEndResult{ .end_token = token_index };3200 return ExpectCommaOrEndResult{ .end_token = token_index };
3081 }3201 }
30823202
3083 return ExpectCommaOrEndResult{ .parse_error = Error{ .ExpectedCommaOrEnd = Error.ExpectedCommaOrEnd{3203 return ExpectCommaOrEndResult{
3084 .token = token_index,3204 .parse_error = Error{
3085 .end_id = end,3205 .ExpectedCommaOrEnd = Error.ExpectedCommaOrEnd{
3086 } } };3206 .token = token_index,
3207 .end_id = end,
3208 },
3209 },
3210 };
3087 },3211 },
3088 }3212 }
3089}3213}
...@@ -3167,13 +3291,14 @@ fn tokenIdToPrefixOp(id: @TagType(Token.Id)) ?ast.Node.PrefixOp.Op {...@@ -3167,13 +3291,14 @@ fn tokenIdToPrefixOp(id: @TagType(Token.Id)) ?ast.Node.PrefixOp.Op {
3167 Token.Id.Tilde => ast.Node.PrefixOp.Op{ .BitNot = void{} },3291 Token.Id.Tilde => ast.Node.PrefixOp.Op{ .BitNot = void{} },
3168 Token.Id.Minus => ast.Node.PrefixOp.Op{ .Negation = void{} },3292 Token.Id.Minus => ast.Node.PrefixOp.Op{ .Negation = void{} },
3169 Token.Id.MinusPercent => ast.Node.PrefixOp.Op{ .NegationWrap = void{} },3293 Token.Id.MinusPercent => ast.Node.PrefixOp.Op{ .NegationWrap = void{} },
3170 Token.Id.Asterisk,3294 Token.Id.Asterisk, Token.Id.AsteriskAsterisk => ast.Node.PrefixOp.Op{ .PointerType = void{} },
3171 Token.Id.AsteriskAsterisk => ast.Node.PrefixOp.Op{ .PointerType = void{} },3295 Token.Id.Ampersand => ast.Node.PrefixOp.Op{
3172 Token.Id.Ampersand => ast.Node.PrefixOp.Op{ .AddrOf = ast.Node.PrefixOp.AddrOfInfo{3296 .AddrOf = ast.Node.PrefixOp.AddrOfInfo{
3173 .align_info = null,3297 .align_info = null,
3174 .const_token = null,3298 .const_token = null,
3175 .volatile_token = null,3299 .volatile_token = null,
3176 } },3300 },
3301 },
3177 Token.Id.QuestionMark => ast.Node.PrefixOp.Op{ .MaybeType = void{} },3302 Token.Id.QuestionMark => ast.Node.PrefixOp.Op{ .MaybeType = void{} },
3178 Token.Id.QuestionMarkQuestionMark => ast.Node.PrefixOp.Op{ .UnwrapMaybe = void{} },3303 Token.Id.QuestionMarkQuestionMark => ast.Node.PrefixOp.Op{ .UnwrapMaybe = void{} },
3179 Token.Id.Keyword_await => ast.Node.PrefixOp.Op{ .Await = void{} },3304 Token.Id.Keyword_await => ast.Node.PrefixOp.Op{ .Await = void{} },
std/zig/parser_test.zig+13-9
...@@ -1021,7 +1021,7 @@ test "zig fmt: extern declaration" {...@@ -1021,7 +1021,7 @@ test "zig fmt: extern declaration" {
1021}1021}
10221022
1023test "zig fmt: alignment" {1023test "zig fmt: alignment" {
1024 try testCanonical(1024 try testCanonical(
1025 \\var foo: c_int align(1);1025 \\var foo: c_int align(1);
1026 \\1026 \\
1027 );1027 );
...@@ -1070,7 +1070,7 @@ test "zig fmt: slice attributes" {...@@ -1070,7 +1070,7 @@ test "zig fmt: slice attributes" {
1070}1070}
10711071
1072test "zig fmt: test declaration" {1072test "zig fmt: test declaration" {
1073 try testCanonical(1073 try testCanonical(
1074 \\test "test name" {1074 \\test "test name" {
1075 \\ const a = 1;1075 \\ const a = 1;
1076 \\ var b = 1;1076 \\ var b = 1;
...@@ -1312,7 +1312,7 @@ test "zig fmt: struct declaration" {...@@ -1312,7 +1312,7 @@ test "zig fmt: struct declaration" {
1312}1312}
13131313
1314test "zig fmt: enum declaration" {1314test "zig fmt: enum declaration" {
1315 try testCanonical(1315 try testCanonical(
1316 \\const E = enum {1316 \\const E = enum {
1317 \\ Ok,1317 \\ Ok,
1318 \\ SomethingElse = 0,1318 \\ SomethingElse = 0,
...@@ -1340,7 +1340,7 @@ test "zig fmt: enum declaration" {...@@ -1340,7 +1340,7 @@ test "zig fmt: enum declaration" {
1340}1340}
13411341
1342test "zig fmt: union declaration" {1342test "zig fmt: union declaration" {
1343 try testCanonical(1343 try testCanonical(
1344 \\const U = union {1344 \\const U = union {
1345 \\ Int: u8,1345 \\ Int: u8,
1346 \\ Float: f32,1346 \\ Float: f32,
...@@ -1860,10 +1860,15 @@ fn testTransform(source: []const u8, expected_source: []const u8) !void {...@@ -1860,10 +1860,15 @@ fn testTransform(source: []const u8, expected_source: []const u8) !void {
1860 } else |err| switch (err) {1860 } else |err| switch (err) {
1861 error.OutOfMemory => {1861 error.OutOfMemory => {
1862 if (failing_allocator.allocated_bytes != failing_allocator.freed_bytes) {1862 if (failing_allocator.allocated_bytes != failing_allocator.freed_bytes) {
1863 warn("\nfail_index: {}/{}\nallocated bytes: {}\nfreed bytes: {}\nallocations: {}\ndeallocations: {}\n",1863 warn(
1864 fail_index, needed_alloc_count,1864 "\nfail_index: {}/{}\nallocated bytes: {}\nfreed bytes: {}\nallocations: {}\ndeallocations: {}\n",
1865 failing_allocator.allocated_bytes, failing_allocator.freed_bytes,1865 fail_index,
1866 failing_allocator.index, failing_allocator.deallocations);1866 needed_alloc_count,
1867 failing_allocator.allocated_bytes,
1868 failing_allocator.freed_bytes,
1869 failing_allocator.index,
1870 failing_allocator.deallocations,
1871 );
1867 return error.MemoryLeakDetected;1872 return error.MemoryLeakDetected;
1868 }1873 }
1869 },1874 },
...@@ -1876,4 +1881,3 @@ fn testTransform(source: []const u8, expected_source: []const u8) !void {...@@ -1876,4 +1881,3 @@ fn testTransform(source: []const u8, expected_source: []const u8) !void {
1876fn testCanonical(source: []const u8) !void {1881fn testCanonical(source: []const u8) !void {
1877 return testTransform(source, source);1882 return testTransform(source, source);
1878}1883}
1879
std/zig/render.zig+48-12
...@@ -161,7 +161,15 @@ fn renderTopLevelDecl(allocator: &mem.Allocator, stream: var, tree: &ast.Tree, i...@@ -161,7 +161,15 @@ fn renderTopLevelDecl(allocator: &mem.Allocator, stream: var, tree: &ast.Tree, i
161 }161 }
162}162}
163163
164fn renderExpression(allocator: &mem.Allocator, stream: var, tree: &ast.Tree, indent: usize, start_col: &usize, base: &ast.Node, space: Space,) (@typeOf(stream).Child.Error || Error)!void {164fn renderExpression(
165 allocator: &mem.Allocator,
166 stream: var,
167 tree: &ast.Tree,
168 indent: usize,
169 start_col: &usize,
170 base: &ast.Node,
171 space: Space,
172) (@typeOf(stream).Child.Error || Error)!void {
165 switch (base.id) {173 switch (base.id) {
166 ast.Node.Id.Identifier => {174 ast.Node.Id.Identifier => {
167 const identifier = @fieldParentPtr(ast.Node.Identifier, "base", base);175 const identifier = @fieldParentPtr(ast.Node.Identifier, "base", base);
...@@ -259,8 +267,7 @@ fn renderExpression(allocator: &mem.Allocator, stream: var, tree: &ast.Tree, ind...@@ -259,8 +267,7 @@ fn renderExpression(allocator: &mem.Allocator, stream: var, tree: &ast.Tree, ind
259 try renderExpression(allocator, stream, tree, indent, start_col, infix_op_node.lhs, op_space);267 try renderExpression(allocator, stream, tree, indent, start_col, infix_op_node.lhs, op_space);
260268
261 const after_op_space = blk: {269 const after_op_space = blk: {
262 const loc = tree.tokenLocation(tree.tokens.at(infix_op_node.op_token).end,270 const loc = tree.tokenLocation(tree.tokens.at(infix_op_node.op_token).end, tree.nextToken(infix_op_node.op_token));
263 tree.nextToken(infix_op_node.op_token));
264 break :blk if (loc.line == 0) op_space else Space.Newline;271 break :blk if (loc.line == 0) op_space else Space.Newline;
265 };272 };
266273
...@@ -367,14 +374,16 @@ fn renderExpression(allocator: &mem.Allocator, stream: var, tree: &ast.Tree, ind...@@ -367,14 +374,16 @@ fn renderExpression(allocator: &mem.Allocator, stream: var, tree: &ast.Tree, ind
367 ast.Node.PrefixOp.Op.NegationWrap,374 ast.Node.PrefixOp.Op.NegationWrap,
368 ast.Node.PrefixOp.Op.UnwrapMaybe,375 ast.Node.PrefixOp.Op.UnwrapMaybe,
369 ast.Node.PrefixOp.Op.MaybeType,376 ast.Node.PrefixOp.Op.MaybeType,
370 ast.Node.PrefixOp.Op.PointerType => {377 ast.Node.PrefixOp.Op.PointerType,
378 => {
371 try renderToken(tree, stream, prefix_op_node.op_token, indent, start_col, Space.None);379 try renderToken(tree, stream, prefix_op_node.op_token, indent, start_col, Space.None);
372 },380 },
373381
374 ast.Node.PrefixOp.Op.Try,382 ast.Node.PrefixOp.Op.Try,
375 ast.Node.PrefixOp.Op.Await,383 ast.Node.PrefixOp.Op.Await,
376 ast.Node.PrefixOp.Op.Cancel,384 ast.Node.PrefixOp.Op.Cancel,
377 ast.Node.PrefixOp.Op.Resume => {385 ast.Node.PrefixOp.Op.Resume,
386 => {
378 try renderToken(tree, stream, prefix_op_node.op_token, indent, start_col, Space.Space);387 try renderToken(tree, stream, prefix_op_node.op_token, indent, start_col, Space.Space);
379 },388 },
380 }389 }
...@@ -1568,13 +1577,19 @@ fn renderExpression(allocator: &mem.Allocator, stream: var, tree: &ast.Tree, ind...@@ -1568,13 +1577,19 @@ fn renderExpression(allocator: &mem.Allocator, stream: var, tree: &ast.Tree, ind
1568 ast.Node.Id.VarDecl,1577 ast.Node.Id.VarDecl,
1569 ast.Node.Id.Use,1578 ast.Node.Id.Use,
1570 ast.Node.Id.TestDecl,1579 ast.Node.Id.TestDecl,
1571 ast.Node.Id.ParamDecl => unreachable,1580 ast.Node.Id.ParamDecl,
1581 => unreachable,
1572 }1582 }
1573}1583}
15741584
1575fn renderVarDecl(allocator: &mem.Allocator, stream: var, tree: &ast.Tree, indent: usize, start_col: &usize,1585fn renderVarDecl(
1576 var_decl: &ast.Node.VarDecl,) (@typeOf(stream).Child.Error || Error)!void1586 allocator: &mem.Allocator,
1577{1587 stream: var,
1588 tree: &ast.Tree,
1589 indent: usize,
1590 start_col: &usize,
1591 var_decl: &ast.Node.VarDecl,
1592) (@typeOf(stream).Child.Error || Error)!void {
1578 if (var_decl.visib_token) |visib_token| {1593 if (var_decl.visib_token) |visib_token| {
1579 try renderToken(tree, stream, visib_token, indent, start_col, Space.Space); // pub1594 try renderToken(tree, stream, visib_token, indent, start_col, Space.Space); // pub
1580 }1595 }
...@@ -1623,7 +1638,15 @@ fn renderVarDecl(allocator: &mem.Allocator, stream: var, tree: &ast.Tree, indent...@@ -1623,7 +1638,15 @@ fn renderVarDecl(allocator: &mem.Allocator, stream: var, tree: &ast.Tree, indent
1623 try renderToken(tree, stream, var_decl.semicolon_token, indent, start_col, Space.Newline);1638 try renderToken(tree, stream, var_decl.semicolon_token, indent, start_col, Space.Newline);
1624}1639}
16251640
1626fn renderParamDecl(allocator: &mem.Allocator, stream: var, tree: &ast.Tree, indent: usize, start_col: &usize, base: &ast.Node, space: Space,) (@typeOf(stream).Child.Error || Error)!void {1641fn renderParamDecl(
1642 allocator: &mem.Allocator,
1643 stream: var,
1644 tree: &ast.Tree,
1645 indent: usize,
1646 start_col: &usize,
1647 base: &ast.Node,
1648 space: Space,
1649) (@typeOf(stream).Child.Error || Error)!void {
1627 const param_decl = @fieldParentPtr(ast.Node.ParamDecl, "base", base);1650 const param_decl = @fieldParentPtr(ast.Node.ParamDecl, "base", base);
16281651
1629 if (param_decl.comptime_token) |comptime_token| {1652 if (param_decl.comptime_token) |comptime_token| {
...@@ -1643,7 +1666,14 @@ fn renderParamDecl(allocator: &mem.Allocator, stream: var, tree: &ast.Tree, inde...@@ -1643,7 +1666,14 @@ fn renderParamDecl(allocator: &mem.Allocator, stream: var, tree: &ast.Tree, inde
1643 }1666 }
1644}1667}
16451668
1646fn renderStatement(allocator: &mem.Allocator, stream: var, tree: &ast.Tree, indent: usize, start_col: &usize, base: &ast.Node,) (@typeOf(stream).Child.Error || Error)!void {1669fn renderStatement(
1670 allocator: &mem.Allocator,
1671 stream: var,
1672 tree: &ast.Tree,
1673 indent: usize,
1674 start_col: &usize,
1675 base: &ast.Node,
1676) (@typeOf(stream).Child.Error || Error)!void {
1647 switch (base.id) {1677 switch (base.id) {
1648 ast.Node.Id.VarDecl => {1678 ast.Node.Id.VarDecl => {
1649 const var_decl = @fieldParentPtr(ast.Node.VarDecl, "base", base);1679 const var_decl = @fieldParentPtr(ast.Node.VarDecl, "base", base);
...@@ -1840,7 +1870,13 @@ fn renderToken(tree: &ast.Tree, stream: var, token_index: ast.TokenIndex, indent...@@ -1840,7 +1870,13 @@ fn renderToken(tree: &ast.Tree, stream: var, token_index: ast.TokenIndex, indent
1840 }1870 }
1841}1871}
18421872
1843fn renderDocComments(tree: &ast.Tree, stream: var, node: var, indent: usize, start_col: &usize,) (@typeOf(stream).Child.Error || Error)!void {1873fn renderDocComments(
1874 tree: &ast.Tree,
1875 stream: var,
1876 node: var,
1877 indent: usize,
1878 start_col: &usize,
1879) (@typeOf(stream).Child.Error || Error)!void {
1844 const comment = node.doc_comments ?? return;1880 const comment = node.doc_comments ?? return;
1845 var it = comment.lines.iterator(0);1881 var it = comment.lines.iterator(0);
1846 const first_token = node.firstToken();1882 const first_token = node.firstToken();
std/zig/tokenizer.zig+101-101
...@@ -11,55 +11,55 @@ pub const Token = struct {...@@ -11,55 +11,55 @@ pub const Token = struct {
11 id: Id,11 id: Id,
12 };12 };
1313
14 pub const keywords = []Keyword {14 pub const keywords = []Keyword{
15 Keyword{.bytes="align", .id = Id.Keyword_align},15 Keyword{ .bytes = "align", .id = Id.Keyword_align },
16 Keyword{.bytes="and", .id = Id.Keyword_and},16 Keyword{ .bytes = "and", .id = Id.Keyword_and },
17 Keyword{.bytes="asm", .id = Id.Keyword_asm},17 Keyword{ .bytes = "asm", .id = Id.Keyword_asm },
18 Keyword{.bytes="async", .id = Id.Keyword_async},18 Keyword{ .bytes = "async", .id = Id.Keyword_async },
19 Keyword{.bytes="await", .id = Id.Keyword_await},19 Keyword{ .bytes = "await", .id = Id.Keyword_await },
20 Keyword{.bytes="break", .id = Id.Keyword_break},20 Keyword{ .bytes = "break", .id = Id.Keyword_break },
21 Keyword{.bytes="catch", .id = Id.Keyword_catch},21 Keyword{ .bytes = "catch", .id = Id.Keyword_catch },
22 Keyword{.bytes="cancel", .id = Id.Keyword_cancel},22 Keyword{ .bytes = "cancel", .id = Id.Keyword_cancel },
23 Keyword{.bytes="comptime", .id = Id.Keyword_comptime},23 Keyword{ .bytes = "comptime", .id = Id.Keyword_comptime },
24 Keyword{.bytes="const", .id = Id.Keyword_const},24 Keyword{ .bytes = "const", .id = Id.Keyword_const },
25 Keyword{.bytes="continue", .id = Id.Keyword_continue},25 Keyword{ .bytes = "continue", .id = Id.Keyword_continue },
26 Keyword{.bytes="defer", .id = Id.Keyword_defer},26 Keyword{ .bytes = "defer", .id = Id.Keyword_defer },
27 Keyword{.bytes="else", .id = Id.Keyword_else},27 Keyword{ .bytes = "else", .id = Id.Keyword_else },
28 Keyword{.bytes="enum", .id = Id.Keyword_enum},28 Keyword{ .bytes = "enum", .id = Id.Keyword_enum },
29 Keyword{.bytes="errdefer", .id = Id.Keyword_errdefer},29 Keyword{ .bytes = "errdefer", .id = Id.Keyword_errdefer },
30 Keyword{.bytes="error", .id = Id.Keyword_error},30 Keyword{ .bytes = "error", .id = Id.Keyword_error },
31 Keyword{.bytes="export", .id = Id.Keyword_export},31 Keyword{ .bytes = "export", .id = Id.Keyword_export },
32 Keyword{.bytes="extern", .id = Id.Keyword_extern},32 Keyword{ .bytes = "extern", .id = Id.Keyword_extern },
33 Keyword{.bytes="false", .id = Id.Keyword_false},33 Keyword{ .bytes = "false", .id = Id.Keyword_false },
34 Keyword{.bytes="fn", .id = Id.Keyword_fn},34 Keyword{ .bytes = "fn", .id = Id.Keyword_fn },
35 Keyword{.bytes="for", .id = Id.Keyword_for},35 Keyword{ .bytes = "for", .id = Id.Keyword_for },
36 Keyword{.bytes="if", .id = Id.Keyword_if},36 Keyword{ .bytes = "if", .id = Id.Keyword_if },
37 Keyword{.bytes="inline", .id = Id.Keyword_inline},37 Keyword{ .bytes = "inline", .id = Id.Keyword_inline },
38 Keyword{.bytes="nakedcc", .id = Id.Keyword_nakedcc},38 Keyword{ .bytes = "nakedcc", .id = Id.Keyword_nakedcc },
39 Keyword{.bytes="noalias", .id = Id.Keyword_noalias},39 Keyword{ .bytes = "noalias", .id = Id.Keyword_noalias },
40 Keyword{.bytes="null", .id = Id.Keyword_null},40 Keyword{ .bytes = "null", .id = Id.Keyword_null },
41 Keyword{.bytes="or", .id = Id.Keyword_or},41 Keyword{ .bytes = "or", .id = Id.Keyword_or },
42 Keyword{.bytes="packed", .id = Id.Keyword_packed},42 Keyword{ .bytes = "packed", .id = Id.Keyword_packed },
43 Keyword{.bytes="promise", .id = Id.Keyword_promise},43 Keyword{ .bytes = "promise", .id = Id.Keyword_promise },
44 Keyword{.bytes="pub", .id = Id.Keyword_pub},44 Keyword{ .bytes = "pub", .id = Id.Keyword_pub },
45 Keyword{.bytes="resume", .id = Id.Keyword_resume},45 Keyword{ .bytes = "resume", .id = Id.Keyword_resume },
46 Keyword{.bytes="return", .id = Id.Keyword_return},46 Keyword{ .bytes = "return", .id = Id.Keyword_return },
47 Keyword{.bytes="section", .id = Id.Keyword_section},47 Keyword{ .bytes = "section", .id = Id.Keyword_section },
48 Keyword{.bytes="stdcallcc", .id = Id.Keyword_stdcallcc},48 Keyword{ .bytes = "stdcallcc", .id = Id.Keyword_stdcallcc },
49 Keyword{.bytes="struct", .id = Id.Keyword_struct},49 Keyword{ .bytes = "struct", .id = Id.Keyword_struct },
50 Keyword{.bytes="suspend", .id = Id.Keyword_suspend},50 Keyword{ .bytes = "suspend", .id = Id.Keyword_suspend },
51 Keyword{.bytes="switch", .id = Id.Keyword_switch},51 Keyword{ .bytes = "switch", .id = Id.Keyword_switch },
52 Keyword{.bytes="test", .id = Id.Keyword_test},52 Keyword{ .bytes = "test", .id = Id.Keyword_test },
53 Keyword{.bytes="this", .id = Id.Keyword_this},53 Keyword{ .bytes = "this", .id = Id.Keyword_this },
54 Keyword{.bytes="true", .id = Id.Keyword_true},54 Keyword{ .bytes = "true", .id = Id.Keyword_true },
55 Keyword{.bytes="try", .id = Id.Keyword_try},55 Keyword{ .bytes = "try", .id = Id.Keyword_try },
56 Keyword{.bytes="undefined", .id = Id.Keyword_undefined},56 Keyword{ .bytes = "undefined", .id = Id.Keyword_undefined },
57 Keyword{.bytes="union", .id = Id.Keyword_union},57 Keyword{ .bytes = "union", .id = Id.Keyword_union },
58 Keyword{.bytes="unreachable", .id = Id.Keyword_unreachable},58 Keyword{ .bytes = "unreachable", .id = Id.Keyword_unreachable },
59 Keyword{.bytes="use", .id = Id.Keyword_use},59 Keyword{ .bytes = "use", .id = Id.Keyword_use },
60 Keyword{.bytes="var", .id = Id.Keyword_var},60 Keyword{ .bytes = "var", .id = Id.Keyword_var },
61 Keyword{.bytes="volatile", .id = Id.Keyword_volatile},61 Keyword{ .bytes = "volatile", .id = Id.Keyword_volatile },
62 Keyword{.bytes="while", .id = Id.Keyword_while},62 Keyword{ .bytes = "while", .id = Id.Keyword_while },
63 };63 };
6464
65 // TODO perfect hash at comptime65 // TODO perfect hash at comptime
...@@ -72,7 +72,10 @@ pub const Token = struct {...@@ -72,7 +72,10 @@ pub const Token = struct {
72 return null;72 return null;
73 }73 }
7474
75 const StrLitKind = enum {Normal, C};75 const StrLitKind = enum {
76 Normal,
77 C,
78 };
7679
77 pub const Id = union(enum) {80 pub const Id = union(enum) {
78 Invalid,81 Invalid,
...@@ -202,7 +205,7 @@ pub const Tokenizer = struct {...@@ -202,7 +205,7 @@ pub const Tokenizer = struct {
202 }205 }
203206
204 pub fn init(buffer: []const u8) Tokenizer {207 pub fn init(buffer: []const u8) Tokenizer {
205 return Tokenizer {208 return Tokenizer{
206 .buffer = buffer,209 .buffer = buffer,
207 .index = 0,210 .index = 0,
208 .pending_invalid_token = null,211 .pending_invalid_token = null,
...@@ -269,7 +272,7 @@ pub const Tokenizer = struct {...@@ -269,7 +272,7 @@ pub const Tokenizer = struct {
269 }272 }
270 const start_index = self.index;273 const start_index = self.index;
271 var state = State.Start;274 var state = State.Start;
272 var result = Token {275 var result = Token{
273 .id = Token.Id.Eof,276 .id = Token.Id.Eof,
274 .start = self.index,277 .start = self.index,
275 .end = undefined,278 .end = undefined,
...@@ -290,7 +293,7 @@ pub const Tokenizer = struct {...@@ -290,7 +293,7 @@ pub const Tokenizer = struct {
290 },293 },
291 '"' => {294 '"' => {
292 state = State.StringLiteral;295 state = State.StringLiteral;
293 result.id = Token.Id { .StringLiteral = Token.StrLitKind.Normal };296 result.id = Token.Id{ .StringLiteral = Token.StrLitKind.Normal };
294 },297 },
295 '\'' => {298 '\'' => {
296 state = State.CharLiteral;299 state = State.CharLiteral;
...@@ -369,7 +372,7 @@ pub const Tokenizer = struct {...@@ -369,7 +372,7 @@ pub const Tokenizer = struct {
369 },372 },
370 '\\' => {373 '\\' => {
371 state = State.Backslash;374 state = State.Backslash;
372 result.id = Token.Id { .MultilineStringLiteralLine = Token.StrLitKind.Normal };375 result.id = Token.Id{ .MultilineStringLiteralLine = Token.StrLitKind.Normal };
373 },376 },
374 '{' => {377 '{' => {
375 result.id = Token.Id.LBrace;378 result.id = Token.Id.LBrace;
...@@ -455,7 +458,7 @@ pub const Tokenizer = struct {...@@ -455,7 +458,7 @@ pub const Tokenizer = struct {
455 else => {458 else => {
456 result.id = Token.Id.Asterisk;459 result.id = Token.Id.Asterisk;
457 break;460 break;
458 }461 },
459 },462 },
460463
461 State.AsteriskPercent => switch (c) {464 State.AsteriskPercent => switch (c) {
...@@ -467,7 +470,7 @@ pub const Tokenizer = struct {...@@ -467,7 +470,7 @@ pub const Tokenizer = struct {
467 else => {470 else => {
468 result.id = Token.Id.AsteriskPercent;471 result.id = Token.Id.AsteriskPercent;
469 break;472 break;
470 }473 },
471 },474 },
472475
473 State.QuestionMark => switch (c) {476 State.QuestionMark => switch (c) {
...@@ -535,7 +538,7 @@ pub const Tokenizer = struct {...@@ -535,7 +538,7 @@ pub const Tokenizer = struct {
535 else => {538 else => {
536 result.id = Token.Id.Caret;539 result.id = Token.Id.Caret;
537 break;540 break;
538 }541 },
539 },542 },
540543
541 State.Identifier => switch (c) {544 State.Identifier => switch (c) {
...@@ -560,11 +563,11 @@ pub const Tokenizer = struct {...@@ -560,11 +563,11 @@ pub const Tokenizer = struct {
560 State.C => switch (c) {563 State.C => switch (c) {
561 '\\' => {564 '\\' => {
562 state = State.Backslash;565 state = State.Backslash;
563 result.id = Token.Id { .MultilineStringLiteralLine = Token.StrLitKind.C };566 result.id = Token.Id{ .MultilineStringLiteralLine = Token.StrLitKind.C };
564 },567 },
565 '"' => {568 '"' => {
566 state = State.StringLiteral;569 state = State.StringLiteral;
567 result.id = Token.Id { .StringLiteral = Token.StrLitKind.C };570 result.id = Token.Id{ .StringLiteral = Token.StrLitKind.C };
568 },571 },
569 'a'...'z', 'A'...'Z', '_', '0'...'9' => {572 'a'...'z', 'A'...'Z', '_', '0'...'9' => {
570 state = State.Identifier;573 state = State.Identifier;
...@@ -605,7 +608,7 @@ pub const Tokenizer = struct {...@@ -605,7 +608,7 @@ pub const Tokenizer = struct {
605 }608 }
606609
607 state = State.CharLiteralEnd;610 state = State.CharLiteralEnd;
608 }611 },
609 },612 },
610613
611 State.CharLiteralBackslash => switch (c) {614 State.CharLiteralBackslash => switch (c) {
...@@ -736,7 +739,7 @@ pub const Tokenizer = struct {...@@ -736,7 +739,7 @@ pub const Tokenizer = struct {
736 else => {739 else => {
737 result.id = Token.Id.MinusPercent;740 result.id = Token.Id.MinusPercent;
738 break;741 break;
739 }742 },
740 },743 },
741744
742 State.AngleBracketLeft => switch (c) {745 State.AngleBracketLeft => switch (c) {
...@@ -944,7 +947,7 @@ pub const Tokenizer = struct {...@@ -944,7 +947,7 @@ pub const Tokenizer = struct {
944 // reinterpret as a normal exponent number947 // reinterpret as a normal exponent number
945 self.index -= 1;948 self.index -= 1;
946 state = State.FloatExponentNumber;949 state = State.FloatExponentNumber;
947 }950 },
948 },951 },
949 State.FloatExponentUnsignedHex => switch (c) {952 State.FloatExponentUnsignedHex => switch (c) {
950 '+', '-' => {953 '+', '-' => {
...@@ -954,7 +957,7 @@ pub const Tokenizer = struct {...@@ -954,7 +957,7 @@ pub const Tokenizer = struct {
954 // reinterpret as a normal exponent number957 // reinterpret as a normal exponent number
955 self.index -= 1;958 self.index -= 1;
956 state = State.FloatExponentNumberHex;959 state = State.FloatExponentNumberHex;
957 }960 },
958 },961 },
959 State.FloatExponentNumber => switch (c) {962 State.FloatExponentNumber => switch (c) {
960 '0'...'9' => {},963 '0'...'9' => {},
...@@ -978,15 +981,15 @@ pub const Tokenizer = struct {...@@ -978,15 +981,15 @@ pub const Tokenizer = struct {
978 State.FloatExponentNumberHex,981 State.FloatExponentNumberHex,
979 State.StringLiteral, // find this error later982 State.StringLiteral, // find this error later
980 State.MultilineStringLiteralLine,983 State.MultilineStringLiteralLine,
981 State.Builtin => {},984 State.Builtin,
985 => {},
982986
983 State.Identifier => {987 State.Identifier => {
984 if (Token.getKeyword(self.buffer[result.start..self.index])) |id| {988 if (Token.getKeyword(self.buffer[result.start..self.index])) |id| {
985 result.id = id;989 result.id = id;
986 }990 }
987 },991 },
988 State.LineCommentStart,992 State.LineCommentStart, State.LineComment => {
989 State.LineComment => {
990 result.id = Token.Id.LineComment;993 result.id = Token.Id.LineComment;
991 },994 },
992 State.DocComment, State.DocCommentStart => {995 State.DocComment, State.DocCommentStart => {
...@@ -1004,7 +1007,8 @@ pub const Tokenizer = struct {...@@ -1004,7 +1007,8 @@ pub const Tokenizer = struct {
1004 State.CharLiteralEscape1,1007 State.CharLiteralEscape1,
1005 State.CharLiteralEscape2,1008 State.CharLiteralEscape2,
1006 State.CharLiteralEnd,1009 State.CharLiteralEnd,
1007 State.StringLiteralBackslash => {1010 State.StringLiteralBackslash,
1011 => {
1008 result.id = Token.Id.Invalid;1012 result.id = Token.Id.Invalid;
1009 },1013 },
10101014
...@@ -1089,7 +1093,7 @@ pub const Tokenizer = struct {...@@ -1089,7 +1093,7 @@ pub const Tokenizer = struct {
1089 if (self.pending_invalid_token != null) return;1093 if (self.pending_invalid_token != null) return;
1090 const invalid_length = self.getInvalidCharacterLength();1094 const invalid_length = self.getInvalidCharacterLength();
1091 if (invalid_length == 0) return;1095 if (invalid_length == 0) return;
1092 self.pending_invalid_token = Token {1096 self.pending_invalid_token = Token{
1093 .id = Token.Id.Invalid,1097 .id = Token.Id.Invalid,
1094 .start = self.index,1098 .start = self.index,
1095 .end = self.index + invalid_length,1099 .end = self.index + invalid_length,
...@@ -1134,23 +1138,18 @@ pub const Tokenizer = struct {...@@ -1134,23 +1138,18 @@ pub const Tokenizer = struct {
1134 }1138 }
1135};1139};
11361140
1137
1138
1139test "tokenizer" {1141test "tokenizer" {
1140 testTokenize("test", []Token.Id {1142 testTokenize("test", []Token.Id{Token.Id.Keyword_test});
1141 Token.Id.Keyword_test,
1142 });
1143}1143}
11441144
1145test "tokenizer - char literal with hex escape" {1145test "tokenizer - char literal with hex escape" {
1146 testTokenize( \\'\x1b'1146 testTokenize(
1147 , []Token.Id {1147 \\'\x1b'
1148 Token.Id.CharLiteral,1148 , []Token.Id{Token.Id.CharLiteral});
1149 });
1150}1149}
11511150
1152test "tokenizer - float literal e exponent" {1151test "tokenizer - float literal e exponent" {
1153 testTokenize("a = 4.94065645841246544177e-324;\n", []Token.Id {1152 testTokenize("a = 4.94065645841246544177e-324;\n", []Token.Id{
1154 Token.Id.Identifier,1153 Token.Id.Identifier,
1155 Token.Id.Equal,1154 Token.Id.Equal,
1156 Token.Id.FloatLiteral,1155 Token.Id.FloatLiteral,
...@@ -1159,7 +1158,7 @@ test "tokenizer - float literal e exponent" {...@@ -1159,7 +1158,7 @@ test "tokenizer - float literal e exponent" {
1159}1158}
11601159
1161test "tokenizer - float literal p exponent" {1160test "tokenizer - float literal p exponent" {
1162 testTokenize("a = 0x1.a827999fcef32p+1022;\n", []Token.Id {1161 testTokenize("a = 0x1.a827999fcef32p+1022;\n", []Token.Id{
1163 Token.Id.Identifier,1162 Token.Id.Identifier,
1164 Token.Id.Equal,1163 Token.Id.Equal,
1165 Token.Id.FloatLiteral,1164 Token.Id.FloatLiteral,
...@@ -1168,31 +1167,31 @@ test "tokenizer - float literal p exponent" {...@@ -1168,31 +1167,31 @@ test "tokenizer - float literal p exponent" {
1168}1167}
11691168
1170test "tokenizer - chars" {1169test "tokenizer - chars" {
1171 testTokenize("'c'", []Token.Id {Token.Id.CharLiteral});1170 testTokenize("'c'", []Token.Id{Token.Id.CharLiteral});
1172}1171}
11731172
1174test "tokenizer - invalid token characters" {1173test "tokenizer - invalid token characters" {
1175 testTokenize("#", []Token.Id{Token.Id.Invalid});1174 testTokenize("#", []Token.Id{Token.Id.Invalid});
1176 testTokenize("`", []Token.Id{Token.Id.Invalid});1175 testTokenize("`", []Token.Id{Token.Id.Invalid});
1177 testTokenize("'c", []Token.Id {Token.Id.Invalid});1176 testTokenize("'c", []Token.Id{Token.Id.Invalid});
1178 testTokenize("'", []Token.Id {Token.Id.Invalid});1177 testTokenize("'", []Token.Id{Token.Id.Invalid});
1179 testTokenize("''", []Token.Id {Token.Id.Invalid, Token.Id.Invalid});1178 testTokenize("''", []Token.Id{ Token.Id.Invalid, Token.Id.Invalid });
1180}1179}
11811180
1182test "tokenizer - invalid literal/comment characters" {1181test "tokenizer - invalid literal/comment characters" {
1183 testTokenize("\"\x00\"", []Token.Id {1182 testTokenize("\"\x00\"", []Token.Id{
1184 Token.Id { .StringLiteral = Token.StrLitKind.Normal },1183 Token.Id{ .StringLiteral = Token.StrLitKind.Normal },
1185 Token.Id.Invalid,1184 Token.Id.Invalid,
1186 });1185 });
1187 testTokenize("//\x00", []Token.Id {1186 testTokenize("//\x00", []Token.Id{
1188 Token.Id.LineComment,1187 Token.Id.LineComment,
1189 Token.Id.Invalid,1188 Token.Id.Invalid,
1190 });1189 });
1191 testTokenize("//\x1f", []Token.Id {1190 testTokenize("//\x1f", []Token.Id{
1192 Token.Id.LineComment,1191 Token.Id.LineComment,
1193 Token.Id.Invalid,1192 Token.Id.Invalid,
1194 });1193 });
1195 testTokenize("//\x7f", []Token.Id {1194 testTokenize("//\x7f", []Token.Id{
1196 Token.Id.LineComment,1195 Token.Id.LineComment,
1197 Token.Id.Invalid,1196 Token.Id.Invalid,
1198 });1197 });
...@@ -1261,18 +1260,16 @@ test "tokenizer - illegal unicode codepoints" {...@@ -1261,18 +1260,16 @@ test "tokenizer - illegal unicode codepoints" {
1261test "tokenizer - string identifier and builtin fns" {1260test "tokenizer - string identifier and builtin fns" {
1262 testTokenize(1261 testTokenize(
1263 \\const @"if" = @import("std");1262 \\const @"if" = @import("std");
1264 ,1263 , []Token.Id{
1265 []Token.Id{1264 Token.Id.Keyword_const,
1266 Token.Id.Keyword_const,1265 Token.Id.Identifier,
1267 Token.Id.Identifier,1266 Token.Id.Equal,
1268 Token.Id.Equal,1267 Token.Id.Builtin,
1269 Token.Id.Builtin,1268 Token.Id.LParen,
1270 Token.Id.LParen,1269 Token.Id{ .StringLiteral = Token.StrLitKind.Normal },
1271 Token.Id {.StringLiteral = Token.StrLitKind.Normal},1270 Token.Id.RParen,
1272 Token.Id.RParen,1271 Token.Id.Semicolon,
1273 Token.Id.Semicolon,1272 });
1274 }
1275 );
1276}1273}
12771274
1278test "tokenizer - pipe and then invalid" {1275test "tokenizer - pipe and then invalid" {
...@@ -1314,7 +1311,10 @@ fn testTokenize(source: []const u8, expected_tokens: []const Token.Id) void {...@@ -1314,7 +1311,10 @@ fn testTokenize(source: []const u8, expected_tokens: []const Token.Id) void {
1314 }1311 }
1315 switch (expected_token_id) {1312 switch (expected_token_id) {
1316 Token.Id.StringLiteral => |expected_kind| {1313 Token.Id.StringLiteral => |expected_kind| {
1317 std.debug.assert(expected_kind == switch (token.id) { Token.Id.StringLiteral => |kind| kind, else => unreachable });1314 std.debug.assert(expected_kind == switch (token.id) {
1315 Token.Id.StringLiteral => |kind| kind,
1316 else => unreachable,
1317 });
1318 },1318 },
1319 else => {},1319 else => {},
1320 }1320 }
test/cases/align.zig+6-6
...@@ -70,7 +70,7 @@ test "specifying alignment allows pointer cast" {...@@ -70,7 +70,7 @@ test "specifying alignment allows pointer cast" {
70 testBytesAlign(0x33);70 testBytesAlign(0x33);
71}71}
72fn testBytesAlign(b: u8) void {72fn testBytesAlign(b: u8) void {
73 var bytes align(4) = []u8 {73 var bytes align(4) = []u8{
74 b,74 b,
75 b,75 b,
76 b,76 b,
...@@ -84,7 +84,7 @@ test "specifying alignment allows slice cast" {...@@ -84,7 +84,7 @@ test "specifying alignment allows slice cast" {
84 testBytesAlignSlice(0x33);84 testBytesAlignSlice(0x33);
85}85}
86fn testBytesAlignSlice(b: u8) void {86fn testBytesAlignSlice(b: u8) void {
87 var bytes align(4) = []u8 {87 var bytes align(4) = []u8{
88 b,88 b,
89 b,89 b,
90 b,90 b,
...@@ -107,7 +107,7 @@ fn expects4(x: &align(4) u32) void {...@@ -107,7 +107,7 @@ fn expects4(x: &align(4) u32) void {
107}107}
108108
109test "@alignCast slices" {109test "@alignCast slices" {
110 var array align(4) = []u32 {110 var array align(4) = []u32{
111 1,111 1,
112 1,112 1,
113 };113 };
...@@ -169,7 +169,7 @@ test "@ptrCast preserves alignment of bigger source" {...@@ -169,7 +169,7 @@ test "@ptrCast preserves alignment of bigger source" {
169169
170test "compile-time known array index has best alignment possible" {170test "compile-time known array index has best alignment possible" {
171 // take full advantage of over-alignment171 // take full advantage of over-alignment
172 var array align(4) = []u8 {172 var array align(4) = []u8{
173 1,173 1,
174 2,174 2,
175 3,175 3,
...@@ -181,7 +181,7 @@ test "compile-time known array index has best alignment possible" {...@@ -181,7 +181,7 @@ test "compile-time known array index has best alignment possible" {
181 assert(@typeOf(&array[3]) == &u8);181 assert(@typeOf(&array[3]) == &u8);
182182
183 // because align is too small but we still figure out to use 2183 // because align is too small but we still figure out to use 2
184 var bigger align(2) = []u64 {184 var bigger align(2) = []u64{
185 1,185 1,
186 2,186 2,
187 3,187 3,
...@@ -193,7 +193,7 @@ test "compile-time known array index has best alignment possible" {...@@ -193,7 +193,7 @@ test "compile-time known array index has best alignment possible" {
193 assert(@typeOf(&bigger[3]) == &align(2) u64);193 assert(@typeOf(&bigger[3]) == &align(2) u64);
194194
195 // because pointer is align 2 and u32 align % 2 == 0 we can assume align 2195 // because pointer is align 2 and u32 align % 2 == 0 we can assume align 2
196 var smaller align(2) = []u32 {196 var smaller align(2) = []u32{
197 1,197 1,
198 2,198 2,
199 3,199 3,
test/cases/array.zig+5-7
...@@ -34,7 +34,7 @@ test "void arrays" {...@@ -34,7 +34,7 @@ test "void arrays" {
34}34}
3535
36test "array literal" {36test "array literal" {
37 const hex_mult = []u16 {37 const hex_mult = []u16{
38 4096,38 4096,
39 256,39 256,
40 16,40 16,
...@@ -54,7 +54,7 @@ test "array dot len const expr" {...@@ -54,7 +54,7 @@ test "array dot len const expr" {
54const ArrayDotLenConstExpr = struct {54const ArrayDotLenConstExpr = struct {
55 y: [some_array.len]u8,55 y: [some_array.len]u8,
56};56};
57const some_array = []u8 {57const some_array = []u8{
58 0,58 0,
59 1,59 1,
60 2,60 2,
...@@ -62,7 +62,7 @@ const some_array = []u8 {...@@ -62,7 +62,7 @@ const some_array = []u8 {
62};62};
6363
64test "nested arrays" {64test "nested arrays" {
65 const array_of_strings = [][]const u8 {65 const array_of_strings = [][]const u8{
66 "hello",66 "hello",
67 "this",67 "this",
68 "is",68 "is",
...@@ -86,9 +86,7 @@ const Str = struct {...@@ -86,9 +86,7 @@ const Str = struct {
86 a: []Sub,86 a: []Sub,
87};87};
88test "set global var array via slice embedded in struct" {88test "set global var array via slice embedded in struct" {
89 var s = Str {89 var s = Str{ .a = s_array[0..] };
90 .a = s_array[0..],
91 };
9290
93 s.a[0].b = 1;91 s.a[0].b = 1;
94 s.a[1].b = 2;92 s.a[1].b = 2;
...@@ -100,7 +98,7 @@ test "set global var array via slice embedded in struct" {...@@ -100,7 +98,7 @@ test "set global var array via slice embedded in struct" {
100}98}
10199
102test "array literal with specified size" {100test "array literal with specified size" {
103 var array = [2]u8 {101 var array = [2]u8{
104 1,102 1,
105 2,103 2,
106 };104 };
test/cases/bugs/394.zig+2-4
...@@ -10,11 +10,9 @@ const S = struct {...@@ -10,11 +10,9 @@ const S = struct {
10const assert = @import("std").debug.assert;10const assert = @import("std").debug.assert;
1111
12test "bug 394 fixed" {12test "bug 394 fixed" {
13 const x = S {13 const x = S{
14 .x = 3,14 .x = 3,
15 .y = E {15 .y = E{ .B = 1 },
16 .B = 1,
17 },
18 };16 };
19 assert(x.x == 3);17 assert(x.x == 3);
20}18}
test/cases/bugs/656.zig+2-4
...@@ -14,10 +14,8 @@ test "nullable if after an if in a switch prong of a switch with 2 prongs in an...@@ -14,10 +14,8 @@ test "nullable if after an if in a switch prong of a switch with 2 prongs in an
14}14}
1515
16fn foo(a: bool, b: bool) void {16fn foo(a: bool, b: bool) void {
17 var prefix_op = PrefixOp {17 var prefix_op = PrefixOp{
18 .AddrOf = Value {18 .AddrOf = Value{ .align_expr = 1234 },
19 .align_expr = 1234,
20 },
21 };19 };
22 if (a) {} else {20 if (a) {} else {
23 switch (prefix_op) {21 switch (prefix_op) {
test/cases/bugs/828.zig+2-6
...@@ -1,14 +1,10 @@...@@ -1,14 +1,10 @@
1const CountBy = struct {1const CountBy = struct {
2 a: usize,2 a: usize,
33
4 const One = CountBy {4 const One = CountBy{ .a = 1 };
5 .a = 1,
6 };
75
8 pub fn counter(self: &const CountBy) Counter {6 pub fn counter(self: &const CountBy) Counter {
9 return Counter {7 return Counter{ .i = 0 };
10 .i = 0,
11 };
12 }8 }
13};9};
1410
test/cases/cast.zig+8-23
...@@ -33,27 +33,21 @@ fn funcWithConstPtrPtr(x: &const &i32) void {...@@ -33,27 +33,21 @@ fn funcWithConstPtrPtr(x: &const &i32) void {
33}33}
3434
35test "implicitly cast a container to a const pointer of it" {35test "implicitly cast a container to a const pointer of it" {
36 const z = Struct(void) {36 const z = Struct(void){ .x = void{} };
37 .x = void{},
38 };
39 assert(0 == @sizeOf(@typeOf(z)));37 assert(0 == @sizeOf(@typeOf(z)));
40 assert(void{} == Struct(void).pointer(z).x);38 assert(void{} == Struct(void).pointer(z).x);
41 assert(void{} == Struct(void).pointer(&z).x);39 assert(void{} == Struct(void).pointer(&z).x);
42 assert(void{} == Struct(void).maybePointer(z).x);40 assert(void{} == Struct(void).maybePointer(z).x);
43 assert(void{} == Struct(void).maybePointer(&z).x);41 assert(void{} == Struct(void).maybePointer(&z).x);
44 assert(void{} == Struct(void).maybePointer(null).x);42 assert(void{} == Struct(void).maybePointer(null).x);
45 const s = Struct(u8) {43 const s = Struct(u8){ .x = 42 };
46 .x = 42,
47 };
48 assert(0 != @sizeOf(@typeOf(s)));44 assert(0 != @sizeOf(@typeOf(s)));
49 assert(42 == Struct(u8).pointer(s).x);45 assert(42 == Struct(u8).pointer(s).x);
50 assert(42 == Struct(u8).pointer(&s).x);46 assert(42 == Struct(u8).pointer(&s).x);
51 assert(42 == Struct(u8).maybePointer(s).x);47 assert(42 == Struct(u8).maybePointer(s).x);
52 assert(42 == Struct(u8).maybePointer(&s).x);48 assert(42 == Struct(u8).maybePointer(&s).x);
53 assert(0 == Struct(u8).maybePointer(null).x);49 assert(0 == Struct(u8).maybePointer(null).x);
54 const u = Union {50 const u = Union{ .x = 42 };
55 .x = 42,
56 };
57 assert(42 == Union.pointer(u).x);51 assert(42 == Union.pointer(u).x);
58 assert(42 == Union.pointer(&u).x);52 assert(42 == Union.pointer(&u).x);
59 assert(42 == Union.maybePointer(u).x);53 assert(42 == Union.maybePointer(u).x);
...@@ -77,9 +71,7 @@ fn Struct(comptime T: type) type {...@@ -77,9 +71,7 @@ fn Struct(comptime T: type) type {
77 }71 }
7872
79 fn maybePointer(self: ?&const Self) Self {73 fn maybePointer(self: ?&const Self) Self {
80 const none = Self {74 const none = Self{ .x = if (T == void) void{} else 0 };
81 .x = if (T == void) void{} else 0,
82 };
83 return (self ?? &none).*;75 return (self ?? &none).*;
84 }76 }
85 };77 };
...@@ -93,9 +85,7 @@ const Union = union {...@@ -93,9 +85,7 @@ const Union = union {
93 }85 }
9486
95 fn maybePointer(self: ?&const Union) Union {87 fn maybePointer(self: ?&const Union) Union {
96 const none = Union {88 const none = Union{ .x = 0 };
97 .x = 0,
98 };
99 return (self ?? &none).*;89 return (self ?? &none).*;
100 }90 }
101};91};
...@@ -130,9 +120,7 @@ test "implicitly cast indirect pointer to maybe-indirect pointer" {...@@ -130,9 +120,7 @@ test "implicitly cast indirect pointer to maybe-indirect pointer" {
130 return ((??p).*.*).x;120 return ((??p).*.*).x;
131 }121 }
132 };122 };
133 const s = S {123 const s = S{ .x = 42 };
134 .x = 42,
135 };
136 const p = &s;124 const p = &s;
137 const q = &p;125 const q = &p;
138 const r = &q;126 const r = &q;
...@@ -202,9 +190,7 @@ fn castToMaybeTypeError(z: i32) void {...@@ -202,9 +190,7 @@ fn castToMaybeTypeError(z: i32) void {
202 const f = z;190 const f = z;
203 const g: error!?i32 = f;191 const g: error!?i32 = f;
204192
205 const a = A {193 const a = A{ .a = z };
206 .a = z,
207 };
208 const b: error!?A = a;194 const b: error!?A = a;
209 assert((??(b catch unreachable)).a == 1);195 assert((??(b catch unreachable)).a == 1);
210}196}
...@@ -343,7 +329,6 @@ test "peer type resolution: error and [N]T" {...@@ -343,7 +329,6 @@ test "peer type resolution: error and [N]T" {
343 // TODO: implicit error!T to error!U where T can implicitly cast to U329 // TODO: implicit error!T to error!U where T can implicitly cast to U
344 //assert(mem.eql(u8, try testPeerErrorAndArray(0), "OK"));330 //assert(mem.eql(u8, try testPeerErrorAndArray(0), "OK"));
345 //comptime assert(mem.eql(u8, try testPeerErrorAndArray(0), "OK"));331 //comptime assert(mem.eql(u8, try testPeerErrorAndArray(0), "OK"));
346
347 assert(mem.eql(u8, try testPeerErrorAndArray2(1), "OKK"));332 assert(mem.eql(u8, try testPeerErrorAndArray2(1), "OKK"));
348 comptime assert(mem.eql(u8, try testPeerErrorAndArray2(1), "OKK"));333 comptime assert(mem.eql(u8, try testPeerErrorAndArray2(1), "OKK"));
349}334}
...@@ -387,7 +372,7 @@ fn cast128Float(x: u128) f128 {...@@ -387,7 +372,7 @@ fn cast128Float(x: u128) f128 {
387}372}
388373
389test "const slice widen cast" {374test "const slice widen cast" {
390 const bytes align(4) = []u8 {375 const bytes align(4) = []u8{
391 0x12,376 0x12,
392 0x12,377 0x12,
393 0x12,378 0x12,
test/cases/const_slice_child.zig+1-1
...@@ -4,7 +4,7 @@ const assert = debug.assert;...@@ -4,7 +4,7 @@ const assert = debug.assert;
4var argv: &const &const u8 = undefined;4var argv: &const &const u8 = undefined;
55
6test "const slice child" {6test "const slice child" {
7 const strs = ([]&const u8) {7 const strs = ([]&const u8){
8 c"one",8 c"one",
9 c"two",9 c"two",
10 c"three",10 c"three",
test/cases/coroutines.zig+4-19
...@@ -10,7 +10,6 @@ test "create a coroutine and cancel it" {...@@ -10,7 +10,6 @@ test "create a coroutine and cancel it" {
10 cancel p;10 cancel p;
11 assert(x == 2);11 assert(x == 2);
12}12}
13
14async fn simpleAsyncFn() void {13async fn simpleAsyncFn() void {
15 x += 1;14 x += 1;
16 suspend;15 suspend;
...@@ -28,7 +27,6 @@ test "coroutine suspend, resume, cancel" {...@@ -28,7 +27,6 @@ test "coroutine suspend, resume, cancel" {
2827
29 assert(std.mem.eql(u8, points, "abcdefg"));28 assert(std.mem.eql(u8, points, "abcdefg"));
30}29}
31
32async fn testAsyncSeq() void {30async fn testAsyncSeq() void {
33 defer seq('e');31 defer seq('e');
3432
...@@ -36,7 +34,7 @@ async fn testAsyncSeq() void {...@@ -36,7 +34,7 @@ async fn testAsyncSeq() void {
36 suspend;34 suspend;
37 seq('d');35 seq('d');
38}36}
39var points = []u8 {0} ** "abcdefg".len;37var points = []u8{0} ** "abcdefg".len;
40var index: usize = 0;38var index: usize = 0;
4139
42fn seq(c: u8) void {40fn seq(c: u8) void {
...@@ -54,7 +52,6 @@ test "coroutine suspend with block" {...@@ -54,7 +52,6 @@ test "coroutine suspend with block" {
5452
55var a_promise: promise = undefined;53var a_promise: promise = undefined;
56var result = false;54var result = false;
57
58async fn testSuspendBlock() void {55async fn testSuspendBlock() void {
59 suspend |p| {56 suspend |p| {
60 comptime assert(@typeOf(p) == promise->void);57 comptime assert(@typeOf(p) == promise->void);
...@@ -75,7 +72,6 @@ test "coroutine await" {...@@ -75,7 +72,6 @@ test "coroutine await" {
75 assert(await_final_result == 1234);72 assert(await_final_result == 1234);
76 assert(std.mem.eql(u8, await_points, "abcdefghi"));73 assert(std.mem.eql(u8, await_points, "abcdefghi"));
77}74}
78
79async fn await_amain() void {75async fn await_amain() void {
80 await_seq('b');76 await_seq('b');
81 const p = async await_another() catch unreachable;77 const p = async await_another() catch unreachable;
...@@ -83,7 +79,6 @@ async fn await_amain() void {...@@ -83,7 +79,6 @@ async fn await_amain() void {
83 await_final_result = await p;79 await_final_result = await p;
84 await_seq('h');80 await_seq('h');
85}81}
86
87async fn await_another() i32 {82async fn await_another() i32 {
88 await_seq('c');83 await_seq('c');
89 suspend |p| {84 suspend |p| {
...@@ -94,7 +89,7 @@ async fn await_another() i32 {...@@ -94,7 +89,7 @@ async fn await_another() i32 {
94 return 1234;89 return 1234;
95}90}
9691
97var await_points = []u8 {0} ** "abcdefghi".len;92var await_points = []u8{0} ** "abcdefghi".len;
98var await_seq_index: usize = 0;93var await_seq_index: usize = 0;
9994
100fn await_seq(c: u8) void {95fn await_seq(c: u8) void {
...@@ -111,7 +106,6 @@ test "coroutine await early return" {...@@ -111,7 +106,6 @@ test "coroutine await early return" {
111 assert(early_final_result == 1234);106 assert(early_final_result == 1234);
112 assert(std.mem.eql(u8, early_points, "abcdef"));107 assert(std.mem.eql(u8, early_points, "abcdef"));
113}108}
114
115async fn early_amain() void {109async fn early_amain() void {
116 early_seq('b');110 early_seq('b');
117 const p = async early_another() catch unreachable;111 const p = async early_another() catch unreachable;
...@@ -119,13 +113,12 @@ async fn early_amain() void {...@@ -119,13 +113,12 @@ async fn early_amain() void {
119 early_final_result = await p;113 early_final_result = await p;
120 early_seq('e');114 early_seq('e');
121}115}
122
123async fn early_another() i32 {116async fn early_another() i32 {
124 early_seq('c');117 early_seq('c');
125 return 1234;118 return 1234;
126}119}
127120
128var early_points = []u8 {0} ** "abcdef".len;121var early_points = []u8{0} ** "abcdef".len;
129var early_seq_index: usize = 0;122var early_seq_index: usize = 0;
130123
131fn early_seq(c: u8) void {124fn early_seq(c: u8) void {
...@@ -141,7 +134,6 @@ test "coro allocation failure" {...@@ -141,7 +134,6 @@ test "coro allocation failure" {
141 error.OutOfMemory => {},134 error.OutOfMemory => {},
142 }135 }
143}136}
144
145async fn asyncFuncThatNeverGetsRun() void {137async fn asyncFuncThatNeverGetsRun() void {
146 @panic("coro frame allocation should fail");138 @panic("coro frame allocation should fail");
147}139}
...@@ -164,15 +156,12 @@ test "async fn pointer in a struct field" {...@@ -164,15 +156,12 @@ test "async fn pointer in a struct field" {
164 const Foo = struct {156 const Foo = struct {
165 bar: async<&std.mem.Allocator> fn(&i32) void,157 bar: async<&std.mem.Allocator> fn(&i32) void,
166 };158 };
167 var foo = Foo {159 var foo = Foo{ .bar = simpleAsyncFn2 };
168 .bar = simpleAsyncFn2,
169 };
170 const p = (async<std.debug.global_allocator> foo.bar(&data)) catch unreachable;160 const p = (async<std.debug.global_allocator> foo.bar(&data)) catch unreachable;
171 assert(data == 2);161 assert(data == 2);
172 cancel p;162 cancel p;
173 assert(data == 4);163 assert(data == 4);
174}164}
175
176async<&std.mem.Allocator> fn simpleAsyncFn2(y: &i32) void {165async<&std.mem.Allocator> fn simpleAsyncFn2(y: &i32) void {
177 defer y.* += 2;166 defer y.* += 2;
178 y.* += 1;167 y.* += 1;
...@@ -184,7 +173,6 @@ test "async fn with inferred error set" {...@@ -184,7 +173,6 @@ test "async fn with inferred error set" {
184 resume p;173 resume p;
185 cancel p;174 cancel p;
186}175}
187
188async fn failing() !void {176async fn failing() !void {
189 suspend;177 suspend;
190 return error.Fail;178 return error.Fail;
...@@ -208,12 +196,10 @@ test "error return trace across suspend points - async return" {...@@ -208,12 +196,10 @@ test "error return trace across suspend points - async return" {
208fn nonFailing() (promise->error!void) {196fn nonFailing() (promise->error!void) {
209 return async<std.debug.global_allocator> suspendThenFail() catch unreachable;197 return async<std.debug.global_allocator> suspendThenFail() catch unreachable;
210}198}
211
212async fn suspendThenFail() error!void {199async fn suspendThenFail() error!void {
213 suspend;200 suspend;
214 return error.Fail;201 return error.Fail;
215}202}
216
217async fn printTrace(p: promise->error!void) void {203async fn printTrace(p: promise->error!void) void {
218 (await p) catch |e| {204 (await p) catch |e| {
219 std.debug.assert(e == error.Fail);205 std.debug.assert(e == error.Fail);
...@@ -234,7 +220,6 @@ test "break from suspend" {...@@ -234,7 +220,6 @@ test "break from suspend" {
234 cancel p;220 cancel p;
235 std.debug.assert(my_result == 2);221 std.debug.assert(my_result == 2);
236}222}
237
238async fn testBreakFromSuspend(my_result: &i32) void {223async fn testBreakFromSuspend(my_result: &i32) void {
239 s: suspend |p| {224 s: suspend |p| {
240 break :s;225 break :s;
test/cases/enum.zig+7-15
...@@ -2,11 +2,9 @@ const assert = @import("std").debug.assert;...@@ -2,11 +2,9 @@ const assert = @import("std").debug.assert;
2const mem = @import("std").mem;2const mem = @import("std").mem;
33
4test "enum type" {4test "enum type" {
5 const foo1 = Foo {5 const foo1 = Foo{ .One = 13 };
6 .One = 13,6 const foo2 = Foo{
7 };7 .Two = Point{
8 const foo2 = Foo {
9 .Two = Point {
10 .x = 1234,8 .x = 1234,
11 .y = 5678,9 .y = 5678,
12 },10 },
...@@ -48,18 +46,12 @@ const Bar = enum {...@@ -48,18 +46,12 @@ const Bar = enum {
48};46};
4947
50fn returnAnInt(x: i32) Foo {48fn returnAnInt(x: i32) Foo {
51 return Foo {49 return Foo{ .One = x };
52 .One = x,
53 };
54}50}
5551
56test "constant enum with payload" {52test "constant enum with payload" {
57 var empty = AnEnumWithPayload {53 var empty = AnEnumWithPayload{ .Empty = {} };
58 .Empty = {},54 var full = AnEnumWithPayload{ .Full = 13 };
59 };
60 var full = AnEnumWithPayload {
61 .Full = 13,
62 };
63 shouldBeEmpty(empty);55 shouldBeEmpty(empty);
64 shouldBeNotEmpty(full);56 shouldBeNotEmpty(full);
65}57}
...@@ -737,7 +729,7 @@ const BitFieldOfEnums = packed struct {...@@ -737,7 +729,7 @@ const BitFieldOfEnums = packed struct {
737 c: C,729 c: C,
738};730};
739731
740const bit_field_1 = BitFieldOfEnums {732const bit_field_1 = BitFieldOfEnums{
741 .a = A.Two,733 .a = A.Two,
742 .b = B.Three3,734 .b = B.Three3,
743 .c = C.Four4,735 .c = C.Four4,
test/cases/enum_with_members.zig+2-6
...@@ -15,12 +15,8 @@ const ET = union(enum) {...@@ -15,12 +15,8 @@ const ET = union(enum) {
15};15};
1616
17test "enum with members" {17test "enum with members" {
18 const a = ET {18 const a = ET{ .SINT = -42 };
19 .SINT = -42,19 const b = ET{ .UINT = 42 };
20 };
21 const b = ET {
22 .UINT = 42,
23 };
24 var buf: [20]u8 = undefined;20 var buf: [20]u8 = undefined;
2521
26 assert((a.print(buf[0..]) catch unreachable) == 3);22 assert((a.print(buf[0..]) catch unreachable) == 3);
test/cases/error.zig+10-12
...@@ -92,7 +92,7 @@ test "error set type " {...@@ -92,7 +92,7 @@ test "error set type " {
92 comptime testErrorSetType();92 comptime testErrorSetType();
93}93}
9494
95const MyErrSet = error {95const MyErrSet = error{
96 OutOfMemory,96 OutOfMemory,
97 FileNotFound,97 FileNotFound,
98};98};
...@@ -114,11 +114,11 @@ test "explicit error set cast" {...@@ -114,11 +114,11 @@ test "explicit error set cast" {
114 comptime testExplicitErrorSetCast(Set1.A);114 comptime testExplicitErrorSetCast(Set1.A);
115}115}
116116
117const Set1 = error {117const Set1 = error{
118 A,118 A,
119 B,119 B,
120};120};
121const Set2 = error {121const Set2 = error{
122 A,122 A,
123 C,123 C,
124};124};
...@@ -134,8 +134,7 @@ test "comptime test error for empty error set" {...@@ -134,8 +134,7 @@ test "comptime test error for empty error set" {
134 comptime testComptimeTestErrorEmptySet(1234);134 comptime testComptimeTestErrorEmptySet(1234);
135}135}
136136
137const EmptyErrorSet = error {137const EmptyErrorSet = error{};
138};
139138
140fn testComptimeTestErrorEmptySet(x: EmptyErrorSet!i32) void {139fn testComptimeTestErrorEmptySet(x: EmptyErrorSet!i32) void {
141 if (x) |v| assert(v == 1234) else |err| @compileError("bad");140 if (x) |v| assert(v == 1234) else |err| @compileError("bad");
...@@ -151,9 +150,10 @@ test "comptime err to int of error set with only 1 possible value" {...@@ -151,9 +150,10 @@ test "comptime err to int of error set with only 1 possible value" {
151 testErrToIntWithOnePossibleValue(error.A, u32(error.A));150 testErrToIntWithOnePossibleValue(error.A, u32(error.A));
152 comptime testErrToIntWithOnePossibleValue(error.A, u32(error.A));151 comptime testErrToIntWithOnePossibleValue(error.A, u32(error.A));
153}152}
154fn testErrToIntWithOnePossibleValue(x: error {153fn testErrToIntWithOnePossibleValue(
155 A,154 x: error{A},
156}, comptime value: u32) void {155 comptime value: u32,
156) void {
157 if (u32(x) != value) {157 if (u32(x) != value) {
158 @compileError("bad");158 @compileError("bad");
159 }159 }
...@@ -197,16 +197,14 @@ fn foo2(f: fn() error!void) void {...@@ -197,16 +197,14 @@ fn foo2(f: fn() error!void) void {
197 const x = f();197 const x = f();
198}198}
199199
200fn bar2() (error {200fn bar2() (error{}!void) {}
201}!void) {}
202201
203test "error: Zero sized error set returned with value payload crash" {202test "error: Zero sized error set returned with value payload crash" {
204 _ = foo3(0);203 _ = foo3(0);
205 _ = comptime foo3(0);204 _ = comptime foo3(0);
206}205}
207206
208const Error = error {207const Error = error{};
209};
210fn foo3(b: usize) Error!usize {208fn foo3(b: usize) Error!usize {
211 return b;209 return b;
212}210}
test/cases/eval.zig+21-31
...@@ -72,12 +72,12 @@ const Point = struct {...@@ -72,12 +72,12 @@ const Point = struct {
72 x: i32,72 x: i32,
73 y: i32,73 y: i32,
74};74};
75const static_point_list = []Point {75const static_point_list = []Point{
76 makePoint(1, 2),76 makePoint(1, 2),
77 makePoint(3, 4),77 makePoint(3, 4),
78};78};
79fn makePoint(x: i32, y: i32) Point {79fn makePoint(x: i32, y: i32) Point {
80 return Point {80 return Point{
81 .x = x,81 .x = x,
82 .y = y,82 .y = y,
83 };83 };
...@@ -92,13 +92,11 @@ pub const Vec3 = struct {...@@ -92,13 +92,11 @@ pub const Vec3 = struct {
92 data: [3]f32,92 data: [3]f32,
93};93};
94pub fn vec3(x: f32, y: f32, z: f32) Vec3 {94pub fn vec3(x: f32, y: f32, z: f32) Vec3 {
95 return Vec3 {95 return Vec3{ .data = []f32{
96 .data = []f32 {96 x,
97 x,97 y,
98 y,98 z,
99 z,99 } };
100 },
101 };
102}100}
103101
104test "constant expressions" {102test "constant expressions" {
...@@ -117,22 +115,22 @@ const Vertex = struct {...@@ -117,22 +115,22 @@ const Vertex = struct {
117 g: f32,115 g: f32,
118 b: f32,116 b: f32,
119};117};
120const vertices = []Vertex {118const vertices = []Vertex{
121 Vertex {119 Vertex{
122 .x = -0.6,120 .x = -0.6,
123 .y = -0.4,121 .y = -0.4,
124 .r = 1.0,122 .r = 1.0,
125 .g = 0.0,123 .g = 0.0,
126 .b = 0.0,124 .b = 0.0,
127 },125 },
128 Vertex {126 Vertex{
129 .x = 0.6,127 .x = 0.6,
130 .y = -0.4,128 .y = -0.4,
131 .r = 0.0,129 .r = 0.0,
132 .g = 1.0,130 .g = 1.0,
133 .b = 0.0,131 .b = 0.0,
134 },132 },
135 Vertex {133 Vertex{
136 .x = 0.0,134 .x = 0.0,
137 .y = 0.6,135 .y = 0.6,
138 .r = 0.0,136 .r = 0.0,
...@@ -149,7 +147,7 @@ const StInitStrFoo = struct {...@@ -149,7 +147,7 @@ const StInitStrFoo = struct {
149 x: i32,147 x: i32,
150 y: bool,148 y: bool,
151};149};
152var st_init_str_foo = StInitStrFoo {150var st_init_str_foo = StInitStrFoo{
153 .x = 13,151 .x = 13,
154 .y = true,152 .y = true,
155};153};
...@@ -158,7 +156,7 @@ test "statically initalized array literal" {...@@ -158,7 +156,7 @@ test "statically initalized array literal" {
158 const y: [4]u8 = st_init_arr_lit_x;156 const y: [4]u8 = st_init_arr_lit_x;
159 assert(y[3] == 4);157 assert(y[3] == 4);
160}158}
161const st_init_arr_lit_x = []u8 {159const st_init_arr_lit_x = []u8{
162 1,160 1,
163 2,161 2,
164 3,162 3,
...@@ -220,16 +218,16 @@ const CmdFn = struct {...@@ -220,16 +218,16 @@ const CmdFn = struct {
220 func: fn(i32) i32,218 func: fn(i32) i32,
221};219};
222220
223const cmd_fns = []CmdFn {221const cmd_fns = []CmdFn{
224 CmdFn {222 CmdFn{
225 .name = "one",223 .name = "one",
226 .func = one,224 .func = one,
227 },225 },
228 CmdFn {226 CmdFn{
229 .name = "two",227 .name = "two",
230 .func = two,228 .func = two,
231 },229 },
232 CmdFn {230 CmdFn{
233 .name = "three",231 .name = "three",
234 .func = three,232 .func = three,
235 },233 },
...@@ -289,9 +287,7 @@ const SimpleStruct = struct {...@@ -289,9 +287,7 @@ const SimpleStruct = struct {
289 }287 }
290};288};
291289
292var simple_struct = SimpleStruct {290var simple_struct = SimpleStruct{ .field = 1234 };
293 .field = 1234,
294};
295291
296const bound_fn = simple_struct.method;292const bound_fn = simple_struct.method;
297293
...@@ -341,9 +337,7 @@ const Foo = struct {...@@ -341,9 +337,7 @@ const Foo = struct {
341 name: []const u8,337 name: []const u8,
342};338};
343339
344var foo_contents = Foo {340var foo_contents = Foo{ .name = "a" };
345 .name = "a",
346};
347const foo_ref = &foo_contents;341const foo_ref = &foo_contents;
348342
349test "create global array with for loop" {343test "create global array with for loop" {
...@@ -529,9 +523,7 @@ const SingleFieldStruct = struct {...@@ -529,9 +523,7 @@ const SingleFieldStruct = struct {
529};523};
530test "const ptr to comptime mutable data is not memoized" {524test "const ptr to comptime mutable data is not memoized" {
531 comptime {525 comptime {
532 var foo = SingleFieldStruct {526 var foo = SingleFieldStruct{ .x = 1 };
533 .x = 1,
534 };
535 assert(foo.read_x() == 1);527 assert(foo.read_x() == 1);
536 foo.x = 2;528 foo.x = 2;
537 assert(foo.read_x() == 2);529 assert(foo.read_x() == 2);
...@@ -574,9 +566,7 @@ pub const Info = struct {...@@ -574,9 +566,7 @@ pub const Info = struct {
574 version: u8,566 version: u8,
575};567};
576568
577pub const diamond_info = Info {569pub const diamond_info = Info{ .version = 0 };
578 .version = 0,
579};
580570
581test "comptime modification of const struct field" {571test "comptime modification of const struct field" {
582 comptime {572 comptime {
test/cases/field_parent_ptr.zig+1-1
...@@ -17,7 +17,7 @@ const Foo = struct {...@@ -17,7 +17,7 @@ const Foo = struct {
17 d: i32,17 d: i32,
18};18};
1919
20const foo = Foo {20const foo = Foo{
21 .a = true,21 .a = true,
22 .b = 0.123,22 .b = 0.123,
23 .c = 1234,23 .c = 1234,
test/cases/fn.zig+1-1
...@@ -73,7 +73,7 @@ fn fnWithUnreachable() noreturn {...@@ -73,7 +73,7 @@ fn fnWithUnreachable() noreturn {
73}73}
7474
75test "function pointers" {75test "function pointers" {
76 const fns = []@typeOf(fn1) {76 const fns = []@typeOf(fn1){
77 fn1,77 fn1,
78 fn2,78 fn2,
79 fn3,79 fn3,
test/cases/fn_in_struct_in_comptime.zig+1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const assert = @import("std").debug.assert;1const assert = @import("std").debug.assert;
22
3fn get_foo() fn(&u8)usize {3fn get_foo() fn(&u8) usize {
4 comptime {4 comptime {
5 return struct {5 return struct {
6 fn func(ptr: &u8) usize {6 fn func(ptr: &u8) usize {
test/cases/for.zig+3-3
...@@ -3,7 +3,7 @@ const assert = std.debug.assert;...@@ -3,7 +3,7 @@ const assert = std.debug.assert;
3const mem = std.mem;3const mem = std.mem;
44
5test "continue in for loop" {5test "continue in for loop" {
6 const array = []i32 {6 const array = []i32{
7 1,7 1,
8 2,8 2,
9 3,9 3,
...@@ -35,7 +35,7 @@ fn mangleString(s: []u8) void {...@@ -35,7 +35,7 @@ fn mangleString(s: []u8) void {
35}35}
3636
37test "basic for loop" {37test "basic for loop" {
38 const expected_result = []u8 {38 const expected_result = []u8{
39 9,39 9,
40 8,40 8,
41 7,41 7,
...@@ -57,7 +57,7 @@ test "basic for loop" {...@@ -57,7 +57,7 @@ test "basic for loop" {
57 var buffer: [expected_result.len]u8 = undefined;57 var buffer: [expected_result.len]u8 = undefined;
58 var buf_index: usize = 0;58 var buf_index: usize = 0;
5959
60 const array = []u8 {60 const array = []u8{
61 9,61 9,
62 8,62 8,
63 7,63 7,
test/cases/generics.zig+5-5
...@@ -81,11 +81,11 @@ test "function with return type type" {...@@ -81,11 +81,11 @@ test "function with return type type" {
81}81}
8282
83test "generic struct" {83test "generic struct" {
84 var a1 = GenNode(i32) {84 var a1 = GenNode(i32){
85 .value = 13,85 .value = 13,
86 .next = null,86 .next = null,
87 };87 };
88 var b1 = GenNode(bool) {88 var b1 = GenNode(bool){
89 .value = true,89 .value = true,
90 .next = null,90 .next = null,
91 };91 };
...@@ -120,8 +120,8 @@ fn aGenericFn(comptime T: type, comptime a: T, b: T) T {...@@ -120,8 +120,8 @@ fn aGenericFn(comptime T: type, comptime a: T, b: T) T {
120}120}
121121
122test "generic fn with implicit cast" {122test "generic fn with implicit cast" {
123 assert(getFirstByte(u8, []u8 {13}) == 13);123 assert(getFirstByte(u8, []u8{13}) == 13);
124 assert(getFirstByte(u16, []u16 {124 assert(getFirstByte(u16, []u16{
125 0,125 0,
126 13,126 13,
127 }) == 0);127 }) == 0);
...@@ -133,7 +133,7 @@ fn getFirstByte(comptime T: type, mem: []const T) u8 {...@@ -133,7 +133,7 @@ fn getFirstByte(comptime T: type, mem: []const T) u8 {
133 return getByte(@ptrCast(&const u8, &mem[0]));133 return getByte(@ptrCast(&const u8, &mem[0]));
134}134}
135135
136const foos = []fn(var) bool {136const foos = []fn(var) bool{
137 foo1,137 foo1,
138 foo2,138 foo2,
139};139};
test/cases/incomplete_struct_param_tld.zig+3-5
...@@ -21,11 +21,9 @@ fn foo(a: &const A) i32 {...@@ -21,11 +21,9 @@ fn foo(a: &const A) i32 {
21}21}
2222
23test "incomplete struct param top level declaration" {23test "incomplete struct param top level declaration" {
24 const a = A {24 const a = A{
25 .b = B {25 .b = B{
26 .c = C {26 .c = C{ .x = 13 },
27 .x = 13,
28 },
29 },27 },
30 };28 };
31 assert(foo(a) == 13);29 assert(foo(a) == 13);
test/cases/math.zig+1-1
...@@ -197,7 +197,7 @@ fn test_u64_div() void {...@@ -197,7 +197,7 @@ fn test_u64_div() void {
197 assert(result.remainder == 100663296);197 assert(result.remainder == 100663296);
198}198}
199fn divWithResult(a: u64, b: u64) DivResult {199fn divWithResult(a: u64, b: u64) DivResult {
200 return DivResult {200 return DivResult{
201 .quotient = a / b,201 .quotient = a / b,
202 .remainder = a % b,202 .remainder = a % b,
203 };203 };
test/cases/misc.zig+16-26
...@@ -232,7 +232,7 @@ test "string escapes" {...@@ -232,7 +232,7 @@ test "string escapes" {
232}232}
233233
234test "multiline string" {234test "multiline string" {
235 const s1 = 235 const s1 =
236 \\one236 \\one
237 \\two)237 \\two)
238 \\three238 \\three
...@@ -242,7 +242,7 @@ test "multiline string" {...@@ -242,7 +242,7 @@ test "multiline string" {
242}242}
243243
244test "multiline C string" {244test "multiline C string" {
245 const s1 = 245 const s1 =
246 c\\one246 c\\one
247 c\\two)247 c\\two)
248 c\\three248 c\\three
...@@ -350,15 +350,13 @@ const Test3Point = struct {...@@ -350,15 +350,13 @@ const Test3Point = struct {
350 x: i32,350 x: i32,
351 y: i32,351 y: i32,
352};352};
353const test3_foo = Test3Foo {353const test3_foo = Test3Foo{
354 .Three = Test3Point {354 .Three = Test3Point{
355 .x = 3,355 .x = 3,
356 .y = 4,356 .y = 4,
357 },357 },
358};358};
359const test3_bar = Test3Foo {359const test3_bar = Test3Foo{ .Two = 13 };
360 .Two = 13,
361};
362fn test3_1(f: &const Test3Foo) void {360fn test3_1(f: &const Test3Foo) void {
363 switch (f.*) {361 switch (f.*) {
364 Test3Foo.Three => |pt| {362 Test3Foo.Three => |pt| {
...@@ -417,7 +415,7 @@ test "C string concatenation" {...@@ -417,7 +415,7 @@ test "C string concatenation" {
417415
418test "cast slice to u8 slice" {416test "cast slice to u8 slice" {
419 assert(@sizeOf(i32) == 4);417 assert(@sizeOf(i32) == 4);
420 var big_thing_array = []i32 {418 var big_thing_array = []i32{
421 1,419 1,
422 2,420 2,
423 3,421 3,
...@@ -458,9 +456,9 @@ test "non const ptr to aliased type" {...@@ -458,9 +456,9 @@ test "non const ptr to aliased type" {
458}456}
459457
460test "array 2D const double ptr" {458test "array 2D const double ptr" {
461 const rect_2d_vertexes = [][1]f32 {459 const rect_2d_vertexes = [][1]f32{
462 []f32 {1.0},460 []f32{1.0},
463 []f32 {2.0},461 []f32{2.0},
464 };462 };
465 testArray2DConstDoublePtr(&rect_2d_vertexes[0][0]);463 testArray2DConstDoublePtr(&rect_2d_vertexes[0][0]);
466}464}
...@@ -565,7 +563,7 @@ test "volatile load and store" {...@@ -565,7 +563,7 @@ test "volatile load and store" {
565test "slice string literal has type []const u8" {563test "slice string literal has type []const u8" {
566 comptime {564 comptime {
567 assert(@typeOf("aoeu"[0..]) == []const u8);565 assert(@typeOf("aoeu"[0..]) == []const u8);
568 const array = []i32 {566 const array = []i32{
569 1,567 1,
570 2,568 2,
571 3,569 3,
...@@ -581,13 +579,9 @@ test "global variable initialized to global variable array element" {...@@ -581,13 +579,9 @@ test "global variable initialized to global variable array element" {
581const GDTEntry = struct {579const GDTEntry = struct {
582 field: i32,580 field: i32,
583};581};
584var gdt = []GDTEntry {582var gdt = []GDTEntry{
585 GDTEntry {583 GDTEntry{ .field = 1 },
586 .field = 1,584 GDTEntry{ .field = 2 },
587 },
588 GDTEntry {
589 .field = 2,
590 },
591};585};
592var global_ptr = &gdt[0];586var global_ptr = &gdt[0];
593587
...@@ -648,9 +642,7 @@ fn testStructInFn() void {...@@ -648,9 +642,7 @@ fn testStructInFn() void {
648 kind: BlockKind,642 kind: BlockKind,
649 };643 };
650644
651 var block = Block {645 var block = Block{ .kind = 1234 };
652 .kind = 1234,
653 };
654646
655 block.kind += 1;647 block.kind += 1;
656648
...@@ -694,12 +686,10 @@ const PackedEnum = packed enum {...@@ -694,12 +686,10 @@ const PackedEnum = packed enum {
694};686};
695687
696test "packed struct, enum, union parameters in extern function" {688test "packed struct, enum, union parameters in extern function" {
697 testPackedStuff(PackedStruct {689 testPackedStuff(PackedStruct{
698 .a = 1,690 .a = 1,
699 .b = 2,691 .b = 2,
700 }, PackedUnion {692 }, PackedUnion{ .a = 1 }, PackedEnum.A);
701 .a = 1,
702 }, PackedEnum.A);
703}693}
704694
705export fn testPackedStuff(a: &const PackedStruct, b: &const PackedUnion, c: PackedEnum) void {}695export fn testPackedStuff(a: &const PackedStruct, b: &const PackedUnion, c: PackedEnum) void {}
test/cases/null.zig+2-4
...@@ -58,7 +58,7 @@ fn foo(x: ?i32) ?bool {...@@ -58,7 +58,7 @@ fn foo(x: ?i32) ?bool {
58}58}
5959
60test "if var maybe pointer" {60test "if var maybe pointer" {
61 assert(shouldBeAPlus1(Particle {61 assert(shouldBeAPlus1(Particle{
62 .a = 14,62 .a = 14,
63 .b = 1,63 .b = 1,
64 .c = 1,64 .c = 1,
...@@ -92,9 +92,7 @@ test "null literal outside function" {...@@ -92,9 +92,7 @@ test "null literal outside function" {
92const SillyStruct = struct {92const SillyStruct = struct {
93 context: ?i32,93 context: ?i32,
94};94};
95const here_is_a_null_literal = SillyStruct {95const here_is_a_null_literal = SillyStruct{ .context = null };
96 .context = null,
97};
9896
99test "test null runtime" {97test "test null runtime" {
100 testTestNullRuntime(null);98 testTestNullRuntime(null);
test/cases/reflection.zig+1-1
...@@ -59,7 +59,7 @@ test "reflection: enum member types and names" {...@@ -59,7 +59,7 @@ test "reflection: enum member types and names" {
59}59}
6060
61test "reflection: @field" {61test "reflection: @field" {
62 var f = Foo {62 var f = Foo{
63 .one = 42,63 .one = 42,
64 .two = true,64 .two = true,
65 .three = void{},65 .three = void{},
test/cases/slice.zig+1-1
...@@ -18,7 +18,7 @@ test "slice child property" {...@@ -18,7 +18,7 @@ test "slice child property" {
18}18}
1919
20test "runtime safety lets us slice from len..len" {20test "runtime safety lets us slice from len..len" {
21 var an_array = []u8 {21 var an_array = []u8{
22 1,22 1,
23 2,23 2,
24 3,24 3,
test/cases/struct.zig+15-25
...@@ -27,7 +27,7 @@ test "invake static method in global scope" {...@@ -27,7 +27,7 @@ test "invake static method in global scope" {
27}27}
2828
29test "void struct fields" {29test "void struct fields" {
30 const foo = VoidStructFieldsFoo {30 const foo = VoidStructFieldsFoo{
31 .a = void{},31 .a = void{},
32 .b = 1,32 .b = 1,
33 .c = void{},33 .c = void{},
...@@ -96,16 +96,12 @@ test "struct byval assign" {...@@ -96,16 +96,12 @@ test "struct byval assign" {
96}96}
9797
98fn structInitializer() void {98fn structInitializer() void {
99 const val = Val {99 const val = Val{ .x = 42 };
100 .x = 42,
101 };
102 assert(val.x == 42);100 assert(val.x == 42);
103}101}
104102
105test "fn call of struct field" {103test "fn call of struct field" {
106 assert(callStructField(Foo {104 assert(callStructField(Foo{ .ptr = aFunc }) == 13);
107 .ptr = aFunc,
108 }) == 13);
109}105}
110106
111const Foo = struct {107const Foo = struct {
...@@ -121,9 +117,7 @@ fn callStructField(foo: &const Foo) i32 {...@@ -121,9 +117,7 @@ fn callStructField(foo: &const Foo) i32 {
121}117}
122118
123test "store member function in variable" {119test "store member function in variable" {
124 const instance = MemberFnTestFoo {120 const instance = MemberFnTestFoo{ .x = 1234 };
125 .x = 1234,
126 };
127 const memberFn = MemberFnTestFoo.member;121 const memberFn = MemberFnTestFoo.member;
128 const result = memberFn(instance);122 const result = memberFn(instance);
129 assert(result == 1234);123 assert(result == 1234);
...@@ -136,17 +130,13 @@ const MemberFnTestFoo = struct {...@@ -136,17 +130,13 @@ const MemberFnTestFoo = struct {
136};130};
137131
138test "call member function directly" {132test "call member function directly" {
139 const instance = MemberFnTestFoo {133 const instance = MemberFnTestFoo{ .x = 1234 };
140 .x = 1234,
141 };
142 const result = MemberFnTestFoo.member(instance);134 const result = MemberFnTestFoo.member(instance);
143 assert(result == 1234);135 assert(result == 1234);
144}136}
145137
146test "member functions" {138test "member functions" {
147 const r = MemberFnRand {139 const r = MemberFnRand{ .seed = 1234 };
148 .seed = 1234,
149 };
150 assert(r.getSeed() == 1234);140 assert(r.getSeed() == 1234);
151}141}
152const MemberFnRand = struct {142const MemberFnRand = struct {
...@@ -165,7 +155,7 @@ const Bar = struct {...@@ -165,7 +155,7 @@ const Bar = struct {
165 y: i32,155 y: i32,
166};156};
167fn makeBar(x: i32, y: i32) Bar {157fn makeBar(x: i32, y: i32) Bar {
168 return Bar {158 return Bar{
169 .x = x,159 .x = x,
170 .y = y,160 .y = y,
171 };161 };
...@@ -190,7 +180,7 @@ fn testReturnEmptyStructFromFn() EmptyStruct2 {...@@ -190,7 +180,7 @@ fn testReturnEmptyStructFromFn() EmptyStruct2 {
190}180}
191181
192test "pass slice of empty struct to fn" {182test "pass slice of empty struct to fn" {
193 assert(testPassSliceOfEmptyStructToFn([]EmptyStruct2 {EmptyStruct2{}}) == 1);183 assert(testPassSliceOfEmptyStructToFn([]EmptyStruct2{EmptyStruct2{}}) == 1);
194}184}
195fn testPassSliceOfEmptyStructToFn(slice: []const EmptyStruct2) usize {185fn testPassSliceOfEmptyStructToFn(slice: []const EmptyStruct2) usize {
196 return slice.len;186 return slice.len;
...@@ -202,7 +192,7 @@ const APackedStruct = packed struct {...@@ -202,7 +192,7 @@ const APackedStruct = packed struct {
202};192};
203193
204test "packed struct" {194test "packed struct" {
205 var foo = APackedStruct {195 var foo = APackedStruct{
206 .x = 1,196 .x = 1,
207 .y = 2,197 .y = 2,
208 };198 };
...@@ -217,7 +207,7 @@ const BitField1 = packed struct {...@@ -217,7 +207,7 @@ const BitField1 = packed struct {
217 c: u2,207 c: u2,
218};208};
219209
220const bit_field_1 = BitField1 {210const bit_field_1 = BitField1{
221 .a = 1,211 .a = 1,
222 .b = 2,212 .b = 2,
223 .c = 3,213 .c = 3,
...@@ -267,7 +257,7 @@ test "packed struct 24bits" {...@@ -267,7 +257,7 @@ test "packed struct 24bits" {
267 assert(@sizeOf(Foo96Bits) == 12);257 assert(@sizeOf(Foo96Bits) == 12);
268 }258 }
269259
270 var value = Foo96Bits {260 var value = Foo96Bits{
271 .a = 0,261 .a = 0,
272 .b = 0,262 .b = 0,
273 .c = 0,263 .c = 0,
...@@ -310,7 +300,7 @@ test "packed array 24bits" {...@@ -310,7 +300,7 @@ test "packed array 24bits" {
310 assert(@sizeOf(FooArray24Bits) == 2 + 2 * 3 + 2);300 assert(@sizeOf(FooArray24Bits) == 2 + 2 * 3 + 2);
311 }301 }
312302
313 var bytes = []u8 {0} ** (@sizeOf(FooArray24Bits) + 1);303 var bytes = []u8{0} ** (@sizeOf(FooArray24Bits) + 1);
314 bytes[bytes.len - 1] = 0xaa;304 bytes[bytes.len - 1] = 0xaa;
315 const ptr = &([]FooArray24Bits)(bytes[0..bytes.len - 1])[0];305 const ptr = &([]FooArray24Bits)(bytes[0..bytes.len - 1])[0];
316 assert(ptr.a == 0);306 assert(ptr.a == 0);
...@@ -360,7 +350,7 @@ test "aligned array of packed struct" {...@@ -360,7 +350,7 @@ test "aligned array of packed struct" {
360 assert(@sizeOf(FooArrayOfAligned) == 2 * 2);350 assert(@sizeOf(FooArrayOfAligned) == 2 * 2);
361 }351 }
362352
363 var bytes = []u8 {0xbb} ** @sizeOf(FooArrayOfAligned);353 var bytes = []u8{0xbb} ** @sizeOf(FooArrayOfAligned);
364 const ptr = &([]FooArrayOfAligned)(bytes[0..bytes.len])[0];354 const ptr = &([]FooArrayOfAligned)(bytes[0..bytes.len])[0];
365355
366 assert(ptr.a[0].a == 0xbb);356 assert(ptr.a[0].a == 0xbb);
...@@ -370,11 +360,11 @@ test "aligned array of packed struct" {...@@ -370,11 +360,11 @@ test "aligned array of packed struct" {
370}360}
371361
372test "runtime struct initialization of bitfield" {362test "runtime struct initialization of bitfield" {
373 const s1 = Nibbles {363 const s1 = Nibbles{
374 .x = x1,364 .x = x1,
375 .y = x1,365 .y = x1,
376 };366 };
377 const s2 = Nibbles {367 const s2 = Nibbles{
378 .x = u4(x2),368 .x = u4(x2),
379 .y = u4(x2),369 .y = u4(x2),
380 };370 };
test/cases/struct_contains_slice_of_itself.zig+8-8
...@@ -6,31 +6,31 @@ const Node = struct {...@@ -6,31 +6,31 @@ const Node = struct {
6};6};
77
8test "struct contains slice of itself" {8test "struct contains slice of itself" {
9 var other_nodes = []Node {9 var other_nodes = []Node{
10 Node {10 Node{
11 .payload = 31,11 .payload = 31,
12 .children = []Node{},12 .children = []Node{},
13 },13 },
14 Node {14 Node{
15 .payload = 32,15 .payload = 32,
16 .children = []Node{},16 .children = []Node{},
17 },17 },
18 };18 };
19 var nodes = []Node {19 var nodes = []Node{
20 Node {20 Node{
21 .payload = 1,21 .payload = 1,
22 .children = []Node{},22 .children = []Node{},
23 },23 },
24 Node {24 Node{
25 .payload = 2,25 .payload = 2,
26 .children = []Node{},26 .children = []Node{},
27 },27 },
28 Node {28 Node{
29 .payload = 3,29 .payload = 3,
30 .children = other_nodes[0..],30 .children = other_nodes[0..],
31 },31 },
32 };32 };
33 const root = Node {33 const root = Node{
34 .payload = 1234,34 .payload = 1234,
35 .children = nodes[0..],35 .children = nodes[0..],
36 };36 };
test/cases/switch.zig+17-37
...@@ -6,10 +6,7 @@ test "switch with numbers" {...@@ -6,10 +6,7 @@ test "switch with numbers" {
66
7fn testSwitchWithNumbers(x: u32) void {7fn testSwitchWithNumbers(x: u32) void {
8 const result = switch (x) {8 const result = switch (x) {
9 1,9 1, 2, 3, 4...8 => false,
10 2,
11 3,
12 4 ... 8 => false,
13 13 => true,10 13 => true,
14 else => false,11 else => false,
15 };12 };
...@@ -25,9 +22,9 @@ test "switch with all ranges" {...@@ -25,9 +22,9 @@ test "switch with all ranges" {
2522
26fn testSwitchWithAllRanges(x: u32, y: u32) u32 {23fn testSwitchWithAllRanges(x: u32, y: u32) u32 {
27 return switch (x) {24 return switch (x) {
28 0 ... 100 => 1,25 0...100 => 1,
29 101 ... 200 => 2,26 101...200 => 2,
30 201 ... 300 => 3,27 201...300 => 3,
31 else => y,28 else => y,
32 };29 };
33}30}
...@@ -37,10 +34,8 @@ test "implicit comptime switch" {...@@ -37,10 +34,8 @@ test "implicit comptime switch" {
37 const result = switch (x) {34 const result = switch (x) {
38 3 => 10,35 3 => 10,
39 4 => 11,36 4 => 11,
40 5,37 5, 6 => 12,
41 6 => 12,38 7, 8 => 13,
42 7,
43 8 => 13,
44 else => 14,39 else => 14,
45 };40 };
4641
...@@ -86,15 +81,9 @@ const SwitchStatmentFoo = enum {...@@ -86,15 +81,9 @@ const SwitchStatmentFoo = enum {
86};81};
8782
88test "switch prong with variable" {83test "switch prong with variable" {
89 switchProngWithVarFn(SwitchProngWithVarEnum {84 switchProngWithVarFn(SwitchProngWithVarEnum{ .One = 13 });
90 .One = 13,85 switchProngWithVarFn(SwitchProngWithVarEnum{ .Two = 13.0 });
91 });86 switchProngWithVarFn(SwitchProngWithVarEnum{ .Meh = {} });
92 switchProngWithVarFn(SwitchProngWithVarEnum {
93 .Two = 13.0,
94 });
95 switchProngWithVarFn(SwitchProngWithVarEnum {
96 .Meh = {},
97 });
98}87}
99const SwitchProngWithVarEnum = union(enum) {88const SwitchProngWithVarEnum = union(enum) {
100 One: i32,89 One: i32,
...@@ -121,9 +110,7 @@ test "switch on enum using pointer capture" {...@@ -121,9 +110,7 @@ test "switch on enum using pointer capture" {
121}110}
122111
123fn testSwitchEnumPtrCapture() void {112fn testSwitchEnumPtrCapture() void {
124 var value = SwitchProngWithVarEnum {113 var value = SwitchProngWithVarEnum{ .One = 1234 };
125 .One = 1234,
126 };
127 switch (value) {114 switch (value) {
128 SwitchProngWithVarEnum.One => |*x| x.* += 1,115 SwitchProngWithVarEnum.One => |*x| x.* += 1,
129 else => unreachable,116 else => unreachable,
...@@ -136,12 +123,8 @@ fn testSwitchEnumPtrCapture() void {...@@ -136,12 +123,8 @@ fn testSwitchEnumPtrCapture() void {
136123
137test "switch with multiple expressions" {124test "switch with multiple expressions" {
138 const x = switch (returnsFive()) {125 const x = switch (returnsFive()) {
139 1,126 1, 2, 3 => 1,
140 2,127 4, 5, 6 => 2,
141 3 => 1,
142 4,
143 5,
144 6 => 2,
145 else => i32(3),128 else => i32(3),
146 };129 };
147 assert(x == 2);130 assert(x == 2);
...@@ -156,9 +139,7 @@ const Number = union(enum) {...@@ -156,9 +139,7 @@ const Number = union(enum) {
156 Three: f32,139 Three: f32,
157};140};
158141
159const number = Number {142const number = Number{ .Three = 1.23 };
160 .Three = 1.23,
161};
162143
163fn returnsFalse() bool {144fn returnsFalse() bool {
164 switch (number) {145 switch (number) {
...@@ -212,12 +193,11 @@ fn testSwitchHandleAllCasesExhaustive(x: u2) u2 {...@@ -212,12 +193,11 @@ fn testSwitchHandleAllCasesExhaustive(x: u2) u2 {
212193
213fn testSwitchHandleAllCasesRange(x: u8) u8 {194fn testSwitchHandleAllCasesRange(x: u8) u8 {
214 return switch (x) {195 return switch (x) {
215 0 ... 100 => u8(0),196 0...100 => u8(0),
216 101 ... 200 => 1,197 101...200 => 1,
217 201,198 201, 203 => 2,
218 203 => 2,
219 202 => 4,199 202 => 4,
220 204 ... 255 => 3,200 204...255 => 3,
221 };201 };
222}202}
223203
test/cases/switch_prong_err_enum.zig+1-3
...@@ -14,9 +14,7 @@ const FormValue = union(enum) {...@@ -14,9 +14,7 @@ const FormValue = union(enum) {
1414
15fn doThing(form_id: u64) error!FormValue {15fn doThing(form_id: u64) error!FormValue {
16 return switch (form_id) {16 return switch (form_id) {
17 17 => FormValue {17 17 => FormValue{ .Address = try readOnce() },
18 .Address = try readOnce(),
19 },
20 else => error.InvalidDebugInfo,18 else => error.InvalidDebugInfo,
21 };19 };
22}20}
test/cases/switch_prong_implicit_cast.zig+2-6
...@@ -7,12 +7,8 @@ const FormValue = union(enum) {...@@ -7,12 +7,8 @@ const FormValue = union(enum) {
77
8fn foo(id: u64) !FormValue {8fn foo(id: u64) !FormValue {
9 return switch (id) {9 return switch (id) {
10 2 => FormValue {10 2 => FormValue{ .Two = true },
11 .Two = true,11 1 => FormValue{ .One = {} },
12 },
13 1 => FormValue {
14 .One = {},
15 },
16 else => return error.Whatever,12 else => return error.Whatever,
17 };13 };
18}14}
test/cases/this.zig+1-1
...@@ -29,7 +29,7 @@ test "this refer to module call private fn" {...@@ -29,7 +29,7 @@ test "this refer to module call private fn" {
29}29}
3030
31test "this refer to container" {31test "this refer to container" {
32 var pt = Point(i32) {32 var pt = Point(i32){
33 .x = 12,33 .x = 12,
34 .y = 34,34 .y = 34,
35 };35 };
test/cases/try.zig+1-2
...@@ -7,8 +7,7 @@ test "try on error union" {...@@ -7,8 +7,7 @@ test "try on error union" {
77
8fn tryOnErrorUnionImpl() void {8fn tryOnErrorUnionImpl() void {
9 const x = if (returnsTen()) |val| val + 1 else |err| switch (err) {9 const x = if (returnsTen()) |val| val + 1 else |err| switch (err) {
10 error.ItBroke,10 error.ItBroke, error.NoMem => 1,
11 error.NoMem => 1,
12 error.CrappedOut => i32(2),11 error.CrappedOut => i32(2),
13 else => unreachable,12 else => unreachable,
14 };13 };
test/cases/type_info.zig+2-2
...@@ -103,7 +103,7 @@ test "type info: error set, error union info" {...@@ -103,7 +103,7 @@ test "type info: error set, error union info" {
103}103}
104104
105fn testErrorSet() void {105fn testErrorSet() void {
106 const TestErrorSet = error {106 const TestErrorSet = error{
107 First,107 First,
108 Second,108 Second,
109 Third,109 Third,
...@@ -196,7 +196,7 @@ fn testStruct() void {...@@ -196,7 +196,7 @@ fn testStruct() void {
196 assert(!struct_info.Struct.defs[0].data.Fn.is_extern);196 assert(!struct_info.Struct.defs[0].data.Fn.is_extern);
197 assert(struct_info.Struct.defs[0].data.Fn.lib_name == null);197 assert(struct_info.Struct.defs[0].data.Fn.lib_name == null);
198 assert(struct_info.Struct.defs[0].data.Fn.return_type == void);198 assert(struct_info.Struct.defs[0].data.Fn.return_type == void);
199 assert(struct_info.Struct.defs[0].data.Fn.fn_type == fn(&const TestStruct)void);199 assert(struct_info.Struct.defs[0].data.Fn.fn_type == fn(&const TestStruct) void);
200}200}
201201
202const TestStruct = packed struct {202const TestStruct = packed struct {
test/cases/union.zig+2-3
...@@ -50,10 +50,10 @@ test "basic unions" {...@@ -50,10 +50,10 @@ test "basic unions" {
5050
51test "comptime union field access" {51test "comptime union field access" {
52 comptime {52 comptime {
53 var foo = Foo { .int = 0 };53 var foo = Foo{ .int = 0 };
54 assert(foo.int == 0);54 assert(foo.int == 0);
5555
56 foo = Foo { .float = 42.42 };56 foo = Foo{ .float = 42.42 };
57 assert(foo.float == 42.42);57 assert(foo.float == 42.42);
58 }58 }
59}59}
...@@ -286,7 +286,6 @@ const PartialInstWithPayload = union(enum) {...@@ -286,7 +286,6 @@ const PartialInstWithPayload = union(enum) {
286 Compiled: i32,286 Compiled: i32,
287};287};
288288
289
290test "access a member of tagged union with conflicting enum tag name" {289test "access a member of tagged union with conflicting enum tag name" {
291 const Bar = union(enum) {290 const Bar = union(enum) {
292 A: A,291 A: A,
test/cases/var_args.zig+1-1
...@@ -58,7 +58,7 @@ fn extraFn(extra: u32, args: ...) usize {...@@ -58,7 +58,7 @@ fn extraFn(extra: u32, args: ...) usize {
58 return args.len;58 return args.len;
59}59}
6060
61const foos = []fn(...) bool {61const foos = []fn(...) bool{
62 foo1,62 foo1,
63 foo2,63 foo2,
64};64};
test/cases/void.zig+1-1
...@@ -8,7 +8,7 @@ const Foo = struct {...@@ -8,7 +8,7 @@ const Foo = struct {
88
9test "compare void with void compile time known" {9test "compare void with void compile time known" {
10 comptime {10 comptime {
11 const foo = Foo {11 const foo = Foo{
12 .a = {},12 .a = {},
13 .b = 1,13 .b = 1,
14 .c = {},14 .c = {},
test/cases/while.zig+2-2
...@@ -151,7 +151,7 @@ test "while on nullable with else result follow break prong" {...@@ -151,7 +151,7 @@ test "while on nullable with else result follow break prong" {
151test "while on error union with else result follow else prong" {151test "while on error union with else result follow else prong" {
152 const result = while (returnError()) |value| {152 const result = while (returnError()) |value| {
153 break value;153 break value;
154 } else|err| 154 } else |err|
155 i32(2);155 i32(2);
156 assert(result == 2);156 assert(result == 2);
157}157}
...@@ -159,7 +159,7 @@ test "while on error union with else result follow else prong" {...@@ -159,7 +159,7 @@ test "while on error union with else result follow else prong" {
159test "while on error union with else result follow break prong" {159test "while on error union with else result follow break prong" {
160 const result = while (returnSuccess(10)) |value| {160 const result = while (returnSuccess(10)) |value| {
161 break value;161 break value;
162 } else|err| 162 } else |err|
163 i32(2);163 i32(2);
164 assert(result == 10);164 assert(result == 10);
165}165}
test/compare_output.zig+2-2
...@@ -475,7 +475,7 @@ pub fn addCases(cases: &tests.CompareOutputContext) void {...@@ -475,7 +475,7 @@ pub fn addCases(cases: &tests.CompareOutputContext) void {
475 \\475 \\
476 );476 );
477477
478 tc.setCommandLineArgs([][]const u8 {478 tc.setCommandLineArgs([][]const u8{
479 "first arg",479 "first arg",
480 "'a' 'b' \\",480 "'a' 'b' \\",
481 "bare",481 "bare",
...@@ -516,7 +516,7 @@ pub fn addCases(cases: &tests.CompareOutputContext) void {...@@ -516,7 +516,7 @@ pub fn addCases(cases: &tests.CompareOutputContext) void {
516 \\516 \\
517 );517 );
518518
519 tc.setCommandLineArgs([][]const u8 {519 tc.setCommandLineArgs([][]const u8{
520 "first arg",520 "first arg",
521 "'a' 'b' \\",521 "'a' 'b' \\",
522 "bare",522 "bare",
test/compile_errors.zig+1502-718
...@@ -1,7 +1,8 @@...@@ -1,7 +1,8 @@
1const tests = @import("tests.zig");1const tests = @import("tests.zig");
22
3pub fn addCases(cases: &tests.CompileErrorContext) void {3pub fn addCases(cases: &tests.CompileErrorContext) void {
4 cases.add("invalid deref on switch target",4 cases.add(
5 "invalid deref on switch target",
5 \\comptime {6 \\comptime {
6 \\ var tile = Tile.Empty;7 \\ var tile = Tile.Empty;
7 \\ switch (tile.*) {8 \\ switch (tile.*) {
...@@ -14,15 +15,19 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -14,15 +15,19 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
14 \\ Filled,15 \\ Filled,
15 \\};16 \\};
16 ,17 ,
17 ".tmp_source.zig:3:17: error: invalid deref on switch target");18 ".tmp_source.zig:3:17: error: invalid deref on switch target",
19 );
1820
19 cases.add("invalid field access in comptime",21 cases.add(
22 "invalid field access in comptime",
20 \\comptime { var x = doesnt_exist.whatever; }23 \\comptime { var x = doesnt_exist.whatever; }
21 ,24 ,
22 ".tmp_source.zig:1:20: error: use of undeclared identifier 'doesnt_exist'");25 ".tmp_source.zig:1:20: error: use of undeclared identifier 'doesnt_exist'",
26 );
2327
24 cases.add("suspend inside suspend block",28 cases.add(
25 \\const std = @import("std");29 "suspend inside suspend block",
30 \\const std = @import("std",);
26 \\31 \\
27 \\export fn entry() void {32 \\export fn entry() void {
28 \\ var buf: [500]u8 = undefined;33 \\ var buf: [500]u8 = undefined;
...@@ -39,27 +44,32 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -39,27 +44,32 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
39 \\}44 \\}
40 ,45 ,
41 ".tmp_source.zig:12:9: error: cannot suspend inside suspend block",46 ".tmp_source.zig:12:9: error: cannot suspend inside suspend block",
42 ".tmp_source.zig:11:5: note: other suspend block here");47 ".tmp_source.zig:11:5: note: other suspend block here",
48 );
4349
44 cases.add("assign inline fn to non-comptime var",50 cases.add(
51 "assign inline fn to non-comptime var",
45 \\export fn entry() void {52 \\export fn entry() void {
46 \\ var a = b;53 \\ var a = b;
47 \\}54 \\}
48 \\inline fn b() void { }55 \\inline fn b() void { }
49 ,56 ,
50 ".tmp_source.zig:2:5: error: functions marked inline must be stored in const or comptime var",57 ".tmp_source.zig:2:5: error: functions marked inline must be stored in const or comptime var",
51 ".tmp_source.zig:4:8: note: declared here");58 ".tmp_source.zig:4:8: note: declared here",
59 );
5260
53 cases.add("wrong type passed to @panic",61 cases.add(
62 "wrong type passed to @panic",
54 \\export fn entry() void {63 \\export fn entry() void {
55 \\ var e = error.Foo;64 \\ var e = error.Foo;
56 \\ @panic(e);65 \\ @panic(e);
57 \\}66 \\}
58 ,67 ,
59 ".tmp_source.zig:3:12: error: expected type '[]const u8', found 'error{Foo}'");68 ".tmp_source.zig:3:12: error: expected type '[]const u8', found 'error{Foo}'",
69 );
6070
6171 cases.add(
62 cases.add("@tagName used on union with no associated enum tag",72 "@tagName used on union with no associated enum tag",
63 \\const FloatInt = extern union {73 \\const FloatInt = extern union {
64 \\ Float: f32,74 \\ Float: f32,
65 \\ Int: i32,75 \\ Int: i32,
...@@ -70,10 +80,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -70,10 +80,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
70 \\}80 \\}
71 ,81 ,
72 ".tmp_source.zig:7:19: error: union has no associated enum",82 ".tmp_source.zig:7:19: error: union has no associated enum",
73 ".tmp_source.zig:1:18: note: declared here");83 ".tmp_source.zig:1:18: note: declared here",
84 );
7485
75 cases.add("returning error from void async function",86 cases.add(
76 \\const std = @import("std");87 "returning error from void async function",
88 \\const std = @import("std",);
77 \\export fn entry() void {89 \\export fn entry() void {
78 \\ const p = async<std.debug.global_allocator> amain() catch unreachable;90 \\ const p = async<std.debug.global_allocator> amain() catch unreachable;
79 \\}91 \\}
...@@ -81,31 +93,39 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -81,31 +93,39 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
81 \\ return error.ShouldBeCompileError;93 \\ return error.ShouldBeCompileError;
82 \\}94 \\}
83 ,95 ,
84 ".tmp_source.zig:6:17: error: expected type 'void', found 'error{ShouldBeCompileError}'");96 ".tmp_source.zig:6:17: error: expected type 'void', found 'error{ShouldBeCompileError}'",
97 );
8598
86 cases.add("var not allowed in structs",99 cases.add(
100 "var not allowed in structs",
87 \\export fn entry() void {101 \\export fn entry() void {
88 \\ var s = (struct{v: var}){.v=i32(10)};102 \\ var s = (struct{v: var}){.v=i32(10)};
89 \\}103 \\}
90 ,104 ,
91 ".tmp_source.zig:2:23: error: invalid token: 'var'");105 ".tmp_source.zig:2:23: error: invalid token: 'var'",
106 );
92107
93 cases.add("@ptrCast discards const qualifier",108 cases.add(
109 "@ptrCast discards const qualifier",
94 \\export fn entry() void {110 \\export fn entry() void {
95 \\ const x: i32 = 1234;111 \\ const x: i32 = 1234;
96 \\ const y = @ptrCast(&i32, &x);112 \\ const y = @ptrCast(&i32, &x);
97 \\}113 \\}
98 ,114 ,
99 ".tmp_source.zig:3:15: error: cast discards const qualifier");115 ".tmp_source.zig:3:15: error: cast discards const qualifier",
116 );
100117
101 cases.add("comptime slice of undefined pointer non-zero len",118 cases.add(
119 "comptime slice of undefined pointer non-zero len",
102 \\export fn entry() void {120 \\export fn entry() void {
103 \\ const slice = (&i32)(undefined)[0..1];121 \\ const slice = (&i32)(undefined)[0..1];
104 \\}122 \\}
105 ,123 ,
106 ".tmp_source.zig:2:36: error: non-zero length slice of undefined pointer");124 ".tmp_source.zig:2:36: error: non-zero length slice of undefined pointer",
125 );
107126
108 cases.add("type checking function pointers",127 cases.add(
128 "type checking function pointers",
109 \\fn a(b: fn (&const u8) void) void {129 \\fn a(b: fn (&const u8) void) void {
110 \\ b('a');130 \\ b('a');
111 \\}131 \\}
...@@ -116,9 +136,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -116,9 +136,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
116 \\ a(c);136 \\ a(c);
117 \\}137 \\}
118 ,138 ,
119 ".tmp_source.zig:8:7: error: expected type 'fn(&const u8) void', found 'fn(u8) void'");139 ".tmp_source.zig:8:7: error: expected type 'fn(&const u8) void', found 'fn(u8) void'",
140 );
120141
121 cases.add("no else prong on switch on global error set",142 cases.add(
143 "no else prong on switch on global error set",
122 \\export fn entry() void {144 \\export fn entry() void {
123 \\ foo(error.A);145 \\ foo(error.A);
124 \\}146 \\}
...@@ -128,18 +150,22 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -128,18 +150,22 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
128 \\ }150 \\ }
129 \\}151 \\}
130 ,152 ,
131 ".tmp_source.zig:5:5: error: else prong required when switching on type 'error'");153 ".tmp_source.zig:5:5: error: else prong required when switching on type 'error'",
154 );
132155
133 cases.add("inferred error set with no returned error",156 cases.add(
157 "inferred error set with no returned error",
134 \\export fn entry() void {158 \\export fn entry() void {
135 \\ foo() catch unreachable;159 \\ foo() catch unreachable;
136 \\}160 \\}
137 \\fn foo() !void {161 \\fn foo() !void {
138 \\}162 \\}
139 ,163 ,
140 ".tmp_source.zig:4:11: error: function with inferred error set must return at least one possible error");164 ".tmp_source.zig:4:11: error: function with inferred error set must return at least one possible error",
165 );
141166
142 cases.add("error not handled in switch",167 cases.add(
168 "error not handled in switch",
143 \\export fn entry() void {169 \\export fn entry() void {
144 \\ foo(452) catch |err| switch (err) {170 \\ foo(452) catch |err| switch (err) {
145 \\ error.Foo => {},171 \\ error.Foo => {},
...@@ -155,9 +181,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -155,9 +181,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
155 \\}181 \\}
156 ,182 ,
157 ".tmp_source.zig:2:26: error: error.Baz not handled in switch",183 ".tmp_source.zig:2:26: error: error.Baz not handled in switch",
158 ".tmp_source.zig:2:26: error: error.Bar not handled in switch");184 ".tmp_source.zig:2:26: error: error.Bar not handled in switch",
185 );
159186
160 cases.add("duplicate error in switch",187 cases.add(
188 "duplicate error in switch",
161 \\export fn entry() void {189 \\export fn entry() void {
162 \\ foo(452) catch |err| switch (err) {190 \\ foo(452) catch |err| switch (err) {
163 \\ error.Foo => {},191 \\ error.Foo => {},
...@@ -175,9 +203,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -175,9 +203,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
175 \\}203 \\}
176 ,204 ,
177 ".tmp_source.zig:5:14: error: duplicate switch value: '@typeOf(foo).ReturnType.ErrorSet.Foo'",205 ".tmp_source.zig:5:14: error: duplicate switch value: '@typeOf(foo).ReturnType.ErrorSet.Foo'",
178 ".tmp_source.zig:3:14: note: other value is here");206 ".tmp_source.zig:3:14: note: other value is here",
207 );
179208
180 cases.add("range operator in switch used on error set",209 cases.add(
210 "range operator in switch used on error set",
181 \\export fn entry() void {211 \\export fn entry() void {
182 \\ try foo(452) catch |err| switch (err) {212 \\ try foo(452) catch |err| switch (err) {
183 \\ error.A ... error.B => {},213 \\ error.A ... error.B => {},
...@@ -192,31 +222,39 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -192,31 +222,39 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
192 \\ }222 \\ }
193 \\}223 \\}
194 ,224 ,
195 ".tmp_source.zig:3:17: error: operator not allowed for errors");225 ".tmp_source.zig:3:17: error: operator not allowed for errors",
226 );
196227
197 cases.add("inferring error set of function pointer",228 cases.add(
229 "inferring error set of function pointer",
198 \\comptime {230 \\comptime {
199 \\ const z: ?fn()!void = null;231 \\ const z: ?fn()!void = null;
200 \\}232 \\}
201 ,233 ,
202 ".tmp_source.zig:2:15: error: inferring error set of return type valid only for function definitions");234 ".tmp_source.zig:2:15: error: inferring error set of return type valid only for function definitions",
235 );
203236
204 cases.add("access non-existent member of error set",237 cases.add(
238 "access non-existent member of error set",
205 \\const Foo = error{A};239 \\const Foo = error{A};
206 \\comptime {240 \\comptime {
207 \\ const z = Foo.Bar;241 \\ const z = Foo.Bar;
208 \\}242 \\}
209 ,243 ,
210 ".tmp_source.zig:3:18: error: no error named 'Bar' in 'Foo'");244 ".tmp_source.zig:3:18: error: no error named 'Bar' in 'Foo'",
245 );
211246
212 cases.add("error union operator with non error set LHS",247 cases.add(
248 "error union operator with non error set LHS",
213 \\comptime {249 \\comptime {
214 \\ const z = i32!i32;250 \\ const z = i32!i32;
215 \\}251 \\}
216 ,252 ,
217 ".tmp_source.zig:2:15: error: expected error set type, found type 'i32'");253 ".tmp_source.zig:2:15: error: expected error set type, found type 'i32'",
254 );
218255
219 cases.add("error equality but sets have no common members",256 cases.add(
257 "error equality but sets have no common members",
220 \\const Set1 = error{A, C};258 \\const Set1 = error{A, C};
221 \\const Set2 = error{B, D};259 \\const Set2 = error{B, D};
222 \\export fn entry() void {260 \\export fn entry() void {
...@@ -228,16 +266,20 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -228,16 +266,20 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
228 \\ }266 \\ }
229 \\}267 \\}
230 ,268 ,
231 ".tmp_source.zig:7:11: error: error sets 'Set1' and 'Set2' have no common errors");269 ".tmp_source.zig:7:11: error: error sets 'Set1' and 'Set2' have no common errors",
270 );
232271
233 cases.add("only equality binary operator allowed for error sets",272 cases.add(
273 "only equality binary operator allowed for error sets",
234 \\comptime {274 \\comptime {
235 \\ const z = error.A > error.B;275 \\ const z = error.A > error.B;
236 \\}276 \\}
237 ,277 ,
238 ".tmp_source.zig:2:23: error: operator not allowed for errors");278 ".tmp_source.zig:2:23: error: operator not allowed for errors",
279 );
239280
240 cases.add("explicit error set cast known at comptime violates error sets",281 cases.add(
282 "explicit error set cast known at comptime violates error sets",
241 \\const Set1 = error {A, B};283 \\const Set1 = error {A, B};
242 \\const Set2 = error {A, C};284 \\const Set2 = error {A, C};
243 \\comptime {285 \\comptime {
...@@ -245,9 +287,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -245,9 +287,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
245 \\ var y = Set2(x);287 \\ var y = Set2(x);
246 \\}288 \\}
247 ,289 ,
248 ".tmp_source.zig:5:17: error: error.B not a member of error set 'Set2'");290 ".tmp_source.zig:5:17: error: error.B not a member of error set 'Set2'",
291 );
249292
250 cases.add("cast error union of global error set to error union of smaller error set",293 cases.add(
294 "cast error union of global error set to error union of smaller error set",
251 \\const SmallErrorSet = error{A};295 \\const SmallErrorSet = error{A};
252 \\export fn entry() void {296 \\export fn entry() void {
253 \\ var x: SmallErrorSet!i32 = foo();297 \\ var x: SmallErrorSet!i32 = foo();
...@@ -257,9 +301,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -257,9 +301,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
257 \\}301 \\}
258 ,302 ,
259 ".tmp_source.zig:3:35: error: expected 'SmallErrorSet!i32', found 'error!i32'",303 ".tmp_source.zig:3:35: error: expected 'SmallErrorSet!i32', found 'error!i32'",
260 ".tmp_source.zig:3:35: note: unable to cast global error set into smaller set");304 ".tmp_source.zig:3:35: note: unable to cast global error set into smaller set",
305 );
261306
262 cases.add("cast global error set to error set",307 cases.add(
308 "cast global error set to error set",
263 \\const SmallErrorSet = error{A};309 \\const SmallErrorSet = error{A};
264 \\export fn entry() void {310 \\export fn entry() void {
265 \\ var x: SmallErrorSet = foo();311 \\ var x: SmallErrorSet = foo();
...@@ -269,9 +315,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -269,9 +315,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
269 \\}315 \\}
270 ,316 ,
271 ".tmp_source.zig:3:31: error: expected 'SmallErrorSet', found 'error'",317 ".tmp_source.zig:3:31: error: expected 'SmallErrorSet', found 'error'",
272 ".tmp_source.zig:3:31: note: unable to cast global error set into smaller set");318 ".tmp_source.zig:3:31: note: unable to cast global error set into smaller set",
319 );
273320
274 cases.add("recursive inferred error set",321 cases.add(
322 "recursive inferred error set",
275 \\export fn entry() void {323 \\export fn entry() void {
276 \\ foo() catch unreachable;324 \\ foo() catch unreachable;
277 \\}325 \\}
...@@ -279,9 +327,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -279,9 +327,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
279 \\ try foo();327 \\ try foo();
280 \\}328 \\}
281 ,329 ,
282 ".tmp_source.zig:5:5: error: cannot resolve inferred error set '@typeOf(foo).ReturnType.ErrorSet': function 'foo' not fully analyzed yet");330 ".tmp_source.zig:5:5: error: cannot resolve inferred error set '@typeOf(foo).ReturnType.ErrorSet': function 'foo' not fully analyzed yet",
331 );
283332
284 cases.add("implicit cast of error set not a subset",333 cases.add(
334 "implicit cast of error set not a subset",
285 \\const Set1 = error{A, B};335 \\const Set1 = error{A, B};
286 \\const Set2 = error{A, C};336 \\const Set2 = error{A, C};
287 \\export fn entry() void {337 \\export fn entry() void {
...@@ -292,18 +342,22 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -292,18 +342,22 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
292 \\}342 \\}
293 ,343 ,
294 ".tmp_source.zig:7:19: error: expected 'Set2', found 'Set1'",344 ".tmp_source.zig:7:19: error: expected 'Set2', found 'Set1'",
295 ".tmp_source.zig:1:23: note: 'error.B' not a member of destination error set");345 ".tmp_source.zig:1:23: note: 'error.B' not a member of destination error set",
346 );
296347
297 cases.add("int to err global invalid number",348 cases.add(
349 "int to err global invalid number",
298 \\const Set1 = error{A, B};350 \\const Set1 = error{A, B};
299 \\comptime {351 \\comptime {
300 \\ var x: usize = 3;352 \\ var x: usize = 3;
301 \\ var y = error(x);353 \\ var y = error(x);
302 \\}354 \\}
303 ,355 ,
304 ".tmp_source.zig:4:18: error: integer value 3 represents no error");356 ".tmp_source.zig:4:18: error: integer value 3 represents no error",
357 );
305358
306 cases.add("int to err non global invalid number",359 cases.add(
360 "int to err non global invalid number",
307 \\const Set1 = error{A, B};361 \\const Set1 = error{A, B};
308 \\const Set2 = error{A, C};362 \\const Set2 = error{A, C};
309 \\comptime {363 \\comptime {
...@@ -311,16 +365,20 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -311,16 +365,20 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
311 \\ var y = Set2(x);365 \\ var y = Set2(x);
312 \\}366 \\}
313 ,367 ,
314 ".tmp_source.zig:5:17: error: integer value 2 represents no error in 'Set2'");368 ".tmp_source.zig:5:17: error: integer value 2 represents no error in 'Set2'",
369 );
315370
316 cases.add("@memberCount of error",371 cases.add(
372 "@memberCount of error",
317 \\comptime {373 \\comptime {
318 \\ _ = @memberCount(error);374 \\ _ = @memberCount(error);
319 \\}375 \\}
320 ,376 ,
321 ".tmp_source.zig:2:9: error: global error set member count not available at comptime");377 ".tmp_source.zig:2:9: error: global error set member count not available at comptime",
378 );
322379
323 cases.add("duplicate error value in error set",380 cases.add(
381 "duplicate error value in error set",
324 \\const Foo = error {382 \\const Foo = error {
325 \\ Bar,383 \\ Bar,
326 \\ Bar,384 \\ Bar,
...@@ -330,22 +388,30 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -330,22 +388,30 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
330 \\}388 \\}
331 ,389 ,
332 ".tmp_source.zig:3:5: error: duplicate error: 'Bar'",390 ".tmp_source.zig:3:5: error: duplicate error: 'Bar'",
333 ".tmp_source.zig:2:5: note: other error here");391 ".tmp_source.zig:2:5: note: other error here",
392 );
334393
335 cases.add("cast negative integer literal to usize",394 cases.add(
395 "cast negative integer literal to usize",
336 \\export fn entry() void {396 \\export fn entry() void {
337 \\ const x = usize(-10);397 \\ const x = usize(-10);
338 \\}398 \\}
339 , ".tmp_source.zig:2:21: error: cannot cast negative value -10 to unsigned integer type 'usize'");399 ,
400 ".tmp_source.zig:2:21: error: cannot cast negative value -10 to unsigned integer type 'usize'",
401 );
340402
341 cases.add("use invalid number literal as array index",403 cases.add(
404 "use invalid number literal as array index",
342 \\var v = 25;405 \\var v = 25;
343 \\export fn entry() void {406 \\export fn entry() void {
344 \\ var arr: [v]u8 = undefined;407 \\ var arr: [v]u8 = undefined;
345 \\}408 \\}
346 , ".tmp_source.zig:1:1: error: unable to infer variable type");409 ,
410 ".tmp_source.zig:1:1: error: unable to infer variable type",
411 );
347412
348 cases.add("duplicate struct field",413 cases.add(
414 "duplicate struct field",
349 \\const Foo = struct {415 \\const Foo = struct {
350 \\ Bar: i32,416 \\ Bar: i32,
351 \\ Bar: usize,417 \\ Bar: usize,
...@@ -355,9 +421,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -355,9 +421,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
355 \\}421 \\}
356 ,422 ,
357 ".tmp_source.zig:3:5: error: duplicate struct field: 'Bar'",423 ".tmp_source.zig:3:5: error: duplicate struct field: 'Bar'",
358 ".tmp_source.zig:2:5: note: other field here");424 ".tmp_source.zig:2:5: note: other field here",
425 );
359426
360 cases.add("duplicate union field",427 cases.add(
428 "duplicate union field",
361 \\const Foo = union {429 \\const Foo = union {
362 \\ Bar: i32,430 \\ Bar: i32,
363 \\ Bar: usize,431 \\ Bar: usize,
...@@ -367,9 +435,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -367,9 +435,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
367 \\}435 \\}
368 ,436 ,
369 ".tmp_source.zig:3:5: error: duplicate union field: 'Bar'",437 ".tmp_source.zig:3:5: error: duplicate union field: 'Bar'",
370 ".tmp_source.zig:2:5: note: other field here");438 ".tmp_source.zig:2:5: note: other field here",
439 );
371440
372 cases.add("duplicate enum field",441 cases.add(
442 "duplicate enum field",
373 \\const Foo = enum {443 \\const Foo = enum {
374 \\ Bar,444 \\ Bar,
375 \\ Bar,445 \\ Bar,
...@@ -380,77 +450,108 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -380,77 +450,108 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
380 \\}450 \\}
381 ,451 ,
382 ".tmp_source.zig:3:5: error: duplicate enum field: 'Bar'",452 ".tmp_source.zig:3:5: error: duplicate enum field: 'Bar'",
383 ".tmp_source.zig:2:5: note: other field here");453 ".tmp_source.zig:2:5: note: other field here",
454 );
384455
385 cases.add("calling function with naked calling convention",456 cases.add(
457 "calling function with naked calling convention",
386 \\export fn entry() void {458 \\export fn entry() void {
387 \\ foo();459 \\ foo();
388 \\}460 \\}
389 \\nakedcc fn foo() void { }461 \\nakedcc fn foo() void { }
390 ,462 ,
391 ".tmp_source.zig:2:5: error: unable to call function with naked calling convention",463 ".tmp_source.zig:2:5: error: unable to call function with naked calling convention",
392 ".tmp_source.zig:4:9: note: declared here");464 ".tmp_source.zig:4:9: note: declared here",
465 );
393466
394 cases.add("function with invalid return type",467 cases.add(
468 "function with invalid return type",
395 \\export fn foo() boid {}469 \\export fn foo() boid {}
396 , ".tmp_source.zig:1:17: error: use of undeclared identifier 'boid'");470 ,
471 ".tmp_source.zig:1:17: error: use of undeclared identifier 'boid'",
472 );
397473
398 cases.add("function with non-extern non-packed enum parameter",474 cases.add(
475 "function with non-extern non-packed enum parameter",
399 \\const Foo = enum { A, B, C };476 \\const Foo = enum { A, B, C };
400 \\export fn entry(foo: Foo) void { }477 \\export fn entry(foo: Foo) void { }
401 , ".tmp_source.zig:2:22: error: parameter of type 'Foo' not allowed in function with calling convention 'ccc'");478 ,
479 ".tmp_source.zig:2:22: error: parameter of type 'Foo' not allowed in function with calling convention 'ccc'",
480 );
402481
403 cases.add("function with non-extern non-packed struct parameter",482 cases.add(
483 "function with non-extern non-packed struct parameter",
404 \\const Foo = struct {484 \\const Foo = struct {
405 \\ A: i32,485 \\ A: i32,
406 \\ B: f32,486 \\ B: f32,
407 \\ C: bool,487 \\ C: bool,
408 \\};488 \\};
409 \\export fn entry(foo: Foo) void { }489 \\export fn entry(foo: Foo) void { }
410 , ".tmp_source.zig:6:22: error: parameter of type 'Foo' not allowed in function with calling convention 'ccc'");490 ,
491 ".tmp_source.zig:6:22: error: parameter of type 'Foo' not allowed in function with calling convention 'ccc'",
492 );
411493
412 cases.add("function with non-extern non-packed union parameter",494 cases.add(
495 "function with non-extern non-packed union parameter",
413 \\const Foo = union {496 \\const Foo = union {
414 \\ A: i32,497 \\ A: i32,
415 \\ B: f32,498 \\ B: f32,
416 \\ C: bool,499 \\ C: bool,
417 \\};500 \\};
418 \\export fn entry(foo: Foo) void { }501 \\export fn entry(foo: Foo) void { }
419 , ".tmp_source.zig:6:22: error: parameter of type 'Foo' not allowed in function with calling convention 'ccc'");502 ,
503 ".tmp_source.zig:6:22: error: parameter of type 'Foo' not allowed in function with calling convention 'ccc'",
504 );
420505
421 cases.add("switch on enum with 1 field with no prongs",506 cases.add(
507 "switch on enum with 1 field with no prongs",
422 \\const Foo = enum { M };508 \\const Foo = enum { M };
423 \\509 \\
424 \\export fn entry() void {510 \\export fn entry() void {
425 \\ var f = Foo.M;511 \\ var f = Foo.M;
426 \\ switch (f) {}512 \\ switch (f) {}
427 \\}513 \\}
428 , ".tmp_source.zig:5:5: error: enumeration value 'Foo.M' not handled in switch");514 ,
515 ".tmp_source.zig:5:5: error: enumeration value 'Foo.M' not handled in switch",
516 );
429517
430 cases.add("shift by negative comptime integer",518 cases.add(
519 "shift by negative comptime integer",
431 \\comptime {520 \\comptime {
432 \\ var a = 1 >> -1;521 \\ var a = 1 >> -1;
433 \\}522 \\}
434 , ".tmp_source.zig:2:18: error: shift by negative value -1");523 ,
524 ".tmp_source.zig:2:18: error: shift by negative value -1",
525 );
435526
436 cases.add("@panic called at compile time",527 cases.add(
528 "@panic called at compile time",
437 \\export fn entry() void {529 \\export fn entry() void {
438 \\ comptime {530 \\ comptime {
439 \\ @panic("aoeu");531 \\ @panic("aoeu",);
440 \\ }532 \\ }
441 \\}533 \\}
442 , ".tmp_source.zig:3:9: error: encountered @panic at compile-time");534 ,
535 ".tmp_source.zig:3:9: error: encountered @panic at compile-time",
536 );
443537
444 cases.add("wrong return type for main",538 cases.add(
539 "wrong return type for main",
445 \\pub fn main() f32 { }540 \\pub fn main() f32 { }
446 , "error: expected return type of main to be 'u8', 'noreturn', 'void', or '!void'");541 ,
542 "error: expected return type of main to be 'u8', 'noreturn', 'void', or '!void'",
543 );
447544
448 cases.add("double ?? on main return value",545 cases.add(
546 "double ?? on main return value",
449 \\pub fn main() ??void {547 \\pub fn main() ??void {
450 \\}548 \\}
451 , "error: expected return type of main to be 'u8', 'noreturn', 'void', or '!void'");549 ,
550 "error: expected return type of main to be 'u8', 'noreturn', 'void', or '!void'",
551 );
452552
453 cases.add("bad identifier in function with struct defined inside function which references local const",553 cases.add(
554 "bad identifier in function with struct defined inside function which references local const",
454 \\export fn entry() void {555 \\export fn entry() void {
455 \\ const BlockKind = u32;556 \\ const BlockKind = u32;
456 \\557 \\
...@@ -460,9 +561,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -460,9 +561,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
460 \\561 \\
461 \\ bogus;562 \\ bogus;
462 \\}563 \\}
463 , ".tmp_source.zig:8:5: error: use of undeclared identifier 'bogus'");564 ,
565 ".tmp_source.zig:8:5: error: use of undeclared identifier 'bogus'",
566 );
464567
465 cases.add("labeled break not found",568 cases.add(
569 "labeled break not found",
466 \\export fn entry() void {570 \\export fn entry() void {
467 \\ blah: while (true) {571 \\ blah: while (true) {
468 \\ while (true) {572 \\ while (true) {
...@@ -470,9 +574,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -470,9 +574,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
470 \\ }574 \\ }
471 \\ }575 \\ }
472 \\}576 \\}
473 , ".tmp_source.zig:4:13: error: label not found: 'outer'");577 ,
578 ".tmp_source.zig:4:13: error: label not found: 'outer'",
579 );
474580
475 cases.add("labeled continue not found",581 cases.add(
582 "labeled continue not found",
476 \\export fn entry() void {583 \\export fn entry() void {
477 \\ var i: usize = 0;584 \\ var i: usize = 0;
478 \\ blah: while (i < 10) : (i += 1) {585 \\ blah: while (i < 10) : (i += 1) {
...@@ -481,9 +588,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -481,9 +588,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
481 \\ }588 \\ }
482 \\ }589 \\ }
483 \\}590 \\}
484 , ".tmp_source.zig:5:13: error: labeled loop not found: 'outer'");591 ,
592 ".tmp_source.zig:5:13: error: labeled loop not found: 'outer'",
593 );
485594
486 cases.add("attempt to use 0 bit type in extern fn",595 cases.add(
596 "attempt to use 0 bit type in extern fn",
487 \\extern fn foo(ptr: extern fn(&void) void) void;597 \\extern fn foo(ptr: extern fn(&void) void) void;
488 \\598 \\
489 \\export fn entry() void {599 \\export fn entry() void {
...@@ -491,390 +601,541 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -491,390 +601,541 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
491 \\}601 \\}
492 \\602 \\
493 \\extern fn bar(x: &void) void { }603 \\extern fn bar(x: &void) void { }
494 , ".tmp_source.zig:7:18: error: parameter of type '&void' has 0 bits; not allowed in function with calling convention 'ccc'");604 ,
605 ".tmp_source.zig:7:18: error: parameter of type '&void' has 0 bits; not allowed in function with calling convention 'ccc'",
606 );
495607
496 cases.add("implicit semicolon - block statement",608 cases.add(
609 "implicit semicolon - block statement",
497 \\export fn entry() void {610 \\export fn entry() void {
498 \\ {}611 \\ {}
499 \\ var good = {};612 \\ var good = {};
500 \\ ({})613 \\ ({})
501 \\ var bad = {};614 \\ var bad = {};
502 \\}615 \\}
503 , ".tmp_source.zig:5:5: error: expected token ';', found 'var'");616 ,
617 ".tmp_source.zig:5:5: error: expected token ';', found 'var'",
618 );
504619
505 cases.add("implicit semicolon - block expr",620 cases.add(
621 "implicit semicolon - block expr",
506 \\export fn entry() void {622 \\export fn entry() void {
507 \\ _ = {};623 \\ _ = {};
508 \\ var good = {};624 \\ var good = {};
509 \\ _ = {}625 \\ _ = {}
510 \\ var bad = {};626 \\ var bad = {};
511 \\}627 \\}
512 , ".tmp_source.zig:5:5: error: expected token ';', found 'var'");628 ,
629 ".tmp_source.zig:5:5: error: expected token ';', found 'var'",
630 );
513631
514 cases.add("implicit semicolon - comptime statement",632 cases.add(
633 "implicit semicolon - comptime statement",
515 \\export fn entry() void {634 \\export fn entry() void {
516 \\ comptime {}635 \\ comptime {}
517 \\ var good = {};636 \\ var good = {};
518 \\ comptime ({})637 \\ comptime ({})
519 \\ var bad = {};638 \\ var bad = {};
520 \\}639 \\}
521 , ".tmp_source.zig:5:5: error: expected token ';', found 'var'");640 ,
641 ".tmp_source.zig:5:5: error: expected token ';', found 'var'",
642 );
522643
523 cases.add("implicit semicolon - comptime expression",644 cases.add(
645 "implicit semicolon - comptime expression",
524 \\export fn entry() void {646 \\export fn entry() void {
525 \\ _ = comptime {};647 \\ _ = comptime {};
526 \\ var good = {};648 \\ var good = {};
527 \\ _ = comptime {}649 \\ _ = comptime {}
528 \\ var bad = {};650 \\ var bad = {};
529 \\}651 \\}
530 , ".tmp_source.zig:5:5: error: expected token ';', found 'var'");652 ,
653 ".tmp_source.zig:5:5: error: expected token ';', found 'var'",
654 );
531655
532 cases.add("implicit semicolon - defer",656 cases.add(
657 "implicit semicolon - defer",
533 \\export fn entry() void {658 \\export fn entry() void {
534 \\ defer {}659 \\ defer {}
535 \\ var good = {};660 \\ var good = {};
536 \\ defer ({})661 \\ defer ({})
537 \\ var bad = {};662 \\ var bad = {};
538 \\}663 \\}
539 , ".tmp_source.zig:5:5: error: expected token ';', found 'var'");664 ,
665 ".tmp_source.zig:5:5: error: expected token ';', found 'var'",
666 );
540667
541 cases.add("implicit semicolon - if statement",668 cases.add(
669 "implicit semicolon - if statement",
542 \\export fn entry() void {670 \\export fn entry() void {
543 \\ if(true) {}671 \\ if(true) {}
544 \\ var good = {};672 \\ var good = {};
545 \\ if(true) ({})673 \\ if(true) ({})
546 \\ var bad = {};674 \\ var bad = {};
547 \\}675 \\}
548 , ".tmp_source.zig:5:5: error: expected token ';', found 'var'");676 ,
677 ".tmp_source.zig:5:5: error: expected token ';', found 'var'",
678 );
549679
550 cases.add("implicit semicolon - if expression",680 cases.add(
681 "implicit semicolon - if expression",
551 \\export fn entry() void {682 \\export fn entry() void {
552 \\ _ = if(true) {};683 \\ _ = if(true) {};
553 \\ var good = {};684 \\ var good = {};
554 \\ _ = if(true) {}685 \\ _ = if(true) {}
555 \\ var bad = {};686 \\ var bad = {};
556 \\}687 \\}
557 , ".tmp_source.zig:5:5: error: expected token ';', found 'var'");688 ,
689 ".tmp_source.zig:5:5: error: expected token ';', found 'var'",
690 );
558691
559 cases.add("implicit semicolon - if-else statement",692 cases.add(
693 "implicit semicolon - if-else statement",
560 \\export fn entry() void {694 \\export fn entry() void {
561 \\ if(true) {} else {}695 \\ if(true) {} else {}
562 \\ var good = {};696 \\ var good = {};
563 \\ if(true) ({}) else ({})697 \\ if(true) ({}) else ({})
564 \\ var bad = {};698 \\ var bad = {};
565 \\}699 \\}
566 , ".tmp_source.zig:5:5: error: expected token ';', found 'var'");700 ,
701 ".tmp_source.zig:5:5: error: expected token ';', found 'var'",
702 );
567703
568 cases.add("implicit semicolon - if-else expression",704 cases.add(
705 "implicit semicolon - if-else expression",
569 \\export fn entry() void {706 \\export fn entry() void {
570 \\ _ = if(true) {} else {};707 \\ _ = if(true) {} else {};
571 \\ var good = {};708 \\ var good = {};
572 \\ _ = if(true) {} else {}709 \\ _ = if(true) {} else {}
573 \\ var bad = {};710 \\ var bad = {};
574 \\}711 \\}
575 , ".tmp_source.zig:5:5: error: expected token ';', found 'var'");712 ,
713 ".tmp_source.zig:5:5: error: expected token ';', found 'var'",
714 );
576715
577 cases.add("implicit semicolon - if-else-if statement",716 cases.add(
717 "implicit semicolon - if-else-if statement",
578 \\export fn entry() void {718 \\export fn entry() void {
579 \\ if(true) {} else if(true) {}719 \\ if(true) {} else if(true) {}
580 \\ var good = {};720 \\ var good = {};
581 \\ if(true) ({}) else if(true) ({})721 \\ if(true) ({}) else if(true) ({})
582 \\ var bad = {};722 \\ var bad = {};
583 \\}723 \\}
584 , ".tmp_source.zig:5:5: error: expected token ';', found 'var'");724 ,
725 ".tmp_source.zig:5:5: error: expected token ';', found 'var'",
726 );
585727
586 cases.add("implicit semicolon - if-else-if expression",728 cases.add(
729 "implicit semicolon - if-else-if expression",
587 \\export fn entry() void {730 \\export fn entry() void {
588 \\ _ = if(true) {} else if(true) {};731 \\ _ = if(true) {} else if(true) {};
589 \\ var good = {};732 \\ var good = {};
590 \\ _ = if(true) {} else if(true) {}733 \\ _ = if(true) {} else if(true) {}
591 \\ var bad = {};734 \\ var bad = {};
592 \\}735 \\}
593 , ".tmp_source.zig:5:5: error: expected token ';', found 'var'");736 ,
737 ".tmp_source.zig:5:5: error: expected token ';', found 'var'",
738 );
594739
595 cases.add("implicit semicolon - if-else-if-else statement",740 cases.add(
741 "implicit semicolon - if-else-if-else statement",
596 \\export fn entry() void {742 \\export fn entry() void {
597 \\ if(true) {} else if(true) {} else {}743 \\ if(true) {} else if(true) {} else {}
598 \\ var good = {};744 \\ var good = {};
599 \\ if(true) ({}) else if(true) ({}) else ({})745 \\ if(true) ({}) else if(true) ({}) else ({})
600 \\ var bad = {};746 \\ var bad = {};
601 \\}747 \\}
602 , ".tmp_source.zig:5:5: error: expected token ';', found 'var'");748 ,
749 ".tmp_source.zig:5:5: error: expected token ';', found 'var'",
750 );
603751
604 cases.add("implicit semicolon - if-else-if-else expression",752 cases.add(
753 "implicit semicolon - if-else-if-else expression",
605 \\export fn entry() void {754 \\export fn entry() void {
606 \\ _ = if(true) {} else if(true) {} else {};755 \\ _ = if(true) {} else if(true) {} else {};
607 \\ var good = {};756 \\ var good = {};
608 \\ _ = if(true) {} else if(true) {} else {}757 \\ _ = if(true) {} else if(true) {} else {}
609 \\ var bad = {};758 \\ var bad = {};
610 \\}759 \\}
611 , ".tmp_source.zig:5:5: error: expected token ';', found 'var'");760 ,
761 ".tmp_source.zig:5:5: error: expected token ';', found 'var'",
762 );
612763
613 cases.add("implicit semicolon - test statement",764 cases.add(
765 "implicit semicolon - test statement",
614 \\export fn entry() void {766 \\export fn entry() void {
615 \\ if (foo()) |_| {}767 \\ if (foo()) |_| {}
616 \\ var good = {};768 \\ var good = {};
617 \\ if (foo()) |_| ({})769 \\ if (foo()) |_| ({})
618 \\ var bad = {};770 \\ var bad = {};
619 \\}771 \\}
620 , ".tmp_source.zig:5:5: error: expected token ';', found 'var'");772 ,
773 ".tmp_source.zig:5:5: error: expected token ';', found 'var'",
774 );
621775
622 cases.add("implicit semicolon - test expression",776 cases.add(
777 "implicit semicolon - test expression",
623 \\export fn entry() void {778 \\export fn entry() void {
624 \\ _ = if (foo()) |_| {};779 \\ _ = if (foo()) |_| {};
625 \\ var good = {};780 \\ var good = {};
626 \\ _ = if (foo()) |_| {}781 \\ _ = if (foo()) |_| {}
627 \\ var bad = {};782 \\ var bad = {};
628 \\}783 \\}
629 , ".tmp_source.zig:5:5: error: expected token ';', found 'var'");784 ,
785 ".tmp_source.zig:5:5: error: expected token ';', found 'var'",
786 );
630787
631 cases.add("implicit semicolon - while statement",788 cases.add(
789 "implicit semicolon - while statement",
632 \\export fn entry() void {790 \\export fn entry() void {
633 \\ while(true) {}791 \\ while(true) {}
634 \\ var good = {};792 \\ var good = {};
635 \\ while(true) ({})793 \\ while(true) ({})
636 \\ var bad = {};794 \\ var bad = {};
637 \\}795 \\}
638 , ".tmp_source.zig:5:5: error: expected token ';', found 'var'");796 ,
797 ".tmp_source.zig:5:5: error: expected token ';', found 'var'",
798 );
639799
640 cases.add("implicit semicolon - while expression",800 cases.add(
801 "implicit semicolon - while expression",
641 \\export fn entry() void {802 \\export fn entry() void {
642 \\ _ = while(true) {};803 \\ _ = while(true) {};
643 \\ var good = {};804 \\ var good = {};
644 \\ _ = while(true) {}805 \\ _ = while(true) {}
645 \\ var bad = {};806 \\ var bad = {};
646 \\}807 \\}
647 , ".tmp_source.zig:5:5: error: expected token ';', found 'var'");808 ,
809 ".tmp_source.zig:5:5: error: expected token ';', found 'var'",
810 );
648811
649 cases.add("implicit semicolon - while-continue statement",812 cases.add(
813 "implicit semicolon - while-continue statement",
650 \\export fn entry() void {814 \\export fn entry() void {
651 \\ while(true):({}) {}815 \\ while(true):({}) {}
652 \\ var good = {};816 \\ var good = {};
653 \\ while(true):({}) ({})817 \\ while(true):({}) ({})
654 \\ var bad = {};818 \\ var bad = {};
655 \\}819 \\}
656 , ".tmp_source.zig:5:5: error: expected token ';', found 'var'");820 ,
821 ".tmp_source.zig:5:5: error: expected token ';', found 'var'",
822 );
657823
658 cases.add("implicit semicolon - while-continue expression",824 cases.add(
825 "implicit semicolon - while-continue expression",
659 \\export fn entry() void {826 \\export fn entry() void {
660 \\ _ = while(true):({}) {};827 \\ _ = while(true):({}) {};
661 \\ var good = {};828 \\ var good = {};
662 \\ _ = while(true):({}) {}829 \\ _ = while(true):({}) {}
663 \\ var bad = {};830 \\ var bad = {};
664 \\}831 \\}
665 , ".tmp_source.zig:5:5: error: expected token ';', found 'var'");832 ,
833 ".tmp_source.zig:5:5: error: expected token ';', found 'var'",
834 );
666835
667 cases.add("implicit semicolon - for statement",836 cases.add(
837 "implicit semicolon - for statement",
668 \\export fn entry() void {838 \\export fn entry() void {
669 \\ for(foo()) {}839 \\ for(foo()) {}
670 \\ var good = {};840 \\ var good = {};
671 \\ for(foo()) ({})841 \\ for(foo()) ({})
672 \\ var bad = {};842 \\ var bad = {};
673 \\}843 \\}
674 , ".tmp_source.zig:5:5: error: expected token ';', found 'var'");844 ,
845 ".tmp_source.zig:5:5: error: expected token ';', found 'var'",
846 );
675847
676 cases.add("implicit semicolon - for expression",848 cases.add(
849 "implicit semicolon - for expression",
677 \\export fn entry() void {850 \\export fn entry() void {
678 \\ _ = for(foo()) {};851 \\ _ = for(foo()) {};
679 \\ var good = {};852 \\ var good = {};
680 \\ _ = for(foo()) {}853 \\ _ = for(foo()) {}
681 \\ var bad = {};854 \\ var bad = {};
682 \\}855 \\}
683 , ".tmp_source.zig:5:5: error: expected token ';', found 'var'");856 ,
857 ".tmp_source.zig:5:5: error: expected token ';', found 'var'",
858 );
684859
685 cases.add("multiple function definitions",860 cases.add(
861 "multiple function definitions",
686 \\fn a() void {}862 \\fn a() void {}
687 \\fn a() void {}863 \\fn a() void {}
688 \\export fn entry() void { a(); }864 \\export fn entry() void { a(); }
689 , ".tmp_source.zig:2:1: error: redefinition of 'a'");865 ,
866 ".tmp_source.zig:2:1: error: redefinition of 'a'",
867 );
690868
691 cases.add("unreachable with return",869 cases.add(
870 "unreachable with return",
692 \\fn a() noreturn {return;}871 \\fn a() noreturn {return;}
693 \\export fn entry() void { a(); }872 \\export fn entry() void { a(); }
694 , ".tmp_source.zig:1:18: error: expected type 'noreturn', found 'void'");873 ,
874 ".tmp_source.zig:1:18: error: expected type 'noreturn', found 'void'",
875 );
695876
696 cases.add("control reaches end of non-void function",877 cases.add(
878 "control reaches end of non-void function",
697 \\fn a() i32 {}879 \\fn a() i32 {}
698 \\export fn entry() void { _ = a(); }880 \\export fn entry() void { _ = a(); }
699 , ".tmp_source.zig:1:12: error: expected type 'i32', found 'void'");881 ,
882 ".tmp_source.zig:1:12: error: expected type 'i32', found 'void'",
883 );
700884
701 cases.add("undefined function call",885 cases.add(
886 "undefined function call",
702 \\export fn a() void {887 \\export fn a() void {
703 \\ b();888 \\ b();
704 \\}889 \\}
705 , ".tmp_source.zig:2:5: error: use of undeclared identifier 'b'");890 ,
891 ".tmp_source.zig:2:5: error: use of undeclared identifier 'b'",
892 );
706893
707 cases.add("wrong number of arguments",894 cases.add(
895 "wrong number of arguments",
708 \\export fn a() void {896 \\export fn a() void {
709 \\ b(1);897 \\ b(1);
710 \\}898 \\}
711 \\fn b(a: i32, b: i32, c: i32) void { }899 \\fn b(a: i32, b: i32, c: i32) void { }
712 , ".tmp_source.zig:2:6: error: expected 3 arguments, found 1");900 ,
901 ".tmp_source.zig:2:6: error: expected 3 arguments, found 1",
902 );
713903
714 cases.add("invalid type",904 cases.add(
905 "invalid type",
715 \\fn a() bogus {}906 \\fn a() bogus {}
716 \\export fn entry() void { _ = a(); }907 \\export fn entry() void { _ = a(); }
717 , ".tmp_source.zig:1:8: error: use of undeclared identifier 'bogus'");908 ,
909 ".tmp_source.zig:1:8: error: use of undeclared identifier 'bogus'",
910 );
718911
719 cases.add("pointer to noreturn",912 cases.add(
913 "pointer to noreturn",
720 \\fn a() &noreturn {}914 \\fn a() &noreturn {}
721 \\export fn entry() void { _ = a(); }915 \\export fn entry() void { _ = a(); }
722 , ".tmp_source.zig:1:9: error: pointer to noreturn not allowed");916 ,
917 ".tmp_source.zig:1:9: error: pointer to noreturn not allowed",
918 );
723919
724 cases.add("unreachable code",920 cases.add(
921 "unreachable code",
725 \\export fn a() void {922 \\export fn a() void {
726 \\ return;923 \\ return;
727 \\ b();924 \\ b();
728 \\}925 \\}
729 \\926 \\
730 \\fn b() void {}927 \\fn b() void {}
731 , ".tmp_source.zig:3:5: error: unreachable code");928 ,
929 ".tmp_source.zig:3:5: error: unreachable code",
930 );
732931
733 cases.add("bad import",932 cases.add(
734 \\const bogus = @import("bogus-does-not-exist.zig");933 "bad import",
934 \\const bogus = @import("bogus-does-not-exist.zig",);
735 \\export fn entry() void { bogus.bogo(); }935 \\export fn entry() void { bogus.bogo(); }
736 , ".tmp_source.zig:1:15: error: unable to find 'bogus-does-not-exist.zig'");936 ,
937 ".tmp_source.zig:1:15: error: unable to find 'bogus-does-not-exist.zig'",
938 );
737939
738 cases.add("undeclared identifier",940 cases.add(
941 "undeclared identifier",
739 \\export fn a() void {942 \\export fn a() void {
740 \\ return943 \\ return
741 \\ b +944 \\ b +
742 \\ c;945 \\ c;
743 \\}946 \\}
744 ,947 ,
745 ".tmp_source.zig:3:5: error: use of undeclared identifier 'b'",948 ".tmp_source.zig:3:5: error: use of undeclared identifier 'b'",
746 ".tmp_source.zig:4:5: error: use of undeclared identifier 'c'");949 ".tmp_source.zig:4:5: error: use of undeclared identifier 'c'",
950 );
747951
748 cases.add("parameter redeclaration",952 cases.add(
953 "parameter redeclaration",
749 \\fn f(a : i32, a : i32) void {954 \\fn f(a : i32, a : i32) void {
750 \\}955 \\}
751 \\export fn entry() void { f(1, 2); }956 \\export fn entry() void { f(1, 2); }
752 , ".tmp_source.zig:1:15: error: redeclaration of variable 'a'");957 ,
958 ".tmp_source.zig:1:15: error: redeclaration of variable 'a'",
959 );
753960
754 cases.add("local variable redeclaration",961 cases.add(
962 "local variable redeclaration",
755 \\export fn f() void {963 \\export fn f() void {
756 \\ const a : i32 = 0;964 \\ const a : i32 = 0;
757 \\ const a = 0;965 \\ const a = 0;
758 \\}966 \\}
759 , ".tmp_source.zig:3:5: error: redeclaration of variable 'a'");967 ,
968 ".tmp_source.zig:3:5: error: redeclaration of variable 'a'",
969 );
760970
761 cases.add("local variable redeclares parameter",971 cases.add(
972 "local variable redeclares parameter",
762 \\fn f(a : i32) void {973 \\fn f(a : i32) void {
763 \\ const a = 0;974 \\ const a = 0;
764 \\}975 \\}
765 \\export fn entry() void { f(1); }976 \\export fn entry() void { f(1); }
766 , ".tmp_source.zig:2:5: error: redeclaration of variable 'a'");977 ,
978 ".tmp_source.zig:2:5: error: redeclaration of variable 'a'",
979 );
767980
768 cases.add("variable has wrong type",981 cases.add(
982 "variable has wrong type",
769 \\export fn f() i32 {983 \\export fn f() i32 {
770 \\ const a = c"a";984 \\ const a = c"a";
771 \\ return a;985 \\ return a;
772 \\}986 \\}
773 , ".tmp_source.zig:3:12: error: expected type 'i32', found '&const u8'");987 ,
988 ".tmp_source.zig:3:12: error: expected type 'i32', found '&const u8'",
989 );
774990
775 cases.add("if condition is bool, not int",991 cases.add(
992 "if condition is bool, not int",
776 \\export fn f() void {993 \\export fn f() void {
777 \\ if (0) {}994 \\ if (0) {}
778 \\}995 \\}
779 , ".tmp_source.zig:2:9: error: integer value 0 cannot be implicitly casted to type 'bool'");996 ,
997 ".tmp_source.zig:2:9: error: integer value 0 cannot be implicitly casted to type 'bool'",
998 );
780999
781 cases.add("assign unreachable",1000 cases.add(
1001 "assign unreachable",
782 \\export fn f() void {1002 \\export fn f() void {
783 \\ const a = return;1003 \\ const a = return;
784 \\}1004 \\}
785 , ".tmp_source.zig:2:5: error: unreachable code");1005 ,
1006 ".tmp_source.zig:2:5: error: unreachable code",
1007 );
7861008
787 cases.add("unreachable variable",1009 cases.add(
1010 "unreachable variable",
788 \\export fn f() void {1011 \\export fn f() void {
789 \\ const a: noreturn = {};1012 \\ const a: noreturn = {};
790 \\}1013 \\}
791 , ".tmp_source.zig:2:14: error: variable of type 'noreturn' not allowed");1014 ,
1015 ".tmp_source.zig:2:14: error: variable of type 'noreturn' not allowed",
1016 );
7921017
793 cases.add("unreachable parameter",1018 cases.add(
1019 "unreachable parameter",
794 \\fn f(a: noreturn) void {}1020 \\fn f(a: noreturn) void {}
795 \\export fn entry() void { f(); }1021 \\export fn entry() void { f(); }
796 , ".tmp_source.zig:1:9: error: parameter of type 'noreturn' not allowed");1022 ,
1023 ".tmp_source.zig:1:9: error: parameter of type 'noreturn' not allowed",
1024 );
7971025
798 cases.add("bad assignment target",1026 cases.add(
1027 "bad assignment target",
799 \\export fn f() void {1028 \\export fn f() void {
800 \\ 3 = 3;1029 \\ 3 = 3;
801 \\}1030 \\}
802 , ".tmp_source.zig:2:7: error: cannot assign to constant");1031 ,
1032 ".tmp_source.zig:2:7: error: cannot assign to constant",
1033 );
8031034
804 cases.add("assign to constant variable",1035 cases.add(
1036 "assign to constant variable",
805 \\export fn f() void {1037 \\export fn f() void {
806 \\ const a = 3;1038 \\ const a = 3;
807 \\ a = 4;1039 \\ a = 4;
808 \\}1040 \\}
809 , ".tmp_source.zig:3:7: error: cannot assign to constant");1041 ,
1042 ".tmp_source.zig:3:7: error: cannot assign to constant",
1043 );
8101044
811 cases.add("use of undeclared identifier",1045 cases.add(
1046 "use of undeclared identifier",
812 \\export fn f() void {1047 \\export fn f() void {
813 \\ b = 3;1048 \\ b = 3;
814 \\}1049 \\}
815 , ".tmp_source.zig:2:5: error: use of undeclared identifier 'b'");1050 ,
1051 ".tmp_source.zig:2:5: error: use of undeclared identifier 'b'",
1052 );
8161053
817 cases.add("const is a statement, not an expression",1054 cases.add(
1055 "const is a statement, not an expression",
818 \\export fn f() void {1056 \\export fn f() void {
819 \\ (const a = 0);1057 \\ (const a = 0);
820 \\}1058 \\}
821 , ".tmp_source.zig:2:6: error: invalid token: 'const'");1059 ,
1060 ".tmp_source.zig:2:6: error: invalid token: 'const'",
1061 );
8221062
823 cases.add("array access of undeclared identifier",1063 cases.add(
1064 "array access of undeclared identifier",
824 \\export fn f() void {1065 \\export fn f() void {
825 \\ i[i] = i[i];1066 \\ i[i] = i[i];
826 \\}1067 \\}
827 , ".tmp_source.zig:2:5: error: use of undeclared identifier 'i'",1068 ,
828 ".tmp_source.zig:2:12: error: use of undeclared identifier 'i'");1069 ".tmp_source.zig:2:5: error: use of undeclared identifier 'i'",
1070 ".tmp_source.zig:2:12: error: use of undeclared identifier 'i'",
1071 );
8291072
830 cases.add("array access of non array",1073 cases.add(
1074 "array access of non array",
831 \\export fn f() void {1075 \\export fn f() void {
832 \\ var bad : bool = undefined;1076 \\ var bad : bool = undefined;
833 \\ bad[bad] = bad[bad];1077 \\ bad[bad] = bad[bad];
834 \\}1078 \\}
835 , ".tmp_source.zig:3:8: error: array access of non-array type 'bool'",1079 ,
836 ".tmp_source.zig:3:19: error: array access of non-array type 'bool'");1080 ".tmp_source.zig:3:8: error: array access of non-array type 'bool'",
1081 ".tmp_source.zig:3:19: error: array access of non-array type 'bool'",
1082 );
8371083
838 cases.add("array access with non integer index",1084 cases.add(
1085 "array access with non integer index",
839 \\export fn f() void {1086 \\export fn f() void {
840 \\ var array = "aoeu";1087 \\ var array = "aoeu";
841 \\ var bad = false;1088 \\ var bad = false;
842 \\ array[bad] = array[bad];1089 \\ array[bad] = array[bad];
843 \\}1090 \\}
844 , ".tmp_source.zig:4:11: error: expected type 'usize', found 'bool'",1091 ,
845 ".tmp_source.zig:4:24: error: expected type 'usize', found 'bool'");1092 ".tmp_source.zig:4:11: error: expected type 'usize', found 'bool'",
1093 ".tmp_source.zig:4:24: error: expected type 'usize', found 'bool'",
1094 );
8461095
847 cases.add("write to const global variable",1096 cases.add(
1097 "write to const global variable",
848 \\const x : i32 = 99;1098 \\const x : i32 = 99;
849 \\fn f() void {1099 \\fn f() void {
850 \\ x = 1;1100 \\ x = 1;
851 \\}1101 \\}
852 \\export fn entry() void { f(); }1102 \\export fn entry() void { f(); }
853 , ".tmp_source.zig:3:7: error: cannot assign to constant");1103 ,
8541104 ".tmp_source.zig:3:7: error: cannot assign to constant",
1105 );
8551106
856 cases.add("missing else clause",1107 cases.add(
1108 "missing else clause",
857 \\fn f(b: bool) void {1109 \\fn f(b: bool) void {
858 \\ const x : i32 = if (b) h: { break :h 1; };1110 \\ const x : i32 = if (b) h: { break :h 1; };
859 \\ const y = if (b) h: { break :h i32(1); };1111 \\ const y = if (b) h: { break :h i32(1); };
860 \\}1112 \\}
861 \\export fn entry() void { f(true); }1113 \\export fn entry() void { f(true); }
862 , ".tmp_source.zig:2:42: error: integer value 1 cannot be implicitly casted to type 'void'",1114 ,
863 ".tmp_source.zig:3:15: error: incompatible types: 'i32' and 'void'");1115 ".tmp_source.zig:2:42: error: integer value 1 cannot be implicitly casted to type 'void'",
1116 ".tmp_source.zig:3:15: error: incompatible types: 'i32' and 'void'",
1117 );
8641118
865 cases.add("direct struct loop",1119 cases.add(
1120 "direct struct loop",
866 \\const A = struct { a : A, };1121 \\const A = struct { a : A, };
867 \\export fn entry() usize { return @sizeOf(A); }1122 \\export fn entry() usize { return @sizeOf(A); }
868 , ".tmp_source.zig:1:11: error: struct 'A' contains itself");1123 ,
1124 ".tmp_source.zig:1:11: error: struct 'A' contains itself",
1125 );
8691126
870 cases.add("indirect struct loop",1127 cases.add(
1128 "indirect struct loop",
871 \\const A = struct { b : B, };1129 \\const A = struct { b : B, };
872 \\const B = struct { c : C, };1130 \\const B = struct { c : C, };
873 \\const C = struct { a : A, };1131 \\const C = struct { a : A, };
874 \\export fn entry() usize { return @sizeOf(A); }1132 \\export fn entry() usize { return @sizeOf(A); }
875 , ".tmp_source.zig:1:11: error: struct 'A' contains itself");1133 ,
1134 ".tmp_source.zig:1:11: error: struct 'A' contains itself",
1135 );
8761136
877 cases.add("invalid struct field",1137 cases.add(
1138 "invalid struct field",
878 \\const A = struct { x : i32, };1139 \\const A = struct { x : i32, };
879 \\export fn f() void {1140 \\export fn f() void {
880 \\ var a : A = undefined;1141 \\ var a : A = undefined;
...@@ -882,27 +1143,37 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -882,27 +1143,37 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
882 \\ const y = a.bar;1143 \\ const y = a.bar;
883 \\}1144 \\}
884 ,1145 ,
885 ".tmp_source.zig:4:6: error: no member named 'foo' in struct 'A'",1146 ".tmp_source.zig:4:6: error: no member named 'foo' in struct 'A'",
886 ".tmp_source.zig:5:16: error: no member named 'bar' in struct 'A'");1147 ".tmp_source.zig:5:16: error: no member named 'bar' in struct 'A'",
1148 );
8871149
888 cases.add("redefinition of struct",1150 cases.add(
1151 "redefinition of struct",
889 \\const A = struct { x : i32, };1152 \\const A = struct { x : i32, };
890 \\const A = struct { y : i32, };1153 \\const A = struct { y : i32, };
891 , ".tmp_source.zig:2:1: error: redefinition of 'A'");1154 ,
1155 ".tmp_source.zig:2:1: error: redefinition of 'A'",
1156 );
8921157
893 cases.add("redefinition of enums",1158 cases.add(
1159 "redefinition of enums",
894 \\const A = enum {};1160 \\const A = enum {};
895 \\const A = enum {};1161 \\const A = enum {};
896 , ".tmp_source.zig:2:1: error: redefinition of 'A'");1162 ,
1163 ".tmp_source.zig:2:1: error: redefinition of 'A'",
1164 );
8971165
898 cases.add("redefinition of global variables",1166 cases.add(
1167 "redefinition of global variables",
899 \\var a : i32 = 1;1168 \\var a : i32 = 1;
900 \\var a : i32 = 2;1169 \\var a : i32 = 2;
901 ,1170 ,
902 ".tmp_source.zig:2:1: error: redefinition of 'a'",1171 ".tmp_source.zig:2:1: error: redefinition of 'a'",
903 ".tmp_source.zig:1:1: note: previous definition is here");1172 ".tmp_source.zig:1:1: note: previous definition is here",
1173 );
9041174
905 cases.add("duplicate field in struct value expression",1175 cases.add(
1176 "duplicate field in struct value expression",
906 \\const A = struct {1177 \\const A = struct {
907 \\ x : i32,1178 \\ x : i32,
908 \\ y : i32,1179 \\ y : i32,
...@@ -916,9 +1187,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -916,9 +1187,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
916 \\ .z = 4,1187 \\ .z = 4,
917 \\ };1188 \\ };
918 \\}1189 \\}
919 , ".tmp_source.zig:11:9: error: duplicate field");1190 ,
1191 ".tmp_source.zig:11:9: error: duplicate field",
1192 );
9201193
921 cases.add("missing field in struct value expression",1194 cases.add(
1195 "missing field in struct value expression",
922 \\const A = struct {1196 \\const A = struct {
923 \\ x : i32,1197 \\ x : i32,
924 \\ y : i32,1198 \\ y : i32,
...@@ -932,9 +1206,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -932,9 +1206,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
932 \\ .y = 2,1206 \\ .y = 2,
933 \\ };1207 \\ };
934 \\}1208 \\}
935 , ".tmp_source.zig:9:17: error: missing field: 'x'");1209 ,
1210 ".tmp_source.zig:9:17: error: missing field: 'x'",
1211 );
9361212
937 cases.add("invalid field in struct value expression",1213 cases.add(
1214 "invalid field in struct value expression",
938 \\const A = struct {1215 \\const A = struct {
939 \\ x : i32,1216 \\ x : i32,
940 \\ y : i32,1217 \\ y : i32,
...@@ -947,66 +1224,95 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -947,66 +1224,95 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
947 \\ .foo = 42,1224 \\ .foo = 42,
948 \\ };1225 \\ };
949 \\}1226 \\}
950 , ".tmp_source.zig:10:9: error: no member named 'foo' in struct 'A'");1227 ,
1228 ".tmp_source.zig:10:9: error: no member named 'foo' in struct 'A'",
1229 );
9511230
952 cases.add("invalid break expression",1231 cases.add(
1232 "invalid break expression",
953 \\export fn f() void {1233 \\export fn f() void {
954 \\ break;1234 \\ break;
955 \\}1235 \\}
956 , ".tmp_source.zig:2:5: error: break expression outside loop");1236 ,
1237 ".tmp_source.zig:2:5: error: break expression outside loop",
1238 );
9571239
958 cases.add("invalid continue expression",1240 cases.add(
1241 "invalid continue expression",
959 \\export fn f() void {1242 \\export fn f() void {
960 \\ continue;1243 \\ continue;
961 \\}1244 \\}
962 , ".tmp_source.zig:2:5: error: continue expression outside loop");1245 ,
1246 ".tmp_source.zig:2:5: error: continue expression outside loop",
1247 );
9631248
964 cases.add("invalid maybe type",1249 cases.add(
1250 "invalid maybe type",
965 \\export fn f() void {1251 \\export fn f() void {
966 \\ if (true) |x| { }1252 \\ if (true) |x| { }
967 \\}1253 \\}
968 , ".tmp_source.zig:2:9: error: expected nullable type, found 'bool'");1254 ,
1255 ".tmp_source.zig:2:9: error: expected nullable type, found 'bool'",
1256 );
9691257
970 cases.add("cast unreachable",1258 cases.add(
1259 "cast unreachable",
971 \\fn f() i32 {1260 \\fn f() i32 {
972 \\ return i32(return 1);1261 \\ return i32(return 1);
973 \\}1262 \\}
974 \\export fn entry() void { _ = f(); }1263 \\export fn entry() void { _ = f(); }
975 , ".tmp_source.zig:2:15: error: unreachable code");1264 ,
1265 ".tmp_source.zig:2:15: error: unreachable code",
1266 );
9761267
977 cases.add("invalid builtin fn",1268 cases.add(
1269 "invalid builtin fn",
978 \\fn f() @bogus(foo) {1270 \\fn f() @bogus(foo) {
979 \\}1271 \\}
980 \\export fn entry() void { _ = f(); }1272 \\export fn entry() void { _ = f(); }
981 , ".tmp_source.zig:1:8: error: invalid builtin function: 'bogus'");1273 ,
1274 ".tmp_source.zig:1:8: error: invalid builtin function: 'bogus'",
1275 );
9821276
983 cases.add("top level decl dependency loop",1277 cases.add(
1278 "top level decl dependency loop",
984 \\const a : @typeOf(b) = 0;1279 \\const a : @typeOf(b) = 0;
985 \\const b : @typeOf(a) = 0;1280 \\const b : @typeOf(a) = 0;
986 \\export fn entry() void {1281 \\export fn entry() void {
987 \\ const c = a + b;1282 \\ const c = a + b;
988 \\}1283 \\}
989 , ".tmp_source.zig:1:1: error: 'a' depends on itself");1284 ,
1285 ".tmp_source.zig:1:1: error: 'a' depends on itself",
1286 );
9901287
991 cases.add("noalias on non pointer param",1288 cases.add(
1289 "noalias on non pointer param",
992 \\fn f(noalias x: i32) void {}1290 \\fn f(noalias x: i32) void {}
993 \\export fn entry() void { f(1234); }1291 \\export fn entry() void { f(1234); }
994 , ".tmp_source.zig:1:6: error: noalias on non-pointer parameter");1292 ,
1293 ".tmp_source.zig:1:6: error: noalias on non-pointer parameter",
1294 );
9951295
996 cases.add("struct init syntax for array",1296 cases.add(
1297 "struct init syntax for array",
997 \\const foo = []u16{.x = 1024,};1298 \\const foo = []u16{.x = 1024,};
998 \\export fn entry() usize { return @sizeOf(@typeOf(foo)); }1299 \\export fn entry() usize { return @sizeOf(@typeOf(foo)); }
999 , ".tmp_source.zig:1:18: error: type '[]u16' does not support struct initialization syntax");1300 ,
1301 ".tmp_source.zig:1:18: error: type '[]u16' does not support struct initialization syntax",
1302 );
10001303
1001 cases.add("type variables must be constant",1304 cases.add(
1305 "type variables must be constant",
1002 \\var foo = u8;1306 \\var foo = u8;
1003 \\export fn entry() foo {1307 \\export fn entry() foo {
1004 \\ return 1;1308 \\ return 1;
1005 \\}1309 \\}
1006 , ".tmp_source.zig:1:1: error: variable of type 'type' must be constant");1310 ,
10071311 ".tmp_source.zig:1:1: error: variable of type 'type' must be constant",
1312 );
10081313
1009 cases.add("variables shadowing types",1314 cases.add(
1315 "variables shadowing types",
1010 \\const Foo = struct {};1316 \\const Foo = struct {};
1011 \\const Bar = struct {};1317 \\const Bar = struct {};
1012 \\1318 \\
...@@ -1018,12 +1324,14 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1018,12 +1324,14 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1018 \\ f(1234);1324 \\ f(1234);
1019 \\}1325 \\}
1020 ,1326 ,
1021 ".tmp_source.zig:4:6: error: redefinition of 'Foo'",1327 ".tmp_source.zig:4:6: error: redefinition of 'Foo'",
1022 ".tmp_source.zig:1:1: note: previous definition is here",1328 ".tmp_source.zig:1:1: note: previous definition is here",
1023 ".tmp_source.zig:5:5: error: redefinition of 'Bar'",1329 ".tmp_source.zig:5:5: error: redefinition of 'Bar'",
1024 ".tmp_source.zig:2:1: note: previous definition is here");1330 ".tmp_source.zig:2:1: note: previous definition is here",
1331 );
10251332
1026 cases.add("switch expression - missing enumeration prong",1333 cases.add(
1334 "switch expression - missing enumeration prong",
1027 \\const Number = enum {1335 \\const Number = enum {
1028 \\ One,1336 \\ One,
1029 \\ Two,1337 \\ Two,
...@@ -1039,9 +1347,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1039,9 +1347,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1039 \\}1347 \\}
1040 \\1348 \\
1041 \\export fn entry() usize { return @sizeOf(@typeOf(f)); }1349 \\export fn entry() usize { return @sizeOf(@typeOf(f)); }
1042 , ".tmp_source.zig:8:5: error: enumeration value 'Number.Four' not handled in switch");1350 ,
1351 ".tmp_source.zig:8:5: error: enumeration value 'Number.Four' not handled in switch",
1352 );
10431353
1044 cases.add("switch expression - duplicate enumeration prong",1354 cases.add(
1355 "switch expression - duplicate enumeration prong",
1045 \\const Number = enum {1356 \\const Number = enum {
1046 \\ One,1357 \\ One,
1047 \\ Two,1358 \\ Two,
...@@ -1059,10 +1370,13 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1059,10 +1370,13 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1059 \\}1370 \\}
1060 \\1371 \\
1061 \\export fn entry() usize { return @sizeOf(@typeOf(f)); }1372 \\export fn entry() usize { return @sizeOf(@typeOf(f)); }
1062 , ".tmp_source.zig:13:15: error: duplicate switch value",1373 ,
1063 ".tmp_source.zig:10:15: note: other value is here");1374 ".tmp_source.zig:13:15: error: duplicate switch value",
1375 ".tmp_source.zig:10:15: note: other value is here",
1376 );
10641377
1065 cases.add("switch expression - duplicate enumeration prong when else present",1378 cases.add(
1379 "switch expression - duplicate enumeration prong when else present",
1066 \\const Number = enum {1380 \\const Number = enum {
1067 \\ One,1381 \\ One,
1068 \\ Two,1382 \\ Two,
...@@ -1081,10 +1395,13 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1081,10 +1395,13 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1081 \\}1395 \\}
1082 \\1396 \\
1083 \\export fn entry() usize { return @sizeOf(@typeOf(f)); }1397 \\export fn entry() usize { return @sizeOf(@typeOf(f)); }
1084 , ".tmp_source.zig:13:15: error: duplicate switch value",1398 ,
1085 ".tmp_source.zig:10:15: note: other value is here");1399 ".tmp_source.zig:13:15: error: duplicate switch value",
1400 ".tmp_source.zig:10:15: note: other value is here",
1401 );
10861402
1087 cases.add("switch expression - multiple else prongs",1403 cases.add(
1404 "switch expression - multiple else prongs",
1088 \\fn f(x: u32) void {1405 \\fn f(x: u32) void {
1089 \\ const value: bool = switch (x) {1406 \\ const value: bool = switch (x) {
1090 \\ 1234 => false,1407 \\ 1234 => false,
...@@ -1095,9 +1412,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1095,9 +1412,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1095 \\export fn entry() void {1412 \\export fn entry() void {
1096 \\ f(1234);1413 \\ f(1234);
1097 \\}1414 \\}
1098 , ".tmp_source.zig:5:9: error: multiple else prongs in switch expression");1415 ,
1416 ".tmp_source.zig:5:9: error: multiple else prongs in switch expression",
1417 );
10991418
1100 cases.add("switch expression - non exhaustive integer prongs",1419 cases.add(
1420 "switch expression - non exhaustive integer prongs",
1101 \\fn foo(x: u8) void {1421 \\fn foo(x: u8) void {
1102 \\ switch (x) {1422 \\ switch (x) {
1103 \\ 0 => {},1423 \\ 0 => {},
...@@ -1105,9 +1425,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1105,9 +1425,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1105 \\}1425 \\}
1106 \\export fn entry() usize { return @sizeOf(@typeOf(foo)); }1426 \\export fn entry() usize { return @sizeOf(@typeOf(foo)); }
1107 ,1427 ,
1108 ".tmp_source.zig:2:5: error: switch must handle all possibilities");1428 ".tmp_source.zig:2:5: error: switch must handle all possibilities",
1429 );
11091430
1110 cases.add("switch expression - duplicate or overlapping integer value",1431 cases.add(
1432 "switch expression - duplicate or overlapping integer value",
1111 \\fn foo(x: u8) u8 {1433 \\fn foo(x: u8) u8 {
1112 \\ return switch (x) {1434 \\ return switch (x) {
1113 \\ 0 ... 100 => u8(0),1435 \\ 0 ... 100 => u8(0),
...@@ -1119,9 +1441,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1119,9 +1441,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1119 \\export fn entry() usize { return @sizeOf(@typeOf(foo)); }1441 \\export fn entry() usize { return @sizeOf(@typeOf(foo)); }
1120 ,1442 ,
1121 ".tmp_source.zig:6:9: error: duplicate switch value",1443 ".tmp_source.zig:6:9: error: duplicate switch value",
1122 ".tmp_source.zig:5:14: note: previous value is here");1444 ".tmp_source.zig:5:14: note: previous value is here",
1445 );
11231446
1124 cases.add("switch expression - switch on pointer type with no else",1447 cases.add(
1448 "switch expression - switch on pointer type with no else",
1125 \\fn foo(x: &u8) void {1449 \\fn foo(x: &u8) void {
1126 \\ switch (x) {1450 \\ switch (x) {
1127 \\ &y => {},1451 \\ &y => {},
...@@ -1130,54 +1454,77 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1130,54 +1454,77 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1130 \\const y: u8 = 100;1454 \\const y: u8 = 100;
1131 \\export fn entry() usize { return @sizeOf(@typeOf(foo)); }1455 \\export fn entry() usize { return @sizeOf(@typeOf(foo)); }
1132 ,1456 ,
1133 ".tmp_source.zig:2:5: error: else prong required when switching on type '&u8'");1457 ".tmp_source.zig:2:5: error: else prong required when switching on type '&u8'",
1458 );
11341459
1135 cases.add("global variable initializer must be constant expression",1460 cases.add(
1461 "global variable initializer must be constant expression",
1136 \\extern fn foo() i32;1462 \\extern fn foo() i32;
1137 \\const x = foo();1463 \\const x = foo();
1138 \\export fn entry() i32 { return x; }1464 \\export fn entry() i32 { return x; }
1139 , ".tmp_source.zig:2:11: error: unable to evaluate constant expression");1465 ,
1466 ".tmp_source.zig:2:11: error: unable to evaluate constant expression",
1467 );
11401468
1141 cases.add("array concatenation with wrong type",1469 cases.add(
1470 "array concatenation with wrong type",
1142 \\const src = "aoeu";1471 \\const src = "aoeu";
1143 \\const derp = usize(1234);1472 \\const derp = usize(1234);
1144 \\const a = derp ++ "foo";1473 \\const a = derp ++ "foo";
1145 \\1474 \\
1146 \\export fn entry() usize { return @sizeOf(@typeOf(a)); }1475 \\export fn entry() usize { return @sizeOf(@typeOf(a)); }
1147 , ".tmp_source.zig:3:11: error: expected array or C string literal, found 'usize'");1476 ,
1477 ".tmp_source.zig:3:11: error: expected array or C string literal, found 'usize'",
1478 );
11481479
1149 cases.add("non compile time array concatenation",1480 cases.add(
1481 "non compile time array concatenation",
1150 \\fn f() []u8 {1482 \\fn f() []u8 {
1151 \\ return s ++ "foo";1483 \\ return s ++ "foo";
1152 \\}1484 \\}
1153 \\var s: [10]u8 = undefined;1485 \\var s: [10]u8 = undefined;
1154 \\export fn entry() usize { return @sizeOf(@typeOf(f)); }1486 \\export fn entry() usize { return @sizeOf(@typeOf(f)); }
1155 , ".tmp_source.zig:2:12: error: unable to evaluate constant expression");1487 ,
1488 ".tmp_source.zig:2:12: error: unable to evaluate constant expression",
1489 );
11561490
1157 cases.add("@cImport with bogus include",1491 cases.add(
1492 "@cImport with bogus include",
1158 \\const c = @cImport(@cInclude("bogus.h"));1493 \\const c = @cImport(@cInclude("bogus.h"));
1159 \\export fn entry() usize { return @sizeOf(@typeOf(c.bogo)); }1494 \\export fn entry() usize { return @sizeOf(@typeOf(c.bogo)); }
1160 , ".tmp_source.zig:1:11: error: C import failed",1495 ,
1161 ".h:1:10: note: 'bogus.h' file not found");1496 ".tmp_source.zig:1:11: error: C import failed",
1497 ".h:1:10: note: 'bogus.h' file not found",
1498 );
11621499
1163 cases.add("address of number literal",1500 cases.add(
1501 "address of number literal",
1164 \\const x = 3;1502 \\const x = 3;
1165 \\const y = &x;1503 \\const y = &x;
1166 \\fn foo() &const i32 { return y; }1504 \\fn foo() &const i32 { return y; }
1167 \\export fn entry() usize { return @sizeOf(@typeOf(foo)); }1505 \\export fn entry() usize { return @sizeOf(@typeOf(foo)); }
1168 , ".tmp_source.zig:3:30: error: expected type '&const i32', found '&const (integer literal)'");1506 ,
1507 ".tmp_source.zig:3:30: error: expected type '&const i32', found '&const (integer literal)'",
1508 );
11691509
1170 cases.add("integer overflow error",1510 cases.add(
1511 "integer overflow error",
1171 \\const x : u8 = 300;1512 \\const x : u8 = 300;
1172 \\export fn entry() usize { return @sizeOf(@typeOf(x)); }1513 \\export fn entry() usize { return @sizeOf(@typeOf(x)); }
1173 , ".tmp_source.zig:1:16: error: integer value 300 cannot be implicitly casted to type 'u8'");1514 ,
1515 ".tmp_source.zig:1:16: error: integer value 300 cannot be implicitly casted to type 'u8'",
1516 );
11741517
1175 cases.add("incompatible number literals",1518 cases.add(
1519 "incompatible number literals",
1176 \\const x = 2 == 2.0;1520 \\const x = 2 == 2.0;
1177 \\export fn entry() usize { return @sizeOf(@typeOf(x)); }1521 \\export fn entry() usize { return @sizeOf(@typeOf(x)); }
1178 , ".tmp_source.zig:1:11: error: integer value 2 cannot be implicitly casted to type '(float literal)'");1522 ,
1523 ".tmp_source.zig:1:11: error: integer value 2 cannot be implicitly casted to type '(float literal)'",
1524 );
11791525
1180 cases.add("missing function call param",1526 cases.add(
1527 "missing function call param",
1181 \\const Foo = struct {1528 \\const Foo = struct {
1182 \\ a: i32,1529 \\ a: i32,
1183 \\ b: i32,1530 \\ b: i32,
...@@ -1201,58 +1548,73 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1201,58 +1548,73 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1201 \\}1548 \\}
1202 \\1549 \\
1203 \\export fn entry() usize { return @sizeOf(@typeOf(f)); }1550 \\export fn entry() usize { return @sizeOf(@typeOf(f)); }
1204 , ".tmp_source.zig:20:34: error: expected 1 arguments, found 0");1551 ,
1552 ".tmp_source.zig:20:34: error: expected 1 arguments, found 0",
1553 );
12051554
1206 cases.add("missing function name and param name",1555 cases.add(
1556 "missing function name and param name",
1207 \\fn () void {}1557 \\fn () void {}
1208 \\fn f(i32) void {}1558 \\fn f(i32) void {}
1209 \\export fn entry() usize { return @sizeOf(@typeOf(f)); }1559 \\export fn entry() usize { return @sizeOf(@typeOf(f)); }
1210 ,1560 ,
1211 ".tmp_source.zig:1:1: error: missing function name",1561 ".tmp_source.zig:1:1: error: missing function name",
1212 ".tmp_source.zig:2:6: error: missing parameter name");1562 ".tmp_source.zig:2:6: error: missing parameter name",
1563 );
12131564
1214 cases.add("wrong function type",1565 cases.add(
1566 "wrong function type",
1215 \\const fns = []fn() void { a, b, c };1567 \\const fns = []fn() void { a, b, c };
1216 \\fn a() i32 {return 0;}1568 \\fn a() i32 {return 0;}
1217 \\fn b() i32 {return 1;}1569 \\fn b() i32 {return 1;}
1218 \\fn c() i32 {return 2;}1570 \\fn c() i32 {return 2;}
1219 \\export fn entry() usize { return @sizeOf(@typeOf(fns)); }1571 \\export fn entry() usize { return @sizeOf(@typeOf(fns)); }
1220 , ".tmp_source.zig:1:27: error: expected type 'fn() void', found 'fn() i32'");1572 ,
1573 ".tmp_source.zig:1:27: error: expected type 'fn() void', found 'fn() i32'",
1574 );
12211575
1222 cases.add("extern function pointer mismatch",1576 cases.add(
1577 "extern function pointer mismatch",
1223 \\const fns = [](fn(i32)i32) { a, b, c };1578 \\const fns = [](fn(i32)i32) { a, b, c };
1224 \\pub fn a(x: i32) i32 {return x + 0;}1579 \\pub fn a(x: i32) i32 {return x + 0;}
1225 \\pub fn b(x: i32) i32 {return x + 1;}1580 \\pub fn b(x: i32) i32 {return x + 1;}
1226 \\export fn c(x: i32) i32 {return x + 2;}1581 \\export fn c(x: i32) i32 {return x + 2;}
1227 \\1582 \\
1228 \\export fn entry() usize { return @sizeOf(@typeOf(fns)); }1583 \\export fn entry() usize { return @sizeOf(@typeOf(fns)); }
1229 , ".tmp_source.zig:1:36: error: expected type 'fn(i32) i32', found 'extern fn(i32) i32'");1584 ,
12301585 ".tmp_source.zig:1:36: error: expected type 'fn(i32) i32', found 'extern fn(i32) i32'",
1586 );
12311587
1232 cases.add("implicit cast from f64 to f32",1588 cases.add(
1589 "implicit cast from f64 to f32",
1233 \\const x : f64 = 1.0;1590 \\const x : f64 = 1.0;
1234 \\const y : f32 = x;1591 \\const y : f32 = x;
1235 \\1592 \\
1236 \\export fn entry() usize { return @sizeOf(@typeOf(y)); }1593 \\export fn entry() usize { return @sizeOf(@typeOf(y)); }
1237 , ".tmp_source.zig:2:17: error: expected type 'f32', found 'f64'");1594 ,
12381595 ".tmp_source.zig:2:17: error: expected type 'f32', found 'f64'",
1596 );
12391597
1240 cases.add("colliding invalid top level functions",1598 cases.add(
1599 "colliding invalid top level functions",
1241 \\fn func() bogus {}1600 \\fn func() bogus {}
1242 \\fn func() bogus {}1601 \\fn func() bogus {}
1243 \\export fn entry() usize { return @sizeOf(@typeOf(func)); }1602 \\export fn entry() usize { return @sizeOf(@typeOf(func)); }
1244 ,1603 ,
1245 ".tmp_source.zig:2:1: error: redefinition of 'func'",1604 ".tmp_source.zig:2:1: error: redefinition of 'func'",
1246 ".tmp_source.zig:1:11: error: use of undeclared identifier 'bogus'");1605 ".tmp_source.zig:1:11: error: use of undeclared identifier 'bogus'",
1606 );
12471607
12481608 cases.add(
1249 cases.add("bogus compile var",1609 "bogus compile var",
1250 \\const x = @import("builtin").bogus;1610 \\const x = @import("builtin").bogus;
1251 \\export fn entry() usize { return @sizeOf(@typeOf(x)); }1611 \\export fn entry() usize { return @sizeOf(@typeOf(x)); }
1252 , ".tmp_source.zig:1:29: error: no member named 'bogus' in '");1612 ,
12531613 ".tmp_source.zig:1:29: error: no member named 'bogus' in '",
1614 );
12541615
1255 cases.add("non constant expression in array size outside function",1616 cases.add(
1617 "non constant expression in array size outside function",
1256 \\const Foo = struct {1618 \\const Foo = struct {
1257 \\ y: [get()]u8,1619 \\ y: [get()]u8,
1258 \\};1620 \\};
...@@ -1261,22 +1623,25 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1261,22 +1623,25 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1261 \\1623 \\
1262 \\export fn entry() usize { return @sizeOf(@typeOf(Foo)); }1624 \\export fn entry() usize { return @sizeOf(@typeOf(Foo)); }
1263 ,1625 ,
1264 ".tmp_source.zig:5:25: error: unable to evaluate constant expression",1626 ".tmp_source.zig:5:25: error: unable to evaluate constant expression",
1265 ".tmp_source.zig:2:12: note: called from here",1627 ".tmp_source.zig:2:12: note: called from here",
1266 ".tmp_source.zig:2:8: note: called from here");1628 ".tmp_source.zig:2:8: note: called from here",
12671629 );
12681630
1269 cases.add("addition with non numbers",1631 cases.add(
1632 "addition with non numbers",
1270 \\const Foo = struct {1633 \\const Foo = struct {
1271 \\ field: i32,1634 \\ field: i32,
1272 \\};1635 \\};
1273 \\const x = Foo {.field = 1} + Foo {.field = 2};1636 \\const x = Foo {.field = 1} + Foo {.field = 2};
1274 \\1637 \\
1275 \\export fn entry() usize { return @sizeOf(@typeOf(x)); }1638 \\export fn entry() usize { return @sizeOf(@typeOf(x)); }
1276 , ".tmp_source.zig:4:28: error: invalid operands to binary expression: 'Foo' and 'Foo'");1639 ,
12771640 ".tmp_source.zig:4:28: error: invalid operands to binary expression: 'Foo' and 'Foo'",
1641 );
12781642
1279 cases.add("division by zero",1643 cases.add(
1644 "division by zero",
1280 \\const lit_int_x = 1 / 0;1645 \\const lit_int_x = 1 / 0;
1281 \\const lit_float_x = 1.0 / 0.0;1646 \\const lit_float_x = 1.0 / 0.0;
1282 \\const int_x = u32(1) / u32(0);1647 \\const int_x = u32(1) / u32(0);
...@@ -1287,49 +1652,65 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1287,49 +1652,65 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1287 \\export fn entry3() usize { return @sizeOf(@typeOf(int_x)); }1652 \\export fn entry3() usize { return @sizeOf(@typeOf(int_x)); }
1288 \\export fn entry4() usize { return @sizeOf(@typeOf(float_x)); }1653 \\export fn entry4() usize { return @sizeOf(@typeOf(float_x)); }
1289 ,1654 ,
1290 ".tmp_source.zig:1:21: error: division by zero",1655 ".tmp_source.zig:1:21: error: division by zero",
1291 ".tmp_source.zig:2:25: error: division by zero",1656 ".tmp_source.zig:2:25: error: division by zero",
1292 ".tmp_source.zig:3:22: error: division by zero",1657 ".tmp_source.zig:3:22: error: division by zero",
1293 ".tmp_source.zig:4:26: error: division by zero");1658 ".tmp_source.zig:4:26: error: division by zero",
12941659 );
12951660
1296 cases.add("normal string with newline",1661 cases.add(
1662 "normal string with newline",
1297 \\const foo = "a1663 \\const foo = "a
1298 \\b";1664 \\b";
1299 \\1665 \\
1300 \\export fn entry() usize { return @sizeOf(@typeOf(foo)); }1666 \\export fn entry() usize { return @sizeOf(@typeOf(foo)); }
1301 , ".tmp_source.zig:1:13: error: newline not allowed in string literal");1667 ,
1668 ".tmp_source.zig:1:13: error: newline not allowed in string literal",
1669 );
13021670
1303 cases.add("invalid comparison for function pointers",1671 cases.add(
1672 "invalid comparison for function pointers",
1304 \\fn foo() void {}1673 \\fn foo() void {}
1305 \\const invalid = foo > foo;1674 \\const invalid = foo > foo;
1306 \\1675 \\
1307 \\export fn entry() usize { return @sizeOf(@typeOf(invalid)); }1676 \\export fn entry() usize { return @sizeOf(@typeOf(invalid)); }
1308 , ".tmp_source.zig:2:21: error: operator not allowed for type 'fn() void'");1677 ,
1678 ".tmp_source.zig:2:21: error: operator not allowed for type 'fn() void'",
1679 );
13091680
1310 cases.add("generic function instance with non-constant expression",1681 cases.add(
1682 "generic function instance with non-constant expression",
1311 \\fn foo(comptime x: i32, y: i32) i32 { return x + y; }1683 \\fn foo(comptime x: i32, y: i32) i32 { return x + y; }
1312 \\fn test1(a: i32, b: i32) i32 {1684 \\fn test1(a: i32, b: i32) i32 {
1313 \\ return foo(a, b);1685 \\ return foo(a, b);
1314 \\}1686 \\}
1315 \\1687 \\
1316 \\export fn entry() usize { return @sizeOf(@typeOf(test1)); }1688 \\export fn entry() usize { return @sizeOf(@typeOf(test1)); }
1317 , ".tmp_source.zig:3:16: error: unable to evaluate constant expression");1689 ,
1690 ".tmp_source.zig:3:16: error: unable to evaluate constant expression",
1691 );
13181692
1319 cases.add("assign null to non-nullable pointer",1693 cases.add(
1694 "assign null to non-nullable pointer",
1320 \\const a: &u8 = null;1695 \\const a: &u8 = null;
1321 \\1696 \\
1322 \\export fn entry() usize { return @sizeOf(@typeOf(a)); }1697 \\export fn entry() usize { return @sizeOf(@typeOf(a)); }
1323 , ".tmp_source.zig:1:16: error: expected type '&u8', found '(null)'");1698 ,
1699 ".tmp_source.zig:1:16: error: expected type '&u8', found '(null)'",
1700 );
13241701
1325 cases.add("indexing an array of size zero",1702 cases.add(
1703 "indexing an array of size zero",
1326 \\const array = []u8{};1704 \\const array = []u8{};
1327 \\export fn foo() void {1705 \\export fn foo() void {
1328 \\ const pointer = &array[0];1706 \\ const pointer = &array[0];
1329 \\}1707 \\}
1330 , ".tmp_source.zig:3:27: error: index 0 outside array of size 0");1708 ,
1709 ".tmp_source.zig:3:27: error: index 0 outside array of size 0",
1710 );
13311711
1332 cases.add("compile time division by zero",1712 cases.add(
1713 "compile time division by zero",
1333 \\const y = foo(0);1714 \\const y = foo(0);
1334 \\fn foo(x: u32) u32 {1715 \\fn foo(x: u32) u32 {
1335 \\ return 1 / x;1716 \\ return 1 / x;
...@@ -1337,17 +1718,21 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1337,17 +1718,21 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1337 \\1718 \\
1338 \\export fn entry() usize { return @sizeOf(@typeOf(y)); }1719 \\export fn entry() usize { return @sizeOf(@typeOf(y)); }
1339 ,1720 ,
1340 ".tmp_source.zig:3:14: error: division by zero",1721 ".tmp_source.zig:3:14: error: division by zero",
1341 ".tmp_source.zig:1:14: note: called from here");1722 ".tmp_source.zig:1:14: note: called from here",
1723 );
13421724
1343 cases.add("branch on undefined value",1725 cases.add(
1726 "branch on undefined value",
1344 \\const x = if (undefined) true else false;1727 \\const x = if (undefined) true else false;
1345 \\1728 \\
1346 \\export fn entry() usize { return @sizeOf(@typeOf(x)); }1729 \\export fn entry() usize { return @sizeOf(@typeOf(x)); }
1347 , ".tmp_source.zig:1:15: error: use of undefined value");1730 ,
13481731 ".tmp_source.zig:1:15: error: use of undefined value",
1732 );
13491733
1350 cases.add("endless loop in function evaluation",1734 cases.add(
1735 "endless loop in function evaluation",
1351 \\const seventh_fib_number = fibbonaci(7);1736 \\const seventh_fib_number = fibbonaci(7);
1352 \\fn fibbonaci(x: i32) i32 {1737 \\fn fibbonaci(x: i32) i32 {
1353 \\ return fibbonaci(x - 1) + fibbonaci(x - 2);1738 \\ return fibbonaci(x - 1) + fibbonaci(x - 2);
...@@ -1355,16 +1740,22 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1355,16 +1740,22 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1355 \\1740 \\
1356 \\export fn entry() usize { return @sizeOf(@typeOf(seventh_fib_number)); }1741 \\export fn entry() usize { return @sizeOf(@typeOf(seventh_fib_number)); }
1357 ,1742 ,
1358 ".tmp_source.zig:3:21: error: evaluation exceeded 1000 backwards branches",1743 ".tmp_source.zig:3:21: error: evaluation exceeded 1000 backwards branches",
1359 ".tmp_source.zig:3:21: note: called from here");1744 ".tmp_source.zig:3:21: note: called from here",
1745 );
13601746
1361 cases.add("@embedFile with bogus file",1747 cases.add(
1362 \\const resource = @embedFile("bogus.txt");1748 "@embedFile with bogus file",
1749 \\const resource = @embedFile("bogus.txt",);
1363 \\1750 \\
1364 \\export fn entry() usize { return @sizeOf(@typeOf(resource)); }1751 \\export fn entry() usize { return @sizeOf(@typeOf(resource)); }
1365 , ".tmp_source.zig:1:29: error: unable to find '", "bogus.txt'");1752 ,
1753 ".tmp_source.zig:1:29: error: unable to find '",
1754 "bogus.txt'",
1755 );
13661756
1367 cases.add("non-const expression in struct literal outside function",1757 cases.add(
1758 "non-const expression in struct literal outside function",
1368 \\const Foo = struct {1759 \\const Foo = struct {
1369 \\ x: i32,1760 \\ x: i32,
1370 \\};1761 \\};
...@@ -1372,9 +1763,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1372,9 +1763,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1372 \\extern fn get_it() i32;1763 \\extern fn get_it() i32;
1373 \\1764 \\
1374 \\export fn entry() usize { return @sizeOf(@typeOf(a)); }1765 \\export fn entry() usize { return @sizeOf(@typeOf(a)); }
1375 , ".tmp_source.zig:4:21: error: unable to evaluate constant expression");1766 ,
1767 ".tmp_source.zig:4:21: error: unable to evaluate constant expression",
1768 );
13761769
1377 cases.add("non-const expression function call with struct return value outside function",1770 cases.add(
1771 "non-const expression function call with struct return value outside function",
1378 \\const Foo = struct {1772 \\const Foo = struct {
1379 \\ x: i32,1773 \\ x: i32,
1380 \\};1774 \\};
...@@ -1387,19 +1781,24 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1387,19 +1781,24 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1387 \\1781 \\
1388 \\export fn entry() usize { return @sizeOf(@typeOf(a)); }1782 \\export fn entry() usize { return @sizeOf(@typeOf(a)); }
1389 ,1783 ,
1390 ".tmp_source.zig:6:24: error: unable to evaluate constant expression",1784 ".tmp_source.zig:6:24: error: unable to evaluate constant expression",
1391 ".tmp_source.zig:4:17: note: called from here");1785 ".tmp_source.zig:4:17: note: called from here",
1786 );
13921787
1393 cases.add("undeclared identifier error should mark fn as impure",1788 cases.add(
1789 "undeclared identifier error should mark fn as impure",
1394 \\export fn foo() void {1790 \\export fn foo() void {
1395 \\ test_a_thing();1791 \\ test_a_thing();
1396 \\}1792 \\}
1397 \\fn test_a_thing() void {1793 \\fn test_a_thing() void {
1398 \\ bad_fn_call();1794 \\ bad_fn_call();
1399 \\}1795 \\}
1400 , ".tmp_source.zig:5:5: error: use of undeclared identifier 'bad_fn_call'");1796 ,
1797 ".tmp_source.zig:5:5: error: use of undeclared identifier 'bad_fn_call'",
1798 );
14011799
1402 cases.add("illegal comparison of types",1800 cases.add(
1801 "illegal comparison of types",
1403 \\fn bad_eql_1(a: []u8, b: []u8) bool {1802 \\fn bad_eql_1(a: []u8, b: []u8) bool {
1404 \\ return a == b;1803 \\ return a == b;
1405 \\}1804 \\}
...@@ -1414,10 +1813,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1414,10 +1813,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1414 \\export fn entry1() usize { return @sizeOf(@typeOf(bad_eql_1)); }1813 \\export fn entry1() usize { return @sizeOf(@typeOf(bad_eql_1)); }
1415 \\export fn entry2() usize { return @sizeOf(@typeOf(bad_eql_2)); }1814 \\export fn entry2() usize { return @sizeOf(@typeOf(bad_eql_2)); }
1416 ,1815 ,
1417 ".tmp_source.zig:2:14: error: operator not allowed for type '[]u8'",1816 ".tmp_source.zig:2:14: error: operator not allowed for type '[]u8'",
1418 ".tmp_source.zig:9:16: error: operator not allowed for type 'EnumWithData'");1817 ".tmp_source.zig:9:16: error: operator not allowed for type 'EnumWithData'",
1818 );
14191819
1420 cases.add("non-const switch number literal",1820 cases.add(
1821 "non-const switch number literal",
1421 \\export fn foo() void {1822 \\export fn foo() void {
1422 \\ const x = switch (bar()) {1823 \\ const x = switch (bar()) {
1423 \\ 1, 2 => 1,1824 \\ 1, 2 => 1,
...@@ -1428,25 +1829,34 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1428,25 +1829,34 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1428 \\fn bar() i32 {1829 \\fn bar() i32 {
1429 \\ return 2;1830 \\ return 2;
1430 \\}1831 \\}
1431 , ".tmp_source.zig:2:15: error: unable to infer expression type");1832 ,
1833 ".tmp_source.zig:2:15: error: unable to infer expression type",
1834 );
14321835
1433 cases.add("atomic orderings of cmpxchg - failure stricter than success",1836 cases.add(
1837 "atomic orderings of cmpxchg - failure stricter than success",
1434 \\const AtomicOrder = @import("builtin").AtomicOrder;1838 \\const AtomicOrder = @import("builtin").AtomicOrder;
1435 \\export fn f() void {1839 \\export fn f() void {
1436 \\ var x: i32 = 1234;1840 \\ var x: i32 = 1234;
1437 \\ while (!@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.Monotonic, AtomicOrder.SeqCst)) {}1841 \\ while (!@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.Monotonic, AtomicOrder.SeqCst)) {}
1438 \\}1842 \\}
1439 , ".tmp_source.zig:4:81: error: failure atomic ordering must be no stricter than success");1843 ,
1844 ".tmp_source.zig:4:81: error: failure atomic ordering must be no stricter than success",
1845 );
14401846
1441 cases.add("atomic orderings of cmpxchg - success Monotonic or stricter",1847 cases.add(
1848 "atomic orderings of cmpxchg - success Monotonic or stricter",
1442 \\const AtomicOrder = @import("builtin").AtomicOrder;1849 \\const AtomicOrder = @import("builtin").AtomicOrder;
1443 \\export fn f() void {1850 \\export fn f() void {
1444 \\ var x: i32 = 1234;1851 \\ var x: i32 = 1234;
1445 \\ while (!@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.Unordered, AtomicOrder.Unordered)) {}1852 \\ while (!@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.Unordered, AtomicOrder.Unordered)) {}
1446 \\}1853 \\}
1447 , ".tmp_source.zig:4:58: error: success atomic ordering must be Monotonic or stricter");1854 ,
1855 ".tmp_source.zig:4:58: error: success atomic ordering must be Monotonic or stricter",
1856 );
14481857
1449 cases.add("negation overflow in function evaluation",1858 cases.add(
1859 "negation overflow in function evaluation",
1450 \\const y = neg(-128);1860 \\const y = neg(-128);
1451 \\fn neg(x: i8) i8 {1861 \\fn neg(x: i8) i8 {
1452 \\ return -x;1862 \\ return -x;
...@@ -1454,10 +1864,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1454,10 +1864,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1454 \\1864 \\
1455 \\export fn entry() usize { return @sizeOf(@typeOf(y)); }1865 \\export fn entry() usize { return @sizeOf(@typeOf(y)); }
1456 ,1866 ,
1457 ".tmp_source.zig:3:12: error: negation caused overflow",1867 ".tmp_source.zig:3:12: error: negation caused overflow",
1458 ".tmp_source.zig:1:14: note: called from here");1868 ".tmp_source.zig:1:14: note: called from here",
1869 );
14591870
1460 cases.add("add overflow in function evaluation",1871 cases.add(
1872 "add overflow in function evaluation",
1461 \\const y = add(65530, 10);1873 \\const y = add(65530, 10);
1462 \\fn add(a: u16, b: u16) u16 {1874 \\fn add(a: u16, b: u16) u16 {
1463 \\ return a + b;1875 \\ return a + b;
...@@ -1465,11 +1877,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1465,11 +1877,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1465 \\1877 \\
1466 \\export fn entry() usize { return @sizeOf(@typeOf(y)); }1878 \\export fn entry() usize { return @sizeOf(@typeOf(y)); }
1467 ,1879 ,
1468 ".tmp_source.zig:3:14: error: operation caused overflow",1880 ".tmp_source.zig:3:14: error: operation caused overflow",
1469 ".tmp_source.zig:1:14: note: called from here");1881 ".tmp_source.zig:1:14: note: called from here",
14701882 );
14711883
1472 cases.add("sub overflow in function evaluation",1884 cases.add(
1885 "sub overflow in function evaluation",
1473 \\const y = sub(10, 20);1886 \\const y = sub(10, 20);
1474 \\fn sub(a: u16, b: u16) u16 {1887 \\fn sub(a: u16, b: u16) u16 {
1475 \\ return a - b;1888 \\ return a - b;
...@@ -1477,10 +1890,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1477,10 +1890,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1477 \\1890 \\
1478 \\export fn entry() usize { return @sizeOf(@typeOf(y)); }1891 \\export fn entry() usize { return @sizeOf(@typeOf(y)); }
1479 ,1892 ,
1480 ".tmp_source.zig:3:14: error: operation caused overflow",1893 ".tmp_source.zig:3:14: error: operation caused overflow",
1481 ".tmp_source.zig:1:14: note: called from here");1894 ".tmp_source.zig:1:14: note: called from here",
1895 );
14821896
1483 cases.add("mul overflow in function evaluation",1897 cases.add(
1898 "mul overflow in function evaluation",
1484 \\const y = mul(300, 6000);1899 \\const y = mul(300, 6000);
1485 \\fn mul(a: u16, b: u16) u16 {1900 \\fn mul(a: u16, b: u16) u16 {
1486 \\ return a * b;1901 \\ return a * b;
...@@ -1488,27 +1903,34 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1488,27 +1903,34 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1488 \\1903 \\
1489 \\export fn entry() usize { return @sizeOf(@typeOf(y)); }1904 \\export fn entry() usize { return @sizeOf(@typeOf(y)); }
1490 ,1905 ,
1491 ".tmp_source.zig:3:14: error: operation caused overflow",1906 ".tmp_source.zig:3:14: error: operation caused overflow",
1492 ".tmp_source.zig:1:14: note: called from here");1907 ".tmp_source.zig:1:14: note: called from here",
1908 );
14931909
1494 cases.add("truncate sign mismatch",1910 cases.add(
1911 "truncate sign mismatch",
1495 \\fn f() i8 {1912 \\fn f() i8 {
1496 \\ const x: u32 = 10;1913 \\ const x: u32 = 10;
1497 \\ return @truncate(i8, x);1914 \\ return @truncate(i8, x);
1498 \\}1915 \\}
1499 \\1916 \\
1500 \\export fn entry() usize { return @sizeOf(@typeOf(f)); }1917 \\export fn entry() usize { return @sizeOf(@typeOf(f)); }
1501 , ".tmp_source.zig:3:26: error: expected signed integer type, found 'u32'");1918 ,
1919 ".tmp_source.zig:3:26: error: expected signed integer type, found 'u32'",
1920 );
15021921
1503 cases.add("try in function with non error return type",1922 cases.add(
1923 "try in function with non error return type",
1504 \\export fn f() void {1924 \\export fn f() void {
1505 \\ try something();1925 \\ try something();
1506 \\}1926 \\}
1507 \\fn something() error!void { }1927 \\fn something() error!void { }
1508 ,1928 ,
1509 ".tmp_source.zig:2:5: error: expected type 'void', found 'error'");1929 ".tmp_source.zig:2:5: error: expected type 'void', found 'error'",
1930 );
15101931
1511 cases.add("invalid pointer for var type",1932 cases.add(
1933 "invalid pointer for var type",
1512 \\extern fn ext() usize;1934 \\extern fn ext() usize;
1513 \\var bytes: [ext()]u8 = undefined;1935 \\var bytes: [ext()]u8 = undefined;
1514 \\export fn f() void {1936 \\export fn f() void {
...@@ -1516,30 +1938,42 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1516,30 +1938,42 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1516 \\ b.* = u8(i);1938 \\ b.* = u8(i);
1517 \\ }1939 \\ }
1518 \\}1940 \\}
1519 , ".tmp_source.zig:2:13: error: unable to evaluate constant expression");1941 ,
1942 ".tmp_source.zig:2:13: error: unable to evaluate constant expression",
1943 );
15201944
1521 cases.add("export function with comptime parameter",1945 cases.add(
1946 "export function with comptime parameter",
1522 \\export fn foo(comptime x: i32, y: i32) i32{1947 \\export fn foo(comptime x: i32, y: i32) i32{
1523 \\ return x + y;1948 \\ return x + y;
1524 \\}1949 \\}
1525 , ".tmp_source.zig:1:15: error: comptime parameter not allowed in function with calling convention 'ccc'");1950 ,
1951 ".tmp_source.zig:1:15: error: comptime parameter not allowed in function with calling convention 'ccc'",
1952 );
15261953
1527 cases.add("extern function with comptime parameter",1954 cases.add(
1955 "extern function with comptime parameter",
1528 \\extern fn foo(comptime x: i32, y: i32) i32;1956 \\extern fn foo(comptime x: i32, y: i32) i32;
1529 \\fn f() i32 {1957 \\fn f() i32 {
1530 \\ return foo(1, 2);1958 \\ return foo(1, 2);
1531 \\}1959 \\}
1532 \\export fn entry() usize { return @sizeOf(@typeOf(f)); }1960 \\export fn entry() usize { return @sizeOf(@typeOf(f)); }
1533 , ".tmp_source.zig:1:15: error: comptime parameter not allowed in function with calling convention 'ccc'");1961 ,
1962 ".tmp_source.zig:1:15: error: comptime parameter not allowed in function with calling convention 'ccc'",
1963 );
15341964
1535 cases.add("convert fixed size array to slice with invalid size",1965 cases.add(
1966 "convert fixed size array to slice with invalid size",
1536 \\export fn f() void {1967 \\export fn f() void {
1537 \\ var array: [5]u8 = undefined;1968 \\ var array: [5]u8 = undefined;
1538 \\ var foo = ([]const u32)(array)[0];1969 \\ var foo = ([]const u32)(array)[0];
1539 \\}1970 \\}
1540 , ".tmp_source.zig:3:28: error: unable to convert [5]u8 to []const u32: size mismatch");1971 ,
1972 ".tmp_source.zig:3:28: error: unable to convert [5]u8 to []const u32: size mismatch",
1973 );
15411974
1542 cases.add("non-pure function returns type",1975 cases.add(
1976 "non-pure function returns type",
1543 \\var a: u32 = 0;1977 \\var a: u32 = 0;
1544 \\pub fn List(comptime T: type) type {1978 \\pub fn List(comptime T: type) type {
1545 \\ a += 1;1979 \\ a += 1;
...@@ -1558,18 +1992,24 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1558,18 +1992,24 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1558 \\ var list: List(i32) = undefined;1992 \\ var list: List(i32) = undefined;
1559 \\ list.length = 10;1993 \\ list.length = 10;
1560 \\}1994 \\}
1561 , ".tmp_source.zig:3:7: error: unable to evaluate constant expression",1995 ,
1562 ".tmp_source.zig:16:19: note: called from here");1996 ".tmp_source.zig:3:7: error: unable to evaluate constant expression",
1997 ".tmp_source.zig:16:19: note: called from here",
1998 );
15631999
1564 cases.add("bogus method call on slice",2000 cases.add(
2001 "bogus method call on slice",
1565 \\var self = "aoeu";2002 \\var self = "aoeu";
1566 \\fn f(m: []const u8) void {2003 \\fn f(m: []const u8) void {
1567 \\ m.copy(u8, self[0..], m);2004 \\ m.copy(u8, self[0..], m);
1568 \\}2005 \\}
1569 \\export fn entry() usize { return @sizeOf(@typeOf(f)); }2006 \\export fn entry() usize { return @sizeOf(@typeOf(f)); }
1570 , ".tmp_source.zig:3:6: error: no member named 'copy' in '[]const u8'");2007 ,
2008 ".tmp_source.zig:3:6: error: no member named 'copy' in '[]const u8'",
2009 );
15712010
1572 cases.add("wrong number of arguments for method fn call",2011 cases.add(
2012 "wrong number of arguments for method fn call",
1573 \\const Foo = struct {2013 \\const Foo = struct {
1574 \\ fn method(self: &const Foo, a: i32) void {}2014 \\ fn method(self: &const Foo, a: i32) void {}
1575 \\};2015 \\};
...@@ -1578,34 +2018,49 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1578,34 +2018,49 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1578 \\ foo.method(1, 2);2018 \\ foo.method(1, 2);
1579 \\}2019 \\}
1580 \\export fn entry() usize { return @sizeOf(@typeOf(f)); }2020 \\export fn entry() usize { return @sizeOf(@typeOf(f)); }
1581 , ".tmp_source.zig:6:15: error: expected 2 arguments, found 3");2021 ,
2022 ".tmp_source.zig:6:15: error: expected 2 arguments, found 3",
2023 );
15822024
1583 cases.add("assign through constant pointer",2025 cases.add(
2026 "assign through constant pointer",
1584 \\export fn f() void {2027 \\export fn f() void {
1585 \\ var cstr = c"Hat";2028 \\ var cstr = c"Hat";
1586 \\ cstr[0] = 'W';2029 \\ cstr[0] = 'W';
1587 \\}2030 \\}
1588 , ".tmp_source.zig:3:11: error: cannot assign to constant");2031 ,
2032 ".tmp_source.zig:3:11: error: cannot assign to constant",
2033 );
15892034
1590 cases.add("assign through constant slice",2035 cases.add(
2036 "assign through constant slice",
1591 \\export fn f() void {2037 \\export fn f() void {
1592 \\ var cstr: []const u8 = "Hat";2038 \\ var cstr: []const u8 = "Hat";
1593 \\ cstr[0] = 'W';2039 \\ cstr[0] = 'W';
1594 \\}2040 \\}
1595 , ".tmp_source.zig:3:11: error: cannot assign to constant");2041 ,
2042 ".tmp_source.zig:3:11: error: cannot assign to constant",
2043 );
15962044
1597 cases.add("main function with bogus args type",2045 cases.add(
2046 "main function with bogus args type",
1598 \\pub fn main(args: [][]bogus) !void {}2047 \\pub fn main(args: [][]bogus) !void {}
1599 , ".tmp_source.zig:1:23: error: use of undeclared identifier 'bogus'");2048 ,
2049 ".tmp_source.zig:1:23: error: use of undeclared identifier 'bogus'",
2050 );
16002051
1601 cases.add("for loop missing element param",2052 cases.add(
2053 "for loop missing element param",
1602 \\fn foo(blah: []u8) void {2054 \\fn foo(blah: []u8) void {
1603 \\ for (blah) { }2055 \\ for (blah) { }
1604 \\}2056 \\}
1605 \\export fn entry() usize { return @sizeOf(@typeOf(foo)); }2057 \\export fn entry() usize { return @sizeOf(@typeOf(foo)); }
1606 , ".tmp_source.zig:2:5: error: for loop expression missing element parameter");2058 ,
2059 ".tmp_source.zig:2:5: error: for loop expression missing element parameter",
2060 );
16072061
1608 cases.add("misspelled type with pointer only reference",2062 cases.add(
2063 "misspelled type with pointer only reference",
1609 \\const JasonHM = u8;2064 \\const JasonHM = u8;
1610 \\const JasonList = &JsonNode;2065 \\const JasonList = &JsonNode;
1611 \\2066 \\
...@@ -1636,9 +2091,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1636,9 +2091,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1636 \\}2091 \\}
1637 \\2092 \\
1638 \\export fn entry() usize { return @sizeOf(@typeOf(foo)); }2093 \\export fn entry() usize { return @sizeOf(@typeOf(foo)); }
1639 , ".tmp_source.zig:5:16: error: use of undeclared identifier 'JsonList'");2094 ,
2095 ".tmp_source.zig:5:16: error: use of undeclared identifier 'JsonList'",
2096 );
16402097
1641 cases.add("method call with first arg type primitive",2098 cases.add(
2099 "method call with first arg type primitive",
1642 \\const Foo = struct {2100 \\const Foo = struct {
1643 \\ x: i32,2101 \\ x: i32,
1644 \\2102 \\
...@@ -1654,9 +2112,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1654,9 +2112,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1654 \\2112 \\
1655 \\ derp.init();2113 \\ derp.init();
1656 \\}2114 \\}
1657 , ".tmp_source.zig:14:5: error: expected type 'i32', found '&const Foo'");2115 ,
2116 ".tmp_source.zig:14:5: error: expected type 'i32', found '&const Foo'",
2117 );
16582118
1659 cases.add("method call with first arg type wrong container",2119 cases.add(
2120 "method call with first arg type wrong container",
1660 \\pub const List = struct {2121 \\pub const List = struct {
1661 \\ len: usize,2122 \\ len: usize,
1662 \\ allocator: &Allocator,2123 \\ allocator: &Allocator,
...@@ -1681,26 +2142,33 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1681,26 +2142,33 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1681 \\ var x = List.init(&global_allocator);2142 \\ var x = List.init(&global_allocator);
1682 \\ x.init();2143 \\ x.init();
1683 \\}2144 \\}
1684 , ".tmp_source.zig:23:5: error: expected type '&Allocator', found '&List'");2145 ,
2146 ".tmp_source.zig:23:5: error: expected type '&Allocator', found '&List'",
2147 );
16852148
1686 cases.add("binary not on number literal",2149 cases.add(
2150 "binary not on number literal",
1687 \\const TINY_QUANTUM_SHIFT = 4;2151 \\const TINY_QUANTUM_SHIFT = 4;
1688 \\const TINY_QUANTUM_SIZE = 1 << TINY_QUANTUM_SHIFT;2152 \\const TINY_QUANTUM_SIZE = 1 << TINY_QUANTUM_SHIFT;
1689 \\var block_aligned_stuff: usize = (4 + TINY_QUANTUM_SIZE) & ~(TINY_QUANTUM_SIZE - 1);2153 \\var block_aligned_stuff: usize = (4 + TINY_QUANTUM_SIZE) & ~(TINY_QUANTUM_SIZE - 1);
1690 \\2154 \\
1691 \\export fn entry() usize { return @sizeOf(@typeOf(block_aligned_stuff)); }2155 \\export fn entry() usize { return @sizeOf(@typeOf(block_aligned_stuff)); }
1692 , ".tmp_source.zig:3:60: error: unable to perform binary not operation on type '(integer literal)'");2156 ,
2157 ".tmp_source.zig:3:60: error: unable to perform binary not operation on type '(integer literal)'",
2158 );
16932159
1694 cases.addCase(x: {2160 cases.addCase(x: {
1695 const tc = cases.create("multiple files with private function error",2161 const tc = cases.create(
1696 \\const foo = @import("foo.zig");2162 "multiple files with private function error",
2163 \\const foo = @import("foo.zig",);
1697 \\2164 \\
1698 \\export fn callPrivFunction() void {2165 \\export fn callPrivFunction() void {
1699 \\ foo.privateFunction();2166 \\ foo.privateFunction();
1700 \\}2167 \\}
1701 ,2168 ,
1702 ".tmp_source.zig:4:8: error: 'privateFunction' is private",2169 ".tmp_source.zig:4:8: error: 'privateFunction' is private",
1703 "foo.zig:1:1: note: declared here");2170 "foo.zig:1:1: note: declared here",
2171 );
17042172
1705 tc.addSourceFile("foo.zig",2173 tc.addSourceFile("foo.zig",
1706 \\fn privateFunction() void { }2174 \\fn privateFunction() void { }
...@@ -1709,14 +2177,18 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1709,14 +2177,18 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1709 break :x tc;2177 break :x tc;
1710 });2178 });
17112179
1712 cases.add("container init with non-type",2180 cases.add(
2181 "container init with non-type",
1713 \\const zero: i32 = 0;2182 \\const zero: i32 = 0;
1714 \\const a = zero{1};2183 \\const a = zero{1};
1715 \\2184 \\
1716 \\export fn entry() usize { return @sizeOf(@typeOf(a)); }2185 \\export fn entry() usize { return @sizeOf(@typeOf(a)); }
1717 , ".tmp_source.zig:2:11: error: expected type, found 'i32'");2186 ,
2187 ".tmp_source.zig:2:11: error: expected type, found 'i32'",
2188 );
17182189
1719 cases.add("assign to constant field",2190 cases.add(
2191 "assign to constant field",
1720 \\const Foo = struct {2192 \\const Foo = struct {
1721 \\ field: i32,2193 \\ field: i32,
1722 \\};2194 \\};
...@@ -1724,9 +2196,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1724,9 +2196,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1724 \\ const f = Foo {.field = 1234,};2196 \\ const f = Foo {.field = 1234,};
1725 \\ f.field = 0;2197 \\ f.field = 0;
1726 \\}2198 \\}
1727 , ".tmp_source.zig:6:13: error: cannot assign to constant");2199 ,
2200 ".tmp_source.zig:6:13: error: cannot assign to constant",
2201 );
17282202
1729 cases.add("return from defer expression",2203 cases.add(
2204 "return from defer expression",
1730 \\pub fn testTrickyDefer() !void {2205 \\pub fn testTrickyDefer() !void {
1731 \\ defer canFail() catch {};2206 \\ defer canFail() catch {};
1732 \\2207 \\
...@@ -1742,9 +2217,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1742,9 +2217,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1742 \\}2217 \\}
1743 \\2218 \\
1744 \\export fn entry() usize { return @sizeOf(@typeOf(testTrickyDefer)); }2219 \\export fn entry() usize { return @sizeOf(@typeOf(testTrickyDefer)); }
1745 , ".tmp_source.zig:4:11: error: cannot return from defer expression");2220 ,
2221 ".tmp_source.zig:4:11: error: cannot return from defer expression",
2222 );
17462223
1747 cases.add("attempt to access var args out of bounds",2224 cases.add(
2225 "attempt to access var args out of bounds",
1748 \\fn add(args: ...) i32 {2226 \\fn add(args: ...) i32 {
1749 \\ return args[0] + args[1];2227 \\ return args[0] + args[1];
1750 \\}2228 \\}
...@@ -1755,10 +2233,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1755,10 +2233,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1755 \\2233 \\
1756 \\export fn entry() usize { return @sizeOf(@typeOf(foo)); }2234 \\export fn entry() usize { return @sizeOf(@typeOf(foo)); }
1757 ,2235 ,
1758 ".tmp_source.zig:2:26: error: index 1 outside argument list of size 1",2236 ".tmp_source.zig:2:26: error: index 1 outside argument list of size 1",
1759 ".tmp_source.zig:6:15: note: called from here");2237 ".tmp_source.zig:6:15: note: called from here",
2238 );
17602239
1761 cases.add("pass integer literal to var args",2240 cases.add(
2241 "pass integer literal to var args",
1762 \\fn add(args: ...) i32 {2242 \\fn add(args: ...) i32 {
1763 \\ var sum = i32(0);2243 \\ var sum = i32(0);
1764 \\ {comptime var i: usize = 0; inline while (i < args.len) : (i += 1) {2244 \\ {comptime var i: usize = 0; inline while (i < args.len) : (i += 1) {
...@@ -1772,32 +2252,44 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1772,32 +2252,44 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1772 \\}2252 \\}
1773 \\2253 \\
1774 \\export fn entry() usize { return @sizeOf(@typeOf(bar)); }2254 \\export fn entry() usize { return @sizeOf(@typeOf(bar)); }
1775 , ".tmp_source.zig:10:16: error: compiler bug: integer and float literals in var args function must be casted");2255 ,
2256 ".tmp_source.zig:10:16: error: compiler bug: integer and float literals in var args function must be casted",
2257 );
17762258
1777 cases.add("assign too big number to u16",2259 cases.add(
2260 "assign too big number to u16",
1778 \\export fn foo() void {2261 \\export fn foo() void {
1779 \\ var vga_mem: u16 = 0xB8000;2262 \\ var vga_mem: u16 = 0xB8000;
1780 \\}2263 \\}
1781 , ".tmp_source.zig:2:24: error: integer value 753664 cannot be implicitly casted to type 'u16'");2264 ,
2265 ".tmp_source.zig:2:24: error: integer value 753664 cannot be implicitly casted to type 'u16'",
2266 );
17822267
1783 cases.add("global variable alignment non power of 2",2268 cases.add(
2269 "global variable alignment non power of 2",
1784 \\const some_data: [100]u8 align(3) = undefined;2270 \\const some_data: [100]u8 align(3) = undefined;
1785 \\export fn entry() usize { return @sizeOf(@typeOf(some_data)); }2271 \\export fn entry() usize { return @sizeOf(@typeOf(some_data)); }
1786 , ".tmp_source.zig:1:32: error: alignment value 3 is not a power of 2");2272 ,
2273 ".tmp_source.zig:1:32: error: alignment value 3 is not a power of 2",
2274 );
17872275
1788 cases.add("function alignment non power of 2",2276 cases.add(
2277 "function alignment non power of 2",
1789 \\extern fn foo() align(3) void;2278 \\extern fn foo() align(3) void;
1790 \\export fn entry() void { return foo(); }2279 \\export fn entry() void { return foo(); }
1791 , ".tmp_source.zig:1:23: error: alignment value 3 is not a power of 2");2280 ,
2281 ".tmp_source.zig:1:23: error: alignment value 3 is not a power of 2",
2282 );
17922283
1793 cases.add("compile log",2284 cases.add(
2285 "compile log",
1794 \\export fn foo() void {2286 \\export fn foo() void {
1795 \\ comptime bar(12, "hi");2287 \\ comptime bar(12, "hi",);
1796 \\}2288 \\}
1797 \\fn bar(a: i32, b: []const u8) void {2289 \\fn bar(a: i32, b: []const u8) void {
1798 \\ @compileLog("begin");2290 \\ @compileLog("begin",);
1799 \\ @compileLog("a", a, "b", b);2291 \\ @compileLog("a", a, "b", b);
1800 \\ @compileLog("end");2292 \\ @compileLog("end",);
1801 \\}2293 \\}
1802 ,2294 ,
1803 ".tmp_source.zig:5:5: error: found compile log statement",2295 ".tmp_source.zig:5:5: error: found compile log statement",
...@@ -1805,9 +2297,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1805,9 +2297,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1805 ".tmp_source.zig:6:5: error: found compile log statement",2297 ".tmp_source.zig:6:5: error: found compile log statement",
1806 ".tmp_source.zig:2:17: note: called from here",2298 ".tmp_source.zig:2:17: note: called from here",
1807 ".tmp_source.zig:7:5: error: found compile log statement",2299 ".tmp_source.zig:7:5: error: found compile log statement",
1808 ".tmp_source.zig:2:17: note: called from here");2300 ".tmp_source.zig:2:17: note: called from here",
2301 );
18092302
1810 cases.add("casting bit offset pointer to regular pointer",2303 cases.add(
2304 "casting bit offset pointer to regular pointer",
1811 \\const BitField = packed struct {2305 \\const BitField = packed struct {
1812 \\ a: u3,2306 \\ a: u3,
1813 \\ b: u3,2307 \\ b: u3,
...@@ -1823,9 +2317,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1823,9 +2317,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1823 \\}2317 \\}
1824 \\2318 \\
1825 \\export fn entry() usize { return @sizeOf(@typeOf(foo)); }2319 \\export fn entry() usize { return @sizeOf(@typeOf(foo)); }
1826 , ".tmp_source.zig:8:26: error: expected type '&const u3', found '&align(1:3:6) const u3'");2320 ,
2321 ".tmp_source.zig:8:26: error: expected type '&const u3', found '&align(1:3:6) const u3'",
2322 );
18272323
1828 cases.add("referring to a struct that is invalid",2324 cases.add(
2325 "referring to a struct that is invalid",
1829 \\const UsbDeviceRequest = struct {2326 \\const UsbDeviceRequest = struct {
1830 \\ Type: u8,2327 \\ Type: u8,
1831 \\};2328 \\};
...@@ -1838,10 +2335,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1838,10 +2335,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1838 \\ if (!ok) unreachable;2335 \\ if (!ok) unreachable;
1839 \\}2336 \\}
1840 ,2337 ,
1841 ".tmp_source.zig:10:14: error: unable to evaluate constant expression",2338 ".tmp_source.zig:10:14: error: unable to evaluate constant expression",
1842 ".tmp_source.zig:6:20: note: called from here");2339 ".tmp_source.zig:6:20: note: called from here",
2340 );
18432341
1844 cases.add("control flow uses comptime var at runtime",2342 cases.add(
2343 "control flow uses comptime var at runtime",
1845 \\export fn foo() void {2344 \\export fn foo() void {
1846 \\ comptime var i = 0;2345 \\ comptime var i = 0;
1847 \\ while (i < 5) : (i += 1) {2346 \\ while (i < 5) : (i += 1) {
...@@ -1851,55 +2350,78 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1851,55 +2350,78 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1851 \\2350 \\
1852 \\fn bar() void { }2351 \\fn bar() void { }
1853 ,2352 ,
1854 ".tmp_source.zig:3:5: error: control flow attempts to use compile-time variable at runtime",2353 ".tmp_source.zig:3:5: error: control flow attempts to use compile-time variable at runtime",
1855 ".tmp_source.zig:3:24: note: compile-time variable assigned here");2354 ".tmp_source.zig:3:24: note: compile-time variable assigned here",
2355 );
18562356
1857 cases.add("ignored return value",2357 cases.add(
2358 "ignored return value",
1858 \\export fn foo() void {2359 \\export fn foo() void {
1859 \\ bar();2360 \\ bar();
1860 \\}2361 \\}
1861 \\fn bar() i32 { return 0; }2362 \\fn bar() i32 { return 0; }
1862 , ".tmp_source.zig:2:8: error: expression value is ignored");2363 ,
2364 ".tmp_source.zig:2:8: error: expression value is ignored",
2365 );
18632366
1864 cases.add("ignored assert-err-ok return value",2367 cases.add(
2368 "ignored assert-err-ok return value",
1865 \\export fn foo() void {2369 \\export fn foo() void {
1866 \\ bar() catch unreachable;2370 \\ bar() catch unreachable;
1867 \\}2371 \\}
1868 \\fn bar() error!i32 { return 0; }2372 \\fn bar() error!i32 { return 0; }
1869 , ".tmp_source.zig:2:11: error: expression value is ignored");2373 ,
2374 ".tmp_source.zig:2:11: error: expression value is ignored",
2375 );
18702376
1871 cases.add("ignored statement value",2377 cases.add(
2378 "ignored statement value",
1872 \\export fn foo() void {2379 \\export fn foo() void {
1873 \\ 1;2380 \\ 1;
1874 \\}2381 \\}
1875 , ".tmp_source.zig:2:5: error: expression value is ignored");2382 ,
2383 ".tmp_source.zig:2:5: error: expression value is ignored",
2384 );
18762385
1877 cases.add("ignored comptime statement value",2386 cases.add(
2387 "ignored comptime statement value",
1878 \\export fn foo() void {2388 \\export fn foo() void {
1879 \\ comptime {1;}2389 \\ comptime {1;}
1880 \\}2390 \\}
1881 , ".tmp_source.zig:2:15: error: expression value is ignored");2391 ,
2392 ".tmp_source.zig:2:15: error: expression value is ignored",
2393 );
18822394
1883 cases.add("ignored comptime value",2395 cases.add(
2396 "ignored comptime value",
1884 \\export fn foo() void {2397 \\export fn foo() void {
1885 \\ comptime 1;2398 \\ comptime 1;
1886 \\}2399 \\}
1887 , ".tmp_source.zig:2:5: error: expression value is ignored");2400 ,
2401 ".tmp_source.zig:2:5: error: expression value is ignored",
2402 );
18882403
1889 cases.add("ignored defered statement value",2404 cases.add(
2405 "ignored defered statement value",
1890 \\export fn foo() void {2406 \\export fn foo() void {
1891 \\ defer {1;}2407 \\ defer {1;}
1892 \\}2408 \\}
1893 , ".tmp_source.zig:2:12: error: expression value is ignored");2409 ,
2410 ".tmp_source.zig:2:12: error: expression value is ignored",
2411 );
18942412
1895 cases.add("ignored defered function call",2413 cases.add(
2414 "ignored defered function call",
1896 \\export fn foo() void {2415 \\export fn foo() void {
1897 \\ defer bar();2416 \\ defer bar();
1898 \\}2417 \\}
1899 \\fn bar() error!i32 { return 0; }2418 \\fn bar() error!i32 { return 0; }
1900 , ".tmp_source.zig:2:14: error: expression value is ignored");2419 ,
2420 ".tmp_source.zig:2:14: error: expression value is ignored",
2421 );
19012422
1902 cases.add("dereference an array",2423 cases.add(
2424 "dereference an array",
1903 \\var s_buffer: [10]u8 = undefined;2425 \\var s_buffer: [10]u8 = undefined;
1904 \\pub fn pass(in: []u8) []u8 {2426 \\pub fn pass(in: []u8) []u8 {
1905 \\ var out = &s_buffer;2427 \\ var out = &s_buffer;
...@@ -1908,11 +2430,14 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1908,11 +2430,14 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1908 \\}2430 \\}
1909 \\2431 \\
1910 \\export fn entry() usize { return @sizeOf(@typeOf(pass)); }2432 \\export fn entry() usize { return @sizeOf(@typeOf(pass)); }
1911 , ".tmp_source.zig:4:11: error: attempt to dereference non pointer type '[10]u8'");2433 ,
2434 ".tmp_source.zig:4:11: error: attempt to dereference non pointer type '[10]u8'",
2435 );
19122436
1913 cases.add("pass const ptr to mutable ptr fn",2437 cases.add(
2438 "pass const ptr to mutable ptr fn",
1914 \\fn foo() bool {2439 \\fn foo() bool {
1915 \\ const a = ([]const u8)("a");2440 \\ const a = ([]const u8)("a",);
1916 \\ const b = &a;2441 \\ const b = &a;
1917 \\ return ptrEql(b, b);2442 \\ return ptrEql(b, b);
1918 \\}2443 \\}
...@@ -1921,18 +2446,22 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1921,18 +2446,22 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1921 \\}2446 \\}
1922 \\2447 \\
1923 \\export fn entry() usize { return @sizeOf(@typeOf(foo)); }2448 \\export fn entry() usize { return @sizeOf(@typeOf(foo)); }
1924 , ".tmp_source.zig:4:19: error: expected type '&[]const u8', found '&const []const u8'");2449 ,
2450 ".tmp_source.zig:4:19: error: expected type '&[]const u8', found '&const []const u8'",
2451 );
19252452
1926 cases.addCase(x: {2453 cases.addCase(x: {
1927 const tc = cases.create("export collision",2454 const tc = cases.create(
1928 \\const foo = @import("foo.zig");2455 "export collision",
2456 \\const foo = @import("foo.zig",);
1929 \\2457 \\
1930 \\export fn bar() usize {2458 \\export fn bar() usize {
1931 \\ return foo.baz;2459 \\ return foo.baz;
1932 \\}2460 \\}
1933 ,2461 ,
1934 "foo.zig:1:8: error: exported symbol collision: 'bar'",2462 "foo.zig:1:8: error: exported symbol collision: 'bar'",
1935 ".tmp_source.zig:3:8: note: other symbol here");2463 ".tmp_source.zig:3:8: note: other symbol here",
2464 );
19362465
1937 tc.addSourceFile("foo.zig",2466 tc.addSourceFile("foo.zig",
1938 \\export fn bar() void {}2467 \\export fn bar() void {}
...@@ -1942,35 +2471,48 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1942,35 +2471,48 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1942 break :x tc;2471 break :x tc;
1943 });2472 });
19442473
1945 cases.add("pass non-copyable type by value to function",2474 cases.add(
2475 "pass non-copyable type by value to function",
1946 \\const Point = struct { x: i32, y: i32, };2476 \\const Point = struct { x: i32, y: i32, };
1947 \\fn foo(p: Point) void { }2477 \\fn foo(p: Point) void { }
1948 \\export fn entry() usize { return @sizeOf(@typeOf(foo)); }2478 \\export fn entry() usize { return @sizeOf(@typeOf(foo)); }
1949 , ".tmp_source.zig:2:11: error: type 'Point' is not copyable; cannot pass by value");2479 ,
2480 ".tmp_source.zig:2:11: error: type 'Point' is not copyable; cannot pass by value",
2481 );
19502482
1951 cases.add("implicit cast from array to mutable slice",2483 cases.add(
2484 "implicit cast from array to mutable slice",
1952 \\var global_array: [10]i32 = undefined;2485 \\var global_array: [10]i32 = undefined;
1953 \\fn foo(param: []i32) void {}2486 \\fn foo(param: []i32) void {}
1954 \\export fn entry() void {2487 \\export fn entry() void {
1955 \\ foo(global_array);2488 \\ foo(global_array);
1956 \\}2489 \\}
1957 , ".tmp_source.zig:4:9: error: expected type '[]i32', found '[10]i32'");2490 ,
2491 ".tmp_source.zig:4:9: error: expected type '[]i32', found '[10]i32'",
2492 );
19582493
1959 cases.add("ptrcast to non-pointer",2494 cases.add(
2495 "ptrcast to non-pointer",
1960 \\export fn entry(a: &i32) usize {2496 \\export fn entry(a: &i32) usize {
1961 \\ return @ptrCast(usize, a);2497 \\ return @ptrCast(usize, a);
1962 \\}2498 \\}
1963 , ".tmp_source.zig:2:21: error: expected pointer, found 'usize'");2499 ,
2500 ".tmp_source.zig:2:21: error: expected pointer, found 'usize'",
2501 );
19642502
1965 cases.add("too many error values to cast to small integer",2503 cases.add(
2504 "too many error values to cast to small integer",
1966 \\const Error = error { A, B, C, D, E, F, G, H };2505 \\const Error = error { A, B, C, D, E, F, G, H };
1967 \\fn foo(e: Error) u2 {2506 \\fn foo(e: Error) u2 {
1968 \\ return u2(e);2507 \\ return u2(e);
1969 \\}2508 \\}
1970 \\export fn entry() usize { return @sizeOf(@typeOf(foo)); }2509 \\export fn entry() usize { return @sizeOf(@typeOf(foo)); }
1971 , ".tmp_source.zig:3:14: error: too many error values to fit in 'u2'");2510 ,
2511 ".tmp_source.zig:3:14: error: too many error values to fit in 'u2'",
2512 );
19722513
1973 cases.add("asm at compile time",2514 cases.add(
2515 "asm at compile time",
1974 \\comptime {2516 \\comptime {
1975 \\ doSomeAsm();2517 \\ doSomeAsm();
1976 \\}2518 \\}
...@@ -1982,48 +2524,66 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -1982,48 +2524,66 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
1982 \\ \\.set aoeu, derp;2524 \\ \\.set aoeu, derp;
1983 \\ );2525 \\ );
1984 \\}2526 \\}
1985 , ".tmp_source.zig:6:5: error: unable to evaluate constant expression");2527 ,
2528 ".tmp_source.zig:6:5: error: unable to evaluate constant expression",
2529 );
19862530
1987 cases.add("invalid member of builtin enum",2531 cases.add(
1988 \\const builtin = @import("builtin");2532 "invalid member of builtin enum",
2533 \\const builtin = @import("builtin",);
1989 \\export fn entry() void {2534 \\export fn entry() void {
1990 \\ const foo = builtin.Arch.x86;2535 \\ const foo = builtin.Arch.x86;
1991 \\}2536 \\}
1992 , ".tmp_source.zig:3:29: error: container 'Arch' has no member called 'x86'");2537 ,
2538 ".tmp_source.zig:3:29: error: container 'Arch' has no member called 'x86'",
2539 );
19932540
1994 cases.add("int to ptr of 0 bits",2541 cases.add(
2542 "int to ptr of 0 bits",
1995 \\export fn foo() void {2543 \\export fn foo() void {
1996 \\ var x: usize = 0x1000;2544 \\ var x: usize = 0x1000;
1997 \\ var y: &void = @intToPtr(&void, x);2545 \\ var y: &void = @intToPtr(&void, x);
1998 \\}2546 \\}
1999 , ".tmp_source.zig:3:31: error: type '&void' has 0 bits and cannot store information");2547 ,
2548 ".tmp_source.zig:3:31: error: type '&void' has 0 bits and cannot store information",
2549 );
20002550
2001 cases.add("@fieldParentPtr - non struct",2551 cases.add(
2552 "@fieldParentPtr - non struct",
2002 \\const Foo = i32;2553 \\const Foo = i32;
2003 \\export fn foo(a: &i32) &Foo {2554 \\export fn foo(a: &i32) &Foo {
2004 \\ return @fieldParentPtr(Foo, "a", a);2555 \\ return @fieldParentPtr(Foo, "a", a);
2005 \\}2556 \\}
2006 , ".tmp_source.zig:3:28: error: expected struct type, found 'i32'");2557 ,
2558 ".tmp_source.zig:3:28: error: expected struct type, found 'i32'",
2559 );
20072560
2008 cases.add("@fieldParentPtr - bad field name",2561 cases.add(
2562 "@fieldParentPtr - bad field name",
2009 \\const Foo = extern struct {2563 \\const Foo = extern struct {
2010 \\ derp: i32,2564 \\ derp: i32,
2011 \\};2565 \\};
2012 \\export fn foo(a: &i32) &Foo {2566 \\export fn foo(a: &i32) &Foo {
2013 \\ return @fieldParentPtr(Foo, "a", a);2567 \\ return @fieldParentPtr(Foo, "a", a);
2014 \\}2568 \\}
2015 , ".tmp_source.zig:5:33: error: struct 'Foo' has no field 'a'");2569 ,
2570 ".tmp_source.zig:5:33: error: struct 'Foo' has no field 'a'",
2571 );
20162572
2017 cases.add("@fieldParentPtr - field pointer is not pointer",2573 cases.add(
2574 "@fieldParentPtr - field pointer is not pointer",
2018 \\const Foo = extern struct {2575 \\const Foo = extern struct {
2019 \\ a: i32,2576 \\ a: i32,
2020 \\};2577 \\};
2021 \\export fn foo(a: i32) &Foo {2578 \\export fn foo(a: i32) &Foo {
2022 \\ return @fieldParentPtr(Foo, "a", a);2579 \\ return @fieldParentPtr(Foo, "a", a);
2023 \\}2580 \\}
2024 , ".tmp_source.zig:5:38: error: expected pointer, found 'i32'");2581 ,
2582 ".tmp_source.zig:5:38: error: expected pointer, found 'i32'",
2583 );
20252584
2026 cases.add("@fieldParentPtr - comptime field ptr not based on struct",2585 cases.add(
2586 "@fieldParentPtr - comptime field ptr not based on struct",
2027 \\const Foo = struct {2587 \\const Foo = struct {
2028 \\ a: i32,2588 \\ a: i32,
2029 \\ b: i32,2589 \\ b: i32,
...@@ -2034,9 +2594,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2034,9 +2594,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2034 \\ const field_ptr = @intToPtr(&i32, 0x1234);2594 \\ const field_ptr = @intToPtr(&i32, 0x1234);
2035 \\ const another_foo_ptr = @fieldParentPtr(Foo, "b", field_ptr);2595 \\ const another_foo_ptr = @fieldParentPtr(Foo, "b", field_ptr);
2036 \\}2596 \\}
2037 , ".tmp_source.zig:9:55: error: pointer value not based on parent struct");2597 ,
2598 ".tmp_source.zig:9:55: error: pointer value not based on parent struct",
2599 );
20382600
2039 cases.add("@fieldParentPtr - comptime wrong field index",2601 cases.add(
2602 "@fieldParentPtr - comptime wrong field index",
2040 \\const Foo = struct {2603 \\const Foo = struct {
2041 \\ a: i32,2604 \\ a: i32,
2042 \\ b: i32,2605 \\ b: i32,
...@@ -2046,76 +2609,100 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2046,76 +2609,100 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2046 \\comptime {2609 \\comptime {
2047 \\ const another_foo_ptr = @fieldParentPtr(Foo, "b", &foo.a);2610 \\ const another_foo_ptr = @fieldParentPtr(Foo, "b", &foo.a);
2048 \\}2611 \\}
2049 , ".tmp_source.zig:8:29: error: field 'b' has index 1 but pointer value is index 0 of struct 'Foo'");2612 ,
2613 ".tmp_source.zig:8:29: error: field 'b' has index 1 but pointer value is index 0 of struct 'Foo'",
2614 );
20502615
2051 cases.add("@offsetOf - non struct",2616 cases.add(
2617 "@offsetOf - non struct",
2052 \\const Foo = i32;2618 \\const Foo = i32;
2053 \\export fn foo() usize {2619 \\export fn foo() usize {
2054 \\ return @offsetOf(Foo, "a");2620 \\ return @offsetOf(Foo, "a",);
2055 \\}2621 \\}
2056 , ".tmp_source.zig:3:22: error: expected struct type, found 'i32'");2622 ,
2623 ".tmp_source.zig:3:22: error: expected struct type, found 'i32'",
2624 );
20572625
2058 cases.add("@offsetOf - bad field name",2626 cases.add(
2627 "@offsetOf - bad field name",
2059 \\const Foo = struct {2628 \\const Foo = struct {
2060 \\ derp: i32,2629 \\ derp: i32,
2061 \\};2630 \\};
2062 \\export fn foo() usize {2631 \\export fn foo() usize {
2063 \\ return @offsetOf(Foo, "a");2632 \\ return @offsetOf(Foo, "a",);
2064 \\}2633 \\}
2065 , ".tmp_source.zig:5:27: error: struct 'Foo' has no field 'a'");2634 ,
2635 ".tmp_source.zig:5:27: error: struct 'Foo' has no field 'a'",
2636 );
20662637
2067 cases.addExe("missing main fn in executable",2638 cases.addExe(
2639 "missing main fn in executable",
2068 \\2640 \\
2069 , "error: no member named 'main' in '");2641 ,
2642 "error: no member named 'main' in '",
2643 );
20702644
2071 cases.addExe("private main fn",2645 cases.addExe(
2646 "private main fn",
2072 \\fn main() void {}2647 \\fn main() void {}
2073 ,2648 ,
2074 "error: 'main' is private",2649 "error: 'main' is private",
2075 ".tmp_source.zig:1:1: note: declared here");2650 ".tmp_source.zig:1:1: note: declared here",
2651 );
20762652
2077 cases.add("setting a section on an extern variable",2653 cases.add(
2654 "setting a section on an extern variable",
2078 \\extern var foo: i32 section(".text2");2655 \\extern var foo: i32 section(".text2");
2079 \\export fn entry() i32 {2656 \\export fn entry() i32 {
2080 \\ return foo;2657 \\ return foo;
2081 \\}2658 \\}
2082 ,2659 ,
2083 ".tmp_source.zig:1:29: error: cannot set section of external variable 'foo'");2660 ".tmp_source.zig:1:29: error: cannot set section of external variable 'foo'",
2661 );
20842662
2085 cases.add("setting a section on a local variable",2663 cases.add(
2664 "setting a section on a local variable",
2086 \\export fn entry() i32 {2665 \\export fn entry() i32 {
2087 \\ var foo: i32 section(".text2") = 1234;2666 \\ var foo: i32 section(".text2") = 1234;
2088 \\ return foo;2667 \\ return foo;
2089 \\}2668 \\}
2090 ,2669 ,
2091 ".tmp_source.zig:2:26: error: cannot set section of local variable 'foo'");2670 ".tmp_source.zig:2:26: error: cannot set section of local variable 'foo'",
2671 );
20922672
2093 cases.add("setting a section on an extern fn",2673 cases.add(
2674 "setting a section on an extern fn",
2094 \\extern fn foo() section(".text2") void;2675 \\extern fn foo() section(".text2") void;
2095 \\export fn entry() void {2676 \\export fn entry() void {
2096 \\ foo();2677 \\ foo();
2097 \\}2678 \\}
2098 ,2679 ,
2099 ".tmp_source.zig:1:25: error: cannot set section of external function 'foo'");2680 ".tmp_source.zig:1:25: error: cannot set section of external function 'foo'",
2681 );
21002682
2101 cases.add("returning address of local variable - simple",2683 cases.add(
2684 "returning address of local variable - simple",
2102 \\export fn foo() &i32 {2685 \\export fn foo() &i32 {
2103 \\ var a: i32 = undefined;2686 \\ var a: i32 = undefined;
2104 \\ return &a;2687 \\ return &a;
2105 \\}2688 \\}
2106 ,2689 ,
2107 ".tmp_source.zig:3:13: error: function returns address of local variable");2690 ".tmp_source.zig:3:13: error: function returns address of local variable",
2691 );
21082692
2109 cases.add("returning address of local variable - phi",2693 cases.add(
2694 "returning address of local variable - phi",
2110 \\export fn foo(c: bool) &i32 {2695 \\export fn foo(c: bool) &i32 {
2111 \\ var a: i32 = undefined;2696 \\ var a: i32 = undefined;
2112 \\ var b: i32 = undefined;2697 \\ var b: i32 = undefined;
2113 \\ return if (c) &a else &b;2698 \\ return if (c) &a else &b;
2114 \\}2699 \\}
2115 ,2700 ,
2116 ".tmp_source.zig:4:12: error: function returns address of local variable");2701 ".tmp_source.zig:4:12: error: function returns address of local variable",
2702 );
21172703
2118 cases.add("inner struct member shadowing outer struct member",2704 cases.add(
2705 "inner struct member shadowing outer struct member",
2119 \\fn A() type {2706 \\fn A() type {
2120 \\ return struct {2707 \\ return struct {
2121 \\ b: B(),2708 \\ b: B(),
...@@ -2137,57 +2724,71 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2137,57 +2724,71 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2137 \\}2724 \\}
2138 ,2725 ,
2139 ".tmp_source.zig:9:17: error: redefinition of 'Self'",2726 ".tmp_source.zig:9:17: error: redefinition of 'Self'",
2140 ".tmp_source.zig:5:9: note: previous definition is here");2727 ".tmp_source.zig:5:9: note: previous definition is here",
2728 );
21412729
2142 cases.add("while expected bool, got nullable",2730 cases.add(
2731 "while expected bool, got nullable",
2143 \\export fn foo() void {2732 \\export fn foo() void {
2144 \\ while (bar()) {}2733 \\ while (bar()) {}
2145 \\}2734 \\}
2146 \\fn bar() ?i32 { return 1; }2735 \\fn bar() ?i32 { return 1; }
2147 ,2736 ,
2148 ".tmp_source.zig:2:15: error: expected type 'bool', found '?i32'");2737 ".tmp_source.zig:2:15: error: expected type 'bool', found '?i32'",
2738 );
21492739
2150 cases.add("while expected bool, got error union",2740 cases.add(
2741 "while expected bool, got error union",
2151 \\export fn foo() void {2742 \\export fn foo() void {
2152 \\ while (bar()) {}2743 \\ while (bar()) {}
2153 \\}2744 \\}
2154 \\fn bar() error!i32 { return 1; }2745 \\fn bar() error!i32 { return 1; }
2155 ,2746 ,
2156 ".tmp_source.zig:2:15: error: expected type 'bool', found 'error!i32'");2747 ".tmp_source.zig:2:15: error: expected type 'bool', found 'error!i32'",
2748 );
21572749
2158 cases.add("while expected nullable, got bool",2750 cases.add(
2751 "while expected nullable, got bool",
2159 \\export fn foo() void {2752 \\export fn foo() void {
2160 \\ while (bar()) |x| {}2753 \\ while (bar()) |x| {}
2161 \\}2754 \\}
2162 \\fn bar() bool { return true; }2755 \\fn bar() bool { return true; }
2163 ,2756 ,
2164 ".tmp_source.zig:2:15: error: expected nullable type, found 'bool'");2757 ".tmp_source.zig:2:15: error: expected nullable type, found 'bool'",
2758 );
21652759
2166 cases.add("while expected nullable, got error union",2760 cases.add(
2761 "while expected nullable, got error union",
2167 \\export fn foo() void {2762 \\export fn foo() void {
2168 \\ while (bar()) |x| {}2763 \\ while (bar()) |x| {}
2169 \\}2764 \\}
2170 \\fn bar() error!i32 { return 1; }2765 \\fn bar() error!i32 { return 1; }
2171 ,2766 ,
2172 ".tmp_source.zig:2:15: error: expected nullable type, found 'error!i32'");2767 ".tmp_source.zig:2:15: error: expected nullable type, found 'error!i32'",
2768 );
21732769
2174 cases.add("while expected error union, got bool",2770 cases.add(
2771 "while expected error union, got bool",
2175 \\export fn foo() void {2772 \\export fn foo() void {
2176 \\ while (bar()) |x| {} else |err| {}2773 \\ while (bar()) |x| {} else |err| {}
2177 \\}2774 \\}
2178 \\fn bar() bool { return true; }2775 \\fn bar() bool { return true; }
2179 ,2776 ,
2180 ".tmp_source.zig:2:15: error: expected error union type, found 'bool'");2777 ".tmp_source.zig:2:15: error: expected error union type, found 'bool'",
2778 );
21812779
2182 cases.add("while expected error union, got nullable",2780 cases.add(
2781 "while expected error union, got nullable",
2183 \\export fn foo() void {2782 \\export fn foo() void {
2184 \\ while (bar()) |x| {} else |err| {}2783 \\ while (bar()) |x| {} else |err| {}
2185 \\}2784 \\}
2186 \\fn bar() ?i32 { return 1; }2785 \\fn bar() ?i32 { return 1; }
2187 ,2786 ,
2188 ".tmp_source.zig:2:15: error: expected error union type, found '?i32'");2787 ".tmp_source.zig:2:15: error: expected error union type, found '?i32'",
2788 );
21892789
2190 cases.add("inline fn calls itself indirectly",2790 cases.add(
2791 "inline fn calls itself indirectly",
2191 \\export fn foo() void {2792 \\export fn foo() void {
2192 \\ bar();2793 \\ bar();
2193 \\}2794 \\}
...@@ -2201,91 +2802,113 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2201,91 +2802,113 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2201 \\}2802 \\}
2202 \\extern fn quux() void;2803 \\extern fn quux() void;
2203 ,2804 ,
2204 ".tmp_source.zig:4:8: error: unable to inline function");2805 ".tmp_source.zig:4:8: error: unable to inline function",
2806 );
22052807
2206 cases.add("save reference to inline function",2808 cases.add(
2809 "save reference to inline function",
2207 \\export fn foo() void {2810 \\export fn foo() void {
2208 \\ quux(@ptrToInt(bar));2811 \\ quux(@ptrToInt(bar));
2209 \\}2812 \\}
2210 \\inline fn bar() void { }2813 \\inline fn bar() void { }
2211 \\extern fn quux(usize) void;2814 \\extern fn quux(usize) void;
2212 ,2815 ,
2213 ".tmp_source.zig:4:8: error: unable to inline function");2816 ".tmp_source.zig:4:8: error: unable to inline function",
2817 );
22142818
2215 cases.add("signed integer division",2819 cases.add(
2820 "signed integer division",
2216 \\export fn foo(a: i32, b: i32) i32 {2821 \\export fn foo(a: i32, b: i32) i32 {
2217 \\ return a / b;2822 \\ return a / b;
2218 \\}2823 \\}
2219 ,2824 ,
2220 ".tmp_source.zig:2:14: error: division with 'i32' and 'i32': signed integers must use @divTrunc, @divFloor, or @divExact");2825 ".tmp_source.zig:2:14: error: division with 'i32' and 'i32': signed integers must use @divTrunc, @divFloor, or @divExact",
2826 );
22212827
2222 cases.add("signed integer remainder division",2828 cases.add(
2829 "signed integer remainder division",
2223 \\export fn foo(a: i32, b: i32) i32 {2830 \\export fn foo(a: i32, b: i32) i32 {
2224 \\ return a % b;2831 \\ return a % b;
2225 \\}2832 \\}
2226 ,2833 ,
2227 ".tmp_source.zig:2:14: error: remainder division with 'i32' and 'i32': signed integers and floats must use @rem or @mod");2834 ".tmp_source.zig:2:14: error: remainder division with 'i32' and 'i32': signed integers and floats must use @rem or @mod",
2835 );
22282836
2229 cases.add("cast negative value to unsigned integer",2837 cases.add(
2838 "cast negative value to unsigned integer",
2230 \\comptime {2839 \\comptime {
2231 \\ const value: i32 = -1;2840 \\ const value: i32 = -1;
2232 \\ const unsigned = u32(value);2841 \\ const unsigned = u32(value);
2233 \\}2842 \\}
2234 ,2843 ,
2235 ".tmp_source.zig:3:25: error: attempt to cast negative value to unsigned integer");2844 ".tmp_source.zig:3:25: error: attempt to cast negative value to unsigned integer",
2845 );
22362846
2237 cases.add("compile-time division by zero",2847 cases.add(
2848 "compile-time division by zero",
2238 \\comptime {2849 \\comptime {
2239 \\ const a: i32 = 1;2850 \\ const a: i32 = 1;
2240 \\ const b: i32 = 0;2851 \\ const b: i32 = 0;
2241 \\ const c = a / b;2852 \\ const c = a / b;
2242 \\}2853 \\}
2243 ,2854 ,
2244 ".tmp_source.zig:4:17: error: division by zero");2855 ".tmp_source.zig:4:17: error: division by zero",
2856 );
22452857
2246 cases.add("compile-time remainder division by zero",2858 cases.add(
2859 "compile-time remainder division by zero",
2247 \\comptime {2860 \\comptime {
2248 \\ const a: i32 = 1;2861 \\ const a: i32 = 1;
2249 \\ const b: i32 = 0;2862 \\ const b: i32 = 0;
2250 \\ const c = a % b;2863 \\ const c = a % b;
2251 \\}2864 \\}
2252 ,2865 ,
2253 ".tmp_source.zig:4:17: error: division by zero");2866 ".tmp_source.zig:4:17: error: division by zero",
2867 );
22542868
2255 cases.add("compile-time integer cast truncates bits",2869 cases.add(
2870 "compile-time integer cast truncates bits",
2256 \\comptime {2871 \\comptime {
2257 \\ const spartan_count: u16 = 300;2872 \\ const spartan_count: u16 = 300;
2258 \\ const byte = u8(spartan_count);2873 \\ const byte = u8(spartan_count);
2259 \\}2874 \\}
2260 ,2875 ,
2261 ".tmp_source.zig:3:20: error: cast from 'u16' to 'u8' truncates bits");2876 ".tmp_source.zig:3:20: error: cast from 'u16' to 'u8' truncates bits",
2877 );
22622878
2263 cases.add("@setRuntimeSafety twice for same scope",2879 cases.add(
2880 "@setRuntimeSafety twice for same scope",
2264 \\export fn foo() void {2881 \\export fn foo() void {
2265 \\ @setRuntimeSafety(false);2882 \\ @setRuntimeSafety(false);
2266 \\ @setRuntimeSafety(false);2883 \\ @setRuntimeSafety(false);
2267 \\}2884 \\}
2268 ,2885 ,
2269 ".tmp_source.zig:3:5: error: runtime safety set twice for same scope",2886 ".tmp_source.zig:3:5: error: runtime safety set twice for same scope",
2270 ".tmp_source.zig:2:5: note: first set here");2887 ".tmp_source.zig:2:5: note: first set here",
2888 );
22712889
2272 cases.add("@setFloatMode twice for same scope",2890 cases.add(
2891 "@setFloatMode twice for same scope",
2273 \\export fn foo() void {2892 \\export fn foo() void {
2274 \\ @setFloatMode(this, @import("builtin").FloatMode.Optimized);2893 \\ @setFloatMode(this, @import("builtin").FloatMode.Optimized);
2275 \\ @setFloatMode(this, @import("builtin").FloatMode.Optimized);2894 \\ @setFloatMode(this, @import("builtin").FloatMode.Optimized);
2276 \\}2895 \\}
2277 ,2896 ,
2278 ".tmp_source.zig:3:5: error: float mode set twice for same scope",2897 ".tmp_source.zig:3:5: error: float mode set twice for same scope",
2279 ".tmp_source.zig:2:5: note: first set here");2898 ".tmp_source.zig:2:5: note: first set here",
2899 );
22802900
2281 cases.add("array access of type",2901 cases.add(
2902 "array access of type",
2282 \\export fn foo() void {2903 \\export fn foo() void {
2283 \\ var b: u8[40] = undefined;2904 \\ var b: u8[40] = undefined;
2284 \\}2905 \\}
2285 ,2906 ,
2286 ".tmp_source.zig:2:14: error: array access of non-array type 'type'");2907 ".tmp_source.zig:2:14: error: array access of non-array type 'type'",
2908 );
22872909
2288 cases.add("cannot break out of defer expression",2910 cases.add(
2911 "cannot break out of defer expression",
2289 \\export fn foo() void {2912 \\export fn foo() void {
2290 \\ while (true) {2913 \\ while (true) {
2291 \\ defer {2914 \\ defer {
...@@ -2294,9 +2917,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2294,9 +2917,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2294 \\ }2917 \\ }
2295 \\}2918 \\}
2296 ,2919 ,
2297 ".tmp_source.zig:4:13: error: cannot break out of defer expression");2920 ".tmp_source.zig:4:13: error: cannot break out of defer expression",
2921 );
22982922
2299 cases.add("cannot continue out of defer expression",2923 cases.add(
2924 "cannot continue out of defer expression",
2300 \\export fn foo() void {2925 \\export fn foo() void {
2301 \\ while (true) {2926 \\ while (true) {
2302 \\ defer {2927 \\ defer {
...@@ -2305,9 +2930,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2305,9 +2930,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2305 \\ }2930 \\ }
2306 \\}2931 \\}
2307 ,2932 ,
2308 ".tmp_source.zig:4:13: error: cannot continue out of defer expression");2933 ".tmp_source.zig:4:13: error: cannot continue out of defer expression",
2934 );
23092935
2310 cases.add("calling a var args function only known at runtime",2936 cases.add(
2937 "calling a var args function only known at runtime",
2311 \\var foos = []fn(...) void { foo1, foo2 };2938 \\var foos = []fn(...) void { foo1, foo2 };
2312 \\2939 \\
2313 \\fn foo1(args: ...) void {}2940 \\fn foo1(args: ...) void {}
...@@ -2317,9 +2944,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2317,9 +2944,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2317 \\ foos[0]();2944 \\ foos[0]();
2318 \\}2945 \\}
2319 ,2946 ,
2320 ".tmp_source.zig:7:9: error: calling a generic function requires compile-time known function value");2947 ".tmp_source.zig:7:9: error: calling a generic function requires compile-time known function value",
2948 );
23212949
2322 cases.add("calling a generic function only known at runtime",2950 cases.add(
2951 "calling a generic function only known at runtime",
2323 \\var foos = []fn(var) void { foo1, foo2 };2952 \\var foos = []fn(var) void { foo1, foo2 };
2324 \\2953 \\
2325 \\fn foo1(arg: var) void {}2954 \\fn foo1(arg: var) void {}
...@@ -2329,10 +2958,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2329,10 +2958,12 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2329 \\ foos[0](true);2958 \\ foos[0](true);
2330 \\}2959 \\}
2331 ,2960 ,
2332 ".tmp_source.zig:7:9: error: calling a generic function requires compile-time known function value");2961 ".tmp_source.zig:7:9: error: calling a generic function requires compile-time known function value",
2962 );
23332963
2334 cases.add("@compileError shows traceback of references that caused it",2964 cases.add(
2335 \\const foo = @compileError("aoeu");2965 "@compileError shows traceback of references that caused it",
2966 \\const foo = @compileError("aoeu",);
2336 \\2967 \\
2337 \\const bar = baz + foo;2968 \\const bar = baz + foo;
2338 \\const baz = 1;2969 \\const baz = 1;
...@@ -2343,9 +2974,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2343,9 +2974,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2343 ,2974 ,
2344 ".tmp_source.zig:1:13: error: aoeu",2975 ".tmp_source.zig:1:13: error: aoeu",
2345 ".tmp_source.zig:3:19: note: referenced here",2976 ".tmp_source.zig:3:19: note: referenced here",
2346 ".tmp_source.zig:7:12: note: referenced here");2977 ".tmp_source.zig:7:12: note: referenced here",
2978 );
23472979
2348 cases.add("instantiating an undefined value for an invalid struct that contains itself",2980 cases.add(
2981 "instantiating an undefined value for an invalid struct that contains itself",
2349 \\const Foo = struct {2982 \\const Foo = struct {
2350 \\ x: Foo,2983 \\ x: Foo,
2351 \\};2984 \\};
...@@ -2356,73 +2989,93 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2356,73 +2989,93 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2356 \\ return @sizeOf(@typeOf(foo.x));2989 \\ return @sizeOf(@typeOf(foo.x));
2357 \\}2990 \\}
2358 ,2991 ,
2359 ".tmp_source.zig:1:13: error: struct 'Foo' contains itself");2992 ".tmp_source.zig:1:13: error: struct 'Foo' contains itself",
2993 );
23602994
2361 cases.add("float literal too large error",2995 cases.add(
2996 "float literal too large error",
2362 \\comptime {2997 \\comptime {
2363 \\ const a = 0x1.0p16384;2998 \\ const a = 0x1.0p16384;
2364 \\}2999 \\}
2365 ,3000 ,
2366 ".tmp_source.zig:2:15: error: float literal out of range of any type");3001 ".tmp_source.zig:2:15: error: float literal out of range of any type",
3002 );
23673003
2368 cases.add("float literal too small error (denormal)",3004 cases.add(
3005 "float literal too small error (denormal)",
2369 \\comptime {3006 \\comptime {
2370 \\ const a = 0x1.0p-16384;3007 \\ const a = 0x1.0p-16384;
2371 \\}3008 \\}
2372 ,3009 ,
2373 ".tmp_source.zig:2:15: error: float literal out of range of any type");3010 ".tmp_source.zig:2:15: error: float literal out of range of any type",
3011 );
23743012
2375 cases.add("explicit cast float literal to integer when there is a fraction component",3013 cases.add(
3014 "explicit cast float literal to integer when there is a fraction component",
2376 \\export fn entry() i32 {3015 \\export fn entry() i32 {
2377 \\ return i32(12.34);3016 \\ return i32(12.34);
2378 \\}3017 \\}
2379 ,3018 ,
2380 ".tmp_source.zig:2:16: error: fractional component prevents float value 12.340000 from being casted to type 'i32'");3019 ".tmp_source.zig:2:16: error: fractional component prevents float value 12.340000 from being casted to type 'i32'",
3020 );
23813021
2382 cases.add("non pointer given to @ptrToInt",3022 cases.add(
3023 "non pointer given to @ptrToInt",
2383 \\export fn entry(x: i32) usize {3024 \\export fn entry(x: i32) usize {
2384 \\ return @ptrToInt(x);3025 \\ return @ptrToInt(x);
2385 \\}3026 \\}
2386 ,3027 ,
2387 ".tmp_source.zig:2:22: error: expected pointer, found 'i32'");3028 ".tmp_source.zig:2:22: error: expected pointer, found 'i32'",
3029 );
23883030
2389 cases.add("@shlExact shifts out 1 bits",3031 cases.add(
3032 "@shlExact shifts out 1 bits",
2390 \\comptime {3033 \\comptime {
2391 \\ const x = @shlExact(u8(0b01010101), 2);3034 \\ const x = @shlExact(u8(0b01010101), 2);
2392 \\}3035 \\}
2393 ,3036 ,
2394 ".tmp_source.zig:2:15: error: operation caused overflow");3037 ".tmp_source.zig:2:15: error: operation caused overflow",
3038 );
23953039
2396 cases.add("@shrExact shifts out 1 bits",3040 cases.add(
3041 "@shrExact shifts out 1 bits",
2397 \\comptime {3042 \\comptime {
2398 \\ const x = @shrExact(u8(0b10101010), 2);3043 \\ const x = @shrExact(u8(0b10101010), 2);
2399 \\}3044 \\}
2400 ,3045 ,
2401 ".tmp_source.zig:2:15: error: exact shift shifted out 1 bits");3046 ".tmp_source.zig:2:15: error: exact shift shifted out 1 bits",
3047 );
24023048
2403 cases.add("shifting without int type or comptime known",3049 cases.add(
3050 "shifting without int type or comptime known",
2404 \\export fn entry(x: u8) u8 {3051 \\export fn entry(x: u8) u8 {
2405 \\ return 0x11 << x;3052 \\ return 0x11 << x;
2406 \\}3053 \\}
2407 ,3054 ,
2408 ".tmp_source.zig:2:17: error: LHS of shift must be an integer type, or RHS must be compile-time known");3055 ".tmp_source.zig:2:17: error: LHS of shift must be an integer type, or RHS must be compile-time known",
3056 );
24093057
2410 cases.add("shifting RHS is log2 of LHS int bit width",3058 cases.add(
3059 "shifting RHS is log2 of LHS int bit width",
2411 \\export fn entry(x: u8, y: u8) u8 {3060 \\export fn entry(x: u8, y: u8) u8 {
2412 \\ return x << y;3061 \\ return x << y;
2413 \\}3062 \\}
2414 ,3063 ,
2415 ".tmp_source.zig:2:17: error: expected type 'u3', found 'u8'");3064 ".tmp_source.zig:2:17: error: expected type 'u3', found 'u8'",
3065 );
24163066
2417 cases.add("globally shadowing a primitive type",3067 cases.add(
3068 "globally shadowing a primitive type",
2418 \\const u16 = @intType(false, 8);3069 \\const u16 = @intType(false, 8);
2419 \\export fn entry() void {3070 \\export fn entry() void {
2420 \\ const a: u16 = 300;3071 \\ const a: u16 = 300;
2421 \\}3072 \\}
2422 ,3073 ,
2423 ".tmp_source.zig:1:1: error: declaration shadows type 'u16'");3074 ".tmp_source.zig:1:1: error: declaration shadows type 'u16'",
3075 );
24243076
2425 cases.add("implicitly increasing pointer alignment",3077 cases.add(
3078 "implicitly increasing pointer alignment",
2426 \\const Foo = packed struct {3079 \\const Foo = packed struct {
2427 \\ a: u8,3080 \\ a: u8,
2428 \\ b: u32,3081 \\ b: u32,
...@@ -2437,9 +3090,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2437,9 +3090,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2437 \\ x.* += 1;3090 \\ x.* += 1;
2438 \\}3091 \\}
2439 ,3092 ,
2440 ".tmp_source.zig:8:13: error: expected type '&u32', found '&align(1) u32'");3093 ".tmp_source.zig:8:13: error: expected type '&u32', found '&align(1) u32'",
3094 );
24413095
2442 cases.add("implicitly increasing slice alignment",3096 cases.add(
3097 "implicitly increasing slice alignment",
2443 \\const Foo = packed struct {3098 \\const Foo = packed struct {
2444 \\ a: u8,3099 \\ a: u8,
2445 \\ b: u32,3100 \\ b: u32,
...@@ -2455,9 +3110,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2455,9 +3110,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2455 \\ x[0] += 1;3110 \\ x[0] += 1;
2456 \\}3111 \\}
2457 ,3112 ,
2458 ".tmp_source.zig:9:17: error: expected type '[]u32', found '[]align(1) u32'");3113 ".tmp_source.zig:9:17: error: expected type '[]u32', found '[]align(1) u32'",
3114 );
24593115
2460 cases.add("increase pointer alignment in @ptrCast",3116 cases.add(
3117 "increase pointer alignment in @ptrCast",
2461 \\export fn entry() u32 {3118 \\export fn entry() u32 {
2462 \\ var bytes: [4]u8 = []u8{0x01, 0x02, 0x03, 0x04};3119 \\ var bytes: [4]u8 = []u8{0x01, 0x02, 0x03, 0x04};
2463 \\ const ptr = @ptrCast(&u32, &bytes[0]);3120 \\ const ptr = @ptrCast(&u32, &bytes[0]);
...@@ -2466,9 +3123,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2466,9 +3123,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2466 ,3123 ,
2467 ".tmp_source.zig:3:17: error: cast increases pointer alignment",3124 ".tmp_source.zig:3:17: error: cast increases pointer alignment",
2468 ".tmp_source.zig:3:38: note: '&u8' has alignment 1",3125 ".tmp_source.zig:3:38: note: '&u8' has alignment 1",
2469 ".tmp_source.zig:3:27: note: '&u32' has alignment 4");3126 ".tmp_source.zig:3:27: note: '&u32' has alignment 4",
3127 );
24703128
2471 cases.add("increase pointer alignment in slice resize",3129 cases.add(
3130 "increase pointer alignment in slice resize",
2472 \\export fn entry() u32 {3131 \\export fn entry() u32 {
2473 \\ var bytes = []u8{0x01, 0x02, 0x03, 0x04};3132 \\ var bytes = []u8{0x01, 0x02, 0x03, 0x04};
2474 \\ return ([]u32)(bytes[0..])[0];3133 \\ return ([]u32)(bytes[0..])[0];
...@@ -2476,16 +3135,20 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2476,16 +3135,20 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2476 ,3135 ,
2477 ".tmp_source.zig:3:19: error: cast increases pointer alignment",3136 ".tmp_source.zig:3:19: error: cast increases pointer alignment",
2478 ".tmp_source.zig:3:19: note: '[]u8' has alignment 1",3137 ".tmp_source.zig:3:19: note: '[]u8' has alignment 1",
2479 ".tmp_source.zig:3:19: note: '[]u32' has alignment 4");3138 ".tmp_source.zig:3:19: note: '[]u32' has alignment 4",
3139 );
24803140
2481 cases.add("@alignCast expects pointer or slice",3141 cases.add(
3142 "@alignCast expects pointer or slice",
2482 \\export fn entry() void {3143 \\export fn entry() void {
2483 \\ @alignCast(4, u32(3));3144 \\ @alignCast(4, u32(3));
2484 \\}3145 \\}
2485 ,3146 ,
2486 ".tmp_source.zig:2:22: error: expected pointer or slice, found 'u32'");3147 ".tmp_source.zig:2:22: error: expected pointer or slice, found 'u32'",
3148 );
24873149
2488 cases.add("passing an under-aligned function pointer",3150 cases.add(
3151 "passing an under-aligned function pointer",
2489 \\export fn entry() void {3152 \\export fn entry() void {
2490 \\ testImplicitlyDecreaseFnAlign(alignedSmall, 1234);3153 \\ testImplicitlyDecreaseFnAlign(alignedSmall, 1234);
2491 \\}3154 \\}
...@@ -2494,9 +3157,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2494,9 +3157,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2494 \\}3157 \\}
2495 \\fn alignedSmall() align(4) i32 { return 1234; }3158 \\fn alignedSmall() align(4) i32 { return 1234; }
2496 ,3159 ,
2497 ".tmp_source.zig:2:35: error: expected type 'fn() align(8) i32', found 'fn() align(4) i32'");3160 ".tmp_source.zig:2:35: error: expected type 'fn() align(8) i32', found 'fn() align(4) i32'",
3161 );
24983162
2499 cases.add("passing a not-aligned-enough pointer to cmpxchg",3163 cases.add(
3164 "passing a not-aligned-enough pointer to cmpxchg",
2500 \\const AtomicOrder = @import("builtin").AtomicOrder;3165 \\const AtomicOrder = @import("builtin").AtomicOrder;
2501 \\export fn entry() bool {3166 \\export fn entry() bool {
2502 \\ var x: i32 align(1) = 1234;3167 \\ var x: i32 align(1) = 1234;
...@@ -2504,16 +3169,20 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2504,16 +3169,20 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2504 \\ return x == 5678;3169 \\ return x == 5678;
2505 \\}3170 \\}
2506 ,3171 ,
2507 ".tmp_source.zig:4:32: error: expected type '&i32', found '&align(1) i32'");3172 ".tmp_source.zig:4:32: error: expected type '&i32', found '&align(1) i32'",
3173 );
25083174
2509 cases.add("wrong size to an array literal",3175 cases.add(
3176 "wrong size to an array literal",
2510 \\comptime {3177 \\comptime {
2511 \\ const array = [2]u8{1, 2, 3};3178 \\ const array = [2]u8{1, 2, 3};
2512 \\}3179 \\}
2513 ,3180 ,
2514 ".tmp_source.zig:2:24: error: expected [2]u8 literal, found [3]u8 literal");3181 ".tmp_source.zig:2:24: error: expected [2]u8 literal, found [3]u8 literal",
3182 );
25153183
2516 cases.add("@setEvalBranchQuota in non-root comptime execution context",3184 cases.add(
3185 "@setEvalBranchQuota in non-root comptime execution context",
2517 \\comptime {3186 \\comptime {
2518 \\ foo();3187 \\ foo();
2519 \\}3188 \\}
...@@ -2523,9 +3192,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2523,9 +3192,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2523 ,3192 ,
2524 ".tmp_source.zig:5:5: error: @setEvalBranchQuota must be called from the top of the comptime stack",3193 ".tmp_source.zig:5:5: error: @setEvalBranchQuota must be called from the top of the comptime stack",
2525 ".tmp_source.zig:2:8: note: called from here",3194 ".tmp_source.zig:2:8: note: called from here",
2526 ".tmp_source.zig:1:10: note: called from here");3195 ".tmp_source.zig:1:10: note: called from here",
3196 );
25273197
2528 cases.add("wrong pointer implicitly casted to pointer to @OpaqueType()",3198 cases.add(
3199 "wrong pointer implicitly casted to pointer to @OpaqueType()",
2529 \\const Derp = @OpaqueType();3200 \\const Derp = @OpaqueType();
2530 \\extern fn bar(d: &Derp) void;3201 \\extern fn bar(d: &Derp) void;
2531 \\export fn foo() void {3202 \\export fn foo() void {
...@@ -2533,9 +3204,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2533,9 +3204,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2533 \\ bar(@ptrCast(&c_void, &x));3204 \\ bar(@ptrCast(&c_void, &x));
2534 \\}3205 \\}
2535 ,3206 ,
2536 ".tmp_source.zig:5:9: error: expected type '&Derp', found '&c_void'");3207 ".tmp_source.zig:5:9: error: expected type '&Derp', found '&c_void'",
3208 );
25373209
2538 cases.add("non-const variables of things that require const variables",3210 cases.add(
3211 "non-const variables of things that require const variables",
2539 \\const Opaque = @OpaqueType();3212 \\const Opaque = @OpaqueType();
2540 \\3213 \\
2541 \\export fn entry(opaque: &Opaque) void {3214 \\export fn entry(opaque: &Opaque) void {
...@@ -2549,7 +3222,7 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2549,7 +3222,7 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2549 \\ var e = null;3222 \\ var e = null;
2550 \\ var f = opaque.*;3223 \\ var f = opaque.*;
2551 \\ var g = i32;3224 \\ var g = i32;
2552 \\ var h = @import("std");3225 \\ var h = @import("std",);
2553 \\ var i = (Foo {}).bar;3226 \\ var i = (Foo {}).bar;
2554 \\3227 \\
2555 \\ var z: noreturn = return;3228 \\ var z: noreturn = return;
...@@ -2569,26 +3242,32 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2569,26 +3242,32 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2569 ".tmp_source.zig:13:4: error: variable of type 'type' must be const or comptime",3242 ".tmp_source.zig:13:4: error: variable of type 'type' must be const or comptime",
2570 ".tmp_source.zig:14:4: error: variable of type '(namespace)' must be const or comptime",3243 ".tmp_source.zig:14:4: error: variable of type '(namespace)' must be const or comptime",
2571 ".tmp_source.zig:15:4: error: variable of type '(bound fn(&const Foo) void)' must be const or comptime",3244 ".tmp_source.zig:15:4: error: variable of type '(bound fn(&const Foo) void)' must be const or comptime",
2572 ".tmp_source.zig:17:4: error: unreachable code");3245 ".tmp_source.zig:17:4: error: unreachable code",
3246 );
25733247
2574 cases.add("wrong types given to atomic order args in cmpxchg",3248 cases.add(
3249 "wrong types given to atomic order args in cmpxchg",
2575 \\export fn entry() void {3250 \\export fn entry() void {
2576 \\ var x: i32 = 1234;3251 \\ var x: i32 = 1234;
2577 \\ while (!@cmpxchgWeak(i32, &x, 1234, 5678, u32(1234), u32(1234))) {}3252 \\ while (!@cmpxchgWeak(i32, &x, 1234, 5678, u32(1234), u32(1234))) {}
2578 \\}3253 \\}
2579 ,3254 ,
2580 ".tmp_source.zig:3:50: error: expected type 'AtomicOrder', found 'u32'");3255 ".tmp_source.zig:3:50: error: expected type 'AtomicOrder', found 'u32'",
3256 );
25813257
2582 cases.add("wrong types given to @export",3258 cases.add(
3259 "wrong types given to @export",
2583 \\extern fn entry() void { }3260 \\extern fn entry() void { }
2584 \\comptime {3261 \\comptime {
2585 \\ @export("entry", entry, u32(1234));3262 \\ @export("entry", entry, u32(1234));
2586 \\}3263 \\}
2587 ,3264 ,
2588 ".tmp_source.zig:3:32: error: expected type 'GlobalLinkage', found 'u32'");3265 ".tmp_source.zig:3:32: error: expected type 'GlobalLinkage', found 'u32'",
3266 );
25893267
2590 cases.add("struct with invalid field",3268 cases.add(
2591 \\const std = @import("std");3269 "struct with invalid field",
3270 \\const std = @import("std",);
2592 \\const Allocator = std.mem.Allocator;3271 \\const Allocator = std.mem.Allocator;
2593 \\const ArrayList = std.ArrayList;3272 \\const ArrayList = std.ArrayList;
2594 \\3273 \\
...@@ -2612,23 +3291,29 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2612,23 +3291,29 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2612 \\ };3291 \\ };
2613 \\}3292 \\}
2614 ,3293 ,
2615 ".tmp_source.zig:14:17: error: use of undeclared identifier 'HeaderValue'");3294 ".tmp_source.zig:14:17: error: use of undeclared identifier 'HeaderValue'",
3295 );
26163296
2617 cases.add("@setAlignStack outside function",3297 cases.add(
3298 "@setAlignStack outside function",
2618 \\comptime {3299 \\comptime {
2619 \\ @setAlignStack(16);3300 \\ @setAlignStack(16);
2620 \\}3301 \\}
2621 ,3302 ,
2622 ".tmp_source.zig:2:5: error: @setAlignStack outside function");3303 ".tmp_source.zig:2:5: error: @setAlignStack outside function",
3304 );
26233305
2624 cases.add("@setAlignStack in naked function",3306 cases.add(
3307 "@setAlignStack in naked function",
2625 \\export nakedcc fn entry() void {3308 \\export nakedcc fn entry() void {
2626 \\ @setAlignStack(16);3309 \\ @setAlignStack(16);
2627 \\}3310 \\}
2628 ,3311 ,
2629 ".tmp_source.zig:2:5: error: @setAlignStack in naked function");3312 ".tmp_source.zig:2:5: error: @setAlignStack in naked function",
3313 );
26303314
2631 cases.add("@setAlignStack in inline function",3315 cases.add(
3316 "@setAlignStack in inline function",
2632 \\export fn entry() void {3317 \\export fn entry() void {
2633 \\ foo();3318 \\ foo();
2634 \\}3319 \\}
...@@ -2636,25 +3321,31 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2636,25 +3321,31 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2636 \\ @setAlignStack(16);3321 \\ @setAlignStack(16);
2637 \\}3322 \\}
2638 ,3323 ,
2639 ".tmp_source.zig:5:5: error: @setAlignStack in inline function");3324 ".tmp_source.zig:5:5: error: @setAlignStack in inline function",
3325 );
26403326
2641 cases.add("@setAlignStack set twice",3327 cases.add(
3328 "@setAlignStack set twice",
2642 \\export fn entry() void {3329 \\export fn entry() void {
2643 \\ @setAlignStack(16);3330 \\ @setAlignStack(16);
2644 \\ @setAlignStack(16);3331 \\ @setAlignStack(16);
2645 \\}3332 \\}
2646 ,3333 ,
2647 ".tmp_source.zig:3:5: error: alignstack set twice",3334 ".tmp_source.zig:3:5: error: alignstack set twice",
2648 ".tmp_source.zig:2:5: note: first set here");3335 ".tmp_source.zig:2:5: note: first set here",
3336 );
26493337
2650 cases.add("@setAlignStack too big",3338 cases.add(
3339 "@setAlignStack too big",
2651 \\export fn entry() void {3340 \\export fn entry() void {
2652 \\ @setAlignStack(511 + 1);3341 \\ @setAlignStack(511 + 1);
2653 \\}3342 \\}
2654 ,3343 ,
2655 ".tmp_source.zig:2:5: error: attempt to @setAlignStack(512); maximum is 256");3344 ".tmp_source.zig:2:5: error: attempt to @setAlignStack(512); maximum is 256",
3345 );
26563346
2657 cases.add("storing runtime value in compile time variable then using it",3347 cases.add(
3348 "storing runtime value in compile time variable then using it",
2658 \\const Mode = @import("builtin").Mode;3349 \\const Mode = @import("builtin").Mode;
2659 \\3350 \\
2660 \\fn Free(comptime filename: []const u8) TestCase {3351 \\fn Free(comptime filename: []const u8) TestCase {
...@@ -2697,9 +3388,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2697,9 +3388,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2697 \\ }3388 \\ }
2698 \\}3389 \\}
2699 ,3390 ,
2700 ".tmp_source.zig:37:16: error: cannot store runtime value in compile time variable");3391 ".tmp_source.zig:37:16: error: cannot store runtime value in compile time variable",
3392 );
27013393
2702 cases.add("field access of opaque type",3394 cases.add(
3395 "field access of opaque type",
2703 \\const MyType = @OpaqueType();3396 \\const MyType = @OpaqueType();
2704 \\3397 \\
2705 \\export fn entry() bool {3398 \\export fn entry() bool {
...@@ -2711,120 +3404,148 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2711,120 +3404,148 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2711 \\ return x.blah;3404 \\ return x.blah;
2712 \\}3405 \\}
2713 ,3406 ,
2714 ".tmp_source.zig:9:13: error: type '&MyType' does not support field access");3407 ".tmp_source.zig:9:13: error: type '&MyType' does not support field access",
3408 );
27153409
2716 cases.add("carriage return special case",3410 cases.add(
3411 "carriage return special case",
2717 "fn test() bool {\r\n" ++3412 "fn test() bool {\r\n" ++
2718 " true\r\n" ++3413 " true\r\n" ++
2719 "}\r\n"3414 "}\r\n",
2720 ,3415 ".tmp_source.zig:1:17: error: invalid carriage return, only '\\n' line endings are supported",
2721 ".tmp_source.zig:1:17: error: invalid carriage return, only '\\n' line endings are supported");3416 );
27223417
2723 cases.add("non-printable invalid character",3418 cases.add(
2724 "\xff\xfe" ++3419 "non-printable invalid character",
2725 \\fn test() bool {\r3420 "\xff\xfe" ++
2726 \\ true\r3421 \\fn test() bool {\r
2727 \\}3422 \\ true\r
2728 ,3423 \\}
2729 ".tmp_source.zig:1:1: error: invalid character: '\\xff'");3424 ,
3425 ".tmp_source.zig:1:1: error: invalid character: '\\xff'",
3426 );
27303427
2731 cases.add("non-printable invalid character with escape alternative",3428 cases.add(
3429 "non-printable invalid character with escape alternative",
2732 "fn test() bool {\n" ++3430 "fn test() bool {\n" ++
2733 "\ttrue\n" ++3431 "\ttrue\n" ++
2734 "}\n"3432 "}\n",
2735 ,3433 ".tmp_source.zig:2:1: error: invalid character: '\\t'",
2736 ".tmp_source.zig:2:1: error: invalid character: '\\t'");3434 );
27373435
2738 cases.add("@ArgType given non function parameter",3436 cases.add(
3437 "@ArgType given non function parameter",
2739 \\comptime {3438 \\comptime {
2740 \\ _ = @ArgType(i32, 3);3439 \\ _ = @ArgType(i32, 3);
2741 \\}3440 \\}
2742 ,3441 ,
2743 ".tmp_source.zig:2:18: error: expected function, found 'i32'");3442 ".tmp_source.zig:2:18: error: expected function, found 'i32'",
3443 );
27443444
2745 cases.add("@ArgType arg index out of bounds",3445 cases.add(
3446 "@ArgType arg index out of bounds",
2746 \\comptime {3447 \\comptime {
2747 \\ _ = @ArgType(@typeOf(add), 2);3448 \\ _ = @ArgType(@typeOf(add), 2);
2748 \\}3449 \\}
2749 \\fn add(a: i32, b: i32) i32 { return a + b; }3450 \\fn add(a: i32, b: i32) i32 { return a + b; }
2750 ,3451 ,
2751 ".tmp_source.zig:2:32: error: arg index 2 out of bounds; 'fn(i32, i32) i32' has 2 arguments");3452 ".tmp_source.zig:2:32: error: arg index 2 out of bounds; 'fn(i32, i32) i32' has 2 arguments",
3453 );
27523454
2753 cases.add("@memberType on unsupported type",3455 cases.add(
3456 "@memberType on unsupported type",
2754 \\comptime {3457 \\comptime {
2755 \\ _ = @memberType(i32, 0);3458 \\ _ = @memberType(i32, 0);
2756 \\}3459 \\}
2757 ,3460 ,
2758 ".tmp_source.zig:2:21: error: type 'i32' does not support @memberType");3461 ".tmp_source.zig:2:21: error: type 'i32' does not support @memberType",
3462 );
27593463
2760 cases.add("@memberType on enum",3464 cases.add(
3465 "@memberType on enum",
2761 \\comptime {3466 \\comptime {
2762 \\ _ = @memberType(Foo, 0);3467 \\ _ = @memberType(Foo, 0);
2763 \\}3468 \\}
2764 \\const Foo = enum {A,};3469 \\const Foo = enum {A,};
2765 ,3470 ,
2766 ".tmp_source.zig:2:21: error: type 'Foo' does not support @memberType");3471 ".tmp_source.zig:2:21: error: type 'Foo' does not support @memberType",
3472 );
27673473
2768 cases.add("@memberType struct out of bounds",3474 cases.add(
3475 "@memberType struct out of bounds",
2769 \\comptime {3476 \\comptime {
2770 \\ _ = @memberType(Foo, 0);3477 \\ _ = @memberType(Foo, 0);
2771 \\}3478 \\}
2772 \\const Foo = struct {};3479 \\const Foo = struct {};
2773 ,3480 ,
2774 ".tmp_source.zig:2:26: error: member index 0 out of bounds; 'Foo' has 0 members");3481 ".tmp_source.zig:2:26: error: member index 0 out of bounds; 'Foo' has 0 members",
3482 );
27753483
2776 cases.add("@memberType union out of bounds",3484 cases.add(
3485 "@memberType union out of bounds",
2777 \\comptime {3486 \\comptime {
2778 \\ _ = @memberType(Foo, 1);3487 \\ _ = @memberType(Foo, 1);
2779 \\}3488 \\}
2780 \\const Foo = union {A: void,};3489 \\const Foo = union {A: void,};
2781 ,3490 ,
2782 ".tmp_source.zig:2:26: error: member index 1 out of bounds; 'Foo' has 1 members");3491 ".tmp_source.zig:2:26: error: member index 1 out of bounds; 'Foo' has 1 members",
3492 );
27833493
2784 cases.add("@memberName on unsupported type",3494 cases.add(
3495 "@memberName on unsupported type",
2785 \\comptime {3496 \\comptime {
2786 \\ _ = @memberName(i32, 0);3497 \\ _ = @memberName(i32, 0);
2787 \\}3498 \\}
2788 ,3499 ,
2789 ".tmp_source.zig:2:21: error: type 'i32' does not support @memberName");3500 ".tmp_source.zig:2:21: error: type 'i32' does not support @memberName",
3501 );
27903502
2791 cases.add("@memberName struct out of bounds",3503 cases.add(
3504 "@memberName struct out of bounds",
2792 \\comptime {3505 \\comptime {
2793 \\ _ = @memberName(Foo, 0);3506 \\ _ = @memberName(Foo, 0);
2794 \\}3507 \\}
2795 \\const Foo = struct {};3508 \\const Foo = struct {};
2796 ,3509 ,
2797 ".tmp_source.zig:2:26: error: member index 0 out of bounds; 'Foo' has 0 members");3510 ".tmp_source.zig:2:26: error: member index 0 out of bounds; 'Foo' has 0 members",
3511 );
27983512
2799 cases.add("@memberName enum out of bounds",3513 cases.add(
3514 "@memberName enum out of bounds",
2800 \\comptime {3515 \\comptime {
2801 \\ _ = @memberName(Foo, 1);3516 \\ _ = @memberName(Foo, 1);
2802 \\}3517 \\}
2803 \\const Foo = enum {A,};3518 \\const Foo = enum {A,};
2804 ,3519 ,
2805 ".tmp_source.zig:2:26: error: member index 1 out of bounds; 'Foo' has 1 members");3520 ".tmp_source.zig:2:26: error: member index 1 out of bounds; 'Foo' has 1 members",
3521 );
28063522
2807 cases.add("@memberName union out of bounds",3523 cases.add(
3524 "@memberName union out of bounds",
2808 \\comptime {3525 \\comptime {
2809 \\ _ = @memberName(Foo, 1);3526 \\ _ = @memberName(Foo, 1);
2810 \\}3527 \\}
2811 \\const Foo = union {A:i32,};3528 \\const Foo = union {A:i32,};
2812 ,3529 ,
2813 ".tmp_source.zig:2:26: error: member index 1 out of bounds; 'Foo' has 1 members");3530 ".tmp_source.zig:2:26: error: member index 1 out of bounds; 'Foo' has 1 members",
3531 );
28143532
2815 cases.add("calling var args extern function, passing array instead of pointer",3533 cases.add(
3534 "calling var args extern function, passing array instead of pointer",
2816 \\export fn entry() void {3535 \\export fn entry() void {
2817 \\ foo("hello");3536 \\ foo("hello",);
2818 \\}3537 \\}
2819 \\pub extern fn foo(format: &const u8, ...) void;3538 \\pub extern fn foo(format: &const u8, ...) void;
2820 ,3539 ,
2821 ".tmp_source.zig:2:9: error: expected type '&const u8', found '[5]u8'");3540 ".tmp_source.zig:2:9: error: expected type '&const u8', found '[5]u8'",
3541 );
28223542
2823 cases.add("constant inside comptime function has compile error",3543 cases.add(
3544 "constant inside comptime function has compile error",
2824 \\const ContextAllocator = MemoryPool(usize);3545 \\const ContextAllocator = MemoryPool(usize);
2825 \\3546 \\
2826 \\pub fn MemoryPool(comptime T: type) type {3547 \\pub fn MemoryPool(comptime T: type) type {
2827 \\ const free_list_t = @compileError("aoeu");3548 \\ const free_list_t = @compileError("aoeu",);
2828 \\3549 \\
2829 \\ return struct {3550 \\ return struct {
2830 \\ free_list: free_list_t,3551 \\ free_list: free_list_t,
...@@ -2837,9 +3558,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2837,9 +3558,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2837 ,3558 ,
2838 ".tmp_source.zig:4:25: error: aoeu",3559 ".tmp_source.zig:4:25: error: aoeu",
2839 ".tmp_source.zig:1:36: note: called from here",3560 ".tmp_source.zig:1:36: note: called from here",
2840 ".tmp_source.zig:12:20: note: referenced here");3561 ".tmp_source.zig:12:20: note: referenced here",
3562 );
28413563
2842 cases.add("specify enum tag type that is too small",3564 cases.add(
3565 "specify enum tag type that is too small",
2843 \\const Small = enum (u2) {3566 \\const Small = enum (u2) {
2844 \\ One,3567 \\ One,
2845 \\ Two,3568 \\ Two,
...@@ -2852,9 +3575,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2852,9 +3575,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2852 \\ var x = Small.One;3575 \\ var x = Small.One;
2853 \\}3576 \\}
2854 ,3577 ,
2855 ".tmp_source.zig:1:20: error: 'u2' too small to hold all bits; must be at least 'u3'");3578 ".tmp_source.zig:1:20: error: 'u2' too small to hold all bits; must be at least 'u3'",
3579 );
28563580
2857 cases.add("specify non-integer enum tag type",3581 cases.add(
3582 "specify non-integer enum tag type",
2858 \\const Small = enum (f32) {3583 \\const Small = enum (f32) {
2859 \\ One,3584 \\ One,
2860 \\ Two,3585 \\ Two,
...@@ -2865,9 +3590,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2865,9 +3590,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2865 \\ var x = Small.One;3590 \\ var x = Small.One;
2866 \\}3591 \\}
2867 ,3592 ,
2868 ".tmp_source.zig:1:20: error: expected integer, found 'f32'");3593 ".tmp_source.zig:1:20: error: expected integer, found 'f32'",
3594 );
28693595
2870 cases.add("implicitly casting enum to tag type",3596 cases.add(
3597 "implicitly casting enum to tag type",
2871 \\const Small = enum(u2) {3598 \\const Small = enum(u2) {
2872 \\ One,3599 \\ One,
2873 \\ Two,3600 \\ Two,
...@@ -2879,9 +3606,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2879,9 +3606,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2879 \\ var x: u2 = Small.Two;3606 \\ var x: u2 = Small.Two;
2880 \\}3607 \\}
2881 ,3608 ,
2882 ".tmp_source.zig:9:22: error: expected type 'u2', found 'Small'");3609 ".tmp_source.zig:9:22: error: expected type 'u2', found 'Small'",
3610 );
28833611
2884 cases.add("explicitly casting enum to non tag type",3612 cases.add(
3613 "explicitly casting enum to non tag type",
2885 \\const Small = enum(u2) {3614 \\const Small = enum(u2) {
2886 \\ One,3615 \\ One,
2887 \\ Two,3616 \\ Two,
...@@ -2893,9 +3622,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2893,9 +3622,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2893 \\ var x = u3(Small.Two);3622 \\ var x = u3(Small.Two);
2894 \\}3623 \\}
2895 ,3624 ,
2896 ".tmp_source.zig:9:15: error: enum to integer cast to 'u3' instead of its tag type, 'u2'");3625 ".tmp_source.zig:9:15: error: enum to integer cast to 'u3' instead of its tag type, 'u2'",
3626 );
28973627
2898 cases.add("explicitly casting non tag type to enum",3628 cases.add(
3629 "explicitly casting non tag type to enum",
2899 \\const Small = enum(u2) {3630 \\const Small = enum(u2) {
2900 \\ One,3631 \\ One,
2901 \\ Two,3632 \\ Two,
...@@ -2908,9 +3639,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2908,9 +3639,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2908 \\ var x = Small(y);3639 \\ var x = Small(y);
2909 \\}3640 \\}
2910 ,3641 ,
2911 ".tmp_source.zig:10:18: error: integer to enum cast from 'u3' instead of its tag type, 'u2'");3642 ".tmp_source.zig:10:18: error: integer to enum cast from 'u3' instead of its tag type, 'u2'",
3643 );
29123644
2913 cases.add("non unsigned integer enum tag type",3645 cases.add(
3646 "non unsigned integer enum tag type",
2914 \\const Small = enum(i2) {3647 \\const Small = enum(i2) {
2915 \\ One,3648 \\ One,
2916 \\ Two,3649 \\ Two,
...@@ -2922,9 +3655,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2922,9 +3655,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2922 \\ var y = Small.Two;3655 \\ var y = Small.Two;
2923 \\}3656 \\}
2924 ,3657 ,
2925 ".tmp_source.zig:1:19: error: expected unsigned integer, found 'i2'");3658 ".tmp_source.zig:1:19: error: expected unsigned integer, found 'i2'",
3659 );
29263660
2927 cases.add("struct fields with value assignments",3661 cases.add(
3662 "struct fields with value assignments",
2928 \\const MultipleChoice = struct {3663 \\const MultipleChoice = struct {
2929 \\ A: i32 = 20,3664 \\ A: i32 = 20,
2930 \\};3665 \\};
...@@ -2932,9 +3667,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2932,9 +3667,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2932 \\ var x: MultipleChoice = undefined;3667 \\ var x: MultipleChoice = undefined;
2933 \\}3668 \\}
2934 ,3669 ,
2935 ".tmp_source.zig:2:14: error: enums, not structs, support field assignment");3670 ".tmp_source.zig:2:14: error: enums, not structs, support field assignment",
3671 );
29363672
2937 cases.add("union fields with value assignments",3673 cases.add(
3674 "union fields with value assignments",
2938 \\const MultipleChoice = union {3675 \\const MultipleChoice = union {
2939 \\ A: i32 = 20,3676 \\ A: i32 = 20,
2940 \\};3677 \\};
...@@ -2943,25 +3680,31 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2943,25 +3680,31 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2943 \\}3680 \\}
2944 ,3681 ,
2945 ".tmp_source.zig:2:14: error: non-enum union field assignment",3682 ".tmp_source.zig:2:14: error: non-enum union field assignment",
2946 ".tmp_source.zig:1:24: note: consider 'union(enum)' here");3683 ".tmp_source.zig:1:24: note: consider 'union(enum)' here",
3684 );
29473685
2948 cases.add("enum with 0 fields",3686 cases.add(
3687 "enum with 0 fields",
2949 \\const Foo = enum {};3688 \\const Foo = enum {};
2950 \\export fn entry() usize {3689 \\export fn entry() usize {
2951 \\ return @sizeOf(Foo);3690 \\ return @sizeOf(Foo);
2952 \\}3691 \\}
2953 ,3692 ,
2954 ".tmp_source.zig:1:13: error: enums must have 1 or more fields");3693 ".tmp_source.zig:1:13: error: enums must have 1 or more fields",
3694 );
29553695
2956 cases.add("union with 0 fields",3696 cases.add(
3697 "union with 0 fields",
2957 \\const Foo = union {};3698 \\const Foo = union {};
2958 \\export fn entry() usize {3699 \\export fn entry() usize {
2959 \\ return @sizeOf(Foo);3700 \\ return @sizeOf(Foo);
2960 \\}3701 \\}
2961 ,3702 ,
2962 ".tmp_source.zig:1:13: error: unions must have 1 or more fields");3703 ".tmp_source.zig:1:13: error: unions must have 1 or more fields",
3704 );
29633705
2964 cases.add("enum value already taken",3706 cases.add(
3707 "enum value already taken",
2965 \\const MultipleChoice = enum(u32) {3708 \\const MultipleChoice = enum(u32) {
2966 \\ A = 20,3709 \\ A = 20,
2967 \\ B = 40,3710 \\ B = 40,
...@@ -2974,9 +3717,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2974,9 +3717,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2974 \\}3717 \\}
2975 ,3718 ,
2976 ".tmp_source.zig:6:9: error: enum tag value 60 already taken",3719 ".tmp_source.zig:6:9: error: enum tag value 60 already taken",
2977 ".tmp_source.zig:4:9: note: other occurrence here");3720 ".tmp_source.zig:4:9: note: other occurrence here",
3721 );
29783722
2979 cases.add("union with specified enum omits field",3723 cases.add(
3724 "union with specified enum omits field",
2980 \\const Letter = enum {3725 \\const Letter = enum {
2981 \\ A,3726 \\ A,
2982 \\ B,3727 \\ B,
...@@ -2991,9 +3736,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -2991,9 +3736,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
2991 \\}3736 \\}
2992 ,3737 ,
2993 ".tmp_source.zig:6:17: error: enum field missing: 'C'",3738 ".tmp_source.zig:6:17: error: enum field missing: 'C'",
2994 ".tmp_source.zig:4:5: note: declared here");3739 ".tmp_source.zig:4:5: note: declared here",
3740 );
29953741
2996 cases.add("@TagType when union has no attached enum",3742 cases.add(
3743 "@TagType when union has no attached enum",
2997 \\const Foo = union {3744 \\const Foo = union {
2998 \\ A: i32,3745 \\ A: i32,
2999 \\};3746 \\};
...@@ -3002,9 +3749,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -3002,9 +3749,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
3002 \\}3749 \\}
3003 ,3750 ,
3004 ".tmp_source.zig:5:24: error: union 'Foo' has no tag",3751 ".tmp_source.zig:5:24: error: union 'Foo' has no tag",
3005 ".tmp_source.zig:1:13: note: consider 'union(enum)' here");3752 ".tmp_source.zig:1:13: note: consider 'union(enum)' here",
3753 );
30063754
3007 cases.add("non-integer tag type to automatic union enum",3755 cases.add(
3756 "non-integer tag type to automatic union enum",
3008 \\const Foo = union(enum(f32)) {3757 \\const Foo = union(enum(f32)) {
3009 \\ A: i32,3758 \\ A: i32,
3010 \\};3759 \\};
...@@ -3012,9 +3761,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -3012,9 +3761,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
3012 \\ const x = @TagType(Foo);3761 \\ const x = @TagType(Foo);
3013 \\}3762 \\}
3014 ,3763 ,
3015 ".tmp_source.zig:1:23: error: expected integer tag type, found 'f32'");3764 ".tmp_source.zig:1:23: error: expected integer tag type, found 'f32'",
3765 );
30163766
3017 cases.add("non-enum tag type passed to union",3767 cases.add(
3768 "non-enum tag type passed to union",
3018 \\const Foo = union(u32) {3769 \\const Foo = union(u32) {
3019 \\ A: i32,3770 \\ A: i32,
3020 \\};3771 \\};
...@@ -3022,9 +3773,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -3022,9 +3773,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
3022 \\ const x = @TagType(Foo);3773 \\ const x = @TagType(Foo);
3023 \\}3774 \\}
3024 ,3775 ,
3025 ".tmp_source.zig:1:18: error: expected enum tag type, found 'u32'");3776 ".tmp_source.zig:1:18: error: expected enum tag type, found 'u32'",
3777 );
30263778
3027 cases.add("union auto-enum value already taken",3779 cases.add(
3780 "union auto-enum value already taken",
3028 \\const MultipleChoice = union(enum(u32)) {3781 \\const MultipleChoice = union(enum(u32)) {
3029 \\ A = 20,3782 \\ A = 20,
3030 \\ B = 40,3783 \\ B = 40,
...@@ -3037,9 +3790,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -3037,9 +3790,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
3037 \\}3790 \\}
3038 ,3791 ,
3039 ".tmp_source.zig:6:9: error: enum tag value 60 already taken",3792 ".tmp_source.zig:6:9: error: enum tag value 60 already taken",
3040 ".tmp_source.zig:4:9: note: other occurrence here");3793 ".tmp_source.zig:4:9: note: other occurrence here",
3794 );
30413795
3042 cases.add("union enum field does not match enum",3796 cases.add(
3797 "union enum field does not match enum",
3043 \\const Letter = enum {3798 \\const Letter = enum {
3044 \\ A,3799 \\ A,
3045 \\ B,3800 \\ B,
...@@ -3056,9 +3811,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -3056,9 +3811,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
3056 \\}3811 \\}
3057 ,3812 ,
3058 ".tmp_source.zig:10:5: error: enum field not found: 'D'",3813 ".tmp_source.zig:10:5: error: enum field not found: 'D'",
3059 ".tmp_source.zig:1:16: note: enum declared here");3814 ".tmp_source.zig:1:16: note: enum declared here",
3815 );
30603816
3061 cases.add("field type supplied in an enum",3817 cases.add(
3818 "field type supplied in an enum",
3062 \\const Letter = enum {3819 \\const Letter = enum {
3063 \\ A: void,3820 \\ A: void,
3064 \\ B,3821 \\ B,
...@@ -3069,9 +3826,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -3069,9 +3826,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
3069 \\}3826 \\}
3070 ,3827 ,
3071 ".tmp_source.zig:2:8: error: structs and unions, not enums, support field types",3828 ".tmp_source.zig:2:8: error: structs and unions, not enums, support field types",
3072 ".tmp_source.zig:1:16: note: consider 'union(enum)' here");3829 ".tmp_source.zig:1:16: note: consider 'union(enum)' here",
3830 );
30733831
3074 cases.add("struct field missing type",3832 cases.add(
3833 "struct field missing type",
3075 \\const Letter = struct {3834 \\const Letter = struct {
3076 \\ A,3835 \\ A,
3077 \\};3836 \\};
...@@ -3079,9 +3838,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -3079,9 +3838,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
3079 \\ var a = Letter { .A = {} };3838 \\ var a = Letter { .A = {} };
3080 \\}3839 \\}
3081 ,3840 ,
3082 ".tmp_source.zig:2:5: error: struct field missing type");3841 ".tmp_source.zig:2:5: error: struct field missing type",
3842 );
30833843
3084 cases.add("extern union field missing type",3844 cases.add(
3845 "extern union field missing type",
3085 \\const Letter = extern union {3846 \\const Letter = extern union {
3086 \\ A,3847 \\ A,
3087 \\};3848 \\};
...@@ -3089,9 +3850,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -3089,9 +3850,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
3089 \\ var a = Letter { .A = {} };3850 \\ var a = Letter { .A = {} };
3090 \\}3851 \\}
3091 ,3852 ,
3092 ".tmp_source.zig:2:5: error: union field missing type");3853 ".tmp_source.zig:2:5: error: union field missing type",
3854 );
30933855
3094 cases.add("extern union given enum tag type",3856 cases.add(
3857 "extern union given enum tag type",
3095 \\const Letter = enum {3858 \\const Letter = enum {
3096 \\ A,3859 \\ A,
3097 \\ B,3860 \\ B,
...@@ -3106,9 +3869,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -3106,9 +3869,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
3106 \\ var a = Payload { .A = 1234 };3869 \\ var a = Payload { .A = 1234 };
3107 \\}3870 \\}
3108 ,3871 ,
3109 ".tmp_source.zig:6:29: error: extern union does not support enum tag type");3872 ".tmp_source.zig:6:29: error: extern union does not support enum tag type",
3873 );
31103874
3111 cases.add("packed union given enum tag type",3875 cases.add(
3876 "packed union given enum tag type",
3112 \\const Letter = enum {3877 \\const Letter = enum {
3113 \\ A,3878 \\ A,
3114 \\ B,3879 \\ B,
...@@ -3123,9 +3888,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -3123,9 +3888,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
3123 \\ var a = Payload { .A = 1234 };3888 \\ var a = Payload { .A = 1234 };
3124 \\}3889 \\}
3125 ,3890 ,
3126 ".tmp_source.zig:6:29: error: packed union does not support enum tag type");3891 ".tmp_source.zig:6:29: error: packed union does not support enum tag type",
3892 );
31273893
3128 cases.add("switch on union with no attached enum",3894 cases.add(
3895 "switch on union with no attached enum",
3129 \\const Payload = union {3896 \\const Payload = union {
3130 \\ A: i32,3897 \\ A: i32,
3131 \\ B: f64,3898 \\ B: f64,
...@@ -3143,9 +3910,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -3143,9 +3910,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
3143 \\}3910 \\}
3144 ,3911 ,
3145 ".tmp_source.zig:11:14: error: switch on union which has no attached enum",3912 ".tmp_source.zig:11:14: error: switch on union which has no attached enum",
3146 ".tmp_source.zig:1:17: note: consider 'union(enum)' here");3913 ".tmp_source.zig:1:17: note: consider 'union(enum)' here",
3914 );
31473915
3148 cases.add("enum in field count range but not matching tag",3916 cases.add(
3917 "enum in field count range but not matching tag",
3149 \\const Foo = enum(u32) {3918 \\const Foo = enum(u32) {
3150 \\ A = 10,3919 \\ A = 10,
3151 \\ B = 11,3920 \\ B = 11,
...@@ -3155,9 +3924,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -3155,9 +3924,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
3155 \\}3924 \\}
3156 ,3925 ,
3157 ".tmp_source.zig:6:16: error: enum 'Foo' has no tag matching integer value 0",3926 ".tmp_source.zig:6:16: error: enum 'Foo' has no tag matching integer value 0",
3158 ".tmp_source.zig:1:13: note: 'Foo' declared here");3927 ".tmp_source.zig:1:13: note: 'Foo' declared here",
3928 );
31593929
3160 cases.add("comptime cast enum to union but field has payload",3930 cases.add(
3931 "comptime cast enum to union but field has payload",
3161 \\const Letter = enum { A, B, C };3932 \\const Letter = enum { A, B, C };
3162 \\const Value = union(Letter) {3933 \\const Value = union(Letter) {
3163 \\ A: i32,3934 \\ A: i32,
...@@ -3169,9 +3940,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -3169,9 +3940,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
3169 \\}3940 \\}
3170 ,3941 ,
3171 ".tmp_source.zig:8:26: error: cast to union 'Value' must initialize 'i32' field 'A'",3942 ".tmp_source.zig:8:26: error: cast to union 'Value' must initialize 'i32' field 'A'",
3172 ".tmp_source.zig:3:5: note: field 'A' declared here");3943 ".tmp_source.zig:3:5: note: field 'A' declared here",
3944 );
31733945
3174 cases.add("runtime cast to union which has non-void fields",3946 cases.add(
3947 "runtime cast to union which has non-void fields",
3175 \\const Letter = enum { A, B, C };3948 \\const Letter = enum { A, B, C };
3176 \\const Value = union(Letter) {3949 \\const Value = union(Letter) {
3177 \\ A: i32,3950 \\ A: i32,
...@@ -3186,9 +3959,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -3186,9 +3959,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
3186 \\}3959 \\}
3187 ,3960 ,
3188 ".tmp_source.zig:11:20: error: runtime cast to union 'Value' which has non-void fields",3961 ".tmp_source.zig:11:20: error: runtime cast to union 'Value' which has non-void fields",
3189 ".tmp_source.zig:3:5: note: field 'A' has type 'i32'");3962 ".tmp_source.zig:3:5: note: field 'A' has type 'i32'",
3963 );
31903964
3191 cases.add("self-referencing function pointer field",3965 cases.add(
3966 "self-referencing function pointer field",
3192 \\const S = struct {3967 \\const S = struct {
3193 \\ f: fn(_: S) void,3968 \\ f: fn(_: S) void,
3194 \\};3969 \\};
...@@ -3198,19 +3973,23 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -3198,19 +3973,23 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
3198 \\ var _ = S { .f = f };3973 \\ var _ = S { .f = f };
3199 \\}3974 \\}
3200 ,3975 ,
3201 ".tmp_source.zig:4:9: error: type 'S' is not copyable; cannot pass by value");3976 ".tmp_source.zig:4:9: error: type 'S' is not copyable; cannot pass by value",
3977 );
32023978
3203 cases.add("taking offset of void field in struct",3979 cases.add(
3980 "taking offset of void field in struct",
3204 \\const Empty = struct {3981 \\const Empty = struct {
3205 \\ val: void,3982 \\ val: void,
3206 \\};3983 \\};
3207 \\export fn foo() void {3984 \\export fn foo() void {
3208 \\ const fieldOffset = @offsetOf(Empty, "val");3985 \\ const fieldOffset = @offsetOf(Empty, "val",);
3209 \\}3986 \\}
3210 ,3987 ,
3211 ".tmp_source.zig:5:42: error: zero-bit field 'val' in struct 'Empty' has no offset");3988 ".tmp_source.zig:5:42: error: zero-bit field 'val' in struct 'Empty' has no offset",
3989 );
32123990
3213 cases.add("invalid union field access in comptime",3991 cases.add(
3992 "invalid union field access in comptime",
3214 \\const Foo = union {3993 \\const Foo = union {
3215 \\ Bar: u8,3994 \\ Bar: u8,
3216 \\ Baz: void,3995 \\ Baz: void,
...@@ -3220,21 +3999,26 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {...@@ -3220,21 +3999,26 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
3220 \\ const bar_val = foo.Bar;3999 \\ const bar_val = foo.Bar;
3221 \\}4000 \\}
3222 ,4001 ,
3223 ".tmp_source.zig:7:24: error: accessing union field 'Bar' while field 'Baz' is set");4002 ".tmp_source.zig:7:24: error: accessing union field 'Bar' while field 'Baz' is set",
4003 );
32244004
3225 cases.add("getting return type of generic function",4005 cases.add(
4006 "getting return type of generic function",
3226 \\fn generic(a: var) void {}4007 \\fn generic(a: var) void {}
3227 \\comptime {4008 \\comptime {
3228 \\ _ = @typeOf(generic).ReturnType;4009 \\ _ = @typeOf(generic).ReturnType;
3229 \\}4010 \\}
3230 ,4011 ,
3231 ".tmp_source.zig:3:25: error: ReturnType has not been resolved because 'fn(var)var' is generic");4012 ".tmp_source.zig:3:25: error: ReturnType has not been resolved because 'fn(var)var' is generic",
4013 );
32324014
3233 cases.add("getting @ArgType of generic function",4015 cases.add(
4016 "getting @ArgType of generic function",
3234 \\fn generic(a: var) void {}4017 \\fn generic(a: var) void {}
3235 \\comptime {4018 \\comptime {
3236 \\ _ = @ArgType(@typeOf(generic), 0);4019 \\ _ = @ArgType(@typeOf(generic), 0);
3237 \\}4020 \\}
3238 ,4021 ,
3239 ".tmp_source.zig:3:36: error: @ArgType could not resolve the type of arg 0 because 'fn(var)var' is generic");4022 ".tmp_source.zig:3:36: error: @ArgType could not resolve the type of arg 0 because 'fn(var)var' is generic",
4023 );
3240}4024}
test/gen_h.zig-1
...@@ -76,5 +76,4 @@ pub fn addCases(cases: &tests.GenHContext) void {...@@ -76,5 +76,4 @@ pub fn addCases(cases: &tests.GenHContext) void {
76 \\TEST_EXPORT void entry(struct Foo foo, uint8_t bar[]);76 \\TEST_EXPORT void entry(struct Foo foo, uint8_t bar[]);
77 \\77 \\
78 );78 );
79
80}79}
test/standalone/brace_expansion/main.zig+4-9
...@@ -29,8 +29,7 @@ fn tokenize(input: []const u8) !ArrayList(Token) {...@@ -29,8 +29,7 @@ fn tokenize(input: []const u8) !ArrayList(Token) {
29 for (input) |b, i| {29 for (input) |b, i| {
30 switch (state) {30 switch (state) {
31 State.Start => switch (b) {31 State.Start => switch (b) {
32 'a' ... 'z',32 'a'...'z', 'A'...'Z' => {
33 'A' ... 'Z' => {
34 state = State.Word;33 state = State.Word;
35 tok_begin = i;34 tok_begin = i;
36 },35 },
...@@ -40,11 +39,8 @@ fn tokenize(input: []const u8) !ArrayList(Token) {...@@ -40,11 +39,8 @@ fn tokenize(input: []const u8) !ArrayList(Token) {
40 else => return error.InvalidInput,39 else => return error.InvalidInput,
41 },40 },
42 State.Word => switch (b) {41 State.Word => switch (b) {
43 'a' ... 'z',42 'a'...'z', 'A'...'Z' => {},
44 'A' ... 'Z' => {},43 '{', '}', ',' => {
45 '{',
46 '}',
47 ',' => {
48 try token_list.append(Token{ .Word = input[tok_begin..i] });44 try token_list.append(Token{ .Word = input[tok_begin..i] });
49 switch (b) {45 switch (b) {
50 '{' => try token_list.append(Token.OpenBrace),46 '{' => try token_list.append(Token.OpenBrace),
...@@ -103,8 +99,7 @@ fn parse(tokens: &const ArrayList(Token), token_index: &usize) ParseError!Node {...@@ -103,8 +99,7 @@ fn parse(tokens: &const ArrayList(Token), token_index: &usize) ParseError!Node {
103 };99 };
104100
105 switch (tokens.items[token_index.*]) {101 switch (tokens.items[token_index.*]) {
106 Token.Word,102 Token.Word, Token.OpenBrace => {
107 Token.OpenBrace => {
108 const pair = try global_allocator.alloc(Node, 2);103 const pair = try global_allocator.alloc(Node, 2);
109 pair[0] = result_node;104 pair[0] = result_node;
110 pair[1] = try parse(tokens, token_index);105 pair[1] = try parse(tokens, token_index);
test/standalone/issue_339/test.zig+4-1
...@@ -1,5 +1,8 @@...@@ -1,5 +1,8 @@
1const StackTrace = @import("builtin").StackTrace;1const StackTrace = @import("builtin").StackTrace;
2pub fn panic(msg: []const u8, stack_trace: ?&StackTrace) noreturn { @breakpoint(); while (true) {} }2pub fn panic(msg: []const u8, stack_trace: ?&StackTrace) noreturn {
3 @breakpoint();
4 while (true) {}
5}
36
4fn bar() error!void {}7fn bar() error!void {}
58
test/standalone/pkg_import/pkg.zig+3-1
...@@ -1 +1,3 @@...@@ -1 +1,3 @@
1pub fn add(a: i32, b: i32) i32 { return a + b; }1pub fn add(a: i32, b: i32) i32 {
2 return a + b;
3}
test/standalone/use_alias/main.zig+1-1
...@@ -2,7 +2,7 @@ const c = @import("c.zig");...@@ -2,7 +2,7 @@ const c = @import("c.zig");
2const assert = @import("std").debug.assert;2const assert = @import("std").debug.assert;
33
4test "symbol exists" {4test "symbol exists" {
5 var foo = c.Foo {5 var foo = c.Foo{
6 .a = 1,6 .a = 1,
7 .b = 1,7 .b = 1,
8 };8 };
test/translate_c.zig+24-25
...@@ -638,7 +638,6 @@ pub fn addCases(cases: &tests.TranslateCContext) void {...@@ -638,7 +638,6 @@ pub fn addCases(cases: &tests.TranslateCContext) void {
638 \\}638 \\}
639 );639 );
640640
641
642 cases.addC("c style cast",641 cases.addC("c style cast",
643 \\int float_to_int(float a) {642 \\int float_to_int(float a) {
644 \\ return (int)a;643 \\ return (int)a;
...@@ -1289,29 +1288,29 @@ pub fn addCases(cases: &tests.TranslateCContext) void {...@@ -1289,29 +1288,29 @@ pub fn addCases(cases: &tests.TranslateCContext) void {
1289 \\ }1288 \\ }
1290 \\}1289 \\}
1291 ,1290 ,
1292 \\pub fn switch_fn(i: c_int) c_int {1291 \\pub fn switch_fn(i: c_int) c_int {
1293 \\ var res: c_int = 0;1292 \\ var res: c_int = 0;
1294 \\ __switch: {1293 \\ __switch: {
1295 \\ __case_2: {1294 \\ __case_2: {
1296 \\ __default: {1295 \\ __default: {
1297 \\ __case_1: {1296 \\ __case_1: {
1298 \\ __case_0: {1297 \\ __case_0: {
1299 \\ switch (i) {1298 \\ switch (i) {
1300 \\ 0 => break :__case_0,1299 \\ 0 => break :__case_0,
1301 \\ 1 => break :__case_1,1300 \\ 1 => break :__case_1,
1302 \\ else => break :__default,1301 \\ else => break :__default,
1303 \\ 2 => break :__case_2,1302 \\ 2 => break :__case_2,
1304 \\ }1303 \\ }
1305 \\ }1304 \\ }
1306 \\ res = 1;1305 \\ res = 1;
1307 \\ }1306 \\ }
1308 \\ res = 2;1307 \\ res = 2;
1309 \\ }1308 \\ }
1310 \\ res = (3 * i);1309 \\ res = (3 * i);
1311 \\ break :__switch;1310 \\ break :__switch;
1312 \\ }1311 \\ }
1313 \\ res = 5;1312 \\ res = 5;
1314 \\ }1313 \\ }
1315 \\}1314 \\}
1316 );1315 );
1317}1316}