summaryrefslogtreecommitdiff
path: root/giscanner/mallard-C-function.tmpl
blob: 2da4710f8756bdab61e976febb0a1055ace97c1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?xml version="1.0"?>
<%
page_style = 'function'
if node.is_constructor:
    page_style = 'constructor'
elif node.is_method:
    page_style = 'method'
%>
<page id="${page_id}"
      type="topic"
      style="${page_style}"
      xmlns="http://projectmallard.org/1.0/"
      xmlns:api="http://projectmallard.org/experimental/api/"
      xmlns:ui="http://projectmallard.org/experimental/ui/">
  <info>
% if node.parent is not None:
    <link type="guide" xref="${namespace.name}.${node.parent.name}" group="${page_style}"/>
% else:
    <link type="guide" xref="index" group="${page_style}"/>
% endif
    <api:function>
      <api:returns>
        <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:arg>
% endif
% endfor
    </api:function>
  </info>
  <title>${node.symbol}</title>
<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:
void\
%endif
);
% elif node.is_method:
,
% endif
% for arg, ix in zip(node.parameters, range(len(node.parameters))):
% if ix != 0:
${' ' * (len(formatter.format_type(node.retval.type)) + len(node.symbol) + 3)}\
% endif
% if arg.type.ctype == '<varargs>':
...\
% else:
${formatter.format_type(arg.type) | x} ${arg.argname}\
% endif
% if ix == len(node.parameters) - 1:
);
% else:
,
%endif
% endfor
</code></synopsis>
${formatter.format(node.doc)}

% if node.parameters or node.retval:
<table>
% for arg, ix in zip(node.parameters, range(len(node.parameters))):
<tr>
<td><p>${arg.argname} :</p></td>
<td>${formatter.format(arg.doc)}</td>
</tr>
% endfor
% if node.retval:
<tr>
<td><p>Returns :</p></td>
<td>${formatter.format(node.retval.doc)}</td>
</tr>
% endif
</table>
% endif
% if node.version:
<p>Since ${node.version}</p>
% endif
</page>