Author: fperrad
Date: Wed Aug 6 06:11:32 2008
New Revision: 30056
Modified:
trunk/languages/lua/src/lib/luaaux.pir
trunk/languages/lua/src/lib/luabasic.pir
trunk/languages/lua/src/lib/luacoroutine.pir
trunk/languages/lua/src/lib/luadebug.pir
trunk/languages/lua/src/lib/luafile.pir
trunk/languages/lua/src/lib/luaio.pir
trunk/languages/lua/src/lib/luamath.pir
trunk/languages/lua/src/lib/luaos.pir
trunk/languages/lua/src/lib/luapackage.pir
trunk/languages/lua/src/lib/luastring.pir
trunk/languages/lua/src/lib/luatable.pir
trunk/languages/lua/src/pmc/luaany.pmc
trunk/languages/lua/src/pmc/luastring.pmc
trunk/languages/lua/t/pmc/closure.t
trunk/languages/lua/t/pmc/function.t
Log:
[Lua]
- refactor namespace : standard libraries
Modified: trunk/languages/lua/src/lib/luaaux.pir
==============================================================================
--- trunk/languages/lua/src/lib/luaaux.pir (original)
+++ trunk/languages/lua/src/lib/luaaux.pir Wed Aug 6 06:11:32 2008
@@ -14,6 +14,7 @@
=cut
.HLL 'Lua', 'lua_group'
+.namespace []
=item C<lua_argerror (narg, extramsg, ...)>
@@ -701,23 +702,23 @@
=cut
.sub 'lua_openlibs'
- $P0 = get_hll_global ['Lua::basic'], 'luaopen_basic'
+ $P0 = get_hll_global ['basic'], 'luaopen_basic'
$P0()
- $P0 = get_hll_global ['Lua::coroutine'], 'luaopen_coroutine'
+ $P0 = get_hll_global ['coroutine'], 'luaopen_coroutine'
$P0()
- $P0 = get_hll_global ['Lua::package'], 'luaopen_package'
+ $P0 = get_hll_global ['package'], 'luaopen_package'
$P0()
- $P0 = get_hll_global ['Lua::table'], 'luaopen_table'
+ $P0 = get_hll_global ['table'], 'luaopen_table'
$P0()
- $P0 = get_hll_global ['Lua::io'], 'luaopen_io'
+ $P0 = get_hll_global ['io'], 'luaopen_io'
$P0()
- $P0 = get_hll_global ['Lua::os'], 'luaopen_os'
+ $P0 = get_hll_global ['os'], 'luaopen_os'
$P0()
- $P0 = get_hll_global ['Lua::string'], 'luaopen_string'
+ $P0 = get_hll_global ['string'], 'luaopen_string'
$P0()
- $P0 = get_hll_global ['Lua::math'], 'luaopen_math'
+ $P0 = get_hll_global ['math'], 'luaopen_math'
$P0()
- $P0 = get_hll_global ['Lua::debug'], 'luaopen_debug'
+ $P0 = get_hll_global ['debug'], 'luaopen_debug'
$P0()
sweepon
sweep 1
Modified: trunk/languages/lua/src/lib/luabasic.pir
==============================================================================
--- trunk/languages/lua/src/lib/luabasic.pir (original)
+++ trunk/languages/lua/src/lib/luabasic.pir Wed Aug 6 06:11:32 2008
@@ -19,7 +19,7 @@
=cut
.HLL 'Lua', 'lua_group'
-.namespace [ 'Lua::basic' ]
+.namespace [ 'basic' ]
.sub 'luaopen_basic'
# print "init Lua Basic\n"
Modified: trunk/languages/lua/src/lib/luacoroutine.pir
==============================================================================
--- trunk/languages/lua/src/lib/luacoroutine.pir (original)
+++ trunk/languages/lua/src/lib/luacoroutine.pir Wed Aug 6 06:11:32 2008
@@ -20,7 +20,7 @@
=cut
.HLL 'Lua', 'lua_group'
-.namespace [ 'Lua::coroutine' ]
+.namespace [ 'coroutine' ]
.sub 'luaopen_coroutine'
load_bytecode 'Parrot/Coroutine.pbc'
Modified: trunk/languages/lua/src/lib/luadebug.pir
==============================================================================
--- trunk/languages/lua/src/lib/luadebug.pir (original)
+++ trunk/languages/lua/src/lib/luadebug.pir Wed Aug 6 06:11:32 2008
@@ -29,7 +29,7 @@
=cut
.HLL 'Lua', 'lua_group'
-.namespace [ 'Lua::debug' ]
+.namespace [ 'debug' ]
.sub 'luaopen_debug'
# print "init Lua Debug\n"
Modified: trunk/languages/lua/src/lib/luafile.pir
==============================================================================
--- trunk/languages/lua/src/lib/luafile.pir (original)
+++ trunk/languages/lua/src/lib/luafile.pir Wed Aug 6 06:11:32 2008
@@ -16,7 +16,7 @@
=cut
.HLL 'Lua', 'lua_group'
-.namespace [ 'Lua::io::file' ]
+.namespace [ 'io'; 'file' ]
.sub 'createmeta'
.local pmc _lua__GLOBAL
@@ -88,9 +88,9 @@
.sub 'close' :method :anon
.param pmc extra :slurpy
.local pmc res
- $P0 = get_hll_global ['Lua::io'], 'tofile'
+ $P0 = get_hll_global ['io'], 'tofile'
$P0(self)
- $P0 = get_hll_global ['Lua::io'], 'aux_close'
+ $P0 = get_hll_global ['io'], 'aux_close'
(res :slurpy) = $P0(self)
.return (res :flat)
.end
@@ -106,7 +106,7 @@
.param pmc extra :slurpy
.local pmc f
.local pmc res
- $P0 = get_hll_global ['Lua::io'], 'tofile'
+ $P0 = get_hll_global ['io'], 'tofile'
f = $P0(self)
f.'flush'()
new res, 'LuaBoolean'
@@ -129,9 +129,9 @@
.sub 'lines' :method :anon
.param pmc extra :slurpy
- $P0 = get_hll_global ['Lua::io'], 'tofile'
+ $P0 = get_hll_global ['io'], 'tofile'
$P0(self)
- $P0 = get_hll_global ['Lua::io'], 'aux_lines'
+ $P0 = get_hll_global ['io'], 'aux_lines'
.return $P0(self, 0)
.end
@@ -177,11 +177,11 @@
.param pmc formats :slurpy
.local pmc res
.local pmc f
- $P0 = get_hll_global ['Lua::io'], 'tofile'
+ $P0 = get_hll_global ['io'], 'tofile'
$P0(self)
f = getattribute self, 'data'
if formats goto L1
- $P0 = get_hll_global ['Lua::io'], 'read_line'
+ $P0 = get_hll_global ['io'], 'read_line'
.return $P0(f)
L1:
.local int narg
@@ -199,12 +199,12 @@
.local int l
l = format
unless l == 0 goto L5
- $P0 = get_hll_global ['Lua::io'], 'test_eof'
+ $P0 = get_hll_global ['io'], 'test_eof'
$P0 = $P0(f)
res[i] = $P0
goto L6
L5:
- $P0 = get_hll_global ['Lua::io'], 'read_chars'
+ $P0 = get_hll_global ['io'], 'read_chars'
$P0 = $P0(f, l)
res[i] = $P0
goto L6
@@ -213,7 +213,7 @@
$I0 = index $S0, '*n'
unless $I0 == 0 goto L7
# number
- $P0 = get_hll_global ['Lua::io'], 'read_number'
+ $P0 = get_hll_global ['io'], 'read_number'
$P0 = $P0(f)
res[i] = $P0
goto L6
@@ -221,7 +221,7 @@
$I0 = index $S0, '*l'
unless $I0 == 0 goto L8
# line
- $P0 = get_hll_global ['Lua::io'], 'read_line'
+ $P0 = get_hll_global ['io'], 'read_line'
$P0 = $P0(f)
res[i] = $P0
goto L6
@@ -229,7 +229,7 @@
$I0 = index $S0, '*a'
unless $I0 == 0 goto L9
# file
- $P0 = get_hll_global ['Lua::io'], 'read_chars'
+ $P0 = get_hll_global ['io'], 'read_chars'
$P0 = $P0(f, 65535)
res[i] = $P0
goto L6
@@ -284,7 +284,7 @@
.param pmc extra :slurpy
.local pmc f
.local pmc res
- $P0 = get_hll_global ['Lua::io'], 'tofile'
+ $P0 = get_hll_global ['io'], 'tofile'
$P0(self)
$S1 = lua_optstring(1, whence, 'cur')
$I1 = lua_checkoption(1, $S1, 'set cur end')
@@ -334,7 +334,7 @@
.local pmc mode
.local pmc f
.local pmc res
- $P0 = get_hll_global ['Lua::io'], 'tofile'
+ $P0 = get_hll_global ['io'], 'tofile'
$P0(self)
$S1 = lua_checkstring(1, mode)
$I1 = lua_checkoption(1, $S1, 'no full line')
@@ -371,7 +371,7 @@
.local int argc
.local int i
.local pmc f
- $P0 = get_hll_global ['Lua::io'], 'tofile'
+ $P0 = get_hll_global ['io'], 'tofile'
$P0(self)
f = getattribute self, 'data'
argc = argv
@@ -397,11 +397,11 @@
.sub '__gc' :method :anon
.local pmc f
- $P0 = get_hll_global ['Lua::io'], 'tofilep'
+ $P0 = get_hll_global ['io'], 'tofilep'
f = $P0(self)
# ignore closed files
if null f goto L1
- $P0 = get_hll_global ['Lua::io'], 'aux_close'
+ $P0 = get_hll_global ['io'], 'aux_close'
$P0(self)
L1:
.return ()
@@ -411,7 +411,7 @@
.sub '__tostring' :method :anon
.local pmc f
.local pmc res
- $P0 = get_hll_global ['Lua::io'], 'tofilep'
+ $P0 = get_hll_global ['io'], 'tofilep'
f = $P0(self)
new res, 'LuaString'
if f goto L1
Modified: trunk/languages/lua/src/lib/luaio.pir
==============================================================================
--- trunk/languages/lua/src/lib/luaio.pir (original)
+++ trunk/languages/lua/src/lib/luaio.pir Wed Aug 6 06:11:32 2008
@@ -34,13 +34,13 @@
=cut
.HLL 'Lua', 'lua_group'
-.namespace [ 'Lua::io' ]
+.namespace [ 'io' ]
.sub 'luaopen_io'
# print "init Lua I/O\n"
.local pmc _file
- $P0 = get_hll_global ['Lua::io::file'], 'createmeta'
+ $P0 = get_hll_global ['io'; 'file'], 'createmeta'
_file = $P0()
# create (private) environment (with fields IO_INPUT, IO_OUTPUT, __close)
Modified: trunk/languages/lua/src/lib/luamath.pir
==============================================================================
--- trunk/languages/lua/src/lib/luamath.pir (original)
+++ trunk/languages/lua/src/lib/luamath.pir Wed Aug 6 06:11:32 2008
@@ -48,7 +48,7 @@
=cut
.HLL 'Lua', 'lua_group'
-.namespace [ 'Lua::math' ]
+.namespace [ 'math' ]
.sub 'luaopen_math'
# print "init Lua Math\n"
Modified: trunk/languages/lua/src/lib/luaos.pir
==============================================================================
--- trunk/languages/lua/src/lib/luaos.pir (original)
+++ trunk/languages/lua/src/lib/luaos.pir Wed Aug 6 06:11:32 2008
@@ -19,7 +19,7 @@
=cut
.HLL 'Lua', 'lua_group'
-.namespace [ 'Lua::os' ]
+.namespace [ 'os' ]
.sub 'luaopen_os'
# print "init Lua OS\n"
Modified: trunk/languages/lua/src/lib/luapackage.pir
==============================================================================
--- trunk/languages/lua/src/lib/luapackage.pir (original)
+++ trunk/languages/lua/src/lib/luapackage.pir Wed Aug 6 06:11:32 2008
@@ -18,7 +18,7 @@
=cut
.HLL 'Lua', 'lua_group'
-.namespace [ 'Lua::package' ]
+.namespace [ 'package' ]
.sub 'luaopen_package'
# print "init Lua Package\n"
Modified: trunk/languages/lua/src/lib/luastring.pir
==============================================================================
--- trunk/languages/lua/src/lib/luastring.pir (original)
+++ trunk/languages/lua/src/lib/luastring.pir Wed Aug 6 06:11:32 2008
@@ -30,7 +30,7 @@
=cut
.HLL 'Lua', 'lua_group'
-.namespace [ 'Lua::string' ]
+.namespace [ 'string' ]
.sub 'luaopen_string'
# print "init Lua String\n"
Modified: trunk/languages/lua/src/lib/luatable.pir
==============================================================================
--- trunk/languages/lua/src/lib/luatable.pir (original)
+++ trunk/languages/lua/src/lib/luatable.pir Wed Aug 6 06:11:32 2008
@@ -24,7 +24,7 @@
=cut
.HLL 'Lua', 'lua_group'
-.namespace [ 'Lua::table' ]
+.namespace [ 'table' ]
.sub 'luaopen_table'
# print "init Lua Table\n"
Modified: trunk/languages/lua/src/pmc/luaany.pmc
==============================================================================
--- trunk/languages/lua/src/pmc/luaany.pmc (original)
+++ trunk/languages/lua/src/pmc/luaany.pmc Wed Aug 6 06:11:32 2008
@@ -61,7 +61,7 @@
if (dynpmc_LuaString == type) {
meta = Parrot_find_global_s(interp,
- const_string(interp, "Lua::string"),
+ const_string(interp, "string"),
const_string(interp, "mt_string"));
}
Modified: trunk/languages/lua/src/pmc/luastring.pmc
==============================================================================
--- trunk/languages/lua/src/pmc/luastring.pmc (original)
+++ trunk/languages/lua/src/pmc/luastring.pmc Wed Aug 6 06:11:32 2008
@@ -997,7 +997,7 @@
*/
METHOD PMC* get_metatable() {
PMC *retval = Parrot_find_global_s(INTERP,
- const_string(INTERP, "Lua::string"),
+ const_string(INTERP, "string"),
const_string(INTERP, "mt_string"));
if (!retval)
retval = pmc_new(INTERP, dynpmc_LuaNil);
Modified: trunk/languages/lua/t/pmc/closure.t
==============================================================================
--- trunk/languages/lua/t/pmc/closure.t (original)
+++ trunk/languages/lua/t/pmc/closure.t Wed Aug 6 06:11:32 2008
@@ -269,7 +269,7 @@
pir_output_like( << 'CODE', << 'OUTPUT', 'from pir' );
.HLL 'Lua', 'lua_group'
-.namespace [ 'Lua::basic' ]
+.namespace [ 'basic' ]
.sub _main
collectoff
luaopen_basic()
Modified: trunk/languages/lua/t/pmc/function.t
==============================================================================
--- trunk/languages/lua/t/pmc/function.t (original)
+++ trunk/languages/lua/t/pmc/function.t Wed Aug 6 06:11:32 2008
@@ -234,7 +234,7 @@
.sub __start :main
load_bytecode 'languages/lua/src/lib/luaaux.pbc'
load_bytecode 'languages/lua/src/lib/luabasic.pbc'
- $P0 = get_hll_global ['Lua::basic'], 'luaopen_basic'
+ $P0 = get_hll_global ['basic'], 'luaopen_basic'
$P0()
_main()
.end