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