Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local rptr = ...
- local ffi = require("ffi")
- local r_exceptionbox = require("reflection.exceptionbox")
- local r_wrapobject = require("reflection.wrapobject")
- local r_unwrapobject = require("reflection.unwrapobject")
- ffi.cdef([[
- ]] .. --[==[
- src/rsbin/storage.hpp:10:2:
- rsbin> StorageMap = class() [[r::name("storagemap")]] [[r::struct]]
- ]==] [[
- typedef struct rsbin_storagemap {
- uint8_t* ptr;
- uint32_t length;
- } rsbin_storagemap;
- ]] .. --[==[
- src/rsbin/storage.hpp:16:2:
- rsbin> MapTask = class(Task) [[r::class]] [[r::name("maptask")]]
- ]==] [[
- typedef void rsbin_maptask;
- typedef struct r_rsbin_maptask_box {
- rsbin_maptask* object;
- void(*cfreeptr)(struct r_rsbin_maptask_box* self);
- void* freeptr;
- } r_rsbin_maptask_box;
- ]] .. --[==[
- src/rsbin/storage.hpp:21:11:
- rsbin::MapTask> getmap = object function []: StorageMap [[r::method]]
- ]==] [[
- ]] .. --[==[
- src/rsbin/storage.hpp:24:2:
- rsbin> GetLimitTask = class(Task) [[r::class]] [[r::name("getlimittask")]]
- ]==] [[
- typedef void rsbin_getlimittask;
- typedef struct r_rsbin_getlimittask_box {
- rsbin_getlimittask* object;
- void(*cfreeptr)(struct r_rsbin_getlimittask_box* self);
- void* freeptr;
- } r_rsbin_getlimittask_box;
- ]] .. --[==[
- src/rsbin/storage.hpp:29:11:
- rsbin::GetLimitTask> getlimit = object function []: uint64_t [[r::method]]
- ]==] [[
- ]] .. --[==[
- src/rsbin/storage.hpp:32:2:
- rsbin> Storage = class(RefObject) [[r::class]] [[r::name("storage")]]
- ]==] [[
- typedef void rsbin_storage;
- typedef struct r_rsbin_storage_box {
- rsbin_storage* object;
- void(*cfreeptr)(struct r_rsbin_storage_box* self);
- void* freeptr;
- } r_rsbin_storage_box;
- ]] .. --[==[
- src/rsbin/storage.hpp:41:11:
- rsbin::Storage> startmap = object function [offset: uint64_t, length: uint32_t, flagread: bool, flagwrite: bool]: Ref<MapTask> [[r::method]]
- ]==] [[
- ]] .. --[==[
- src/rsbin/storage.hpp:45:11:
- rsbin::Storage> startgetlimit = object function [plimit: pointer uint64_t]: Ref<GetLimitTask> [[r::method]]
- ]==] [[
- ]] .. --[==[
- src/rsbin/storage.hpp:47:11:
- rsbin::Storage> startsetlimit = object function [limit: uint64_t]: Ref<Task> [[r::method]]
- ]==] [[
- ]] .. --[==[
- src/rsbin/storage.hpp:49:11:
- rsbin::Storage> startflush = object function []: Ref<Task> [[r::method]]
- ]==] [[
- ]] .. --[==[
- src/rsbin/storage.hpp:51:11:
- rsbin::Storage> startclose = object function []: Ref<Task> [[r::method]]
- ]==] [[
- ]] .. --[==[
- src/rsbin/storage.hpp:55:1:
- r_emit
- ]==] [[
- ]])
- local ptrtype = [[
- struct{
- ]] .. --[==[
- src/rsbin/storage.hpp:10:2:
- rsbin> StorageMap = class() [[r::name("storagemap")]] [[r::struct]]
- ]==] [[
- ]] .. --[==[
- src/rsbin/storage.hpp:16:2:
- rsbin> MapTask = class(Task) [[r::class]] [[r::name("maptask")]]
- ]==] [[
- ]] .. --[==[
- src/rsbin/storage.hpp:21:11:
- rsbin::MapTask> getmap = object function []: StorageMap [[r::method]]
- ]==] [[
- rsbin_storagemap (*rsbin_maptask_getmap)(rsbin_maptask* self, reflection_exceptionbox* exception);
- ]] .. --[==[
- src/rsbin/storage.hpp:24:2:
- rsbin> GetLimitTask = class(Task) [[r::class]] [[r::name("getlimittask")]]
- ]==] [[
- ]] .. --[==[
- src/rsbin/storage.hpp:29:11:
- rsbin::GetLimitTask> getlimit = object function []: uint64_t [[r::method]]
- ]==] [[
- uint64_t (*rsbin_getlimittask_getlimit)(rsbin_getlimittask* self, reflection_exceptionbox* exception);
- ]] .. --[==[
- src/rsbin/storage.hpp:32:2:
- rsbin> Storage = class(RefObject) [[r::class]] [[r::name("storage")]]
- ]==] [[
- ]] .. --[==[
- src/rsbin/storage.hpp:41:11:
- rsbin::Storage> startmap = object function [offset: uint64_t, length: uint32_t, flagread: bool, flagwrite: bool]: Ref<MapTask> [[r::method]]
- ]==] [[
- r_rsbin_maptask_box (*rsbin_storage_startmap)(rsbin_storage* self, uint64_t arg1, uint32_t arg2, bool arg3, bool arg4, reflection_exceptionbox* exception);
- ]] .. --[==[
- src/rsbin/storage.hpp:45:11:
- rsbin::Storage> startgetlimit = object function [plimit: pointer uint64_t]: Ref<GetLimitTask> [[r::method]]
- ]==] [[
- r_rsbin_getlimittask_box (*rsbin_storage_startgetlimit)(rsbin_storage* self, uint64_t* arg1, reflection_exceptionbox* exception);
- ]] .. --[==[
- src/rsbin/storage.hpp:47:11:
- rsbin::Storage> startsetlimit = object function [limit: uint64_t]: Ref<Task> [[r::method]]
- ]==] [[
- r_task_box (*rsbin_storage_startsetlimit)(rsbin_storage* self, uint64_t arg1, reflection_exceptionbox* exception);
- ]] .. --[==[
- src/rsbin/storage.hpp:49:11:
- rsbin::Storage> startflush = object function []: Ref<Task> [[r::method]]
- ]==] [[
- r_task_box (*rsbin_storage_startflush)(rsbin_storage* self, reflection_exceptionbox* exception);
- ]] .. --[==[
- src/rsbin/storage.hpp:51:11:
- rsbin::Storage> startclose = object function []: Ref<Task> [[r::method]]
- ]==] [[
- r_task_box (*rsbin_storage_startclose)(rsbin_storage* self, reflection_exceptionbox* exception);
- ]] .. --[==[
- src/rsbin/storage.hpp:55:1:
- r_emit
- ]==] [[
- }*
- ]]
- local r = ffi.cast(ptrtype, rptr)
- --[==[
- src/rsbin/storage.hpp:10:2:
- rsbin> StorageMap = class() [[r::name("storagemap")]] [[r::struct]]
- ]==]
- local rsbin_storagemap = package.loaded["base.ffipure"]:module("rsbin.storagemap")
- rsbin_storagemap.typedef = "rsbin_storagemap"
- --[==[
- src/rsbin/storage.hpp:16:2:
- rsbin> MapTask = class(Task) [[r::class]] [[r::name("maptask")]]
- ]==]
- local rsbin_maptask = package.loaded["task"]:module("rsbin.maptask")
- rsbin_maptask.typedef = "r_rsbin_maptask_box"
- --[==[
- src/rsbin/storage.hpp:21:11:
- rsbin::MapTask> getmap = object function []: StorageMap [[r::method]]
- ]==]
- function rsbin_maptask:getmap()
- local exception = r_exceptionbox:new()
- local result = r.rsbin_maptask_getmap(self.object, exception)
- if exception.whatptr ~= nil then
- error(exception:what())
- end
- return result
- end
- --[==[
- src/rsbin/storage.hpp:24:2:
- rsbin> GetLimitTask = class(Task) [[r::class]] [[r::name("getlimittask")]]
- ]==]
- local rsbin_getlimittask = package.loaded["task"]:module("rsbin.getlimittask")
- rsbin_getlimittask.typedef = "r_rsbin_getlimittask_box"
- --[==[
- src/rsbin/storage.hpp:29:11:
- rsbin::GetLimitTask> getlimit = object function []: uint64_t [[r::method]]
- ]==]
- function rsbin_getlimittask:getlimit()
- local exception = r_exceptionbox:new()
- local result = r.rsbin_getlimittask_getlimit(self.object, exception)
- if exception.whatptr ~= nil then
- error(exception:what())
- end
- return result
- end
- --[==[
- src/rsbin/storage.hpp:32:2:
- rsbin> Storage = class(RefObject) [[r::class]] [[r::name("storage")]]
- ]==]
- local rsbin_storage = package.loaded["refobject"]:module("rsbin.storage")
- rsbin_storage.typedef = "r_rsbin_storage_box"
- --[==[
- src/rsbin/storage.hpp:41:11:
- rsbin::Storage> startmap = object function [offset: uint64_t, length: uint32_t, flagread: bool, flagwrite: bool]: Ref<MapTask> [[r::method]]
- ]==]
- function rsbin_storage:startmap(arg1, arg2, arg3, arg4)
- local exception = r_exceptionbox:new()
- local result = r.rsbin_storage_startmap(self.object, arg1, arg2, arg3, arg4, exception)
- if exception.whatptr ~= nil then
- error(exception:what())
- end
- return r_wrapobject(result)
- end
- --[==[
- src/rsbin/storage.hpp:45:11:
- rsbin::Storage> startgetlimit = object function [plimit: pointer uint64_t]: Ref<GetLimitTask> [[r::method]]
- ]==]
- function rsbin_storage:startgetlimit(arg1)
- local exception = r_exceptionbox:new()
- local result = r.rsbin_storage_startgetlimit(self.object, arg1, exception)
- if exception.whatptr ~= nil then
- error(exception:what())
- end
- return r_wrapobject(result)
- end
- --[==[
- src/rsbin/storage.hpp:47:11:
- rsbin::Storage> startsetlimit = object function [limit: uint64_t]: Ref<Task> [[r::method]]
- ]==]
- function rsbin_storage:startsetlimit(arg1)
- local exception = r_exceptionbox:new()
- local result = r.rsbin_storage_startsetlimit(self.object, arg1, exception)
- if exception.whatptr ~= nil then
- error(exception:what())
- end
- return r_wrapobject(result)
- end
- --[==[
- src/rsbin/storage.hpp:49:11:
- rsbin::Storage> startflush = object function []: Ref<Task> [[r::method]]
- ]==]
- function rsbin_storage:startflush()
- local exception = r_exceptionbox:new()
- local result = r.rsbin_storage_startflush(self.object, exception)
- if exception.whatptr ~= nil then
- error(exception:what())
- end
- return r_wrapobject(result)
- end
- --[==[
- src/rsbin/storage.hpp:51:11:
- rsbin::Storage> startclose = object function []: Ref<Task> [[r::method]]
- ]==]
- function rsbin_storage:startclose()
- local exception = r_exceptionbox:new()
- local result = r.rsbin_storage_startclose(self.object, exception)
- if exception.whatptr ~= nil then
- error(exception:what())
- end
- return r_wrapobject(result)
- end
- --[==[
- src/rsbin/storage.hpp:55:1:
- r_emit
- ]==]
- function rsbin_storage:map(offset, length, flagread, flagwrite)
- local task = self:startmap(offset, length, flagread, flagwrite)
- if not task then
- return nil, nil, 0
- end
- while not task:poll() do
- coroutine.yield()
- end
- local map = task:getmap()
- if map.ptr == nil or map.length == 0 then
- return task, nil, 0
- else
- return task, map.ptr, map.length
- end
- end
- function rsbin_storage:getlimit()
- local limit = ffi.new('uint64_t[1]')
- local task = self:startgetlimit(limit)
- if task then
- while not task:poll() do
- coroutine.yield()
- end
- local result = task:getlimit()
- task:release()
- return result
- else
- return limit[0]
- end
- end
- function rsbin_storage:setlimit(limit)
- local task = self:startsetlimit(limit)
- if task then
- while not task:poll() do
- coroutine.yield()
- end
- task:release()
- end
- end
- function rsbin_storage:flush()
- local task = self:startflush()
- if task then
- while not task:poll() do
- coroutine.yield()
- end
- task:release()
- end
- end
- function rsbin_storage:close()
- local task = self:startclose()
- if task then
- while not task:poll() do
- coroutine.yield()
- end
- task:release()
- end
- end
- --[==[
- src/rsbin/storage.hpp:10:2:
- rsbin> StorageMap = class() [[r::name("storagemap")]] [[r::struct]]
- ]==]
- rsbin_storagemap:buildmetatype()
- --[==[
- src/rsbin/storage.hpp:16:2:
- rsbin> MapTask = class(Task) [[r::class]] [[r::name("maptask")]]
- ]==]
- rsbin_maptask:buildmetatype()
- --[==[
- src/rsbin/storage.hpp:21:11:
- rsbin::MapTask> getmap = object function []: StorageMap [[r::method]]
- ]==]
- --[==[
- src/rsbin/storage.hpp:24:2:
- rsbin> GetLimitTask = class(Task) [[r::class]] [[r::name("getlimittask")]]
- ]==]
- rsbin_getlimittask:buildmetatype()
- --[==[
- src/rsbin/storage.hpp:29:11:
- rsbin::GetLimitTask> getlimit = object function []: uint64_t [[r::method]]
- ]==]
- --[==[
- src/rsbin/storage.hpp:32:2:
- rsbin> Storage = class(RefObject) [[r::class]] [[r::name("storage")]]
- ]==]
- rsbin_storage:buildmetatype()
- --[==[
- src/rsbin/storage.hpp:41:11:
- rsbin::Storage> startmap = object function [offset: uint64_t, length: uint32_t, flagread: bool, flagwrite: bool]: Ref<MapTask> [[r::method]]
- ]==]
- --[==[
- src/rsbin/storage.hpp:45:11:
- rsbin::Storage> startgetlimit = object function [plimit: pointer uint64_t]: Ref<GetLimitTask> [[r::method]]
- ]==]
- --[==[
- src/rsbin/storage.hpp:47:11:
- rsbin::Storage> startsetlimit = object function [limit: uint64_t]: Ref<Task> [[r::method]]
- ]==]
- --[==[
- src/rsbin/storage.hpp:49:11:
- rsbin::Storage> startflush = object function []: Ref<Task> [[r::method]]
- ]==]
- --[==[
- src/rsbin/storage.hpp:51:11:
- rsbin::Storage> startclose = object function []: Ref<Task> [[r::method]]
- ]==]
- --[==[
- src/rsbin/storage.hpp:55:1:
- r_emit
- ]==]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement