From cc035ba6ef2ecf3884c12c2af8ad4e5fd6616f0f Mon Sep 17 00:00:00 2001 From: daurnimator Date: Wed, 26 Apr 2017 18:28:30 +1000 Subject: Export ldo.js functions from lua.js --- src/lcorolib.js | 7 +++---- src/lmathlib.js | 1 - src/ltablib.js | 1 - src/lua.js | 5 +++++ src/lundump.js | 1 - tests/lapi.js | 1 - tests/lbaselib.js | 1 - tests/lcorolib.js | 1 - tests/ldebug.js | 1 - tests/lmathlib.js | 1 - tests/load.js | 1 - tests/ltablib.js | 1 - 12 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/lcorolib.js b/src/lcorolib.js index af1a3ec..6238c6c 100644 --- a/src/lcorolib.js +++ b/src/lcorolib.js @@ -4,7 +4,6 @@ const assert = require('assert'); const lua = require('./lua.js'); const lauxlib = require('./lauxlib.js'); -const ldo = require('./ldo.js'); const lobject = require('./lobject.js'); const getco = function(L) { @@ -25,7 +24,7 @@ const auxresume = function(L, co, narg) { } lua.lua_xmove(L, co, narg); - let status = ldo.lua_resume(co, L, narg); + let status = lua.lua_resume(co, L, narg); if (status === lua.LUA_OK || status === lua.LUA_YIELD) { let nres = lua.lua_gettop(co); if (!lua.lua_checkstack(L, nres + 1)) { @@ -87,7 +86,7 @@ const luaB_cowrap = function(L) { }; const luaB_yield = function(L) { - return ldo.lua_yield(L, lua.lua_gettop(L)); + return lua.lua_yield(L, lua.lua_gettop(L)); }; const luaB_costatus = function(L) { @@ -118,7 +117,7 @@ const luaB_costatus = function(L) { }; const luaB_yieldable = function(L) { - lua.lua_pushboolean(L, ldo.lua_isyieldable(L)); + lua.lua_pushboolean(L, lua.lua_isyieldable(L)); return 1; }; diff --git a/src/lmathlib.js b/src/lmathlib.js index 8ee9f71..6c666b1 100644 --- a/src/lmathlib.js +++ b/src/lmathlib.js @@ -6,7 +6,6 @@ const seedrandom = require('seedrandom'); const lua = require('./lua.js'); const lauxlib = require('./lauxlib.js'); const lstate = require('./lstate.js'); -const ldo = require('./ldo.js'); const llimit = require('./llimit.js'); const luaconf = require('./luaconf.js'); diff --git a/src/ltablib.js b/src/ltablib.js index 08cf4d6..ba3d374 100644 --- a/src/ltablib.js +++ b/src/ltablib.js @@ -6,7 +6,6 @@ const lua = require('./lua.js'); const lapi = require('./lapi.js'); const lauxlib = require('./lauxlib.js'); const lstate = require('./lstate.js'); -const ldo = require('./ldo.js'); const llimit = require('./llimit.js'); const lobject = require('./lobject.js'); diff --git a/src/lua.js b/src/lua.js index 17df09b..047926f 100644 --- a/src/lua.js +++ b/src/lua.js @@ -4,6 +4,7 @@ const defs = require("./defs.js"); const lapi = require("./lapi.js"); const ldebug = require("./ldebug.js"); +const ldo = require("./ldo.js"); const lstate = require("./lstate.js"); module.exports.FENGARI_AUTHORS = defs.FENGARI_AUTHORS; @@ -120,6 +121,7 @@ module.exports.lua_isstring = lapi.lua_isstring; module.exports.lua_istable = lapi.lua_istable; module.exports.lua_isthread = lapi.lua_isthread; module.exports.lua_isuserdata = lapi.lua_isuserdata; +module.exports.lua_isyieldable = ldo.lua_isyieldable; module.exports.lua_len = lapi.lua_len; module.exports.lua_load = lapi.lua_load; module.exports.lua_newtable = lapi.lua_newtable; @@ -155,6 +157,7 @@ module.exports.lua_rawlen = lapi.lua_rawlen; module.exports.lua_rawset = lapi.lua_rawset; module.exports.lua_rawsetp = lapi.lua_rawsetp; module.exports.lua_remove = lapi.lua_remove; +module.exports.lua_resume = ldo.lua_resume; module.exports.lua_replace = lapi.lua_replace; module.exports.lua_rotate = lapi.lua_rotate; module.exports.lua_setfield = lapi.lua_setfield; @@ -187,3 +190,5 @@ module.exports.lua_upvalueid = lapi.lua_upvalueid; module.exports.lua_upvaluejoin = lapi.lua_upvaluejoin; module.exports.lua_version = lapi.lua_version; module.exports.lua_xmove = lapi.lua_xmove; +module.exports.lua_yield = ldo.lua_yield; +module.exports.lua_yieldk = ldo.lua_yieldk; diff --git a/src/lundump.js b/src/lundump.js index e2daf6e..3d7233c 100644 --- a/src/lundump.js +++ b/src/lundump.js @@ -1,7 +1,6 @@ /*jshint esversion: 6 */ "use strict"; -const fs = require('fs'); const assert = require('assert'); const defs = require('./defs.js'); diff --git a/tests/lapi.js b/tests/lapi.js index 1e3624f..2221ba6 100644 --- a/tests/lapi.js +++ b/tests/lapi.js @@ -8,7 +8,6 @@ const getState = tests.getState; const toByteCode = tests.toByteCode; const VM = require("../src/lvm.js"); -const ldo = require("../src/ldo.js"); const lauxlib = require("../src/lauxlib.js"); const lua = require('../src/lua.js'); const linit = require('../src/linit.js'); diff --git a/tests/lbaselib.js b/tests/lbaselib.js index abde72c..bf571dd 100644 --- a/tests/lbaselib.js +++ b/tests/lbaselib.js @@ -8,7 +8,6 @@ const getState = tests.getState; const toByteCode = tests.toByteCode; const VM = require("../src/lvm.js"); -const ldo = require("../src/ldo.js"); const lauxlib = require("../src/lauxlib.js"); const lua = require('../src/lua.js'); const linit = require('../src/linit.js'); diff --git a/tests/lcorolib.js b/tests/lcorolib.js index 29f9b34..d2fc8c9 100644 --- a/tests/lcorolib.js +++ b/tests/lcorolib.js @@ -8,7 +8,6 @@ const getState = tests.getState; const toByteCode = tests.toByteCode; const VM = require("../src/lvm.js"); -const ldo = require("../src/ldo.js"); const lauxlib = require("../src/lauxlib.js"); const lua = require('../src/lua.js'); const linit = require('../src/linit.js'); diff --git a/tests/ldebug.js b/tests/ldebug.js index 751c9c2..bee5cd6 100644 --- a/tests/ldebug.js +++ b/tests/ldebug.js @@ -8,7 +8,6 @@ const getState = tests.getState; const toByteCode = tests.toByteCode; const lvm = require("../src/lvm.js"); -const ldo = require("../src/ldo.js"); const lauxlib = require("../src/lauxlib.js"); const lua = require('../src/lua.js'); const linit = require('../src/linit.js'); diff --git a/tests/lmathlib.js b/tests/lmathlib.js index d39e762..dd0785c 100644 --- a/tests/lmathlib.js +++ b/tests/lmathlib.js @@ -8,7 +8,6 @@ const getState = tests.getState; const toByteCode = tests.toByteCode; const VM = require("../src/lvm.js"); -const ldo = require("../src/ldo.js"); const lauxlib = require("../src/lauxlib.js"); const lua = require('../src/lua.js'); const linit = require('../src/linit.js'); diff --git a/tests/load.js b/tests/load.js index 2b346aa..5f0e438 100644 --- a/tests/load.js +++ b/tests/load.js @@ -6,7 +6,6 @@ const tests = require("./tests.js"); const toByteCode = tests.toByteCode; const VM = require("../src/lvm.js"); -const ldo = require("../src/ldo.js"); const lauxlib = require("../src/lauxlib.js"); const lua = require('../src/lua.js'); const linit = require('../src/linit.js'); diff --git a/tests/ltablib.js b/tests/ltablib.js index 946742b..535876a 100644 --- a/tests/ltablib.js +++ b/tests/ltablib.js @@ -8,7 +8,6 @@ const getState = tests.getState; const toByteCode = tests.toByteCode; const VM = require("../src/lvm.js"); -const ldo = require("../src/ldo.js"); const lauxlib = require("../src/lauxlib.js"); const lua = require('../src/lua.js'); const linit = require('../src/linit.js'); -- cgit v1.2.3-70-g09d2