Mercurial > projects > ldc
view gen/logger.c @ 11:d3ee9efe20e2 trunk
[svn r15] * Fixed a bunch problems with virtual calls. Seems I did some rather poor testing.
* Now 50/51 tests compile.
* Added a simple runalltests.d scripts that should be run with 'gdmd -run runalltests.d' - LLVMDC will not compile it yet.
author | lindquist |
---|---|
date | Tue, 02 Oct 2007 05:10:18 +0200 |
parents | e116aa1488e6 |
children | 27b2f40bdb58 |
line wrap: on
line source
#ifndef LLVMD_NO_LOGGER #include <cassert> #include <cstdarg> #include <cstdio> #include <cstdlib> #include <iostream> #include <string> #include "gen/logger.h" namespace Logger { static std::string indent_str; void indent() { indent_str += " "; } void undent() { assert(!indent_str.empty()); indent_str.resize(indent_str.size()-2); } std::ostream& cout() { return std::cout << indent_str; } void println(const char* fmt,...) { printf(indent_str.c_str()); va_list va; va_start(va,fmt); vprintf(fmt,va); va_end(va); printf("\n"); } void print(const char* fmt,...) { printf(indent_str.c_str()); va_list va; va_start(va,fmt); vprintf(fmt,va); va_end(va); } } #endif