Changeset 3899 for neercs/trunk


Ignore:
Timestamp:
Nov 13, 2009, 5:45:48 PM (10 years ago)
Author:
Pascal Terjan
Message:
  • Apparently \033 is more common than \x1b for ESC. Use the former in our code for clarity. (following libcaca commit 3412)
Location:
neercs/trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • neercs/trunk/src/grab.c

    r3892 r3899  
    122122    mytrace_detach(parent);
    123123    waitpid(pid, NULL, 0); /* Wait for reset to finish before displaying */
    124     mytrace_write(child, 2, "\x1b[H\x1b[2J", 7);
     124    mytrace_write(child, 2, "\033[H\033[2J", 7);
    125125    mytrace_write(child, 2, "\n[Process stolen by neercs]\r\n\n", 30);
    126126
  • neercs/trunk/src/input.c

    r3897 r3899  
    2626
    2727struct kconv kconv[] = {
    28     {CACA_KEY_UP,      "\x1bOA",   3},
    29     {CACA_KEY_DOWN,    "\x1bOB",   3},
    30     {CACA_KEY_RIGHT,   "\x1bOC",   3},
    31     {CACA_KEY_LEFT,    "\x1bOD",   3},
    32     {CACA_KEY_PAGEUP,  "\x1b[5~",  4},
    33     {CACA_KEY_PAGEDOWN,"\x1b[6~",  4},
    34     {CACA_KEY_HOME,    "\x1b[1~",  4},
    35     {CACA_KEY_INSERT,  "\x1b[2~",  4},
    36     {CACA_KEY_DELETE,  "\x1b[3~",  4},
    37     {CACA_KEY_END,     "\x1b[4~",  4},
    38     {CACA_KEY_F1,      "\x1b[11~", 5},
    39     {CACA_KEY_F2,      "\x1b[12~", 5},
    40     {CACA_KEY_F3,      "\x1b[13~", 5},
    41     {CACA_KEY_F4,      "\x1b[14~", 5},
    42     {CACA_KEY_F5,      "\x1b[15~", 5},
    43     {CACA_KEY_F6,      "\x1b[17~", 5},
    44     {CACA_KEY_F7,      "\x1b[18~", 5},
    45     {CACA_KEY_F8,      "\x1b[19~", 5},
    46     {CACA_KEY_F9,      "\x1b[20~", 5},
    47     {CACA_KEY_F10,     "\x1b[21~", 5},
    48     {CACA_KEY_F11,     "\x1b[23~", 5},
    49     {CACA_KEY_F12,     "\x1b[24~", 5},
     28    {CACA_KEY_UP,      "\033OA",   3},
     29    {CACA_KEY_DOWN,    "\033OB",   3},
     30    {CACA_KEY_RIGHT,   "\033OC",   3},
     31    {CACA_KEY_LEFT,    "\033OD",   3},
     32    {CACA_KEY_PAGEUP,  "\033[5~",  4},
     33    {CACA_KEY_PAGEDOWN,"\033[6~",  4},
     34    {CACA_KEY_HOME,    "\033[1~",  4},
     35    {CACA_KEY_INSERT,  "\033[2~",  4},
     36    {CACA_KEY_DELETE,  "\033[3~",  4},
     37    {CACA_KEY_END,     "\033[4~",  4},
     38    {CACA_KEY_F1,      "\033[11~", 5},
     39    {CACA_KEY_F2,      "\033[12~", 5},
     40    {CACA_KEY_F3,      "\033[13~", 5},
     41    {CACA_KEY_F4,      "\033[14~", 5},
     42    {CACA_KEY_F5,      "\033[15~", 5},
     43    {CACA_KEY_F6,      "\033[17~", 5},
     44    {CACA_KEY_F7,      "\033[18~", 5},
     45    {CACA_KEY_F8,      "\033[19~", 5},
     46    {CACA_KEY_F9,      "\033[20~", 5},
     47    {CACA_KEY_F10,     "\033[21~", 5},
     48    {CACA_KEY_F11,     "\033[23~", 5},
     49    {CACA_KEY_F12,     "\033[24~", 5},
    5050};
    5151
  • neercs/trunk/src/term.c

    r3891 r3899  
    169169        /* If there are not enough characters to parse the escape sequence,
    170170         * wait until the next try. We require 3. */
    171         else if(buffer[i] == '\x1b' && i + 2 >= size)
     171        else if(buffer[i] == '\033' && i + 2 >= size)
    172172            break;
    173173
    174174        /* Single Shift Select of G2 Character Set (SS2: 0x8e):
    175175         * affects next character only */
    176         else if(buffer[i] == '\x1b' && buffer[i + 1] == 'N')
     176        else if(buffer[i] == '\033' && buffer[i + 1] == 'N')
    177177        {
    178178            sc->conv_state.ss = 2;
     
    182182        /* Single Shift Select of G3 Character Set (SS2: 0x8f):
    183183         * affects next character only */
    184         else if(buffer[i] == '\x1b' && buffer[i + 1] == 'O')
     184        else if(buffer[i] == '\033' && buffer[i + 1] == 'O')
    185185        {
    186186            sc->conv_state.ss = 3;
     
    189189
    190190        /* LOCKING-SHIFT TWO (LS2), ISO 2022, ECMA-48 (1986), ISO 6429 : 1988 */
    191         else if(buffer[i] == '\x1b' && buffer[i + 1] == 'n')
     191        else if(buffer[i] == '\033' && buffer[i + 1] == 'n')
    192192        {
    193193            sc->conv_state.glr[0] = 2;
     
    196196
    197197        /* LOCKING-SHIFT THREE (LS3) ISO 2022, ECMA-48 (1986), ISO 6429 : 1988 */
    198         else if(buffer[i] == '\x1b' && buffer[i + 1] == 'o')
     198        else if(buffer[i] == '\033' && buffer[i + 1] == 'o')
    199199        {
    200200            sc->conv_state.glr[0] = 3;
     
    203203
    204204        /* RESET TO INITIAL STATE (RIS), ECMA-48 (1986), ISO 6429 : 1988 */
    205         else if(buffer[i] == '\x1b' && buffer[i + 1] == 'c')
     205        else if(buffer[i] == '\033' && buffer[i + 1] == 'c')
    206206        {
    207207            sc->dfg = CACA_DEFAULT;
     
    217217
    218218        /* Coding Method Delimiter (CMD), ECMA-48 (1991), ISO/IEC 6429:1992 (ISO IR 189) */
    219         else if(buffer[i] == '\x1b' && buffer[i + 1] == 'd')
     219        else if(buffer[i] == '\033' && buffer[i + 1] == 'd')
    220220        {
    221221            reset_conv_state(sc);
     
    224224
    225225        /* GZDM4, G0-Designators, multi, 94^n chars [grandfathered short form from ISO 2022:1986] */
    226         else if(buffer[i] == '\x1b' && buffer[i + 1] == '$' && (buffer[i + 2] >= '@') && (buffer[i + 2] <= 'C'))
     226        else if(buffer[i] == '\033' && buffer[i + 1] == '$' && (buffer[i + 2] >= '@') && (buffer[i + 2] <= 'C'))
    227227        {
    228228            sc->conv_state.gn[0] = LITERAL2CHAR('$', buffer[i + 2]);
     
    231231
    232232        /* GnDMx Gn-Designators, 9x^n chars; need one more char to distinguish these */
    233         else if(buffer[i] == '\x1b' && buffer[i + 1] == '$' && (i + 3 >= size))
     233        else if(buffer[i] == '\033' && buffer[i + 1] == '$' && (i + 3 >= size))
    234234            break;
    235235
    236236        /* GZD4 G0-Designator, 94 chars */
    237         else if(buffer[i] == '\x1b' && buffer[i + 1] == '(')
     237        else if(buffer[i] == '\033' && buffer[i + 1] == '(')
    238238        {
    239239            sc->conv_state.gn[0] = buffer[i + 2];
     
    242242
    243243        /* G1D4 G1-Designator, 94 chars */
    244         else if(buffer[i] == '\x1b' && buffer[i + 1] == ')')
     244        else if(buffer[i] == '\033' && buffer[i + 1] == ')')
    245245        {
    246246            sc->conv_state.gn[1] = buffer[i + 2];
     
    249249
    250250        /* G2D4 G2-Designator, 94 chars */
    251         else if(buffer[i] == '\x1b' && buffer[i + 1] == '*')
     251        else if(buffer[i] == '\033' && buffer[i + 1] == '*')
    252252        {
    253253            sc->conv_state.gn[2] = buffer[i + 2];
     
    256256
    257257        /* G3D4 G3-Designator, 94 chars */
    258         else if(buffer[i] == '\x1b' && buffer[i + 1] == '+')
     258        else if(buffer[i] == '\033' && buffer[i + 1] == '+')
    259259        {
    260260            sc->conv_state.gn[3] = buffer[i + 2];
     
    263263
    264264        /* G2D6 G2-Designator, 96 chars */
    265         else if(buffer[i] == '\x1b' && buffer[i + 1] == '.')
     265        else if(buffer[i] == '\033' && buffer[i + 1] == '.')
    266266        {
    267267            sc->conv_state.gn[2] = LITERAL2CHAR('.', buffer[i + 2]);
     
    270270
    271271        /* G3D6 G3-Designator, 96 chars */
    272         else if(buffer[i] == '\x1b' && buffer[i + 1] == '/')
     272        else if(buffer[i] == '\033' && buffer[i + 1] == '/')
    273273        {
    274274            sc->conv_state.gn[3] = LITERAL2CHAR('.', buffer[i + 2]);
     
    277277
    278278        /* GZDM4 G0-Designator, 94^n chars */
    279         else if(buffer[i] == '\x1b' && buffer[i + 1] == '$' && buffer[i + 2] == '(')
     279        else if(buffer[i] == '\033' && buffer[i + 1] == '$' && buffer[i + 2] == '(')
    280280        {
    281281            sc->conv_state.gn[0] = LITERAL2CHAR('$', buffer[i + 3]);
     
    284284
    285285        /* G1DM4 G1-Designator, 94^n chars */
    286         else if(buffer[i] == '\x1b' && buffer[i + 1] == '$' && buffer[i + 2] == ')')
     286        else if(buffer[i] == '\033' && buffer[i + 1] == '$' && buffer[i + 2] == ')')
    287287        {
    288288            sc->conv_state.gn[1] = LITERAL2CHAR('$', buffer[i + 3]);
     
    291291
    292292        /* G2DM4 G2-Designator, 94^n chars */
    293         else if(buffer[i] == '\x1b' && buffer[i + 1] == '$' && buffer[i + 2] == '*')
     293        else if(buffer[i] == '\033' && buffer[i + 1] == '$' && buffer[i + 2] == '*')
    294294        {
    295295            sc->conv_state.gn[2] = LITERAL2CHAR('$', buffer[i + 3]);
     
    298298
    299299        /* G3DM4 G3-Designator, 94^n chars */
    300         else if(buffer[i] == '\x1b' && buffer[i + 1] == '$' && buffer[i + 2] == '+')
     300        else if(buffer[i] == '\033' && buffer[i + 1] == '$' && buffer[i + 2] == '+')
    301301        {
    302302            sc->conv_state.gn[3] = LITERAL2CHAR('$', buffer[i + 3]);
     
    305305
    306306        /* G2DM6 G2-Designator, 96^n chars */
    307         else if(buffer[i] == '\x1b' && buffer[i + 1] == '$' && buffer[i + 2] == '.')
     307        else if(buffer[i] == '\033' && buffer[i + 1] == '$' && buffer[i + 2] == '.')
    308308        {
    309309            sc->conv_state.gn[2] = LITERAL3CHAR('$', '.', buffer[i + 3]);
     
    312312
    313313        /* G3DM6 G3-Designator, 96^n chars */
    314         else if(buffer[i] == '\x1b' && buffer[i + 1] == '$' && buffer[i + 2] == '/')
     314        else if(buffer[i] == '\033' && buffer[i + 1] == '$' && buffer[i + 2] == '/')
    315315        {
    316316            sc->conv_state.gn[3] = LITERAL3CHAR('$', '.', buffer[i + 3]);
     
    320320        /* Interpret escape commands, as per Standard ECMA-48 "Control
    321321         * Functions for Coded Character Sets", 5.4. Control sequences. */
    322         else if(buffer[i] == '\x1b' && buffer[i + 1] == '[')
     322        else if(buffer[i] == '\033' && buffer[i + 1] == '[')
    323323        {
    324324            unsigned int argc = 0, argv[101];
     
    471471                break;
    472472            case 'r': /* SS  (0x72) - Scroll Screen FIXME */
     473                debug("SCROLL scrolled=%d argv=%s", scrolled, argv);
    473474                if(scrolled) break;
    474475                if((argv[0]==0 && argv[1]==0)  || scrolled) break;
     
    512513
    513514        /* Parse OSC stuff. */
    514         else if(buffer[i] == '\x1b' && buffer[i + 1] == ']')
     515        else if(buffer[i] == '\033' && buffer[i + 1] == ']')
    515516        {
    516517            char *string;
Note: See TracChangeset for help on using the changeset viewer.