forked from mbebenita/j2me.js
-
Notifications
You must be signed in to change notification settings - Fork 1
/
frame.js
34 lines (28 loc) · 937 Bytes
/
frame.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
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set shiftwidth=4 tabstop=4 autoindent cindent expandtab: */
'use strict';
Array.prototype.push2 = function(value) {
this.push(value);
this.push(null);
return value;
}
Array.prototype.pop2 = function() {
this.pop();
return this.pop();
}
Array.prototype.pushType = function(signature, value) {
if (signature === "J" || signature === "D") {
this.push2(value);
return;
}
this.push(value);
}
Array.prototype.popType = function(signature) {
return (signature === "J" || signature === "D") ? this.pop2() : this.pop();
}
// A convenience function for retrieving values in reverse order
// from the end of the stack. stack.read(1) returns the topmost item
// on the stack, while stack.read(2) returns the one underneath it.
Array.prototype.read = function(i) {
return this[this.length - i];
};