[gobject-introspection] doctool: Update templates to include the actual instance parameter
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] doctool: Update templates to include the actual instance parameter
- Date: Sat, 2 Feb 2013 02:23:13 +0000 (UTC)
commit d1e368a22c8b9a9a7b260f7077142233b1a3e189
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Fri Feb 1 20:19:12 2013 -0500
doctool: Update templates to include the actual instance parameter
Rather than fabricating one with a fake name.
giscanner/doctemplates/C/function.tmpl | 34 ++++++--------------
giscanner/doctemplates/Gjs/function.tmpl | 8 +----
giscanner/doctemplates/Python/function.tmpl | 25 +++++----------
.../DocExamples.Obj.method.page | 8 ++--
.../DocExamples.Obj.method.page | 4 --
.../DocExamples.Obj.method.page | 6 ++-
6 files changed, 27 insertions(+), 58 deletions(-)
---
diff --git a/giscanner/doctemplates/C/function.tmpl b/giscanner/doctemplates/C/function.tmpl
index 01c653b..4472ec5 100644
--- a/giscanner/doctemplates/C/function.tmpl
+++ b/giscanner/doctemplates/C/function.tmpl
@@ -10,19 +10,13 @@
<api:type>${formatter.format_type(node.retval.type) | x}</api:type>
</api:returns>
<api:name>${node.symbol}</api:name>
-% if node.is_method:
- <api:arg>
- <api:type>${node.parent.ctype} *</api:type>
- <api:name>self</api:name>
- </api:arg>
-% endif
-% for arg in node.parameters:
+% for arg in node.all_parameters:
% if arg.type.ctype == '<varargs>':
<api:varargs/>
% else:
<api:arg>
<api:type>${formatter.format_type(arg.type) | x}</api:type>
- <api:name>${arg.argname}</api:name>
+ <api:name>${formatter.format_parameter_name(node, arg)}</api:name>
</api:arg>
% endif
% endfor
@@ -31,18 +25,10 @@
<%block name="synopsis">
<synopsis><code mime="text/x-csrc">
${node.retval.type.ctype} ${node.symbol} (\
-% if node.is_method:
-${node.parent.ctype} *self\
-%endif
-% if len(node.parameters) == 0:
-% if not node.is_method:
+% if len(node.all_parameters) == 0:
void\
-%endif
-);
-% elif node.is_method:
-,
-% endif
-% for arg, ix in zip(node.parameters, range(len(node.parameters))):
+% else:
+% for arg, ix in zip(node.all_parameters, range(len(node.all_parameters))):
% if ix != 0:
${' ' * (len(formatter.format_type(node.retval.type)) + len(node.symbol) + 3)}\
% endif
@@ -51,16 +37,16 @@ ${' ' * (len(formatter.format_type(node.retval.type)) + len(node.symbol) + 3)}\
% else:
${formatter.format_type(arg.type) | x} ${arg.argname}\
% endif
-% if ix == len(node.parameters) - 1:
-);
-% else:
+% if ix != len(node.all_parameters) - 1:
,
-%endif
+% endif
% endfor
+% endif
+);
</code></synopsis>
</%block>
<%block name="details">
-% if node.parameters or node.retval:
+% if node.all_parameters or node.retval:
<dl>
% for arg, ix in zip(node.parameters, range(len(node.parameters))):
<dt><p>${arg.argname} :</p></dt>
diff --git a/giscanner/doctemplates/Gjs/function.tmpl b/giscanner/doctemplates/Gjs/function.tmpl
index 92bfb3a..d0fa096 100644
--- a/giscanner/doctemplates/Gjs/function.tmpl
+++ b/giscanner/doctemplates/Gjs/function.tmpl
@@ -10,19 +10,13 @@
<api:type>${formatter.format_type(node.retval.type) | x}</api:type>
</api:returns>
<api:name>${node.symbol}</api:name>
-% if node.is_method:
- <api:arg>
- <api:type>${node.parent.ctype} *</api:type>
- <api:name>self</api:name>
- </api:arg>
-% endif
% for arg in node.parameters:
% if arg.type.ctype == '<varargs>':
<api:varargs/>
% else:
<api:arg>
<api:type>${formatter.format_type(arg.type) | x}</api:type>
- <api:name>${arg.argname}</api:name>
+ <api:name>${formatter.format_parameter_name(node, arg)}</api:name>
</api:arg>
% endif
% endfor
diff --git a/giscanner/doctemplates/Python/function.tmpl b/giscanner/doctemplates/Python/function.tmpl
index 467cfcb..fa705bd 100644
--- a/giscanner/doctemplates/Python/function.tmpl
+++ b/giscanner/doctemplates/Python/function.tmpl
@@ -10,19 +10,13 @@
<api:type>${formatter.format_type(node.retval.type) | x}</api:type>
</api:returns>
<api:name>${node.symbol}</api:name>
-% if node.is_method:
- <api:arg>
- <api:type>${node.parent.ctype} *</api:type>
- <api:name>self</api:name>
- </api:arg>
-% endif
-% for arg in node.parameters:
+% for arg in node.all_parameters:
% if arg.type.ctype == '<varargs>':
<api:varargs/>
% else:
<api:arg>
<api:type>${formatter.format_type(arg.type) | x}</api:type>
- <api:name>${arg.argname}</api:name>
+ <api:name>${formatter.format_parameter_name(node, arg)}</api:name>
</api:arg>
% endif
% endfor
@@ -30,27 +24,24 @@
</%block>
<%block name="synopsis">
<synopsis><code mime="text/x-python">
-% if len(node.parameters) != 0:
+% if len(node.all_parameters) != 0:
@accepts(\
-${', '.join((formatter.format_type(arg.type) for arg in node.parameters))}\
+${', '.join((formatter.format_type(arg.type) for arg in node.all_parameters))}\
)
% endif
@returns(${formatter.format_type(node.retval.type) | x})
def \
${node.name}(\
-% if node.is_method:
-self, \
-% endif
-${', '.join((arg.argname for arg in node.parameters))}\
+${', '.join((formatter.format_parameter_name(node, arg) for arg in node.all_parameters))}\
):
# Python wrapper for ${node.symbol}()
</code></synopsis>
</%block>
<%block name="details">
-% if node.parameters or node.retval:
+% if node.all_parameters or node.retval:
<dl>
-% for arg, ix in zip(node.parameters, range(len(node.parameters))):
-<dt><p>${arg.argname} :</p></dt>
+% for arg, ix in zip(node.all_parameters, range(len(node.all_parameters))):
+<dt><p>${formatter.format_parameter_name(node, arg)} :</p></dt>
<dd>${formatter.format(node, arg.doc)}</dd>
% endfor
% if node.retval and node.retval.type.ctype != 'void':
diff --git a/tests/doctool/DocExamples-1.0-C-expected/DocExamples.Obj.method.page b/tests/doctool/DocExamples-1.0-C-expected/DocExamples.Obj.method.page
index 1047753..8dbe8a7 100644
--- a/tests/doctool/DocExamples-1.0-C-expected/DocExamples.Obj.method.page
+++ b/tests/doctool/DocExamples-1.0-C-expected/DocExamples.Obj.method.page
@@ -14,8 +14,8 @@
</api:returns>
<api:name>doc_examples_obj_method</api:name>
<api:arg>
- <api:type>DocExamplesObj *</api:type>
- <api:name>self</api:name>
+ <api:type>DocExamplesObj*</api:type>
+ <api:name>obj</api:name>
</api:arg>
<api:arg>
<api:type>gint</api:type>
@@ -43,8 +43,8 @@
<title>doc_examples_obj_method</title>
<synopsis><code mime="text/x-csrc">
-gboolean doc_examples_obj_method (DocExamplesObj *self,
-gint first_arg,
+gboolean doc_examples_obj_method (DocExamplesObj* obj,
+ gint first_arg,
gfloat second_arg,
gboolean boolean_arg,
gpointer pointer_arg,
diff --git a/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.Obj.method.page b/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.Obj.method.page
index b3dad03..abe38df 100644
--- a/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.Obj.method.page
+++ b/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.Obj.method.page
@@ -14,10 +14,6 @@
</api:returns>
<api:name>doc_examples_obj_method</api:name>
<api:arg>
- <api:type>DocExamplesObj *</api:type>
- <api:name>self</api:name>
- </api:arg>
- <api:arg>
<api:type>Number</api:type>
<api:name>first_arg</api:name>
</api:arg>
diff --git a/tests/doctool/DocExamples-1.0-Python-expected/DocExamples.Obj.method.page b/tests/doctool/DocExamples-1.0-Python-expected/DocExamples.Obj.method.page
index 390c40c..7b7c8fa 100644
--- a/tests/doctool/DocExamples-1.0-Python-expected/DocExamples.Obj.method.page
+++ b/tests/doctool/DocExamples-1.0-Python-expected/DocExamples.Obj.method.page
@@ -14,7 +14,7 @@
</api:returns>
<api:name>doc_examples_obj_method</api:name>
<api:arg>
- <api:type>DocExamplesObj *</api:type>
+ <api:type>DocExamples.Obj</api:type>
<api:name>self</api:name>
</api:arg>
<api:arg>
@@ -43,7 +43,7 @@
<title>Obj.method</title>
<synopsis><code mime="text/x-python">
- accepts(int, float, bool, gpointer, unicode)
+ accepts(DocExamples.Obj, int, float, bool, gpointer, unicode)
@returns(bool)
def method(self, first_arg, second_arg, boolean_arg, pointer_arg, string):
# Python wrapper for doc_examples_obj_method()
@@ -59,6 +59,8 @@ in as <code>self</code>.</p><p>This should be a %FALSEALARM.</p>
<dl>
+<dt><p>self :</p></dt>
+<dd><p>A <link xref="DocExamples.Obj"/>.</p></dd>
<dt><p>first_arg :</p></dt>
<dd><p>first argument</p></dd>
<dt><p>second_arg :</p></dt>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]