/* ================================================================================ RPL/2 (R) version 4.1.9 Copyright (C) 1989-2012 Dr. BERTRAND Joël This file is part of RPL/2. RPL/2 is free software; you can redistribute it and/or modify it under the terms of the CeCILL V2 License as published by the french CEA, CNRS and INRIA. RPL/2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the CeCILL V2 License for more details. You should have received a copy of the CeCILL License along with RPL/2. If not, write to info@cecill.info. ================================================================================ */ #include "rpl-conv.h" /* ================================================================================ Positionnement d'un drapeau d'indicateur à 1 ================================================================================ Entrée : - pointeur sur la structure processus - numero du drapeau à mettre à 1 (INTEGER*1) -------------------------------------------------------------------------------- Sortie : néant -------------------------------------------------------------------------------- Effets de bord : néant ================================================================================ */ void sf(struct_processus *s_etat_processus, unsigned char indice_drapeau) { t_8_bits masque; unsigned char indice_bit; unsigned char indice_bloc; unsigned char taille_bloc; indice_drapeau--; taille_bloc = sizeof(t_8_bits) * 8; indice_bloc = indice_drapeau / taille_bloc; indice_bit = indice_drapeau % taille_bloc; masque = ((t_8_bits) 1) << (taille_bloc - indice_bit - 1); (*s_etat_processus).drapeaux_etat[indice_bloc] |= masque; } /* ================================================================================ Positionnement d'un drapeau d'indicateur à 0 ================================================================================ Entrée : - pointeur sur la structure processus - numero du drapeau à mettre à 0 (INTEGER*1) -------------------------------------------------------------------------------- Sortie : néant -------------------------------------------------------------------------------- Effets de bord : néant ================================================================================ */ void cf(struct_processus *s_etat_processus, unsigned char indice_drapeau) { t_8_bits masque; unsigned char indice_bit; unsigned char indice_bloc; unsigned char taille_bloc; indice_drapeau--; taille_bloc = sizeof(t_8_bits) * 8; indice_bloc = indice_drapeau / taille_bloc; indice_bit = indice_drapeau % taille_bloc; masque = ~(((t_8_bits) 1) << (taille_bloc - indice_bit - 1)); (*s_etat_processus).drapeaux_etat[indice_bloc] &= masque; } /* ================================================================================ Routine renvoyant l'état d'un indicateur ================================================================================ Entrée : - pointeur sur la structure processus - numero du drapeau à mettre à 0 (INTEGER*1) -------------------------------------------------------------------------------- Sortie : drapeau -------------------------------------------------------------------------------- Effets de bord : néant ================================================================================ */ logical1 test_cfsf(struct_processus *s_etat_processus, unsigned char indice_drapeau) { t_8_bits masque; unsigned char indice_bit; unsigned char indice_bloc; unsigned char taille_bloc; indice_drapeau--; taille_bloc = sizeof(t_8_bits) * 8; indice_bloc = indice_drapeau / taille_bloc; indice_bit = indice_drapeau % taille_bloc; masque = ((t_8_bits) 1) << (taille_bloc - indice_bit - 1); return((((*s_etat_processus).drapeaux_etat[indice_bloc] & masque) != 0) ? d_vrai : d_faux); } // vim: ts=4