4 ms·
Length-prefixed strings would be useful for some file formats. You'd need to be able to pick a size for the length-prefix, such as u8,u16,etc. Also some abilit
by skissane 8y ago
Length-prefixed strings would be useful for some file formats. You'd need to be able to pick a size for the length-prefix, such as u8,u16,etc.
Also some ability to length-prefix the output of a macro might be useful for tag-length-value-like formats.
For Unicode, ability to write out UTF-16 or UTF-32 would be useful, also CESU-8 and Java's Modified UTF-8.
Also, for a challenge, think about how you could write macros to generate ASN.1 formats such as BER. You'd probably need some more smarts in your macro language to handle such a task gracefully.
Also, how does one control the endianness of output? Maybe you need u16le and u16be, or some kind of general endianness modifier.
Output of IEEE floating point might also be useful in some applications.
- childintime 8y ago> Also some ability to length-prefix the output of a macro might be useful for tag-length-value-like formats. Exactly. TLV (tag-length-value) support is really what I expected to see. They are hairy to get right manually.
- thosakwe 8y agoI think you could achieve something like that with a macro. macro tlv_string s begin i32 (get CONSTANT_STRING_TAG_FOO) i32 (len s) str s u8 0 endmacro By the way, there's no `len` command at this point, so that's something I'll have to add in eventually to get something like TLV to work.