xref: /freebsd/contrib/ncurses/include/MKparametrized.sh (revision 4a1a95108dd76c4259fe6c37c4471f7969b17983)
10e3d5408SPeter Wemm#!/bin/sh
24a1a9510SRong-En Fan##############################################################################
34a1a9510SRong-En Fan# Copyright (c) 1998-2000,2006 Free Software Foundation, Inc.                #
44a1a9510SRong-En Fan#                                                                            #
54a1a9510SRong-En Fan# Permission is hereby granted, free of charge, to any person obtaining a    #
64a1a9510SRong-En Fan# copy of this software and associated documentation files (the "Software"), #
74a1a9510SRong-En Fan# to deal in the Software without restriction, including without limitation  #
84a1a9510SRong-En Fan# the rights to use, copy, modify, merge, publish, distribute, distribute    #
94a1a9510SRong-En Fan# with modifications, sublicense, and/or sell copies of the Software, and to #
104a1a9510SRong-En Fan# permit persons to whom the Software is furnished to do so, subject to the  #
114a1a9510SRong-En Fan# following conditions:                                                      #
124a1a9510SRong-En Fan#                                                                            #
134a1a9510SRong-En Fan# The above copyright notice and this permission notice shall be included in #
144a1a9510SRong-En Fan# all copies or substantial portions of the Software.                        #
154a1a9510SRong-En Fan#                                                                            #
164a1a9510SRong-En Fan# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
174a1a9510SRong-En Fan# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   #
184a1a9510SRong-En Fan# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    #
194a1a9510SRong-En Fan# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      #
204a1a9510SRong-En Fan# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING    #
214a1a9510SRong-En Fan# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER        #
224a1a9510SRong-En Fan# DEALINGS IN THE SOFTWARE.                                                  #
234a1a9510SRong-En Fan#                                                                            #
244a1a9510SRong-En Fan# Except as contained in this notice, the name(s) of the above copyright     #
254a1a9510SRong-En Fan# holders shall not be used in advertising or otherwise to promote the sale, #
264a1a9510SRong-En Fan# use or other dealings in this Software without prior written               #
274a1a9510SRong-En Fan# authorization.                                                             #
284a1a9510SRong-En Fan##############################################################################
294a1a9510SRong-En Fan# $Id: MKparametrized.sh,v 1.6 2006/04/22 21:36:16 tom Exp $
300e3d5408SPeter Wemm#
310e3d5408SPeter Wemm# MKparametrized.sh -- generate indirection vectors for various sort methods
320e3d5408SPeter Wemm#
330e3d5408SPeter Wemm# The output of this script is C source for an array specifying whether
340e3d5408SPeter Wemm# termcap strings should undergo parameter and padding translation.
350e3d5408SPeter Wemm#
360e3d5408SPeter WemmCAPS="${1-Caps}"
370e3d5408SPeter Wemmcat <<EOF
380e3d5408SPeter Wemm/*
390e3d5408SPeter Wemm * parametrized.h --- is a termcap capability parametrized?
400e3d5408SPeter Wemm *
4118259542SPeter Wemm * Note: this file is generated using MKparametrized.sh, do not edit by hand.
420e3d5408SPeter Wemm * A value of -1 in the table means suppress both pad and % translations.
430e3d5408SPeter Wemm * A value of 0 in the table means do pad but not % translations.
440e3d5408SPeter Wemm * A value of 1 in the table means do both pad and % translations.
450e3d5408SPeter Wemm */
460e3d5408SPeter Wemm
470e3d5408SPeter Wemmstatic short const parametrized[] = {
480e3d5408SPeter WemmEOF
490e3d5408SPeter Wemm
500e3d5408SPeter Wemm# We detect whether % translations should be done by looking for #[0-9] in the
510e3d5408SPeter Wemm# description field.  We presently suppress padding translation only for the
520e3d5408SPeter Wemm# XENIX acs_* capabilities.  Maybe someday we'll dedicate a flag field for
530e3d5408SPeter Wemm# this, that would be cleaner....
540e3d5408SPeter Wemm
550e3d5408SPeter Wemm${AWK-awk} <$CAPS '
560e3d5408SPeter Wemm$3 != "str"	{next;}
570e3d5408SPeter Wemm$1 ~ /^acs_/	{print "-1,\t/* ", $2, " */"; count++; next;}
580e3d5408SPeter Wemm$0 ~ /#[0-9]/	{print "1,\t/* ", $2, " */"; count++; next;}
590e3d5408SPeter Wemm		{print "0,\t/* ", $2, " */"; count++;}
600e3d5408SPeter WemmEND		{printf("} /* %d entries */;\n\n", count);}
610e3d5408SPeter Wemm'
620e3d5408SPeter Wemm
63