=?UTF-8?Q?Fr=C3=A9d=C3=A9ric=20Delanoy=20?=: cmd: Add support for GEQ comparison operator in if statements.
Alexandre Julliard
julliard at winehq.org
Fri Oct 26 11:36:21 CDT 2012
Module: wine
Branch: master
Commit: 73995c71e05a7bd33784b0f994951d6fc3ca9c9e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=73995c71e05a7bd33784b0f994951d6fc3ca9c9e
Author: Frédéric Delanoy <frederic.delanoy at gmail.com>
Date: Thu Oct 25 23:48:06 2012 +0200
cmd: Add support for GEQ comparison operator in if statements.
---
programs/cmd/builtins.c | 9 ++++
programs/cmd/tests/test_builtins.cmd.exp | 76 +++++++++++++++---------------
2 files changed, 47 insertions(+), 38 deletions(-)
diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c
index e15c7c8..112d678 100644
--- a/programs/cmd/builtins.c
+++ b/programs/cmd/builtins.c
@@ -2359,6 +2359,7 @@ static int evaluate_if_comparison(const WCHAR *leftOperand, const WCHAR *operato
static const WCHAR leqW[] = {'l','e','q','\0'};
static const WCHAR equW[] = {'e','q','u','\0'};
static const WCHAR neqW[] = {'n','e','q','\0'};
+ static const WCHAR geqW[] = {'g','e','q','\0'};
/* == is a special case, as it always compares strings */
if (!lstrcmpiW(operator, eqeqW))
@@ -2403,6 +2404,14 @@ static int evaluate_if_comparison(const WCHAR *leftOperand, const WCHAR *operato
: lstrcmpW (leftOperand, rightOperand) != 0;
}
+ if (!lstrcmpiW(operator, geqW)) {
+ if (int_operands)
+ return leftOperand_int >= rightOperand_int;
+ else
+ return caseInsensitive ? lstrcmpiW(leftOperand, rightOperand) >= 0
+ : lstrcmpW (leftOperand, rightOperand) >= 0;
+ }
+
return -1;
}
diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp
index 9adc016..c451c70 100644
--- a/programs/cmd/tests/test_builtins.cmd.exp
+++ b/programs/cmd/tests/test_builtins.cmd.exp
@@ -507,21 +507,21 @@ A NEQ AA
B NEQ AA
AB NEQ AA
BA NEQ AA
- at todo_wine@A GEQ A
- at todo_wine@B GEQ A
- at todo_wine@AB GEQ A
- at todo_wine@BA GEQ A
- at todo_wine@AA GEQ A
- at todo_wine@B GEQ B
- at todo_wine@BA GEQ B
- at todo_wine@B GEQ AB
- at todo_wine@AB GEQ AB
- at todo_wine@BA GEQ AB
- at todo_wine@BA GEQ BA
- at todo_wine@B GEQ AA
- at todo_wine@AB GEQ AA
- at todo_wine@BA GEQ AA
- at todo_wine@AA GEQ AA
+A GEQ A
+B GEQ A
+AB GEQ A
+BA GEQ A
+AA GEQ A
+B GEQ B
+BA GEQ B
+B GEQ AB
+AB GEQ AB
+BA GEQ AB
+BA GEQ BA
+B GEQ AA
+AB GEQ AA
+BA GEQ AA
+AA GEQ AA
@todo_wine at B GTR A
@todo_wine at AB GTR A
@todo_wine at BA GTR A
@@ -576,16 +576,16 @@ string/hexa compare ok
0 NEQ 9
1 NEQ 9
10 NEQ 9
- at todo_wine@0 GEQ 0
- at todo_wine@1 GEQ 0
- at todo_wine@10 GEQ 0
- at todo_wine@9 GEQ 0
- at todo_wine@1 GEQ 1
- at todo_wine@10 GEQ 1
- at todo_wine@9 GEQ 1
- at todo_wine@10 GEQ 10
- at todo_wine@10 GEQ 9
- at todo_wine@9 GEQ 9
+0 GEQ 0
+1 GEQ 0
+10 GEQ 0
+9 GEQ 0
+1 GEQ 1
+10 GEQ 1
+9 GEQ 1
+10 GEQ 10
+10 GEQ 9
+9 GEQ 9
@todo_wine at 1 GTR 0
@todo_wine at 10 GTR 0
@todo_wine at 9 GTR 0
@@ -596,19 +596,19 @@ string/hexa compare ok
strings and integers not equal
strings and integers not equal
foo
- at todo_wine@"10" GEQ "1"
- at todo_wine@'1' GEQ 1 at or_broken@NT4
- at todo_wine@1 GEQ "1"
- at todo_wine@"1" GEQ "1"
- at todo_wine@'1' GEQ "1"
- at todo_wine@"10" GEQ "1"
- at todo_wine@non NT4 at or_broken@1 GEQ '1'
- at todo_wine@'1' GEQ '1'
- at todo_wine@foo
- at todo_wine@1 GEQ "10"
- at todo_wine@foo
- at todo_wine@'1' GEQ "10"
- at todo_wine@"10" GEQ "10"
+"10" GEQ "1"
+'1' GEQ 1 at or_broken@NT4
+1 GEQ "1"
+"1" GEQ "1"
+'1' GEQ "1"
+"10" GEQ "1"
+non NT4 at or_broken@1 GEQ '1'
+'1' GEQ '1'
+foo
+1 GEQ "10"
+foo
+'1' GEQ "10"
+"10" GEQ "10"
------------ Testing for ------------
--- plain FOR
A
More information about the wine-cvs
mailing list