<commit_before>#!/usr/bin/lua

local binder = {}
local B = nil

-- a string devised to not compile. should not make into code. never.
binder.ERRORSTRING = '<<>>'
binder.WRAPCALL = '__LuaWrapCall__'
binder.debug_type = function(el) return (type(el)=='table'and (el.tag .. ' ' .. el.attr.id) or el) end

function binder:init(filename)
  --require 'lxp'
  --require 'lxp.lom'
  
  if not self.tree then
    local xmlf = io.open(filename, 'r')
    local xmls = xmlf:read('*a')
    xmlf:close()
    --self.tree = lxp.lom.parse(xmls)
		self.tree = xml:collect(xmls)
  end
  
  self.type_names = {}
  self.types_to_stack = {
    ['const char *'] = function(i) return 'lua_pushstring(L, ' .. tostring(i) .. ')' end,
    ['short int'] =              function(i) return 'lua_pushinteger(L, ' .. tostring(i) .. ')' end,
    ['unsigned short int'] =     function(i) return 'lua_pushinteger(L, ' .. tostring(i) .. ')' end,
    ['int'] =                    function(i) return 'lua_pushinteger(L, ' .. tostring(i) .. ')' end,
    ['unsigned int'] =           function(i) return 'lua_pushinteger(L, ' .. tostring(i) .. ')' end,
    ['long int'] =               function(i) return 'lua_pushinteger(L, ' .. tostring(i) .. ')' end,
    ['unsigned long int'] =      function(i) return 'lua_pushinteger(L, ' .. tostring(i) .. ')' end,
    ['long unsigned int'] =      function(i) return 'lua_pushinteger(L, ' .. tostring(i) .. ')' end,
    ['long long int'] =          function(i) return 'lua_pushinteger(L, ' .. tostring(i) .. ')' end,
    ['unsigned long long int'] = function(i) return 'lua_pushinteger(L, ' .. tostring(i) .. ')' end,
    ['float'] =  function(i) return 'lua_pushnumber(L, ' .. tostring(i) .. ')' end,
    ['double'] = function(i) return 'lua_pushnumber(L, ' .. tostring(i) .. ')' end,
    ['bool'] = function(i) return 'lua_pushboolean(L, ' .. tostring(i) .. ')' end,
    ['void *'] =   function(i) return 'lua_pushlightuserdata(L, ' .. tostring(i) .. ')' end,
    ['void * *'] = function(i) return 'lua_pushlightuserdata(L, ' .. tostring(i) .. ')' end,
  }
  self.types_from_stack = {
    ['const char *'] = function(i) return 'lua_tostring(L, ' .. tostring(i) .. ')' end,
    ['short int'] =              function(i) return 'lua_tointeger(L, ' .. tostring(i) .. ')' end,
    ['unsigned short int'] =     function(i) return 'lua_tointeger(L, ' .. tostring(i) .. ')' end,
    ['int'] =                    function(i) return 'lua_tointeger(L, ' .. tostring(i) .. ')' end,
    ['unsigned int'] =           function(i) return 'lua_tointeger(L, ' .. tostring(i) .. ')' end,
    ['long int'] =               function(i) return 'lua_tointeger(L, ' .. tostring(i) .. ')' end,
    ['unsigned long int'] =      function(i) return 'lua_tointeger(L, ' .. tostring(i) .. ')' end,
    ['long unsigned int'] =      function(i) return 'lua_tointeger(L, ' .. tostring(i) .. ')' end,
    ['long long int'] =          function(i) return 'lua_tointeger(L, ' .. tostring(i) .. ')' end,
    ['unsigned long long int'] = function(i) return 'lua_tointeger(L, ' .. tostring(i) .. ')' end,
    ['float'] =  function(i) return 'lua_tonumber(L, ' .. tostring(i) .. ')' end,
    ['double'] = function(i) return 'lua_tonumber(L, ' .. tostring(i) .. ')' end,
    ['bool'] = function(i) return '(bool)lua_toboolean(L, ' .. tostring(i) .. ')' end,
    ['void *'] =   function(i) return 'lua_touserdata(L, ' .. tostring(i) .. ')' end,
    ['void * *'] = function(i) return 'static_cast<void **>(lua_touserdata(L, ' .. tostring(i) .. '))' end,
  }
  self.types_test = {
    ['const char *'] = function(i) return '(lua_type(L, ' .. tostring(i) .. ')==LUA_TSTRING)' end,
    ['short int'] =              function(i) return 'lua_isnumber(L, ' .. tostring(i) .. ')' end,
    ['unsigned short int'] =     function(i) return 'lua_isnumber(L, ' .. tostring(i) .. ')' end,
    ['int'] =                    function(i) return 'lua_isnumber(L, ' .. tostring(i) .. ')' end,
    ['unsigned int'] =           function(i) return 'lua_isnumber(L, ' .. tostring(i) .. ')' end,
    ['long int'] =               function(i) return 'lua_isnumber(L, ' .. tostring(i) .. ')' end,
    ['unsigned long int'] =      function(i) return 'lua_isnumber(L, ' .. tostring(i) .. ')' end,
    ['long unsigned int'] =      function(i) return 'lua_isnumber(L, ' .. tostring(i) .. ')' end,
    ['long long int'] =          function(i) return 'lua_isnumber(L, ' .. tostring(i) .. ')' end,
    ['unsigned long long int'] = function(i) return 'lua_isnumber(L, ' .. tostring(i) .. ')' end,
    ['float'] =  function(i) return 'lua_isnumber(L, ' .. tostring(i) .. ')' end,
    ['double'] = function(i) return 'lua_isnumber(L, ' .. tostring(i) .. ')' end,
    ['bool'] = function(i) return 'lua_isboolean(L, ' .. tostring(i) .. ')' end,<commit_msg>added a permutation of unsigned short int to known types<commit_after>#!/usr/bin/lua

local binder = {}
local B = nil

-- a string devised to not compile. should not make into code. never.
binder.ERRORSTRING = '<<>>'
binder.WRAPCALL = '__LuaWrapCall__'
binder.debug_type = function(el) return (type(el)=='table'and (el.tag .. ' ' .. el.attr.id) or el) end

function binder:init(filename)
  --require 'lxp'
  --require 'lxp.lom'
  
  if not self.tree then
    local xmlf = io.open(filename, 'r')
    local xmls = xmlf:read('*a')
    xmlf:close()
    --self.tree = lxp.lom.parse(xmls)
		self.tree = xml:collect(xmls)
  end
  
  self.type_names = {}
  self.types_to_stack = {
    ['const char *'] = function(i) return 'lua_pushstring(L, ' .. tostring(i) .. ')' end,
    ['short int'] =              function(i) return 'lua_pushinteger(L, ' .. tostring(i) .. ')' end,
    ['unsigned short int'] =     function(i) return 'lua_pushinteger(L, ' .. tostring(i) .. ')' end,
    ['short unsigned int'] =     function(i) return 'lua_pushinteger(L, ' .. tostring(i) .. ')' end,
    ['int'] =                    function(i) return 'lua_pushinteger(L, ' .. tostring(i) .. ')' end,
    ['unsigned int'] =           function(i) return 'lua_pushinteger(L, ' .. tostring(i) .. ')' end,
    ['long int'] =               function(i) return 'lua_pushinteger(L, ' .. tostring(i) .. ')' end,
    ['unsigned long int'] =      function(i) return 'lua_pushinteger(L, ' .. tostring(i) .. ')' end,
    ['long unsigned int'] =      function(i) return 'lua_pushinteger(L, ' .. tostring(i) .. ')' end,
    ['long long int'] =          function(i) return 'lua_pushinteger(L, ' .. tostring(i) .. ')' end,
    ['unsigned long long int'] = function(i) return 'lua_pushinteger(L, ' .. tostring(i) .. ')' end,
    ['float'] =  function(i) return 'lua_pushnumber(L, ' .. tostring(i) .. ')' end,
    ['double'] = function(i) return 'lua_pushnumber(L, ' .. tostring(i) .. ')' end,
    ['bool'] = function(i) return 'lua_pushboolean(L, ' .. tostring(i) .. ')' end,
    ['void *'] =   function(i) return 'lua_pushlightuserdata(L, ' .. tostring(i) .. ')' end,
    ['void * *'] = function(i) return 'lua_pushlightuserdata(L, ' .. tostring(i) .. ')' end,
  }
  self.types_from_stack = {
    ['const char *'] = function(i) return 'lua_tostring(L, ' .. tostring(i) .. ')' end,
    ['short int'] =              function(i) return 'lua_tointeger(L, ' .. tostring(i) .. ')' end,
    ['unsigned short int'] =     function(i) return 'lua_tointeger(L, ' .. tostring(i) .. ')' end,
    ['short unsigned int'] =     function(i) return 'lua_tointeger(L, ' .. tostring(i) .. ')' end,
    ['int'] =                    function(i) return 'lua_tointeger(L, ' .. tostring(i) .. ')' end,
    ['unsigned int'] =           function(i) return 'lua_tointeger(L, ' .. tostring(i) .. ')' end,
    ['long int'] =               function(i) return 'lua_tointeger(L, ' .. tostring(i) .. ')' end,
    ['unsigned long int'] =      function(i) return 'lua_tointeger(L, ' .. tostring(i) .. ')' end,
    ['long unsigned int'] =      function(i) return 'lua_tointeger(L, ' .. tostring(i) .. ')' end,
    ['long long int'] =          function(i) return 'lua_tointeger(L, ' .. tostring(i) .. ')' end,
    ['unsigned long long int'] = function(i) return 'lua_tointeger(L, ' .. tostring(i) .. ')' end,
    ['float'] =  function(i) return 'lua_tonumber(L, ' .. tostring(i) .. ')' end,
    ['double'] = function(i) return 'lua_tonumber(L, ' .. tostring(i) .. ')' end,
    ['bool'] = function(i) return '(bool)lua_toboolean(L, ' .. tostring(i) .. ')' end,
    ['void *'] =   function(i) return 'lua_touserdata(L, ' .. tostring(i) .. ')' end,
    ['void * *'] = function(i) return 'static_cast<void **>(lua_touserdata(L, ' .. tostring(i) .. '))' end,
  }
  self.types_test = {
    ['const char *'] = function(i) return '(lua_type(L, ' .. tostring(i) .. ')==LUA_TSTRING)' end,
    ['short int'] =              function(i) return 'lua_isnumber(L, ' .. tostring(i) .. ')' end,
    ['unsigned short int'] =     function(i) return 'lua_isnumber(L, ' .. tostring(i) .. ')' end,
    ['short unsigned int'] =     function(i) return 'lua_isnumber(L, ' .. tostring(i) .. ')' end,
    ['int'] =                    function(i) return 'lua_isnumber(L, ' .. tostring(i) .. ')' end,
    ['unsigned int'] =           function(i) return 'lua_isnumber(L, ' .. tostring(i) .. ')' end,
    ['long int'] =               function(i) return 'lua_isnumber(L, ' .. tostring(i) .. ')' end,
    ['unsigned long int'] =      function(i) return 'lua_isnumber(L, ' .. tostring(i) .. ')' end,
    ['long unsigned int'] =      function(i) return 'lua_isnumber(L, ' .. tostring(i) .. ')' end,
    ['long long int'] =          function(i) return 'lua_isnumber(L, ' .. tostring(i) .. ')' end,
    ['unsigned long long int'] = function(i) return 'lua_isnumber(L, ' .. tostring(i) .. ')' end,
    ['float'] =  function(i) return 'lua_isnumber(L, ' .. tostring(i) .. ')' end,
    ['double'] = function(i) return 'lua_isnumber(L, ' .. tostring(i) .. ')' end,
    ['bool'] = function(i) return 'lua_isboolean(L, ' .. tostring(i) .. ')' end,
{'fraction_non_alphanumeric': 0.21553555173460098, 'fraction_numerical': 0.0, 'mean_word_length': 2.7383742911153117, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 14}, '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': '6902229', 'n_tokens_mistral': 3550, 'n_tokens_neox': 3531, 'n_words': 756}