3
|
1 |
#
|
|
2 |
# Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
# All rights reserved.
|
|
4 |
# This component and the accompanying materials are made available
|
|
5 |
# under the terms of the License "Eclipse Public License v1.0"
|
|
6 |
# which accompanies this distribution, and is available
|
|
7 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
#
|
|
9 |
# Initial Contributors:
|
|
10 |
# Nokia Corporation - initial contribution.
|
|
11 |
#
|
|
12 |
# Contributors:
|
|
13 |
#
|
|
14 |
# Description:
|
|
15 |
# operators for boolean logic, including a case
|
|
16 |
# sensitive equality operator
|
|
17 |
#
|
|
18 |
|
|
19 |
|
|
20 |
define not
|
|
21 |
$(if $1,,1)
|
|
22 |
endef
|
|
23 |
|
|
24 |
define xor
|
|
25 |
$(and $(or $1,$2),$(call not,$1,$2))
|
|
26 |
endef
|
|
27 |
|
|
28 |
define equal
|
|
29 |
$(if $(1:$(2)=),,$(if $(2:$(1)=),,1))
|
|
30 |
endef
|
|
31 |
|
|
32 |
define equal_debug
|
|
33 |
$(info equal $1 $2 )$(if $(1:$(2)=),,$(if $(2:$(1)=),,1))
|
|
34 |
endef
|
|
35 |
|
|
36 |
# $(call isoneof,fred, alice bob james fred joe) # returns 1
|
|
37 |
define isoneof
|
|
38 |
$(if $2,$(or $(call equal,$1,$(word 1,$2)),$(call isoneof,$(1),$(wordlist 2,$(words $(2)),$(2)))),)
|
|
39 |
endef
|
|
40 |
|
|
41 |
define isoneof_debug
|
|
42 |
$(info one:$1 LIST: $2 nextCAR: $(word 1,$2) nextCDR: $(wordlist 2,$(words $2),$2))$(if $2,$(or $(call equal,$1,$(word 1,$2)),$(call isoneof,$(1),$(wordlist 2,$(words $(2)),$(2)))),)
|
|
43 |
endef
|
|
44 |
|
|
45 |
#testboolean::
|
|
46 |
# @echo -e "(call equal,dll,dll) : $(call equal,dll,dll)"
|
|
47 |
# @echo -e "(call equal,,dll) : $(call equal,,dll)"
|
|
48 |
# @echo -e "(call equal,thingdllthing,dll) : $(call equal,thingdllthing,dll)"
|
|
49 |
# @echo -e "(call equal,dll,thingdllthing) : $(call equal,dll,thingdllthing)"
|
|
50 |
# @echo -e "(call equal,dll,) : $(call equal,dll,)"
|
|
51 |
# @echo -e "(call equal,,) : $(call equal,,)"
|
|
52 |
# @echo -e "(call equal,dlldlldll,dll) : $(call equal,dlldlldll,dll)"
|
|
53 |
# @echo -e "(call equal,dll,dlldlldll) : $(call equal,dll,dlldlldll)"
|
|
54 |
# @echo ""
|
|
55 |
# @echo -e '(call isoneof,fred, nobby cheery fred detritus ) : $(call isoneof,fred, nobby cheery fred detritus) '
|
|
56 |
# @echo -e '(call isoneof,nobby, cheery fred carrot angiur) : $(call isoneof,nobby, cheery fred carrot angiur) '
|
|
57 |
# @echo -e '(call isoneof,vimes,vetinari) : $(call isoneof,vimes,vetinari) '
|
|
58 |
# @echo -e '(call isoneof,vetinari,) : $(call isoneof,vetinari,) '
|
|
59 |
# @echo -e '(call isoneof,vetinari,vetinari) : $(call isoneof,vetinari,vetinari) '
|
|
60 |
|
|
61 |
|