2018-12-13 22:09:42 +00:00
|
|
|
/*
|
|
|
|
Unless explicitly stated otherwise all files in this repository are licensed
|
2021-08-05 10:47:52 +00:00
|
|
|
under the MIT License.
|
2018-12-13 22:09:42 +00:00
|
|
|
This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
|
|
Copyright 2018 Datadog, Inc.
|
|
|
|
*/
|
|
|
|
|
2018-12-06 20:34:27 +00:00
|
|
|
package python3
|
|
|
|
|
|
|
|
/*
|
|
|
|
#include "Python.h"
|
|
|
|
#include "macro.h"
|
|
|
|
*/
|
|
|
|
import "C"
|
2018-12-20 22:59:29 +00:00
|
|
|
import "unsafe"
|
2018-12-06 20:34:27 +00:00
|
|
|
|
2023-05-24 08:30:48 +00:00
|
|
|
// List : https://docs.python.org/3/c-api/list.html#c.PyList_Type
|
2018-12-20 22:59:29 +00:00
|
|
|
var List = togo((*C.PyObject)(unsafe.Pointer(&C.PyList_Type)))
|
2018-12-06 20:34:27 +00:00
|
|
|
|
2023-05-24 08:30:48 +00:00
|
|
|
// PyList_Check : https://docs.python.org/3/c-api/list.html#c.PyList_Check
|
2018-12-06 20:34:27 +00:00
|
|
|
func PyList_Check(p *PyObject) bool {
|
|
|
|
return C._go_PyList_Check(toc(p)) != 0
|
|
|
|
}
|
|
|
|
|
2023-05-24 08:30:48 +00:00
|
|
|
// PyList_CheckExact : https://docs.python.org/3/c-api/list.html#c.PyList_CheckExact
|
2018-12-06 20:34:27 +00:00
|
|
|
func PyList_CheckExact(p *PyObject) bool {
|
|
|
|
return C._go_PyList_CheckExact(toc(p)) != 0
|
|
|
|
}
|
|
|
|
|
2023-05-24 08:30:48 +00:00
|
|
|
// PyList_New : https://docs.python.org/3/c-api/list.html#c.PyList_New
|
2018-12-06 20:34:27 +00:00
|
|
|
func PyList_New(len int) *PyObject {
|
|
|
|
return togo(C.PyList_New(C.Py_ssize_t(len)))
|
|
|
|
}
|
|
|
|
|
2023-05-24 08:30:48 +00:00
|
|
|
// PyList_Size : https://docs.python.org/3/c-api/list.html#c.PyList_Size
|
2018-12-06 20:34:27 +00:00
|
|
|
func PyList_Size(p *PyObject) int {
|
|
|
|
return int(C.PyList_Size(toc(p)))
|
|
|
|
}
|
|
|
|
|
2023-05-24 08:30:48 +00:00
|
|
|
// PyList_GetItem : https://docs.python.org/3/c-api/list.html#c.PyList_GetItem
|
2018-12-06 20:34:27 +00:00
|
|
|
func PyList_GetItem(p *PyObject, pos int) *PyObject {
|
|
|
|
return togo(C.PyList_GetItem(toc(p), C.Py_ssize_t(pos)))
|
|
|
|
}
|
|
|
|
|
2023-05-24 08:30:48 +00:00
|
|
|
// PyList_SetItem : https://docs.python.org/3/c-api/list.html#c.PyList_SetItem
|
2019-01-18 19:50:08 +00:00
|
|
|
func PyList_SetItem(p *PyObject, pos int, o *PyObject) int {
|
|
|
|
return int(C.PyList_SetItem(toc(p), C.Py_ssize_t(pos), toc(o)))
|
2018-12-06 20:34:27 +00:00
|
|
|
}
|
|
|
|
|
2023-05-24 08:30:48 +00:00
|
|
|
// PyList_Insert : https://docs.python.org/3/c-api/list.html#c.PyList_Insert
|
2018-12-06 20:34:27 +00:00
|
|
|
func PyList_Insert(p *PyObject, index int, item *PyObject) int {
|
|
|
|
return int(C.PyList_Insert(toc(p), C.Py_ssize_t(index), toc(item)))
|
|
|
|
}
|
|
|
|
|
2023-05-24 08:30:48 +00:00
|
|
|
// PyList_Append : https://docs.python.org/3/c-api/list.html#c.PyList_Append
|
2018-12-06 20:34:27 +00:00
|
|
|
func PyList_Append(p, item *PyObject) int {
|
|
|
|
return int(C.PyList_Append(toc(p), toc(item)))
|
|
|
|
}
|
|
|
|
|
2023-05-24 08:30:48 +00:00
|
|
|
// PyList_GetSlice : https://docs.python.org/3/c-api/list.html#c.PyList_GetSlice
|
2018-12-06 20:34:27 +00:00
|
|
|
func PyList_GetSlice(p *PyObject, low, high int) *PyObject {
|
|
|
|
return togo(C.PyList_GetSlice(toc(p), C.Py_ssize_t(low), C.Py_ssize_t(high)))
|
|
|
|
}
|
|
|
|
|
2023-05-24 08:30:48 +00:00
|
|
|
// PyList_SetSlice : https://docs.python.org/3/c-api/list.html#c.PyList_SetSlice
|
2018-12-06 20:34:27 +00:00
|
|
|
func PyList_SetSlice(p *PyObject, low, high int, itemlist *PyObject) int {
|
|
|
|
return int(C.PyList_SetSlice(toc(p), C.Py_ssize_t(low), C.Py_ssize_t(high), toc(itemlist)))
|
|
|
|
}
|
|
|
|
|
2023-05-24 08:30:48 +00:00
|
|
|
// PyList_Sort : https://docs.python.org/3/c-api/list.html#c.PyList_Sort
|
2018-12-06 20:34:27 +00:00
|
|
|
func PyList_Sort(list *PyObject) int {
|
|
|
|
return int(C.PyList_Sort(toc(list)))
|
|
|
|
}
|
|
|
|
|
2023-05-24 08:30:48 +00:00
|
|
|
// PyList_Reverse : https://docs.python.org/3/c-api/list.html#c.PyList_Reverse
|
2018-12-06 20:34:27 +00:00
|
|
|
func PyList_Reverse(list *PyObject) int {
|
|
|
|
return int(C.PyList_Reverse(toc(list)))
|
|
|
|
}
|
|
|
|
|
2023-05-24 08:30:48 +00:00
|
|
|
// PyList_AsTuple : https://docs.python.org/3/c-api/list.html#c.PyList_AsTuple
|
2018-12-06 20:34:27 +00:00
|
|
|
func PyList_AsTuple(list *PyObject) *PyObject {
|
|
|
|
return togo(C.PyList_AsTuple(toc(list)))
|
|
|
|
}
|
|
|
|
|
|
|
|
//PyList_ClearFreeList : https://docs.python.org/3/c-api/list.html#c.PyList_ClearFreeList
|
2023-05-24 08:30:48 +00:00
|
|
|
/*
|
2018-12-06 20:34:27 +00:00
|
|
|
func PyList_ClearFreeList() int {
|
|
|
|
return int(C.PyList_ClearFreeList())
|
|
|
|
}
|
2023-05-24 08:30:48 +00:00
|
|
|
*/
|