5 |
-- modify it under the terms of the GNU General Public License |
-- modify it under the terms of the GNU General Public License |
6 |
-- as published by the Free Software Foundation; either version 2 |
-- as published by the Free Software Foundation; either version 2 |
7 |
-- of the License, or (at your option) any later version. |
-- of the License, or (at your option) any later version. |
8 |
-- |
-- |
9 |
-- This program is distributed in the hope that it will be useful, |
-- This program is distributed in the hope that it will be useful, |
10 |
-- but WITHOUT ANY WARRANTY; without even the implied warranty of |
-- but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 |
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 |
-- GNU General Public License for more details. |
-- GNU General Public License for more details. |
13 |
-- |
-- |
14 |
-- You should have received a copy of the GNU General Public License along |
-- You should have received a copy of the GNU General Public License along |
15 |
-- with this program; if not, write to the Free Software Foundation, Inc., |
-- with this program; if not, write to the Free Software Foundation, Inc., |
16 |
-- 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. |
-- 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. |
55 |
-- support for parents that do not accept coordinates, default cell key meanings, updates in default |
-- support for parents that do not accept coordinates, default cell key meanings, updates in default |
56 |
-- parent handling, debug mode |
-- parent handling, debug mode |
57 |
-- 2003-03-13 -- several cosmetic changes plus add_multitag, spread_tag, wormholes generator and slope generator |
-- 2003-03-13 -- several cosmetic changes plus add_multitag, spread_tag, wormholes generator and slope generator |
58 |
|
-- 2003-03-21 -- warning may raise error if warning_raises_error is set to 1 (ralf) |
59 |
|
|
60 |
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
61 |
-- MISCELANEOUS - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
-- MISCELANEOUS - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
62 |
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
63 |
-- for warning messages |
-- for warning messages |
64 |
function warning(text) |
function warning(text) |
65 |
print("warning: [ant.lua]: "..text) |
if (warning_raises_error and (warning_raises_error == 1)) then |
66 |
|
error(" [ant.lua]: "..text) |
67 |
|
else |
68 |
|
print("warning: [ant.lua]: "..text) |
69 |
|
end |
70 |
end |
end |
71 |
|
|
72 |
-- for debug messages |
-- for debug messages |
174 |
end |
end |
175 |
|
|
176 |
-- this function tries to guess the width of key based on the most common width of keys in cell[key] |
-- this function tries to guess the width of key based on the most common width of keys in cell[key] |
177 |
-- also there is possibility to get level as argument and try to divide its width by common level widths, |
-- also there is possibility to get level as argument and try to divide its width by common level widths, |
178 |
-- such as 20, 39, ... this way it would be possible to get the value also... |
-- such as 20, 39, ... this way it would be possible to get the value also... |
179 |
-- Anyway, I think first test is better. |
-- Anyway, I think first test is better. |
180 |
function guess_cell_key_width(cellfuncs) |
function guess_cell_key_width(cellfuncs) |
181 |
local funcs = cellfuncs or cells or {} -- hope for a global cells |
local funcs = cellfuncs or cells or {} -- hope for a global cells |
299 |
local xylist = tremove(arg, 1) or {} |
local xylist = tremove(arg, 1) or {} |
300 |
local ret = nil |
local ret = nil |
301 |
|
|
302 |
-- first, get rid of cell(x,y) notation and convert it to cell({{x0,y0}}) notation |
-- first, get rid of cell(x,y) notation and convert it to cell({{x0,y0}}) notation |
303 |
local xtp = type(xylist); |
local xtp = type(xylist); |
304 |
if (xtp=="number") then |
if (xtp=="number") then |
305 |
xylist = {{xylist,tremove(arg,1)}} |
xylist = {{xylist,tremove(arg,1)}} |