bglibs: iter.h Source File

- Main Page
- Modules
- Data Structures
- Files
- Directories
- Related Pages
- Examples

# iter.h

    00001 /* $Id: iter.h 616 2005-08-19 20:11:01Z bruce $ */
    00002 #ifndef STR_ITER__H__
    00003 #define STR_ITER__H__
    00004
    00005 struct str;
    00006
    00016 typedef struct
    00017 {
    00019   const struct str* str;
    00021   unsigned start;
    00023   const char* startptr;
    00025   unsigned len;
    00027   char sep;
    00028 } striter;
    00029
    00030 void striter_start(striter* iter, const struct str* s, char sep);
    00031 int striter_valid(striter*);
    00032 int striter_advance(striter*);
    00033
    00035 #define str_copyiter(STR,ITER) str_copyb(STR,(ITER)->startptr,(ITER)->len)
    00036
    00038 #define str_catiter(STR,ITER) str_catb(STR,(ITER)->startptr,(ITER)->len)
    00039
    00041 #define obuf_putiter(OBUF,ITER) obuf_write(OBUF,(ITER)->startptr,(ITER)->len)
    00042
    00044 #define striter_loop(ITER,STR,SEP) for(striter_start(ITER,STR,SEP);striter_valid(ITER);striter_advance(ITER))
    00045
    00048 #endif