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

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

CVSweb interface <joel.bertrand@systella.fr>