aboutsummaryrefslogtreecommitdiff
path: root/examples/c.prs
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi92@disroot.org>2026-10-01 01:04:30 +0200
committerXavier Del Campo Romero <xavi92@disroot.org>2026-10-11 00:14:35 +0200
commit4ce39e4fc1de9536de7dedfe91b6dee38dec76ae (patch)
treef9820f96b8eab624430c3700f32a2878a7036ee2 /examples/c.prs
parent9140988be4e5bb028b7140aca1a67af1370c72a7 (diff)
downloadprc-4ce39e4fc1de9536de7dedfe91b6dee38dec76ae.tar.gz
WIP sym + cgen
Diffstat (limited to 'examples/c.prs')
-rw-r--r--examples/c.prs27
1 files changed, 27 insertions, 0 deletions
diff --git a/examples/c.prs b/examples/c.prs
new file mode 100644
index 0000000..8224fb5
--- /dev/null
+++ b/examples/c.prs
@@ -0,0 +1,27 @@
+* C interoperatibility example (without imports)
+public function main
+ types
+ socket prototype
+ linkage
+ domain word
+ type word
+ protocol word
+ fd word
+ procedure using domain type protocol returning fd
+
+ close prototype
+ linkage
+ fd word
+ status word
+ procedure using fd returning status
+
+ AF_INET constant to 2
+ SOCK_STREAM constant to 2
+ linkage
+ status word
+ storage
+ fd word
+ procedure returning status
+ call socket using AF_INET SOCK_STREAM 0 returning fd
+ display "fd is " fd
+ call close using fd returning status