First Commit
This commit is contained in:
parent
3f207ccdd3
commit
74f6b061ba
22 changed files with 435 additions and 0 deletions
30
Yûki/README.md
Normal file
30
Yûki/README.md
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# Projet-C-Huffman
|
||||
**Projet C Huffman commencé le 2 Décembre 2019 (Compression et décompression d'un fichier)**.
|
||||
|
||||
*Collaborateurs : Yûki VACHOT, Guillaume XIUME, Wilfried VALLEE, Florian COQUILLAT*.
|
||||
|
||||
## COMMENT COMMIT AVEC VISUAL STUDIO CODE :
|
||||
*(Commit : soumettre, valider des fichiers)*
|
||||
|
||||
1. Si ce n'est pas déjà fait télécharger **[Visual Studio Code](https://code.visualstudio.com/Download)** *(Windows, Linux ou Mac)*.
|
||||
2. Créer un compte sur **[GitHub](https://github.com/)**.
|
||||
3. Donner à **Yûki** votre nom de compte GitHub ou votre adresse e-mail associée (Je vous rajouterais au répertoire).
|
||||
4. Véfifier si vous avez déjà **Git** avec un terminal en mettant `git --version`.
|
||||
- Vérifier que vous avez une version supérieure à 2.0.
|
||||
- Sinon télécharger **[Git](https://git-scm.com/downloads)**.
|
||||
5. Aller sur VSCode puis ouvrez le dossier de votre projet *(CTRL + K ou O par défaut)*.
|
||||
6. Aller dans l'onglet "Contrôle de Code Source"  *(CTRL + MAJ + G par défaut)* .
|
||||
- Note : vérifier que **Git est activé** dans les paramètres de Git sur VSCode.
|
||||
- `Fichier -> Préférences -> Paramètres -> Utilisateur -> Extensions -> Git -> Enabled -> Yes or No`
|
||||
7. Ouvrir votre dossier dans l'onglet "Contrôle de Code Source" si ce n'est pas déjà fait avec le petit bouton à sa droite.
|
||||
8. Dans la partie haut gauche mettez un message clair pour définir le commit puis pressez sur Entrer.
|
||||
- Le changement ne s'est pas encore effectué sur le dossier dans **GitHub**, il ne l'est que localement pour l'instant. Donc, il faut associer votre dossier au répertoire sur **GitHub** (Vous ne pourrez pas encore "push" vos changements).
|
||||
|
||||
9. Ajouter le répertoire distant
|
||||
- Ouvrir la palette de commande *(CTRL + MAJ + P par défaut)*
|
||||
- Rechercher `Git Add Remote` et pressez entrer
|
||||
- Mettez un nom pour vous afin de reconnaître le dépôt
|
||||
- Puis mettez ce lien : **https://github.com/NyxiumYuuki/Projet-C-Huffman.git**
|
||||
- Publier enfin vos changements en appuyant sur le bouton en bas à droite  *(Il faudra vous connecter à votre compte GitHub)*
|
||||
- ***Félicitations vous avez enfin fait votre premier commit !***
|
||||
10. Vous pouvez maintenant voir les changements entre les différents fichiers, voir l'avancement des autres collaborateurs et vous pouvez aussi commit vos changements en répétant les **étapes 7 et 8**
|
||||
19
Yûki/Yûki/arbre_de_codage/Makefile
Normal file
19
Yûki/Yûki/arbre_de_codage/Makefile
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
CC = gcc
|
||||
CCOPTS = -Wall
|
||||
|
||||
all: main
|
||||
|
||||
arbre_naire.o: arbre_naire.c arbre_naire.h
|
||||
${CC} ${CCOPTS} -c arbre_naire.c
|
||||
|
||||
arbre_binaire.o: arbre_binaire.c arbre_binaire.h
|
||||
${CC} ${CCOPTS} -c arbre_binaire.c
|
||||
|
||||
main.o: main.c
|
||||
${CC} ${CCOPTS} -c main.c
|
||||
|
||||
main: main.o arbre_naire.o arbre_binaire.o
|
||||
${CC} ${CCOPTS} -o main main.o arbre_naire.o arbre_binaire.o
|
||||
|
||||
clean:
|
||||
rm *.o ; rm main
|
||||
69
Yûki/Yûki/arbre_de_codage/arbre_binaire.c
Normal file
69
Yûki/Yûki/arbre_de_codage/arbre_binaire.c
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include "arbre_binaire.h"
|
||||
|
||||
arbre creer_arbre_vide (void)
|
||||
{
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
arbre creer_arbre_huffman(Elt e, int p, arbre fg, arbre fd)
|
||||
{
|
||||
noeud * tmp = malloc(sizeof(noeud));
|
||||
tmp->elt=e;
|
||||
tmp->poids=p;
|
||||
tmp->fils_gauche=fg;
|
||||
tmp->fils_droit=fd;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
arbre fils_gauche(arbre a)
|
||||
{
|
||||
assert(!est_arbre_vide(a));
|
||||
return a->fils_gauche;
|
||||
}
|
||||
|
||||
arbre fils_droit(arbre b)
|
||||
{
|
||||
assert(!est_arbre_vide(b));
|
||||
return b->fils_droit;
|
||||
}
|
||||
|
||||
Elt racine(arbre a)
|
||||
{
|
||||
assert(!est_arbre_vide(a));
|
||||
return a->elt;
|
||||
}
|
||||
|
||||
bool est_arbre_vide(arbre a)
|
||||
{
|
||||
return (a == NULL) ;
|
||||
}
|
||||
|
||||
arbre creer_feuille(Elt e)
|
||||
{
|
||||
return creer_arbre(e, creer_arbre_vide(), creer_arbre_vide()) ;
|
||||
}
|
||||
|
||||
bool est_feuille(arbre a)
|
||||
{
|
||||
if (est_arbre_vide(a))
|
||||
return 0 ;
|
||||
return (est_arbre_vide(a->fils_gauche) && est_arbre_vide(a->fils_droit)) ;
|
||||
}
|
||||
|
||||
void free_noeud(arbre a)
|
||||
{
|
||||
assert(!est_arbre_vide(a));
|
||||
free(a);
|
||||
}
|
||||
|
||||
void free_arbre(arbre a)
|
||||
{
|
||||
if(!est_arbre_vide(a)){
|
||||
free_arbre(fils_gauche(a));
|
||||
free_arbre(fils_droit(a));
|
||||
free(a);
|
||||
}
|
||||
}
|
||||
25
Yûki/Yûki/arbre_de_codage/arbre_binaire.h
Normal file
25
Yûki/Yûki/arbre_de_codage/arbre_binaire.h
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef __ARBRE_BINAIRE__
|
||||
#define __ARBRE_BINAIRE__
|
||||
|
||||
typedef char Elt;
|
||||
typedef int bool;
|
||||
struct znoeud {
|
||||
Elt elt ;
|
||||
int poids;
|
||||
struct znoeud *fils_gauche;
|
||||
struct znoeud *fils_droit;
|
||||
};
|
||||
typedef struct znoeud noeud ;
|
||||
typedef struct znoeud * arbre;
|
||||
|
||||
arbre creer_arbre_vide(void);
|
||||
arbre creer_arbre_huffman(Elt e, int p, arbre fg, arbre fd);
|
||||
arbre fils_gauche(arbre a);
|
||||
arbre fils_droit(arbre a);
|
||||
Elt racine(arbre a);
|
||||
bool est_arbre_vide(arbre a);
|
||||
|
||||
arbre creer_feuille(Elt e) ;
|
||||
bool est_feuille(arbre a) ;
|
||||
|
||||
#endif
|
||||
15
Yûki/Yûki/arbre_de_codage/frequence_dapparition_char.c
Normal file
15
Yûki/Yûki/arbre_de_codage/frequence_dapparition_char.c
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
struct zoccurence{
|
||||
int nb;
|
||||
char lettre;
|
||||
};
|
||||
typedef struct zoccurence occ;
|
||||
typedef struct zoccurence * freq;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
24
Yûki/Yûki/arbre_de_codage/main.c
Normal file
24
Yûki/Yûki/arbre_de_codage/main.c
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#include <stdio.h>
|
||||
#include "arbre_binaire.h"
|
||||
|
||||
struct zoccurence{
|
||||
int nb;
|
||||
char lettre;
|
||||
};
|
||||
typedef struct zoccurence occ;
|
||||
typedef struct zoccurence * freq;
|
||||
|
||||
int main ()
|
||||
{
|
||||
|
||||
}
|
||||
/*
|
||||
L est considéré comme ordonné
|
||||
*/
|
||||
arbre huffman(arbre H, freq L[])
|
||||
{
|
||||
int i;
|
||||
|
||||
printf(L[]->nb);
|
||||
printf(L[]->lettre);
|
||||
}
|
||||
40
Yûki/Yûki/gestion_des_fichiers/bit_a_bit.c
Normal file
40
Yûki/Yûki/gestion_des_fichiers/bit_a_bit.c
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#define BIN_MAX 8
|
||||
|
||||
void binaire(unsigned int n, char s[]);
|
||||
|
||||
int main(int argc, char **argv){
|
||||
FILE *file;
|
||||
char buffer;
|
||||
int cursor,c;
|
||||
file=fopen("text.txt","rb");
|
||||
// EOF : End Of File
|
||||
while((c=fgetc(file))!=EOF){
|
||||
char sb[BIN_MAX+1];
|
||||
binaire(32,sb);
|
||||
printf("%s\n",sb);
|
||||
}
|
||||
fclose(file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void binaire(unsigned int n, char s[]){
|
||||
/*
|
||||
Décomposition binaire d'un entier (<BIN_MAX) et place celle-ci dans une chaîne de caractères passée en argument (s)
|
||||
|
||||
*/
|
||||
assert(n>=BIN_MAX);
|
||||
s[BIN_MAX]= '\0';
|
||||
int i,r;
|
||||
i=0;
|
||||
while(n!=0){
|
||||
r = n%2;
|
||||
n = n/2;
|
||||
if(0<=(BIN_MAX-i-1) && (BIN_MAX-i-1)<=BIN_MAX){
|
||||
if(r==0) s[BIN_MAX-i-1]= '0';
|
||||
else s[BIN_MAX-i-1]= '1';
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
Yûki/Yûki/gestion_des_fichiers/bit_a_bit.exe
Normal file
BIN
Yûki/Yûki/gestion_des_fichiers/bit_a_bit.exe
Normal file
Binary file not shown.
BIN
Yûki/Yûki/gestion_des_fichiers/bit_a_bit.o
Normal file
BIN
Yûki/Yûki/gestion_des_fichiers/bit_a_bit.o
Normal file
Binary file not shown.
1
Yûki/Yûki/gestion_des_fichiers/text.txt
Normal file
1
Yûki/Yûki/gestion_des_fichiers/text.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
ABCDE
|
||||
19
Yûki/arbre_de_codage/Makefile
Normal file
19
Yûki/arbre_de_codage/Makefile
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
CC = gcc
|
||||
CCOPTS = -Wall
|
||||
|
||||
all: main
|
||||
|
||||
arbre_naire.o: arbre_naire.c arbre_naire.h
|
||||
${CC} ${CCOPTS} -c arbre_naire.c
|
||||
|
||||
arbre_binaire.o: arbre_binaire.c arbre_binaire.h
|
||||
${CC} ${CCOPTS} -c arbre_binaire.c
|
||||
|
||||
main.o: main.c
|
||||
${CC} ${CCOPTS} -c main.c
|
||||
|
||||
main: main.o arbre_naire.o arbre_binaire.o
|
||||
${CC} ${CCOPTS} -o main main.o arbre_naire.o arbre_binaire.o
|
||||
|
||||
clean:
|
||||
rm *.o ; rm main
|
||||
69
Yûki/arbre_de_codage/arbre_binaire.c
Normal file
69
Yûki/arbre_de_codage/arbre_binaire.c
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include "arbre_binaire.h"
|
||||
|
||||
arbre creer_arbre_vide (void)
|
||||
{
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
arbre creer_arbre_huffman(Elt e, int p, arbre fg, arbre fd)
|
||||
{
|
||||
noeud * tmp = malloc(sizeof(noeud));
|
||||
tmp->elt=e;
|
||||
tmp->poids=p;
|
||||
tmp->fils_gauche=fg;
|
||||
tmp->fils_droit=fd;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
arbre fils_gauche(arbre a)
|
||||
{
|
||||
assert(!est_arbre_vide(a));
|
||||
return a->fils_gauche;
|
||||
}
|
||||
|
||||
arbre fils_droit(arbre b)
|
||||
{
|
||||
assert(!est_arbre_vide(b));
|
||||
return b->fils_droit;
|
||||
}
|
||||
|
||||
Elt racine(arbre a)
|
||||
{
|
||||
assert(!est_arbre_vide(a));
|
||||
return a->elt;
|
||||
}
|
||||
|
||||
bool est_arbre_vide(arbre a)
|
||||
{
|
||||
return (a == NULL) ;
|
||||
}
|
||||
|
||||
arbre creer_feuille(Elt e)
|
||||
{
|
||||
return creer_arbre(e, creer_arbre_vide(), creer_arbre_vide()) ;
|
||||
}
|
||||
|
||||
bool est_feuille(arbre a)
|
||||
{
|
||||
if (est_arbre_vide(a))
|
||||
return 0 ;
|
||||
return (est_arbre_vide(a->fils_gauche) && est_arbre_vide(a->fils_droit)) ;
|
||||
}
|
||||
|
||||
void free_noeud(arbre a)
|
||||
{
|
||||
assert(!est_arbre_vide(a));
|
||||
free(a);
|
||||
}
|
||||
|
||||
void free_arbre(arbre a)
|
||||
{
|
||||
if(!est_arbre_vide(a)){
|
||||
free_arbre(fils_gauche(a));
|
||||
free_arbre(fils_droit(a));
|
||||
free(a);
|
||||
}
|
||||
}
|
||||
25
Yûki/arbre_de_codage/arbre_binaire.h
Normal file
25
Yûki/arbre_de_codage/arbre_binaire.h
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef __ARBRE_BINAIRE__
|
||||
#define __ARBRE_BINAIRE__
|
||||
|
||||
typedef char Elt;
|
||||
typedef int bool;
|
||||
struct znoeud {
|
||||
Elt elt ;
|
||||
int poids;
|
||||
struct znoeud *fils_gauche;
|
||||
struct znoeud *fils_droit;
|
||||
};
|
||||
typedef struct znoeud noeud ;
|
||||
typedef struct znoeud * arbre;
|
||||
|
||||
arbre creer_arbre_vide(void);
|
||||
arbre creer_arbre_huffman(Elt e, int p, arbre fg, arbre fd);
|
||||
arbre fils_gauche(arbre a);
|
||||
arbre fils_droit(arbre a);
|
||||
Elt racine(arbre a);
|
||||
bool est_arbre_vide(arbre a);
|
||||
|
||||
arbre creer_feuille(Elt e) ;
|
||||
bool est_feuille(arbre a) ;
|
||||
|
||||
#endif
|
||||
15
Yûki/arbre_de_codage/frequence_dapparition_char.c
Normal file
15
Yûki/arbre_de_codage/frequence_dapparition_char.c
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
struct zoccurence{
|
||||
int nb;
|
||||
char lettre;
|
||||
};
|
||||
typedef struct zoccurence occ;
|
||||
typedef struct zoccurence * freq;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
24
Yûki/arbre_de_codage/main.c
Normal file
24
Yûki/arbre_de_codage/main.c
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#include <stdio.h>
|
||||
#include "arbre_binaire.h"
|
||||
|
||||
struct zoccurence{
|
||||
int nb;
|
||||
char lettre;
|
||||
};
|
||||
typedef struct zoccurence occ;
|
||||
typedef struct zoccurence * freq;
|
||||
|
||||
int main ()
|
||||
{
|
||||
|
||||
}
|
||||
/*
|
||||
L est considéré comme ordonné
|
||||
*/
|
||||
arbre huffman(arbre H, freq L[])
|
||||
{
|
||||
int i;
|
||||
|
||||
printf(L[]->nb);
|
||||
printf(L[]->lettre);
|
||||
}
|
||||
40
Yûki/gestion_des_fichiers/bit_a_bit.c
Normal file
40
Yûki/gestion_des_fichiers/bit_a_bit.c
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#define BIN_MAX 8
|
||||
|
||||
void binaire(unsigned int n, char s[]);
|
||||
|
||||
int main(int argc, char **argv){
|
||||
FILE *file;
|
||||
char buffer;
|
||||
int cursor,c;
|
||||
file=fopen("text.txt","rb");
|
||||
// EOF : End Of File
|
||||
while((c=fgetc(file))!=EOF){
|
||||
char sb[BIN_MAX+1];
|
||||
binaire(32,sb);
|
||||
printf("%s\n",sb);
|
||||
}
|
||||
fclose(file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void binaire(unsigned int n, char s[]){
|
||||
/*
|
||||
Décomposition binaire d'un entier (<BIN_MAX) et place celle-ci dans une chaîne de caractères passée en argument (s)
|
||||
|
||||
*/
|
||||
assert(n>=BIN_MAX);
|
||||
s[BIN_MAX]= '\0';
|
||||
int i,r;
|
||||
i=0;
|
||||
while(n!=0){
|
||||
r = n%2;
|
||||
n = n/2;
|
||||
if(0<=(BIN_MAX-i-1) && (BIN_MAX-i-1)<=BIN_MAX){
|
||||
if(r==0) s[BIN_MAX-i-1]= '0';
|
||||
else s[BIN_MAX-i-1]= '1';
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
Yûki/gestion_des_fichiers/bit_a_bit.exe
Normal file
BIN
Yûki/gestion_des_fichiers/bit_a_bit.exe
Normal file
Binary file not shown.
BIN
Yûki/gestion_des_fichiers/bit_a_bit.o
Normal file
BIN
Yûki/gestion_des_fichiers/bit_a_bit.o
Normal file
Binary file not shown.
1
Yûki/gestion_des_fichiers/text.txt
Normal file
1
Yûki/gestion_des_fichiers/text.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
ABCDE
|
||||
Reference in a new issue