File:  [local] / rpl / src / instructions_s5.c
Revision 1.16.2.1: download - view: text, annotated - select for diffs - revision graph
Mon Apr 11 13:02:25 2011 UTC (13 years ago) by bertrand
Branches: rpl-4_0
CVS tags: rpl-4_0_22
Diff to: branchpoint 1.16: preferred, colored
En route vers la 4.0.22.

    1: /*
    2: ================================================================================
    3:   RPL/2 (R) version 4.0.22
    4:   Copyright (C) 1989-2011 Dr. BERTRAND Joël
    5: 
    6:   This file is part of RPL/2.
    7: 
    8:   RPL/2 is free software; you can redistribute it and/or modify it
    9:   under the terms of the CeCILL V2 License as published by the french
   10:   CEA, CNRS and INRIA.
   11:  
   12:   RPL/2 is distributed in the hope that it will be useful, but WITHOUT
   13:   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   14:   FITNESS FOR A PARTICULAR PURPOSE.  See the CeCILL V2 License
   15:   for more details.
   16:  
   17:   You should have received a copy of the CeCILL License
   18:   along with RPL/2. If not, write to info@cecill.info.
   19: ================================================================================
   20: */
   21: 
   22: 
   23: #include "rpl-conv.h"
   24: 
   25: 
   26: /*
   27: ================================================================================
   28:   Fonction 's+'
   29: ================================================================================
   30:   Entrées : structure processus
   31: --------------------------------------------------------------------------------
   32:   Sorties :
   33: --------------------------------------------------------------------------------
   34:   Effets de bord : néant
   35: ================================================================================
   36: */
   37: 
   38: void
   39: instruction_s_plus(struct_processus *s_etat_processus)
   40: {
   41:     long                                i;
   42: 
   43:     logical1                            creation_variable_sigma;
   44:     logical1                            presence_variable;
   45: 
   46:     struct_objet                        *s_copie;
   47:     struct_objet                        *s_copie_statistique;
   48:     struct_objet                        *s_objet;
   49:     struct_objet                        *s_objet_statistique;
   50: 
   51:     struct_variable                     s_variable;
   52: 
   53:     unsigned long                       j;
   54:     unsigned long                       k;
   55:     unsigned long                       nombre_colonnes;
   56:     unsigned long                       nombre_lignes;
   57: 
   58:     void                                *tampon;
   59: 
   60:     (*s_etat_processus).erreur_execution = d_ex;
   61: 
   62:     if ((*s_etat_processus).affichage_arguments == 'Y')
   63:     {
   64:         printf("\n  S+ ");
   65: 
   66:         if ((*s_etat_processus).langue == 'F')
   67:         {
   68:             printf("(ajout d'une donnée dans la matrice statistique)\n\n");
   69:         }
   70:         else
   71:         {
   72:             printf("(add a data value in statistical matrix)\n\n");
   73:         }
   74: 
   75:         printf("    1: %s, %s, %s, %s, %s, %s\n", d_INT, d_REL, d_VIN, d_VRL,
   76:                 d_MIN, d_MRL);
   77: 
   78:         return;
   79:     }
   80:     else if ((*s_etat_processus).test_instruction == 'Y')
   81:     {
   82:         (*s_etat_processus).nombre_arguments = -1;
   83:         return;
   84:     }
   85:     
   86:     if (test_cfsf(s_etat_processus, 31) == d_vrai)
   87:     {
   88:         if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
   89:         {
   90:             return;
   91:         }
   92:     }
   93: 
   94:     /*
   95:      * Recherche d'une variable globale référencée par SIGMA
   96:      */
   97: 
   98:     if (recherche_variable(s_etat_processus, ds_sdat) == d_faux)
   99:     {
  100:         /*
  101:          * Aucune variable SIGMA, donc il faut la créer en fonction
  102:          * de l'objet à introduire.
  103:          */
  104: 
  105:         (*s_etat_processus).erreur_systeme = d_es;
  106:         creation_variable_sigma = d_vrai;
  107:         nombre_colonnes = 0;
  108:     }
  109:     else
  110:     {
  111:         /*
  112:          * Il existe une variable locale SIGMA. Reste à vérifier l'existence
  113:          * d'une variable SIGMA globale...
  114:          */
  115: 
  116:         i = (*s_etat_processus).position_variable_courante;
  117:         presence_variable = d_faux;
  118: 
  119:         while(i >= 0)
  120:         {
  121:             if ((strcmp((*s_etat_processus).s_liste_variables[i].nom,
  122:                     ds_sdat) == 0) && ((*s_etat_processus)
  123:                     .s_liste_variables[i].niveau == 1))
  124:             {
  125:                 presence_variable = d_vrai;
  126:                 break;
  127:             }
  128: 
  129:             i--;
  130:         }
  131: 
  132:         if (presence_variable == d_faux)
  133:         {
  134:             creation_variable_sigma = d_vrai;
  135:             nombre_colonnes = 0;
  136:         }
  137:         else
  138:         {
  139:             creation_variable_sigma = d_faux;
  140: 
  141:             (*s_etat_processus).position_variable_courante = i;
  142: 
  143:             if ((*s_etat_processus).s_liste_variables[(*s_etat_processus)
  144:                     .position_variable_courante].variable_verrouillee ==
  145:                     d_vrai)
  146:             {
  147:                 (*s_etat_processus).erreur_execution =
  148:                         d_ex_variable_verrouillee;
  149:                 return;
  150:             }
  151: 
  152:             if ((*s_etat_processus).s_liste_variables[i].objet == NULL)
  153:             {
  154:                 (*s_etat_processus).erreur_execution = d_ex_variable_partagee;
  155:                 return;
  156:             }
  157: 
  158:             if (((*((*s_etat_processus).s_liste_variables
  159:                     [(*s_etat_processus).position_variable_courante].objet))
  160:                     .type != MIN) && ((*((*s_etat_processus)
  161:                     .s_liste_variables[(*s_etat_processus)
  162:                     .position_variable_courante].objet)).type != MRL))
  163:             {
  164:                 (*s_etat_processus).erreur_execution =
  165:                         d_ex_matrice_statistique_invalide;
  166:                 return;
  167:             }
  168: 
  169:             if ((s_copie_statistique = copie_objet(s_etat_processus,
  170:                     (*s_etat_processus)
  171:                     .s_liste_variables[(*s_etat_processus)
  172:                     .position_variable_courante].objet, 'Q')) == NULL)
  173:             {
  174:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
  175:                 return;
  176:             }
  177: 
  178:             liberation(s_etat_processus, (*s_etat_processus).s_liste_variables
  179:                     [(*s_etat_processus).position_variable_courante].objet);
  180:             (*s_etat_processus).s_liste_variables[(*s_etat_processus)
  181:                     .position_variable_courante].objet = s_copie_statistique;
  182: 
  183:             nombre_colonnes = (*((struct_matrice *) (*((*s_etat_processus)
  184:                     .s_liste_variables[(*s_etat_processus)
  185:                     .position_variable_courante].objet)).objet))
  186:                     .nombre_colonnes;
  187:         }
  188:     }
  189: 
  190:     if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
  191:             &s_objet) == d_erreur)
  192:     {
  193:         (*s_etat_processus).erreur_execution = d_ex_manque_argument;
  194:         return;
  195:     }
  196: 
  197:     if ((s_copie = copie_objet(s_etat_processus, s_objet, 'O')) == NULL)
  198:     {
  199:         (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
  200:         return;
  201:     }
  202: 
  203:     liberation(s_etat_processus, s_objet);
  204:     s_objet = s_copie;
  205: 
  206:     /*
  207:      * Ajout d'un scalaire
  208:      */
  209: 
  210:     if (((*s_objet).type == INT) ||
  211:             ((*s_objet).type == REL))
  212:     {
  213:         if (creation_variable_sigma == d_vrai)
  214:         {
  215:             /*
  216:              * Création d'une matrice statistique 1*1
  217:              */
  218: 
  219:             if ((s_variable.nom = malloc(6 * sizeof(unsigned char))) == NULL)
  220:             {
  221:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
  222:                 return;
  223:             }
  224: 
  225:             strcpy(s_variable.nom, ds_sdat);
  226:             s_variable.niveau = 1;
  227: 
  228:             if ((*s_objet).type == INT)
  229:             {
  230:                 if ((s_objet_statistique = allocation(s_etat_processus, MIN))
  231:                         == NULL)
  232:                 {
  233:                     (*s_etat_processus).erreur_systeme =
  234:                             d_es_allocation_memoire;
  235:                     return;
  236:                 }
  237: 
  238:                 if (((*((struct_matrice *) (*s_objet_statistique).objet))
  239:                         .tableau = malloc(sizeof(integer8 *))) == NULL)
  240:                 {
  241:                     (*s_etat_processus).erreur_systeme =
  242:                             d_es_allocation_memoire;
  243:                     return;
  244:                 }
  245: 
  246:                 ((integer8 **) (*((struct_matrice *) (*s_objet_statistique)
  247:                         .objet)).tableau)[0] = (integer8 *) (*s_objet).objet;
  248:             }
  249:             else
  250:             {
  251:                 if ((s_objet_statistique = allocation(s_etat_processus, MRL))
  252:                         == NULL)
  253:                 {
  254:                     (*s_etat_processus).erreur_systeme =
  255:                             d_es_allocation_memoire;
  256:                     return;
  257:                 }
  258: 
  259:                 if (((*((struct_matrice *) (*s_objet_statistique).objet))
  260:                         .tableau = malloc(sizeof(real8 *))) == NULL)
  261:                 {
  262:                     (*s_etat_processus).erreur_systeme =
  263:                             d_es_allocation_memoire;
  264:                     return;
  265:                 }
  266: 
  267:                 ((real8 **) (*((struct_matrice *) (*s_objet_statistique)
  268:                         .objet)).tableau)[0] = (real8 *) (*s_objet).objet;
  269:             }
  270: 
  271:             (*((struct_matrice *) (*s_objet_statistique).objet))
  272:                     .nombre_colonnes = 1;
  273:             (*((struct_matrice *) (*s_objet_statistique).objet))
  274:                     .nombre_lignes = 1;
  275: 
  276:             free(s_objet);
  277:             s_objet = NULL;
  278: 
  279:             s_variable.objet = s_objet_statistique;
  280: 
  281:             if (creation_variable(s_etat_processus, &s_variable, 'V', 'P')
  282:                     == d_erreur)
  283:             {
  284:                 return;
  285:             }
  286:         }
  287:         else
  288:         {
  289:             /*
  290:              * La variable existe déjà, il faut lui rajouter une ligne.
  291:              */
  292: 
  293:             if (nombre_colonnes != 1)
  294:             {
  295:                 (*s_etat_processus).erreur_execution =
  296:                         d_ex_dimensions_matrice_statistique;
  297: 
  298:                 liberation(s_etat_processus, s_objet);
  299:                 return;
  300:             }
  301: 
  302:             s_objet_statistique = ((*s_etat_processus).s_liste_variables
  303:                     [(*s_etat_processus).position_variable_courante]).objet;
  304: 
  305:             if (((*s_objet_statistique).type == MIN) &&
  306:                     ((*s_objet).type == INT))
  307:             {
  308:                 tampon = (*((struct_matrice *) (*s_objet_statistique).objet))
  309:                         .tableau;
  310:                 (*((struct_matrice *) (*s_objet_statistique).objet))
  311:                         .nombre_lignes++;
  312: 
  313:                 if (((*((struct_matrice *) (*s_objet_statistique).objet))
  314:                         .tableau = malloc((*((struct_matrice *)
  315:                         (*s_objet_statistique).objet)).nombre_lignes *
  316:                         sizeof(integer8 *))) == NULL)
  317:                 {
  318:                     (*s_etat_processus).erreur_systeme =
  319:                             d_es_allocation_memoire;
  320:                     return;
  321:                 }
  322: 
  323:                 for(i = 0; i < (long) ((*((struct_matrice *)
  324:                         (*s_objet_statistique).objet)).nombre_lignes - 1); i++)
  325:                 {
  326:                     ((integer8 **) (*((struct_matrice *) (*s_objet_statistique)
  327:                             .objet)).tableau)[i] = ((integer8 **) tampon)[i];
  328:                 }
  329: 
  330:                 free(tampon);
  331: 
  332:                 ((integer8 **) (*((struct_matrice *) (*s_objet_statistique)
  333:                         .objet)).tableau)[i] = (integer8 *) (*s_objet).objet;
  334: 
  335:                 free(s_objet);
  336:                 s_objet = NULL;
  337:             }
  338:             else if (((*s_objet_statistique).type == MRL) &&
  339:                     ((*s_objet).type == REL))
  340:             {
  341:                 tampon = (*((struct_matrice *) (*s_objet_statistique).objet))
  342:                         .tableau;
  343:                 (*((struct_matrice *) (*s_objet_statistique).objet))
  344:                         .nombre_lignes++;
  345: 
  346:                 if (((*((struct_matrice *) (*s_objet_statistique).objet))
  347:                         .tableau = malloc((*((struct_matrice *)
  348:                         (*s_objet_statistique).objet)).nombre_lignes *
  349:                         sizeof(real8 *))) == NULL)
  350:                 {
  351:                     (*s_etat_processus).erreur_systeme =
  352:                             d_es_allocation_memoire;
  353:                     return;
  354:                 }
  355: 
  356:                 for(i = 0; i < (long) ((*((struct_matrice *)
  357:                         (*s_objet_statistique).objet)).nombre_lignes - 1); i++)
  358:                 {
  359:                     ((real8 **) (*((struct_matrice *) (*s_objet_statistique)
  360:                             .objet)).tableau)[i] = ((real8 **) tampon)[i];
  361:                 }
  362: 
  363:                 free(tampon);
  364: 
  365:                 ((real8 **) (*((struct_matrice *) (*s_objet_statistique)
  366:                         .objet)).tableau)[i] = (real8 *) (*s_objet).objet;
  367: 
  368:                 free(s_objet);
  369:                 s_objet = NULL;
  370:             }
  371:             else if (((*s_objet_statistique).type == MRL) &&
  372:                     ((*s_objet).type == INT))
  373:             {
  374:                 tampon = (*((struct_matrice *) (*s_objet_statistique).objet))
  375:                         .tableau;
  376:                 (*((struct_matrice *) (*s_objet_statistique).objet))
  377:                         .nombre_lignes++;
  378: 
  379:                 if (((*((struct_matrice *) (*s_objet_statistique).objet))
  380:                         .tableau = malloc((*((struct_matrice *)
  381:                         (*s_objet_statistique).objet)).nombre_lignes *
  382:                         sizeof(real8 *))) == NULL)
  383:                 {
  384:                     (*s_etat_processus).erreur_systeme =
  385:                             d_es_allocation_memoire;
  386:                     return;
  387:                 }
  388: 
  389:                 for(i = 0; i < (long) ((*((struct_matrice *)
  390:                         (*s_objet_statistique).objet)).nombre_lignes - 1); i++)
  391:                 {
  392:                     ((real8 **) (*((struct_matrice *) (*s_objet_statistique)
  393:                             .objet)).tableau)[i] = ((real8 **) tampon)[i];
  394:                 }
  395: 
  396:                 free(tampon);
  397: 
  398:                 if ((((real8 **) (*((struct_matrice *) (*s_objet_statistique)
  399:                         .objet)).tableau)[i] = malloc(sizeof(real8)))
  400:                         == NULL)
  401:                 {
  402:                     (*s_etat_processus).erreur_systeme =
  403:                             d_es_allocation_memoire;
  404:                     return;
  405:                 }
  406: 
  407:                 ((real8 **) (*((struct_matrice *) (*s_objet_statistique)
  408:                         .objet)).tableau)[i][0] =
  409:                         (real8) (*((integer8 *) (*s_objet).objet));
  410:             }
  411:             else
  412:             {
  413:                 tampon = (*((struct_matrice *) (*s_objet_statistique).objet))
  414:                         .tableau;
  415:                 (*((struct_matrice *) (*s_objet_statistique).objet))
  416:                         .nombre_lignes++;
  417: 
  418:                 if (((*((struct_matrice *) (*s_objet_statistique).objet))
  419:                         .tableau = malloc((*((struct_matrice *)
  420:                         (*s_objet_statistique).objet)).nombre_lignes *
  421:                         sizeof(real8 *))) == NULL)
  422:                 {
  423:                     (*s_etat_processus).erreur_systeme =
  424:                             d_es_allocation_memoire;
  425:                     return;
  426:                 }
  427: 
  428:                 for(i = 0; i < (long) ((*((struct_matrice *)
  429:                         (*s_objet_statistique).objet)).nombre_lignes - 1); i++)
  430:                 {
  431:                     if ((((real8 **) (*((struct_matrice *)
  432:                             (*s_objet_statistique).objet)).tableau)[i] =
  433:                             malloc(sizeof(real8))) == NULL)
  434:                     {
  435:                         (*s_etat_processus).erreur_systeme =
  436:                                 d_es_allocation_memoire;
  437:                         return;
  438:                     }
  439: 
  440:                     ((real8 **) (*((struct_matrice *) (*s_objet_statistique)
  441:                             .objet)).tableau)[i][0] = (real8)
  442:                             ((integer8 **) tampon)[i][0];
  443: 
  444:                     free(((integer8 **) tampon)[i]);
  445:                 }
  446: 
  447:                 if ((((real8 **) (*((struct_matrice *) (*s_objet_statistique)
  448:                         .objet)).tableau)[i] = malloc(sizeof(real8)))
  449:                         == NULL)
  450:                 {
  451:                     (*s_etat_processus).erreur_systeme =
  452:                             d_es_allocation_memoire;
  453:                     return;
  454:                 }
  455: 
  456:                 ((real8 **) (*((struct_matrice *) (*s_objet_statistique)
  457:                         .objet)).tableau)[i][0] = (*((real8 *)
  458:                         (*s_objet).objet));
  459: 
  460:                 (*((struct_matrice *) (*s_objet_statistique).objet)).type = 'R';
  461:                 (*s_objet_statistique).type = MRL;
  462: 
  463:                 free(tampon);
  464:             }
  465:         }
  466:     }
  467: 
  468:     /*
  469:      * Ajout d'un vecteur
  470:      */
  471: 
  472:     else if (((*s_objet).type == VIN) ||
  473:             ((*s_objet).type == VRL))
  474:     {
  475:         if (creation_variable_sigma == d_vrai)
  476:         {
  477:             /*
  478:              * Création d'une matrice statistique 1*NC
  479:              */
  480: 
  481:             if ((s_variable.nom = malloc(6 * sizeof(unsigned char))) == NULL)
  482:             {
  483:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
  484:                 return;
  485:             }
  486: 
  487:             strcpy(s_variable.nom, ds_sdat);
  488:             s_variable.niveau = 1;
  489: 
  490:             if ((*s_objet).type == VIN)
  491:             {
  492:                 if ((s_objet_statistique = allocation(s_etat_processus, MIN))
  493:                         == NULL)
  494:                 {
  495:                     (*s_etat_processus).erreur_systeme =
  496:                             d_es_allocation_memoire;
  497:                     return;
  498:                 }
  499: 
  500:                 if (((*((struct_matrice *) (*s_objet_statistique).objet))
  501:                         .tableau = malloc(sizeof(integer8 **))) == NULL)
  502:                 {
  503:                     (*s_etat_processus).erreur_systeme =
  504:                             d_es_allocation_memoire;
  505:                     return;
  506:                 }
  507: 
  508:                 ((integer8 **) (*((struct_matrice *) (*s_objet_statistique)
  509:                         .objet)).tableau)[0] = (*((struct_vecteur *)
  510:                         (*s_objet).objet)).tableau;
  511:             }
  512:             else
  513:             {
  514:                 if ((s_objet_statistique = allocation(s_etat_processus, MRL))
  515:                         == NULL)
  516:                 {
  517:                     (*s_etat_processus).erreur_systeme =
  518:                             d_es_allocation_memoire;
  519:                     return;
  520:                 }
  521: 
  522:                 if (((*((struct_matrice *) (*s_objet_statistique).objet))
  523:                         .tableau = malloc(sizeof(real8 **))) == NULL)
  524:                 {
  525:                     (*s_etat_processus).erreur_systeme =
  526:                             d_es_allocation_memoire;
  527:                     return;
  528:                 }
  529: 
  530:                 ((real8 **) (*((struct_matrice *) (*s_objet_statistique)
  531:                         .objet)).tableau)[0] = (*((struct_vecteur *)
  532:                         (*s_objet).objet)).tableau;
  533:             }
  534: 
  535:             (*((struct_matrice *) (*s_objet_statistique).objet))
  536:                     .nombre_colonnes = (*((struct_vecteur *) (*s_objet).objet))
  537:                     .taille;
  538:             (*((struct_matrice *) (*s_objet_statistique).objet))
  539:                     .nombre_lignes = 1;
  540: 
  541:             free((struct_vecteur *) (*s_objet).objet);
  542:             free(s_objet);
  543:             s_objet = NULL;
  544: 
  545:             s_variable.objet = s_objet_statistique;
  546: 
  547:             if (creation_variable(s_etat_processus, &s_variable, 'V', 'P')
  548:                     == d_erreur)
  549:             {
  550:                 return;
  551:             }
  552:         }
  553:         else
  554:         {
  555:             /*
  556:              * La variable existe déjà, il faut lui rajouter une ligne.
  557:              */
  558: 
  559:             if (nombre_colonnes != (*((struct_vecteur *) (*s_objet).objet))
  560:                     .taille)
  561:             {
  562:                 (*s_etat_processus).erreur_execution =
  563:                         d_ex_dimensions_matrice_statistique;
  564: 
  565:                 liberation(s_etat_processus, s_objet);
  566:                 return;
  567:             }
  568: 
  569:             s_objet_statistique = ((*s_etat_processus).s_liste_variables
  570:                     [(*s_etat_processus).position_variable_courante]).objet;
  571: 
  572:             if (((*s_objet_statistique).type == MIN) &&
  573:                     ((*s_objet).type == VIN))
  574:             {
  575:                 tampon = (*((struct_matrice *) (*s_objet_statistique).objet))
  576:                         .tableau;
  577:                 (*((struct_matrice *) (*s_objet_statistique).objet))
  578:                         .nombre_lignes++;
  579: 
  580:                 if (((*((struct_matrice *) (*s_objet_statistique).objet))
  581:                         .tableau = malloc((*((struct_matrice *)
  582:                         (*s_objet_statistique).objet)).nombre_lignes *
  583:                         sizeof(integer8 *))) == NULL)
  584:                 {
  585:                     (*s_etat_processus).erreur_systeme =
  586:                             d_es_allocation_memoire;
  587:                     return;
  588:                 }
  589: 
  590:                 for(i = 0; i < (long) ((*((struct_matrice *)
  591:                         (*s_objet_statistique).objet)).nombre_lignes - 1); i++)
  592:                 {
  593:                     ((integer8 **) (*((struct_matrice *) (*s_objet_statistique)
  594:                             .objet)).tableau)[i] = ((integer8 **) tampon)[i];
  595:                 }
  596: 
  597:                 free(tampon);
  598: 
  599:                 ((integer8 **) (*((struct_matrice *) (*s_objet_statistique)
  600:                         .objet)).tableau)[i] = (integer8 *)
  601:                         (*((struct_vecteur *) (*s_objet).objet)).tableau;
  602: 
  603:                 free((struct_vecteur *) (*s_objet).objet);
  604:                 free(s_objet);
  605:                 s_objet = NULL;
  606:             }
  607:             else if (((*s_objet_statistique).type == MRL) &&
  608:                     ((*s_objet).type == VRL))
  609:             {
  610:                 tampon = (*((struct_matrice *) (*s_objet_statistique).objet))
  611:                         .tableau;
  612:                 (*((struct_matrice *) (*s_objet_statistique).objet))
  613:                         .nombre_lignes++;
  614: 
  615:                 if (((*((struct_matrice *) (*s_objet_statistique).objet))
  616:                         .tableau = malloc((*((struct_matrice *)
  617:                         (*s_objet_statistique).objet)).nombre_lignes *
  618:                         sizeof(real8 *))) == NULL)
  619:                 {
  620:                     (*s_etat_processus).erreur_systeme =
  621:                             d_es_allocation_memoire;
  622:                     return;
  623:                 }
  624: 
  625:                 for(i = 0; i < (long) ((*((struct_matrice *)
  626:                         (*s_objet_statistique).objet)).nombre_lignes - 1); i++)
  627:                 {
  628:                     ((real8 **) (*((struct_matrice *) (*s_objet_statistique)
  629:                             .objet)).tableau)[i] = ((real8 **) tampon)[i];
  630:                 }
  631: 
  632:                 free(tampon);
  633: 
  634:                 ((real8 **) (*((struct_matrice *) (*s_objet_statistique)
  635:                         .objet)).tableau)[i] = (real8 *)
  636:                         (*((struct_vecteur *) (*s_objet).objet)).tableau;
  637: 
  638:                 free((struct_vecteur *) (*s_objet).objet);
  639:                 free(s_objet);
  640:                 s_objet = NULL;
  641:             }
  642:             else if (((*s_objet_statistique).type == MRL) &&
  643:                     ((*s_objet).type == VIN))
  644:             {
  645:                 tampon = (*((struct_matrice *) (*s_objet_statistique).objet))
  646:                         .tableau;
  647:                 (*((struct_matrice *) (*s_objet_statistique).objet))
  648:                         .nombre_lignes++;
  649: 
  650:                 if (((*((struct_matrice *) (*s_objet_statistique).objet))
  651:                         .tableau = malloc((*((struct_matrice *)
  652:                         (*s_objet_statistique).objet)).nombre_lignes *
  653:                         sizeof(real8 *))) == NULL)
  654:                 {
  655:                     (*s_etat_processus).erreur_systeme =
  656:                             d_es_allocation_memoire;
  657:                     return;
  658:                 }
  659: 
  660:                 for(i = 0; i < (long) ((*((struct_matrice *)
  661:                         (*s_objet_statistique).objet)).nombre_lignes - 1); i++)
  662:                 {
  663:                     ((real8 **) (*((struct_matrice *) (*s_objet_statistique)
  664:                             .objet)).tableau)[i] = ((real8 **) tampon)[i];
  665:                 }
  666: 
  667:                 free(tampon);
  668: 
  669:                 if ((((real8 **) (*((struct_matrice *) (*s_objet_statistique)
  670:                         .objet)).tableau)[i] =
  671:                         malloc(nombre_colonnes * sizeof(real8))) == NULL)
  672:                 {
  673:                     (*s_etat_processus).erreur_systeme =
  674:                             d_es_allocation_memoire;
  675:                     return;
  676:                 }
  677: 
  678:                 for(j = 0; j < nombre_colonnes; j++)
  679:                 {
  680:                     ((real8 **) (*((struct_matrice *) (*s_objet_statistique)
  681:                             .objet)).tableau)[i][j] =
  682:                             (real8) (((integer8 *) (*((struct_vecteur *)
  683:                             (*s_objet).objet)).tableau)[j]);
  684:                 }
  685:             }
  686:             else
  687:             {
  688:                 tampon = (*((struct_matrice *) (*s_objet_statistique).objet))
  689:                         .tableau;
  690:                 (*((struct_matrice *) (*s_objet_statistique).objet))
  691:                         .nombre_lignes++;
  692: 
  693:                 if (((*((struct_matrice *) (*s_objet_statistique).objet))
  694:                         .tableau = malloc((*((struct_matrice *)
  695:                         (*s_objet_statistique).objet)).nombre_lignes *
  696:                         sizeof(real8 *))) == NULL)
  697:                 {
  698:                     (*s_etat_processus).erreur_systeme =
  699:                             d_es_allocation_memoire;
  700:                     return;
  701:                 }
  702: 
  703:                 for(i = 0; i < (long) ((*((struct_matrice *)
  704:                         (*s_objet_statistique).objet)).nombre_lignes - 1); i++)
  705:                 {
  706:                     if ((((real8 **) (*((struct_matrice *)
  707:                             (*s_objet_statistique).objet)).tableau)[i] =
  708:                             malloc(nombre_colonnes * sizeof(real8))) == NULL)
  709:                     {
  710:                         (*s_etat_processus).erreur_systeme =
  711:                                 d_es_allocation_memoire;
  712:                         return;
  713:                     }
  714: 
  715:                     for(j = 0; j < nombre_colonnes; j++)
  716:                     {
  717:                         ((real8 **) (*((struct_matrice *) (*s_objet_statistique)
  718:                                 .objet)).tableau)[i][j] = (real8)
  719:                                 ((integer8 **) tampon)[i][j];
  720:                     }
  721: 
  722:                     free(((integer8 **) tampon)[i]);
  723:                 }
  724: 
  725:                 free(tampon);
  726: 
  727:                 ((real8 **) (*((struct_matrice *) (*s_objet_statistique)
  728:                         .objet)).tableau)[i] = (real8 *) (*((struct_vecteur *)
  729:                         (*s_objet).objet)).tableau;
  730: 
  731:                 free((struct_vecteur *) (*s_objet).objet);
  732:                 free(s_objet);
  733:                 s_objet = NULL;
  734: 
  735:                 (*((struct_matrice *) (*s_objet_statistique).objet)).type = 'R';
  736:                 (*s_objet_statistique).type = MRL;
  737:             }
  738:         }
  739:     }
  740: 
  741:     /*
  742:      * Ajout d'une matrice
  743:      */
  744: 
  745:     else if (((*s_objet).type == MIN) ||
  746:             ((*s_objet).type == MRL))
  747:     {
  748:         if (creation_variable_sigma == d_vrai)
  749:         {
  750:             /*
  751:              * Création d'une matrice statistique NL*NC
  752:              */
  753: 
  754:             if ((s_variable.nom = malloc(6 * sizeof(unsigned char))) == NULL)
  755:             {
  756:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
  757:                 return;
  758:             }
  759: 
  760:             strcpy(s_variable.nom, ds_sdat);
  761:             s_variable.niveau = 1;
  762: 
  763:             if ((*s_objet).type == MIN)
  764:             {
  765:                 if ((s_objet_statistique = allocation(s_etat_processus, MIN))
  766:                         == NULL)
  767:                 {
  768:                     (*s_etat_processus).erreur_systeme =
  769:                             d_es_allocation_memoire;
  770:                     return;
  771:                 }
  772: 
  773:                 (*s_objet_statistique).objet = (*s_objet).objet;
  774:             }
  775:             else
  776:             {
  777:                 if ((s_objet_statistique = allocation(s_etat_processus, MRL))
  778:                         == NULL)
  779:                 {
  780:                     (*s_etat_processus).erreur_systeme =
  781:                             d_es_allocation_memoire;
  782:                     return;
  783:                 }
  784: 
  785:                 (*s_objet_statistique).objet = (*s_objet).objet;
  786:             }
  787: 
  788:             free(s_objet);
  789:             s_objet = NULL;
  790: 
  791:             s_variable.objet = s_objet_statistique;
  792: 
  793:             if (creation_variable(s_etat_processus, &s_variable, 'V', 'P')
  794:                     == d_erreur)
  795:             {
  796:                 return;
  797:             }
  798:         }
  799:         else
  800:         {
  801:             /*
  802:              * La variable existe déjà, il faut lui rajouter le nombre
  803:              * de lignes de la matrice passée en argument.
  804:              */
  805: 
  806:             if (nombre_colonnes != (*((struct_matrice *) (*s_objet).objet))
  807:                     .nombre_colonnes)
  808:             {
  809:                 (*s_etat_processus).erreur_execution =
  810:                         d_ex_dimensions_matrice_statistique;
  811: 
  812:                 liberation(s_etat_processus, s_objet);
  813:                 return;
  814:             }
  815: 
  816:             s_objet_statistique = ((*s_etat_processus).s_liste_variables
  817:                     [(*s_etat_processus).position_variable_courante]).objet;
  818: 
  819:             nombre_lignes = (*((struct_matrice *) (*s_objet).objet))
  820:                     .nombre_lignes;
  821: 
  822:             if (((*s_objet_statistique).type == MIN) &&
  823:                     ((*s_objet).type == MIN))
  824:             {
  825:                 tampon = (*((struct_matrice *) (*s_objet_statistique).objet))
  826:                         .tableau;
  827:                 (*((struct_matrice *) (*s_objet_statistique).objet))
  828:                         .nombre_lignes += nombre_lignes;
  829: 
  830:                 if (((*((struct_matrice *) (*s_objet_statistique).objet))
  831:                         .tableau = malloc((*((struct_matrice *)
  832:                         (*s_objet_statistique).objet)).nombre_lignes *
  833:                         sizeof(integer8 *))) == NULL)
  834:                 {
  835:                     (*s_etat_processus).erreur_systeme =
  836:                             d_es_allocation_memoire;
  837:                     return;
  838:                 }
  839: 
  840:                 for(i = 0; i < (long) ((*((struct_matrice *)
  841:                         (*s_objet_statistique).objet)).nombre_lignes
  842:                         - nombre_lignes); i++)
  843:                 {
  844:                     ((integer8 **) (*((struct_matrice *) (*s_objet_statistique)
  845:                             .objet)).tableau)[i] = ((integer8 **) tampon)[i];
  846:                 }
  847: 
  848:                 free(tampon);
  849: 
  850:                 for(k = 0; i < (long) ((*((struct_matrice *)
  851:                         (*s_objet_statistique).objet)).nombre_lignes); i++, k++)
  852:                 {
  853:                     ((integer8 **) (*((struct_matrice *) (*s_objet_statistique)
  854:                             .objet)).tableau)[i] = ((integer8 **)
  855:                             (*((struct_matrice *) (*s_objet).objet))
  856:                             .tableau)[k];
  857:                 }
  858: 
  859:                 free((integer8 **) (*((struct_matrice *) (*s_objet).objet))
  860:                         .tableau);
  861:                 free((struct_matrice *) (*s_objet).objet);
  862:                 free(s_objet);
  863:                 s_objet = NULL;
  864:             }
  865:             else if (((*s_objet_statistique).type == MRL) &&
  866:                     ((*s_objet).type == MRL))
  867:             {
  868:                 tampon = (*((struct_matrice *) (*s_objet_statistique).objet))
  869:                         .tableau;
  870:                 (*((struct_matrice *) (*s_objet_statistique).objet))
  871:                         .nombre_lignes += nombre_lignes;
  872: 
  873:                 if (((*((struct_matrice *) (*s_objet_statistique).objet))
  874:                         .tableau = malloc((*((struct_matrice *)
  875:                         (*s_objet_statistique).objet)).nombre_lignes *
  876:                         sizeof(real8 *))) == NULL)
  877:                 {
  878:                     (*s_etat_processus).erreur_systeme =
  879:                             d_es_allocation_memoire;
  880:                     return;
  881:                 }
  882: 
  883:                 for(i = 0; i < (long) ((*((struct_matrice *)
  884:                         (*s_objet_statistique).objet)).nombre_lignes
  885:                         - nombre_lignes); i++)
  886:                 {
  887:                     ((real8 **) (*((struct_matrice *) (*s_objet_statistique)
  888:                             .objet)).tableau)[i] = ((real8 **) tampon)[i];
  889:                 }
  890: 
  891:                 free(tampon);
  892: 
  893:                 for(k = 0; i < (long) ((*((struct_matrice *)
  894:                         (*s_objet_statistique).objet)).nombre_lignes); i++, k++)
  895:                 {
  896:                     ((real8 **) (*((struct_matrice *) (*s_objet_statistique)
  897:                             .objet)).tableau)[i] = ((real8 **)
  898:                             (*((struct_matrice *) (*s_objet).objet))
  899:                             .tableau)[k];
  900:                 }
  901: 
  902:                 free((real8 **) (*((struct_matrice *) (*s_objet).objet))
  903:                         .tableau);
  904:                 free((struct_matrice *) (*s_objet).objet);
  905:                 free(s_objet);
  906:                 s_objet = NULL;
  907:             }
  908:             else if (((*s_objet_statistique).type == MRL) &&
  909:                     ((*s_objet).type == MIN))
  910:             {
  911:                 tampon = (*((struct_matrice *) (*s_objet_statistique).objet))
  912:                         .tableau;
  913:                 (*((struct_matrice *) (*s_objet_statistique).objet))
  914:                         .nombre_lignes += nombre_lignes;
  915: 
  916:                 if (((*((struct_matrice *) (*s_objet_statistique).objet))
  917:                         .tableau = malloc((*((struct_matrice *)
  918:                         (*s_objet_statistique).objet)).nombre_lignes *
  919:                         sizeof(real8 *))) == NULL)
  920:                 {
  921:                     (*s_etat_processus).erreur_systeme =
  922:                             d_es_allocation_memoire;
  923:                     return;
  924:                 }
  925: 
  926:                 for(i = 0; i < (long) ((*((struct_matrice *)
  927:                         (*s_objet_statistique).objet)).nombre_lignes
  928:                         - nombre_lignes); i++)
  929:                 {
  930:                     ((real8 **) (*((struct_matrice *) (*s_objet_statistique)
  931:                             .objet)).tableau)[i] = ((real8 **) tampon)[i];
  932:                 }
  933: 
  934:                 free(tampon);
  935: 
  936:                 for(k = 0; i < (long) ((*((struct_matrice *)
  937:                         (*s_objet_statistique).objet)).nombre_lignes); i++, k++)
  938:                 {
  939:                     if ((((real8 **) (*((struct_matrice *)
  940:                             (*s_objet_statistique).objet)).tableau)[i] =
  941:                             malloc(nombre_colonnes * sizeof(real8))) == NULL)
  942:                     {
  943:                         (*s_etat_processus).erreur_systeme =
  944:                                 d_es_allocation_memoire;
  945:                         return;
  946:                     }
  947: 
  948:                     for(j = 0; j < nombre_colonnes; j++)
  949:                     {
  950:                         ((real8 **) (*((struct_matrice *) (*s_objet_statistique)
  951:                                 .objet)).tableau)[i][j] =
  952:                                 (real8) (((integer8 **) (*((struct_matrice *)
  953:                                 (*s_objet).objet)).tableau)[k][j]);
  954:                     }
  955:                 }
  956:             }
  957:             else
  958:             {
  959:                 tampon = (*((struct_matrice *) (*s_objet_statistique).objet))
  960:                         .tableau;
  961:                 (*((struct_matrice *) (*s_objet_statistique).objet))
  962:                         .nombre_lignes += nombre_lignes;
  963: 
  964:                 if (((*((struct_matrice *) (*s_objet_statistique).objet))
  965:                         .tableau = malloc((*((struct_matrice *)
  966:                         (*s_objet_statistique).objet)).nombre_lignes *
  967:                         sizeof(real8 *))) == NULL)
  968:                 {
  969:                     (*s_etat_processus).erreur_systeme =
  970:                             d_es_allocation_memoire;
  971:                     return;
  972:                 }
  973: 
  974:                 for(i = 0; i < (long) ((*((struct_matrice *)
  975:                         (*s_objet_statistique).objet)).nombre_lignes
  976:                         - nombre_lignes); i++)
  977:                 {
  978:                     if ((((real8 **) (*((struct_matrice *)
  979:                             (*s_objet_statistique).objet)).tableau)[i] =
  980:                             malloc(nombre_colonnes * sizeof(real8)))
  981:                             == NULL)
  982:                     {
  983:                         (*s_etat_processus).erreur_systeme =
  984:                                 d_es_allocation_memoire;
  985:                         return;
  986:                     }
  987: 
  988:                     for(j = 0; j < nombre_colonnes; j++)
  989:                     {
  990:                         ((real8 **) (*((struct_matrice *) (*s_objet_statistique)
  991:                                 .objet)).tableau)[i][j] = (real8)
  992:                                 ((integer8 **) tampon)[i][j];
  993:                     }
  994: 
  995:                     free(((integer8 **) tampon)[i]);
  996:                 }
  997: 
  998:                 free(tampon);
  999: 
 1000:                 for(k = 0; i < (long) ((*((struct_matrice *)
 1001:                         (*s_objet_statistique).objet)).nombre_lignes); i++, k++)
 1002:                 {
 1003:                     ((real8 **) (*((struct_matrice *) (*s_objet_statistique)
 1004:                             .objet)).tableau)[i] = ((real8 **)
 1005:                             (*((struct_matrice *) (*s_objet).objet))
 1006:                             .tableau)[k];
 1007:                 }
 1008: 
 1009:                 free((real8 **) (*((struct_matrice *) (*s_objet).objet))
 1010:                         .tableau);
 1011:                 free((struct_matrice *) (*s_objet).objet);
 1012:                 free(s_objet);
 1013:                 s_objet = NULL;
 1014: 
 1015:                 (*((struct_matrice *) (*s_objet_statistique).objet)).type = 'R';
 1016:                 (*s_objet_statistique).type = MRL;
 1017:             }
 1018:         }
 1019:     }
 1020: 
 1021:     /*
 1022:      * Type incompatible en entrée
 1023:      */
 1024: 
 1025:     else
 1026:     {
 1027:         liberation(s_etat_processus, s_objet);
 1028: 
 1029:         (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
 1030:         return;
 1031:     }
 1032: 
 1033:     liberation(s_etat_processus, s_objet);
 1034: 
 1035:     return;
 1036: }
 1037: 
 1038: 
 1039: /*
 1040: ================================================================================
 1041:   Fonction 's-'
 1042: ================================================================================
 1043:   Entrées : structure processus
 1044: --------------------------------------------------------------------------------
 1045:   Sorties :
 1046: --------------------------------------------------------------------------------
 1047:   Effets de bord : néant
 1048: ================================================================================
 1049: */
 1050: 
 1051: void
 1052: instruction_s_moins(struct_processus *s_etat_processus)
 1053: {
 1054:     logical1                            presence_variable;
 1055: 
 1056:     long                                i;
 1057: 
 1058:     struct_objet                        *s_copie_statistique;
 1059:     struct_objet                        *s_objet;
 1060:     struct_objet                        *s_objet_statistique;
 1061: 
 1062:     unsigned long                       nombre_colonnes;
 1063:     unsigned long                       nombre_lignes;
 1064: 
 1065:     void                                *tampon;
 1066: 
 1067:     (*s_etat_processus).erreur_execution = d_ex;
 1068: 
 1069:     if ((*s_etat_processus).affichage_arguments == 'Y')
 1070:     {
 1071:         printf("\n  S- ");
 1072: 
 1073:         if ((*s_etat_processus).langue == 'F')
 1074:         {
 1075:             printf("(retrait une donnée dans la matrice statistique)\n\n");
 1076:         }
 1077:         else
 1078:         {
 1079:             printf("(remove a data value from statistical matrix)\n\n");
 1080:         }
 1081: 
 1082:         printf("->  1: %s, %s, %s, %s\n", d_INT, d_REL, d_VIN, d_VRL);
 1083: 
 1084:         return;
 1085:     }
 1086:     else if ((*s_etat_processus).test_instruction == 'Y')
 1087:     {
 1088:         (*s_etat_processus).nombre_arguments = -1;
 1089:         return;
 1090:     }
 1091:     
 1092:     if (test_cfsf(s_etat_processus, 31) == d_vrai)
 1093:     {
 1094:         if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
 1095:         {
 1096:             return;
 1097:         }
 1098:     }
 1099: 
 1100:     /*
 1101:      * Recherche d'une variable globale référencée par SIGMA
 1102:      */
 1103: 
 1104:     if (recherche_variable(s_etat_processus, ds_sdat) == d_faux)
 1105:     {
 1106:         /*
 1107:          * Aucune variable SIGMA
 1108:          */
 1109: 
 1110:         (*s_etat_processus).erreur_systeme = d_es;
 1111:         (*s_etat_processus).erreur_execution = d_ex_absence_observations;
 1112:         return;
 1113:     }
 1114:     else
 1115:     {
 1116:         /*
 1117:          * Il existe une variable locale SIGMA. Reste à vérifier l'existence
 1118:          * d'une variable SIGMA globale...
 1119:          */
 1120: 
 1121:         i = (*s_etat_processus).position_variable_courante;
 1122:         presence_variable = d_faux;
 1123: 
 1124:         while(i >= 0)
 1125:         {
 1126:             if ((strcmp((*s_etat_processus).s_liste_variables[i].nom,
 1127:                     ds_sdat) == 0) && ((*s_etat_processus)
 1128:                     .s_liste_variables[i].niveau == 1))
 1129:             {
 1130:                 presence_variable = d_vrai;
 1131:                 break;
 1132:             }
 1133: 
 1134:             i--;
 1135:         }
 1136: 
 1137:         if (presence_variable == d_faux)
 1138:         {
 1139:             (*s_etat_processus).erreur_execution = d_ex_absence_observations;
 1140:             return;
 1141:         }
 1142:         else
 1143:         {
 1144:             (*s_etat_processus).position_variable_courante = i;
 1145: 
 1146:             if ((*s_etat_processus).s_liste_variables[(*s_etat_processus)
 1147:                     .position_variable_courante].variable_verrouillee ==
 1148:                     d_vrai)
 1149:             {
 1150:                 (*s_etat_processus).erreur_execution =
 1151:                         d_ex_variable_verrouillee;
 1152:                 return;
 1153:             }
 1154: 
 1155:             if ((*s_etat_processus).s_liste_variables[i].objet == NULL)
 1156:             {
 1157:                 (*s_etat_processus).erreur_execution = d_ex_variable_partagee;
 1158:                 return;
 1159:             }
 1160: 
 1161:             if (((*((*s_etat_processus).s_liste_variables
 1162:                     [(*s_etat_processus).position_variable_courante].objet))
 1163:                     .type != MIN) && ((*((*s_etat_processus)
 1164:                     .s_liste_variables[(*s_etat_processus)
 1165:                     .position_variable_courante].objet)).type != MRL))
 1166:             {
 1167:                 (*s_etat_processus).erreur_execution =
 1168:                         d_ex_matrice_statistique_invalide;
 1169:                 return;
 1170:             }
 1171: 
 1172:             if ((s_copie_statistique = copie_objet(s_etat_processus,
 1173:                     (*s_etat_processus)
 1174:                     .s_liste_variables[(*s_etat_processus)
 1175:                     .position_variable_courante].objet, 'O')) == NULL)
 1176:             {
 1177:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1178:                 return;
 1179:             }
 1180: 
 1181:             liberation(s_etat_processus, (*s_etat_processus).s_liste_variables
 1182:                     [(*s_etat_processus).position_variable_courante].objet);
 1183:             (*s_etat_processus).s_liste_variables[(*s_etat_processus)
 1184:                     .position_variable_courante].objet = s_copie_statistique;
 1185: 
 1186:             nombre_colonnes = (*((struct_matrice *) (*((*s_etat_processus)
 1187:                     .s_liste_variables[(*s_etat_processus)
 1188:                     .position_variable_courante].objet)).objet))
 1189:                     .nombre_colonnes;
 1190: 
 1191:             nombre_lignes = (*((struct_matrice *) (*((*s_etat_processus)
 1192:                     .s_liste_variables[(*s_etat_processus)
 1193:                     .position_variable_courante].objet)).objet))
 1194:                     .nombre_lignes;
 1195:         }
 1196:     }
 1197: 
 1198:     s_objet_statistique = ((*s_etat_processus).s_liste_variables
 1199:             [(*s_etat_processus).position_variable_courante]).objet;
 1200: 
 1201:     if ((*s_objet_statistique).type == MIN)
 1202:     {
 1203:         if (nombre_colonnes == 1)
 1204:         {
 1205:             /*
 1206:              * Formation d'un entier
 1207:              */
 1208: 
 1209:             if ((s_objet = allocation(s_etat_processus, NON)) == NULL)
 1210:             {
 1211:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1212:                 return;
 1213:             }
 1214: 
 1215:             (*s_objet).type = INT;
 1216: 
 1217:             if (nombre_lignes == 1)
 1218:             {
 1219:                 if (((*s_objet).objet = malloc(sizeof(integer8))) == NULL)
 1220:                 {
 1221:                     (*s_etat_processus).erreur_systeme =
 1222:                             d_es_allocation_memoire;
 1223:                     return;
 1224:                 }
 1225: 
 1226:                 (*((integer8 *) (*s_objet).objet)) = ((integer8 **)
 1227:                         (*((struct_matrice *) (*s_objet_statistique).objet))
 1228:                         .tableau)[nombre_lignes - 1][0];
 1229:             }
 1230:             else
 1231:             {
 1232:                 (*s_objet).objet = ((integer8 **)
 1233:                         (*((struct_matrice *) (*s_objet_statistique).objet))
 1234:                         .tableau)[nombre_lignes - 1];
 1235:             }
 1236:         }
 1237:         else
 1238:         {
 1239:             /*
 1240:              * Formation d'un vecteur d'entiers
 1241:              */
 1242: 
 1243:             if ((s_objet = allocation(s_etat_processus, NON)) == NULL)
 1244:             {
 1245:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1246:                 return;
 1247:             }
 1248: 
 1249:             if (((*s_objet).objet = malloc(sizeof(struct_vecteur))) == NULL)
 1250:             {
 1251:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1252:                 return;
 1253:             }
 1254: 
 1255:             (*s_objet).type = VIN;
 1256:             (*((struct_vecteur *) (*s_objet).objet)).type = 'I';
 1257:             (*((struct_vecteur *) (*s_objet).objet)).taille = nombre_colonnes;
 1258: 
 1259:             if (nombre_lignes == 1)
 1260:             {
 1261:                 if (((*((struct_vecteur *) (*s_objet).objet))
 1262:                         .tableau = malloc(nombre_colonnes *
 1263:                         sizeof(integer8))) == NULL)
 1264:                 {
 1265:                     (*s_etat_processus).erreur_systeme =
 1266:                             d_es_allocation_memoire;
 1267:                     return;
 1268:                 }
 1269: 
 1270:                 for(i = 0; i < (long) nombre_colonnes; i++)
 1271:                 {
 1272:                     ((integer8 *) (*((struct_vecteur *) (*s_objet).objet))
 1273:                             .tableau)[i] = ((integer8 **) (*((struct_matrice *)
 1274:                             (*s_objet_statistique).objet)).tableau)
 1275:                             [nombre_lignes - 1][i];
 1276:                 }
 1277:             }
 1278:             else
 1279:             {
 1280:                 (*((struct_vecteur *) (*s_objet).objet)).tableau =
 1281:                         ((integer8 **) (*((struct_matrice *)
 1282:                         (*s_objet_statistique).objet)).tableau)
 1283:                         [nombre_lignes - 1];
 1284:             }
 1285:         }
 1286: 
 1287:         if (nombre_lignes == 1)
 1288:         {
 1289:             /*
 1290:              * Destruction de la variable globale SIGMA
 1291:              */
 1292: 
 1293:             if (retrait_variable(s_etat_processus, ds_sdat, 'G') == d_erreur)
 1294:             {
 1295:                 return;
 1296:             }
 1297:         }
 1298:         else
 1299:         {
 1300:             /*
 1301:              * Elimination de la dernière ligne de la matrice SIGMA
 1302:              */
 1303: 
 1304:             tampon = (*((struct_matrice *) (*s_objet_statistique)
 1305:                     .objet)).tableau;
 1306:             (*((struct_matrice *) (*s_objet_statistique).objet))
 1307:                     .nombre_lignes--;
 1308: 
 1309:             if (((*((struct_matrice *) (*s_objet_statistique)
 1310:                     .objet)).tableau = malloc(
 1311:                     (*((struct_matrice *) (*s_objet_statistique).objet))
 1312:                     .nombre_lignes * sizeof(integer8 *))) == NULL)
 1313:             {
 1314:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1315:                 return;
 1316:             }
 1317: 
 1318:             for(i = 0; i < (long) (*((struct_matrice *) (*s_objet_statistique)
 1319:                     .objet)).nombre_lignes; i++)
 1320:             {
 1321:                 ((integer8 **) (*((struct_matrice *) (*s_objet_statistique)
 1322:                         .objet)).tableau)[i] = ((integer8 **) tampon)[i];
 1323:             }
 1324: 
 1325:             free(tampon);
 1326:         }
 1327:     }
 1328:     else if ((*s_objet_statistique).type == MRL)
 1329:     {
 1330:         if (nombre_colonnes == 1)
 1331:         {
 1332:             /*
 1333:              * Formation d'un réel
 1334:              */
 1335: 
 1336:             if ((s_objet = allocation(s_etat_processus, NON)) == NULL)
 1337:             {
 1338:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1339:                 return;
 1340:             }
 1341: 
 1342:             (*s_objet).type = REL;
 1343: 
 1344:             if (nombre_lignes == 1)
 1345:             {
 1346:                 if (((*s_objet).objet = malloc(sizeof(real8)))
 1347:                         == NULL)
 1348:                 {
 1349:                     (*s_etat_processus).erreur_systeme =
 1350:                             d_es_allocation_memoire;
 1351:                     return;
 1352:                 }
 1353: 
 1354:                 (*((real8 *) (*s_objet).objet)) = ((real8 **)
 1355:                         (*((struct_matrice *) (*s_objet_statistique).objet))
 1356:                         .tableau)[nombre_lignes - 1][0];
 1357:             }
 1358:             else
 1359:             {
 1360:                 (*s_objet).objet = ((real8 **)
 1361:                         (*((struct_matrice *) (*s_objet_statistique).objet))
 1362:                         .tableau)[nombre_lignes - 1];
 1363:             }
 1364:         }
 1365:         else
 1366:         {
 1367:             /*
 1368:              * Formation d'un vecteur de réels
 1369:              */
 1370: 
 1371:             if ((s_objet = allocation(s_etat_processus, NON)) == NULL)
 1372:             {
 1373:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1374:                 return;
 1375:             }
 1376: 
 1377:             if (((*s_objet).objet = malloc(sizeof(struct_vecteur))) == NULL)
 1378:             {
 1379:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1380:                 return;
 1381:             }
 1382: 
 1383:             (*s_objet).type = VRL;
 1384:             (*((struct_vecteur *) (*s_objet).objet)).type = 'R';
 1385:             (*((struct_vecteur *) (*s_objet).objet)).taille = nombre_colonnes;
 1386: 
 1387:             if (nombre_lignes == 1)
 1388:             {
 1389:                 if (((*((struct_vecteur *) (*s_objet).objet))
 1390:                         .tableau = malloc(nombre_colonnes *
 1391:                         sizeof(real8))) == NULL)
 1392:                 {
 1393:                     (*s_etat_processus).erreur_systeme =
 1394:                             d_es_allocation_memoire;
 1395:                     return;
 1396:                 }
 1397: 
 1398:                 for(i = 0; i < (long) nombre_colonnes; i++)
 1399:                 {
 1400:                     ((real8 *) (*((struct_vecteur *) (*s_objet).objet))
 1401:                             .tableau)[i] = ((real8 **) (*((struct_matrice *)
 1402:                             (*s_objet_statistique).objet)).tableau)
 1403:                             [nombre_lignes - 1][i];
 1404:                 }
 1405:             }
 1406:             else
 1407:             {
 1408:                 (*((struct_vecteur *) (*s_objet).objet)).tableau =
 1409:                         ((real8 **) (*((struct_matrice *)
 1410:                         (*s_objet_statistique).objet)).tableau)
 1411:                         [nombre_lignes - 1];
 1412:             }
 1413:         }
 1414: 
 1415:         if (nombre_lignes == 1)
 1416:         {
 1417:             /*
 1418:              * Destruction de la variable globale SIGMA
 1419:              */
 1420: 
 1421:             if (retrait_variable(s_etat_processus, ds_sdat, 'G') == d_erreur)
 1422:             {
 1423:                 return;
 1424:             }
 1425:         }
 1426:         else
 1427:         {
 1428:             /*
 1429:              * Elimination de la dernière ligne de la matrice SIGMA
 1430:              */
 1431: 
 1432:             tampon = (*((struct_matrice *) (*s_objet_statistique)
 1433:                     .objet)).tableau;
 1434:             (*((struct_matrice *) (*s_objet_statistique).objet))
 1435:                     .nombre_lignes--;
 1436: 
 1437:             if (((*((struct_matrice *) (*s_objet_statistique).objet))
 1438:                     .tableau = malloc((*((struct_matrice *)
 1439:                     (*s_objet_statistique).objet)).nombre_lignes *
 1440:                     sizeof(real8 *))) == NULL)
 1441:             {
 1442:                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
 1443:                 return;
 1444:             }
 1445: 
 1446:             for(i = 0; i < (long) (*((struct_matrice *) (*s_objet_statistique)
 1447:                     .objet)).nombre_lignes; i++)
 1448:             {
 1449:                 ((real8 **) (*((struct_matrice *) (*s_objet_statistique)
 1450:                         .objet)).tableau)[i] = ((real8 **) tampon)[i];
 1451:             }
 1452: 
 1453:             free(tampon);
 1454:         }
 1455:     }
 1456:     else
 1457:     {
 1458:         (*s_etat_processus).erreur_execution =
 1459:                 d_ex_matrice_statistique_invalide;
 1460:         return;
 1461:     }
 1462: 
 1463:     if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
 1464:             s_objet) == d_erreur)
 1465:     {
 1466:         return;
 1467:     }
 1468: 
 1469:     return;
 1470: }
 1471: 
 1472: // vim: ts=4

CVSweb interface <joel.bertrand@systella.fr>