-
Notifications
You must be signed in to change notification settings - Fork 32
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
Eric Meehan
committed
Apr 10, 2021
1 parent
c8988d5
commit 1f6bc3e
Showing
14 changed files
with
263 additions
and
89 deletions.
There are no files selected for viewing
Binary file not shown.
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
Binary file not shown.
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,15 @@ | ||
// | ||
// ================================== | ||
// libeom | ||
// | ||
// an open source c library. | ||
// ================================== | ||
// | ||
// BlockHeaders.c | ||
// | ||
// Eric Meehan | ||
// 4/1/21 | ||
// | ||
// | ||
|
||
#include "BlockHeaders.h" |
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,34 @@ | ||
// | ||
// ================================== | ||
// libeom | ||
// | ||
// an open source c library. | ||
// ================================== | ||
// | ||
// BlockHeaders.h | ||
// | ||
// Eric Meehan | ||
// 4/1/21 | ||
// | ||
// | ||
|
||
#ifndef BlockHeaders_h | ||
#define BlockHeaders_h | ||
|
||
struct BlockHeaders // Bytes: | ||
{ | ||
unsigned char previous[64]; // 0 - 63 | ||
unsigned long nonce; // 64 - 71 | ||
|
||
unsigned char by[64]; // 72 - 135 | ||
char timestamp[20]; // 136 - 155 | ||
unsigned long size; // 156 - 164 | ||
}; | ||
|
||
struct Block | ||
{ | ||
struct BlockHeaders headers; | ||
unsigned char data; | ||
}; | ||
|
||
#endif /* BlockHeaders_h */ |
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 |
---|---|---|
|
@@ -19,4 +19,6 @@ | |
|
||
#include "Systems/ThreadPool.h" | ||
|
||
#include "Systems/Files.h" | ||
|
||
#endif /* System_h */ |
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,58 @@ | ||
// | ||
// ================================== | ||
// libeom | ||
// | ||
// an open source c library. | ||
// ================================== | ||
// | ||
// Files.c | ||
// | ||
// Eric Meehan | ||
// 4/2/21 | ||
// | ||
// | ||
|
||
#include "Files.h" | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
unsigned long get_file_size(char *path) | ||
{ | ||
FILE *file = fopen(path, "r"); | ||
fseek(file, 0, SEEK_END); | ||
unsigned long size = ftell(file); | ||
fclose(file); | ||
return size; | ||
} | ||
|
||
unsigned long get_file_size_internal(FILE *file) | ||
{ | ||
fseek(file, 0, SEEK_END); | ||
unsigned long size = ftell(file); | ||
fseek(file, 0, SEEK_SET); | ||
return size; | ||
} | ||
|
||
void write_file(char *path, void *data, unsigned long size) | ||
{ | ||
FILE *file = fopen(path, "w"); | ||
fwrite(data, size, 1, file); | ||
fclose(file); | ||
} | ||
|
||
void append_file(char *path, void *data, unsigned long size) | ||
{ | ||
FILE *file = fopen(path, "a"); | ||
fwrite(data, size, 1, file); | ||
fclose(file); | ||
} | ||
|
||
void * read_file(char *path) | ||
{ | ||
FILE *file = fopen(path, "r"); | ||
unsigned long size = get_file_size_internal(file); | ||
void *data = malloc(size); | ||
fread(data, size, 1, file); | ||
return data; | ||
} |
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,23 @@ | ||
// | ||
// ================================== | ||
// libeom | ||
// | ||
// an open source c library. | ||
// ================================== | ||
// | ||
// Files.h | ||
// | ||
// Eric Meehan | ||
// 4/2/21 | ||
// | ||
// | ||
|
||
#ifndef Files_h | ||
#define Files_h | ||
|
||
unsigned long get_file_size(char *path); | ||
void write_file(char *path, void *data, unsigned long size); | ||
void append_file(char *path, void *data, unsigned long size); | ||
void * read_file(char *path); | ||
|
||
#endif /* Files_h */ |
Binary file not shown.
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 |
---|---|---|
|
@@ -21,4 +21,6 @@ | |
|
||
#include "Systems.h" | ||
|
||
|
||
|
||
#endif /* libeom_h */ |
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
Binary file modified
BIN
+4.95 KB
(100%)
....xcodeproj/project.xcworkspace/xcuserdata/eric.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
Oops, something went wrong.