Skip to content

Commit

Permalink
Released v1.1.7 with new set_is_not_member function
Browse files Browse the repository at this point in the history
set_is_not_member is the opposite of set_is_member and was added as a
convenience for a GMSL user.

See https://sourceforge.net/p/gmsl/feature-requests/6/
  • Loading branch information
jgrahamc committed Dec 22, 2014
1 parent 10387bf commit 170fa5f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 10 deletions.
17 changes: 10 additions & 7 deletions __gmsl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
# This is the GNU Make Standard Library version number as a list with
# three items: major, minor, revision

gmsl_version := 1 1 6
gmsl_version := 1 1 7

__gmsl_name := GNU Make Standard Library

Expand Down Expand Up @@ -383,6 +383,11 @@ lc = $(__gmsl_tr1)$(call assert_no_dollar,$0,$1)$(call tr,$([A-Z]),$([a-z]),$1)
# Arguments: 1: A string
# Returns: Returns the length of the string
# ----------------------------------------------------------------------------

# This results in __gmsl_tab containing a tab

__gmsl_tab := #

__gmsl_characters := A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
__gmsl_characters += a b c d e f g h i j k l m n o p q r s t u v w x y z
__gmsl_characters += 0 1 2 3 4 5 6 7 8 9
Expand All @@ -403,10 +408,6 @@ define __gmsl_newline

endef

# This results in __gmsl_tab containing a tab

__gmsl_tab := #

# ----------------------------------------------------------------------------
# Function: substr
# Arguments: 1: A string
Expand Down Expand Up @@ -455,12 +456,14 @@ set_insert = $(__gmsl_tr2)$(sort $1 $2)
set_remove = $(__gmsl_tr2)$(filter-out $1,$2)

# ----------------------------------------------------------------------------
# Function: set_is_member
# Function: set_is_member, set_is_not_member
# Arguments: 1: A single element
# 2: A set
# Returns: Returns $(true) if the element is in the set
# Returns: (set_is_member) Returns $(true) if the element is in the set
# (set_is_not_member) Returns $(false) if the element is in the set
# ----------------------------------------------------------------------------
set_is_member = $(__gmsl_tr2)$(if $(filter $1,$2),$(true),$(false))
set_is_not_member = $(__gmsl_tr2)$(if $(filter $1,$2),$(false),$(true))

# ----------------------------------------------------------------------------
# Function: set_union
Expand Down
2 changes: 1 addition & 1 deletion gmsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# A library of functions to be used with GNU Make's $(call) that
# provides functionality not available in standard GNU Make.
#
# Copyright (c) 2005-2013 John Graham-Cumming
# Copyright (c) 2005-2014 John Graham-Cumming
#
# This file is part of GMSL
#
Expand Down
11 changes: 10 additions & 1 deletion gmsl-tests
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ $(call test_assert,$(call seq, , ),T)
$(call test_assert,$(call seq,, ),)
$(call test_assert,$(call seq, ,),)
$(call test_assert,$(call seq,y,xy),)
$(call test_assert,$(call seq,$(__gmsl_space),$(__gmsl_tab)),)
$(call stop_test)

$(call start_test,sne)
Expand Down Expand Up @@ -286,6 +287,13 @@ $(call test_assert,$(call set_is_member,1,$(call set_create,1 2 3)),T)
$(call test_assert,$(call set_is_member,1,$(call set_create,1)),T)
$(call stop_test)

$(call start_test,set_is_not_member)
$(call test_assert,$(call set_is_not_member,1,$(empty_set)),T)
$(call test_assert,$(call set_is_not_member,1,$(call set_create,2 3)),T)
$(call test_assert,$(call set_is_not_member,1,$(call set_create,1 2 3)),)
$(call test_assert,$(call set_is_not_member,1,$(call set_create,1)),)
$(call stop_test)

$(call start_test,set_union)
$(call test_assert,$(call set_union,,),)
$(call test_assert,$(call set_union,1 2,),1 2)
Expand Down Expand Up @@ -775,7 +783,8 @@ $(call test_assert,$(call gmsl_compatible,1 1 3),$(true))
$(call test_assert,$(call gmsl_compatible,1 1 4),$(true))
$(call test_assert,$(call gmsl_compatible,1 1 5),$(true))
$(call test_assert,$(call gmsl_compatible,1 1 6),$(true))
$(call test_assert,$(call gmsl_compatible,1 1 7),)
$(call test_assert,$(call gmsl_compatible,1 1 7),$(true))
$(call test_assert,$(call gmsl_compatible,1 1 8),)
$(call test_assert,$(call gmsl_compatible,1 2 0),)
$(call test_assert,$(call gmsl_compatible,2 0 0),)
$(call stop_test)
9 changes: 8 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h2>Using GMSL</h2>
you have the right version of <span style="font-family: monospace;">gmsl</span>
use the <span style="font-family: monospace;">gmsl_compatible</span>
function (see
below). The current version is <span style="font-family: monospace;">1 1 6</span>.<br>
below). The current version is <span style="font-family: monospace;">1 1 7</span>.<br>
<br>
The GMSL package also includes a test suite for GMSL.&nbsp; Just run <span style="font-family: monospace;">make -f gmsl-tests</span>.<br>
<h2>Logical Operators</h2>GMSL has boolean $(true) (a non-empty string)
Expand Down Expand Up @@ -250,6 +250,13 @@ <h2>Set Manipulation Functions</h2>
Returns:&nbsp;&nbsp;&nbsp;Returns $(true) if the element is in the set<br>
</span>

<hr><b>set_is_not_member</b><br>
<br>
<span style="font-family: monospace;">Arguments: 1: A single element<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2: A set<br>
Returns:&nbsp;&nbsp;&nbsp;Returns $(false) if the element is in the set<br>
</span>

<hr><b>set_union</b><br>
<br>
<span style="font-family: monospace;">Arguments: 1: A set<br>
Expand Down

0 comments on commit 170fa5f

Please sign in to comment.