Backout changeset 57172a7f03452a6b07f346e850f3e1020e230f46

This commit is contained in:
Alex Szpakowski
2014-06-05 14:59:29 -03:00
parent e9e303c1e8
commit 3792dee4b4
7 changed files with 5520 additions and 29 deletions
@@ -390,6 +390,7 @@
0EB870A1180261FD424A41B3 /* Shape.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Shape.h; sourceTree = "<group>"; };
0F0E666B7C790BB870477994 /* b2BlockAllocator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = b2BlockAllocator.h; sourceTree = "<group>"; };
0F8D03F1544476B57CA97B01 /* b2WorldCallbacks.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = b2WorldCallbacks.cpp; sourceTree = "<group>"; };
104144AB73A974BC04A03131 /* graphics.lua.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = graphics.lua.h; sourceTree = "<group>"; };
104D5534669B772556942891 /* PrismaticJoint.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PrismaticJoint.h; sourceTree = "<group>"; };
104D567660003ADE696D341A /* Source.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Source.h; sourceTree = "<group>"; };
10A608C96F067F972C962EFB /* love.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = love.h; sourceTree = "<group>"; };
@@ -603,6 +604,7 @@
4F1862D324C9429157A27A2E /* Event.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Event.h; sourceTree = "<group>"; };
4F34010A575C02E66D400CE2 /* RopeJoint.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RopeJoint.h; sourceTree = "<group>"; };
4F3E12BD4A646D0366792FC9 /* b2WorldCallbacks.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = b2WorldCallbacks.h; sourceTree = "<group>"; };
503971A86B7167A91B670FBA /* boot.lua.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = boot.lua.h; sourceTree = "<group>"; };
505F23A73BFE250833D650E4 /* Image.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Image.cpp; sourceTree = "<group>"; };
50B67F2D0CC511706810302E /* wrap_GearJoint.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_GearJoint.cpp; sourceTree = "<group>"; };
50EC67CE3ED71F5D13304FD4 /* b2Contact.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = b2Contact.h; sourceTree = "<group>"; };
@@ -793,6 +795,7 @@
FA577A8616C71CF000860150 /* Shader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Shader.h; sourceTree = "<group>"; };
FA577A8716C71CF000860150 /* wrap_Shader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Shader.cpp; sourceTree = "<group>"; };
FA577A8816C71CF000860150 /* wrap_Shader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Shader.h; sourceTree = "<group>"; };
FA577A8C16C71D3600860150 /* auto.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = auto.lua; sourceTree = "<group>"; };
FA577A8D16C71D3600860150 /* boot.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = boot.lua; sourceTree = "<group>"; };
FA577A8E16C71D3600860150 /* graphics.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = graphics.lua; sourceTree = "<group>"; };
FA577AAF16C7507900860150 /* love.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = love.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -1292,8 +1295,11 @@
352E6C5F6F8A681766EB5299 /* scripts */ = {
isa = PBXGroup;
children = (
FA577A8C16C71D3600860150 /* auto.lua */,
FA577A8D16C71D3600860150 /* boot.lua */,
503971A86B7167A91B670FBA /* boot.lua.h */,
FA577A8E16C71D3600860150 /* graphics.lua */,
104144AB73A974BC04A03131 /* graphics.lua.h */,
);
name = scripts;
path = ../../src/scripts;
@@ -26,6 +26,7 @@
#include "font/Rasterizer.h"
#include "filesystem/wrap_Filesystem.h"
#include "scripts/graphics.lua.h"
#include <cassert>
namespace love
@@ -1503,11 +1504,6 @@ static const lua_CFunction types[] =
0
};
// Scripts.
static const char graphics_lua[] =
#include "scripts/graphics.lua"
;
extern "C" int luaopen_love_graphics(lua_State *L)
{
if (instance == 0)
@@ -1526,7 +1522,7 @@ extern "C" int luaopen_love_graphics(lua_State *L)
int n = luax_register_module(L, w);
if (luaL_loadbuffer(L, graphics_lua, sizeof(graphics_lua), "graphics.lua") == 0)
if (luaL_loadbuffer(L, (const char *)graphics_lua, sizeof(graphics_lua), "graphics.lua") == 0)
lua_call(L, 0, 0);
return n;
+4 -6
View File
@@ -44,6 +44,9 @@
# include "libraries/enet/lua-enet.h"
#endif
// Scripts
#include "scripts/boot.lua.h"
// All modules define a c-accessible luaopen
// so let's make use of those, instead
// of addressing implementations directly.
@@ -283,14 +286,9 @@ int w__openConsole(lua_State *L)
#endif // LOVE_LEGENDARY_CONSOLE_IO_HACK
// Scripts.
static const char boot_lua[] =
#include "scripts/boot.lua"
;
int luaopen_love_boot(lua_State *L)
{
if (luaL_loadbuffer(L, boot_lua, sizeof(boot_lua), "boot.lua") == 0)
if (luaL_loadbuffer(L, (const char *)love::boot_lua, sizeof(love::boot_lua), "boot.lua") == 0)
lua_call(L, 0, 1);
return 1;
+118
View File
@@ -0,0 +1,118 @@
-- Usage:
-- lua auto.lua <name1> <name2> .. <nameN>
--
-- Example:
-- lua auto.lua boot graphics
local max_width = 18
local pattern = [[
/**
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
**/
namespace love
{
// [%s]
const unsigned char %s[] =
{
%s
}; // [%s]
} // love
]]
--formatting parameters:
-- - input file name
-- - c variable name
-- - array contents
-- - input file name
function auto(name)
--the input file name
local src = name .. ".lua"
--and the output one
local dst = name .. ".lua.h"
--the name of the variable
local cpp_name = name .. "_lua"
--do a minimal code check
--(syntax errors, really)
loadfile(src)
--no error catching? no
--we have the main loop doing that for us
--what character is this on this line?
local counter = 0
local function tohex(c)
counter = counter + 1
--if we've reached the maximum width (or 0)
--then we'll carry on and add a newline
if counter % max_width == 0 then
return ("\n\t0x%02x, "):format(c:byte())
end
--otherwise we just use the hex of the current byte
return ("0x%02x, "):format(c:byte())
end
--let's open the input file
local src_file = io.open(src, "rb")
--create an output string
local out_data = ""
--go through the input file line-by-line
for line in src_file:lines() do
--if the line is non-empty
if #line > 0 then
--set the counter to -1
--this will start a new line (see tohex)
counter = -1
--append the output to what we had, plus a newline character (0x0a is newline)
out_data = ("%s%s0x0a,"):format(out_data, line:gsub("\r", ""):gsub(".", tohex))
end
end
--close our input
src_file:close()
--open, write and close the output
out_file = io.open(dst, "wb")
--see pattern above
out_file:write(pattern:format(src, cpp_name, out_data, src))
out_file:close()
--tell the world we succeeded!
print(name .. ": Success")
end
--usage
if #arg == 0 then
return print("Usage: lua auto.lua <name1> <name2> .. <name3>")
end
--the 'main' procedure
for i, v in ipairs(arg) do
--run the auto function for every argument
--but do it with pcall, to catch errors
v = v:gsub("%.lua$", ""):gsub("^(.+)/", "") -- normalize input
local ok, err = pcall(auto, v)
if not ok then
--inform people we've failed
print(v .. ": " .. err)
end
end
-9
View File
@@ -1,8 +1,3 @@
R"luastring"--(
-- DO NOT REMOVE THE ABOVE LINE. It is used to load this file as a raw string
-- literal in C++. There is a matching delimiter at the bottom of this file.
-- It is designed to avoid problems with Lua linters picking up invalid syntax.
--[[
Copyright (c) 2006-2014 LOVE Development Team
@@ -1639,7 +1634,3 @@ return function()
return tonumber(retval) or 0
end
-- DO NOT REMOVE THE NEXT LINE. It is used to load this file as a raw string
-- literal in C++.
--)luastring"--"
File diff suppressed because it is too large Load Diff
-8
View File
@@ -1,7 +1,3 @@
R"luastring"--(
-- DO NOT REMOVE THE ABOVE LINE. It is used to load this file as a raw string
-- literal in C++. There is a matching delimiter at the bottom of this file.
--[[
Copyright (c) 2006-2014 LOVE Development Team
@@ -1470,7 +1466,3 @@ void main() {
return table_concat(lines, "\n")
end
end
-- DO NOT REMOVE THE NEXT LINE. It is used to load this file as a raw string
-- literal in C++.
--)luastring"--"