+static JNIEnv *currentEnv = NULL;
+jobject sclWriter = NULL;
+
+static PyObject *
+writeToSCL(PyObject *self, PyObject *args)
+{
+ if (currentEnv != NULL && sclWriter != NULL) {
+ JNIEnv *env = currentEnv;
+
+ Py_UNICODE *what;
+ Py_ssize_t length;
+ if (!PyArg_ParseTuple(args, "u#", &what, &length))
+ return Py_BuildValue("");
+
+ {
+ jclass writerClass = (*env)->FindClass(env, WRITER_CLASS);
+ jmethodID writeMethod = (*env)->GetMethodID(env, writerClass, "write", "([CII)V");
+ jcharArray chars = (*env)->NewCharArray(env, (jsize)length);
+
+ (*env)->SetCharArrayRegion(env, chars, 0, length, what);
+ (*env)->CallVoidMethod(env, sclWriter, writeMethod, chars, 0, length);
+ }
+ }
+
+ return Py_BuildValue("");
+}
+
+static PyMethodDef sclWriterMethods[] = {
+ {"write", writeToSCL, METH_VARARGS, "Write something."},
+ {NULL, NULL, 0, NULL}
+};
+
+