source:
mainline/uspace/dist/src/bithenge/cond.bh@
ca22536
Last change on this file since ca22536 was 1c79996, checked in by , 13 years ago | |
---|---|
|
|
File size: 690 bytes |
Rev | Line | |
---|---|---|
[d7c8e39f] | 1 | transform pascal_string = struct { |
[d8bd2ec] | 2 | <- struct { # An inner struct for testing purposes |
3 | .len <- uint8; | |
4 | }; | |
[84e8a70] | 5 | .string <- ascii <- known_length(.len); |
6 | }; | |
7 | ||
[78d3a00] | 8 | transform u32(little_endian) = |
9 | if (little_endian) { | |
10 | uint32le | |
11 | } else { | |
12 | uint32be | |
13 | }; | |
14 | ||
15 | transform item(little_endian, len) = struct { | |
[d8bd2ec] | 16 | .type <- (3 * in + 1) <- u32(little_endian); |
[84e8a70] | 17 | .name <- pascal_string; |
[78d3a00] | 18 | switch (.type) { |
[a66ea217] | 19 | 10: { |
[78d3a00] | 20 | .val <- u32(little_endian); |
21 | }; | |
[a66ea217] | 22 | 11: { |
[78d3a00] | 23 | .text <- ascii <- known_length(len); |
24 | }; | |
25 | else: { | |
26 | .unknown <- known_length(len); | |
27 | }; | |
28 | } | |
[84e8a70] | 29 | }; |
30 | ||
[78d3a00] | 31 | transform main() = struct { |
[d8bd2ec] | 32 | .first_len <- (3); |
33 | .second_len <- (6 - 2); | |
34 | .first_item <- item(true, .first_len); | |
35 | .second_item <- item(false, .second_len); | |
[78d3a00] | 36 | }; |
Note:
See TracBrowser
for help on using the repository browser.