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