[comp.emacs] Hack for MicroEMACS to support fkeys/keypad under

karl@sugar.UUCP (Karl Lehenbauer) (11/29/87)

This is a context diff of a hack to make MicroEMACS function keys work under 
Microport Unix System V/286.  You also have to replace your ANSI keyboard
mappings, defined in '/etc/rc.d/keybrd.rc' with one I've included as a
shell archive at the end.  Yes, it's gross, but it makes the function,
arrow keys, and miscellaneous keypad keys work.  Consult keybrd.rc 
for their definitions.

This adds a Microport entry to estruct.h for #if's:

*** estruct.orig	Fri Nov 27 20:37:19 1987
--- estruct.h	Fri Nov 27 20:37:06 1987
***************
*** 49,50
  #define	FINDER	0			/* Macintosh OS			*/
  

--- 49,51 -----
  #define	FINDER	0			/* Macintosh OS			*/
+ #define	MICROPORT 1			/* Sys V/286, set USG too	*/
  
This causes uEMACS to recognize ASCII decimal character 31 (^_) as a
function key prefix character.  It was the only I could figure out
that uEMACS didn't use for something that @#$%&* /etc/setkey would
accept (/etc/setkey doesn't conform to its manpage, either.  Perhaps
Microport sysv/286 2.2 will.

*** input.orig	Thu Nov 26 20:00:35 1987
--- input.c	Fri Nov 27 20:29:47 1987
***************
*** 305,306
  
  #if	AMIGA

--- 305,313 -----
  
+ #if	MICROPORT
+ 	if (c == 31) {	/* Apply SPEC prefix, it's control underscore */
+ 	        c = tgetc();
+ 		return(SPEC | c);
+ 	}
+ #endif
+ 
  #if	AMIGA

--------------------- 

Here's the shar for keybrd.rc.  

There are probably better mappings for some of these.  I don't know 'cuz
I'm new to EMACS.
------------------- cut here -------------------
:
#! /bin/sh
# This is a shell archive, created on Sugar Land Unix (..!uunet!nuchat!sugar)
# (bbs: 713-933-2440) by karl (Karl Lehenbauer) on Sat Nov 28 16:24:35 1987
# Remove anything before the "#! /bin/sh" line, then unpack it by saving
# it into a file and typing "sh file".  If you do not have sh, you need 
# unshar, a dearchiving program which is widely available.  In the absolute
# wost case, you can crack the files out by hand.
# If the archive is complete, you will see the message "End of archive."
# at the end.
# This archive contains the following files...
# 'keybrd.rc'
# To extract them, run the following through /bin/sh
echo x - keybrd.rc
sed 's/^X//' > keybrd.rc << '//END_OF_FILE'
X: /bin/sh
X#  @(#) MicroEMACS keybrd.rc
X#  set up the keyboard as hacked for MicroEMACS
X#
X/etc/setkey	ins		"^C"	# insert character
X/etc/setkey	up		"^P"	# up cursor
X/etc/setkey	down		"^N"	# down cursor
X/etc/setkey	left		"^B"	# left (backward) cursor
X/etc/setkey	right		"^F"	# right (forward) cursor
X/etc/setkey	shift left	"^[B"	# left word
X/etc/setkey	shift right	"^[F"	# right word
X/etc/setkey	home		"^[<"	# go to start of file
X/etc/setkey	end		"^[>"	# go to end of file
X/etc/setkey	alt ins		"^A^M^B"	# insert line
X/etc/setkey	alt del		"^A^[ ^N^W"	# delete line
X/etc/setkey	ctrl del	"^D"	# delete character
X/etc/setkey	ctrl up		"^X^P"	# scroll up
X/etc/setkey	ctrl down	"^X^N"	# scroll down
X/etc/setkey	pgup		"^Z"	# page up
X/etc/setkey	pgdn		"^V"	# page down
X#/etc/setkey	shift tab	"^[[Z"	# backtab
X#/etc/setkey	prtsc		"^[[i"	# copy to primary aux dev (print screen)
X/etc/setkey	ctrl left	"^[3^[B"	# jump left
X/etc/setkey	ctrl right	"^[3^[F"	# jump right
X/etc/setkey	f1		"^_;"	# function 1
X/etc/setkey	f2		"^_<"	# function 2
X/etc/setkey	f3		"^_="	# function 3
X/etc/setkey	f4		"^_>"	# function 4
X/etc/setkey	f5		"^_?"	# function 5
X/etc/setkey	f6		"^_@"	# function 6
X/etc/setkey	f7		"^_A"	# function 7
X/etc/setkey	f8		"^_B"	# function 8
X/etc/setkey	f9		"^_C"	# function 9
X/etc/setkey	f10		"^_D"	# function 10
X/etc/setkey	shift f1	"^_T"	# function 1 shifted
X/etc/setkey	shift f2	"^_U"	# function 2 shifted
X/etc/setkey	shift f3	"^_V"	# function 3 shifted
X/etc/setkey	shift f4	"^_W"	# function 4 shifted
X/etc/setkey	shift f5	"^_X"	# function 5 shifted
X/etc/setkey	shift f6	"^_Y"	# function 6 shifted
X/etc/setkey	shift f7	"^_Z"	# function 7 shifted
X/etc/setkey	shift f8	"^_["	# function 8 shifted
X/etc/setkey	shift f9	"^_\\"	# function 9 shifted
X/etc/setkey	shift f10	"^_]"	# function 10 shifted
X
X/etc/setkey	alt f10		"^[xhelp^M"	# get help
//END_OF_FILE
echo "End of archive."
# end of archive.
exit 0


-- 

manes@dasys1.UUCP (Steve Manes) (12/01/87)

In article <1132@sugar.UUCP> karl@sugar.UUCP (Karl Lehenbauer) writes:
>This is a context diff of a hack to make MicroEMACS function keys work under 
>Microport Unix System V/286.  You also have to replace your ANSI keyboard
>mappings, defined in '/etc/rc.d/keybrd.rc' with one I've included as a
>shell archive at the end.  Yes, it's gross, but it makes the function,
>arrow keys, and miscellaneous keypad keys work.  Consult keybrd.rc 
>for their definitions.

It's not necessary to add a new protocol code character to make uEMACS
work with Microport UNIX.  I modified Daniel's code to allow it to use
Microport's standard ANSI escape codes as follows.  This is the
beginning of his function 'get1key' in file 'input.c':

get1key()
	int	c;
#if AMIGA
	int	d;
#endif
#if UPORT
	static int gotmeta;
#endif

	/* get a keystroke */
	c = tgetc();
#ifdef UPORT
	if (gotmeta && c == '[' || c == 'O')) {
		gotmeta = FALSE;
		return( (c == '[') ? (SPEC | tgetc()) :
			(META | SPEC | tgetc()) );
	}
	gotmeta = (c == 0x1b) ? TRUE : FALSE;
#endif

and in the function 'getcmd':
...
...
	/* process META prefix */
	if (c == metac) {
		c = get1key();
#ifdef UPORT
		if (c & SPEC)
			return(c);
#endif
...
...

This allows Microport function keys to be attached to M-FNx keys.
You'll also need to do the 'bind.c' patch mentioned earlier in the
discussion to enable both upper and lowercase function key codes.
-- 
+-----------------------------------------------------------------------
+ Steve Manes         Roxy Recorders, Inc.                 NYC
+ decvax!philabs!cmcl2!hombre!magpie!manes       Magpie BBS: 212-420-0527
+ uunet!iuvax!bsu-cs!zoo-hq!magpie!manes              300/1200/2400