Skip to content
Snippets Groups Projects
Commit 7a5d149b authored by dario.genga's avatar dario.genga
Browse files

Add project skeleton

parent aca34891
Branches
No related tags found
No related merge requests found
# Created by https://www.toptal.com/developers/gitignore/api/c,visualstudiocode
# Edit at https://www.toptal.com/developers/gitignore?templates=c,visualstudiocode
### C ###
# Prerequisites
*.d
# Object files
*.o
*.ko
*.obj
*.elf
# Linker output
*.ilk
*.map
*.exp
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# Debug files
*.dSYM/
*.su
*.idb
*.pdb
# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf
### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Local History for Visual Studio Code
.history/
### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide
# Support for Project snippet scope
!.vscode/*.code-snippets
# End of https://www.toptal.com/developers/gitignore/api/c,visualstudiocode
# Custom gitignore for project
hashtable
cmake-build-debug
.idea
# progseq-hashtable
12e travail pratique du cours de programmation séquentielle, 1er année (2021-2022).
\ No newline at end of file
- **Class** : Programmation séquentielle en C
- **Creation date** : 18 janvier 2022
- **Description** : 12e travail pratique
## Makefile configuration
### Compile the project
> `make`
Use this command to compile the project.
### Clean the project
> `make clean`
Use this command to clean the project.
## Run the project
Execute the `hashtable` file.
> ./hashtable
/* Author : Dario GENGA
* Date : 18.01.2022
* Description : Hash library.
*/
#include "hashtable.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
hm *hm_create(unsigned int length) {
return NULL;
}
void hm_destroy(hm **hm) {
}
hm *hm_set(hm *hm, const char *const key, const char *const value) {
return NULL;
}
char *hm_get(const hm *const hm, const char *const key) {
return NULL;
}
char *hm_rm(hm *hm, const char *const key) {
return NULL;
}
char *hmo_str(const hm *const hm) {
return NULL;
}
void hm_print(const hm *const hm) {
return NULL;
}
/* Author : Dario GENGA
* Date : 18.01.2022
* Description : Hash library.
*/
#ifndef _HASHTABLE_H
#define _HASHTABLE_H
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct hm_t {
struct entry_t **entries;
int length;
} hm;
typedef struct entry_t {
char *key;
char *value;
struct entry_t *next;
} entry;
// création d'un pointeur vers une hm
hm *hm_create(unsigned int length);
// destruction de la hm et libération de la mémoire
void hm_destroy(hm **hm);
// insère la paire key-value dans la hm. si key est déjà présente écraser value dans la hm.
hm *hm_set(hm *hm, const char *const key, const char *const value);
// retourne la valeur associé à la clé, key
char *hm_get(const hm *const hm, const char *const key);
// retire une clé de la hm et la retourne
char *hm_rm(hm *hm, const char *const key);
// convertit la hm en chaîne de caractères
char *hm_to_str(const hm *const hm);
// affiche le contenu de la hm
void hm_print(const hm *const hm);
#endif
main.c 0 → 100644
/* Author : Dario GENGA
* Date : 18.01.2022
* Description : Hash library.
*/
#include <stdio.h>
#include <stdlib.h>
int main() {
return EXIT_SUCCESS;
}
makefile 0 → 100644
LIB=-lm
CC=gcc -Wall -Wextra -g
hashtable: hashtable.o main.o
$(CC) $^ -fsanitize=address -fsanitize=leak -o $@ $(LIB)
hashtable.o: hashtable.c hashtable.h
$(CC) -c $< $(LIB)
main.o: main.c
$(CC) -c $< $(LIB)
clean:
rm -f *.o hashtable
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment