Fix #2673 : allow use of \E(0 to switch to line drawing character set.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38088 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues 2010-08-13 15:19:36 +00:00
parent 78e421e05e
commit 3614af01cd
3 changed files with 359 additions and 6 deletions

View File

@ -44,6 +44,8 @@ extern int gIesTable[]; /* ignore ESC table */
extern int gEscIgnoreTable[]; /* ESC ignore table */
extern int gMbcsTable[]; /* ESC $ */
extern int gLineDrawTable[]; /* ESC ( 0 */
#define DEFAULT -1
#define NPARAM 10 // Max parameters
@ -448,6 +450,30 @@ TermParse::EscParse()
fBuffer->InsertChar(dstbuf, dstLen, fAttr);
break;
case CASE_PRINT_GRA:
/* "Special characters and line drawing" enabled by \E(0 */
switch (c) {
case 'j':
fBuffer->InsertChar("\xE2\x94\x98",3,fAttr);
break;
case 'k':
fBuffer->InsertChar("\xE2\x94\x90",3,fAttr);
break;
case 'l':
fBuffer->InsertChar("\xE2\x94\x8C",3,fAttr);
break;
case 'm':
fBuffer->InsertChar("\xE2\x94\x94",3,fAttr);
break;
case 'q':
break;
case 'x':
break;
default:
fBuffer->InsertChar((char)c, fAttr);
}
break;
case CASE_LF:
fBuffer->InsertLF();
break;
@ -516,13 +542,12 @@ TermParse::EscParse()
break;
case CASE_SCS_STATE:
{
cs96 = 0;
_NextParseChar();
// skip next char
parsestate = groundtable;
if (_NextParseChar() == '0')
parsestate = gLineDrawTable;
else
parsestate = groundtable;
break;
}
case CASE_GROUND_STATE:
/* exit ignore mode */
parsestate = groundtable;

View File

@ -4722,3 +4722,329 @@ CASE_SJIS_INSTRING,
CASE_SJIS_INSTRING,
CASE_SJIS_INSTRING,
};
// #pragma mark Line drawing table
int gLineDrawTable[] =
{
/* NUL SOH STX ETX */
CASE_IGNORE,
CASE_IGNORE,
CASE_IGNORE,
CASE_IGNORE,
/* EOT ENQ ACK BEL */
CASE_IGNORE,
CASE_IGNORE,
CASE_IGNORE,
CASE_BELL,
/* BS HT NL VT */
CASE_BS,
CASE_TAB,
CASE_LF,
CASE_LF, /* CASE_UP*/
/* NP CR SO SI */
CASE_LF, /* CASE_IGNORE*/
CASE_CR,
CASE_SO,
CASE_SI,
/* DLE DC1 DC2 DC3 */
CASE_IGNORE,
CASE_IGNORE,
CASE_IGNORE,
CASE_IGNORE,
/* DC4 NAK SYN ETB */
CASE_IGNORE,
CASE_IGNORE,
CASE_IGNORE,
CASE_IGNORE,
/* CAN EM SUB ESC */
CASE_IGNORE,
CASE_IGNORE,
CASE_IGNORE,
CASE_ESC,
/* FS GS RS US */
CASE_IGNORE,
CASE_IGNORE,
CASE_IGNORE,
CASE_IGNORE,
/* SP ! " # */
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
/* $ % & ' */
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
/* ( ) * + */
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
/* , - . / */
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
/* 0 1 2 3 */
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
/* 4 5 6 7 */
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
/* 8 9 : ; */
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
/* < = > ? */
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
/* @ A B C */
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
/* D E F G */
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
/* H I J K */
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
/* L M N O */
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
/* P Q R S */
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
/* T U V W */
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
/* X Y Z [ */
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
/* \ ] ^ _ */
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
/* ` a b c */
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
/* d e f g */
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
/* h i j k */
CASE_PRINT,
CASE_PRINT,
CASE_PRINT_GRA,
CASE_PRINT_GRA,
/* l m n o */
CASE_PRINT_GRA,
CASE_PRINT_GRA,
CASE_PRINT,
CASE_PRINT,
/* p q r s */
CASE_PRINT,
CASE_PRINT_GRA,
CASE_PRINT,
CASE_PRINT,
/* t u v w */
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
/* x y z { */
CASE_PRINT_GRA,
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
/* | } ~ DEL */
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
CASE_IGNORE,
/* 0x80 0x81 0x82 0x83 */
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
/* 0x84 0x85 0x86 0x87 */
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
/* 0x88 0x89 0x8a 0x8b */
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
/* 0x8c 0x8d 0x8e 0x8f */
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
/* 0x90 0x91 0x92 0x93 */
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
/* 0x94 0x95 0x96 0x97 */
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
/* 0x99 0x99 0x9a 0x9b */
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
/* 0x9c 0x9d 0x9e 0x9f */
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
/* 0xa0 0xa1 0xa2 0xa3 */
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
/* 0xa4 0xa5 0xa6 0xa7 */
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
/* 0xa8 0xa9 0xaa 0xab */
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
/* 0xac 0xad 0xae 0xaf */
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
/* 0xb0 0xb1 0xb2 0xb3 */
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
/* 0xb4 0xb5 0xb6 0xb7 */
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
/* 0xb8 0xb9 0xba 0xbb */
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
/* 0xbc 0xbd 0xbe 0xbf */
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
CASE_UTF8_INSTRING,
/* 0xc0 0xc1 0xc2 0xc3 */
CASE_UTF8_2BYTE,
CASE_UTF8_2BYTE,
CASE_UTF8_2BYTE,
CASE_UTF8_2BYTE,
/* 0xc4 0xc5 0xc6 0xc7 */
CAS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,
/* 0xf4 0xf5 0xf6 0xf7 */
CASE_UTF8_3BYTE,
CASE_UTF8_3BYTE,
CASE_UTF8_3BYTE,
CASE_UTF8_3BYTE,
/* 0xf8 0xf9 0xfa 0xfb */
CASE_UTF8_3BYTE,
CASE_UTF8_3BYTE,
CASE_UTF8_3BYTE,
CASE_UTF8_3BYTE,
/* 0xfc 0xfd 0xfe 0xff */
CASE_UTF8_3BYTE,
CASE_UTF8_3BYTE,
CASE_UTF8_3BYTE,
CASE_UTF8_3BYTE,
};

View File

@ -123,3 +123,5 @@
#define CASE_SU 89 /* scroll screen up */
#define CASE_SD 90 /* scroll screen down */
#define CASE_ECH 91 /* erase characters */
#define CASE_PRINT_GRA 92