3 # Copyright (c) 1992, 1993
4 # The Regents of the University of California. All rights reserved.
6 # This code is derived from software contributed to Berkeley by
7 # Christos Zoulas of Cornell University.
9 # Redistribution and use in source and binary forms, with or without
10 # modification, are permitted provided that the following conditions
12 # 1. Redistributions of source code must retain the above copyright
13 # notice, this list of conditions and the following disclaimer.
14 # 2. Redistributions in binary form must reproduce the above copyright
15 # notice, this list of conditions and the following disclaimer in the
16 # documentation and/or other materials provided with the distribution.
17 # 3. All advertising materials mentioning features or use of this software
18 # must display the following acknowledgement:
19 # This product includes software developed by the University of
20 # California, Berkeley and its contributors.
21 # 4. Neither the name of the University nor the names of its contributors
22 # may be used to endorse or promote products derived from this software
23 # without specific prior written permission.
25 # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 # @(#)makelist 5.3 (Berkeley) 6/4/93
38 # $DragonFly: src/lib/libedit/makelist,v 1.3 2003/11/12 20:21:29 eirikn Exp $
40 # makelist.sh: Automatically generate header files...
43 USAGE="Usage: $0 -h|-e|-fc|-fh|-bc|-bh <filenames>"
66 printf("/* Automatically generated file, do not edit */\n");
67 printf("#ifndef %s\n#define %s\n", "'$hdr'", "'$hdr'");
70 pr = substr($2, 1, 2);
71 if (pr == "vi" || pr == "em" || pr == "ed") {
72 name = substr($2, 1, length($2) - 3);
73 printf("protected el_action_t\t%-25.25s (EditLine *, int);\n", name);
77 printf("#endif /* %s */\n", "'$hdr'");
82 printf("/* Automatically generated file, do not edit */\n");
83 printf("#include \"sys.h\"\n#include \"el.h\"\n");
84 printf("private struct el_bindings_t el_func_help[] = {\n");
85 low = "abcdefghijklmnopqrstuvwxyz_";
86 high = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_";
87 for (i = 1; i <= length(low); i++)
88 tr[substr(low, i, 1)] = substr(high, i, 1);
91 pr = substr($2, 1, 2);
92 if (pr == "vi" || pr == "em" || pr == "ed") {
93 name = substr($2, 1, length($2) - 3);
96 for (i = 1; i <= length(name); i++) {
97 s = substr(name, i, 1);
104 printf(" { %-30.30s %-30.30s\n","\"" fname "\",", uname ",");
111 for (i = 2; i < NF; i++)
113 printf("%s\" },\n", $i);
118 printf(" { NULL, 0, NULL }\n");
120 printf("\nprotected el_bindings_t* help__get()");
121 printf("{ return el_func_help; }\n");
126 printf("/* Automatically generated file, do not edit */\n");
127 printf("#ifndef _h_help_c\n#define _h_help_c\n");
128 printf("protected el_bindings_t *help__get\t(void);\n");
129 printf("#endif /* _h_help_c */\n");
132 cat $FILES | $AWK '/el_action_t/ { print $3 }' | \
133 sort | tr '[a-z]' '[A-Z]' | $AWK '
135 printf("/* Automatically generated file, do not edit */\n");
136 printf("#ifndef _h_fcns_c\n#define _h_fcns_c\n");
140 printf("#define\t%-30.30s\t%3d\n", $1, count++);
143 printf("#define\t%-30.30s\t%3d\n", "EL_NUM_FCNS", count);
145 printf("typedef el_action_t (*el_func_t) (EditLine *, int);");
146 printf("\nprotected el_func_t* func__get (void);\n");
147 printf("#endif /* _h_fcns_c */\n");
150 cat $FILES | $AWK '/el_action_t/ { print $3 }' | sort | $AWK '
152 printf("/* Automatically generated file, do not edit */\n");
153 printf("#include \"sys.h\"\n#include \"el.h\"\n");
154 printf("private el_func_t el_func[] = {");
170 printf("%-26.26s ", s);
174 printf("\nprotected el_func_t* func__get() { return el_func; }\n");
177 echo "$FILES" | tr ' ' '\012' | $AWK '
179 printf("/* Automatically generated file, do not edit */\n");
180 printf("#define protected static\n");
181 printf("#define SCCSID\n");
184 printf("#include \"%s\"\n", $1);