diff options
author | Ian Lynagh <ian@well-typed.com> | 2012-09-18 17:43:15 +0100 |
---|---|---|
committer | Ian Lynagh <ian@well-typed.com> | 2012-09-18 17:43:15 +0100 |
commit | b44db6f1fac8e5c166104d6158eeaccbe9eb223d (patch) | |
tree | 77e560d4578d43d4d9e44549005f908bd2bdbf5f /includes/mkDerivedConstants.c | |
parent | 98903b9626ab332eeac9d4baeb6854dd47272e8c (diff) | |
download | haskell-b44db6f1fac8e5c166104d6158eeaccbe9eb223d.tar.gz |
Remove some uses of the WORDS_BIGENDIAN CPP symbol
Diffstat (limited to 'includes/mkDerivedConstants.c')
-rw-r--r-- | includes/mkDerivedConstants.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/includes/mkDerivedConstants.c b/includes/mkDerivedConstants.c index 558d709f94..c73233288a 100644 --- a/includes/mkDerivedConstants.c +++ b/includes/mkDerivedConstants.c @@ -293,6 +293,27 @@ enum Mode { Gen_Haskell_Type, Gen_Haskell_Value, Gen_Haskell_Wrappers, Gen_Haske #define FUN_OFFSET(sym) (OFFSET(Capability,f.sym) - OFFSET(Capability,r)) +void constantBool(char *haskellName, int val) { + switch (mode) { + case Gen_Haskell_Type: + printf(" , pc_%s :: Bool\n", haskellName); + break; + case Gen_Haskell_Value: + printf(" , pc_%s = %s\n", haskellName, val ? "True" : "False"); + break; + case Gen_Haskell_Wrappers: + printf("%s :: DynFlags -> Bool\n", haskellName); + printf("%s dflags = pc_%s (sPlatformConstants (settings dflags))\n", + haskellName, haskellName); + break; + case Gen_Haskell_Exports: + printf(" %s,\n", haskellName); + break; + case Gen_Header: + break; + } +} + void constantIntC(char *cName, char *haskellName, intptr_t val) { /* If the value is larger than 2^28 or smaller than -2^28, then fail. This test is a bit conservative, but if any constants are roughly @@ -700,6 +721,14 @@ main(int argc, char *argv[]) // Amount of pointer bits used for semi-tagging constructor closures constantInt("tAG_BITS", TAG_BITS); + constantBool("wORDS_BIGENDIAN", +#ifdef WORDS_BIGENDIAN + 1 +#else + 0 +#endif + ); + switch (mode) { case Gen_Haskell_Type: printf(" } deriving (Read, Show)\n"); |