Re: [BLACKBOX] Control codes CR and LF

From: [at]} <Robert>
Date: Mon, 21 Feb 2011 22:42:46 +0000

----boundary-LibPST-iamunique-806457298_-_-
Content-type: text/plain

Folks: some ideas - probably not all correct!


I don't know what a 'Reverse Tabulator Key' is, but the main points seem to me
to be:

1 - BlackBox only uses the 3 control codes: tab (09X), line (0DX), & para (0EX)
in Texts (TextModels.Model).

2 - These ideas are represented differently in Files, and the Converters do the
necessary translations on reading & writing.

3 - These ideas are probably represented differently in files on different
operating systems.

4 - There does not seem to be a clear & consistent definition of how to
represent these ideas in Windows. Different programs (eg Word, Wordpad, Notepad,
TextPad seem to do different things.

5 - I have written a Module (LibAsciiMappers) for reading Windows Ascii files.
The decision I took (experiments indicated that it was not as bad a decision as
some alternatives) was:

"The end-of-line markers accepted are CR (carriage return = 0DX), LF (line feed
= 0AX), or CR immediately followed by LF.
(LF immediately followed by CR is interpreted as two end-of-line markers.)"

This seemed to give the best compatibility with other programs, but exact
compatiblity is impossible because they are not self consistent.

6 - (A pretty wild guess) The most common Windows line separator is CR + LF?


Cheers

Robert.



On 21/02/2011 05:57 PM, Manuel Martín Sánchez wrote:
> To represent a line jump in a file:
>
> * *Unix* and *MacOS X*: the byte *0A* (hexadecimal number 0A, decimal 10,
> *LF*, Line Feed).
> * *MacOS 9*: the byte *0D* (hexadecimal number 0D, decimal 13, *CR*,

> Carriage Return).
> * *Windows*: the byte *0D* followed by the byte *0A*, that is *CR*+*LF*..
>
>
> I have been experimenting:
>
> PROCEDURE WriteSmallFile*;
> CONST fileName = "MyFile_CRLF.txt";
> VAR l: Files.Locator;
> f: Files.File;
> w: Files.Writer;
> res: INTEGER;
> BEGIN
> l := Files.dir.This("Priv");
> ASSERT(l.res = 0, 20);
> f := Files.dir.New(l, Files.dontAsk);
> ASSERT(l.res = 0, 21);
> w := f.NewWriter(NIL);
> w.WriteByte(61H); (* ascii "a" *)
> w.WriteByte(62H); (* ascii "b" *)
> w.WriteByte(0DH); (* ascii 13 CR *)
> w.WriteByte(0AH); (* ascii 10 LF *)
> w..WriteByte(63H); (* ascii "c" *)
> f.Flush;
> f.Register(fileName, "", Files.ask, res);
> ASSERT(res = 0, 22);
> END WriteSmallFile;
>
> I have wrote 0D only (CR), 0A only (LF), and both 0D and 0A (CR+LF). I have
> found that it is always interpreted like a line jump, both by the BB editor and
> the Notepad++.
>
> I have also noted the following:
>
> * When you are in the BB editor editing a file, and you hit the Return key,

> then that hit is translated onto a 0D byte (CR). So the .odc files use the
> CR to represent a line jump, like the files of MacOS 9.
>
>
> * The procedure "TextMappers.Formatter.*WriteLn*" inserts the two bytes CR

> and LF (I am using WindowsOS). At least that is what is seen in the file
> generated, although I think it is due to the converter
> (HostTextConv.ImportText) that is used to make persistent the file.
>
>
> PROCEDURE WriteSmallFileUsingAbstractions*;
> CONST fileName = "MyFile.txt";
> VAR loc: Files.Locator;
> frmter: TextMappers.Formatter;
> v: TextViews.View;
> BEGIN
> frmter.ConnectTo(TextModels.dir.New());
> frmter.WriteString("First line");
> frmter.*WriteLn*; (* CR+LF under Windows OS *)
> frmter.WriteString("Second line");
> loc := Files.dir.This("Priv");
> ASSERT(loc.res = 0, 20);
>
> v := TextViews.dir.New(frmter.rider.Base());
> Converters.Export(loc, fileName, conv, v);
> ASSERT(loc.res = 0, 21);
> END WriteSmallFileUsingAbstractions;
> BEGIN (* module *)
> conv := Converters.list;
> WHILE (conv # NIL) & (conv.imp # "HostTextConv.ImportText") DO conv := conv.next END
>
>
> So far so good, but the documentation of BB 1..5 (Caracter Set - Control codes
> used in Black Box) says:
> 0AX ltab reverse tabulator key
> 0DX line return key
>
> I am confused about the fact that the hexadecimal number 0A is the "reverse
> tabulator key". Does somebody know what does this mean?
>
> Thanks,
> Manuel
>
> --------------------------------------------------------------------------------
>
> No virus found in this message.
> Checked by AVG - www.avg.com <http://www.avg.com>
> Version: 10.0.1204 / Virus Database: 1435/3457 - Release Date: 02/21/11
>
> ---- To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to
> LISTSERV{([at]})nowhere.xy
>


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-806457298_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzc1xmY2hhcnNldDAgQXJpYWw7fQ0Ke1xmMVxmbW9kZXJuIENvdXJpZXIgTmV3O30NCntcZjJc
Zm5pbFxmY2hhcnNldDIgU3ltYm9sO30NCntcZjNcZm1vZGVyblxmY2hhcnNldDAgQ291cmllciBO
ZXc7fX0NCntcY29sb3J0YmxccmVkMFxncmVlbjBcYmx1ZTA7XHJlZDBcZ3JlZW4wXGJsdWUyNTU7
fQ0KXHVjMVxwYXJkXHBsYWluXGRlZnRhYjM2MCBcZjBcZnMyMCBGb2xrczogc29tZSBpZGVhcyAt
IHByb2JhYmx5IG5vdCBhbGwgY29ycmVjdCFccGFyDQpccGFyDQpccGFyDQpJIGRvbid0IGtub3cg
d2hhdCBhICdSZXZlcnNlIFRhYnVsYXRvciBLZXknIGlzLCBidXQgdGhlIG1haW4gcG9pbnRzIHNl
ZW0gdG8gbWUgXHBhcg0KdG8gYmU6XHBhcg0KXHBhcg0KMSAtIEJsYWNrQm94IG9ubHkgdXNlcyB0
aGUgMyBjb250cm9sIGNvZGVzOiB0YWIgKDA5WCksIGxpbmUgKDBEWCksICYgcGFyYSAoMEVYKSBc
cGFyDQppbiBUZXh0cyAoVGV4dE1vZGVscy5Nb2RlbCkuXHBhcg0KXHBhcg0KMiAtIFRoZXNlIGlk
ZWFzIGFyZSByZXByZXNlbnRlZCBkaWZmZXJlbnRseSBpbiBGaWxlcywgYW5kIHRoZSBDb252ZXJ0
ZXJzIGRvIHRoZSBccGFyDQpuZWNlc3NhcnkgdHJhbnNsYXRpb25zIG9uIHJlYWRpbmcgJiB3c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SVNUUy5PfX0AVa8XVrlX31jsfWFw
----boundary-LibPST-iamunique-806457298_-_---
Received on Mon Feb 21 2011 - 23:42:46 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:30:18 UTC