Skip to content

Commit 90f2ba9

Browse files
alexcrichtonsunfishcode
authored andcommitted
Implement enums in terms of Variant
1 parent a58d9b7 commit 90f2ba9

File tree

17 files changed

+179
-194
lines changed

17 files changed

+179
-194
lines changed

phases/ephemeral/docs.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ Size: 8
2222

2323
Alignment: 8
2424

25-
## <a href="#clockid" name="clockid"></a> `clockid`: Enum(`u32`)
25+
## <a href="#clockid" name="clockid"></a> `clockid`: Variant
2626
Identifiers for clocks.
2727

2828
Size: 4
2929

3030
Alignment: 4
3131

32-
### Variants
32+
### Variant cases
3333
- <a href="#clockid.realtime" name="clockid.realtime"></a> `realtime`
3434
The clock measuring real time. Time value zero corresponds with
3535
1970-01-01T00:00:00Z.
@@ -40,7 +40,7 @@ real time, whose value cannot be adjusted and which cannot have negative
4040
clock jumps. The epoch of this clock is undefined. The absolute time
4141
value of this clock therefore has no meaning.
4242

43-
## <a href="#errno" name="errno"></a> `errno`: Enum(`u16`)
43+
## <a href="#errno" name="errno"></a> `errno`: Variant
4444
Error codes returned by functions.
4545
Not all of these error codes are returned by the functions provided by this
4646
API; some are used in higher-level library layers, and others are provided
@@ -50,7 +50,7 @@ Size: 2
5050

5151
Alignment: 2
5252

53-
### Variants
53+
### Variant cases
5454
- <a href="#errno.success" name="errno.success"></a> `success`
5555
No error occurred. System call completed successfully.
5656

@@ -463,14 +463,14 @@ Size: 8
463463

464464
Alignment: 8
465465

466-
## <a href="#whence" name="whence"></a> `whence`: Enum(`u8`)
466+
## <a href="#whence" name="whence"></a> `whence`: Variant
467467
The position relative to which to set the offset of the file descriptor.
468468

469469
Size: 1
470470

471471
Alignment: 1
472472

473-
### Variants
473+
### Variant cases
474474
- <a href="#whence.set" name="whence.set"></a> `set`
475475
Seek relative to start-of-file.
476476

@@ -501,14 +501,14 @@ Size: 8
501501

502502
Alignment: 8
503503

504-
## <a href="#filetype" name="filetype"></a> `filetype`: Enum(`u8`)
504+
## <a href="#filetype" name="filetype"></a> `filetype`: Variant
505505
The type of a file descriptor or file.
506506

507507
Size: 1
508508

509509
Alignment: 1
510510

511-
### Variants
511+
### Variant cases
512512
- <a href="#filetype.unknown" name="filetype.unknown"></a> `unknown`
513513
The type of the file descriptor or file is unknown or is different from any of the other types specified.
514514

@@ -564,14 +564,14 @@ The length of the name of the directory entry.
564564

565565
Offset: 20
566566

567-
## <a href="#advice" name="advice"></a> `advice`: Enum(`u8`)
567+
## <a href="#advice" name="advice"></a> `advice`: Variant
568568
File or memory access pattern advisory information.
569569

570570
Size: 1
571571

572572
Alignment: 1
573573

574-
### Variants
574+
### Variant cases
575575
- <a href="#advice.normal" name="advice.normal"></a> `normal`
576576
The application has no advice to give on its behavior with respect to the specified data.
577577

@@ -805,14 +805,14 @@ Size: 8
805805

806806
Alignment: 8
807807

808-
## <a href="#eventtype" name="eventtype"></a> `eventtype`: Enum(`u8`)
808+
## <a href="#eventtype" name="eventtype"></a> `eventtype`: Variant
809809
Type of a subscription to an event or its occurrence.
810810

811811
Size: 1
812812

813813
Alignment: 1
814814

815-
### Variants
815+
### Variant cases
816816
- <a href="#eventtype.clock" name="eventtype.clock"></a> `clock`
817817
The time value of clock [`subscription_clock::id`](#subscription_clock.id) has
818818
reached timestamp [`subscription_clock::timeout`](#subscription_clock.timeout).
@@ -1051,14 +1051,14 @@ Disables further receive operations.
10511051
- <a href="#sdflags.wr" name="sdflags.wr"></a> `wr`
10521052
Disables further send operations.
10531053

1054-
## <a href="#preopentype" name="preopentype"></a> `preopentype`: Enum(`u8`)
1054+
## <a href="#preopentype" name="preopentype"></a> `preopentype`: Variant
10551055
Identifiers for preopened capabilities.
10561056

10571057
Size: 1
10581058

10591059
Alignment: 1
10601060

1061-
### Variants
1061+
### Variant cases
10621062
- <a href="#preopentype.dir" name="preopentype.dir"></a> `dir`
10631063
A pre-opened directory.
10641064

phases/ephemeral/witx/typenames.witx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
;;; Identifiers for clocks.
2020
(typename $clockid
21-
(enum u32
21+
(enum (@witx tag u32)
2222
;;; The clock measuring real time. Time value zero corresponds with
2323
;;; 1970-01-01T00:00:00Z.
2424
$realtime
@@ -35,7 +35,7 @@
3535
;;; API; some are used in higher-level library layers, and others are provided
3636
;;; merely for alignment with POSIX.
3737
(typename $errno
38-
(enum u16
38+
(enum (@witx tag u16)
3939
;;; No error occurred. System call completed successfully.
4040
$success
4141
;;; Argument list too long.
@@ -312,7 +312,7 @@
312312

313313
;;; The position relative to which to set the offset of the file descriptor.
314314
(typename $whence
315-
(enum u8
315+
(enum (@witx tag u8)
316316
;;; Seek relative to start-of-file.
317317
$set
318318
;;; Seek relative to current position.
@@ -336,7 +336,7 @@
336336

337337
;;; The type of a file descriptor or file.
338338
(typename $filetype
339-
(enum u8
339+
(enum (@witx tag u8)
340340
;;; The type of the file descriptor or file is unknown or is different from any of the other types specified.
341341
$unknown
342342
;;; The file descriptor or file refers to a block device inode.
@@ -374,7 +374,7 @@
374374

375375
;;; File or memory access pattern advisory information.
376376
(typename $advice
377-
(enum u8
377+
(enum (@witx tag u8)
378378
;;; The application has no advice to give on its behavior with respect to the specified data.
379379
$normal
380380
;;; The application expects to access the specified data sequentially from lower offsets to higher offsets.
@@ -527,7 +527,7 @@
527527

528528
;;; Type of a subscription to an event or its occurrence.
529529
(typename $eventtype
530-
(enum u8
530+
(enum (@witx tag u8)
531531
;;; The time value of clock `subscription_clock::id` has
532532
;;; reached timestamp `subscription_clock::timeout`.
533533
$clock
@@ -675,7 +675,7 @@
675675

676676
;;; Identifiers for preopened capabilities.
677677
(typename $preopentype
678-
(enum u8
678+
(enum (@witx tag u8)
679679
;;; A pre-opened directory.
680680
$dir
681681
)

phases/old/snapshot_0/docs.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ Size: 8
1919

2020
Alignment: 8
2121

22-
## <a href="#clockid" name="clockid"></a> `clockid`: Enum(`u32`)
22+
## <a href="#clockid" name="clockid"></a> `clockid`: Variant
2323
Identifiers for clocks.
2424

2525
Size: 4
2626

2727
Alignment: 4
2828

29-
### Variants
29+
### Variant cases
3030
- <a href="#clockid.realtime" name="clockid.realtime"></a> `realtime`
3131
The clock measuring real time. Time value zero corresponds with
3232
1970-01-01T00:00:00Z.
@@ -43,7 +43,7 @@ The CPU-time clock associated with the current process.
4343
- <a href="#clockid.thread_cputime_id" name="clockid.thread_cputime_id"></a> `thread_cputime_id`
4444
The CPU-time clock associated with the current thread.
4545

46-
## <a href="#errno" name="errno"></a> `errno`: Enum(`u16`)
46+
## <a href="#errno" name="errno"></a> `errno`: Variant
4747
Error codes returned by functions.
4848
Not all of these error codes are returned by the functions provided by this
4949
API; some are used in higher-level library layers, and others are provided
@@ -53,7 +53,7 @@ Size: 2
5353

5454
Alignment: 2
5555

56-
### Variants
56+
### Variant cases
5757
- <a href="#errno.success" name="errno.success"></a> `success`
5858
No error occurred. System call completed successfully.
5959

@@ -455,14 +455,14 @@ Size: 8
455455

456456
Alignment: 8
457457

458-
## <a href="#whence" name="whence"></a> `whence`: Enum(`u8`)
458+
## <a href="#whence" name="whence"></a> `whence`: Variant
459459
The position relative to which to set the offset of the file descriptor.
460460

461461
Size: 1
462462

463463
Alignment: 1
464464

465-
### Variants
465+
### Variant cases
466466
- <a href="#whence.cur" name="whence.cur"></a> `cur`
467467
Seek relative to current position.
468468

@@ -493,14 +493,14 @@ Size: 8
493493

494494
Alignment: 8
495495

496-
## <a href="#filetype" name="filetype"></a> `filetype`: Enum(`u8`)
496+
## <a href="#filetype" name="filetype"></a> `filetype`: Variant
497497
The type of a file descriptor or file.
498498

499499
Size: 1
500500

501501
Alignment: 1
502502

503-
### Variants
503+
### Variant cases
504504
- <a href="#filetype.unknown" name="filetype.unknown"></a> `unknown`
505505
The type of the file descriptor or file is unknown or is different from any of the other types specified.
506506

@@ -553,14 +553,14 @@ The type of the file referred to by this directory entry.
553553

554554
Offset: 20
555555

556-
## <a href="#advice" name="advice"></a> `advice`: Enum(`u8`)
556+
## <a href="#advice" name="advice"></a> `advice`: Variant
557557
File or memory access pattern advisory information.
558558

559559
Size: 1
560560

561561
Alignment: 1
562562

563-
### Variants
563+
### Variant cases
564564
- <a href="#advice.normal" name="advice.normal"></a> `normal`
565565
The application has no advice to give on its behavior with respect to the specified data.
566566

@@ -755,14 +755,14 @@ Size: 8
755755

756756
Alignment: 8
757757

758-
## <a href="#eventtype" name="eventtype"></a> `eventtype`: Enum(`u8`)
758+
## <a href="#eventtype" name="eventtype"></a> `eventtype`: Variant
759759
Type of a subscription to an event or its occurrence.
760760

761761
Size: 1
762762

763763
Alignment: 1
764764

765-
### Variants
765+
### Variant cases
766766
- <a href="#eventtype.clock" name="eventtype.clock"></a> `clock`
767767
The time value of clock [`subscription_clock::id`](#subscription_clock.id) has
768768
reached timestamp [`subscription_clock::timeout`](#subscription_clock.timeout).
@@ -945,14 +945,14 @@ Size: 4
945945

946946
Alignment: 4
947947

948-
## <a href="#signal" name="signal"></a> `signal`: Enum(`u8`)
948+
## <a href="#signal" name="signal"></a> `signal`: Variant
949949
Signal condition.
950950

951951
Size: 1
952952

953953
Alignment: 1
954954

955-
### Variants
955+
### Variant cases
956956
- <a href="#signal.none" name="signal.none"></a> `none`
957957
No signal. Note that POSIX has special semantics for `kill(pid, 0)`,
958958
so this value is reserved.
@@ -1124,14 +1124,14 @@ Disables further receive operations.
11241124
- <a href="#sdflags.wr" name="sdflags.wr"></a> `wr`
11251125
Disables further send operations.
11261126

1127-
## <a href="#preopentype" name="preopentype"></a> `preopentype`: Enum(`u8`)
1127+
## <a href="#preopentype" name="preopentype"></a> `preopentype`: Variant
11281128
Identifiers for preopened capabilities.
11291129

11301130
Size: 1
11311131

11321132
Alignment: 1
11331133

1134-
### Variants
1134+
### Variant cases
11351135
- <a href="#preopentype.dir" name="preopentype.dir"></a> `dir`
11361136
A pre-opened directory.
11371137

phases/old/snapshot_0/witx/typenames.witx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
;;; Identifiers for clocks.
1717
(typename $clockid
18-
(enum u32
18+
(enum (@witx tag u32)
1919
;;; The clock measuring real time. Time value zero corresponds with
2020
;;; 1970-01-01T00:00:00Z.
2121
$realtime
@@ -36,7 +36,7 @@
3636
;;; API; some are used in higher-level library layers, and others are provided
3737
;;; merely for alignment with POSIX.
3838
(typename $errno
39-
(enum u16
39+
(enum (@witx tag u16)
4040
;;; No error occurred. System call completed successfully.
4141
$success
4242
;;; Argument list too long.
@@ -304,7 +304,7 @@
304304

305305
;;; The position relative to which to set the offset of the file descriptor.
306306
(typename $whence
307-
(enum u8
307+
(enum (@witx tag u8)
308308
;;; Seek relative to current position.
309309
$cur
310310
;;; Seek relative to end-of-file.
@@ -325,7 +325,7 @@
325325

326326
;;; The type of a file descriptor or file.
327327
(typename $filetype
328-
(enum u8
328+
(enum (@witx tag u8)
329329
;;; The type of the file descriptor or file is unknown or is different from any of the other types specified.
330330
$unknown
331331
;;; The file descriptor or file refers to a block device inode.
@@ -361,7 +361,7 @@
361361

362362
;;; File or memory access pattern advisory information.
363363
(typename $advice
364-
(enum u8
364+
(enum (@witx tag u8)
365365
;;; The application has no advice to give on its behavior with respect to the specified data.
366366
$normal
367367
;;; The application expects to access the specified data sequentially from lower offsets to higher offsets.
@@ -481,7 +481,7 @@
481481

482482
;;; Type of a subscription to an event or its occurrence.
483483
(typename $eventtype
484-
(enum u8
484+
(enum (@witx tag u8)
485485
;;; The time value of clock `subscription_clock::id` has
486486
;;; reached timestamp `subscription_clock::timeout`.
487487
$clock
@@ -593,7 +593,7 @@
593593

594594
;;; Signal condition.
595595
(typename $signal
596-
(enum u8
596+
(enum (@witx tag u8)
597597
;;; No signal. Note that POSIX has special semantics for `kill(pid, 0)`,
598598
;;; so this value is reserved.
599599
$none
@@ -724,7 +724,7 @@
724724

725725
;;; Identifiers for preopened capabilities.
726726
(typename $preopentype
727-
(enum u8
727+
(enum (@witx tag u8)
728728
;;; A pre-opened directory.
729729
$dir
730730
)

0 commit comments

Comments
 (0)