iterable.h

Tue, 17 Oct 2006 00:32:05 +0200

author
Tuomo Valkonen <tuomov@iki.fi>
date
Tue, 17 Oct 2006 00:32:05 +0200
changeset 103
76174c5f04b5
parent 94
f48ffd2f2224
permissions
-rw-r--r--

Path fix

/*
 * libtu/iterable.h
 *
 * Copyright (c) Tuomo Valkonen 2005.
 *
 * You may distribute and modify this library under the terms of either
 * the Clarified Artistic License or the GNU LGPL, version 2.1 or later.
 */

#ifndef LIBTU_ITERABLE_H
#define LIBTU_ITERABLE_H

#include "types.h"
#include "obj.h"

typedef void *VoidIterator(void *);
typedef Obj *ObjIterator(void *);

typedef bool BoolFilter(void *p, void *param);

#define FOR_ALL_ITER(INIT, ITER, VAR, LL, TMP) \
    for(INIT(TMP, LL), (VAR)=ITER(TMP); (VAR)!=NULL; VAR=ITER(TMP))

extern void *iterable_nth(uint n, VoidIterator *iter, void *st);
extern bool iterable_is_on(void *p, VoidIterator *iter, void *st);
extern void *iterable_find(BoolFilter *f, void *fparam, 
                           VoidIterator *iter, void *st);
    
#endif /* LIBTU_ITERABLE_H */

mercurial