| 1 | (* |
| 2 | * (C) arty 2002 |
| 3 | * This software is covered under the GNU lesser general public license |
| 4 | *) |
| 5 | |
| 6 | open Int64 ;; |
| 7 | |
| 8 | type funcptr |
| 9 | type pyobject |
| 10 | type funcent = (funcptr * int * int) |
| 11 | |
| 12 | type pymodule_func = { pyml_name : string ; |
| 13 | pyml_func : (pyobject -> pyobject) ; |
| 14 | pyml_flags : int ; |
| 15 | pyml_doc : string } |
| 16 | |
| 17 | type pyobject_type = |
| 18 | TupleType |
| 19 | | StringType |
| 20 | | IntType |
| 21 | | FloatType |
| 22 | | ListType |
| 23 | | NoneType |
| 24 | | CallableType |
| 25 | | ModuleType |
| 26 | | ClassType |
| 27 | | NullType |
| 28 | | TypeType |
| 29 | | OtherType |
| 30 | |
| 31 | (* Function list *) |
| 32 | |
| 33 | external getfuncarray : unit -> funcent array = "pygetfuncarray" |
| 34 | let py_funcs = getfuncarray () |
| 35 | external pytype : pyobject -> pyobject_type = "pytype" |
| 36 | |
| 37 | external pyfuncall1 : (funcptr * int * int) -> unit -> unit = "pygencall" |
| 38 | external pyfuncall2 : (funcptr * int * int) -> int -> unit = "pygencall" |
| 39 | external pyfuncall3 : (funcptr * int * int) -> string -> unit = "pygencall" |
| 40 | external pyfuncall4 : (funcptr * int * int) -> unit -> int = "pygencall" |
| 41 | external pyfuncall5 : (funcptr * int * int) -> string -> int = "pygencall" |
| 42 | external pyfuncall6 : (funcptr * int * int) -> (int * string) -> int = "pygencall" |
| 43 | external pyfuncall7 : (funcptr * int * int) -> (int * string * int) -> int = |
| 44 | "pygencall" |
| 45 | external pyfuncall8 : (funcptr * int * int) -> unit -> string = "pygencall" |
| 46 | external pyfuncall9 : (funcptr * int * int) -> (string * int * pyobject * pyobject) -> pyobject = "pygencall" |
| 47 | external pyfuncall10 : (funcptr * int * int) -> |
| 48 | (int * string * int * pyobject * pyobject) -> pyobject = "pygencall" |
| 49 | external pyfuncall11 : (funcptr * int * int) -> |
| 50 | (int * string * int * pyobject * pyobject * int) -> pyobject = "pygencall" |
| 51 | external pyfuncall12 : (funcptr * int * int) -> |
| 52 | (string * string * int) -> pyobject = "pygencall" |
| 53 | external pyfuncall13 : (funcptr * int * int) -> |
| 54 | (pyobject * int * int) -> int = "pygencall" |
| 55 | external pyfuncall14 : (funcptr * int * int) -> pyobject -> pyobject = "pygencall" |
| 56 | external pyfuncall15 : (funcptr * int * int) -> (pyobject * pyobject * int) -> pyobject = "pygencall" |
| 57 | external pyfuncall16 : (funcptr * int * int) -> (pyobject * string) -> pyobject = "pygencall" |
| 58 | external pyfuncall17 : (funcptr * int * int) -> (pyobject * pyobject) -> pyobject = "pygencall" |
| 59 | external pyfuncall18 : (funcptr * int * int) -> pyobject -> int = "pygencall" |
| 60 | external pyfuncall19 : (funcptr * int * int) -> (pyobject * pyobject) -> int = "pygencall" |
| 61 | external pyfuncall20 : (funcptr * int * int) -> (pyobject * pyobject * int) -> int = "pygencall" |
| 62 | external pyfuncall21 : (funcptr * int * int) -> (pyobject * string * pyobject) -> int = "pygencall" |
| 63 | external pyfuncall22 : (funcptr * int * int) -> (pyobject * string) -> int = "pygencall" |
| 64 | external pyfuncall23 : (funcptr * int * int) -> (pyobject * pyobject) -> (pyobject * pyobject) option = "pygencall" |
| 65 | external pyfuncall24 : (funcptr * int * int) -> (pyobject * pyobject * pyobject) -> int = "pygencall" |
| 66 | external pyfuncall25 : (funcptr * int * int) -> pyobject -> int64 = "pygencall" |
| 67 | external pyfuncall26 : (funcptr * int * int) -> pyobject -> string = "pygencall" |
| 68 | external pyfuncall27 : (funcptr * int * int) -> (pyobject * pyobject) -> pyobject = "pygencall" |
| 69 | external pyfuncall28 : (funcptr * int * int) -> string -> pyobject = "pygencall" |
| 70 | external pyfuncall29 : (funcptr * int * int) -> unit -> pyobject = "pygencall" |
| 71 | external pyfuncall30 : (funcptr * int * int) -> pyobject -> unit = "pygencall" |
| 72 | external pyfuncall31 : (funcptr * int * int) -> (pyobject * int) -> |
| 73 | (pyobject * pyobject * int) option = "pygencall" |
| 74 | external pyfuncall34 : (funcptr * int * int) -> int64 -> pyobject = "pygencall" |
| 75 | external pyfuncall35 : (funcptr * int * int) -> unit -> int64 = "pygencall" |
| 76 | external pyfuncall36 : (funcptr * int * int) -> float -> pyobject = "pygencall" |
| 77 | external pyfuncall37 : (funcptr * int * int) -> pyobject -> float = "pygencall" |
| 78 | external pyfuncall39 : (funcptr * int * int) -> int -> pyobject = "pygencall" |
| 79 | external pyfuncall40 : (funcptr * int * int) -> (pyobject * int) -> |
| 80 | pyobject = "pygencall" |
| 81 | external pyfuncall41 : (funcptr * int * int) -> (pyobject * int * pyobject) -> |
| 82 | int = "pygencall" |
| 83 | external pyfuncall42 : (funcptr * int * int) -> (pyobject * pyobject * pyobject) -> |
| 84 | pyobject = "pygencall" |
| 85 | external pyfuncall43 : (funcptr * int * int) -> (pyobject * int) -> |
| 86 | (int * int * int) option = "pygencall" |
| 87 | external pyfuncall44 : (funcptr * int * int) -> (int * int * int * int) -> |
| 88 | pyobject = "pygencall" |
| 89 | external pyfuncall45 : (funcptr * int * int) -> (pyobject * pyobject) -> unit = |
| 90 | "pygencall" |
| 91 | external pyfuncall46 : (funcptr * int * int) -> (pyobject * string) -> unit = |
| 92 | "pygencall" |
| 93 | external pyfuncall47 : (funcptr * int * int) -> (pyobject * pyobject * pyobject) -> |
| 94 | (pyobject * pyobject * pyobject) = "pygencall" |
| 95 | external pyfuncall48 : (funcptr * int * int) -> (pyobject * pyobject * pyobject) -> |
| 96 | unit = "pygencall" |
| 97 | external pyfuncall49 : (funcptr * int * int) -> (pyobject * string) -> pyobject = |
| 98 | "pygencall" |
| 99 | external pyfuncall50 : (funcptr * int * int) -> (string * pyobject * string) -> |
| 100 | pyobject = "pygencall" |
| 101 | external pyfuncall51 : (funcptr * int * int) -> |
| 102 | (string * pyobject * pyobject * pyobject) -> pyobject = "pygencall" |
| 103 | external pyfuncall52 : (funcptr * int * int) -> pyobject -> string = "pygencall" |
| 104 | external pyfuncall53 : (funcptr * int * int) -> (pyobject * int * int * pyobject) -> int = "pygencall" |
| 105 | external pyfuncall54 : (funcptr * int * int) -> (pyobject * int * int) -> int = |
| 106 | "pygencall" |
| 107 | |
| 108 | let fmt1call func = pyfuncall1 func |
| 109 | let fmt2call func = pyfuncall2 func |
| 110 | let fmt3call func = pyfuncall3 func |
| 111 | let fmt4call func = pyfuncall4 func |
| 112 | let fmt5call func = pyfuncall5 func |
| 113 | let fmt6call func = pyfuncall6 func |
| 114 | let fmt7call func = pyfuncall7 func |
| 115 | let fmt8call func = pyfuncall8 func |
| 116 | let fmt9call func = pyfuncall9 func |
| 117 | let fmt10call func = pyfuncall10 func |
| 118 | let fmt11call func = pyfuncall11 func |
| 119 | let fmt12call func = pyfuncall12 func |
| 120 | let fmt13call func = pyfuncall13 func |
| 121 | let fmt14call func = pyfuncall14 func |
| 122 | let fmt15call func = pyfuncall15 func |
| 123 | let fmt16call func = pyfuncall16 func |
| 124 | let fmt17call func = pyfuncall17 func |
| 125 | let fmt18call func = pyfuncall18 func |
| 126 | let fmt19call func = pyfuncall19 func |
| 127 | let fmt20call func = pyfuncall20 func |
| 128 | let fmt21call func = pyfuncall21 func |
| 129 | let fmt22call func = pyfuncall22 func |
| 130 | let fmt23call func = pyfuncall23 func |
| 131 | let fmt24call func = pyfuncall24 func |
| 132 | let fmt25call func = pyfuncall25 func |
| 133 | let fmt26call func = pyfuncall26 func |
| 134 | let fmt27call func = pyfuncall27 func |
| 135 | let fmt28call func = pyfuncall28 func |
| 136 | let fmt29call func = pyfuncall29 func |
| 137 | let fmt30call func = pyfuncall30 func |
| 138 | let fmt31call func = pyfuncall31 func |
| 139 | (* 32 *) |
| 140 | (* 33 *) |
| 141 | let fmt34call func = pyfuncall34 func |
| 142 | let fmt35call func = pyfuncall35 func |
| 143 | let fmt36call func = pyfuncall36 func |
| 144 | let fmt37call func = pyfuncall37 func |
| 145 | (* 38 *) |
| 146 | let fmt39call func = pyfuncall39 func |
| 147 | let fmt40call func = pyfuncall40 func |
| 148 | let fmt41call func = pyfuncall41 func |
| 149 | let fmt42call func = pyfuncall42 func |
| 150 | let fmt43call func = pyfuncall43 func |
| 151 | let fmt44call func = pyfuncall44 func |
| 152 | let fmt45call func = pyfuncall45 func |
| 153 | let fmt46call func = pyfuncall46 func |
| 154 | let fmt47call func = pyfuncall47 func |
| 155 | let fmt48call func = pyfuncall48 func |
| 156 | let fmt49call func = pyfuncall49 func |
| 157 | let fmt50call func = pyfuncall50 func |
| 158 | let fmt51call func = pyfuncall51 func |
| 159 | let fmt52call func = pyfuncall52 func |
| 160 | let fmt53call func = pyfuncall53 func |
| 161 | let fmt54call func = pyfuncall54 func |
| 162 | |
| 163 | let py_cur_func_num = ref 0 |
| 164 | let pnf () = let this_func = py_funcs.(!py_cur_func_num) in |
| 165 | py_cur_func_num := !py_cur_func_num + 1 ; this_func |
| 166 | |
| 167 | (* 1 *) |
| 168 | let py_initialize = fmt1call (pnf ()) |
| 169 | let py_finalize = fmt1call (pnf ()) |
| 170 | let pyerr_print = fmt1call (pnf ()) |
| 171 | (* 2 *) |
| 172 | let py_exit = fmt2call (pnf ()) |
| 173 | let pyerr_printex = fmt2call (pnf ()) |
| 174 | (* 3 *) |
| 175 | let py_setprogramname = fmt3call (pnf ()) |
| 176 | let py_setpythonhome = fmt3call (pnf ()) |
| 177 | (* 4 *) |
| 178 | let py_isinitialized = fmt4call (pnf ()) |
| 179 | (* 5 *) |
| 180 | let pyrun_simplestring = fmt5call (pnf ()) |
| 181 | (* 6 *) |
| 182 | let pyrun_anyfile = fmt6call (pnf ()) |
| 183 | let pyrun_simplefile = fmt6call (pnf ()) |
| 184 | let pyrun_interactiveone = fmt6call (pnf ()) |
| 185 | let pyrun_interactiveloop = fmt6call (pnf ()) |
| 186 | let py_fdisinteractive = fmt6call (pnf ()) |
| 187 | (* 7 *) |
| 188 | let pyrun_anyfileex = fmt7call (pnf ()) |
| 189 | let pyrun_simplefileex = fmt7call (pnf ()) |
| 190 | (* 8 *) |
| 191 | let py_getprogramname = fmt8call (pnf ()) |
| 192 | let py_getpythonhome = fmt8call (pnf ()) |
| 193 | let py_getprogramfullpath = fmt8call (pnf ()) |
| 194 | let py_getprefix = fmt8call (pnf ()) |
| 195 | let py_getexecprefix = fmt8call (pnf ()) |
| 196 | let py_getpath = fmt8call (pnf ()) |
| 197 | let py_getversion = fmt8call (pnf ()) |
| 198 | let py_getplatform = fmt8call (pnf ()) |
| 199 | let py_getcopyright = fmt8call (pnf ()) |
| 200 | let py_getcompiler = fmt8call (pnf ()) |
| 201 | let py_getbuildinfo = fmt8call (pnf ()) |
| 202 | (* 9 *) |
| 203 | let pyrun_string = fmt9call (pnf ()) |
| 204 | (* 10 *) |
| 205 | let pyrun_file = fmt10call (pnf ()) |
| 206 | (* 11 *) |
| 207 | let pyrun_fileex = fmt11call (pnf ()) |
| 208 | (* 12 *) |
| 209 | let py_compilestring = fmt12call (pnf ()) |
| 210 | (* 13 *) |
| 211 | let pyobject_print = fmt13call (pnf ()) |
| 212 | (* 14 *) |
| 213 | let pyobject_repr = fmt14call (pnf ()) |
| 214 | let pyobject_str = fmt14call (pnf ()) |
| 215 | let pyobject_unicode = fmt14call (pnf ()) |
| 216 | (* 15 *) |
| 217 | let pyobject_richcompare = fmt15call (pnf ()) |
| 218 | (* 16 *) |
| 219 | let pyobject_getattrstring = fmt16call (pnf ()) |
| 220 | (* 17 *) |
| 221 | let pyobject_getattr = fmt17call (pnf ()) |
| 222 | let pyobject_callobject = fmt17call (pnf ()) |
| 223 | (* 18 *) |
| 224 | let pyobject_istrue = fmt18call (pnf ()) |
| 225 | let pyobject_not = fmt18call (pnf ()) |
| 226 | let pycallable_check = fmt18call (pnf ()) |
| 227 | (* 19 *) |
| 228 | let pyobject_compare = fmt19call (pnf ()) |
| 229 | let pyobject_hasattr = fmt19call (pnf ()) |
| 230 | (* 20 *) |
| 231 | let pyobject_richcomparebool = fmt20call (pnf ()) |
| 232 | (* 21 *) |
| 233 | let pyobject_setattrstring = fmt21call (pnf ()) |
| 234 | (* 22 *) |
| 235 | let pyobject_hasattrstring = fmt22call (pnf ()) |
| 236 | (* 23 *) |
| 237 | let pynumber_coerce = fmt23call (pnf ()) |
| 238 | let pynumber_coerceex = fmt23call (pnf ()) |
| 239 | (* 24 *) |
| 240 | let pyobject_setattr = fmt24call (pnf ()) |
| 241 | (* 25 *) |
| 242 | let pyobject_hash = fmt25call (pnf ()) |
| 243 | (* Strings *) |
| 244 | (* 18 *) |
| 245 | let pystring_size = fmt18call (pnf ()) |
| 246 | (* 26 *) |
| 247 | let pystring_asstring = fmt26call (pnf ()) |
| 248 | (* 27 *) |
| 249 | let pystring_concat = fmt27call (pnf ()) |
| 250 | let pystring_concatanddel = fmt27call (pnf ()) |
| 251 | (* 28 *) |
| 252 | let pystring_fromstring = fmt28call (pnf ()) |
| 253 | (* 17 *) |
| 254 | let pystring_format = fmt17call (pnf ()) |
| 255 | |
| 256 | (* Dictionaries *) |
| 257 | (* 29 *) |
| 258 | let pydict_new = fmt29call (pnf ()) |
| 259 | (* 17 *) |
| 260 | let pydict_getitem = fmt17call (pnf ()) |
| 261 | (* 24 *) |
| 262 | let pydict_setitem = fmt24call (pnf ()) |
| 263 | (* 19 *) |
| 264 | let pydict_delitem = fmt19call (pnf ()) |
| 265 | (* 30 *) |
| 266 | let pydict_clear = fmt30call (pnf ()) |
| 267 | (* 31 *) |
| 268 | let pydict_next = fmt31call (pnf ()) |
| 269 | (* 14 *) |
| 270 | let pydict_keys = fmt14call (pnf ()) |
| 271 | let pydict_values = fmt14call (pnf ()) |
| 272 | let pydict_items = fmt14call (pnf ()) |
| 273 | let pydict_copy = fmt14call (pnf ()) |
| 274 | (* 18 *) |
| 275 | let pydict_size = fmt18call (pnf ()) |
| 276 | (* 16 *) |
| 277 | let pydict_getitemstring = fmt16call (pnf ()) |
| 278 | (* 22 *) |
| 279 | let pydict_delitemstring = fmt22call (pnf ()) |
| 280 | (* 21 *) |
| 281 | let pydict_setitemstring = fmt21call (pnf ()) |
| 282 | |
| 283 | (* Integer *) |
| 284 | (* 34 *) |
| 285 | let pyint_fromlong = fmt34call (pnf ()) |
| 286 | (* 25 *) |
| 287 | let pyint_aslong = fmt25call (pnf ()) |
| 288 | (* 35 *) |
| 289 | let pyint_getmax = fmt35call (pnf ()) |
| 290 | |
| 291 | (* Float *) |
| 292 | (* 36 *) |
| 293 | let pyfloat_fromdouble = fmt36call (pnf ()) |
| 294 | (* 37 *) |
| 295 | let pyfloat_asdouble = fmt37call (pnf ()) |
| 296 | |
| 297 | (* Modules *) |
| 298 | (* 28 *) |
| 299 | let pymodule_new = fmt28call (pnf ()) |
| 300 | (* 14 *) |
| 301 | let pymodule_getdict = fmt14call (pnf ()) |
| 302 | (* 26 *) |
| 303 | let pymodule_getname = fmt26call (pnf ()) |
| 304 | let pymodule_getfilename = fmt26call (pnf ()) |
| 305 | |
| 306 | (* 39 *) |
| 307 | let pytuple_new = fmt39call (pnf ()) |
| 308 | (* 18 *) |
| 309 | let pytuple_size = fmt18call (pnf ()) |
| 310 | let pytuple_check = fmt18call (pnf ()) |
| 311 | (* 40 *) |
| 312 | let pytuple_getitem = fmt40call (pnf ()) |
| 313 | (* 41 *) |
| 314 | let pytuple_setitem = fmt41call (pnf ()) |
| 315 | (* 13 *) |
| 316 | let pytuple_getslice = fmt13call (pnf ()) |
| 317 | |
| 318 | (* 42 *) |
| 319 | let pyslice_new = fmt42call (pnf ()) |
| 320 | (* 43 *) |
| 321 | let pyslice_getindices = fmt43call (pnf ()) |
| 322 | (* 44 *) |
| 323 | let pyrange_new = fmt44call (pnf ()) |
| 324 | |
| 325 | (* Error handling definitions *) |
| 326 | |
| 327 | (* 30 *) |
| 328 | let pyerr_setnone = fmt30call (pnf ()) |
| 329 | (* 45 *) |
| 330 | let pyerr_setobject = fmt45call (pnf ()) |
| 331 | (* 46 *) |
| 332 | let pyerr_setstring = fmt46call (pnf ()) |
| 333 | (* 29 *) |
| 334 | let pyerr_occurred = fmt29call (pnf ()) |
| 335 | (* 1 *) |
| 336 | let pyerr_clear = fmt1call (pnf ()) |
| 337 | (* 47 *) |
| 338 | let pyerr_fetch = fmt47call (pnf ()) |
| 339 | (* 48 *) |
| 340 | let pyerr_restore = fmt48call (pnf ()) |
| 341 | |
| 342 | (* Error testing and normalization *) |
| 343 | (* 19 *) |
| 344 | let pyerr_givenexceptionmatches = fmt19call (pnf ()) |
| 345 | (* 18 *) |
| 346 | let pyerr_exceptionmatches = fmt18call (pnf ()) |
| 347 | (* 47 *) |
| 348 | let pyerr_normalizeexception = fmt47call (pnf ()) |
| 349 | |
| 350 | (* Classes *) |
| 351 | (* 42 *) |
| 352 | let pyclass_new = fmt42call (pnf ()) |
| 353 | (* 42 *) |
| 354 | let pyinstance_new = fmt42call (pnf ()) |
| 355 | |
| 356 | (* 17 *) |
| 357 | let pyinstance_newraw = fmt17call (pnf ()) |
| 358 | (* 42 *) |
| 359 | let pymethod_new = fmt42call (pnf ()) |
| 360 | (* 14 *) |
| 361 | let pymethod_function = fmt14call (pnf ()) |
| 362 | let pymethod_self = fmt14call (pnf ()) |
| 363 | let pymethod_class = fmt14call (pnf ()) |
| 364 | |
| 365 | (* Module *) |
| 366 | (* 28 *) |
| 367 | let pymodule_new = fmt28call (pnf ()) |
| 368 | (* 14 *) |
| 369 | let pymodule_getdict = fmt14call (pnf ()) |
| 370 | (* 26 *) |
| 371 | let pymodule_getname = fmt26call (pnf ()) |
| 372 | let pymodule_getfilename = fmt26call (pnf ()) |
| 373 | (* 35 *) |
| 374 | let pyimport_getmagicnumber = fmt35call (pnf ()) |
| 375 | (* 49 *) |
| 376 | let pyimport_execcodemodule = fmt49call (pnf ()) |
| 377 | (* 50 *) |
| 378 | let pyimport_execcodemoduleex = fmt50call (pnf ()) |
| 379 | (* 29 *) |
| 380 | let pyimport_getmoduledict = fmt29call (pnf ()) |
| 381 | (* 28 *) |
| 382 | let pyimport_addmodule = fmt28call (pnf ()) |
| 383 | let pyimport_importmodule = fmt28call (pnf ()) |
| 384 | (* - disabled, see comment in pycaml_ml.c. - RWMJ |
| 385 | (* 51 *) |
| 386 | let pyimport_importmoduleex = fmt51call (pnf ()) |
| 387 | *) |
| 388 | (* 28 *) |
| 389 | let pyimport_import = fmt28call (pnf ()) |
| 390 | (* 14 *) |
| 391 | let pyimport_reloadmodule = fmt14call (pnf ()) |
| 392 | (* 1 *) |
| 393 | let pyimport_cleanup = fmt1call (pnf ()) |
| 394 | (* 5 *) |
| 395 | let pyimport_importfrozenmodule = fmt5call (pnf ()) |
| 396 | |
| 397 | (* Interface to random parts in ceval.c *) |
| 398 | (* 42 *) |
| 399 | let pyeval_callobjectwithkeywords = fmt42call (pnf ()) |
| 400 | (* 17 *) |
| 401 | (* dropped in Python 2.7 |
| 402 | let pyeval_callobject = fmt17call (pnf ()) *) |
| 403 | |
| 404 | (* 29 *) |
| 405 | let pyeval_getbuiltins = fmt29call (pnf ()) |
| 406 | let pyeval_getglobals = fmt29call (pnf ()) |
| 407 | let pyeval_getlocals = fmt29call (pnf ()) |
| 408 | let pyeval_getframe = fmt29call (pnf ()) |
| 409 | (* 4 *) |
| 410 | let pyeval_getrestricted = fmt4call (pnf ()) |
| 411 | |
| 412 | (* Abstract layer *) |
| 413 | (* 14 *) |
| 414 | let pyobject_type = fmt14call (pnf ()) |
| 415 | (* 18 *) |
| 416 | let pyobject_size = fmt18call (pnf ()) |
| 417 | (* 17 *) |
| 418 | let pyobject_getitem = fmt17call (pnf ()) |
| 419 | (* 24 *) |
| 420 | let pyobject_setitem = fmt24call (pnf ()) |
| 421 | (* 17 *) |
| 422 | let pyobject_delitem = fmt17call (pnf ()) |
| 423 | (* 52 *) |
| 424 | let pyobject_ascharbuffer = fmt52call (pnf ()) |
| 425 | let pyobject_asreadbuffer = fmt52call (pnf ()) |
| 426 | let pyobject_aswritebuffer = fmt52call (pnf ()) |
| 427 | (* 18 *) |
| 428 | let pynumber_check = fmt18call (pnf ()) |
| 429 | (* 17 *) |
| 430 | let pynumber_add = fmt17call (pnf ()) |
| 431 | let pynumber_subtract = fmt17call (pnf ()) |
| 432 | let pynumber_multiply = fmt17call (pnf ()) |
| 433 | let pynumber_divide = fmt17call (pnf ()) |
| 434 | let pynumber_remainder = fmt17call (pnf ()) |
| 435 | let pynumber_divmod = fmt17call (pnf ()) |
| 436 | (* 42 *) |
| 437 | let pynumber_power = fmt42call (pnf ()) |
| 438 | (* 14 *) |
| 439 | let pynumber_negative = fmt14call (pnf ()) |
| 440 | let pynumber_positive = fmt14call (pnf ()) |
| 441 | let pynumber_absolute = fmt14call (pnf ()) |
| 442 | let pynumber_invert = fmt14call (pnf ()) |
| 443 | (* 17 *) |
| 444 | let pynumber_lshift = fmt17call (pnf ()) |
| 445 | let pynumber_rshift = fmt17call (pnf ()) |
| 446 | let pynumber_and = fmt17call (pnf ()) |
| 447 | let pynumber_xor = fmt17call (pnf ()) |
| 448 | let pynumber_or = fmt17call (pnf ()) |
| 449 | (* 14 *) |
| 450 | let pynumber_int = fmt14call (pnf ()) |
| 451 | let pynumber_long = fmt14call (pnf ()) |
| 452 | let pynumber_float = fmt14call (pnf ()) |
| 453 | (* 17 *) |
| 454 | let pynumber_inplaceadd = fmt17call (pnf ()) |
| 455 | let pynumber_inplacesubtract = fmt17call (pnf ()) |
| 456 | let pynumber_inplacemultiply = fmt17call (pnf ()) |
| 457 | let pynumber_inplacedivide = fmt17call (pnf ()) |
| 458 | let pynumber_inplaceremainder = fmt17call (pnf ()) |
| 459 | let pynumber_inplacelshift = fmt17call (pnf ()) |
| 460 | let pynumber_inplacershift = fmt17call (pnf ()) |
| 461 | let pynumber_inplaceand = fmt17call (pnf ()) |
| 462 | let pynumber_inplacexor = fmt17call (pnf ()) |
| 463 | let pynumber_inplaceor = fmt17call (pnf ()) |
| 464 | (* 42 *) |
| 465 | let pynumber_inplacepower = fmt42call (pnf ()) |
| 466 | (* 18 *) |
| 467 | let pysequence_check = fmt18call (pnf ()) |
| 468 | let pysequence_size = fmt18call (pnf ()) |
| 469 | let pysequence_length = fmt18call (pnf ()) |
| 470 | (* 17 *) |
| 471 | let pysequence_concat = fmt17call (pnf ()) |
| 472 | (* 40 *) |
| 473 | let pysequence_repeat = fmt40call (pnf ()) |
| 474 | let pysequence_getitem = fmt40call (pnf ()) |
| 475 | (* 13 *) |
| 476 | let pysequence_getslice = fmt13call (pnf ()) |
| 477 | (* 41 *) |
| 478 | let pysequence_setitem = fmt41call (pnf ()) |
| 479 | (* 20 *) |
| 480 | let pysequence_delitem = fmt20call (pnf ()) |
| 481 | (* 53 *) |
| 482 | let pysequence_setslice = fmt53call (pnf ()) |
| 483 | (* 54 *) |
| 484 | let pysequence_delslice = fmt54call (pnf ()) |
| 485 | (* 14 *) |
| 486 | let pysequence_tuple = fmt14call (pnf ()) |
| 487 | let pysequence_list = fmt14call (pnf ()) |
| 488 | (* 16 *) |
| 489 | let pysequence_fast = fmt16call (pnf ()) |
| 490 | (* 19 *) |
| 491 | let pysequence_count = fmt19call (pnf ()) |
| 492 | let pysequence_contains = fmt19call (pnf ()) |
| 493 | let pysequence_in = fmt19call (pnf ()) |
| 494 | let pysequence_index = fmt19call (pnf ()) |
| 495 | (* 17 *) |
| 496 | let pysequence_inplaceconcat = fmt17call (pnf ()) |
| 497 | (* 22 *) |
| 498 | let pysequence_inplacerepeat = fmt22call (pnf ()) |
| 499 | (* 18 *) |
| 500 | let pymapping_check = fmt18call (pnf ()) |
| 501 | let pymapping_size = fmt18call (pnf ()) |
| 502 | let pymapping_length = fmt18call (pnf ()) |
| 503 | (* 16 *) |
| 504 | let pymapping_haskeystring = fmt16call (pnf ()) |
| 505 | (* 19 *) |
| 506 | let pymapping_haskey = fmt19call (pnf ()) |
| 507 | (* 16 *) |
| 508 | let pymapping_getitemstring = fmt16call (pnf ()) |
| 509 | (* 41 *) |
| 510 | let pymapping_setitemstring = fmt41call (pnf ()) |
| 511 | |
| 512 | external pynull : unit -> pyobject = "pynull" |
| 513 | |
| 514 | external pynone : unit -> pyobject = "pynone" |
| 515 | external pytrue : unit -> pyobject = "pytrue" |
| 516 | external pyfalse : unit -> pyobject = "pyfalse" |
| 517 | |
| 518 | external pytuple_fromarray : pyobject array -> pyobject = "pytuple_fromarray" |
| 519 | let pytuple_fromsingle elt = pytuple_fromarray [| elt |] |
| 520 | let pytuple_empty = pytuple_fromarray [| |] |
| 521 | external pytuple2 : (pyobject * pyobject) -> pyobject = |
| 522 | "pytuple_fromarray" |
| 523 | external pytuple3 : (pyobject * pyobject * pyobject) -> pyobject = |
| 524 | "pytuple_fromarray" |
| 525 | external pytuple4 : (pyobject * pyobject * pyobject * pyobject) -> |
| 526 | pyobject = "pytuple_fromarray" |
| 527 | external pytuple5 : (pyobject * pyobject * pyobject * pyobject * pyobject) -> |
| 528 | pyobject = "pytuple_fromarray" |
| 529 | external pytuple6 : (pyobject * pyobject * pyobject * pyobject * pyobject * pyobject) -> |
| 530 | pyobject = "pytuple_fromarray" |
| 531 | |
| 532 | let pyint_fromint i = pyint_fromlong (Int64.of_int i) |
| 533 | let pyint_asint obj = Int64.to_int (pyint_aslong obj) |
| 534 | |
| 535 | external pytuple_toarray : pyobject -> pyobject array = "pytuple_toarray" |
| 536 | |
| 537 | external pywrap_closure : (pyobject -> pyobject) -> pyobject = "pywrap_closure" |
| 538 | external pycaml_setargs : string -> unit = "pycaml_setargs" |
| 539 | |
| 540 | external pymodule_initmodule : string -> pymodule_func array = "pymodule_initmodule" |
| 541 | |
| 542 | external pywrap_value : 'a -> pyobject = "pywrapvalue" ;; |
| 543 | |
| 544 | external pyunwrap_value : pyobject -> 'a = "pyunwrapvalue" ;; |
| 545 | |
| 546 | let _ = py_initialize () ;; |