26 #if defined(__osf__) || defined(__APPLE__)
32 #if defined(AVOID_XKB)
42 #include <QtCore/QEvent>
44 #include <QtCore/QByteRef>
51 void scrolllock_set_off();
52 void scrolllock_set_on();
82 _titleUpdateTimer(new QTimer(this))
182 #define TY_CONSTR(T,A,N) ( ((((int)N) & 0xffff) << 16) | ((((int)A) & 0xff) << 8) | (((int)T) & 0xff) )
184 #define TY_CHR( ) TY_CONSTR(0,0,0)
185 #define TY_CTL(A ) TY_CONSTR(1,A,0)
186 #define TY_ESC(A ) TY_CONSTR(2,A,0)
187 #define TY_ESC_CS(A,B) TY_CONSTR(3,A,B)
188 #define TY_ESC_DE(A ) TY_CONSTR(4,A,0)
189 #define TY_CSI_PS(A,N) TY_CONSTR(5,A,N)
190 #define TY_CSI_PN(A ) TY_CONSTR(6,A,0)
191 #define TY_CSI_PR(A,N) TY_CONSTR(7,A,N)
193 #define TY_VT52(A ) TY_CONSTR(8,A,0)
195 #define TY_CSI_PG(A ) TY_CONSTR(9,A,0)
197 #define TY_CSI_PE(A ) TY_CONSTR(10,A,0)
242 for(i = 0; i < 256; i++)
tbl[ i] = 0;
243 for(i = 0; i < 32; i++)
tbl[ i] |=
CTL;
244 for(i = 32; i < 256; i++)
tbl[ i] |=
CHR;
245 for(s = (quint8*)
"@ABCDGHILMPSTXZcdfry"; *s; s++)
tbl[*s] |=
CPN;
247 for(s = (quint8*)
"t"; *s; s++)
tbl[*s] |=
CPS;
248 for(s = (quint8*)
"0123456789" ; *s; s++)
tbl[*s] |=
DIG;
249 for(s = (quint8*)
"()+*%" ; *s; s++)
tbl[*s] |=
SCS;
250 for(s = (quint8*)
"()+*#[]%" ; *s; s++)
tbl[*s] |=
GRP;
269 #define lec(P,L,C) (p == (P) && s[(L)] == (C))
270 #define lun( ) (p == 1 && cc >= 32 )
271 #define les(P,L,C) (p == (P) && s[L] < 256 && (tbl[s[(L)]] & (C)) == (C))
272 #define eec(C) (p >= 3 && cc == (C))
273 #define ees(C) (p >= 3 && cc < 256 && (tbl[ cc ] & (C)) == (C))
274 #define eps(C) (p >= 3 && s[2] != '?' && s[2] != '!' && s[2] != '>' && cc < 256 && (tbl[ cc ] & (C)) == (C))
275 #define epp( ) (p >= 3 && s[2] == '?' )
276 #define epe( ) (p >= 3 && s[2] == '!' )
277 #define egt( ) (p >= 3 && s[2] == '>' )
278 #define Xpe (ppos>=2 && pbuf[1] == ']' )
279 #define Xte (Xpe && cc == 7 )
280 #define ces(C) ( cc < 256 && (tbl[ cc ] & (C)) == (C) && !Xte)
283 #define CNTL(c) ((c)-'@')
290 if (cc == 127)
return;
308 if (
lec(1,0,
ESC)) {
return; }
310 if (
les(2,1,
GRP)) {
return; }
312 if (
Xpe ) {
return; }
313 if (
lec(3,2,
'?')) {
return; }
314 if (
lec(3,2,
'>')) {
return; }
315 if (
lec(3,2,
'!')) {
return; }
328 for (i=0;i<=
argc;i++)
331 else if (cc ==
'm' &&
argc - i >= 4 && (
argv[i] == 38 ||
argv[i] == 48) &&
argv[i+1] == 2)
337 else if (cc ==
'm' &&
argc - i >= 2 && (
argv[i] == 38 ||
argv[i] == 48) &&
argv[i+1] == 5)
349 if (
lec(2,1,
'Y'))
return;
350 if (
lec(3,1,
'Y'))
return;
358 for (i = 2; i <
ppos &&
'0'<=
pbuf[i] &&
pbuf[i]<
'9' ; i++)
359 arg = 10*arg + (pbuf[i]-
'0');
361 QChar *str =
new QChar[ppos-i-2];
362 for (
int j = 0; j < ppos-i-2; j++) str[j] = pbuf[i+1+j];
363 QString unistr(str,ppos-i-2);
377 while (iter.hasNext()) {
378 int arg = iter.next();
406 int N = (token>>0)&0xff;
407 int A = (token>>8)&0xff;
410 case 0: printf(
"%c", (p < 128) ? p :
'?');
412 case 1:
if (A ==
'J') printf(
"\r");
413 else if (A ==
'M') printf(
"\n");
414 else printf(
"CTL-%c ", (token>>8)&0xff);
416 case 2: printf(
"ESC-%c ", (token>>8)&0xff);
418 case 3: printf(
"ESC_CS-%c-%c ", (token>>8)&0xff, (token>>16)&0xff);
420 case 4: printf(
"ESC_DE-%c ", (token>>8)&0xff);
422 case 5: printf(
"CSI-PS-%c-%d", (token>>8)&0xff, (token>>16)&0xff );
424 case 6: printf(
"CSI-PN-%c [%d]", (token>>8)&0xff, p);
426 case 7: printf(
"CSI-PR-%c-%d", (token>>8)&0xff, (token>>16)&0xff );
428 case 8: printf(
"VT52-%c", (token>>8)&0xff);
430 case 9: printf(
"CSI-PG-%c", (token>>8)&0xff);
432 case 10: printf(
"CSI-PE-%c", (token>>8)&0xff);
444 case TY_CTL(
'@' ) :
break;
445 case TY_CTL(
'A' ) :
break;
446 case TY_CTL(
'B' ) :
break;
447 case TY_CTL(
'C' ) :
break;
448 case TY_CTL(
'D' ) :
break;
450 case TY_CTL(
'F' ) :
break;
463 case TY_CTL(
'P' ) :
break;
464 case TY_CTL(
'Q' ) :
break;
465 case TY_CTL(
'R' ) :
break;
466 case TY_CTL(
'S' ) :
break;
467 case TY_CTL(
'T' ) :
break;
468 case TY_CTL(
'U' ) :
break;
469 case TY_CTL(
'V' ) :
break;
470 case TY_CTL(
'W' ) :
break;
472 case TY_CTL(
'Y' ) :
break;
474 case TY_CTL(
'[' ) :
break;
475 case TY_CTL(
'\\' ) :
break;
476 case TY_CTL(
']' ) :
break;
477 case TY_CTL(
'^' ) :
break;
478 case TY_CTL(
'_' ) :
break;
863 sprintf(tmp,
"\033[%d;1;1;112;112;1;0x",p);
878 #define ANSWER_BACK "" // This is really obsolete VT100 stuff.
905 if ( cx<1 || cy<1 )
return;
908 if (cb >= 4) cb += 0x3c;
914 sprintf(tmp,
"\033[M%c%c%c",cb+0x20,cx+0x20,cy+0x20);
920 #define encodeMode(M,B) BITS(B,getMode(M))
921 #define encodeStat(M,B) BITS(B,((ev->modifiers() & (M)) == (M)))
925 if (!text.isEmpty()) {
926 QKeyEvent event(QEvent::KeyPress,
937 Qt::KeyboardModifiers modifiers =
event->modifiers();
955 QByteArray textToSend;
964 if ( modifiers & Qt::AltModifier && !(wantsAltModifier || wantsAnyModifier)
965 && !event->text().isEmpty() )
967 textToSend.prepend(
"\033");
976 else if ( !entry.
text().isEmpty() )
978 textToSend +=
_codec->fromUnicode(entry.
text(
true,modifiers));
981 textToSend +=
_codec->fromUnicode(event->text());
983 sendData( textToSend.constData() , textToSend.length() );
989 QString translatorError = (
"No keyboard translator available. "
990 "The information needed to convert key presses "
991 "into characters to send to the terminal "
995 receiveData( translatorError.toAscii().constData() , translatorError.count() );
1023 #define CHARSET _charset[_currentScreen==_screen[1]]
1030 if (
CHARSET.pound && c ==
'#' )
return 0xa3;
1045 strncpy(
_charset[scrno].charset,
"BBBB",4);
1208 if ( entry.
text().count() > 0 )
1209 return entry.
text()[0];
1230 for (i = 0; i < len; i++)
1235 if ((s[i]) > 32 && s[i] < 127)
1238 printf(
"\\%04x(hex)",s[i]);
1243 if (
ppos == 0 || (
ppos == 1 && (
pbuf[0] & 0xff) >= 32)) {