1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

command grouping with TEXT...ENDTEXT

Discussion in 'Support' started by LarryBrasfield, Mar 18, 2010.

  1. LarryBrasfield

    Joined:
    Mar 18, 2010
    Messages:
    11
    Likes Received:
    0
    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
     
  2. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,870
    Likes Received:
    83
    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
     

Share This Page