Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. --[[
  2. Copyright (c) 2019, Vsevolod Stakhov <vsevolod@highsecure.ru>
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ]]--
  13. --[[[
  14. -- @module lua_ffi
  15. -- This module contains ffi interfaces (requires luajit or lua-ffi)
  16. --]]
  17. local ffi
  18. local exports = {}
  19. if type(jit) == 'table' then
  20. ffi = require "ffi"
  21. local NULL = ffi.new 'void*'
  22. exports.is_null = function(o)
  23. return o ~= NULL
  24. end
  25. else
  26. local ret,result_or_err = pcall(require, 'ffi')
  27. if not ret then
  28. io.stderr:write('FFI support is required: please use LuaJIT or install lua-ffi')
  29. os.exit(1)
  30. end
  31. ffi = result_or_err
  32. -- Lua ffi
  33. local NULL = ffi.NULL or ffi.C.NULL
  34. exports.is_null = function(o)
  35. return o ~= NULL
  36. end
  37. end
  38. exports.common = require "lua_ffi/common"
  39. exports.dkim = require "lua_ffi/dkim"
  40. return exports