Commit b8a35329 authored by Nicolas Denoyelle's avatar Nicolas Denoyelle

Merge branch 'master' into tleaf

parents a56b4120 2f228ce7
......@@ -2,6 +2,6 @@ AM_CFLAGS = -Wall -Werror -pedantic
lib_LTLIBRARIES = libexcit.la
libexcit_la_SOURCES = excit.c tleaf.c range.c slice.c repeat.c prod.c cons.c hilbert2d.c
libexcit_la_SOURCES = excit.c slice.c prod.c cons.c repeat.c hilbert2d.c range.c
include_HEADERS = excit.h
#include "dev/excit.h"
#include "cons.h"
#define EXCIT_DATA(data, it) \
if(data == NULL) { return EXCIT_EINVAL; } \
do{ \
int err = excit_get_data(data, (void**)(&it)); \
if(err != EXCIT_SUCCESS) { return err; } \
} while(0); \
if(it == NULL){ return EXCIT_EINVAL; }
static void circular_fifo_add(struct circular_fifo_s *fifo, ssize_t elem)
{
if (fifo->size == fifo->length) {
......@@ -33,25 +25,9 @@ static void circular_fifo_dump(const struct circular_fifo_s *fifo,
}
}
struct excit_func_table_s excit_cons_func_table = {
cons_it_alloc,
cons_it_free,
cons_it_copy,
cons_it_next,
cons_it_peek,
cons_it_size,
cons_it_rewind,
cons_it_split,
cons_it_nth,
cons_it_rank,
cons_it_pos
};
int cons_it_alloc(excit_t data)
static int cons_it_alloc(excit_t data)
{
struct cons_it_s *it;
EXCIT_DATA(data, it);
struct cons_it_s *it = (struct cons_it_s *)data->data;
it->it = NULL;
it->n = 0;
......@@ -63,24 +39,18 @@ int cons_it_alloc(excit_t data)
return EXCIT_SUCCESS;
}
void cons_it_free(excit_t data)
static void cons_it_free(excit_t data)
{
struct cons_it_s *it;
if(data == NULL) { return ; }
int err = excit_get_data(data, (void**)(&it));
if(err != EXCIT_SUCCESS) { return; }
if(it == NULL){ return; }
struct cons_it_s *it = (struct cons_it_s *)data->data;
excit_free(it->it);
free(it->fifo.buffer);
}
int cons_it_copy(excit_t ddst, const excit_t dsrc)
static int cons_it_copy(excit_t ddst, const excit_t dsrc)
{
struct cons_it_s *dst;
EXCIT_DATA(ddst, dst);
const struct cons_it_s *src;
EXCIT_DATA(dsrc, src);
struct cons_it_s *dst = (struct cons_it_s *)ddst->data;
const struct cons_it_s *src = (const struct cons_it_s *)dsrc->data;
excit_t copy = excit_dup(src->it);
if (!copy)
......@@ -102,10 +72,9 @@ int cons_it_copy(excit_t ddst, const excit_t dsrc)
return EXCIT_SUCCESS;
}
int cons_it_size(const excit_t data, ssize_t *size)
static int cons_it_size(const excit_t data, ssize_t *size)
{
const struct cons_it_s *it;
EXCIT_DATA(data, it);
const struct cons_it_s *it = (const struct cons_it_s *)data->data;
ssize_t tmp_size = 0;
int err = excit_size(it->it, &tmp_size);
......@@ -115,7 +84,7 @@ int cons_it_size(const excit_t data, ssize_t *size)
return EXCIT_SUCCESS;
}
int cons_it_split(const excit_t data, ssize_t n, excit_t *results)
static int cons_it_split(const excit_t data, ssize_t n, excit_t *results)
{
ssize_t size;
int err = cons_it_size(data, &size);
......@@ -166,7 +135,7 @@ error1:
return err;
}
int cons_it_nth(const excit_t data, ssize_t n, ssize_t *indexes)
static int cons_it_nth(const excit_t data, ssize_t n, ssize_t *indexes)
{
ssize_t size;
int err = cons_it_size(data, &size);
......@@ -175,9 +144,8 @@ int cons_it_nth(const excit_t data, ssize_t n, ssize_t *indexes)
return err;
if (n < 0 || n >= size)
return -EXCIT_EDOM;
const struct cons_it_s *it;
EXCIT_DATA(data, it);
int dim = excit_get_dimension(it->it);
const struct cons_it_s *it = (const struct cons_it_s *)data->data;
int dim = it->it->dimension;
if (indexes) {
for (int i = 0; i < it->n; i++) {
......@@ -189,16 +157,16 @@ int cons_it_nth(const excit_t data, ssize_t n, ssize_t *indexes)
return EXCIT_SUCCESS;
}
int cons_it_rank(const excit_t data, const ssize_t *indexes, ssize_t *n)
static int cons_it_rank(const excit_t data, const ssize_t *indexes,
ssize_t *n)
{
const struct cons_it_s *it;
EXCIT_DATA(data, it);
const struct cons_it_s *it = (const struct cons_it_s *)data->data;
ssize_t inner_n, inner_n_tmp;
int err = excit_rank(it->it, indexes, &inner_n);
if (err)
return err;
int dim = excit_get_dimension(it->it);
int dim = it->it->dimension;
for (int i = 1; i < it->n; i++) {
err = excit_rank(it->it, indexes + dim * i, &inner_n_tmp);
......@@ -213,11 +181,10 @@ int cons_it_rank(const excit_t data, const ssize_t *indexes, ssize_t *n)
return EXCIT_SUCCESS;
}
int cons_it_pos(const excit_t data, ssize_t *n)
static int cons_it_pos(const excit_t data, ssize_t *n)
{
ssize_t inner_n;
const struct cons_it_s *it;
EXCIT_DATA(data, it);
const struct cons_it_s *it = (const struct cons_it_s *)data->data;
int err = excit_pos(it->it, &inner_n);
if (err)
......@@ -227,12 +194,11 @@ int cons_it_pos(const excit_t data, ssize_t *n)
return EXCIT_SUCCESS;
}
int cons_it_peek(const excit_t data, ssize_t *indexes)
static int cons_it_peek(const excit_t data, ssize_t *indexes)
{
const struct cons_it_s *it;
EXCIT_DATA(data, it);
const struct cons_it_s *it = (const struct cons_it_s *)data->data;
int err;
int dim = excit_get_dimension(it->it);
int dim = it->it->dimension;
int n = it->n;
if (indexes) {
......@@ -245,12 +211,11 @@ int cons_it_peek(const excit_t data, ssize_t *indexes)
return EXCIT_SUCCESS;
}
int cons_it_next(excit_t data, ssize_t *indexes)
static int cons_it_next(excit_t data, ssize_t *indexes)
{
struct cons_it_s *it;
EXCIT_DATA(data, it);
struct cons_it_s *it = (struct cons_it_s *)data->data;
int err;
int dim = excit_get_dimension(it->it);
int dim = it->it->dimension;
int n = it->n;
if (indexes) {
......@@ -266,10 +231,9 @@ int cons_it_next(excit_t data, ssize_t *indexes)
return EXCIT_SUCCESS;
}
int cons_it_rewind(excit_t data)
static int cons_it_rewind(excit_t data)
{
struct cons_it_s *it;
EXCIT_DATA(data, it);
struct cons_it_s *it = (struct cons_it_s *)data->data;
int err = excit_rewind(it->it);
if (err)
......@@ -282,11 +246,11 @@ int cons_it_rewind(excit_t data)
int err;
err =
excit_next(it->it, it->fifo.buffer + excit_get_dimension(it->it) * i);
excit_next(it->it, it->fifo.buffer + it->it->dimension * i);
if (err)
return err;
it->fifo.size += excit_get_dimension(it->it);
it->fifo.end += excit_get_dimension(it->it);
it->fifo.size += it->it->dimension;
it->fifo.end += it->it->dimension;
}
return EXCIT_SUCCESS;
}
......@@ -296,22 +260,21 @@ int excit_cons_init(excit_t it, excit_t src, ssize_t n)
ssize_t src_size;
int err;
if (!it || !src || n <= 0)
if (!it || it->type != EXCIT_CONS || !src || n <= 0)
return -EXCIT_EINVAL;
err = excit_size(src, &src_size);
if (err)
return err;
if (src_size < n)
return -EXCIT_EINVAL;
struct cons_it_s *cons_it;
EXCIT_DATA(it, cons_it);
struct cons_it_s *cons_it = (struct cons_it_s *)it->data;
free(cons_it->fifo.buffer);
excit_free(cons_it->it);
excit_set_dimension(it, excit_get_dimension(src) * n);
it->dimension = n * src->dimension;
cons_it->it = src;
cons_it->n = n;
cons_it->fifo.length = excit_get_dimension(src) * (n - 1);
cons_it->fifo.length = src->dimension * (n - 1);
cons_it->fifo.buffer =
(ssize_t *) malloc(cons_it->fifo.length * sizeof(ssize_t));
if (!cons_it->fifo.buffer)
......@@ -324,3 +287,16 @@ int excit_cons_init(excit_t it, excit_t src, ssize_t n)
return EXCIT_SUCCESS;
}
struct excit_func_table_s excit_cons_func_table = {
cons_it_alloc,
cons_it_free,
cons_it_copy,
cons_it_next,
cons_it_peek,
cons_it_size,
cons_it_rewind,
cons_it_split,
cons_it_nth,
cons_it_rank,
cons_it_pos
};
#ifndef CONS_H
#define CONS_H
#ifndef EXCIT_CONS_H
#define EXCIT_CONS_H
#include "excit.h"
#include "dev/excit.h"
struct circular_fifo_s {
ssize_t length;
......@@ -17,18 +18,6 @@ struct cons_it_s {
struct circular_fifo_s fifo;
};
int cons_it_alloc(excit_t data);
void cons_it_free(excit_t data);
int cons_it_copy(excit_t ddst, const excit_t dsrc);
int cons_it_size(const excit_t data, ssize_t *size);
int cons_it_split(const excit_t data, ssize_t n, excit_t *results);
int cons_it_nth(const excit_t data, ssize_t n, ssize_t *indexes);
int cons_it_rank(const excit_t data, const ssize_t *indexes, ssize_t *n);
int cons_it_pos(const excit_t data, ssize_t *n);
int cons_it_peek(const excit_t data, ssize_t *indexes);
int cons_it_next(excit_t data, ssize_t *indexes);
int cons_it_rewind(excit_t data);
extern struct excit_func_table_s excit_cons_func_table;
#endif
#endif //EXCIT_CONS_H
#ifndef EXCIT_DEV_H
#define EXCIT_DEV_H
#include "../excit.h"
struct excit_s {
struct excit_func_table_s *func_table;
ssize_t dimension;
enum excit_type_e type;
void *data;
};
#endif
#include <stdlib.h>
#include "excit.h"
#include "dev/excit.h"
#include "slice.h"
#include "range.h"
#include "repeat.h"
#include "prod.h"
#include "cons.h"
#include "repeat.h"
#include "hilbert2d.h"
#include "tleaf.h"
#include "range.h"
#define CASE(val) case val: return #val; break;
#define CASE(val) case val: return #val; break
const char * excit_type_name(enum excit_type_e type)
const char *excit_type_name(enum excit_type_e type)
{
switch (type) {
CASE(EXCIT_RANGE)
CASE(EXCIT_CONS)
CASE(EXCIT_REPEAT)
CASE(EXCIT_HILBERT2D)
CASE(EXCIT_PRODUCT)
CASE(EXCIT_SLICE)
CASE(EXCIT_TLEAF)
CASE(EXCIT_USER)
CASE(EXCIT_TYPE_MAX)
CASE(EXCIT_RANGE);
CASE(EXCIT_CONS);
CASE(EXCIT_REPEAT);
CASE(EXCIT_HILBERT2D);
CASE(EXCIT_PRODUCT);
CASE(EXCIT_SLICE);
CASE(EXCIT_USER);
CASE(EXCIT_TYPE_MAX);
default:
return NULL;
}
}
const char * excit_error_name(enum excit_error_e err)
const char *excit_error_name(enum excit_error_e err)
{
switch (err) {
CASE(EXCIT_SUCCESS)
CASE(EXCIT_STOPIT)
CASE(EXCIT_ENOMEM)
CASE(EXCIT_EINVAL)
CASE(EXCIT_EDOM)
CASE(EXCIT_ENOTSUP)
CASE(EXCIT_ERROR_MAX)
CASE(EXCIT_SUCCESS);
CASE(EXCIT_STOPIT);
CASE(EXCIT_ENOMEM);
CASE(EXCIT_EINVAL);
CASE(EXCIT_EDOM);
CASE(EXCIT_ENOTSUP);
CASE(EXCIT_ERROR_MAX);
default:
return NULL;
}
......@@ -44,13 +43,6 @@ const char * excit_error_name(enum excit_error_e err)
#undef CASE
struct excit_s {
struct excit_func_table_s *func_table;
ssize_t dimension;
enum excit_type_e type;
void *data;
};
int excit_set_dimension(excit_t it, ssize_t dimension)
{
if (!it)
......@@ -61,22 +53,12 @@ int excit_set_dimension(excit_t it, ssize_t dimension)
return EXCIT_SUCCESS;
}
ssize_t excit_get_dimension(excit_t it)
{
if(it)
{
return it->dimension;
} else {
return -1;
}
}
int excit_get_data(excit_t it, void **data)
{
if (!it)
return -EXCIT_EINVAL;
/* if (it->type != EXCIT_USER) */
/* return -EXCIT_ENOTSUP; */ // WHY !!!
if (it->type != EXCIT_USER)
return -EXCIT_ENOTSUP;
*data = it->data;
return EXCIT_SUCCESS;
}
......@@ -97,6 +79,8 @@ int excit_get_func_table(excit_t it, struct excit_func_table_s **func_table)
return EXCIT_SUCCESS;
}
/*--------------------------------------------------------------------*/
#define ALLOC_EXCIT(op) { \
it = malloc(sizeof(struct excit_s) + sizeof(struct op## _it_s)); \
if (!it) \
......@@ -108,7 +92,7 @@ int excit_get_func_table(excit_t it, struct excit_func_table_s **func_table)
it->dimension = 0; \
if (excit_ ##op## _func_table.alloc(it)) \
goto error; \
}
}
excit_t excit_alloc(enum excit_type_e type)
{
......@@ -174,8 +158,7 @@ excit_t excit_dup(excit_t it)
{
excit_t result = NULL;
if (!it || !it->data || !it->func_table
|| !it->func_table->copy)
if (!it || !it->data || !it->func_table || !it->func_table->copy)
return NULL;
result = excit_alloc(it->type);
if (!result)
......
......@@ -15,7 +15,6 @@ enum excit_type_e {
EXCIT_HILBERT2D, /*!< Hilbert space filing curve */
EXCIT_PRODUCT, /*!< Iterator over the catesian product of iterators */
EXCIT_SLICE, /*!< Iterator using another iterator to index a third */
EXCIT_TLEAF, /*!< Iterator on leaves of a balanced tree */
EXCIT_USER, /*!< User-defined iterator */
EXCIT_TYPE_MAX /*!< Guard */
};
......@@ -23,7 +22,7 @@ enum excit_type_e {
/*
* Returns the string representation of an iterator type.
*/
const char * excit_type_name(enum excit_type_e type);
const char *excit_type_name(enum excit_type_e type);
/*
* The different possible return codes of an excit function.
......@@ -41,7 +40,7 @@ enum excit_error_e {
/*
* Returns the string representation of a return code.
*/
const char * excit_error_name(enum excit_error_e err);
const char *excit_error_name(enum excit_error_e err);
/*
* Opaque structure of an iterator
......@@ -87,66 +86,66 @@ struct excit_func_table_s {
* allocation, the inner data pointer will already be set.
* Returns EXCIT_SUCCESS or an error code.
*/
int (*alloc)(excit_t it);
int (*alloc) (excit_t it);
/*
* This function is called during excit_free. After this function is
* called the iterator and the data will be freed.
*/
void (*free)(excit_t it);
void (*free) (excit_t it);
/*
* This funciton is called during excit_dup. It is responsible for
* duplicating the content of the inner data between src_it and dst_it.
* Returns EXCIT_SUCCESS or an error code.
*/
int (*copy)(excit_t dst_it, const excit_t src_it);
int (*copy) (excit_t dst_it, const excit_t src_it);
/*
* This function is responsible for implementing the next functionality
* of the iterator.
* Returns EXCIT_SUCCESS, EXCIT_STOPIT or an error code.
*/
int (*next)(excit_t it, ssize_t *indexes);
int (*next) (excit_t it, ssize_t * indexes);
/*
* This function is responsible for implementing the peek functionality
* of the iterator.
* Returns EXCIT_SUCCESS, EXCIT_STOPIT or an error code.
*/
int (*peek)(const excit_t it, ssize_t *indexes);
int (*peek) (const excit_t it, ssize_t * indexes);
/*
* This function is responsible for implementing the size functionality
* of the iterator.
* Returns EXCIT_SUCCESS or an error code.
*/
int (*size)(const excit_t it, ssize_t *size);
int (*size) (const excit_t it, ssize_t * size);
/*
* This function is responsible for implementing the rewind
* functionality of the iterator.
* Returns EXCIT_SUCCESS or an error code.
*/
int (*rewind)(excit_t it);
int (*rewind) (excit_t it);
/*
* This function is responsible for implementing the split
* functionality of the iterator.
* Returns EXCIT_SUCCESS or an error code.
*/
int (*split)(const excit_t it, ssize_t n, excit_t *results);
int (*split) (const excit_t it, ssize_t n, excit_t * results);
/*
* This function is responsible for implementing the nth functionality
* of the iterator.
* Returns EXCIT_SUCCESS or an error code.
*/
int (*nth)(const excit_t it, ssize_t n, ssize_t *indexes);
int (*nth) (const excit_t it, ssize_t n, ssize_t * indexes);
/*
* This function is responsible for implementing the rank functionality
* of the iterator.
* Returns EXCIT_SUCCESS or an error code.
*/
int (*rank)(const excit_t it, const ssize_t *indexes, ssize_t *n);
int (*rank) (const excit_t it, const ssize_t * indexes, ssize_t * n);
/*
* This function is responsible for implementing the pos functionality
* of the iterator.
* Returns EXCIT_SUCCESS, EXCIT_STOPIT or an error code.
*/
int (*pos)(const excit_t it, ssize_t *n);
int (*pos) (const excit_t it, ssize_t * n);
};
/*
......@@ -213,7 +212,7 @@ int excit_type(excit_t it, enum excit_type_e *type);
* "dimension": a pointer where the result will be written.
* Returns EXCIT_SUCCESS or an error code.
*/
int excit_dimension(excit_t it, ssize_t *dimension);
int excit_dimension(excit_t it, ssize_t * dimension);
/*
* Gets the current element of an iterator and increments it.
......@@ -223,7 +222,7 @@ int excit_dimension(excit_t it, ssize_t *dimension);
* Returns EXCIT_SUCCESS if a valid element was retured or EXCIT_STOPIT if the
* iterator is depleted or an error code.
*/
int excit_next(excit_t it, ssize_t *indexes);
int excit_next(excit_t it, ssize_t * indexes);
/*
* Gets the current element of an iterator.
......@@ -233,7 +232,7 @@ int excit_next(excit_t it, ssize_t *indexes);
* Returns EXCIT_SUCCESS if a valid element was retured or EXCIT_STOPIT if the
* iterator is depleted or an error code.
*/
int excit_peek(const excit_t it, ssize_t *indexes);
int excit_peek(const excit_t it, ssize_t * indexes);
/*
* Rewinds an iterator to its initial state.
......@@ -248,7 +247,7 @@ int excit_rewind(excit_t it);
* "size": an pointer to the variable where the result will be stored.
* Returns EXCIT_SUCCESS or an error code.
*/
int excit_size(const excit_t it, ssize_t *size);
int excit_size(const excit_t it, ssize_t * size);
/*
* Splits an iterator envenly into several suub iterators.
......@@ -259,17 +258,18 @@ int excit_size(const excit_t it, ssize_t *size);
* Returns EXCIT_SUCCESS, -EXCIT_EDOM if the source iterator is too small to be
* subdivised in the wanted number or an error code.
*/
int excit_split(const excit_t it, ssize_t n, excit_t *results);
int excit_split(const excit_t it, ssize_t n, excit_t * results);
/*
* Gets the nth element of an iterator.
* "it": an iterator.
* "rank": rank of the element, comprised between 0 and the size of the iterator.
* "rank": rank of the element, comprised between 0 and the size of the
* iterator.
* "indexes": an array of indexes with a dimension corresponding to that of the
* iterator, no results is returned if NULL.
* Returns EXCIT_SUCCESS or an error code.
*/
int excit_nth(const excit_t it, ssize_t rank, ssize_t *indexes);
int excit_nth(const excit_t it, ssize_t rank, ssize_t * indexes);
/*
* Gets the rank of an element of an iterator.
......@@ -279,7 +279,7 @@ int excit_nth(const excit_t it, ssize_t rank, ssize_t *indexes);
* returned if NULL.
* Returns EXCIT_SUCCESS or an error code.
*/
int excit_rank(const excit_t it, const ssize_t *indexes, ssize_t *rank);
int excit_rank(const excit_t it, const ssize_t * indexes, ssize_t * rank);
/*
* Gets the position of the iterator.
......@@ -289,7 +289,7 @@ int excit_rank(const excit_t it, const ssize_t *indexes, ssize_t *rank);
* Returns EXCIT_SUCCESS or EXCIT_STOPIT if the iterator is depleted or an error
* code.
*/
int excit_pos(const excit_t it, ssize_t *rank);
int excit_pos(const excit_t it, ssize_t * rank);
/*
* Increments the iterator.
......@@ -307,7 +307,7 @@ int excit_skip(excit_t it);
* iterator, no results is returned if NULL.
* Returns EXCIT_SUCCESS or an error code.
*/
int excit_cyclic_next(excit_t it, ssize_t *indexes, int *looped);
int excit_cyclic_next(excit_t it, ssize_t * indexes, int *looped);
/*
* Initializes a range iterator to iterate from first to last (included) by sep.
......@@ -369,7 +369,7 @@ int excit_product_add_copy(excit_t it, excit_t added_it);
* "count": a pointer to a variable where the result will be stored.
* Returns EXCIT_SUCCESS or an error code.
*/
int excit_product_count(const excit_t it, ssize_t *count);
int excit_product_count(const excit_t it, ssize_t * count);
/*
* Splits a product iterator along the nth iterator.
......@@ -383,7 +383,7 @@ int excit_product_count(const excit_t it, ssize_t *count);
* be subdivised in the wanted number or an error code.
*/
int excit_product_split_dim(const excit_t it, ssize_t dim, ssize_t n,
excit_t *results);
excit_t * results);
/*
* Initializes a slice iterator by giving asrc iterator and an indexer iterator.
......
#include "dev/excit.h"
#include "hilbert2d.h"
struct excit_func_table_s excit_hilbert2d_func_table = {
hilbert2d_it_alloc,
hilbert2d_it_free,
hilbert2d_it_copy,
hilbert2d_it_next,
hilbert2d_it_peek,
hilbert2d_it_size,
hilbert2d_it_rewind,
hilbert2d_it_split,
hilbert2d_it_nth,
hilbert2d_it_rank,
hilbert2d_it_pos
};
#define EXCIT_DATA(data, it) \
if(data == NULL) { return EXCIT_EINVAL; } \
do{ \
int err = excit_get_data(data, (void**)(&it)); \
if(err != EXCIT_SUCCESS) { return err; } \
} while(0); \
if(it == NULL){ return EXCIT_EINVAL; }
/* Helper functions from: https://en.wikipedia.org/wiki/Hilbert_curve */
//rotate/flip a quadrant appropriately
static void rot(ssize_t n, ssize_t *x, ssize_t *y, ssize_t rx, ssize_t ry)
{
if (ry == 0) {
......@@ -73,33 +48,27 @@ static void d2xy(ssize_t n, ssize_t d, ssize_t *x, ssize_t *y)
/* End helper functions */
int hilbert2d_it_alloc(excit_t data)
static int hilbert2d_it_alloc(excit_t data)
{
struct hilbert2d_it_s *it;
EXCIT_DATA(data, it);
struct hilbert2d_it_s *it = (struct hilbert2d_it_s *)data->data;
it->n = 0;
it->range_it = NULL;
return EXCIT_SUCCESS;
}
void hilbert2d_it_free(excit_t data)
static void hilbert2d_it_free(excit_t data)
{
struct hilbert2d_it_s *it;
if(data == NULL) { return ; }
int err = excit_get_data(data, (void**)(&it));
if(err != EXCIT_SUCCESS) { return; }
if(it == NULL){ return; }
struct hilbert2d_it_s *it = (struct hilbert2d_it_s *)data->data;
excit_free(it->range_it);
}
int hilbert2d_it_copy(excit_t ddst, const excit_t dsrc)
static int hilbert2d_it_copy(excit_t ddst, const excit_t dsrc)
{
struct hilbert2d_it_s *dst;
EXCIT_DATA(ddst, dst);
const struct hilbert2d_it_s *src;
EXCIT_DATA(dsrc, src);
struct hilbert2d_it_s *dst = (struct hilbert2d_it_s *)ddst->data;
const struct hilbert2d_it_s *src =
(const struct hilbert2d_it_s *)dsrc->data;
excit_t copy = excit_dup(src->range_it);
if (!copy)
......@@ -109,18 +78,16 @@ int hilbert2d_it_copy(excit_t ddst, const excit_t dsrc)
return EXCIT_SUCCESS;
}
int hilbert2d_it_rewind(excit_t data)
static int hilbert2d_it_rewind(excit_t data)
{
struct hilbert2d_it_s *it;
EXCIT_DATA(data, it);
struct hilbert2d_it_s *it = (struct hilbert2d_it_s *)data->data;
return excit_rewind(it->range_it);
}
int hilbert2d_it_peek(const excit_t data, ssize_t *val)
static int hilbert2d_it_peek(const excit_t data, ssize_t *val)
{
struct hilbert2d_it_s *it;
EXCIT_DATA(data, it);
struct hilbert2d_it_s *it = (struct hilbert2d_it_s *)data->data;
ssize_t d;
int err;
......@@ -132,10 +99,9 @@ int hilbert2d_it_peek(const excit_t data, ssize_t *val)
return EXCIT_SUCCESS;
}
int hilbert2d_it_next(excit_t data, ssize_t *val)
static int hilbert2d_it_next(excit_t data, ssize_t *val)
{
struct hilbert2d_it_s *it;
EXCIT_DATA(data, it);
struct hilbert2d_it_s *it = (struct hilbert2d_it_s *)data->data;
ssize_t d;
int err = excit_next(it->range_it, &d);
......@@ -146,18 +112,16 @@ int hilbert2d_it_next(excit_t data, ssize_t *val)
return EXCIT_SUCCESS;
}
int hilbert2d_it_size(const excit_t data, ssize_t *size)
static int hilbert2d_it_size(const excit_t data, ssize_t *size)