On 9/7/07, Scott Lanning <[EMAIL PROTECTED]> wrote: > Is it documented somewhere which variables are > available to typemaps and what they are?
I have a vague memory of seeing such a thing, but I can't track it down. I may have been making it up. > Like $arg, $var, $type, but I also see different > and mysterious ones. I tried looking around ExtUtils, > but ran in circles. What's an example of such a thing? I scanned through xsubpp, but didn't see any more '$' things other than those three. I think there may be constructs usable in different parts (prototypes, something to do with lengths or STRLEN, ...?) Are those what you are thinking of? > I find myself copy/paste/editing typemaps a zillion times, > but I think I could surely doing it much more concisely > if I knew which variable to use. Yes, mine tend to grow too. The only thing I've come up with is defining subroutines for the commonly repeated actions. For example, all of my OUTPUT typemaps for pointers to objects look like $arg = $var ? wrap("Some::Class", $var) : &PL_sv_undef; where wrap() is a subroutine defined in a file whose header I include in all of my XS files. I don't think I made it inline, though I probably should; instead, the definition is in my main application in which I am embedding Perl. That doesn't really help, I know. I have been somewhat tempted to autogenerate my typemap file, but I only have nine pointer-to-object types, so I don't mind the duplication all that much.