Fw: Feature request: recognize the line break in multi line string
I forgot to reply all.
Begin forwarded message:
Date: Mon, 14 Sep 2015 12:19:29 -0500
From: "G. Wade Johnson" <[hidden email]>
To: Jerry Davis <[hidden email]>
Subject: Re: [OpenSCAD] Feature request: recognize the line break in
multi line string
On Mon, 14 Sep 2015 06:21:33 -0700
Jerry Davis <[hidden email]> wrote:
> I thought in most projects, the \n did the right thing DEPENDING UPON
> the platform it was running on.
> So if you are on windows, \n becomes technically a \r\n, on mac and
> linux, just \n.
> \r shouldn't even be in there, IMO.
Whichever tool you are working with normally handles line endings
correctly for the platform they are on (modulo little issues like
Windows text/binary modes).
The problem comes when you get files from a different system...
Some tools can handle the variations, and we are talking about adding
that feature to OpenSCAD. It isn't really as much of a problem in the
whitespace, but when a newline occur in a string, more thought is
Just my 0.02.
> Extra Ham Operator: K7AZJ
> Registered Linux User: 275424
> Raspberry Pi and Arduino developer
> *The most exciting phrase to hear in science - the one that heralds
> new discoveries - is not "Eureka!" but "That's funny...".*- Isaac.
> *f you give someone a program, you will frustrate them for a day; if
> you teach them how to program, you will frustrate them for a
> lifetime. *- Anonymous
> *If writing good code requires very little comments, then writing
> really excellent code requires no comments at all!*- Ken Thompson
> On Mon, Sep 14, 2015 at 3:13 AM, Alan Cox <[hidden email]>
> > On Sun, 13 Sep 2015 20:22:19 -0500
> > "G. Wade Johnson" <[hidden email]> wrote:
> > > On Sun, 13 Sep 2015 19:49:53 -0400
> > > doug moen <[hidden email]> wrote:
> > >
> > > > Alan Cox said "There are systems that just use \r."
> > > >
> > > > Not any more, and not for a long time. Apple dropped support
> > > > for Mac OS 9 in 2002, and OpenSCAD seems to have started in
> > > > 2009. Xt has also never supported MacOS 9. You've never been
> > > > able to create a text file with \r line separators on any
> > > > system that supports OpenSCAD, and those systems likely only
> > > > exist in computer museums nowadays.
> > >
> > > Less than a month ago, I got an example data file from a company
> > > that was using \r as a line separator. I don't know for sure
> > > where they got it. (Of course a quick one-liner converted it to
> > > something reasonable for me.)
> > >
> > > Until that time, I believed that you were correct. Now, I'm not
> > > sure I would discount Alan's comment so quickly.
> > Ignoring the \r isn't the way to do it. The logic is trivial to do
> > it right
> > \r\n -> one newline
> > else
> > \r -> one newline
> > else
> > \n -> one newline
> > else
> > literal character
> > Alan
> > _______________________________________________
> > OpenSCAD mailing list
> > [hidden email] > > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >
There will always be things we wish to say in our programs that in all
known languages can only be said poorly. -- Alan Perlis
If there's no problem, there's no solution. -- Rick Hoselton