This commit is contained in:
Axel Kittenberger 2010-11-13 19:22:05 +00:00
parent c05ba085f6
commit e53f7cc61f
1 changed files with 69 additions and 8 deletions

View File

@ -228,6 +228,7 @@ end)()
-- InletControl is the runners part to control the interface -- InletControl is the runners part to control the interface
-- hidden from the user. -- hidden from the user.
-- --
local getInlet
local Inlet, InletControl = (function() local Inlet, InletControl = (function()
-- lua runner controlled variables -- lua runner controlled variables
local sync local sync
@ -275,6 +276,10 @@ local Inlet, InletControl = (function()
return e2d[event].sync.config return e2d[event].sync.config
end, end,
inlet = function(event)
return getInlet()
end,
----- -----
-- Returns the type of the event. -- Returns the type of the event.
-- Can be: -- Can be:
@ -419,7 +424,21 @@ local Inlet, InletControl = (function()
return f(t) return f(t)
end end
} }
-----
-- adds an exclude.
--
local function addExclude(pattern)
sync:addExclude(pattern)
end
-----
-- removes an exclude.
--
local function rmExclude(pattern)
sync:rmExclude(pattern)
end
----- -----
-- Interface for user scripts to get event fields. -- Interface for user scripts to get event fields.
-- --
@ -624,11 +643,13 @@ local Inlet, InletControl = (function()
-- public interface. -- public interface.
-- this one is split, one for user one for runner. -- this one is split, one for user one for runner.
return { return {
addExclude = addExclude,
createBlanketEvent = createBlanketEvent, createBlanketEvent = createBlanketEvent,
discardEvent = discardEvent, discardEvent = discardEvent,
getEvent = getEvent, getEvent = getEvent,
getEvents = getEvents, getEvents = getEvents,
getConfig = getConfig, getConfig = getConfig,
rmExclude = rmExclude,
}, { }, {
d2e = d2e, d2e = d2e,
dl2el = dl2el, dl2el = dl2el,
@ -639,6 +660,12 @@ local Inlet, InletControl = (function()
} }
end)() end)()
-----
-- Little dirty workaround to retrieve the Inlet from events in Inlet
getInlet = function()
return Inlet
end
----- -----
-- A set of exclude patterns -- A set of exclude patterns
@ -682,6 +709,19 @@ local Excludes = (function()
local lp = toLuaPattern(pattern) local lp = toLuaPattern(pattern)
self.list[pattern] = lp self.list[pattern] = lp
end end
-----
-- Removes a pattern to exclude.
--
local function remove(self, pattern)
if not self.list[pattern] then
-- already in the list
log("Normal", "Removing not excluded exclude '"..pattern.."'")
return
end
self.list[pattern] = nil
end
----- -----
-- Adds a list of patterns to exclude. -- Adds a list of patterns to exclude.
@ -733,10 +773,11 @@ local Excludes = (function()
list = {}, list = {},
-- functions -- functions
add = add, add = add,
adList = addList, adList = addList,
loadFile = loadFile, loadFile = loadFile,
test = test, remove = remove,
test = test,
} }
end end
@ -756,6 +797,20 @@ local Sync = (function()
-- --
local nextDefaultName = 1 local nextDefaultName = 1
-----
-- Adds an exclude.
--
local function addExclude(self, pattern)
return self.excludes:add(pattern)
end
-----
-- Removes an exclude.
--
local function rmExclude(self, pattern)
return self.excludes:remove(pattern)
end
----- -----
-- Removes a delay. -- Removes a delay.
-- --
@ -1135,14 +1190,17 @@ local Sync = (function()
excludes = Excludes.new(), excludes = Excludes.new(),
-- functions -- functions
addBlanketDelay = addBlanketDelay,
addExclude = addExclude,
collect = collect, collect = collect,
delay = delay, delay = delay,
addBlanketDelay = addBlanketDelay,
getAlarm = getAlarm, getAlarm = getAlarm,
getDelays = getDelays, getDelays = getDelays,
getNextDelay = getNextDelay, getNextDelay = getNextDelay,
invokeActions = invokeActions, invokeActions = invokeActions,
removeDelay = removeDelay, removeDelay = removeDelay,
rmExclude = rmExclude,
statusReport = statusReport, statusReport = statusReport,
} }
-- provides a default name if needed -- provides a default name if needed
@ -1251,6 +1309,9 @@ local Syncs = (function()
end end
-- loads a default value for an option if not existent -- loads a default value for an option if not existent
if not settings then
settings = {}
end
local defaultValues = { local defaultValues = {
'action', 'action',
'collapse', 'collapse',