[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[FYI] {ylwrap-refactor} ylwrap: some renaming of variables and subroutin
From: |
Stefano Lattarini |
Subject: |
[FYI] {ylwrap-refactor} ylwrap: some renaming of variables and subroutines |
Date: |
Fri, 6 May 2011 18:41:59 +0200 |
User-agent: |
KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) |
* lib/ylwrap ($dirname): Renamed ...
($tempdir): ... to this.
(dos_fix_yacc_filenames): Renamed ...
(set_yacc_filenames): ... to this. Added comments.
---
ChangeLog | 8 ++++++++
lib/ylwrap | 31 +++++++++++++++++--------------
2 files changed, 25 insertions(+), 14 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 982aeba..9e7adf6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-05-06 Stefano Lattarini <address@hidden>
+
+ ylwrap: some renaming of variables and subroutines
+ * lib/ylwrap ($dirname): Renamed ...
+ ($tempdir): ... to this.
+ (dos_fix_yacc_filenames): Renamed ...
+ (set_yacc_filenames): ... to this. Added comments.
+
2011-05-05 Stefano Lattarini <address@hidden>
ylwrap: move "update if changed" logic out of `handle_renaming'
diff --git a/lib/ylwrap b/lib/ylwrap
index 63ff934..d19d4db 100755
--- a/lib/ylwrap
+++ b/lib/ylwrap
@@ -60,9 +60,12 @@ tr_cpp ()
}
# Since DOS filename conventions don't allow two dots, the DOS version
-# of Bison writes out y_tab.c instead of y.tab.c and y_tab.h instead
-# of y.tab.h. Test to see if this is the case.
-dos_fix_yacc_filenames ()
+# of Bison writes out y_tab.c instead of y.tab.c and y_tab.h instead of
+# y.tab.h. Test to see if this is the case, ans set the default names
+# of the yacc output files accordingly.
+# This subroutine sets the global variables `$y_tab_c', `$y_tab_h' and
+# `$y_output'.
+set_yacc_filenames ()
{
test $wrapped = yacc || return 0
if test -f y_tab.c || test -f y_tab.h; then
@@ -80,7 +83,7 @@ handle_renaming ()
{
from=$1
target=$2
- if test ! -f $dirname/$from; then
+ if test ! -f $tempdir/$from; then
echo "ylwrap: expected file \`$from' not found" >&2
ret=1
return
@@ -105,7 +108,7 @@ handle_renaming ()
TARGET=`tr_cpp "$target"`
sed -e "/^#/!b" -e "s,$input_rx,," -e "s,$from,$target," \
- -e "s,$FROM,$TARGET," $dirname/"$from" >"$target" || ret=$?
+ -e "s,$FROM,$TARGET," $tempdir/"$from" >"$target" || ret=$?
}
move_if_change ()
@@ -205,23 +208,23 @@ esac
# FIXME: add hostname here for parallel makes that run commands on
# other machines. But that might take us over the 14-char limit.
-dirname=ylwrap$$
-do_exit="cd '$ocwd' && rm -rf $dirname; (exit \$ret); exit \$ret"
+tempdir=ylwrap$$
+do_exit="cd '$ocwd' && rm -rf $tempdir; (exit \$ret); exit \$ret"
# The only signals which are portably trappable are 1 (SIGHUP),
# 2 (SIGINT), 13 (SIGPIPE) and 15 (SIGTERM).
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
-mkdir $dirname || exit 1
+mkdir $tempdir || exit 1
-cd $dirname || exit 1
+cd $tempdir || exit 1
case $# in
0) "$prog" "$input" ;;
*) "$prog" "$@" "$input" ;;
esac
ret=$?
-dos_fix_yacc_filenames
+set_yacc_filenames
cd "$ocwd" || exit 1
test $ret -eq 0 || eval "$do_exit"
@@ -244,11 +247,11 @@ case $wrapped in
# If the `-d' option is not used, we don't want an error when the
# header file is "missing". Similarly, if `-v' is not used, we
# don't want an error when the `y.output' file is "missing".
- if test -f $dirname/$y_tab_h; then
- handle_renaming $y_tab_h $dirname/header.tmp
- move_if_change $dirname/header.tmp $output_stem.$h_ext
+ if test -f $tempdir/$y_tab_h; then
+ handle_renaming $y_tab_h $tempdir/header.tmp
+ move_if_change $tempdir/header.tmp $output_stem.$h_ext
fi
- if test -f $dirname/$y_output; then
+ if test -f $tempdir/$y_output; then
handle_renaming $y_output $output_stem.output
fi
;;
--
1.7.2.3
- [FYI] {ylwrap-refactor} ylwrap: make less general and more "expert", (continued)
- [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, 2011/05/05
- 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 <=
- [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