On Fri, Jul 5, 2019 at 6:41 PM Sven Barth via fpc-devel < fpc-devel@lists.freepascal.org> wrote:
> 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 > {$H+} is definitely not needed for an explicit 'var string: ansistring'. It works even with {$H-}. 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. That said, writing the following *does* work: program test; {$push} {$mode objfpc} {$H+} const lines = ` #version 150 uniform sampler2D textures[8]; in vec2 vertexTexCoord; in vec4 vertexColor; in float vertexUVMap; out vec4 fragColor; void main() { if (vertexUVMap == 255) { fragColor = vertexColor; } else { fragColor = texture(textures[int(vertexUVMap)], vertexTexCoord.st); if (vertexColor.a < fragColor.a) { fragColor.a = vertexColor.a; } } }`; {$pop} begin writeln(lines); end. 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. On Fri, Jul 5, 2019 at 6:41 PM Sven Barth via fpc-devel < fpc-devel@lists.freepascal.org> wrote: > Am 05.07.2019 um 22:30 schrieb Ben Grasset: > > > > On Fri, Jul 5, 2019 at 1:41 PM Ryan Joseph <generic...@gmail.com> wrote: > >> This doesn’t work either. >> >> {$push} >> {$h+} >> var lines: ansistring = ` >> #version 150 >> >> uniform sampler2D textures[8]; >> in vec2 vertexTexCoord; >> in vec4 vertexColor; >> in float vertexUVMap; >> out vec4 fragColor; >> >> void main() >> { >> if (vertexUVMap == 255) { >> fragColor = vertexColor; >> } else { >> fragColor = texture(textures[int(vertexUVMap)], vertexTexCoord.st); >> if (vertexColor.a < fragColor.a) { >> fragColor.a = vertexColor.a; >> } >> } >> }`; >> {$pop} >> >> Regards, >> Ryan Joseph >> > > Doesn't work in what regard? You wouldn't even need {$H+} there, as you're > explicitly using an ansistring. > > 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. > > Regards, > Sven > _______________________________________________ > fpc-devel maillist - fpc-devel@lists.freepascal.org > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel >
_______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel