Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikdusan/demo.tty
short demo of a virtual TTY (teleprinter) device for Zig with xterm256-color support
https://github.com/mikdusan/demo.tty
Last synced: about 1 month ago
JSON representation
short demo of a virtual TTY (teleprinter) device for Zig with xterm256-color support
- Host: GitHub
- URL: https://github.com/mikdusan/demo.tty
- Owner: mikdusan
- Created: 2020-01-29T04:33:41.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-01-29T05:03:58.000Z (about 5 years ago)
- Last Synced: 2024-11-10T10:39:00.506Z (3 months ago)
- Language: Zig
- Size: 859 KB
- Stars: 4
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# demo.tty
short demo of a virtual TTY (teleprinter) device for Zig with xterm256-color support`zig run example.zig`
- intermixes string formatting with tty primitives
- offers simple indent/dedent push/pop mechanism
- models a set of hues independent of actual color: { hue0, hue1, hue2, info, positive, negative, caution, alert }
- supports a few basic zig types: { `[] const u8`, `bool`, `unsigned-int` }
- formatting is evolving
- lots still to be done![screenshot of example](screenshot/example.png)
#### unstable grammer/wishlist:
```
format_string := *
item := |
maybe_replacement := '{' '{' | '}' '}' |
replacement := '{' [arg_index '/'] [spec] ['!' coercion] '}'
arg_index :=
spec := bool_spec | unsigned_spec | signed_spec | float_spec | string_spec | pointer_spec
coercion := 'bool' | 'unsigned' | 'signed' | 'float' | 'string' | pointer' | 'type'bool_spec := [[fill] align] [width] [bool_style [bool_case]]
unsigned_spec := [[fill] align] [width] [unsigned_style ['p' | 'P'] ['\'' | '_' | ','] [['0'] iwidth]]
signed_spec := [[fill] align] [width] [signed_style ['+'] ['p' | 'P'] ['\'' | '_' | ','] [['0'] iwidth]]
float_spec := [[fill] align] [width] [float_style ['+'] ['p' | 'P'] ['\'' | '_' | ','] [['0'] iwidth] ['.' fwidth]]
string_spec := [[fill] align] [width] [string_style]
pointer_spec := [[fill] align] [width] [pointer_style ['_'] [['0'] iwidth]]
type_spec := [[fill] align] [width] [type_style]fill := not ( '{' | '}' | align )
align := '<' | '>' | '^'
width :=
bool_style := 'e' | 'o' | 'p' | 't' | 'y'
bool_case := 'c' | 'l' | 'u'
unsigned_style := 'b' | 'o' | 'd' | 'x' | 'X'
signed_style := 'b' | 'o' | 'd' | 'x' | 'X'
float_style := 'e' | 'E' | 'f' | 'F' | '%'
string_style := 's'
pointer_style := 'p' | 't' | 'x'
type_style := TODObool_case := 'l', 'u', 'c'
note: positional parameters:
- fill: '*' and arg must be u8 or []const u8
- width, iwidth, fwidth: '*' and arg must be unsigned
```