You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
879 B
Lua
29 lines
879 B
Lua
local base = string.match(..., "(.-)[^%.]+%.[^%.]+$")
|
|
local ffi = require("ffi")
|
|
local fh = require(base.."helper.ffi_struct")
|
|
local id = require(base.."ev_api.id").new
|
|
local string_escape = require(base.."helper.string").escape
|
|
|
|
local ffi_string = ffi.string
|
|
|
|
local format = string.format
|
|
|
|
local mt, index = {}, {}
|
|
|
|
function index:get_id() return id(self.raw.id) end
|
|
-- TODO: probably not the most optimal
|
|
function index:set_id(...) self.raw.id = id(...).raw end
|
|
|
|
function index:get_name() return ffi_string(self.raw.name) end
|
|
function index:set_name(n) self.raw.name = n end
|
|
|
|
fh.gen_raw_accessor(index, "ff_effects_max")
|
|
|
|
function index:tostring()
|
|
return format("setup{id=%s, name=%s, ff_effects_max=%d}",
|
|
self.id, string_escape(self.name), self.ff_effects_max)
|
|
end
|
|
mt.__tostring = index.tostring
|
|
|
|
return fh.base(mt, index, ffi.typeof("struct uinput_setup"))
|