1: /*
2: ================================================================================
3: RPL/2 (R) version 4.0.16
4: Copyright (C) 1989-2010 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 '<<'
29: ================================================================================
30: Entrées :
31: --------------------------------------------------------------------------------
32: Sorties :
33: --------------------------------------------------------------------------------
34: Effets de bord : néant
35: ================================================================================
36: */
37:
38: void
39: instruction_vers_niveau_superieur(struct_processus *s_etat_processus)
40: {
41: (*s_etat_processus).erreur_execution = d_ex;
42:
43: if ((*s_etat_processus).affichage_arguments == 'Y')
44: {
45: return;
46: }
47: else if ((*s_etat_processus).test_instruction == 'Y')
48: {
49: (*s_etat_processus).instruction_valide = 'Y';
50: (*s_etat_processus).nombre_arguments = -1;
51: return;
52: }
53:
54: empilement_pile_systeme(s_etat_processus);
55:
56: if ((*s_etat_processus).erreur_systeme != d_es)
57: {
58: return;
59: }
60:
61: if ((*s_etat_processus).mode_execution_programme == 'I')
62: {
63: (*(*s_etat_processus).l_base_pile_systeme).niveau_courant =
64: (*s_etat_processus).niveau_courant;
65: (*(*s_etat_processus).l_base_pile_systeme)
66: .origine_routine_evaluation = 'Y';
67: (*s_etat_processus).mode_execution_programme = 'N';
68: }
69:
70: (*s_etat_processus).niveau_courant++;
71: (*s_etat_processus).autorisation_empilement_programme = 'Y';
72:
73: if ((*s_etat_processus).debug == d_vrai)
74: if (((*s_etat_processus).type_debug &
75: d_debug_niveaux) != 0)
76: {
77: if ((*s_etat_processus).langue == 'F')
78: {
79: printf("[%d] Initialisation du niveau %lu\n", (int) getpid(),
80: (*s_etat_processus).niveau_courant);
81: }
82: else
83: {
84: printf("[%d] Initialization of level %lu\n", (int) getpid(),
85: (*s_etat_processus).niveau_courant);
86: }
87:
88: fflush(stdout);
89: }
90:
91: return;
92: }
93:
94:
95: /*
96: ================================================================================
97: Fonction '>>'
98: ================================================================================
99: Entrées :
100: --------------------------------------------------------------------------------
101: Sorties :
102: --------------------------------------------------------------------------------
103: Effets de bord : néant
104: ================================================================================
105: */
106:
107: void
108: instruction_vers_niveau_inferieur(struct_processus *s_etat_processus)
109: {
110: (*s_etat_processus).erreur_execution = d_ex;
111:
112: if ((*s_etat_processus).affichage_arguments == 'Y')
113: {
114: return;
115: }
116: else if ((*s_etat_processus).test_instruction == 'Y')
117: {
118: (*s_etat_processus).instruction_valide = 'Y';
119: (*s_etat_processus).nombre_arguments = -1;
120: return;
121: }
122:
123: if ((*s_etat_processus).debug == d_vrai)
124: if (((*s_etat_processus).type_debug &
125: d_debug_niveaux) != 0)
126: {
127: if ((*s_etat_processus).langue == 'F')
128: {
129: printf("[%d] Fermeture du niveau %lu\n", (int) getpid(),
130: (*s_etat_processus).niveau_courant);
131: }
132: else
133: {
134: printf("[%d] Closing of level %lu\n", (int) getpid(),
135: (*s_etat_processus).niveau_courant);
136: }
137:
138: fflush(stdout);
139: }
140:
141: (*s_etat_processus).niveau_courant--;
142: depilement_pile_systeme(s_etat_processus);
143:
144: if ((*s_etat_processus).erreur_systeme != d_es)
145: {
146: return;
147: }
148:
149: if ((*(*s_etat_processus).l_base_pile_systeme).retour_definition == 'Y')
150: {
151: if ((*s_etat_processus).debug == d_vrai)
152: if (((*s_etat_processus).type_debug &
153: d_debug_appels_fonctions) != 0)
154: {
155: if ((*s_etat_processus).niveau_recursivite == 0)
156: {
157: if ((*s_etat_processus).langue == 'F')
158: {
159: printf("[%d] Retour\n", (int) getpid());
160: }
161: else
162: {
163: printf("[%d] Return\n", (int) getpid());
164: }
165: }
166: else
167: {
168: if ((*s_etat_processus).langue == 'F')
169: {
170: printf("[%d] Retour récursif de niveau "
171: "%lu\n", (int) getpid(), (*s_etat_processus)
172: .niveau_recursivite);
173: }
174: else
175: {
176: printf("[%d] Level %lu recursive "
177: "return\n", (int) getpid(), (*s_etat_processus)
178: .niveau_recursivite);
179: }
180: }
181:
182: fflush(stdout);
183: }
184:
185: if ((*s_etat_processus).l_base_pile_systeme != NULL)
186: {
187: if ((*(*s_etat_processus).l_base_pile_systeme)
188: .origine_routine_evaluation == 'N')
189: {
190: (*s_etat_processus).position_courante =
191: (*(*s_etat_processus).l_base_pile_systeme)
192: .adresse_retour;
193:
194: if ((*s_etat_processus).profilage == d_vrai)
195: {
196: profilage(s_etat_processus, NULL);
197: }
198:
199: depilement_pile_systeme(s_etat_processus);
200:
201: if ((*s_etat_processus).erreur_systeme != d_es)
202: {
203: return;
204: }
205: }
206: else
207: {
208: (*s_etat_processus).retour_routine_evaluation = 'Y';
209: }
210: }
211: }
212:
213: /*
214: * Destruction des variables locales
215: * de niveau supérieur au niveau courant.
216: */
217:
218: if (((*s_etat_processus).niveau_recursivite == 0) && ((*s_etat_processus)
219: .s_liste_variables != NULL) && ((*s_etat_processus)
220: .gel_liste_variables == d_faux))
221: {
222: if (retrait_variable_par_niveau(s_etat_processus) == d_erreur)
223: {
224: return;
225: }
226: }
227:
228: return;
229: }
230:
231: // vim: ts=4
CVSweb interface <joel.bertrand@systella.fr>