<commit_before>// This code is GPLed by <NAME>

#include <Python.h>
#include <structmember.h>
#include <libvex.h>

#include "pyvex_enums.h"
#include "pyvex_types.h"
#include "pyvex_macros.h"

#ifdef PYVEX_STATIC
	#include "pyvex_static.h"
	#include "pyvex_deepcopy.h"
#endif

PYMARE_NEW(IRCallee)
PYMARE_DEALLOC(IRCallee)
PYMARE_WRAP(IRCallee)
PYVEX_METH_STANDARD(IRCallee)

static int
pyIRCallee_init(pyIRCallee *self, PyObject *args, PyObject *kwargs)
{
	PYMARE_WRAP_CONSTRUCTOR(IRCallee);

	Int regparms;
	char *name;
	UInt mcx_mask = 123456789;
	unsigned long long addr;

	static char *kwlist[] = {"regparms", "name", "addr", "mcx_mask", NULL};
	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "isK|I", kwlist, &regparms, &name, &addr, &mcx_mask)) return -1;
	if (regparms < 0 || regparms > 3) { PYMARE_SETSTRING(PyVEXError, "regparms out of range"); return -1; }

	self->wrapped = PYVEX_COPYOUT(IRCallee, mkIRCallee(regparms, name, (void *)addr));
	if (mcx_mask != 123456789) self->wrapped->mcx_mask = mcx_mask;
	return 0;
}

static PyMemberDef pyIRCallee_members[] = { {NULL} };

PYMARE_ACCESSOR_WRAPPED(IRCallee, IRCallee, self->wrapped, wrapped, IRCallee)
PYMARE_ACCESSOR_BUILDVAL(IRCallee, IRCallee, self->wrapped->regparms, regparms, "i")
PYMARE_ACCESSOR_BUILDVAL(IRCallee, IRCallee, self->wrapped->name, name, "s")
PYMARE_ACCESSOR_BUILDVAL(IRCallee, IRCallee, self->wrapped->mcx_mask, mcx_mask, "I")
PYMARE_ACCESSOR_BUILDVAL(IRCallee, IRCallee, self->wrapped->addr, addr, "K")

static PyGetSetDef pyIRCallee_getseters[] =
{
	PYMARE_ACCESSOR_DEF(IRCallee, wrapped),
	PYMARE_ACCESSOR_DEF(IRCallee, regparms),
	PYMARE_ACCESSOR_DEF(IRCallee, name),
	PYMARE_ACCESSOR_DEF(IRCallee, mcx_mask),
	PYMARE_ACCESSOR_DEF(IRCallee, addr),
	{NULL}
};

static PyMethodDef pyIRCallee_methods[] =
{
	PYVEX_METHDEF_STANDARD(IRCallee),
	{NULL}  /* Sentinel */<commit_msg>properly copy the string out<commit_after>// This code is GPLed by <NAME>

#include <Python.h>
#include <structmember.h>
#include <libvex.h>

#include "pyvex_enums.h"
#include "pyvex_types.h"
#include "pyvex_macros.h"

#ifdef PYVEX_STATIC
	#include "pyvex_static.h"
	#include "pyvex_deepcopy.h"
#endif

PYMARE_NEW(IRCallee)
PYMARE_DEALLOC(IRCallee)
PYMARE_WRAP(IRCallee)
PYVEX_METH_STANDARD(IRCallee)

static int
pyIRCallee_init(pyIRCallee *self, PyObject *args, PyObject *kwargs)
{
	PYMARE_WRAP_CONSTRUCTOR(IRCallee);

	Int regparms;
	char *name;
	UInt mcx_mask = 123456789;
	unsigned long long addr;

	static char *kwlist[] = {"regparms", "name", "addr", "mcx_mask", NULL};
	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "isK|I", kwlist, &regparms, &name, &addr, &mcx_mask)) return -1;
	if (regparms < 0 || regparms > 3) { PYMARE_SETSTRING(PyVEXError, "regparms out of range"); return -1; }

	// TODO: free this string
	self->wrapped = PYVEX_COPYOUT(IRCallee, mkIRCallee(regparms, strdup(name), (void *)addr));
	if (mcx_mask != 123456789) self->wrapped->mcx_mask = mcx_mask;
	return 0;
}

static PyMemberDef pyIRCallee_members[] = { {NULL} };

PYMARE_ACCESSOR_WRAPPED(IRCallee, IRCallee, self->wrapped, wrapped, IRCallee)
PYMARE_ACCESSOR_BUILDVAL(IRCallee, IRCallee, self->wrapped->regparms, regparms, "i")
PYMARE_ACCESSOR_BUILDVAL(IRCallee, IRCallee, self->wrapped->name, name, "s")
PYMARE_ACCESSOR_BUILDVAL(IRCallee, IRCallee, self->wrapped->mcx_mask, mcx_mask, "I")
PYMARE_ACCESSOR_BUILDVAL(IRCallee, IRCallee, self->wrapped->addr, addr, "K")

static PyGetSetDef pyIRCallee_getseters[] =
{
	PYMARE_ACCESSOR_DEF(IRCallee, wrapped),
	PYMARE_ACCESSOR_DEF(IRCallee, regparms),
	PYMARE_ACCESSOR_DEF(IRCallee, name),
	PYMARE_ACCESSOR_DEF(IRCallee, mcx_mask),
	PYMARE_ACCESSOR_DEF(IRCallee, addr),
	{NULL}
};

static PyMethodDef pyIRCallee_methods[] =
{
	PYVEX_METHDEF_STANDARD(IRCallee),
	{NULL}  /* Sentinel */
{'fraction_non_alphanumeric': 0.13547189819724284, 'fraction_numerical': 0.012195121951219513, 'mean_word_length': 7.184381778741866, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 37, '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': '5794542', 'n_tokens_mistral': 1704, 'n_tokens_neox': 1580, 'n_words': 294}