Annotation of rpl/src/rpl.c, revision 1.24

1.1       bertrand    1: /*
                      2: ================================================================================
1.18      bertrand    3:   RPL/2 (R) version 4.0.15
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: #define  MAIN_RPL
                     24: #include "rpl.conv.h"
                     25: 
                     26: 
                     27: /*
                     28: ================================================================================
                     29:   Programme principal
                     30: ================================================================================
                     31: */
                     32: 
                     33: int
1.11      bertrand   34: rplinit(int argc, char *argv[], unsigned char ***resultats, char *rpl_home)
1.1       bertrand   35: {
                     36: #  include                             "copyright.conv.h"
                     37: #  include                             "licence.conv.h"
                     38: 
                     39:    file                                *f_source;
                     40: 
                     41:    int                                 erreur_historique;
                     42:    int                                 option_P;
                     43:    int                                 status;
                     44: 
                     45:    logical1                            core;
                     46:    logical1                            debug;
                     47:    logical1                            erreur_fichier;
                     48:    logical1                            existence;
                     49:    logical1                            mode_interactif;
                     50:    logical1                            option_a;
                     51:    logical1                            option_A;
                     52:    logical1                            option_c;
                     53:    logical1                            option_d;
                     54:    logical1                            option_D;
                     55:    logical1                            option_h;
                     56:    logical1                            option_i;
                     57:    logical1                            option_l;
                     58:    logical1                            option_n;
                     59:    logical1                            option_p;
                     60:    logical1                            option_s;
                     61:    logical1                            option_S;
                     62:    logical1                            option_t;
                     63:    logical1                            option_v;
                     64:    logical1                            ouverture;
                     65: 
                     66:    pthread_mutexattr_t                 attributs_mutex;
                     67: 
                     68:    ssize_t                             longueur_ecriture;
                     69: 
                     70:    struct_objet                        *s_objet;
                     71: 
                     72:    struct_processus                    *s_etat_processus;
                     73: 
                     74:    struct_table_variables_partagees    s_variables_partagees;
                     75: 
                     76:    struct sigaction                    action;
                     77:    struct sigaction                    registre;
                     78: 
                     79:    struct timespec                     attente;
                     80: 
                     81:    unsigned char                       *arguments;
                     82:    unsigned char                       drapeau_encart;
                     83:    unsigned char                       *type_debug;
                     84:    unsigned char                       *home;
                     85:    unsigned char                       *langue;
                     86:    unsigned char                       *message;
                     87:    unsigned char                       *nom_fichier_temporaire;
                     88:    unsigned char                       option;
                     89:    unsigned char                       presence_definition;
                     90:    unsigned char                       *ptr;
                     91:    unsigned char                       *tampon;
                     92: 
                     93:    unsigned long                       i;
                     94:    unsigned long                       unite_fichier;
                     95: 
                     96:    void                                *l_element_courant;
                     97:    void                                *l_element_suivant;
                     98: 
                     99:    volatile int                        erreur;
                    100:    volatile unsigned char              traitement_fichier_temporaire;
                    101: 
                    102:    setvbuf(stdout, NULL, _IOLBF, 0);
                    103:    setvbuf(stderr, NULL, _IOLBF, 0);
                    104: 
1.17      bertrand  105: #  ifndef SEMAPHORES_NOMMES
1.1       bertrand  106:    sem_init(&semaphore_liste_threads, 0, 1);
                    107:    sem_init(&semaphore_gestionnaires_signaux, 0, 0);
                    108:    sem_init(&semaphore_gestionnaires_signaux_atomique, 0, 1);
1.17      bertrand  109: #  else
                    110:    semaphore_liste_threads = sem_init2(1, sem_liste_threads);
                    111:    semaphore_gestionnaires_signaux = sem_init2(0, sem_gestionnaires_signaux);
                    112:    semaphore_gestionnaires_signaux_atomique = sem_init2(1,
                    113:            sem_gestionnaires_signaux_atomique);
                    114: 
                    115:    if ((semaphore_liste_threads == SEM_FAILED) ||
                    116:            (semaphore_gestionnaires_signaux == SEM_FAILED) ||
                    117:            (semaphore_gestionnaires_signaux_atomique == SEM_FAILED))
                    118:    {
                    119:        erreur = d_es_allocation_memoire;
                    120: 
                    121:        if ((langue = getenv("LANG")) != NULL)
                    122:        {
                    123:            if (strncmp(langue, "fr", 2) == 0)
                    124:            {
                    125:                uprintf("+++Système : Mémoire insuffisante\n");
                    126:            }
                    127:            else
                    128:            {
                    129:                uprintf("+++System : Not enough memory\n");
                    130:            }
                    131:        }
                    132:        else
                    133:        {
                    134:            uprintf("+++System : Not enough memory\n");
                    135:        }
                    136: 
                    137:        return(EXIT_FAILURE);
                    138:    }
                    139: #  endif
1.1       bertrand  140: 
                    141:    if ((s_etat_processus = malloc(sizeof(struct_processus))) == NULL)
                    142:    {
                    143:        erreur = d_es_allocation_memoire;
                    144: 
1.17      bertrand  145:        if ((langue = getenv("LANG")) != NULL)
1.1       bertrand  146:        {
1.17      bertrand  147:            if (strncmp(langue, "fr", 2) == 0)
                    148:            {
                    149:                uprintf("+++Système : Mémoire insuffisante\n");
                    150:            }
                    151:            else
                    152:            {
                    153:                uprintf("+++System : Not enough memory\n");
                    154:            }
1.1       bertrand  155:        }
                    156:        else
                    157:        {
1.17      bertrand  158:            uprintf("+++System : Not enough memory\n");
1.1       bertrand  159:        }
                    160: 
                    161:        return(EXIT_FAILURE);
                    162:    }
                    163: 
1.17      bertrand  164:    if ((langue = getenv("LANG")) != NULL)
                    165:    {
                    166:        (*s_etat_processus).langue = (strncmp(langue, "fr", 2) == 0)
                    167:                ? 'F' : 'E';
                    168:    }
                    169:    else
                    170:    {
                    171:        (*s_etat_processus).langue = 'E';
                    172:    }
                    173: 
1.1       bertrand  174:    (*s_etat_processus).exception = d_ep;
                    175:    (*s_etat_processus).erreur_systeme = d_es;
                    176:    (*s_etat_processus).erreur_execution = d_ex;
                    177: 
1.11      bertrand  178:    (*s_etat_processus).rpl_home = rpl_home;
                    179: 
1.1       bertrand  180:    insertion_thread(s_etat_processus, d_vrai);
                    181: 
                    182:    pthread_mutexattr_init(&attributs_mutex);
                    183:    pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_NORMAL);
                    184:    pthread_mutex_init(&((*s_etat_processus).mutex), &attributs_mutex);
                    185:    pthread_mutexattr_destroy(&attributs_mutex);
                    186: 
1.17      bertrand  187: #  ifndef SEMAPHORES_NOMMES
1.1       bertrand  188:    sem_init(&((*s_etat_processus).semaphore_fork), 0, 0);
1.17      bertrand  189: #  else
                    190:    if (((*s_etat_processus).semaphore_fork = sem_init2(0, sem_fork)) ==
                    191:            SEM_FAILED)
                    192:    {
                    193:        if ((*s_etat_processus).langue == 'F')
                    194:        {
                    195:            uprintf("+++Système : Mémoire insuffisante\n");
                    196:        }
                    197:        else
                    198:        {
                    199:            uprintf("+++System : Not enough memory\n");
                    200:        }
                    201: 
                    202:        return(EXIT_FAILURE);
                    203:    }
                    204: #  endif
1.1       bertrand  205: 
                    206:    pthread_mutexattr_init(&attributs_mutex);
                    207:    pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_NORMAL);
                    208:    pthread_mutex_init(&((*s_etat_processus).protection_liste_mutexes),
                    209:            &attributs_mutex);
                    210:    pthread_mutexattr_destroy(&attributs_mutex);
                    211: 
                    212:    (*s_etat_processus).s_liste_variables_partagees = &s_variables_partagees;
                    213: 
                    214:    s_variables_partagees.nombre_variables = 0;
                    215:    s_variables_partagees.nombre_variables_allouees = 0;
                    216:    s_variables_partagees.table = NULL;
                    217: 
                    218:    pthread_mutexattr_init(&attributs_mutex);
                    219:    pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_NORMAL);
                    220:    pthread_mutex_init(&((*((*s_etat_processus).s_liste_variables_partagees))
                    221:            .mutex), &attributs_mutex);
                    222:    pthread_mutexattr_destroy(&attributs_mutex);
                    223: 
                    224:    localisation_courante(s_etat_processus);
1.17      bertrand  225:    (*s_etat_processus).erreur_systeme = d_es;
1.1       bertrand  226: 
1.17      bertrand  227:    if ((*s_etat_processus).localisation == NULL)
1.1       bertrand  228:    {
1.17      bertrand  229:        if (((*s_etat_processus).localisation = malloc((strlen(d_locale) + 1) *
                    230:                sizeof(unsigned char))) == NULL)
1.1       bertrand  231:        {
1.17      bertrand  232:            if ((*s_etat_processus).langue == 'F')
                    233:            {
                    234:                uprintf("+++Système : Mémoire insuffisante\n");
                    235:            }
                    236:            else
                    237:            {
                    238:                uprintf("+++System : Not enough memory\n");
                    239:            }
                    240: 
                    241:            return(EXIT_FAILURE);
1.1       bertrand  242:        }
                    243: 
1.17      bertrand  244:        strcpy((*s_etat_processus).localisation, d_locale);
1.1       bertrand  245:    }
                    246: 
                    247:    printf("+++RPL/2 (R) version %s (%s)\n", d_version_rpl,
                    248:            ((*s_etat_processus).langue == 'F') ? d_date_rpl : d_date_en_rpl);
                    249: 
                    250:    if ((*s_etat_processus).langue == 'F')
                    251:    {
                    252:        printf("+++Copyright (C) 1989 à 2009, 2010 BERTRAND Joël\n");
                    253:    }
                    254:    else
                    255:    {
                    256:        printf("+++Copyright (C) 1989 to 2009, 2010 BERTRAND Joel\n");
                    257:    }
                    258: 
                    259:    if (getenv("HOME") != NULL)
                    260:    {
                    261:        home = getenv("HOME");
                    262:    }
                    263:    else if ((getenv("USER") != NULL) && (getpwnam(getenv("USER")) != NULL))
                    264:    {
                    265:        home = getpwnam(getenv("USER"))->pw_dir;
                    266:    }
                    267:    else if ((getenv("LOGNAME") != NULL) && (getpwnam(getenv("LOGNAME"))
                    268:            != NULL))
                    269:    {
                    270:        home = getpwnam(getenv("LOGNAME"))->pw_dir;
                    271:    }
                    272:    else if ((getuid() != ((uid_t) -1)) && (getpwuid(getuid()) != NULL))
                    273:    {
                    274:        home = getpwuid(getuid())->pw_dir;
                    275:    }
                    276:    else
                    277:    {
                    278:        home = "";
                    279:    }
                    280: 
                    281:    // Initialisation d'une clef
                    282: 
                    283:    if (pthread_key_create(&semaphore_fork_processus_courant, NULL) != 0)
                    284:    {
                    285:        if ((*s_etat_processus).langue == 'F')
                    286:        {
                    287:            printf("+++Système : Mémoire insuffisante\n");
                    288:        }
                    289:        else
                    290:        {
                    291:            printf("+++System : Not enough memory\n");
                    292:        }
                    293: 
                    294:        return(EXIT_FAILURE);
                    295:    }
                    296: 
1.17      bertrand  297: #  ifndef SEMAPHORES_NOMMES
1.1       bertrand  298:    if (pthread_setspecific(semaphore_fork_processus_courant,
                    299:            &((*s_etat_processus).semaphore_fork)) != 0)
1.17      bertrand  300: #  else
                    301:    if (pthread_setspecific(semaphore_fork_processus_courant,
                    302:            (*s_etat_processus).semaphore_fork) != 0)
                    303: #  endif
1.1       bertrand  304:    {
                    305:        if ((*s_etat_processus).langue == 'F')
                    306:        {
                    307:            printf("+++Système : Mémoire insuffisante\n");
                    308:        }
                    309:        else
                    310:        {
                    311:            printf("+++System : Not enough memory\n");
                    312:        }
                    313: 
                    314:        return(EXIT_FAILURE);
                    315:    }
                    316: 
                    317:    // Initialisation d'une pile de signal pour récupérer les
                    318:    // débordement de pile
                    319: 
1.9       bertrand  320: #  ifndef Cygwin
1.1       bertrand  321:    if (((*s_etat_processus).pile_signal.ss_sp =
                    322:            malloc((*s_etat_processus).pile_signal.ss_size =
                    323:            SIGSTKSZ)) == NULL)
                    324:    {
                    325:        erreur = d_es_allocation_memoire;
                    326: 
                    327:        if ((*s_etat_processus).langue == 'F')
                    328:        {
                    329:            printf("+++Système : Mémoire insuffisante\n");
                    330:        }
                    331:        else
                    332:        {
                    333:            printf("+++System : Not enough memory\n");
                    334:        }
                    335: 
                    336:        return(EXIT_FAILURE);
                    337:    }
                    338: 
                    339:    (*s_etat_processus).pile_signal.ss_flags = 0;
                    340: 
                    341:    if (sigaltstack(&((*s_etat_processus).pile_signal), NULL) != 0)
                    342:    {
                    343:        erreur = d_es_signal;
                    344: 
                    345:        if ((*s_etat_processus).langue == 'F')
                    346:        {
                    347:            printf("+++Système : Initialisation de la pile spécifique de signal"
                    348:                    " impossible\n");
                    349:        }
                    350:        else
                    351:        {
                    352:            printf("+++System : Initialization of signal stack failed\n");
                    353:        }
                    354: 
                    355:        return(EXIT_FAILURE);
                    356:    }
1.9       bertrand  357: #  endif
1.1       bertrand  358: 
                    359:    action.sa_sigaction = interruption1;
                    360:    action.sa_flags = SA_ONSTACK | SA_SIGINFO;
                    361: 
                    362:    if (sigaction(SIGINT, &action, NULL) != 0)
                    363:    {
                    364:        erreur = d_es_signal;
                    365: 
                    366:        if ((*s_etat_processus).langue == 'F')
                    367:        {
                    368:            printf("+++Système : Initialisation des signaux POSIX "
                    369:                    "impossible\n");
                    370:        }
                    371:        else
                    372:        {
                    373:            printf("+++System : Initialization of POSIX signals failed\n");
                    374:        }
                    375: 
                    376:        return(EXIT_FAILURE);
                    377:    }
                    378: 
                    379:    action.sa_sigaction = interruption2;
                    380:    action.sa_flags = SA_NODEFER | SA_ONSTACK | SA_SIGINFO;
                    381: 
                    382:    if (sigaction(SIGTSTP, &action, NULL) != 0)
                    383:    {
                    384:        if ((*s_etat_processus).langue == 'F')
                    385:        {
                    386:            printf("+++Système : Initialisation des signaux POSIX "
                    387:                    "impossible\n");
                    388:        }
                    389:        else
                    390:        {
                    391:            printf("+++System : Initialization of POSIX signals failed\n");
                    392:        }
                    393: 
                    394:        return(EXIT_FAILURE);
                    395:    }
                    396: 
                    397:    action.sa_sigaction = interruption4;
                    398:    action.sa_flags = SA_ONSTACK | SA_SIGINFO;
                    399: 
                    400:    if (sigaction(SIGSTART, &action, NULL) != 0)
                    401:    {
                    402:        if ((*s_etat_processus).langue == 'F')
                    403:        {
                    404:            printf("+++Système : Initialisation des signaux POSIX "
                    405:                    "impossible\n");
                    406:        }
                    407:        else
                    408:        {
                    409:            printf("+++System : Initialization of POSIX signals failed\n");
                    410:        }
                    411: 
                    412:        return(EXIT_FAILURE);
                    413:    }
                    414: 
                    415:    if (sigaction(SIGCONT, &action, NULL) != 0)
                    416:    {
                    417:        if ((*s_etat_processus).langue == 'F')
                    418:        {
                    419:            printf("+++Système : Initialisation des signaux POSIX "
                    420:                    "impossible\n");
                    421:        }
                    422:        else
                    423:        {
                    424:            printf("+++System : Initialization of POSIX signals failed\n");
                    425:        }
                    426: 
                    427:        return(EXIT_FAILURE);
                    428:    }
                    429: 
                    430:    action.sa_sigaction = interruption5;
                    431:    action.sa_flags = SA_NODEFER | SA_ONSTACK | SA_SIGINFO;
                    432: 
                    433:    if (sigaction(SIGFSTOP, &action, NULL) != 0)
                    434:    {
                    435:        erreur = d_es_signal;
                    436: 
                    437:        if ((*s_etat_processus).langue == 'F')
                    438:        {
                    439:            printf("+++Système : Initialisation des signaux POSIX "
                    440:                    "impossible\n");
                    441:        }
                    442:        else
                    443:        {
                    444:            printf("+++System : Initialization of POSIX signals failed\n");
                    445:        }
                    446: 
                    447:        return(EXIT_FAILURE);
                    448:    }
                    449: 
1.22      bertrand  450:    if (sigaction(SIGFABORT, &action, NULL) != 0)
                    451:    {
                    452:        erreur = d_es_signal;
                    453: 
                    454:        if ((*s_etat_processus).langue == 'F')
                    455:        {
                    456:            printf("+++Système : Initialisation des signaux POSIX "
                    457:                    "impossible\n");
                    458:        }
                    459:        else
                    460:        {
                    461:            printf("+++System : Initialization of POSIX signals failed\n");
                    462:        }
                    463: 
                    464:        return(EXIT_FAILURE);
                    465:    }
                    466: 
1.1       bertrand  467:    action.sa_sigaction = interruption8;
                    468:    action.sa_flags = SA_NODEFER | SA_ONSTACK | SA_SIGINFO;
                    469: 
                    470:    if (sigaction(SIGURG, &action, NULL) != 0)
                    471:    {
                    472:        erreur = d_es_signal;
                    473: 
                    474:        if ((*s_etat_processus).langue == 'F')
                    475:        {
                    476:            printf("+++Système : Initialisation des signaux POSIX "
                    477:                    "impossible\n");
                    478:        }
                    479:        else
                    480:        {
                    481:            printf("+++System : Initialization of POSIX signals failed\n");
                    482:        }
                    483: 
                    484:        return(EXIT_FAILURE);
                    485:    }
                    486: 
                    487:    action.sa_sigaction = interruption7;
                    488:    action.sa_flags = SA_NODEFER | SA_ONSTACK | SA_SIGINFO;
                    489: 
                    490:    if (sigaction(SIGPIPE, &action, NULL) != 0)
                    491:    {
                    492:        erreur = d_es_signal;
                    493: 
                    494:        if ((*s_etat_processus).langue == 'F')
                    495:        {
                    496:            printf("+++Système : Initialisation des signaux POSIX "
                    497:                    "impossible\n");
                    498:        }
                    499:        else
                    500:        {
                    501:            printf("+++System : Initialization of POSIX signals failed\n");
                    502:        }
                    503: 
                    504:        return(EXIT_FAILURE);
                    505:    }
                    506: 
                    507:    action.sa_sigaction = interruption6;
                    508:    action.sa_flags = SA_ONSTACK | SA_SIGINFO;
                    509: 
                    510:    if (sigaction(SIGINJECT, &action, NULL) != 0)
                    511:    {
                    512:        erreur = d_es_signal;
                    513: 
                    514:        if ((*s_etat_processus).langue == 'F')
                    515:        {
                    516:            printf("+++Système : Initialisation des signaux POSIX "
                    517:                    "impossible\n");
                    518:        }
                    519:        else
                    520:        {
                    521:            printf("+++System : Initialization of POSIX signals failed\n");
                    522:        }
                    523: 
                    524:        return(EXIT_FAILURE);
                    525:    }
                    526: 
                    527:    action.sa_sigaction = interruption9;
                    528:    action.sa_flags = SA_ONSTACK | SA_SIGINFO;
                    529: 
                    530:    if (sigaction(SIGABORT, &action, NULL) != 0)
                    531:    {
                    532:        erreur = d_es_signal;
                    533: 
                    534:        if ((*s_etat_processus).langue == 'F')
                    535:        {
                    536:            printf("+++Système : Initialisation des signaux POSIX "
                    537:                    "impossible\n");
                    538:        }
                    539:        else
                    540:        {
                    541:            printf("+++System : Initialization of POSIX signals failed\n");
                    542:        }
                    543: 
                    544:        return(EXIT_FAILURE);
                    545:    }
                    546: 
                    547:    action.sa_sigaction = interruption1;
                    548:    action.sa_flags = SA_NODEFER | SA_ONSTACK | SA_SIGINFO;
                    549: 
                    550:    if (sigaction(SIGALRM, &action, NULL) != 0)
                    551:    {
                    552:        erreur = d_es_signal;
                    553: 
                    554:        if ((*s_etat_processus).langue == 'F')
                    555:        {
                    556:            printf("+++Système : Initialisation des signaux POSIX "
                    557:                    "impossible\n");
                    558:        }
                    559:        else
                    560:        {
                    561:            printf("+++System : Initialization of POSIX signals failed\n");
                    562:        }
                    563: 
                    564:        return(EXIT_FAILURE);
                    565:    }
                    566: 
                    567:    action.sa_sigaction = interruption3;
                    568:    action.sa_flags = SA_NODEFER | SA_ONSTACK | SA_SIGINFO;
                    569: 
                    570:    (*s_etat_processus).chemin_fichiers_temporaires =
                    571:            recherche_chemin_fichiers_temporaires(s_etat_processus);
                    572: 
1.13      bertrand  573:    erreur = d_absence_erreur;
1.1       bertrand  574:    core = d_faux;
                    575:    mode_interactif = d_faux;
                    576:    (*s_etat_processus).nom_fichier_source = NULL;
                    577:    (*s_etat_processus).definitions_chainees = NULL;
                    578:    (*s_etat_processus).type_debug = 0;
                    579:    traitement_fichier_temporaire = 'N';
                    580:    option = ' ';
                    581:    drapeau_encart = 'Y';
                    582:    debug = d_faux;
                    583:    arguments = NULL;
                    584: 
                    585:    (*s_etat_processus).s_fichiers = NULL;
                    586:    (*s_etat_processus).s_sockets = NULL;
                    587:    (*s_etat_processus).s_connecteurs_sql = NULL;
                    588: 
                    589:    setlogmask(LOG_MASK(LOG_NOTICE));
                    590:    openlog(argv[0], LOG_ODELAY | LOG_PID, LOG_USER);
                    591: 
                    592:    if (argc == 1)
                    593:    {
1.13      bertrand  594:        erreur = d_erreur;
1.1       bertrand  595:        informations(s_etat_processus);
                    596:    }
                    597:    else
                    598:    {
                    599:        presence_definition = 'N';
                    600:        (*s_etat_processus).debug = d_faux;
                    601:        (*s_etat_processus).lancement_interactif = d_faux;
                    602: 
                    603:        option_a = d_faux;
                    604:        option_A = d_faux;
                    605:        option_c = d_faux;
                    606:        option_d = d_faux;
                    607:        option_D = d_faux;
                    608:        option_h = d_faux;
                    609:        option_i = d_faux;
                    610:        option_l = d_faux;
                    611:        option_n = d_faux;
                    612:        option_p = d_faux;
                    613:        option_P = 0;
                    614:        option_s = d_faux;
                    615:        option_S = d_faux;
                    616:        option_t = d_faux;
                    617:        option_v = d_faux;
                    618: 
                    619:        while((--argc) > 0)
                    620:        {
                    621:            if ((*(++argv))[0] == '-')
                    622:            {
                    623:                while((option = *(++argv[0])) != '\0')
                    624:                {
                    625:                    switch(option)
                    626:                    {
                    627:                        case 'a' :
                    628:                        {
                    629:                            if (option_a == d_vrai)
                    630:                            {
                    631:                                if ((*s_etat_processus).langue == 'F')
                    632:                                {
                    633:                                    printf("+++Erreur : option -a présente "
                    634:                                            "plus d'une fois\n");
                    635:                                }
                    636:                                else
                    637:                                {
                    638:                                    printf("+++Error : more than one -a "
                    639:                                            "on command line");
                    640:                                }
                    641: 
                    642:                                return(EXIT_FAILURE);
                    643:                            }
                    644: 
                    645:                            option_a = d_vrai;
                    646:                            break;
                    647:                        }
                    648: 
                    649:                        case 'A' :
                    650:                        {
                    651:                            if (option_A == d_vrai)
                    652:                            {
                    653:                                if ((*s_etat_processus).langue == 'F')
                    654:                                {
                    655:                                    printf("+++Erreur : option -A présente "
                    656:                                            "plus d'une fois\n");
                    657:                                }
                    658:                                else
                    659:                                {
                    660:                                    printf("+++Error : more than one -A "
                    661:                                            "on command line");
                    662:                                }
                    663: 
                    664:                                return(EXIT_FAILURE);
                    665:                            }
                    666: 
                    667:                            option_A = d_vrai;
                    668: 
                    669:                            while(*(++argv[0]) == ' ');
                    670:                            argv[0]--;
                    671: 
                    672:                            if ((*(++argv[0])) != '\0')
                    673:                            {
                    674:                                if ((arguments = malloc((strlen(argv[0]) + 7) *
                    675:                                        sizeof(unsigned char))) == NULL)
                    676:                                {
                    677:                                    if ((*s_etat_processus).langue == 'F')
                    678:                                    {
                    679:                                        printf("+++Système : Mémoire "
                    680:                                                "insuffisante\n");
                    681:                                    }
                    682:                                    else
                    683:                                    {
                    684:                                        printf("+++System : Not enough "
                    685:                                                "memory\n");
                    686:                                    }
                    687: 
                    688:                                    return(EXIT_FAILURE);
                    689:                                }
                    690: 
                    691:                                ptr = arguments;
                    692:                                (*ptr) = d_code_fin_chaine;
                    693:                                strcat(ptr, "<< ");
                    694:                                ptr += 3;
                    695: 
                    696:                                while(*(argv[0]) != '\0')
                    697:                                {
                    698:                                    *(ptr++) = *(argv[0]++);
                    699:                                }
                    700: 
                    701:                                (*ptr) = '\0';
                    702: 
                    703:                                strcat(arguments, " >>");
                    704:                                argv[0]--;
                    705:                            }
                    706:                            else if ((--argc) > 0)
                    707:                            {
                    708:                                argv++;
                    709: 
                    710:                                if ((arguments = malloc((strlen(argv[0]) + 7) *
                    711:                                        sizeof(unsigned char))) == NULL)
                    712:                                {
                    713:                                    if ((*s_etat_processus).langue == 'F')
                    714:                                    {
                    715:                                        printf("+++Système : Mémoire "
                    716:                                                "insuffisante\n");
                    717:                                    }
                    718:                                    else
                    719:                                    {
                    720:                                        printf("+++System : Not enough "
                    721:                                                "memory\n");
                    722:                                    }
                    723: 
                    724:                                    return(EXIT_FAILURE);
                    725:                                }
                    726: 
                    727:                                ptr = arguments;
                    728:                                (*ptr) = d_code_fin_chaine;
                    729:                                strcat(ptr, "<< ");
                    730:                                ptr += 3;
                    731: 
                    732:                                while(*(argv[0]) != '\0')
                    733:                                {
                    734:                                    *(ptr++) = *(argv[0]++);
                    735:                                }
                    736: 
                    737:                                (*ptr) = '\0';
                    738: 
                    739:                                strcat(arguments, " >>");
                    740:                                argv[0]--;
                    741:                            }
                    742:                            else
                    743:                            {
                    744:                                if ((*s_etat_processus).langue == 'F')
                    745:                                {
                    746:                                    printf("+++Erreur : Aucune donnée "
                    747:                                            "spécifié après l'option -A\n");
                    748:                                }
                    749:                                else
                    750:                                {
                    751:                                    printf("+++Error : Data required after "
                    752:                                            "-A option\n");
                    753:                                }
                    754: 
                    755:                                return(EXIT_FAILURE);
                    756:                            }
                    757: 
                    758:                            break;
                    759:                        }
                    760: 
                    761:                        case 'c' :
                    762:                        {
                    763:                            if (option_c == d_vrai)
                    764:                            {
                    765:                                if ((*s_etat_processus).langue == 'F')
                    766:                                {
                    767:                                    printf("+++Erreur : option -c présente "
                    768:                                            "plus d'une fois\n");
                    769:                                }
                    770:                                else
                    771:                                {
                    772:                                    printf("+++Error : more than one -c "
                    773:                                            "on command line");
                    774:                                }
                    775: 
                    776:                                return(EXIT_FAILURE);
                    777:                            }
                    778: 
                    779:                            option_c = d_vrai;
                    780:                            core = d_vrai;
                    781:                            break;
                    782:                        }
                    783: 
                    784:                        case 'd' :
                    785:                        {
                    786:                            if (option_d == d_vrai)
                    787:                            {
                    788:                                if ((*s_etat_processus).langue == 'F')
                    789:                                {
                    790:                                    printf("+++Erreur : option -d présente "
                    791:                                            "plus d'une fois\n");
                    792:                                }
                    793:                                else
                    794:                                {
                    795:                                    printf("+++Error : more than one -d "
                    796:                                            "on command line");
                    797:                                }
                    798: 
                    799:                                return(EXIT_FAILURE);
                    800:                            }
                    801: 
                    802:                            option_d = d_vrai;
                    803:                            debug = d_vrai;
                    804:                            break;
                    805:                        }
                    806: 
                    807:                        case 'D' :
                    808:                        {
                    809:                            if (option_D == d_vrai)
                    810:                            {
                    811:                                if ((*s_etat_processus).langue == 'F')
                    812:                                {
                    813:                                    printf("+++Erreur : option -D présente "
                    814:                                            "plus d'une fois\n");
                    815:                                }
                    816:                                else
                    817:                                {
                    818:                                    printf("+++Error : more than one -D "
                    819:                                            "on command line");
                    820:                                }
                    821: 
                    822:                                return(EXIT_FAILURE);
                    823:                            }
                    824: 
                    825:                            option_D = d_vrai;
                    826:                            break;
                    827:                        }
                    828: 
                    829:                        case 'h' :
                    830:                        {
                    831:                            if (option_h == d_vrai)
                    832:                            {
                    833:                                if ((*s_etat_processus).langue == 'F')
                    834:                                {
                    835:                                    printf("+++Erreur : option -h présente "
                    836:                                            "plus d'une fois\n");
                    837:                                }
                    838:                                else
                    839:                                {
                    840:                                    printf("+++Error : more than one -h "
                    841:                                            "on command line");
                    842:                                }
                    843: 
                    844:                                return(EXIT_FAILURE);
                    845:                            }
                    846: 
                    847:                            option_h = d_vrai;
                    848:                            informations(s_etat_processus);
                    849:                            break;
                    850:                        }
                    851: 
                    852:                        case 'i' :
                    853:                        {
                    854:                            if (option_i == d_vrai) 
                    855:                            {
                    856:                                if ((*s_etat_processus).langue == 'F')
                    857:                                {
                    858:                                    printf("+++Erreur : option -i présente "
                    859:                                            "plus d'une fois\n");
                    860:                                }
                    861:                                else
                    862:                                {
                    863:                                    printf("+++Error : more than one -i "
                    864:                                            "on command line");
                    865:                                }
                    866: 
                    867:                                return(EXIT_FAILURE);
                    868:                            }
                    869:                            else if (option_S == d_vrai)
                    870:                            {
                    871:                                if ((*s_etat_processus).langue == 'F')
                    872:                                {
                    873:                                    printf("+++Erreur : options -i et -S "
                    874:                                            "incompatibles\n");
                    875:                                }
                    876:                                else
                    877:                                {
                    878:                                    printf("+++Error : incompatible options -i "
                    879:                                            "and -S\n");
                    880:                                }
                    881: 
                    882:                                return(EXIT_FAILURE);
                    883:                            }
                    884:                            else if (option_p == d_vrai)
                    885:                            {
                    886:                                if ((*s_etat_processus).langue == 'F')
                    887:                                {
                    888:                                    printf("+++Erreur : options -i et -p "
                    889:                                            "incompatibles\n");
                    890:                                }
                    891:                                else
                    892:                                {
                    893:                                    printf("+++Error : incompatible options -i "
                    894:                                            "and -p\n");
                    895:                                }
                    896: 
                    897:                                return(EXIT_FAILURE);
                    898:                            }
                    899: 
                    900:                            option_i = d_vrai;
                    901:                            mode_interactif = d_vrai;
                    902:                            presence_definition = 'O';
                    903:                            break;
                    904:                        }
                    905: 
                    906:                        case 'l' :
                    907:                        {
                    908:                            if (option_l == d_vrai)
                    909:                            {
                    910:                                if ((*s_etat_processus).langue == 'F')
                    911:                                {
                    912:                                    printf("+++Erreur : option -l présente "
                    913:                                            "plus d'une fois\n");
                    914:                                }
                    915:                                else
                    916:                                {
                    917:                                    printf("+++Error : more than one -l "
                    918:                                            "on command line");
                    919:                                }
                    920: 
                    921:                                return(EXIT_FAILURE);
                    922:                            }
                    923: 
                    924:                            option_l = d_vrai;
                    925: 
                    926:                            if ((*s_etat_processus).langue == 'F')
                    927:                            {
                    928:                                printf("%s\n\n", CeCILL_fr);
                    929:                            }
                    930:                            else
                    931:                            {
                    932:                                printf("%s\n\n", CeCILL_en);
                    933:                            }
                    934: 
                    935:                            break;
                    936:                        }
                    937: 
                    938:                        case 'n' :
                    939:                        {
                    940:                            if (option_n == d_vrai)
                    941:                            {
                    942:                                if ((*s_etat_processus).langue == 'F')
                    943:                                {
                    944:                                    printf("+++Erreur : option -n présente "
                    945:                                            "plus d'une fois\n");
                    946:                                }
                    947:                                else
                    948:                                {
                    949:                                    printf("+++Error : more than one -n "
                    950:                                            "on command line");
                    951:                                }
                    952: 
                    953:                                return(EXIT_FAILURE);
                    954:                            }
                    955: 
                    956:                            option_n = d_vrai;
                    957: 
                    958:                            break;
                    959:                        }
                    960: 
                    961:                        case 'p' :
                    962:                        {
                    963:                            if (option_p == d_vrai)
                    964:                            {
                    965:                                if ((*s_etat_processus).langue == 'F')
                    966:                                {
                    967:                                    printf("+++Erreur : option -p présente "
                    968:                                            "plus d'une fois\n");
                    969:                                }
                    970:                                else
                    971:                                {
                    972:                                    printf("+++Error : more than one -p "
                    973:                                            "on command line");
                    974:                                }
                    975: 
                    976:                                return(EXIT_FAILURE);
                    977:                            }
                    978:                            else if (option_i == d_vrai)
                    979:                            {
                    980:                                if ((*s_etat_processus).langue == 'F')
                    981:                                {
                    982:                                    printf("+++Erreur : options -i et -p "
                    983:                                            "incompatibles\n");
                    984:                                }
                    985:                                else
                    986:                                {
                    987:                                    printf("+++Error : incompatible options -i "
                    988:                                            "and -p\n");
                    989:                                }
                    990: 
                    991:                                return(EXIT_FAILURE);
                    992:                            }
                    993: 
                    994:                            option_p = d_vrai;
                    995: 
                    996:                            break;
                    997:                        }
                    998: 
                    999:                        case 'P' :
                   1000:                        {
                   1001:                            if (option_P > 2)
                   1002:                            {
                   1003:                                if ((*s_etat_processus).langue == 'F')
                   1004:                                {
                   1005:                                    printf("+++Erreur : option -P présente "
                   1006:                                            "plus de deux fois\n");
                   1007:                                }
                   1008:                                else
                   1009:                                {
                   1010:                                    printf("+++Error : more than two -P "
                   1011:                                            "on command line");
                   1012:                                }
                   1013: 
                   1014:                                return(EXIT_FAILURE);
                   1015:                            }
                   1016: 
                   1017:                            option_P++;
                   1018: 
                   1019:                            break;
                   1020:                        }
                   1021: 
                   1022:                        case 's' :
                   1023:                        {
                   1024:                            if (option_s == d_vrai)
                   1025:                            {
                   1026:                                if ((*s_etat_processus).langue == 'F')
                   1027:                                {
                   1028:                                    printf("+++Erreur : option -s présente "
                   1029:                                            "plus d'une fois\n");
                   1030:                                }
                   1031:                                else
                   1032:                                {
                   1033:                                    printf("+++Error : more than one -s "
                   1034:                                            "on command line");
                   1035:                                }
                   1036: 
                   1037:                                return(EXIT_FAILURE);
                   1038:                            }
                   1039: 
                   1040:                            option_s = d_vrai;
                   1041:                            drapeau_encart = 'N';
                   1042:                            break;
                   1043:                        }
                   1044: 
                   1045:                        case 'S' :
                   1046:                        {
                   1047:                            if (option_S == d_vrai)
                   1048:                            {
                   1049:                                if ((*s_etat_processus).langue == 'F')
                   1050:                                {
                   1051:                                    printf("+++Erreur : option -S présente "
                   1052:                                            "plus d'une fois\n");
                   1053:                                }
                   1054:                                else
                   1055:                                {
                   1056:                                    printf("+++Error : more than one -S "
                   1057:                                            "on command line");
                   1058:                                }
                   1059: 
                   1060:                                return(EXIT_FAILURE);
                   1061:                            }
                   1062:                            else if (option_i == d_vrai)
                   1063:                            {
                   1064:                                if ((*s_etat_processus).langue == 'F')
                   1065:                                {
                   1066:                                    printf("+++Erreur : options -i et -S "
                   1067:                                            "incompatibles\n");
                   1068:                                }
                   1069:                                else
                   1070:                                {
                   1071:                                    printf("+++Error : incompatible options -S "
                   1072:                                            "and -i\n");
                   1073:                                }
                   1074: 
                   1075:                                return(EXIT_FAILURE);
                   1076:                            }
                   1077: 
                   1078:                            option_S = d_vrai;
                   1079: 
                   1080:                            while(*(++argv[0]) == ' ');
                   1081:                            argv[0]--;
                   1082: 
                   1083:                            if ((*(++argv[0])) != '\0')
                   1084:                            {
                   1085:                                if (((*s_etat_processus).definitions_chainees =
                   1086:                                        malloc((strlen(argv[0]) + 1) *
                   1087:                                        sizeof(unsigned char))) == NULL)
                   1088:                                {
                   1089:                                    if ((*s_etat_processus).langue == 'F')
                   1090:                                    {
                   1091:                                        printf("+++Système : Mémoire "
                   1092:                                                "insuffisante\n");
                   1093:                                    }
                   1094:                                    else
                   1095:                                    {
                   1096:                                        printf("+++System : Not enough "
                   1097:                                                "memory\n");
                   1098:                                    }
                   1099: 
                   1100:                                    return(EXIT_FAILURE);
                   1101:                                }
                   1102: 
                   1103:                                ptr = (*s_etat_processus).definitions_chainees;
                   1104: 
                   1105:                                while(*(argv[0]) != '\0')
                   1106:                                {
                   1107:                                    *(ptr++) = *(argv[0]++);
                   1108:                                }
                   1109: 
                   1110:                                (*ptr) = '\0';
                   1111: 
                   1112:                                argv[0]--;
                   1113:                                presence_definition = 'O';
                   1114:                            }
                   1115:                            else if ((--argc) > 0)
                   1116:                            {
                   1117:                                argv++;
                   1118: 
                   1119:                                if (((*s_etat_processus).definitions_chainees =
                   1120:                                        malloc((strlen(argv[0]) + 1) *
                   1121:                                        sizeof(unsigned char))) == NULL)
                   1122:                                {
                   1123:                                    if ((*s_etat_processus).langue == 'F')
                   1124:                                    {
                   1125:                                        printf("+++Système : Mémoire "
                   1126:                                                "insuffisante\n");
                   1127:                                    }
                   1128:                                    else
                   1129:                                    {
                   1130:                                        printf("+++System : Not enough "
                   1131:                                                "memory\n");
                   1132:                                    }
                   1133: 
                   1134:                                    return(EXIT_FAILURE);
                   1135:                                }
                   1136: 
                   1137:                                ptr = (*s_etat_processus).definitions_chainees;
                   1138: 
                   1139:                                while(*(argv[0]) != '\0')
                   1140:                                {
                   1141:                                    *(ptr++) = *(argv[0]++);
                   1142:                                }
                   1143: 
                   1144:                                (*ptr) = '\0';
                   1145: 
                   1146:                                argv[0]--;
                   1147:                                presence_definition = 'O';
                   1148:                            }
                   1149:                            else
                   1150:                            {
                   1151:                                if ((*s_etat_processus).langue == 'F')
                   1152:                                {
                   1153:                                    printf("+++Erreur : Aucun script "
                   1154:                                            "spécifié après l'option -S\n");
                   1155:                                }
                   1156:                                else
                   1157:                                {
                   1158:                                    printf("+++Error : Script required after "
                   1159:                                            "-S option\n");
                   1160:                                }
                   1161: 
                   1162:                                return(EXIT_FAILURE);
                   1163:                            }
                   1164: 
                   1165:                            if (((*s_etat_processus).definitions_chainees =
                   1166:                                    compactage((*s_etat_processus)
                   1167:                                    .definitions_chainees)) == NULL)
                   1168:                            {
                   1169:                                if ((*s_etat_processus).langue == 'F')
                   1170:                                {
                   1171:                                    printf("+++Système : Mémoire "
                   1172:                                            "insuffisante\n");
                   1173:                                }
                   1174:                                else
                   1175:                                {
                   1176:                                    printf("+++System : Not enough "
                   1177:                                            "memory\n");
                   1178:                                }
                   1179: 
                   1180:                                return(EXIT_FAILURE);
                   1181:                            }
                   1182: 
                   1183:                            (*s_etat_processus).longueur_definitions_chainees =
                   1184:                                    strlen((*s_etat_processus)
                   1185:                                    .definitions_chainees);
                   1186: 
                   1187:                            break;
                   1188:                        }
                   1189: 
                   1190:                        case 't' :
                   1191:                        {
                   1192:                            if (option_t == d_vrai)
                   1193:                            {
                   1194:                                if ((*s_etat_processus).langue == 'F')
                   1195:                                {
                   1196:                                    printf("+++Erreur : option -t présente "
                   1197:                                            "plus d'une fois\n");
                   1198:                                }
                   1199:                                else
                   1200:                                {
                   1201:                                    printf("+++Error : more than one -t "
                   1202:                                            "on command line");
                   1203:                                }
                   1204: 
                   1205:                                return(EXIT_FAILURE);
                   1206:                            }
                   1207: 
                   1208:                            option_t = d_vrai;
                   1209:                            (*s_etat_processus).debug = d_vrai;
                   1210: 
                   1211:                            while(*(++argv[0]) == ' ');
                   1212:                            argv[0]--;
                   1213: 
                   1214:                            if ((*(++argv[0])) != '\0')
                   1215:                            {
                   1216:                                if ((type_debug = malloc((strlen(argv[0]) + 1) *
                   1217:                                        sizeof(unsigned char))) == NULL)
                   1218:                                {
                   1219:                                    if ((*s_etat_processus).langue == 'F')
                   1220:                                    {
                   1221:                                        printf("+++Système : Mémoire "
                   1222:                                                "insuffisante\n");
                   1223:                                    }
                   1224:                                    else
                   1225:                                    {
                   1226:                                        printf("+++System : Not enough "
                   1227:                                                "memory\n");
                   1228:                                    }
                   1229: 
                   1230:                                    return(EXIT_FAILURE);
                   1231:                                }
                   1232: 
                   1233:                                ptr = type_debug;
                   1234: 
                   1235:                                while((*(argv[0]) != '\0') &&
                   1236:                                        (*(argv[0]) != ' '))
                   1237:                                {
                   1238:                                    *(ptr++) = *(argv[0]++);
                   1239:                                }
                   1240: 
                   1241:                                (*ptr) = '\0';
                   1242: 
                   1243:                                argv[0]--;
                   1244:                            }
                   1245:                            else if ((--argc) > 0)
                   1246:                            {
                   1247:                                argv++;
                   1248: 
                   1249:                                if ((type_debug =
                   1250:                                        malloc((strlen(argv[0]) + 1) *
                   1251:                                        sizeof(unsigned char))) == NULL)
                   1252:                                {
                   1253:                                    if ((*s_etat_processus).langue == 'F')
                   1254:                                    {
                   1255:                                        printf("+++Système : Mémoire "
                   1256:                                                "insuffisante\n");
                   1257:                                    }
                   1258:                                    else
                   1259:                                    {
                   1260:                                        printf("+++System : Not enough "
                   1261:                                                "memory\n");
                   1262:                                    }
                   1263: 
                   1264:                                    return(EXIT_FAILURE);
                   1265:                                }
                   1266: 
                   1267:                                ptr = type_debug;
                   1268: 
                   1269:                                while(*(argv[0]) != '\0')
                   1270:                                {
                   1271:                                    *(ptr++) = *(argv[0]++);
                   1272:                                }
                   1273: 
                   1274:                                (*ptr) = '\0';
                   1275: 
                   1276:                                argv[0]--;
                   1277:                            }
                   1278:                            else
                   1279:                            {
                   1280:                                if ((*s_etat_processus).langue == 'F')
                   1281:                                {
                   1282:                                    printf("+++Erreur : Aucun niveau "
                   1283:                                            "de débogage spécifié après "
                   1284:                                            "l'option -t\n");
                   1285:                                }
                   1286:                                else
                   1287:                                {
                   1288:                                    printf("+++Error : Debug level not "
                   1289:                                            "specified after -t option\n");
                   1290:                                }
                   1291: 
                   1292:                                return(EXIT_FAILURE);
                   1293:                            }
                   1294: 
                   1295:                            ptr = type_debug;
                   1296: 
                   1297:                            while(*ptr != '\0')
                   1298:                            {
                   1299:                                switch(*ptr)
                   1300:                                {
                   1301:                                    case '0':
                   1302:                                    case '1':
                   1303:                                    case '2':
                   1304:                                    case '3':
                   1305:                                    case '4':
                   1306:                                    case '5':
                   1307:                                    case '6':
                   1308:                                    case '7':
                   1309:                                    case '8':
                   1310:                                    case '9':
                   1311:                                    case 'A':
                   1312:                                    case 'B':
                   1313:                                    case 'C':
                   1314:                                    case 'D':
                   1315:                                    case 'E':
                   1316:                                    case 'F':
                   1317:                                    {
                   1318:                                        break;
                   1319:                                    }
                   1320: 
                   1321:                                    default:
                   1322:                                    {
                   1323:                                        if ((*s_etat_processus).langue == 'F')
                   1324:                                        {
                   1325:                                            printf("+++Erreur : Niveau "
                   1326:                                                    "de débogage non "
                   1327:                                                    "hexadécimal\n");
                   1328:                                        }
                   1329:                                        else
                   1330:                                        {
                   1331:                                            printf("+++Error : Debug level must"
                   1332:                                                    " be hexadecimal "
                   1333:                                                    "integer\n");
                   1334:                                        }
                   1335: 
                   1336:                                        return(EXIT_FAILURE);
                   1337:                                    }
                   1338:                                }
                   1339: 
                   1340:                                ptr++;
                   1341:                            }
                   1342: 
                   1343:                            if (sscanf(type_debug, "%llX",
                   1344:                                    &((*s_etat_processus).type_debug)) != 1)
                   1345:                            {
                   1346:                                if ((*s_etat_processus).langue == 'F')
                   1347:                                {
                   1348:                                    printf("+++Erreur : Niveau "
                   1349:                                            "de débogage non entier\n");
                   1350:                                }
                   1351:                                else
                   1352:                                {
                   1353:                                    printf("+++Error : Debug level must"
                   1354:                                            " be integer\n");
                   1355:                                }
                   1356: 
                   1357:                                return(EXIT_FAILURE);
                   1358:                            }
                   1359: 
1.17      bertrand 1360:                            free(type_debug);
1.1       bertrand 1361:                            break;
                   1362:                        }
                   1363: 
                   1364:                        case 'v' :
                   1365:                        {
                   1366:                            if (option_v == d_vrai)
                   1367:                            {
                   1368:                                if ((*s_etat_processus).langue == 'F')
                   1369:                                {
                   1370:                                    printf("+++Erreur : option -v présente "
                   1371:                                            "plus d'une fois\n");
                   1372:                                }
                   1373:                                else
                   1374:                                {
                   1375:                                    printf("+++Error : more than one -v "
                   1376:                                            "on command line");
                   1377:                                }
                   1378: 
                   1379:                                return(EXIT_FAILURE);
                   1380:                            }
                   1381: 
                   1382:                            option_v = d_vrai;
                   1383:                            printf("\n");
                   1384: 
                   1385:                            if ((*s_etat_processus).langue == 'F')
                   1386:                            {
                   1387:                                printf("  Reverse Polish Lisp/2 version %s "
                   1388:                                        "pour systèmes "
                   1389:                                        "POSIX\n", d_version_rpl);
                   1390:                                printf("      Langage procédural de très haut "
                   1391:                                        "niveau, semi-compilé, "
                   1392:                                        "extensible,\n");
                   1393:                                printf("      destiné principalement aux "
                   1394:                                        "calculs scientifiques et "
                   1395:                                        "symboliques\n");
                   1396:                                printf("%s\n", copyright);
                   1397:                            }
                   1398:                            else
                   1399:                            {
                   1400:                                printf("  Reverse Polish Lisp/2 version %s "
                   1401:                                        "for POSIX operating systems\n",
                   1402:                                        d_version_rpl);
                   1403:                                printf("      Half-compiled, high-level "
                   1404:                                        "procedural language,\n");
                   1405:                                printf("      mainly aiming at scientific "
                   1406:                                        "calculations\n");
                   1407:                                printf("%s\n", copyright_anglais);
                   1408:                            }
                   1409: 
                   1410:                            printf("\n");
                   1411:                            break;
                   1412:                        }
                   1413: 
                   1414:                        default :
                   1415:                        {
                   1416:                            if ((*s_etat_processus).langue == 'F')
                   1417:                            {
1.3       bertrand 1418:                                printf("+++Information : Option -%c inconnue\n",
1.1       bertrand 1419:                                        option);
                   1420:                            }
                   1421:                            else
                   1422:                            {
1.3       bertrand 1423:                                printf("+++Warning : -%c option unknown\n",
1.1       bertrand 1424:                                        option);
                   1425:                            }
                   1426: 
                   1427:                            informations(s_etat_processus);
                   1428:                            break;
                   1429:                        }
                   1430:                    }
                   1431:                }
                   1432:            }
                   1433:            else
                   1434:            {
                   1435:                if (presence_definition == 'O')
                   1436:                {
                   1437:                    argc = 0;
                   1438: 
                   1439:                    if ((*s_etat_processus).langue == 'F')
                   1440:                    {
                   1441:                        printf("+++Erreur : Plusieurs définitions\n");
                   1442:                    }
                   1443:                    else
                   1444:                    {
                   1445:                        printf("+++Error : More than one definition\n");
                   1446:                    }
                   1447: 
1.13      bertrand 1448:                    erreur = d_erreur;
1.1       bertrand 1449:                }
                   1450:                else
                   1451:                {
                   1452:                    (*s_etat_processus).nom_fichier_source = argv[0];
                   1453:                    presence_definition = 'O';
                   1454:                }
                   1455:            }
                   1456:        }
                   1457: 
                   1458:        if (debug == d_faux)
                   1459:        {
                   1460:            if (sigaction(SIGSEGV, &action, NULL) != 0)
                   1461:            {
                   1462:                if ((*s_etat_processus).langue == 'F')
                   1463:                {
                   1464:                    printf("+++Système : Initialisation des signaux POSIX "
                   1465:                            "impossible\n");
                   1466:                }
                   1467:                else
                   1468:                {
                   1469:                    printf("+++System : Initialization of POSIX signals "
                   1470:                            "failed\n");
                   1471:                }
                   1472: 
                   1473:                return(EXIT_FAILURE);
                   1474:            }
                   1475: 
                   1476:            if (sigaction(SIGBUS, &action, NULL) != 0)
                   1477:            {
                   1478:                if ((*s_etat_processus).langue == 'F')
                   1479:                {
                   1480:                    printf("+++Système : Initialisation des signaux POSIX "
                   1481:                            "impossible\n");
                   1482:                }
                   1483:                else
                   1484:                {
                   1485:                    printf("+++System : Initialization of POSIX signals "
                   1486:                            "failed\n");
                   1487:                }
                   1488: 
                   1489:                return(EXIT_FAILURE);
                   1490:            }
                   1491:        }
                   1492: 
                   1493:        if (option_n == d_vrai)
                   1494:        {
                   1495:            action.sa_sigaction = interruption10;
                   1496:            action.sa_flags = SA_ONSTACK | SA_SIGINFO;
                   1497: 
                   1498:            if (sigaction(SIGHUP, &action, NULL) != 0)
                   1499:            {
                   1500:                if ((*s_etat_processus).langue == 'F')
                   1501:                {
                   1502:                    printf("+++Système : Initialisation des signaux POSIX "
                   1503:                            "impossible\n");
                   1504:                }
                   1505:                else
                   1506:                {
                   1507:                    printf("+++System : Initialization of POSIX signals "
                   1508:                            "failed\n");
                   1509:                }
                   1510: 
                   1511:                return(EXIT_FAILURE);
                   1512:            }
                   1513:        }
                   1514: 
                   1515:        if (mode_interactif == d_vrai)
                   1516:        {
                   1517:            printf("\n");
                   1518: 
                   1519:            if ((*s_etat_processus).langue == 'F')
                   1520:            {
                   1521:                printf("+++Ce logiciel est un logiciel libre"
                   1522:                        " sans aucune garantie de "
                   1523:                        "fonctionnement.\n");
                   1524:                printf("+++Pour plus de détails, utilisez la "
                   1525:                        "commande 'warranty'.\n");
                   1526:            }
                   1527:            else
                   1528:            {
                   1529:                printf("+++This is a free software with "
                   1530:                        "absolutely no warranty.\n");
                   1531:                printf("+++For details, type 'warranty'.\n");
                   1532:            }
                   1533: 
                   1534:            printf("\n");
                   1535: 
                   1536:            traitement_fichier_temporaire = 'Y';
                   1537: 
                   1538:            if ((nom_fichier_temporaire =
                   1539:                    creation_nom_fichier(s_etat_processus, (*s_etat_processus)
                   1540:                    .chemin_fichiers_temporaires)) == NULL)
                   1541:            {
                   1542:                if ((*s_etat_processus).langue == 'F')
                   1543:                {
                   1544:                    printf("+++Système : Fichier indisponible\n");
                   1545:                }
                   1546:                else
                   1547:                {
                   1548:                    printf("+++System : File unavailable\n");
                   1549:                }
                   1550: 
                   1551:                return(EXIT_FAILURE);
                   1552:            }
                   1553: 
                   1554:            if ((f_source = fopen(nom_fichier_temporaire, "w"))
                   1555:                    == NULL)
                   1556:            {
                   1557:                if ((*s_etat_processus).langue == 'F')
                   1558:                {
                   1559:                    printf("+++Système : Fichier introuvable\n");
                   1560:                }
                   1561:                else
                   1562:                {
                   1563:                    printf("+++System : File not found\n");
                   1564:                }
                   1565: 
                   1566:                return(EXIT_FAILURE);
                   1567:            }
                   1568: 
                   1569:            if (fprintf(f_source, "MODE_INTERACTIF\n") < 0)
                   1570:            {
                   1571:                if ((*s_etat_processus).langue == 'F')
                   1572:                {
                   1573:                    printf("+++Système : Erreur d'écriture dans un fichier\n");
                   1574:                }
                   1575:                else
                   1576:                {
                   1577:                    printf("+++System : Cannot write in file\n");
                   1578:                }
                   1579: 
                   1580:                return(EXIT_FAILURE);
                   1581:            }
                   1582: 
                   1583:            if (fprintf(f_source,
                   1584:                    "<< DO HALT UNTIL FALSE END >>\n") < 0)
                   1585:            {
                   1586:                if ((*s_etat_processus).langue == 'F')
                   1587:                {
                   1588:                    printf("+++Système : Erreur d'écriture dans un fichier\n");
                   1589:                }
                   1590:                else
                   1591:                {
                   1592:                    printf("+++System : Cannot write in file\n");
                   1593:                }
                   1594: 
                   1595:                return(EXIT_FAILURE);
                   1596:            }
                   1597: 
                   1598:            if (fclose(f_source) != 0)
                   1599:            {
                   1600:                if ((*s_etat_processus).langue == 'F')
                   1601:                {
                   1602:                    printf("+++Système : Fichier indisponible\n");
                   1603:                }
                   1604:                else
                   1605:                {
                   1606:                    printf("+++System : File unavailable\n");
                   1607:                }
                   1608: 
                   1609:                return(EXIT_FAILURE);
                   1610:            }
                   1611: 
                   1612:            (*s_etat_processus).lancement_interactif = d_vrai;
                   1613:            (*s_etat_processus).nom_fichier_source =
                   1614:                    nom_fichier_temporaire;
                   1615: 
                   1616:            presence_definition = 'O';
                   1617:        }
                   1618:        else
                   1619:        {
                   1620:            nom_fichier_temporaire = NULL;
                   1621:        }
                   1622: 
                   1623:        if ((*s_etat_processus).nom_fichier_source == NULL)
                   1624:        {
                   1625:            erreur_fichier = d_erreur;
                   1626:        }
                   1627:        else
                   1628:        {
                   1629:            erreur_fichier = caracteristiques_fichier(s_etat_processus,
                   1630:                    (*s_etat_processus).nom_fichier_source,
                   1631:                    &existence, &ouverture, &unite_fichier);
                   1632:        }
                   1633: 
                   1634:        if (((existence == d_faux) || (erreur_fichier != d_absence_erreur)) &&
                   1635:                (option_S == d_faux))
                   1636:        {
                   1637:            if (presence_definition == 'O')
                   1638:            {
                   1639:                if ((*s_etat_processus).langue == 'F')
                   1640:                {
                   1641:                    printf("+++Erreur : Fichier %s inexistant\n",
                   1642:                            (*s_etat_processus).nom_fichier_source);
                   1643:                }
                   1644:                else
                   1645:                {
                   1646:                    printf("+++Error : File %s not found\n",
                   1647:                            (*s_etat_processus).nom_fichier_source);
                   1648:                }
                   1649: 
1.13      bertrand 1650:                erreur = d_erreur;
1.1       bertrand 1651:            }
                   1652:            else
                   1653:            {
                   1654:                if ((*s_etat_processus).langue == 'F')
                   1655:                {
                   1656:                    printf("+++Erreur : Absence de définition à exécuter\n");
                   1657:                }
                   1658:                else
                   1659:                {
                   1660:                    printf("+++Error : Any executable definition\n");
                   1661:                }
                   1662:            }
1.3       bertrand 1663: 
                   1664:            return(EXIT_FAILURE);
1.1       bertrand 1665:        }
                   1666: 
                   1667:        if ((*s_etat_processus).chemin_fichiers_temporaires == NULL)
                   1668:        {
                   1669:            if ((*s_etat_processus).langue == 'F')
                   1670:            {
                   1671:                printf("+++Système : Chemin des fichiers temporaires nul\n");
                   1672:            }
                   1673:            else
                   1674:            {
                   1675:                printf("+++System : Null temporary files path\n");
                   1676:            }
                   1677: 
                   1678:            return(EXIT_FAILURE);
                   1679:        }
                   1680: 
                   1681:        if ((*s_etat_processus).debug == d_vrai)
                   1682:        {
                   1683:            if ((*s_etat_processus).langue == 'F')
                   1684:            {
                   1685:                printf("[%d] Chemin des fichiers temporaires %s\n\n",
                   1686:                        (int) getpid(),
                   1687:                        (*s_etat_processus).chemin_fichiers_temporaires);
                   1688:            }
                   1689:            else
                   1690:            {
                   1691:                printf("[%d] Temporary files path %s\n\n",
                   1692:                        (int) getpid(),
                   1693:                        (*s_etat_processus).chemin_fichiers_temporaires);
                   1694:            }
                   1695:        }
                   1696: 
1.13      bertrand 1697:        if ((erreur == d_absence_erreur) && (presence_definition == 'O'))
1.1       bertrand 1698:        {
                   1699:            (*s_etat_processus).profilage = (option_P != 0) ? d_vrai : d_faux;
                   1700:            (*s_etat_processus).niveau_profilage = option_P;
                   1701:            (*s_etat_processus).pile_profilage = NULL;
                   1702:            (*s_etat_processus).pile_profilage_fonctions = NULL;
                   1703:            gettimeofday(&((*s_etat_processus).horodatage_profilage), NULL);
                   1704: 
                   1705:            (*s_etat_processus).liste_mutexes = NULL;
                   1706: 
                   1707:            (*s_etat_processus).test_instruction = 'N';
                   1708:            (*s_etat_processus).nombre_arguments = 0;
                   1709:            (*s_etat_processus).affichage_arguments = 'N';
1.6       bertrand 1710:            (*s_etat_processus).autorisation_conversion_chaine = 'Y';
1.1       bertrand 1711:            (*s_etat_processus).autorisation_evaluation_nom = 'Y';
1.15      bertrand 1712:            (*s_etat_processus).autorisation_nom_implicite = 'Y';
1.1       bertrand 1713:            (*s_etat_processus).autorisation_empilement_programme = 'N';
                   1714:            (*s_etat_processus).requete_arret = 'N';
1.4       bertrand 1715:            (*s_etat_processus).evaluation_forcee = 'N';
1.1       bertrand 1716: 
                   1717:            (*s_etat_processus).constante_symbolique = 'N';
                   1718:            (*s_etat_processus).traitement_symbolique = 'N';
                   1719: 
                   1720:            (*s_etat_processus).expression_courante = NULL;
                   1721:            (*s_etat_processus).objet_courant = NULL;
                   1722:            (*s_etat_processus).evaluation_expression_compilee = 'N';
                   1723: 
                   1724:            (*s_etat_processus).l_base_pile = NULL;
                   1725:            (*s_etat_processus).l_base_pile_last = NULL;
                   1726: 
                   1727:            (*s_etat_processus).s_liste_variables = NULL;
                   1728:            (*s_etat_processus).gel_liste_variables = d_faux;
                   1729:            (*s_etat_processus).nombre_variables = 0;
                   1730:            (*s_etat_processus).nombre_variables_allouees = 0;
                   1731:            (*s_etat_processus).s_liste_variables_statiques = NULL;
                   1732:            (*s_etat_processus).nombre_variables_statiques = 0;
                   1733:            (*s_etat_processus).nombre_variables_statiques_allouees = 0;
                   1734:            (*s_etat_processus).niveau_courant = 0;
                   1735:            (*s_etat_processus).niveau_initial = 0;
                   1736:            (*s_etat_processus).creation_variables_statiques = d_faux;
                   1737:            (*s_etat_processus).creation_variables_partagees = d_faux;
                   1738:            (*s_etat_processus).position_variable_courante = 0;
                   1739:            (*s_etat_processus).position_variable_statique_courante = 0;
                   1740: 
                   1741:            (*s_etat_processus).s_bibliotheques = NULL;
                   1742:            (*s_etat_processus).s_instructions_externes = NULL;
                   1743:            (*s_etat_processus).nombre_instructions_externes = 0;
                   1744: 
                   1745:            (*s_etat_processus).systeme_axes = 0;
                   1746: 
                   1747:            (*s_etat_processus).x_min = -10.;
                   1748:            (*s_etat_processus).x_max = 10.;
                   1749:            (*s_etat_processus).y_min = -10.;
                   1750:            (*s_etat_processus).y_max = 10.;
                   1751:            (*s_etat_processus).z_min = -10.;
                   1752:            (*s_etat_processus).z_max = 10.;
                   1753: 
                   1754:            (*s_etat_processus).x2_min = -10.;
                   1755:            (*s_etat_processus).x2_max = 10.;
                   1756:            (*s_etat_processus).y2_min = -10.;
                   1757:            (*s_etat_processus).y2_max = 10.;
                   1758:            (*s_etat_processus).z2_min = -10.;
                   1759:            (*s_etat_processus).z2_max = 10.;
                   1760: 
                   1761:            (*s_etat_processus).resolution = .01;
                   1762: 
                   1763:            (*s_etat_processus).souris_active = d_faux;
                   1764: 
                   1765:            (*s_etat_processus).echelle_automatique_x = d_faux;
                   1766:            (*s_etat_processus).echelle_automatique_y = d_faux;
                   1767:            (*s_etat_processus).echelle_automatique_z = d_faux;
                   1768: 
                   1769:            (*s_etat_processus).echelle_automatique_x2 = d_faux;
                   1770:            (*s_etat_processus).echelle_automatique_y2 = d_faux;
                   1771:            (*s_etat_processus).echelle_automatique_z2 = d_faux;
                   1772: 
                   1773:            (*s_etat_processus).echelle_log_x = d_faux;
                   1774:            (*s_etat_processus).echelle_log_y = d_faux;
                   1775:            (*s_etat_processus).echelle_log_z = d_faux;
                   1776: 
                   1777:            (*s_etat_processus).echelle_log_x2 = d_faux;
                   1778:            (*s_etat_processus).echelle_log_y2 = d_faux;
                   1779:            (*s_etat_processus).echelle_log_z2 = d_faux;
                   1780: 
                   1781:            (*s_etat_processus).point_de_vue_theta = 4 * atan((real8) 1) / 6;
                   1782:            (*s_etat_processus).point_de_vue_phi = 4 * atan((real8) 1) / 3;
                   1783:            (*s_etat_processus).echelle_3D = 1;
                   1784: 
                   1785:            strcpy((*s_etat_processus).type_trace_eq, "FONCTION");
                   1786:            strcpy((*s_etat_processus).type_trace_sigma, "POINTS");
                   1787:            (*s_etat_processus).fichiers_graphiques = NULL;
                   1788:            (*s_etat_processus).nom_fichier_impression = NULL;
                   1789:            strcpy((*s_etat_processus).format_papier, "a4paper");
                   1790:            (*s_etat_processus).entree_standard = NULL;
                   1791:            (*s_etat_processus).s_marques = NULL;
                   1792:            (*s_etat_processus).requete_nouveau_plan = d_vrai;
                   1793:            (*s_etat_processus).mise_a_jour_trace_requise = d_faux;
                   1794: 
                   1795:            (*s_etat_processus).l_base_pile = NULL;
                   1796:            (*s_etat_processus).hauteur_pile_operationnelle = 0;
                   1797:            (*s_etat_processus).l_base_pile_contextes = NULL;
                   1798:            (*s_etat_processus).l_base_pile_taille_contextes = NULL;
                   1799: 
                   1800:            (*s_etat_processus).position_courante = 0;
                   1801: 
                   1802:            (*s_etat_processus).l_base_pile_systeme = NULL;
                   1803:            (*s_etat_processus).hauteur_pile_systeme = 0;
                   1804: 
                   1805:            (*s_etat_processus).l_base_pile_processus = NULL;
                   1806:            (*s_etat_processus).presence_pipes = d_faux;
                   1807:            (*s_etat_processus).pipe_donnees = 0;
                   1808:            (*s_etat_processus).pipe_acquittement = 0;
                   1809:            (*s_etat_processus).pipe_injections = 0;
                   1810:            (*s_etat_processus).pipe_nombre_injections = 0;
                   1811:            (*s_etat_processus).nombre_objets_injectes = 0;
                   1812:            (*s_etat_processus).nombre_objets_envoyes_non_lus = 0;
                   1813:            (*s_etat_processus).pourcentage_maximal_cpu = 100;
                   1814:            (*s_etat_processus).temps_maximal_cpu = 0;
                   1815:            (*s_etat_processus).thread_fusible = 0;
                   1816:            (*s_etat_processus).presence_fusible = d_faux;
                   1817: 
                   1818:            (*s_etat_processus).niveau_recursivite = 0;
                   1819:            (*s_etat_processus).generateur_aleatoire = NULL;
                   1820:            (*s_etat_processus).type_generateur_aleatoire = NULL;
                   1821: 
                   1822:            (*s_etat_processus).colonne_statistique_1 = 1; 
                   1823:            (*s_etat_processus).colonne_statistique_2 = 2; 
                   1824: 
                   1825:            (*s_etat_processus).debug_programme = d_faux;
                   1826:            (*s_etat_processus).execution_pas_suivant = d_faux;
                   1827:            (*s_etat_processus).traitement_instruction_halt = d_faux;
                   1828: 
                   1829:            (*s_etat_processus).derniere_exception = d_ep;
                   1830:            (*s_etat_processus).derniere_erreur_systeme = d_es;
                   1831:            (*s_etat_processus).derniere_erreur_execution = d_ex;
                   1832:            (*s_etat_processus).derniere_erreur_evaluation = d_ex;
                   1833:            (*s_etat_processus).derniere_erreur_fonction_externe = 0;
                   1834: 
                   1835:            (*s_etat_processus).erreur_processus_fils = d_faux;
                   1836:            (*s_etat_processus).erreur_systeme_processus_fils = d_es;
                   1837:            (*s_etat_processus).erreur_execution_processus_fils = d_ex;
                   1838:            (*s_etat_processus).pid_erreur_processus_fils = 0;
                   1839:            (*s_etat_processus).exception_processus_fils = d_ep;
                   1840:            (*s_etat_processus).core = core;
                   1841:            (*s_etat_processus).invalidation_message_erreur = d_faux;
                   1842:            (*s_etat_processus).s_objet_errone = NULL;
                   1843:            (*s_etat_processus).s_objet_erreur = NULL;
                   1844: 
                   1845:            (*s_etat_processus).retour_routine_evaluation = 'N';
                   1846: 
                   1847:            (*s_etat_processus).traitement_interruption = 'N';
                   1848:            (*s_etat_processus).traitement_interruptible = 'Y';
                   1849:            (*s_etat_processus).nombre_interruptions_en_queue = 0;
                   1850:            (*s_etat_processus).nombre_interruptions_non_affectees = 0;
                   1851: 
                   1852:            for(i = 0; i < d_NOMBRE_INTERRUPTIONS; i++)
                   1853:            {
                   1854:                (*s_etat_processus).masque_interruptions[i] = 'N';
                   1855:                (*s_etat_processus).queue_interruptions[i] = 0;
                   1856:                (*s_etat_processus).corps_interruptions[i] = NULL;
                   1857:                (*s_etat_processus).pile_origine_interruptions[i] = NULL;
                   1858:            }
                   1859: 
1.20      bertrand 1860:            (*s_etat_processus).at_exit = NULL;
1.19      bertrand 1861: 
1.1       bertrand 1862:            (*s_etat_processus).pointeurs_caracteres = NULL;
                   1863:            (*s_etat_processus).arbre_instructions = NULL;
                   1864: 
                   1865:            (*s_etat_processus).tid_processus_pere = pthread_self();
                   1866:            (*s_etat_processus).pid_processus_pere = getpid();
                   1867:            (*s_etat_processus).processus_detache = d_vrai;
                   1868:            (*s_etat_processus).var_volatile_processus_pere = -1;
                   1869:            (*s_etat_processus).var_volatile_traitement_retarde_stop = 0;
                   1870:            (*s_etat_processus).var_volatile_alarme = 0;
                   1871:            (*s_etat_processus).var_volatile_requete_arret = 0;
                   1872:            (*s_etat_processus).var_volatile_requete_arret2 = 0;
                   1873:            (*s_etat_processus).var_volatile_traitement_retarde_stop = 0;
                   1874:            (*s_etat_processus).var_volatile_traitement_sigint = 0;
                   1875:            (*s_etat_processus).var_volatile_recursivite = 0;
                   1876:            (*s_etat_processus).var_volatile_exception_gsl = 0;
1.22      bertrand 1877:            (*s_etat_processus).arret_depuis_abort = 0;
1.1       bertrand 1878: 
                   1879:            initialisation_allocateur(s_etat_processus);
                   1880:            initialisation_drapeaux(s_etat_processus);
                   1881: 
                   1882:            if ((*s_etat_processus).erreur_systeme != d_es)
                   1883:            {
                   1884:                if ((*s_etat_processus).langue == 'F')
                   1885:                {
                   1886:                    printf("+++Système : Mémoire insuffisante\n");
                   1887:                }
                   1888:                else
                   1889:                {
                   1890:                    printf("+++System : Not enough memory\n");
                   1891:                }
                   1892: 
                   1893:                return(EXIT_FAILURE);
                   1894:            }
                   1895: 
                   1896:            if (((*s_etat_processus).instruction_derniere_erreur =
                   1897:                    malloc(2 * sizeof(unsigned char))) == NULL)
                   1898:            {
                   1899:                erreur = d_es_allocation_memoire;
                   1900: 
                   1901:                if ((*s_etat_processus).langue == 'F')
                   1902:                {
                   1903:                    printf("+++Système : Mémoire insuffisante\n");
                   1904:                }
                   1905:                else
                   1906:                {
                   1907:                    printf("+++System : Not enough memory\n");
                   1908:                }
                   1909: 
                   1910:                return(EXIT_FAILURE);
                   1911:            }
                   1912: 
                   1913:            strcpy((*s_etat_processus).instruction_derniere_erreur, "");
                   1914:            (*s_etat_processus).niveau_derniere_erreur = 0;
                   1915: 
                   1916:            if (traitement_fichier_temporaire == 'Y')
                   1917:            {
                   1918:                (*s_etat_processus).mode_interactif = 'Y';
                   1919:            }
                   1920:            else
                   1921:            {
                   1922:                (*s_etat_processus).mode_interactif = 'N';
                   1923:            }
                   1924: 
                   1925:            if (((*s_etat_processus).instruction_courante = (unsigned char *)
                   1926:                    malloc(sizeof(unsigned char))) == NULL)
                   1927:            {
                   1928:                erreur = d_es_allocation_memoire;
                   1929: 
                   1930:                if ((*s_etat_processus).langue == 'F')
                   1931:                {
                   1932:                    printf("+++Système : Mémoire insuffisante\n");
                   1933:                }
                   1934:                else
                   1935:                {
                   1936:                    printf("+++System : Not enough memory\n");
                   1937:                }
                   1938: 
                   1939:                return(EXIT_FAILURE);
                   1940:            }
                   1941: 
                   1942:            (*s_etat_processus).instruction_courante[0] = d_code_fin_chaine;
                   1943: 
                   1944:            empilement_pile_systeme(s_etat_processus);
                   1945: 
                   1946:            free((*s_etat_processus).instruction_courante);
                   1947: 
                   1948:            if ((*s_etat_processus).erreur_systeme == d_es_allocation_memoire)
                   1949:            {
                   1950:                erreur = d_es_allocation_memoire;
                   1951:            }
                   1952:            else
                   1953:            {
                   1954:                (*((*s_etat_processus).l_base_pile_systeme))
                   1955:                        .retour_definition = 'Y';
                   1956: 
                   1957:                (*s_etat_processus).indep = (struct_objet *) malloc(
                   1958:                        sizeof(struct_objet));
                   1959:                (*s_etat_processus).depend = (struct_objet *) malloc(
                   1960:                        sizeof(struct_objet));
                   1961:                (*s_etat_processus).parametres_courbes_de_niveau =
                   1962:                        (struct_objet *) malloc(sizeof(struct_objet));
                   1963: 
                   1964:                if (((*s_etat_processus).indep != NULL) &&
                   1965:                        ((*s_etat_processus).depend != NULL) &&
                   1966:                        ((*s_etat_processus).parametres_courbes_de_niveau
                   1967:                        != NULL))
                   1968:                {
                   1969:                    (*((*s_etat_processus).indep)).type = NOM;
                   1970:                    (*((*s_etat_processus).depend)).type = NOM;
                   1971:                    (*((*s_etat_processus).
                   1972:                            parametres_courbes_de_niveau)).type = LST;
                   1973: 
                   1974:                    initialisation_objet((*s_etat_processus).indep);
                   1975:                    initialisation_objet((*s_etat_processus).depend);
                   1976:                    initialisation_objet((*s_etat_processus)
                   1977:                            .parametres_courbes_de_niveau);
                   1978: 
                   1979:                    (*((*s_etat_processus).indep)).objet = (struct_nom *)
                   1980:                            malloc(sizeof(struct_nom));
                   1981:                    (*((*s_etat_processus).depend)).objet = (struct_nom *)
                   1982:                            malloc(sizeof(struct_nom));
                   1983:                    (*((*s_etat_processus).parametres_courbes_de_niveau))
                   1984:                            .objet = (struct_liste_chainee *)
                   1985:                            malloc(sizeof(struct_liste_chainee));
                   1986: 
                   1987:                    if (((*((*s_etat_processus).depend)).objet == NULL) ||
                   1988:                            ((*((*s_etat_processus).depend)).objet == NULL) ||
                   1989:                            ((*((*s_etat_processus).
                   1990:                            parametres_courbes_de_niveau)).objet == NULL))
                   1991:                    {
                   1992:                        erreur = d_es_allocation_memoire;
                   1993:                        
                   1994:                        if ((*s_etat_processus).langue == 'F')
                   1995:                        {
                   1996:                            printf("+++Système : Mémoire insuffisante\n");
                   1997:                        }
                   1998:                        else
                   1999:                        {
                   2000:                            printf("+++System : Not enough memory\n");
                   2001:                        }
                   2002: 
                   2003:                        return(EXIT_FAILURE);
                   2004:                    }
                   2005: 
                   2006:                    (*((struct_nom *) (*((*s_etat_processus).indep)).objet))
                   2007:                            .nom = malloc(2 * sizeof(unsigned char));
                   2008:                    (*((struct_nom *) (*((*s_etat_processus).depend)).objet))
                   2009:                            .nom = malloc(2 * sizeof(unsigned char));
                   2010: 
                   2011:                    if (((*((struct_nom *) (*((*s_etat_processus).indep))
                   2012:                            .objet)).nom == NULL) || ((*((struct_nom *)
                   2013:                            (*((*s_etat_processus).depend)).objet)).nom ==
                   2014:                            NULL))
                   2015:                    {
                   2016:                        erreur = d_es_allocation_memoire;
                   2017: 
                   2018:                        if ((*s_etat_processus).langue == 'F')
                   2019:                        {
                   2020:                            printf("+++Système : Mémoire insuffisante\n");
                   2021:                        }
                   2022:                        else
                   2023:                        {
                   2024:                            printf("+++System : Not enough memory\n");
                   2025:                        }
                   2026: 
                   2027:                        return(EXIT_FAILURE);
                   2028:                    }
                   2029: 
                   2030:                    strcpy((*((struct_nom *) (*((*s_etat_processus).indep))
                   2031:                            .objet)).nom, "X");
                   2032:                    strcpy((*((struct_nom *) (*((*s_etat_processus).depend))
                   2033:                            .objet)).nom, "Y");
                   2034: 
                   2035:                    (*((struct_nom *) (*((*s_etat_processus).indep))
                   2036:                            .objet)).symbole = d_vrai;
                   2037:                    (*((struct_nom *) (*((*s_etat_processus).depend))
                   2038:                            .objet)).symbole = d_vrai;
                   2039: 
                   2040:                    (*((struct_liste_chainee *) (*((*s_etat_processus)
                   2041:                            .parametres_courbes_de_niveau)).objet)).suivant
                   2042:                            = NULL;
                   2043: 
                   2044:                    (*((struct_liste_chainee *) (*((*s_etat_processus)
                   2045:                            .parametres_courbes_de_niveau)).objet)).donnee
                   2046:                            = malloc(sizeof(struct_objet));
                   2047: 
                   2048:                    (*s_etat_processus).legende =
                   2049:                            malloc(sizeof(unsigned char));
                   2050:                    (*s_etat_processus).label_x =
                   2051:                            malloc(sizeof(unsigned char));
                   2052:                    (*s_etat_processus).label_y =
                   2053:                            malloc(sizeof(unsigned char));
                   2054:                    (*s_etat_processus).label_z =
                   2055:                            malloc(sizeof(unsigned char));
                   2056:                    (*s_etat_processus).titre =
                   2057:                            malloc(sizeof(unsigned char));
                   2058: 
                   2059:                    if (((*s_etat_processus).label_x == NULL) ||
                   2060:                            ((*s_etat_processus).label_y == NULL) ||
                   2061:                            ((*s_etat_processus).label_z == NULL) ||
                   2062:                            ((*s_etat_processus).titre == NULL) ||
                   2063:                            ((*s_etat_processus).legende == NULL) ||
                   2064:                            ((*((struct_liste_chainee *) (*((*s_etat_processus)
                   2065:                            .parametres_courbes_de_niveau)).objet)).donnee
                   2066:                            == NULL))
                   2067:                    {
                   2068:                        erreur = d_es_allocation_memoire;
                   2069: 
                   2070:                        if ((*s_etat_processus).langue == 'F')
                   2071:                        {
                   2072:                            printf("+++Système : Mémoire insuffisante\n");
                   2073:                        }
                   2074:                        else
                   2075:                        {
                   2076:                            printf("+++System : Not enough memory\n");
                   2077:                        }
                   2078: 
                   2079:                        return(EXIT_FAILURE);
                   2080:                    }
                   2081: 
                   2082:                    (*(*((struct_liste_chainee *) (*((*s_etat_processus)
                   2083:                            .parametres_courbes_de_niveau)).objet)).donnee)
                   2084:                            .type = CHN;
                   2085: 
                   2086:                    initialisation_objet((*((struct_liste_chainee *)
                   2087:                            (*((*s_etat_processus)
                   2088:                            .parametres_courbes_de_niveau))
                   2089:                            .objet)).donnee);
                   2090: 
                   2091:                    if (((*(*((struct_liste_chainee *) (*((*s_etat_processus)
                   2092:                            .parametres_courbes_de_niveau)).objet)).donnee)
                   2093:                            .objet = malloc(10 * sizeof(unsigned char)))
                   2094:                            == NULL)
                   2095:                    {
                   2096:                        erreur = d_es_allocation_memoire;
                   2097: 
                   2098:                        if ((*s_etat_processus).langue == 'F')
                   2099:                        {
                   2100:                            printf("+++Système : Mémoire insuffisante\n");
                   2101:                        }
                   2102:                        else
                   2103:                        {
                   2104:                            printf("+++System : Not enough memory\n");
                   2105:                        }
                   2106: 
                   2107:                        return(EXIT_FAILURE);
                   2108:                    }
                   2109: 
                   2110:                    strcpy((unsigned char *) (*(*((struct_liste_chainee *)
                   2111:                            (*((*s_etat_processus)
                   2112:                            .parametres_courbes_de_niveau))
                   2113:                            .objet)).donnee).objet, "AUTOMATIC");
                   2114: 
                   2115:                    (*s_etat_processus).label_x[0] = d_code_fin_chaine;
                   2116:                    (*s_etat_processus).label_y[0] = d_code_fin_chaine;
                   2117:                    (*s_etat_processus).label_z[0] = d_code_fin_chaine;
                   2118:                    (*s_etat_processus).titre[0] = d_code_fin_chaine;
                   2119:                    (*s_etat_processus).legende[0] = d_code_fin_chaine;
                   2120: 
                   2121:                    (*s_etat_processus).nom_fichier_gnuplot = NULL;
                   2122:                    (*s_etat_processus).type_fichier_gnuplot = NULL;
                   2123: 
                   2124:                    (*s_etat_processus).x_tics = 0;
                   2125:                    (*s_etat_processus).y_tics = 0;
                   2126:                    (*s_etat_processus).z_tics = 0;
                   2127: 
                   2128:                    (*s_etat_processus).x_lines = d_vrai;
                   2129:                    (*s_etat_processus).y_lines = d_vrai;
                   2130:                    (*s_etat_processus).z_lines = d_vrai;
                   2131: 
                   2132:                    (*s_etat_processus).mx_tics = -1;
                   2133:                    (*s_etat_processus).my_tics = -1;
                   2134:                    (*s_etat_processus).mz_tics = -1;
                   2135: 
                   2136:                    (*s_etat_processus).mx_lines = d_faux;
                   2137:                    (*s_etat_processus).my_lines = d_faux;
                   2138:                    (*s_etat_processus).mz_lines = d_faux;
                   2139: 
                   2140:                    (*s_etat_processus).x2_tics = -1;
                   2141:                    (*s_etat_processus).y2_tics = -1;
                   2142:                    (*s_etat_processus).z2_tics = -1;
                   2143: 
                   2144:                    (*s_etat_processus).x2_lines = d_faux;
                   2145:                    (*s_etat_processus).y2_lines = d_faux;
                   2146:                    (*s_etat_processus).z2_lines = d_faux;
                   2147: 
                   2148:                    (*s_etat_processus).mx2_tics = -1;
                   2149:                    (*s_etat_processus).my2_tics = -1;
                   2150:                    (*s_etat_processus).mz2_tics = -1;
                   2151: 
                   2152:                    (*s_etat_processus).mx2_lines = d_faux;
                   2153:                    (*s_etat_processus).my2_lines = d_faux;
                   2154:                    (*s_etat_processus).mz2_lines = d_faux;
                   2155: 
                   2156:                    if ((*s_etat_processus).erreur_systeme != d_es)
                   2157:                    {
                   2158:                        if ((*s_etat_processus).langue == 'F')
                   2159:                        {
                   2160:                            printf("+++Système : Mémoire insuffisante\n");
                   2161:                        }
                   2162:                        else
                   2163:                        {
                   2164:                            printf("+++System : Not enough memory\n");
                   2165:                        }
                   2166: 
                   2167:                        return(EXIT_FAILURE);
                   2168:                    }
                   2169: 
                   2170:                    (*s_etat_processus).mode_evaluation_expression = 'N';
                   2171:                    (*s_etat_processus).mode_execution_programme = 'Y';
                   2172: 
                   2173:                    if ((*s_etat_processus).definitions_chainees == NULL)
                   2174:                    {
                   2175:                        if ((erreur = chainage(s_etat_processus)) !=
                   2176:                                d_absence_erreur)
                   2177:                        {
                   2178:                            if ((*s_etat_processus).langue == 'F')
                   2179:                            {
                   2180:                                printf("+++Fatal :"
                   2181:                                        " Chaînage des définitions"
                   2182:                                        " impossible\n");
                   2183:                            }
                   2184:                            else
                   2185:                            {
                   2186:                                printf("+++Fatal : Error in "
                   2187:                                        "compilation\n");
                   2188:                            }
                   2189: 
                   2190:                            if (traitement_fichier_temporaire == 'Y')
                   2191:                            {
                   2192:                                if (destruction_fichier(
                   2193:                                        nom_fichier_temporaire)
                   2194:                                        == d_erreur)
                   2195:                                {
                   2196:                                    return(EXIT_FAILURE);
                   2197:                                }
                   2198: 
                   2199:                                free(nom_fichier_temporaire);
                   2200:                            }
                   2201: 
                   2202:                            return(EXIT_FAILURE);
                   2203:                        }
                   2204:                    }
                   2205: 
                   2206:                    if ((erreur = compilation(s_etat_processus)) !=
                   2207:                            d_absence_erreur)
                   2208:                    {
                   2209:                        if (traitement_fichier_temporaire == 'Y')
                   2210:                        {
                   2211:                            if (destruction_fichier(nom_fichier_temporaire)
                   2212:                                    == d_erreur)
                   2213:                            {
                   2214:                                return(EXIT_FAILURE);
                   2215:                            }
                   2216: 
                   2217:                            free(nom_fichier_temporaire);
                   2218:                        }
                   2219: 
                   2220:                        printf("%s [%d]\n", message =
                   2221:                                messages(s_etat_processus), (int) getpid());
                   2222:                        free(message);
                   2223: 
                   2224:                        if (test_cfsf(s_etat_processus, 51) == d_faux)
                   2225:                        {
                   2226:                            printf("%s", ds_beep);
                   2227:                        }
                   2228: 
                   2229:                        if ((*s_etat_processus).core == d_vrai)
                   2230:                        {
                   2231:                            printf("\n");
                   2232:                            
                   2233:                            if ((*s_etat_processus).langue == 'F')
                   2234:                            {
                   2235:                                printf("+++Information : Génération du fichier "
                   2236:                                        "rpl-core [%d]\n", (int) getpid());
                   2237:                            }
                   2238:                            else
                   2239:                            {
                   2240:                                printf("+++Information : Writing rpl-core "
                   2241:                                        "file [%d]\n", (int) getpid());
                   2242:                            }
                   2243: 
                   2244:                            rplcore(s_etat_processus);
                   2245: 
                   2246:                            if ((*s_etat_processus).langue == 'F')
                   2247:                            {
                   2248:                                printf("+++Information : Processus tracé "
                   2249:                                        "[%d]\n", (int) getpid());
                   2250:                            }
                   2251:                            else
                   2252:                            {
                   2253:                                printf("+++Information : Done [%d]\n",
                   2254:                                        (int) getpid());
                   2255:                            }
                   2256: 
                   2257:                            printf("\n");
                   2258:                        }
                   2259: 
                   2260:                        return(EXIT_FAILURE);
                   2261:                    }
                   2262: 
                   2263:                    (*s_etat_processus).position_courante = 0;
                   2264:                    (*s_etat_processus).traitement_cycle_exit = 'N';
                   2265: 
                   2266:                    if ((*s_etat_processus).nombre_variables == 0)
                   2267:                    {
                   2268:                        if ((*s_etat_processus).langue == 'F')
                   2269:                        {
                   2270:                            printf("+++Fatal : Aucun point d'entrée\n");
                   2271:                        }
                   2272:                        else
                   2273:                        {
                   2274:                            printf("+++Fatal : Any entry point\n");
                   2275:                        }
                   2276: 
                   2277:                        if (test_cfsf(s_etat_processus, 51) == d_faux)
                   2278:                        {
                   2279:                            printf("%s", ds_beep);
                   2280:                        }
                   2281: 
                   2282:                        return(EXIT_FAILURE);
                   2283:                    }
                   2284: 
                   2285:                    if (recherche_instruction_suivante(s_etat_processus)
                   2286:                            == d_erreur)
                   2287:                    {
                   2288:                        if ((*s_etat_processus).langue == 'F')
                   2289:                        {
                   2290:                            printf("+++Fatal : Aucun point d'entrée\n");
                   2291:                        }
                   2292:                        else
                   2293:                        {
                   2294:                            printf("+++Fatal : Any entry point\n");
                   2295:                        }
                   2296: 
                   2297:                        if (test_cfsf(s_etat_processus, 51) == d_faux)
                   2298:                        {
                   2299:                            printf("%s", ds_beep);
                   2300:                        }
                   2301: 
                   2302:                        return(EXIT_FAILURE);
                   2303:                    }
                   2304: 
                   2305:                    if (recherche_variable(s_etat_processus,
                   2306:                            (*s_etat_processus)
                   2307:                            .instruction_courante) == d_faux)
                   2308:                    {
                   2309:                        if ((*s_etat_processus).langue == 'F')
                   2310:                        {
                   2311:                            printf("+++Fatal : Aucun point d'entrée\n");
                   2312:                        }
                   2313:                        else
                   2314:                        {
                   2315:                            printf("+++Fatal : Any entry point\n");
                   2316:                        }
                   2317: 
                   2318:                        if (test_cfsf(s_etat_processus, 51) == d_faux)
                   2319:                        {
                   2320:                            printf("%s", ds_beep);
                   2321:                        }
                   2322: 
                   2323:                        return(EXIT_FAILURE);
                   2324:                    }
                   2325: 
                   2326:                    if ((*s_etat_processus).s_liste_variables
                   2327:                            [(*s_etat_processus)
                   2328:                            .position_variable_courante].niveau != 0)
                   2329:                    {
                   2330:                        if ((*s_etat_processus).langue == 'F')
                   2331:                        {
                   2332:                            printf("+++Fatal : Aucun point d'entrée\n");
                   2333:                        }
                   2334:                        else
                   2335:                        {
                   2336:                            printf("+++Fatal : Any entry point\n");
                   2337:                        }
                   2338: 
                   2339:                        if (test_cfsf(s_etat_processus, 51) == d_faux)
                   2340:                        {
                   2341:                            printf("%s", ds_beep);
                   2342:                        }
                   2343: 
                   2344:                        return(EXIT_FAILURE);
                   2345:                    }
                   2346: 
                   2347:                    free((*s_etat_processus).instruction_courante);
                   2348:                    (*s_etat_processus).position_courante = 0;
                   2349: 
                   2350:                    if (((*s_etat_processus).nom_fichier_historique =
                   2351:                            malloc((strlen(home) +
                   2352:                            strlen(ds_fichier_historique) + 2) *
                   2353:                            sizeof(unsigned char))) == NULL)
                   2354:                    {
                   2355:                        erreur = d_es_allocation_memoire;
                   2356: 
                   2357:                        if ((*s_etat_processus).langue == 'F')
                   2358:                        {
                   2359:                            printf("+++Système : Mémoire insuffisante\n");
                   2360:                        }
                   2361:                        else
                   2362:                        {
                   2363:                            printf("+++System : Not enough memory\n");
                   2364:                        }
                   2365: 
                   2366:                        return(EXIT_FAILURE);
                   2367:                    }
                   2368: 
                   2369:                    sprintf((*s_etat_processus).nom_fichier_historique, "%s/%s",
                   2370:                            home, ds_fichier_historique);
                   2371: 
                   2372:                    using_history();
                   2373:                    erreur_historique = read_history(
                   2374:                            (*s_etat_processus).nom_fichier_historique);
                   2375: 
                   2376:                    gsl_set_error_handler(&traitement_exceptions_gsl);
                   2377: 
                   2378:                    if (drapeau_encart == 'Y')
                   2379:                    {
                   2380:                        (*s_etat_processus).erreur_systeme = d_es;
                   2381:                        encart(s_etat_processus,
                   2382:                                (unsigned long) (5 * 1000000));
                   2383: 
                   2384:                        if ((*s_etat_processus).erreur_systeme != d_es)
                   2385:                        {
                   2386:                            if ((message = messages(s_etat_processus))
                   2387:                                    == NULL)
                   2388:                            {
                   2389:                                erreur = d_es_allocation_memoire;
                   2390: 
                   2391:                                if ((*s_etat_processus).langue == 'F')
                   2392:                                {
                   2393:                                    printf("+++Système : Mémoire "
                   2394:                                            "insuffisante\n");
                   2395:                                }
                   2396:                                else
                   2397:                                {
                   2398:                                    printf("+++System : Not enough "
                   2399:                                            "memory\n");
                   2400:                                }
                   2401: 
                   2402:                                return(EXIT_FAILURE);
                   2403:                            }
                   2404: 
                   2405:                            printf("%s [%d]\n", message, (int) getpid());
                   2406:                            free(message);
                   2407: 
                   2408:                            return(EXIT_FAILURE);
                   2409:                        }
                   2410:                    }
                   2411: 
                   2412:                    fflush(stdout);
                   2413: 
                   2414:                    initialisation_instructions(s_etat_processus);
                   2415: 
                   2416:                    if (arguments != NULL)
                   2417:                    {
                   2418:                        tampon = (*s_etat_processus).definitions_chainees;
                   2419:                        (*s_etat_processus).definitions_chainees =
                   2420:                                arguments;
                   2421: 
                   2422:                        if (analyse_syntaxique(s_etat_processus) ==
                   2423:                                d_erreur)
                   2424:                        {
                   2425:                            if ((*s_etat_processus).erreur_systeme != d_es)
                   2426:                            {
                   2427:                                erreur = d_es_allocation_memoire;
                   2428: 
                   2429:                                if ((*s_etat_processus).langue == 'F')
                   2430:                                {
                   2431:                                    printf("+++Système : Mémoire "
                   2432:                                            "insuffisante\n");
                   2433:                                }
                   2434:                                else
                   2435:                                {
                   2436:                                    printf("+++System : Not enough "
                   2437:                                            "memory\n");
                   2438:                                }
                   2439: 
                   2440:                                return(EXIT_FAILURE);
                   2441:                            }
                   2442:                            else
                   2443:                            {
                   2444:                                if ((*s_etat_processus).langue == 'F')
                   2445:                                {
                   2446:                                    printf("+++Erreur : Erreur de "
                   2447:                                            "syntaxe\n");
                   2448:                                }
                   2449:                                else
                   2450:                                {
                   2451:                                    printf("+++Error : Syntax error\n");
                   2452:                                }
                   2453: 
                   2454:                                return(EXIT_FAILURE);
                   2455:                            }
                   2456:                        }
                   2457: 
                   2458:                        (*s_etat_processus).instruction_courante
                   2459:                                = arguments;
                   2460:                        (*s_etat_processus).definitions_chainees = tampon;
                   2461:                        (*s_etat_processus).position_courante = 0;
                   2462: 
                   2463:                        recherche_type(s_etat_processus);
                   2464: 
                   2465:                        if ((*s_etat_processus).erreur_systeme != d_es)
                   2466:                        {
                   2467:                            if ((message = messages(s_etat_processus))
                   2468:                                    == NULL)
                   2469:                            {
                   2470:                                erreur = d_es_allocation_memoire;
                   2471: 
                   2472:                                if ((*s_etat_processus).langue == 'F')
                   2473:                                {
                   2474:                                    printf("+++Système : Mémoire "
                   2475:                                            "insuffisante\n");
                   2476:                                }
                   2477:                                else
                   2478:                                {
                   2479:                                    printf("+++System : Not enough "
                   2480:                                            "memory\n");
                   2481:                                }
                   2482: 
                   2483:                                return(EXIT_FAILURE);
                   2484:                            }
                   2485: 
                   2486:                            printf("%s [%d]\n", message, (int) getpid());
                   2487:                            free(message);
                   2488: 
                   2489:                            return(EXIT_FAILURE);
                   2490:                        }
                   2491: 
                   2492:                        if ((*s_etat_processus).erreur_execution != d_ex)
                   2493:                        {
                   2494:                            if ((message = messages(s_etat_processus))
                   2495:                                    == NULL)
                   2496:                            {
                   2497:                                erreur = d_es_allocation_memoire;
                   2498: 
                   2499:                                if ((*s_etat_processus).langue == 'F')
                   2500:                                {
                   2501:                                    printf("+++Erreur : Mémoire "
                   2502:                                            "insuffisante\n");
                   2503:                                }
                   2504:                                else
                   2505:                                {
                   2506:                                    printf("+++Error : Not enough "
                   2507:                                            "memory\n");
                   2508:                                }
                   2509: 
                   2510:                                return(EXIT_FAILURE);
                   2511:                            }
                   2512: 
                   2513:                            printf("%s [%d]\n", message, (int) getpid());
                   2514:                            free(message);
                   2515: 
                   2516:                            return(EXIT_FAILURE);
                   2517:                        }
                   2518: 
                   2519:                        if (depilement(s_etat_processus,
                   2520:                                &((*s_etat_processus).l_base_pile),
                   2521:                                &s_objet) == d_erreur)
                   2522:                        {
                   2523:                            if ((message = messages(s_etat_processus))
                   2524:                                    == NULL)
                   2525:                            {
                   2526:                                erreur = d_es_allocation_memoire;
                   2527: 
                   2528:                                if ((*s_etat_processus).langue == 'F')
                   2529:                                {
                   2530:                                    printf("+++Erreur : Mémoire "
                   2531:                                            "insuffisante\n");
                   2532:                                }
                   2533:                                else
                   2534:                                {
                   2535:                                    printf("+++Error : Not enough "
                   2536:                                            "memory\n");
                   2537:                                }
                   2538: 
                   2539:                                return(EXIT_FAILURE);
                   2540:                            }
                   2541: 
                   2542:                            printf("%s [%d]\n", message, (int) getpid());
                   2543:                            free(message);
                   2544: 
                   2545:                            return(EXIT_FAILURE);
                   2546:                        }
                   2547: 
                   2548:                        if (evaluation(s_etat_processus, s_objet, 'E')
                   2549:                                == d_erreur)
                   2550:                        {
                   2551:                            if ((*s_etat_processus).erreur_systeme != d_es)
                   2552:                            {
                   2553:                                if ((message = messages(s_etat_processus))
                   2554:                                        == NULL)
                   2555:                                {
                   2556:                                    erreur = d_es_allocation_memoire;
                   2557: 
                   2558:                                    if ((*s_etat_processus).langue == 'F')
                   2559:                                    {
                   2560:                                        printf("+++Système : Mémoire "
                   2561:                                                "insuffisante\n");
                   2562:                                    }
                   2563:                                    else
                   2564:                                    {
                   2565:                                        printf("+++System : Not enough "
                   2566:                                                "memory\n");
                   2567:                                    }
                   2568: 
                   2569:                                    return(EXIT_FAILURE);
                   2570:                                }
                   2571: 
                   2572:                                printf("%s [%d]\n", message,
                   2573:                                        (int) getpid());
                   2574:                                free(message);
                   2575: 
                   2576:                                return(EXIT_FAILURE);
                   2577:                            }
                   2578: 
                   2579:                            if ((*s_etat_processus).erreur_execution
                   2580:                                    != d_ex)
                   2581:                            {
                   2582:                                if ((message = messages(s_etat_processus))
                   2583:                                        == NULL)
                   2584:                                {
                   2585:                                    erreur = d_es_allocation_memoire;
                   2586: 
                   2587:                                    if ((*s_etat_processus).langue == 'F')
                   2588:                                    {
                   2589:                                        printf("+++Erreur : Mémoire "
                   2590:                                                "insuffisante\n");
                   2591:                                    }
                   2592:                                    else
                   2593:                                    {
                   2594:                                        printf("+++Error : Not enough "
                   2595:                                                "memory\n");
                   2596:                                    }
                   2597: 
                   2598:                                    return(EXIT_FAILURE);
                   2599:                                }
                   2600: 
                   2601:                                printf("%s [%d]\n", message,
                   2602:                                        (int) getpid());
                   2603:                                free(message);
                   2604: 
                   2605:                                return(EXIT_FAILURE);
                   2606:                            }
                   2607:                        }
                   2608: 
                   2609:                        (*s_etat_processus).instruction_courante = NULL;
                   2610:                        liberation(s_etat_processus, s_objet);
                   2611: 
                   2612:                        free(arguments);
                   2613:                    }
                   2614: 
1.13      bertrand 2615:                    if (option_a == d_vrai)
1.1       bertrand 2616:                    {
1.13      bertrand 2617:                        fprintf(stdout, "%s\n", (*s_etat_processus)
                   2618:                                .definitions_chainees);
1.1       bertrand 2619:                    }
1.13      bertrand 2620:                    else
                   2621:                    {
                   2622:                        if (option_D == d_vrai)
                   2623:                        {
                   2624:                            lancement_daemon(s_etat_processus);
                   2625:                        }
1.1       bertrand 2626: 
1.13      bertrand 2627:                        if (option_p == d_faux)
1.1       bertrand 2628:                        {
1.13      bertrand 2629:                            if (setjmp(contexte_initial) == 0)
                   2630:                            {
                   2631:                                erreur = sequenceur(s_etat_processus);
                   2632:                            }
1.1       bertrand 2633:                        }
1.13      bertrand 2634:                        else
1.1       bertrand 2635:                        {
1.13      bertrand 2636:                            if (setjmp(contexte_initial) == 0)
                   2637:                            {
                   2638:                                erreur = sequenceur_optimise(s_etat_processus);
                   2639:                            }
1.1       bertrand 2640:                        }
1.19      bertrand 2641: 
                   2642:                        if (erreur == d_absence_erreur)
                   2643:                        {
1.22      bertrand 2644:                            if (((*s_etat_processus).var_volatile_alarme == 0)
                   2645:                                    && ((*s_etat_processus).arret_depuis_abort
                   2646:                                    == 0) && ((*s_etat_processus).at_exit
                   2647:                                    != NULL))
1.21      bertrand 2648:                            {
                   2649:                                erreur = evaluation(s_etat_processus,
                   2650:                                        (*s_etat_processus).at_exit, 'E');
                   2651:                            }
1.19      bertrand 2652:                        }
                   2653: 
                   2654:                        liberation(s_etat_processus,
1.20      bertrand 2655:                                (*s_etat_processus).at_exit);
1.1       bertrand 2656:                    }
                   2657: 
                   2658:                    if ((*s_etat_processus).generateur_aleatoire != NULL)
                   2659:                    {
                   2660:                        liberation_generateur_aleatoire(s_etat_processus);
                   2661:                    }
                   2662: 
                   2663:                    l_element_courant = (*s_etat_processus).liste_mutexes;
                   2664:                    while(l_element_courant != NULL)
                   2665:                    {
                   2666:                        pthread_mutex_trylock(&((*((struct_mutex *)
                   2667:                                (*(*((struct_liste_chainee *)
                   2668:                                l_element_courant)).donnee).objet)).mutex));
                   2669:                        pthread_mutex_unlock(&((*((struct_mutex *)
                   2670:                                (*(*((struct_liste_chainee *)
                   2671:                                l_element_courant)).donnee).objet)).mutex));
                   2672:                        pthread_mutex_destroy(&((*((struct_mutex *)
                   2673:                                (*(*((struct_liste_chainee *)
                   2674:                                l_element_courant)).donnee).objet)).mutex));
                   2675: 
                   2676:                        liberation(s_etat_processus,
                   2677:                                (*((struct_liste_chainee *)
                   2678:                                l_element_courant)).donnee);
                   2679:                        l_element_suivant = (*((struct_liste_chainee *)
                   2680:                                l_element_courant)).suivant;
                   2681:                        free((struct_liste_chainee *) l_element_courant);
                   2682:                        l_element_courant = l_element_suivant;
                   2683:                    }
                   2684: 
                   2685:                    /*
                   2686:                     * Arrêt des processus fils
                   2687:                     */
                   2688: 
                   2689:                    if ((*s_etat_processus).presence_fusible == d_vrai)
                   2690:                    {
                   2691:                        pthread_cancel((*s_etat_processus).thread_fusible);
                   2692:                    }
                   2693: 
                   2694:                    pthread_mutex_lock(&((*s_etat_processus).mutex));
                   2695: 
                   2696:                    l_element_courant = (void *) (*s_etat_processus)
                   2697:                            .l_base_pile_processus;
                   2698: 
                   2699:                    while(l_element_courant != NULL)
                   2700:                    {
                   2701:                        if ((*s_etat_processus).debug == d_vrai)
                   2702:                        {
                   2703:                            if (((*s_etat_processus).type_debug &
                   2704:                                    d_debug_processus) != 0)
                   2705:                            {
                   2706:                                if ((*(*((struct_processus_fils *)
                   2707:                                        (*(*((struct_liste_chainee *)
                   2708:                                        l_element_courant)).donnee)
                   2709:                                        .objet)).thread)
                   2710:                                        .processus_detache == d_vrai)
                   2711:                                {
                   2712:                                    if ((*s_etat_processus).langue == 'F')
                   2713:                                    {
                   2714:                                        printf("[%d] Signalement pour arrêt du "
                   2715:                                                "processus %d\n",
                   2716:                                                (int) getpid(), (int)
                   2717:                                                (*(*((struct_processus_fils *)
                   2718:                                                (*(*((struct_liste_chainee *)
                   2719:                                                l_element_courant)).donnee)
                   2720:                                                .objet)).thread).pid);
                   2721:                                    }
                   2722:                                    else
                   2723:                                    {
                   2724:                                        printf("[%d] Send stop signal to "
                   2725:                                                "process %d\n",
                   2726:                                                (int) getpid(), (int)
                   2727:                                                (*(*((struct_processus_fils *)
                   2728:                                                (*(*((struct_liste_chainee *)
                   2729:                                                l_element_courant)).donnee)
                   2730:                                                .objet)).thread).pid);
                   2731:                                    }
                   2732:                                }
                   2733:                                else
                   2734:                                {
                   2735:                                    if ((*s_etat_processus).langue == 'F')
                   2736:                                    {
                   2737:                                        printf("[%d] Signalement pour arrêt du "
                   2738:                                                "thread %llu\n", (int) getpid(),
                   2739:                                                (unsigned long long)
                   2740:                                                (*(*((struct_processus_fils *)
                   2741:                                                (*(*((struct_liste_chainee *)
                   2742:                                                l_element_courant)).donnee)
                   2743:                                                .objet)).thread).tid);
                   2744:                                    }
                   2745:                                    else
                   2746:                                    {
                   2747:                                        printf("[%d] Send stop signal to "
                   2748:                                                "thread %llu\n",
                   2749:                                                (int) getpid(),
                   2750:                                                (unsigned long long)
                   2751:                                                (*(*((struct_processus_fils *)
                   2752:                                                (*(*((struct_liste_chainee *)
                   2753:                                                l_element_courant)).donnee)
                   2754:                                                .objet)).thread).tid);
                   2755:                                    }
                   2756:                                }
                   2757:                            }
                   2758:                        }
                   2759: 
                   2760:                        if ((*(*((struct_processus_fils *)
                   2761:                                (*(*((struct_liste_chainee *)
                   2762:                                l_element_courant)).donnee).objet))
                   2763:                                .thread).processus_detache == d_vrai)
                   2764:                        {
                   2765:                            if ((*s_etat_processus).var_volatile_alarme != 0)
                   2766:                            {
                   2767:                                kill((*(*((struct_processus_fils *)
                   2768:                                        (*(*((struct_liste_chainee *)
                   2769:                                        l_element_courant)).donnee).objet))
                   2770:                                        .thread).pid, SIGURG);
                   2771:                            }
                   2772:                            else
                   2773:                            {
1.22      bertrand 2774:                                if ((*s_etat_processus).arret_depuis_abort
                   2775:                                        == -1)
                   2776:                                {
                   2777:                                    kill((*(*((struct_processus_fils *)
                   2778:                                            (*(*((struct_liste_chainee *)
                   2779:                                            l_element_courant)).donnee).objet))
                   2780:                                            .thread).pid, SIGFABORT);
                   2781:                                }
                   2782:                                else
                   2783:                                {
                   2784:                                    kill((*(*((struct_processus_fils *)
                   2785:                                            (*(*((struct_liste_chainee *)
                   2786:                                            l_element_courant)).donnee).objet))
                   2787:                                            .thread).pid, SIGFSTOP);
                   2788:                                }
1.1       bertrand 2789:                            }
                   2790:                        }
                   2791:                        else
                   2792:                        {
                   2793:                            pthread_mutex_lock(&((*(*((struct_processus_fils *)
                   2794:                                    (*(*((struct_liste_chainee *)
                   2795:                                    l_element_courant)).donnee).objet)).thread)
                   2796:                                    .mutex));
                   2797: 
                   2798:                            if ((*(*((struct_processus_fils *)
                   2799:                                    (*(*((struct_liste_chainee *)
                   2800:                                    l_element_courant)).donnee).objet)).thread)
                   2801:                                    .thread_actif == d_vrai)
                   2802:                            {
                   2803:                                if ((*s_etat_processus).var_volatile_alarme
                   2804:                                        != 0)
                   2805:                                {
                   2806:                                    pthread_kill((*(*((struct_processus_fils *)
                   2807:                                            (*(*((struct_liste_chainee *)
                   2808:                                            l_element_courant)).donnee).objet))
                   2809:                                            .thread).tid, SIGURG);
                   2810:                                }
                   2811:                                else
                   2812:                                {
1.22      bertrand 2813:                                    if ((*s_etat_processus).arret_depuis_abort
                   2814:                                            == -1)
                   2815:                                    {
                   2816:                                        pthread_kill(
                   2817:                                                (*(*((struct_processus_fils *)
                   2818:                                                (*(*((struct_liste_chainee *)
                   2819:                                                l_element_courant)).donnee)
                   2820:                                                .objet)).thread).tid,
                   2821:                                                SIGFABORT);
                   2822:                                    }
                   2823:                                    else
                   2824:                                    {
                   2825:                                        pthread_kill(
                   2826:                                                (*(*((struct_processus_fils *)
                   2827:                                                (*(*((struct_liste_chainee *)
                   2828:                                                l_element_courant)).donnee)
                   2829:                                                .objet)).thread).tid,
                   2830:                                                SIGFSTOP);
                   2831:                                    }
1.1       bertrand 2832:                                }
                   2833:                            }
                   2834: 
                   2835:                            pthread_mutex_unlock(
                   2836:                                    &((*(*((struct_processus_fils *)
                   2837:                                    (*(*((struct_liste_chainee *)
                   2838:                                    l_element_courant)).donnee).objet)).thread)
                   2839:                                    .mutex));
                   2840:                        }
                   2841: 
                   2842:                        l_element_courant = (*((struct_liste_chainee *)
                   2843:                                l_element_courant)).suivant;
                   2844:                    }
                   2845: 
                   2846:                    /*
                   2847:                     * Attente de la fin de tous les processus fils
                   2848:                     */
                   2849: 
                   2850:                    for(i = 0; i < d_NOMBRE_INTERRUPTIONS;
                   2851:                            (*s_etat_processus).masque_interruptions[i++]
                   2852:                            = 'I');
                   2853: 
                   2854:                    attente.tv_sec = 0;
                   2855:                    attente.tv_nsec = GRANULARITE_us * 1000;
                   2856: 
                   2857:                    while((*s_etat_processus).l_base_pile_processus != NULL)
                   2858:                    {
                   2859:                        status = 0;
                   2860: 
                   2861:                        l_element_courant = (void *)
                   2862:                                (*s_etat_processus).l_base_pile_processus;
                   2863: 
                   2864:                        for(i = 0; i < (unsigned long)
                   2865:                                (*(*((struct_processus_fils *)
                   2866:                                (*(*((struct_liste_chainee *)
                   2867:                                l_element_courant)).donnee).objet)).thread)
                   2868:                                .nombre_objets_dans_pipe; i++)
                   2869:                        {
                   2870:                            if ((s_objet = lecture_pipe(
                   2871:                                    s_etat_processus,
                   2872:                                    (*(*((struct_processus_fils *)
                   2873:                                    (*(*((struct_liste_chainee *)
                   2874:                                    l_element_courant)).donnee).objet)).thread)
                   2875:                                    .pipe_objets[0])) != NULL)
                   2876:                            {
                   2877:                                liberation(s_etat_processus, s_objet);
                   2878: 
                   2879:                                (*(*((struct_processus_fils *)
                   2880:                                        (*(*((struct_liste_chainee *)
                   2881:                                        l_element_courant)).donnee).objet))
                   2882:                                        .thread).nombre_objets_dans_pipe--;
                   2883: 
                   2884:                                action.sa_handler = SIG_IGN;
                   2885:                                action.sa_flags = SA_ONSTACK;
                   2886: 
                   2887:                                if (sigaction(SIGPIPE, &action, &registre)
                   2888:                                        != 0)
                   2889:                                {
                   2890:                                    pthread_mutex_unlock(
                   2891:                                            &((*s_etat_processus).mutex));
                   2892:                                    return(EXIT_FAILURE);
                   2893:                                }
                   2894: 
                   2895:                                while((longueur_ecriture =
                   2896:                                        write_atomic(s_etat_processus,
                   2897:                                        (*(*((struct_processus_fils *)
                   2898:                                        (*(*((struct_liste_chainee *)
                   2899:                                        l_element_courant)).donnee).objet))
                   2900:                                        .thread).pipe_nombre_injections[1], "+",
                   2901:                                        sizeof(unsigned char))) !=
                   2902:                                        sizeof(unsigned char))
                   2903:                                {
                   2904:                                    if (longueur_ecriture == -1)
                   2905:                                    {
                   2906:                                        // Le processus n'existe plus.
                   2907:                                        break;
                   2908:                                    }
                   2909:                                }
                   2910: 
                   2911:                                if (sigaction(SIGPIPE, &registre, NULL)
                   2912:                                        != 0)
                   2913:                                {
                   2914:                                    pthread_mutex_unlock(
                   2915:                                            &((*s_etat_processus).mutex));
                   2916:                                    return(EXIT_FAILURE);
                   2917:                                }
                   2918:                            }
                   2919:                        }
                   2920: 
                   2921:                        pthread_mutex_unlock(&((*s_etat_processus).mutex));
1.23      bertrand 2922: 
                   2923:                        if ((*s_etat_processus)
                   2924:                                .nombre_interruptions_non_affectees != 0)
                   2925:                        {
                   2926:                            affectation_interruptions_logicielles(
                   2927:                                    s_etat_processus);
                   2928:                        }
                   2929: 
1.1       bertrand 2930:                        nanosleep(&attente, NULL);
                   2931:                        pthread_mutex_lock(&((*s_etat_processus).mutex));
                   2932:                    }
                   2933: 
                   2934:                    pthread_mutex_unlock(&((*s_etat_processus).mutex));
                   2935: 
                   2936:                    erreur_historique = write_history(
                   2937:                            (*s_etat_processus).nom_fichier_historique);
                   2938:                    clear_history();
                   2939: 
                   2940:                    if (erreur_historique != 0)
                   2941:                    {
                   2942:                        if ((*s_etat_processus).langue == 'F')
                   2943:                        {
                   2944:                            printf("+++Erreur : L'historique ne peut être "
                   2945:                                    "écrit\n");
                   2946:                        }
                   2947:                        else
                   2948:                        {
                   2949:                            printf("+++Error : History cannot be "
                   2950:                                    "written\n");
                   2951:                        }
                   2952: 
                   2953:                        if (test_cfsf(s_etat_processus, 51) == d_faux)
                   2954:                        {
                   2955:                            printf("%s", ds_beep);
                   2956:                        }
                   2957:                    }
                   2958: 
                   2959:                    free((*s_etat_processus).nom_fichier_historique);
                   2960: 
                   2961:                    if (((*s_etat_processus).core == d_vrai) &&
                   2962:                            (erreur == d_erreur) &&
                   2963:                            ((*s_etat_processus).var_volatile_traitement_sigint
                   2964:                            == 0))
                   2965:                    {
                   2966:                        printf("\n");
                   2967:                        
                   2968:                        if ((*s_etat_processus).langue == 'F')
                   2969:                        {
                   2970:                            printf("+++Information : Génération du fichier "
                   2971:                                    "rpl-core [%d]\n", (int) getpid());
                   2972:                        }
                   2973:                        else
                   2974:                        {
                   2975:                            printf("+++Information : Writing rpl-core "
                   2976:                                    "file [%d]\n", (int) getpid());
                   2977:                        }
                   2978: 
                   2979:                        rplcore(s_etat_processus);
                   2980: 
                   2981:                        if ((*s_etat_processus).langue == 'F')
                   2982:                        {
                   2983:                            printf("+++Information : Processus tracé [%d]\n",
                   2984:                                    (int) getpid());
                   2985:                        }
                   2986:                        else
                   2987:                        {
                   2988:                            printf("+++Information : Done [%d]\n",
                   2989:                                    (int) getpid());
                   2990:                        }
                   2991: 
                   2992:                        printf("\n");
                   2993:                    }
                   2994: 
                   2995:                    free((*s_etat_processus).definitions_chainees);
                   2996: 
                   2997:                    /*
                   2998:                     * Libération de l'arbre des instructions
                   2999:                     */
                   3000: 
                   3001:                    liberation_arbre_instructions(s_etat_processus,
                   3002:                            (*s_etat_processus).arbre_instructions);
                   3003:                    free((*s_etat_processus).pointeurs_caracteres);
                   3004: 
                   3005:                    if ((*s_etat_processus).entree_standard != NULL)
                   3006:                    {
                   3007:                        pclose((*s_etat_processus).entree_standard);
                   3008:                        (*s_etat_processus).entree_standard = NULL;
                   3009:                    }
                   3010: 
                   3011:                    if ((*s_etat_processus).nom_fichier_impression != NULL)
                   3012:                    {
                   3013:                        if (test_cfsf(s_etat_processus, 51) == d_faux)
                   3014:                        {
                   3015:                            printf("%s", ds_beep);
                   3016:                        }
                   3017: 
                   3018:                        if ((*s_etat_processus).langue == 'F')
                   3019:                        {
                   3020:                            printf("+++Attention : Queue d'impression "
                   3021:                                    "non vide !\n");
                   3022:                        }
                   3023:                        else
                   3024:                        {
                   3025:                            printf("+++Warning : Non empty printing "
                   3026:                                    "spool queue !\n");
                   3027:                        }
                   3028: 
                   3029:                        instruction_erase(s_etat_processus);
                   3030:                    }
                   3031: 
                   3032:                    if ((*s_etat_processus).fichiers_graphiques != NULL)
                   3033:                    {
                   3034:                        instruction_cllcd(s_etat_processus);
                   3035:                    }
                   3036: 
                   3037:                    liberation(s_etat_processus, (*s_etat_processus).indep);
                   3038:                    liberation(s_etat_processus, (*s_etat_processus).depend);
                   3039: 
                   3040:                    free((*s_etat_processus).label_x);
                   3041:                    free((*s_etat_processus).label_y);
                   3042:                    free((*s_etat_processus).label_z);
                   3043:                    free((*s_etat_processus).titre);
                   3044:                    free((*s_etat_processus).legende);
                   3045: 
                   3046:                    liberation(s_etat_processus, (*s_etat_processus)
                   3047:                            .parametres_courbes_de_niveau);
                   3048: 
                   3049:                    for(i = 0; i < d_NOMBRE_INTERRUPTIONS; i++)
                   3050:                    {
                   3051:                        liberation(s_etat_processus,
                   3052:                                (*s_etat_processus).corps_interruptions[i]);
                   3053: 
                   3054:                        l_element_courant = (*s_etat_processus)
                   3055:                                .pile_origine_interruptions[i];
                   3056: 
                   3057:                        while(l_element_courant != NULL)
                   3058:                        {
                   3059:                            l_element_suivant = (*((struct_liste_chainee *)
                   3060:                                    l_element_courant)).suivant;
                   3061: 
                   3062:                            liberation(s_etat_processus,
                   3063:                                    (*((struct_liste_chainee *)
                   3064:                                    l_element_courant)).donnee);
                   3065:                            free(l_element_courant);
                   3066: 
                   3067:                            l_element_courant = l_element_suivant;
                   3068:                        }
                   3069:                    }
                   3070: 
                   3071:                    if ((*s_etat_processus).instruction_derniere_erreur
                   3072:                            != NULL)
                   3073:                    {
                   3074:                        free((*s_etat_processus).instruction_derniere_erreur);
                   3075:                        (*s_etat_processus).instruction_derniere_erreur = NULL;
                   3076:                    }
                   3077: 
                   3078:                    /*
                   3079:                     * Le pointeur s_etat_processus.nom_fichier_source est
                   3080:                     * alloué par le système. Il ne faut donc pas
                   3081:                     * le libérer...
                   3082:                     */
                   3083: 
                   3084:                    for(i = 0; i < (*s_etat_processus).nombre_variables; i++)
                   3085:                    {
                   3086:                        liberation(s_etat_processus,
                   3087:                                (*s_etat_processus).s_liste_variables[i].objet);
                   3088:                        free((*s_etat_processus).s_liste_variables[i].nom);
                   3089:                    }
                   3090: 
                   3091:                    free((*s_etat_processus).s_liste_variables);
                   3092: 
                   3093:                    for(i = 0; i < (*s_etat_processus)
                   3094:                            .nombre_variables_statiques; i++)
                   3095:                    {
                   3096:                        liberation(s_etat_processus, (*s_etat_processus)
                   3097:                                .s_liste_variables_statiques[i].objet);
                   3098:                        free((*s_etat_processus)
                   3099:                                .s_liste_variables_statiques[i].nom);
                   3100:                    }
                   3101: 
                   3102:                    free((*s_etat_processus).s_liste_variables_statiques);
                   3103: 
                   3104:                    for(i = 0; i < (*((*s_etat_processus)
                   3105:                            .s_liste_variables_partagees)).nombre_variables;
                   3106:                            i++)
                   3107:                    {
                   3108:                        liberation(s_etat_processus, (*((*s_etat_processus)
                   3109:                                .s_liste_variables_partagees)).table[i].objet);
                   3110:                        free((*((*s_etat_processus)
                   3111:                                .s_liste_variables_partagees)).table[i].nom);
                   3112:                    }
                   3113: 
                   3114:                    free((struct_variable_partagee *)
                   3115:                            (*((*s_etat_processus).s_liste_variables_partagees))
                   3116:                            .table);
                   3117: 
                   3118:                    /*
                   3119:                     * Si resultats est non nul, rplinit a été appelé
                   3120:                     * depuis rpl() [librpl] et non main().
                   3121:                     * On copie alors le contenu de la * pile dans un
                   3122:                     * tableau **resultats dont le pointeur de base a
                   3123:                     * été alloué dans rpl().
                   3124:                     */
                   3125: 
                   3126:                    if (resultats != NULL)
                   3127:                    {
                   3128:                        if ((*resultats) != NULL)
                   3129:                        {
                   3130:                            free((*resultats));
                   3131: 
                   3132:                            if (((*resultats) = malloc(((*s_etat_processus)
                   3133:                                    .hauteur_pile_operationnelle + 1)
                   3134:                                    * sizeof(unsigned char **))) != NULL)
                   3135:                            {
                   3136:                                (*resultats)[(*s_etat_processus)
                   3137:                                        .hauteur_pile_operationnelle] = NULL;
                   3138:                                l_element_courant = (void *) (*s_etat_processus)
                   3139:                                        .l_base_pile;
                   3140: 
                   3141:                                for(i = 0; i < (*s_etat_processus)
                   3142:                                        .hauteur_pile_operationnelle; i++)
                   3143:                                {
                   3144:                                    if (l_element_courant != NULL)
                   3145:                                    {
                   3146:                                        (*resultats)[i] =
                   3147:                                                formateur(s_etat_processus,
                   3148:                                                0, (*((struct_liste_chainee *)
                   3149:                                                l_element_courant)).donnee);
                   3150: 
                   3151:                                        if ((*resultats)[i] == NULL)
                   3152:                                        {
                   3153:                                            i = (*s_etat_processus).
                   3154:                                                    hauteur_pile_operationnelle;
                   3155:                                        }
                   3156:                                        else
                   3157:                                        {
                   3158:                                            l_element_suivant =
                   3159:                                                    (*((struct_liste_chainee *)
                   3160:                                                    l_element_courant)).suivant;
                   3161:                                        }
                   3162:                                    }
                   3163:                                }
                   3164:                            }
                   3165:                            else
                   3166:                            {
                   3167:                                (*resultats) = NULL;
                   3168:                                erreur = d_es_allocation_memoire;
                   3169:                            }
                   3170:                        }
                   3171:                    }
                   3172: 
                   3173:                    l_element_courant = (void *) (*s_etat_processus)
                   3174:                            .l_base_pile;
                   3175:                    while(l_element_courant != NULL)
                   3176:                    {
                   3177:                        l_element_suivant = (*((struct_liste_chainee *)
                   3178:                                l_element_courant)).suivant;
                   3179: 
                   3180:                        liberation(s_etat_processus,
                   3181:                                (*((struct_liste_chainee *)
                   3182:                                l_element_courant)).donnee);
                   3183:                        free((struct_liste_chainee *) l_element_courant);
                   3184: 
                   3185:                        l_element_courant = l_element_suivant;
                   3186:                    }
                   3187: 
                   3188:                    l_element_courant = (void *) (*s_etat_processus)
                   3189:                            .l_base_pile_contextes;
                   3190:                    while(l_element_courant != NULL)
                   3191:                    {
                   3192:                        l_element_suivant = (*((struct_liste_chainee *)
                   3193:                                l_element_courant)).suivant;
                   3194: 
                   3195:                        liberation(s_etat_processus,
                   3196:                                (*((struct_liste_chainee *)
                   3197:                                l_element_courant)).donnee);
                   3198:                        free((struct_liste_chainee *) l_element_courant);
                   3199: 
                   3200:                        l_element_courant = l_element_suivant;
                   3201:                    }
                   3202: 
                   3203:                    l_element_courant = (void *) (*s_etat_processus)
                   3204:                            .l_base_pile_taille_contextes;
                   3205:                    while(l_element_courant != NULL)
                   3206:                    {
                   3207:                        l_element_suivant = (*((struct_liste_chainee *)
                   3208:                                l_element_courant)).suivant;
                   3209: 
                   3210:                        liberation(s_etat_processus,
                   3211:                                (*((struct_liste_chainee *)
                   3212:                                l_element_courant)).donnee);
                   3213:                        free((struct_liste_chainee *) l_element_courant);
                   3214: 
                   3215:                        l_element_courant = l_element_suivant;
                   3216:                    }
                   3217: 
                   3218:                    for(i = 0; i < (*s_etat_processus)
                   3219:                            .nombre_instructions_externes; i++)
                   3220:                    {
                   3221:                        free((*s_etat_processus).s_instructions_externes[i]
                   3222:                                .nom);
                   3223:                        free((*s_etat_processus).s_instructions_externes[i]
                   3224:                                .nom_bibliotheque);
                   3225:                    }
                   3226: 
                   3227:                    if ((*s_etat_processus).nombre_instructions_externes != 0)
                   3228:                    {
                   3229:                        free((*s_etat_processus).s_instructions_externes);
                   3230:                    }
                   3231: 
                   3232:                    l_element_courant = (void *) (*s_etat_processus)
                   3233:                            .s_bibliotheques;
                   3234:                    
                   3235:                    while(l_element_courant != NULL)
                   3236:                    {
                   3237:                        l_element_suivant = (*((struct_liste_chainee *)
                   3238:                                l_element_courant)).suivant;
                   3239: 
                   3240:                        free((*((struct_bibliotheque *)
                   3241:                                (*((struct_liste_chainee *)
                   3242:                                l_element_courant)).donnee)).nom);
                   3243:                        dlclose((*((struct_bibliotheque *)
                   3244:                                (*((struct_liste_chainee *)
                   3245:                                l_element_courant)).donnee)).descripteur);
                   3246:                        free((*((struct_liste_chainee *) l_element_courant))
                   3247:                                .donnee);
                   3248:                        free(l_element_courant);
                   3249: 
                   3250:                        l_element_courant = l_element_suivant;
                   3251:                    }
                   3252: 
                   3253:                    l_element_courant = (void *) (*s_etat_processus)
                   3254:                            .l_base_pile_last;
                   3255:                    while(l_element_courant != NULL)
                   3256:                    {
                   3257:                        l_element_suivant = (*((struct_liste_chainee *)
                   3258:                                l_element_courant)).suivant;
                   3259: 
                   3260:                        liberation(s_etat_processus,
                   3261:                                (*((struct_liste_chainee *)
                   3262:                                l_element_courant)).donnee);
                   3263:                        free((struct_liste_chainee *) l_element_courant);
                   3264: 
                   3265:                        l_element_courant = l_element_suivant;
                   3266:                    }
                   3267: 
                   3268:                    l_element_courant = (void *) (*s_etat_processus)
                   3269:                            .l_base_pile_systeme;
                   3270:                    while(l_element_courant != NULL)
                   3271:                    {
                   3272:                        l_element_suivant = (*((struct_liste_pile_systeme *)
                   3273:                                l_element_courant)).suivant;
                   3274: 
                   3275:                        liberation(s_etat_processus,
                   3276:                                (*((struct_liste_pile_systeme *)
                   3277:                                l_element_courant)).indice_boucle);
                   3278:                        liberation(s_etat_processus,
                   3279:                                (*((struct_liste_pile_systeme *)
                   3280:                                l_element_courant)).limite_indice_boucle);
                   3281:                        liberation(s_etat_processus,
                   3282:                                (*((struct_liste_pile_systeme *)
                   3283:                                l_element_courant)).objet_de_test);
                   3284: 
                   3285:                        if ((*((struct_liste_pile_systeme *)
                   3286:                                l_element_courant)).nom_variable != NULL)
                   3287:                        {
                   3288:                            free((*((struct_liste_pile_systeme *)
                   3289:                                    l_element_courant)).nom_variable);
                   3290:                        }
                   3291: 
                   3292:                        free((struct_liste_pile_systeme *)
                   3293:                                l_element_courant);
                   3294: 
                   3295:                        l_element_courant = l_element_suivant;
                   3296:                    }
                   3297: 
                   3298:                    l_element_courant = (void *)
                   3299:                            (*s_etat_processus).s_fichiers;
                   3300:                    while(l_element_courant != NULL)
                   3301:                    {
                   3302:                        l_element_suivant = (*((struct_liste_chainee *)
                   3303:                                l_element_courant)).suivant;
                   3304: 
                   3305:                        fclose((*((struct_descripteur_fichier *)
                   3306:                                (*((struct_liste_chainee *)
                   3307:                                l_element_courant)).donnee))
1.12      bertrand 3308:                                .descripteur_c);
                   3309: 
                   3310:                        if ((*((struct_descripteur_fichier *)
                   3311:                                (*((struct_liste_chainee *)
                   3312:                                l_element_courant)).donnee)).type != 'C')
                   3313:                        {
                   3314:                            sqlite3_close((*((struct_descripteur_fichier *)
                   3315:                                    (*((struct_liste_chainee *)
                   3316:                                    l_element_courant)).donnee))
                   3317:                                    .descripteur_sqlite);
                   3318:                        }
1.1       bertrand 3319: 
                   3320:                        if ((*((struct_descripteur_fichier *)
                   3321:                                (*((struct_liste_chainee *)
                   3322:                                l_element_courant)).donnee))
                   3323:                                .effacement == 'Y')
                   3324:                        {
                   3325:                            unlink((*((struct_descripteur_fichier *)
                   3326:                                    (*((struct_liste_chainee *)
                   3327:                                    l_element_courant)).donnee))
                   3328:                                    .nom);
                   3329:                        }
                   3330: 
                   3331:                        free((*((struct_descripteur_fichier *)
                   3332:                                (*((struct_liste_chainee *)
                   3333:                                l_element_courant)).donnee)).nom);
                   3334:                        free((struct_descripteur_fichier *)
                   3335:                                (*((struct_liste_chainee *)
                   3336:                                l_element_courant)).donnee);
                   3337:                        free(l_element_courant);
                   3338: 
                   3339:                        l_element_courant = l_element_suivant;
                   3340:                    }
                   3341: 
                   3342:                    l_element_courant = (void *)
                   3343:                            (*s_etat_processus).s_sockets;
                   3344:                    while(l_element_courant != NULL)
                   3345:                    {
                   3346:                        l_element_suivant = (*((struct_liste_chainee *)
                   3347:                                l_element_courant)).suivant;
                   3348: 
                   3349:                        if ((*((struct_socket *)
                   3350:                                (*(*((struct_liste_chainee *)
                   3351:                                l_element_courant)).donnee).objet))
                   3352:                                .socket_connectee == d_vrai)
                   3353:                        {
                   3354:                            shutdown((*((struct_socket *)
                   3355:                                    (*(*((struct_liste_chainee *)
                   3356:                                    l_element_courant)).donnee).objet))
                   3357:                                    .socket, SHUT_RDWR);
                   3358:                        }
                   3359: 
                   3360:                        close((*((struct_socket *)
                   3361:                                (*(*((struct_liste_chainee *)
                   3362:                                l_element_courant)).donnee).objet)).socket);
                   3363: 
                   3364:                        if ((*((struct_socket *) (*(*((struct_liste_chainee *)
                   3365:                                l_element_courant)).donnee).objet)).effacement
                   3366:                                == 'Y')
                   3367:                        {
                   3368:                            unlink((*((struct_socket *)
                   3369:                                    (*(*((struct_liste_chainee *)
                   3370:                                    l_element_courant)).donnee).objet))
                   3371:                                    .adresse);
                   3372:                        }
                   3373: 
                   3374:                        liberation(s_etat_processus,
                   3375:                                (*((struct_liste_chainee *)
                   3376:                                l_element_courant)).donnee);
                   3377:                        free(l_element_courant);
                   3378: 
                   3379:                        l_element_courant = l_element_suivant;
                   3380:                    }
                   3381: 
                   3382:                    l_element_courant = (void *)
                   3383:                            (*s_etat_processus).s_connecteurs_sql;
                   3384:                    while(l_element_courant != NULL)
                   3385:                    {
                   3386:                        l_element_suivant = (*((struct_liste_chainee *)
                   3387:                                l_element_courant)).suivant;
                   3388: 
                   3389:                        sqlclose((*((struct_liste_chainee *)
                   3390:                                l_element_courant)).donnee);
                   3391:                        liberation(s_etat_processus,
                   3392:                                (*((struct_liste_chainee *)
                   3393:                                l_element_courant)).donnee);
                   3394:                        free(l_element_courant);
                   3395: 
                   3396:                        l_element_courant = l_element_suivant;
                   3397:                    }
                   3398: 
                   3399:                    free((*s_etat_processus).chemin_fichiers_temporaires);
                   3400: 
                   3401:                    l_element_courant = (*s_etat_processus).s_marques;
                   3402:                    while(l_element_courant != NULL)
                   3403:                    {
                   3404:                        free((*((struct_marque *) l_element_courant)).label);
                   3405:                        free((*((struct_marque *) l_element_courant)).position);
                   3406:                        l_element_suivant = (*((struct_marque *)
                   3407:                                l_element_courant)).suivant;
                   3408:                        free(l_element_courant);
                   3409:                        l_element_courant = l_element_suivant;
                   3410:                    }
                   3411:                }
                   3412:                else
                   3413:                {
                   3414:                    erreur = d_es_allocation_memoire;
                   3415: 
                   3416:                    if (test_cfsf(s_etat_processus, 51) == d_faux)
                   3417:                    {
                   3418:                        printf("%s", ds_beep);
                   3419:                    }
                   3420: 
                   3421:                    if ((*s_etat_processus).langue == 'F')
                   3422:                    {
                   3423:                        printf("+++Système : Mémoire insuffisante\n");
                   3424:                    }
                   3425:                    else
                   3426:                    {
                   3427:                        printf("+++System : Not enough memory\n");
                   3428:                    }
                   3429:                }
                   3430:            }
                   3431: 
                   3432:            liberation_allocateur(s_etat_processus);
                   3433:        }
                   3434: 
                   3435:        if (traitement_fichier_temporaire == 'Y')
                   3436:        {
                   3437:            if (destruction_fichier(nom_fichier_temporaire) == d_erreur)
                   3438:            {
                   3439:                return(EXIT_FAILURE);
                   3440:            }
                   3441: 
                   3442:            free(nom_fichier_temporaire);
                   3443:        }
                   3444: 
                   3445:        if ((*s_etat_processus).profilage == d_vrai)
                   3446:        {
                   3447:            ecriture_profil(s_etat_processus);
                   3448:            liberation_profil(s_etat_processus);
                   3449:        }
                   3450:    }
                   3451: 
1.9       bertrand 3452: #  ifndef Cygwin
1.1       bertrand 3453:    free((*s_etat_processus).pile_signal.ss_sp);
1.9       bertrand 3454: #  endif
                   3455: 
1.1       bertrand 3456:    closelog();
                   3457: 
                   3458:    pthread_mutex_destroy(&((*s_etat_processus).protection_liste_mutexes));
                   3459:    pthread_mutex_destroy(&((*((*s_etat_processus).s_liste_variables_partagees))
                   3460:            .mutex));
                   3461: 
                   3462:    retrait_thread(s_etat_processus);
                   3463: 
                   3464:    pthread_mutex_destroy(&((*s_etat_processus).mutex));
1.17      bertrand 3465: #  ifndef SEMAPHORES_NOMMES
1.1       bertrand 3466:    sem_post(&((*s_etat_processus).semaphore_fork));
                   3467:    sem_destroy(&((*s_etat_processus).semaphore_fork));
1.17      bertrand 3468: #  else
                   3469:    sem_post((*s_etat_processus).semaphore_fork);
                   3470:    sem_destroy2((*s_etat_processus).semaphore_fork, sem_fork);
                   3471: #  endif
1.1       bertrand 3472: 
                   3473:    free((*s_etat_processus).localisation);
                   3474: 
1.17      bertrand 3475: #  ifndef SEMAPHORES_NOMMES
1.1       bertrand 3476:    sem_destroy(&semaphore_liste_threads);
1.17      bertrand 3477: #  else
                   3478:    sem_destroy2(semaphore_liste_threads, sem_liste_threads);
                   3479: #  endif
                   3480: #  ifndef SEMAPHORES_NOMMES
1.1       bertrand 3481:    sem_post(&semaphore_gestionnaires_signaux);
                   3482:    sem_destroy(&semaphore_gestionnaires_signaux);
                   3483:    sem_destroy(&semaphore_gestionnaires_signaux_atomique);
1.17      bertrand 3484: #  else
                   3485:    sem_post(semaphore_gestionnaires_signaux);
                   3486:    sem_destroy2(semaphore_gestionnaires_signaux, sem_gestionnaires_signaux);
                   3487:    sem_destroy2(semaphore_gestionnaires_signaux_atomique,
                   3488:            sem_gestionnaires_signaux_atomique);
                   3489: #  endif
1.1       bertrand 3490: 
1.24    ! bertrand 3491:    free(s_etat_processus);
        !          3492: 
1.8       bertrand 3493: #  ifdef DEBUG_MEMOIRE
1.24    ! bertrand 3494:    debug_memoire_verification();
        !          3495:    analyse_post_mortem();
1.8       bertrand 3496: #  endif
                   3497: 
1.13      bertrand 3498:    return((erreur == d_absence_erreur) ? EXIT_SUCCESS : EXIT_FAILURE);
1.1       bertrand 3499: }
                   3500: 
                   3501: 
                   3502: void
                   3503: informations(struct_processus *s_etat_processus)
                   3504: {
                   3505:    printf("\n");
                   3506: 
                   3507:    if ((*s_etat_processus).langue == 'F')
                   3508:    {
                   3509:        printf("  rpl [-options] [programme]\n");
1.13      bertrand 3510:        printf("      -a : analyse du code\n");
1.1       bertrand 3511:        printf("      -A : paramètres passés au programme principal\n");
                   3512:        printf("      -c : génération de fichier de débogage (rpl-core)\n");
                   3513:        printf("      -d : option de déverminage interne\n");
                   3514:        printf("      -D : lancement d'un daemon\n");
                   3515:        printf("      -h : aide sur la ligne de commande\n");
                   3516:        printf("      -i : fonctionnement interactif\n");
                   3517:        printf("      -l : licence d'utilisation\n");
                   3518:        printf("      -n : ignorance du signal HUP\n");
                   3519:        printf("      -p : précompilation du script avant exécution\n");
                   3520:        printf("      -P : profilage\n");
                   3521:        printf("      -s : empêchement de l'ouverture de l'écran initial\n");
                   3522:        printf("      -S : exécution du script passé en ligne de commande\n");
                   3523:        printf("      -t : trace\n");
                   3524:        printf("      -v : version\n");
                   3525:    }
                   3526:    else
                   3527:    {
                   3528:        printf("  rpl [-options] [program]\n");
1.13      bertrand 3529:        printf("      -a : analyzes program\n");
1.1       bertrand 3530:        printf("      -A : sends parameters to main program\n");
                   3531:        printf("      -c : allows creation of a rpl-core file, providing a way"
                   3532:                "\n"
                   3533:                "           to debug a program\n");
                   3534:        printf("      -d : internal debug process\n");
                   3535:        printf("      -D : starts in daemon mode\n");
                   3536:        printf("      -h : shows a summary of available options\n");
                   3537:        printf("      -i : runs the RPL/2 sequencer in interactive mode\n");
                   3538:        printf("      -l : prints the user licence of the software\n");
                   3539:        printf("      -n : ignores HUP signal\n");
                   3540:        printf("      -p : precompiles script\n");
                   3541:        printf("      -P : computes profile data\n");
                   3542:        printf("      -s : disables splash screen\n");
                   3543:        printf("      -S : executes script written in command line\n");
                   3544:        printf("      -t : enables tracing mode\n");
                   3545:        printf("      -v : prints the version number\n");
                   3546:    }
                   3547: 
                   3548:    printf("\n");
                   3549: 
                   3550:    return;
                   3551: }
                   3552: 
                   3553: // vim: ts=4

CVSweb interface <joel.bertrand@systella.fr>