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

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

CVSweb interface <joel.bertrand@systella.fr>