#include #include #include #include #include #include "projet.h" /* Un MAKEFILE_FILE repr‚sente la description d'un fichier dans makefile.dat */ PUBLIC MAKEFILE_FILE::MAKEFILE_FILE () { efface = 0; is_del = 0; mark = 0; is_dir = 0; archive = 1; path = NULL; nom[0] = '\0'; date = 0; nbhist = 0; memset (tbhist,0,sizeof(tbhist)); } PUBLIC MAKEFILE_FILE::~MAKEFILE_FILE () { free (path); } /* Indique si un fichier ne fait plus partie (logiquement) du makefile.dat */ PUBLIC int MAKEFILE_FILE::isdel() { return is_del; } /* Construit le path absolue du fichier dans ombre */ PUBLIC void MAKEFILE_FILE::getombpath( USERINFO *user, char *ombpath) { assert (path != NULL); user->makombpath(path,ombpath); } /* Obtient le path relatif du fichier dans /kit/ombre */ PUBLIC const char *MAKEFILE_FILE::getref() { return path; } /* Retourne le path relatif du fichier dans ombre */ PUBLIC const char *MAKEFILE_FILE::getrelpath () { assert (path != NULL); return path; } /* Retourne le nom du fichier */ PUBLIC const char *MAKEFILE_FILE::getnom () { return nom; } /* Retourne la r‚vision du fichier */ PUBLIC const REVISION *MAKEFILE_FILE::getrev () const { return &rev; } /* Enregistre une nouvelle r‚vision pour un fichier en retenant l'ancienne dans la pile. */ PUBLIC void MAKEFILE_FILE::pushrev (const REVISION *newrev) { memmove (tbhist[1],tbhist[0],sizeof(tbhist)-sizeof(tbhist[0])); rev.format (tbhist[0]); if (newrev != NULL) rev = *newrev; } /* A partir de r‚vision, calcul le path relatif dans ombre. */ PUBLIC void MAKEFILE_FILE::setombpath(const char *projet) { /* Le fichier peut contenir un path. On retrouve cette situation quand un projet contient des sous-r‚pertoires. Alors le makefile.dat contient des r‚f‚rences … la version des sous makefile.dat. */ char rel_ombpath[MAXSIZ_PATH]; // Path relatif du fichier par // rapport au r‚pertoire ombre char name[MAXSIZ_NAME]; path_splitlex (nom,rel_ombpath,name); path_make (projet,rel_ombpath,rel_ombpath); // D‚termine le sous-r‚pertoire associ‚ … la r‚vision du fichier char ombrev[MAXSIZ_NAME]; rev.formatpath (ombrev); strcat (ombrev,".s"); path_make (rel_ombpath,ombrev,rel_ombpath); free (path); path_make (rel_ombpath,name,rel_ombpath); path_2unix (rel_ombpath,rel_ombpath); path = strdup_err (rel_ombpath); archive = 1; } /* Enregistre la valeur du marqueur utilise par MAKEFILE::itermark(). */ PUBLIC void MAKEFILE_FILE::setmark(int val) { mark = (char)val; } /* Retourne le nombre d'entr‚e dans la table d'historique des livraisons */ PUBLIC int MAKEFILE_FILE::getnbhistory() { return nbhist; } /* Retourne une entr‚e de la table d'historique des livraisons Retourne NULL si no invalide. */ PUBLIC const char *MAKEFILE_FILE::gethistory(int no) { return no >= 0 && no < nbhist ? tbhist[no] : (char*)NULL; }