You are viewing a plain text version of this content. The canonical link for it is here.
Posted to websh-cvs@tcl.apache.org by da...@apache.org on 2001/11/07 00:12:44 UTC
cvs commit: tcl-websh/src/unix Makefile.in
davidw 01/11/06 15:12:44
Modified: src ChangeLog
src/generic tcldecmt.tcl
src/unix Makefile.in
Log:
Makefile.in changes to eliminate some shell commands in favor of an
extended tcldecmt.tcl script.
Revision Changes Path
1.2 +12 -0 tcl-websh/src/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /home/cvs/tcl-websh/src/ChangeLog,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ChangeLog 2001/10/25 09:44:28 1.1
+++ ChangeLog 2001/11/06 23:12:43 1.2
@@ -1,3 +1,15 @@
+2001-11-07 David N. Welton <da...@dedasys.com>
+
+ * generic/tcldecmt.tcl: Extend functionality to do multiple files,
+ and properly quote \ and " characters for use in a C string.
+
+ * unix/Makefile.in: Replaced shell commands with more
+ functionality in tcldecmt.tcl script.
+
+2001-11-05 David N. Welton <da...@dedasys.com>
+
+ * unix/configure.in: Moved to this directory from src/.
+
2001-03-14 Simon Hefti <si...@netcetera.ch>
* webutl.c: fixed setting global var for web::response command
1.2 +40 -30 tcl-websh/src/generic/tcldecmt.tcl
Index: tcldecmt.tcl
===================================================================
RCS file: /home/cvs/tcl-websh/src/generic/tcldecmt.tcl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- tcldecmt.tcl 2001/10/25 09:46:55 1.1
+++ tcldecmt.tcl 2001/11/06 23:12:44 1.2
@@ -1,35 +1,45 @@
-if {$argc > 0 } {
- set fileName [lindex $argv 0]
-} else {
- puts "hdb2pab.tcl --- usage: hdb2pab.tcl input.hdb."
- exit 1
-}
-
-# ----------------------------------------------------------------------------
-# try to open file
-# ----------------------------------------------------------------------------
-if {[file exists $fileName] } {
- set fileId [open $fileName "r"]
-} else {
- puts "hdb2pab.tcl --- cannot open $fileName."
- exit 1
-}
+proc DoFile { fileName } {
+ global argv0
+ # ----------------------------------------------------------------------------
+ # try to open file
+ # ----------------------------------------------------------------------------
+ if {[file exists $fileName] } {
+ set fileId [open $fileName "r"]
+ } else {
+ puts stderr "$argv0 --- cannot open $fileName."
+ exit 1
+ }
-# ----------------------------------------------------------------------------
-# read line by line to the end of the file
-# ----------------------------------------------------------------------------
-while {[eof $fileId] == 0} {
+ # ----------------------------------------------------------------------------
+ # read line by line to the end of the file
+ # ----------------------------------------------------------------------------
+ while {[eof $fileId] == 0} {
- gets $fileId tLine
- if { ![regexp "^$" $tLine] } {
- if { ![regexp {^[^#]*#} $tLine] } {
- regsub -all {\s+} $tLine { } res
- set tLine $res
- if { [regexp {^\s*(.*)} $tLine dum res] } {
- puts $res
- } else {
- puts $tLine
- }
+ gets $fileId tLine
+ if { ![regexp "^$" $tLine] } {
+ if { ![regexp {^[^#]*#} $tLine] } {
+ regsub -all {\s+} $tLine { } res
+ set res [string map {\" \\\" \\ \\\\} $res]
+ set tLine $res
+ if { [regexp {^\s*(.*)} $tLine dum res] } {
+ puts $res
+ } else {
+ puts $tLine
+ }
+ }
}
}
+}
+
+if {$argc > 0 } {
+ # prologue
+ puts "/* Do not modify! This code is automatically generated by $argv0 */"
+ puts "char script_h\[\] = \""
+ foreach fileName $argv {
+ DoFile $fileName
+ }
+ puts "\";"
+} else {
+ puts stderr "$argv0 --- usage: hdb2pab.tcl input.hdb."
+ exit 1
}
1.2 +3 -7 tcl-websh/src/unix/Makefile.in
Index: Makefile.in
===================================================================
RCS file: /home/cvs/tcl-websh/src/unix/Makefile.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Makefile.in 2001/10/25 09:48:32 1.1
+++ Makefile.in 2001/11/06 23:12:44 1.2
@@ -8,7 +8,7 @@
# redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
#
-# @(#) $Id: Makefile.in,v 1.1 2001/10/25 09:48:32 davidw Exp $
+# @(#) $Id: Makefile.in,v 1.2 2001/11/06 23:12:44 davidw Exp $
#
ECHO = echo
@@ -332,12 +332,8 @@
# generic
script.o: ../generic/script.c ../generic/script.h
-../generic/script.h: ../generic/script.ws3 ../generic/cookie.ws3 ../generic/context.tcl ../generic/sessctx.ws3 ../generic/tcldecmt.tcl initcode
- cat ../generic/script.ws3 ../generic/context.tcl ../generic/sessctx.ws3 ../generic/cookie.ws3 > script1.tmp
- $(TCLSH_PROG) ../generic/tcldecmt.tcl script1.tmp > script2.tmp
- ./initcode script2.tmp script.h
- mv script.h ../generic
- rm -f script1.tmp script2.tmp
+../generic/script.h: ../generic/script.ws3 ../generic/cookie.ws3 ../generic/context.tcl ../generic/sessctx.ws3 ../generic/tcldecmt.tcl
+ $(TCLSH_PROG) ../generic/tcldecmt.tcl ../generic/script.ws3 ../generic/context.tcl ../generic/sessctx.ws3 ../generic/cookie.ws3 > ../generic/script.h
initcode: ../generic/initcode.c
$(CC) -o initcode $<
Re: tcldecmt.tcl changes
Posted by "David N. Welton" <da...@dedasys.com>.
Ronnie Brunner <ro...@netcetera.ch> writes:
> > I have patched Makefile.in and tcldecmt.tcl to get rid of the
> > initcode depencency. I also changed the 'usage' message to
> > reference $argv0 instead of whatever other command was in there.
> FYI: the tcldecmt.tcl is not really very fancy: it does not follow
> tcl syntax, but only skips lines starting with a hash. Maybe we
> should at least add a comment, if not open a (low priority) bug.
Yes, and I enhanced it to quote \ and ", so that it works as a C
string.
You mean a comment or bug to describe what it does?
--
David N. Welton
Consulting: http://www.dedasys.com/
Free Software: http://people.debian.org/~davidw/
Apache Tcl: http://tcl.apache.org/
Personal: http://www.efn.org/~davidw/
Re: tcldecmt.tcl changes
Posted by Ronnie Brunner <ro...@netcetera.ch>.
David,
> I have patched Makefile.in and tcldecmt.tcl to get rid of the initcode
> depencency. I also changed the 'usage' message to reference $argv0
> instead of whatever other command was in there.
FYI: the tcldecmt.tcl is not really very fancy: it does not follow tcl
syntax, but only skips lines starting with a hash. Maybe we should at
least add a comment, if not open a (low priority) bug.
Ronnie
------------------------------------------------------------------------
Ronnie Brunner ronnie.brunner@netcetera.ch
Netcetera AG, 8040 Zuerich phone +41 1 247 79 79 Fax: +41 1 247 70 75
Re: tcldecmt.tcl changes
Posted by Ronnie Brunner <ro...@netcetera.ch>.
David,
> I have patched Makefile.in and tcldecmt.tcl to get rid of the initcode
> depencency. I also changed the 'usage' message to reference $argv0
> instead of whatever other command was in there.
FYI: the tcldecmt.tcl is not really very fancy: it does not follow tcl
syntax, but only skips lines starting with a hash. Maybe we should at
least add a comment, if not open a (low priority) bug.
Ronnie
------------------------------------------------------------------------
Ronnie Brunner ronnie.brunner@netcetera.ch
Netcetera AG, 8040 Zuerich phone +41 1 247 79 79 Fax: +41 1 247 70 75