File:  [local] / rpl / src / instructions_r2.c
Revision 1.6: download - view: text, annotated - select for diffs - revision graph
Thu Apr 1 13:22:06 2010 UTC (14 years, 1 month ago) by bertrand
Branches: MAIN
CVS tags: rpl-4_0_13, HEAD
Correction d'un bug dans la fonction RETURN. Ce problème ne survient qu'en
cas d'exécution d'un programme compilé ou de l'évaluation d'une fonction
contenant l'instruction RETURN.

    1: /*
    2: ================================================================================
    3:   RPL/2 (R) version 4.0.13
    4:   Copyright (C) 1989-2010 Dr. BERTRAND Joël
    5: 
    6:   This file is part of RPL/2.
    7: 
    8:   RPL/2 is free software; you can redistribute it and/or modify it
    9:   under the terms of the CeCILL V2 License as published by the french
   10:   CEA, CNRS and INRIA.
   11:  
   12:   RPL/2 is distributed in the hope that it will be useful, but WITHOUT
   13:   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   14:   FITNESS FOR A PARTICULAR PURPOSE.  See the CeCILL V2 License
   15:   for more details.
   16:  
   17:   You should have received a copy of the CeCILL License
   18:   along with RPL/2. If not, write to info@cecill.info.
   19: ================================================================================
   20: */
   21: 
   22: 
   23: #include "rpl.conv.h"
   24: 
   25: 
   26: /*
   27: ================================================================================
   28:   Fonction 'r->d'
   29: ================================================================================
   30:   Entrées : pointeur sur une structure struct_processus
   31: --------------------------------------------------------------------------------
   32:   Sorties :
   33: --------------------------------------------------------------------------------
   34:   Effets de bord : néant
   35: ================================================================================
   36: */
   37: 
   38: void
   39: instruction_r_vers_d(struct_processus *s_etat_processus)
   40: {
   41:     struct_liste_chainee            *l_element_courant;
   42:     struct_liste_chainee            *l_element_precedent;
   43: 
   44:     struct_objet                    *s_copie_argument;
   45:     struct_objet                    *s_objet_argument;
   46:     struct_objet                    *s_objet_resultat;
   47: 
   48:     if ((*s_etat_processus).affichage_arguments == 'Y')
   49:     {
   50:         printf("\n  R->D ");
   51: 
   52:         if ((*s_etat_processus).langue == 'F')
   53:         {
   54:             printf("(radians vers degrés)\n\n");
   55:         }
   56:         else
   57:         {
   58:             printf("(radians to degrees)\n\n");
   59:         }
   60: 
   61:         printf("    1: %s, %s\n", d_INT, d_REL);
   62:         printf("->  1: %s\n\n", d_REL);
   63: 
   64:         printf("    1: %s, %s\n", d_NOM, d_ALG);
   65:         printf("->  1: %s\n\n", d_ALG);
   66: 
   67:         printf("    1: %s\n", d_RPN);
   68:         printf("->  1: %s\n", d_RPN);
   69: 
   70:         return;
   71:     }
   72:     else if ((*s_etat_processus).test_instruction == 'Y')
   73:     {
   74:         (*s_etat_processus).nombre_arguments = -1;
   75:         return;
   76:     }
   77: 
   78:     if (test_cfsf(s_etat_processus, 31) == d_vrai)
   79:     {
   80:         if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
   81:         {
   82:             return;
   83:         }
   84:     }
   85: 
   86:     if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
   87:             &s_objet_argument) == d_erreur)
   88:     {
   89:         (*s_etat_processus).erreur_execution = d_ex_manque_argument;
   90:         return;
   91:     }
   92: 
   93: /*
   94: --------------------------------------------------------------------------------
   95:   Conversion d'un entier ou d'un réel
   96: --------------------------------------------------------------------------------
   97: */
   98: 
   99:     if (((*s_objet_argument).type == INT) ||
  100:             ((*s_objet_argument).type == REL))
  101:     {
  102:         if ((s_objet_resultat = allocation(s_etat_processus, REL)) == NULL)
  103:         {
  104:             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
  105:             return;
  106:         }
  107: 
  108:         if ((*s_objet_argument).type == INT)
  109:         {
  110:             (*((real8 *) (*s_objet_resultat).objet)) =
  111:                     (real8) (*((integer8 *) (*s_objet_argument).objet));
  112:         }
  113:         else
  114:         {
  115:             (*((real8 *) (*s_objet_resultat).objet)) =
  116:                     (*((real8 *) (*s_objet_argument).objet));
  117:         }
  118: 
  119:         conversion_radians_vers_degres((real8 *) (*s_objet_resultat).objet);
  120:     }
  121: 
  122: /*
  123: --------------------------------------------------------------------------------
  124:   Conversion d'un nom
  125: --------------------------------------------------------------------------------
  126: */
  127: 
  128:     else if ((*s_objet_argument).type == NOM)
  129:     {
  130:         if ((s_objet_resultat = allocation(s_etat_processus, ALG)) == NULL)
  131:         {
  132:             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
  133:             return;
  134:         }
  135: 
  136:         if (((*s_objet_resultat).objet =
  137:                 allocation_maillon(s_etat_processus)) == NULL)
  138:         {
  139:             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
  140:             return;
  141:         }
  142: 
  143:         l_element_courant = (*s_objet_resultat).objet;
  144: 
  145:         if (((*l_element_courant).donnee = allocation(s_etat_processus, FCT))
  146:                 == NULL)
  147:         {
  148:             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
  149:             return;
  150:         }
  151: 
  152:         (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
  153:                 .nombre_arguments = 0;
  154:         (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
  155:                 .fonction = instruction_vers_niveau_superieur;
  156: 
  157:         if (((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
  158:                 .nom_fonction = malloc(3 * sizeof(unsigned char))) == NULL)
  159:         {
  160:             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
  161:             return;
  162:         }
  163: 
  164:         strcpy((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
  165:                 .nom_fonction, "<<");
  166: 
  167:         if (((*l_element_courant).suivant =
  168:                 allocation_maillon(s_etat_processus)) == NULL)
  169:         {
  170:             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
  171:             return;
  172:         }
  173: 
  174:         l_element_courant = (*l_element_courant).suivant;
  175:         (*l_element_courant).donnee = s_objet_argument;
  176: 
  177:         if (((*l_element_courant).suivant =
  178:                 allocation_maillon(s_etat_processus)) == NULL)
  179:         {
  180:             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
  181:             return;
  182:         }
  183: 
  184:         l_element_courant = (*l_element_courant).suivant;
  185: 
  186:         if (((*l_element_courant).donnee = allocation(s_etat_processus, FCT))
  187:                 == NULL)
  188:         {
  189:             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
  190:             return;
  191:         }
  192: 
  193:         (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
  194:                 .nombre_arguments = 1;
  195:         (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
  196:                 .fonction = instruction_r_vers_d;
  197: 
  198:         if (((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
  199:                 .nom_fonction = malloc(5 * sizeof(unsigned char))) == NULL)
  200:         {
  201:             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
  202:             return;
  203:         }
  204: 
  205:         strcpy((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
  206:                 .nom_fonction, "R->D");
  207: 
  208:         if (((*l_element_courant).suivant =
  209:                 allocation_maillon(s_etat_processus)) == NULL)
  210:         {
  211:             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
  212:             return;
  213:         }
  214: 
  215:         l_element_courant = (*l_element_courant).suivant;
  216: 
  217:         if (((*l_element_courant).donnee = allocation(s_etat_processus, FCT))
  218:                 == NULL)
  219:         {
  220:             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
  221:             return;
  222:         }
  223: 
  224:         (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
  225:                 .nombre_arguments = 0;
  226:         (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
  227:                 .fonction = instruction_vers_niveau_inferieur;
  228: 
  229:         if (((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
  230:                 .nom_fonction = malloc(3 * sizeof(unsigned char))) == NULL)
  231:         {
  232:             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
  233:             return;
  234:         }
  235: 
  236:         strcpy((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
  237:                 .nom_fonction, ">>");
  238: 
  239:         (*l_element_courant).suivant = NULL;
  240:         s_objet_argument = NULL;
  241:     }
  242: 
  243: /*
  244: --------------------------------------------------------------------------------
  245:   Conversion d'une expression
  246: --------------------------------------------------------------------------------
  247: */
  248: 
  249:     else if (((*s_objet_argument).type == ALG) ||
  250:             ((*s_objet_argument).type == RPN))
  251:     {
  252:         if ((s_copie_argument = copie_objet(s_etat_processus,
  253:                 s_objet_argument, 'N')) == NULL)
  254:         {
  255:             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
  256:             return;
  257:         }
  258: 
  259:         l_element_courant = (struct_liste_chainee *)
  260:                 (*s_copie_argument).objet;
  261:         l_element_precedent = l_element_courant;
  262: 
  263:         while((*l_element_courant).suivant != NULL)
  264:         {
  265:             l_element_precedent = l_element_courant;
  266:             l_element_courant = (*l_element_courant).suivant;
  267:         }
  268: 
  269:         if (((*l_element_precedent).suivant =
  270:                 allocation_maillon(s_etat_processus)) == NULL)
  271:         {
  272:             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
  273:             return;
  274:         }
  275: 
  276:         if (((*(*l_element_precedent).suivant).donnee =
  277:                 allocation(s_etat_processus, FCT)) == NULL)
  278:         {
  279:             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
  280:             return;
  281:         }
  282: 
  283:         (*((struct_fonction *) (*(*(*l_element_precedent).suivant)
  284:                 .donnee).objet)).nombre_arguments = 1;
  285:         (*((struct_fonction *) (*(*(*l_element_precedent).suivant)
  286:                 .donnee).objet)).fonction = instruction_r_vers_d;
  287: 
  288:         if (((*((struct_fonction *) (*(*(*l_element_precedent)
  289:                 .suivant).donnee).objet)).nom_fonction =
  290:                 malloc(5 * sizeof(unsigned char))) == NULL)
  291:         {
  292:             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
  293:             return;
  294:         }
  295: 
  296:         strcpy((*((struct_fonction *) (*(*(*l_element_precedent)
  297:                 .suivant).donnee).objet)).nom_fonction, "R->D");
  298: 
  299:         (*(*l_element_precedent).suivant).suivant = l_element_courant;
  300: 
  301:         s_objet_resultat = s_copie_argument;
  302:     }
  303: 
  304: /*
  305: --------------------------------------------------------------------------------
  306:   Réalisation impossible de la fonction R->D
  307: --------------------------------------------------------------------------------
  308: */
  309: 
  310:     else
  311:     {
  312:         liberation(s_etat_processus, s_objet_argument);
  313: 
  314:         (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
  315:         return;
  316:     }
  317: 
  318:     liberation(s_etat_processus, s_objet_argument);
  319: 
  320:     if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
  321:             s_objet_resultat) == d_erreur)
  322:     {
  323:         return;
  324:     }
  325: 
  326:     return;
  327: }
  328: 
  329: 
  330: /*
  331: ================================================================================
  332:   Fonction 'return'
  333: ================================================================================
  334:   Entrées : pointeur sur une structure struct_processus
  335: --------------------------------------------------------------------------------
  336:   Sorties :
  337: --------------------------------------------------------------------------------
  338:   Effets de bord : néant
  339: ================================================================================
  340: */
  341: 
  342: void
  343: instruction_return(struct_processus *s_etat_processus)
  344: {
  345:     logical1                        erreur;
  346:     logical1                        fin_boucle;
  347:     logical1                        fin_scrutation;
  348:     logical1                        presence_compteur;
  349: 
  350:     unsigned char                   *instruction_majuscule;
  351:     unsigned char                   *tampon;
  352: 
  353:     unsigned long                   registre_position_courante;
  354: 
  355:     struct_liste_chainee            *tampon_expression;
  356: 
  357:     void                            (*fonction)();
  358: 
  359:     (*s_etat_processus).erreur_execution = d_ex;
  360: 
  361:     if ((*s_etat_processus).affichage_arguments == 'Y')
  362:     {
  363:         printf("\n  RETURN ");
  364: 
  365:         if ((*s_etat_processus).langue == 'F')
  366:         {
  367:             printf("(retour d'une routine)\n\n");
  368:             printf("  Aucun argument\n");
  369:         }
  370:         else
  371:         {
  372:             printf("(return from a routine)\n\n");
  373:             printf("  No argument\n");
  374:         }
  375: 
  376:         return;
  377:     }
  378:     else if ((*s_etat_processus).test_instruction == 'Y')
  379:     {
  380:         (*s_etat_processus).nombre_arguments = -1;
  381:         return;
  382:     }
  383: 
  384:     if ((*s_etat_processus).niveau_courant == ((*s_etat_processus)
  385:             .niveau_initial + 1))
  386:     {
  387:         /*
  388:          * On ne peut rien dépiler !
  389:          */
  390: 
  391:         if ((*s_etat_processus).mode_execution_programme == 'Y')
  392:         {
  393:             (*s_etat_processus).requete_arret = 'Y';
  394:         }
  395: 
  396:         return;
  397:     }
  398: 
  399:     tampon = (*s_etat_processus).instruction_courante;
  400:     tampon_expression = (*s_etat_processus).expression_courante;
  401: 
  402:     fin_boucle = d_faux;
  403: 
  404:     if ((*s_etat_processus).mode_execution_programme == 'Y')
  405:     {
  406:         while(fin_boucle == d_faux)
  407:         {
  408:             erreur = recherche_instruction_suivante(s_etat_processus);
  409: 
  410:             if (erreur == d_erreur)
  411:             {
  412:                 return;
  413:             }
  414: 
  415:             if (recherche_variable(s_etat_processus,
  416:                     (*s_etat_processus).instruction_courante) == d_faux)
  417:             {
  418:                 (*s_etat_processus).erreur_systeme = d_es;
  419:                 instruction_majuscule = conversion_majuscule(
  420:                         (*s_etat_processus).instruction_courante);
  421: 
  422:                 if (instruction_majuscule == NULL)
  423:                 {
  424:                     return;
  425:                 }
  426: 
  427:                 /*
  428:                  * Traitement de la pile système par les différentes
  429:                  * instructions.
  430:                  */
  431: 
  432:                 if ((strcmp(instruction_majuscule, "IF") == 0) ||
  433:                         (strcmp(instruction_majuscule, "IFERR") == 0) ||
  434:                         (strcmp(instruction_majuscule, "DO") == 0) ||
  435:                         (strcmp(instruction_majuscule, "WHILE") == 0) ||
  436:                         (strcmp(instruction_majuscule, "FOR") == 0) ||
  437:                         (strcmp(instruction_majuscule, "START") == 0) ||
  438:                         (strcmp(instruction_majuscule, "SELECT") == 0)
  439:                         || (strcmp(instruction_majuscule, "CASE") == 0)
  440:                         || (strcmp(instruction_majuscule, "<<") == 0))
  441:                 {
  442:                     if (strcmp(instruction_majuscule, "<<") == 0)
  443:                     {
  444:                         analyse(s_etat_processus, NULL);
  445:                     }
  446:                     else if ((strcmp(instruction_majuscule, "FOR") == 0) ||
  447:                             (strcmp(instruction_majuscule, "START") == 0))
  448:                     {
  449:                         empilement_pile_systeme(s_etat_processus);
  450: 
  451:                         if ((*s_etat_processus).erreur_systeme != d_es)
  452:                         {
  453:                             return;
  454:                         }
  455: 
  456:                         (*(*s_etat_processus).l_base_pile_systeme)
  457:                                 .type_cloture = 'L';
  458:                     }
  459:                     else
  460:                     {
  461:                         /*
  462:                          * Si on passe sur un début de boucle FOR ou START,
  463:                          * les champs de la pile système sont initialisés à
  464:                          * NULL, ce qui permet de les libérer de façon correcte
  465:                          * lors du dépilement.
  466:                          */
  467: 
  468:                         empilement_pile_systeme(s_etat_processus);
  469: 
  470:                         if ((*s_etat_processus).erreur_systeme != d_es)
  471:                         {
  472:                             return;
  473:                         }
  474:                     }
  475:                 }
  476:                 else if ((strcmp(instruction_majuscule, "END") == 0) ||
  477:                         (strcmp(instruction_majuscule, "NEXT") == 0) ||
  478:                         (strcmp(instruction_majuscule, "STEP") == 0) ||
  479:                         (strcmp(instruction_majuscule, ">>") == 0))
  480:                 {
  481:                     if (strcmp(instruction_majuscule, ">>") == 0)
  482:                     {
  483:                         registre_position_courante = (*s_etat_processus)
  484:                                 .position_courante;
  485: 
  486:                         analyse(s_etat_processus, NULL);
  487: 
  488:                         fin_boucle = ((registre_position_courante !=
  489:                                 (*s_etat_processus).position_courante) ||
  490:                                 ((*s_etat_processus).retour_routine_evaluation
  491:                                 == 'Y'))
  492:                                 ? d_vrai : d_faux;
  493: 
  494:                         if (fin_boucle == d_faux)
  495:                         {
  496:                             if ((*s_etat_processus).niveau_courant ==
  497:                                     (*s_etat_processus).niveau_initial)
  498:                             {
  499:                                 fin_boucle = d_vrai;
  500:                             }
  501:                         }
  502:                     }
  503:                     else if (((strcmp(instruction_majuscule, "NEXT") == 0) ||
  504:                                 (strcmp(instruction_majuscule, "STEP") == 0)) &&
  505:                                 ((*(*s_etat_processus).l_base_pile_systeme)
  506:                                 .type_cloture != 'L'))
  507:                     {
  508:                         /*
  509:                          * Libération des compteurs de boucle.
  510:                          */
  511: 
  512:                         presence_compteur = ((*(*s_etat_processus)
  513:                                 .l_base_pile_systeme).type_cloture == 'F')
  514:                                 ? d_vrai : d_faux;
  515: 
  516:                         if (((*(*s_etat_processus).l_base_pile_systeme)
  517:                                 .type_cloture != 'S') &&
  518:                                 (presence_compteur == d_faux))
  519:                         {
  520:                             (*s_etat_processus).erreur_execution =
  521:                                     d_ex_erreur_traitement_boucle;
  522:                             return;
  523:                         }
  524: 
  525:                         if (presence_compteur == d_vrai)
  526:                         {
  527:                             if (recherche_variable(s_etat_processus,
  528:                                     (*(*s_etat_processus).l_base_pile_systeme)
  529:                                     .nom_variable) == d_faux)
  530:                             {
  531:                                 (*s_etat_processus).erreur_systeme = d_es;
  532:                                 (*s_etat_processus).erreur_execution =
  533:                                         d_ex_erreur_traitement_boucle;
  534:                                 return;
  535:                             }
  536: 
  537:                             if (((*s_etat_processus).s_liste_variables
  538:                                     [(*s_etat_processus)
  539:                                     .position_variable_courante]).objet == NULL)
  540:                             {
  541:                                 (*s_etat_processus).erreur_systeme = d_es;
  542:                                 (*s_etat_processus).erreur_execution =
  543:                                         d_ex_variable_partagee;
  544:                                 return;
  545:                             }
  546: 
  547:                             (*(*s_etat_processus).l_base_pile_systeme)
  548:                                     .indice_boucle = ((*s_etat_processus)
  549:                                     .s_liste_variables[(*s_etat_processus)
  550:                                     .position_variable_courante]).objet;
  551: 
  552:                             if (presence_compteur == d_vrai)
  553:                             {
  554:                                 (*s_etat_processus).niveau_courant--;
  555: 
  556:                                 if (retrait_variable_par_niveau(
  557:                                         s_etat_processus) == d_erreur)
  558:                                 {
  559:                                     return;
  560:                                 }
  561:                             }
  562:                         }
  563: 
  564:                         (*(*s_etat_processus).l_base_pile_systeme)
  565:                                 .indice_boucle = NULL;
  566: 
  567:                         depilement_pile_systeme(s_etat_processus);
  568:                     }
  569:                     else
  570:                     {
  571:                         depilement_pile_systeme(s_etat_processus);
  572: 
  573:                         if ((*s_etat_processus).erreur_systeme != d_es)
  574:                         {
  575:                             return;
  576:                         }
  577:                     }
  578:                 }
  579: 
  580:                 free(instruction_majuscule);
  581:             }
  582: 
  583:             free((*s_etat_processus).instruction_courante);
  584:         }
  585:     }
  586:     else
  587:     {
  588:         while(fin_boucle == d_faux)
  589:         {
  590:             if ((*s_etat_processus).expression_courante == NULL)
  591:             {
  592:                 (*s_etat_processus).expression_courante = tampon_expression;
  593: 
  594:                 (*s_etat_processus).erreur_execution =
  595:                         d_ex_erreur_traitement_boucle;
  596:                 return;
  597:             }
  598: 
  599:             (*s_etat_processus).expression_courante =
  600:                     (*(*s_etat_processus).expression_courante).suivant;
  601: 
  602:             if ((*s_etat_processus).expression_courante == NULL)
  603:             {
  604:                 (*s_etat_processus).expression_courante = tampon_expression;
  605: 
  606:                 (*s_etat_processus).erreur_execution =
  607:                         d_ex_erreur_traitement_boucle;
  608:                 return;
  609:             }
  610: 
  611:             fin_scrutation = d_faux;
  612: 
  613:             do
  614:             {
  615:                 while((*(*(*s_etat_processus).expression_courante)
  616:                         .donnee).type != FCT)
  617:                 {
  618:                     (*s_etat_processus).expression_courante =
  619:                             (*(*s_etat_processus).expression_courante).suivant;
  620: 
  621:                     if ((*s_etat_processus).expression_courante == NULL)
  622:                     {
  623:                         (*s_etat_processus).expression_courante =
  624:                                 tampon_expression;
  625: 
  626:                         (*s_etat_processus).erreur_execution =
  627:                                 d_ex_erreur_traitement_boucle;
  628:                         return;
  629:                     }
  630:                 }
  631: 
  632:                 if ((*((struct_fonction *) (*(*(*s_etat_processus)
  633:                         .expression_courante).donnee).objet))
  634:                         .nombre_arguments != 0)
  635:                 {
  636:                     (*s_etat_processus).expression_courante =
  637:                             (*(*s_etat_processus).expression_courante).suivant;
  638: 
  639:                     if ((*s_etat_processus).expression_courante == NULL)
  640:                     {
  641:                         (*s_etat_processus).expression_courante =
  642:                                 tampon_expression;
  643: 
  644:                         (*s_etat_processus).erreur_execution =
  645:                                 d_ex_erreur_traitement_boucle;
  646:                         return;
  647:                     }
  648:                 }
  649:                 else
  650:                 {
  651:                     fin_scrutation = d_vrai;
  652:                     tampon_expression = (*s_etat_processus).expression_courante;
  653:                 }
  654:             } while(fin_scrutation == d_faux);
  655: 
  656:             fonction = (*((struct_fonction *) (*(*(*s_etat_processus)
  657:                     .expression_courante).donnee).objet)).fonction;
  658: 
  659:             /*
  660:              * Traitement de la pile système par les différentes
  661:              * instructions.
  662:              */
  663: 
  664:             if ((fonction == instruction_if) ||
  665:                     (fonction == instruction_iferr) ||
  666:                     (fonction == instruction_do) ||
  667:                     (fonction == instruction_while) ||
  668:                     (fonction == instruction_for) ||
  669:                     (fonction == instruction_start) ||
  670:                     (fonction == instruction_select) ||
  671:                     (fonction == instruction_case) ||
  672:                     (fonction == instruction_vers_niveau_superieur))
  673:             {
  674:                 if (fonction == instruction_vers_niveau_superieur)
  675:                 {
  676:                     analyse(s_etat_processus,
  677:                             instruction_vers_niveau_superieur);
  678:                 }
  679:                 else if ((fonction == instruction_for) ||
  680:                         (fonction == instruction_start))
  681:                 {
  682:                     empilement_pile_systeme(s_etat_processus);
  683: 
  684:                     if ((*s_etat_processus).erreur_systeme != d_es)
  685:                     {
  686:                         return;
  687:                     }
  688: 
  689:                     (*(*s_etat_processus).l_base_pile_systeme)
  690:                             .type_cloture = 'L';
  691:                 }
  692:                 else
  693:                 {
  694:                     /*
  695:                      * Si on passe sur un début de boucle FOR ou START,
  696:                      * les champs de la pile système sont initialisés à
  697:                      * NULL, ce qui permet de les libérer de façon correcte
  698:                      * lors du dépilement.
  699:                      */
  700: 
  701:                     empilement_pile_systeme(s_etat_processus);
  702: 
  703:                     if ((*s_etat_processus).erreur_systeme != d_es)
  704:                     {
  705:                         return;
  706:                     }
  707:                 }
  708:             }
  709:             else if ((fonction == instruction_end) ||
  710:                     (fonction == instruction_next) ||
  711:                     (fonction == instruction_step) ||
  712:                     (fonction == instruction_vers_niveau_inferieur))
  713:             {
  714:                 if (fonction == instruction_vers_niveau_inferieur)
  715:                 {
  716:                     analyse(s_etat_processus,
  717:                             instruction_vers_niveau_inferieur);
  718: 
  719:                     fin_boucle = ((*(*s_etat_processus)
  720:                             .expression_courante).suivant == NULL)
  721:                             ? d_vrai : d_faux;
  722: 
  723:                     if (fin_boucle == d_faux)
  724:                     {
  725:                         if ((*s_etat_processus).niveau_courant ==
  726:                                 (*s_etat_processus).niveau_initial)
  727:                         {
  728:                             fin_boucle = d_vrai;
  729:                         }
  730:                     }
  731:                 }
  732:                 else if (((fonction == instruction_next) ||
  733:                         (fonction == instruction_step)) &&
  734:                         ((*(*s_etat_processus).l_base_pile_systeme)
  735:                         .type_cloture != 'L'))
  736:                 {
  737:                     /*
  738:                      * Libération des compteurs de boucle.
  739:                      */
  740: 
  741:                     presence_compteur = ((*(*s_etat_processus)
  742:                             .l_base_pile_systeme).type_cloture == 'F')
  743:                             ? d_vrai : d_faux;
  744: 
  745:                     if (((*(*s_etat_processus).l_base_pile_systeme)
  746:                             .type_cloture != 'S') &&
  747:                             (presence_compteur == d_faux))
  748:                     {
  749:                         (*s_etat_processus).erreur_execution =
  750:                                 d_ex_erreur_traitement_boucle;
  751:                         return;
  752:                     }
  753: 
  754:                     if (presence_compteur == d_vrai)
  755:                     {
  756:                         if (recherche_variable(s_etat_processus,
  757:                                 (*(*s_etat_processus).l_base_pile_systeme)
  758:                                 .nom_variable) == d_faux)
  759:                         {
  760:                             (*s_etat_processus).erreur_systeme = d_es;
  761:                             (*s_etat_processus).erreur_execution =
  762:                                     d_ex_erreur_traitement_boucle;
  763:                             return;
  764:                         }
  765: 
  766:                         if ((*s_etat_processus).s_liste_variables
  767:                                 [(*s_etat_processus).position_variable_courante]
  768:                                 .objet == NULL)
  769:                         {
  770:                             (*s_etat_processus).erreur_systeme = d_es;
  771:                             (*s_etat_processus).erreur_execution =
  772:                                     d_ex_variable_partagee;
  773:                             return;
  774:                         }
  775: 
  776:                         (*(*s_etat_processus).l_base_pile_systeme)
  777:                                 .indice_boucle = ((*s_etat_processus)
  778:                                 .s_liste_variables[(*s_etat_processus)
  779:                                 .position_variable_courante]).objet;
  780: 
  781:                         if (presence_compteur == d_vrai)
  782:                         {
  783:                             (*s_etat_processus).niveau_courant--;
  784: 
  785:                             if (retrait_variable_par_niveau(s_etat_processus)
  786:                                     == d_erreur)
  787:                             {
  788:                                 return;
  789:                             }
  790:                         }
  791:                     }
  792: 
  793:                     (*(*s_etat_processus).l_base_pile_systeme)
  794:                             .indice_boucle = NULL;
  795: 
  796:                     depilement_pile_systeme(s_etat_processus);
  797:                 }
  798:                 else
  799:                 {
  800:                     depilement_pile_systeme(s_etat_processus);
  801: 
  802:                     if ((*s_etat_processus).erreur_systeme != d_es)
  803:                     {
  804:                         return;
  805:                     }
  806:                 }
  807:             }
  808:         }
  809:     }
  810: 
  811:     if ((*s_etat_processus).mode_execution_programme != 'Y')
  812:     {
  813:         if ((*s_etat_processus).expression_courante == NULL)
  814:         {
  815:             (*s_etat_processus).expression_courante = tampon_expression;
  816: 
  817:             (*s_etat_processus).erreur_execution =
  818:                     d_ex_erreur_traitement_boucle;
  819:             return;
  820:         }
  821: 
  822:         (*s_etat_processus).expression_courante =
  823:                 (*(*s_etat_processus).expression_courante).suivant;
  824:     }
  825:     
  826:     (*s_etat_processus).instruction_courante = tampon;
  827:     (*s_etat_processus).expression_courante = tampon_expression;
  828: 
  829:     return;
  830: }
  831: 
  832: 
  833: /*
  834: ================================================================================
  835:   Fonction 'rdm'
  836: ================================================================================
  837:   Entrées : pointeur sur une structure struct_processus
  838: --------------------------------------------------------------------------------
  839:   Sorties :
  840: --------------------------------------------------------------------------------
  841:   Effets de bord : néant
  842: ================================================================================
  843: */
  844: 
  845: void
  846: instruction_rdm(struct_processus *s_etat_processus)
  847: {
  848:     struct_liste_chainee            *l_element_courant;
  849: 
  850:     struct_objet                    *s_objet_dimensions;
  851:     struct_objet                    *s_objet_initial;
  852:     struct_objet                    *s_objet_redimensionne;
  853: 
  854:     logical1                        argument_nom;
  855:     logical1                        drapeau_fin_objet_originel;
  856:     logical1                        variable_partagee;
  857: 
  858:     unsigned long                   i;
  859:     unsigned long                   j;
  860:     unsigned long                   k;
  861:     unsigned long                   l;
  862:     unsigned long                   nombre_colonnes;
  863:     unsigned long                   nombre_dimensions;
  864:     unsigned long                   nombre_lignes;
  865: 
  866:     (*s_etat_processus).erreur_execution = d_ex;
  867: 
  868:     if ((*s_etat_processus).affichage_arguments == 'Y')
  869:     {
  870:         printf("\n  RDM ");
  871: 
  872:         if ((*s_etat_processus).langue == 'F')
  873:         {
  874:             printf("(redimensionnement)\n\n");
  875:         }
  876:         else
  877:         {
  878:             printf("(resizing)\n\n");
  879:         }
  880: 
  881:         printf("    2: %s, %s, %s, %s, %s, %s, %s\n", d_NOM,
  882:                 d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX);
  883:         printf("    1: %s\n", d_LST);
  884:         printf("->  1: %s, %s, %s, %s, %s, %s\n",
  885:                 d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX);
  886:         return;
  887:     }
  888:     else if ((*s_etat_processus).test_instruction == 'Y')
  889:     {
  890:         (*s_etat_processus).nombre_arguments = -1;
  891:         return;
  892:     }
  893:     
  894:     if (test_cfsf(s_etat_processus, 31) == d_vrai)
  895:     {
  896:         if (empilement_pile_last(s_etat_processus, 2) == d_erreur)
  897:         {
  898:             return;
  899:         }
  900:     }
  901: 
  902:     if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
  903:             &s_objet_dimensions) == d_erreur)
  904:     {
  905:         (*s_etat_processus).erreur_execution = d_ex_manque_argument;
  906:         return;
  907:     }
  908: 
  909:     if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
  910:             &s_objet_initial) == d_erreur)
  911:     {
  912:         liberation(s_etat_processus, s_objet_dimensions);
  913: 
  914:         (*s_etat_processus).erreur_execution = d_ex_manque_argument;
  915:         return;
  916:     }
  917: 
  918:     variable_partagee = d_faux;
  919: 
  920:     if ((*s_objet_initial).type == NOM)
  921:     {
  922:         argument_nom = d_vrai;
  923: 
  924:         if (recherche_variable(s_etat_processus, (*((struct_nom *)
  925:                 (*s_objet_initial).objet)).nom) == d_faux)
  926:         {
  927:             (*s_etat_processus).erreur_systeme = d_es;
  928:             (*s_etat_processus).erreur_execution = d_ex_variable_non_definie;
  929: 
  930:             liberation(s_etat_processus, s_objet_initial);
  931:             liberation(s_etat_processus, s_objet_dimensions);
  932: 
  933:             return;
  934:         }
  935: 
  936:         liberation(s_etat_processus, s_objet_initial);
  937: 
  938:         if ((*s_etat_processus).s_liste_variables[(*s_etat_processus)
  939:                 .position_variable_courante].variable_verrouillee == d_vrai)
  940:         {
  941:             (*s_etat_processus).erreur_execution = d_ex_variable_verrouillee;
  942: 
  943:             liberation(s_etat_processus, s_objet_dimensions);
  944:             return;
  945:         }
  946: 
  947:         s_objet_initial = (*s_etat_processus).s_liste_variables
  948:                 [(*s_etat_processus).position_variable_courante].objet;
  949: 
  950:         if (s_objet_initial == NULL)
  951:         {
  952:             if (pthread_mutex_lock(&((*(*s_etat_processus)
  953:                     .s_liste_variables_partagees).mutex)) != 0)
  954:             {
  955:                 (*s_etat_processus).erreur_systeme = d_es_processus;
  956:                 return;
  957:             }
  958: 
  959:             if (recherche_variable_partagee(s_etat_processus,
  960:                     (*s_etat_processus).s_liste_variables
  961:                     [(*s_etat_processus).position_variable_courante].nom,
  962:                     (*s_etat_processus).s_liste_variables
  963:                     [(*s_etat_processus).position_variable_courante]
  964:                     .variable_partagee, (*s_etat_processus).s_liste_variables
  965:                     [(*s_etat_processus).position_variable_courante].origine)
  966:                     == d_faux)
  967:             {
  968:                 if (pthread_mutex_unlock(&((*(*s_etat_processus)
  969:                         .s_liste_variables_partagees).mutex)) != 0)
  970:                 {
  971:                     (*s_etat_processus).erreur_systeme = d_es_processus;
  972:                     return;
  973:                 }
  974: 
  975:                 (*s_etat_processus).erreur_systeme = d_es;
  976:                 (*s_etat_processus).erreur_execution =
  977:                         d_ex_variable_non_definie;
  978: 
  979:                 liberation(s_etat_processus, s_objet_dimensions);
  980: 
  981:                 return;
  982:             }
  983: 
  984:             variable_partagee = d_vrai;
  985:         }
  986:     }
  987:     else
  988:     {
  989:         argument_nom = d_faux;
  990:     }
  991: 
  992:     if ((*s_objet_dimensions).type != LST)
  993:     {
  994:         if (variable_partagee == d_vrai)
  995:         {
  996:             if (pthread_mutex_unlock(&((*(*s_etat_processus)
  997:                     .s_liste_variables_partagees).mutex)) != 0)
  998:             {
  999:                 (*s_etat_processus).erreur_systeme = d_es_processus;
 1000:                 return;
 1001:             }
 1002:         }
 1003: 
 1004:         liberation(s_etat_processus, s_objet_dimensions);
 1005: 
 1006:         if (argument_nom == d_faux)
 1007:         {
 1008:             liberation(s_etat_processus, s_objet_initial);
 1009:         }
 1010: 
 1011:         (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
 1012:         return;
 1013:     }
 1014: 
 1015:     l_element_courant = (*s_objet_dimensions).objet;
 1016:     nombre_dimensions = 0;
 1017: 
 1018:     while(l_element_courant != NULL)
 1019:     {
 1020:         nombre_dimensions++;
 1021:         l_element_courant = (*l_element_courant).suivant;
 1022:     }
 1023: 
 1024:     if ((nombre_dimensions != 1) && (nombre_dimensions != 2))
 1025:     {
 1026:         if (variable_partagee == d_vrai)
 1027:         {
 1028:             if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1029:                     .s_liste_variables_partagees).mutex)) != 0)
 1030:             {
 1031:                 (*s_etat_processus).erreur_systeme = d_es_processus;
 1032:                 return;
 1033:             }
 1034:         }
 1035: 
 1036:         liberation(s_etat_processus, s_objet_dimensions);
 1037: 
 1038:         if (argument_nom == d_faux)
 1039:         {
 1040:             liberation(s_etat_processus, s_objet_initial);
 1041:         }
 1042: 
 1043:         (*s_etat_processus).erreur_execution = d_ex_dimensions_invalides;
 1044:         return;
 1045:     }
 1046: 
 1047:     nombre_colonnes = 0;
 1048:     nombre_lignes = 0;
 1049: 
 1050:     l_element_courant = (*s_objet_dimensions).objet;
 1051: 
 1052:     while(l_element_courant != NULL)
 1053:     {
 1054:         if ((*(*l_element_courant).donnee).type != INT)
 1055:         {
 1056:             if (variable_partagee == d_vrai)
 1057:             {
 1058:                 if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1059:                         .s_liste_variables_partagees).mutex)) != 0)
 1060:                 {
 1061:                     (*s_etat_processus).erreur_systeme = d_es_processus;
 1062:                     return;
 1063:                 }
 1064:             }
 1065: 
 1066:             liberation(s_etat_processus, s_objet_dimensions);
 1067: 
 1068:             if (argument_nom == d_faux)
 1069:             {
 1070:                 liberation(s_etat_processus, s_objet_initial);
 1071:             }
 1072: 
 1073:             (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
 1074:             return;
 1075:         }
 1076: 
 1077:         if ((*((integer8 *) (*(*l_element_courant).donnee).objet)) <= 0)
 1078:         {
 1079:             if (variable_partagee == d_vrai)
 1080:             {
 1081:                 if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1082:                         .s_liste_variables_partagees).mutex)) != 0)
 1083:                 {
 1084:                     (*s_etat_processus).erreur_systeme = d_es_processus;
 1085:                     return;
 1086:                 }
 1087:             }
 1088: 
 1089:             liberation(s_etat_processus, s_objet_dimensions);
 1090: 
 1091:             if (argument_nom == d_faux)
 1092:             {
 1093:                 liberation(s_etat_processus, s_objet_initial);
 1094:             }
 1095: 
 1096:             (*s_etat_processus).erreur_execution = d_ex_argument_invalide;
 1097:             return;
 1098:         }
 1099: 
 1100:         if (nombre_lignes == 0)
 1101:         {
 1102:             nombre_lignes = (*((integer8 *)
 1103:                     (*(*l_element_courant).donnee).objet));
 1104:         }
 1105:         else
 1106:         {
 1107:             nombre_colonnes = (*((integer8 *)
 1108:                     (*(*l_element_courant).donnee).objet));
 1109:         }
 1110: 
 1111:         l_element_courant = (*l_element_courant).suivant;
 1112:     }
 1113: 
 1114:     if ((s_objet_redimensionne = allocation(s_etat_processus, NON)) == NULL)
 1115:     {
 1116:         if (variable_partagee == d_vrai)
 1117:         {
 1118:             if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1119:                     .s_liste_variables_partagees).mutex)) != 0)
 1120:             {
 1121:                 (*s_etat_processus).erreur_systeme = d_es_processus;
 1122:                 return;
 1123:             }
 1124:         }
 1125: 
 1126:         (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1127:         return;
 1128:     }
 1129: 
 1130: /*
 1131: --------------------------------------------------------------------------------
 1132:   Redimensionnement aboutissant à un vecteur
 1133: --------------------------------------------------------------------------------
 1134: */
 1135: 
 1136:     if (nombre_dimensions == 1)
 1137:     {
 1138:         if ((*s_objet_initial).type == VIN)
 1139:         {
 1140:             (*s_objet_redimensionne).type = VIN;
 1141: 
 1142:             if (((*s_objet_redimensionne).objet =
 1143:                     malloc(sizeof(struct_vecteur))) == NULL)
 1144:             {
 1145:                 if (variable_partagee == d_vrai)
 1146:                 {
 1147:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1148:                             .s_liste_variables_partagees).mutex)) != 0)
 1149:                     {
 1150:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1151:                         return;
 1152:                     }
 1153:                 }
 1154: 
 1155:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1156:                 return;
 1157:             }
 1158: 
 1159:             (*((struct_vecteur *) (*s_objet_redimensionne).objet)).type = 'I';
 1160:             (*((struct_vecteur *) (*s_objet_redimensionne).objet)).taille =
 1161:                     nombre_lignes;
 1162: 
 1163:             if (((*((struct_vecteur *) (*s_objet_redimensionne).objet)).tableau
 1164:                     = malloc(nombre_lignes * sizeof(integer8))) == NULL)
 1165:             {
 1166:                 if (variable_partagee == d_vrai)
 1167:                 {
 1168:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1169:                             .s_liste_variables_partagees).mutex)) != 0)
 1170:                     {
 1171:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1172:                         return;
 1173:                     }
 1174:                 }
 1175: 
 1176:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1177:                 return;
 1178:             }
 1179: 
 1180:             for(i = 0; i < nombre_lignes; i++)
 1181:             {
 1182:                 if (i < (*((struct_vecteur *) (*s_objet_initial).objet)).taille)
 1183:                 {
 1184:                     ((integer8 *) (*((struct_vecteur *)
 1185:                             (*s_objet_redimensionne).objet)).tableau)[i] =
 1186:                             ((integer8 *) (*((struct_vecteur *)
 1187:                             (*s_objet_initial).objet)).tableau)[i];
 1188:                 }
 1189:                 else
 1190:                 {
 1191:                     ((integer8 *) (*((struct_vecteur *)
 1192:                             (*s_objet_redimensionne).objet)).tableau)[i] = 0;
 1193:                 }
 1194:             }
 1195:         }
 1196:         else if ((*s_objet_initial).type == VRL)
 1197:         {
 1198:             (*s_objet_redimensionne).type = VRL;
 1199: 
 1200:             if (((*s_objet_redimensionne).objet =
 1201:                     malloc(sizeof(struct_vecteur))) == NULL)
 1202:             {
 1203:                 if (variable_partagee == d_vrai)
 1204:                 {
 1205:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1206:                             .s_liste_variables_partagees).mutex)) != 0)
 1207:                     {
 1208:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1209:                         return;
 1210:                     }
 1211:                 }
 1212: 
 1213:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1214:                 return;
 1215:             }
 1216: 
 1217:             (*((struct_vecteur *) (*s_objet_redimensionne).objet)).type = 'R';
 1218:             (*((struct_vecteur *) (*s_objet_redimensionne).objet)).taille =
 1219:                     nombre_lignes;
 1220: 
 1221:             if (((*((struct_vecteur *) (*s_objet_redimensionne).objet)).tableau
 1222:                     = malloc(nombre_lignes * sizeof(real8))) == NULL)
 1223:             {
 1224:                 if (variable_partagee == d_vrai)
 1225:                 {
 1226:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1227:                             .s_liste_variables_partagees).mutex)) != 0)
 1228:                     {
 1229:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1230:                         return;
 1231:                     }
 1232:                 }
 1233: 
 1234:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1235:                 return;
 1236:             }
 1237: 
 1238:             for(i = 0; i < nombre_lignes; i++)
 1239:             {
 1240:                 if (i < (*((struct_vecteur *) (*s_objet_initial).objet)).taille)
 1241:                 {
 1242:                     ((real8 *) (*((struct_vecteur *)
 1243:                             (*s_objet_redimensionne).objet)).tableau)[i] =
 1244:                             ((real8 *) (*((struct_vecteur *)
 1245:                             (*s_objet_initial).objet)).tableau)[i];
 1246:                 }
 1247:                 else
 1248:                 {
 1249:                     ((real8 *) (*((struct_vecteur *)
 1250:                             (*s_objet_redimensionne).objet)).tableau)[i] =
 1251:                             (real8) 0;
 1252:                 }
 1253:             }
 1254:         }
 1255:         else if ((*s_objet_initial).type == VCX)
 1256:         {
 1257:             (*s_objet_redimensionne).type = VCX;
 1258: 
 1259:             if (((*s_objet_redimensionne).objet =
 1260:                     malloc(sizeof(struct_vecteur))) == NULL)
 1261:             {
 1262:                 if (variable_partagee == d_vrai)
 1263:                 {
 1264:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1265:                             .s_liste_variables_partagees).mutex)) != 0)
 1266:                     {
 1267:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1268:                         return;
 1269:                     }
 1270:                 }
 1271: 
 1272:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1273:                 return;
 1274:             }
 1275: 
 1276:             (*((struct_vecteur *) (*s_objet_redimensionne).objet)).type = 'C';
 1277:             (*((struct_vecteur *) (*s_objet_redimensionne).objet)).taille =
 1278:                     nombre_lignes;
 1279: 
 1280:             if (((*((struct_vecteur *) (*s_objet_redimensionne).objet)).tableau
 1281:                     = malloc(nombre_lignes * sizeof(struct_complexe16)))
 1282:                     == NULL)
 1283:             {
 1284:                 if (variable_partagee == d_vrai)
 1285:                 {
 1286:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1287:                             .s_liste_variables_partagees).mutex)) != 0)
 1288:                     {
 1289:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1290:                         return;
 1291:                     }
 1292:                 }
 1293: 
 1294:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1295:                 return;
 1296:             }
 1297: 
 1298:             for(i = 0; i < nombre_lignes; i++)
 1299:             {
 1300:                 if (i < (*((struct_vecteur *) (*s_objet_initial).objet)).taille)
 1301:                 {
 1302:                     ((struct_complexe16 *) (*((struct_vecteur *)
 1303:                             (*s_objet_redimensionne).objet)).tableau)[i]
 1304:                             .partie_reelle = ((struct_complexe16 *)
 1305:                             (*((struct_vecteur *) (*s_objet_initial).objet))
 1306:                             .tableau)[i].partie_reelle;
 1307:                     ((struct_complexe16 *) (*((struct_vecteur *)
 1308:                             (*s_objet_redimensionne).objet)).tableau)[i]
 1309:                             .partie_imaginaire = ((struct_complexe16 *)
 1310:                             (*((struct_vecteur *) (*s_objet_initial).objet))
 1311:                             .tableau)[i].partie_imaginaire;
 1312:                 }
 1313:                 else
 1314:                 {
 1315:                     ((struct_complexe16 *) (*((struct_vecteur *)
 1316:                             (*s_objet_redimensionne).objet)).tableau)[i]
 1317:                             .partie_reelle = (real8) 0;
 1318:                     ((struct_complexe16 *) (*((struct_vecteur *)
 1319:                             (*s_objet_redimensionne).objet)).tableau)[i]
 1320:                             .partie_imaginaire = (real8) 0;
 1321:                 }
 1322:             }
 1323:         }
 1324:         else if ((*s_objet_initial).type == MIN)
 1325:         {
 1326:             (*s_objet_redimensionne).type = VIN;
 1327: 
 1328:             if (((*s_objet_redimensionne).objet =
 1329:                     malloc(sizeof(struct_vecteur))) == NULL)
 1330:             {
 1331:                 if (variable_partagee == d_vrai)
 1332:                 {
 1333:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1334:                             .s_liste_variables_partagees).mutex)) != 0)
 1335:                     {
 1336:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1337:                         return;
 1338:                     }
 1339:                 }
 1340: 
 1341:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1342:                 return;
 1343:             }
 1344: 
 1345:             (*((struct_vecteur *) (*s_objet_redimensionne).objet)).type = 'I';
 1346:             (*((struct_vecteur *) (*s_objet_redimensionne).objet)).taille =
 1347:                     nombre_lignes;
 1348: 
 1349:             if (((*((struct_vecteur *) (*s_objet_redimensionne).objet)).tableau
 1350:                     = malloc(nombre_lignes * sizeof(integer8))) == NULL)
 1351:             {
 1352:                 if (variable_partagee == d_vrai)
 1353:                 {
 1354:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1355:                             .s_liste_variables_partagees).mutex)) != 0)
 1356:                     {
 1357:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1358:                         return;
 1359:                     }
 1360:                 }
 1361: 
 1362:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1363:                 return;
 1364:             }
 1365: 
 1366:             drapeau_fin_objet_originel = d_faux;
 1367:             for(i = 0, j = 0, k = 0; i < nombre_lignes; i++)
 1368:             {
 1369:                 if (drapeau_fin_objet_originel == d_faux)
 1370:                 {
 1371:                     ((integer8 *) (*((struct_vecteur *)
 1372:                             (*s_objet_redimensionne).objet)).tableau)[i] =
 1373:                             ((integer8 **) (*((struct_matrice *)
 1374:                             (*s_objet_initial).objet)).tableau)[j][k];
 1375: 
 1376:                     if ((++k) >= (*((struct_matrice *) (*s_objet_initial)
 1377:                             .objet)).nombre_colonnes)
 1378:                     {
 1379:                         k = 0;
 1380: 
 1381:                         if ((++j) >= (*((struct_matrice *) (*s_objet_initial)
 1382:                                 .objet)).nombre_lignes)
 1383:                         {
 1384:                             drapeau_fin_objet_originel = d_vrai;
 1385:                         }
 1386:                     }
 1387:                 }
 1388:                 else
 1389:                 {
 1390:                     ((integer8 *) (*((struct_vecteur *)
 1391:                             (*s_objet_redimensionne).objet)).tableau)[i] = 0;
 1392:                 }
 1393:             }
 1394:         }
 1395:         else if ((*s_objet_initial).type == MRL)
 1396:         {
 1397:             (*s_objet_redimensionne).type = VRL;
 1398: 
 1399:             if (((*s_objet_redimensionne).objet =
 1400:                     malloc(sizeof(struct_vecteur))) == NULL)
 1401:             {
 1402:                 if (variable_partagee == d_vrai)
 1403:                 {
 1404:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1405:                             .s_liste_variables_partagees).mutex)) != 0)
 1406:                     {
 1407:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1408:                         return;
 1409:                     }
 1410:                 }
 1411: 
 1412:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1413:                 return;
 1414:             }
 1415: 
 1416:             (*((struct_vecteur *) (*s_objet_redimensionne).objet)).type = 'R';
 1417:             (*((struct_vecteur *) (*s_objet_redimensionne).objet)).taille =
 1418:                     nombre_lignes;
 1419: 
 1420:             if (((*((struct_vecteur *) (*s_objet_redimensionne).objet)).tableau
 1421:                     = malloc(nombre_lignes * sizeof(real8))) == NULL)
 1422:             {
 1423:                 if (variable_partagee == d_vrai)
 1424:                 {
 1425:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1426:                             .s_liste_variables_partagees).mutex)) != 0)
 1427:                     {
 1428:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1429:                         return;
 1430:                     }
 1431:                 }
 1432: 
 1433:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1434:                 return;
 1435:             }
 1436: 
 1437:             drapeau_fin_objet_originel = d_faux;
 1438:             for(i = 0, j = 0, k = 0; i < nombre_lignes; i++)
 1439:             {
 1440:                 if (drapeau_fin_objet_originel == d_faux)
 1441:                 {
 1442:                     ((real8 *) (*((struct_vecteur *)
 1443:                             (*s_objet_redimensionne).objet)).tableau)[i] =
 1444:                             ((real8 **) (*((struct_matrice *)
 1445:                             (*s_objet_initial).objet)).tableau)[j][k];
 1446: 
 1447:                     if ((++k) >= (*((struct_matrice *) (*s_objet_initial)
 1448:                             .objet)).nombre_colonnes)
 1449:                     {
 1450:                         k = 0;
 1451: 
 1452:                         if ((++j) >= (*((struct_matrice *) (*s_objet_initial)
 1453:                                 .objet)).nombre_lignes)
 1454:                         {
 1455:                             drapeau_fin_objet_originel = d_vrai;
 1456:                         }
 1457:                     }
 1458:                 }
 1459:                 else
 1460:                 {
 1461:                     ((real8 *) (*((struct_vecteur *)
 1462:                             (*s_objet_redimensionne).objet)).tableau)[i] =
 1463:                             (real8) 0;
 1464:                 }
 1465:             }
 1466:         }
 1467:         else if ((*s_objet_initial).type == MCX)
 1468:         {
 1469:             (*s_objet_redimensionne).type = VCX;
 1470: 
 1471:             if (((*s_objet_redimensionne).objet =
 1472:                     malloc(sizeof(struct_vecteur))) == NULL)
 1473:             {
 1474:                 if (variable_partagee == d_vrai)
 1475:                 {
 1476:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1477:                             .s_liste_variables_partagees).mutex)) != 0)
 1478:                     {
 1479:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1480:                         return;
 1481:                     }
 1482:                 }
 1483: 
 1484:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1485:                 return;
 1486:             }
 1487: 
 1488:             (*((struct_vecteur *) (*s_objet_redimensionne).objet)).type = 'C';
 1489:             (*((struct_vecteur *) (*s_objet_redimensionne).objet)).taille =
 1490:                     nombre_lignes;
 1491: 
 1492:             if (((*((struct_vecteur *) (*s_objet_redimensionne).objet)).tableau
 1493:                     = malloc(nombre_lignes * sizeof(struct_complexe16)))
 1494:                     == NULL)
 1495:             {
 1496:                 if (variable_partagee == d_vrai)
 1497:                 {
 1498:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1499:                             .s_liste_variables_partagees).mutex)) != 0)
 1500:                     {
 1501:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1502:                         return;
 1503:                     }
 1504:                 }
 1505: 
 1506:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1507:                 return;
 1508:             }
 1509: 
 1510:             drapeau_fin_objet_originel = d_faux;
 1511:             for(i = 0, j = 0, k = 0; i < nombre_lignes; i++)
 1512:             {
 1513:                 if (drapeau_fin_objet_originel == d_faux)
 1514:                 {
 1515:                     ((struct_complexe16 *) (*((struct_vecteur *)
 1516:                             (*s_objet_redimensionne).objet)).tableau)[i]
 1517:                             .partie_reelle = ((struct_complexe16 **)
 1518:                             (*((struct_matrice *) (*s_objet_initial).objet))
 1519:                             .tableau)[j][k].partie_reelle;
 1520:                     ((struct_complexe16 *) (*((struct_vecteur *)
 1521:                             (*s_objet_redimensionne).objet)).tableau)[i]
 1522:                             .partie_imaginaire = ((struct_complexe16 **)
 1523:                             (*((struct_matrice *) (*s_objet_initial).objet))
 1524:                             .tableau)[j][k].partie_imaginaire;
 1525: 
 1526:                     if ((++k) >= (*((struct_matrice *) (*s_objet_initial)
 1527:                             .objet)).nombre_colonnes)
 1528:                     {
 1529:                         k = 0;
 1530: 
 1531:                         if ((++j) >= (*((struct_matrice *) (*s_objet_initial)
 1532:                                 .objet)).nombre_lignes)
 1533:                         {
 1534:                             drapeau_fin_objet_originel = d_vrai;
 1535:                         }
 1536:                     }
 1537:                 }
 1538:                 else
 1539:                 {
 1540:                     ((struct_complexe16 *) (*((struct_vecteur *)
 1541:                             (*s_objet_redimensionne).objet)).tableau)[i]
 1542:                             .partie_reelle = 0;
 1543:                     ((struct_complexe16 *) (*((struct_vecteur *)
 1544:                             (*s_objet_redimensionne).objet)).tableau)[i]
 1545:                             .partie_imaginaire = 0;
 1546:                 }
 1547:             }
 1548:         }
 1549:         else
 1550:         {
 1551:             if (variable_partagee == d_vrai)
 1552:             {
 1553:                 if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1554:                         .s_liste_variables_partagees).mutex)) != 0)
 1555:                 {
 1556:                     (*s_etat_processus).erreur_systeme = d_es_processus;
 1557:                     return;
 1558:                 }
 1559:             }
 1560: 
 1561:             if (argument_nom == d_faux)
 1562:             {
 1563:                 liberation(s_etat_processus, s_objet_initial);
 1564:             }
 1565: 
 1566:             liberation(s_etat_processus, s_objet_dimensions);
 1567:             free(s_objet_redimensionne);
 1568: 
 1569:             (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
 1570:             return;
 1571:         }
 1572:     }
 1573: 
 1574: /*
 1575: --------------------------------------------------------------------------------
 1576:   Redimensionnement aboutissant à une matrice
 1577: --------------------------------------------------------------------------------
 1578: */
 1579: 
 1580:     else
 1581:     {
 1582:         if ((*s_objet_initial).type == VIN)
 1583:         {
 1584:             (*s_objet_redimensionne).type = MIN;
 1585: 
 1586:             if (((*s_objet_redimensionne).objet =
 1587:                     malloc(sizeof(struct_matrice))) == NULL)
 1588:             {
 1589:                 if (variable_partagee == d_vrai)
 1590:                 {
 1591:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1592:                             .s_liste_variables_partagees).mutex)) != 0)
 1593:                     {
 1594:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1595:                         return;
 1596:                     }
 1597:                 }
 1598: 
 1599:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1600:                 return;
 1601:             }
 1602: 
 1603:             (*((struct_matrice *) (*s_objet_redimensionne).objet)).type = 'I';
 1604:             (*((struct_matrice *) (*s_objet_redimensionne).objet))
 1605:                     .nombre_lignes = nombre_lignes;
 1606:             (*((struct_matrice *) (*s_objet_redimensionne).objet))
 1607:                     .nombre_colonnes = nombre_colonnes;
 1608: 
 1609:             if (((*((struct_matrice *) (*s_objet_redimensionne).objet)).tableau
 1610:                     = malloc(nombre_lignes * sizeof(integer8 *)))
 1611:                     == NULL)
 1612:             {
 1613:                 if (variable_partagee == d_vrai)
 1614:                 {
 1615:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1616:                             .s_liste_variables_partagees).mutex)) != 0)
 1617:                     {
 1618:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1619:                         return;
 1620:                     }
 1621:                 }
 1622: 
 1623:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1624:                 return;
 1625:             }
 1626: 
 1627:             for(i = 0, k = 0; i < nombre_lignes; i++)
 1628:             {
 1629:                 if ((((integer8 **) (*((struct_matrice *)
 1630:                         (*s_objet_redimensionne).objet)).tableau)[i] =
 1631:                         malloc(nombre_colonnes * sizeof(integer8))) == NULL)
 1632:                 {
 1633:                     if (variable_partagee == d_vrai)
 1634:                     {
 1635:                         if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1636:                                 .s_liste_variables_partagees).mutex)) != 0)
 1637:                         {
 1638:                             (*s_etat_processus).erreur_systeme = d_es_processus;
 1639:                             return;
 1640:                         }
 1641:                     }
 1642: 
 1643:                     (*s_etat_processus).erreur_systeme =
 1644:                             d_es_allocation_memoire;
 1645:                     return;
 1646:                 }
 1647: 
 1648:                 for(j = 0; j < nombre_colonnes; j++)
 1649:                 {
 1650:                     if (k < (*((struct_vecteur *) (*s_objet_initial)
 1651:                             .objet)).taille)
 1652:                     {
 1653:                         ((integer8 **) (*((struct_matrice *)
 1654:                                 (*s_objet_redimensionne).objet)).tableau)
 1655:                                 [i][j] = ((integer8 *) (*((struct_vecteur *)
 1656:                                 (*s_objet_initial).objet)).tableau)[k++];
 1657:                     }
 1658:                     else
 1659:                     {
 1660:                         ((integer8 **) (*((struct_matrice *)
 1661:                                 (*s_objet_redimensionne).objet)).tableau)
 1662:                                 [i][j] = 0;
 1663:                     }
 1664:                 }
 1665:             }
 1666:         }
 1667:         else if ((*s_objet_initial).type == VRL)
 1668:         {
 1669:             (*s_objet_redimensionne).type = MRL;
 1670: 
 1671:             if (((*s_objet_redimensionne).objet =
 1672:                     malloc(sizeof(struct_matrice))) == NULL)
 1673:             {
 1674:                 if (variable_partagee == d_vrai)
 1675:                 {
 1676:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1677:                             .s_liste_variables_partagees).mutex)) != 0)
 1678:                     {
 1679:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1680:                         return;
 1681:                     }
 1682:                 }
 1683: 
 1684:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1685:                 return;
 1686:             }
 1687: 
 1688:             (*((struct_matrice *) (*s_objet_redimensionne).objet)).type = 'R';
 1689:             (*((struct_matrice *) (*s_objet_redimensionne).objet))
 1690:                     .nombre_lignes = nombre_lignes;
 1691:             (*((struct_matrice *) (*s_objet_redimensionne).objet))
 1692:                     .nombre_colonnes = nombre_colonnes;
 1693: 
 1694:             if (((*((struct_matrice *) (*s_objet_redimensionne).objet)).tableau
 1695:                     = malloc(nombre_lignes * sizeof(real8 *)))
 1696:                     == NULL)
 1697:             {
 1698:                 if (variable_partagee == d_vrai)
 1699:                 {
 1700:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1701:                             .s_liste_variables_partagees).mutex)) != 0)
 1702:                     {
 1703:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1704:                         return;
 1705:                     }
 1706:                 }
 1707: 
 1708:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1709:                 return;
 1710:             }
 1711: 
 1712:             for(i = 0, k = 0; i < nombre_lignes; i++)
 1713:             {
 1714:                 if ((((real8 **) (*((struct_matrice *)
 1715:                         (*s_objet_redimensionne).objet)).tableau)[i] =
 1716:                         malloc(nombre_colonnes * sizeof(real8))) == NULL)
 1717:                 {
 1718:                     if (variable_partagee == d_vrai)
 1719:                     {
 1720:                         if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1721:                                 .s_liste_variables_partagees).mutex)) != 0)
 1722:                         {
 1723:                             (*s_etat_processus).erreur_systeme = d_es_processus;
 1724:                             return;
 1725:                         }
 1726:                     }
 1727: 
 1728:                     (*s_etat_processus).erreur_systeme =
 1729:                             d_es_allocation_memoire;
 1730:                     return;
 1731:                 }
 1732: 
 1733:                 for(j = 0; j < nombre_colonnes; j++)
 1734:                 {
 1735:                     if (k < (*((struct_vecteur *) (*s_objet_initial)
 1736:                             .objet)).taille)
 1737:                     {
 1738:                         ((real8 **) (*((struct_matrice *)
 1739:                                 (*s_objet_redimensionne).objet)).tableau)
 1740:                                 [i][j] = ((real8 *) (*((struct_vecteur *)
 1741:                                 (*s_objet_initial).objet)).tableau)[k++];
 1742:                     }
 1743:                     else
 1744:                     {
 1745:                         ((real8 **) (*((struct_matrice *)
 1746:                                 (*s_objet_redimensionne).objet)).tableau)
 1747:                                 [i][j] = (real8) 0;
 1748:                     }
 1749:                 }
 1750:             }
 1751:         }
 1752:         else if ((*s_objet_initial).type == VCX)
 1753:         {
 1754:             (*s_objet_redimensionne).type = MCX;
 1755: 
 1756:             if (((*s_objet_redimensionne).objet =
 1757:                     malloc(sizeof(struct_matrice))) == NULL)
 1758:             {
 1759:                 if (variable_partagee == d_vrai)
 1760:                 {
 1761:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1762:                             .s_liste_variables_partagees).mutex)) != 0)
 1763:                     {
 1764:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1765:                         return;
 1766:                     }
 1767:                 }
 1768: 
 1769:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1770:                 return;
 1771:             }
 1772: 
 1773:             (*((struct_matrice *) (*s_objet_redimensionne).objet)).type = 'C';
 1774:             (*((struct_matrice *) (*s_objet_redimensionne).objet))
 1775:                     .nombre_lignes = nombre_lignes;
 1776:             (*((struct_matrice *) (*s_objet_redimensionne).objet))
 1777:                     .nombre_colonnes = nombre_colonnes;
 1778: 
 1779:             if (((*((struct_matrice *) (*s_objet_redimensionne).objet)).tableau
 1780:                     = malloc(nombre_lignes * sizeof(struct_complexe16 *)))
 1781:                     == NULL)
 1782:             {
 1783:                 if (variable_partagee == d_vrai)
 1784:                 {
 1785:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1786:                             .s_liste_variables_partagees).mutex)) != 0)
 1787:                     {
 1788:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1789:                         return;
 1790:                     }
 1791:                 }
 1792: 
 1793:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1794:                 return;
 1795:             }
 1796: 
 1797:             for(i = 0, k = 0; i < nombre_lignes; i++)
 1798:             {
 1799:                 if ((((struct_complexe16 **) (*((struct_matrice *)
 1800:                         (*s_objet_redimensionne).objet)).tableau)[i] =
 1801:                         malloc(nombre_colonnes *
 1802:                         sizeof(struct_complexe16))) == NULL)
 1803:                 {
 1804:                     if (variable_partagee == d_vrai)
 1805:                     {
 1806:                         if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1807:                                 .s_liste_variables_partagees).mutex)) != 0)
 1808:                         {
 1809:                             (*s_etat_processus).erreur_systeme = d_es_processus;
 1810:                             return;
 1811:                         }
 1812:                     }
 1813: 
 1814:                     (*s_etat_processus).erreur_systeme =
 1815:                             d_es_allocation_memoire;
 1816:                     return;
 1817:                 }
 1818: 
 1819:                 for(j = 0; j < nombre_colonnes; j++)
 1820:                 {
 1821:                     if (k < (*((struct_vecteur *) (*s_objet_initial)
 1822:                             .objet)).taille)
 1823:                     {
 1824:                         ((struct_complexe16 **) (*((struct_matrice *)
 1825:                                 (*s_objet_redimensionne).objet)).tableau)
 1826:                                 [i][j].partie_reelle =
 1827:                                 ((struct_complexe16 *) (*((struct_vecteur *)
 1828:                                 (*s_objet_initial).objet)).tableau)[k]
 1829:                                 .partie_reelle;
 1830:                         ((struct_complexe16 **) (*((struct_matrice *)
 1831:                                 (*s_objet_redimensionne).objet)).tableau)
 1832:                                 [i][j].partie_imaginaire =
 1833:                                 ((struct_complexe16 *) (*((struct_vecteur *)
 1834:                                 (*s_objet_initial).objet)).tableau)[k++]
 1835:                                 .partie_imaginaire;
 1836:                     }
 1837:                     else
 1838:                     {
 1839:                         ((struct_complexe16 **) (*((struct_matrice *)
 1840:                                 (*s_objet_redimensionne).objet)).tableau)
 1841:                                 [i][j].partie_reelle = (real8) 0;
 1842:                         ((struct_complexe16 **) (*((struct_matrice *)
 1843:                                 (*s_objet_redimensionne).objet)).tableau)
 1844:                                 [i][j].partie_imaginaire = (real8) 0;
 1845:                     }
 1846:                 }
 1847:             }
 1848:         }
 1849:         else if ((*s_objet_initial).type == MIN)
 1850:         {
 1851:             (*s_objet_redimensionne).type = MIN;
 1852: 
 1853:             if (((*s_objet_redimensionne).objet =
 1854:                     malloc(sizeof(struct_matrice))) == NULL)
 1855:             {
 1856:                 if (variable_partagee == d_vrai)
 1857:                 {
 1858:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1859:                             .s_liste_variables_partagees).mutex)) != 0)
 1860:                     {
 1861:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1862:                         return;
 1863:                     }
 1864:                 }
 1865: 
 1866:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1867:                 return;
 1868:             }
 1869: 
 1870:             (*((struct_matrice *) (*s_objet_redimensionne).objet)).type = 'I';
 1871:             (*((struct_matrice *) (*s_objet_redimensionne).objet))
 1872:                     .nombre_lignes = nombre_lignes;
 1873:             (*((struct_matrice *) (*s_objet_redimensionne).objet))
 1874:                     .nombre_colonnes = nombre_colonnes;
 1875: 
 1876:             if (((*((struct_matrice *) (*s_objet_redimensionne).objet)).tableau
 1877:                     = malloc(nombre_lignes * sizeof(integer8 *)))
 1878:                     == NULL)
 1879:             {
 1880:                 if (variable_partagee == d_vrai)
 1881:                 {
 1882:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1883:                             .s_liste_variables_partagees).mutex)) != 0)
 1884:                     {
 1885:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1886:                         return;
 1887:                     }
 1888:                 }
 1889: 
 1890:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1891:                 return;
 1892:             }
 1893: 
 1894:             drapeau_fin_objet_originel = d_faux;
 1895: 
 1896:             for(i = 0, k = 0, l = 0; i < nombre_lignes; i++)
 1897:             {
 1898:                 if ((((integer8 **) (*((struct_matrice *)
 1899:                         (*s_objet_redimensionne).objet)).tableau)[i] =
 1900:                         malloc(nombre_colonnes *
 1901:                         sizeof(integer8))) == NULL)
 1902:                 {
 1903:                     if (variable_partagee == d_vrai)
 1904:                     {
 1905:                         if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1906:                                 .s_liste_variables_partagees).mutex)) != 0)
 1907:                         {
 1908:                             (*s_etat_processus).erreur_systeme = d_es_processus;
 1909:                             return;
 1910:                         }
 1911:                     }
 1912: 
 1913:                     (*s_etat_processus).erreur_systeme =
 1914:                             d_es_allocation_memoire;
 1915:                     return;
 1916:                 }
 1917: 
 1918:                 for(j = 0; j < nombre_colonnes; j++)
 1919:                 {
 1920:                     if (drapeau_fin_objet_originel == d_faux)
 1921:                     {
 1922:                         ((integer8 **) (*((struct_matrice *)
 1923:                                 (*s_objet_redimensionne).objet)).tableau)
 1924:                                 [i][j] = ((integer8 **) (*((struct_matrice *)
 1925:                                 (*s_objet_initial).objet)).tableau)[k][l];
 1926: 
 1927:                         if ((++l) >= (*((struct_matrice *) (*s_objet_initial)
 1928:                                 .objet)).nombre_colonnes)
 1929:                         {
 1930:                             l = 0;
 1931: 
 1932:                             if ((++k) >= (*((struct_matrice *)
 1933:                                     (*s_objet_initial).objet)).nombre_lignes)
 1934:                             {
 1935:                                 drapeau_fin_objet_originel = d_vrai;
 1936:                             }
 1937:                         }
 1938:                     }
 1939:                     else
 1940:                     {
 1941:                         ((integer8 **) (*((struct_matrice *)
 1942:                                 (*s_objet_redimensionne).objet)).tableau)
 1943:                                 [i][j] = 0;
 1944:                     }
 1945:                 }
 1946:             }
 1947:         }
 1948:         else if ((*s_objet_initial).type == MRL)
 1949:         {
 1950:             (*s_objet_redimensionne).type = MRL;
 1951: 
 1952:             if (((*s_objet_redimensionne).objet =
 1953:                     malloc(sizeof(struct_matrice))) == NULL)
 1954:             {
 1955:                 if (variable_partagee == d_vrai)
 1956:                 {
 1957:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1958:                             .s_liste_variables_partagees).mutex)) != 0)
 1959:                     {
 1960:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1961:                         return;
 1962:                     }
 1963:                 }
 1964: 
 1965:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1966:                 return;
 1967:             }
 1968: 
 1969:             (*((struct_matrice *) (*s_objet_redimensionne).objet)).type = 'R';
 1970:             (*((struct_matrice *) (*s_objet_redimensionne).objet))
 1971:                     .nombre_lignes = nombre_lignes;
 1972:             (*((struct_matrice *) (*s_objet_redimensionne).objet))
 1973:                     .nombre_colonnes = nombre_colonnes;
 1974: 
 1975:             if (((*((struct_matrice *) (*s_objet_redimensionne).objet)).tableau
 1976:                     = malloc(nombre_lignes * sizeof(real8 *)))
 1977:                     == NULL)
 1978:             {
 1979:                 if (variable_partagee == d_vrai)
 1980:                 {
 1981:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1982:                             .s_liste_variables_partagees).mutex)) != 0)
 1983:                     {
 1984:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1985:                         return;
 1986:                     }
 1987:                 }
 1988: 
 1989:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1990:                 return;
 1991:             }
 1992: 
 1993:             drapeau_fin_objet_originel = d_faux;
 1994: 
 1995:             for(i = 0, k = 0, l = 0; i < nombre_lignes; i++)
 1996:             {
 1997:                 if ((((real8 **) (*((struct_matrice *)
 1998:                         (*s_objet_redimensionne).objet)).tableau)[i] =
 1999:                         malloc(nombre_colonnes *
 2000:                         sizeof(real8))) == NULL)
 2001:                 {
 2002:                     if (variable_partagee == d_vrai)
 2003:                     {
 2004:                         if (pthread_mutex_unlock(&((*(*s_etat_processus)
 2005:                                 .s_liste_variables_partagees).mutex)) != 0)
 2006:                         {
 2007:                             (*s_etat_processus).erreur_systeme = d_es_processus;
 2008:                             return;
 2009:                         }
 2010:                     }
 2011: 
 2012:                     (*s_etat_processus).erreur_systeme =
 2013:                             d_es_allocation_memoire;
 2014:                     return;
 2015:                 }
 2016: 
 2017:                 for(j = 0; j < nombre_colonnes; j++)
 2018:                 {
 2019:                     if (drapeau_fin_objet_originel == d_faux)
 2020:                     {
 2021:                         ((real8 **) (*((struct_matrice *)
 2022:                                 (*s_objet_redimensionne).objet)).tableau)
 2023:                                 [i][j] = ((real8 **) (*((struct_matrice *)
 2024:                                 (*s_objet_initial).objet)).tableau)[k][l];
 2025: 
 2026:                         if ((++l) >= (*((struct_matrice *) (*s_objet_initial)
 2027:                                 .objet)).nombre_colonnes)
 2028:                         {
 2029:                             l = 0;
 2030: 
 2031:                             if ((++k) >= (*((struct_matrice *)
 2032:                                     (*s_objet_initial).objet)).nombre_lignes)
 2033:                             {
 2034:                                 drapeau_fin_objet_originel = d_vrai;
 2035:                             }
 2036:                         }
 2037:                     }
 2038:                     else
 2039:                     {
 2040:                         ((real8 **) (*((struct_matrice *)
 2041:                                 (*s_objet_redimensionne).objet)).tableau)
 2042:                                 [i][j] = (real8) 0;
 2043:                     }
 2044:                 }
 2045:             }
 2046:         }
 2047:         else if ((*s_objet_initial).type == MCX)
 2048:         {
 2049:             (*s_objet_redimensionne).type = MCX;
 2050: 
 2051:             if (((*s_objet_redimensionne).objet =
 2052:                     malloc(sizeof(struct_matrice))) == NULL)
 2053:             {
 2054:                 if (variable_partagee == d_vrai)
 2055:                 {
 2056:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 2057:                             .s_liste_variables_partagees).mutex)) != 0)
 2058:                     {
 2059:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 2060:                         return;
 2061:                     }
 2062:                 }
 2063: 
 2064:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 2065:                 return;
 2066:             }
 2067: 
 2068:             (*((struct_matrice *) (*s_objet_redimensionne).objet)).type = 'C';
 2069:             (*((struct_matrice *) (*s_objet_redimensionne).objet))
 2070:                     .nombre_lignes = nombre_lignes;
 2071:             (*((struct_matrice *) (*s_objet_redimensionne).objet))
 2072:                     .nombre_colonnes = nombre_colonnes;
 2073: 
 2074:             if (((*((struct_matrice *) (*s_objet_redimensionne).objet)).tableau
 2075:                     = malloc(nombre_lignes * sizeof(struct_complexe16 *)))
 2076:                     == NULL)
 2077:             {
 2078:                 if (variable_partagee == d_vrai)
 2079:                 {
 2080:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 2081:                             .s_liste_variables_partagees).mutex)) != 0)
 2082:                     {
 2083:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 2084:                         return;
 2085:                     }
 2086:                 }
 2087: 
 2088:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 2089:                 return;
 2090:             }
 2091: 
 2092:             drapeau_fin_objet_originel = d_faux;
 2093: 
 2094:             for(i = 0, k = 0, l = 0; i < nombre_lignes; i++)
 2095:             {
 2096:                 if ((((struct_complexe16 **) (*((struct_matrice *)
 2097:                         (*s_objet_redimensionne).objet)).tableau)[i] =
 2098:                         malloc(nombre_colonnes *
 2099:                         sizeof(struct_complexe16))) == NULL)
 2100:                 {
 2101:                     if (variable_partagee == d_vrai)
 2102:                     {
 2103:                         if (pthread_mutex_unlock(&((*(*s_etat_processus)
 2104:                                 .s_liste_variables_partagees).mutex)) != 0)
 2105:                         {
 2106:                             (*s_etat_processus).erreur_systeme = d_es_processus;
 2107:                             return;
 2108:                         }
 2109:                     }
 2110: 
 2111:                     (*s_etat_processus).erreur_systeme =
 2112:                             d_es_allocation_memoire;
 2113:                     return;
 2114:                 }
 2115: 
 2116:                 for(j = 0; j < nombre_colonnes; j++)
 2117:                 {
 2118:                     if (drapeau_fin_objet_originel == d_faux)
 2119:                     {
 2120:                         ((struct_complexe16 **) (*((struct_matrice *)
 2121:                                 (*s_objet_redimensionne).objet)).tableau)
 2122:                                 [i][j].partie_reelle = ((struct_complexe16 **)
 2123:                                 (*((struct_matrice *) (*s_objet_initial).objet))
 2124:                                 .tableau)[k][l].partie_reelle;
 2125: 
 2126:                         ((struct_complexe16 **) (*((struct_matrice *)
 2127:                                 (*s_objet_redimensionne).objet)).tableau)
 2128:                                 [i][j].partie_imaginaire =
 2129:                                 ((struct_complexe16 **) (*((struct_matrice *)
 2130:                                 (*s_objet_initial).objet)).tableau)[k][l]
 2131:                                 .partie_imaginaire; 
 2132: 
 2133:                         if ((++l) >= (*((struct_matrice *) (*s_objet_initial)
 2134:                                 .objet)).nombre_colonnes)
 2135:                         {
 2136:                             l = 0;
 2137: 
 2138:                             if ((++k) >= (*((struct_matrice *)
 2139:                                     (*s_objet_initial).objet)).nombre_lignes)
 2140:                             {
 2141:                                 drapeau_fin_objet_originel = d_vrai;
 2142:                             }
 2143:                         }
 2144:                     }
 2145:                     else
 2146:                     {
 2147:                         ((struct_complexe16 **) (*((struct_matrice *)
 2148:                                 (*s_objet_redimensionne).objet)).tableau)
 2149:                                 [i][j].partie_reelle = (real8) 0;
 2150:                         ((struct_complexe16 **) (*((struct_matrice *)
 2151:                                 (*s_objet_redimensionne).objet)).tableau)
 2152:                                 [i][j].partie_imaginaire = (real8) 0;
 2153:                     }
 2154:                 }
 2155:             }
 2156:         }
 2157:         else
 2158:         {
 2159:             if (variable_partagee == d_vrai)
 2160:             {
 2161:                 if (pthread_mutex_unlock(&((*(*s_etat_processus)
 2162:                         .s_liste_variables_partagees).mutex)) != 0)
 2163:                 {
 2164:                     (*s_etat_processus).erreur_systeme = d_es_processus;
 2165:                     return;
 2166:                 }
 2167:             }
 2168: 
 2169:             if (argument_nom == d_faux)
 2170:             {
 2171:                 liberation(s_etat_processus, s_objet_initial);
 2172:             }
 2173: 
 2174:             liberation(s_etat_processus, s_objet_dimensions);
 2175:             free(s_objet_redimensionne);
 2176: 
 2177:             (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
 2178:             return;
 2179:         }
 2180:     }
 2181: 
 2182:     liberation(s_etat_processus, s_objet_dimensions);
 2183:     liberation(s_etat_processus, s_objet_initial);
 2184: 
 2185:     if (argument_nom == d_faux)
 2186:     {
 2187:         if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
 2188:                 s_objet_redimensionne) == d_erreur)
 2189:         {
 2190:             return;
 2191:         }
 2192:     }
 2193:     else
 2194:     {
 2195:         if (variable_partagee == d_vrai)
 2196:         {
 2197:             (*(*s_etat_processus).s_liste_variables_partagees).table
 2198:                     [(*(*s_etat_processus).s_liste_variables_partagees)
 2199:                     .position_variable].objet = s_objet_redimensionne;
 2200: 
 2201:             if (pthread_mutex_unlock(&((*(*s_etat_processus)
 2202:                     .s_liste_variables_partagees).mutex)) != 0)
 2203:             {
 2204:                 (*s_etat_processus).erreur_systeme = d_es_processus;
 2205:                 return;
 2206:             }
 2207:         }
 2208:         else
 2209:         {
 2210:             (*s_etat_processus).s_liste_variables
 2211:                     [(*s_etat_processus).position_variable_courante].objet =
 2212:                     s_objet_redimensionne;
 2213:         }
 2214:     }
 2215: 
 2216:     return;
 2217: }
 2218: 
 2219: // vim: ts=4

CVSweb interface <joel.bertrand@systella.fr>