summaryrefslogtreecommitdiff
path: root/Libraries/LibWeb/CodeGenerators
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-04-06 10:12:10 +0200
committerAndreas Kling <kling@serenityos.org>2020-04-06 10:49:27 +0200
commit0d48fb9a8770adc089f5e5943b4c359115909524 (patch)
treee3f70330a438d3f930c86c9d25ddd08a30d3963e /Libraries/LibWeb/CodeGenerators
parent63b11e094db38fc433e6a105c3f559b0c69bef7d (diff)
downloadserenity-0d48fb9a8770adc089f5e5943b4c359115909524.zip
AK: Add out() and warn() streams that forward to stdout and stderr
Our C++ code generator tools have been relying on host-side dbg() being forwarded to stdout until now. Now they use out() instead. Hopefully this will make it easier and more enticing to use streams in userspace programs as well. :^)
Diffstat (limited to 'Libraries/LibWeb/CodeGenerators')
-rw-r--r--Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_cpp/Generate_CSS_PropertyID_cpp.cpp38
-rw-r--r--Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_h/Generate_CSS_PropertyID_h.cpp18
2 files changed, 28 insertions, 28 deletions
diff --git a/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_cpp/Generate_CSS_PropertyID_cpp.cpp b/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_cpp/Generate_CSS_PropertyID_cpp.cpp
index f31fe62310..2b34a62cd8 100644
--- a/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_cpp/Generate_CSS_PropertyID_cpp.cpp
+++ b/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_cpp/Generate_CSS_PropertyID_cpp.cpp
@@ -58,36 +58,36 @@ int main(int argc, char** argv)
auto json = JsonValue::from_string(file->read_all());
ASSERT(json.is_object());
- dbg() << "#include <AK/Assertions.h>";
- dbg() << "#include <LibWeb/CSS/PropertyID.h>";
- dbg() << "namespace Web {";
- dbg() << "namespace CSS {";
+ out() << "#include <AK/Assertions.h>";
+ out() << "#include <LibWeb/CSS/PropertyID.h>";
+ out() << "namespace Web {";
+ out() << "namespace CSS {";
- dbg() << "PropertyID property_id_from_string(const StringView& string) {";
+ out() << "PropertyID property_id_from_string(const StringView& string) {";
json.as_object().for_each_member([&](auto& name, auto& value) {
ASSERT(value.is_object());
- dbg() << " if (string == \"" << name << "\")";
- dbg() << " return PropertyID::" << title_casify(name) << ";";
+ out() << " if (string == \"" << name << "\")";
+ out() << " return PropertyID::" << title_casify(name) << ";";
});
- dbg() << " return PropertyID::Invalid;";
+ out() << " return PropertyID::Invalid;";
- dbg() << "}";
+ out() << "}";
- dbg() << "const char* string_from_property_id(PropertyID property_id) {";
- dbg() << " switch (property_id) {";
+ out() << "const char* string_from_property_id(PropertyID property_id) {";
+ out() << " switch (property_id) {";
json.as_object().for_each_member([&](auto& name, auto& value) {
ASSERT(value.is_object());
- dbg() << " case PropertyID::" << title_casify(name) << ":";
- dbg() << " return \"" << name << "\";";
+ out() << " case PropertyID::" << title_casify(name) << ":";
+ out() << " return \"" << name << "\";";
});
- dbg() << " default:";
- dbg() << " return \"(invalid CSS::PropertyID)\";";
- dbg() << " }";
- dbg() << "}";
- dbg() << "}";
- dbg() << "}";
+ out() << " default:";
+ out() << " return \"(invalid CSS::PropertyID)\";";
+ out() << " }";
+ out() << "}";
+ out() << "}";
+ out() << "}";
return 0;
}
diff --git a/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_h/Generate_CSS_PropertyID_h.cpp b/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_h/Generate_CSS_PropertyID_h.cpp
index 8ebe39deee..04cd3d9278 100644
--- a/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_h/Generate_CSS_PropertyID_h.cpp
+++ b/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_h/Generate_CSS_PropertyID_h.cpp
@@ -58,21 +58,21 @@ int main(int argc, char** argv)
auto json = JsonValue::from_string(file->read_all());
ASSERT(json.is_object());
- dbg() << "#pragma once";
- dbg() << "#include <AK/StringView.h>";
- dbg() << "#include <AK/Traits.h>";
+ out() << "#pragma once";
+ out() << "#include <AK/StringView.h>";
+ out() << "#include <AK/Traits.h>";
- dbg() << "namespace Web {";
- dbg() << "namespace CSS {";
- dbg() << "enum class PropertyID {";
- dbg() << " Invalid,";
+ out() << "namespace Web {";
+ out() << "namespace CSS {";
+ out() << "enum class PropertyID {";
+ out() << " Invalid,";
json.as_object().for_each_member([&](auto& name, auto& value) {
ASSERT(value.is_object());
- dbg() << " " << title_casify(name) << ",";
+ out() << " " << title_casify(name) << ",";
});
- dbg() << "};\n\
+ out() << "};\n\
PropertyID property_id_from_string(const StringView&);\n\
const char* string_from_property_id(PropertyID);\n\
}\n\