Annotation of rpl/src/instructions_r2.c, revision 1.39

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

CVSweb interface <joel.bertrand@systella.fr>