From dd7595a3475407a7fa96a97393bae8c5220e8762 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Wed, 4 Jan 2012 18:41:13 +1000 Subject: 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. --- libraries/eina/src/examples/eina_array_02.c | 57 +++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 libraries/eina/src/examples/eina_array_02.c (limited to 'libraries/eina/src/examples/eina_array_02.c') diff --git a/libraries/eina/src/examples/eina_array_02.c b/libraries/eina/src/examples/eina_array_02.c new file mode 100644 index 0000000..e897321 --- /dev/null +++ b/libraries/eina/src/examples/eina_array_02.c @@ -0,0 +1,57 @@ +//Compile with: +//gcc -g `pkg-config --cflags --libs eina` eina_array_02.c -o eina_array_02 + +#include +#include + +#include + +Eina_Bool keep(void *data, void *gdata) +{ + if (strlen((const char*)data) <= 5) + return EINA_TRUE; + return EINA_FALSE; +} + +int +main(int argc, char **argv) +{ + const char* strs[] = { + "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", + "ten", "eleven", "twelve", "thirteen", "fourtenn", "fifteen", "sixteen", + "seventeen", "eighteen", "nineteen", "twenty" + }; + const char* strings[] = { + "helo", "hera", "starbuck", "kat", "boomer", + "hotdog", "longshot", "jammer", "crashdown", "hardball", + "duck", "racetrack", "apolo", "husker", "freaker", + "skulls", "bulldog", "flat top", "hammerhead", "gonzo" + }; + Eina_Array *array; + Eina_Array_Iterator iterator; + const char *item; + unsigned int i; + + eina_init(); + + array = eina_array_new(10); + + for (i = 0; i < 20; i++) + eina_array_push(array, strs[i]); + + eina_array_clean(array); + for (i = 0; i < 20; i++) + eina_array_push(array, strings[i]); + + eina_array_data_set(array, 17, "flattop"); + + eina_array_remove(array, keep, NULL); + EINA_ARRAY_ITER_NEXT(array, i, item, iterator) + printf("item #%d: %s\n", i, item); + + eina_array_free(array); + + eina_shutdown(); + + return 0; +} -- cgit v1.1