BASIC Developer & Support Resources > Scripting Languages

Extension Module Builder

(1/2) > >>

John:
It seems that I do a lot of repetitive work building extension modules that could be easily automated with a header file parser. Or just pass it a list of exported function definitions. One could create an extension module with no knowledge of C programming.

AIR:
I don't think you'll ever be able to get away from having to use/know C.
Practically speaking, I think the best you can do would be to generate a template based on your second suggestion, passing a list of exported functions.  Done right, it could generate quite a bit of 'boilerplate' code, but you would still need to implement the actual functionality.
Or try your hand at creating an interface for SWIG.
AIR.

John:
I already tried the SWIG route.

I like your idea of passing a list of function declarations and have it do the templating work for you,

AIR:
So how would you go about converting this
--- Code: C ---int slre_match(const char *regexp, const char *buf, int buf_len,               struct slre_cap *caps, int num_caps, int flags); 
Into this
--- Code: C ---besFUNCTION(SLRE_MATCH)  pModuleObject p;  const char *regexp;  const char *buf;  int buf_len;  struct slre_cap caps[100];  int num_caps = 100;  int flags;   p = (pModuleObject)besMODULEPOINTER;    besARGUMENTS("zzi")      &regexp,&buf,&flags  besARGEND   int ret = slre_match(regexp,buf,strlen(buf),cap,num_caps,flags);   besRETURN_LONG(ret); besEND

John:
The struct curve ball was cruel.  ;D

The IUP API would have been a good candidate for a utility like this.

Navigation

[0] Message Index

[#] Next page

Go to full version