"Fossies" - the Fresh Open Source Software Archive

Member "tin-2.4.4/include/keymap.h" (20 Nov 2019, 14171 Bytes) of package /linux/misc/tin-2.4.4.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "keymap.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 2.4.3_vs_2.4.4.

    1 /*
    2  *  Project   : tin - a Usenet reader
    3  *  Module    : keymap.h
    4  *  Author    : J. Faultless, D. Nimmich
    5  *  Created   : 1999
    6  *  Updated   : 2011-01-25
    7  *  Notes     :
    8  *
    9  * Copyright (c) 1999-2020 Jason Faultless <jason@altarstone.com>
   10  * All rights reserved.
   11  *
   12  * Redistribution and use in source and binary forms, with or without
   13  * modification, are permitted provided that the following conditions
   14  * are met:
   15  *
   16  * 1. Redistributions of source code must retain the above copyright notice,
   17  *    this list of conditions and the following disclaimer.
   18  *
   19  * 2. Redistributions in binary form must reproduce the above copyright
   20  *    notice, this list of conditions and the following disclaimer in the
   21  *    documentation and/or other materials provided with the distribution.
   22  *
   23  * 3. Neither the name of the copyright holder nor the names of its
   24  *    contributors may be used to endorse or promote products derived from
   25  *    this software without specific prior written permission.
   26  *
   27  * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   28  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   29  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   30  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
   31  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   32  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   33  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   34  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   35  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   36  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   37  * POSSIBILITY OF SUCH DAMAGE.
   38  */
   39 
   40 
   41 #ifndef KEYMAP_H
   42 #   define KEYMAP_H 1
   43 
   44 /* Revised 9 October 1996 by Branden Robinson in ASCII order
   45  *
   46  *        Oct   Dec   Hex   Char           Oct   Dec   Hex   Char
   47  *        ------------------------------------------------------------
   48  *        000   0     00    NUL '\0'       100   64    40    @
   49  *        001   1     01    SOH      ^A    101   65    41    A
   50  *        002   2     02    STX      ^B    102   66    42    B
   51  *        003   3     03    ETX      ^C    103   67    43    C
   52  *        004   4     04    EOT      ^D    104   68    44    D
   53  *        005   5     05    ENQ      ^E    105   69    45    E
   54  *        006   6     06    ACK      ^F    106   70    46    F
   55  *        007   7     07    BEL '\a' ^G    107   71    47    G
   56  *        010   8     08    BS  '\b' ^H    110   72    48    H
   57  *        011   9     09    HT  '\t' ^I    111   73    49    I
   58  *        012   10    0A    LF  '\n' ^J    112   74    4A    J
   59  *        013   11    0B    VT  '\v' ^K    113   75    4B    K
   60  *        014   12    0C    FF  '\f' ^L    114   76    4C    L
   61  *        015   13    0D    CR  '\r' ^M    115   77    4D    M
   62  *        016   14    0E    SO       ^N    116   78    4E    N
   63  *        017   15    0F    SI       ^O    117   79    4F    O
   64  *        020   16    10    DLE      ^P    120   80    50    P
   65  *        021   17    11    DC1      ^Q    121   81    51    Q
   66  *        022   18    12    DC2      ^R    122   82    52    R
   67  *        023   19    13    DC3      ^S    123   83    53    S
   68  *        024   20    14    DC4      ^T    124   84    54    T
   69  *        025   21    15    NAK      ^U    125   85    55    U
   70  *        026   22    16    SYN      ^V    126   86    56    V
   71  *        027   23    17    ETB      ^W    127   87    57    W
   72  *        030   24    18    CAN      ^X    130   88    58    X
   73  *        031   25    19    EM       ^Y    131   89    59    Y
   74  *        032   26    1A    SUB      ^Z    132   90    5A    Z
   75  *        033   27    1B    ESC            133   91    5B    [
   76  *        034   28    1C    FS             134   92    5C    \   '\\'
   77  *        035   29    1D    GS             135   93    5D    ]
   78  *        036   30    1E    RS             136   94    5E    ^
   79  *        037   31    1F    US             137   95    5F    _
   80  *        040   32    20    SPACE          140   96    60    `
   81  *        041   33    21    !              141   97    61    a
   82  *        042   34    22    "              142   98    62    b
   83  *        043   35    23    #              143   99    63    c
   84  *        044   36    24    $              144   100   64    d
   85  *        045   37    25    %              145   101   65    e
   86  *        046   38    26    &              146   102   66    f
   87  *        047   39    27    '              147   103   67    g
   88  *        050   40    28    (              150   104   68    h
   89  *        051   41    29    )              151   105   69    i
   90  *        052   42    2A    *              152   106   6A    j
   91  *        053   43    2B    +              153   107   6B    k
   92  *        054   44    2C    ,              154   108   6C    l
   93  *        055   45    2D    -              155   109   6D    m
   94  *        056   46    2E    .              156   110   6E    n
   95  *        057   47    2F    /              157   111   6F    o
   96  *        060   48    30    0              160   112   70    p
   97  *        061   49    31    1              161   113   71    q
   98  *        062   50    32    2              162   114   72    r
   99  *        063   51    33    3              163   115   73    s
  100  *        064   52    34    4              164   116   74    t
  101  *        065   53    35    5              165   117   75    u
  102  *        066   54    36    6              166   118   76    v
  103  *        067   55    37    7              167   119   77    w
  104  *        070   56    38    8              170   120   78    x
  105  *        071   57    39    9              171   121   79    y
  106  *        072   58    3A    :              172   122   7A    z
  107  *        073   59    3B    ;              173   123   7B    {
  108  *        074   60    3C    <              174   124   7C    |
  109  *        075   61    3D    =              175   125   7D    }
  110  *        076   62    3E    >              176   126   7E    ~
  111  *        077   63    3F    ?              177   127   7F    DEL
  112  *
  113  * Above chart reprinted from Linux manual page.
  114  *
  115  * When adding key functionality, be aware of key functions in the "big five"
  116  * levels of tin operation: top (group selection), group, thread, article
  117  * (pager), and help.  If possible, when adding a key to any of these levels,
  118  * check the others to make sure that the key doesn't do something
  119  * non-analogous elsewhere.  For instance, having "^R" map to "redraw screen"
  120  * at article level and "reset .newsrc" (a drastic and unreversible action)
  121  * at top level is a bad idea.
  122  *
  123  * [make emacs happy: "]
  124  */
  125 
  126 /*
  127  * Maximum chars (including null byte) needed to print a key name
  128  * A multibyte character can use up to MB_CUR_MAX chars. But as MB_CUR_MAX
  129  * can't be used here, use MB_LEN_MAX instead.
  130  * Some values for MB_LEN_MAX:
  131  * - glibc 2.3.5: 16
  132  * - gcc 4.0: 1
  133  * - icc 8.0/9.0: 8
  134  * Use the largest + 1 to be on the safe side.
  135  */
  136 #define MAXKEYLEN 17
  137 
  138 /* TODO: permanently move here from tin.h */
  139 #define ctrl(c) ((c) & 0x1F)
  140 #define ESC     27
  141 
  142 /* TODO: get rid of these remaining #define */
  143 #define iKeyAbort ESC
  144 #define iKeyQuitTin 'Q'
  145 #define iKeyQuit 'q'
  146 
  147 /* complete list of functions which can be associated with keys */
  148 enum defined_functions {
  149     NOT_ASSIGNED = 0,
  150     DIGIT_0,
  151     DIGIT_1,
  152     DIGIT_2,
  153     DIGIT_3,
  154     DIGIT_4,
  155     DIGIT_5,
  156     DIGIT_6,
  157     DIGIT_7,
  158     DIGIT_8,
  159     DIGIT_9,
  160     ATTACHMENT_PIPE,
  161     ATTACHMENT_SAVE,
  162     ATTACHMENT_SELECT,
  163     ATTACHMENT_TAG,
  164     ATTACHMENT_TAG_PATTERN,
  165     ATTACHMENT_TOGGLE_TAGGED,
  166     ATTACHMENT_UNTAG,
  167     SPECIAL_CATCHUP_LEFT,
  168     SPECIAL_MOUSE_TOGGLE,
  169     CATCHUP,
  170     CATCHUP_NEXT_UNREAD,
  171     CONFIG_RESET_ATTRIB,
  172     CONFIG_SCOPE_MENU,
  173     CONFIG_SELECT,
  174     CONFIG_NO_SAVE,
  175     CONFIG_TOGGLE_ATTRIB,
  176     FEED_ARTICLE,
  177     FEED_THREAD,
  178     FEED_HOT,
  179     FEED_PATTERN,
  180     FEED_RANGE,
  181     FEED_TAGGED,
  182     FEED_KEY_REPOST,
  183     FEED_SUPERSEDE,
  184     FILTER_EDIT,
  185     FILTER_SAVE,
  186     GLOBAL_ABORT,
  187     GLOBAL_BUGREPORT,
  188     GLOBAL_DISPLAY_POST_HISTORY,
  189     GLOBAL_EDIT_FILTER,
  190     GLOBAL_FIRST_PAGE,
  191     GLOBAL_HELP,
  192     GLOBAL_LAST_PAGE,
  193     GLOBAL_LAST_VIEWED,
  194     GLOBAL_LINE_DOWN,
  195     GLOBAL_LINE_UP,
  196     GLOBAL_LOOKUP_MESSAGEID,
  197     GLOBAL_MENU_FILTER_KILL,
  198     GLOBAL_MENU_FILTER_SELECT,
  199     GLOBAL_OPTION_MENU,
  200     GLOBAL_PAGE_DOWN,
  201     GLOBAL_PAGE_UP,
  202     GLOBAL_PIPE,
  203     GLOBAL_POST,
  204     GLOBAL_POSTPONED,
  205 #ifndef DISABLE_PRINTING
  206     GLOBAL_PRINT,
  207 #endif /* !DISABLE_PRINTING */
  208     GLOBAL_QUICK_FILTER_KILL,
  209     GLOBAL_QUICK_FILTER_SELECT,
  210     GLOBAL_QUIT,
  211     GLOBAL_QUIT_TIN,
  212     GLOBAL_REDRAW_SCREEN,
  213     GLOBAL_SCROLL_DOWN,
  214     GLOBAL_SCROLL_UP,
  215     GLOBAL_SEARCH_BODY,
  216     GLOBAL_SEARCH_REPEAT,
  217     GLOBAL_SEARCH_AUTHOR_BACKWARD,
  218     GLOBAL_SEARCH_AUTHOR_FORWARD,
  219     GLOBAL_SEARCH_SUBJECT_BACKWARD,
  220     GLOBAL_SEARCH_SUBJECT_FORWARD,
  221     GLOBAL_SET_RANGE,
  222 #ifndef NO_SHELL_ESCAPE
  223     GLOBAL_SHELL_ESCAPE,
  224 #endif /* !NO_SHELL_ESCAPE */
  225 #ifdef HAVE_COLOR
  226     GLOBAL_TOGGLE_COLOR,
  227 #endif /* HAVE_COLOR */
  228     GLOBAL_TOGGLE_HELP_DISPLAY,
  229     GLOBAL_TOGGLE_INFO_LAST_LINE,
  230     GLOBAL_TOGGLE_INVERSE_VIDEO,
  231     GLOBAL_VERSION,
  232     GROUP_AUTOSAVE,
  233     GROUP_CANCEL,
  234     GROUP_DO_AUTOSELECT,
  235     GROUP_GOTO,
  236     GROUP_LIST_THREAD,
  237     GROUP_MAIL,
  238     GROUP_MARK_THREAD_READ,
  239     GROUP_MARK_UNSELECTED_ARTICLES_READ,
  240     GROUP_NEXT_GROUP,
  241     GROUP_NEXT_UNREAD_ARTICLE,
  242     GROUP_NEXT_UNREAD_ARTICLE_OR_GROUP,
  243     GROUP_PREVIOUS_GROUP,
  244     GROUP_PREVIOUS_UNREAD_ARTICLE,
  245     GROUP_READ_BASENOTE,
  246     GROUP_REPOST,
  247     GROUP_REVERSE_SELECTIONS,
  248     GROUP_SAVE,
  249     GROUP_SELECT_PATTERN,
  250     GROUP_SELECT_THREAD,
  251     GROUP_SELECT_THREAD_IF_UNREAD_SELECTED,
  252     GROUP_TAG,
  253     GROUP_TAG_PARTS,
  254     GROUP_TOGGLE_GET_ARTICLES_LIMIT,
  255     GROUP_TOGGLE_READ_UNREAD,
  256     GROUP_TOGGLE_SUBJECT_DISPLAY,
  257     GROUP_TOGGLE_SELECT_THREAD,
  258     GROUP_TOGGLE_THREADING,
  259     GROUP_UNDO_SELECTIONS,
  260     GROUP_UNTAG,
  261     MARK_ARTICLE_UNREAD,
  262     MARK_THREAD_UNREAD,
  263     MARK_FEED_READ,
  264     MARK_FEED_UNREAD,
  265     PAGE_AUTOSAVE,
  266     PAGE_BOTTOM_THREAD,
  267     PAGE_CANCEL,
  268     PAGE_EDIT_ARTICLE,
  269     PAGE_FOLLOWUP,
  270     PAGE_FOLLOWUP_QUOTE,
  271     PAGE_FOLLOWUP_QUOTE_HEADERS,
  272     PAGE_GOTO_PARENT,
  273     PAGE_GROUP_SELECT,
  274     PAGE_LIST_THREAD,
  275     PAGE_MAIL,
  276     PAGE_MARK_THREAD_READ,
  277     PAGE_NEXT_ARTICLE,
  278     PAGE_NEXT_THREAD,
  279     PAGE_NEXT_UNREAD,
  280     PAGE_NEXT_UNREAD_ARTICLE,
  281 #ifdef HAVE_PGP_GPG
  282     PAGE_PGP_CHECK_ARTICLE,
  283 #endif /* HAVE_PGP_GPG */
  284     PAGE_PREVIOUS_ARTICLE,
  285     PAGE_PREVIOUS_UNREAD_ARTICLE,
  286     PAGE_REVEAL,
  287     PAGE_REPLY,
  288     PAGE_REPLY_QUOTE,
  289     PAGE_REPLY_QUOTE_HEADERS,
  290     PAGE_REPOST,
  291     PAGE_SAVE,
  292     PAGE_SKIP_INCLUDED_TEXT,
  293     PAGE_TAG,
  294     PAGE_TOGGLE_HEADERS,
  295     PAGE_TOGGLE_HIGHLIGHTING,
  296     PAGE_TOGGLE_RAW,
  297     PAGE_TOGGLE_ROT13,
  298     PAGE_TOGGLE_TABS,
  299     PAGE_TOGGLE_TEX2ISO,
  300     PAGE_TOGGLE_UUE,
  301     PAGE_TOP_THREAD,
  302     PAGE_VIEW_ATTACHMENTS,
  303     PAGE_VIEW_URL,
  304 #ifdef HAVE_PGP_GPG
  305     PGP_KEY_ENCRYPT,
  306     PGP_KEY_ENCRYPT_SIGN,
  307     PGP_INCLUDE_KEY,
  308     PGP_KEY_SIGN,
  309 #endif /* HAVE_PGP_GPG */
  310     POST_ABORT,
  311     POST_CANCEL,
  312     POST_CONTINUE,
  313     POST_EDIT,
  314     POST_IGNORE_FUPTO,
  315 #ifdef HAVE_ISPELL
  316     POST_ISPELL,
  317 #endif /* HAVE_ISPELL */
  318     POST_MAIL,
  319 #ifdef HAVE_PGP_GPG
  320     POST_PGP,
  321 #endif /* HAVE_PGP_GPG */
  322     POST_POSTPONE,
  323     POST_SEND,
  324     POST_SUPERSEDE,
  325     POSTPONE_ALL,
  326     POSTPONE_OVERRIDE,
  327     POSTPROCESS_NO,
  328     POSTPROCESS_SHAR,
  329     POSTPROCESS_YES,
  330     PROMPT_NO,
  331     PROMPT_YES,
  332     SAVE_APPEND_FILE,
  333     SAVE_OVERWRITE_FILE,
  334     SCOPE_ADD,
  335     SCOPE_DELETE,
  336     SCOPE_EDIT_ATTRIBUTES_FILE,
  337     SCOPE_MOVE,
  338     SCOPE_RENAME,
  339     SCOPE_SELECT,
  340     SELECT_ENTER_GROUP,
  341     SELECT_ENTER_NEXT_UNREAD_GROUP,
  342     SELECT_GOTO,
  343     SELECT_MARK_GROUP_UNREAD,
  344     SELECT_MOVE_GROUP,
  345     SELECT_NEXT_UNREAD_GROUP,
  346     SELECT_RESET_NEWSRC,
  347     SELECT_SORT_ACTIVE,
  348     SELECT_SUBSCRIBE,
  349     SELECT_SUBSCRIBE_PATTERN,
  350     SELECT_SYNC_WITH_ACTIVE,
  351     SELECT_TOGGLE_DESCRIPTIONS,
  352     SELECT_TOGGLE_READ_DISPLAY,
  353     SELECT_UNSUBSCRIBE,
  354     SELECT_UNSUBSCRIBE_PATTERN,
  355     SELECT_QUIT_NO_WRITE,
  356     SELECT_YANK_ACTIVE,
  357     THREAD_AUTOSAVE,
  358     THREAD_CANCEL,
  359     THREAD_MAIL,
  360     THREAD_MARK_ARTICLE_READ,
  361     THREAD_READ_NEXT_ARTICLE_OR_THREAD,
  362     THREAD_READ_ARTICLE,
  363     THREAD_REVERSE_SELECTIONS,
  364     THREAD_SAVE,
  365     THREAD_SELECT_ARTICLE,
  366     THREAD_TAG,
  367     THREAD_TOGGLE_ARTICLE_SELECTION,
  368     THREAD_TOGGLE_SUBJECT_DISPLAY,
  369     THREAD_UNDO_SELECTIONS,
  370     THREAD_UNTAG,
  371     URL_SELECT
  372 };
  373 typedef enum defined_functions t_function;
  374 
  375 
  376 struct keynode {
  377 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
  378     wchar_t key;
  379 #else
  380     char key;
  381 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
  382     t_function function;
  383 };
  384 
  385 
  386 struct keylist {
  387     struct keynode *list;
  388     size_t used;
  389     size_t max;
  390 };
  391 
  392 
  393 extern struct keylist attachment_keys;
  394 extern struct keylist feed_post_process_keys;
  395 extern struct keylist feed_supersede_article_keys;
  396 extern struct keylist feed_type_keys;
  397 extern struct keylist filter_keys;
  398 extern struct keylist group_keys;
  399 extern struct keylist info_keys;
  400 extern struct keylist option_menu_keys;
  401 extern struct keylist page_keys;
  402 #ifdef HAVE_PGP_GPG
  403     extern struct keylist pgp_mail_keys;
  404     extern struct keylist pgp_news_keys;
  405 #endif /* HAVE_PGP_GPG */
  406 extern struct keylist post_cancel_keys;
  407 extern struct keylist post_continue_keys;
  408 extern struct keylist post_delete_keys;
  409 extern struct keylist post_edit_keys;
  410 extern struct keylist post_edit_ext_keys;
  411 extern struct keylist post_ignore_fupto_keys;
  412 extern struct keylist post_mail_fup_keys;
  413 extern struct keylist post_post_keys;
  414 extern struct keylist post_postpone_keys;
  415 extern struct keylist post_send_keys;
  416 extern struct keylist prompt_keys;
  417 extern struct keylist save_append_overwrite_keys;
  418 extern struct keylist scope_keys;
  419 extern struct keylist select_keys;
  420 extern struct keylist thread_keys;
  421 extern struct keylist url_keys;
  422 
  423 
  424 extern t_function global_mouse_action(t_function (*left_action) (void), t_function (*right_action) (void));
  425 extern t_function handle_keypad(
  426     t_function (*left_action) (void),
  427     t_function (*right_action) (void),
  428     t_function (*mouse_action) (
  429         t_function (*left_action) (void),
  430         t_function (*right_action) (void)),
  431     const struct keylist keys);
  432 extern t_function prompt_slk_response(t_function default_func, const struct keylist keys, const char *fmt, ...);
  433 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
  434     extern char *printascii(char *buf, wint_t ch);
  435     extern wchar_t func_to_key(t_function func, const struct keylist keys);
  436     extern t_function key_to_func(const wchar_t key, const struct keylist keys);
  437 #else
  438     extern char *printascii(char *buf, int ch);
  439     extern char func_to_key (t_function func, const struct keylist keys);
  440     extern t_function key_to_func (const char key, const struct keylist keys);
  441 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
  442 #endif /* !KEYMAP_H */