Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!samsung!noose.ecn.purdue.edu!mentor.cc.purdue.edu!seaman.cc.purdue.edu!ags From: ags@seaman.cc.purdue.edu (Dave Seaman) Newsgroups: comp.sys.mac.programmer Subject: Re: Readln in THINK Pascal; (really--what's the space for?) Summary: THINK is correct Keywords: eoln, space Message-ID: <5814@mentor.cc.purdue.edu> Date: 13 Feb 91 20:04:43 GMT References: <1991Feb12.100618.4840@cc.helsinki.fi> <5710@husc6.harvard.edu> <18704@brahms.udel.edu> Sender: news@mentor.cc.purdue.edu Reply-To: ags@seaman.cc.purdue.edu (Dave Seaman) Organization: Purdue University Lines: 32 In article <18704@brahms.udel.edu> mchupa@brahms.udel.edu (Michael A Chupa) writes: >A related topic that comes up very often in my HS programming classes is >Think Pascal's handling of CR's in text files. For example, if eoln(f) is >true, then the effect of doing a read(f,ch) is that ch = ' ', instead of >ch = chr(13) (ascii CR). I'm curious as to why this handling of returns was >done--it is the (absolutely!) only thing I prefer Turbo 1.1 over Think on! >Mike A CR in a Macintosh text file is the Macintosh way of representing an end-of-line character. The Pascal standard requires implementations to treat end-of-line characters as indistinguishable from blanks, except by the required function EOLN and the required procedures RESET, WRITELN and PAGE. Therefore, the THINK implementation is correct and Turbo is wrong. Why was it done that way? It's a long story. I can remember a very early version of Pascal on a CDC 6600 which actually treated EOL as a reserved token and allowed you to do things like WRITE('THIS IS A LINE OF TEXT',EOL,'AND THIS IS ANOTHER LINE.'); (this is all uppercase because everything was in CDC display code) but this led to all kinds of problems because, on a CDC 6600, there really was no such thing as an end-of-line character, which led to all sorts of implementation problems. Therefore, in a very early revision of the language, the EOL token was dropped and the EOLN function and WRITELN and READLN procedures were introduced. All of this was before the first edition of Jensen & Wirth's _Pascal_User_Manual_and_Report_ ever hit the streets. -- Dave Seaman ags@seaman.cc.purdue.edu