diff options
| author | bhgv <bhgv.empire@gmail.com> | 2018-03-01 16:54:45 +0200 |
|---|---|---|
| committer | bhgv <bhgv.empire@gmail.com> | 2018-03-01 16:54:45 +0200 |
| commit | b786f20bbab5a59046aa78a2c6c2a11536497202 (patch) | |
| tree | 0851ecdec889eb9b7ba3751cc04d4f0b474e4a9e /module/format.m | |
inferno-os tree was separated from the inferno-os-android (separated from the Android driver)
Diffstat (limited to 'module/format.m')
| -rw-r--r-- | module/format.m | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/module/format.m b/module/format.m new file mode 100644 index 0000000..1f3bfab --- /dev/null +++ b/module/format.m @@ -0,0 +1,30 @@ +Format: module { + PATH: con "/dis/lib/format.dis"; + Fmtspec: adt { + name: string; + fields: cyclic array of Fmtspec; + }; + Fmt: adt { + kind: int; + fields: cyclic array of Fmt; + }; + Fmtval: adt { + val: ref Sexprs->Sexp; + recs: cyclic array of array of Fmtval; + + text: fn(v: self Fmtval): string; + }; + Fmtfile: adt { + spec: array of Fmtspec; + descr: array of byte; + + new: fn(spec: array of Fmtspec): Fmtfile; + open: fn(f: self Fmtfile, name: string): ref Bufio->Iobuf; + read: fn(f: self Fmtfile, iob: ref Bufio->Iobuf): (array of Fmtval, string); + }; + init: fn(); + spec2se: fn(spec: array of Fmtspec): list of ref Sexprs->Sexp; + spec2fmt: fn(spec: array of Fmtspec): array of Fmt; + se2fmt: fn(spec: array of Fmtspec, se: ref Sexprs->Sexp): (array of Fmt, string); + rec2val: fn(spec: array of Fmtspec, rec: ref Sexprs->Sexp): (array of Fmtval, string); +}; |
