Path: utzoo!utgpu!water!watmath!clyde!att-cb!att-ih!pacbell!ptsfa!ames!pasteur!ucbvax!bloom-beacon!oberon!pollux.usc.edu!papa From: papa@pollux.usc.edu (Marco Papa) Newsgroups: comp.sys.amiga Subject: Re: Manx/RawKeyConvert-urgent! Message-ID: <7489@oberon.USC.EDU> Date: 8 Mar 88 02:29:19 GMT References: <1322@pasteur.Berkeley.Edu> Sender: news@oberon.USC.EDU Reply-To: papa@pollux.usc.edu (Marco Papa) Organization: Felsina Software, Los Angeles, CA Lines: 69 In article <1322@pasteur.Berkeley.Edu> c162-fe@zooey.Berkeley.EDU (Jonathan Dubman) writes: >This is a question for the initiated. (Bryce? Matt? Leo? Chuck? CATS?) >Summary of question: HOW DO YOU CALL RawKeyConvert() from Manx? >I am having major problems calling the RawKeyConvert() function, which takes an >input event of class RAWKEY and returns the ASCII code, using any KeyMap. It's >gotta be done this way - I already have the RAWKEY and I need to know its >translation. >This is actually a function of the Console Device, so the Console Device has to >be open. The OpenDevice() call for the console device initializes the >io_Device field of the struct IOStdReq that I pass to it. >HOW DO YOU CALL IT FROM C? I'd like to avoid writing an assembly language >front end, though I could if I really needed to.I'm using Manx 3.4b. I say > numchars = RawKeyConvert(event, buffer, lengthy, NULL); > >Compiles fine, but when I link it, it sings to the tune of > Undefined _ConsoleDevice >or something. Now ConsoleDevice() is a function mentioned in the functions.h >file - WHAT IS ConsoleDevice()? (I'm using a precompiled file that includes >functions.h) The Enhancer Software Manual (included with the Enhancer 1.2 package) has an example that shows how to get "dead" keys that uses RawKeyConvert. The portion you need follows. This code is Copyright 1986, Commodore-Amiga Inc. All Rights Reserved. /* must have the ConsoleDevice opened to use RawKeyConvert() */ struct Device *ConsoleDevice; /* external declaration */ struct IOStdReq ioreq; ... OpenDevice("console.device", -1, &ioreq, 0); ConsoleDevice = ioreq.io_Device; ... ... /* * DeadKeyConvert() * * returns: * -2 is message is of clas RAWKEY * same as RawKeyConvert otherwise: * buffer lenght if <= kbsize * -1 else */ DeadKeyConvert(msg,kbuffer,kbsize,kmap) struct IntuiMessage *msg; UBYTE *kbuffer; int kbsize; struct Keymap *kmap; { static struct InputEvent = {NULL,IECLASS_RAWKEY, 0,0,0}; if (msg->Class != RAWKEY) return (-2); /* pack input event */ ievent.ie_Code = msg->Code; ievent.ie_Qualifier = msg->Qualifier; /* get previous codes from location pointed to by IAddress this pointer is valid until IntuiMessage is replied */ ievemt.ie_position.ieOSyj3addr = *((APTR *)msg->IAddres); return(RawKeyConvert(&ievent,kbuffer,kbsize,kmap)); } Enjoy. -- Marco