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
|
|
|
|
|
2022-10-09 15:23:23 -06:00
|
|
|
#include <AK/Platform.h>
|
|
|
|
|
|
|
|
#ifdef AK_OS_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" {
|
2022-04-01 20:58:27 +03:00
|
|
|
void dbgputstr(char const*, size_t);
|
|
|
|
int sprintf(char* buf, char const* fmt, ...) __attribute__((format(printf, 2, 3)));
|
|
|
|
int snprintf(char* buffer, size_t, char const* 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>
|
2022-04-01 20:58:27 +03:00
|
|
|
inline void dbgputstr(char const* 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>
|
2022-04-01 20:58:27 +03:00
|
|
|
inline void dbgputstr(char const (&array)[N])
|
2020-08-08 22:45:20 -04:00
|
|
|
{
|
|
|
|
return ::dbgputstr(array, N);
|
|
|
|
}
|