libSBML C API  libSBML 5.20.4 C API
Loading...
Searching...
No Matches
FormulaFormatter.h File Reference

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

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

Functions

void FormulaFormatter_format (StringBuffer_t *sb, const ASTNode_t *node)
 _tFormats_t _tthe_t _tgiven_t _tASTNode_t_t _tas_t _tan_t _tSBML_t _tL1_t _ttoken_t _tand_t _tappends_t _tthe_t _tresult_t _tto_t _tthe_t _tgiven_t _tStringBuffer_t_t.
 
void FormulaFormatter_formatFunction (StringBuffer_t *sb, const ASTNode_t *node)
 _tFormats_t _tthe_t _tgiven_t _tASTNode_t_t _tas_t _tan_t _tSBML_t _tL1_t _tfunction_t _tname_t _tand_t _tappends_t _tthe_t _tresult_t _tto_t _tthe_t _tgiven_t _tStringBuffer_t_t.
 
void FormulaFormatter_formatOperator (StringBuffer_t *sb, const ASTNode_t *node)
 _tFormats_t _tthe_t _tgiven_t _tASTNode_t_t _tas_t _tan_t _tSBML_t _tL1_t _toperator_t _tand_t _tappends_t _tthe_t _tresult_t _tto_t _tthe_t _tgiven_t _tStringBuffer_t_t.
 
void FormulaFormatter_formatRational (StringBuffer_t *sb, const ASTNode_t *node)
 _tFormats_t _tthe_t _tgiven_t _tASTNode_t_t _tas_t _ta_t _trational_t _tnumber_t _tand_t _tappends_t _tthe_t _tresult_t _tto_t _tthe_t _tgiven_t _tStringBuffer_t_t.
 
void FormulaFormatter_formatReal (StringBuffer_t *sb, const ASTNode_t *node)
 _tFormats_t _tthe_t _tgiven_t _tASTNode_t_t _tas_t _ta_t _treal_t _tnumber_t _tand_t _tappends_t _tthe_t _tresult_t _tto_t _tthe_t _tgiven_t _tStringBuffer_t_t.
 
int FormulaFormatter_isFunction (const ASTNode_t *node)
 @_tcond_t _tdoxygenLibsbmlInternal_t
 
int FormulaFormatter_isGrouped (const ASTNode_t *parent, const ASTNode_t *child)
 @_treturn_t @_tc_t _t1_t (_ttrue_t) _tif_t _tthe_t _tgiven_t _tchild_t _tASTNode_t _tshould_t _tbe_t _tgrouped_t (_twith_t _tparenthesis_t), @_tc_t _t0_t (_tfalse_t) _totherwise_t.
 
void FormulaFormatter_visit (const ASTNode_t *parent, const ASTNode_t *node, StringBuffer_t *sb)
 _tVisits_t _tthe_t _tgiven_t _tASTNode_t_t _tnode_t.
 
void FormulaFormatter_visitFunction (const ASTNode_t *parent, const ASTNode_t *node, StringBuffer_t *sb)
 _tVisits_t _tthe_t _tgiven_t _tASTNode_t_t _tas_t _ta_t _tfunction_t.
 
void FormulaFormatter_visitLog10 (const ASTNode_t *parent, const ASTNode_t *node, StringBuffer_t *sb)
 _tVisits_t _tthe_t _tgiven_t _tASTNode_t_t _tas_t _tthe_t _tfunction_t "_tlog_t(_t10_t, _tx_t)" _tand_t _tin_t _tdoing_t _tso_t, _tformats_t _tit_t _tas_t "_tlog10_t(_tx_t)" (_twhere_t _tx_t _tis_t _tany_t _tsubexpression_t).
 
void FormulaFormatter_visitOther (const ASTNode_t *parent, const ASTNode_t *node, StringBuffer_t *sb)
 _tVisits_t _tthe_t _tgiven_t _tASTNode_t_t _tand_t _tcontinues_t _tthe_t _tinorder_t _ttraversal_t.
 
void FormulaFormatter_visitSqrt (const ASTNode_t *parent, const ASTNode_t *node, StringBuffer_t *sb)
 _tVisits_t _tthe_t _tgiven_t _tASTNode_t_t _tas_t _tthe_t _tfunction_t "_troot_t(_t2_t, _tx_t)" _tand_t _tin_t _tdoing_t _tso_t, _tformats_t _tit_t _tas_t "_tsqrt_t(_tx_t)" (_twhere_t _tx_t _tis_t _tany_t _tsubexpression_t).
 
void FormulaFormatter_visitUMinus (const ASTNode_t *parent, const ASTNode_t *node, StringBuffer_t *sb)
 _tVisits_t _tthe_t _tgiven_t _tASTNode_t_t _tas_t _ta_t _tunary_t _tminus_t.
 
char * SBML_formulaToString (const ASTNode_t *tree)
 _tConverts_t _tan_t _tAST_t _tto_t _ta_t _tstring_t _trepresentation_t _tof_t _ta_t _tformula_t _tusing_t _ta_t _tsyntax_t _tbasically_t _tderived_t _tfrom_t _tSBML_t _tLevel_t&_tnbsp_t;_t1_t.
 

Detailed Description

Formats an AST formula tree as an SBML formula string.

Author
Ben Bornstein

Function Documentation

◆ FormulaFormatter_format()

void FormulaFormatter_format ( StringBuffer_t *  sb,
const ASTNode_t node 
)

_tFormats_t _tthe_t _tgiven_t _tASTNode_t_t _tas_t _tan_t _tSBML_t _tL1_t _ttoken_t _tand_t _tappends_t _tthe_t _tresult_t _tto_t _tthe_t _tgiven_t _tStringBuffer_t_t.

_tFormats_t _tthe_t _tgiven_t _tASTNode_t_t _tas_t _tan_t _tSBML_t _tL1_t _ttoken_t _tand_t _tappends_t _tthe_t _tresult_t _tto_t _tthe_t _tgiven_t _tStringBuffer_t_t.

◆ FormulaFormatter_formatFunction()

void FormulaFormatter_formatFunction ( StringBuffer_t *  sb,
const ASTNode_t node 
)

_tFormats_t _tthe_t _tgiven_t _tASTNode_t_t _tas_t _tan_t _tSBML_t _tL1_t _tfunction_t _tname_t _tand_t _tappends_t _tthe_t _tresult_t _tto_t _tthe_t _tgiven_t _tStringBuffer_t_t.

_tFormats_t _tthe_t _tgiven_t _tASTNode_t_t _tas_t _tan_t _tSBML_t _tL1_t _tfunction_t _tname_t _tand_t _tappends_t _tthe_t _tresult_t _tto_t _tthe_t _tgiven_t _tStringBuffer_t_t.

◆ FormulaFormatter_formatOperator()

void FormulaFormatter_formatOperator ( StringBuffer_t *  sb,
const ASTNode_t node 
)

_tFormats_t _tthe_t _tgiven_t _tASTNode_t_t _tas_t _tan_t _tSBML_t _tL1_t _toperator_t _tand_t _tappends_t _tthe_t _tresult_t _tto_t _tthe_t _tgiven_t _tStringBuffer_t_t.

_tFormats_t _tthe_t _tgiven_t _tASTNode_t_t _tas_t _tan_t _tSBML_t _tL1_t _toperator_t _tand_t _tappends_t _tthe_t _tresult_t _tto_t _tthe_t _tgiven_t _tStringBuffer_t_t.

◆ FormulaFormatter_formatRational()

void FormulaFormatter_formatRational ( StringBuffer_t *  sb,
const ASTNode_t node 
)

_tFormats_t _tthe_t _tgiven_t _tASTNode_t_t _tas_t _ta_t _trational_t _tnumber_t _tand_t _tappends_t _tthe_t _tresult_t _tto_t _tthe_t _tgiven_t _tStringBuffer_t_t.

_tFor_t _tSBML_t _tL1_t _tthis_t _tamounts_t _tto_t:

"(_tnumerator_t/_tdenominator_t)"

_tFormats_t _tthe_t _tgiven_t _tASTNode_t_t _tas_t _ta_t _trational_t _tnumber_t _tand_t _tappends_t _tthe_t _tresult_t _tto_t _tthe_t _tgiven_t _tStringBuffer_t_t.

_tFor_t _tSBML_t _tL1_t _tthis_t _tamounts_t _tto_t:

"(_tnumerator_t/_tdenominator_t)"

◆ FormulaFormatter_formatReal()

void FormulaFormatter_formatReal ( StringBuffer_t *  sb,
const ASTNode_t node 
)

_tFormats_t _tthe_t _tgiven_t _tASTNode_t_t _tas_t _ta_t _treal_t _tnumber_t _tand_t _tappends_t _tthe_t _tresult_t _tto_t _tthe_t _tgiven_t _tStringBuffer_t_t.

_tFormats_t _tthe_t _tgiven_t _tASTNode_t_t _tas_t _ta_t _treal_t _tnumber_t _tand_t _tappends_t _tthe_t _tresult_t _tto_t _tthe_t _tgiven_t _tStringBuffer_t_t.

◆ FormulaFormatter_isFunction()

int FormulaFormatter_isFunction ( const ASTNode_t node)

@_tcond_t _tdoxygenLibsbmlInternal_t

@_treturn_t @_tc_t _t1_t (_ttrue_t) _tif_t _tthe_t _tgiven_t _tASTNode_t_t _tis_t _tto_t _tformatted_t _tas_t _ta_t _tfunction_t.

@_tcond_t _tdoxygenLibsbmlInternal_t

@_treturn_t _ttrue_t (_tnonzero_t) _tif_t _tthe_t _tgiven_t _tASTNode_t _tis_t _tto_t _tformatted_t _tas_t _ta_t _tfunction_t.

◆ FormulaFormatter_isGrouped()

int FormulaFormatter_isGrouped ( const ASTNode_t parent,
const ASTNode_t child 
)

@_treturn_t @_tc_t _t1_t (_ttrue_t) _tif_t _tthe_t _tgiven_t _tchild_t _tASTNode_t _tshould_t _tbe_t _tgrouped_t (_twith_t _tparenthesis_t), @_tc_t _t0_t (_tfalse_t) _totherwise_t.

_tA_t _tnode_t _tshould_t _tbe_t _tgroup_t _tif_t _tit_t _tis_t _tnot_t _tan_t _targument_t _tto_t _ta_t _tfunction_t _tand_t _teither_t:

  • _tThe_t _tparent_t _tnode_t _thas_t _thigher_t _tprecedence_t _tthan_t _tthe_t _tchild_t, _tor_t
  • _tIf_t _tparent_t _tnode_t _thas_t _tequal_t _tprecedence_t _twith_t _tthe_t _tchild_t _tand_t _tthe_t _tchild_t _tis_t _tto_t _tthe_t _tright_t. _tIn_t _tthis_t _tcase_t, _toperator_t _tassociativity_t _tand_t _tright_t-_tmost_t _tAST_t _tderivation_t _tenforce_t _tthe_t _tgrouping_t.

@_treturn_t @_tc_t _t1_t (_ttrue_t) _tif_t _tthe_t _tgiven_t _tchild_t _tASTNode_t _tshould_t _tbe_t _tgrouped_t (_twith_t _tparenthesis_t), @_tc_t _t0_t (_tfalse_t) _totherwise_t.

_tA_t _tnode_t _tshould_t _tbe_t _tgroup_t _tif_t _tit_t _tis_t _tnot_t _tan_t _targument_t _tto_t _ta_t _tfunction_t _tand_t _teither_t:

  • _tThe_t _tparent_t _tnode_t _thas_t _thigher_t _tprecedence_t _tthan_t _tthe_t _tchild_t, _tor_t
  • _tIf_t _tparent_t _tnode_t _thas_t _tequal_t _tprecedence_t _twith_t _tthe_t _tchild_t _tand_t _tthe_t _tchild_t _tis_t _tto_t _tthe_t _tright_t. _tIn_t _tthis_t _tcase_t, _toperator_t _tassociativity_t _tand_t _tright_t-_tmost_t _tAST_t _tderivation_t _tenforce_t _tthe_t _tgrouping_t.

◆ FormulaFormatter_visit()

void FormulaFormatter_visit ( const ASTNode_t parent,
const ASTNode_t node,
StringBuffer_t *  sb 
)

_tVisits_t _tthe_t _tgiven_t _tASTNode_t_t _tnode_t.

_tThis_t _tfunction_t _tis_t _treally_t _tjust_t _ta_t _tdispatcher_t _tto_t _teither_t _tSBML_formulaToString_visitFunction_t() _tor_t _tSBML_formulaToString_visitOther_t().

_tVisits_t _tthe_t _tgiven_t _tASTNode_t_t _tnode_t.

_tThis_t _tfunction_t _tis_t _treally_t _tjust_t _ta_t _tdispatcher_t _tto_t _teither_t _tSBML_formulaToString_visitFunction_t() _tor_t _tSBML_formulaToString_visitOther_t().

◆ FormulaFormatter_visitFunction()

void FormulaFormatter_visitFunction ( const ASTNode_t parent,
const ASTNode_t node,
StringBuffer_t *  sb 
)

_tVisits_t _tthe_t _tgiven_t _tASTNode_t_t _tas_t _ta_t _tfunction_t.

_tFor_t _tthis_t _tnode_t _tonly_t _tthe_t _ttraversal_t _tis_t _tpreorder_t.

_tVisits_t _tthe_t _tgiven_t _tASTNode_t_t _tas_t _ta_t _tfunction_t.

_tFor_t _tthis_t _tnode_t _tonly_t _tthe_t _ttraversal_t _tis_t _tpreorder_t.

◆ FormulaFormatter_visitLog10()

void FormulaFormatter_visitLog10 ( const ASTNode_t parent,
const ASTNode_t node,
StringBuffer_t *  sb 
)

_tVisits_t _tthe_t _tgiven_t _tASTNode_t_t _tas_t _tthe_t _tfunction_t "_tlog_t(_t10_t, _tx_t)" _tand_t _tin_t _tdoing_t _tso_t, _tformats_t _tit_t _tas_t "_tlog10_t(_tx_t)" (_twhere_t _tx_t _tis_t _tany_t _tsubexpression_t).

_tVisits_t _tthe_t _tgiven_t _tASTNode_t_t _tas_t _tthe_t _tfunction_t "_tlog_t(_t10_t, _tx_t)" _tand_t _tin_t _tdoing_t _tso_t, _tformats_t _tit_t _tas_t "_tlog10_t(_tx_t)" (_twhere_t _tx_t _tis_t _tany_t _tsubexpression_t).

◆ FormulaFormatter_visitOther()

void FormulaFormatter_visitOther ( const ASTNode_t parent,
const ASTNode_t node,
StringBuffer_t *  sb 
)

_tVisits_t _tthe_t _tgiven_t _tASTNode_t_t _tand_t _tcontinues_t _tthe_t _tinorder_t _ttraversal_t.

_tVisits_t _tthe_t _tgiven_t _tASTNode_t_t _tand_t _tcontinues_t _tthe_t _tinorder_t _ttraversal_t.

◆ FormulaFormatter_visitSqrt()

void FormulaFormatter_visitSqrt ( const ASTNode_t parent,
const ASTNode_t node,
StringBuffer_t *  sb 
)

_tVisits_t _tthe_t _tgiven_t _tASTNode_t_t _tas_t _tthe_t _tfunction_t "_troot_t(_t2_t, _tx_t)" _tand_t _tin_t _tdoing_t _tso_t, _tformats_t _tit_t _tas_t "_tsqrt_t(_tx_t)" (_twhere_t _tx_t _tis_t _tany_t _tsubexpression_t).

_tVisits_t _tthe_t _tgiven_t _tASTNode_t_t _tas_t _tthe_t _tfunction_t "_troot_t(_t2_t, _tx_t)" _tand_t _tin_t _tdoing_t _tso_t, _tformats_t _tit_t _tas_t "_tsqrt_t(_tx_t)" (_twhere_t _tx_t _tis_t _tany_t _tsubexpression_t).

◆ FormulaFormatter_visitUMinus()

void FormulaFormatter_visitUMinus ( const ASTNode_t parent,
const ASTNode_t node,
StringBuffer_t *  sb 
)

_tVisits_t _tthe_t _tgiven_t _tASTNode_t_t _tas_t _ta_t _tunary_t _tminus_t.

_tFor_t _tthis_t _tnode_t _tonly_t _tthe_t _ttraversal_t _tis_t _tpreorder_t.

_tVisits_t _tthe_t _tgiven_t _tASTNode_t_t _tas_t _ta_t _tunary_t _tminus_t.

_tFor_t _tthis_t _tnode_t _tonly_t _tthe_t _ttraversal_t _tis_t _tpreorder_t.

◆ SBML_formulaToString()

char * SBML_formulaToString ( const ASTNode_t tree)

_tConverts_t _tan_t _tAST_t _tto_t _ta_t _tstring_t _trepresentation_t _tof_t _ta_t _tformula_t _tusing_t _ta_t _tsyntax_t _tbasically_t _tderived_t _tfrom_t _tSBML_t _tLevel_t&_tnbsp_t;_t1_t.

@_tcopydetails_t _tdoc_summary_of_string_math_t

@_tcopydetails_t _tdoc_note_l3_parser_encouraged_t

@_tparam_t _ttree_t _tthe_t _tAST_t _tto_t _tbe_t _tconverted_t.

@_treturn_t _tthe_t _tformula_t _tfrom_t _tthe_t _tgiven_t _tAST_t _tas_t _tan_t _tSBML_t _tLevel_t _t1_t _ttext_t-_tstring_t _tmathematical_t _tformula_t. _tThe_t _tcaller_t _towns_t _tthe_t _treturned_t _tstring_t _tand_t _tis_t _tresponsible_t _tfor_t _tfreeing_t _tit_t _twhen_t _tit_t _tis_t _tno_t _tlonger_t _tneeded_t.

@_tsee_t @_tsbmlfunction_t{_tformulaToL3String_t, _tASTNode_t} @_tsee_t @_tsbmlfunction_t{_tformulaToL3StringWithSettings_t, _tASTNode_t\, _tL3ParserSettings_t} @_tsee_t @_tsbmlfunction_t{_tparseL3FormulaWithSettings_t, _tString_t\, _tL3ParserSettings_t} @_tsee_t @_tsbmlfunction_t{_tparseL3FormulaWithModel_t, _tString_t\, _tModel_t} @_tsee_t @_tsbmlfunction_t{_tparseFormula_t, _tString_t}

@_tcopydetails_t _tdoc_note_math_string_syntax_t

@_tif_t _tconly_t @_tmemberof_t _tASTNode_t_t @_tendif_t

_tConverts_t _tan_t _tAST_t _tto_t _ta_t _tstring_t _trepresentation_t _tof_t _ta_t _tformula_t _tusing_t _ta_t _tsyntax_t _tbasically_t _tderived_t _tfrom_t _tSBML_t _tLevel_t&_tnbsp_t;_t1_t.