A list for the developers of CellML tools

Text archives Help


[cellml-dev] CellML wchar sizes


Chronological Thread 
  • From: lpsmith at spod-central.org (Lucian Smith)
  • Subject: [cellml-dev] CellML wchar sizes
  • Date: Thu, 10 Dec 2009 00:40:18 +0000

* Andrew Miller <ak.miller at auckland.ac.nz> [2009-12-09 00:46] writes:
>
> Are you running this with xulrunner, or through your own code directly
> using XPCOM? If the latter, are you requesting XPCOM components be
> registered?
>
> If you are using xulrunner, or are registering XPCOM components, are the
> CellML XPCOM components in the correct components directory? Is your
> PATH or LD_LIBRARY_PATH, depending on the platform, correct, so that the
> CellML API libraries are in the loader path (the shared objects
> themselves, not the .la files from libtool)?

Whoops, the first time I read this I thought it only applied to using
xulrunner, but on a re-read, I saw that it was indeed relevant to me.
And making a components/ directory, as well as initializing XPCOM a la
http://www.ibm.com/developerworks/webservices/library/co-xpcom3.html
('Enabling XPCOM in an application') seems to have done the trick! Now if
I run my little test program in the directory where the components
subdirectory is, it runs. I fails to run if invoked from anywhere else,
which is annoying, but since it runs at all, I am willing to punt on that
one, at least for now.

I now seem to be getting to issues that are actually interesting and not
just syntax related. I am trying to call the cellml-to-infix bit from
OpenCell with the following code:

nsCOMPtr<cellml_apiIMathContainer> mc(do_QueryInterface(component));
nsCOMPtr<cellml_apiIMathList> mathlist;
rv = mc->GetMath(getter_AddRefs(mathlist));
nsCOMPtr<cellml_apiIMathMLElementIterator> mli;
rv = mathlist->Iterate(getter_AddRefs(mli));
nsCOMPtr<mathml_domIMathMLElement> mathel;
rv = mli->Next(getter_AddRefs(mathel));
while(mathel != NULL) {
nsCString indent;
indent = "";
nsCString infix;
nsCOMPtr<mathml_domIMathMLApplyElement> input(do_QueryInterface(mathel,
&rv));
if (input != NULL) {
MathMLInputServices mmlis;
rv = mmlis.MathMLToInputFormat(input, NULL, indent, infix);
//Here's where we translate the MathML to Infix and figure out whether
it was
// an assignment rule or a rate rule.
cout << infix.get();
}
rv = mli->Next(getter_AddRefs(mathel));
}

My thought was that the 'mathel' in question would be the root of the math
element in the model, and would necessarily be an 'apply' element. As
such, the 'do_QueryInterface' line would (in essence) cast the MathElement
to a MathApplyElement, which the mmlis needed. However, 'input' is always
NULL, and if I check rv, I get the code "NS_NOINTERFACE". I can imagine a
few different things that might be going wrong here--maybe the root math
element is *not* actually the 'apply' bit, or maybe what I think is
casting is not actually casting, or maybe I forgot to include something
somewhere like the components/ directory or... something else is going
wrong. Any ideas? Thank you all again!

-Lucian




Archive powered by MHonArc 2.6.18.

Top of page