[fpc-pascal] Resource compilation

Martok listbox at martoks-place.de
Tue Aug 28 17:26:35 CEST 2018


Hi again,

a quick update: I have a somewhat-working version, but many things are still
missing.
We have: a preprocessor, full support for BITMAP, ICON, CURSOR, resource
attributes (LANGUAGE etc.), all RCDATA-like resources, including their
definition from inline literal statements.

What's missing:
 - UnicodeString Strings (L"foo")
 - various forms of escape sequences for strings
 - Concatenated adjacent strings ("ABC" "DEF")
 - numeric expressions (used for things like computing flags).
 - complex resources: ACCELERATORS DIALOG/EX MENU/EX STRINGTABLE VERSIONINFO

The first two are not that difficult, just awkward (as all encoding-aware
stringhandling is), adjacent strings are more of an issue: turns out this
creates a problem in the language:
    FOO BITMAP "900.bmp"
    "A NAME" TEXT BEGIN "A String" END
This can't parse right: the filename and resid get concatenated to "900.bmpA
NAME". While entirely correct, that's not very useful. I might leave that out
until someone needs it.
Of the complex resources, STRINGTABLE and VERSIONINFO are probably the more
important ones. Luckily, both already have resource types implemented, so that
shouldn't be too hard either.
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.

I only get to work on this on about one day a week and spend half of that trying
to keep the grammar somewhat readable and with no bad reduce conflicts, but if
anyone wants to play along:
<https://github.com/martok/freepascal/compare/master...fpcres-rc>

-- 
Regards,
Martok




More information about the fpc-pascal mailing list