Randall Britten wrote:
> Don't you think we should put a test in somewhere for this?  (Perhaps a
> manual test for it is already in Litmus?).
>   

It is already in Litmus, although we could probably do automated testing 
of PCEnv too (it requires running Javascript as part of the tests, but 
Mozilla do this so we could do this if we want to depend on having debug 
versions of Mozilla available as part of build process - probably a 
space problem for now on my VM, but once we get our testing platform I 
have asked for much more space for the Win32 image).

Best regards,
Andrew

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of CellML
> Automated Notifications
> Sent: Wednesday, 19 September 2007 4:11 p.m.
> To: [EMAIL PROTECTED]
> Subject: r1756 - pce/trunk/chrome/content/ui
>
> Author: amil082
> Date: 2007-09-19 16:10:36 +1200 (Wed, 19 Sep 2007)
> New Revision: 1756
>
> Modified:
>    pce/trunk/chrome/content/ui/Menu.js
> Log:
> Fix export CSV function, which was been broken as a consequence of the move
> to the new
> CCGS.
>
> Modified: pce/trunk/chrome/content/ui/Menu.js
> ===================================================================
> --- pce/trunk/chrome/content/ui/Menu.js       2007-09-18 17:47:09 UTC (rev 
> 1755)
> +++ pce/trunk/chrome/content/ui/Menu.js       2007-09-19 04:10:36 UTC (rev 
> 1756)
> @@ -153,34 +153,48 @@
>  function WriteCSVData(datacollector, cmodel, stream)
>  {
>    var header = '';
> -  var varit = cmodel.codeInformation.iterateVariables();
> +  var ctit = cmodel.codeInformation.iterateTargets();
>    var vars = [];
>    var i;
> -  var v, bv;
> -  while ((v = varit.nextVariable()) != null)
> -    if (v.type == 0/* BOUND*/)
> -      bv = v.source.name + '(' + v.source.unitsName + ')';
> -    else if (v.type == 1/* CONSTANT */)
> +  var ct, bv;
> +  var rateCount = cmodel.codeInformation.rateIndexCount;
> +
> +  while ((ct = ctit.nextComputationTarget()) != null)
> +    if (ct.type == 0/* VARIABLE_OF_INTEGRATION */)
> +      bv = ct.variable.name + '(' + ct.variable.unitsName + ')';
> +    else if (ct.type == 1/* CONSTANT */)
>        ;
> -    else
> -      vars[v.variableIndex] = v.source.name + '(' + v.source.unitsName +
> ')';
> -  var vc = cmodel.codeInformation.variableCount;
> -  for (i = 0; i < vc; i++)
> -  {
> -    if (header != '')
> -      header = header + ',';
> -    header = header + vars[i];
> -  }
> -  if (bv != null)
> -  {
> -    if (header != '')
> -      header = header + ',';
> -    header = header + bv;
> -  }
> +    else if (ct.type == 4/* FLOATING */)
> +      ;
> +    else // state variable or algebraic...
> +    {
> +      var isSV = (ct.type == 2/* STATE_VARIABLE */);
> +      var isRate = (ct.degree > 0);
> +      var idx = isSV ? 1 : (isRate ? rateCount + 1 : 2 * rateCount + 1);
> +      idx += ct.assignedIndex;
> +
> +      var primes = "";
> +      if (isRate)
> +      {
> +        var x;
> +        for (x = ct.degree; x > 0; x--)
> +          primes = primes + "'";
> +      }
> +      else
> +        primes = '(' + ct.variable.unitsName + ')';
> +
> +      vars[idx] = ct.variable.name + primes;
> +    }
> +
> +  header = bv;
> +  var vc = 2 * rateCount + 1 + cmodel.codeInformation.algebraicIndexCount;
> +
> +  for (i = 1; i < vc; i++)
> +    header += ',' + vars[i];
> +
>    header = header + "\n";
>    stream.write(header, header.length);
>  
> -  vc = vc + 1;
>    try
>    {
>      var t = 0;
>
> _______________________________________________
> automated-notifications mailing list
> [EMAIL PROTECTED]
> http://www.cellml.org/mailman/listinfo/automated-notifications
>
>   

_______________________________________________
cellml-discussion mailing list
cellml-discussion@cellml.org
http://www.cellml.org/mailman/listinfo/cellml-discussion

Reply via email to