Annotation of rpl/src/sequenceur.c, revision 1.85
1.1 bertrand 1: /*
2: ================================================================================
1.84 bertrand 3: RPL/2 (R) version 4.1.20
1.83 bertrand 4: Copyright (C) 1989-2015 Dr. BERTRAND Joël
1.1 bertrand 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:
1.13 bertrand 22:
1.20 bertrand 23: #include "rpl-conv.h"
1.1 bertrand 24:
25:
26: /*
27: ================================================================================
1.60 bertrand 28: Boucle principale de l'interprète RPL/2
1.1 bertrand 29: ================================================================================
1.60 bertrand 30: Entrées : structure sur l'état du processus
1.1 bertrand 31: --------------------------------------------------------------------------------
1.60 bertrand 32: Sorties : néant
1.1 bertrand 33: --------------------------------------------------------------------------------
1.60 bertrand 34: Effets de bord : néant
1.1 bertrand 35: ================================================================================
36: */
37:
38: logical1
39: sequenceur(struct_processus *s_etat_processus)
40: {
41: struct_liste_chainee *l_element_courant;
42:
43: struct_objet *s_objet;
1.4 bertrand 44: struct_objet *s_objet_evaluation;
1.1 bertrand 45: struct_objet *s_sous_objet;
46:
1.69 bertrand 47: integer8 niveau;
48: integer8 position_courante;
49:
1.1 bertrand 50: logical1 drapeau_appel_definition;
51: logical1 drapeau_fin;
52: logical1 drapeau_then;
53: logical1 erreur;
1.56 bertrand 54: logical1 presence_compteur;
1.1 bertrand 55:
56: static logical1 completion_valide = d_faux;
57:
58: struct sigaction action;
59: struct sigaction action_defaut;
60: struct sigaction action_defaut2;
61:
62: unsigned char *instruction_majuscule;
63: unsigned char *ligne;
64: unsigned char *message;
65: unsigned char *registre;
66: unsigned char *tampon;
67: unsigned char *t_ligne;
68:
1.49 bertrand 69: Keymap ancien_keymap;
70: Keymap nouveau_keymap;
71:
1.1 bertrand 72: (*s_etat_processus).retour_routine_evaluation = 'N';
73:
74: if ((*s_etat_processus).debug == d_vrai)
75: if (((*s_etat_processus).type_debug &
76: d_debug_appels_fonctions) != 0)
77: {
78: if ((*s_etat_processus).niveau_recursivite != 0)
79: {
80: if ((*s_etat_processus).langue == 'F')
81: {
1.70 bertrand 82: printf("[%d] Exécution récursive de niveau %lld\n",
1.1 bertrand 83: (int) getpid(), (*s_etat_processus).niveau_recursivite);
84: }
85: else
86: {
1.70 bertrand 87: printf("[%d] %lld level recursive execution\n",
1.1 bertrand 88: (int) getpid(), (*s_etat_processus).niveau_recursivite);
89: }
90: }
91: else
92: {
93: if ((*s_etat_processus).langue == 'F')
94: {
1.70 bertrand 95: printf("[%d] Exécution\n", (int) getpid());
1.1 bertrand 96: }
97: else
98: {
99: printf("[%d] Execution\n", (int) getpid());
100: }
101: }
102:
103: fflush(stdout);
104: }
105:
106: /*
107: --------------------------------------------------------------------------------
1.60 bertrand 108: Boucle de l'interprète RPL/2
1.1 bertrand 109: On boucle tant qu'on n'a pas une bonne raison de sortir...
110: --------------------------------------------------------------------------------
111: */
112:
113: do
114: {
115: drapeau_appel_definition = d_faux;
116:
117: /*
118: --------------------------------------------------------------------------------
1.60 bertrand 119: Recherche de l'instruction suivante dans les définitions chaînées
1.1 bertrand 120: --------------------------------------------------------------------------------
121: */
122:
123: if ((erreur = recherche_instruction_suivante(s_etat_processus))
124: == d_erreur)
125: {
126: return(d_erreur);
127: }
128:
129: if (((*s_etat_processus).debug_programme == d_vrai) &&
130: ((*s_etat_processus).niveau_recursivite == 0))
131: {
132: /*
133: * Traitement de la commande HALT (debug)
134: */
135:
136: action.sa_handler = SIG_IGN;
137: action.sa_flags = SA_NODEFER | SA_ONSTACK;
138:
139: (*s_etat_processus).execution_pas_suivant = d_faux;
140: (*s_etat_processus).traitement_instruction_halt = d_vrai;
141:
142: if (completion_valide == d_faux)
143: {
144: initialisation_completion();
145: completion_valide = d_vrai;
146: }
147:
148: while((*s_etat_processus).execution_pas_suivant == d_faux)
149: {
150: if ((*s_etat_processus).hauteur_pile_operationnelle != 0)
151: {
152: fprintf(stdout, "\n");
153: }
154:
155: affichage_pile(s_etat_processus, (*s_etat_processus)
156: .l_base_pile, 1);
157:
158: if ((*s_etat_processus).mode_interactif == 'N')
159: {
160: printf("[%d] Instruction : %s\n", (int) getpid(),
161: (*s_etat_processus).instruction_courante);
162: fflush(stdout);
163: }
164:
165: if (sigaction(SIGINT, &action, &action_defaut) != 0)
166: {
167: (*s_etat_processus).erreur_systeme = d_es_signal;
168: return(d_erreur);
169: }
170:
171: if (sigaction(SIGTSTP, &action, &action_defaut2) != 0)
172: {
173: (*s_etat_processus).erreur_systeme = d_es_signal;
174: return(d_erreur);
175: }
176:
177: (*s_etat_processus).var_volatile_requete_arret = 0;
178: (*s_etat_processus).var_volatile_requete_arret2 = 0;
179:
180: flockfile(stdin);
181: flockfile(stdout);
182:
1.49 bertrand 183: ancien_keymap = rl_get_keymap();
184: nouveau_keymap = rl_copy_keymap(ancien_keymap);
185: rl_set_keymap(nouveau_keymap);
186:
1.50 bertrand 187: rl_bind_key(NEWLINE, readline_analyse_syntaxique);
188: rl_bind_key(RETURN, readline_analyse_syntaxique);
189: rl_bind_key(CTRL('g'), readline_effacement);
1.49 bertrand 190: rl_done = 0;
191:
1.1 bertrand 192: ligne = readline("RPL/2> ");
193:
1.49 bertrand 194: rl_set_keymap(ancien_keymap);
195: rl_free(nouveau_keymap);
196:
1.1 bertrand 197: funlockfile(stdin);
198: funlockfile(stdout);
199:
200: if (ligne != NULL)
201: {
202: if ((t_ligne = transliteration(s_etat_processus, ligne,
203: (*s_etat_processus).localisation, d_locale))
204: == NULL)
205: {
1.27 bertrand 206: free((*s_etat_processus).instruction_courante);
1.1 bertrand 207: return(d_erreur);
208: }
209:
210: free(ligne);
211: ligne = t_ligne;
212:
1.85 ! bertrand 213: if ((ligne = compactage(s_etat_processus, ligne)) == NULL)
1.1 bertrand 214: {
215: (*s_etat_processus).erreur_systeme =
216: d_es_allocation_memoire;
217: return(d_erreur);
218: }
219: }
220:
221: if (sigaction(SIGINT, &action_defaut, NULL) != 0)
222: {
223: (*s_etat_processus).erreur_systeme = d_es_signal;
224: return(d_erreur);
225: }
226:
227: if (sigaction(SIGTSTP, &action_defaut2, NULL) != 0)
228: {
229: (*s_etat_processus).erreur_systeme = d_es_signal;
230: return(d_erreur);
231: }
232:
233: if (ligne == NULL)
234: {
235: if ((ligne = (unsigned char *) malloc(6 *
236: sizeof(unsigned char))) == NULL)
237: {
238: (*s_etat_processus).erreur_systeme =
239: d_es_allocation_memoire;
240: return(d_erreur);
241: }
242:
243: sprintf(ligne, "abort");
244: fprintf(stdout, "%s\n", ligne);
245: }
246: else if (((*ligne) == d_code_fin_chaine) &&
247: ((*s_etat_processus).l_base_pile != NULL))
248: {
249: free(ligne);
250:
251: if ((ligne = (unsigned char *) malloc(4 *
252: sizeof(unsigned char))) == NULL)
253: {
254: (*s_etat_processus).erreur_systeme =
255: d_es_allocation_memoire;
256: return(d_erreur);
257: }
258:
259: sprintf(ligne, "dup");
260: }
261:
1.85 ! bertrand 262: if ((*s_etat_processus).var_volatile_requete_arret != 0)
! 263: {
! 264: free(ligne);
! 265: (*s_etat_processus).requete_arret = 'Y';
! 266: break;
! 267: }
! 268:
1.1 bertrand 269: add_history(ligne);
270: stifle_history(ds_longueur_historique);
271:
272: position_courante = (*s_etat_processus).position_courante;
273: tampon = (*s_etat_processus).definitions_chainees;
274: registre = (*s_etat_processus).instruction_courante;
275: (*s_etat_processus).definitions_chainees = ligne;
276:
277: if (analyse_syntaxique(s_etat_processus) == d_absence_erreur)
278: {
279: (*s_etat_processus).instruction_courante = registre;
280: (*s_etat_processus).position_courante = position_courante;
281: (*s_etat_processus).definitions_chainees = tampon;
282:
283: if ((tampon = (unsigned char *) malloc((strlen(ligne) + 7) *
284: sizeof(unsigned char))) == NULL)
285: {
286: (*s_etat_processus).erreur_systeme =
287: d_es_allocation_memoire;
288: return(d_erreur);
289: }
290:
291: sprintf(tampon, "<< %s >>", ligne);
292:
293: free(ligne);
294: ligne = tampon;
295:
296: tampon = (*s_etat_processus).instruction_courante;
297: (*s_etat_processus).instruction_courante = ligne;
1.6 bertrand 298:
1.82 bertrand 299: (*s_etat_processus).type_en_cours = NON;
1.1 bertrand 300: recherche_type(s_etat_processus);
301:
1.6 bertrand 302: (*s_etat_processus).instruction_courante = tampon;
303:
1.1 bertrand 304: if ((((*s_etat_processus).erreur_execution != d_ex) ||
305: ((*s_etat_processus).erreur_systeme != d_es)) &&
306: ((*s_etat_processus).invalidation_message_erreur
307: == d_faux))
308: {
309: if ((*s_etat_processus).erreur_execution != d_ex)
310: {
311: (*s_etat_processus).erreur_scrutation = d_vrai;
312: }
313:
314: if (test_cfsf(s_etat_processus, 51) == d_faux)
315: {
316: printf("%s", ds_beep);
317: }
318:
319: if ((message = messages(s_etat_processus)) == NULL)
320: {
1.27 bertrand 321: free((*s_etat_processus).instruction_courante);
1.1 bertrand 322: return(d_erreur);
323: }
324:
325: printf("%s [%d]\n", message, (int) getpid());
326:
327: free(message);
328:
329: (*s_etat_processus).erreur_execution = d_ex;
330:
331: if ((*s_etat_processus).erreur_systeme != d_es)
332: {
333: return(d_erreur);
334: }
335: }
336: else
337: {
1.76 bertrand 338: position_courante =
339: (*s_etat_processus).position_courante;
1.74 bertrand 340: empilement_pile_systeme(s_etat_processus);
341:
342: if ((*s_etat_processus).erreur_systeme != d_es)
343: {
344: return(d_erreur);
345: }
346:
1.1 bertrand 347: (*(*s_etat_processus).l_base_pile_systeme)
348: .retour_definition = 'Y';
349:
350: if (depilement(s_etat_processus, &((*s_etat_processus)
351: .l_base_pile), &s_objet) == d_erreur)
352: {
353: if (test_cfsf(s_etat_processus, 51) == d_faux)
354: {
355: printf("%s", ds_beep);
356: }
357:
358: if ((*s_etat_processus).langue == 'F')
359: {
1.70 bertrand 360: printf("+++Erreur : Défaut d'argument\n");
1.1 bertrand 361: }
362: else
363: {
364: printf("+++Error : Too few arguments\n");
365: }
366:
1.74 bertrand 367: depilement_pile_systeme(s_etat_processus);
368:
369: if ((*s_etat_processus).erreur_systeme != d_es)
370: {
371: return(d_erreur);
372: }
1.1 bertrand 373:
374: fflush(stdout);
375: }
376: else if (evaluation(s_etat_processus, s_objet, 'I') ==
377: d_erreur)
378: {
379: if ((*s_etat_processus).erreur_systeme != d_es)
380: {
381: if (test_cfsf(s_etat_processus, 51) == d_faux)
382: {
383: printf("%s", ds_beep);
384: }
385:
386: if ((message = messages(s_etat_processus))
387: == NULL)
388: {
1.27 bertrand 389: free((*s_etat_processus)
390: .instruction_courante);
1.1 bertrand 391: return(d_erreur);
392: }
393:
394: printf("%s [%d]\n", message, (int) getpid());
1.27 bertrand 395:
1.1 bertrand 396: free(message);
1.27 bertrand 397: free((*s_etat_processus).instruction_courante);
1.1 bertrand 398: return(d_erreur);
399: }
400: else if ((*s_etat_processus)
401: .invalidation_message_erreur == d_faux)
402: {
403: (*s_etat_processus).erreur_execution =
404: (*s_etat_processus)
405: .derniere_erreur_evaluation;
406:
407: if (test_cfsf(s_etat_processus, 51) == d_faux)
408: {
409: printf("%s", ds_beep);
410: }
411:
412: if ((message = messages(s_etat_processus))
413: == NULL)
414: {
1.27 bertrand 415: free((*s_etat_processus)
416: .instruction_courante);
1.1 bertrand 417: return(d_erreur);
418: }
419:
420: printf("%s [%d]\n", message, (int) getpid());
421: free(message);
422:
423: if (test_cfsf(s_etat_processus, 31) == d_vrai)
424: {
425: l_element_courant = (*s_etat_processus)
426: .l_base_pile_last;
427:
428: while(l_element_courant != NULL)
429: {
430: if ((s_sous_objet = copie_objet(
431: s_etat_processus,
432: (*l_element_courant).donnee,
433: 'P')) == NULL)
434: {
435: (*s_etat_processus).erreur_systeme =
436: d_es_allocation_memoire;
437: return(d_erreur);
438: }
439:
440: if (empilement(s_etat_processus,
441: &((*s_etat_processus)
442: .l_base_pile),
443: s_sous_objet) == d_erreur)
444: {
445: return(d_erreur);
446: }
447:
448: l_element_courant = (*l_element_courant)
449: .suivant;
450: }
451: }
452:
453: (*s_etat_processus).erreur_execution = d_ex;
454: (*s_etat_processus).exception = d_ep;
455: }
456:
457: liberation(s_etat_processus, s_objet);
458: }
459: else
460: {
461: liberation(s_etat_processus, s_objet);
462: }
1.76 bertrand 463:
464: (*s_etat_processus).position_courante =
465: position_courante;
1.1 bertrand 466: }
467: }
468: else if ((*s_etat_processus).invalidation_message_erreur
469: == d_faux)
470: {
471: (*s_etat_processus).instruction_courante = registre;
472: (*s_etat_processus).position_courante = position_courante;
473: (*s_etat_processus).definitions_chainees = tampon;
474:
475: if (test_cfsf(s_etat_processus, 51) == d_faux)
476: {
477: printf("%s", ds_beep);
478: }
479:
480: if ((message = messages(s_etat_processus)) == NULL)
481: {
1.27 bertrand 482: free((*s_etat_processus).instruction_courante);
1.1 bertrand 483: free(ligne);
484: return(d_erreur);
485: }
486:
487: free(message);
488:
489: if ((*s_etat_processus).langue == 'F')
490: {
491: printf("+++Erreur : Erreur de syntaxe\n");
492: }
493: else
494: {
495: printf("+++Error : Syntax error\n");
496: }
497:
498: fflush(stdout);
499: }
500:
501: free(ligne);
502: }
503:
504: (*s_etat_processus).traitement_instruction_halt = d_faux;
505: }
506:
507: if ((*s_etat_processus).debug == d_vrai)
508: if (((*s_etat_processus).type_debug &
509: d_debug_fonctions_intrinseques) != 0)
510: {
511: if ((*s_etat_processus).langue == 'F')
512: {
513: printf("[%d] Instruction %s\n",
514: (int) getpid(),
515: (*s_etat_processus).instruction_courante);
516: }
517: else
518: {
519: printf("[%d] %s instruction\n",
520: (int) getpid(),
521: (*s_etat_processus).instruction_courante);
522: }
523:
524: fflush(stdout);
525: }
526:
527: /*
528: --------------------------------------------------------------------------------
1.60 bertrand 529: Dans le cas où une instruction est retournée, celle-ci est évaluée. Dans le
530: cas contraire, l'interprète renvoie un message d'erreur et s'interrompt.
1.1 bertrand 531: --------------------------------------------------------------------------------
532: */
533:
534: if (erreur == d_absence_erreur)
535: {
536:
537: /*
538: --------------------------------------------------------------------------------
1.60 bertrand 539: Scrutation des mots clef du langage RPL/2 et exécution le cas échéant
540: de l'action associée.
1.1 bertrand 541: --------------------------------------------------------------------------------
542: */
543:
544: analyse(s_etat_processus, NULL);
545:
546: if ((*s_etat_processus).traitement_cycle_exit != 'N')
547: {
548: switch((*s_etat_processus).traitement_cycle_exit)
549: {
550: case 'C' :
551: {
552: instruction_cycle(s_etat_processus);
553: break;
554: }
555:
556: case 'E' :
557: {
558: instruction_exit(s_etat_processus);
559: break;
560: }
561: }
562: }
563:
564: if ((*s_etat_processus).instruction_valide == 'N')
565: {
566:
567: /*
568: --------------------------------------------------------------------------------
1.60 bertrand 569: L'instruction ne correspond pas à l'un des mots clef du langage RPL/2.
1.1 bertrand 570: --------------------------------------------------------------------------------
571: */
572:
573: if ((recherche_variable(s_etat_processus,
574: (*s_etat_processus).instruction_courante) ==
575: d_vrai) && ((*s_etat_processus)
576: .autorisation_evaluation_nom == 'Y'))
577: {
1.32 bertrand 578: if ((*(*s_etat_processus).pointeur_variable_courante)
579: .objet == NULL)
1.1 bertrand 580: {
581:
582: /*
583: --------------------------------------------------------------------------------
1.60 bertrand 584: L'instruction est une variable partagée
1.1 bertrand 585: --------------------------------------------------------------------------------
586: */
587:
588: if ((*s_etat_processus).debug == d_vrai)
589: if (((*s_etat_processus).type_debug &
590: d_debug_variables) != 0)
591: {
592: if ((*s_etat_processus).langue == 'F')
593: {
1.60 bertrand 594: printf("[%d] Évaluation de la variable "
595: "partagée %s de type %d\n",
1.32 bertrand 596: (int) getpid(), (*s_etat_processus)
1.1 bertrand 597: .instruction_courante,
1.32 bertrand 598: (*(*(*s_etat_processus)
599: .pointeur_variable_courante).objet)
1.1 bertrand 600: .type);
601: }
602: else
603: {
604: printf("[%d] Pushing %s as %d type shared "
1.70 bertrand 605: "variable\n", (int) getpid(),
1.1 bertrand 606: (*s_etat_processus)
607: .instruction_courante,
1.32 bertrand 608: (*(*(*s_etat_processus)
609: .pointeur_variable_courante).objet)
1.1 bertrand 610: .type);
611: }
612:
613: fflush(stdout);
614: }
615:
616: if (recherche_variable_partagee(s_etat_processus,
1.32 bertrand 617: (*(*s_etat_processus)
618: .pointeur_variable_courante).nom,
619: (*(*s_etat_processus)
620: .pointeur_variable_courante).variable_partagee,
1.62 bertrand 621: 'P') != NULL)
1.1 bertrand 622: {
623: // La variable existe.
624:
625: if ((s_objet = copie_objet(s_etat_processus,
626: (*(*s_etat_processus)
1.61 bertrand 627: .pointeur_variable_partagee_courante)
628: .objet, 'P')) == NULL)
1.1 bertrand 629: {
630: (*s_etat_processus).erreur_systeme =
631: d_es_allocation_memoire;
632: return(d_erreur);
633: }
634:
635: if (pthread_mutex_unlock(&((*(*s_etat_processus)
1.61 bertrand 636: .pointeur_variable_partagee_courante)
637: .mutex)) != 0)
1.1 bertrand 638: {
639: (*s_etat_processus).erreur_systeme =
640: d_es_processus;
641: return(d_erreur);
642: }
643:
1.60 bertrand 644: if (evaluation(s_etat_processus, s_objet, 'E')
645: == d_erreur)
1.1 bertrand 646: {
1.60 bertrand 647: liberation(s_etat_processus, s_objet);
1.1 bertrand 648: return(d_erreur);
649: }
1.60 bertrand 650:
651: liberation(s_etat_processus, s_objet);
1.1 bertrand 652: }
653: else
654: {
655: // La variable n'existe plus.
656: }
657: }
658:
659: /*
660: --------------------------------------------------------------------------------
1.60 bertrand 661: L'instruction est une variable automatique (évaluation lors de l'empilement).
1.1 bertrand 662: --------------------------------------------------------------------------------
663: */
664:
1.32 bertrand 665: else if ((*(*(*s_etat_processus).pointeur_variable_courante)
1.1 bertrand 666: .objet).type == ADR)
667: {
668:
669: /*
670: --------------------------------------------------------------------------------
671: L'instruction est une variable de type 'adresse' pointant sur une
1.60 bertrand 672: définition. Un branchement est effectué à cette adresse.
1.1 bertrand 673: --------------------------------------------------------------------------------
674: */
675:
676: if ((*s_etat_processus).debug == d_vrai)
677: if (((*s_etat_processus).type_debug &
678: d_debug_appels_fonctions) != 0)
679: {
680: if ((*s_etat_processus).langue == 'F')
681: {
1.60 bertrand 682: printf("[%d] Branchement à la"
683: " définition %s\n", (int) getpid(),
1.1 bertrand 684: (*s_etat_processus)
685: .instruction_courante);
686: }
687: else
688: {
689: printf("[%d] Execution : "
690: "Branching at %s definition\n",
691: (int) getpid(), (*s_etat_processus)
692: .instruction_courante);
693: }
694:
695: fflush(stdout);
696: }
697:
698: (*s_etat_processus).autorisation_empilement_programme =
699: 'N';
700:
701: empilement_pile_systeme(s_etat_processus);
702:
703: if ((*s_etat_processus).erreur_systeme != d_es)
704: {
705: erreur = d_erreur;
706: }
707: else
708: {
709: if ((*s_etat_processus).profilage == d_vrai)
710: {
711: profilage(s_etat_processus,
712: (*s_etat_processus)
713: .instruction_courante);
714:
715: if ((*s_etat_processus).erreur_systeme != d_es)
716: {
717: return(d_erreur);
718: }
719: }
720:
721: (*(*s_etat_processus).l_base_pile_systeme)
722: .adresse_retour = (*s_etat_processus)
723: .position_courante;
724:
725: (*(*s_etat_processus).l_base_pile_systeme)
726: .retour_definition = 'Y';
727:
728: (*(*s_etat_processus).l_base_pile_systeme)
729: .niveau_courant = (*s_etat_processus)
730: .niveau_courant;
731:
732: (*s_etat_processus).position_courante =
1.69 bertrand 733: (*((integer8 *)
1.32 bertrand 734: ((*(*(*s_etat_processus)
735: .pointeur_variable_courante)
736: .objet).objet)));
1.1 bertrand 737:
738: drapeau_appel_definition = d_vrai;
739: }
740: }
741: else
742: {
743: if ((*s_etat_processus).debug == d_vrai)
744: if (((*s_etat_processus).type_debug &
745: d_debug_variables) != 0)
746: {
747: if ((*s_etat_processus).langue == 'F')
748: {
1.60 bertrand 749: printf("[%d] Évaluation de la variable "
1.1 bertrand 750: "%s de type %d\n",
751: (int) getpid(),
752: (*s_etat_processus)
753: .instruction_courante,
1.32 bertrand 754: (*(*(*s_etat_processus)
755: .pointeur_variable_courante).objet)
1.1 bertrand 756: .type);
757: }
758: else
759: {
760: printf("[%d] Pushing %s as %d type variable "
761: "\n", (int) getpid(),
762: (*s_etat_processus)
763: .instruction_courante,
1.32 bertrand 764: (*(*(*s_etat_processus)
765: .pointeur_variable_courante).objet)
1.1 bertrand 766: .type);
767: }
768:
769: fflush(stdout);
770: }
771:
772: if ((s_objet = copie_objet(s_etat_processus,
1.32 bertrand 773: (*(*s_etat_processus)
774: .pointeur_variable_courante).objet, 'P'))
1.1 bertrand 775: == NULL)
776: {
777: (*s_etat_processus).erreur_systeme =
778: d_es_allocation_memoire;
779: return(d_erreur);
780: }
781:
1.60 bertrand 782: if (evaluation(s_etat_processus, s_objet, 'E')
783: == d_erreur)
1.1 bertrand 784: {
1.60 bertrand 785: liberation(s_etat_processus, s_objet);
1.1 bertrand 786: return(d_erreur);
787: }
1.60 bertrand 788:
789: liberation(s_etat_processus, s_objet);
1.1 bertrand 790: }
791: }
792: else
793: {
794:
795: /*
796: --------------------------------------------------------------------------------
1.60 bertrand 797: L'instruction est une donnée à empiler.
1.1 bertrand 798: --------------------------------------------------------------------------------
799: */
800:
801: (*s_etat_processus).erreur_systeme = d_es;
1.82 bertrand 802: (*s_etat_processus).type_en_cours = NON;
1.1 bertrand 803: recherche_type(s_etat_processus);
1.4 bertrand 804:
1.9 bertrand 805: if ((*s_etat_processus).autorisation_nom_implicite == 'N')
806: {
807: if ((*s_etat_processus).l_base_pile == NULL)
808: {
1.37 bertrand 809: if ((*s_etat_processus).erreur_execution !=
810: d_ex_nom_implicite)
811: {
812: (*s_etat_processus).erreur_execution =
813: d_ex_manque_argument;
814: }
1.9 bertrand 815: }
1.12 bertrand 816: else if ((*(*(*s_etat_processus).l_base_pile).donnee)
817: .type == NOM)
1.9 bertrand 818: {
819: if ((*((struct_nom *) (*(*(*s_etat_processus)
820: .l_base_pile).donnee).objet)).symbole
821: == d_faux)
822: {
1.12 bertrand 823: (*s_etat_processus).erreur_execution =
824: d_ex_nom_implicite;
825:
1.60 bertrand 826: // Si le niveau de récursivité est non nul, on
1.12 bertrand 827: // arrive ici depuis la fonction
1.60 bertrand 828: // recherche_type(). On retourne à cette
829: // dernière en indiquant une erreur.
1.12 bertrand 830:
831: if ((*s_etat_processus).niveau_recursivite != 0)
1.11 bertrand 832: {
1.12 bertrand 833: free((*s_etat_processus)
834: .instruction_courante);
1.11 bertrand 835: return(d_erreur);
836: }
1.9 bertrand 837: }
838: }
839: }
840:
1.60 bertrand 841: // Le séquenceur est appelé depuis la routine d'évaluation
1.4 bertrand 842:
843: if ((*s_etat_processus).evaluation_forcee == 'Y')
844: {
845: if (depilement(s_etat_processus,
846: &((*s_etat_processus).l_base_pile),
847: &s_objet_evaluation) == d_erreur)
848: {
1.27 bertrand 849: free((*s_etat_processus).instruction_courante);
1.4 bertrand 850: (*s_etat_processus).erreur_execution =
851: d_ex_manque_argument;
852: return(d_erreur);
853: }
854:
855: if (evaluation(s_etat_processus, s_objet_evaluation,
856: 'N') == d_erreur)
857: {
1.27 bertrand 858: free((*s_etat_processus).instruction_courante);
1.4 bertrand 859: liberation(s_etat_processus, s_objet_evaluation);
860: return(d_erreur);
861: }
862:
863: liberation(s_etat_processus, s_objet_evaluation);
864: }
1.27 bertrand 865:
1.60 bertrand 866: // Le séquenceur est appelé depuis la routine de
1.27 bertrand 867: // recherche de type
868:
869: else if ((*s_etat_processus).recherche_type == 'Y')
870: {
871: if ((*s_etat_processus).erreur_execution != d_ex)
872: {
873: free((*s_etat_processus).instruction_courante);
874: return(d_erreur);
875: }
876: }
1.1 bertrand 877: }
878: }
879: else if (((*s_etat_processus).test_instruction == 'Y') &&
880: ((*s_etat_processus).instruction_valide == 'Y'))
881: {
882:
883: /*
884: --------------------------------------------------------------------------------
885: Permet de traiter les fonctions dans les objets de type liste
886: --------------------------------------------------------------------------------
887: */
888:
889: if ((instruction_majuscule = conversion_majuscule(
1.85 ! bertrand 890: s_etat_processus, (*s_etat_processus)
! 891: .instruction_courante)) == NULL)
1.1 bertrand 892: {
893: (*s_etat_processus).erreur_systeme =
894: d_es_allocation_memoire;
895: return(d_erreur);
896: }
897:
898: if ((strcmp((*s_etat_processus).instruction_courante, "<<")
899: != 0) && (strcmp((*s_etat_processus)
900: .instruction_courante, ">>") != 0))
901: {
1.12 bertrand 902: if ((s_objet = allocation(s_etat_processus, FCT)) == NULL)
1.1 bertrand 903: {
904: (*s_etat_processus).erreur_systeme =
905: d_es_allocation_memoire;
906: return(d_erreur);
907: }
908:
909: (*((struct_fonction *) (*s_objet).objet))
910: .nombre_arguments = 0;
911:
912: if ((*s_etat_processus).instruction_intrinseque == 'Y')
913: {
914: if (((*((struct_fonction *) (*s_objet).objet))
915: .nom_fonction = conversion_majuscule(
1.85 ! bertrand 916: s_etat_processus, (*s_etat_processus)
! 917: .instruction_courante)) == NULL)
1.1 bertrand 918: {
919: (*s_etat_processus).erreur_systeme =
920: d_es_allocation_memoire;
921: return(d_erreur);
922: }
923: }
924: else
925: {
926: if (((*((struct_fonction *) (*s_objet).objet))
927: .nom_fonction = (unsigned char *) malloc(
928: (strlen((*s_etat_processus)
929: .instruction_courante)
930: + 1) * sizeof(unsigned char))) == NULL)
931: {
932: (*s_etat_processus).erreur_systeme =
933: d_es_allocation_memoire;
934: return(d_erreur);
935: }
936:
937: strcpy((*((struct_fonction *) (*s_objet).objet))
938: .nom_fonction, (*s_etat_processus)
939: .instruction_courante);
940: }
941:
942: (*((struct_fonction *) (*s_objet).objet)).fonction =
943: analyse_instruction(s_etat_processus,
944: (*s_etat_processus).instruction_courante);
945:
946: if (empilement(s_etat_processus,
947: &((*s_etat_processus).l_base_pile), s_objet) ==
948: d_erreur)
949: {
950: (*s_etat_processus).erreur_systeme =
951: d_es_allocation_memoire;
952: return(d_erreur);
953: }
954: }
955: else
956: {
957: (*s_etat_processus).test_instruction = 'N';
958: analyse(s_etat_processus, NULL);
959: (*s_etat_processus).test_instruction = 'Y';
960: }
961:
962: free(instruction_majuscule);
963: }
964:
1.69 bertrand 965: erreur = (logical1) (erreur | (((*s_etat_processus)
966: .erreur_execution != d_ex) ? d_erreur : d_absence_erreur));
1.1 bertrand 967: }
968: else
969: {
970: printf("\n");
971:
972: if ((*s_etat_processus).langue == 'F')
973: {
974: printf("+++Erreur : Argument %s invalide\n",
975: (*s_etat_processus).instruction_courante);
976: }
977: else
978: {
979: printf("+++Error : Invalid %s argument\n",
980: (*s_etat_processus).instruction_courante);
981: }
982:
983: fflush(stdout);
984:
1.27 bertrand 985: free((*s_etat_processus).instruction_courante);
1.1 bertrand 986: return(d_erreur);
987: }
988:
989: /*
990: --------------------------------------------------------------------------------
1.60 bertrand 991: Traitement des arrêts simples
1.1 bertrand 992: --------------------------------------------------------------------------------
993: */
994:
995: if ((*s_etat_processus).var_volatile_requete_arret2 != 0)
996: {
997: if ((*s_etat_processus).debug_programme == d_vrai)
998: {
999: (*s_etat_processus).var_volatile_requete_arret2 = 0;
1000: }
1001: else
1002: {
1003: if ((*s_etat_processus).var_volatile_requete_arret2 == -1)
1004: {
1005: if (strncmp(getenv("LANG"), "fr", 2) == 0)
1006: {
1.70 bertrand 1007: printf("[%d] Arrêt\n", (int) getpid());
1.1 bertrand 1008: }
1009: else
1010: {
1011: printf("[%d] Break\n", (int) getpid());
1012: }
1013:
1014: (*s_etat_processus).var_volatile_requete_arret2 = 1;
1015:
1016: fflush(stdout);
1017: }
1018:
1019: if ((*s_etat_processus).niveau_recursivite == 0)
1020: {
1021: (*s_etat_processus).debug_programme = d_vrai;
1022: (*s_etat_processus).var_volatile_requete_arret2 = 0;
1023: }
1024: }
1025: }
1026:
1027: /*
1028: * On ne sort pas du debugger en cas d'une erreur sur un programme
1.60 bertrand 1029: * en cours de débogage.
1.1 bertrand 1030: */
1031:
1032: if ((((*s_etat_processus).erreur_execution != d_ex) ||
1033: ((*s_etat_processus).exception != d_ep)) &&
1034: ((*s_etat_processus).debug_programme == d_vrai))
1035: {
1036: if (test_cfsf(s_etat_processus, 31) == d_vrai)
1037: {
1038: l_element_courant = (*s_etat_processus).l_base_pile_last;
1039:
1040: while(l_element_courant != NULL)
1041: {
1042: if ((s_objet = copie_objet(s_etat_processus,
1043: (*l_element_courant).donnee, 'P')) == NULL)
1044: {
1045: (*s_etat_processus).erreur_systeme =
1046: d_es_allocation_memoire;
1047: return(d_erreur);
1048: }
1049:
1050: if (empilement(s_etat_processus, &((*s_etat_processus)
1051: .l_base_pile), s_objet) == d_erreur)
1052: {
1053: return(d_erreur);
1054: }
1055:
1056: l_element_courant = (*l_element_courant).suivant;
1057: }
1058: }
1059:
1060: if (test_cfsf(s_etat_processus, 51) == d_faux)
1061: {
1062: printf("%s", ds_beep);
1063: }
1064:
1065: if ((message = messages(s_etat_processus)) == NULL)
1066: {
1.27 bertrand 1067: free((*s_etat_processus).instruction_courante);
1.1 bertrand 1068: return(d_erreur);
1069: }
1070:
1071: printf("%s [%d]\n", message, (int) getpid());
1072:
1073: free(message);
1074:
1075: (*s_etat_processus).erreur_execution = d_ex;
1076: (*s_etat_processus).exception = d_ep;
1077: erreur = d_absence_erreur;
1078:
1.69 bertrand 1079: (*s_etat_processus).position_courante -= (integer8)
1.1 bertrand 1080: strlen((*s_etat_processus).instruction_courante);
1081: }
1082:
1083: /*
1084: --------------------------------------------------------------------------------
1.60 bertrand 1085: Test de fin d'exécution du programme RPL/2
1.1 bertrand 1086: --------------------------------------------------------------------------------
1087: */
1088:
1089: if (((*s_etat_processus).niveau_courant == 0) &&
1090: (drapeau_appel_definition != d_vrai))
1091: {
1092: drapeau_fin = d_vrai;
1093: }
1094: else if ((*s_etat_processus).requete_arret == 'Y')
1095: {
1096: drapeau_fin = d_vrai;
1097: }
1098: else if (((*s_etat_processus).var_volatile_requete_arret != 0)
1099: && ((*s_etat_processus).debug_programme == d_faux))
1100: {
1101: drapeau_fin = d_vrai;
1102:
1103: if ((*s_etat_processus).erreur_systeme == d_es)
1104: {
1105: erreur = d_absence_erreur;
1106: }
1107: }
1108: else if ((*s_etat_processus).arret_si_exception == d_vrai)
1109: {
1110: drapeau_fin = d_faux;
1111:
1112: if ((*s_etat_processus).exception != d_ep)
1113: {
1114: erreur = d_erreur;
1115: }
1116: else if ((*s_etat_processus).erreur_systeme != d_es)
1117: {
1118: erreur = d_erreur;
1119: }
1120: }
1121: else if ((*s_etat_processus).arret_si_exception == d_faux)
1122: {
1123: if ((message = messages(s_etat_processus)) == NULL)
1124: {
1125: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
1126: return(d_erreur);
1127: }
1128:
1129: free(message);
1130:
1131: drapeau_fin = d_faux;
1132:
1133: /*
1134: --------------------------------------------------------------------------------
1135: Traitement des exceptions
1136: --------------------------------------------------------------------------------
1137: */
1138:
1139: if ((*s_etat_processus).erreur_systeme != d_es)
1140: {
1141: erreur = d_erreur;
1142: }
1143: else if (((*s_etat_processus).exception != d_ep) ||
1144: ((*s_etat_processus).erreur_execution != d_ex))
1145: {
1146: tampon = (*s_etat_processus).instruction_courante;
1147:
1148: while((*(*s_etat_processus).l_base_pile_systeme).clause != 'R')
1149: {
1150: erreur = recherche_instruction_suivante(s_etat_processus);
1151:
1152: if (erreur == d_erreur)
1153: {
1.27 bertrand 1154: free((*s_etat_processus).instruction_courante);
1.1 bertrand 1155: return(d_erreur);
1156: }
1157:
1158: if (recherche_variable(s_etat_processus,
1159: (*s_etat_processus).instruction_courante) == d_vrai)
1160: {
1.32 bertrand 1161: if ((*(*s_etat_processus).pointeur_variable_courante)
1162: .objet == NULL)
1.1 bertrand 1163: {
1.60 bertrand 1164: // Variable partagée
1.1 bertrand 1165: }
1.32 bertrand 1166: else if ((*(*(*s_etat_processus)
1167: .pointeur_variable_courante).objet).type == ADR)
1.1 bertrand 1168: {
1169: empilement_pile_systeme(s_etat_processus);
1170:
1171: if ((*s_etat_processus).erreur_systeme != d_es)
1172: {
1.27 bertrand 1173: free((*s_etat_processus).instruction_courante);
1.1 bertrand 1174: return(d_erreur);
1175: }
1176:
1177: (*(*s_etat_processus).l_base_pile_systeme)
1178: .adresse_retour = (*s_etat_processus)
1179: .position_courante;
1180:
1181: (*(*s_etat_processus).l_base_pile_systeme)
1182: .retour_definition = 'Y';
1183:
1184: (*(*s_etat_processus).l_base_pile_systeme)
1185: .niveau_courant = (*s_etat_processus)
1186: .niveau_courant;
1187:
1188: (*s_etat_processus).position_courante =
1.69 bertrand 1189: (*((integer8 *)
1.32 bertrand 1190: ((*(*(*s_etat_processus)
1191: .pointeur_variable_courante)
1192: .objet).objet)));
1.1 bertrand 1193:
1194: (*s_etat_processus)
1195: .autorisation_empilement_programme = 'N';
1196: }
1197: }
1198: else
1199: {
1200: (*s_etat_processus).erreur_systeme = d_es;
1201: instruction_majuscule = conversion_majuscule(
1.85 ! bertrand 1202: s_etat_processus, (*s_etat_processus)
! 1203: .instruction_courante);
1.1 bertrand 1204:
1205: if (instruction_majuscule == NULL)
1206: {
1.27 bertrand 1207: free((*s_etat_processus).instruction_courante);
1.1 bertrand 1208: return(d_erreur);
1209: }
1210:
1211: /*
1.60 bertrand 1212: * Traitement de la pile système par les
1213: * différentes instructions.
1.1 bertrand 1214: */
1215:
1216: if ((strcmp(instruction_majuscule, "IF") == 0) ||
1217: (strcmp(instruction_majuscule, "IFERR") == 0) ||
1218: (strcmp(instruction_majuscule, "DO") == 0) ||
1219: (strcmp(instruction_majuscule, "WHILE") == 0) ||
1220: (strcmp(instruction_majuscule, "FOR") == 0) ||
1.56 bertrand 1221: (strcmp(instruction_majuscule, "FORALL") == 0)
1222: ||
1.1 bertrand 1223: (strcmp(instruction_majuscule, "START") == 0) ||
1224: (strcmp(instruction_majuscule, "SELECT") == 0)
1.55 bertrand 1225: ||
1226: (strcmp(instruction_majuscule, "CRITICAL") == 0)
1.1 bertrand 1227: || (strcmp(instruction_majuscule, "CASE") == 0)
1228: || (strcmp(instruction_majuscule, "<<") == 0))
1229: {
1230: if (strcmp(instruction_majuscule, "<<") == 0)
1231: {
1232: analyse(s_etat_processus, NULL);
1233: }
1.56 bertrand 1234: else if ((strcmp(instruction_majuscule, "FOR") == 0)
1.57 bertrand 1235: || (strcmp(instruction_majuscule, "FORALL")
1236: == 0) || (strcmp(instruction_majuscule,
1237: "START") == 0))
1.56 bertrand 1238: {
1239: empilement_pile_systeme(s_etat_processus);
1240:
1241: if ((*s_etat_processus).erreur_systeme != d_es)
1242: {
1243: return(d_erreur);
1244: }
1245:
1246: (*(*s_etat_processus).l_base_pile_systeme)
1247: .type_cloture = 'L';
1248: }
1.1 bertrand 1249: else
1250: {
1251: empilement_pile_systeme(s_etat_processus);
1252:
1253: if ((*s_etat_processus).erreur_systeme != d_es)
1254: {
1255: return(d_erreur);
1256: }
1257: }
1258: }
1259: else if ((strcmp(instruction_majuscule, "END") == 0) ||
1260: (strcmp(instruction_majuscule, "NEXT") == 0) ||
1261: (strcmp(instruction_majuscule, "STEP") == 0) ||
1262: (strcmp(instruction_majuscule, ">>") == 0))
1263: {
1264: if (strcmp(instruction_majuscule, ">>") == 0)
1265: {
1266: analyse(s_etat_processus, NULL);
1267:
1268: if ((*(*s_etat_processus).l_base_pile_systeme)
1269: .origine_routine_evaluation == 'Y')
1270: {
1271: free(instruction_majuscule);
1272: free((*s_etat_processus)
1273: .instruction_courante);
1274:
1275: (*s_etat_processus).instruction_courante =
1276: tampon;
1277:
1278: return(d_absence_erreur);
1279: }
1280: }
1.56 bertrand 1281: else if (((strcmp(instruction_majuscule, "NEXT")
1282: == 0) || (strcmp(instruction_majuscule,
1283: "STEP") == 0)) && ((*(*s_etat_processus)
1284: .l_base_pile_systeme).type_cloture != 'L'))
1285: {
1286: /*
1.60 bertrand 1287: * Libération des compteurs de boucle.
1.56 bertrand 1288: */
1289:
1.57 bertrand 1290: presence_compteur = (((*(*s_etat_processus)
1291: .l_base_pile_systeme).type_cloture
1292: == 'F') || ((*(*s_etat_processus)
1.56 bertrand 1293: .l_base_pile_systeme).type_cloture
1.57 bertrand 1294: == 'A')) ? d_vrai : d_faux;
1.56 bertrand 1295:
1296: if (((*(*s_etat_processus).l_base_pile_systeme)
1297: .type_cloture != 'S') &&
1298: (presence_compteur == d_faux))
1299: {
1300: return(d_erreur);
1301: }
1302:
1303: if (presence_compteur == d_vrai)
1304: {
1305: if (recherche_variable(s_etat_processus,
1306: (*(*s_etat_processus)
1307: .l_base_pile_systeme).nom_variable)
1308: == d_faux)
1309: {
1310: return(d_erreur);
1311: }
1312:
1313: if ((*(*s_etat_processus)
1314: .pointeur_variable_courante).objet
1315: == NULL)
1316: {
1317: return(d_erreur);
1318: }
1319:
1320: (*s_etat_processus).niveau_courant--;
1321:
1.59 bertrand 1322: if (retrait_variables_par_niveau(
1.56 bertrand 1323: s_etat_processus) == d_erreur)
1324: {
1325: return(d_erreur);
1326: }
1327: }
1328:
1329: depilement_pile_systeme(s_etat_processus);
1330:
1331: if ((*s_etat_processus).erreur_systeme != d_es)
1332: {
1333: return(d_erreur);
1334: }
1335: }
1.1 bertrand 1336: else
1337: {
1.60 bertrand 1338: // Traitement spécifique pour la fin
1.55 bertrand 1339: // d'une section critique
1340:
1341: if ((*s_etat_processus).l_base_pile_systeme
1342: == NULL)
1343: {
1344: (*s_etat_processus).erreur_systeme =
1345: d_es_processus;
1346: return(d_erreur);
1347: }
1348:
1349: if ((*(*s_etat_processus).l_base_pile_systeme)
1350: .type_cloture == 'Q')
1351: {
1352: if (pthread_mutex_unlock(
1353: &mutex_sections_critiques) != 0)
1354: {
1355: (*s_etat_processus).erreur_systeme =
1356: d_es_processus;
1357: return(d_erreur);
1358: }
1359:
1360: (*s_etat_processus).sections_critiques--;
1361: }
1362:
1.1 bertrand 1363: depilement_pile_systeme(s_etat_processus);
1364:
1365: if ((*s_etat_processus).erreur_systeme != d_es)
1366: {
1367: return(d_erreur);
1368: }
1369: }
1370: }
1371:
1372: free(instruction_majuscule);
1373: }
1374:
1375: free((*s_etat_processus).instruction_courante);
1376: }
1377:
1378: drapeau_then = d_faux;
1379: niveau = 0;
1380:
1381: do
1382: {
1383: erreur = recherche_instruction_suivante(s_etat_processus);
1384:
1385: if (erreur == d_erreur)
1386: {
1387: return(d_erreur);
1388: }
1389:
1390: instruction_majuscule = conversion_majuscule(
1.85 ! bertrand 1391: s_etat_processus,
1.1 bertrand 1392: (*s_etat_processus).instruction_courante);
1393:
1394: if (instruction_majuscule == NULL)
1395: {
1396: return(d_erreur);
1397: }
1398:
1399: if ((strcmp(instruction_majuscule, "IF") == 0) ||
1400: (strcmp(instruction_majuscule, "IFERR") == 0) ||
1401: (strcmp(instruction_majuscule, "DO") == 0) ||
1402: (strcmp(instruction_majuscule, "WHILE") == 0) ||
1403: (strcmp(instruction_majuscule, "FOR") == 0) ||
1.56 bertrand 1404: (strcmp(instruction_majuscule, "FORALL") == 0) ||
1.1 bertrand 1405: (strcmp(instruction_majuscule, "START") == 0) ||
1406: (strcmp(instruction_majuscule, "SELECT") == 0)
1.55 bertrand 1407: || (strcmp(instruction_majuscule, "CRITICAL") == 0)
1.1 bertrand 1408: || (strcmp(instruction_majuscule, "CASE") == 0)
1409: || (strcmp(instruction_majuscule, "<<") == 0))
1410: {
1411: niveau++;
1412: }
1413: else if ((strcmp(instruction_majuscule, "END") == 0) ||
1414: (strcmp(instruction_majuscule, "NEXT") == 0) ||
1415: (strcmp(instruction_majuscule, "STEP") == 0) ||
1416: (strcmp(instruction_majuscule, ">>") == 0))
1417: {
1418: niveau--;
1419: }
1420:
1421: drapeau_then = ((strcmp(instruction_majuscule, "THEN") == 0)
1422: && (niveau == 0)) ? d_vrai : d_faux;
1423:
1424: free(instruction_majuscule);
1425: free((*s_etat_processus).instruction_courante);
1426: } while(drapeau_then == d_faux);
1427:
1428: (*s_etat_processus).position_courante -= 5;
1429: (*s_etat_processus).instruction_courante = tampon;
1430: (*(*s_etat_processus).l_base_pile_systeme).clause = 'X';
1431:
1432: erreur = d_absence_erreur;
1433: (*s_etat_processus).exception = d_ep;
1434: (*s_etat_processus).erreur_execution = d_ex;
1435: }
1436: }
1437: else
1438: {
1439: drapeau_fin = d_faux;
1440: }
1441:
1442: if (erreur == d_absence_erreur)
1443: {
1444: free((*s_etat_processus).instruction_courante);
1445: }
1446: } while((erreur == d_absence_erreur) &&
1447: ((*s_etat_processus).position_courante <
1448: (*s_etat_processus).longueur_definitions_chainees) &&
1449: (drapeau_fin == d_faux) &&
1450: ((*s_etat_processus).retour_routine_evaluation == 'N'));
1451:
1452: /*
1453: --------------------------------------------------------------------------------
1.60 bertrand 1454: Messages d'erreur à afficher le cas échéant
1.1 bertrand 1455: --------------------------------------------------------------------------------
1456: */
1457:
1458: if ((erreur != d_absence_erreur) && ((*s_etat_processus)
1459: .invalidation_message_erreur == d_faux))
1460: {
1461: if (test_cfsf(s_etat_processus, 31) == d_vrai)
1462: {
1463: l_element_courant = (*s_etat_processus).l_base_pile_last;
1464:
1465: while(l_element_courant != NULL)
1466: {
1467: if ((s_objet = copie_objet(s_etat_processus,
1468: (*l_element_courant).donnee, 'P')) == NULL)
1469: {
1470: (*s_etat_processus).erreur_systeme =
1471: d_es_allocation_memoire;
1472: return(d_erreur);
1473: }
1474:
1475: if (empilement(s_etat_processus, &((*s_etat_processus)
1476: .l_base_pile), s_objet) == d_erreur)
1477: {
1478: return(d_erreur);
1479: }
1480:
1481: l_element_courant = (*l_element_courant).suivant;
1482: }
1483: }
1484:
1485: if (test_cfsf(s_etat_processus, 51) == d_faux)
1486: {
1487: printf("%s", ds_beep);
1488: }
1489:
1490: if ((message = messages(s_etat_processus)) == NULL)
1491: {
1492: return(d_erreur);
1493: }
1494:
1495: printf("%s [%d]\n", message, (int) getpid());
1496:
1497: free(message);
1498: free((*s_etat_processus).instruction_courante);
1499:
1500: if ((*s_etat_processus).var_volatile_processus_pere == 0)
1501: {
1.43 bertrand 1502: envoi_signal_processus((*s_etat_processus).pid_processus_pere,
1503: rpl_sigalrm);
1.1 bertrand 1504: }
1505: else
1506: {
1507: (*s_etat_processus).var_volatile_alarme = -1;
1508: }
1509:
1510: return(d_erreur);
1511: }
1512:
1513: return(d_absence_erreur);
1514: }
1515:
1516: // vim: ts=4
CVSweb interface <joel.bertrand@systella.fr>