File:  [local] / rpl / src / rpl.c
Revision 1.58.2.2: download - view: text, annotated - select for diffs - revision graph
Thu Apr 14 08:24:13 2011 UTC (13 years ago) by bertrand
Branches: rpl-4_0
CVS tags: rpl-4_0_22
Diff to: branchpoint 1.58: preferred, colored
Modification de la valeur par défaut de IMPLICIT. NONE dans le cas
d'exécution de programmes, ALL dans le cas interactif.

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

CVSweb interface <joel.bertrand@systella.fr>