/*	Copyright (C) 1990 Free Software Foundation, Inc.

This file is part of Oleo, the GNU Spreadsheet.

Oleo 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 1, or (at your option)
any later version.

Oleo 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 Oleo; see the file COPYING.  If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */


struct key {
	unsigned char vector;
	unsigned char code;
};

/* if Map_Malloc is nonzero, the Keys entry can be realloc'ed and scribbled
   on.  This is used when re-binding keys.

   If Map_Dense, there should be only one Keys element, and it applies to
   *all* the values from Lochr to Hichr (this is used to cheaply implement
   self-insert, etc. */

/* Map_End marks the end of a keymap, and means that map_next points to
   another keymap to try if it didn't find a match in this one. */

struct keymap {
	struct keymap *map_next;
	char map_end;
	char map_dense;
	char map_malloc;
	unsigned char lochr;
	unsigned char hichr;
	struct key *keys;	/* Should really be a variable-sized array,
					but C doesn't handle them well, so. . . */
};
extern int num_maps;
extern struct keymap **the_maps;

struct cmd_func {
	char	*func_name;
	char	*func_args;
	int	func_flags;
	void	(*func_func)();
};

extern int num_funcs;
extern struct cmd_func **the_funcs;

/* JF: In a keymap, vector!=255 means it's the command in
   the_funcs[vector][code];
   else we switch to keymap the_maps[code]; and read a new char. . .

   Note that this means no more than 255 cmd vectors, and no more than
   256 cmds per vector, also no more than 256 keymaps.  These should not be
   serious limitations. . . */

#define MAIN_MAP 0
#define META_MAP 1
#define EDIT_MAP 2
#define EDIT_META_MAP 3
#define ANSI_MAP 4
#define DIGIT_MAP 5

#define UNBOUND		0

