summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLauri Aarnio <Lauri.Aarnio@iki.fi>2009-03-12 15:15:22 +0200
committerLauri Leukkunen <lle@rahina.org>2009-03-18 23:29:20 +0200
commit9c11d8d85b8ed161bdc6c01f406a4b322354b2a8 (patch)
treed221148f703ef8d4ea5002b74ab9ca62cb1963f0
parentb0fa5d08f9841e31d565ba8055ab2d7a413edaa9 (diff)
Fix: Reverse rule generator works now also when next_chain != nil
- Mika Westerberg's last change to the "emulate" mode uses "next_chain"...
-rw-r--r--lua_scripts/create_reverse_rules.lua26
1 files changed, 16 insertions, 10 deletions
diff --git a/lua_scripts/create_reverse_rules.lua b/lua_scripts/create_reverse_rules.lua
index 66a80e9..a209e7d 100644
--- a/lua_scripts/create_reverse_rules.lua
+++ b/lua_scripts/create_reverse_rules.lua
@@ -13,9 +13,6 @@
-- 1. Reverse rules won't be created if the forward rules use "func_name"
-- conditions. It might be possible to fix that, but "func_names" certainly
-- complicate sorting of the generated reversing rules.
---
--- 2. Rule chains with "next_chain" set to something else than 'nil'
--- are not currently supported.
allow_reversing = true -- default = create reverse rules.
reversing_disabled_message = ""
@@ -283,20 +280,29 @@ end
function process_chains(chains_table)
local n
+ -- ensure that all chains have names
for n=1,table.maxn(chains_table) do
+ if chains_table[n].name then
+ chains_table[n].rev_name = string.format(
+ "reverse_chain__%s", chains_table[n].name)
+ else
+ chains_table[n].rev_name = string.format(
+ "reverse_chain_%d", n)
+ end
+ end
+
+ for n=table.maxn(chains_table),1,-1 do
if chains_table[n].noentry then
print("-- ========== ",n)
print("-- noentry")
else
- print(string.format("-- ======= Chain %d =======",n))
- print(string.format("reverse_chain_%d = {",n))
+ print(string.format("-- ======= %s =======",
+ chains_table[n].rev_name))
+ print(string.format("%s = {", chains_table[n].rev_name))
if chains_table[n].next_chain then
- -- FIXME: Handle next_chain!!!
- print(" -- NOTE: next_chain is not nil,")
- print(" -- can't create reversing rules")
- allow_reversing = false
- reversing_disabled_message = "next_chain is not nil"
+ print(string.format(" next_chain=%s,",
+ chains_table[n].next_chain.rev_name))
else
print(" next_chain=nil,")
end