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

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

CVSweb interface <joel.bertrand@systella.fr>