hpkeyb49.h

Go to the documentation of this file.
00001 //& ****************************************************************************
00002 //&
00003 //& Written by Benjamin Maurin, September 2004
00004 //&
00005 //& Copyright (C) 2004 The HP-GCC Development Team
00006 //&
00007 //& ****************************************************************************
00008 //&
00009 //&
00010 //& This file is part of HP-GCC.
00011 //&
00012 //& HP-GCC is free software; you can redistribute it and/or modify
00013 //& it under the terms of the GNU General Public License as published by
00014 //& the Free Software Foundation; either version 2, or (at your option)
00015 //& any later version.
00016 //& 
00017 //& HP-GCC is distributed in the hope that it will be useful,
00018 //& but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 //& MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 //& GNU General Public License for more details.
00021 //& 
00022 //& You should have received a copy of the GNU General Public License
00023 //& along with HP-GCC; see the file COPYING. 
00024 //&
00025 //& As a special exception, you may use this file as part of a free software
00026 //& library without restriction.  Specifically, if other files instantiate
00027 //& templates or use macros or inline functions from this file, or you compile
00028 //& this file and link it with other files to produce an executable, this
00029 //& file does not by itself cause the resulting executable to be covered by
00030 //& the GNU General Public License.  This exception does not however
00031 //& invalidate any other reasons why the executable file might be covered by
00032 //& the GNU General Public License.
00033 //&
00034 //& ****************************************************************************
00035 
00036 #ifndef _HPKEYB49_H
00037 #define _HPKEYB49_H
00038 
00039 // LONG TYPE DEFINITION, ADDED BY CLAUDIO 01/14/05
00040 #ifndef _LONGLONG_DEF
00041 typedef unsigned long long ULONGLONG;
00042 typedef long long LONGLONG;
00043 #define _LONGLONG_DEF
00044 #endif
00045 
00145 int keyb_isKeyPressed(unsigned char col, unsigned char row);
00146 
00147 
00148 
00155 int keyb_isAnyKeyPressed(void);
00156 
00166 void keyb_waitKeyPressed(void);
00167 
00176 int keyb_isLeft(void);
00177 
00186 int keyb_isRight(void);
00187 
00196 int keyb_isUp(void);
00197 
00206 int keyb_isDown(void);
00207 
00214 int keyb_isAlpha(void);
00215 
00222 int keyb_isLS(void);
00223 
00230 int keyb_isRS(void);
00231 
00238 int keyb_isON(void);
00239 
00268 int keyb_getkey(int wait);
00269 
00270 
00271 // KEYBOARD MATRIX HANDLING ROUTINE, ADDED BY CLAUDIO
00272 
00273 /* 
00274 
00275 KEYBOARD BIT MAP
00276 ----------------
00277 This is the bit number in the 64-bit keymatrix.
00278 Bit set means key is pressed.
00279 
00280     A]-+  B]-+  C]-+  D]-+  E]-+  F]-+  
00281     |41|  |42|  |43|  |44|  |45|  |46|
00282     +--+  +--+  +--+  +--+  +--+  +--+  
00283 
00284     G]-+  H]-+  I]-+        UP]+        
00285     |47|  |53|  |54|        |49|      
00286     +--+  +--+  +--+  LF]+  +--+  RT]+  
00287                       |50|  DN]+  |52|
00288     J]-+  K]-+  L]-+  +--+  |51|  +--+  
00289     |55|  |57|  |58|        +--+    
00290     +--+  +--+  +--+                    
00291 
00292     M]--+  N]--+  O]--+  P]--+  BKS]+
00293     | 33|  | 25|  | 17|  | 09|  | 01|
00294     +---+  +---+  +---+  +---+  +---+
00295 
00296     Q]--+  R]--+  S]--+  T]--+  U]--+
00297     | 34|  | 26|  | 18|  | 10|  | 02|
00298     +---+  +---+  +---+  +---+  +---+
00299 
00300     V]--+  W]--+  X]--+  Y]--+  /]--+
00301     | 35|  | 27|  | 19|  | 11|  | 03|
00302     +---+  +---+  +---+  +---+  +---+
00303     
00304     AL]-+  7]--+  8]--+  9]--+  *]--+
00305     | 60|  | 28|  | 20|  | 12|  | 04|
00306     +---+  +---+  +---+  +---+  +---+
00307     
00308     RS]-+  4]--+  5]--+  6]--+  -]--+
00309     | 61|  | 29|  | 21|  | 13|  | 05|
00310     +---+  +---+  +---+  +---+  +---+
00311     
00312     LS]-+  1]--+  2]--+  3]--+  +]--+
00313     | 62|  | 30|  | 22|  | 14|  | 06|
00314     +---+  +---+  +---+  +---+  +---+
00315     
00316     ON]-+  0]--+  .]--+  SP]-+  EN]-+
00317     | 63|  | 31|  | 23|  | 15|  | 07|
00318     +---+  +---+  +---+  +---+  +---+
00319 
00320 */
00321 
00323 #define KB_A   41
00325 #define KB_B   42
00327 #define KB_C   43
00329 #define KB_D   44
00331 #define KB_E   45
00333 #define KB_F   46
00335 #define KB_G   47
00337 #define KB_H   53
00339 #define KB_I   54
00341 #define KB_J   55
00343 #define KB_K   57
00345 #define KB_L   58
00347 #define KB_M   33
00349 #define KB_N   25
00351 #define KB_O   17
00353 #define KB_P    9
00355 #define KB_Q   34
00357 #define KB_R   26
00359 #define KB_S   18
00361 #define KB_T   10
00363 #define KB_U    2
00365 #define KB_V   35
00367 #define KB_W   27
00369 #define KB_X   19
00371 #define KB_Y   11
00373 #define KB_Z KB_DIV
00375 #define KB_0   31
00377 #define KB_1   30
00379 #define KB_2   22
00381 #define KB_3   14
00383 #define KB_4   29
00385 #define KB_5   21
00387 #define KB_6   13
00389 #define KB_7   28
00391 #define KB_8   20
00393 #define KB_9   12
00395 #define KB_BKS  1
00397 #define KB_DIV  3
00399 #define KB_MUL  4
00401 #define KB_ADD  6
00403 #define KB_SUB  5
00405 #define KB_DOT 23
00407 #define KB_SPC 15
00409 #define KB_ENT  7
00411 #define KB_UP  49
00413 #define KB_DN  51
00415 #define KB_LF  50
00417 #define KB_RT  52
00419 #define KB_ALPHA   60
00421 #define KB_LSHIFT  61
00423 #define KB_RSHIFT  62
00425 #define KB_ON  63
00426 
00427 // MACROS TO CREATE KEYBOARD MASKS
00434 #define KB_MASK64(a) (((ULONGLONG)1)<<(a))
00435 
00443 #define KB_MASK32(a) (((unsigned int)1)<<(a&31))
00444 
00452 #define KB_MASK8(a)  (((unsigned int)1)<<(a&7))
00453 
00454 // COMMON KEYBOARD MASKS
00455 // ALL CURSOR KEYS
00456 
00466 #define KB_CURS ((ULONGLONG)0x001e000000000000)
00467 
00468 // USE WITH HIWORD ONLY
00478 #define KBH_CURS32 ((unsigned int)0x001e0000)
00479 
00480 // ALL FUNCTION KEYS (A-F)
00490 #define KB_FUNC ((ULONGLONG)0x00007e0000000000)
00491 // USE WITH HIWORD ONLY
00501 #define KBH_FUNC32 ((unsigned int)0x00007e00)
00502 
00503 
00504 // SHIFT CONSTANTS FOR HIGH-LEVEL KEYBOARD FUNCTIONS
00505 
00507 #define SHFT_LS        0x40000000
00509 #define SHFT_RS     0x20000000
00511 #define SHFT_ALPHA    0x10000000
00513 #define SHFT_ON        0x80000000
00515 #define SHFT_ANY    0xf0000000    
00516 
00517 
00519 #define KEYCODE(shftcode) ((shftcode)&0xff)
00521 #define SHFTPLANE(shftcode) ((shftcode)&0xf0000000)
00522 
00523 
00524 // KEYMATRIX TYPE DEFINITION
00533 typedef union {
00534     ULONGLONG full;
00535     struct { unsigned int loword,hiword; };
00536     unsigned char bytes[8];
00537 } keymatrix;
00538 
00539 // SCANS THE KEYBOARD AND STORES THE 64-BIT MATRIX IN ptr
00549 extern void keyb_getmatrix(keymatrix *ptr);
00550 
00563 int keyb_isKeyPrM(int keycode);
00564 
00578 int keyb_isShiftKeyPrM(int shiftcode);
00579 
00580 
00613 int keyb_getkeyM(int wait);
00614 
00642 int keyb_getnextkey(keymatrix *ptr,int keycode);
00643 // convenience macro
00644 // < ibl ; 2005-05-08 >
00645 
00646 #define WAIT_CANCEL {while(keyb_isON()); while(! keyb_isON());}
00647 
00648 #endif 

Generated on Sat Feb 17 00:05:26 2007 for HP-GCCLibrary by  doxygen 1.5.0