File:  [local] / rpl / src / rpl.c
Revision 1.78: download - view: text, annotated - select for diffs - revision graph
Tue Aug 30 14:19:28 2011 UTC (12 years, 8 months ago) by bertrand
Branches: MAIN
CVS tags: HEAD
Aïe... Crash des disques sur la machine de développement !... Commit d'urgence !

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

CVSweb interface <joel.bertrand@systella.fr>