version 1.1, 2011/04/19 21:40:21
|
version 1.1.2.1, 2011/04/19 21:40:21
|
Line 0
|
Line 1
|
|
#include <stdio.h> |
|
#include <string.h> |
|
#include <aitio.h> |
|
|
|
int |
|
main(int argc, char **argv) |
|
{ |
|
array_t *a = NULL; |
|
|
|
a = io_arrayInit(10); |
|
if (!a) { |
|
printf("Error:: #%d - %s\n", io_GetErrno(), io_GetError()); |
|
return 1; |
|
} |
|
|
|
switch (argc) { |
|
case 4: |
|
io_arraySet(a, 5, argv[3]); |
|
case 3: |
|
io_arraySet(a, 4, argv[2]); |
|
case 2: |
|
io_arraySet(a, 1, argv[1]); |
|
} |
|
|
|
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_arrayGet(a, 2, char*), io_arrayGet(a, 3, char*), |
|
io_arrayGet(a, 4, char*), io_arrayGet(a, 5, char*)); |
|
printf(">>> last used element=%d array size=%d\n", io_arrayLen(a), io_arraySize(a)); |
|
|
|
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", |
|
io_arrayGet(a, 0, char*), io_arrayGet(a, 1, char*), |
|
io_arrayGet(a, 2, char*), io_arrayGet(a, 3, char*), |
|
io_arrayGet(a, 4, char*), io_arrayGet(a, 5, char*)); |
|
|
|
printf("vacuum:: last used element=%d array size=%d\n", io_arrayLen(a), io_arraySize(a)); |
|
|
|
io_arrayGrow(a, io_arrayLen(a) + 3); |
|
printf("grow:: last used element=%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", |
|
io_arrayGet(a, 0, char*), io_arrayGet(a, 1, char*), |
|
io_arrayGet(a, 2, char*), io_arrayGet(a, 3, char*), |
|
io_arrayGet(a, 4, char*), io_arrayGet(a, 5, char*)); |
|
|
|
io_arrayGrow(a, 1); |
|
io_arrayGrow(a, 2); |
|
printf("shrink:: last used element=%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*)); |
|
|
|
io_arrayDestroy(&a); |
|
return 0; |
|
} |