<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>I have to admit first, that I did not read all the comments in
this thread. But anyway, <br>
I'd like to comment on this. Because I have done Pascal
programming for almost 40 years <br>
now and even on platforms that are much older than PCs and
machines typically run <br>
by Unix systems, I have a somehow different view. <br>
</p>
<p>First of all, there is a good reason why Pascal has a WRITELN
procedure; <br>
because there are platforms where it is simply not possible to
write a special <br>
character like 0x0a to flush an output buffer and start a new
output line. <br>
On old scientific computers of the 1960s and 1970s, there simply
was no such character; <br>
this comes from the teletype heritage of the Unix operating
system. Even today there<br>
are platforms (and languages) where it is not possible to write a
new line on output <br>
simply by writing a 0x0a char. Only people which have grown up
with systems like<br>
MS-DOS and Unix take this as given. <br>
<br>
So I doubt that there is a portable solution for multi-line
strings in the sense that <br>
strings involve carriage-return characters. If you need such
things, you have to find <br>
non-portable solutions (like platform-specific constants: <br>
CONST NL_Number = 0x0a; for example<br>
or CONST NL_CHAR = X'0a'; ... if your compiler allow such a
notation). <br>
</p>
<p>Second: <br>
</p>
<p>To split strings in source programs, I strongly suggest a
solution where the parts are <br>
terminated on every line; otherwise (with strings left open), you
will always have a <br>
problem with trailing and leading blanks. The source code should
be format free,<br>
after all. <br>
</p>
<p>The simplest solution IMO is: simply close the string on one line
and open it on the <br>
next one, like here: <br>
</p>
<p><tt>CONST long_string = 'this is a long string '<br>
'which occupies '<br>
'multiple source lines'; <br>
</tt></p>
<p>if you absolutely need to put line feed characters into such a
long string, do it like this: <br>
</p>
<p><tt>CONST long_string = 'this is a long string ' x'0a'<br>
'which occupies ' x'0a'<br>
'multiple source lines'; <br>
</tt></p>
<p>This is implemented in my New Stanford Pascal compiler. <br>
<br>
Kind regards <br>
</p>
<p>Bernd <br>
</p>
<p><br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">Am 04.07.2019 um 13:54 schrieb Michael
Van Canneyt:<br>
</div>
<blockquote type="cite"
cite="mid:alpine.DEB.2.21.1907041352420.8137@home">
<br>
<br>
On Thu, 4 Jul 2019, Tomas Hajny wrote:
<br>
<br>
<blockquote type="cite">On 2019-07-04 12:59, Marģers . via
fpc-devel wrote:
<br>
<br>
.
<br>
.
<br>
<blockquote type="cite">Why introduce ` if there already is ' ?
Just use '
<br>
as well for multi line strings. For people of more
<br>
conservative view point, put multilinestring
<br>
behind mode switch.
<br>
</blockquote>
<br>
Because then it's never clear whether the fact that there's no
ending quote before the end of the line is an omission, or an
intention.
<br>
</blockquote>
<br>
Exactly. The same goes for all other quote characters. That's why
the directive is a better approach; it is unambigious.
<br>
<br>
Michael.<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
fpc-devel maillist - <a class="moz-txt-link-abbreviated" href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel">https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a>
</pre>
</blockquote>
</body>
</html>