From mail at joeconway.com  Wed Jun 20 18:57:48 2007
From: mail at joeconway.com (Joe Conway)
Date: Wed, 20 Jun 2007 09:57:48 -0700
Subject: [Rd] clients and carriage returns
Message-ID: <46795C8C.8080304@joeconway.com>

I've recently ported PL/R (R embedded in Postgres as a procedural 
language) to work on Win32 -- thank you to all involved for making the 
embedded interface common between *nix and Win32!

This of course means users are now creating PL/R functions using Win32 
based editors, which are using \r\n for EOL. I had not realized this 
before, but R throws a parse error when it sees \r, even on a Win32 OS. 
Near as I can tell browsing R source, this is true on all operating 
systems -- e.g. gram.y seems to look only for \n, and in 
src/gnuwin32/graphapp/events.c:handle_char(), \r is actively replaced 
with \n. I didn't find any specific mention of EOL/newline in "Writing R 
Extensions", and only reference to related escape sequences in "R 
Language Definition".

My questions:
- Is it safe (and indeed proper) for PL/R to always convert \r\n to
   \n prior to invoking the R parser?
- Should the same be done for \r to \n (e.g. on OS X)?
- Any other considerations I should care for?

Thanks,

Joe



[Rd] clients and carriage returns
Joe Conway