summaryrefslogtreecommitdiff
path: root/examples/hello.uc
blob: bbd7b14bd26f4a6f9623b593fd4d707c21eb6d0f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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