summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rwxr-xr-xpkg.sh15
-rw-r--r--std/arr.c23
-rw-r--r--std/io.c42
4 files changed, 14 insertions, 69 deletions
diff --git a/.gitignore b/.gitignore
index 9c1ef31..ba8d9a8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,4 +10,5 @@ vgcore*
TAGS
tags
*.o
-compatibility \ No newline at end of file
+compatibility
+std/*.c
diff --git a/pkg.sh b/pkg.sh
index 5f1d847..1a397b5 100755
--- a/pkg.sh
+++ b/pkg.sh
@@ -1,10 +1,19 @@
#!/bin/sh
std_things="io arr"
cd std
+
+VALGRIND="valgrind --track-origins=yes --exit-on-first-error=yes --error-exitcode=1 -q"
+if [ "$1" = "nov" ]; then
+ VALGRIND=""
+fi
+if [ "$CC" = "" ]; then
+ CC=gcc
+fi
+
for thing in $std_things; do
- valgrind --track-origins=yes --exit-on-first-error=yes --error-exitcode=1 -q ../toc $thing.toc -o $thing.c || exit 1
+ $VALGRIND ../toc $thing.toc -o $thing.c || exit 1
done
cd ..
-valgrind --track-origins=yes --exit-on-first-error=yes --error-exitcode=1 -q ./toc test.toc || exit 1
-gcc out.c std/*.c || exit 1
+$VALGRIND ./toc test.toc || exit 1
+$CC out.c std/*.c || exit 1
./a.out
diff --git a/std/arr.c b/std/arr.c
deleted file mode 100644
index 2d2c03a..0000000
--- a/std/arr.c
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <stdint.h>
-#include <stdio.h>
-typedef int8_t i8;
-typedef int16_t i16;
-typedef int32_t i32;
-typedef int64_t i64;
-typedef uint8_t u8;
-typedef uint16_t u16;
-typedef uint32_t u32;
-typedef uint64_t u64;
-typedef float f32;
-typedef double f64;
-typedef u8 bool;
-typedef struct { void *data; i64 n; } slice_;
-#define false ((bool)0)
-#define true ((bool)1)
-static slice_ mkslice_(void *data, i64 n) { slice_ ret; ret.data = data; ret.n = n; return ret; }
-static void free_(void *data) { extern void free(void *data); free(data); }
-static void *e__calloc(size_t n, size_t sz) { extern void *calloc(size_t n, size_t size); extern void abort(void); void *ret = calloc(n, sz); if (n && sz && !ret) { fprintf(stderr, "Out of memory.\n"); abort(); } return ret; }
-
-
-/* declarations */
-/* code */
diff --git a/std/io.c b/std/io.c
deleted file mode 100644
index 97d5d43..0000000
--- a/std/io.c
+++ /dev/null
@@ -1,42 +0,0 @@
-#include <stdint.h>
-#include <stdio.h>
-typedef int8_t i8;
-typedef int16_t i16;
-typedef int32_t i32;
-typedef int64_t i64;
-typedef uint8_t u8;
-typedef uint16_t u16;
-typedef uint32_t u32;
-typedef uint64_t u64;
-typedef float f32;
-typedef double f64;
-typedef u8 bool;
-typedef struct { void *data; i64 n; } slice_;
-#define false ((bool)0)
-#define true ((bool)1)
-static slice_ mkslice_(void *data, i64 n) { slice_ ret; ret.data = data; ret.n = n; return ret; }
-static void free_(void *data) { extern void free(void *data); free(data); }
-static void *e__calloc(size_t n, size_t sz) { extern void *calloc(size_t n, size_t size); extern void abort(void); void *ret = calloc(n, sz); if (n && sz && !ret) { fprintf(stderr, "Out of memory.\n"); abort(); } return ret; }
-
-
-/* declarations */
-void io__puti(i64 x);
-void io__putf(f32 x);
-void io__puts(slice_ x);
-/* code */
-void io__puti(i64 x) {
- printf("%ld\n", (long)x);
-}
-
-
-void io__putf(f32 x) {
- printf("%f\n", (double)x);
-}
-
-
-void io__puts(slice_ x) {
- fwrite(x.data, 1, x.n, stdout);
- printf("\n");
-}
-
-