File:  [local] / rpl / src / rpl.c
Revision 1.87: download - view: text, annotated - select for diffs - revision graph
Sun Sep 18 12:42:50 2011 UTC (12 years, 7 months ago) by bertrand
Branches: MAIN
CVS tags: HEAD
Première série de patches pour porter la nouvelle gestion des signaux sous
MacOS X. La compilation se déroule bien, mais une opération de l'émulation
de sem_getvalue() n'est pas atomique et peut aboutir à une condition
bloquante.

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

CVSweb interface <joel.bertrand@systella.fr>