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_variable_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_variable_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 (pthread_mutex_lock(&((*(*s_etat_processus)
984: .s_liste_variables_partagees).mutex)) != 0)
985: {
986: (*s_etat_processus).erreur_systeme = d_es_processus;
987: return;
988: }
989:
990: if (recherche_variable_partagee(s_etat_processus,
991: (*(*s_etat_processus).pointeur_variable_courante).nom,
992: (*(*s_etat_processus).pointeur_variable_courante)
993: .variable_partagee, (*(*s_etat_processus)
994: .pointeur_variable_courante).origine)
995: == d_faux)
996: {
997: if (pthread_mutex_unlock(&((*(*s_etat_processus)
998: .s_liste_variables_partagees).mutex)) != 0)
999: {
1000: (*s_etat_processus).erreur_systeme = d_es_processus;
1001: return;
1002: }
1003:
1004: (*s_etat_processus).erreur_systeme = d_es;
1005: (*s_etat_processus).erreur_execution =
1006: d_ex_variable_non_definie;
1007:
1008: liberation(s_etat_processus, s_objet_dimensions);
1009:
1010: return;
1011: }
1012:
1013: variable_partagee = d_vrai;
1014: }
1015: }
1016: else
1017: {
1018: argument_nom = d_faux;
1019: }
1020:
1021: if ((*s_objet_dimensions).type != LST)
1022: {
1023: if (variable_partagee == d_vrai)
1024: {
1025: if (pthread_mutex_unlock(&((*(*s_etat_processus)
1026: .s_liste_variables_partagees).mutex)) != 0)
1027: {
1028: (*s_etat_processus).erreur_systeme = d_es_processus;
1029: return;
1030: }
1031: }
1032:
1033: liberation(s_etat_processus, s_objet_dimensions);
1034:
1035: if (argument_nom == d_faux)
1036: {
1037: liberation(s_etat_processus, s_objet_initial);
1038: }
1039:
1040: (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
1041: return;
1042: }
1043:
1044: l_element_courant = (*s_objet_dimensions).objet;
1045: nombre_dimensions = 0;
1046:
1047: while(l_element_courant != NULL)
1048: {
1049: nombre_dimensions++;
1050: l_element_courant = (*l_element_courant).suivant;
1051: }
1052:
1053: if ((nombre_dimensions != 1) && (nombre_dimensions != 2))
1054: {
1055: if (variable_partagee == d_vrai)
1056: {
1057: if (pthread_mutex_unlock(&((*(*s_etat_processus)
1058: .s_liste_variables_partagees).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_dimensions_invalides;
1073: return;
1074: }
1075:
1076: nombre_colonnes = 0;
1077: nombre_lignes = 0;
1078:
1079: l_element_courant = (*s_objet_dimensions).objet;
1080:
1081: while(l_element_courant != NULL)
1082: {
1083: if ((*(*l_element_courant).donnee).type != INT)
1084: {
1085: if (variable_partagee == d_vrai)
1086: {
1087: if (pthread_mutex_unlock(&((*(*s_etat_processus)
1088: .s_liste_variables_partagees).mutex)) != 0)
1089: {
1090: (*s_etat_processus).erreur_systeme = d_es_processus;
1091: return;
1092: }
1093: }
1094:
1095: liberation(s_etat_processus, s_objet_dimensions);
1096:
1097: if (argument_nom == d_faux)
1098: {
1099: liberation(s_etat_processus, s_objet_initial);
1100: }
1101:
1102: (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
1103: return;
1104: }
1105:
1106: if ((*((integer8 *) (*(*l_element_courant).donnee).objet)) <= 0)
1107: {
1108: if (variable_partagee == d_vrai)
1109: {
1110: if (pthread_mutex_unlock(&((*(*s_etat_processus)
1111: .s_liste_variables_partagees).mutex)) != 0)
1112: {
1113: (*s_etat_processus).erreur_systeme = d_es_processus;
1114: return;
1115: }
1116: }
1117:
1118: liberation(s_etat_processus, s_objet_dimensions);
1119:
1120: if (argument_nom == d_faux)
1121: {
1122: liberation(s_etat_processus, s_objet_initial);
1123: }
1124:
1125: (*s_etat_processus).erreur_execution = d_ex_argument_invalide;
1126: return;
1127: }
1128:
1129: if (nombre_lignes == 0)
1130: {
1131: nombre_lignes = (*((integer8 *)
1132: (*(*l_element_courant).donnee).objet));
1133: }
1134: else
1135: {
1136: nombre_colonnes = (*((integer8 *)
1137: (*(*l_element_courant).donnee).objet));
1138: }
1139:
1140: l_element_courant = (*l_element_courant).suivant;
1141: }
1142:
1143: if ((s_objet_redimensionne = allocation(s_etat_processus, NON)) == NULL)
1144: {
1145: if (variable_partagee == d_vrai)
1146: {
1147: if (pthread_mutex_unlock(&((*(*s_etat_processus)
1148: .s_liste_variables_partagees).mutex)) != 0)
1149: {
1150: (*s_etat_processus).erreur_systeme = d_es_processus;
1151: return;
1152: }
1153: }
1154:
1155: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
1156: return;
1157: }
1158:
1159: /*
1160: --------------------------------------------------------------------------------
1161: Redimensionnement aboutissant à un vecteur
1162: --------------------------------------------------------------------------------
1163: */
1164:
1165: if (nombre_dimensions == 1)
1166: {
1167: if ((*s_objet_initial).type == VIN)
1168: {
1169: (*s_objet_redimensionne).type = VIN;
1170:
1171: if (((*s_objet_redimensionne).objet =
1172: malloc(sizeof(struct_vecteur))) == NULL)
1173: {
1174: if (variable_partagee == d_vrai)
1175: {
1176: if (pthread_mutex_unlock(&((*(*s_etat_processus)
1177: .s_liste_variables_partagees).mutex)) != 0)
1178: {
1179: (*s_etat_processus).erreur_systeme = d_es_processus;
1180: return;
1181: }
1182: }
1183:
1184: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
1185: return;
1186: }
1187:
1188: (*((struct_vecteur *) (*s_objet_redimensionne).objet)).type = 'I';
1189: (*((struct_vecteur *) (*s_objet_redimensionne).objet)).taille =
1190: nombre_lignes;
1191:
1192: if (((*((struct_vecteur *) (*s_objet_redimensionne).objet)).tableau
1193: = malloc(nombre_lignes * sizeof(integer8))) == NULL)
1194: {
1195: if (variable_partagee == d_vrai)
1196: {
1197: if (pthread_mutex_unlock(&((*(*s_etat_processus)
1198: .s_liste_variables_partagees).mutex)) != 0)
1199: {
1200: (*s_etat_processus).erreur_systeme = d_es_processus;
1201: return;
1202: }
1203: }
1204:
1205: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
1206: return;
1207: }
1208:
1209: for(i = 0; i < nombre_lignes; i++)
1210: {
1211: if (i < (*((struct_vecteur *) (*s_objet_initial).objet)).taille)
1212: {
1213: ((integer8 *) (*((struct_vecteur *)
1214: (*s_objet_redimensionne).objet)).tableau)[i] =
1215: ((integer8 *) (*((struct_vecteur *)
1216: (*s_objet_initial).objet)).tableau)[i];
1217: }
1218: else
1219: {
1220: ((integer8 *) (*((struct_vecteur *)
1221: (*s_objet_redimensionne).objet)).tableau)[i] = 0;
1222: }
1223: }
1224: }
1225: else if ((*s_objet_initial).type == VRL)
1226: {
1227: (*s_objet_redimensionne).type = VRL;
1228:
1229: if (((*s_objet_redimensionne).objet =
1230: malloc(sizeof(struct_vecteur))) == NULL)
1231: {
1232: if (variable_partagee == d_vrai)
1233: {
1234: if (pthread_mutex_unlock(&((*(*s_etat_processus)
1235: .s_liste_variables_partagees).mutex)) != 0)
1236: {
1237: (*s_etat_processus).erreur_systeme = d_es_processus;
1238: return;
1239: }
1240: }
1241:
1242: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
1243: return;
1244: }
1245:
1246: (*((struct_vecteur *) (*s_objet_redimensionne).objet)).type = 'R';
1247: (*((struct_vecteur *) (*s_objet_redimensionne).objet)).taille =
1248: nombre_lignes;
1249:
1250: if (((*((struct_vecteur *) (*s_objet_redimensionne).objet)).tableau
1251: = malloc(nombre_lignes * sizeof(real8))) == NULL)
1252: {
1253: if (variable_partagee == d_vrai)
1254: {
1255: if (pthread_mutex_unlock(&((*(*s_etat_processus)
1256: .s_liste_variables_partagees).mutex)) != 0)
1257: {
1258: (*s_etat_processus).erreur_systeme = d_es_processus;
1259: return;
1260: }
1261: }
1262:
1263: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
1264: return;
1265: }
1266:
1267: for(i = 0; i < nombre_lignes; i++)
1268: {
1269: if (i < (*((struct_vecteur *) (*s_objet_initial).objet)).taille)
1270: {
1271: ((real8 *) (*((struct_vecteur *)
1272: (*s_objet_redimensionne).objet)).tableau)[i] =
1273: ((real8 *) (*((struct_vecteur *)
1274: (*s_objet_initial).objet)).tableau)[i];
1275: }
1276: else
1277: {
1278: ((real8 *) (*((struct_vecteur *)
1279: (*s_objet_redimensionne).objet)).tableau)[i] =
1280: (real8) 0;
1281: }
1282: }
1283: }
1284: else if ((*s_objet_initial).type == VCX)
1285: {
1286: (*s_objet_redimensionne).type = VCX;
1287:
1288: if (((*s_objet_redimensionne).objet =
1289: malloc(sizeof(struct_vecteur))) == NULL)
1290: {
1291: if (variable_partagee == d_vrai)
1292: {
1293: if (pthread_mutex_unlock(&((*(*s_etat_processus)
1294: .s_liste_variables_partagees).mutex)) != 0)
1295: {
1296: (*s_etat_processus).erreur_systeme = d_es_processus;
1297: return;
1298: }
1299: }
1300:
1301: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
1302: return;
1303: }
1304:
1305: (*((struct_vecteur *) (*s_objet_redimensionne).objet)).type = 'C';
1306: (*((struct_vecteur *) (*s_objet_redimensionne).objet)).taille =
1307: nombre_lignes;
1308:
1309: if (((*((struct_vecteur *) (*s_objet_redimensionne).objet)).tableau
1310: = malloc(nombre_lignes * sizeof(struct_complexe16)))
1311: == NULL)
1312: {
1313: if (variable_partagee == d_vrai)
1314: {
1315: if (pthread_mutex_unlock(&((*(*s_etat_processus)
1316: .s_liste_variables_partagees).mutex)) != 0)
1317: {
1318: (*s_etat_processus).erreur_systeme = d_es_processus;
1319: return;
1320: }
1321: }
1322:
1323: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
1324: return;
1325: }
1326:
1327: for(i = 0; i < nombre_lignes; i++)
1328: {
1329: if (i < (*((struct_vecteur *) (*s_objet_initial).objet)).taille)
1330: {
1331: ((struct_complexe16 *) (*((struct_vecteur *)
1332: (*s_objet_redimensionne).objet)).tableau)[i]
1333: .partie_reelle = ((struct_complexe16 *)
1334: (*((struct_vecteur *) (*s_objet_initial).objet))
1335: .tableau)[i].partie_reelle;
1336: ((struct_complexe16 *) (*((struct_vecteur *)
1337: (*s_objet_redimensionne).objet)).tableau)[i]
1338: .partie_imaginaire = ((struct_complexe16 *)
1339: (*((struct_vecteur *) (*s_objet_initial).objet))
1340: .tableau)[i].partie_imaginaire;
1341: }
1342: else
1343: {
1344: ((struct_complexe16 *) (*((struct_vecteur *)
1345: (*s_objet_redimensionne).objet)).tableau)[i]
1346: .partie_reelle = (real8) 0;
1347: ((struct_complexe16 *) (*((struct_vecteur *)
1348: (*s_objet_redimensionne).objet)).tableau)[i]
1349: .partie_imaginaire = (real8) 0;
1350: }
1351: }
1352: }
1353: else if ((*s_objet_initial).type == MIN)
1354: {
1355: (*s_objet_redimensionne).type = VIN;
1356:
1357: if (((*s_objet_redimensionne).objet =
1358: malloc(sizeof(struct_vecteur))) == NULL)
1359: {
1360: if (variable_partagee == d_vrai)
1361: {
1362: if (pthread_mutex_unlock(&((*(*s_etat_processus)
1363: .s_liste_variables_partagees).mutex)) != 0)
1364: {
1365: (*s_etat_processus).erreur_systeme = d_es_processus;
1366: return;
1367: }
1368: }
1369:
1370: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
1371: return;
1372: }
1373:
1374: (*((struct_vecteur *) (*s_objet_redimensionne).objet)).type = 'I';
1375: (*((struct_vecteur *) (*s_objet_redimensionne).objet)).taille =
1376: nombre_lignes;
1377:
1378: if (((*((struct_vecteur *) (*s_objet_redimensionne).objet)).tableau
1379: = malloc(nombre_lignes * sizeof(integer8))) == NULL)
1380: {
1381: if (variable_partagee == d_vrai)
1382: {
1383: if (pthread_mutex_unlock(&((*(*s_etat_processus)
1384: .s_liste_variables_partagees).mutex)) != 0)
1385: {
1386: (*s_etat_processus).erreur_systeme = d_es_processus;
1387: return;
1388: }
1389: }
1390:
1391: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
1392: return;
1393: }
1394:
1395: drapeau_fin_objet_originel = d_faux;
1396: for(i = 0, j = 0, k = 0; i < nombre_lignes; i++)
1397: {
1398: if (drapeau_fin_objet_originel == d_faux)
1399: {
1400: ((integer8 *) (*((struct_vecteur *)
1401: (*s_objet_redimensionne).objet)).tableau)[i] =
1402: ((integer8 **) (*((struct_matrice *)
1403: (*s_objet_initial).objet)).tableau)[j][k];
1404:
1405: if ((++k) >= (*((struct_matrice *) (*s_objet_initial)
1406: .objet)).nombre_colonnes)
1407: {
1408: k = 0;
1409:
1410: if ((++j) >= (*((struct_matrice *) (*s_objet_initial)
1411: .objet)).nombre_lignes)
1412: {
1413: drapeau_fin_objet_originel = d_vrai;
1414: }
1415: }
1416: }
1417: else
1418: {
1419: ((integer8 *) (*((struct_vecteur *)
1420: (*s_objet_redimensionne).objet)).tableau)[i] = 0;
1421: }
1422: }
1423: }
1424: else if ((*s_objet_initial).type == MRL)
1425: {
1426: (*s_objet_redimensionne).type = VRL;
1427:
1428: if (((*s_objet_redimensionne).objet =
1429: malloc(sizeof(struct_vecteur))) == NULL)
1430: {
1431: if (variable_partagee == d_vrai)
1432: {
1433: if (pthread_mutex_unlock(&((*(*s_etat_processus)
1434: .s_liste_variables_partagees).mutex)) != 0)
1435: {
1436: (*s_etat_processus).erreur_systeme = d_es_processus;
1437: return;
1438: }
1439: }
1440:
1441: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
1442: return;
1443: }
1444:
1445: (*((struct_vecteur *) (*s_objet_redimensionne).objet)).type = 'R';
1446: (*((struct_vecteur *) (*s_objet_redimensionne).objet)).taille =
1447: nombre_lignes;
1448:
1449: if (((*((struct_vecteur *) (*s_objet_redimensionne).objet)).tableau
1450: = malloc(nombre_lignes * sizeof(real8))) == NULL)
1451: {
1452: if (variable_partagee == d_vrai)
1453: {
1454: if (pthread_mutex_unlock(&((*(*s_etat_processus)
1455: .s_liste_variables_partagees).mutex)) != 0)
1456: {
1457: (*s_etat_processus).erreur_systeme = d_es_processus;
1458: return;
1459: }
1460: }
1461:
1462: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
1463: return;
1464: }
1465:
1466: drapeau_fin_objet_originel = d_faux;
1467: for(i = 0, j = 0, k = 0; i < nombre_lignes; i++)
1468: {
1469: if (drapeau_fin_objet_originel == d_faux)
1470: {
1471: ((real8 *) (*((struct_vecteur *)
1472: (*s_objet_redimensionne).objet)).tableau)[i] =
1473: ((real8 **) (*((struct_matrice *)
1474: (*s_objet_initial).objet)).tableau)[j][k];
1475:
1476: if ((++k) >= (*((struct_matrice *) (*s_objet_initial)
1477: .objet)).nombre_colonnes)
1478: {
1479: k = 0;
1480:
1481: if ((++j) >= (*((struct_matrice *) (*s_objet_initial)
1482: .objet)).nombre_lignes)
1483: {
1484: drapeau_fin_objet_originel = d_vrai;
1485: }
1486: }
1487: }
1488: else
1489: {
1490: ((real8 *) (*((struct_vecteur *)
1491: (*s_objet_redimensionne).objet)).tableau)[i] =
1492: (real8) 0;
1493: }
1494: }
1495: }
1496: else if ((*s_objet_initial).type == MCX)
1497: {
1498: (*s_objet_redimensionne).type = VCX;
1499:
1500: if (((*s_objet_redimensionne).objet =
1501: malloc(sizeof(struct_vecteur))) == NULL)
1502: {
1503: if (variable_partagee == d_vrai)
1504: {
1505: if (pthread_mutex_unlock(&((*(*s_etat_processus)
1506: .s_liste_variables_partagees).mutex)) != 0)
1507: {
1508: (*s_etat_processus).erreur_systeme = d_es_processus;
1509: return;
1510: }
1511: }
1512:
1513: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
1514: return;
1515: }
1516:
1517: (*((struct_vecteur *) (*s_objet_redimensionne).objet)).type = 'C';
1518: (*((struct_vecteur *) (*s_objet_redimensionne).objet)).taille =
1519: nombre_lignes;
1520:
1521: if (((*((struct_vecteur *) (*s_objet_redimensionne).objet)).tableau
1522: = malloc(nombre_lignes * sizeof(struct_complexe16)))
1523: == NULL)
1524: {
1525: if (variable_partagee == d_vrai)
1526: {
1527: if (pthread_mutex_unlock(&((*(*s_etat_processus)
1528: .s_liste_variables_partagees).mutex)) != 0)
1529: {
1530: (*s_etat_processus).erreur_systeme = d_es_processus;
1531: return;
1532: }
1533: }
1534:
1535: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
1536: return;
1537: }
1538:
1539: drapeau_fin_objet_originel = d_faux;
1540: for(i = 0, j = 0, k = 0; i < nombre_lignes; i++)
1541: {
1542: if (drapeau_fin_objet_originel == d_faux)
1543: {
1544: ((struct_complexe16 *) (*((struct_vecteur *)
1545: (*s_objet_redimensionne).objet)).tableau)[i]
1546: .partie_reelle = ((struct_complexe16 **)
1547: (*((struct_matrice *) (*s_objet_initial).objet))
1548: .tableau)[j][k].partie_reelle;
1549: ((struct_complexe16 *) (*((struct_vecteur *)
1550: (*s_objet_redimensionne).objet)).tableau)[i]
1551: .partie_imaginaire = ((struct_complexe16 **)
1552: (*((struct_matrice *) (*s_objet_initial).objet))
1553: .tableau)[j][k].partie_imaginaire;
1554:
1555: if ((++k) >= (*((struct_matrice *) (*s_objet_initial)
1556: .objet)).nombre_colonnes)
1557: {
1558: k = 0;
1559:
1560: if ((++j) >= (*((struct_matrice *) (*s_objet_initial)
1561: .objet)).nombre_lignes)
1562: {
1563: drapeau_fin_objet_originel = d_vrai;
1564: }
1565: }
1566: }
1567: else
1568: {
1569: ((struct_complexe16 *) (*((struct_vecteur *)
1570: (*s_objet_redimensionne).objet)).tableau)[i]
1571: .partie_reelle = 0;
1572: ((struct_complexe16 *) (*((struct_vecteur *)
1573: (*s_objet_redimensionne).objet)).tableau)[i]
1574: .partie_imaginaire = 0;
1575: }
1576: }
1577: }
1578: else
1579: {
1580: if (variable_partagee == d_vrai)
1581: {
1582: if (pthread_mutex_unlock(&((*(*s_etat_processus)
1583: .s_liste_variables_partagees).mutex)) != 0)
1584: {
1585: (*s_etat_processus).erreur_systeme = d_es_processus;
1586: return;
1587: }
1588: }
1589:
1590: if (argument_nom == d_faux)
1591: {
1592: liberation(s_etat_processus, s_objet_initial);
1593: }
1594:
1595: liberation(s_etat_processus, s_objet_dimensions);
1596: free(s_objet_redimensionne);
1597:
1598: (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
1599: return;
1600: }
1601: }
1602:
1603: /*
1604: --------------------------------------------------------------------------------
1605: Redimensionnement aboutissant à une matrice
1606: --------------------------------------------------------------------------------
1607: */
1608:
1609: else
1610: {
1611: if ((*s_objet_initial).type == VIN)
1612: {
1613: (*s_objet_redimensionne).type = MIN;
1614:
1615: if (((*s_objet_redimensionne).objet =
1616: malloc(sizeof(struct_matrice))) == NULL)
1617: {
1618: if (variable_partagee == d_vrai)
1619: {
1620: if (pthread_mutex_unlock(&((*(*s_etat_processus)
1621: .s_liste_variables_partagees).mutex)) != 0)
1622: {
1623: (*s_etat_processus).erreur_systeme = d_es_processus;
1624: return;
1625: }
1626: }
1627:
1628: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
1629: return;
1630: }
1631:
1632: (*((struct_matrice *) (*s_objet_redimensionne).objet)).type = 'I';
1633: (*((struct_matrice *) (*s_objet_redimensionne).objet))
1634: .nombre_lignes = nombre_lignes;
1635: (*((struct_matrice *) (*s_objet_redimensionne).objet))
1636: .nombre_colonnes = nombre_colonnes;
1637:
1638: if (((*((struct_matrice *) (*s_objet_redimensionne).objet)).tableau
1639: = malloc(nombre_lignes * sizeof(integer8 *)))
1640: == NULL)
1641: {
1642: if (variable_partagee == d_vrai)
1643: {
1644: if (pthread_mutex_unlock(&((*(*s_etat_processus)
1645: .s_liste_variables_partagees).mutex)) != 0)
1646: {
1647: (*s_etat_processus).erreur_systeme = d_es_processus;
1648: return;
1649: }
1650: }
1651:
1652: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
1653: return;
1654: }
1655:
1656: for(i = 0, k = 0; i < nombre_lignes; i++)
1657: {
1658: if ((((integer8 **) (*((struct_matrice *)
1659: (*s_objet_redimensionne).objet)).tableau)[i] =
1660: malloc(nombre_colonnes * sizeof(integer8))) == NULL)
1661: {
1662: if (variable_partagee == d_vrai)
1663: {
1664: if (pthread_mutex_unlock(&((*(*s_etat_processus)
1665: .s_liste_variables_partagees).mutex)) != 0)
1666: {
1667: (*s_etat_processus).erreur_systeme = d_es_processus;
1668: return;
1669: }
1670: }
1671:
1672: (*s_etat_processus).erreur_systeme =
1673: d_es_allocation_memoire;
1674: return;
1675: }
1676:
1677: for(j = 0; j < nombre_colonnes; j++)
1678: {
1679: if (k < (*((struct_vecteur *) (*s_objet_initial)
1680: .objet)).taille)
1681: {
1682: ((integer8 **) (*((struct_matrice *)
1683: (*s_objet_redimensionne).objet)).tableau)
1684: [i][j] = ((integer8 *) (*((struct_vecteur *)
1685: (*s_objet_initial).objet)).tableau)[k++];
1686: }
1687: else
1688: {
1689: ((integer8 **) (*((struct_matrice *)
1690: (*s_objet_redimensionne).objet)).tableau)
1691: [i][j] = 0;
1692: }
1693: }
1694: }
1695: }
1696: else if ((*s_objet_initial).type == VRL)
1697: {
1698: (*s_objet_redimensionne).type = MRL;
1699:
1700: if (((*s_objet_redimensionne).objet =
1701: malloc(sizeof(struct_matrice))) == NULL)
1702: {
1703: if (variable_partagee == d_vrai)
1704: {
1705: if (pthread_mutex_unlock(&((*(*s_etat_processus)
1706: .s_liste_variables_partagees).mutex)) != 0)
1707: {
1708: (*s_etat_processus).erreur_systeme = d_es_processus;
1709: return;
1710: }
1711: }
1712:
1713: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
1714: return;
1715: }
1716:
1717: (*((struct_matrice *) (*s_objet_redimensionne).objet)).type = 'R';
1718: (*((struct_matrice *) (*s_objet_redimensionne).objet))
1719: .nombre_lignes = nombre_lignes;
1720: (*((struct_matrice *) (*s_objet_redimensionne).objet))
1721: .nombre_colonnes = nombre_colonnes;
1722:
1723: if (((*((struct_matrice *) (*s_objet_redimensionne).objet)).tableau
1724: = malloc(nombre_lignes * sizeof(real8 *)))
1725: == NULL)
1726: {
1727: if (variable_partagee == d_vrai)
1728: {
1729: if (pthread_mutex_unlock(&((*(*s_etat_processus)
1730: .s_liste_variables_partagees).mutex)) != 0)
1731: {
1732: (*s_etat_processus).erreur_systeme = d_es_processus;
1733: return;
1734: }
1735: }
1736:
1737: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
1738: return;
1739: }
1740:
1741: for(i = 0, k = 0; i < nombre_lignes; i++)
1742: {
1743: if ((((real8 **) (*((struct_matrice *)
1744: (*s_objet_redimensionne).objet)).tableau)[i] =
1745: malloc(nombre_colonnes * sizeof(real8))) == NULL)
1746: {
1747: if (variable_partagee == d_vrai)
1748: {
1749: if (pthread_mutex_unlock(&((*(*s_etat_processus)
1750: .s_liste_variables_partagees).mutex)) != 0)
1751: {
1752: (*s_etat_processus).erreur_systeme = d_es_processus;
1753: return;
1754: }
1755: }
1756:
1757: (*s_etat_processus).erreur_systeme =
1758: d_es_allocation_memoire;
1759: return;
1760: }
1761:
1762: for(j = 0; j < nombre_colonnes; j++)
1763: {
1764: if (k < (*((struct_vecteur *) (*s_objet_initial)
1765: .objet)).taille)
1766: {
1767: ((real8 **) (*((struct_matrice *)
1768: (*s_objet_redimensionne).objet)).tableau)
1769: [i][j] = ((real8 *) (*((struct_vecteur *)
1770: (*s_objet_initial).objet)).tableau)[k++];
1771: }
1772: else
1773: {
1774: ((real8 **) (*((struct_matrice *)
1775: (*s_objet_redimensionne).objet)).tableau)
1776: [i][j] = (real8) 0;
1777: }
1778: }
1779: }
1780: }
1781: else if ((*s_objet_initial).type == VCX)
1782: {
1783: (*s_objet_redimensionne).type = MCX;
1784:
1785: if (((*s_objet_redimensionne).objet =
1786: malloc(sizeof(struct_matrice))) == NULL)
1787: {
1788: if (variable_partagee == d_vrai)
1789: {
1790: if (pthread_mutex_unlock(&((*(*s_etat_processus)
1791: .s_liste_variables_partagees).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: (*((struct_matrice *) (*s_objet_redimensionne).objet)).type = 'C';
1803: (*((struct_matrice *) (*s_objet_redimensionne).objet))
1804: .nombre_lignes = nombre_lignes;
1805: (*((struct_matrice *) (*s_objet_redimensionne).objet))
1806: .nombre_colonnes = nombre_colonnes;
1807:
1808: if (((*((struct_matrice *) (*s_objet_redimensionne).objet)).tableau
1809: = malloc(nombre_lignes * sizeof(struct_complexe16 *)))
1810: == NULL)
1811: {
1812: if (variable_partagee == d_vrai)
1813: {
1814: if (pthread_mutex_unlock(&((*(*s_etat_processus)
1815: .s_liste_variables_partagees).mutex)) != 0)
1816: {
1817: (*s_etat_processus).erreur_systeme = d_es_processus;
1818: return;
1819: }
1820: }
1821:
1822: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
1823: return;
1824: }
1825:
1826: for(i = 0, k = 0; i < nombre_lignes; i++)
1827: {
1828: if ((((struct_complexe16 **) (*((struct_matrice *)
1829: (*s_objet_redimensionne).objet)).tableau)[i] =
1830: malloc(nombre_colonnes *
1831: sizeof(struct_complexe16))) == NULL)
1832: {
1833: if (variable_partagee == d_vrai)
1834: {
1835: if (pthread_mutex_unlock(&((*(*s_etat_processus)
1836: .s_liste_variables_partagees).mutex)) != 0)
1837: {
1838: (*s_etat_processus).erreur_systeme = d_es_processus;
1839: return;
1840: }
1841: }
1842:
1843: (*s_etat_processus).erreur_systeme =
1844: d_es_allocation_memoire;
1845: return;
1846: }
1847:
1848: for(j = 0; j < nombre_colonnes; j++)
1849: {
1850: if (k < (*((struct_vecteur *) (*s_objet_initial)
1851: .objet)).taille)
1852: {
1853: ((struct_complexe16 **) (*((struct_matrice *)
1854: (*s_objet_redimensionne).objet)).tableau)
1855: [i][j].partie_reelle =
1856: ((struct_complexe16 *) (*((struct_vecteur *)
1857: (*s_objet_initial).objet)).tableau)[k]
1858: .partie_reelle;
1859: ((struct_complexe16 **) (*((struct_matrice *)
1860: (*s_objet_redimensionne).objet)).tableau)
1861: [i][j].partie_imaginaire =
1862: ((struct_complexe16 *) (*((struct_vecteur *)
1863: (*s_objet_initial).objet)).tableau)[k++]
1864: .partie_imaginaire;
1865: }
1866: else
1867: {
1868: ((struct_complexe16 **) (*((struct_matrice *)
1869: (*s_objet_redimensionne).objet)).tableau)
1870: [i][j].partie_reelle = (real8) 0;
1871: ((struct_complexe16 **) (*((struct_matrice *)
1872: (*s_objet_redimensionne).objet)).tableau)
1873: [i][j].partie_imaginaire = (real8) 0;
1874: }
1875: }
1876: }
1877: }
1878: else if ((*s_objet_initial).type == MIN)
1879: {
1880: (*s_objet_redimensionne).type = MIN;
1881:
1882: if (((*s_objet_redimensionne).objet =
1883: malloc(sizeof(struct_matrice))) == NULL)
1884: {
1885: if (variable_partagee == d_vrai)
1886: {
1887: if (pthread_mutex_unlock(&((*(*s_etat_processus)
1888: .s_liste_variables_partagees).mutex)) != 0)
1889: {
1890: (*s_etat_processus).erreur_systeme = d_es_processus;
1891: return;
1892: }
1893: }
1894:
1895: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
1896: return;
1897: }
1898:
1899: (*((struct_matrice *) (*s_objet_redimensionne).objet)).type = 'I';
1900: (*((struct_matrice *) (*s_objet_redimensionne).objet))
1901: .nombre_lignes = nombre_lignes;
1902: (*((struct_matrice *) (*s_objet_redimensionne).objet))
1903: .nombre_colonnes = nombre_colonnes;
1904:
1905: if (((*((struct_matrice *) (*s_objet_redimensionne).objet)).tableau
1906: = malloc(nombre_lignes * sizeof(integer8 *)))
1907: == NULL)
1908: {
1909: if (variable_partagee == d_vrai)
1910: {
1911: if (pthread_mutex_unlock(&((*(*s_etat_processus)
1912: .s_liste_variables_partagees).mutex)) != 0)
1913: {
1914: (*s_etat_processus).erreur_systeme = d_es_processus;
1915: return;
1916: }
1917: }
1918:
1919: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
1920: return;
1921: }
1922:
1923: drapeau_fin_objet_originel = d_faux;
1924:
1925: for(i = 0, k = 0, l = 0; i < nombre_lignes; i++)
1926: {
1927: if ((((integer8 **) (*((struct_matrice *)
1928: (*s_objet_redimensionne).objet)).tableau)[i] =
1929: malloc(nombre_colonnes *
1930: sizeof(integer8))) == NULL)
1931: {
1932: if (variable_partagee == d_vrai)
1933: {
1934: if (pthread_mutex_unlock(&((*(*s_etat_processus)
1935: .s_liste_variables_partagees).mutex)) != 0)
1936: {
1937: (*s_etat_processus).erreur_systeme = d_es_processus;
1938: return;
1939: }
1940: }
1941:
1942: (*s_etat_processus).erreur_systeme =
1943: d_es_allocation_memoire;
1944: return;
1945: }
1946:
1947: for(j = 0; j < nombre_colonnes; j++)
1948: {
1949: if (drapeau_fin_objet_originel == d_faux)
1950: {
1951: ((integer8 **) (*((struct_matrice *)
1952: (*s_objet_redimensionne).objet)).tableau)
1953: [i][j] = ((integer8 **) (*((struct_matrice *)
1954: (*s_objet_initial).objet)).tableau)[k][l];
1955:
1956: if ((++l) >= (*((struct_matrice *) (*s_objet_initial)
1957: .objet)).nombre_colonnes)
1958: {
1959: l = 0;
1960:
1961: if ((++k) >= (*((struct_matrice *)
1962: (*s_objet_initial).objet)).nombre_lignes)
1963: {
1964: drapeau_fin_objet_originel = d_vrai;
1965: }
1966: }
1967: }
1968: else
1969: {
1970: ((integer8 **) (*((struct_matrice *)
1971: (*s_objet_redimensionne).objet)).tableau)
1972: [i][j] = 0;
1973: }
1974: }
1975: }
1976: }
1977: else if ((*s_objet_initial).type == MRL)
1978: {
1979: (*s_objet_redimensionne).type = MRL;
1980:
1981: if (((*s_objet_redimensionne).objet =
1982: malloc(sizeof(struct_matrice))) == NULL)
1983: {
1984: if (variable_partagee == d_vrai)
1985: {
1986: if (pthread_mutex_unlock(&((*(*s_etat_processus)
1987: .s_liste_variables_partagees).mutex)) != 0)
1988: {
1989: (*s_etat_processus).erreur_systeme = d_es_processus;
1990: return;
1991: }
1992: }
1993:
1994: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
1995: return;
1996: }
1997:
1998: (*((struct_matrice *) (*s_objet_redimensionne).objet)).type = 'R';
1999: (*((struct_matrice *) (*s_objet_redimensionne).objet))
2000: .nombre_lignes = nombre_lignes;
2001: (*((struct_matrice *) (*s_objet_redimensionne).objet))
2002: .nombre_colonnes = nombre_colonnes;
2003:
2004: if (((*((struct_matrice *) (*s_objet_redimensionne).objet)).tableau
2005: = malloc(nombre_lignes * sizeof(real8 *)))
2006: == NULL)
2007: {
2008: if (variable_partagee == d_vrai)
2009: {
2010: if (pthread_mutex_unlock(&((*(*s_etat_processus)
2011: .s_liste_variables_partagees).mutex)) != 0)
2012: {
2013: (*s_etat_processus).erreur_systeme = d_es_processus;
2014: return;
2015: }
2016: }
2017:
2018: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
2019: return;
2020: }
2021:
2022: drapeau_fin_objet_originel = d_faux;
2023:
2024: for(i = 0, k = 0, l = 0; i < nombre_lignes; i++)
2025: {
2026: if ((((real8 **) (*((struct_matrice *)
2027: (*s_objet_redimensionne).objet)).tableau)[i] =
2028: malloc(nombre_colonnes *
2029: sizeof(real8))) == NULL)
2030: {
2031: if (variable_partagee == d_vrai)
2032: {
2033: if (pthread_mutex_unlock(&((*(*s_etat_processus)
2034: .s_liste_variables_partagees).mutex)) != 0)
2035: {
2036: (*s_etat_processus).erreur_systeme = d_es_processus;
2037: return;
2038: }
2039: }
2040:
2041: (*s_etat_processus).erreur_systeme =
2042: d_es_allocation_memoire;
2043: return;
2044: }
2045:
2046: for(j = 0; j < nombre_colonnes; j++)
2047: {
2048: if (drapeau_fin_objet_originel == d_faux)
2049: {
2050: ((real8 **) (*((struct_matrice *)
2051: (*s_objet_redimensionne).objet)).tableau)
2052: [i][j] = ((real8 **) (*((struct_matrice *)
2053: (*s_objet_initial).objet)).tableau)[k][l];
2054:
2055: if ((++l) >= (*((struct_matrice *) (*s_objet_initial)
2056: .objet)).nombre_colonnes)
2057: {
2058: l = 0;
2059:
2060: if ((++k) >= (*((struct_matrice *)
2061: (*s_objet_initial).objet)).nombre_lignes)
2062: {
2063: drapeau_fin_objet_originel = d_vrai;
2064: }
2065: }
2066: }
2067: else
2068: {
2069: ((real8 **) (*((struct_matrice *)
2070: (*s_objet_redimensionne).objet)).tableau)
2071: [i][j] = (real8) 0;
2072: }
2073: }
2074: }
2075: }
2076: else if ((*s_objet_initial).type == MCX)
2077: {
2078: (*s_objet_redimensionne).type = MCX;
2079:
2080: if (((*s_objet_redimensionne).objet =
2081: malloc(sizeof(struct_matrice))) == NULL)
2082: {
2083: if (variable_partagee == d_vrai)
2084: {
2085: if (pthread_mutex_unlock(&((*(*s_etat_processus)
2086: .s_liste_variables_partagees).mutex)) != 0)
2087: {
2088: (*s_etat_processus).erreur_systeme = d_es_processus;
2089: return;
2090: }
2091: }
2092:
2093: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
2094: return;
2095: }
2096:
2097: (*((struct_matrice *) (*s_objet_redimensionne).objet)).type = 'C';
2098: (*((struct_matrice *) (*s_objet_redimensionne).objet))
2099: .nombre_lignes = nombre_lignes;
2100: (*((struct_matrice *) (*s_objet_redimensionne).objet))
2101: .nombre_colonnes = nombre_colonnes;
2102:
2103: if (((*((struct_matrice *) (*s_objet_redimensionne).objet)).tableau
2104: = malloc(nombre_lignes * sizeof(struct_complexe16 *)))
2105: == NULL)
2106: {
2107: if (variable_partagee == d_vrai)
2108: {
2109: if (pthread_mutex_unlock(&((*(*s_etat_processus)
2110: .s_liste_variables_partagees).mutex)) != 0)
2111: {
2112: (*s_etat_processus).erreur_systeme = d_es_processus;
2113: return;
2114: }
2115: }
2116:
2117: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
2118: return;
2119: }
2120:
2121: drapeau_fin_objet_originel = d_faux;
2122:
2123: for(i = 0, k = 0, l = 0; i < nombre_lignes; i++)
2124: {
2125: if ((((struct_complexe16 **) (*((struct_matrice *)
2126: (*s_objet_redimensionne).objet)).tableau)[i] =
2127: malloc(nombre_colonnes *
2128: sizeof(struct_complexe16))) == NULL)
2129: {
2130: if (variable_partagee == d_vrai)
2131: {
2132: if (pthread_mutex_unlock(&((*(*s_etat_processus)
2133: .s_liste_variables_partagees).mutex)) != 0)
2134: {
2135: (*s_etat_processus).erreur_systeme = d_es_processus;
2136: return;
2137: }
2138: }
2139:
2140: (*s_etat_processus).erreur_systeme =
2141: d_es_allocation_memoire;
2142: return;
2143: }
2144:
2145: for(j = 0; j < nombre_colonnes; j++)
2146: {
2147: if (drapeau_fin_objet_originel == d_faux)
2148: {
2149: ((struct_complexe16 **) (*((struct_matrice *)
2150: (*s_objet_redimensionne).objet)).tableau)
2151: [i][j].partie_reelle = ((struct_complexe16 **)
2152: (*((struct_matrice *) (*s_objet_initial).objet))
2153: .tableau)[k][l].partie_reelle;
2154:
2155: ((struct_complexe16 **) (*((struct_matrice *)
2156: (*s_objet_redimensionne).objet)).tableau)
2157: [i][j].partie_imaginaire =
2158: ((struct_complexe16 **) (*((struct_matrice *)
2159: (*s_objet_initial).objet)).tableau)[k][l]
2160: .partie_imaginaire;
2161:
2162: if ((++l) >= (*((struct_matrice *) (*s_objet_initial)
2163: .objet)).nombre_colonnes)
2164: {
2165: l = 0;
2166:
2167: if ((++k) >= (*((struct_matrice *)
2168: (*s_objet_initial).objet)).nombre_lignes)
2169: {
2170: drapeau_fin_objet_originel = d_vrai;
2171: }
2172: }
2173: }
2174: else
2175: {
2176: ((struct_complexe16 **) (*((struct_matrice *)
2177: (*s_objet_redimensionne).objet)).tableau)
2178: [i][j].partie_reelle = (real8) 0;
2179: ((struct_complexe16 **) (*((struct_matrice *)
2180: (*s_objet_redimensionne).objet)).tableau)
2181: [i][j].partie_imaginaire = (real8) 0;
2182: }
2183: }
2184: }
2185: }
2186: else
2187: {
2188: if (variable_partagee == d_vrai)
2189: {
2190: if (pthread_mutex_unlock(&((*(*s_etat_processus)
2191: .s_liste_variables_partagees).mutex)) != 0)
2192: {
2193: (*s_etat_processus).erreur_systeme = d_es_processus;
2194: return;
2195: }
2196: }
2197:
2198: if (argument_nom == d_faux)
2199: {
2200: liberation(s_etat_processus, s_objet_initial);
2201: }
2202:
2203: liberation(s_etat_processus, s_objet_dimensions);
2204: free(s_objet_redimensionne);
2205:
2206: (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
2207: return;
2208: }
2209: }
2210:
2211: liberation(s_etat_processus, s_objet_dimensions);
2212: liberation(s_etat_processus, s_objet_initial);
2213:
2214: if (argument_nom == d_faux)
2215: {
2216: if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
2217: s_objet_redimensionne) == d_erreur)
2218: {
2219: return;
2220: }
2221: }
2222: else
2223: {
2224: if (variable_partagee == d_vrai)
2225: {
2226: (*(*s_etat_processus).s_liste_variables_partagees).table
2227: [(*(*s_etat_processus).s_liste_variables_partagees)
2228: .position_variable].objet = s_objet_redimensionne;
2229:
2230: if (pthread_mutex_unlock(&((*(*s_etat_processus)
2231: .s_liste_variables_partagees).mutex)) != 0)
2232: {
2233: (*s_etat_processus).erreur_systeme = d_es_processus;
2234: return;
2235: }
2236: }
2237: else
2238: {
2239: (*(*s_etat_processus).pointeur_variable_courante).objet =
2240: s_objet_redimensionne;
2241: }
2242: }
2243:
2244: return;
2245: }
2246:
2247: // vim: ts=4
CVSweb interface <joel.bertrand@systella.fr>