I have a c library I have connected to perl via XS.
Originally I wrote the c to write c programs. I've since
quit writing any c programs and write entirely in perl.
The original c was written with perl in mind. Since though
I have rebuilt many of the c functions to better align
with perl:
Here is some of my XS code:
void
LayerExtent(cp,ln)
Laff::Cell cp
char* ln
PPCODE:
{
int llx,lly,urx,ury;
if (! LayerExtent(cp,ln,&llx,&lly,&urx,&ury)) XSRETURN_NO;
XPUSHs(sv_2mortal(newSViv(llx)));
XPUSHs(sv_2mortal(newSViv(lly)));
XPUSHs(sv_2mortal(newSViv(urx)));
XPUSHs(sv_2mortal(newSViv(ury)));
XSRETURN(4);
}
The names are the same but the C version needs to return
4 values.
Since I'm currently in the process of rebuilding my C and my
XS to align, should I move all the XSPUSH into my c code?
Other than reducing the amount of xs code.
What would be the +'s and -'s of doing this?
So that I could simply do:
void
LayerExtent(cp,ln)
Laff::Cell cp
char* ln
This would be VERY low maintenance XS :)