Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!think.com!paperboy!osf!dbrooks From: dbrooks@osf.osf.org (David Brooks) Newsgroups: comp.sys.atari.st.tech Subject: Re: Getting ASCII value from scancode Message-ID: <21491@paperboy.OSF.ORG> Date: 28 Apr 91 19:10:37 GMT References: <1991Apr27.172516.29313@zip.eecs.umich.edu> <21490@paperboy.OSF.ORG> Sender: news@OSF.ORG Reply-To: dbrooks@osf.org (David Brooks) Distribution: all Organization: Open Software Foundation Lines: 42 entropy@gnu.ai.mit.edu (entropy) writes: >Could you maybe give a hunk of code using the methods you described? Pleasure. In startup: char **keytb; char *ktunshift, *ktshift; keytp = (char **)Keytbl(-1L, -1L, -1L); /* Setting [2] to same as [0] forces capslock to be ignored... */ ktunshift = keytp[2] = keytp[0]; ktshift = keytp[1]; ... /* Now, if you have the scancode right justified in int scode... */ shifts = Getshift(); /* i.e. kbshift(-1); if (shifts & 8) { /* ALT */ if (scode >= 0x78) /* Allan Pratt explained this once, but... */ /* GSX correction: */ scode -= 0x76; /* This code ignores the capslock key. Use shifts & 0x10 to look at it. */ ch = ((shifts & 3)?ktshift:ktunshift)[scode]; if (shifts & 4) /* CTRL */ ch &= 0x1f; if (using_full_8_bits) ch |= 0x80; else emit('\033'); /* Use esc-char as alias for 8th bit */ } emit(ch); -- David Brooks dbrooks@osf.org Systems Engineering, OSF uunet!osf.org!dbrooks Donnie Wahlberg is brought to you by three billion years of evolution.