mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-06-12 01:25:59 +00:00
Resolved marge conflicts
This commit is contained in:
commit
53335281d7
@ -4,20 +4,22 @@
|
||||
# include <inttypes.h>
|
||||
# include <string.h>
|
||||
# include <stdio.h>
|
||||
# include <stdarg.h>
|
||||
# include <stdint.h>
|
||||
#else
|
||||
# include <cinttypes>
|
||||
# include <cstring>
|
||||
# include <cstdio>
|
||||
# include <stdarg.h>
|
||||
# include <cstdint>
|
||||
#endif // STA_PLATFORM_ARDUINO
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <sta/debug/assert.hpp>
|
||||
#include <sta/lang.hpp>
|
||||
|
||||
namespace sta
|
||||
{
|
||||
void BasePrintable::printf(const char * fmt, ...)
|
||||
void Printable::printf(const char * fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start (args, fmt);
|
||||
@ -33,96 +35,96 @@ namespace sta
|
||||
println(str);
|
||||
}
|
||||
|
||||
void BasePrintable::print(char c)
|
||||
void Printable::print(char c)
|
||||
{
|
||||
print(&c, 1);
|
||||
}
|
||||
|
||||
void BasePrintable::print(bool b)
|
||||
void Printable::print(bool b)
|
||||
{
|
||||
print(b ? "true" : "false");
|
||||
}
|
||||
|
||||
void BasePrintable::print(double d)
|
||||
void Printable::print(double d)
|
||||
{
|
||||
char buffer[64];
|
||||
snprintf(buffer, sizeof(buffer), "%f", d);
|
||||
print(buffer);
|
||||
}
|
||||
|
||||
void BasePrintable::print(uint8_t num, IntegerBase base)
|
||||
void Printable::print(uint8_t num, IntegerBase base)
|
||||
{
|
||||
printBase(num, base, "%" PRIu8, sizeof(num));
|
||||
}
|
||||
|
||||
void BasePrintable::print(uint16_t num, IntegerBase base)
|
||||
void Printable::print(uint16_t num, IntegerBase base)
|
||||
{
|
||||
printBase(num, base, "%" PRIu16, sizeof(num));
|
||||
}
|
||||
|
||||
void BasePrintable::print(uint32_t num, IntegerBase base)
|
||||
void Printable::print(uint32_t num, IntegerBase base)
|
||||
{
|
||||
printBase(num, base, "%" PRIu32, sizeof(num));
|
||||
}
|
||||
|
||||
void BasePrintable::print(const char * str)
|
||||
void Printable::print(const char * str)
|
||||
{
|
||||
print(str, strlen(str));
|
||||
}
|
||||
|
||||
void BasePrintable::println()
|
||||
void Printable::println()
|
||||
{
|
||||
print("\r\n", 2);
|
||||
}
|
||||
|
||||
void BasePrintable::println(char c)
|
||||
void Printable::println(char c)
|
||||
{
|
||||
print(&c, 1);
|
||||
println();
|
||||
}
|
||||
|
||||
void BasePrintable::println(bool b)
|
||||
void Printable::println(bool b)
|
||||
{
|
||||
print(b);
|
||||
println();
|
||||
}
|
||||
|
||||
void BasePrintable::println(double d)
|
||||
void Printable::println(double d)
|
||||
{
|
||||
print(d);
|
||||
println();
|
||||
}
|
||||
|
||||
void BasePrintable::println(uint8_t num, IntegerBase base)
|
||||
void Printable::println(uint8_t num, IntegerBase base)
|
||||
{
|
||||
print(num, base);
|
||||
println();
|
||||
}
|
||||
|
||||
void BasePrintable::println(uint16_t num, IntegerBase base)
|
||||
void Printable::println(uint16_t num, IntegerBase base)
|
||||
{
|
||||
print(num, base);
|
||||
println();
|
||||
}
|
||||
|
||||
void BasePrintable::println(uint32_t num, IntegerBase base)
|
||||
void Printable::println(uint32_t num, IntegerBase base)
|
||||
{
|
||||
print(num, base);
|
||||
println();
|
||||
}
|
||||
|
||||
void BasePrintable::println(const char * str)
|
||||
void Printable::println(const char * str)
|
||||
{
|
||||
println(str, strlen(str));
|
||||
}
|
||||
|
||||
void BasePrintable::println(const char * str, size_t length)
|
||||
void Printable::println(const char * str, size_t length)
|
||||
{
|
||||
print(str, length);
|
||||
println();
|
||||
}
|
||||
|
||||
void BasePrintable::printBase(uintmax_t num, IntegerBase base, const char * fmt, size_t size)
|
||||
void Printable::printBase(uintmax_t num, IntegerBase base, const char * fmt, size_t size)
|
||||
{
|
||||
switch (base)
|
||||
{
|
||||
@ -145,14 +147,14 @@ namespace sta
|
||||
}
|
||||
}
|
||||
|
||||
void BasePrintable::printDec(uintmax_t num, const char * fmt)
|
||||
void Printable::printDec(uintmax_t num, const char * fmt)
|
||||
{
|
||||
char buffer[64];
|
||||
snprintf(buffer, sizeof(buffer), fmt, static_cast<uint32_t>(num));
|
||||
print(buffer);
|
||||
}
|
||||
|
||||
void BasePrintable::printBin(uintmax_t value, size_t digits)
|
||||
void Printable::printBin(uintmax_t value, size_t digits)
|
||||
{
|
||||
// Need 8 digits for every byte
|
||||
char buffer[sizeof(value) * 8];
|
||||
@ -177,7 +179,7 @@ namespace sta
|
||||
print(buffer, digits);
|
||||
}
|
||||
|
||||
void BasePrintable::printHex(uintmax_t value, size_t digits)
|
||||
void Printable::printHex(uintmax_t value, size_t digits)
|
||||
{
|
||||
// Need 2 digits for every byte
|
||||
char buffer[sizeof(value) * 2];
|
||||
|
Loading…
x
Reference in New Issue
Block a user