home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.apple2
- Path: sparky!uunet!cs.utexas.edu!hermes.chpc.utexas.edu!news.utdallas.edu!corpgate!bnrgate!nott!cunews!revcan!micor!beejay
- From: beejay@Micor.OCUnix.on.ca (Basil Johnson)
- Subject: Re: Editors
- Organization: M.B. Cormier INC.
- Date: Fri, 20 Nov 92 01:02:21 EST
- Message-ID: <maXiuB1w165w@Micor.OCUnix.on.ca>
- References: <9211180618.AA16914@chasm.scar.utoronto.ca>
- Sender: view@micor.ocunix.on.ca (View)
- Lines: 114
-
- 90taobri@CHASM.SCAR.UTORONTO.CA (Brian Tao) writes:
-
- >
- > Now that I've finished my mid-terms (and only one lab report to do
- > for the entire week!), I can start some serious pounding at my
- > AppleWorks 3.0 script for uemacs 3.11c. Rather than taking the easy way
- > out and simply mimicking the keystrokes, I've started writing procedures
- > so that things like search-and-replace comes up with the same prompts.
- > There are a few things I can't do easily (like OA-1 thru OA-9 would be a
- > bitch to program), but it looks like it will be able to retain most of
- > the AppleWorks-style commands.
- > --
- > -=+ Brian Tao (taob@r-node.pci.on.ca, 90taobri@chasm.scar.utoronto.ca) +=-
- > -=+=-
- > -=+ MuGS: The Only Internet Mail Reader For The Apple IIGS! +=-
- >
-
-
-
- Not difficult at all, Brian. I had to implement OA-1/OA-9
- commands this past week-end with HyperC. Well, I cheated a
- bit. HyperC doesn't have a function to peek at a memory
- location so I wrote one in assembly for it. I assume ORCA/C
- has such a function. If it does, you can port this easily.
- If it doesn't I'm sure someone here will write the code for
- you. I could write the 8 bit code but I don't know how to
- interface assembly and ORCA/C.
-
- The HyperC getkey() function waits indefinitely until the keyboard
- is struck and returns the struck character with the high bit
- clear. The extended getkey function [getekey()] checks the
- Open-Apple key (0xc061); the high bit is set if it is. Since
- the normal read of the keyboard has high bit low, I simply
- set the high bit if the OA key was also struck. So, all my
- OA prefixed commands have the high bit set as is evident from
- the defines.
-
- This is not a program. I have cut and paste the relevant
- sections from mine for you. Good Luck with your reader.
-
- Your compatriot in Ottawa,
- Basil
-
- beejay@micor.ocunix.on.ca
- --
- /* ASCII control characters */
- #define ASCNUL 3
- #define ASCBEL 7
- #define ASCBS 8
- #define ASCTAB 9
- #define ASCLF 0x0A
- #define ASCFF 0x0C
- #define ASCCR 0x0D
- #define ASCESC 0x1B
- #define ASCDEL 0x7F
- #define ASCSPACE 0x20
- /* cursor movement Control keys */
- #define UPARROW 0x0b
- #define DOWNARROW 0x0a
- #define LEFTARROW 0x08
- #define RIGHTARROW 0x15
-
- /* Open-Apple command keys */
- /* (high bit is set) */
- #define HOMEKEY 0xb1 /* OA-1 (beginning of text) */
- #define ENDKEY 0xb9 /* OA-9 (end of text) */
- #define PGDNKEY 0x8a /* OA-DownArrow (Page down) */
- #define PGUPKEY 0x8b /* OA-UpArrow (Page up) */
- #define HELPKEY 0xbf /* OA-? (Help) */
-
- #define INVALIDCMD 999
-
- int get_cmd() /* get next input command from keyboard
- */
- { /* returns the command type entered */
- int key ; /* the keyboard input value */
- /* (see keyio.h for values) */
- int cmd ; /* the command type value */
-
- cmd = INVALIDCMD ; /* get next keyboard input */
- while(cmd == INVALIDCMD)
- { key = getekey() ; /* get next keyboard input */
- switch(key) /* classify the key pressed */
- {
- case PGDNKEY : cmd = NEXTPAGE ;break ;
- case PGUPKEY : cmd = PREVPAGE ;break ;
- case ASCESC : cmd = EXITPGM ;break ;
- case HOMEKEY : cmd = FIRSTPAGE ;break ;
- case ENDKEY : cmd = LASTPAGE ;break ;
- case UPARROW : cmd = PREVLINE ;break ;
- case DOWNARROW: cmd = NEXTLINE ;break ;
- case HELPKEY : cmd = HELPCMD ;break ;
- default : cmd = INVALIDCMD ;
- } /* end of switch statement */
- }
- return(cmd) ;
- }
-
-
- /* getekey - waits for and returns the next keystroke input */
- /* - use when expecting OA commands and other commands */
- /* Use HyperC's getkey() when OA commands are not expected */
-
- int getekey() /* get the next key input */
- {
- int c ;
-
- c = getkey(YES) ; /* get single ASCII character */
- if(peekb(0xc061) >= 0x80) /* check for open-apple */
- c = 0x80 + c ;
- return (c) ;
- }
-
-
-