libSBML Perl API  libSBML 5.17.2 Perl API
L3FormulaFormatter.h File Reference

Formats an L3 AST formula tree as an SBML formula string. More...

Include dependency graph for L3FormulaFormatter.h:
This graph shows which files directly or indirectly include this file:

Functions

char * SBML_formulaToL3String (const ASTNode_t *tree)
 Converts an AST to a string representation of a formula using a syntax derived from SBML Level 1, but extended to include elements from SBML Level 2 and SBML Level 3. More...
 
char * SBML_formulaToL3StringWithSettings (const ASTNode_t *tree, const L3ParserSettings_t *settings)
 Converts an AST to a string representation of a formula using a syntax basically derived from SBML Level 1, with behavior modifiable with custom settings. More...
 

Detailed Description

Formats an L3 AST formula tree as an SBML formula string.

Author
Lucian Smith

Function Documentation

◆ SBML_formulaToL3String()

char* SBML_formulaToL3String ( const ASTNode_t tree)

Converts an AST to a string representation of a formula using a syntax derived from SBML Level 1, but extended to include elements from SBML Level 2 and SBML Level 3.

Parameters
treethe AST to be converted.
Returns
the formula from the given AST as an SBML Level 3 text-string mathematical formula. The caller owns the returned string and is responsible for freeing it when it is no longer needed.

◆ SBML_formulaToL3StringWithSettings()

char* SBML_formulaToL3StringWithSettings ( const ASTNode_t tree,
const L3ParserSettings_t settings 
)

Converts an AST to a string representation of a formula using a syntax basically derived from SBML Level 1, with behavior modifiable with custom settings.

This function behaves identically to SBML_formulaToL3String(), but its behavior can be modified by two settings in the

Parameters
settingsobject, namely:
  • ParseUnits: If this is set to 'true' (the default), the function will write out the units of any numerical ASTNodes that have them, producing (for example) "3 mL", "(3/4) m", or "5.5e-10 M". If this is set to 'false', this function will only write out the number itself ("3", "(3/4)", and "5.5e-10", in the previous examples).
  • CollapseMinus: If this is set to 'false' (the default), the function will write out explicitly any doubly-nested unary minus ASTNodes, producing (for example) "--x" or even "-----3.1". If this is set to 'true', the function will collapse the nodes before producing the infix, producing "x" and "-3.1" in the previous examples.

All other settings will not affect the behavior of this function: the 'parseLog' setting is ignored, and "log10(x)", "ln(x)", and "log(x, y)" are always produced. Nothing in the Model object is used, and whether Avogadro is a csymbol or not is immaterial to the produced infix.

Parameters
treethe AST to be converted.
settingsthe L3ParserSettings object used to modify behavior.
Returns
the formula from the given AST as an SBML Level 3 text-string mathematical formula. The caller owns the returned string and is responsible for freeing it when it is no longer needed.
See also
SBML_parseFormula()
SBML_parseL3Formula()
SBML_formulaToL3String()