Annotation of rpl/src/instructions_p7.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 'protect'
! 29: ================================================================================
! 30: Entrées :
! 31: --------------------------------------------------------------------------------
! 32: Sorties :
! 33: --------------------------------------------------------------------------------
! 34: Effets de bord : néant
! 35: ================================================================================
! 36: */
! 37:
! 38: void
! 39: instruction_protect(struct_processus *s_etat_processus)
! 40: {
! 41: struct_liste_chainee *l_element_courant;
! 42:
! 43: struct_objet *s_objet;
! 44:
! 45: (*s_etat_processus).erreur_execution = d_ex;
! 46:
! 47: if ((*s_etat_processus).affichage_arguments == 'Y')
! 48: {
! 49: printf("\n PROTECT ");
! 50:
! 51: if ((*s_etat_processus).langue == 'F')
! 52: {
! 53: printf("(verrouille une variable)\n\n");
! 54: }
! 55: else
! 56: {
! 57: printf("(lock a variable)\n\n");
! 58: }
! 59:
! 60: printf(" 1: %s, %s\n", d_NOM, d_LST);
! 61:
! 62: return;
! 63: }
! 64: else if ((*s_etat_processus).test_instruction == 'Y')
! 65: {
! 66: (*s_etat_processus).nombre_arguments = -1;
! 67: return;
! 68: }
! 69:
! 70: if (test_cfsf(s_etat_processus, 31) == d_vrai)
! 71: {
! 72: if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
! 73: {
! 74: return;
! 75: }
! 76: }
! 77:
! 78: if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 79: &s_objet) == d_erreur)
! 80: {
! 81: (*s_etat_processus).erreur_execution = d_ex_manque_argument;
! 82: return;
! 83: }
! 84:
! 85: if ((*s_objet).type == NOM)
! 86: {
! 87: if (recherche_variable(s_etat_processus, ((*((struct_nom *)
! 88: (*s_objet).objet)).nom)) == d_faux)
! 89: {
! 90: liberation(s_etat_processus, s_objet);
! 91:
! 92: (*s_etat_processus).erreur_systeme = d_es;
! 93: (*s_etat_processus).erreur_execution = d_ex_variable_non_definie;
! 94: return;
! 95: }
! 96:
! 97: ((*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 98: .position_variable_courante]).variable_verrouillee = d_vrai;
! 99: }
! 100: else if ((*s_objet).type == LST)
! 101: {
! 102: l_element_courant = (struct_liste_chainee *) (*s_objet).objet;
! 103:
! 104: while(l_element_courant != NULL)
! 105: {
! 106: if ((*(*l_element_courant).donnee).type != NOM)
! 107: {
! 108: liberation(s_etat_processus, s_objet);
! 109:
! 110: (*s_etat_processus).erreur_execution = d_ex_nom_invalide;
! 111: return;
! 112: }
! 113:
! 114: if (recherche_variable(s_etat_processus, (*((struct_nom *)
! 115: (*(*l_element_courant).donnee).objet)).nom) == d_faux)
! 116: {
! 117: liberation(s_etat_processus, s_objet);
! 118:
! 119: (*s_etat_processus).erreur_systeme = d_es;
! 120: (*s_etat_processus).erreur_execution =
! 121: d_ex_variable_non_definie;
! 122: return;
! 123: }
! 124:
! 125: ((*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 126: .position_variable_courante]).variable_verrouillee = d_vrai;
! 127:
! 128: l_element_courant = (*l_element_courant).suivant;
! 129: }
! 130: }
! 131: else
! 132: {
! 133: liberation(s_etat_processus, s_objet);
! 134:
! 135: (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
! 136: return;
! 137: }
! 138:
! 139: liberation(s_etat_processus, s_objet);
! 140:
! 141: return;
! 142: }
! 143:
! 144:
! 145: /*
! 146: ================================================================================
! 147: Fonction 'parameter'
! 148: ================================================================================
! 149: Entrées :
! 150: --------------------------------------------------------------------------------
! 151: Sorties :
! 152: --------------------------------------------------------------------------------
! 153: Effets de bord : néant
! 154: ================================================================================
! 155: */
! 156:
! 157: void
! 158: instruction_parameter(struct_processus *s_etat_processus)
! 159: {
! 160: logical1 presence_variable;
! 161:
! 162: long i;
! 163:
! 164: struct_liste_chainee *l_element_courant;
! 165:
! 166: struct_objet *s_objet;
! 167:
! 168: (*s_etat_processus).erreur_execution = d_ex;
! 169:
! 170: if ((*s_etat_processus).affichage_arguments == 'Y')
! 171: {
! 172: printf("\n PARAMETER ");
! 173:
! 174: if ((*s_etat_processus).langue == 'F')
! 175: {
! 176: printf("(verrouille une variable globale)\n\n");
! 177: }
! 178: else
! 179: {
! 180: printf("(lock a global variable)\n\n");
! 181: }
! 182:
! 183: printf(" 1: %s, %s\n", d_NOM, d_LST);
! 184:
! 185: return;
! 186: }
! 187: else if ((*s_etat_processus).test_instruction == 'Y')
! 188: {
! 189: (*s_etat_processus).nombre_arguments = -1;
! 190: return;
! 191: }
! 192:
! 193: if (test_cfsf(s_etat_processus, 31) == d_vrai)
! 194: {
! 195: if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
! 196: {
! 197: return;
! 198: }
! 199: }
! 200:
! 201: if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 202: &s_objet) == d_erreur)
! 203: {
! 204: (*s_etat_processus).erreur_execution = d_ex_manque_argument;
! 205: return;
! 206: }
! 207:
! 208: if ((*s_objet).type == NOM)
! 209: {
! 210: if (recherche_variable(s_etat_processus, ((*((struct_nom *)
! 211: (*s_objet).objet)).nom)) == d_faux)
! 212: {
! 213: liberation(s_etat_processus, s_objet);
! 214:
! 215: (*s_etat_processus).erreur_systeme = d_es;
! 216: (*s_etat_processus).erreur_execution = d_ex_variable_non_definie;
! 217: return;
! 218: }
! 219:
! 220: i = (*s_etat_processus).position_variable_courante;
! 221: presence_variable = d_faux;
! 222:
! 223: while(i >= 0)
! 224: {
! 225: if ((strcmp((*s_etat_processus).s_liste_variables[i].nom,
! 226: (*((struct_nom *) (*s_objet).objet)).nom) == 0)
! 227: && ((*s_etat_processus).s_liste_variables[i].niveau == 1))
! 228: {
! 229: presence_variable = d_vrai;
! 230: break;
! 231: }
! 232:
! 233: i--;
! 234: }
! 235:
! 236: (*s_etat_processus).position_variable_courante = i;
! 237:
! 238: if (presence_variable == d_faux)
! 239: {
! 240: liberation(s_etat_processus, s_objet);
! 241:
! 242: (*s_etat_processus).erreur_execution = d_ex_variable_non_definie;
! 243: return;
! 244: }
! 245:
! 246: ((*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 247: .position_variable_courante]).variable_verrouillee = d_vrai;
! 248: }
! 249: else if ((*s_objet).type == LST)
! 250: {
! 251: l_element_courant = (struct_liste_chainee *) (*s_objet).objet;
! 252:
! 253: while(l_element_courant != NULL)
! 254: {
! 255: if ((*(*l_element_courant).donnee).type != NOM)
! 256: {
! 257: liberation(s_etat_processus, s_objet);
! 258:
! 259: (*s_etat_processus).erreur_execution = d_ex_nom_invalide;
! 260: return;
! 261: }
! 262:
! 263: if (recherche_variable(s_etat_processus, (*((struct_nom *)
! 264: (*(*l_element_courant).donnee).objet)).nom) == d_faux)
! 265: {
! 266: liberation(s_etat_processus, s_objet);
! 267:
! 268: (*s_etat_processus).erreur_systeme = d_es;
! 269: (*s_etat_processus).erreur_execution =
! 270: d_ex_variable_non_definie;
! 271: return;
! 272: }
! 273:
! 274: i = (*s_etat_processus).position_variable_courante;
! 275: presence_variable = d_faux;
! 276:
! 277: while(i >= 0)
! 278: {
! 279: if ((strcmp((*s_etat_processus).s_liste_variables[i].nom,
! 280: (*((struct_nom *) (*(*l_element_courant).donnee)
! 281: .objet)).nom) == 0) && ((*s_etat_processus)
! 282: .s_liste_variables[i].niveau == 1))
! 283: {
! 284: presence_variable = d_vrai;
! 285: break;
! 286: }
! 287:
! 288: i--;
! 289: }
! 290:
! 291: (*s_etat_processus).position_variable_courante = i;
! 292:
! 293: if (presence_variable == d_faux)
! 294: {
! 295: liberation(s_etat_processus, s_objet);
! 296:
! 297: (*s_etat_processus).erreur_execution =
! 298: d_ex_variable_non_definie;
! 299: return;
! 300: }
! 301:
! 302: ((*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 303: .position_variable_courante]).variable_verrouillee = d_vrai;
! 304:
! 305: l_element_courant = (*l_element_courant).suivant;
! 306: }
! 307: }
! 308: else
! 309: {
! 310: liberation(s_etat_processus, s_objet);
! 311:
! 312: (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
! 313: return;
! 314: }
! 315:
! 316: liberation(s_etat_processus, s_objet);
! 317:
! 318: return;
! 319: }
! 320:
! 321:
! 322: /*
! 323: ================================================================================
! 324: Fonction 'pshcntxt'
! 325: ================================================================================
! 326: Entrées :
! 327: --------------------------------------------------------------------------------
! 328: Sorties :
! 329: --------------------------------------------------------------------------------
! 330: Effets de bord : néant
! 331: ================================================================================
! 332: */
! 333:
! 334: void
! 335: instruction_pshcntxt(struct_processus *s_etat_processus)
! 336: {
! 337: struct_objet *s_objet;
! 338:
! 339: (*s_etat_processus).erreur_execution = d_ex;
! 340:
! 341: if ((*s_etat_processus).affichage_arguments == 'Y')
! 342: {
! 343: printf("\n PSHCNTXT ");
! 344:
! 345: if ((*s_etat_processus).langue == 'F')
! 346: {
! 347: printf("(sauvegarde de contexte)\n\n");
! 348: printf(" Aucun argument\n");
! 349: }
! 350: else
! 351: {
! 352: printf("(pushes context)\n\n");
! 353: printf(" No argument\n");
! 354: }
! 355:
! 356: return;
! 357: }
! 358: else if ((*s_etat_processus).test_instruction == 'Y')
! 359: {
! 360: (*s_etat_processus).nombre_arguments = -1;
! 361: return;
! 362: }
! 363:
! 364: if (test_cfsf(s_etat_processus, 31) == d_vrai)
! 365: {
! 366: if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
! 367: {
! 368: return;
! 369: }
! 370: }
! 371:
! 372: if ((s_objet = allocation(s_etat_processus, LST)) == NULL)
! 373: {
! 374: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 375: return;
! 376: }
! 377:
! 378: (*s_objet).objet = (*s_etat_processus).l_base_pile;
! 379:
! 380: if (empilement(s_etat_processus, &((*s_etat_processus).
! 381: l_base_pile_contextes), s_objet) == d_erreur)
! 382: {
! 383: return;
! 384: }
! 385:
! 386: if ((s_objet = allocation(s_etat_processus, INT)) == NULL)
! 387: {
! 388: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 389: return;
! 390: }
! 391:
! 392: (*((integer8 *) (*s_objet).objet)) = (*s_etat_processus)
! 393: .hauteur_pile_operationnelle;
! 394:
! 395: if (empilement(s_etat_processus, &((*s_etat_processus)
! 396: .l_base_pile_taille_contextes), s_objet) == d_erreur)
! 397: {
! 398: return;
! 399: }
! 400:
! 401: /*
! 402: * Vidage de la pile opérationnelle
! 403: */
! 404:
! 405: (*s_etat_processus).l_base_pile = NULL;
! 406: (*s_etat_processus).hauteur_pile_operationnelle = 0;
! 407:
! 408: return;
! 409: }
! 410:
! 411:
! 412: /*
! 413: ================================================================================
! 414: Fonction 'pulcntxt'
! 415: ================================================================================
! 416: Entrées :
! 417: --------------------------------------------------------------------------------
! 418: Sorties :
! 419: --------------------------------------------------------------------------------
! 420: Effets de bord : néant
! 421: ================================================================================
! 422: */
! 423:
! 424: void
! 425: instruction_pulcntxt(struct_processus *s_etat_processus)
! 426: {
! 427: struct_objet *s_objet;
! 428:
! 429: (*s_etat_processus).erreur_execution = d_ex;
! 430:
! 431: if ((*s_etat_processus).affichage_arguments == 'Y')
! 432: {
! 433: printf("\n PULCNTXT ");
! 434:
! 435: if ((*s_etat_processus).langue == 'F')
! 436: {
! 437: printf("(restauration de contexte)\n\n");
! 438: printf(" Aucun argument\n");
! 439: }
! 440: else
! 441: {
! 442: printf("(pulls context)\n\n");
! 443: printf(" No argument\n");
! 444: }
! 445:
! 446: return;
! 447: }
! 448: else if ((*s_etat_processus).test_instruction == 'Y')
! 449: {
! 450: (*s_etat_processus).nombre_arguments = -1;
! 451: return;
! 452: }
! 453:
! 454: if (test_cfsf(s_etat_processus, 31) == d_vrai)
! 455: {
! 456: if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
! 457: {
! 458: return;
! 459: }
! 460: }
! 461:
! 462: if (((*s_etat_processus).l_base_pile_contextes == NULL) ||
! 463: ((*s_etat_processus).l_base_pile_taille_contextes == NULL))
! 464: {
! 465: (*s_etat_processus).erreur_execution = d_ex_contexte;
! 466: return;
! 467: }
! 468:
! 469: instruction_clear(s_etat_processus);
! 470:
! 471: if (depilement(s_etat_processus, &((*s_etat_processus)
! 472: .l_base_pile_contextes), &s_objet) == d_erreur)
! 473: {
! 474: return;
! 475: }
! 476:
! 477: if ((*s_objet).type != LST)
! 478: {
! 479: (*s_etat_processus).erreur_systeme = d_es_contexte;
! 480: return;
! 481: }
! 482:
! 483: (*s_etat_processus).l_base_pile = (*s_objet).objet;
! 484:
! 485: BUG((*s_objet).nombre_occurrences != 1,
! 486: printf("(*s_objet).nombre_occurrences=%ld\n",
! 487: (*s_objet).nombre_occurrences));
! 488: free(s_objet);
! 489:
! 490: if (depilement(s_etat_processus, &((*s_etat_processus)
! 491: .l_base_pile_taille_contextes), &s_objet) == d_erreur)
! 492: {
! 493: return;
! 494: }
! 495:
! 496: if ((*s_objet).type != INT)
! 497: {
! 498: (*s_etat_processus).erreur_systeme = d_es_contexte;
! 499: return;
! 500: }
! 501:
! 502: if ((*((integer8 *) (*s_objet).objet)) < 0)
! 503: {
! 504: (*s_etat_processus).erreur_systeme = d_es_contexte;
! 505: return;
! 506: }
! 507:
! 508: (*s_etat_processus).hauteur_pile_operationnelle =
! 509: (*((integer8 *) (*s_objet).objet));
! 510: liberation(s_etat_processus, s_objet);
! 511:
! 512: return;
! 513: }
! 514:
! 515:
! 516: /*
! 517: ================================================================================
! 518: Fonction 'peek'
! 519: ================================================================================
! 520: Entrées :
! 521: --------------------------------------------------------------------------------
! 522: Sorties :
! 523: --------------------------------------------------------------------------------
! 524: Effets de bord : néant
! 525: ================================================================================
! 526: */
! 527:
! 528: void
! 529: instruction_peek(struct_processus *s_etat_processus)
! 530: {
! 531: sig_atomic_t registre;
! 532:
! 533: struct_objet *s_objet;
! 534: struct_objet *s_objet_drapeau;
! 535:
! 536: (*s_etat_processus).erreur_execution = d_ex;
! 537:
! 538: if ((*s_etat_processus).affichage_arguments == 'Y')
! 539: {
! 540: printf("\n PEEK ");
! 541:
! 542: if ((*s_etat_processus).langue == 'F')
! 543: {
! 544: printf("(réception de données d'un processus père)\n\n");
! 545: }
! 546: else
! 547: {
! 548: printf("(data reception from parent process)\n\n");
! 549: }
! 550:
! 551: printf("-> 1: %s (0)\n\n", d_INT);
! 552:
! 553: printf("-> 2: %s, %s, %s, %s, %s, %s,\n"
! 554: " %s, %s, %s, %s, %s,\n"
! 555: " %s, %s, %s, %s\n",
! 556: d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX,
! 557: d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN);
! 558: printf(" 1: %s (-1)\n", d_INT);
! 559:
! 560: return;
! 561: }
! 562: else if ((*s_etat_processus).test_instruction == 'Y')
! 563: {
! 564: (*s_etat_processus).nombre_arguments = -1;
! 565: return;
! 566: }
! 567:
! 568: if (test_cfsf(s_etat_processus, 31) == d_vrai)
! 569: {
! 570: if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
! 571: {
! 572: return;
! 573: }
! 574: }
! 575:
! 576: if ((*s_etat_processus).presence_pipes == d_faux)
! 577: {
! 578: (*s_etat_processus).erreur_execution =
! 579: d_ex_absence_processus_pere;
! 580: return;
! 581: }
! 582:
! 583: if ((s_objet_drapeau = allocation(s_etat_processus, INT)) == NULL)
! 584: {
! 585: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 586: return;
! 587: }
! 588:
! 589: if ((*s_etat_processus).nombre_objets_injectes > 0)
! 590: {
! 591: registre = (*s_etat_processus).var_volatile_traitement_retarde_stop;
! 592: (*s_etat_processus).var_volatile_traitement_retarde_stop = 1;
! 593:
! 594: if ((*s_etat_processus).profilage == d_vrai)
! 595: {
! 596: profilage(s_etat_processus, "Interprocess or interthread "
! 597: "communications (PEEK)");
! 598:
! 599: if ((*s_etat_processus).erreur_systeme != d_es)
! 600: {
! 601: return;
! 602: }
! 603: }
! 604:
! 605: if ((s_objet = lecture_pipe(s_etat_processus,
! 606: (*s_etat_processus).pipe_injections)) == NULL)
! 607: {
! 608: if (registre == 0)
! 609: {
! 610: if ((*s_etat_processus).var_volatile_traitement_retarde_stop
! 611: == -1)
! 612: {
! 613: (*s_etat_processus).var_volatile_requete_arret = -1;
! 614: }
! 615:
! 616: (*s_etat_processus).var_volatile_traitement_retarde_stop
! 617: = registre;
! 618: }
! 619:
! 620: if ((*s_etat_processus).profilage == d_vrai)
! 621: {
! 622: profilage(s_etat_processus, NULL);
! 623: }
! 624:
! 625: return;
! 626: }
! 627:
! 628: if ((*s_etat_processus).profilage == d_vrai)
! 629: {
! 630: profilage(s_etat_processus, NULL);
! 631: }
! 632:
! 633: if (registre == 0)
! 634: {
! 635: if ((*s_etat_processus).var_volatile_traitement_retarde_stop == -1)
! 636: {
! 637: (*s_etat_processus).var_volatile_requete_arret = -1;
! 638: }
! 639:
! 640: (*s_etat_processus).var_volatile_traitement_retarde_stop = registre;
! 641: }
! 642:
! 643: (*s_etat_processus).nombre_objets_injectes--;
! 644:
! 645: if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 646: s_objet) == d_erreur)
! 647: {
! 648: return;
! 649: }
! 650:
! 651: (*((integer8 *) (*s_objet_drapeau).objet)) = -1;
! 652: }
! 653: else
! 654: {
! 655: (*((integer8 *) (*s_objet_drapeau).objet)) = 0;
! 656: }
! 657:
! 658: if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 659: s_objet_drapeau) == d_erreur)
! 660: {
! 661: return;
! 662: }
! 663:
! 664: return;
! 665: }
! 666:
! 667:
! 668: /*
! 669: ================================================================================
! 670: Fonction 'poke'
! 671: ================================================================================
! 672: Entrées :
! 673: --------------------------------------------------------------------------------
! 674: Sorties :
! 675: --------------------------------------------------------------------------------
! 676: Effets de bord : néant
! 677: ================================================================================
! 678: */
! 679:
! 680: void
! 681: instruction_poke(struct_processus *s_etat_processus)
! 682: {
! 683: sig_atomic_t registre_stop;
! 684:
! 685: ssize_t longueur_ecriture;
! 686:
! 687: struct sigaction action;
! 688: struct sigaction registre;
! 689:
! 690: struct_liste_chainee *l_element_courant;
! 691:
! 692: struct_objet *s_objet_argument_1;
! 693: struct_objet *s_objet_argument_2;
! 694:
! 695: (*s_etat_processus).erreur_execution = d_ex;
! 696:
! 697: if ((*s_etat_processus).affichage_arguments == 'Y')
! 698: {
! 699: printf("\n POKE ");
! 700:
! 701: if ((*s_etat_processus).langue == 'F')
! 702: {
! 703: printf("(envoi d'une donnée à un processus fils)\n\n");
! 704: }
! 705: else
! 706: {
! 707: printf("(send data to child process)\n\n");
! 708: }
! 709:
! 710: printf(" 2: %s, %s, %s, %s, %s, %s,\n"
! 711: " %s, %s, %s, %s, %s,\n"
! 712: " %s, %s, %s, %s, %s\n",
! 713: d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX,
! 714: d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_TAB);
! 715: printf(" 1: %s\n", d_PRC);
! 716:
! 717: return;
! 718: }
! 719: else if ((*s_etat_processus).test_instruction == 'Y')
! 720: {
! 721: (*s_etat_processus).nombre_arguments = -1;
! 722: return;
! 723: }
! 724:
! 725: if (test_cfsf(s_etat_processus, 31) == d_vrai)
! 726: {
! 727: if (empilement_pile_last(s_etat_processus, 2) == d_erreur)
! 728: {
! 729: return;
! 730: }
! 731: }
! 732:
! 733: if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 734: &s_objet_argument_1) == d_erreur)
! 735: {
! 736: (*s_etat_processus).erreur_execution = d_ex_manque_argument;
! 737: return;
! 738: }
! 739:
! 740: if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 741: &s_objet_argument_2) == d_erreur)
! 742: {
! 743: liberation(s_etat_processus, s_objet_argument_1);
! 744:
! 745: (*s_etat_processus).erreur_execution = d_ex_manque_argument;
! 746: return;
! 747: }
! 748:
! 749: if ((*s_objet_argument_1).type == PRC)
! 750: {
! 751: /*
! 752: * Vérification du type de la donnée transmise
! 753: */
! 754:
! 755: if (((*s_objet_argument_2).type != INT) &&
! 756: ((*s_objet_argument_2).type != REL) &&
! 757: ((*s_objet_argument_2).type != CPL) &&
! 758: ((*s_objet_argument_2).type != VIN) &&
! 759: ((*s_objet_argument_2).type != VRL) &&
! 760: ((*s_objet_argument_2).type != VCX) &&
! 761: ((*s_objet_argument_2).type != MIN) &&
! 762: ((*s_objet_argument_2).type != MRL) &&
! 763: ((*s_objet_argument_2).type != MCX) &&
! 764: ((*s_objet_argument_2).type != BIN) &&
! 765: ((*s_objet_argument_2).type != NOM) &&
! 766: ((*s_objet_argument_2).type != CHN) &&
! 767: ((*s_objet_argument_2).type != LST) &&
! 768: ((*s_objet_argument_2).type != ALG) &&
! 769: ((*s_objet_argument_2).type != RPN) &&
! 770: ((*s_objet_argument_2).type != TBL))
! 771: {
! 772: liberation(s_etat_processus, s_objet_argument_1);
! 773: liberation(s_etat_processus, s_objet_argument_2);
! 774:
! 775: (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
! 776: return;
! 777: }
! 778:
! 779: if (pthread_mutex_lock(&((*s_etat_processus).mutex)) != 0)
! 780: {
! 781: (*s_etat_processus).erreur_systeme = d_es_processus;
! 782: return;
! 783: }
! 784:
! 785: l_element_courant = (struct_liste_chainee *)
! 786: (*s_etat_processus).l_base_pile_processus;
! 787:
! 788: while(l_element_courant != NULL)
! 789: {
! 790: if ((*(*((struct_processus_fils *) (*s_objet_argument_1).objet))
! 791: .thread).processus_detache == d_vrai)
! 792: {
! 793: if ((*(*((struct_processus_fils *) (*(*l_element_courant)
! 794: .donnee).objet)).thread).processus_detache == d_faux)
! 795: {
! 796: l_element_courant = (*l_element_courant).suivant;
! 797: continue;
! 798: }
! 799:
! 800: if ((*(*((struct_processus_fils *) (*s_objet_argument_1).objet))
! 801: .thread).pid == (*(*((struct_processus_fils *)
! 802: (*(*l_element_courant).donnee).objet)).thread).pid)
! 803: {
! 804: // Envoi des données
! 805: // Attention : si le processus n'existe plus, il n'y a plus
! 806: // de lecteur et on peut se prendre un SIGPIPE dans la
! 807: // figure !
! 808:
! 809: action.sa_handler = SIG_IGN;
! 810: action.sa_flags = SA_ONSTACK;
! 811:
! 812: if (sigaction(SIGPIPE, &action, ®istre) != 0)
! 813: {
! 814: pthread_mutex_unlock(&((*s_etat_processus).mutex));
! 815:
! 816: (*s_etat_processus).erreur_systeme = d_es_signal;
! 817: return;
! 818: }
! 819:
! 820: // Validation des données. On envoie un signal pour
! 821: // débloquer les instructions de type WF* pour les
! 822: // lectures bloquantes.
! 823:
! 824: if (kill((*(*((struct_processus_fils *)
! 825: (*(*l_element_courant).donnee).objet))
! 826: .thread).pid, SIGINJECT) != 0)
! 827: {
! 828: // Le processus fils peut s'être terminé.
! 829: break;
! 830: }
! 831:
! 832: registre_stop = (*s_etat_processus)
! 833: .var_volatile_traitement_retarde_stop;
! 834: (*s_etat_processus).var_volatile_traitement_retarde_stop
! 835: = 1;
! 836:
! 837: if ((*s_etat_processus).profilage == d_vrai)
! 838: {
! 839: profilage(s_etat_processus,
! 840: "Interprocess communications (POKE)");
! 841:
! 842: if ((*s_etat_processus).erreur_systeme != d_es)
! 843: {
! 844: pthread_mutex_unlock(&((*s_etat_processus).mutex));
! 845: return;
! 846: }
! 847: }
! 848:
! 849: if (sem_post(&((*s_etat_processus).semaphore_fork))
! 850: != 0)
! 851: {
! 852: (*s_etat_processus).erreur_systeme = d_es_processus;
! 853: return;
! 854: }
! 855:
! 856: while((longueur_ecriture = write_atomic(s_etat_processus,
! 857: (*(*((struct_processus_fils *)
! 858: (*(*l_element_courant).donnee).objet)).thread)
! 859: .pipe_nombre_injections[1], "-",
! 860: sizeof(unsigned char))) != sizeof(unsigned char))
! 861: {
! 862: while(sem_wait(&((*s_etat_processus)
! 863: .semaphore_fork)) == -1)
! 864: {
! 865: if (errno != EINTR)
! 866: {
! 867: (*s_etat_processus).erreur_systeme =
! 868: d_es_processus;
! 869: return;
! 870: }
! 871: }
! 872:
! 873: if (longueur_ecriture == -1)
! 874: {
! 875: pthread_mutex_unlock(&((*s_etat_processus).mutex));
! 876:
! 877: liberation(s_etat_processus, s_objet_argument_1);
! 878: liberation(s_etat_processus, s_objet_argument_2);
! 879:
! 880: if (registre_stop == 0)
! 881: {
! 882: if ((*s_etat_processus)
! 883: .var_volatile_traitement_retarde_stop
! 884: == -1)
! 885: {
! 886: (*s_etat_processus)
! 887: .var_volatile_requete_arret = -1;
! 888: }
! 889:
! 890: (*s_etat_processus)
! 891: .var_volatile_traitement_retarde_stop
! 892: = registre_stop;
! 893: }
! 894:
! 895: if ((*s_etat_processus).profilage == d_vrai)
! 896: {
! 897: profilage(s_etat_processus, NULL);
! 898: }
! 899:
! 900: if (sigaction(SIGPIPE, ®istre, NULL) != 0)
! 901: {
! 902: (*s_etat_processus).erreur_systeme =
! 903: d_es_signal;
! 904: return;
! 905: }
! 906:
! 907: return;
! 908: }
! 909:
! 910: if (sem_post(&((*s_etat_processus)
! 911: .semaphore_fork)) != 0)
! 912: {
! 913: (*s_etat_processus).erreur_systeme = d_es_processus;
! 914: return;
! 915: }
! 916: }
! 917:
! 918: if (ecriture_pipe(s_etat_processus,
! 919: (*(*((struct_processus_fils *)
! 920: (*(*l_element_courant).donnee).objet)).thread)
! 921: .pipe_injections[1], s_objet_argument_2)
! 922: == d_erreur)
! 923: {
! 924: // Le processus fils peut s'être terminé.
! 925:
! 926: if ((*s_etat_processus).erreur_systeme != d_es)
! 927: {
! 928: (*s_etat_processus).erreur_systeme = d_es;
! 929: }
! 930: }
! 931:
! 932: while(sem_wait(&((*s_etat_processus).semaphore_fork))
! 933: == -1)
! 934: {
! 935: if (errno == EINTR)
! 936: {
! 937: (*s_etat_processus).erreur_systeme = d_es_processus;
! 938: return;
! 939: }
! 940: }
! 941:
! 942: if (registre_stop == 0)
! 943: {
! 944: if ((*s_etat_processus)
! 945: .var_volatile_traitement_retarde_stop
! 946: == -1)
! 947: {
! 948: (*s_etat_processus).var_volatile_requete_arret = -1;
! 949: }
! 950:
! 951: (*s_etat_processus).var_volatile_traitement_retarde_stop
! 952: = registre_stop;
! 953: }
! 954:
! 955: if ((*s_etat_processus).profilage == d_vrai)
! 956: {
! 957: profilage(s_etat_processus, NULL);
! 958: }
! 959:
! 960: if (sigaction(SIGPIPE, ®istre, NULL) != 0)
! 961: {
! 962: pthread_mutex_unlock(&((*s_etat_processus).mutex));
! 963:
! 964: (*s_etat_processus).erreur_systeme = d_es_signal;
! 965: return;
! 966: }
! 967:
! 968: break;
! 969: }
! 970: }
! 971: else
! 972: {
! 973: if ((*(*((struct_processus_fils *) (*(*l_element_courant)
! 974: .donnee).objet)).thread).processus_detache == d_vrai)
! 975: {
! 976: l_element_courant = (*l_element_courant).suivant;
! 977: continue;
! 978: }
! 979:
! 980: if (((pthread_equal((*(*((struct_processus_fils *)
! 981: (*s_objet_argument_1).objet)).thread).tid,
! 982: (*(*((struct_processus_fils *)
! 983: (*(*l_element_courant).donnee).objet)).thread).tid)
! 984: != 0)) && ((*(*((struct_processus_fils *)
! 985: (*s_objet_argument_1).objet)).thread).pid ==
! 986: (*(*((struct_processus_fils *)
! 987: (*(*l_element_courant).donnee).objet)).thread).pid))
! 988: {
! 989: // Envoi des données
! 990: // Attention : si le processus n'existe plus, il n'y a plus
! 991: // de lecteur et on peut se prendre un SIGPIPE dans la
! 992: // figure !
! 993:
! 994: action.sa_handler = SIG_IGN;
! 995: action.sa_flags = SA_ONSTACK;
! 996:
! 997: if (sigaction(SIGPIPE, &action, ®istre) != 0)
! 998: {
! 999: pthread_mutex_unlock(&((*s_etat_processus).mutex));
! 1000:
! 1001: (*s_etat_processus).erreur_systeme = d_es_signal;
! 1002: return;
! 1003: }
! 1004:
! 1005: // Validation des données. On envoie un signal pour
! 1006: // débloquer les instructions de type WF* pour les
! 1007: // lectures bloquantes.
! 1008:
! 1009: if (pthread_mutex_lock(&((*(*((struct_processus_fils *)
! 1010: (*(*l_element_courant).donnee).objet)).thread)
! 1011: .mutex)) != 0)
! 1012: {
! 1013: (*s_etat_processus).erreur_systeme = d_es_processus;
! 1014: return;
! 1015: }
! 1016:
! 1017: if ((*(*((struct_processus_fils *)
! 1018: (*(*l_element_courant).donnee).objet)).thread)
! 1019: .thread_actif == d_vrai)
! 1020: {
! 1021: if (pthread_kill((*(*((struct_processus_fils *)
! 1022: (*(*l_element_courant).donnee).objet)).thread)
! 1023: .tid, SIGINJECT) != 0)
! 1024: {
! 1025: // Le processus fils peut s'être terminé.
! 1026:
! 1027: if (pthread_mutex_unlock(
! 1028: &((*(*((struct_processus_fils *)
! 1029: (*(*l_element_courant).donnee).objet))
! 1030: .thread).mutex)) != 0)
! 1031: {
! 1032: (*s_etat_processus).erreur_systeme =
! 1033: d_es_processus;
! 1034: return;
! 1035: }
! 1036:
! 1037: break;
! 1038: }
! 1039: }
! 1040: else
! 1041: {
! 1042: if (pthread_mutex_unlock(
! 1043: &((*(*((struct_processus_fils *)
! 1044: (*(*l_element_courant).donnee).objet))
! 1045: .thread).mutex)) != 0)
! 1046: {
! 1047: (*s_etat_processus).erreur_systeme = d_es_processus;
! 1048: return;
! 1049: }
! 1050:
! 1051: break;
! 1052: }
! 1053:
! 1054: if (pthread_mutex_unlock(&((*(*((struct_processus_fils *)
! 1055: (*(*l_element_courant).donnee).objet)).thread)
! 1056: .mutex)) != 0)
! 1057: {
! 1058: (*s_etat_processus).erreur_systeme = d_es_processus;
! 1059: return;
! 1060: }
! 1061:
! 1062: registre_stop = (*s_etat_processus)
! 1063: .var_volatile_traitement_retarde_stop;
! 1064: (*s_etat_processus).var_volatile_traitement_retarde_stop
! 1065: = 1;
! 1066:
! 1067: if ((*s_etat_processus).profilage == d_vrai)
! 1068: {
! 1069: profilage(s_etat_processus,
! 1070: "Interthread communications (POKE)");
! 1071:
! 1072: if ((*s_etat_processus).erreur_systeme != d_es)
! 1073: {
! 1074: pthread_mutex_unlock(&((*s_etat_processus).mutex));
! 1075: return;
! 1076: }
! 1077: }
! 1078:
! 1079: if (sem_post(&((*s_etat_processus).semaphore_fork))
! 1080: != 0)
! 1081: {
! 1082: (*s_etat_processus).erreur_systeme = d_es_processus;
! 1083: return;
! 1084: }
! 1085:
! 1086: while((longueur_ecriture = write_atomic(s_etat_processus,
! 1087: (*(*((struct_processus_fils *)
! 1088: (*(*l_element_courant).donnee).objet)).thread)
! 1089: .pipe_nombre_injections[1], "-",
! 1090: sizeof(unsigned char))) != sizeof(unsigned char))
! 1091: {
! 1092: while(sem_wait(&((*s_etat_processus)
! 1093: .semaphore_fork)) == -1)
! 1094: {
! 1095: if (errno != EINTR)
! 1096: {
! 1097: (*s_etat_processus).erreur_systeme =
! 1098: d_es_processus;
! 1099: return;
! 1100: }
! 1101: }
! 1102:
! 1103: if (longueur_ecriture == -1)
! 1104: {
! 1105: pthread_mutex_unlock(&((*s_etat_processus).mutex));
! 1106:
! 1107: liberation(s_etat_processus, s_objet_argument_1);
! 1108: liberation(s_etat_processus, s_objet_argument_2);
! 1109:
! 1110: if (registre_stop == 0)
! 1111: {
! 1112: if ((*s_etat_processus)
! 1113: .var_volatile_traitement_retarde_stop
! 1114: == -1)
! 1115: {
! 1116: (*s_etat_processus)
! 1117: .var_volatile_requete_arret = -1;
! 1118: }
! 1119:
! 1120: (*s_etat_processus)
! 1121: .var_volatile_traitement_retarde_stop
! 1122: = registre_stop;
! 1123: }
! 1124:
! 1125: if ((*s_etat_processus).profilage == d_vrai)
! 1126: {
! 1127: profilage(s_etat_processus, NULL);
! 1128: }
! 1129:
! 1130: if (sigaction(SIGPIPE, ®istre, NULL) != 0)
! 1131: {
! 1132: (*s_etat_processus).erreur_systeme =
! 1133: d_es_signal;
! 1134: return;
! 1135: }
! 1136:
! 1137: return;
! 1138: }
! 1139:
! 1140: if (sem_post(&((*s_etat_processus)
! 1141: .semaphore_fork)) != 0)
! 1142: {
! 1143: (*s_etat_processus).erreur_systeme = d_es_processus;
! 1144: return;
! 1145: }
! 1146: }
! 1147:
! 1148: if (ecriture_pipe(s_etat_processus,
! 1149: (*(*((struct_processus_fils *)
! 1150: (*(*l_element_courant).donnee).objet)).thread)
! 1151: .pipe_injections[1], s_objet_argument_2)
! 1152: == d_erreur)
! 1153: {
! 1154: // Le processus fils peut s'être terminé.
! 1155:
! 1156: if ((*s_etat_processus).erreur_systeme != d_es)
! 1157: {
! 1158: (*s_etat_processus).erreur_systeme = d_es;
! 1159: }
! 1160: }
! 1161:
! 1162: while(sem_wait(&((*s_etat_processus)
! 1163: .semaphore_fork)) == -1)
! 1164: {
! 1165: if (errno != EINTR)
! 1166: {
! 1167: (*s_etat_processus).erreur_systeme = d_es_processus;
! 1168: return;
! 1169: }
! 1170: }
! 1171:
! 1172: if (registre_stop == 0)
! 1173: {
! 1174: if ((*s_etat_processus)
! 1175: .var_volatile_traitement_retarde_stop
! 1176: == -1)
! 1177: {
! 1178: (*s_etat_processus).var_volatile_requete_arret = -1;
! 1179: }
! 1180:
! 1181: (*s_etat_processus).var_volatile_traitement_retarde_stop
! 1182: = registre_stop;
! 1183: }
! 1184:
! 1185: if ((*s_etat_processus).profilage == d_vrai)
! 1186: {
! 1187: profilage(s_etat_processus, NULL);
! 1188: }
! 1189:
! 1190: if (sigaction(SIGPIPE, ®istre, NULL) != 0)
! 1191: {
! 1192: pthread_mutex_unlock(&((*s_etat_processus).mutex));
! 1193:
! 1194: (*s_etat_processus).erreur_systeme = d_es_signal;
! 1195: return;
! 1196: }
! 1197:
! 1198: break;
! 1199: }
! 1200: }
! 1201:
! 1202: l_element_courant = (*l_element_courant).suivant;
! 1203: }
! 1204:
! 1205: if (pthread_mutex_unlock(&((*s_etat_processus).mutex)) != 0)
! 1206: {
! 1207: (*s_etat_processus).erreur_systeme = d_es_processus;
! 1208: return;
! 1209: }
! 1210:
! 1211: if (l_element_courant == NULL)
! 1212: {
! 1213: liberation(s_etat_processus, s_objet_argument_1);
! 1214: liberation(s_etat_processus, s_objet_argument_2);
! 1215:
! 1216: (*s_etat_processus).erreur_execution = d_ex_processus;
! 1217: return;
! 1218: }
! 1219: }
! 1220: else
! 1221: {
! 1222: liberation(s_etat_processus, s_objet_argument_1);
! 1223: liberation(s_etat_processus, s_objet_argument_2);
! 1224:
! 1225: (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
! 1226: return;
! 1227: }
! 1228:
! 1229: liberation(s_etat_processus, s_objet_argument_1);
! 1230: liberation(s_etat_processus, s_objet_argument_2);
! 1231:
! 1232: return;
! 1233: }
! 1234:
! 1235:
! 1236: /*
! 1237: ================================================================================
! 1238: Fonction 'private'
! 1239: ================================================================================
! 1240: Entrées :
! 1241: --------------------------------------------------------------------------------
! 1242: Sorties :
! 1243: --------------------------------------------------------------------------------
! 1244: Effets de bord : néant
! 1245: ================================================================================
! 1246: */
! 1247:
! 1248: void
! 1249: instruction_private(struct_processus *s_etat_processus)
! 1250: {
! 1251: struct_liste_chainee *l_element_courant;
! 1252:
! 1253: struct_objet *s_objet;
! 1254:
! 1255: (*s_etat_processus).erreur_execution = d_ex;
! 1256:
! 1257: if ((*s_etat_processus).affichage_arguments == 'Y')
! 1258: {
! 1259: printf("\n PRIVATE ");
! 1260:
! 1261: if ((*s_etat_processus).langue == 'F')
! 1262: {
! 1263: printf("(rend privée une variable partagée)\n\n");
! 1264: }
! 1265: else
! 1266: {
! 1267: printf("(switch a shared variable to private one)\n\n");
! 1268: }
! 1269:
! 1270: printf(" 1: %s, %s\n", d_NOM, d_LST);
! 1271:
! 1272: return;
! 1273: }
! 1274: else if ((*s_etat_processus).test_instruction == 'Y')
! 1275: {
! 1276: (*s_etat_processus).nombre_arguments = -1;
! 1277: return;
! 1278: }
! 1279:
! 1280: if (test_cfsf(s_etat_processus, 31) == d_vrai)
! 1281: {
! 1282: if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
! 1283: {
! 1284: return;
! 1285: }
! 1286: }
! 1287:
! 1288: if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 1289: &s_objet) == d_erreur)
! 1290: {
! 1291: (*s_etat_processus).erreur_execution = d_ex_manque_argument;
! 1292: return;
! 1293: }
! 1294:
! 1295: if ((*s_objet).type == NOM)
! 1296: {
! 1297: if (recherche_variable(s_etat_processus, ((*((struct_nom *)
! 1298: (*s_objet).objet)).nom)) == d_faux)
! 1299: {
! 1300: liberation(s_etat_processus, s_objet);
! 1301:
! 1302: (*s_etat_processus).erreur_systeme = d_es;
! 1303: (*s_etat_processus).erreur_execution = d_ex_variable_non_definie;
! 1304: return;
! 1305: }
! 1306:
! 1307: if (pthread_mutex_lock(&((*(*s_etat_processus)
! 1308: .s_liste_variables_partagees).mutex)) != 0)
! 1309: {
! 1310: (*s_etat_processus).erreur_systeme = d_es_processus;
! 1311: return;
! 1312: }
! 1313:
! 1314: if (recherche_variable_partagee(s_etat_processus, ((*((struct_nom *)
! 1315: (*s_objet).objet)).nom), ((*s_etat_processus).s_liste_variables
! 1316: [(*s_etat_processus).position_variable_courante])
! 1317: .variable_partagee, ((*s_etat_processus).s_liste_variables
! 1318: [(*s_etat_processus).position_variable_courante]).origine)
! 1319: == d_faux)
! 1320: {
! 1321: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 1322: .s_liste_variables_partagees).mutex)) != 0)
! 1323: {
! 1324: (*s_etat_processus).erreur_systeme = d_es_processus;
! 1325: return;
! 1326: }
! 1327:
! 1328: liberation(s_etat_processus, s_objet);
! 1329:
! 1330: (*s_etat_processus).erreur_systeme = d_es;
! 1331: return;
! 1332: }
! 1333:
! 1334: (*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 1335: .position_variable_courante].objet =
! 1336: (*(*s_etat_processus).s_liste_variables_partagees).table
! 1337: [(*(*s_etat_processus).s_liste_variables_partagees)
! 1338: .position_variable].objet;
! 1339: (*(*s_etat_processus).s_liste_variables_partagees).table
! 1340: [(*(*s_etat_processus).s_liste_variables_partagees)
! 1341: .position_variable].objet = NULL;
! 1342:
! 1343: if (retrait_variable_partagee(s_etat_processus,
! 1344: (*((struct_nom *) (*s_objet).objet)).nom,
! 1345: (*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 1346: .position_variable_courante].variable_partagee) == d_erreur)
! 1347: {
! 1348: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 1349: .s_liste_variables_partagees).mutex)) != 0)
! 1350: {
! 1351: (*s_etat_processus).erreur_systeme = d_es_processus;
! 1352: return;
! 1353: }
! 1354:
! 1355: liberation(s_etat_processus, s_objet);
! 1356: return;
! 1357: }
! 1358:
! 1359: if ((*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 1360: .position_variable_courante].origine == 'P')
! 1361: {
! 1362: (*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 1363: .position_variable_courante].variable_partagee.adresse = 0;
! 1364: }
! 1365: else
! 1366: {
! 1367: (*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 1368: .position_variable_courante].variable_partagee.pointeur
! 1369: = NULL;
! 1370: }
! 1371:
! 1372: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 1373: .s_liste_variables_partagees).mutex)) != 0)
! 1374: {
! 1375: (*s_etat_processus).erreur_systeme = d_es_processus;
! 1376: return;
! 1377: }
! 1378: }
! 1379: else if ((*s_objet).type == LST)
! 1380: {
! 1381: l_element_courant = (struct_liste_chainee *) (*s_objet).objet;
! 1382:
! 1383: while(l_element_courant != NULL)
! 1384: {
! 1385: if ((*(*l_element_courant).donnee).type != NOM)
! 1386: {
! 1387: liberation(s_etat_processus, s_objet);
! 1388:
! 1389: (*s_etat_processus).erreur_execution = d_ex_nom_invalide;
! 1390: return;
! 1391: }
! 1392:
! 1393: if (recherche_variable(s_etat_processus, ((*((struct_nom *)
! 1394: (*s_objet).objet)).nom)) == d_faux)
! 1395: {
! 1396: liberation(s_etat_processus, s_objet);
! 1397:
! 1398: (*s_etat_processus).erreur_systeme = d_es;
! 1399: (*s_etat_processus).erreur_execution =
! 1400: d_ex_variable_non_definie;
! 1401: return;
! 1402: }
! 1403:
! 1404: if (pthread_mutex_lock(&((*(*s_etat_processus)
! 1405: .s_liste_variables_partagees).mutex)) != 0)
! 1406: {
! 1407: (*s_etat_processus).erreur_systeme = d_es_processus;
! 1408: return;
! 1409: }
! 1410:
! 1411: if (recherche_variable_partagee(s_etat_processus, ((*((struct_nom *)
! 1412: (*s_objet).objet)).nom), ((*s_etat_processus)
! 1413: .s_liste_variables[(*s_etat_processus)
! 1414: .position_variable_courante]).variable_partagee,
! 1415: ((*s_etat_processus).s_liste_variables
! 1416: [(*s_etat_processus).position_variable_courante]).origine)
! 1417: == d_faux)
! 1418: {
! 1419: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 1420: .s_liste_variables_partagees).mutex)) != 0)
! 1421: {
! 1422: (*s_etat_processus).erreur_systeme = d_es_processus;
! 1423: return;
! 1424: }
! 1425:
! 1426: liberation(s_etat_processus, s_objet);
! 1427:
! 1428: (*s_etat_processus).erreur_systeme = d_es;
! 1429: (*s_etat_processus).erreur_execution =
! 1430: d_ex_variable_non_definie;
! 1431: return;
! 1432: }
! 1433:
! 1434: (*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 1435: .position_variable_courante].objet =
! 1436: (*(*s_etat_processus).s_liste_variables_partagees).table
! 1437: [(*(*s_etat_processus).s_liste_variables_partagees)
! 1438: .position_variable].objet;
! 1439: (*(*s_etat_processus).s_liste_variables_partagees).table
! 1440: [(*(*s_etat_processus).s_liste_variables_partagees)
! 1441: .position_variable].objet = NULL;
! 1442:
! 1443: if ((*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 1444: .position_variable_courante].origine == 'P')
! 1445: {
! 1446: (*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 1447: .position_variable_courante].variable_partagee.adresse
! 1448: = 0;
! 1449: }
! 1450: else
! 1451: {
! 1452: (*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 1453: .position_variable_courante].variable_partagee.pointeur
! 1454: = NULL;
! 1455: }
! 1456:
! 1457: if (retrait_variable_partagee(s_etat_processus,
! 1458: (*((struct_nom *) (*s_objet).objet)).nom,
! 1459: (*s_etat_processus).s_liste_variables[(*s_etat_processus)
! 1460: .position_variable_courante].variable_statique) == d_erreur)
! 1461: {
! 1462: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 1463: .s_liste_variables_partagees).mutex)) != 0)
! 1464: {
! 1465: (*s_etat_processus).erreur_systeme = d_es_processus;
! 1466: return;
! 1467: }
! 1468:
! 1469: liberation(s_etat_processus, s_objet);
! 1470: return;
! 1471: }
! 1472:
! 1473: if (pthread_mutex_unlock(&((*(*s_etat_processus)
! 1474: .s_liste_variables_partagees).mutex)) != 0)
! 1475: {
! 1476: (*s_etat_processus).erreur_systeme = d_es_processus;
! 1477: return;
! 1478: }
! 1479:
! 1480: l_element_courant = (*l_element_courant).suivant;
! 1481: }
! 1482: }
! 1483: else
! 1484: {
! 1485: liberation(s_etat_processus, s_objet);
! 1486:
! 1487: (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
! 1488: return;
! 1489: }
! 1490:
! 1491: liberation(s_etat_processus, s_objet);
! 1492:
! 1493: return;
! 1494: }
! 1495:
! 1496:
! 1497: /*
! 1498: ================================================================================
! 1499: Fonction 'pshprfl'
! 1500: ================================================================================
! 1501: Entrées : pointeur sur une structure struct_processus
! 1502: --------------------------------------------------------------------------------
! 1503: Sorties :
! 1504: --------------------------------------------------------------------------------
! 1505: Effets de bord : néant
! 1506: ================================================================================
! 1507: */
! 1508:
! 1509: void
! 1510: instruction_pshprfl(struct_processus *s_etat_processus)
! 1511: {
! 1512: struct_objet *s_objet_argument;
! 1513:
! 1514: (*s_etat_processus).erreur_execution = d_ex;
! 1515:
! 1516: if ((*s_etat_processus).affichage_arguments == 'Y')
! 1517: {
! 1518: printf("\n PSHPRFL ");
! 1519:
! 1520: if ((*s_etat_processus).langue == 'F')
! 1521: {
! 1522: printf("(empilement d'un point de profilage)\n\n");
! 1523: }
! 1524: else
! 1525: {
! 1526: printf("(push profile data)\n\n");
! 1527: }
! 1528:
! 1529: printf(" 1: %s\n", d_CHN);
! 1530:
! 1531: return;
! 1532: }
! 1533: else if ((*s_etat_processus).test_instruction == 'Y')
! 1534: {
! 1535: (*s_etat_processus).nombre_arguments = -1;
! 1536: return;
! 1537: }
! 1538:
! 1539: if (test_cfsf(s_etat_processus, 31) == d_vrai)
! 1540: {
! 1541: if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
! 1542: {
! 1543: return;
! 1544: }
! 1545: }
! 1546:
! 1547: if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 1548: &s_objet_argument) == d_erreur)
! 1549: {
! 1550: (*s_etat_processus).erreur_execution = d_ex_manque_argument;
! 1551: return;
! 1552: }
! 1553:
! 1554: if ((*s_objet_argument).type == CHN)
! 1555: {
! 1556: if ((*s_etat_processus).profilage == d_vrai)
! 1557: {
! 1558: profilage(s_etat_processus, (unsigned char *)
! 1559: (*s_objet_argument).objet);
! 1560: }
! 1561: }
! 1562: else
! 1563: {
! 1564: liberation(s_etat_processus, s_objet_argument);
! 1565:
! 1566: (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
! 1567: return;
! 1568: }
! 1569:
! 1570: liberation(s_etat_processus, s_objet_argument);
! 1571:
! 1572: return;
! 1573: }
! 1574:
! 1575:
! 1576: /*
! 1577: ================================================================================
! 1578: Fonction 'pulprfl'
! 1579: ================================================================================
! 1580: Entrées : pointeur sur une structure struct_processus
! 1581: --------------------------------------------------------------------------------
! 1582: Sorties :
! 1583: --------------------------------------------------------------------------------
! 1584: Effets de bord : néant
! 1585: ================================================================================
! 1586: */
! 1587:
! 1588: void
! 1589: instruction_pulprfl(struct_processus *s_etat_processus)
! 1590: {
! 1591: (*s_etat_processus).erreur_execution = d_ex;
! 1592:
! 1593: if ((*s_etat_processus).affichage_arguments == 'Y')
! 1594: {
! 1595: printf("\n PULPRFL ");
! 1596:
! 1597: if ((*s_etat_processus).langue == 'F')
! 1598: {
! 1599: printf("(dépilement d'un point de profilage)\n\n");
! 1600: printf(" Aucun argument\n");
! 1601: }
! 1602: else
! 1603: {
! 1604: printf("(pull profile data)\n\n");
! 1605: printf(" No argument\n");
! 1606: }
! 1607:
! 1608: return;
! 1609: }
! 1610: else if ((*s_etat_processus).test_instruction == 'Y')
! 1611: {
! 1612: (*s_etat_processus).nombre_arguments = -1;
! 1613: return;
! 1614: }
! 1615:
! 1616: if (test_cfsf(s_etat_processus, 31) == d_vrai)
! 1617: {
! 1618: if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
! 1619: {
! 1620: return;
! 1621: }
! 1622: }
! 1623:
! 1624: if ((*s_etat_processus).profilage == d_vrai)
! 1625: {
! 1626: profilage(s_etat_processus, NULL);
! 1627: }
! 1628:
! 1629: return;
! 1630: }
! 1631:
! 1632:
! 1633: /*
! 1634: ================================================================================
! 1635: Fonction 'plot'
! 1636: ================================================================================
! 1637: Entrées : pointeur sur une structure struct_processus
! 1638: --------------------------------------------------------------------------------
! 1639: Sorties :
! 1640: --------------------------------------------------------------------------------
! 1641: Effets de bord : néant
! 1642: ================================================================================
! 1643: */
! 1644:
! 1645: void
! 1646: instruction_plot(struct_processus *s_etat_processus)
! 1647: {
! 1648: (*s_etat_processus).erreur_execution = d_ex;
! 1649:
! 1650: if ((*s_etat_processus).affichage_arguments == 'Y')
! 1651: {
! 1652: printf("\n PLOT ");
! 1653:
! 1654: if ((*s_etat_processus).langue == 'F')
! 1655: {
! 1656: printf("(affiche les données graphiques mémorisées)\n\n");
! 1657: printf(" Aucun argument\n");
! 1658: }
! 1659: else
! 1660: {
! 1661: printf("(plot buffered graphic)\n\n");
! 1662: printf(" No argument\n");
! 1663: }
! 1664:
! 1665: return;
! 1666: }
! 1667: else if ((*s_etat_processus).test_instruction == 'Y')
! 1668: {
! 1669: (*s_etat_processus).nombre_arguments = -1;
! 1670: return;
! 1671: }
! 1672:
! 1673: if (test_cfsf(s_etat_processus, 31) == d_vrai)
! 1674: {
! 1675: if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
! 1676: {
! 1677: return;
! 1678: }
! 1679: }
! 1680:
! 1681: if ((*s_etat_processus).fichiers_graphiques != NULL)
! 1682: {
! 1683: appel_gnuplot(s_etat_processus, 'N');
! 1684: }
! 1685:
! 1686: (*s_etat_processus).mise_a_jour_trace_requise = d_faux;
! 1687:
! 1688: return;
! 1689: }
! 1690:
! 1691: // vim: ts=4
CVSweb interface <joel.bertrand@systella.fr>