C code generation



> I need to generate C code from the results of maxima.  The
> string() command almost does it, except it uses a^b form for
> powers and C doesn't have the ^ operator.

For the simple case (no subscripts, no %I, etc.), the following should
work.

printval(var):=
    block([val],
          val: var=ev(var),
          val: subst(["^"='pow,%e=euler],val),
          fortran(val));

qq: (x+y)^3-%e^x+sin(log(y));

printval('qq);

      qq = (-1)*pow(EULER,x)+pow(y+x,3)+SIN(LOG(y))

If you want to get fancier, you might as well modify the Fortran
function directly.

      -s