make ord() result unsigned int; add asc() which is:

• not designed to be emitted, only used in comparisons with
  other asc() results
• on EBCDIC platforms, the mapping of an EBCDIC octet to their
  corresponding ASCII or Unicode/UCS-4 codepoint or, if there
  is no mapping, a distinct value above all valid Unicode codepoints
• on nōn-EBCDIC platforms, just the identity mapping of the input
  octet into their ord() value

Intended use are ASCII-ish character ops, including ranges (“A-Z”),
mapping from those to the corresponding digit offset, and sorting
of things in an ASCIIbetical way
This commit is contained in:
tg
2017-04-21 19:50:09 +00:00
parent 36ea8e6171
commit e18a509a80
4 changed files with 25 additions and 23 deletions

6
edit.c
View File

@ -28,7 +28,7 @@
#ifndef MKSH_NO_CMDLINE_EDITING
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.322 2017/04/21 19:08:17 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.323 2017/04/21 19:50:06 tg Exp $");
/*
* in later versions we might use libtermcap for this, but since external
@ -3685,7 +3685,7 @@ vi_hook(int ch)
return (1);
cmdlen = 0;
argc1 = 0;
if (ch >= ord('1') && ch <= ord('9')) {
if (ksh_isdigit(ch)) {
argc1 = ksh_numdig(ch);
state = VARG1;
} else {
@ -3740,7 +3740,7 @@ vi_hook(int ch)
case VEXTCMD:
argc2 = 0;
if (ch >= ord('1') && ch <= ord('9')) {
if (ksh_isdigit(ch)) {
argc2 = ksh_numdig(ch);
state = VARG2;
return (0);