--- rpl/src/simplification.c 2014/10/13 07:12:54 1.50 +++ rpl/src/simplification.c 2014/10/20 19:01:35 1.51 @@ -111,6 +111,33 @@ transcription_arbre(struct_processus *s_ /* ================================================================================ + Fonction de simplification d'un arbre +================================================================================ + Entrées : pointeur sur une structure struct_processus +-------------------------------------------------------------------------------- + Sorties : +-------------------------------------------------------------------------------- + Effets de bord : néant +================================================================================ +*/ + +static void +inversion_fonctions_arbre(struct_arbre *s_arbre) +{ + return; +} + + +static void +simplification_arbre(struct_processus *s_etat_processus, + struct_arbre **s_arbre) +{ + return; +} + + +/* +================================================================================ Fonction 'simplification' (ne libère pas les paramètres) ================================================================================ Entrées : pointeur sur une structure struct_processus @@ -126,8 +153,6 @@ simplification(struct_processus *s_etat_ { struct_objet *s_objet_simplifie; -# ifdef EXPERIMENTAL_CODE - integer8 i; integer8 nombre_arguments; @@ -187,6 +212,8 @@ simplification(struct_processus *s_etat_ (*s_arbre).inversion = d_faux; (*s_arbre).nombre_branches = nombre_arguments; + (*s_arbre).feuille = copie_objet(s_etat_processus, + (*l_element_courant).donnee, 'P'); if (((*s_arbre).branches = malloc(((size_t) (*s_arbre) .nombre_branches) * sizeof(struct_arbre *))) @@ -197,7 +224,7 @@ simplification(struct_processus *s_etat_ return(NULL); } - for(i = 0; i < nombre_arguments; i++) + for(i = nombre_arguments - 1; i >= 0; i--) { if (l_liste_locale == NULL) { @@ -206,19 +233,8 @@ simplification(struct_processus *s_etat_ return(NULL); } - if (((*s_arbre).branches[i] = malloc( - sizeof(struct_arbre))) == NULL) - { - (*s_etat_processus).erreur_systeme = - d_es_allocation_memoire; - return(NULL); - } - - (*(*s_arbre).branches[i]).feuille = + (*s_arbre).branches[i] = (struct_arbre *) (*l_liste_locale).donnee; - (*(*s_arbre).branches[i]).inversion = d_faux; - (*(*s_arbre).branches[i]).nombre_branches = 0; - (*(*s_arbre).branches[i]).branches = NULL; l_ancienne_liste_locale = l_liste_locale; l_liste_locale = (*l_liste_locale).suivant; @@ -305,8 +321,13 @@ simplification(struct_processus *s_etat_ * Simplification de l'arbre */ -# if 0 - simplification_arbre(); +# ifdef EXPERIMENTAL_CODE + simplification_arbre(s_etat_processus, &s_arbre); + + if ((*s_etat_processus).erreur_systeme != d_es) + { + return(NULL); + } # endif /* @@ -397,7 +418,6 @@ simplification(struct_processus *s_etat_ .nom_fonction, ">>"); } else -# endif { s_objet_simplifie = copie_objet(s_etat_processus, s_objet, 'P'); }