[Cook] end-of-line question

mlee at klaxoniqa.com mlee at klaxoniqa.com
Fri Sep 27 09:51:35 EST 2002


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
> 



More information about the Cook-users mailing list