Subject:
|
Re: NQC 2.1 b2 in beta test
|
Newsgroups:
|
lugnet.robotics.rcx.nqc
|
Date:
|
Sat, 15 Jan 2000 00:56:02 GMT
|
Viewed:
|
1835 times
|
| |
| |
In article <387F57AD.4E340ADC@munich.netsurf.de>, Uwe Denzer
<Uwe.Denzer@munich.netsurf.de> wrote:
> Also, I don't think it is related to the parameters. I have now checked the exec
> call of RcxCC with a debugger and found this is the command line it sends:
> nqc -E"temp.log" -L"temp.lst" -I"C:\NQC\CC\" temp.nqc
>
> As far as I can see, nothing wrong with it, is it?
The answer isn't pretty....
As near as I can tell (sorry, not much of a Windows expert), the command
line gets passed in its entirety to the executable, which then is
responsible for parsing it into separate arguments. For the most part
this is done by the runtime library suppiled by the compiler vendor, and
thus you get a nice array of arguments passed to main().
I'm not sure about the official parsing rules. Running some tests with an
app built under MS Developer Studio I came up with the following
observations:
Normal processing:
* whitespace delimits args and is not included in them (obvious)
* A doublequote " begins "quoting" an argument
When "quoting"
* whitespace is part of the arg
* A doublequote when not preceeded by " or \ ends quoting
* Two adjacent doublequotes "" add a doublequote to the arg and end quoting
Here's the weird one...
In either mode (normal or quoting) a series of backslashes followed by a
double quote is special. If there are 2n backslashes, then its
interpreted as n backslashes and the quote has normal behavior (starting
or ending a quote).
If there are 2n+1 backslashes, then it is interpreted as n backslashes and
the quote becomes part of the arg (and the quoting state remains
unchanged)
If anyone knows the "official" rules here, please let me know.
------
Looking at the RcxCC exec call:
nqc -E"temp.log" -L"temp.lst" -I"C:\NQC\CC\" temp.nqc
becomes the following arguments (delimited by <>)
<nqc>
<-Etemp.log>
<-Ltemp.lst>
<-IC:\NQC\CC" temp.nqc>
Note that last arg - instead of the doublequote ending the arg, the
preceeding backslash "escapes" the quote.
The reason this used to work is that I don't use Developer Studio - I use
Metrowerks. And their runtime used to not do any escaping of quotes.
However, in their latest release (which has been used for the 2.1 betas)
they partially implemented the various escaping stuff.
Notice that I said "partially". They implemented enough to break the
RcxCC call, but not enough to be indentical to Dev Studio. Specifically,
they escape \" properly, but don't handle things like \\" or "" the
identically. This makes it pretty difficult to come up with a general
scheme for Mark to build a parseable command line that will still be
parsed by the Metrowerks runtime.
I think the right fix in the end is to have Mark generate an appropriately
escaped command string and I'll hack on the Metrowerks runtime to get it
to behave properly. (of course it would help if someone could define
"properly" beyond my empirical observations)
In shorter order, I can probably disable all escaping (essentially revert
to the old Metrowerks behavior) so that the next nqc build will work with
the current RcxCC.
Dave Baum
--
reply to: dbaum at enteract dot com
|
|
Message has 1 Reply: | | Re: NQC 2.1 b2 in beta test
|
| (...) Unfortunately, I don't know "official" rules nor did I find a place where to look them up. Nevertheless, I can only think that this whole escaping stuff is not compliant with normal, expected Win32 behavior. The backslash is the standard (...) (25 years ago, 16-Jan-00, to lugnet.robotics.rcx.nqc)
|
Message is in Reply To:
| | Re: NQC 2.1 b2 in beta test
|
| (...) The same problem was already present with the b1 (I had asked about it in this newsgroup but got no reply). Also, I don't think it is related to the parameters. I have now checked the exec call of RcxCC with a debugger and found this is the (...) (25 years ago, 14-Jan-00, to lugnet.robotics.rcx.nqc)
|
25 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|