File:  [local] / rpl / src / rpl.c
Revision 1.102: download - view: text, annotated - select for diffs - revision graph
Wed Nov 30 12:15:18 2011 UTC (12 years, 5 months ago) by bertrand
Branches: MAIN
CVS tags: HEAD
Correction d'une régression.

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

CVSweb interface <joel.bertrand@systella.fr>