diff options
author | David Walter Seikel | 2012-01-04 18:41:13 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-04 18:41:13 +1000 |
commit | dd7595a3475407a7fa96a97393bae8c5220e8762 (patch) | |
tree | e341e911d7eb911a51684a7412ef7f7c7605d28e /libraries/eina/src/examples/eina_accessor_01.c | |
parent | Add the skeleton. (diff) | |
download | SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.zip SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.gz SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.bz2 SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.xz |
Add the base Enlightenment Foundation Libraries - eina, eet, evas, ecore, embryo, and edje.
Note that embryo wont be used, but I'm not sure yet if you can build edje without it.
Diffstat (limited to '')
-rw-r--r-- | libraries/eina/src/examples/eina_accessor_01.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/libraries/eina/src/examples/eina_accessor_01.c b/libraries/eina/src/examples/eina_accessor_01.c new file mode 100644 index 0000000..c48fdc6 --- /dev/null +++ b/libraries/eina/src/examples/eina_accessor_01.c | |||
@@ -0,0 +1,55 @@ | |||
1 | //Compile with: | ||
2 | //gcc -g `pkg-config --cflags --libs eina` eina_accessor_01.c -o eina_accessor_01 | ||
3 | |||
4 | #include <stdio.h> | ||
5 | |||
6 | #include <Eina.h> | ||
7 | |||
8 | int | ||
9 | main(int argc, char **argv) | ||
10 | { | ||
11 | const char *strings[] = { | ||
12 | "even", "odd", "even", "odd", "even", "odd", "even", "odd", "even", "odd" | ||
13 | }; | ||
14 | const char *more_strings[] = { | ||
15 | "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" | ||
16 | }; | ||
17 | Eina_Array *array; | ||
18 | Eina_List *list = NULL; | ||
19 | Eina_Accessor *acc; | ||
20 | unsigned short int i; | ||
21 | void *data; | ||
22 | |||
23 | eina_init(); | ||
24 | |||
25 | array = eina_array_new(10); | ||
26 | |||
27 | for (i = 0; i < 10; i++) | ||
28 | { | ||
29 | eina_array_push(array, strings[i]); | ||
30 | list = eina_list_append(list, more_strings[i]); | ||
31 | } | ||
32 | |||
33 | acc = eina_array_accessor_new(array); | ||
34 | for(i = 1; i < 10; i += 2) | ||
35 | { | ||
36 | eina_accessor_data_get(acc, i, &data); | ||
37 | printf("%s\n", (const char *)data); | ||
38 | } | ||
39 | eina_accessor_free(acc); | ||
40 | eina_array_free(array); | ||
41 | |||
42 | acc = eina_list_accessor_new(list); | ||
43 | for(i = 1; i < 10; i += 2) | ||
44 | { | ||
45 | eina_accessor_data_get(acc, i, &data); | ||
46 | printf("%s\n", (const char *)data); | ||
47 | } | ||
48 | |||
49 | eina_list_free(eina_accessor_container_get(acc)); | ||
50 | eina_accessor_free(acc); | ||
51 | |||
52 | eina_shutdown(); | ||
53 | |||
54 | return 0; | ||
55 | } | ||