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 # mkkey.awk
  26 #
  27 # XCurses Library
  28 #
  29 # Copyright 1990, 1995 by Mortice Kern Systems Inc.  All rights reserved.
  30 #
  31 # USAGE:
  32 #       awk -f mkkey.awk caps >keyindex.c
  33 #
  34 #  rcsid = $Header: /rd/src/libc/xcurses/rcs/mkkey.awk 1.1 1995/05/11 14:39:17 ant Exp $
  35 #       
  36 
  37 BEGIN {
  38 print "/*"
  39 print " * keyindex.c"
  40 print " *"
  41 print " * XCurses Library"
  42 print " *"
  43 print " * **** THIS FILE IS MACHINE GENERATED."
  44 print " * **** DO NOT EDIT THIS FILE."
  45 print " *"
  46 print " * Copyright 1990, 1995 by Mortice Kern Systems Inc.  All rights reserved."
  47 print " *"
  48 print " */"
  49 print ""
  50 print "#if M_RCSID"
  51 print "#ifndef lint"
  52 printf "static char rcsID[] = \"$Header%s\";\n", "$"
  53 print "#endif"
  54 print "#endif"
  55 print ""
  56 print "#include <private.h>"
  57 print ""
  58 print "/*"
  59 print " * This table is used to map a KEY_ constant to an"
  60 print " * index for cur_term->_str[] for use by keyname()."
  61 print " */"
  62 print "short __m_keyindex[][2]= {"
  63         strcount = 0;
  64 }
  65 
  66 $4 == "str" {
  67         if ($1 ~ /^key_f[0-9][0-9]*/)
  68                 printf("\t{ %d, KEY_F(%d) },\n", strcount, substr($1, 6, 2));
  69         else if ($1 ~ /^key_/)
  70                 printf "\t{ %d, %s },\n", strcount, toupper($1);
  71         ++strcount;
  72 }
  73 
  74 END {
  75         print "\t{ -1, -1 }"
  76         print "};"
  77 }