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