To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cad.dev.macOpen lugnet.cad.dev.mac in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / Development / Macintosh / 897
896  |  898
Subject: 
Thoughts sought on final newlines
Newsgroups: 
lugnet.cad.dev, lugnet.cad.dev.mac
Date: 
Fri, 19 Oct 2007 12:14:35 GMT
Viewed: 
43 times
  
A recent discussion lead me to observe that Bricksmith saves models without a final newline (ie, CRLF - no “line ending”):

  
   I tried the script out in Windows using cygwin, and it seems to work. Some observations:
  • Until prel3p 1.3 is released by Jim, I can’t be sure it works.

It does. It would work with Bricksmith’s step export, too, if Bricksmith included a final newline in its exported files. Until then, it’s easy enough to add newlines manually or with your favorite editor’s multi-file search & replace tool.

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 didn’t 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. I’m 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 doesn’t specify anything about line endings in general, either (nevertheless, aren’t 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. I’m just curious about compatibility and consistency.

Jim



Message has 3 Replies:
  Re: Thoughts sought on final newlines
 
(...) We had a discussion about this item some times ago. I can not find the thread right now. The conclusion was: The user should not mind about that, the programer should. So if you write a prog for LDraw compatible files, you should check for (...) (17 years ago, 20-Oct-07, to lugnet.cad.dev, lugnet.cad.dev.mac, FTX)
  Re: Thoughts sought on final newlines
 
(...) FWIW I'm 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. It's just common courtesy. After all, we have no control over third party (...) (17 years ago, 20-Oct-07, to lugnet.cad.dev, lugnet.cad.dev.mac, FTX)
  Re: Thoughts sought on final newlines
 
(...) I agree fully on this. A text line is not complete until you have specified the end of it (with EOLN). A LDRAW model consists of text lines, and should IMO end with EOLN. Windows expects 'text' files to end with EOLN, and mistreats them if (...) (17 years ago, 20-Oct-07, to lugnet.cad.dev, lugnet.cad.dev.mac)

5 Messages in This Thread:



Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR