1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License, Version 1.0 only
6# (the "License").  You may not use this file except in compliance
7# with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22# Copyright (c) 1995-1998 by Sun Microsystems, Inc.
23# All rights reserved.
24#
25# ident	"%Z%%M%	%I%	%E% SMI"
26#
27# mknames.awk
28#
29# XCurses Library
30#
31# Copyright 1990, 1995 by Mortice Kern Systems Inc.  All rights reserved.
32#
33#  rcsid = $Header: /team/ps/sun_xcurses/archive/local_changes/xcurses/src/lib/libxcurses/src/libc/xcurses/rcs/mknames.awk 1.3 1998/05/29 15:58:51 cbates Exp $
34#
35
36function header(file, array) {
37print "/*" > file
38print " * Copyright (c) 1998 by Sun Microsystems, Inc." > file
39print " * All rights reserved." > file
40print " */" > file
41print > file
42print "#pragma ident	\"@(#)" file "\t%I%\t%E% SMI\"" > file
43print > file
44print "/*" > file
45printf " * %s\n", file > file
46print " *" > file
47print " * XCurses Library" > file
48print " *" > file
49print " * **** THIS FILE IS MACHINE GENERATED." > file
50print " * **** DO NOT EDIT THIS FILE." > file
51print " *" > file
52print " * Copyright 1990, 1995 by Mortice Kern Systems Inc.  All rights reserved." > file
53print " *" > file
54print " */" > file
55print > file
56printf "const char *%s[] = {\n", array > file
57}
58
59function tail(file) {
60	printf("\t0\n};\n") >file;
61	close(file);
62}
63
64BEGIN {
65	header("boolname.c", "boolnames");
66	header("boolcode.c", "boolcodes");
67	header("boolfnam.c", "boolfnames");
68	header("numname.c", "numnames");
69	header("numcode.c", "numcodes");
70	header("numfnam.c", "numfnames");
71	header("strname.c", "strnames");
72	header("strcode.c", "strcodes");
73	header("strfnam.c", "strfnames");
74}
75
76$4 == "bool" {
77	printf "\t\"%s\",\n", $1 > "boolfnam.c"
78	printf "\t\"%s\",\n", $2 > "boolname.c"
79	printf "\t\"%s\",\n", $3 > "boolcode.c"
80}
81
82$4 == "number" {
83	printf "\t\"%s\",\n", $1 > "numfnam.c"
84	printf "\t\"%s\",\n", $2 > "numname.c"
85	printf "\t\"%s\",\n", $3 > "numcode.c"
86}
87
88$4 == "str" {
89	if ($1 ~ /^key_/)
90	{
91		printf "\t\"%s\",\n", toupper($1) > "strfnam.c"
92	}
93	else
94	{
95		printf "\t\"%s\",\n", $1 > "strfnam.c"
96	}
97	printf "\t\"%s\",\n", $2 > "strname.c"
98	printf "\t\"%s\",\n", $3 > "strcode.c"
99}
100
101END {
102	tail("boolname.c");
103	tail("boolcode.c");
104	tail("boolfnam.c");
105	tail("numname.c");
106	tail("numcode.c");
107	tail("numfnam.c");
108	tail("strname.c");
109	tail("strcode.c");
110	tail("strfnam.c");
111}
112