From 23db4f4a598cac029284426c1a662c9f498692c6 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Fri, 20 Dec 2019 00:45:20 -0400 Subject: [PATCH] =?UTF-8?q?Remove=20functions=20that=20were=20deprecated?= =?UTF-8?q?=20in=20L=C3=96VE=2011.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --HG-- branch : minor --- src/modules/audio/wrap_Audio.cpp | 9 -- src/modules/audio/wrap_Source.cpp | 11 --- src/modules/filesystem/wrap_Filesystem.cpp | 87 ------------------- src/modules/graphics/wrap_ParticleSystem.cpp | 50 ----------- src/modules/math/wrap_Math.cpp | 83 ------------------ src/modules/physics/box2d/wrap_Body.cpp | 23 ----- .../physics/box2d/wrap_PrismaticJoint.cpp | 9 -- .../physics/box2d/wrap_RevoluteJoint.cpp | 9 -- src/modules/physics/box2d/wrap_World.cpp | 23 ----- src/modules/sound/wrap_Decoder.cpp | 9 -- src/modules/sound/wrap_SoundData.cpp | 9 -- 11 files changed, 322 deletions(-) diff --git a/src/modules/audio/wrap_Audio.cpp b/src/modules/audio/wrap_Audio.cpp index 4bc4b615e..6baba5b56 100644 --- a/src/modules/audio/wrap_Audio.cpp +++ b/src/modules/audio/wrap_Audio.cpp @@ -530,12 +530,6 @@ int w_setMixWithSystem(lua_State *L) return 1; } -int w_getSourceCount(lua_State *L) -{ - luax_markdeprecated(L, "love.audio.getSourceCount", API_FUNCTION, DEPRECATED_RENAMED, "love.audio.getActiveSourceCount"); - return w_getActiveSourceCount(L); -} - // List of functions to wrap. static const luaL_Reg functions[] = { @@ -568,9 +562,6 @@ static const luaL_Reg functions[] = { "isEffectsSupported", w_isEffectsSupported }, { "setMixWithSystem", w_setMixWithSystem }, - // Deprecated - { "getSourceCount", w_getSourceCount }, - { 0, 0 } }; diff --git a/src/modules/audio/wrap_Source.cpp b/src/modules/audio/wrap_Source.cpp index 3db1dcf5a..f6509bf59 100644 --- a/src/modules/audio/wrap_Source.cpp +++ b/src/modules/audio/wrap_Source.cpp @@ -601,14 +601,6 @@ int w_Source_getType(lua_State *L) return 1; } -// Deprecated - -int w_Source_getChannels(lua_State *L) -{ - luax_markdeprecated(L, "Source:getChannels", API_METHOD, DEPRECATED_RENAMED, "Source:getChannelCount"); - return w_Source_getChannelCount(L); -} - static const luaL_Reg w_Source_functions[] = { { "clone", w_Source_clone }, @@ -662,9 +654,6 @@ static const luaL_Reg w_Source_functions[] = { "getType", w_Source_getType }, - // Deprecated - { "getChannels", w_Source_getChannels }, - { 0, 0 } }; diff --git a/src/modules/filesystem/wrap_Filesystem.cpp b/src/modules/filesystem/wrap_Filesystem.cpp index efb15706d..e2c206291 100644 --- a/src/modules/filesystem/wrap_Filesystem.cpp +++ b/src/modules/filesystem/wrap_Filesystem.cpp @@ -827,85 +827,6 @@ int extloader(lua_State *L) return 1; } -// Deprecated functions. - -int w_exists(lua_State *L) -{ - luax_markdeprecated(L, "love.filesystem.exists", API_FUNCTION, DEPRECATED_REPLACED, "love.filesystem.getInfo"); - const char *arg = luaL_checkstring(L, 1); - Filesystem::Info info = {}; - luax_pushboolean(L, instance()->getInfo(arg, info)); - return 1; -} - -int w_isDirectory(lua_State *L) -{ - luax_markdeprecated(L, "love.filesystem.isDirectory", API_FUNCTION, DEPRECATED_REPLACED, "love.filesystem.getInfo"); - const char *arg = luaL_checkstring(L, 1); - Filesystem::Info info = {}; - bool exists = instance()->getInfo(arg, info); - luax_pushboolean(L, exists && info.type == Filesystem::FILETYPE_DIRECTORY); - return 1; -} - -int w_isFile(lua_State *L) -{ - luax_markdeprecated(L, "love.filesystem.isFile", API_FUNCTION, DEPRECATED_REPLACED, "love.filesystem.getInfo"); - const char *arg = luaL_checkstring(L, 1); - Filesystem::Info info = {}; - bool exists = instance()->getInfo(arg, info); - luax_pushboolean(L, exists && info.type == Filesystem::FILETYPE_FILE); - return 1; -} - -int w_isSymlink(lua_State *L) -{ - luax_markdeprecated(L, "love.filesystem.isSymlink", API_FUNCTION, DEPRECATED_REPLACED, "love.filesystem.getInfo"); - const char *filename = luaL_checkstring(L, 1); - Filesystem::Info info = {}; - bool exists = instance()->getInfo(filename, info); - luax_pushboolean(L, exists && info.type == Filesystem::FILETYPE_SYMLINK); - return 1; -} - -int w_getLastModified(lua_State *L) -{ - luax_markdeprecated(L, "love.filesystem.getLastModified", API_FUNCTION, DEPRECATED_REPLACED, "love.filesystem.getInfo"); - - const char *filename = luaL_checkstring(L, 1); - - Filesystem::Info info = {}; - bool exists = instance()->getInfo(filename, info); - - if (!exists) - return luax_ioError(L, "File does not exist"); - else if (info.modtime == -1) - return luax_ioError(L, "Could not determine file modification date."); - - lua_pushnumber(L, (lua_Number) info.modtime); - return 1; -} - -int w_getSize(lua_State *L) -{ - luax_markdeprecated(L, "love.filesystem.getSize", API_FUNCTION, DEPRECATED_REPLACED, "love.filesystem.getInfo"); - - const char *filename = luaL_checkstring(L, 1); - - Filesystem::Info info = {}; - bool exists = instance()->getInfo(filename, info); - - if (!exists) - luax_ioError(L, "File does not exist"); - else if (info.size == -1) - return luax_ioError(L, "Could not determine file size."); - else if (info.size >= 0x20000000000000LL) - return luax_ioError(L, "Size too large to fit into a Lua number!"); - - lua_pushnumber(L, (lua_Number) info.size); - return 1; -} - // List of functions to wrap. static const luaL_Reg functions[] = { @@ -944,14 +865,6 @@ static const luaL_Reg functions[] = { "getCRequirePath", w_getCRequirePath }, { "setCRequirePath", w_setCRequirePath }, - // Deprecated. - { "exists", w_exists }, - { "isDirectory", w_isDirectory }, - { "isFile", w_isFile }, - { "isSymlink", w_isSymlink }, - { "getLastModified", w_getLastModified }, - { "getSize", w_getSize }, - { 0, 0 } }; diff --git a/src/modules/graphics/wrap_ParticleSystem.cpp b/src/modules/graphics/wrap_ParticleSystem.cpp index e8bc8865a..a169842da 100644 --- a/src/modules/graphics/wrap_ParticleSystem.cpp +++ b/src/modules/graphics/wrap_ParticleSystem.cpp @@ -713,52 +713,6 @@ int w_ParticleSystem_update(lua_State *L) return 0; } -// Deprecated functions. - -int w_ParticleSystem_setAreaSpread(lua_State *L) -{ - luax_markdeprecated(L, "ParticleSystem:setAreaSpread", API_METHOD, DEPRECATED_REPLACED, "ParticleSystem:setEmissionArea"); - - ParticleSystem *t = luax_checkparticlesystem(L, 1); - - ParticleSystem::AreaSpreadDistribution distribution = ParticleSystem::DISTRIBUTION_NONE; - float x = 0.f, y = 0.f; - - const char *str = lua_isnoneornil(L, 2) ? 0 : luaL_checkstring(L, 2); - if (str && !ParticleSystem::getConstant(str, distribution)) - return luax_enumerror(L, "particle distribution", ParticleSystem::getConstants(distribution), str); - - if (distribution != ParticleSystem::DISTRIBUTION_NONE) - { - x = (float) luaL_checknumber(L, 3); - y = (float) luaL_checknumber(L, 4); - if (x < 0.0f || y < 0.0f) - return luaL_error(L, "Invalid area spread parameters (must be >= 0)"); - } - - t->setEmissionArea(distribution, x, y, 0.0f, false); - return 0; -} - -int w_ParticleSystem_getAreaSpread(lua_State *L) -{ - luax_markdeprecated(L, "ParticleSystem:getAreaSpread", API_METHOD, DEPRECATED_REPLACED, "ParticleSystem:getEmissionArea"); - - ParticleSystem *t = luax_checkparticlesystem(L, 1); - love::Vector2 p; - float angle; - bool unused; - ParticleSystem::AreaSpreadDistribution distribution = t->getEmissionArea(p, angle, unused); - const char *str; - ParticleSystem::getConstant(distribution, str); - - lua_pushstring(L, str); - lua_pushnumber(L, p.x); - lua_pushnumber(L, p.y); - - return 3; -} - static const luaL_Reg w_ParticleSystem_functions[] = { { "clone", w_ParticleSystem_clone }, @@ -822,10 +776,6 @@ static const luaL_Reg w_ParticleSystem_functions[] = { "isStopped", w_ParticleSystem_isStopped }, { "update", w_ParticleSystem_update }, - // Deprecated. - { "setAreaSpread", w_ParticleSystem_setAreaSpread }, - { "getAreaSpread", w_ParticleSystem_getAreaSpread }, - { 0, 0 } }; diff --git a/src/modules/math/wrap_Math.cpp b/src/modules/math/wrap_Math.cpp index 1636b25f9..db775fd1a 100644 --- a/src/modules/math/wrap_Math.cpp +++ b/src/modules/math/wrap_Math.cpp @@ -26,10 +26,6 @@ #include "BezierCurve.h" #include "Transform.h" -#include "data/wrap_DataModule.h" -#include "data/wrap_CompressedData.h" -#include "data/DataModule.h" - #include #include #include @@ -350,81 +346,6 @@ int w_noise(lua_State *L) return 1; } -int w_compress(lua_State *L) -{ - using namespace love::data; - luax_markdeprecated(L, "love.math.compress", API_FUNCTION, DEPRECATED_REPLACED, "love.data.compress"); - - const char *fstr = lua_isnoneornil(L, 2) ? nullptr : luaL_checkstring(L, 2); - Compressor::Format format = Compressor::FORMAT_LZ4; - - if (fstr && !Compressor::getConstant(fstr, format)) - return luax_enumerror(L, "compressed data format", Compressor::getConstants(format), fstr); - - int level = (int) luaL_optinteger(L, 3, -1); - size_t rawsize = 0; - const char *rawbytes = nullptr; - - if (lua_isstring(L, 1)) - rawbytes = luaL_checklstring(L, 1, &rawsize); - else - { - Data *rawdata = luax_checktype(L, 1); - rawsize = rawdata->getSize(); - rawbytes = (const char *) rawdata->getData(); - } - - CompressedData *cdata = nullptr; - luax_catchexcept(L, [&](){ cdata = compress(format, rawbytes, rawsize, level); }); - - luax_pushtype(L, cdata); - cdata->release(); - return 1; -} - -int w_decompress(lua_State *L) -{ - using namespace love::data; - luax_markdeprecated(L, "love.math.decompress", API_FUNCTION, DEPRECATED_REPLACED, "love.data.decompress"); - - char *rawbytes = nullptr; - size_t rawsize = 0; - - if (luax_istype(L, 1, CompressedData::type)) - { - CompressedData *data = luax_checkcompresseddata(L, 1); - rawsize = data->getDecompressedSize(); - luax_catchexcept(L, [&](){ rawbytes = decompress(data, rawsize); }); - } - else - { - Compressor::Format format = Compressor::FORMAT_LZ4; - const char *fstr = luaL_checkstring(L, 2); - - if (!Compressor::getConstant(fstr, format)) - return luax_enumerror(L, "compressed data format", Compressor::getConstants(format), fstr); - - size_t compressedsize = 0; - const char *cbytes = nullptr; - - if (luax_istype(L, 1, Data::type)) - { - Data *data = luax_checktype(L, 1); - cbytes = (const char *) data->getData(); - compressedsize = data->getSize(); - } - else - cbytes = luaL_checklstring(L, 1, &compressedsize); - - luax_catchexcept(L, [&](){ rawbytes = decompress(format, cbytes, compressedsize, rawsize); }); - } - - lua_pushlstring(L, rawbytes, rawsize); - delete[] rawbytes; - - return 1; -} - // C functions in a struct, necessary for the FFI versions of math functions. struct FFI_Math { @@ -463,10 +384,6 @@ static const luaL_Reg functions[] = { "linearToGamma", w_linearToGamma }, { "noise", w_noise }, - // Deprecated. - { "compress", w_compress }, - { "decompress", w_decompress }, - { 0, 0 } }; diff --git a/src/modules/physics/box2d/wrap_Body.cpp b/src/modules/physics/box2d/wrap_Body.cpp index c465148d4..53214b220 100644 --- a/src/modules/physics/box2d/wrap_Body.cpp +++ b/src/modules/physics/box2d/wrap_Body.cpp @@ -619,24 +619,6 @@ int w_Body_getUserData(lua_State *L) return t->getUserData(L); } -int w_Body_getFixtureList(lua_State *L) -{ - luax_markdeprecated(L, "Body:getFixtureList", API_METHOD, DEPRECATED_RENAMED, "Body:getFixtures"); - return w_Body_getFixtures(L); -} - -int w_Body_getJointList(lua_State *L) -{ - luax_markdeprecated(L, "Body:getJointList", API_METHOD, DEPRECATED_RENAMED, "Body:getJoints"); - return w_Body_getJoints(L); -} - -int w_Body_getContactList(lua_State *L) -{ - luax_markdeprecated(L, "Body:getContactList", API_METHOD, DEPRECATED_RENAMED, "Body:getContacts"); - return w_Body_getContacts(L); -} - static const luaL_Reg w_Body_functions[] = { { "getX", w_Body_getX }, @@ -701,11 +683,6 @@ static const luaL_Reg w_Body_functions[] = { "setUserData", w_Body_setUserData }, { "getUserData", w_Body_getUserData }, - // Deprectaed - { "getFixtureList", w_Body_getFixtureList }, - { "getJointList", w_Body_getJointList }, - { "getContactList", w_Body_getContactList }, - { 0, 0 } }; diff --git a/src/modules/physics/box2d/wrap_PrismaticJoint.cpp b/src/modules/physics/box2d/wrap_PrismaticJoint.cpp index 52bef31a5..4dfabb28a 100644 --- a/src/modules/physics/box2d/wrap_PrismaticJoint.cpp +++ b/src/modules/physics/box2d/wrap_PrismaticJoint.cpp @@ -178,12 +178,6 @@ int w_PrismaticJoint_getReferenceAngle(lua_State *L) return 1; } -int w_PrismaticJoint_hasLimitsEnabled(lua_State *L) -{ - luax_markdeprecated(L, "PrismaticJoint:hasLimitsEnabled", API_METHOD, DEPRECATED_RENAMED, "PrismaticJoint:areLimitsEnabled"); - return w_PrismaticJoint_areLimitsEnabled(L); -} - static const luaL_Reg w_PrismaticJoint_functions[] = { { "getJointTranslation", w_PrismaticJoint_getJointTranslation }, @@ -206,9 +200,6 @@ static const luaL_Reg w_PrismaticJoint_functions[] = { "getAxis", w_PrismaticJoint_getAxis }, { "getReferenceAngle", w_PrismaticJoint_getReferenceAngle }, - // Deprecated - { "hasLimitsEnabled", w_PrismaticJoint_hasLimitsEnabled }, - { 0, 0 } }; diff --git a/src/modules/physics/box2d/wrap_RevoluteJoint.cpp b/src/modules/physics/box2d/wrap_RevoluteJoint.cpp index 64b0c0cd4..843f88745 100644 --- a/src/modules/physics/box2d/wrap_RevoluteJoint.cpp +++ b/src/modules/physics/box2d/wrap_RevoluteJoint.cpp @@ -171,12 +171,6 @@ int w_RevoluteJoint_getReferenceAngle(lua_State *L) return 1; } -int w_RevoluteJoint_hasLimitsEnabled(lua_State *L) -{ - luax_markdeprecated(L, "RevoluteJoint:hasLimitsEnabled", API_METHOD, DEPRECATED_RENAMED, "RevoluteJoint:areLimitsEnabled"); - return w_RevoluteJoint_areLimitsEnabled(L); -} - static const luaL_Reg w_RevoluteJoint_functions[] = { { "getJointAngle", w_RevoluteJoint_getJointAngle }, @@ -198,9 +192,6 @@ static const luaL_Reg w_RevoluteJoint_functions[] = { "getLimits", w_RevoluteJoint_getLimits }, { "getReferenceAngle", w_RevoluteJoint_getReferenceAngle }, - // Deprecated - { "hasLimitsEnabled", w_RevoluteJoint_hasLimitsEnabled }, - { 0, 0 } }; diff --git a/src/modules/physics/box2d/wrap_World.cpp b/src/modules/physics/box2d/wrap_World.cpp index 3614d4ef7..bc015c35d 100644 --- a/src/modules/physics/box2d/wrap_World.cpp +++ b/src/modules/physics/box2d/wrap_World.cpp @@ -208,24 +208,6 @@ int w_World_isDestroyed(lua_State *L) return 1; } -int w_World_getBodyList(lua_State *L) -{ - luax_markdeprecated(L, "World:getBodyList", API_METHOD, DEPRECATED_RENAMED, "World:getBodies"); - return w_World_getBodies(L); -} - -int w_World_getJointList(lua_State *L) -{ - luax_markdeprecated(L, "World:getJointList", API_METHOD, DEPRECATED_RENAMED, "World:getJoints"); - return w_World_getJoints(L); -} - -int w_World_getContactList(lua_State *L) -{ - luax_markdeprecated(L, "World:getContactList", API_METHOD, DEPRECATED_RENAMED, "World:getContacts"); - return w_World_getContacts(L); -} - static const luaL_Reg w_World_functions[] = { { "update", w_World_update }, @@ -250,11 +232,6 @@ static const luaL_Reg w_World_functions[] = { "destroy", w_World_destroy }, { "isDestroyed", w_World_isDestroyed }, - // Deprecated - { "getBodyList", w_World_getBodyList }, - { "getJointList", w_World_getJointList }, - { "getContactList", w_World_getContactList }, - { 0, 0 } }; diff --git a/src/modules/sound/wrap_Decoder.cpp b/src/modules/sound/wrap_Decoder.cpp index 7feed4223..a11f65630 100644 --- a/src/modules/sound/wrap_Decoder.cpp +++ b/src/modules/sound/wrap_Decoder.cpp @@ -106,12 +106,6 @@ int w_Decoder_seek(lua_State *L) return 0; } -int w_Decoder_getChannels(lua_State *L) -{ - luax_markdeprecated(L, "Decoder:getChannels", API_METHOD, DEPRECATED_RENAMED, "Decoder:getChannelCount"); - return w_Decoder_getChannelCount(L); -} - static const luaL_Reg w_Decoder_functions[] = { { "clone", w_Decoder_clone }, @@ -122,9 +116,6 @@ static const luaL_Reg w_Decoder_functions[] = { "decode", w_Decoder_decode }, { "seek", w_Decoder_seek }, - // Deprecated - { "getChannels", w_Decoder_getChannels }, - { 0, 0 } }; diff --git a/src/modules/sound/wrap_SoundData.cpp b/src/modules/sound/wrap_SoundData.cpp index 7158254af..ac13fec46 100644 --- a/src/modules/sound/wrap_SoundData.cpp +++ b/src/modules/sound/wrap_SoundData.cpp @@ -121,12 +121,6 @@ int w_SoundData_getSample(lua_State *L) return 1; } -int w_SoundData_getChannels(lua_State *L) -{ - luax_markdeprecated(L, "SoundData:getChannels", API_METHOD, DEPRECATED_RENAMED, "SoundData:getChannelCount"); - return w_SoundData_getChannelCount(L); -} - static const luaL_Reg w_SoundData_functions[] = { { "clone", w_SoundData_clone }, @@ -138,9 +132,6 @@ static const luaL_Reg w_SoundData_functions[] = { "setSample", w_SoundData_setSample }, { "getSample", w_SoundData_getSample }, - // Deprecated - { "getChannels", w_SoundData_getChannels }, - { 0, 0 } };