diff options
author | lantw44 <lantw44@gmail.com> | 2012-08-30 00:05:33 +0800 |
---|---|---|
committer | lantw44 <lantw44@gmail.com> | 2012-08-30 00:05:33 +0800 |
commit | 516f31006b9c1b47f85b31deef28b78276f2c4bb (patch) | |
tree | 78c1971b2ca1f48dea81c18c3f31561e93319aba /l4bds | |
download | l4basic-516f31006b9c1b47f85b31deef28b78276f2c4bb.tar l4basic-516f31006b9c1b47f85b31deef28b78276f2c4bb.tar.gz l4basic-516f31006b9c1b47f85b31deef28b78276f2c4bb.tar.bz2 l4basic-516f31006b9c1b47f85b31deef28b78276f2c4bb.tar.lz l4basic-516f31006b9c1b47f85b31deef28b78276f2c4bb.tar.xz l4basic-516f31006b9c1b47f85b31deef28b78276f2c4bb.tar.zst l4basic-516f31006b9c1b47f85b31deef28b78276f2c4bb.zip |
Initial commit - copy project files
Diffstat (limited to 'l4bds')
-rw-r--r-- | l4bds/Makefile | 14 | ||||
-rw-r--r-- | l4bds/l4bds.h | 65 |
2 files changed, 79 insertions, 0 deletions
diff --git a/l4bds/Makefile b/l4bds/Makefile new file mode 100644 index 0000000..07c4235 --- /dev/null +++ b/l4bds/Makefile @@ -0,0 +1,14 @@ +CC=cc +AR=ar +RM=rm +CFLAGS=-Wall -g -I. +OBJ= +LIBFILE=l4bds.a + +.PHONY: all clean + +all: $(LIBFILE) +$(LIBFILE): $(OBJ) + $(AR) rcs $(LIBFILE) $(OBJ) +clean: + $(RM) -f $(LIBFILE) $(OBJ) diff --git a/l4bds/l4bds.h b/l4bds/l4bds.h new file mode 100644 index 0000000..31cd747 --- /dev/null +++ b/l4bds/l4bds.h @@ -0,0 +1,65 @@ +#ifndef L4LIB_BASIC_DATA_STRUCTURE +#define L4LIB_BASIC_DATA_STRUCTURE + +/*********** list ***********/ + +struct l4lib_list_node{ /* list 中每一個項目用的資料結構,會有很多個 */ + struct l4lib_list_node* node_prev; + struct l4lib_list_node* node_next; + void* node_data; +}; + +typedef struct l4lib_list{ /* 管理 list 用的,每個 list 只有一個 */ + struct l4lib_list_node* list_first; + struct l4lib_list_node* list_last; + struct l4lib_list_node* list_current; + int list_prevcount; + int list_nextcount; + int list_len; +} L4LL; + +/* 這兩個常數僅供 l4ll_remove 使用 */ +#define L4LL_PREV 1 /* 刪除後移至上一項 */ +#define L4LL_NEXT 2 /* 刪除後移至下一項 */ + +/* 這兩個常數僅供 l4ll_goto 使用 */ +#define L4LL_FRONT 3 +#define L4LL_BACK 4 + +L4LL* l4ll_create(void); +void l4ll_free(L4LL*); +void* l4ll_getcur(L4LL*); +void* l4ll_getback(L4LL*); +void* l4ll_getfront(L4LL*); +int l4ll_pushback(L4LL*, void*); +int l4ll_pushfront(L4LL*, void*); +int l4ll_popback(L4LL*); +int l4ll_popfront(L4LL*); +int l4ll_remove(L4LL*, int); +int l4ll_insprev(L4LL*); +int l4ll_insnext(L4LL*); +int l4ll_goto(L4LL*, int, int); +#define l4ll_getlen(list) +#define l4ll_getc(list) +#define l4ll_getpc(list) +#define l4ll_getnc(list) + +/*********** stack ***********/ + +#define l4stack_create() +#define l4stack_push(list, value) +#define l4stack_pop(list) +#define l4stack_getlen(list) +#define l4stack_value(list) +#define l4stack_free(list) + +/*********** queue ***********/ + +#define l4queue_create() +#define l4queue_push(list, value) +#define l4queue_pop(list) +#define l4queue_getlen(list) +#define l4queue_value(list) +#define l4queue_free(list) + +#endif |