xref: /titanic_50/usr/src/lib/libxcurses/src/libc/xcurses/mkkey.awk (revision 2654012f83cec5dc15b61dfe3e4a4915f186e7a6)
1#
2# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
3# Use is subject to license terms.
4#
5# CDDL HEADER START
6#
7# The contents of this file are subject to the terms of the
8# Common Development and Distribution License, Version 1.0 only
9# (the "License").  You may not use this file except in compliance
10# with the License.
11#
12# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
13# or http://www.opensolaris.org/os/licensing.
14# See the License for the specific language governing permissions
15# and limitations under the License.
16#
17# When distributing Covered Code, include this CDDL HEADER in each
18# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
19# If applicable, add the following below this CDDL HEADER, with the
20# fields enclosed by brackets "[]" replaced with your own identifying
21# information: Portions Copyright [yyyy] [name of copyright owner]
22#
23# CDDL HEADER END
24#
25# ident	"%Z%%M%	%I%	%E% SMI"
26#
27# mkkey.awk
28#
29# XCurses Library
30#
31# Copyright 1990, 1995 by Mortice Kern Systems Inc.  All rights reserved.
32#
33# USAGE:
34# 	awk -f mkkey.awk caps >keyindex.c
35#
36#  rcsid = $Header: /rd/src/libc/xcurses/rcs/mkkey.awk 1.1 1995/05/11 14:39:17 ant Exp $
37#
38
39BEGIN {
40print "/*"
41print " * keyindex.c"
42print " *"
43print " * XCurses Library"
44print " *"
45print " * **** THIS FILE IS MACHINE GENERATED."
46print " * **** DO NOT EDIT THIS FILE."
47print " *"
48print " * Copyright 1990, 1995 by Mortice Kern Systems Inc.  All rights reserved."
49print " *"
50print " */"
51print
52print "#if M_RCSID"
53print "#ifndef lint"
54printf "static char rcsID[] = \"$Header%s\";\n", "$"
55print "#endif"
56print "#endif"
57print
58print "#include <private.h>"
59print
60print "/*"
61print " * This table is used to map a KEY_ constant to an"
62print " * index for cur_term->_str[] for use by keyname()."
63print " */"
64print "short __m_keyindex[][2]= {"
65	strcount = 0;
66}
67
68$4 == "str" {
69	if ($1 ~ /^key_f[0-9][0-9]*/)
70		printf("\t{ %d, KEY_F(%d) },\n", strcount, substr($1, 6, 2));
71	else if ($1 ~ /^key_/)
72		printf "\t{ %d, %s },\n", strcount, toupper($1);
73	++strcount;
74}
75
76END {
77	print "\t{ -1, -1 }"
78	print "};"
79}
80