fonction.h 1.67 KB
#ifndef FONCTION_H_INCLUDED
#define FONCTION_H_INCLUDED
#define TABLE_SIZE 100
#define LINE_MAX 1000
#include <stdio.h>
#include <stdlib.h>
#include <string.h>


    typedef struct Oeuvres Oeuvres;
    struct Oeuvres
    {
        char title[LINE_MAX];
        char annee[LINE_MAX];
        char commentaire[LINE_MAX];
        Oeuvres *suivant;

    };


    typedef Oeuvres *ptoeuvres;


    typedef struct Realisateur Realisateur;
    struct Realisateur
    {
        char nom[LINE_MAX];
        char prenom[LINE_MAX];
        ptoeuvres filmographie;
        Realisateur *suivant;
    };

    typedef Realisateur *ptrealisateur;
    typedef ptrealisateur tableReal[TABLE_SIZE];


    int hash(char *word);
    void initTable(tableReal table);
    int hashNum(char nom[LINE_MAX],char prenom[LINE_MAX]);


    int findEnd(char line[LINE_MAX]);

    void initOeuvre(ptoeuvres oe);

    int readPartOfLine(int a,int b,char line[LINE_MAX],char part[LINE_MAX]);
    void readElement(char element[LINE_MAX],ptoeuvres film);
    void readFile(FILE *file, tableReal database);

    ptrealisateur findReal(tableReal table,char nom[LINE_MAX],char prenom[LINE_MAX]);

    void afficherFilm(ptoeuvres oe);
    void afficherTable(tableReal table);
    void afficherReal(tableReal table,char nom[LINE_MAX],char prenom[LINE_MAX]);

    void addReal(tableReal table,char nom[LINE_MAX],char prenom[LINE_MAX]);
    void addFilm(tableReal table,char nom[LINE_MAX],char prenom[LINE_MAX] );

    int eraseFilm(ptrealisateur real,char title[LINE_MAX]);
    void eraseReal(tableReal table,char nom[LINE_MAX],char prenom[LINE_MAX]);





#endif // FONCTION_H_INCLUDED