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/sexprs.m | |
inferno-os tree was separated from the inferno-os-android (separated from the Android driver)
Diffstat (limited to 'module/sexprs.m')
| -rw-r--r-- | module/sexprs.m | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/module/sexprs.m b/module/sexprs.m new file mode 100644 index 0000000..63053d2 --- /dev/null +++ b/module/sexprs.m @@ -0,0 +1,41 @@ +Sexprs: module +{ + PATH: con "/dis/lib/sexprs.dis"; + + Sexp: adt { + pick { + String => + s: string; + hint: string; + Binary => + data: array of byte; + hint: string; + List => + l: cyclic list of ref Sexp; + } + + read: fn[T](b: T): (ref Sexp, string) for { + T => + getb: fn(nil: self T): int; + ungetb: fn(nil: self T): int; + offset: fn(nil: self T): big; + }; + parse: fn(s: string): (ref Sexp, string, string); + unpack: fn(a: array of byte): (ref Sexp, array of byte, string); + text: fn(e: self ref Sexp): string; + packedsize: fn(e: self ref Sexp): int; + pack: fn(e: self ref Sexp): array of byte; + b64text: fn(e: self ref Sexp): string; + + islist: fn(e: self ref Sexp): int; + els: fn(e: self ref Sexp): list of ref Sexp; + op: fn(e: self ref Sexp): string; + args: fn(e: self ref Sexp): list of ref Sexp; + eq: fn(e: self ref Sexp, t: ref Sexp): int; + copy: fn(e: self ref Sexp): ref Sexp; + asdata: fn(e: self ref Sexp): array of byte; + astext: fn(e: self ref Sexp): string; + }; + + init: fn(); +}; |
