about summary refs log tree commit diff stats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rwxr-xr-xapps/mubin418435 -> 418489 bytes
-rw-r--r--apps/mu.subx12
-rw-r--r--apps/tile/environment.mu39
3 files changed, 50 insertions, 1 deletions
diff --git a/apps/mu b/apps/mu
index ff754870..eabf8405 100755
--- a/apps/mu
+++ b/apps/mu
Binary files differdiff --git a/apps/mu.subx b/apps/mu.subx
index 590fa595..5b8418d9 100644
--- a/apps/mu.subx
+++ b/apps/mu.subx
@@ -13500,7 +13500,7 @@ $check-mu-numberlike-output:check-int:
     # if t is an int, return
     (is-simple-mu-type? %esi 1)  # int => eax
     3d/compare-eax-and 0/imm32/false
-    75/jump-if-!= $check-mu-numberlike-output:end/disp8
+    0f 85/jump-if-!= $check-mu-numberlike-output:end/disp32
 $check-mu-numberlike-output:check-float:
     # if t is a float, return
     (is-simple-mu-type? %esi 0xf)  # float => eax
@@ -13516,6 +13516,16 @@ $check-mu-numberlike-output:check-byte:
     (is-simple-mu-type? %esi 8)  # byte => eax
     3d/compare-eax-and 0/imm32/false
     75/jump-if-!= $check-mu-numberlike-output:end/disp8
+$check-mu-numberlike-output:check-code-point:
+    # if t is a code-point, return
+    (is-simple-mu-type? %esi 0xd)  # code-point => eax
+    3d/compare-eax-and 0/imm32/false
+    75/jump-if-!= $check-mu-numberlike-output:end/disp8
+$check-mu-numberlike-output:check-grapheme:
+    # if t is a grapheme, return
+    (is-simple-mu-type? %esi 0xe)  # grapheme => eax
+    3d/compare-eax-and 0/imm32/false
+    75/jump-if-!= $check-mu-numberlike-output:end/disp8
     e9/jump $check-mu-numberlike-output:fail/disp32
 $check-mu-numberlike-output:end:
     # . restore registers
diff --git a/apps/tile/environment.mu b/apps/tile/environment.mu
index 2fa81894..6f648ebb 100644
--- a/apps/tile/environment.mu
+++ b/apps/tile/environment.mu
@@ -416,5 +416,44 @@ fn clear-canvas _env: (addr environment) {
 }
 
 fn real-grapheme? g: grapheme -> result/eax: boolean {
+$real-grapheme?:body: {
+  # if g == newline return true
+  compare g, 0xa
+  {
+    break-if-!=
+    result <- copy 1  # true
+    break $real-grapheme?:body
+  }
+  # if g == tab return true
+  compare g, 9
+  {
+    break-if-!=
+    result <- copy 1  # true
+    break $real-grapheme?:body
+  }
+  # if g < 32 return false
+  compare g, 0x20
+  {
+    break-if->=
+    result <- copy 0  # false
+    break $real-grapheme?:body
+  }
+  # if g <= 255 return true
+  compare g, 0xff
+  {
+    break-if->
+    result <- copy 1  # true
+    break $real-grapheme?:body
+  }
+  # if (g&0xff == Esc) it's an escape sequence
+  and-with g, 0xff
+  compare g, 0x1b  # Esc
+  {
+    break-if-!=
+    result <- copy 0  # false
+    break $real-grapheme?:body
+  }
+  # otherwise return true
   result <- copy 1  # true
 }
+}