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

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

CVSweb interface <joel.bertrand@systella.fr>