2 # $NetBSD: emacs-gen.sh,v 1.4 2008/10/25 22:18:15 apb Exp $
10 echo "$0: Usage: $0 path-to-emacs.c" 1>&2
14 if [ ! -r "$file" ] ;then
15 echo "$0: can't read $file" 1>&2
19 cat << E_O_F || exit 1
21 * NOTE: THIS FILE WAS GENERATED AUTOMATICALLY FROM $file
23 * DO NOT BOTHER EDITING THIS FILE
27 # Pass 1: print out lines before @START-FUNC-TAB@
28 # and generate defines and function declarations,
29 ${SED} -e '1,/@START-FUNC-TAB@/d' -e '/@END-FUNC-TAB@/,$d' < $file |
30 ${AWK} 'BEGIN { nfunc = 0; }
37 c = substr(fname, length(fname), 1);
39 fname = substr(fname, 1, length(fname) - 1);
41 printf "#define XFUNC_%s %d\n", substr(fname, 3, length(fname) - 2), nfunc;
42 printf "static int %s ARGS((int c));\n", fname;