From 978119ba717afa02126f7b78d0452d236db7513a Mon Sep 17 00:00:00 2001 From: qrczak Date: Sat, 13 Jan 2001 20:34:25 +0000 Subject: [PATCH] [project @ 2001-01-13 20:33:51 by qrczak] Use a replacement for LINE pragmas under nhc. --- ghc/utils/hsc2hs/Main.hs | 4 ++-- ghc/utils/hsc2hs/template-hsc.h | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ghc/utils/hsc2hs/Main.hs b/ghc/utils/hsc2hs/Main.hs index 71abaa3..be87ec6 100644 --- a/ghc/utils/hsc2hs/Main.hs +++ b/ghc/utils/hsc2hs/Main.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $Id: Main.hs,v 1.10 2001/01/13 19:46:49 qrczak Exp $ +-- $Id: Main.hs,v 1.11 2001/01/13 20:33:51 qrczak Exp $ -- -- (originally "GlueHsc.hs" by Marcin 'Qrczak' Kowalczyk) -- @@ -409,7 +409,7 @@ outCLine pos = outHsLine :: SourcePos -> String outHsLine pos = - " printf (\"{-# LINE %d \\\"%s\\\" #-}\\n\", "++ + " hsc_line ("++ show (sourceLine pos + 1)++", \""++ showCString (sourceFileName pos)++"\");\n" diff --git a/ghc/utils/hsc2hs/template-hsc.h b/ghc/utils/hsc2hs/template-hsc.h index 9b68c98..df8747d 100644 --- a/ghc/utils/hsc2hs/template-hsc.h +++ b/ghc/utils/hsc2hs/template-hsc.h @@ -11,6 +11,14 @@ #define offsetof(t, f) ((size_t) &((t *)0)->f) #endif +#if __NHC__ +#define hsc_line(line, file) \ + printf ("# %d \"%s\"\n", line, file); +#else +#define hsc_line(line, file) \ + printf ("{-# LINE %d \"%s\" #-}\n", line, file); +#endif + #define hsc_const(x) \ if ((x) < 0) \ printf ("%ld", (long)(x)); \ -- 1.7.10.4