Changeset d8bd2ec in mainline for uspace/dist/src/bithenge/test.bh


Ignore:
Timestamp:
2012-08-08T04:13:53Z (11 years ago)
Author:
Sean Bartell <wingedtachikoma@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade
Children:
0b60d2d, 20e95be
Parents:
a66ea217
Message:

Bithenge: add syntax for inputless transforms

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/dist/src/bithenge/test.bh

    ra66ea217 rd8bd2ec  
    1 transform length = struct {
    2         .len <- uint8;
    3 };
    4 
    51transform pascal_string = struct {
    6         <- length;
     2        <- struct { # An inner struct for testing purposes
     3                .len <- uint8;
     4        };
    75        .string <- ascii <- known_length(.len);
    86};
     
    1614
    1715transform item(little_endian, len) = struct {
    18         .type <- (3*in+1) <- u32(little_endian);
     16        .type <- (3 * in + 1) <- u32(little_endian);
    1917        .name <- pascal_string;
    2018        switch (.type) {
     
    3230
    3331transform main() = struct {
    34         .first_item <- item(true, 3);
    35         .second_item <- item(false, 4);
     32        .first_len <- (3);
     33        .second_len <- (6 - 2);
     34        .first_item <- item(true, .first_len);
     35        .second_item <- item(false, .second_len);
    3636};
Note: See TracChangeset for help on using the changeset viewer.