- From: ak.miller at auckland.ac.nz (Andrew Miller)
- Subject: [cellml-dev] Using MathMLToInputFormat in C++
- Date: Thu, 19 Nov 2009 16:41:46 +1300
Lucian Smith wrote:
>
So! Thanks in no small part to the rest of you, I have now successfully
>
compiled OpenCell, and with that as a guide, believe I will be able to
>
successfully steal the MathMLToInputFormat and InputFormatToMathML
>
functions hidden therein--I now am #including 'MathMLInputServices.h' in
>
my own code, and seem to have access to the functions.
Hi Lucian,
OpenCell accesses the API through XPCOM (part of the Mozilla framework);
we have code to generate a bridge between the PCM (Physiome C++ Mapping,
which the API is written in) and XPCOM. XPCOM can be accessed from
either C++ or Javascript.
You could build a standalone XPCOM based program, or make your program
xulrunner based, or alternatively, rewrite the math input code to not
use XPCOM.
See
https://developer.mozilla.org/en/xpcom for more information on XPCOM.
Best wishes,
Andrew
>
>
However, I can't work out how to provide the correct objects to actually
>
call those functions. And I can't use OpenCell as a guide, because (as
>
far as I can tell) those functions are only called from Java.
>
>
So, I have two things I need: One, how do I change a
>
'iface::mathml_dom::MathMLElement*' into a
>
'mathml_domIMathMLApplyElement*' ? Is this even possible? There are two
>
hurdles that I can see--one is changing an 'Element' into an
>
'ApplyElement', and one is (basically) changing the '::' into an 'I' ;-)
>
>
The second thing I need is to know what to do with 'ACString's or
>
'nsACString's. I tracked down 'nsStringAPI.h' from xulrunner-sdk, but I
>
get an error if I include it:
>
>
/home/lpsmith/xulrunner-sdk/include/xpcom/nsStringAPI.h:1054: error: size
>
of array 'arg' is negative
>
>
If I use it anyway and create a 'nsACString' object, I get a new error:
>
>
/home/lpsmith/xulrunner-sdk/include/xpcom/nsStringAPI.h:705: error:
>
'nsACString::~nsACString()' is protected
>
src/module-cellml.cpp:178: error: within this context
>
>
Here's my current, not-working code for some context:
>
>
cellml_api::MathList* mathlist = component->math();
>
cellml_api::MathMLElementIterator* mli = mathlist->iterate();
>
mathlist->release_ref();
>
mathml_dom::MathMLElement* mathel;
>
while((mathel = mli->next()) != NULL) {
>
nsACString blank;
>
blank = "";
>
MathMLInputServices mmlis;
>
mmlis.MathMLToInputFormat(NULL, NULL, blank, blank);
>
mathel->release_ref();
>
}
>
mli->release_ref();
>
>
>
So, I need to change 'mathel' into something to use it instead of NULL,
>
and I need to do something different with my 'nsACString' object.
>
>
Hints, anyone? And/or documentation where I could read about this sort of
>
thing? I think part of this is just that the whole interface thing is
>
throwing me for a loop.
>
>
-Lucian
>
_______________________________________________
>
cellml-tools-developers mailing list
>
cellml-tools-developers at cellml.org
>
http://www.cellml.org/mailman/listinfo/cellml-tools-developers
Archive powered by MHonArc 2.6.18.