After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 606183 - Add a tool to extract C documentation for gmmproc.
Add a tool to extract C documentation for gmmproc.
Status: RESOLVED OBSOLETE
Product: glibmm
Classification: Bindings
Component: build
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on: 615136
Blocks:
 
 
Reported: 2010-01-06 06:40 UTC by José Alburquerque
Modified: 2010-04-12 02:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to add a doc extraction tool (12.57 KB, patch)
2010-01-06 06:40 UTC, José Alburquerque
none Details | Review
Difference between generated xml doc files (153.24 KB, application/x-compressed-tar)
2010-01-06 21:25 UTC, José Alburquerque
  Details
gstreamermm difference between generated functions (7.02 KB, patch)
2010-01-07 06:36 UTC, José Alburquerque
none Details | Review
glibmm difference between generated functions (7.38 KB, patch)
2010-01-07 06:47 UTC, José Alburquerque
none Details | Review
Updated patch now with enum processing. (14.06 KB, patch)
2010-01-07 06:52 UTC, José Alburquerque
none Details | Review
Updated patch to allow the same processing for lines in comment blocks without preceding asterisks (14.34 KB, patch)
2010-01-08 00:18 UTC, José Alburquerque
none Details | Review

Description José Alburquerque 2010-01-06 06:40:12 UTC
Created attachment 150883 [details] [review]
Patch to add a doc extraction tool

Hi.  The reason I'm submitting this patch is that I've found that some method descriptions are not generated correctly by the docextract_to_xml.py python script normally used.  I filed a bug about that some time ago but there has been no response:

https://bugzilla.gnome.org/show_bug.cgi?id=603428

I would guess that there may be other methods with similar problems so I decided to write a script that (hopefully) can generate better descriptions so that methods are more understandable.

I tested the attached patch with glibmm and gstreamermm and I think it works okay.  I hope it is useful.
Comment 1 Jonathon Jongsma 2010-01-06 06:47:43 UTC
can you attach a diff between the docs generated with the old script and docs generated by your script so we can get a feel for what problem is actually being solved here?
Comment 2 José Alburquerque 2010-01-06 21:25:47 UTC
Created attachment 150933 [details]
Difference between generated xml doc files

Here's a (compressed) diff of the two generated xml doc files for gstreamermm.  The original xml is generated as always, the second with the attached script.

I just noticed that there is a slight difference in the output of the <return></return> tags so the script could probably be modified to do what is normally done in that case.

I'll attach a diff for glibmm later (if it is needed).

Also the output of the function mentioned in the bug referenced in the original report looks like the following (the output can be compared with what is reported in the bug):

<function name="gst_mixer_list_tracks">
<description>
Returns a list of available tracks for this mixer/element. Note
that it is allowed for sink (output) elements to only provide
the output tracks in this list. Likewise, for sources (inputs),
it is allowed to only provide input elements in this list.

</description>
<parameters>
<parameter name="mixer">
<parameter_description> the #GstMixer (a #GstElement) to get the tracks from.
</parameter_description>
</parameter>
</parameters>
<return>
A #GList consisting of zero or more #GstMixerTracks.
The list is owned by the #GstMixer instance and must not be freed
or modified.
</return>
</function>

I think that the functions with names starting with uppercase in the original xml are attempts at generating signal docs (I'm not sure).  The attached script generates signal xml like the following if desired (via a specified switch):

<signal name="GstBin::element-added">
<description>
Will be emitted after the element was added to the bin.
</description>
<parameters>
<parameter name="bin">
<parameter_description> the #GstBin
</parameter_description>
</parameter>
<parameter name="element">
<parameter_description> the #GstElement that was added to the bin
</parameter_description>
</parameter>
</parameters>
<return>
</return>
</signal>

I kind of see the xml as being used for signal docs in the future if it is possible.  Of course, the xml can be refined if necessary.

The script also generates property xml, but I think that properties already have a way of being documented:

<property name="GstBin:async-handling">
<description>
If set to #TRUE, the bin will handle asynchronous state changes.
This should be used only if the bin subclass is modifying the state
of its children on its own.

Since: 0.10.13
</description>
</property>

Right now, the script is designed to process *.c files so I didn't think of generating docs for enums, but if *.h files are also processed, I think that enum docs can also be generated fairly easily so I'll try to add that and attach a substitute patch if the script promises usefulness.

I only submit this in case it does have some use. You, the glibmm maintainers would determine that.
Comment 3 José Alburquerque 2010-01-07 06:36:33 UTC
Created attachment 150957 [details] [review]
gstreamermm difference between generated functions
Comment 4 José Alburquerque 2010-01-07 06:47:29 UTC
Created attachment 150958 [details] [review]
glibmm difference between generated functions

Here's a difference of the glibmm generated functions.  I could not provide a difference of the xml because the sorting of it failed due to some &..; being interpreted as tags by the sorter I'm using.
Comment 5 José Alburquerque 2010-01-07 06:52:02 UTC
Created attachment 150960 [details] [review]
Updated patch now with enum processing.

This patch is updated to include enum xml.  One thing to consider is whether it is convenient to accept source files to be processed directly on the command line or whether to allow directories and search for source files in them instead.
Comment 6 José Alburquerque 2010-01-08 00:18:48 UTC
Created attachment 151012 [details] [review]
Updated patch to allow the same processing for lines in comment blocks without preceding asterisks

Updated according to the description.  Also added output confirming file processing.  There is no difference in the xml output except that lines without preceding asterisks in comment blocks are processed as part of the comment block regardless.
Comment 7 Murray Cumming 2010-03-21 12:38:15 UTC
So is this a drop-in replacement for docextract_to_xml.py? Should we start using it now?

Of course, I'd rather fix the original python script rather than have a completely new script.
Comment 8 José Alburquerque 2010-03-23 18:54:31 UTC
It should be a drop in replacement, except that it doesn't process files in the tmpl/ directories because the gtk-doc manual suggests that these files not be used anymore.  Having looked at the docextract_to_xml.py code, it seems better because it does the processing by directories instead of by files.

I'm in the process of seeing how the features in this tool (like property and signal xml) can be included in the original script and then this tool will not be needed.  In the meanwhile, if it's okay, this can remain open.  I'd rather keep it open to remind me that the transition needs to be done.
Comment 9 José Alburquerque 2010-04-08 04:43:22 UTC
If bug #615136 is accepted, this one can be closed because the enhancements in the patch in that bug implement most of what is implemented here (except for enum handling because the python doc extraction scripts process just *.c files).
Comment 10 José Alburquerque 2010-04-12 02:31:23 UTC
Bug #615136 has been accepted and resolved.  The python doc generation tool essentially now does what this tool would have done and more because it also handles GObject Introspection annotations.  Closing this enhancement request as obsolete.