diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/array.h (renamed from include/vector.h) | 98 | ||||
-rw-r--r-- | include/list.h | 2 |
2 files changed, 50 insertions, 50 deletions
diff --git a/include/vector.h b/include/array.h index 6dcc244..05a6492 100644 --- a/include/vector.h +++ b/include/array.h @@ -1,60 +1,60 @@ -#ifndef __vector_h__ -#define __vector_h__ +#ifndef __ARRAY_H__ +#define __ARRAY_H__ #include "utility.h" /**********************************************************/ /* This object is an array with dynamic table size. */ /* methods: */ -/* init(addr of the vector, size per entry, size) */ -/* The vector's type depends on what user want to */ +/* init(addr of the array, size per entry, size) */ +/* The array's type depends on what user want to */ /* store. For example: if you want an array for int, */ /* you should decleare like "int* v", and call the */ /* init() like this "init(&v, sizeof(int), 5)", and */ /* it will initalize an array with 5 elements. */ /* */ -/* free(addr of the vector) */ -/* Free the memory the vector use. Yous should call */ +/* free(addr of the array) */ +/* Free the memory the array use. Yous should call */ /* it when you don't need the container. */ /* */ /* */ -/* getSize(addr of the vector) */ +/* getSize(addr of the array) */ /* Return the number of elements. */ /* */ -/* getEntrySize(addr of the vector) */ +/* getEntrySize(addr of the array) */ /* Return the size per entry, it dependent on what */ /* type of data you store in the container. */ /* */ -/* getEntry(addr of the vector, index) */ +/* getEntry(addr of the array, index) */ /* Return a const pointer which point to the entry */ /* with the index you give. */ /* */ /* */ -/* setSize(addr of the vector, new_size) */ +/* setSize(addr of the array, new_size) */ /* Resize the table to new_size. Note that it won't */ /* initalize the newly element if you increase size. */ /* */ -/* setEntry(addr of the vector, index, data) */ +/* setEntry(addr of the array, index, data) */ /* Let the element with index you give be data. */ /* */ /* */ -/* addBack(addr of the vector, data) */ +/* addBack(addr of the array, data) */ /* Add an element which contain data at the back of */ -/* the vector. */ +/* the array. */ /* */ -/* delBack(addr of the vector) */ -/* Remove the last element of the vector. */ +/* delBack(addr of the array) */ +/* Remove the last element of the array. */ /* */ -/* addFront(addr of the vector, data) !! UNFINISHED !! */ +/* addFront(addr of the array, data) !! UNFINISHED !! */ /* Add an element which contain data at the front of */ -/* the vector. */ +/* the array. */ /* */ -/* delFront(addr of the vector) !! UNFINISHED !! */ -/* Remove the first element of the vector. */ +/* delFront(addr of the array) !! UNFINISHED !! */ +/* Remove the first element of the array. */ /* */ /* */ /* cat(addr of the v1, addr of the v2) */ -/* Concatenate the vector2 to the back of vector1. */ +/* Concatenate the array2 to the back of array1. */ /* */ /* copy(addr of the v1, addr of the v2) */ /* Let the contain in the v1 be the one in the v2 */ @@ -71,44 +71,44 @@ /* */ /**********************************************************/ -pvoid ctl_vector_initX(ppvoid v, size_t size, uint count); -pvoid ctl_vector_freeX(ppvoid v); +pvoid ctl_array_initX(ppvoid v, size_t size, uint count); +pvoid ctl_array_freeX(ppvoid v); -int ctl_vector_getSizeX (ppvoid v); -pcvoid ctl_vector_getEntryX (ppvoid v, uint index); -int ctl_vector_getEntrySizeX(ppvoid v); +int ctl_array_getSizeX (ppvoid v); +pcvoid ctl_array_getEntryX (ppvoid v, uint index); +int ctl_array_getEntrySizeX(ppvoid v); -int ctl_vector_setSizeX (ppvoid v, uint count); -pvoid ctl_vector_setEntryX(ppvoid v, uint index, pcvoid data); +int ctl_array_setSizeX (ppvoid v, uint count); +pvoid ctl_array_setEntryX(ppvoid v, uint index, pcvoid data); -int ctl_vector_addBackX (ppvoid v, pcvoid entry); -int ctl_vector_delBackX (ppvoid v); -//int ctl_vector_addFrontX(ppvoid v, pcvoid entry); -//int ctl_vector_delFrontX(ppvoid v); +int ctl_array_addBackX (ppvoid v, pcvoid entry); +int ctl_array_delBackX (ppvoid v); +//int ctl_array_addFrontX(ppvoid v, pcvoid entry); +//int ctl_array_delFrontX(ppvoid v); -int ctl_vector_catX (ppvoid v, ppcvoid v2); -pvoid ctl_vector_copyX (ppvoid v, ppcvoid v2); -int ctl_vector_replaceX(ppvoid v , uint i1, uint ct1, +int ctl_array_catX (ppvoid v, ppcvoid v2); +pvoid ctl_array_copyX (ppvoid v, ppcvoid v2); +int ctl_array_replaceX(ppvoid v , uint i1, uint ct1, ppcvoid v2, uint j1, int ct2); -#define ctl_vector_init(X,Y,Z) ctl_vector_initX(ppVoid(X),Y,Z) -#define ctl_vector_free(X) ctl_vector_freeX(ppVoid(X)) +#define ctl_array_init(X,Y,Z) ctl_array_initX(ppVoid(X),Y,Z) +#define ctl_array_free(X) ctl_array_freeX(ppVoid(X)) -#define ctl_vector_getSize(X) ctl_vector_getSizeX (ppVoid(X)) -#define ctl_vector_getEntry(X,Y) ctl_vector_getEntryX (ppVoid(X),Y) -#define ctl_vector_getEntrySize(X) ctl_vector_getEntrySizeX(ppVoid(X)) +#define ctl_array_getSize(X) ctl_array_getSizeX (ppVoid(X)) +#define ctl_array_getEntry(X,Y) ctl_array_getEntryX (ppVoid(X),Y) +#define ctl_array_getEntrySize(X) ctl_array_getEntrySizeX(ppVoid(X)) -#define ctl_vector_setSize(X,Y) ctl_vector_setSizeX (ppVoid(X),Y) -#define ctl_vector_setEntry(X,Y,Z) ctl_vector_setEntryX(ppVoid(X),Y,pcVoid(Z)) +#define ctl_array_setSize(X,Y) ctl_array_setSizeX (ppVoid(X),Y) +#define ctl_array_setEntry(X,Y,Z) ctl_array_setEntryX(ppVoid(X),Y,pcVoid(Z)) -#define ctl_vector_addBack(X,Y) ctl_vector_addBackX(ppVoid(X),pcVoid(Y)) -#define ctl_vector_delBack(X) ctl_vector_delBackX(ppVoid(X)) -//#define ctl_vector_addFront(X,Y) ctl_vector_addBackX(ppVoid(X),pcVoid(Y)) -//#define ctl_vector_delFront(X) ctl_vector_delBackX(ppVoid(X)) +#define ctl_array_addBack(X,Y) ctl_array_addBackX(ppVoid(X),pcVoid(Y)) +#define ctl_array_delBack(X) ctl_array_delBackX(ppVoid(X)) +//#define ctl_array_addFront(X,Y) ctl_array_addBackX(ppVoid(X),pcVoid(Y)) +//#define ctl_array_delFront(X) ctl_array_delBackX(ppVoid(X)) -#define ctl_vector_cat(X,Y) ctl_vector_catX (ppVoid(X),ppcVoid(Y)) -#define ctl_vector_copy(X,Y) ctl_vector_copyX(ppVoid(X),ppcVoid(Y)) -#define ctl_vector_replace(X,Y,Z,A,B,C) ctl_vector_replaceX( ppVoid(X),Y,Z,\ +#define ctl_array_cat(X,Y) ctl_array_catX (ppVoid(X),ppcVoid(Y)) +#define ctl_array_copy(X,Y) ctl_array_copyX(ppVoid(X),ppcVoid(Y)) +#define ctl_array_replace(X,Y,Z,A,B,C) ctl_array_replaceX( ppVoid(X),Y,Z,\ ppcVoid(A),B,C) -#endif /* __vector_h__ */ +#endif /* __ARRAY_H_ */ diff --git a/include/list.h b/include/list.h index 902a39c..8b802f5 100644 --- a/include/list.h +++ b/include/list.h @@ -61,7 +61,7 @@ /* delBack(addr of the list) */ /* Remove the last element of the list. */ /* */ -/* addFront(addr of the vector, data) */ +/* addFront(addr of the list, data) */ /* Add an element which contain data at the front of */ /* the list. */ /* */ |