summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi92@disroot.org>2026-05-09 02:56:07 +0200
committerXavier Del Campo Romero <xavi92@disroot.org>2026-05-17 11:13:23 +0200
commit527c23b73c8dae16f02cca6f450edb7d8225f60f (patch)
tree6b2bfd9e8d814026d6d2c1839d8cfe1bcadc825c /examples
downloadslcob-master.tar.gz
Add project skeletonHEADmaster
Diffstat (limited to 'examples')
-rw-r--r--examples/hello.uc62
1 files changed, 62 insertions, 0 deletions
diff --git a/examples/hello.uc b/examples/hello.uc
new file mode 100644
index 0000000..bbd7b14
--- /dev/null
+++ b/examples/hello.uc
@@ -0,0 +1,62 @@
+* simple example with 3 functions
+
+function bar
+storage
+ var word
+types
+ MONDAY constant
+ TUESDAY constant
+ WEDNESDAY constant
+ THURSDAY constant
+ FRIDAY constant
+ SATURDAY constant
+ SUNDAY constant
+
+ mystruct struct
+ var long
+ var2 long
+ end
+
+ mystruct2 struct
+ var word
+ end
+linkage
+ retcode uword
+procedure returning retcode
+ set retcode to SATURDAY
+ display "bar has now changed the retcode to " SATURDAY
+
+function foo
+storage
+linkage
+ param uword
+ param2 uword
+ retcode uword
+procedure with param param2 returning retcode
+ set retcode to 12
+ display "hi from foo! param is " param
+ ", param2 is " param2
+ ", assigning retcode to " retcode
+ set param to 90
+ set param2 to 60
+ display "now, param is " param ", param2 is " param2
+ call bar returning retcode
+ display "bar returned " retcode
+
+function main public
+globals
+storage
+ myparam uword
+ myparam2 uword
+ myret uword
+procedure
+ set myret to size of word
+ display "myret is " myret
+ set myret to 100
+ set myparam to 300
+ set myparam2 to 400
+ display "calling foo, myparam is " myparam
+ ", myparam2 is " myparam2
+ ", myret is " myret
+ call foo with myparam myparam2
+ display "foo in turn returned " myret