]> git.lizzy.rs Git - uwu-lang.git/commitdiff
Use uwu-common as submodule
authorElias Fleckenstein <eliasfleckenstein@web.de>
Sat, 1 Jan 2022 18:19:47 +0000 (19:19 +0100)
committerElias Fleckenstein <eliasfleckenstein@web.de>
Sat, 1 Jan 2022 18:19:47 +0000 (19:19 +0100)
.gitmodules [new file with mode: 0644]
README.md
common [new submodule]
common/dl.h [deleted file]
common/err.h [deleted file]
common/file.h [deleted file]
common/str.h [deleted file]
src/load.c

diff --git a/.gitmodules b/.gitmodules
new file mode 100644 (file)
index 0000000..10d1794
--- /dev/null
@@ -0,0 +1,3 @@
+[submodule "common"]
+       path = common
+       url = https://github.com/EliasFleckenstein03/uwu-common
index bea6e21df4ab50a4cd67b589abe974bcc3a2a1e3..703a9d8df703a9f55fd0ccb0e27974d4354fd634 100644 (file)
--- a/README.md
+++ b/README.md
@@ -28,7 +28,7 @@ It's turing complete and somewhat useable.
 To build:
 
 ```
-make
+make all std
 ```
 
 To run:
diff --git a/common b/common
new file mode 160000 (submodule)
index 0000000..a636a96
--- /dev/null
+++ b/common
@@ -0,0 +1 @@
+Subproject commit a636a960a0866a94719aff01774b9533743ee072
diff --git a/common/dl.h b/common/dl.h
deleted file mode 100644 (file)
index 143b422..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _COMMON_DL_H_
-#define _COMMON_DL_H_
-
-#include <dlfcn.h>
-#include "err.h"
-
-inline static void check_dlerror()
-{
-       char *err = dlerror();
-       if (err)
-               error("library error: %s\n", err);
-}
-
-#endif
diff --git a/common/err.h b/common/err.h
deleted file mode 100644 (file)
index b9faf11..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef _COMMON_ERR_H_
-#define _COMMON_ERR_H_
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-
-static inline void error(const char *format, ...)
-{
-       va_list args;
-       va_start(args, format);
-       vfprintf(stderr, format, args);
-       va_end(args);
-       exit(1);
-}
-
-static inline void syserror(const char *call, FILE *file)
-{
-       perror(call);
-
-       if (file)
-               fclose(file);
-
-       exit(1);
-}
-
-#endif
diff --git a/common/file.h b/common/file.h
deleted file mode 100644 (file)
index c5e8036..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef _COMMON_FILE_H_
-#define _COMMON_FILE_H_
-
-#include <stdio.h>
-#include <stdbool.h>
-
-inline static bool file_exists(const char *filename)
-{
-       FILE *f = fopen(filename, "r");
-
-       if (f) {
-               fclose(f);
-               return true;
-       }
-
-       return false;
-}
-
-#endif
diff --git a/common/str.h b/common/str.h
deleted file mode 100644 (file)
index fc5f587..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef _COMMON_STR_H_
-#define _COMMON_STR_H_
-
-#include <stdio.h>
-#include <stdarg.h>
-
-static inline char *asprintf_wrapper(const char *format, ...)
-{
-       va_list args;
-       va_start(args, format);
-       char *ptr;
-       vasprintf(&ptr, format, args);
-       va_end(args);
-       return ptr;
-}
-
-#endif
index 4a05915e28320b6949ed587f15f9668f683d5344..4eee71710b443c32b4cc39e4fecb7e9ecc0568d3 100644 (file)
@@ -2,31 +2,17 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdarg.h>
-#include <libgen.h>
 #include <dlfcn.h>
 #include "common/err.h"
 #include "common/str.h"
 #include "common/file.h"
 #include "common/dl.h"
+#include "common/dir.h"
 #include "load.h"
 #include "parse.h"
 
 #define DEBUG 0
 
-// helper functions
-
-static char *dirname_wrapper(const char *name)
-{
-       char *copy = strdup(name);
-       char *result = dirname(copy);
-       char *result_copy = strdup(result);
-
-       free(copy);
-       return result_copy;
-}
-
-// type definitions
-
 typedef struct
 {
        char *name;