diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2019-10-21 10:08:40 -0400 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2019-10-21 10:08:40 -0400 |
commit | ee7525251681a3c0ab38e0356bc3733adb3e6566 (patch) | |
tree | 9e2ded4a9de3823419375b1c31a7d4973279e2f3 /out.c | |
parent | d85766938a25c5c8fc32cdb83ee61b983d458318 (diff) |
run time slice at index; started compile time
Diffstat (limited to 'out.c')
-rw-r--r-- | out.c | 34 |
1 files changed, 26 insertions, 8 deletions
@@ -17,7 +17,8 @@ typedef struct { void *data; u64 n; } slice_; /* declarations */ -i64 foo(void); +void puti(i64 x); +i64 foo(i64 x); void main__(void); /* code */ int main() { @@ -25,19 +26,36 @@ int main() { return 0; } -i64 foo(void) { +void puti(i64 x) { - slice_ X; { - slice_ expr__; slice_ a0_; a0_.data = calloc(5, sizeof(i64([100]))); a0_.n = 5;expr__ = a0_;X = expr__;} - i64( asdf[100]) = {0}; - ((*(&asdf))[5]) = 12;; - return (asdf[5]); + printf("%ld\n", (long)x); +} + + +i64 foo(i64 x) { + + slice_ C; { + slice_ expr__; slice_ a0_; a0_.data = calloc(x, sizeof(i64)); a0_.n = x;expr__ = a0_;C = expr__;} + i64 i; { + i64 expr__; expr__ = 0;i = expr__;} + while ((i<x)) { + (((i64(*))(C.data))[i]) = i;; + i = (i+1);; + }; + i64 total; { + i64 expr__; expr__ = 0;total = expr__;} + while ((i<x)) { + total = (total+(((i64(*))(C.data))[i]));; + i = (i+1);; + }; + return total; } void main__(void) { - i64( Ar[12]) = {0}; + i64( A[0]) = {0}; + i64( B[0]) = {0}; } |