diff --git a/.gitmodules b/.gitmodules index ead63e79f..45ae3eaf5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,3 +10,6 @@ [submodule "kpvcrlib/crengine"] path = kpvcrlib/crengine url = git://crengine.git.sourceforge.net/gitroot/crengine/crengine +[submodule "luajit-2.0"] + path = luajit-2.0 + url = http://luajit.org/git/luajit-2.0.git diff --git a/Makefile b/Makefile index 66adfe5f4..b3670e5ac 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # you can probably leave these settings alone: -LUADIR=lua +LUADIR=luajit-2.0 MUPDFDIR=mupdf MUPDFTARGET=build/debug MUPDFLIBDIR=$(MUPDFDIR)/$(MUPDFTARGET) @@ -82,7 +82,7 @@ THIRDPARTYLIBS := $(MUPDFLIBDIR)/libfreetype.a \ #$(MUPDFLIBDIR)/libjpeg.a \ #$(CRENGINEDIR)/thirdparty/libjpeg/libjpeg.a \ -LUALIB := $(LUADIR)/src/liblua.a +LUALIB := $(LUADIR)/src/libluajit.a all:kpdfview @@ -127,9 +127,9 @@ lfs.o: $(LFSDIR)/src/lfs.c $(CC) -c $(CFLAGS) -I$(LUADIR)/src -I$(LFSDIR)/src $(LFSDIR)/src/lfs.c -o $@ fetchthirdparty: - -rm -Rf lua lua-5.1.4 -rm -Rf mupdf/thirdparty test -d mupdf && (cd mupdf; git checkout .) || echo warn: mupdf folder not found + test -d $(LUADIR) && (cd $(LUADIR); git checkout .) || echo warn: $(LUADIR) folder not found git submodule init git submodule update ln -sf kpvcrlib/crengine/cr3gui/data data @@ -149,8 +149,6 @@ fetchthirdparty: patch -N -p0 < ../../../kpvcrlib/jpeg_decompress_struct_size.patch # MuPDF patch: use external fonts cd mupdf && patch -N -p1 < ../mupdf.patch - test -f lua-5.1.4.tar.gz || wget http://www.lua.org/ftp/lua-5.1.4.tar.gz - tar xvzf lua-5.1.4.tar.gz && ln -s lua-5.1.4 lua clean: -rm -f *.o kpdfview slider_watcher @@ -196,7 +194,11 @@ $(CRENGINELIBS): make $(LUALIB): - make -C lua/src CC="$(CC)" CFLAGS="$(CFLAGS)" MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E" liblua.a +ifdef EMULATE_READER + make -C $(LUADIR) +else + make -C $(LUADIR) HOST_CC="$(HOSTCC) -m32" CROSS="$(HOST)-" TARGET_FLAGS="$(SYSROOT) -DLUAJIT_NO_LOG2 -DLUAJIT_NO_EXP2" +endif thirdparty: $(MUPDFLIBS) $(THIRDPARTYLIBS) $(LUALIB) $(DJVULIBS) $(CRENGINELIBS) diff --git a/crereader.lua b/crereader.lua index d85dab3c8..6ce3e111c 100644 --- a/crereader.lua +++ b/crereader.lua @@ -335,7 +335,7 @@ function CREReader:_drawReadingInfo() cur_section = "Section: "..cur_section end -- NuPogodi 15.05.12: Rewrite the following renderUtf8Text() in order to fix too long strings - local footer = "Position: "..load_percent.."\%".." "..cur_section + local footer = "Position: "..load_percent.."%".." "..cur_section if sizeUtf8Text(10, fb.bb:getWidth(), face, footer, true).x < (fb.bb:getWidth() - 20) then renderUtf8Text(fb.bb, 10, ypos+6, face, footer, true) else @@ -408,7 +408,7 @@ function CREReader:adjustCreReaderCommands() self.line_space_percent = self.line_space_percent + 10 self.line_space_percent = math.min(self.line_space_percent, 200) end - InfoMessage:show("line spacing "..self.line_space_percent.."\%", 0) + InfoMessage:show("line spacing "..self.line_space_percent.."%", 0) debug("line spacing set to", self.line_space_percent) -- NuPogodi, 15.05.12: storing old document height self.old_doc_height = self.doc:getFullHeight() diff --git a/filechooser.lua b/filechooser.lua index 185879097..7dc91bac7 100644 --- a/filechooser.lua +++ b/filechooser.lua @@ -52,7 +52,7 @@ end function BatteryLevel() local fn, battery = "./data/temporary", "?" -- NuPogodi, 18.05.12: This command seems to work even without Amazon Kindle framework - os.execute("\(gasgauge-info ".."-s\) ".."> "..fn) + os.execute("(gasgauge-info ".."-s) ".."> "..fn) if io.open(fn,"r") then for lines in io.lines(fn) do battery = " " .. lines end else diff --git a/fileinfo.lua b/fileinfo.lua index aee24d955..e00556f94 100644 --- a/fileinfo.lua +++ b/fileinfo.lua @@ -34,9 +34,9 @@ function FileInfo:FileSize(size) if size < 1024 then return size.." Bytes" elseif size < 2^20 then - return string.format("%.2f", size/2^10).."KB \("..size.." Bytes\)" + return string.format("%.2f", size/2^10).."KB ("..size.." Bytes)" else - return string.format("%.2f", size/2^20).."MB \("..size.." Bytes\)" + return string.format("%.2f", size/2^20).."MB ("..size.." Bytes)" end end -- end of changes (NuPogodi, 26.05.12) @@ -87,9 +87,9 @@ function FileInfo:init(path,fname) info_entry = {dir = "Last Read", name = FileInfo:FileCreated(history,"change")} table.insert(self.result, info_entry) local file_type = string.lower(string.match(self.pathfile, ".+%.([^.]+)")) - local to_search, add, factor = "\[\"last_percent\"\]", "\%", 100 + local to_search, add, factor = "[\"last_percent\"]", "%", 100 if ext:getReader(file_type) ~= CREReader then - to_search = "\[\"last_page\"\]" + to_search = "[\"last_page\"]" add = " pages" factor = 1 end diff --git a/inputbox.lua b/inputbox.lua index 904333428..518cf5327 100644 --- a/inputbox.lua +++ b/inputbox.lua @@ -193,11 +193,11 @@ function InputBox:setLayoutsTable() { KEY_W, "W", "w", "2", "?", "Ж", "ж", "2", "?", }, { KEY_E, "E", "e", "3", "#", "Е", "е", "3", "«", }, { KEY_R, "R", "r", "4", "@", "Р", "р", "4", "»", }, - { KEY_T, "T", "t", "5", "\%", "Т", "т", "5", ":", }, + { KEY_T, "T", "t", "5", "%", "Т", "т", "5", ":", }, { KEY_Y, "Y", "y", "6", "‰", "Ы", "ы", "6", ";", }, { KEY_U, "U", "u", "7", "\'", "У", "у", "7", "~", }, - { KEY_I, "I", "i", "8", "`", "И", "и", "8", "\(",}, - { KEY_O, "O", "o", "9", ":", "О", "о", "9", "\)",}, + { KEY_I, "I", "i", "8", "`", "И", "и", "8", "(",}, + { KEY_O, "O", "o", "9", ":", "О", "о", "9", ")",}, { KEY_P, "P", "p", "0", ";", "П", "п", "0", "=", }, -- middle raw { KEY_A, "A", "a", "+", "…", "А", "а", "Ш", "ш", }, @@ -210,12 +210,12 @@ function InputBox:setLayoutsTable() { KEY_K, "K", "k", "ˆ", "\"", "К", "к", "Ќ", "ќ", }, { KEY_L, "L", "l", ">", "~", "Л", "л", "Љ", "љ", }, -- lowest raw - { KEY_Z, "Z", "z", "\(", "$", "З", "з", "Щ", "щ", }, - { KEY_X, "X", "x", "\)", "€", "Х", "х", "№", "@", }, - { KEY_C, "C", "c", "\{", "¥", "Ц", "ц", "Џ", "џ", }, - { KEY_V, "V", "v", "\}", "£", "В", "в", "Ў", "ў", }, - { KEY_B, "B", "b", "\[", "‚", "Б", "б", "Ћ", "ћ", }, - { KEY_N, "N", "n", "\]", "‘", "Н", "н", "Њ", "њ", }, + { KEY_Z, "Z", "z", "(", "$", "З", "з", "Щ", "щ", }, + { KEY_X, "X", "x", ")", "€", "Х", "х", "№", "@", }, + { KEY_C, "C", "c", "{", "¥", "Ц", "ц", "Џ", "џ", }, + { KEY_V, "V", "v", "}", "£", "В", "в", "Ў", "ў", }, + { KEY_B, "B", "b", "[", "‚", "Б", "б", "Ћ", "ћ", }, + { KEY_N, "N", "n", "]", "‘", "Н", "н", "Њ", "њ", }, { KEY_M, "M", "m", "&", "’", "М", "м", "Ї", "ї", }, { KEY_DOT, ".", ",", ".", ",", ".", ",", "Є", "є", }, -- Let us make key 'Space' the same for all layouts diff --git a/luajit-2.0 b/luajit-2.0 new file mode 160000 index 000000000..5bd133d6c --- /dev/null +++ b/luajit-2.0 @@ -0,0 +1 @@ +Subproject commit 5bd133d6c89fb9ef5c501eb27d2d6221ec44d11d diff --git a/mupdfimg.c b/mupdfimg.c index dcda3e8fa..fe14e5ad6 100644 --- a/mupdfimg.c +++ b/mupdfimg.c @@ -53,6 +53,7 @@ static int loadPNGData(lua_State *L) { fz_catch(img->context) { return luaL_error(L, "cannot load PNG data"); } + return 0; } static int loadJPEGData(lua_State *L) { @@ -65,6 +66,7 @@ static int loadJPEGData(lua_State *L) { fz_catch(img->context) { return luaL_error(L, "cannot open JPEG data"); } + return 0; } static int toBlitBuffer(lua_State *L) { diff --git a/rendertext.lua b/rendertext.lua index 2505173e4..c63d15381 100644 --- a/rendertext.lua +++ b/rendertext.lua @@ -145,7 +145,7 @@ function SplitString(text) local words = {} local word = "" for uchar in string.gfind(text, "([%z\1-\127\194-\244][\128-\191]*)") do - if uchar == "/" or uchar == " " or uchar == "-" or uchar == "_" or uchar == "\." then + if uchar == "/" or uchar == " " or uchar == "-" or uchar == "_" or uchar == "." then words[#words+1] = word .. uchar word = "" else diff --git a/settings.lua b/settings.lua index e5e4204ea..bd2bd4c69 100644 --- a/settings.lua +++ b/settings.lua @@ -9,7 +9,7 @@ function DocToHistory(fullname) j = i end local f = string.sub(fullname,j+1,-1) - if j>0 then return "./history/\["..string.gsub(string.sub(fullname,1,j),"/","#").."\] "..f..".lua" + if j>0 then return "./history/["..string.gsub(string.sub(fullname,1,j),"/","#").."] "..f..".lua" else return "./settings"..f..".lua" end end