SWIG experiments
Squash of the following commits (a full rebase was too hard :( ) *ef309cfdfN - SWIG: create pm3.c (5 months ago) <Philippe Teuwen> *05ba6a73fN - swig pm3_device -> pm3 (5 months ago) <Philippe Teuwen> *d59630183N - swig: move pm3.i (5 months ago) <Philippe Teuwen> *6adcfad75N - Fix historic make & cmake (5 months ago) <Philippe Teuwen> *bcbef2edfN - Fix typo with script_embedded (5 months ago) <slurdge> *538ee4dabN - Better SWIG integration: autogen func & attributes (5 months ago) <slurdge> *756b62466N - SWIG: few helper scripts (5 months ago) <Philippe Teuwen> *47ba4acd0N - SWIG %extend (5 months ago) <Philippe Teuwen> *21841cb9dN - simplify scripts (5 months ago) <Philippe Teuwen> *78c4f7929N - Revert "SWIG experiments: introduce context" (5 months ago) <Philippe Teuwen> *1562b75fcN - SWIG experiments: introduce context (5 months ago) <Philippe Teuwen> *a503dfcd9N - SWIG experiments (5 months ago) <Philippe Teuwen>
This commit is contained in:
1 parent
e959d0e229
commit
eadacd82f5
42 files changed
+8542
-34
No files matched your search
@@ -0,0 +1,39 @@
|
||||
%module pm3
|
||||
%{
|
||||
/* Include the header in the wrapper code */
|
||||
#include "pm3.h"
|
||||
#include "comms.h"
|
||||
%}
|
||||
|
||||
/* Strip "pm3_" from API functions for SWIG */
|
||||
%rename("%(strip:[pm3_])s") "";
|
||||
%feature("immutable","1") pm3_current_dev;
|
||||
typedef struct {
|
||||
%extend {
|
||||
pm3() {
|
||||
printf("SWIG pm3 constructor, get current pm3\n");
|
||||
pm3_device * p = pm3_get_current_dev();
|
||||
p->script_embedded = 1;
|
||||
return p;
|
||||
}
|
||||
pm3(char *port) {
|
||||
printf("SWIG pm3 constructor with port, open pm3\n");
|
||||
pm3_device * p = pm3_open(port);
|
||||
p->script_embedded = 0;
|
||||
return p;
|
||||
}
|
||||
~pm3() {
|
||||
if ($self->script_embedded) {
|
||||
printf("SWIG pm3 destructor, nothing to do\n");
|
||||
} else {
|
||||
printf("SWIG pm3 destructor, close pm3\n");
|
||||
pm3_close($self);
|
||||
}
|
||||
}
|
||||
int console(char *cmd);
|
||||
char const * const name;
|
||||
}
|
||||
} pm3;
|
||||
//%nodefaultctor device;
|
||||
//%nodefaultdtor device;
|
||||
/* Parse the header file to generate wrappers */
|
||||
Reference in new issue
Block a user