forked from Archive/PX4-Autopilot
Add ASCII and VT100 header files
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4541 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
parent
cc5a41a14b
commit
55d55c1e70
|
@ -47,6 +47,9 @@
|
|||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/ascii.h>
|
||||
#include <nuttx/vt100.h>
|
||||
|
||||
#include <apps/readline.h>
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -68,13 +71,6 @@
|
|||
#undef CONFIG_EOL_IS_BOTH_CRLF
|
||||
#define CONFIG_EOL_IS_EITHER_CRLF 1
|
||||
|
||||
/* Some special characters */
|
||||
|
||||
#define BS 0x08 /* Backspace */
|
||||
#define ESC 0x1b /* Escape */
|
||||
#define LBRACKET 0x5b /* Left bracket */
|
||||
#define DEL 0x7f /* DEL */
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
@ -92,7 +88,7 @@
|
|||
****************************************************************************/
|
||||
/* <esc>[K is the VT100 command erases to the end of the line. */
|
||||
|
||||
static const char g_erasetoeol[] = "\033[K";
|
||||
static const char g_erasetoeol[] = VT100_CLEAREOL;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
|
@ -130,13 +126,13 @@ static inline void readline_consoleputc(int ch, int outfd)
|
|||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: readline_consoleputs
|
||||
* Name: readline_consolewrite
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_READLINE_ECHO
|
||||
static inline void readline_consoleputs(FAR const char *str, int outfd)
|
||||
static inline void readline_consolewrite(int outfd, FAR const char *buffer, size_t buflen)
|
||||
{
|
||||
(void)write(outfd, str, strlen(str));
|
||||
(void)write(outfd, buffer, buflen);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -203,7 +199,7 @@ ssize_t readline(FAR char *buf, int buflen, FILE *instream, FILE *outstream)
|
|||
/* <esc>[K is the VT100 command that erases to the end of the line. */
|
||||
|
||||
#ifdef CONFIG_READLINE_ECHO
|
||||
readline_consoleputs(g_erasetoeol, outfd);
|
||||
readline_consolewrite(outfd, g_erasetoeol, sizeof(g_erasetoeol));
|
||||
#endif
|
||||
|
||||
/* Read characters until we have a full line. On each the loop we must
|
||||
|
@ -226,7 +222,7 @@ ssize_t readline(FAR char *buf, int buflen, FILE *instream, FILE *outstream)
|
|||
{
|
||||
/* Yes, is it an <esc>[, 3 byte sequence */
|
||||
|
||||
if (ch != LBRACKET || escape == 2)
|
||||
if (ch != ASCII_LBRACKET || escape == 2)
|
||||
{
|
||||
/* We are finished with the escape sequence */
|
||||
|
||||
|
@ -254,7 +250,7 @@ ssize_t readline(FAR char *buf, int buflen, FILE *instream, FILE *outstream)
|
|||
* backspace key is pressed.
|
||||
*/
|
||||
|
||||
else if (ch == BS || ch == DEL)
|
||||
else if (ch == ASCII_BS || ch == ASCII_DEL)
|
||||
{
|
||||
/* Eliminate that last character in the buffer. */
|
||||
|
||||
|
@ -268,15 +264,15 @@ ssize_t readline(FAR char *buf, int buflen, FILE *instream, FILE *outstream)
|
|||
* understand DEL properly.
|
||||
*/
|
||||
|
||||
readline_consoleputc(BS, outfd);
|
||||
readline_consoleputs(g_erasetoeol, outfd);
|
||||
readline_consoleputc(ASCII_BS, outfd);
|
||||
readline_consolewrite(outfd, g_erasetoeol, sizeof(g_erasetoeol));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for the beginning of a VT100 escape sequence */
|
||||
|
||||
else if (ch == ESC)
|
||||
else if (ch == ASCII_ESC)
|
||||
{
|
||||
/* The next character is escaped */
|
||||
|
||||
|
|
|
@ -0,0 +1,200 @@
|
|||
/****************************************************************************
|
||||
* include/nuttx/ascii.h
|
||||
* ASCII Control Codes
|
||||
*
|
||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __INCLUDE_NUTTX_ASCII_H
|
||||
#define __INCLUDE_NUTTX_ASCII_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
/* All 7-bit ASCII codes */
|
||||
|
||||
#define ASCII_NUL 0x00 /* Null character (^@) */
|
||||
#define ASCII_SOH 0x01 /* Start of header (^A) */
|
||||
#define ASCII_STX 0x02 /* Start of tex (^B) */
|
||||
#define ASCII_ETX 0x03 /* End of text (^C) */
|
||||
#define ASCII_EOT 0x04 /* End of transmission (^D) */
|
||||
#define ASCII_ENQ 0x05 /* Enquiry (^E) */
|
||||
#define ASCII_ACK 0x06 /* Acknowledge (^F) */
|
||||
#define ASCII_BEL 0x07 /* Bell (^G) */
|
||||
#define ASCII_BS 0x08 /* Backspace (^H) */
|
||||
#define ASCII_TAB 0x09 /* Horizontal tab (^I) */
|
||||
#define ASCII_LF 0x0a /* Line Feed (^J) */
|
||||
#define ASCII_VT 0x0b /* Vertical tab(^K) */
|
||||
#define ASCII_FF 0x0c /* Form Feed (^L) */
|
||||
#define ASCII_CR 0x0d /* Carriage Return (^M) */
|
||||
#define ASCII_SO 0x0e /* Shift Out (^N) */
|
||||
#define ASCII_SI 0x0f /* Shift In (^O) */
|
||||
|
||||
#define ASCII_DLE 0x10 /* Data link escape (^P) */
|
||||
#define ASCII_DC1 0x11 /* XON (^Q) */
|
||||
#define ASCII_DC2 0x12 /* Device control 2, block-mode flow control (^R) */
|
||||
#define ASCII_DC3 0x13 /* XOFF (^S) */
|
||||
#define ASCII_DC4 0x14 /* Device control 4 (^T) */
|
||||
#define ASCII_NAK 0x15 /* Negative acknowledge (^U) */
|
||||
#define ASCII_SYN 0x16 /* Synchronous idle (^V) */
|
||||
#define ASCII_ETB 0x17 /* End transmission block(^W) */
|
||||
#define ASCII_CAN 0x18 /* Cancel line(^X) */
|
||||
#define ASCII_EM 0x19 /* End of medium(^Y) */
|
||||
#define ASCII_SUB 0x1a /* Substitute (^Z) */
|
||||
#define ASCII_ESC 0x1b /* Escape (^[) */
|
||||
#define ASCII_FS 0x1c /* File separator (^\) */
|
||||
#define ASCII_GS 0x1d /* Group separator (^]) */
|
||||
#define ASCII_RS 0x1e /* Record separator, block-mode terminator (^^) */
|
||||
#define ASCII_US 0x1f /* Unit separator (^_) */
|
||||
|
||||
#define ASCII_SPACE 0x20 /* Space ( ) */
|
||||
#define ASCII_EXCLAM 0x21 /* Exclamation mark (!) */
|
||||
#define ASCII_QUOTE 0x22 /* Quotation mark (") */
|
||||
#define ASCII_NUMBER 0x23 /* Number sign (#) */
|
||||
#define ASCII_HASH 0x23 /* Hash (#) */
|
||||
#define ASCII_DOLLAR 0x24 /* Dollar sign ($) */
|
||||
#define ASCII_PERCENT 0x25 /* Percent sign (%) */
|
||||
#define ASCII_AMPERSAND 0x26 /* Ampersand (&) */
|
||||
#define ASCII_RSQUOTE 0x27 /* Closing single quote (') */
|
||||
#define ASCII_APOSTROPHE 0x27 /* Apostrophe (') */
|
||||
#define ASCII_LPAREN 0x28 /* Opening parenthesis (() */
|
||||
#define ASCII_RPAREN 0x29 /* Closing parenthesis ()) */
|
||||
#define ASCII_ASTERISK 0x2a /* Asterisk (*) */
|
||||
#define ASCII_PLUS 0x2b /* Plus sign (+) */
|
||||
#define ASCII_COMMA 0x2c /* Comma (,) */
|
||||
#define ASCII_HYPHEN 0x2d /* Hyphen (-) */
|
||||
#define ASCII_DASH 0x2d /* Dash (-) */
|
||||
#define ASCII_MINUS 0x2d /* Minus sign (-) */
|
||||
#define ASCII_PERIOD 0x2e /* Period (.) */
|
||||
#define ASCII_SLASH 0x2f /* Forward Slash (/) */
|
||||
#define ASCII_DIVIDE 0x2f /* Divide (/) */
|
||||
|
||||
#define ASCII_0 0x30 /* Numbers */
|
||||
#define ASCII_1 0x31 /* " " */
|
||||
#define ASCII_2 0x32 /* " " */
|
||||
#define ASCII_3 0x33 /* " " */
|
||||
#define ASCII_4 0x34 /* " " */
|
||||
#define ASCII_5 0x35 /* " " */
|
||||
#define ASCII_6 0x36 /* " " */
|
||||
#define ASCII_7 0x37 /* " " */
|
||||
#define ASCII_8 0x38 /* " " */
|
||||
#define ASCII_9 0x39 /* " " */
|
||||
#define ASCII_COLON 0x3a /* Colon (:) */
|
||||
#define ASCII_SEMICOLON 0x3b /* Semicolon (;) */
|
||||
#define ASCII_LT 0x3c /* Less than (<) */
|
||||
#define ASCII_EQUAL 0x3d /* Equal (=) */
|
||||
#define ASCII_GT 0x3e /* Greater than (>) */
|
||||
#define ASCII_QUESTION 0x3f /* Question mark (?) */
|
||||
|
||||
#define ASCII_AT 0x40 /* At sign (@) */
|
||||
#define ASCII_A 0x41 /* Upper case letters */
|
||||
#define ASCII_B 0x42 /* " " " " " " */
|
||||
#define ASCII_C 0x43 /* " " " " " " */
|
||||
#define ASCII_D 0x44 /* " " " " " " */
|
||||
#define ASCII_E 0x45 /* " " " " " " */
|
||||
#define ASCII_F 0x46 /* " " " " " " */
|
||||
#define ASCII_G 0x47 /* " " " " " " */
|
||||
#define ASCII_H 0x48 /* " " " " " " */
|
||||
#define ASCII_I 0x49 /* " " " " " " */
|
||||
#define ASCII_J 0x4a /* " " " " " " */
|
||||
#define ASCII_K 0x4b /* " " " " " " */
|
||||
#define ASCII_L 0x4c /* " " " " " " */
|
||||
#define ASCII_M 0x4d /* " " " " " " */
|
||||
#define ASCII_N 0x4e /* " " " " " " */
|
||||
#define ASCII_O 0x4f /* " " " " " " */
|
||||
|
||||
#define ASCII_P 0x50 /* " " " " " " */
|
||||
#define ASCII_Q 0x51 /* " " " " " " */
|
||||
#define ASCII_R 0x52 /* " " " " " " */
|
||||
#define ASCII_S 0x53 /* " " " " " " */
|
||||
#define ASCII_T 0x54 /* " " " " " " */
|
||||
#define ASCII_U 0x55 /* " " " " " " */
|
||||
#define ASCII_V 0x56 /* " " " " " " */
|
||||
#define ASCII_W 0x57 /* " " " " " " */
|
||||
#define ASCII_X 0x58 /* " " " " " " */
|
||||
#define ASCII_Y 0x59 /* " " " " " " */
|
||||
#define ASCII_Z 0x5a /* " " " " " " */
|
||||
#define ASCII_LBRACKET 0x5b /* Left bracket ([) */
|
||||
#define ASCII_BACKSLASH 0x5c /* Back slash (\) */
|
||||
#define ASCII_RBRACKET 0x5d /* Right bracket (]) */
|
||||
#define ASCII_CARET 0x5c /* Caret (^) */
|
||||
#define ASCII_CIRCUMFLEX 0x5c /* Circumflex (^) */
|
||||
#define ASCII_UNDERSCORE 0x5f /* Underscore (_) */
|
||||
|
||||
#define ASCII_RSQUOT 0x60 /* Closing single quote */
|
||||
#define ASCII_a 0x61 /* Lower case letters */
|
||||
#define ASCII_b 0x62 /* " " " " " " */
|
||||
#define ASCII_c 0x63 /* " " " " " " */
|
||||
#define ASCII_d 0x64 /* " " " " " " */
|
||||
#define ASCII_e 0x65 /* " " " " " " */
|
||||
#define ASCII_f 0x66 /* " " " " " " */
|
||||
#define ASCII_g 0x67 /* " " " " " " */
|
||||
#define ASCII_h 0x68 /* " " " " " " */
|
||||
#define ASCII_i 0x69 /* " " " " " " */
|
||||
#define ASCII_j 0x6a /* " " " " " " */
|
||||
#define ASCII_k 0x6b /* " " " " " " */
|
||||
#define ASCII_l 0x6c /* " " " " " " */
|
||||
#define ASCII_m 0x6d /* " " " " " " */
|
||||
#define ASCII_n 0x6e /* " " " " " " */
|
||||
#define ASCII_o 0x6f /* " " " " " " */
|
||||
|
||||
#define ASCII_p 0x70 /* " " " " " " */
|
||||
#define ASCII_q 0x71 /* " " " " " " */
|
||||
#define ASCII_r 0x72 /* " " " " " " */
|
||||
#define ASCII_s 0x73 /* " " " " " " */
|
||||
#define ASCII_t 0x74 /* " " " " " " */
|
||||
#define ASCII_u 0x75 /* " " " " " " */
|
||||
#define ASCII_v 0x76 /* " " " " " " */
|
||||
#define ASCII_w 0x77 /* " " " " " " */
|
||||
#define ASCII_x 0x78 /* " " " " " " */
|
||||
#define ASCII_y 0x79 /* " " " " " " */
|
||||
#define ASCII_z 0x7a /* " " " " " " */
|
||||
#define ASCII_LBRACE 0x7b /* Left brace ({) */
|
||||
#define ASCII_VERTBAR 0x7c /* Vertical bar (|) */
|
||||
#define ASCII_PIPE 0x7c /* Pipe (|) */
|
||||
#define ASCII_RBRACE 0x7d /* Right brace (}) */
|
||||
#define ASCII_TILDE 0x7e /* Tilde (~) */
|
||||
#define ASCII_DEL 0x7f /* Delete (rubout) */
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#endif /* __INCLUDE_NUTTX_ASCII_H */
|
|
@ -0,0 +1,250 @@
|
|||
/********************************************************************************************
|
||||
* include/nuttx/vt100.h
|
||||
* VT100 Escape Sequences
|
||||
*
|
||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
#ifndef __INCLUDE_NUTTX_VT100_H
|
||||
#define __INCLUDE_NUTTX_VT100_H
|
||||
|
||||
/********************************************************************************************
|
||||
* Included Files
|
||||
********************************************************************************************/
|
||||
|
||||
#include <nuttx/ascii.h>
|
||||
|
||||
/********************************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
********************************************************************************************/
|
||||
|
||||
#define VT100_SETNL {ASCII_ESC, '[', '2', '0', 'h'} /* Set new line mode */
|
||||
#define VT100_SETAPPL {ASCII_ESC, '[', '?', '1', 'h'} /* Set cursor key to application */
|
||||
#define VT100_SETCOL {ASCII_ESC, '[', '?', '3', 'h'} /* Set number of columns to 132 */
|
||||
#define VT100_SETSMOOTH {ASCII_ESC, '[', '?', '4', 'h'} /* Set smooth scrolling */
|
||||
#define VT100_SETREVSCRN {ASCII_ESC, '[', '?', '5', 'h'} /* Set reverse video on screen */
|
||||
#define VT100_SETORGREL {ASCII_ESC, '[', '?', '6', 'h'} /* Set origin to relative */
|
||||
#define VT100_SETWRAP {ASCII_ESC, '[', '?', '7', 'h'} /* Set auto-wrap mode */
|
||||
#define VT100_SETREP {ASCII_ESC, '[', '?', '8', 'h'} /* Set auto-repeat mode */
|
||||
#define VT100_SETINTER {ASCII_ESC, '[', '?', '9', 'h'} /* Set interlacing mode */
|
||||
|
||||
#define VT100_SETLF {ASCII_ESC, '[', '2', '0', 'l'} /* Set line feed mode */
|
||||
#define VT100_SETCURSOR {ASCII_ESC, '[', '?', '1', 'l'} /* Set cursor key to cursor */
|
||||
#define VT100_SETVT52 {ASCII_ESC, '[', '?', '2', 'l'} /* Set VT52 (versus ANSI) */
|
||||
#define VT100_RESETCOL {ASCII_ESC, '[', '?', '3', 'l'} /* Set number of columns to 80 */
|
||||
#define VT100_SETJUMP {ASCII_ESC, '[', '?', '4', 'l'} /* Set jump scrolling */
|
||||
#define VT100_SETNORMSCRN {ASCII_ESC, '[', '?', '5', 'l'} /* Set normal video on screen */
|
||||
#define VT100_SETORGABS {ASCII_ESC, '[', '?', '6', 'l'} /* Set origin to absolute */
|
||||
#define VT100_RESETWRAP {ASCII_ESC, '[', '?', '7', 'l'} /* Reset auto-wrap mode */
|
||||
#define VT100_RESETREP {ASCII_ESC, '[', '?', '8', 'l'} /* Reset auto-repeat mode */
|
||||
#define VT100_RESETINTER {ASCII_ESC, '[', '?', '9', 'l'} /* Reset interlacing mode */
|
||||
|
||||
#define VT100_ALTKEYPAD {ASCII_ESC, '='} /* Set alternate keypad mode */
|
||||
#define VT100_NUMKEYPAD {ASCII_ESC, '>'} /* Set numeric keypad mode */
|
||||
|
||||
#define VT100_SETUKG0 {ASCII_ESC, '(', 'A'} /* Set United Kingdom G0 character set */
|
||||
#define VT100_SETUKG1 {ASCII_ESC, ')', 'A'} /* Set United Kingdom G1 character set */
|
||||
#define VT100_SETUSG0 {ASCII_ESC, '(', 'B'} /* Set United States G0 character set */
|
||||
#define VT100_SETUSG1 {ASCII_ESC, ')', 'B'} /* Set United States G1 character set */
|
||||
#define VT100_SETSPECG0 {ASCII_ESC, '(', '0'} /* Set G0 special chars. & line set */
|
||||
#define VT100_SETSPECG1 {ASCII_ESC, ')', '0'} /* Set G1 special chars. & line set */
|
||||
#define VT100_SETALTG0 {ASCII_ESC, '(', '1'} /* Set G0 alternate character ROM */
|
||||
#define VT100_SETALTG1 {ASCII_ESC, ')', '1'} /* Set G1 alternate character ROM */
|
||||
#define VT100_SETALTSPECG0 {ASCII_ESC, '(', '2'} /* Set G0 alt char ROM and spec. graphics */
|
||||
#define VT100_SETALTSPECG1 {ASCII_ESC, ')', '2'} /* Set G1 alt char ROM and spec. graphics */
|
||||
|
||||
#define VT100_SETSS2 {ASCII_ESC, 'N'} /* Set single shift 2 */
|
||||
#define VT100_SETSS3 {ASCII_ESC, 'O'} /* Set single shift 3 */
|
||||
|
||||
#define VT100_MODESOFF {ASCII_ESC, '[', 'm'} /* Turn off character attributes */
|
||||
#define VT100_MODESOFF_ {ASCII_ESC, '[', '0', 'm'} /* Turn off character attributes */
|
||||
#define VT100_BOLD {ASCII_ESC, '[', '1', 'm'} /* Turn bold mode on */
|
||||
#define VT100_LOWINT {ASCII_ESC, '[', '2', 'm'} /* Turn low intensity mode on */
|
||||
#define VT100_UNDERLINE {ASCII_ESC, '[', '4', 'm'} /* Turn underline mode on */
|
||||
#define VT100_BLINK {ASCII_ESC, '[', '5', 'm'} /* Turn blinking mode on */
|
||||
#define VT100_REVERSE {ASCII_ESC, '[', '7', 'm'} /* Turn reverse video on */
|
||||
#define VT100_INVISIBLE {ASCII_ESC, '[', '8', 'm'} /* Turn invisible text mode on */
|
||||
|
||||
#define VT100_SETWIN(t,b) {ASCII_ESC, '[', (t), ';', (b), 'r'} /* Set top and bottom line#s of a window */
|
||||
|
||||
#define VT100_CURSORUP(n) {ASCII_ESC, '[', (n), 'A'} /* Move cursor up n lines */
|
||||
#define VT100_CURSORDN(n) {ASCII_ESC, '[', (n), 'B'} /* Move cursor down n lines */
|
||||
#define VT100_CURSORRT(n) {ASCII_ESC, '[', (n), 'C'} /* Move cursor right n lines */
|
||||
#define VT100_CURSORLF(n) {ASCII_ESC, '[', (n), 'D'} /* Move cursor left n lines */
|
||||
#define VT100_CURSORHOME {ASCII_ESC, '[', 'H'} /* Move cursor to upper left corner */
|
||||
#define VT100_CURSORHOME_ {ASCII_ESC, '[', ';', 'H'} /* Move cursor to upper left corner */
|
||||
#define VT100_CURSORPOS(v,h) {ASCII_ESC, '[', (v), ';', (h), 'H'} /* Move cursor to screen location v,h */
|
||||
|
||||
#define VT100_HVHOME {ASCII_ESC, '[', 'f'} /* Move cursor to upper left corner */
|
||||
#define VT100_HVHOME_ {ASCII_ESC, '[', ;', 'f'} /* Move cursor to upper left corner */
|
||||
#define VT100_HVPOS(v,h) {ASCII_ESC, '[', (v), ';', (h), 'f'} /* Move cursor to screen location v,h */
|
||||
#define VT100_INDEX {ASCII_ESC, 'D'} /* Move/scroll window up one line */
|
||||
#define VT100_REVINDEX {ASCII_ESC, 'M'} /* Move/scroll window down one line */
|
||||
#define VT100_NEXTLINE {ASCII_ESC, 'E'} /* Move to next line */
|
||||
#define VT100_SAVECURSOR {ASCII_ESC, '7'} /* Save cursor position and attributes */
|
||||
#define VT100_RESTORECURSOR {ASCII_ESC, '8'} /* Restore cursor position and attribute */
|
||||
|
||||
#define VT100_TABSET {ASCII_ESC, 'H'} /* Set a tab at the current column */
|
||||
#define VT100_TABCLR {ASCII_ESC, '[', 'g'} /* Clear a tab at the current column */
|
||||
#define VT100_TABCLR_ {ASCII_ESC, '[', '0', 'g'} /* Clear a tab at the current column */
|
||||
#define VT100_TABCLRALL {ASCII_ESC, '[', '3', 'g'} /* Clear all tabs */
|
||||
|
||||
#define VT100_DHTOP {ASCII_ESC, '#', '3'} /* Double-height letters, top half */
|
||||
#define VT100_DHBOT {ASCII_ESC, '#', '4'} /* Double-height letters, bottom hal */
|
||||
#define VT100_SWSH {ASCII_ESC, '#', '5'} /* Single width, single height letters */
|
||||
#define VT100_DWSH {ASCII_ESC, '#', '6'} /* Double width, single height letters */
|
||||
|
||||
#define VT100_CLEAREOL {ASCII_ESC, '[', 'K'} /* Clear line from cursor right */
|
||||
#define VT100_CLEAREOL_ {ASCII_ESC, '[', '0', 'K'} /* Clear line from cursor right */
|
||||
#define VT100_CLEARBOL {ASCII_ESC, '[', '1', 'K'} /* Clear line from cursor left */
|
||||
#define VT100_CLEARLINE {ASCII_ESC, '[', '2', 'K'} /* Clear entire line */
|
||||
|
||||
#define VT100_CLEAREOS {ASCII_ESC, '[', 'J'} /* Clear screen from cursor down */
|
||||
#define VT100_CLEAREOS_ {ASCII_ESC, '[', '0', 'J'} /* Clear screen from cursor down */
|
||||
#define VT100_CLEARBOS {ASCII_ESC, '[', '1', 'J'} /* Clear screen from cursor up */
|
||||
#define VT100_CLEARSCREEN {ASCII_ESC, '[', '2', 'J'} /* Clear entire screen */
|
||||
|
||||
#define VT100_DEVSTAT {ASCII_ESC, '5', 'n'} /* Device status report */
|
||||
#define VT100_TERMOK {ASCII_ESC, '0', 'n'} /* Response: terminal is OK */
|
||||
#define VT100_TERMNOK {ASCII_ESC, '3', 'n'} /* Response: terminal is not OK */
|
||||
|
||||
#define VT100_GETCURSOR {ASCII_ESC, '6', 'n'} /* Get cursor position */
|
||||
#define VT100_CURSORPOS {ASCII_ESC, (v), ';', (h), 'R'} /* Response: cursor is at v,h */
|
||||
|
||||
#define VT100_IDENT {ASCII_ESC, '[', 'c'} /* Identify what terminal type */
|
||||
#define VT100_IDENT_ {ASCII_ESC, '[', '0', 'c'} /* Identify what terminal type */
|
||||
#define VT100_GETTYPE {ASCII_ESC, '[', '?', '1', ';', (n), '0', 'c'} /* Response: terminal type code n */
|
||||
|
||||
#define VT100_RESET RIS {ASCII_ESC, 'c'} /* Reset terminal to initial state */
|
||||
|
||||
#define VT100_ALIGN {ASCII_ESC, '#', '8'} /* Screen alignment display */
|
||||
#define VT100_TESTPU {ASCII_ESC, '[', '2', ';', '1', 'y'} /* Confidence power up test */
|
||||
#define VT100_TESTLB {ASCII_ESC, '[', '2', ';', '2', 'y'} /* Confidence loopback test */
|
||||
#define VT100_TESTPUREP {ASCII_ESC, '[', '2', ';', '9', 'y'} /* Repeat power up test */
|
||||
#define VT100_TESTLBREP {ASCII_ESC, '[', '2', ';', '1', '0', 'y'} /* Repeat loopback test */
|
||||
|
||||
#define VT100_LEDSOFF {ASCII_ESC, '[', '0', 'q'} /* Turn off all four leds */
|
||||
#define VT100_LED1 {ASCII_ESC, '[', '1', 'q'} /* Turn on LED #1 */
|
||||
#define VT100_LED2 {ASCII_ESC, '[', '2', 'q'} /* Turn on LED #2 */
|
||||
#define VT100_LED3 {ASCII_ESC, '[', '3', 'q'} /* Turn on LED #3 */
|
||||
#define VT100_LED4 {ASCII_ESC, '[', '4', 'q'} /* Turn on LED #4 */
|
||||
|
||||
/* All codes below are for use in VT52 compatibility mode. */
|
||||
|
||||
#define VT52_SETANSI {ASCII_ESC, '<'} /* Enter/exit ANSI mode */
|
||||
|
||||
#define VT52_ALTKEYPAD {ASCII_ESC, '='} /* Enter alternate keypad mode */
|
||||
#define VT52_NUMKEYPAD {ASCII_ESC, '>'} /* Exit alternate keypad mode */
|
||||
|
||||
#define VT52_SETGR {ASCII_ESC, 'F'} /* Use special graphics character set */
|
||||
#define VT52_RESETGR {ASCII_ESC, 'G'} /* Use normal US/UK character set */
|
||||
|
||||
#define VT52_CURSORUP {ASCII_ESC, 'A'} /* Move cursor up one line */
|
||||
#define VT52_CURSORDN {ASCII_ESC, 'B'} /* Move cursor down one line */
|
||||
#define VT52_CURSORRT {ASCII_ESC, 'C'} /* Move cursor right one char */
|
||||
#define VT52_CURSORLF {ASCII_ESC, 'D'} /* Move cursor left one char */
|
||||
#define VT52_CURSORHOME {ASCII_ESC, 'H'} /* Move cursor to upper left corner */
|
||||
#define VT52_CURSORPOS(v,h) {ASCII_ESC, (v), (h)} /* Move cursor to v,h location */
|
||||
#define VT52_REVINDEX {ASCII_ESC, 'I'} /* Generate a reverse line-feed */
|
||||
|
||||
#define VT52_CLEAREOL {ASCII_ESC, 'K'} /* Erase to end of current line */
|
||||
#define VT52_CLEAREOS {ASCII_ESC, 'J'} /* Erase to end of screen */
|
||||
|
||||
#define VT52_IDENT {ASCII_ESC, 'Z'} /* dentify what the terminal is */
|
||||
#define VT52_IDENTRESP {ASCII_ESC, '/', 'Z'} /* Correct response to ident */
|
||||
|
||||
/* VT100 Special Key Codes
|
||||
*
|
||||
* These are sent from the terminal back to the computer when the particular
|
||||
* key is pressed. Note that the numeric keypad keys send different codes
|
||||
* in numeric mode than in alternate mode.
|
||||
*/
|
||||
|
||||
/* Function Keys */
|
||||
|
||||
#define VT100_PF1 {ASCII_ESC, 'O', 'P'}
|
||||
#define VT100_PF2 {ASCII_ESC, 'O', 'Q'}
|
||||
#define VT100_PF3 {ASCII_ESC, 'O', 'R'}
|
||||
#define VT100_PF4 {ASCII_ESC, 'O', 'S'}
|
||||
|
||||
|
||||
/* Arrow keys */
|
||||
|
||||
#define VT100_UP_RESET {ASCII_ESC, 'A'}
|
||||
#define VT100_UP_SET {ASCII_ESC, 'O', 'A'}
|
||||
#define VT100_DOWN_RESET {ASCII_ESC, 'B'}
|
||||
#define VT100_DOWN_SET {ASCII_ESC, 'O', 'B'}
|
||||
#define VT100_RIGHT_RESET {ASCII_ESC, 'C'}
|
||||
#define VT100_RIGHT_SET {ASCII_ESC, 'O', 'C'}
|
||||
#define VT100_LEFT_RESET {ASCII_ESC, 'D'}
|
||||
#define VT100_LEFT_SET {ASCII_ESC, 'O', 'D'}
|
||||
|
||||
/* Numeric Keypad Keys */
|
||||
|
||||
#define VT100_NUMERIC_0 {'0'}
|
||||
#define VT100_ALT_0 {ASCII_ESC, 'O', 'p'}
|
||||
#define VT100_NUMERIC_1 {'1'}
|
||||
#define VT100_ALT_1 {ASCII_ESC, 'O', 'q'}
|
||||
#define VT100_NUMERIC_2 {'2'}
|
||||
#define VT100_ALT_2 {ASCII_ESC, 'O', 'r'}
|
||||
#define VT100_NUMERIC_3 {'3'}
|
||||
#define VT100_ALT_3 {ASCII_ESC, 'O', 's'}
|
||||
#define VT100_NUMERIC_4 {'4'}
|
||||
#define VT100_ALT_4 {ASCII_ESC, 'O', 't'}
|
||||
#define VT100_NUMERIC_5 {'5'}
|
||||
#define VT100_ALT_5 {ASCII_ESC, 'O', 'u'}
|
||||
#define VT100_NUMERIC_6 {'6'}
|
||||
#define VT100_ALT_6 {ASCII_ESC, 'O', 'v'}
|
||||
#define VT100_NUMERIC_7 {'7'}
|
||||
#define VT100_ALT_7 {ASCII_ESC, 'O', 'w'}
|
||||
#define VT100_NUMERIC_8 {'8'}
|
||||
#define VT100_ALT_8 {ASCII_ESC, 'O', 'x'}
|
||||
#define VT100_NUMERIC_9 {'9',
|
||||
#define VT100_ALT_9 {ASCII_ESC, 'O', 'y'}
|
||||
#define VT100_NUMERIC_MINUS {'-'}
|
||||
#define VT100_ALT_MINUS {ASCII_ESC, 'O', 'm'}
|
||||
#define VT100_NUMERIC_COMMA {','}
|
||||
#define VT100_ALT_COMMA {ASCII_ESC, 'O', 'l'}
|
||||
#define VT100_NUMERIC_PERIOD {'.'}
|
||||
#define VT100_ALT_PERIOD {ASCII_ESC, 'O', 'n'}
|
||||
#define VT100_NUMERIC_ENTER {ASCII_CR}
|
||||
#define VT100_ALT_ENTER {ASCII_ESC, 'O', 'M'}
|
||||
|
||||
/********************************************************************************************
|
||||
* Public Data
|
||||
********************************************************************************************/
|
||||
|
||||
/********************************************************************************************
|
||||
* Public Function Prototypes
|
||||
********************************************************************************************/
|
||||
|
||||
#endif /* __INCLUDE_NUTTX_VT100_H */
|
Loading…
Reference in New Issue