Nicholas Clark <[EMAIL PROTECTED]> wrote: > I'm trying to find documentation on how to write PMCs. I can find lots of > PMCs in the source tree, but I can't seem to find documentation on how to > go about writing them, or what the various fields and flags do.
Well, there isn't too much documentation around. The flags are documented in pobj.h. Existing PMCs should give you some hints. WRT the fields: there are 2 rules of thumb: - if the data fit into the UnionVal put it there (use appropriate members of the union) else you need the PMC_data allocated anyway. - but if a PMC may point to other PMCs so that possibly deeply nested structures may result, it needs the C<pmc_ext> structure (denoted by need_ext) in the pmc file. > I don't find any documentation saying "if you do this you'll need to do that > in a destructor else you'll leak". If your PMCs contains other managed objects like Buffers or PMCs, you have to make sure, that they get marked properly. If you mem_sys_allocate something during object creation, you need to set the active_destroy flag and fill the destroy vtable. > Am I missing something obvious? No, not AFAIK. I always start writing a new PMC by copying a similar one. > Nicholas Clark leo