def fprocess(infilep,outfilep):
pattern = r'<STR_LIT>'<EOL>eqn = re.compile(pattern,re.DOTALL)<EOL>s = infilep.read()<EOL>def parser(mo):<EOL><INDENT>ccode = parse(mo.group(<NUM_LIT:1>))<EOL>return "<STR_LIT>"%(mo.group(<NUM_LIT:1>),ccode)<EOL><DEDENT>content = eqn.sub(parser,s)<EOL>outfilep.write(content)<EOL>
Scans an input file for LA equations between double square brackets,
e.g. [[ M3_mymatrix = M3_anothermatrix^-1 ]], and replaces the expression
with a comment containing the equation followed by nested function calls
that implement the equation as C code. A trailing semi-colon is appended.
The equation within [[ ]] should NOT end with a semicolon as that will raise
a ParseException. However, it is ok to have a semicolon after the right brackets.

Other text in the file is unaltered.

The arguments are file objects (NOT file names) opened for reading and
writing, respectively.