File:  [local] / rpl / src / instructions_s9.c
Revision 1.15: download - view: text, annotated - select for diffs - revision graph
Sat Jul 24 18:01:12 2010 UTC (13 years, 9 months ago) by bertrand
Branches: MAIN
CVS tags: HEAD
Correction d'un problème de création des variables globales. Lorsqu'une
variable locale de même nom préexistait, la variable globale n'était pas
créée à la bonne adresse.

    1: /*
    2: ================================================================================
    3:   RPL/2 (R) version 4.0.18
    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: #include "rpl.conv.h"
   24: 
   25: 
   26: /*
   27: ================================================================================
   28:   Fonction 'sort'
   29: ================================================================================
   30:   Entrées :
   31: --------------------------------------------------------------------------------
   32:   Sorties :
   33: --------------------------------------------------------------------------------
   34:   Effets de bord : néant
   35: ================================================================================
   36: */
   37: 
   38: void
   39: instruction_sort(struct_processus *s_etat_processus)
   40: {
   41:     integer8                    i;
   42:     integer8                    j;
   43:     integer8                    nombre_elements;
   44: 
   45:     logical1                    condition;
   46:     logical1                    inversion;
   47:     logical1                    presence_nom;
   48:     logical1                    terminaison_boucle_1;
   49:     logical1                    terminaison_boucle_2;
   50:     logical1                    terminaison_boucle_3;
   51:     logical1                    variable_partagee;
   52: 
   53:     struct_liste_chainee        *l_element_courant;
   54:     struct_liste_chainee        *l_element_precedent;
   55:     struct_liste_chainee        *l_element_tampon;
   56: 
   57:     struct_objet                *s_objet_copie;
   58:     struct_objet                *s_objet_critere;
   59:     struct_objet                *s_objet_liste;
   60:     struct_objet                *s_objet_test;
   61: 
   62:     signed long                 indice_i;
   63:     signed long                 indice_j;
   64:     signed long                 indice_k;
   65:     signed long                 indice_l;
   66: 
   67:     unsigned long               ecartement;
   68: 
   69:     (*s_etat_processus).erreur_execution = d_ex;
   70: 
   71:     if ((*s_etat_processus).affichage_arguments == 'Y')
   72:     {
   73:         printf("\n  SORT ");
   74: 
   75:         if ((*s_etat_processus).langue == 'F')
   76:         {
   77:             printf("(trie une liste selon un critère paramétrable)\n\n");
   78:         }
   79:         else
   80:         {
   81:             printf("(sort a list)\n\n");
   82:         }
   83: 
   84:         printf("    2: %s\n", d_LST);
   85:         printf("    1: %s\n", d_RPN);
   86:         printf("->  1: %s\n\n", d_LST);
   87: 
   88:         printf("    2: %s\n", d_TAB);
   89:         printf("    1: %s\n", d_RPN);
   90:         printf("->  1: %s\n\n", d_LST);
   91: 
   92:         printf("    2: %s\n", d_NOM);
   93:         printf("    1: %s\n", d_RPN);
   94: 
   95:         return;
   96:     }
   97:     else if ((*s_etat_processus).test_instruction == 'Y')
   98:     {
   99:         (*s_etat_processus).nombre_arguments = -1;
  100:         return;
  101:     }
  102:     
  103:     if (test_cfsf(s_etat_processus, 31) == d_vrai)
  104:     {
  105:         if (empilement_pile_last(s_etat_processus, 2) == d_erreur)
  106:         {
  107:             return;
  108:         }
  109:     }
  110: 
  111:     if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
  112:             &s_objet_critere) == d_erreur)
  113:     {
  114:         (*s_etat_processus).erreur_execution = d_ex_manque_argument;
  115:         return;
  116:     }
  117: 
  118:     if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
  119:             &s_objet_liste) == d_erreur)
  120:     {
  121:         liberation(s_etat_processus, s_objet_critere);
  122: 
  123:         (*s_etat_processus).erreur_execution = d_ex_manque_argument;
  124:         return;
  125:     }
  126: 
  127:     variable_partagee = d_faux;
  128: 
  129:     if ((*s_objet_liste).type == NOM)
  130:     {
  131:         if (recherche_variable(s_etat_processus, (*((struct_nom *)
  132:                 (*s_objet_liste).objet)).nom) == d_faux)
  133:         {
  134:             (*s_etat_processus).erreur_systeme = d_es;
  135:             (*s_etat_processus).erreur_execution = d_ex_variable_non_definie;
  136: 
  137:             liberation(s_etat_processus, s_objet_critere);
  138:             liberation(s_etat_processus, s_objet_liste);
  139: 
  140:             return;
  141:         }
  142: 
  143:         if ((*s_etat_processus).s_liste_variables[(*s_etat_processus)
  144:                 .position_variable_courante].variable_verrouillee == d_vrai)
  145:         {
  146:             (*s_etat_processus).erreur_execution = d_ex_variable_verrouillee;
  147: 
  148:             liberation(s_etat_processus, s_objet_critere);
  149:             liberation(s_etat_processus, s_objet_liste);
  150: 
  151:             return;
  152:         }
  153: 
  154:         if ((*s_etat_processus).s_liste_variables[(*s_etat_processus)
  155:                 .position_variable_courante].objet == NULL)
  156:         {
  157:             if (pthread_mutex_lock(&((*(*s_etat_processus)
  158:                     .s_liste_variables_partagees).mutex)) != 0)
  159:             {
  160:                 (*s_etat_processus).erreur_systeme = d_es_processus;
  161:                 return;
  162:             }
  163: 
  164:             if (recherche_variable_partagee(s_etat_processus,
  165:                     (*s_etat_processus).s_liste_variables
  166:                     [(*s_etat_processus).position_variable_courante].nom,
  167:                     (*s_etat_processus).s_liste_variables
  168:                     [(*s_etat_processus).position_variable_courante]
  169:                     .variable_partagee, (*s_etat_processus).s_liste_variables
  170:                     [(*s_etat_processus).position_variable_courante].origine)
  171:                     == d_faux)
  172:             {
  173:                 if (pthread_mutex_unlock(&((*(*s_etat_processus)
  174:                         .s_liste_variables_partagees).mutex)) != 0)
  175:                 {
  176:                     (*s_etat_processus).erreur_systeme = d_es_processus;
  177:                     return;
  178:                 }
  179: 
  180:                 (*s_etat_processus).erreur_execution =
  181:                         d_ex_erreur_type_argument;
  182: 
  183:                 liberation(s_etat_processus, s_objet_critere);
  184:                 liberation(s_etat_processus, s_objet_liste);
  185: 
  186:                 return;
  187:             }
  188: 
  189:             if (((*(*(*s_etat_processus).s_liste_variables_partagees)
  190:                     .table[(*(*s_etat_processus).s_liste_variables_partagees)
  191:                     .position_variable].objet).type != LST) &&
  192:                     ((*(*(*s_etat_processus).s_liste_variables_partagees)
  193:                     .table[(*(*s_etat_processus).s_liste_variables_partagees)
  194:                     .position_variable].objet).type != TBL))
  195:             {
  196:                 if (pthread_mutex_unlock(&((*(*s_etat_processus)
  197:                         .s_liste_variables_partagees).mutex)) != 0)
  198:                 {
  199:                     (*s_etat_processus).erreur_systeme = d_es_processus;
  200:                     return;
  201:                 }
  202: 
  203:                 (*s_etat_processus).erreur_execution =
  204:                         d_ex_erreur_type_argument;
  205: 
  206:                 liberation(s_etat_processus, s_objet_critere);
  207:                 liberation(s_etat_processus, s_objet_liste);
  208: 
  209:                 return;
  210:             }
  211: 
  212:             liberation(s_etat_processus, s_objet_liste);
  213: 
  214:             s_objet_liste = (*(*s_etat_processus).s_liste_variables_partagees)
  215:                     .table[(*(*s_etat_processus).s_liste_variables_partagees)
  216:                     .position_variable].objet;
  217: 
  218:             if ((s_objet_copie = copie_objet(s_etat_processus, s_objet_liste,
  219:                     'N')) == NULL)
  220:             {
  221:                 if (pthread_mutex_unlock(&((*(*s_etat_processus)
  222:                         .s_liste_variables_partagees).mutex)) != 0)
  223:                 {
  224:                     (*s_etat_processus).erreur_systeme = d_es_processus;
  225:                     return;
  226:                 }
  227: 
  228:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
  229:                 return;
  230:             }
  231: 
  232:             variable_partagee = d_vrai;
  233:         }
  234:         else
  235:         {
  236:             if (((*(*s_etat_processus).s_liste_variables
  237:                     [(*s_etat_processus).position_variable_courante].objet)
  238:                     .type != LST) &&
  239:                     ((*(*s_etat_processus).s_liste_variables
  240:                     [(*s_etat_processus).position_variable_courante].objet)
  241:                     .type != TBL))
  242:             {
  243:                 (*s_etat_processus).erreur_execution =
  244:                         d_ex_erreur_type_argument;
  245: 
  246:                 liberation(s_etat_processus, s_objet_critere);
  247:                 liberation(s_etat_processus, s_objet_liste);
  248: 
  249:                 return;
  250:             }
  251: 
  252:             liberation(s_etat_processus, s_objet_liste);
  253: 
  254:             s_objet_liste = (*s_etat_processus).s_liste_variables
  255:                     [(*s_etat_processus).position_variable_courante].objet;
  256: 
  257:             if ((s_objet_copie = copie_objet(s_etat_processus, s_objet_liste,
  258:                     'N')) == NULL)
  259:             {
  260:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
  261:                 return;
  262:             }
  263:         }
  264: 
  265:         liberation(s_etat_processus, s_objet_liste);
  266:         s_objet_liste = s_objet_copie;
  267: 
  268:         (*s_etat_processus).s_liste_variables[(*s_etat_processus)
  269:                 .position_variable_courante].objet = s_objet_liste;
  270: 
  271:         presence_nom = d_vrai;
  272:     }
  273:     else
  274:     {
  275:         if ((s_objet_copie = copie_objet(s_etat_processus, s_objet_liste, 'N'))
  276:                 == NULL)
  277:         {
  278:             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
  279:             return;
  280:         }
  281: 
  282:         liberation(s_etat_processus, s_objet_liste);
  283:         s_objet_liste = s_objet_copie;
  284:         presence_nom = d_faux;
  285:     }
  286: 
  287:     if (((*s_objet_liste).type == LST) &&
  288:             ((*s_objet_critere).type == RPN))
  289:     {
  290:         /*
  291:          * Tri bulle de la liste chaînée. On se contente d'un tri bulle
  292:          * car on travaille sur une liste chaînée et non sur un tableau
  293:          * sur lequel on pourrait accéder directement aux données grâce à
  294:          * leur indice.
  295:          */
  296: 
  297:         nombre_elements = 0;
  298:         l_element_courant = (*s_objet_liste).objet;
  299: 
  300:         while(l_element_courant != NULL)
  301:         {
  302:             l_element_courant = (*l_element_courant).suivant;
  303:             nombre_elements++;
  304:         }
  305: 
  306:         // Si la liste est vide, on considère qu'elle est triée.
  307:         // De la même manière, on considère qu'une liste d'un
  308:         // seul élément est toujours triée.
  309: 
  310:         if (nombre_elements > 1)
  311:         {
  312:             j = nombre_elements;
  313: 
  314:             do
  315:             {
  316:                 inversion = d_faux;
  317: 
  318:                 l_element_courant = (*s_objet_liste).objet;
  319:                 l_element_precedent = NULL;
  320: 
  321:                 for(i = 0; i < j - 1; i++)
  322:                 {
  323:                     // Test des éléments adjacents. Pour cela, on
  324:                     // empile les deux éléments adjacents dans la pile dans
  325:                     // l'ordre [i] [i+1] et on évalue le critère d'ordre.
  326: 
  327:                     if ((s_objet_copie = copie_objet(s_etat_processus,
  328:                             (*l_element_courant).donnee, 'P')) == NULL)
  329:                     {
  330:                         (*s_etat_processus).erreur_systeme =
  331:                                 d_es_allocation_memoire;
  332:                         return;
  333:                     }
  334: 
  335:                     if (empilement(s_etat_processus,
  336:                             &((*s_etat_processus).l_base_pile),
  337:                             s_objet_copie) == d_erreur)
  338:                     {
  339:                         return;
  340:                     }
  341: 
  342:                     if ((s_objet_copie = copie_objet(s_etat_processus,
  343:                             (*(*l_element_courant)
  344:                             .suivant).donnee, 'P')) == NULL)
  345:                     {
  346:                         (*s_etat_processus).erreur_systeme =
  347:                                 d_es_allocation_memoire;
  348:                         return;
  349:                     }
  350: 
  351:                     if (empilement(s_etat_processus,
  352:                             &((*s_etat_processus).l_base_pile),
  353:                             s_objet_copie) == d_erreur)
  354:                     {
  355:                         return;
  356:                     }
  357: 
  358:                     if (evaluation(s_etat_processus, s_objet_critere, 'N')
  359:                             == d_erreur)
  360:                     {
  361:                         liberation(s_etat_processus, s_objet_critere);
  362:                         liberation(s_etat_processus, s_objet_liste);
  363: 
  364:                         return;
  365:                     }
  366: 
  367:                     if (depilement(s_etat_processus,
  368:                             &((*s_etat_processus).l_base_pile), &s_objet_test)
  369:                             == d_erreur)
  370:                     {
  371:                         liberation(s_etat_processus, s_objet_critere);
  372:                         liberation(s_etat_processus, s_objet_liste);
  373: 
  374:                         (*s_etat_processus).erreur_execution =
  375:                                 d_ex_manque_argument;
  376:                         return;
  377:                     }
  378: 
  379:                     if ((*s_objet_test).type == INT)
  380:                     {
  381:                         condition = ((*((integer8 *) (*s_objet_test).objet))
  382:                                 == 0) ? d_faux : d_vrai;
  383:                     }
  384:                     else if ((*s_objet_test).type == REL)
  385:                     {
  386:                         condition = ((*((real8 *) (*s_objet_test).objet))
  387:                                 == 0) ? d_faux : d_vrai;
  388:                     }
  389:                     else
  390:                     {
  391:                         liberation(s_etat_processus, s_objet_critere);
  392:                         liberation(s_etat_processus, s_objet_liste);
  393:                         liberation(s_etat_processus, s_objet_test);
  394: 
  395:                         (*s_etat_processus).erreur_execution =
  396:                                 d_ex_erreur_type_argument;
  397:                         return;
  398:                     }
  399: 
  400:                     liberation(s_etat_processus, s_objet_test);
  401: 
  402:                     if (condition == d_faux)
  403:                     {
  404:                         // On échange les deux éléments adjacents
  405: 
  406:                         inversion = d_vrai;
  407: 
  408:                         if (l_element_precedent == NULL)
  409:                         {
  410:                             // Échange des deux premiers éléments
  411:                             // de la liste.
  412: 
  413:                             l_element_tampon = (*(*l_element_courant)
  414:                                     .suivant).suivant;
  415:                             (*s_objet_liste).objet = (*l_element_courant)
  416:                                     .suivant;
  417:                             (*((struct_liste_chainee *) (*s_objet_liste)
  418:                                     .objet)).suivant = l_element_courant;
  419:                             (*l_element_courant).suivant =
  420:                                     l_element_tampon;
  421:                             l_element_courant = (*s_objet_liste).objet;
  422:                         }
  423:                         else
  424:                         {
  425:                             // Échange de deux éléments quelconques de la
  426:                             // liste.
  427: 
  428:                             l_element_tampon = (*l_element_courant).suivant;
  429:                             (*l_element_courant).suivant =
  430:                                     (*(*l_element_courant).suivant).suivant;
  431:                             (*l_element_precedent).suivant = l_element_tampon;
  432:                             (*l_element_tampon).suivant = l_element_courant;
  433: 
  434:                             l_element_courant = l_element_tampon;
  435:                         }
  436:                     }
  437: 
  438:                     l_element_precedent = l_element_courant;
  439:                     l_element_courant = (*l_element_courant).suivant;
  440:                 }
  441: 
  442:                 j--;
  443:             } while(inversion != d_faux);
  444:         }
  445:     }
  446:     else if (((*s_objet_liste).type == TBL) &&
  447:             ((*s_objet_critere).type == RPN))
  448:     {
  449:         /*
  450:          * Tri Shell-Metzner d'une table
  451:          */
  452: 
  453:         ecartement = (*((struct_tableau *) (*s_objet_liste).objet))
  454:                 .nombre_elements;
  455:         terminaison_boucle_1 = d_faux;
  456: 
  457:         do
  458:         {
  459:             ecartement = ecartement / 2;
  460: 
  461:             if (ecartement >= 1)
  462:             {
  463:                 indice_j = 0;
  464:                 indice_k = (*((struct_tableau *) (*s_objet_liste).objet))
  465:                         .nombre_elements - ecartement;
  466:                 terminaison_boucle_2 = d_faux;
  467: 
  468:                 do
  469:                 {
  470:                     indice_i = indice_j;
  471:                     terminaison_boucle_3 = d_faux;
  472: 
  473:                     do
  474:                     {
  475:                         indice_l = indice_i + ecartement;
  476: 
  477:                         if ((indice_i > 0) && (indice_l > 0))
  478:                         {
  479:                             if ((s_objet_copie = copie_objet(s_etat_processus,
  480:                                     (*((struct_tableau *) (*s_objet_liste)
  481:                                     .objet)).elements[indice_i - 1], 'P'))
  482:                                     == NULL)
  483:                             {
  484:                                 (*s_etat_processus).erreur_systeme =
  485:                                         d_es_allocation_memoire;
  486:                                 return;
  487:                             }
  488: 
  489:                             if (empilement(s_etat_processus,
  490:                                     &((*s_etat_processus).l_base_pile),
  491:                                     s_objet_copie) == d_erreur)
  492:                             {
  493:                                 return;
  494:                             }
  495: 
  496:                             if ((s_objet_copie = copie_objet(s_etat_processus,
  497:                                     (*((struct_tableau *) (*s_objet_liste)
  498:                                     .objet)).elements[indice_l - 1], 'P'))
  499:                                     == NULL)
  500:                             {
  501:                                 (*s_etat_processus).erreur_systeme =
  502:                                         d_es_allocation_memoire;
  503:                                 return;
  504:                             }
  505: 
  506:                             if (empilement(s_etat_processus,
  507:                                     &((*s_etat_processus).l_base_pile),
  508:                                     s_objet_copie) == d_erreur)
  509:                             {
  510:                                 return;
  511:                             }
  512: 
  513:                             if (evaluation(s_etat_processus, s_objet_critere,
  514:                                     'N') == d_erreur)
  515:                             {
  516:                                 liberation(s_etat_processus, s_objet_critere);
  517:                                 liberation(s_etat_processus, s_objet_liste);
  518: 
  519:                                 return;
  520:                             }
  521: 
  522:                             if (depilement(s_etat_processus,
  523:                                     &((*s_etat_processus).l_base_pile),
  524:                                     &s_objet_test) == d_erreur)
  525:                             {
  526:                                 liberation(s_etat_processus, s_objet_critere);
  527:                                 liberation(s_etat_processus, s_objet_liste);
  528: 
  529:                                 (*s_etat_processus).erreur_execution =
  530:                                         d_ex_manque_argument;
  531:                                 return;
  532:                             }
  533: 
  534:                             if ((*s_objet_test).type == INT)
  535:                             {
  536:                                 condition = ((*((integer8 *) (*s_objet_test)
  537:                                         .objet)) == 0) ? d_faux : d_vrai;
  538:                             }
  539:                             else if ((*s_objet_test).type == REL)
  540:                             {
  541:                                 condition = ((*((real8 *) (*s_objet_test)
  542:                                         .objet)) == 0) ? d_faux : d_vrai;
  543:                             }
  544:                             else
  545:                             {
  546:                                 liberation(s_etat_processus, s_objet_critere);
  547:                                 liberation(s_etat_processus, s_objet_liste);
  548:                                 liberation(s_etat_processus, s_objet_test);
  549: 
  550:                                 (*s_etat_processus).erreur_execution =
  551:                                         d_ex_erreur_type_argument;
  552:                                 return;
  553:                             }
  554: 
  555:                             liberation(s_etat_processus, s_objet_test);
  556: 
  557:                             if (condition == d_faux)
  558:                             {
  559:                                 swap(&((*((struct_tableau *)
  560:                                         (*s_objet_liste).objet)).elements
  561:                                         [indice_i - 1]),
  562:                                         &((*((struct_tableau *) (*s_objet_liste)
  563:                                         .objet)).elements[indice_l - 1]),
  564:                                         sizeof(struct_objet *));
  565: 
  566:                                 indice_i -= ecartement;
  567: 
  568:                                 if (indice_i < 1)
  569:                                 {
  570:                                     terminaison_boucle_3 = d_vrai;
  571:                                 }
  572:                             }
  573:                             else
  574:                             {
  575:                                 terminaison_boucle_3 = d_vrai;
  576:                             }
  577:                         }
  578:                         else
  579:                         {
  580:                             terminaison_boucle_3 = d_vrai;
  581:                         }
  582:                     } while(terminaison_boucle_3 == d_faux);
  583: 
  584:                     indice_j++;
  585: 
  586:                     if (indice_j > indice_k)
  587:                     {
  588:                         terminaison_boucle_2 = d_vrai;
  589:                     }
  590:                 } while(terminaison_boucle_2 == d_faux);
  591:             }
  592:             else
  593:             {
  594:                 terminaison_boucle_1 = d_vrai;
  595:             }
  596:         } while(terminaison_boucle_1 == d_faux);
  597:     }
  598:     else
  599:     {
  600:         if (pthread_mutex_unlock(&((*(*s_etat_processus)
  601:                 .s_liste_variables_partagees).mutex)) != 0)
  602:         {
  603:             (*s_etat_processus).erreur_systeme = d_es_processus;
  604:             return;
  605:         }
  606: 
  607:         liberation(s_etat_processus, s_objet_liste);
  608:         liberation(s_etat_processus, s_objet_critere);
  609: 
  610:         (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
  611:         return;
  612:     }
  613: 
  614:     if (presence_nom == d_faux)
  615:     {
  616:         if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
  617:                 s_objet_liste) == d_erreur)
  618:         {
  619:             return;
  620:         }
  621:     }
  622:     else
  623:     {
  624:         if (variable_partagee == d_vrai)
  625:         {
  626:             (*(*s_etat_processus).s_liste_variables_partagees)
  627:                     .table[(*(*s_etat_processus).s_liste_variables_partagees)
  628:                     .position_variable].objet = s_objet_liste;
  629: 
  630:             if (pthread_mutex_unlock(&((*(*s_etat_processus)
  631:                     .s_liste_variables_partagees).mutex)) != 0)
  632:             {
  633:                 (*s_etat_processus).erreur_systeme = d_es_processus;
  634:                 return;
  635:             }
  636:         }
  637:     }
  638: 
  639:     liberation(s_etat_processus, s_objet_critere);
  640: 
  641:     return;
  642: }
  643: 
  644: 
  645: /*
  646: ================================================================================
  647:   Fonction 'save'
  648: ================================================================================
  649:   Entrées : structure processus
  650: --------------------------------------------------------------------------------
  651:   Sorties :
  652: --------------------------------------------------------------------------------
  653:   Effets de bord : néant
  654: ================================================================================
  655: */
  656: 
  657: void
  658: instruction_save(struct_processus *s_etat_processus)
  659: {
  660:     logical1                            presence_variable;
  661: 
  662:     long                                i;
  663: 
  664:     struct_objet                        *s_objet_1;
  665:     struct_objet                        *s_objet_2;
  666: 
  667:     struct_variable                     s_variable;
  668: 
  669:     (*s_etat_processus).erreur_execution = d_ex;
  670: 
  671:     if ((*s_etat_processus).affichage_arguments == 'Y')
  672:     {
  673:         printf("\n  SAVE ");
  674: 
  675:         if ((*s_etat_processus).langue == 'F')
  676:         {
  677:             printf("(affecte un objet à une variable globale)\n\n");
  678:         }
  679:         else
  680:         {
  681:             printf("(store an object in a global variable)\n\n");
  682:         }
  683: 
  684:         printf("    2: %s, %s, %s, %s, %s, %s,\n"
  685:                 "       %s, %s, %s, %s, %s,\n"
  686:                 "       %s, %s, %s, %s, %s,\n"
  687:                 "       %s, %s, %s, %s,\n"
  688:                 "       %s, %s\n",
  689:                 d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX,
  690:                 d_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SCK,
  691:                 d_SQL, d_SLB, d_PRC, d_MTX);
  692:         printf("    1: %s\n", d_NOM);
  693: 
  694:         return;
  695:     }
  696:     else if ((*s_etat_processus).test_instruction == 'Y')
  697:     {
  698:         (*s_etat_processus).nombre_arguments = -1;
  699:         return;
  700:     }
  701:     
  702:     if (test_cfsf(s_etat_processus, 31) == d_vrai)
  703:     {
  704:         if (empilement_pile_last(s_etat_processus, 2) == d_erreur)
  705:         {
  706:             return;
  707:         }
  708:     }
  709: 
  710:     if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
  711:             &s_objet_1) == d_erreur)
  712:     {
  713:         (*s_etat_processus).erreur_execution = d_ex_manque_argument;
  714:         return;
  715:     }
  716: 
  717:     if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
  718:             &s_objet_2) == d_erreur)
  719:     {
  720:         liberation(s_etat_processus, s_objet_1);
  721: 
  722:         (*s_etat_processus).erreur_execution = d_ex_manque_argument;
  723:         return;
  724:     }
  725: 
  726:     if ((*s_objet_1).type != NOM)
  727:     {
  728:         liberation(s_etat_processus, s_objet_1);
  729:         liberation(s_etat_processus, s_objet_2);
  730: 
  731:         (*s_etat_processus).erreur_execution = d_ex_nom_invalide;
  732:         return;
  733:     }
  734: 
  735:     if (recherche_variable(s_etat_processus, (*((struct_nom *)
  736:             (*s_objet_1).objet)).nom) == d_vrai)
  737:     {
  738:         /*
  739:          * Une variable est accessible directement.
  740:          */
  741: 
  742:         if ((*s_etat_processus).s_liste_variables[(*s_etat_processus)
  743:                 .position_variable_courante].niveau == 1)
  744:         {
  745:             // La variable accessible directement est une variable globale.
  746: 
  747:             if ((*s_etat_processus).s_liste_variables[(*s_etat_processus)
  748:                     .position_variable_courante].variable_verrouillee == d_vrai)
  749:             {
  750:                 liberation(s_etat_processus, s_objet_1);
  751:                 liberation(s_etat_processus, s_objet_2);
  752: 
  753:                 (*s_etat_processus).erreur_execution =
  754:                         d_ex_variable_verrouillee;
  755:                 return;
  756:             }
  757: 
  758:             if ((*s_etat_processus).s_liste_variables[(*s_etat_processus)
  759:                     .position_variable_courante].objet == NULL)
  760:             {
  761:                 liberation(s_etat_processus, s_objet_1);
  762:                 liberation(s_etat_processus, s_objet_2);
  763: 
  764:                 (*s_etat_processus).erreur_execution = d_ex_variable_partagee;
  765:                 return;
  766:             }
  767: 
  768:             liberation(s_etat_processus,
  769:                     (*s_etat_processus).s_liste_variables[(*s_etat_processus)
  770:                     .position_variable_courante].objet);
  771: 
  772:             (*s_etat_processus).s_liste_variables[(*s_etat_processus)
  773:                     .position_variable_courante].objet = s_objet_2;
  774:         }
  775:         else
  776:         {
  777:             // On cherche une variable globale de même nom.
  778: 
  779:             i = (*s_etat_processus).position_variable_courante;
  780:             presence_variable = d_faux;
  781: 
  782:             while(i >= 0)
  783:             {
  784:                 if ((strcmp((*s_etat_processus).s_liste_variables[i].nom,
  785:                         (*((struct_nom *) (*s_objet_1).objet)).nom) == 0) &&
  786:                         ((*s_etat_processus).s_liste_variables[i].niveau == 1))
  787:                 {
  788:                     presence_variable = d_vrai;
  789:                     break;
  790:                 }
  791: 
  792:                 i--;
  793:             }
  794: 
  795:             if (presence_variable == d_vrai)
  796:             {
  797:                 (*s_etat_processus).position_variable_courante = i;
  798:             }
  799:             else
  800:             {
  801:                 (*s_etat_processus).position_variable_courante = 0;
  802:             }
  803: 
  804:             if (((*s_etat_processus).s_liste_variables[(*s_etat_processus)
  805:                     .position_variable_courante].niveau == 1) &&
  806:                     (presence_variable == d_vrai))
  807:             {
  808:                 // On a trouvé une variable globale correspondant au nom et
  809:                 // que l'on modifie.
  810: 
  811:                 if ((*s_etat_processus).s_liste_variables[(*s_etat_processus)
  812:                         .position_variable_courante].variable_verrouillee ==
  813:                         d_vrai)
  814:                 {
  815:                     liberation(s_etat_processus, s_objet_1);
  816:                     liberation(s_etat_processus, s_objet_2);
  817: 
  818:                     (*s_etat_processus).erreur_execution =
  819:                             d_ex_variable_verrouillee;
  820:                     return;
  821:                 }
  822: 
  823:                 if ((*s_etat_processus).s_liste_variables[(*s_etat_processus)
  824:                         .position_variable_courante].objet == NULL)
  825:                 {
  826:                     liberation(s_etat_processus, s_objet_1);
  827:                     liberation(s_etat_processus, s_objet_2);
  828: 
  829:                     (*s_etat_processus).erreur_execution =
  830:                             d_ex_variable_partagee;
  831:                     return;
  832:                 }
  833: 
  834:                 liberation(s_etat_processus,
  835:                         (*s_etat_processus).s_liste_variables
  836:                         [(*s_etat_processus).position_variable_courante].objet);
  837: 
  838:                 (*s_etat_processus).s_liste_variables[(*s_etat_processus)
  839:                         .position_variable_courante].objet = s_objet_2;
  840:             }
  841:             else
  842:             {
  843:                 if ((s_variable.nom = malloc((strlen((*((struct_nom *)
  844:                         (*s_objet_1).objet)).nom) + 1) * sizeof(unsigned char)))
  845:                         == NULL)
  846:                 {
  847:                     (*s_etat_processus).erreur_systeme =
  848:                             d_es_allocation_memoire;
  849:                     return;
  850:                 }
  851: 
  852:                 strcpy(s_variable.nom, (*((struct_nom *)
  853:                         (*s_objet_1).objet)).nom);
  854:                 s_variable.niveau = 1;
  855: 
  856:                 /*
  857:                  * Le niveau 0 correspond aux définitions. Les variables
  858:                  * commencent à 1 car elles sont toujours incluses dans
  859:                  * une définition.
  860:                  */
  861: 
  862:                 s_variable.objet = s_objet_2;
  863: 
  864:                 if (creation_variable(s_etat_processus, &s_variable, 'V', 'P')
  865:                         == d_erreur)
  866:                 {
  867:                     return;
  868:                 }
  869:             }
  870:         }
  871:     }
  872:     else
  873:     {
  874:         /*
  875:          * Aucune variable n'est accessible (ni locale, ni globale).
  876:          */
  877: 
  878:         if ((s_variable.nom = malloc((strlen((*((struct_nom *)
  879:                 (*s_objet_1).objet)).nom) + 1) * sizeof(unsigned char)))
  880:                 == NULL)
  881:         {
  882:             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
  883:             return;
  884:         }
  885: 
  886:         strcpy(s_variable.nom, (*((struct_nom *) (*s_objet_1).objet)).nom);
  887:         s_variable.niveau = 1;
  888: 
  889:         /*
  890:          * Le niveau 0 correspond aux définitions. Les variables
  891:          * commencent à 1 car elles sont toujours incluses dans
  892:          * une définition.
  893:          */
  894: 
  895:         s_variable.objet = s_objet_2;
  896: 
  897:         if (creation_variable(s_etat_processus, &s_variable, 'V', 'P')
  898:                 == d_erreur)
  899:         {
  900:             return;
  901:         }
  902: 
  903:         (*s_etat_processus).erreur_systeme = d_es;
  904:     }
  905: 
  906:     liberation(s_etat_processus, s_objet_1);
  907: 
  908:     return;
  909: }
  910: 
  911: 
  912: /*
  913: ================================================================================
  914:   Fonction 'suspend'
  915: ================================================================================
  916:   Entrées : structure processus
  917: --------------------------------------------------------------------------------
  918:   Sorties :
  919: --------------------------------------------------------------------------------
  920:   Effets de bord : néant
  921: ================================================================================
  922: */
  923: 
  924: void
  925: instruction_suspend(struct_processus *s_etat_processus)
  926: {
  927:     sigset_t            masque;
  928: 
  929:     (*s_etat_processus).erreur_execution = d_ex;
  930: 
  931:     if ((*s_etat_processus).affichage_arguments == 'Y')
  932:     {
  933:         printf("\n  SUSPEND ");
  934: 
  935:         if ((*s_etat_processus).langue == 'F')
  936:         {
  937:             printf("(attend un signal SIGCONT)\n\n");
  938:             printf("  Aucun argument\n");
  939:         }
  940:         else
  941:         {
  942:             printf("(wait for SIGCONT signal)\n\n");
  943:             printf("  No argument\n");
  944:         }
  945: 
  946:         return;
  947:     }
  948:     else if ((*s_etat_processus).test_instruction == 'Y')
  949:     {
  950:         (*s_etat_processus).nombre_arguments = -1;
  951:         return;
  952:     }
  953: 
  954:     if (test_cfsf(s_etat_processus, 31) == d_vrai)
  955:     {
  956:         if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
  957:         {
  958:             return;
  959:         }
  960:     }
  961: 
  962:     if (sigfillset(&masque) != 0)
  963:     {
  964:         (*s_etat_processus).erreur_systeme = d_es_processus;
  965:         return;
  966:     }
  967: 
  968:     if (sigdelset(&masque, SIGCONT) != 0)
  969:     {
  970:         (*s_etat_processus).erreur_systeme = d_es_processus;
  971:         return;
  972:     }
  973: 
  974:     if (sigdelset(&masque, SIGFSTOP) != 0)
  975:     {
  976:         (*s_etat_processus).erreur_systeme = d_es_processus;
  977:         return;
  978:     }
  979: 
  980:     if (sigdelset(&masque, SIGFABORT) != 0)
  981:     {
  982:         (*s_etat_processus).erreur_systeme = d_es_processus;
  983:         return;
  984:     }
  985: 
  986:     if (sigdelset(&masque, SIGURG) != 0)
  987:     {
  988:         (*s_etat_processus).erreur_systeme = d_es_processus;
  989:         return;
  990:     }
  991: 
  992:     if (sigdelset(&masque, SIGALRM) != 0)
  993:     {
  994:         (*s_etat_processus).erreur_systeme = d_es_processus;
  995:         return;
  996:     }
  997: 
  998:     if ((*s_etat_processus).profilage == d_vrai)
  999:     {
 1000:         profilage(s_etat_processus, "Suspend");
 1001: 
 1002:         if ((*s_etat_processus).erreur_systeme != d_es)
 1003:         {
 1004:             return;
 1005:         }
 1006:     }
 1007: 
 1008: #   ifndef SEMAPHORES_NOMMES
 1009:     if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)
 1010:     {
 1011:         (*s_etat_processus).erreur_systeme = d_es_processus;
 1012:         return;
 1013:     }
 1014: #   else
 1015:     if (sem_post((*s_etat_processus).semaphore_fork) != 0)
 1016:     {
 1017:         (*s_etat_processus).erreur_systeme = d_es_processus;
 1018:         return;
 1019:     }
 1020: #   endif
 1021: 
 1022:     sigsuspend(&masque);
 1023: 
 1024: #   ifndef SEMAPHORES_NOMMES
 1025:     while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1)
 1026: #   else
 1027:     while(sem_wait((*s_etat_processus).semaphore_fork) == -1)
 1028: #   endif
 1029:     {
 1030:         if (errno != EINTR)
 1031:         {
 1032:             (*s_etat_processus).erreur_systeme = d_es_processus;
 1033:             return;
 1034:         }
 1035:     }
 1036: 
 1037:     if ((*s_etat_processus).profilage == d_vrai)
 1038:     {
 1039:         profilage(s_etat_processus, NULL);
 1040:     }
 1041: 
 1042:     return;
 1043: }
 1044: 
 1045: 
 1046: /*
 1047: ================================================================================
 1048:   Fonction 'static'
 1049: ================================================================================
 1050:   Entrées : structure processus
 1051: --------------------------------------------------------------------------------
 1052:   Sorties :
 1053: --------------------------------------------------------------------------------
 1054:   Effets de bord : néant
 1055: ================================================================================
 1056: */
 1057: 
 1058: void
 1059: instruction_static(struct_processus *s_etat_processus)
 1060: {
 1061:     (*s_etat_processus).erreur_execution = d_ex;
 1062: 
 1063:     if ((*s_etat_processus).affichage_arguments == 'Y')
 1064:     {
 1065:         printf("\n  STATIC ");
 1066: 
 1067:         if ((*s_etat_processus).langue == 'F')
 1068:         {
 1069:             printf("(déclaration de variables statiques)\n\n");
 1070:             printf("  Aucun argument\n");
 1071:         }
 1072:         else
 1073:         {
 1074:             printf("(static variables declaration)\n\n");
 1075:             printf("  No argument\n");
 1076:         }
 1077: 
 1078:         return;
 1079:     }
 1080:     else if ((*s_etat_processus).test_instruction == 'Y')
 1081:     {
 1082:         (*s_etat_processus).nombre_arguments = -1;
 1083:         return;
 1084:     }
 1085:     
 1086:     if (test_cfsf(s_etat_processus, 31) == d_vrai)
 1087:     {
 1088:         if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
 1089:         {
 1090:             return;
 1091:         }
 1092:     }
 1093: 
 1094:     if ((*s_etat_processus).creation_variables_partagees == d_vrai)
 1095:     {
 1096:         (*s_etat_processus).erreur_execution = d_ex_variable_statique_partagee;
 1097:         return;
 1098:     }
 1099: 
 1100:     (*s_etat_processus).creation_variables_statiques = d_vrai;
 1101: 
 1102:     return;
 1103: }
 1104: 
 1105: 
 1106: /*
 1107: ================================================================================
 1108:   Fonction 'shared'
 1109: ================================================================================
 1110:   Entrées : structure processus
 1111: --------------------------------------------------------------------------------
 1112:   Sorties :
 1113: --------------------------------------------------------------------------------
 1114:   Effets de bord : néant
 1115: ================================================================================
 1116: */
 1117: 
 1118: void
 1119: instruction_shared(struct_processus *s_etat_processus)
 1120: {
 1121:     (*s_etat_processus).erreur_execution = d_ex;
 1122: 
 1123:     if ((*s_etat_processus).affichage_arguments == 'Y')
 1124:     {
 1125:         printf("\n  SHARED ");
 1126: 
 1127:         if ((*s_etat_processus).langue == 'F')
 1128:         {
 1129:             printf("(déclaration de variables partagées)\n\n");
 1130:             printf("  Aucun argument\n");
 1131:         }
 1132:         else
 1133:         {
 1134:             printf("(shared variables declaration)\n\n");
 1135:             printf("  No argument\n");
 1136:         }
 1137: 
 1138:         return;
 1139:     }
 1140:     else if ((*s_etat_processus).test_instruction == 'Y')
 1141:     {
 1142:         (*s_etat_processus).nombre_arguments = -1;
 1143:         return;
 1144:     }
 1145:     
 1146:     if (test_cfsf(s_etat_processus, 31) == d_vrai)
 1147:     {
 1148:         if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
 1149:         {
 1150:             return;
 1151:         }
 1152:     }
 1153: 
 1154:     if ((*s_etat_processus).creation_variables_partagees == d_vrai)
 1155:     {
 1156:         (*s_etat_processus).erreur_execution = d_ex_variable_statique_partagee;
 1157:         return;
 1158:     }
 1159: 
 1160:     (*s_etat_processus).creation_variables_partagees = d_vrai;
 1161: 
 1162:     return;
 1163: }
 1164: 
 1165: 
 1166: /*
 1167: ================================================================================
 1168:   Fonction 'stoswi'
 1169: ================================================================================
 1170:   Entrées : structure processus
 1171: --------------------------------------------------------------------------------
 1172:   Sorties :
 1173: --------------------------------------------------------------------------------
 1174:   Effets de bord : néant
 1175: ================================================================================
 1176: */
 1177: 
 1178: void
 1179: instruction_stoswi(struct_processus *s_etat_processus)
 1180: {
 1181:     integer8                    interruption;
 1182: 
 1183:     struct_objet                *s_objet_argument_1;
 1184:     struct_objet                *s_objet_argument_2;
 1185: 
 1186:     (*s_etat_processus).erreur_execution = d_ex;
 1187: 
 1188:     if ((*s_etat_processus).affichage_arguments == 'Y')
 1189:     {
 1190:         printf("\n  STOSWI ");
 1191: 
 1192:         if ((*s_etat_processus).langue == 'F')
 1193:         {
 1194:             printf("(définition d'une interruption logicielle)\n\n");
 1195:         }
 1196:         else
 1197:         {
 1198:             printf("(software interrupt definition)\n\n");
 1199:         }
 1200: 
 1201:         printf("    2: %s, %s\n", d_NOM, d_RPN);
 1202:         printf("    1: %s\n", d_INT);
 1203: 
 1204:         return;
 1205:     }
 1206:     else if ((*s_etat_processus).test_instruction == 'Y')
 1207:     {
 1208:         (*s_etat_processus).nombre_arguments = -1;
 1209:         return;
 1210:     }
 1211: 
 1212:     if (test_cfsf(s_etat_processus, 31) == d_vrai)
 1213:     {
 1214:         if (empilement_pile_last(s_etat_processus, 2) == d_erreur)
 1215:         {
 1216:             return;
 1217:         }
 1218:     }
 1219: 
 1220:     if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
 1221:             &s_objet_argument_1) == d_erreur)
 1222:     {
 1223:         (*s_etat_processus).erreur_execution = d_ex_manque_argument;
 1224:         return;
 1225:     }
 1226: 
 1227:     if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
 1228:             &s_objet_argument_2) == d_erreur)
 1229:     {
 1230:         liberation(s_etat_processus, s_objet_argument_1);
 1231: 
 1232:         (*s_etat_processus).erreur_execution = d_ex_manque_argument;
 1233:         return;
 1234:     }
 1235: 
 1236:     if ((*s_objet_argument_1).type == INT)
 1237:     {
 1238:         interruption = (*((integer8 *) (*s_objet_argument_1).objet));
 1239: 
 1240:         if ((interruption < 1) || (interruption > d_NOMBRE_INTERRUPTIONS))
 1241:         {
 1242:             liberation(s_etat_processus, s_objet_argument_1);
 1243:             liberation(s_etat_processus, s_objet_argument_2);
 1244: 
 1245:             (*s_etat_processus).erreur_execution = d_ex_interruption_invalide;
 1246:             return;
 1247:         }
 1248: 
 1249:         if ((*s_objet_argument_2).type == NOM)
 1250:         {
 1251:             liberation(s_etat_processus, (*s_etat_processus).corps_interruptions
 1252:                     [interruption - 1]);
 1253:             (*s_etat_processus).corps_interruptions[interruption - 1] =
 1254:                     s_objet_argument_2;
 1255:         }
 1256:         else if((*s_objet_argument_2).type == RPN)
 1257:         {
 1258:             liberation(s_etat_processus, (*s_etat_processus).corps_interruptions
 1259:                     [interruption - 1]);
 1260:             (*s_etat_processus).corps_interruptions[interruption - 1] =
 1261:                     s_objet_argument_2;
 1262:         }
 1263:         else
 1264:         {
 1265:             liberation(s_etat_processus, s_objet_argument_1);
 1266:             liberation(s_etat_processus, s_objet_argument_2);
 1267: 
 1268:             (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
 1269:             return;
 1270:         }
 1271:     }
 1272:     else
 1273:     {
 1274:         liberation(s_etat_processus, s_objet_argument_1);
 1275:         liberation(s_etat_processus, s_objet_argument_2);
 1276: 
 1277:         (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
 1278:         return;
 1279:     }
 1280: 
 1281:     liberation(s_etat_processus, s_objet_argument_1);
 1282: 
 1283:     return;
 1284: }
 1285: 
 1286: 
 1287: /*
 1288: ================================================================================
 1289:   Fonction 'swi'
 1290: ================================================================================
 1291:   Entrées : structure processus
 1292: --------------------------------------------------------------------------------
 1293:   Sorties :
 1294: --------------------------------------------------------------------------------
 1295:   Effets de bord : néant
 1296: ================================================================================
 1297: */
 1298: 
 1299: void
 1300: instruction_swi(struct_processus *s_etat_processus)
 1301: {
 1302:     int                         interruption_reduite;
 1303: 
 1304:     integer8                    interruption;
 1305: 
 1306:     pid_t                       pid;
 1307: 
 1308:     pthread_t                   tid;
 1309: 
 1310:     sig_atomic_t                registre;
 1311: 
 1312:     ssize_t                     longueur_ecriture;
 1313: 
 1314:     struct_objet                *s_objet_argument;
 1315: 
 1316:     struct timespec             attente;
 1317: 
 1318:     unsigned char               tampon;
 1319: 
 1320:     (*s_etat_processus).erreur_execution = d_ex;
 1321: 
 1322:     if ((*s_etat_processus).affichage_arguments == 'Y')
 1323:     {
 1324:         printf("\n  SWI ");
 1325: 
 1326:         if ((*s_etat_processus).langue == 'F')
 1327:         {
 1328:             printf("(interruption logicielle)\n\n");
 1329:         }
 1330:         else
 1331:         {
 1332:             printf("(software interrupt)\n\n");
 1333:         }
 1334: 
 1335:         printf("    1: %s\n", d_INT);
 1336: 
 1337:         return;
 1338:     }
 1339:     else if ((*s_etat_processus).test_instruction == 'Y')
 1340:     {
 1341:         (*s_etat_processus).nombre_arguments = -1;
 1342:         return;
 1343:     }
 1344: 
 1345:     if (test_cfsf(s_etat_processus, 31) == d_vrai)
 1346:     {
 1347:         if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
 1348:         {
 1349:             return;
 1350:         }
 1351:     }
 1352: 
 1353:     if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
 1354:             &s_objet_argument) == d_erreur)
 1355:     {
 1356:         (*s_etat_processus).erreur_execution = d_ex_manque_argument;
 1357:         return;
 1358:     }
 1359: 
 1360:     if ((*s_objet_argument).type == INT)
 1361:     {
 1362:         interruption = (*((integer8 *) (*s_objet_argument).objet));
 1363: 
 1364:         if ((interruption < 1) || (interruption > d_NOMBRE_INTERRUPTIONS))
 1365:         {
 1366:             liberation(s_etat_processus, s_objet_argument);
 1367: 
 1368:             (*s_etat_processus).erreur_execution = d_ex_interruption_invalide;
 1369:             return;
 1370:         }
 1371: 
 1372:         if ((*s_etat_processus).presence_pipes == d_faux)
 1373:         {
 1374:             liberation(s_etat_processus, s_objet_argument);
 1375: 
 1376:             (*s_etat_processus).erreur_execution = d_ex_absence_processus_pere;
 1377:             return;
 1378:         }
 1379: 
 1380:         // Envoi d'un PID invalide (-1) pour ne pas bloquer le thread
 1381:         // de surveillance.
 1382: 
 1383:         registre = (*s_etat_processus).var_volatile_traitement_retarde_stop;
 1384:         (*s_etat_processus).var_volatile_traitement_retarde_stop = 1;
 1385: 
 1386:         if ((*s_etat_processus).processus_detache == d_vrai)
 1387:         {
 1388:             pid = -1;
 1389: 
 1390:             attente.tv_sec = 0;
 1391:             attente.tv_nsec = GRANULARITE_us * 1000;
 1392: 
 1393: #           ifndef SEMAPHORES_NOMMES
 1394:             if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)
 1395:             {
 1396:                 (*s_etat_processus).erreur_systeme = d_es_processus;
 1397:                 return;
 1398:             }
 1399: #           else
 1400:             if (sem_post((*s_etat_processus).semaphore_fork) != 0)
 1401:             {
 1402:                 (*s_etat_processus).erreur_systeme = d_es_processus;
 1403:                 return;
 1404:             }
 1405: #           endif
 1406: 
 1407:             while((longueur_ecriture = write_atomic(s_etat_processus,
 1408:                     (*s_etat_processus).pipe_nombre_objets_attente,
 1409:                     &pid, sizeof(pid))) != sizeof(pid))
 1410:             {
 1411: #               ifndef SEMAPHORES_NOMMES
 1412:                 while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1)
 1413: #               else
 1414:                 while(sem_wait((*s_etat_processus).semaphore_fork) == -1)
 1415: #               endif
 1416:                 {
 1417:                     if (errno != EINTR)
 1418:                     {
 1419:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1420:                         return;
 1421:                     }
 1422:                 }
 1423: 
 1424:                 if (longueur_ecriture == -1)
 1425:                 {
 1426:                     if (registre == 0)
 1427:                     {
 1428:                         if ((*s_etat_processus)
 1429:                                 .var_volatile_traitement_retarde_stop == -1)
 1430:                         {
 1431:                             (*s_etat_processus).var_volatile_requete_arret = -1;
 1432:                         }
 1433: 
 1434:                         (*s_etat_processus)
 1435:                                 .var_volatile_traitement_retarde_stop
 1436:                                 = registre;
 1437:                     }
 1438: 
 1439:                     (*s_etat_processus).erreur_systeme = d_es_processus;
 1440:                     return;
 1441:                 }
 1442: 
 1443:                 nanosleep(&attente, NULL);
 1444:                 INCR_GRANULARITE(attente.tv_nsec);
 1445: 
 1446: #               ifndef SEMAPHORES_NOMMES
 1447:                 if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)
 1448: #               else
 1449:                 if (sem_post((*s_etat_processus).semaphore_fork) != 0)
 1450: #               endif
 1451:                 {
 1452:                     (*s_etat_processus).erreur_systeme = d_es_processus;
 1453:                     return;
 1454:                 }
 1455:             }
 1456: 
 1457: #           ifndef SEMAPHORES_NOMMES
 1458:             while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1)
 1459: #           else
 1460:             while(sem_wait((*s_etat_processus).semaphore_fork) == -1)
 1461: #           endif
 1462:             {
 1463:                 if (errno != EINTR)
 1464:                 {
 1465:                     (*s_etat_processus).erreur_systeme = d_es_processus;
 1466:                     return;
 1467:                 }
 1468:             }
 1469:         }
 1470:         else
 1471:         {
 1472:             tid = -1;
 1473: 
 1474:             attente.tv_sec = 0;
 1475:             attente.tv_nsec = GRANULARITE_us * 1000;
 1476: 
 1477: #           ifndef SEMAPHORES_NOMMES
 1478:             if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)
 1479:             {
 1480:                 (*s_etat_processus).erreur_systeme = d_es_processus;
 1481:                 return;
 1482:             }
 1483: #           else
 1484:             if (sem_post((*s_etat_processus).semaphore_fork) != 0)
 1485:             {
 1486:                 (*s_etat_processus).erreur_systeme = d_es_processus;
 1487:                 return;
 1488:             }
 1489: #           endif
 1490: 
 1491:             while((longueur_ecriture = write_atomic(s_etat_processus,
 1492:                     (*s_etat_processus).pipe_nombre_objets_attente,
 1493:                     &tid, sizeof(tid))) != sizeof(tid))
 1494:             {
 1495: #               ifndef SEMAPHORES_NOMMES
 1496:                 while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1)
 1497: #               else
 1498:                 while(sem_wait((*s_etat_processus).semaphore_fork) == -1)
 1499: #               endif
 1500:                 {
 1501:                     if (errno != EINTR)
 1502:                     {
 1503:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1504:                         return;
 1505:                     }
 1506:                 }
 1507: 
 1508:                 if (longueur_ecriture == -1)
 1509:                 {
 1510:                     if (registre == 0)
 1511:                     {
 1512:                         if ((*s_etat_processus)
 1513:                                 .var_volatile_traitement_retarde_stop == -1)
 1514:                         {
 1515:                             (*s_etat_processus).var_volatile_requete_arret = -1;
 1516:                         }
 1517: 
 1518:                         (*s_etat_processus)
 1519:                                 .var_volatile_traitement_retarde_stop
 1520:                                 = registre;
 1521:                     }
 1522: 
 1523:                     (*s_etat_processus).erreur_systeme = d_es_processus;
 1524:                     return;
 1525:                 }
 1526: 
 1527:                 nanosleep(&attente, NULL);
 1528:                 INCR_GRANULARITE(attente.tv_nsec);
 1529: 
 1530: #               ifndef SEMAPHORES_NOMMES
 1531:                 if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)
 1532:                 {
 1533:                     (*s_etat_processus).erreur_systeme = d_es_processus;
 1534:                     return;
 1535:                 }
 1536: #               else
 1537:                 if (sem_post((*s_etat_processus).semaphore_fork) != 0)
 1538:                 {
 1539:                     (*s_etat_processus).erreur_systeme = d_es_processus;
 1540:                     return;
 1541:                 }
 1542: #               endif
 1543:             }
 1544: 
 1545: #           ifndef SEMAPHORES_NOMMES
 1546:             while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1)
 1547: #           else
 1548:             while(sem_wait((*s_etat_processus).semaphore_fork) == -1)
 1549: #           endif
 1550:             {
 1551:                 if (errno != EINTR)
 1552:                 {
 1553:                     (*s_etat_processus).erreur_systeme = d_es_processus;
 1554:                     return;
 1555:                 }
 1556:             }
 1557:         }
 1558: 
 1559:         interruption_reduite = interruption;
 1560: 
 1561:         attente.tv_sec = 0;
 1562:         attente.tv_nsec = GRANULARITE_us * 1000;
 1563: 
 1564: #       ifndef SEMAPHORES_NOMMES
 1565:         if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)
 1566:         {
 1567:             (*s_etat_processus).erreur_systeme = d_es_processus;
 1568:             return;
 1569:         }
 1570: #       else
 1571:         if (sem_post((*s_etat_processus).semaphore_fork) != 0)
 1572:         {
 1573:             (*s_etat_processus).erreur_systeme = d_es_processus;
 1574:             return;
 1575:         }
 1576: #       endif
 1577: 
 1578:         while((longueur_ecriture = write_atomic(s_etat_processus,
 1579:                 (*s_etat_processus).pipe_interruptions,
 1580:                 &interruption_reduite, sizeof(interruption_reduite)))
 1581:                 != sizeof(interruption_reduite))
 1582:         {
 1583: #           ifndef SEMAPHORES_NOMMES
 1584:             while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1)
 1585: #           else
 1586:             while(sem_wait((*s_etat_processus).semaphore_fork) == -1)
 1587: #           endif
 1588:             {
 1589:                 if (errno != EINTR)
 1590:                 {
 1591:                     (*s_etat_processus).erreur_systeme = d_es_processus;
 1592:                     return;
 1593:                 }
 1594:             }
 1595: 
 1596:             if (longueur_ecriture == -1)
 1597:             {
 1598:                 if (registre == 0)
 1599:                 {
 1600:                     if ((*s_etat_processus)
 1601:                             .var_volatile_traitement_retarde_stop == -1)
 1602:                     {
 1603:                         (*s_etat_processus).var_volatile_requete_arret = -1;
 1604:                     }
 1605: 
 1606:                     (*s_etat_processus)
 1607:                             .var_volatile_traitement_retarde_stop
 1608:                             = registre;
 1609:                 }
 1610: 
 1611:                 (*s_etat_processus).erreur_systeme = d_es_processus;
 1612:                 return;
 1613:             }
 1614: 
 1615:             nanosleep(&attente, NULL);
 1616:             INCR_GRANULARITE(attente.tv_nsec);
 1617: 
 1618: #           ifndef SEMAPHORES_NOMMES
 1619:             if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)
 1620:             {
 1621:                 (*s_etat_processus).erreur_systeme = d_es_processus;
 1622:                 return;
 1623:             }
 1624: #           else
 1625:             if (sem_post((*s_etat_processus).semaphore_fork) != 0)
 1626:             {
 1627:                 (*s_etat_processus).erreur_systeme = d_es_processus;
 1628:                 return;
 1629:             }
 1630: #           endif
 1631:         }
 1632: 
 1633: #       ifndef SEMAPHORES_NOMMES
 1634:         while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1)
 1635: #       else
 1636:         while(sem_wait((*s_etat_processus).semaphore_fork) == -1)
 1637: #       endif
 1638:         {
 1639:             if (errno != EINTR)
 1640:             {
 1641:                 (*s_etat_processus).erreur_systeme = d_es_processus;
 1642:                 return;
 1643:             }
 1644:         }
 1645: 
 1646:         if ((*s_etat_processus).processus_detache == d_vrai)
 1647:         {
 1648:             pid = -3;
 1649: 
 1650:             attente.tv_sec = 0;
 1651:             attente.tv_nsec = GRANULARITE_us * 1000;
 1652: 
 1653: #           ifndef SEMAPHORES_NOMMES
 1654:             if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)
 1655:             {
 1656:                 (*s_etat_processus).erreur_systeme = d_es_processus;
 1657:                 return;
 1658:             }
 1659: #           else
 1660:             if (sem_post((*s_etat_processus).semaphore_fork) != 0)
 1661:             {
 1662:                 (*s_etat_processus).erreur_systeme = d_es_processus;
 1663:                 return;
 1664:             }
 1665: #           endif
 1666: 
 1667:             while((longueur_ecriture = write_atomic(s_etat_processus,
 1668:                     (*s_etat_processus).pipe_nombre_interruptions_attente,
 1669:                     &pid, sizeof(pid))) != sizeof(pid))
 1670:             {
 1671: #               ifndef SEMAPHORES_NOMMES
 1672:                 while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1)
 1673: #               else
 1674:                 while(sem_wait((*s_etat_processus).semaphore_fork) == -1)
 1675: #               endif
 1676:                 {
 1677:                     (*s_etat_processus).erreur_systeme = d_es_processus;
 1678:                     return;
 1679:                 }
 1680: 
 1681:                 if (longueur_ecriture == -1)
 1682:                 {
 1683:                     if (registre == 0)
 1684:                     {
 1685:                         if ((*s_etat_processus)
 1686:                                 .var_volatile_traitement_retarde_stop == -1)
 1687:                         {
 1688:                             (*s_etat_processus).var_volatile_requete_arret = -1;
 1689:                         }
 1690: 
 1691:                         (*s_etat_processus)
 1692:                                 .var_volatile_traitement_retarde_stop
 1693:                                 = registre;
 1694:                     }
 1695: 
 1696:                     (*s_etat_processus).erreur_systeme = d_es_processus;
 1697:                     return;
 1698:                 }
 1699: 
 1700:                 nanosleep(&attente, NULL);
 1701:                 INCR_GRANULARITE(attente.tv_nsec);
 1702: 
 1703: #               ifndef SEMAPHORES_NOMMES
 1704:                 if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)
 1705:                 {
 1706:                     (*s_etat_processus).erreur_systeme = d_es_processus;
 1707:                     return;
 1708:                 }
 1709: #               else
 1710:                 if (sem_post((*s_etat_processus).semaphore_fork) != 0)
 1711:                 {
 1712:                     (*s_etat_processus).erreur_systeme = d_es_processus;
 1713:                     return;
 1714:                 }
 1715: #               endif
 1716:             }
 1717: 
 1718:             pid = getpid();
 1719: 
 1720:             attente.tv_sec = 0;
 1721:             attente.tv_nsec = GRANULARITE_us * 1000;
 1722: 
 1723:             while((longueur_ecriture = write_atomic(s_etat_processus,
 1724:                     (*s_etat_processus).pipe_nombre_interruptions_attente,
 1725:                     &pid, sizeof(pid))) != sizeof(pid))
 1726:             {
 1727: #               ifndef SEMAPHORES_NOMMES
 1728:                 while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1)
 1729: #               else
 1730:                 while(sem_wait((*s_etat_processus).semaphore_fork) == -1)
 1731: #               endif
 1732:                 {
 1733:                     if (errno != EINTR)
 1734:                     {
 1735:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1736:                         return;
 1737:                     }
 1738:                 }
 1739: 
 1740:                 if (longueur_ecriture == -1)
 1741:                 {
 1742:                     if (registre == 0)
 1743:                     {
 1744:                         if ((*s_etat_processus)
 1745:                                 .var_volatile_traitement_retarde_stop == -1)
 1746:                         {
 1747:                             (*s_etat_processus).var_volatile_requete_arret = -1;
 1748:                         }
 1749: 
 1750:                         (*s_etat_processus)
 1751:                                 .var_volatile_traitement_retarde_stop
 1752:                                 = registre;
 1753:                     }
 1754: 
 1755:                     (*s_etat_processus).erreur_systeme = d_es_processus;
 1756:                     return;
 1757:                 }
 1758: 
 1759:                 nanosleep(&attente, NULL);
 1760:                 INCR_GRANULARITE(attente.tv_nsec);
 1761: 
 1762: #               ifndef SEMAPHORES_NOMMES
 1763:                 if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)
 1764:                 {
 1765:                     (*s_etat_processus).erreur_systeme = d_es_processus;
 1766:                     return;
 1767:                 }
 1768: #               else
 1769:                 if (sem_post((*s_etat_processus).semaphore_fork) != 0)
 1770:                 {
 1771:                     (*s_etat_processus).erreur_systeme = d_es_processus;
 1772:                     return;
 1773:                 }
 1774: #               endif
 1775:             }
 1776: 
 1777: #           ifndef SEMAPHORES_NOMMES
 1778:             while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1)
 1779: #           else
 1780:             while(sem_wait((*s_etat_processus).semaphore_fork) == -1)
 1781: #           endif
 1782:             {
 1783:                 if (errno != EINTR)
 1784:                 {
 1785:                     (*s_etat_processus).erreur_systeme = d_es_processus;
 1786:                     return;
 1787:                 }
 1788:             }
 1789:         }
 1790:         else
 1791:         {
 1792:             tid = -3;
 1793: 
 1794: #           ifndef SEMAPHORES_NOMMES
 1795:             if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)
 1796:             {
 1797:                 (*s_etat_processus).erreur_systeme = d_es_processus;
 1798:                 return;
 1799:             }
 1800: #           else
 1801:             if (sem_post((*s_etat_processus).semaphore_fork) != 0)
 1802:             {
 1803:                 (*s_etat_processus).erreur_systeme = d_es_processus;
 1804:                 return;
 1805:             }
 1806: #           endif
 1807: 
 1808:             while((longueur_ecriture = write_atomic(s_etat_processus,
 1809:                     (*s_etat_processus).pipe_nombre_interruptions_attente,
 1810:                     &tid, sizeof(tid))) != sizeof(tid))
 1811:             {
 1812: #               ifndef SEMAPHORES_NOMMES
 1813:                 while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1)
 1814: #               else
 1815:                 while(sem_wait((*s_etat_processus).semaphore_fork) == -1)
 1816: #               endif
 1817:                 {
 1818:                     if (errno != EINTR)
 1819:                     {
 1820:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1821:                         return;
 1822:                     }
 1823:                 }
 1824: 
 1825:                 if (longueur_ecriture == -1)
 1826:                 {
 1827:                     if (registre == 0)
 1828:                     {
 1829:                         if ((*s_etat_processus)
 1830:                                 .var_volatile_traitement_retarde_stop == -1)
 1831:                         {
 1832:                             (*s_etat_processus).var_volatile_requete_arret = -1;
 1833:                         }
 1834: 
 1835:                         (*s_etat_processus)
 1836:                                 .var_volatile_traitement_retarde_stop
 1837:                                 = registre;
 1838:                     }
 1839: 
 1840:                     (*s_etat_processus).erreur_systeme = d_es_processus;
 1841:                     return;
 1842:                 }
 1843: 
 1844:                 nanosleep(&attente, NULL);
 1845:                 INCR_GRANULARITE(attente.tv_nsec);
 1846: 
 1847: #               ifndef SEMAPHORES_NOMMES
 1848:                 if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)
 1849:                 {
 1850:                     (*s_etat_processus).erreur_systeme = d_es_processus;
 1851:                     return;
 1852:                 }
 1853: #               else
 1854:                 if (sem_post((*s_etat_processus).semaphore_fork) != 0)
 1855:                 {
 1856:                     (*s_etat_processus).erreur_systeme = d_es_processus;
 1857:                     return;
 1858:                 }
 1859: #               endif
 1860:             }
 1861: 
 1862:             tid = pthread_self();
 1863: 
 1864:             attente.tv_sec = 0;
 1865:             attente.tv_nsec = GRANULARITE_us * 1000;
 1866: 
 1867:             while((longueur_ecriture = write_atomic(s_etat_processus,
 1868:                     (*s_etat_processus).pipe_nombre_interruptions_attente,
 1869:                     &tid, sizeof(tid))) != sizeof(tid))
 1870:             {
 1871: #               ifndef SEMAPHORES_NOMMES
 1872:                 while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1)
 1873: #               else
 1874:                 while(sem_wait((*s_etat_processus).semaphore_fork) == -1)
 1875: #               endif
 1876:                 {
 1877:                     if (errno != EINTR)
 1878:                     {
 1879:                         (*s_etat_processus).erreur_systeme = d_es_processus;
 1880:                         return;
 1881:                     }
 1882:                 }
 1883: 
 1884:                 if (longueur_ecriture == -1)
 1885: 
 1886:                 {
 1887:                     if (registre == 0)
 1888:                     {
 1889:                         if ((*s_etat_processus)
 1890:                                 .var_volatile_traitement_retarde_stop == -1)
 1891:                         {
 1892:                             (*s_etat_processus).var_volatile_requete_arret = -1;
 1893:                         }
 1894: 
 1895:                         (*s_etat_processus)
 1896:                                 .var_volatile_traitement_retarde_stop
 1897:                                 = registre;
 1898:                     }
 1899: 
 1900:                     (*s_etat_processus).erreur_systeme = d_es_processus;
 1901:                     return;
 1902:                 }
 1903: 
 1904:                 nanosleep(&attente, NULL);
 1905:                 INCR_GRANULARITE(attente.tv_nsec);
 1906: 
 1907: #               ifndef SEMAPHORES_NOMMES
 1908:                 if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)
 1909:                 {
 1910:                     (*s_etat_processus).erreur_systeme = d_es_processus;
 1911:                     return;
 1912:                 }
 1913: #               else
 1914:                 if (sem_post((*s_etat_processus).semaphore_fork) != 0)
 1915:                 {
 1916:                     (*s_etat_processus).erreur_systeme = d_es_processus;
 1917:                     return;
 1918:                 }
 1919: #               endif
 1920:             }
 1921: 
 1922: #           ifndef SEMAPHORES_NOMMES
 1923:             while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1)
 1924: #           else
 1925:             while(sem_wait((*s_etat_processus).semaphore_fork) == -1)
 1926: #           endif
 1927:             {
 1928:                 if (errno != EINTR)
 1929:                 {
 1930:                     (*s_etat_processus).erreur_systeme = d_es_processus;
 1931:                     return;
 1932:                 }
 1933:             }
 1934:         }
 1935: 
 1936:         attente.tv_sec = 0;
 1937:         attente.tv_nsec = GRANULARITE_us * 1000;
 1938: 
 1939: #       ifndef SEMAPHORES_NOMMES
 1940:         if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)
 1941:         {
 1942:             (*s_etat_processus).erreur_systeme = d_es_processus;
 1943:             return;
 1944:         }
 1945: #       else
 1946:         if (sem_post((*s_etat_processus).semaphore_fork) != 0)
 1947:         {
 1948:             (*s_etat_processus).erreur_systeme = d_es_processus;
 1949:             return;
 1950:         }
 1951: #       endif
 1952: 
 1953:         while(read_atomic(s_etat_processus,
 1954:                 (*s_etat_processus).pipe_acquittement,
 1955:                 &tampon, sizeof(unsigned char)) != sizeof(unsigned char))
 1956:         {
 1957: #           ifndef SEMAPHORES_NOMMES
 1958:             while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1)
 1959: #           else
 1960:             while(sem_wait((*s_etat_processus).semaphore_fork) == -1)
 1961: #           endif
 1962:             {
 1963:                 if (errno != EINTR)
 1964:                 {
 1965:                     (*s_etat_processus).erreur_systeme = d_es_processus;
 1966:                     return;
 1967:                 }
 1968:             }
 1969: 
 1970:             nanosleep(&attente, NULL);
 1971:             INCR_GRANULARITE(attente.tv_nsec);
 1972: 
 1973: #           ifndef SEMAPHORES_NOMMES
 1974:             if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)
 1975: #           else
 1976:             if (sem_post((*s_etat_processus).semaphore_fork) != 0)
 1977: #           endif
 1978:             {
 1979:                 (*s_etat_processus).erreur_systeme = d_es_processus;
 1980:                 return;
 1981:             }
 1982:         }
 1983: 
 1984: #       ifndef SEMAPHORES_NOMMES
 1985:         while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1)
 1986: #       else
 1987:         while(sem_wait((*s_etat_processus).semaphore_fork) == -1)
 1988: #       endif
 1989:         {
 1990:             if (errno != EINTR)
 1991:             {
 1992:                 (*s_etat_processus).erreur_systeme = d_es_processus;
 1993:                 return;
 1994:             }
 1995:         }
 1996: 
 1997:         if (registre == 0)
 1998:         {
 1999:             if ((*s_etat_processus).var_volatile_traitement_retarde_stop == -1)
 2000:             {
 2001:                 (*s_etat_processus).var_volatile_requete_arret = -1;
 2002:             }
 2003: 
 2004:             (*s_etat_processus).var_volatile_traitement_retarde_stop = registre;
 2005:         }
 2006:     }
 2007:     else
 2008:     {
 2009:         liberation(s_etat_processus, s_objet_argument);
 2010: 
 2011:         (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
 2012:         return;
 2013:     }
 2014: 
 2015:     liberation(s_etat_processus, s_objet_argument);
 2016: 
 2017:     return;
 2018: }
 2019: 
 2020: 
 2021: /*
 2022: ================================================================================
 2023:   Fonction 'swilock'
 2024: ================================================================================
 2025:   Entrées : structure processus
 2026: --------------------------------------------------------------------------------
 2027:   Sorties :
 2028: --------------------------------------------------------------------------------
 2029:   Effets de bord : néant
 2030: ================================================================================
 2031: */
 2032: 
 2033: void
 2034: instruction_swilock(struct_processus *s_etat_processus)
 2035: {
 2036:     integer8                    interruption;
 2037: 
 2038:     struct_liste_chainee        *l_element_courant;
 2039: 
 2040:     struct_objet                *s_objet_argument;
 2041: 
 2042:     (*s_etat_processus).erreur_execution = d_ex;
 2043: 
 2044:     if ((*s_etat_processus).affichage_arguments == 'Y')
 2045:     {
 2046:         printf("\n  SWILOCK ");
 2047: 
 2048:         if ((*s_etat_processus).langue == 'F')
 2049:         {
 2050:             printf("(verrouillage des interruptions logicielles)\n\n");
 2051:         }
 2052:         else
 2053:         {
 2054:             printf("(software interrupt lock)\n\n");
 2055:         }
 2056: 
 2057:         printf("    1: %s, %s\n", d_INT, d_LST);
 2058: 
 2059:         return;
 2060:     }
 2061:     else if ((*s_etat_processus).test_instruction == 'Y')
 2062:     {
 2063:         (*s_etat_processus).nombre_arguments = -1;
 2064:         return;
 2065:     }
 2066: 
 2067:     if (test_cfsf(s_etat_processus, 31) == d_vrai)
 2068:     {
 2069:         if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
 2070:         {
 2071:             return;
 2072:         }
 2073:     }
 2074: 
 2075:     if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
 2076:             &s_objet_argument) == d_erreur)
 2077:     {
 2078:         (*s_etat_processus).erreur_execution = d_ex_manque_argument;
 2079:         return;
 2080:     }
 2081: 
 2082:     if ((*s_objet_argument).type == INT)
 2083:     {
 2084:         interruption = (*((integer8 *) (*s_objet_argument).objet));
 2085: 
 2086:         if ((interruption < 1) || (interruption > d_NOMBRE_INTERRUPTIONS))
 2087:         {
 2088:             liberation(s_etat_processus, s_objet_argument);
 2089: 
 2090:             (*s_etat_processus).erreur_execution = d_ex_interruption_invalide;
 2091:             return;
 2092:         }
 2093: 
 2094:         (*s_etat_processus).masque_interruptions[interruption - 1] = 'I';
 2095:     }
 2096:     else if ((*s_objet_argument).type == LST)
 2097:     {
 2098:         l_element_courant = (*s_objet_argument).objet;
 2099: 
 2100:         while(l_element_courant)
 2101:         {
 2102:             if ((*(*l_element_courant).donnee).type != INT)
 2103:             {
 2104:                 liberation(s_etat_processus, s_objet_argument);
 2105: 
 2106:                 (*s_etat_processus).erreur_execution =
 2107:                         d_ex_erreur_type_argument;
 2108:                 return;
 2109:             }
 2110: 
 2111:             interruption = (*((integer8 *) (*(*l_element_courant)
 2112:                     .donnee).objet));
 2113: 
 2114:             if ((interruption < 1) || (interruption > d_NOMBRE_INTERRUPTIONS))
 2115:             {
 2116:                 liberation(s_etat_processus, s_objet_argument);
 2117: 
 2118:                 (*s_etat_processus).erreur_execution =
 2119:                         d_ex_interruption_invalide;
 2120:                 return;
 2121:             }
 2122: 
 2123:             (*s_etat_processus).masque_interruptions[interruption - 1] = 'I';
 2124:             l_element_courant = (*l_element_courant).suivant;
 2125:         }
 2126:     }
 2127:     else
 2128:     {
 2129:         liberation(s_etat_processus, s_objet_argument);
 2130: 
 2131:         (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
 2132:         return;
 2133:     }
 2134: 
 2135:     liberation(s_etat_processus, s_objet_argument);
 2136: 
 2137:     return;
 2138: }
 2139: 
 2140: 
 2141: /*
 2142: ================================================================================
 2143:   Fonction 'swistatus'
 2144: ================================================================================
 2145:   Entrées : structure processus
 2146: --------------------------------------------------------------------------------
 2147:   Sorties :
 2148: --------------------------------------------------------------------------------
 2149:   Effets de bord : néant
 2150: ================================================================================
 2151: */
 2152: 
 2153: void
 2154: instruction_swistatus(struct_processus *s_etat_processus)
 2155: {
 2156:     int                         i;
 2157: 
 2158:     struct_liste_chainee        *l_element_courant;
 2159:     struct_liste_chainee        *l_element_futur;
 2160:     struct_liste_chainee        *l_element_liste;
 2161: 
 2162:     struct_objet                *s_objet_resultat;
 2163: 
 2164:     (*s_etat_processus).erreur_execution = d_ex;
 2165: 
 2166:     if ((*s_etat_processus).affichage_arguments == 'Y')
 2167:     {
 2168:         printf("\n  SWISTATUS ");
 2169: 
 2170:         if ((*s_etat_processus).langue == 'F')
 2171:         {
 2172:             printf("(état des interruptions logicielles)\n\n");
 2173:         }
 2174:         else
 2175:         {
 2176:             printf("(software interrupts status)\n\n");
 2177:         }
 2178: 
 2179:         printf("->  1: %s\n\n", d_LST);
 2180: 
 2181:         if ((*s_etat_processus).langue == 'F')
 2182:         {
 2183:             printf("  Utilisation :\n\n");
 2184:         }
 2185:         else
 2186:         {
 2187:             printf("  Usage:\n\n");
 2188:         }
 2189: 
 2190:         printf("    { { initialized interrupts }\n"
 2191:                 "      { unlocked interrupts }\n"
 2192:                 "      { queued interrupts }\n"
 2193:                 "      { locked interrupts } }\n");
 2194:         return;
 2195:     }
 2196:     else if ((*s_etat_processus).test_instruction == 'Y')
 2197:     {
 2198:         (*s_etat_processus).nombre_arguments = -1;
 2199:         return;
 2200:     }
 2201: 
 2202:     if (test_cfsf(s_etat_processus, 31) == d_vrai)
 2203:     {
 2204:         if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
 2205:         {
 2206:             return;
 2207:         }
 2208:     }
 2209: 
 2210:     if ((s_objet_resultat = allocation(s_etat_processus, LST)) == NULL)
 2211:     {
 2212:         (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 2213:         return;
 2214:     }
 2215: 
 2216:     if (((*s_objet_resultat).objet =
 2217:             allocation_maillon(s_etat_processus)) == NULL)
 2218:     {
 2219:         (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 2220:         return;
 2221:     }
 2222: 
 2223:     l_element_courant = (struct_liste_chainee *) (*s_objet_resultat).objet;
 2224: 
 2225:     if (((*l_element_courant).donnee = allocation(s_etat_processus, LST))
 2226:             == NULL)
 2227:     {
 2228:         (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 2229:         return;
 2230:     }
 2231: 
 2232:     l_element_liste = NULL;
 2233:     l_element_futur = NULL;
 2234: 
 2235:     for(i = 0; i < d_NOMBRE_INTERRUPTIONS; i++)
 2236:     {
 2237:         if ((*s_etat_processus).corps_interruptions[i] != NULL)
 2238:         {
 2239:             if (l_element_liste == NULL)
 2240:             {
 2241:                 if ((l_element_liste =
 2242:                         allocation_maillon(s_etat_processus)) == NULL)
 2243:                 {
 2244:                     (*s_etat_processus).erreur_systeme =
 2245:                             d_es_allocation_memoire;
 2246:                     return;
 2247:                 }
 2248: 
 2249:                 l_element_futur = l_element_liste;
 2250:             }
 2251:             else
 2252:             {
 2253:                 if (((*l_element_liste).suivant =
 2254:                         allocation_maillon(s_etat_processus)) == NULL)
 2255:                 {
 2256:                     (*s_etat_processus).erreur_systeme =
 2257:                             d_es_allocation_memoire;
 2258:                     return;
 2259:                 }
 2260: 
 2261:                 l_element_liste = (*l_element_liste).suivant;
 2262:             }
 2263: 
 2264:             (*l_element_liste).suivant = NULL;
 2265: 
 2266:             if (((*l_element_liste).donnee = allocation(s_etat_processus,
 2267:                     INT)) == NULL)
 2268:             {
 2269:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 2270:                 return;
 2271:             }
 2272: 
 2273:             (*((integer8 *) (*(*l_element_liste).donnee).objet)) = i + 1;
 2274:         }
 2275:     }
 2276: 
 2277:     (*(*l_element_courant).donnee).objet = l_element_futur;
 2278: 
 2279:     if (((*l_element_courant).suivant =
 2280:             allocation_maillon(s_etat_processus)) == NULL)
 2281:     {
 2282:         (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 2283:         return;
 2284:     }
 2285: 
 2286:     l_element_courant = (*l_element_courant).suivant;
 2287: 
 2288:     if (((*l_element_courant).donnee = allocation(s_etat_processus, LST))
 2289:             == NULL)
 2290:     {
 2291:         (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 2292:         return;
 2293:     }
 2294: 
 2295:     l_element_liste = NULL;
 2296:     l_element_futur = NULL;
 2297: 
 2298:     for(i = 0; i < d_NOMBRE_INTERRUPTIONS; i++)
 2299:     {
 2300:         if ((*s_etat_processus).masque_interruptions[i] == 'N')
 2301:         {
 2302:             if (l_element_liste == NULL)
 2303:             {
 2304:                 if ((l_element_liste =
 2305:                         allocation_maillon(s_etat_processus)) == NULL)
 2306:                 {
 2307:                     (*s_etat_processus).erreur_systeme =
 2308:                             d_es_allocation_memoire;
 2309:                     return;
 2310:                 }
 2311: 
 2312:                 l_element_futur = l_element_liste;
 2313:             }
 2314:             else
 2315:             {
 2316:                 if (((*l_element_liste).suivant =
 2317:                         allocation_maillon(s_etat_processus)) == NULL)
 2318:                 {
 2319:                     (*s_etat_processus).erreur_systeme =
 2320:                             d_es_allocation_memoire;
 2321:                     return;
 2322:                 }
 2323: 
 2324:                 l_element_liste = (*l_element_liste).suivant;
 2325:             }
 2326: 
 2327:             (*l_element_liste).suivant = NULL;
 2328: 
 2329:             if (((*l_element_liste).donnee = allocation(s_etat_processus,
 2330:                     INT)) == NULL)
 2331:             {
 2332:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 2333:                 return;
 2334:             }
 2335: 
 2336:             (*((integer8 *) (*(*l_element_liste).donnee).objet)) = i + 1;
 2337:         }
 2338:     }
 2339: 
 2340:     (*(*l_element_courant).donnee).objet = l_element_futur;
 2341: 
 2342:     if (((*l_element_courant).suivant = allocation_maillon(s_etat_processus))
 2343:             == NULL)
 2344:     {
 2345:         (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 2346:         return;
 2347:     }
 2348: 
 2349:     l_element_courant = (*l_element_courant).suivant;
 2350: 
 2351:     if (((*l_element_courant).donnee = allocation(s_etat_processus, LST))
 2352:             == NULL)
 2353:     {
 2354:         (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 2355:         return;
 2356:     }
 2357: 
 2358:     l_element_liste = NULL;
 2359:     l_element_futur = NULL;
 2360: 
 2361:     for(i = 0; i < d_NOMBRE_INTERRUPTIONS; i++)
 2362:     {
 2363:         if ((*s_etat_processus).masque_interruptions[i] == 'Q')
 2364:         {
 2365:             if (l_element_liste == NULL)
 2366:             {
 2367:                 if ((l_element_liste =
 2368:                         allocation_maillon(s_etat_processus)) == NULL)
 2369:                 {
 2370:                     (*s_etat_processus).erreur_systeme =
 2371:                             d_es_allocation_memoire;
 2372:                     return;
 2373:                 }
 2374: 
 2375:                 l_element_futur = l_element_liste;
 2376:             }
 2377:             else
 2378:             {
 2379:                 if (((*l_element_liste).suivant =
 2380:                         allocation_maillon(s_etat_processus)) == NULL)
 2381:                 {
 2382:                     (*s_etat_processus).erreur_systeme =
 2383:                             d_es_allocation_memoire;
 2384:                     return;
 2385:                 }
 2386: 
 2387:                 l_element_liste = (*l_element_liste).suivant;
 2388:             }
 2389: 
 2390:             (*l_element_liste).suivant = NULL;
 2391: 
 2392:             if (((*l_element_liste).donnee = allocation(s_etat_processus,
 2393:                     INT)) == NULL)
 2394:             {
 2395:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 2396:                 return;
 2397:             }
 2398: 
 2399:             (*((integer8 *) (*(*l_element_liste).donnee).objet)) = i + 1;
 2400:         }
 2401:     }
 2402: 
 2403:     (*(*l_element_courant).donnee).objet = l_element_futur;
 2404: 
 2405:     if (((*l_element_courant).suivant = allocation_maillon(s_etat_processus))
 2406:             == NULL)
 2407:     {
 2408:         (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 2409:         return;
 2410:     }
 2411: 
 2412:     l_element_courant = (*l_element_courant).suivant;
 2413: 
 2414:     if (((*l_element_courant).donnee = allocation(s_etat_processus, LST))
 2415:             == NULL)
 2416:     {
 2417:         (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 2418:         return;
 2419:     }
 2420: 
 2421:     l_element_liste = NULL;
 2422:     l_element_futur = NULL;
 2423: 
 2424:     for(i = 0; i < d_NOMBRE_INTERRUPTIONS; i++)
 2425:     {
 2426:         if ((*s_etat_processus).masque_interruptions[i] == 'I')
 2427:         {
 2428:             if (l_element_liste == NULL)
 2429:             {
 2430:                 if ((l_element_liste =
 2431:                         allocation_maillon(s_etat_processus)) == NULL)
 2432:                 {
 2433:                     (*s_etat_processus).erreur_systeme =
 2434:                             d_es_allocation_memoire;
 2435:                     return;
 2436:                 }
 2437: 
 2438:                 l_element_futur = l_element_liste;
 2439:             }
 2440:             else
 2441:             {
 2442:                 if (((*l_element_liste).suivant =
 2443:                         allocation_maillon(s_etat_processus)) == NULL)
 2444:                 {
 2445:                     (*s_etat_processus).erreur_systeme =
 2446:                             d_es_allocation_memoire;
 2447:                     return;
 2448:                 }
 2449: 
 2450:                 l_element_liste = (*l_element_liste).suivant;
 2451:             }
 2452: 
 2453:             (*l_element_liste).suivant = NULL;
 2454: 
 2455:             if (((*l_element_liste).donnee = allocation(s_etat_processus,
 2456:                     INT)) == NULL)
 2457:             {
 2458:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 2459:                 return;
 2460:             }
 2461: 
 2462:             (*((integer8 *) (*(*l_element_liste).donnee).objet)) = i + 1;
 2463:         }
 2464:     }
 2465: 
 2466:     (*(*l_element_courant).donnee).objet = l_element_futur;
 2467: 
 2468:     (*l_element_courant).suivant = NULL;
 2469: 
 2470:     if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
 2471:             s_objet_resultat) == d_erreur)
 2472:     {
 2473:         return;
 2474:     }
 2475: 
 2476:     return;
 2477: }
 2478: 
 2479: 
 2480: /*
 2481: ================================================================================
 2482:   Fonction 'swiunlock'
 2483: ================================================================================
 2484:   Entrées : structure processus
 2485: --------------------------------------------------------------------------------
 2486:   Sorties :
 2487: --------------------------------------------------------------------------------
 2488:   Effets de bord : néant
 2489: ================================================================================
 2490: */
 2491: 
 2492: void
 2493: instruction_swiunlock(struct_processus *s_etat_processus)
 2494: {
 2495:     integer8                    interruption;
 2496: 
 2497:     struct_liste_chainee        *l_element_courant;
 2498: 
 2499:     struct_objet                *s_objet_argument;
 2500: 
 2501:     (*s_etat_processus).erreur_execution = d_ex;
 2502: 
 2503:     if ((*s_etat_processus).affichage_arguments == 'Y')
 2504:     {
 2505:         printf("\n  SWIUNLOCK ");
 2506: 
 2507:         if ((*s_etat_processus).langue == 'F')
 2508:         {
 2509:             printf("(déverrouillage des interruptions logicielles)\n\n");
 2510:         }
 2511:         else
 2512:         {
 2513:             printf("(software interrupt unlock)\n\n");
 2514:         }
 2515: 
 2516:         printf("    1: %s, %s\n", d_INT, d_LST);
 2517: 
 2518:         return;
 2519:     }
 2520:     else if ((*s_etat_processus).test_instruction == 'Y')
 2521:     {
 2522:         (*s_etat_processus).nombre_arguments = -1;
 2523:         return;
 2524:     }
 2525: 
 2526:     if (test_cfsf(s_etat_processus, 31) == d_vrai)
 2527:     {
 2528:         if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
 2529:         {
 2530:             return;
 2531:         }
 2532:     }
 2533: 
 2534:     if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
 2535:             &s_objet_argument) == d_erreur)
 2536:     {
 2537:         (*s_etat_processus).erreur_execution = d_ex_manque_argument;
 2538:         return;
 2539:     }
 2540: 
 2541:     if ((*s_objet_argument).type == INT)
 2542:     {
 2543:         interruption = (*((integer8 *) (*s_objet_argument).objet));
 2544: 
 2545:         if ((interruption < 1) || (interruption > d_NOMBRE_INTERRUPTIONS))
 2546:         {
 2547:             liberation(s_etat_processus, s_objet_argument);
 2548: 
 2549:             (*s_etat_processus).erreur_execution = d_ex_interruption_invalide;
 2550:             return;
 2551:         }
 2552: 
 2553:         (*s_etat_processus).masque_interruptions[interruption - 1] = 'N';
 2554:     }
 2555:     else if ((*s_objet_argument).type == LST)
 2556:     {
 2557:         l_element_courant = (*s_objet_argument).objet;
 2558: 
 2559:         while(l_element_courant)
 2560:         {
 2561:             if ((*(*l_element_courant).donnee).type != INT)
 2562:             {
 2563:                 liberation(s_etat_processus, s_objet_argument);
 2564: 
 2565:                 (*s_etat_processus).erreur_execution =
 2566:                         d_ex_erreur_type_argument;
 2567:                 return;
 2568:             }
 2569: 
 2570:             interruption = (*((integer8 *) (*(*l_element_courant)
 2571:                     .donnee).objet));
 2572: 
 2573:             if ((interruption < 1) || (interruption > d_NOMBRE_INTERRUPTIONS))
 2574:             {
 2575:                 liberation(s_etat_processus, s_objet_argument);
 2576: 
 2577:                 (*s_etat_processus).erreur_execution =
 2578:                         d_ex_interruption_invalide;
 2579:                 return;
 2580:             }
 2581: 
 2582:             (*s_etat_processus).masque_interruptions[interruption - 1] = 'N';
 2583:             l_element_courant = (*l_element_courant).suivant;
 2584:         }
 2585:     }
 2586:     else
 2587:     {
 2588:         liberation(s_etat_processus, s_objet_argument);
 2589: 
 2590:         (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
 2591:         return;
 2592:     }
 2593: 
 2594:     liberation(s_etat_processus, s_objet_argument);
 2595: 
 2596:     return;
 2597: }
 2598: 
 2599: 
 2600: /*
 2601: ================================================================================
 2602:   Fonction 'swiqueue'
 2603: ================================================================================
 2604:   Entrées : structure processus
 2605: --------------------------------------------------------------------------------
 2606:   Sorties :
 2607: --------------------------------------------------------------------------------
 2608:   Effets de bord : néant
 2609: ================================================================================
 2610: */
 2611: 
 2612: void
 2613: instruction_swiqueue(struct_processus *s_etat_processus)
 2614: {
 2615:     integer8                    interruption;
 2616: 
 2617:     struct_liste_chainee        *l_element_courant;
 2618: 
 2619:     struct_objet                *s_objet_argument;
 2620: 
 2621:     (*s_etat_processus).erreur_execution = d_ex;
 2622: 
 2623:     if ((*s_etat_processus).affichage_arguments == 'Y')
 2624:     {
 2625:         printf("\n  SWIQUEUE ");
 2626: 
 2627:         if ((*s_etat_processus).langue == 'F')
 2628:         {
 2629:             printf("(enregistre des interruptions logicielles)\n\n");
 2630:         }
 2631:         else
 2632:         {
 2633:             printf("(software interrupt record)\n\n");
 2634:         }
 2635: 
 2636:         printf("    1: %s, %s\n", d_INT, d_LST);
 2637: 
 2638:         return;
 2639:     }
 2640:     else if ((*s_etat_processus).test_instruction == 'Y')
 2641:     {
 2642:         (*s_etat_processus).nombre_arguments = -1;
 2643:         return;
 2644:     }
 2645: 
 2646:     if (test_cfsf(s_etat_processus, 31) == d_vrai)
 2647:     {
 2648:         if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
 2649:         {
 2650:             return;
 2651:         }
 2652:     }
 2653: 
 2654:     if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
 2655:             &s_objet_argument) == d_erreur)
 2656:     {
 2657:         (*s_etat_processus).erreur_execution = d_ex_manque_argument;
 2658:         return;
 2659:     }
 2660: 
 2661:     if ((*s_objet_argument).type == INT)
 2662:     {
 2663:         interruption = (*((integer8 *) (*s_objet_argument).objet));
 2664: 
 2665:         if ((interruption < 1) || (interruption > d_NOMBRE_INTERRUPTIONS))
 2666:         {
 2667:             liberation(s_etat_processus, s_objet_argument);
 2668: 
 2669:             (*s_etat_processus).erreur_execution = d_ex_interruption_invalide;
 2670:             return;
 2671:         }
 2672: 
 2673:         (*s_etat_processus).masque_interruptions[interruption - 1] = 'Q';
 2674:     }
 2675:     else if ((*s_objet_argument).type == LST)
 2676:     {
 2677:         l_element_courant = (*s_objet_argument).objet;
 2678: 
 2679:         while(l_element_courant)
 2680:         {
 2681:             if ((*(*l_element_courant).donnee).type != INT)
 2682:             {
 2683:                 liberation(s_etat_processus, s_objet_argument);
 2684: 
 2685:                 (*s_etat_processus).erreur_execution =
 2686:                         d_ex_erreur_type_argument;
 2687:                 return;
 2688:             }
 2689: 
 2690:             interruption = (*((integer8 *) (*(*l_element_courant)
 2691:                     .donnee).objet));
 2692: 
 2693:             if ((interruption < 1) || (interruption > d_NOMBRE_INTERRUPTIONS))
 2694:             {
 2695:                 liberation(s_etat_processus, s_objet_argument);
 2696: 
 2697:                 (*s_etat_processus).erreur_execution =
 2698:                         d_ex_interruption_invalide;
 2699:                 return;
 2700:             }
 2701: 
 2702:             (*s_etat_processus).masque_interruptions[interruption - 1] = 'Q';
 2703:             l_element_courant = (*l_element_courant).suivant;
 2704:         }
 2705:     }
 2706:     else
 2707:     {
 2708:         liberation(s_etat_processus, s_objet_argument);
 2709: 
 2710:         (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
 2711:         return;
 2712:     }
 2713: 
 2714:     liberation(s_etat_processus, s_objet_argument);
 2715: 
 2716:     return;
 2717: }
 2718: 
 2719: 
 2720: /*
 2721: ================================================================================
 2722:   Fonction 'sched'
 2723: ================================================================================
 2724:   Entrées : structure processus
 2725: --------------------------------------------------------------------------------
 2726:   Sorties :
 2727: --------------------------------------------------------------------------------
 2728:   Effets de bord : néant
 2729: ================================================================================
 2730: */
 2731: 
 2732: void
 2733: instruction_sched(struct_processus *s_etat_processus)
 2734: {
 2735:     real8                       pourcentage;
 2736: 
 2737:     struct_objet                *s_objet_argument;
 2738: 
 2739:     (*s_etat_processus).erreur_execution = d_ex;
 2740: 
 2741:     if ((*s_etat_processus).affichage_arguments == 'Y')
 2742:     {
 2743:         printf("\n  SCHED ");
 2744: 
 2745:         if ((*s_etat_processus).langue == 'F')
 2746:         {
 2747:             printf("(limitation des ressources de calcul)\n\n");
 2748:         }
 2749:         else
 2750:         {
 2751:             printf("(CPU ressources limitation)\n\n");
 2752:         }
 2753: 
 2754:         printf("    1: %s, %s\n", d_INT, d_REL);
 2755: 
 2756:         return;
 2757:     }
 2758:     else if ((*s_etat_processus).test_instruction == 'Y')
 2759:     {
 2760:         (*s_etat_processus).nombre_arguments = -1;
 2761:         return;
 2762:     }
 2763: 
 2764:     if (test_cfsf(s_etat_processus, 31) == d_vrai)
 2765:     {
 2766:         if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
 2767:         {
 2768:             return;
 2769:         }
 2770:     }
 2771: 
 2772:     if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
 2773:             &s_objet_argument) == d_erreur)
 2774:     {
 2775:         (*s_etat_processus).erreur_execution = d_ex_manque_argument;
 2776:         return;
 2777:     }
 2778: 
 2779:     if ((*s_objet_argument).type == INT)
 2780:     {
 2781:         pourcentage = (real8) (*((integer8 *) (*s_objet_argument).objet));
 2782:     }
 2783:     else if ((*s_objet_argument).type == REL)
 2784:     {
 2785:         pourcentage = (*((real8 *) (*s_objet_argument).objet));
 2786:     }
 2787:     else
 2788:     {
 2789:         liberation(s_etat_processus, s_objet_argument);
 2790: 
 2791:         (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
 2792:         return;
 2793:     }
 2794: 
 2795:     liberation(s_etat_processus, s_objet_argument);
 2796: 
 2797:     if ((pourcentage <= 0) || (pourcentage > 100))
 2798:     {
 2799:         (*s_etat_processus).erreur_execution = d_ex_argument_invalide;
 2800:         return;
 2801:     }
 2802: 
 2803:     (*s_etat_processus).pourcentage_maximal_cpu = pourcentage;
 2804: 
 2805:     return;
 2806: }
 2807: 
 2808: // vim: ts=4

CVSweb interface <joel.bertrand@systella.fr>