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