2020-01-18 09:38:21 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 09:38:21 +01:00
|
|
|
*/
|
|
|
|
|
2018-10-16 14:33:16 +02:00
|
|
|
#pragma once
|
|
|
|
|
2019-06-18 08:53:26 +02:00
|
|
|
#ifdef __serenity__
|
2020-05-16 12:00:04 +02:00
|
|
|
# ifdef KERNEL
|
|
|
|
# include <Kernel/kstdio.h>
|
2020-02-15 19:18:56 +01:00
|
|
|
# else
|
|
|
|
# include <AK/Types.h>
|
2020-08-06 13:36:06 +02:00
|
|
|
# include <stdarg.h>
|
2020-02-15 19:18:56 +01:00
|
|
|
extern "C" {
|
2021-03-12 17:29:37 +01:00
|
|
|
void dbgputstr(const char*, size_t);
|
2020-12-25 15:12:40 +11:00
|
|
|
int sprintf(char* buf, const char* fmt, ...) __attribute__((format(printf, 2, 3)));
|
|
|
|
int snprintf(char* buffer, size_t, const char* fmt, ...) __attribute__((format(printf, 3, 4)));
|
2020-02-15 19:18:56 +01:00
|
|
|
}
|
|
|
|
# endif
|
2019-06-18 08:53:26 +02:00
|
|
|
#else
|
2020-02-15 19:18:56 +01:00
|
|
|
# include <stdio.h>
|
2021-03-12 17:29:37 +01:00
|
|
|
inline void dbgputstr(const char* characters, size_t length)
|
2020-08-08 22:45:20 -04:00
|
|
|
{
|
2020-10-04 17:42:31 +02:00
|
|
|
fwrite(characters, 1, length, stderr);
|
2020-08-08 22:45:20 -04:00
|
|
|
}
|
2019-06-18 08:53:26 +02:00
|
|
|
#endif
|
2020-08-08 22:45:20 -04:00
|
|
|
template<size_t N>
|
2021-03-12 17:29:37 +01:00
|
|
|
inline void dbgputstr(const char (&array)[N])
|
2020-08-08 22:45:20 -04:00
|
|
|
{
|
|
|
|
return ::dbgputstr(array, N);
|
|
|
|
}
|