| 1 |
|
| #include "EXTERN.h" |
| 2 |
|
| #include "perl.h" |
| 3 |
|
| #include "XSUB.h" |
| 4 |
|
| |
| 5 |
|
| # include "src/Matrix.h" |
| 6 |
|
| # include "src/TypeSafeData.h" |
| 7 |
|
| # include "src/Characters.h" |
| 8 |
|
| # include "src/types.h" |
| 9 |
|
| |
| 10 |
0 |
| Matrix* create(const char * classname) { |
| 11 |
|
| Matrix *self; |
| 12 |
0 |
| Newx(self,1,Matrix); |
| 13 |
0 |
| initialize_matrix(self); |
| 14 |
0 |
| return self; |
| 15 |
|
| } |
| 16 |
|
| |
| 17 |
0 |
| void initialize_matrix(Matrix* self){ |
| 18 |
0 |
| initialize_typesafedata((TypeSafeData*)self); |
| 19 |
0 |
| self->charlabels = newAV(); |
| 20 |
0 |
| self->statelabels = newAV(); |
| 21 |
0 |
| self->gapmode = 1; |
| 22 |
0 |
| self->matchchar = '.'; |
| 23 |
0 |
| self->polymorphism = 0; |
| 24 |
0 |
| self->respectcase = 1; |
| 25 |
0 |
| ((Identifiable*)self)->_type = _MATRIX_; |
| 26 |
0 |
| ((Identifiable*)self)->_container = _MATRICES_; |
| 27 |
0 |
| ((Identifiable*)self)->_index = _MATRIX_IDX_; |
| 28 |
|
| |
| 29 |
|
| // allocate and initialize Characters* field |
| 30 |
0 |
| Newx(self->characters,1,Characters); |
| 31 |
0 |
| initialize_characters(self->characters); |
| 32 |
0 |
| } |
| 33 |
|
| |
| 34 |
0 |
| void destroy_matrix(Matrix* self) { |
| 35 |
0 |
| destroy_characters(self->characters); |
| 36 |
0 |
| destroy_typesafedata((TypeSafeData*)self); |
| 37 |
|
| //Safefree(self); |
| 38 |
0 |
| } |
| 39 |
|
| MODULE = Bio::PhyloXS::Matrices::Matrix PACKAGE = Bio::PhyloXS::Matrices::Matrix |
| 40 |
|
| |
| 41 |
|
| PROTOTYPES: DISABLE |
| 42 |
|
| |
| 43 |
|
| |
| 44 |
|
| Matrix * |
| 45 |
|
| create (classname) |
| 46 |
|
| const char * classname |
| 47 |
|
| |
| 48 |
|
| void |
| 49 |
|
| initialize_matrix (self) |
| 50 |
|
| Matrix * self |
| 51 |
|
| PREINIT: |
| 52 |
|
| I32* temp; |
| 53 |
|
| PPCODE: |
| 54 |
0 |
| temp = PL_markstack_ptr++; |
| 55 |
0 |
| initialize_matrix(self); |
| 56 |
0 |
▶ | if (PL_markstack_ptr != temp) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (PL_markstack_ptr != temp) { |
0 |
0 |
0 |
|
| 57 |
|
| /* truly void, because dXSARGS not invoked */ |
| 58 |
0 |
| PL_markstack_ptr = temp; |
| 59 |
0 |
| XSRETURN_EMPTY; /* return empty stack */ |
| 60 |
|
| } |
| 61 |
|
| /* must have used dXSARGS; list context implied */ |
| 62 |
0 |
| return; /* assume stack size is correct */ |
| 63 |
|
| |
| 64 |
|
| void |
| 65 |
|
| destroy_matrix (self) |
| 66 |
|
| Matrix * self |
| 67 |
|
| PREINIT: |
| 68 |
|
| I32* temp; |
| 69 |
|
| PPCODE: |
| 70 |
0 |
| temp = PL_markstack_ptr++; |
| 71 |
0 |
| destroy_matrix(self); |
| 72 |
0 |
▶ | if (PL_markstack_ptr != temp) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (PL_markstack_ptr != temp) { |
0 |
0 |
0 |
|
| 73 |
|
| /* truly void, because dXSARGS not invoked */ |
| 74 |
0 |
| PL_markstack_ptr = temp; |
| 75 |
0 |
| XSRETURN_EMPTY; /* return empty stack */ |
| 76 |
|
| } |
| 77 |
|
| /* must have used dXSARGS; list context implied */ |
| 78 |
0 |
| return; /* assume stack size is correct */ |
| 79 |
|
| |