* lib/ylwrap: The new shape in which the previous refactoring have left the code allows us to get rid on the confusing loop on the "FROM TARGET" couples, where FROM is the name of an output file generated by the wrapped program and TARGET is the name of the file it should be renamed to. The renamings can now be done in a more ad-hoc, conscious way. This is also meant will allow further optimizations and cleanups in the future. --- ChangeLog | 11 +++++++++++ lib/ylwrap | 45 +++++++++++++++++---------------------------- 2 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/ChangeLog b/ChangeLog index 78d7ffa..6f5f573 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2011-05-05 Stefano Lattarini <stefano.lattar...@gmail.com> + ylwrap: get rid of the loop on "FROM TARGET" couples + * lib/ylwrap: The new shape in which the previous refactoring have + left the code allows us to get rid on the confusing loop on the + "FROM TARGET" couples, where FROM is the name of an output file + generated by the wrapped program and TARGET is the name of the + file it should be renamed to. The renamings can now be done in + a more ad-hoc, conscious way. This is also meant will allow + further optimizations and cleanups in the future. + +2011-05-05 Stefano Lattarini <stefano.lattar...@gmail.com> + ylwrap: another cleanup refactoring (no semantic change) * lib/ylwrap: Restructure main code to remove an if/else construct. diff --git a/lib/ylwrap b/lib/ylwrap index fbbca84..9f9190c 100755 --- a/lib/ylwrap +++ b/lib/ylwrap @@ -207,26 +207,7 @@ EOF ;; esac -case $wrapped in - yacc) - c_ext=`echo $y_ext | tr 'y' 'c'` - h_ext=`echo $y_ext | tr 'y' 'h'` - output_stem=`echo "$output" | sed "s/\\\\.$c_ext$//"` - pairlist=" - y.tab.c $output_stem.$c_ext - y.tab.h $output_stem.$h_ext - y.output $output_stem.output" - ;; - lex) - pairlist="$lex_output_root.c $output" - ;; - '') - usage_error "no operation mode specified" - ;; - *) - exit 255 # not reached - ;; -esac +test -n "$wrapped" || usage_error "no operation mode specified" if test x"$1" = x"--"; then shift @@ -273,19 +254,27 @@ ret=$? test $ret -eq 0 || eval "$do_exit" -set X $pairlist -shift - # The directory holding the input. input_dir=`dirname_ "$input"` # Quote $input_dir so we can use it in a regexp. input_rx=`quote_for_sed "$input_dir"` -while test $# -ne 0; do - handle_renaming "$1" "$2" - shift - shift -done +case $wrapped in + yacc) + c_ext=`echo $y_ext | tr 'y' 'c'` + h_ext=`echo $y_ext | tr 'y' 'h'` + output_stem=`echo "$output" | sed "s/\\\\.$c_ext$//"` + handle_renaming y.tab.c $output_stem.$c_ext + handle_renaming y.tab.h $output_stem.$h_ext + handle_renaming y.output $output_stem.output + ;; + lex) + handle_renaming $lex_output_root.c $output + ;; + *) + exit 255 # Not reached. + ;; +esac eval "$do_exit" -- 1.7.2.3