[webkit-gtk] Webkit introspection experiments with Python
Gabriel Jacobo
gabomdq at gmail.com
Tue Sep 7 07:40:10 PDT 2010
I modified the script like Martin suggested and its working fine right now. One
more problem remains, the introspection scanner uses the class naming
conventions to determine if certain method belongs to a class, for example...
For the WebKitWebView method webkit_web_view_get_dom_document it removes the
prefix WebKit and splits the class name in capital letters separating them by
underscores, and then it matches this to the method names, so it can tell that
this method belong to the class.
But, for example for WebKitDOMHTMLElement method
webkit_dom_html_element_get_inner_html this doesnt work, because the scanner
tool processes WebKitDOMHTMLElement as domhtml_element instead of
dom_html_element.
I thought of using the Rename to: parameter in the comments to account for
this difference (renaming for introspection purpouses
webkit_dom_html_element_get_inner_html to
webkit_domhtml_element_get_inner_html), but this doesnt seem to work. I also
thought of fixing the class names generated so they follow the convention
WebKitDomHtmlElement for example, but this (as expected) brings problem in a
lot of places. The same goes if instead of renaming using a introspection
annotation I actually rename functions.
So, the question here is what's the best approach to solve this. It seems that
the "rename to" annotation is the path of least resistance, but it doesnt
quite work and in the end it's a workaround. Another alternative would be to
talk to the introspection tool guys about improving the detection routine.
The consequence of this is that in a language like Python, the "self" variable
isnt automatically passed to the functions, and you have to pass it manually
as the first parameter of the function. Its not the end of the world for sure!
Thanks,
Gabriel.
On Mar 07 Sep 2010 04:14:47 Xan escribió:
> On Tue, Sep 7, 2010 at 6:04 AM, Gabriel Jacobo <gabomdq at gmail.com> wrote:
> > Perhaps put them all together in a separate "comments only" header file
> > and add it to the list of headers that get processed by the tool?
>
> I think probably the easiest solution would be to have a different
> perl file with a hash table where we index the documentation for each
> function by its name, and then we just have the generator tool look it
> up each time it's creating a function to include it. So in short: yes.
>
> :)
>
> Just open a bug about this issue and attach the patch when you have it
> ready, I'll review it ASAP. Thank you!
>
> Xan
More information about the webkit-gtk
mailing list