Chat-O-Matic/build/jam/HelperRules

53 lines
989 B
Plaintext
Raw Normal View History

# HelperRules
#
# Helper rules without side effects.
rule FFilter
{
# FFilter <list> : <excludes> ;
#
# Removes all occurrences of <excludes> in <list>.
local list = $(1) ;
local excludes = $(2) ;
local newList ;
local item ;
for item in $(list) {
local skip ;
local exclude ;
for exclude in $(excludes) {
if $(item) = $(exclude) {
skip = true ;
}
}
if ! $(skip) {
newList += $(item) ;
}
}
return $(newList) ;
}
rule FSplitPath
{
# FSplitPath <path> ;
#
# Decomposes a path into its components.
#
# <path>: The path to be decomposed.
#
local path = $(1:G=) ;
local components ;
# $(path:D) for "/" is "/". Therefore the second condition.
while $(path:D) && $(path:D) != $(path)
{
# Note: $(path:B) returns "." for "..", but $(path:D=) is fine.
components = $(path:D=) $(components) ;
path = $(path:D) ;
}
components = $(components) ;
# Use this to return initial /
#components = $(path) $(components) ;
return $(components) ;
}