Difference between revisions of "gir2pascal"

From Free Pascal wiki
Jump to navigationJump to search
(gir2pascal was imported to Lazarus source tree)
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
=About=
 
=About=
gir2pascal is a program to convert gobject-introspection (*.gir) xml files into into pascal files which can be compiled (hopefully) without modification.
+
gir2pascal is a program to convert gobject-introspection (*.gir) xml files into into Pascal files which can be compiled (hopefully) without modification.
  
 
More information about gobject-introspection technology can be found here: [http://live.gnome.org/GObjectIntrospection http://live.gnome.org/GObjectIntrospection]
 
More information about gobject-introspection technology can be found here: [http://live.gnome.org/GObjectIntrospection http://live.gnome.org/GObjectIntrospection]
Line 6: Line 6:
 
*Converts the .gir file used as an argument into a .pas file
 
*Converts the .gir file used as an argument into a .pas file
 
*Also converts any .gir files required into .pas files.
 
*Also converts any .gir files required into .pas files.
*GObject's are mapped to pascal objects(not classes) for easier use.
+
*GObject's are mapped to pascal objects (not classes) for easier use.
 
*Creating an instance of an object is done through Foo := ''TSomeGObjectType''.new(''Parameters'').
 
*Creating an instance of an object is done through Foo := ''TSomeGObjectType''.new(''Parameters'').
 
*Can currently generate bindings for gtk3, glib2, atk1, pango1 and webkit without the resulting files needing to be modified to be compiled and linked.
 
*Can currently generate bindings for gtk3, glib2, atk1, pango1 and webkit without the resulting files needing to be modified to be compiled and linked.
Line 12: Line 12:
 
*Can create test units that help verify the conversion is correct.
 
*Can create test units that help verify the conversion is correct.
 
<p>Some limitations in generated code</p>
 
<p>Some limitations in generated code</p>
*The objects are just memory mapped to the C structs that are allocated. The pascal new and dispose functions cannot be used with them.
+
*The objects are just memory mapped to the C structs that are allocated.
*The objects created cannot wrap the c varargs methods. However the flat functions with varargs are availableas before.
+
*The pascal new and dispose functions cannot be used with the objects.
 +
*You cannot create a new object type that inherits the generated objects. (Technically possible if you don't add any additional fields or virtual methods)
 +
*The objects created cannot wrap the c varargs methods. However the flat functions with varargs are available as before.
 
gir2pascal is currently being used to generate the [[Gtk+3]] bindings for pascal.
 
gir2pascal is currently being used to generate the [[Gtk+3]] bindings for pascal.
  
 
=License=
 
=License=
 
[http://www.opensource.org/licenses/GPL-2.0 GPL-2.0]
 
[http://www.opensource.org/licenses/GPL-2.0 GPL-2.0]
 +
 
=Author=
 
=Author=
 
<p>Andrew Haines</p>  
 
<p>Andrew Haines</p>  
Line 23: Line 26:
 
<p>If you find this program useful you can donate with paypal
 
<p>If you find this program useful you can donate with paypal
 
[https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SYYDBL2TAQMPY here].</p>
 
[https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SYYDBL2TAQMPY here].</p>
=SVN=
+
 
You can download the source from svn
+
=Source code=
  svn co https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/applications/gobject-introspection gir2pascal
+
 
Or alternatively you can browse the source [http://lazarus-ccr.svn.sourceforge.net/viewvc/lazarus-ccr/applications/gobject-introspection/ here]
+
Since Lazarus 2.3, this tool is part of Lazarus source code tree and located in ''tools/gir2pascal'' directory.
 +
 
 +
Historic sources are located in [http://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/applications/gobject-introspection/ Lazarus-CCR SVN].
 +
Later the tool has received maintenance on [https://github.com/n1tehawk/gir2pascal GitHub] by [[User:Bnortmann|Bnortmann]] ([[User talk:Bnortmann|talk]]) and finally was imported from his repository into Lazarus source tree.
 +
 
 +
[[Category:Lazarus-CCR]]

Revision as of 00:17, 19 July 2022

About

gir2pascal is a program to convert gobject-introspection (*.gir) xml files into into Pascal files which can be compiled (hopefully) without modification.

More information about gobject-introspection technology can be found here: http://live.gnome.org/GObjectIntrospection

Some of the features of gir2pascal are:

  • Converts the .gir file used as an argument into a .pas file
  • Also converts any .gir files required into .pas files.
  • GObject's are mapped to pascal objects (not classes) for easier use.
  • Creating an instance of an object is done through Foo := TSomeGObjectType.new(Parameters).
  • Can currently generate bindings for gtk3, glib2, atk1, pango1 and webkit without the resulting files needing to be modified to be compiled and linked.
  • Many other .gir files may work as well
  • Can create test units that help verify the conversion is correct.

Some limitations in generated code

  • The objects are just memory mapped to the C structs that are allocated.
  • The pascal new and dispose functions cannot be used with the objects.
  • You cannot create a new object type that inherits the generated objects. (Technically possible if you don't add any additional fields or virtual methods)
  • The objects created cannot wrap the c varargs methods. However the flat functions with varargs are available as before.

gir2pascal is currently being used to generate the Gtk+3 bindings for pascal.

License

GPL-2.0

Author

Andrew Haines

Email: (andrewd207 at aol dot com)

If you find this program useful you can donate with paypal here.

Source code

Since Lazarus 2.3, this tool is part of Lazarus source code tree and located in tools/gir2pascal directory.

Historic sources are located in Lazarus-CCR SVN. Later the tool has received maintenance on GitHub by Bnortmann (talk) and finally was imported from his repository into Lazarus source tree.