* harbour/Makefile
+ harbour/make_bsd.sh
+ harbour/make_drw.sh
* harbour/make_tgz.sh
+ harbour/bin/hb-func.sh
* harbour/bin/pack_src.sh
+ harbour/bin/postinst.bat
+ harbour/bin/postinst.sh
* harbour/config/dir.cf
* harbour/config/bsd/gcc.cf
* harbour/config/bsd/global.cf
+ harbour/config/darwin/dir.cf
+ harbour/config/darwin/gcc.cf
+ harbour/config/darwin/global.cf
+ harbour/config/darwin/install.cf
* harbour/config/dos/dir.cf
* harbour/config/dos/global.cf
* harbour/config/dos/install.cf
* harbour/config/dos/owatcom.cf
* harbour/config/dos/watcom.cf
* harbour/config/linux/gcc.cf
* harbour/config/linux/global.cf
* harbour/contrib/Makefile
* harbour/contrib/dot/pp_harb.ch
* harbour/contrib/libct/Makefile
* harbour/contrib/libct/bit1.c
* harbour/contrib/libct/bit2.c
* harbour/contrib/libct/bit3.c
* harbour/contrib/libct/files.c
* harbour/contrib/libct/ftoc.c
- harbour/contrib/libct/invertwin.prg
+ harbour/contrib/libct/invrtwin.prg
* harbour/contrib/libct/keyset.c
* harbour/contrib/libct/makefile.bc
* harbour/contrib/libmisc/dates2.c
* harbour/contrib/rdd_ads/ads1.c
* harbour/contrib/rdd_ads/adsfunc.c
* harbour/contrib/samples/date.c
* harbour/include/dbinfo.ch
* harbour/include/hbapi.h
* harbour/include/hbapicdp.h
* harbour/include/hbapifs.h
* harbour/include/hbapigt.h
* harbour/include/hbapiitm.h
* harbour/include/hbcomp.h
* harbour/include/hbdate.h
* harbour/include/hbdbf.h
* harbour/include/hbdbferr.h
* harbour/include/hbdefs.h
* harbour/include/hbexprb.c
* harbour/include/hbexprc.c
* harbour/include/hbexprop.h
* harbour/include/hbmacro.h
* harbour/include/hbmath.h
* harbour/include/hbpcode.h
* harbour/include/hbrddcdx.h
* harbour/include/hbrdddbf.h
* harbour/include/hbrdddbt.h
* harbour/include/hbrddfpt.h
* harbour/include/hbrddntx.h
* harbour/include/hbset.h
* harbour/include/hbsetup.h
* harbour/include/set.ch
* harbour/source/common/Makefile
* harbour/source/common/expropt1.c
* harbour/source/common/expropt2.c
- harbour/source/common/hbffind.c
* harbour/source/common/hbfsapi.c
* harbour/source/common/hbstr.c
* harbour/source/common/hbver.c
+ harbour/source/common/hbverdsp.c
* harbour/source/compiler/genc.c
* harbour/source/compiler/gencli.c
* harbour/source/compiler/harbour.c
* harbour/source/compiler/harbour.l
* harbour/source/compiler/harbour.slx
* harbour/source/compiler/harbour.sly
* harbour/source/compiler/harbour.y
* harbour/source/compiler/hbfix.c
* harbour/source/compiler/hbpcode.c
* harbour/source/compiler/hbusage.c
* harbour/source/compiler/simplex.c
* harbour/source/macro/macro.l
* harbour/source/macro/macro.slx
* harbour/source/macro/macro.y
* harbour/source/pp/ppcore.c
* harbour/source/rdd/dbcmd.c
* harbour/source/rdd/dbf1.c
* harbour/source/rdd/dbfcdx/dbfcdx1.c
- harbour/source/rdd/dbfcdx/dbfcdx1.h
* harbour/source/rdd/dbffpt/dbffpt1.c
* harbour/source/rdd/dbfntx/dbfntx1.c
* harbour/source/rtl/Makefile
* harbour/source/rtl/abs.c
* harbour/source/rtl/at.c
* harbour/source/rtl/datec.c
* harbour/source/rtl/dates.c
* harbour/source/rtl/dateshb.c
* harbour/source/rtl/datesx.c
* harbour/source/rtl/empty.c
* harbour/source/rtl/errorapi.c
* harbour/source/rtl/errorint.c
* harbour/source/rtl/filesys.c
* harbour/source/rtl/fstemp.c
+ harbour/source/rtl/hbffind.c
* harbour/source/rtl/hbrandom.c
* harbour/source/rtl/idle.c
* harbour/source/rtl/inkey.c
* harbour/source/rtl/math.c
* harbour/source/rtl/minmax.c
* harbour/source/rtl/pad.c
* harbour/source/rtl/padc.c
* harbour/source/rtl/padl.c
* harbour/source/rtl/padr.c
* harbour/source/rtl/philes.c
* harbour/source/rtl/round.c
* harbour/source/rtl/soundex.c
* harbour/source/rtl/str.c
* harbour/source/rtl/strcase.c
* harbour/source/rtl/strmatch.c
* harbour/source/rtl/strtran.c
* harbour/source/rtl/strzero.c
* harbour/source/rtl/substr.c
* harbour/source/rtl/val.c
* harbour/source/rtl/gtcrs/gtcrs.c
* harbour/source/rtl/gtcrs/kbdcrs.c
* harbour/source/rtl/gtdos/gtdos.c
* harbour/source/rtl/gtsln/gtsln.c
* harbour/source/rtl/gtsln/kbsln.c
* harbour/source/rtl/gtsln/keytrans.c
* harbour/source/vm/arrays.c
* harbour/source/vm/codebloc.c
* harbour/source/vm/estack.c
* harbour/source/vm/eval.c
* harbour/source/vm/extend.c
* harbour/source/vm/hvm.c
* harbour/source/vm/itemapi.c
* harbour/source/vm/macro.c
* harbour/source/vm/memvars.c
* harbour/source/vm/runner.c
* harbour/tests/bldtest/bldtest.c
* harbour/utils/hbtest/hbtest.prg
* harbour/utils/hbtest/rt_misc.prg
* harbour/utils/hbtest/rt_str.prg
* Sorry but it's too much modification for full description
cvs diff gives file 785982 bytes length. So I only count the
main things:
! cleand the code (no more warning messages under Linux and GCC and
DOS OpenWatcom) - some of them were real bugs
! cleaned all endian dependend code I've found - now Harbour can be
compiled on LITLE and BIG endian machines - for some other like
PDP ENDIAN it's enough to define proper macros in hbdefs.h
+ added macros for to get/put values in chosen byte order:
HB_GET_LE_[U]INT{16,24,32,64}( pPtr )
HB_GET_BE_[U]INT{16,24,32,64}( pPtr )
HB_PUT_LE_[U]INT{16,24,32,64}( pPtr, nVal )
HB_PUT_BE_[U]INT{16,24,32,64}( pPtr, nVal )
+ added macro HB_CAST_BYTE_NUMBERS_OFF which disables casting in
HB_{GET|PUT}_{LE|BE}_* macros - it's necessary for some platforms
like ALPHA DEC.
! cleaned the code for 64bit machines
* changed all parameters in hb_date* functions (day, month, year, week)
from LONG to int - it doesn't change binary compatibility for 32bit
machines but can cause troubles with compiling the old source
+ changed HB_IT_LONG type to HB_LONG which is mapped to long long
by default for 32 bit machines.
+ change HB_IT_INTEGER to be real 'int' C type not 'short int'
+ added HB_IS_NUMINT() macro
+ added hb_parnll, hb_stornll, hb_retnll, hbretnlllen, hb_itemPutNLL,
hb_itemPutNLLLen, hb_itemGetNLL which operates on LONGLONG
+ added hb_parnint, hb_stornint, hb_retnint, hb_retnintlen,
hb_itemPutNInt, hb_itemPutNIntLen, hb_itemGetNInt which operates on
HB_LONG
+ added HB_PUSHLONGLONG pcode
+ changed compiler and optimizer to use HB_LONG numbers and reduce
conversion from to double which may damage the 64bit number.
+ common functions for string to number conversions for compiler, RTL
and RDD to reduce problems with differ FL values for the same number:
hb_compStrToNum(), hb_valStrnToNum(), hb_strToNum(), hb_strnToNum()
+ common function hb_numRoun() which uses exactly the same algorithms
as string to number conversion for the same reason - please keep
this functions together.
+ hack inside hb_numRound() similar to the one used by CL5.3
+ hb_numInt() which uses uses the same hack as hb_numRound()
+ rewritten number to string conversion
+ some new string manipulation functions hb_strncpy(), hb_strncat(), ...
They works differ the the C one - always set 0 at the end, the buffer
has to be n+1 bytes length, the n is total size of buffer not the
left free space.
! cleaned some code which operates on ASCIIZ string to avoid potential
buffer overflow
+ updated RDD code - it's the first part - in few days I plan to change
workarea structure in both projects - it will break any 3rd party RDDs
so they have to be updated. I want to add SUPERTABLE into workarea
to allow creating new RDD on-line.
! cleaned the bugs with negating integers - on most machines (like x86)
the integers are not 0 symmetric - it means that x = -x does not work
for {INT,LONG,LONGLONG}_MIN (hb_vmNegate, ABS())
+ cleaned error messages to be Clipper compatible.
+ updated build process for .DEB packages - now hb* scripts and shared
libs are created by standard make install
* added new .prg #defines: __PLATFORM__<cPlatfrom>,
__ARCH{16|32|64}BIT__, __LITTLE_ENDIAN__|__BIG_ENDIAN__|__PDP_ENDIAN__
!!! cPlatfrom can have lower letters (for xHarbour compatibility)
If you do not like it please change it.
* others ...
465 lines
19 KiB
C
465 lines
19 KiB
C
/*
|
|
* $Id$
|
|
*/
|
|
|
|
/*
|
|
* Harbour Project source code:
|
|
* Keyboard subsystem based on Slang screen library.
|
|
*
|
|
* Copyright 2000 Marek Paliwoda <paliwoda@inetia.pl>
|
|
* www - http://www.harbour-project.org
|
|
*
|
|
* This program 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 2, or (at your option)
|
|
* any later version.
|
|
*
|
|
* This program 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 this software; see the file COPYING. If not, write to
|
|
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
|
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
|
|
*
|
|
* As a special exception, the Harbour Project gives permission for
|
|
* additional uses of the text contained in its release of Harbour.
|
|
*
|
|
* The exception is that, if you link the Harbour libraries with other
|
|
* files to produce an executable, this does not by itself cause the
|
|
* resulting executable to be covered by the GNU General Public License.
|
|
* Your use of that executable is in no way restricted on account of
|
|
* linking the Harbour library code into it.
|
|
*
|
|
* This exception does not however invalidate any other reasons why
|
|
* the executable file might be covered by the GNU General Public License.
|
|
*
|
|
* This exception applies only to the code released by the Harbour
|
|
* Project under the name Harbour. If you copy code from other
|
|
* Harbour Project or Free Software Foundation releases into a copy of
|
|
* Harbour, as the General Public License permits, the exception does
|
|
* not apply to the code that you add in this way. To avoid misleading
|
|
* anyone as to the status of such modified files, you must delete
|
|
* this exception notice from them.
|
|
*
|
|
* If you write modifications of your own for Harbour, it is your choice
|
|
* whether to permit this exception to apply to your modifications.
|
|
* If you do not wish that, delete this exception notice.
|
|
*
|
|
*/
|
|
|
|
/* *********************************************************************** */
|
|
|
|
/* a shortcut only */
|
|
#define CTRL_PRESSED CONTROL_PRESSED
|
|
|
|
/* *********************************************************************** */
|
|
|
|
/* a table of keys translation */
|
|
static int KeyTranslationTable[][ 2 ] =
|
|
{
|
|
{ SL_KEY_UP, K_UP },
|
|
{ SL_KEY_DOWN, K_DOWN },
|
|
{ SL_KEY_LEFT, K_LEFT },
|
|
{ SL_KEY_RIGHT, K_RIGHT },
|
|
{ SL_KEY_HOME, K_HOME },
|
|
{ SL_KEY_END, K_END },
|
|
{ SL_KEY_PPAGE, K_PGUP },
|
|
{ SL_KEY_NPAGE, K_PGDN },
|
|
|
|
#if HB_GT_KBD_MODIF_MASK
|
|
{ SL_KEY_UP | ( CTRL_PRESSED << 16 ), K_CTRL_UP },
|
|
{ SL_KEY_DOWN | ( CTRL_PRESSED << 16 ), K_CTRL_DOWN },
|
|
{ SL_KEY_LEFT | ( CTRL_PRESSED << 16 ), K_CTRL_LEFT },
|
|
{ SL_KEY_RIGHT | ( CTRL_PRESSED << 16 ), K_CTRL_RIGHT },
|
|
{ SL_KEY_HOME | ( CTRL_PRESSED << 16 ), K_CTRL_HOME },
|
|
{ SL_KEY_END | ( CTRL_PRESSED << 16 ), K_CTRL_END },
|
|
{ SL_KEY_PPAGE | ( CTRL_PRESSED << 16 ), K_CTRL_PGUP },
|
|
{ SL_KEY_NPAGE | ( CTRL_PRESSED << 16 ), K_CTRL_PGDN },
|
|
|
|
{ SL_KEY_UP | ( ALTL_PRESSED << 16 ), K_ALT_UP },
|
|
{ SL_KEY_DOWN | ( ALTL_PRESSED << 16 ), K_ALT_DOWN },
|
|
{ SL_KEY_LEFT | ( ALTL_PRESSED << 16 ), K_ALT_LEFT },
|
|
{ SL_KEY_RIGHT | ( ALTL_PRESSED << 16 ), K_ALT_RIGHT },
|
|
{ SL_KEY_HOME | ( ALTL_PRESSED << 16 ), K_ALT_HOME },
|
|
{ SL_KEY_END | ( ALTL_PRESSED << 16 ), K_ALT_END },
|
|
{ SL_KEY_PPAGE | ( ALTL_PRESSED << 16 ), K_ALT_PGUP },
|
|
{ SL_KEY_NPAGE | ( ALTL_PRESSED << 16 ), K_ALT_PGDN },
|
|
#endif
|
|
|
|
{ SL_KEY_IC, K_INS },
|
|
{ SL_KEY_ESC, K_ESC },
|
|
{ SL_KEY_DELETE, K_DEL },
|
|
{ SL_KEY_BACKSPACE, K_BS },
|
|
|
|
#if HB_GT_KBD_MODIF_MASK
|
|
{ SL_KEY_IC | ( CTRL_PRESSED << 16 ), K_CTRL_INS },
|
|
/* { SL_KEY_ESC | ( CTRL_PRESSED << 16 ), K_CTRL_ESC }, */
|
|
{ SL_KEY_DELETE | ( CTRL_PRESSED << 16 ), K_CTRL_DEL },
|
|
{ SL_KEY_BACKSPACE | ( CTRL_PRESSED << 16 ), K_CTRL_BS },
|
|
/*
|
|
{ K_TAB | ( CTRL_PRESSED << 16 ), K_CTRL_TAB },
|
|
??? K_CTRL_PRTSCR,
|
|
??? K_CTRL_QUESTION,
|
|
*/
|
|
|
|
{ SL_KEY_IC | ( ALTL_PRESSED << 16 ), K_ALT_INS },
|
|
{ SL_KEY_ESC | ( ALTL_PRESSED << 16 ), K_ALT_ESC },
|
|
{ SL_KEY_DELETE | ( ALTL_PRESSED << 16 ), K_ALT_DEL },
|
|
{ SL_KEY_BACKSPACE | ( ALTL_PRESSED << 16 ), K_ALT_BS },
|
|
{ K_TAB | ( ALTL_PRESSED << 16 ), K_ALT_TAB },
|
|
/* ??? K_ALT_EQUALS, */
|
|
|
|
{ '/' | ( CTRL_PRESSED << 16 ), KP_CTRL_SLASH},
|
|
{ '*' | ( CTRL_PRESSED << 16 ), KP_CTRL_ASTERISK},
|
|
{ '-' | ( CTRL_PRESSED << 16 ), KP_CTRL_MINUS},
|
|
{ '+' | ( CTRL_PRESSED << 16 ), KP_CTRL_PLUS },
|
|
{ K_ENTER | ( CTRL_PRESSED << 16 ), K_CTRL_ENTER },
|
|
{ SL_KEY_NUM_5 | ( CTRL_PRESSED << 16 ), KP_CTRL_5 },
|
|
|
|
{ '/' | ( ALTL_PRESSED << 16 ), KP_ALT_SLASH },
|
|
{ '*' | ( ALTL_PRESSED << 16 ), KP_ALT_ASTERISK},
|
|
{ '-' | ( ALTL_PRESSED << 16 ), KP_ALT_MINUS },
|
|
{ '+' | ( ALTL_PRESSED << 16 ), KP_ALT_PLUS },
|
|
{ K_ENTER | ( ALTL_PRESSED << 16 ), K_ALT_ENTER },
|
|
{ K_ENTER | ( ALTR_PRESSED << 16 ), K_ALT_ENTER },
|
|
{ SL_KEY_NUM_5 | ( ALTL_PRESSED << 16 ), KP_ALT_5 },
|
|
{ SL_KEY_NUM_5 | ( ALTR_PRESSED << 16 ), KP_ALT_5 },
|
|
{ SL_KEY_B2 | ( ALTR_PRESSED << 16 ), KP_ALT_5 },
|
|
|
|
{ K_TAB | ( SHIFT_PRESSED << 16 ), K_SH_TAB },
|
|
#endif
|
|
|
|
#if HB_GT_KBD_MODIF_MASK
|
|
#ifdef __linux__
|
|
{ SL_KEY_ALT( 'A' ) | ( ALTL_PRESSED << 16 ), K_ALT_A },
|
|
{ SL_KEY_ALT( 'B' ) | ( ALTL_PRESSED << 16 ), K_ALT_B },
|
|
{ SL_KEY_ALT( 'C' ) | ( ALTL_PRESSED << 16 ), K_ALT_C },
|
|
{ SL_KEY_ALT( 'D' ) | ( ALTL_PRESSED << 16 ), K_ALT_D },
|
|
{ SL_KEY_ALT( 'E' ) | ( ALTL_PRESSED << 16 ), K_ALT_E },
|
|
{ SL_KEY_ALT( 'F' ) | ( ALTL_PRESSED << 16 ), K_ALT_F },
|
|
{ SL_KEY_ALT( 'G' ) | ( ALTL_PRESSED << 16 ), K_ALT_G },
|
|
{ SL_KEY_ALT( 'H' ) | ( ALTL_PRESSED << 16 ), K_ALT_H },
|
|
{ SL_KEY_ALT( 'I' ) | ( ALTL_PRESSED << 16 ), K_ALT_I },
|
|
{ SL_KEY_ALT( 'J' ) | ( ALTL_PRESSED << 16 ), K_ALT_J },
|
|
{ SL_KEY_ALT( 'K' ) | ( ALTL_PRESSED << 16 ), K_ALT_K },
|
|
{ SL_KEY_ALT( 'L' ) | ( ALTL_PRESSED << 16 ), K_ALT_L },
|
|
{ SL_KEY_ALT( 'M' ) | ( ALTL_PRESSED << 16 ), K_ALT_M },
|
|
{ SL_KEY_ALT( 'N' ) | ( ALTL_PRESSED << 16 ), K_ALT_N },
|
|
{ SL_KEY_ALT( 'O' ) | ( ALTL_PRESSED << 16 ), K_ALT_O },
|
|
{ SL_KEY_ALT( 'P' ) | ( ALTL_PRESSED << 16 ), K_ALT_P },
|
|
{ SL_KEY_ALT( 'Q' ) | ( ALTL_PRESSED << 16 ), K_ALT_Q },
|
|
{ SL_KEY_ALT( 'R' ) | ( ALTL_PRESSED << 16 ), K_ALT_R },
|
|
{ SL_KEY_ALT( 'S' ) | ( ALTL_PRESSED << 16 ), K_ALT_S },
|
|
{ SL_KEY_ALT( 'T' ) | ( ALTL_PRESSED << 16 ), K_ALT_T },
|
|
{ SL_KEY_ALT( 'U' ) | ( ALTL_PRESSED << 16 ), K_ALT_U },
|
|
{ SL_KEY_ALT( 'V' ) | ( ALTL_PRESSED << 16 ), K_ALT_V },
|
|
{ SL_KEY_ALT( 'W' ) | ( ALTL_PRESSED << 16 ), K_ALT_W },
|
|
{ SL_KEY_ALT( 'X' ) | ( ALTL_PRESSED << 16 ), K_ALT_X },
|
|
{ SL_KEY_ALT( 'Y' ) | ( ALTL_PRESSED << 16 ), K_ALT_Y },
|
|
{ SL_KEY_ALT( 'Z' ) | ( ALTL_PRESSED << 16 ), K_ALT_Z },
|
|
{ SL_KEY_ALT( 'a' ) | ( ALTL_PRESSED << 16 ), K_ALT_A },
|
|
{ SL_KEY_ALT( 'b' ) | ( ALTL_PRESSED << 16 ), K_ALT_B },
|
|
{ SL_KEY_ALT( 'c' ) | ( ALTL_PRESSED << 16 ), K_ALT_C },
|
|
{ SL_KEY_ALT( 'd' ) | ( ALTL_PRESSED << 16 ), K_ALT_D },
|
|
{ SL_KEY_ALT( 'e' ) | ( ALTL_PRESSED << 16 ), K_ALT_E },
|
|
{ SL_KEY_ALT( 'f' ) | ( ALTL_PRESSED << 16 ), K_ALT_F },
|
|
{ SL_KEY_ALT( 'g' ) | ( ALTL_PRESSED << 16 ), K_ALT_G },
|
|
{ SL_KEY_ALT( 'h' ) | ( ALTL_PRESSED << 16 ), K_ALT_H },
|
|
{ SL_KEY_ALT( 'i' ) | ( ALTL_PRESSED << 16 ), K_ALT_I },
|
|
{ SL_KEY_ALT( 'j' ) | ( ALTL_PRESSED << 16 ), K_ALT_J },
|
|
{ SL_KEY_ALT( 'k' ) | ( ALTL_PRESSED << 16 ), K_ALT_K },
|
|
{ SL_KEY_ALT( 'l' ) | ( ALTL_PRESSED << 16 ), K_ALT_L },
|
|
{ SL_KEY_ALT( 'm' ) | ( ALTL_PRESSED << 16 ), K_ALT_M },
|
|
{ SL_KEY_ALT( 'n' ) | ( ALTL_PRESSED << 16 ), K_ALT_N },
|
|
{ SL_KEY_ALT( 'o' ) | ( ALTL_PRESSED << 16 ), K_ALT_O },
|
|
{ SL_KEY_ALT( 'p' ) | ( ALTL_PRESSED << 16 ), K_ALT_P },
|
|
{ SL_KEY_ALT( 'q' ) | ( ALTL_PRESSED << 16 ), K_ALT_Q },
|
|
{ SL_KEY_ALT( 'r' ) | ( ALTL_PRESSED << 16 ), K_ALT_R },
|
|
{ SL_KEY_ALT( 's' ) | ( ALTL_PRESSED << 16 ), K_ALT_S },
|
|
{ SL_KEY_ALT( 't' ) | ( ALTL_PRESSED << 16 ), K_ALT_T },
|
|
{ SL_KEY_ALT( 'u' ) | ( ALTL_PRESSED << 16 ), K_ALT_U },
|
|
{ SL_KEY_ALT( 'v' ) | ( ALTL_PRESSED << 16 ), K_ALT_V },
|
|
{ SL_KEY_ALT( 'w' ) | ( ALTL_PRESSED << 16 ), K_ALT_W },
|
|
{ SL_KEY_ALT( 'x' ) | ( ALTL_PRESSED << 16 ), K_ALT_X },
|
|
{ SL_KEY_ALT( 'y' ) | ( ALTL_PRESSED << 16 ), K_ALT_Y },
|
|
{ SL_KEY_ALT( 'z' ) | ( ALTL_PRESSED << 16 ), K_ALT_Z },
|
|
{ SL_KEY_ALT( '0' ) | ( ALTL_PRESSED << 16 ), K_ALT_0 },
|
|
{ SL_KEY_ALT( '1' ) | ( ALTL_PRESSED << 16 ), K_ALT_1 },
|
|
{ SL_KEY_ALT( '2' ) | ( ALTL_PRESSED << 16 ), K_ALT_2 },
|
|
{ SL_KEY_ALT( '3' ) | ( ALTL_PRESSED << 16 ), K_ALT_3 },
|
|
{ SL_KEY_ALT( '4' ) | ( ALTL_PRESSED << 16 ), K_ALT_4 },
|
|
{ SL_KEY_ALT( '5' ) | ( ALTL_PRESSED << 16 ), K_ALT_5 },
|
|
{ SL_KEY_ALT( '6' ) | ( ALTL_PRESSED << 16 ), K_ALT_6 },
|
|
{ SL_KEY_ALT( '7' ) | ( ALTL_PRESSED << 16 ), K_ALT_7 },
|
|
{ SL_KEY_ALT( '8' ) | ( ALTL_PRESSED << 16 ), K_ALT_8 },
|
|
{ SL_KEY_ALT( '9' ) | ( ALTL_PRESSED << 16 ), K_ALT_9 },
|
|
#else
|
|
{ 'A' | ( ALTL_PRESSED << 16 ), K_ALT_A },
|
|
{ 'B' | ( ALTL_PRESSED << 16 ), K_ALT_B },
|
|
{ 'C' | ( ALTL_PRESSED << 16 ), K_ALT_C },
|
|
{ 'D' | ( ALTL_PRESSED << 16 ), K_ALT_D },
|
|
{ 'E' | ( ALTL_PRESSED << 16 ), K_ALT_E },
|
|
{ 'F' | ( ALTL_PRESSED << 16 ), K_ALT_F },
|
|
{ 'G' | ( ALTL_PRESSED << 16 ), K_ALT_G },
|
|
{ 'H' | ( ALTL_PRESSED << 16 ), K_ALT_H },
|
|
{ 'I' | ( ALTL_PRESSED << 16 ), K_ALT_I },
|
|
{ 'J' | ( ALTL_PRESSED << 16 ), K_ALT_J },
|
|
{ 'K' | ( ALTL_PRESSED << 16 ), K_ALT_K },
|
|
{ 'L' | ( ALTL_PRESSED << 16 ), K_ALT_L },
|
|
{ 'M' | ( ALTL_PRESSED << 16 ), K_ALT_M },
|
|
{ 'N' | ( ALTL_PRESSED << 16 ), K_ALT_N },
|
|
{ 'O' | ( ALTL_PRESSED << 16 ), K_ALT_O },
|
|
{ 'P' | ( ALTL_PRESSED << 16 ), K_ALT_P },
|
|
{ 'Q' | ( ALTL_PRESSED << 16 ), K_ALT_Q },
|
|
{ 'R' | ( ALTL_PRESSED << 16 ), K_ALT_R },
|
|
{ 'S' | ( ALTL_PRESSED << 16 ), K_ALT_S },
|
|
{ 'T' | ( ALTL_PRESSED << 16 ), K_ALT_T },
|
|
{ 'U' | ( ALTL_PRESSED << 16 ), K_ALT_U },
|
|
{ 'V' | ( ALTL_PRESSED << 16 ), K_ALT_V },
|
|
{ 'W' | ( ALTL_PRESSED << 16 ), K_ALT_W },
|
|
{ 'X' | ( ALTL_PRESSED << 16 ), K_ALT_X },
|
|
{ 'Y' | ( ALTL_PRESSED << 16 ), K_ALT_Y },
|
|
{ 'Z' | ( ALTL_PRESSED << 16 ), K_ALT_Z },
|
|
{ 'a' | ( ALTL_PRESSED << 16 ), K_ALT_A },
|
|
{ 'b' | ( ALTL_PRESSED << 16 ), K_ALT_B },
|
|
{ 'c' | ( ALTL_PRESSED << 16 ), K_ALT_C },
|
|
{ 'd' | ( ALTL_PRESSED << 16 ), K_ALT_D },
|
|
{ 'e' | ( ALTL_PRESSED << 16 ), K_ALT_E },
|
|
{ 'f' | ( ALTL_PRESSED << 16 ), K_ALT_F },
|
|
{ 'g' | ( ALTL_PRESSED << 16 ), K_ALT_G },
|
|
{ 'h' | ( ALTL_PRESSED << 16 ), K_ALT_H },
|
|
{ 'i' | ( ALTL_PRESSED << 16 ), K_ALT_I },
|
|
{ 'j' | ( ALTL_PRESSED << 16 ), K_ALT_J },
|
|
{ 'k' | ( ALTL_PRESSED << 16 ), K_ALT_K },
|
|
{ 'l' | ( ALTL_PRESSED << 16 ), K_ALT_L },
|
|
{ 'm' | ( ALTL_PRESSED << 16 ), K_ALT_M },
|
|
{ 'n' | ( ALTL_PRESSED << 16 ), K_ALT_N },
|
|
{ 'o' | ( ALTL_PRESSED << 16 ), K_ALT_O },
|
|
{ 'p' | ( ALTL_PRESSED << 16 ), K_ALT_P },
|
|
{ 'q' | ( ALTL_PRESSED << 16 ), K_ALT_Q },
|
|
{ 'r' | ( ALTL_PRESSED << 16 ), K_ALT_R },
|
|
{ 's' | ( ALTL_PRESSED << 16 ), K_ALT_S },
|
|
{ 't' | ( ALTL_PRESSED << 16 ), K_ALT_T },
|
|
{ 'u' | ( ALTL_PRESSED << 16 ), K_ALT_U },
|
|
{ 'v' | ( ALTL_PRESSED << 16 ), K_ALT_V },
|
|
{ 'w' | ( ALTL_PRESSED << 16 ), K_ALT_W },
|
|
{ 'x' | ( ALTL_PRESSED << 16 ), K_ALT_X },
|
|
{ 'y' | ( ALTL_PRESSED << 16 ), K_ALT_Y },
|
|
{ 'z' | ( ALTL_PRESSED << 16 ), K_ALT_Z },
|
|
{ '0' | ( ALTL_PRESSED << 16 ), K_ALT_0 },
|
|
{ '1' | ( ALTL_PRESSED << 16 ), K_ALT_1 },
|
|
{ '2' | ( ALTL_PRESSED << 16 ), K_ALT_2 },
|
|
{ '3' | ( ALTL_PRESSED << 16 ), K_ALT_3 },
|
|
{ '4' | ( ALTL_PRESSED << 16 ), K_ALT_4 },
|
|
{ '5' | ( ALTL_PRESSED << 16 ), K_ALT_5 },
|
|
{ '6' | ( ALTL_PRESSED << 16 ), K_ALT_6 },
|
|
{ '7' | ( ALTL_PRESSED << 16 ), K_ALT_7 },
|
|
{ '8' | ( ALTL_PRESSED << 16 ), K_ALT_8 },
|
|
{ '9' | ( ALTL_PRESSED << 16 ), K_ALT_9 },
|
|
#endif
|
|
#endif
|
|
|
|
{ SL_KEY_ALT( 'A' ), K_ALT_A },
|
|
{ SL_KEY_ALT( 'B' ), K_ALT_B },
|
|
{ SL_KEY_ALT( 'C' ), K_ALT_C },
|
|
{ SL_KEY_ALT( 'D' ), K_ALT_D },
|
|
{ SL_KEY_ALT( 'E' ), K_ALT_E },
|
|
{ SL_KEY_ALT( 'F' ), K_ALT_F },
|
|
{ SL_KEY_ALT( 'G' ), K_ALT_G },
|
|
{ SL_KEY_ALT( 'H' ), K_ALT_H },
|
|
{ SL_KEY_ALT( 'I' ), K_ALT_I },
|
|
{ SL_KEY_ALT( 'J' ), K_ALT_J },
|
|
{ SL_KEY_ALT( 'K' ), K_ALT_K },
|
|
{ SL_KEY_ALT( 'L' ), K_ALT_L },
|
|
{ SL_KEY_ALT( 'M' ), K_ALT_M },
|
|
{ SL_KEY_ALT( 'N' ), K_ALT_N },
|
|
{ SL_KEY_ALT( 'O' ), K_ALT_O },
|
|
{ SL_KEY_ALT( 'P' ), K_ALT_P },
|
|
{ SL_KEY_ALT( 'Q' ), K_ALT_Q },
|
|
{ SL_KEY_ALT( 'R' ), K_ALT_R },
|
|
{ SL_KEY_ALT( 'S' ), K_ALT_S },
|
|
{ SL_KEY_ALT( 'T' ), K_ALT_T },
|
|
{ SL_KEY_ALT( 'U' ), K_ALT_U },
|
|
{ SL_KEY_ALT( 'V' ), K_ALT_V },
|
|
{ SL_KEY_ALT( 'W' ), K_ALT_W },
|
|
{ SL_KEY_ALT( 'X' ), K_ALT_X },
|
|
{ SL_KEY_ALT( 'Y' ), K_ALT_Y },
|
|
{ SL_KEY_ALT( 'Z' ), K_ALT_Z },
|
|
{ SL_KEY_ALT( 'a' ), K_ALT_A },
|
|
{ SL_KEY_ALT( 'b' ), K_ALT_B },
|
|
{ SL_KEY_ALT( 'c' ), K_ALT_C },
|
|
{ SL_KEY_ALT( 'd' ), K_ALT_D },
|
|
{ SL_KEY_ALT( 'e' ), K_ALT_E },
|
|
{ SL_KEY_ALT( 'f' ), K_ALT_F },
|
|
{ SL_KEY_ALT( 'g' ), K_ALT_G },
|
|
{ SL_KEY_ALT( 'h' ), K_ALT_H },
|
|
{ SL_KEY_ALT( 'i' ), K_ALT_I },
|
|
{ SL_KEY_ALT( 'j' ), K_ALT_J },
|
|
{ SL_KEY_ALT( 'k' ), K_ALT_K },
|
|
{ SL_KEY_ALT( 'l' ), K_ALT_L },
|
|
{ SL_KEY_ALT( 'm' ), K_ALT_M },
|
|
{ SL_KEY_ALT( 'n' ), K_ALT_N },
|
|
{ SL_KEY_ALT( 'o' ), K_ALT_O },
|
|
{ SL_KEY_ALT( 'p' ), K_ALT_P },
|
|
{ SL_KEY_ALT( 'q' ), K_ALT_Q },
|
|
{ SL_KEY_ALT( 'r' ), K_ALT_R },
|
|
{ SL_KEY_ALT( 's' ), K_ALT_S },
|
|
{ SL_KEY_ALT( 't' ), K_ALT_T },
|
|
{ SL_KEY_ALT( 'u' ), K_ALT_U },
|
|
{ SL_KEY_ALT( 'v' ), K_ALT_V },
|
|
{ SL_KEY_ALT( 'w' ), K_ALT_W },
|
|
{ SL_KEY_ALT( 'x' ), K_ALT_X },
|
|
{ SL_KEY_ALT( 'y' ), K_ALT_Y },
|
|
{ SL_KEY_ALT( 'z' ), K_ALT_Z },
|
|
{ SL_KEY_ALT( '0' ), K_ALT_0 },
|
|
{ SL_KEY_ALT( '1' ), K_ALT_1 },
|
|
{ SL_KEY_ALT( '2' ), K_ALT_2 },
|
|
{ SL_KEY_ALT( '3' ), K_ALT_3 },
|
|
{ SL_KEY_ALT( '4' ), K_ALT_4 },
|
|
{ SL_KEY_ALT( '5' ), K_ALT_5 },
|
|
{ SL_KEY_ALT( '6' ), K_ALT_6 },
|
|
{ SL_KEY_ALT( '7' ), K_ALT_7 },
|
|
{ SL_KEY_ALT( '8' ), K_ALT_8 },
|
|
{ SL_KEY_ALT( '9' ), K_ALT_9 },
|
|
|
|
{ SL_KEY_F(1), K_F1 },
|
|
{ SL_KEY_F(2), K_F2 },
|
|
{ SL_KEY_F(3), K_F3 },
|
|
{ SL_KEY_F(4), K_F4 },
|
|
{ SL_KEY_F(5), K_F5 },
|
|
{ SL_KEY_F(6), K_F6 },
|
|
{ SL_KEY_F(7), K_F7 },
|
|
{ SL_KEY_F(8), K_F8 },
|
|
{ SL_KEY_F(9), K_F9 },
|
|
{ SL_KEY_F(10), K_F10 },
|
|
|
|
{ SL_KEY_F(11), K_SH_F1 },
|
|
{ SL_KEY_F(12), K_SH_F2 },
|
|
{ SL_KEY_F(13), K_SH_F3 },
|
|
{ SL_KEY_F(14), K_SH_F4 },
|
|
{ SL_KEY_F(15), K_SH_F5 },
|
|
{ SL_KEY_F(16), K_SH_F6 },
|
|
{ SL_KEY_F(17), K_SH_F7 },
|
|
{ SL_KEY_F(18), K_SH_F8 },
|
|
{ SL_KEY_F(19), K_SH_F9 },
|
|
{ SL_KEY_F(20), K_SH_F10 },
|
|
|
|
{ SL_KEY_F(21), K_CTRL_F1 },
|
|
{ SL_KEY_F(22), K_CTRL_F2 },
|
|
{ SL_KEY_F(23), K_CTRL_F3 },
|
|
{ SL_KEY_F(24), K_CTRL_F4 },
|
|
{ SL_KEY_F(25), K_CTRL_F5 },
|
|
{ SL_KEY_F(26), K_CTRL_F6 },
|
|
{ SL_KEY_F(27), K_CTRL_F7 },
|
|
{ SL_KEY_F(28), K_CTRL_F8 },
|
|
{ SL_KEY_F(29), K_CTRL_F9 },
|
|
{ SL_KEY_F(30), K_CTRL_F10 },
|
|
|
|
{ SL_KEY_F(31), K_ALT_F1 },
|
|
{ SL_KEY_F(32), K_ALT_F2 },
|
|
{ SL_KEY_F(33), K_ALT_F3 },
|
|
{ SL_KEY_F(34), K_ALT_F4 },
|
|
{ SL_KEY_F(35), K_ALT_F5 },
|
|
{ SL_KEY_F(36), K_ALT_F6 },
|
|
{ SL_KEY_F(37), K_ALT_F7 },
|
|
{ SL_KEY_F(38), K_ALT_F8 },
|
|
{ SL_KEY_F(39), K_ALT_F9 },
|
|
{ SL_KEY_F(40), K_ALT_F10 }
|
|
};
|
|
|
|
/* *********************************************************************** */
|
|
|
|
#define KeyTranslationTableSize \
|
|
( sizeof( KeyTranslationTable ) / ( 2 * sizeof ( int ) ) )
|
|
|
|
/* a very simple sort algorithm */
|
|
static void hb_gt_SortKeyTranslationTable( void )
|
|
{
|
|
int i, j, min, KeyTmp[ 2 ];
|
|
|
|
for ( i = 0; i < (int) ( KeyTranslationTableSize - 1 ); i++ )
|
|
{
|
|
min = i;
|
|
|
|
for ( j = i + 1; j < (int) KeyTranslationTableSize; j++ )
|
|
{
|
|
if ( KeyTranslationTable[ j ][ 0 ] < KeyTranslationTable[ min ][ 0 ] )
|
|
min = j;
|
|
}
|
|
|
|
if ( min > i )
|
|
{
|
|
KeyTmp[ 0 ] = KeyTranslationTable[ i ][ 0 ];
|
|
KeyTmp[ 1 ] = KeyTranslationTable[ i ][ 1 ];
|
|
|
|
KeyTranslationTable[ i ][ 0 ] = KeyTranslationTable[ min ][ 0 ];
|
|
KeyTranslationTable[ i ][ 1 ] = KeyTranslationTable[ min ][ 1 ];
|
|
|
|
KeyTranslationTable[ min ][ 0 ] = KeyTmp[ 0 ];
|
|
KeyTranslationTable[ min ][ 1 ] = KeyTmp[ 1 ];
|
|
}
|
|
}
|
|
|
|
/*
|
|
for ( i = 0; i < KeyTranslationTableSize; i++ )
|
|
fprintf( stderr, "%02x %8x %8x\n", i, KeyTranslationTable[ i ][ 0 ], KeyTranslationTable[ i ][ 1 ] );
|
|
*/
|
|
|
|
}
|
|
|
|
/* ************************************************************************* */
|
|
|
|
/* standard binary search */
|
|
static int hb_gt_FindKeyTranslation( int SlangKey )
|
|
{
|
|
int Start,Stop,CurPos;
|
|
|
|
if ( ( SlangKey >= KeyTranslationTable[ 0 ][ 0 ] ) &&
|
|
( SlangKey <= KeyTranslationTable[ KeyTranslationTableSize - 1 ][ 0 ] ) )
|
|
{
|
|
Start = 0; Stop = KeyTranslationTableSize - 1;
|
|
|
|
while( Start <= Stop )
|
|
{
|
|
CurPos = ( Start + Stop ) / 2;
|
|
|
|
/* fprintf( stderr, "%d %d %d\n", i, KeyTranslationTable[ i ][ 0 ], KeyTranslationTable[ i ][ 1 ] ); */
|
|
|
|
if( SlangKey == KeyTranslationTable[ CurPos ][ 0 ] )
|
|
return( KeyTranslationTable[ CurPos ][ 1 ] );
|
|
|
|
else if( SlangKey < KeyTranslationTable[ CurPos ][ 0 ] )
|
|
Stop = CurPos - 1;
|
|
|
|
else if( SlangKey > KeyTranslationTable[ CurPos ][ 0 ] )
|
|
Start = CurPos + 1;
|
|
}
|
|
}
|
|
|
|
/* return( SlangKey ); */
|
|
return( 0 );
|
|
}
|
|
|
|
/* ************************************************************************* */
|
|
|
|
void hb_gt_SetKeyInKeyTranslationTable( int SlangKey, int ClipKey )
|
|
{
|
|
|
|
if ( ( SlangKey >= KeyTranslationTable[ 0 ][ 0 ] ) &&
|
|
( SlangKey <= KeyTranslationTable[ KeyTranslationTableSize - 1 ][ 0 ] ) )
|
|
{
|
|
int i;
|
|
for ( i = 0; i < (int) KeyTranslationTableSize; i++ )
|
|
{
|
|
if ( SlangKey == KeyTranslationTable[ i ][ 0 ] )
|
|
KeyTranslationTable[ i ][ 1 ] = ClipKey;
|
|
/* we don't break here because SlangKey can be defined more than once */
|
|
}
|
|
}
|
|
}
|
|
|
|
/* ************************************************************************* */
|