File:  [local] / rpl / src / rpl.c
Revision 1.101: download - view: text, annotated - select for diffs - revision graph
Wed Nov 30 09:28:38 2011 UTC (12 years, 5 months ago) by bertrand
Branches: MAIN
CVS tags: HEAD
Ajout de l'argument *envp[] dans main().

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

CVSweb interface <joel.bertrand@systella.fr>