Annotation of rpl/src/instructions_m2.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 'max'
! 29: ================================================================================
! 30: Entrées :
! 31: --------------------------------------------------------------------------------
! 32: Sorties :
! 33: --------------------------------------------------------------------------------
! 34: Effets de bord : néant
! 35: ================================================================================
! 36: */
! 37:
! 38: void
! 39: instruction_max(struct_processus *s_etat_processus)
! 40: {
! 41: real8 max_reel;
! 42: real8 module;
! 43:
! 44: integer8 max_entier;
! 45:
! 46: struct_liste_chainee *l_element_courant;
! 47: struct_liste_chainee *l_element_precedent;
! 48:
! 49: struct_objet *s_copie_argument_1;
! 50: struct_objet *s_copie_argument_2;
! 51: struct_objet *s_objet_argument_1;
! 52: struct_objet *s_objet_argument_2;
! 53: struct_objet *s_objet_position;
! 54: struct_objet *s_objet_resultat;
! 55:
! 56: unsigned long i;
! 57: unsigned long j;
! 58: unsigned long nombre_elements;
! 59: unsigned long position_max_i;
! 60: unsigned long position_max_j;
! 61:
! 62: (*s_etat_processus).erreur_execution = d_ex;
! 63:
! 64: if ((*s_etat_processus).affichage_arguments == 'Y')
! 65: {
! 66: printf("\n MAX ");
! 67:
! 68: if ((*s_etat_processus).langue == 'F')
! 69: {
! 70: printf("(maximum)\n\n");
! 71: }
! 72: else
! 73: {
! 74: printf("(maximum)\n\n");
! 75: }
! 76:
! 77: printf(" 1: %s, %s, %s\n", d_VIN, d_VRL, d_VCX);
! 78: printf("-> 2: %s, %s, %s\n", d_INT, d_REL, d_CPL);
! 79: printf(" 1: %s\n\n", d_LST);
! 80:
! 81: printf(" 1: %s, %s, %s\n", d_MIN, d_MRL, d_MCX);
! 82: printf("-> 2: %s, %s, %s\n", d_INT, d_REL, d_CPL);
! 83: printf(" 1: %s\n\n", d_LST);
! 84:
! 85: printf(" 2: %s, %s, %s\n", d_INT, d_REL, d_CPL);
! 86: printf(" 1: %s, %s, %s\n", d_INT, d_REL, d_CPL);
! 87: printf("-> 1: %s, %s, %s\n\n", d_INT, d_REL, d_CPL);
! 88:
! 89: printf(" 2: %s, %s, %s, %s, %s, %s\n",
! 90: d_INT, d_REL, d_CPL, d_NOM, d_ALG, d_RPN);
! 91: printf(" 1: %s, %s, %s, %s, %s, %s\n",
! 92: d_INT, d_REL, d_CPL, d_NOM, d_ALG, d_RPN);
! 93: printf("-> 1: %s, %s\n", d_ALG, d_RPN);
! 94:
! 95: return;
! 96: }
! 97: else if ((*s_etat_processus).test_instruction == 'Y')
! 98: {
! 99: (*s_etat_processus).nombre_arguments = 2;
! 100: return;
! 101: }
! 102:
! 103: /*
! 104: --------------------------------------------------------------------------------
! 105: MAX portant sur un tableau (un seul argument)
! 106: --------------------------------------------------------------------------------
! 107: */
! 108:
! 109: if (((*(*(*s_etat_processus).l_base_pile).donnee).type == VIN)
! 110: || ((*(*(*s_etat_processus).l_base_pile).donnee).type ==
! 111: VRL) || ((*(*(*s_etat_processus).l_base_pile)
! 112: .donnee).type == VCX))
! 113: {
! 114: if (test_cfsf(s_etat_processus, 31) == d_vrai)
! 115: {
! 116: if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
! 117: {
! 118: return;
! 119: }
! 120: }
! 121:
! 122: if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 123: &s_objet_argument_1) == d_erreur)
! 124: {
! 125: (*s_etat_processus).erreur_execution = d_ex_manque_argument;
! 126: return;
! 127: }
! 128:
! 129: if ((s_objet_position = allocation(s_etat_processus, LST)) == NULL)
! 130: {
! 131: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 132: return;
! 133: }
! 134:
! 135: /*
! 136: * Vecteur d'entiers
! 137: */
! 138:
! 139: if ((*s_objet_argument_1).type == VIN)
! 140: {
! 141: max_entier = ((integer8 *) (*((struct_vecteur *)
! 142: (*s_objet_argument_1).objet)).tableau)[0];
! 143: position_max_i = 0;
! 144:
! 145: for(i = 1; i < (*((struct_vecteur *) (*s_objet_argument_1).objet))
! 146: .taille; i++)
! 147: {
! 148: if (((integer8 *) (*((struct_vecteur *) (*s_objet_argument_1)
! 149: .objet)).tableau)[i] > max_entier)
! 150: {
! 151: max_entier = ((integer8 *) (*((struct_vecteur *)
! 152: (*s_objet_argument_1).objet)).tableau)[i];
! 153: position_max_i = i;
! 154: }
! 155: }
! 156:
! 157: if ((s_objet_resultat = allocation(s_etat_processus, INT))
! 158: == NULL)
! 159: {
! 160: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 161: return;
! 162: }
! 163:
! 164: (*((integer8 *) (*s_objet_resultat).objet)) = max_entier;
! 165:
! 166: if (((*s_objet_position).objet =
! 167: allocation_maillon(s_etat_processus)) == NULL)
! 168: {
! 169: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 170: return;
! 171: }
! 172:
! 173: l_element_courant = (*s_objet_position).objet;
! 174: (*l_element_courant).suivant = NULL;
! 175:
! 176: if (((*l_element_courant).donnee = allocation(s_etat_processus,
! 177: INT)) == NULL)
! 178: {
! 179: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 180: return;
! 181: }
! 182:
! 183: (*((integer8 *) (*(*l_element_courant).donnee).objet)) =
! 184: position_max_i + 1;
! 185: }
! 186:
! 187: /*
! 188: * Vecteur de réels
! 189: */
! 190:
! 191: else if ((*s_objet_argument_1).type == VRL)
! 192: {
! 193: max_reel = ((real8 *) (*((struct_vecteur *)
! 194: (*s_objet_argument_1).objet)).tableau)[0];
! 195: position_max_i = 0;
! 196:
! 197: for(i = 1; i < (*((struct_vecteur *) (*s_objet_argument_1).objet))
! 198: .taille; i++)
! 199: {
! 200: if (((real8 *) (*((struct_vecteur *) (*s_objet_argument_1)
! 201: .objet)).tableau)[i] > max_reel)
! 202: {
! 203: max_reel = ((real8 *) (*((struct_vecteur *)
! 204: (*s_objet_argument_1).objet)).tableau)[i];
! 205: position_max_i = i;
! 206: }
! 207: }
! 208:
! 209: if ((s_objet_resultat = allocation(s_etat_processus, REL))
! 210: == NULL)
! 211: {
! 212: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 213: return;
! 214: }
! 215:
! 216: (*((real8 *) (*s_objet_resultat).objet)) = max_reel;
! 217:
! 218: if (((*s_objet_position).objet =
! 219: allocation_maillon(s_etat_processus)) == NULL)
! 220: {
! 221: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 222: return;
! 223: }
! 224:
! 225: l_element_courant = (*s_objet_position).objet;
! 226: (*l_element_courant).suivant = NULL;
! 227:
! 228: if (((*l_element_courant).donnee = allocation(s_etat_processus,
! 229: INT)) == NULL)
! 230: {
! 231: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 232: return;
! 233: }
! 234:
! 235: (*((integer8 *) (*(*l_element_courant).donnee).objet)) =
! 236: position_max_i + 1;
! 237: }
! 238:
! 239: /*
! 240: * Vecteur de complexes
! 241: */
! 242:
! 243: else
! 244: {
! 245: f77absc_(&(((struct_complexe16 *) (*((struct_vecteur *)
! 246: (*s_objet_argument_1).objet)).tableau)[0]), &max_reel);
! 247:
! 248: position_max_i = 0;
! 249:
! 250: for(i = 1; i < (*((struct_vecteur *) (*s_objet_argument_1).objet))
! 251: .taille; i++)
! 252: {
! 253: f77absc_(&(((struct_complexe16 *) (*((struct_vecteur *)
! 254: (*s_objet_argument_1).objet)).tableau)[i]), &module);
! 255:
! 256: if (module > max_reel)
! 257: {
! 258: max_reel = module;
! 259: position_max_i = i;
! 260: }
! 261: }
! 262:
! 263: if ((s_objet_resultat = allocation(s_etat_processus, CPL))
! 264: == NULL)
! 265: {
! 266: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 267: return;
! 268: }
! 269:
! 270: (*((struct_complexe16 *) (*s_objet_resultat).objet))
! 271: .partie_reelle = ((struct_complexe16 *)
! 272: (*((struct_vecteur *) (*s_objet_argument_1).objet))
! 273: .tableau)[position_max_i].partie_reelle;
! 274: (*((struct_complexe16 *) (*s_objet_resultat).objet))
! 275: .partie_imaginaire = ((struct_complexe16 *)
! 276: (*((struct_vecteur *) (*s_objet_argument_1).objet))
! 277: .tableau)[position_max_i].partie_imaginaire;
! 278:
! 279: if (((*s_objet_position).objet =
! 280: allocation_maillon(s_etat_processus)) == NULL)
! 281: {
! 282: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 283: return;
! 284: }
! 285:
! 286: l_element_courant = (*s_objet_position).objet;
! 287: (*l_element_courant).suivant = NULL;
! 288:
! 289: if (((*l_element_courant).donnee = allocation(s_etat_processus,
! 290: INT)) == NULL)
! 291: {
! 292: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 293: return;
! 294: }
! 295:
! 296: (*((integer8 *) (*(*l_element_courant).donnee).objet)) =
! 297: position_max_i + 1;
! 298: }
! 299:
! 300: liberation(s_etat_processus, s_objet_argument_1);
! 301:
! 302: if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 303: s_objet_resultat) == d_erreur)
! 304: {
! 305: return;
! 306: }
! 307:
! 308: if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 309: s_objet_position) == d_erreur)
! 310: {
! 311: return;
! 312: }
! 313: }
! 314: else if (((*(*(*s_etat_processus).l_base_pile).donnee).type ==
! 315: MIN) || ((*(*(*s_etat_processus).l_base_pile)
! 316: .donnee).type == MRL) || ((*(*(*s_etat_processus)
! 317: .l_base_pile).donnee).type == MCX))
! 318: {
! 319: if (test_cfsf(s_etat_processus, 31) == d_vrai)
! 320: {
! 321: if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
! 322: {
! 323: return;
! 324: }
! 325: }
! 326:
! 327: if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 328: &s_objet_argument_1) == d_erreur)
! 329: {
! 330: (*s_etat_processus).erreur_execution = d_ex_manque_argument;
! 331: return;
! 332: }
! 333:
! 334: if ((s_objet_position = allocation(s_etat_processus, LST)) == NULL)
! 335: {
! 336: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 337: return;
! 338: }
! 339:
! 340: /*
! 341: * Matrice d'entiers
! 342: */
! 343:
! 344: if ((*s_objet_argument_1).type == MIN)
! 345: {
! 346: max_entier = ((integer8 **) (*((struct_matrice *)
! 347: (*s_objet_argument_1).objet)).tableau)[0][0];
! 348: position_max_i = 0;
! 349: position_max_j = 0;
! 350:
! 351: for(i = 0; i < (*((struct_matrice *) (*s_objet_argument_1).objet))
! 352: .nombre_lignes; i++)
! 353: {
! 354: for(j = 0; j < (*((struct_matrice *) (*s_objet_argument_1)
! 355: .objet)).nombre_colonnes; j++)
! 356: {
! 357: if (((integer8 **) (*((struct_matrice *)
! 358: (*s_objet_argument_1).objet)).tableau)[i][j] >
! 359: max_entier)
! 360: {
! 361: max_entier = ((integer8 **) (*((struct_matrice *)
! 362: (*s_objet_argument_1).objet)).tableau)[i][j];
! 363: position_max_i = i;
! 364: position_max_j = j;
! 365: }
! 366: }
! 367: }
! 368:
! 369: if ((s_objet_resultat = allocation(s_etat_processus, INT))
! 370: == NULL)
! 371: {
! 372: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 373: return;
! 374: }
! 375:
! 376: (*((integer8 *) (*s_objet_resultat).objet)) = max_entier;
! 377:
! 378: if (((*s_objet_position).objet =
! 379: allocation_maillon(s_etat_processus)) == NULL)
! 380: {
! 381: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 382: return;
! 383: }
! 384:
! 385: l_element_courant = (*s_objet_position).objet;
! 386:
! 387: if (((*l_element_courant).donnee = allocation(s_etat_processus,
! 388: INT)) == NULL)
! 389: {
! 390: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 391: return;
! 392: }
! 393:
! 394: (*((integer8 *) (*(*l_element_courant).donnee).objet)) =
! 395: position_max_i + 1;
! 396:
! 397: if (((*l_element_courant).suivant =
! 398: allocation_maillon(s_etat_processus)) == NULL)
! 399: {
! 400: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 401: return;
! 402: }
! 403:
! 404: l_element_courant = (*l_element_courant).suivant;
! 405: (*l_element_courant).suivant = NULL;
! 406:
! 407: if (((*l_element_courant).donnee = allocation(s_etat_processus,
! 408: INT)) == NULL)
! 409: {
! 410: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 411: return;
! 412: }
! 413:
! 414: (*((integer8 *) (*(*l_element_courant).donnee).objet)) =
! 415: position_max_j + 1;
! 416: }
! 417:
! 418: /*
! 419: * Matrice de réels
! 420: */
! 421:
! 422: else if ((*s_objet_argument_1).type == MRL)
! 423: {
! 424: max_reel = ((real8 **) (*((struct_matrice *)
! 425: (*s_objet_argument_1).objet)).tableau)[0][0];
! 426: position_max_i = 0;
! 427: position_max_j = 0;
! 428:
! 429: for(i = 0; i < (*((struct_matrice *) (*s_objet_argument_1).objet))
! 430: .nombre_lignes; i++)
! 431: {
! 432: for(j = 0; j < (*((struct_matrice *) (*s_objet_argument_1)
! 433: .objet)).nombre_colonnes; j++)
! 434: {
! 435: if (((real8 **) (*((struct_matrice *)
! 436: (*s_objet_argument_1).objet)).tableau)[i][j] >
! 437: max_reel)
! 438: {
! 439: max_reel = ((real8 **) (*((struct_matrice *)
! 440: (*s_objet_argument_1).objet)).tableau)[i][j];
! 441: position_max_i = i;
! 442: position_max_j = j;
! 443: }
! 444: }
! 445: }
! 446:
! 447: if ((s_objet_resultat = allocation(s_etat_processus, REL))
! 448: == NULL)
! 449: {
! 450: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 451: return;
! 452: }
! 453:
! 454: (*((real8 *) (*s_objet_resultat).objet)) = max_reel;
! 455:
! 456: if (((*s_objet_position).objet =
! 457: allocation_maillon(s_etat_processus)) == NULL)
! 458: {
! 459: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 460: return;
! 461: }
! 462:
! 463: l_element_courant = (*s_objet_position).objet;
! 464:
! 465: if (((*l_element_courant).donnee = allocation(s_etat_processus,
! 466: INT)) == NULL)
! 467: {
! 468: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 469: return;
! 470: }
! 471:
! 472: (*((integer8 *) (*(*l_element_courant).donnee).objet)) =
! 473: position_max_i + 1;
! 474:
! 475: if (((*l_element_courant).suivant =
! 476: allocation_maillon(s_etat_processus)) == NULL)
! 477: {
! 478: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 479: return;
! 480: }
! 481:
! 482: l_element_courant = (*l_element_courant).suivant;
! 483: (*l_element_courant).suivant = NULL;
! 484:
! 485: if (((*l_element_courant).donnee = allocation(s_etat_processus,
! 486: INT)) == NULL)
! 487: {
! 488: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 489: return;
! 490: }
! 491:
! 492: (*((integer8 *) (*(*l_element_courant).donnee).objet)) =
! 493: position_max_j + 1;
! 494: }
! 495:
! 496: /*
! 497: * Matrice de complexes
! 498: */
! 499:
! 500: else
! 501: {
! 502: f77absc_(&(((struct_complexe16 **) (*((struct_matrice *)
! 503: (*s_objet_argument_1).objet)).tableau)[0][0]), &max_reel);
! 504:
! 505: position_max_i = 0;
! 506: position_max_j = 0;
! 507:
! 508: for(i = 0; i < (*((struct_matrice *) (*s_objet_argument_1).objet))
! 509: .nombre_lignes; i++)
! 510: {
! 511: for(j = 0; j < (*((struct_matrice *) (*s_objet_argument_1)
! 512: .objet)).nombre_colonnes; j++)
! 513: {
! 514:
! 515: f77absc_(&(((struct_complexe16 **) (*((struct_matrice *)
! 516: (*s_objet_argument_1).objet)).tableau)[i][j]),
! 517: &module);
! 518:
! 519: if (module > max_reel)
! 520: {
! 521: max_reel = module;
! 522: position_max_i = i;
! 523: position_max_j = j;
! 524: }
! 525: }
! 526: }
! 527:
! 528: if ((s_objet_resultat = allocation(s_etat_processus, CPL))
! 529: == NULL)
! 530: {
! 531: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 532: return;
! 533: }
! 534:
! 535: (*((struct_complexe16 *) (*s_objet_resultat).objet))
! 536: .partie_reelle = ((struct_complexe16 **)
! 537: (*((struct_matrice *) (*s_objet_argument_1).objet))
! 538: .tableau)[position_max_i][position_max_j].partie_reelle;
! 539: (*((struct_complexe16 *) (*s_objet_resultat).objet))
! 540: .partie_imaginaire = ((struct_complexe16 **)
! 541: (*((struct_matrice *) (*s_objet_argument_1).objet))
! 542: .tableau)[position_max_i][position_max_j].partie_imaginaire;
! 543:
! 544: if (((*s_objet_position).objet =
! 545: allocation_maillon(s_etat_processus)) == NULL)
! 546: {
! 547: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 548: return;
! 549: }
! 550:
! 551: l_element_courant = (*s_objet_position).objet;
! 552:
! 553: if (((*l_element_courant).donnee = allocation(s_etat_processus,
! 554: INT)) == NULL)
! 555: {
! 556: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 557: return;
! 558: }
! 559:
! 560: (*((integer8 *) (*(*l_element_courant).donnee).objet)) =
! 561: position_max_i + 1;
! 562:
! 563: if (((*l_element_courant).suivant =
! 564: allocation_maillon(s_etat_processus)) == NULL)
! 565: {
! 566: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 567: return;
! 568: }
! 569:
! 570: l_element_courant = (*l_element_courant).suivant;
! 571: (*l_element_courant).suivant = NULL;
! 572:
! 573: if (((*l_element_courant).donnee = allocation(s_etat_processus,
! 574: INT)) == NULL)
! 575: {
! 576: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 577: return;
! 578: }
! 579:
! 580: (*((integer8 *) (*(*l_element_courant).donnee).objet)) =
! 581: position_max_j + 1;
! 582: }
! 583:
! 584: liberation(s_etat_processus, s_objet_argument_1);
! 585:
! 586: if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 587: s_objet_resultat) == d_erreur)
! 588: {
! 589: return;
! 590: }
! 591:
! 592: if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 593: s_objet_position) == d_erreur)
! 594: {
! 595: return;
! 596: }
! 597: }
! 598:
! 599: /*
! 600: --------------------------------------------------------------------------------
! 601: MAX portant sur autre chose (deux arguments)
! 602: --------------------------------------------------------------------------------
! 603: */
! 604:
! 605: else
! 606: {
! 607: if (test_cfsf(s_etat_processus, 31) == d_vrai)
! 608: {
! 609: if (empilement_pile_last(s_etat_processus, 2) == d_erreur)
! 610: {
! 611: return;
! 612: }
! 613: }
! 614:
! 615: if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 616: &s_objet_argument_1) == d_erreur)
! 617: {
! 618: (*s_etat_processus).erreur_execution = d_ex_manque_argument;
! 619: return;
! 620: }
! 621:
! 622: if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 623: &s_objet_argument_2) == d_erreur)
! 624: {
! 625: liberation(s_etat_processus, s_objet_argument_1);
! 626:
! 627: (*s_etat_processus).erreur_execution = d_ex_manque_argument;
! 628: return;
! 629: }
! 630:
! 631: /*
! 632: --------------------------------------------------------------------------------
! 633: MAX portant sur des valeurs numériques
! 634: --------------------------------------------------------------------------------
! 635: */
! 636:
! 637: if ((((*s_objet_argument_1).type == INT) ||
! 638: ((*s_objet_argument_1).type == REL)) &&
! 639: (((*s_objet_argument_2).type == INT) ||
! 640: ((*s_objet_argument_2).type == REL)))
! 641: {
! 642: if ((*s_objet_argument_1).type == INT)
! 643: {
! 644: if ((*s_objet_argument_2).type == INT)
! 645: {
! 646: if ((*((integer8 *) (*s_objet_argument_1).objet)) >=
! 647: (*((integer8 *) (*s_objet_argument_2).objet)))
! 648: {
! 649: s_objet_resultat = s_objet_argument_1;
! 650: s_objet_argument_1 = NULL;
! 651: }
! 652: else
! 653: {
! 654: s_objet_resultat = s_objet_argument_2;
! 655: s_objet_argument_2 = NULL;
! 656: }
! 657: }
! 658: else
! 659: {
! 660: if ((*((integer8 *) (*s_objet_argument_1).objet)) >=
! 661: (*((real8 *) (*s_objet_argument_2).objet)))
! 662: {
! 663: s_objet_resultat = s_objet_argument_1;
! 664: s_objet_argument_1 = NULL;
! 665: }
! 666: else
! 667: {
! 668: s_objet_resultat = s_objet_argument_2;
! 669: s_objet_argument_2 = NULL;
! 670: }
! 671: }
! 672: }
! 673: else
! 674: {
! 675: if ((*s_objet_argument_2).type == INT)
! 676: {
! 677: if ((*((real8 *) (*s_objet_argument_1).objet)) >=
! 678: (*((integer8 *) (*s_objet_argument_2).objet)))
! 679: {
! 680: s_objet_resultat = s_objet_argument_1;
! 681: s_objet_argument_1 = NULL;
! 682: }
! 683: else
! 684: {
! 685: s_objet_resultat = s_objet_argument_2;
! 686: s_objet_argument_2 = NULL;
! 687: }
! 688: }
! 689: else
! 690: {
! 691: if ((*((real8 *) (*s_objet_argument_1).objet)) >=
! 692: (*((real8 *) (*s_objet_argument_2).objet)))
! 693: {
! 694: s_objet_resultat = s_objet_argument_1;
! 695: s_objet_argument_1 = NULL;
! 696: }
! 697: else
! 698: {
! 699: s_objet_resultat = s_objet_argument_2;
! 700: s_objet_argument_2 = NULL;
! 701: }
! 702: }
! 703: }
! 704: }
! 705:
! 706: /*
! 707: --------------------------------------------------------------------------------
! 708: MAX entre des arguments complexes
! 709: --------------------------------------------------------------------------------
! 710: */
! 711:
! 712: /*
! 713: * Nom ou valeur numérique / Nom ou valeur numérique
! 714: */
! 715:
! 716: else if ((((*s_objet_argument_1).type == NOM) &&
! 717: (((*s_objet_argument_2).type == NOM) ||
! 718: ((*s_objet_argument_2).type == INT) ||
! 719: ((*s_objet_argument_2).type == REL))) ||
! 720: (((*s_objet_argument_2).type == NOM) &&
! 721: (((*s_objet_argument_1).type == INT) ||
! 722: ((*s_objet_argument_1).type == REL))))
! 723: {
! 724: if ((s_objet_resultat = allocation(s_etat_processus, ALG))
! 725: == NULL)
! 726: {
! 727: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 728: return;
! 729: }
! 730:
! 731: if (((*s_objet_resultat).objet =
! 732: allocation_maillon(s_etat_processus)) == NULL)
! 733: {
! 734: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 735: return;
! 736: }
! 737:
! 738: l_element_courant = (*s_objet_resultat).objet;
! 739:
! 740: if (((*l_element_courant).donnee = allocation(s_etat_processus,
! 741: FCT)) == NULL)
! 742: {
! 743: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 744: return;
! 745: }
! 746:
! 747: (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 748: .nombre_arguments = 0;
! 749: (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 750: .fonction = instruction_vers_niveau_superieur;
! 751:
! 752: if (((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 753: .nom_fonction = malloc(3 * sizeof(unsigned char))) == NULL)
! 754: {
! 755: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 756: return;
! 757: }
! 758:
! 759: strcpy((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 760: .nom_fonction, "<<");
! 761:
! 762: if (((*l_element_courant).suivant =
! 763: allocation_maillon(s_etat_processus)) == NULL)
! 764: {
! 765: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 766: return;
! 767: }
! 768:
! 769: l_element_courant = (*l_element_courant).suivant;
! 770: (*l_element_courant).donnee = s_objet_argument_2;
! 771:
! 772: if (((*l_element_courant).suivant =
! 773: allocation_maillon(s_etat_processus)) == NULL)
! 774: {
! 775: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 776: return;
! 777: }
! 778:
! 779: l_element_courant = (*l_element_courant).suivant;
! 780: (*l_element_courant).donnee = s_objet_argument_1;
! 781:
! 782: if (((*l_element_courant).suivant =
! 783: allocation_maillon(s_etat_processus)) == NULL)
! 784: {
! 785: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 786: return;
! 787: }
! 788:
! 789: l_element_courant = (*l_element_courant).suivant;
! 790:
! 791: if (((*l_element_courant).donnee = allocation(s_etat_processus,
! 792: FCT)) == NULL)
! 793: {
! 794: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 795: return;
! 796: }
! 797:
! 798: (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 799: .nombre_arguments = 2;
! 800: (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 801: .fonction = instruction_max;
! 802:
! 803: if (((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 804: .nom_fonction = malloc(4 * sizeof(unsigned char))) == NULL)
! 805: {
! 806: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 807: return;
! 808: }
! 809:
! 810: strcpy((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 811: .nom_fonction, "MAX");
! 812:
! 813: if (((*l_element_courant).suivant =
! 814: allocation_maillon(s_etat_processus)) == NULL)
! 815: {
! 816: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 817: return;
! 818: }
! 819:
! 820: l_element_courant = (*l_element_courant).suivant;
! 821:
! 822: if (((*l_element_courant).donnee = allocation(s_etat_processus,
! 823: FCT)) == NULL)
! 824: {
! 825: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 826: return;
! 827: }
! 828:
! 829: (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 830: .nombre_arguments = 0;
! 831: (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 832: .fonction = instruction_vers_niveau_inferieur;
! 833:
! 834: if (((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 835: .nom_fonction = malloc(3 * sizeof(unsigned char))) == NULL)
! 836: {
! 837: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 838: return;
! 839: }
! 840:
! 841: strcpy((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 842: .nom_fonction, ">>");
! 843:
! 844: (*l_element_courant).suivant = NULL;
! 845:
! 846: s_objet_argument_1 = NULL;
! 847: s_objet_argument_2 = NULL;
! 848: }
! 849:
! 850: /*
! 851: * Nom ou valeur numérique / Expression
! 852: */
! 853:
! 854: else if (((((*s_objet_argument_1).type == ALG) ||
! 855: ((*s_objet_argument_1).type == RPN))) &&
! 856: (((*s_objet_argument_2).type == NOM) ||
! 857: ((*s_objet_argument_2).type == INT) ||
! 858: ((*s_objet_argument_2).type == REL)))
! 859: {
! 860: nombre_elements = 0;
! 861: l_element_courant = (struct_liste_chainee *)
! 862: (*s_objet_argument_1).objet;
! 863:
! 864: while(l_element_courant != NULL)
! 865: {
! 866: nombre_elements++;
! 867: l_element_courant = (*l_element_courant).suivant;
! 868: }
! 869:
! 870: if (nombre_elements == 2)
! 871: {
! 872: liberation(s_etat_processus, s_objet_argument_1);
! 873: liberation(s_etat_processus, s_objet_argument_2);
! 874:
! 875: (*s_etat_processus).erreur_execution = d_ex_argument_invalide;
! 876: return;
! 877: }
! 878:
! 879: if ((s_objet_resultat = copie_objet(s_etat_processus,
! 880: s_objet_argument_1, 'N')) == NULL)
! 881: {
! 882: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 883: return;
! 884: }
! 885:
! 886: l_element_courant = (struct_liste_chainee *)
! 887: (*s_objet_resultat).objet;
! 888: l_element_precedent = l_element_courant;
! 889: l_element_courant = (*l_element_courant).suivant;
! 890:
! 891: if (((*l_element_precedent).suivant =
! 892: allocation_maillon(s_etat_processus)) == NULL)
! 893: {
! 894: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 895: return;
! 896: }
! 897:
! 898: (*(*l_element_precedent).suivant).donnee = s_objet_argument_2;
! 899: (*(*l_element_precedent).suivant).suivant = l_element_courant;
! 900:
! 901: while((*l_element_courant).suivant != NULL)
! 902: {
! 903: l_element_precedent = l_element_courant;
! 904: l_element_courant = (*l_element_courant).suivant;
! 905: }
! 906:
! 907: if (((*l_element_precedent).suivant =
! 908: allocation_maillon(s_etat_processus)) == NULL)
! 909: {
! 910: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 911: return;
! 912: }
! 913:
! 914: if (((*(*l_element_precedent).suivant).donnee =
! 915: allocation(s_etat_processus, FCT)) == NULL)
! 916: {
! 917: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 918: return;
! 919: }
! 920:
! 921: (*((struct_fonction *) (*(*(*l_element_precedent).suivant)
! 922: .donnee).objet)).nombre_arguments = 2;
! 923: (*((struct_fonction *) (*(*(*l_element_precedent).suivant)
! 924: .donnee).objet)).fonction = instruction_max;
! 925:
! 926: if (((*((struct_fonction *) (*(*(*l_element_precedent)
! 927: .suivant).donnee).objet)).nom_fonction =
! 928: malloc(4 * sizeof(unsigned char))) == NULL)
! 929: {
! 930: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 931: return;
! 932: }
! 933:
! 934: strcpy((*((struct_fonction *) (*(*(*l_element_precedent)
! 935: .suivant).donnee).objet)).nom_fonction, "MAX");
! 936:
! 937: (*(*l_element_precedent).suivant).suivant = l_element_courant;
! 938:
! 939: s_objet_argument_2 = NULL;
! 940: }
! 941:
! 942: /*
! 943: * Expression / Nom ou valeur numérique
! 944: */
! 945:
! 946: else if ((((*s_objet_argument_1).type == NOM) ||
! 947: ((*s_objet_argument_1).type == INT) ||
! 948: ((*s_objet_argument_1).type == REL)) &&
! 949: ((((*s_objet_argument_2).type == ALG) ||
! 950: ((*s_objet_argument_2).type == RPN))))
! 951: {
! 952: nombre_elements = 0;
! 953: l_element_courant = (struct_liste_chainee *)
! 954: (*s_objet_argument_2).objet;
! 955:
! 956: while(l_element_courant != NULL)
! 957: {
! 958: nombre_elements++;
! 959: l_element_courant = (*l_element_courant).suivant;
! 960: }
! 961:
! 962: if (nombre_elements == 2)
! 963: {
! 964: liberation(s_etat_processus, s_objet_argument_1);
! 965: liberation(s_etat_processus, s_objet_argument_2);
! 966:
! 967: (*s_etat_processus).erreur_execution = d_ex_argument_invalide;
! 968: return;
! 969: }
! 970:
! 971: if ((s_objet_resultat = copie_objet(s_etat_processus,
! 972: s_objet_argument_2, 'N')) == NULL)
! 973: {
! 974: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 975: return;
! 976: }
! 977:
! 978: l_element_courant = (struct_liste_chainee *)
! 979: (*s_objet_resultat).objet;
! 980: l_element_precedent = l_element_courant;
! 981:
! 982: while((*l_element_courant).suivant != NULL)
! 983: {
! 984: l_element_precedent = l_element_courant;
! 985: l_element_courant = (*l_element_courant).suivant;
! 986: }
! 987:
! 988: if (((*l_element_precedent).suivant =
! 989: allocation_maillon(s_etat_processus)) == NULL)
! 990: {
! 991: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 992: return;
! 993: }
! 994:
! 995: (*(*l_element_precedent).suivant).donnee = s_objet_argument_1;
! 996: l_element_precedent = (*l_element_precedent).suivant;
! 997:
! 998: if (((*l_element_precedent).suivant =
! 999: allocation_maillon(s_etat_processus)) == NULL)
! 1000: {
! 1001: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1002: return;
! 1003: }
! 1004:
! 1005: if (((*(*l_element_precedent).suivant).donnee =
! 1006: allocation(s_etat_processus, FCT)) == NULL)
! 1007: {
! 1008: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1009: return;
! 1010: }
! 1011:
! 1012: (*((struct_fonction *) (*(*(*l_element_precedent).suivant)
! 1013: .donnee).objet)).nombre_arguments = 2;
! 1014: (*((struct_fonction *) (*(*(*l_element_precedent).suivant)
! 1015: .donnee).objet)).fonction = instruction_max;
! 1016:
! 1017: if (((*((struct_fonction *) (*(*(*l_element_precedent)
! 1018: .suivant).donnee).objet)).nom_fonction =
! 1019: malloc(4 * sizeof(unsigned char))) == NULL)
! 1020: {
! 1021: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1022: return;
! 1023: }
! 1024:
! 1025: strcpy((*((struct_fonction *) (*(*(*l_element_precedent)
! 1026: .suivant).donnee).objet)).nom_fonction, "MAX");
! 1027:
! 1028: (*(*l_element_precedent).suivant).suivant = l_element_courant;
! 1029:
! 1030: s_objet_argument_1 = NULL;
! 1031: }
! 1032:
! 1033: /*
! 1034: * Expression / Expression
! 1035: */
! 1036:
! 1037: else if ((((*s_objet_argument_1).type == ALG) &&
! 1038: ((*s_objet_argument_2).type == ALG)) ||
! 1039: (((*s_objet_argument_1).type == RPN) &&
! 1040: ((*s_objet_argument_2).type == RPN)))
! 1041: {
! 1042: nombre_elements = 0;
! 1043: l_element_courant = (struct_liste_chainee *)
! 1044: (*s_objet_argument_1).objet;
! 1045:
! 1046: while(l_element_courant != NULL)
! 1047: {
! 1048: nombre_elements++;
! 1049: l_element_courant = (*l_element_courant).suivant;
! 1050: }
! 1051:
! 1052: if (nombre_elements == 2)
! 1053: {
! 1054: liberation(s_etat_processus, s_objet_argument_1);
! 1055: liberation(s_etat_processus, s_objet_argument_2);
! 1056:
! 1057: (*s_etat_processus).erreur_execution = d_ex_argument_invalide;
! 1058: return;
! 1059: }
! 1060:
! 1061: nombre_elements = 0;
! 1062: l_element_courant = (struct_liste_chainee *)
! 1063: (*s_objet_argument_2).objet;
! 1064:
! 1065: while(l_element_courant != NULL)
! 1066: {
! 1067: nombre_elements++;
! 1068: l_element_courant = (*l_element_courant).suivant;
! 1069: }
! 1070:
! 1071: if (nombre_elements == 2)
! 1072: {
! 1073: liberation(s_etat_processus, s_objet_argument_1);
! 1074: liberation(s_etat_processus, s_objet_argument_2);
! 1075:
! 1076: (*s_etat_processus).erreur_execution = d_ex_argument_invalide;
! 1077: return;
! 1078: }
! 1079:
! 1080: if ((s_copie_argument_1 = copie_objet(s_etat_processus,
! 1081: s_objet_argument_1, 'N')) == NULL)
! 1082: {
! 1083: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1084: return;
! 1085: }
! 1086:
! 1087: if ((s_copie_argument_2 = copie_objet(s_etat_processus,
! 1088: s_objet_argument_2, 'N')) == NULL)
! 1089: {
! 1090: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1091: return;
! 1092: }
! 1093:
! 1094: l_element_courant = (struct_liste_chainee *)
! 1095: (*s_copie_argument_1).objet;
! 1096: (*s_copie_argument_1).objet = (void *) (*((struct_liste_chainee *)
! 1097: (*s_copie_argument_1).objet)).suivant;
! 1098:
! 1099: liberation(s_etat_processus, (*l_element_courant).donnee);
! 1100: free(l_element_courant);
! 1101:
! 1102: l_element_courant = (struct_liste_chainee *)
! 1103: (*s_copie_argument_2).objet;
! 1104: l_element_precedent = l_element_courant;
! 1105: s_objet_resultat = s_copie_argument_2;
! 1106:
! 1107: while((*l_element_courant).suivant != NULL)
! 1108: {
! 1109: l_element_precedent = l_element_courant;
! 1110: l_element_courant = (*l_element_courant).suivant;
! 1111: }
! 1112:
! 1113: liberation(s_etat_processus, (*l_element_courant).donnee);
! 1114: free(l_element_courant);
! 1115:
! 1116: (*l_element_precedent).suivant = (struct_liste_chainee *)
! 1117: (*s_copie_argument_1).objet;
! 1118: free(s_copie_argument_1);
! 1119:
! 1120: l_element_courant = (*l_element_precedent).suivant;
! 1121: while((*l_element_courant).suivant != NULL)
! 1122: {
! 1123: l_element_precedent = l_element_courant;
! 1124: l_element_courant = (*l_element_courant).suivant;
! 1125: }
! 1126:
! 1127: if (((*l_element_precedent).suivant =
! 1128: allocation_maillon(s_etat_processus)) == NULL)
! 1129: {
! 1130: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1131: return;
! 1132: }
! 1133:
! 1134: (*(*l_element_precedent).suivant).suivant = l_element_courant;
! 1135: l_element_courant = (*l_element_precedent).suivant;
! 1136:
! 1137: if (((*l_element_courant).donnee = allocation(s_etat_processus,
! 1138: FCT)) == NULL)
! 1139: {
! 1140: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1141: return;
! 1142: }
! 1143:
! 1144: (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 1145: .nombre_arguments = 2;
! 1146: (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 1147: .fonction = instruction_max;
! 1148:
! 1149: if (((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 1150: .nom_fonction = malloc(4 * sizeof(unsigned char))) == NULL)
! 1151: {
! 1152: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1153: return;
! 1154: }
! 1155:
! 1156: strcpy((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 1157: .nom_fonction, "MAX");
! 1158: }
! 1159:
! 1160: /*
! 1161: --------------------------------------------------------------------------------
! 1162: Arguments incorrects
! 1163: --------------------------------------------------------------------------------
! 1164: */
! 1165:
! 1166: else
! 1167: {
! 1168: liberation(s_etat_processus, s_objet_argument_1);
! 1169: liberation(s_etat_processus, s_objet_argument_2);
! 1170:
! 1171: (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
! 1172: return;
! 1173: }
! 1174:
! 1175: if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 1176: s_objet_resultat) == d_erreur)
! 1177: {
! 1178: return;
! 1179: }
! 1180:
! 1181: liberation(s_etat_processus, s_objet_argument_1);
! 1182: liberation(s_etat_processus, s_objet_argument_2);
! 1183: }
! 1184:
! 1185: return;
! 1186: }
! 1187:
! 1188:
! 1189: /*
! 1190: ================================================================================
! 1191: Fonction 'min'
! 1192: ================================================================================
! 1193: Entrées :
! 1194: --------------------------------------------------------------------------------
! 1195: Sorties :
! 1196: --------------------------------------------------------------------------------
! 1197: Effets de bord : néant
! 1198: ================================================================================
! 1199: */
! 1200:
! 1201: void
! 1202: instruction_min(struct_processus *s_etat_processus)
! 1203: {
! 1204: real8 min_reel;
! 1205: real8 module;
! 1206:
! 1207: integer8 min_entier;
! 1208:
! 1209: struct_liste_chainee *l_element_courant;
! 1210: struct_liste_chainee *l_element_precedent;
! 1211:
! 1212: struct_objet *s_copie_argument_1;
! 1213: struct_objet *s_copie_argument_2;
! 1214: struct_objet *s_objet_argument_1;
! 1215: struct_objet *s_objet_argument_2;
! 1216: struct_objet *s_objet_position;
! 1217: struct_objet *s_objet_resultat;
! 1218:
! 1219: unsigned long i;
! 1220: unsigned long j;
! 1221: unsigned long nombre_elements;
! 1222: unsigned long position_min_i;
! 1223: unsigned long position_min_j;
! 1224:
! 1225: (*s_etat_processus).erreur_execution = d_ex;
! 1226:
! 1227: if ((*s_etat_processus).affichage_arguments == 'Y')
! 1228: {
! 1229: printf("\n MIN ");
! 1230:
! 1231: if ((*s_etat_processus).langue == 'F')
! 1232: {
! 1233: printf("(minimum)\n\n");
! 1234: }
! 1235: else
! 1236: {
! 1237: printf("(minimum)\n\n");
! 1238: }
! 1239:
! 1240: printf(" 1: %s, %s, %s\n", d_VIN, d_VRL, d_VCX);
! 1241: printf("-> 2: %s, %s, %s\n", d_INT, d_REL, d_CPL);
! 1242: printf(" 1: %s\n\n", d_LST);
! 1243:
! 1244: printf(" 1: %s, %s, %s\n", d_MIN, d_MRL, d_MCX);
! 1245: printf("-> 2: %s, %s, %s\n", d_INT, d_REL, d_CPL);
! 1246: printf(" 1: %s\n\n", d_LST);
! 1247:
! 1248: printf(" 2: %s, %s, %s\n", d_INT, d_REL, d_CPL);
! 1249: printf(" 1: %s, %s, %s\n", d_INT, d_REL, d_CPL);
! 1250: printf("-> 1: %s, %s, %s\n\n", d_INT, d_REL, d_CPL);
! 1251:
! 1252: printf(" 2: %s, %s, %s, %s, %s, %s\n",
! 1253: d_INT, d_REL, d_CPL, d_NOM, d_ALG, d_RPN);
! 1254: printf(" 1: %s, %s, %s, %s, %s, %s\n",
! 1255: d_INT, d_REL, d_CPL, d_NOM, d_ALG, d_RPN);
! 1256: printf("-> 1: %s, %s\n", d_ALG, d_RPN);
! 1257:
! 1258: return;
! 1259: }
! 1260: else if ((*s_etat_processus).test_instruction == 'Y')
! 1261: {
! 1262: (*s_etat_processus).nombre_arguments = 2;
! 1263: return;
! 1264: }
! 1265:
! 1266: /*
! 1267: --------------------------------------------------------------------------------
! 1268: MIN portant sur un tableau (un seul argument)
! 1269: --------------------------------------------------------------------------------
! 1270: */
! 1271:
! 1272: if (((*(*(*s_etat_processus).l_base_pile).donnee).type == VIN)
! 1273: || ((*(*(*s_etat_processus).l_base_pile).donnee).type ==
! 1274: VRL) || ((*(*(*s_etat_processus).l_base_pile)
! 1275: .donnee).type == VCX))
! 1276: {
! 1277: if (test_cfsf(s_etat_processus, 31) == d_vrai)
! 1278: {
! 1279: if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
! 1280: {
! 1281: return;
! 1282: }
! 1283: }
! 1284:
! 1285: if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 1286: &s_objet_argument_1) == d_erreur)
! 1287: {
! 1288: (*s_etat_processus).erreur_execution = d_ex_manque_argument;
! 1289: return;
! 1290: }
! 1291:
! 1292: if ((s_objet_position = allocation(s_etat_processus, LST)) == NULL)
! 1293: {
! 1294: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1295: return;
! 1296: }
! 1297:
! 1298: /*
! 1299: * Vecteur d'entiers
! 1300: */
! 1301:
! 1302: if ((*s_objet_argument_1).type == VIN)
! 1303: {
! 1304: min_entier = ((integer8 *) (*((struct_vecteur *)
! 1305: (*s_objet_argument_1).objet)).tableau)[0];
! 1306: position_min_i = 0;
! 1307:
! 1308: for(i = 1; i < (*((struct_vecteur *) (*s_objet_argument_1).objet))
! 1309: .taille; i++)
! 1310: {
! 1311: if (((integer8 *) (*((struct_vecteur *) (*s_objet_argument_1)
! 1312: .objet)).tableau)[i] < min_entier)
! 1313: {
! 1314: min_entier = ((integer8 *) (*((struct_vecteur *)
! 1315: (*s_objet_argument_1).objet)).tableau)[i];
! 1316: position_min_i = i;
! 1317: }
! 1318: }
! 1319:
! 1320: if ((s_objet_resultat = allocation(s_etat_processus, INT))
! 1321: == NULL)
! 1322: {
! 1323: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1324: return;
! 1325: }
! 1326:
! 1327: (*((integer8 *) (*s_objet_resultat).objet)) = min_entier;
! 1328:
! 1329: if (((*s_objet_position).objet =
! 1330: allocation_maillon(s_etat_processus)) == NULL)
! 1331: {
! 1332: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1333: return;
! 1334: }
! 1335:
! 1336: l_element_courant = (*s_objet_position).objet;
! 1337: (*l_element_courant).suivant = NULL;
! 1338:
! 1339: if (((*l_element_courant).donnee = allocation(s_etat_processus,
! 1340: INT)) == NULL)
! 1341: {
! 1342: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1343: return;
! 1344: }
! 1345:
! 1346: (*((integer8 *) (*(*l_element_courant).donnee).objet)) =
! 1347: position_min_i + 1;
! 1348: }
! 1349:
! 1350: /*
! 1351: * Vecteur de réels
! 1352: */
! 1353:
! 1354: else if ((*s_objet_argument_1).type == VRL)
! 1355: {
! 1356: min_reel = ((real8 *) (*((struct_vecteur *)
! 1357: (*s_objet_argument_1).objet)).tableau)[0];
! 1358: position_min_i = 0;
! 1359:
! 1360: for(i = 1; i < (*((struct_vecteur *) (*s_objet_argument_1).objet))
! 1361: .taille; i++)
! 1362: {
! 1363: if (((real8 *) (*((struct_vecteur *) (*s_objet_argument_1)
! 1364: .objet)).tableau)[i] < min_reel)
! 1365: {
! 1366: min_reel = ((real8 *) (*((struct_vecteur *)
! 1367: (*s_objet_argument_1).objet)).tableau)[i];
! 1368: position_min_i = i;
! 1369: }
! 1370: }
! 1371:
! 1372: if ((s_objet_resultat = allocation(s_etat_processus, REL))
! 1373: == NULL)
! 1374: {
! 1375: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1376: return;
! 1377: }
! 1378:
! 1379: (*((real8 *) (*s_objet_resultat).objet)) = min_reel;
! 1380:
! 1381: if (((*s_objet_position).objet =
! 1382: allocation_maillon(s_etat_processus)) == NULL)
! 1383: {
! 1384: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1385: return;
! 1386: }
! 1387:
! 1388: l_element_courant = (*s_objet_position).objet;
! 1389: (*l_element_courant).suivant = NULL;
! 1390:
! 1391: if (((*l_element_courant).donnee = allocation(s_etat_processus,
! 1392: INT)) == NULL)
! 1393: {
! 1394: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1395: return;
! 1396: }
! 1397:
! 1398: (*((integer8 *) (*(*l_element_courant).donnee).objet)) =
! 1399: position_min_i + 1;
! 1400: }
! 1401:
! 1402: /*
! 1403: * Vecteur de complexes
! 1404: */
! 1405:
! 1406: else
! 1407: {
! 1408: f77absc_(&(((struct_complexe16 *) (*((struct_vecteur *)
! 1409: (*s_objet_argument_1).objet)).tableau)[0]), &min_reel);
! 1410:
! 1411: position_min_i = 0;
! 1412:
! 1413: for(i = 1; i < (*((struct_vecteur *) (*s_objet_argument_1).objet))
! 1414: .taille; i++)
! 1415: {
! 1416: f77absc_(&(((struct_complexe16 *) (*((struct_vecteur *)
! 1417: (*s_objet_argument_1).objet)).tableau)[i]), &module);
! 1418:
! 1419: if (module < min_reel)
! 1420: {
! 1421: min_reel = module;
! 1422: position_min_i = i;
! 1423: }
! 1424: }
! 1425:
! 1426: if ((s_objet_resultat = allocation(s_etat_processus, CPL))
! 1427: == NULL)
! 1428: {
! 1429: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1430: return;
! 1431: }
! 1432:
! 1433: (*((struct_complexe16 *) (*s_objet_resultat).objet))
! 1434: .partie_reelle = ((struct_complexe16 *)
! 1435: (*((struct_vecteur *) (*s_objet_argument_1).objet))
! 1436: .tableau)[position_min_i].partie_reelle;
! 1437: (*((struct_complexe16 *) (*s_objet_resultat).objet))
! 1438: .partie_imaginaire = ((struct_complexe16 *)
! 1439: (*((struct_vecteur *) (*s_objet_argument_1).objet))
! 1440: .tableau)[position_min_i].partie_imaginaire;
! 1441:
! 1442: if (((*s_objet_position).objet =
! 1443: allocation_maillon(s_etat_processus)) == NULL)
! 1444: {
! 1445: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1446: return;
! 1447: }
! 1448:
! 1449: l_element_courant = (*s_objet_position).objet;
! 1450: (*l_element_courant).suivant = NULL;
! 1451:
! 1452: if (((*l_element_courant).donnee = allocation(s_etat_processus,
! 1453: INT)) == NULL)
! 1454: {
! 1455: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1456: return;
! 1457: }
! 1458:
! 1459: (*((integer8 *) (*(*l_element_courant).donnee).objet)) =
! 1460: position_min_i + 1;
! 1461: }
! 1462:
! 1463: liberation(s_etat_processus, s_objet_argument_1);
! 1464:
! 1465: if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 1466: s_objet_resultat) == d_erreur)
! 1467: {
! 1468: return;
! 1469: }
! 1470:
! 1471: if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 1472: s_objet_position) == d_erreur)
! 1473: {
! 1474: return;
! 1475: }
! 1476: }
! 1477: else if (((*(*(*s_etat_processus).l_base_pile).donnee).type ==
! 1478: MIN) || ((*(*(*s_etat_processus).l_base_pile)
! 1479: .donnee).type == MRL) || ((*(*(*s_etat_processus)
! 1480: .l_base_pile).donnee).type == MCX))
! 1481: {
! 1482: if (test_cfsf(s_etat_processus, 31) == d_vrai)
! 1483: {
! 1484: if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
! 1485: {
! 1486: return;
! 1487: }
! 1488: }
! 1489:
! 1490: if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 1491: &s_objet_argument_1) == d_erreur)
! 1492: {
! 1493: (*s_etat_processus).erreur_execution = d_ex_manque_argument;
! 1494: return;
! 1495: }
! 1496:
! 1497: if ((s_objet_position = allocation(s_etat_processus, LST))
! 1498: == NULL)
! 1499: {
! 1500: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1501: return;
! 1502: }
! 1503:
! 1504: /*
! 1505: * Matrice d'entiers
! 1506: */
! 1507:
! 1508: if ((*s_objet_argument_1).type == MIN)
! 1509: {
! 1510: min_entier = ((integer8 **) (*((struct_matrice *)
! 1511: (*s_objet_argument_1).objet)).tableau)[0][0];
! 1512: position_min_i = 0;
! 1513: position_min_j = 0;
! 1514:
! 1515: for(i = 0; i < (*((struct_matrice *) (*s_objet_argument_1).objet))
! 1516: .nombre_lignes; i++)
! 1517: {
! 1518: for(j = 0; j < (*((struct_matrice *) (*s_objet_argument_1)
! 1519: .objet)).nombre_colonnes; j++)
! 1520: {
! 1521: if (((integer8 **) (*((struct_matrice *)
! 1522: (*s_objet_argument_1).objet)).tableau)[i][j] <
! 1523: min_entier)
! 1524: {
! 1525: min_entier = ((integer8 **) (*((struct_matrice *)
! 1526: (*s_objet_argument_1).objet)).tableau)[i][j];
! 1527: position_min_i = i;
! 1528: position_min_j = j;
! 1529: }
! 1530: }
! 1531: }
! 1532:
! 1533: if ((s_objet_resultat = allocation(s_etat_processus, INT))
! 1534: == NULL)
! 1535: {
! 1536: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1537: return;
! 1538: }
! 1539:
! 1540: (*((integer8 *) (*s_objet_resultat).objet)) = min_entier;
! 1541:
! 1542: if (((*s_objet_position).objet =
! 1543: allocation_maillon(s_etat_processus)) == NULL)
! 1544: {
! 1545: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1546: return;
! 1547: }
! 1548:
! 1549: l_element_courant = (*s_objet_position).objet;
! 1550:
! 1551: if (((*l_element_courant).donnee = allocation(s_etat_processus,
! 1552: INT)) == NULL)
! 1553: {
! 1554: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1555: return;
! 1556: }
! 1557:
! 1558: (*((integer8 *) (*(*l_element_courant).donnee).objet)) =
! 1559: position_min_i + 1;
! 1560:
! 1561: if (((*l_element_courant).suivant =
! 1562: allocation_maillon(s_etat_processus)) == NULL)
! 1563: {
! 1564: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1565: return;
! 1566: }
! 1567:
! 1568: l_element_courant = (*l_element_courant).suivant;
! 1569: (*l_element_courant).suivant = NULL;
! 1570:
! 1571: if (((*l_element_courant).donnee = allocation(s_etat_processus,
! 1572: INT)) == NULL)
! 1573: {
! 1574: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1575: return;
! 1576: }
! 1577:
! 1578: (*((integer8 *) (*(*l_element_courant).donnee).objet)) =
! 1579: position_min_j + 1;
! 1580: }
! 1581:
! 1582: /*
! 1583: * Matrice de réels
! 1584: */
! 1585:
! 1586: else if ((*s_objet_argument_1).type == MRL)
! 1587: {
! 1588: min_reel = ((real8 **) (*((struct_matrice *)
! 1589: (*s_objet_argument_1).objet)).tableau)[0][0];
! 1590: position_min_i = 0;
! 1591: position_min_j = 0;
! 1592:
! 1593: for(i = 0; i < (*((struct_matrice *) (*s_objet_argument_1).objet))
! 1594: .nombre_lignes; i++)
! 1595: {
! 1596: for(j = 0; j < (*((struct_matrice *) (*s_objet_argument_1)
! 1597: .objet)).nombre_colonnes; j++)
! 1598: {
! 1599: if (((real8 **) (*((struct_matrice *)
! 1600: (*s_objet_argument_1).objet)).tableau)[i][j] <
! 1601: min_reel)
! 1602: {
! 1603: min_reel = ((real8 **) (*((struct_matrice *)
! 1604: (*s_objet_argument_1).objet)).tableau)[i][j];
! 1605: position_min_i = i;
! 1606: position_min_j = j;
! 1607: }
! 1608: }
! 1609: }
! 1610:
! 1611: if ((s_objet_resultat = allocation(s_etat_processus, REL))
! 1612: == NULL)
! 1613: {
! 1614: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1615: return;
! 1616: }
! 1617:
! 1618: (*((real8 *) (*s_objet_resultat).objet)) = min_reel;
! 1619:
! 1620: if (((*s_objet_position).objet =
! 1621: allocation_maillon(s_etat_processus)) == NULL)
! 1622: {
! 1623: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1624: return;
! 1625: }
! 1626:
! 1627: l_element_courant = (*s_objet_position).objet;
! 1628:
! 1629: if (((*l_element_courant).donnee = allocation(s_etat_processus,
! 1630: INT)) == NULL)
! 1631: {
! 1632: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1633: return;
! 1634: }
! 1635:
! 1636: (*((integer8 *) (*(*l_element_courant).donnee).objet)) =
! 1637: position_min_i + 1;
! 1638:
! 1639: if (((*l_element_courant).suivant =
! 1640: allocation_maillon(s_etat_processus)) == NULL)
! 1641: {
! 1642: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1643: return;
! 1644: }
! 1645:
! 1646: l_element_courant = (*l_element_courant).suivant;
! 1647: (*l_element_courant).suivant = NULL;
! 1648:
! 1649: if (((*l_element_courant).donnee = allocation(s_etat_processus,
! 1650: INT)) == NULL)
! 1651: {
! 1652: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1653: return;
! 1654: }
! 1655:
! 1656: (*((integer8 *) (*(*l_element_courant).donnee).objet)) =
! 1657: position_min_j + 1;
! 1658: }
! 1659:
! 1660: /*
! 1661: * Matrice de complexes
! 1662: */
! 1663:
! 1664: else
! 1665: {
! 1666: f77absc_(&(((struct_complexe16 **) (*((struct_matrice *)
! 1667: (*s_objet_argument_1).objet)).tableau)[0][0]), &min_reel);
! 1668:
! 1669: position_min_i = 0;
! 1670: position_min_j = 0;
! 1671:
! 1672: for(i = 0; i < (*((struct_matrice *) (*s_objet_argument_1).objet))
! 1673: .nombre_lignes; i++)
! 1674: {
! 1675: for(j = 0; j < (*((struct_matrice *) (*s_objet_argument_1)
! 1676: .objet)).nombre_colonnes; j++)
! 1677: {
! 1678:
! 1679: f77absc_(&(((struct_complexe16 **) (*((struct_matrice *)
! 1680: (*s_objet_argument_1).objet)).tableau)[i][j]),
! 1681: &module);
! 1682:
! 1683: if (module < min_reel)
! 1684: {
! 1685: min_reel = module;
! 1686: position_min_i = i;
! 1687: position_min_j = j;
! 1688: }
! 1689: }
! 1690: }
! 1691:
! 1692: if ((s_objet_resultat = allocation(s_etat_processus, CPL))
! 1693: == NULL)
! 1694: {
! 1695: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1696: return;
! 1697: }
! 1698:
! 1699: (*((struct_complexe16 *) (*s_objet_resultat).objet))
! 1700: .partie_reelle = ((struct_complexe16 **)
! 1701: (*((struct_matrice *) (*s_objet_argument_1).objet))
! 1702: .tableau)[position_min_i][position_min_j].partie_reelle;
! 1703: (*((struct_complexe16 *) (*s_objet_resultat).objet))
! 1704: .partie_imaginaire = ((struct_complexe16 **)
! 1705: (*((struct_matrice *) (*s_objet_argument_1).objet))
! 1706: .tableau)[position_min_i][position_min_j].partie_imaginaire;
! 1707:
! 1708: if (((*s_objet_position).objet =
! 1709: allocation_maillon(s_etat_processus)) == NULL)
! 1710: {
! 1711: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1712: return;
! 1713: }
! 1714:
! 1715: l_element_courant = (*s_objet_position).objet;
! 1716:
! 1717: if (((*l_element_courant).donnee = allocation(s_etat_processus,
! 1718: INT)) == NULL)
! 1719: {
! 1720: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1721: return;
! 1722: }
! 1723:
! 1724: (*((integer8 *) (*(*l_element_courant).donnee).objet)) =
! 1725: position_min_i + 1;
! 1726:
! 1727: if (((*l_element_courant).suivant =
! 1728: allocation_maillon(s_etat_processus)) == NULL)
! 1729: {
! 1730: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1731: return;
! 1732: }
! 1733:
! 1734: l_element_courant = (*l_element_courant).suivant;
! 1735: (*l_element_courant).suivant = NULL;
! 1736:
! 1737: if (((*l_element_courant).donnee = allocation(s_etat_processus,
! 1738: INT)) == NULL)
! 1739: {
! 1740: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1741: return;
! 1742: }
! 1743:
! 1744: (*((integer8 *) (*(*l_element_courant).donnee).objet)) =
! 1745: position_min_j + 1;
! 1746: }
! 1747:
! 1748: liberation(s_etat_processus, s_objet_argument_1);
! 1749:
! 1750: if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 1751: s_objet_resultat) == d_erreur)
! 1752: {
! 1753: return;
! 1754: }
! 1755:
! 1756: if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 1757: s_objet_position) == d_erreur)
! 1758: {
! 1759: return;
! 1760: }
! 1761: }
! 1762:
! 1763: /*
! 1764: --------------------------------------------------------------------------------
! 1765: MIN portant sur autre chose (deux arguments)
! 1766: --------------------------------------------------------------------------------
! 1767: */
! 1768:
! 1769: else
! 1770: {
! 1771: if (test_cfsf(s_etat_processus, 31) == d_vrai)
! 1772: {
! 1773: if (empilement_pile_last(s_etat_processus, 2) == d_erreur)
! 1774: {
! 1775: return;
! 1776: }
! 1777: }
! 1778:
! 1779: if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 1780: &s_objet_argument_1) == d_erreur)
! 1781: {
! 1782: (*s_etat_processus).erreur_execution = d_ex_manque_argument;
! 1783: return;
! 1784: }
! 1785:
! 1786: if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 1787: &s_objet_argument_2) == d_erreur)
! 1788: {
! 1789: liberation(s_etat_processus, s_objet_argument_1);
! 1790:
! 1791: (*s_etat_processus).erreur_execution = d_ex_manque_argument;
! 1792: return;
! 1793: }
! 1794:
! 1795: /*
! 1796: --------------------------------------------------------------------------------
! 1797: MIN portant sur des valeurs numériques
! 1798: --------------------------------------------------------------------------------
! 1799: */
! 1800:
! 1801: if ((((*s_objet_argument_1).type == INT) ||
! 1802: ((*s_objet_argument_1).type == REL)) &&
! 1803: (((*s_objet_argument_2).type == INT) ||
! 1804: ((*s_objet_argument_2).type == REL)))
! 1805: {
! 1806: if ((*s_objet_argument_1).type == INT)
! 1807: {
! 1808: if ((*s_objet_argument_2).type == INT)
! 1809: {
! 1810: if ((*((integer8 *) (*s_objet_argument_1).objet)) <=
! 1811: (*((integer8 *) (*s_objet_argument_2).objet)))
! 1812: {
! 1813: s_objet_resultat = s_objet_argument_1;
! 1814: s_objet_argument_1 = NULL;
! 1815: }
! 1816: else
! 1817: {
! 1818: s_objet_resultat = s_objet_argument_2;
! 1819: s_objet_argument_2 = NULL;
! 1820: }
! 1821: }
! 1822: else
! 1823: {
! 1824: if ((*((integer8 *) (*s_objet_argument_1).objet)) <=
! 1825: (*((real8 *) (*s_objet_argument_2).objet)))
! 1826: {
! 1827: s_objet_resultat = s_objet_argument_1;
! 1828: s_objet_argument_1 = NULL;
! 1829: }
! 1830: else
! 1831: {
! 1832: s_objet_resultat = s_objet_argument_2;
! 1833: s_objet_argument_2 = NULL;
! 1834: }
! 1835: }
! 1836: }
! 1837: else
! 1838: {
! 1839: if ((*s_objet_argument_2).type == INT)
! 1840: {
! 1841: if ((*((real8 *) (*s_objet_argument_1).objet)) <=
! 1842: (*((integer8 *) (*s_objet_argument_2).objet)))
! 1843: {
! 1844: s_objet_resultat = s_objet_argument_1;
! 1845: s_objet_argument_1 = NULL;
! 1846: }
! 1847: else
! 1848: {
! 1849: s_objet_resultat = s_objet_argument_2;
! 1850: s_objet_argument_2 = NULL;
! 1851: }
! 1852: }
! 1853: else
! 1854: {
! 1855: if ((*((real8 *) (*s_objet_argument_1).objet)) <=
! 1856: (*((real8 *) (*s_objet_argument_2).objet)))
! 1857: {
! 1858: s_objet_resultat = s_objet_argument_1;
! 1859: s_objet_argument_1 = NULL;
! 1860: }
! 1861: else
! 1862: {
! 1863: s_objet_resultat = s_objet_argument_2;
! 1864: s_objet_argument_2 = NULL;
! 1865: }
! 1866: }
! 1867: }
! 1868: }
! 1869:
! 1870: /*
! 1871: --------------------------------------------------------------------------------
! 1872: MIN entre des arguments complexes
! 1873: --------------------------------------------------------------------------------
! 1874: */
! 1875:
! 1876: /*
! 1877: * Nom ou valeur numérique / Nom ou valeur numérique
! 1878: */
! 1879:
! 1880: else if ((((*s_objet_argument_1).type == NOM) &&
! 1881: (((*s_objet_argument_2).type == NOM) ||
! 1882: ((*s_objet_argument_2).type == INT) ||
! 1883: ((*s_objet_argument_2).type == REL))) ||
! 1884: (((*s_objet_argument_2).type == NOM) &&
! 1885: (((*s_objet_argument_1).type == INT) ||
! 1886: ((*s_objet_argument_1).type == REL))))
! 1887: {
! 1888: if ((s_objet_resultat = allocation(s_etat_processus, ALG))
! 1889: == NULL)
! 1890: {
! 1891: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1892: return;
! 1893: }
! 1894:
! 1895: if (((*s_objet_resultat).objet =
! 1896: allocation_maillon(s_etat_processus)) == NULL)
! 1897: {
! 1898: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1899: return;
! 1900: }
! 1901:
! 1902: l_element_courant = (*s_objet_resultat).objet;
! 1903:
! 1904: if (((*l_element_courant).donnee = allocation(s_etat_processus,
! 1905: FCT)) == NULL)
! 1906: {
! 1907: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1908: return;
! 1909: }
! 1910:
! 1911: (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 1912: .nombre_arguments = 0;
! 1913: (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 1914: .fonction = instruction_vers_niveau_superieur;
! 1915:
! 1916: if (((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 1917: .nom_fonction = malloc(3 * sizeof(unsigned char))) == NULL)
! 1918: {
! 1919: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1920: return;
! 1921: }
! 1922:
! 1923: strcpy((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 1924: .nom_fonction, "<<");
! 1925:
! 1926: if (((*l_element_courant).suivant =
! 1927: allocation_maillon(s_etat_processus)) == NULL)
! 1928: {
! 1929: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1930: return;
! 1931: }
! 1932:
! 1933: l_element_courant = (*l_element_courant).suivant;
! 1934: (*l_element_courant).donnee = s_objet_argument_2;
! 1935:
! 1936: if (((*l_element_courant).suivant =
! 1937: allocation_maillon(s_etat_processus)) == NULL)
! 1938: {
! 1939: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1940: return;
! 1941: }
! 1942:
! 1943: l_element_courant = (*l_element_courant).suivant;
! 1944: (*l_element_courant).donnee = s_objet_argument_1;
! 1945:
! 1946: if (((*l_element_courant).suivant =
! 1947: allocation_maillon(s_etat_processus)) == NULL)
! 1948: {
! 1949: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1950: return;
! 1951: }
! 1952:
! 1953: l_element_courant = (*l_element_courant).suivant;
! 1954:
! 1955: if (((*l_element_courant).donnee = allocation(s_etat_processus,
! 1956: FCT)) == NULL)
! 1957: {
! 1958: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1959: return;
! 1960: }
! 1961:
! 1962: (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 1963: .nombre_arguments = 2;
! 1964: (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 1965: .fonction = instruction_min;
! 1966:
! 1967: if (((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 1968: .nom_fonction = malloc(4 * sizeof(unsigned char))) == NULL)
! 1969: {
! 1970: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1971: return;
! 1972: }
! 1973:
! 1974: strcpy((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 1975: .nom_fonction, "MIN");
! 1976:
! 1977: if (((*l_element_courant).suivant =
! 1978: allocation_maillon(s_etat_processus)) == NULL)
! 1979: {
! 1980: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1981: return;
! 1982: }
! 1983:
! 1984: l_element_courant = (*l_element_courant).suivant;
! 1985:
! 1986: if (((*l_element_courant).donnee = allocation(s_etat_processus,
! 1987: FCT)) == NULL)
! 1988: {
! 1989: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 1990: return;
! 1991: }
! 1992:
! 1993: (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 1994: .nombre_arguments = 0;
! 1995: (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 1996: .fonction = instruction_vers_niveau_inferieur;
! 1997:
! 1998: if (((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 1999: .nom_fonction = malloc(3 * sizeof(unsigned char))) == NULL)
! 2000: {
! 2001: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 2002: return;
! 2003: }
! 2004:
! 2005: strcpy((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 2006: .nom_fonction, ">>");
! 2007:
! 2008: (*l_element_courant).suivant = NULL;
! 2009:
! 2010: s_objet_argument_1 = NULL;
! 2011: s_objet_argument_2 = NULL;
! 2012: }
! 2013:
! 2014: /*
! 2015: * Nom ou valeur numérique / Expression
! 2016: */
! 2017:
! 2018: else if (((((*s_objet_argument_1).type == ALG) ||
! 2019: ((*s_objet_argument_1).type == RPN))) &&
! 2020: (((*s_objet_argument_2).type == NOM) ||
! 2021: ((*s_objet_argument_2).type == INT) ||
! 2022: ((*s_objet_argument_2).type == REL)))
! 2023: {
! 2024: nombre_elements = 0;
! 2025: l_element_courant = (struct_liste_chainee *)
! 2026: (*s_objet_argument_1).objet;
! 2027:
! 2028: while(l_element_courant != NULL)
! 2029: {
! 2030: nombre_elements++;
! 2031: l_element_courant = (*l_element_courant).suivant;
! 2032: }
! 2033:
! 2034: if (nombre_elements == 2)
! 2035: {
! 2036: liberation(s_etat_processus, s_objet_argument_1);
! 2037: liberation(s_etat_processus, s_objet_argument_2);
! 2038:
! 2039: (*s_etat_processus).erreur_execution = d_ex_argument_invalide;
! 2040: return;
! 2041: }
! 2042:
! 2043: if ((s_objet_resultat = copie_objet(s_etat_processus,
! 2044: s_objet_argument_1, 'N')) == NULL)
! 2045: {
! 2046: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 2047: return;
! 2048: }
! 2049:
! 2050: l_element_courant = (struct_liste_chainee *)
! 2051: (*s_objet_resultat).objet;
! 2052: l_element_precedent = l_element_courant;
! 2053: l_element_courant = (*l_element_courant).suivant;
! 2054:
! 2055: if (((*l_element_precedent).suivant =
! 2056: allocation_maillon(s_etat_processus)) == NULL)
! 2057: {
! 2058: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 2059: return;
! 2060: }
! 2061:
! 2062: (*(*l_element_precedent).suivant).donnee = s_objet_argument_2;
! 2063: (*(*l_element_precedent).suivant).suivant = l_element_courant;
! 2064:
! 2065: while((*l_element_courant).suivant != NULL)
! 2066: {
! 2067: l_element_precedent = l_element_courant;
! 2068: l_element_courant = (*l_element_courant).suivant;
! 2069: }
! 2070:
! 2071: if (((*l_element_precedent).suivant =
! 2072: allocation_maillon(s_etat_processus)) == NULL)
! 2073: {
! 2074: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 2075: return;
! 2076: }
! 2077:
! 2078: if (((*(*l_element_precedent).suivant).donnee =
! 2079: allocation(s_etat_processus, FCT)) == NULL)
! 2080: {
! 2081: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 2082: return;
! 2083: }
! 2084:
! 2085: (*((struct_fonction *) (*(*(*l_element_precedent).suivant)
! 2086: .donnee).objet)).nombre_arguments = 2;
! 2087: (*((struct_fonction *) (*(*(*l_element_precedent).suivant)
! 2088: .donnee).objet)).fonction = instruction_min;
! 2089:
! 2090: if (((*((struct_fonction *) (*(*(*l_element_precedent)
! 2091: .suivant).donnee).objet)).nom_fonction =
! 2092: malloc(4 * sizeof(unsigned char))) == NULL)
! 2093: {
! 2094: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 2095: return;
! 2096: }
! 2097:
! 2098: strcpy((*((struct_fonction *) (*(*(*l_element_precedent)
! 2099: .suivant).donnee).objet)).nom_fonction, "MIN");
! 2100:
! 2101: (*(*l_element_precedent).suivant).suivant = l_element_courant;
! 2102:
! 2103: s_objet_argument_2 = NULL;
! 2104: }
! 2105:
! 2106: /*
! 2107: * Expression / Nom ou valeur numérique
! 2108: */
! 2109:
! 2110: else if ((((*s_objet_argument_1).type == NOM) ||
! 2111: ((*s_objet_argument_1).type == INT) ||
! 2112: ((*s_objet_argument_1).type == REL)) &&
! 2113: ((((*s_objet_argument_2).type == ALG) ||
! 2114: ((*s_objet_argument_2).type == RPN))))
! 2115: {
! 2116: nombre_elements = 0;
! 2117: l_element_courant = (struct_liste_chainee *)
! 2118: (*s_objet_argument_2).objet;
! 2119:
! 2120: while(l_element_courant != NULL)
! 2121: {
! 2122: nombre_elements++;
! 2123: l_element_courant = (*l_element_courant).suivant;
! 2124: }
! 2125:
! 2126: if (nombre_elements == 2)
! 2127: {
! 2128: liberation(s_etat_processus, s_objet_argument_1);
! 2129: liberation(s_etat_processus, s_objet_argument_2);
! 2130:
! 2131: (*s_etat_processus).erreur_execution = d_ex_argument_invalide;
! 2132: return;
! 2133: }
! 2134:
! 2135: if ((s_objet_resultat = copie_objet(s_etat_processus,
! 2136: s_objet_argument_2, 'N')) == NULL)
! 2137: {
! 2138: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 2139: return;
! 2140: }
! 2141:
! 2142: l_element_courant = (struct_liste_chainee *)
! 2143: (*s_objet_resultat).objet;
! 2144: l_element_precedent = l_element_courant;
! 2145:
! 2146: while((*l_element_courant).suivant != NULL)
! 2147: {
! 2148: l_element_precedent = l_element_courant;
! 2149: l_element_courant = (*l_element_courant).suivant;
! 2150: }
! 2151:
! 2152: if (((*l_element_precedent).suivant =
! 2153: allocation_maillon(s_etat_processus)) == NULL)
! 2154: {
! 2155: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 2156: return;
! 2157: }
! 2158:
! 2159: (*(*l_element_precedent).suivant).donnee = s_objet_argument_1;
! 2160: l_element_precedent = (*l_element_precedent).suivant;
! 2161:
! 2162: if (((*l_element_precedent).suivant =
! 2163: allocation_maillon(s_etat_processus)) == NULL)
! 2164: {
! 2165: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 2166: return;
! 2167: }
! 2168:
! 2169: if (((*(*l_element_precedent).suivant).donnee =
! 2170: allocation(s_etat_processus, FCT)) == NULL)
! 2171: {
! 2172: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 2173: return;
! 2174: }
! 2175:
! 2176: (*((struct_fonction *) (*(*(*l_element_precedent).suivant)
! 2177: .donnee).objet)).nombre_arguments = 2;
! 2178: (*((struct_fonction *) (*(*(*l_element_precedent).suivant)
! 2179: .donnee).objet)).fonction = instruction_min;
! 2180:
! 2181: if (((*((struct_fonction *) (*(*(*l_element_precedent)
! 2182: .suivant).donnee).objet)).nom_fonction =
! 2183: malloc(4 * sizeof(unsigned char))) == NULL)
! 2184: {
! 2185: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 2186: return;
! 2187: }
! 2188:
! 2189: strcpy((*((struct_fonction *) (*(*(*l_element_precedent)
! 2190: .suivant).donnee).objet)).nom_fonction, "MIN");
! 2191:
! 2192: (*(*l_element_precedent).suivant).suivant = l_element_courant;
! 2193:
! 2194: s_objet_argument_1 = NULL;
! 2195: }
! 2196:
! 2197: /*
! 2198: * Expression / Expression
! 2199: */
! 2200:
! 2201: else if ((((*s_objet_argument_1).type == ALG) &&
! 2202: ((*s_objet_argument_2).type == ALG)) ||
! 2203: (((*s_objet_argument_1).type == RPN) &&
! 2204: ((*s_objet_argument_2).type == RPN)))
! 2205: {
! 2206: nombre_elements = 0;
! 2207: l_element_courant = (struct_liste_chainee *)
! 2208: (*s_objet_argument_1).objet;
! 2209:
! 2210: while(l_element_courant != NULL)
! 2211: {
! 2212: nombre_elements++;
! 2213: l_element_courant = (*l_element_courant).suivant;
! 2214: }
! 2215:
! 2216: if (nombre_elements == 2)
! 2217: {
! 2218: liberation(s_etat_processus, s_objet_argument_1);
! 2219: liberation(s_etat_processus, s_objet_argument_2);
! 2220:
! 2221: (*s_etat_processus).erreur_execution = d_ex_argument_invalide;
! 2222: return;
! 2223: }
! 2224:
! 2225: nombre_elements = 0;
! 2226: l_element_courant = (struct_liste_chainee *)
! 2227: (*s_objet_argument_2).objet;
! 2228:
! 2229: while(l_element_courant != NULL)
! 2230: {
! 2231: nombre_elements++;
! 2232: l_element_courant = (*l_element_courant).suivant;
! 2233: }
! 2234:
! 2235: if (nombre_elements == 2)
! 2236: {
! 2237: liberation(s_etat_processus, s_objet_argument_1);
! 2238: liberation(s_etat_processus, s_objet_argument_2);
! 2239:
! 2240: (*s_etat_processus).erreur_execution = d_ex_argument_invalide;
! 2241: return;
! 2242: }
! 2243:
! 2244: if ((s_copie_argument_1 = copie_objet(s_etat_processus,
! 2245: s_objet_argument_1, 'N')) == NULL)
! 2246: {
! 2247: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 2248: return;
! 2249: }
! 2250:
! 2251: if ((s_copie_argument_2 = copie_objet(s_etat_processus,
! 2252: s_objet_argument_2, 'N')) == NULL)
! 2253: {
! 2254: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 2255: return;
! 2256: }
! 2257:
! 2258: l_element_courant = (struct_liste_chainee *)
! 2259: (*s_copie_argument_1).objet;
! 2260: (*s_copie_argument_1).objet = (void *) (*((struct_liste_chainee *)
! 2261: (*s_copie_argument_1).objet)).suivant;
! 2262:
! 2263: liberation(s_etat_processus, (*l_element_courant).donnee);
! 2264: free(l_element_courant);
! 2265:
! 2266: l_element_courant = (struct_liste_chainee *)
! 2267: (*s_copie_argument_2).objet;
! 2268: l_element_precedent = l_element_courant;
! 2269: s_objet_resultat = s_copie_argument_2;
! 2270:
! 2271: while((*l_element_courant).suivant != NULL)
! 2272: {
! 2273: l_element_precedent = l_element_courant;
! 2274: l_element_courant = (*l_element_courant).suivant;
! 2275: }
! 2276:
! 2277: liberation(s_etat_processus, (*l_element_courant).donnee);
! 2278: free(l_element_courant);
! 2279:
! 2280: (*l_element_precedent).suivant = (struct_liste_chainee *)
! 2281: (*s_copie_argument_1).objet;
! 2282: free(s_copie_argument_1);
! 2283:
! 2284: l_element_courant = (*l_element_precedent).suivant;
! 2285: while((*l_element_courant).suivant != NULL)
! 2286: {
! 2287: l_element_precedent = l_element_courant;
! 2288: l_element_courant = (*l_element_courant).suivant;
! 2289: }
! 2290:
! 2291: if (((*l_element_precedent).suivant =
! 2292: allocation_maillon(s_etat_processus)) == NULL)
! 2293: {
! 2294: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 2295: return;
! 2296: }
! 2297:
! 2298: (*(*l_element_precedent).suivant).suivant = l_element_courant;
! 2299: l_element_courant = (*l_element_precedent).suivant;
! 2300:
! 2301: if (((*l_element_courant).donnee = allocation(s_etat_processus,
! 2302: FCT)) == NULL)
! 2303: {
! 2304: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 2305: return;
! 2306: }
! 2307:
! 2308: (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 2309: .nombre_arguments = 2;
! 2310: (*((struct_fonction *) (*(*(*l_element_precedent).suivant)
! 2311: .donnee).objet)).fonction = instruction_min;
! 2312:
! 2313: if (((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 2314: .nom_fonction = malloc(4 * sizeof(unsigned char))) == NULL)
! 2315: {
! 2316: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 2317: return;
! 2318: }
! 2319:
! 2320: strcpy((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
! 2321: .nom_fonction, "MIN");
! 2322: }
! 2323:
! 2324: /*
! 2325: --------------------------------------------------------------------------------
! 2326: Arguments incorrects
! 2327: --------------------------------------------------------------------------------
! 2328: */
! 2329:
! 2330: else
! 2331: {
! 2332: liberation(s_etat_processus, s_objet_argument_1);
! 2333: liberation(s_etat_processus, s_objet_argument_2);
! 2334:
! 2335: (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
! 2336: return;
! 2337: }
! 2338:
! 2339: if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 2340: s_objet_resultat) == d_erreur)
! 2341: {
! 2342: return;
! 2343: }
! 2344:
! 2345: liberation(s_etat_processus, s_objet_argument_1);
! 2346: liberation(s_etat_processus, s_objet_argument_2);
! 2347: }
! 2348:
! 2349: return;
! 2350: }
! 2351:
! 2352: // vim: ts=4
CVSweb interface <joel.bertrand@systella.fr>