[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
Sat Jul 6 02:04:07 CEST 2019


On Fri, Jul 5, 2019 at 7:49 PM Ryan Joseph <genericptr at gmail.com> wrote:

> Do you mean this? I still get an error without H+.
>
> {$mode objfpc}
>
> program test;
>
> 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;
>       }
>     }
>   }`;
>

Copy and paste this exact code into a file called test.pas:

{$mode objfpc}
{ explicitly set H- ! }
{$H-}

program test;

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;
      }
    }
  }`;

begin
  WriteLn(lines);
end.

With a build of my fork of the compiler as uploaded, compiling it with
simply "fpc ./test.pas" works without issues,  and it runs like you'd
expect.

If that somehow is not the case for you, what is the *exact* error you're
getting?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20190705/a07e1cb7/attachment.html>


More information about the fpc-devel mailing list