cpy3/complex.go

44 lines
1.4 KiB
Go
Raw Permalink Normal View History

2018-12-13 22:09:42 +00:00
/*
Unless explicitly stated otherwise all files in this repository are licensed
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 17:24:59 +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 17:24:59 +00:00
2023-05-24 08:30:48 +00:00
// Complex : https://docs.python.org/3/c-api/complex.html#c.PyComplex_Type
2018-12-20 22:59:29 +00:00
var Complex = togo((*C.PyObject)(unsafe.Pointer(&C.PyComplex_Type)))
2018-12-06 17:24:59 +00:00
2023-05-24 08:30:48 +00:00
// PyComplex_Check : https://docs.python.org/3/c-api/complex.html#c.PyComplex_Check
2018-12-06 17:24:59 +00:00
func PyComplex_Check(p *PyObject) bool {
return C._go_PyComplex_Check(toc(p)) != 0
}
2023-05-24 08:30:48 +00:00
// PyComplex_CheckExact : https://docs.python.org/3/c-api/complex.html#c.PyComplex_CheckExact
2018-12-06 17:24:59 +00:00
func PyComplex_CheckExact(p *PyObject) bool {
return C._go_PyComplex_CheckExact(toc(p)) != 0
}
2023-05-24 08:30:48 +00:00
// PyComplex_FromDoubles : https://docs.python.org/3/c-api/complex.html#c.PyComplex_FromDoubles
2018-12-06 17:24:59 +00:00
func PyComplex_FromDoubles(real, imag float64) *PyObject {
return togo(C.PyComplex_FromDoubles(C.double(real), C.double(imag)))
}
2023-05-24 08:30:48 +00:00
// PyComplex_RealAsDouble : https://docs.python.org/3/c-api/complex.html#c.PyComplex_RealAsDouble
2018-12-06 17:24:59 +00:00
func PyComplex_RealAsDouble(op *PyObject) float64 {
return float64(C.PyComplex_RealAsDouble(toc(op)))
}
2023-05-24 08:30:48 +00:00
// PyComplex_ImagAsDouble : https://docs.python.org/3/c-api/complex.html#c.PyComplex_ImagAsDouble
2018-12-06 17:24:59 +00:00
func PyComplex_ImagAsDouble(op *PyObject) float64 {
return float64(C.PyComplex_ImagAsDouble(toc(op)))
}