| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
import string |
| 7 |
|
| 8 |
|
| 9 |
MACHEADERFILE = 'Fonts.h' |
| 10 |
MODNAME = '_Fm' |
| 11 |
|
| 12 |
|
| 13 |
MODPREFIX = 'Fm' |
| 14 |
INPUTFILE = string.lower(MODPREFIX) + 'gen.py' |
| 15 |
OUTPUTFILE = MODNAME + "module.c" |
| 16 |
|
| 17 |
from macsupport import * |
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
class RevVarInputBufferType(VarInputBufferType): |
| 22 |
def passInput(self, name): |
| 23 |
return "%s__len__, %s__in__" % (name, name) |
| 24 |
|
| 25 |
TextBuffer = RevVarInputBufferType() |
| 26 |
|
| 27 |
|
| 28 |
includestuff = includestuff + """ |
| 29 |
#include <Carbon/Carbon.h> |
| 30 |
|
| 31 |
|
| 32 |
/* |
| 33 |
** Parse/generate ComponentDescriptor records |
| 34 |
*/ |
| 35 |
static PyObject * |
| 36 |
FMRec_New(FMetricRec *itself) |
| 37 |
{ |
| 38 |
|
| 39 |
return Py_BuildValue("O&O&O&O&O&", |
| 40 |
PyMac_BuildFixed, itself->ascent, |
| 41 |
PyMac_BuildFixed, itself->descent, |
| 42 |
PyMac_BuildFixed, itself->leading, |
| 43 |
PyMac_BuildFixed, itself->widMax, |
| 44 |
ResObj_New, itself->wTabHandle); |
| 45 |
} |
| 46 |
|
| 47 |
#if 0 |
| 48 |
/* Not needed... */ |
| 49 |
static int |
| 50 |
FMRec_Convert(PyObject *v, FMetricRec *p_itself) |
| 51 |
{ |
| 52 |
return PyArg_ParseTuple(v, "O&O&O&O&O&", |
| 53 |
PyMac_GetFixed, &itself->ascent, |
| 54 |
PyMac_GetFixed, &itself->descent, |
| 55 |
PyMac_GetFixed, &itself->leading, |
| 56 |
PyMac_GetFixed, &itself->widMax, |
| 57 |
ResObj_Convert, &itself->wTabHandle); |
| 58 |
} |
| 59 |
#endif |
| 60 |
|
| 61 |
""" |
| 62 |
|
| 63 |
FMetricRecPtr = OpaqueType('FMetricRec', 'FMRec') |
| 64 |
|
| 65 |
|
| 66 |
module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff) |
| 67 |
|
| 68 |
|
| 69 |
Function = OSErrWeakLinkFunctionGenerator |
| 70 |
|
| 71 |
|
| 72 |
functions = [] |
| 73 |
execfile(INPUTFILE) |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
for f in functions: module.add(f) |
| 78 |
|
| 79 |
|
| 80 |
SetOutputFileName(OUTPUTFILE) |
| 81 |
module.generate() |