Commit from tof on branch b_tof (2007-03-26 19:42 CEST) -------------------------------
better list : possibility to delete items aversive modules/base/list/list.h 1.14.2.3 --------------------------------- aversive/modules/base/list/list.h (1.14.2.2 -> 1.14.2.3) --------------------------------- *************** *** 15,21 **** * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ! * Revision : $Id: list.h,v 1.14.2.2 2006-11-25 20:22:47 tof Exp $ * */ --- 15,21 ---- * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ! * Revision : $Id: list.h,v 1.14.2.3 2007-03-26 17:42:44 tof Exp $ * */ *************** *** 212,219 **** uint8_t ret=0; \ if( LIST_EMPTY(list) ) \ ret=EINVAL; \ ! else if (elt_p) { \ ! *elt_p = list.elt [ list.hdr.beg_indice ] ; \ list.hdr.beg_indice = (list.hdr.beg_indice+1) % list.hdr.size; \ list.hdr.cur_size -- ; \ } \ --- 212,220 ---- uint8_t ret=0; \ if( LIST_EMPTY(list) ) \ ret=EINVAL; \ ! else { \ ! if (elt_p) \ ! *elt_p = list.elt [ list.hdr.beg_indice ] ; \ list.hdr.beg_indice = (list.hdr.beg_indice+1) % list.hdr.size; \ list.hdr.cur_size -- ; \ } \ *************** *** 226,233 **** uint8_t ret=0; \ if( LIST_EMPTY(list) ) \ ret=EINVAL; \ ! else if (elt_p) { \ ! *elt_p = list.elt [ (list.hdr.beg_indice-1+list.hdr.cur_size) % list.hdr.size ] ; \ list.hdr.cur_size -- ; \ } \ if(DEBUG) \ --- 227,235 ---- uint8_t ret=0; \ if( LIST_EMPTY(list) ) \ ret=EINVAL; \ ! else \ ! if (elt_p) { \ ! *elt_p = list.elt [ (list.hdr.beg_indice-1+list.hdr.cur_size) % list.hdr.size ] ; \ list.hdr.cur_size -- ; \ } \ if(DEBUG) \ *************** *** 267,274 **** #define LIST_ARRAY_PULL_START(list, array, nb) ({\ uint8_t ret=0, i; \ ! if(!array) \ ! ret=EINVAL; \ else { \ for(i=0 ; (i<nb) && (!ret) ; i++) { \ ret=LIST_PULL_START(list, (array+i)); \ --- 269,278 ---- #define LIST_ARRAY_PULL_START(list, array, nb) ({\ uint8_t ret=0, i; \ ! if(!array) {\ ! for(i=0 ; (i<nb) && (!ret) ; i++) { \ ! ret=LIST_PULL_START(list, (array)); \ ! }\ else { \ for(i=0 ; (i<nb) && (!ret) ; i++) { \ ret=LIST_PULL_START(list, (array+i)); \ *************** *** 283,289 **** uint8_t ret=0; \ int8_t i; \ if(!array) \ ! ret=EINVAL; \ else { \ for(i=nb-1 ; (i>=0) && (!ret) ; i--) { \ ret=LIST_PULL_END(list, (array+i)); \ --- 287,295 ---- uint8_t ret=0; \ int8_t i; \ if(!array) \ ! for(i=nb-1 ; (i>=0) && (!ret) ; i--) { \ ! ret=LIST_PULL_END(list, (array)); \ ! }\ else { \ for(i=nb-1 ; (i>=0) && (!ret) ; i--) { \ ret=LIST_PULL_END(list, (array+i)); \ Commit from tof on branch b_tof (2007-03-26 20:14 CEST) ------------------------------- list : better behaviour aversive modules/base/list/list.h 1.14.2.4 --------------------------------- aversive/modules/base/list/list.h (1.14.2.3 -> 1.14.2.4) --------------------------------- *************** *** 15,21 **** * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ! * Revision : $Id: list.h,v 1.14.2.3 2007-03-26 17:42:44 tof Exp $ * */ --- 15,21 ---- * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ! * Revision : $Id: list.h,v 1.14.2.4 2007-03-26 18:14:06 tof Exp $ * */ *************** *** 227,234 **** uint8_t ret=0; \ if( LIST_EMPTY(list) ) \ ret=EINVAL; \ ! else \ ! if (elt_p) { \ *elt_p = list.elt [ (list.hdr.beg_indice-1+list.hdr.cur_size) % list.hdr.size ] ; \ list.hdr.cur_size -- ; \ } \ --- 227,234 ---- uint8_t ret=0; \ if( LIST_EMPTY(list) ) \ ret=EINVAL; \ ! else {\ ! if (elt_p) \ *elt_p = list.elt [ (list.hdr.beg_indice-1+list.hdr.cur_size) % list.hdr.size ] ; \ list.hdr.cur_size -- ; \ } \ *************** *** 270,285 **** #define LIST_ARRAY_PULL_START(list, array, nb) ({\ uint8_t ret=0, i; \ if(!array) {\ ! for(i=0 ; (i<nb) && (!ret) ; i++) { \ ret=LIST_PULL_START(list, (array)); \ }\ else { \ ! for(i=0 ; (i<nb) && (!ret) ; i++) { \ ret=LIST_PULL_START(list, (array+i)); \ ! } \ } \ if(DEBUG) \ ! printf("LIST_ARRAY_PULL_START(%s, %s, %d) -> ret %d"CR,#list, #array, nb, ret); \ ret; \ }) --- 270,285 ---- #define LIST_ARRAY_PULL_START(list, array, nb) ({\ uint8_t ret=0, i; \ if(!array) {\ ! for(i=0 ; (i<nb) && (!ret) ; i++) { \ ret=LIST_PULL_START(list, (array)); \ }\ else { \ ! for(i=0 ; (i<nb) && (!ret) ; i++) { \ ret=LIST_PULL_START(list, (array+i)); \ ! } \ } \ if(DEBUG) \ ! printf("LIST_ARRAY_PULL_START(%s, %s, %d) -> ret %d"CR,#list, #array, nb, ret); \ ret; \ }) *************** *** 287,299 **** uint8_t ret=0; \ int8_t i; \ if(!array) \ ! for(i=nb-1 ; (i>=0) && (!ret) ; i--) { \ ret=LIST_PULL_END(list, (array)); \ }\ else { \ ! for(i=nb-1 ; (i>=0) && (!ret) ; i--) { \ ret=LIST_PULL_END(list, (array+i)); \ ! } \ } \ if(DEBUG) \ printf("LIST_ARRAY_PULL_END(%s, %s, %d) -> ret %d"CR,#list, #array, nb, ret); \ --- 287,299 ---- uint8_t ret=0; \ int8_t i; \ if(!array) \ ! for(i=nb-1 ; (i>=0) && (!ret) ; i--) { \ ret=LIST_PULL_END(list, (array)); \ }\ else { \ ! for(i=nb-1 ; (i>=0) && (!ret) ; i--) { \ ret=LIST_PULL_END(list, (array+i)); \ ! } \ } \ if(DEBUG) \ printf("LIST_ARRAY_PULL_END(%s, %s, %d) -> ret %d"CR,#list, #array, nb, ret); \ _______________________________________________ Avr-list mailing list Avr-list@droids-corp.org CVSWEB : http://cvsweb.droids-corp.org/cgi-bin/viewcvs.cgi/aversive WIKI : http://wiki.droids-corp.org/index.php/Aversive DOXYGEN : http://zer0.droids-corp.org/doxygen_aversive/html/ BUGZILLA : http://bugzilla.droids-corp.org COMMIT LOGS : http://zer0.droids-corp.org/aversive_commitlog