On Wednesday, November 22, 2006 1:32 PM Gaby wrote:
> | On Wednesday, November 22, 2006 12:50 PM Gaby wrote:
> | 
> | > | > !              chunk=$arg
> 
> Bill Page wrote:
> 
> | Why does this fail? What is the value of $chunk?
> 
> Most of your questions can be asnwered as follows:
> Uncomment the "set -x" and "set +x" instructions from the
> document script and run the script for the files TESTFR.input,
> INTHEORY.input and VIEW2D.input. 
> 
>    ${INPUT}/TESTFR.input: $(srcdir)/fr.spad.pamphlet
>            $(axiom_build_document) --tangle='TEST FR' --output=$@ $<
> 
>    ${INPUT}/INTHEORY.input: $(srcdir)/numtheor.spad.pamphlet
>            $(axiom_build_document) --tangle='TEST INTHEORY' 
> --output=$@ $<
> 
>    ${INPUT}/VIEW2D.input: $(srcdir)/view2D.spad.pamphlet
>            $(axiom_build_document) --tangle='TEST VIEW2D' 
> --output=$@ $<
>

Unfortunately what wasted a lot of time and did not tell me
anything. :-(

All of these commands executed properly on the axiom-developer.org
server without changes to document - probably because of the default
behaviour of bash. See the output attached below.

But I noticed that you have many incorrectly quoted or unquoted
parameters in the document script. Perhaps that is what is causing
your "quote micmac" with zsh. This sort of awkward and obscure
construction is not necessary:

           chunk=`echo -n $arg`

I included a patch for document below. The corrected version of
the document script generates the same output as but it is more
robust on other systems with other shells and fully supports
file names that include spaces (e.g. on Windows).

Attachment:

[EMAIL PROTECTED] scripts]$ ./document --tangle='TEST VIEW2D'
 --output=test
~/axiom.build-improvements/src/algebra/view2D.spad.pamphlet
+ latex=latex
+ [EMAIL PROTECTED]@
+ tangle=/usr/local/bin/notangle
+ weave=/usr/local/bin/noweave
+ TEXINPUTS=.:/home/page/axiom.test/build/i686-pc-linux/share/texmf/tex:
+ export TEXINPUTS
+ BIBINPUTS=.:/home/page/axiom.test/build/i686-pc-linux/share/texmf/tex:
+ export BIBINPUTS
+ do_index=
+ do_latex=
+ do_tangle=
+ do_weave=
+ chunk=
+ file=
+ output=
+ :
+ do_tangle=yes
++ echo --tangle=TEST VIEW2D
++ awk -F= '{ print $2; }'
+ chunk=TEST VIEW2D
+ shift
+ :
++ echo --output=test3
++ awk -F= '{ print $2; }'
+ output=test3
+ shift
+ :
+ break
+ test xyes = xyes
+
file=/home/page/axiom.build-improvements/src/algebra/view2D.spad.pamphle
t
+ '[' -z test3 ']'
+ '[' -z 'TEST VIEW2D' ']'
+ /usr/local/bin/notangle '-RTEST VIEW2D'
/home/page/axiom.build-improvements/src/algebra/view2D.spad.pamphlet
+ exit 0
[EMAIL PROTECTED] scripts]$ rm test3
[EMAIL PROTECTED] scripts]$ ./document --tangle='TEST VIEW2D'
--output=test
3 ~/axiom.build-improvements/src/algebra/view2D.spad.pamphlet
+ latex=latex
+ [EMAIL PROTECTED]@
+ tangle=/usr/local/bin/notangle
+ weave=/usr/local/bin/noweave
+ TEXINPUTS=.:/home/page/axiom.test/build/i686-pc-linux/share/texmf/tex:
+ export TEXINPUTS
+ BIBINPUTS=.:/home/page/axiom.test/build/i686-pc-linux/share/texmf/tex:
+ export BIBINPUTS
+ do_index=
+ do_latex=
+ do_tangle=
+ do_weave=
+ chunk=
+ file=
+ output=
+ :
+ do_tangle=yes
++ echo --tangle=TEST VIEW2D
++ awk -F= '{ print $2; }'
+ chunk=TEST VIEW2D
+ shift
+ :
++ echo --output=test3
++ awk -F= '{ print $2; }'
+ output=test3
+ shift
+ :
+ break
+ test xyes = xyes
+
file=/home/page/axiom.build-improvements/src/algebra/view2D.spad.pamphle
t
+ '[' -z test3 ']'
+ '[' -z 'TEST VIEW2D' ']'
+ /usr/local/bin/notangle '-RTEST VIEW2D'
/home/page/axiom.build-improvements/src/algebra/view2D.spad.pamphlet
+ exit 0
[EMAIL PROTECTED] scripts]$ cat test3
)clear all
a:=0.5
b:=0.5
y1:=draw(x^3*(a+b*x),x=-1..1,title=="2.2.10 explicit")
g1:=getGraph(y1,1)
pointLists g1
b:=1.0
y2:=draw(x^3*(a+b*x),x=-1..1)
g2:=getGraph(y2,1)
pointLists g2
putGraph(y1,g2,2)
b:=2.0
y3:=draw(x^3*(a+b*x),x=-1..1)
g3:=getGraph(y3,1)
pointLists g3
putGraph(y1,g3,3)
vp:=makeViewport2D(y1)
[EMAIL PROTECTED] scripts]$

--------

Patch for document:

Everywhere a variable is used in a parameter to an external
command, it must be enclosed in "quotes". Note especially
the command

  $tangle "-R$chunk"

The substitution must be made inside the quoted parameter.

Also the notation

  if test x$do_tangle = xyes; then

is old and silly. This looks better and works the same.

  if test "$do_tangle" = "yes"; then

[EMAIL PROTECTED] scripts]$ ./document --tangle='TEST VIEW2D'
--output=test
3 ~/axiom.build-improvements/src/algebra/view2D.spad.pamphlet
[EMAIL PROTECTED] scripts]$ diff -au document_old document_new
--- document_old        2006-11-22 13:18:11.000000000 -0600
+++ document_new        2006-11-22 13:49:04.000000000 -0600
@@ -76,7 +76,7 @@
     esac
 done

-if test x$do_tangle = xyes; then
+if test "$do_tangle" = "yes"; then
     # FIXME: Check that the input file name does indeed have
     # a pamphlet extension.
     file=$1
@@ -89,32 +89,32 @@
     #        Alternatively, we could initialize chunk to '*' and
     #        unconditionally use -R"$chunk".
     if [ -z "$chunk" ]; then
-       $tangle $file > $output
+       $tangle "$file" > "$output"
     else
-       $tangle -R"$chunk" $file > $output
+       $tangle "-R$chunk" "$file" > "$output"
     fi
     # FIXME: Handle errors.
     exit $?;
 fi


-if test x$do_weave = xyes; then
+if test "$do_weave" = "yes"; then
     file=`basename $1 .pamphlet`
-    $weave -delay $1 > $file.tex
-    if test x$do_latex != xyes; then
+    $weave -delay "$1" > "$file.tex"
+    if test "$do_latex" != "yes"; then
        exit 0;
     fi
 fi

-if test x$do_latex = xyes; then
+if test "$do_latex" = "yes"; then
     if [ -z $file ]; then
        file=`basename $1 .tex`
     fi
-    $latex --interaction nonstopmode $file;
-    if [ x$do_index = xyes ]; then
-       $makeindex $file.idx
+    $latex --interaction nonstopmode "$file";
+    if [ "$do_index" = "yes" ]; then
+       $makeindex "$file.idx"
     fi
-    $latex --interaction nonstopmode $file;
+    $latex --interaction nonstopmode "$file";
     exit $?
 fi

@@ -122,30 +122,30 @@
 if [ "$#" = "3" ]; then
  REDIRECT=$2
  FILE=`basename $3 .pamphlet`
- $tangle -t8 $FILE.pamphlet >$FILE
- $weave -delay $FILE.pamphlet >$FILE.tex
- $latex --interaction nonstopmode $FILE.tex >$REDIRECT
- $latex --interaction nonstopmode $FILE.tex >$REDIRECT
- rm -f $FILE~
- rm -f $FILE.pamphlet~
- rm -f $FILE.log
- rm -f $FILE.tex
- rm -f $FILE.toc
- rm -f $FILE.aux
+ $tangle -t8 "$FILE.pamphlet" >"$FILE"
+ $weave -delay "$FILE.pamphlet" >"$FILE.tex"
+ $latex --interaction nonstopmode "$FILE.tex" >"$REDIRECT"
+ $latex --interaction nonstopmode "$FILE.tex" >"$REDIRECT"
+ rm -f "$FILE~"
+ rm -f "$FILE.pamphlet~"
+ rm -f "$FILE.log"
+ rm -f "$FILE.tex"
+ rm -f "$FILE.toc"
+ rm -f "$FILE.aux"
  exit 0
 fi
 if [ "$#" = "1" ]; then
  FILE=`basename $1 .pamphlet`
- $tangle -t8 $FILE.pamphlet >$FILE
- $weave -delay $FILE.pamphlet >$FILE.tex
- $latex $FILE.tex
- $latex $FILE.tex
- rm -f $FILE~
- rm -f $FILE.pamphlet~
- rm -f $FILE.log
- rm -f $FILE.tex
- rm -f $FILE.toc
- rm -f $FILE.aux
+ $tangle -t8 "$FILE.pamphlet" >"$FILE"
+ $weave -delay "$FILE.pamphlet" >"$FILE.tex"
+ $latex "$FILE.tex"
+ $latex "$FILE.tex"
+ rm -f "$FILE~"
+ rm -f "$FILE.pamphlet~"
+ rm -f "$FILE.log"
+ rm -f "$FILE.tex"
+ rm -f "$FILE.toc"
+ rm -f "$FILE.aux"
  exit 0
 fi
 echo "document [ -o redirect ] pamphlet"

[EMAIL PROTECTED] scripts]$


_______________________________________________
Axiom-developer mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/axiom-developer

Reply via email to