"Fossies" - the Fresh Open Source Software Archive

Member "tin-2.4.1/include/keymap.h" (12 Oct 2016, 14068 Bytes) of package /linux/misc/tin-2.4.1.tar.gz:


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.0_vs_2.4.1.

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