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

TCC/LE incompatibility with CMD.exe

Discussion in 'TCC/LE Support' started by rjperrella, Dec 19, 2010.

  1. rjperrella

    Joined:
    Nov 15, 2010
    Messages:
    8
    Likes Received:
    0
    Hi, I found a minor incompatibility with TCC vs CMD.exe.

    If you have an IF statement such as:

    if defined var JAVA_HOME(

    This gives an error in TCC but not in CMD. The solution is to add a space prior to the open paren. This works in both CMD and TCC. Basically, it sounds like a parser error.

    I'm using TCC/LE v 11.00.40 by the way on Windows 7.

    Just thought you'd want to know.
     
  2. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,729
    Likes Received:
    80
    prior

    like a

    Not reproducible here.

    Can you provide the full IF statement (not just the fragment you quoted)?

    Rex Conn
    JP Software
     
  3. rjperrella

    Joined:
    Nov 15, 2010
    Messages:
    8
    Likes Received:
    0
    Hey it's only taken me 9 years to answer but better late than never!

    Running the following version:
    CMD.exe on Microsoft Windows [Version 10.0.14393]
    TCC LE 14.00.9 x64 Windows 10 [Version 6.3.14393]

    I put these four statements in a batch file called if_test.bat.

    IF DEFINED PATH(ECHO 1) ELSE ECHO NOT 1
    @ECHO EXIT CODE %ERRORLEVEL% %_?
    IF DEFINED PATH (ECHO 2) ELSE ECHO NOT 2
    @ECHO EXIT CODE %ERRORLEVEL% %_?
    IF NOT DEFINED XXX(ECHO 3) ELSE ECHO NOT 3
    @ECHO EXIT CODE %ERRORLEVEL% %_?
    IF NOT DEFINED XXX (ECHO 4) ELSE ECHO NOT 4
    @ECHO EXIT CODE %ERRORLEVEL% %_?
    IF DEFINED PATH(ECHO 5)
    @ECHO EXIT CODE %ERRORLEVEL% %_?



    On CMD, I get this:
    C:\src\tcc>if_test

    C:\src\tcc>IF DEFINED PATH(ECHO 1) ELSE ECHO NOT 1
    EXIT CODE 0 _?

    C:\src\tcc>IF DEFINED PATH (ECHO 2 ) ELSE ECHO NOT 2
    2
    EXIT CODE 0 _?

    C:\src\tcc>IF NOT DEFINED XXX(ECHO 3) ELSE ECHO NOT 3
    '3)' is not recognized as an internal or external command,
    operable program or batch file.
    EXIT CODE 0 _?

    C:\src\tcc>IF NOT DEFINED XXX (ECHO 4 ) ELSE ECHO NOT 4
    4
    EXIT CODE 0 _?

    C:\src\tcc>IF DEFINED PATH(ECHO 5)
    EXIT CODE 0 _?


    On TCC, I get this:
    [C:\src\tcc]if_test.bat
    IF DEFINED PATH(ECHO 1) ELSE ECHO NOT 1
    EXIT CODE 0 2
    IF DEFINED PATH (ECHO 2) ELSE ECHO NOT 2
    2
    EXIT CODE 0 0
    IF NOT DEFINED XXX(ECHO 3) ELSE ECHO NOT 3
    TCC: C:\src\tcc\if_test.bat [5] Unknown command "ELSE"
    EXIT CODE 2 2
    IF NOT DEFINED XXX (ECHO 4) ELSE ECHO NOT 4
    4
    EXIT CODE 2 0
    IF DEFINED PATH(ECHO 5)
    C:\src\tcc\if_test.bat [9] Usage : IF [/I] [NOT] condition [.AND. | .OR. | .XOR. [NOT] condition ...] command
    EXIT CODE 2 1

    Test Case 5 is where the difference is apparent. Basically CMD is silent where TCC issues an error. I think it's actually a bug in CMD. Adding the ELSE seemed to change the behavior which is why I wrote cases 1 and 5.

    But like I said in my original post, it's pretty minor.

    Ron
     
  4. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,729
    Likes Received:
    80
    Not sure exactly what you want here ...

    #5 is definitely a syntax error. (You cannot embed the leading '(' of a command group inside another argument.)

    Do you want TCC to fail to process the line and also fail to report an error (like CMD is doing)? And if so, what benefit would that provide?
     

Share This Page