#include #include "liste.h" #include "gst_eval_grp.h" struct evgr_st { liste lst; }; typedef struct info_st { type_fct_evalue fct_evalue; void *arg; } * info_st; static void evgr_evaluation (void *info, void *arg); evgr_st evgr_init (void) { evgr_st evgr = (evgr_st) malloc (sizeof (struct evgr_st)); assert (evgr != NULL); evgr->lst = lst_cree (free); return evgr; } void evgr_ajoute_composant (evgr_st evgr, type_fct_evalue fct_evalue, void *arg, int en_fin) { info_st info = (info_st) malloc (sizeof (struct info_st)); assert (info != NULL); info->fct_evalue = fct_evalue; info->arg = arg; if (en_fin) lst_ajoute_fin (evgr->lst, info); else lst_ajoute_debut (evgr->lst, info); } void evgr_evalue (evgr_st evgr) { lst_applique (evgr->lst, evgr_evaluation, NULL); } void evgr_libere (evgr_st evgr) { lst_libere (evgr->lst); free (evgr); } static void evgr_evaluation (void *info, void *arg) { info_st inf = (info_st) info; inf->fct_evalue (inf->arg); }