Add tn3270 with correct Makefiles.
This commit is contained in:
parent
2f84481095
commit
7bd7054808
|
@ -0,0 +1,6 @@
|
|||
.if !make(install)
|
||||
SUBDIR += tools
|
||||
.endif
|
||||
SUBDIR += tn3270 mset
|
||||
|
||||
.include <bsd.subdir.mk>
|
|
@ -0,0 +1,2 @@
|
|||
CFLAGS += -DTERMCAP -DSRCRT -DKLUDGELINEMODE -DUSE_TERMIO -DTN3270
|
||||
KBD = unix.kbd
|
|
@ -0,0 +1,25 @@
|
|||
.include <../../Makefile.inc>
|
||||
|
||||
CFLAGS += -I${.CURDIR} -I.
|
||||
|
||||
MAN1 = mset.0
|
||||
MAN5 = map3270.0
|
||||
|
||||
SRCS += astosc.c map3270.c mset.c
|
||||
|
||||
PROG = mset
|
||||
|
||||
astosc.o: astosc.OUT
|
||||
CLEANFILES += astosc.OUT astosc.out
|
||||
astosc.OUT: ${.CURDIR}/../ctlr/hostctlr.h ${.CURDIR}/../ctlr/function.h \
|
||||
${.CURDIR}/../ctlr/${KBD}
|
||||
${.CURDIR}/../tools/mkastosc/obj/mkastosc \
|
||||
${.CURDIR}/../ctlr/hostctlr.h ${.CURDIR}/../ctlr/function.h \
|
||||
< ${.CURDIR}/../ctlr/${KBD} > ${.TARGET}
|
||||
ln -s astosc.OUT astosc.out
|
||||
|
||||
# astosc.out
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
.PATH: ${.CURDIR}/../api ${.CURDIR}/../ascii
|
|
@ -0,0 +1,341 @@
|
|||
.\" Copyright (c) 1986 The Regents of the University of California.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. All advertising materials mentioning features or use of this software
|
||||
.\" must display the following acknowledgement:
|
||||
.\" This product includes software developed by the University of
|
||||
.\" California, Berkeley and its contributors.
|
||||
.\" 4. Neither the name of the University nor the names of its contributors
|
||||
.\" may be used to endorse or promote products derived from this software
|
||||
.\" without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)map3270.5 4.5 (Berkeley) 7/31/91
|
||||
.\"
|
||||
.TH MAP3270 5 "July 31, 1991"
|
||||
.UC 6
|
||||
.SH NAME
|
||||
map3270 \- database for mapping ascii keystrokes into IBM 3270 keys
|
||||
.SH SYNOPSIS
|
||||
.B map3270
|
||||
.SH DESCRIPTION
|
||||
When emulating IBM-syle 3270 terminals under \s-1UNIX\s0 (see \fItn3270\fR(1)),
|
||||
a mapping must be performed between sequences of keys hit on
|
||||
a user's (ascii) keyboard, and the keys that are
|
||||
available on a 3270. For example, a 3270 has a key labeled
|
||||
.B EEOF
|
||||
which erases the contents of the current field from the
|
||||
location of the cursor to the end.
|
||||
In order to accomplish this function,
|
||||
the terminal user and a program emulating a 3270 must
|
||||
agree on what keys will be typed
|
||||
to invoke the
|
||||
.B EEOF
|
||||
function.
|
||||
.PP
|
||||
The requirements for these sequences are:
|
||||
.nf
|
||||
.ta 4n 9n
|
||||
.sp
|
||||
1) that the first character of the sequence be outside of the
|
||||
standard ascii printable characters;
|
||||
.sp
|
||||
2) that no sequence \fIbe\fR an initial part of another (although
|
||||
sequences may \fIshare\fR initial parts).
|
||||
.sp
|
||||
.fi
|
||||
.SH FORMAT
|
||||
The file consists of entries for various keyboards. The first part
|
||||
of an entry lists the names of the keyboards which use that entry.
|
||||
These names will often be the same as in
|
||||
.I /etc/termcap
|
||||
(see
|
||||
.IR termcap (5));
|
||||
however, note that often the terminals from various termcap entries will all
|
||||
use the same
|
||||
.I map3270
|
||||
entry; for example, both 925 and 925vb (for
|
||||
925 with visual bells) would probably use the same
|
||||
.I map3270
|
||||
entry.
|
||||
Additionally, there are occasions when the terminal type defines
|
||||
a window manager, and it will then be necessary to specify a
|
||||
keyboard name (via the
|
||||
.B KEYBD
|
||||
environment variable) as the name of the entry.
|
||||
After the names, separated by vertical bars (`|'), comes a left
|
||||
brace (`{'); the definitions; and, finally, a right brace
|
||||
(`}').
|
||||
.PP
|
||||
Each definition consists of a reserved keyword (see list below) which
|
||||
identifies the 3270 function (extended as defined below), followed
|
||||
by an equal sign (`='), followed by the various ways to generate
|
||||
this particular function, followed by a semi-colon (`;').
|
||||
Each way is a sequence of strings of
|
||||
.I printable
|
||||
ascii characters enclosed inside single quotes (`\(aa');
|
||||
various ways (alternatives) are separated by vertical bars (`|').
|
||||
.PP
|
||||
Inside the single quotes, a few characters are special.
|
||||
A caret
|
||||
(`^') specifies that the next character is
|
||||
the ``control'' character of whatever the character is.
|
||||
So, `^a'
|
||||
represents control-a, ie: hexadecimal 1
|
||||
(note that `^A' would generate the same code).
|
||||
To generate
|
||||
.B rubout
|
||||
(DEL),
|
||||
one enters `^?'.
|
||||
To represent a control character inside a file
|
||||
requires using the caret to represent a control sequence;
|
||||
simply typing control-A will not work.
|
||||
Note: the ctrl-caret sequence
|
||||
(to generate a hexadecimal 1E)
|
||||
is represented as `^^' (not `^\e^').
|
||||
.PP
|
||||
In addition to the caret, a letter may be preceeded by a backslash (`\e').
|
||||
Since this has little effect for most characters,
|
||||
its use is usually not recommended.
|
||||
For the case of a single quote (`\(aa'), the backslash
|
||||
prevents that single quote from terminating the string.
|
||||
For the case of a caret (`^'), the backslash prevents
|
||||
the caret from having its special meaning.
|
||||
To have the backslash be part of the string, it is necessary to
|
||||
place two backslashes ('\e\e') in the file.
|
||||
.PP
|
||||
In addition, the following characters are special:
|
||||
.sp
|
||||
.nf
|
||||
.in +0.5i
|
||||
`\eE' means an escape character;
|
||||
`\en' means newline;
|
||||
`\et' means tab;
|
||||
`\er' means carriage return.
|
||||
.in -0.5i
|
||||
.fi
|
||||
.sp
|
||||
It is not necessary for each character in a string
|
||||
to be enclosed within single quotes.
|
||||
`\eE\eE\eE' means three escape characters.
|
||||
.PP
|
||||
Comments, which may appear anywhere on a line,
|
||||
begin with a hash mark (`#'), and terminate
|
||||
at the end of that line.
|
||||
However, comments cannot begin inside a quoted string;
|
||||
a hash mark inside a quoted string has no special meaning.
|
||||
.PP
|
||||
.SH 3270 KEYS SUPPORTED
|
||||
The following is the list of 3270 key names that are supported in this file.
|
||||
Note that some of the keys don't really exist on a 3270.
|
||||
In particular, the developers of this file have relied
|
||||
extensively on the work at the Yale University Computer Center with
|
||||
their 3270 emulator which runs in an IBM Series/1 front end.
|
||||
The following list corresponds closely to the functions
|
||||
that the developers of the Yale code offer in their product.
|
||||
.sp
|
||||
.B In the following list, the
|
||||
.B starred ("*")
|
||||
.B functions are not supported by
|
||||
.IR tn3270 (1).
|
||||
An unsupported function will cause
|
||||
.IR tn3270(1)
|
||||
to send a (possibly visual) bell sequence to the user's terminal.
|
||||
.sp
|
||||
.nf
|
||||
3270 Key Name Functional description
|
||||
|
||||
(*)LPRT local print
|
||||
DP dup character
|
||||
FM field mark character
|
||||
CURSEL cursor select
|
||||
CENTSIGN EBCDIC cent sign
|
||||
RESHOW redisplay the screen
|
||||
EINP erase input
|
||||
EEOF erase end of field
|
||||
DELETE delete character
|
||||
INSRT toggle insert mode
|
||||
TAB field tab
|
||||
BTAB field back tab
|
||||
COLTAB column tab
|
||||
COLBAK column back tab
|
||||
INDENT indent one tab stop
|
||||
UNDENT undent one tab stop
|
||||
NL new line
|
||||
HOME home the cursor
|
||||
UP up cursor
|
||||
DOWN down cursor
|
||||
RIGHT right cursor
|
||||
LEFT left cursor
|
||||
SETTAB set a column tab
|
||||
DELTAB delete a columntab
|
||||
SETMRG set left margin
|
||||
SETHOM set home position
|
||||
CLRTAB clear all column tabs
|
||||
(*)APLON apl on
|
||||
(*)APLOFF apl off
|
||||
(*)APLEND treat input as ascii
|
||||
(*)PCON xon/xoff on
|
||||
(*)PCOFF xon/xoff off
|
||||
DISC disconnect (suspend)
|
||||
(*)INIT new terminal type
|
||||
(*)ALTK alternate keyboard dvorak
|
||||
FLINP flush input
|
||||
ERASE erase last character
|
||||
WERASE erase last word
|
||||
FERASE erase field
|
||||
SYNCH we are in synch with the user
|
||||
RESET reset key-unlock keyboard
|
||||
MASTER_RESET reset, unlock and redisplay
|
||||
(*)XOFF please hold output
|
||||
(*)XON please give me output
|
||||
ESCAPE enter telnet command mode
|
||||
WORDTAB tab to beginning of next word
|
||||
WORDBACKTAB tab to beginning of current/last word
|
||||
WORDEND tab to end of current/next word
|
||||
FIELDEND tab to last non-blank of current/next
|
||||
unprotected (writable) field.
|
||||
|
||||
PA1 program attention 1
|
||||
PA2 program attention 2
|
||||
PA3 program attention 3
|
||||
|
||||
CLEAR local clear of the 3270 screen
|
||||
TREQ test request
|
||||
ENTER enter key
|
||||
|
||||
PFK1 program function key 1
|
||||
PFK2 program function key 2
|
||||
etc. etc.
|
||||
PFK36 program function key 36
|
||||
.SH A SAMPLE ENTRY
|
||||
The following entry is used by
|
||||
tn3270(1) when unable to locate a reasonable version in the
|
||||
user's environment and in /etc/map3270:
|
||||
.sp
|
||||
.nf
|
||||
name { # actual name comes from TERM variable
|
||||
clear = '^z';
|
||||
flinp = '^x';
|
||||
enter = '^m';
|
||||
delete = '^d' | '^?'; # note that '^?' is delete (rubout)
|
||||
synch = '^r';
|
||||
reshow = '^v';
|
||||
eeof = '^e';
|
||||
tab = '^i';
|
||||
btab = '^b';
|
||||
nl = '^n';
|
||||
left = '^h';
|
||||
right = '^l';
|
||||
up = '^k';
|
||||
down = '^j';
|
||||
einp = '^w';
|
||||
reset = '^t';
|
||||
xoff = '^s';
|
||||
xon = '^q';
|
||||
escape = '^c';
|
||||
ferase = '^u';
|
||||
insrt = '\E ';
|
||||
# program attention keys
|
||||
pa1 = '^p1'; pa2 = '^p2'; pa3 = '^p3';
|
||||
# program function keys
|
||||
pfk1 = '\eE1'; pfk2 = '\eE2'; pfk3 = '\eE3'; pfk4 = '\eE4';
|
||||
pfk5 = '\eE5'; pfk6 = '\eE6'; pfk7 = '\eE7'; pfk8 = '\eE8';
|
||||
pfk9 = '\eE9'; pfk10 = '\eE0'; pfk11 = '\eE-'; pfk12 = '\eE=';
|
||||
pfk13 = '\eE!'; pfk14 = '\eE@'; pfk15 = '\eE#'; pfk16 = '\eE$';
|
||||
pfk17 = '\eE%'; pfk18 = '\eE'; pfk19 = '\eE&'; pfk20 = '\eE*';
|
||||
pfk21 = '\eE('; pfk22 = '\eE)'; pfk23 = '\eE_'; pfk24 = '\eE+';
|
||||
}
|
||||
.fi
|
||||
.SH "IBM 3270 KEY DEFINITONS FOR AN ABOVE DEFINITION"
|
||||
The charts below show the proper keys to emulate
|
||||
each 3270 function when using the default key mapping supplied
|
||||
with
|
||||
.IR tn3270 (1)
|
||||
and
|
||||
.IR mset (1).
|
||||
.sp
|
||||
.nf
|
||||
Command Keys IBM 3270 Key Default Key(s)
|
||||
Enter RETURN
|
||||
Clear control-z
|
||||
Cursor Movement Keys
|
||||
New Line control-n or
|
||||
Home
|
||||
Tab control-i
|
||||
Back Tab control-b
|
||||
Cursor Left control-h
|
||||
Cursor Right control-l
|
||||
Cursor Up control-k
|
||||
Cursor Down control-j or
|
||||
LINE FEED
|
||||
Edit Control Keys
|
||||
Delete Char control-d or
|
||||
RUB
|
||||
Erase EOF control-e
|
||||
Erase Input control-w
|
||||
Insert Mode ESC Space
|
||||
End Insert ESC Space
|
||||
Program Function Keys
|
||||
PF1 ESC 1
|
||||
PF2 ESC 2
|
||||
... ...
|
||||
PF10 ESC 0
|
||||
PF11 ESC -
|
||||
PF12 ESC =
|
||||
PF13 ESC !
|
||||
PF14 ESC @
|
||||
... ...
|
||||
PF24 ESC +
|
||||
Program Attention Keys
|
||||
PA1 control-p 1
|
||||
PA2 control-p 2
|
||||
PA3 control-p 3
|
||||
Local Control Keys
|
||||
Reset After Error control-r
|
||||
Purge Input Buffer control-x
|
||||
Keyboard Unlock control-t
|
||||
Redisplay Screen control-v
|
||||
Other Keys
|
||||
Erase current field control-u
|
||||
.fi
|
||||
.SH FILES
|
||||
/etc/map3270
|
||||
.SH SEE ALSO
|
||||
tn3270(1), mset(1), \fIYale ASCII Terminal Communication
|
||||
System II Program Description/Operator's Manual\fR
|
||||
(IBM SB30-1911)
|
||||
.SH AUTHOR
|
||||
Greg Minshall
|
||||
.SH BUGS
|
||||
.I Tn3270
|
||||
doesn't yet understand how to process all the functions
|
||||
available in
|
||||
.I map3270;
|
||||
when such a function is requested
|
||||
.I tn3270
|
||||
will beep at you.
|
||||
.PP
|
||||
The definition of "word" (for "word erase", "word tab") should be a run-time
|
||||
option. Currently it is defined as the kernel tty driver defines it (strings
|
||||
of non-whitespace); more than one person would rather use the "vi" definition
|
||||
(strings of specials, strings of alphanumeric).
|
|
@ -0,0 +1,188 @@
|
|||
.\" Copyright (c) 1986, 1990 The Regents of the University of California.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. All advertising materials mentioning features or use of this software
|
||||
.\" must display the following acknowledgement:
|
||||
.\" This product includes software developed by the University of
|
||||
.\" California, Berkeley and its contributors.
|
||||
.\" 4. Neither the name of the University nor the names of its contributors
|
||||
.\" may be used to endorse or promote products derived from this software
|
||||
.\" without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)mset.1 4.6 (Berkeley) 7/27/91
|
||||
.\"
|
||||
.Dd July 27, 1991
|
||||
.Dt MSET 1
|
||||
.Os BSD 4.3
|
||||
.Sh NAME
|
||||
.Nm mset
|
||||
.Nd retrieve
|
||||
.Tn ASCII
|
||||
to
|
||||
.Tn IBM
|
||||
3270 keyboard map
|
||||
.Sh SYNOPSIS
|
||||
.Nm mset
|
||||
.Op Fl picky
|
||||
.Op Fl shell
|
||||
.Op Ar keyboardname
|
||||
.Sh DESCRIPTION
|
||||
.Nm Mset
|
||||
retrieves mapping information
|
||||
for the
|
||||
.Tn ASCII
|
||||
keyboard to
|
||||
.Tn IBM
|
||||
3270 terminal
|
||||
special functions.
|
||||
Normally, these mappings are found
|
||||
in
|
||||
.Pa /usr/share/misc/map3270
|
||||
(see
|
||||
.Xr map3270 5 ) .
|
||||
This information is used by the
|
||||
.Xr tn3270
|
||||
command (see
|
||||
.Xr tn3270 1 ) .
|
||||
.Pp
|
||||
The default
|
||||
.Nm mset
|
||||
output can be used to store the mapping information in the process environment
|
||||
in order to avoid scanning
|
||||
.Nm map3270
|
||||
each time
|
||||
.Nm tn3270
|
||||
is invoked.
|
||||
To do this, place the following command in your
|
||||
.Pa .login
|
||||
file:
|
||||
.Bd -literal -offset indent
|
||||
set noglob; setenv MAP3270 "\(gamset\(ga"; unset noglob
|
||||
.Ed
|
||||
.Pp
|
||||
If the
|
||||
.Ar keyboardname
|
||||
argument is not supplied,
|
||||
.Nm mset
|
||||
attempts to determine the name of the keyboard the user is using,
|
||||
by checking the
|
||||
.Ev KEYBD
|
||||
environment variable.
|
||||
If the
|
||||
.Ev KEYBD
|
||||
environment variable is not set, then
|
||||
.Nm mset
|
||||
uses the user's terminal type from the environment variable
|
||||
.Ev TERM
|
||||
as the keyboard name.
|
||||
Normally,
|
||||
.Nm mset
|
||||
then uses the file
|
||||
.Xr map3270 5
|
||||
to find the keyboard mapping for that terminal.
|
||||
However, if the environment variable
|
||||
.Ev MAP3270
|
||||
exists and contains the entry for the specified keyboard, then that
|
||||
definition is used.
|
||||
If the value of
|
||||
.Ev MAP3270
|
||||
begins with a slash (`/') then it is assumed to be the full pathname
|
||||
of an alternate mapping file and that file is searched first.
|
||||
In any case, if the mapping for the keyboard is not found in
|
||||
the environment, nor in an alternate map file, nor in the standard map file,
|
||||
then the same search is performed for an entry for a keyboard with the name
|
||||
.Ar unknown .
|
||||
If that search also fails,
|
||||
then a default mapping
|
||||
is used.
|
||||
.Pp
|
||||
The arguments to
|
||||
.Nm mset
|
||||
are:
|
||||
.Pp
|
||||
.Bl -tag -width Fl
|
||||
.It Fl picky
|
||||
When processing the various
|
||||
.Pa map3270
|
||||
entries (for the user's keyboard,
|
||||
and all those encountered before the one for the user's keyboard),
|
||||
.Nm mset
|
||||
normally will not complain about entries for unknown functions (like
|
||||
.Dq PFX1 ;
|
||||
the
|
||||
.Fl picky
|
||||
argument causes
|
||||
.Nm mset
|
||||
to issue warning messages about these unknown entries.
|
||||
.It Fl shell
|
||||
If the
|
||||
.Pa map3270
|
||||
entry is longer than the shell's 1024 environmental variable
|
||||
length limit, the default
|
||||
.Nm mset
|
||||
output cannot be used to store the mapping information in the process
|
||||
environment to avoid scanning
|
||||
.Pa map3270
|
||||
each time
|
||||
.Nm tn3270
|
||||
is invoked.
|
||||
The
|
||||
.Fl shell
|
||||
argument causes
|
||||
.Nm mset
|
||||
to generate shell commands to set the environmental variables
|
||||
.Ev MAP3270 ,
|
||||
.Ev MAP3270A ,
|
||||
and so on, breaking up the entry to fit within the shell environmental
|
||||
variable length limit.
|
||||
To set these variables, place the following command in your
|
||||
.Pa .login
|
||||
file:
|
||||
.Bd -literal -offset indent
|
||||
mset -shell > tmp ; source tmp ; /bin/rm tmp
|
||||
.Ed
|
||||
.It Ar keyboardname
|
||||
When searching for the
|
||||
.Pa map3270
|
||||
entry that matches the user's keyboard,
|
||||
.Nm mset
|
||||
will use
|
||||
.Ar keyboardname
|
||||
instead of determining the keyboard name from the
|
||||
.Ev KEYBD
|
||||
or
|
||||
.Ev TERM
|
||||
environmental variables.
|
||||
.Sh FILES
|
||||
.Bl -tag -width /usr/share/misc/map3270 -compact
|
||||
.It Pa /usr/share/misc/map3270
|
||||
keyboard mapping for known keyboards
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr tn3270 1 ,
|
||||
.Xr map3270 5
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm mset
|
||||
command appeared in
|
||||
.Bx 4.3 .
|
|
@ -0,0 +1,53 @@
|
|||
.include <../../Makefile.inc>
|
||||
|
||||
CFLAGS += -I${.CURDIR} -I.
|
||||
LDADD += -lcrypt -lcurses -ltermcap -ltelnet
|
||||
DPADD += ${LIBCRYPT} ${LIBCURSES} /usr/lib/libtermcap.a /usr/lib/libtelnet.a
|
||||
|
||||
MAN1 = tn3270.0
|
||||
|
||||
SRCS += apilib.c api_bsd.c api_exch.c asc_ebc.c astosc.c dctype.c
|
||||
SRCS += disp_asc.c ebc_disp.c
|
||||
SRCS += map3270.c termin.c
|
||||
SRCS += api.c function.c inbound.c oia.c options.c outbound.c
|
||||
SRCS += genbsubs.c globals.c system.c termout.c
|
||||
SRCS += commands.c main.c network.c ring.c sys_bsd.c telnet.c terminal.c
|
||||
SRCS += tn3270.c utilities.c
|
||||
|
||||
PROG = tn3270
|
||||
|
||||
astosc.o: astosc.OUT
|
||||
CLEANFILES += astosc.OUT astosc.out
|
||||
astosc.OUT: ${.CURDIR}/../ctlr/hostctlr.h ${.CURDIR}/../ctlr/function.h \
|
||||
${.CURDIR}/../ctlr/${KBD}
|
||||
${.CURDIR}/../tools/mkastosc/obj/mkastosc ${.CURDIR}/../ctlr/hostctlr.h \
|
||||
${.CURDIR}/../ctlr/function.h < ${.CURDIR}/../ctlr/${KBD} \
|
||||
> ${.TARGET}
|
||||
ln -s astosc.OUT astosc.out
|
||||
|
||||
disp_asc.o: asc_disp.OUT disp_asc.OUT
|
||||
CLEANFILES += asc_disp.OUT asc_disp.out disp_asc.OUT disp_asc.out
|
||||
asc_disp.OUT:
|
||||
${.CURDIR}/../tools/mkastods/obj/mkastods > ${.TARGET}
|
||||
ln -s asc_disp.OUT asc_disp.out
|
||||
disp_asc.OUT:
|
||||
${.CURDIR}/../tools/mkdstoas/obj/mkdstoas > ${.TARGET}
|
||||
ln -s disp_asc.OUT disp_asc.out
|
||||
|
||||
inbound.o: kbd.OUT
|
||||
CLEANFILES += kbd.OUT kbd.out
|
||||
kbd.OUT: ${.CURDIR}/../ctlr/hostctlr.h ${.CURDIR}/../ctlr/${KBD}
|
||||
${CC} ${CFLAGS} -E ${.CURDIR}/../ctlr/function.c > TMPfunc.out
|
||||
${.CURDIR}/../tools/mkhits/obj/mkhits ${.CURDIR}/../ctlr/hostctlr.h \
|
||||
TMPfunc.out < ${.CURDIR}/../ctlr/${KBD} > ${.TARGET}
|
||||
ln -s kbd.OUT kbd.out
|
||||
|
||||
# astosc.out
|
||||
# asc_disp.out disp_asc.out
|
||||
# default.map
|
||||
# kbd.out
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
.PATH: ${.CURDIR}/../api ${.CURDIR}/../ascii ${.CURDIR}/../ctlr
|
||||
.PATH: ${.CURDIR}/../general ${.CURDIR}/../sys_curses ${.CURDIR}/../../telnet
|
|
@ -0,0 +1,339 @@
|
|||
.\" Copyright (c) 1986, 1990 The Regents of the University of California.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. All advertising materials mentioning features or use of this software
|
||||
.\" must display the following acknowledgement:
|
||||
.\" This product includes software developed by the University of
|
||||
.\" California, Berkeley and its contributors.
|
||||
.\" 4. Neither the name of the University nor the names of its contributors
|
||||
.\" may be used to endorse or promote products derived from this software
|
||||
.\" without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)tn3270.1 4.6 (Berkeley) 7/27/91
|
||||
.\"
|
||||
.Dd July 27, 1991
|
||||
.Dt TN3270 1
|
||||
.Os BSD 4.3
|
||||
.Sh NAME
|
||||
.Nm tn3270
|
||||
.Nd full-screen remote login to
|
||||
.Tn IBM VM/CMS
|
||||
.Sh SYNOPSIS
|
||||
.Nm tn3270
|
||||
.Op Fl d
|
||||
.Op Fl n Ar filename
|
||||
.Op Fl t Ar commandname
|
||||
.Op Ar sysname Op port
|
||||
.Sh DESCRIPTION
|
||||
.Nm Tn3270
|
||||
permits a full-screen, full-duplex connection
|
||||
from a
|
||||
.Tn UNIX
|
||||
machine
|
||||
to an
|
||||
.Tn IBM
|
||||
(or compatible) machine.
|
||||
.Nm Tn3270
|
||||
gives the appearance of being logged in
|
||||
to the remote machine
|
||||
from an
|
||||
.Tn IBM
|
||||
3270 terminal.
|
||||
Of course, you must have an account on the machine
|
||||
to which you connect in order to log in.
|
||||
.Nm Tn3270
|
||||
looks to the user in many respects
|
||||
like the Yale
|
||||
.Tn ASCII
|
||||
Terminal Communication System II.
|
||||
.Nm Tn3270
|
||||
is actually a modification of the Arpanet
|
||||
.Tn TELNET
|
||||
user interface (see
|
||||
.Xr telnet 1 )
|
||||
which will, in certain circumstances, interpret and generate
|
||||
raw 3270 control streams.
|
||||
.Pp
|
||||
The flags to
|
||||
.Nm tn3270
|
||||
are as follows:
|
||||
.Bl -tag -width Fl
|
||||
.It Fl d
|
||||
Turn on socket-level tracing (for super-user only)
|
||||
.Fl n Ns Ar filename
|
||||
Specify a file to receive network trace data
|
||||
output (from commands "toggle netdata" and
|
||||
"toggle options", see
|
||||
.Xr telnet 1 ) ;
|
||||
the default is for output
|
||||
to be directed to the standard error file.
|
||||
.Fl t Ns Ar commandname
|
||||
Specify a
|
||||
.Tn UNIX
|
||||
command to process
|
||||
.Tn IBM
|
||||
4994 style transparent mode
|
||||
data received from the remote
|
||||
.Tn IBM
|
||||
machine.
|
||||
.It Ar sysname
|
||||
The name of the remote system. If the remote name
|
||||
is NOT specified, the user will be prompted for a
|
||||
command (see below).
|
||||
.It Ar port
|
||||
The port to connect to on the remote system.
|
||||
Normally,
|
||||
.Nm tn3270
|
||||
attempts to connect to the
|
||||
standard
|
||||
.Tn TELNET
|
||||
port (port
|
||||
23) on the remote machine.
|
||||
.El
|
||||
.Pp
|
||||
When
|
||||
.Nm tn3270
|
||||
first connects to the remote system, it will negotiate to go into
|
||||
3270 mode.
|
||||
Part of this negotiation involves telling the remote system what model
|
||||
3270 it is emulating.
|
||||
In all cases,
|
||||
.Nm tn3270
|
||||
emulates a 3278 terminal.
|
||||
To decide which specific model,
|
||||
.Nm tn3270
|
||||
looks at the number of lines and columns on the actual terminal (as
|
||||
defined in the
|
||||
.Ev TERM
|
||||
environment variable; see
|
||||
.Xr termcap 5 ) .
|
||||
The terminal (or window in which
|
||||
.Nm tn3270
|
||||
is running, on multiple
|
||||
window systems) must have at least 80 columns and 24 lines, or
|
||||
.Nm tn3270
|
||||
will not go into emulation mode.
|
||||
If the terminal does have at least 80 columns and at least 24 lines,
|
||||
the following table describes the emulation:
|
||||
.Pp
|
||||
.ne 7v
|
||||
.Bd -filled -offset center
|
||||
.Bl -column (rows*columns)
|
||||
.It minimum_size emulated
|
||||
.It (rows*columns) terminal
|
||||
.It -------------- ------------
|
||||
.It 27*132 3278 model 5
|
||||
.It 43*80 3278 model 4
|
||||
.It 32*80 3278 model 3
|
||||
.It 24*80 3278 model 2.
|
||||
.El
|
||||
.Ed
|
||||
.Pp
|
||||
Emulation of the 3270 terminal is done in the
|
||||
.Tn UNIX
|
||||
process.
|
||||
This emulation involves mapping
|
||||
3270-style commands from the host
|
||||
into appropriate sequences to control the user's terminal screen.
|
||||
.Nm Tn3270
|
||||
uses
|
||||
.Xr curses 3
|
||||
and the
|
||||
.Pa /usr/share/misc/termcap
|
||||
file to do this.
|
||||
The emulation also involves simulating the special 3270 keyboard keys
|
||||
(program function keys, etc.)
|
||||
by mapping sequences of keystrokes
|
||||
from the
|
||||
.Tn ASCII
|
||||
keyboard into appropriate 3270 control strings.
|
||||
This mapping is terminal dependent and is specified
|
||||
in a description file,
|
||||
.Pa /usr/share/misc/map3270 ,
|
||||
(see
|
||||
.Xr map3270 5 )
|
||||
or in an environment variable
|
||||
.Ev MAP3270
|
||||
(and, if necessary,
|
||||
.Ev MAP3270A ,
|
||||
.Ev MAP3270B ,
|
||||
and so on - see
|
||||
.Xr mset 1 ) .
|
||||
Any special function keys on the
|
||||
.Tn ASCII
|
||||
keyboard are used whenever possible.
|
||||
If an entry for the user's terminal
|
||||
is not found,
|
||||
.Nm tn3270
|
||||
looks for an entry for the terminal type
|
||||
.Em unknown .
|
||||
If this is not found,
|
||||
.Nm tn3270
|
||||
uses a default keyboard mapping
|
||||
(see
|
||||
.Xr map3270 5 ) .
|
||||
.Pp
|
||||
The first character of each special keyboard mapping sequence
|
||||
is either an
|
||||
.Tn ASCII
|
||||
escape
|
||||
.Pq Tn ESC ,
|
||||
a control character, or an
|
||||
.Tn ASCII
|
||||
delete
|
||||
.Pq Tn DEL .
|
||||
If the user types an unrecognized function key sequence,
|
||||
.Nm tn3270
|
||||
sends an
|
||||
.Tn ASCII
|
||||
bell
|
||||
.Pq Tn BEL ,
|
||||
or a visual bell if
|
||||
defined in the user's termcap entry, to the user's terminal
|
||||
and nothing is sent to the
|
||||
.Tn IBM
|
||||
host.
|
||||
.Pp
|
||||
If
|
||||
.Nm tn3270
|
||||
is invoked without specifying a remote host system name,
|
||||
it enters local command mode,
|
||||
indicated by the prompt
|
||||
.Dq Li tn3270>\ .
|
||||
In this mode,
|
||||
.Nm tn3270
|
||||
accepts and executes
|
||||
all the commands of
|
||||
.Xr telnet 1 ,
|
||||
plus one additional command:
|
||||
.Pp
|
||||
.Bl -tag -width Ar
|
||||
.It Ic transcom
|
||||
Specify
|
||||
.Tn UNIX
|
||||
command for
|
||||
.Tn IBM
|
||||
4994 style transparent mode processing.
|
||||
.El
|
||||
.Pp
|
||||
.Nm Tn3270
|
||||
command mode may also be entered, after connecting to a host, by typing
|
||||
a special escape sequence.
|
||||
If
|
||||
.Nm tn3270
|
||||
has succeeded in negotiating 3270 mode with the remote host, the
|
||||
escape sequence will be as defined by the map3270 (see
|
||||
.Xr map3270 5 )
|
||||
entry for the user's terminal type
|
||||
(typically control-C);
|
||||
otherwise the escape sequence will initially be set to the
|
||||
single character
|
||||
.Sq Li \&^]
|
||||
(control right square bracket).
|
||||
.Pp
|
||||
While in command mode, any host login session is still alive
|
||||
but temporarily suspended.
|
||||
The host login session may be resumed by entering an empty line
|
||||
(press the
|
||||
.Tn RETURN
|
||||
key)
|
||||
in response to the command prompt.
|
||||
A session may be terminated by logging off the foreign host,
|
||||
or by typing ``quit'' or ``close'' while in local command mode.
|
||||
.Sh FILES
|
||||
.Bl -tag -width /usr/share/misc/termcap -compact
|
||||
.It Pa /usr/share/misc/termcap
|
||||
.It Pa /usr/share/misc/map3270
|
||||
.El
|
||||
.\" .Sh AUTHOR
|
||||
.\" Greg Minshall
|
||||
.Sh NOTES
|
||||
The
|
||||
.Tn IBM
|
||||
4994 style transparent mode command is invoked when
|
||||
.Nm tn3270
|
||||
receives
|
||||
.Tn IBM
|
||||
4994 style transparent output from the remote host.
|
||||
Output and input pipes are created for communication between the two
|
||||
processes.
|
||||
The pipes are closed when a 3270 clear command is received from the remote
|
||||
hosts, signalling the end of transparent mode output.
|
||||
Transparent mode is necessary for sending
|
||||
.Tn ASCII
|
||||
control characters over the
|
||||
3270 terminal connection;
|
||||
.Tn ASCII
|
||||
graphics terminal support is accomplished this
|
||||
way.
|
||||
Developers of
|
||||
.Ic transcom
|
||||
commands should note that the
|
||||
.Ic transcom
|
||||
stdin pipe end will be in
|
||||
.Dv CBREAK
|
||||
mode, with
|
||||
.Dv ECHO
|
||||
and
|
||||
.Dv CRMOD
|
||||
turned off.
|
||||
.Sh ENVIRONMENT
|
||||
.Nm Tn3270
|
||||
checks the following environment variables:
|
||||
.Ev TERM ,
|
||||
.Ev MAP3270 ,
|
||||
.Ev MAP3270[A...] .
|
||||
Information on these can be found in
|
||||
.Xr mset 1 .
|
||||
.Nm Tn3270
|
||||
also checks
|
||||
.Ev SHELL ,
|
||||
.Ev KEYBD
|
||||
and
|
||||
.Ev API3270 .
|
||||
.Sh SEE ALSO
|
||||
.Xr mset 1 ,
|
||||
.Xr telnet 1 ,
|
||||
.Xr curses 3 ,
|
||||
.Xr termcap 3 ,
|
||||
.Xr termcap 5 ,
|
||||
.Xr map3270 5 ,
|
||||
.Rs
|
||||
.%T "Yale ASCII Terminal Communication"
|
||||
.%B "System II Program Description/Operator's Manual"
|
||||
.%R IBM SB30-1911
|
||||
.Re
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm tn3270
|
||||
command appeared in
|
||||
.Bx 4.3 .
|
||||
.Sh BUGS
|
||||
Tn3270 is slow and uses system resources prodigiously.
|
||||
.Pp
|
||||
Not all 3270 functions are supported,
|
||||
nor all Yale enhancements.
|
||||
.Pp
|
||||
Error conditions (attempting to enter data in a protected field, for
|
||||
example) should cause a message to be sent to the user's terminal
|
||||
instead of just ringing a bell.
|
|
@ -0,0 +1,3 @@
|
|||
SUBDIR = mkhits mkastosc mkastods mkdstoas mkdctype
|
||||
|
||||
.include <bsd.subdir.mk>
|
|
@ -0,0 +1,8 @@
|
|||
CFLAGS += -I${.CURDIR}/.. -I.
|
||||
|
||||
SRCS = mkastods.c asc_ebc.c ebc_disp.c
|
||||
PROG = mkastods
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
.PATH: ${.CURDIR}/../../api
|
|
@ -0,0 +1,77 @@
|
|||
/*-
|
||||
* Copyright (c) 1988 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
char copyright[] =
|
||||
"@(#) Copyright (c) 1988 The Regents of the University of California.\n\
|
||||
All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)mkastods.c 4.2 (Berkeley) 4/26/91";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <stdio.h>
|
||||
#if defined(unix)
|
||||
#include <strings.h>
|
||||
#else /* defined(unix) */
|
||||
#include <string.h>
|
||||
#endif /* defined(unix) */
|
||||
#include <ctype.h>
|
||||
#include "../api/asc_ebc.h"
|
||||
#include "../api/ebc_disp.h"
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
int i;
|
||||
|
||||
/* For each ascii code, find the display code that matches */
|
||||
|
||||
printf("unsigned char asc_disp[256] = {");
|
||||
for (i = 0; i < NASCII; i++) {
|
||||
if ((i%8) == 0) {
|
||||
printf("\n");
|
||||
}
|
||||
printf("\t0x%02x,", ebc_disp[asc_ebc[i]]);
|
||||
}
|
||||
for (i = sizeof disp_ebc; i < 256; i++) {
|
||||
if ((i%8) == 0) {
|
||||
printf("\n");
|
||||
}
|
||||
printf("\t0x%02x,", 0);
|
||||
}
|
||||
printf("\n};\n");
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
CFLAGS += -I${.CURDIR}/../mkhits -I${.CURDIR}/.. -I.
|
||||
|
||||
SRCS = mkastosc.c dohits.c asc_ebc.c ebc_disp.c
|
||||
PROG = mkastosc
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
.PATH: ${.CURDIR}/../mkhits ${.CURDIR}/../../api
|
|
@ -0,0 +1,166 @@
|
|||
/*-
|
||||
* Copyright (c) 1988 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
char copyright[] =
|
||||
"@(#) Copyright (c) 1988 The Regents of the University of California.\n\
|
||||
All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)mkastosc.c 4.2 (Berkeley) 4/26/91";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <stdio.h>
|
||||
#if defined(unix)
|
||||
#include <strings.h>
|
||||
#else /* defined(unix) */
|
||||
#include <string.h>
|
||||
#endif /* defined(unix) */
|
||||
#include <ctype.h>
|
||||
|
||||
#include "../general/general.h"
|
||||
#include "../ctlr/function.h"
|
||||
|
||||
#include "dohits.h"
|
||||
|
||||
static struct tbl {
|
||||
unsigned char
|
||||
scancode,
|
||||
used;
|
||||
char
|
||||
*shiftstate;
|
||||
} tbl[128];
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
int scancode;
|
||||
int asciicode;
|
||||
int empty;
|
||||
int i;
|
||||
int c;
|
||||
int found;
|
||||
struct hits *ph;
|
||||
struct Hits *Ph;
|
||||
struct thing *this;
|
||||
struct thing **attable;
|
||||
struct tbl *Pt;
|
||||
static char *shiftof[] =
|
||||
{ "0", "SHIFT_UPSHIFT", "SHIFT_ALT", "SHIFT_ALT|SHIFT_UPSHIFT" };
|
||||
char *aidfile = 0, *fcnfile = 0;
|
||||
|
||||
if (argc > 1) {
|
||||
if (argv[1][0] != '-') {
|
||||
aidfile = argv[1];
|
||||
}
|
||||
}
|
||||
if (argc > 2) {
|
||||
if (argv[2][0] != '-') {
|
||||
fcnfile = argv[2];
|
||||
}
|
||||
}
|
||||
|
||||
dohits(aidfile, fcnfile); /* Set up "Hits" */
|
||||
|
||||
printf("/*\n");
|
||||
printf(" * Ascii to scancode conversion table. First\n");
|
||||
printf(" * 128 bytes (0-127) correspond with actual Ascii\n");
|
||||
printf(" * characters; the rest are functions from ctrl/function.h\n");
|
||||
printf(" */\n");
|
||||
/* Build the ascii part of the table. */
|
||||
for (Ph = Hits, scancode = 0; Ph <= Hits+highestof(Hits);
|
||||
Ph++, scancode++) {
|
||||
ph = &Ph->hits;
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (ph->hit[i].ctlrfcn == FCN_CHARACTER) {
|
||||
c = Ph->name[i][0]; /* "name" of this one */
|
||||
if (tbl[c].used == 0) {
|
||||
tbl[c].used = 1;
|
||||
tbl[c].shiftstate = shiftof[i];
|
||||
tbl[c].scancode = scancode;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Now, output the table */
|
||||
for (Pt = tbl, asciicode = 0; Pt <= tbl+highestof(tbl); Pt++, asciicode++) {
|
||||
if (Pt->used == 0) {
|
||||
if (isprint(asciicode) && (asciicode != ' ')) {
|
||||
fprintf(stderr, "Unable to produce scancode sequence for");
|
||||
fprintf(stderr, " ASCII character [%c]!\n", asciicode);
|
||||
}
|
||||
printf("\t{ 0, 0, undefined, 0 },\t");
|
||||
} else {
|
||||
printf("\t{ 0x%02x, %s, FCN_CHARACTER, 0 },",
|
||||
Pt->scancode, Pt->shiftstate);
|
||||
}
|
||||
printf("\t/* 0x%x", asciicode);
|
||||
if (isprint(asciicode)) {
|
||||
printf(" [%c]", asciicode);
|
||||
}
|
||||
printf(" */\n");
|
||||
}
|
||||
|
||||
|
||||
for (attable = &table[0]; attable <= &table[highestof(table)]; attable++) {
|
||||
for (this = *attable; this; this = this->next) {
|
||||
Ph = this->hits;
|
||||
if (Ph == 0) {
|
||||
continue;
|
||||
}
|
||||
for (i = 0; i < 4; i++) {
|
||||
if ((Ph->name[i] != 0) &&
|
||||
(Ph->name[i][0] == this->name[0]) &&
|
||||
(strcmp(Ph->name[i], this->name) == 0)) {
|
||||
printf("\t{ 0x%02x, %s, ",
|
||||
Ph-Hits, shiftof[i]);
|
||||
if (memcmp("AID_", this->name, 4) == 0) { /* AID key */
|
||||
printf("FCN_AID, ");
|
||||
} else {
|
||||
printf("%s, ", Ph->name[i]);
|
||||
}
|
||||
if (memcmp("PF", this->name+4, 2) == 0) {
|
||||
printf("\"PFK%s\" },\n", Ph->name[i]+4+2);
|
||||
} else {
|
||||
printf("\"%s\" },\n", Ph->name[i]+4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
CFLAGS += -I${.CURDIR}/.. -I.
|
||||
|
||||
SRCS = mkdctype.c ebc_disp.c ectype.c
|
||||
PROG = mkdctype
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
.PATH: ${.CURDIR}/../../api
|
|
@ -0,0 +1,313 @@
|
|||
/*-
|
||||
* Copyright (c) 1988 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)ectype.c 4.2 (Berkeley) 4/26/91";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "ectype.h"
|
||||
|
||||
char ectype[] = {
|
||||
/* 0x00 */
|
||||
E_SPACE,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
/* 0x10 */
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
/* 0x20 */
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
/* 0x30 */
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
/* 0x40 */
|
||||
E_SPACE,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
E_PRINT|E_PUNCT,
|
||||
E_PRINT|E_PUNCT,
|
||||
E_PRINT|E_PUNCT,
|
||||
E_PRINT|E_PUNCT,
|
||||
E_PRINT|E_PUNCT,
|
||||
E_PRINT|E_PUNCT,
|
||||
/* 0x50 */
|
||||
E_PRINT|E_PUNCT,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
E_PRINT|E_PUNCT,
|
||||
E_PRINT|E_PUNCT,
|
||||
E_PRINT|E_PUNCT,
|
||||
E_PRINT|E_PUNCT,
|
||||
E_PRINT|E_PUNCT,
|
||||
E_PRINT|E_PUNCT,
|
||||
/* 0x60 */
|
||||
E_PRINT|E_PUNCT,
|
||||
E_PRINT|E_PUNCT,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
E_PRINT|E_PUNCT,
|
||||
E_PRINT|E_PUNCT,
|
||||
E_PRINT|E_PUNCT,
|
||||
E_PRINT|E_PUNCT,
|
||||
E_PRINT|E_PUNCT,
|
||||
E_PRINT|E_PUNCT,
|
||||
/* 0x70 */
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
E_PRINT|E_PUNCT,
|
||||
E_PRINT|E_PUNCT,
|
||||
E_PRINT|E_PUNCT,
|
||||
E_PRINT|E_PUNCT,
|
||||
E_PRINT|E_PUNCT,
|
||||
E_PRINT|E_PUNCT,
|
||||
E_PRINT|E_PUNCT,
|
||||
/* 0x80 */
|
||||
0x00,
|
||||
E_PRINT|E_LOWER,
|
||||
E_PRINT|E_LOWER,
|
||||
E_PRINT|E_LOWER,
|
||||
E_PRINT|E_LOWER,
|
||||
E_PRINT|E_LOWER,
|
||||
E_PRINT|E_LOWER,
|
||||
E_PRINT|E_LOWER,
|
||||
E_PRINT|E_LOWER,
|
||||
E_PRINT|E_LOWER,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
/* 0x90 */
|
||||
0x00,
|
||||
E_PRINT|E_LOWER,
|
||||
E_PRINT|E_LOWER,
|
||||
E_PRINT|E_LOWER,
|
||||
E_PRINT|E_LOWER,
|
||||
E_PRINT|E_LOWER,
|
||||
E_PRINT|E_LOWER,
|
||||
E_PRINT|E_LOWER,
|
||||
E_PRINT|E_LOWER,
|
||||
E_PRINT|E_LOWER,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
/* 0xA0 */
|
||||
0x00,
|
||||
E_PRINT|E_PUNCT,
|
||||
E_PRINT|E_LOWER,
|
||||
E_PRINT|E_LOWER,
|
||||
E_PRINT|E_LOWER,
|
||||
E_PRINT|E_LOWER,
|
||||
E_PRINT|E_LOWER,
|
||||
E_PRINT|E_LOWER,
|
||||
E_PRINT|E_LOWER,
|
||||
E_PRINT|E_LOWER,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
/* 0xB0 */
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
/* 0xC0 */
|
||||
E_PRINT|E_PUNCT,
|
||||
E_PRINT|E_UPPER,
|
||||
E_PRINT|E_UPPER,
|
||||
E_PRINT|E_UPPER,
|
||||
E_PRINT|E_UPPER,
|
||||
E_PRINT|E_UPPER,
|
||||
E_PRINT|E_UPPER,
|
||||
E_PRINT|E_UPPER,
|
||||
E_PRINT|E_UPPER,
|
||||
E_PRINT|E_UPPER,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
/* 0xD0 */
|
||||
E_PRINT|E_PUNCT,
|
||||
E_PRINT|E_UPPER,
|
||||
E_PRINT|E_UPPER,
|
||||
E_PRINT|E_UPPER,
|
||||
E_PRINT|E_UPPER,
|
||||
E_PRINT|E_UPPER,
|
||||
E_PRINT|E_UPPER,
|
||||
E_PRINT|E_UPPER,
|
||||
E_PRINT|E_UPPER,
|
||||
E_PRINT|E_UPPER,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
/* 0xE0 */
|
||||
E_PRINT|E_PUNCT,
|
||||
0x00,
|
||||
E_PRINT|E_UPPER,
|
||||
E_PRINT|E_UPPER,
|
||||
E_PRINT|E_UPPER,
|
||||
E_PRINT|E_UPPER,
|
||||
E_PRINT|E_UPPER,
|
||||
E_PRINT|E_UPPER,
|
||||
E_PRINT|E_UPPER,
|
||||
E_PRINT|E_UPPER,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
/* 0xF0 */
|
||||
E_PRINT|E_DIGIT,
|
||||
E_PRINT|E_DIGIT,
|
||||
E_PRINT|E_DIGIT,
|
||||
E_PRINT|E_DIGIT,
|
||||
E_PRINT|E_DIGIT,
|
||||
E_PRINT|E_DIGIT,
|
||||
E_PRINT|E_DIGIT,
|
||||
E_PRINT|E_DIGIT,
|
||||
E_PRINT|E_DIGIT,
|
||||
E_PRINT|E_DIGIT,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00
|
||||
};
|
|
@ -0,0 +1,52 @@
|
|||
/*-
|
||||
* Copyright (c) 1988 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ectype.h 4.2 (Berkeley) 4/26/91
|
||||
*/
|
||||
|
||||
#define INCLUDED_ECTYPE
|
||||
|
||||
#define E_UPPER 0x01
|
||||
#define E_LOWER 0x02
|
||||
#define E_DIGIT 0x04
|
||||
#define E_SPACE 0x08
|
||||
#define E_PUNCT 0x10
|
||||
#define E_PRINT 0x20
|
||||
|
||||
#define Eisalpha(c) (ectype[(c)&0xff]&(E_UPPER|E_LOWER))
|
||||
#define Eisupper(c) (ectype[(c)&0xff]&E_UPPER)
|
||||
#define Eislower(c) (ectype[(c)&0xff]&E_LOWER)
|
||||
#define Eisdigit(c) (ectype[(c)&0xff]&E_DIGIT)
|
||||
#define Eisalnum(c) (ectype[(c)&0xff]&(E_UPPER|E_LOWER|E_DIGIT))
|
||||
#define Eisspace(c) (ectype[(c)&0xff]&E_SPACE) /* blank or null */
|
||||
#define Eispunct(c) (ectype[(c)&0xff]&E_PUNCT)
|
||||
#define Eisprint(c) (ectype[(c)&0xff]&E_PRINT)
|
|
@ -0,0 +1,99 @@
|
|||
/*-
|
||||
* Copyright (c) 1988 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
char copyright[] =
|
||||
"@(#) Copyright (c) 1988 The Regents of the University of California.\n\
|
||||
All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)mkdctype.c 4.2 (Berkeley) 4/26/91";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "../api/ebc_disp.h"
|
||||
#include "ectype.h"
|
||||
|
||||
|
||||
extern unsigned char ectype[256];
|
||||
|
||||
|
||||
void
|
||||
main()
|
||||
{
|
||||
static unsigned char dctype[192] = { 0 };
|
||||
int i;
|
||||
char *orbar;
|
||||
int type;
|
||||
|
||||
for (i = 0; i < sizeof ectype; i++) {
|
||||
dctype[ebc_disp[i]] = ectype[i];
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof dctype; i++) {
|
||||
if ((i%16) == 0) {
|
||||
printf("/*%02x*/\n", i);
|
||||
}
|
||||
printf("\t");
|
||||
type = dctype[i];
|
||||
orbar = "";
|
||||
if (type & E_UPPER) {
|
||||
printf("E_UPPER");
|
||||
orbar = "|";
|
||||
}
|
||||
if (type & E_LOWER) {
|
||||
printf("%sD_LOWER", orbar);
|
||||
orbar = "|";
|
||||
}
|
||||
if (type & E_DIGIT) {
|
||||
printf("%sD_DIGIT", orbar);
|
||||
orbar = "|";
|
||||
}
|
||||
if (type & E_SPACE) {
|
||||
printf("%sD_SPACE", orbar);
|
||||
orbar = "|";
|
||||
}
|
||||
if (type & E_PUNCT) {
|
||||
printf("%sD_PUNCT", orbar);
|
||||
orbar = "|";
|
||||
}
|
||||
if (type & E_PRINT) {
|
||||
printf("%sD_PRINT", orbar);
|
||||
orbar = "|";
|
||||
}
|
||||
if (orbar[0] == 0) {
|
||||
printf("0");
|
||||
}
|
||||
printf(",\n");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
CFLAGS += -I${.CURDIR}/.. -I.
|
||||
|
||||
SRCS = mkdstoas.c asc_ebc.c ebc_disp.c
|
||||
PROG = mkdstoas
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
.PATH: ${.CURDIR}/../../api
|
|
@ -0,0 +1,78 @@
|
|||
/*-
|
||||
* Copyright (c) 1988 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
char copyright[] =
|
||||
"@(#) Copyright (c) 1988 The Regents of the University of California.\n\
|
||||
All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)mkdstoas.c 4.2 (Berkeley) 4/26/91";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <stdio.h>
|
||||
#if defined(unix)
|
||||
#include <strings.h>
|
||||
#else /* defined(unix) */
|
||||
#include <string.h>
|
||||
#endif /* defined(unix) */
|
||||
#include <ctype.h>
|
||||
#include "../api/asc_ebc.h"
|
||||
#include "../api/ebc_disp.h"
|
||||
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
int i;
|
||||
|
||||
/* For each display code, find the ascii code that matches */
|
||||
|
||||
printf("unsigned char disp_asc[256] = {");
|
||||
for (i = 0; i < sizeof disp_ebc; i++) {
|
||||
if ((i%8) == 0) {
|
||||
printf("\n");
|
||||
}
|
||||
printf("\t0x%02x,", ebc_asc[disp_ebc[i]]);
|
||||
}
|
||||
for (i = sizeof disp_ebc; i < 256; i++) {
|
||||
if ((i%8) == 0) {
|
||||
printf("\n");
|
||||
}
|
||||
printf("\t0x%02x,", ' ');
|
||||
}
|
||||
printf("\n};\n");
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
CFLAGS += -I${.CURDIR}/.. -I.
|
||||
|
||||
SRCS = mkhits.c dohits.c asc_ebc.c ebc_disp.c
|
||||
PROG = mkhits
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
.PATH: ${.CURDIR}/../../api
|
|
@ -0,0 +1,295 @@
|
|||
/*-
|
||||
* Copyright (c) 1988 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)dohits.c 4.2 (Berkeley) 4/26/91";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
* This program scans a file which describes a keyboard. The output
|
||||
* of the program is a series of 'C' declarations which describe a
|
||||
* mapping between (scancode, shiftstate, altstate) and 3270 functions,
|
||||
* characters, and AIDs.
|
||||
*
|
||||
* The format of the input file is as follows:
|
||||
*
|
||||
* keynumber [ scancode [ unshifted [ shifted [ alted [ shiftalted ] ] ] ] ]
|
||||
*
|
||||
* keynumber is in decimal, and starts in column 1.
|
||||
* scancode is hexadecimal.
|
||||
* unshifted, etc. - these are either a single ascii character,
|
||||
* or the name of a function or an AID-generating key.
|
||||
*
|
||||
* all fields are separated by a single space.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#if defined(unix)
|
||||
#include <strings.h>
|
||||
#else /* defined(unix) */
|
||||
#include <string.h>
|
||||
#endif /* defined(unix) */
|
||||
#include <ctype.h>
|
||||
#include "../general/general.h"
|
||||
#include "../api/asc_ebc.h"
|
||||
#include "../api/ebc_disp.h"
|
||||
#include "../ctlr/function.h"
|
||||
|
||||
#include "dohits.h"
|
||||
|
||||
struct Hits Hits[256]; /* one for each of 0x00-0xff */
|
||||
|
||||
struct thing *table[100];
|
||||
|
||||
extern char *malloc();
|
||||
|
||||
unsigned int
|
||||
dohash(seed, string)
|
||||
unsigned int seed;
|
||||
char *string;
|
||||
{
|
||||
register unsigned int i = seed;
|
||||
register unsigned char c;
|
||||
|
||||
while (c = *string++) {
|
||||
if (c >= 0x60) {
|
||||
c -= (0x60+0x20);
|
||||
} else {
|
||||
c -= 0x20;
|
||||
}
|
||||
i = (i>>26) + (i<<6) + (c&0x3f);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
void
|
||||
add(first, second, value)
|
||||
char *first, *second;
|
||||
int value;
|
||||
{
|
||||
struct thing **item, *this;
|
||||
|
||||
item = &firstentry(second);
|
||||
this = (struct thing *) malloc(sizeof *this);
|
||||
this->next = *item;
|
||||
*item = this;
|
||||
this->value = value;
|
||||
strcpy(this->name, first);
|
||||
strcpy(this->name+strlen(this->name), second);
|
||||
}
|
||||
|
||||
void
|
||||
scanwhite(file, prefix)
|
||||
char *file, /* Name of file to scan for whitespace prefix */
|
||||
*prefix; /* prefix of what should be picked up */
|
||||
{
|
||||
FILE *ourfile;
|
||||
char compare[100];
|
||||
char what[100], value[100];
|
||||
char line[200];
|
||||
|
||||
sprintf(compare, " %s%%[^,\t \n]", prefix);
|
||||
if ((ourfile = fopen(file, "r")) == NULL) {
|
||||
perror("fopen");
|
||||
exit(1);
|
||||
}
|
||||
while (!feof(ourfile)) {
|
||||
if (fscanf(ourfile, compare, what) == 1) {
|
||||
add(prefix, what, 0);
|
||||
}
|
||||
do {
|
||||
if (fgets(line, sizeof line, ourfile) == NULL) {
|
||||
if (!feof(ourfile)) {
|
||||
perror("fgets");
|
||||
}
|
||||
break;
|
||||
}
|
||||
} while (line[strlen(line)-1] != '\n');
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
scandefine(file, prefix)
|
||||
char *file, /* Name of file to scan for #define prefix */
|
||||
*prefix; /* prefix of what should be picked up */
|
||||
{
|
||||
FILE *ourfile;
|
||||
char compare[100];
|
||||
char what[100], value[100];
|
||||
char line[200];
|
||||
int whatitis;
|
||||
|
||||
sprintf(compare, "#define %s%%s %%s", prefix);
|
||||
if ((ourfile = fopen(file, "r")) == NULL) {
|
||||
perror("fopen");
|
||||
exit(1);
|
||||
}
|
||||
while (!feof(ourfile)) {
|
||||
if (fscanf(ourfile, compare, what, value) == 2) {
|
||||
if (value[0] == '0') {
|
||||
if ((value[1] == 'x') || (value[1] == 'X')) {
|
||||
sscanf(value, "0x%x", &whatitis);
|
||||
} else {
|
||||
sscanf(value, "0%o", &whatitis);
|
||||
}
|
||||
} else {
|
||||
sscanf(value, "%d", &whatitis);
|
||||
}
|
||||
add(prefix, what, whatitis);
|
||||
}
|
||||
do {
|
||||
if (fgets(line, sizeof line, ourfile) == NULL) {
|
||||
if (!feof(ourfile)) {
|
||||
perror("fgets");
|
||||
}
|
||||
break;
|
||||
}
|
||||
} while (line[strlen(line)-1] != '\n');
|
||||
}
|
||||
}
|
||||
|
||||
char *savechr(c)
|
||||
unsigned char c;
|
||||
{
|
||||
char *foo;
|
||||
|
||||
foo = malloc(sizeof c);
|
||||
if (foo == 0) {
|
||||
fprintf(stderr, "No room for ascii characters!\n");
|
||||
exit(1);
|
||||
}
|
||||
*foo = c;
|
||||
return foo;
|
||||
}
|
||||
|
||||
char *
|
||||
doit(hit, type, hits)
|
||||
struct hit *hit;
|
||||
unsigned char *type;
|
||||
struct Hits *hits;
|
||||
{
|
||||
struct thing *this;
|
||||
|
||||
hit->ctlrfcn = FCN_NULL;
|
||||
if (type[0] == 0) {
|
||||
return 0;
|
||||
}
|
||||
if (type[1] == 0) { /* character */
|
||||
hit->ctlrfcn = FCN_CHARACTER;
|
||||
hit->code = ebc_disp[asc_ebc[type[0]]];
|
||||
return savechr(*type); /* The character is the name */
|
||||
} else {
|
||||
for (this = firstentry(type); this; this = this->next) {
|
||||
if ((type[0] == this->name[4])
|
||||
&& (strcmp(type, this->name+4) == 0)) {
|
||||
this->hits = hits;
|
||||
if (this->name[0] == 'F') {
|
||||
hit->ctlrfcn = FCN_NULL; /* XXX */
|
||||
} else {
|
||||
hit->ctlrfcn = FCN_AID;
|
||||
}
|
||||
return this->name;
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "Error: Unknown type %s.\n", type);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dohits(aidfile, fcnfile)
|
||||
char *aidfile, *fcnfile;
|
||||
{
|
||||
unsigned char plain[100], shifted[100], alted[100], shiftalted[100];
|
||||
unsigned char line[200];
|
||||
int keynumber, scancode;
|
||||
int empty;
|
||||
int i;
|
||||
struct hit *hit;
|
||||
struct hits *ph;
|
||||
struct Hits *Ph;
|
||||
|
||||
memset((char *)Hits, 0, sizeof Hits);
|
||||
|
||||
/*
|
||||
* First, we read "host3270.h" to find the names/values of
|
||||
* various AID; then we read kbd3270.h to find the names/values
|
||||
* of various FCNs.
|
||||
*/
|
||||
|
||||
if (aidfile == 0) {
|
||||
aidfile = "../ctlr/hostctlr.h";
|
||||
}
|
||||
scandefine(aidfile, "AID_");
|
||||
if (fcnfile == 0) {
|
||||
fcnfile = "../ctlr/function.h";
|
||||
}
|
||||
scanwhite(fcnfile, "FCN_");
|
||||
|
||||
while (gets(line) != NULL) {
|
||||
if (!isdigit(line[0])) {
|
||||
continue;
|
||||
}
|
||||
plain[0] = shifted[0] = alted[0] = shiftalted[0] = 0;
|
||||
keynumber = -1;
|
||||
scancode = -1;
|
||||
(void) sscanf(line, "%d %x %s %s %s %s", &keynumber,
|
||||
&scancode, plain, shifted, alted, shiftalted);
|
||||
if ((keynumber == -1) || (scancode == -1)
|
||||
|| ((plain[0] == 0)
|
||||
&& (shifted[0] == 0)
|
||||
&& (alted[0] == 0)
|
||||
&& (shiftalted[0] == 0))) {
|
||||
continue;
|
||||
}
|
||||
if (scancode >= 256) {
|
||||
fprintf(stderr,
|
||||
"Error: scancode 0x%02x for keynumber %d\n", scancode,
|
||||
keynumber);
|
||||
break;
|
||||
}
|
||||
if (Hits[scancode].hits.hit[0].ctlrfcn != undefined) {
|
||||
fprintf(stderr,
|
||||
"Error: duplicate scancode 0x%02x for keynumber %d\n",
|
||||
scancode, keynumber);
|
||||
break;
|
||||
}
|
||||
hit = Hits[scancode].hits.hit;
|
||||
Hits[scancode].hits.keynumber = keynumber;
|
||||
Hits[scancode].name[0] = doit(hit, plain, &Hits[scancode]);
|
||||
Hits[scancode].name[1] = doit(hit+1, shifted, &Hits[scancode]);
|
||||
Hits[scancode].name[2] = doit(hit+2, alted, &Hits[scancode]);
|
||||
Hits[scancode].name[3] = doit(hit+3, shiftalted, &Hits[scancode]);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
/*-
|
||||
* Copyright (c) 1988 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)dohits.h 4.2 (Berkeley) 4/26/91
|
||||
*/
|
||||
|
||||
#define numberof(x) (sizeof x/sizeof x[0])
|
||||
#define highestof(x) (numberof(x)-1)
|
||||
|
||||
#define firstentry(x) (table[dohash(0, (x))%highestof(table)])
|
||||
|
||||
struct Hits {
|
||||
struct hits hits;
|
||||
char *name[4];
|
||||
};
|
||||
|
||||
struct thing {
|
||||
struct thing *next;
|
||||
struct Hits *hits;
|
||||
unsigned char value;
|
||||
char name[100];
|
||||
};
|
||||
|
||||
extern struct Hits Hits[256]; /* one for each of 0x00-0xff */
|
||||
extern struct thing *table[100];
|
||||
|
||||
extern unsigned int dohash();
|
|
@ -0,0 +1,147 @@
|
|||
/*-
|
||||
* Copyright (c) 1988 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
char copyright[] =
|
||||
"@(#) Copyright (c) 1988 The Regents of the University of California.\n\
|
||||
All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)mkhits.c 4.2 (Berkeley) 4/26/91";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
* This program scans a file which describes a keyboard. The output
|
||||
* of the program is a series of 'C' declarations which describe a
|
||||
* mapping between (scancode, shiftstate, altstate) and 3270 functions,
|
||||
* characters, and AIDs.
|
||||
*
|
||||
* The format of the input file is as follows:
|
||||
*
|
||||
* keynumber [ scancode [ unshifted [ shifted [ alted [ shiftalted ] ] ] ] ]
|
||||
*
|
||||
* keynumber is in decimal, and starts in column 1.
|
||||
* scancode is hexadecimal.
|
||||
* unshifted, etc. - these are either a single ascii character,
|
||||
* or the name of a function or an AID-generating key.
|
||||
*
|
||||
* all fields are separated by a single space.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#if defined(unix)
|
||||
#include <strings.h>
|
||||
#else /* defined(unix) */
|
||||
#include <string.h>
|
||||
#endif /* defined(unix) */
|
||||
#include <ctype.h>
|
||||
#include "../ctlr/function.h"
|
||||
|
||||
#include "dohits.h"
|
||||
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
int scancode;
|
||||
int empty;
|
||||
int i;
|
||||
struct hits *ph;
|
||||
struct Hits *Ph;
|
||||
char *aidfile = 0, *fcnfile = 0;
|
||||
|
||||
if (argc > 1) {
|
||||
if (argv[1][0] != '-') {
|
||||
aidfile = argv[1];
|
||||
}
|
||||
}
|
||||
if (argc > 2) {
|
||||
if (argv[2][0] != '-') {
|
||||
fcnfile = argv[2];
|
||||
}
|
||||
}
|
||||
|
||||
dohits(aidfile, fcnfile); /* Set up "Hits" */
|
||||
|
||||
printf("struct hits hits[] = {\n");
|
||||
empty = 0;
|
||||
scancode = -1;
|
||||
for (Ph = Hits; Ph < Hits+(sizeof Hits/sizeof Hits[0]); Ph++) {
|
||||
ph = &Ph->hits;
|
||||
scancode++;
|
||||
if ((ph->hit[0].ctlrfcn == undefined)
|
||||
&& (ph->hit[1].ctlrfcn == undefined)
|
||||
&& (ph->hit[2].ctlrfcn == undefined)
|
||||
&& (ph->hit[3].ctlrfcn == undefined)) {
|
||||
empty++;
|
||||
continue;
|
||||
} else {
|
||||
while (empty) {
|
||||
printf("\t{ 0, { {undefined}, {undefined}");
|
||||
printf(", {undefined}, {undefined} } },\n");
|
||||
empty--;
|
||||
}
|
||||
}
|
||||
printf("\t{ %d, {\t/* 0x%02x */\n\t", ph->keynumber, scancode);
|
||||
for (i = 0; i < 4; i++) {
|
||||
printf("\t{ ");
|
||||
switch (ph->hit[i].ctlrfcn) {
|
||||
case undefined:
|
||||
printf("undefined");
|
||||
break;
|
||||
case FCN_CHARACTER:
|
||||
printf("FCN_CHARACTER, 0x%02x", ph->hit[i].code);
|
||||
break;
|
||||
case FCN_AID:
|
||||
printf("FCN_AID, %s", Ph->name[i]);
|
||||
break;
|
||||
case FCN_NULL:
|
||||
default:
|
||||
if ((Ph->name[i] != 0)
|
||||
&& (strcmp(Ph->name[i], "FCN_NULL") != 0)) {
|
||||
printf("%s", Ph->name[i]);
|
||||
} else {
|
||||
printf("undefined");
|
||||
}
|
||||
break;
|
||||
}
|
||||
printf(" },\n\t");
|
||||
}
|
||||
printf("} },\n");
|
||||
}
|
||||
printf("};\n");
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue