delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/07/25/00:42:28

From: "Mark E." <snowball3 AT bigfoot DOT com>
To: djgpp-workers AT delorie DOT com
Date: Wed, 25 Jul 2001 00:13:35 -0400
MIME-Version: 1.0
Subject: extended key string docs
Message-ID: <3B5E0F2F.14861.65A457@localhost>
X-mailer: Pegasus Mail for Win32 (v3.12c)
Reply-To: djgpp-workers AT delorie DOT com

How's this?

@node __get_extended_key_string, bios
@subheading Syntax

@example
#include <pc.h>

const unsigned char * __get_extended_key_string(int key_code);
@end example

@subheading Description

Returns an @sc{ecma}-48 compliant representation of an extended key's
scan code in @var{key_code}.

@xref{getkey}.
@xref{getxkey}.

@subheading Return Value

A pointer to an @sc{ecma}-48 compliant string if one is associated with the
scan code @var{key_code} or @code{NULL} if there is not.

@subheading Portability

@port-note This function is DJGPP-specific.

@portability !ansi, !posix

@subheading Example

@example
#include <pc.h>
#include <stdio.h>

int key;

int main()
@{
  key = getxkey();
  if (key < 0x100)
  @{
    putc(key, stdout);
    putc('\r', stdout);
  @}
  else
  @{
    const unsigned char *str = __get_extended_key_string(key);
    if (str)
      puts(str);
    else
      puts("<unknown>");
  @}
  fflush(stdout);
@}

@end example

@example
#include <pc.h>
#include <stdio.h>
#include <dpmi.h>

int main()
@{
  __dpmi_regs r;
  const unsigned char *str;
  int is_extended_key;

  /* Wait for keypress. */
  r.h.ah = 0x11;
  __dpmi_int(0x16, &r);
  /* Print the encoding for function keys (F1, F2, etc.)
     and other extended keys (Home, End, etc.). */
  is_extended_key = (r.h.al == 0x00 || r.h.al == 0xe0);
  if (is_extended_key)
  @{
    str = __get_extended_key_string((int)r.h.ah)
    printf("Key encoding: %s", str);
  @}
@}

@end example


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019