File:  [local] / rpl / src / rpl.c
Revision 1.45: download - view: text, annotated - select for diffs - revision graph
Mon Aug 30 14:14:07 2010 UTC (13 years, 8 months ago) by bertrand
Branches: MAIN
CVS tags: HEAD
Correction d'un problème entre le processus d'injection de données et
l'instruction NRPROC.

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

CVSweb interface <joel.bertrand@systella.fr>