diff options
Diffstat (limited to 'Mac/Modules/res')
-rw-r--r-- | Mac/Modules/res/resedit.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Mac/Modules/res/resedit.py b/Mac/Modules/res/resedit.py new file mode 100644 index 0000000..5e54ef2 --- /dev/null +++ b/Mac/Modules/res/resedit.py @@ -0,0 +1,25 @@ +resource_body = """ +char *buf; +int len; +Handle h; + +if (!PyArg_ParseTuple(_args, "s#", &buf, &len)) + return NULL; +h = NewHandle(len); +if ( h == NULL ) { + PyErr_NoMemory(); + return NULL; +} +HLock(h); +memcpy(*h, buf, len); +HUnlock(h); +return (PyObject *)ResObj_New(h); +""" + +f = ManualGenerator("Resource", resource_body) +f.docstring = lambda: """Convert a string to a resource object. + +The created resource object is actually just a handle. +Apply AddResource() to write it to a resource file. +""" +functions.append(f) |