2020-01-18 03:38:21 -05:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
2021-04-22 04:24:48 -04:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 03:38:21 -05:00
|
|
|
*/
|
|
|
|
|
2018-10-16 08:33:16 -04:00
|
|
|
#pragma once
|
|
|
|
|
2022-10-09 17:23:23 -04:00
|
|
|
#include <AK/Platform.h>
|
|
|
|
|
|
|
|
#ifdef AK_OS_SERENITY
|
2020-05-16 06:00:04 -04:00
|
|
|
# ifdef KERNEL
|
|
|
|
# include <Kernel/kstdio.h>
|
2020-02-15 13:18:56 -05:00
|
|
|
# else
|
|
|
|
# include <AK/Types.h>
|
2020-08-06 07:36:06 -04:00
|
|
|
# include <stdarg.h>
|
2020-02-15 13:18:56 -05:00
|
|
|
extern "C" {
|
2022-04-01 13:58:27 -04: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 13:18:56 -05:00
|
|
|
}
|
|
|
|
# endif
|
2019-06-18 02:53:26 -04:00
|
|
|
#else
|
2020-02-15 13:18:56 -05:00
|
|
|
# include <stdio.h>
|
2022-04-01 13:58:27 -04:00
|
|
|
inline void dbgputstr(char const* characters, size_t length)
|
2020-08-08 22:45:20 -04:00
|
|
|
{
|
2020-10-04 11:42:31 -04:00
|
|
|
fwrite(characters, 1, length, stderr);
|
2020-08-08 22:45:20 -04:00
|
|
|
}
|
2019-06-18 02:53:26 -04:00
|
|
|
#endif
|
2020-08-08 22:45:20 -04:00
|
|
|
template<size_t N>
|
2022-04-01 13:58:27 -04:00
|
|
|
inline void dbgputstr(char const (&array)[N])
|
2020-08-08 22:45:20 -04:00
|
|
|
{
|
|
|
|
return ::dbgputstr(array, N);
|
|
|
|
}
|