File:  [local] / rpl / src / rpl.c
Revision 1.84: download - view: text, annotated - select for diffs - revision graph
Wed Sep 14 17:56:00 2011 UTC (12 years, 7 months ago) by bertrand
Branches: MAIN
CVS tags: HEAD
Suite des patches...

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

CVSweb interface <joel.bertrand@systella.fr>