Permalink
Browse files

[Lua] merge branch opengl4lua

  • Loading branch information...
1 parent caf6b0b commit c6c262f8f25939c65bbbd19e3e818850722adf8f fperrad committed Aug 15, 2008
Showing with 1,553 additions and 2,788 deletions.
  1. +14 −1 config/makefiles/root.in
  2. +3 −4 demo/triangle.lua
  3. +67 −0 src/lib/_helpers.pir
  4. +584 −0 src/lib/gl.lua
  5. +0 −2,774 src/lib/gl.pir
  6. +822 −0 src/lib/gl_binding.pir
  7. +21 −7 src/lib/luaaux.pir
  8. +1 −1 src/lib/luapackage.pir
  9. +16 −0 src/pmc/luatable.pmc
  10. +25 −1 t/gl.t
View
@@ -89,7 +89,9 @@ GEN_PIR = \
src/lua51_gen.pir \
src/PASTGrammar_gen.pir \
src/POSTGrammar_gen.pir \
- $(LIBPATH)/luabytecode_gen.pir
+ $(LIBPATH)/luabytecode_gen.pir \
+ $(LIBPATH)/gl.pir \
+ $(LIBPATH)/sha1.pir
GEN_PBC = \
lua.pbc
@@ -98,11 +100,13 @@ all: \
$(PMCDIR)/lua_group$(LOAD_EXT) \
$(LIB_PBCS) \
$(LIBPATH)/luaperl.pbc \
+ $(LIBPATH)/_helpers.pbc \
$(LIBPATH)/alarm.pbc \
$(LIBPATH)/base64.pbc \
$(LIBPATH)/bc.pbc \
$(LIBPATH)/bitlib.pbc \
$(LIBPATH)/gl.pbc \
+ $(LIBPATH)/gl_binding.pbc \
$(LIBPATH)/glut.pbc \
$(LIBPATH)/lfs.pbc \
$(LIBPATH)/md5.pbc \
@@ -186,6 +190,9 @@ $(LIBPATH)/luadebug.pbc: $(LIBPATH)/luadebug.pir
$(LIBPATH)/luabytecode.pbc: $(LIBPATH)/luabytecode.pir $(LIBPATH)/luabytecode_gen.pir
-$(PARROT) --output=$(LIBPATH)/luabytecode.pbc $(LIBPATH)/luabytecode.pir
+$(LIBPATH)/_helpers.pbc: $(LIBPATH)/_helpers.pir
+ $(PARROT) --output=$(LIBPATH)/_helpers.pbc $(LIBPATH)/_helpers.pir
+
$(LIBPATH)/alarm.pbc: $(LIBPATH)/alarm.pir
-$(PARROT) --output=$(LIBPATH)/alarm.pbc $(LIBPATH)/alarm.pir
@@ -198,9 +205,15 @@ $(LIBPATH)/bc.pbc: $(LIBPATH)/bc.pir
$(LIBPATH)/bitlib.pbc: $(LIBPATH)/bitlib.pir
-$(PARROT) --output=$(LIBPATH)/bitlib.pbc $(LIBPATH)/bitlib.pir
+$(LIBPATH)/gl.pir: $(LIBPATH)/gl.lua lua.pbc
+ -$(PARROT) luap.pir --target=pir $(LIBPATH)/gl.lua > $(LIBPATH)/gl.pir
+
$(LIBPATH)/gl.pbc: $(LIBPATH)/gl.pir
-$(PARROT) --output=$(LIBPATH)/gl.pbc $(LIBPATH)/gl.pir
+$(LIBPATH)/gl_binding.pbc: $(LIBPATH)/gl_binding.pir
+ -$(PARROT) --output=$(LIBPATH)/gl_binding.pbc $(LIBPATH)/gl_binding.pir
+
$(LIBPATH)/glut.pbc: $(LIBPATH)/glut.pir
-$(PARROT) --output=$(LIBPATH)/glut.pbc $(LIBPATH)/glut.pir
View
@@ -3,7 +3,7 @@
triangle.lua - Initialize GLUT and render a simple OpenGL animation
- $ ./parrot languages/lua/lua.pbc languages/lua/demo/triangle.lua
+ $ ./parrot --no-gc languages/lua/lua.pbc languages/lua/demo/triangle.lua
]]
@@ -29,13 +29,13 @@ function Idle ()
prev_time = now
if rotating and dt ~= 0 then
gl.Rotate(360*dt, 0, 1, 0)
- glut.PostRedisplay()
+ glut.PostRedisplay()
end
end
function Keyboard (key)
if key == 27 or key == 81 or key == 113 then
- glut.DestroyWindow(glut_window)
+ glut.DestroyWindow(glut_window)
end
rotating = not rotating
end
@@ -50,4 +50,3 @@ glut.IdleFunc('Idle')
glut.KeyboardFunc('Keyboard')
glut.MainLoop()
-
View
@@ -0,0 +1,67 @@
+# Copyright (C) 2008, The Perl Foundation.
+# $Id$
+
+=head1 NAME
+
+lib/_helpers.pir - library
+
+=head1 DESCRIPTION
+
+=head2 Functions
+
+=over 4
+
+=cut
+
+.HLL 'Lua', 'lua_group'
+.namespace []
+
+.sub '__onload' :anon :load
+# print "__onload _helpers\n"
+ .const .Sub entry = 'luaopen__helpers'
+ set_hll_global 'luaopen__helpers', entry
+.end
+
+.sub 'luaopen__helpers'
+
+# print "luaopen__helpers\n"
+
+ .local pmc _lua__GLOBAL
+ _lua__GLOBAL = get_hll_global '_G'
+
+ new $P1, 'LuaString'
+
+ .local pmc __helpers
+ new __helpers, 'LuaTable'
+ set $P1, '_helpers'
+ _lua__GLOBAL[$P1] = __helpers
+
+ $P2 = split "\n", <<'LIST'
+lua_isboolean
+lua_isfunction
+lua_isnil
+lua_isnumber
+lua_isstring
+lua_istable
+lua_isuserdata
+LIST
+ lua_register($P1, __helpers, $P2)
+
+ .return (__helpers)
+.end
+
+
+=back
+
+=head1 AUTHORS
+
+Francois Perrad
+
+=cut
+
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
Oops, something went wrong.

0 comments on commit c6c262f

Please sign in to comment.