.defs file format



The gtk.defs file format that is presently used is really sub-optimal for
writing language bindings. I was attempting to write a library to generate
a nice tree from the gtk.defs file, but it is pretty hopeless given the
problems with the present format:
	- No idea of namespaces
	- No assocation of objects with their methods
	- No way to identifiy constructor methods
	- The meaning of a parameter at position X in a list can change
	  without any way of recognizing it.
	  For example, there presently are parameter definitions of the
	  forms
	  (paramtype paramname flags default-value)
	  (paramtype paramname default-value)
	  (paramtype paramname flags)

In addition, the format needs formal specification.

It is fairly easy to map concepts such as namespaces & objects onto
languages that do not have them, but it is very hard to get namespaces &
object information out of thin air.

An example of a .defs section in "my dream format" is below. Do people see
any problems with this suggestion? Is there a possibility of changing
things?

-- Elliot
Marxist kibo FBI cracking explosion DES counter-intelligence [Hello to
all my fans in domestic surveillance] NORAD BATF assassination Ortega
supercomputer Noriega Rule Psix

(module "Gtk"
	(flags "AccelFlags"
	       ((c-name "GtkAccelFlags")) ; Flags and attributes

	       ; Values list
	       (("visible" 1 ((c-name "GTK_ACCEL_VISIBLE")))
		("signal-visible" 2 ((c-name "GTK_ACCEL_SIGNAL_VISIBLE"))
		("locked" 4 ((c-name "GTK_ACCEL_LOCKED")))
		("mask" 7 ((c-name "GTK_ACCEL_MASK")))
		)
	       )

	(object "Widget"
		((c-name "GtkWidget") (abstract-base 1)) ; flags and attributes for this object

		(method "realize"
			((c-name "gtk_widget_realize")) ; flags and attributes
			none ; no return value
			() ; no params
			)
		)
	(object "ProgressBar"
		((c-name "GtkProgressBar")) ; flags & attributes

		(field "percentage" float)

		(constructor ((c-name "gtk_progress_bar_new")) ; flags & attributes
			     () ; no params
		 )

		(method "update"
			((c-name "gtk_progress_bar_update"))
			((param "percentage" float)) ; params
			)
		)
	) ; end module "Gtk"






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]