mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
remove unused.
This commit is contained in:
parent
a2a4806400
commit
d9116d41ff
7 changed files with 0 additions and 332 deletions
|
@ -1,40 +0,0 @@
|
|||
project(minimal)
|
||||
|
||||
set(minimal_TYPESYSTEM
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/typesystem_minimal.xml
|
||||
)
|
||||
|
||||
set(minimal_SRC
|
||||
${CMAKE_CURRENT_BINARY_DIR}/minimal/minimal_module_wrapper.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/minimal/obj_wrapper.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/minimal/val_wrapper.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/minimal/listuser_wrapper.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/minimal/minbooluser_wrapper.cpp
|
||||
)
|
||||
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/minimal-binding.txt.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/minimal-binding.txt" @ONLY)
|
||||
|
||||
add_custom_command(OUTPUT ${minimal_SRC}
|
||||
COMMAND shiboken2 --project-file=${CMAKE_CURRENT_BINARY_DIR}/minimal-binding.txt ${GENERATOR_EXTRA_FLAGS}
|
||||
DEPENDS ${minimal_TYPESYSTEM} ${CMAKE_CURRENT_SOURCE_DIR}/global.h shiboken2
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMENT "Running generator for 'minimal' test binding..."
|
||||
)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_SOURCE_DIR}
|
||||
${SBK_PYTHON_INCLUDE_DIR}
|
||||
${libminimal_SOURCE_DIR}
|
||||
${libshiboken_SOURCE_DIR}
|
||||
${libshiboken_BINARY_DIR})
|
||||
add_library(minimal MODULE ${minimal_SRC})
|
||||
set_property(TARGET minimal PROPERTY PREFIX "")
|
||||
set_property(TARGET minimal PROPERTY OUTPUT_NAME "minimal${PYTHON_EXTENSION_SUFFIX}")
|
||||
if(WIN32)
|
||||
set_property(TARGET minimal PROPERTY SUFFIX ".pyd")
|
||||
endif()
|
||||
target_link_libraries(minimal
|
||||
libminimal
|
||||
${SBK_PYTHON_LIBRARIES}
|
||||
libshiboken)
|
|
@ -1,7 +0,0 @@
|
|||
# ---- Link ---------------------------
|
||||
kcardgame.so: kcardgame.o Makefile
|
||||
gcc -shared -o kcardgame.so kcardgame.o `pkg-config --libs python3`
|
||||
|
||||
# ---- gcc C compile ------------------
|
||||
kcardgame.o: kcardgame.cpp kcardgame.hpp Makefile
|
||||
gcc `pkg-config --cflags Qt5Gui pyside2` -I /usr/include/PySide2/QtCore/ -I /usr/include/PySide2/QtGui/ -I build-kpat/libkcardgame/ -I kpat/libkcardgame/include -I kpat/libkcardgame/ -g -fPIC -c kcardgame.cpp -I /usr/include/python3.7m/ -I /usr/lib64/python3.7/site-packages/numpy/core/include/numpy
|
|
@ -1,103 +0,0 @@
|
|||
/* A file to test imorting C modules for handling arrays to Python */
|
||||
|
||||
#include "Python.h"
|
||||
#include "arrayobject.h"
|
||||
#include "kcardgame.hpp"
|
||||
#include <QPixmap>
|
||||
#include "QtGui/pyside2_qtgui_python.h"
|
||||
#include <math.h>
|
||||
|
||||
/* #### Globals #################################### */
|
||||
|
||||
/* ==== Set up the methods table ====================== */
|
||||
static struct PyMethodDef _kcardgameMethods[] = {
|
||||
{"np_kcardgame", np_kcardgame, METH_VARARGS, "kcardgame"},
|
||||
{NULL, NULL, 0, NULL} /* Sentinel - marks the end of this structure */
|
||||
};
|
||||
|
||||
static struct PyModuleDef _kcardgame_mod = {
|
||||
PyModuleDef_HEAD_INIT,
|
||||
"_kcardgame",
|
||||
NULL,
|
||||
-1,
|
||||
_kcardgameMethods
|
||||
};
|
||||
|
||||
|
||||
/* ==== Initialize the C_test functions ====================== */
|
||||
// Module name must be _kcardgame in compile and linked
|
||||
PyMODINIT_FUNC
|
||||
PyInit_kcardgame() {
|
||||
PyObject* ret = PyModule_Create(&_kcardgame_mod);
|
||||
import_array(); // Must be present for NumPy. Called first after above line.
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* ==== Create 1D Carray from PyArray ======================
|
||||
Assumes PyArray is contiguous in memory. */
|
||||
static inline uint64_t *pyvector_to_Carrayptrs(PyArrayObject *arrayin) {
|
||||
return (uint64_t *) arrayin->data; /* pointer to arrayin data as double */
|
||||
}
|
||||
|
||||
int my_kcardgame(
|
||||
const uint64_t *const cin,
|
||||
const size_t n)
|
||||
{
|
||||
unsigned __int128 sum = 0;
|
||||
/* Operate on the vectors */
|
||||
for ( size_t i=0; i<n; i++) {
|
||||
sum += cin[i];
|
||||
}
|
||||
return (int)(sum % 1000000007);
|
||||
}
|
||||
|
||||
#include "KCardDeck"
|
||||
#include "KCardTheme"
|
||||
static void del_kcardgame(PyObject * obj)
|
||||
{
|
||||
delete (KCardDeck *)PyCapsule_GetPointer(obj, "KCardDeck");
|
||||
}
|
||||
static PyObject *np_kcardgame(PyObject *self, PyObject *args)
|
||||
{
|
||||
auto ret = new KCardDeck( KCardTheme(), nullptr);
|
||||
return PyCapsule_New(ret, "KCardDeck", del_kcardgame);
|
||||
}
|
||||
static PyObject *get_card_pixmap(PyObject *self, PyObject *args)
|
||||
{
|
||||
PyObject * kcard;
|
||||
int i;
|
||||
if (! PyArg_ParseTuple(args, "Oi", &kcard, &i))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
auto deck = (KCardDeck *)PyCapsule_GetPointer(kcard, "KCardDeck");
|
||||
auto ret = new QPixmap(deck->cardPixmap(i, true));
|
||||
return PyType_GenericNew(Shiboken::SbkType<QPixmap>, ret, NULL);
|
||||
}
|
||||
|
||||
/* ==== Square vector components & multiply by a float =========================
|
||||
/* #### Vector Utility functions ######################### */
|
||||
|
||||
/* ==== Make a Python Array Obj. from a PyObject, ================
|
||||
generates a double vector w/ contiguous memory which may be a new allocation if
|
||||
the original was not a double type or contiguous
|
||||
!! Must DECREF the object returned from this routine unless it is returned to the
|
||||
caller of this routines caller using return PyArray_Return(obj) or
|
||||
PyArray_BuildValue with the "N" construct !!!
|
||||
*/
|
||||
PyArrayObject *pyvector(PyObject *objin) {
|
||||
return (PyArrayObject *) PyArray_ContiguousFromObject(objin,
|
||||
NPY_DOUBLE, 1,1);
|
||||
}
|
||||
/* ==== Check that PyArrayObject is a double (Float) type and a vector ==============
|
||||
return 1 if an error and raise exception */
|
||||
int not_doublevector(PyArrayObject *vec) {
|
||||
if (vec->descr->type_num != NPY_UINT64 || vec->nd != 1) {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
"In not_doublevector: array must be of type uint644 and 1 dimensional (n).");
|
||||
return 1; }
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* #### Matrix Extensions ############################## */
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
/* Header to test of C modules for arrays for Python: C_test.c */
|
||||
|
||||
/* ==== Prototypes =================================== */
|
||||
|
||||
// .... Python callable Vector functions ..................
|
||||
static PyObject *np_kcardgame(PyObject *self, PyObject *args);
|
||||
|
||||
/* .... C vector utility functions ..................*/
|
||||
PyArrayObject *pyvector(PyObject *objin);
|
||||
int not_doublevector(PyArrayObject *vec);
|
|
@ -1,64 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
#############################################################################
|
||||
##
|
||||
## Copyright (C) 2016 The Qt Company Ltd.
|
||||
## Contact: https://www.qt.io/licensing/
|
||||
##
|
||||
## This file is part of the test suite of Qt for Python.
|
||||
##
|
||||
## $QT_BEGIN_LICENSE:GPL-EXCEPT$
|
||||
## Commercial License Usage
|
||||
## Licensees holding valid commercial Qt licenses may use this file in
|
||||
## accordance with the commercial license agreement provided with the
|
||||
## Software or, alternatively, in accordance with the terms contained in
|
||||
## a written agreement between you and The Qt Company. For licensing terms
|
||||
## and conditions see https://www.qt.io/terms-conditions. For further
|
||||
## information use the contact form at https://www.qt.io/contact-us.
|
||||
##
|
||||
## GNU General Public License Usage
|
||||
## Alternatively, this file may be used under the terms of the GNU
|
||||
## General Public License version 3 as published by the Free Software
|
||||
## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
## included in the packaging of this file. Please review the following
|
||||
## information to ensure the GNU General Public License requirements will
|
||||
## be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
##
|
||||
## $QT_END_LICENSE$
|
||||
##
|
||||
#############################################################################
|
||||
|
||||
import unittest
|
||||
|
||||
from minimal import MinBoolUser
|
||||
|
||||
class DerivedMinBoolUser (MinBoolUser):
|
||||
def returnMyselfVirtual(self):
|
||||
return MinBoolUser()
|
||||
|
||||
class MinBoolTest(unittest.TestCase):
|
||||
|
||||
def testMinBoolUser(self):
|
||||
mbuTrue = MinBoolUser()
|
||||
mbuFalse = MinBoolUser()
|
||||
mbuTrue.setMinBool(True)
|
||||
self.assertEqual(mbuFalse.minBool(), False)
|
||||
self.assertEqual(mbuTrue.minBool(), True)
|
||||
self.assertEqual(mbuTrue.callInvertedMinBool(), False)
|
||||
|
||||
self.assertEqual(mbuTrue.minBool() == True, True)
|
||||
self.assertEqual(False == mbuFalse.minBool(), True)
|
||||
self.assertEqual(mbuTrue.minBool() == mbuFalse.minBool(), False)
|
||||
|
||||
self.assertEqual(mbuFalse.minBool() != True, True)
|
||||
self.assertEqual(True != mbuFalse.minBool(), True)
|
||||
self.assertEqual(mbuTrue.minBool() != mbuFalse.minBool(), True)
|
||||
|
||||
def testVirtuals(self):
|
||||
dmbu = DerivedMinBoolUser()
|
||||
self.assertEqual(dmbu.invertedMinBool(), True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
[generator-project]
|
||||
|
||||
generator-set = shiboken
|
||||
|
||||
header-file = @CMAKE_CURRENT_SOURCE_DIR@/global.h
|
||||
typesystem-file = @minimal_TYPESYSTEM@
|
||||
|
||||
output-directory = @CMAKE_CURRENT_BINARY_DIR@
|
||||
|
||||
include-path = @libminimal_SOURCE_DIR@
|
||||
|
||||
typesystem-path = @CMAKE_CURRENT_SOURCE_DIR@
|
||||
|
||||
enable-parent-ctor-heuristic
|
||||
use-isnull-as-nb_nonzero
|
|
@ -1,93 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<typesystem package="minimal">
|
||||
<primitive-type name="bool"/>
|
||||
<primitive-type name="int"/>
|
||||
|
||||
<primitive-type name="MinBool" target-lang-api-name="PyBool" default-constructor="MinBool(false)">
|
||||
<include file-name="minbool.h" location="global"/>
|
||||
<conversion-rule>
|
||||
<native-to-target>
|
||||
return PyBool_FromLong(%in.value());
|
||||
</native-to-target>
|
||||
<target-to-native>
|
||||
<add-conversion type="PyBool" check="PyBool_Check(%in)">
|
||||
%out = %OUTTYPE(%in == Py_True);
|
||||
</add-conversion>
|
||||
</target-to-native>
|
||||
</conversion-rule>
|
||||
</primitive-type>
|
||||
|
||||
<container-type name="std::list" type="list">
|
||||
<include file-name="list" location="global"/>
|
||||
<conversion-rule>
|
||||
<native-to-target>
|
||||
PyObject* %out = PyList_New((int) %in.size());
|
||||
%INTYPE::const_iterator it = %in.begin();
|
||||
for (int idx = 0; it != %in.end(); ++it, ++idx) {
|
||||
%INTYPE_0 cppItem(*it);
|
||||
PyList_SET_ITEM(%out, idx, %CONVERTTOPYTHON[%INTYPE_0](cppItem));
|
||||
}
|
||||
return %out;
|
||||
</native-to-target>
|
||||
<target-to-native>
|
||||
<add-conversion type="PySequence">
|
||||
Shiboken::AutoDecRef seq(PySequence_Fast(%in, 0));
|
||||
for (int i = 0; i < PySequence_Fast_GET_SIZE(seq.object()); i++) {
|
||||
PyObject* pyItem = PySequence_Fast_GET_ITEM(seq.object(), i);
|
||||
%OUTTYPE_0 cppItem = %CONVERTTOCPP[%OUTTYPE_0](pyItem);
|
||||
%out.push_back(cppItem);
|
||||
}
|
||||
</add-conversion>
|
||||
</target-to-native>
|
||||
</conversion-rule>
|
||||
</container-type>
|
||||
|
||||
<object-type name="Obj"/>
|
||||
<value-type name="Val">
|
||||
<enum-type name="ValEnum"/>
|
||||
</value-type>
|
||||
<value-type name="ListUser"/>
|
||||
<value-type name="MinBoolUser"/>
|
||||
|
||||
<container-type name="std::vector" type="vector">
|
||||
<include file-name="vector" location="global"/>
|
||||
<conversion-rule>
|
||||
<native-to-target>
|
||||
%INTYPE::size_type vectorSize = %in.size();
|
||||
PyObject* %out = PyList_New((int) vectorSize);
|
||||
for (%INTYPE::size_type idx = 0; idx < vectorSize; ++idx) {
|
||||
%INTYPE_0 cppItem(%in[idx]);
|
||||
PyList_SET_ITEM(%out, idx, %CONVERTTOPYTHON[%INTYPE_0](cppItem));
|
||||
}
|
||||
return %out;
|
||||
</native-to-target>
|
||||
<target-to-native>
|
||||
<add-conversion type="PySequence">
|
||||
Shiboken::AutoDecRef seq(PySequence_Fast(%in, 0));
|
||||
int vectorSize = PySequence_Fast_GET_SIZE(seq.object());
|
||||
%out.reserve(vectorSize);
|
||||
for (int idx = 0; idx < vectorSize; ++idx ) {
|
||||
PyObject* pyItem = PySequence_Fast_GET_ITEM(seq.object(), idx);
|
||||
%OUTTYPE_0 cppItem = %CONVERTTOCPP[%OUTTYPE_0](pyItem);
|
||||
%out.push_back(cppItem);
|
||||
}
|
||||
</add-conversion>
|
||||
</target-to-native>
|
||||
</conversion-rule>
|
||||
</container-type>
|
||||
<!-- Test wrapping of a typedef -->
|
||||
<function signature="arrayFuncInt(std::vector<int>)" />
|
||||
<!-- Note manual expansion of the typedef -->
|
||||
<function signature="arrayFuncIntTypedef(std::vector<int>)" />
|
||||
|
||||
<function signature="arrayFuncIntReturn(int)" />
|
||||
<function signature="arrayFuncIntReturnTypedef(int)" />
|
||||
|
||||
<!-- Test wrapping of a typedef of a typedef -->
|
||||
<function signature="arrayFunc(std::vector<int>)" />
|
||||
<!-- Note manual expansion of the typedef -->
|
||||
<function signature="arrayFuncTypedef(std::vector<int>)" />
|
||||
|
||||
<function signature="arrayFuncReturn(int)" />
|
||||
<function signature="arrayFuncReturnTypedef(int)" />
|
||||
</typesystem>
|
Loading…
Add table
Reference in a new issue