xo-allod: + per-type stats + pretty printing
This commit is contained in:
parent
150bfa4aa2
commit
13f4fb0935
26 changed files with 473 additions and 203 deletions
|
|
@ -42,6 +42,12 @@ namespace xo {
|
|||
return Reflect::make_tp(const_cast<Boolean*>(this));
|
||||
}
|
||||
|
||||
void
|
||||
Boolean::display(std::ostream & os) const
|
||||
{
|
||||
os << (value_ ? "#t" : "#f");
|
||||
}
|
||||
|
||||
std::size_t
|
||||
Boolean::_shallow_size() const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -29,6 +29,11 @@ namespace xo {
|
|||
return Reflect::make_tp(const_cast<Integer*>(this));
|
||||
}
|
||||
|
||||
void
|
||||
Integer::display(std::ostream & os) const {
|
||||
os << value_;
|
||||
}
|
||||
|
||||
std::size_t
|
||||
Integer::_shallow_size() const {
|
||||
return sizeof(Integer);
|
||||
|
|
|
|||
|
|
@ -75,6 +75,18 @@ namespace xo {
|
|||
return Reflect::make_tp(const_cast<List*>(this));
|
||||
}
|
||||
|
||||
void
|
||||
List::display(std::ostream & os) const {
|
||||
gp<List> l = const_cast<List*>(this);
|
||||
|
||||
os << "(";
|
||||
while (!l->is_nil()) {
|
||||
os << l->head();
|
||||
l = l->rest();
|
||||
}
|
||||
os << ")";
|
||||
}
|
||||
|
||||
std::size_t
|
||||
List::_shallow_size() const {
|
||||
return sizeof(List);
|
||||
|
|
|
|||
|
|
@ -96,6 +96,13 @@ namespace xo {
|
|||
return Reflect::make_tp(const_cast<String*>(this));
|
||||
}
|
||||
|
||||
void
|
||||
String::display(std::ostream & os) const {
|
||||
// TODO: print with escapes
|
||||
|
||||
os << "\"" << c_str() << "\"";
|
||||
}
|
||||
|
||||
// ----- GC support -----
|
||||
|
||||
std::size_t
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue