projects
/
rune.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
Rune - Further Object abstraction work
[rune.git]
/
tests
/
float2.d
1
#!/usr/local/bin/rune -x
2
#
3
# Demonstrate constant types. Constants in Rune are effectively what
4
# '#define BLAH 23' would be in C, except they are specifically typed.
5
6
import "sys";
7
import <stdio>;
8
9
alias stdio.File @stdout = stdio.stdout;
10
11
const char NIL = 0UB;
12
13
double D1 = 1.0;
14
double D2 = 2.0;
15
double D3 = 3.0;
16
double D4 = 4.0;
17
18
public
19
int
20
main(int ac, string_p *av)
21
{
22
double d1;
23
double d2;
24
double d3;
25
double d4;
26
27
d1 = D1;
28
d2 = D2;
29
d3 = D3;
30
d4 = D4;
31
d1 += d2;
32
d1 += d3;
33
d1 += d4;
34
d2 *= d1;
35
d3 /= d1;
36
d4 *= d1;
37
38
fubar();
39
40
return(0);
41
}
42
43
void
44
fubar()
45
{
46
double d1;
47
double d2;
48
double d3;
49
double d4;
50
double *xptr;
51
52
d1 = D1;
53
d2 = D2;
54
d3 = D3;
55
d4 = D4;
56
xptr = &d1;
57
d1 += d2;
58
d1 += d3;
59
d1 += d4;
60
xptr = &d2;
61
d2 *= d1;
62
d3 /= d1;
63
d4 *= d1;
64
65
return(0);
66
}