From 56daf32c845bbcdc6bec7439dd2f766d9d5999e0 Mon Sep 17 00:00:00 2001 From: Stephanie Gawroriski Date: Sun, 25 Aug 2024 16:53:08 +0000 Subject: [PATCH] Add blank base for circle buffer, the inflate buffer will be moved to it. --- nanocoat/include/sjme/circleBuffer.h | 42 ++++++++++++++++++++++++++++++++++++ nanocoat/lib/base/CMakeLists.txt | 1 + nanocoat/lib/base/circleBuffer.c | 10 +++++++++ 3 files changed, 53 insertions(+) create mode 100644 nanocoat/include/sjme/circleBuffer.h create mode 100644 nanocoat/lib/base/circleBuffer.c diff --git a/nanocoat/include/sjme/circleBuffer.h b/nanocoat/include/sjme/circleBuffer.h new file mode 100644 index 0000000000..fb5ff25f4c --- /dev/null +++ b/nanocoat/include/sjme/circleBuffer.h @@ -0,0 +1,42 @@ +/* -*- Mode: C; indent-tabs-mode: t; tab-width: 4 -*- +// --------------------------------------------------------------------------- +// SquirrelJME +// Copyright (C) Stephanie Gawroriski +// --------------------------------------------------------------------------- +// SquirrelJME is under the Mozilla Public License Version 2.0. +// See license.mkd for licensing and copyright information. +// -------------------------------------------------------------------------*/ + +/** + * Circle buffer, also known as a round robin. + * + * @since 2024/08/25 + */ + +#ifndef SQUIRRELJME_CIRCLEBUFFER_H +#define SQUIRRELJME_CIRCLEBUFFER_H + +/* Anti-C++. */ +#ifdef __cplusplus + #ifndef SJME_CXX_IS_EXTERNED + #define SJME_CXX_IS_EXTERNED + #define SJME_CXX_SQUIRRELJME_CIRCLEBUFFER_H +extern "C" +{ + #endif /* #ifdef SJME_CXX_IS_EXTERNED */ +#endif /* #ifdef __cplusplus */ + +/*--------------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------------*/ + +/* Anti-C++. */ +#ifdef __cplusplus + #ifdef SJME_CXX_SQUIRRELJME_CIRCLEBUFFER_H +} + #undef SJME_CXX_SQUIRRELJME_CIRCLEBUFFER_H + #undef SJME_CXX_IS_EXTERNED + #endif /* #ifdef SJME_CXX_SQUIRRELJME_CIRCLEBUFFER_H */ +#endif /* #ifdef __cplusplus */ + +#endif /* SQUIRRELJME_CIRCLEBUFFER_H */ diff --git a/nanocoat/lib/base/CMakeLists.txt b/nanocoat/lib/base/CMakeLists.txt index 17b2cfe346..ad15a8b470 100644 --- a/nanocoat/lib/base/CMakeLists.txt +++ b/nanocoat/lib/base/CMakeLists.txt @@ -12,6 +12,7 @@ squirreljme_multilib_add_library(Base allocSizeOf.c atomic.c charSeq.c + circleBuffer.c closeable.c comparator.c debug.c diff --git a/nanocoat/lib/base/circleBuffer.c b/nanocoat/lib/base/circleBuffer.c new file mode 100644 index 0000000000..32f63905fd --- /dev/null +++ b/nanocoat/lib/base/circleBuffer.c @@ -0,0 +1,10 @@ +/* -*- Mode: C; indent-tabs-mode: t; tab-width: 4 -*- +// --------------------------------------------------------------------------- +// SquirrelJME +// Copyright (C) Stephanie Gawroriski +// --------------------------------------------------------------------------- +// SquirrelJME is under the Mozilla Public License Version 2.0. +// See license.mkd for licensing and copyright information. +// -------------------------------------------------------------------------*/ + +#include "sjme/circleBuffer.h" -- 2.11.4.GIT