Staging
v0.5.1
swh:1:snp:635f4099902912592851108bcac178ff574f7c5f
Raw File
Tip revision: e2aaa9dd61632e48da08372dfb7f3365ed6d663b authored by cvs2svn on 14 February 1995, 00:58:59 UTC
This commit was manufactured by cvs2svn to create tag 'r12beta3'.
Tip revision: e2aaa9d
resedit.py
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)
back to top