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