diff -r 0a202714eea4 -r 588cc27e84bb databuffer.h --- a/databuffer.h Wed Dec 19 04:20:02 2012 +0200 +++ b/databuffer.h Wed Dec 19 13:44:18 2012 +0200 @@ -43,6 +43,7 @@ #include #include #include "common.h" +#include "stringtable.h" #define MAX_MARKS 512 @@ -279,6 +280,22 @@ count += !!refs[u]; return count; } + + // Write a float into the buffer + void WriteFloat (str floatstring) { + // TODO: Casting float to word causes the decimal to be lost. + // Find a way to store the number without such loss. + float val = atof (floatstring); + Write (DH_PUSHNUMBER); + Write (static_cast ((val > 0) ? val : -val)); + if (val < 0) + Write (DH_UNARYMINUS); + } + + void WriteString (str string) { + Write (DH_PUSHSTRINGINDEX); + Write (PushToStringTable (string)); + } }; #endif // __DATABUFFER_H__ \ No newline at end of file