File:  [local] / rpl / src / rpl.c
Revision 1.97: download - view: text, annotated - select for diffs - revision graph
Thu Nov 24 14:24:49 2011 UTC (12 years, 5 months ago) by bertrand
Branches: MAIN
CVS tags: HEAD
Ajout d'un #ifdef

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

CVSweb interface <joel.bertrand@systella.fr>