[fpc-pascal] Resource compilation

Martok listbox at martoks-place.de
Sun Jan 13 18:38:41 CET 2019

Update time!


>  - UnicodeString Strings (L"foo")Done

>  - various forms of escape sequences for strings

>  - Concatenated adjacent strings ("ABC" "DEF")
This is weird: windres, brcc and rc all do something different when
concatenating mixed Unicode and CP strings, as in `L"a" "b"`, `"a" L"b"`.
I have no idea what the correct action would be.

Probably going to leave out the Dialog-Related stuff, since it's not super
relevant for us anyway. Windows users can just use RC ;-)

> It's also leaking memory like a rusty bucket, I have so far completely ignored
> what transfers object ownership in fcl-res classes. Heaptrc will hopefully help
> here.

All of windres's tests pass now, except for the Dialog related ones. I would
consider it more or less finished. Any more things to do? Otherwise, I'll stack
it into some patches.

A few lessons learned:
Using TStringList as a key-value-store (#define) is SLOW. Replacing it with a
TFPStringHashTable brought processing time for windows.h down from 4 seconds to
some 10ms. That's just insert operations.

Codepage Strings are weird if more than one CP is involved. There is almost no
way to carry a specific codepage anywhere: AnsiString[850] + Char =
AnsiString[CP_UTF8]... Also, ShortStrings are often converted to AnsiStrings, so
that doesn't reliably work either. Same for array of char. That made working
with plex awfully complicated, and I still think it's wrong in some cases. But
at least it works for most now.

Having a reentrant version of plex&pyacc would be nice. Flex and Bison can do it
these days.

To a lesser degree: something like Python's argparse would be nice. Everyone
builds their own argument parser, usually with very different concepts and
varying amounts of code duplication.


More information about the fpc-pascal mailing list