File:  [local] / rpl / src / rpl.c
Revision 1.16: download - view: text, annotated - select for diffs - revision graph
Wed Apr 7 13:45:10 2010 UTC (14 years, 1 month ago) by bertrand
Branches: MAIN
CVS tags: HEAD
En route pour la 4.0.14 !

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

CVSweb interface <joel.bertrand@systella.fr>