File:  [local] / rpl / src / rpl.c
Revision 1.55: download - view: text, annotated - select for diffs - revision graph
Tue Dec 14 15:46:24 2010 UTC (13 years, 4 months ago) by bertrand
Branches: MAIN
CVS tags: HEAD
Correction de la destruction des piles alternatives.

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

CVSweb interface <joel.bertrand@systella.fr>