Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changes between Version 21 and Version 22 of StructuredBinaryData


Ignore:
Timestamp:
2012-08-08T04:42:00Z (7 years ago)
Author:
Sean Bartell
Comment:

Better expressions implemented

Legend:

Unmodified
Added
Removed
Modified
  • StructuredBinaryData

    v21 v22  
    166166it is decoded.
    167167
     168== Expressions ==
     169
    168170Transforms can have parameters that affect how they decode data:
    169171{{{
     
    176178}}}
    177179When such a transform is used, expressions must be given to calculate its
    178 parameters. Currently, the only possible expressions are parameters given to
    179 the current transform, boolean and integer literals, and previously decoded
    180 fields in the current `struct` or an outer `struct`:
     180parameters. The basic terms used in expressions are parameters given to the
     181current transform, boolean and integer literals, and previously decoded fields
     182in the current `struct` or an outer `struct`:
    181183{{{
    182184transform item(little_endian) = struct {
     
    186188};
    187189}}}
     190You can also use `+`, `-`, `*`, and parentheses as you would expect.
     191
     192Expressions can also be used as transforms themselves, in two ways. First, an
     193expression referring to `in` can be used to decode a value, such as
     194`.num_bytes <- (in * 4) <- uint32le;`. Second, an expression that doesn’t refer
     195to `in` can be used as a transform that takes an empty blob and evaluates the
     196expression: for example, `.num_total <- (.num_short + .num_long);` could be
     197used in a `struct`. In both cases, the parentheses are mandatory.
    188198
    189199== Structs ==
     
    277287   printed instead; Bithenge should not try to look in the `if` when searching
    278288   for `.non_existent`.
    279  Complex expressions:: Expressions that use operators or call transforms.
     289 Complex expressions:: More operators, and expressions that call transforms.
    280290 Better error reporting:: errno.h is intended for system call errors; when
    281291   other errors occur, a more helpful error message should be printed, like