+ simplify porting of Spreadsheet module to Python3

This commit is contained in:
wmayer
2016-01-17 23:15:24 +01:00
parent d78d747760
commit 36383135a8
4 changed files with 91 additions and 99 deletions

View File

@@ -15,22 +15,31 @@
# include <Python.h>
#endif
#include <CXX/Extensions.hxx>
#include <CXX/Objects.hxx>
#include <Base/Console.h>
#include "Sheet.h"
#include "SpreadsheetExpression.h"
/* registration table */
static struct PyMethodDef Spreadsheet_methods[] = {
{NULL, NULL} /* end of table marker */
namespace Spreadsheet {
class Module : public Py::ExtensionModule<Module>
{
public:
Module() : Py::ExtensionModule<Module>("Spreadsheet")
{
initialize("This module is the Spreadsheet module."); // register with Python
}
virtual ~Module() {}
private:
};
} // namespace Spreadsheet
/* Python entry */
extern "C" {
void SpreadsheetExport initSpreadsheet() {
(void) Py_InitModule("Spreadsheet", Spreadsheet_methods); /* mod name, table ptr */
Base::Console().Log("Loading Spreadsheet module... done\n");
PyMODINIT_FUNC initSpreadsheet() {
Spreadsheet::PropertySpreadsheetQuantity::init();
Spreadsheet::PropertyColumnWidths::init();
Spreadsheet::PropertyRowHeights::init();
@@ -40,7 +49,6 @@ void SpreadsheetExport initSpreadsheet() {
Spreadsheet::AggregateFunctionExpression::init();
Spreadsheet::RangeExpression::init();
return;
new Spreadsheet::Module();
Base::Console().Log("Loading Spreadsheet module... done\n");
}
} // extern "C"