]> git.sesse.net Git - vlc/commitdiff
python-ctypes: improve documentation generation
authorOlivier Aubert <olivier.aubert@liris.cnrs.fr>
Fri, 31 Jul 2009 15:58:36 +0000 (17:58 +0200)
committerOlivier Aubert <olivier.aubert@liris.cnrs.fr>
Fri, 31 Jul 2009 16:46:36 +0000 (18:46 +0200)
bindings/python-ctypes/generate.py
bindings/python-ctypes/header.py
bindings/python-ctypes/override.py

index 5f8ddb792c134b9fdf1d993bd91de7a25a674a8e..c7f61a00e7dacddea0df69906d896d364b635283 100755 (executable)
@@ -207,7 +207,7 @@ def generate_header(classes=None):
 
 def convert_enum_names(enums):
     res={}
-    for (typ, name, values) in enums:
+    for (typ, name, values, comment) in enums:
         if typ != 'enum':
             raise Exception('This method only handles enums')
         pyname=re.findall('(libvlc|mediacontrol)_(.+?)(_t)?$', name)[0][1]
@@ -219,12 +219,13 @@ def convert_enum_names(enums):
     return res
 
 def generate_enums(enums):
-    for (typ, name, values) in enums:
+    for (typ, name, values, comment) in enums:
         if typ != 'enum':
             raise Exception('This method only handles enums')
         pyname=typ2class[name]
 
         print "class %s(ctypes.c_uint):" % pyname
+        print '    """%s\n    """' % comment
 
         conv={}
         # Convert symbol names
@@ -255,7 +256,7 @@ def parse_typedef(name):
     """Parse include file for typedef expressions.
 
     This generates a tuple for each typedef:
-    (type, name, value_list)
+    (type, name, value_list, comment)
     with type == 'enum' (for the moment) and value_list being a list of (name, value)
     Note that values are string, since this is intended for code generation.
     """
@@ -298,7 +299,9 @@ def parse_typedef(name):
                 else:
                     if l:
                         values.append( (l, str(i)) )
-            yield (typ, name, values)
+            comment=comment.replace('@{', '').replace('@see', 'See').replace('\ingroup', '')
+            yield (typ, name, values, comment)
+            comment=''
 
 def parse_include(name):
     """Parse include file.
index 6684d12e41e7199569d2909073215dcb0dfe81ff..f4a2c2db43a9381f65e3cef08d8f762f07201264 100755 (executable)
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 #
 
+"""This module provides bindings for the
+U{libvlc<http://wiki.videolan.org/ExternalAPI>} and
+U{MediaControl<http://wiki.videolan.org/MediaControlAPI>} APIs.
+
+You can find documentation at U{http://www.advene.org/download/python-ctypes/}.
+
+Basically, the most important class is L{Instance}, which is used to
+create a libvlc Instance. From this instance, you can then create
+L{MediaPlayer} and L{MediaListPlayer} instances.
+"""
+
 import ctypes
 import sys
 
index 0bd39ca3731328856a05242117fc1fde2f898864..382a33a7f64404f94bebff91e181f87fe624cd34 100644 (file)
@@ -103,6 +103,8 @@ class MediaPlayer:
             return o
 
     def get_instance(self):
+        """Return the associated vlc.Instance.
+        """
         return self._instance
 
 class MediaListPlayer:
@@ -131,6 +133,8 @@ class MediaListPlayer:
             return o
 
     def get_instance(self):
+        """Return the associated vlc.Instance.
+        """
         return self._instance
 
 class LogIterator: