forked from clj-python/libpython-clj
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjna.clj
406 lines (364 loc) · 12.9 KB
/
jna.clj
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
(ns libpython-clj.jna
(:require [tech.v2.datatype :as dtype]
[tech.jna :as jna]
[tech.jna.base :as jna-base]
[tech.v2.datatype.typecast :as typecast]
[camel-snake-kebab.core :refer [->kebab-case]]
[tech.parallel.utils :refer [export-symbols]]
[libpython-clj.jna.base
:refer [def-pylib-fn
ensure-pyobj]]
[libpython-clj.jna.base]
[libpython-clj.jna.interpreter]
[libpython-clj.jna.protocols.object]
[libpython-clj.jna.protocols.iterator]
[libpython-clj.jna.protocols.sequence]
[libpython-clj.jna.protocols.mapping]
[libpython-clj.jna.protocols.buffer]
[libpython-clj.jna.concrete.numeric.integer]
[libpython-clj.jna.concrete.numeric.float]
[libpython-clj.jna.concrete.numeric.boolean]
[libpython-clj.jna.concrete.numeric.complex]
[libpython-clj.jna.concrete.tuple]
[libpython-clj.jna.concrete.list]
[libpython-clj.jna.concrete.set]
[libpython-clj.jna.concrete.dict]
[libpython-clj.jna.concrete.unicode]
[libpython-clj.jna.concrete.cfunction]
[libpython-clj.jna.concrete.import]
[libpython-clj.jna.concrete.module]
[libpython-clj.jna.concrete.type]
[libpython-clj.jna.concrete.err])
(:import [com.sun.jna Pointer NativeLibrary]))
(export-symbols libpython-clj.jna.base
find-pylib-symbol)
(export-symbols libpython-clj.jna.interpreter
Py_InitializeEx
Py_IsInitialized
Py_FinalizeEx
PyRun_SimpleString
PySys_SetArgv
get-type-name
lookup-type-symbols
Py_None
Py_NotImplemented
PyMem_Free
PyEval_RestoreThread
PyEval_SaveThread
PyThreadState_Get
PyThreadState_Swap
PyRun_String
PyRun_StringFlags)
(export-symbols libpython-clj.jna.protocols.object
Py_DecRef
Py_IncRef
PyObject_Type
PyObject_Repr
PyObject_Str
PyObject_HasAttr
PyObject_HasAttrString
PyObject_GetAttr
PyObject_GetAttrString
PyObject_GenericGetAttr
PyObject_SetAttr
PyObject_SetAttrString
PyObject_GenericSetAttr
PyObject_DelAttr
PyObject_DelAttrString
PyObject_GenericGetDict
PyObject_GenericSetDict
PyObject_RichCompare
PyObject_RichCompareBool
PyCallable_Check
PyObject_Call
PyObject_CallObject
PyObject_Hash
PyObject_IsTrue
PyObject_Not
PyObject_Length
PyObject_GetItem
PyObject_SetItem
PyObject_DelItem
PyObject_Dir
PyObject_GetIter)
(export-symbols libpython-clj.jna.protocols.iterator
PyIter_Check
PyIter_Next)
(export-symbols libpython-clj.jna.protocols.sequence
PySequence_Check
PySequence_Concat
PySequence_Contains
PySequence_Count
PySequence_DelItem
PySequence_DelSlice
PySequence_GetItem
PySequence_GetSlice
PySequence_InPlaceConcat
PySequence_InPlaceRepeat
PySequence_Index
PySequence_Length
PySequence_List
PySequence_Repeat
PySequence_SetItem
PySequence_SetSlice
PySequence_Tuple)
(export-symbols libpython-clj.jna.protocols.mapping
PyMapping_Check
PyMapping_DelItem
PyMapping_DelItemString
PyMapping_GetItemString
PyMapping_HasKey
PyMapping_HasKeyString
PyMapping_Items
PyMapping_Keys
PyMapping_Length
PyMapping_SetItemString
PyMapping_Values)
(export-symbols libpython-clj.jna.protocols.buffer
PyBUF_ANY_CONTIGUOUS
PyBUF_CONTIG
PyBUF_CONTIG_RO
PyBUF_C_CONTIGUOUS
PyBUF_FORMAT
PyBUF_FULL
PyBUF_FULL_RO
PyBUF_F_CONTIGUOUS
PyBUF_INDIRECT
PyBUF_MAX_NDIM
PyBUF_ND
PyBUF_READ
PyBUF_RECORDS
PyBUF_RECORDS_RO
PyBUF_SIMPLE
PyBUF_STRIDED
PyBUF_STRIDED_RO
PyBUF_STRIDES
PyBUF_WRITABLE
PyBUF_WRITE
PyBUF_WRITEABLE
PyBuffer_IsContiguous
PyBuffer_Release
PyBuffer_ToContiguous
PyObject_CheckBuffer
PyObject_GetBuffer)
(export-symbols libpython-clj.jna.concrete.numeric.integer
PyLong_Check
PyLong_CheckExact
PyLong_FromLong
PyLong_FromUnsignedLong
PyLong_FromSsize_t
PyLong_FromLongLong
PyLong_FromUnsignedLongLong
PyLong_FromDouble
PyLong_AsLong
PyLong_AsLongLong)
(export-symbols libpython-clj.jna.concrete.numeric.float
PyFloat_AsDouble
PyFloat_Check
PyFloat_CheckExact
PyFloat_FromDouble
PyFloat_FromString
PyFloat_GetInfo
PyFloat_GetMax
PyFloat_GetMin)
(export-symbols libpython-clj.jna.concrete.numeric.boolean
PyBool_Check
PyBool_FromLong
Py_False
Py_True)
(export-symbols libpython-clj.jna.concrete.numeric.complex
PyComplex_AsCComplex
PyComplex_Check
PyComplex_FromCComplex
PyComplex_FromDoubles
PyComplex_ImagAsDouble
PyComplex_RealAsDouble)
(export-symbols libpython-clj.jna.concrete.tuple
PyTuple_Check
PyTuple_GetItem
PyTuple_GetSlice
PyTuple_New
PyTuple_SetItem)
(export-symbols libpython-clj.jna.concrete.list
PyList_Append
PyList_AsTuple
PyList_Check
PyList_GetItem
PyList_GetSlice
PyList_Insert
PyList_New
PyList_Reverse
PyList_SetItem
PyList_SetSlice
PyList_Size
PyList_Sort)
(export-symbols libpython-clj.jna.concrete.set
PyFrozenSet_Check
PyFrozenSet_New
PySet_Add
PySet_Check
PySet_Clear
PySet_Contains
PySet_Discard
PySet_New
PySet_Pop)
(export-symbols libpython-clj.jna.concrete.dict
PyDictProxy_New
PyDict_Check
PyDict_Clear
PyDict_Contains
PyDict_Copy
PyDict_DelItem
PyDict_DelItemString
PyDict_GetItem
PyDict_GetItemString
PyDict_GetItemWithError
PyDict_Items
PyDict_Keys
PyDict_Merge
PyDict_MergeFromSeq2
PyDict_New
PyDict_Next
PyDict_SetDefault
PyDict_SetItem
PyDict_SetItemString
PyDict_Size
PyDict_Update
PyDict_Values)
(export-symbols libpython-clj.jna.concrete.unicode
PyUnicode_AsEncodedString
PyUnicode_AsUTF8AndSize
PyUnicode_AsUTF8
PyUnicode_Decode)
(export-symbols libpython-clj.jna.concrete.cfunction
METH_CLASS
METH_COEXIST
METH_KEYWORDS
METH_NOARGS
METH_O
METH_STATIC
METH_VARARGS
PyCFunction_New)
(export-symbols libpython-clj.jna.concrete.import
PyImport_ImportModule
PyImport_Import
PyImport_AddModule
PyImport_ImportModuleLevel
PyImport_GetModuleDict)
(export-symbols libpython-clj.jna.concrete.type
PyObject_Del
PyType_Check
PyType_GenericNew
PyType_Ready
Py_TPFLAGS_BASETYPE
Py_TPFLAGS_DEFAULT
Py_TPFLAGS_HAVE_GC
Py_TPFLAGS_HAVE_STACKLESS_EXTENSION
Py_TPFLAGS_HAVE_VERSION_TAG
Py_TPFLAGS_HEAPTYPE
Py_TPFLAGS_IS_ABSTRACT
Py_TPFLAGS_READY
Py_TPFLAGS_READYING
Py_TPFLAGS_VALID_VERSION_TAG
_PyObject_New)
(export-symbols libpython-clj.jna.concrete.module
PyModule_AddFunctions
PyModule_AddIntConstant
PyModule_AddObject
PyModule_AddStringConstant
PyModule_Check
PyModule_GetDef
PyModule_GetDict
PyModule_GetNameObject
PyModule_GetState
PyModule_New
PyModule_SetDocString)
(export-symbols libpython-clj.jna.concrete.err
PyErr_BadArgument
PyErr_BadInternalCall
PyErr_Clear
PyErr_Fetch
PyErr_NoMemory
PyErr_Print
PyErr_PrintEx
PyErr_Restore
PyErr_SetFromErrno
PyErr_SetNone
PyErr_SetObject
PyErr_SetString
PyErr_WarnEx
PyErr_WarnExplicit
PyErr_WriteUnraisable
PyErr_Occurred
;; Exception classes
PyExc_ArithmeticError
PyExc_AssertionError
PyExc_AttributeError
PyExc_BaseException
PyExc_BlockingIOError
PyExc_BrokenPipeError
PyExc_BufferError
PyExc_BytesWarning
PyExc_ChildProcessError
PyExc_ConnectionAbortedError
PyExc_ConnectionError
PyExc_ConnectionRefusedError
PyExc_ConnectionResetError
PyExc_DeprecationWarning
PyExc_EOFError
PyExc_Exception
PyExc_FileExistsError
PyExc_FileNotFoundError
PyExc_FloatingPointError
PyExc_FutureWarning
PyExc_GeneratorExit
PyExc_ImportError
PyExc_ImportWarning
PyExc_IndentationError
PyExc_IndexError
PyExc_InterruptedError
PyExc_IsADirectoryError
PyExc_KeyError
PyExc_KeyboardInterrupt
PyExc_LookupError
PyExc_MemoryError
PyExc_ModuleNotFoundError
PyExc_NameError
PyExc_NotADirectoryError
PyExc_NotImplementedError
PyExc_OSError
PyExc_OverflowError
PyExc_PendingDeprecationWarning
PyExc_PermissionError
PyExc_ProcessLookupError
PyExc_RecursionError
PyExc_ReferenceError
PyExc_ResourceWarning
PyExc_RuntimeError
PyExc_RuntimeWarning
PyExc_StopAsyncIteration
PyExc_StopIteration
PyExc_SyntaxError
PyExc_SyntaxWarning
PyExc_SystemError
PyExc_SystemExit
PyExc_TabError
PyExc_TimeoutError
PyExc_TypeError
PyExc_UnboundLocalError
PyExc_UnicodeDecodeError
PyExc_UnicodeEncodeError
PyExc_UnicodeError
PyExc_UnicodeTranslateError
PyExc_UnicodeWarning
PyExc_UserWarning
PyExc_ValueError
PyExc_Warning
PyExc_ZeroDivisionError
;;Exception data system
PyException_GetCause
PyException_GetContext
PyException_GetTraceback
PyException_SetCause
PyException_SetContext
PyException_SetTraceback)