23 */ |
23 */ |
24 |
24 |
25 #include "html.h" |
25 #include "html.h" |
26 |
26 |
27 #include <cstdio> |
27 #include <cstdio> |
|
28 #include <cassert> |
28 |
29 |
29 using namespace std::chrono; |
30 using namespace std::chrono; |
30 |
31 |
31 namespace html { |
32 namespace html { |
32 static constexpr const char* weekdays[] = {"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"}; |
33 static constexpr const char* weekdays[] = {"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"}; |
33 |
34 |
34 static unsigned indentation; |
35 static unsigned indentation; |
35 static const char *tabs = " "; |
36 static const char *tabs = " "; |
36 static void indent(int change = 0) { |
37 static void indent(int change = 0) { |
37 indentation += change; |
38 indentation += change; |
|
39 assert(indentation >= 0); |
|
40 assert(indentation <= max_indentation); |
38 fwrite(tabs, 4, indentation, stdout); |
41 fwrite(tabs, 4, indentation, stdout); |
39 } |
42 } |
40 |
43 |
41 static std::string encode(const std::string &data) { |
44 static std::string encode(const std::string &data) { |
42 std::string buffer; |
45 std::string buffer; |