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

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

CVSweb interface <joel.bertrand@systella.fr>