diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-04-10 23:05:16 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-04-10 23:05:16 -0700 |
commit | b0096cd6a694e1ccad19d6b3849bd032af6a4fe9 (patch) | |
tree | fc980956ae69ec47ce2f9c25c2047b811001cb77 /shell/cell.mu | |
parent | f38c2a1502648b0be16fc2e984420886cf64cdee (diff) | |
download | mu-b0096cd6a694e1ccad19d6b3849bd032af6a4fe9.tar.gz |
shell: streams that you can append graphemes to
Diffstat (limited to 'shell/cell.mu')
-rw-r--r-- | shell/cell.mu | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/shell/cell.mu b/shell/cell.mu index 7d04e5db..9cb6ea9e 100644 --- a/shell/cell.mu +++ b/shell/cell.mu @@ -6,7 +6,7 @@ type cell { # type 1: number number-data: float # type 2: symbol - # type 3: string + # type 3: stream text-data: (handle stream byte) # type 4: primitive function index-data: int @@ -14,7 +14,7 @@ type cell { screen-data: (handle screen) # type 6: keyboard keyboard-data: (handle gap-buffer) - # TODO: array, (associative) table, stream + # TODO: array, (associative) table } fn allocate-symbol _out: (addr handle cell) { @@ -40,6 +40,16 @@ fn new-symbol out: (addr handle cell), val: (addr array byte) { initialize-symbol out, val } +fn allocate-stream _out: (addr handle cell) { + var out/eax: (addr handle cell) <- copy _out + allocate out + var out-addr/eax: (addr cell) <- lookup *out + var type/ecx: (addr int) <- get out-addr, type + copy-to *type, 3/stream + var dest-ah/eax: (addr handle stream byte) <- get out-addr, text-data + populate-stream dest-ah, 0x40/max-stream-size +} + fn allocate-number _out: (addr handle cell) { var out/eax: (addr handle cell) <- copy _out allocate out |