return the labels of the src of ae splitted by ':'
| 18 | |
| 19 | // return the labels of the src of ae splitted by ':' |
| 20 | static char* ae_labels_src |
| 21 | ( |
| 22 | AlgebraicExpression **ae // AlgebraicExpression to extract labels from |
| 23 | ) { |
| 24 | sds labels = sdsempty(); |
| 25 | AlgebraicExpression *operand = |
| 26 | (AlgebraicExpression *) AlgebraicExpression_SrcOperand(*ae); |
| 27 | |
| 28 | // as long as: |
| 29 | // 1. algebraic expression isn't empty |
| 30 | // 2. current operand is diagonal |
| 31 | while(*ae && |
| 32 | operand->type == AL_OPERAND && |
| 33 | operand->operand.diagonal) { |
| 34 | |
| 35 | // remove source from expression |
| 36 | operand = AlgebraicExpression_RemoveSource(ae); |
| 37 | |
| 38 | // update labels string |
| 39 | labels = sdscatprintf(labels, ":%s", operand->operand.label); |
| 40 | |
| 41 | // free operand |
| 42 | AlgebraicExpression_Free(operand); |
| 43 | |
| 44 | // advance to next source operand |
| 45 | if(*ae != NULL) { |
| 46 | operand = |
| 47 | (AlgebraicExpression *) AlgebraicExpression_SrcOperand(*ae); |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | return labels; |
| 52 | } |
| 53 | |
| 54 | // return the labels of the dest of ae splitted by ':' |
| 55 | static char* ae_labels_dest |
no test coverage detected