Auto-entrepreneur
In: Programmation
28 Nov 2008Eina est LA bibliothèque de “base” d’Enlightenment. Elle fournit un ensemble d’outils (“data types”) utilisés par les EFL, comme des tableaux, des hashs, des listes chaînées, une gestion de modules, et bien plus encore…
Voici, un exemple simple d’usage de ses listes chaînées.
#include <Eina.h> int main(int ac, char **av) { int i; char *data; Eina_List *list = NULL, *l = NULL; if (ac <= 1) return 0; eina_init(); for (i=0; i<ac; i++) list = eina_list_append(list, eina_stringshare_add(av[i])); EINA_LIST_FOREACH(list, l, data) printf("argument : %s\n", data); return 0; }
Passionné des nouvelles technologies, je propose en tant qu’auto-entrepreneur diverses activités : développement de bibliothèques, d’applications ou encore de progiciels mais aussi des prestations plus courantes comme la création de sites web et d'intranet professionnel.
De plus je suis administrateur système, je m occupe ainsi d’un micro parc de six machines dans un environnement professionnel. Passionné par les technologies libres et open-source, il m’arrive souvent d’apporter mon aide au développement de divers projets. Actuellement, je me concentre essentiellement sur Drupal, qui est selon moi le CMS le plus prometteur dans le domaine du net.
Vous avez des idées plus ou moins abouties que vous tentez de concrétiser, vous rencontrez quelques problèmes, ou vous êtes bloqués, n’hésitez pas à partager avec moi votre projet.
Responsable et bien organisé je peux vous accompagner pour faire connaître votre projet ou tout simplement vous aider dans des développements temporels, ainsi que vous conseiller sur des améliorations possibles.
7 Responses to Liste chaînée simple avec Eina.
Issa
July 10th, 2010 at 09:16
Hello cool !
mais quand on compile ton programme il y a des warnings :
issa@issa-desktop:/media/Element/programmation/SYSTEM/TEST_EINA_LIST$ make
— compilation main.c —
main.c: In function ‘main’:
main.c:18: warning: implicit declaration of function ‘printf’
main.c:18: warning: incompatible implicit declaration of built-in function ‘printf’
— Cr�ation ex�cutable : bin/main —
mais cela marche bien quand même quand je le lance :
issa@issa-desktop:/media/Element/programmation/SYSTEM/TEST_EINA_LIST/bin$ ./main mot1 mot2 mot3 mot4 mot5
argument : ./main
argument : mot1
argument : mot2
argument : mot3
argument : mot4
argument : mot5
Issa
July 10th, 2010 at 09:29
Par contre j’ai oublié de poser ma question donc :
par contre ce que je comprend pas pourquoi on ne peut ajjouter que des pointeurs dans une list ?
pourquoi par exemple si je fais ceci ça ne marche pas :
le code :
#include
int main()
{
const int val1 = 10,val2 = 20, val3 = 30, val4 = 40;
Eina_List *list = NULL, *l = NULL;
int *data;
eina_init();
list = eina_list_append(list, val1);
list = eina_list_append(list, val2);
list = eina_list_append(list, val3);
list = eina_list_append(list, val4);
EINA_LIST_FOREACH(list, l, data)
printf(”argument : %d\n”, data);
return 0;
}
a la compile j’ai ces erreurs :
issa@issa-desktop:/media/Element/programmation/SYSTEM/TEST_EINA_LIST$ make
— compilation main.c —
main.c: In function ‘main’:
main.c:13: warning: passing argument 2 of ‘eina_list_append’ makes pointer from integer without a cast
/home/issa/usr/E17svn/include/eina-0/eina/eina_list.h:78: note: expected ‘const void *’ but argument is of type ‘int’
main.c:14: warning: passing argument 2 of ‘eina_list_append’ makes pointer from integer without a cast
/home/issa/usr/E17svn/include/eina-0/eina/eina_list.h:78: note: expected ‘const void *’ but argument is of type ‘int’
main.c:15: warning: passing argument 2 of ‘eina_list_append’ makes pointer from integer without a cast
/home/issa/usr/E17svn/include/eina-0/eina/eina_list.h:78: note: expected ‘const void *’ but argument is of type ‘int’
main.c:16: warning: passing argument 2 of ‘eina_list_append’ makes pointer from integer without a cast
/home/issa/usr/E17svn/include/eina-0/eina/eina_list.h:78: note: expected ‘const void *’ but argument is of type ‘int’
main.c:19: warning: implicit declaration of function ‘printf’
main.c:19: warning: incompatible implicit declaration of built-in function ‘printf’
main.c:19: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘int *’
— Cr�ation ex�cutable : bin/main —
et pourtant quand je lance mon programme il marche :
issa@issa-desktop:/media/Element/programmation/SYSTEM/TEST_EINA_LIST/bin$ ./main
argument : 10
argument : 20
argument : 30
argument : 40
Donc ma question est comment ne plus avoir ces warnins ?
et est ce que dans une EINA_LIST on peut mettre des variables de type différentes ?
rookmoot
August 12th, 2010 at 13:23
Ce billet est un peu vieux, et l’API de EINA a peut être changé depuis, renseigne toi auprès de cédric ou sur la documentation de Eina.
Mais les listes prennent des adresses en paramètre oui, après tu peux bien sur passé une référence à une variable simple. Mais dès la mort de ta variable, ton noeud ne pointera plus sur rien…
Sean Orlikowski
July 15th, 2011 at 21:06
I have never seen such impressive ideas presented in writing. Your writer has a very unique way of presenting information in such a way as to catch the reader’s attention.
TERRENCE
August 1st, 2011 at 19:49
Order@Discount.Abilify” rel=”nofollow”>..…
Buyit now…
google
August 30th, 2011 at 14:41
I liked your article is an interesting technology
thanks to google I found you
Jordan Zapatos
January 4th, 2012 at 17:28
Youre so cool! I dont suppose Ive read anything like this before. So good to search out any individual with some unique ideas on this subject. realy thanks for beginning this up. this web site is one thing that is wanted on the internet, somebody with a little originality. useful job for bringing something new to the web!