|
In lugnet.cad.dev, Jim DeVona wrote:
|
A recent discussion lead me to
observe that Bricksmith saves models without a final newline (ie, CRLF - no
line ending):
Since one line that ended differently from others lead to complications here,
I wondered if it might elsewhere. I asked Allen if there was a reason that
Bricksmith didnt end the file with a newline. To clarify the perceived
problem, I offered this example:
if I append model B to model A, my expectation is that the result, model C, will be a valid model comprised of the parts from model A followed by the parts from model B. However, if model A does not conclude with a newline, the idiomatic
cat modelA.ldr modelB.ldr > modelC.ldr
will yield a malformed model C; the last line of A and the first line of B appear on the same line with no separation. cat has performed its duty diligently, but the literal concatenation of these files does not match the conceptual concatenation of models comprised of lines with discrete structure.
In response, Allen suggested that I pose the question here:
But I still think you should ask the people on lugnet.cad who know better, or can pontificate louder. Im curious what they say.
So, then, what do you say? Are there any good reasons for LDraw files to end
with a line ending? The spec is
silent, but it doesnt specify anything about line endings in general, either
(nevertheless, arent DOS CRLF line endings conventional?). Do other editors
like ldglite, LeoCAD, MLCad, or LDraw itself save files with final newlines?
Note: this is not about whether or not final newlines are better than files
without final newlines. Im just curious about compatibility and consistency.
|
FWIW Im pretty sure ldglite saves with a newline (of some sort) after
every line. And my opinion is that all programs that *create* ldraw
data should do that. Its just common courtesy. After all, we have no
control over third party processing tools (like the unix cat tool)
which might require it. In fact Ive seen C compilers barf when they
dont get that last linefeed. So Id recommend fixing BrickSmith to save
the models with a final linefeed.
That said, any program we make that *reads* ldraw data should be written
to accept different types of line feeds, including a missing one at the
end of the file.
Have fun,
Don
|
|
Message is in Reply To:
| | Thoughts sought on final newlines
|
| A (URL) recent discussion> lead me to observe that Bricksmith saves models without a final newline (ie, CRLF - no "line ending"): (...) Since one line that ended differently from others lead to complications here, I wondered if it might elsewhere. I (...) (17 years ago, 19-Oct-07, to lugnet.cad.dev, lugnet.cad.dev.mac, FTX)
|
5 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|