summaryrefslogtreecommitdiff
path: root/meta/template
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-11-30 13:23:53 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-11-30 13:23:53 +0800
commitcd42d1141cfa7352d97e0d66ab93f31772578a5d (patch)
treef045dfcfb26c0ce820b85debcb1447e3f6a9c256 /meta/template
parent610fe9243f785c2388321d5ea84ca3973bea9dfc (diff)
downloadlua-language-server-cd42d1141cfa7352d97e0d66ab93f31772578a5d.zip
metas of LuaJIT
Diffstat (limited to 'meta/template')
-rw-r--r--meta/template/bit.lua67
-rw-r--r--meta/template/ffi.lua110
-rw-r--r--meta/template/jit.lua31
3 files changed, 208 insertions, 0 deletions
diff --git a/meta/template/bit.lua b/meta/template/bit.lua
new file mode 100644
index 00000000..09b69194
--- /dev/null
+++ b/meta/template/bit.lua
@@ -0,0 +1,67 @@
+---@meta
+
+---@version JIT
+---@class bit*
+local bit = {}
+
+---@param x integer
+---@return integer y
+function bit.tobit(x) end
+
+---@param x integer
+---@param n? integer
+---@return integer y
+function bit.tohex(x, n) end
+
+---@param x integer
+---@return integer y
+function bit.bnot(x) end
+
+---@param x integer
+---@param x2 integer
+---@vararg integer
+---@return integer y
+function bit.bor(x, x2, ...) end
+
+---@param x integer
+---@param x2 integer
+---@vararg integer
+---@return integer y
+function bit.band(x, x2, ...) end
+
+---@param x integer
+---@param x2 integer
+---@vararg integer
+---@return integer y
+function bit.bxor(x, x2, ...) end
+
+---@param x integer
+---@param n integer
+---@return integer y
+function bit.lshift(x, n) end
+
+---@param x integer
+---@param n integer
+---@return integer y
+function bit.rshift(x, n) end
+
+---@param x integer
+---@param n integer
+---@return integer y
+function bit.arshift(x, n) end
+
+---@param x integer
+---@param n integer
+---@return integer y
+function bit.rol(x, n) end
+
+---@param x integer
+---@param n integer
+---@return integer y
+function bit.ror(x, n) end
+
+---@param x integer
+---@return integer y
+function bit.bswap(x) end
+
+return bit
diff --git a/meta/template/ffi.lua b/meta/template/ffi.lua
new file mode 100644
index 00000000..7ffe0e47
--- /dev/null
+++ b/meta/template/ffi.lua
@@ -0,0 +1,110 @@
+---@meta
+
+---@class ffi.namespace*: table
+
+---@class ffi.cdecl*: string
+---@class ffi.ctype*: userdata
+local ctype
+---@class ffi.cdata*: userdata
+---@alias ffi.ct* ffi.cdecl*|ffi.ctype*|ffi.cdata*
+---@class ffi.cb*: userdata
+local cb
+---@class ffi.VLA*: userdata
+---@class ffi.VLS*: userdata
+
+---@version JIT
+---@class ffi*
+---@field C ffi.namespace*
+---@field os string
+---@field arch string
+local ffi = {}
+
+---@param def string
+function ffi.cdef(def) end
+
+---@param name string
+---@param global? boolean
+---@return ffi.namespace* clib
+function ffi.load(name, global) end
+
+---@param ct ffi.ct*
+---@param nelem? integer
+---@param init? any
+---@return ffi.cdata* cdata
+function ffi.new(ct, nelem, init, ...) end
+
+---@param nelem? integer
+---@param init? any
+---@return ffi.cdata* cdata
+function ctype(nelem, init, ...) end
+
+---@param ct ffi.ct*
+---@return ffi.ctype* ctype
+function ffi.typeof(ct) end
+
+---@param ct ffi.ct*
+---@param init any
+---@return ffi.cdata* cdata
+function ffi.cast(ct, init) end
+
+---@param ct ffi.ct*
+---@param metatable table
+---@return ffi.ctype* ctype
+function ffi.metatype(ct, metatable) end
+
+---@param cdata ffi.cdata*
+---@param finalizer function
+---@return ffi.cdata* cdata
+function ffi.gc(cdata, finalizer) end
+
+---@param ct ffi.ct*
+---@param nelem? integer
+---@return integer|nil size
+function ffi.sizeof(ct, nelem) end
+
+---@param ct ffi.ct*
+---@return integer align
+function ffi.alignof(ct) end
+
+---@param ct ffi.ct*
+---@param field string
+---@return integer ofs
+---@return integer? bpos
+---@return integer? bsize
+function ffi.offsetof(ct, field) end
+
+---@param ct ffi.ct*
+---@param obj any
+---@return boolean status
+function ffi.istype(ct, obj) end
+
+---@param newerr? integer
+---@return integer err
+function ffi.errno(newerr) end
+
+---@param ptr any
+---@param len? integer
+---@return string str
+function ffi.string(ptr, len) end
+
+---@overload fun(dst: any, str: string)
+---@param dst any
+---@param src any
+---@param len integer
+function ffi.copy(dst, src, len) end
+
+---@param dst any
+---@param len integer
+---@param c? any
+function ffi.fill(dst, len, c) end
+
+---@param param string
+---@return boolean status
+function ffi.abi(param) end
+
+function cb:free() end
+
+---@param func function
+function cb:set(func) end
+
+return ffi
diff --git a/meta/template/jit.lua b/meta/template/jit.lua
new file mode 100644
index 00000000..560e1264
--- /dev/null
+++ b/meta/template/jit.lua
@@ -0,0 +1,31 @@
+---@meta
+
+---@version JIT
+---@class jit*
+---@field version string
+---@field version_num number
+---@field os string
+---@field arch string
+jit = {}
+
+---@overload fun()
+---@param func function|boolean
+---@param recursive? boolean
+function jit.on(func, recursive) end
+
+---@overload fun()
+---@param func function|boolean
+---@param recursive? boolean
+function jit.off(func, recursive) end
+
+---@overload fun()
+---@overload fun(tr: number)
+---@param func function|boolean
+---@param recursive? boolean
+function jit.flush(func, recursive) end
+
+---@return boolean status
+---@return ...
+function jit.status() end
+
+return jit