<commit_before>#include <rservr/api/command-table.h>

#include "load-all.h"
#include "python-macro.h"

#include "rservr.h"
#include "command-queue.h"


#define POINTER_GLOBAL_TYPES(macro) \
macro(command_table_info)


#define ALL_GLOBAL_TYPES(macro) \
POINTER_GLOBAL_TYPES(macro)


POINTER_GLOBAL_TYPES(DEFINE_POINTER_TYPE_WRAPPER)


ALL_GLOBAL_TYPES(TYPE_WRAPPER_COMPARE_DEFINE)



static PyObject *python_command_table_info_getattro(python_command_table_info *self, PyObject *name_object)
{
	if (!self || !self->pointer) return auto_exception(PyExc_IndexError, "");
	const char *name = NULL;
	if (!(name = PyString_AsString(name_object))) return NULL;

	//TODO: use a 'std::map' here

	if (0);

	STRING_CASE(name, "name")
	{
	return Py_BuildValue("s", self->pointer->name);
	}

	STRING_CASE(name, "alias")
	{
	return Py_BuildValue("s", self->pointer->alias);
	}

	STRING_CASE(name, "info")
	{
	return Py_BuildValue("s", self->pointer->info);
	}

	STRING_CASE(name, "type")
	{
	return Py_BuildValue("l", self->pointer->type);
	}

	else return PyObject_GenericGetAttr((PyObject*) self, name_object);
}



static void python_command_table_info_dealloc(python_command_table_info *self)
{
	free((void*) self->pointer);
	self->pointer = NULL;
	self->ob_type->tp_free((PyObject*) self);
}



TYPE_BINDING_START(command_table_info, "proxy to 'struct command_table_info'")
	,tp_dealloc:  (destructor)   &python_command_table_info_dealloc
	,tp_getattro: (getattrofunc) &python_command_table_info_getattro
	,tp_flags:    Py_TPFLAGS_DEFAULT
	,tp_compare:  (cmpfunc) &TYPE_WRAPPER_COMPARE(command_table_info)
TYPE_BINDING_END(command_table_info)



POINTER_GLOBAL_TYPES(NEW_POINTER_TYPE_WRAPPER_DEFINE)



#define ALL_GLOBAL_BINDINGS(macro) \
macro(check_command_loaded) \
macro(check_command_can_create) \
macro(command_information) \<commit_msg>gamma.10 - removed unused sources and updated command-table getattro<commit_after>#include <rservr/api/command-table.h>

#include "load-all.h"
#include "python-macro.h"

#include "rservr.h"
#include "command-queue.h"


#define POINTER_GLOBAL_TYPES(macro) \
macro(command_table_info)


#define ALL_GLOBAL_TYPES(macro) \
POINTER_GLOBAL_TYPES(macro)


POINTER_GLOBAL_TYPES(DEFINE_POINTER_TYPE_WRAPPER)


ALL_GLOBAL_TYPES(TYPE_WRAPPER_COMPARE_DEFINE)



#define ALL_COMMAND_TABLE_INFO_GETATTR(macro) \
macro(command_table_info, name) \
macro(command_table_info, alias) \
macro(command_table_info, info) \
macro(command_table_info, type)


TYPE_GETATTR(command_table_info, name,  Py_BuildValue("s", SELF->pointer->name))
TYPE_GETATTR(command_table_info, alias, Py_BuildValue("s", SELF->pointer->alias))
TYPE_GETATTR(command_table_info, info,  Py_BuildValue("s", SELF->pointer->info))
TYPE_GETATTR(command_table_info, type,  Py_BuildValue("l", (long) SELF->pointer->type))


static PyObject *python_command_table_info_getattro(python_command_table_info *self, PyObject *name_object)
{
	if (!self || !self->pointer) return auto_exception(PyExc_IndexError, "");
	const char *name = NULL;
	if (!(name = PyString_AsString(name_object))) return NULL;

	return TYPE_GETATTR_CALL(command_table_info, self, name_object);
}


static void python_command_table_info_dealloc(python_command_table_info *self)
{
	free((void*) self->pointer);
	self->pointer = NULL;
	self->ob_type->tp_free((PyObject*) self);
}



TYPE_BINDING_START(command_table_info, "proxy to 'struct command_table_info'")
	,tp_dealloc:  (destructor)   &python_command_table_info_dealloc
	,tp_getattro: (getattrofunc) &python_command_table_info_getattro
	,tp_flags:    Py_TPFLAGS_DEFAULT
	,tp_compare:  (cmpfunc) &TYPE_WRAPPER_COMPARE(command_table_info)
TYPE_BINDING_END(command_table_info)



POINTER_GLOBAL_TYPES(NEW_POINTER_TYPE_WRAPPER_DEFINE)



#define ALL_GLOBAL_BINDINGS(macro) \
macro(check_command_loaded) \
macro(check_command_can_create) \
macro(command_information) \
{'fraction_non_alphanumeric': 0.12002069322296947, 'fraction_numerical': 0.0007759958613554061, 'mean_word_length': 7.7687074829931975, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 31, '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': '2255375', 'n_tokens_mistral': 1479, 'n_tokens_neox': 1454, 'n_words': 212}