]> ncurses.scripts.mit.edu Git - ncurses.git/blob - include/MKparametrized.sh
ncurses 4.1
[ncurses.git] / include / MKparametrized.sh
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 #
8 CAPS="${1-Caps}"
9 cat <<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
19 static short const parametrized[] = {
20 EOF
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 <$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++;}
32 END             {printf("} /* %d entries */;\n\n", count);}
33 '
34