File:  [local] / rpl / src / rpl.c
Revision 1.49: download - view: text, annotated - select for diffs - revision graph
Mon Sep 6 16:50:17 2010 UTC (13 years, 8 months ago) by bertrand
Branches: MAIN
CVS tags: rpl-4_0_19, HEAD
Patches pour ne pas utiliser les IPCS SystemV qui sont bugguées jusqu'à la
moëlle sous OS/2.

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

CVSweb interface <joel.bertrand@systella.fr>