Constant command

Richard Gaskin ambassador at fourthworld.com
Thu Oct 14 19:19:38 EDT 2010


Bob Sneidar wrote:

 > Wha??? That just makes no sense at all! A CR should be chr(13) and
 > LF should be chr(10). Period. If in Revolution it is not, then I
 > need to go back and edit a whole lot of scripts!

If those scripts are working do they need revision?

Here's the deal:

Rev's use of the CR constant is borrowed from HyperCard, but was written 
for a different OS.  Rev was born on Unix, where line endings are ASCII 
10, but HC was born on Mac Classic, where line endings were ASCII 13. 
So to allow HC scripts to run in MC, Raney simply mapped the constant to 
its functional equivalent on Unix.

Internally, the engine uses ASCII 10 line endings, so the only time any 
change in line endings is relevant is when reading and writing files.

But even there it's often a non-issue, since unless you open a file in 
binary mode the engine will automatically translate line endings to or 
from whatever's appropriate on the host system running at the time.

And even then, it's less and less of an issue because OS X itself change 
the line ending used in most apps to ASCII 10 some time ago, so today 
there are relatively few files lying around that use the old 
"typewriter" character (I wonder how many people these days have even 
seen a physical carriage? <g>).

Maybe this is why it only occurs to you to consider revising code after 
reading something on this list:  Maybe the code actually runs just fine 
as it is. :)

--
  Richard Gaskin
  Fourth World
  LiveCode training and consulting: http://www.fourthworld.com
  Webzine for LiveCode developers: http://www.LiveCodeJournal.com
  LiveCode Journal blog: http://LiveCodejournal.com/blog.irv



More information about the Use-livecode mailing list