diff --git a/.gitignore b/.gitignore index 9c709e8..e201960 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,14 @@ UCD.*/ ucd/ ucd.*/ *.dll + +lua-utf8.so +lua-utf8.so.* +luautf8-*.zip +luautf8-*.rock + +*.gcov +*.gcda +*.gcno + +test_*.lua diff --git a/parseucd.lua b/parseucd.lua index cc0757a..171fee2 100644 --- a/parseucd.lua +++ b/parseucd.lua @@ -5,7 +5,7 @@ -- - UCD\EastAsianWidth.txt -- - UCD\PropList.txt -- - UCD\UnicodeData.txt --- +-- -- files can be downloaded at: http://unicode.org/Public/UCD/latest/UCD/ @@ -15,7 +15,7 @@ local function parse_UnicodeData() -- 1. name -- 2. general category -- 3. canonical combining class - -- 4. bidi class + -- 4. bidi class -- 5. decomposition type/mapping -- 6. numberic type/value -- 7. numberic type/value @@ -81,8 +81,8 @@ local function parse_EastAsianWidth() assert(first, line) end - local first = tonumber(first, 16) - local last = tonumber(last, 16) + first = tonumber(first, 16) + last = tonumber(last, 16) if mark == 'W' or mark == 'F' then for i = first, last do @@ -139,8 +139,8 @@ local function parse_PropList(f) assert(first, line) end - local first = tonumber(first, 16) - local last = tonumber(last, 16) + first = tonumber(first, 16) + last = tonumber(last, 16) if f(mark) then for i = first, last do @@ -157,7 +157,7 @@ local function parse_PropList(f) return ranges, lookup end -local function get_ranges(list, func, proc) +local function get_ranges(list, func) local first, last, step, offset local ranges = {} for i = 1, #list do @@ -165,7 +165,7 @@ local function get_ranges(list, func, proc) local v = list[i] local res = not func or func(v) if type(v) == 'number' then - v_cp, v_offset = v + v_cp, v_offset = v, nil elseif v.cp then v_cp, v_offset = v.cp, v.offset end @@ -180,7 +180,7 @@ local function get_ranges(list, func, proc) local r = { first = first, last = last, step = step, offset = offset } ranges[#ranges+1] = r end - first, last, step = v_cp, v_cp + first, last, step = v_cp, v_cp, nil offset = v_offset end end @@ -192,6 +192,7 @@ local function get_ranges(list, func, proc) return ranges end +--[[ local function merge_ranges(...) local ranges = {} local lookup = {} @@ -238,6 +239,7 @@ local function diff_ranges(base, sub, force) end return get_ranges(ranges) end +--]] local function write_ranges(name, ranges) io.write("static struct range_table "..name.."_table[] = {\n") diff --git a/rockspecs/luautf8-0.1.2-2.rockspec b/rockspecs/luautf8-0.1.2-2.rockspec new file mode 100644 index 0000000..574ccda --- /dev/null +++ b/rockspecs/luautf8-0.1.2-2.rockspec @@ -0,0 +1,23 @@ +package = "luautf8" +version = "0.1.2-2" +source = { + url = "https://github.com/starwing/luautf8/archive/0.1.2.tar.gz", + dir = "luautf8-0.1.2" +} +description = { + summary = "A UTF-8 support module for Lua", + detailed = [[ + This module adds UTF-8 support to Lua. It's compatible with Lua "string" module. + ]], + homepage = "http://github.com/starwing/luautf8", + license = "MIT" +} +dependencies = { + "lua >= 5.1" +} +build = { + type = "builtin", + modules = { + ["lua-utf8"] = "lutf8lib.c" + } +} diff --git a/rockspecs/luautf8-0.1.3-1.rockspec b/rockspecs/luautf8-0.1.3-1.rockspec new file mode 100644 index 0000000..65ed2f1 --- /dev/null +++ b/rockspecs/luautf8-0.1.3-1.rockspec @@ -0,0 +1,23 @@ +package = "luautf8" +version = "0.1.3-1" +source = { + url = "https://github.com/starwing/luautf8/archive/0.1.3.tar.gz", + dir = "luautf8-0.1.3" +} +description = { + summary = "A UTF-8 support module for Lua", + detailed = [[ + This module adds UTF-8 support to Lua. It's compatible with Lua "string" module. +]], + homepage = "http://github.com/starwing/luautf8", + license = "MIT" +} +dependencies = { + "lua >= 5.1" +} +build = { + type = "builtin", + modules = { + ["lua-utf8"] = "lutf8lib.c" + } +}