aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorGravatar Moon Flower <moon@coffin.ir> 2025-02-26 12:16:34 +0330
committerGravatar Moon Flower <moon@coffin.ir> 2025-02-26 12:16:34 +0330
commit93d17188c89a9197a2cb0bdad4d5ca9ac3be4461 (patch)
treebdbd50206f87ea00a124c94b29398f9037f3014a /main.c
parentAdded foreach (diff)
a few fixes and changes
Diffstat (limited to 'main.c')
-rw-r--r--main.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/main.c b/main.c
index 3952bd7..b01452e 100644
--- a/main.c
+++ b/main.c
@@ -1,16 +1,18 @@
// This is the test unit, not the actual code.
+#define __MOONSHINE_LIBC_WARNINGS
#include "moonshine.h"
-int main() {
- array(int) test = new (int);
+void cleanup_free(var* input) { print("Free that thang ", input); }
+
+#define auto_free __attribute__((cleanup(cleanup_free)))
- int j = 1;
- for(int i = 100; i >= 0; i--) push(test, i % (j++));
+#define create(name, ...) \
+ auto_free var cat(name, _parent) = __VA_ARGS__; \
+ auto name = cat(name, _parent);
- foreach(numba in test) {
- print("Item: ", numba, " index ", numba_index);
- }
+int main() {
+ print("Wow ", strdup("Gay smex")[ 0 ]);
return 0;
}