File:
[local] /
rpl /
src /
indicateurs.c
Revision
1.21:
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Jun 21 15:26:30 2011 UTC (12 years, 10 months ago) by
bertrand
Branches:
MAIN
CVS tags:
HEAD
Correction d'une réinitialisation sauvage de la pile des variables par niveau
dans la copie de la structure de description du processus. Cela corrige
la fonction SPAWN qui échouait sur un segmentation fault car la pile des
variables par niveau était vide alors même que l'arbre des variables contenait
bien les variables. Passage à la prerelease 2.
1: /*
2: ================================================================================
3: RPL/2 (R) version 4.1.0.prerelease.2
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: Positionnement d'un drapeau d'indicateur à 1
29: ================================================================================
30: Entrée :
31: - pointeur sur la structure processus
32: - numero du drapeau à mettre à 1 (INTEGER*1)
33: --------------------------------------------------------------------------------
34: Sortie : néant
35: --------------------------------------------------------------------------------
36: Effets de bord : néant
37: ================================================================================
38: */
39:
40: void
41: sf(struct_processus *s_etat_processus, unsigned char indice_drapeau)
42: {
43: t_8_bits masque;
44:
45: unsigned char indice_bit;
46: unsigned char indice_bloc;
47: unsigned char taille_bloc;
48:
49: indice_drapeau--;
50: taille_bloc = sizeof(t_8_bits) * 8;
51: indice_bloc = indice_drapeau / taille_bloc;
52: indice_bit = indice_drapeau % taille_bloc;
53:
54: masque = ((t_8_bits) 1) << (taille_bloc - indice_bit - 1);
55:
56: (*s_etat_processus).drapeaux_etat[indice_bloc] |= masque;
57: }
58:
59:
60: /*
61: ================================================================================
62: Positionnement d'un drapeau d'indicateur à 0
63: ================================================================================
64: Entrée :
65: - pointeur sur la structure processus
66: - numero du drapeau à mettre à 0 (INTEGER*1)
67: --------------------------------------------------------------------------------
68: Sortie : néant
69: --------------------------------------------------------------------------------
70: Effets de bord : néant
71: ================================================================================
72: */
73:
74: void
75: cf(struct_processus *s_etat_processus, unsigned char indice_drapeau)
76: {
77: t_8_bits masque;
78:
79: unsigned char indice_bit;
80: unsigned char indice_bloc;
81: unsigned char taille_bloc;
82:
83: indice_drapeau--;
84: taille_bloc = sizeof(t_8_bits) * 8;
85: indice_bloc = indice_drapeau / taille_bloc;
86: indice_bit = indice_drapeau % taille_bloc;
87:
88: masque = ~(((t_8_bits) 1) << (taille_bloc - indice_bit - 1));
89:
90: (*s_etat_processus).drapeaux_etat[indice_bloc] &= masque;
91: }
92:
93:
94: /*
95: ================================================================================
96: Routine renvoyant l'état d'un indicateur
97: ================================================================================
98: Entrée :
99: - pointeur sur la structure processus
100: - numero du drapeau à mettre à 0 (INTEGER*1)
101: --------------------------------------------------------------------------------
102: Sortie : drapeau
103: --------------------------------------------------------------------------------
104: Effets de bord : néant
105: ================================================================================
106: */
107:
108: logical1
109: test_cfsf(struct_processus *s_etat_processus, unsigned char indice_drapeau)
110: {
111: t_8_bits masque;
112:
113: unsigned char indice_bit;
114: unsigned char indice_bloc;
115: unsigned char taille_bloc;
116:
117: indice_drapeau--;
118: taille_bloc = sizeof(t_8_bits) * 8;
119: indice_bloc = indice_drapeau / taille_bloc;
120: indice_bit = indice_drapeau % taille_bloc;
121:
122: masque = ((t_8_bits) 1) << (taille_bloc - indice_bit - 1);
123:
124: return((((*s_etat_processus).drapeaux_etat[indice_bloc] & masque) != 0)
125: ? d_vrai : d_faux);
126: }
127:
128: // vim: ts=4
CVSweb interface <joel.bertrand@systella.fr>