-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7673fa0
commit 0ea0bfb
Showing
29 changed files
with
1,543 additions
and
1,499 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ | |
/bin/ | ||
/.vscode/ | ||
docs/ | ||
latex/ | ||
latex/ | ||
out/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,15 @@ | ||
# paris-trees-mst | ||
|
||
we'll take a dive into the utilization of this program | ||
This project is an academical project which aims to compute minimum spanning tree algorithm on Paris trees from a csv database. | ||
|
||
One year after, I come back on the database to try to enhance coding quality and review my past mistakes. | ||
|
||
## to be modified | ||
|
||
- CLI parsing, use [vrgcli](https://dev.to/rdentato/vrg-for-comand-lines-5hmm), it seems easier | ||
- gui library : use sdl2 instead, more universal and portable | ||
|
||
taking a first look at the basecode shows there are plenty of modifications to be done ! | ||
|
||
A test framework needs to be used, why not [this one](https://github.com/rdentato/tst/blob/main/src/tst.h) | ||
let's write some unit tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,37 @@ | ||
#include <stdio.h> | ||
|
||
typedef struct list_t list_t ; | ||
|
||
|
||
typedef struct list dynamic_list; | ||
|
||
/** | ||
* @brief Crée une liste vide | ||
* | ||
* | ||
* @return list_t* ou NULL en cas de problème | ||
*/ | ||
list_t* list_create(void); | ||
|
||
dynamic_list *list_create(void); | ||
|
||
/** | ||
* @brief Ajoute un élément à la fin de la liste | ||
* | ||
* @return 0 en cas de problème, 1 sinon | ||
*/ | ||
int list_append(list_t*, void*); | ||
|
||
/** | ||
* @brief Ajoute un élément en début de liste | ||
* | ||
* | ||
* @return 0 en cas de problème, 1 sinon | ||
*/ | ||
int list_prepend(list_t*, void*); | ||
|
||
int list_append(dynamic_list *list, size_t elem); | ||
|
||
/** | ||
* @brief retourne le (idx+1)ème élément | ||
* comportement indéfini en cas de dépassemnt | ||
* | ||
* @return void* | ||
* | ||
* @return void* | ||
*/ | ||
void* list_get(list_t*, int); | ||
size_t list_get(dynamic_list *list, int index); | ||
|
||
size_t list_pop(dynamic_list *list); | ||
|
||
/** | ||
* @brief remplace l'élément à la position donnée par l'élément donné | ||
* | ||
*/ | ||
void list_set(list_t*, int, void*); | ||
|
||
/** | ||
* @brief remplace l'élément à la position donnée par l'élément donné et free l'élément remplacé | ||
* | ||
*/ | ||
void list_set2(list_t* it, int pos, void* element); | ||
|
||
/** | ||
* @brief revoie la taille de la liste | ||
* | ||
* @return size_t | ||
*/ | ||
size_t list_size(list_t*); | ||
|
||
/** | ||
* @brief insère un élément à la position idx | ||
* | ||
* @return 0 en cas de problème, 1 sinon | ||
*/ | ||
int list_insert(list_t*, size_t, void*); | ||
|
||
/** | ||
* @brief retourne l'élément à la position idc, puis enlève cet élément de la liste | ||
* | ||
* @return void* | ||
*/ | ||
void* list_take(list_t*, int); | ||
|
||
/** | ||
* @brief libère la liste et tous ses éléments | ||
* | ||
* | ||
*/ | ||
void list_free(list_t*); | ||
|
||
void list_set(dynamic_list *, int index, size_t new_value); | ||
|
||
size_t* create_size_t(size_t i); | ||
size_t list_size(dynamic_list *list); | ||
|
||
void list_free2(list_t* it); | ||
void list_free(dynamic_list *list); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
/** | ||
A convenient way to handle errors : will call raler if condition is true | ||
--> means bad return code | ||
*/ | ||
#define CHK(condition) \ | ||
do { \ | ||
if (condition) \ | ||
raler(#condition, __FILE__, __LINE__); \ | ||
} while (0); | ||
|
||
void raler(const char *msg, const char *file, int line); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.