Changes between Version 10 and Version 11 of StructuredBinaryData


Ignore:
Timestamp:
2012-06-27T22:21:47Z (12 years ago)
Author:
Sean Bartell
Comment:

update to reflect new commits

Legend:

Unmodified
Added
Removed
Modified
  • StructuredBinaryData

    v10 v11  
    128128== Built‐in transforms ==
    129129
    130 These transforms will be implemented in C and included with Bithenge. Note that
     130These transforms are implemented in C and included with Bithenge. Note that
    131131precise names are preferred; scripts can define shorter aliases if necessary.
    132132
    133133||= name =||= input =||= output =||= description =||= example =||
    134 ||uint32le        ||4‐byte blob node ||integer node ||decodes a 4‐byte little‐endian unsigned integer ||  `x"01010000"` becomes `257` ||
    135 ||zero_terminated ||blob node        ||blob node    ||takes bytes up until the first `00` ||  `x"7f0400"` becomes `x"7f04"` ||
    136 ||ascii           ||blob node        ||string       ||decodes some bytes as ASCII characters ||  `x"6869"` becomes `"hi"` ||
    137 ||padded_with_spaces_at_end ||string ||string       ||removes spaces from the end of a string ||  `"README  "` becomes `"README"`
     134||ascii           ||blob node        ||string       ||decodes some bytes as ASCII characters ||  `hex:6869` becomes `"hi"` ||
     135||uint32be        ||4‐byte blob node ||integer node ||decodes a 4‐byte big‐endian unsigned integer ||  `hex:00000201` becomes `513` ||
     136||uint32le        ||4‐byte blob node ||integer node ||decodes a 4‐byte little‐endian unsigned integer ||  `hex:01010000` becomes `257` ||
     137||zero_terminated ||blob node        ||blob node    ||takes bytes up until the first `00` ||  `hex:7f0400` becomes `hex:7f04` ||
    138138
    139139== Basic syntax ==
     
    148148
    149149Transforms can be composed to create a new transform that applies them in
    150 order. The transform `padded_with_spaces_at_end . ascii . zero_terminated`
    151 first removes the 0x00 from the end of the blob, then decodes it as ascii and
    152 removes spaces from the end. Note that the order of composition is consistent
    153 with function composition and nested application in mathematics, and also
    154 consistent with the general idea that data moves from right to left as it is
    155 decoded.
     150order. The transform `ascii <- zero_terminated`
     151first removes the 0x00 from the end of the blob, then decodes it as ascii. Note
     152that the order of composition is consistent with function composition and
     153nested application in mathematics, and also consistent with the general idea
     154that data moves from right to left as it is decoded.
    156155
    157156== Structs ==
     
    168167{{{
    169168transform point = struct {
    170     .x = uint32le;
    171     .y = uint32le;
     169    .x <- uint32le;
     170    .y <- uint32le;
    172171};
    173172
    174173transform labeled_point = struct {
    175     .id = uint32le;
    176     .label = ascii . zero_terminated;
    177     point;
     174    .id <- uint32le;
     175    .label <- ascii <- zero_terminated;
     176    <- point;
    178177};
    179178}}}
    180179
    181 If `labeled_point` is applied to `x"06000000 4100 03000000 08000000"`, the
    182 result is `{"id": 6, "label": "A", "x": 3, "y": 8}`.
     180If `labeled_point` is applied to `hex:0600000041000300000008000000`, the result
     181is `{"id": 6, "label": "A", "x": 3, "y": 8}`.
     182
     183== Using Bithenge ==
     184
     185The Bithenge source code is in `uspace/app/bithenge` and is built along with
     186HelenOS. It can be built for Linux instead with `make -f Makefile.linux`.
     187
     188The program can be run with `bithenge <script file> <source>`. The script file
     189must define a transform called `main`. The source can start with one of the
     190following prefixes:
     191
     192||= Prefix =||= Example =||= Description =||
     193|| file: || file:/textdemo || Read the contents of a file. This is the default if no prefix is used. ||
     194|| block: || block:bd/initrd || Read the contents of a block device. (HelenOS only.) ||
     195|| hex: || hex:01000000 || Use a string of hexadecimal characters to create a blob node. ||
     196
     197There are some example files in `uspace/dist/src/bithenge`.
    183198
    184199== Future features ==