code wiki / (root) / nx_aesthetic_vocabulary_test.nx

nx_aesthetic_vocabulary_test.nx source

↩ module page · 85 lines · 3118 B

1import "nx_syscalls.nx" 2import "nx_aesthetic_vocabulary.nx" 3 4func main() -> i64 { 5 // T1: INNIE_CLEAN_CLEFT — English variant exists. 6 let en: *u8 = nx_aesthetic_phrase(NX_AES_INNIE_CLEAN_CLEFT, NX_AES_LANG_EN, 0) 7 if en == (0 as *u8) { return 1 } 8 let en_len: i64 = nx_aes_strlen(en) 9 if en_len < 20 { return 2 } 10 11 // T2: 縦スジ in JA variant 0 — UTF-8 bytes. 12 // 縦 = E7 B8 A6 ス = E3 82 B9 ジ = E3 82 B8 = 9 bytes total 13 let ja: *u8 = nx_aesthetic_phrase(NX_AES_INNIE_CLEAN_CLEFT, NX_AES_LANG_JA, 0) 14 if ja == (0 as *u8) { return 10 } 15 let ja_len: i64 = nx_aes_strlen(ja) 16 if ja_len != 9 { return 11 } 17 if ja[0] != 0xe7 { return 12 } 18 if ja[1] != 0xb8 { return 13 } 19 if ja[2] != 0xa6 { return 14 } 20 21 // T3: 土手まん in JA variant 2 — 12 bytes. 22 let ja2: *u8 = nx_aesthetic_phrase(NX_AES_INNIE_CLEAN_CLEFT, NX_AES_LANG_JA, 2) 23 if ja2 == (0 as *u8) { return 20 } 24 // 土 = E5 9C 9F 25 if ja2[0] != 0xe5 { return 21 } 26 if ja2[1] != 0x9c { return 22 } 27 if ja2[2] != 0x9f { return 23 } 28 29 // T4: Korean 깨끗한 보지 in KO variant 0. 30 let ko: *u8 = nx_aesthetic_phrase(NX_AES_INNIE_CLEAN_CLEFT, NX_AES_LANG_KO, 0) 31 if ko == (0 as *u8) { return 30 } 32 // 깨 = EA B9 A8 33 if ko[0] != 0xea { return 31 } 34 35 // T5: Chinese 一线天 in ZH variant 0. 36 let zh: *u8 = nx_aesthetic_phrase(NX_AES_INNIE_CLEAN_CLEFT, NX_AES_LANG_ZH_CN, 0) 37 if zh == (0 as *u8) { return 40 } 38 // 一 = E4 B8 80 39 if zh[0] != 0xe4 { return 41 } 40 if zh[1] != 0xb8 { return 42 } 41 if zh[2] != 0x80 { return 43 } 42 43 // T6: HAIRLESS_VULVA JA = パイパン 44 let pp: *u8 = nx_aesthetic_phrase(NX_AES_HAIRLESS_VULVA, NX_AES_LANG_JA, 0) 45 if pp == (0 as *u8) { return 50 } 46 // パ = E3 83 91 47 if pp[0] != 0xe3 { return 51 } 48 if pp[1] != 0x83 { return 52 } 49 if pp[2] != 0x91 { return 53 } 50 51 // T7: HEART_SHAPED_ASS JA = 桃尻 52 let pa: *u8 = nx_aesthetic_phrase(NX_AES_HEART_SHAPED_ASS, NX_AES_LANG_JA, 0) 53 if pa == (0 as *u8) { return 60 } 54 // 桃 = E6 A1 83 55 if pa[0] != 0xe6 { return 61 } 56 57 // T8: HOURGLASS_WAIST JA = くびれ 58 let kw: *u8 = nx_aesthetic_phrase(NX_AES_HOURGLASS_WAIST, NX_AES_LANG_JA, 0) 59 if kw == (0 as *u8) { return 70 } 60 // く = E3 81 8F 61 if kw[0] != 0xe3 { return 71 } 62 63 // T9: Composer emits all variants for INNIE_CLEAN_CLEFT 64 let buf: *u8 = sys_mmap(2048) 65 let n: i64 = nx_aesthetic_compose(NX_AES_INNIE_CLEAN_CLEFT, buf, 2048) 66 if n < 80 { return 80 } 67 // Verify buf contains the 縦 byte sequence (E7 B8 A6). 68 var found_ja: i64 = 0 69 var i: i64 = 0 70 while i < n - 2 { 71 if buf[i] == 0xe7 { if buf[i + 1] == 0xb8 { if buf[i + 2] == 0xa6 { found_ja = 1 } } } 72 i = i + 1 73 } 74 if found_ja != 1 { return 81 } 75 // Verify buf contains the 一 byte sequence (E4 B8 80) — Chinese variant present. 76 var found_zh: i64 = 0 77 i = 0 78 while i < n - 2 { 79 if buf[i] == 0xe4 { if buf[i + 1] == 0xb8 { if buf[i + 2] == 0x80 { found_zh = 1 } } } 80 i = i + 1 81 } 82 if found_zh != 1 { return 82 } 83 84 return 0 85}