about summary refs log tree commit diff stats
path: root/baremetal/shell/grapheme-stack.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-02-21 16:25:43 -0800
committerKartik K. Agaram <vc@akkartik.com>2021-02-21 16:25:43 -0800
commitd7c7488398474d8310539e850edd0c3de2030d3d (patch)
treeb72ebd948b33adeaa29c841ac3040262842227cc /baremetal/shell/grapheme-stack.mu
parentf173379a75bdfed7e40562dd14031e9052364458 (diff)
downloadmu-d7c7488398474d8310539e850edd0c3de2030d3d.tar.gz
7770 - baremetal/shell: scanning through gap buffer
Diffstat (limited to 'baremetal/shell/grapheme-stack.mu')
-rw-r--r--baremetal/shell/grapheme-stack.mu6
1 files changed, 6 insertions, 0 deletions
diff --git a/baremetal/shell/grapheme-stack.mu b/baremetal/shell/grapheme-stack.mu
index 8a4bbd0a..ad8fbc24 100644
--- a/baremetal/shell/grapheme-stack.mu
+++ b/baremetal/shell/grapheme-stack.mu
@@ -30,6 +30,12 @@ fn grapheme-stack-empty? _self: (addr grapheme-stack) -> _/eax: boolean {
   return 0/false
 }
 
+fn grapheme-stack-length _self: (addr grapheme-stack) -> _/eax: int {
+  var self/esi: (addr grapheme-stack) <- copy _self
+  var top/eax: (addr int) <- get self, top
+  return *top
+}
+
 fn push-grapheme-stack _self: (addr grapheme-stack), _val: grapheme {
   var self/esi: (addr grapheme-stack) <- copy _self
   var top-addr/ecx: (addr int) <- get self, top