commit: 1a160b0b9b34760b950afee5763564fff6974359
parent b40273cf90ccc14b17377fb26ef75950cffebe19
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Mon, 18 Sep 2023 06:36:53 +0200
cmd/unicode: Print each rune after it's hex-codepoint
Diffstat:
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/cmd/unicode.ha b/cmd/unicode.ha
@@ -50,17 +50,17 @@ fn table(args: []str) void = {
};
const (cel_width, cel_fmt) = if(max < 0xFFFF) {
- // (1 char, non-break space, 4 hex, 2 space) = 8 chars
- yield (8u16, "{} {:04X} ");
+ // (4 hex, non-break space, 1 char, 2 space) = 8 chars
+ yield (8u16, "{:04X} {} ");
} else {
- // (1 char, non-break space, 8 hex, 2 space) = 12 chars
- yield (12u16, "{} {:08X} ");
+ // (8 hex, non-break space, 1 char, 2 space) = 12 chars
+ yield (12u16, "{:08X} {} ");
};
match(tsize) {
case void =>
for(let c = min; c <= max; c += 1) {
- fmt::printf(cel_fmt, c: rune, c)!;
+ fmt::printf(cel_fmt, c, c: rune)!;
};
fmt::println()!;
case let ts: tty::ttysize =>
@@ -68,7 +68,7 @@ fn table(args: []str) void = {
for(let r = min; r <= max; r += row_width) {
for(let c = r; c < r+row_width && c <= max; c += 1) {
- fmt::printf(cel_fmt, c: rune, c)!;
+ fmt::printf(cel_fmt, c, c: rune)!;
};
fmt::println()!;
};
diff --git a/test-cmd/unicode.t b/test-cmd/unicode.t
@@ -12,7 +12,8 @@
BA
$ ./cmd/unicode 30-50
- 0 0030 1 0031 2 0032 3 0033 4 0034 5 0035 6 0036 7 0037 8 0038 9 0039 : 003A ; 003B < 003C = 003D > 003E ? 003F @ 0040 A 0041 B 0042 C 0043 D 0044 E 0045 F 0046 G 0047 H 0048 I 0049 J 004A K 004B L 004C M 004D N 004E O 004F P 0050
+ 0030 0 0031 1 0032 2 0033 3 0034 4 0035 5 0036 6 0037 7 0038 8 0039 9 003A : 003B ; 003C < 003D = 003E > 003F ? 0040 @ 0041 A 0042 B 0043 C 0044 D 0045 E 0046 F 0047 G 0048 H 0049 I 004A J 004B K 004C L 004D M 004E N 004F O 0050 P
+
$ ./cmd/unicode -n foo
0066
@@ -23,7 +24,7 @@
γεια (no-eol)
$ ./cmd/unicode 2200-22f1
- ∀ 2200 ∁ 2201 ∂ 2202 ∃ 2203 ∄ 2204 ∅ 2205 ∆ 2206 ∇ 2207 ∈ 2208 ∉ 2209 ∊ 220A ∋ 220B ∌ 220C ∍ 220D ∎ 220E ∏ 220F ∐ 2210 ∑ 2211 − 2212 ∓ 2213 ∔ 2214 ∕ 2215 ∖ 2216 ∗ 2217 ∘ 2218 ∙ 2219 √ 221A ∛ 221B ∜ 221C ∝ 221D ∞ 221E ∟ 221F ∠ 2220 ∡ 2221 ∢ 2222 ∣ 2223 ∤ 2224 ∥ 2225 ∦ 2226 ∧ 2227 ∨ 2228 ∩ 2229 ∪ 222A ∫ 222B ∬ 222C ∭ 222D ∮ 222E ∯ 222F ∰ 2230 ∱ 2231 ∲ 2232 ∳ 2233 ∴ 2234 ∵ 2235 ∶ 2236 ∷ 2237 ∸ 2238 ∹ 2239 ∺ 223A ∻ 223B ∼ 223C ∽ 223D ∾ 223E ∿ 223F ≀ 2240 ≁ 2241 ≂ 2242 ≃ 2243 ≄ 2244 ≅ 2245 ≆ 2246 ≇ 2247 ≈ 2248 ≉ 2249 ≊ 224A ≋ 224B ≌ 224C ≍ 224D ≎ 224E ≏ 224F ≐ 2250 ≑ 2251 ≒ 2252 ≓ 2253 ≔ 2254 ≕ 2255 ≖ 2256 ≗ 2257 ≘ 2258 ≙ 2259 ≚ 225A ≛ 225B ≜ 225C ≝ 225D ≞ 225E ≟ 225F ≠ 2260 ≡ 2261 ≢ 2262 ≣ 2263 ≤ 2264 ≥ 2265 ≦ 2266 ≧ 2267 ≨ 2268 ≩ 2269 ≪ 226A ≫ 226B ≬ 226C ≭ 226D ≮ 226E ≯ 226F ≰ 2270 ≱ 2271 ≲ 2272 ≳ 2273 ≴ 2274 ≵ 2275 ≶ 2276 ≷ 2277 ≸ 2278 ≹ 2279 ≺ 227A ≻ 227B ≼ 227C ≽ 227D ≾ 227E ≿ 227F ⊀ 2280 ⊁ 2281 ⊂ 2282 ⊃ 2283 ⊄ 2284 ⊅ 2285 ⊆ 2286 ⊇ 2287 ⊈ 2288 ⊉ 2289 ⊊ 228A ⊋ 228B ⊌ 228C ⊍ 228D ⊎ 228E ⊏ 228F ⊐ 2290 ⊑ 2291 ⊒ 2292 ⊓ 2293 ⊔ 2294 ⊕ 2295 ⊖ 2296 ⊗ 2297 ⊘ 2298 ⊙ 2299 ⊚ 229A ⊛ 229B ⊜ 229C ⊝ 229D ⊞ 229E ⊟ 229F ⊠ 22A0 ⊡ 22A1 ⊢ 22A2 ⊣ 22A3 ⊤ 22A4 ⊥ 22A5 ⊦ 22A6 ⊧ 22A7 ⊨ 22A8 ⊩ 22A9 ⊪ 22AA ⊫ 22AB ⊬ 22AC ⊭ 22AD ⊮ 22AE ⊯ 22AF ⊰ 22B0 ⊱ 22B1 ⊲ 22B2 ⊳ 22B3 ⊴ 22B4 ⊵ 22B5 ⊶ 22B6 ⊷ 22B7 ⊸ 22B8 ⊹ 22B9 ⊺ 22BA ⊻ 22BB ⊼ 22BC ⊽ 22BD ⊾ 22BE ⊿ 22BF ⋀ 22C0 ⋁ 22C1 ⋂ 22C2 ⋃ 22C3 ⋄ 22C4 ⋅ 22C5 ⋆ 22C6 ⋇ 22C7 ⋈ 22C8 ⋉ 22C9 ⋊ 22CA ⋋ 22CB ⋌ 22CC ⋍ 22CD ⋎ 22CE ⋏ 22CF ⋐ 22D0 ⋑ 22D1 ⋒ 22D2 ⋓ 22D3 ⋔ 22D4 ⋕ 22D5 ⋖ 22D6 ⋗ 22D7 ⋘ 22D8 ⋙ 22D9 ⋚ 22DA ⋛ 22DB ⋜ 22DC ⋝ 22DD ⋞ 22DE ⋟ 22DF ⋠ 22E0 ⋡ 22E1 ⋢ 22E2 ⋣ 22E3 ⋤ 22E4 ⋥ 22E5 ⋦ 22E6 ⋧ 22E7 ⋨ 22E8 ⋩ 22E9 ⋪ 22EA ⋫ 22EB ⋬ 22EC ⋭ 22ED ⋮ 22EE ⋯ 22EF ⋰ 22F0 ⋱ 22F1
+ 2200 ∀ 2201 ∁ 2202 ∂ 2203 ∃ 2204 ∄ 2205 ∅ 2206 ∆ 2207 ∇ 2208 ∈ 2209 ∉ 220A ∊ 220B ∋ 220C ∌ 220D ∍ 220E ∎ 220F ∏ 2210 ∐ 2211 ∑ 2212 − 2213 ∓ 2214 ∔ 2215 ∕ 2216 ∖ 2217 ∗ 2218 ∘ 2219 ∙ 221A √ 221B ∛ 221C ∜ 221D ∝ 221E ∞ 221F ∟ 2220 ∠ 2221 ∡ 2222 ∢ 2223 ∣ 2224 ∤ 2225 ∥ 2226 ∦ 2227 ∧ 2228 ∨ 2229 ∩ 222A ∪ 222B ∫ 222C ∬ 222D ∭ 222E ∮ 222F ∯ 2230 ∰ 2231 ∱ 2232 ∲ 2233 ∳ 2234 ∴ 2235 ∵ 2236 ∶ 2237 ∷ 2238 ∸ 2239 ∹ 223A ∺ 223B ∻ 223C ∼ 223D ∽ 223E ∾ 223F ∿ 2240 ≀ 2241 ≁ 2242 ≂ 2243 ≃ 2244 ≄ 2245 ≅ 2246 ≆ 2247 ≇ 2248 ≈ 2249 ≉ 224A ≊ 224B ≋ 224C ≌ 224D ≍ 224E ≎ 224F ≏ 2250 ≐ 2251 ≑ 2252 ≒ 2253 ≓ 2254 ≔ 2255 ≕ 2256 ≖ 2257 ≗ 2258 ≘ 2259 ≙ 225A ≚ 225B ≛ 225C ≜ 225D ≝ 225E ≞ 225F ≟ 2260 ≠ 2261 ≡ 2262 ≢ 2263 ≣ 2264 ≤ 2265 ≥ 2266 ≦ 2267 ≧ 2268 ≨ 2269 ≩ 226A ≪ 226B ≫ 226C ≬ 226D ≭ 226E ≮ 226F ≯ 2270 ≰ 2271 ≱ 2272 ≲ 2273 ≳ 2274 ≴ 2275 ≵ 2276 ≶ 2277 ≷ 2278 ≸ 2279 ≹ 227A ≺ 227B ≻ 227C ≼ 227D ≽ 227E ≾ 227F ≿ 2280 ⊀ 2281 ⊁ 2282 ⊂ 2283 ⊃ 2284 ⊄ 2285 ⊅ 2286 ⊆ 2287 ⊇ 2288 ⊈ 2289 ⊉ 228A ⊊ 228B ⊋ 228C ⊌ 228D ⊍ 228E ⊎ 228F ⊏ 2290 ⊐ 2291 ⊑ 2292 ⊒ 2293 ⊓ 2294 ⊔ 2295 ⊕ 2296 ⊖ 2297 ⊗ 2298 ⊘ 2299 ⊙ 229A ⊚ 229B ⊛ 229C ⊜ 229D ⊝ 229E ⊞ 229F ⊟ 22A0 ⊠ 22A1 ⊡ 22A2 ⊢ 22A3 ⊣ 22A4 ⊤ 22A5 ⊥ 22A6 ⊦ 22A7 ⊧ 22A8 ⊨ 22A9 ⊩ 22AA ⊪ 22AB ⊫ 22AC ⊬ 22AD ⊭ 22AE ⊮ 22AF ⊯ 22B0 ⊰ 22B1 ⊱ 22B2 ⊲ 22B3 ⊳ 22B4 ⊴ 22B5 ⊵ 22B6 ⊶ 22B7 ⊷ 22B8 ⊸ 22B9 ⊹ 22BA ⊺ 22BB ⊻ 22BC ⊼ 22BD ⊽ 22BE ⊾ 22BF ⊿ 22C0 ⋀ 22C1 ⋁ 22C2 ⋂ 22C3 ⋃ 22C4 ⋄ 22C5 ⋅ 22C6 ⋆ 22C7 ⋇ 22C8 ⋈ 22C9 ⋉ 22CA ⋊ 22CB ⋋ 22CC ⋌ 22CD ⋍ 22CE ⋎ 22CF ⋏ 22D0 ⋐ 22D1 ⋑ 22D2 ⋒ 22D3 ⋓ 22D4 ⋔ 22D5 ⋕ 22D6 ⋖ 22D7 ⋗ 22D8 ⋘ 22D9 ⋙ 22DA ⋚ 22DB ⋛ 22DC ⋜ 22DD ⋝ 22DE ⋞ 22DF ⋟ 22E0 ⋠ 22E1 ⋡ 22E2 ⋢ 22E3 ⋣ 22E4 ⋤ 22E5 ⋥ 22E6 ⋦ 22E7 ⋧ 22E8 ⋨ 22E9 ⋩ 22EA ⋪ 22EB ⋫ 22EC ⋬ 22ED ⋭ 22EE ⋮ 22EF ⋯ 22F0 ⋰ 22F1 ⋱
$ ./cmd/unicode -n γεια
03B3