Welcome!

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

SignUp Now!

How to? Missing closing quote: What am I doing wrong????

May
855
0
I apologize in advance if this is a stupid question because it probably is. But this used to work (and still works in the following standalone piece of code), and I can't figure out what I could have done (wrong!) to get these symptoms. So here's the code that works:
Code:
@Echo Off
SetLocal
On Error
Gosub DM 26 ":Original Line Count: %LC"
EndLocal
Quit 0
:DM [DMTCAOSTDERR Line0]
   @Echo ************* DMTCAOSTDERR: %DMTCAOSTDERR *************
   @Echo ******************** Line0: %Line0 ********************
   Set CM=%@UnQuoteS[%Line0]
   @Echo %%CM: %CM
   @Echo %%@Left[1,%%CM]: $%@Left[1,%CM]$
   Iff "%@Left[1,%CM]" == ":" Then
      @Echo It's a colon!!!
   EndIff
   Return
And here's what happens when I execute this code:
Code:
[Z:\]SampleThatWorks
************* 26 *************
**************** ":Original Line Count: " *****************
%Line0: ":Original Line Count: "
%CM: :Original Line Count:
%@Left[1,%CM]: $:$
It's a colon!!!
Exactly as one would expect!

So here's the code (that doesn't work) in the "real" .btm file:
Code:
@Echo Off
SetLocal
On Break Goto NormalExit
...
:NormalExit
   @Echo Gosub DM 26 ":Original Line Count: %LC"
   Gosub DM 26 ":Original Line Count: %LC"
   EndLocal
   Quit 0
...
:DM [DMTCAOSTDERR Line0]
   @Echo ************* DMTCAOSTDERR: %DMTCAOSTDERR *************
   @Echo ******************** Line0: %Line0 ********************
   Set CM=%@UnQuoteS[%Line0]
   @Echo %%CM: %CM
   @Echo %%@Left[1,%%CM]: $%@Left[1,%CM]$
   Iff "%@Left[1,%CM]" == ":" Then
      @Echo It's a colon!!!
   EndIff
   Return
Exactly the same as the previous except for the "On Break Goto".

And here's the results of running that code:
Code:
[Z:\]ExcludeLines 
^C
Gosub DM 26 ":Original Line Count: 1"
************* DMTCAOSTDERR: 26 *************
******************** Line0: ":Original ********************
%CM: ":Original
%@Left[1,%CM]: $"$
As you can rather quickly see, of course, the input argument contains the opening quote and is truncated at the first blank which, of course, "leaves" out the closing double quote, which causes the code not to work further down (either the first character of %DM is a double quote and not a colon or even a "hard" error depending on exactly what I am trying to do) in code that is making a a comparison to "%CM") in the "real' DM subroutine.

And if you are wondering about the use of the "Iff/EndIff" rather than just a plain old "If", that's because of another peculiarity that could very well be related: If I use an "If" the second .btm file ("ExcludeLines ") always echos "It's a colon!!!", whereas the "Iff' prevents that behavior (why???) and it is in both .btm files so that there can be no doubt as to whether or not that has anything to do with why the first works and the second does not.

Now I'm not including "ExcludeLines.btm" at the moment because it is quite long (713 lines as of this moment) and I'm about 95% sure somebody can tell me what line of code is in there (now?) that that is causing this to happen. (It used to work fine.)

As always, thank you in advance.

- Dan
 
I tried a very slight variation on your code and it worked OK. Below, I pressed Ctrl-C during the DELAY.
Code:
v:\> type test.btm
@Echo Off
SetLocal
On Break Goto NormalExit
set lc=10
delay 10
quit
 
:NormalExit
  @Echo Gosub DM 26 ":Original Line Count: %LC"
  Gosub DM 26 ":Original Line Count: %LC"
  EndLocal
  Quit 0
 
:DM [DMTCAOSTDERR Line0]
  @Echo ************* DMTCAOSTDERR: %DMTCAOSTDERR *************
  @Echo ******************** Line0: %Line0 ********************
  Set CM=%@UnQuoteS[%Line0]
  @Echo %%CM: %CM
  @Echo %%@Left[1,%%CM]: $%@Left[1,%CM]$
  Iff "%@Left[1,%CM]" == ":" Then
      @Echo It's a colon!!!
  EndIff
  Return
 
 
v:\> test.btm
^C
Gosub DM 26 ":Original Line Count: 10"
************* DMTCAOSTDERR: 26 *************
******************** Line0: ":Original Line Count: 10" ********************
%CM: :Original Line Count: 10
%@Left[1,%CM]: $:$
It's a colon!!!
 
When there was MS-DOS there was 4DOS, from JPSoft, a popular alternative to MS-DOS's command interpreter (command.com). 4DOS evolved into 4NT. 4NT evolved into TCC (today's product). As Joe Caverly said, the programming language is a much-enhanced version of the batch language of 30+ years ago.
 
Back
Top
[FOX] Ultimate Translator
Translate