excit.h 1.81 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
#ifndef EXCIT_H
#define EXCIT_H 1

enum excit_type_e {
	EXCIT_RANGE,
	EXCIT_CONS,
	EXCIT_REPEAT,
	EXCIT_HILBERT2D,
	EXCIT_PRODUCT,
	EXCIT_SLICE
};

typedef struct excit_s *excit_t;

typedef ssize_t excit_index_t;

excit_t excit_alloc(enum excit_type_e type);
void excit_free(excit_t iterator);
excit_t excit_dup(const excit_t iterator);

int excit_type(excit_t iterator, enum excit_type_e *type);
int excit_dimension(excit_t iterator, excit_index_t *dimension);

int excit_next(excit_t iterator, excit_index_t *indexes);
int excit_peek(const excit_t iterator, excit_index_t *indexes);
int excit_size(const excit_t iterator, excit_index_t *size);
int excit_rewind(excit_t iterator);
int excit_split(const excit_t iterator, excit_index_t n,
		    excit_t *results);
int excit_nth(const excit_t iterator, excit_index_t n,
		  excit_index_t *indexes);
int excit_n(const excit_t iterator, const excit_index_t *indexes,
		excit_index_t *n);
int excit_pos(const excit_t iterator, excit_index_t *n);

int excit_skip(excit_t iterator);
int excit_cyclic_next(excit_t iterator, excit_index_t *indexes,
			  int *looped);

int excit_range_init(excit_t iterator, excit_index_t first,
			 excit_index_t last, excit_index_t step);

int excit_cons_init(excit_t iterator, excit_t src,
			excit_index_t n);

int excit_repeat_init(excit_t iterator, excit_t src,
			  excit_index_t n);

int excit_hilbert2d_init(excit_t iterator, excit_index_t order);

int excit_product_add(excit_t iterator, excit_t added_iterator);
int excit_product_add_copy(excit_t iterator,
			       excit_t added_iterator);
int excit_product_count(const excit_t iterator,
			    excit_index_t *count);
int excit_product_split_dim(const excit_t iterator,
				excit_index_t dim, excit_index_t n,
				excit_t *results);

int excit_slice_init(excit_t iterator, excit_t src,
			 excit_t indexer);
#endif