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# mknames.awk	
28#
29# XCurses Library
30#
31# Copyright 1990, 1995 by Mortice Kern Systems Inc.  All rights reserved.
32#
33#  rcsid = $Header: /rd/src/libc/xcurses/rcs/mknames.awk 1.1 1995/05/11 15:12:57 ant Exp $
34#
35
36function header(file, array) {
37print "/*" > file
38printf " * %s\n", file > file
39print " *" > file
40print " * XCurses Library" > file
41print " *" > file
42print " * **** THIS FILE IS MACHINE GENERATED." > file
43print " * **** DO NOT EDIT THIS FILE." > file
44print " *" > file
45print " * Copyright 1990, 1995 by Mortice Kern Systems Inc.  All rights reserved." > file
46print " *" > file
47print " */" > file
48print > file
49print "#if M_RCSID" > file
50print "#ifndef lint" > file
51printf "static char rcsID[] = \"$Header%s\"\n", "$" > file
52print "#endif" > file
53print "#endif" > file
54print > file
55printf "char *__m_%s[] = {\n", array > file
56}
57
58function tail(file) {
59	printf("\t0\n};\n\n") >file;
60	close(file);
61}
62
63BEGIN {
64	header("boolname.c", "boolnames");
65	header("boolcode.c", "boolcodes");
66	header("boolfnam.c", "boolfnames");
67	header("numname.c", "numnames");
68	header("numcode.c", "numcodes");
69	header("numfnam.c", "numfnames");
70	header("strname.c", "strnames");
71	header("strcode.c", "strcodes");
72	header("strfnam.c", "strfnames");
73}
74
75$4 == "bool" {
76	printf "\t\"%s\",\n", $1 > "boolfnam.c"
77	printf "\t\"%s\",\n", $2 > "boolname.c"
78	printf "\t\"%s\",\n", $3 > "boolcode.c"
79}
80
81$4 == "number" {
82	printf "\t\"%s\",\n", $1 > "numfnam.c"
83	printf "\t\"%s\",\n", $2 > "numname.c"
84	printf "\t\"%s\",\n", $3 > "numcode.c"
85}
86
87$4 == "str" {
88	printf "\t\"%s\",\n", $1 > "strfnam.c"
89	printf "\t\"%s\",\n", $2 > "strname.c"
90	printf "\t\"%s\",\n", $3 > "strcode.c"
91}
92
93END {
94	tail("boolname.c");
95	tail("boolcode.c");
96	tail("boolfnam.c");
97	tail("numname.c");
98	tail("numcode.c");
99	tail("numfnam.c");
100	tail("strname.c");
101	tail("strcode.c");
102	tail("strfnam.c");
103}
104