mathematical 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +12 -0
- data/ext/mathematical/extconf.rb +12 -2
- data/ext/mathematical/{itex2MML.h → itexToMML/itex2MML.h} +0 -0
- data/ext/mathematical/{lex.yy.c → itexToMML/lex.yy.c} +0 -0
- data/ext/mathematical/{y.tab.c → itexToMML/y.tab.c} +0 -0
- data/ext/mathematical/{y.tab.h → itexToMML/y.tab.h} +0 -0
- data/ext/mathematical/lasem/itex2mml/itex2MML.h +63 -0
- data/ext/mathematical/{lasemrender.c → lasem/src/lasemrender.c} +27 -21
- data/ext/mathematical/{lsm.c → lasem/src/lsm.c} +0 -0
- data/ext/mathematical/{lsm.h → lasem/src/lsm.h} +0 -0
- data/ext/mathematical/{lsmattributes.c → lasem/src/lsmattributes.c} +0 -0
- data/ext/mathematical/{lsmattributes.h → lasem/src/lsmattributes.h} +0 -0
- data/ext/mathematical/{lsmcairo.c → lasem/src/lsmcairo.c} +0 -0
- data/ext/mathematical/{lsmcairo.h → lasem/src/lsmcairo.h} +0 -0
- data/ext/mathematical/{lsmdebug.c → lasem/src/lsmdebug.c} +2 -0
- data/ext/mathematical/{lsmdebug.h → lasem/src/lsmdebug.h} +3 -3
- data/ext/mathematical/{lsmdom.h → lasem/src/lsmdom.h} +0 -0
- data/ext/mathematical/{lsmdomcharacterdata.c → lasem/src/lsmdomcharacterdata.c} +0 -0
- data/ext/mathematical/{lsmdomcharacterdata.h → lasem/src/lsmdomcharacterdata.h} +0 -0
- data/ext/mathematical/{lsmdomdocument.c → lasem/src/lsmdomdocument.c} +0 -0
- data/ext/mathematical/{lsmdomdocument.h → lasem/src/lsmdomdocument.h} +0 -0
- data/ext/mathematical/{lsmdomdocumentfragment.c → lasem/src/lsmdomdocumentfragment.c} +0 -0
- data/ext/mathematical/{lsmdomdocumentfragment.h → lasem/src/lsmdomdocumentfragment.h} +0 -0
- data/ext/mathematical/{lsmdomelement.c → lasem/src/lsmdomelement.c} +0 -0
- data/ext/mathematical/{lsmdomelement.h → lasem/src/lsmdomelement.h} +0 -0
- data/ext/mathematical/{lsmdomentities.c → lasem/src/lsmdomentities.c} +0 -0
- data/ext/mathematical/{lsmdomentities.h → lasem/src/lsmdomentities.h} +0 -0
- data/ext/mathematical/{lsmdomimplementation.c → lasem/src/lsmdomimplementation.c} +0 -0
- data/ext/mathematical/{lsmdomimplementation.h → lasem/src/lsmdomimplementation.h} +0 -0
- data/ext/mathematical/{lsmdomnamednodemap.c → lasem/src/lsmdomnamednodemap.c} +0 -0
- data/ext/mathematical/{lsmdomnamednodemap.h → lasem/src/lsmdomnamednodemap.h} +0 -0
- data/ext/mathematical/{lsmdomnode.c → lasem/src/lsmdomnode.c} +0 -0
- data/ext/mathematical/{lsmdomnode.h → lasem/src/lsmdomnode.h} +0 -0
- data/ext/mathematical/{lsmdomnodelist.c → lasem/src/lsmdomnodelist.c} +0 -0
- data/ext/mathematical/{lsmdomnodelist.h → lasem/src/lsmdomnodelist.h} +0 -0
- data/ext/mathematical/{lsmdomparser.c → lasem/src/lsmdomparser.c} +78 -16
- data/ext/mathematical/{lsmdomparser.h → lasem/src/lsmdomparser.h} +7 -7
- data/ext/mathematical/{lsmdomtext.c → lasem/src/lsmdomtext.c} +0 -0
- data/ext/mathematical/{lsmdomtext.h → lasem/src/lsmdomtext.h} +0 -0
- data/ext/mathematical/{lsmdomtypes.h → lasem/src/lsmdomtypes.h} +0 -0
- data/ext/mathematical/{lsmdomview.c → lasem/src/lsmdomview.c} +1 -0
- data/ext/mathematical/{lsmdomview.h → lasem/src/lsmdomview.h} +0 -0
- data/ext/mathematical/{lsmitex.c → lasem/src/lsmitex.c} +4 -4
- data/ext/mathematical/{lsmitex.h → lasem/src/lsmitex.h} +1 -1
- data/ext/mathematical/{lsmmathml.h → lasem/src/lsmmathml.h} +0 -0
- data/ext/mathematical/{lsmmathmlactionelement.c → lasem/src/lsmmathmlactionelement.c} +0 -0
- data/ext/mathematical/{lsmmathmlactionelement.h → lasem/src/lsmmathmlactionelement.h} +0 -0
- data/ext/mathematical/{lsmmathmlaligngroupelement.c → lasem/src/lsmmathmlaligngroupelement.c} +0 -0
- data/ext/mathematical/{lsmmathmlaligngroupelement.h → lasem/src/lsmmathmlaligngroupelement.h} +0 -0
- data/ext/mathematical/{lsmmathmlalignmarkelement.c → lasem/src/lsmmathmlalignmarkelement.c} +0 -0
- data/ext/mathematical/{lsmmathmlalignmarkelement.h → lasem/src/lsmmathmlalignmarkelement.h} +0 -0
- data/ext/mathematical/{lsmmathmlattributes.c → lasem/src/lsmmathmlattributes.c} +0 -0
- data/ext/mathematical/{lsmmathmlattributes.h → lasem/src/lsmmathmlattributes.h} +0 -0
- data/ext/mathematical/{lsmmathmldocument.c → lasem/src/lsmmathmldocument.c} +2 -2
- data/ext/mathematical/{lsmmathmldocument.h → lasem/src/lsmmathmldocument.h} +1 -1
- data/ext/mathematical/{lsmmathmlelement.c → lasem/src/lsmmathmlelement.c} +0 -0
- data/ext/mathematical/{lsmmathmlelement.h → lasem/src/lsmmathmlelement.h} +0 -0
- data/ext/mathematical/{lsmmathmlenums.c → lasem/src/lsmmathmlenums.c} +0 -0
- data/ext/mathematical/{lsmmathmlenums.h → lasem/src/lsmmathmlenums.h} +0 -0
- data/ext/mathematical/{lsmmathmlerrorelement.c → lasem/src/lsmmathmlerrorelement.c} +0 -0
- data/ext/mathematical/{lsmmathmlerrorelement.h → lasem/src/lsmmathmlerrorelement.h} +0 -0
- data/ext/mathematical/{lsmmathmlfencedelement.c → lasem/src/lsmmathmlfencedelement.c} +0 -0
- data/ext/mathematical/{lsmmathmlfencedelement.h → lasem/src/lsmmathmlfencedelement.h} +0 -0
- data/ext/mathematical/{lsmmathmlfractionelement.c → lasem/src/lsmmathmlfractionelement.c} +0 -0
- data/ext/mathematical/{lsmmathmlfractionelement.h → lasem/src/lsmmathmlfractionelement.h} +0 -0
- data/ext/mathematical/{lsmmathmlglyphtableams.c → lasem/src/lsmmathmlglyphtableams.c} +0 -0
- data/ext/mathematical/{lsmmathmlglyphtableams.h → lasem/src/lsmmathmlglyphtableams.h} +0 -0
- data/ext/mathematical/{lsmmathmlitexelement.c → lasem/src/lsmmathmlitexelement.c} +0 -0
- data/ext/mathematical/{lsmmathmlitexelement.h → lasem/src/lsmmathmlitexelement.h} +0 -0
- data/ext/mathematical/{lsmmathmllayoututils.c → lasem/src/lsmmathmllayoututils.c} +0 -0
- data/ext/mathematical/{lsmmathmllayoututils.h → lasem/src/lsmmathmllayoututils.h} +0 -0
- data/ext/mathematical/{lsmmathmlmathelement.c → lasem/src/lsmmathmlmathelement.c} +0 -0
- data/ext/mathematical/{lsmmathmlmathelement.h → lasem/src/lsmmathmlmathelement.h} +0 -0
- data/ext/mathematical/{lsmmathmloperatordictionary.c → lasem/src/lsmmathmloperatordictionary.c} +0 -0
- data/ext/mathematical/{lsmmathmloperatordictionary.h → lasem/src/lsmmathmloperatordictionary.h} +0 -0
- data/ext/mathematical/{lsmmathmloperatorelement.c → lasem/src/lsmmathmloperatorelement.c} +0 -0
- data/ext/mathematical/{lsmmathmloperatorelement.h → lasem/src/lsmmathmloperatorelement.h} +0 -0
- data/ext/mathematical/{lsmmathmlpaddedelement.c → lasem/src/lsmmathmlpaddedelement.c} +0 -0
- data/ext/mathematical/{lsmmathmlpaddedelement.h → lasem/src/lsmmathmlpaddedelement.h} +0 -0
- data/ext/mathematical/{lsmmathmlphantomelement.c → lasem/src/lsmmathmlphantomelement.c} +0 -0
- data/ext/mathematical/{lsmmathmlphantomelement.h → lasem/src/lsmmathmlphantomelement.h} +0 -0
- data/ext/mathematical/{lsmmathmlpresentationcontainer.c → lasem/src/lsmmathmlpresentationcontainer.c} +0 -0
- data/ext/mathematical/{lsmmathmlpresentationcontainer.h → lasem/src/lsmmathmlpresentationcontainer.h} +0 -0
- data/ext/mathematical/{lsmmathmlpresentationtoken.c → lasem/src/lsmmathmlpresentationtoken.c} +0 -0
- data/ext/mathematical/{lsmmathmlpresentationtoken.h → lasem/src/lsmmathmlpresentationtoken.h} +0 -0
- data/ext/mathematical/{lsmmathmlradicalelement.c → lasem/src/lsmmathmlradicalelement.c} +0 -0
- data/ext/mathematical/{lsmmathmlradicalelement.h → lasem/src/lsmmathmlradicalelement.h} +0 -0
- data/ext/mathematical/{lsmmathmlrowelement.c → lasem/src/lsmmathmlrowelement.c} +0 -0
- data/ext/mathematical/{lsmmathmlrowelement.h → lasem/src/lsmmathmlrowelement.h} +0 -0
- data/ext/mathematical/{lsmmathmlscriptelement.c → lasem/src/lsmmathmlscriptelement.c} +0 -0
- data/ext/mathematical/{lsmmathmlscriptelement.h → lasem/src/lsmmathmlscriptelement.h} +0 -0
- data/ext/mathematical/{lsmmathmlsemanticselement.c → lasem/src/lsmmathmlsemanticselement.c} +0 -0
- data/ext/mathematical/{lsmmathmlsemanticselement.h → lasem/src/lsmmathmlsemanticselement.h} +0 -0
- data/ext/mathematical/{lsmmathmlspaceelement.c → lasem/src/lsmmathmlspaceelement.c} +0 -0
- data/ext/mathematical/{lsmmathmlspaceelement.h → lasem/src/lsmmathmlspaceelement.h} +0 -0
- data/ext/mathematical/{lsmmathmlstringelement.c → lasem/src/lsmmathmlstringelement.c} +0 -0
- data/ext/mathematical/{lsmmathmlstringelement.h → lasem/src/lsmmathmlstringelement.h} +0 -0
- data/ext/mathematical/{lsmmathmlstyle.c → lasem/src/lsmmathmlstyle.c} +0 -0
- data/ext/mathematical/{lsmmathmlstyle.h → lasem/src/lsmmathmlstyle.h} +0 -0
- data/ext/mathematical/{lsmmathmlstyleelement.c → lasem/src/lsmmathmlstyleelement.c} +0 -0
- data/ext/mathematical/{lsmmathmlstyleelement.h → lasem/src/lsmmathmlstyleelement.h} +0 -0
- data/ext/mathematical/{lsmmathmltablecellelement.c → lasem/src/lsmmathmltablecellelement.c} +0 -0
- data/ext/mathematical/{lsmmathmltablecellelement.h → lasem/src/lsmmathmltablecellelement.h} +0 -0
- data/ext/mathematical/{lsmmathmltableelement.c → lasem/src/lsmmathmltableelement.c} +0 -0
- data/ext/mathematical/{lsmmathmltableelement.h → lasem/src/lsmmathmltableelement.h} +0 -0
- data/ext/mathematical/{lsmmathmltablerowelement.c → lasem/src/lsmmathmltablerowelement.c} +0 -0
- data/ext/mathematical/{lsmmathmltablerowelement.h → lasem/src/lsmmathmltablerowelement.h} +0 -0
- data/ext/mathematical/{lsmmathmltraits.c → lasem/src/lsmmathmltraits.c} +0 -0
- data/ext/mathematical/{lsmmathmltraits.h → lasem/src/lsmmathmltraits.h} +0 -0
- data/ext/mathematical/{lsmmathmltypes.h → lasem/src/lsmmathmltypes.h} +0 -0
- data/ext/mathematical/{lsmmathmlunderoverelement.c → lasem/src/lsmmathmlunderoverelement.c} +0 -0
- data/ext/mathematical/{lsmmathmlunderoverelement.h → lasem/src/lsmmathmlunderoverelement.h} +0 -0
- data/ext/mathematical/{lsmmathmlutils.c → lasem/src/lsmmathmlutils.c} +0 -0
- data/ext/mathematical/{lsmmathmlutils.h → lasem/src/lsmmathmlutils.h} +0 -0
- data/ext/mathematical/{lsmmathmlview.c → lasem/src/lsmmathmlview.c} +0 -0
- data/ext/mathematical/{lsmmathmlview.h → lasem/src/lsmmathmlview.h} +0 -0
- data/ext/mathematical/{lsmproperties.c → lasem/src/lsmproperties.c} +0 -0
- data/ext/mathematical/{lsmproperties.h → lasem/src/lsmproperties.h} +0 -0
- data/ext/mathematical/{lsmstr.c → lasem/src/lsmstr.c} +0 -0
- data/ext/mathematical/{lsmstr.h → lasem/src/lsmstr.h} +0 -0
- data/ext/mathematical/{lsmsvg.h → lasem/src/lsmsvg.h} +0 -0
- data/ext/mathematical/{lsmsvgaelement.c → lasem/src/lsmsvgaelement.c} +0 -0
- data/ext/mathematical/{lsmsvgaelement.h → lasem/src/lsmsvgaelement.h} +0 -0
- data/ext/mathematical/{lsmsvgattributes.h → lasem/src/lsmsvgattributes.h} +0 -0
- data/ext/mathematical/{lsmsvgcircleelement.c → lasem/src/lsmsvgcircleelement.c} +0 -0
- data/ext/mathematical/{lsmsvgcircleelement.h → lasem/src/lsmsvgcircleelement.h} +0 -0
- data/ext/mathematical/{lsmsvgclippathelement.c → lasem/src/lsmsvgclippathelement.c} +0 -0
- data/ext/mathematical/{lsmsvgclippathelement.h → lasem/src/lsmsvgclippathelement.h} +0 -0
- data/ext/mathematical/{lsmsvgcolors.c → lasem/src/lsmsvgcolors.c} +0 -0
- data/ext/mathematical/{lsmsvgcolors.h → lasem/src/lsmsvgcolors.h} +0 -0
- data/ext/mathematical/{lsmsvgdefselement.c → lasem/src/lsmsvgdefselement.c} +0 -0
- data/ext/mathematical/{lsmsvgdefselement.h → lasem/src/lsmsvgdefselement.h} +0 -0
- data/ext/mathematical/{lsmsvgdocument.c → lasem/src/lsmsvgdocument.c} +0 -0
- data/ext/mathematical/{lsmsvgdocument.h → lasem/src/lsmsvgdocument.h} +0 -0
- data/ext/mathematical/{lsmsvgelement.c → lasem/src/lsmsvgelement.c} +0 -0
- data/ext/mathematical/{lsmsvgelement.h → lasem/src/lsmsvgelement.h} +0 -0
- data/ext/mathematical/{lsmsvgellipseelement.c → lasem/src/lsmsvgellipseelement.c} +0 -0
- data/ext/mathematical/{lsmsvgellipseelement.h → lasem/src/lsmsvgellipseelement.h} +0 -0
- data/ext/mathematical/{lsmsvgenums.c → lasem/src/lsmsvgenums.c} +0 -0
- data/ext/mathematical/{lsmsvgenums.h → lasem/src/lsmsvgenums.h} +0 -0
- data/ext/mathematical/{lsmsvgfilterblend.c → lasem/src/lsmsvgfilterblend.c} +0 -0
- data/ext/mathematical/{lsmsvgfilterblend.h → lasem/src/lsmsvgfilterblend.h} +0 -0
- data/ext/mathematical/{lsmsvgfiltercomposite.c → lasem/src/lsmsvgfiltercomposite.c} +0 -0
- data/ext/mathematical/{lsmsvgfiltercomposite.h → lasem/src/lsmsvgfiltercomposite.h} +0 -0
- data/ext/mathematical/{lsmsvgfilterelement.c → lasem/src/lsmsvgfilterelement.c} +0 -0
- data/ext/mathematical/{lsmsvgfilterelement.h → lasem/src/lsmsvgfilterelement.h} +0 -0
- data/ext/mathematical/{lsmsvgfilterflood.c → lasem/src/lsmsvgfilterflood.c} +0 -0
- data/ext/mathematical/{lsmsvgfilterflood.h → lasem/src/lsmsvgfilterflood.h} +0 -0
- data/ext/mathematical/{lsmsvgfiltergaussianblur.c → lasem/src/lsmsvgfiltergaussianblur.c} +0 -0
- data/ext/mathematical/{lsmsvgfiltergaussianblur.h → lasem/src/lsmsvgfiltergaussianblur.h} +0 -0
- data/ext/mathematical/{lsmsvgfiltermerge.c → lasem/src/lsmsvgfiltermerge.c} +0 -0
- data/ext/mathematical/{lsmsvgfiltermerge.h → lasem/src/lsmsvgfiltermerge.h} +0 -0
- data/ext/mathematical/{lsmsvgfiltermergenode.c → lasem/src/lsmsvgfiltermergenode.c} +0 -0
- data/ext/mathematical/{lsmsvgfiltermergenode.h → lasem/src/lsmsvgfiltermergenode.h} +0 -0
- data/ext/mathematical/{lsmsvgfilteroffset.c → lasem/src/lsmsvgfilteroffset.c} +0 -0
- data/ext/mathematical/{lsmsvgfilteroffset.h → lasem/src/lsmsvgfilteroffset.h} +0 -0
- data/ext/mathematical/{lsmsvgfilterprimitive.c → lasem/src/lsmsvgfilterprimitive.c} +0 -0
- data/ext/mathematical/{lsmsvgfilterprimitive.h → lasem/src/lsmsvgfilterprimitive.h} +0 -0
- data/ext/mathematical/{lsmsvgfilterspecularlighting.c → lasem/src/lsmsvgfilterspecularlighting.c} +0 -0
- data/ext/mathematical/{lsmsvgfilterspecularlighting.h → lasem/src/lsmsvgfilterspecularlighting.h} +0 -0
- data/ext/mathematical/{lsmsvgfiltersurface.c → lasem/src/lsmsvgfiltersurface.c} +0 -0
- data/ext/mathematical/{lsmsvgfiltersurface.h → lasem/src/lsmsvgfiltersurface.h} +0 -0
- data/ext/mathematical/{lsmsvgfiltertile.c → lasem/src/lsmsvgfiltertile.c} +0 -0
- data/ext/mathematical/{lsmsvgfiltertile.h → lasem/src/lsmsvgfiltertile.h} +0 -0
- data/ext/mathematical/{lsmsvggelement.c → lasem/src/lsmsvggelement.c} +0 -0
- data/ext/mathematical/{lsmsvggelement.h → lasem/src/lsmsvggelement.h} +0 -0
- data/ext/mathematical/{lsmsvggradientelement.c → lasem/src/lsmsvggradientelement.c} +0 -0
- data/ext/mathematical/{lsmsvggradientelement.h → lasem/src/lsmsvggradientelement.h} +0 -0
- data/ext/mathematical/{lsmsvgimageelement.c → lasem/src/lsmsvgimageelement.c} +0 -0
- data/ext/mathematical/{lsmsvgimageelement.h → lasem/src/lsmsvgimageelement.h} +0 -0
- data/ext/mathematical/{lsmsvglength.c → lasem/src/lsmsvglength.c} +0 -0
- data/ext/mathematical/{lsmsvglength.h → lasem/src/lsmsvglength.h} +0 -0
- data/ext/mathematical/{lsmsvglineargradientelement.c → lasem/src/lsmsvglineargradientelement.c} +0 -0
- data/ext/mathematical/{lsmsvglineargradientelement.h → lasem/src/lsmsvglineargradientelement.h} +0 -0
- data/ext/mathematical/{lsmsvglineelement.c → lasem/src/lsmsvglineelement.c} +0 -0
- data/ext/mathematical/{lsmsvglineelement.h → lasem/src/lsmsvglineelement.h} +0 -0
- data/ext/mathematical/{lsmsvgmarkerelement.c → lasem/src/lsmsvgmarkerelement.c} +0 -0
- data/ext/mathematical/{lsmsvgmarkerelement.h → lasem/src/lsmsvgmarkerelement.h} +0 -0
- data/ext/mathematical/{lsmsvgmaskelement.c → lasem/src/lsmsvgmaskelement.c} +0 -0
- data/ext/mathematical/{lsmsvgmaskelement.h → lasem/src/lsmsvgmaskelement.h} +0 -0
- data/ext/mathematical/{lsmsvgmatrix.c → lasem/src/lsmsvgmatrix.c} +0 -0
- data/ext/mathematical/{lsmsvgmatrix.h → lasem/src/lsmsvgmatrix.h} +0 -0
- data/ext/mathematical/{lsmsvgpathelement.c → lasem/src/lsmsvgpathelement.c} +0 -0
- data/ext/mathematical/{lsmsvgpathelement.h → lasem/src/lsmsvgpathelement.h} +0 -0
- data/ext/mathematical/{lsmsvgpatternelement.c → lasem/src/lsmsvgpatternelement.c} +0 -0
- data/ext/mathematical/{lsmsvgpatternelement.h → lasem/src/lsmsvgpatternelement.h} +0 -0
- data/ext/mathematical/{lsmsvgpolygonelement.c → lasem/src/lsmsvgpolygonelement.c} +0 -0
- data/ext/mathematical/{lsmsvgpolygonelement.h → lasem/src/lsmsvgpolygonelement.h} +0 -0
- data/ext/mathematical/{lsmsvgpolylineelement.c → lasem/src/lsmsvgpolylineelement.c} +0 -0
- data/ext/mathematical/{lsmsvgpolylineelement.h → lasem/src/lsmsvgpolylineelement.h} +0 -0
- data/ext/mathematical/{lsmsvgradialgradientelement.c → lasem/src/lsmsvgradialgradientelement.c} +0 -0
- data/ext/mathematical/{lsmsvgradialgradientelement.h → lasem/src/lsmsvgradialgradientelement.h} +0 -0
- data/ext/mathematical/{lsmsvgrectelement.c → lasem/src/lsmsvgrectelement.c} +0 -0
- data/ext/mathematical/{lsmsvgrectelement.h → lasem/src/lsmsvgrectelement.h} +0 -0
- data/ext/mathematical/{lsmsvgstopelement.c → lasem/src/lsmsvgstopelement.c} +0 -0
- data/ext/mathematical/{lsmsvgstopelement.h → lasem/src/lsmsvgstopelement.h} +0 -0
- data/ext/mathematical/{lsmsvgstyle.c → lasem/src/lsmsvgstyle.c} +0 -14
- data/ext/mathematical/{lsmsvgstyle.h → lasem/src/lsmsvgstyle.h} +0 -0
- data/ext/mathematical/{lsmsvgsvgelement.c → lasem/src/lsmsvgsvgelement.c} +0 -0
- data/ext/mathematical/{lsmsvgsvgelement.h → lasem/src/lsmsvgsvgelement.h} +0 -0
- data/ext/mathematical/{lsmsvgswitchelement.c → lasem/src/lsmsvgswitchelement.c} +0 -0
- data/ext/mathematical/{lsmsvgswitchelement.h → lasem/src/lsmsvgswitchelement.h} +0 -0
- data/ext/mathematical/{lsmsvgsymbolelement.c → lasem/src/lsmsvgsymbolelement.c} +0 -0
- data/ext/mathematical/{lsmsvgsymbolelement.h → lasem/src/lsmsvgsymbolelement.h} +0 -0
- data/ext/mathematical/{lsmsvgtextelement.c → lasem/src/lsmsvgtextelement.c} +0 -0
- data/ext/mathematical/{lsmsvgtextelement.h → lasem/src/lsmsvgtextelement.h} +0 -0
- data/ext/mathematical/{lsmsvgtraits.c → lasem/src/lsmsvgtraits.c} +0 -0
- data/ext/mathematical/{lsmsvgtraits.h → lasem/src/lsmsvgtraits.h} +0 -0
- data/ext/mathematical/{lsmsvgtransformable.c → lasem/src/lsmsvgtransformable.c} +0 -0
- data/ext/mathematical/{lsmsvgtransformable.h → lasem/src/lsmsvgtransformable.h} +0 -0
- data/ext/mathematical/{lsmsvgtspanelement.c → lasem/src/lsmsvgtspanelement.c} +0 -0
- data/ext/mathematical/{lsmsvgtspanelement.h → lasem/src/lsmsvgtspanelement.h} +0 -0
- data/ext/mathematical/{lsmsvgtypes.h → lasem/src/lsmsvgtypes.h} +0 -0
- data/ext/mathematical/{lsmsvguseelement.c → lasem/src/lsmsvguseelement.c} +0 -0
- data/ext/mathematical/{lsmsvguseelement.h → lasem/src/lsmsvguseelement.h} +0 -0
- data/ext/mathematical/{lsmsvgview.c → lasem/src/lsmsvgview.c} +2 -1
- data/ext/mathematical/{lsmsvgview.h → lasem/src/lsmsvgview.h} +0 -0
- data/ext/mathematical/{lsmtraits.c → lasem/src/lsmtraits.c} +0 -0
- data/ext/mathematical/{lsmtraits.h → lasem/src/lsmtraits.h} +0 -0
- data/ext/mathematical/{lsmtypes.h → lasem/src/lsmtypes.h} +0 -0
- data/ext/mathematical/{lsmutils.c → lasem/src/lsmutils.c} +0 -0
- data/ext/mathematical/{lsmutils.h → lasem/src/lsmutils.h} +0 -0
- data/ext/mathematical/lasem/tests/dom.c +272 -0
- data/ext/mathematical/lasem/tests/lsmtest.c +597 -0
- data/ext/mathematical/lasem/tests/str.c +48 -0
- data/ext/mathematical/lasem/tests/suite.c +125 -0
- data/ext/mathematical/lasem/tools/generate-entity-array.c +2136 -0
- data/ext/mathematical/mathematical.c +38 -34
- data/lib/mathematical/render.rb +5 -4
- data/lib/mathematical/version.rb +1 -1
- data/test/mathematical/maliciousness_test.rb +27 -1
- metadata +242 -242
- data/ext/mathematical/lsmdomenumtypes.c +0 -99
- data/ext/mathematical/lsmdomenumtypes.h +0 -26
- data/ext/mathematical/lsmmathmlenumtypes.c +0 -666
- data/ext/mathematical/lsmmathmlenumtypes.h +0 -90
- data/ext/mathematical/lsmsvgenumtypes.c +0 -1083
- data/ext/mathematical/lsmsvgenumtypes.h +0 -111
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/ext/mathematical/{lsmsvgradialgradientelement.c → lasem/src/lsmsvgradialgradientelement.c}
RENAMED
File without changes
|
data/ext/mathematical/{lsmsvgradialgradientelement.h → lasem/src/lsmsvgradialgradientelement.h}
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -544,17 +544,3 @@ lsm_svg_style_new_inherited (const LsmSvgStyle *parent_style, LsmPropertyBag *pr
|
|
544
544
|
|
545
545
|
return style;
|
546
546
|
}
|
547
|
-
|
548
|
-
#if 0 /* Unused code - remove? */
|
549
|
-
LsmSvgStyle *
|
550
|
-
lsm_svg_style_duplicate (const LsmSvgStyle *origin)
|
551
|
-
{
|
552
|
-
LsmSvgStyle *style;
|
553
|
-
|
554
|
-
style = g_new (LsmSvgStyle, 1);
|
555
|
-
|
556
|
-
memcpy (style, origin, sizeof (LsmSvgStyle));
|
557
|
-
|
558
|
-
return style;
|
559
|
-
}
|
560
|
-
#endif /* 0 */
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1256,7 +1256,8 @@ _show_text (LsmSvgView *view,
|
|
1256
1256
|
|
1257
1257
|
style = view->style;
|
1258
1258
|
|
1259
|
-
lsm_debug_render ("[LsmSvgView::show_text] Show '%s' at %g,%g (%g px)", string,
|
1259
|
+
lsm_debug_render ("[LsmSvgView::show_text] Show '%s' at %g,%g (%g px)", string,
|
1260
|
+
x != NULL ? *x : 0, y != NULL ? *y : 0, style->font_size_px);
|
1260
1261
|
|
1261
1262
|
need_pop = _lock_pango_layout (view);
|
1262
1263
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,272 @@
|
|
1
|
+
#include <glib.h>
|
2
|
+
#include <lsmdom.h>
|
3
|
+
|
4
|
+
static void
|
5
|
+
_weak_ref_cb (void *data, GObject *object)
|
6
|
+
{
|
7
|
+
int *counter = data;
|
8
|
+
|
9
|
+
(*counter)++;
|
10
|
+
}
|
11
|
+
|
12
|
+
static void
|
13
|
+
create_document_test (void)
|
14
|
+
{
|
15
|
+
LsmDomDocument *document;
|
16
|
+
|
17
|
+
document = lsm_dom_implementation_create_document (NULL, "math");
|
18
|
+
g_assert (LSM_IS_DOM_DOCUMENT (document));
|
19
|
+
g_assert_cmpstr (lsm_dom_node_get_node_name (LSM_DOM_NODE (document)), ==, "#document");
|
20
|
+
g_assert (lsm_dom_node_get_node_value (LSM_DOM_NODE (document)) == NULL);
|
21
|
+
|
22
|
+
g_object_unref (document);
|
23
|
+
|
24
|
+
document = lsm_dom_implementation_create_document (NULL, "svg");
|
25
|
+
g_assert (LSM_IS_DOM_DOCUMENT (document));
|
26
|
+
g_assert_cmpstr (lsm_dom_node_get_node_name (LSM_DOM_NODE (document)), ==, "#document");
|
27
|
+
g_assert (lsm_dom_node_get_node_value (LSM_DOM_NODE (document)) == NULL);
|
28
|
+
|
29
|
+
g_object_unref (document);
|
30
|
+
}
|
31
|
+
|
32
|
+
static void
|
33
|
+
owner_document_test (void)
|
34
|
+
{
|
35
|
+
LsmDomDocument *document;
|
36
|
+
LsmDomElement *element;
|
37
|
+
LsmDomElement *text_element;
|
38
|
+
LsmDomText *text;
|
39
|
+
int counter = 0;
|
40
|
+
|
41
|
+
document = lsm_dom_implementation_create_document (NULL, "svg");
|
42
|
+
g_assert (LSM_IS_DOM_DOCUMENT (document));
|
43
|
+
g_assert (lsm_dom_node_get_owner_document (LSM_DOM_NODE (document)) == NULL);
|
44
|
+
|
45
|
+
element = lsm_dom_document_create_element (document, "svg");
|
46
|
+
g_assert (LSM_IS_DOM_ELEMENT (element));
|
47
|
+
g_assert (lsm_dom_node_get_owner_document (LSM_DOM_NODE (element)) == document);
|
48
|
+
|
49
|
+
lsm_dom_node_append_child (LSM_DOM_NODE (document), LSM_DOM_NODE (element));
|
50
|
+
g_assert (lsm_dom_node_get_owner_document (LSM_DOM_NODE (element)) == document);
|
51
|
+
|
52
|
+
text_element = lsm_dom_document_create_element (document, "text");
|
53
|
+
g_assert (LSM_IS_DOM_ELEMENT (text_element));
|
54
|
+
g_assert (lsm_dom_node_get_owner_document (LSM_DOM_NODE (text_element)) == document);
|
55
|
+
|
56
|
+
lsm_dom_node_append_child (LSM_DOM_NODE (element), LSM_DOM_NODE (text_element));
|
57
|
+
|
58
|
+
text = lsm_dom_document_create_text_node (document, "");
|
59
|
+
g_assert (LSM_IS_DOM_TEXT (text));
|
60
|
+
g_assert (lsm_dom_node_get_owner_document (LSM_DOM_NODE (text)) == document);
|
61
|
+
|
62
|
+
lsm_dom_node_append_child (LSM_DOM_NODE (text_element), LSM_DOM_NODE (text));
|
63
|
+
g_assert (lsm_dom_node_get_owner_document (LSM_DOM_NODE (text)) == document);
|
64
|
+
|
65
|
+
g_object_weak_ref (G_OBJECT (document), _weak_ref_cb, &counter);
|
66
|
+
g_object_weak_ref (G_OBJECT (element), _weak_ref_cb, &counter);
|
67
|
+
g_object_weak_ref (G_OBJECT (text_element), _weak_ref_cb, &counter);
|
68
|
+
g_object_weak_ref (G_OBJECT (text), _weak_ref_cb, &counter);
|
69
|
+
|
70
|
+
g_object_unref (document);
|
71
|
+
|
72
|
+
g_assert_cmpint (counter, ==, 4);
|
73
|
+
}
|
74
|
+
|
75
|
+
static void
|
76
|
+
owner_mismatch_test (void)
|
77
|
+
{
|
78
|
+
LsmDomDocument *document_a;
|
79
|
+
LsmDomDocument *document_b;
|
80
|
+
LsmDomElement *element_a;
|
81
|
+
LsmDomElement *element_b;
|
82
|
+
LsmDomElement *element_c;
|
83
|
+
int counter = 0;
|
84
|
+
|
85
|
+
document_a = lsm_dom_implementation_create_document (NULL, "svg");
|
86
|
+
g_assert (LSM_IS_DOM_DOCUMENT (document_a));
|
87
|
+
g_assert (lsm_dom_node_get_owner_document (LSM_DOM_NODE (document_a)) == NULL);
|
88
|
+
|
89
|
+
element_a = lsm_dom_document_create_element (document_a, "svg");
|
90
|
+
element_b = lsm_dom_document_create_element (document_a, "text");
|
91
|
+
|
92
|
+
document_b = lsm_dom_implementation_create_document (NULL, "svg");
|
93
|
+
g_assert (LSM_IS_DOM_DOCUMENT (document_b));
|
94
|
+
g_assert (lsm_dom_node_get_owner_document (LSM_DOM_NODE (document_b)) == NULL);
|
95
|
+
|
96
|
+
element_c = lsm_dom_document_create_element (document_b, "text");
|
97
|
+
|
98
|
+
g_assert (lsm_dom_node_append_child (LSM_DOM_NODE (document_a), LSM_DOM_NODE (element_a)) == LSM_DOM_NODE (element_a));
|
99
|
+
g_assert (lsm_dom_node_append_child (LSM_DOM_NODE (element_a), LSM_DOM_NODE (element_b)) == LSM_DOM_NODE (element_b));
|
100
|
+
|
101
|
+
g_object_weak_ref (G_OBJECT (document_a), _weak_ref_cb, &counter);
|
102
|
+
g_object_weak_ref (G_OBJECT (document_b), _weak_ref_cb, &counter);
|
103
|
+
g_object_weak_ref (G_OBJECT (element_a), _weak_ref_cb, &counter);
|
104
|
+
g_object_weak_ref (G_OBJECT (element_c), _weak_ref_cb, &counter);
|
105
|
+
g_object_weak_ref (G_OBJECT (element_b), _weak_ref_cb, &counter);
|
106
|
+
|
107
|
+
g_assert (lsm_dom_node_append_child (LSM_DOM_NODE (element_a), LSM_DOM_NODE (element_c)) == NULL);
|
108
|
+
|
109
|
+
g_object_unref (document_a);
|
110
|
+
g_object_unref (document_b);
|
111
|
+
|
112
|
+
g_assert_cmpint (counter, ==, 5);
|
113
|
+
}
|
114
|
+
|
115
|
+
static void
|
116
|
+
create_element_test (void)
|
117
|
+
{
|
118
|
+
LsmDomDocument *document;
|
119
|
+
LsmDomElement *element;
|
120
|
+
|
121
|
+
document = lsm_dom_implementation_create_document (NULL, "svg");
|
122
|
+
g_assert (LSM_IS_DOM_DOCUMENT (document));
|
123
|
+
g_assert_cmpstr (lsm_dom_node_get_node_name (LSM_DOM_NODE (document)), ==, "#document");
|
124
|
+
|
125
|
+
element = lsm_dom_document_create_element (document, "unknown");
|
126
|
+
g_assert (element == NULL);
|
127
|
+
|
128
|
+
element = lsm_dom_document_create_element (document, "svg");
|
129
|
+
g_assert (LSM_IS_DOM_ELEMENT (element));
|
130
|
+
|
131
|
+
g_object_unref (element);
|
132
|
+
g_object_unref (document);
|
133
|
+
}
|
134
|
+
|
135
|
+
static void
|
136
|
+
add_remove_element_test (void)
|
137
|
+
{
|
138
|
+
LsmDomDocument *document;
|
139
|
+
LsmDomElement *element;
|
140
|
+
|
141
|
+
document = lsm_dom_implementation_create_document (NULL, "svg");
|
142
|
+
g_assert (LSM_IS_DOM_DOCUMENT (document));
|
143
|
+
|
144
|
+
element = lsm_dom_document_create_element (document, "unknown");
|
145
|
+
g_assert (element == NULL);
|
146
|
+
|
147
|
+
element = lsm_dom_document_create_element (document, "svg");
|
148
|
+
g_assert (LSM_IS_DOM_ELEMENT (element));
|
149
|
+
g_assert_cmpstr (lsm_dom_element_get_tag_name (LSM_DOM_ELEMENT (element)), ==, "svg");
|
150
|
+
g_assert (lsm_dom_node_get_next_sibling (LSM_DOM_NODE (element)) == NULL);
|
151
|
+
g_assert (lsm_dom_node_get_previous_sibling (LSM_DOM_NODE (element)) == NULL);
|
152
|
+
g_assert (lsm_dom_node_get_parent_node (LSM_DOM_NODE (element)) == NULL);
|
153
|
+
|
154
|
+
g_assert (lsm_dom_node_append_child (LSM_DOM_NODE (document), LSM_DOM_NODE (element)) ==
|
155
|
+
LSM_DOM_NODE (element));
|
156
|
+
g_assert (lsm_dom_node_get_parent_node (LSM_DOM_NODE (element)) == LSM_DOM_NODE (document));
|
157
|
+
g_assert (lsm_dom_node_get_owner_document (LSM_DOM_NODE (element)) == document);
|
158
|
+
g_assert (lsm_dom_node_get_first_child (LSM_DOM_NODE (document)) == LSM_DOM_NODE (element));
|
159
|
+
|
160
|
+
g_object_ref (element);
|
161
|
+
|
162
|
+
lsm_dom_node_remove_child (LSM_DOM_NODE (document), LSM_DOM_NODE (element));
|
163
|
+
g_assert (lsm_dom_node_get_first_child (LSM_DOM_NODE (document)) == NULL);
|
164
|
+
g_assert (lsm_dom_node_get_parent_node (LSM_DOM_NODE (element)) == NULL);
|
165
|
+
g_assert (lsm_dom_node_get_owner_document (LSM_DOM_NODE (element)) != NULL);
|
166
|
+
|
167
|
+
g_object_unref (element);
|
168
|
+
g_object_unref (document);
|
169
|
+
}
|
170
|
+
|
171
|
+
static void
|
172
|
+
node_list_test (void)
|
173
|
+
{
|
174
|
+
LsmDomDocument *document;
|
175
|
+
LsmDomElement *element;
|
176
|
+
LsmDomNodeList *childs;
|
177
|
+
int counter = 0;
|
178
|
+
|
179
|
+
document = lsm_dom_implementation_create_document (NULL, "svg");
|
180
|
+
element = lsm_dom_document_create_element (document, "svg");
|
181
|
+
lsm_dom_node_append_child (LSM_DOM_NODE (document), LSM_DOM_NODE (element));
|
182
|
+
|
183
|
+
childs = lsm_dom_node_get_child_nodes (LSM_DOM_NODE (document));
|
184
|
+
g_assert (LSM_IS_DOM_NODE_LIST (childs));
|
185
|
+
g_assert (lsm_dom_node_list_get_length (childs) == 1);
|
186
|
+
g_assert (lsm_dom_node_list_get_item (childs, 0) == LSM_DOM_NODE (element));
|
187
|
+
g_assert (lsm_dom_node_list_get_item (childs, 1) == NULL);
|
188
|
+
|
189
|
+
g_object_weak_ref (G_OBJECT (document), _weak_ref_cb, &counter);
|
190
|
+
g_object_weak_ref (G_OBJECT (element), _weak_ref_cb, &counter);
|
191
|
+
g_object_weak_ref (G_OBJECT (childs), _weak_ref_cb, &counter);
|
192
|
+
|
193
|
+
g_object_ref (childs);
|
194
|
+
g_object_unref (document);
|
195
|
+
|
196
|
+
g_assert (lsm_dom_node_list_get_length (childs) == 0);
|
197
|
+
|
198
|
+
g_object_unref (childs);
|
199
|
+
|
200
|
+
g_assert_cmpint (counter, ==, 3);
|
201
|
+
}
|
202
|
+
|
203
|
+
static void
|
204
|
+
insert_before_test (void)
|
205
|
+
{
|
206
|
+
LsmDomDocument *document;
|
207
|
+
LsmDomNode *node;
|
208
|
+
LsmDomNodeList *childs;
|
209
|
+
LsmDomElement *math;
|
210
|
+
LsmDomElement *mn1;
|
211
|
+
LsmDomElement *mn2;
|
212
|
+
LsmDomElement *mo1;
|
213
|
+
LsmDomElement *mo2;
|
214
|
+
|
215
|
+
document = lsm_dom_implementation_create_document (NULL, "math");
|
216
|
+
math = lsm_dom_document_create_element (document, "math");
|
217
|
+
lsm_dom_node_append_child (LSM_DOM_NODE (document), LSM_DOM_NODE (math));
|
218
|
+
mn1 = lsm_dom_document_create_element (document, "mn");
|
219
|
+
mn2 = lsm_dom_document_create_element (document, "mn");
|
220
|
+
mo1 = lsm_dom_document_create_element (document, "mo");
|
221
|
+
|
222
|
+
node = lsm_dom_node_append_child (LSM_DOM_NODE (math), LSM_DOM_NODE (mn2));
|
223
|
+
g_assert (node == LSM_DOM_NODE (mn2));
|
224
|
+
node = lsm_dom_node_insert_before (LSM_DOM_NODE (math), LSM_DOM_NODE (mn1), LSM_DOM_NODE (mn2));
|
225
|
+
g_assert (node == LSM_DOM_NODE (mn1));
|
226
|
+
node = lsm_dom_node_insert_before (LSM_DOM_NODE (math), LSM_DOM_NODE (mo1), LSM_DOM_NODE (mn2));
|
227
|
+
g_assert (node == LSM_DOM_NODE (mo1));
|
228
|
+
|
229
|
+
childs = lsm_dom_node_get_child_nodes (LSM_DOM_NODE (math));
|
230
|
+
g_assert (LSM_IS_DOM_NODE_LIST (childs));
|
231
|
+
|
232
|
+
g_assert (lsm_dom_node_list_get_item (childs, 0) == LSM_DOM_NODE (mn1));
|
233
|
+
g_assert (lsm_dom_node_list_get_item (childs, 1) == LSM_DOM_NODE (mo1));
|
234
|
+
g_assert (lsm_dom_node_list_get_item (childs, 2) == LSM_DOM_NODE (mn2));
|
235
|
+
g_assert (lsm_dom_node_list_get_length (childs) == 3);
|
236
|
+
|
237
|
+
mo2 = lsm_dom_document_create_element (document, "mo");
|
238
|
+
node = lsm_dom_node_replace_child (LSM_DOM_NODE (math), LSM_DOM_NODE (mo2), LSM_DOM_NODE (mo1));
|
239
|
+
g_assert (node == LSM_DOM_NODE (mo1));
|
240
|
+
|
241
|
+
g_assert (lsm_dom_node_list_get_item (childs, 1) == LSM_DOM_NODE (mo2));
|
242
|
+
g_assert (lsm_dom_node_list_get_length (childs) == 3);
|
243
|
+
|
244
|
+
g_object_unref (mo1);
|
245
|
+
g_object_unref (document);
|
246
|
+
}
|
247
|
+
|
248
|
+
int
|
249
|
+
main (int argc, char *argv[])
|
250
|
+
{
|
251
|
+
int result;
|
252
|
+
|
253
|
+
g_test_init (&argc, &argv, NULL);
|
254
|
+
|
255
|
+
g_test_add_func ("/dom/create-document", create_document_test);
|
256
|
+
g_test_add_func ("/dom/owner-document", owner_document_test);
|
257
|
+
g_test_add_func ("/dom/owner-mismatch", owner_mismatch_test);
|
258
|
+
g_test_add_func ("/dom/create-element", create_element_test);
|
259
|
+
g_test_add_func ("/dom/add-remove-element", add_remove_element_test);
|
260
|
+
g_test_add_func ("/dom/node-list", node_list_test);
|
261
|
+
g_test_add_func ("/dom/insert-before", insert_before_test);
|
262
|
+
|
263
|
+
#if !GLIB_CHECK_VERSION(2,36,0)
|
264
|
+
g_type_init ();
|
265
|
+
#endif
|
266
|
+
|
267
|
+
result = g_test_run();
|
268
|
+
|
269
|
+
lsm_shutdown ();
|
270
|
+
|
271
|
+
return result;
|
272
|
+
}
|
@@ -0,0 +1,597 @@
|
|
1
|
+
/* Lasem - SVG and Mathml library
|
2
|
+
*
|
3
|
+
* lsm-test - Regression test utility for Lasem
|
4
|
+
*
|
5
|
+
* Copyright © 2004 Richard D. Worth
|
6
|
+
* Copyright © 2006 Red Hat, Inc.
|
7
|
+
* Copyright © 2007-2012 Emmanuel Pacaud
|
8
|
+
*
|
9
|
+
* Permission to use, copy, modify, distribute, and sell this software
|
10
|
+
* and its documentation for any purpose is hereby granted without
|
11
|
+
* fee, provided that the above copyright notice appear in all copies
|
12
|
+
* and that both that copyright notice and this permission notice
|
13
|
+
* appear in supporting documentation, and that the name of the authors
|
14
|
+
* not be used in advertising or publicity pertaining to distribution
|
15
|
+
* of the software without specific, written prior permission.
|
16
|
+
* The authors make no representations about the suitability of this
|
17
|
+
* software for any purpose. It is provided "as is" without express
|
18
|
+
* or implied warranty.
|
19
|
+
*
|
20
|
+
* THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
21
|
+
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
|
22
|
+
* NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
23
|
+
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
24
|
+
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
25
|
+
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
26
|
+
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
27
|
+
*
|
28
|
+
* Authors: Emmanuel Pacaud <emmanuel@gnome.org>
|
29
|
+
* Richard D. Worth <richard@theworths.org>
|
30
|
+
* Carl Worth <cworth@cworth.org>
|
31
|
+
*/
|
32
|
+
|
33
|
+
#include "config.h"
|
34
|
+
|
35
|
+
#include <stdio.h>
|
36
|
+
#include <stdlib.h>
|
37
|
+
#include <string.h>
|
38
|
+
#include <assert.h>
|
39
|
+
#ifdef HAVE_UNISTD_H
|
40
|
+
#include <unistd.h>
|
41
|
+
#endif
|
42
|
+
|
43
|
+
#include <lsmmathml.h>
|
44
|
+
#include <glib.h>
|
45
|
+
#include <glib/gprintf.h>
|
46
|
+
#include <gio/gio.h>
|
47
|
+
|
48
|
+
#include <libxml/parser.h>
|
49
|
+
|
50
|
+
#include <../itex2mml/itex2MML.h>
|
51
|
+
|
52
|
+
#define XML_FILENAME "lasemtest.xml"
|
53
|
+
|
54
|
+
static char *option_debug_domains = NULL;
|
55
|
+
static char **option_input_filenames = NULL;
|
56
|
+
double option_ppi = 72.0;
|
57
|
+
static gboolean option_fatal_warning = FALSE;
|
58
|
+
static gboolean option_debug_filter = FALSE;
|
59
|
+
static gboolean option_debug_pattern = FALSE;
|
60
|
+
static gboolean option_debug_mask = FALSE;
|
61
|
+
static gboolean option_debug_group = FALSE;
|
62
|
+
static gboolean option_debug_text = FALSE;
|
63
|
+
static gboolean option_dry_run = FALSE;
|
64
|
+
static double option_compare_fuzz = 10.0;
|
65
|
+
|
66
|
+
static const GOptionEntry entries[] =
|
67
|
+
{
|
68
|
+
{ G_OPTION_REMAINING, ' ', 0, G_OPTION_ARG_FILENAME_ARRAY,
|
69
|
+
&option_input_filenames, NULL, NULL},
|
70
|
+
{ "ppi", 'p', 0, G_OPTION_ARG_DOUBLE,
|
71
|
+
&option_ppi, "Pixel per inch", NULL },
|
72
|
+
{ "debug", 'd', 0, G_OPTION_ARG_STRING,
|
73
|
+
&option_debug_domains, "Debug domains", NULL },
|
74
|
+
{ "fatal-warning", 'f', 0, G_OPTION_ARG_NONE,
|
75
|
+
&option_fatal_warning, "Make warning fatal", NULL },
|
76
|
+
{ "debug-filter", ' ' , 0, G_OPTION_ARG_NONE,
|
77
|
+
&option_debug_filter, "Debug filter surfaces", NULL },
|
78
|
+
{ "debug-pattern", ' ' , 0, G_OPTION_ARG_NONE,
|
79
|
+
&option_debug_pattern, "Debug pattern surfaces", NULL },
|
80
|
+
{ "debug-mask", ' ' , 0, G_OPTION_ARG_NONE,
|
81
|
+
&option_debug_mask, "Debug mask surfaces", NULL },
|
82
|
+
{ "debug-group", ' ' , 0, G_OPTION_ARG_NONE,
|
83
|
+
&option_debug_group, "Debug group surfaces", NULL },
|
84
|
+
{ "debug-text", ' ' , 0, G_OPTION_ARG_NONE,
|
85
|
+
&option_debug_text, "Debug text layout", NULL },
|
86
|
+
{ "dry-run", 'n' , 0, G_OPTION_ARG_NONE,
|
87
|
+
&option_dry_run, "Don't write files", NULL },
|
88
|
+
{ "compare-fuzz", 'z', 0, G_OPTION_ARG_DOUBLE,
|
89
|
+
&option_compare_fuzz, "Compare fuzz", NULL},
|
90
|
+
{ NULL }
|
91
|
+
};
|
92
|
+
|
93
|
+
static const char *fail_face = "";
|
94
|
+
static const char *success_face = "";
|
95
|
+
static const char *normal_face = "";
|
96
|
+
FILE *lasem_test_html_file = NULL;
|
97
|
+
|
98
|
+
typedef struct {
|
99
|
+
double elapsed_time;
|
100
|
+
unsigned int rendered_count;
|
101
|
+
unsigned int comparison_count;
|
102
|
+
unsigned int failed_count;
|
103
|
+
unsigned int success_count;
|
104
|
+
} Statistic;
|
105
|
+
|
106
|
+
static void __attribute__((format(printf,1,2)))
|
107
|
+
lasem_test_html (const char *fmt, ...)
|
108
|
+
{
|
109
|
+
va_list va;
|
110
|
+
FILE *file = lasem_test_html_file ? lasem_test_html_file : stdout;
|
111
|
+
|
112
|
+
va_start (va, fmt);
|
113
|
+
vfprintf (file, fmt, va);
|
114
|
+
va_end (va);
|
115
|
+
}
|
116
|
+
|
117
|
+
static GRegex *regex_mml = NULL;
|
118
|
+
|
119
|
+
typedef struct _buffer_diff_result {
|
120
|
+
unsigned int pixels_changed;
|
121
|
+
unsigned int max_diff;
|
122
|
+
} buffer_diff_result_t;
|
123
|
+
|
124
|
+
typedef guint32 pixman_bits_t;
|
125
|
+
|
126
|
+
static void
|
127
|
+
buffer_diff_core (unsigned char *_buf_a,
|
128
|
+
unsigned char *_buf_b,
|
129
|
+
unsigned char *_buf_diff,
|
130
|
+
int width,
|
131
|
+
int height,
|
132
|
+
int stride,
|
133
|
+
pixman_bits_t mask,
|
134
|
+
buffer_diff_result_t *result_ret)
|
135
|
+
{
|
136
|
+
int x, y;
|
137
|
+
pixman_bits_t *row_a, *row_b, *row;
|
138
|
+
buffer_diff_result_t result = {0, 0};
|
139
|
+
pixman_bits_t *buf_a = (pixman_bits_t*)_buf_a;
|
140
|
+
pixman_bits_t *buf_b = (pixman_bits_t*)_buf_b;
|
141
|
+
pixman_bits_t *buf_diff = (pixman_bits_t*)_buf_diff;
|
142
|
+
|
143
|
+
stride /= sizeof(pixman_bits_t);
|
144
|
+
for (y = 0; y < height; y++)
|
145
|
+
{
|
146
|
+
row_a = buf_a + y * stride;
|
147
|
+
row_b = buf_b + y * stride;
|
148
|
+
row = buf_diff + y * stride;
|
149
|
+
for (x = 0; x < width; x++)
|
150
|
+
{
|
151
|
+
/* check if the pixels are the same */
|
152
|
+
if ((row_a[x] & mask) != (row_b[x] & mask)) {
|
153
|
+
int channel;
|
154
|
+
pixman_bits_t diff_pixel = 0;
|
155
|
+
|
156
|
+
/* calculate a difference value for all 4 channels */
|
157
|
+
for (channel = 0; channel < 4; channel++) {
|
158
|
+
int value_a = (row_a[x] >> (channel*8)) & 0xff;
|
159
|
+
int value_b = (row_b[x] >> (channel*8)) & 0xff;
|
160
|
+
unsigned int diff;
|
161
|
+
diff = abs (value_a - value_b);
|
162
|
+
if (diff > result.max_diff)
|
163
|
+
result.max_diff = diff;
|
164
|
+
diff *= 4; /* emphasize */
|
165
|
+
if (diff)
|
166
|
+
diff += 128; /* make sure it's visible */
|
167
|
+
if (diff > 255)
|
168
|
+
diff = 255;
|
169
|
+
diff_pixel |= diff << (channel*8);
|
170
|
+
}
|
171
|
+
|
172
|
+
result.pixels_changed++;
|
173
|
+
row[x] = diff_pixel;
|
174
|
+
} else {
|
175
|
+
row[x] = 0;
|
176
|
+
}
|
177
|
+
row[x] |= 0xff000000; /* Set ALPHA to 100% (opaque) */
|
178
|
+
}
|
179
|
+
}
|
180
|
+
|
181
|
+
*result_ret = result;
|
182
|
+
}
|
183
|
+
|
184
|
+
static gboolean
|
185
|
+
compare_surfaces (const char *test_name, cairo_surface_t *surface_a, cairo_surface_t *surface_b)
|
186
|
+
{
|
187
|
+
int width_a, width_b, height_a, height_b, stride_a, stride_b;
|
188
|
+
|
189
|
+
if (surface_b == NULL)
|
190
|
+
return FALSE;
|
191
|
+
if (surface_a == NULL)
|
192
|
+
return FALSE;
|
193
|
+
|
194
|
+
width_a = cairo_image_surface_get_width (surface_a);
|
195
|
+
height_a = cairo_image_surface_get_height (surface_a);
|
196
|
+
stride_a = cairo_image_surface_get_stride (surface_a);
|
197
|
+
width_b = cairo_image_surface_get_width (surface_b);
|
198
|
+
height_b = cairo_image_surface_get_height (surface_b);
|
199
|
+
stride_b = cairo_image_surface_get_stride (surface_b);
|
200
|
+
|
201
|
+
if (width_a == width_b && height_a == height_b && stride_a == stride_b) {
|
202
|
+
buffer_diff_result_t result;
|
203
|
+
cairo_surface_t *surface_diff;
|
204
|
+
char *diff_png_filename;
|
205
|
+
char *command;
|
206
|
+
char *command_result = NULL;
|
207
|
+
int command_status;
|
208
|
+
|
209
|
+
diff_png_filename = g_strdup_printf ("%s-diff.png", test_name);
|
210
|
+
|
211
|
+
surface_diff = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
|
212
|
+
width_a, height_a);
|
213
|
+
|
214
|
+
buffer_diff_core (cairo_image_surface_get_data (surface_a),
|
215
|
+
cairo_image_surface_get_data (surface_b),
|
216
|
+
cairo_image_surface_get_data (surface_diff),
|
217
|
+
cairo_image_surface_get_width (surface_a),
|
218
|
+
cairo_image_surface_get_height (surface_a),
|
219
|
+
cairo_image_surface_get_stride (surface_a),
|
220
|
+
0xffffffff,
|
221
|
+
&result);
|
222
|
+
|
223
|
+
cairo_surface_write_to_png (surface_diff, diff_png_filename);
|
224
|
+
|
225
|
+
cairo_surface_destroy (surface_diff);
|
226
|
+
g_free (diff_png_filename);
|
227
|
+
|
228
|
+
if (result.pixels_changed == 0) {
|
229
|
+
g_printf (" %sOK%s \n", success_face, normal_face);
|
230
|
+
return TRUE;
|
231
|
+
}
|
232
|
+
|
233
|
+
command = g_strdup_printf ("compare -metric AE -fuzz %g%% %s-out.png %s-ref.png %s-compare-diff.png",
|
234
|
+
option_compare_fuzz, test_name, test_name, test_name);
|
235
|
+
g_spawn_command_line_sync (command, NULL, &command_result, &command_status, NULL);
|
236
|
+
g_free (command);
|
237
|
+
|
238
|
+
if (command_result != NULL && atoi (command_result) == 0) {
|
239
|
+
g_printf (" %sOK%s \n", success_face, normal_face);
|
240
|
+
return TRUE;
|
241
|
+
}
|
242
|
+
}
|
243
|
+
|
244
|
+
g_printf (" %sFAIL%s \n", fail_face, normal_face);
|
245
|
+
return FALSE;
|
246
|
+
}
|
247
|
+
|
248
|
+
static void
|
249
|
+
lasem_test_render (char const *filename, gboolean compare, gboolean dry_run, Statistic *statistic)
|
250
|
+
{
|
251
|
+
LsmDomDocument *document;
|
252
|
+
LsmDomView *view;
|
253
|
+
GTimer *timer;
|
254
|
+
cairo_t *cairo;
|
255
|
+
cairo_surface_t *surface;
|
256
|
+
char *buffer = NULL;
|
257
|
+
gsize size;
|
258
|
+
char *png_filename;
|
259
|
+
char *reference_png_filename;
|
260
|
+
char *test_name;
|
261
|
+
char *mime;
|
262
|
+
unsigned int width, height;
|
263
|
+
gboolean is_xml, success;
|
264
|
+
gboolean is_svg;
|
265
|
+
gboolean is_mathml;
|
266
|
+
gboolean check;
|
267
|
+
GRegex *regex;
|
268
|
+
GError *error = NULL;
|
269
|
+
char *filtered_buffer;
|
270
|
+
|
271
|
+
g_return_if_fail (statistic != NULL);
|
272
|
+
|
273
|
+
test_name = g_regex_replace (regex_mml, filename, -1, 0, "", 0, NULL);
|
274
|
+
|
275
|
+
png_filename = g_strdup_printf ("%s-out.png", test_name);
|
276
|
+
reference_png_filename = g_strdup_printf ("%s-ref.png", test_name);
|
277
|
+
if (g_file_test (reference_png_filename, G_FILE_TEST_IS_REGULAR)) {
|
278
|
+
check = compare;
|
279
|
+
} else {
|
280
|
+
g_free (reference_png_filename);
|
281
|
+
reference_png_filename = g_strdup_printf ("%s.png", test_name);
|
282
|
+
check = FALSE;
|
283
|
+
}
|
284
|
+
|
285
|
+
mime = g_content_type_guess (filename, NULL, 0, NULL);
|
286
|
+
|
287
|
+
is_svg = strcmp (mime, "image/svg+xml") == 0;
|
288
|
+
is_mathml = (strcmp (mime, "text/mathml") == 0) || (strcmp (mime, "application/mathml+xml") == 0);
|
289
|
+
is_xml = is_svg || is_mathml;
|
290
|
+
|
291
|
+
g_printf ("\trender %s (%s)", filename, mime);
|
292
|
+
g_free (mime);
|
293
|
+
|
294
|
+
success = g_file_get_contents (filename, &buffer, &size, NULL);
|
295
|
+
if (success) {
|
296
|
+
LsmBox viewport;
|
297
|
+
char *xml;
|
298
|
+
|
299
|
+
if (is_xml)
|
300
|
+
xml = buffer;
|
301
|
+
else {
|
302
|
+
xml = itex2MML_parse (buffer, size);
|
303
|
+
size = 0;
|
304
|
+
}
|
305
|
+
|
306
|
+
timer = g_timer_new ();
|
307
|
+
|
308
|
+
document = lsm_dom_document_new_from_memory (xml, size, NULL);
|
309
|
+
|
310
|
+
lsm_dom_document_set_path (document, filename);
|
311
|
+
|
312
|
+
view = lsm_dom_document_create_view (document);
|
313
|
+
|
314
|
+
viewport.x = 0.0;
|
315
|
+
viewport.y = 0.0;
|
316
|
+
viewport.width = 480.0;
|
317
|
+
viewport.height = 360.0;
|
318
|
+
|
319
|
+
lsm_dom_view_set_resolution (view, option_ppi);
|
320
|
+
lsm_dom_view_set_viewport_pixels (view, &viewport);
|
321
|
+
lsm_dom_view_get_size_pixels (LSM_DOM_VIEW (view), &width, &height, NULL);
|
322
|
+
|
323
|
+
if (option_debug_mask)
|
324
|
+
lsm_dom_view_set_debug (view, "mask", TRUE);
|
325
|
+
if (option_debug_pattern)
|
326
|
+
lsm_dom_view_set_debug (view, "pattern", TRUE);
|
327
|
+
if (option_debug_filter)
|
328
|
+
lsm_dom_view_set_debug (view, "filter", TRUE);
|
329
|
+
if (option_debug_group)
|
330
|
+
lsm_dom_view_set_debug (view, "group", TRUE);
|
331
|
+
if (option_debug_text)
|
332
|
+
lsm_dom_view_set_debug (view, "text", TRUE);
|
333
|
+
|
334
|
+
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width + 2, height + 2);
|
335
|
+
cairo = cairo_create (surface);
|
336
|
+
cairo_surface_destroy (surface);
|
337
|
+
|
338
|
+
lsm_dom_view_render (LSM_DOM_VIEW (view), cairo, 1, 1);
|
339
|
+
|
340
|
+
statistic->elapsed_time += g_timer_elapsed (timer, NULL);
|
341
|
+
statistic->rendered_count++;
|
342
|
+
g_timer_destroy (timer);
|
343
|
+
|
344
|
+
if (!dry_run)
|
345
|
+
cairo_surface_write_to_png (surface, png_filename);
|
346
|
+
|
347
|
+
if (check) {
|
348
|
+
cairo_surface_t *reference_surface;
|
349
|
+
|
350
|
+
reference_surface = cairo_image_surface_create_from_png (reference_png_filename);
|
351
|
+
if (reference_surface != NULL) {
|
352
|
+
gboolean same;
|
353
|
+
|
354
|
+
same = compare_surfaces (test_name, surface, reference_surface);
|
355
|
+
cairo_surface_destroy (reference_surface);
|
356
|
+
|
357
|
+
if (same)
|
358
|
+
statistic->success_count++;
|
359
|
+
else
|
360
|
+
statistic->failed_count++;
|
361
|
+
statistic->comparison_count++;
|
362
|
+
}
|
363
|
+
} else
|
364
|
+
g_printf ("\n");
|
365
|
+
|
366
|
+
cairo_destroy (cairo);
|
367
|
+
|
368
|
+
g_object_unref (view);
|
369
|
+
g_object_unref (document);
|
370
|
+
|
371
|
+
lasem_test_html ("<table border=\"1\" cellpadding=\"8\">\n");
|
372
|
+
lasem_test_html ("<tr>");
|
373
|
+
|
374
|
+
lasem_test_html ("<td><a href=\"%s\"><img border=\"0\" src=\"%s\"/></a></td>",
|
375
|
+
filename, png_filename);
|
376
|
+
lasem_test_html ("<td><img src=\"%s\"/></td>", reference_png_filename);
|
377
|
+
|
378
|
+
lasem_test_html ("<td>");
|
379
|
+
|
380
|
+
if (is_mathml) {
|
381
|
+
regex = g_regex_new ("<math>", 0, 0, &error);
|
382
|
+
assert (error == NULL);
|
383
|
+
|
384
|
+
filtered_buffer = g_regex_replace (regex, xml,
|
385
|
+
-1, 0,
|
386
|
+
"<math xmlns=\"http://www.w3.org/1998/Math/MathML\">",
|
387
|
+
0, NULL);
|
388
|
+
g_regex_unref (regex);
|
389
|
+
|
390
|
+
lasem_test_html ("%s", filtered_buffer);
|
391
|
+
|
392
|
+
g_free (filtered_buffer);
|
393
|
+
}
|
394
|
+
|
395
|
+
if (is_svg) {
|
396
|
+
lasem_test_html ("<object type=\"image/svg+xml\" data=\"");
|
397
|
+
lasem_test_html ("%s", filename);
|
398
|
+
lasem_test_html ("\" width=\"%dpx\"/>", width + 2);
|
399
|
+
}
|
400
|
+
|
401
|
+
lasem_test_html ("</td>");
|
402
|
+
lasem_test_html ("</tr>\n");
|
403
|
+
lasem_test_html ("</table>\n");
|
404
|
+
|
405
|
+
if (!is_xml && !g_file_test (reference_png_filename, G_FILE_TEST_IS_REGULAR) && !dry_run) {
|
406
|
+
FILE *file;
|
407
|
+
int result __attribute__((unused));
|
408
|
+
char *cmd;
|
409
|
+
|
410
|
+
file = fopen ("lsmmathmltest.tmp", "w");
|
411
|
+
fprintf (file, "\\documentclass[10pt]{article}\n");
|
412
|
+
fprintf (file, "\\usepackage{amsmath}\n");
|
413
|
+
fprintf (file, "\\usepackage{amsfonts}\n");
|
414
|
+
fprintf (file, "\\usepackage{amssymb}\n");
|
415
|
+
fprintf (file, "\\usepackage{pst-plot}\n");
|
416
|
+
fprintf (file, "\\usepackage{color}\n");
|
417
|
+
fprintf (file, "\\pagestyle{empty}\n");
|
418
|
+
fprintf (file, "\\begin{document}\n");
|
419
|
+
fprintf (file, "%s\n", buffer);
|
420
|
+
fprintf (file, "\\end{document}\n");
|
421
|
+
fclose (file);
|
422
|
+
|
423
|
+
result = system ("latex --interaction=nonstopmode lsmmathmltest.tmp");
|
424
|
+
result = system ("dvips -E lsmmathmltest.dvi -o lsmmathmltest.ps");
|
425
|
+
|
426
|
+
cmd = g_strdup_printf ("convert -density 120 lsmmathmltest.ps %s", reference_png_filename);
|
427
|
+
result = system (cmd);
|
428
|
+
g_free (cmd);
|
429
|
+
|
430
|
+
result = system ("rm lsmmathmltest.tmp");
|
431
|
+
result = system ("rm lsmmathmltest.dvi");
|
432
|
+
result = system ("rm lsmmathmltest.log");
|
433
|
+
result = system ("rm lsmmathmltest.aux");
|
434
|
+
result = system ("rm lsmmathmltest.ps");
|
435
|
+
}
|
436
|
+
|
437
|
+
if (xml != buffer && !dry_run) {
|
438
|
+
char *xml_filename;
|
439
|
+
|
440
|
+
xml_filename = g_strdup_printf ("%s.xml", test_name);
|
441
|
+
|
442
|
+
g_file_set_contents (xml_filename, xml, -1, NULL);
|
443
|
+
|
444
|
+
g_free (xml_filename);
|
445
|
+
g_free (buffer);
|
446
|
+
itex2MML_free_string (xml);
|
447
|
+
} else
|
448
|
+
g_free (xml);
|
449
|
+
}
|
450
|
+
|
451
|
+
g_free (png_filename);
|
452
|
+
g_free (reference_png_filename);
|
453
|
+
|
454
|
+
g_free (test_name);
|
455
|
+
}
|
456
|
+
|
457
|
+
static void
|
458
|
+
lasem_test_process_dir (const char *name, gboolean compare, gboolean dry_run, Statistic *statistic)
|
459
|
+
{
|
460
|
+
GDir *directory;
|
461
|
+
GError *error = NULL;
|
462
|
+
const char *entry;
|
463
|
+
char *filename;
|
464
|
+
unsigned int n_files = 0;
|
465
|
+
|
466
|
+
directory = g_dir_open (name, 0, &error);
|
467
|
+
assert (error == NULL);
|
468
|
+
|
469
|
+
g_printf ("In directory %s\n", name);
|
470
|
+
|
471
|
+
lasem_test_html ("<h1>%s</h1>", name);
|
472
|
+
|
473
|
+
do {
|
474
|
+
entry = g_dir_read_name (directory);
|
475
|
+
if (entry != NULL &&
|
476
|
+
strstr (entry, "ignore-") != entry &&
|
477
|
+
strcmp (entry, "images") != 0)
|
478
|
+
{
|
479
|
+
filename = g_build_filename (name, entry, NULL);
|
480
|
+
|
481
|
+
if (g_file_test (filename, G_FILE_TEST_IS_DIR))
|
482
|
+
lasem_test_process_dir (filename, compare, dry_run, statistic);
|
483
|
+
else if (g_file_test (filename, G_FILE_TEST_IS_REGULAR) &&
|
484
|
+
g_regex_match (regex_mml, filename, 0, NULL)) {
|
485
|
+
lasem_test_render (filename, compare, dry_run, statistic);
|
486
|
+
n_files++;
|
487
|
+
}
|
488
|
+
|
489
|
+
g_free (filename);
|
490
|
+
}
|
491
|
+
} while (entry != NULL);
|
492
|
+
|
493
|
+
g_dir_close (directory);
|
494
|
+
}
|
495
|
+
|
496
|
+
static gboolean
|
497
|
+
check_for_compare (void)
|
498
|
+
{
|
499
|
+
char *result, *output;
|
500
|
+
|
501
|
+
g_spawn_command_line_sync ("compare --version", &output, &result, NULL, NULL);
|
502
|
+
|
503
|
+
g_free (output);
|
504
|
+
|
505
|
+
if (result != NULL) {
|
506
|
+
g_free (result);
|
507
|
+
return TRUE;
|
508
|
+
}
|
509
|
+
|
510
|
+
g_printf ("Compare utility not found.\nPlease install ImageMagick.\n");
|
511
|
+
return FALSE;
|
512
|
+
}
|
513
|
+
|
514
|
+
int
|
515
|
+
main (int argc, char **argv)
|
516
|
+
{
|
517
|
+
GOptionContext *context;
|
518
|
+
GError *error = NULL;
|
519
|
+
unsigned int i;
|
520
|
+
unsigned int n_input_files = 0;
|
521
|
+
Statistic statistic = {0, 0, 0, 0, 0};
|
522
|
+
|
523
|
+
if (!check_for_compare())
|
524
|
+
return EXIT_FAILURE;
|
525
|
+
|
526
|
+
#ifdef HAVE_UNISTD_H
|
527
|
+
if (isatty (2)) {
|
528
|
+
fail_face = "\033[41m\033[37m\033[1m";
|
529
|
+
success_face = "\033[42m\033[37m\033[1m";
|
530
|
+
normal_face = "\033[m";
|
531
|
+
}
|
532
|
+
#endif
|
533
|
+
|
534
|
+
lasem_test_html_file = fopen (XML_FILENAME, "w");
|
535
|
+
|
536
|
+
lasem_test_html ("<?xml version=\"1.0\"?>");
|
537
|
+
lasem_test_html ("<!DOCTYPE html PUBLIC "
|
538
|
+
"\"-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN\" "
|
539
|
+
"\"http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd\">");
|
540
|
+
lasem_test_html ("<html xmlns=\"http://www.w3.org/1999/xhtml\">\n");
|
541
|
+
lasem_test_html ("<body>\n");
|
542
|
+
|
543
|
+
#if !GLIB_CHECK_VERSION(2,36,0)
|
544
|
+
g_type_init ();
|
545
|
+
#endif
|
546
|
+
|
547
|
+
context = g_option_context_new (NULL);
|
548
|
+
g_option_context_add_main_entries (context, entries, NULL);
|
549
|
+
|
550
|
+
if (!g_option_context_parse (context, &argc, &argv, &error))
|
551
|
+
{
|
552
|
+
g_option_context_free (context);
|
553
|
+
g_print ("Option parsing failed: %s\n", error->message);
|
554
|
+
return 1;
|
555
|
+
}
|
556
|
+
|
557
|
+
g_option_context_free (context);
|
558
|
+
|
559
|
+
lsm_debug_enable (option_debug_domains);
|
560
|
+
|
561
|
+
if (option_fatal_warning)
|
562
|
+
g_log_set_fatal_mask ("Lasem", G_LOG_FATAL_MASK | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);
|
563
|
+
|
564
|
+
regex_mml = g_regex_new ("\\.(mml|tex|svg)$", 0, 0, &error);
|
565
|
+
assert (error == NULL);
|
566
|
+
|
567
|
+
n_input_files = option_input_filenames != NULL ? g_strv_length (option_input_filenames) : 0;
|
568
|
+
if (n_input_files == 1 && g_file_test (option_input_filenames[0], G_FILE_TEST_IS_DIR))
|
569
|
+
lasem_test_process_dir (option_input_filenames[0], TRUE, option_dry_run, &statistic);
|
570
|
+
else {
|
571
|
+
if (n_input_files > 0)
|
572
|
+
for (i = 0; i < n_input_files; i++)
|
573
|
+
lasem_test_render (option_input_filenames[i], TRUE, option_dry_run, &statistic);
|
574
|
+
else
|
575
|
+
lasem_test_process_dir (".", TRUE, option_dry_run, &statistic);
|
576
|
+
}
|
577
|
+
|
578
|
+
lasem_test_html ("</body>\n");
|
579
|
+
lasem_test_html ("</html>\n");
|
580
|
+
|
581
|
+
if (lasem_test_html_file != NULL)
|
582
|
+
fclose (lasem_test_html_file);
|
583
|
+
|
584
|
+
g_regex_unref (regex_mml);
|
585
|
+
|
586
|
+
g_printf ("%d files processed in %g seconds.\n", statistic.rendered_count, statistic.elapsed_time);
|
587
|
+
if (statistic.comparison_count > 0)
|
588
|
+
g_printf ("%s%d/%d%s comparison failures.\n",
|
589
|
+
statistic.failed_count > 0 ? fail_face : success_face,
|
590
|
+
statistic.failed_count,
|
591
|
+
statistic.comparison_count,
|
592
|
+
normal_face);
|
593
|
+
|
594
|
+
return 0;
|
595
|
+
}
|
596
|
+
|
597
|
+
/* vim: set sw=8 sts=8: -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 8 -*- */
|