<commit_before>local ffi     = require "ffi"

local function orequire(...)
  local err = ""
  for _, name in ipairs{...} do
    local ok, mod = pcall(require, name)
    if ok then return mod, name end
    err = err .. "\n" .. mod
  end
  error(err)
end

local function oload(...)
  local err = ""
  for _, name in ipairs{...} do
    local ok, mod = pcall(ffi.load, name)
    if ok then return mod, name end
    err = err .. "\n" .. mod
  end
  error(err)
end

local bit     = orequire("bit32", "bit")

local ok, libzmq3 = pcall( oload, "zmq3", "libzmq3", "zmq", "libzmq" )
if (not ok) and pcall( require, "lzmq" ) then -- jus to load libzmq3
  libzmq3 = oload( "zmq3", "libzmq3", "zmq", "libzmq" )
else
  error(libzmq3)
end

ffi.cdef[[
  typedef struct zmq_msg_t {unsigned char _ [32];} zmq_msg_t;

  void zmq_version (int *major, int *minor, int *patch);
  int zmq_errno (void);
  const char *zmq_strerror (int errnum);

  void *zmq_ctx_new (void);<commit_msg>Fix. load zmq library in ffi.api module.<commit_after>local ffi     = require "ffi"

local function orequire(...)
  local err = ""
  for _, name in ipairs{...} do
    local ok, mod = pcall(require, name)
    if ok then return mod, name end
    err = err .. "\n" .. mod
  end
  error(err)
end

local function oload(...)
  local err = ""
  for _, name in ipairs{...} do
    local ok, mod = pcall(ffi.load, name)
    if ok then return mod, name end
    err = err .. "\n" .. mod
  end
  error(err)
end

local bit     = orequire("bit32", "bit")

local ok, libzmq3 = pcall( oload, "zmq3", "libzmq3", "zmq", "libzmq" )
if not ok then
  if pcall( require, "lzmq" ) then -- jus to load libzmq3
    libzmq3 = oload( "zmq3", "libzmq3", "zmq", "libzmq" )
  else error(libzmq3) end
end

ffi.cdef[[
  typedef struct zmq_msg_t {unsigned char _ [32];} zmq_msg_t;

  void zmq_version (int *major, int *minor, int *patch);
  int zmq_errno (void);
  const char *zmq_strerror (int errnum);

  void *zmq_ctx_new (void);
{'fraction_non_alphanumeric': 0.147524247064829, 'fraction_numerical': 0.01225114854517611, 'mean_word_length': 2.9516129032258065, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2807841', 'n_tokens_mistral': 783, 'n_tokens_neox': 770, 'n_words': 253}