FreeBASIC  0.91.0
io_input.c File Reference
#include "../fb.h"
#include "fb_private_console.h"
#include <ctype.h>
Include dependency graph for io_input.c:

Go to the source code of this file.

Data Structures

struct  _FB_KEY_CODES
 
struct  _FB_KEY_LIST_ENTRY
 

Macros

#define KEY_BUFFER_LEN   512
 
#define FB_KEY_LIST_SIZE   (sizeof(fb_ext_key_entries)/sizeof(FB_KEY_LIST_ENTRY))
 
#define FB_KEY_CODES_SIZE   (sizeof(fb_asc_key_codes)/sizeof(FB_KEY_CODES))
 

Typedefs

typedef struct _FB_KEY_CODES FB_KEY_CODES
 
typedef struct _FB_KEY_LIST_ENTRY FB_KEY_LIST_ENTRY
 

Functions

static void fb_hConsolePostKey (int key, const KEY_EVENT_RECORD *key_event)
 
int fb_hConsoleInputBufferChanged (void)
 
static int fb_hConsoleGetKeyEx (int full, int allow_remove)
 
int fb_hConsoleGetKey (int full)
 
int fb_hConsolePeekKey (int full)
 
void fb_hConsolePutBackEvents (void)
 
static void fb_hConsoleProcessKeyEvent (KEY_EVENT_RECORD *event)
 
static BOOL WINAPI fb_hConsoleHandlerRoutine (DWORD dwCtrlType)
 
static void fb_hExitControlHandler (void)
 
static void fb_hInitControlHandler (void)
 
int fb_ConsoleProcessEvents (void)
 
int fb_hConsoleTranslateKey (char AsciiChar, WORD wVsCode, WORD wVkCode, DWORD dwControlKeyState, int bEnhancedKeysOnly)
 Translates an ASCII character, Virtual scan code and Virtual key code to a single QB-compatible keyboard code. More...
 

Variables

static int key_buffer [KEY_BUFFER_LEN]
 
static size_t key_head = 0
 
static size_t key_tail = 0
 
static INPUT_RECORD input_events [KEY_BUFFER_LEN]
 
static unsigned key_scratch_pad = 0
 
static int key_buffer_changed = FALSE
 
static const FB_KEY_LIST_ENTRY fb_ext_key_entries []
 
static const FB_KEY_CODES fb_asc_key_codes []
 
static int control_handler_inited = FALSE
 

Macro Definition Documentation

#define FB_KEY_CODES_SIZE   (sizeof(fb_asc_key_codes)/sizeof(FB_KEY_CODES))

Definition at line 157 of file io_input.c.

#define FB_KEY_LIST_SIZE   (sizeof(fb_ext_key_entries)/sizeof(FB_KEY_LIST_ENTRY))

Definition at line 41 of file io_input.c.

#define KEY_BUFFER_LEN   512

Definition at line 7 of file io_input.c.

Typedef Documentation

typedef struct _FB_KEY_CODES FB_KEY_CODES

Function Documentation

int fb_ConsoleProcessEvents ( void  )

Definition at line 386 of file io_input.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int fb_hConsoleGetKey ( int  full)

Definition at line 229 of file io_input.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static int fb_hConsoleGetKeyEx ( int  full,
int  allow_remove 
)
static

Definition at line 198 of file io_input.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL WINAPI fb_hConsoleHandlerRoutine ( DWORD  dwCtrlType)
static

Definition at line 347 of file io_input.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int fb_hConsoleInputBufferChanged ( void  )

Definition at line 184 of file io_input.c.

Here is the call graph for this function:

int fb_hConsolePeekKey ( int  full)

Definition at line 234 of file io_input.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static void fb_hConsolePostKey ( int  key,
const KEY_EVENT_RECORD *  key_event 
)
static

Definition at line 159 of file io_input.c.

Here is the caller graph for this function:

static void fb_hConsoleProcessKeyEvent ( KEY_EVENT_RECORD *  event)
static

Definition at line 266 of file io_input.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void fb_hConsolePutBackEvents ( void  )

Definition at line 239 of file io_input.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int fb_hConsoleTranslateKey ( char  AsciiChar,
WORD  wVsCode,
WORD  wVkCode,
DWORD  dwControlKeyState,
int  bEnhancedKeysOnly 
)

Translates an ASCII character, Virtual scan code and Virtual key code to a single QB-compatible keyboard code.

Returns
-1 if key not translatable

Definition at line 434 of file io_input.c.

Here is the caller graph for this function:

static void fb_hExitControlHandler ( void  )
static

Definition at line 368 of file io_input.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static void fb_hInitControlHandler ( void  )
static

Definition at line 375 of file io_input.c.

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

int control_handler_inited = FALSE
static

Definition at line 366 of file io_input.c.

const FB_KEY_CODES fb_asc_key_codes[]
static

Definition at line 43 of file io_input.c.

const FB_KEY_LIST_ENTRY fb_ext_key_entries[]
static
Initial value:
= {
{ 0x001C, { 0x000D, 0x000D, 0x000A, 0xA600 } },
{ 0x0035, { 0x002F, 0x003F, 0x9500, 0xA400 } },
{ 0x0047, { 0x4700, 0x4700, 0x7700, 0x9700 } },
{ 0x0048, { 0x4800, 0x4800, 0x8D00, 0x9800 } },
{ 0x0049, { 0x4900, 0x4900, 0x8400, 0x9900 } },
{ 0x004B, { 0x4B00, 0x4B00, 0x7300, 0x9B00 } },
{ 0x004D, { 0x4D00, 0x4D00, 0x7400, 0x9D00 } },
{ 0x004F, { 0x4F00, 0x4F00, 0x7500, 0x9F00 } },
{ 0x0050, { 0x5000, 0x5000, 0x9100, 0xA000 } },
{ 0x0051, { 0x5100, 0x5100, 0x7600, 0xA100 } },
{ 0x0052, { 0x5200, 0x5200, 0x9200, 0xA200 } },
{ 0x0053, { 0x5300, 0x5300, 0x9300, 0xA300 } }
}

Definition at line 26 of file io_input.c.

INPUT_RECORD input_events[KEY_BUFFER_LEN]
static

Definition at line 10 of file io_input.c.

int key_buffer[KEY_BUFFER_LEN]
static

Definition at line 8 of file io_input.c.

int key_buffer_changed = FALSE
static

Definition at line 12 of file io_input.c.

size_t key_head = 0
static

Definition at line 9 of file io_input.c.

unsigned key_scratch_pad = 0
static

Definition at line 11 of file io_input.c.

size_t key_tail = 0
static

Definition at line 9 of file io_input.c.