-doIt :: CmdLineInfo -> String -> MainIO ()
-#ifndef DPH
-doIt (switch_lookup_fn, core_cmds, stg_cmds) input_pgm
-#else
-doIt (switch_lookup_fn, core_cmds, podize_cmds, pcore_cmds, stg_cmds) input_pgm
-#endif {- Data Parallel Haskell -}
- --
- -- Help functions and boring global variables (e.g., printing style)
- -- are figured out first; the "business end" follows, in the
- -- body of the let.
- --
- = let
- -- ****** help functions:
-
- switch_is_on switch = switchIsOn switch_lookup_fn switch
-
- string_switch_is_on switch
- = maybeToBool (stringSwitchSet switch_lookup_fn switch)
-
- show_pass
- = if switch_is_on D_show_passes
- then \ what -> writeMn stderr ("*** "++what++":\n")
- else \ what -> returnMn ()
-
- doOutput switch io_action
- = BSCC("doOutput")
- case (stringSwitchSet switch_lookup_fn switch) of
- Nothing -> returnMn ()
- Just fname ->
- fopen fname "a+" `thenMn` \ file ->
- if (file == ``NULL'') then
- error ("doOutput: failed to open:"++fname)
- else
- io_action file `thenMn` \ () ->
- fclose file `thenMn` \ status ->
- if status == 0
- then returnMn ()
- else error ("doOutput: closed failed: "{-++show status++" "-}++fname)
- ESCC
-
- doDump switch hdr string
- = BSCC("doDump")
- if (switch_is_on switch)
- then writeMn stderr hdr `thenMn_`
- writeMn stderr ('\n': string) `thenMn_`
- writeMn stderr "\n"
- else returnMn ()
- ESCC
-
- -- ****** printing styles and column width:
-
- pprCols = (80 :: Int) -- could make configurable
-
- (pprStyle, pprErrorsStyle)
- = if switch_is_on PprStyle_All then
- (PprShowAll, PprShowAll)
- else if switch_is_on PprStyle_Debug then
- (PprDebug, PprDebug)
- else if switch_is_on PprStyle_User then
- (PprForUser, PprForUser)
- else -- defaults...
- (PprDebug, PprForUser)
-
- pp_show p = ppShow {-WAS:pprCols-}10000{-random-} p
- in
- -- non-tuple-ish bindings...
-
- -- ****** possibly fiddle builtin namespaces:
-
- BIND (BSCC("builtinEnv")
- builtinNameInfo switch_is_on {-switch looker-upper-}
- ESCC
- )
- _TO_ (init_val_lookup_fn, init_tc_lookup_fn) ->
-
- -- **********************************************
- -- Welcome to the business end of the main module
- -- of the Glorious Glasgow Haskell compiler!
- -- **********************************************
-#ifndef DPH
- doDump Verbose "Glasgow Haskell Compiler, version 0.27" "" `thenMn_`
-#else
- doDump Verbose "Data Parallel Haskell Compiler, version 0.06 (Glasgow 0.27)" ""
- `thenMn_`
-#endif {- Data Parallel Haskell -}