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