[Zion] Move to StrFormat for debug line.

This commit is contained in:
Drew Galbraith 2023-11-05 09:24:09 -08:00
parent 4af19d010f
commit 69aced2220
23 changed files with 142 additions and 89 deletions

View file

@ -1,4 +1,4 @@
add_library(glacier STATIC
set(glacier_files
string/string.cpp
string/string_builder.cpp
string/string_view.cpp
@ -6,9 +6,24 @@ add_library(glacier STATIC
string/str_split.cpp
)
add_library(glacier STATIC
${glacier_files}
)
target_include_directories(glacier
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
set_target_properties(glacier PROPERTIES
COMPILE_FLAGS "${CMAKE_CXX_FLAGS} ${BASE_COMPILE_FLAGS}")
add_library(glacier_kernel STATIC
${glacier_files}
)
target_include_directories(glacier_kernel
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
set_target_properties(glacier_kernel PROPERTIES
COMPILE_FLAGS "${CMAKE_CXX_FLAGS} ${BASE_COMPILE_FLAGS} -mcmodel=kernel")

View file

@ -54,6 +54,11 @@ void StrFormatValue(StringBuilder& builder, ErrorCode value, StringView opts) {
StrFormatValue(builder, static_cast<uint64_t>(value), opts);
}
template <>
void StrFormatValue(StringBuilder& builder, char value, StringView opts) {
builder.PushBack(value);
}
template <>
void StrFormatValue(StringBuilder& builder, const char* value,
StringView opts) {
@ -65,6 +70,11 @@ void StrFormatValue(StringBuilder& builder, StringView value, StringView opts) {
StrFormatInternal(builder, value);
}
template <>
void StrFormatValue(StringBuilder& builder, String value, StringView opts) {
StrFormatInternal(builder, value);
}
void StrFormatInternal(StringBuilder& builder, StringView format) {
// TODO: Consider throwing an error if there are unhandled format
builder.PushBack(format);

View file

@ -28,12 +28,18 @@ void StrFormatValue(StringBuilder& builder, uint64_t value, StringView opts);
template <>
void StrFormatValue(StringBuilder& builder, ErrorCode value, StringView opts);
template <>
void StrFormatValue(StringBuilder& builder, char value, StringView opts);
template <>
void StrFormatValue(StringBuilder& builder, const char* value, StringView opts);
template <>
void StrFormatValue(StringBuilder& builder, StringView value, StringView opts);
template <>
void StrFormatValue(StringBuilder& builder, String value, StringView opts);
void StrFormatInternal(StringBuilder& builder, StringView format);
template <typename T, typename... Args>