Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2000-12

Re: X lib

6 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Van Canneyt
to Johan Blok: I programmed some stuff in C for X, now I want to convert it to pascal. I did a very…
Johan Blok wrote 9 lines
I programmed some stuff in C for X, now I want to convert it to pascal. I did a very small program, but for every macro in C I had to write a function, or I have to use a long expression that's repeated very often (for example ScreenOfDisplay). In xlib.pp all #defines from C are comments. Is there allready a unit with all this #defines rewritten as functions?

No. In principle this should be done in the xlib unit itself. Feel free to start doing that :-)

Show quoted text 6 lines
FPC supports some macro's, but only inside the unit where you defined them, if I understand it right. This makes very little sense, in my opinion, this type of macro's are almost useless.

As far as I know, no-one uses them.

Why can't FPC support using macro's also outside the unit?

You better use inlined functions for such things.

Michael.

Reply by email

Jonas Maebe
> Why can't FPC support using macro's also outside the unit? You better use inlined functions for such things.

Inlined functions across units aren't supported yet either. Though this is certainly planned for the 1.1 branch.

Jonas

Reply by email

Jonas Maebe
> You better use inlined functions for such things. > Okay, but I remember that I have read somewhere that they are not supported at this moment. Is this correct?

Inline functinos are supported, but also not across units currently.

Jonas

Reply by email

Johan Blok

I programmed some stuff in C for X, now I want to convert it to pascal.

I did a very small program, but for every macro in C I had to write a function, or I have to use a long
expression that's repeated very often (for example ScreenOfDisplay). In xlib.pp all #defines from C are
comments.

Is there allready a unit with all this #defines rewritten as functions?

FPC supports some macro's, but only inside the unit where you defined them, if I understand it right.

This makes very little sense, in my opinion, this type of macro's are almost useless.

Why can't FPC support using macro's also outside the unit?

in such a way that I can have:

unit macros;
... macro definitions ...
begin
end.
unit usemacros;
uses macros;

... here I can use all macros definitions.

begin
end.

Johan Blok

Reply by email

Johan Blok
to Michael Van Canneyt: No. In principle this should be done in the xlib unit itself. Feel free to start doing…
Michael Van Canneyt wrote 15 lines
On Thu, 14 Dec 2000, Johan Blok wrote: > I programmed some stuff in C for X, now I want to convert it to pascal. > > I did a very small program, but for every macro in C I had to write a > function, or I have to use a long > expression that's repeated very often (for example ScreenOfDisplay). In > xlib.pp all #defines from C are > comments. > > Is there allready a unit with all this #defines rewritten as functions? No. In principle this should be done in the xlib unit itself. Feel free to start doing that :-)

Because I want to do a lot with X, I start doing that, using inline functions. I hope the compiler accepts the keyword inline, only simple doesn't do the inline stuff really.

Johan Blok

Reply by email