diff options
Diffstat (limited to 'libraries/eina/src/examples/eina_inarray_01.c')
-rw-r--r-- | libraries/eina/src/examples/eina_inarray_01.c | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/libraries/eina/src/examples/eina_inarray_01.c b/libraries/eina/src/examples/eina_inarray_01.c deleted file mode 100644 index b9ab4e7..0000000 --- a/libraries/eina/src/examples/eina_inarray_01.c +++ /dev/null | |||
@@ -1,52 +0,0 @@ | |||
1 | //Compile with: | ||
2 | //gcc -g eina_inarray_01.c -o eina_inarray_01 `pkg-config --cflags --libs eina` | ||
3 | |||
4 | #include <Eina.h> | ||
5 | |||
6 | int | ||
7 | cmp(const void *a, const void *b) | ||
8 | { | ||
9 | return *(int*)a > *(int*)b; | ||
10 | } | ||
11 | |||
12 | int main(int argc, char **argv) | ||
13 | { | ||
14 | Eina_Inarray *iarr; | ||
15 | char ch, *ch2; | ||
16 | int a, *b; | ||
17 | |||
18 | eina_init(); | ||
19 | iarr = eina_inarray_new(sizeof(char), 0); | ||
20 | |||
21 | ch = 'a'; | ||
22 | eina_inarray_append(iarr, &ch); | ||
23 | ch = 'b'; | ||
24 | eina_inarray_append(iarr, &ch); | ||
25 | ch = 'c'; | ||
26 | eina_inarray_append(iarr, &ch); | ||
27 | ch = 'd'; | ||
28 | eina_inarray_append(iarr, &ch); | ||
29 | |||
30 | printf("Inline array of chars:\n"); | ||
31 | EINA_INARRAY_FOREACH(iarr, ch2) | ||
32 | printf("char: %c(pointer: %p)\n", *ch2, ch2); | ||
33 | |||
34 | eina_inarray_flush(iarr); | ||
35 | eina_inarray_setup(iarr, sizeof(int), 4); | ||
36 | |||
37 | a = 97; | ||
38 | eina_inarray_append(iarr, &a); | ||
39 | a = 98; | ||
40 | eina_inarray_append(iarr, &a); | ||
41 | a = 100; | ||
42 | eina_inarray_append(iarr, &a); | ||
43 | a = 99; | ||
44 | eina_inarray_insert_sorted(iarr, &a, cmp); | ||
45 | |||
46 | printf("Inline array of integers with %d elements:\n", eina_inarray_count(iarr)); | ||
47 | EINA_INARRAY_FOREACH(iarr, b) | ||
48 | printf("int: %d(pointer: %p)\n", *b, b); | ||
49 | |||
50 | eina_inarray_free(iarr); | ||
51 | eina_shutdown(); | ||
52 | } | ||