]> git.cworth.org Git - apitrace/blob - specs/stdapi.py
Handle variations of LockRect.
[apitrace] / specs / stdapi.py
1 ##########################################################################
2 #
3 # Copyright 2008-2010 VMware, Inc.
4 # All Rights Reserved.
5 #
6 # Permission is hereby granted, free of charge, to any person obtaining a copy
7 # of this software and associated documentation files (the "Software"), to deal
8 # in the Software without restriction, including without limitation the rights
9 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 # copies of the Software, and to permit persons to whom the Software is
11 # furnished to do so, subject to the following conditions:
12 #
13 # The above copyright notice and this permission notice shall be included in
14 # all copies or substantial portions of the Software.
15 #
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 # THE SOFTWARE.
23 #
24 ##########################################################################/
25
26 """C basic types"""
27
28
29 import debug
30
31
32 class Type:
33     """Base class for all types."""
34
35     __tags = set()
36
37     def __init__(self, expr, tag = None):
38         self.expr = expr
39
40         # Generate a default tag, used when naming functions that will operate
41         # on this type, so it should preferrably be something representative of
42         # the type.
43         if tag is None:
44             if expr is not None:
45                 tag = ''.join([c for c in expr if c.isalnum() or c in '_'])
46             else:
47                 tag = 'anonynoums'
48         else:
49             for c in tag:
50                 assert c.isalnum() or c in '_'
51
52         # Ensure it is unique.
53         if tag in Type.__tags:
54             suffix = 1
55             while tag + str(suffix) in Type.__tags:
56                 suffix += 1
57             tag += str(suffix)
58
59         assert tag not in Type.__tags
60         Type.__tags.add(tag)
61
62         self.tag = tag
63
64     def __str__(self):
65         """Return the C/C++ type expression for this type."""
66         return self.expr
67
68     def visit(self, visitor, *args, **kwargs):
69         raise NotImplementedError
70
71     def mutable(self):
72         '''Return a mutable version of this type.
73
74         Convenience wrapper around MutableRebuilder.'''
75         visitor = MutableRebuilder()
76         return visitor.visit(self)
77
78
79 class _Void(Type):
80     """Singleton void type."""
81
82     def __init__(self):
83         Type.__init__(self, "void")
84
85     def visit(self, visitor, *args, **kwargs):
86         return visitor.visitVoid(self, *args, **kwargs)
87
88 Void = _Void()
89
90
91 class Literal(Type):
92     """Class to describe literal types.
93
94     Types which are not defined in terms of other types, such as integers and
95     floats."""
96
97     def __init__(self, expr, kind):
98         Type.__init__(self, expr)
99         self.kind = kind
100
101     def visit(self, visitor, *args, **kwargs):
102         return visitor.visitLiteral(self, *args, **kwargs)
103
104
105 class Const(Type):
106
107     def __init__(self, type):
108         # While "const foo" and "foo const" are synonymous, "const foo *" and
109         # "foo * const" are not quite the same, and some compilers do enforce
110         # strict const correctness.
111         if isinstance(type, String) or type is WString:
112             # For strings we never intend to say a const pointer to chars, but
113             # rather a point to const chars.
114             expr = "const " + type.expr
115         elif type.expr.startswith("const ") or '*' in type.expr:
116             expr = type.expr + " const"
117         else:
118             # The most legible
119             expr = "const " + type.expr
120
121         Type.__init__(self, expr, 'C' + type.tag)
122
123         self.type = type
124
125     def visit(self, visitor, *args, **kwargs):
126         return visitor.visitConst(self, *args, **kwargs)
127
128
129 class Pointer(Type):
130
131     def __init__(self, type):
132         Type.__init__(self, type.expr + " *", 'P' + type.tag)
133         self.type = type
134
135     def visit(self, visitor, *args, **kwargs):
136         return visitor.visitPointer(self, *args, **kwargs)
137
138
139 class IntPointer(Type):
140     '''Integer encoded as a pointer.'''
141
142     def visit(self, visitor, *args, **kwargs):
143         return visitor.visitIntPointer(self, *args, **kwargs)
144
145
146 class ObjPointer(Type):
147     '''Pointer to an object.'''
148
149     def __init__(self, type):
150         Type.__init__(self, type.expr + " *", 'P' + type.tag)
151         self.type = type
152
153     def visit(self, visitor, *args, **kwargs):
154         return visitor.visitObjPointer(self, *args, **kwargs)
155
156
157 class LinearPointer(Type):
158     '''Pointer to a linear range of memory.'''
159
160     def __init__(self, type, size = None):
161         Type.__init__(self, type.expr + " *", 'P' + type.tag)
162         self.type = type
163         self.size = size
164
165     def visit(self, visitor, *args, **kwargs):
166         return visitor.visitLinearPointer(self, *args, **kwargs)
167
168
169 class Reference(Type):
170     '''C++ references.'''
171
172     def __init__(self, type):
173         Type.__init__(self, type.expr + " &", 'R' + type.tag)
174         self.type = type
175
176     def visit(self, visitor, *args, **kwargs):
177         return visitor.visitReference(self, *args, **kwargs)
178
179
180 class Handle(Type):
181
182     def __init__(self, name, type, range=None, key=None):
183         Type.__init__(self, type.expr, 'P' + type.tag)
184         self.name = name
185         self.type = type
186         self.range = range
187         self.key = key
188
189     def visit(self, visitor, *args, **kwargs):
190         return visitor.visitHandle(self, *args, **kwargs)
191
192
193 def ConstPointer(type):
194     return Pointer(Const(type))
195
196
197 class Enum(Type):
198
199     __id = 0
200
201     def __init__(self, name, values):
202         Type.__init__(self, name)
203
204         self.id = Enum.__id
205         Enum.__id += 1
206
207         self.values = list(values)
208
209     def visit(self, visitor, *args, **kwargs):
210         return visitor.visitEnum(self, *args, **kwargs)
211
212
213 def FakeEnum(type, values):
214     return Enum(type.expr, values)
215
216
217 class Bitmask(Type):
218
219     __id = 0
220
221     def __init__(self, type, values):
222         Type.__init__(self, type.expr)
223
224         self.id = Bitmask.__id
225         Bitmask.__id += 1
226
227         self.type = type
228         self.values = values
229
230     def visit(self, visitor, *args, **kwargs):
231         return visitor.visitBitmask(self, *args, **kwargs)
232
233 Flags = Bitmask
234
235
236 class Array(Type):
237
238     def __init__(self, type, length):
239         Type.__init__(self, type.expr + " *")
240         self.type = type
241         self.length = length
242
243     def visit(self, visitor, *args, **kwargs):
244         return visitor.visitArray(self, *args, **kwargs)
245
246
247 class Blob(Type):
248
249     def __init__(self, type, size):
250         Type.__init__(self, type.expr + ' *')
251         self.type = type
252         self.size = size
253
254     def visit(self, visitor, *args, **kwargs):
255         return visitor.visitBlob(self, *args, **kwargs)
256
257
258 class Struct(Type):
259
260     __id = 0
261
262     def __init__(self, name, members):
263         Type.__init__(self, name)
264
265         self.id = Struct.__id
266         Struct.__id += 1
267
268         self.name = name
269         self.members = []
270
271         # Eliminate anonymous unions
272         for type, name in members:
273             if name is not None:
274                 self.members.append((type, name))
275             else:
276                 assert isinstance(type, Union)
277                 assert type.name is None
278                 self.members.extend(type.members)
279
280     def visit(self, visitor, *args, **kwargs):
281         return visitor.visitStruct(self, *args, **kwargs)
282
283
284 class Union(Type):
285
286     __id = 0
287
288     def __init__(self, name, members):
289         Type.__init__(self, name)
290
291         self.id = Union.__id
292         Union.__id += 1
293
294         self.name = name
295         self.members = members
296
297
298 class Alias(Type):
299
300     def __init__(self, expr, type):
301         Type.__init__(self, expr)
302         self.type = type
303
304     def visit(self, visitor, *args, **kwargs):
305         return visitor.visitAlias(self, *args, **kwargs)
306
307 class Arg:
308
309     def __init__(self, type, name, input=True, output=False):
310         self.type = type
311         self.name = name
312         self.input = input
313         self.output = output
314         self.index = None
315
316     def __str__(self):
317         return '%s %s' % (self.type, self.name)
318
319
320 def In(type, name):
321     return Arg(type, name, input=True, output=False)
322
323 def Out(type, name):
324     return Arg(type, name, input=False, output=True)
325
326 def InOut(type, name):
327     return Arg(type, name, input=True, output=True)
328
329
330 class Function:
331
332     # 0-3 are reserved to memcpy, malloc, free, and realloc
333     __id = 4
334
335     def __init__(self, type, name, args, call = '', fail = None, sideeffects=True):
336         self.id = Function.__id
337         Function.__id += 1
338
339         self.type = type
340         self.name = name
341
342         self.args = []
343         index = 0
344         for arg in args:
345             if not isinstance(arg, Arg):
346                 if isinstance(arg, tuple):
347                     arg_type, arg_name = arg
348                 else:
349                     arg_type = arg
350                     arg_name = "arg%u" % index
351                 arg = Arg(arg_type, arg_name)
352             arg.index = index
353             index += 1
354             self.args.append(arg)
355
356         self.call = call
357         self.fail = fail
358         self.sideeffects = sideeffects
359
360     def prototype(self, name=None):
361         if name is not None:
362             name = name.strip()
363         else:
364             name = self.name
365         s = name
366         if self.call:
367             s = self.call + ' ' + s
368         if name.startswith('*'):
369             s = '(' + s + ')'
370         s = self.type.expr + ' ' + s
371         s += "("
372         if self.args:
373             s += ", ".join(["%s %s" % (arg.type, arg.name) for arg in self.args])
374         else:
375             s += "void"
376         s += ")"
377         return s
378
379     def argNames(self):
380         return [arg.name for arg in self.args]
381
382
383 def StdFunction(*args, **kwargs):
384     kwargs.setdefault('call', '__stdcall')
385     return Function(*args, **kwargs)
386
387
388 def FunctionPointer(type, name, args, **kwargs):
389     # XXX: We should probably treat function pointers (callbacks or not) in a generic fashion
390     return Opaque(name)
391
392
393 class Interface(Type):
394
395     def __init__(self, name, base=None):
396         Type.__init__(self, name)
397         self.name = name
398         self.base = base
399         self.methods = []
400
401     def visit(self, visitor, *args, **kwargs):
402         return visitor.visitInterface(self, *args, **kwargs)
403
404     def getMethodByName(self, name):
405         for method in self.iterMethods():
406             if method.name == name:
407                 return method
408         return None
409
410     def iterMethods(self):
411         if self.base is not None:
412             for method in self.base.iterMethods():
413                 yield method
414         for method in self.methods:
415             yield method
416         raise StopIteration
417
418     def iterBases(self):
419         iface = self
420         while iface is not None:
421             yield iface
422             iface = iface.base
423         raise StopIteration
424
425     def iterBaseMethods(self):
426         if self.base is not None:
427             for iface, method in self.base.iterBaseMethods():
428                 yield iface, method
429         for method in self.methods:
430             yield self, method
431         raise StopIteration
432
433
434 class Method(Function):
435
436     def __init__(self, type, name, args, call = '__stdcall', const=False, sideeffects=True):
437         Function.__init__(self, type, name, args, call = call, sideeffects=sideeffects)
438         for index in range(len(self.args)):
439             self.args[index].index = index + 1
440         self.const = const
441
442     def prototype(self, name=None):
443         s = Function.prototype(self, name)
444         if self.const:
445             s += ' const'
446         return s
447
448
449 def StdMethod(*args, **kwargs):
450     kwargs.setdefault('call', '__stdcall')
451     return Method(*args, **kwargs)
452
453
454 class String(Type):
455
456     def __init__(self, expr = "char *", length = None, kind = 'String'):
457         Type.__init__(self, expr)
458         self.length = length
459         self.kind = kind
460
461     def visit(self, visitor, *args, **kwargs):
462         return visitor.visitString(self, *args, **kwargs)
463
464
465 class Opaque(Type):
466     '''Opaque pointer.'''
467
468     def __init__(self, expr):
469         Type.__init__(self, expr)
470
471     def visit(self, visitor, *args, **kwargs):
472         return visitor.visitOpaque(self, *args, **kwargs)
473
474
475 def OpaquePointer(type, *args):
476     return Opaque(type.expr + ' *')
477
478 def OpaqueArray(type, size):
479     return Opaque(type.expr + ' *')
480
481 def OpaqueBlob(type, size):
482     return Opaque(type.expr + ' *')
483
484
485 class Polymorphic(Type):
486
487     def __init__(self, switchExpr, switchTypes, defaultType, contextLess=True):
488         Type.__init__(self, defaultType.expr)
489         self.switchExpr = switchExpr
490         self.switchTypes = switchTypes
491         self.defaultType = defaultType
492         self.contextLess = contextLess
493
494     def visit(self, visitor, *args, **kwargs):
495         return visitor.visitPolymorphic(self, *args, **kwargs)
496
497     def iterSwitch(self):
498         cases = [['default']]
499         types = [self.defaultType]
500
501         for expr, type in self.switchTypes:
502             case = 'case %s' % expr
503             try:
504                 i = types.index(type)
505             except ValueError:
506                 cases.append([case])
507                 types.append(type)
508             else:
509                 cases[i].append(case)
510
511         return zip(cases, types)
512
513
514 def EnumPolymorphic(enumName, switchExpr, switchTypes, defaultType, contextLess=True):
515     enumValues = [expr for expr, type in switchTypes]
516     enum = Enum(enumName, enumValues)
517     polymorphic = Polymorphic(switchExpr, switchTypes, defaultType, contextLess)
518     return enum, polymorphic
519
520
521 class Visitor:
522     '''Abstract visitor for the type hierarchy.'''
523
524     def visit(self, type, *args, **kwargs):
525         return type.visit(self, *args, **kwargs)
526
527     def visitVoid(self, void, *args, **kwargs):
528         raise NotImplementedError
529
530     def visitLiteral(self, literal, *args, **kwargs):
531         raise NotImplementedError
532
533     def visitString(self, string, *args, **kwargs):
534         raise NotImplementedError
535
536     def visitConst(self, const, *args, **kwargs):
537         raise NotImplementedError
538
539     def visitStruct(self, struct, *args, **kwargs):
540         raise NotImplementedError
541
542     def visitArray(self, array, *args, **kwargs):
543         raise NotImplementedError
544
545     def visitBlob(self, blob, *args, **kwargs):
546         raise NotImplementedError
547
548     def visitEnum(self, enum, *args, **kwargs):
549         raise NotImplementedError
550
551     def visitBitmask(self, bitmask, *args, **kwargs):
552         raise NotImplementedError
553
554     def visitPointer(self, pointer, *args, **kwargs):
555         raise NotImplementedError
556
557     def visitIntPointer(self, pointer, *args, **kwargs):
558         raise NotImplementedError
559
560     def visitObjPointer(self, pointer, *args, **kwargs):
561         raise NotImplementedError
562
563     def visitLinearPointer(self, pointer, *args, **kwargs):
564         raise NotImplementedError
565
566     def visitReference(self, reference, *args, **kwargs):
567         raise NotImplementedError
568
569     def visitHandle(self, handle, *args, **kwargs):
570         raise NotImplementedError
571
572     def visitAlias(self, alias, *args, **kwargs):
573         raise NotImplementedError
574
575     def visitOpaque(self, opaque, *args, **kwargs):
576         raise NotImplementedError
577
578     def visitInterface(self, interface, *args, **kwargs):
579         raise NotImplementedError
580
581     def visitPolymorphic(self, polymorphic, *args, **kwargs):
582         raise NotImplementedError
583         #return self.visit(polymorphic.defaultType, *args, **kwargs)
584
585
586 class OnceVisitor(Visitor):
587     '''Visitor that guarantees that each type is visited only once.'''
588
589     def __init__(self):
590         self.__visited = set()
591
592     def visit(self, type, *args, **kwargs):
593         if type not in self.__visited:
594             self.__visited.add(type)
595             return type.visit(self, *args, **kwargs)
596         return None
597
598
599 class Rebuilder(Visitor):
600     '''Visitor which rebuild types as it visits them.
601
602     By itself it is a no-op -- it is intended to be overwritten.
603     '''
604
605     def visitVoid(self, void):
606         return void
607
608     def visitLiteral(self, literal):
609         return literal
610
611     def visitString(self, string):
612         return string
613
614     def visitConst(self, const):
615         const_type = self.visit(const.type)
616         if const_type is const.type:
617             return const
618         else:
619             return Const(const_type)
620
621     def visitStruct(self, struct):
622         members = [(self.visit(type), name) for type, name in struct.members]
623         return Struct(struct.name, members)
624
625     def visitArray(self, array):
626         type = self.visit(array.type)
627         return Array(type, array.length)
628
629     def visitBlob(self, blob):
630         type = self.visit(blob.type)
631         return Blob(type, blob.size)
632
633     def visitEnum(self, enum):
634         return enum
635
636     def visitBitmask(self, bitmask):
637         type = self.visit(bitmask.type)
638         return Bitmask(type, bitmask.values)
639
640     def visitPointer(self, pointer):
641         pointer_type = self.visit(pointer.type)
642         if pointer_type is pointer.type:
643             return pointer
644         else:
645             return Pointer(pointer_type)
646
647     def visitIntPointer(self, pointer):
648         return pointer
649
650     def visitObjPointer(self, pointer):
651         pointer_type = self.visit(pointer.type)
652         if pointer_type is pointer.type:
653             return pointer
654         else:
655             return ObjPointer(pointer_type)
656
657     def visitLinearPointer(self, pointer):
658         pointer_type = self.visit(pointer.type)
659         if pointer_type is pointer.type:
660             return pointer
661         else:
662             return LinearPointer(pointer_type)
663
664     def visitReference(self, reference):
665         reference_type = self.visit(reference.type)
666         if reference_type is reference.type:
667             return reference
668         else:
669             return Reference(reference_type)
670
671     def visitHandle(self, handle):
672         handle_type = self.visit(handle.type)
673         if handle_type is handle.type:
674             return handle
675         else:
676             return Handle(handle.name, handle_type, range=handle.range, key=handle.key)
677
678     def visitAlias(self, alias):
679         alias_type = self.visit(alias.type)
680         if alias_type is alias.type:
681             return alias
682         else:
683             return Alias(alias.expr, alias_type)
684
685     def visitOpaque(self, opaque):
686         return opaque
687
688     def visitInterface(self, interface, *args, **kwargs):
689         return interface
690
691     def visitPolymorphic(self, polymorphic):
692         switchExpr = polymorphic.switchExpr
693         switchTypes = [(expr, self.visit(type)) for expr, type in polymorphic.switchTypes]
694         defaultType = self.visit(polymorphic.defaultType)
695         return Polymorphic(switchExpr, switchTypes, defaultType, polymorphic.contextLess)
696
697
698 class MutableRebuilder(Rebuilder):
699     '''Type visitor which derives a mutable type.'''
700
701     def visitConst(self, const):
702         # Strip out const qualifier
703         return const.type
704
705     def visitAlias(self, alias):
706         # Tear the alias on type changes
707         type = self.visit(alias.type)
708         if type is alias.type:
709             return alias
710         return type
711
712     def visitReference(self, reference):
713         # Strip out references
714         return reference.type
715
716
717 class Traverser(Visitor):
718     '''Visitor which all types.'''
719
720     def visitVoid(self, void, *args, **kwargs):
721         pass
722
723     def visitLiteral(self, literal, *args, **kwargs):
724         pass
725
726     def visitString(self, string, *args, **kwargs):
727         pass
728
729     def visitConst(self, const, *args, **kwargs):
730         self.visit(const.type, *args, **kwargs)
731
732     def visitStruct(self, struct, *args, **kwargs):
733         for type, name in struct.members:
734             self.visit(type, *args, **kwargs)
735
736     def visitArray(self, array, *args, **kwargs):
737         self.visit(array.type, *args, **kwargs)
738
739     def visitBlob(self, array, *args, **kwargs):
740         pass
741
742     def visitEnum(self, enum, *args, **kwargs):
743         pass
744
745     def visitBitmask(self, bitmask, *args, **kwargs):
746         self.visit(bitmask.type, *args, **kwargs)
747
748     def visitPointer(self, pointer, *args, **kwargs):
749         self.visit(pointer.type, *args, **kwargs)
750
751     def visitIntPointer(self, pointer, *args, **kwargs):
752         pass
753
754     def visitObjPointer(self, pointer, *args, **kwargs):
755         self.visit(pointer.type, *args, **kwargs)
756
757     def visitLinearPointer(self, pointer, *args, **kwargs):
758         self.visit(pointer.type, *args, **kwargs)
759
760     def visitReference(self, reference, *args, **kwargs):
761         self.visit(reference.type, *args, **kwargs)
762
763     def visitHandle(self, handle, *args, **kwargs):
764         self.visit(handle.type, *args, **kwargs)
765
766     def visitAlias(self, alias, *args, **kwargs):
767         self.visit(alias.type, *args, **kwargs)
768
769     def visitOpaque(self, opaque, *args, **kwargs):
770         pass
771
772     def visitInterface(self, interface, *args, **kwargs):
773         if interface.base is not None:
774             self.visit(interface.base, *args, **kwargs)
775         for method in interface.iterMethods():
776             for arg in method.args:
777                 self.visit(arg.type, *args, **kwargs)
778             self.visit(method.type, *args, **kwargs)
779
780     def visitPolymorphic(self, polymorphic, *args, **kwargs):
781         self.visit(polymorphic.defaultType, *args, **kwargs)
782         for expr, type in polymorphic.switchTypes:
783             self.visit(type, *args, **kwargs)
784
785
786 class Collector(Traverser):
787     '''Visitor which collects all unique types as it traverses them.'''
788
789     def __init__(self):
790         self.__visited = set()
791         self.types = []
792
793     def visit(self, type):
794         if type in self.__visited:
795             return
796         self.__visited.add(type)
797         Visitor.visit(self, type)
798         self.types.append(type)
799
800
801
802 class API:
803     '''API abstraction.
804
805     Essentially, a collection of types, functions, and interfaces.
806     '''
807
808     def __init__(self, name = None):
809         self.name = name
810         self.headers = []
811         self.functions = []
812         self.interfaces = []
813
814     def getAllTypes(self):
815         collector = Collector()
816         for function in self.functions:
817             for arg in function.args:
818                 collector.visit(arg.type)
819             collector.visit(function.type)
820         for interface in self.interfaces:
821             collector.visit(interface)
822             for method in interface.iterMethods():
823                 for arg in method.args:
824                     collector.visit(arg.type)
825                 collector.visit(method.type)
826         return collector.types
827
828     def getAllInterfaces(self):
829         types = self.getAllTypes()
830         interfaces = [type for type in types if isinstance(type, Interface)]
831         for interface in self.interfaces:
832             if interface not in interfaces:
833                 interfaces.append(interface)
834         return interfaces
835
836     def addFunction(self, function):
837         self.functions.append(function)
838
839     def addFunctions(self, functions):
840         for function in functions:
841             self.addFunction(function)
842
843     def addInterface(self, interface):
844         self.interfaces.append(interface)
845
846     def addInterfaces(self, interfaces):
847         self.interfaces.extend(interfaces)
848
849     def addApi(self, api):
850         self.headers.extend(api.headers)
851         self.addFunctions(api.functions)
852         self.addInterfaces(api.interfaces)
853
854     def getFunctionByName(self, name):
855         for function in self.functions:
856             if function.name == name:
857                 return function
858         return None
859
860
861 Bool = Literal("bool", "Bool")
862 SChar = Literal("signed char", "SInt")
863 UChar = Literal("unsigned char", "UInt")
864 Short = Literal("short", "SInt")
865 Int = Literal("int", "SInt")
866 Long = Literal("long", "SInt")
867 LongLong = Literal("long long", "SInt")
868 UShort = Literal("unsigned short", "UInt")
869 UInt = Literal("unsigned int", "UInt")
870 ULong = Literal("unsigned long", "UInt")
871 ULongLong = Literal("unsigned long long", "UInt")
872 Float = Literal("float", "Float")
873 Double = Literal("double", "Double")
874 SizeT = Literal("size_t", "UInt")
875
876 # C string (i.e., zero terminated)
877 CString = String()
878 WString = String("wchar_t *", kind="WString")
879
880 Int8 = Literal("int8_t", "SInt")
881 UInt8 = Literal("uint8_t", "UInt")
882 Int16 = Literal("int16_t", "SInt")
883 UInt16 = Literal("uint16_t", "UInt")
884 Int32 = Literal("int32_t", "SInt")
885 UInt32 = Literal("uint32_t", "UInt")
886 Int64 = Literal("int64_t", "SInt")
887 UInt64 = Literal("uint64_t", "UInt")