Renamed medit lua package to 'moo'

This commit is contained in:
Yevgen Muntyan 2011-01-22 22:12:20 -08:00
parent d80f9b90a9
commit 0f5d84f71c
22 changed files with 117 additions and 124 deletions

View File

@ -438,7 +438,8 @@ static void *%(func)s (void)
all_method_cfuncs[cls.name] = method_cfuncs all_method_cfuncs[cls.name] = method_cfuncs
all_static_method_cfuncs[cls.short_name] = static_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 = [] all_func_cfuncs = []
@ -468,11 +469,11 @@ static void *%(func)s (void)
self.__write_register_module(module, all_method_cfuncs) self.__write_register_module(module, all_method_cfuncs)
self.out.write("""\ 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 (); %(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) """ % 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] cfuncs = all_static_method_cfuncs[cls_name]
if not cfuncs: if not cfuncs:
continue 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') self.out.write('\n')
for enum in module.get_enums(): 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") self.out.write("}\n")

View File

@ -134,12 +134,16 @@ endif
EXTRA_DIST = help built/moo-help-sections.h built/medit.1 EXTRA_DIST = help built/moo-help-sections.h built/medit.1
install-data-local: 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/*.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 cd $(srcdir) && $(INSTALL_DATA) help/img/*.png $(DESTDIR)$(MOO_HELP_DIR)/img
uninstall-local: 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 if MOO_OS_UNIX
dist_man_MANS = built/medit.1 dist_man_MANS = built/medit.1

View File

@ -4,6 +4,7 @@
%medit-defines; %medit-defines;
]> ]>
<chapter id="chapter-script-lua-gtk"> <chapter id="chapter-script-lua-gtk">
<?dbhtml filename="lua-gtk.html"?>
<title>&medit; Gtk API for Lua scripts</title> <title>&medit; Gtk API for Lua scripts</title>
<sect1> <sect1>
<title>Introduction</title> <title>Introduction</title>

View File

@ -4,6 +4,7 @@
%medit-defines; %medit-defines;
]> ]>
<chapter id="chapter-script-lua"> <chapter id="chapter-script-lua">
<?dbhtml filename="lua-moo.html"?>
<title>&medit; Lua API</title> <title>&medit; Lua API</title>
<sect1 id="section-script-lua-introduction"> <sect1 id="section-script-lua-introduction">

View File

@ -4,6 +4,7 @@
%medit-defines; %medit-defines;
]> ]>
<chapter id="chapter-script-python"> <chapter id="chapter-script-python">
<?dbhtml filename="python-moo.html"?>
<title>&medit; Python API</title> <title>&medit; Python API</title>
<sect1> <sect1>
<title>Introduction</title> <title>Introduction</title>

View File

@ -384,10 +384,10 @@ or scripts into <filename><envar>DATA_DIR</envar>/scripts/</filename> to be used
<title>Lua scripts</title> <title>Lua scripts</title>
<para> <para>
<ulink url="script-lua.html">Medit API for Lua scripts</ulink>. <ulink url="script/lua-moo.html">Medit API for Lua scripts</ulink>.
</para> </para>
<para> <para>
<ulink url="script-lua-gtk.html">Gtk API for Lua scripts</ulink>. <ulink url="script/lua-gtk.html">Gtk API for Lua scripts</ulink>.
</para> </para>
</sect1> </sect1>
@ -397,7 +397,7 @@ or scripts into <filename><envar>DATA_DIR</envar>/scripts/</filename> to be used
<title>Python scripts</title> <title>Python scripts</title>
<para> <para>
<ulink url="script-python.html">Medit API for Python scripts</ulink>. <ulink url="script/python-moo.html">Medit API for Python scripts</ulink>.
</para> </para>
</sect1> </sect1>

View File

@ -1,4 +1,4 @@
local medit = require("medit") local moo = require("moo")
local function _tassert(cond, msg, ...) local function _tassert(cond, msg, ...)
local info = debug.getinfo(3, "Slf") local info = debug.getinfo(3, "Slf")
@ -8,9 +8,9 @@ local function _tassert(cond, msg, ...)
if name then if name then
message = string.format('in function %s: %s', name, message) message = string.format('in function %s: %s', name, message)
end end
medit.test_assert_impl(false, message, info.short_src, info.currentline) moo.test_assert_impl(false, message, info.short_src, info.currentline)
else else
medit.test_assert_impl(true, '', info.short_src, info.currentline) moo.test_assert_impl(true, '', info.short_src, info.currentline)
end end
end end

View File

@ -1,8 +1,5 @@
-- -%- indent-width:2 -%- --
require("munit") require("munit")
require("gtk") os = require("_moo.os")
os = require("moo.os")
if os.name == 'nt' then if os.name == 'nt' then
name1 = 'c:\\tmp\\foo' name1 = 'c:\\tmp\\foo'

View File

@ -1,20 +1,18 @@
require("munit") require("munit")
require("medit") require("_moo.os")
require("gtk")
require("moo.os")
editor = medit.Editor.instance() editor = moo.Editor.instance()
tassert(medit.LE_NATIVE ~= nil) tassert(moo.LE_NATIVE ~= nil)
tassert(medit.LE_UNIX ~= nil) tassert(moo.LE_UNIX ~= nil)
tassert(medit.LE_WIN32 ~= nil) tassert(moo.LE_WIN32 ~= nil)
tassert(moo.os.name == 'nt' or medit.LE_NATIVE ~= medit.LE_WIN32) tassert(_moo.os.name == 'nt' or moo.LE_NATIVE ~= moo.LE_WIN32)
tassert(moo.os.name ~= 'nt' or medit.LE_NATIVE == medit.LE_WIN32) tassert(_moo.os.name ~= 'nt' or moo.LE_NATIVE == moo.LE_WIN32)
text_unix = 'line1\nline2\nline3\n' text_unix = 'line1\nline2\nline3\n'
text_win32 = 'line1\r\nline2\r\nline3\r\n' text_win32 = 'line1\r\nline2\r\nline3\r\n'
text_mix = 'line1\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 text_native = text_win32
else else
text_native = text_unix text_native = text_unix
@ -35,80 +33,80 @@ end
function test_default() function test_default()
doc = editor.new_doc() 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) 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(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) 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(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) doc.set_modified(false)
editor.close_doc(doc) editor.close_doc(doc)
end end
function test_set() function test_set()
doc = editor.new_doc() 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) 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(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) doc.set_line_end_type(moo.LE_UNIX)
tassert(doc.get_line_end_type() == medit.LE_UNIX) tassert(doc.get_line_end_type() == moo.LE_UNIX)
tassert(doc.save_as(medit.SaveInfo.new_path(filename))) tassert(doc.save_as(moo.SaveInfo.new_path(filename)))
tassert(read_file(filename) == text_unix) 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) doc.set_line_end_type(moo.LE_WIN32)
tassert(doc.get_line_end_type() == medit.LE_WIN32) tassert(doc.get_line_end_type() == moo.LE_WIN32)
tassert(doc.save_as(medit.SaveInfo.new_path(filename))) tassert(doc.save_as(moo.SaveInfo.new_path(filename)))
tassert(read_file(filename) == text_win32) 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) doc.set_modified(false)
editor.close_doc(doc) editor.close_doc(doc)
end end
function test_load() function test_load()
filename = medit.tempnam() filename = moo.tempnam()
save_file(filename, text_unix) 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_filename() == filename)
tassert(doc.get_line_end_type() == medit.LE_UNIX) tassert(doc.get_line_end_type() == moo.LE_UNIX)
doc.close() doc.close()
save_file(filename, text_win32) 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_filename() == filename)
tassert(doc.get_line_end_type() == medit.LE_WIN32) tassert(doc.get_line_end_type() == moo.LE_WIN32)
doc.close() doc.close()
end end
function test_mix() function test_mix()
filename = medit.tempnam() filename = moo.tempnam()
save_file(filename, text_mix) 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_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.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) tassert(read_file(filename) == text_unix)
save_file(filename, text_mix) save_file(filename, text_mix)
tassert(doc.reload()) tassert(doc.reload())
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_WIN32) doc.set_line_end_type(moo.LE_WIN32)
tassert(doc.save()) 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) tassert(read_file(filename) == text_win32)
doc.close() doc.close()

View File

@ -1,10 +1,7 @@
-- -%- indent-width:2 -%- --
require("munit") require("munit")
require("medit") require("_moo.os")
require("moo.os")
app = medit.App.instance() app = moo.App.instance()
editor = app.get_editor() editor = app.get_editor()
local __docs_to_cleanup = {} local __docs_to_cleanup = {}
@ -27,11 +24,11 @@ local function test_active_window()
tassert(w1 ~= w2, 'old window != new window') tassert(w1 ~= w2, 'old window != new window')
tassert(#editor.get_windows() == 2, 'two window') tassert(#editor.get_windows() == 2, 'two window')
editor.set_active_window(w2) 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()') 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) 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()') tassert(w1 == editor.get_active_window(), 'w1 == editor.get_active_window()')
end end
editor.close_window(w1) editor.close_window(w1)

View File

@ -1,9 +1,5 @@
-- -%- indent-width:2 -%- --
require("munit") require("munit")
require("moo.builtin")._inject(_G)
function to_list(t) function to_list(t)
local l = {} local l = {}
for k, v in pairs(t) do for k, v in pairs(t) do

View File

@ -1,35 +1,33 @@
require("munit") require("munit")
require("medit")
require("gtk")
editor = medit.Editor.instance() editor = moo.Editor.instance()
tassert(medit.CLOSE_RESPONSE_CANCEL ~= nil) tassert(moo.CLOSE_RESPONSE_CANCEL ~= nil)
tassert(medit.CLOSE_RESPONSE_CONTINUE ~= nil) tassert(moo.CLOSE_RESPONSE_CONTINUE ~= nil)
function check_args_ew(editor, window) function check_args_ew(editor, window)
tassert(editor == medit.Editor.instance()) tassert(editor == moo.Editor.instance())
tassert(editor == window.get_editor()) tassert(editor == window.get_editor())
window.get_tabs() window.get_tabs()
end end
function check_args_ed(editor, doc) function check_args_ed(editor, doc)
tassert(editor == medit.Editor.instance()) tassert(editor == moo.Editor.instance())
tassert(editor == doc.get_editor()) tassert(editor == doc.get_editor())
doc.get_display_basename() doc.get_display_basename()
end end
function check_args_w(window) function check_args_w(window)
tassert(medit.Editor.instance() == window.get_editor()) tassert(moo.Editor.instance() == window.get_editor())
window.get_tabs() window.get_tabs()
end end
function check_args_e(editor) function check_args_e(editor)
tassert(medit.Editor.instance() == editor) tassert(moo.Editor.instance() == editor)
end end
function check_args_d(doc) function check_args_d(doc)
tassert(medit.Editor.instance() == doc.get_editor()) tassert(moo.Editor.instance() == doc.get_editor())
doc.get_display_basename() doc.get_display_basename()
end end
@ -82,7 +80,7 @@ function test_before_close_window()
function(editor, window) function(editor, window)
check_args_ew(editor, window) check_args_ew(editor, window)
seen_editor_before_close_window = seen_editor_before_close_window + 1 seen_editor_before_close_window = seen_editor_before_close_window + 1
return medit.CLOSE_RESPONSE_CANCEL return moo.CLOSE_RESPONSE_CANCEL
end) end)
window = editor.new_window() window = editor.new_window()
@ -98,7 +96,7 @@ function test_before_close_window()
function(window) function(window)
check_args_w(window) check_args_w(window)
seen_window_before_close = seen_window_before_close + 1 seen_window_before_close = seen_window_before_close + 1
return medit.CLOSE_RESPONSE_CANCEL return moo.CLOSE_RESPONSE_CANCEL
end) end)
tassert(not editor.close_window(window)) tassert(not editor.close_window(window))
@ -114,14 +112,14 @@ function test_before_close_window()
function(editor, window) function(editor, window)
check_args_ew(editor, window) check_args_ew(editor, window)
seen_editor_before_close_window = seen_editor_before_close_window + 1 seen_editor_before_close_window = seen_editor_before_close_window + 1
return medit.CLOSE_RESPONSE_CONTINUE return moo.CLOSE_RESPONSE_CONTINUE
end) end)
window.connect('before-close', window.connect('before-close',
function(window) function(window)
check_args_w(window) check_args_w(window)
seen_window_before_close = seen_window_before_close + 1 seen_window_before_close = seen_window_before_close + 1
return medit.CLOSE_RESPONSE_CONTINUE return moo.CLOSE_RESPONSE_CONTINUE
end) end)
tassert(window.close()) tassert(window.close())
@ -170,9 +168,9 @@ function test_bad_callback()
tassert(cb_id1 ~= nil and cb_id1 ~= 0) tassert(cb_id1 ~= nil and cb_id1 ~= 0)
tassert(cb_id2 ~= nil and cb_id2 ~= 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)) tassert(editor.close_window(window))
medit.test_set_silent_messages(was_silent) moo.test_set_silent_messages(was_silent)
tassert(n_callbacks == 6) tassert(n_callbacks == 6)
@ -181,8 +179,8 @@ function test_bad_callback()
end end
function test_will_save() function test_will_save()
path = medit.tempnam() path = moo.tempnam()
si = medit.SaveInfo.new_path(path) si = moo.SaveInfo.new_path(path)
doc = editor.new_doc() doc = editor.new_doc()
doc.set_modified(true) doc.set_modified(true)
@ -279,12 +277,12 @@ function test_before_save()
check_args_ed(editor, doc) check_args_ed(editor, doc)
check_args_f(gfile) check_args_f(gfile)
seen_editor_before_save = seen_editor_before_save + 1 seen_editor_before_save = seen_editor_before_save + 1
return medit.SAVE_RESPONSE_CANCEL return moo.SAVE_RESPONSE_CANCEL
end) end)
doc = editor.new_doc() doc = editor.new_doc()
path = medit.tempnam() path = moo.tempnam()
si = medit.SaveInfo.new_path(path) si = moo.SaveInfo.new_path(path)
tassert(not editor.save_as(doc, si)) tassert(not editor.save_as(doc, si))
tassert(seen_editor_before_save == 1) tassert(seen_editor_before_save == 1)
@ -298,7 +296,7 @@ function test_before_save()
check_args_d(doc) check_args_d(doc)
check_args_f(gfile) check_args_f(gfile)
seen_doc_before_save = seen_doc_before_save + 1 seen_doc_before_save = seen_doc_before_save + 1
return medit.SAVE_RESPONSE_CANCEL return moo.SAVE_RESPONSE_CANCEL
end) end)
tassert(not editor.save_as(doc, si)) tassert(not editor.save_as(doc, si))
@ -315,7 +313,7 @@ function test_before_save()
check_args_ed(editor, doc) check_args_ed(editor, doc)
check_args_f(gfile) check_args_f(gfile)
seen_editor_before_save = seen_editor_before_save + 1 seen_editor_before_save = seen_editor_before_save + 1
return medit.SAVE_RESPONSE_CONTINUE return moo.SAVE_RESPONSE_CONTINUE
end) end)
doc.connect('before-save', doc.connect('before-save',
@ -323,7 +321,7 @@ function test_before_save()
check_args_d(doc) check_args_d(doc)
check_args_f(gfile) check_args_f(gfile)
seen_doc_before_save = seen_doc_before_save + 1 seen_doc_before_save = seen_doc_before_save + 1
return medit.SAVE_RESPONSE_CONTINUE return moo.SAVE_RESPONSE_CONTINUE
end) end)
tassert(doc.save_as(si)) tassert(doc.save_as(si))
@ -340,13 +338,13 @@ function test_before_save()
end end
test_will_close_window() test_will_close_window()
-- medit.spin_main_loop(0.1) -- moo.spin_main_loop(0.1)
test_before_close_window() test_before_close_window()
-- medit.spin_main_loop(0.1) -- moo.spin_main_loop(0.1)
test_bad_callback() test_bad_callback()
-- medit.spin_main_loop(0.1) -- moo.spin_main_loop(0.1)
test_will_save() test_will_save()
-- medit.spin_main_loop(0.1) -- moo.spin_main_loop(0.1)
test_will_close_doc() test_will_close_doc()
-- medit.spin_main_loop(0.1) -- moo.spin_main_loop(0.1)
test_before_save() test_before_save()

View File

@ -1,7 +1,6 @@
require("munit") require("munit")
require("medit")
editor = medit.Editor.instance() editor = moo.Editor.instance()
doc = editor.new_doc() doc = editor.new_doc()
tassert(doc.get_text() == '') tassert(doc.get_text() == '')

View File

@ -1,5 +1,5 @@
local _g = getfenv(0) local _g = getfenv(0)
require("moo.builtin")._inject(_g) require("_moo.builtin")._inject(_g)
local medit = require("medit") local moo = require("moo")
_g.app = medit.App.instance() _g.app = moo.App.instance()
_g.editor = _g.app.get_editor() _g.editor = _g.app.get_editor()

View File

@ -77,11 +77,11 @@ EXTRA_DIST += \
moolua/lua/slnunico.c moolua/lua/slnunico.c
luadir = $(MOO_DATA_DIR)/lua luadir = $(MOO_DATA_DIR)/lua
EXTRA_DIST += moolua/lua/moo EXTRA_DIST += moolua/lua/_moo
install-data-local: install-lua-moo install-data-local: install-lua-moo
uninstall-local: uninstall-lua-moo uninstall-local: uninstall-lua-moo
install-lua-moo: install-lua-moo:
$(MKDIR_P) $(DESTDIR)$(luadir)/moo $(MKDIR_P) $(DESTDIR)$(luadir)/_moo
cd $(srcdir) && $(INSTALL_DATA) moolua/lua/moo/*.lua $(DESTDIR)$(luadir)/moo/ cd $(srcdir) && $(INSTALL_DATA) moolua/lua/_moo/*.lua $(DESTDIR)$(luadir)/_moo/
uninstall-lua-moo: uninstall-lua-moo:
rm -f $(DESTDIR)$(luadir)/moo/*.lua rm -f $(DESTDIR)$(luadir)/_moo/*.lua

View File

@ -5,7 +5,7 @@ local table = table
local pairs, ipairs, select, unpack, require = local pairs, ipairs, select, unpack, require =
pairs, ipairs, select, unpack, require pairs, ipairs, select, unpack, require
module('moo._string') module('_moo._string')
function startswith(s, prfx) function startswith(s, prfx)
return s:sub(1, #prfx) == prfx return s:sub(1, #prfx) == prfx

View File

@ -5,7 +5,7 @@ local table, math = table, math
local pairs, ipairs, select, unpack, require = local pairs, ipairs, select, unpack, require =
pairs, ipairs, select, unpack, require pairs, ipairs, select, unpack, require
module('moo._table') module('_moo._table')
function count(t, x) function count(t, x)
local c = 0 local c = 0

View File

@ -4,7 +4,7 @@ local _G = _G
local type, require, pairs = local type, require, pairs =
type, require, pairs type, require, pairs
module('moo._util') module('_moo._util')
function inject_symbols(src, dest) function inject_symbols(src, dest)
if type(src) == 'string' then if type(src) == 'string' then

View File

@ -6,15 +6,15 @@ local math, table, string =
local pairs, ipairs, select, unpack, require, type, error = local pairs, ipairs, select, unpack, require, type, error =
pairs, ipairs, select, unpack, require, type, error pairs, ipairs, select, unpack, require, type, error
module('moo.builtin') module('_moo.builtin')
function _inject(dest) function _inject(dest)
local util = require('moo._util') local util = require('_moo._util')
util.inject_symbols('moo._table', table) util.inject_symbols('_moo._table', table)
util.inject_symbols('moo._string', string) util.inject_symbols('_moo._string', string)
util.inject_symbols('moo.builtin', dest) util.inject_symbols('_moo.builtin', dest)
dest.os = require('moo.os') dest.os = require('_moo.os')
dest.os.path = require('moo.path') dest.os.path = require('_moo.path')
end end
abs = math.abs abs = math.abs

View File

@ -7,7 +7,7 @@ local _os = os
local lfs = require('lfs') local lfs = require('lfs')
local _moo_utils = require("_moo_utils") local _moo_utils = require("_moo_utils")
module('moo.os') module('_moo.os')
if package.config:sub(1,1) == '/' then if package.config:sub(1,1) == '/' then
name = 'posix' name = 'posix'

View File

@ -4,10 +4,10 @@ local _G = _G
local math, table = math, table local math, table = math, table
local pairs, ipairs, select, unpack, require = local pairs, ipairs, select, unpack, require =
pairs, ipairs, select, unpack, require pairs, ipairs, select, unpack, require
local os = require('moo.os') local os = require('_moo.os')
local lfs = require('lfs') local lfs = require('lfs')
module('moo.path') module('_moo.path')
function exists(path) function exists(path)
return lfs.attributes(path) ~= nil return lfs.attributes(path) ~= nil

View File

@ -116,8 +116,8 @@ moo_lua_state_run_string (MooLuaState *lua,
} // extern "C" } // extern "C"
void gtk_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, const char *package_name); void moo_lua_api_add_to_lua (lua_State *L);
static bool static bool
add_raw_api (lua_State *L) add_raw_api (lua_State *L)
@ -128,12 +128,12 @@ add_raw_api (lua_State *L)
g_assert (lua_gettop (L) == 0); 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); lua_pop(L, 1);
g_assert (lua_gettop (L) == 0); 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); lua_pop(L, 1);
g_assert (lua_gettop (L) == 0); g_assert (lua_gettop (L) == 0);