#include "buffer.h"
#include
#define BUFFER_SIZE 8 //1000
#define BUFFER_SIZE_MASK ((BUFFER_SIZE)-1) //0111
#define NEXT_INDEX(v) ( ((v)+1) & BUFFER_SIZE_MASK) ) // 안되면 괄호 지우기 오른쪽꺼
#define IS_EMPTY() ((head)==(tail))
#define IS_FULL() (NEXT_INDEX(head) == (tail) )
static char buffer[BUFFER_SIZE];
static int head = 0;
static int tail = 0;
int write_buffer(char d)
{
if (IS_FULL())
{
return -1;
}