-
-
Notifications
You must be signed in to change notification settings - Fork 68
/
integer.clj
99 lines (68 loc) · 2.73 KB
/
integer.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
(ns libpython-clj.jna.concrete.numeric.integer
(:require [libpython-clj.jna.base
:refer [def-pylib-fn
ensure-pyobj
ensure-pytuple
ensure-pydict
*python-library*]
:as libpy-base]
[tech.jna :as jna])
(:import [com.sun.jna Pointer]
[libpython_clj.jna PyObject]))
(def-pylib-fn PyLong_Check
"Return true if its argument is a PyLongObject or a subtype of PyLongObject."
Integer
[p ensure-pyobj])
(def-pylib-fn PyLong_CheckExact
"Return true if its argument is a PyLongObject, but not a subtype of PyLongObject."
Integer
[p ensure-pyobj])
(def-pylib-fn PyLong_FromLong
"Return value: New reference.
Return a new PyLongObject object from v, or NULL on failure.
The current implementation keeps an array of integer objects for all integers between
-5 and 256, when you create an int in that range you actually just get back a
reference to the existing object. So it should be possible to change the value of
1. I suspect the behaviour of Python in this case is undefined. :-)"
Pointer
[v int])
(def-pylib-fn PyLong_FromUnsignedLong
"Return value: New reference.
Return a new PyLongObject object from a C unsigned long, or NULL on failure."
Pointer
[v unchecked-int])
(def-pylib-fn PyLong_FromSsize_t
"Return value: New reference.
Return a new PyLongObject object from a C Py_ssize_t, or NULL on failure."
Pointer
[v jna/size-t])
(def-pylib-fn PyLong_FromLongLong
"Return value: New reference.
Return a new PyLongObject object from a C long long, or NULL on failure."
Pointer
[v long])
(def-pylib-fn PyLong_FromUnsignedLongLong
"Return value: New reference.
Return a new PyLongObject object from a C unsigned long long, or NULL on failure."
Pointer
[v unchecked-long])
(def-pylib-fn PyLong_FromDouble
"Return value: New reference.
Return a new PyLongObject object from the integer part of v, or NULL on failure."
Pointer
[v double])
(def-pylib-fn PyLong_AsLong
"Return a C long representation of obj. If obj is not an instance of PyLongObject,
first call its __int__() method (if present) to convert it to a PyLongObject.
Raise OverflowError if the value of obj is out of range for a long.
Returns -1 on error. Use PyErr_Occurred() to disambiguate."
Integer
[obj ensure-pyobj])
(def-pylib-fn PyLong_AsLongLong
"Return a C long long representation of obj. If obj is not an instance of
PyLongObject, first call its __int__() method (if present) to convert it to a
PyLongObject.
Raise OverflowError if the value of obj is out of range for a long.
Returns -1 on error. Use PyErr_Occurred() to disambiguate."
Long
[obj ensure-pyobj])