[fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

Ben Grasset operator97 at gmail.com
Fri Jul 5 22:30:23 CEST 2019


On Fri, Jul 5, 2019 at 1:41 PM Ryan Joseph <genericptr at 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.

Does something like the following not work for you:

program Example;

{$push}
{$H+}
const ReallyLongConstant = `
imagine
this
was
really
long
`;
{$pop}

var Short: String;

begin
  WriteLn(GetTypeKind(ReallyLongConstant));
  WriteLn(GetTypeKind(Short));
end.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20190705/436a818d/attachment.html>


More information about the fpc-devel mailing list