[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/net/collection CacheC.nc, 1.1.2.2, 1.1.2.3 CacheP.nc, 1.1.2.2, 1.1.2.3

Rodrigo Fonseca rfonseca76 at users.sourceforge.net
Thu Jun 22 10:03:55 PDT 2006


Update of /cvsroot/tinyos/tinyos-2.x/tos/lib/net/collection
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv14191

Modified Files:
      Tag: tinyos-2_0_devel-BRANCH
	CacheC.nc CacheP.nc 
Log Message:
Changed name of key_t parameter. Workaround for small nesc bug


Index: CacheC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/collection/Attic/CacheC.nc,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** CacheC.nc	22 Jun 2006 14:09:47 -0000	1.1.2.2
--- CacheC.nc	22 Jun 2006 17:03:53 -0000	1.1.2.3
***************
*** 1,7 ****
! generic configuration CacheC(typedef key_t @integer(), uint8_t CACHE_SIZE) {
!     provides interface Cache<key_t>;
  }
  implementation {
!     components MainC, new CacheP(key_t, CACHE_SIZE);
      
      Cache = CacheP;
--- 1,7 ----
! generic configuration CacheC(typedef  cache_key_t at integer(), uint8_t CACHE_SIZE) {
!     provides interface Cache<cache_key_t>;
  }
  implementation {
!     components MainC, new CacheP(cache_key_t, CACHE_SIZE);
      
      Cache = CacheP;

Index: CacheP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/collection/Attic/CacheP.nc,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** CacheP.nc	22 Jun 2006 14:09:47 -0000	1.1.2.2
--- CacheP.nc	22 Jun 2006 17:03:53 -0000	1.1.2.3
***************
*** 3,14 ****
   * Insert on an element already in the cache will refresh its age.
   */
! generic module CacheP(typedef key_t @integer(), uint8_t size) {
      provides {
          interface Init;
!         interface Cache<key_t>;
      }
  }
  implementation {
!     key_t cache[size];
      uint8_t first;
      uint8_t count;
--- 3,14 ----
   * Insert on an element already in the cache will refresh its age.
   */
! generic module CacheP(typedef cache_key_t @integer(), uint8_t size) {
      provides {
          interface Init;
!         interface Cache<cache_key_t>;
      }
  }
  implementation {
!     cache_key_t cache[size];
      uint8_t first;
      uint8_t count;
***************
*** 34,40 ****
  
      /* if key is in cache returns the index (offset by first), otherwise returns count */
!     uint8_t lookup(key_t key) {
          uint8_t i;
! 	key_t k;
          for (i = 0; i < count; i++) {
  	   k = cache[(i + first) % size];
--- 34,40 ----
  
      /* if key is in cache returns the index (offset by first), otherwise returns count */
!     uint8_t lookup(cache_key_t key) {
          uint8_t i;
! 	cache_key_t k;
          for (i = 0; i < count; i++) {
  	   k = cache[(i + first) % size];
***************
*** 62,66 ****
      }
  
!     command void Cache.insert(key_t key) {
          uint8_t i;
          if (count == size ) {
--- 62,66 ----
      }
  
!     command void Cache.insert(cache_key_t key) {
          uint8_t i;
          if (count == size ) {
***************
*** 78,82 ****
      }
  
!     command bool Cache.lookup(key_t key) {
          return (lookup(key) < count);
      }
--- 78,82 ----
      }
  
!     command bool Cache.lookup(cache_key_t key) {
          return (lookup(key) < count);
      }
***************
*** 85,89 ****
       * Returns SUCCESS if item was in cache,
       *         FAIL if item was not in cache */
!     command error_t Cache.remove(key_t key) {
      }
  
--- 85,89 ----
       * Returns SUCCESS if item was in cache,
       *         FAIL if item was not in cache */
!     command error_t Cache.remove(cache_key_t key) {
      }
  



More information about the Tinyos-2-commits mailing list