migrating

master
Penguin 3 years ago
parent e91fc41591
commit 519c761f7a

@ -0,0 +1,6 @@
((c-mode . ((lsp-clients-clangd-args . ("--compile-commands-dir=build/"
"--pch-storage=memory"
"--background-index"
"-j=4"
))
)))

@ -1,41 +0,0 @@
CC=gcc
CFLAGS=-std=c99 -Wall -Wextra
BIN=./bin
SRC=./src
INC=./inc
TEST=./test
EXAMPLE_DIR=./example
TESTER_OBJS=$(BIN)/PCircularBuffer.o $(BIN)/test.o
EXAMPLE_OBJS=$(BIN)/PCircularBuffer.o $(BIN)/simple_circular_buffer_example.o
TESTER=$(BIN)/tester
EXAMPLE=$(BIN)/simple_circular_buffer_example
$(TESTER): $(TESTER_OBJS)
$(CC) $(CFLAGS) -o $@ $(TESTER_OBJS)
$(EXAMPLE): $(EXAMPLE_OBJS)
$(CC) $(CFLAGS) -o $@ $(EXAMPLE_OBJS)
$(BIN)/PCircularBuffer.o: $(SRC)/PCircularBuffer.c $(INC)/PCircularBuffer.h
$(CC) -c $(CFLAGS) -I$(INC) $(SRC)/PCircularBuffer.c -o $(BIN)/PCircularBuffer.o
$(BIN)/test.o: $(TEST)/test.c
$(CC) -c $(CFLAGS) -I$(INC) $(TEST)/test.c -o $(BIN)/test.o
$(BIN)/simple_circular_buffer_example.o: $(EXAMPLE_DIR)/simple_circular_buffer_example.c
$(CC) -c $(CFLAGS) -I$(INC) $(EXAMPLE_DIR)/simple_circular_buffer_example.c -o $(BIN)/simple_circular_buffer_example.o
all: $(TESTER) $(EXAMPLE)
clean:
rm -rf $(BIN)/*
test: $(TESTER)
$(TESTER)
example: $(EXAMPLE)
$(EXAMPLE)

@ -0,0 +1,54 @@
PRJNAME=pcbuffer
PRJOUT=lib$(PRJNAME).a
TESTSOUT=$(PRJNAME)_tests
EXAMPLESOUT=$(PRJNAME)_example
CC=gcc
SIZE=size
MK_DIR=mkdir -p
CFLAGS=\
-Wall \
-DDEBUG \
-std=gnu11 \
-ffunctions-sections \
-O3 \
-g3
ARFLAGS=\
# Core Stuff
CORE_SUB_DIRS=src
CORE_INC_DIRS=\
-I../cfg \
-I../inc
# Tests
TESTS_SUB_DIRS=\
test/src
TESTS_INC_DIRS=\
-I../tests/inc \
-I../test/cfg
# Examples
EXAMPLES_SUB_DIRS=\
EXAMPLES_INC_DIRS=\
.PHONY: all tests examples clean
all: $(CORE_SUB_DIRS) $(PRJOUT)
tests: all $(TESTS_SUB_DIRS) $(TESTSOUT)
examples: all $(EXAMPLES_SUB_DIRS) $(EXAMPLESOUT)
$(PRJOUT): $(CORE_OBJS)
$(AR) $(CORE_INC_DIRS) $(CFLAGS) $(ARFLAGS) $@ $<
$(TESTSOUT): $(TEST_OBJS)
$(CC) $(CFLAGS) -o $< $(TEST_OBJS)
$(EXAMPLESOUT)

@ -1,408 +1,409 @@
#include <PCircularBuffer.h> #include <PCircularBuffer.h>
// Error handler used for debugging only // Error handler used for debugging only
#ifdef PB_CB_DEBUG #ifdef PB_CB_DEBUG
#include <stdio.h> #include <stdio.h>
static void handle_status(const char* func, PB_CB_STATUS status_code) static void handle_status(const char* func, PB_CB_STATUS status_code)
{ {
if(status_code != PB_CB_GOOD) if(status_code != PB_CB_GOOD)
{ {
printf("%s failed: error code: %d\r\n", func, status_code); printf("%s failed: error code: %d\r\n", func, status_code);
} }
} }
#endif #endif
// Circular Buffer Prototypes -- uint8_t // Circular Buffer Prototypes -- uint8_t
#if PB_CB_U8 #if PB_CB_U8
static PB_CB_STATUS p_cb_u8_push(p_cb_double* cbuffer, uint8_t value); static PB_CB_STATUS p_cb_u8_push(p_cb_double* cbuffer, uint8_t value);
static PB_CB_STATUS p_cb_u8_empty(p_cb_double* cbuffer); static PB_CB_STATUS p_cb_u8_empty(p_cb_double* cbuffer);
#endif #endif
// Circular Buffer Prototypes -- uint16_t // Circular Buffer Prototypes -- uint16_t
#if PB_CB_U16 #if PB_CB_U16
static PB_CB_STATUS p_cb_u16_push(p_cb_double* cbuffer, uint16_t value); static PB_CB_STATUS p_cb_u16_push(p_cb_double* cbuffer, uint16_t value);
static PB_CB_STATUS p_cb_u16_empty(p_cb_double* cbuffer); static PB_CB_STATUS p_cb_u16_empty(p_cb_double* cbuffer);
#endif #endif
// Circular Buffer Prototypes -- uint32_t // Circular Buffer Prototypes -- uint32_t
#if PB_CB_U32 #if PB_CB_U32
static PB_CB_STATUS p_cb_u32_push(p_cb_double* cbuffer, uint32_t value); static PB_CB_STATUS p_cb_u32_push(p_cb_double* cbuffer, uint32_t value);
static PB_CB_STATUS p_cb_u32_empty(p_cb_double* cbuffer); static PB_CB_STATUS p_cb_u32_empty(p_cb_double* cbuffer);
#endif #endif
// Circular Buffer Prototypes -- uint64_t // Circular Buffer Prototypes -- uint64_t
#if PB_CB_U64 #if PB_CB_U64
static PB_CB_STATUS p_cb_u64_push(p_cb_double* cbuffer, uint64_t value); static PB_CB_STATUS p_cb_u64_push(p_cb_double* cbuffer, uint64_t value);
static PB_CB_STATUS p_cb_u64_empty(p_cb_double* cbuffer); static PB_CB_STATUS p_cb_u64_empty(p_cb_double* cbuffer);
#endif #endif
// Circular Buffer Prototypes -- int8_t // Circular Buffer Prototypes -- int8_t
#if PB_CB_I8 #if PB_CB_I8
static PB_CB_STATUS p_cb_i8_push(p_cb_double* cbuffer, int8_t value); static PB_CB_STATUS p_cb_i8_push(p_cb_double* cbuffer, int8_t value);
static PB_CB_STATUS p_cb_i8_empty(p_cb_double* cbuffer); static PB_CB_STATUS p_cb_i8_empty(p_cb_double* cbuffer);
#endif #endif
// Circular Buffer Prototypes -- int16_t // Circular Buffer Prototypes -- int16_t
#if PB_CB_I16 #if PB_CB_I16
static PB_CB_STATUS p_cb_i16_push(p_cb_double* cbuffer, int16_t value); static PB_CB_STATUS p_cb_i16_push(p_cb_double* cbuffer, int16_t value);
static PB_CB_STATUS p_cb_i16_empty(p_cb_double* cbuffer); static PB_CB_STATUS p_cb_i16_empty(p_cb_double* cbuffer);
#endif #endif
// Circular Buffer Prototypes -- int32_t // Circular Buffer Prototypes -- int32_t
#if PB_CB_I32 #if PB_CB_I32
static PB_CB_STATUS p_cb_i32_push(p_cb_double* cbuffer, int32_t value); static PB_CB_STATUS p_cb_i32_push(p_cb_double* cbuffer, int32_t value);
static PB_CB_STATUS p_cb_i32_empty(p_cb_double* cbuffer); static PB_CB_STATUS p_cb_i32_empty(p_cb_double* cbuffer);
#endif #endif
// Circular Buffer Prototypes -- int64_t // Circular Buffer Prototypes -- int64_t
#if PB_CB_I64 #if PB_CB_I64
static PB_CB_STATUS p_cb_i64_push(p_cb_double* cbuffer, int64_t value); static PB_CB_STATUS p_cb_i64_push(p_cb_double* cbuffer, int64_t value);
static PB_CB_STATUS p_cb_i64_empty(p_cb_double* cbuffer); static PB_CB_STATUS p_cb_i64_empty(p_cb_double* cbuffer);
#endif #endif
// Circular Buffer Prototypes -- Float // Circular Buffer Prototypes -- Float
#if PB_CB_FLOAT #if PB_CB_FLOAT
static PB_CB_STATUS p_cb_float_push(p_cb_double* cbuffer, float value); static PB_CB_STATUS p_cb_float_push(p_cb_double* cbuffer, float value);
static PB_CB_STATUS p_cb_float_empty(p_cb_double* cbuffer); static PB_CB_STATUS p_cb_float_empty(p_cb_double* cbuffer);
#endif #endif
// Circular Buffer Prototypes -- Double // Circular Buffer Prototypes -- Double
#if PB_CB_DOUBLE #if PB_CB_DOUBLE
static PB_CB_STATUS p_cb_double_push(p_cb_double* cbuffer, double value); static PB_CB_STATUS p_cb_double_push(p_cb_double* cbuffer, double value);
static PB_CB_STATUS p_cb_double_empty(p_cb_double* cbuffer); static PB_CB_STATUS p_cb_double_empty(p_cb_double* cbuffer);
#endif #endif
// Circular Buffer Definitions -- uint8_t // Circular Buffer Definitions -- uint8_t
#if PB_CB_U8 #if PB_CB_U8
PB_CB_STATUS p_cb_u8_init(p_cb_u8* circ_buffer, uint8_t* buff, uint32_t max_length) PB_CB_STATUS p_cb_u8_init(p_cb_u8* circ_buffer, uint8_t* buff, uint32_t max_length)
{ {
PB_CB_STATUS ret = PB_CB_GOOD; PB_CB_STATUS ret = PB_CB_GOOD;
do do
{ {
// Make sure the buffer isn't bad (null) // Make sure the buffer isn't bad (null)
if(!buff) if(!buff)
{ {
ret = PB_CB_NULL_BUFFER; ret = PB_CB_NULL_BUFFER;
break; break;
} }
// Make sure the max buffer is a useable size // Make sure the max buffer is a useable size
if(max_length > PB_CB_MAX_BUFFER_SIZE || max_length <= 0) if(max_length > PB_CB_MAX_BUFFER_SIZE || max_length <= 0)
{ {
ret = PB_CB_BAD_BUFFER_SIZE; ret = PB_CB_BAD_BUFFER_SIZE;
break; break;
} }
} while (0); } while (0);
// Debugging // Debugging
#ifdef PB_CB_DEBUG #ifdef PB_CB_DEBUG
handle_status(__func__, ret); handle_status(__func__, ret);
#endif #endif
return ret; return ret;
} }
PB_CB_STATUS p_cb_u8_push(p_cb_double* cbuffer, uint8_t value) PB_CB_STATUS p_cb_u8_push(p_cb_double* cbuffer, uint8_t value)
{ {
} }
PB_CB_STATUS p_cb_u8_empty(p_cb_double* cbuffer) PB_CB_STATUS p_cb_u8_empty(p_cb_double* cbuffer)
{ {
} }
#endif #endif
// Circular Buffer Definitions -- uint16_t // Circular Buffer Definitions -- uint16_t
#if PB_CB_U16 #if PB_CB_U16
PB_CB_STATUS p_cb_u16_init(p_cb_u16* circ_buffer, uint16_t* buff, uint32_t max_length) PB_CB_STATUS p_cb_u16_init(p_cb_u16* circ_buffer, uint16_t* buff, uint32_t max_length)
{ {
PB_CB_STATUS ret = PB_CB_GOOD; PB_CB_STATUS ret = PB_CB_GOOD;
do do
{ {
// Make sure the buffer isn't bad (null) // Make sure the buffer isn't bad (null)
if(!buff) if(!buff)
{ {
ret = PB_CB_NULL_BUFFER; ret = PB_CB_NULL_BUFFER;
break; break;
} }
// Make sure the max buffer is a useable size // Make sure the max buffer is a useable size
if(max_length > PB_CB_MAX_BUFFER_SIZE || max_length <= 0) if(max_length > PB_CB_MAX_BUFFER_SIZE || max_length <= 0)
{ {
ret = PB_CB_BAD_BUFFER_SIZE; ret = PB_CB_BAD_BUFFER_SIZE;
break; break;
} }
} while (0); } while (0);
// Debugging // Debugging
#ifdef PB_CB_DEBUG #ifdef PB_CB_DEBUG
handle_status(__func__, ret); handle_status(__func__, ret);
#endif #endif
return ret; return ret;
} }
PB_CB_STATUS p_cb_u16_push(p_cb_double* cbuffer, uint16_t value)
{ PB_CB_STATUS p_cb_u16_push(p_cb_double* cbuffer, uint16_t value)
PB_CB_STATUS ret = PB_CB_GOOD; {
// Debugging PB_CB_STATUS ret = PB_CB_GOOD;
#ifdef PB_CB_DEBUG // Debugging
handle_status(__func__, ret); #ifdef PB_CB_DEBUG
#endif handle_status(__func__, ret);
#endif
return ret;
} return ret;
PB_CB_STATUS p_cb_u16_empty(p_cb_double* cbuffer) }
{ PB_CB_STATUS p_cb_u16_empty(p_cb_double* cbuffer)
PB_CB_STATUS ret = PB_CB_GOOD; {
// Debugging PB_CB_STATUS ret = PB_CB_GOOD;
#ifdef PB_CB_DEBUG // Debugging
handle_status(__func__, ret); #ifdef PB_CB_DEBUG
#endif handle_status(__func__, ret);
#endif
return ret;
} return ret;
#endif }
#endif
// Circular Buffer Definitions -- uint32_t
#if PB_CB_U32 // Circular Buffer Definitions -- uint32_t
PB_CB_STATUS p_cb_u32_init(p_cb_u32* circ_buffer, uint32_t* buff, uint32_t max_length) #if PB_CB_U32
{ PB_CB_STATUS p_cb_u32_init(p_cb_u32* circ_buffer, uint32_t* buff, uint32_t max_length)
PB_CB_STATUS ret = PB_CB_GOOD; {
do PB_CB_STATUS ret = PB_CB_GOOD;
{ do
// Make sure the buffer isn't bad (null) {
if(!buff) // Make sure the buffer isn't bad (null)
{ if(!buff)
ret = PB_CB_NULL_BUFFER; {
break; ret = PB_CB_NULL_BUFFER;
} break;
}
// Make sure the max buffer is a useable size
if(max_length > PB_CB_MAX_BUFFER_SIZE || max_length <= 0) // Make sure the max buffer is a useable size
{ if(max_length > PB_CB_MAX_BUFFER_SIZE || max_length <= 0)
ret = PB_CB_BAD_BUFFER_SIZE; {
break; ret = PB_CB_BAD_BUFFER_SIZE;
} break;
} while (0); }
} while (0);
// Debugging
#ifdef PB_CB_DEBUG // Debugging
handle_status(__func__, ret); #ifdef PB_CB_DEBUG
#endif handle_status(__func__, ret);
#endif
return ret;
} return ret;
PB_CB_STATUS p_cb_u32_push(p_cb_double* cbuffer, uint32_t value) }
{ PB_CB_STATUS p_cb_u32_push(p_cb_double* cbuffer, uint32_t value)
PB_CB_STATUS ret = PB_CB_GOOD; {
// Debugging PB_CB_STATUS ret = PB_CB_GOOD;
#ifdef PB_CB_DEBUG // Debugging
handle_status(__func__, ret); #ifdef PB_CB_DEBUG
#endif handle_status(__func__, ret);
#endif
return ret;
} return ret;
PB_CB_STATUS p_cb_u32_empty(p_cb_double* cbuffer) }
{ PB_CB_STATUS p_cb_u32_empty(p_cb_double* cbuffer)
PB_CB_STATUS ret = PB_CB_GOOD; {
// Debugging PB_CB_STATUS ret = PB_CB_GOOD;
#ifdef PB_CB_DEBUG // Debugging
handle_status(__func__, ret); #ifdef PB_CB_DEBUG
#endif handle_status(__func__, ret);
#endif
return ret;
} return ret;
#endif }
#endif
// Circular Buffer Definitions -- uint64_t
#if PB_CB_U64 // Circular Buffer Definitions -- uint64_t
PB_CB_STATUS p_cb_u64_init(p_cb_u64* circ_buffer, uint64_t* buff, uint32_t max_length) #if PB_CB_U64
{ PB_CB_STATUS p_cb_u64_init(p_cb_u64* circ_buffer, uint64_t* buff, uint32_t max_length)
PB_CB_STATUS ret = PB_CB_GOOD; {
do PB_CB_STATUS ret = PB_CB_GOOD;
{ do
// Make sure the buffer isn't bad (null) {
if(!buff) // Make sure the buffer isn't bad (null)
{ if(!buff)
ret = PB_CB_NULL_BUFFER; {
break; ret = PB_CB_NULL_BUFFER;
} break;
}
// Make sure the max buffer is a useable size
if(max_length > PB_CB_MAX_BUFFER_SIZE || max_length <= 0) // Make sure the max buffer is a useable size
{ if(max_length > PB_CB_MAX_BUFFER_SIZE || max_length <= 0)
ret = PB_CB_BAD_BUFFER_SIZE; {
break; ret = PB_CB_BAD_BUFFER_SIZE;
} break;
} while (0); }
} while (0);
// Debugging
#ifdef PB_CB_DEBUG // Debugging
handle_status(__func__, ret); #ifdef PB_CB_DEBUG
#endif handle_status(__func__, ret);
#endif
return ret;
} return ret;
PB_CB_STATUS p_cb_u64_push(p_cb_double* cbuffer, uint64_t value) }
{ PB_CB_STATUS p_cb_u64_push(p_cb_double* cbuffer, uint64_t value)
PB_CB_STATUS ret = PB_CB_GOOD; {
// Debugging PB_CB_STATUS ret = PB_CB_GOOD;
#ifdef PB_CB_DEBUG // Debugging
handle_status(__func__, ret); #ifdef PB_CB_DEBUG
#endif handle_status(__func__, ret);
#endif
return ret;
} return ret;
PB_CB_STATUS p_cb_u64_empty(p_cb_double* cbuffer) }
{ PB_CB_STATUS p_cb_u64_empty(p_cb_double* cbuffer)
PB_CB_STATUS ret = PB_CB_GOOD; {
// Debugging PB_CB_STATUS ret = PB_CB_GOOD;
#ifdef PB_CB_DEBUG // Debugging
handle_status(__func__, ret); #ifdef PB_CB_DEBUG
#endif handle_status(__func__, ret);
#endif
return ret;
} return ret;
#endif }
#endif
#if PB_CB_FLOAT
PB_CB_STATUS p_cb_float_init(p_cb_float* circ_buffer, float* buff, uint32_t max_length) #if PB_CB_FLOAT
{ PB_CB_STATUS p_cb_float_init(p_cb_float* circ_buffer, float* buff, uint32_t max_length)
PB_CB_STATUS ret = PB_CB_GOOD; {
do PB_CB_STATUS ret = PB_CB_GOOD;
{ do
// Make sure the buffer isn't bad (null) {
if(!buff) // Make sure the buffer isn't bad (null)
{ if(!buff)
ret = PB_CB_NULL_BUFFER; {
break; ret = PB_CB_NULL_BUFFER;
} break;
}
// Make sure the max buffer is a useable size
if(max_length > PB_CB_MAX_BUFFER_SIZE || max_length <= 0) // Make sure the max buffer is a useable size
{ if(max_length > PB_CB_MAX_BUFFER_SIZE || max_length <= 0)
ret = PB_CB_BAD_BUFFER_SIZE; {
break; ret = PB_CB_BAD_BUFFER_SIZE;
} break;
} while (0); }
} while (0);
// Debugging
#ifdef PB_CB_DEBUG // Debugging
handle_status(__func__, ret); #ifdef PB_CB_DEBUG
#endif handle_status(__func__, ret);
#endif
return ret;
} return ret;
PB_CB_STATUS p_cb_float_push(p_cb_double* cbuffer, float value) }
{ PB_CB_STATUS p_cb_float_push(p_cb_double* cbuffer, float value)
PB_CB_STATUS ret = PB_CB_GOOD; {
// Debugging PB_CB_STATUS ret = PB_CB_GOOD;
#ifdef PB_CB_DEBUG // Debugging
handle_status(__func__, ret); #ifdef PB_CB_DEBUG
#endif handle_status(__func__, ret);
#endif
return ret;
} return ret;
PB_CB_STATUS p_cb_float_empty(p_cb_double* cbuffer) }
{ PB_CB_STATUS p_cb_float_empty(p_cb_double* cbuffer)
PB_CB_STATUS ret = PB_CB_GOOD; {
// Debugging PB_CB_STATUS ret = PB_CB_GOOD;
#ifdef PB_CB_DEBUG // Debugging
handle_status(__func__, ret); #ifdef PB_CB_DEBUG
#endif handle_status(__func__, ret);
#endif
return ret;
} return ret;
#endif }
#endif
// Circular Buffer Definitions -- double
#if PB_CB_DOUBLE // Circular Buffer Definitions -- double
PB_CB_STATUS p_cb_double_init(p_cb_double* circ_buffer, double* buff, uint32_t max_length) #if PB_CB_DOUBLE
{ PB_CB_STATUS p_cb_double_init(p_cb_double* circ_buffer, double* buff, uint32_t max_length)
PB_CB_STATUS ret = PB_CB_GOOD; {
do PB_CB_STATUS ret = PB_CB_GOOD;
{ do
// Make sure the buffer isn't bad (null) {
if(!buff) // Make sure the buffer isn't bad (null)
{ if(!buff)
ret = PB_CB_NULL_BUFFER; {
break; ret = PB_CB_NULL_BUFFER;
} break;
}
// Make sure the max buffer is a useable size
if(max_length > PB_CB_MAX_BUFFER_SIZE || max_length <= 0) // Make sure the max buffer is a useable size
{ if(max_length > PB_CB_MAX_BUFFER_SIZE || max_length <= 0)
ret = PB_CB_BAD_BUFFER_SIZE; {
break; ret = PB_CB_BAD_BUFFER_SIZE;
} break;
circ_buffer->buffer = buff; }
circ_buffer->max_len = (uint16_t)max_length; circ_buffer->buffer = buff;
circ_buffer->head = 0; circ_buffer->max_len = (uint16_t)max_length;
circ_buffer->push = p_cb_double_push; circ_buffer->head = 0;
circ_buffer->empty = p_cb_double_empty; circ_buffer->push = p_cb_double_push;
circ_buffer->empty(circ_buffer); circ_buffer->empty = p_cb_double_empty;
} while (0); circ_buffer->empty(circ_buffer);
} while (0);
// Debugging
#ifdef PB_CB_DEBUG // Debugging
handle_status(__func__, ret); #ifdef PB_CB_DEBUG
#endif handle_status(__func__, ret);
#endif
return ret;
} return ret;
}
PB_CB_STATUS p_cb_double_push(p_cb_double* cbuffer, double value)
{ PB_CB_STATUS p_cb_double_push(p_cb_double* cbuffer, double value)
PB_CB_STATUS ret = PB_CB_GOOD; {
PB_CB_STATUS ret = PB_CB_GOOD;
if(!cbuffer)
{ if(!cbuffer)
ret = PB_CB_NULL_CBUFFER; {
} ret = PB_CB_NULL_CBUFFER;
else }
{ else
cbuffer->buffer[cbuffer->head] = value; {
cbuffer->head = (cbuffer->head + 1) % cbuffer->max_len; cbuffer->buffer[cbuffer->head] = value;
} cbuffer->head = (cbuffer->head + 1) % cbuffer->max_len;
}
// Debugging
#ifdef PB_CB_DEBUG // Debugging
handle_status(__func__, ret); #ifdef PB_CB_DEBUG
#endif handle_status(__func__, ret);
#endif
return ret;
} return ret;
PB_CB_STATUS p_cb_double_empty(p_cb_double* cbuffer) }
{ PB_CB_STATUS p_cb_double_empty(p_cb_double* cbuffer)
PB_CB_STATUS ret = PB_CB_GOOD; {
PB_CB_STATUS ret = PB_CB_GOOD;
do
{ do
if(!cbuffer) {
{ if(!cbuffer)
ret = PB_CB_NULL_CBUFFER; {
break; ret = PB_CB_NULL_CBUFFER;
} break;
}
if(!cbuffer->buffer)
{ if(!cbuffer->buffer)
ret = PB_CB_NULL_BUFFER; {
break; ret = PB_CB_NULL_BUFFER;
} break;
for(int ind = 0; ind < cbuffer->max_len; ind++) }
{ for(int ind = 0; ind < cbuffer->max_len; ind++)
cbuffer->buffer[ind] = 0.0; {
} cbuffer->buffer[ind] = 0.0;
cbuffer->head = 0; }
cbuffer->b_empty = true; cbuffer->head = 0;
cbuffer->b_filled = false; cbuffer->b_empty = true;
} while (0); cbuffer->b_filled = false;
} while (0);
// Debugging
#ifdef PB_CB_DEBUG // Debugging
handle_status(__func__, ret); #ifdef PB_CB_DEBUG
#endif handle_status(__func__, ret);
#endif
return ret;
} return ret;
#endif }
#endif

Loading…
Cancel
Save