Annotation of rpl/src/instructions_d4.c, revision 1.3

1.1       bertrand    1: /*
                      2: ================================================================================
1.3     ! bertrand    3:   RPL/2 (R) version 4.0.11
1.1       bertrand    4:   Copyright (C) 1989-2010 Dr. BERTRAND Joël
                      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: 
                     23: #include "rpl.conv.h"
                     24: 
                     25: 
                     26: /*
                     27: ================================================================================
                     28:   Fonction 'delete'
                     29: ================================================================================
                     30:   Entrées : pointeur sur une structure struct_processus
                     31: --------------------------------------------------------------------------------
                     32:   Sorties :
                     33: --------------------------------------------------------------------------------
                     34:   Effets de bord : néant
                     35: ================================================================================
                     36: */
                     37: 
                     38: void
                     39: instruction_delete(struct_processus *s_etat_processus)
                     40: {
                     41:    file                        *fichier;
                     42: 
                     43:    logical1                    erreur;
                     44:    logical1                    existence;
                     45:    logical1                    ouverture;
                     46: 
                     47:    struct_objet                *s_objet_argument;
                     48: 
                     49:    struct flock                lock;
                     50: 
                     51:    struct stat                 requete;
                     52: 
                     53:    unsigned long               unite;
                     54: 
                     55:    (*s_etat_processus).erreur_execution = d_ex;
                     56: 
                     57:    if ((*s_etat_processus).affichage_arguments == 'Y')
                     58:    {
                     59:        printf("\n  DELETE ");
                     60: 
                     61:        if ((*s_etat_processus).langue == 'F')
                     62:        {
                     63:            printf("(effacement d'un fichier)\n\n");
                     64:        }
                     65:        else
                     66:        {
                     67:            printf("(delete a file)\n\n");
                     68:        }
                     69: 
                     70:        printf("    1: %s\n", d_CHN);
                     71: 
                     72:        return;
                     73:    }
                     74:    else if ((*s_etat_processus).test_instruction == 'Y')
                     75:    {
                     76:        (*s_etat_processus).nombre_arguments = -1;
                     77:        return;
                     78:    }
                     79: 
                     80:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                     81:    {
                     82:        if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
                     83:        {
                     84:            return;
                     85:        }
                     86:    }
                     87: 
                     88:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                     89:            &s_objet_argument) == d_erreur)
                     90:    {
                     91:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                     92:        return;
                     93:    }
                     94: 
                     95:    if ((*s_objet_argument).type == CHN)
                     96:    {
                     97:        if (stat((unsigned char *) (*s_objet_argument).objet,
                     98:                &requete) != 0)
                     99:        {
                    100:            liberation(s_etat_processus, s_objet_argument);
                    101: 
                    102:            (*s_etat_processus).erreur_execution =
                    103:                    d_ex_erreur_acces_fichier;
                    104:            return;
                    105:        }
                    106: 
                    107:        if (S_ISREG(requete.st_mode)) // Fichier régulier
                    108:        {
                    109:            if ((fichier = fopen((unsigned char *)
                    110:                    (*s_objet_argument).objet, "r+")) == NULL)
                    111:            {
                    112:                liberation(s_etat_processus, s_objet_argument);
                    113: 
                    114:                (*s_etat_processus).erreur_execution =
                    115:                        d_ex_erreur_acces_fichier;
                    116:                return;
                    117:            }
                    118: 
                    119:            lock.l_type = F_WRLCK;
                    120:            lock.l_whence = SEEK_SET;
                    121:            lock.l_start = 0;
                    122:            lock.l_len = 0;
                    123:            lock.l_pid = getpid();
                    124: 
                    125:            if (fcntl(fileno(fichier), F_GETLK, &lock) == -1)
                    126:            {
                    127:                if (fclose(fichier) != 0)
                    128:                {
                    129:                    liberation(s_etat_processus, s_objet_argument);
                    130: 
                    131:                    (*s_etat_processus).erreur_execution =
                    132:                            d_ex_erreur_acces_fichier;
                    133:                    return;
                    134:                }
                    135: 
                    136:                liberation(s_etat_processus, s_objet_argument);
                    137: 
                    138:                (*s_etat_processus).erreur_execution =
                    139:                        d_ex_erreur_acces_fichier;
                    140:                return;
                    141:            }
                    142: 
                    143:            if (lock.l_type != F_UNLCK)
                    144:            {
                    145:                liberation(s_etat_processus, s_objet_argument);
                    146: 
                    147:                (*s_etat_processus).erreur_execution =
                    148:                        d_ex_erreur_acces_fichier;
                    149:                return;
                    150:            }
                    151: 
                    152:            erreur = caracteristiques_fichier(s_etat_processus,
                    153:                    (unsigned char *) (*s_objet_argument).objet,
                    154:                    &existence, &ouverture, &unite);
                    155: 
                    156:            if ((erreur != d_absence_erreur) || (ouverture == d_vrai))
                    157:            {
                    158:                liberation(s_etat_processus, s_objet_argument);
                    159: 
                    160:                (*s_etat_processus).erreur_execution =
                    161:                        d_ex_erreur_acces_fichier;
                    162:                return;
                    163:            }
                    164: 
                    165:            if (destruction_fichier((unsigned char *)
                    166:                    (*s_objet_argument).objet) == d_erreur)
                    167:            {
                    168:                liberation(s_etat_processus, s_objet_argument);
                    169: 
                    170:                (*s_etat_processus).erreur_execution =
                    171:                        d_ex_erreur_acces_fichier;
                    172:                return;
                    173:            }
                    174:        }
                    175:        else // Socket
                    176:        {
                    177:            if (unlink((unsigned char *) (*s_objet_argument).objet) != 0)
                    178:            {
                    179:                liberation(s_etat_processus, s_objet_argument);
                    180: 
                    181:                (*s_etat_processus).erreur_execution =
                    182:                        d_ex_erreur_acces_fichier;
                    183:                return;
                    184:            }
                    185:        }
                    186:    }
                    187:    else
                    188:    {
                    189:        liberation(s_etat_processus, s_objet_argument);
                    190: 
                    191:        (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
                    192:        return;
                    193:    }
                    194: 
                    195:    liberation(s_etat_processus, s_objet_argument);
                    196: 
                    197:    return;
                    198: }
                    199: 
                    200: 
                    201: /*
                    202: ================================================================================
                    203:   Fonction 'date'
                    204: ================================================================================
                    205:   Entrées : pointeur sur une structure struct_processus
                    206: --------------------------------------------------------------------------------
                    207:   Sorties :
                    208: --------------------------------------------------------------------------------
                    209:   Effets de bord : néant
                    210: ================================================================================
                    211: */
                    212: 
                    213: void
                    214: instruction_date(struct_processus *s_etat_processus)
                    215: {
                    216:    struct_objet            *s_objet;
                    217: 
                    218:    struct timeval          horodatage;
                    219: 
                    220:    (*s_etat_processus).erreur_execution = d_ex;
                    221: 
                    222:    if ((*s_etat_processus).affichage_arguments == 'Y')
                    223:    {
                    224:        printf("\n  DATE ");
                    225: 
                    226:        if ((*s_etat_processus).langue == 'F')
                    227:        {
                    228:            printf("(information sur la date et l'heure)\n\n");
                    229:        }
                    230:        else
                    231:        {
                    232:            printf("(date and time)\n\n");
                    233:        }
                    234: 
                    235:        printf("->  1: %s\n", d_LST);
                    236: 
                    237:        return;
                    238:    }
                    239:    else if ((*s_etat_processus).test_instruction == 'Y')
                    240:    {
                    241:        (*s_etat_processus).nombre_arguments = -1;
                    242:        return;
                    243:    }
                    244: 
                    245:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                    246:    {
                    247:        if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
                    248:        {
                    249:            return;
                    250:        }
                    251:    }
                    252: 
                    253:    gettimeofday(&horodatage, NULL);
                    254: 
                    255:    if ((s_objet = formateur_date(s_etat_processus, &horodatage)) == NULL)
                    256:    {
                    257:        return;
                    258:    }
                    259: 
                    260:    if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                    261:            s_objet) == d_erreur)
                    262:    {
                    263:        return;
                    264:    }
                    265: 
                    266:    return;
                    267: }
                    268: 
                    269: 
                    270: /*
                    271: ================================================================================
                    272:   Fonction 'drws'
                    273: ================================================================================
                    274:   Entrées : pointeur sur une structure struct_processus
                    275: --------------------------------------------------------------------------------
                    276:   Sorties :
                    277: --------------------------------------------------------------------------------
                    278:   Effets de bord : néant
                    279: ================================================================================
                    280: */
                    281: 
                    282: void
                    283: instruction_drws(struct_processus *s_etat_processus)
                    284: {
                    285:    file                        *fichier;
                    286: 
                    287:    int                         dimensions;
                    288: 
                    289:    logical1                    presence_variable;
                    290:    logical1                    matrice_entiere;
                    291: 
                    292:    long                        i;
                    293: 
                    294:    struct_objet                *s_objet_statistique;
                    295: 
                    296:    unsigned char               *nom_fichier;
                    297: 
                    298:    unsigned long               j;
                    299: 
                    300:    struct_fichier_graphique    *l_fichier_courant;
                    301:    struct_fichier_graphique    *l_fichier_precedent;
                    302: 
                    303:    (*s_etat_processus).erreur_execution = d_ex;
                    304: 
                    305:    if ((*s_etat_processus).affichage_arguments == 'Y')
                    306:    {
                    307:        printf("\n  DRWS ");
                    308: 
                    309:        if ((*s_etat_processus).langue == 'F')
                    310:        {
                    311:            printf("(affiche une série statistique)\n\n");
                    312:            printf("  Aucun argument\n");
                    313:        }
                    314:        else
                    315:        {
                    316:            printf("(draw statistical data)\n\n");
                    317:            printf("  No argument\n");
                    318:        }
                    319: 
                    320:        return;
                    321:    }
                    322:    else if ((*s_etat_processus).test_instruction == 'Y')
                    323:    {
                    324:        (*s_etat_processus).nombre_arguments = -1;
                    325:        return;
                    326:    }
                    327: 
                    328:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                    329:    {
                    330:        if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
                    331:        {
                    332:            return;
                    333:        }
                    334:    }
                    335: 
                    336:    /*
                    337:     * Vérification de la présence de la matrice statistique
                    338:     */
                    339: 
                    340:    if (recherche_variable(s_etat_processus, ds_sdat) == d_faux)
                    341:    {
                    342:        /*
                    343:         * Aucune variable ds_sdat n'existe.
                    344:         */
                    345: 
                    346:        (*s_etat_processus).erreur_execution = d_ex_absence_observations;
                    347:        (*s_etat_processus).erreur_systeme = d_es;
                    348: 
                    349:        return;
                    350:    }
                    351: 
                    352:    i = (*s_etat_processus).position_variable_courante;
                    353:    presence_variable = d_faux;
                    354: 
                    355:    while(i >= 0)
                    356:    {
                    357:        if ((strcmp((*s_etat_processus).s_liste_variables[i].nom,
                    358:                ds_sdat) == 0) && ((*s_etat_processus)
                    359:                .s_liste_variables[i].niveau == 1))
                    360:        {
                    361:            presence_variable = d_vrai;
                    362:            break;
                    363:        }
                    364: 
                    365:        i--;
                    366:    }
                    367: 
                    368:    if (presence_variable == d_faux)
                    369:    {
                    370:        (*s_etat_processus).erreur_execution = d_ex_absence_observations;
                    371:        return;
                    372:    }
                    373: 
                    374:    if ((s_objet_statistique = (*s_etat_processus).s_liste_variables[i].objet)
                    375:            == NULL)
                    376:    {
                    377:        (*s_etat_processus).erreur_execution = d_ex_variable_partagee;
                    378:        return;
                    379:    }
                    380: 
                    381:    if ((*s_objet_statistique).type == MIN)
                    382:    {
                    383:        matrice_entiere = d_vrai;
                    384:    }
                    385:    else if ((*s_objet_statistique).type == MRL)
                    386:    {
                    387:        matrice_entiere = d_faux;
                    388:    }
                    389:    else
                    390:    {
                    391:        (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
                    392:        return;
                    393:    }
                    394: 
                    395:    /*
                    396:     * Création du fichier graphique temporaire
                    397:     */
                    398: 
                    399:    if ((nom_fichier = creation_nom_fichier(s_etat_processus,
                    400:            (*s_etat_processus).chemin_fichiers_temporaires)) == NULL)
                    401:    {
                    402:        (*s_etat_processus).erreur_systeme = d_es_erreur_fichier;
                    403:        return;
                    404:    }
                    405: 
                    406:    if ((fichier = fopen(nom_fichier, "w+")) == NULL)
                    407:    {
                    408:        (*s_etat_processus).erreur_systeme = d_es_erreur_fichier;
                    409:        return;
                    410:    }
                    411: 
                    412:    switch((*((struct_matrice *) (*s_objet_statistique).objet)).nombre_colonnes)
                    413:    {
                    414: 
                    415:    /*
                    416:     * Une seule colonne
                    417:     */
                    418: 
                    419:        case 1 :
                    420:        {
                    421:            dimensions = 2;
                    422: 
                    423:            for(j = 0; j < (*((struct_matrice *) (*s_objet_statistique).objet))
                    424:                    .nombre_lignes; j++)
                    425:            {
                    426:                if (matrice_entiere == d_vrai)
                    427:                {
                    428:                    if (fprintf(fichier, "%f %f\n", (double) j, (double)
                    429:                            ((integer8 **) (*((struct_matrice *)
                    430:                            (*s_objet_statistique).objet)).tableau)[j][0]) < 0)
                    431:                    {
                    432:                        (*s_etat_processus).erreur_systeme =
                    433:                                d_es_erreur_fichier;
                    434:                        return;
                    435:                    }
                    436:                }
                    437:                else
                    438:                {
                    439:                    if (fprintf(fichier, "%f %f\n", (double) j, (double)
                    440:                            ((real8 **) (*((struct_matrice *)
                    441:                            (*s_objet_statistique).objet)).tableau)[j][0]) < 0)
                    442:                    {
                    443:                        (*s_etat_processus).erreur_systeme =
                    444:                                d_es_erreur_fichier;
                    445:                        return;
                    446:                    }
                    447:                }
                    448:            }
                    449: 
                    450:            break;
                    451:        }
                    452: 
                    453:    /*
                    454:     * Deux colonnes ou plus
                    455:     */
                    456: 
                    457:        default :
                    458:        {
                    459:            dimensions = 2;
                    460: 
                    461:            if (((*s_etat_processus).colonne_statistique_1 < 1) ||
                    462:                    ((*s_etat_processus).colonne_statistique_2 < 1) ||
                    463:                    ((*s_etat_processus).colonne_statistique_1 > (signed long)
                    464:                    (*((struct_matrice *) (*s_objet_statistique).objet))
                    465:                    .nombre_colonnes) ||
                    466:                    ((*s_etat_processus).colonne_statistique_2 > (signed long)
                    467:                    (*((struct_matrice *) (*s_objet_statistique).objet))
                    468:                    .nombre_colonnes))
                    469:            {
                    470:                if (fclose(fichier) != 0)
                    471:                {
                    472:                    (*s_etat_processus).erreur_systeme = d_es_erreur_fichier;
                    473:                    return;
                    474:                }
                    475: 
                    476:                if (destruction_fichier(nom_fichier) == d_erreur)
                    477:                {
                    478:                    (*s_etat_processus).erreur_systeme = d_es_erreur_fichier;
                    479:                    return;
                    480:                }
                    481: 
                    482:                free(nom_fichier);
                    483: 
                    484:                (*s_etat_processus).erreur_execution =
                    485:                        d_ex_observations_inexistantes;
                    486:                return;
                    487:            }
                    488: 
                    489:            for(j = 0; j < (*((struct_matrice *) (*s_objet_statistique).objet))
                    490:                    .nombre_lignes; j++)
                    491:            {
                    492:                if (matrice_entiere == d_vrai)
                    493:                {
                    494:                    if (fprintf(fichier, "%f %f\n", (double) ((integer8 **)
                    495:                            (*((struct_matrice *) (*s_objet_statistique).objet))
                    496:                            .tableau)[j][(*s_etat_processus)
                    497:                            .colonne_statistique_1 - 1], (double) ((integer8 **)
                    498:                            (*((struct_matrice *) (*s_objet_statistique).objet))
                    499:                            .tableau)[j][(*s_etat_processus)
                    500:                            .colonne_statistique_2 - 1]) < 0)
                    501:                    {
                    502:                        (*s_etat_processus).erreur_systeme =
                    503:                                d_es_erreur_fichier;
                    504:                        return;
                    505:                    }
                    506:                }
                    507:                else
                    508:                {
                    509:                    if (fprintf(fichier, "%f %f\n", (double) ((real8 **)
                    510:                            (*((struct_matrice *) (*s_objet_statistique).objet))
                    511:                            .tableau)[j][(*s_etat_processus)
                    512:                            .colonne_statistique_1 - 1], (double) ((real8 **)
                    513:                            (*((struct_matrice *) (*s_objet_statistique).objet))
                    514:                            .tableau)[j][(*s_etat_processus)
                    515:                            .colonne_statistique_2 - 1]) < 0)
                    516:                    {
                    517:                        (*s_etat_processus).erreur_systeme =
                    518:                                d_es_erreur_fichier;
                    519:                        return;
                    520:                    }
                    521:                }
                    522:            }
                    523: 
                    524:            break;
                    525:        }
                    526:    }
                    527: 
                    528:    /*
                    529:     * Fermeture du fichier graphique
                    530:     */
                    531: 
                    532:    if (fclose(fichier) != 0)
                    533:    {
                    534:        (*s_etat_processus).erreur_systeme = d_es_erreur_fichier;
                    535:        return;
                    536:    }
                    537: 
                    538:    /*
                    539:     * Chaînage du fichier temporaire à la liste des fichiers graphiques
                    540:     */
                    541: 
                    542:    l_fichier_courant = (*s_etat_processus).fichiers_graphiques;
                    543: 
                    544:    if (l_fichier_courant == NULL)
                    545:    {
                    546:        if (((*s_etat_processus).fichiers_graphiques = malloc(
                    547:                sizeof(struct_fichier_graphique))) == NULL)
                    548:        {
                    549:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    550:            return;
                    551:        }
                    552: 
                    553:        (*(*s_etat_processus).fichiers_graphiques).suivant = NULL;
                    554:        (*(*s_etat_processus).fichiers_graphiques).nom = nom_fichier;
                    555:        (*(*s_etat_processus).fichiers_graphiques).legende = NULL;
                    556:        (*(*s_etat_processus).fichiers_graphiques).dimensions = dimensions;
                    557:        (*(*s_etat_processus).fichiers_graphiques).presence_axes = d_faux;
                    558:        (*(*s_etat_processus).fichiers_graphiques).systeme_axes =
                    559:                (*s_etat_processus).systeme_axes;
                    560:        strcpy((*(*s_etat_processus).fichiers_graphiques).type,
                    561:                (*s_etat_processus).type_trace_sigma);
                    562:    }
                    563:    else
                    564:    {
                    565:        while(l_fichier_courant != NULL)
                    566:        {
                    567:            if ((*l_fichier_courant).dimensions != dimensions)
                    568:            {
                    569:                (*s_etat_processus).erreur_execution =
                    570:                        d_ex_dimensions_differentes;
                    571:                return;
                    572:            }
                    573: 
                    574:            l_fichier_precedent = l_fichier_courant;
                    575:            l_fichier_courant = (*l_fichier_courant).suivant;
                    576:        }
                    577: 
                    578:        l_fichier_courant = l_fichier_precedent;
                    579: 
                    580:        if (((*l_fichier_courant).suivant = malloc(
                    581:                sizeof(struct_fichier_graphique))) == NULL)
                    582:        {
                    583:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    584:            return;
                    585:        }
                    586: 
                    587:        l_fichier_courant = (*l_fichier_courant).suivant;
                    588: 
                    589:        (*l_fichier_courant).suivant = NULL;
                    590:        (*l_fichier_courant).nom = nom_fichier;
                    591:        (*l_fichier_courant).legende = NULL;
                    592:        (*l_fichier_courant).dimensions = dimensions;
                    593:        (*l_fichier_courant).presence_axes = d_faux;
                    594:        (*l_fichier_courant).systeme_axes = (*s_etat_processus).systeme_axes;
                    595:        strcpy((*l_fichier_courant).type, (*s_etat_processus).type_trace_sigma);
                    596:    }
                    597: 
                    598:    /*
                    599:     * Affichage du graphique
                    600:     */
                    601: 
                    602:    appel_gnuplot(s_etat_processus, 'N');
                    603:    (*s_etat_processus).erreur_execution = d_ex;
                    604:    (*s_etat_processus).exception = d_ep;
                    605: 
                    606:    return;
                    607: }
                    608: 
                    609: 
                    610: /*
                    611: ================================================================================
                    612:   Fonction 'decr'
                    613: ================================================================================
                    614:   Entrées :
                    615: --------------------------------------------------------------------------------
                    616:   Sorties :
                    617: --------------------------------------------------------------------------------
                    618:   Effets de bord : néant
                    619: ================================================================================
                    620: */
                    621: 
                    622: void
                    623: instruction_decr(struct_processus *s_etat_processus)
                    624: {
                    625:    logical1                    variable_partagee;
                    626: 
                    627:    struct_objet                *s_copie_argument;
                    628:    struct_objet                *s_objet_argument;
                    629: 
                    630:    (*s_etat_processus).erreur_execution = d_ex;
                    631: 
                    632:    if ((*s_etat_processus).affichage_arguments == 'Y')
                    633:    {
                    634:        printf("\n  DECR ");
                    635: 
                    636:        if ((*s_etat_processus).langue == 'F')
                    637:        {
                    638:            printf("(décrémentation)\n\n");
                    639:        }
                    640:        else
                    641:        {
                    642:            printf("(decrementation)\n\n");
                    643:        }
                    644: 
                    645:        printf("    1: %s\n", d_INT);
                    646:        printf("->  1: %s\n\n", d_INT);
                    647: 
                    648:        printf("    1: %s\n", d_NOM);
                    649: 
                    650:        return;
                    651:    }
                    652:    else if ((*s_etat_processus).test_instruction == 'Y')
                    653:    {
                    654:        (*s_etat_processus).nombre_arguments = -1;
                    655:        return;
                    656:    }
                    657: 
                    658:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                    659:    {
                    660:        if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
                    661:        {
                    662:            return;
                    663:        }
                    664:    }
                    665: 
                    666:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                    667:            &s_objet_argument) == d_erreur)
                    668:    {
                    669:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                    670:        return;
                    671:    }
                    672: 
                    673:    if ((*s_objet_argument).type == INT)
                    674:    {
                    675:        if ((s_copie_argument = copie_objet(s_etat_processus,
                    676:                s_objet_argument, 'O')) == NULL)
                    677:        {
                    678:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    679:            return;
                    680:        }
                    681: 
                    682:        liberation(s_etat_processus, s_objet_argument);
                    683:        s_objet_argument = s_copie_argument;
                    684: 
                    685:        (*((integer8 *) (*s_objet_argument).objet))--;
                    686: 
                    687:        if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                    688:                s_objet_argument) == d_erreur)
                    689:        {
                    690:            return;
                    691:        }
                    692:    }
                    693:    else if ((*s_objet_argument).type == NOM)
                    694:    {
                    695:        if (recherche_variable(s_etat_processus, (*((struct_nom *)
                    696:                (*s_objet_argument).objet)).nom) == d_faux)
                    697:        {
                    698:            (*s_etat_processus).erreur_systeme = d_es;
                    699:            (*s_etat_processus).erreur_execution = d_ex_variable_non_definie;
                    700: 
                    701:            return;
                    702:        }
                    703: 
                    704:        liberation(s_etat_processus, s_objet_argument);
                    705: 
                    706:        if ((*s_etat_processus).s_liste_variables
                    707:                [(*s_etat_processus).position_variable_courante]
                    708:                .variable_verrouillee == d_vrai)
                    709:        {
                    710:            (*s_etat_processus).erreur_execution =
                    711:                    d_ex_variable_verrouillee;
                    712:            return;
                    713:        }
                    714: 
                    715:        if ((*s_etat_processus).s_liste_variables
                    716:                [(*s_etat_processus).position_variable_courante].objet
                    717:                == NULL)
                    718:        {
                    719:            if (pthread_mutex_lock(&((*(*s_etat_processus)
                    720:                    .s_liste_variables_partagees).mutex)) != 0)
                    721:            {
                    722:                (*s_etat_processus).erreur_systeme = d_es_processus;
                    723:                return;
                    724:            }
                    725: 
                    726:            if (recherche_variable_partagee(s_etat_processus,
                    727:                    (*s_etat_processus).s_liste_variables
                    728:                    [(*s_etat_processus).position_variable_courante].nom,
                    729:                    (*s_etat_processus).s_liste_variables
                    730:                    [(*s_etat_processus).position_variable_courante]
                    731:                    .variable_partagee, (*s_etat_processus).s_liste_variables
                    732:                    [(*s_etat_processus).position_variable_courante]
                    733:                    .origine) == d_faux)
                    734:            {
                    735:                (*s_etat_processus).erreur_systeme = d_es;
                    736:                (*s_etat_processus).erreur_execution =
                    737:                        d_ex_variable_non_definie;
                    738: 
                    739:                return;
                    740:            }
                    741: 
                    742:            s_objet_argument = (*(*s_etat_processus)
                    743:                    .s_liste_variables_partagees).table
                    744:                    [(*(*s_etat_processus).s_liste_variables_partagees)
                    745:                    .position_variable].objet;
                    746:            variable_partagee = d_vrai;
                    747:        }
                    748:        else
                    749:        {
                    750:            s_objet_argument = (*s_etat_processus).s_liste_variables
                    751:                    [(*s_etat_processus).position_variable_courante].objet;
                    752:            variable_partagee = d_faux;
                    753:        }
                    754: 
                    755:        if ((s_copie_argument = copie_objet(s_etat_processus,
                    756:                s_objet_argument, 'O')) == NULL)
                    757:        {
                    758:            if (variable_partagee == d_vrai)
                    759:            {
                    760:                if (pthread_mutex_unlock(&((*(*s_etat_processus)
                    761:                        .s_liste_variables_partagees).mutex)) != 0)
                    762:                {
                    763:                    (*s_etat_processus).erreur_systeme = d_es_processus;
                    764:                    return;
                    765:                }
                    766:            }
                    767: 
                    768:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    769:            return;
                    770:        }
                    771: 
                    772:        liberation(s_etat_processus, s_objet_argument);
                    773: 
                    774:        if (variable_partagee == d_vrai)
                    775:        {
                    776:            (*s_etat_processus).s_liste_variables[(*s_etat_processus)
                    777:                    .position_variable_courante].objet = NULL;
                    778:            (*(*s_etat_processus)
                    779:                    .s_liste_variables_partagees).table
                    780:                    [(*(*s_etat_processus).s_liste_variables_partagees)
                    781:                    .position_variable].objet = s_copie_argument;
                    782:        }
                    783:        else
                    784:        {
                    785:            (*s_etat_processus).s_liste_variables[(*s_etat_processus)
                    786:                    .position_variable_courante].objet = s_copie_argument;
                    787:        }
                    788: 
                    789:        if ((*s_copie_argument).type == INT)
                    790:        {
                    791:            (*((integer8 *) (*s_copie_argument).objet))--;
                    792: 
                    793:            if (variable_partagee == d_vrai)
                    794:            {
                    795:                if (pthread_mutex_unlock(&((*(*s_etat_processus)
                    796:                        .s_liste_variables_partagees).mutex)) != 0)
                    797:                {
                    798:                    (*s_etat_processus).erreur_systeme = d_es_processus;
                    799:                    return;
                    800:                }
                    801:            }
                    802:        }
                    803:        else
                    804:        {
                    805:            if (variable_partagee == d_vrai)
                    806:            {
                    807:                if (pthread_mutex_unlock(&((*(*s_etat_processus)
                    808:                        .s_liste_variables_partagees).mutex)) != 0)
                    809:                {
                    810:                    (*s_etat_processus).erreur_systeme = d_es_processus;
                    811:                    return;
                    812:                }
                    813:            }
                    814: 
                    815:            (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
                    816:            return;
                    817:        }
                    818:    }
                    819:    else
                    820:    {
                    821:        (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
                    822: 
                    823:        liberation(s_etat_processus, s_objet_argument);
                    824:        return;
                    825:    }
                    826: 
                    827:    return;
                    828: }
                    829: 
                    830: // vim: ts=4

CVSweb interface <joel.bertrand@systella.fr>