/************************************************************ * vecteurbase.c * Description : Implementation des operations du type Vecteur * Auteur : Departement Informatique * Date de création : 2002-10-14 * Dernière modification : 2002-10-30 *************************************************************/ #include "vecteurbase.h" RefVecteur creerVecteur(int bi, int bs) { int i; RefVecteur rv; rv = (RefVecteur) malloc(sizeof(Vecteur)); rv->init = (int *) malloc(sizeof(int) * (bs - bi + 1)); rv->element = (Element *) malloc(sizeof(Element) * (bs - bi + 1)); (*rv).bi = bi; (*rv).bs = bs; for(i = 0; i < (bs-bi+1); i++) (*rv).init[i] = FAUX; return rv; } RefVecteur affVal(RefVecteur rv, int indice, Element e) { (*rv).element[indice-(*rv).bi] = e; (*rv).init[indice-(*rv).bi] = VRAI; return rv; } Element recVal(RefVecteur rv, int indice) { return (*rv).element[indice-(*rv).bi]; } int bInf(RefVecteur rv) { return (*rv).bi; } int bSup(RefVecteur rv) { return (*rv).bs; } BOOLEEN estInit(RefVecteur rv,int indice) { return (*rv).init[indice-(*rv).bi]; }