To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cad.devOpen lugnet.cad.dev in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / Development / 10696
10695  |  10697
Subject: 
Re: Thoughts sought on final newlines
Newsgroups: 
lugnet.cad.dev, lugnet.cad.dev.mac
Date: 
Sat, 20 Oct 2007 12:16:35 GMT
Viewed: 
8803 times
  
Jim DeVona wrote:
; "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."

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 they
don't (see below). If the LDRAW standard says anything about 'Windows text
file' it also indirectly says 'needs EOLN after every line, including the
last'.

On Windows the concatenation is done with COPY which has two modes -
ASCII/BINARY.

The text file copy operation, "COPY /A T1.TXT+T2.TXT TSum.TXT", inserts
extraneous NUL chars at the concatenation point if the first file doesn't
end in EOLN (but works as expected if it ends with EOLN). This more or less
invalidates the file as a standard text file. No *extra* EOLN is inserted
though, so if NUL is filtered out, the result agrees with 'cat'.

The binary copy operation, "COPY /B t1.txt+t2.txt tsum.txt", works exactly
like 'cat'. Nothing is inserted that isn't in the files.

--
Anders Isaksson, Sweden
BlockCAD:  http://web.telia.com/~u16122508/proglego.htm
Gallery:   http://web.telia.com/~u16122508/gallery/index.htm



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
    

Custom Search

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