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