/** * Formats the given ASTNode as a rational number and appends the result to * the given StringBuffer. For SBML L1 this amounts to: * * "(numerator/denominator)" */ void FormulaFormatter_formatRational (StringBuffer_t *sb, const ASTNode_t *node) { StringBuffer_appendChar( sb, '('); StringBuffer_appendInt ( sb, ASTNode_getNumerator(node) ); StringBuffer_appendChar( sb, '/'); StringBuffer_appendInt ( sb, ASTNode_getDenominator(node) ); StringBuffer_appendChar( sb, ')'); }
/** * Formats the given ASTNode as a rational number and appends the result to * the given StringBuffer. For SBML L1 this amounts to: * * "(numerator/denominator)" */ void L3FormulaFormatter_formatRational (StringBuffer_t *sb, const ASTNode_t *node, const L3ParserSettings_t *settings) { StringBuffer_appendChar( sb, '('); StringBuffer_appendInt ( sb, ASTNode_getNumerator(node) ); StringBuffer_appendChar( sb, '/'); StringBuffer_appendInt ( sb, ASTNode_getDenominator(node) ); StringBuffer_appendChar( sb, ')'); if (L3ParserSettings_getParseUnits(settings)) { if (ASTNode_hasUnits(node)) { StringBuffer_appendChar( sb, ' '); StringBuffer_append( sb, ASTNode_getUnits(node)); } } }
/** * Formats the given ASTNode as a rational number and returns the result as * a string. This amounts to: * * "(numerator/denominator)" */ char * FormulaGraphvizFormatter_formatRational (const ASTNode_t *node) { char *s; StringBuffer_t *p = StringBuffer_create(128); StringBuffer_appendChar( p, '('); StringBuffer_appendInt ( p, ASTNode_getNumerator(node) ); StringBuffer_appendChar( p, '/'); StringBuffer_appendInt ( p, ASTNode_getDenominator(node) ); StringBuffer_appendChar( p, ')'); s = StringBuffer_toString(p); free(p); return s; }