1
- # Copyright (c) 2018, 2019 , Oracle and/or its affiliates. All rights reserved.
1
+ # Copyright (c) 2018, 2020 , Oracle and/or its affiliates. All rights reserved.
2
2
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3
3
#
4
4
# The Universal Permissive License (UPL), Version 1.0
@@ -55,10 +55,37 @@ class CDLL(object):
55
55
pass
56
56
57
57
58
- class _SimpleCData :
58
+ # Dummy classes:
59
+
60
+
61
+ class _CData :
62
+ pass
63
+
64
+
65
+ class _Array (_CData ):
66
+ pass
67
+
68
+
69
+
70
+ class _SimpleCDataMetaCls (type ):
71
+ """
72
+ Dummy implementation of the operators on _SimpleCDatan subclasses.
73
+
74
+ For example: ctypes.c_int * 3 gives dynamically created class representing
75
+ the type of the array.
76
+ """
77
+
78
+ def __mul__ (self , other ):
79
+ return type (self .__name__ + '_Array_' + str (other ), (_Array , object ,), {})
80
+
81
+ def __rmul__ (self , other ):
82
+ return type (self .__name__ + '_Array_' + str (other ), (_Array , object ,), {})
83
+
84
+
85
+ class _SimpleCData (_CData , metaclass = _SimpleCDataMetaCls ):
59
86
pass
60
87
61
- # dummies
88
+
62
89
class c_void_p (_SimpleCData ):
63
90
_type_ = "P"
64
91
@@ -71,6 +98,30 @@ class c_int(_SimpleCData):
71
98
_type_ = "i"
72
99
73
100
101
+ class c_int32 (c_int ):
102
+ pass
103
+
104
+
105
+ class c_uint (_SimpleCData ):
106
+ _type_ = "I"
107
+
108
+
109
+ class c_uint32 (c_uint ):
110
+ pass
111
+
112
+
113
+ class c_ulong (_SimpleCData ):
114
+ _type_ = "L"
115
+
116
+
117
+ class c_uint64 (c_ulong ):
118
+ pass
119
+
120
+
121
+ class c_char (_SimpleCData ):
122
+ _type_ = "c"
123
+
124
+
74
125
class py_object (_SimpleCData ):
75
126
_type_ = "O"
76
127
def __repr__ (self ):
0 commit comments