X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=cbits%2FPrelIOUtils.c;h=9e05f08396be7df894733564fd449263b4458f5a;hb=487b9d4571a847ee0273b4627aaa135c46a51b8d;hp=556736e86b36b3c83865e4728e7391b9ade7fcd6;hpb=6473a780bd38170c6813b70a735c5e282b10d24c;p=ghc-base.git diff --git a/cbits/PrelIOUtils.c b/cbits/PrelIOUtils.c index 556736e..9e05f08 100644 --- a/cbits/PrelIOUtils.c +++ b/cbits/PrelIOUtils.c @@ -5,14 +5,48 @@ */ #define INLINE + +#ifdef __GLASGOW_HASKELL__ +# include "Rts.h" +#endif + #include "HsBase.h" +#ifdef __GLASGOW_HASKELL__ + void errorBelch2(const char*s, char *t) { - return errorBelch(s,t); + errorBelch(s,t); } void debugBelch2(const char*s, char *t) { - return debugBelch(s,t); + debugBelch(s,t); +} + +#if defined(HAVE_LIBCHARSET) +# include +#elif defined(HAVE_LANGINFO_H) +# include +#endif + +#if !defined(mingw32_HOST_OS) +const char* localeEncoding(void) +{ +#if defined(HAVE_LIBCHARSET) + return locale_charset(); + +#elif defined(HAVE_LANGINFO_H) + return nl_langinfo(CODESET); + +#else +#warning Depending on the unportable behavior of GNU iconv due to absence of both libcharset and langinfo.h + /* GNU iconv accepts "" to mean the current locale's + * encoding. Warning: This isn't portable. + */ + return ""; +#endif } +#endif + +#endif /* __GLASGOW_HASKELL__ */