[Cook] end-of-line question

Jerry Pendergraft jerry at endocardial.com
Fri Sep 27 10:09:49 EST 2002


I think you have discovered that the manual omits an important fact.
While it is true that an escaped newline is totally ignored, that does
*NOT* mean the leading spaces on the next line are ignored.

hence your right hand side of:
     ["if" [not [defined %0%/-some-variable]] "then"
         [rather-long-function-name argument1 argument2]/\
         [fromto %%-%2-%3 %1-%2 i586-Linux-avr]/lib\
         [rather-long-function-name argument1 argument2].a

evaluates to:
     ["if" [not [defined %0%/-some-variable]] "then"
         [rather-long-function-name argument1 argument2]/         [fromto %%-%2-%3 %1-%2 i586-Linux-avr]/lib         [rather-long-function-name argument1 argument2].a

With the problematic spaces. Did something like the following work?
     ["if" [not [defined %0%/-some-variable]] "then"
       [catenate [rather-long-function-name argument1 argument2] /
         [fromto %%-%2-%3 %1-%2 i586-Linux-avr]              /lib/
         [rather-long-function-name argument1 argument2]     .a
       ]

It seems from your example that you are trying to do something somewhat
outside the normal routine ;^)
-- 
Jerry Pendergraft                        jerry.pendergraft at endocardial.com
Endocardial Solutions                    voice: 651-523-6935
1350 Energy Lane, Suite 110                fax: 651-644-7897
St Paul, MN 55108-5254

On Fri, 27 Sep 2002 mlee at klaxoniqa.com wrote:

> Jerry,
> 
> Thanks, your suggestion below does help.
> 
> However, the debug stuff I was printing was an effort to determine why a recipe
> was failing.
> 
> One of the ingredients for the recipe was being built using the construct
> described below.  The recipe would fail if I did this:
> 
> bin/%0%1/%:
>     ["if" [not [defined %0%/-some-variable]] "then"
>         [rather-long-function-name argument1 argument2]/\
>         [fromto %%-%2-%3 %1-%2 i586-Linux-avr]/lib\
>         [rather-long-function-name argument1 argument2].a
>     ]
> {
>    ... etc ...
> }
> 
> 
> To get it to work, I had to remove interpreted line breaks like this:
> 
> bin/%0%1/%:
>     ["if" [not [defined %0%/-some-variable]] "then"
>         [rather-long-function-name argument1 argument2]/[fromto
>            %%-%2-%3 %1-%2 i586-Linux-avr
>            ]/lib[rather-long-function-name argument1 argument2].a
>     ]
> {
>    ... etc ...
> }
> 
> which is very ugly.
> 
> The suggestion you made below, using unsplit and catenate, does work and makes
> the ingredient construction less ugly, but is still not an intuitive way of
> doing it.  Especially since the cook manual says that the backslash should
> escape the line feed.  I also tried this, which didn't work:
> 
> bin/%0%1/%:
>     ["if" [not [defined %0%/-some-variable]] "then"
>         [rather-long-function-name argument1 argument2]/\
> [fromto %%-%2-%3 %1-%2 i586-Linux-avr]/lib\
> [rather-long-function-name argument1 argument2].a
>     ]
> {
>    ... etc ...
> }
> 
> 
> 
> Thanks again in advance for any help.
> 
> Regards,
> Matt Lee
> 
> 
> 
> Quoting Jerry Pendergraft <jerry at endocardial.com>:
> 
> > On Mon, 23 Sep 2002, Matthew Lee wrote:
> > 
> > > I'm having some trouble with end-of-line's in cook recipes -- I hope
> > > someone can help!
> > > 
> > > The cook user guide says that "An escaped end-of-line is totally
> > > ignored." (section 7.1.2).
> > > 
> > > In one of my cookbooks, I'm printing some debug info in an attempt
> > to
> > > get my recipes right.  I want to limit the column width of my
> > cookbook
> > > to 80 columns.  Here's what I'm doing:
> > > 
> > > function print Debug1 [rather-long-function-name argument1
> > argument2]/\
> > > [fromto %%-%2-%3 %1-%2 i586-Linux-avr]/lib\
> > > [rather-long-function-name argument1 argument2].a
> > function print will automatically wrap lines on output even if your
> > message did not contain spaces.
> > 
> > try using echo instead.
> > Also you can use catenate and/or unsplit to form the message across
> > multiple lines.
> > Something like:
> > 
> > echo [unsplit " " Debug1 
> >        [catenate [rather-long-function-name argument1 argument2] /
> >                  [fromto %1-%2-%3 %1-%2 i586-Linux-avr]/lib      /
> >                  [rather-long-function-name argument1 argument2] .a
> >        ]
> >      ];
> > 
> > > Thanks in advance,
> > > 
> > > Matt Lee
> > > KlaxonIQA
> > > Sydney, Australia
> > 
> _______________________________________________
> Cook-users mailing list
> Cook-users at auug.org.au
> http://www.auug.org.au/mailman/listinfo/cook-users
> 




More information about the Cook-users mailing list