Skip to content
Quentin Glidic edited this page May 18, 2017 · 2 revisions

What?

We need to push script modes to level of feature closer to C plugins.

Why?

To avoid having to create bindings plugins to various languages, even more since we cannot imagine what new languages will be invented in the future.

How?

That’s actually the big question.

We want the format to be easily created from shell scripts, because most script are shell scripts. Then we need enough flexibility to add future features easily, without breaking existing scripts. We need the output to be proper UTF-8

Proposal 1

Using a custom binary-like format.

f 6b urgent f 6b active t 5b test! \0

(Whitespaces are added for visibility)

Here, we have a two field, identified by a letter, followed by their sizes and their content: Using f 6b urgent as an example:

  • f means "flag"
  • 6 is the size, 6 bytes
  • b is there to tell the size string is ended (and is visually nice, 6b means "6 bytes")
  • urgent is the flag value The third field is of type "text" (t). The line is ended by \0.

To auto-detect the usage of this format, the script must send \0 as its very first byte.

A sample bash script:

grab_data | while read line; do
    if is_urgent; then
        echo -ne "f6burgent"
    fi
    echo -ne "t${#line}${line}\0"
done

Proposal 2

Using ASCII separators (values 0x1c to 0x1f).

urgent \x1d active \x1d \x1e test! \x1f

(Whitespaces are added for visibility)

It is a variant of the first one using ASCII separators instead of specifying size.

Proposal 3

Using a metadata footer.

Clone this wiki locally