File:  [local] / rpl / src / instructions_r2.c
Revision 1.16: download - view: text, annotated - select for diffs - revision graph
Thu Sep 23 15:27:39 2010 UTC (13 years, 7 months ago) by bertrand
Branches: MAIN
CVS tags: HEAD
En route pour la 4.0.20.

    1: /*
    2: ================================================================================
    3:   RPL/2 (R) version 4.0.20
    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:                         if ((*s_etat_processus).erreur_systeme != d_es)
  570:                         {
  571:                             return;
  572:                         }
  573:                     }
  574:                     else
  575:                     {
  576:                         depilement_pile_systeme(s_etat_processus);
  577: 
  578:                         if ((*s_etat_processus).erreur_systeme != d_es)
  579:                         {
  580:                             return;
  581:                         }
  582:                     }
  583:                 }
  584: 
  585:                 free(instruction_majuscule);
  586:             }
  587: 
  588:             free((*s_etat_processus).instruction_courante);
  589:         }
  590:     }
  591:     else
  592:     {
  593:         while(fin_boucle == d_faux)
  594:         {
  595:             if ((*s_etat_processus).expression_courante == NULL)
  596:             {
  597:                 (*s_etat_processus).expression_courante = tampon_expression;
  598: 
  599:                 (*s_etat_processus).erreur_execution =
  600:                         d_ex_erreur_traitement_boucle;
  601:                 return;
  602:             }
  603: 
  604:             (*s_etat_processus).expression_courante =
  605:                     (*(*s_etat_processus).expression_courante).suivant;
  606: 
  607:             if ((*s_etat_processus).expression_courante == NULL)
  608:             {
  609:                 (*s_etat_processus).expression_courante = tampon_expression;
  610: 
  611:                 (*s_etat_processus).erreur_execution =
  612:                         d_ex_erreur_traitement_boucle;
  613:                 return;
  614:             }
  615: 
  616:             fin_scrutation = d_faux;
  617: 
  618:             do
  619:             {
  620:                 while((*(*(*s_etat_processus).expression_courante)
  621:                         .donnee).type != FCT)
  622:                 {
  623:                     (*s_etat_processus).expression_courante =
  624:                             (*(*s_etat_processus).expression_courante).suivant;
  625: 
  626:                     if ((*s_etat_processus).expression_courante == NULL)
  627:                     {
  628:                         (*s_etat_processus).expression_courante =
  629:                                 tampon_expression;
  630: 
  631:                         (*s_etat_processus).erreur_execution =
  632:                                 d_ex_erreur_traitement_boucle;
  633:                         return;
  634:                     }
  635:                 }
  636: 
  637:                 if ((*((struct_fonction *) (*(*(*s_etat_processus)
  638:                         .expression_courante).donnee).objet))
  639:                         .nombre_arguments != 0)
  640:                 {
  641:                     (*s_etat_processus).expression_courante =
  642:                             (*(*s_etat_processus).expression_courante).suivant;
  643: 
  644:                     if ((*s_etat_processus).expression_courante == NULL)
  645:                     {
  646:                         (*s_etat_processus).expression_courante =
  647:                                 tampon_expression;
  648: 
  649:                         (*s_etat_processus).erreur_execution =
  650:                                 d_ex_erreur_traitement_boucle;
  651:                         return;
  652:                     }
  653:                 }
  654:                 else
  655:                 {
  656:                     fin_scrutation = d_vrai;
  657:                     tampon_expression = (*s_etat_processus).expression_courante;
  658:                 }
  659:             } while(fin_scrutation == d_faux);
  660: 
  661:             fonction = (*((struct_fonction *) (*(*(*s_etat_processus)
  662:                     .expression_courante).donnee).objet)).fonction;
  663: 
  664:             /*
  665:              * Traitement de la pile système par les différentes
  666:              * instructions.
  667:              */
  668: 
  669:             if ((fonction == instruction_if) ||
  670:                     (fonction == instruction_iferr) ||
  671:                     (fonction == instruction_do) ||
  672:                     (fonction == instruction_while) ||
  673:                     (fonction == instruction_for) ||
  674:                     (fonction == instruction_start) ||
  675:                     (fonction == instruction_select) ||
  676:                     (fonction == instruction_case) ||
  677:                     (fonction == instruction_vers_niveau_superieur))
  678:             {
  679:                 if (fonction == instruction_vers_niveau_superieur)
  680:                 {
  681:                     analyse(s_etat_processus,
  682:                             instruction_vers_niveau_superieur);
  683:                 }
  684:                 else if ((fonction == instruction_for) ||
  685:                         (fonction == instruction_start))
  686:                 {
  687:                     empilement_pile_systeme(s_etat_processus);
  688: 
  689:                     if ((*s_etat_processus).erreur_systeme != d_es)
  690:                     {
  691:                         return;
  692:                     }
  693: 
  694:                     (*(*s_etat_processus).l_base_pile_systeme)
  695:                             .type_cloture = 'L';
  696:                 }
  697:                 else
  698:                 {
  699:                     /*
  700:                      * Si on passe sur un début de boucle FOR ou START,
  701:                      * les champs de la pile système sont initialisés à
  702:                      * NULL, ce qui permet de les libérer de façon correcte
  703:                      * lors du dépilement.
  704:                      */
  705: 
  706:                     empilement_pile_systeme(s_etat_processus);
  707: 
  708:                     if ((*s_etat_processus).erreur_systeme != d_es)
  709:                     {
  710:                         return;
  711:                     }
  712:                 }
  713:             }
  714:             else if ((fonction == instruction_end) ||
  715:                     (fonction == instruction_next) ||
  716:                     (fonction == instruction_step) ||
  717:                     (fonction == instruction_vers_niveau_inferieur))
  718:             {
  719:                 if (fonction == instruction_vers_niveau_inferieur)
  720:                 {
  721:                     analyse(s_etat_processus,
  722:                             instruction_vers_niveau_inferieur);
  723: 
  724:                     fin_boucle = ((*(*s_etat_processus)
  725:                             .expression_courante).suivant == NULL)
  726:                             ? d_vrai : d_faux;
  727: 
  728:                     if (fin_boucle == d_faux)
  729:                     {
  730:                         if ((*s_etat_processus).niveau_courant ==
  731:                                 (*s_etat_processus).niveau_initial)
  732:                         {
  733:                             fin_boucle = d_vrai;
  734:                         }
  735:                     }
  736:                 }
  737:                 else if (((fonction == instruction_next) ||
  738:                         (fonction == instruction_step)) &&
  739:                         ((*(*s_etat_processus).l_base_pile_systeme)
  740:                         .type_cloture != 'L'))
  741:                 {
  742:                     /*
  743:                      * Libération des compteurs de boucle.
  744:                      */
  745: 
  746:                     presence_compteur = ((*(*s_etat_processus)
  747:                             .l_base_pile_systeme).type_cloture == 'F')
  748:                             ? d_vrai : d_faux;
  749: 
  750:                     if (((*(*s_etat_processus).l_base_pile_systeme)
  751:                             .type_cloture != 'S') &&
  752:                             (presence_compteur == d_faux))
  753:                     {
  754:                         (*s_etat_processus).erreur_execution =
  755:                                 d_ex_erreur_traitement_boucle;
  756:                         return;
  757:                     }
  758: 
  759:                     if (presence_compteur == d_vrai)
  760:                     {
  761:                         if (recherche_variable(s_etat_processus,
  762:                                 (*(*s_etat_processus).l_base_pile_systeme)
  763:                                 .nom_variable) == d_faux)
  764:                         {
  765:                             (*s_etat_processus).erreur_systeme = d_es;
  766:                             (*s_etat_processus).erreur_execution =
  767:                                     d_ex_erreur_traitement_boucle;
  768:                             return;
  769:                         }
  770: 
  771:                         if ((*s_etat_processus).s_liste_variables
  772:                                 [(*s_etat_processus).position_variable_courante]
  773:                                 .objet == NULL)
  774:                         {
  775:                             (*s_etat_processus).erreur_systeme = d_es;
  776:                             (*s_etat_processus).erreur_execution =
  777:                                     d_ex_variable_partagee;
  778:                             return;
  779:                         }
  780: 
  781:                         (*(*s_etat_processus).l_base_pile_systeme)
  782:                                 .indice_boucle = ((*s_etat_processus)
  783:                                 .s_liste_variables[(*s_etat_processus)
  784:                                 .position_variable_courante]).objet;
  785: 
  786:                         if (presence_compteur == d_vrai)
  787:                         {
  788:                             (*s_etat_processus).niveau_courant--;
  789: 
  790:                             if (retrait_variable_par_niveau(s_etat_processus)
  791:                                     == d_erreur)
  792:                             {
  793:                                 return;
  794:                             }
  795:                         }
  796:                     }
  797: 
  798:                     (*(*s_etat_processus).l_base_pile_systeme)
  799:                             .indice_boucle = NULL;
  800: 
  801:                     depilement_pile_systeme(s_etat_processus);
  802:                 }
  803:                 else
  804:                 {
  805:                     depilement_pile_systeme(s_etat_processus);
  806: 
  807:                     if ((*s_etat_processus).erreur_systeme != d_es)
  808:                     {
  809:                         return;
  810:                     }
  811:                 }
  812:             }
  813:         }
  814:     }
  815: 
  816:     if ((*s_etat_processus).mode_execution_programme != 'Y')
  817:     {
  818:         if ((*s_etat_processus).expression_courante == NULL)
  819:         {
  820:             (*s_etat_processus).expression_courante = tampon_expression;
  821: 
  822:             (*s_etat_processus).erreur_execution =
  823:                     d_ex_erreur_traitement_boucle;
  824:             return;
  825:         }
  826: 
  827:         (*s_etat_processus).expression_courante =
  828:                 (*(*s_etat_processus).expression_courante).suivant;
  829:     }
  830:     
  831:     (*s_etat_processus).instruction_courante = tampon;
  832:     (*s_etat_processus).expression_courante = tampon_expression;
  833: 
  834:     return;
  835: }
  836: 
  837: 
  838: /*
  839: ================================================================================
  840:   Fonction 'rdm'
  841: ================================================================================
  842:   Entrées : pointeur sur une structure struct_processus
  843: --------------------------------------------------------------------------------
  844:   Sorties :
  845: --------------------------------------------------------------------------------
  846:   Effets de bord : néant
  847: ================================================================================
  848: */
  849: 
  850: void
  851: instruction_rdm(struct_processus *s_etat_processus)
  852: {
  853:     struct_liste_chainee            *l_element_courant;
  854: 
  855:     struct_objet                    *s_objet_dimensions;
  856:     struct_objet                    *s_objet_initial;
  857:     struct_objet                    *s_objet_redimensionne;
  858: 
  859:     logical1                        argument_nom;
  860:     logical1                        drapeau_fin_objet_originel;
  861:     logical1                        variable_partagee;
  862: 
  863:     unsigned long                   i;
  864:     unsigned long                   j;
  865:     unsigned long                   k;
  866:     unsigned long                   l;
  867:     unsigned long                   nombre_colonnes;
  868:     unsigned long                   nombre_dimensions;
  869:     unsigned long                   nombre_lignes;
  870: 
  871:     (*s_etat_processus).erreur_execution = d_ex;
  872: 
  873:     if ((*s_etat_processus).affichage_arguments == 'Y')
  874:     {
  875:         printf("\n  RDM ");
  876: 
  877:         if ((*s_etat_processus).langue == 'F')
  878:         {
  879:             printf("(redimensionnement)\n\n");
  880:         }
  881:         else
  882:         {
  883:             printf("(resizing)\n\n");
  884:         }
  885: 
  886:         printf("    2: %s, %s, %s, %s, %s, %s, %s\n", d_NOM,
  887:                 d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX);
  888:         printf("    1: %s\n", d_LST);
  889:         printf("->  1: %s, %s, %s, %s, %s, %s\n",
  890:                 d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX);
  891:         return;
  892:     }
  893:     else if ((*s_etat_processus).test_instruction == 'Y')
  894:     {
  895:         (*s_etat_processus).nombre_arguments = -1;
  896:         return;
  897:     }
  898:     
  899:     if (test_cfsf(s_etat_processus, 31) == d_vrai)
  900:     {
  901:         if (empilement_pile_last(s_etat_processus, 2) == d_erreur)
  902:         {
  903:             return;
  904:         }
  905:     }
  906: 
  907:     if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
  908:             &s_objet_dimensions) == d_erreur)
  909:     {
  910:         (*s_etat_processus).erreur_execution = d_ex_manque_argument;
  911:         return;
  912:     }
  913: 
  914:     if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
  915:             &s_objet_initial) == d_erreur)
  916:     {
  917:         liberation(s_etat_processus, s_objet_dimensions);
  918: 
  919:         (*s_etat_processus).erreur_execution = d_ex_manque_argument;
  920:         return;
  921:     }
  922: 
  923:     variable_partagee = d_faux;
  924: 
  925:     if ((*s_objet_initial).type == NOM)
  926:     {
  927:         argument_nom = d_vrai;
  928: 
  929:         if (recherche_variable(s_etat_processus, (*((struct_nom *)
  930:                 (*s_objet_initial).objet)).nom) == d_faux)
  931:         {
  932:             (*s_etat_processus).erreur_systeme = d_es;
  933:             (*s_etat_processus).erreur_execution = d_ex_variable_non_definie;
  934: 
  935:             liberation(s_etat_processus, s_objet_initial);
  936:             liberation(s_etat_processus, s_objet_dimensions);
  937: 
  938:             return;
  939:         }
  940: 
  941:         liberation(s_etat_processus, s_objet_initial);
  942: 
  943:         if ((*s_etat_processus).s_liste_variables[(*s_etat_processus)
  944:                 .position_variable_courante].variable_verrouillee == d_vrai)
  945:         {
  946:             (*s_etat_processus).erreur_execution = d_ex_variable_verrouillee;
  947: 
  948:             liberation(s_etat_processus, s_objet_dimensions);
  949:             return;
  950:         }
  951: 
  952:         s_objet_initial = (*s_etat_processus).s_liste_variables
  953:                 [(*s_etat_processus).position_variable_courante].objet;
  954: 
  955:         if (s_objet_initial == NULL)
  956:         {
  957:             if (pthread_mutex_lock(&((*(*s_etat_processus)
  958:                     .s_liste_variables_partagees).mutex)) != 0)
  959:             {
  960:                 (*s_etat_processus).erreur_systeme = d_es_processus;
  961:                 return;
  962:             }
  963: 
  964:             if (recherche_variable_partagee(s_etat_processus,
  965:                     (*s_etat_processus).s_liste_variables
  966:                     [(*s_etat_processus).position_variable_courante].nom,
  967:                     (*s_etat_processus).s_liste_variables
  968:                     [(*s_etat_processus).position_variable_courante]
  969:                     .variable_partagee, (*s_etat_processus).s_liste_variables
  970:                     [(*s_etat_processus).position_variable_courante].origine)
  971:                     == d_faux)
  972:             {
  973:                 if (pthread_mutex_unlock(&((*(*s_etat_processus)
  974:                         .s_liste_variables_partagees).mutex)) != 0)
  975:                 {
  976:                     (*s_etat_processus).erreur_systeme = d_es_processus;
  977:                     return;
  978:                 }
  979: 
  980:                 (*s_etat_processus).erreur_systeme = d_es;
  981:                 (*s_etat_processus).erreur_execution =
  982:                         d_ex_variable_non_definie;
  983: 
  984:                 liberation(s_etat_processus, s_objet_dimensions);
  985: 
  986:                 return;
  987:             }
  988: 
  989:             variable_partagee = d_vrai;
  990:         }
  991:     }
  992:     else
  993:     {
  994:         argument_nom = d_faux;
  995:     }
  996: 
  997:     if ((*s_objet_dimensions).type != LST)
  998:     {
  999:         if (variable_partagee == d_vrai)
 1000:         {
 1001:             if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1002:                     .s_liste_variables_partagees).mutex)) != 0)
 1003:             {
 1004:                 (*s_etat_processus).erreur_systeme = d_es_processus;
 1005:                 return;
 1006:             }
 1007:         }
 1008: 
 1009:         liberation(s_etat_processus, s_objet_dimensions);
 1010: 
 1011:         if (argument_nom == d_faux)
 1012:         {
 1013:             liberation(s_etat_processus, s_objet_initial);
 1014:         }
 1015: 
 1016:         (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
 1017:         return;
 1018:     }
 1019: 
 1020:     l_element_courant = (*s_objet_dimensions).objet;
 1021:     nombre_dimensions = 0;
 1022: 
 1023:     while(l_element_courant != NULL)
 1024:     {
 1025:         nombre_dimensions++;
 1026:         l_element_courant = (*l_element_courant).suivant;
 1027:     }
 1028: 
 1029:     if ((nombre_dimensions != 1) && (nombre_dimensions != 2))
 1030:     {
 1031:         if (variable_partagee == d_vrai)
 1032:         {
 1033:             if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1034:                     .s_liste_variables_partagees).mutex)) != 0)
 1035:             {
 1036:                 (*s_etat_processus).erreur_systeme = d_es_processus;
 1037:                 return;
 1038:             }
 1039:         }
 1040: 
 1041:         liberation(s_etat_processus, s_objet_dimensions);
 1042: 
 1043:         if (argument_nom == d_faux)
 1044:         {
 1045:             liberation(s_etat_processus, s_objet_initial);
 1046:         }
 1047: 
 1048:         (*s_etat_processus).erreur_execution = d_ex_dimensions_invalides;
 1049:         return;
 1050:     }
 1051: 
 1052:     nombre_colonnes = 0;
 1053:     nombre_lignes = 0;
 1054: 
 1055:     l_element_courant = (*s_objet_dimensions).objet;
 1056: 
 1057:     while(l_element_courant != NULL)
 1058:     {
 1059:         if ((*(*l_element_courant).donnee).type != INT)
 1060:         {
 1061:             if (variable_partagee == d_vrai)
 1062:             {
 1063:                 if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1064:                         .s_liste_variables_partagees).mutex)) != 0)
 1065:                 {
 1066:                     (*s_etat_processus).erreur_systeme = d_es_processus;
 1067:                     return;
 1068:                 }
 1069:             }
 1070: 
 1071:             liberation(s_etat_processus, s_objet_dimensions);
 1072: 
 1073:             if (argument_nom == d_faux)
 1074:             {
 1075:                 liberation(s_etat_processus, s_objet_initial);
 1076:             }
 1077: 
 1078:             (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
 1079:             return;
 1080:         }
 1081: 
 1082:         if ((*((integer8 *) (*(*l_element_courant).donnee).objet)) <= 0)
 1083:         {
 1084:             if (variable_partagee == d_vrai)
 1085:             {
 1086:                 if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1087:                         .s_liste_variables_partagees).mutex)) != 0)
 1088:                 {
 1089:                     (*s_etat_processus).erreur_systeme = d_es_processus;
 1090:                     return;
 1091:                 }
 1092:             }
 1093: 
 1094:             liberation(s_etat_processus, s_objet_dimensions);
 1095: 
 1096:             if (argument_nom == d_faux)
 1097:             {
 1098:                 liberation(s_etat_processus, s_objet_initial);
 1099:             }
 1100: 
 1101:             (*s_etat_processus).erreur_execution = d_ex_argument_invalide;
 1102:             return;
 1103:         }
 1104: 
 1105:         if (nombre_lignes == 0)
 1106:         {
 1107:             nombre_lignes = (*((integer8 *)
 1108:                     (*(*l_element_courant).donnee).objet));
 1109:         }
 1110:         else
 1111:         {
 1112:             nombre_colonnes = (*((integer8 *)
 1113:                     (*(*l_element_courant).donnee).objet));
 1114:         }
 1115: 
 1116:         l_element_courant = (*l_element_courant).suivant;
 1117:     }
 1118: 
 1119:     if ((s_objet_redimensionne = allocation(s_etat_processus, NON)) == NULL)
 1120:     {
 1121:         if (variable_partagee == d_vrai)
 1122:         {
 1123:             if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1124:                     .s_liste_variables_partagees).mutex)) != 0)
 1125:             {
 1126:                 (*s_etat_processus).erreur_systeme = d_es_processus;
 1127:                 return;
 1128:             }
 1129:         }
 1130: 
 1131:         (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1132:         return;
 1133:     }
 1134: 
 1135: /*
 1136: --------------------------------------------------------------------------------
 1137:   Redimensionnement aboutissant à un vecteur
 1138: --------------------------------------------------------------------------------
 1139: */
 1140: 
 1141:     if (nombre_dimensions == 1)
 1142:     {
 1143:         if ((*s_objet_initial).type == VIN)
 1144:         {
 1145:             (*s_objet_redimensionne).type = VIN;
 1146: 
 1147:             if (((*s_objet_redimensionne).objet =
 1148:                     malloc(sizeof(struct_vecteur))) == NULL)
 1149:             {
 1150:                 if (variable_partagee == d_vrai)
 1151:                 {
 1152:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1153:                             .s_liste_variables_partagees).mutex)) != 0)
 1154:                     {
 1155:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1156:                         return;
 1157:                     }
 1158:                 }
 1159: 
 1160:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1161:                 return;
 1162:             }
 1163: 
 1164:             (*((struct_vecteur *) (*s_objet_redimensionne).objet)).type = 'I';
 1165:             (*((struct_vecteur *) (*s_objet_redimensionne).objet)).taille =
 1166:                     nombre_lignes;
 1167: 
 1168:             if (((*((struct_vecteur *) (*s_objet_redimensionne).objet)).tableau
 1169:                     = malloc(nombre_lignes * sizeof(integer8))) == NULL)
 1170:             {
 1171:                 if (variable_partagee == d_vrai)
 1172:                 {
 1173:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1174:                             .s_liste_variables_partagees).mutex)) != 0)
 1175:                     {
 1176:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1177:                         return;
 1178:                     }
 1179:                 }
 1180: 
 1181:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1182:                 return;
 1183:             }
 1184: 
 1185:             for(i = 0; i < nombre_lignes; i++)
 1186:             {
 1187:                 if (i < (*((struct_vecteur *) (*s_objet_initial).objet)).taille)
 1188:                 {
 1189:                     ((integer8 *) (*((struct_vecteur *)
 1190:                             (*s_objet_redimensionne).objet)).tableau)[i] =
 1191:                             ((integer8 *) (*((struct_vecteur *)
 1192:                             (*s_objet_initial).objet)).tableau)[i];
 1193:                 }
 1194:                 else
 1195:                 {
 1196:                     ((integer8 *) (*((struct_vecteur *)
 1197:                             (*s_objet_redimensionne).objet)).tableau)[i] = 0;
 1198:                 }
 1199:             }
 1200:         }
 1201:         else if ((*s_objet_initial).type == VRL)
 1202:         {
 1203:             (*s_objet_redimensionne).type = VRL;
 1204: 
 1205:             if (((*s_objet_redimensionne).objet =
 1206:                     malloc(sizeof(struct_vecteur))) == NULL)
 1207:             {
 1208:                 if (variable_partagee == d_vrai)
 1209:                 {
 1210:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1211:                             .s_liste_variables_partagees).mutex)) != 0)
 1212:                     {
 1213:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1214:                         return;
 1215:                     }
 1216:                 }
 1217: 
 1218:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1219:                 return;
 1220:             }
 1221: 
 1222:             (*((struct_vecteur *) (*s_objet_redimensionne).objet)).type = 'R';
 1223:             (*((struct_vecteur *) (*s_objet_redimensionne).objet)).taille =
 1224:                     nombre_lignes;
 1225: 
 1226:             if (((*((struct_vecteur *) (*s_objet_redimensionne).objet)).tableau
 1227:                     = malloc(nombre_lignes * sizeof(real8))) == NULL)
 1228:             {
 1229:                 if (variable_partagee == d_vrai)
 1230:                 {
 1231:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1232:                             .s_liste_variables_partagees).mutex)) != 0)
 1233:                     {
 1234:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1235:                         return;
 1236:                     }
 1237:                 }
 1238: 
 1239:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1240:                 return;
 1241:             }
 1242: 
 1243:             for(i = 0; i < nombre_lignes; i++)
 1244:             {
 1245:                 if (i < (*((struct_vecteur *) (*s_objet_initial).objet)).taille)
 1246:                 {
 1247:                     ((real8 *) (*((struct_vecteur *)
 1248:                             (*s_objet_redimensionne).objet)).tableau)[i] =
 1249:                             ((real8 *) (*((struct_vecteur *)
 1250:                             (*s_objet_initial).objet)).tableau)[i];
 1251:                 }
 1252:                 else
 1253:                 {
 1254:                     ((real8 *) (*((struct_vecteur *)
 1255:                             (*s_objet_redimensionne).objet)).tableau)[i] =
 1256:                             (real8) 0;
 1257:                 }
 1258:             }
 1259:         }
 1260:         else if ((*s_objet_initial).type == VCX)
 1261:         {
 1262:             (*s_objet_redimensionne).type = VCX;
 1263: 
 1264:             if (((*s_objet_redimensionne).objet =
 1265:                     malloc(sizeof(struct_vecteur))) == NULL)
 1266:             {
 1267:                 if (variable_partagee == d_vrai)
 1268:                 {
 1269:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1270:                             .s_liste_variables_partagees).mutex)) != 0)
 1271:                     {
 1272:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1273:                         return;
 1274:                     }
 1275:                 }
 1276: 
 1277:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1278:                 return;
 1279:             }
 1280: 
 1281:             (*((struct_vecteur *) (*s_objet_redimensionne).objet)).type = 'C';
 1282:             (*((struct_vecteur *) (*s_objet_redimensionne).objet)).taille =
 1283:                     nombre_lignes;
 1284: 
 1285:             if (((*((struct_vecteur *) (*s_objet_redimensionne).objet)).tableau
 1286:                     = malloc(nombre_lignes * sizeof(struct_complexe16)))
 1287:                     == NULL)
 1288:             {
 1289:                 if (variable_partagee == d_vrai)
 1290:                 {
 1291:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1292:                             .s_liste_variables_partagees).mutex)) != 0)
 1293:                     {
 1294:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1295:                         return;
 1296:                     }
 1297:                 }
 1298: 
 1299:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1300:                 return;
 1301:             }
 1302: 
 1303:             for(i = 0; i < nombre_lignes; i++)
 1304:             {
 1305:                 if (i < (*((struct_vecteur *) (*s_objet_initial).objet)).taille)
 1306:                 {
 1307:                     ((struct_complexe16 *) (*((struct_vecteur *)
 1308:                             (*s_objet_redimensionne).objet)).tableau)[i]
 1309:                             .partie_reelle = ((struct_complexe16 *)
 1310:                             (*((struct_vecteur *) (*s_objet_initial).objet))
 1311:                             .tableau)[i].partie_reelle;
 1312:                     ((struct_complexe16 *) (*((struct_vecteur *)
 1313:                             (*s_objet_redimensionne).objet)).tableau)[i]
 1314:                             .partie_imaginaire = ((struct_complexe16 *)
 1315:                             (*((struct_vecteur *) (*s_objet_initial).objet))
 1316:                             .tableau)[i].partie_imaginaire;
 1317:                 }
 1318:                 else
 1319:                 {
 1320:                     ((struct_complexe16 *) (*((struct_vecteur *)
 1321:                             (*s_objet_redimensionne).objet)).tableau)[i]
 1322:                             .partie_reelle = (real8) 0;
 1323:                     ((struct_complexe16 *) (*((struct_vecteur *)
 1324:                             (*s_objet_redimensionne).objet)).tableau)[i]
 1325:                             .partie_imaginaire = (real8) 0;
 1326:                 }
 1327:             }
 1328:         }
 1329:         else if ((*s_objet_initial).type == MIN)
 1330:         {
 1331:             (*s_objet_redimensionne).type = VIN;
 1332: 
 1333:             if (((*s_objet_redimensionne).objet =
 1334:                     malloc(sizeof(struct_vecteur))) == NULL)
 1335:             {
 1336:                 if (variable_partagee == d_vrai)
 1337:                 {
 1338:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1339:                             .s_liste_variables_partagees).mutex)) != 0)
 1340:                     {
 1341:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1342:                         return;
 1343:                     }
 1344:                 }
 1345: 
 1346:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1347:                 return;
 1348:             }
 1349: 
 1350:             (*((struct_vecteur *) (*s_objet_redimensionne).objet)).type = 'I';
 1351:             (*((struct_vecteur *) (*s_objet_redimensionne).objet)).taille =
 1352:                     nombre_lignes;
 1353: 
 1354:             if (((*((struct_vecteur *) (*s_objet_redimensionne).objet)).tableau
 1355:                     = malloc(nombre_lignes * sizeof(integer8))) == NULL)
 1356:             {
 1357:                 if (variable_partagee == d_vrai)
 1358:                 {
 1359:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1360:                             .s_liste_variables_partagees).mutex)) != 0)
 1361:                     {
 1362:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1363:                         return;
 1364:                     }
 1365:                 }
 1366: 
 1367:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1368:                 return;
 1369:             }
 1370: 
 1371:             drapeau_fin_objet_originel = d_faux;
 1372:             for(i = 0, j = 0, k = 0; i < nombre_lignes; i++)
 1373:             {
 1374:                 if (drapeau_fin_objet_originel == d_faux)
 1375:                 {
 1376:                     ((integer8 *) (*((struct_vecteur *)
 1377:                             (*s_objet_redimensionne).objet)).tableau)[i] =
 1378:                             ((integer8 **) (*((struct_matrice *)
 1379:                             (*s_objet_initial).objet)).tableau)[j][k];
 1380: 
 1381:                     if ((++k) >= (*((struct_matrice *) (*s_objet_initial)
 1382:                             .objet)).nombre_colonnes)
 1383:                     {
 1384:                         k = 0;
 1385: 
 1386:                         if ((++j) >= (*((struct_matrice *) (*s_objet_initial)
 1387:                                 .objet)).nombre_lignes)
 1388:                         {
 1389:                             drapeau_fin_objet_originel = d_vrai;
 1390:                         }
 1391:                     }
 1392:                 }
 1393:                 else
 1394:                 {
 1395:                     ((integer8 *) (*((struct_vecteur *)
 1396:                             (*s_objet_redimensionne).objet)).tableau)[i] = 0;
 1397:                 }
 1398:             }
 1399:         }
 1400:         else if ((*s_objet_initial).type == MRL)
 1401:         {
 1402:             (*s_objet_redimensionne).type = VRL;
 1403: 
 1404:             if (((*s_objet_redimensionne).objet =
 1405:                     malloc(sizeof(struct_vecteur))) == NULL)
 1406:             {
 1407:                 if (variable_partagee == d_vrai)
 1408:                 {
 1409:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1410:                             .s_liste_variables_partagees).mutex)) != 0)
 1411:                     {
 1412:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1413:                         return;
 1414:                     }
 1415:                 }
 1416: 
 1417:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1418:                 return;
 1419:             }
 1420: 
 1421:             (*((struct_vecteur *) (*s_objet_redimensionne).objet)).type = 'R';
 1422:             (*((struct_vecteur *) (*s_objet_redimensionne).objet)).taille =
 1423:                     nombre_lignes;
 1424: 
 1425:             if (((*((struct_vecteur *) (*s_objet_redimensionne).objet)).tableau
 1426:                     = malloc(nombre_lignes * sizeof(real8))) == NULL)
 1427:             {
 1428:                 if (variable_partagee == d_vrai)
 1429:                 {
 1430:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1431:                             .s_liste_variables_partagees).mutex)) != 0)
 1432:                     {
 1433:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1434:                         return;
 1435:                     }
 1436:                 }
 1437: 
 1438:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1439:                 return;
 1440:             }
 1441: 
 1442:             drapeau_fin_objet_originel = d_faux;
 1443:             for(i = 0, j = 0, k = 0; i < nombre_lignes; i++)
 1444:             {
 1445:                 if (drapeau_fin_objet_originel == d_faux)
 1446:                 {
 1447:                     ((real8 *) (*((struct_vecteur *)
 1448:                             (*s_objet_redimensionne).objet)).tableau)[i] =
 1449:                             ((real8 **) (*((struct_matrice *)
 1450:                             (*s_objet_initial).objet)).tableau)[j][k];
 1451: 
 1452:                     if ((++k) >= (*((struct_matrice *) (*s_objet_initial)
 1453:                             .objet)).nombre_colonnes)
 1454:                     {
 1455:                         k = 0;
 1456: 
 1457:                         if ((++j) >= (*((struct_matrice *) (*s_objet_initial)
 1458:                                 .objet)).nombre_lignes)
 1459:                         {
 1460:                             drapeau_fin_objet_originel = d_vrai;
 1461:                         }
 1462:                     }
 1463:                 }
 1464:                 else
 1465:                 {
 1466:                     ((real8 *) (*((struct_vecteur *)
 1467:                             (*s_objet_redimensionne).objet)).tableau)[i] =
 1468:                             (real8) 0;
 1469:                 }
 1470:             }
 1471:         }
 1472:         else if ((*s_objet_initial).type == MCX)
 1473:         {
 1474:             (*s_objet_redimensionne).type = VCX;
 1475: 
 1476:             if (((*s_objet_redimensionne).objet =
 1477:                     malloc(sizeof(struct_vecteur))) == NULL)
 1478:             {
 1479:                 if (variable_partagee == d_vrai)
 1480:                 {
 1481:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1482:                             .s_liste_variables_partagees).mutex)) != 0)
 1483:                     {
 1484:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1485:                         return;
 1486:                     }
 1487:                 }
 1488: 
 1489:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1490:                 return;
 1491:             }
 1492: 
 1493:             (*((struct_vecteur *) (*s_objet_redimensionne).objet)).type = 'C';
 1494:             (*((struct_vecteur *) (*s_objet_redimensionne).objet)).taille =
 1495:                     nombre_lignes;
 1496: 
 1497:             if (((*((struct_vecteur *) (*s_objet_redimensionne).objet)).tableau
 1498:                     = malloc(nombre_lignes * sizeof(struct_complexe16)))
 1499:                     == NULL)
 1500:             {
 1501:                 if (variable_partagee == d_vrai)
 1502:                 {
 1503:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1504:                             .s_liste_variables_partagees).mutex)) != 0)
 1505:                     {
 1506:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1507:                         return;
 1508:                     }
 1509:                 }
 1510: 
 1511:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1512:                 return;
 1513:             }
 1514: 
 1515:             drapeau_fin_objet_originel = d_faux;
 1516:             for(i = 0, j = 0, k = 0; i < nombre_lignes; i++)
 1517:             {
 1518:                 if (drapeau_fin_objet_originel == d_faux)
 1519:                 {
 1520:                     ((struct_complexe16 *) (*((struct_vecteur *)
 1521:                             (*s_objet_redimensionne).objet)).tableau)[i]
 1522:                             .partie_reelle = ((struct_complexe16 **)
 1523:                             (*((struct_matrice *) (*s_objet_initial).objet))
 1524:                             .tableau)[j][k].partie_reelle;
 1525:                     ((struct_complexe16 *) (*((struct_vecteur *)
 1526:                             (*s_objet_redimensionne).objet)).tableau)[i]
 1527:                             .partie_imaginaire = ((struct_complexe16 **)
 1528:                             (*((struct_matrice *) (*s_objet_initial).objet))
 1529:                             .tableau)[j][k].partie_imaginaire;
 1530: 
 1531:                     if ((++k) >= (*((struct_matrice *) (*s_objet_initial)
 1532:                             .objet)).nombre_colonnes)
 1533:                     {
 1534:                         k = 0;
 1535: 
 1536:                         if ((++j) >= (*((struct_matrice *) (*s_objet_initial)
 1537:                                 .objet)).nombre_lignes)
 1538:                         {
 1539:                             drapeau_fin_objet_originel = d_vrai;
 1540:                         }
 1541:                     }
 1542:                 }
 1543:                 else
 1544:                 {
 1545:                     ((struct_complexe16 *) (*((struct_vecteur *)
 1546:                             (*s_objet_redimensionne).objet)).tableau)[i]
 1547:                             .partie_reelle = 0;
 1548:                     ((struct_complexe16 *) (*((struct_vecteur *)
 1549:                             (*s_objet_redimensionne).objet)).tableau)[i]
 1550:                             .partie_imaginaire = 0;
 1551:                 }
 1552:             }
 1553:         }
 1554:         else
 1555:         {
 1556:             if (variable_partagee == d_vrai)
 1557:             {
 1558:                 if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1559:                         .s_liste_variables_partagees).mutex)) != 0)
 1560:                 {
 1561:                     (*s_etat_processus).erreur_systeme = d_es_processus;
 1562:                     return;
 1563:                 }
 1564:             }
 1565: 
 1566:             if (argument_nom == d_faux)
 1567:             {
 1568:                 liberation(s_etat_processus, s_objet_initial);
 1569:             }
 1570: 
 1571:             liberation(s_etat_processus, s_objet_dimensions);
 1572:             free(s_objet_redimensionne);
 1573: 
 1574:             (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
 1575:             return;
 1576:         }
 1577:     }
 1578: 
 1579: /*
 1580: --------------------------------------------------------------------------------
 1581:   Redimensionnement aboutissant à une matrice
 1582: --------------------------------------------------------------------------------
 1583: */
 1584: 
 1585:     else
 1586:     {
 1587:         if ((*s_objet_initial).type == VIN)
 1588:         {
 1589:             (*s_objet_redimensionne).type = MIN;
 1590: 
 1591:             if (((*s_objet_redimensionne).objet =
 1592:                     malloc(sizeof(struct_matrice))) == NULL)
 1593:             {
 1594:                 if (variable_partagee == d_vrai)
 1595:                 {
 1596:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1597:                             .s_liste_variables_partagees).mutex)) != 0)
 1598:                     {
 1599:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1600:                         return;
 1601:                     }
 1602:                 }
 1603: 
 1604:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1605:                 return;
 1606:             }
 1607: 
 1608:             (*((struct_matrice *) (*s_objet_redimensionne).objet)).type = 'I';
 1609:             (*((struct_matrice *) (*s_objet_redimensionne).objet))
 1610:                     .nombre_lignes = nombre_lignes;
 1611:             (*((struct_matrice *) (*s_objet_redimensionne).objet))
 1612:                     .nombre_colonnes = nombre_colonnes;
 1613: 
 1614:             if (((*((struct_matrice *) (*s_objet_redimensionne).objet)).tableau
 1615:                     = malloc(nombre_lignes * sizeof(integer8 *)))
 1616:                     == NULL)
 1617:             {
 1618:                 if (variable_partagee == d_vrai)
 1619:                 {
 1620:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1621:                             .s_liste_variables_partagees).mutex)) != 0)
 1622:                     {
 1623:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1624:                         return;
 1625:                     }
 1626:                 }
 1627: 
 1628:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1629:                 return;
 1630:             }
 1631: 
 1632:             for(i = 0, k = 0; i < nombre_lignes; i++)
 1633:             {
 1634:                 if ((((integer8 **) (*((struct_matrice *)
 1635:                         (*s_objet_redimensionne).objet)).tableau)[i] =
 1636:                         malloc(nombre_colonnes * sizeof(integer8))) == NULL)
 1637:                 {
 1638:                     if (variable_partagee == d_vrai)
 1639:                     {
 1640:                         if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1641:                                 .s_liste_variables_partagees).mutex)) != 0)
 1642:                         {
 1643:                             (*s_etat_processus).erreur_systeme = d_es_processus;
 1644:                             return;
 1645:                         }
 1646:                     }
 1647: 
 1648:                     (*s_etat_processus).erreur_systeme =
 1649:                             d_es_allocation_memoire;
 1650:                     return;
 1651:                 }
 1652: 
 1653:                 for(j = 0; j < nombre_colonnes; j++)
 1654:                 {
 1655:                     if (k < (*((struct_vecteur *) (*s_objet_initial)
 1656:                             .objet)).taille)
 1657:                     {
 1658:                         ((integer8 **) (*((struct_matrice *)
 1659:                                 (*s_objet_redimensionne).objet)).tableau)
 1660:                                 [i][j] = ((integer8 *) (*((struct_vecteur *)
 1661:                                 (*s_objet_initial).objet)).tableau)[k++];
 1662:                     }
 1663:                     else
 1664:                     {
 1665:                         ((integer8 **) (*((struct_matrice *)
 1666:                                 (*s_objet_redimensionne).objet)).tableau)
 1667:                                 [i][j] = 0;
 1668:                     }
 1669:                 }
 1670:             }
 1671:         }
 1672:         else if ((*s_objet_initial).type == VRL)
 1673:         {
 1674:             (*s_objet_redimensionne).type = MRL;
 1675: 
 1676:             if (((*s_objet_redimensionne).objet =
 1677:                     malloc(sizeof(struct_matrice))) == NULL)
 1678:             {
 1679:                 if (variable_partagee == d_vrai)
 1680:                 {
 1681:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1682:                             .s_liste_variables_partagees).mutex)) != 0)
 1683:                     {
 1684:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1685:                         return;
 1686:                     }
 1687:                 }
 1688: 
 1689:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1690:                 return;
 1691:             }
 1692: 
 1693:             (*((struct_matrice *) (*s_objet_redimensionne).objet)).type = 'R';
 1694:             (*((struct_matrice *) (*s_objet_redimensionne).objet))
 1695:                     .nombre_lignes = nombre_lignes;
 1696:             (*((struct_matrice *) (*s_objet_redimensionne).objet))
 1697:                     .nombre_colonnes = nombre_colonnes;
 1698: 
 1699:             if (((*((struct_matrice *) (*s_objet_redimensionne).objet)).tableau
 1700:                     = malloc(nombre_lignes * sizeof(real8 *)))
 1701:                     == NULL)
 1702:             {
 1703:                 if (variable_partagee == d_vrai)
 1704:                 {
 1705:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1706:                             .s_liste_variables_partagees).mutex)) != 0)
 1707:                     {
 1708:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1709:                         return;
 1710:                     }
 1711:                 }
 1712: 
 1713:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1714:                 return;
 1715:             }
 1716: 
 1717:             for(i = 0, k = 0; i < nombre_lignes; i++)
 1718:             {
 1719:                 if ((((real8 **) (*((struct_matrice *)
 1720:                         (*s_objet_redimensionne).objet)).tableau)[i] =
 1721:                         malloc(nombre_colonnes * sizeof(real8))) == NULL)
 1722:                 {
 1723:                     if (variable_partagee == d_vrai)
 1724:                     {
 1725:                         if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1726:                                 .s_liste_variables_partagees).mutex)) != 0)
 1727:                         {
 1728:                             (*s_etat_processus).erreur_systeme = d_es_processus;
 1729:                             return;
 1730:                         }
 1731:                     }
 1732: 
 1733:                     (*s_etat_processus).erreur_systeme =
 1734:                             d_es_allocation_memoire;
 1735:                     return;
 1736:                 }
 1737: 
 1738:                 for(j = 0; j < nombre_colonnes; j++)
 1739:                 {
 1740:                     if (k < (*((struct_vecteur *) (*s_objet_initial)
 1741:                             .objet)).taille)
 1742:                     {
 1743:                         ((real8 **) (*((struct_matrice *)
 1744:                                 (*s_objet_redimensionne).objet)).tableau)
 1745:                                 [i][j] = ((real8 *) (*((struct_vecteur *)
 1746:                                 (*s_objet_initial).objet)).tableau)[k++];
 1747:                     }
 1748:                     else
 1749:                     {
 1750:                         ((real8 **) (*((struct_matrice *)
 1751:                                 (*s_objet_redimensionne).objet)).tableau)
 1752:                                 [i][j] = (real8) 0;
 1753:                     }
 1754:                 }
 1755:             }
 1756:         }
 1757:         else if ((*s_objet_initial).type == VCX)
 1758:         {
 1759:             (*s_objet_redimensionne).type = MCX;
 1760: 
 1761:             if (((*s_objet_redimensionne).objet =
 1762:                     malloc(sizeof(struct_matrice))) == NULL)
 1763:             {
 1764:                 if (variable_partagee == d_vrai)
 1765:                 {
 1766:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1767:                             .s_liste_variables_partagees).mutex)) != 0)
 1768:                     {
 1769:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1770:                         return;
 1771:                     }
 1772:                 }
 1773: 
 1774:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1775:                 return;
 1776:             }
 1777: 
 1778:             (*((struct_matrice *) (*s_objet_redimensionne).objet)).type = 'C';
 1779:             (*((struct_matrice *) (*s_objet_redimensionne).objet))
 1780:                     .nombre_lignes = nombre_lignes;
 1781:             (*((struct_matrice *) (*s_objet_redimensionne).objet))
 1782:                     .nombre_colonnes = nombre_colonnes;
 1783: 
 1784:             if (((*((struct_matrice *) (*s_objet_redimensionne).objet)).tableau
 1785:                     = malloc(nombre_lignes * sizeof(struct_complexe16 *)))
 1786:                     == NULL)
 1787:             {
 1788:                 if (variable_partagee == d_vrai)
 1789:                 {
 1790:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1791:                             .s_liste_variables_partagees).mutex)) != 0)
 1792:                     {
 1793:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1794:                         return;
 1795:                     }
 1796:                 }
 1797: 
 1798:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1799:                 return;
 1800:             }
 1801: 
 1802:             for(i = 0, k = 0; i < nombre_lignes; i++)
 1803:             {
 1804:                 if ((((struct_complexe16 **) (*((struct_matrice *)
 1805:                         (*s_objet_redimensionne).objet)).tableau)[i] =
 1806:                         malloc(nombre_colonnes *
 1807:                         sizeof(struct_complexe16))) == NULL)
 1808:                 {
 1809:                     if (variable_partagee == d_vrai)
 1810:                     {
 1811:                         if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1812:                                 .s_liste_variables_partagees).mutex)) != 0)
 1813:                         {
 1814:                             (*s_etat_processus).erreur_systeme = d_es_processus;
 1815:                             return;
 1816:                         }
 1817:                     }
 1818: 
 1819:                     (*s_etat_processus).erreur_systeme =
 1820:                             d_es_allocation_memoire;
 1821:                     return;
 1822:                 }
 1823: 
 1824:                 for(j = 0; j < nombre_colonnes; j++)
 1825:                 {
 1826:                     if (k < (*((struct_vecteur *) (*s_objet_initial)
 1827:                             .objet)).taille)
 1828:                     {
 1829:                         ((struct_complexe16 **) (*((struct_matrice *)
 1830:                                 (*s_objet_redimensionne).objet)).tableau)
 1831:                                 [i][j].partie_reelle =
 1832:                                 ((struct_complexe16 *) (*((struct_vecteur *)
 1833:                                 (*s_objet_initial).objet)).tableau)[k]
 1834:                                 .partie_reelle;
 1835:                         ((struct_complexe16 **) (*((struct_matrice *)
 1836:                                 (*s_objet_redimensionne).objet)).tableau)
 1837:                                 [i][j].partie_imaginaire =
 1838:                                 ((struct_complexe16 *) (*((struct_vecteur *)
 1839:                                 (*s_objet_initial).objet)).tableau)[k++]
 1840:                                 .partie_imaginaire;
 1841:                     }
 1842:                     else
 1843:                     {
 1844:                         ((struct_complexe16 **) (*((struct_matrice *)
 1845:                                 (*s_objet_redimensionne).objet)).tableau)
 1846:                                 [i][j].partie_reelle = (real8) 0;
 1847:                         ((struct_complexe16 **) (*((struct_matrice *)
 1848:                                 (*s_objet_redimensionne).objet)).tableau)
 1849:                                 [i][j].partie_imaginaire = (real8) 0;
 1850:                     }
 1851:                 }
 1852:             }
 1853:         }
 1854:         else if ((*s_objet_initial).type == MIN)
 1855:         {
 1856:             (*s_objet_redimensionne).type = MIN;
 1857: 
 1858:             if (((*s_objet_redimensionne).objet =
 1859:                     malloc(sizeof(struct_matrice))) == NULL)
 1860:             {
 1861:                 if (variable_partagee == d_vrai)
 1862:                 {
 1863:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1864:                             .s_liste_variables_partagees).mutex)) != 0)
 1865:                     {
 1866:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1867:                         return;
 1868:                     }
 1869:                 }
 1870: 
 1871:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1872:                 return;
 1873:             }
 1874: 
 1875:             (*((struct_matrice *) (*s_objet_redimensionne).objet)).type = 'I';
 1876:             (*((struct_matrice *) (*s_objet_redimensionne).objet))
 1877:                     .nombre_lignes = nombre_lignes;
 1878:             (*((struct_matrice *) (*s_objet_redimensionne).objet))
 1879:                     .nombre_colonnes = nombre_colonnes;
 1880: 
 1881:             if (((*((struct_matrice *) (*s_objet_redimensionne).objet)).tableau
 1882:                     = malloc(nombre_lignes * sizeof(integer8 *)))
 1883:                     == NULL)
 1884:             {
 1885:                 if (variable_partagee == d_vrai)
 1886:                 {
 1887:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1888:                             .s_liste_variables_partagees).mutex)) != 0)
 1889:                     {
 1890:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1891:                         return;
 1892:                     }
 1893:                 }
 1894: 
 1895:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1896:                 return;
 1897:             }
 1898: 
 1899:             drapeau_fin_objet_originel = d_faux;
 1900: 
 1901:             for(i = 0, k = 0, l = 0; i < nombre_lignes; i++)
 1902:             {
 1903:                 if ((((integer8 **) (*((struct_matrice *)
 1904:                         (*s_objet_redimensionne).objet)).tableau)[i] =
 1905:                         malloc(nombre_colonnes *
 1906:                         sizeof(integer8))) == NULL)
 1907:                 {
 1908:                     if (variable_partagee == d_vrai)
 1909:                     {
 1910:                         if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1911:                                 .s_liste_variables_partagees).mutex)) != 0)
 1912:                         {
 1913:                             (*s_etat_processus).erreur_systeme = d_es_processus;
 1914:                             return;
 1915:                         }
 1916:                     }
 1917: 
 1918:                     (*s_etat_processus).erreur_systeme =
 1919:                             d_es_allocation_memoire;
 1920:                     return;
 1921:                 }
 1922: 
 1923:                 for(j = 0; j < nombre_colonnes; j++)
 1924:                 {
 1925:                     if (drapeau_fin_objet_originel == d_faux)
 1926:                     {
 1927:                         ((integer8 **) (*((struct_matrice *)
 1928:                                 (*s_objet_redimensionne).objet)).tableau)
 1929:                                 [i][j] = ((integer8 **) (*((struct_matrice *)
 1930:                                 (*s_objet_initial).objet)).tableau)[k][l];
 1931: 
 1932:                         if ((++l) >= (*((struct_matrice *) (*s_objet_initial)
 1933:                                 .objet)).nombre_colonnes)
 1934:                         {
 1935:                             l = 0;
 1936: 
 1937:                             if ((++k) >= (*((struct_matrice *)
 1938:                                     (*s_objet_initial).objet)).nombre_lignes)
 1939:                             {
 1940:                                 drapeau_fin_objet_originel = d_vrai;
 1941:                             }
 1942:                         }
 1943:                     }
 1944:                     else
 1945:                     {
 1946:                         ((integer8 **) (*((struct_matrice *)
 1947:                                 (*s_objet_redimensionne).objet)).tableau)
 1948:                                 [i][j] = 0;
 1949:                     }
 1950:                 }
 1951:             }
 1952:         }
 1953:         else if ((*s_objet_initial).type == MRL)
 1954:         {
 1955:             (*s_objet_redimensionne).type = MRL;
 1956: 
 1957:             if (((*s_objet_redimensionne).objet =
 1958:                     malloc(sizeof(struct_matrice))) == NULL)
 1959:             {
 1960:                 if (variable_partagee == d_vrai)
 1961:                 {
 1962:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1963:                             .s_liste_variables_partagees).mutex)) != 0)
 1964:                     {
 1965:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1966:                         return;
 1967:                     }
 1968:                 }
 1969: 
 1970:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1971:                 return;
 1972:             }
 1973: 
 1974:             (*((struct_matrice *) (*s_objet_redimensionne).objet)).type = 'R';
 1975:             (*((struct_matrice *) (*s_objet_redimensionne).objet))
 1976:                     .nombre_lignes = nombre_lignes;
 1977:             (*((struct_matrice *) (*s_objet_redimensionne).objet))
 1978:                     .nombre_colonnes = nombre_colonnes;
 1979: 
 1980:             if (((*((struct_matrice *) (*s_objet_redimensionne).objet)).tableau
 1981:                     = malloc(nombre_lignes * sizeof(real8 *)))
 1982:                     == NULL)
 1983:             {
 1984:                 if (variable_partagee == d_vrai)
 1985:                 {
 1986:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 1987:                             .s_liste_variables_partagees).mutex)) != 0)
 1988:                     {
 1989:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1990:                         return;
 1991:                     }
 1992:                 }
 1993: 
 1994:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1995:                 return;
 1996:             }
 1997: 
 1998:             drapeau_fin_objet_originel = d_faux;
 1999: 
 2000:             for(i = 0, k = 0, l = 0; i < nombre_lignes; i++)
 2001:             {
 2002:                 if ((((real8 **) (*((struct_matrice *)
 2003:                         (*s_objet_redimensionne).objet)).tableau)[i] =
 2004:                         malloc(nombre_colonnes *
 2005:                         sizeof(real8))) == NULL)
 2006:                 {
 2007:                     if (variable_partagee == d_vrai)
 2008:                     {
 2009:                         if (pthread_mutex_unlock(&((*(*s_etat_processus)
 2010:                                 .s_liste_variables_partagees).mutex)) != 0)
 2011:                         {
 2012:                             (*s_etat_processus).erreur_systeme = d_es_processus;
 2013:                             return;
 2014:                         }
 2015:                     }
 2016: 
 2017:                     (*s_etat_processus).erreur_systeme =
 2018:                             d_es_allocation_memoire;
 2019:                     return;
 2020:                 }
 2021: 
 2022:                 for(j = 0; j < nombre_colonnes; j++)
 2023:                 {
 2024:                     if (drapeau_fin_objet_originel == d_faux)
 2025:                     {
 2026:                         ((real8 **) (*((struct_matrice *)
 2027:                                 (*s_objet_redimensionne).objet)).tableau)
 2028:                                 [i][j] = ((real8 **) (*((struct_matrice *)
 2029:                                 (*s_objet_initial).objet)).tableau)[k][l];
 2030: 
 2031:                         if ((++l) >= (*((struct_matrice *) (*s_objet_initial)
 2032:                                 .objet)).nombre_colonnes)
 2033:                         {
 2034:                             l = 0;
 2035: 
 2036:                             if ((++k) >= (*((struct_matrice *)
 2037:                                     (*s_objet_initial).objet)).nombre_lignes)
 2038:                             {
 2039:                                 drapeau_fin_objet_originel = d_vrai;
 2040:                             }
 2041:                         }
 2042:                     }
 2043:                     else
 2044:                     {
 2045:                         ((real8 **) (*((struct_matrice *)
 2046:                                 (*s_objet_redimensionne).objet)).tableau)
 2047:                                 [i][j] = (real8) 0;
 2048:                     }
 2049:                 }
 2050:             }
 2051:         }
 2052:         else if ((*s_objet_initial).type == MCX)
 2053:         {
 2054:             (*s_objet_redimensionne).type = MCX;
 2055: 
 2056:             if (((*s_objet_redimensionne).objet =
 2057:                     malloc(sizeof(struct_matrice))) == NULL)
 2058:             {
 2059:                 if (variable_partagee == d_vrai)
 2060:                 {
 2061:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 2062:                             .s_liste_variables_partagees).mutex)) != 0)
 2063:                     {
 2064:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 2065:                         return;
 2066:                     }
 2067:                 }
 2068: 
 2069:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 2070:                 return;
 2071:             }
 2072: 
 2073:             (*((struct_matrice *) (*s_objet_redimensionne).objet)).type = 'C';
 2074:             (*((struct_matrice *) (*s_objet_redimensionne).objet))
 2075:                     .nombre_lignes = nombre_lignes;
 2076:             (*((struct_matrice *) (*s_objet_redimensionne).objet))
 2077:                     .nombre_colonnes = nombre_colonnes;
 2078: 
 2079:             if (((*((struct_matrice *) (*s_objet_redimensionne).objet)).tableau
 2080:                     = malloc(nombre_lignes * sizeof(struct_complexe16 *)))
 2081:                     == NULL)
 2082:             {
 2083:                 if (variable_partagee == d_vrai)
 2084:                 {
 2085:                     if (pthread_mutex_unlock(&((*(*s_etat_processus)
 2086:                             .s_liste_variables_partagees).mutex)) != 0)
 2087:                     {
 2088:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 2089:                         return;
 2090:                     }
 2091:                 }
 2092: 
 2093:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 2094:                 return;
 2095:             }
 2096: 
 2097:             drapeau_fin_objet_originel = d_faux;
 2098: 
 2099:             for(i = 0, k = 0, l = 0; i < nombre_lignes; i++)
 2100:             {
 2101:                 if ((((struct_complexe16 **) (*((struct_matrice *)
 2102:                         (*s_objet_redimensionne).objet)).tableau)[i] =
 2103:                         malloc(nombre_colonnes *
 2104:                         sizeof(struct_complexe16))) == NULL)
 2105:                 {
 2106:                     if (variable_partagee == d_vrai)
 2107:                     {
 2108:                         if (pthread_mutex_unlock(&((*(*s_etat_processus)
 2109:                                 .s_liste_variables_partagees).mutex)) != 0)
 2110:                         {
 2111:                             (*s_etat_processus).erreur_systeme = d_es_processus;
 2112:                             return;
 2113:                         }
 2114:                     }
 2115: 
 2116:                     (*s_etat_processus).erreur_systeme =
 2117:                             d_es_allocation_memoire;
 2118:                     return;
 2119:                 }
 2120: 
 2121:                 for(j = 0; j < nombre_colonnes; j++)
 2122:                 {
 2123:                     if (drapeau_fin_objet_originel == d_faux)
 2124:                     {
 2125:                         ((struct_complexe16 **) (*((struct_matrice *)
 2126:                                 (*s_objet_redimensionne).objet)).tableau)
 2127:                                 [i][j].partie_reelle = ((struct_complexe16 **)
 2128:                                 (*((struct_matrice *) (*s_objet_initial).objet))
 2129:                                 .tableau)[k][l].partie_reelle;
 2130: 
 2131:                         ((struct_complexe16 **) (*((struct_matrice *)
 2132:                                 (*s_objet_redimensionne).objet)).tableau)
 2133:                                 [i][j].partie_imaginaire =
 2134:                                 ((struct_complexe16 **) (*((struct_matrice *)
 2135:                                 (*s_objet_initial).objet)).tableau)[k][l]
 2136:                                 .partie_imaginaire; 
 2137: 
 2138:                         if ((++l) >= (*((struct_matrice *) (*s_objet_initial)
 2139:                                 .objet)).nombre_colonnes)
 2140:                         {
 2141:                             l = 0;
 2142: 
 2143:                             if ((++k) >= (*((struct_matrice *)
 2144:                                     (*s_objet_initial).objet)).nombre_lignes)
 2145:                             {
 2146:                                 drapeau_fin_objet_originel = d_vrai;
 2147:                             }
 2148:                         }
 2149:                     }
 2150:                     else
 2151:                     {
 2152:                         ((struct_complexe16 **) (*((struct_matrice *)
 2153:                                 (*s_objet_redimensionne).objet)).tableau)
 2154:                                 [i][j].partie_reelle = (real8) 0;
 2155:                         ((struct_complexe16 **) (*((struct_matrice *)
 2156:                                 (*s_objet_redimensionne).objet)).tableau)
 2157:                                 [i][j].partie_imaginaire = (real8) 0;
 2158:                     }
 2159:                 }
 2160:             }
 2161:         }
 2162:         else
 2163:         {
 2164:             if (variable_partagee == d_vrai)
 2165:             {
 2166:                 if (pthread_mutex_unlock(&((*(*s_etat_processus)
 2167:                         .s_liste_variables_partagees).mutex)) != 0)
 2168:                 {
 2169:                     (*s_etat_processus).erreur_systeme = d_es_processus;
 2170:                     return;
 2171:                 }
 2172:             }
 2173: 
 2174:             if (argument_nom == d_faux)
 2175:             {
 2176:                 liberation(s_etat_processus, s_objet_initial);
 2177:             }
 2178: 
 2179:             liberation(s_etat_processus, s_objet_dimensions);
 2180:             free(s_objet_redimensionne);
 2181: 
 2182:             (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
 2183:             return;
 2184:         }
 2185:     }
 2186: 
 2187:     liberation(s_etat_processus, s_objet_dimensions);
 2188:     liberation(s_etat_processus, s_objet_initial);
 2189: 
 2190:     if (argument_nom == d_faux)
 2191:     {
 2192:         if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
 2193:                 s_objet_redimensionne) == d_erreur)
 2194:         {
 2195:             return;
 2196:         }
 2197:     }
 2198:     else
 2199:     {
 2200:         if (variable_partagee == d_vrai)
 2201:         {
 2202:             (*(*s_etat_processus).s_liste_variables_partagees).table
 2203:                     [(*(*s_etat_processus).s_liste_variables_partagees)
 2204:                     .position_variable].objet = s_objet_redimensionne;
 2205: 
 2206:             if (pthread_mutex_unlock(&((*(*s_etat_processus)
 2207:                     .s_liste_variables_partagees).mutex)) != 0)
 2208:             {
 2209:                 (*s_etat_processus).erreur_systeme = d_es_processus;
 2210:                 return;
 2211:             }
 2212:         }
 2213:         else
 2214:         {
 2215:             (*s_etat_processus).s_liste_variables
 2216:                     [(*s_etat_processus).position_variable_courante].objet =
 2217:                     s_objet_redimensionne;
 2218:         }
 2219:     }
 2220: 
 2221:     return;
 2222: }
 2223: 
 2224: // vim: ts=4

CVSweb interface <joel.bertrand@systella.fr>