Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

command grouping with TEXT...ENDTEXT

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
 
> 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
 

Similar threads

Back
Top