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