mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-19 08:38:14 +01:00
base38: reassign alphabet and numbers
It changes from " 0-9?a-z" to ".0-9a-z~". The default or placeholder changes from " " to "." so it's now always visible. The wildcard changes from "?" to "~" so it's now sorted last.
This commit is contained in:
1 parent
e12f10eef0
commit
bd42fa7af2
18 files changed
+235
-212
No files matched your search
@@ -36,7 +36,7 @@ func main1() error {
|
||||
args := os.Args
|
||||
if len(args) > 1 {
|
||||
for _, arg := range args[1:] {
|
||||
arg := (strings.ToLower(arg) + " ")[:4]
|
||||
arg := (strings.ToLower(arg) + "....")[:4]
|
||||
if code, ok := base38.Encode(arg); ok {
|
||||
code0 := fmt.Sprintf("0x%06X", code)
|
||||
code1 := fmt.Sprintf("0x%08X", code<<10)
|
||||
|
||||
@@ -255,9 +255,9 @@ const char* g_vbc_names[16] = {
|
||||
};
|
||||
|
||||
const int g_base38_decode[38] = {
|
||||
' ', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '?', //
|
||||
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', //
|
||||
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', //
|
||||
'.', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', //
|
||||
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', //
|
||||
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '~', //
|
||||
};
|
||||
|
||||
const char* //
|
||||
@@ -341,10 +341,10 @@ main1(int argc, char** argv) {
|
||||
|
||||
if (vmajor > 0) {
|
||||
char vmajor_name[5];
|
||||
vmajor_name[0] = '*';
|
||||
vmajor_name[1] = '*';
|
||||
vmajor_name[2] = '*';
|
||||
vmajor_name[3] = '*';
|
||||
vmajor_name[0] = '?';
|
||||
vmajor_name[1] = '?';
|
||||
vmajor_name[2] = '?';
|
||||
vmajor_name[3] = '?';
|
||||
vmajor_name[4] = '\x00';
|
||||
uint32_t m = vmajor;
|
||||
if (m < 38 * 38 * 38 * 38) {
|
||||
@@ -364,7 +364,7 @@ main1(int argc, char** argv) {
|
||||
vmajor_name[3] = g_base38_decode[m3];
|
||||
}
|
||||
|
||||
printf("vmajor=0x%06" PRIX32 ":%s vminor=0x%07" PRIX32 "\n", vmajor,
|
||||
printf("vmajor=0x%06" PRIX32 "=%s vminor=0x%07" PRIX32 "\n", vmajor,
|
||||
vmajor_name, vminor);
|
||||
} else if (vmajor == 0) {
|
||||
printf("vbc=%s vbd=0x%06" PRIX32 "\n", g_vbc_names[vbc & 15], vbd);
|
||||
|
||||
Reference in new issue
Block a user