// Name:	C30PyIntegrate.c
// Author:	Dave Renner		dmrenne@comcast.net
// Date:	09/24/12		1400
// Note:	this module is used with 'pyDemo.py' test suite;
//			it is called by 'CIntegrate.py
// Note:	It is used with Python 3.0 only
// Note:	this code is to be compiled into a .pyd (Windows) or .so (Linux) module

#include <Python.h>
#include <string.h>


static PyObject *insult_from_here(PyObject *self, PyObject *args) {
	char *fromPython;
	char result[64];
	if ( ! PyArg_Parse( args, "(s)", &fromPython ) )
		return NULL;
	else {
		strcpy( result, "We are " );
		strcat( result, fromPython );
		return Py_BuildValue( "s", result );
	}
}


static struct PyMethodDef Py30Integrate_methods[] = {
	{ "insult_the_English", insult_from_here, METH_VARARGS, "method doc" },
	{ NULL, NULL, 0, NULL }
};


static struct PyModuleDef C30Py_module = {
	PyModuleDef_HEAD_INIT,
	"C30PyIntegrate",
	"Your mother was a hampster",
	-1,
	Py30Integrate_methods,
	NULL,
	NULL,
	NULL,
	NULL
};


PyMODINIT_FUNC PyInit_C30PyIntegrate() {
	return PyModule_Create( &C30Py_module );
}	
