xref: /freebsd/contrib/ncurses/include/MKparametrized.sh (revision daf1cffce2e07931f27c6c6998652e90df6ba87e)
1#!/bin/sh
2#
3# MKparametrized.sh -- generate indirection vectors for various sort methods
4#
5# The output of this script is C source for an array specifying whether
6# termcap strings should undergo parameter and padding translation.
7#
8CAPS="${1-Caps}"
9cat <<EOF
10/*
11 * parametrized.h --- is a termcap capability parametrized?
12 *
13 * Note: this file is generated using parametrized.sh, do not edit by hand.
14 * A value of -1 in the table means suppress both pad and % translations.
15 * A value of 0 in the table means do pad but not % translations.
16 * A value of 1 in the table means do both pad and % translations.
17 */
18
19static short const parametrized[] = {
20EOF
21
22# We detect whether % translations should be done by looking for #[0-9] in the
23# description field.  We presently suppress padding translation only for the
24# XENIX acs_* capabilities.  Maybe someday we'll dedicate a flag field for
25# this, that would be cleaner....
26
27${AWK-awk} <$CAPS '
28$3 != "str"	{next;}
29$1 ~ /^acs_/	{print "-1,\t/* ", $2, " */"; count++; next;}
30$0 ~ /#[0-9]/	{print "1,\t/* ", $2, " */"; count++; next;}
31		{print "0,\t/* ", $2, " */"; count++;}
32END		{printf("} /* %d entries */;\n\n", count);}
33'
34
35