command grouping with TEXT...ENDTEXT

Mar 18, 2010
11
0
#1
The .btm appended below works as expected when run
without any parameter. But when given a parameter,
so that it uses the code after :DieStrangely, it dies
(strangely) when run under TCC 11.00.44. It appears
that the {TEXT followed by ENDTEXT} feature does not
work inside of a command group bounded by parentheses.

As can be seen, there is a work-around, which is to put
what might have been an inline emit text into its own
subroutine. But that is less desirable because, often,
stuff that motivates using the TEXT feature needs to be
understood in the context of stuff where all the maybe
troublesome expansion is necessary.

==========.btm content follows ===========
@echo off
set perl=type
set gotarget=Munge
if not "_%1"=="_" set gotarget=DieStrangely
gosub %gotarget%

quit 0

:emitPerlProg
TEXT
while ($_ = <>) {
print "$.\t", $_;
}
__END__
ENDTEXT
return

:Munge
(
gosub emitPerlProg
echo something
echo or
echo another
) | %perl%
return

:DieStrangely
(
TEXT
while ($_ = <>) {
print "$.\t", $_;
}
__END__
ENDTEXT
echo Something
echo or
echo another.
) | %type%
return
 

rconn

Administrator
Staff member
May 14, 2008
10,325
94
#2
> The .btm appended below works as expected when run
> without any parameter. But when given a parameter,
> so that it uses the code after :DieStrangely, it dies
> (strangely) when run under TCC 11.00.44. It appears
> that the {TEXT followed by ENDTEXT} feature does not
> work inside of a command group bounded by parentheses.
WAD. The TEXT / ENDTEXT block has to be on separate lines. When you put it
in a command group, it's all on one line.

Rex Conn
JP Software