version 1.1.2.1, 2011/04/19 21:40:21
|
version 1.7, 2012/05/19 00:00:12
|
Line 6 int
|
Line 6 int
|
main(int argc, char **argv) |
main(int argc, char **argv) |
{ |
{ |
array_t *a = NULL; |
array_t *a = NULL; |
|
void *d = "MEOWeoeoeoeoe!!!"; |
|
|
|
a = io_arrayInit(0); |
|
if (!a) { |
|
printf("Error:: #%d - %s\n", io_GetErrno(), io_GetError()); |
|
return 1; |
|
} |
|
io_arrayElem(a, 5, d); |
|
printf("si=%d\n", io_arraySize(a)); |
|
io_arrayDestroy(&a); |
|
|
a = io_arrayInit(10); |
a = io_arrayInit(10); |
if (!a) { |
if (!a) { |
printf("Error:: #%d - %s\n", io_GetErrno(), io_GetError()); |
printf("Error:: #%d - %s\n", io_GetErrno(), io_GetError()); |
Line 22 main(int argc, char **argv)
|
Line 32 main(int argc, char **argv)
|
io_arraySet(a, 1, argv[1]); |
io_arraySet(a, 1, argv[1]); |
} |
} |
|
|
|
printf("d=%p push=%d\n", d, io_arrayPush(a, &d, 0)); |
|
printf("d=%p pop=%d\n", d, io_arrayPop(a, &d, 0)); |
|
printf("last=%d ", io_arrayLast(a)); |
|
printf("d=%p pop=%d\n", d, io_arrayPop(a, &d, 1)); |
|
printf("last=%d ", io_arrayLast(a)); |
|
|
printf(">>> a[0]=%s a[1]=%s a[2]=%s a[3]=%s a[4]=%s a[5]=%s\n", |
printf(">>> a[0]=%s a[1]=%s a[2]=%s a[3]=%s a[4]=%s a[5]=%s\n", |
io_arrayGet(a, 0, char*), io_arrayGet(a, 1, char*), | io_array(a, 0, char*), io_array(a, 1, char*), |
io_arrayGet(a, 2, char*), io_arrayGet(a, 3, char*), | io_array(a, 2, char*), io_array(a, 3, char*), |
io_arrayGet(a, 4, char*), io_arrayGet(a, 5, char*)); | io_array(a, 4, char*), io_array(a, 5, char*)); |
printf(">>> last used element=%d array size=%d\n", io_arrayLen(a), io_arraySize(a)); | printf(">>> array really len=%d array size=%d\n", io_arrayLen(a), io_arraySize(a)); |
|
|
io_arrayVacuum(a, VACUUM_BETWEEN); |
io_arrayVacuum(a, VACUUM_BETWEEN); |
printf("vacuum:: a[0]=%s a[1]=%s a[2]=%s a[3]=%s a[4]=%s a[5]=%s\n", |
printf("vacuum:: a[0]=%s a[1]=%s a[2]=%s a[3]=%s a[4]=%s a[5]=%s\n", |
io_arrayGet(a, 0, char*), io_arrayGet(a, 1, char*), | io_array(a, 0, char*), io_array(a, 1, char*), |
io_arrayGet(a, 2, char*), io_arrayGet(a, 3, char*), | io_array(a, 2, char*), io_array(a, 3, char*), |
io_arrayGet(a, 4, char*), io_arrayGet(a, 5, char*)); | io_array(a, 4, char*), io_array(a, 5, char*)); |
|
|
printf("vacuum:: last used element=%d array size=%d\n", io_arrayLen(a), io_arraySize(a)); | printf("vacuum:: array really len=%d array size=%d\n", io_arrayLen(a), io_arraySize(a)); |
|
|
io_arrayGrow(a, io_arrayLen(a) + 3); | io_arrayGrow(a, io_arrayLen(a) + 4, 0); |
printf("grow:: last used element=%d array size=%d\n", io_arrayLen(a), io_arraySize(a)); | printf("grow:: array really len=%d array size=%d\n", io_arrayLen(a), io_arraySize(a)); |
printf("grow:: a[0]=%s a[1]=%s a[2]=%s a[3]=%s a[4]=%s a[5]=%s\n", |
printf("grow:: a[0]=%s a[1]=%s a[2]=%s a[3]=%s a[4]=%s a[5]=%s\n", |
io_arrayGet(a, 0, char*), io_arrayGet(a, 1, char*), | io_array(a, 0, char*), io_array(a, 1, char*), |
io_arrayGet(a, 2, char*), io_arrayGet(a, 3, char*), | io_array(a, 2, char*), /*io_array(a, 3, char*), */ NULL, |
io_arrayGet(a, 4, char*), io_arrayGet(a, 5, char*)); | /*io_array(a, 4, char*), io_array(a, 5, char*)*/ NULL, NULL); |
|
|
io_arrayGrow(a, 1); | io_arrayGrow(a, 1, 0); |
io_arrayGrow(a, 2); | io_arrayGrow(a, 2, 0); |
printf("shrink:: last used element=%d array size=%d\n", io_arrayLen(a), io_arraySize(a)); | printf("shrink:: array really len=%d array size=%d\n", io_arrayLen(a), io_arraySize(a)); |
printf("shrink:: a[0]=%s a[1]=%s\n", io_arrayGet(a, 0, char*), io_arrayGet(a, 1, char*)); | printf("shrink:: a[0]=%s a[1]=%s\n", io_array(a, 0, char*), io_array(a, 1, char*)); |
|
|
io_arrayDestroy(&a); |
io_arrayDestroy(&a); |
return 0; |
return 0; |