]> git.cworth.org Git - apitrace/blob - specs/stdapi.py
Merge remote-tracking branch 'jbenton/master'
[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, internal=False):
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         self.internal = internal
360
361     def prototype(self, name=None):
362         if name is not None:
363             name = name.strip()
364         else:
365             name = self.name
366         s = name
367         if self.call:
368             s = self.call + ' ' + s
369         if name.startswith('*'):
370             s = '(' + s + ')'
371         s = self.type.expr + ' ' + s
372         s += "("
373         if self.args:
374             s += ", ".join(["%s %s" % (arg.type, arg.name) for arg in self.args])
375         else:
376             s += "void"
377         s += ")"
378         return s
379
380     def argNames(self):
381         return [arg.name for arg in self.args]
382
383
384 def StdFunction(*args, **kwargs):
385     kwargs.setdefault('call', '__stdcall')
386     return Function(*args, **kwargs)
387
388
389 def FunctionPointer(type, name, args, **kwargs):
390     # XXX: We should probably treat function pointers (callbacks or not) in a generic fashion
391     return Opaque(name)
392
393
394 class Interface(Type):
395
396     def __init__(self, name, base=None):
397         Type.__init__(self, name)
398         self.name = name
399         self.base = base
400         self.methods = []
401
402     def visit(self, visitor, *args, **kwargs):
403         return visitor.visitInterface(self, *args, **kwargs)
404
405     def getMethodByName(self, name):
406         for method in self.iterMethods():
407             if method.name == name:
408                 return method
409         return None
410
411     def iterMethods(self):
412         if self.base is not None:
413             for method in self.base.iterMethods():
414                 yield method
415         for method in self.methods:
416             yield method
417         raise StopIteration
418
419     def iterBases(self):
420         iface = self
421         while iface is not None:
422             yield iface
423             iface = iface.base
424         raise StopIteration
425
426     def iterBaseMethods(self):
427         if self.base is not None:
428             for iface, method in self.base.iterBaseMethods():
429                 yield iface, method
430         for method in self.methods:
431             yield self, method
432         raise StopIteration
433
434
435 class Method(Function):
436
437     def __init__(self, type, name, args, call = '__stdcall', const=False, sideeffects=True):
438         Function.__init__(self, type, name, args, call = call, sideeffects=sideeffects)
439         for index in range(len(self.args)):
440             self.args[index].index = index + 1
441         self.const = const
442
443     def prototype(self, name=None):
444         s = Function.prototype(self, name)
445         if self.const:
446             s += ' const'
447         return s
448
449
450 def StdMethod(*args, **kwargs):
451     kwargs.setdefault('call', '__stdcall')
452     return Method(*args, **kwargs)
453
454
455 class String(Type):
456
457     def __init__(self, expr = "char *", length = None, kind = 'String'):
458         Type.__init__(self, expr)
459         self.length = length
460         self.kind = kind
461
462     def visit(self, visitor, *args, **kwargs):
463         return visitor.visitString(self, *args, **kwargs)
464
465
466 class Opaque(Type):
467     '''Opaque pointer.'''
468
469     def __init__(self, expr):
470         Type.__init__(self, expr)
471
472     def visit(self, visitor, *args, **kwargs):
473         return visitor.visitOpaque(self, *args, **kwargs)
474
475
476 def OpaquePointer(type, *args):
477     return Opaque(type.expr + ' *')
478
479 def OpaqueArray(type, size):
480     return Opaque(type.expr + ' *')
481
482 def OpaqueBlob(type, size):
483     return Opaque(type.expr + ' *')
484
485
486 class Polymorphic(Type):
487
488     def __init__(self, switchExpr, switchTypes, defaultType, contextLess=True):
489         Type.__init__(self, defaultType.expr)
490         self.switchExpr = switchExpr
491         self.switchTypes = switchTypes
492         self.defaultType = defaultType
493         self.contextLess = contextLess
494
495     def visit(self, visitor, *args, **kwargs):
496         return visitor.visitPolymorphic(self, *args, **kwargs)
497
498     def iterSwitch(self):
499         cases = [['default']]
500         types = [self.defaultType]
501
502         for expr, type in self.switchTypes:
503             case = 'case %s' % expr
504             try:
505                 i = types.index(type)
506             except ValueError:
507                 cases.append([case])
508                 types.append(type)
509             else:
510                 cases[i].append(case)
511
512         return zip(cases, types)
513
514
515 def EnumPolymorphic(enumName, switchExpr, switchTypes, defaultType, contextLess=True):
516     enumValues = [expr for expr, type in switchTypes]
517     enum = Enum(enumName, enumValues)
518     polymorphic = Polymorphic(switchExpr, switchTypes, defaultType, contextLess)
519     return enum, polymorphic
520
521
522 class Visitor:
523     '''Abstract visitor for the type hierarchy.'''
524
525     def visit(self, type, *args, **kwargs):
526         return type.visit(self, *args, **kwargs)
527
528     def visitVoid(self, void, *args, **kwargs):
529         raise NotImplementedError
530
531     def visitLiteral(self, literal, *args, **kwargs):
532         raise NotImplementedError
533
534     def visitString(self, string, *args, **kwargs):
535         raise NotImplementedError
536
537     def visitConst(self, const, *args, **kwargs):
538         raise NotImplementedError
539
540     def visitStruct(self, struct, *args, **kwargs):
541         raise NotImplementedError
542
543     def visitArray(self, array, *args, **kwargs):
544         raise NotImplementedError
545
546     def visitBlob(self, blob, *args, **kwargs):
547         raise NotImplementedError
548
549     def visitEnum(self, enum, *args, **kwargs):
550         raise NotImplementedError
551
552     def visitBitmask(self, bitmask, *args, **kwargs):
553         raise NotImplementedError
554
555     def visitPointer(self, pointer, *args, **kwargs):
556         raise NotImplementedError
557
558     def visitIntPointer(self, pointer, *args, **kwargs):
559         raise NotImplementedError
560
561     def visitObjPointer(self, pointer, *args, **kwargs):
562         raise NotImplementedError
563
564     def visitLinearPointer(self, pointer, *args, **kwargs):
565         raise NotImplementedError
566
567     def visitReference(self, reference, *args, **kwargs):
568         raise NotImplementedError
569
570     def visitHandle(self, handle, *args, **kwargs):
571         raise NotImplementedError
572
573     def visitAlias(self, alias, *args, **kwargs):
574         raise NotImplementedError
575
576     def visitOpaque(self, opaque, *args, **kwargs):
577         raise NotImplementedError
578
579     def visitInterface(self, interface, *args, **kwargs):
580         raise NotImplementedError
581
582     def visitPolymorphic(self, polymorphic, *args, **kwargs):
583         raise NotImplementedError
584         #return self.visit(polymorphic.defaultType, *args, **kwargs)
585
586
587 class OnceVisitor(Visitor):
588     '''Visitor that guarantees that each type is visited only once.'''
589
590     def __init__(self):
591         self.__visited = set()
592
593     def visit(self, type, *args, **kwargs):
594         if type not in self.__visited:
595             self.__visited.add(type)
596             return type.visit(self, *args, **kwargs)
597         return None
598
599
600 class Rebuilder(Visitor):
601     '''Visitor which rebuild types as it visits them.
602
603     By itself it is a no-op -- it is intended to be overwritten.
604     '''
605
606     def visitVoid(self, void):
607         return void
608
609     def visitLiteral(self, literal):
610         return literal
611
612     def visitString(self, string):
613         return string
614
615     def visitConst(self, const):
616         const_type = self.visit(const.type)
617         if const_type is const.type:
618             return const
619         else:
620             return Const(const_type)
621
622     def visitStruct(self, struct):
623         members = [(self.visit(type), name) for type, name in struct.members]
624         return Struct(struct.name, members)
625
626     def visitArray(self, array):
627         type = self.visit(array.type)
628         return Array(type, array.length)
629
630     def visitBlob(self, blob):
631         type = self.visit(blob.type)
632         return Blob(type, blob.size)
633
634     def visitEnum(self, enum):
635         return enum
636
637     def visitBitmask(self, bitmask):
638         type = self.visit(bitmask.type)
639         return Bitmask(type, bitmask.values)
640
641     def visitPointer(self, pointer):
642         pointer_type = self.visit(pointer.type)
643         if pointer_type is pointer.type:
644             return pointer
645         else:
646             return Pointer(pointer_type)
647
648     def visitIntPointer(self, pointer):
649         return pointer
650
651     def visitObjPointer(self, pointer):
652         pointer_type = self.visit(pointer.type)
653         if pointer_type is pointer.type:
654             return pointer
655         else:
656             return ObjPointer(pointer_type)
657
658     def visitLinearPointer(self, pointer):
659         pointer_type = self.visit(pointer.type)
660         if pointer_type is pointer.type:
661             return pointer
662         else:
663             return LinearPointer(pointer_type)
664
665     def visitReference(self, reference):
666         reference_type = self.visit(reference.type)
667         if reference_type is reference.type:
668             return reference
669         else:
670             return Reference(reference_type)
671
672     def visitHandle(self, handle):
673         handle_type = self.visit(handle.type)
674         if handle_type is handle.type:
675             return handle
676         else:
677             return Handle(handle.name, handle_type, range=handle.range, key=handle.key)
678
679     def visitAlias(self, alias):
680         alias_type = self.visit(alias.type)
681         if alias_type is alias.type:
682             return alias
683         else:
684             return Alias(alias.expr, alias_type)
685
686     def visitOpaque(self, opaque):
687         return opaque
688
689     def visitInterface(self, interface, *args, **kwargs):
690         return interface
691
692     def visitPolymorphic(self, polymorphic):
693         switchExpr = polymorphic.switchExpr
694         switchTypes = [(expr, self.visit(type)) for expr, type in polymorphic.switchTypes]
695         defaultType = self.visit(polymorphic.defaultType)
696         return Polymorphic(switchExpr, switchTypes, defaultType, polymorphic.contextLess)
697
698
699 class MutableRebuilder(Rebuilder):
700     '''Type visitor which derives a mutable type.'''
701
702     def visitConst(self, const):
703         # Strip out const qualifier
704         return const.type
705
706     def visitAlias(self, alias):
707         # Tear the alias on type changes
708         type = self.visit(alias.type)
709         if type is alias.type:
710             return alias
711         return type
712
713     def visitReference(self, reference):
714         # Strip out references
715         return reference.type
716
717
718 class Traverser(Visitor):
719     '''Visitor which all types.'''
720
721     def visitVoid(self, void, *args, **kwargs):
722         pass
723
724     def visitLiteral(self, literal, *args, **kwargs):
725         pass
726
727     def visitString(self, string, *args, **kwargs):
728         pass
729
730     def visitConst(self, const, *args, **kwargs):
731         self.visit(const.type, *args, **kwargs)
732
733     def visitStruct(self, struct, *args, **kwargs):
734         for type, name in struct.members:
735             self.visit(type, *args, **kwargs)
736
737     def visitArray(self, array, *args, **kwargs):
738         self.visit(array.type, *args, **kwargs)
739
740     def visitBlob(self, array, *args, **kwargs):
741         pass
742
743     def visitEnum(self, enum, *args, **kwargs):
744         pass
745
746     def visitBitmask(self, bitmask, *args, **kwargs):
747         self.visit(bitmask.type, *args, **kwargs)
748
749     def visitPointer(self, pointer, *args, **kwargs):
750         self.visit(pointer.type, *args, **kwargs)
751
752     def visitIntPointer(self, pointer, *args, **kwargs):
753         pass
754
755     def visitObjPointer(self, pointer, *args, **kwargs):
756         self.visit(pointer.type, *args, **kwargs)
757
758     def visitLinearPointer(self, pointer, *args, **kwargs):
759         self.visit(pointer.type, *args, **kwargs)
760
761     def visitReference(self, reference, *args, **kwargs):
762         self.visit(reference.type, *args, **kwargs)
763
764     def visitHandle(self, handle, *args, **kwargs):
765         self.visit(handle.type, *args, **kwargs)
766
767     def visitAlias(self, alias, *args, **kwargs):
768         self.visit(alias.type, *args, **kwargs)
769
770     def visitOpaque(self, opaque, *args, **kwargs):
771         pass
772
773     def visitInterface(self, interface, *args, **kwargs):
774         if interface.base is not None:
775             self.visit(interface.base, *args, **kwargs)
776         for method in interface.iterMethods():
777             for arg in method.args:
778                 self.visit(arg.type, *args, **kwargs)
779             self.visit(method.type, *args, **kwargs)
780
781     def visitPolymorphic(self, polymorphic, *args, **kwargs):
782         self.visit(polymorphic.defaultType, *args, **kwargs)
783         for expr, type in polymorphic.switchTypes:
784             self.visit(type, *args, **kwargs)
785
786
787 class Collector(Traverser):
788     '''Visitor which collects all unique types as it traverses them.'''
789
790     def __init__(self):
791         self.__visited = set()
792         self.types = []
793
794     def visit(self, type):
795         if type in self.__visited:
796             return
797         self.__visited.add(type)
798         Visitor.visit(self, type)
799         self.types.append(type)
800
801
802
803 class API:
804     '''API abstraction.
805
806     Essentially, a collection of types, functions, and interfaces.
807     '''
808
809     def __init__(self, name = None):
810         self.name = name
811         self.headers = []
812         self.functions = []
813         self.interfaces = []
814
815     def getAllTypes(self):
816         collector = Collector()
817         for function in self.functions:
818             for arg in function.args:
819                 collector.visit(arg.type)
820             collector.visit(function.type)
821         for interface in self.interfaces:
822             collector.visit(interface)
823             for method in interface.iterMethods():
824                 for arg in method.args:
825                     collector.visit(arg.type)
826                 collector.visit(method.type)
827         return collector.types
828
829     def getAllInterfaces(self):
830         types = self.getAllTypes()
831         interfaces = [type for type in types if isinstance(type, Interface)]
832         for interface in self.interfaces:
833             if interface not in interfaces:
834                 interfaces.append(interface)
835         return interfaces
836
837     def addFunction(self, function):
838         self.functions.append(function)
839
840     def addFunctions(self, functions):
841         for function in functions:
842             self.addFunction(function)
843
844     def addInterface(self, interface):
845         self.interfaces.append(interface)
846
847     def addInterfaces(self, interfaces):
848         self.interfaces.extend(interfaces)
849
850     def addApi(self, api):
851         self.headers.extend(api.headers)
852         self.addFunctions(api.functions)
853         self.addInterfaces(api.interfaces)
854
855     def getFunctionByName(self, name):
856         for function in self.functions:
857             if function.name == name:
858                 return function
859         return None
860
861
862 Bool = Literal("bool", "Bool")
863 SChar = Literal("signed char", "SInt")
864 UChar = Literal("unsigned char", "UInt")
865 Short = Literal("short", "SInt")
866 Int = Literal("int", "SInt")
867 Long = Literal("long", "SInt")
868 LongLong = Literal("long long", "SInt")
869 UShort = Literal("unsigned short", "UInt")
870 UInt = Literal("unsigned int", "UInt")
871 ULong = Literal("unsigned long", "UInt")
872 ULongLong = Literal("unsigned long long", "UInt")
873 Float = Literal("float", "Float")
874 Double = Literal("double", "Double")
875 SizeT = Literal("size_t", "UInt")
876
877 # C string (i.e., zero terminated)
878 CString = String()
879 WString = String("wchar_t *", kind="WString")
880
881 Int8 = Literal("int8_t", "SInt")
882 UInt8 = Literal("uint8_t", "UInt")
883 Int16 = Literal("int16_t", "SInt")
884 UInt16 = Literal("uint16_t", "UInt")
885 Int32 = Literal("int32_t", "SInt")
886 UInt32 = Literal("uint32_t", "UInt")
887 Int64 = Literal("int64_t", "SInt")
888 UInt64 = Literal("uint64_t", "UInt")