return result;
}
-long long BinaryParser::parse_int()
+IntType::Store BinaryParser::parse_int()
{
- long long result = 0;
+ IntType::Store result = 0;
unsigned bits = 0;
while(in)
break;
}
- const long long mask = 1LL<<(bits-1);
+ const IntType::Store mask = 1LL<<(bits-1);
result = (result^mask)-mask;
return result;
}
-float BinaryParser::parse_float()
+FloatType::Store BinaryParser::parse_float()
{
union
{
return f;
}
-bool BinaryParser::parse_bool()
+BoolType::Store BinaryParser::parse_bool()
{
return in.get();
}
-string BinaryParser::parse_string()
+StringType::Store BinaryParser::parse_string()
{
int len = parse_int();
if(len>=0)
return get_item(strings, -len);
}
-Symbol BinaryParser::parse_symbol()
+SymbolType::Store BinaryParser::parse_symbol()
{
return get_item(strings, parse_int());
}
virtual Statement parse();
private:
Statement parse_statement();
- long long parse_int();
- float parse_float();
- std::string parse_string();
- bool parse_bool();
- Symbol parse_symbol();
+ IntType::Store parse_int();
+ FloatType::Store parse_float();
+ StringType::Store parse_string();
+ BoolType::Store parse_bool();
+ SymbolType::Store parse_symbol();
};
} // namespace DataFile
collect_keywords(*i);
}
-void BinaryWriter::write_int(long long n)
+void BinaryWriter::write_int(IntType::Store n)
{
- unsigned i = sizeof(long long)-1;
+ unsigned i = sizeof(IntType::Store)-1;
if(n>=0)
for(; (i>0 && (n>>(i*7-1))==0); --i) ;
out.put((n>>(i*7) & 0x7F) | (i?0x80:0));
}
-void BinaryWriter::write_string(const string &s)
+void BinaryWriter::write_string(const StringType::Store &s)
{
StringMap::const_iterator i = strings.find(s);
if(i!=strings.end())
}
}
-void BinaryWriter::write_float(float f)
+void BinaryWriter::write_float(FloatType::Store f)
{
union
{
#endif
}
-void BinaryWriter::write_symbol(const Symbol &s)
+void BinaryWriter::write_symbol(const SymbolType::Store &s)
{
write_int(get_item(strings, s.name));
}
private:
void write_(const Statement &st);
void collect_keywords(const Statement &st);
- void write_int(long long n);
- void write_string(const std::string &s);
- void write_float(float f);
- void write_symbol(const Symbol &s);
+ void write_int(IntType::Store n);
+ void write_string(const StringType::Store &s);
+ void write_float(FloatType::Store f);
+ void write_symbol(const SymbolType::Store &s);
};
} // namespace DataFile