mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-13 18:17:49 -04:00
CWE Directory Reorganization
Rearrange directory structure of CWE to be loosely equivalent to the H'uru Plasma repository. Part 1: Movement of directories and files.
This commit is contained in:
55
Sources/Plasma/PythonLib/pyPloticus/dllmain.cpp
Normal file
55
Sources/Plasma/PythonLib/pyPloticus/dllmain.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "pyPloticus.h"
|
||||
|
||||
#pragma warning(push)
|
||||
// disable warnings that appear in boost
|
||||
# pragma warning(disable:4800) // disable int to bool performance warning
|
||||
# pragma warning(disable:4275) // disable non dll-interface warning
|
||||
# pragma warning(disable:4251) // similar to above warning
|
||||
# include <boost/python.hpp>
|
||||
#pragma warning(pop)
|
||||
|
||||
BOOST_PYTHON_MODULE(pyPloticus)
|
||||
{
|
||||
pyPloticus::PythonModDef();
|
||||
}
|
216
Sources/Plasma/PythonLib/pyPloticus/pyPloticus.cpp
Normal file
216
Sources/Plasma/PythonLib/pyPloticus/pyPloticus.cpp
Normal file
@ -0,0 +1,216 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "pyPloticus.h"
|
||||
|
||||
#include "../pfPython/pyGlueHelpers.h"
|
||||
#include <python.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
extern "C" {
|
||||
// Ploticus C API
|
||||
int ploticus_init(char *, char *);
|
||||
int ploticus_arg(char *, char *);
|
||||
int ploticus_begin();
|
||||
void ploticus_end();
|
||||
void ploticus_execline(char *);
|
||||
int ploticus_execscript(char *, int);
|
||||
int ploticus_getvar(char *, char *);
|
||||
void ploticus_setvar(char *, char *);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
void pyPloticus::Init(char* device, char* outfilename)
|
||||
{
|
||||
ploticus_init( device, outfilename );
|
||||
}
|
||||
|
||||
void pyPloticus::Arg(char* name, char* value)
|
||||
{
|
||||
ploticus_arg( name, value );
|
||||
}
|
||||
|
||||
void pyPloticus::Begin()
|
||||
{
|
||||
ploticus_begin();
|
||||
}
|
||||
|
||||
void pyPloticus::End()
|
||||
{
|
||||
ploticus_end();
|
||||
}
|
||||
|
||||
void pyPloticus::ExecLine(char* line)
|
||||
{
|
||||
ploticus_execline( line );
|
||||
}
|
||||
|
||||
void pyPloticus::ExecScript(char* scriptfile, int prefab)
|
||||
{
|
||||
ploticus_execscript( scriptfile, prefab );
|
||||
}
|
||||
|
||||
void pyPloticus::GetVar(char* name, char* value)
|
||||
{
|
||||
ploticus_getvar( name, value );
|
||||
}
|
||||
|
||||
void pyPloticus::SetVar(char* name, char* value)
|
||||
{
|
||||
ploticus_setvar( name, value );
|
||||
}
|
||||
|
||||
PYTHON_GLOBAL_METHOD_DEFINITION(init, args, "Params: device,outfilename\nUNKNOWN")
|
||||
{
|
||||
char* device;
|
||||
char* outfilename;
|
||||
if (!PyArg_ParseTuple(args, "ss", &device, &outfilename))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "init expects two strings");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
pyPloticus::Init(device, outfilename);
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
|
||||
PYTHON_GLOBAL_METHOD_DEFINITION(arg, args, "Params: name,value\nUNKNOWN")
|
||||
{
|
||||
char* name;
|
||||
char* value;
|
||||
if (!PyArg_ParseTuple(args, "ss", &name, &value))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "arg expects two strings");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
pyPloticus::Arg(name, value);
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
|
||||
PYTHON_BASIC_GLOBAL_METHOD_DEFINITION(begin, pyPloticus::Begin, "UNKNOWN")
|
||||
PYTHON_BASIC_GLOBAL_METHOD_DEFINITION(end, pyPloticus::End, "UNKNOWN")
|
||||
|
||||
PYTHON_GLOBAL_METHOD_DEFINITION(execLine, args, "Params: line\nUNKNOWN")
|
||||
{
|
||||
char* line;
|
||||
if (!PyArg_ParseTuple(args, "s", &line))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "execLine expects a string");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
pyPloticus::ExecLine(line);
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
|
||||
PYTHON_GLOBAL_METHOD_DEFINITION(execScript, args, "Params: file,prefab\nUNKNOWN")
|
||||
{
|
||||
char* file;
|
||||
int prefab;
|
||||
if (!PyArg_ParseTuple(args, "si", &file, &prefab))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "execScript expects a string and an int");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
pyPloticus::ExecScript(file, prefab);
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
|
||||
PYTHON_GLOBAL_METHOD_DEFINITION(getVar, args, "Params: name,value\nUNKNOWN")
|
||||
{
|
||||
char* name;
|
||||
char* value;
|
||||
if (!PyArg_ParseTuple(args, "ss", &name, &value))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "getVar expects two strings");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
pyPloticus::GetVar(name, value);
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
|
||||
PYTHON_GLOBAL_METHOD_DEFINITION(setVar, args, "Params: name,value\nUNKNOWN")
|
||||
{
|
||||
char* name;
|
||||
char* value;
|
||||
if (!PyArg_ParseTuple(args, "ss", &name, &value))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "setVar expects two strings");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
pyPloticus::SetVar(name, value);
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
|
||||
void AddPlasmaMethods(std::vector<PyMethodDef> &methods)
|
||||
{
|
||||
PYTHON_GLOBAL_METHOD(methods, init);
|
||||
PYTHON_GLOBAL_METHOD(methods, arg);
|
||||
PYTHON_BASIC_GLOBAL_METHOD(methods, begin);
|
||||
PYTHON_BASIC_GLOBAL_METHOD(methods, end);
|
||||
PYTHON_GLOBAL_METHOD(methods, execLine);
|
||||
PYTHON_GLOBAL_METHOD(methods, execScript);
|
||||
PYTHON_GLOBAL_METHOD(methods, getVar);
|
||||
PYTHON_GLOBAL_METHOD(methods, setVar);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
extern "C" __declspec(dllexport) void PyInit_pyPloticus(void)
|
||||
{
|
||||
std::vector<PyMethodDef> methods; // this is temporary, for easy addition of new methods
|
||||
AddPlasmaMethods(methods);
|
||||
|
||||
// now copy the data to our real method definition structure
|
||||
PyMethodDef* plasmaMethods = new PyMethodDef[methods.size() + 1];
|
||||
for (int curMethod = 0; curMethod < methods.size(); curMethod++)
|
||||
plasmaMethods[curMethod] = methods[curMethod];
|
||||
PyMethodDef terminator = {NULL};
|
||||
plasmaMethods[methods.size()] = terminator; // add the terminator
|
||||
|
||||
// Init the module
|
||||
PyObject *m = Py_InitModule("pyPloticus", plasmaMethods);
|
||||
|
||||
delete [] plasmaMethods; // clean up
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
63
Sources/Plasma/PythonLib/pyPloticus/pyPloticus.h
Normal file
63
Sources/Plasma/PythonLib/pyPloticus/pyPloticus.h
Normal file
@ -0,0 +1,63 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef pyPloticus_h_inc
|
||||
#define pyPloticus_h_inc
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "Python.h"
|
||||
|
||||
// Ploticus C API
|
||||
|
||||
class pyPloticus
|
||||
{
|
||||
public:
|
||||
static void Init(char* device, char* outfilename);
|
||||
static void Arg(char* name, char* value);
|
||||
static void Begin();
|
||||
static void End();
|
||||
static void ExecLine(char* line);
|
||||
static void ExecScript(char* scriptfile, int prefab);
|
||||
static void GetVar(char* name, char* value);
|
||||
static void SetVar(char* name, char* value);
|
||||
};
|
||||
|
||||
#endif // pyPloticus_h_inc
|
Reference in New Issue
Block a user