|
definition: |
preprocess :: PPOpts -> String -> String -> String -> String -> IO ()
preprocess opts modname orgfile infile outfile
| null pptargets
= -- no target specified: apply all reasonable transformations
preprocess opts { optTgts = [ForeignCode, DefaultRules, Contracts] }
modname orgfile infile outfile
| otherwise
= do let savefile = orgfile++".SAVEPPORG"
starttime <- getCPUTime
renameFile orgfile savefile
srcprog <- readFile (if orgfile==infile then savefile else infile)
>>= return . replaceOptionsLine
-- remove currypp option to avoid recursive preprocessor calls:
writeFile orgfile srcprog
outtxt <- catch (callPreprocessors opts (optionLines srcprog)
modname srcprog orgfile)
(\err -> renameFile savefile orgfile >> ioError err)
writeFile outfile outtxt
renameFile savefile orgfile
stoptime <- getCPUTime
when (optVerb opts > 1) $ putStrLn
("Transformation time: " ++
show (stoptime-starttime) ++ " ms")
where
pptargets = optTgts opts
|
|
demand: |
argument 1 |
|
deterministic: |
deterministic operation |
|
documentation: |
Start the Curry preprocessor: |
|
indeterministic: |
might be indeterministic |
|
infix: |
no fixity defined |
|
iotype: |
{(_,_,_,_,_) |-> _}
|
|
name: |
preprocess |
|
precedence: |
no precedence defined |
|
result-values: |
_ |
|
signature: |
PPOpts -> String -> String -> String -> String -> Prelude.IO () |
|
solution-complete: |
operation might suspend on free variables |
|
terminating: |
possibly non-terminating |
|
totally-defined: |
possibly non-reducible on same data term |