/* intrat.c v0.1 (C) 1999 adolfo@di-mare.com */ #include "intrat.h" /*--------*\ || int_lk || \*--------*/ define_binder(int_lk, ik, int_init, int_copy, int_equal, int_print, int_done ); void int_init(int_lk * it) { it->n = 0; cl_link_init(&it->ik); } void int_copy(int_lk * it, int_lk * src) { it->n = src->n; } int int_equal(int_lk * it, int_lk * src){ return (it->n == src->n); } void int_print(int_lk * it, FILE *F) { fprintf(F,"%d", it->n); } void int_done(int_lk * it) { cl_link_done(&it->ik); } /*--------*\ || rat_lk || \*--------*/ define_binder(rat_lk, rk, rat_init, rat_copy, rat_equal, rat_print, rat_done ); void rat_init(rat_lk * it) { it->num = 0; it->den = 1; cl_link_init(&it->rk); } void rat_copy(rat_lk * it, rat_lk * src) { it->num = src->num; it->den = src->den; } int rat_equal(rat_lk * it, rat_lk * src){ return (it->num * src->den) == (src->num * it->den); } void rat_print(rat_lk * it, FILE *F) { fprintf(F,"(%d,%d)", it->num, it->den); } void rat_done(rat_lk * it) { cl_link_done(&it->rk); } /* EOF: intrat.c */