summaryrefslogtreecommitdiff
path: root/out.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2019-10-22 21:47:33 -0400
committerLeo Tenenbaum <pommicket@gmail.com>2019-10-22 21:47:33 -0400
commitf97d401c3bade9f053055f411be25ef6d6b8041b (patch)
treefc60de8681f89626ebf0382a19ff13dc95f856ed /out.c
parente5e7fa994521c516166684f53035f17a3ad23895 (diff)
string literals are now slices; minor bug fixes
Diffstat (limited to 'out.c')
-rw-r--r--out.c72
1 files changed, 0 insertions, 72 deletions
diff --git a/out.c b/out.c
deleted file mode 100644
index a9db4d3..0000000
--- a/out.c
+++ /dev/null
@@ -1,72 +0,0 @@
-#include <stdint.h>
-#include <stdlib.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 unsigned char bool;
-typedef struct { void *data; u64 n; } slice_;
-static slice_ mkslice_(void *data, u64 n) { slice_ ret; ret.data = data; ret.n = n; return ret; }
-static void *e__calloc(size_t n, size_t sz) { void *ret = calloc(n, sz); if (!ret) { fprintf(stderr, "Out of memory.\n"); abort(); } return ret; }
-#define false ((bool)0)
-#define true ((bool)1)
-
-
-/* declarations */
-void puti(i64 x);
-void putf(f32 x);
-i64 foo(void);
-void main__(void);
-/* code */
-int main() {
- main__();
- return 0;
-}
-
-void puti(i64 x) {
-
- printf("%ld\n", (long)x);
-}
-
-
-void putf(f32 x) {
-
- printf("%f\n", (double)x);
-}
-
-
-i64 foo(void) {
-
- i64 N; {
- i64 expr__; expr__ = 10;N = expr__;}
- slice_ numbers; {
- slice_ expr__; expr__ = mkslice_(e__calloc(N, sizeof(i64)), N);numbers = expr__;}
- i64 i; {
- i64 expr__; expr__ = 0;i = expr__;}
- while ((i<N)) {
- (((i64(*))(numbers.data))[i]) = i;;
- i = (i+1);;
- };
- slice_ a1_; { slice_ of__ = numbers; u64 a2_ = 5; a1_.data = (i64(*))(of__.data) + a2_; a1_.n = 7 - a2_; }
- slice_ a3_; { slice_ of__ = numbers; u64 a4_ = 2; a3_.data = (i64(*))(of__.data) + a4_; a3_.n = of__.n - 1 - a4_; }
- slice_ a5_; { slice_ of__ = numbers; u64 a6_ = 0; a5_.data = (i64(*))(of__.data) + a6_; a5_.n = 6 - a6_; }
- return (((((i64(*))(a1_.data))[1])+(((i64(*))(a3_.data))[0]))+(((i64(*))(a5_.data))[3]));
-}
-
-
-void main__(void) {
-
- i64 N = 5;
- (puti(N));
- i64( x[11]) = {0};
- (puti((foo())));
-}
-
-