Hi,
fpc 1.9 support global properties, see for example rtl/linux/baseunix.pp.
The codetools don't support them and give an error: Error expected end., but property found.
Regards,
Vincent.

Mailing lists / lazarus / 2003-12
8 messages · 5 people ·
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Hi,
fpc 1.9 support global properties, see for example rtl/linux/baseunix.pp.
The codetools don't support them and give an error: Error expected end., but property found.
Regards,
Vincent.
They are the same as normal properties, only without class. Read/write specifiers can be…
:)
The codetools support it now.
Mattias
They are the same as normal properties, only without class. Read/write specifiers can be…
The main idea is to keep code that depends on variables in an external lib that are exported via function into variable notation.
E.g. libc's errno (the problem in question) is exported by libc as a function that returns a pointer to the (right threadinstance of ) errno. Libc hides this with a macro.
So
function __error():pcint; external name '__errno'; // FreeBSD libc,
Linux calls it errno_location
procedure seterrno(newerrno:cint);
begin
__error():=i;
end;
function geterrno:cint;
begin
result:=__error();
end;
property
errno : cint read geterrno write seterrno;
begin
errno:=5; // behaves like when accessed in C, but threadsafe.
writeln(errno);
end;fpc 1.9 support global properties, see for example rtl/linux/baseunix.pp. The codetools…
Implemented.
Interesting feature. Where can I find the specs?
Question is still open.
Mattias
fpc 1.9 support global properties, see for example rtl/linux/baseunix.pp. The codetools…
Cool :-)
Marc
fpc 1.9 support global properties, see for example rtl/linux/baseunix.pp. The codetools…
Interesting feature.
Where can I find the specs?
Mattias
fpc 1.9 support global properties, see for example rtl/linux/baseunix.pp. The codetools…
Thanks. That needs some more work ...
Mattias
fpc 1.9 support global properties, see for example rtl/linux/baseunix.pp. The codetools…
They are the same as normal properties, only without class. Read/write specifiers can be in another unit, and properties can be grouped as in var/const/type/resourcestring blocks.
So something like:
Unit SomeProps;
Uses
ReadWriteUnit;
Property
A1 : Integer Read GetA1 Write SetA1;
A2 : Integer Read GetA2 Write SetA2;Michael.