-
Notifications
You must be signed in to change notification settings - Fork 0
/
expose.xsd
767 lines (675 loc) · 26.1 KB
/
expose.xsd
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
<?xml version="1.0"?>
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:annotation>
<xsd:documentation><![CDATA[
Example: ::
<?xml version="1.0"?>
<module name="modulename" include="vector">
<doc>module doc string</doc>
<class name="DVector" type="std::vector<double>">
<doc>class doc string</doc>
<init overload=""/>
<init overload="size_t,const double&"/>
<property name="size" get="size" set="resize"/>
<def func="push_back"/>
<def name="__sequence__getitem__" func="at" return-semantic="copy"/>
<def name="__sequence__setitem__" assign-to="at"/>
</class>
</module>
]]>
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType name="ident">
<xsd:restriction base="xsd:string">
<xsd:pattern value="[a-zA-Z_][a-zA-Z0-9_]*"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="retsemantictype">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="default"/>
<xsd:enumeration value="copy"/>
<xsd:enumeration value="managedref"/>
<xsd:enumeration value="self"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="symbol">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
<xsd:simpleType name="expression">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
<xsd:simpleType name="arglist">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
<xsd:simpleType name="includelist">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
<xsd:simpleType name="fieldlist">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
<xsd:element name="module">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded" minOccurs="0">
<xsd:element ref="def"/>
<xsd:element ref="class"/>
<xsd:element ref="doc"/>
<xsd:element ref="to-pyobject"/>
<xsd:element ref="from-pyobject"/>
<xsd:element ref="gc-handler"/>
<xsd:element name="init" maxOccurs="1">
<xsd:annotation>
<xsd:documentation>
Call a function at the start or end (or both) of the module's initialization.
A function specified here may either return ``int`` or nothing. If it returns
int, it is expected to use the return value to indicate an error and never throw
an (C++) exception. A value of zero indicates success. If any other value is
returned, a Python exception is assumed to be raised and the module
initialization is aborted.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:attribute name="pre" type="symbol">
<xsd:annotation>
<xsd:documentation>
The name of a function to call at the start of the module's initialization. The
function is called with no arguments.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="post" type="symbol">
<xsd:annotation>
<xsd:documentation>
The name of a function to call at the end of the module's initialization. The
function should either accept one argument of type ``PyObject*`` or no
arguments. If it accepts ``PyObject*``, it will receive the module object.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
</xsd:choice>
<xsd:attribute name="name" type="ident" use="required">
<xsd:annotation>
<xsd:documentation>
The name of the module. This will be the name by which the module is imported.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="include" type="includelist" use="required">
<xsd:annotation>
<xsd:documentation>
A comma separated list of include files to scan for the types and functions to
expose.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="def">
<xsd:annotation>
<xsd:documentation><![CDATA[
Specifies a method when inside <class>, specifies a function
when inside <module>.
Special methods can be defined by using the equivalent Python method
name:
=============== ================================================================
Python C++
=============== ================================================================
__new__ tp_new
__repr__ tp_repr
__str__ tp_str
__lt__ tp_richcompare
__le__ tp_richcompare
__eq__ tp_richcompare
__ne__ tp_richcompare
__gt__ tp_richcompare
__ge__ tp_richcompare
__cmp__ tp_compare
__hash__ tp_hash
__nonzero__ tp_as_number->nb_nonzero
__getattr__ tp_getattro
__setattr__ tp_setattro
__get__ tp_descr_get
__set__ tp_descr_set
__call__ tp_call
__iter__ tp_iter
next tp_iternext
__contains__ tp_as_sequence->sq_contains
__add__ tp_as_number->nb_add
__radd__ tp_as_number->nb_add (arguments reversed)
__sub__ tp_as_number->nb_subtract
__rsub__ tp_as_number->nb_subtract (arguments reversed)
__mul__ tp_as_number->nb_multiply
__rmul__ tp_as_number->nb_multiply (arguments reversed)
__floordiv__ tp_as_number->nb_floor_divide
__rfloordiv__ tp_as_number->nb_floor_divide (arguments reversed)
__mod__ tp_as_number->nb_remainder
__rmod__ tp_as_number->nb_remainder (arguments reversed)
__divmod__ tp_as_number->nb_divmod
__rdivmod__ tp_as_number->nb_divmod (arguments reversed)
__pow__ tp_as_number->nb_power
__rpow__ tp_as_number->nb_power (arguments reversed)
__lshift__ tp_as_number->nb_lshift
__rlshift__ tp_as_number->nb_lshift (arguments reversed)
__rshift__ tp_as_number->nb_rshift
__rrshift__ tp_as_number->nb_rshift (arguments reversed)
__and__ tp_as_number->nb_and
__rand__ tp_as_number->nb_and (arguments reversed)
__xor__ tp_as_number->nb_xor
__rxor__ tp_as_number->nb_xor (arguments reversed)
__or__ tp_as_number->nb_or
__ror__ tp_as_number->nb_or (arguments reversed)
__div__ tp_as_number->nb_divide
__rdiv__ tp_as_number->nb_divide (arguments reversed)
__truediv__ tp_as_number->nb_true_divide
__rtruediv__ tp_as_number->nb_true_divide (arguments reversed)
__iadd__ tp_as_number->nb_inplace_add
__isub__ tp_as_number->nb_inplace_subtract
__imul__ tp_as_number->nb_inplace_multiply
__idiv__ tp_as_number->nb_inplace_divide
__itruediv__ tp_as_number->nb_inplace_true_divide
__ifloordiv__ tp_as_number->nb_inplace_floor_divide
__imod__ tp_as_number->nb_inplace_remainder
__ipow__ tp_as_number->nb_inplace_power
__ilshift__ tp_as_number->nb_inplace_lshift
__irshift__ tp_as_number->nb_inplace_rshift
__iand__ tp_as_number->nb_inplace_and
__ixor__ tp_as_number->nb_inplace_xor
__ior__ tp_as_number->nb_inplace_or
__neg__ tp_as_number->nb_negative
__pos__ tp_as_number->nb_positive
__abs__ tp_as_number->nb_absolute
__invert__ tp_as_number->nb_invert
__int__ tp_as_number->nb_int
__long__ tp_as_number->nb_long
__float__ tp_as_number->nb_float
__oct__ tp_as_number->nb_oct
__hex__ tp_as_number->nb_hex
__index__ tp_as_number->nb_index
__coerce__ tp_as_number->nb_coerce
=============== ================================================================
The following cannot be used because they correspond to the constructor and
destructor. To specify the constructor, use the <init> tag.
=============== =================
Python C++
=============== =================
__init__ tp_init
__new__ tp_new
__del__ tp_dealloc
=============== =================
For functions that don't have a distinct equivalent in Python, the following
names are provided:
========================= ======================================
Name C++
========================= ======================================
__concat__ tp_as_sequence->sq_concat
__iconcat__ tp_as_sequence->sq_inplace_concat
__repeat__ tp_as_sequence->sq_repeat
__irepeat__ tp_as_sequence->sq_inplace_repeat
__mapping__len__ tp_as_mapping->mp_length
__sequence__len__ tp_as_sequence->sq_length
__mapping__getitem__ tp_as_mapping->mp_subscript
__sequence__getitem__ tp_as_sequence->sq_item
__mapping__setitem__ tp_as_mapping->mp_ass_subscript
__sequence__setitem__ tp_as_sequence->sq_ass_item
========================= ======================================
Operator methods can also be specified by their operators. The following are
equivalent:
============= ================
< __lt__
<= __le__
== __eq__
!= __ne__
> __gt__
>= __ge__
() __call__
\+ __add__
+= __iadd__
\- __sub__
-= __isub__
\* __mul__
\*= __imul__
\** __pow__
\**= __ipow__
/ __div__
/= __idiv__
// __floordiv__
//= __ifloordiv__
<< __lshift__
<<= __ilshift__
>> __rshift__
>>= __irshift__
& __and__
&= __iand__
^ __xor__
^= __ixor__
\| __or__
\|= __ior__
~ __invert__
============= ================
One and only one of ``func`` or ``assign-to`` needs to be defined.
]]>
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:all minOccurs="0">
<xsd:element ref="doc"/>
</xsd:all>
<xsd:attribute name="name" type="ident">
<xsd:annotation>
<xsd:documentation>
The name of the function/method as will be seen in python. If not specified, the
name will taken from the C++ function/method.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="func" type="symbol">
<xsd:annotation>
<xsd:documentation>
The C++ function/method that implements this.
When specifying a method, whether the resulting Python method is static is
determined by whether the C++ method is static. This can be overridden using the
``static`` attribute. A method may also be implemented using a C++ function, in
which case the function must accept the class's type as the first argument,
unless the ``static`` attribute is specified (to prevent mistakes, specifying a
function that doesn't accept the class type as its first argument, without
specifying ``static``, is considered an error).
The __rop__ methods will also accept C++ functions that accept the class type as
the second argument.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="assign-to" type="symbol">
<xsd:annotation>
<xsd:documentation>
Like func, except the return value is assigned to.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="overload" type="arglist">
<xsd:annotation>
<xsd:documentation>
The list of arguments the C++ function/method takes. This is to select a
specific function/method out of a set of overloads. The arguments are separated
by commas and can be specified with or without typedefs, as long as the
underlying types are the same as that of the function/method.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="return-semantic" type="retsemantictype">
<xsd:annotation>
<xsd:documentation>
Specifies how a pointer or reference return value is to be handled. If the
function returns by value, this attribute is meaningless. The options are
"default", "copy", "managedref" and "self". "default" is the same as omitting
this attribute. "copy" means the value will be dereferenced and copied.
"managedref" means the returned Python object will keep a reference and a
pointer to the class, in order to keep the class alive while the reference
exists. "self" means ignore the return value and return what would be the "self"
argument in Python.
For ``__iop__`` methods, the default is "self".
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="static" type="xsd:boolean" default="false">
<xsd:annotation>
<xsd:documentation>
For methods only, specifies whether the method will be static. This is
determined automatically when ``func`` is a method.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="self-arg" type="xsd:nonNegativeInteger">
<xsd:annotation>
<xsd:documentation>
For methods only, if supplied, the method will receive the ``self`` pointer, of
type ``PyObject*``. The value specifies the index (starting at 1) of the
argument to receive the pointer.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="arity" type="xsd:nonNegativeInteger">
<xsd:annotation>
<xsd:documentation>
Filters the overloaded functions/methods specified by ``func`` to ones that have
this many arguments. This is so operators with different meaning but the same
name (e.g. negation and subtraction), can be conveniently selected. Specifying
both ``arity`` and ``overload`` is redundant.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="bridge-virtual" type="xsd:boolean" default="true">
<xsd:annotation>
<xsd:documentation>
For virtual methods, if true (the default), the method will be overridable in
Python code. An attribute look-up must be performed to determine if the method
is overridden, so setting this to false avoids a small amount of overhead.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="init">
<xsd:attribute name="overload" type="arglist">
<xsd:annotation>
<xsd:documentation>
The list of arguments of the constructor. This is to select a specific
constructor out of a set of overloads. The arguments are separated by commas and
can be specified with or without typedefs, as long as the underlying types are
the same as that of the constructor.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="self-arg" type="xsd:nonNegativeInteger">
<xsd:annotation>
<xsd:documentation>
If supplied, the constructor will receive the ``self`` pointer, or type
``PyObject*``. The value specifies the index (starting at 1) of the argument to
receive the pointer.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="func" type="symbol">
<xsd:annotation>
<xsd:documentation>
If specified, the given function is used to initialize the class instead of the
constructor. The first argument (or second argument if ``self-arg`` is 1) must
take a pointer to the class. The function will be given a zero-filled region of
memory where the class is to be written.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
<xsd:element name="no-init">
<xsd:annotation>
<xsd:documentation>
Specifies that the class will not have an ``__init__`` method. Unless
``new-initializes`` is specified, the class cannot be instantiated directly in
Python code. Attempting to do so will raise a TypeError.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType/>
</xsd:element>
<xsd:element name="property">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded" minOccurs="0">
<xsd:element ref="doc"/>
<xsd:element name="get">
<xsd:complexType>
<xsd:attribute name="func" type="symbol" use="required"/>
<xsd:attribute name="return-semantic" type="retsemantictype" default="default"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="set">
<xsd:complexType>
<xsd:attribute name="func" type="symbol" use="required"/>
<xsd:attribute name="overload" type="arglist"/>
</xsd:complexType>
</xsd:element>
</xsd:choice>
<xsd:attribute name="name" type="ident" use="required"/>
<xsd:attribute name="get" type="symbol"/>
<xsd:attribute name="set" type="symbol"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="attr">
<xsd:annotation>
<xsd:documentation>
Expose a member variable as a Python attribute.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:attribute name="name" type="ident">
<xsd:annotation>
<xsd:documentation>
The name of the member as will be seen in python. If not specified, the name
will be taken from the C++ member.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="cmember" type="symbol" use="required">
<xsd:annotation>
<xsd:documentation>
The member variable of the C++ class to expose.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="readonly" type="xsd:boolean" default="false"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="class">
<xsd:annotation>
<xsd:documentation><![CDATA[
A class to expose to python.
Use ``<init>`` or ``<new>`` to specify a constructor. If none of ``<init>;``,
``<new>`` or ``<no-init>`` are specified, ``<init overload="">`` is implied.
Unless ``<new>`` is specified, the underlying C++ object is not constructed
until ``__init__`` is called. An unconstructed object raises an exception when
any of its methods (include property getters and setters) are called.
]]></xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:choice maxOccurs="unbounded" minOccurs="0">
<xsd:element name="init" type="init"/>
<xsd:element name="new" type="init"/>
<xsd:element ref="no-init"/>
<xsd:element ref="def"/>
<xsd:element ref="property"/>
<xsd:element ref="attr"/>
<xsd:element ref="doc"/>
</xsd:choice>
<xsd:attribute name="name" type="ident">
<xsd:annotation>
<xsd:documentation>
The name of the class as will be seen in python. If not specified, the name will
be taken from the C++ class if the class name is a legal Python identifier,
otherwise an arbitrary name is chosen.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="type" type="symbol" use="required">
<xsd:annotation>
<xsd:documentation>
The C++ class to expose to python. The class may be an instantiation of a
template, but cannot be the template itself (e.g. you can use
``std::vector<int>``, but ``not std::vector``).
Note that if you specify an instantiation of a template using a typedef but the
instantiation is not used anywhere else, PyExpose might not find it. The
solution is to either specify the template instantiation directly, or add
'``template class MyClass<args>;``' to the code PyExpose looks at.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="instance-dict" type="xsd:boolean" default="true">
<xsd:annotation>
<xsd:documentation>
Specifies whether to include an instance dictionary (``__dict__``). The default is
"true".
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="weakrefs" type="xsd:boolean" default="true">
<xsd:annotation>
<xsd:documentation>
Specifies whether to support weak references (``__weakref__``). The default is
"true".
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="use-gc" type="xsd:boolean" default="true">
<xsd:annotation>
<xsd:documentation>
Specifies whether to support cyclic garbage collection. If true, the "traverse"
and "clear" functions are generated for this class, handling the instance
dictionary and any public fields of type ``PyObject*`` or a type specified by
``<gc-handler>``. Fields can be omitted from the traverse and clear
functions using ``gc-ignore``.
Only first-level fields are included by default. For example, if the class has fields
that are structs or arrays, the struct's fields and array's items will not be
included automatically. They can however be included by listing them in
``gc-include``.
The default is "true".
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="gc-include" type="fieldlist">
<xsd:annotation>
<xsd:documentation>
A semicolon-separated list of fields to be included in cyclic garbage
collection. This list is ignored if a <gc-handler> applies to the entire
class.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="gc-ignore" type="fieldlist">
<xsd:annotation>
<xsd:documentation>
A semicolon-separated list of fields to be omitted from cyclic garbage
collection. This list is ignored if a <gc-handler> applies to the entire
class.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="doc">
<xsd:annotation>
<xsd:documentation>
A documentation string that will be exposed to Python.
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:whiteSpace value="preserve"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="to-pyobject">
<xsd:annotation>
<xsd:documentation>
Specifies how to convert a particular type to ``PyObject*``.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType mixed="true">
<xsd:choice maxOccurs="unbounded" minOccurs="0">
<xsd:element ref="val"/>
</xsd:choice>
<xsd:attribute name="type" type="symbol">
<xsd:annotation>
<xsd:documentation>
The type the conversion applies to.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="from-pyobject">
<xsd:annotation>
<xsd:documentation>
Specifies how to convert ``PyObject*`` to a particular type.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType mixed="true">
<xsd:choice maxOccurs="unbounded" minOccurs="0">
<xsd:element ref="val"/>
</xsd:choice>
<xsd:attribute name="type" type="symbol">
<xsd:annotation>
<xsd:documentation>
The C++ type the conversion applies to.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="val">
<xsd:annotation>
<xsd:documentation>
This tag gets replaced by the expression that needs to be converted.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType/>
</xsd:element>
<xsd:element name="var">
<xsd:annotation>
<xsd:documentation>
Specifies a variable
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:attribute name="name" type="ident">
<xsd:annotation>
<xsd:documentation>
The name of the variable. If not specified, the name is taken from ``value``,
which must be a legal Python identifier.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="value" type="expression" use="required">
<xsd:annotation>
<xsd:documentation>
The value of the variable. This can be any C++ expression and may include
macros.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="ref">
<xsd:annotation>
<xsd:documentation>
Specifies whether to pass ``value`` by value or by reference.
The following are allowed:
================ ===============================================================
true Pass by reference. This is the default. If the value cannot be
taken by reference (for example: if it's the result of a
function that returns by copy), it's taken by copy instead.
false Pass by copy
copy Same as "false"
managedptr If ``value`` evaluates to a pointer, the pointer is kept and
``delete`` is called on it when the Python object is destroyed.
unmanagedref Same as "true"
================ ===============================================================
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:union memberTypes="xsd:boolean">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="copy"/>
<xsd:enumeration value="managedptr"/>
<xsd:enumeration value="unmanagedref"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:union>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="gc-handler">
<xsd:annotation>
<xsd:documentation>
Specifies how to visit a data type containing a Python reference in a
tp_traverse function and optionally how to clear it in a tp_clear function.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:all>
<xsd:element name="traverse">
<xsd:complexType mixed="true">
<xsd:choice maxOccurs="unbounded" minOccurs="0">
<xsd:element ref="val"/>
</xsd:choice>
</xsd:complexType>
</xsd:element>
<xsd:element name="clear" minOccurs="0">
<xsd:complexType mixed="true">
<xsd:choice maxOccurs="unbounded" minOccurs="0">
<xsd:element ref="val"/>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:all>
<xsd:attribute name="type" type="symbol"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>