Am Mittwoch, 7. Januar 2004 20:37 schrieb Alastair Reid: > > I want to use Haskell files with #ifdef, #else and #endif preprocessor > > directives. I tried hugs -F "cpp -P" <source_file_name> but cpp > > complains about unterminated character constants. What is wrong? > > ANSI C preprocessors tend to get confused by the quotes in lines like the > following: > > f x = x' where x' = ... > g x = x' > where > x' = ... > > You can often avoid this by putting cpp in 'K&R mode'. For example, GNU cpp > accepts '-traditional'.
I tried hugs -F "cpp -P -traditional" but got the same error message as without -traditional. This message is, suprisingly, sh: line 1: /usr/lib/hugs/libraries/Hugs/Prelude.hs: Permission denied ERROR "/usr/lib/hugs/libraries/Hugs/Prelude.hs" - Module "case" recursively imports itself FATAL ERROR: Unable to load Prelude. I started hugs without the -F option and then tried to set it via :set -F"cpp -P -traditional". After this I loaded my input file via :load and got these messages: cpp0: output pipe has been closed cpp0: output pipe has been closed cpp0: output pipe has been closed cpp0: output pipe has been closed cpp0: output pipe has been closed cpp0: output pipe has been closed cpp0: output pipe has been closed cpp0: output pipe has been closed cpp0: output pipe has been closed ERROR "./RegAlloc/Data/Graphs.hs":42 - Syntax error in input (unexpected selector "#ifdef") So cpp gives strange error messages and #ifdefs still don't work. > I'm attaching a shell script you might use (from end of hugs98/Install in > the Hugs98 distribution). (Not tested recently but ought to work.) > [...] > if $running_under_some_random_shell; Is this real code? > [...] > # Reads CPP output and turns #line things into appropriate Haskell > # pragmas. This program is derived from the "hscpp" script > # distributed with the Glasgow Haskell Compiler. I already looked for hscpp but it doesn't seem to be included in 6.2. Is it still in use with GHC? > [...] Wolfgang _______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell