X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=readline%2Fkeymaps.h;h=af8d5d997d4b7de21ebc4f3bc13c3ea0169a6f31;hb=6ff5a0f675d5a806dfd7f9671d72727d1c30cde2;hp=3c577b398f59c09ee0dfad8ed77536fabfef7a70;hpb=bd5635a1e2b38ee8432fcdaa6456079191375277;p=platform%2Fupstream%2Fbinutils.git diff --git a/readline/keymaps.h b/readline/keymaps.h index 3c577b3..af8d5d9 100644 --- a/readline/keymaps.h +++ b/readline/keymaps.h @@ -1,31 +1,58 @@ /* keymaps.h -- Manipulation of readline keymaps. */ +/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc. + + This file is part of the GNU Readline Library (Readline), a library + for reading lines of text with interactive input and history editing. + + Readline is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Readline is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Readline. If not, see . +*/ + #ifndef _KEYMAPS_H_ #define _KEYMAPS_H_ -#include +#ifdef __cplusplus +extern "C" { +#endif -#ifndef __FUNCTION_DEF -typedef int Function (); -#define __FUNCTION_DEF +#if defined (READLINE_LIBRARY) +# include "rlstdc.h" +# include "chardefs.h" +# include "rltypedefs.h" +#else +# include +# include +# include #endif /* A keymap contains one entry for each key in the ASCII set. Each entry consists of a type and a pointer. - POINTER is the address of a function to run, or the + FUNCTION is the address of a function to run, or the address of a keymap to indirect through. - TYPE says which kind of thing POINTER is. */ + TYPE says which kind of thing FUNCTION is. */ typedef struct _keymap_entry { char type; - Function *function; + rl_command_func_t *function; } KEYMAP_ENTRY; -/* I wanted to make the above structure contain a union of: - union { Function *function; struct _keymap_entry *keymap; } value; - but this made it impossible for me to create a static array. - Maybe I need C lessons. */ +/* This must be large enough to hold bindings for all of the characters + in a desired character set (e.g, 128 for ASCII, 256 for ISO Latin-x, + and so on) plus one for subsequence matching. */ +#define KEYMAP_SIZE 257 +#define ANYOTHERKEY KEYMAP_SIZE-1 -typedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[128]; +typedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[KEYMAP_SIZE]; typedef KEYMAP_ENTRY *Keymap; /* The values that TYPE can have in a keymap entry. */ @@ -38,16 +65,33 @@ extern KEYMAP_ENTRY_ARRAY vi_insertion_keymap, vi_movement_keymap; /* Return a new, empty keymap. Free it with free() when you are done. */ -Keymap rl_make_bare_keymap (); +extern Keymap rl_make_bare_keymap PARAMS((void)); /* Return a new keymap which is a copy of MAP. */ -Keymap rl_copy_keymap (); +extern Keymap rl_copy_keymap PARAMS((Keymap)); /* Return a new keymap with the printing characters bound to rl_insert, the lowercase Meta characters bound to run their equivalents, and the Meta digits bound to produce numeric arguments. */ -Keymap rl_make_keymap (); +extern Keymap rl_make_keymap PARAMS((void)); -#endif /* _KEYMAPS_H_ */ +/* Free the storage associated with a keymap. */ +extern void rl_discard_keymap PARAMS((Keymap)); +/* These functions actually appear in bind.c */ +/* Return the keymap corresponding to a given name. Names look like + `emacs' or `emacs-meta' or `vi-insert'. */ +extern Keymap rl_get_keymap_by_name PARAMS((const char *)); + +/* Return the current keymap. */ +extern Keymap rl_get_keymap PARAMS((void)); + +/* Set the current keymap to MAP. */ +extern void rl_set_keymap PARAMS((Keymap)); + +#ifdef __cplusplus +} +#endif + +#endif /* _KEYMAPS_H_ */