Annotation of rpl/src/instructions_p2.c, revision 1.1
1.1 ! bertrand 1: /*
! 2: ================================================================================
! 3: RPL/2 (R) version 4.0.9
! 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 'p->r'
! 29: ================================================================================
! 30: Entrées : pointeur sur une structure struct_processus
! 31: --------------------------------------------------------------------------------
! 32: Sorties :
! 33: --------------------------------------------------------------------------------
! 34: Effets de bord : néant
! 35: ================================================================================
! 36: */
! 37:
! 38: void
! 39: instruction_p_vers_r(struct_processus *s_etat_processus)
! 40: {
! 41: struct_liste_chainee *l_element_courant;
! 42: struct_liste_chainee *l_element_precedent;
! 43:
! 44: struct_objet *s_copie_argument;
! 45: struct_objet *s_objet_argument;
! 46: struct_objet *s_objet_resultat;
! 47:
! 48: (*s_etat_processus).erreur_execution = d_ex;
! 49:
! 50: if ((*s_etat_processus).affichage_arguments == 'Y')
! 51: {
! 52: printf("\n P->R ");
! 53:
! 54: if ((*s_etat_processus).langue == 'F')
! 55: {
! 56: printf("(coordonnées polaires vers cartésiennes)\n\n");
! 57: }
! 58: else
! 59: {
! 60: printf("(polar to cartesian coordinates)\n\n");
! 61: }
! 62:
! 63: printf(" 1: %s, %s, %s\n", d_INT, d_REL, d_CPL);
! 64: printf("-> 1: %s\n\n", d_CPL);
! 65:
! 66: printf(" 1: %s, %s\n", d_NOM, d_ALG);
! 67: printf("-> 1: %s\n\n", d_ALG);
! 68:
! 69: printf(" 1: %s\n", d_RPN);
! 70: printf("-> 1: %s\n", d_RPN);
! 71:
! 72: return;
! 73: }
! 74: else if ((*s_etat_processus).test_instruction == 'Y')
! 75: {
! 76: (*s_etat_processus).nombre_arguments = -1;
! 77: return;
! 78: }
! 79:
! 80: if (test_cfsf(s_etat_processus, 31) == d_vrai)
! 81: {
! 82: if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
! 83: {
! 84: return;
! 85: }
! 86: }
! 87:
! 88: if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 89: &s_objet_argument) == d_erreur)
! 90: {
! 91: (*s_etat_processus).erreur_execution = d_ex_manque_argument;
! 92: return;
! 93: }
! 94:
! 95: /*
! 96: --------------------------------------------------------------------------------
! 97: Conversion d'un entier ou d'un réel
! 98: --------------------------------------------------------------------------------
! 99: */
! 100:
! 101: if (((*s_objet_argument).type == INT) ||
! 102: ((*s_objet_argument).type == REL))
! 103: {
! 104: if ((s_objet_resultat = allocation(s_etat_processus, CPL)) == NULL)
! 105: {
! 106: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 107: return;
! 108: }
! 109:
! 110: if ((*s_objet_argument).type == INT)
! 111: {
! 112: (*((struct_complexe16 *) (*s_objet_resultat).objet)).partie_reelle
! 113: = (*((integer8 *) (*s_objet_argument).objet));
! 114: }
! 115: else
! 116: {
! 117: (*((struct_complexe16 *) (*s_objet_resultat).objet)).partie_reelle
! 118: = (*((real8 *) (*s_objet_argument).objet));
! 119: }
! 120:
! 121: (*((struct_complexe16 *) (*s_objet_resultat).objet)).partie_imaginaire
! 122: = 0;
! 123: }
! 124:
! 125: /*
! 126: --------------------------------------------------------------------------------
! 127: Conversion d'un complexe
! 128: --------------------------------------------------------------------------------
! 129: */
! 130:
! 131: else if ((*s_objet_argument).type == CPL)
! 132: {
! 133: if ((s_objet_resultat = allocation(s_etat_processus, CPL)) == NULL)
! 134: {
! 135: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 136: return;
! 137: }
! 138:
! 139: if (test_cfsf(s_etat_processus, 60) == d_faux)
! 140: {
! 141: conversion_degres_vers_radians(&((*((struct_complexe16 *)
! 142: (*s_objet_argument).objet)).partie_imaginaire));
! 143: }
! 144:
! 145: (*((struct_complexe16 *) (*s_objet_resultat).objet)).partie_reelle =
! 146: (*((struct_complexe16 *) (*s_objet_argument).objet))
! 147: .partie_reelle * cos((*((struct_complexe16 *)
! 148: (*s_objet_argument).objet)).partie_imaginaire);
! 149: (*((struct_complexe16 *) (*s_objet_resultat).objet)).partie_imaginaire =
! 150: (*((struct_complexe16 *) (*s_objet_argument).objet))
! 151: .partie_reelle * sin((*((struct_complexe16 *)
! 152: (*s_objet_argument).objet)).partie_imaginaire);
! 153: }
! 154:
! 155: /*
! 156: --------------------------------------------------------------------------------
! 157: Conversion d'un nom
! 158: --------------------------------------------------------------------------------
! 159: */
! 160:
! 161: else if ((*s_objet_argument).type == NOM)
! 162: {
! 163: if ((s_objet_resultat = allocation(s_etat_processus, ALG)) == NULL)
! 164: {
! 165: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 166: return;
! 167: }
! 168:
! 169: if (((*s_objet_resultat).objet =
! 170: allocation_maillon(s_etat_processus)) == NULL)
! 171: {
! 172: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 173: return;
! 174: }
! 175:
! 176: l_element_courant = (*s_objet_resultat).objet;
! 177:
! 178: if (((*l_element_courant).donnee = allocation(s_etat_processus, FCT))
! 179: == NULL)
! 180: {
! 181: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 182: return;
! 183: }
! 184:
! 185: (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 186: .nombre_arguments = 0;
! 187: (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 188: .fonction = instruction_vers_niveau_superieur;
! 189:
! 190: if (((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 191: .nom_fonction = malloc(3 * sizeof(unsigned char))) == NULL)
! 192: {
! 193: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 194: return;
! 195: }
! 196:
! 197: strcpy((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 198: .nom_fonction, "<<");
! 199:
! 200: if (((*l_element_courant).suivant =
! 201: allocation_maillon(s_etat_processus)) == NULL)
! 202: {
! 203: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 204: return;
! 205: }
! 206:
! 207: l_element_courant = (*l_element_courant).suivant;
! 208: (*l_element_courant).donnee = s_objet_argument;
! 209:
! 210: if (((*l_element_courant).suivant =
! 211: allocation_maillon(s_etat_processus)) == NULL)
! 212: {
! 213: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 214: return;
! 215: }
! 216:
! 217: l_element_courant = (*l_element_courant).suivant;
! 218:
! 219: if (((*l_element_courant).donnee = allocation(s_etat_processus, FCT))
! 220: == NULL)
! 221: {
! 222: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 223: return;
! 224: }
! 225:
! 226: (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 227: .nombre_arguments = 1;
! 228: (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 229: .fonction = instruction_p_vers_r;
! 230:
! 231: if (((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 232: .nom_fonction = malloc(5 * sizeof(unsigned char))) == NULL)
! 233: {
! 234: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 235: return;
! 236: }
! 237:
! 238: strcpy((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 239: .nom_fonction, "P->R");
! 240:
! 241: if (((*l_element_courant).suivant =
! 242: allocation_maillon(s_etat_processus)) == NULL)
! 243: {
! 244: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 245: return;
! 246: }
! 247:
! 248: l_element_courant = (*l_element_courant).suivant;
! 249:
! 250: if (((*l_element_courant).donnee = allocation(s_etat_processus, FCT))
! 251: == NULL)
! 252: {
! 253: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 254: return;
! 255: }
! 256:
! 257: (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 258: .nombre_arguments = 0;
! 259: (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 260: .fonction = instruction_vers_niveau_inferieur;
! 261:
! 262: if (((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 263: .nom_fonction = malloc(3 * sizeof(unsigned char))) == NULL)
! 264: {
! 265: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 266: return;
! 267: }
! 268:
! 269: strcpy((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 270: .nom_fonction, ">>");
! 271:
! 272: (*l_element_courant).suivant = NULL;
! 273: s_objet_argument = NULL;
! 274: }
! 275:
! 276: /*
! 277: --------------------------------------------------------------------------------
! 278: Conversion d'une expression
! 279: --------------------------------------------------------------------------------
! 280: */
! 281:
! 282: else if (((*s_objet_argument).type == ALG) ||
! 283: ((*s_objet_argument).type == RPN))
! 284: {
! 285: if ((s_copie_argument = copie_objet(s_etat_processus, s_objet_argument,
! 286: 'N')) == NULL)
! 287: {
! 288: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 289: return;
! 290: }
! 291:
! 292: l_element_courant = (struct_liste_chainee *)
! 293: (*s_copie_argument).objet;
! 294: l_element_precedent = l_element_courant;
! 295:
! 296: while((*l_element_courant).suivant != NULL)
! 297: {
! 298: l_element_precedent = l_element_courant;
! 299: l_element_courant = (*l_element_courant).suivant;
! 300: }
! 301:
! 302: if (((*l_element_precedent).suivant =
! 303: allocation_maillon(s_etat_processus)) == NULL)
! 304: {
! 305: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 306: return;
! 307: }
! 308:
! 309: if (((*(*l_element_precedent).suivant).donnee =
! 310: allocation(s_etat_processus, FCT)) == NULL)
! 311: {
! 312: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 313: return;
! 314: }
! 315:
! 316: (*((struct_fonction *) (*(*(*l_element_precedent).suivant)
! 317: .donnee).objet)).nombre_arguments = 1;
! 318: (*((struct_fonction *) (*(*(*l_element_precedent).suivant)
! 319: .donnee).objet)).fonction = instruction_p_vers_r;
! 320:
! 321: if (((*((struct_fonction *) (*(*(*l_element_precedent)
! 322: .suivant).donnee).objet)).nom_fonction =
! 323: malloc(5 * sizeof(unsigned char))) == NULL)
! 324: {
! 325: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 326: return;
! 327: }
! 328:
! 329: strcpy((*((struct_fonction *) (*(*(*l_element_precedent)
! 330: .suivant).donnee).objet)).nom_fonction, "P->R");
! 331:
! 332: (*(*l_element_precedent).suivant).suivant = l_element_courant;
! 333:
! 334: s_objet_resultat = s_copie_argument;
! 335: }
! 336:
! 337: /*
! 338: --------------------------------------------------------------------------------
! 339: Réalisation impossible de la fonction P->R
! 340: --------------------------------------------------------------------------------
! 341: */
! 342:
! 343: else
! 344: {
! 345: liberation(s_etat_processus, s_objet_argument);
! 346:
! 347: (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
! 348: return;
! 349: }
! 350:
! 351: liberation(s_etat_processus, s_objet_argument);
! 352:
! 353: if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 354: s_objet_resultat) == d_erreur)
! 355: {
! 356: return;
! 357: }
! 358:
! 359: return;
! 360: }
! 361:
! 362:
! 363: /*
! 364: ================================================================================
! 365: Fonction 'put'
! 366: ================================================================================
! 367: Entrées : pointeur sur une structure struct_processus
! 368: --------------------------------------------------------------------------------
! 369: Sorties :
! 370: --------------------------------------------------------------------------------
! 371: Effets de bord : néant
! 372: ================================================================================
! 373: */
! 374:
! 375: void
! 376: instruction_put(struct_processus *s_etat_processus)
! 377: {
! 378: logical1 variable_partagee;
! 379:
! 380: struct_liste_chainee *l_element_courant;
! 381:
! 382: struct_objet *s_copie_3;
! 383: struct_objet *s_copie_4;
! 384: struct_objet *s_objet_1;
! 385: struct_objet *s_objet_2;
! 386: struct_objet *s_objet_3;
! 387: struct_objet *s_objet_4;
! 388: struct_objet *s_objet_element;
! 389:
! 390: unsigned long i;
! 391: unsigned long indice_i;
! 392: unsigned long indice_j;
! 393: unsigned long j;
! 394: unsigned long nombre_dimensions;
! 395:
! 396: void *tampon;
! 397:
! 398: (*s_etat_processus).erreur_execution = d_ex;
! 399:
! 400: if ((*s_etat_processus).affichage_arguments == 'Y')
! 401: {
! 402: printf("\n PUT ");
! 403:
! 404: if ((*s_etat_processus).langue == 'F')
! 405: {
! 406: printf("(change un élément)\n\n");
! 407: }
! 408: else
! 409: {
! 410: printf("(change element)\n\n");
! 411: }
! 412:
! 413: printf(" 3: %s, %s, %s\n", d_VIN, d_VRL, d_VCX);
! 414: printf(" 2: %s\n", d_LST);
! 415: printf(" 1: %s, %s, %s\n", d_INT, d_REL, d_CPL);
! 416: printf("-> 1: %s, %s, %s\n\n", d_VIN, d_VRL, d_VCX);
! 417:
! 418: printf(" 3: %s, %s, %s\n", d_MIN, d_MRL, d_MCX);
! 419: printf(" 2: %s\n", d_LST);
! 420: printf(" 1: %s, %s, %s\n", d_INT, d_REL, d_CPL);
! 421: printf("-> 1: %s, %s, %s\n\n", d_MIN, d_MRL, d_MCX);
! 422:
! 423: printf(" 3: %s\n", d_LST);
! 424: printf(" 2: %s\n", d_INT);
! 425: printf(" 1: %s, %s, %s, %s, %s, %s,\n"
! 426: " %s, %s, %s, %s, %s,\n"
! 427: " %s, %s, %s, %s, %s,\n"
! 428: " %s, %s, %s, %s,\n"
! 429: " %s, %s\n",
! 430: d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX,
! 431: d_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SCK,
! 432: d_SQL, d_SLB, d_PRC, d_MTX);
! 433: printf("-> 1: %s\n\n", d_LST);
! 434:
! 435: printf(" 3: %s\n", d_TAB);
! 436: printf(" 2: %s\n", d_LST);
! 437: printf(" 1: %s, %s, %s, %s, %s, %s,\n"
! 438: " %s, %s, %s, %s, %s,\n"
! 439: " %s, %s, %s, %s, %s,\n"
! 440: " %s, %s, %s, %s,\n"
! 441: " %s, %s\n",
! 442: d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX,
! 443: d_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SCK,
! 444: d_SQL, d_SLB, d_PRC, d_MTX);
! 445: printf("-> 1: %s\n\n", d_TAB);
! 446:
! 447: printf(" 3: %s\n", d_NOM);
! 448: printf(" 2: %s, %s\n", d_LST, d_INT);
! 449: printf(" 1: %s, %s, %s, %s, %s, %s,\n"
! 450: " %s, %s, %s, %s, %s,\n"
! 451: " %s, %s, %s, %s, %s,\n"
! 452: " %s, %s, %s, %s,\n"
! 453: " %s, %s\n",
! 454: d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX,
! 455: d_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SCK,
! 456: d_SQL, d_SLB, d_PRC, d_MTX);
! 457:
! 458: return;
! 459: }
! 460: else if ((*s_etat_processus).test_instruction == 'Y')
! 461: {
! 462: (*s_etat_processus).nombre_arguments = -1;
! 463: return;
! 464: }
! 465:
! 466: if (test_cfsf(s_etat_processus, 31) == d_vrai)
! 467: {
! 468: if (empilement_pile_last(s_etat_processus, 3) == d_erreur)
! 469: {
! 470: return;
! 471: }
! 472: }
! 473:
! 474: if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 475: &s_objet_1) == d_erreur)
! 476: {
! 477: (*s_etat_processus).erreur_execution = d_ex_manque_argument;
! 478: return;
! 479: }
! 480:
! 481: if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 482: &s_objet_2) == d_erreur)
! 483: {
! 484: liberation(s_etat_processus, s_objet_1);
! 485:
! 486: (*s_etat_processus).erreur_execution = d_ex_manque_argument;
! 487: return;
! 488: }
! 489:
! 490: if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 491: &s_objet_3) == d_erreur)
! 492: {
! 493: liberation(s_etat_processus, s_objet_1);
! 494: liberation(s_etat_processus, s_objet_2);
! 495:
! 496: (*s_etat_processus).erreur_execution = d_ex_manque_argument;
! 497: return;
! 498: }
! 499:
! 500: /*
! 501: --------------------------------------------------------------------------------
! 502: Traitement des éléments des vecteurs
! 503: --------------------------------------------------------------------------------
! 504: */
! 505:
! 506: if (((*s_objet_3).type == VIN) ||
! 507: ((*s_objet_3).type == VRL) ||
! 508: ((*s_objet_3).type == VCX))
! 509: {
! 510: if ((*s_objet_2).type != LST)
! 511: {
! 512: liberation(s_etat_processus, s_objet_1);
! 513: liberation(s_etat_processus, s_objet_2);
! 514: liberation(s_etat_processus, s_objet_3);
! 515:
! 516: (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
! 517: return;
! 518: }
! 519:
! 520: l_element_courant = (*s_objet_2).objet;
! 521: nombre_dimensions = 0;
! 522:
! 523: while(l_element_courant != NULL)
! 524: {
! 525: nombre_dimensions++;
! 526: l_element_courant = (*l_element_courant).suivant;
! 527: }
! 528:
! 529: if (nombre_dimensions != 1)
! 530: {
! 531: liberation(s_etat_processus, s_objet_1);
! 532: liberation(s_etat_processus, s_objet_2);
! 533: liberation(s_etat_processus, s_objet_3);
! 534:
! 535: (*s_etat_processus).erreur_execution = d_ex_dimensions_invalides;
! 536: return;
! 537: }
! 538:
! 539: l_element_courant = (*s_objet_2).objet;
! 540:
! 541: if ((*(*l_element_courant).donnee).type != INT)
! 542: {
! 543: liberation(s_etat_processus, s_objet_1);
! 544: liberation(s_etat_processus, s_objet_2);
! 545: liberation(s_etat_processus, s_objet_3);
! 546:
! 547: (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
! 548: return;
! 549: }
! 550:
! 551: if ((*((integer8 *) (*(*l_element_courant).donnee).objet)) <= 0)
! 552: {
! 553: liberation(s_etat_processus, s_objet_1);
! 554: liberation(s_etat_processus, s_objet_2);
! 555: liberation(s_etat_processus, s_objet_3);
! 556:
! 557: (*s_etat_processus).erreur_execution = d_ex_argument_invalide;
! 558: return;
! 559: }
! 560: else if ((*((integer8 *) (*(*l_element_courant).donnee).objet)) >
! 561: (integer8) (*((struct_vecteur *) (*s_objet_3).objet)).taille)
! 562: {
! 563: liberation(s_etat_processus, s_objet_1);
! 564: liberation(s_etat_processus, s_objet_2);
! 565: liberation(s_etat_processus, s_objet_3);
! 566:
! 567: (*s_etat_processus).erreur_execution = d_ex_element_inexistant;
! 568: return;
! 569: }
! 570:
! 571: indice_i = (*((integer8 *) (*(*l_element_courant).donnee).objet));
! 572:
! 573: if ((s_copie_3 = copie_objet(s_etat_processus, s_objet_3, 'Q')) == NULL)
! 574: {
! 575: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 576: return;
! 577: }
! 578:
! 579: liberation(s_etat_processus, s_objet_3);
! 580: s_objet_3 = s_copie_3;
! 581:
! 582: if ((*s_objet_3).type == VIN)
! 583: {
! 584: /*
! 585: * Vecteur d'entiers
! 586: */
! 587:
! 588: if ((*s_objet_1).type == INT)
! 589: {
! 590: /*
! 591: * Aucune conversion de type
! 592: */
! 593:
! 594: ((integer8 *) (*((struct_vecteur *) (*s_objet_3).objet))
! 595: .tableau)[indice_i - 1] = (*((integer8 *)
! 596: (*s_objet_1).objet));
! 597: }
! 598: else if ((*s_objet_1).type == REL)
! 599: {
! 600: /*
! 601: * Conversion du vecteur en vecteur réel
! 602: */
! 603:
! 604: tampon = (void *) ((integer8 *) (*((struct_vecteur *)
! 605: (*s_objet_3).objet)).tableau);
! 606:
! 607: (*((struct_vecteur *) (*s_objet_3).objet)).type = 'R';
! 608: (*s_objet_3).type = VRL;
! 609:
! 610: if (((*((struct_vecteur *) (*s_objet_3).objet)).tableau
! 611: = malloc((*((struct_vecteur *)
! 612: (*s_objet_3).objet)).taille * sizeof(real8)))
! 613: == NULL)
! 614: {
! 615: (*s_etat_processus).erreur_systeme =
! 616: d_es_allocation_memoire;
! 617: return;
! 618: }
! 619:
! 620: for(i = 0; i < (*((struct_vecteur *) (*s_objet_3).objet))
! 621: .taille; i++)
! 622: {
! 623: ((real8 *) (*((struct_vecteur *) (*s_objet_3).objet))
! 624: .tableau)[i] = (real8) (((integer8 *) tampon)[i]);
! 625: }
! 626:
! 627: free((integer8 *) tampon);
! 628:
! 629: ((real8 *) (*((struct_vecteur *) (*s_objet_3).objet))
! 630: .tableau)[indice_i - 1] = (*((real8 *)
! 631: (*s_objet_1).objet));
! 632: }
! 633: else if ((*s_objet_1).type == CPL)
! 634: {
! 635: /*
! 636: * Conversion du vecteur en vecteur complexe
! 637: */
! 638:
! 639: tampon = (void *) ((integer8 *) (*((struct_vecteur *)
! 640: (*s_objet_3).objet)).tableau);
! 641:
! 642: (*((struct_vecteur *) (*s_objet_3).objet)).type = 'C';
! 643: (*s_objet_3).type = VCX;
! 644:
! 645: if (((*((struct_vecteur *) (*s_objet_3).objet)).tableau
! 646: = malloc((*((struct_vecteur *)
! 647: (*s_objet_3).objet)).taille *
! 648: sizeof(struct_complexe16))) == NULL)
! 649: {
! 650: (*s_etat_processus).erreur_systeme =
! 651: d_es_allocation_memoire;
! 652: return;
! 653: }
! 654:
! 655: for(i = 0; i < (*((struct_vecteur *) (*s_objet_3).objet))
! 656: .taille; i++)
! 657: {
! 658: ((struct_complexe16 *) (*((struct_vecteur *)
! 659: (*s_objet_3).objet)).tableau)[i].partie_reelle =
! 660: (real8) (((integer8 *) tampon)[i]);
! 661: ((struct_complexe16 *) (*((struct_vecteur *)
! 662: (*s_objet_3).objet)).tableau)[i]
! 663: .partie_imaginaire = (real8) 0;
! 664: }
! 665:
! 666: free((integer8 *) tampon);
! 667:
! 668: ((struct_complexe16 *) (*((struct_vecteur *)
! 669: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 670: .partie_reelle = (*((struct_complexe16 *)
! 671: (*s_objet_1).objet)).partie_reelle;
! 672: ((struct_complexe16 *) (*((struct_vecteur *)
! 673: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 674: .partie_imaginaire = (*((struct_complexe16 *)
! 675: (*s_objet_1).objet)).partie_imaginaire;
! 676: }
! 677: else
! 678: {
! 679: liberation(s_etat_processus, s_objet_1);
! 680: liberation(s_etat_processus, s_objet_2);
! 681: liberation(s_etat_processus, s_objet_3);
! 682:
! 683: (*s_etat_processus).erreur_execution =
! 684: d_ex_erreur_type_argument;
! 685: return;
! 686: }
! 687: }
! 688: else if ((*s_objet_3).type == VRL)
! 689: {
! 690: /*
! 691: * Vecteur de réels
! 692: */
! 693:
! 694: if ((*s_objet_1).type == INT)
! 695: {
! 696: /*
! 697: * Conversion de l'élément à insérer en réel
! 698: */
! 699:
! 700: ((real8 *) (*((struct_vecteur *) (*s_objet_3).objet))
! 701: .tableau)[indice_i - 1] = (real8) (*((integer8 *)
! 702: (*s_objet_1).objet));
! 703: }
! 704: else if ((*s_objet_1).type == REL)
! 705: {
! 706: /*
! 707: * Aucune conversion de type
! 708: */
! 709:
! 710: ((real8 *) (*((struct_vecteur *) (*s_objet_3).objet))
! 711: .tableau)[indice_i - 1] = (*((real8 *)
! 712: (*s_objet_1).objet));
! 713: }
! 714: else if ((*s_objet_1).type == CPL)
! 715: {
! 716: /*
! 717: * Conversion du vecteur en vecteur complexe
! 718: */
! 719:
! 720: tampon = (void *) ((integer8 *) (*((struct_vecteur *)
! 721: (*s_objet_3).objet)).tableau);
! 722:
! 723: (*((struct_vecteur *) (*s_objet_3).objet)).type = 'C';
! 724: (*s_objet_3).type = VCX;
! 725:
! 726: if (((*((struct_vecteur *) (*s_objet_3).objet)).tableau
! 727: = malloc((*((struct_vecteur *)
! 728: (*s_objet_3).objet)).taille *
! 729: sizeof(struct_complexe16))) == NULL)
! 730: {
! 731: (*s_etat_processus).erreur_systeme =
! 732: d_es_allocation_memoire;
! 733: return;
! 734: }
! 735:
! 736: for(i = 0; i < (*((struct_vecteur *) (*s_objet_3).objet))
! 737: .taille; i++)
! 738: {
! 739: ((struct_complexe16 *) (*((struct_vecteur *)
! 740: (*s_objet_3).objet)).tableau)[i].partie_reelle =
! 741: ((real8 *) tampon)[i];
! 742: ((struct_complexe16 *) (*((struct_vecteur *)
! 743: (*s_objet_3).objet)).tableau)[i]
! 744: .partie_imaginaire = (real8) 0;
! 745: }
! 746:
! 747: free((real8 *) tampon);
! 748:
! 749: ((struct_complexe16 *) (*((struct_vecteur *)
! 750: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 751: .partie_reelle = (*((struct_complexe16 *)
! 752: (*s_objet_1).objet)).partie_reelle;
! 753: ((struct_complexe16 *) (*((struct_vecteur *)
! 754: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 755: .partie_imaginaire = (*((struct_complexe16 *)
! 756: (*s_objet_1).objet)).partie_imaginaire;
! 757: }
! 758: else
! 759: {
! 760: liberation(s_etat_processus, s_objet_1);
! 761: liberation(s_etat_processus, s_objet_2);
! 762: liberation(s_etat_processus, s_objet_3);
! 763:
! 764: (*s_etat_processus).erreur_execution =
! 765: d_ex_erreur_type_argument;
! 766: return;
! 767: }
! 768: }
! 769: else
! 770: {
! 771: /*
! 772: * Vecteur de complexes
! 773: */
! 774:
! 775: if ((*s_objet_1).type == INT)
! 776: {
! 777: /*
! 778: * Conversion de l'élément à insérer en complexe
! 779: */
! 780:
! 781: ((struct_complexe16 *) (*((struct_vecteur *)
! 782: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 783: .partie_reelle = (real8) (*((integer8 *)
! 784: (*s_objet_1).objet));
! 785: ((struct_complexe16 *) (*((struct_vecteur *)
! 786: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 787: .partie_imaginaire = (real8) 0;
! 788: }
! 789: else if ((*s_objet_1).type == REL)
! 790: {
! 791: /*
! 792: * Conversion de l'élément à insérer en complexe
! 793: */
! 794:
! 795: ((struct_complexe16 *) (*((struct_vecteur *)
! 796: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 797: .partie_reelle = (*((real8 *) (*s_objet_1).objet));
! 798: ((struct_complexe16 *) (*((struct_vecteur *)
! 799: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 800: .partie_imaginaire = (real8) 0;
! 801: }
! 802: else if ((*s_objet_1).type == CPL)
! 803: {
! 804: /*
! 805: * Aucune conversion de type
! 806: */
! 807:
! 808: ((struct_complexe16 *) (*((struct_vecteur *)
! 809: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 810: .partie_reelle = (*((struct_complexe16 *)
! 811: (*s_objet_1).objet)).partie_reelle;
! 812: ((struct_complexe16 *) (*((struct_vecteur *)
! 813: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 814: .partie_imaginaire = (*((struct_complexe16 *)
! 815: (*s_objet_1).objet)).partie_imaginaire;
! 816: }
! 817: else
! 818: {
! 819: liberation(s_etat_processus, s_objet_1);
! 820: liberation(s_etat_processus, s_objet_2);
! 821: liberation(s_etat_processus, s_objet_3);
! 822:
! 823: (*s_etat_processus).erreur_execution =
! 824: d_ex_erreur_type_argument;
! 825: return;
! 826: }
! 827: }
! 828:
! 829: liberation(s_etat_processus, s_objet_1);
! 830: liberation(s_etat_processus, s_objet_2);
! 831:
! 832: if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 833: s_objet_3) == d_erreur)
! 834: {
! 835: return;
! 836: }
! 837: }
! 838:
! 839: /*
! 840: --------------------------------------------------------------------------------
! 841: Traitement des éléments des matrices
! 842: --------------------------------------------------------------------------------
! 843: */
! 844:
! 845: else if (((*s_objet_3).type == MIN) ||
! 846: ((*s_objet_3).type == MRL) ||
! 847: ((*s_objet_3).type == MCX))
! 848: {
! 849: if ((*s_objet_2).type != LST)
! 850: {
! 851: liberation(s_etat_processus, s_objet_1);
! 852: liberation(s_etat_processus, s_objet_2);
! 853: liberation(s_etat_processus, s_objet_3);
! 854:
! 855: (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
! 856: return;
! 857: }
! 858:
! 859: l_element_courant = (*s_objet_2).objet;
! 860: nombre_dimensions = 0;
! 861:
! 862: while(l_element_courant != NULL)
! 863: {
! 864: nombre_dimensions++;
! 865: l_element_courant = (*l_element_courant).suivant;
! 866: }
! 867:
! 868: if (nombre_dimensions != 2)
! 869: {
! 870: liberation(s_etat_processus, s_objet_1);
! 871: liberation(s_etat_processus, s_objet_2);
! 872: liberation(s_etat_processus, s_objet_3);
! 873:
! 874: (*s_etat_processus).erreur_execution = d_ex_dimensions_invalides;
! 875: return;
! 876: }
! 877:
! 878: l_element_courant = (*s_objet_2).objet;
! 879:
! 880: indice_i = 0;
! 881: indice_j = 0;
! 882:
! 883: while(l_element_courant != NULL)
! 884: {
! 885: if ((*(*l_element_courant).donnee).type != INT)
! 886: {
! 887: liberation(s_etat_processus, s_objet_1);
! 888: liberation(s_etat_processus, s_objet_2);
! 889: liberation(s_etat_processus, s_objet_3);
! 890:
! 891: (*s_etat_processus).erreur_execution =
! 892: d_ex_erreur_type_argument;
! 893: return;
! 894: }
! 895:
! 896: if ((*((integer8 *) (*(*l_element_courant).donnee).objet)) <= 0)
! 897: {
! 898: liberation(s_etat_processus, s_objet_1);
! 899: liberation(s_etat_processus, s_objet_2);
! 900: liberation(s_etat_processus, s_objet_3);
! 901:
! 902: (*s_etat_processus).erreur_execution = d_ex_argument_invalide;
! 903: return;
! 904: }
! 905:
! 906: if (indice_i == 0)
! 907: {
! 908: indice_i = (*((integer8 *)
! 909: (*(*l_element_courant).donnee).objet));
! 910: }
! 911: else
! 912: {
! 913: indice_j = (*((integer8 *)
! 914: (*(*l_element_courant).donnee).objet));
! 915: }
! 916:
! 917: l_element_courant = (*l_element_courant).suivant;
! 918: }
! 919:
! 920: if ((indice_i > (*((struct_matrice *) (*s_objet_3).objet))
! 921: .nombre_lignes) || (indice_j > (*((struct_matrice *)
! 922: (*s_objet_3).objet)).nombre_colonnes))
! 923: {
! 924: liberation(s_etat_processus, s_objet_1);
! 925: liberation(s_etat_processus, s_objet_2);
! 926: liberation(s_etat_processus, s_objet_3);
! 927:
! 928: (*s_etat_processus).erreur_execution = d_ex_element_inexistant;
! 929: return;
! 930: }
! 931:
! 932: if ((s_copie_3 = copie_objet(s_etat_processus, s_objet_3, 'Q')) == NULL)
! 933: {
! 934: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 935: return;
! 936: }
! 937:
! 938: liberation(s_etat_processus, s_objet_3);
! 939: s_objet_3 = s_copie_3;
! 940:
! 941: if ((*s_objet_3).type == MIN)
! 942: {
! 943: /*
! 944: * Matrice d'entiers
! 945: */
! 946:
! 947: if ((*s_objet_1).type == INT)
! 948: {
! 949: /*
! 950: * Aucune conversion de type
! 951: */
! 952:
! 953: ((integer8 **) (*((struct_matrice *) (*s_objet_3).objet))
! 954: .tableau)[indice_i - 1][indice_j - 1] =
! 955: (*((integer8 *) (*s_objet_1).objet));
! 956: }
! 957: else if ((*s_objet_1).type == REL)
! 958: {
! 959: /*
! 960: * Conversion de la matrice en matrice réelle
! 961: */
! 962:
! 963: tampon = (void *) ((integer8 **) (*((struct_matrice *)
! 964: (*s_objet_3).objet)).tableau);
! 965:
! 966: (*((struct_matrice *) (*s_objet_3).objet)).type = 'R';
! 967: (*s_objet_3).type = MRL;
! 968:
! 969: if (((*((struct_matrice *) (*s_objet_3).objet)).tableau
! 970: = malloc((*((struct_matrice *)
! 971: (*s_objet_3).objet)).nombre_lignes * sizeof(real8 *)))
! 972: == NULL)
! 973: {
! 974: (*s_etat_processus).erreur_systeme =
! 975: d_es_allocation_memoire;
! 976: return;
! 977: }
! 978:
! 979: for(i = 0; i < (*((struct_matrice *) (*s_objet_3).objet))
! 980: .nombre_lignes; i++)
! 981: {
! 982: if ((((real8 **) (*((struct_matrice *)
! 983: (*s_objet_3).objet)).tableau)[i]
! 984: = malloc((*((struct_matrice *)
! 985: (*s_objet_3).objet)).nombre_colonnes *
! 986: sizeof(real8))) == NULL)
! 987: {
! 988: (*s_etat_processus).erreur_systeme =
! 989: d_es_allocation_memoire;
! 990: return;
! 991: }
! 992:
! 993: for(j = 0; j < (*((struct_matrice *) (*s_objet_3).objet))
! 994: .nombre_colonnes; j++)
! 995: {
! 996: ((real8 **) (*((struct_matrice *) (*s_objet_3).objet))
! 997: .tableau)[i][j] = (real8) (((integer8 **)
! 998: tampon)[i][j]);
! 999: }
! 1000:
! 1001: free(((integer8 **) tampon)[i]);
! 1002: }
! 1003:
! 1004: free((integer8 **) tampon);
! 1005:
! 1006: ((real8 **) (*((struct_matrice *) (*s_objet_3).objet))
! 1007: .tableau)[indice_i - 1][indice_j - 1] = (*((real8 *)
! 1008: (*s_objet_1).objet));
! 1009: }
! 1010: else if ((*s_objet_1).type == CPL)
! 1011: {
! 1012: /*
! 1013: * Conversion de la matrice en matrice complexe
! 1014: */
! 1015:
! 1016: tampon = (void *) ((integer8 **) (*((struct_matrice *)
! 1017: (*s_objet_3).objet)).tableau);
! 1018:
! 1019: (*((struct_matrice *) (*s_objet_3).objet)).type = 'C';
! 1020: (*s_objet_3).type = MCX;
! 1021:
! 1022: if (((*((struct_matrice *) (*s_objet_3).objet)).tableau
! 1023: = malloc((*((struct_matrice *)
! 1024: (*s_objet_3).objet)).nombre_lignes *
! 1025: sizeof(struct_complexe16 *))) == NULL)
! 1026: {
! 1027: (*s_etat_processus).erreur_systeme =
! 1028: d_es_allocation_memoire;
! 1029: return;
! 1030: }
! 1031:
! 1032: for(i = 0; i < (*((struct_matrice *) (*s_objet_3).objet))
! 1033: .nombre_lignes; i++)
! 1034: {
! 1035: if ((((struct_complexe16 **) (*((struct_matrice *)
! 1036: (*s_objet_3).objet)).tableau)[i]
! 1037: = malloc((*((struct_matrice *)
! 1038: (*s_objet_3).objet)).nombre_colonnes *
! 1039: sizeof(struct_complexe16))) == NULL)
! 1040: {
! 1041: (*s_etat_processus).erreur_systeme =
! 1042: d_es_allocation_memoire;
! 1043: return;
! 1044: }
! 1045:
! 1046: for(j = 0; j < (*((struct_matrice *) (*s_objet_3).objet))
! 1047: .nombre_colonnes; j++)
! 1048: {
! 1049: ((struct_complexe16 **) (*((struct_matrice *)
! 1050: (*s_objet_3).objet)).tableau)[i][j]
! 1051: .partie_reelle = (real8) (((integer8 **)
! 1052: tampon)[i][j]);
! 1053: ((struct_complexe16 **) (*((struct_matrice *)
! 1054: (*s_objet_3).objet)).tableau)[i][j]
! 1055: .partie_imaginaire = (real8) 0;
! 1056: }
! 1057:
! 1058: free(((integer8 **) tampon)[i]);
! 1059: }
! 1060:
! 1061: free((integer8 **) tampon);
! 1062:
! 1063: ((struct_complexe16 **) (*((struct_matrice *)
! 1064: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 1065: [indice_j - 1].partie_reelle = (*((struct_complexe16 *)
! 1066: (*s_objet_1).objet)).partie_reelle;
! 1067: ((struct_complexe16 **) (*((struct_matrice *)
! 1068: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 1069: [indice_j - 1].partie_imaginaire =
! 1070: (*((struct_complexe16 *)
! 1071: (*s_objet_1).objet)).partie_imaginaire;
! 1072: }
! 1073: else
! 1074: {
! 1075: liberation(s_etat_processus, s_objet_1);
! 1076: liberation(s_etat_processus, s_objet_2);
! 1077: liberation(s_etat_processus, s_objet_3);
! 1078:
! 1079: (*s_etat_processus).erreur_execution =
! 1080: d_ex_erreur_type_argument;
! 1081: return;
! 1082: }
! 1083: }
! 1084: else if ((*s_objet_3).type == MRL)
! 1085: {
! 1086: /*
! 1087: * Matrice de réels
! 1088: */
! 1089:
! 1090: if ((*s_objet_1).type == INT)
! 1091: {
! 1092: /*
! 1093: * Conversion de l'élément à insérer en réel
! 1094: */
! 1095:
! 1096: ((real8 **) (*((struct_matrice *) (*s_objet_3).objet))
! 1097: .tableau)[indice_i - 1][indice_j - 1] =
! 1098: (real8) (*((integer8 *) (*s_objet_1).objet));
! 1099: }
! 1100: else if ((*s_objet_1).type == REL)
! 1101: {
! 1102: /*
! 1103: * Aucune conversion de type
! 1104: */
! 1105:
! 1106: ((real8 **) (*((struct_matrice *) (*s_objet_3).objet))
! 1107: .tableau)[indice_i - 1][indice_j - 1] = (*((real8 *)
! 1108: (*s_objet_1).objet));
! 1109: }
! 1110: else if ((*s_objet_1).type == CPL)
! 1111: {
! 1112: /*
! 1113: * Conversion de la matrice en matrice complexe
! 1114: */
! 1115:
! 1116: tampon = (void *) ((real8 **) (*((struct_matrice *)
! 1117: (*s_objet_3).objet)).tableau);
! 1118:
! 1119: (*((struct_matrice *) (*s_objet_3).objet)).type = 'C';
! 1120: (*s_objet_3).type = MCX;
! 1121:
! 1122: if (((*((struct_matrice *) (*s_objet_3).objet)).tableau
! 1123: = malloc((*((struct_matrice *)
! 1124: (*s_objet_3).objet)).nombre_lignes *
! 1125: sizeof(struct_complexe16 *))) == NULL)
! 1126: {
! 1127: (*s_etat_processus).erreur_systeme =
! 1128: d_es_allocation_memoire;
! 1129: return;
! 1130: }
! 1131:
! 1132: for(i = 0; i < (*((struct_matrice *) (*s_objet_3).objet))
! 1133: .nombre_lignes; i++)
! 1134: {
! 1135: if ((((struct_complexe16 **) (*((struct_matrice *)
! 1136: (*s_objet_3).objet)).tableau)[i]
! 1137: = malloc((*((struct_matrice *)
! 1138: (*s_objet_3).objet)).nombre_colonnes *
! 1139: sizeof(struct_complexe16))) == NULL)
! 1140: {
! 1141: (*s_etat_processus).erreur_systeme =
! 1142: d_es_allocation_memoire;
! 1143: return;
! 1144: }
! 1145:
! 1146: for(j = 0; j < (*((struct_matrice *) (*s_objet_3).objet))
! 1147: .nombre_colonnes; j++)
! 1148: {
! 1149: ((struct_complexe16 **) (*((struct_matrice *)
! 1150: (*s_objet_3).objet)).tableau)[i][j]
! 1151: .partie_reelle = (((real8 **)
! 1152: tampon)[i][j]);
! 1153: ((struct_complexe16 **) (*((struct_matrice *)
! 1154: (*s_objet_3).objet)).tableau)[i][j]
! 1155: .partie_imaginaire = (real8) 0;
! 1156: }
! 1157:
! 1158: free(((integer8 **) tampon)[i]);
! 1159: }
! 1160:
! 1161: free((integer8 **) tampon);
! 1162:
! 1163: ((struct_complexe16 **) (*((struct_matrice *)
! 1164: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 1165: [indice_j - 1].partie_reelle = (*((struct_complexe16 *)
! 1166: (*s_objet_1).objet)).partie_reelle;
! 1167: ((struct_complexe16 **) (*((struct_matrice *)
! 1168: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 1169: [indice_j - 1].partie_imaginaire =
! 1170: (*((struct_complexe16 *)
! 1171: (*s_objet_1).objet)).partie_imaginaire;
! 1172: }
! 1173: else
! 1174: {
! 1175: liberation(s_etat_processus, s_objet_1);
! 1176: liberation(s_etat_processus, s_objet_2);
! 1177: liberation(s_etat_processus, s_objet_3);
! 1178:
! 1179: (*s_etat_processus).erreur_execution =
! 1180: d_ex_erreur_type_argument;
! 1181: return;
! 1182: }
! 1183: }
! 1184: else
! 1185: {
! 1186: /*
! 1187: * Matrice de complexes
! 1188: */
! 1189:
! 1190: if ((*s_objet_1).type == INT)
! 1191: {
! 1192: /*
! 1193: * Conversion de l'élément à insérer en complexe
! 1194: */
! 1195:
! 1196: ((struct_complexe16 **) (*((struct_matrice *)
! 1197: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 1198: [indice_j - 1].partie_reelle = (real8) (*((integer8 *)
! 1199: (*s_objet_1).objet));
! 1200: ((struct_complexe16 **) (*((struct_matrice *)
! 1201: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 1202: [indice_j - 1].partie_imaginaire = (real8) 0;
! 1203: }
! 1204: else if ((*s_objet_1).type == REL)
! 1205: {
! 1206: /*
! 1207: * Conversion de l'élément à insérer en complexe
! 1208: */
! 1209:
! 1210: ((struct_complexe16 **) (*((struct_matrice *)
! 1211: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 1212: [indice_j - 1].partie_reelle =
! 1213: (*((real8 *) (*s_objet_1).objet));
! 1214: ((struct_complexe16 **) (*((struct_matrice *)
! 1215: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 1216: [indice_j - 1].partie_imaginaire = (real8) 0;
! 1217: }
! 1218: else if ((*s_objet_1).type == CPL)
! 1219: {
! 1220: /*
! 1221: * Aucune conversion de type
! 1222: */
! 1223:
! 1224: ((struct_complexe16 **) (*((struct_matrice *)
! 1225: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 1226: [indice_j - 1].partie_reelle = (*((struct_complexe16 *)
! 1227: (*s_objet_1).objet)).partie_reelle;
! 1228: ((struct_complexe16 **) (*((struct_matrice *)
! 1229: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 1230: [indice_j - 1].partie_imaginaire =
! 1231: (*((struct_complexe16 *)
! 1232: (*s_objet_1).objet)).partie_imaginaire;
! 1233: }
! 1234: else
! 1235: {
! 1236: liberation(s_etat_processus, s_objet_1);
! 1237: liberation(s_etat_processus, s_objet_2);
! 1238: liberation(s_etat_processus, s_objet_3);
! 1239:
! 1240: (*s_etat_processus).erreur_execution =
! 1241: d_ex_erreur_type_argument;
! 1242: return;
! 1243: }
! 1244: }
! 1245:
! 1246: liberation(s_etat_processus, s_objet_1);
! 1247: liberation(s_etat_processus, s_objet_2);
! 1248:
! 1249: if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 1250: s_objet_3) == d_erreur)
! 1251: {
! 1252: return;
! 1253: }
! 1254: }
! 1255:
! 1256: /*
! 1257: --------------------------------------------------------------------------------
! 1258: Traitement des éléments des listes
! 1259: --------------------------------------------------------------------------------
! 1260: */
! 1261:
! 1262: else if ((*s_objet_3).type == LST)
! 1263: {
! 1264: if ((*s_objet_2).type != INT)
! 1265: {
! 1266: liberation(s_etat_processus, s_objet_1);
! 1267: liberation(s_etat_processus, s_objet_2);
! 1268: liberation(s_etat_processus, s_objet_3);
! 1269:
! 1270: (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
! 1271: return;
! 1272: }
! 1273:
! 1274: indice_i = (*((integer8 *) (*s_objet_2).objet));
! 1275: indice_j = 1;
! 1276:
! 1277: if ((*s_objet_3).nombre_occurrences > 1)
! 1278: {
! 1279: if ((s_copie_3 = copie_objet(s_etat_processus, s_objet_3, 'N'))
! 1280: == NULL)
! 1281: {
! 1282: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1283: return;
! 1284: }
! 1285:
! 1286: liberation(s_etat_processus, s_objet_3);
! 1287: s_objet_3 = s_copie_3;
! 1288: }
! 1289:
! 1290: l_element_courant = (*s_objet_3).objet;
! 1291:
! 1292: while((l_element_courant != NULL) && (indice_j != indice_i))
! 1293: {
! 1294: l_element_courant = (*l_element_courant).suivant;
! 1295: indice_j++;
! 1296: }
! 1297:
! 1298: if (l_element_courant != NULL)
! 1299: {
! 1300: liberation(s_etat_processus, (*l_element_courant).donnee);
! 1301: (*l_element_courant).donnee = s_objet_1;
! 1302: }
! 1303: else
! 1304: {
! 1305: liberation(s_etat_processus, s_objet_1);
! 1306: liberation(s_etat_processus, s_objet_2);
! 1307: liberation(s_etat_processus, s_objet_3);
! 1308:
! 1309: (*s_etat_processus).erreur_execution = d_ex_element_inexistant;
! 1310: return;
! 1311: }
! 1312:
! 1313: liberation(s_etat_processus, s_objet_2);
! 1314:
! 1315: if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 1316: s_objet_3) == d_erreur)
! 1317: {
! 1318: return;
! 1319: }
! 1320: }
! 1321:
! 1322: /*
! 1323: --------------------------------------------------------------------------------
! 1324: Traitement des éléments des tables
! 1325: --------------------------------------------------------------------------------
! 1326: */
! 1327:
! 1328: else if ((*s_objet_3).type == TBL)
! 1329: {
! 1330: if ((*s_objet_2).type != LST)
! 1331: {
! 1332: liberation(s_etat_processus, s_objet_1);
! 1333: liberation(s_etat_processus, s_objet_2);
! 1334: liberation(s_etat_processus, s_objet_3);
! 1335:
! 1336: (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
! 1337: return;
! 1338: }
! 1339:
! 1340: if ((*s_objet_3).nombre_occurrences > 1)
! 1341: {
! 1342: if ((s_copie_3 = copie_objet(s_etat_processus, s_objet_3, 'N'))
! 1343: == NULL)
! 1344: {
! 1345: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1346: return;
! 1347: }
! 1348:
! 1349: liberation(s_etat_processus, s_objet_3);
! 1350: s_objet_3 = s_copie_3;
! 1351: }
! 1352:
! 1353: s_objet_element = s_objet_3;
! 1354: l_element_courant = (*s_objet_2).objet;
! 1355: indice_i = 0;
! 1356:
! 1357: while(l_element_courant != NULL)
! 1358: {
! 1359: if ((*(*l_element_courant).donnee).type != INT)
! 1360: {
! 1361: liberation(s_etat_processus, s_objet_1);
! 1362: liberation(s_etat_processus, s_objet_2);
! 1363: liberation(s_etat_processus, s_objet_3);
! 1364:
! 1365: (*s_etat_processus).erreur_execution =
! 1366: d_ex_erreur_type_argument;
! 1367: return;
! 1368: }
! 1369:
! 1370: if ((*s_objet_element).type != TBL)
! 1371: {
! 1372: liberation(s_etat_processus, s_objet_1);
! 1373: liberation(s_etat_processus, s_objet_2);
! 1374: liberation(s_etat_processus, s_objet_3);
! 1375:
! 1376: (*s_etat_processus).erreur_execution = d_ex_element_inexistant;
! 1377: return;
! 1378: }
! 1379:
! 1380: indice_i = (*((integer8 *) (*(*l_element_courant).donnee).objet));
! 1381:
! 1382: if ((indice_i < 1) || (indice_i > (*((struct_tableau *)
! 1383: (*s_objet_element).objet)).nombre_elements))
! 1384: {
! 1385: liberation(s_etat_processus, s_objet_1);
! 1386: liberation(s_etat_processus, s_objet_2);
! 1387: liberation(s_etat_processus, s_objet_3);
! 1388:
! 1389: (*s_etat_processus).erreur_execution = d_ex_element_inexistant;
! 1390: return;
! 1391: }
! 1392:
! 1393: if ((*l_element_courant).suivant != NULL)
! 1394: {
! 1395: s_objet_element = (*((struct_tableau *) (*s_objet_element)
! 1396: .objet)).elements[indice_i - 1];
! 1397: }
! 1398:
! 1399: l_element_courant = (*l_element_courant).suivant;
! 1400: }
! 1401:
! 1402: liberation(s_etat_processus, (*((struct_tableau *)
! 1403: (*s_objet_element).objet)).elements[indice_i - 1]);
! 1404: (*((struct_tableau *) (*s_objet_element).objet)).elements[indice_i - 1]
! 1405: = s_objet_1;
! 1406:
! 1407: liberation(s_etat_processus, s_objet_2);
! 1408:
! 1409: if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 1410: s_objet_3) == d_erreur)
! 1411: {
! 1412: return;
! 1413: }
! 1414: }
! 1415:
! 1416: /*
! 1417: --------------------------------------------------------------------------------
! 1418: Traitement des noms
! 1419: --------------------------------------------------------------------------------
! 1420: */
! 1421:
! 1422: else if ((*s_objet_3).type == NOM)
! 1423: {
! 1424: variable_partagee = d_faux;
! 1425:
! 1426: if (recherche_variable(s_etat_processus, (*((struct_nom *)
! 1427: (*s_objet_3).objet)).nom) == d_faux)
! 1428: {
! 1429: (*s_etat_processus).erreur_systeme = d_es;
! 1430: (*s_etat_processus).erreur_execution = d_ex_variable_non_definie;
! 1431:
! 1432: liberation(s_etat_processus, s_objet_1);
! 1433: liberation(s_etat_processus, s_objet_2);
! 1434: liberation(s_etat_processus, s_objet_3);
! 1435:
! 1436: return;
! 1437: }
! 1438:
! 1439: if ((*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 1440: .position_variable_courante].variable_verrouillee == d_vrai)
! 1441: {
! 1442: (*s_etat_processus).erreur_execution = d_ex_variable_verrouillee;
! 1443:
! 1444: liberation(s_etat_processus, s_objet_1);
! 1445: liberation(s_etat_processus, s_objet_2);
! 1446: liberation(s_etat_processus, s_objet_3);
! 1447:
! 1448: return;
! 1449: }
! 1450:
! 1451: s_objet_4 = (*s_etat_processus).s_liste_variables
! 1452: [(*s_etat_processus).position_variable_courante].objet;
! 1453:
! 1454: if (s_objet_4 == NULL)
! 1455: {
! 1456: if (pthread_mutex_lock(&((*(*s_etat_processus)
! 1457: .s_liste_variables_partagees).mutex)) != 0)
! 1458: {
! 1459: (*s_etat_processus).erreur_systeme = d_es_processus;
! 1460: return;
! 1461: }
! 1462:
! 1463: if (recherche_variable_partagee(s_etat_processus,
! 1464: (*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 1465: .position_variable_courante].nom,
! 1466: (*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 1467: .position_variable_courante].variable_partagee,
! 1468: (*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 1469: .position_variable_courante].origine) == d_faux)
! 1470: {
! 1471: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 1472: .s_liste_variables_partagees).mutex)) != 0)
! 1473: {
! 1474: (*s_etat_processus).erreur_systeme = d_es_processus;
! 1475: return;
! 1476: }
! 1477:
! 1478: (*s_etat_processus).erreur_systeme = d_es;
! 1479: (*s_etat_processus).erreur_execution =
! 1480: d_ex_variable_non_definie;
! 1481:
! 1482: liberation(s_etat_processus, s_objet_1);
! 1483: liberation(s_etat_processus, s_objet_2);
! 1484: liberation(s_etat_processus, s_objet_3);
! 1485:
! 1486: return;
! 1487: }
! 1488:
! 1489: s_objet_4 = (*(*s_etat_processus).s_liste_variables_partagees)
! 1490: .table[(*(*s_etat_processus).s_liste_variables_partagees)
! 1491: .position_variable].objet;
! 1492: variable_partagee = d_vrai;
! 1493: }
! 1494:
! 1495: if (((*s_objet_4).type == VIN) ||
! 1496: ((*s_objet_4).type == VRL) ||
! 1497: ((*s_objet_4).type == VCX))
! 1498: {
! 1499: if ((*s_objet_2).type != LST)
! 1500: {
! 1501: if (variable_partagee == d_vrai)
! 1502: {
! 1503: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 1504: .s_liste_variables_partagees).mutex)) != 0)
! 1505: {
! 1506: (*s_etat_processus).erreur_systeme = d_es_processus;
! 1507: return;
! 1508: }
! 1509: }
! 1510:
! 1511: liberation(s_etat_processus, s_objet_1);
! 1512: liberation(s_etat_processus, s_objet_2);
! 1513: liberation(s_etat_processus, s_objet_3);
! 1514:
! 1515: (*s_etat_processus).erreur_execution =
! 1516: d_ex_erreur_type_argument;
! 1517: return;
! 1518: }
! 1519:
! 1520: l_element_courant = (*s_objet_2).objet;
! 1521: nombre_dimensions = 0;
! 1522:
! 1523: while(l_element_courant != NULL)
! 1524: {
! 1525: nombre_dimensions++;
! 1526: l_element_courant = (*l_element_courant).suivant;
! 1527: }
! 1528:
! 1529: if (nombre_dimensions != 1)
! 1530: {
! 1531: if (variable_partagee == d_vrai)
! 1532: {
! 1533: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 1534: .s_liste_variables_partagees).mutex)) != 0)
! 1535: {
! 1536: (*s_etat_processus).erreur_systeme = d_es_processus;
! 1537: return;
! 1538: }
! 1539: }
! 1540:
! 1541: liberation(s_etat_processus, s_objet_1);
! 1542: liberation(s_etat_processus, s_objet_2);
! 1543: liberation(s_etat_processus, s_objet_3);
! 1544:
! 1545: (*s_etat_processus).erreur_execution =
! 1546: d_ex_dimensions_invalides;
! 1547: return;
! 1548: }
! 1549:
! 1550: l_element_courant = (*s_objet_2).objet;
! 1551:
! 1552: if ((*(*l_element_courant).donnee).type != INT)
! 1553: {
! 1554: if (variable_partagee == d_vrai)
! 1555: {
! 1556: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 1557: .s_liste_variables_partagees).mutex)) != 0)
! 1558: {
! 1559: (*s_etat_processus).erreur_systeme = d_es_processus;
! 1560: return;
! 1561: }
! 1562: }
! 1563:
! 1564: liberation(s_etat_processus, s_objet_1);
! 1565: liberation(s_etat_processus, s_objet_2);
! 1566: liberation(s_etat_processus, s_objet_3);
! 1567:
! 1568: (*s_etat_processus).erreur_execution =
! 1569: d_ex_erreur_type_argument;
! 1570: return;
! 1571: }
! 1572:
! 1573: if ((*((integer8 *) (*(*l_element_courant).donnee).objet)) <= 0)
! 1574: {
! 1575: if (variable_partagee == d_vrai)
! 1576: {
! 1577: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 1578: .s_liste_variables_partagees).mutex)) != 0)
! 1579: {
! 1580: (*s_etat_processus).erreur_systeme = d_es_processus;
! 1581: return;
! 1582: }
! 1583: }
! 1584:
! 1585: liberation(s_etat_processus, s_objet_1);
! 1586: liberation(s_etat_processus, s_objet_2);
! 1587: liberation(s_etat_processus, s_objet_3);
! 1588:
! 1589: (*s_etat_processus).erreur_execution = d_ex_argument_invalide;
! 1590: return;
! 1591: }
! 1592: else if ((*((integer8 *) (*(*l_element_courant).donnee).objet)) >
! 1593: (integer8) (*((struct_vecteur *) (*s_objet_4).objet))
! 1594: .taille)
! 1595: {
! 1596: if (variable_partagee == d_vrai)
! 1597: {
! 1598: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 1599: .s_liste_variables_partagees).mutex)) != 0)
! 1600: {
! 1601: (*s_etat_processus).erreur_systeme = d_es_processus;
! 1602: return;
! 1603: }
! 1604: }
! 1605:
! 1606: liberation(s_etat_processus, s_objet_1);
! 1607: liberation(s_etat_processus, s_objet_2);
! 1608: liberation(s_etat_processus, s_objet_3);
! 1609:
! 1610: (*s_etat_processus).erreur_execution = d_ex_element_inexistant;
! 1611: return;
! 1612: }
! 1613:
! 1614: indice_i = (*((integer8 *) (*(*l_element_courant).donnee).objet));
! 1615:
! 1616: if ((s_copie_4 = copie_objet(s_etat_processus, s_objet_4, 'Q'))
! 1617: == NULL)
! 1618: {
! 1619: if (variable_partagee == d_vrai)
! 1620: {
! 1621: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 1622: .s_liste_variables_partagees).mutex)) != 0)
! 1623: {
! 1624: (*s_etat_processus).erreur_systeme = d_es_processus;
! 1625: return;
! 1626: }
! 1627: }
! 1628:
! 1629: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1630: return;
! 1631: }
! 1632:
! 1633: liberation(s_etat_processus, s_objet_4);
! 1634: s_objet_4 = s_copie_4;
! 1635:
! 1636: if ((*s_objet_4).type == VIN)
! 1637: {
! 1638: /*
! 1639: * Vecteur d'entiers
! 1640: */
! 1641:
! 1642: if ((*s_objet_1).type == INT)
! 1643: {
! 1644: /*
! 1645: * Aucune conversion de type
! 1646: */
! 1647:
! 1648: ((integer8 *) (*((struct_vecteur *) (*s_objet_4).objet))
! 1649: .tableau)[indice_i - 1] = (*((integer8 *)
! 1650: (*s_objet_1).objet));
! 1651: }
! 1652: else if ((*s_objet_1).type == REL)
! 1653: {
! 1654: /*
! 1655: * Conversion du vecteur en vecteur réel
! 1656: */
! 1657:
! 1658: tampon = (void *) ((integer8 *) (*((struct_vecteur *)
! 1659: (*s_objet_4).objet)).tableau);
! 1660:
! 1661: (*((struct_vecteur *) (*s_objet_4).objet)).type = 'R';
! 1662: (*s_objet_4).type = VRL;
! 1663:
! 1664: if (((*((struct_vecteur *) (*s_objet_4).objet)).tableau
! 1665: = malloc((*((struct_vecteur *)
! 1666: (*s_objet_4).objet)).taille * sizeof(real8)))
! 1667: == NULL)
! 1668: {
! 1669: if (variable_partagee == d_vrai)
! 1670: {
! 1671: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 1672: .s_liste_variables_partagees).mutex)) != 0)
! 1673: {
! 1674: (*s_etat_processus).erreur_systeme =
! 1675: d_es_processus;
! 1676: return;
! 1677: }
! 1678: }
! 1679:
! 1680: (*s_etat_processus).erreur_systeme =
! 1681: d_es_allocation_memoire;
! 1682: return;
! 1683: }
! 1684:
! 1685: for(i = 0; i < (*((struct_vecteur *) (*s_objet_4).objet))
! 1686: .taille; i++)
! 1687: {
! 1688: ((real8 *) (*((struct_vecteur *) (*s_objet_4).objet))
! 1689: .tableau)[i] = (real8) (((integer8 *)
! 1690: tampon)[i]);
! 1691: }
! 1692:
! 1693: free((integer8 *) tampon);
! 1694:
! 1695: ((real8 *) (*((struct_vecteur *) (*s_objet_4).objet))
! 1696: .tableau)[indice_i - 1] = (*((real8 *)
! 1697: (*s_objet_1).objet));
! 1698: }
! 1699: else if ((*s_objet_1).type == CPL)
! 1700: {
! 1701: /*
! 1702: * Conversion du vecteur en vecteur complexe
! 1703: */
! 1704:
! 1705: tampon = (void *) ((integer8 *) (*((struct_vecteur *)
! 1706: (*s_objet_4).objet)).tableau);
! 1707:
! 1708: (*((struct_vecteur *) (*s_objet_4).objet)).type = 'C';
! 1709: (*s_objet_4).type = VCX;
! 1710:
! 1711: if (((*((struct_vecteur *) (*s_objet_4).objet)).tableau
! 1712: = malloc((*((struct_vecteur *)
! 1713: (*s_objet_4).objet)).taille *
! 1714: sizeof(struct_complexe16))) == NULL)
! 1715: {
! 1716: if (variable_partagee == d_vrai)
! 1717: {
! 1718: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 1719: .s_liste_variables_partagees).mutex)) != 0)
! 1720: {
! 1721: (*s_etat_processus).erreur_systeme =
! 1722: d_es_processus;
! 1723: return;
! 1724: }
! 1725: }
! 1726:
! 1727: (*s_etat_processus).erreur_systeme =
! 1728: d_es_allocation_memoire;
! 1729: return;
! 1730: }
! 1731:
! 1732: for(i = 0; i < (*((struct_vecteur *) (*s_objet_4).objet))
! 1733: .taille; i++)
! 1734: {
! 1735: ((struct_complexe16 *) (*((struct_vecteur *)
! 1736: (*s_objet_4).objet)).tableau)[i].partie_reelle =
! 1737: (real8) (((integer8 *) tampon)[i]);
! 1738: ((struct_complexe16 *) (*((struct_vecteur *)
! 1739: (*s_objet_4).objet)).tableau)[i]
! 1740: .partie_imaginaire = (real8) 0;
! 1741: }
! 1742:
! 1743: free((integer8 *) tampon);
! 1744:
! 1745: ((struct_complexe16 *) (*((struct_vecteur *)
! 1746: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 1747: .partie_reelle = (*((struct_complexe16 *)
! 1748: (*s_objet_1).objet)).partie_reelle;
! 1749: ((struct_complexe16 *) (*((struct_vecteur *)
! 1750: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 1751: .partie_imaginaire = (*((struct_complexe16 *)
! 1752: (*s_objet_1).objet)).partie_imaginaire;
! 1753: }
! 1754: else
! 1755: {
! 1756: if (variable_partagee == d_vrai)
! 1757: {
! 1758: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 1759: .s_liste_variables_partagees).mutex)) != 0)
! 1760: {
! 1761: (*s_etat_processus).erreur_systeme =
! 1762: d_es_processus;
! 1763: return;
! 1764: }
! 1765: }
! 1766:
! 1767: liberation(s_etat_processus, s_objet_1);
! 1768: liberation(s_etat_processus, s_objet_2);
! 1769: liberation(s_etat_processus, s_objet_3);
! 1770:
! 1771: (*s_etat_processus).erreur_execution =
! 1772: d_ex_erreur_type_argument;
! 1773: return;
! 1774: }
! 1775: }
! 1776: else if ((*s_objet_4).type == VRL)
! 1777: {
! 1778: /*
! 1779: * Vecteur de réels
! 1780: */
! 1781:
! 1782: if ((*s_objet_1).type == INT)
! 1783: {
! 1784: /*
! 1785: * Conversion de l'élément à insérer en réel
! 1786: */
! 1787:
! 1788: ((real8 *) (*((struct_vecteur *) (*s_objet_4).objet))
! 1789: .tableau)[indice_i - 1] = (real8) (*((integer8 *)
! 1790: (*s_objet_1).objet));
! 1791: }
! 1792: else if ((*s_objet_1).type == REL)
! 1793: {
! 1794: /*
! 1795: * Aucune conversion de type
! 1796: */
! 1797:
! 1798: ((real8 *) (*((struct_vecteur *) (*s_objet_4).objet))
! 1799: .tableau)[indice_i - 1] = (*((real8 *)
! 1800: (*s_objet_1).objet));
! 1801: }
! 1802: else if ((*s_objet_1).type == CPL)
! 1803: {
! 1804: /*
! 1805: * Conversion du vecteur en vecteur complexe
! 1806: */
! 1807:
! 1808: tampon = (void *) ((integer8 *) (*((struct_vecteur *)
! 1809: (*s_objet_4).objet)).tableau);
! 1810:
! 1811: (*((struct_vecteur *) (*s_objet_4).objet)).type = 'C';
! 1812: (*s_objet_4).type = VCX;
! 1813:
! 1814: if (((*((struct_vecteur *) (*s_objet_4).objet)).tableau
! 1815: = malloc((*((struct_vecteur *)
! 1816: (*s_objet_4).objet)).taille *
! 1817: sizeof(struct_complexe16))) == NULL)
! 1818: {
! 1819: if (variable_partagee == d_vrai)
! 1820: {
! 1821: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 1822: .s_liste_variables_partagees).mutex)) != 0)
! 1823: {
! 1824: (*s_etat_processus).erreur_systeme =
! 1825: d_es_processus;
! 1826: return;
! 1827: }
! 1828: }
! 1829:
! 1830: (*s_etat_processus).erreur_systeme =
! 1831: d_es_allocation_memoire;
! 1832: return;
! 1833: }
! 1834:
! 1835: for(i = 0; i < (*((struct_vecteur *) (*s_objet_4).objet))
! 1836: .taille; i++)
! 1837: {
! 1838: ((struct_complexe16 *) (*((struct_vecteur *)
! 1839: (*s_objet_4).objet)).tableau)[i].partie_reelle =
! 1840: ((real8 *) tampon)[i];
! 1841: ((struct_complexe16 *) (*((struct_vecteur *)
! 1842: (*s_objet_4).objet)).tableau)[i]
! 1843: .partie_imaginaire = (real8) 0;
! 1844: }
! 1845:
! 1846: free((real8 *) tampon);
! 1847:
! 1848: ((struct_complexe16 *) (*((struct_vecteur *)
! 1849: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 1850: .partie_reelle = (*((struct_complexe16 *)
! 1851: (*s_objet_1).objet)).partie_reelle;
! 1852: ((struct_complexe16 *) (*((struct_vecteur *)
! 1853: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 1854: .partie_imaginaire = (*((struct_complexe16 *)
! 1855: (*s_objet_1).objet)).partie_imaginaire;
! 1856: }
! 1857: else
! 1858: {
! 1859: if (variable_partagee == d_vrai)
! 1860: {
! 1861: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 1862: .s_liste_variables_partagees).mutex)) != 0)
! 1863: {
! 1864: (*s_etat_processus).erreur_systeme =
! 1865: d_es_processus;
! 1866: return;
! 1867: }
! 1868: }
! 1869:
! 1870: liberation(s_etat_processus, s_objet_1);
! 1871: liberation(s_etat_processus, s_objet_2);
! 1872: liberation(s_etat_processus, s_objet_3);
! 1873:
! 1874: (*s_etat_processus).erreur_execution =
! 1875: d_ex_erreur_type_argument;
! 1876: return;
! 1877: }
! 1878: }
! 1879: else
! 1880: {
! 1881: /*
! 1882: * Vecteur de complexes
! 1883: */
! 1884:
! 1885: if ((*s_objet_1).type == INT)
! 1886: {
! 1887: /*
! 1888: * Conversion de l'élément à insérer en complexe
! 1889: */
! 1890:
! 1891: ((struct_complexe16 *) (*((struct_vecteur *)
! 1892: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 1893: .partie_reelle = (real8) (*((integer8 *)
! 1894: (*s_objet_1).objet));
! 1895: ((struct_complexe16 *) (*((struct_vecteur *)
! 1896: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 1897: .partie_imaginaire = (real8) 0;
! 1898: }
! 1899: else if ((*s_objet_1).type == REL)
! 1900: {
! 1901: /*
! 1902: * Conversion de l'élément à insérer en complexe
! 1903: */
! 1904:
! 1905: ((struct_complexe16 *) (*((struct_vecteur *)
! 1906: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 1907: .partie_reelle = (*((real8 *) (*s_objet_1).objet));
! 1908: ((struct_complexe16 *) (*((struct_vecteur *)
! 1909: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 1910: .partie_imaginaire = (real8) 0;
! 1911: }
! 1912: else if ((*s_objet_1).type == CPL)
! 1913: {
! 1914: /*
! 1915: * Aucune conversion de type
! 1916: */
! 1917:
! 1918: ((struct_complexe16 *) (*((struct_vecteur *)
! 1919: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 1920: .partie_reelle = (*((struct_complexe16 *)
! 1921: (*s_objet_1).objet)).partie_reelle;
! 1922: ((struct_complexe16 *) (*((struct_vecteur *)
! 1923: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 1924: .partie_imaginaire = (*((struct_complexe16 *)
! 1925: (*s_objet_1).objet)).partie_imaginaire;
! 1926: }
! 1927: else
! 1928: {
! 1929: if (variable_partagee == d_vrai)
! 1930: {
! 1931: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 1932: .s_liste_variables_partagees).mutex)) != 0)
! 1933: {
! 1934: (*s_etat_processus).erreur_systeme =
! 1935: d_es_processus;
! 1936: return;
! 1937: }
! 1938: }
! 1939:
! 1940: liberation(s_etat_processus, s_objet_1);
! 1941: liberation(s_etat_processus, s_objet_2);
! 1942: liberation(s_etat_processus, s_objet_3);
! 1943:
! 1944: (*s_etat_processus).erreur_execution =
! 1945: d_ex_erreur_type_argument;
! 1946: return;
! 1947: }
! 1948: }
! 1949:
! 1950: if (variable_partagee == d_faux)
! 1951: {
! 1952: (*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 1953: .position_variable_courante].objet = s_objet_4;
! 1954: }
! 1955: else
! 1956: {
! 1957: (*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 1958: .position_variable_courante].objet = NULL;
! 1959: (*(*s_etat_processus).s_liste_variables_partagees).table
! 1960: [(*(*s_etat_processus).s_liste_variables_partagees)
! 1961: .position_variable].objet = s_objet_4;
! 1962:
! 1963: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 1964: .s_liste_variables_partagees).mutex)) != 0)
! 1965: {
! 1966: (*s_etat_processus).erreur_systeme = d_es_processus;
! 1967: return;
! 1968: }
! 1969: }
! 1970:
! 1971: liberation(s_etat_processus, s_objet_1);
! 1972: liberation(s_etat_processus, s_objet_2);
! 1973: liberation(s_etat_processus, s_objet_3);
! 1974: }
! 1975: else if (((*s_objet_4).type == MIN) ||
! 1976: ((*s_objet_4).type == MRL) ||
! 1977: ((*s_objet_4).type == MCX))
! 1978: {
! 1979: if ((*s_objet_2).type != LST)
! 1980: {
! 1981: if (variable_partagee == d_vrai)
! 1982: {
! 1983: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 1984: .s_liste_variables_partagees).mutex)) != 0)
! 1985: {
! 1986: (*s_etat_processus).erreur_systeme = d_es_processus;
! 1987: return;
! 1988: }
! 1989: }
! 1990:
! 1991: liberation(s_etat_processus, s_objet_1);
! 1992: liberation(s_etat_processus, s_objet_2);
! 1993: liberation(s_etat_processus, s_objet_3);
! 1994:
! 1995: (*s_etat_processus).erreur_execution =
! 1996: d_ex_erreur_type_argument;
! 1997: return;
! 1998: }
! 1999:
! 2000: l_element_courant = (*s_objet_2).objet;
! 2001: nombre_dimensions = 0;
! 2002:
! 2003: while(l_element_courant != NULL)
! 2004: {
! 2005: nombre_dimensions++;
! 2006: l_element_courant = (*l_element_courant).suivant;
! 2007: }
! 2008:
! 2009: if (nombre_dimensions != 2)
! 2010: {
! 2011: if (variable_partagee == d_vrai)
! 2012: {
! 2013: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 2014: .s_liste_variables_partagees).mutex)) != 0)
! 2015: {
! 2016: (*s_etat_processus).erreur_systeme = d_es_processus;
! 2017: return;
! 2018: }
! 2019: }
! 2020:
! 2021: liberation(s_etat_processus, s_objet_1);
! 2022: liberation(s_etat_processus, s_objet_2);
! 2023: liberation(s_etat_processus, s_objet_3);
! 2024:
! 2025: (*s_etat_processus).erreur_execution =
! 2026: d_ex_dimensions_invalides;
! 2027: return;
! 2028: }
! 2029:
! 2030: l_element_courant = (*s_objet_2).objet;
! 2031:
! 2032: indice_i = 0;
! 2033: indice_j = 0;
! 2034:
! 2035: while(l_element_courant != NULL)
! 2036: {
! 2037: if ((*(*l_element_courant).donnee).type != INT)
! 2038: {
! 2039: if (variable_partagee == d_vrai)
! 2040: {
! 2041: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 2042: .s_liste_variables_partagees).mutex)) != 0)
! 2043: {
! 2044: (*s_etat_processus).erreur_systeme = d_es_processus;
! 2045: return;
! 2046: }
! 2047: }
! 2048:
! 2049: liberation(s_etat_processus, s_objet_1);
! 2050: liberation(s_etat_processus, s_objet_2);
! 2051: liberation(s_etat_processus, s_objet_3);
! 2052:
! 2053: (*s_etat_processus).erreur_execution =
! 2054: d_ex_erreur_type_argument;
! 2055: return;
! 2056: }
! 2057:
! 2058: if ((*((integer8 *) (*(*l_element_courant).donnee).objet))
! 2059: <= 0)
! 2060: {
! 2061: if (variable_partagee == d_vrai)
! 2062: {
! 2063: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 2064: .s_liste_variables_partagees).mutex)) != 0)
! 2065: {
! 2066: (*s_etat_processus).erreur_systeme = d_es_processus;
! 2067: return;
! 2068: }
! 2069: }
! 2070:
! 2071: liberation(s_etat_processus, s_objet_1);
! 2072: liberation(s_etat_processus, s_objet_2);
! 2073: liberation(s_etat_processus, s_objet_3);
! 2074:
! 2075: (*s_etat_processus).erreur_execution =
! 2076: d_ex_argument_invalide;
! 2077: return;
! 2078: }
! 2079:
! 2080: if (indice_i == 0)
! 2081: {
! 2082: indice_i = (*((integer8 *)
! 2083: (*(*l_element_courant).donnee).objet));
! 2084: }
! 2085: else
! 2086: {
! 2087: indice_j = (*((integer8 *)
! 2088: (*(*l_element_courant).donnee).objet));
! 2089: }
! 2090:
! 2091: l_element_courant = (*l_element_courant).suivant;
! 2092: }
! 2093:
! 2094: if ((indice_i > (*((struct_matrice *) (*s_objet_4).objet))
! 2095: .nombre_lignes) || (indice_j > (*((struct_matrice *)
! 2096: (*s_objet_4).objet)).nombre_colonnes))
! 2097: {
! 2098: if (variable_partagee == d_vrai)
! 2099: {
! 2100: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 2101: .s_liste_variables_partagees).mutex)) != 0)
! 2102: {
! 2103: (*s_etat_processus).erreur_systeme = d_es_processus;
! 2104: return;
! 2105: }
! 2106: }
! 2107:
! 2108: liberation(s_etat_processus, s_objet_1);
! 2109: liberation(s_etat_processus, s_objet_2);
! 2110: liberation(s_etat_processus, s_objet_3);
! 2111:
! 2112: (*s_etat_processus).erreur_execution = d_ex_element_inexistant;
! 2113: return;
! 2114: }
! 2115:
! 2116: if ((s_copie_4 = copie_objet(s_etat_processus, s_objet_4, 'Q'))
! 2117: == NULL)
! 2118: {
! 2119: if (variable_partagee == d_vrai)
! 2120: {
! 2121: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 2122: .s_liste_variables_partagees).mutex)) != 0)
! 2123: {
! 2124: (*s_etat_processus).erreur_systeme = d_es_processus;
! 2125: return;
! 2126: }
! 2127: }
! 2128:
! 2129: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 2130: return;
! 2131: }
! 2132:
! 2133: liberation(s_etat_processus, s_objet_4);
! 2134: s_objet_4 = s_copie_4;
! 2135:
! 2136: if ((*s_objet_4).type == MIN)
! 2137: {
! 2138: /*
! 2139: * Matrice d'entiers
! 2140: */
! 2141:
! 2142: if ((*s_objet_1).type == INT)
! 2143: {
! 2144: /*
! 2145: * Aucune conversion de type
! 2146: */
! 2147:
! 2148: ((integer8 **) (*((struct_matrice *) (*s_objet_4).objet))
! 2149: .tableau)[indice_i - 1][indice_j - 1] =
! 2150: (*((integer8 *) (*s_objet_1).objet));
! 2151: }
! 2152: else if ((*s_objet_1).type == REL)
! 2153: {
! 2154: /*
! 2155: * Conversion de la matrice en matrice réelle
! 2156: */
! 2157:
! 2158: tampon = (void *) ((integer8 **) (*((struct_matrice *)
! 2159: (*s_objet_4).objet)).tableau);
! 2160:
! 2161: (*((struct_matrice *) (*s_objet_4).objet)).type = 'R';
! 2162: (*s_objet_4).type = MRL;
! 2163:
! 2164: if (((*((struct_matrice *) (*s_objet_4).objet)).tableau
! 2165: = malloc((*((struct_matrice *)
! 2166: (*s_objet_4).objet)).nombre_lignes *
! 2167: sizeof(real8 *))) == NULL)
! 2168: {
! 2169: if (variable_partagee == d_vrai)
! 2170: {
! 2171: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 2172: .s_liste_variables_partagees).mutex)) != 0)
! 2173: {
! 2174: (*s_etat_processus).erreur_systeme =
! 2175: d_es_processus;
! 2176: return;
! 2177: }
! 2178: }
! 2179:
! 2180: (*s_etat_processus).erreur_systeme =
! 2181: d_es_allocation_memoire;
! 2182: return;
! 2183: }
! 2184:
! 2185: for(i = 0; i < (*((struct_matrice *) (*s_objet_4).objet))
! 2186: .nombre_lignes; i++)
! 2187: {
! 2188: if ((((real8 **) (*((struct_matrice *)
! 2189: (*s_objet_4).objet)).tableau)[i]
! 2190: = malloc((*((struct_matrice *)
! 2191: (*s_objet_4).objet)).nombre_colonnes *
! 2192: sizeof(real8))) == NULL)
! 2193: {
! 2194: if (variable_partagee == d_vrai)
! 2195: {
! 2196: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 2197: .s_liste_variables_partagees).mutex))
! 2198: != 0)
! 2199: {
! 2200: (*s_etat_processus).erreur_systeme =
! 2201: d_es_processus;
! 2202: return;
! 2203: }
! 2204: }
! 2205:
! 2206: (*s_etat_processus).erreur_systeme =
! 2207: d_es_allocation_memoire;
! 2208: return;
! 2209: }
! 2210:
! 2211: for(j = 0; j < (*((struct_matrice *)
! 2212: (*s_objet_4).objet)).nombre_colonnes; j++)
! 2213: {
! 2214: ((real8 **) (*((struct_matrice *) (*s_objet_4)
! 2215: .objet)).tableau)[i][j] = (real8)
! 2216: (((integer8 **) tampon)[i][j]);
! 2217: }
! 2218:
! 2219: free(((integer8 **) tampon)[i]);
! 2220: }
! 2221:
! 2222: free((integer8 **) tampon);
! 2223:
! 2224: ((real8 **) (*((struct_matrice *) (*s_objet_4).objet))
! 2225: .tableau)[indice_i - 1][indice_j - 1] =
! 2226: (*((real8 *) (*s_objet_1).objet));
! 2227: }
! 2228: else if ((*s_objet_1).type == CPL)
! 2229: {
! 2230: /*
! 2231: * Conversion de la matrice en matrice complexe
! 2232: */
! 2233:
! 2234: tampon = (void *) ((integer8 **) (*((struct_matrice *)
! 2235: (*s_objet_4).objet)).tableau);
! 2236:
! 2237: (*((struct_matrice *) (*s_objet_4).objet)).type = 'C';
! 2238: (*s_objet_4).type = MCX;
! 2239:
! 2240: if (((*((struct_matrice *) (*s_objet_4).objet)).tableau
! 2241: = malloc((*((struct_matrice *)
! 2242: (*s_objet_4).objet)).nombre_lignes *
! 2243: sizeof(struct_complexe16 *))) == NULL)
! 2244: {
! 2245: if (variable_partagee == d_vrai)
! 2246: {
! 2247: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 2248: .s_liste_variables_partagees).mutex)) != 0)
! 2249: {
! 2250: (*s_etat_processus).erreur_systeme =
! 2251: d_es_processus;
! 2252: return;
! 2253: }
! 2254: }
! 2255:
! 2256: (*s_etat_processus).erreur_systeme =
! 2257: d_es_allocation_memoire;
! 2258: return;
! 2259: }
! 2260:
! 2261: for(i = 0; i < (*((struct_matrice *) (*s_objet_4).objet))
! 2262: .nombre_lignes; i++)
! 2263: {
! 2264: if ((((struct_complexe16 **) (*((struct_matrice *)
! 2265: (*s_objet_4).objet)).tableau)[i]
! 2266: = malloc((*((struct_matrice *)
! 2267: (*s_objet_4).objet)).nombre_colonnes *
! 2268: sizeof(struct_complexe16))) == NULL)
! 2269: {
! 2270: if (variable_partagee == d_vrai)
! 2271: {
! 2272: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 2273: .s_liste_variables_partagees).mutex))
! 2274: != 0)
! 2275: {
! 2276: (*s_etat_processus).erreur_systeme =
! 2277: d_es_processus;
! 2278: return;
! 2279: }
! 2280: }
! 2281:
! 2282: (*s_etat_processus).erreur_systeme =
! 2283: d_es_allocation_memoire;
! 2284: return;
! 2285: }
! 2286:
! 2287: for(j = 0; j < (*((struct_matrice *)
! 2288: (*s_objet_4).objet)).nombre_colonnes; j++)
! 2289: {
! 2290: ((struct_complexe16 **) (*((struct_matrice *)
! 2291: (*s_objet_4).objet)).tableau)[i][j]
! 2292: .partie_reelle = (real8) (((integer8 **)
! 2293: tampon)[i][j]);
! 2294: ((struct_complexe16 **) (*((struct_matrice *)
! 2295: (*s_objet_4).objet)).tableau)[i][j]
! 2296: .partie_imaginaire = (real8) 0;
! 2297: }
! 2298:
! 2299: free(((integer8 **) tampon)[i]);
! 2300: }
! 2301:
! 2302: free((integer8 **) tampon);
! 2303:
! 2304: ((struct_complexe16 **) (*((struct_matrice *)
! 2305: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 2306: [indice_j - 1].partie_reelle =
! 2307: (*((struct_complexe16 *)
! 2308: (*s_objet_1).objet)).partie_reelle;
! 2309: ((struct_complexe16 **) (*((struct_matrice *)
! 2310: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 2311: [indice_j - 1].partie_imaginaire =
! 2312: (*((struct_complexe16 *)
! 2313: (*s_objet_1).objet)).partie_imaginaire;
! 2314: }
! 2315: else
! 2316: {
! 2317: if (variable_partagee == d_vrai)
! 2318: {
! 2319: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 2320: .s_liste_variables_partagees).mutex)) != 0)
! 2321: {
! 2322: (*s_etat_processus).erreur_systeme =
! 2323: d_es_processus;
! 2324: return;
! 2325: }
! 2326: }
! 2327:
! 2328: liberation(s_etat_processus, s_objet_1);
! 2329: liberation(s_etat_processus, s_objet_2);
! 2330: liberation(s_etat_processus, s_objet_3);
! 2331:
! 2332: (*s_etat_processus).erreur_execution =
! 2333: d_ex_erreur_type_argument;
! 2334: return;
! 2335: }
! 2336: }
! 2337: else if ((*s_objet_4).type == MRL)
! 2338: {
! 2339: /*
! 2340: * Matrice de réels
! 2341: */
! 2342:
! 2343: if ((*s_objet_1).type == INT)
! 2344: {
! 2345: /*
! 2346: * Conversion de l'élément à insérer en réel
! 2347: */
! 2348:
! 2349: ((real8 **) (*((struct_matrice *) (*s_objet_4).objet))
! 2350: .tableau)[indice_i - 1][indice_j - 1] =
! 2351: (real8) (*((integer8 *) (*s_objet_1).objet));
! 2352: }
! 2353: else if ((*s_objet_1).type == REL)
! 2354: {
! 2355: /*
! 2356: * Aucune conversion de type
! 2357: */
! 2358:
! 2359: ((real8 **) (*((struct_matrice *) (*s_objet_4).objet))
! 2360: .tableau)[indice_i - 1][indice_j - 1] =
! 2361: (*((real8 *) (*s_objet_1).objet));
! 2362: }
! 2363: else if ((*s_objet_1).type == CPL)
! 2364: {
! 2365: /*
! 2366: * Conversion de la matrice en matrice complexe
! 2367: */
! 2368:
! 2369: tampon = (void *) ((real8 **) (*((struct_matrice *)
! 2370: (*s_objet_4).objet)).tableau);
! 2371:
! 2372: (*((struct_matrice *) (*s_objet_4).objet)).type = 'C';
! 2373: (*s_objet_4).type = MCX;
! 2374:
! 2375: if (((*((struct_matrice *) (*s_objet_4).objet)).tableau
! 2376: = malloc((*((struct_matrice *)
! 2377: (*s_objet_4).objet)).nombre_lignes *
! 2378: sizeof(struct_complexe16 *))) == NULL)
! 2379: {
! 2380: if (variable_partagee == d_vrai)
! 2381: {
! 2382: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 2383: .s_liste_variables_partagees).mutex))
! 2384: != 0)
! 2385: {
! 2386: (*s_etat_processus).erreur_systeme =
! 2387: d_es_processus;
! 2388: return;
! 2389: }
! 2390: }
! 2391:
! 2392: (*s_etat_processus).erreur_systeme =
! 2393: d_es_allocation_memoire;
! 2394: return;
! 2395: }
! 2396:
! 2397: for(i = 0; i < (*((struct_matrice *) (*s_objet_4).objet))
! 2398: .nombre_lignes; i++)
! 2399: {
! 2400: if ((((struct_complexe16 **) (*((struct_matrice *)
! 2401: (*s_objet_4).objet)).tableau)[i]
! 2402: = malloc((*((struct_matrice *)
! 2403: (*s_objet_4).objet)).nombre_colonnes *
! 2404: sizeof(struct_complexe16))) == NULL)
! 2405: {
! 2406: if (variable_partagee == d_vrai)
! 2407: {
! 2408: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 2409: .s_liste_variables_partagees).mutex))
! 2410: != 0)
! 2411: {
! 2412: (*s_etat_processus).erreur_systeme =
! 2413: d_es_processus;
! 2414: return;
! 2415: }
! 2416: }
! 2417:
! 2418: (*s_etat_processus).erreur_systeme =
! 2419: d_es_allocation_memoire;
! 2420: return;
! 2421: }
! 2422:
! 2423: for(j = 0; j < (*((struct_matrice *)
! 2424: (*s_objet_4).objet)).nombre_colonnes; j++)
! 2425: {
! 2426: ((struct_complexe16 **) (*((struct_matrice *)
! 2427: (*s_objet_4).objet)).tableau)[i][j]
! 2428: .partie_reelle = (((real8 **)
! 2429: tampon)[i][j]);
! 2430: ((struct_complexe16 **) (*((struct_matrice *)
! 2431: (*s_objet_4).objet)).tableau)[i][j]
! 2432: .partie_imaginaire = (real8) 0;
! 2433: }
! 2434:
! 2435: free(((integer8 **) tampon)[i]);
! 2436: }
! 2437:
! 2438: free((integer8 **) tampon);
! 2439:
! 2440: ((struct_complexe16 **) (*((struct_matrice *)
! 2441: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 2442: [indice_j - 1].partie_reelle =
! 2443: (*((struct_complexe16 *)
! 2444: (*s_objet_1).objet)).partie_reelle;
! 2445: ((struct_complexe16 **) (*((struct_matrice *)
! 2446: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 2447: [indice_j - 1].partie_imaginaire =
! 2448: (*((struct_complexe16 *)
! 2449: (*s_objet_1).objet)).partie_imaginaire;
! 2450: }
! 2451: else
! 2452: {
! 2453: if (variable_partagee == d_vrai)
! 2454: {
! 2455: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 2456: .s_liste_variables_partagees).mutex)) != 0)
! 2457: {
! 2458: (*s_etat_processus).erreur_systeme =
! 2459: d_es_processus;
! 2460: return;
! 2461: }
! 2462: }
! 2463:
! 2464: liberation(s_etat_processus, s_objet_1);
! 2465: liberation(s_etat_processus, s_objet_2);
! 2466: liberation(s_etat_processus, s_objet_3);
! 2467:
! 2468: (*s_etat_processus).erreur_execution =
! 2469: d_ex_erreur_type_argument;
! 2470: return;
! 2471: }
! 2472: }
! 2473: else
! 2474: {
! 2475: /*
! 2476: * Matrice de complexes
! 2477: */
! 2478:
! 2479: if ((*s_objet_1).type == INT)
! 2480: {
! 2481: /*
! 2482: * Conversion de l'élément à insérer en complexe
! 2483: */
! 2484:
! 2485: ((struct_complexe16 **) (*((struct_matrice *)
! 2486: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 2487: [indice_j - 1].partie_reelle = (real8)
! 2488: (*((integer8 *) (*s_objet_1).objet));
! 2489: ((struct_complexe16 **) (*((struct_matrice *)
! 2490: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 2491: [indice_j - 1].partie_imaginaire = (real8) 0;
! 2492: }
! 2493: else if ((*s_objet_1).type == REL)
! 2494: {
! 2495: /*
! 2496: * Conversion de l'élément à insérer en complexe
! 2497: */
! 2498:
! 2499: ((struct_complexe16 **) (*((struct_matrice *)
! 2500: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 2501: [indice_j - 1].partie_reelle =
! 2502: (*((real8 *) (*s_objet_1).objet));
! 2503: ((struct_complexe16 **) (*((struct_matrice *)
! 2504: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 2505: [indice_j - 1].partie_imaginaire = (real8) 0;
! 2506: }
! 2507: else if ((*s_objet_1).type == CPL)
! 2508: {
! 2509: /*
! 2510: * Aucune conversion de type
! 2511: */
! 2512:
! 2513: ((struct_complexe16 **) (*((struct_matrice *)
! 2514: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 2515: [indice_j - 1].partie_reelle =
! 2516: (*((struct_complexe16 *)
! 2517: (*s_objet_1).objet)).partie_reelle;
! 2518: ((struct_complexe16 **) (*((struct_matrice *)
! 2519: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 2520: [indice_j - 1].partie_imaginaire =
! 2521: (*((struct_complexe16 *)
! 2522: (*s_objet_1).objet)).partie_imaginaire;
! 2523: }
! 2524: else
! 2525: {
! 2526: if (variable_partagee == d_vrai)
! 2527: {
! 2528: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 2529: .s_liste_variables_partagees).mutex)) != 0)
! 2530: {
! 2531: (*s_etat_processus).erreur_systeme =
! 2532: d_es_processus;
! 2533: return;
! 2534: }
! 2535: }
! 2536:
! 2537: liberation(s_etat_processus, s_objet_1);
! 2538: liberation(s_etat_processus, s_objet_2);
! 2539: liberation(s_etat_processus, s_objet_3);
! 2540:
! 2541: (*s_etat_processus).erreur_execution =
! 2542: d_ex_erreur_type_argument;
! 2543: return;
! 2544: }
! 2545: }
! 2546:
! 2547: if (variable_partagee == d_faux)
! 2548: {
! 2549: (*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 2550: .position_variable_courante].objet = s_objet_4;
! 2551: }
! 2552: else
! 2553: {
! 2554: (*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 2555: .position_variable_courante].objet = NULL;
! 2556: (*(*s_etat_processus).s_liste_variables_partagees).table
! 2557: [(*(*s_etat_processus).s_liste_variables_partagees)
! 2558: .position_variable].objet = s_objet_4;
! 2559:
! 2560: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 2561: .s_liste_variables_partagees).mutex))
! 2562: != 0)
! 2563: {
! 2564: (*s_etat_processus).erreur_systeme =
! 2565: d_es_processus;
! 2566: return;
! 2567: }
! 2568: }
! 2569:
! 2570: liberation(s_etat_processus, s_objet_1);
! 2571: liberation(s_etat_processus, s_objet_2);
! 2572: liberation(s_etat_processus, s_objet_3);
! 2573: }
! 2574: else if ((*s_objet_4).type == LST)
! 2575: {
! 2576: if ((*s_objet_2).type != INT)
! 2577: {
! 2578: if (variable_partagee == d_vrai)
! 2579: {
! 2580: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 2581: .s_liste_variables_partagees).mutex))
! 2582: != 0)
! 2583: {
! 2584: (*s_etat_processus).erreur_systeme =
! 2585: d_es_processus;
! 2586: return;
! 2587: }
! 2588: }
! 2589:
! 2590: liberation(s_etat_processus, s_objet_1);
! 2591: liberation(s_etat_processus, s_objet_2);
! 2592: liberation(s_etat_processus, s_objet_3);
! 2593:
! 2594: (*s_etat_processus).erreur_execution =
! 2595: d_ex_erreur_type_argument;
! 2596: return;
! 2597: }
! 2598:
! 2599: indice_i = (*((integer8 *) (*s_objet_2).objet));
! 2600: indice_j = 1;
! 2601:
! 2602: if ((*s_objet_4).nombre_occurrences > 1)
! 2603: {
! 2604: if ((s_copie_4 = copie_objet(s_etat_processus, s_objet_4, 'N'))
! 2605: == NULL)
! 2606: {
! 2607: if (variable_partagee == d_vrai)
! 2608: {
! 2609: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 2610: .s_liste_variables_partagees).mutex))
! 2611: != 0)
! 2612: {
! 2613: (*s_etat_processus).erreur_systeme =
! 2614: d_es_processus;
! 2615: return;
! 2616: }
! 2617: }
! 2618:
! 2619: (*s_etat_processus).erreur_systeme =
! 2620: d_es_allocation_memoire;
! 2621: return;
! 2622: }
! 2623:
! 2624: liberation(s_etat_processus, s_objet_4);
! 2625: s_objet_4 = s_copie_4;
! 2626: }
! 2627:
! 2628: l_element_courant = (*s_objet_4).objet;
! 2629:
! 2630: while((l_element_courant != NULL) && (indice_j != indice_i))
! 2631: {
! 2632: l_element_courant = (*l_element_courant).suivant;
! 2633: indice_j++;
! 2634: }
! 2635:
! 2636: if (l_element_courant != NULL)
! 2637: {
! 2638: liberation(s_etat_processus, (*l_element_courant).donnee);
! 2639: (*l_element_courant).donnee = s_objet_1;
! 2640: }
! 2641: else
! 2642: {
! 2643: if (variable_partagee == d_vrai)
! 2644: {
! 2645: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 2646: .s_liste_variables_partagees).mutex)) != 0)
! 2647: {
! 2648: (*s_etat_processus).erreur_systeme =
! 2649: d_es_processus;
! 2650: return;
! 2651: }
! 2652: }
! 2653:
! 2654: liberation(s_etat_processus, s_objet_1);
! 2655: liberation(s_etat_processus, s_objet_2);
! 2656: liberation(s_etat_processus, s_objet_3);
! 2657:
! 2658: (*s_etat_processus).erreur_execution = d_ex_element_inexistant;
! 2659: return;
! 2660: }
! 2661:
! 2662: if (variable_partagee == d_faux)
! 2663: {
! 2664: (*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 2665: .position_variable_courante].objet = s_objet_4;
! 2666: }
! 2667: else
! 2668: {
! 2669: (*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 2670: .position_variable_courante].objet = NULL;
! 2671: (*(*s_etat_processus).s_liste_variables_partagees).table
! 2672: [(*(*s_etat_processus).s_liste_variables_partagees)
! 2673: .position_variable].objet = s_objet_4;
! 2674:
! 2675: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 2676: .s_liste_variables_partagees).mutex)) != 0)
! 2677: {
! 2678: (*s_etat_processus).erreur_systeme =
! 2679: d_es_processus;
! 2680: return;
! 2681: }
! 2682: }
! 2683:
! 2684: liberation(s_etat_processus, s_objet_2);
! 2685: liberation(s_etat_processus, s_objet_3);
! 2686: }
! 2687: else if ((*s_objet_4).type == TBL)
! 2688: {
! 2689: if ((*s_objet_2).type != LST)
! 2690: {
! 2691: if (variable_partagee == d_vrai)
! 2692: {
! 2693: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 2694: .s_liste_variables_partagees).mutex)) != 0)
! 2695: {
! 2696: (*s_etat_processus).erreur_systeme =
! 2697: d_es_processus;
! 2698: return;
! 2699: }
! 2700: }
! 2701:
! 2702: liberation(s_etat_processus, s_objet_1);
! 2703: liberation(s_etat_processus, s_objet_2);
! 2704: liberation(s_etat_processus, s_objet_3);
! 2705:
! 2706: (*s_etat_processus).erreur_execution =
! 2707: d_ex_erreur_type_argument;
! 2708: return;
! 2709: }
! 2710:
! 2711: if ((*s_objet_4).nombre_occurrences > 1)
! 2712: {
! 2713: if ((s_copie_4 = copie_objet(s_etat_processus, s_objet_4, 'N'))
! 2714: == NULL)
! 2715: {
! 2716: if (variable_partagee == d_vrai)
! 2717: {
! 2718: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 2719: .s_liste_variables_partagees).mutex)) != 0)
! 2720: {
! 2721: (*s_etat_processus).erreur_systeme =
! 2722: d_es_processus;
! 2723: return;
! 2724: }
! 2725: }
! 2726:
! 2727: (*s_etat_processus).erreur_systeme =
! 2728: d_es_allocation_memoire;
! 2729: return;
! 2730: }
! 2731:
! 2732: liberation(s_etat_processus, s_objet_4);
! 2733: s_objet_4 = s_copie_4;
! 2734: }
! 2735:
! 2736: s_objet_element = s_objet_4;
! 2737: l_element_courant = (*s_objet_2).objet;
! 2738: indice_i = 0;
! 2739:
! 2740: while(l_element_courant != NULL)
! 2741: {
! 2742: if ((*(*l_element_courant).donnee).type != INT)
! 2743: {
! 2744: if (variable_partagee == d_vrai)
! 2745: {
! 2746: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 2747: .s_liste_variables_partagees).mutex)) != 0)
! 2748: {
! 2749: (*s_etat_processus).erreur_systeme =
! 2750: d_es_processus;
! 2751: return;
! 2752: }
! 2753: }
! 2754:
! 2755: liberation(s_etat_processus, s_objet_1);
! 2756: liberation(s_etat_processus, s_objet_2);
! 2757: liberation(s_etat_processus, s_objet_3);
! 2758:
! 2759: (*s_etat_processus).erreur_execution =
! 2760: d_ex_erreur_type_argument;
! 2761: return;
! 2762: }
! 2763:
! 2764: if ((*s_objet_element).type != TBL)
! 2765: {
! 2766: if (variable_partagee == d_vrai)
! 2767: {
! 2768: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 2769: .s_liste_variables_partagees).mutex)) != 0)
! 2770: {
! 2771: (*s_etat_processus).erreur_systeme =
! 2772: d_es_processus;
! 2773: return;
! 2774: }
! 2775: }
! 2776:
! 2777: liberation(s_etat_processus, s_objet_1);
! 2778: liberation(s_etat_processus, s_objet_2);
! 2779: liberation(s_etat_processus, s_objet_3);
! 2780:
! 2781: (*s_etat_processus).erreur_execution =
! 2782: d_ex_element_inexistant;
! 2783: return;
! 2784: }
! 2785:
! 2786: indice_i = (*((integer8 *) (*(*l_element_courant)
! 2787: .donnee).objet));
! 2788:
! 2789: if ((indice_i < 1) || (indice_i > (*((struct_tableau *)
! 2790: (*s_objet_element).objet)).nombre_elements))
! 2791: {
! 2792: if (variable_partagee == d_vrai)
! 2793: {
! 2794: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 2795: .s_liste_variables_partagees).mutex)) != 0)
! 2796: {
! 2797: (*s_etat_processus).erreur_systeme =
! 2798: d_es_processus;
! 2799: return;
! 2800: }
! 2801: }
! 2802:
! 2803: liberation(s_etat_processus, s_objet_1);
! 2804: liberation(s_etat_processus, s_objet_2);
! 2805: liberation(s_etat_processus, s_objet_3);
! 2806:
! 2807: (*s_etat_processus).erreur_execution =
! 2808: d_ex_element_inexistant;
! 2809: return;
! 2810: }
! 2811:
! 2812: if ((*l_element_courant).suivant != NULL)
! 2813: {
! 2814: s_objet_element = (*((struct_tableau *) (*s_objet_element)
! 2815: .objet)).elements[indice_i - 1];
! 2816: }
! 2817:
! 2818: l_element_courant = (*l_element_courant).suivant;
! 2819: }
! 2820:
! 2821: liberation(s_etat_processus, (*((struct_tableau *)
! 2822: (*s_objet_element).objet)).elements[indice_i - 1]);
! 2823: (*((struct_tableau *) (*s_objet_element).objet)).elements
! 2824: [indice_i - 1] = s_objet_1;
! 2825:
! 2826: if (variable_partagee == d_faux)
! 2827: {
! 2828: (*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 2829: .position_variable_courante].objet = s_objet_4;
! 2830: }
! 2831: else
! 2832: {
! 2833: (*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 2834: .position_variable_courante].objet = NULL;
! 2835: (*(*s_etat_processus).s_liste_variables_partagees).table
! 2836: [(*(*s_etat_processus).s_liste_variables_partagees)
! 2837: .position_variable].objet = s_objet_4;
! 2838:
! 2839: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 2840: .s_liste_variables_partagees).mutex)) != 0)
! 2841: {
! 2842: (*s_etat_processus).erreur_systeme =
! 2843: d_es_processus;
! 2844: return;
! 2845: }
! 2846: }
! 2847:
! 2848: liberation(s_etat_processus, s_objet_2);
! 2849: }
! 2850: else
! 2851: {
! 2852: if (variable_partagee == d_vrai)
! 2853: {
! 2854: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 2855: .s_liste_variables_partagees).mutex)) != 0)
! 2856: {
! 2857: (*s_etat_processus).erreur_systeme =
! 2858: d_es_processus;
! 2859: return;
! 2860: }
! 2861: }
! 2862:
! 2863: liberation(s_etat_processus, s_objet_1);
! 2864: liberation(s_etat_processus, s_objet_2);
! 2865: liberation(s_etat_processus, s_objet_3);
! 2866:
! 2867: (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
! 2868: return;
! 2869: }
! 2870: }
! 2871:
! 2872: /*
! 2873: --------------------------------------------------------------------------------
! 2874: Arguments incompatibles
! 2875: --------------------------------------------------------------------------------
! 2876: */
! 2877:
! 2878: else
! 2879: {
! 2880: liberation(s_etat_processus, s_objet_1);
! 2881: liberation(s_etat_processus, s_objet_2);
! 2882: liberation(s_etat_processus, s_objet_3);
! 2883:
! 2884: (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
! 2885: return;
! 2886: }
! 2887:
! 2888: return;
! 2889: }
! 2890:
! 2891:
! 2892: /*
! 2893: ================================================================================
! 2894: Fonction 'puti'
! 2895: ================================================================================
! 2896: Entrées : pointeur sur une structure struct_processus
! 2897: --------------------------------------------------------------------------------
! 2898: Sorties :
! 2899: --------------------------------------------------------------------------------
! 2900: Effets de bord : néant
! 2901: ================================================================================
! 2902: */
! 2903:
! 2904: void
! 2905: instruction_puti(struct_processus *s_etat_processus)
! 2906: {
! 2907: logical1 variable_partagee;
! 2908:
! 2909: struct_liste_chainee *l_element_courant;
! 2910:
! 2911: struct_objet *s_copie_2;
! 2912: struct_objet *s_copie_3;
! 2913: struct_objet *s_copie_4;
! 2914: struct_objet *s_objet_1;
! 2915: struct_objet *s_objet_2;
! 2916: struct_objet *s_objet_3;
! 2917: struct_objet *s_objet_4;
! 2918:
! 2919: unsigned long i;
! 2920: unsigned long indice_i;
! 2921: unsigned long indice_j;
! 2922: unsigned long j;
! 2923: unsigned long nombre_dimensions;
! 2924: unsigned long nombre_elements;
! 2925:
! 2926: void *tampon;
! 2927:
! 2928: (*s_etat_processus).erreur_execution = d_ex;
! 2929:
! 2930: if ((*s_etat_processus).affichage_arguments == 'Y')
! 2931: {
! 2932: printf("\n PUTI ");
! 2933:
! 2934: if ((*s_etat_processus).langue == 'F')
! 2935: {
! 2936: printf("(change un élément)\n\n");
! 2937: }
! 2938: else
! 2939: {
! 2940: printf("(change element)\n\n");
! 2941: }
! 2942:
! 2943: printf(" 3: %s, %s, %s, %s\n", d_VIN, d_VRL, d_VCX, d_NOM);
! 2944: printf(" 2: %s\n", d_LST);
! 2945: printf(" 1: %s, %s, %s\n", d_INT, d_REL, d_CPL);
! 2946: printf("-> 2: %s, %s, %s, %s\n", d_VIN, d_VRL, d_VCX, d_NOM);
! 2947: printf(" 1: %s\n\n", d_LST);
! 2948:
! 2949: printf(" 3: %s, %s, %s, %s\n", d_MIN, d_MRL, d_MCX, d_NOM);
! 2950: printf(" 2: %s\n", d_LST);
! 2951: printf(" 1: %s, %s, %s\n", d_INT, d_REL, d_CPL);
! 2952: printf("-> 2: %s, %s, %s, %s\n", d_MIN, d_MRL, d_MCX, d_NOM);
! 2953: printf(" 1: %s\n\n", d_LST);
! 2954:
! 2955: printf(" 3: %s, %s\n", d_LST, d_NOM);
! 2956: printf(" 2: %s\n", d_INT);
! 2957: printf(" 1: %s, %s, %s, %s, %s, %s,\n"
! 2958: " %s, %s, %s, %s, %s,\n"
! 2959: " %s, %s, %s, %s, %s,\n"
! 2960: " %s, %s, %s, %s,\n"
! 2961: " %s, %s\n",
! 2962: d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX,
! 2963: d_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SCK,
! 2964: d_SQL, d_SLB, d_PRC, d_MTX);
! 2965: printf("-> 2: %s, %s\n", d_LST, d_NOM);
! 2966: printf(" 1: %s\n", d_INT);
! 2967:
! 2968: return;
! 2969: }
! 2970: else if ((*s_etat_processus).test_instruction == 'Y')
! 2971: {
! 2972: (*s_etat_processus).nombre_arguments = -1;
! 2973: return;
! 2974: }
! 2975:
! 2976: if (test_cfsf(s_etat_processus, 31) == d_vrai)
! 2977: {
! 2978: if (empilement_pile_last(s_etat_processus, 3) == d_erreur)
! 2979: {
! 2980: return;
! 2981: }
! 2982: }
! 2983:
! 2984: if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 2985: &s_objet_1) == d_erreur)
! 2986: {
! 2987: (*s_etat_processus).erreur_execution = d_ex_manque_argument;
! 2988: return;
! 2989: }
! 2990:
! 2991: if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 2992: &s_objet_2) == d_erreur)
! 2993: {
! 2994: liberation(s_etat_processus, s_objet_1);
! 2995:
! 2996: (*s_etat_processus).erreur_execution = d_ex_manque_argument;
! 2997: return;
! 2998: }
! 2999:
! 3000: if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 3001: &s_objet_3) == d_erreur)
! 3002: {
! 3003: liberation(s_etat_processus, s_objet_1);
! 3004: liberation(s_etat_processus, s_objet_2);
! 3005:
! 3006: (*s_etat_processus).erreur_execution = d_ex_manque_argument;
! 3007: return;
! 3008: }
! 3009:
! 3010: if ((s_copie_2 = copie_objet(s_etat_processus, s_objet_2, 'O')) == NULL)
! 3011: {
! 3012: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 3013: return;
! 3014: }
! 3015:
! 3016: liberation(s_etat_processus, s_objet_2);
! 3017: s_objet_2 = s_copie_2;
! 3018:
! 3019: /*
! 3020: --------------------------------------------------------------------------------
! 3021: Traitement des éléments des vecteurs
! 3022: --------------------------------------------------------------------------------
! 3023: */
! 3024:
! 3025: if (((*s_objet_3).type == VIN) ||
! 3026: ((*s_objet_3).type == VRL) ||
! 3027: ((*s_objet_3).type == VCX))
! 3028: {
! 3029: if ((*s_objet_2).type != LST)
! 3030: {
! 3031: liberation(s_etat_processus, s_objet_1);
! 3032: liberation(s_etat_processus, s_objet_2);
! 3033: liberation(s_etat_processus, s_objet_3);
! 3034:
! 3035: (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
! 3036: return;
! 3037: }
! 3038:
! 3039: l_element_courant = (*s_objet_2).objet;
! 3040: nombre_dimensions = 0;
! 3041:
! 3042: while(l_element_courant != NULL)
! 3043: {
! 3044: nombre_dimensions++;
! 3045: l_element_courant = (*l_element_courant).suivant;
! 3046: }
! 3047:
! 3048: if (nombre_dimensions != 1)
! 3049: {
! 3050: liberation(s_etat_processus, s_objet_1);
! 3051: liberation(s_etat_processus, s_objet_2);
! 3052: liberation(s_etat_processus, s_objet_3);
! 3053:
! 3054: (*s_etat_processus).erreur_execution = d_ex_dimensions_invalides;
! 3055: return;
! 3056: }
! 3057:
! 3058: l_element_courant = (*s_objet_2).objet;
! 3059:
! 3060: if ((*(*l_element_courant).donnee).type != INT)
! 3061: {
! 3062: liberation(s_etat_processus, s_objet_1);
! 3063: liberation(s_etat_processus, s_objet_2);
! 3064: liberation(s_etat_processus, s_objet_3);
! 3065:
! 3066: (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
! 3067: return;
! 3068: }
! 3069:
! 3070: if ((*((integer8 *) (*(*l_element_courant).donnee).objet)) <= 0)
! 3071: {
! 3072: liberation(s_etat_processus, s_objet_1);
! 3073: liberation(s_etat_processus, s_objet_2);
! 3074: liberation(s_etat_processus, s_objet_3);
! 3075:
! 3076: (*s_etat_processus).erreur_execution = d_ex_argument_invalide;
! 3077: return;
! 3078: }
! 3079: else if ((*((integer8 *) (*(*l_element_courant).donnee).objet)) >
! 3080: (integer8) (*((struct_vecteur *) (*s_objet_3).objet)).taille)
! 3081: {
! 3082: liberation(s_etat_processus, s_objet_1);
! 3083: liberation(s_etat_processus, s_objet_2);
! 3084: liberation(s_etat_processus, s_objet_3);
! 3085:
! 3086: (*s_etat_processus).erreur_execution = d_ex_element_inexistant;
! 3087: return;
! 3088: }
! 3089:
! 3090: indice_i = (*((integer8 *) (*(*l_element_courant).donnee).objet));
! 3091:
! 3092: if ((s_copie_3 = copie_objet(s_etat_processus, s_objet_3, 'Q')) == NULL)
! 3093: {
! 3094: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 3095: return;
! 3096: }
! 3097:
! 3098: liberation(s_etat_processus, s_objet_3);
! 3099: s_objet_3 = s_copie_3;
! 3100:
! 3101: if ((*s_objet_3).type == VIN)
! 3102: {
! 3103: /*
! 3104: * Vecteur d'entiers
! 3105: */
! 3106:
! 3107: if ((*s_objet_1).type == INT)
! 3108: {
! 3109: /*
! 3110: * Aucune conversion de type
! 3111: */
! 3112:
! 3113: ((integer8 *) (*((struct_vecteur *) (*s_objet_3).objet))
! 3114: .tableau)[indice_i - 1] = (*((integer8 *)
! 3115: (*s_objet_1).objet));
! 3116: }
! 3117: else if ((*s_objet_1).type == REL)
! 3118: {
! 3119: /*
! 3120: * Conversion du vecteur en vecteur réel
! 3121: */
! 3122:
! 3123: tampon = (void *) ((integer8 *) (*((struct_vecteur *)
! 3124: (*s_objet_3).objet)).tableau);
! 3125:
! 3126: (*((struct_vecteur *) (*s_objet_3).objet)).type = 'R';
! 3127: (*s_objet_3).type = VRL;
! 3128:
! 3129: if (((*((struct_vecteur *) (*s_objet_3).objet)).tableau
! 3130: = malloc((*((struct_vecteur *)
! 3131: (*s_objet_3).objet)).taille * sizeof(real8)))
! 3132: == NULL)
! 3133: {
! 3134: (*s_etat_processus).erreur_systeme =
! 3135: d_es_allocation_memoire;
! 3136: return;
! 3137: }
! 3138:
! 3139: for(i = 0; i < (*((struct_vecteur *) (*s_objet_3).objet))
! 3140: .taille; i++)
! 3141: {
! 3142: ((real8 *) (*((struct_vecteur *) (*s_objet_3).objet))
! 3143: .tableau)[i] = (real8) (((integer8 *) tampon)[i]);
! 3144: }
! 3145:
! 3146: free((integer8 *) tampon);
! 3147:
! 3148: ((real8 *) (*((struct_vecteur *) (*s_objet_3).objet))
! 3149: .tableau)[indice_i - 1] = (*((real8 *)
! 3150: (*s_objet_1).objet));
! 3151: }
! 3152: else if ((*s_objet_1).type == CPL)
! 3153: {
! 3154: /*
! 3155: * Conversion du vecteur en vecteur complexe
! 3156: */
! 3157:
! 3158: tampon = (void *) ((integer8 *) (*((struct_vecteur *)
! 3159: (*s_objet_3).objet)).tableau);
! 3160:
! 3161: (*((struct_vecteur *) (*s_objet_3).objet)).type = 'C';
! 3162: (*s_objet_3).type = VCX;
! 3163:
! 3164: if (((*((struct_vecteur *) (*s_objet_3).objet)).tableau
! 3165: = malloc((*((struct_vecteur *)
! 3166: (*s_objet_3).objet)).taille *
! 3167: sizeof(struct_complexe16))) == NULL)
! 3168: {
! 3169: (*s_etat_processus).erreur_systeme =
! 3170: d_es_allocation_memoire;
! 3171: return;
! 3172: }
! 3173:
! 3174: for(i = 0; i < (*((struct_vecteur *) (*s_objet_3).objet))
! 3175: .taille; i++)
! 3176: {
! 3177: ((struct_complexe16 *) (*((struct_vecteur *)
! 3178: (*s_objet_3).objet)).tableau)[i].partie_reelle =
! 3179: (real8) (((integer8 *) tampon)[i]);
! 3180: ((struct_complexe16 *) (*((struct_vecteur *)
! 3181: (*s_objet_3).objet)).tableau)[i]
! 3182: .partie_imaginaire = (real8) 0;
! 3183: }
! 3184:
! 3185: free((integer8 *) tampon);
! 3186:
! 3187: ((struct_complexe16 *) (*((struct_vecteur *)
! 3188: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 3189: .partie_reelle = (*((struct_complexe16 *)
! 3190: (*s_objet_1).objet)).partie_reelle;
! 3191: ((struct_complexe16 *) (*((struct_vecteur *)
! 3192: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 3193: .partie_imaginaire = (*((struct_complexe16 *)
! 3194: (*s_objet_1).objet)).partie_imaginaire;
! 3195: }
! 3196: else
! 3197: {
! 3198: liberation(s_etat_processus, s_objet_1);
! 3199: liberation(s_etat_processus, s_objet_2);
! 3200: liberation(s_etat_processus, s_objet_3);
! 3201:
! 3202: (*s_etat_processus).erreur_execution =
! 3203: d_ex_erreur_type_argument;
! 3204: return;
! 3205: }
! 3206: }
! 3207: else if ((*s_objet_3).type == VRL)
! 3208: {
! 3209: /*
! 3210: * Vecteur de réels
! 3211: */
! 3212:
! 3213: if ((*s_objet_1).type == INT)
! 3214: {
! 3215: /*
! 3216: * Conversion de l'élément à insérer en réel
! 3217: */
! 3218:
! 3219: ((real8 *) (*((struct_vecteur *) (*s_objet_3).objet))
! 3220: .tableau)[indice_i - 1] = (real8) (*((integer8 *)
! 3221: (*s_objet_1).objet));
! 3222: }
! 3223: else if ((*s_objet_1).type == REL)
! 3224: {
! 3225: /*
! 3226: * Aucune conversion de type
! 3227: */
! 3228:
! 3229: ((real8 *) (*((struct_vecteur *) (*s_objet_3).objet))
! 3230: .tableau)[indice_i - 1] = (*((real8 *)
! 3231: (*s_objet_1).objet));
! 3232: }
! 3233: else if ((*s_objet_1).type == CPL)
! 3234: {
! 3235: /*
! 3236: * Conversion du vecteur en vecteur complexe
! 3237: */
! 3238:
! 3239: tampon = (void *) ((integer8 *) (*((struct_vecteur *)
! 3240: (*s_objet_3).objet)).tableau);
! 3241:
! 3242: (*((struct_vecteur *) (*s_objet_3).objet)).type = 'C';
! 3243: (*s_objet_3).type = VCX;
! 3244:
! 3245: if (((*((struct_vecteur *) (*s_objet_3).objet)).tableau
! 3246: = malloc((*((struct_vecteur *)
! 3247: (*s_objet_3).objet)).taille *
! 3248: sizeof(struct_complexe16))) == NULL)
! 3249: {
! 3250: (*s_etat_processus).erreur_systeme =
! 3251: d_es_allocation_memoire;
! 3252: return;
! 3253: }
! 3254:
! 3255: for(i = 0; i < (*((struct_vecteur *) (*s_objet_3).objet))
! 3256: .taille; i++)
! 3257: {
! 3258: ((struct_complexe16 *) (*((struct_vecteur *)
! 3259: (*s_objet_3).objet)).tableau)[i].partie_reelle =
! 3260: ((real8 *) tampon)[i];
! 3261: ((struct_complexe16 *) (*((struct_vecteur *)
! 3262: (*s_objet_3).objet)).tableau)[i]
! 3263: .partie_imaginaire = (real8) 0;
! 3264: }
! 3265:
! 3266: free((real8 *) tampon);
! 3267:
! 3268: ((struct_complexe16 *) (*((struct_vecteur *)
! 3269: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 3270: .partie_reelle = (*((struct_complexe16 *)
! 3271: (*s_objet_1).objet)).partie_reelle;
! 3272: ((struct_complexe16 *) (*((struct_vecteur *)
! 3273: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 3274: .partie_imaginaire = (*((struct_complexe16 *)
! 3275: (*s_objet_1).objet)).partie_imaginaire;
! 3276: }
! 3277: else
! 3278: {
! 3279: liberation(s_etat_processus, s_objet_1);
! 3280: liberation(s_etat_processus, s_objet_2);
! 3281: liberation(s_etat_processus, s_objet_3);
! 3282:
! 3283: (*s_etat_processus).erreur_execution =
! 3284: d_ex_erreur_type_argument;
! 3285: return;
! 3286: }
! 3287: }
! 3288: else
! 3289: {
! 3290: /*
! 3291: * Vecteur de complexes
! 3292: */
! 3293:
! 3294: if ((*s_objet_1).type == INT)
! 3295: {
! 3296: /*
! 3297: * Conversion de l'élément à insérer en complexe
! 3298: */
! 3299:
! 3300: ((struct_complexe16 *) (*((struct_vecteur *)
! 3301: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 3302: .partie_reelle = (real8) (*((integer8 *)
! 3303: (*s_objet_1).objet));
! 3304: ((struct_complexe16 *) (*((struct_vecteur *)
! 3305: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 3306: .partie_imaginaire = (real8) 0;
! 3307: }
! 3308: else if ((*s_objet_1).type == REL)
! 3309: {
! 3310: /*
! 3311: * Conversion de l'élément à insérer en complexe
! 3312: */
! 3313:
! 3314: ((struct_complexe16 *) (*((struct_vecteur *)
! 3315: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 3316: .partie_reelle = (*((real8 *) (*s_objet_1).objet));
! 3317: ((struct_complexe16 *) (*((struct_vecteur *)
! 3318: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 3319: .partie_imaginaire = (real8) 0;
! 3320: }
! 3321: else if ((*s_objet_1).type == CPL)
! 3322: {
! 3323: /*
! 3324: * Aucune conversion de type
! 3325: */
! 3326:
! 3327: ((struct_complexe16 *) (*((struct_vecteur *)
! 3328: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 3329: .partie_reelle = (*((struct_complexe16 *)
! 3330: (*s_objet_1).objet)).partie_reelle;
! 3331: ((struct_complexe16 *) (*((struct_vecteur *)
! 3332: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 3333: .partie_imaginaire = (*((struct_complexe16 *)
! 3334: (*s_objet_1).objet)).partie_imaginaire;
! 3335: }
! 3336: else
! 3337: {
! 3338: liberation(s_etat_processus, s_objet_1);
! 3339: liberation(s_etat_processus, s_objet_2);
! 3340: liberation(s_etat_processus, s_objet_3);
! 3341:
! 3342: (*s_etat_processus).erreur_execution =
! 3343: d_ex_erreur_type_argument;
! 3344: return;
! 3345: }
! 3346: }
! 3347:
! 3348: liberation(s_etat_processus, s_objet_1);
! 3349:
! 3350: if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 3351: s_objet_3) == d_erreur)
! 3352: {
! 3353: return;
! 3354: }
! 3355:
! 3356: (*((integer8 *) (*(*l_element_courant).donnee).objet)) =
! 3357: (indice_i % (*((struct_vecteur *) (*s_objet_3).objet))
! 3358: .taille) + 1;
! 3359:
! 3360: if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 3361: s_objet_2) == d_erreur)
! 3362: {
! 3363: return;
! 3364: }
! 3365: }
! 3366:
! 3367: /*
! 3368: --------------------------------------------------------------------------------
! 3369: Traitement des éléments des matrices
! 3370: --------------------------------------------------------------------------------
! 3371: */
! 3372:
! 3373: else if (((*s_objet_3).type == MIN) ||
! 3374: ((*s_objet_3).type == MRL) ||
! 3375: ((*s_objet_3).type == MCX))
! 3376: {
! 3377: if ((*s_objet_2).type != LST)
! 3378: {
! 3379: liberation(s_etat_processus, s_objet_1);
! 3380: liberation(s_etat_processus, s_objet_2);
! 3381: liberation(s_etat_processus, s_objet_3);
! 3382:
! 3383: (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
! 3384: return;
! 3385: }
! 3386:
! 3387: l_element_courant = (*s_objet_2).objet;
! 3388: nombre_dimensions = 0;
! 3389:
! 3390: while(l_element_courant != NULL)
! 3391: {
! 3392: nombre_dimensions++;
! 3393: l_element_courant = (*l_element_courant).suivant;
! 3394: }
! 3395:
! 3396: if (nombre_dimensions != 2)
! 3397: {
! 3398: liberation(s_etat_processus, s_objet_1);
! 3399: liberation(s_etat_processus, s_objet_2);
! 3400: liberation(s_etat_processus, s_objet_3);
! 3401:
! 3402: (*s_etat_processus).erreur_execution = d_ex_dimensions_invalides;
! 3403: return;
! 3404: }
! 3405:
! 3406: l_element_courant = (*s_objet_2).objet;
! 3407:
! 3408: indice_i = 0;
! 3409: indice_j = 0;
! 3410:
! 3411: while(l_element_courant != NULL)
! 3412: {
! 3413: if ((*(*l_element_courant).donnee).type != INT)
! 3414: {
! 3415: liberation(s_etat_processus, s_objet_1);
! 3416: liberation(s_etat_processus, s_objet_2);
! 3417: liberation(s_etat_processus, s_objet_3);
! 3418:
! 3419: (*s_etat_processus).erreur_execution =
! 3420: d_ex_erreur_type_argument;
! 3421: return;
! 3422: }
! 3423:
! 3424: if ((*((integer8 *) (*(*l_element_courant).donnee).objet)) <= 0)
! 3425: {
! 3426: liberation(s_etat_processus, s_objet_1);
! 3427: liberation(s_etat_processus, s_objet_2);
! 3428: liberation(s_etat_processus, s_objet_3);
! 3429:
! 3430: (*s_etat_processus).erreur_execution = d_ex_argument_invalide;
! 3431: return;
! 3432: }
! 3433:
! 3434: if (indice_i == 0)
! 3435: {
! 3436: indice_i = (*((integer8 *)
! 3437: (*(*l_element_courant).donnee).objet));
! 3438: }
! 3439: else
! 3440: {
! 3441: indice_j = (*((integer8 *)
! 3442: (*(*l_element_courant).donnee).objet));
! 3443: }
! 3444:
! 3445: l_element_courant = (*l_element_courant).suivant;
! 3446: }
! 3447:
! 3448: if ((indice_i > (*((struct_matrice *) (*s_objet_3).objet))
! 3449: .nombre_lignes) || (indice_j > (*((struct_matrice *)
! 3450: (*s_objet_3).objet)).nombre_colonnes))
! 3451: {
! 3452: liberation(s_etat_processus, s_objet_1);
! 3453: liberation(s_etat_processus, s_objet_2);
! 3454: liberation(s_etat_processus, s_objet_3);
! 3455:
! 3456: (*s_etat_processus).erreur_execution = d_ex_element_inexistant;
! 3457: return;
! 3458: }
! 3459:
! 3460: if ((s_copie_3 = copie_objet(s_etat_processus, s_objet_3, 'Q')) == NULL)
! 3461: {
! 3462: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 3463: return;
! 3464: }
! 3465:
! 3466: liberation(s_etat_processus, s_objet_3);
! 3467: s_objet_3 = s_copie_3;
! 3468:
! 3469: if ((*s_objet_3).type == MIN)
! 3470: {
! 3471: /*
! 3472: * Matrice d'entiers
! 3473: */
! 3474:
! 3475: if ((*s_objet_1).type == INT)
! 3476: {
! 3477: /*
! 3478: * Aucune conversion de type
! 3479: */
! 3480:
! 3481: ((integer8 **) (*((struct_matrice *) (*s_objet_3).objet))
! 3482: .tableau)[indice_i - 1][indice_j - 1] =
! 3483: (*((integer8 *) (*s_objet_1).objet));
! 3484: }
! 3485: else if ((*s_objet_1).type == REL)
! 3486: {
! 3487: /*
! 3488: * Conversion de la matrice en matrice réelle
! 3489: */
! 3490:
! 3491: tampon = (void *) ((integer8 **) (*((struct_matrice *)
! 3492: (*s_objet_3).objet)).tableau);
! 3493:
! 3494: (*((struct_matrice *) (*s_objet_3).objet)).type = 'R';
! 3495: (*s_objet_3).type = MRL;
! 3496:
! 3497: if (((*((struct_matrice *) (*s_objet_3).objet)).tableau
! 3498: = malloc((*((struct_matrice *)
! 3499: (*s_objet_3).objet)).nombre_lignes * sizeof(real8 *)))
! 3500: == NULL)
! 3501: {
! 3502: (*s_etat_processus).erreur_systeme =
! 3503: d_es_allocation_memoire;
! 3504: return;
! 3505: }
! 3506:
! 3507: for(i = 0; i < (*((struct_matrice *) (*s_objet_3).objet))
! 3508: .nombre_lignes; i++)
! 3509: {
! 3510: if ((((real8 **) (*((struct_matrice *)
! 3511: (*s_objet_3).objet)).tableau)[i]
! 3512: = malloc((*((struct_matrice *)
! 3513: (*s_objet_3).objet)).nombre_colonnes *
! 3514: sizeof(real8))) == NULL)
! 3515: {
! 3516: (*s_etat_processus).erreur_systeme =
! 3517: d_es_allocation_memoire;
! 3518: return;
! 3519: }
! 3520:
! 3521: for(j = 0; j < (*((struct_matrice *) (*s_objet_3).objet))
! 3522: .nombre_colonnes; j++)
! 3523: {
! 3524: ((real8 **) (*((struct_matrice *) (*s_objet_3).objet))
! 3525: .tableau)[i][j] = (real8) (((integer8 **)
! 3526: tampon)[i][j]);
! 3527: }
! 3528:
! 3529: free(((integer8 **) tampon)[i]);
! 3530: }
! 3531:
! 3532: free((integer8 **) tampon);
! 3533:
! 3534: ((real8 **) (*((struct_matrice *) (*s_objet_3).objet))
! 3535: .tableau)[indice_i - 1][indice_j - 1] = (*((real8 *)
! 3536: (*s_objet_1).objet));
! 3537: }
! 3538: else if ((*s_objet_1).type == CPL)
! 3539: {
! 3540: /*
! 3541: * Conversion de la matrice en matrice complexe
! 3542: */
! 3543:
! 3544: tampon = (void *) ((integer8 **) (*((struct_matrice *)
! 3545: (*s_objet_3).objet)).tableau);
! 3546:
! 3547: (*((struct_matrice *) (*s_objet_3).objet)).type = 'C';
! 3548: (*s_objet_3).type = MCX;
! 3549:
! 3550: if (((*((struct_matrice *) (*s_objet_3).objet)).tableau
! 3551: = malloc((*((struct_matrice *)
! 3552: (*s_objet_3).objet)).nombre_lignes *
! 3553: sizeof(struct_complexe16 *))) == NULL)
! 3554: {
! 3555: (*s_etat_processus).erreur_systeme =
! 3556: d_es_allocation_memoire;
! 3557: return;
! 3558: }
! 3559:
! 3560: for(i = 0; i < (*((struct_matrice *) (*s_objet_3).objet))
! 3561: .nombre_lignes; i++)
! 3562: {
! 3563: if ((((struct_complexe16 **) (*((struct_matrice *)
! 3564: (*s_objet_3).objet)).tableau)[i]
! 3565: = malloc((*((struct_matrice *)
! 3566: (*s_objet_3).objet)).nombre_colonnes *
! 3567: sizeof(struct_complexe16))) == NULL)
! 3568: {
! 3569: (*s_etat_processus).erreur_systeme =
! 3570: d_es_allocation_memoire;
! 3571: return;
! 3572: }
! 3573:
! 3574: for(j = 0; j < (*((struct_matrice *) (*s_objet_3).objet))
! 3575: .nombre_colonnes; j++)
! 3576: {
! 3577: ((struct_complexe16 **) (*((struct_matrice *)
! 3578: (*s_objet_3).objet)).tableau)[i][j]
! 3579: .partie_reelle = (real8) (((integer8 **)
! 3580: tampon)[i][j]);
! 3581: ((struct_complexe16 **) (*((struct_matrice *)
! 3582: (*s_objet_3).objet)).tableau)[i][j]
! 3583: .partie_imaginaire = (real8) 0;
! 3584: }
! 3585:
! 3586: free(((integer8 **) tampon)[i]);
! 3587: }
! 3588:
! 3589: free((integer8 **) tampon);
! 3590:
! 3591: ((struct_complexe16 **) (*((struct_matrice *)
! 3592: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 3593: [indice_j - 1].partie_reelle = (*((struct_complexe16 *)
! 3594: (*s_objet_1).objet)).partie_reelle;
! 3595: ((struct_complexe16 **) (*((struct_matrice *)
! 3596: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 3597: [indice_j - 1].partie_imaginaire =
! 3598: (*((struct_complexe16 *)
! 3599: (*s_objet_1).objet)).partie_imaginaire;
! 3600: }
! 3601: else
! 3602: {
! 3603: liberation(s_etat_processus, s_objet_1);
! 3604: liberation(s_etat_processus, s_objet_2);
! 3605: liberation(s_etat_processus, s_objet_3);
! 3606:
! 3607: (*s_etat_processus).erreur_execution =
! 3608: d_ex_erreur_type_argument;
! 3609: return;
! 3610: }
! 3611: }
! 3612: else if ((*s_objet_3).type == MRL)
! 3613: {
! 3614: /*
! 3615: * Matrice de réels
! 3616: */
! 3617:
! 3618: if ((*s_objet_1).type == INT)
! 3619: {
! 3620: /*
! 3621: * Conversion de l'élément à insérer en réel
! 3622: */
! 3623:
! 3624: ((real8 **) (*((struct_matrice *) (*s_objet_3).objet))
! 3625: .tableau)[indice_i - 1][indice_j - 1] =
! 3626: (real8) (*((integer8 *) (*s_objet_1).objet));
! 3627: }
! 3628: else if ((*s_objet_1).type == REL)
! 3629: {
! 3630: /*
! 3631: * Aucune conversion de type
! 3632: */
! 3633:
! 3634: ((real8 **) (*((struct_matrice *) (*s_objet_3).objet))
! 3635: .tableau)[indice_i - 1][indice_j - 1] = (*((real8 *)
! 3636: (*s_objet_1).objet));
! 3637: }
! 3638: else if ((*s_objet_1).type == CPL)
! 3639: {
! 3640: /*
! 3641: * Conversion de la matrice en matrice complexe
! 3642: */
! 3643:
! 3644: tampon = (void *) ((real8 **) (*((struct_matrice *)
! 3645: (*s_objet_3).objet)).tableau);
! 3646:
! 3647: (*((struct_matrice *) (*s_objet_3).objet)).type = 'C';
! 3648: (*s_objet_3).type = MCX;
! 3649:
! 3650: if (((*((struct_matrice *) (*s_objet_3).objet)).tableau
! 3651: = malloc((*((struct_matrice *)
! 3652: (*s_objet_3).objet)).nombre_lignes *
! 3653: sizeof(struct_complexe16 *))) == NULL)
! 3654: {
! 3655: (*s_etat_processus).erreur_systeme =
! 3656: d_es_allocation_memoire;
! 3657: return;
! 3658: }
! 3659:
! 3660: for(i = 0; i < (*((struct_matrice *) (*s_objet_3).objet))
! 3661: .nombre_lignes; i++)
! 3662: {
! 3663: if ((((struct_complexe16 **) (*((struct_matrice *)
! 3664: (*s_objet_3).objet)).tableau)[i]
! 3665: = malloc((*((struct_matrice *)
! 3666: (*s_objet_3).objet)).nombre_colonnes *
! 3667: sizeof(struct_complexe16))) == NULL)
! 3668: {
! 3669: (*s_etat_processus).erreur_systeme =
! 3670: d_es_allocation_memoire;
! 3671: return;
! 3672: }
! 3673:
! 3674: for(j = 0; j < (*((struct_matrice *) (*s_objet_3).objet))
! 3675: .nombre_colonnes; j++)
! 3676: {
! 3677: ((struct_complexe16 **) (*((struct_matrice *)
! 3678: (*s_objet_3).objet)).tableau)[i][j]
! 3679: .partie_reelle = (((real8 **)
! 3680: tampon)[i][j]);
! 3681: ((struct_complexe16 **) (*((struct_matrice *)
! 3682: (*s_objet_3).objet)).tableau)[i][j]
! 3683: .partie_imaginaire = (real8) 0;
! 3684: }
! 3685:
! 3686: free(((integer8 **) tampon)[i]);
! 3687: }
! 3688:
! 3689: free((integer8 **) tampon);
! 3690:
! 3691: ((struct_complexe16 **) (*((struct_matrice *)
! 3692: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 3693: [indice_j - 1].partie_reelle = (*((struct_complexe16 *)
! 3694: (*s_objet_1).objet)).partie_reelle;
! 3695: ((struct_complexe16 **) (*((struct_matrice *)
! 3696: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 3697: [indice_j - 1].partie_imaginaire =
! 3698: (*((struct_complexe16 *)
! 3699: (*s_objet_1).objet)).partie_imaginaire;
! 3700: }
! 3701: else
! 3702: {
! 3703: liberation(s_etat_processus, s_objet_1);
! 3704: liberation(s_etat_processus, s_objet_2);
! 3705: liberation(s_etat_processus, s_objet_3);
! 3706:
! 3707: (*s_etat_processus).erreur_execution =
! 3708: d_ex_erreur_type_argument;
! 3709: return;
! 3710: }
! 3711: }
! 3712: else
! 3713: {
! 3714: /*
! 3715: * Matrice de complexes
! 3716: */
! 3717:
! 3718: if ((*s_objet_1).type == INT)
! 3719: {
! 3720: /*
! 3721: * Conversion de l'élément à insérer en complexe
! 3722: */
! 3723:
! 3724: ((struct_complexe16 **) (*((struct_matrice *)
! 3725: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 3726: [indice_j - 1].partie_reelle = (real8) (*((integer8 *)
! 3727: (*s_objet_1).objet));
! 3728: ((struct_complexe16 **) (*((struct_matrice *)
! 3729: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 3730: [indice_j - 1].partie_imaginaire = (real8) 0;
! 3731: }
! 3732: else if ((*s_objet_1).type == REL)
! 3733: {
! 3734: /*
! 3735: * Conversion de l'élément à insérer en complexe
! 3736: */
! 3737:
! 3738: ((struct_complexe16 **) (*((struct_matrice *)
! 3739: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 3740: [indice_j - 1].partie_reelle =
! 3741: (*((real8 *) (*s_objet_1).objet));
! 3742: ((struct_complexe16 **) (*((struct_matrice *)
! 3743: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 3744: [indice_j - 1].partie_imaginaire = (real8) 0;
! 3745: }
! 3746: else if ((*s_objet_1).type == CPL)
! 3747: {
! 3748: /*
! 3749: * Aucune conversion de type
! 3750: */
! 3751:
! 3752: ((struct_complexe16 **) (*((struct_matrice *)
! 3753: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 3754: [indice_j - 1].partie_reelle = (*((struct_complexe16 *)
! 3755: (*s_objet_1).objet)).partie_reelle;
! 3756: ((struct_complexe16 **) (*((struct_matrice *)
! 3757: (*s_objet_3).objet)).tableau)[indice_i - 1]
! 3758: [indice_j - 1].partie_imaginaire =
! 3759: (*((struct_complexe16 *)
! 3760: (*s_objet_1).objet)).partie_imaginaire;
! 3761: }
! 3762: else
! 3763: {
! 3764: liberation(s_etat_processus, s_objet_1);
! 3765: liberation(s_etat_processus, s_objet_2);
! 3766: liberation(s_etat_processus, s_objet_3);
! 3767:
! 3768: (*s_etat_processus).erreur_execution =
! 3769: d_ex_erreur_type_argument;
! 3770: return;
! 3771: }
! 3772: }
! 3773:
! 3774: liberation(s_etat_processus, s_objet_1);
! 3775:
! 3776: if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 3777: s_objet_3) == d_erreur)
! 3778: {
! 3779: return;
! 3780: }
! 3781:
! 3782: if ((++(*((integer8 *) (*(*(*((struct_liste_chainee *)
! 3783: (*s_objet_2).objet)).suivant).donnee).objet))) > (integer8)
! 3784: (*((struct_matrice *) (*s_objet_3).objet)).nombre_colonnes)
! 3785: {
! 3786: (*((integer8 *) (*(*(*((struct_liste_chainee *) (*s_objet_2)
! 3787: .objet)).suivant).donnee).objet)) = 1;
! 3788:
! 3789: if ((++(*((integer8 *) (*(*((struct_liste_chainee *)
! 3790: (*s_objet_2).objet)).donnee).objet))) > (integer8)
! 3791: (*((struct_matrice *) (*s_objet_3).objet)).nombre_lignes)
! 3792: {
! 3793: (*((integer8 *) (*(*((struct_liste_chainee *)
! 3794: (*s_objet_2).objet)).donnee).objet)) = 1;
! 3795: }
! 3796: }
! 3797:
! 3798: if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 3799: s_objet_2) == d_erreur)
! 3800: {
! 3801: return;
! 3802: }
! 3803: }
! 3804:
! 3805: /*
! 3806: --------------------------------------------------------------------------------
! 3807: Traitement des éléments des listes
! 3808: --------------------------------------------------------------------------------
! 3809: */
! 3810:
! 3811: else if ((*s_objet_3).type == LST)
! 3812: {
! 3813: if ((*s_objet_2).type != INT)
! 3814: {
! 3815: liberation(s_etat_processus, s_objet_1);
! 3816: liberation(s_etat_processus, s_objet_2);
! 3817: liberation(s_etat_processus, s_objet_3);
! 3818:
! 3819: (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
! 3820: return;
! 3821: }
! 3822:
! 3823: indice_i = (*((integer8 *) (*s_objet_2).objet));
! 3824: indice_j = 1;
! 3825:
! 3826: if ((*s_objet_3).nombre_occurrences > 1)
! 3827: {
! 3828: if ((s_copie_3 = copie_objet(s_etat_processus, s_objet_3, 'N'))
! 3829: == NULL)
! 3830: {
! 3831: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 3832: return;
! 3833: }
! 3834:
! 3835: liberation(s_etat_processus, s_objet_3);
! 3836: s_objet_3 = s_copie_3;
! 3837: }
! 3838:
! 3839: l_element_courant = (*s_objet_3).objet;
! 3840: nombre_elements = 0;
! 3841:
! 3842: while(l_element_courant != NULL)
! 3843: {
! 3844: l_element_courant = (*l_element_courant).suivant;
! 3845: nombre_elements++;
! 3846: }
! 3847:
! 3848: l_element_courant = (*s_objet_3).objet;
! 3849:
! 3850: while((l_element_courant != NULL) && (indice_j != indice_i))
! 3851: {
! 3852: l_element_courant = (*l_element_courant).suivant;
! 3853: indice_j++;
! 3854: }
! 3855:
! 3856: if (l_element_courant != NULL)
! 3857: {
! 3858: liberation(s_etat_processus, (*l_element_courant).donnee);
! 3859: (*l_element_courant).donnee = s_objet_1;
! 3860: }
! 3861: else
! 3862: {
! 3863: liberation(s_etat_processus, s_objet_1);
! 3864: liberation(s_etat_processus, s_objet_2);
! 3865: liberation(s_etat_processus, s_objet_3);
! 3866:
! 3867: (*s_etat_processus).erreur_execution = d_ex_element_inexistant;
! 3868: return;
! 3869: }
! 3870:
! 3871: if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 3872: s_objet_3) == d_erreur)
! 3873: {
! 3874: return;
! 3875: }
! 3876:
! 3877: (*((integer8 *) (*s_objet_2).objet)) =
! 3878: (indice_i % nombre_elements) + 1;
! 3879:
! 3880: if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 3881: s_objet_2) == d_erreur)
! 3882: {
! 3883: return;
! 3884: }
! 3885: }
! 3886:
! 3887: /*
! 3888: --------------------------------------------------------------------------------
! 3889: Traitement des noms
! 3890: --------------------------------------------------------------------------------
! 3891: */
! 3892:
! 3893: else if ((*s_objet_3).type == NOM)
! 3894: {
! 3895: variable_partagee = d_faux;
! 3896:
! 3897: if (recherche_variable(s_etat_processus, (*((struct_nom *)
! 3898: (*s_objet_3).objet)).nom) == d_faux)
! 3899: {
! 3900: (*s_etat_processus).erreur_systeme = d_es;
! 3901: (*s_etat_processus).erreur_execution = d_ex_variable_non_definie;
! 3902:
! 3903: liberation(s_etat_processus, s_objet_1);
! 3904: liberation(s_etat_processus, s_objet_2);
! 3905: liberation(s_etat_processus, s_objet_3);
! 3906:
! 3907: return;
! 3908: }
! 3909:
! 3910: if ((*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 3911: .position_variable_courante].variable_verrouillee == d_vrai)
! 3912: {
! 3913: (*s_etat_processus).erreur_execution = d_ex_variable_verrouillee;
! 3914:
! 3915: liberation(s_etat_processus, s_objet_1);
! 3916: liberation(s_etat_processus, s_objet_2);
! 3917: liberation(s_etat_processus, s_objet_3);
! 3918:
! 3919: return;
! 3920: }
! 3921:
! 3922: s_objet_4 = (*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 3923: .position_variable_courante].objet;
! 3924:
! 3925: if (s_objet_4 == NULL)
! 3926: {
! 3927: if (pthread_mutex_lock(&((*(*s_etat_processus)
! 3928: .s_liste_variables_partagees).mutex)) != 0)
! 3929: {
! 3930: (*s_etat_processus).erreur_systeme = d_es_processus;
! 3931: return;
! 3932: }
! 3933:
! 3934: if (recherche_variable_partagee(s_etat_processus,
! 3935: (*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 3936: .position_variable_courante].nom,
! 3937: (*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 3938: .position_variable_courante].variable_partagee,
! 3939: (*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 3940: .position_variable_courante].origine) == d_faux)
! 3941: {
! 3942: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 3943: .s_liste_variables_partagees).mutex)) != 0)
! 3944: {
! 3945: (*s_etat_processus).erreur_systeme = d_es_processus;
! 3946: return;
! 3947: }
! 3948:
! 3949: (*s_etat_processus).erreur_systeme = d_es;
! 3950: (*s_etat_processus).erreur_execution =
! 3951: d_ex_variable_non_definie;
! 3952:
! 3953: liberation(s_etat_processus, s_objet_1);
! 3954: liberation(s_etat_processus, s_objet_2);
! 3955: liberation(s_etat_processus, s_objet_3);
! 3956:
! 3957: return;
! 3958: }
! 3959:
! 3960: s_objet_4 = (*(*s_etat_processus).s_liste_variables_partagees)
! 3961: .table[(*(*s_etat_processus).s_liste_variables_partagees)
! 3962: .position_variable].objet;
! 3963: variable_partagee = d_vrai;
! 3964: }
! 3965:
! 3966: if (((*s_objet_4).type == VIN) ||
! 3967: ((*s_objet_4).type == VRL) ||
! 3968: ((*s_objet_4).type == VCX))
! 3969: {
! 3970: if ((*s_objet_2).type != LST)
! 3971: {
! 3972: if (variable_partagee == d_vrai)
! 3973: {
! 3974: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 3975: .s_liste_variables_partagees).mutex)) != 0)
! 3976: {
! 3977: (*s_etat_processus).erreur_systeme = d_es_processus;
! 3978: return;
! 3979: }
! 3980: }
! 3981:
! 3982: liberation(s_etat_processus, s_objet_1);
! 3983: liberation(s_etat_processus, s_objet_2);
! 3984: liberation(s_etat_processus, s_objet_3);
! 3985:
! 3986: (*s_etat_processus).erreur_execution =
! 3987: d_ex_erreur_type_argument;
! 3988: return;
! 3989: }
! 3990:
! 3991: l_element_courant = (*s_objet_2).objet;
! 3992: nombre_dimensions = 0;
! 3993:
! 3994: while(l_element_courant != NULL)
! 3995: {
! 3996: nombre_dimensions++;
! 3997: l_element_courant = (*l_element_courant).suivant;
! 3998: }
! 3999:
! 4000: if (nombre_dimensions != 1)
! 4001: {
! 4002: if (variable_partagee == d_vrai)
! 4003: {
! 4004: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 4005: .s_liste_variables_partagees).mutex)) != 0)
! 4006: {
! 4007: (*s_etat_processus).erreur_systeme = d_es_processus;
! 4008: return;
! 4009: }
! 4010: }
! 4011:
! 4012: liberation(s_etat_processus, s_objet_1);
! 4013: liberation(s_etat_processus, s_objet_2);
! 4014: liberation(s_etat_processus, s_objet_3);
! 4015:
! 4016: (*s_etat_processus).erreur_execution =
! 4017: d_ex_dimensions_invalides;
! 4018: return;
! 4019: }
! 4020:
! 4021: l_element_courant = (*s_objet_2).objet;
! 4022:
! 4023: if ((*(*l_element_courant).donnee).type != INT)
! 4024: {
! 4025: if (variable_partagee == d_vrai)
! 4026: {
! 4027: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 4028: .s_liste_variables_partagees).mutex)) != 0)
! 4029: {
! 4030: (*s_etat_processus).erreur_systeme = d_es_processus;
! 4031: return;
! 4032: }
! 4033: }
! 4034:
! 4035: liberation(s_etat_processus, s_objet_1);
! 4036: liberation(s_etat_processus, s_objet_2);
! 4037: liberation(s_etat_processus, s_objet_3);
! 4038:
! 4039: (*s_etat_processus).erreur_execution =
! 4040: d_ex_erreur_type_argument;
! 4041: return;
! 4042: }
! 4043:
! 4044: if ((*((integer8 *) (*(*l_element_courant).donnee).objet)) <= 0)
! 4045: {
! 4046: if (variable_partagee == d_vrai)
! 4047: {
! 4048: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 4049: .s_liste_variables_partagees).mutex)) != 0)
! 4050: {
! 4051: (*s_etat_processus).erreur_systeme = d_es_processus;
! 4052: return;
! 4053: }
! 4054: }
! 4055:
! 4056: liberation(s_etat_processus, s_objet_1);
! 4057: liberation(s_etat_processus, s_objet_2);
! 4058: liberation(s_etat_processus, s_objet_3);
! 4059:
! 4060: (*s_etat_processus).erreur_execution = d_ex_argument_invalide;
! 4061: return;
! 4062: }
! 4063: else if ((*((integer8 *) (*(*l_element_courant).donnee).objet)) >
! 4064: (integer8) (*((struct_vecteur *) (*s_objet_4).objet))
! 4065: .taille)
! 4066: {
! 4067: if (variable_partagee == d_vrai)
! 4068: {
! 4069: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 4070: .s_liste_variables_partagees).mutex)) != 0)
! 4071: {
! 4072: (*s_etat_processus).erreur_systeme = d_es_processus;
! 4073: return;
! 4074: }
! 4075: }
! 4076:
! 4077: liberation(s_etat_processus, s_objet_1);
! 4078: liberation(s_etat_processus, s_objet_2);
! 4079: liberation(s_etat_processus, s_objet_3);
! 4080:
! 4081: (*s_etat_processus).erreur_execution = d_ex_element_inexistant;
! 4082: return;
! 4083: }
! 4084:
! 4085: indice_i = (*((integer8 *) (*(*l_element_courant).donnee).objet));
! 4086:
! 4087: if ((s_copie_4 = copie_objet(s_etat_processus, s_objet_4, 'Q'))
! 4088: == NULL)
! 4089: {
! 4090: if (variable_partagee == d_vrai)
! 4091: {
! 4092: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 4093: .s_liste_variables_partagees).mutex)) != 0)
! 4094: {
! 4095: (*s_etat_processus).erreur_systeme = d_es_processus;
! 4096: return;
! 4097: }
! 4098: }
! 4099:
! 4100: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 4101: return;
! 4102: }
! 4103:
! 4104: liberation(s_etat_processus, s_objet_4);
! 4105: s_objet_4 = s_copie_4;
! 4106:
! 4107: if ((*s_objet_4).type == VIN)
! 4108: {
! 4109: /*
! 4110: * Vecteur d'entiers
! 4111: */
! 4112:
! 4113: if ((*s_objet_1).type == INT)
! 4114: {
! 4115: /*
! 4116: * Aucune conversion de type
! 4117: */
! 4118:
! 4119: ((integer8 *) (*((struct_vecteur *) (*s_objet_4).objet))
! 4120: .tableau)[indice_i - 1] = (*((integer8 *)
! 4121: (*s_objet_1).objet));
! 4122: }
! 4123: else if ((*s_objet_1).type == REL)
! 4124: {
! 4125: /*
! 4126: * Conversion du vecteur en vecteur réel
! 4127: */
! 4128:
! 4129: tampon = (void *) ((integer8 *) (*((struct_vecteur *)
! 4130: (*s_objet_4).objet)).tableau);
! 4131:
! 4132: (*((struct_vecteur *) (*s_objet_4).objet)).type = 'R';
! 4133: (*s_objet_4).type = VRL;
! 4134:
! 4135: if (((*((struct_vecteur *) (*s_objet_4).objet)).tableau
! 4136: = malloc((*((struct_vecteur *)
! 4137: (*s_objet_4).objet)).taille * sizeof(real8)))
! 4138: == NULL)
! 4139: {
! 4140: if (variable_partagee == d_vrai)
! 4141: {
! 4142: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 4143: .s_liste_variables_partagees).mutex)) != 0)
! 4144: {
! 4145: (*s_etat_processus).erreur_systeme =
! 4146: d_es_processus;
! 4147: return;
! 4148: }
! 4149: }
! 4150:
! 4151: (*s_etat_processus).erreur_systeme =
! 4152: d_es_allocation_memoire;
! 4153: return;
! 4154: }
! 4155:
! 4156: for(i = 0; i < (*((struct_vecteur *) (*s_objet_4).objet))
! 4157: .taille; i++)
! 4158: {
! 4159: ((real8 *) (*((struct_vecteur *) (*s_objet_4).objet))
! 4160: .tableau)[i] = (real8) (((integer8 *)
! 4161: tampon)[i]);
! 4162: }
! 4163:
! 4164: free((integer8 *) tampon);
! 4165:
! 4166: ((real8 *) (*((struct_vecteur *) (*s_objet_4).objet))
! 4167: .tableau)[indice_i - 1] = (*((real8 *)
! 4168: (*s_objet_1).objet));
! 4169: }
! 4170: else if ((*s_objet_1).type == CPL)
! 4171: {
! 4172: /*
! 4173: * Conversion du vecteur en vecteur complexe
! 4174: */
! 4175:
! 4176: tampon = (void *) ((integer8 *) (*((struct_vecteur *)
! 4177: (*s_objet_4).objet)).tableau);
! 4178:
! 4179: (*((struct_vecteur *) (*s_objet_4).objet)).type = 'C';
! 4180: (*s_objet_4).type = VCX;
! 4181:
! 4182: if (((*((struct_vecteur *) (*s_objet_4).objet)).tableau
! 4183: = malloc((*((struct_vecteur *)
! 4184: (*s_objet_4).objet)).taille *
! 4185: sizeof(struct_complexe16))) == NULL)
! 4186: {
! 4187: if (variable_partagee == d_vrai)
! 4188: {
! 4189: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 4190: .s_liste_variables_partagees).mutex)) != 0)
! 4191: {
! 4192: (*s_etat_processus).erreur_systeme =
! 4193: d_es_processus;
! 4194: return;
! 4195: }
! 4196: }
! 4197:
! 4198: (*s_etat_processus).erreur_systeme =
! 4199: d_es_allocation_memoire;
! 4200: return;
! 4201: }
! 4202:
! 4203: for(i = 0; i < (*((struct_vecteur *) (*s_objet_4).objet))
! 4204: .taille; i++)
! 4205: {
! 4206: ((struct_complexe16 *) (*((struct_vecteur *)
! 4207: (*s_objet_4).objet)).tableau)[i].partie_reelle =
! 4208: (real8) (((integer8 *) tampon)[i]);
! 4209: ((struct_complexe16 *) (*((struct_vecteur *)
! 4210: (*s_objet_4).objet)).tableau)[i]
! 4211: .partie_imaginaire = (real8) 0;
! 4212: }
! 4213:
! 4214: free((integer8 *) tampon);
! 4215:
! 4216: ((struct_complexe16 *) (*((struct_vecteur *)
! 4217: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 4218: .partie_reelle = (*((struct_complexe16 *)
! 4219: (*s_objet_1).objet)).partie_reelle;
! 4220: ((struct_complexe16 *) (*((struct_vecteur *)
! 4221: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 4222: .partie_imaginaire = (*((struct_complexe16 *)
! 4223: (*s_objet_1).objet)).partie_imaginaire;
! 4224: }
! 4225: else
! 4226: {
! 4227: if (variable_partagee == d_vrai)
! 4228: {
! 4229: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 4230: .s_liste_variables_partagees).mutex)) != 0)
! 4231: {
! 4232: (*s_etat_processus).erreur_systeme =
! 4233: d_es_processus;
! 4234: return;
! 4235: }
! 4236: }
! 4237:
! 4238: liberation(s_etat_processus, s_objet_1);
! 4239: liberation(s_etat_processus, s_objet_2);
! 4240: liberation(s_etat_processus, s_objet_3);
! 4241:
! 4242: (*s_etat_processus).erreur_execution =
! 4243: d_ex_erreur_type_argument;
! 4244: return;
! 4245: }
! 4246: }
! 4247: else if ((*s_objet_4).type == VRL)
! 4248: {
! 4249: /*
! 4250: * Vecteur de réels
! 4251: */
! 4252:
! 4253: if ((*s_objet_1).type == INT)
! 4254: {
! 4255: /*
! 4256: * Conversion de l'élément à insérer en réel
! 4257: */
! 4258:
! 4259: ((real8 *) (*((struct_vecteur *) (*s_objet_4).objet))
! 4260: .tableau)[indice_i - 1] = (real8) (*((integer8 *)
! 4261: (*s_objet_1).objet));
! 4262: }
! 4263: else if ((*s_objet_1).type == REL)
! 4264: {
! 4265: /*
! 4266: * Aucune conversion de type
! 4267: */
! 4268:
! 4269: ((real8 *) (*((struct_vecteur *) (*s_objet_4).objet))
! 4270: .tableau)[indice_i - 1] = (*((real8 *)
! 4271: (*s_objet_1).objet));
! 4272: }
! 4273: else if ((*s_objet_1).type == CPL)
! 4274: {
! 4275: /*
! 4276: * Conversion du vecteur en vecteur complexe
! 4277: */
! 4278:
! 4279: tampon = (void *) ((integer8 *) (*((struct_vecteur *)
! 4280: (*s_objet_4).objet)).tableau);
! 4281:
! 4282: (*((struct_vecteur *) (*s_objet_4).objet)).type = 'C';
! 4283: (*s_objet_4).type = VCX;
! 4284:
! 4285: if (((*((struct_vecteur *) (*s_objet_4).objet)).tableau
! 4286: = malloc((*((struct_vecteur *)
! 4287: (*s_objet_4).objet)).taille *
! 4288: sizeof(struct_complexe16))) == NULL)
! 4289: {
! 4290: if (variable_partagee == d_vrai)
! 4291: {
! 4292: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 4293: .s_liste_variables_partagees).mutex)) != 0)
! 4294: {
! 4295: (*s_etat_processus).erreur_systeme =
! 4296: d_es_processus;
! 4297: return;
! 4298: }
! 4299: }
! 4300:
! 4301: (*s_etat_processus).erreur_systeme =
! 4302: d_es_allocation_memoire;
! 4303: return;
! 4304: }
! 4305:
! 4306: for(i = 0; i < (*((struct_vecteur *) (*s_objet_4).objet))
! 4307: .taille; i++)
! 4308: {
! 4309: ((struct_complexe16 *) (*((struct_vecteur *)
! 4310: (*s_objet_4).objet)).tableau)[i].partie_reelle =
! 4311: ((real8 *) tampon)[i];
! 4312: ((struct_complexe16 *) (*((struct_vecteur *)
! 4313: (*s_objet_4).objet)).tableau)[i]
! 4314: .partie_imaginaire = (real8) 0;
! 4315: }
! 4316:
! 4317: free((real8 *) tampon);
! 4318:
! 4319: ((struct_complexe16 *) (*((struct_vecteur *)
! 4320: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 4321: .partie_reelle = (*((struct_complexe16 *)
! 4322: (*s_objet_1).objet)).partie_reelle;
! 4323: ((struct_complexe16 *) (*((struct_vecteur *)
! 4324: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 4325: .partie_imaginaire = (*((struct_complexe16 *)
! 4326: (*s_objet_1).objet)).partie_imaginaire;
! 4327: }
! 4328: else
! 4329: {
! 4330: if (variable_partagee == d_vrai)
! 4331: {
! 4332: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 4333: .s_liste_variables_partagees).mutex)) != 0)
! 4334: {
! 4335: (*s_etat_processus).erreur_systeme =
! 4336: d_es_processus;
! 4337: return;
! 4338: }
! 4339: }
! 4340:
! 4341: liberation(s_etat_processus, s_objet_1);
! 4342: liberation(s_etat_processus, s_objet_2);
! 4343: liberation(s_etat_processus, s_objet_3);
! 4344:
! 4345: (*s_etat_processus).erreur_execution =
! 4346: d_ex_erreur_type_argument;
! 4347: return;
! 4348: }
! 4349: }
! 4350: else
! 4351: {
! 4352: /*
! 4353: * Vecteur de complexes
! 4354: */
! 4355:
! 4356: if ((*s_objet_1).type == INT)
! 4357: {
! 4358: /*
! 4359: * Conversion de l'élément à insérer en complexe
! 4360: */
! 4361:
! 4362: ((struct_complexe16 *) (*((struct_vecteur *)
! 4363: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 4364: .partie_reelle = (real8) (*((integer8 *)
! 4365: (*s_objet_1).objet));
! 4366: ((struct_complexe16 *) (*((struct_vecteur *)
! 4367: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 4368: .partie_imaginaire = (real8) 0;
! 4369: }
! 4370: else if ((*s_objet_1).type == REL)
! 4371: {
! 4372: /*
! 4373: * Conversion de l'élément à insérer en complexe
! 4374: */
! 4375:
! 4376: ((struct_complexe16 *) (*((struct_vecteur *)
! 4377: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 4378: .partie_reelle = (*((real8 *) (*s_objet_1).objet));
! 4379: ((struct_complexe16 *) (*((struct_vecteur *)
! 4380: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 4381: .partie_imaginaire = (real8) 0;
! 4382: }
! 4383: else if ((*s_objet_1).type == CPL)
! 4384: {
! 4385: /*
! 4386: * Aucune conversion de type
! 4387: */
! 4388:
! 4389: ((struct_complexe16 *) (*((struct_vecteur *)
! 4390: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 4391: .partie_reelle = (*((struct_complexe16 *)
! 4392: (*s_objet_1).objet)).partie_reelle;
! 4393: ((struct_complexe16 *) (*((struct_vecteur *)
! 4394: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 4395: .partie_imaginaire = (*((struct_complexe16 *)
! 4396: (*s_objet_1).objet)).partie_imaginaire;
! 4397: }
! 4398: else
! 4399: {
! 4400: if (variable_partagee == d_vrai)
! 4401: {
! 4402: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 4403: .s_liste_variables_partagees).mutex)) != 0)
! 4404: {
! 4405: (*s_etat_processus).erreur_systeme =
! 4406: d_es_processus;
! 4407: return;
! 4408: }
! 4409: }
! 4410:
! 4411: liberation(s_etat_processus, s_objet_1);
! 4412: liberation(s_etat_processus, s_objet_2);
! 4413: liberation(s_etat_processus, s_objet_3);
! 4414:
! 4415: (*s_etat_processus).erreur_execution =
! 4416: d_ex_erreur_type_argument;
! 4417: return;
! 4418: }
! 4419: }
! 4420:
! 4421: (*((integer8 *) (*(*l_element_courant).donnee).objet)) =
! 4422: (indice_i % (*((struct_vecteur *) (*s_objet_4).objet))
! 4423: .taille) + 1;
! 4424:
! 4425: if (variable_partagee == d_faux)
! 4426: {
! 4427: (*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 4428: .position_variable_courante].objet = s_objet_4;
! 4429: }
! 4430: else
! 4431: {
! 4432: (*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 4433: .position_variable_courante].objet = NULL;
! 4434: (*(*s_etat_processus).s_liste_variables_partagees)
! 4435: .table[(*(*s_etat_processus)
! 4436: .s_liste_variables_partagees).position_variable].objet
! 4437: = s_objet_4;
! 4438:
! 4439: if (variable_partagee == d_vrai)
! 4440: {
! 4441: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 4442: .s_liste_variables_partagees).mutex)) != 0)
! 4443: {
! 4444: (*s_etat_processus).erreur_systeme = d_es_processus;
! 4445: return;
! 4446: }
! 4447: }
! 4448: }
! 4449:
! 4450: liberation(s_etat_processus, s_objet_1);
! 4451: }
! 4452: else if (((*s_objet_4).type == MIN) ||
! 4453: ((*s_objet_4).type == MRL) ||
! 4454: ((*s_objet_4).type == MCX))
! 4455: {
! 4456: if ((*s_objet_2).type != LST)
! 4457: {
! 4458: if (variable_partagee == d_vrai)
! 4459: {
! 4460: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 4461: .s_liste_variables_partagees).mutex)) != 0)
! 4462: {
! 4463: (*s_etat_processus).erreur_systeme = d_es_processus;
! 4464: return;
! 4465: }
! 4466: }
! 4467:
! 4468: liberation(s_etat_processus, s_objet_1);
! 4469: liberation(s_etat_processus, s_objet_2);
! 4470: liberation(s_etat_processus, s_objet_3);
! 4471:
! 4472: (*s_etat_processus).erreur_execution =
! 4473: d_ex_erreur_type_argument;
! 4474: return;
! 4475: }
! 4476:
! 4477: l_element_courant = (*s_objet_2).objet;
! 4478: nombre_dimensions = 0;
! 4479:
! 4480: while(l_element_courant != NULL)
! 4481: {
! 4482: nombre_dimensions++;
! 4483: l_element_courant = (*l_element_courant).suivant;
! 4484: }
! 4485:
! 4486: if (nombre_dimensions != 2)
! 4487: {
! 4488: if (variable_partagee == d_vrai)
! 4489: {
! 4490: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 4491: .s_liste_variables_partagees).mutex)) != 0)
! 4492: {
! 4493: (*s_etat_processus).erreur_systeme = d_es_processus;
! 4494: return;
! 4495: }
! 4496: }
! 4497:
! 4498: liberation(s_etat_processus, s_objet_1);
! 4499: liberation(s_etat_processus, s_objet_2);
! 4500: liberation(s_etat_processus, s_objet_3);
! 4501:
! 4502: (*s_etat_processus).erreur_execution =
! 4503: d_ex_dimensions_invalides;
! 4504: return;
! 4505: }
! 4506:
! 4507: l_element_courant = (*s_objet_2).objet;
! 4508:
! 4509: indice_i = 0;
! 4510: indice_j = 0;
! 4511:
! 4512: while(l_element_courant != NULL)
! 4513: {
! 4514: if ((*(*l_element_courant).donnee).type != INT)
! 4515: {
! 4516: if (variable_partagee == d_vrai)
! 4517: {
! 4518: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 4519: .s_liste_variables_partagees).mutex)) != 0)
! 4520: {
! 4521: (*s_etat_processus).erreur_systeme = d_es_processus;
! 4522: return;
! 4523: }
! 4524: }
! 4525:
! 4526: liberation(s_etat_processus, s_objet_1);
! 4527: liberation(s_etat_processus, s_objet_2);
! 4528: liberation(s_etat_processus, s_objet_3);
! 4529:
! 4530: (*s_etat_processus).erreur_execution =
! 4531: d_ex_erreur_type_argument;
! 4532: return;
! 4533: }
! 4534:
! 4535: if ((*((integer8 *) (*(*l_element_courant).donnee).objet))
! 4536: <= 0)
! 4537: {
! 4538: if (variable_partagee == d_vrai)
! 4539: {
! 4540: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 4541: .s_liste_variables_partagees).mutex)) != 0)
! 4542: {
! 4543: (*s_etat_processus).erreur_systeme = d_es_processus;
! 4544: return;
! 4545: }
! 4546: }
! 4547:
! 4548: liberation(s_etat_processus, s_objet_1);
! 4549: liberation(s_etat_processus, s_objet_2);
! 4550: liberation(s_etat_processus, s_objet_3);
! 4551:
! 4552: (*s_etat_processus).erreur_execution =
! 4553: d_ex_argument_invalide;
! 4554: return;
! 4555: }
! 4556:
! 4557: if (indice_i == 0)
! 4558: {
! 4559: indice_i = (*((integer8 *)
! 4560: (*(*l_element_courant).donnee).objet));
! 4561: }
! 4562: else
! 4563: {
! 4564: indice_j = (*((integer8 *)
! 4565: (*(*l_element_courant).donnee).objet));
! 4566: }
! 4567:
! 4568: l_element_courant = (*l_element_courant).suivant;
! 4569: }
! 4570:
! 4571: if ((indice_i > (*((struct_matrice *) (*s_objet_4).objet))
! 4572: .nombre_lignes) || (indice_j > (*((struct_matrice *)
! 4573: (*s_objet_4).objet)).nombre_colonnes))
! 4574: {
! 4575: if (variable_partagee == d_vrai)
! 4576: {
! 4577: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 4578: .s_liste_variables_partagees).mutex)) != 0)
! 4579: {
! 4580: (*s_etat_processus).erreur_systeme = d_es_processus;
! 4581: return;
! 4582: }
! 4583: }
! 4584:
! 4585: liberation(s_etat_processus, s_objet_1);
! 4586: liberation(s_etat_processus, s_objet_2);
! 4587: liberation(s_etat_processus, s_objet_3);
! 4588:
! 4589: (*s_etat_processus).erreur_execution = d_ex_element_inexistant;
! 4590: return;
! 4591: }
! 4592:
! 4593: if ((s_copie_4 = copie_objet(s_etat_processus, s_objet_4, 'Q'))
! 4594: == NULL)
! 4595: {
! 4596: if (variable_partagee == d_vrai)
! 4597: {
! 4598: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 4599: .s_liste_variables_partagees).mutex)) != 0)
! 4600: {
! 4601: (*s_etat_processus).erreur_systeme = d_es_processus;
! 4602: return;
! 4603: }
! 4604: }
! 4605:
! 4606: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 4607: return;
! 4608: }
! 4609:
! 4610: liberation(s_etat_processus, s_objet_4);
! 4611: s_objet_4 = s_copie_4;
! 4612:
! 4613: if ((*s_objet_4).type == MIN)
! 4614: {
! 4615: /*
! 4616: * Matrice d'entiers
! 4617: */
! 4618:
! 4619: if ((*s_objet_1).type == INT)
! 4620: {
! 4621: /*
! 4622: * Aucune conversion de type
! 4623: */
! 4624:
! 4625: ((integer8 **) (*((struct_matrice *) (*s_objet_4).objet))
! 4626: .tableau)[indice_i - 1][indice_j - 1] =
! 4627: (*((integer8 *) (*s_objet_1).objet));
! 4628: }
! 4629: else if ((*s_objet_1).type == REL)
! 4630: {
! 4631: /*
! 4632: * Conversion de la matrice en matrice réelle
! 4633: */
! 4634:
! 4635: tampon = (void *) ((integer8 **) (*((struct_matrice *)
! 4636: (*s_objet_4).objet)).tableau);
! 4637:
! 4638: (*((struct_matrice *) (*s_objet_4).objet)).type = 'R';
! 4639: (*s_objet_4).type = MRL;
! 4640:
! 4641: if (((*((struct_matrice *) (*s_objet_4).objet)).tableau
! 4642: = malloc((*((struct_matrice *)
! 4643: (*s_objet_4).objet)).nombre_lignes *
! 4644: sizeof(real8 *))) == NULL)
! 4645: {
! 4646: if (variable_partagee == d_vrai)
! 4647: {
! 4648: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 4649: .s_liste_variables_partagees).mutex)) != 0)
! 4650: {
! 4651: (*s_etat_processus).erreur_systeme =
! 4652: d_es_processus;
! 4653: return;
! 4654: }
! 4655: }
! 4656:
! 4657: (*s_etat_processus).erreur_systeme =
! 4658: d_es_allocation_memoire;
! 4659: return;
! 4660: }
! 4661:
! 4662: for(i = 0; i < (*((struct_matrice *) (*s_objet_4).objet))
! 4663: .nombre_lignes; i++)
! 4664: {
! 4665: if ((((real8 **) (*((struct_matrice *)
! 4666: (*s_objet_4).objet)).tableau)[i]
! 4667: = malloc((*((struct_matrice *)
! 4668: (*s_objet_4).objet)).nombre_colonnes *
! 4669: sizeof(real8))) == NULL)
! 4670: {
! 4671: if (variable_partagee == d_vrai)
! 4672: {
! 4673: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 4674: .s_liste_variables_partagees).mutex))
! 4675: != 0)
! 4676: {
! 4677: (*s_etat_processus).erreur_systeme =
! 4678: d_es_processus;
! 4679: return;
! 4680: }
! 4681: }
! 4682:
! 4683: (*s_etat_processus).erreur_systeme =
! 4684: d_es_allocation_memoire;
! 4685: return;
! 4686: }
! 4687:
! 4688: for(j = 0; j < (*((struct_matrice *)
! 4689: (*s_objet_4).objet)).nombre_colonnes; j++)
! 4690: {
! 4691: ((real8 **) (*((struct_matrice *) (*s_objet_4)
! 4692: .objet)).tableau)[i][j] = (real8)
! 4693: (((integer8 **) tampon)[i][j]);
! 4694: }
! 4695:
! 4696: free(((integer8 **) tampon)[i]);
! 4697: }
! 4698:
! 4699: free((integer8 **) tampon);
! 4700:
! 4701: ((real8 **) (*((struct_matrice *) (*s_objet_4).objet))
! 4702: .tableau)[indice_i - 1][indice_j - 1] =
! 4703: (*((real8 *) (*s_objet_1).objet));
! 4704: }
! 4705: else if ((*s_objet_1).type == CPL)
! 4706: {
! 4707: /*
! 4708: * Conversion de la matrice en matrice complexe
! 4709: */
! 4710:
! 4711: tampon = (void *) ((integer8 **) (*((struct_matrice *)
! 4712: (*s_objet_4).objet)).tableau);
! 4713:
! 4714: (*((struct_matrice *) (*s_objet_4).objet)).type = 'C';
! 4715: (*s_objet_4).type = MCX;
! 4716:
! 4717: if (((*((struct_matrice *) (*s_objet_4).objet)).tableau
! 4718: = malloc((*((struct_matrice *)
! 4719: (*s_objet_4).objet)).nombre_lignes *
! 4720: sizeof(struct_complexe16 *))) == NULL)
! 4721: {
! 4722: if (variable_partagee == d_vrai)
! 4723: {
! 4724: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 4725: .s_liste_variables_partagees).mutex)) != 0)
! 4726: {
! 4727: (*s_etat_processus).erreur_systeme =
! 4728: d_es_processus;
! 4729: return;
! 4730: }
! 4731: }
! 4732:
! 4733: (*s_etat_processus).erreur_systeme =
! 4734: d_es_allocation_memoire;
! 4735: return;
! 4736: }
! 4737:
! 4738: for(i = 0; i < (*((struct_matrice *) (*s_objet_4).objet))
! 4739: .nombre_lignes; i++)
! 4740: {
! 4741: if ((((struct_complexe16 **) (*((struct_matrice *)
! 4742: (*s_objet_4).objet)).tableau)[i]
! 4743: = malloc((*((struct_matrice *)
! 4744: (*s_objet_4).objet)).nombre_colonnes *
! 4745: sizeof(struct_complexe16))) == NULL)
! 4746: {
! 4747: if (variable_partagee == d_vrai)
! 4748: {
! 4749: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 4750: .s_liste_variables_partagees).mutex))
! 4751: != 0)
! 4752: {
! 4753: (*s_etat_processus).erreur_systeme =
! 4754: d_es_processus;
! 4755: return;
! 4756: }
! 4757: }
! 4758:
! 4759: (*s_etat_processus).erreur_systeme =
! 4760: d_es_allocation_memoire;
! 4761: return;
! 4762: }
! 4763:
! 4764: for(j = 0; j < (*((struct_matrice *)
! 4765: (*s_objet_4).objet)).nombre_colonnes; j++)
! 4766: {
! 4767: ((struct_complexe16 **) (*((struct_matrice *)
! 4768: (*s_objet_4).objet)).tableau)[i][j]
! 4769: .partie_reelle = (real8) (((integer8 **)
! 4770: tampon)[i][j]);
! 4771: ((struct_complexe16 **) (*((struct_matrice *)
! 4772: (*s_objet_4).objet)).tableau)[i][j]
! 4773: .partie_imaginaire = (real8) 0;
! 4774: }
! 4775:
! 4776: free(((integer8 **) tampon)[i]);
! 4777: }
! 4778:
! 4779: free((integer8 **) tampon);
! 4780:
! 4781: ((struct_complexe16 **) (*((struct_matrice *)
! 4782: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 4783: [indice_j - 1].partie_reelle =
! 4784: (*((struct_complexe16 *)
! 4785: (*s_objet_1).objet)).partie_reelle;
! 4786: ((struct_complexe16 **) (*((struct_matrice *)
! 4787: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 4788: [indice_j - 1].partie_imaginaire =
! 4789: (*((struct_complexe16 *)
! 4790: (*s_objet_1).objet)).partie_imaginaire;
! 4791: }
! 4792: else
! 4793: {
! 4794: if (variable_partagee == d_vrai)
! 4795: {
! 4796: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 4797: .s_liste_variables_partagees).mutex)) != 0)
! 4798: {
! 4799: (*s_etat_processus).erreur_systeme =
! 4800: d_es_processus;
! 4801: return;
! 4802: }
! 4803: }
! 4804:
! 4805: liberation(s_etat_processus, s_objet_1);
! 4806: liberation(s_etat_processus, s_objet_2);
! 4807: liberation(s_etat_processus, s_objet_3);
! 4808:
! 4809: (*s_etat_processus).erreur_execution =
! 4810: d_ex_erreur_type_argument;
! 4811: return;
! 4812: }
! 4813: }
! 4814: else if ((*s_objet_4).type == MRL)
! 4815: {
! 4816: /*
! 4817: * Matrice de réels
! 4818: */
! 4819:
! 4820: if ((*s_objet_1).type == INT)
! 4821: {
! 4822: /*
! 4823: * Conversion de l'élément à insérer en réel
! 4824: */
! 4825:
! 4826: ((real8 **) (*((struct_matrice *) (*s_objet_4).objet))
! 4827: .tableau)[indice_i - 1][indice_j - 1] =
! 4828: (real8) (*((integer8 *) (*s_objet_1).objet));
! 4829: }
! 4830: else if ((*s_objet_1).type == REL)
! 4831: {
! 4832: /*
! 4833: * Aucune conversion de type
! 4834: */
! 4835:
! 4836: ((real8 **) (*((struct_matrice *) (*s_objet_4).objet))
! 4837: .tableau)[indice_i - 1][indice_j - 1] =
! 4838: (*((real8 *) (*s_objet_1).objet));
! 4839: }
! 4840: else if ((*s_objet_1).type == CPL)
! 4841: {
! 4842: /*
! 4843: * Conversion de la matrice en matrice complexe
! 4844: */
! 4845:
! 4846: tampon = (void *) ((real8 **) (*((struct_matrice *)
! 4847: (*s_objet_4).objet)).tableau);
! 4848:
! 4849: (*((struct_matrice *) (*s_objet_4).objet)).type = 'C';
! 4850: (*s_objet_4).type = MCX;
! 4851:
! 4852: if (((*((struct_matrice *) (*s_objet_4).objet)).tableau
! 4853: = malloc((*((struct_matrice *)
! 4854: (*s_objet_4).objet)).nombre_lignes *
! 4855: sizeof(struct_complexe16 *))) == NULL)
! 4856: {
! 4857: if (variable_partagee == d_vrai)
! 4858: {
! 4859: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 4860: .s_liste_variables_partagees).mutex)) != 0)
! 4861: {
! 4862: (*s_etat_processus).erreur_systeme =
! 4863: d_es_processus;
! 4864: return;
! 4865: }
! 4866: }
! 4867:
! 4868: (*s_etat_processus).erreur_systeme =
! 4869: d_es_allocation_memoire;
! 4870: return;
! 4871: }
! 4872:
! 4873: for(i = 0; i < (*((struct_matrice *) (*s_objet_4).objet))
! 4874: .nombre_lignes; i++)
! 4875: {
! 4876: if ((((struct_complexe16 **) (*((struct_matrice *)
! 4877: (*s_objet_4).objet)).tableau)[i]
! 4878: = malloc((*((struct_matrice *)
! 4879: (*s_objet_4).objet)).nombre_colonnes *
! 4880: sizeof(struct_complexe16))) == NULL)
! 4881: {
! 4882: if (variable_partagee == d_vrai)
! 4883: {
! 4884: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 4885: .s_liste_variables_partagees).mutex))
! 4886: != 0)
! 4887: {
! 4888: (*s_etat_processus).erreur_systeme =
! 4889: d_es_processus;
! 4890: return;
! 4891: }
! 4892: }
! 4893:
! 4894: (*s_etat_processus).erreur_systeme =
! 4895: d_es_allocation_memoire;
! 4896: return;
! 4897: }
! 4898:
! 4899: for(j = 0; j < (*((struct_matrice *)
! 4900: (*s_objet_4).objet)).nombre_colonnes; j++)
! 4901: {
! 4902: ((struct_complexe16 **) (*((struct_matrice *)
! 4903: (*s_objet_4).objet)).tableau)[i][j]
! 4904: .partie_reelle = (((real8 **)
! 4905: tampon)[i][j]);
! 4906: ((struct_complexe16 **) (*((struct_matrice *)
! 4907: (*s_objet_4).objet)).tableau)[i][j]
! 4908: .partie_imaginaire = (real8) 0;
! 4909: }
! 4910:
! 4911: free(((integer8 **) tampon)[i]);
! 4912: }
! 4913:
! 4914: free((integer8 **) tampon);
! 4915:
! 4916: ((struct_complexe16 **) (*((struct_matrice *)
! 4917: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 4918: [indice_j - 1].partie_reelle =
! 4919: (*((struct_complexe16 *)
! 4920: (*s_objet_1).objet)).partie_reelle;
! 4921: ((struct_complexe16 **) (*((struct_matrice *)
! 4922: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 4923: [indice_j - 1].partie_imaginaire =
! 4924: (*((struct_complexe16 *)
! 4925: (*s_objet_1).objet)).partie_imaginaire;
! 4926: }
! 4927: else
! 4928: {
! 4929: if (variable_partagee == d_vrai)
! 4930: {
! 4931: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 4932: .s_liste_variables_partagees).mutex))
! 4933: != 0)
! 4934: {
! 4935: (*s_etat_processus).erreur_systeme =
! 4936: d_es_processus;
! 4937: return;
! 4938: }
! 4939: }
! 4940:
! 4941: liberation(s_etat_processus, s_objet_1);
! 4942: liberation(s_etat_processus, s_objet_2);
! 4943: liberation(s_etat_processus, s_objet_3);
! 4944:
! 4945: (*s_etat_processus).erreur_execution =
! 4946: d_ex_erreur_type_argument;
! 4947: return;
! 4948: }
! 4949: }
! 4950: else
! 4951: {
! 4952: /*
! 4953: * Matrice de complexes
! 4954: */
! 4955:
! 4956: if ((*s_objet_1).type == INT)
! 4957: {
! 4958: /*
! 4959: * Conversion de l'élément à insérer en complexe
! 4960: */
! 4961:
! 4962: ((struct_complexe16 **) (*((struct_matrice *)
! 4963: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 4964: [indice_j - 1].partie_reelle = (real8)
! 4965: (*((integer8 *) (*s_objet_1).objet));
! 4966: ((struct_complexe16 **) (*((struct_matrice *)
! 4967: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 4968: [indice_j - 1].partie_imaginaire = (real8) 0;
! 4969: }
! 4970: else if ((*s_objet_1).type == REL)
! 4971: {
! 4972: /*
! 4973: * Conversion de l'élément à insérer en complexe
! 4974: */
! 4975:
! 4976: ((struct_complexe16 **) (*((struct_matrice *)
! 4977: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 4978: [indice_j - 1].partie_reelle =
! 4979: (*((real8 *) (*s_objet_1).objet));
! 4980: ((struct_complexe16 **) (*((struct_matrice *)
! 4981: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 4982: [indice_j - 1].partie_imaginaire = (real8) 0;
! 4983: }
! 4984: else if ((*s_objet_1).type == CPL)
! 4985: {
! 4986: /*
! 4987: * Aucune conversion de type
! 4988: */
! 4989:
! 4990: ((struct_complexe16 **) (*((struct_matrice *)
! 4991: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 4992: [indice_j - 1].partie_reelle =
! 4993: (*((struct_complexe16 *)
! 4994: (*s_objet_1).objet)).partie_reelle;
! 4995: ((struct_complexe16 **) (*((struct_matrice *)
! 4996: (*s_objet_4).objet)).tableau)[indice_i - 1]
! 4997: [indice_j - 1].partie_imaginaire =
! 4998: (*((struct_complexe16 *)
! 4999: (*s_objet_1).objet)).partie_imaginaire;
! 5000: }
! 5001: else
! 5002: {
! 5003: if (variable_partagee == d_vrai)
! 5004: {
! 5005: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 5006: .s_liste_variables_partagees).mutex))
! 5007: != 0)
! 5008: {
! 5009: (*s_etat_processus).erreur_systeme =
! 5010: d_es_processus;
! 5011: return;
! 5012: }
! 5013: }
! 5014:
! 5015: liberation(s_etat_processus, s_objet_1);
! 5016: liberation(s_etat_processus, s_objet_2);
! 5017: liberation(s_etat_processus, s_objet_3);
! 5018:
! 5019: (*s_etat_processus).erreur_execution =
! 5020: d_ex_erreur_type_argument;
! 5021: return;
! 5022: }
! 5023: }
! 5024:
! 5025: if ((++(*((integer8 *) (*(*(*((struct_liste_chainee *)
! 5026: (*s_objet_2).objet)).suivant).donnee).objet))) > (integer8)
! 5027: (*((struct_matrice *) (*s_objet_4).objet)).nombre_colonnes)
! 5028: {
! 5029: (*((integer8 *) (*(*(*((struct_liste_chainee *) (*s_objet_2)
! 5030: .objet)).suivant).donnee).objet)) = 1;
! 5031:
! 5032: if ((++(*((integer8 *) (*(*((struct_liste_chainee *)
! 5033: (*s_objet_2).objet)).donnee).objet))) > (integer8)
! 5034: (*((struct_matrice *) (*s_objet_4).objet))
! 5035: .nombre_lignes)
! 5036: {
! 5037: (*((integer8 *) (*(*((struct_liste_chainee *)
! 5038: (*s_objet_2).objet)).donnee).objet)) = 1;
! 5039: }
! 5040: }
! 5041:
! 5042: if (variable_partagee == d_faux)
! 5043: {
! 5044: (*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 5045: .position_variable_courante].objet = s_objet_4;
! 5046: }
! 5047: else
! 5048: {
! 5049: (*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 5050: .position_variable_courante].objet = NULL;
! 5051: (*(*s_etat_processus).s_liste_variables_partagees).table
! 5052: [(*(*s_etat_processus).s_liste_variables_partagees)
! 5053: .position_variable].objet = s_objet_4;
! 5054:
! 5055: if (variable_partagee == d_vrai)
! 5056: {
! 5057: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 5058: .s_liste_variables_partagees).mutex)) != 0)
! 5059: {
! 5060: (*s_etat_processus).erreur_systeme =
! 5061: d_es_processus;
! 5062: return;
! 5063: }
! 5064: }
! 5065: }
! 5066:
! 5067: liberation(s_etat_processus, s_objet_1);
! 5068: }
! 5069: else if ((*s_objet_4).type == LST)
! 5070: {
! 5071: if ((*s_objet_2).type != INT)
! 5072: {
! 5073: if (variable_partagee == d_vrai)
! 5074: {
! 5075: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 5076: .s_liste_variables_partagees).mutex)) != 0)
! 5077: {
! 5078: (*s_etat_processus).erreur_systeme =
! 5079: d_es_processus;
! 5080: return;
! 5081: }
! 5082: }
! 5083:
! 5084: liberation(s_etat_processus, s_objet_1);
! 5085: liberation(s_etat_processus, s_objet_2);
! 5086: liberation(s_etat_processus, s_objet_3);
! 5087:
! 5088: (*s_etat_processus).erreur_execution =
! 5089: d_ex_erreur_type_argument;
! 5090: return;
! 5091: }
! 5092:
! 5093: indice_i = (*((integer8 *) (*s_objet_2).objet));
! 5094: indice_j = 1;
! 5095:
! 5096: if ((*s_objet_4).nombre_occurrences > 1)
! 5097: {
! 5098: if ((s_copie_4 = copie_objet(s_etat_processus, s_objet_4, 'N'))
! 5099: == NULL)
! 5100: {
! 5101: if (variable_partagee == d_vrai)
! 5102: {
! 5103: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 5104: .s_liste_variables_partagees).mutex)) != 0)
! 5105: {
! 5106: (*s_etat_processus).erreur_systeme =
! 5107: d_es_processus;
! 5108: return;
! 5109: }
! 5110: }
! 5111:
! 5112: (*s_etat_processus).erreur_systeme =
! 5113: d_es_allocation_memoire;
! 5114: return;
! 5115: }
! 5116:
! 5117: liberation(s_etat_processus, s_objet_4);
! 5118: s_objet_4 = s_copie_4;
! 5119: }
! 5120:
! 5121: l_element_courant = (*s_objet_4).objet;
! 5122: nombre_elements = 0;
! 5123:
! 5124: while(l_element_courant != NULL)
! 5125: {
! 5126: l_element_courant = (*l_element_courant).suivant;
! 5127: nombre_elements++;
! 5128: }
! 5129:
! 5130: l_element_courant = (*s_objet_4).objet;
! 5131:
! 5132: while((l_element_courant != NULL) && (indice_j != indice_i))
! 5133: {
! 5134: l_element_courant = (*l_element_courant).suivant;
! 5135: indice_j++;
! 5136: }
! 5137:
! 5138: if (l_element_courant != NULL)
! 5139: {
! 5140: liberation(s_etat_processus, (*l_element_courant).donnee);
! 5141: (*l_element_courant).donnee = s_objet_1;
! 5142: }
! 5143: else
! 5144: {
! 5145: if (variable_partagee == d_vrai)
! 5146: {
! 5147: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 5148: .s_liste_variables_partagees).mutex)) != 0)
! 5149: {
! 5150: (*s_etat_processus).erreur_systeme =
! 5151: d_es_processus;
! 5152: return;
! 5153: }
! 5154: }
! 5155:
! 5156: liberation(s_etat_processus, s_objet_1);
! 5157: liberation(s_etat_processus, s_objet_2);
! 5158: liberation(s_etat_processus, s_objet_3);
! 5159:
! 5160: (*s_etat_processus).erreur_execution = d_ex_element_inexistant;
! 5161: return;
! 5162: }
! 5163:
! 5164: (*((integer8 *) (*s_objet_2).objet)) =
! 5165: (indice_i % nombre_elements) + 1;
! 5166:
! 5167: if (variable_partagee == d_faux)
! 5168: {
! 5169: (*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 5170: .position_variable_courante].objet = s_objet_4;
! 5171: }
! 5172: else
! 5173: {
! 5174: (*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 5175: .position_variable_courante].objet = NULL;
! 5176: (*(*s_etat_processus).s_liste_variables_partagees).table
! 5177: [(*(*s_etat_processus).s_liste_variables_partagees)
! 5178: .position_variable].objet = s_objet_4;
! 5179:
! 5180: if (variable_partagee == d_vrai)
! 5181: {
! 5182: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 5183: .s_liste_variables_partagees).mutex)) != 0)
! 5184: {
! 5185: (*s_etat_processus).erreur_systeme =
! 5186: d_es_processus;
! 5187: return;
! 5188: }
! 5189: }
! 5190: }
! 5191: }
! 5192: else
! 5193: {
! 5194: if (variable_partagee == d_vrai)
! 5195: {
! 5196: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 5197: .s_liste_variables_partagees).mutex)) != 0)
! 5198: {
! 5199: (*s_etat_processus).erreur_systeme =
! 5200: d_es_processus;
! 5201: return;
! 5202: }
! 5203: }
! 5204:
! 5205: liberation(s_etat_processus, s_objet_1);
! 5206: liberation(s_etat_processus, s_objet_2);
! 5207: liberation(s_etat_processus, s_objet_3);
! 5208:
! 5209: (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
! 5210: return;
! 5211: }
! 5212:
! 5213: if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 5214: s_objet_3) == d_erreur)
! 5215: {
! 5216: return;
! 5217: }
! 5218:
! 5219: if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 5220: s_objet_2) == d_erreur)
! 5221: {
! 5222: return;
! 5223: }
! 5224: }
! 5225:
! 5226: /*
! 5227: --------------------------------------------------------------------------------
! 5228: Arguments incompatibles
! 5229: --------------------------------------------------------------------------------
! 5230: */
! 5231:
! 5232: else
! 5233: {
! 5234: liberation(s_etat_processus, s_objet_1);
! 5235: liberation(s_etat_processus, s_objet_2);
! 5236: liberation(s_etat_processus, s_objet_3);
! 5237:
! 5238: (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
! 5239: return;
! 5240: }
! 5241:
! 5242: return;
! 5243: }
! 5244:
! 5245: // vim: ts=4
CVSweb interface <joel.bertrand@systella.fr>