There seems to be a bug in the parser when targeting ASM statements for a WIN32 target. I'm using Free Pascal Compiler version 1.0.2 [2000/10/12] for i386.
The parser does not properly handle literal strings inside assembler DB statements, when the strings contain brace characters. The compiler- generated code omits the braces and any characters between them.
Interestingly, this is not a problem for braces in strings elsewhere in the program, only for those in assembler DB statements.
For example, consider the code snippet which embeds a bit of PostScript code in an assembly-language segment:
begin
...
asm
...
db '/pop2 { pop pop } def',0;
...
end;This construct works correctly under Borland Pascal 7.0, where the resulting PostScript string is "/pop2 { pop pop } def". But under Free Pascal, the string is just "/pop2 def" which, obviously, causes the resulting PostScript to be invalid.
Below is the minimal compilable program that demonstrates this problem. Try it under Borland Pascal and then under Free Pascal to see the difference.
procedure SomePostScript; assembler;
asm
db '/pop2 { pop pop } def',0;
end;
begin
WriteLn(pchar(@SomePostScript));
end.Of course, I am aware that I could work around the bug by re-coding my statement as
db '/pop2 ',123,' pop pop ',125,' def',0;However, my point is not to ask for help in developing my application, but to alert you to a bug in the parser that should be fixed.
- Rich
