[lazarus] gtk port questions

Michael Van Canneyt Michael.VanCanneyt at wisa.be
Fri Apr 23 04:25:51 EDT 1999




On Fri, 23 Apr 1999, Mike Z. wrote:

> Well, I've started the port and as anticipated I've got some questions.
> Please be patient with me - I'm a quick study and learn well by example.
> By the time this is done I might even understand what I'm doing...
> 
> I'm working under Win32 (my linux box is running an FTP server on a 486-66
> and I try to avoid using it for other purposes).  Feel free to answer with
> brevity, I'll let you know if I'm missing something.  Thanks in advance!
> 
> 1.  The h2pas.exe (12/21/98 version) seems to do nothing.  I've tried the
> syntax: h2pas gtkbbox.h gtkbbox.pp and I'm just returned to the command
> prompt.  I downloaded h2pas from apparently the original author (6/9/95
> version) and it works.  Should I be using the version supplied with fpc and
> any thoughts on why it doesn't work?

Just recompile it and it will work. (in rtl/utils/convert)
The official distributed version had a problem on win32 platforms :(

> 
> 2.  Regarding this code snippet from the .pp file:
> 
> {$ifndef gtk_include_files}
>   {$define read_interface}
>   {$define
> read_implementation}
> {$endif not gtk_include_files}
> 
> {$ifndef
> gtk_include_files}
> 
>   unit gtkbbox;
>   interface
> [snip]
> 
> I see these directives in all the units.  I'll assume they're necessary but
> I'm not clear on when gtk_include_files would be defined.

The purpose of this is that you can compile the unit GTK such that it includes
all the other units, thus making it 1 huge unit. The unit gtk therefore defines
gtk_include_files, and simply includes all the others.

You can also compile the units separately. In that case you DON't define
gtk_include_files, and each .pp file will act as a unit on it's own.

> 3. Compiler directives in the C headers are ignored in the pp units.  Correct?
Correct.

> 4. A C struct is equivalent to a pascal record?  The C typedef struct
> statements aren't used in pascal?

No.

> 5. Is there an easy way to determine what needs to be in the Uses clause of
> the pp units?

In the C header files, several includes are done. I think that most of them
need gtktypes and gtkwidgets, most also use gdk and glib.

I always tried to compile the unit and added units as needed.

The problem of course doesn't exist if it is all 1 big unit...

> 6.  These types seem frequently defined:
> 
>   Type
>     PLongint  = ^Longint;
>     PByte     = ^Byte;
>     PWord     =
> ^Word;
>     PINteger  = ^Integer;
>     PCardinal = ^Cardinal;
>     PReal     =
> ^Real;
>     PDouble   = ^Double;
> 
> while PWord isn't used, for example, in gtkbbox.pp.  In this case, PWord
> doesn't need to be typed, correct?  You're just throwing them all in for
> convenience?

Yes. Include these, they are generated by the H2pas program for convenience.

> 
> Thanks again for any tips.  Once I get rolling I won't be quite the
> irritant :)

No complaints so far :)

Michael.






More information about the Lazarus mailing list