Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tlug] 68k Assembler, Regexes and EOL, oh my! (was: CJK Printing...)



On 04/11/06, Godwin Stewart <godwin.stewart@example.com> wrote:

On Sat, 4 Nov 2006 19:23:28 +0900, "Josh Glover" <jmglov@example.com>
wrote:

> but newline conventions don't matter terribly much when issuing
> instructions to a CPU. :)

True. But is does matter when you code low-level I/O routines that read
stuff from disks, serial ports etc.

Yeah, I've never done that kind of stuff in assembly. All of my 68k stuff was "Lunar Lander" and "Asteroids" clones. :)

I've written OS code in C++, as part of the NachOS framework:

http://www.cs.washington.edu/homes/tom/nachos/

> Which is why I am happy that regex engines provide ^ and $

So, they automagically recognize the line-end convention, then?

They try. :)

To be fair, they pretty much succeed. PCREs have some mumbo-jumbo flag
that allows you to adjust what $ matches, IIRC, and of course the 'm'
flag turns $ into EOF, not EOL.

While I think of it, MacOS-X is Unix-based but Mac nonetheless. What's
the EOL for that system?

SJT can provide (I hope) the authoritative answer, but I would expect the answer is, "it varies". :)

Seriously, Unix handles DOS-style (and probably Mac-style, but
frankly, I have not seen plain '\r' in my life as a Unix hacker, so I
dunno) newlines just fine, all the time. After all, every userland
program is potentially left to fend for itself when it comes to line
processing, and GNU readline has to be smart enough to handle "\r\n",
since many Internet protocols (e.g. HTTP, SMTP, et al.) use that as
EOL. And the Linux kernel should not care most of the time, and when
it must (for example, when doing TTY or optimised disk reads), it has
to handle both, because you could have a DOS-style file or maybe (who
knows) a keyboard that sends "\r\n" when you hit "Enter".

Cheers,
Josh


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links