<div dir="ltr"><div dir="ltr">On Fri, Jul 5, 2019 at 6:41 PM Sven Barth via fpc-devel <<a href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">
<div class="gmail-m_-25117672859905927moz-cite-prefix">The constant itself is parsed depending on the state of $H and only
then "assigned" to the constant (just tested that myself). So the
directives are needed to get the correct string type of the
constant<br></div></div></blockquote><div><br></div><div>{$H+} is definitely not needed for an explicit 'var string: ansistring'. It works even with {$H-}.</div><div><br>After looking at Ryan's more complete example though, the use of {$mode SomeLanguageMode} *before* pushing {$H+} does seem to make {$H+} not recognized. I do not believe that this behaviour is related to any code I've added so far, however, as I don't see how it possibly could be. Seems like a bug that nobody came across before.<br></div><div><br></div><div>That said, writing the following *does* work:</div><div><br></div><div>program test;<br><br>{$push}<br>{$mode objfpc}<br>{$H+}<br><br>const lines = `<br> #version 150<br><br> uniform sampler2D textures[8];<br> in vec2 vertexTexCoord;<br> in vec4 vertexColor;<br> in float vertexUVMap;<br> out vec4 fragColor;<br><br> void main()<br> {<br> if (vertexUVMap == 255) {<br> fragColor = vertexColor;<br> } else {<br> fragColor = texture(textures[int(vertexUVMap)], vertexTexCoord.st);<br> if (vertexColor.a < fragColor.a) {<br> fragColor.a = vertexColor.a;<br> }<br> }<br> }`;<br>{$pop}<br><br>begin<br> writeln(lines);<br>end.</div><div><br></div><div>I'm still very unclear about where Ryan said he got "illegal expression" and such, though. I just now tested another large number of possible ways you can use multi-line strings, and they all do work.</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jul 5, 2019 at 6:41 PM Sven Barth via fpc-devel <<a href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">
<div class="gmail-m_-25117672859905927moz-cite-prefix">Am 05.07.2019 um 22:30 schrieb Ben
Grasset:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div dir="ltr"><br>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Fri, Jul 5, 2019 at 1:41
PM Ryan Joseph <<a href="mailto:genericptr@gmail.com" target="_blank">genericptr@gmail.com</a>> wrote:</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
This doesn’t work either.<br>
<br>
{$push}<br>
{$h+}<br>
var lines: ansistring = `<br>
#version 150<br>
<br>
uniform sampler2D textures[8];<br>
in vec2 vertexTexCoord;<br>
in vec4 vertexColor;<br>
in float vertexUVMap;<br>
out vec4 fragColor;<br>
<br>
void main()<br>
{<br>
if (vertexUVMap == 255) {<br>
fragColor = vertexColor;<br>
} else {<br>
fragColor = texture(textures[int(vertexUVMap)],
vertexTexCoord.st);<br>
if (vertexColor.a < fragColor.a) {<br>
fragColor.a = vertexColor.a;<br>
}<br>
}<br>
}`;<br>
{$pop}<br>
<br>
Regards,<br>
Ryan Joseph<br>
</blockquote>
<div><br>
</div>
<div>Doesn't work in what regard? You wouldn't even need {$H+}
there, as you're explicitly using an ansistring.</div>
</div>
</div>
</blockquote>
The constant itself is parsed depending on the state of $H and only
then "assigned" to the constant (just tested that myself). So the
directives are needed to get the correct string type of the
constant.<br>
<br>
Regards,<br>
Sven<br>
</div>
_______________________________________________<br>
fpc-devel maillist - <a href="mailto:fpc-devel@lists.freepascal.org" target="_blank">fpc-devel@lists.freepascal.org</a><br>
<a href="https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel" rel="noreferrer" target="_blank">https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a><br>
</blockquote></div>