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