Skip to content

Commit c003a69

Browse files
committed
---
yaml --- r: 63316 b: refs/heads/snap-stage3 c: 9f9e505 h: refs/heads/master v: v3
1 parent 12f7ed5 commit c003a69

File tree

2 files changed

+13
-28
lines changed

2 files changed

+13
-28
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 821a962febc3261e97e31174dcb8cf142678bb4b
4+
refs/heads/snap-stage3: 9f9e50540581881a3c3a7304eaa2577afda59048
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libextra/terminfo/parm.rs

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ pub fn expand(cap: &[u8], params: &mut [Param], sta: &mut [Param], dyn: &mut [Pa
6868

6969
while i < cap.len() {
7070
cur = cap[i] as char;
71-
debug!("current char: %c", cur);
7271
let mut old_state = state;
7372
match state {
7473
Nothing => {
@@ -134,43 +133,29 @@ pub fn expand(cap: &[u8], params: &mut [Param], sta: &mut [Param], dyn: &mut [Pa
134133
(_, _) => return Err(~"non-numbers on stack with |")
135134
},
136135
'A' => match (stack.pop(), stack.pop()) {
137-
(Number(x), Number(y)) => {
138-
if x == 1 && y == 1 {
139-
stack.push(Number(1));
140-
} else {
141-
stack.push(Number(0));
142-
}
143-
},
144-
(_, _) => return Err(~"non-numbers on stack with logical and")
136+
(Number(0), Number(_)) => stack.push(Number(0)),
137+
(Number(_), Number(0)) => stack.push(Number(0)),
138+
(Number(_), Number(_)) => stack.push(Number(1)),
139+
_ => return Err(~"non-numbers on stack with logical and")
145140
},
146141
'O' => match (stack.pop(), stack.pop()) {
147-
(Number(x), Number(y)) => {
148-
if x == 1 && y == 1 {
149-
stack.push(Number(1));
150-
} else {
151-
stack.push(Number(0));
152-
}
153-
},
154-
(_, _) => return Err(~"non-numbers on stack with logical or")
142+
(Number(0), Number(0)) => stack.push(Number(0)),
143+
(Number(_), Number(_)) => stack.push(Number(1)),
144+
_ => return Err(~"non-numbers on stack with logical or")
155145
},
156146
'!' => match stack.pop() {
157-
Number(x) => {
158-
if x == 1 {
159-
stack.push(Number(0))
160-
} else {
161-
stack.push(Number(1))
162-
}
163-
},
147+
Number(0) => stack.push(Number(1)),
148+
Number(_) => stack.push(Number(0)),
164149
_ => return Err(~"non-number on stack with logical not")
165150
},
166151
'~' => match stack.pop() {
167152
Number(x) => stack.push(Number(!x)),
168153
_ => return Err(~"non-number on stack with %~")
169154
},
170155
'i' => match (copy params[0], copy params[1]) {
171-
(Number(x), Number(y)) => {
172-
params[0] = Number(x + 1);
173-
params[1] = Number(y + 1);
156+
(Number(ref mut x), Number(ref mut y)) => {
157+
*x += 1;
158+
*y += 1;
174159
},
175160
(_, _) => return Err(~"first two params not numbers with %i")
176161
},

0 commit comments

Comments
 (0)