-
Notifications
You must be signed in to change notification settings - Fork 20
/
test_rhino.js
69 lines (61 loc) · 1.29 KB
/
test_rhino.js
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
load("sprintf-0.6.js")
load("jsmat/matrix.js");
load("hp15c.js");
load("test.js");
Timers = [];
function alert(s) {
print(s);
}
function setTimeout(fn, delay) {
var expire = new Date().getTime() + delay;
var i = 0;
while (i < Timers.length && expire > Timers[i].expire) {
i += 1;
}
var t = {
expire: expire,
fn: fn
};
Timers[i] = t;
return t;
}
function clearTimeout(t) {
for (var i = 0; i < Timers.length; i++) {
if (Timers[i] === t) {
Timers.splice(i, 1);
break;
}
}
}
console = {
log: function(s) {
//print(s);
}
};
window = {
console: console
};
Display = {
clear_digit: function(i) {},
clear_digits: function() {},
clear_shift: function() {},
set_complex: function(on) {},
set_comma: function(i) {},
set_decimal: function(i) {},
set_digit: function(i, d) {},
set_neg: function() {},
set_prgm: function(on) {},
set_shift: function(mode) {},
set_trigmode: function(mode) {},
set_user: function(on) {}
};
init();
start_tests();
while (Timers.length > 0) {
var now = new Date().getTime();
if (Timers.length > 0 && now >= Timers[0].expire) {
var fn = Timers[0].fn;
Timers.splice(0, 1);
fn();
}
}