about summary refs log tree commit diff stats
path: root/linux/apps
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-11-09 08:12:11 -0800
committerKartik K. Agaram <vc@akkartik.com>2021-11-09 08:12:11 -0800
commitd253a3182859c7c989449122a60d5f362f19ded0 (patch)
tree7459cddc57f93107fa4cee89d4f0a94dd0f0f131 /linux/apps
parentd1808995b2c6b99749237a29e6ac6477d00ff8f9 (diff)
downloadmu-d253a3182859c7c989449122a60d5f362f19ded0.tar.gz
rename grapheme to code-point-utf8
Longer name, but it doesn't lie. We have no data structure right now for
combining multiple code points. And it makes no sense for the notion of
a grapheme to conflate its Unicode encoding.
Diffstat (limited to 'linux/apps')
-rw-r--r--linux/apps/arith.mu46
-rw-r--r--linux/apps/parse-int.mu2
-rw-r--r--linux/apps/print-file.mu4
-rw-r--r--linux/apps/tui.mu2
4 files changed, 27 insertions, 27 deletions
diff --git a/linux/apps/arith.mu b/linux/apps/arith.mu
index 4393a34c..08b2008d 100644
--- a/linux/apps/arith.mu
+++ b/linux/apps/arith.mu
@@ -33,7 +33,7 @@
 
 fn main -> _/ebx: int {
   enable-keyboard-immediate-mode
-  var look/esi: grapheme <- copy 0  # lookahead
+  var look/esi: code-point-utf8 <- copy 0  # lookahead
   var n/eax: int <- copy 0  # result of each expression
   print-string 0/screen, "press ctrl-c or ctrl-d to exit\n"
   # read-eval-print loop
@@ -55,17 +55,17 @@ fn main -> _/ebx: int {
   return 0
 }
 
-fn simplify -> _/eax: int, _/esi: grapheme {
+fn simplify -> _/eax: int, _/esi: code-point-utf8 {
   # prime the pump
-  var look/esi: grapheme <- get-char
+  var look/esi: code-point-utf8 <- get-char
   # do it
   var result/eax: int <- copy 0
   result, look <- expression look
   return result, look
 }
 
-fn expression _look: grapheme -> _/eax: int, _/esi: grapheme {
-  var look/esi: grapheme <- copy _look
+fn expression _look: code-point-utf8 -> _/eax: int, _/esi: code-point-utf8 {
+  var look/esi: code-point-utf8 <- copy _look
   # read arg
   var result/eax: int <- copy 0
   result, look <- term look
@@ -78,7 +78,7 @@ fn expression _look: grapheme -> _/eax: int, _/esi: grapheme {
       break-if-= $expression:loop
     }
     # read operator
-    var op/ecx: grapheme <- copy 0
+    var op/ecx: code-point-utf8 <- copy 0
     op, look <- operator look
     # read next arg
     var second/edx: int <- copy 0
@@ -109,8 +109,8 @@ fn expression _look: grapheme -> _/eax: int, _/esi: grapheme {
   return result, look
 }
 
-fn term _look: grapheme -> _/eax: int, _/esi: grapheme {
-  var look/esi: grapheme <- copy _look
+fn term _look: code-point-utf8 -> _/eax: int, _/esi: code-point-utf8 {
+  var look/esi: code-point-utf8 <- copy _look
   # read arg
   look <- skip-spaces look
   var result/eax: int <- copy 0
@@ -124,7 +124,7 @@ fn term _look: grapheme -> _/eax: int, _/esi: grapheme {
       break-if-= $term:loop
     }
     # read operator
-    var op/ecx: grapheme <- copy 0
+    var op/ecx: code-point-utf8 <- copy 0
     op, look <- operator look
     # read next arg
     var second/edx: int <- copy 0
@@ -154,8 +154,8 @@ fn term _look: grapheme -> _/eax: int, _/esi: grapheme {
   return result, look
 }
 
-fn factor _look: grapheme -> _/eax: int, _/esi: grapheme {
-  var look/esi: grapheme <- copy _look  # should be a no-op
+fn factor _look: code-point-utf8 -> _/eax: int, _/esi: code-point-utf8 {
+  var look/esi: code-point-utf8 <- copy _look  # should be a no-op
   look <- skip-spaces look
   # if next char is not '(', parse a number
   compare look, 0x28/open-paren
@@ -174,7 +174,7 @@ fn factor _look: grapheme -> _/eax: int, _/esi: grapheme {
   return result, look
 }
 
-fn mul-or-div? c: grapheme -> _/eax: boolean {
+fn mul-or-div? c: code-point-utf8 -> _/eax: boolean {
   compare c, 0x2a/*
   {
     break-if-!=
@@ -188,7 +188,7 @@ fn mul-or-div? c: grapheme -> _/eax: boolean {
   return 0/false
 }
 
-fn add-or-sub? c: grapheme -> _/eax: boolean {
+fn add-or-sub? c: code-point-utf8 -> _/eax: boolean {
   compare c, 0x2b/+
   {
     break-if-!=
@@ -202,14 +202,14 @@ fn add-or-sub? c: grapheme -> _/eax: boolean {
   return 0/false
 }
 
-fn operator _look: grapheme -> _/ecx: grapheme, _/esi: grapheme {
-  var op/ecx: grapheme <- copy _look
-  var look/esi: grapheme <- get-char
+fn operator _look: code-point-utf8 -> _/ecx: code-point-utf8, _/esi: code-point-utf8 {
+  var op/ecx: code-point-utf8 <- copy _look
+  var look/esi: code-point-utf8 <- get-char
   return op, look
 }
 
-fn num _look: grapheme -> _/eax: int, _/esi: grapheme {
-  var look/esi: grapheme <- copy _look
+fn num _look: code-point-utf8 -> _/eax: int, _/esi: code-point-utf8 {
+  var look/esi: code-point-utf8 <- copy _look
   var result/edi: int <- copy 0
   {
     var first-digit/eax: int <- to-decimal-digit look
@@ -234,8 +234,8 @@ fn num _look: grapheme -> _/eax: int, _/esi: grapheme {
   return result, look
 }
 
-fn skip-spaces _look: grapheme -> _/esi: grapheme {
-  var look/esi: grapheme <- copy _look  # should be a no-op
+fn skip-spaces _look: code-point-utf8 -> _/esi: code-point-utf8 {
+  var look/esi: code-point-utf8 <- copy _look  # should be a no-op
   {
     compare look, 0x20
     break-if-!=
@@ -245,9 +245,9 @@ fn skip-spaces _look: grapheme -> _/esi: grapheme {
   return look
 }
 
-fn get-char -> _/esi: grapheme {
-  var look/eax: grapheme <- read-key-from-real-keyboard
-  print-grapheme-to-real-screen look
+fn get-char -> _/esi: code-point-utf8 {
+  var look/eax: code-point-utf8 <- read-key-from-real-keyboard
+  print-code-point-utf8-to-real-screen look
   compare look, 4
   {
     break-if-!=
diff --git a/linux/apps/parse-int.mu b/linux/apps/parse-int.mu
index 0f8c71d1..ccff8d44 100644
--- a/linux/apps/parse-int.mu
+++ b/linux/apps/parse-int.mu
@@ -37,7 +37,7 @@ fn parse-int _in: (addr array byte) -> _/eax: int {
     var tmp/ebx: (addr byte) <- index in, i
     var c/eax: byte <- copy-byte *tmp
     #
-    var g/eax: grapheme <- copy c
+    var g/eax: code-point-utf8 <- copy c
     var digit/eax: int <- to-decimal-digit g
     result <- add digit
     i <- increment
diff --git a/linux/apps/print-file.mu b/linux/apps/print-file.mu
index 75ce2e39..284b805e 100644
--- a/linux/apps/print-file.mu
+++ b/linux/apps/print-file.mu
@@ -30,8 +30,8 @@ fn main _args: (addr array addr array byte) -> _/ebx: int {
       var c/eax: byte <- read-byte-buffered in-addr
       compare c, 0xffffffff/end-of-file
       break-if-=
-      var g/eax: grapheme <- copy c
-      print-grapheme 0/screen, g
+      var g/eax: code-point-utf8 <- copy c
+      print-code-point-utf8 0/screen, g
       loop
     }
   }
diff --git a/linux/apps/tui.mu b/linux/apps/tui.mu
index 4e58b986..f4fc914c 100644
--- a/linux/apps/tui.mu
+++ b/linux/apps/tui.mu
@@ -23,7 +23,7 @@ fn main -> _/ebx: int {
 
   print-string 0/screen, "press a key to see its code: "
   enable-keyboard-immediate-mode
-  var x/eax: grapheme <- read-key-from-real-keyboard
+  var x/eax: code-point-utf8 <- read-key-from-real-keyboard
   enable-keyboard-type-mode
   enable-screen-type-mode
   print-string 0/screen, "You pressed "
/000organization.cc.html?h=hlt&id=3670fb87f6d38c9ba4fcbb1eaa6439b4007a194e'>^
672e3e50 ^




65361948 ^

298f8065 ^
65361948 ^



4690ce81 ^
672e3e50 ^


4690ce81 ^
672e3e50 ^

672e3e50 ^


a654e4ec ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163