diff --git a/api/mpi/luawriter.py b/api/mpi/luawriter.py index 296d32bb..aa583b63 100644 --- a/api/mpi/luawriter.py +++ b/api/mpi/luawriter.py @@ -438,7 +438,8 @@ static void *%(func)s (void) all_method_cfuncs[cls.name] = method_cfuncs all_static_method_cfuncs[cls.short_name] = static_method_cfuncs - dic = dict(module=module.name.lower()) + package_name=module.name.lower() + dic = dict(module=module.name.lower(), package_name=package_name) all_func_cfuncs = [] @@ -468,11 +469,11 @@ static void *%(func)s (void) self.__write_register_module(module, all_method_cfuncs) self.out.write("""\ -void %(module)s_lua_api_add_to_lua (lua_State *L, const char *package_name) +void %(module)s_lua_api_add_to_lua (lua_State *L) { %(module)s_lua_api_register (); - luaL_register (L, package_name, %(module)s_lua_functions); + luaL_register (L, "%(package_name)s", %(module)s_lua_functions); """ % dic) @@ -480,11 +481,11 @@ void %(module)s_lua_api_add_to_lua (lua_State *L, const char *package_name) cfuncs = all_static_method_cfuncs[cls_name] if not cfuncs: continue - self.out.write(' moo_lua_register_static_methods (L, package_name, "%s", %s_lua_functions);\n' % (cls_name, cls_name)) + self.out.write(' moo_lua_register_static_methods (L, "%s", "%s", %s_lua_functions);\n' % (package_name, cls_name, cls_name)) self.out.write('\n') for enum in module.get_enums(): - self.out.write(' moo_lua_register_enum (L, package_name, %s, "%s");\n' % (enum.gtype_id, module.name.upper() + '_')) + self.out.write(' moo_lua_register_enum (L, "%s", %s, "%s");\n' % (package_name, enum.gtype_id, module.name.upper() + '_')) self.out.write("}\n") diff --git a/doc/Makefile.am b/doc/Makefile.am index c98320d8..06077ae5 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -134,12 +134,16 @@ endif EXTRA_DIST = help built/moo-help-sections.h built/medit.1 install-data-local: - $(MKDIR_P) $(DESTDIR)$(MOO_HELP_DIR)/img + $(MKDIR_P) $(DESTDIR)$(MOO_HELP_DIR)/img $(DESTDIR)$(MOO_HELP_DIR)/script cd $(srcdir) && $(INSTALL_DATA) help/*.html help/*.css $(DESTDIR)$(MOO_HELP_DIR) + cd $(srcdir) && $(INSTALL_DATA) help/script/*.html $(DESTDIR)$(MOO_HELP_DIR)/script cd $(srcdir) && $(INSTALL_DATA) help/img/*.png $(DESTDIR)$(MOO_HELP_DIR)/img uninstall-local: - rm -f $(DESTDIR)$(MOO_HELP_DIR)/*.html $(DESTDIR)$(MOO_HELP_DIR)/*.css $(DESTDIR)$(MOO_HELP_DIR)/img/*.png + rm -f $(DESTDIR)$(MOO_HELP_DIR)/*.html \ + $(DESTDIR)$(MOO_HELP_DIR)/*.css \ + $(DESTDIR)$(MOO_HELP_DIR)/script/*.html \ + $(DESTDIR)$(MOO_HELP_DIR)/img/*.png if MOO_OS_UNIX dist_man_MANS = built/medit.1 diff --git a/doc/script-lua-gtk.tmpl.docbook b/doc/script-lua-gtk.tmpl.docbook index 7d58b684..685bf5b2 100644 --- a/doc/script-lua-gtk.tmpl.docbook +++ b/doc/script-lua-gtk.tmpl.docbook @@ -4,6 +4,7 @@ %medit-defines; ]> + &medit; Gtk API for Lua scripts Introduction diff --git a/doc/script-lua.tmpl.docbook b/doc/script-lua.tmpl.docbook index 6409b768..19a8cc19 100644 --- a/doc/script-lua.tmpl.docbook +++ b/doc/script-lua.tmpl.docbook @@ -4,6 +4,7 @@ %medit-defines; ]> + &medit; Lua API diff --git a/doc/script-python.tmpl.docbook b/doc/script-python.tmpl.docbook index 5200f73f..3586fb8d 100644 --- a/doc/script-python.tmpl.docbook +++ b/doc/script-python.tmpl.docbook @@ -4,6 +4,7 @@ %medit-defines; ]> + &medit; Python API Introduction diff --git a/doc/user-tools.docbook b/doc/user-tools.docbook index b7ab5f21..093d32d8 100644 --- a/doc/user-tools.docbook +++ b/doc/user-tools.docbook @@ -384,10 +384,10 @@ or scripts into DATA_DIR/scripts/ to be used Lua scripts -Medit API for Lua scripts. +Medit API for Lua scripts. -Gtk API for Lua scripts. +Gtk API for Lua scripts. @@ -397,7 +397,7 @@ or scripts into DATA_DIR/scripts/ to be used Python scripts -Medit API for Python scripts. +Medit API for Python scripts. diff --git a/moo/medit-app/data/test-lua/lua/munit.lua b/moo/medit-app/data/test-lua/lua/munit.lua index 7a2eb671..4f47bf65 100644 --- a/moo/medit-app/data/test-lua/lua/munit.lua +++ b/moo/medit-app/data/test-lua/lua/munit.lua @@ -1,4 +1,4 @@ -local medit = require("medit") +local moo = require("moo") local function _tassert(cond, msg, ...) local info = debug.getinfo(3, "Slf") @@ -8,9 +8,9 @@ local function _tassert(cond, msg, ...) if name then message = string.format('in function %s: %s', name, message) end - medit.test_assert_impl(false, message, info.short_src, info.currentline) + moo.test_assert_impl(false, message, info.short_src, info.currentline) else - medit.test_assert_impl(true, '', info.short_src, info.currentline) + moo.test_assert_impl(true, '', info.short_src, info.currentline) end end diff --git a/moo/medit-app/data/test-lua/testgfile.lua b/moo/medit-app/data/test-lua/testgfile.lua index ca008e6b..447fb48f 100644 --- a/moo/medit-app/data/test-lua/testgfile.lua +++ b/moo/medit-app/data/test-lua/testgfile.lua @@ -1,8 +1,5 @@ --- -%- indent-width:2 -%- -- - require("munit") -require("gtk") -os = require("moo.os") +os = require("_moo.os") if os.name == 'nt' then name1 = 'c:\\tmp\\foo' diff --git a/moo/medit-app/data/test-lua/testlineends.lua b/moo/medit-app/data/test-lua/testlineends.lua index 218d2589..40b0ed3a 100644 --- a/moo/medit-app/data/test-lua/testlineends.lua +++ b/moo/medit-app/data/test-lua/testlineends.lua @@ -1,20 +1,18 @@ require("munit") -require("medit") -require("gtk") -require("moo.os") +require("_moo.os") -editor = medit.Editor.instance() +editor = moo.Editor.instance() -tassert(medit.LE_NATIVE ~= nil) -tassert(medit.LE_UNIX ~= nil) -tassert(medit.LE_WIN32 ~= nil) -tassert(moo.os.name == 'nt' or medit.LE_NATIVE ~= medit.LE_WIN32) -tassert(moo.os.name ~= 'nt' or medit.LE_NATIVE == medit.LE_WIN32) +tassert(moo.LE_NATIVE ~= nil) +tassert(moo.LE_UNIX ~= nil) +tassert(moo.LE_WIN32 ~= nil) +tassert(_moo.os.name == 'nt' or moo.LE_NATIVE ~= moo.LE_WIN32) +tassert(_moo.os.name ~= 'nt' or moo.LE_NATIVE == moo.LE_WIN32) text_unix = 'line1\nline2\nline3\n' text_win32 = 'line1\r\nline2\r\nline3\r\n' text_mix = 'line1\nline2\r\nline3\r\n' -if moo.os.name == 'nt' then +if _moo.os.name == 'nt' then text_native = text_win32 else text_native = text_unix @@ -35,80 +33,80 @@ end function test_default() doc = editor.new_doc() - filename = medit.tempnam() - tassert(doc.get_line_end_type() == medit.LE_NATIVE) + filename = moo.tempnam() + tassert(doc.get_line_end_type() == moo.LE_NATIVE) doc.set_text(text_unix) - tassert(doc.save_as(medit.SaveInfo.new_path(filename))) + tassert(doc.save_as(moo.SaveInfo.new_path(filename))) tassert(read_file(filename) == text_native) - tassert(doc.get_line_end_type() == medit.LE_NATIVE) + tassert(doc.get_line_end_type() == moo.LE_NATIVE) doc.set_text(text_win32) - tassert(doc.save_as(medit.SaveInfo.new_path(filename))) + tassert(doc.save_as(moo.SaveInfo.new_path(filename))) tassert(read_file(filename) == text_native) - tassert(doc.get_line_end_type() == medit.LE_NATIVE) + tassert(doc.get_line_end_type() == moo.LE_NATIVE) doc.set_modified(false) editor.close_doc(doc) end function test_set() doc = editor.new_doc() - filename = medit.tempnam() + filename = moo.tempnam() - tassert(doc.get_line_end_type() == medit.LE_NATIVE) + tassert(doc.get_line_end_type() == moo.LE_NATIVE) doc.set_text(text_unix) - tassert(doc.save_as(medit.SaveInfo.new_path(filename))) + tassert(doc.save_as(moo.SaveInfo.new_path(filename))) tassert(read_file(filename) == text_native) - tassert(doc.get_line_end_type() == medit.LE_NATIVE) + tassert(doc.get_line_end_type() == moo.LE_NATIVE) - doc.set_line_end_type(medit.LE_UNIX) - tassert(doc.get_line_end_type() == medit.LE_UNIX) - tassert(doc.save_as(medit.SaveInfo.new_path(filename))) + doc.set_line_end_type(moo.LE_UNIX) + tassert(doc.get_line_end_type() == moo.LE_UNIX) + tassert(doc.save_as(moo.SaveInfo.new_path(filename))) tassert(read_file(filename) == text_unix) - tassert(doc.get_line_end_type() == medit.LE_UNIX) + tassert(doc.get_line_end_type() == moo.LE_UNIX) - doc.set_line_end_type(medit.LE_WIN32) - tassert(doc.get_line_end_type() == medit.LE_WIN32) - tassert(doc.save_as(medit.SaveInfo.new_path(filename))) + doc.set_line_end_type(moo.LE_WIN32) + tassert(doc.get_line_end_type() == moo.LE_WIN32) + tassert(doc.save_as(moo.SaveInfo.new_path(filename))) tassert(read_file(filename) == text_win32) - tassert(doc.get_line_end_type() == medit.LE_WIN32) + tassert(doc.get_line_end_type() == moo.LE_WIN32) doc.set_modified(false) editor.close_doc(doc) end function test_load() - filename = medit.tempnam() + filename = moo.tempnam() save_file(filename, text_unix) - doc = editor.open_file(medit.OpenInfo.new_path(filename)) + doc = editor.open_file(moo.OpenInfo.new_path(filename)) tassert(doc.get_filename() == filename) - tassert(doc.get_line_end_type() == medit.LE_UNIX) + tassert(doc.get_line_end_type() == moo.LE_UNIX) doc.close() save_file(filename, text_win32) - doc = editor.open_file(medit.OpenInfo.new_path(filename)) + doc = editor.open_file(moo.OpenInfo.new_path(filename)) tassert(doc.get_filename() == filename) - tassert(doc.get_line_end_type() == medit.LE_WIN32) + tassert(doc.get_line_end_type() == moo.LE_WIN32) doc.close() end function test_mix() - filename = medit.tempnam() + filename = moo.tempnam() save_file(filename, text_mix) - doc = editor.open_file(medit.OpenInfo.new_path(filename)) + doc = editor.open_file(moo.OpenInfo.new_path(filename)) tassert(doc.get_filename() == filename) - tassert(doc.get_line_end_type() == medit.LE_NATIVE) + tassert(doc.get_line_end_type() == moo.LE_NATIVE) tassert(doc.save()) - tassert(doc.get_line_end_type() == medit.LE_NATIVE) + tassert(doc.get_line_end_type() == moo.LE_NATIVE) tassert(read_file(filename) == text_unix) save_file(filename, text_mix) tassert(doc.reload()) - tassert(doc.get_line_end_type() == medit.LE_NATIVE) - doc.set_line_end_type(medit.LE_WIN32) + tassert(doc.get_line_end_type() == moo.LE_NATIVE) + doc.set_line_end_type(moo.LE_WIN32) tassert(doc.save()) - tassert(doc.get_line_end_type() == medit.LE_WIN32) + tassert(doc.get_line_end_type() == moo.LE_WIN32) tassert(read_file(filename) == text_win32) doc.close() diff --git a/moo/medit-app/data/test-lua/testmedit.lua b/moo/medit-app/data/test-lua/testmedit.lua index 44af3d06..0268467d 100644 --- a/moo/medit-app/data/test-lua/testmedit.lua +++ b/moo/medit-app/data/test-lua/testmedit.lua @@ -1,10 +1,7 @@ --- -%- indent-width:2 -%- -- - require("munit") -require("medit") -require("moo.os") +require("_moo.os") -app = medit.App.instance() +app = moo.App.instance() editor = app.get_editor() local __docs_to_cleanup = {} @@ -27,11 +24,11 @@ local function test_active_window() tassert(w1 ~= w2, 'old window != new window') tassert(#editor.get_windows() == 2, 'two window') editor.set_active_window(w2) - medit.spin_main_loop(0.1) + moo.spin_main_loop(0.1) tassert(w2 == editor.get_active_window(), 'w2 == editor.get_active_window()') - if moo.os.name == 'posix' then + if _moo.os.name == 'posix' then editor.set_active_window(w1) - medit.spin_main_loop(0.1) + moo.spin_main_loop(0.1) tassert(w1 == editor.get_active_window(), 'w1 == editor.get_active_window()') end editor.close_window(w1) diff --git a/moo/medit-app/data/test-lua/testmoo.lua b/moo/medit-app/data/test-lua/testmoo.lua index 7ce805a1..42f89cb3 100644 --- a/moo/medit-app/data/test-lua/testmoo.lua +++ b/moo/medit-app/data/test-lua/testmoo.lua @@ -1,9 +1,5 @@ --- -%- indent-width:2 -%- -- - require("munit") -require("moo.builtin")._inject(_G) - function to_list(t) local l = {} for k, v in pairs(t) do diff --git a/moo/medit-app/data/test-lua/testmooeditor.lua b/moo/medit-app/data/test-lua/testmooeditor.lua index 023638d8..6a5362e5 100644 --- a/moo/medit-app/data/test-lua/testmooeditor.lua +++ b/moo/medit-app/data/test-lua/testmooeditor.lua @@ -1,35 +1,33 @@ require("munit") -require("medit") -require("gtk") -editor = medit.Editor.instance() +editor = moo.Editor.instance() -tassert(medit.CLOSE_RESPONSE_CANCEL ~= nil) -tassert(medit.CLOSE_RESPONSE_CONTINUE ~= nil) +tassert(moo.CLOSE_RESPONSE_CANCEL ~= nil) +tassert(moo.CLOSE_RESPONSE_CONTINUE ~= nil) function check_args_ew(editor, window) - tassert(editor == medit.Editor.instance()) + tassert(editor == moo.Editor.instance()) tassert(editor == window.get_editor()) window.get_tabs() end function check_args_ed(editor, doc) - tassert(editor == medit.Editor.instance()) + tassert(editor == moo.Editor.instance()) tassert(editor == doc.get_editor()) doc.get_display_basename() end function check_args_w(window) - tassert(medit.Editor.instance() == window.get_editor()) + tassert(moo.Editor.instance() == window.get_editor()) window.get_tabs() end function check_args_e(editor) - tassert(medit.Editor.instance() == editor) + tassert(moo.Editor.instance() == editor) end function check_args_d(doc) - tassert(medit.Editor.instance() == doc.get_editor()) + tassert(moo.Editor.instance() == doc.get_editor()) doc.get_display_basename() end @@ -82,7 +80,7 @@ function test_before_close_window() function(editor, window) check_args_ew(editor, window) seen_editor_before_close_window = seen_editor_before_close_window + 1 - return medit.CLOSE_RESPONSE_CANCEL + return moo.CLOSE_RESPONSE_CANCEL end) window = editor.new_window() @@ -98,7 +96,7 @@ function test_before_close_window() function(window) check_args_w(window) seen_window_before_close = seen_window_before_close + 1 - return medit.CLOSE_RESPONSE_CANCEL + return moo.CLOSE_RESPONSE_CANCEL end) tassert(not editor.close_window(window)) @@ -114,14 +112,14 @@ function test_before_close_window() function(editor, window) check_args_ew(editor, window) seen_editor_before_close_window = seen_editor_before_close_window + 1 - return medit.CLOSE_RESPONSE_CONTINUE + return moo.CLOSE_RESPONSE_CONTINUE end) window.connect('before-close', function(window) check_args_w(window) seen_window_before_close = seen_window_before_close + 1 - return medit.CLOSE_RESPONSE_CONTINUE + return moo.CLOSE_RESPONSE_CONTINUE end) tassert(window.close()) @@ -170,9 +168,9 @@ function test_bad_callback() tassert(cb_id1 ~= nil and cb_id1 ~= 0) tassert(cb_id2 ~= nil and cb_id2 ~= 0) - was_silent = medit.test_set_silent_messages(true) + was_silent = moo.test_set_silent_messages(true) tassert(editor.close_window(window)) - medit.test_set_silent_messages(was_silent) + moo.test_set_silent_messages(was_silent) tassert(n_callbacks == 6) @@ -181,8 +179,8 @@ function test_bad_callback() end function test_will_save() - path = medit.tempnam() - si = medit.SaveInfo.new_path(path) + path = moo.tempnam() + si = moo.SaveInfo.new_path(path) doc = editor.new_doc() doc.set_modified(true) @@ -279,12 +277,12 @@ function test_before_save() check_args_ed(editor, doc) check_args_f(gfile) seen_editor_before_save = seen_editor_before_save + 1 - return medit.SAVE_RESPONSE_CANCEL + return moo.SAVE_RESPONSE_CANCEL end) doc = editor.new_doc() - path = medit.tempnam() - si = medit.SaveInfo.new_path(path) + path = moo.tempnam() + si = moo.SaveInfo.new_path(path) tassert(not editor.save_as(doc, si)) tassert(seen_editor_before_save == 1) @@ -298,7 +296,7 @@ function test_before_save() check_args_d(doc) check_args_f(gfile) seen_doc_before_save = seen_doc_before_save + 1 - return medit.SAVE_RESPONSE_CANCEL + return moo.SAVE_RESPONSE_CANCEL end) tassert(not editor.save_as(doc, si)) @@ -315,7 +313,7 @@ function test_before_save() check_args_ed(editor, doc) check_args_f(gfile) seen_editor_before_save = seen_editor_before_save + 1 - return medit.SAVE_RESPONSE_CONTINUE + return moo.SAVE_RESPONSE_CONTINUE end) doc.connect('before-save', @@ -323,7 +321,7 @@ function test_before_save() check_args_d(doc) check_args_f(gfile) seen_doc_before_save = seen_doc_before_save + 1 - return medit.SAVE_RESPONSE_CONTINUE + return moo.SAVE_RESPONSE_CONTINUE end) tassert(doc.save_as(si)) @@ -340,13 +338,13 @@ function test_before_save() end test_will_close_window() --- medit.spin_main_loop(0.1) +-- moo.spin_main_loop(0.1) test_before_close_window() --- medit.spin_main_loop(0.1) +-- moo.spin_main_loop(0.1) test_bad_callback() --- medit.spin_main_loop(0.1) +-- moo.spin_main_loop(0.1) test_will_save() --- medit.spin_main_loop(0.1) +-- moo.spin_main_loop(0.1) test_will_close_doc() --- medit.spin_main_loop(0.1) +-- moo.spin_main_loop(0.1) test_before_save() diff --git a/moo/medit-app/data/test-lua/testtext.lua b/moo/medit-app/data/test-lua/testtext.lua index a95eff25..9d7dc724 100644 --- a/moo/medit-app/data/test-lua/testtext.lua +++ b/moo/medit-app/data/test-lua/testtext.lua @@ -1,7 +1,6 @@ require("munit") -require("medit") -editor = medit.Editor.instance() +editor = moo.Editor.instance() doc = editor.new_doc() tassert(doc.get_text() == '') diff --git a/moo/moolua/lua-default-init.lua b/moo/moolua/lua-default-init.lua index 85c792ce..a5f3500a 100644 --- a/moo/moolua/lua-default-init.lua +++ b/moo/moolua/lua-default-init.lua @@ -1,5 +1,5 @@ local _g = getfenv(0) -require("moo.builtin")._inject(_g) -local medit = require("medit") -_g.app = medit.App.instance() +require("_moo.builtin")._inject(_g) +local moo = require("moo") +_g.app = moo.App.instance() _g.editor = _g.app.get_editor() diff --git a/moo/moolua/lua/Makefile.incl b/moo/moolua/lua/Makefile.incl index 95a1711a..0b95bb3f 100644 --- a/moo/moolua/lua/Makefile.incl +++ b/moo/moolua/lua/Makefile.incl @@ -77,11 +77,11 @@ EXTRA_DIST += \ moolua/lua/slnunico.c luadir = $(MOO_DATA_DIR)/lua -EXTRA_DIST += moolua/lua/moo +EXTRA_DIST += moolua/lua/_moo install-data-local: install-lua-moo uninstall-local: uninstall-lua-moo install-lua-moo: - $(MKDIR_P) $(DESTDIR)$(luadir)/moo - cd $(srcdir) && $(INSTALL_DATA) moolua/lua/moo/*.lua $(DESTDIR)$(luadir)/moo/ + $(MKDIR_P) $(DESTDIR)$(luadir)/_moo + cd $(srcdir) && $(INSTALL_DATA) moolua/lua/_moo/*.lua $(DESTDIR)$(luadir)/_moo/ uninstall-lua-moo: - rm -f $(DESTDIR)$(luadir)/moo/*.lua + rm -f $(DESTDIR)$(luadir)/_moo/*.lua diff --git a/moo/moolua/lua/moo/_string.lua b/moo/moolua/lua/_moo/_string.lua similarity index 93% rename from moo/moolua/lua/moo/_string.lua rename to moo/moolua/lua/_moo/_string.lua index ba7f3fa1..8ebe0caa 100644 --- a/moo/moolua/lua/moo/_string.lua +++ b/moo/moolua/lua/_moo/_string.lua @@ -5,7 +5,7 @@ local table = table local pairs, ipairs, select, unpack, require = pairs, ipairs, select, unpack, require -module('moo._string') +module('_moo._string') function startswith(s, prfx) return s:sub(1, #prfx) == prfx diff --git a/moo/moolua/lua/moo/_table.lua b/moo/moolua/lua/_moo/_table.lua similarity index 96% rename from moo/moolua/lua/moo/_table.lua rename to moo/moolua/lua/_moo/_table.lua index d0d37f5c..094c8eaf 100644 --- a/moo/moolua/lua/moo/_table.lua +++ b/moo/moolua/lua/_moo/_table.lua @@ -5,7 +5,7 @@ local table, math = table, math local pairs, ipairs, select, unpack, require = pairs, ipairs, select, unpack, require -module('moo._table') +module('_moo._table') function count(t, x) local c = 0 diff --git a/moo/moolua/lua/moo/_util.lua b/moo/moolua/lua/_moo/_util.lua similarity index 94% rename from moo/moolua/lua/moo/_util.lua rename to moo/moolua/lua/_moo/_util.lua index 86e40379..e0f52366 100644 --- a/moo/moolua/lua/moo/_util.lua +++ b/moo/moolua/lua/_moo/_util.lua @@ -4,7 +4,7 @@ local _G = _G local type, require, pairs = type, require, pairs -module('moo._util') +module('_moo._util') function inject_symbols(src, dest) if type(src) == 'string' then diff --git a/moo/moolua/lua/moo/builtin.lua b/moo/moolua/lua/_moo/builtin.lua similarity index 90% rename from moo/moolua/lua/moo/builtin.lua rename to moo/moolua/lua/_moo/builtin.lua index 40fe3019..b1f02ad5 100644 --- a/moo/moolua/lua/moo/builtin.lua +++ b/moo/moolua/lua/_moo/builtin.lua @@ -6,15 +6,15 @@ local math, table, string = local pairs, ipairs, select, unpack, require, type, error = pairs, ipairs, select, unpack, require, type, error -module('moo.builtin') +module('_moo.builtin') function _inject(dest) - local util = require('moo._util') - util.inject_symbols('moo._table', table) - util.inject_symbols('moo._string', string) - util.inject_symbols('moo.builtin', dest) - dest.os = require('moo.os') - dest.os.path = require('moo.path') + local util = require('_moo._util') + util.inject_symbols('_moo._table', table) + util.inject_symbols('_moo._string', string) + util.inject_symbols('_moo.builtin', dest) + dest.os = require('_moo.os') + dest.os.path = require('_moo.path') end abs = math.abs diff --git a/moo/moolua/lua/moo/os.lua b/moo/moolua/lua/_moo/os.lua similarity index 97% rename from moo/moolua/lua/moo/os.lua rename to moo/moolua/lua/_moo/os.lua index 77a80d3e..5647fe22 100644 --- a/moo/moolua/lua/moo/os.lua +++ b/moo/moolua/lua/_moo/os.lua @@ -7,7 +7,7 @@ local _os = os local lfs = require('lfs') local _moo_utils = require("_moo_utils") -module('moo.os') +module('_moo.os') if package.config:sub(1,1) == '/' then name = 'posix' diff --git a/moo/moolua/lua/moo/path.lua b/moo/moolua/lua/_moo/path.lua similarity index 92% rename from moo/moolua/lua/moo/path.lua rename to moo/moolua/lua/_moo/path.lua index 176d2509..13943dbf 100644 --- a/moo/moolua/lua/moo/path.lua +++ b/moo/moolua/lua/_moo/path.lua @@ -4,10 +4,10 @@ local _G = _G local math, table = math, table local pairs, ipairs, select, unpack, require = pairs, ipairs, select, unpack, require -local os = require('moo.os') +local os = require('_moo.os') local lfs = require('lfs') -module('moo.path') +module('_moo.path') function exists(path) return lfs.attributes(path) ~= nil diff --git a/moo/moolua/medit-lua.cpp b/moo/moolua/medit-lua.cpp index 270975c6..fecd953d 100644 --- a/moo/moolua/medit-lua.cpp +++ b/moo/moolua/medit-lua.cpp @@ -116,8 +116,8 @@ moo_lua_state_run_string (MooLuaState *lua, } // extern "C" -void gtk_lua_api_add_to_lua (lua_State *L, const char *package_name); -void moo_lua_api_add_to_lua (lua_State *L, const char *package_name); +void gtk_lua_api_add_to_lua (lua_State *L); +void moo_lua_api_add_to_lua (lua_State *L); static bool add_raw_api (lua_State *L) @@ -128,12 +128,12 @@ add_raw_api (lua_State *L) g_assert (lua_gettop (L) == 0); - gtk_lua_api_add_to_lua (L, "gtk"); + gtk_lua_api_add_to_lua (L); lua_pop(L, 1); g_assert (lua_gettop (L) == 0); - moo_lua_api_add_to_lua (L, "medit"); + moo_lua_api_add_to_lua (L); lua_pop(L, 1); g_assert (lua_gettop (L) == 0);