blob: 5e54ef223afdf8c1d4fdfe7f07acb05d726cf2da [file] [log] [blame]
Guido van Rossum81920f11995-02-05 17:01:24 +00001resource_body = """
2char *buf;
3int len;
4Handle h;
5
6if (!PyArg_ParseTuple(_args, "s#", &buf, &len))
7 return NULL;
8h = NewHandle(len);
9if ( h == NULL ) {
10 PyErr_NoMemory();
11 return NULL;
12}
13HLock(h);
14memcpy(*h, buf, len);
15HUnlock(h);
16return (PyObject *)ResObj_New(h);
17"""
18
19f = ManualGenerator("Resource", resource_body)
20f.docstring = lambda: """Convert a string to a resource object.
21
22The created resource object is actually just a handle.
23Apply AddResource() to write it to a resource file.
24"""
25functions.append(f)