2 # $Id: MKtermsort.sh,v 1.6 2000/01/25 11:35:36 tom Exp $
4 # MKtermsort.sh -- generate indirection vectors for the various sort methods
6 # The output of this script is C source for nine arrays that list three sort
7 # orders for each of the three different classes of terminfo capabilities.
9 # keep the order independent of locale:
16 DATA=${2-../include/Caps}
19 echo " * termsort.c --- sort order arrays for use by infocmp.";
21 echo " * Note: this file is generated using MKtermsort.sh, do not edit by hand.";
24 echo "static const int bool_terminfo_sort[] = {";
28 $3 == "bool" {printf("%s\t%d\n", $2, i++);}
29 ' | sort | $AWK '{print "\t", $2, ",\t/* ", $1, " */";}';
33 echo "static const int num_terminfo_sort[] = {";
37 $3 == "num" {printf("%s\t%d\n", $2, i++);}
38 ' | sort | $AWK '{print "\t", $2, ",\t/* ", $1, " */";}';
42 echo "static const int str_terminfo_sort[] = {";
46 $3 == "str" {printf("%s\t%d\n", $2, i++);}
47 ' | sort | $AWK '{print "\t", $2, ",\t/* ", $1, " */";}';
51 echo "static const int bool_variable_sort[] = {";
55 $3 == "bool" {printf("%s\t%d\n", $1, i++);}
56 ' | sort | $AWK '{print "\t", $2, ",\t/* ", $1, " */";}';
60 echo "static const int num_variable_sort[] = {";
64 $3 == "num" {printf("%s\t%d\n", $1, i++);}
65 ' | sort | $AWK '{print "\t", $2, ",\t/* ", $1, " */";}';
69 echo "static const int str_variable_sort[] = {";
73 $3 == "str" {printf("%s\t%d\n", $1, i++);}
74 ' | sort | $AWK '{print "\t", $2, ",\t/* ", $1, " */";}';
78 echo "static const int bool_termcap_sort[] = {";
82 $3 == "bool" {printf("%s\t%d\n", $4, i++);}
83 ' | sort | $AWK '{print "\t", $2, ",\t/* ", $1, " */";}';
87 echo "static const int num_termcap_sort[] = {";
91 $3 == "num" {printf("%s\t%d\n", $4, i++);}
92 ' | sort | $AWK '{print "\t", $2, ",\t/* ", $1, " */";}';
96 echo "static const int str_termcap_sort[] = {";
100 $3 == "str" {printf("%s\t%d\n", $4, i++);}
101 ' | sort | $AWK '{print "\t", $2, ",\t/* ", $1, " */";}';
105 echo "static const bool bool_from_termcap[] = {";
107 $3 == "bool" && substr($5, 1, 1) == "-" {print "\tFALSE,\t/* ", $2, " */";}
108 $3 == "bool" && substr($5, 1, 1) == "Y" {print "\tTRUE,\t/* ", $2, " */";}
113 echo "static const bool num_from_termcap[] = {";
115 $3 == "num" && substr($5, 1, 1) == "-" {print "\tFALSE,\t/* ", $2, " */";}
116 $3 == "num" && substr($5, 1, 1) == "Y" {print "\tTRUE,\t/* ", $2, " */";}
121 echo "static const bool str_from_termcap[] = {";
123 $3 == "str" && substr($5, 1, 1) == "-" {print "\tFALSE,\t/* ", $2, " */";}
124 $3 == "str" && substr($5, 1, 1) == "Y" {print "\tTRUE,\t/* ", $2, " */";}