From 514b0a5e45c72a3a8a2cb60fe605abde30e8fe1b Mon Sep 17 00:00:00 2001 From: doomchild Date: Mon, 5 Apr 2010 11:08:42 -0500 Subject: [PATCH] ReadRaw and WriteRaw are straight C functions, so's I can use ctypes to pass pointers in without a lot of list copying overhead --- dfhack/python/pydfhack.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/dfhack/python/pydfhack.cpp b/dfhack/python/pydfhack.cpp index 378d885bd..cd72dbc17 100644 --- a/dfhack/python/pydfhack.cpp +++ b/dfhack/python/pydfhack.cpp @@ -30,6 +30,25 @@ distribution. #define PyMODINIT_FUNC void #endif +extern "C" +{ +void ReadRaw(DF_API* self, const uint32_t offset, const uint32_t size, uint8_t* target) +{ + if(self != NULL && self->api_Ptr != NULL) + { + self->api_Ptr->ReadRaw(offset, size, target); + } +} + +void WriteRaw(DF_API* self, const uint32_t offset, const uint32_t size, uint8_t* source) +{ + if(self != NULL && self->api_Ptr != NULL) + { + self->api_Ptr->WriteRaw(offset, size, source); + } +} +} + static PyMethodDef module_methods[] = { {NULL} //Sentinel