diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-02-12T11·49+0100 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-02-12T11·49+0100 |
commit | b3e8d72770b4100843c60b35633e529e6e69d543 (patch) | |
tree | f50070c3c31dd862b837bb514a9e0b10e68216a1 /src/libexpr/value.hh | |
parent | ae4a3cfa030438ca05ad3bf61fa301dee6c1dbb5 (diff) | |
parent | 5cdcaf5e8edd6679f667502eec421ac4e725d4ef (diff) |
Merge pull request #762 from ctheune/ctheune-floats
Implement floats
Diffstat (limited to 'src/libexpr/value.hh')
-rw-r--r-- | src/libexpr/value.hh | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libexpr/value.hh b/src/libexpr/value.hh index e6d1502cb607..62bdd9281f08 100644 --- a/src/libexpr/value.hh +++ b/src/libexpr/value.hh @@ -22,6 +22,7 @@ typedef enum { tPrimOp, tPrimOpApp, tExternal, + tFloat } ValueType; @@ -38,6 +39,7 @@ class XMLWriter; typedef long NixInt; +typedef float NixFloat; /* External values must descend from ExternalValueBase, so that * type-agnostic nix functions (e.g. showType) can be implemented @@ -141,6 +143,7 @@ struct Value Value * left, * right; } primOpApp; ExternalValueBase * external; + NixFloat fpoint; }; bool isList() const @@ -181,6 +184,14 @@ static inline void mkInt(Value & v, NixInt n) } +static inline void mkFloat(Value & v, NixFloat n) +{ + clearValue(v); + v.type = tFloat; + v.fpoint = n; +} + + static inline void mkBool(Value & v, bool b) { clearValue(v); |