-
Notifications
You must be signed in to change notification settings - Fork 0
/
OUCHOW.F
83 lines (63 loc) · 2 KB
/
OUCHOW.F
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
c Code to abstract OW specific calls.
c I intend to implement versions of this for other compilers, most
c specifically gfortran and NAG.
c
c Owain Kenway
c Equivalent of iargc
subroutine countargs(n)
implicit none
integer n, iargc
n = iargc() - 1
end
c Equivalent of igetarg
subroutine getargat(n, s, l)
implicit none
integer n, l, igetarg
character*1024 s
l = igetarg(n, s)
end
c Equivalent of gettim
subroutine getsec(t)
implicit none
real t
integer*2 hrs, mins, sec, hsec
call gettim(hrs,mins,sec,hsec)
t = (3600*hrs) + (60*mins) + sec + (hsec/100.0)
end
c Start random number generation.
c Technically we don't need to do anything in OpenWatcom
subroutine initrand(seed)
implicit none
integer seed, dummy
c Do something with seed to supress warnings.
dummy = seed
end
c Get next number.
c Need to pass seed as that's always needed by OpenWatcom
function getrand(seed)
implicit none
real getrand, urand
integer seed
getrand = urand(seed)
end
c Sleep that only happens on DOS
subroutine dossleep(seconds)
implicit none
integer seconds
call sleep(seconds)
end
c Literal delay loop as we have no sleep and are on DOS
subroutine sleep(seconds)
implicit none
integer seconds
integer*2 hrs,mins,sec,hsec
real*8 elap, start, now
elap = 0.0d0
call gettim(hrs,mins,sec,hsec)
start = (3600*hrs) + (60 * mins) + sec + (hsec/100.0d0)
do while (elap .le. seconds)
call gettim(hrs,mins,sec,hsec)
now = (3600*hrs) + (60 * mins) + sec + (hsec/100.0d0)
elap = now - start
end do
end