[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[FYI] {ylwrap-refactor} ylwrap: get rid of the loop on "FROM TARGET" cou
From: |
Stefano Lattarini |
Subject: |
[FYI] {ylwrap-refactor} ylwrap: get rid of the loop on "FROM TARGET" couples |
Date: |
Thu, 5 May 2011 19:33:59 +0200 |
User-agent: |
KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) |
* 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 <address@hidden>
+ 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 <address@hidden>
+
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
- [FYI] {ylwrap-refactor} Refactoring (eventual rewriting) of the `ylwrap' script., Stefano Lattarini, 2011/05/05
- [FYI] {ylwrap-refactor} ylwrap: various refactorings, few improvements, Stefano Lattarini, 2011/05/05
- [FYI] {ylwrap-refactor} ylwrap: fixlets in option parsing, Stefano Lattarini, 2011/05/05
- [FYI] {ylwrap-refactor} ylwrap: make less general and more "expert", Stefano Lattarini, 2011/05/05
- [FYI] {ylwrap-refactor} ylwrap: new subroutine `tr_cpp', Stefano Lattarini, 2011/05/05
- [FYI] {ylwrap-refactor} ylwrap: new subroutine `handle_renaming', Stefano Lattarini, 2011/05/05
- [FYI] {ylwrap-refactor} ylwrap: warn when expected output files are missing, Stefano Lattarini, 2011/05/05
- [FYI] {ylwrap-refactor} ylwrap: cleanup refactoring (no semantic change), Stefano Lattarini, 2011/05/05
- [FYI] {ylwrap-refactor} ylwrap: another cleanup refactoring (no semantic change), Stefano Lattarini, 2011/05/05
- [FYI] {ylwrap-refactor} ylwrap: get rid of the loop on "FROM TARGET" couples,
Stefano Lattarini <=
- FYI] {ylwrap-refactor} ylwrap: go into tempdir only when running wrapped program, Stefano Lattarini, 2011/05/05
- [FYI] {ylwrap-refactor} ylwrap: pull `dos_fix_yacc_filenames' out of `handle_renaming', Stefano Lattarini, 2011/05/05
- [FYI] {ylwrap-refactor} ylwrap: move "update if changed" logic out of `handle_renaming', Stefano Lattarini, 2011/05/05
- [FYI] {ylwrap-refactor} ylwrap: some renaming of variables and subroutines, Stefano Lattarini, 2011/05/06
- [FYI] {ylwrap-refactor} ylwrap: fix indentation, Stefano Lattarini, 2011/05/06
- [FYI] {ylwrap-refactor} ylwrap: rename 'handle_renaming' to 'tempfile_deploy', Stefano Lattarini, 2011/05/06
- [FYI] {ylwrap-refactor} merged branch 'yacc-work', Stefano Lattarini, 2011/05/06