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;
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; }
349 if (
lec(2,1,
'Y'))
return;
350 if (
lec(3,1,
'Y'))
return;
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 #if !defined(Q_OS_MAC) 968 textToSend.prepend(
"\033");
978 else if ( !entry.
text().isEmpty() )
980 textToSend +=
_codec->fromUnicode(entry.
text(
true,modifiers));
982 else if (event->key() == Qt::Key_PageUp)
984 textToSend +=
"\033[5~";
986 else if (event->key() == Qt::Key_PageDown)
988 textToSend +=
"\033[6~";
991 textToSend +=
_codec->fromUnicode(event->text());
993 sendData( textToSend.constData() , textToSend.length() );
999 QString translatorError = (
"No keyboard translator available. " 1000 "The information needed to convert key presses " 1001 "into characters to send to the terminal " 1005 receiveData( translatorError.toLatin1().constData() , translatorError.count() );
1033 #define CHARSET _charset[_currentScreen==_screen[1]] 1040 if (
CHARSET.pound &&
c ==
'#' )
return 0xa3;
1055 strncpy(
_charset[scrno].charset,
"BBBB",4);
1218 if ( entry.
text().count() > 0 )
1219 return entry.
text()[0];
1240 for (
i = 0;
i < len;
i++)
1245 if ((
s[
i]) > 32 &&
s[
i] < 127)
1253 if (
ppos == 0 || (
ppos == 1 && (
pbuf[0] & 0xff) >= 32)) {
void changeTabStop(bool set)
Sets or removes a tab stop at the cursor's current column.
void clearToEndOfLine()
Clears from the current cursor position to the end of the line.
void setForeColor(int space, int color)
Sets the cursor's foreground color.
void setAndUseCharset(int n, int cs)
void setCursorY(int y)
Position the cursor on line y.
void clearSelection()
Clears the current selection.
void setBackColor(int space, int color)
Sets the cursor's background color.
Command command() const
Returns the commands associated with this entry.
static void hexdump(int *s, int len)
virtual void resetMode(int mode)
void reset(bool clearScreen=true)
Resets the state of the screen.
void setDefaultMargins()
Resets the scrolling margins back to the top and bottom lines of the screen.
virtual void clearEntireScreen()
Copies the current image into the history and clears the screen.
static const int LINE_DOUBLEWIDTH
Echos the operating system specific erase character.
void reportTerminalType()
void setScreen(int index)
Sets the active screen.
virtual void receiveChar(int cc)
Processes an incoming character.
Vt102Emulation()
Constructs a new emulation.
void Tabulate(int n=1)
Moves the cursor n tab-stops to the right.
void bufferedUpdate()
Schedules an update of attached views.
F77_RET_T const F77_INT & N
States stateMask() const
Returns the state flags which are valid in this entry.
void setCursorYX(int y, int x)
Position the cursor at line y, column x.
void eraseChars(int n)
Erase n characters beginning from the current cursor position.
int getLines()
Return the number of lines.
void reportSecondaryAttributes()
void cursorRight(int n)
Move the cursor to the right by n columns.
void helpAlign()
Fills the entire screen with the letter 'E'.
Base class for terminal emulation back-ends.
#define COLOR_SPACE_DEFAULT
void reportTerminalParms(int p)
QHash< int, QString > _pendingTitleUpdates
void resetCharset(int scrno)
void scan_buffer_report()
void clearToEndOfScreen()
Clear the area of the screen from the current cursor position to the end of the screen.
void setMargins(int top, int bottom)
printf("%s\, nthargout(2, "system", "cmd"))
void resetMode(int mode)
Resets (clears) the specified screen mode.
void backTabulate(int n)
Moves the cursor n tab-stops to the left.
virtual void setImageSize(int lines, int columns)
Change the size of the emulation's image.
void sendData(const char *data, int len)
Emitted when a buffer of data is ready to send to the standard input of the terminal.
void BackSpace()
Moves the cursor one column to the left and erases the character at the new cursor position...
void reportCursorPosition()
numeric fields are padded if necessary Padding is with zeros by default
Indicates that no special state is active.
void Return()
Moves the cursor to the beginning of the current line.
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function t
void setMargins(int topLine, int bottomLine)
Sets the margins for scrolling the screen.
unsigned short vt100_graphics[32]
void NewLine()
Moves the cursor down one line, if the MODE_NewLine mode flag is enabled then the cursor is returned ...
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
void clearEntireScreen()
Clear the whole screen, moving the current screen contents into the history first.
Qt::KeyboardModifiers modifierMask() const
Returns the keyboard modifiers which are valid in this entry.
void programUsesMouseChanged(bool usesMouse)
This is emitted when the program running in the shell indicates whether or not it is interested in mo...
void clearToBeginOfScreen()
Clear the area of the screen from the current cursor position to the start of the screen...
int getCursorY() const
Returns the line which the cursor is positioned on.
void tau(int code, int p, int q)
void clearScreenAndSetColumns(int columnCount)
virtual void sendString(const char *, int length=-1)
void stateSet(int state)
Emitted when the activity state of the emulation is set.
virtual char getErase() const
TODO Document me.
virtual void setMode(int mode)
unsigned short applyCharset(unsigned short c)
bool mode[(MODES_SCREEN+8)]
const QTextCodec * _codec
Entry findEntry(int keyCode, Qt::KeyboardModifiers modifiers, States state=NoState) const
Looks for an entry in this keyboard translator which matches the given key code, keyboard modifiers a...
void setDefaultRendition()
Resets the cursor's color back to the default and sets the character's rendition flags back to the de...
void clearToBeginOfLine()
Clears from the current cursor position to the beginning of the line.
F77_RET_T const F77_INT F77_CMPLX * A
Qt::KeyboardModifiers modifiers() const
Returns a bitwise-OR of the enabled keyboard modifiers associated with this entry.
void deleteLines(int n)
Removes n lines beginning from the current cursor position.
void reverseIndex()
Move the cursor up one line.
virtual void sendKeyEvent(QKeyEvent *)
Indicates that the alternate screen ( typically used by interactive programs such as screen or vim ) ...
Indicates that the terminal is in 'Ansi' mode.
void insertChars(int n)
Insert n blank characters beginning from the current cursor position.
virtual void sendText(const QString &text)
The terminal program has triggered a bell event to get the user's attention.
returns the type of the matrix and caches it for future use Called with more than one the function will not attempt to guess the type if it is still unknown This is useful for debugging purposes The possible matrix types depend on whether the matrix is full or and can be one of the following able sis tem and mark type as unknown tem as the structure of the matrix explicitly gives this(Sparse matrices only) tem code
Indicates that no command is associated with this command sequence.
void titleChanged(int title, const QString &newTitle)
Emitted when the program running in the terminal wishes to update the session's title.
States state() const
Returns a bitwise-OR of the enabled state flags associated with this entry.
T::size_type strlen(const typename T::value_type *str)
void index()
Move the cursor down one line.
void changeTabTextColorRequest(int color)
Requests that the color of the text used to represent the tabs associated with this emulation be chan...
const KeyboardTranslator * _keyTranslator
void restoreMode(int mode)
void setLineProperty(LineProperty property, bool enable)
Sets or clears an attribute of the current line.
void resetRendition(int rendition)
Disables the given rendition flag.
void clearEntireLine()
Clears the whole of the line on which the cursor is currently positioned.
void NextLine()
Moves the cursor down one line and positions it at the beginning of the line.
virtual void sendMouseEvent(int buttons, int column, int line, int eventType)
void insertLines(int n)
Inserts lines beginning from the current cursor position.
Represents an association between a key sequence pressed by the user and the character sequence and c...
void setCodec(const QTextCodec *)
Sets the codec used to decode incoming characters.
virtual void reset()
Resets the state of the terminal.
void deleteChars(int n)
Delete n characters beginning from the current cursor position.
void setCharset(int n, int cs)
void setMode(int mode)
Sets (enables) the specified screen mode.
void clearTabStops()
Clears all the tab stops.
void restoreCursor()
Restores the position and appearence of the cursor.
void restoreMode(int mode)
Restores the state of a screen mode saved by calling saveMode()
void scrollUp(int n)
Scroll the scrolling region of the screen up by n lines.
Indicates that any of the modifier keys is active.
QByteArray text(bool expandWildCards=false, Qt::KeyboardModifiers modifiers=Qt::NoModifier) const
Returns the character sequence associated with this entry, optionally replacing wildcard '*' characte...
void saveCursor()
Saves the current position and appearence (text color and style) of the cursor.
void cursorUp(int n)
Move the cursor up by n lines.
void receiveData(const char *buffer, int len)
Processes an incoming stream of characters.
void cursorDown(int n)
Move the cursor down by n lines.
void ShowCharacter(unsigned short c)
Displays a new character at the current cursor position.
void cursorLeft(int n)
Move the cursor to the left by n columns.
void scrollDown(int n)
Scroll the scrolling region of the screen down by n lines.
#define COLOR_SPACE_SYSTEM
int getCursorX() const
Returns the column which the cursor is positioned at.
void setCursorX(int x)
Position the cursor at column x.
static const int LINE_DOUBLEHEIGHT
QTimer * _titleUpdateTimer