Added buffer handling. Buffer are initialized, pushed, and freed. No use is made of them so far

Signed-off-by: James Booth <boothj5@gmail.com>
This commit is contained in:
Immae
2014-06-23 00:44:35 +02:00
committed by James Booth
parent 66ad23b35b
commit 6a9e19303e
5 changed files with 142 additions and 1 deletions

29
src/ui/buffer.h Normal file
View File

@@ -0,0 +1,29 @@
#ifndef UI_BUFFER_H
#define UI_BUFFER_H
#include "config.h"
//#include "ui/window.h"
#define BUFF_SIZE 1000
typedef struct prof_buff_entry_t {
char show_char;
GTimeVal tstamp;
int flags;
int attrs;
char *from;
char *message;
} ProfBuffEntry;
typedef struct prof_buff_t {
ProfBuffEntry entry[BUFF_SIZE];
int wrap;
int current;
} ProfBuff;
ProfBuff* buffer_create();
void buffer_free(ProfBuff* buffer);
void buffer_push(ProfBuff* buffer, const char show_char, GTimeVal *tstamp, int flags, int attrs, const char * const from, const char * const message);
int buffer_yield(ProfBuff* buffer, int line, ProfBuffEntry** list);
#endif