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