Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Commit

Permalink
feat(comment): Implement comments
Browse files Browse the repository at this point in the history
  • Loading branch information
h4rldev committed May 18, 2024
1 parent 61b7df4 commit b54f6c3
Show file tree
Hide file tree
Showing 10 changed files with 377 additions and 103 deletions.
8 changes: 8 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ print_help() {
echo -e "Made with ${RED}<3${CLEAR} by ${__AUTHOR__}"
}

# iterates over every file in src/exmeteo/ and compiles them, then compiles src/main.c, moving them to out/

compile() {
local -a C_FILES

Expand Down Expand Up @@ -132,6 +134,8 @@ compile() {
echo -e "${GREEN}${CLEAR} Compiled ${CYAN}${TRIMMED_C_FILENAMES[@]}${CLEAR} & ${CYAN}main${CLEAR} successfully"
}

# links all object files in out/ to an executable in /bin

link() {
local RELINK
local -a OBJECTS
Expand Down Expand Up @@ -172,6 +176,8 @@ link() {
popd >/dev/null
}

# removes dangling object files that shouldn't be there, used to be required, not that much as of lately though.

clean_dangling() {
local DIR1
local DIR2
Expand All @@ -198,6 +204,8 @@ clean_dangling() {
rm temp_dir1_files.txt temp_dir2_files.txt extra_o_files.txt
}

# cleans both /out && /bin

clean() {
local CLEAN

Expand Down
2 changes: 2 additions & 0 deletions scripts/clear_vgcores.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ print_help() {
echo -e "Made with ${RED}<3${CLEAR} by ${__AUTHOR__}"
}

# Delete all vgcore.* in the repo.

delete() {
local -a FILES
local FILE
Expand Down
24 changes: 23 additions & 1 deletion src/exmeteo/cache.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
#include "cache.h"
#include "color.h"
#include "file.h"


/*
* json_t read_from_cache(const char *cache_name)
*
* Reads, and parses the json defined in %APPDATA\\exmeteo\\ or in ~/.cache/exmeteo/
*
* Usage:
* json_t *cache_codes = read_from_cache("cache.json");
* char *content = json_dump(cache_codes, 0);
* printf("JSON content: %s", content);
*/

json_t *read_from_cache(const char *cache_name) {
char *path = get_path(cache_name);

Expand Down Expand Up @@ -53,6 +64,17 @@ json_t *read_from_cache(const char *cache_name) {
return codes;
}

/*
* int write_to_json(const char *filename, json_t *json, bool free_json)
*
* Reads, and writes json to %APPDATA\\exmeteo\\ or in ~/.cache/exmeteo/
*
* Usage:
* if (write_to_json("cache.json", root, false) == 1) {
* - Do some error handling
* }
*/

int write_to_json(const char *filename, json_t *json, bool free_json) {
char* path = get_path(filename);

Expand Down
Loading

0 comments on commit b54f6c3

Please sign in to comment.