Waldek Hebisch wrote:
Some thoughts, if you search for good way to express the intent. AFAICS on Mac OSX you can define:
StyleParameter = set of StyleItemGPC;
and that should do the right thing here.
Yes, I tried that and It does. There is some history (with ABI problems) behind the call. Here are the original comments.
Quickdraw Types Style Quickdraw font rendering styles StyleParameter Style when used as a parameter (historical 68K convention) StyleField Style when used as a field (historical 68K convention) Note: The original Macintosh toolbox in 68K Pascal defined Style as a SET. Both Style and CHAR occupy 8-bits in packed records or 16-bits when used as fields in non-packed records or as parameters.
and the (messy) declarations:
StyleItemGPC = (bold,italic,underline,outline,shadow,condense,extend); StyleItem = packed bold..extend; StyleGPC = set of StyleItem; Style = UInt8;
StyleParameter = UInt16; StyleField = Style;
procedure TextFace(face: StyleParameter); external name 'TextFace';
In GPC a set is at least 32-bits, but still this works - fortunately: StyleParameter = set of StyleItemGPC
as you mentioned.
Alternatively, cast of set constructor should work:
....
StyleParameterGPC = set of StyleItemGPC;
...
TextFace( StyleParameter(StyleParameterGPC[bold, italic]));
Double cast
TextFace( StyleParameter(StyleParameterGPC([bold, italic])));
should work too, but I just noticed that it did not work (without the patch I posted).
The compiler accepts it, but it doesn't have the desired effect (on high-endian systems). Type-casting to a signed 32-bit integer however does (with the patch):
TextFace( SInt32( [italic]));
Regards,
Adriaan van Os