Revision 606e71d3 autotools/convert-constants
b/autotools/convert-constants | ||
---|---|---|
60 | 60 |
if not CONSTANT_RE.match(name): |
61 | 61 |
lines.append("-- Skipped %s, not constant" % name) |
62 | 62 |
elif isinstance(value, basestring): |
63 |
lines.append("-- | Converted from Python constant %s" % name) |
|
63 | 64 |
lines.append("%s :: String" % hs_name) |
64 | 65 |
lines.append("%s = \"%s\"" % (hs_name, StringValueRules(value))) |
65 | 66 |
elif isinstance(value, int): |
67 |
lines.append("-- | Converted from Python constant %s" % name) |
|
66 | 68 |
lines.append("%s :: Int" % hs_name) |
67 | 69 |
lines.append("%s = %d" % (hs_name, value)) |
68 | 70 |
elif isinstance(value, long): |
71 |
lines.append("-- | Converted from Python constant %s" % name) |
|
69 | 72 |
lines.append("%s :: Integer" % hs_name) |
70 | 73 |
lines.append("%s = %d" % (hs_name, value)) |
71 | 74 |
elif isinstance(value, float): |
75 |
lines.append("-- | Converted from Python constant %s" % name) |
|
72 | 76 |
lines.append("%s :: Double" % hs_name) |
73 | 77 |
lines.append("%s = %f" % (hs_name, value)) |
74 | 78 |
else: |
Also available in: Unified diff