Annotation of rpl/src/instructions_c4.c, revision 1.80

1.1       bertrand    1: /*
                      2: ================================================================================
1.80    ! bertrand    3:   RPL/2 (R) version 4.1.34
1.79      bertrand    4:   Copyright (C) 1989-2021 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.14      bertrand   23: #include "rpl-conv.h"
                     24: #include "convert-conv.h"
1.1       bertrand   25: 
                     26: 
                     27: /*
                     28: ================================================================================
                     29:   Fonction 'cov'
                     30: ================================================================================
                     31:   Entrées :
                     32: --------------------------------------------------------------------------------
                     33:   Sorties :
                     34: --------------------------------------------------------------------------------
                     35:   Effets de bord : néant
                     36: ================================================================================
                     37: */
                     38: 
                     39: void
                     40: instruction_cov(struct_processus *s_etat_processus)
                     41: {
                     42:    logical1                            erreur;
                     43: 
                     44:    struct_objet                        *s_objet_statistique;
                     45:    struct_objet                        *s_objet_resultat;
                     46: 
1.40      bertrand   47:    integer8                            nombre_colonnes;
1.39      bertrand   48: 
1.1       bertrand   49:    (*s_etat_processus).erreur_execution = d_ex;
                     50: 
                     51:    if ((*s_etat_processus).affichage_arguments == 'Y')
                     52:    {
                     53:        printf("\n  COV ");
                     54: 
                     55:        if ((*s_etat_processus).langue == 'F')
                     56:        {
                     57:            printf("(covariance)\n\n");
                     58:        }
                     59:        else
                     60:        {
                     61:            printf("(covariance)\n\n");
                     62:        }
                     63: 
                     64:        printf("->  1: %s\n", d_REL);
                     65: 
                     66:        return;
                     67:    }
                     68:    else if ((*s_etat_processus).test_instruction == 'Y')
                     69:    {
                     70:        (*s_etat_processus).nombre_arguments = -1;
                     71:        return;
                     72:    }
                     73:    
                     74:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                     75:    {
                     76:        if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
                     77:        {
                     78:            return;
                     79:        }
                     80:    }
                     81: 
                     82:    /*
                     83:     * Recherche d'une variable globale référencée par SIGMA
                     84:     */
                     85: 
1.22      bertrand   86:    if (recherche_variable_globale(s_etat_processus, ds_sdat) == d_faux)
1.1       bertrand   87:    {
                     88:        /*
                     89:         * Aucune variable SIGMA
                     90:         */
                     91: 
                     92:        (*s_etat_processus).erreur_systeme = d_es;
                     93:        (*s_etat_processus).erreur_execution = d_ex_absence_observations;
                     94:        return;
                     95:    }
                     96:    else
                     97:    {
1.22      bertrand   98:        if (((*(*(*s_etat_processus).pointeur_variable_courante).objet)
                     99:                .type != MIN) && ((*(*(*s_etat_processus)
                    100:                .pointeur_variable_courante).objet).type != MRL))
1.1       bertrand  101:        {
1.22      bertrand  102:            (*s_etat_processus).erreur_execution =
                    103:                    d_ex_matrice_statistique_invalide;
1.1       bertrand  104:            return;
                    105:        }
                    106: 
1.22      bertrand  107:        nombre_colonnes = (*((struct_matrice *) (*(*(*s_etat_processus)
                    108:                .pointeur_variable_courante).objet).objet)).nombre_colonnes;
1.1       bertrand  109:    }
                    110: 
1.22      bertrand  111:    s_objet_statistique = (*(*s_etat_processus).pointeur_variable_courante)
                    112:            .objet;
1.1       bertrand  113: 
                    114:    if (((*s_objet_statistique).type == MIN) ||
                    115:            ((*s_objet_statistique).type == MRL))
                    116:    {
                    117:        if (((*s_etat_processus).colonne_statistique_1 < 1) ||
                    118:                ((*s_etat_processus).colonne_statistique_2 < 1) ||
                    119:                ((*s_etat_processus).colonne_statistique_1 > nombre_colonnes) ||
                    120:                ((*s_etat_processus).colonne_statistique_2 > nombre_colonnes))
                    121:        {
                    122:            (*s_etat_processus).erreur_execution =
                    123:                    d_ex_observations_inexistantes;
                    124:            return;
                    125:        }
                    126: 
                    127:        if ((s_objet_resultat = allocation(s_etat_processus, REL))
                    128:                == NULL)
                    129:        {
                    130:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    131:            return;
                    132:        }
                    133: 
                    134:        (*((real8 *) (*s_objet_resultat).objet)) = covariance_statistique(
                    135:                (struct_matrice *) (*s_objet_statistique).objet,
                    136:                (*s_etat_processus).colonne_statistique_1,
                    137:                (*s_etat_processus).colonne_statistique_2, 'E', &erreur);
                    138: 
                    139:        if (erreur == d_erreur)
                    140:        {
                    141:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    142:            return;
                    143:        }
                    144:    }
                    145:    else
                    146:    {
                    147:        (*s_etat_processus).erreur_execution =
                    148:                d_ex_matrice_statistique_invalide;
                    149:        return;
                    150:    }
                    151: 
                    152:    if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                    153:            s_objet_resultat) == d_erreur)
                    154:    {
                    155:        return;
                    156:    }
                    157: 
                    158:    return;
                    159: }
                    160: 
                    161: 
                    162: /*
                    163: ================================================================================
                    164:   Fonction 'corr'
                    165: ================================================================================
                    166:   Entrées :
                    167: --------------------------------------------------------------------------------
                    168:   Sorties :
                    169: --------------------------------------------------------------------------------
                    170:   Effets de bord : néant
                    171: ================================================================================
                    172: */
                    173: 
                    174: void
                    175: instruction_corr(struct_processus *s_etat_processus)
                    176: {
                    177:    logical1                            erreur;
                    178: 
                    179:    struct_objet                        *s_objet_statistique;
                    180:    struct_objet                        *s_objet_resultat;
                    181: 
1.49      bertrand  182:    integer8                            nombre_colonnes;
1.1       bertrand  183: 
                    184:    (*s_etat_processus).erreur_execution = d_ex;
                    185: 
                    186:    if ((*s_etat_processus).affichage_arguments == 'Y')
                    187:    {
                    188:        printf("\n  CORR ");
                    189: 
                    190:        if ((*s_etat_processus).langue == 'F')
                    191:        {
                    192:            printf("(corrélation)\n\n");
                    193:        }
                    194:        else
                    195:        {
                    196:            printf("(correlation)\n\n");
                    197:        }
                    198: 
                    199:        printf("->  1: %s\n", d_REL);
                    200: 
                    201:        return;
                    202:    }
                    203:    else if ((*s_etat_processus).test_instruction == 'Y')
                    204:    {
                    205:        (*s_etat_processus).nombre_arguments = -1;
                    206:        return;
                    207:    }
                    208:    
                    209:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                    210:    {
                    211:        if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
                    212:        {
                    213:            return;
                    214:        }
                    215:    }
                    216: 
                    217:    /*
                    218:     * Recherche d'une variable globale référencée par SIGMA
                    219:     */
                    220: 
1.22      bertrand  221:    if (recherche_variable_globale(s_etat_processus, ds_sdat) == d_faux)
1.1       bertrand  222:    {
                    223:        /*
                    224:         * Aucune variable SIGMA
                    225:         */
                    226: 
                    227:        (*s_etat_processus).erreur_systeme = d_es;
                    228:        (*s_etat_processus).erreur_execution = d_ex_absence_observations;
                    229:        return;
                    230:    }
                    231:    else
                    232:    {
1.22      bertrand  233:        if (((*(*(*s_etat_processus).pointeur_variable_courante).objet)
                    234:                .type != MIN) && ((*(*(*s_etat_processus)
                    235:                .pointeur_variable_courante).objet).type != MRL))
1.1       bertrand  236:        {
1.22      bertrand  237:            (*s_etat_processus).erreur_execution =
                    238:                    d_ex_matrice_statistique_invalide;
1.1       bertrand  239:            return;
                    240:        }
                    241: 
1.22      bertrand  242:        nombre_colonnes = (*((struct_matrice *) (*(*(*s_etat_processus)
                    243:                .pointeur_variable_courante).objet).objet))
                    244:                .nombre_colonnes;
1.1       bertrand  245:    }
                    246: 
1.22      bertrand  247:    s_objet_statistique = (*(*s_etat_processus).pointeur_variable_courante)
                    248:            .objet;
1.1       bertrand  249: 
                    250:    if (((*s_objet_statistique).type == MIN) ||
                    251:            ((*s_objet_statistique).type == MRL))
                    252:    {
                    253:        if (((*s_etat_processus).colonne_statistique_1 < 1) ||
                    254:                ((*s_etat_processus).colonne_statistique_2 < 1) ||
                    255:                ((*s_etat_processus).colonne_statistique_1 > (long)
                    256:                nombre_colonnes) || ((*s_etat_processus).colonne_statistique_2
                    257:                > (long) nombre_colonnes))
                    258:        {
                    259:            (*s_etat_processus).erreur_execution =
                    260:                    d_ex_observations_inexistantes;
                    261:            return;
                    262:        }
                    263: 
                    264:        if ((s_objet_resultat = allocation(s_etat_processus, REL))
                    265:                == NULL)
                    266:        {
                    267:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    268:            return;
                    269:        }
                    270: 
                    271:        (*((real8 *) (*s_objet_resultat).objet)) = correlation_statistique(
                    272:                (struct_matrice *) (*s_objet_statistique).objet,
                    273:                (*s_etat_processus).colonne_statistique_1,
                    274:                (*s_etat_processus).colonne_statistique_2, &erreur);
                    275: 
                    276:        if (erreur == d_erreur)
                    277:        {
                    278:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    279:            return;
                    280:        }
                    281:    }
                    282:    else
                    283:    {
                    284:        (*s_etat_processus).erreur_execution =
                    285:                d_ex_matrice_statistique_invalide;
                    286:        return;
                    287:    }
                    288: 
                    289:    if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                    290:            s_objet_resultat) == d_erreur)
                    291:    {
                    292:        return;
                    293:    }
                    294: 
                    295:    return;
                    296: }
                    297: 
                    298: 
                    299: /*
                    300: ================================================================================
                    301:   Fonction 'copyright'
                    302: ================================================================================
                    303:   Entrées :
                    304: --------------------------------------------------------------------------------
                    305:   Sorties :
                    306: --------------------------------------------------------------------------------
                    307:   Effets de bord : néant
                    308: ================================================================================
                    309: */
                    310: 
                    311: void
                    312: instruction_copyright(struct_processus *s_etat_processus)
                    313: {
1.14      bertrand  314: #  include                     "copyright-conv.h"
1.1       bertrand  315: 
                    316:    (*s_etat_processus).erreur_execution = d_ex;
                    317: 
                    318:    if ((*s_etat_processus).affichage_arguments == 'Y')
                    319:    {
                    320:        printf("\n  COPYRIGHT ");
                    321: 
                    322:        if ((*s_etat_processus).langue == 'F')
                    323:        {
                    324:            printf("(copyright)\n\n");
                    325:            printf("  Aucun argument\n");
                    326:        }
                    327:        else
                    328:        {
                    329:            printf("(copyright)\n\n");
                    330:            printf("  No argument\n");
                    331:        }
                    332: 
                    333:        return;
                    334:    }
                    335:    else if ((*s_etat_processus).test_instruction == 'Y')
                    336:    {
                    337:        (*s_etat_processus).nombre_arguments = -1;
                    338:        return;
                    339:    }
                    340:    
                    341:    printf("\n  RPL/2 (R) version %s\n", d_version_rpl);
                    342:    printf("%s\n", ((*s_etat_processus).langue == 'F' )
                    343:            ? copyright : copyright_anglais);
                    344: 
                    345:    if ((*s_etat_processus).hauteur_pile_operationnelle == 0)
                    346:    {
                    347:        printf("\n");
                    348:    }
                    349: 
                    350:    return;
                    351: }
                    352: 
                    353: 
                    354: /*
                    355: ================================================================================
                    356:   Fonction 'convert'
                    357: ================================================================================
                    358:   Entrées :
                    359: --------------------------------------------------------------------------------
                    360:   Sorties :
                    361: --------------------------------------------------------------------------------
                    362:   Effets de bord : néant
                    363: ================================================================================
                    364: */
                    365: 
                    366: void
                    367: instruction_convert(struct_processus *s_etat_processus)
                    368: {
                    369:    file                        *pipe;
                    370: 
                    371:    int                         fin_fichier;
                    372: 
                    373:    logical1                    last_valide;
                    374: 
1.49      bertrand  375:    size_t                      longueur_chaine;
1.1       bertrand  376: 
                    377:    logical1                    presence_resultat;
                    378: 
                    379:    struct_objet                *s_objet_argument_1;
                    380:    struct_objet                *s_objet_argument_2;
                    381:    struct_objet                *s_objet_argument_3;
                    382: 
                    383:    unsigned char               *commande;
1.6       bertrand  384:    unsigned char               *executable_candidat;
1.1       bertrand  385:    unsigned char               ligne[1024 + 1];
                    386:    unsigned char               *tampon_instruction;
                    387: 
                    388:    (*s_etat_processus).erreur_execution = d_ex;
                    389: 
                    390:    if ((*s_etat_processus).affichage_arguments == 'Y')
                    391:    {
                    392:        printf("\n  CONVERT ");
                    393: 
                    394:        if ((*s_etat_processus).langue == 'F')
                    395:        {
                    396:            printf("(conversion d'unités)\n\n");
                    397:        }
                    398:        else
                    399:        {
                    400:            printf("(units conversion)\n\n");
                    401:        }
                    402: 
                    403:        printf("    3: %s, %s\n", d_INT, d_REL);
                    404:        printf("    2: %s\n", d_CHN);
                    405:        printf("    1: %s\n", d_CHN);
                    406:        printf("->  2: %s, %s\n", d_INT, d_REL);
                    407:        printf("    1: %s\n", d_CHN);
                    408: 
                    409:        return;
                    410:    }
                    411:    else if ((*s_etat_processus).test_instruction == 'Y')
                    412:    {
                    413:        (*s_etat_processus).nombre_arguments = -1;
                    414:        return;
                    415:    }
                    416: 
                    417:    if ((last_valide = test_cfsf(s_etat_processus, 31)) == d_vrai)
                    418:    {
                    419:        if (empilement_pile_last(s_etat_processus, 3) == d_erreur)
                    420:        {
                    421:            return;
                    422:        }
                    423:    }
                    424: 
                    425:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                    426:            &s_objet_argument_1) == d_erreur)
                    427:    {
                    428:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                    429:        return;
                    430:    }
                    431: 
                    432:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                    433:            &s_objet_argument_2) == d_erreur)
                    434:    {
                    435:        liberation(s_etat_processus, s_objet_argument_1);
                    436: 
                    437:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                    438:        return;
                    439:    }
                    440: 
                    441:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                    442:            &s_objet_argument_3) == d_erreur)
                    443:    {
                    444:        liberation(s_etat_processus, s_objet_argument_1);
                    445:        liberation(s_etat_processus, s_objet_argument_2);
                    446: 
                    447:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                    448:        return;
                    449:    }
                    450: 
                    451:    if (((*s_objet_argument_1).type == CHN) &&
                    452:            ((*s_objet_argument_2).type == CHN) &&
                    453:            (((*s_objet_argument_3).type == INT) ||
                    454:            ((*s_objet_argument_3).type == REL)))
                    455:    {
1.5       bertrand  456:        if ((*s_etat_processus).rpl_home == NULL)
                    457:        {
                    458:            longueur_chaine = strlen(ds_rplconvert_commande) - 9
                    459:                    + strlen((unsigned char *) (*s_objet_argument_1).objet)
                    460:                    + strlen((unsigned char *) (*s_objet_argument_2).objet)
                    461:                    + (2 * strlen(d_exec_path));
1.1       bertrand  462: 
1.5       bertrand  463:            if ((commande = malloc((longueur_chaine + 1) *
                    464:                    sizeof(unsigned char))) == NULL)
                    465:            {
                    466:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    467:                return;
                    468:            }
                    469: 
                    470:            sprintf(commande, ds_rplconvert_commande, d_exec_path, d_exec_path,
                    471:                    (unsigned char *) (*s_objet_argument_2).objet,
                    472:                    (unsigned char *) (*s_objet_argument_1).objet);
1.6       bertrand  473: 
1.62      bertrand  474:            if (alsprintf(s_etat_processus, &executable_candidat,
                    475:                    "%s/bin/rplconvert", d_exec_path) < 0)
1.6       bertrand  476:            {
                    477:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    478:                return;
                    479:            }
                    480: 
1.35      bertrand  481:            if (controle_integrite(s_etat_processus, executable_candidat,
                    482:                    "rplconvert") != d_vrai)
1.6       bertrand  483:            {
                    484:                (*s_etat_processus).erreur_systeme = d_es_somme_controle;
                    485:                return;
                    486:            }
                    487: 
                    488:            free(executable_candidat);
1.5       bertrand  489:        }
                    490:        else
1.1       bertrand  491:        {
1.5       bertrand  492:            longueur_chaine = strlen(ds_rplconvert_commande) - 9
                    493:                    + strlen((unsigned char *) (*s_objet_argument_1).objet)
                    494:                    + strlen((unsigned char *) (*s_objet_argument_2).objet)
                    495:                    + (2 * strlen((*s_etat_processus).rpl_home));
                    496: 
                    497:            if ((commande = malloc((longueur_chaine + 1) *
                    498:                    sizeof(unsigned char))) == NULL)
                    499:            {
                    500:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    501:                return;
                    502:            }
                    503: 
                    504:            sprintf(commande, ds_rplconvert_commande,
                    505:                    (*s_etat_processus).rpl_home, (*s_etat_processus).rpl_home,
                    506:                    (unsigned char *) (*s_objet_argument_2).objet,
                    507:                    (unsigned char *) (*s_objet_argument_1).objet);
1.6       bertrand  508: 
1.62      bertrand  509:            if (alsprintf(s_etat_processus, &executable_candidat,
                    510:                    "%s/bin/rplconvert", (*s_etat_processus).rpl_home) < 0)
1.6       bertrand  511:            {
                    512:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    513:                return;
                    514:            }
                    515: 
1.35      bertrand  516:            if (controle_integrite(s_etat_processus, executable_candidat,
                    517:                    "rplconvert") != d_vrai)
1.6       bertrand  518:            {
                    519:                (*s_etat_processus).erreur_systeme = d_es_somme_controle;
                    520:                return;
                    521:            }
                    522: 
                    523:            free(executable_candidat);
1.1       bertrand  524:        }
                    525: 
                    526:        if ((pipe = popen(commande, "r")) == NULL)
                    527:        {
                    528:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    529:            return;
                    530:        }
                    531: 
                    532:        free(commande);
                    533: 
                    534:        presence_resultat = d_faux;
                    535: 
                    536:        do
                    537:        {
                    538:            fin_fichier = fscanf(pipe, "%1024s", ligne);
                    539: 
                    540:            if (strcmp(ligne, "*") == 0)
                    541:            {
                    542:                fin_fichier = fscanf(pipe, "%1024s", ligne);
                    543: 
                    544:                if (fin_fichier != EOF)
                    545:                {
                    546:                    presence_resultat = d_vrai;
                    547: 
                    548:                    tampon_instruction =
                    549:                            (*s_etat_processus).instruction_courante;
                    550:                    (*s_etat_processus).instruction_courante = ligne;
                    551: 
1.59      bertrand  552:                    (*s_etat_processus).type_en_cours = NON;
1.1       bertrand  553:                    recherche_type(s_etat_processus);
                    554:                    
                    555:                    (*s_etat_processus).instruction_courante =
                    556:                            tampon_instruction;
                    557: 
                    558:                    if ((*s_etat_processus).erreur_execution != d_ex)
                    559:                    {
                    560:                        if (pclose(pipe) == -1)
                    561:                        {
                    562:                            (*s_etat_processus).erreur_systeme = d_es_processus;
                    563:                            return;
                    564:                        }
                    565: 
                    566:                        liberation(s_etat_processus, s_objet_argument_1);
                    567:                        liberation(s_etat_processus, s_objet_argument_2);
                    568:                        liberation(s_etat_processus, s_objet_argument_3);
                    569: 
                    570:                        return;
                    571:                    }
                    572:                }
                    573:            }
                    574:        } while(fin_fichier != EOF);
                    575: 
                    576:        /*
                    577:         * Récupération de la ligne renvoyée commencant par "*". Si une telle
                    578:         * ligne n'existe par, rplconvert retourne une erreur de type
                    579:         * « conformability error » ou « Unknown unit ».
                    580:         */
                    581: 
                    582:        if (pclose(pipe) == -1)
                    583:        {
                    584:            (*s_etat_processus).erreur_systeme = d_es_processus;
                    585:            return;
                    586:        }
                    587: 
                    588:        if (presence_resultat == d_faux)
                    589:        {
                    590:            liberation(s_etat_processus, s_objet_argument_1);
                    591:            liberation(s_etat_processus, s_objet_argument_2);
                    592:            liberation(s_etat_processus, s_objet_argument_3);
                    593: 
                    594:            (*s_etat_processus).erreur_execution = d_ex_conversion_unite;
                    595:            return;
                    596:        }
                    597:        
                    598:        /*
                    599:         * Retrait des espaces dans la chaîne unité renvoyée
                    600:         */
                    601: 
                    602:        if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                    603:                s_objet_argument_3) == d_erreur)
                    604:        {
                    605:            return;
                    606:        }
                    607: 
                    608:        if (last_valide == d_vrai)
                    609:        {
                    610:            cf(s_etat_processus, 31);
                    611:        }
                    612: 
                    613:        instruction_multiplication(s_etat_processus);
                    614: 
                    615:        if (last_valide == d_vrai)
                    616:        {
                    617:            sf(s_etat_processus, 31);
                    618:        }
                    619:    }
                    620:    else
                    621:    {
                    622:        liberation(s_etat_processus, s_objet_argument_1);
                    623:        liberation(s_etat_processus, s_objet_argument_2);
                    624:        liberation(s_etat_processus, s_objet_argument_3);
                    625: 
                    626:        (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
                    627:        return;
                    628:    }
                    629: 
                    630:    liberation(s_etat_processus, s_objet_argument_1);
                    631:    liberation(s_etat_processus, s_objet_argument_2);
                    632: 
                    633:    return;
                    634: }
                    635: 
                    636: 
                    637: /*
                    638: ================================================================================
                    639:   Fonction 'close'
                    640: ================================================================================
                    641:   Entrées :
                    642: --------------------------------------------------------------------------------
                    643:   Sorties :
                    644: --------------------------------------------------------------------------------
                    645:   Effets de bord : néant
                    646: ================================================================================
                    647: */
                    648: 
                    649: void
                    650: instruction_close(struct_processus *s_etat_processus)
                    651: {
1.7       bertrand  652:    const char                  *queue;
1.1       bertrand  653: 
                    654:    int                         socket;
                    655: 
                    656:    logical1                    socket_connectee;
                    657: 
1.7       bertrand  658:    sqlite3_stmt                *ppStmt;
                    659: 
                    660:    struct_descripteur_fichier  *descripteur;
                    661: 
1.1       bertrand  662:    struct_liste_chainee        *l_element_courant;
                    663:    struct_liste_chainee        *l_element_precedent;
                    664: 
                    665:    struct_objet                *s_objet_argument;
                    666: 
                    667:    (*s_etat_processus).erreur_execution = d_ex;
                    668: 
                    669:    if ((*s_etat_processus).affichage_arguments == 'Y')
                    670:    {
                    671:        printf("\n  CLOSE ");
                    672: 
                    673:        if ((*s_etat_processus).langue == 'F')
                    674:        {
                    675:            printf("(fermeture d'un fichier, d'une socket ou d'un sémaphore)"
                    676:                    "\n\n");
                    677:        }
                    678:        else
                    679:        {
                    680:            printf("(close file, socket or semaphore)\n\n");
                    681:        }
                    682: 
                    683:        printf("    1: %s\n\n", d_FCH);
                    684: 
                    685:        printf("    1: %s\n\n", d_SCK);
                    686: 
                    687:        printf("    1: %s\n", d_SPH);
                    688: 
                    689:        return;
                    690:    }
                    691:    else if ((*s_etat_processus).test_instruction == 'Y')
                    692:    {
                    693:        (*s_etat_processus).nombre_arguments = -1;
                    694:        return;
                    695:    }
                    696: 
                    697:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                    698:    {
                    699:        if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
                    700:        {
                    701:            return;
                    702:        }
                    703:    }
                    704: 
                    705:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                    706:            &s_objet_argument) == d_erreur)
                    707:    {
                    708:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                    709:        return;
                    710:    }
                    711: 
                    712:    if ((*s_objet_argument).type == FCH)
                    713:    {
                    714:        /*
                    715:         * Retrait du descripteur de la pile de fichiers
                    716:         */
                    717: 
                    718:        l_element_courant = (*s_etat_processus).s_fichiers;
                    719:        l_element_precedent = NULL;
                    720: 
                    721:        descripteur = NULL;
                    722: 
                    723:        while(l_element_courant != NULL)
                    724:        {
                    725:            if (((*((struct_descripteur_fichier *) (*l_element_courant).donnee))
                    726:                    .identifiant == (*((struct_fichier *) (*s_objet_argument)
                    727:                    .objet)).descripteur) && ((*((struct_descripteur_fichier *)
                    728:                    (*l_element_courant).donnee)).pid == getpid()) &&
                    729:                    (pthread_equal((*((struct_descripteur_fichier *)
                    730:                    (*l_element_courant).donnee)).tid, pthread_self()) != 0))
                    731:            {
                    732:                if (((*((struct_fichier *) (*s_objet_argument).objet)).pid ==
                    733:                        (*((struct_descripteur_fichier *) (*l_element_courant)
                    734:                        .donnee)).pid) && (pthread_equal((*((struct_fichier *)
                    735:                        (*s_objet_argument).objet)).tid,
                    736:                        (*((struct_descripteur_fichier *) (*l_element_courant)
                    737:                        .donnee)).tid) != 0))
                    738:                {
1.7       bertrand  739:                    descripteur = (struct_descripteur_fichier *)
                    740:                            (*l_element_courant).donnee;
1.1       bertrand  741: 
                    742:                    if (l_element_precedent == NULL)
                    743:                    {
                    744:                        (*s_etat_processus).s_fichiers =
                    745:                                (*l_element_courant).suivant;
                    746:                    }
                    747:                    else if ((*l_element_courant).suivant == NULL)
                    748:                    {
                    749:                        (*l_element_precedent).suivant = NULL;
                    750:                    }
                    751:                    else
                    752:                    {
                    753:                        (*l_element_precedent).suivant =
                    754:                                (*l_element_courant).suivant;
                    755:                    }
                    756: 
                    757:                    free((*((struct_descripteur_fichier *)
                    758:                            (*l_element_courant).donnee)).nom);
                    759:                    free(l_element_courant);
                    760: 
                    761:                    break;
                    762:                }
                    763:            }
                    764: 
                    765:            l_element_precedent = l_element_courant;
                    766:            l_element_courant = (*l_element_courant).suivant;
                    767:        }
                    768: 
                    769:        if (descripteur == NULL)
                    770:        {
                    771:            liberation(s_etat_processus, s_objet_argument);
                    772: 
                    773:            (*s_etat_processus).erreur_execution = d_ex_erreur_acces_fichier;
                    774:            return;
                    775:        }
                    776: 
                    777:        /*
                    778:         * Fermeture du fichier
                    779:         */
                    780: 
1.7       bertrand  781:        if (fclose((*descripteur).descripteur_c) != 0)
1.1       bertrand  782:        {
1.7       bertrand  783:            free(descripteur);
1.1       bertrand  784:            liberation(s_etat_processus, s_objet_argument);
                    785: 
                    786:            (*s_etat_processus).erreur_systeme = d_es_erreur_fichier;
                    787:            return;
                    788:        }
                    789: 
1.7       bertrand  790:        if ((*descripteur).type != 'C')
                    791:        {
                    792:            if (sqlite3_prepare_v2((*descripteur).descripteur_sqlite,
                    793:                    "vacuum", 7, &ppStmt, &queue) != SQLITE_OK)
                    794:            {
                    795:                free(descripteur);
                    796:                liberation(s_etat_processus, s_objet_argument);
                    797: 
                    798:                (*s_etat_processus).erreur_systeme = d_es_erreur_fichier;
                    799:                return;
                    800:            }
                    801: 
                    802:            if (sqlite3_step(ppStmt) != SQLITE_DONE)
                    803:            {
                    804:                free(descripteur);
                    805:                liberation(s_etat_processus, s_objet_argument);
                    806: 
                    807:                (*s_etat_processus).erreur_systeme = d_es_erreur_fichier;
                    808:                return;
                    809:            }
                    810: 
                    811:            if (sqlite3_finalize(ppStmt) != SQLITE_OK)
                    812:            {
                    813:                free(descripteur);
                    814:                liberation(s_etat_processus, s_objet_argument);
                    815: 
                    816:                (*s_etat_processus).erreur_systeme = d_es_erreur_fichier;
                    817:                return;
                    818:            }
                    819: 
                    820:            if (sqlite3_close((*descripteur).descripteur_sqlite) != SQLITE_OK)
                    821:            {
                    822:                free(descripteur);
                    823:                liberation(s_etat_processus, s_objet_argument);
                    824: 
                    825:                (*s_etat_processus).erreur_systeme = d_es_erreur_fichier;
                    826:                return;
                    827:            }
                    828: 
                    829:            free(descripteur);
                    830:        }
                    831: 
1.1       bertrand  832:        if ((*((struct_fichier *) (*s_objet_argument).objet)).ouverture == 'S')
                    833:        {
                    834:            if (destruction_fichier((*((struct_fichier *)
                    835:                    (*s_objet_argument).objet)).nom) == d_erreur)
                    836:            {
                    837:                liberation(s_etat_processus, s_objet_argument);
                    838: 
                    839:                (*s_etat_processus).erreur_systeme = d_es_erreur_fichier;
                    840:                return;
                    841:            }
                    842:        }
                    843:    }
                    844:    else if ((*s_objet_argument).type == SCK)
                    845:    {
                    846:        /*
                    847:         * Retrait de la socket de la pile
                    848:         */
                    849: 
                    850:        l_element_courant = (*s_etat_processus).s_sockets;
                    851:        l_element_precedent = NULL;
                    852: 
                    853:        socket = -1;
                    854:        socket_connectee = d_faux;
                    855: 
                    856:        while(l_element_courant != NULL)
                    857:        {
                    858:            if ((*((struct_socket *) (*(*l_element_courant).donnee).objet))
                    859:                    .socket == (*((struct_socket *) (*s_objet_argument)
                    860:                    .objet)).socket)
                    861:            {
                    862:                socket = (*((struct_socket *)
                    863:                        (*(*l_element_courant).donnee).objet)).socket;
                    864:                socket_connectee = (*((struct_socket *)
                    865:                        (*(*l_element_courant).donnee).objet)).socket_connectee;
                    866: 
                    867:                if (l_element_precedent == NULL)
                    868:                {
                    869:                    (*s_etat_processus).s_sockets =
                    870:                            (*l_element_courant).suivant;
                    871:                }
                    872:                else if ((*l_element_courant).suivant == NULL)
                    873:                {
                    874:                    (*l_element_precedent).suivant = NULL;
                    875:                }
                    876:                else
                    877:                {
                    878:                    (*l_element_precedent).suivant =
                    879:                            (*l_element_courant).suivant;
                    880:                }
                    881: 
                    882:                liberation(s_etat_processus, (*l_element_courant).donnee);
                    883:                free(l_element_courant);
                    884: 
                    885:                break;
                    886:            }
                    887: 
                    888:            l_element_precedent = l_element_courant;
                    889:            l_element_courant = (*l_element_courant).suivant;
                    890:        }
                    891: 
                    892:        if (socket == -1)
                    893:        {
                    894:            liberation(s_etat_processus, s_objet_argument);
                    895: 
                    896:            (*s_etat_processus).erreur_execution = d_ex_erreur_acces_fichier;
                    897:            return;
                    898:        }
                    899: 
                    900:        /*
                    901:         * Fermeture de la socket
                    902:         */
                    903: 
                    904:        if (socket_connectee == d_vrai)
                    905:        {
                    906:            shutdown(socket, SHUT_RDWR);
                    907:        }
                    908: 
                    909:        if (close(socket) != 0)
                    910:        {
                    911:            liberation(s_etat_processus, s_objet_argument);
                    912: 
                    913:            (*s_etat_processus).erreur_systeme = d_es_erreur_fichier;
                    914:            return;
                    915:        }
                    916: 
                    917:        if ((*((struct_socket *) (*s_objet_argument).objet)).effacement == 'Y')
                    918:        {
                    919:            unlink((*((struct_socket *) (*s_objet_argument).objet)).adresse);
                    920:        }
                    921:    }
                    922:    else if ((*s_objet_argument).type == SPH)
                    923:    {
                    924:        if (sem_close((*((struct_semaphore *) (*s_objet_argument).objet))
                    925:                .semaphore) != 0)
                    926:        {
                    927:            (*s_etat_processus).erreur_execution = d_ex_semaphore;
                    928:            return;
                    929:        }
                    930:    }
                    931:    else
                    932:    {
                    933:        liberation(s_etat_processus, s_objet_argument);
                    934: 
                    935:        (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
                    936:        return;
                    937:    }
                    938: 
                    939:    liberation(s_etat_processus, s_objet_argument);
                    940: 
                    941:    return;
                    942: }
                    943: 
                    944: 
                    945: /*
                    946: ================================================================================
                    947:   Fonction 'create'
                    948: ================================================================================
                    949:   Entrées :
                    950: --------------------------------------------------------------------------------
                    951:   Sorties :
                    952: --------------------------------------------------------------------------------
                    953:   Effets de bord : néant
                    954: ================================================================================
                    955: */
                    956: 
                    957: void
                    958: instruction_create(struct_processus *s_etat_processus)
                    959: {
                    960:    file                        *fichier;
                    961: 
                    962:    logical1                    erreur;
                    963:    logical1                    existence;
                    964:    logical1                    ouverture;
                    965: 
                    966:    struct_objet                *s_objet_argument;
                    967: 
1.7       bertrand  968:    unsigned char               *nom;
                    969: 
1.1       bertrand  970:    unsigned long               unite;
                    971: 
                    972:    (*s_etat_processus).erreur_execution = d_ex;
                    973: 
                    974:    if ((*s_etat_processus).affichage_arguments == 'Y')
                    975:    {
                    976:        printf("\n  CREATE ");
                    977: 
                    978:        if ((*s_etat_processus).langue == 'F')
                    979:        {
                    980:            printf("(création d'un fichier)\n\n");
                    981:        }
                    982:        else
                    983:        {
                    984:            printf("(create file)\n\n");
                    985:        }
                    986: 
                    987:        printf("    1: %s\n", d_CHN);
                    988: 
                    989:        return;
                    990:    }
                    991:    else if ((*s_etat_processus).test_instruction == 'Y')
                    992:    {
                    993:        (*s_etat_processus).nombre_arguments = -1;
                    994:        return;
                    995:    }
                    996: 
                    997:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                    998:    {
                    999:        if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
                   1000:        {
                   1001:            return;
                   1002:        }
                   1003:    }
                   1004: 
                   1005:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   1006:            &s_objet_argument) == d_erreur)
                   1007:    {
                   1008:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                   1009:        return;
                   1010:    }
                   1011: 
                   1012:    if ((*s_objet_argument).type == CHN)
                   1013:    {
1.7       bertrand 1014:        if ((nom = transliteration(s_etat_processus, (unsigned char *)
                   1015:                (*s_objet_argument).objet, d_locale, "UTF-8")) == NULL)
                   1016:        {
                   1017:            liberation(s_etat_processus, s_objet_argument);
                   1018:            return;
                   1019:        }
                   1020: 
                   1021:        erreur = caracteristiques_fichier(s_etat_processus, nom,
                   1022:                &existence, &ouverture, &unite);
1.1       bertrand 1023: 
                   1024:        if ((erreur != d_absence_erreur) || (existence == d_vrai))
                   1025:        {
                   1026:            liberation(s_etat_processus, s_objet_argument);
1.7       bertrand 1027:            free(nom);
1.1       bertrand 1028: 
                   1029:            (*s_etat_processus).erreur_execution =
                   1030:                    d_ex_erreur_acces_fichier;
                   1031:            return;
                   1032:        }
                   1033: 
1.7       bertrand 1034:        if ((fichier = fopen(nom, "w")) == NULL)
1.1       bertrand 1035:        {
                   1036:            liberation(s_etat_processus, s_objet_argument);
1.7       bertrand 1037:            free(nom);
1.1       bertrand 1038: 
                   1039:            (*s_etat_processus).erreur_execution =
                   1040:                    d_ex_erreur_acces_fichier;
                   1041:            return;
                   1042:        }
                   1043: 
1.7       bertrand 1044:        free(nom);
                   1045: 
1.1       bertrand 1046:        if (fclose(fichier) != 0)
                   1047:        {
                   1048:            liberation(s_etat_processus, s_objet_argument);
                   1049: 
                   1050:            (*s_etat_processus).erreur_execution =
                   1051:                    d_ex_erreur_acces_fichier;
                   1052:            return;
                   1053:        }
                   1054:    }
                   1055:    else
                   1056:    {
                   1057:        liberation(s_etat_processus, s_objet_argument);
                   1058: 
                   1059:        (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
                   1060:        return;
                   1061:    }
                   1062: 
                   1063:    liberation(s_etat_processus, s_objet_argument);
                   1064: 
                   1065:    return;
                   1066: }
                   1067: 
                   1068: 
                   1069: /*
                   1070: ================================================================================
                   1071:   Fonction 'cswp'
                   1072: ================================================================================
                   1073:   Entrées :
                   1074: --------------------------------------------------------------------------------
                   1075:   Sorties :
                   1076: --------------------------------------------------------------------------------
                   1077:   Effets de bord : néant
                   1078: ================================================================================
                   1079: */
                   1080: 
                   1081: void
                   1082: instruction_cswp(struct_processus *s_etat_processus)
                   1083: {
                   1084:    struct_objet                *s_copie_argument_3;
                   1085:    struct_objet                *s_objet_argument_1;
                   1086:    struct_objet                *s_objet_argument_2;
                   1087:    struct_objet                *s_objet_argument_3;
                   1088: 
1.49      bertrand 1089:    integer8                    colonne_1;
                   1090:    integer8                    colonne_2;
                   1091:    integer8                    i;
1.1       bertrand 1092: 
                   1093:    (*s_etat_processus).erreur_execution = d_ex;
                   1094: 
                   1095:    if ((*s_etat_processus).affichage_arguments == 'Y')
                   1096:    {
                   1097:        printf("\n  CSWP ");
                   1098: 
                   1099:        if ((*s_etat_processus).langue == 'F')
                   1100:        {
                   1101:            printf("(échange de deux colonnes d'une matrice)\n\n");
                   1102:        }
                   1103:        else
                   1104:        {
                   1105:            printf("(swap two columns of a matrix)\n\n");
                   1106:        }
                   1107: 
                   1108:        printf("    3: %s, %s, %s\n", d_MIN, d_MRL, d_MCX);
                   1109:        printf("    2: %s\n", d_INT);
                   1110:        printf("    1: %s\n", d_INT);
                   1111:        printf("->  1: %s, %s, %s\n", d_MIN, d_MRL, d_MCX);
                   1112: 
                   1113:        return;
                   1114:    }
                   1115:    else if ((*s_etat_processus).test_instruction == 'Y')
                   1116:    {
                   1117:        (*s_etat_processus).nombre_arguments = -1;
                   1118:        return;
                   1119:    }
                   1120: 
                   1121:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                   1122:    {
                   1123:        if (empilement_pile_last(s_etat_processus, 3) == d_erreur)
                   1124:        {
                   1125:            return;
                   1126:        }
                   1127:    }
                   1128: 
                   1129:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   1130:            &s_objet_argument_1) == d_erreur)
                   1131:    {
                   1132:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                   1133:        return;
                   1134:    }
                   1135: 
                   1136:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   1137:            &s_objet_argument_2) == d_erreur)
                   1138:    {
                   1139:        liberation(s_etat_processus, s_objet_argument_1);
                   1140: 
                   1141:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                   1142:        return;
                   1143:    }
                   1144: 
                   1145:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   1146:            &s_objet_argument_3) == d_erreur)
                   1147:    {
                   1148:        liberation(s_etat_processus, s_objet_argument_1);
                   1149:        liberation(s_etat_processus, s_objet_argument_2);
                   1150: 
                   1151:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                   1152:        return;
                   1153:    }
                   1154: 
                   1155:    if (((*s_objet_argument_1).type == INT) &&
                   1156:            ((*s_objet_argument_2).type == INT))
                   1157:    {
                   1158:        colonne_1 = (*((integer8 *) (*s_objet_argument_1).objet)) - 1;
                   1159:        colonne_2 = (*((integer8 *) (*s_objet_argument_2).objet)) - 1;
                   1160: 
                   1161:        if ((*s_objet_argument_3).type == MIN)
                   1162:        {
1.50      bertrand 1163:            if ((colonne_1 < 0) || (colonne_1 >
1.1       bertrand 1164:                    (*((struct_matrice *) (*s_objet_argument_3).objet))
1.50      bertrand 1165:                    .nombre_colonnes - 1) || (colonne_2 < 0) || (colonne_2 >
                   1166:                    (*((struct_matrice *)
                   1167:                    (*s_objet_argument_3).objet)).nombre_colonnes - 1))
1.1       bertrand 1168:            {
                   1169:                liberation(s_etat_processus, s_objet_argument_1);
                   1170:                liberation(s_etat_processus, s_objet_argument_2);
                   1171:                liberation(s_etat_processus, s_objet_argument_3);
                   1172: 
                   1173:                (*s_etat_processus).erreur_execution =
                   1174:                        d_ex_dimensions_invalides;
                   1175:                return;
                   1176:            }
                   1177: 
                   1178:            if ((s_copie_argument_3 = copie_objet(s_etat_processus,
                   1179:                    s_objet_argument_3, 'Q')) == NULL)
                   1180:            {
                   1181:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1182:                return;
                   1183:            }
                   1184: 
                   1185:            for(i = 0; i < (*((struct_matrice *) (*s_objet_argument_3).objet))
                   1186:                    .nombre_lignes; i++)
                   1187:            {
                   1188:                ((integer8 **) (*((struct_matrice *)
                   1189:                        (*s_copie_argument_3).objet)).tableau)
                   1190:                        [i][colonne_1] = ((integer8 **) (*((struct_matrice *)
                   1191:                        (*s_objet_argument_3).objet)).tableau)[i][colonne_2];
                   1192:                ((integer8 **) (*((struct_matrice *)
                   1193:                        (*s_copie_argument_3).objet)).tableau)
                   1194:                        [i][colonne_2] = ((integer8 **) (*((struct_matrice *)
                   1195:                        (*s_objet_argument_3).objet)).tableau)[i][colonne_1];
                   1196:            }
                   1197:        }
                   1198:        else if ((*s_objet_argument_3).type == MRL)
                   1199:        {
1.50      bertrand 1200:            if ((colonne_1 < 0) || (colonne_1 >
1.1       bertrand 1201:                    (*((struct_matrice *) (*s_objet_argument_3).objet))
1.50      bertrand 1202:                    .nombre_colonnes - 1) || (colonne_2 < 0) || (colonne_2 >
                   1203:                    (*((struct_matrice *)
                   1204:                    (*s_objet_argument_3).objet)).nombre_colonnes - 1))
1.1       bertrand 1205:            {
                   1206:                liberation(s_etat_processus, s_objet_argument_1);
                   1207:                liberation(s_etat_processus, s_objet_argument_2);
                   1208:                liberation(s_etat_processus, s_objet_argument_3);
                   1209: 
                   1210:                (*s_etat_processus).erreur_execution =
                   1211:                        d_ex_dimensions_invalides;
                   1212:                return;
                   1213:            }
                   1214: 
                   1215:            if ((s_copie_argument_3 = copie_objet(s_etat_processus,
                   1216:                    s_objet_argument_3, 'O')) == NULL)
                   1217:            {
                   1218:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1219:                return;
                   1220:            }
                   1221: 
                   1222:            for(i = 0; i < (*((struct_matrice *) (*s_objet_argument_3).objet))
                   1223:                    .nombre_lignes; i++)
                   1224:            {
                   1225:                ((real8 **) (*((struct_matrice *)
                   1226:                        (*s_copie_argument_3).objet)).tableau)
                   1227:                        [i][colonne_1] = ((real8 **) (*((struct_matrice *)
                   1228:                        (*s_objet_argument_3).objet)).tableau)[i][colonne_2];
                   1229:                ((real8 **) (*((struct_matrice *)
                   1230:                        (*s_copie_argument_3).objet)).tableau)
                   1231:                        [i][colonne_2] = ((real8 **) (*((struct_matrice *)
                   1232:                        (*s_objet_argument_3).objet)).tableau)[i][colonne_1];
                   1233:            }
                   1234:        }
                   1235:        else if ((*s_objet_argument_3).type == MCX)
                   1236:        {
1.50      bertrand 1237:            if ((colonne_1 < 0) || (colonne_1 >
1.1       bertrand 1238:                    (*((struct_matrice *) (*s_objet_argument_3).objet))
1.50      bertrand 1239:                    .nombre_colonnes - 1) || (colonne_2 < 0) || (colonne_2 >
                   1240:                    (*((struct_matrice *)
                   1241:                    (*s_objet_argument_3).objet)).nombre_colonnes - 1))
1.1       bertrand 1242:            {
                   1243:                liberation(s_etat_processus, s_objet_argument_1);
                   1244:                liberation(s_etat_processus, s_objet_argument_2);
                   1245:                liberation(s_etat_processus, s_objet_argument_3);
                   1246: 
                   1247:                (*s_etat_processus).erreur_execution =
                   1248:                        d_ex_dimensions_invalides;
                   1249:                return;
                   1250:            }
                   1251: 
                   1252:            if ((s_copie_argument_3 = copie_objet(s_etat_processus,
                   1253:                    s_objet_argument_3, 'O')) == NULL)
                   1254:            {
                   1255:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1256:                return;
                   1257:            }
                   1258: 
                   1259:            for(i = 0; i < (*((struct_matrice *) (*s_objet_argument_3).objet))
                   1260:                    .nombre_lignes; i++)
                   1261:            {
                   1262:                ((complex16 **) (*((struct_matrice *)
                   1263:                        (*s_copie_argument_3).objet)).tableau)
                   1264:                        [i][colonne_1].partie_reelle =
                   1265:                        ((complex16 **) (*((struct_matrice *)
                   1266:                        (*s_objet_argument_3).objet)).tableau)[i][colonne_2]
                   1267:                        .partie_reelle;
                   1268:                ((complex16 **) (*((struct_matrice *)
                   1269:                        (*s_copie_argument_3).objet)).tableau)
                   1270:                        [i][colonne_1].partie_imaginaire =
                   1271:                        ((complex16 **) (*((struct_matrice *)
                   1272:                        (*s_objet_argument_3).objet)).tableau)[i][colonne_2]
                   1273:                        .partie_imaginaire;
                   1274:                ((complex16 **) (*((struct_matrice *)
                   1275:                        (*s_copie_argument_3).objet)).tableau)
                   1276:                        [i][colonne_2].partie_reelle =
                   1277:                        ((complex16 **) (*((struct_matrice *)
                   1278:                        (*s_objet_argument_3).objet)).tableau)[i][colonne_1]
                   1279:                        .partie_reelle;
                   1280:                ((complex16 **) (*((struct_matrice *)
                   1281:                        (*s_copie_argument_3).objet)).tableau)
                   1282:                        [i][colonne_2].partie_imaginaire =
                   1283:                        ((complex16 **) (*((struct_matrice *)
                   1284:                        (*s_objet_argument_3).objet)).tableau)[i][colonne_1]
                   1285:                        .partie_imaginaire;
                   1286:            }
                   1287:        }
                   1288:        else
                   1289:        {
                   1290:            liberation(s_etat_processus, s_objet_argument_1);
                   1291:            liberation(s_etat_processus, s_objet_argument_2);
                   1292:            liberation(s_etat_processus, s_objet_argument_3);
                   1293: 
                   1294:            (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
                   1295:            return;
                   1296:        }
                   1297:    }
                   1298:    else
                   1299:    {
                   1300:        liberation(s_etat_processus, s_objet_argument_1);
                   1301:        liberation(s_etat_processus, s_objet_argument_2);
                   1302:        liberation(s_etat_processus, s_objet_argument_3);
                   1303: 
                   1304:        (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
                   1305:        return;
                   1306:    }
                   1307: 
                   1308:    liberation(s_etat_processus, s_objet_argument_1);
                   1309:    liberation(s_etat_processus, s_objet_argument_2);
                   1310:    liberation(s_etat_processus, s_objet_argument_3);
                   1311: 
                   1312:    if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   1313:            s_copie_argument_3) == d_erreur)
                   1314:    {
                   1315:        return;
                   1316:    }
                   1317: 
                   1318:    return;
                   1319: }
                   1320: 
                   1321: // vim: ts=4

CVSweb interface <joel.bertrand@systella.fr>