Grelet Jacques / statis

Dependents:   Ni-MH_V3

Revision:
3:27019c77bf90
Parent:
1:a4c87bc5b008
Child:
4:080b3e0819a1
--- a/ring.h	Fri Nov 30 12:58:53 2012 +0000
+++ b/ring.h	Sun Dec 02 16:35:56 2012 +0000
@@ -1,50 +1,50 @@
 /* Copyright (c) <2012> <copyright J. Grelet>, MIT License
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 
- * and associated documentation files (the "Software"), to deal in the Software without restriction, 
- * including without limitation the rights to use, copy, modify, merge, publish, distribute, 
- * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute,
+ * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
  * furnished to do so, subject to the following conditions:
  *
- * The above copyright notice and this permission notice shall be included in all copies or 
+ * The above copyright notice and this permission notice shall be included in all copies or
  * substantial portions of the Software.
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
+ * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
- 
- /*****************************************************************************
- *                                                                           *
- * ring.cpp : Module template de gestion de buffers circulaires tous types   *
- *                                                                           *
- *          Jacques Grelet      Mars 1992                                    *
- *          Bruno Buisson       Aout 92                                      *
- *          - Modif lecture buffer : si plein, on perd la plus   *
- *                                   ancienne valeur, pas toutes *
- *          - Nouvelles fonctions : vide_ring_x() vide le buffer *
- *                                  term_ring_x() libere la mem  *
- *                                  pr_ring_list() (debug)       *
- *                                  swap_ring_x() construit list *
- *                                  libre_ring_x() taille dispo  *
- *                                                                           *
- *          Bruno Buisson       Novembre 95                                  *
- *                      - Ajout de la fonction top_ring_x() qui retourne sans*
- *                        supprimer du ring le premier de la liste           *
- *                                                                           *
- *                              Avril 96                                     *
- *                      - Version template                                   *
- *                        Modification des fonctions fct_x(r,) en r.fct()    *
- *                        Suppression des fonctions init et term             *
- *                        (constructeur / destructeur)                       *
- *                        Les fonctions ont ete renommees                    *
- *                        Nouvelle fonction shift( n ) : supprime n elements *
- *                                                                           *
-  *         J. Grelet            Novembre  2012                              *
-  *                      - Adapted for mbed ARM cortex                       *
- *****************************************************************************/
+
+/*****************************************************************************
+*                                                                           *
+* ring.cpp : Module template de gestion de buffers circulaires tous types   *
+*                                                                           *
+*          Jacques Grelet      Mars 1992                                    *
+*          Bruno Buisson       Aout 92                                      *
+*          - Modif lecture buffer : si plein, on perd la plus   *
+*                                   ancienne valeur, pas toutes *
+*          - Nouvelles fonctions : vide_ring_x() vide le buffer *
+*                                  term_ring_x() libere la mem  *
+*                                  pr_ring_list() (debug)       *
+*                                  swap_ring_x() construit list *
+*                                  libre_ring_x() taille dispo  *
+*                                                                           *
+*          Bruno Buisson       Novembre 95                                  *
+*                      - Ajout de la fonction top_ring_x() qui retourne sans*
+*                        supprimer du ring le premier de la liste           *
+*                                                                           *
+*                              Avril 96                                     *
+*                      - Version template                                   *
+*                        Modification des fonctions fct_x(r,) en r.fct()    *
+*                        Suppression des fonctions init et term             *
+*                        (constructeur / destructeur)                       *
+*                        Les fonctions ont ete renommees                    *
+*                        Nouvelle fonction shift( n ) : supprime n elements *
+*                                                                           *
+ *         J. Grelet            Novembre  2012                              *
+ *                      - Adapted for mbed ARM cortex                       *
+*****************************************************************************/
 
 #ifdef DEBUG
 #include "mbed.h"
@@ -176,7 +176,7 @@
 {
     libre    = taille;
     lecture  =
-        ecriture = tampon;
+    ecriture = tampon;
 }
 
 /*****************************************************************************
@@ -193,16 +193,11 @@
     unsigned nb_elem = taille - libre,
              i;
 
-    //DPRINTF( ("\r\nList: ") );
     for( i = 0; i < nb_elem; i++ ) {
         list[ i ] = *lecture;
-        //DPRINTF( ("%4.3g ", list[ i ] ));
         incr( lecture );
     }
-    //DPRINTF( ("\r\n") );
-    libre    = taille;
-    lecture  =
-        ecriture = tampon;
+    vide();
     return( nb_elem );
 }
 
@@ -221,11 +216,11 @@
 Ring<T_elem>::Ring( unsigned size /*=0*/ )
 {
     lecture  =
-        ecriture =
-            tampon   = ( size == 0 ? (P_ELEM) NULL : FARALLOUE( size,T_elem ) );
+    ecriture =
+    tampon   = ( size == 0 ? (P_ELEM) NULL : FARALLOUE( size,T_elem ) );
     list     = ( size == 0 ? (P_ELEM) NULL : FARALLOUE( size,T_elem ) );
     libre    =
-        taille   = ( tampon ? size : 0 );
+    taille   = ( tampon ? size : 0 );
 }
 
 /*****************************************************************************
@@ -236,11 +231,11 @@
     FARLIBERE( tampon );
     FARLIBERE( list   );
     libre    =
-        taille   = 0;
+    taille   = 0;
     lecture  =
-        ecriture =
-            tampon   =
-                list     = (P_ELEM) NULL;
+    ecriture =
+    tampon   =
+    list     = (P_ELEM) NULL;
 }
 
 #endif