about summary refs log tree commit diff
path: root/examples/19.pry
diff options
context:
space:
mode:
authorBaitinq <[email protected]>2025-06-11 00:16:17 +0200
committerBaitinq <[email protected]>2025-06-11 00:16:17 +0200
commitfa92a157746ae17f295d31b7a047dfeb99624a13 (patch)
tree71e469e67a70df15542d873ebe223654def6111b /examples/19.pry
parentstdlib: Remove println (diff)
downloadpry-lang-fa92a157746ae17f295d31b7a047dfeb99624a13.tar.gz
pry-lang-fa92a157746ae17f295d31b7a047dfeb99624a13.tar.bz2
pry-lang-fa92a157746ae17f295d31b7a047dfeb99624a13.zip
Misc: Rename lang
Diffstat (limited to 'examples/19.pry')
-rw-r--r--examples/19.pry33
1 files changed, 33 insertions, 0 deletions
diff --git a/examples/19.pry b/examples/19.pry
new file mode 100644
index 0000000..2ae1973
--- /dev/null
+++ b/examples/19.pry
@@ -0,0 +1,33 @@
+extern printf = (*i8, varargs) => void;
+extern malloc = (i64) => *void;
+extern free = (*void) => void;
+
+let main = () => i64 {
+	let buf = cast(*i8, malloc(sizeof(i8) * 13));
+	(*(buf+cast(*i8, 0))) = 'h';
+	(*(buf+cast(*i8, 1))) = 'e';
+	(*(buf+cast(*i8, 2))) = 'l';
+	(*(buf+cast(*i8, 3))) = 'l';
+	(*(buf+cast(*i8, 4))) = 'o';
+	(*(buf+cast(*i8, 5))) = ' ';
+	(*(buf+cast(*i8, 6))) = 'w';
+	(*(buf+cast(*i8, 7))) = 'o';
+	(*(buf+cast(*i8, 8))) = 'r';
+	(*(buf+cast(*i8, 9))) = 'l';
+	(*(buf+cast(*i8, 10))) = 'd';
+	(*(buf+cast(*i8, 11))) = '\n';
+	(*(buf+cast(*i8, 12))) = '\0';
+	printf("%s", buf);
+	free(cast(*void, buf));
+	return 0;
+};
+
+/*
+
+Expected stdout:
+
+hello world!
+
+Expected return: 0
+
+*/