head 1.30; access; symbols SHTOOL_2_0_8:1.30 SHTOOL_2_0_7:1.29 SHTOOL_2_0_6:1.28 SHTOOL_2_0_5:1.28 SHTOOL_2_0_4:1.28 SHTOOL_2_0_3:1.27 SHTOOL_2_0_2:1.27 SHTOOL_2_0_1:1.26 SHTOOL_2_0_0:1.26 SHTOOL_2_0b3:1.26 SHTOOL_2_0b2:1.26 SHTOOL_2_0b1:1.26 SHTOOL_1_6:1.22.0.2 SHTOOL_1_6_2:1.22 SHTOOL_1_6_1:1.21 SHTOOL_1_6_0:1.21 SHTOOL_1_5:1.18.0.2 SHTOOL_1_5_4:1.18 SHTOOL_1_5_3:1.18 SHTOOL_1_5_2:1.18 SHTOOL_1_5_1:1.17 SHTOOL_1_5_0:1.17 SHTOOL_1_4_9:1.17 SHTOOL_1_4_8:1.16 SHTOOL_1_4_7:1.13 SHTOOL_1_4_6:1.12 SHTOOL_1_4_5:1.11 SHTOOL_1_4_4:1.11 SHTOOL_1_4_3:1.11 SHTOOL_1_4_2:1.11 SHTOOL_1_4_1:1.10 SHTOOL_1_4_0:1.9 SHTOOL_1_3_3:1.6 SHTOOL_1_3_2:1.5 SHTOOL_1_3_1:1.4 SHTOOL_1_3_0:1.4 SHTOOL_1_2_9:1.2 SHTOOL_1_2_8:1.2; locks; strict; comment @# @; 1.30 date 2008.04.02.20.13.44; author rse; state Exp; branches; next 1.29; commitid eB5Wirx8MdMyDzXs; 1.29 date 2007.05.19.19.09.39; author rse; state Exp; branches; next 1.28; commitid OPUF1UBbllBTwzis; 1.28 date 2006.02.04.09.43.25; author rse; state Exp; branches; next 1.27; commitid oWk7BmnyAitJtfkr; 1.27 date 2005.06.15.08.14.35; author rse; state Exp; branches; next 1.26; 1.26 date 2004.02.12.16.06.27; author rse; state Exp; branches; next 1.25; 1.25 date 2004.01.01.16.54.20; author rse; state Exp; branches; next 1.24; 1.24 date 2003.02.11.13.00.50; author rse; state Exp; branches; next 1.23; 1.23 date 2003.02.11.12.56.40; author rse; state Exp; branches; next 1.22; 1.22 date 2002.11.02.12.14.10; author rse; state Exp; branches; next 1.21; 1.21 date 2001.12.31.15.06.04; author rse; state Exp; branches; next 1.20; 1.20 date 2001.09.23.10.58.10; author rse; state Exp; branches; next 1.19; 1.19 date 2001.06.14.19.02.54; author rse; state Exp; branches; next 1.18; 1.18 date 2001.01.17.09.55.11; author rse; state Exp; branches; next 1.17; 1.17 date 2000.04.05.16.42.28; author rse; state Exp; branches; next 1.16; 1.16 date 2000.03.12.13.28.24; author rse; state Exp; branches; next 1.15; 1.15 date 2000.03.12.11.13.38; author rse; state Exp; branches; next 1.14; 1.14 date 2000.03.12.11.12.21; author rse; state Exp; branches; next 1.13; 1.13 date 99.12.24.15.11.23; author rse; state Exp; branches; next 1.12; 1.12 date 99.09.04.10.47.19; author rse; state Exp; branches; next 1.11; 1.11 date 99.07.09.06.21.41; author rse; state Exp; branches; next 1.10; 1.10 date 99.07.06.08.57.45; author rse; state Exp; branches; next 1.9; 1.9 date 99.07.02.08.34.33; author rse; state Exp; branches; next 1.8; 1.8 date 99.07.01.15.04.36; author rse; state Exp; branches; next 1.7; 1.7 date 99.07.01.15.02.48; author rse; state Exp; branches; next 1.6; 1.6 date 99.06.29.17.37.34; author rse; state Exp; branches; next 1.5; 1.5 date 99.06.28.15.18.44; author rse; state Exp; branches; next 1.4; 1.4 date 99.06.12.14.46.37; author rse; state Exp; branches; next 1.3; 1.3 date 99.06.12.14.08.49; author rse; state Exp; branches; next 1.2; 1.2 date 99.05.28.11.16.35; author rse; state Exp; branches; next 1.1; 1.1 date 99.05.28.10.13.57; author rse; state Exp; branches; next ; desc @@ 1.30 log @adjust copyright for year 2008 @ text @## ## scpp -- Sharing C Pre-Processor ## Copyright (c) 1999-2008 Ralf S. Engelschall ## ## This file is part of shtool and free software; you can redistribute ## it and/or modify it under the terms of the GNU General Public ## License as published by the Free Software Foundation; either version ## 2 of the License, or (at your option) any later version. ## ## This file is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, ## USA, or contact Ralf S. Engelschall . ## str_tool="scpp" str_usage="[-v|--verbose] [-p|--preserve] [-f|--filter ] [-o|--output ] [-t|--template ] [-M|--mark ] [-D|--define ] [-C|--class ] [ ...]" gen_tmpfile=yes arg_spec="1+" opt_spec="v.p.f+o:t:M:D:C:" opt_alias="v:verbose,p:preserve,f:filter,o:output,t:template,M:mark,D:define,C:class" opt_v=no opt_p=no opt_f="" opt_o="lib.h" opt_t="lib.h.in" opt_M="%%MARK%%" opt_D="cpp" opt_C="intern" . ./sh.common srcs="$*" output="${opt_o}.n" # find a reasonable Awk awk='' paths=`echo $PATH |\ sed -e 's%/*:%:%g' -e 's%/$%%' \ -e 's/^:/.:/' -e 's/::/:.:/g' -e 's/:$/:./' \ -e 's/:/ /g'` for name in gawk nawk awk; do for path in $paths; do if [ -r "$path/$name" ]; then awk="$path/$name" break fi done if [ ".$awk" != . ]; then break fi done if [ ".$awk" = . ]; then echo "$msgprefix:Error: cannot find a reasonable Awk" 1>&2 shtool_exit 1 fi # parse source file(s) if [ ".$opt_v" = .yes ]; then echo "Parsing:" | $awk '{ printf("%s", $0); }' 1>&2 fi for src in $srcs; do if [ ".$opt_v" = .yes ]; then echo $src | $awk '{ printf(" %s", $0); }' 1>&2 fi if [ ".$opt_f" != . ]; then inputcmd="sed" OIFS="$IFS"; IFS="$ASC_NL"; set -- $opt_f; IFS="$OIFS" for e do inputcmd="$inputcmd -e '$e'" done inputcmd="$inputcmd '$src'" else inputcmd="cat '$src'" fi eval $inputcmd |\ $awk ' BEGIN { ln = 0; fln = 0; level = 0; mode = ""; store = ""; } { ln++; } /^#if.*/ { level++; } /^#if [a-zA-Z_][a-zA-Z0-9_]* *$/ { if ($2 == define) { mode = "D"; printf("D:#line %d \"%s\"\n", ln, src); next; } } /^#endif.*/ { level--; if (mode == "D" && level == 0) { mode = ""; next; } } /^[a-zA-Z_][a-zA-Z0-9_].*;.*/ { if ($1 == class) { printf("V:#line %d \"%s\"\n", ln, src); printf("V:%s\n", $0); printf("J:%s\n", $0); next; } } /^[a-zA-Z_][a-zA-Z0-9_].*=.*/ { if ($1 == class) { printf("V:#line %d \"%s\"\n", ln, src); printf("V:%s\n", $0); printf("J:%s\n", $0); next; } } /^[a-zA-Z_][a-zA-Z0-9_]*/ { if ($1 == class) { fln = ln; store = $0; mode = "F"; next; } } /^\{ *$/ { if (mode == "F") { printf("F:#line %d \"%s\"\n", fln, src); printf("F:%s;\n", store); printf("I:%s;\n", store); store = ""; mode = ""; next; } } { if (mode == "D") printf("D:%s\n", $0); else if (mode == "F") store = store " " $0; } ' "src=$src" "define=$opt_D" "class=$opt_C" >>$tmpfile done if [ ".$opt_v" = .yes ]; then echo "" 1>&2 fi # start generating output header echo "/* $opt_o -- autogenerated from $opt_t, DO NOT EDIT! */" >$output echo "#line 1 \"$opt_t\"" >>$output sed <$opt_t -e "1,/^${opt_M} *\$/p" -e 'd' |\ sed -e "/^${opt_M} *\$/d" >>$output # merge in the define blocks grep '^D:' $tmpfile | sed -e 's/^D://' >>$output # generate standard prolog echo "#line 1 \"_ON_THE_FLY_\"" >>$output echo "" >>$output echo "/* make sure the scpp source extensions are skipped */" >>$output echo "#define $opt_D 0" >>$output echo "#define $opt_C /**/" >>$output # generate namespace hiding for variables echo "" >>$output echo "/* move intern variables to hidden namespace */" >>$output grep '^J:' $tmpfile | sed >>$output \ -e 's/^J://' \ -e 's/ */ /g' \ -e 's/^[^=;]*[ *]\([a-zA-Z0-9_]*\)\[\];.*$/#define \1 __\1/' \ -e 's/^[^=;]*[ *]\([a-zA-Z0-9_]*\)\[\] =.*$/#define \1 __\1/' \ -e 's/^[^=;]*[ *]\([a-zA-Z0-9_]*\);.*$/#define \1 __\1/' \ -e 's/^[^=;]*[ *]\([a-zA-Z0-9_]*\) =.*$/#define \1 __\1/' # generate namespace hiding for functions echo "" >>$output echo "/* move intern functions to hidden namespace */" >>$output grep '^I:' $tmpfile | sed >>$output \ -e 's/^I://' \ -e 's/\([ (]\) */\1/g' \ -e 's/ *\([),]\)/\1/g' \ -e 's/^[^(]*[ *]\([a-zA-Z0-9_]*\)(.*$/#define \1 __\1/' # generate prototypes for variables echo "" >>$output echo "/* prototypes for intern variables */" >>$output grep '^V:' $tmpfile | sed >>$output \ -e 's/^V://' \ -e 's/ */ /g' \ -e 's/^\([^=;]*[ *][a-zA-Z0-9_]*\[\]\);.*$/\1;/' \ -e 's/^\([^=;]*[ *][a-zA-Z0-9_]*\[\]\) =.*$/\1;/' \ -e 's/^\([^=;]*[ *][a-zA-Z0-9_]*\);.*$/\1;/' \ -e 's/^\([^=;]*[ *][a-zA-Z0-9_]*\) =.*$/\1;/' \ -e 's/ ;/;/g' \ -e "s/^$opt_C /extern /" # generate prototypes for functions echo "" >>$output echo "/* prototypes for intern functions */" >>$output grep '^F:' $tmpfile | sed >>$output \ -e 's/^F://' \ -e 's/\([ (]\) */\1/g' \ -e 's/ *\([),]\)/\1/g' \ -e 's/\([* ]\)[a-zA-Z0-9_]*,/\1,/g' \ -e 's/\([* ]\)[a-zA-Z0-9_]*);/\1);/g' \ -e 's/(\*[a-zA-Z0-9_]*)(/(*)(/g' \ -e 's/\([ (]\) */\1/g' \ -e 's/ *\([),]\)/\1/g' \ -e "s/^$opt_C /extern /" # finish generating output header n=`(echo ''; sed <$opt_t -e "1,/^${opt_M} *\$/p" -e 'd') |\ wc -l | sed -e 's;^ *\([0-9]*\) *$;\1;'` echo "#line $n \"$opt_t\"" >>$output sed <$opt_t -e "/^${opt_M} *\$/,\$p" -e 'd' |\ sed -e "/^${opt_M} *\$/d" >>$output # create final output file if [ -f $opt_o ]; then if [ ".$opt_p" = .yes ]; then grep -v '^#line' $opt_o >$tmpfile.o grep -v '^#line' $output >$tmpfile.n out_old="$tmpfile.o" out_new="$tmpfile.n" else out_old="$opt_o" out_new="$output" fi if cmp -s $out_old $out_new; then : else cp $output $opt_o fi else cp $output $opt_o fi rm -f $output rm -f $tmpfile $tmpfile.* >/dev/null 2>&1 shtool_exit 0 ## ## manual page ## =pod =head1 NAME B - B C source file pre-processor =head1 SYNOPSIS B [B<-v>|B<--verbose>] [B<-p>|B<--preserve>] [B<-f>|B<--filter> I] [B<-o>|B<--output> I] [B<-t>|B<--template> I] [B<-M>|B<--mark> I] [B<-D>|B<--define> I] [B<-C>|B<--class> I] I [I ...] =head1 DESCRIPTION This command is an additional ANSI C source file pre-processor for sharing cpp(1) code segments, internal variables and internal functions. The intention for this comes from writing libraries in ANSI C. Here a common shared internal header file is usually used for sharing information between the library source files. The operation is to parse special constructs in Is, generate a few things out of these constructs and insert them at position I in I by writing the output to I. Additionally the Is are never touched or modified. Instead the constructs are removed later by the cpp(1) phase of the build process. The only prerequisite is that every I has a ``C<#include ">IC<">'' at the top. This command provides the following features: First it avoids namespace pollution and reduces prototyping efforts for internal symbols by recognizing functions and variables which are defined with the storage class identifier ``I''. For instance if I is ``intern'', a function ``C'' in one of the Is is translated into both a ``C<#define foobar __foobar>'' and a ``C'' in I. Additionally a global ``C<#define> I C'' is also created in I to let the compiler silently ignore this additional storage class identifier. Second, the library source files usually want to share Cs, C<#define>s, etc. over the source file boundaries. To achieve this one can either place this stuff manually into I or use the second feature of B: All code in Is encapsulated with ``C<#if >I ... C<#endif>'' is automatically copied to I. Additionally a global ``C<#define> I C<0>'' is also created in I to let the compiler silently skip this parts (because it was already found in the header). =head1 OPTIONS The following command line options are available. =over 4 =item B<-v>, B<--verbose> Display some processing information. =item B<-p>, B<--preserve> Preserves I independent of the generated ``#line'' lines. This is useful for Makefiles if the real contents of I will not change, just line numbers. Default is to overwrite. =item B<-f>, B<--filter> I Apply one or more pre-processing sed(1) I commands (usually of type ``C'') to each input file before their input is parsed. This option can occur multiple times. =item B<-o>, B<--output> I Output file name. Default is C. =item B<-t>, B<--template> I Template file name. Default is C. =item B<-M>, B<--mark> I Mark to be replaced by generated constructs. Default is C<%%MARK%%>. =item B<-D>, B<--define> I FIXME. Default is C. =item B<-C>, B<--class> I FIXME. Default is C. =back =head1 EXAMPLE # Makefile SRCS=foo_bar.c foo_quux.c foo_p.h: foo_p.h.in shtool scpp -o foo_p.h -t foo_p.h.in \ -M %%MARK%% -D cpp -C intern $(SRCS) /* foo_p.h.in */ #ifndef FOO_P_H #define FOO_P_H %%MARK%% #endif /* FOO_P_H */ /* foo_bar.c */ #include "foo_p.h" #if cpp #define OURS_INIT 4711 #endif intern int ours; static int myone = 0815; intern int bar(void) { ours += myone; } /* foo_quux.c */ #include "foo_p.h" int main(int argc, char *argv[]) { int i; ours = OURS_INIT for (i = 0; i < 10; i++) { bar(); printf("ours now %d\n", ours); } return 0; } =head1 HISTORY The B B command was originally written by Ralf S. Engelschall Erse@@engelschall.comE in 1999 for B. Its was prompted by the need to have a pre-processing facility in the B project. =head1 SEE ALSO shtool(1), cpp(1). =cut @ 1.29 log @Adjust copyright for year 2007. @ text @d3 1 a3 1 ## Copyright (c) 1999-2007 Ralf S. Engelschall @ 1.28 log @Adjust copyright for year 2006 @ text @d3 1 a3 1 ## Copyright (c) 1999-2006 Ralf S. Engelschall @ 1.27 log @Adjust copyright for year 2005 @ text @d3 1 a3 1 ## Copyright (c) 1999-2005 Ralf S. Engelschall @ 1.26 log @Embedded the command documentation from shtool.pod into the individual sh.xxxx scripts and this way split the large shtool(1) manual page into individual manual pages shtool-xxxx(1). Submitted partly by: Thomas Lotterer @ text @d3 1 a3 1 ## Copyright (c) 1999-2004 Ralf S. Engelschall @ 1.25 log @Bump copyright year for 2004 @ text @a3 1 ## Originally written for GNU Pth d248 154 @ 1.24 log @Bump year in copyright messages to cover new year 2003. @ text @d3 1 a3 1 ## Copyright (c) 1999-2003 Ralf S. Engelschall @ 1.23 log @Fixed error exit in all commands by introducing an "shtool_exit" function (which correctly cleans up temporary files) and replacing all "exit" calls with "shtool_exit". THIS THE FIRST TIME INTRODUCED THE USAGE OF A SHELL FUNCTION TO THE SHTOOL CODE. This is known to break on _very_ anchient and broken Bourne-Shell implementations and is considered to be no longer a real problem in the year 2003. Especially there is no alternative way anyway. @ text @d3 1 a3 1 ## Copyright (c) 1999-2002 Ralf S. Engelschall @ 1.22 log @Fixed 'shtool scpp -f ...'. The arguments to option -f were not evaluated correctly. @ text @d61 1 a61 1 exit 1 @ 1.21 log @bump copyright years @ text @d79 1 a79 1 inputcmd="$inputcmd $src" d81 1 a81 1 inputcmd="cat $src" d83 1 a83 1 $inputcmd |\ @ 1.20 log @*** empty log message *** @ text @d3 1 a3 1 ## Copyright (c) 1999-2001 Ralf S. Engelschall @ 1.19 log @*** empty log message *** @ text @d23 1 a23 1 str_usage="[-v] [-p] [-f] [-o] [-t] [-M] [-D] [-C] [ ...]" d27 1 @ 1.18 log @*** empty log message *** @ text @d71 9 a79 1 if [ ".$opt_f" = . ]; then a80 2 else inputcmd="sed $opt_f $src" @ 1.17 log @*** empty log message *** @ text @d3 1 a3 1 ## Copyright (c) 1999-2000 Ralf S. Engelschall @ 1.16 log @*** empty log message *** @ text @d23 1 a23 1 str_usage="[-v] [-p] [-o] [-t] [-M] [-D] [-C] [ ...]" d26 1 a26 1 opt_spec="v.p.o:t:M:D:C:" d29 1 d71 7 a77 1 $awk <$src ' @ 1.15 log @*** empty log message *** @ text @d26 3 a28 1 opt_spec="vpo:t:M:D:C:" @ 1.14 log @*** empty log message *** @ text @d4 1 a4 1 ## Originally written for GNU pth @ 1.13 log @*** empty log message *** @ text @d3 1 a3 1 ## Copyright (c) 1999 Ralf S. Engelschall @ 1.12 log @*** empty log message *** @ text @d26 1 a26 1 opt_spec="vpo:!t:!M:!D:!C:!" @ 1.11 log @*** empty log message *** @ text @d96 9 a104 1 /^[a-zA-Z_][a-zA-Z0-9_].*;.*/ || /^[a-zA-Z_][a-zA-Z0-9_].*=.*/ { @ 1.10 log @*** empty log message *** @ text @d190 5 @ 1.9 log @*** empty log message *** @ text @d4 1 a4 1 ## Originally written for NPS d38 22 d62 1 a62 1 echo "Parsing:" | awk '{ printf("%s", $0); }' 1>&2 d66 1 a66 1 echo $src | awk '{ printf(" %s", $0); }' 1>&2 d68 1 a68 1 awk <$src ' @ 1.8 log @*** empty log message *** @ text @d141 1 a141 1 echo "/* move intern function to hidden namespace */" >>$output @ 1.7 log @*** empty log message *** @ text @d52 1 a52 1 store = ""; d57 1 a57 1 /^#if.*/ { d60 1 a60 1 /^#if [a-zA-Z_][a-zA-Z0-9_]* *$/ { d67 1 a67 1 /^#endif.*/ { d74 1 a74 1 /^[a-zA-Z_][a-zA-Z0-9_].*;.*/ || /^[a-zA-Z_][a-zA-Z0-9_].*=.*/ { @ 1.6 log @*** empty log message *** @ text @d82 1 a82 1 /^[a-zA-Z_][a-zA-Z0-9_]*/ { @ 1.5 log @*** empty log message *** @ text @d90 1 a90 1 /^\{ *$/ { d119 1 a119 1 grep '^D:' $tmpfile | sed -e 's/^D://' >>$output @ 1.4 log @*** empty log message *** @ text @d33 1 a33 1 . sh.common @ 1.3 log @*** empty log message *** @ text @d3 1 a3 1 ## Copyright (c) 1999 Ralf S. Engelschall, All Rights Reserved. d5 15 @ 1.2 log @*** empty log message *** @ text @a0 1 #!/bin/sh d4 1 a4 1 ## Usage: scpp [-v] [-o ] [-t ] [-M ] [-D ] [-C ] [ ...] d7 10 a16 31 # # defaults # verbose=no output_file="lib.h" output_template="lib.h.in" output_mark="%%MARK%%" input_define="cpp" input_class="intern" srcs="" # # command line parsing # while [ ".$1" != . ]; do case $1 in -v) verbose=yes; shift; continue ;; -o) output_file=$2; shift; shift; continue ;; -t) output_template=$2; shift; shift; continue ;; -M) output_mark=$2; shift; shift; continue ;; -D) input_define=$2; shift; shift; continue ;; -C) input_class=$2; shift; shift; continue ;; *) break ;; esac done if [ $# -lt 1 ]; then echo "$0:Usage: scpp [-v] [-o ] [-t ] [-D ] [-C ] [ ...]" 1>&2 exit 1 fi srcs="$*" output="${output_file}.n" d18 1 a18 12 # # determine temporary dir # tmpdir="/tmp" if [ ".$TMPDIR" != . ]; then tmpdir="$TMPDIR" else if [ ".$TEMPDIR" != . ]; then tmpdir="$TEMPDIR" fi fi tmpfile="$tmpdir/shtool.scpp.tmp.$$" d20 2 a21 8 # # start generating output header # echo "/* $output_file -- autogenerated header file, DO NOT EDIT! */" >$output echo "#line 1 \"$output_template\"" >>$output sed <$output_template \ -e "1,/^${output_mark} *\$/p" -e 'd' |\ sed -e "/^${output_mark} *\$/d" >>$output a22 1 # d24 1 a24 3 # cp /dev/null $tmpfile if [ $verbose = yes ]; then d28 1 a28 1 if [ $verbose = yes ]; then a30 1 out_src=`echo "$src" | sed -e 's;\.[^.]*$;;' -e 's;$;.c;'` d33 2 a34 2 ln = 0; fln = 0; d36 1 a36 1 mode = ""; d86 1 a86 1 if (mode == "D") { d88 1 a88 2 } else if (mode == "F") { a89 1 } d91 1 a91 1 ' "src=$src" "define=$input_define" "class=$input_class" >>$tmpfile d93 1 a93 1 if [ $verbose = yes ]; then d97 8 a104 6 # # devide, conquer, postprocess and generate output # grep '^D:' <$tmpfile |\ sed >>$output \ -e 's/^D://' d106 1 d109 5 a113 3 echo "/* make sure the original sources are skipped */" >>$output echo "#define $input_define 0" >>$output echo "#define $input_class /**/" >>$output d116 9 a124 8 grep '^J:' <$tmpfile |\ sed >>$output \ -e 's/^J://' \ -e 's/ */ /g' \ -e 's/^[^=;]*[ *]\([a-zA-Z0-9_]*\)\[\];.*$/#define \1 __\1/' \ -e 's/^[^=;]*[ *]\([a-zA-Z0-9_]*\)\[\] =.*$/#define \1 __\1/' \ -e 's/^[^=;]*[ *]\([a-zA-Z0-9_]*\);.*$/#define \1 __\1/' \ -e 's/^[^=;]*[ *]\([a-zA-Z0-9_]*\) =.*$/#define \1 __\1/' d127 5 a131 6 grep '^I:' <$tmpfile |\ sed >>$output \ -e 's/^I://' \ -e 's/\([ (]\) */\1/g' \ -e 's/ *\([),]\)/\1/g' \ -e 's/^[^(]*[ *]\([a-zA-Z0-9_]*\)(.*$/#define \1 __\1/' d133 1 d136 11 a146 10 grep '^V:' <$tmpfile |\ sed >>$output \ -e 's/^V://' \ -e 's/ */ /g' \ -e 's/^\([^=;]*[ *][a-zA-Z0-9_]*\[\]\);.*$/\1;/' \ -e 's/^\([^=;]*[ *][a-zA-Z0-9_]*\[\]\) =.*$/\1;/' \ -e 's/^\([^=;]*[ *][a-zA-Z0-9_]*\);.*$/\1;/' \ -e 's/^\([^=;]*[ *][a-zA-Z0-9_]*\) =.*$/\1;/' \ -e 's/ ;/;/g' \ -e 's/^intern /extern /' d149 12 a160 16 grep '^F:' <$tmpfile |\ sed >>$output \ -e 's/^F://' \ -e 's/\([ (]\) */\1/g' \ -e 's/ *\([),]\)/\1/g' \ -e 's/^intern /extern /' # # end generating output header # n=`(echo ''; sed <$output_template -e "1,/^${output_mark} *\$/p" -e 'd') |\ wc -l | sed -e 's;^ *\([0-9]*\) *$;\1;'` echo "#line $n \"$output_template\"" >>$output sed <$output_template \ -e "/^${output_mark} *\$/,\$p" -e 'd' |\ sed -e "/^${output_mark} *\$/d" >>$output a161 1 # d163 11 a173 3 # if [ -f $output_file ]; then if cmp -s $output_file $output; then d176 1 a176 1 cp $output $output_file d179 1 a179 1 cp $output $output_file d182 1 a182 5 # # cleanup # rm -f $tmpfile @ 1.1 log @*** empty log message *** @ text @d160 4 a163 2 -e 's/^[^=;]*[ *]\([a-zA-Z0-9_]*\)\[\] *[=;].*$/#define \1 __\1/' \ -e 's/^[^=;]*[ *]\([a-zA-Z0-9_]*\) *[=;].*$/#define \1 __\1/' d179 4 a182 1 -e 's/^\([^=;]*[ *]\([a-zA-Z0-9_]*\)\) *[=;].*$/\1;/' \ @