aboutsummaryrefslogtreecommitdiff
path: root/asm/main.cpp
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2024-04-15 04:53:42 +0630
committerAryadev Chavali <aryadev@aryadevchavali.com>2024-04-15 04:55:51 +0630
commitf661438c93806e42cfbbbd39d79c77924a4a5a16 (patch)
treef6fcbc9542822528b83f7e16b41cc58fe9ea9bfc /asm/main.cpp
parent0385d4bb8dafe6c4968fcc83888b5dd3e18e861f (diff)
downloadovm-f661438c93806e42cfbbbd39d79c77924a4a5a16.tar.gz
ovm-f661438c93806e42cfbbbd39d79c77924a4a5a16.tar.bz2
ovm-f661438c93806e42cfbbbd39d79c77924a4a5a16.zip
Moved read_file to a general base library
Diffstat (limited to 'asm/main.cpp')
-rw-r--r--asm/main.cpp19
1 files changed, 1 insertions, 18 deletions
diff --git a/asm/main.cpp b/asm/main.cpp
index 51600cb..be26426 100644
--- a/asm/main.cpp
+++ b/asm/main.cpp
@@ -20,28 +20,11 @@
#include <lib/inst.h>
+#include "./base.hpp"
#include "./lexer.hpp"
using std::pair, std::string, std::string_view, std::vector;
-std::optional<string> read_file(const char *filename)
-{
- FILE *fp = fopen(filename, "rb");
- if (fp)
- {
- string contents;
- fseek(fp, 0, SEEK_END);
- contents.resize(ftell(fp));
- rewind(fp);
- fread(&contents[0], 1, contents.size(), fp);
- fclose(fp);
-
- return contents;
- }
- else
- return std::nullopt;
-}
-
void usage(const char *program_name, FILE *fp)
{
fprintf(fp,