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

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

CVSweb interface <joel.bertrand@systella.fr>